1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-23 07:21:19 +00:00

Mostly match retail bosses, part 1 (#1898)

* Retail bosses part 1

* Use GameState* local variable in BossGanon/BossGanon2 draw helper functions
This commit is contained in:
cadmic 2024-03-01 09:43:02 -08:00 committed by GitHub
parent 3670a48aee
commit c9e97a3055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 240 additions and 205 deletions

View file

@ -184,6 +184,8 @@ void BossGanonEff_SpawnLightRay(PlayState* play, Vec3f* pos, Vec3f* velocity, Ve
for (i = 0; i < 150; i++, eff++) {
if (eff->type == GDF_EFF_NONE) {
s32 pad;
eff->type = GDF_EFF_LIGHT_RAY;
eff->pos = *pos;
eff->velocity = *velocity;
@ -1222,9 +1224,6 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
Vec3f sp98;
Vec3f sp8C;
Vec3f sp80;
Vec3f sp74;
Camera* mainCam;
Vec3f sp64;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
@ -1570,7 +1569,8 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
}
if (this->csTimer == 190) {
sp74 = this->actor.world.pos;
Vec3f sp74 = this->actor.world.pos;
sp74.y = 4102.0f;
BossGanonEff_SpawnDustDark(play, &sp74, 0.2f, 0.7f);
}
@ -1782,7 +1782,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f;
if (this->csTimer > 50) {
mainCam = Play_GetCamera(play, CAM_ID_MAIN);
Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN);
mainCam->eye = this->csCamEye;
mainCam->eyeNext = this->csCamEye;
@ -1807,6 +1807,8 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
}
if (this->csCamIndex != 0) {
Vec3f sp64;
if (moveCam) {
Math_ApproachF(&this->csCamEye.x, this->csCamTargetEye.x, this->csCamMovementScale,
this->csCamEyeMaxStep.x * this->csCamMaxStepScale);
@ -1830,10 +1832,10 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
void BossGanon_SetupPoundFloor(BossGanon* this, PlayState* play) {
this->unk_1C2 = 0;
this->timers[0] = 40;
this->actionFunc = BossGanon_PoundFloor;
this->actor.velocity.x = 0.0f;
this->actor.velocity.y = 0.0f;
this->timers[0] = 40;
this->actionFunc = BossGanon_PoundFloor;
this->fwork[GDF_CENTER_POS] = 100.0f;
}
@ -1844,8 +1846,6 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) {
f32 targetPosZ;
Vec3f sp6C;
Vec3f sp60;
Vec3f sp54;
Vec3f sp48;
SkelAnime_Update(&this->skelAnime);
@ -1951,13 +1951,15 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) {
}
if ((this->unk_19C == 35) || (this->unk_19C == 30) || (this->unk_19C == 25)) {
sp54 = this->actor.world.pos;
Vec3f sp54 = this->actor.world.pos;
sp54.y = 0.0f;
BossGanonEff_SpawnDustLight(play, &sp54, 0, 3.0f, this->unk_19C - 25);
}
if (this->unk_19C == 35) {
sp48 = this->actor.world.pos;
Vec3f sp48 = this->actor.world.pos;
sp48.y = 0.0f;
BossGanonEff_SpawnShockwave(play, &sp48, 0, 3.0f);
}
@ -1965,9 +1967,9 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) {
void BossGanon_SetupChargeBigMagic(BossGanon* this, PlayState* play) {
this->unk_1C2 = 0;
this->timers[0] = 30;
this->actor.velocity.x = 0.0f;
this->actor.velocity.y = 0.0f;
this->timers[0] = 30;
this->fwork[GDF_CENTER_POS] = 100.0f;
this->unk_1AA = Rand_ZeroFloat(20000.0f);
this->unk_1AC = 0;
@ -3333,14 +3335,14 @@ f32 BossGanon_RandZeroOne(void) {
}
void BossGanon_DrawShock(BossGanon* this, PlayState* play) {
s32 pad;
GraphicsContext* gfxCtx = play->state.gfxCtx;
GameState* gameState = &play->state;
GraphicsContext* gfxCtx = gameState->gfxCtx;
s16 i;
OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7350);
if ((this->unk_2E8 != 0) || (this->unk_2E6 != 0)) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Gfx_SetupDL_25Xlu(gameState->gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0);
gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightBallMaterialDL);
@ -3373,7 +3375,7 @@ void BossGanon_DrawShock(BossGanon* this, PlayState* play) {
if (this->shockGlow) {
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 64, 1, 0,
Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 64, 1, 0,
(this->unk_1A2 + i) * -15, 32, 64));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 255, 170, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128);
@ -3389,14 +3391,14 @@ void BossGanon_DrawShock(BossGanon* this, PlayState* play) {
}
void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) {
s32 pad;
GraphicsContext* gfxCtx = play->state.gfxCtx;
GameState* gameState = &play->state;
GraphicsContext* gfxCtx = gameState->gfxCtx;
s32 alpha;
OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7476);
if (this->handLightBallScale > 0.0f) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Gfx_SetupDL_25Xlu(gameState->gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
if ((this->unk_1A2 % 2) != 0) {
@ -3420,7 +3422,7 @@ void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 155, alpha);
Matrix_Translate(this->unk_260.x, 0.0f, this->unk_260.z, MTXMODE_NEW);
Matrix_Scale(this->handLightBallScale * 0.75f, 1.0f, this->handLightBallScale * 0.75f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 7531),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 7531),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gGanondorfLightCoreDL);
@ -3429,21 +3431,21 @@ void BossGanon_DrawHandLightBall(BossGanon* this, PlayState* play) {
}
void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) {
s32 pad;
GameState* gameState = &play->state;
f32 yRot;
GraphicsContext* gfxCtx = play->state.gfxCtx;
GraphicsContext* gfxCtx = gameState->gfxCtx;
s16 i;
OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 7548);
if (this->unk_284 > 0.0f) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
Gfx_SetupDL_25Xlu(gameState->gfxCtx);
// light flecks
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s8)this->unk_290);
gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 128);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0,
Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0,
this->unk_1A2 * 0xA, 0x40, 0x40));
Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
@ -3460,14 +3462,14 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 100, (s8)this->unk_288);
gSPSegment(POLY_XLU_DISP++, 0x09,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4,
Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, 0, this->unk_1A2 * -4,
0x20, 0x20));
gSPDisplayList(POLY_XLU_DISP++, gGanondorfBigMagicBGCircleDL);
// yellow background dot
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 170, 0, (s8)this->unk_288);
gSPSegment(POLY_XLU_DISP++, 0x0A,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2,
Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, this->unk_1A2 * 2,
this->unk_1A2 * -0x14, 0x40, 0x40));
gSPDisplayList(POLY_XLU_DISP++, gGanondorfDotDL);
@ -3509,15 +3511,17 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, PlayState* play) {
Matrix_Pop();
}
if (1) {}
CLOSE_DISPS(gfxCtx, "../z_boss_ganon.c", 7721);
}
}
void BossGanon_DrawTriforce(BossGanon* this, PlayState* play) {
s32 pad;
GameState* gameState = &play->state;
if (this->fwork[GDF_TRIFORCE_PRIM_A] > 0.0f) {
OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7732);
OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7732);
Matrix_Push();
@ -3555,26 +3559,26 @@ void BossGanon_DrawTriforce(BossGanon* this, PlayState* play) {
}
Matrix_Scale(this->fwork[GDF_TRIFORCE_SCALE], this->fwork[GDF_TRIFORCE_SCALE], 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 7779),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 7779),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanondorfTriforceDL));
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7782);
CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7782);
}
}
void BossGanon_DrawDarkVortex(BossGanon* this, PlayState* play) {
s32 pad;
GameState* gameState = &play->state;
if (this->fwork[GDF_VORTEX_ALPHA] > 0.0f) {
OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7792);
OPEN_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7792);
Matrix_Push();
gDPPipeSync(POLY_XLU_DISP++);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -8, 0, 0x20, 0x40, 1,
Gfx_TwoTexScroll(gameState->gfxCtx, G_TX_RENDERTILE, this->unk_1A2 * -8, 0, 0x20, 0x40, 1,
this->unk_1A2 * -4, this->unk_1A2 * -8, 0x20, 0x20));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 0, 200, (s8)this->fwork[GDF_VORTEX_ALPHA]);
gDPSetEnvColor(POLY_XLU_DISP++, 130, 0, 0, 128);
@ -3590,13 +3594,13 @@ void BossGanon_DrawDarkVortex(BossGanon* this, PlayState* play) {
Matrix_Scale(this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE], this->fwork[GDF_VORTEX_SCALE],
MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 7841),
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 7841),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGanondorfVortexDL));
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 7844);
CLOSE_DISPS(gameState->gfxCtx, "../z_boss_ganon.c", 7844);
}
}
@ -3746,13 +3750,13 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, PlayState* play) {
}
void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, PlayState* play) {
s32 pad;
GameState* gameState = &play->state;
f32 zOffset;
GraphicsContext* gfxCtx = play->state.gfxCtx;
GraphicsContext* gfxCtx = gameState->gfxCtx;
OPEN_DISPS(gfxCtx, "../z_boss_ganon.c", 8372);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
Gfx_SetupDL_25Opa(gameState->gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 50);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
@ -3764,7 +3768,7 @@ void BossGanon_DrawShadowTexture(void* tex, BossGanon* this, PlayState* play) {
}
Matrix_Scale(0.95000005f, 1.0f, 0.95000005f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_ganon.c", 8396),
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(gameState->gfxCtx, "../z_boss_ganon.c", 8396),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gGanondorfShadowSetupDL);
gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP,
@ -3836,6 +3840,8 @@ s32 BossGanon_CheckFallingPlatforms(BossGanon* this, PlayState* play, Vec3f* che
f32 zDiff = platform->dyna.actor.world.pos.z - checkPos->z;
if ((fabsf(xDiff) < 60.0f) && (yDiff < 20.0f) && (yDiff > -20.0f) && (fabsf(zDiff) < 60.0f)) {
s32 pad;
platform->isFalling = true;
platform->visibleSides = OTYUKA_SIDE_ALL;
@ -3972,6 +3978,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) {
this->unk_1C2 = 1;
} else {
this->unk_1C2 = 3;
break;
}
}
}
@ -4162,6 +4169,8 @@ void BossGanon_LightBall_Draw(Actor* thisx, PlayState* play) {
gSPDisplayList(POLY_XLU_DISP++, gGanondorfSquareDL);
}
if (1) {}
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon.c", 9911);
}
@ -4170,14 +4179,6 @@ void func_808E1EB4(Actor* thisx, PlayState* play2) {
BossGanon* this = (BossGanon*)thisx;
PlayState* play = play2;
BossGanon* dorf = (BossGanon*)this->actor.parent;
f32 xDiff;
f32 yDiff;
f32 zDiff;
f32 xzDist;
s16 xRotTarget;
s16 yRotTarget;
Vec3f vel;
Vec3f accel;
this->unk_1A2++;
dorf->envLightMode = 1;
@ -4207,6 +4208,15 @@ void func_808E1EB4(Actor* thisx, PlayState* play2) {
this->unk_1C2 = 1;
}
} else if (this->unk_1C2 == 1) {
f32 xDiff;
f32 yDiff;
f32 zDiff;
f32 xzDist;
s16 xRotTarget;
s16 yRotTarget;
Vec3f vel;
Vec3f accel;
xDiff = dorf->unk_1FC.x - this->actor.world.pos.x;
yDiff = dorf->unk_1FC.y - this->actor.world.pos.y;
zDiff = dorf->unk_1FC.z - this->actor.world.pos.z;
@ -4305,8 +4315,6 @@ void func_808E2544(Actor* thisx, PlayState* play) {
BossGanon* dorf = (BossGanon*)this->actor.parent;
s32 pad;
Player* player = GET_PLAYER(play);
ColliderElement* acHitElem;
Vec3f sp60;
this->unk_1A2++;
Actor_SetScale(&this->actor, 0.01f);
@ -4415,7 +4423,7 @@ void func_808E2544(Actor* thisx, PlayState* play) {
}
if (this->collider.base.acFlags & AC_HIT) {
acHitElem = this->collider.elem.acHitElem;
ColliderElement* acHitElem = this->collider.elem.acHitElem;
this->collider.base.acFlags &= ~AC_HIT;
@ -4524,6 +4532,8 @@ void func_808E2544(Actor* thisx, PlayState* play) {
}
if (numEffects) {
Vec3f sp60;
SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_FANTOM_THUNDER);
for (i = 0; i < numEffects; i++) {
@ -4676,6 +4686,8 @@ void BossGanon_UpdateEffects(PlayState* play) {
Math_ApproachF(&eff->unk_38, eff->unk_40, 1.0f, (eff->unk_40 / 15.0f) * 4.0f);
} else if (eff->type == GDF_EFF_SHOCK) {
s32 pad4;
if (eff->unk_2E == GDF_SHOCK_DORF_YELLOW) {
bodyPart = (s16)Rand_ZeroFloat(13.9f) + 1;