1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 22:41:14 +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

@ -258,7 +258,6 @@ static Vec3f sCeilingTargets[] = {
void BossFd_Fly(BossFd* this, PlayState* play) {
u8 sp1CF = false;
u8 temp_rand;
s16 i1;
s16 i2;
s16 i3;
@ -272,7 +271,6 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
f32 temp_y;
f32 temp_x;
f32 temp_z;
f32 temp;
SkelAnime_Update(&this->skelAnimeHead);
SkelAnime_Update(&this->skelAnimeRightArm);
@ -476,13 +474,13 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
this->subCamAtVel.y = 85.56f;
this->subCamAtVel.z = 25.0f;
} else {
// the following `temp` stuff is probably fake but is required to match
// the following `temp_z` stuff is probably fake but is required to match
// it's optimized to 1.0f because sp1CF is false at this point, but the 0.1f ends up in rodata
temp = 0.1f;
temp_z = 0.1f;
if (!sp1CF) {
temp = 1.0f;
temp_z = 1.0f;
}
Math_ApproachF(&this->subCamShake, 2.0f, temp, 0.1 * 0.08f);
Math_ApproachF(&this->subCamShake, 2.0f, temp_z, 0.1 * 0.08f);
this->subCamAtYOffset = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->subCamShake;
}
if (this->timers[3] == 160) {
@ -561,6 +559,8 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
this->timers[0] = 0;
this->timers[1] = 100;
} else {
u8 temp_rand;
if (this->introState != BFD_CS_NONE) {
this->holeIndex = 6;
} else {
@ -919,12 +919,6 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
if (!this->work[BFD_STOP_FLAG]) {
s16 i4;
Vec3f spE0[3];
Vec3f spBC[3];
f32 phi_f20;
f32 padB4;
f32 padB0;
f32 padAC;
Math_ApproachS(&this->actor.world.rot.y, angleToTarget, 0xA, this->fwork[BFD_TURN_RATE]);
@ -993,6 +987,8 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
}
if (!sp1CF) {
Vec3f spE0[3];
Vec3f spBC[3];
spE0[0].x = spE0[0].y = Math_SinS(this->work[BFD_MOVE_TIMER] * 1500.0f) * 3000.0f;
spE0[1].x = Math_SinS(this->work[BFD_MOVE_TIMER] * 2000.0f) * 4000.0f;
spE0[1].y = Math_SinS(this->work[BFD_MOVE_TIMER] * 2200.0f) * 4000.0f;
@ -1012,7 +1008,11 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
}
} else {
for (i2 = 0; i2 < 3; i2++) {
phi_f20 = 0.0f;
f32 phi_f20 = 0.0f;
f32 padB4;
f32 padB0;
f32 padAC;
Math_ApproachZeroF(&this->rightArmRot[i2].y, 0.1f, 100.0f);
Math_ApproachZeroF(&this->leftArmRot[i2].y, 0.1f, 100.0f);
if (i2 == 0) {
@ -1027,14 +1027,16 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
void BossFd_Wait(BossFd* this, PlayState* play) {
if (this->handoffSignal == FD2_SIGNAL_FLY) { // Set by BossFd2
u8 temp_rand;
this->handoffSignal = FD2_SIGNAL_NONE;
BossFd_SetupFly(this, play);
do {
temp_rand = Rand_ZeroFloat(8.9f);
} while (temp_rand == this->holeIndex);
this->holeIndex = temp_rand;
{
u8 temp_rand;
do {
temp_rand = Rand_ZeroFloat(8.9f);
} while (temp_rand == this->holeIndex);
this->holeIndex = temp_rand;
}
if (1) {} // Needed for matching
this->targetPosition.x = sHoleLocations[this->holeIndex].x;
this->targetPosition.y = sHoleLocations[this->holeIndex].y - 200.0f;
@ -1071,7 +1073,6 @@ void BossFd_Effects(BossFd* this, PlayState* play) {
s16 eyeStates[] = { EYE_OPEN, EYE_HALF, EYE_CLOSED, EYE_CLOSED, EYE_HALF };
f32 temp_x;
f32 temp_z;
s16 i;
if (1) {} // Needed for match
@ -1088,6 +1089,8 @@ void BossFd_Effects(BossFd* this, PlayState* play) {
play->envCtx.prevLightSetting = 0;
Math_ApproachF(&play->envCtx.lightBlend, 1.0f, 1.0f, 0.05f);
} else if (this->fogMode == 2) {
s16 pad;
this->fogMode--;
play->envCtx.lightSettingOverride = 0;
Math_ApproachF(&play->envCtx.lightBlend, 0.55f + 0.05f * Math_SinS(this->work[BFD_VAR_TIMER] * 0x3E00), 1.0f,
@ -1096,6 +1099,8 @@ void BossFd_Effects(BossFd* this, PlayState* play) {
play->envCtx.lightSetting = 3;
play->envCtx.prevLightSetting = 0;
} else if (this->fogMode == 10) {
s16 pad;
this->fogMode = 1;
play->envCtx.lightSettingOverride = 0;
Math_ApproachF(&play->envCtx.lightBlend, 0.21f + 0.07f * Math_SinS(this->work[BFD_VAR_TIMER] * 0xC00), 1.0f,
@ -1150,7 +1155,7 @@ void BossFd_Effects(BossFd* this, PlayState* play) {
Vec3f spawnVel1;
Vec3f spawnAccel1;
Vec3f spawnPos1;
s32 pad;
s16 i;
Audio_PlaySfxGeneral(NA_SE_EN_VALVAISA_APPEAR - SFX_FLAG, &this->actor.projectedPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -1220,6 +1225,7 @@ void BossFd_Effects(BossFd* this, PlayState* play) {
breathOpacity = (this->fireBreathTimer >= 6) ? 255 : this->fireBreathTimer * 50;
}
if (breathOpacity != 0) {
s16 i;
f32 spawnAngleX;
f32 spawnAngleY;
Vec3f spawnSpeed2 = { 0.0f, 0.0f, 0.0f };
@ -1299,12 +1305,8 @@ void BossFd_CollisionCheck(BossFd* this, PlayState* play) {
}
void BossFd_Update(Actor* thisx, PlayState* play) {
s32 pad;
BossFd* this = (BossFd*)thisx;
f32 headGlow;
f32 rManeGlow;
f32 lManeGlow;
s16 i;
BossFd* this = (BossFd*)thisx;
PRINTF("FD MOVE START \n");
this->work[BFD_VAR_TIMER]++;
@ -1339,47 +1341,55 @@ void BossFd_Update(Actor* thisx, PlayState* play) {
this->fwork[BFD_TEX2_SCROLL_X] += 3.0f;
this->fwork[BFD_TEX2_SCROLL_Y] -= 2.0f;
Math_ApproachF(&this->fwork[BFD_BODY_TEX2_ALPHA], (this->work[BFD_VAR_TIMER] & 0x10) ? 30.0f : 158.0f, 1.0f, 8.0f);
if (this->skinSegments == 0) {
this->fwork[BFD_HEAD_TEX2_ALPHA] = this->fwork[BFD_BODY_TEX2_ALPHA];
} else {
headGlow = (this->work[BFD_VAR_TIMER] & 4) ? 0.0f : 255.0f;
Math_ApproachF(&this->fwork[BFD_HEAD_TEX2_ALPHA], headGlow, 1.0f, 64.0f);
}
if (1) {
f32 headGlow;
f32 rManeGlow;
f32 lManeGlow;
s32 pad;
headGlow = (this->work[BFD_VAR_TIMER] & 8) ? 128.0f : 255.0f;
rManeGlow = ((this->work[BFD_VAR_TIMER] + 3) & 8) ? 128.0f : 255.0f;
lManeGlow = ((this->work[BFD_VAR_TIMER] + 6) & 8) ? 128.0f : 255.0f;
Math_ApproachF(&this->fwork[BFD_BODY_TEX2_ALPHA], (this->work[BFD_VAR_TIMER] & 0x10) ? 30.0f : 158.0f, 1.0f,
8.0f);
if (this->skinSegments == 0) {
this->fwork[BFD_HEAD_TEX2_ALPHA] = this->fwork[BFD_BODY_TEX2_ALPHA];
} else {
headGlow = (this->work[BFD_VAR_TIMER] & 4) ? 0.0f : 255.0f;
Math_ApproachF(&this->fwork[BFD_HEAD_TEX2_ALPHA], headGlow, 1.0f, 64.0f);
}
Math_ApproachF(&this->fwork[BFD_MANE_COLOR_CENTER], headGlow, 1.0f, 16.0f);
Math_ApproachF(&this->fwork[BFD_MANE_COLOR_RIGHT], rManeGlow, 1.0f, 16.0f);
Math_ApproachF(&this->fwork[BFD_MANE_COLOR_LEFT], lManeGlow, 1.0f, 16.0f);
headGlow = (this->work[BFD_VAR_TIMER] & 8) ? 128.0f : 255.0f;
rManeGlow = ((this->work[BFD_VAR_TIMER] + 3) & 8) ? 128.0f : 255.0f;
lManeGlow = ((this->work[BFD_VAR_TIMER] + 6) & 8) ? 128.0f : 255.0f;
if (this->work[BFD_ROCK_TIMER] != 0) {
this->work[BFD_ROCK_TIMER]--;
if ((this->work[BFD_ROCK_TIMER] % 16) == 0) {
EnVbBall* bossFdRock = (EnVbBall*)Actor_SpawnAsChild(
&play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f,
this->actor.world.pos.z, 0, 0, (s16)Rand_ZeroFloat(50.0f) + 130, 100);
Math_ApproachF(&this->fwork[BFD_MANE_COLOR_CENTER], headGlow, 1.0f, 16.0f);
Math_ApproachF(&this->fwork[BFD_MANE_COLOR_RIGHT], rManeGlow, 1.0f, 16.0f);
Math_ApproachF(&this->fwork[BFD_MANE_COLOR_LEFT], lManeGlow, 1.0f, 16.0f);
if (bossFdRock != NULL) {
for (i = 0; i < 10; i++) {
Vec3f debrisVel = { 0.0f, 0.0f, 0.0f };
Vec3f debrisAccel = { 0.0f, -1.0f, 0.0f };
Vec3f debrisPos;
if (this->work[BFD_ROCK_TIMER] != 0) {
this->work[BFD_ROCK_TIMER]--;
if ((this->work[BFD_ROCK_TIMER] % 16) == 0) {
EnVbBall* bossFdRock = (EnVbBall*)Actor_SpawnAsChild(
&play->actorCtx, &this->actor, play, ACTOR_EN_VB_BALL, this->actor.world.pos.x, 1000.0f,
this->actor.world.pos.z, 0, 0, (s16)Rand_ZeroFloat(50.0f) + 130, 100);
debrisPos.x = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.x;
debrisPos.y = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.y;
debrisPos.z = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.z;
if (bossFdRock != NULL) {
for (i = 0; i < 10; i++) {
Vec3f debrisVel = { 0.0f, 0.0f, 0.0f };
Vec3f debrisAccel = { 0.0f, -1.0f, 0.0f };
Vec3f debrisPos;
BossFd_SpawnDebris(this->effects, &debrisPos, &debrisVel, &debrisAccel,
(s16)Rand_ZeroFloat(15.0f) + 20);
debrisPos.x = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.x;
debrisPos.y = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.y;
debrisPos.z = Rand_CenteredFloat(300.0f) + bossFdRock->actor.world.pos.z;
BossFd_SpawnDebris(this->effects, &debrisPos, &debrisVel, &debrisAccel,
(s16)Rand_ZeroFloat(15.0f) + 20);
}
}
}
}
}
if (1) { // Needed for matching, and also to define new variables
if (1) {
Vec3f emberVel = { 0.0f, 0.0f, 0.0f };
Vec3f emberAccel = { 0.0f, 0.0f, 0.0f };
Vec3f emberPos;
@ -1432,7 +1442,7 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) {
Color_RGB8 colors[4] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 } };
Vec3f diff;
s16 i1;
s16 i2;
s16 cInd;
for (i1 = 0; i1 < BOSSFD_EFFECT_COUNT; i1++, effect++) {
if (effect->type != BFD_FX_NONE) {
@ -1446,7 +1456,7 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) {
effect->velocity.y += effect->accel.y;
effect->velocity.z += effect->accel.z;
if (effect->type == BFD_FX_EMBER) {
s16 cInd = effect->timer1 % 4;
cInd = effect->timer1 % 4;
effect->color.r = colors[cInd].r;
effect->color.g = colors[cInd].g;
@ -1477,6 +1487,8 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) {
this->timers[3] = 50;
func_8002F6D4(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30);
if (!player->bodyIsBurning) {
s16 i2;
for (i2 = 0; i2 < PLAYER_BODYPART_MAX; i2++) {
player->bodyFlameTimers[i2] = Rand_S16Offset(0, 200);
}