diff --git a/assets/xml/objects/object_pst.xml b/assets/xml/objects/object_pst.xml index d2b5323d67..82fe6315e9 100644 --- a/assets/xml/objects/object_pst.xml +++ b/assets/xml/objects/object_pst.xml @@ -1,7 +1,7 @@  - + diff --git a/include/functions.h b/include/functions.h index 754d35d2f5..50e7687c3a 100644 --- a/include/functions.h +++ b/include/functions.h @@ -327,7 +327,7 @@ s32 func_800B8718(Actor* actor, GameState* gameState); s32 func_800B874C(Actor* actor, PlayState* play, f32 xzRange, f32 yRange); s32 func_800B8804(Actor* actor, PlayState* play, f32 xzRange); s32 func_800B886C(Actor* actor, PlayState* play); -void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y); +void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* posX, s16* posY); bool Actor_OnScreen(PlayState* play, Actor* actor); s32 Actor_HasParent(Actor* actor, PlayState* play); s32 Actor_OfferGetItem(Actor* actor, PlayState* play, GetItemId getItemId, f32 xzRange, f32 yRange); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 1277a7e1ab..7d2df00dac 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2096,14 +2096,14 @@ s32 func_800B886C(Actor* actor, PlayState* play) { return false; } -void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* x, s16* y) { +void Actor_GetScreenPos(PlayState* play, Actor* actor, s16* posX, s16* posY) { Vec3f projectedPos; f32 invW; Actor_GetProjectedPos(play, &actor->focus.pos, &projectedPos, &invW); - *x = PROJECTED_TO_SCREEN_X(projectedPos, invW); - *y = PROJECTED_TO_SCREEN_Y(projectedPos, invW); + *posX = PROJECTED_TO_SCREEN_X(projectedPos, invW); + *posY = PROJECTED_TO_SCREEN_Y(projectedPos, invW); } bool Actor_OnScreen(PlayState* play, Actor* actor) { @@ -3499,12 +3499,13 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { } bool Target_InTargetableScreenRegion(PlayState* play, Actor* actor) { - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; - Actor_GetScreenPos(play, actor, &x, &y); + Actor_GetScreenPos(play, actor, &screenPosX, &screenPosY); - return (x > -20) && (x < gScreenWidth + 20) && (y > -160) && (y < gScreenHeight + 160); + return (screenPosX > -20) && (screenPosX < gScreenWidth + 20) && (screenPosY > -160) && + (screenPosY < gScreenHeight + 160); } /** diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 32c5b0c073..00d2978dd2 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1313,8 +1313,8 @@ s32 Camera_CalcAtForScreen(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, f32* f s32 pad; f32 clampedDeltaY; f32 clampedAbsScreenY; - s16 absScreenY; - s16 screenY; + s16 absScreenPosY; + s16 screenPosY; PosRot* focalActorPosRot = &camera->focalActorPosRot; f32 focalActorHeight = Camera_GetFocalActorHeight(camera); @@ -1322,21 +1322,21 @@ s32 Camera_CalcAtForScreen(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, f32* f focalActorAtOffsetTarget.x = 0.0f; focalActorAtOffsetTarget.z = 0.0f; - Actor_GetScreenPos(camera->play, camera->focalActor, &absScreenY, &screenY); - screenY -= SCREEN_HEIGHT / 2; - absScreenY = ABS(screenY); + Actor_GetScreenPos(camera->play, camera->focalActor, &absScreenPosY, &screenPosY); + screenPosY -= SCREEN_HEIGHT / 2; + absScreenPosY = ABS(screenPosY); // result unused - clampedAbsScreenY = OLib_ClampMaxDist(absScreenY / (f32)(SCREEN_HEIGHT / 2), 1.0f); + clampedAbsScreenY = OLib_ClampMaxDist(absScreenPosY / (f32)(SCREEN_HEIGHT / 2), 1.0f); deltaY = focalActorPosRot->pos.y - *focalActorPosY; clampedDeltaY = OLib_ClampMaxDist(deltaY, deltaYMax); - if (absScreenY > (SCREEN_HEIGHT / 4)) { - absScreenY = SCREEN_HEIGHT / 4; + if (absScreenPosY > (SCREEN_HEIGHT / 4)) { + absScreenPosY = SCREEN_HEIGHT / 4; } - clampedAbsScreenY = OLib_ClampMaxDist(absScreenY / (f32)(SCREEN_HEIGHT / 4), 1.0f); + clampedAbsScreenY = OLib_ClampMaxDist(absScreenPosY / (f32)(SCREEN_HEIGHT / 4), 1.0f); focalActorAtOffsetTarget.y -= clampedDeltaY * clampedAbsScreenY * clampedAbsScreenY; Camera_ScaledStepToCeilVec3f(&focalActorAtOffsetTarget, &camera->focalActorAtOffset, camera->xzOffsetUpdateRate, @@ -3785,8 +3785,8 @@ s32 Camera_Battle1(Camera* camera) { rwData->unk_1A &= ~0x10; } else if (!camera->play->envCtx.skyboxDisabled || (roData->interfaceFlags & BATTLE1_FLAG_0)) { if (func_800CBC84(camera, at, &spC4, 0) != 0) { - s16 screenX; - s16 screenY; + s16 screenPosX; + s16 screenPosY; rwData->unk_1A |= 0x1000; spF8 = OLib_Vec3fDist(at, &focalActorFocus->pos); @@ -3796,10 +3796,10 @@ s32 Camera_Battle1(Camera* camera) { spF4 = OLib_Vec3fDist(at, &spC4.pos); spF8 += (rwData->unk_1A & 0x10) ? 40.0f : 0.0f; - Actor_GetScreenPos(camera->play, camera->focalActor, &screenX, &screenY); + Actor_GetScreenPos(camera->play, camera->focalActor, &screenPosX, &screenPosY); - if ((spF4 < spF8) || - ((screenX >= 0) && (screenX <= SCREEN_WIDTH) && (screenY >= 0) && (screenY <= SCREEN_HEIGHT))) { + if ((spF4 < spF8) || ((screenPosX >= 0) && (screenPosX <= SCREEN_WIDTH) && (screenPosY >= 0) && + (screenPosY <= SCREEN_HEIGHT))) { rwData->unk_1A |= 0x10; spB4.yaw = spA4.yaw + 0x8000; spB4.pitch = -spA4.pitch; @@ -4140,18 +4140,18 @@ s32 Camera_KeepOn1(Camera* camera) { rwData->unk_18 &= ~0x10; } else if (!camera->play->envCtx.skyboxDisabled || (roData->interfaceFlags & KEEPON1_FLAG_0)) { if (func_800CBC84(camera, at, &sp7C, 0) != 0) { - s16 screenX; - s16 screenY; + s16 screenPosX; + s16 screenPosY; rwData->unk_18 |= 0x1000; spF8 = OLib_Vec3fDist(at, &focalActorFocus->pos); spF4 = OLib_Vec3fDist(at, &sp7C.pos); spF8 += (rwData->unk_18 & 0x10) ? 40 : 0.0f; - Actor_GetScreenPos(camera->play, camera->focalActor, &screenX, &screenY); + Actor_GetScreenPos(camera->play, camera->focalActor, &screenPosX, &screenPosY); - if ((spF4 < spF8) || - ((screenX >= 0) && (screenX <= SCREEN_WIDTH) && (screenY >= 0) && (screenY <= SCREEN_HEIGHT))) { + if ((spF4 < spF8) || ((screenPosX >= 0) && (screenPosX <= SCREEN_WIDTH) && (screenPosY >= 0) && + (screenPosY <= SCREEN_HEIGHT))) { rwData->unk_18 |= 0x10; spE0.yaw = (s16)(spD0.yaw + 0x8000); spE0.pitch = -spD0.pitch; @@ -5642,8 +5642,8 @@ s32 Camera_Demo1(Camera* camera) { PosRot* targetPosRot = &camera->targetPosRot; f32 temp_f0; Actor* sp98[1]; - s16 screenX; - s16 screenY; + s16 screenPosX; + s16 screenPosY; s32 phi_v0; VecGeo sp88; PosRot sp74; @@ -5671,10 +5671,11 @@ s32 Camera_Demo1(Camera* camera) { camera->animState++; } - Actor_GetScreenPos(camera->play, camera->target, &screenX, &screenY); + Actor_GetScreenPos(camera->play, camera->target, &screenPosX, &screenPosY); temp_f0 = rwData->unk_0C.r; - if ((screenX > 20) && (screenX < (SCREEN_WIDTH - 20)) && (screenY > 40) && (screenY < (SCREEN_HEIGHT - 40))) { + if ((screenPosX > 20) && (screenPosX < (SCREEN_WIDTH - 20)) && (screenPosY > 40) && + (screenPosY < (SCREEN_HEIGHT - 40))) { if (temp_f0 < 700.0f) { phi_v0 = 0; } else { diff --git a/src/code/z_message.c b/src/code/z_message.c index 4ebcda37fe..63330e5076 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -5208,11 +5208,11 @@ void Message_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx; Input* input = CONTROLLER1(&play->state); - s16 averageY; - s16 sp50; + s16 avgScreenPosY; + s16 screenPosX; u16 temp_v1_2; - s16 sp4C; - s16 sp4A; + s16 playerScreenPosY; + s16 actorScreenPosY; s16 sp48; s32 sp44; s32 sp40; @@ -5223,7 +5223,7 @@ void Message_Update(PlayState* play) { msgCtx->stickAdjX = input->rel.stick_x; msgCtx->stickAdjY = input->rel.stick_y; - averageY = 0; + avgScreenPosY = 0; // If stickAdj is held, set a delay to allow the cursor to read the next input. // The first delay is given a longer time than all subsequent delays. @@ -5309,12 +5309,12 @@ void Message_Update(PlayState* play) { } if (temp) { if (msgCtx->talkActor != NULL) { - Actor_GetScreenPos(play, &GET_PLAYER(play)->actor, &sp50, &sp4C); - Actor_GetScreenPos(play, msgCtx->talkActor, &sp50, &sp4A); - if (sp4C >= sp4A) { - averageY = ((sp4C - sp4A) / 2) + sp4A; + Actor_GetScreenPos(play, &GET_PLAYER(play)->actor, &screenPosX, &playerScreenPosY); + Actor_GetScreenPos(play, msgCtx->talkActor, &screenPosX, &actorScreenPosY); + if (playerScreenPosY >= actorScreenPosY) { + avgScreenPosY = ((playerScreenPosY - actorScreenPosY) / 2) + actorScreenPosY; } else { - averageY = ((sp4A - sp4C) / 2) + sp4C; + avgScreenPosY = ((actorScreenPosY - playerScreenPosY) / 2) + playerScreenPosY; } } else { msgCtx->textboxX = msgCtx->textboxXTarget; @@ -5326,13 +5326,13 @@ void Message_Update(PlayState* play) { if ((u32)msgCtx->textBoxPos == 0) { if ((play->sceneId == SCENE_UNSET_04) || (play->sceneId == SCENE_UNSET_05) || (play->sceneId == SCENE_UNSET_06)) { - if (averageY < 0x64) { + if (avgScreenPosY < 100) { msgCtx->textboxYTarget = sTextboxLowerYPositions[var_v1]; } else { msgCtx->textboxYTarget = sTextboxUpperYPositions[var_v1]; } } else { - if (averageY < 0xA0) { + if (avgScreenPosY < 160) { msgCtx->textboxYTarget = sTextboxLowerYPositions[var_v1]; } else { msgCtx->textboxYTarget = sTextboxUpperYPositions[var_v1]; diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 3cc7ffb87b..f5a233ede6 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -826,11 +826,11 @@ s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst) { */ s32 SubS_Offer(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 itemId, SubSOfferMode mode) { s32 canAccept = false; - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; f32 xzDistToPlayerTemp; - Actor_GetScreenPos(play, actor, &x, &y); + Actor_GetScreenPos(play, actor, &screenPosX, &screenPosY); switch (mode) { case SUBS_OFFER_MODE_GET_ITEM: @@ -847,7 +847,8 @@ s32 SubS_Offer(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 itemI case SUBS_OFFER_MODE_ONSCREEN: //! @bug: Both x and y conditionals are always true, || should be an && - if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { + if (((screenPosX >= 0) || (screenPosX < SCREEN_WIDTH)) && + ((screenPosY >= 0) || (screenPosY < SCREEN_HEIGHT))) { canAccept = Actor_OfferTalkExchange(actor, play, xzRange, yRange, itemId); } break; @@ -864,8 +865,9 @@ s32 SubS_Offer(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 itemI case SUBS_OFFER_MODE_AUTO_TARGETED: //! @bug: Both x and y conditionals are always true, || should be an && - if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && - (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange) && actor->isLockedOn) { + if (((screenPosX >= 0) || (screenPosX < SCREEN_WIDTH)) && + ((screenPosY >= 0) || (screenPosY < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && + (actor->xzDistToPlayer <= xzRange) && actor->isLockedOn) { actor->flags |= ACTOR_FLAG_10000; canAccept = Actor_OfferTalkExchange(actor, play, xzRange, yRange, itemId); } @@ -873,8 +875,9 @@ s32 SubS_Offer(Actor* actor, PlayState* play, f32 xzRange, f32 yRange, s32 itemI case SUBS_OFFER_MODE_AUTO_NEARBY_ONSCREEN: //! @bug: Both x and y conditionals are always true, || should be an && - if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) && - (fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) { + if (((screenPosX >= 0) || (screenPosX < SCREEN_WIDTH)) && + ((screenPosY >= 0) || (screenPosY < SCREEN_HEIGHT)) && (fabsf(actor->playerHeightRel) <= yRange) && + (actor->xzDistToPlayer <= xzRange)) { actor->flags |= ACTOR_FLAG_10000; canAccept = Actor_OfferTalkExchange(actor, play, xzRange, yRange, itemId); } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c index b7c420b1a1..4926f620aa 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Balance/z_bg_dblue_balance.c @@ -173,11 +173,11 @@ s32 func_80B82454(BgDblueBalance* this, PlayState* play) { void func_80B8259C(BgDblueBalance* this, PlayState* play) { s32 pad; - WaterBox* sp30; + WaterBox* waterBox; f32 sp2C; if (WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, &sp2C, - &sp30)) { + &waterBox)) { this->dyna.actor.depthInWater = sp2C - this->dyna.actor.world.pos.y; this->unk_228 = sp2C; if ((this->dyna.actor.depthInWater < 150.0f) && (this->dyna.actor.depthInWater > -150.0f)) { diff --git a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c index 74a1151350..0cfdb1500e 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c @@ -270,12 +270,13 @@ void func_80B84348(BgDblueWaterfall* this, PlayState* play, f32 arg2, f32 arg3, void func_80B84568(BgDblueWaterfall* this, PlayState* play) { s32 pad; CollisionPoly* sp40; - WaterBox* sp3C; + WaterBox* waterBox; s32 sp38; f32 sp34 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp40, &sp38, &this->actor, &this->actor.world.pos); f32 sp30; - if (WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, &sp3C)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, + &waterBox)) { if (sp30 < sp34) { this->unk_198 = sp34; } else { diff --git a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c index 40a8c3ca2c..cb5251de61 100644 --- a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c +++ b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c @@ -118,12 +118,12 @@ void func_80AC4C18(BgIcefloe* this) { } void func_80AC4C34(BgIcefloe* this, PlayState* play) { - WaterBox* water; + WaterBox* waterBox; this->timer--; if ((this->timer == 0) || !WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, - &this->dyna.actor.home.pos.y, &water)) { + &this->dyna.actor.home.pos.y, &waterBox)) { func_80AC4CF0(this); } else { this->dyna.actor.world.pos.y = diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c index 04e784635d..0d23d6bec0 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c @@ -148,10 +148,10 @@ void func_80AD6B68(BgLotus* this, PlayState* play) { void BgLotus_Update(Actor* thisx, PlayState* play) { BgLotus* this = THIS; s32 pad; - WaterBox* sp2C; + WaterBox* waterBox; WaterBox_GetSurface1_2(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, - &this->unk160, &sp2C); + &this->unk160, &waterBox); this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index cd1a9626cd..eb9dc87470 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -270,12 +270,12 @@ void func_8088A894(EnArrow* this, PlayState* play) { } void func_8088AA98(EnArrow* this, PlayState* play) { - WaterBox* sp54; + WaterBox* waterBox; f32 sp50 = this->actor.world.pos.y; Vec3f sp44; f32 temp_f0; - if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &waterBox) && (this->actor.world.pos.y < sp50) && !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { this->actor.bgCheckFlags |= BGCHECKFLAG_WATER; diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index f4f56a6307..69aa87602b 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -196,22 +196,22 @@ void EnAttackNiw_AnimateWingHead(EnAttackNiw* this, PlayState* play, s16 animInd } s32 EnAttackNiw_IsOnScreen(EnAttackNiw* this, PlayState* play) { - s16 posX; - s16 posY; + s16 screenPosX; + s16 screenPosY; Actor_SetFocus(&this->actor, this->targetHeight); - Actor_GetScreenPos(play, &this->actor, &posX, &posY); + Actor_GetScreenPos(play, &this->actor, &screenPosX, &screenPosY); - if ((this->actor.projectedPos.z < -20.0f) || (posX < 0) || (posX > SCREEN_WIDTH) || (posY < 0) || - (posY > SCREEN_HEIGHT)) { + if ((this->actor.projectedPos.z < -20.0f) || (screenPosX < 0) || (screenPosX > SCREEN_WIDTH) || (screenPosY < 0) || + (screenPosY > SCREEN_HEIGHT)) { return false; } return true; } void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) { - s16 posX; - s16 posY; + s16 screenPosX; + s16 screenPosY; Vec3f viewOffset; Vec3f flightTarget; s32 pad; @@ -237,7 +237,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) { Math_ApproachF(&this->rotStep, 5000.0f, 1.0f, 100.0f); Actor_SetFocus(&this->actor, this->targetHeight); - Actor_GetScreenPos(play, &this->actor, &posX, &posY); + Actor_GetScreenPos(play, &this->actor, &screenPosX, &screenPosY); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->targetRotY = this->actor.yawTowardsPlayer; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 017aaeed43..dbeffbc882 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -1348,8 +1348,8 @@ s32 func_80A973B4(EnAz* this, PlayState* play) { } void func_80A97410(EnAz* this, PlayState* play) { - s16 sp56; - s16 sp54; + s16 screenPosX; + s16 screenPosY; s32 temp_a0; if (this->unk_378 != 0) { @@ -1466,8 +1466,9 @@ void func_80A97410(EnAz* this, PlayState* play) { this->unk_378 = 9; } } else { - Actor_GetScreenPos(play, &this->actor, &sp56, &sp54); - if ((sp56 >= 0) && (sp56 <= SCREEN_WIDTH) && (sp54 >= 0) && (sp54 <= SCREEN_HEIGHT) && + Actor_GetScreenPos(play, &this->actor, &screenPosX, &screenPosY); + if ((screenPosX >= 0) && (screenPosX <= SCREEN_WIDTH) && (screenPosY >= 0) && + (screenPosY <= SCREEN_HEIGHT) && Actor_OfferTalkExchange(&this->actor, play, 120.0f, 120.0f, PLAYER_IA_NONE)) { this->unk_3D2 = func_80A97274(this, play); if ((this->unk_3D2 == 0x10CE) || (this->unk_3D2 == 0x10D4)) { diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 9ad1f7c265..caf43c0ebd 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -143,12 +143,13 @@ s32 EnBba01_TestIsTalking(EnBba01* this, PlayState* play) { } s32 func_809CC270(EnBba01* this, PlayState* play) { - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; - Actor_GetScreenPos(play, &this->enHy.actor, &x, &y); + Actor_GetScreenPos(play, &this->enHy.actor, &screenPosX, &screenPosY); //! @bug: Both x and y conditionals are always true, || should be an && - if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { + if (!this->enHy.waitingOnInit && ((screenPosX >= 0) || (screenPosX < SCREEN_WIDTH)) && + ((screenPosY >= 0) || (screenPosY < SCREEN_HEIGHT))) { Actor_OfferTalkExchangeEquiCylinder(&this->enHy.actor, play, 30.0f, PLAYER_IA_MAGIC_BEANS); } return true; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index cf06ca1ff0..0979fd3a8d 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -184,13 +184,13 @@ s32 EnBigokuta_ValidatePictograph(PlayState* play, Actor* thisx) { } s32 EnBigokuta_IsInWater(EnBigokuta* this, PlayState* play) { - WaterBox* box; + WaterBox* waterBox; s32 bgId; this->picto.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &this->picto.actor.floorPoly, &bgId, &this->picto.actor, &this->picto.actor.world.pos); if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->picto.actor.world.pos.x, this->picto.actor.world.pos.z, - &this->picto.actor.home.pos.y, &box) || + &this->picto.actor.home.pos.y, &waterBox) || (this->picto.actor.home.pos.y <= this->picto.actor.floorHeight)) { return false; } else { diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index 07dd8c44fb..ae1f9e3fbd 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -371,11 +371,12 @@ void func_80A281B4(EnBigpamet* this) { } void func_80A281DC(EnBigpamet* this, PlayState* play) { - WaterBox* sp2C; + WaterBox* waterBox; f32 sp28; if (this->actor.parent->params == GEKKO_GET_SNAPPER) { - if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, &sp2C)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp28, + &waterBox)) { this->actor.depthInWater = sp28 - this->actor.world.pos.y; } else { this->actor.depthInWater = this->actor.world.pos.y; diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 9b5ecfbbf8..e8b235a5bd 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -542,7 +542,7 @@ void func_80C01CD0(EnBomjimb* this, PlayState* play) { return; } - if (this->actor.draw == 0) { + if (this->actor.draw == NULL) { this->unk_2E4->shape.rot.z = -this->unk_2E4->shape.rot.z; this->unk_2E4->shape.rot.z *= 0.1f; if (fabsf(this->unk_2E4->shape.rot.z) < 100.0f) { diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index ffd7fdae5c..4aeb6d8d70 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -61,11 +61,11 @@ void EnBoom_SetupAction(EnBoom* this, EnBoomActionFunc actionFunc) { } void func_808A24DC(EnBoom* this, PlayState* play) { - WaterBox* sp54; + WaterBox* waterBox; f32 sp50 = this->actor.world.pos.y; u16 sp4E = this->actor.bgCheckFlags & BGCHECKFLAG_WATER; - if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &waterBox) && (this->actor.world.pos.y < sp50)) { Vec3f sp40; diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 99500be0f3..9e97549fc8 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -135,12 +135,13 @@ s32 EnCne01_TestIsTalking(EnCne01* this, PlayState* play) { } s32 func_809CB4A0(EnCne01* this, PlayState* play) { - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; - Actor_GetScreenPos(play, &this->enHy.actor, &x, &y); + Actor_GetScreenPos(play, &this->enHy.actor, &screenPosX, &screenPosY); //! @bug: Both x and y conditionals are always true, || should be an && - if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) { + if (!this->enHy.waitingOnInit && ((screenPosX >= 0) || (screenPosX < SCREEN_WIDTH)) && + ((screenPosY >= 0) || (screenPosY < SCREEN_HEIGHT))) { Actor_OfferTalkExchangeEquiCylinder(&this->enHy.actor, play, 30.0f, PLAYER_IA_MAGIC_BEANS); } return true; diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index 9533f0a1ff..69ff37fe10 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -295,7 +295,7 @@ s32 func_80B2899C(EnFish2* this, PlayState* play) { } void func_80B289DC(EnFish2* this, PlayState* play) { - WaterBox* sp2C; + WaterBox* waterBox; if (this->unk_2B4 != 0) { this->unk_348 = 0; @@ -314,7 +314,7 @@ void func_80B289DC(EnFish2* this, PlayState* play) { this->actor.gravity = 0.0f; } } else if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, - &this->unk_334, &sp2C)) { + &this->unk_334, &waterBox)) { if ((this->unk_334 != BGCHECK_Y_MIN) && (this->actor.world.pos.y < (this->unk_334 - this->unk_2D8))) { this->actor.velocity.y = this->actor.world.rot.x * 0.001f * -0.1f; if (this->actionFunc == func_80B297FC) { @@ -922,10 +922,10 @@ void func_80B2A498(EnFish2* this, PlayState* play) { if ((this->animIndex == FISH2_ANIM_4) && (Animation_OnFrame(&this->skelAnime, 13.0f) || Animation_OnFrame(&this->skelAnime, 31.0f))) { - WaterBox* sp78; + WaterBox* waterBox; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_334, - &sp78)) { + &waterBox)) { Vec3f sp6C; s32 i; @@ -1136,7 +1136,7 @@ void func_80B2ADB0(EnFish2* this, Vec3f* vec, s16 arg2) { void func_80B2AF80(EnFish2* this, PlayState* play) { EnFish2UnkStruct* ptr = &this->unk_3F8[0]; - WaterBox* sp90; + WaterBox* waterBox; f32 sp8C; s32 i; @@ -1154,7 +1154,7 @@ void func_80B2AF80(EnFish2* this, PlayState* play) { ptr->unk_04.y += 1.0f + ((Rand_ZeroOne() - 0.3f) * 1.2f); ptr->unk_04.z += (0.3f + (Rand_ZeroOne() * 0.5f)) - 0.55f; sp8C = ptr->unk_04.y; - if (!WaterBox_GetSurface1(play, &play->colCtx, ptr->unk_04.x, ptr->unk_04.z, &sp8C, &sp90)) { + if (!WaterBox_GetSurface1(play, &play->colCtx, ptr->unk_04.x, ptr->unk_04.z, &sp8C, &waterBox)) { ptr->unk_00 = 0; } else if (sp8C < ptr->unk_04.y) { Vec3f sp7C; diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index bfe84b6ef1..ffdc553775 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -443,14 +443,14 @@ s32 EnFsn_TestCancelOption(EnFsn* this, PlayState* play, Input* input) { } void EnFsn_UpdateCursorPos(EnFsn* this, PlayState* play) { - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; f32 xOffset = 0.0f; f32 yOffset = 17.0f; - Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y); - this->cursorPos.x = x + xOffset; - this->cursorPos.y = y + yOffset; + Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &screenPosX, &screenPosY); + this->cursorPos.x = screenPosX + xOffset; + this->cursorPos.y = screenPosY + yOffset; this->cursorPos.z = 1.2f; } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index cec8d03cc4..fd3deb557b 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -499,11 +499,11 @@ s32 func_8093F6F8(EnGoroiwa* this, PlayState* play) { } if (this->unk_1CA == 0) { - WaterBox* sp44; + WaterBox* waterBox; f32 sp40; if (WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp40, - &sp44)) { + &waterBox)) { if ((this->actor.world.pos.y + this->unk_1DC) <= sp40) { this->unk_1E5 |= 0x20; if (sp40 < (this->unk_1DC + sp78)) { diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index d918a56695..5b15e66a3d 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -1044,14 +1044,14 @@ void EnGs_Update(Actor* thisx, PlayState* play) { func_80998040(this, play); } } else { - s16 sp2E; - s16 sp2C; + s16 screenPosX; + s16 screenPosY; if ((this->actor.flags & ACTOR_FLAG_40) || (this->unk_19A & 0x100) || (this->unk_19A & 0x200)) { func_80999BC8(&this->actor, play); - Actor_GetScreenPos(play, &this->actor, &sp2E, &sp2C); - if ((this->actor.xyzDistToPlayerSq > SQ(400.0f)) || (sp2E < 0) || (sp2E > SCREEN_WIDTH) || (sp2C < 0) || - (sp2C > SCREEN_HEIGHT)) { + Actor_GetScreenPos(play, &this->actor, &screenPosX, &screenPosY); + if ((this->actor.xyzDistToPlayerSq > SQ(400.0f)) || (screenPosX < 0) || (screenPosX > SCREEN_WIDTH) || + (screenPosY < 0) || (screenPosY > SCREEN_HEIGHT)) { this->unk_216 = 0; } else if (this->quakeY > 0) { Actor_RequestQuakeAndRumble(&this->actor, play, this->quakeY, this->quakeDuration); diff --git a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c index 01b38b43aa..4ed2788ca2 100644 --- a/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c +++ b/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.c @@ -355,12 +355,12 @@ void func_80BDBA28(EnHiddenNuts* this, PlayState* play) { void func_80BDBB48(EnHiddenNuts* this, PlayState* play) { s32 pad[3]; f32 curFrame = this->skelAnime.curFrame; - WaterBox* sp54; + WaterBox* waterBox; f32 sp50; s16 sp4E = false; Vec3f sp40; - if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) && + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &waterBox) && (this->actor.world.pos.y < sp50)) { this->actor.velocity.y = 0.0f; Math_Vec3f_Copy(&sp40, &this->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 2876867f83..419e640826 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -617,7 +617,7 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { s32 pathCount; Vec3s* pathPoints; - if (pathIndex == -1) { + if (pathIndex == PATH_INDEX_NONE) { return false; } diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 1f50942b3f..94ab471f68 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -364,11 +364,11 @@ void func_8095E204(EnIshi* this, PlayState* play) { s32 func_8095E2B0(EnIshi* this, PlayState* play) { s32 pad; - WaterBox* sp30; + WaterBox* waterBox; f32 sp2C; s32 sp28; - if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &sp30, + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &waterBox, &sp28) && (this->actor.world.pos.y < sp2C)) { return true; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 902697cc35..d2104d153d 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -346,8 +346,8 @@ void EnKakasi_SetupIdleStanding(EnKakasi* this) { void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { u32 day = gSaveContext.save.day; - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; // first talk to scarecrow dialogue this->picto.actor.textId = 0x1644; @@ -362,9 +362,9 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { return; } if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) { - Actor_GetScreenPos(play, &this->picto.actor, &x, &y); - if ((this->picto.actor.projectedPos.z > -20.0f) && (x > 0) && (x < SCREEN_WIDTH) && (y > 0) && - (y < SCREEN_HEIGHT) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) { + Actor_GetScreenPos(play, &this->picto.actor, &screenPosX, &screenPosY); + if ((this->picto.actor.projectedPos.z > -20.0f) && (screenPosX > 0) && (screenPosX < SCREEN_WIDTH) && + (screenPosY > 0) && (screenPosY < SCREEN_HEIGHT) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) { // faster shaking EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); this->skelAnime.playSpeed = 2.0f; diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index d62113c85f..6ffa291792 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -128,14 +128,15 @@ s32 func_80A68860(EnMushi2* this, PlayState* play) { s32 sp40; CollisionPoly* sp3C; f32 temp_f0 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp3C, &sp40, &this->actor, &this->actor.world.pos); - WaterBox* sp34; + WaterBox* waterBox; f32 sp30; if ((temp_f0 > (BGCHECK_Y_MIN + 1)) && ((this->actor.world.pos.y - 150.0f) < temp_f0)) { return true; } - return WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, &sp34); + return WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, + &waterBox); } s32 func_80A68910(EnMushi2* this, PlayState* play) { @@ -528,7 +529,7 @@ void func_80A697C4(EnMushi2* this, PlayState* play) { s32 bgId = this->polyBgId; if (!(this->unk_30C & (0x10 | 0x4))) { - WaterBox* sp30; + WaterBox* waterBox; f32 sp2C; this->unk_30C &= ~(0x40 | 0x8 | 0x2); @@ -537,7 +538,7 @@ void func_80A697C4(EnMushi2* this, PlayState* play) { } if (WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, - &sp30)) { + &waterBox)) { this->actor.depthInWater = sp2C - this->actor.world.pos.y; if (this->actor.depthInWater >= 1.0f) { this->unk_30C |= 0x20; @@ -577,7 +578,7 @@ void func_80A697C4(EnMushi2* this, PlayState* play) { s32 func_80A699E4(EnMushi2* this, PlayState* play) { s32 pad; - WaterBox* sp40; + WaterBox* waterBox; f32 sp3C; if (this->unk_328.y < 0.0f) { @@ -585,7 +586,7 @@ s32 func_80A699E4(EnMushi2* this, PlayState* play) { f32 y = (2.0f * this->unk_328.y) + this->actor.world.pos.y; f32 z = (2.0f * this->unk_328.z) + this->actor.world.pos.z; - if (WaterBox_GetSurface1_2(play, &play->colCtx, x, z, &sp3C, &sp40) && (y <= sp3C)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, x, z, &sp3C, &waterBox) && (y <= sp3C)) { return true; } } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index a42e093cf7..968a9c6f2b 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -292,12 +292,12 @@ void EnOssan_Destroy(Actor* thisx, PlayState* play) { } void EnOssan_UpdateCursorPos(PlayState* play, EnOssan* this) { - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; - Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y); - this->cursorPos.x = x; - this->cursorPos.y = y; + Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &screenPosX, &screenPosY); + this->cursorPos.x = screenPosX; + this->cursorPos.y = screenPosY; } void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 6df96fbe5e..d587d03d64 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -888,7 +888,7 @@ s32 func_8095C510(EnOwl* this) { void func_8095C568(EnOwl* this) { if (this->actionFlags & 0x40) { - if ((this->csIdIndex < 0) || (this->csIdList[this->csIdIndex] < 0)) { + if ((this->csIdIndex < 0) || (this->csIdList[this->csIdIndex] <= CS_ID_NONE)) { this->actionFlags &= ~0x40; } else if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index d4bb67d8a3..6118db8cce 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -105,20 +105,38 @@ static CollisionCheckInfoInit2 sColChkInfoInit2 = { 0, 0, 0, 0, MASS_IMMOVABLE, }; -static AnimationInfo sAnimationInfo[] = { - { &object_pamera_Anim_0005BC, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_pamera_Anim_008AE0, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_pamera_Anim_008E38, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_pamera_Anim_00A844, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_pamera_Anim_00B0C4, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_pamera_Anim_009870, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_pamera_Anim_009F54, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_pamera_Anim_00B5B0, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_pamera_Anim_00BCC4, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_pamera_Anim_00D9DC, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_pamera_Anim_00E16C, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_pamera_Anim_00C9F4, 1.0f, 0, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &object_pamera_Anim_00D0F0, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, +typedef enum PamelaAnimation { + /* -1 */ PAMELA_ANIM_NONE = -1, + /* 0x0 */ PAMELA_ANIM_0, + /* 0x1 */ PAMELA_ANIM_1, + /* 0x2 */ PAMELA_ANIM_2, + /* 0x3 */ PAMELA_ANIM_3, + /* 0x4 */ PAMELA_ANIM_4, + /* 0x5 */ PAMELA_ANIM_5, + /* 0x6 */ PAMELA_ANIM_6, + /* 0x7 */ PAMELA_ANIM_7, + /* 0x8 */ PAMELA_ANIM_8, + /* 0x9 */ PAMELA_ANIM_9, + /* 0xA */ PAMELA_ANIM_10, + /* 0xB */ PAMELA_ANIM_11, + /* 0xC */ PAMELA_ANIM_12, + /* 0xD */ PAMELA_ANIM_MAX +} PamelaAnimation; + +static AnimationInfo sAnimationInfo[PAMELA_ANIM_MAX] = { + { &object_pamera_Anim_0005BC, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, // PAMELA_ANIM_0 + { &object_pamera_Anim_008AE0, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, // PAMELA_ANIM_1 + { &object_pamera_Anim_008E38, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, // PAMELA_ANIM_2 + { &object_pamera_Anim_00A844, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, // PAMELA_ANIM_3 + { &object_pamera_Anim_00B0C4, 1.0f, 0, 0.0f, ANIMMODE_LOOP, -4.0f }, // PAMELA_ANIM_4 + { &object_pamera_Anim_009870, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, // PAMELA_ANIM_5 + { &object_pamera_Anim_009F54, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, // PAMELA_ANIM_6 + { &object_pamera_Anim_00B5B0, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, // PAMELA_ANIM_7 + { &object_pamera_Anim_00BCC4, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, // PAMELA_ANIM_8 + { &object_pamera_Anim_00D9DC, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, // PAMELA_ANIM_9 + { &object_pamera_Anim_00E16C, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, // PAMELA_ANIM_10 + { &object_pamera_Anim_00C9F4, 1.0f, 0, 0.0f, ANIMMODE_ONCE, 0.0f }, // PAMELA_ANIM_11 + { &object_pamera_Anim_00D0F0, 1.0f, 0, 0.0f, ANIMMODE_LOOP, 0.0f }, // PAMELA_ANIM_12 }; static Vec3f D_80BDA5F0 = { 1000.0f, 0.0f, 0.0f }; @@ -148,7 +166,7 @@ void EnPamera_Init(Actor* thisx, PlayState* play) { this->hideInisdeTimer = 0; this->unk_322 = 0; this->unk_324 = 0; - if ((this->actor.params & 0xF000) >> 0xC) { + if (PAMELA_GET_F000(&this->actor)) { func_80BD9840(this, play); } else { func_80BD8588(this, play); @@ -195,7 +213,7 @@ s32 func_80BD84F0(EnPamera* this, PlayState* play) { } void func_80BD8588(EnPamera* this, PlayState* play) { - Path* path = &play->setupPathList[ENPAMERA_GET_PATH_INDEX(&this->actor)]; + Path* path = &play->setupPathList[PAMELA_GET_PATH_INDEX(&this->actor)]; Vec3f sp28; if (path == NULL) { @@ -234,27 +252,27 @@ void EnPamera_Destroy(Actor* thisx, PlayState* play) { void func_80BD8700(EnPamera* this) { this->hideInisdeTimer = 0; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_0); this->actionFunc = func_80BD8758; } void func_80BD8758(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 1800) { - if (CutsceneManager_IsNext(this->csIdList[0]) && (this->csIdList[0] != -1)) { + if (CutsceneManager_IsNext(this->csIdList[0]) && (this->csIdList[0] != CS_ID_NONE)) { CutsceneManager_StartWithPlayerCs(this->csIdList[0], &this->actor); Camera_SetFocalActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csIdList[0])), &this->actor); this->actor.speed = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; func_80BD9338(this, play); func_80BD8908(this); - } else if ((this->csIdList[0] != -1) && (this->actor.xzDistToPlayer < 1000.0f)) { + } else if ((this->csIdList[0] != CS_ID_NONE) && (this->actor.xzDistToPlayer < 1000.0f)) { CutsceneManager_Queue(this->csIdList[0]); } else { this->actor.speed = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_1); this->actor.shape.rot.y = this->actor.home.rot.y; this->actor.world.rot.y = this->actor.home.rot.y; func_80BD9338(this, play); @@ -276,7 +294,7 @@ void func_80BD8758(EnPamera* this, PlayState* play) { void func_80BD8908(EnPamera* this) { this->actor.draw = EnPamera_Draw; this->actor.flags |= ACTOR_FLAG_TARGETABLE; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_1); this->actionFunc = func_80BD8964; } @@ -289,14 +307,14 @@ void func_80BD8964(EnPamera* this, PlayState* play) { if (Math_Vec3f_StepTo(&this->actor.world.pos, &vec, 1.0f) < 5.0f) { this->actor.speed = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_1); SET_WEEKEVENTREG(WEEKEVENTREG_59_01); func_80BD8B50(this); } } void func_80BD8A38(EnPamera* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_1); this->actionFunc = func_80BD8A7C; } @@ -343,14 +361,14 @@ void func_80BD8B70(EnPamera* this, PlayState* play) { void func_80BD8CCC(EnPamera* this) { this->hideInisdeTimer = 0; this->actor.speed = 0.0f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_3); this->actionFunc = func_80BD8D1C; } void func_80BD8D1C(EnPamera* this, PlayState* play) { if (this->hideInisdeTimer++ > 200) { this->actor.speed = 1.5f; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_1); func_80BD8D80(this); } } @@ -386,14 +404,14 @@ void func_80BD8DB0(EnPamera* this, PlayState* play) { void EnPamera_LookDownWell(EnPamera* this) { func_80BD93CC(this, 1, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_4); this->actionFunc = func_80BD8F60; } void func_80BD8F60(EnPamera* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x3000, 0x1000); if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_2); this->actor.speed = 3.0f; func_80BD93CC(this, 0, 0); func_80BD8D80(this); @@ -410,7 +428,7 @@ void func_80BD8FF0(EnPamera* this) { pameraYaw = Math_Vec3f_Yaw(&pameraPos, &this->actor.world.pos); this->actor.shape.rot.y = pameraYaw; this->actor.world.rot.y = pameraYaw; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_3); this->actionFunc = func_80BD909C; } @@ -420,19 +438,19 @@ void func_80BD909C(EnPamera* this, PlayState* play) { void func_80BD90AC(EnPamera* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (Player_GetMask(play) != PLAYER_MASK_STONE && (this->actionFunc != func_80BD8758) && + if ((Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actionFunc != func_80BD8758) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD8A7C) && (this->actionFunc != func_80BD8F60) && ((this->actionFunc != func_80BD8B70) || (this->waypointIndex != 0)) && ((this->actionFunc != func_80BD8DB0) || (this->actor.speed != 3.0f)) && ((this->actor.xzDistToPlayer < 150.0f) || ((this->actionFunc == func_80BD909C) && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f)))) { - if ((CutsceneManager_IsNext(this->csIdList[1])) && ((this->csIdList[1] != -1))) { + if (CutsceneManager_IsNext(this->csIdList[1]) && (this->csIdList[1] != CS_ID_NONE)) { CutsceneManager_StartWithPlayerCs(this->csIdList[1], &this->actor); Camera_SetFocalActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(this->csIdList[1])), &this->actor); EnPamera_LookDownWell(this); - } else if (this->csIdList[1] != -1) { + } else if (this->csIdList[1] != CS_ID_NONE) { CutsceneManager_Queue(this->csIdList[1]); } else { EnPamera_LookDownWell(this); @@ -446,12 +464,12 @@ s32 func_80BD9234(EnPamera* this, PlayState* play) { while (actor != NULL) { if ((actor->id == ACTOR_EN_BOM) && (Math_Vec3f_DistXZ(&this->actor.world.pos, &actor->world.pos) < 500.0f) && (((EnBom*)actor)->timer == 0)) { - return 1; + return true; } else { actor = actor->next; } } - return 0; + return false; } void func_80BD92D0(EnPamera* this, PlayState* play) { @@ -459,7 +477,7 @@ void func_80BD92D0(EnPamera* this, PlayState* play) { s32 pathIndex = this->additionalPathIndex; path = &play->setupPathList[pathIndex]; - if (pathIndex >= 0) { + if (pathIndex > PATH_INDEX_NONE) { this->pathPoints = Lib_SegmentedToVirtual(path->points); this->waypointIndex = 0; this->pathCount = path->count; @@ -586,7 +604,7 @@ void func_80BD9840(EnPamera* this, PlayState* play) { void func_80BD9904(EnPamera* this) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - this->actionFunc = &func_80BD9928; + this->actionFunc = func_80BD9928; } void func_80BD9928(EnPamera* this, PlayState* play) { @@ -609,15 +627,13 @@ void func_80BD994C(EnPamera* this, PlayState* play) { func_80BD93CC(this, 1, 0); Message_StartTextbox(play, 0x158E, &this->actor); this->unk_324 = 0x158E; + } else if (!(this->unk_322 & 1)) { + this->unk_322 |= 1; + Message_StartTextbox(play, 0x1587, &this->actor); + this->unk_324 = 0x1587; } else { - if (!(this->unk_322 & 1)) { - this->unk_322 |= 1; - Message_StartTextbox(play, 0x1587, &this->actor); - this->unk_324 = 0x1587; - } else { - Message_StartTextbox(play, 0x158C, &this->actor); - this->unk_324 = 0x158C; - } + Message_StartTextbox(play, 0x158C, &this->actor); + this->unk_324 = 0x158C; } func_80BD9A9C(this); } else { @@ -662,27 +678,35 @@ void func_80BD9B4C(EnPamera* this, PlayState* play) { Message_StartTextbox(play, 0x1588, &this->actor); this->unk_324 = 0x1588; break; + case 0x1588: Message_StartTextbox(play, 0x1589, &this->actor); this->unk_324 = 0x1589; break; + case 0x1589: Message_StartTextbox(play, 0x158A, &this->actor); this->unk_324 = 0x158A; break; + case 0x158A: Message_StartTextbox(play, 0x158B, &this->actor); this->unk_324 = 0x158B; break; + case 0x158C: Message_StartTextbox(play, 0x158D, &this->actor); this->unk_324 = 0x158D; break; + case 0x158E: case 0x15A8: Message_CloseTextbox(play); func_80BD9C70(this, play); break; + + default: + break; } } } @@ -706,6 +730,7 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { case 1: func_80BD9E88(this); break; + case 2: if (this->actor.draw == NULL) { this->actor.draw = EnPamera_Draw; @@ -713,23 +738,30 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { } func_80BD9EE0(this); break; + case 3: func_80BDA038(this); break; + case 4: func_80BDA0A0(this); break; + case 5: func_80BDA170(this); break; + case 6: func_80BDA288(this); break; + + default: + break; } } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); this->setupFunc(this, play); - return 1; + return true; } if ((play->csCtx.state == CS_STATE_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_20)) { if ((this->actionFunc != func_80BD994C) && (this->actionFunc != EnPamera_HandleDialogue)) { @@ -739,7 +771,7 @@ s32 func_80BD9CB8(EnPamera* this, PlayState* play) { } } this->cueId = 99; - return 0; + return false; } void func_80BD9E60(EnPamera* this) { @@ -751,7 +783,7 @@ void func_80BD9E78(EnPamera* this, PlayState* play) { } void func_80BD9E88(EnPamera* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_0); this->unk_31E = 0; this->setupFunc = func_80BD9ED0; } @@ -760,7 +792,7 @@ void func_80BD9ED0(EnPamera* this, PlayState* play) { } void func_80BD9EE0(EnPamera* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_5); func_80BD93CC(this, 1, 0); this->unk_31E = 1; this->setupFunc = func_80BD9F3C; @@ -777,14 +809,14 @@ void func_80BD9F3C(EnPamera* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_6); } } } void func_80BDA038(EnPamera* this) { func_80BD93CC(this, 0, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 7); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_7); this->unk_31E = 0; this->setupFunc = func_80BDA090; } @@ -794,7 +826,7 @@ void func_80BDA090(EnPamera* this, PlayState* play) { void func_80BDA0A0(EnPamera* this) { func_80BD93CC(this, 0, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_8); this->unk_31E = 1; this->setupFunc = func_80BDA0FC; } @@ -804,7 +836,7 @@ void func_80BDA0FC(EnPamera* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_6); } } } @@ -812,7 +844,7 @@ void func_80BDA0FC(EnPamera* this, PlayState* play) { void func_80BDA170(EnPamera* this) { this->unk_31E = 1; func_80BD93CC(this, 0, 1); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_9); this->setupFunc = func_80BDA1C8; } @@ -825,7 +857,7 @@ void func_80BDA1C8(EnPamera* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 10); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_10); } } } @@ -833,7 +865,7 @@ void func_80BDA1C8(EnPamera* this, PlayState* play) { void func_80BDA288(EnPamera* this) { this->unk_31E = 1; func_80BD93CC(this, 0, 0); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_11); this->setupFunc = func_80BDA2E0; } @@ -841,7 +873,7 @@ void func_80BDA2E0(EnPamera* this, PlayState* play) { if (this->unk_31E == 1) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->unk_31E = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, PAMELA_ANIM_12); } } } diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h index 4fa3e4f5f9..cde9449c81 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.h @@ -9,7 +9,8 @@ struct EnPamera; typedef void (*EnPameraActionFunc)(struct EnPamera*, PlayState*); typedef void (*EnPameraSetupFunc)(struct EnPamera*, PlayState*); -#define ENPAMERA_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF0) >> 4) +#define PAMELA_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF0) >> 4) +#define PAMELA_GET_F000(thisx) (((thisx)->params & 0xF000) >> 0xC) typedef struct EnPamera { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index f941ee00f1..c2437b7e9a 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -463,7 +463,7 @@ void EnPametfrog_SetupRearOnSnapperWave(EnPametfrog* this) { } void EnPametfrog_RearOnSnapperWave(EnPametfrog* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && this->timer > 0) { + if (SkelAnime_Update(&this->skelAnime) && (this->timer > 0)) { this->timer--; if (this->timer == 0) { EnPametfrog_SetupRearOnSnapper(this); @@ -666,7 +666,7 @@ void EnPametfrog_SetupWallPause(EnPametfrog* this) { this->wallRotation = this->unk_2E8.y > 0.0f ? (M_PI / 30) : (-M_PI / 30); } else { randFloat = Rand_ZeroFloat(0x2000); - this->wallRotation = (Rand_ZeroOne() < 0.5f ? -1 : 1) * (0x1000 + randFloat) * (M_PI / (15 * 0x8000)); + this->wallRotation = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (0x1000 + randFloat) * (M_PI / (15 * 0x8000)); } this->timer = 15; Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_RUNAWAY2); @@ -772,7 +772,7 @@ void EnPametfrog_SetupJumpOnSnapper(EnPametfrog* this) { } void EnPametfrog_JumpOnSnapper(EnPametfrog* this, PlayState* play) { - f32 temp_f0; + f32 lerp; EnBigpamet* bigpamet; SkelAnime_Update(&this->skelAnime); @@ -781,9 +781,9 @@ void EnPametfrog_JumpOnSnapper(EnPametfrog* this, PlayState* play) { EnPametfrog_SetupLandOnSnapper(this); } else { bigpamet = (EnBigpamet*)this->actor.child; - temp_f0 = 1.0f / this->timer; - this->actor.world.pos.x -= (this->actor.world.pos.x - bigpamet->actor.world.pos.x) * temp_f0; - this->actor.world.pos.z -= (this->actor.world.pos.z - bigpamet->actor.world.pos.z) * temp_f0; + lerp = 1.0f / this->timer; + this->actor.world.pos.x -= (this->actor.world.pos.x - bigpamet->actor.world.pos.x) * lerp; + this->actor.world.pos.z -= (this->actor.world.pos.z - bigpamet->actor.world.pos.z) * lerp; this->actor.world.pos.y = Math_SinS((-this->timer * 0x1000) + 0x6000) * 65.0f + ((EnBigpamet*)this->actor.child)->unk_2AC; } @@ -848,7 +848,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, PlayState* play) { void EnPametfrog_FallInAir(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - this->actor.colorFilterTimer = 0x10; + this->actor.colorFilterTimer = 16; if (this->timer > 0) { this->timer--; if (this->timer == 0) { @@ -903,7 +903,7 @@ void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, PlayState* play) { s16 yaw = Actor_WorldYawTowardPoint(this->actor.child, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; - yaw = yawDiff > 0 ? yaw - 0x2000 : yaw + 0x2000; + yaw = (yawDiff > 0) ? (yaw - 0x2000) : (yaw + 0x2000); subCamEye.x = this->actor.child->focus.pos.x + 150.0f * Math_SinS(yaw); subCamEye.y = this->actor.child->focus.pos.y + 20.0f; subCamEye.z = this->actor.child->focus.pos.z + 150.0f * Math_CosS(yaw); @@ -928,7 +928,7 @@ void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, PlayState* play) { s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; - yaw = yawDiff > 0 ? yaw - 0x2000 : yaw + 0x2000; + yaw = (yawDiff > 0) ? (yaw - 0x2000) : (yaw + 0x2000); subCamEye.x = this->actor.world.pos.x + Math_SinS(yaw) * 150.0f; subCamEye.y = this->actor.world.pos.y + 20.0f; subCamEye.z = this->actor.world.pos.z + Math_CosS(yaw) * 150.0f; @@ -953,7 +953,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play) { static Color_RGBA8 envColor = { 180, 180, 180, 255 }; s16 yaw = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); Vec3f vec1; - Vec3f vel; + Vec3f velocity; s32 i; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_MINIFROG, this->actor.world.pos.x, this->actor.world.pos.y, @@ -967,11 +967,11 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, PlayState* play) { Flags_SetClearTemp(play, play->roomCtx.curRoom.num); for (i = 0; i < 25; i++) { - vel.x = Rand_CenteredFloat(5.0f); - vel.y = Rand_ZeroFloat(3.0f) + 4.0f; - vel.z = Rand_CenteredFloat(5.0f); - EffectSsHahen_Spawn(play, &this->actor.world.pos, &vel, &sAccel, 0, Rand_S16Offset(12, 3), HAHEN_OBJECT_DEFAULT, - 10, 0); + velocity.x = Rand_CenteredFloat(5.0f); + velocity.y = Rand_ZeroFloat(3.0f) + 4.0f; + velocity.z = Rand_CenteredFloat(5.0f); + EffectSsHahen_Spawn(play, &this->actor.world.pos, &velocity, &sAccel, 0, Rand_S16Offset(12, 3), + HAHEN_OBJECT_DEFAULT, 10, 0); } this->timer = 40; @@ -1056,7 +1056,7 @@ void EnPametfrog_JumpToLink(EnPametfrog* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); EnPametfrog_JumpOnGround(this, play); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || - (this->skelAnime.curFrame > 1.0f && this->skelAnime.curFrame < 12.0f)) { + ((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 12.0f))) { this->actor.speed = 8.0f; } else { this->actor.speed = 0.0f; @@ -1096,9 +1096,9 @@ void EnPametfrog_MeleeAttack(EnPametfrog* this, PlayState* play) { } } - if ((this->skelAnime.animation == &gGekkoJabPunchAnim && Animation_OnFrame(&this->skelAnime, 2.0f)) || - (this->skelAnime.animation == &gGekkoHookPunchAnim && Animation_OnFrame(&this->skelAnime, 9.0f)) || - (this->skelAnime.animation == &gGekkoKickAnim && Animation_OnFrame(&this->skelAnime, 2.0f)) || + if (((this->skelAnime.animation == &gGekkoJabPunchAnim) && Animation_OnFrame(&this->skelAnime, 2.0f)) || + ((this->skelAnime.animation == &gGekkoHookPunchAnim) && Animation_OnFrame(&this->skelAnime, 9.0f)) || + ((this->skelAnime.animation == &gGekkoKickAnim) && Animation_OnFrame(&this->skelAnime, 2.0f)) || ((this->skelAnime.animation == &gGekkoWindupPunchAnim) && Animation_OnFrame(&this->skelAnime, 27.0f))) { this->collider.base.atFlags |= AT_ON; if (this->skelAnime.animation == &gGekkoKickAnim) { @@ -1186,8 +1186,8 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, PlayState* play) { subCamAt.x = this->actor.world.pos.x; subCamAt.z = this->actor.world.pos.z; subCamAt.y = this->actor.world.pos.y + 45.0f; - subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 90.0f) + subCamAt.x; - subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 90.0f) + subCamAt.z; + subCamEye.x = subCamAt.x + (Math_SinS(this->actor.shape.rot.y) * 90.0f); + subCamEye.z = subCamAt.z + (Math_CosS(this->actor.shape.rot.y) * 90.0f); subCamEye.y = subCamAt.y + 4.0f; // Zooms in on Gekko @@ -1330,7 +1330,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { void EnPametfrog_Update(Actor* thisx, PlayState* play) { EnPametfrog* this = THIS; f32 unk2C4; - f32 arg3; + f32 wallCheckRadius; if (this->actor.params == GEKKO_CUTSCENE) { EnPametfrog_SetupCutscene(this); @@ -1341,11 +1341,12 @@ void EnPametfrog_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); + if ((this->actionFunc != EnPametfrog_JumpOnSnapper) && (this->actionFunc != EnPametfrog_RearOnSnapperRise)) { if (this->actor.gravity < -0.1f) { Actor_MoveWithGravity(&this->actor); - arg3 = this->actionFunc == EnPametfrog_FallInAir ? 3.0f : 15.0f; - Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, arg3, 3.0f, + wallCheckRadius = (this->actionFunc == EnPametfrog_FallInAir) ? 3.0f : 15.0f; + Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, wallCheckRadius, 3.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } else if (this->freezeTimer == 0) { @@ -1421,9 +1422,9 @@ void EnPametfrog_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s center->y = vec.y; center->z = vec.z; center = &this->collider.elements[1].dim.worldSphere.center; - center->x = (Math_SinS(this->actor.shape.rot.y) * 35.0f) + this->actor.focus.pos.x; + center->x = this->actor.focus.pos.x + (Math_SinS(this->actor.shape.rot.y) * 35.0f); center->y = this->actor.focus.pos.y - 10.0f; - center->z = (Math_CosS(this->actor.shape.rot.y) * 35.0f) + this->actor.focus.pos.z; + center->z = this->actor.focus.pos.z + (Math_CosS(this->actor.shape.rot.y) * 35.0f); } bodyPartIndex = sLimbToBodyParts[limbIndex]; diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 14d0f823c1..a1f830ffdd 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -48,6 +48,7 @@ void func_80865390(EnPart* this, PlayState* play) { this->actor.gravity = -0.6f - (Rand_ZeroOne() * 0.5f); this->unk14C = 0.15f; break; + case ENPART_TYPE_15: this->actor.world.rot.y = this->actor.parent->shape.rot.y + 0x8000; this->unk146 = 100; @@ -55,6 +56,9 @@ void func_80865390(EnPart* this, PlayState* play) { this->actor.speed = 2.0f; this->actor.gravity = -1.0f; break; + + default: + break; } } @@ -88,6 +92,7 @@ void func_808654C4(EnPart* this, PlayState* play) { 1); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 10, NA_SE_EN_EXTINCT); break; + case ENPART_TYPE_4: for (i = 7; i >= 0; i--) { effectPos.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; @@ -100,6 +105,9 @@ void func_808654C4(EnPart* this, PlayState* play) { DTBUBBLE_COLOR_PROFILE_RED, true); } break; + + default: + break; } Actor_Kill(&this->actor); } else { @@ -114,7 +122,8 @@ void EnPart_Update(Actor* thisx, PlayState* play) { EnPart* this = THIS; Actor_MoveWithGravity(&this->actor); - (*sActionFuncs[this->actionFuncIndex])(this, play); + + sActionFuncs[this->actionFuncIndex](this, play); } void EnPart_Draw(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index e50b4dc762..b7c3b465ca 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -8,7 +8,6 @@ #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" -#include "objects/object_ph/object_ph.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) @@ -180,7 +179,7 @@ void EnPeehat_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_Init(play, &this->skelAnime, &object_ph_Skel_001C80, &object_ph_Anim_0009C4, this->jointTable, - this->morphTable, 24); + this->morphTable, OBJECT_PH_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->unk_2B0 = 0; Math_Vec3f_Copy(&this->actor.focus.pos, &this->actor.world.pos); @@ -382,12 +381,14 @@ void func_80897910(EnPeehat* this, PlayState* play) { Math_StepToF(&this->actor.speed, 3.0f, 0.25f); Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight + 80.0f, 3.0f); SkelAnime_Update(&this->skelAnime); + if (!gSaveContext.save.isNight && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 1200.0f)) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1000); this->actor.shape.rot.y += (s16)(this->unk_2AD * 450); } else { func_80898124(this); } + Math_ScaledStepToS(&this->unk_2B2, 4000, 500); this->unk_2B4 += this->unk_2B2; Math_StepToF(&this->unk_2C4, 0.075f, 0.005f); @@ -472,11 +473,12 @@ void func_80897D48(EnPeehat* this, PlayState* play) { Math_StepToF(&this->actor.shape.yOffset, -1000.0f, 50.0f); Math_StepToF(&this->actor.speed, 0.0f, 1.0f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 50); + if (SkelAnime_Update(&this->skelAnime)) { func_80897498(this); this->actor.world.pos.y = this->actor.floorHeight; Actor_PlaySfx(&this->actor, NA_SE_EN_PIHAT_LAND); - } else if (this->actor.floorHeight < this->actor.world.pos.y) { + } else if (this->actor.world.pos.y > this->actor.floorHeight) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight, 0.3f, 3.5f, 0.25f); if ((this->actor.world.pos.y - this->actor.floorHeight) < 60.0f) { Math_Vec3f_Copy(&sp34, &this->actor.world.pos); @@ -794,16 +796,15 @@ void EnPeehat_Update(Actor* thisx, PlayState* play2) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderTris.base); if (thisx->params == 0) { Vec3f sp74; - CollisionPoly* sp70; - s32 sp6C; + CollisionPoly* poly = NULL; + s32 bgId; s32 i; - sp70 = NULL; CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base); for (i = 1; i >= 0; i--) { - if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, &this->unk_2D4[i], &sp74, &sp70, true, - true, false, true, &sp6C)) { + if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, &this->unk_2D4[i], &sp74, &poly, true, + true, false, true, &bgId)) { func_800BBFB0(play, &sp74, 0.0f, 1, 300, 150, 1); func_80897258(play, this, &sp74, 0.0f, 1.5f); } @@ -837,10 +838,11 @@ s32 EnPeehat_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f EnPeehat* this = THIS; s32 pad; - if (limbIndex == 4) { + if (limbIndex == OBJECT_PH_LIMB_04) { rot->x = -this->unk_2B4; - } else if ((limbIndex == 3) || - ((limbIndex == 23) && ((this->actionFunc == func_80898594) || (this->actionFunc == func_80897520)))) { + } else if ((limbIndex == OBJECT_PH_LIMB_03) || + ((limbIndex == OBJECT_PH_LIMB_17) && + ((this->actionFunc == func_80898594) || (this->actionFunc == func_80897520)))) { OPEN_DISPS(play->state.gfxCtx); Gfx* gfx = POLY_OPA_DISP; @@ -912,10 +914,10 @@ void EnPeehat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVecX(4000.0f, &this->bodyPartsPos[bodyPartIndex + 1]); } - if (limbIndex == 4) { + if (limbIndex == OBJECT_PH_LIMB_04) { Matrix_MultVecZ(5500.0f, &this->unk_2D4[0]); Matrix_MultVecZ(-5500.0f, &this->unk_2D4[1]); - } else if ((limbIndex == 3) && (thisx->params == 0)) { + } else if ((limbIndex == OBJECT_PH_LIMB_03) && (thisx->params == 0)) { Vec3f* vec = &D_80899570[0]; Vec3f* bodyPartPosPtr = &this->bodyPartsPos[PEEHAT_BODYPART_12]; diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h index c5ff88b658..416c0e303b 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.h @@ -2,6 +2,7 @@ #define Z_EN_PEEHAT_H #include "global.h" +#include "objects/object_ph/object_ph.h" struct EnPeehat; @@ -32,8 +33,8 @@ typedef enum PeehatBodyPart { typedef struct EnPeehat { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[24]; - /* 0x188 */ Vec3s morphTable[24]; + /* 0x188 */ Vec3s jointTable[OBJECT_PH_LIMB_MAX]; + /* 0x188 */ Vec3s morphTable[OBJECT_PH_LIMB_MAX]; /* 0x2A8 */ EnPeehatActionFunc actionFunc; /* 0x2AC */ u8 unk_2AC; /* 0x2AD */ s8 unk_2AD; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 3ea5514eaa..728e925152 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -148,7 +148,6 @@ static InitChainEntry sInitChain[] = { // clang-format off // PoSisters have their own flags variable for cross function behavior detection -#define POE_SISTERS_FLAG_CLEAR (0) #define POE_SISTERS_FLAG_CHECK_AC (1 << 0) #define POE_SISTERS_FLAG_UPDATE_SHAPE_ROT (1 << 1) #define POE_SISTERS_FLAG_CHECK_Z_TARGET (1 << 2) // Meg doesnt go invisible if you ztarget her for too long @@ -230,12 +229,10 @@ void EnPoSisters_UpdateDeathFlameSwirl(EnPoSisters* this, s32 deathTimerParam, V for (i = 0; i < this->fireCount; i++) { firePos = &this->firePos[i]; - firePos->x = Math_SinS(this->actor.shape.rot.y + (this->deathTimer * 0x800) + (i * 0x2000)) * - (SQ(deathTimerParamF) * 0.1f) + - pos->x; - firePos->z = Math_CosS(this->actor.shape.rot.y + (this->deathTimer * 0x800) + (i * 0x2000)) * - (SQ(deathTimerParamF) * 0.1f) + - pos->z; + firePos->x = pos->x + Math_SinS(this->actor.shape.rot.y + (this->deathTimer * 0x800) + (i * 0x2000)) * + (SQ(deathTimerParamF) * 0.1f); + firePos->z = pos->z + Math_CosS(this->actor.shape.rot.y + (this->deathTimer * 0x800) + (i * 0x2000)) * + (SQ(deathTimerParamF) * 0.1f); firePos->y = pos->y + deathTimerParamF; } } @@ -257,8 +254,8 @@ void EnPoSisters_MatchPlayerXZ(EnPoSisters* this, PlayState* play) { dist = this->actor.parent->xzDistToPlayer; } - this->actor.world.pos.x = (Math_SinS(BINANG_ROT180(this->actor.shape.rot.y)) * dist) + player->actor.world.pos.x; - this->actor.world.pos.z = (Math_CosS(BINANG_ROT180(this->actor.shape.rot.y)) * dist) + player->actor.world.pos.z; + this->actor.world.pos.x = player->actor.world.pos.x + (Math_SinS(BINANG_ROT180(this->actor.shape.rot.y)) * dist); + this->actor.world.pos.z = player->actor.world.pos.z + (Math_CosS(BINANG_ROT180(this->actor.shape.rot.y)) * dist); } void EnPoSisters_MatchPlayerY(EnPoSisters* this, PlayState* play) { @@ -663,7 +660,7 @@ void EnPoSisters_SetupDeathStage1(EnPoSisters* this) { this->actor.world.pos.y += 42.0f; this->actor.shape.yOffset = -6000.0f; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - this->poSisterFlags = POE_SISTERS_FLAG_CLEAR; + this->poSisterFlags = 0; this->actionFunc = EnPoSisters_DeathStage1; } diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 0d27f0339d..2c6fe4ebe1 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -850,11 +850,12 @@ s32 EnPoh_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p Gfx** gfx) { EnPoh* this = THIS; - if ((this->unk_197 == 0) || (limbIndex == 18) || ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2))) { + if ((this->unk_197 == 0) || (limbIndex == POE_LIMB_LANTERN) || + ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2))) { *dList = NULL; } - if (limbIndex == 19) { + if (limbIndex == POE_LIMB_RIGHT_FOREARM) { gDPPipeSync((*gfx)++); gDPSetEnvColor((*gfx)++, this->unk_194, this->unk_195, this->unk_196, this->unk_197); } @@ -899,12 +900,13 @@ void EnPoh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, s32 pad; Collider_UpdateSpheres(limbIndex, &this->colliderSph); - if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2) && (limbIndex == 5)) { + + if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 2) && (limbIndex == POE_LIMB_TOP_CLOAK)) { gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList((*gfx)++, gPoeBurnDL); } - if (limbIndex == 18) { + if (limbIndex == POE_LIMB_LANTERN) { if ((this->actionFunc == func_80B2D300) && (this->unk_18E >= 19) && (this->actor.scale.x != 0.0f)) { Matrix_Scale(0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, 0.01f / this->actor.scale.x, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.c b/src/overlays/actors/ovl_En_Pp/z_en_pp.c index 7f991b86f3..30613db970 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.c +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.c @@ -206,31 +206,6 @@ static Color_RGBA8 sDustPrimColor = { 60, 50, 20, 255 }; static Color_RGBA8 sDustEnvColor = { 40, 30, 30, 255 }; -typedef enum { - /* 0 */ EN_PP_ANIM_IDLE, - /* 1 */ EN_PP_ANIM_WALK, - /* 2 */ EN_PP_ANIM_WIND_UP, - /* 3 */ EN_PP_ANIM_CHARGE, - /* 4 */ EN_PP_ANIM_ATTACK, - /* 5 */ EN_PP_ANIM_DAMAGE, - /* 6 */ EN_PP_ANIM_ROAR, - /* 7 */ EN_PP_ANIM_TURN_TO_FACE_PLAYER, - /* 8 */ EN_PP_ANIM_JUMP, - /* 9 */ EN_PP_ANIM_LAND -} EnPpAnimation; - -static AnimationHeader* sAnimations[] = { - &gHiploopIdleAnim, &gHiploopWalkAnim, &gHiploopWindUpAnim, &gHiploopChargeAnim, &gHiploopAttackAnim, - &gHiploopDamageAnim, &gHiploopRoarAnim, &gHiploopWalkAnim, &gHiploopWindUpAnim, &gHiploopWalkAnim, -}; - -static u8 sAnimationModes[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, -}; - -static s16 sLedgeCheckAngles[] = { 0x0000, 0x1000, 0xF000 }; - void EnPp_Init(Actor* thisx, PlayState* play) { EnPp* this = THIS; EffectBlureInit1 blureInit; @@ -411,13 +386,53 @@ void EnPp_SpawnDust(EnPp* this, PlayState* play) { } } +typedef enum { + /* 0 */ EN_PP_ANIM_IDLE, + /* 1 */ EN_PP_ANIM_WALK, + /* 2 */ EN_PP_ANIM_WIND_UP, + /* 3 */ EN_PP_ANIM_CHARGE, + /* 4 */ EN_PP_ANIM_ATTACK, + /* 5 */ EN_PP_ANIM_DAMAGE, + /* 6 */ EN_PP_ANIM_ROAR, + /* 7 */ EN_PP_ANIM_TURN_TO_FACE_PLAYER, + /* 8 */ EN_PP_ANIM_JUMP, + /* 9 */ EN_PP_ANIM_LAND, + /* 10 */ EN_PP_ANIM_MAX +} EnPpAnimation; + +static AnimationHeader* sAnimations[EN_PP_ANIM_MAX] = { + &gHiploopIdleAnim, // EN_PP_ANIM_IDLE + &gHiploopWalkAnim, // EN_PP_ANIM_WALK + &gHiploopWindUpAnim, // EN_PP_ANIM_WIND_UP + &gHiploopChargeAnim, // EN_PP_ANIM_CHARGE + &gHiploopAttackAnim, // EN_PP_ANIM_ATTACK + &gHiploopDamageAnim, // EN_PP_ANIM_DAMAGE + &gHiploopRoarAnim, // EN_PP_ANIM_ROAR + &gHiploopWalkAnim, // EN_PP_ANIM_TURN_TO_FACE_PLAYER + &gHiploopWindUpAnim, // EN_PP_ANIM_JUMP + &gHiploopWalkAnim, // EN_PP_ANIM_LAND +}; + +static u8 sAnimationModes[EN_PP_ANIM_MAX] = { + ANIMMODE_LOOP, // EN_PP_ANIM_IDLE + ANIMMODE_LOOP, // EN_PP_ANIM_WALK + ANIMMODE_ONCE, // EN_PP_ANIM_WIND_UP + ANIMMODE_LOOP, // EN_PP_ANIM_CHARGE + ANIMMODE_ONCE, // EN_PP_ANIM_ATTACK + ANIMMODE_LOOP, // EN_PP_ANIM_DAMAGE + ANIMMODE_LOOP, // EN_PP_ANIM_ROAR + ANIMMODE_LOOP, // EN_PP_ANIM_TURN_TO_FACE_PLAYER + ANIMMODE_ONCE, // EN_PP_ANIM_JUMP + ANIMMODE_ONCE, // EN_PP_ANIM_LAND +}; + void EnPp_ChangeAnim(EnPp* this, s32 animIndex) { f32 morphFrames = -10.0f; f32 playSpeed; f32 startFrame; this->animIndex = animIndex; - this->endFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); if (this->animIndex >= EN_PP_ANIM_WIND_UP) { morphFrames = 0.0f; @@ -430,10 +445,10 @@ void EnPp_ChangeAnim(EnPp* this, s32 animIndex) { startFrame = 0.0f; if (this->action == EN_PP_ACTION_BODY_PART_MOVE) { - startFrame = this->endFrame; + startFrame = this->animEndFrame; } - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, startFrame, this->endFrame, + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, startFrame, this->animEndFrame, sAnimationModes[this->animIndex], morphFrames); } @@ -477,6 +492,7 @@ void EnPp_PlaySfxForAnimation(EnPp* this) { * Checks to see if the Hiploop is about to walk off a ledge or into a wall. */ s32 EnPp_CheckCollision(EnPp* this, PlayState* play) { + static s16 sLedgeCheckAngles[] = { 0x0000, 0x1000, 0xF000 }; s16 angle; s32 i; @@ -618,7 +634,7 @@ void EnPp_Charge(EnPp* this, PlayState* play) { } else if (this->animIndex == EN_PP_ANIM_TURN_TO_FACE_PLAYER) { EnPp_ChangeAnim(this, EN_PP_ANIM_WIND_UP); } else if (this->animIndex == EN_PP_ANIM_WIND_UP) { - if (this->endFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { this->chargeAndBounceSpeed = 14.0f; this->timer = 20; EnPp_ChangeAnim(this, EN_PP_ANIM_CHARGE); @@ -686,7 +702,7 @@ void EnPp_Attack(EnPp* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - if (this->endFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { EnPp_SetupCharge(this); } } @@ -773,7 +789,7 @@ void EnPp_Roar(EnPp* this, PlayState* play) { this->secondaryTimer = 3; } - if (!this->actionVar.hasDoneFirstRoar && (this->endFrame <= curFrame)) { + if (!this->actionVar.hasDoneFirstRoar && (curFrame >= this->animEndFrame)) { this->skelAnime.startFrame = 6.0f; this->actionVar.hasDoneFirstRoar = true; } @@ -836,7 +852,7 @@ void EnPp_Jump(EnPp* this, PlayState* play) { this->actionVar.hasLandedFromJump = true; EnPp_ChangeAnim(this, EN_PP_ANIM_LAND); } - } else if (this->endFrame <= curFrame) { + } else if (curFrame >= this->animEndFrame) { EnPp_SetupIdle(this); } } diff --git a/src/overlays/actors/ovl_En_Pp/z_en_pp.h b/src/overlays/actors/ovl_En_Pp/z_en_pp.h index 2f975a68c8..6491227d56 100644 --- a/src/overlays/actors/ovl_En_Pp/z_en_pp.h +++ b/src/overlays/actors/ovl_En_Pp/z_en_pp.h @@ -75,7 +75,7 @@ typedef struct EnPp { } actionVar; /* 0x2D4 */ s16 maskBounceAngularVelocity; // Controls the speed that the Hiploop rotates to face the player when an attack bounces off the mask. /* 0x2D6 */ s16 deadBodyPartsSpawnedCount; - /* 0x2D8 */ f32 endFrame; + /* 0x2D8 */ f32 animEndFrame; /* 0x2DC */ f32 chargeAndBounceSpeed; /* 0x2DC */ Vec3f ledgeCheckPos[3]; /* 0x304 */ Vec3f wallCheckPos; diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.c b/src/overlays/actors/ovl_En_Pr/z_en_pr.c index e9934bf378..9cfccb8ba6 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.c +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.c @@ -7,7 +7,6 @@ #include "z_en_pr.h" #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_En_Prz/z_en_prz.h" -#include "objects/object_pr/object_pr.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) @@ -107,13 +106,29 @@ static ColliderCylinderInit sCylinderInit = { { 18, 20, 5, { 0, 0, 0 } }, }; -static AnimationHeader* sAnimations[] = { - &object_pr_Anim_0021E8, &object_pr_Anim_001E10, &object_pr_Anim_0021E8, - &object_pr_Anim_000740, &object_pr_Anim_000268, +typedef enum EnPrAnimation { + /* 0 */ ENPR_ANIM_0, + /* 1 */ ENPR_ANIM_1, + /* 2 */ ENPR_ANIM_2, + /* 3 */ ENPR_ANIM_3, + /* 4 */ ENPR_ANIM_4, + /* 5 */ ENPR_ANIM_MAX +} EnPrAnimation; + +static AnimationHeader* sAnimations[ENPR_ANIM_MAX] = { + &object_pr_Anim_0021E8, // ENPR_ANIM_0 + &object_pr_Anim_001E10, // ENPR_ANIM_1 + &object_pr_Anim_0021E8, // ENPR_ANIM_2 + &object_pr_Anim_000740, // ENPR_ANIM_3 + &object_pr_Anim_000268, // ENPR_ANIM_4 }; -u8 D_80A33934[] = { - ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, +static u8 sAnimationModes[ENPR_ANIM_MAX] = { + ANIMMODE_LOOP, // ENPR_ANIM_0 + ANIMMODE_ONCE, // ENPR_ANIM_1 + ANIMMODE_LOOP, // ENPR_ANIM_2 + ANIMMODE_LOOP, // ENPR_ANIM_3 + ANIMMODE_ONCE, // ENPR_ANIM_4 }; void EnPr_Init(Actor* thisx, PlayState* play2) { @@ -140,7 +155,7 @@ void EnPr_Init(Actor* thisx, PlayState* play2) { this->actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_0038B8, &object_pr_Anim_0021E8, this->jointTable, - this->morphTable, 10); + this->morphTable, OBJECT_PR_1_LIMB_MAX); this->unk_2C8 = this->actor.world.rot.z * 20.0f; if (this->unk_2C8 < 80.0f) { @@ -182,26 +197,26 @@ void EnPr_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80A3242C(EnPr* this, s32 arg0) { - f32 sp34; +void EnPr_ChangeAnim(EnPr* this, s32 animIndex) { + f32 playSpeed; - this->unk_21C = arg0; - sp34 = 1.0f; - this->unk_2BC = Animation_GetLastFrame(sAnimations[arg0]); + this->animIndex = animIndex; + playSpeed = 1.0f; + this->unk_2BC = Animation_GetLastFrame(sAnimations[animIndex]); - if (this->unk_21C == 2) { - sp34 = 2.0f; + if (this->animIndex == ENPR_ANIM_2) { + playSpeed = 2.0f; } - Animation_Change(&this->skelAnime, sAnimations[this->unk_21C], sp34, 0.0f, this->unk_2BC, D_80A33934[this->unk_21C], - -2.0f); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->unk_2BC, + sAnimationModes[this->animIndex], -2.0f); } s32 func_80A324E0(EnPr* this, PlayState* play) { CollisionPoly* sp54; Vec3f sp48; s32 sp44; - WaterBox* sp40; + WaterBox* waterBox; if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &this->unk_2E0, &sp48, &sp54, 1, 0, 0, 1, &sp44)) { @@ -209,7 +224,7 @@ s32 func_80A324E0(EnPr* this, PlayState* play) { } if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4, - &sp40)) { + &waterBox)) { if ((this->unk_2B4 - 30.0f) < this->actor.world.pos.y) { this->unk_2B8 = this->unk_2B4 - 30.0f; return 2; @@ -244,8 +259,8 @@ s32 func_80A325E4(EnPr* this) { } void func_80A326F0(EnPr* this) { - if (this->unk_21C != 0) { - func_80A3242C(this, 0); + if (this->animIndex != ENPR_ANIM_0) { + EnPr_ChangeAnim(this, ENPR_ANIM_0); } this->unk_206 = 0; this->actor.speed = 1.0f; @@ -278,8 +293,8 @@ void func_80A32740(EnPr* this, PlayState* play) { } void func_80A32854(EnPr* this) { - if (this->unk_21C != 0) { - func_80A3242C(this, 0); + if (this->animIndex != ENPR_ANIM_0) { + EnPr_ChangeAnim(this, ENPR_ANIM_0); } this->unk_206 = 1; this->actionFunc = func_80A3289C; @@ -312,8 +327,8 @@ void func_80A32984(EnPr* this, PlayState* play) { if (func_80A324E0(this, play)) { this->unk_22C += 0x1000; } else { - if (this->unk_21C != 0) { - func_80A3242C(this, 0); + if (this->animIndex != ENPR_ANIM_0) { + EnPr_ChangeAnim(this, ENPR_ANIM_0); } this->unk_206 = 3; this->actionFunc = func_80A32A40; @@ -323,13 +338,13 @@ void func_80A32984(EnPr* this, PlayState* play) { void func_80A32A40(EnPr* this, PlayState* play) { Vec3f sp34; - WaterBox* sp30; + WaterBox* waterBox; Math_Vec3f_Copy(&sp34, &this->actor.world.pos); sp34.y = Rand_CenteredFloat(50.0f) + this->actor.home.pos.y; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4, - &sp30)) { + &waterBox)) { if (sp34.y < (this->unk_2B4 - 30.0f)) { this->unk_2B8 = sp34.y; } else { @@ -372,7 +387,7 @@ void func_80A32B20(EnPr* this, PlayState* play) { } void func_80A32CDC(EnPr* this) { - func_80A3242C(this, 3); + EnPr_ChangeAnim(this, ENPR_ANIM_3); this->unk_206 = 5; this->unk_20A = 400; this->unk_2C0 = 0.0f; @@ -401,7 +416,7 @@ void func_80A32D28(EnPr* this, PlayState* play) { } void func_80A32E60(EnPr* this) { - func_80A3242C(this, 4); + EnPr_ChangeAnim(this, ENPR_ANIM_4); this->unk_206 = 6; this->actor.speed = 0.0f; this->actionFunc = func_80A32EA4; @@ -427,7 +442,7 @@ void func_80A32EA4(EnPr* this, PlayState* play) { } void func_80A32F48(EnPr* this, PlayState* play) { - WaterBox* sp2C; + WaterBox* waterBox; if (this->unk_208 > 0) { this->unk_208 -= 2; @@ -436,7 +451,7 @@ void func_80A32F48(EnPr* this, PlayState* play) { } if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_2B4, - &sp2C)) { + &waterBox)) { if ((this->unk_2B4 - 100.0f) < this->actor.world.pos.y) { this->unk_212 += 0xBB8; this->unk_2C4 = 2.0f * Math_SinS(this->unk_212); @@ -572,7 +587,7 @@ void EnPr_Update(Actor* thisx, PlayState* play) { s32 EnPr_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPr* this = THIS; - if (limbIndex == 2) { + if (limbIndex == OBJECT_PR_1_LIMB_02) { rot->y += this->unk_214; } return false; @@ -582,13 +597,16 @@ void EnPr_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Vec3f sp24 = { 0.0f, 0.0f, 0.0f }; EnPr* this = THIS; - if (limbIndex == 2) { + if (limbIndex == OBJECT_PR_1_LIMB_02) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_MultVec3f(&sp24, &this->unk_2D4); } - if ((limbIndex == 0) || (limbIndex == 1) || (limbIndex == 2) || (limbIndex == 3) || (limbIndex == 4) || - (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 8) || (limbIndex == 9)) { + if ((limbIndex == OBJECT_PR_1_LIMB_NONE) || (limbIndex == OBJECT_PR_1_LIMB_01) || + (limbIndex == OBJECT_PR_1_LIMB_02) || (limbIndex == OBJECT_PR_1_LIMB_03) || + (limbIndex == OBJECT_PR_1_LIMB_04) || (limbIndex == OBJECT_PR_1_LIMB_05) || + (limbIndex == OBJECT_PR_1_LIMB_06) || (limbIndex == OBJECT_PR_1_LIMB_07) || + (limbIndex == OBJECT_PR_1_LIMB_08) || (limbIndex == OBJECT_PR_1_LIMB_09)) { Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); this->bodyPartsCount++; if (this->bodyPartsCount >= ENPR_BODYPART_MAX) { diff --git a/src/overlays/actors/ovl_En_Pr/z_en_pr.h b/src/overlays/actors/ovl_En_Pr/z_en_pr.h index 58d1e8be26..7770504adb 100644 --- a/src/overlays/actors/ovl_En_Pr/z_en_pr.h +++ b/src/overlays/actors/ovl_En_Pr/z_en_pr.h @@ -2,6 +2,7 @@ #define Z_EN_PR_H #include "global.h" +#include "objects/object_pr/object_pr.h" struct EnPr; @@ -29,8 +30,8 @@ typedef enum EnPrBodyPart { typedef struct EnPr { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[10]; - /* 0x1C4 */ Vec3s morphTable[10]; + /* 0x188 */ Vec3s jointTable[OBJECT_PR_1_LIMB_MAX]; + /* 0x1C4 */ Vec3s morphTable[OBJECT_PR_1_LIMB_MAX]; /* 0x200 */ EnPrActionFunc actionFunc; /* 0x204 */ u8 unk_204; /* 0x206 */ s16 unk_206; @@ -43,7 +44,7 @@ typedef struct EnPr { /* 0x214 */ s16 unk_214; /* 0x216 */ s16 unk_216; /* 0x218 */ UNK_TYPE1 unk218[4]; - /* 0x21C */ s32 unk_21C; + /* 0x21C */ s32 animIndex; /* 0x220 */ UNK_TYPE1 unk220[0x8]; /* 0x228 */ s32 bodyPartsCount; /* 0x22C */ s16 unk_22C; diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index e4f6a6fadf..05bbd0033d 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -5,7 +5,6 @@ */ #include "z_en_pr2.h" -#include "objects/object_pr/object_pr.h" #include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) @@ -93,13 +92,24 @@ ActorInit En_Pr2_InitVars = { /**/ EnPr2_Draw, }; -static AnimationHeader* sAnimations[] = { - &object_pr_Anim_004340, - &object_pr_Anim_004274, - &object_pr_Anim_003904, +typedef enum EnPr2Animation { + /* 0 */ ENPR2_ANIM_0, + /* 1 */ ENPR2_ANIM_1, + /* 2 */ ENPR2_ANIM_2, + /* 3 */ ENPR2_ANIM_MAX +} EnPr2Animation; + +static AnimationHeader* sAnimations[ENPR2_ANIM_MAX] = { + &object_pr_Anim_004340, // ENPR2_ANIM_0 + &object_pr_Anim_004274, // ENPR2_ANIM_1 + &object_pr_Anim_003904, // ENPR2_ANIM_2 }; -u8 D_80A75C38[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE }; +static u8 sAnimationModes[ENPR2_ANIM_MAX] = { + ANIMMODE_LOOP, // ENPR2_ANIM_0 + ANIMMODE_LOOP, // ENPR2_ANIM_1 + ANIMMODE_ONCE, // ENPR2_ANIM_2 +}; s16 D_80A75C3C[] = { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, @@ -115,7 +125,7 @@ void EnPr2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, - this->morphTable, 5); + this->morphTable, OBJECT_PR_2_LIMB_MAX); this->unk_1E0 = ENPR2_GET_F(&this->actor); this->actor.colChkInfo.mass = 10; Math_Vec3f_Copy(&this->unk_228, &this->actor.home.pos); @@ -198,13 +208,14 @@ void EnPr2_Destroy(Actor* thisx, PlayState* play) { s32 func_80A7429C(EnPr2* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 sp1A; - s16 sp18; + s16 screenPosX; + s16 screenPosY; - Actor_GetScreenPos(play, &this->actor, &sp1A, &sp18); + Actor_GetScreenPos(play, &this->actor, &screenPosX, &screenPosY); if ((fabsf(player->actor.world.pos.y - this->actor.world.pos.y) > 160.0f) || - (this->actor.projectedPos.z < -40.0f) || (sp1A < 0) || (sp1A > 320) || (sp18 < 0) || (sp18 > 240)) { + (this->actor.projectedPos.z < -40.0f) || (screenPosX < 0) || (screenPosX > SCREEN_WIDTH) || (screenPosY < 0) || + (screenPosY > SCREEN_HEIGHT)) { return false; } @@ -242,19 +253,20 @@ void func_80A7436C(EnPr2* this, s16 arg1) { Math_SmoothStepToS(&this->actor.world.rot.y, arg1, 1, 2000, 300); } -void func_80A74510(EnPr2* this, s32 arg0) { - f32 sp34 = 1.0f; +void EnPr2_ChangeAnim(EnPr2* this, s32 animIndex) { + f32 playSpeed = 1.0f; - this->unk_210 = arg0; - this->unk_1F8 = Animation_GetLastFrame(sAnimations[arg0]); - if (this->unk_210 == 3) { - sp34 = 0.0f; + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + if (this->animIndex == ENPR2_ANIM_MAX) { + playSpeed = 0.0f; } - Animation_Change(&this->skelAnime, sAnimations[arg0], sp34, 0.0f, this->unk_1F8, D_80A75C38[arg0], 0.0f); + Animation_Change(&this->skelAnime, sAnimations[animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[animIndex], 0.0f); } void func_80A745C4(EnPr2* this) { - func_80A74510(this, 0); + EnPr2_ChangeAnim(this, ENPR2_ANIM_0); this->unk_1D4 = 0; this->actionFunc = func_80A745FC; } @@ -310,7 +322,7 @@ void func_80A745FC(EnPr2* this, PlayState* play) { } void func_80A74888(EnPr2* this) { - func_80A74510(this, 0); + EnPr2_ChangeAnim(this, ENPR2_ANIM_0); this->unk_1DA = 2; this->unk_1D8 = 0; Math_Vec3f_Copy(&this->unk_21C, &this->unk_228); @@ -376,6 +388,9 @@ void func_80A748E8(EnPr2* this, PlayState* play) { } } break; + + default: + break; } if (!sp4C) { @@ -432,7 +447,7 @@ void func_80A74DEC(EnPr2* this, PlayState* play) { Player* player = GET_PLAYER(play); this->unk_1F0 = 0; - func_80A74510(this, 1); + EnPr2_ChangeAnim(this, ENPR2_ANIM_1); Actor_PlaySfx(&this->actor, NA_SE_EN_PIRANHA_ATTACK); Math_Vec3f_Copy(&this->unk_21C, &player->actor.world.pos); @@ -446,7 +461,7 @@ void func_80A74DEC(EnPr2* this, PlayState* play) { void func_80A74E90(EnPr2* this, PlayState* play) { Player* player = GET_PLAYER(play); - WaterBox* sp40; + WaterBox* waterBox; Math_ApproachF(&this->unk_204, 0.02f, 0.1f, 0.005f); if ((this->unk_1D8 == 0) || !(player->stateFlags1 & PLAYER_STATE1_8000000) || (this->unk_1E0 == 0)) { @@ -491,8 +506,8 @@ void func_80A74E90(EnPr2* this, PlayState* play) { } if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_200, - &sp40)) { - if ((this->unk_200 - 40.0f) < this->unk_21C.y) { + &waterBox)) { + if (this->unk_21C.y > (this->unk_200 - 40.0f)) { this->unk_21C.y = this->unk_200 - 40.0f; } } @@ -520,11 +535,11 @@ void func_80A751B4(EnPr2* this) { this->actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (this->unk_1E0 < 10) { - func_80A74510(this, 2); + EnPr2_ChangeAnim(this, ENPR2_ANIM_2); } else { - this->unk_1F8 = Animation_GetLastFrame(&object_pr_Anim_003904); - Animation_Change(&this->skelAnime, &object_pr_Anim_003904, 1.0f, this->unk_1F8, this->unk_1F8, ANIMMODE_ONCE, - 0.0f); + this->animEndFrame = Animation_GetLastFrame(&object_pr_Anim_003904); + Animation_Change(&this->skelAnime, &object_pr_Anim_003904, 1.0f, this->animEndFrame, this->animEndFrame, + ANIMMODE_ONCE, 0.0f); this->unk_1D8 = Rand_S16Offset(20, 30); this->unk_1E4 = 0x4000; if (Rand_ZeroOne() < 0.5f) { @@ -545,16 +560,16 @@ void func_80A751B4(EnPr2* this) { void func_80A75310(EnPr2* this, PlayState* play) { s32 temp; - f32 frame; - WaterBox* sp74; + f32 curFrame; + WaterBox* waterBox; SkelAnime_Update(&this->skelAnime); if (this->unk_1E0 < 10) { s32 i; - frame = this->skelAnime.curFrame; + curFrame = this->skelAnime.curFrame; - if (this->unk_1F8 <= frame) { + if (curFrame >= this->animEndFrame) { for (i = 0; i < ARRAY_COUNT(this->unk_234); i++) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PR2, this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, this->actor.world.rot.x, this->actor.world.rot.y, @@ -577,13 +592,11 @@ void func_80A75310(EnPr2* this, PlayState* play) { } if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_200, - &sp74)) { - frame = this->unk_200 - 15.0f; - - if (frame <= this->actor.world.pos.y) { + &waterBox)) { + if (this->actor.world.pos.y >= (this->unk_200 - 15.0f)) { temp = true; } else { - Math_ApproachF(&this->actor.world.pos.y, frame, 0.3f, 1.0f); + Math_ApproachF(&this->actor.world.pos.y, this->unk_200 - 15.0f, 0.3f, 1.0f); } } @@ -599,9 +612,8 @@ void func_80A75310(EnPr2* this, PlayState* play) { sp64.x += Rand_CenteredFloat(20.0f); sp64.y += Rand_CenteredFloat(5.0f); sp64.z += Rand_CenteredFloat(20.0f); - frame = Rand_ZeroFloat(0.03f) + 0.07f; - EffectSsBubble_Spawn(play, &sp64, 0.0f, 5.0f, 5.0f, frame); + EffectSsBubble_Spawn(play, &sp64, 0.0f, 5.0f, 5.0f, Rand_ZeroFloat(0.03f) + 0.07f); } Actor_Kill(&this->actor); @@ -638,6 +650,7 @@ void EnPr2_Update(Actor* thisx, PlayState* play) { EnPr2* this = THIS; f32 rand; + //! FAKE: if (thisx) {} Actor_SetScale(&this->actor, this->unk_204); @@ -702,7 +715,7 @@ s32 func_80A758E8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s EnPr2* this = THIS; if (this->unk_1E0 < 10) { - if (limbIndex == 2) { + if (limbIndex == OBJECT_PR_2_LIMB_02) { rot->y += (s16)this->unk_1FC * -1; } } else if ((limbIndex + 10) != this->unk_1E0) { @@ -715,7 +728,7 @@ void func_80A75950(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Acto EnPr2* this = THIS; if (this->unk_1E0 < 10) { - if (limbIndex == 2) { + if (limbIndex == OBJECT_PR_2_LIMB_02) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_MultZero(&this->unk_270); } @@ -727,7 +740,7 @@ s32 func_80A759D8(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s EnPr2* this = THIS; if (this->unk_1E0 < 10) { - if (limbIndex == 2) { + if (limbIndex == OBJECT_PR_2_LIMB_02) { rot->y += (s16)this->unk_1FC * -1; } } else if ((limbIndex + 10) != this->unk_1E0) { diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h index 7d462b6395..04640eb770 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.h @@ -2,6 +2,7 @@ #define Z_EN_PR2_H #include "global.h" +#include "objects/object_pr/object_pr.h" struct EnPr2; @@ -16,8 +17,8 @@ typedef void (*EnPr2ActionFunc)(struct EnPr2*, PlayState*); typedef struct EnPr2 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[5]; - /* 0x1A6 */ Vec3s morphTable[5]; + /* 0x188 */ Vec3s jointTable[OBJECT_PR_2_LIMB_MAX]; + /* 0x1A6 */ Vec3s morphTable[OBJECT_PR_2_LIMB_MAX]; /* 0x1C4 */ EnPr2ActionFunc actionFunc; /* 0x1C8 */ s16 pathIndex; /* 0x1CC */ Path* path; @@ -38,13 +39,13 @@ typedef struct EnPr2 { /* 0x1F0 */ s16 unk_1F0; /* 0x1F2 */ s16 unk_1F2; /* 0x1F4 */ s16 unk_1F4; - /* 0x1F8 */ f32 unk_1F8; + /* 0x1F8 */ f32 animEndFrame; /* 0x1FC */ f32 unk_1FC; /* 0x200 */ f32 unk_200; /* 0x204 */ f32 unk_204; /* 0x208 */ f32 unk_208; /* 0x20C */ f32 unk_20C; - /* 0x210 */ s32 unk_210; + /* 0x210 */ s32 animIndex; /* 0x214 */ UNK_TYPE1 unk214[4]; /* 0x218 */ s32 unk_218; /* 0x21C */ Vec3f unk_21C; diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.c b/src/overlays/actors/ovl_En_Prz/z_en_prz.c index f7fa2df27a..f134efc2a2 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.c +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.c @@ -5,7 +5,6 @@ */ #include "z_en_prz.h" -#include "objects/object_pr/object_pr.h" #include "overlays/actors/ovl_En_Pr/z_en_pr.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10) @@ -100,12 +99,6 @@ ActorInit En_Prz_InitVars = { /**/ EnPrz_Draw, }; -AnimationHeader* D_80A77240[] = { &object_pr_Anim_004340, &object_pr_Anim_004274 }; - -u8 D_80A77248[] = { ANIMMODE_LOOP, ANIMMODE_LOOP }; - -Vec3f D_80A7724C = { 0.0f, 0.0f, 0.0f }; - void EnPrz_Init(Actor* thisx, PlayState* play) { EnPrz* this = THIS; @@ -121,7 +114,7 @@ void EnPrz_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 1; SkelAnime_InitFlex(play, &this->skelAnime, &object_pr_Skel_004188, &object_pr_Anim_004340, this->jointTable, - this->morphTable, 5); + this->morphTable, OBJECT_PR_2_LIMB_MAX); this->unk_1E6 = ENPRZ_GET(&this->actor); this->actor.shape.yOffset = 500.0f; @@ -141,18 +134,34 @@ void EnPrz_Init(Actor* thisx, PlayState* play) { void EnPrz_Destroy(Actor* thisx, PlayState* play) { } -void func_80A75F18(EnPrz* this, s32 arg1) { - this->unk_204 = arg1; - Animation_Change(&this->skelAnime, D_80A77240[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A77240[arg1]), - D_80A77248[arg1], -2.0f); +typedef enum EnPrzAnimation { + /* 0 */ ENPRZ_ANIM_0, + /* 1 */ ENPRZ_ANIM_1, + /* 2 */ ENPRZ_ANIM_MAX +} EnPrzAnimation; + +static AnimationHeader* sAnimations[ENPRZ_ANIM_MAX] = { + &object_pr_Anim_004340, // ENPRZ_ANIM_0 + &object_pr_Anim_004274, // ENPRZ_ANIM_1 +}; + +static u8 sAnimationModes[ENPRZ_ANIM_MAX] = { + ANIMMODE_LOOP, // ENPRZ_ANIM_0 + ANIMMODE_LOOP, // ENPRZ_ANIM_1 +}; + +void EnPrz_ChangeAnim(EnPrz* this, s32 animIndex) { + this->animIndex = animIndex; + Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, + Animation_GetLastFrame(sAnimations[animIndex]), sAnimationModes[animIndex], -2.0f); } s32 func_80A75FA4(EnPrz* this, PlayState* play) { - WaterBox* sp2C; + WaterBox* waterBox; f32 temp_f0; if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_210, - &sp2C)) { + &waterBox)) { temp_f0 = BREG(10) + (this->unk_210 - 10.0f); if (temp_f0 < this->actor.world.pos.y) { this->unk_1D8.y = temp_f0; @@ -225,7 +234,7 @@ s32 func_80A762C0(EnPrz* this, PlayState* play) { void func_80A76388(EnPrz* this) { this->actor.speed = Rand_CenteredFloat(1.0f) + 4.0f; - func_80A75F18(this, 0); + EnPrz_ChangeAnim(this, ENPRZ_ANIM_0); this->unk_1EA = 1; this->actionFunc = func_80A763E8; } @@ -271,6 +280,7 @@ void func_80A763E8(EnPrz* this, PlayState* play) { Math_Vec3f_Copy(&this->unk_1D8, &sp3C->world.pos); } + //! FAKE: if (1) {} if ((Rand_ZeroOne() < 0.1f) && (this->unk_1C8 == 0)) { @@ -322,7 +332,7 @@ void func_80A767A8(EnPrz* this, PlayState* play) { s32 pad[2]; if (func_80A762C0(this, play)) { - func_80A75F18(this, 0); + EnPrz_ChangeAnim(this, ENPRZ_ANIM_0); this->actor.speed = Rand_CenteredFloat(1.0f) + 4.0f; func_80A76604(this, play); return; @@ -339,13 +349,13 @@ void func_80A767A8(EnPrz* this, PlayState* play) { } if ((this->actor.xzDistToPlayer < 200.0f) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 80.0f)) { - if (this->unk_204 != 1) { - func_80A75F18(this, 1); + if (this->animIndex != ENPRZ_ANIM_1) { + EnPrz_ChangeAnim(this, ENPRZ_ANIM_1); } this->skelAnime.playSpeed = 1.0f; } else { - if (this->unk_204 != 0) { - func_80A75F18(this, 0); + if (this->animIndex != ENPRZ_ANIM_0) { + EnPrz_ChangeAnim(this, ENPRZ_ANIM_0); } this->skelAnime.playSpeed = 2.0f; } @@ -384,13 +394,13 @@ void func_80A76A1C(EnPrz* this) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 30); this->unk_1EE = 50; - func_80A75F18(this, 0); + EnPrz_ChangeAnim(this, ENPRZ_ANIM_0); this->unk_1EA = 7; this->actionFunc = func_80A76B14; } void func_80A76B14(EnPrz* this, PlayState* play) { - WaterBox* sp7C; + WaterBox* waterBox; s32 i; Vec3f sp6C; s32 phi_s0 = false; @@ -400,7 +410,7 @@ void func_80A76B14(EnPrz* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_1FE, 5, 0x2710, 0x3E8); if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &this->unk_210, - &sp7C)) { + &waterBox)) { if ((this->unk_210 - 15.0f) <= this->actor.world.pos.y) { phi_s0 = true; } else { @@ -491,19 +501,19 @@ void EnPrz_Update(Actor* thisx, PlayState* play) { s32 func_80A76F70(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnPrz* this = THIS; - if (limbIndex == 2) { + if (limbIndex == OBJECT_PR_2_LIMB_02) { rot->y += (s16)this->unk_218 * -100; } return false; } void func_80A76FCC(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - Vec3f sp1C = D_80A7724C; + Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; EnPrz* this = THIS; - if (limbIndex == 2) { + if (limbIndex == OBJECT_PR_2_LIMB_02) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Matrix_MultVec3f(&sp1C, &this->unk_1CC); + Matrix_MultVec3f(&sZeroVec, &this->unk_1CC); } } diff --git a/src/overlays/actors/ovl_En_Prz/z_en_prz.h b/src/overlays/actors/ovl_En_Prz/z_en_prz.h index db91c7c035..2676c75b54 100644 --- a/src/overlays/actors/ovl_En_Prz/z_en_prz.h +++ b/src/overlays/actors/ovl_En_Prz/z_en_prz.h @@ -2,6 +2,7 @@ #define Z_EN_PRZ_H #include "global.h" +#include "objects/object_pr/object_pr.h" struct EnPrz; @@ -12,8 +13,8 @@ typedef void (*EnPrzActionFunc)(struct EnPrz*, PlayState*); typedef struct EnPrz { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[5]; - /* 0x1A6 */ Vec3s morphTable[5]; + /* 0x188 */ Vec3s jointTable[OBJECT_PR_2_LIMB_MAX]; + /* 0x1A6 */ Vec3s morphTable[OBJECT_PR_2_LIMB_MAX]; /* 0x1C4 */ EnPrzActionFunc actionFunc; /* 0x1C8 */ u8 unk_1C8; /* 0x1CC */ Vec3f unk_1CC; @@ -31,7 +32,7 @@ typedef struct EnPrz { /* 0x1FE */ s16 unk_1FE; /* 0x200 */ UNK_TYPE1 unk200[2]; /* 0x202 */ s16 unk_202; - /* 0x204 */ s32 unk_204; + /* 0x204 */ s32 animIndex; /* 0x208 */ f32 unk_208; /* 0x20C */ f32 unk_20C; /* 0x210 */ f32 unk_210; diff --git a/src/overlays/actors/ovl_En_Pst/z_en_pst.c b/src/overlays/actors/ovl_En_Pst/z_en_pst.c index 6d3dfb144f..64f53ba5fb 100644 --- a/src/overlays/actors/ovl_En_Pst/z_en_pst.c +++ b/src/overlays/actors/ovl_En_Pst/z_en_pst.c @@ -15,7 +15,6 @@ void EnPst_Destroy(Actor* thisx, PlayState* play); void EnPst_Update(Actor* thisx, PlayState* play); void EnPst_Draw(Actor* thisx, PlayState* play); -void EnPst_FollowSchedule(EnPst* this, PlayState* play); void EnPst_Talk(EnPst* this, PlayState* play); typedef enum { @@ -152,7 +151,14 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimationInfo[] = { { &gPostboxOpenSlotAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 } }; +typedef enum PostboxAnimation { + /* 0 */ POSTBOX_ANIM_IDLE, + /* 1 */ POSTBOX_ANIM_MAX +} PostboxAnimation; + +static AnimationInfoS sAnimationInfo[POSTBOX_ANIM_MAX] = { + { &gPostboxIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // POSTBOX_ANIM_IDLE +}; void EnPst_UpdateCollision(EnPst* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); @@ -163,14 +169,19 @@ s32 EnPst_HandleLetterDay1(EnPst* this) { switch (this->actor.params) { case POSTBOX_SOUTH_UPPER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_DEPOSITED_LETTER_TO_KAFEI_SOUTH_UPPER_CLOCKTOWN); + case POSTBOX_NORTH_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_DEPOSITED_LETTER_TO_KAFEI_NORTH_CLOCKTOWN); + case POSTBOX_EAST_UPPER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_DEPOSITED_LETTER_TO_KAFEI_EAST_UPPER_CLOCKTOWN); + case POSTBOX_EAST_LOWER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_DEPOSITED_LETTER_TO_KAFEI_EAST_LOWER_CLOCKTOWN); + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_DEPOSITED_LETTER_TO_KAFEI_SOUTH_LOWER_CLOCKTOWN); + default: return false; } @@ -180,14 +191,19 @@ s32 EnPst_HandleLetterDay2(EnPst* this) { switch (this->actor.params) { case POSTBOX_SOUTH_UPPER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_40); + case POSTBOX_NORTH_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_27_80); + case POSTBOX_EAST_UPPER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_28_01); + case POSTBOX_EAST_LOWER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_28_02); + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: return CHECK_WEEKEVENTREG(WEEKEVENTREG_28_04); + default: return false; } @@ -220,13 +236,20 @@ s32 EnPst_ChooseBehaviour(Actor* thisx, PlayState* play) { } } break; + + default: + break; } break; + case POSTBOX_BEHAVIOUR_TAKE_ITEM: if (this->exchangeItemAction == PLAYER_IA_LETTER_TO_KAFEI) { scriptBranch = 1; } break; + + default: + break; } return scriptBranch; } @@ -240,39 +263,52 @@ s32* EnPst_GetMsgEventScript(EnPst* this, PlayState* play) { switch (this->actor.params) { case POSTBOX_SOUTH_UPPER_CLOCKTOWN: return D_80B2C3E8; + case POSTBOX_NORTH_CLOCKTOWN: return D_80B2C408; + case POSTBOX_EAST_UPPER_CLOCKTOWN: return D_80B2C428; + case POSTBOX_EAST_LOWER_CLOCKTOWN: return D_80B2C448; + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: return D_80B2C468; + default: return NULL; } - } else if (this->stateFlags & 0x20) { + } + + if (this->stateFlags & 0x20) { if (this->exchangeItemAction == PLAYER_IA_LETTER_MAMA) { return D_80B2C488; } else { return D_80B2C490; } - } else { - this->msgEventCallback = EnPst_ChooseBehaviour; - switch (this->actor.params) { - case POSTBOX_SOUTH_UPPER_CLOCKTOWN: - return D_80B2C23C; - case POSTBOX_NORTH_CLOCKTOWN: - return D_80B2C288; - case POSTBOX_EAST_UPPER_CLOCKTOWN: - return D_80B2C2D4; - case POSTBOX_EAST_LOWER_CLOCKTOWN: - return D_80B2C320; - case POSTBOX_SOUTH_LOWER_CLOCKTOWN: - return D_80B2C36C; - default: - return NULL; - } + } + + this->msgEventCallback = EnPst_ChooseBehaviour; + + switch (this->actor.params) { + case POSTBOX_SOUTH_UPPER_CLOCKTOWN: + return D_80B2C23C; + + case POSTBOX_NORTH_CLOCKTOWN: + return D_80B2C288; + + case POSTBOX_EAST_UPPER_CLOCKTOWN: + return D_80B2C2D4; + + case POSTBOX_EAST_LOWER_CLOCKTOWN: + return D_80B2C320; + + case POSTBOX_SOUTH_LOWER_CLOCKTOWN: + return D_80B2C36C; + + default: + return NULL; } } @@ -321,6 +357,9 @@ s32 EnPst_ProcessScheduleOutput(EnPst* this, PlayState* play, ScheduleOutput* sc case POSTBOX_SCH_CHECKED_BY_POSTMAN: ret = true; break; + + default: + break; } return ret; } @@ -389,7 +428,7 @@ void EnPst_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); SubS_SetOfferMode(&this->stateFlags, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); - SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, 0); + SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, POSTBOX_ANIM_IDLE); this->actor.targetMode = TARGET_MODE_0; Actor_SetScale(&this->actor, 0.02f); this->actionFunc = EnPst_FollowSchedule; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 42dcd82aca..37b35086d0 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -447,14 +447,14 @@ void EnSob1_Destroy(Actor* thisx, PlayState* play) { } void EnSob1_UpdateCursorPos(PlayState* play, EnSob1* this) { - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; f32 xOffset = 0.0f; f32 yOffset = 17.0f; - Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y); - this->cursorPos.x = x + xOffset; - this->cursorPos.y = y + yOffset; + Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &screenPosX, &screenPosY); + this->cursorPos.x = screenPosX + xOffset; + this->cursorPos.y = screenPosY + yOffset; this->cursorPos.z = 1.2f; } diff --git a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c index d812b9a042..7c485188a0 100644 --- a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c +++ b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c @@ -199,7 +199,7 @@ void func_80BB5318(EnTanron1* this, PlayState* play) { Vec3f* spB4 = NULL; f32 spB0; Vec3f spA4; - WaterBox* spA0; + WaterBox* waterBox; f32 sp9C; CollisionPoly* sp98; Actor* temp_v0; @@ -340,7 +340,7 @@ void func_80BB5318(EnTanron1* this, PlayState* play) { } ptr->unk_3C = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp98, &ptr->unk_00); sp9C = ptr->unk_00.y; - WaterBox_GetSurface1(play, &play->colCtx, ptr->unk_00.x, ptr->unk_00.z, &sp9C, &spA0); + WaterBox_GetSurface1(play, &play->colCtx, ptr->unk_00.x, ptr->unk_00.z, &sp9C, &waterBox); if ((sp9C < ptr->unk_00.y) && (ptr->unk_3C < sp9C)) { ptr->unk_3C = sp9C; } diff --git a/src/overlays/actors/ovl_En_Test5/z_en_test5.c b/src/overlays/actors/ovl_En_Test5/z_en_test5.c index f07270824b..d68faa09bd 100644 --- a/src/overlays/actors/ovl_En_Test5/z_en_test5.c +++ b/src/overlays/actors/ovl_En_Test5/z_en_test5.c @@ -35,19 +35,19 @@ void EnTest5_SetupAction(EnTest5* this, EnTest5ActionFunc actionFunc) { void EnTest5_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnTest5* this = THIS; - WaterBox* water; + WaterBox* waterBox; f32 ySurface; // If not spawned above a water source, immediately despawn if (!WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, - &water)) { + &waterBox)) { Actor_Kill(&this->actor); return; } - Math_Vec3s_ToVec3f(&this->minPos, &water->minPos); - this->xLength = (f32)water->xLength; - this->zLength = (f32)water->zLength; + Math_Vec3s_ToVec3f(&this->minPos, &waterBox->minPos); + this->xLength = (f32)waterBox->xLength; + this->zLength = (f32)waterBox->zLength; EnTest5_SetupAction(this, EnTest5_HandleBottleAction); } diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index b3b65f5136..72bdec4a10 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -157,14 +157,14 @@ void EnTrt_UpdateCollider(EnTrt* this, PlayState* play) { } void EnTrt_UpdateCursorPos(PlayState* play, EnTrt* this) { - s16 x; - s16 y; + s16 screenPosX; + s16 screenPosY; f32 xOffset = 0.0f; f32 yOffset = 17.0f; - Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &x, &y); - this->cursorPos.x = x + xOffset; - this->cursorPos.y = y + yOffset; + Actor_GetScreenPos(play, &this->items[this->cursorIndex]->actor, &screenPosX, &screenPosY); + this->cursorPos.x = screenPosX + xOffset; + this->cursorPos.y = screenPosY + yOffset; this->cursorPos.z = 1.2f; } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 2220dcc5ad..e96bbc3b34 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -834,14 +834,14 @@ void func_80B94E34(EnZog* this, PlayState* play) { this->actor.speed = 0.0f; } else { if (this->actor.speed > 0.1f) { - WaterBox* sp44; + WaterBox* waterBox; Vec3f sp38; Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &D_80B959AC, &sp38); sp38.x += Rand_CenteredFloat(30.0f); sp38.y += 20.0f; sp38.z += Rand_CenteredFloat(30.0f); - if (WaterBox_GetSurface1(play, &play->colCtx, sp38.x, sp38.z, &sp38.y, &sp44) && + if (WaterBox_GetSurface1(play, &play->colCtx, sp38.x, sp38.z, &sp38.y, &waterBox) && (this->actor.world.pos.y < sp38.y)) { EffectSsGSplash_Spawn(play, &sp38, NULL, NULL, 1, Rand_ZeroFloat(this->actor.speed * 40.0f) + (this->actor.speed * 60.0f)); diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index b688b2dd49..1392bfa145 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -591,7 +591,7 @@ void func_80B32BB8(EnZoraegg* this, PlayState* play) { } void func_80B32C34(EnZoraegg* this, PlayState* play) { - WaterBox* sp34; + WaterBox* waterBox; f32 sp30; s32 pad; @@ -600,7 +600,7 @@ void func_80B32C34(EnZoraegg* this, PlayState* play) { this->actor.focus.pos.y += 10.0f; sp30 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, &sp34)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp30, &waterBox)) { if ((this->actor.world.pos.y + 50.0f) < sp30) { this->actionFunc = func_80B32BB8; } @@ -611,7 +611,7 @@ void func_80B32C34(EnZoraegg* this, PlayState* play) { } void func_80B32D08(EnZoraegg* this, PlayState* play) { - WaterBox* sp44; + WaterBox* waterBox; f32 sp40; Vec3f sp34; s32 pad; @@ -621,7 +621,7 @@ void func_80B32D08(EnZoraegg* this, PlayState* play) { this->actor.focus.pos.y += 10.0f; sp40 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp40, &sp44)) { + if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp40, &waterBox)) { if (this->actor.world.pos.y < sp40) { sp34.x = this->actor.world.pos.x; sp34.y = sp40; diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index 7b633f915e..3a18ee915f 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -148,11 +148,11 @@ s32 func_80939470(Actor* thisx) { s32 func_8093951C(ObjBombiwa* this, PlayState* play) { s32 pad; - WaterBox* sp30; + WaterBox* waterBox; f32 sp2C; s32 sp28; - if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &sp30, + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &waterBox, &sp28) && (this->actor.world.pos.y < sp2C)) { return true; diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index a49f341f40..38a5282299 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -148,11 +148,11 @@ void func_809A13A0(ObjHamishi* this, PlayState* play) { s32 func_809A1408(ObjHamishi* this, PlayState* play) { s32 pad; - WaterBox* sp30; + WaterBox* waterBox; f32 sp2C; s32 sp28; - if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &sp30, + if (WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &waterBox, &sp28) && (this->actor.world.pos.y < sp2C)) { return true; diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 251d6d2cd7..dd05941342 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -309,7 +309,7 @@ s32 func_80A23D08(ObjIceblock* this, PlayState* play) { }; s32 pad3; ObjIceBlockUnkStruct2* ptr; - WaterBox* spC4; + WaterBox* waterBox; s32 i; s32 spBC; s32 spB8; @@ -349,7 +349,7 @@ s32 func_80A23D08(ObjIceblock* this, PlayState* play) { } } - if (WaterBox_GetSurface1_2(play, &play->colCtx, spA4.x, spA4.z, &ptr->unk_0C, &spC4)) { + if (WaterBox_GetSurface1_2(play, &play->colCtx, spA4.x, spA4.z, &ptr->unk_0C, &waterBox)) { if (phi_f20 < ptr->unk_0C) { spB8 = i; phi_f20 = ptr->unk_0C; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 9fddb83971..317d8e9ca9 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -7168,7 +7168,7 @@ void func_8083827C(Player* this, PlayState* play) { s32 temp_t0; // sp64 CollisionPoly* sp60; s32 sp5C; - WaterBox* sp58; + WaterBox* waterBox; Vec3f sp4C; f32 sp48; f32 sp44; @@ -7230,7 +7230,7 @@ void func_8083827C(Player* this, PlayState* play) { sp48 = func_80835CD8(play, this, &D_8085D154, &sp4C, &sp60, &sp5C); sp44 = this->actor.world.pos.y; - if (WaterBox_GetSurface1(play, &play->colCtx, sp4C.x, sp4C.z, &sp44, &sp58) && + if (WaterBox_GetSurface1(play, &play->colCtx, sp4C.x, sp4C.z, &sp44, &waterBox) && ((sp44 - sp48) > 50.0f)) { func_80834DB8(this, &gPlayerAnim_link_normal_run_jump_water_fall, 6.0f, play); Player_SetAction(play, this, Player_Action_27, 0); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index ea4063db30..936e9cddd5 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -10167,7 +10167,7 @@ 0x80A3148C:("EnSlime_Draw",), 0x80A32210:("EnPr_Init",), 0x80A32400:("EnPr_Destroy",), - 0x80A3242C:("func_80A3242C",), + 0x80A3242C:("EnPr_ChangeAnim",), 0x80A324E0:("func_80A324E0",), 0x80A325E4:("func_80A325E4",), 0x80A326F0:("func_80A326F0",), @@ -11019,7 +11019,7 @@ 0x80A7422C:("EnPr2_Destroy",), 0x80A7429C:("func_80A7429C",), 0x80A7436C:("func_80A7436C",), - 0x80A74510:("func_80A74510",), + 0x80A74510:("EnPr2_ChangeAnim",), 0x80A745C4:("func_80A745C4",), 0x80A745FC:("func_80A745FC",), 0x80A74888:("func_80A74888",), @@ -11036,7 +11036,7 @@ 0x80A75A40:("EnPr2_Draw",), 0x80A75DC0:("EnPrz_Init",), 0x80A75F08:("EnPrz_Destroy",), - 0x80A75F18:("func_80A75F18",), + 0x80A75F18:("EnPrz_ChangeAnim",), 0x80A75FA4:("func_80A75FA4",), 0x80A76070:("func_80A76070",), 0x80A762C0:("func_80A762C0",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index f0d079f396..d9e6205c69 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -11086,7 +11086,7 @@ 0x80A338D4:("En_Pr_InitVars","UNK_TYPE1","",0x1), 0x80A338F4:("D_80A338F4","UNK_TYPE1","",0x1), 0x80A33920:("D_80A33920","UNK_TYPE1","",0x1), - 0x80A33934:("D_80A33934","UNK_TYPE1","",0x1), + 0x80A33934:("sAnimationModes","UNK_TYPE1","",0x1), 0x80A3393C:("D_80A3393C","UNK_TYPE4","",0x4), 0x80A33950:("D_80A33950","f32","",0x4), 0x80A33954:("D_80A33954","f32","",0x4), @@ -11945,7 +11945,7 @@ 0x80A75BE0:("D_80A75BE0","UNK_TYPE1","",0x1), 0x80A75C0C:("En_Pr2_InitVars","UNK_TYPE1","",0x1), 0x80A75C2C:("D_80A75C2C","UNK_TYPE1","",0x1), - 0x80A75C38:("D_80A75C38","UNK_TYPE1","",0x1), + 0x80A75C38:("sAnimationModes","UNK_TYPE1","",0x1), 0x80A75C3C:("D_80A75C3C","UNK_TYPE1","",0x1), 0x80A75C60:("D_80A75C60","f32","",0x4), 0x80A75C64:("D_80A75C64","f32","",0x4), @@ -11961,8 +11961,8 @@ 0x80A771E0:("D_80A771E0","f32","",0x4), 0x80A771F4:("D_80A771F4","UNK_TYPE1","",0x1), 0x80A77220:("En_Prz_InitVars","UNK_TYPE1","",0x1), - 0x80A77240:("D_80A77240","UNK_TYPE1","",0x1), - 0x80A77248:("D_80A77248","UNK_TYPE1","",0x1), + 0x80A77240:("sAnimations","UNK_TYPE1","",0x1), + 0x80A77248:("sAnimationModes","UNK_TYPE1","",0x1), 0x80A7724C:("D_80A7724C","UNK_TYPE4","",0x4), 0x80A77260:("D_80A77260","f32","",0x4), 0x80A77264:("D_80A77264","f32","",0x4),