1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-22 15:01:17 +00:00

Improve Matches: Part 4 (#1545)

* more improvements

* small cleanup

* PR Review
This commit is contained in:
engineer124 2023-09-25 01:51:03 +10:00 committed by GitHub
parent fefeb369dd
commit 873c55faad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 426 additions and 413 deletions

View file

@ -197,50 +197,53 @@ void ArrowLight_Draw(Actor* thisx, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
Actor* transform;
if (1) {}
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
if (1) {}
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 598);
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY);
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
// Draw yellow effect over the screen when arrow hits
if (this->unk_164 > 0) {
POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF,
(s32)(40.0f * this->unk_164) & 0xFF, 0, (s32)(150.0f * this->unk_164) & 0xFF);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
}
// Draw light on the arrow
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128);
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
if (this->timer != 0) {
Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} else {
Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY);
}
Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_light.c", 648),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1,
511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 664);
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
return;
}
if (this->timer >= 255) {
return;
}
transform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor;
OPEN_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 598);
Matrix_Translate(transform->world.pos.x, transform->world.pos.y, transform->world.pos.z, MTXMODE_NEW);
Matrix_RotateY(BINANG_TO_RAD(transform->shape.rot.y), MTXMODE_APPLY);
Matrix_RotateX(BINANG_TO_RAD(transform->shape.rot.x), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD(transform->shape.rot.z), MTXMODE_APPLY);
Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY);
// Draw yellow effect over the screen when arrow hits
if (this->unk_164 > 0) {
POLY_XLU_DISP = Gfx_SetupDL_57(POLY_XLU_DISP);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF, (s32)(40.0f * this->unk_164) & 0xFF,
0, (s32)(150.0f * this->unk_164) & 0xFF);
gDPSetAlphaDither(POLY_XLU_DISP++, G_AD_DISABLE);
gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
gDPFillRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1);
}
// Draw light on the arrow
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128);
Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY);
if (this->timer != 0) {
Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} else {
Matrix_Translate(0.0f, 1500.0f, 0.0f, MTXMODE_APPLY);
}
Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY);
Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_arrow_light.c", 648),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, sMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1,
511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 664);
}