1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 23:36:22 +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

@ -200,10 +200,15 @@ void ArrowFire_Draw(Actor* thisx, PlayState* play2) {
stateFrames = play->state.frames;
arrow = (EnArrow*)this->actor.parent;
if (1) {}
if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) {
if (1) {}
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_fire.c", 618);
@ -240,10 +245,9 @@ void ArrowFire_Draw(Actor* thisx, PlayState* play2) {
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, 255 - (stateFrames * 2) % 256, 0, 64, 32,
1, 255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64));
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1,
255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_fire.c", 682);
}
}

View file

@ -199,10 +199,14 @@ void ArrowIce_Draw(Actor* thisx, PlayState* play) {
u32 stateFrames = play->state.frames;
EnArrow* arrow = (EnArrow*)this->actor.parent;
if (1) {}
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
return;
}
if (this->timer >= 255) {
return;
}
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_ice.c", 610);
@ -239,10 +243,9 @@ void ArrowIce_Draw(Actor* thisx, PlayState* play) {
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, 128, 32,
1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16));
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1,
511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16));
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_ice.c", 676);
}
}

View file

@ -197,10 +197,14 @@ void ArrowLight_Draw(Actor* thisx, PlayState* play) {
EnArrow* arrow = (EnArrow*)this->actor.parent;
Actor* transform;
if (1) {}
if ((arrow == NULL) || (arrow->actor.update == NULL)) {
return;
}
if (this->timer >= 255) {
return;
}
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);
@ -214,8 +218,8 @@ void ArrowLight_Draw(Actor* thisx, PlayState* play) {
// 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);
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);
@ -242,5 +246,4 @@ void ArrowLight_Draw(Actor* thisx, PlayState* play) {
gSPDisplayList(POLY_XLU_DISP++, sModelDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_arrow_light.c", 664);
}
}

View file

@ -100,10 +100,11 @@ void BgGndDarkmeiro_Destroy(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
BgGndDarkmeiro* this = (BgGndDarkmeiro*)thisx;
if ((this->dyna.actor.params & 0xFF) == 1) {
if (1) {}
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if ((this->dyna.actor.params & 0xFF) != 1) {
return;
}
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void BgGndDarkmeiro_Noop(BgGndDarkmeiro* this, PlayState* play) {

View file

@ -51,10 +51,11 @@ void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
BgGndFiremeiro* this = (BgGndFiremeiro*)thisx;
if (this->dyna.actor.params == 0) {
if (1) {}
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if (this->dyna.actor.params != 0) {
return;
}
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play) {

View file

@ -298,16 +298,17 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) {
z = (88.0f - spBC.z) * 0.64f + 0.5f;
for (k = 0; k < 11; k++) {
temp_z = z - 5 + k;
if (!(temp_z & ~0x3F)) {
if (temp_z & ~0x3F) {
continue;
}
temp_z *= 0x40;
for (l = 0; l < 11; l++) {
temp_x = x - 5 + l;
if (!(temp_x & ~0x3F)) {
if (temp_x & ~0x3F) {
continue;
}
shadowTex[temp_z + temp_x] |= D_8089731C[k][l];
}
if (1) {}
}
}
}
}
}
@ -326,18 +327,20 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) {
z = (s32)(((88.0f - spBC.z) * 0.64f) + 0.5f);
for (k = 0; k < 3; k++) {
temp_z = z - 1 + k;
if (!(temp_z & ~0x3F)) {
if (temp_z & ~0x3F) {
continue;
}
temp_z *= 0x40;
for (l = 0; l < 3; l++) {
temp_x = x - 1 + l;
if (!(temp_x & ~0x3F)) {
if (temp_x & ~0x3F) {
continue;
}
shadowTex[temp_z + temp_x] |= D_80897398[k][l];
}
}
}
}
}
}
for (i = 0; i < 0x40; i++) {
shadowTex[0 * 0x40 + i] = 0;
@ -348,7 +351,6 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) {
shadowTex[j * 0x40 + 0] = 0;
shadowTex[j * 0x40 + 0x3F] = 0;
}
if (D_80897398[0][0]) {}
}
/*

View file

@ -137,24 +137,20 @@ void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play) {
void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) {
BgSpot00Hanebasi* child = (BgSpot00Hanebasi*)this->dyna.actor.child;
if (IS_CUTSCENE_LAYER || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY) ||
!CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) || GET_EVENTCHKINF(EVENTCHKINF_80)) {
if (this->dyna.actor.shape.rot.x != 0) {
if (CutsceneFlags_Get(play, 0) || (!IS_CUTSCENE_LAYER && IS_DAY)) {
this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall;
this->destAngle = 0;
child->destAngle = 0;
if (!IS_CUTSCENE_LAYER && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) &&
CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !GET_EVENTCHKINF(EVENTCHKINF_80)) {
return;
}
if (this) {} // required to match
}
if ((this->dyna.actor.shape.rot.x == 0) && !IS_CUTSCENE_LAYER && !LINK_IS_ADULT && !IS_DAY) {
if ((this->dyna.actor.shape.rot.x != 0) && (CutsceneFlags_Get(play, 0) || (!IS_CUTSCENE_LAYER && IS_DAY))) {
this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall;
this->destAngle = 0;
child->destAngle = 0;
} else if ((this->dyna.actor.shape.rot.x == 0) && !IS_CUTSCENE_LAYER && !LINK_IS_ADULT && !IS_DAY) {
this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall;
this->destAngle = -0x4000;
child->destAngle = -0xFE0;
}
}
}
void BgSpot00Hanebasi_DoNothing(BgSpot00Hanebasi* this, PlayState* play) {

View file

@ -932,7 +932,6 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) {
} else if (this->unk_224 > 1.7f) {
phi_s0_3 = 3;
sp90 = 1;
if (play) {}
magma2DrawMode = 0;
} else if (this->unk_224 > 1.4f) {
phi_s0_3 = 7;
@ -1025,9 +1024,10 @@ void BossDodongo_Update(Actor* thisx, PlayState* play2) {
this->collider.elements[0].dim.scale = (this->actionFunc == BossDodongo_Inhale) ? 0.0f : 1.0f;
for (i = 6; i < 19; i++) {
if (i != 12) {
this->collider.elements[i].dim.scale = (this->actionFunc == BossDodongo_Roll) ? 0.0f : 1.0f;
if (i == 12) {
continue;
}
this->collider.elements[i].dim.scale = (this->actionFunc == BossDodongo_Roll) ? 0.0f : 1.0f;
}
if (this->unk_244 != 0) {

View file

@ -1914,8 +1914,6 @@ void BossGoma_Update(Actor* thisx, PlayState* play) {
this->sfxFaintTimer--;
}
if (1) {}
this->eyeState = EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES;
this->actionFunc(this, play);
this->actor.shape.rot.y = this->actor.world.rot.y;
@ -1937,7 +1935,10 @@ void BossGoma_Update(Actor* thisx, PlayState* play) {
BossGoma_UpdateEyeEnvColor(this);
BossGoma_UpdateTailLimbsScale(this);
if (!this->disableGameplayLogic) {
if (this->disableGameplayLogic) {
return;
}
BossGoma_UpdateHit(this, play);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
@ -1946,7 +1947,6 @@ void BossGoma_Update(Actor* thisx, PlayState* play) {
(this->actionFunc != BossGoma_FloorMain || this->timer == 0)) {
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
}
}
}
s32 BossGoma_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {

View file

@ -920,7 +920,6 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_0;
Math_ApproachF(&this->baseAlpha, 0.0, 1.0f, 5.0f);
for (indS1 = 0; indS1 < 40; indS1++) {
if (sMorphaTent2->tentSpawnPos) {}
indT5 = Rand_ZeroFloat(20.9f);
indS0 = sTentSpawnIndex[indT5];
spFC.x = 0;
@ -930,9 +929,11 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
Matrix_MultVec3f(&spFC, &spF0);
spF0.x = player->actor.world.pos.x + spF0.x;
spF0.z = player->actor.world.pos.z + spF0.z;
if ((fabsf(spF0.x - sTentSpawnPos[indS0].x) <= 320) &&
(fabsf(spF0.z - sTentSpawnPos[indS0].y) <= 320) &&
((sMorphaTent2 == NULL) || (sMorphaTent2->tentSpawnPos != indS0))) {
if (!(fabsf(spF0.x - sTentSpawnPos[indS0].x) <= 320) ||
!(fabsf(spF0.z - sTentSpawnPos[indS0].y) <= 320) ||
((sMorphaTent2 != NULL) && (sMorphaTent2->tentSpawnPos == indS0))) {
continue;
}
this->targetPos.x = sTentSpawnPos[indS0].x;
this->targetPos.z = sTentSpawnPos[indS0].y;
this->tentSpawnPos = indS0;
@ -941,7 +942,6 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
break;
}
}
}
if ((this == sMorphaTent1) && (sMorphaCore->hitCount >= 3) && (sMorphaTent2 == NULL)) {
sMorphaTent2 =
(BossMo*)Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_MO, this->actor.world.pos.x,

View file

@ -2863,9 +2863,6 @@ void BossTw_Update(Actor* thisx, PlayState* play) {
this->blastTailPos[this->work[TAIL_IDX]] = this->actor.world.pos;
if (1) {}
if (1) {}
for (i = 0; i < 5; i++) {
if (this->timers[i] != 0) {
this->timers[i]--;
@ -2890,7 +2887,10 @@ void BossTw_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->actionFunc != BossTw_Wait) {
if (this->actionFunc == BossTw_Wait) {
return;
}
this->collider.dim.radius = 45;
if (this->actionFunc == BossTw_Spin) {
@ -2931,7 +2931,11 @@ void BossTw_Update(Actor* thisx, PlayState* play) {
this->work[BLINK_IDX]--;
}
if (this->actionFunc != BossTw_MergeCS && this->unk_5F8 != 0) {
if ((this->actionFunc == BossTw_MergeCS) || (this->unk_5F8 == 0)) {
return;
}
{
Vec3f pos;
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
Vec3f accel = { 0.0f, 0.0f, 0.0f };
@ -2945,8 +2949,8 @@ void BossTw_Update(Actor* thisx, PlayState* play) {
accel.y = 0.4f;
accel.x = Rand_CenteredFloat(0.5f);
accel.z = Rand_CenteredFloat(0.5f);
BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8,
this->actor.params, 37);
BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params,
37);
}
}
@ -2958,9 +2962,7 @@ void BossTw_Update(Actor* thisx, PlayState* play) {
accel.y = 0.4f;
accel.x = Rand_CenteredFloat(0.5f);
accel.z = Rand_CenteredFloat(0.5f);
BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params,
37);
}
BossTw_AddDotEffect(play, &pos, &velocity, &accel, (s16)Rand_ZeroFloat(2.0f) + 8, this->actor.params, 37);
}
}
}

View file

@ -3285,7 +3285,10 @@ void BossVa_UpdateEffects(PlayState* play) {
BossVa* refActor;
for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type != VA_NONE) {
if (effect->type == VA_NONE) {
continue;
}
effect->timer--;
effect->pos.x += effect->velocity.x;
@ -3479,8 +3482,6 @@ void BossVa_UpdateEffects(PlayState* play) {
}
break;
}
if (1) {}
}
}
}
}