Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements drugs powerup #302

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions src/DETHRACE/common/depth.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,26 +639,36 @@ void DoWobbleCamera(br_actor* pCamera) {
// IDA: void __usercall DoDrugWobbleCamera(br_actor *pCamera@<EAX>)
void DoDrugWobbleCamera(br_actor* pCamera) {
float f_time;
static br_scalar mag00;
static br_scalar mag01;
static br_scalar mag02;
static br_scalar mag10;
static br_scalar mag11;
static br_scalar mag12;
static br_scalar mag20;
static br_scalar mag21;
static br_scalar mag22;
static float period00;
static float period01;
static float period02;
static float period10;
static float period11;
static float period12;
static float period20;
static float period21;
static float period22;
static br_scalar mag00 = 0.03f;
static br_scalar mag01 = 0.03f;
static br_scalar mag02 = 0.03f;
static br_scalar mag10 = 0.2f;
static br_scalar mag11 = 0.07;
static br_scalar mag12 = 0.03f;
static br_scalar mag20 = 0.02f;
static br_scalar mag21 = 0.03f;
static br_scalar mag22 = 0.01f;
static float period00 = 550.f;
static float period01 = 700.f;
static float period02 = 200.f;
static float period10 = 100.f;
static float period11 = 1300.f;
static float period12 = 500.f;
static float period20 = 800.f;
static float period21 = 1500.f;
static float period22 = 300.f;
LOG_TRACE("(%p)", pCamera);
NOT_IMPLEMENTED();

f_time = (float)PDGetTotalTime();
pCamera->t.t.mat.m[0][0] += FastScalarSin(fmod(f_time / period00 * 360.f, 360.f)) * mag00;
pCamera->t.t.mat.m[0][1] += FastScalarSin(fmod(f_time / period01 * 360.f, 360.f)) * mag01;
pCamera->t.t.mat.m[0][2] += FastScalarSin(fmod(f_time / period02 * 360.f, 360.f)) * mag02;
pCamera->t.t.mat.m[1][0] += FastScalarSin(fmod(f_time / period10 * 360.f, 360.f)) * mag10;
pCamera->t.t.mat.m[1][1] += FastScalarSin(fmod(f_time / period11 * 360.f, 360.f)) * mag11;
pCamera->t.t.mat.m[1][2] += FastScalarSin(fmod(f_time / period12 * 360.f, 360.f)) * mag12;
pCamera->t.t.mat.m[2][0] += FastScalarSin(fmod(f_time / period20 * 360.f, 360.f)) * mag20;
pCamera->t.t.mat.m[2][1] += FastScalarSin(fmod(f_time / period21 * 360.f, 360.f)) * mag21;
pCamera->t.t.mat.m[2][2] += FastScalarSin(fmod(f_time / period22 * 360.f, 360.f)) * mag22;
}

// IDA: void __usercall DoSpecialCameraEffect(br_actor *pCamera@<EAX>, br_matrix34 *pCamera_to_world@<EDX>)
Expand Down
2 changes: 1 addition & 1 deletion src/DETHRACE/common/powerup.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ void PaletteFuckedUpByDrugs(br_pixelmap* pPixelmap, int pOffset) {
int i;
LOG_TRACE("(%p, %d)", pPixelmap, pOffset);

*(tU32*)gRender_palette->pixels = *gReal_render_palette;
((tU32*)gRender_palette->pixels)[0] = gReal_render_palette[0];
for (i = 1; i < 224; i++) {
((tU32*)gRender_palette->pixels)[i] = gReal_render_palette[(i + pOffset) & 0xff];
}
Expand Down