1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 14:31:17 +00:00

PlayState Rename (#1231)

* global context -> play

* fix PlayState* PlayState
This commit is contained in:
fig02 2022-05-21 14:23:43 -04:00 committed by GitHub
parent 154f44b6da
commit 2e6279bc8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
912 changed files with 40489 additions and 41078 deletions

View file

@ -29,45 +29,45 @@ typedef enum {
/* 16 */ GELDB_SPIN_DODGE
} EnGeldBAction;
void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx);
void EnGeldB_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx);
void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnGeldB_Init(Actor* thisx, PlayState* play);
void EnGeldB_Destroy(Actor* thisx, PlayState* play);
void EnGeldB_Update(Actor* thisx, PlayState* play);
void EnGeldB_Draw(Actor* thisx, PlayState* play);
s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this);
s32 EnGeldB_DodgeRanged(PlayState* play, EnGeldB* this);
void EnGeldB_SetupWait(EnGeldB* this);
void EnGeldB_SetupReady(EnGeldB* this);
void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_SetupAdvance(EnGeldB* this, PlayState* play);
void EnGeldB_SetupPivot(EnGeldB* this);
void EnGeldB_SetupRollForward(EnGeldB* this);
void EnGeldB_SetupCircle(EnGeldB* this);
void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_SetupSpinDodge(EnGeldB* this, PlayState* play);
void EnGeldB_SetupSlash(EnGeldB* this);
void EnGeldB_SetupSpinAttack(EnGeldB* this);
void EnGeldB_SetupRollBack(EnGeldB* this);
void EnGeldB_SetupJump(EnGeldB* this);
void EnGeldB_SetupBlock(EnGeldB* this);
void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_SetupSidestep(EnGeldB* this, PlayState* play);
void EnGeldB_SetupDefeated(EnGeldB* this);
void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Flee(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx);
void EnGeldB_Wait(EnGeldB* this, PlayState* play);
void EnGeldB_Flee(EnGeldB* this, PlayState* play);
void EnGeldB_Ready(EnGeldB* this, PlayState* play);
void EnGeldB_Advance(EnGeldB* this, PlayState* play);
void EnGeldB_RollForward(EnGeldB* this, PlayState* play);
void EnGeldB_Pivot(EnGeldB* this, PlayState* play);
void EnGeldB_Circle(EnGeldB* this, PlayState* play);
void EnGeldB_SpinDodge(EnGeldB* this, PlayState* play);
void EnGeldB_Slash(EnGeldB* this, PlayState* play);
void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play);
void EnGeldB_RollBack(EnGeldB* this, PlayState* play);
void EnGeldB_Stunned(EnGeldB* this, PlayState* play);
void EnGeldB_Damaged(EnGeldB* this, PlayState* play);
void EnGeldB_Jump(EnGeldB* this, PlayState* play);
void EnGeldB_Block(EnGeldB* this, PlayState* play);
void EnGeldB_Sidestep(EnGeldB* this, PlayState* play);
void EnGeldB_Defeated(EnGeldB* this, PlayState* play);
const ActorInit En_GeldB_InitVars = {
ACTOR_EN_GELDB,
@ -215,7 +215,7 @@ void EnGeldB_SetupAction(EnGeldB* this, EnGeldBActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnGeldB_Init(Actor* thisx, PlayState* play) {
s32 pad;
EffectBlureInit1 blureInit;
EnGeldB* this = (EnGeldB*)thisx;
@ -232,14 +232,14 @@ void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) {
thisx->params &= 0xFF;
this->blinkState = 0;
this->unkFloat = 10.0f;
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable,
SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable,
this->morphTable, GELDB_LIMB_MAX);
Collider_InitCylinder(globalCtx, &this->bodyCollider);
Collider_SetCylinder(globalCtx, &this->bodyCollider, thisx, &sBodyCylInit);
Collider_InitTris(globalCtx, &this->blockCollider);
Collider_SetTris(globalCtx, &this->blockCollider, thisx, &sBlockTrisInit, this->blockElements);
Collider_InitQuad(globalCtx, &this->swordCollider);
Collider_SetQuad(globalCtx, &this->swordCollider, thisx, &sSwordQuadInit);
Collider_InitCylinder(play, &this->bodyCollider);
Collider_SetCylinder(play, &this->bodyCollider, thisx, &sBodyCylInit);
Collider_InitTris(play, &this->blockCollider);
Collider_SetTris(play, &this->blockCollider, thisx, &sBlockTrisInit, this->blockElements);
Collider_InitQuad(play, &this->swordCollider);
Collider_SetQuad(play, &this->swordCollider, thisx, &sSwordQuadInit);
blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] =
blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = blureInit.p1EndColor[0] =
blureInit.p1EndColor[1] = blureInit.p1EndColor[2] = blureInit.p2EndColor[0] = blureInit.p2EndColor[1] =
@ -250,27 +250,27 @@ void EnGeldB_Init(Actor* thisx, GlobalContext* globalCtx) {
blureInit.unkFlag = 0;
blureInit.calcMode = 2;
Effect_Add(globalCtx, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit);
Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit);
Actor_SetScale(thisx, 0.012499999f);
EnGeldB_SetupWait(this);
if ((this->keyFlag != 0) && Flags_GetCollectible(globalCtx, this->keyFlag >> 8)) {
if ((this->keyFlag != 0) && Flags_GetCollectible(play, this->keyFlag >> 8)) {
Actor_Kill(thisx);
}
}
void EnGeldB_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnGeldB_Destroy(Actor* thisx, PlayState* play) {
s32 pad;
EnGeldB* this = (EnGeldB*)thisx;
func_800F5B58();
Effect_Delete(globalCtx, this->blureIndex);
Collider_DestroyTris(globalCtx, &this->blockCollider);
Collider_DestroyCylinder(globalCtx, &this->bodyCollider);
Collider_DestroyQuad(globalCtx, &this->swordCollider);
Effect_Delete(play, this->blureIndex);
Collider_DestroyTris(play, &this->blockCollider);
Collider_DestroyCylinder(play, &this->bodyCollider);
Collider_DestroyQuad(play, &this->swordCollider);
}
s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
Player* player = GET_PLAYER(globalCtx);
s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) {
Player* player = GET_PLAYER(play);
Actor* thisx = &this->actor;
s16 angleToWall;
s16 angleToLink;
@ -281,32 +281,32 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
angleToLink = thisx->yawTowardsPlayer - thisx->shape.rot.y;
angleToLink = ABS(angleToLink);
if (func_800354B4(globalCtx, thisx, 100.0f, 0x2710, 0x3E80, thisx->shape.rot.y)) {
if (func_800354B4(play, thisx, 100.0f, 0x2710, 0x3E80, thisx->shape.rot.y)) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
EnGeldB_SetupSpinDodge(this, play);
return true;
} else if (globalCtx->gameplayFrames & 1) {
} else if (play->gameplayFrames & 1) {
EnGeldB_SetupBlock(this);
return true;
}
}
if (func_800354B4(globalCtx, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) {
if (func_800354B4(play, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) {
thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer;
if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) &&
(thisx->xzDistToPlayer < 90.0f)) {
EnGeldB_SetupJump(this);
return true;
} else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
EnGeldB_SetupSpinDodge(this, play);
return true;
} else if ((thisx->xzDistToPlayer < 90.0f) && (globalCtx->gameplayFrames & 1)) {
} else if ((thisx->xzDistToPlayer < 90.0f) && (play->gameplayFrames & 1)) {
EnGeldB_SetupBlock(this);
return true;
} else {
EnGeldB_SetupRollBack(this);
return true;
}
} else if ((bomb = Actor_FindNearby(globalCtx, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) {
} else if ((bomb = Actor_FindNearby(play, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) {
thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer;
if (((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || (bomb->id == ACTOR_EN_BOM_CHU)) {
if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) &&
@ -314,7 +314,7 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
EnGeldB_SetupJump(this);
return true;
} else {
EnGeldB_SetupSidestep(this, globalCtx);
EnGeldB_SetupSidestep(this, play);
return true;
}
} else {
@ -323,13 +323,13 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
}
} else if (arg2) {
if (angleToLink >= 0x1B58) {
EnGeldB_SetupSidestep(this, globalCtx);
EnGeldB_SetupSidestep(this, play);
return true;
} else {
s16 angleToFacingLink = player->actor.shape.rot.y - thisx->shape.rot.y;
if ((thisx->xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, thisx) &&
((globalCtx->gameplayFrames & 7) || (ABS(angleToFacingLink) < 0x38E0))) {
if ((thisx->xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, thisx) &&
((play->gameplayFrames & 7) || (ABS(angleToFacingLink) < 0x38E0))) {
EnGeldB_SetupSlash(this);
return true;
} else {
@ -353,9 +353,8 @@ void EnGeldB_SetupWait(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Wait);
}
void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) {
if ((this->invisible && !Flags_GetSwitch(globalCtx, this->actor.home.rot.z)) ||
this->actor.xzDistToPlayer > 300.0f) {
void EnGeldB_Wait(EnGeldB* this, PlayState* play) {
if ((this->invisible && !Flags_GetSwitch(play, this->actor.home.rot.z)) || this->actor.xzDistToPlayer > 300.0f) {
this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.world.pos.y = this->actor.floorHeight + 120.0f;
} else {
@ -371,8 +370,8 @@ void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) {
this->actor.focus.pos = this->actor.world.pos;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH;
this->actor.velocity.y = 0.0f;
Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false);
}
if (SkelAnime_Update(&this->skelAnime)) {
EnGeldB_SetupReady(this);
@ -390,14 +389,14 @@ void EnGeldB_SetupFlee(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Flee);
}
void EnGeldB_Flee(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Flee(EnGeldB* this, PlayState* play) {
if (this->skelAnime.curFrame == 10.0f) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP);
}
if (this->skelAnime.curFrame == 2.0f) {
this->actor.gravity = 0.0f;
Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false);
}
if (SkelAnime_Update(&this->skelAnime)) {
Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 300.0f, 1.0f, 20.5f, 0.0f);
@ -417,8 +416,8 @@ void EnGeldB_SetupReady(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Ready);
}
void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void EnGeldB_Ready(EnGeldB* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 pad;
s16 angleToLink;
@ -432,7 +431,7 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) {
this->lookTimer = 0;
}
angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if (!EnGeldB_DodgeRanged(play, this)) {
if (this->unkTimer != 0) {
this->unkTimer--;
@ -440,7 +439,7 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) {
return;
}
this->unkTimer = 0;
} else if (EnGeldB_ReactToPlayer(globalCtx, this, 0)) {
} else if (EnGeldB_ReactToPlayer(play, this, 0)) {
return;
}
angleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y;
@ -451,28 +450,28 @@ void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) {
if (Actor_IsFacingPlayer(&this->actor, 30 * 0x10000 / 360)) {
if ((210.0f > this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 150.0f) &&
(Rand_ZeroOne() < 0.3f)) {
if (Actor_OtherIsTargeted(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) ||
if (Actor_OtherIsTargeted(play, &this->actor) || (Rand_ZeroOne() > 0.5f) ||
(ABS(angleToLink) < 0x38E0)) {
EnGeldB_SetupRollForward(this);
} else {
EnGeldB_SetupSpinAttack(this);
}
} else if (Rand_ZeroOne() > 0.3f) {
EnGeldB_SetupAdvance(this, globalCtx);
EnGeldB_SetupAdvance(this, play);
} else {
EnGeldB_SetupCircle(this);
}
} else {
EnGeldB_SetupPivot(this);
}
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
if ((play->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
}
}
}
void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_SetupAdvance(EnGeldB* this, PlayState* play) {
f32 lastFrame = Animation_GetLastFrame(&gGerudoRedWalkAnim);
Animation_Change(&this->skelAnime, &gGerudoRedWalkAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f);
@ -480,14 +479,14 @@ void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx) {
EnGeldB_SetupAction(this, EnGeldB_Advance);
}
void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Advance(EnGeldB* this, PlayState* play) {
s32 prevFrame;
s32 beforeCurFrame;
s32 absPlaySpeed;
s16 facingAngletoLink;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if (!EnGeldB_DodgeRanged(play, this)) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
if (this->actor.xzDistToPlayer <= 40.0f) {
@ -520,19 +519,19 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
EnGeldB_SetupReady(this);
}
} else if (this->actor.xzDistToPlayer < 90.0f) {
if (!Actor_OtherIsTargeted(globalCtx, &this->actor) &&
if (!Actor_OtherIsTargeted(play, &this->actor) &&
(Rand_ZeroOne() > 0.03f || (this->actor.xzDistToPlayer <= 45.0f && facingAngletoLink < 0x38E0))) {
EnGeldB_SetupSlash(this);
} else if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) {
} else if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) {
EnGeldB_SetupRollBack(this);
} else {
EnGeldB_SetupCircle(this);
}
}
if (!EnGeldB_ReactToPlayer(globalCtx, this, 0)) {
if (!EnGeldB_ReactToPlayer(play, this, 0)) {
if ((this->actor.xzDistToPlayer < 210.0f) && (this->actor.xzDistToPlayer > 150.0f) &&
Actor_IsFacingPlayer(&this->actor, 0x71C)) {
if (Actor_IsTargeted(globalCtx, &this->actor)) {
if (Actor_IsTargeted(play, &this->actor)) {
if (Rand_ZeroOne() > 0.5f) {
EnGeldB_SetupRollForward(this);
} else {
@ -543,7 +542,7 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
return;
}
}
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
if ((play->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
if (prevFrame != (s32)this->skelAnime.curFrame) {
@ -570,8 +569,8 @@ void EnGeldB_SetupRollForward(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_RollForward);
}
void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void EnGeldB_RollForward(EnGeldB* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 facingAngleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y;
if (SkelAnime_Update(&this->skelAnime)) {
@ -583,14 +582,14 @@ void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx) {
if (ABS(facingAngleToLink) < 0x38E0) {
this->lookTimer = 20;
}
} else if (!Actor_OtherIsTargeted(globalCtx, &this->actor) &&
} else if (!Actor_OtherIsTargeted(play, &this->actor) &&
(Rand_ZeroOne() > 0.5f || (ABS(facingAngleToLink) < 0x3FFC))) {
EnGeldB_SetupSlash(this);
} else {
EnGeldB_SetupAdvance(this, globalCtx);
EnGeldB_SetupAdvance(this, play);
}
}
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
if ((play->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
}
@ -601,12 +600,12 @@ void EnGeldB_SetupPivot(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Pivot);
}
void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Pivot(EnGeldB* this, PlayState* play) {
s16 angleToLink;
s16 turnRate;
f32 playSpeed;
if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) {
if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) {
angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
turnRate = (angleToLink > 0) ? ((angleToLink * 0.25f) + 2000.0f) : ((angleToLink * 0.25f) - 2000.0f);
this->actor.world.rot.y = this->actor.shape.rot.y += turnRate;
@ -623,10 +622,10 @@ void EnGeldB_Pivot(EnGeldB* this, GlobalContext* globalCtx) {
if (Rand_ZeroOne() > 0.8f) {
EnGeldB_SetupCircle(this);
} else {
EnGeldB_SetupAdvance(this, globalCtx);
EnGeldB_SetupAdvance(this, play);
}
}
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
if ((play->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
}
@ -645,17 +644,17 @@ void EnGeldB_SetupCircle(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Circle);
}
void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Circle(EnGeldB* this, PlayState* play) {
s16 angleBehindLink;
s16 phi_v1;
s32 afterPrevFrame;
s32 prevFrame;
s32 pad;
s32 beforeCurFrame;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1);
if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) {
if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) {
this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98;
angleBehindLink = player->actor.shape.rot.y + 0x8000;
if (Math_SinS(angleBehindLink - this->actor.shape.rot.y) >= 0.0f) {
@ -670,8 +669,7 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) {
}
}
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ||
!Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ,
this->actor.shape.rot.y + 0x3E80)) {
!Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
if (this->actor.speedXZ >= 0.0f) {
phi_v1 = this->actor.shape.rot.y + 0x3E80;
@ -720,14 +718,14 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND);
}
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
if ((play->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
if ((Math_CosS(angleBehindLink - this->actor.shape.rot.y) < -0.85f) &&
!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer <= 45.0f)) {
!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 45.0f)) {
EnGeldB_SetupSlash(this);
} else if (--this->timer == 0) {
if (Actor_OtherIsTargeted(globalCtx, &this->actor) && (Rand_ZeroOne() > 0.5f)) {
if (Actor_OtherIsTargeted(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) {
EnGeldB_SetupRollBack(this);
} else {
EnGeldB_SetupReady(this);
@ -736,9 +734,9 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) {
}
}
void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_SetupSpinDodge(EnGeldB* this, PlayState* play) {
s16 sp3E;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim);
Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f);
@ -762,7 +760,7 @@ void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx) {
EnGeldB_SetupAction(this, EnGeldB_SpinDodge);
}
void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_SpinDodge(EnGeldB* this, PlayState* play) {
s16 phi_v1;
s32 prevFrame;
s32 pad;
@ -771,7 +769,7 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x3A98;
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ||
!Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) {
!Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
if (this->actor.speedXZ >= 0.0f) {
phi_v1 = this->actor.shape.rot.y + 0x3E80;
@ -816,14 +814,14 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND);
}
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
if ((play->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
this->timer--;
if (this->timer == 0) {
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer <= 70.0f)) {
if (!EnGeldB_DodgeRanged(play, this)) {
if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer <= 70.0f)) {
EnGeldB_SetupSlash(this);
} else {
EnGeldB_SetupRollBack(this);
@ -848,8 +846,8 @@ void EnGeldB_SetupSlash(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Slash);
}
void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void EnGeldB_Slash(EnGeldB* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y;
s16 angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
@ -880,13 +878,13 @@ void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) {
} else {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
if (Rand_ZeroOne() > 0.7f) {
EnGeldB_SetupSidestep(this, globalCtx);
EnGeldB_SetupSidestep(this, play);
} else if (angleFacingLink <= 0x2710) {
if (angleToLink > 0x3E80) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
EnGeldB_SetupCircle(this);
} else {
EnGeldB_ReactToPlayer(globalCtx, this, 1);
EnGeldB_ReactToPlayer(play, this, 1);
}
} else {
EnGeldB_SetupCircle(this);
@ -906,8 +904,8 @@ void EnGeldB_SetupSpinAttack(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_SpinAttack);
}
void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 angleFacingLink;
s16 angleToLink;
@ -919,10 +917,10 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) {
} else if (this->swordCollider.base.atFlags & AT_HIT) {
this->swordCollider.base.atFlags &= ~AT_HIT;
if (&player->actor == this->swordCollider.base.at) {
func_8002F71C(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f);
func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f);
this->spinAttackState = 2;
func_8002DF54(globalCtx, &this->actor, 0x18);
Message_StartTextbox(globalCtx, 0x6003, &this->actor);
func_8002DF54(play, &this->actor, 0x18);
Message_StartTextbox(play, 0x6003, &this->actor);
this->timer = 30;
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_TWINROBA_YOUNG_LAUGH);
@ -933,8 +931,8 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) {
if ((s32)this->skelAnime.curFrame < 9) {
this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer;
} else if ((s32)this->skelAnime.curFrame == 13) {
Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false);
Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false);
this->swordState = 1;
this->actor.speedXZ = 10.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_ATTACK);
@ -956,7 +954,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) {
} else {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
if (Rand_ZeroOne() > 0.7f) {
EnGeldB_SetupSidestep(this, globalCtx);
EnGeldB_SetupSidestep(this, play);
} else {
angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y;
angleFacingLink = ABS(angleFacingLink);
@ -967,7 +965,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
EnGeldB_SetupCircle(this);
} else {
EnGeldB_ReactToPlayer(globalCtx, this, 1);
EnGeldB_ReactToPlayer(play, this, 1);
}
} else {
EnGeldB_SetupCircle(this);
@ -988,18 +986,18 @@ void EnGeldB_SetupRollBack(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_RollBack);
}
void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_RollBack(EnGeldB* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime)) {
if (!Actor_OtherIsTargeted(globalCtx, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) &&
if (!Actor_OtherIsTargeted(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) &&
(this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) {
EnGeldB_SetupSpinAttack(this);
} else if (globalCtx->gameplayFrames & 1) {
EnGeldB_SetupSidestep(this, globalCtx);
} else if (play->gameplayFrames & 1) {
EnGeldB_SetupSidestep(this, play);
} else {
EnGeldB_SetupReady(this);
}
}
if ((globalCtx->state.frames & 0x5F) == 0) {
if ((play->state.frames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
}
@ -1019,7 +1017,7 @@ void EnGeldB_SetupStunned(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Stunned);
}
void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Stunned(EnGeldB* this, PlayState* play) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
this->actor.speedXZ = 0.0f;
}
@ -1033,7 +1031,7 @@ void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) {
if (this->actor.colChkInfo.health == 0) {
EnGeldB_SetupDefeated(this);
} else {
EnGeldB_ReactToPlayer(globalCtx, this, 1);
EnGeldB_ReactToPlayer(play, this, 1);
}
}
}
@ -1053,7 +1051,7 @@ void EnGeldB_SetupDamaged(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Damaged);
}
void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Damaged(EnGeldB* this, PlayState* play) {
s16 angleToWall;
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
@ -1066,15 +1064,15 @@ void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) {
this->invisible = false;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0);
if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0) &&
if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0) &&
SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
angleToWall = this->actor.wallYaw - this->actor.shape.rot.y;
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) &&
(this->actor.xzDistToPlayer < 90.0f)) {
EnGeldB_SetupJump(this);
} else if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) &&
(globalCtx->gameplayFrames & 7)) {
} else if (!EnGeldB_DodgeRanged(play, this)) {
if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, &this->actor) &&
(play->gameplayFrames & 7)) {
EnGeldB_SetupSlash(this);
} else {
EnGeldB_SetupRollBack(this);
@ -1097,11 +1095,11 @@ void EnGeldB_SetupJump(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Jump);
}
void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Jump(EnGeldB* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1);
if (this->actor.velocity.y >= 5.0f) {
func_800355B8(globalCtx, &this->leftFootPos);
func_800355B8(globalCtx, &this->rightFootPos);
func_800355B8(play, &this->leftFootPos);
func_800355B8(play, &this->rightFootPos);
}
if (SkelAnime_Update(&this->skelAnime) &&
(this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) {
@ -1110,7 +1108,7 @@ void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx) {
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;
this->actor.world.pos.y = this->actor.floorHeight;
if (!Actor_OtherIsTargeted(globalCtx, &this->actor)) {
if (!Actor_OtherIsTargeted(play, &this->actor)) {
EnGeldB_SetupSlash(this);
} else {
EnGeldB_SetupReady(this);
@ -1131,8 +1129,8 @@ void EnGeldB_SetupBlock(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Block);
}
void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void EnGeldB_Block(EnGeldB* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 pad;
s16 angleToLink;
s16 angleFacingLink;
@ -1146,18 +1144,18 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if ((ABS(angleToLink) <= 0x4000) && (this->actor.xzDistToPlayer < 40.0f) &&
(ABS(this->actor.yDistToPlayer) < 50.0f)) {
if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) {
if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
} else if (globalCtx->gameplayFrames & 1) {
EnGeldB_SetupSpinDodge(this, play);
} else if (play->gameplayFrames & 1) {
EnGeldB_SetupBlock(this);
} else {
EnGeldB_SetupRollBack(this);
}
} else {
angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y;
if (!Actor_OtherIsTargeted(globalCtx, &this->actor) &&
((globalCtx->gameplayFrames & 1) || (ABS(angleFacingLink) < 0x38E0))) {
if (!Actor_OtherIsTargeted(play, &this->actor) &&
((play->gameplayFrames & 1) || (ABS(angleFacingLink) < 0x38E0))) {
EnGeldB_SetupSlash(this);
} else {
EnGeldB_SetupCircle(this);
@ -1167,11 +1165,11 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
EnGeldB_SetupCircle(this);
}
} else if ((this->timer == 0) &&
func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) {
func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
} else if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if (globalCtx->gameplayFrames & 1) {
EnGeldB_SetupSpinDodge(this, play);
} else if (!EnGeldB_DodgeRanged(play, this)) {
if (play->gameplayFrames & 1) {
if ((this->actor.xzDistToPlayer < 100.0f) && (Rand_ZeroOne() > 0.7f)) {
EnGeldB_SetupJump(this);
} else {
@ -1184,13 +1182,13 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
}
}
void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_SetupSidestep(EnGeldB* this, PlayState* play) {
s16 linkAngle;
Player* player;
f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim);
Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f);
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1);
linkAngle = player->actor.shape.rot.y;
if (Math_SinS(linkAngle - this->actor.shape.rot.y) > 0.0f) {
@ -1208,10 +1206,10 @@ void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) {
EnGeldB_SetupAction(this, EnGeldB_Sidestep);
}
void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Sidestep(EnGeldB* this, PlayState* play) {
s16 behindLinkAngle;
s16 phi_v1;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
s32 prevFrame;
s32 beforeCurFrame;
f32 absPlaySpeed;
@ -1225,7 +1223,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) {
}
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ||
!Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) {
!Actor_TestFloorInDirection(&this->actor, play, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
if (this->actor.speedXZ >= 0.0f) {
phi_v1 = this->actor.shape.rot.y + 0x3E80;
@ -1274,7 +1272,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) {
beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed));
absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); // Needed to match for some reason
if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) {
if (!EnGeldB_DodgeRanged(play, this) && !EnGeldB_ReactToPlayer(play, this, 0)) {
if (--this->timer == 0) {
s16 angleFacingPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y;
@ -1283,23 +1281,23 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) {
EnGeldB_SetupReady(this);
this->timer = (Rand_ZeroOne() * 5.0f) + 1.0f;
} else {
Player* player2 = GET_PLAYER(globalCtx);
Player* player2 = GET_PLAYER(play);
s16 angleFacingPlayer2 = player2->actor.shape.rot.y - this->actor.shape.rot.y;
this->actor.world.rot.y = this->actor.shape.rot.y;
if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) &&
(!(globalCtx->gameplayFrames & 3) || (ABS(angleFacingPlayer2) < 0x38E0))) {
if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(play, &this->actor) &&
(!(play->gameplayFrames & 3) || (ABS(angleFacingPlayer2) < 0x38E0))) {
EnGeldB_SetupSlash(this);
} else if ((210.0f > this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 150.0f) &&
!(globalCtx->gameplayFrames & 1)) {
if (Actor_OtherIsTargeted(globalCtx, &this->actor) || (Rand_ZeroOne() > 0.5f) ||
!(play->gameplayFrames & 1)) {
if (Actor_OtherIsTargeted(play, &this->actor) || (Rand_ZeroOne() > 0.5f) ||
(ABS(angleFacingPlayer2) < 0x38E0)) {
EnGeldB_SetupRollForward(this);
} else {
EnGeldB_SetupSpinAttack(this);
}
} else {
EnGeldB_SetupAdvance(this, globalCtx);
EnGeldB_SetupAdvance(this, play);
}
}
}
@ -1308,7 +1306,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) {
((beforeCurFrame < 5) && (((s32)absPlaySpeed + prevFrame) > 5)))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND);
}
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
if ((play->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
}
@ -1329,7 +1327,7 @@ void EnGeldB_SetupDefeated(EnGeldB* this) {
EnGeldB_SetupAction(this, EnGeldB_Defeated);
}
void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Defeated(EnGeldB* this, PlayState* play) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
this->actor.speedXZ = 0.0f;
}
@ -1345,7 +1343,7 @@ void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx) {
}
}
void EnGeldB_TurnHead(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_TurnHead(EnGeldB* this, PlayState* play) {
if ((this->action == GELDB_READY) && (this->lookTimer != 0)) {
this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 8920.0f;
} else if (this->action != GELDB_STUNNED) {
@ -1358,7 +1356,7 @@ void EnGeldB_TurnHead(EnGeldB* this, GlobalContext* globalCtx) {
}
}
void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_CollisionCheck(EnGeldB* this, PlayState* play) {
s32 pad;
EnItem00* key;
@ -1383,7 +1381,7 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) {
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 8);
if (Actor_ApplyDamage(&this->actor) == 0) {
if (this->keyFlag != 0) {
key = Item_DropCollectible(globalCtx, &this->actor.world.pos, this->keyFlag | ITEM00_SMALL_KEY);
key = Item_DropCollectible(play, &this->actor.world.pos, this->keyFlag | ITEM00_SMALL_KEY);
if (key != NULL) {
key->actor.world.rot.y = Math_Vec3f_Yaw(&key->actor.world.pos, &this->actor.home.pos);
key->actor.speedXZ = 6.0f;
@ -1393,7 +1391,7 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) {
}
}
EnGeldB_SetupDefeated(this);
Enemy_StartFinishingBlow(globalCtx, &this->actor);
Enemy_StartFinishingBlow(play, &this->actor);
} else {
EnGeldB_SetupDamaged(this);
}
@ -1402,35 +1400,35 @@ void EnGeldB_CollisionCheck(EnGeldB* this, GlobalContext* globalCtx) {
}
}
void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnGeldB_Update(Actor* thisx, PlayState* play) {
s32 pad;
EnGeldB* this = (EnGeldB*)thisx;
EnGeldB_CollisionCheck(this, globalCtx);
EnGeldB_CollisionCheck(this, play);
if (this->actor.colChkInfo.damageEffect != GELDB_DMG_UNK_6) {
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f,
Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 |
UPDBGCHECKINFO_FLAG_4);
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 40.0f;
EnGeldB_TurnHead(this, globalCtx);
EnGeldB_TurnHead(this, play);
}
Collider_UpdateCylinder(&this->actor, &this->bodyCollider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base);
if ((this->action >= GELDB_READY) && (this->spinAttackState < 2) &&
((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bodyCollider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base);
}
if ((this->action == GELDB_BLOCK) && (this->skelAnime.curFrame == 0.0f)) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->blockCollider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->blockCollider.base);
}
if (this->swordState > 0) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->swordCollider.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base);
}
if (this->blinkState == 0) {
if ((Rand_ZeroOne() < 0.1f) && ((globalCtx->gameplayFrames % 4) == 0)) {
if ((Rand_ZeroOne() < 0.1f) && ((play->gameplayFrames % 4) == 0)) {
this->blinkState++;
}
} else {
@ -1438,11 +1436,10 @@ void EnGeldB_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
s32 EnGeldB_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
s32 EnGeldB_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnGeldB* this = (EnGeldB*)thisx;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2507);
OPEN_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2507);
if (limbIndex == GELDB_LIMB_NECK) {
rot->z += this->headRot.x;
rot->x += this->headRot.y;
@ -1458,11 +1455,11 @@ s32 EnGeldB_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 140, 0, 0, 255);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2529);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2529);
return false;
}
void EnGeldB_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnGeldB_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f footOffset = { 300.0f, 0.0f, 0.0f };
static Vec3f swordTipOffset = { 0.0f, -3000.0f, 0.0f };
static Vec3f swordHiltOffset = { 400.0f, 0.0f, 0.0f };
@ -1547,7 +1544,7 @@ void EnGeldB_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
}
}
void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnGeldB_Draw(Actor* thisx, PlayState* play) {
static Vec3f blockTrisOffsets0[3] = {
{ -3000.0f, 6000.0f, 1600.0f },
{ -3000.0f, 0.0f, 1600.0f },
@ -1563,7 +1560,7 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnGeldB* this = (EnGeldB*)thisx;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2672);
OPEN_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2672);
if (1) {}
if ((this->spinAttackState >= 2) && SkelAnime_Update(&this->skelAnime)) {
@ -1576,23 +1573,23 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->timer--;
if (this->timer == 0) {
if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) {
globalCtx->nextEntranceIndex = ENTR_SPOT09_1;
play->nextEntranceIndex = ENTR_SPOT09_1;
} else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) {
globalCtx->nextEntranceIndex = ENTR_SPOT12_18;
play->nextEntranceIndex = ENTR_SPOT12_18;
} else {
globalCtx->nextEntranceIndex = ENTR_SPOT12_17;
play->nextEntranceIndex = ENTR_SPOT12_17;
}
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
}
}
}
if ((this->action != GELDB_WAIT) || !this->invisible) {
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->blinkState]));
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, EnGeldB_OverrideLimbDraw, EnGeldB_PostLimbDraw, this);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnGeldB_OverrideLimbDraw, EnGeldB_PostLimbDraw, this);
if (this->action == GELDB_BLOCK) {
s32 i;
Vec3f blockTrisVtx0[3];
@ -1612,16 +1609,16 @@ void EnGeldB_Draw(Actor* thisx, GlobalContext* globalCtx) {
if ((this->iceTimer % 4) == 0) {
s32 iceIndex = this->iceTimer >> 2;
EffectSsEnIce_SpawnFlyingVec3s(globalCtx, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235,
245, 255, 1.5f);
EffectSsEnIce_SpawnFlyingVec3s(play, thisx, &this->bodyPartsPos[iceIndex], 150, 150, 150, 250, 235, 245,
255, 1.5f);
}
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_geldB.c", 2744);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2744);
}
s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this) {
Actor* actor = Actor_GetProjectileActor(globalCtx, &this->actor, 800.0f);
s32 EnGeldB_DodgeRanged(PlayState* play, EnGeldB* this) {
Actor* actor = Actor_GetProjectileActor(play, &this->actor, 800.0f);
if (actor != NULL) {
s16 angleToFacing;
@ -1642,7 +1639,7 @@ s32 EnGeldB_DodgeRanged(GlobalContext* globalCtx, EnGeldB* this) {
} else {
this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF;
if ((ABS(angleToFacing) < 0x2000) || (ABS(angleToFacing) > 0x5FFF)) {
EnGeldB_SetupSidestep(this, globalCtx);
EnGeldB_SetupSidestep(this, play);
this->actor.speedXZ *= 3.0f;
} else if (ABS(angleToFacing) < 0x5FFF) {
EnGeldB_SetupRollBack(this);

View file

@ -34,7 +34,7 @@ typedef enum {
/* 0x18 */ GELDB_LIMB_MAX
} EnGeldBLimb;
typedef void (*EnGeldBActionFunc)(struct EnGeldB*, GlobalContext*);
typedef void (*EnGeldBActionFunc)(struct EnGeldB*, PlayState*);
typedef struct EnGeldB {
/* 0x0000 */ Actor actor;