From 0bb57352a52ba8fa3d361d2f88c2b9063fa71f62 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:54:14 +1000 Subject: [PATCH] Animation Cleanup: En_T* (#1522) * anim T cleanup * more cleanup * brackets and floats * small thing * more floats * fix name * fix * format --------- Co-authored-by: angie --- include/z64player.h | 3 + src/audio/lib/playback.c | 7 +- src/code/z_actor.c | 4 +- src/code/z_collision_check.c | 4 +- src/code/z_eventmgr.c | 6 +- src/code/z_fireobj.c | 2 +- src/code/z_kankyo.c | 4 +- src/code/z_path.c | 2 +- src/libultra/vimodes/vimodentschpf1.c | 4 +- .../ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c | 4 +- .../actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c | 4 +- .../actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c | 4 +- .../actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c | 2 +- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c | 2 +- .../z_bg_ikana_bombwall.c | 2 +- .../z_bg_ikana_rotaryroom.c | 2 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 2 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 6 +- src/overlays/actors/ovl_En_Ah/z_en_ah.c | 28 +-- src/overlays/actors/ovl_En_Ah/z_en_ah.h | 2 +- src/overlays/actors/ovl_En_Al/z_en_al.c | 24 +- src/overlays/actors/ovl_En_Al/z_en_al.h | 2 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 2 +- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 2 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 4 +- src/overlays/actors/ovl_En_Fsn/z_en_fsn.c | 2 +- src/overlays/actors/ovl_En_Giant/z_en_giant.c | 2 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 54 ++-- src/overlays/actors/ovl_En_Gm/z_en_gm.h | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 2 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 10 +- src/overlays/actors/ovl_En_Ja/z_en_ja.c | 30 +-- src/overlays/actors/ovl_En_Ja/z_en_ja.h | 8 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 6 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 10 +- .../actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c | 12 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 2 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 71 +++--- src/overlays/actors/ovl_En_Pm/z_en_pm.h | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 2 +- .../actors/ovl_En_Racedog/z_en_racedog.c | 2 +- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.c | 32 ++- .../actors/ovl_En_Rail_Skb/z_en_rail_skb.h | 5 +- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 6 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 10 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 4 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 29 ++- .../actors/ovl_En_Suttari/z_en_suttari.h | 2 +- .../ovl_En_Syateki_Okuta/z_en_syateki_okuta.c | 2 +- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 24 +- src/overlays/actors/ovl_En_Tab/z_en_tab.h | 2 +- .../actors/ovl_En_Takaraya/z_en_takaraya.c | 6 +- src/overlays/actors/ovl_En_Talk/z_en_talk.c | 2 +- src/overlays/actors/ovl_En_Talk/z_en_talk.h | 1 + .../ovl_En_Talk_Gibud/z_en_talk_gibud.c | 65 ++--- .../actors/ovl_En_Tanron1/z_en_tanron1.c | 5 +- .../actors/ovl_En_Tanron2/z_en_tanron2.c | 34 ++- .../actors/ovl_En_Tanron3/z_en_tanron3.c | 19 +- .../actors/ovl_En_Tanron4/z_en_tanron4.c | 12 +- .../actors/ovl_En_Tanron5/z_en_tanron5.c | 2 +- src/overlays/actors/ovl_En_Test2/z_en_test2.c | 62 +++-- src/overlays/actors/ovl_En_Test2/z_en_test2.h | 24 +- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 100 ++++++-- src/overlays/actors/ovl_En_Test3/z_en_test3.h | 2 +- src/overlays/actors/ovl_En_Tg/z_en_tg.c | 11 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 30 +-- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 24 +- src/overlays/actors/ovl_En_Tite/z_en_tite.h | 7 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 232 +++++++++++------- src/overlays/actors/ovl_En_Tk/z_en_tk.h | 11 +- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 42 ++-- src/overlays/actors/ovl_En_Toto/z_en_toto.h | 7 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 65 ++--- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 47 ++-- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 84 ++++--- src/overlays/actors/ovl_En_Tsn/z_en_tsn.c | 15 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 11 +- src/overlays/actors/ovl_En_Yb/z_en_yb.c | 2 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 2 +- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 4 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 2 +- .../actors/ovl_Obj_Etcetera/z_obj_etcetera.c | 6 +- .../actors/ovl_Obj_Hunsui/z_obj_hunsui.c | 4 +- .../actors/ovl_Obj_Iceblock/z_obj_iceblock.c | 2 +- .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 2 +- .../ovl_Obj_Spidertent/z_obj_spidertent.c | 2 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 2 +- .../ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c | 2 +- .../ovl_Obj_Y2shutter/z_obj_y2shutter.c | 4 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.c | 2 +- .../actors/ovl_player_actor/z_player.c | 3 - tools/disasm/variables.txt | 10 +- 96 files changed, 811 insertions(+), 627 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index 2f26507058..c3d4e90958 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -552,6 +552,9 @@ typedef enum PlayerLedgeClimbType { #define LEDGE_DIST_MAX 399.96002f +// TODO: less dumb name +#define SFX_VOICE_BANK_SIZE 0x20 + typedef struct PlayerAgeProperties { /* 0x00 */ f32 ceilingCheckHeight; /* 0x04 */ f32 shadowScale; diff --git a/src/audio/lib/playback.c b/src/audio/lib/playback.c index c997d3872c..ed478ff5c5 100644 --- a/src/audio/lib/playback.c +++ b/src/audio/lib/playback.c @@ -719,11 +719,14 @@ void AudioList_ClearNotePool(NotePool* pool) { source = &pool->active; dest = &gAudioCtx.noteFreeLists.active; break; + + default: + break; } - for (;;) { + while (true) { cur = source->next; - if (cur == source || cur == NULL) { + if ((cur == source) || (cur == NULL)) { break; } AudioList_Remove(cur); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index f47b5146ec..d4fe8a9da1 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4023,7 +4023,7 @@ typedef struct { } DoorLockInfo; // size = 0x1C DoorLockInfo sDoorLocksInfo[DOORLOCK_MAX] = { - /* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0, 1.0f, 0.0f, gDoorChainDL, gDoorLockDL }, + /* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, gDoorChainDL, gDoorLockDL }, /* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, gBossDoorChainDL, gBossDoorLockDL }, /* DOORLOCK_2 */ { 0.6400000453f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainDL, gDoorLockDL }, }; @@ -4968,7 +4968,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[] for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { alpha = bodyPartIndex & 3; alpha = effectAlphaScaled - 30.0f * alpha; - if (effectAlphaScaled < 30.0f * (bodyPartIndex & 3)) { + if (effectAlphaScaled < (30.0f * (bodyPartIndex & 3))) { alpha = 0.0f; } if (alpha > 255.0f) { diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index c3ac08936b..aa36a4ac7d 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -1660,7 +1660,7 @@ s32 CollisionCheck_SetATvsAC(PlayState* play, Collider* at, ColliderInfo* atInfo if (effect == 0) { return 0; } - } else if (CollisionCheck_ApplyBumperDefense(damage, acInfo) < 1.0f && effect == 0) { + } else if ((CollisionCheck_ApplyBumperDefense(damage, acInfo) < 1.0f) && (effect == 0)) { return 0; } } @@ -3374,7 +3374,7 @@ void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colCtxt, } } else { finalDamage = CollisionCheck_ApplyBumperDefense(damage, info); - if (finalDamage < 1.0f && effect == 0) { + if ((finalDamage < 1.0f) && (effect == 0)) { return; } } diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index 35e2f1fef3..6c629cf5ef 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -318,7 +318,7 @@ s16 CutsceneManager_Update(void) { } void CutsceneManager_Queue(s16 csId) { - if (csId >= 0) { + if (csId > CS_ID_NONE) { sWaitingCutsceneList[csId >> 3] |= 1 << (csId & 7); } } @@ -343,7 +343,7 @@ s16 CutsceneManager_IsNext(s16 csId) { s16 CutsceneManager_StartWithPlayerCs(s16 csId, Actor* actor) { s16 startCsId = CutsceneManager_Start(csId, actor); - if (startCsId >= 0) { + if (startCsId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(sCutsceneMgr.play, NULL, PLAYER_CSACTION_WAIT); if (sCutsceneMgr.length == 0) { CutsceneManager_Stop(sCutsceneMgr.csId); @@ -359,7 +359,7 @@ s16 CutsceneManager_StartWithPlayerCs(s16 csId, Actor* actor) { s16 CutsceneManager_StartWithPlayerCsAndSetFlag(s16 csId, Actor* actor) { s16 startCsId = CutsceneManager_Start(csId, actor); - if (startCsId >= 0) { + if (startCsId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(sCutsceneMgr.play, NULL, PLAYER_CSACTION_WAIT); if (sCutsceneMgr.length == 0) { CutsceneManager_Stop(sCutsceneMgr.csId); diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index 8f75a4d3eb..dd98ef8eac 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -109,7 +109,7 @@ void FireObj_UpdateStateTransitions(PlayState* play, FireObj* fire) { if ((fire->flags & FIRE_FLAG_WATER_EXTINGUISHABLE) && (fire->state != FIRE_STATE_NOT_LIT) && WaterBox_GetSurface1_2(play, &play->colCtx, fire->position.x, fire->position.z, &waterY, &waterBox) && - (waterY - fire->position.y > 6500.0f * fire->yScale)) { + ((waterY - fire->position.y) > (6500.0f * fire->yScale))) { FireObj_SetState(fire, fire->dynamicSizeStep, FIRE_STATE_NOT_LIT); } if ((fire->flags & FIRE_FLAG_INTERACT_STICK) && (player->heldItemAction == PLAYER_IA_DEKU_STICK)) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 7e88e81d06..586ac8c760 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1930,8 +1930,8 @@ void Environment_DrawLensFlare(PlayState* play, EnvironmentContext* envCtx, View if (sSunDepthTestY < 0) { sSunDepthTestY = 0; } - if (sSunScreenDepth != GPACK_ZDZ(G_MAXFBZ, 0) || screenPos.x < 0.0f || screenPos.y < 0.0f || - screenPos.x > SCREEN_WIDTH || screenPos.y > SCREEN_HEIGHT) { + if ((sSunScreenDepth != GPACK_ZDZ(G_MAXFBZ, 0)) || (screenPos.x < 0.0f) || (screenPos.y < 0.0f) || + (screenPos.x > SCREEN_WIDTH) || (screenPos.y > SCREEN_HEIGHT)) { isOffScreen = true; } } diff --git a/src/code/z_path.c b/src/code/z_path.c index 7b33c1f830..2694d9b1c4 100644 --- a/src/code/z_path.c +++ b/src/code/z_path.c @@ -21,7 +21,7 @@ f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw) { Vec3s* pointPos; if (path == NULL) { - return -1.0; + return -1.0f; } pointPos = Lib_SegmentedToVirtual(path->points); diff --git a/src/libultra/vimodes/vimodentschpf1.c b/src/libultra/vimodes/vimodentschpf1.c index ce7c7d8a71..e9686ab584 100644 --- a/src/libultra/vimodes/vimodentschpf1.c +++ b/src/libultra/vimodes/vimodentschpf1.c @@ -21,7 +21,7 @@ OSViMode osViModeNtscHpf1 = { { // [0] ORIGIN(1280), // origin - SCALE(0.5, 0.5), // 0x2000800, // yScale + SCALE(0.5f, 0.5f), // 0x2000800, // yScale START(35, 509), // vStart BURST(4, 2, 14, 0), // vBurst VINTR(2), // vIntr @@ -29,7 +29,7 @@ OSViMode osViModeNtscHpf1 = { { // [1] ORIGIN(2560), // origin - SCALE(0.5, 0.5), // 0x2000800, // yScale + SCALE(0.5f, 0.5f), // 0x2000800, // yScale START(37, 511), // vStart BURST(4, 2, 14, 0), // vBurst VINTR(2) // vIntr diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index 1a73827610..45ff36a948 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -248,8 +248,8 @@ void BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(BgCraceMovebg* this, Pl Math_Vec3f_Diff(&player->bodyPartsPos[PLAYER_BODYPART_WAIST], &this->dyna.actor.home.pos, &posDiff); Matrix_MultVec3f(&posDiff, &this->intersectionOffsetFromHome); - if (fabsf(this->intersectionOffsetFromHome.x) < 100.0f && this->intersectionOffsetFromHome.y >= -10.0f && - this->intersectionOffsetFromHome.y <= 180.0f) { + if ((fabsf(this->intersectionOffsetFromHome.x) < 100.0f) && (this->intersectionOffsetFromHome.y >= -10.0f) && + (this->intersectionOffsetFromHome.y <= 180.0f)) { if (this->intersectionOffsetFromHome.z < 0.0f) { Flags_SetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1); this->stateFlags |= BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR; diff --git a/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c b/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c index d2014080d6..7c2cfa1dc2 100644 --- a/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c +++ b/src/overlays/actors/ovl_Bg_Fu_Kaiten/z_bg_fu_kaiten.c @@ -33,12 +33,12 @@ void BgFuKaiten_Init(Actor* thisx, PlayState* play) { BgFuKaiten* this = THIS; CollisionHeader* header = NULL; - Actor_SetScale(thisx, 1.0); + Actor_SetScale(thisx, 1.0f); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); CollisionHeader_GetVirtual(&object_fu_kaiten_Colheader_002D30, &header); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, header); - this->bounceHeight = 0.0; + this->bounceHeight = 0.0f; this->rotationSpeed = 0; this->bounceSpeed = 0; this->bounce = 0; diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index ab495de974..727ea89ea8 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -89,8 +89,8 @@ void func_80B401F8(BgGoronOyu* this, PlayState* play) { player = GET_PLAYER(play); Math_Vec3f_DistXYZAndStoreDiff(&this->waterBoxPos, &player->actor.world.pos, &dist); - if (dist.x >= 0.0f && dist.x <= this->waterBoxXLength && dist.z >= 0.0f && dist.z <= this->waterBoxZLength && - fabsf(dist.y) < 100.0f && player->actor.depthInWater > 12.0f) { + if ((dist.x >= 0.0f) && (dist.x <= this->waterBoxXLength) && (dist.z >= 0.0f) && + (dist.z <= this->waterBoxZLength) && (fabsf(dist.y) < 100.0f) && (player->actor.depthInWater > 12.0f)) { Actor_OfferGetItem(&this->dyna.actor, play, GI_MAX, this->dyna.actor.xzDistToPlayer, fabsf(this->dyna.actor.playerHeightRel)); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c index 8a1d9ad8f5..ae861d4a13 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c @@ -67,7 +67,7 @@ s32 func_80BD6638(s16* csId, s16* csIdList, s32 numCutscenes) { s32 i; *csId = CutsceneManager_GetCurrentCsId(); - if (*csId >= 0) { + if (*csId > CS_ID_NONE) { for (i = 0; i < numCutscenes; i++) { if (*csId == csIdList[i]) { retVal = true; diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index 7cc9b9da37..e44c276faf 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -924,7 +924,7 @@ void func_80A9D2C4(BgHakuginPost* this, BgHakuginPostFunc unkFunc, f32 arg2, s16 void func_80A9D360(BgHakuginPost* this, PlayState* play) { if (CutsceneManager_IsNext(this->csId)) { CutsceneManager_StartWithPlayerCs(this->csId, &this->dyna.actor); - if (this->additionalCsId >= 0) { + if (this->additionalCsId > CS_ID_NONE) { func_80A9D3E4(this); } else { this->unkFunc(this); diff --git a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c index 6c533e6993..11ad57001b 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c @@ -355,7 +355,7 @@ void func_80BD5134(BgIkanaBombwall* this, PlayState* play) { CutsceneManager_Stop(this->dyna.actor.csId); Actor_Kill(&this->dyna.actor); } - } else if (this->dyna.actor.csId >= 0) { + } else if (this->dyna.actor.csId > CS_ID_NONE) { if (CutsceneManager_GetCurrentCsId() != this->dyna.actor.csId) { Actor_Kill(&this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index ddaaa70c1c..13710bbca3 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -793,7 +793,7 @@ void func_80B819F0(Actor* thisx, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - if (this->dyna.actor.csId >= 0) { + if (this->dyna.actor.csId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); } func_80B81A64(this); diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index c7f2ecd556..9ed16ca917 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -284,7 +284,7 @@ s32 DemoEffect_OverrideLimbDrawTimewarp(PlayState* play, SkelCurve* skelCurve, s CLOSE_DISPS(play->state.gfxCtx); - if (limbIndex == 0) { + if (limbIndex == TIMEWARP_LIMB_NONE) { s16* transform = skelCurve->jointTable[LIMB_ROOT_POS]; transform[2] = transform[0] = 1024; diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 3e7b1898e2..7f8b641ba8 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -184,10 +184,10 @@ void DoorAna_GrabLink(DoorAna* this, PlayState* play) { } } - if (this->actor.playerHeightRel <= 0.0f && this->actor.xzDistToPlayer > 20.0f) { + if ((this->actor.playerHeightRel <= 0.0f) && (this->actor.xzDistToPlayer > 20.0f)) { player = GET_PLAYER(play); - player->actor.world.pos.x = Math_SinS(this->actor.yawTowardsPlayer) * 20.0f + this->actor.world.pos.x; - player->actor.world.pos.z = Math_CosS(this->actor.yawTowardsPlayer) * 20.0f + this->actor.world.pos.z; + player->actor.world.pos.x = this->actor.world.pos.x + Math_SinS(this->actor.yawTowardsPlayer) * 20.0f; + player->actor.world.pos.z = this->actor.world.pos.z + Math_CosS(this->actor.yawTowardsPlayer) * 20.0f; } } diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index 6a73f3ff8a..172987101a 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -233,7 +233,7 @@ void func_80BD2C6C(EnAh* this) { Actor* func_80BD2DA0(EnAh* this, PlayState* play) { Actor* actor; - if (this->unk_1DC == 3) { + if (this->scheduleResult == 3) { actor = this->actor.child; } else { actor = &GET_PLAYER(play)->actor; @@ -300,7 +300,7 @@ void func_80BD2FD0(EnAh* this, PlayState* play) { } s32 func_80BD30C0(EnAh* this, PlayState* play) { - switch (this->unk_1DC) { + switch (this->scheduleResult) { case 1: EnAh_ChangeAnim(this, ENAH_ANIM_0); break; @@ -374,7 +374,7 @@ MsgScript* EnAh_GetMsgScript(EnAh* this, PlayState* play) { return D_80BD3E08; } - switch (this->unk_1DC) { + switch (this->scheduleResult) { case 1: if (gSaveContext.save.day == 2) { return D_80BD3DF0; @@ -475,7 +475,7 @@ s32 func_80BD3548(EnAh* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 func_80BD35BC(EnAh* this, PlayState* play) { s16 temp; - switch (this->unk_1DC) { + switch (this->scheduleResult) { default: return false; @@ -491,25 +491,25 @@ s32 func_80BD35BC(EnAh* this, PlayState* play) { } void func_80BD3658(EnAh* this, PlayState* play) { - if ((this->unk_1DC == 1) || (this->unk_1DC == 2) || (this->unk_1DC == 3)) { + if ((this->scheduleResult == 1) || (this->scheduleResult == 2) || (this->scheduleResult == 3)) { func_80BD35BC(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } void func_80BD36B8(EnAh* this, PlayState* play) { - ScheduleOutput sp18; + ScheduleOutput scheduleOutput; - if (!Schedule_RunScript(play, D_80BD3DB0, &sp18) || - ((this->unk_1DC != sp18.result) && !func_80BD3548(this, play, &sp18))) { + if (!Schedule_RunScript(play, D_80BD3DB0, &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && !func_80BD3548(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - sp18.result = 0; + scheduleOutput.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk_1DC = sp18.result; + this->scheduleResult = scheduleOutput.result; func_80BD3658(this, play); } @@ -525,7 +525,7 @@ void func_80BD3768(EnAh* this, PlayState* play) { this->unk_2F4 = 20; this->msgScriptPos = 0; this->actionFunc = func_80BD36B8; - } else if (this->unk_1DC != 2) { + } else if (this->scheduleResult != 2) { if (this->unk_1E4 != NULL) { Math_Vec3f_Copy(&sp40, &this->unk_1E4->world.pos); Math_Vec3f_Copy(&sp34, &this->actor.world.pos); @@ -551,7 +551,7 @@ void EnAh_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); this->actor.targetMode = TARGET_MODE_6; Actor_SetScale(&this->actor, 0.01f); - this->unk_1DC = 0; + this->scheduleResult = 0; this->unk_2D8 = 0; this->actionFunc = func_80BD36B8; @@ -573,7 +573,7 @@ void EnAh_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->unk_1DC != 0) { + if (this->scheduleResult != 0) { func_80BD3198(this, play); EnAh_UpdateSkelAnime(this); func_80BD2C6C(this); @@ -643,7 +643,7 @@ void EnAh_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void EnAh_Draw(Actor* thisx, PlayState* play) { EnAh* this = THIS; - if (this->unk_1DC != 0) { + if (this->scheduleResult != 0) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.h b/src/overlays/actors/ovl_En_Ah/z_en_ah.h index 4f0b6d3524..2f2d8f34c0 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.h +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.h @@ -15,7 +15,7 @@ typedef struct EnAh { /* 0x188 */ EnAhActionFunc actionFunc; /* 0x18C */ EnAhUnkFunc unk_18C; /* 0x190 */ ColliderCylinder collider; - /* 0x1DC */ u8 unk_1DC; + /* 0x1DC */ u8 scheduleResult; /* 0x1E0 */ s32 msgScriptPos; /* 0x1E4 */ Actor* unk_1E4; /* 0x1E8 */ Vec3f unk_1E8[2]; diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index 8e9cec7618..cbe735e513 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -503,7 +503,7 @@ void func_80BDE318(EnAl* this, PlayState* play) { Actor* func_80BDE384(EnAl* this, PlayState* play) { Actor* actor; - switch (this->unk_35C) { + switch (this->scheduleResult) { case 2: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08) && CHECK_WEEKEVENTREG(WEEKEVENTREG_85_80)) { actor = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_PM); @@ -743,12 +743,12 @@ s32 func_80BDEA14(Actor* thisx, PlayState* play) { MsgScript* EnAl_GetMsgScript(EnAl* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->unk_35C == 3) { + if (this->scheduleResult == 3) { this->msgScriptCallback = func_80BDE92C; return D_80BDFD14; } - switch (this->unk_35C) { + switch (this->scheduleResult) { case 1: if (player->transformation == PLAYER_FORM_DEKU) { return D_80BDFDD0; @@ -1053,7 +1053,7 @@ void func_80BDF568(EnAl* this, PlayState* play) { } void func_80BDF578(EnAl* this, PlayState* play) { - switch (this->unk_35C) { + switch (this->scheduleResult) { case 1: case 3: func_80BDF568(this, play); @@ -1071,19 +1071,19 @@ void func_80BDF578(EnAl* this, PlayState* play) { } void func_80BDF5E8(EnAl* this, PlayState* play) { - ScheduleOutput sp20; + ScheduleOutput scheduleOutput; this->unk_4E0 = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); - if (!Schedule_RunScript(play, D_80BDFC70, &sp20) || - ((this->unk_35C != sp20.result) && !func_80BDF390(this, play, &sp20))) { + if (!Schedule_RunScript(play, D_80BDFC70, &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && !func_80BDF390(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - sp20.result = 0; + scheduleOutput.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk_35C = sp20.result; + this->scheduleResult = scheduleOutput.result; this->unk_368 = func_80BDE384(this, play); func_80BDF578(this, play); } @@ -1113,7 +1113,7 @@ void EnAl_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->unk_310, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); - this->unk_35C = 0; + this->scheduleResult = 0; this->actionFunc = func_80BDF5E8; this->actionFunc(this, play); @@ -1134,7 +1134,7 @@ void EnAl_Update(Actor* thisx, PlayState* play) { func_80BDF064(this, play); - if (this->unk_35C != 0) { + if (this->scheduleResult != 0) { EnAl_UpdateSkelAnime(this); func_80BDEE5C(this); SubS_Offer(&this->actor, play, this->unk_4D4, 30.0f, this->unk_4F0, this->unk_4C2 & SUBS_OFFER_MODE_MASK); @@ -1234,7 +1234,7 @@ void EnAl_Draw(Actor* thisx, PlayState* play) { EnAl* this = THIS; s32 i; - if (this->unk_35C != 0) { + if (this->scheduleResult != 0) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.h b/src/overlays/actors/ovl_En_Al/z_en_al.h index ef36245928..eac6880364 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.h +++ b/src/overlays/actors/ovl_En_Al/z_en_al.h @@ -16,7 +16,7 @@ typedef struct EnAl { /* 0x18C */ EnAlUnkFunc2 unk_18C; /* 0x190 */ MtxF unk_190[6]; /* 0x310 */ ColliderCylinder unk_310; - /* 0x35C */ u8 unk_35C; + /* 0x35C */ u8 scheduleResult; /* 0x360 */ MsgScript* msgScript; /* 0x364 */ s32 msgScriptPos; /* 0x368 */ Actor* unk_368; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 6c68d1c288..fb5cbf6885 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -293,7 +293,7 @@ void EnAni_Update(Actor* thisx, PlayState* play) { Actor_UpdatePos(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); this->actionFunc(this, play); - if (this->actor.xzDistToPlayer < 100.0f && !(this->stateFlags & ANI_STATE_CLIMBING)) { + if ((this->actor.xzDistToPlayer < 100.0f) && !(this->stateFlags & ANI_STATE_CLIMBING)) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); this->torsoRot.x = this->torsoRot.y = this->torsoRot.z = 0; } else { diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index ec2bafa5f2..ce30a48268 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -344,7 +344,7 @@ void EnDekubaba_Wait(EnDekubaba* this, PlayState* play) { this->actor.world.pos.y = this->actor.home.pos.y + 14.0f * this->size; if ((this->timer == 0) && (this->actor.xzDistToPlayer < (200.0f * this->size)) && - (fabsf(this->actor.playerHeightRel) < 30.0f * this->size)) { + (fabsf(this->actor.playerHeightRel) < (30.0f * this->size))) { EnDekubaba_SetupGrow(this); } } diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index b4fa4bb407..a48a7fa399 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -876,7 +876,7 @@ void func_808785B0(EnDodongo* this, PlayState* play) { func_80876D28(this, play); if (this->actor.colChkInfo.health == 0) { func_80878724(this); - } else if (this->actor.xzDistToPlayer > 100.0f * this->unk_334) { + } else if (this->actor.xzDistToPlayer > (100.0f * this->unk_334)) { func_80877494(this); } else { func_80876B08(this, play); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index e0a2f9f7c4..4c9e72cba7 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -622,7 +622,7 @@ void EnDoor_Open(EnDoor* this, PlayState* play) { if (this->knobDoor.skelAnime.playSpeed < 1.5f) { numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; for (i = 0; i < numEffects; i++) { - EffectSsBubble_Spawn(play, &this->knobDoor.dyna.actor.world.pos, 60.0, 100.0f, 50.0f, 0.15f); + EffectSsBubble_Spawn(play, &this->knobDoor.dyna.actor.world.pos, 60.0f, 100.0f, 50.0f, 0.15f); } } } else if (Animation_OnFrame(&this->knobDoor.skelAnime, sAnimCloseFrames[this->knobDoor.animIndex])) { diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 265899e364..6e6b806a24 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -3108,7 +3108,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_172[1] != 0)) { Math_ApproachF(&this->unk_1A8, 8192.0f, 1.0f, 768.0f); - Math_ApproachF(&this->actor.speed, 4.2f, 1.0f, 0.75); + Math_ApproachF(&this->actor.speed, 4.2f, 1.0f, 0.75f); this->unk_188 = 1.2f; this->unk_18C = 4000.0f; this->unk_172[0] = 20; @@ -3137,7 +3137,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Math_ApproachS(&this->unk_15E, 0, 0x14, 0x20); if ((this->actor.xzDistToPlayer < (250.0f * sp118)) || (this->unk_172[1] != 0)) { - Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.75); + Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.75f); this->unk_188 = 1.0f; this->unk_172[0] = 20; this->unk_18C = 4000.0f; 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 bfb199efa7..e36993cd4c 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -1425,7 +1425,7 @@ void EnFsn_IdleBackroom(EnFsn* this, PlayState* play) { this->textId = 0; EnFsn_HandleConversationBackroom(this, play); this->actionFunc = EnFsn_ConverseBackroom; - } else if (this->actor.xzDistToPlayer < 100.0f || this->actor.isLockedOn) { + } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) { Actor_OfferTalk(&this->actor, play, 100.0f); } } diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index fcfbe7eb4c..2d7c0d89cf 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -352,7 +352,7 @@ void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) { void EnGiant_UpdateAlpha(EnGiant* this) { switch (this->cueId) { case GIANT_CUEID_FALLING_OVER: - if (this->skelAnime.curFrame >= 90.0f && this->alpha > 0) { + if ((this->skelAnime.curFrame >= 90.0f) && (this->alpha > 0)) { this->alpha -= 12; } break; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 4cf65f82f6..2b7e228f3b 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -460,7 +460,7 @@ s32 func_8094E0F8(EnGm* this, PlayState* play) { ret = true; } else { this->actor.draw = EnGm_Draw; - if (this->unk_258 == 2) { + if (this->scheduleResult == 2) { this->unk_268 = NULL; this->unk_3B8 = 0; } @@ -474,7 +474,7 @@ void func_8094E1DC(EnGm* this, PlayState* play) { s32 pad; f32 temp; - if (this->unk_258 == 7) { + if (this->scheduleResult == 7) { temp = this->colliderSphere.dim.modelSphere.radius * this->colliderSphere.dim.scale; this->colliderSphere.dim.worldSphere.radius = temp; CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base); @@ -807,7 +807,7 @@ s32 func_8094EB1C(Actor* thisx, PlayState* play) { } MsgScript* EnGm_GetMsgScript(EnGm* this, PlayState* play) { - switch (this->unk_258) { + switch (this->scheduleResult) { case 1: this->msgScriptCallback = func_8094E52C; return D_80951A98; @@ -866,14 +866,14 @@ s32 func_8094EE84(EnGm* this, PlayState* play) { this->actor.child = this->unk_268; this->msgScript = EnGm_GetMsgScript(this, play); - if ((this->unk_258 == 5) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) && + if ((this->scheduleResult == 5) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_50_01) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_80) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_75_02)) { this->unk_3A4 |= 0x20; - } else if ((this->unk_258 != 1) && (this->unk_258 != 5) && (this->unk_258 != 7)) { + } else if ((this->scheduleResult != 1) && (this->scheduleResult != 5) && (this->scheduleResult != 7)) { this->unk_3A4 |= 0x20; } - if ((this->unk_258 == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_01)) { + if ((this->scheduleResult == 3) && CHECK_WEEKEVENTREG(WEEKEVENTREG_75_01)) { this->unk_3A4 &= ~0x20; } @@ -890,7 +890,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { if (this->unk_3F8 == 0) { if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.sceneLayer == 2)) { EnGm_ChangeAnim(this, play, ENGM_ANIM_0); - this->unk_258 = 255; + this->scheduleResult = 255; } this->cueId = 255; this->unk_3F8 = 1; @@ -908,7 +908,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { Actor* func_8094F074(EnGm* this, PlayState* play) { Actor* actor; - switch (this->unk_258) { + switch (this->scheduleResult) { case 1: actor = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL); break; @@ -1005,7 +1005,7 @@ void func_8094F3D0(EnGm* this, PlayState* play) { } s32 func_8094F4EC(EnGm* this, PlayState* play) { - if ((this->unk_258 != 6) && (this->animIndex == ENGM_ANIM_12)) { + if ((this->scheduleResult != 6) && (this->animIndex == ENGM_ANIM_12)) { this->unk_3A4 &= ~0x2000; EnGm_ChangeAnim(this, play, ENGM_ANIM_8); } @@ -1194,7 +1194,7 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { } if (this->timePath != NULL) { - if ((this->unk_258 < 9) && (this->unk_258 != 0) && (this->timePathTimeSpeed >= 0)) { + if ((this->scheduleResult < 9) && (this->scheduleResult != 0) && (this->timePathTimeSpeed >= 0)) { phi_v1 = sp2E; } else { phi_v1 = scheduleOutput->time0; @@ -1228,7 +1228,7 @@ s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TAB)) { - if (this->unk_258 == 0) { + if (this->scheduleResult == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90); SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); EnGm_ChangeAnim(this, play, ENGM_ANIM_0); @@ -1299,7 +1299,7 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { Math_Vec3s_ToVec3f(&sp30, &sp48[this->timePath->count - 1]); this->actor.shape.shadowDraw = NULL; this->actor.world.rot.y = Math_Vec3f_Yaw(&sp3C, &sp30); - if (this->unk_258 == 0) { + if (this->scheduleResult == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D9C); SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_3C8 = 4; @@ -1537,7 +1537,7 @@ s32 func_80950690(EnGm* this, PlayState* play) { Actor* al; Actor* toto; - switch (this->unk_258) { + switch (this->scheduleResult) { case 2: al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); toto = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); @@ -1578,7 +1578,7 @@ s32 func_80950804(EnGm* this, PlayState* play) { s32 pad; f32 temp_f0; - door = EnGm_FindScheduleDoor(play, this->unk_258); + door = EnGm_FindScheduleDoor(play, this->scheduleResult); if (!SubS_InCsMode(play) && (this->timePathTimeSpeed != 0)) { if ((door != NULL) && (door->knobDoor.dyna.actor.update != NULL)) { if ((this->unk_3BA / (f32)this->unk_3B8) <= 0.9f) { @@ -1658,7 +1658,7 @@ s32 func_8095097C(EnGm* this, PlayState* play) { } void func_80950C24(EnGm* this, PlayState* play) { - switch (this->unk_258) { + switch (this->scheduleResult) { case 1: func_80950388(this, play); break; @@ -1714,20 +1714,20 @@ void func_80950C24(EnGm* this, PlayState* play) { } void func_80950CDC(EnGm* this, PlayState* play) { - ScheduleOutput sp20; + ScheduleOutput scheduleOutput; this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); - if (!Schedule_RunScript(play, D_80951820, &sp20) || - ((this->unk_258 != sp20.result) && !func_80950280(this, play, &sp20))) { + if (!Schedule_RunScript(play, D_80951820, &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && !func_80950280(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - sp20.result = 0; + scheduleOutput.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk_258 = sp20.result; + this->scheduleResult = scheduleOutput.result; this->unk_268 = func_8094F074(this, play); func_80950C24(this, play); } @@ -1741,7 +1741,7 @@ void func_80950DB8(EnGm* this, PlayState* play) { if (MsgEvent_RunScript(&this->actor, play, this->msgScript, this->msgScriptCallback, &this->msgScriptPos)) { SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); - if ((this->unk_258 == 2) && (al != NULL) && (al->update != NULL)) { + if ((this->scheduleResult == 2) && (al != NULL) && (al->update != NULL)) { this->unk_268 = al; this->unk_3B8 = Rand_S16Offset(60, 60); } else { @@ -1751,8 +1751,8 @@ void func_80950DB8(EnGm* this, PlayState* play) { this->unk_3C6 = 20; this->msgScriptPos = 0; this->actionFunc = func_80950CDC; - } else if ((this->unk_258 != 1) && (this->unk_258 != 2) && (this->unk_258 != 3) && (this->unk_258 != 5) && - (this->unk_258 != 7)) { + } else if ((this->scheduleResult != 1) && (this->scheduleResult != 2) && (this->scheduleResult != 3) && + (this->scheduleResult != 5) && (this->scheduleResult != 7)) { if ((this->unk_268 != NULL) && (this->unk_268->update != NULL)) { Math_Vec3f_Copy(&sp40, &this->unk_268->world.pos); Math_Vec3f_Copy(&sp34, &this->actor.world.pos); @@ -1815,7 +1815,7 @@ void EnGm_Init(Actor* thisx, PlayState* play) { this->actor.room = -1; this->unk_260 = -128; this->unk_3FC = 0; - this->unk_258 = 0; + this->scheduleResult = 0; this->actionFunc = func_80950CDC; this->actionFunc(this, play); } @@ -1842,12 +1842,12 @@ void EnGm_Update(Actor* thisx, PlayState* play) { func_8094F53C(this, play); - if (this->unk_258 != 0) { + if (this->scheduleResult != 0) { EnGm_UpdateSkelAnime(this, play); func_8094E2D0(this); func_8094F2E8(this); SubS_Offer(&this->actor, play, this->unk_3B4, 30.0f, PLAYER_IA_NONE, this->unk_3A4 & SUBS_OFFER_MODE_MASK); - if ((this->unk_258 != 3) && (this->unk_258 != 5) && (this->unk_258 != 8)) { + if ((this->scheduleResult != 3) && (this->scheduleResult != 5) && (this->scheduleResult != 8)) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } @@ -1965,7 +1965,7 @@ void EnGm_Draw(Actor* thisx, PlayState* play) { }; EnGm* this = THIS; - if ((this->unk_258 != 0) && (this->objectSlot > OBJECT_SLOT_NONE)) { + if ((this->scheduleResult != 0) && (this->objectSlot > OBJECT_SLOT_NONE)) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.h b/src/overlays/actors/ovl_En_Gm/z_en_gm.h index 51b9cb780a..4384803537 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.h +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.h @@ -27,7 +27,7 @@ typedef struct EnGm { /* 0x24C */ s32 timePathWaypointTime; /* 0x250 */ s32 timePathWaypoint; /* 0x254 */ s32 timePathElapsedTime; - /* 0x258 */ u8 unk_258; + /* 0x258 */ u8 scheduleResult; /* 0x259 */ u8 cueId; /* 0x25C */ s32 msgScriptPos; /* 0x260 */ s8 unk_260; 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 4fb2694f42..c28bca0809 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -126,7 +126,7 @@ void func_8093E8A0(EnGoroiwa* this) { } else if (params == ENGOROIWA_3000_1) { phi_f2 = 0.05f; } else { - phi_f2 = (Rand_ZeroOne() * (f32)0.04) + 0.04f; + phi_f2 = (Rand_ZeroOne() * .04f) + 0.04f; } Actor_SetScale(&this->actor, phi_f2); diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index f4dcd4e37c..5ac8d05731 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -932,21 +932,21 @@ void func_80BF2A50(EnIg* this, PlayState* play) { } void func_80BF2AF8(EnIg* this, PlayState* play) { - ScheduleOutput sp20; + ScheduleOutput scheduleOutput; this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); - if (!Schedule_RunScript(play, D_80BF3260, &sp20) || - ((this->scheduleResult != sp20.result) && !func_80BF2368(this, play, &sp20))) { + if (!Schedule_RunScript(play, D_80BF3260, &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && !func_80BF2368(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - sp20.result = 0; + scheduleOutput.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_TARGETABLE; } this->unk_2A8 = func_80BF146C(this, play); - this->scheduleResult = sp20.result; + this->scheduleResult = scheduleOutput.result; func_80BF2A50(this, play); } diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c index 821cb33af9..558a3f1c3b 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -364,31 +364,31 @@ s32 func_80BC213C(EnJa* this, PlayState* play) { } void func_80BC2150(EnJa* this, PlayState* play) { - if ((this->unk_1D8 == 1) || (this->unk_1D8 == 2)) { + if ((this->scheduleResult == 1) || (this->scheduleResult == 2)) { func_80BC213C(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); } void func_80BC21A8(EnJa* this, PlayState* play) { - ScheduleOutput sp18; + ScheduleOutput scheduleOutput; this->unk_35C = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); - if (!Schedule_RunScript(play, D_80BC35F0, &sp18) || - ((this->unk_1D8 != sp18.result) && !func_80BC20D0(this, play, &sp18))) { + if (!Schedule_RunScript(play, D_80BC35F0, &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && !func_80BC20D0(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - sp18.result = 0; + scheduleOutput.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk_1D8 = sp18.result; + this->scheduleResult = scheduleOutput.result; func_80BC2150(this, play); } MsgScript* EnJa_GetMsgScript(EnJa* this, PlayState* play) { - switch (this->unk_1D8) { + switch (this->scheduleResult) { case 1: if (ENJA_GET_3(&this->actor) == 0) { return D_80BC360C; @@ -434,7 +434,7 @@ void EnJa_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_NONE, SUBS_OFFER_MODE_MASK); this->unk_340 |= 0x10; - this->unk_1D8 = 0; + this->scheduleResult = 0; this->msgScriptCallback = NULL; this->actionFunc = func_80BC21A8; } @@ -454,7 +454,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->unk_1D8 != 0) { + if (this->scheduleResult != 0) { EnJa_UpdateSkelAnime(this); func_80BC1A68(this); func_80BC1D70(this, play); @@ -463,14 +463,14 @@ void EnJa_Update(Actor* thisx, PlayState* play) { height = this->collider.dim.height + 10; SubS_Offer(&this->actor, play, radius, height, PLAYER_IA_NONE, this->unk_340 & SUBS_OFFER_MODE_MASK); - if (this->unk_1D8 != 2) { + if (this->scheduleResult != 2) { Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 12.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); } func_80BC1984(this, play); } - if (this->unk_1D8 == 1) { + if (this->scheduleResult == 1) { func_80BC32D8(this, play); } } @@ -488,7 +488,7 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, static Vec3f D_80BC3774 = { -87.0f, 444.0f, -49.0f }; static Vec3f D_80BC3780 = { 600.0f, 0.0f, 0.0f }; static Vec3f D_80BC378C = { 400.0f, 0.0f, -400.0f }; - static Vec3f D_80BC3798 = { 400.0, 0.0f, 400.0f }; + static Vec3f D_80BC3798 = { 400.0f, 0.0f, 400.0f }; static Vec3s D_80BC37A4 = { 0x7770, -0x4BC, -0x251C }; s32 pad; EnJa* this = THIS; @@ -511,7 +511,7 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, CLOSE_DISPS(play->state.gfxCtx); } - if (this->unk_1D8 == 1) { + if (this->scheduleResult == 1) { if ((limbIndex == OBJECT_BOJ_LIMB_0B) && (((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) || ((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) { @@ -673,7 +673,7 @@ void EnJa_Draw(Actor* thisx, PlayState* play) { phi_t2 = 1; } - if (this->unk_1D8 != 0) { + if (this->scheduleResult != 0) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -694,7 +694,7 @@ void EnJa_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } - if (this->unk_1D8 == 1) { + if (this->scheduleResult == 1) { func_80BC3594(this, play); } } diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.h b/src/overlays/actors/ovl_En_Ja/z_en_ja.h index f0927cb669..fdd87d85d1 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.h +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.h @@ -11,9 +11,9 @@ typedef void (*EnJaActionFunc)(struct EnJa*, PlayState*); #define ENJA_GET_3(thisx) (((thisx)->params & 3) & 0xFF) typedef struct { - /* 0x00 */ Vec3f unk_00; - /* 0x0C */ s16 unk_0C; - /* 0x0E */ s16 unk_0E; + /* 0x0 */ Vec3f unk_00; + /* 0xC */ s16 unk_0C; + /* 0xE */ s16 unk_0E; } EnJaStruct; // size = 0x10 typedef struct EnJa { @@ -21,7 +21,7 @@ typedef struct EnJa { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnJaActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ u8 unk_1D8; + /* 0x1D8 */ u8 scheduleResult; /* 0x1DC */ s32 msgScriptPos; /* 0x1E0 */ Actor* unk_1E0; /* 0x1E4 */ Vec3s unk_1E4; diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index ad878e8e3c..15e96a007d 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -913,7 +913,7 @@ void func_80B872F4(EnKaizoku* this, PlayState* play) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; func_80B88CD8(this); } else if (Actor_IsFacingPlayer(&this->picto.actor, 0xBB8)) { - if ((this->picto.actor.xzDistToPlayer < 400.0f && this->picto.actor.xzDistToPlayer > 150.0f) && + if ((this->picto.actor.xzDistToPlayer < 400.0f) && (this->picto.actor.xzDistToPlayer > 150.0f) && (Rand_ZeroOne() < 0.7f)) { if ((Rand_ZeroOne() > 0.5f) || (ABS_ALT(yawDiff) < 0x3000)) { func_80B88214(this); @@ -1080,7 +1080,7 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { func_80B874D8(this, play); } else if (!func_80B85858(this, play)) { if (!(play->gameplayFrames & 1)) { - if (this->picto.actor.xzDistToPlayer < 100.0f && Rand_ZeroOne() > 0.7f) { + if ((this->picto.actor.xzDistToPlayer < 100.0f) && (Rand_ZeroOne() > 0.7f)) { this->bodyCollider.base.acFlags &= ~AC_HARD; func_80B87C7C(this); } else { @@ -1215,7 +1215,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { this->lookTimer = 20; } } else { - if (Rand_ZeroOne() > 0.7f || this->picto.actor.xzDistToPlayer >= 120.0f) { + if ((Rand_ZeroOne() > 0.7f) || (this->picto.actor.xzDistToPlayer >= 120.0f)) { func_80B872A4(this); return; } 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 2b9e6bc39c..6f8865b7ef 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -92,10 +92,10 @@ Vec3f D_80971E38[] = { }; Vec3f D_80971EEC[] = { - { 12.0f, 1.0f, 2.0f }, { 12.0f, 1.0f, 2.0f }, { 2.0f, -6.0f, 0.0f }, { 12.0f, -6.0f, -10.0f }, - { -88.0f, 14.0, -10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, - { 0.0f, -10.0f, 0.0f }, { 0.0f, -10.0f, 0.0f }, { 0.0f, -10.0f, 0.0f }, { 0.0f, -10.0f, 0.0f }, - { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, + { 12.0f, 1.0f, 2.0f }, { 12.0f, 1.0f, 2.0f }, { 2.0f, -6.0f, 0.0f }, { 12.0f, -6.0f, -10.0f }, + { -88.0f, 14.0f, -10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, + { 0.0f, -10.0f, 0.0f }, { 0.0f, -10.0f, 0.0f }, { 0.0f, -10.0f, 0.0f }, { 0.0f, -10.0f, 0.0f }, + { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, }; Vec3f D_80971FA0[] = { @@ -1044,7 +1044,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { } void EnKakasi_SetupIdleUnderground(EnKakasi* this) { - this->picto.actor.shape.yOffset = -7000.0; + this->picto.actor.shape.yOffset = -7000.0f; this->picto.actor.draw = NULL; this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->unkState196 = 5; diff --git a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c index 356a92c298..b691664c47 100644 --- a/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c +++ b/src/overlays/actors/ovl_En_Neo_Reeba/z_en_neo_reeba.c @@ -282,7 +282,7 @@ void EnNeoReeba_Move(EnNeoReeba* this, PlayState* play) { if (remainingDist < 2.0f) { EnNeoReeba_SetupChooseAction(this); - } else if (remainingDist < 40.0f && this->actor.speed > 3.0f) { + } else if ((remainingDist < 40.0f) && (this->actor.speed > 3.0f)) { this->actor.speed -= 2.0f; } @@ -312,12 +312,12 @@ void EnNeoReeba_ReturnHome(EnNeoReeba* this, PlayState* play) { if (remainingDist < 2.0f) { EnNeoReeba_SetupChooseAction(this); - } else if (remainingDist < 40.0f && this->actor.speed > 3.0f) { + } else if ((remainingDist < 40.0f) && (this->actor.speed > 3.0f)) { this->actor.speed -= 1.0f; } - if (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) > 200.0f || - fabsf(this->actor.playerHeightRel) > 100.0f) { + if ((Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) > 200.0f) || + (fabsf(this->actor.playerHeightRel) > 100.0f)) { EnNeoReeba_SetupSink(this); } } @@ -410,7 +410,9 @@ void EnNeoReeba_SetupDamageAnim(EnNeoReeba* this) { this->actionFunc = EnNeoReeba_DamageAnim; } -static f32 sDamageAnimXZScales[] = { 0.04, 0.04, 0.039, 0.042, 0.045, 0.043, 0.04, 0.035, 0.03, 0.033, 0.04 }; +static f32 sDamageAnimXZScales[] = { + 0.04f, 0.04f, 0.039f, 0.042f, 0.045f, 0.043f, 0.04f, 0.035f, 0.03f, 0.033f, 0.04f +}; static f32 sDamageAnimYScales[] = { 0.04f, 0.04f, 0.041f, 0.038f, 0.035f, 0.037f, 0.04f, 0.045f, 0.05f, 0.047f, 0.04f }; void EnNeoReeba_DamageAnim(EnNeoReeba* this, PlayState* play) { 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 f677f918d0..f6a23570e6 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -1064,7 +1064,7 @@ void EnPametfrog_JumpToLink(EnPametfrog* this, PlayState* play) { if ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) && Actor_IsFacingPlayer(&this->actor, 0x3000) && - (this->skelAnime.curFrame <= 2.0f || this->skelAnime.curFrame >= 11.0f)) { + ((this->skelAnime.curFrame <= 2.0f) || (this->skelAnime.curFrame >= 11.0f))) { EnPametfrog_SetupMeleeAttack(this); } } diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index bf54ec6d4e..60873dd470 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -544,7 +544,7 @@ void func_80AF7F68(EnPm* this, PlayState* play) { f32 temp; s32 pad; - switch (this->unk_258) { + switch (this->scheduleResult) { case 9: case 20: case 21: @@ -567,7 +567,7 @@ void func_80AF7F68(EnPm* this, PlayState* play) { Actor* func_80AF8040(EnPm* this, PlayState* play) { Actor* actor; - switch (this->unk_258) { + switch (this->scheduleResult) { case 16: actor = EnPm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AN); break; @@ -585,7 +585,7 @@ Actor* func_80AF8040(EnPm* this, PlayState* play) { case 5: case 6: case 7: - actor = func_80AF7DC4(this, play, this->unk_258 - 3); + actor = func_80AF7DC4(this, play, this->scheduleResult - 3); break; case 19: @@ -744,7 +744,7 @@ s32 func_80AF8478(Actor* thisx, PlayState* play) { } MsgScript* EnPm_GetMsgScript(EnPm* this, PlayState* play) { - switch (this->unk_258) { + switch (this->scheduleResult) { case 28: this->msgScriptCallback = func_80AF8348; return D_80AFB6BC; @@ -779,7 +779,7 @@ MsgScript* EnPm_GetMsgScript(EnPm* this, PlayState* play) { return D_80AFB744; } - switch (this->unk_258) { + switch (this->scheduleResult) { case 9: return D_80AFB614; @@ -822,8 +822,8 @@ s32 func_80AF86F0(EnPm* this, PlayState* play) { this->msgScriptCallback = NULL; this->actor.child = this->unk_268; this->msgScript = EnPm_GetMsgScript(this, play); - if ((this->unk_258 != 24) && (this->unk_258 != 9) && (this->unk_258 != 20) && (this->unk_258 != 21) && - (this->unk_258 != 22)) { + if ((this->scheduleResult != 24) && (this->scheduleResult != 9) && (this->scheduleResult != 20) && + (this->scheduleResult != 21) && (this->scheduleResult != 22)) { this->unk_356 |= 0x20; } this->actionFunc = func_80AFA5FC; @@ -839,14 +839,14 @@ s32 func_80AF87C4(EnPm* this, PlayState* play) { (play->curSpawn == 1)) { if (!this->unk_380) { func_80AF7E98(this, 0); - this->unk_258 = 255; + this->scheduleResult = 255; this->unk_380 = true; this->actor.speed = 4.0f; this->actor.gravity = -1.0f; } ret = true; } else if (this->unk_380) { - this->unk_258 = 0; + this->scheduleResult = 0; this->unk_380 = false; this->actor.speed = 0.0f; } @@ -1113,7 +1113,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { } if (this->timePath != 0) { - if ((this->unk_258 < 38) && (this->unk_258 != 0) && (this->timePathTimeSpeed >= 0)) { + if ((this->scheduleResult < 38) && (this->scheduleResult != 0) && (this->timePathTimeSpeed >= 0)) { phi_v1 = sp2E; } else { phi_v1 = scheduleOutput->time0; @@ -1132,7 +1132,7 @@ s32 func_80AF91E8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { (this->timePathElapsedTime / this->timePathWaypointTime) + (SUBS_TIME_PATHING_ORDER - 1); this->unk_356 &= ~8; this->unk_356 &= ~0x10; - if (this->unk_258 == 27) { + if (this->scheduleResult == 27) { Actor_PlaySfx(&this->actor, NA_SE_EV_ROOM_CARTAIN); Flags_UnsetSwitch(play, 0); } @@ -1336,7 +1336,7 @@ s32 func_80AF9A0C(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; - if (this->unk_258 != 0) { + if (this->scheduleResult != 0) { this->unk_356 |= 0x800; func_80AF7E98(this, 5); } else { @@ -1354,7 +1354,7 @@ s32 func_80AF9AB0(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; - if (this->unk_258 != 0) { + if (this->scheduleResult != 0) { this->unk_356 |= 0x800; func_80AF7E98(this, 5); } else { @@ -1372,7 +1372,7 @@ s32 func_80AF9B54(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { SubS_SetOfferMode(&this->unk_356, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); this->unk_356 |= 0x9000; this->unk_356 |= 0x20; - if (this->unk_258 != 0) { + if (this->scheduleResult != 0) { this->unk_356 |= 0x800; func_80AF7E98(this, 5); } else { @@ -1518,7 +1518,7 @@ s32 func_80AF9BF8(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput) { } s32 func_80AF9D04(EnPm* this, PlayState* play) { - EnDoor* door = EnPm_FindScheduleDoor(play, this->unk_258); + EnDoor* door = EnPm_FindScheduleDoor(play, this->scheduleResult); Vec3f sp38; s32 pad; f32 temp; @@ -1594,12 +1594,12 @@ s32 func_80AF9E7C(EnPm* this, PlayState* play) { this->timePathElapsedTime = sp54; this->timePathWaypoint = sp50; this->timePathTargetPos = timePathTargetPos; - } else if ((this->unk_258 != 91) && + } else if ((this->scheduleResult != 91) && (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 8.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMAN_WALK); } - if ((this->unk_356 & 0x10) && (this->unk_258 == 90)) { + if ((this->unk_356 & 0x10) && (this->scheduleResult == 90)) { //! @bug Uses SET_WEEKEVENTREG instead of CHECK_WEEKEVENTREG if (!SET_WEEKEVENTREG(WEEKEVENTREG_89_40)) { SET_WEEKEVENTREG(WEEKEVENTREG_89_40); @@ -1613,7 +1613,7 @@ s32 func_80AFA170(EnPm* this, PlayState* play) { Vec3f sp34; Vec3f sp28; - switch (this->unk_258) { + switch (this->scheduleResult) { case 28: if (CURRENT_TIME >= CLOCK_TIME(1, 39)) { SET_WEEKEVENTREG(WEEKEVENTREG_89_08); @@ -1645,10 +1645,10 @@ s32 func_80AFA170(EnPm* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_POSTMACHINE_HIT_OPEN); } - if (this->unk_258 == 19) { + if (this->scheduleResult == 19) { func_80AF8BA8(4); } else { - func_80AF8BA8(this->unk_258 - 3); + func_80AF8BA8(this->scheduleResult - 3); } break; } @@ -1665,7 +1665,7 @@ s32 func_80AFA170(EnPm* this, PlayState* play) { s32 func_80AFA334(EnPm* this, PlayState* play) { s16 temp_v0; - switch (this->unk_258) { + switch (this->scheduleResult) { case 14: case 24: temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -1699,7 +1699,7 @@ s32 func_80AFA334(EnPm* this, PlayState* play) { } void func_80AFA438(EnPm* this, PlayState* play) { - switch (this->unk_258) { + switch (this->scheduleResult) { case 3: case 4: case 5: @@ -1807,7 +1807,7 @@ void func_80AFA4D0(EnPm* this, PlayState* play) { }; u16 time = CURRENT_TIME; u16 sp3C = 0; - ScheduleOutput sp2C; + ScheduleOutput scheduleOutput; this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (this->unk_38C != 0) { @@ -1816,17 +1816,17 @@ void func_80AFA4D0(EnPm* this, PlayState* play) { gSaveContext.save.time = time; } - if (!Schedule_RunScript(play, D_80AFB900[this->unk_38C], &sp2C) || - ((this->unk_258 != sp2C.result) && !func_80AF9BF8(this, play, &sp2C))) { + if (!Schedule_RunScript(play, D_80AFB900[this->unk_38C], &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && !func_80AF9BF8(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - sp2C.result = 0; + scheduleOutput.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk_258 = sp2C.result; + this->scheduleResult = scheduleOutput.result; this->unk_268 = func_80AF8040(this, play); func_80AFA438(this, play); if (this->unk_38C != 0) { @@ -1850,9 +1850,9 @@ void func_80AFA5FC(EnPm* this, PlayState* play) { return; } - if ((this->unk_258 != 9) && (this->unk_258 != 14) && (this->unk_258 != 16) && (this->unk_258 != 17) && - (this->unk_258 != 20) && (this->unk_258 != 21) && (this->unk_258 != 22) && (this->unk_258 != 24) && - (this->unk_258 != 25)) { + if ((this->scheduleResult != 9) && (this->scheduleResult != 14) && (this->scheduleResult != 16) && + (this->scheduleResult != 17) && (this->scheduleResult != 20) && (this->scheduleResult != 21) && + (this->scheduleResult != 22) && (this->scheduleResult != 24) && (this->scheduleResult != 25)) { if ((this->unk_268 != NULL) && (this->unk_268->update != NULL)) { Math_Vec3f_Copy(&sp38, &this->unk_268->world.pos); Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); @@ -1882,7 +1882,7 @@ void EnPm_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->unk_38C = func_80AF7B40(); - this->unk_258 = 0; + this->scheduleResult = 0; this->unk_356 = 0; this->actionFunc = func_80AFA4D0; this->actionFunc(this, play); @@ -1905,7 +1905,7 @@ void EnPm_Update(Actor* thisx, PlayState* play) { } else { this->actionFunc(this, play); func_80AF7BAC(this); - if (this->unk_258 != 0) { + if (this->scheduleResult != 0) { func_80AF8DD4(this, play); func_80AF7E6C(this); func_80AF8AC8(this); @@ -1950,10 +1950,11 @@ void EnPm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, break; case 8: - if ((this->unk_258 == 9) || (this->unk_258 == 20) || (this->unk_258 == 21) || (this->unk_258 == 22)) { + if ((this->scheduleResult == 9) || (this->scheduleResult == 20) || (this->scheduleResult == 21) || + (this->scheduleResult == 22)) { Matrix_MultVec3f(&gZeroVec3f, &sp2C); Math_Vec3f_ToVec3s(&this->colliderSphere.dim.worldSphere.center, &sp2C); - } else if (this->unk_258 == 24) { + } else if (this->scheduleResult == 24) { Matrix_MultVec3f(&gZeroVec3f, &sp2C); Math_Vec3f_ToVec3s(&this->colliderSphere.dim.worldSphere.center, &sp2C); } @@ -2000,7 +2001,7 @@ void EnPm_Draw(Actor* thisx, PlayState* play) { EnPm* this = THIS; s32 pad; - if (this->unk_258 != 0) { + if (this->scheduleResult != 0) { Gfx_SetupDL25_Opa(play->state.gfxCtx); OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.h b/src/overlays/actors/ovl_En_Pm/z_en_pm.h index e3341f2b23..d95f2f3e4d 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.h +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.h @@ -24,7 +24,7 @@ typedef struct EnPm { /* 0x24C */ s32 timePathWaypointTime; /* 0x250 */ s32 timePathWaypoint; /* 0x254 */ s32 timePathElapsedTime; - /* 0x258 */ u8 unk_258; + /* 0x258 */ u8 scheduleResult; /* 0x25C */ MsgScript* msgScript; /* 0x260 */ s8 unk_260; /* 0x264 */ s32 msgScriptPos; 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 686e90c925..c4add250d9 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 @@ -1236,7 +1236,7 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { if (this->actionFunc == EnPoSisters_DeathStage2) { alpha = ((-this->deathTimer * 255) + 0x1FE0) / 32; - scale = (7 / 1.2500 * 0.001f); + scale = (7 / 1.25f * 0.001f); } else { alpha = 0; scale = this->actor.scale.x * 0.5f; diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index c2a3622b14..18f6ec91d9 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -134,7 +134,7 @@ static RaceDogInfo sDogInfo[] = { * Stores the RacedogInfo for the dog that is selected by the player. These values are just * placeholders, and the actual value gets grabbed from sDogInfo in EnRacedog_Init. */ -static RaceDogInfo sSelectedDogInfo = { -1.0f, 1.0, DOG_COLOR_DEFAULT, -1, 0, 0x353E }; +static RaceDogInfo sSelectedDogInfo = { -1.0f, 1.0f, DOG_COLOR_DEFAULT, -1, 0, 0x353E }; /** * The XZ-coordinates used to determine if the dog is inside the finish line. diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index 47a735a880..bd2f3c89b0 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -5,7 +5,6 @@ */ #include "z_en_rail_skb.h" -#include "objects/object_skb/object_skb.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" @@ -556,6 +555,9 @@ void func_80B717E0(EnRailSkb* this, PlayState* play) { func_80B71650(this); } break; + + default: + break; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x71C, 0xB6); } @@ -766,6 +768,9 @@ void func_80B71F3C(EnRailSkb* this, PlayState* play) { Message_CloseTextbox(play); func_80B71D8C(this, play, func_80B718B0); break; + + default: + break; } } } @@ -1106,7 +1111,7 @@ s32 EnRailSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 EnRailSkb* this = THIS; s16 abs; - if (limbIndex == 11) { + if (limbIndex == STALCHILD_LIMB_HEAD) { OPEN_DISPS(play->state.gfxCtx); abs = fabsf(Math_SinS(play->state.frames * 6000) * 95.0f) + 160.0f; @@ -1115,15 +1120,15 @@ s32 EnRailSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 gDPSetEnvColor(POLY_OPA_DISP++, abs, abs, abs, 255); CLOSE_DISPS(play->state.gfxCtx); - } else if (limbIndex == 10) { + } else if (limbIndex == STALCHILD_LIMB_RIBCAGE) { Vec3f sp24 = { 0.0f, 1000.0f, 0.0f }; Matrix_MultVec3f(&sp24, &this->actor.focus.pos); - } else if ((limbIndex == 12) && (this->unk_3FA == 1)) { + } else if ((limbIndex == STALCHILD_LIMB_LOWER_JAW) && (this->unk_3FA == 1)) { Matrix_RotateZS(1820, MTXMODE_APPLY); } - if (((limbIndex == 11) || (limbIndex == 12)) && (this->unk_402 & 2)) { + if (((limbIndex == STALCHILD_LIMB_HEAD) || (limbIndex == STALCHILD_LIMB_LOWER_JAW)) && (this->unk_402 & 2)) { *dList = NULL; } @@ -1137,20 +1142,25 @@ void EnRailSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* if (!(this->unk_402 & 0x80)) { Collider_UpdateSpheres(limbIndex, &this->collider); - if ((limbIndex == 11) && (this->unk_402 & 1) && !(this->unk_402 & 2)) { + if ((limbIndex == STALCHILD_LIMB_HEAD) && (this->unk_402 & 1) && !(this->unk_402 & 2)) { Actor_SpawnBodyParts(&this->actor, play, ENPART_PARAMS(ENPART_TYPE_1), dList); this->unk_402 |= 2; - } else if ((this->unk_402 & 0x40) && ((limbIndex != 11) || !(this->unk_402 & 1)) && (limbIndex != 12)) { + } else if ((this->unk_402 & 0x40) && ((limbIndex != STALCHILD_LIMB_HEAD) || !(this->unk_402 & 1)) && + (limbIndex != STALCHILD_LIMB_LOWER_JAW)) { Actor_SpawnBodyParts(&this->actor, play, ENPART_PARAMS(ENPART_TYPE_1), dList); } if (this->drawDmgEffTimer != 0) { - if ((limbIndex == 2) || (limbIndex == 4) || (limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || - (limbIndex == 8) || (limbIndex == 9) || (limbIndex == 13) || (limbIndex == 14) || (limbIndex == 15) || - (limbIndex == 16) || (limbIndex == 17) || (limbIndex == 18)) { + if ((limbIndex == STALCHILD_LIMB_PELVIS) || (limbIndex == STALCHILD_LIMB_RIGHT_THIGH) || + (limbIndex == STALCHILD_LIMB_RIGHT_SHIN) || (limbIndex == STALCHILD_LIMB_RIGHT_FOOT) || + (limbIndex == STALCHILD_LIMB_LEFT_THIGH) || (limbIndex == STALCHILD_LIMB_LEFT_SHIN) || + (limbIndex == STALCHILD_LIMB_LEFT_FOOT) || (limbIndex == STALCHILD_LIMB_RIGHT_UPPER_ARM) || + (limbIndex == STALCHILD_LIMB_RIGHT_LOWER_ARM) || (limbIndex == STALCHILD_LIMB_RIGHT_HAND) || + (limbIndex == STALCHILD_LIMB_LEFT_UPPER_ARM) || (limbIndex == STALCHILD_LIMB_LEFT_LOWER_ARM) || + (limbIndex == STALCHILD_LIMB_LEFT_HAND)) { Matrix_MultZero(&this->bodyPartsPos[this->bodyPartsCount]); this->bodyPartsCount++; - } else if ((limbIndex == 11) && !(this->unk_402 & 2)) { + } else if ((limbIndex == STALCHILD_LIMB_HEAD) && !(this->unk_402 & 2)) { Matrix_MultVec3f(&D_80B734D0, &this->bodyPartsPos[this->bodyPartsCount]); this->bodyPartsCount++; } diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h index 046ce39b60..b30928b0ee 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h @@ -2,6 +2,7 @@ #define Z_EN_RAIL_SKB_H #include "global.h" +#include "objects/object_skb/object_skb.h" #include "overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.h" struct EnRailSkb; @@ -45,8 +46,8 @@ typedef struct EnRailSkb { /* 0x2E8 */ s32 unk_2E8; /* 0x2EC */ f32 drawDmgEffAlpha; /* 0x2F0 */ f32 drawDmgEffScale; - /* 0x2F4 */ Vec3s jointTable[20]; - /* 0x36C */ Vec3s morphTable[20]; + /* 0x2F4 */ Vec3s jointTable[STALCHILD_LIMB_MAX]; + /* 0x36C */ Vec3s morphTable[STALCHILD_LIMB_MAX]; /* 0x3E4 */ UNK_TYPE1 unk3E4[0xC]; /* 0x3F0 */ s16 drawDmgEffTimer; /* 0x3F2 */ s16 unk_3F2; diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index f72f1e2d53..bea5af097f 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -750,7 +750,7 @@ s32 EnRailgibud_PlayerInRangeWithCorrectState(EnRailgibud* this, PlayState* play return false; } - if (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 100.0f && + if ((Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 100.0f) && !(player->stateFlags1 & (PLAYER_STATE1_80 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_200000)) && !(player->stateFlags2 & (PLAYER_STATE2_80 | PLAYER_STATE2_4000))) { diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index dbd31882f1..075c8175cb 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -208,7 +208,7 @@ void EnSb_SetupIdle(EnSb* this, s32 changeSpeed) { void EnSb_Idle(EnSb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0); - if (this->actor.xzDistToPlayer <= 240.0f && this->actor.xzDistToPlayer > 0.0f) { + if ((this->actor.xzDistToPlayer <= 240.0f) && (this->actor.xzDistToPlayer > 0.0f)) { EnSb_SetupOpen(this); } } @@ -222,7 +222,7 @@ void EnSb_Open(EnSb* this, PlayState* play) { EnSb_SetupWaitOpen(this); } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0); - if (this->actor.xzDistToPlayer > 240.0f || this->actor.xzDistToPlayer <= 40.0f) { + if ((this->actor.xzDistToPlayer > 240.0f) || (this->actor.xzDistToPlayer <= 40.0f)) { this->vulnerableTimer = 0; EnSb_SetupWaitClosed(this); } @@ -232,7 +232,7 @@ void EnSb_Open(EnSb* this, PlayState* play) { void EnSb_WaitOpen(EnSb* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xA, 0x7D0, 0); - if (this->actor.xzDistToPlayer > 240.0f || this->actor.xzDistToPlayer <= 40.0f) { + if ((this->actor.xzDistToPlayer > 240.0f) || (this->actor.xzDistToPlayer <= 40.0f)) { this->vulnerableTimer = 0; EnSb_SetupWaitClosed(this); } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 62a842c76b..71ba9dea47 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -83,10 +83,10 @@ static AnimationInfo sAnimationInfo[STALCHILD_ANIM_MAX] = { }; static Vec3f D_80997468[] = { - { -534.0f, 80.0, -1277.0f }, - { 113.0f, 80.0, -1359.0f }, - { 100.0f, 80.0, -770.0f }, - { -334.0f, 80.0, -720.0f }, + { -534.0f, 80.0f, -1277.0f }, + { 113.0f, 80.0f, -1359.0f }, + { 100.0f, 80.0f, -770.0f }, + { -334.0f, 80.0f, -720.0f }, }; static ColliderJntSphElementInit sJntSphElementsInit[2] = { @@ -1022,7 +1022,7 @@ void func_80996AD0(EnSkb* this, PlayState* play) { void func_80996BEC(EnSkb* this, PlayState* play) { static Color_RGBA8 D_80997550 = { 170, 255, 255, 255 }; static Color_RGBA8 D_80997554 = { 200, 200, 255, 255 }; - static Vec3f D_80997558 = { 0.0f, -1.0, 0.0f }; + static Vec3f D_80997558 = { 0.0f, -1.0f, 0.0f }; Vec3f sp84; s32 i; s16 yaw; 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 7c825e5f72..52ffc00bc7 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -544,8 +544,8 @@ void EnSob1_EndingInteraction(EnSob1* this, PlayState* play) { void EnSob1_SetupWalk(EnSob1* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((player->actor.world.pos.x >= 0.0f && player->actor.world.pos.x <= 390.0f) && - (player->actor.world.pos.z >= 72.0f && player->actor.world.pos.z <= 365.0f)) { + if ((player->actor.world.pos.x >= 0.0f) && (player->actor.world.pos.x <= 390.0f) && + (player->actor.world.pos.z >= 72.0f) && (player->actor.world.pos.z <= 365.0f)) { EnSob1_SetupAction(this, EnSob1_Walk); } } diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index f09bd81c0c..ec4a7fe1f2 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -696,7 +696,7 @@ s32 func_80BABC48(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp if (this->timePath == NULL) { return 0; } - if ((this->unk428 != 0) && (this->unk428 < 0xC) && (this->timePathTimeSpeed >= 0)) { + if ((this->scheduleResult != 0) && (this->scheduleResult < 0xC) && (this->timePathTimeSpeed >= 0)) { phi_a0 = sp26; } else { phi_a0 = scheduleOutput->time0; @@ -725,7 +725,7 @@ s32 func_80BABDD8(EnSuttari* this, PlayState* play, ScheduleOutput* scheduleOutp Vec3s* sp28; s32 sp24; - if ((this->unk428 == 10) || (this->unk428 == 11) || (this->unk428 == 2)) { + if ((this->scheduleResult == 10) || (this->scheduleResult == 11) || (this->scheduleResult == 2)) { return false; } door = (EnDoor*)SubS_FindNearestActor(&this->actor, play, ACTORCAT_DOOR, ACTOR_EN_DOOR); @@ -858,7 +858,7 @@ void func_80BAC2FC(EnSuttari* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame; s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation); - switch (this->unk428) { + switch (this->scheduleResult) { case 12: case 13: this->flags1 |= 0x80; @@ -1130,16 +1130,16 @@ void func_80BACEE0(EnSuttari* this, PlayState* play) { this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || - ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { + ((this->scheduleResult != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk428 = scheduleOutput.result; + this->scheduleResult = scheduleOutput.result; func_80BAC2FC(this, play); func_80BAB434(this); - if (this->unk428 == 5) { + if (this->scheduleResult == 5) { SET_WEEKEVENTREG(WEEKEVENTREG_58_80); this->actionFunc = func_80BADDB4; this->actor.speed = 0.0f; @@ -1154,20 +1154,23 @@ void func_80BAD004(EnSuttari* this, PlayState* play) { this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || - ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { + ((this->scheduleResult != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk428 = scheduleOutput.result; + + this->scheduleResult = scheduleOutput.result; func_80BAC2FC(this, play); + if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { Message_StartTextbox(play, 0x2A3A, &this->actor); this->actionFunc = func_80BAD130; } else if ((this->actor.xzDistToPlayer < 200.0f) || this->actor.isLockedOn) { Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); } + Actor_MoveWithGravity(&this->actor); } @@ -1281,13 +1284,13 @@ void func_80BAD5F8(EnSuttari* this, PlayState* play) { } this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || - ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { + ((this->scheduleResult != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk428 = scheduleOutput.result; + this->scheduleResult = scheduleOutput.result; func_80BAC2FC(this, play); if ((this->unk430 == 1) && (this->timePath->additionalPathIndex == ADDITIONAL_PATH_INDEX_NONE)) { Actor_Kill(&this->actor); @@ -1319,13 +1322,13 @@ void func_80BAD7F8(EnSuttari* this, PlayState* play) { } this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (!Schedule_RunScript(play, D_80BAE820, &scheduleOutput) || - ((this->unk428 != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { + ((this->scheduleResult != scheduleOutput.result) && !func_80BABF64(this, play, &scheduleOutput))) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; scheduleOutput.result = 0; } else { this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk428 = scheduleOutput.result; + this->scheduleResult = scheduleOutput.result; func_80BAC2FC(this, play); if ((this->unk430 == 1) && (this->timePath->additionalPathIndex == ADDITIONAL_PATH_INDEX_NONE)) { Actor_Kill(&this->actor); @@ -1513,7 +1516,7 @@ void EnSuttari_Update(Actor* thisx, PlayState* play) { if (this->flags2 & 2) { EnSuttari_AdvanceTime(); } - if (this->unk428 != 0) { + if (this->scheduleResult != 0) { if ((this->animIndex == SUTTARI_ANIM_2) || (this->animIndex == SUTTARI_ANIM_6)) { if (Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 16.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_PAMERA_WALK); diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h index 3ba38563f9..7a99130734 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h @@ -49,7 +49,7 @@ typedef struct EnSuttari { /* 0x41C */ s32 timePathWaypointTime; /* 0x420 */ s32 timePathWaypoint; /* 0x424 */ s32 timePathElapsedTime; - /* 0x428 */ u8 unk428; + /* 0x428 */ u8 scheduleResult; /* 0x42A */ s16 timePathTimeSpeed; /* 0x42C */ s32 unk42C; /* 0x430 */ s32 unk430; diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index 7f650a6ad1..6ac9326162 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -288,7 +288,7 @@ void EnSyatekiOkuta_SetupDie(EnSyatekiOkuta* this) { * make it do nothing until the Shooting Gallery Man tells it to appear again. */ void EnSyatekiOkuta_Die(EnSyatekiOkuta* this, PlayState* play) { - static Vec3f sBubbleAccel = { 0.0f, -0.5, 0.0f }; + static Vec3f sBubbleAccel = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 sBubblePrimColor = { 255, 255, 255, 255 }; static Color_RGBA8 sBubbleEnvColor = { 150, 150, 150, 0 }; Vec3f velocity; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 23579142d2..858a15a141 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -349,7 +349,7 @@ s32 func_80BE06DC(EnTab* this, PlayState* play) { Actor* func_80BE0778(EnTab* this, PlayState* play) { Actor* actor; - if (this->unk_1D8 == 1) { + if (this->scheduleResult == 1) { actor = this->actor.child; } else { actor = &GET_PLAYER(play)->actor; @@ -487,7 +487,7 @@ MsgScript* EnTab_GetMsgScript(EnTab* this, PlayState* play) { return D_80BE1984; } - switch (this->unk_1D8) { + switch (this->scheduleResult) { case 2: this->msgScriptCallback = func_80BE0D38; if (Player_GetMask(play) != PLAYER_MASK_ROMANI) { @@ -574,7 +574,7 @@ s32 func_80BE10BC(EnTab* this, PlayState* play) { f32 dist; Actor* tempActor; - switch (this->unk_1D8) { + switch (this->scheduleResult) { case 1: if ((player->stateFlags1 & PLAYER_STATE1_40) && !(play->msgCtx.currentTextId <= 0x2B00) && (play->msgCtx.currentTextId < 0x2B08)) { @@ -612,27 +612,27 @@ s32 func_80BE10BC(EnTab* this, PlayState* play) { } void func_80BE1224(EnTab* this, PlayState* play) { - if ((this->unk_1D8 == 1) || (this->unk_1D8 == 2)) { + if ((this->scheduleResult == 1) || (this->scheduleResult == 2)) { func_80BE10BC(this, play); } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8); } void func_80BE127C(EnTab* this, PlayState* play) { - ScheduleOutput sp18; + ScheduleOutput scheduleOutput; this->unk_31A = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); - if (!Schedule_RunScript(play, D_80BE18D0, &sp18) || - ((this->unk_1D8 != sp18.result) && !func_80BE1060(this, play, &sp18))) { + if (!Schedule_RunScript(play, D_80BE18D0, &scheduleOutput) || + ((this->scheduleResult != scheduleOutput.result) && !func_80BE1060(this, play, &scheduleOutput))) { this->actor.shape.shadowDraw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - sp18.result = 0; + scheduleOutput.result = 0; } else { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; this->actor.flags |= ACTOR_FLAG_TARGETABLE; } - this->unk_1D8 = sp18.result; + this->scheduleResult = scheduleOutput.result; func_80BE1224(this, play); } @@ -667,7 +667,7 @@ void EnTab_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); - this->unk_1D8 = 0; + this->scheduleResult = 0; this->msgScriptCallback = NULL; this->unk_2FC = 0; this->unk_2FC |= 0x40; @@ -692,7 +692,7 @@ void EnTab_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (this->unk_1D8 != 0) { + if (this->scheduleResult != 0) { func_80BE0590(this); func_80BE0664(this); func_80BE09A8(this, play); @@ -763,7 +763,7 @@ void EnTab_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { void EnTab_Draw(Actor* thisx, PlayState* play) { EnTab* this = THIS; - if (this->unk_1D8 != 0) { + if (this->scheduleResult != 0) { OPEN_DISPS(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.h b/src/overlays/actors/ovl_En_Tab/z_en_tab.h index c19ffa0fed..610d6531cd 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.h +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.h @@ -13,7 +13,7 @@ typedef struct EnTab { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnTabActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ u8 unk_1D8; + /* 0x1D8 */ u8 scheduleResult; /* 0x1DC */ s32 msgScriptPos; /* 0x1E0 */ Actor* unk_1E0; /* 0x1E4 */ EnGm* unk_1E4; diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c index 2f73c81a69..282367a267 100644 --- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c +++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c @@ -217,7 +217,9 @@ void EnTakaraya_Talk(EnTakaraya* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &object_bg_Anim_009890); } } + talkState = Message_GetState(&play->msgCtx); + if ((talkState == TEXT_STATE_CLOSING) || (talkState == TEXT_STATE_DONE)) { if (this->actor.textId == 0x778) { func_80ADF2D4(this); @@ -284,9 +286,9 @@ void func_80ADF338(EnTakaraya* this, PlayState* play) { } else { sp2C = ((chest->xzDistToPlayer - 250.0f) * (25 - this->timer) * 0.04f) + 250.0f; } - subCamEye.x = (Math_SinS(chest->yawTowardsPlayer) * sp2C) + chest->world.pos.x; + subCamEye.x = chest->world.pos.x + (Math_SinS(chest->yawTowardsPlayer) * sp2C); subCamEye.y = player->actor.world.pos.y + 120.0f; - subCamEye.z = (Math_CosS(chest->yawTowardsPlayer) * sp2C) + chest->world.pos.z; + subCamEye.z = chest->world.pos.z + (Math_CosS(chest->yawTowardsPlayer) * sp2C); subCamAt.x = subCamEye.x - (Math_SinS(chest->yawTowardsPlayer) * 250.0f); subCamAt.y = subCamEye.y - 90.0f; subCamAt.z = subCamEye.z - (Math_CosS(chest->yawTowardsPlayer) * 250.0f); diff --git a/src/overlays/actors/ovl_En_Talk/z_en_talk.c b/src/overlays/actors/ovl_En_Talk/z_en_talk.c index cb352f227d..658fe9ec4d 100644 --- a/src/overlays/actors/ovl_En_Talk/z_en_talk.c +++ b/src/overlays/actors/ovl_En_Talk/z_en_talk.c @@ -30,7 +30,7 @@ ActorInit En_Talk_InitVars = { void EnTalk_Init(Actor* thisx, PlayState* play) { EnTalk* this = THIS; - s8 targetMode = this->actor.home.rot.x - 0x1; + s8 targetMode = ENTALK_GET_TARGET_MODE(&this->actor); if ((targetMode >= TARGET_MODE_0) && (targetMode < TARGET_MODE_7)) { this->actor.targetMode = targetMode; diff --git a/src/overlays/actors/ovl_En_Talk/z_en_talk.h b/src/overlays/actors/ovl_En_Talk/z_en_talk.h index ef2f67798e..a97637e4eb 100644 --- a/src/overlays/actors/ovl_En_Talk/z_en_talk.h +++ b/src/overlays/actors/ovl_En_Talk/z_en_talk.h @@ -4,6 +4,7 @@ #include "global.h" #define ENTALK_GET_TEXT_ID(thisx) (((thisx)->params & 0x3F) + 0x1C00) +#define ENTALK_GET_TARGET_MODE(thisx) (((thisx)->home.rot.x) - 1) struct EnTalk; diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index a84fa26600..4fc338fccc 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -74,23 +74,6 @@ typedef enum EnTalkGibudRequestedItemIndex { /* 9 */ EN_TALK_GIBUD_REQUESTED_ITEM_INDEX_MILK } EnTalkGibudRequestedItemIndex; -typedef enum EnTalkGibudAnimation { - /* 0 */ EN_TALK_GIBUD_ANIM_GRAB_ATTACK, - /* 1 */ EN_TALK_GIBUD_ANIM_GRAB_END, - /* 2 */ EN_TALK_GIBUD_ANIM_GRAB_START, - /* 3 */ EN_TALK_GIBUD_ANIM_LOOK_BACK, - /* 4 */ EN_TALK_GIBUD_ANIM_CROUCH_WIPING_TEARS, - /* 5 */ EN_TALK_GIBUD_ANIM_CROUCH_CRYING, - /* 6 */ EN_TALK_GIBUD_ANIM_DEATH, - /* 7 */ EN_TALK_GIBUD_ANIM_DAMAGE, - /* 8 */ EN_TALK_GIBUD_ANIM_CROUCH_END, - /* 9 */ EN_TALK_GIBUD_ANIM_IDLE, - /* 10 */ EN_TALK_GIBUD_ANIM_WALK, - /* 11 */ EN_TALK_GIBUD_ANIM_DANCE_SQUAT, - /* 12 */ EN_TALK_GIBUD_ANIM_DANCE_PIROUETTE, - /* 13 */ EN_TALK_GIBUD_ANIM_DANCE_CLAP -} EnTalkGibudAnimation; - typedef enum EnTalkGibudType { /* 0 */ EN_TALK_GIBUD_TYPE_GIBDO, /* 1 */ EN_TALK_GIBUD_TYPE_REDEAD @@ -114,21 +97,39 @@ ActorInit En_Talk_Gibud_InitVars = { /**/ EnTalkGibud_Draw, }; -static AnimationInfo sAnimationInfo[] = { - { &gGibdoRedeadGrabAttackAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &gGibdoRedeadGrabEndAnim, 0.5f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f }, - { &gGibdoRedeadGrabStartAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gGibdoRedeadLookBackAnim, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gGibdoRedeadWipingTearsAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gGibdoRedeadSobbingAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &gGibdoRedeadDeathAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gGibdoRedeadDamageAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gGibdoRedeadStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gGibdoRedeadIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &gGibdoRedeadWalkAnim, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -8.0f }, - { &gGibdoRedeadSquattingDanceAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &gGibdoRedeadPirouetteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &gGibdoRedeadClappingDanceAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, +typedef enum EnTalkGibudAnimation { + /* 0 */ EN_TALK_GIBUD_ANIM_GRAB_ATTACK, + /* 1 */ EN_TALK_GIBUD_ANIM_GRAB_END, + /* 2 */ EN_TALK_GIBUD_ANIM_GRAB_START, + /* 3 */ EN_TALK_GIBUD_ANIM_LOOK_BACK, + /* 4 */ EN_TALK_GIBUD_ANIM_CROUCH_WIPING_TEARS, + /* 5 */ EN_TALK_GIBUD_ANIM_CROUCH_CRYING, + /* 6 */ EN_TALK_GIBUD_ANIM_DEATH, + /* 7 */ EN_TALK_GIBUD_ANIM_DAMAGE, + /* 8 */ EN_TALK_GIBUD_ANIM_CROUCH_END, + /* 9 */ EN_TALK_GIBUD_ANIM_IDLE, + /* 10 */ EN_TALK_GIBUD_ANIM_WALK, + /* 11 */ EN_TALK_GIBUD_ANIM_DANCE_SQUAT, + /* 12 */ EN_TALK_GIBUD_ANIM_DANCE_PIROUETTE, + /* 13 */ EN_TALK_GIBUD_ANIM_DANCE_CLAP, + /* 14 */ EN_TALK_GIBUD_ANIM_MAX +} EnTalkGibudAnimation; + +static AnimationInfo sAnimationInfo[EN_TALK_GIBUD_ANIM_MAX] = { + { &gGibdoRedeadGrabAttackAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // EN_TALK_GIBUD_ANIM_GRAB_ATTACK + { &gGibdoRedeadGrabEndAnim, 0.5f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f }, // EN_TALK_GIBUD_ANIM_GRAB_END + { &gGibdoRedeadGrabStartAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // EN_TALK_GIBUD_ANIM_GRAB_START + { &gGibdoRedeadLookBackAnim, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // EN_TALK_GIBUD_ANIM_LOOK_BACK + { &gGibdoRedeadWipingTearsAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // EN_TALK_GIBUD_ANIM_CROUCH_WIPING_TEARS + { &gGibdoRedeadSobbingAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // EN_TALK_GIBUD_ANIM_CROUCH_CRYING + { &gGibdoRedeadDeathAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // EN_TALK_GIBUD_ANIM_DEATH + { &gGibdoRedeadDamageAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // EN_TALK_GIBUD_ANIM_DAMAGE + { &gGibdoRedeadStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // EN_TALK_GIBUD_ANIM_CROUCH_END + { &gGibdoRedeadIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // EN_TALK_GIBUD_ANIM_IDLE + { &gGibdoRedeadWalkAnim, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -8.0f }, // EN_TALK_GIBUD_ANIM_WALK + { &gGibdoRedeadSquattingDanceAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // EN_TALK_GIBUD_ANIM_DANCE_SQUAT + { &gGibdoRedeadPirouetteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // EN_TALK_GIBUD_ANIM_DANCE_PIROUETTE + { &gGibdoRedeadClappingDanceAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // EN_TALK_GIBUD_ANIM_DANCE_CLAP }; static ColliderCylinderInit sCylinderInit = { 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 7c485188a0..89b4bda5c4 100644 --- a/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c +++ b/src/overlays/actors/ovl_En_Tanron1/z_en_tanron1.c @@ -116,7 +116,7 @@ void EnTanron1_Update(Actor* thisx, PlayState* play) { } temp.x = this->unk_14C.x - temp_a0->world.pos.x; - temp.y = (this->unk_14C.y - temp_a0->world.pos.y) + 70.0f; + temp.y = this->unk_14C.y - temp_a0->world.pos.y + 70.0f; temp.z = this->unk_14C.z - temp_a0->world.pos.z; if (sqrtf(SQXYZ(temp)) < phi_f18) { @@ -147,6 +147,9 @@ void EnTanron1_Update(Actor* thisx, PlayState* play) { } this->unk_144 = 1; break; + + default: + break; } if ((player->heldItemAction == PLAYER_IA_DEKU_STICK) && (player->unk_B28 != 0)) { diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index ceb8e675f7..808a89adf0 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -118,9 +118,6 @@ static ColliderCylinderInit sCylinderInit2 = { { 22, 42, -21, { 0, 0, 0 } }, }; -Color_RGBA8 D_80BB81E8 = { 255, 255, 255, 255 }; -Color_RGBA8 D_80BB81EC = { 255, 100, 100, 255 }; - void EnTanron2_Init(Actor* thisx, PlayState* play) { EnTanron2* this = THIS; @@ -356,24 +353,26 @@ void func_80BB6F78(EnTanron2* this, PlayState* play) { } void func_80BB71C8(EnTanron2* this, PlayState* play) { + static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sEnvColor = { 255, 100, 100, 255 }; s32 i; - Vec3f spA8; - Vec3f sp9C; - Vec3f sp90; + Vec3f velocity; + Vec3f accel; + Vec3f pos; for (i = 0; i < 15; i++) { - Matrix_RotateYF(Rand_ZeroFloat(6.2831855f), MTXMODE_NEW); - Matrix_RotateXFApply(Rand_ZeroFloat(6.2831855f)); - Matrix_MultVecZ(Rand_ZeroFloat(10.0f) + 5.0f, &spA8); - sp90.x = this->actor.world.pos.x + spA8.x; - sp90.y = this->actor.world.pos.y + spA8.y; - sp90.z = this->actor.world.pos.z + spA8.z; + Matrix_RotateYF(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW); + Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); + Matrix_MultVecZ(Rand_ZeroFloat(10.0f) + 5.0f, &velocity); + pos.x = this->actor.world.pos.x + velocity.x; + pos.y = this->actor.world.pos.y + velocity.y; + pos.z = this->actor.world.pos.z + velocity.z; - sp9C.x = spA8.x * -0.03f; - sp9C.y = spA8.y * -0.03f; - sp9C.z = spA8.z * -0.03f; + accel.x = velocity.x * -0.03f; + accel.y = velocity.y * -0.03f; + accel.z = velocity.z * -0.03f; - EffectSsDtBubble_SpawnCustomColor(play, &sp90, &spA8, &sp9C, &D_80BB81E8, &D_80BB81EC, + EffectSsDtBubble_SpawnCustomColor(play, &pos, &velocity, &accel, &sPrimColor, &sEnvColor, Rand_ZeroFloat(100.0f) + 200.0f, Rand_ZeroFloat(5.0f) + 15.0f, false); } } @@ -419,8 +418,7 @@ void func_80BB7578(EnTanron2* this, PlayState* play) { ColliderInfo* acHitInfo; s32 pad; Player* player = GET_PLAYER(play); - s32 pad2; - s32 pad3; + s32 pad2[2]; u8 damage; if (this->unk_154 == 0) { diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index fe5d4aa081..80d12217af 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -132,18 +132,17 @@ void EnTanron3_SpawnBubbles(EnTanron3* this, PlayState* play) { static Color_RGBA8 sEnvColor = { 50, 10, 10, 255 }; s32 i; Vec3f velocity; - Vec3f acceleration; + Vec3f accel; for (i = 0; i < 20; i++) { Matrix_RotateYF(Rand_ZeroFloat(2 * M_PIf), MTXMODE_NEW); Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PIf)); Matrix_MultVecZ(Rand_ZeroFloat(3.0f) + 2.0f, &velocity); - acceleration.x = velocity.x * -0.05f; - acceleration.y = velocity.y * -0.05f; - acceleration.z = velocity.z * -0.05f; - EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &acceleration, &sPrimColor, - &sEnvColor, Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f, - false); + accel.x = velocity.x * -0.05f; + accel.y = velocity.y * -0.05f; + accel.z = velocity.z * -0.05f; + EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &accel, &sPrimColor, &sEnvColor, + Rand_ZeroFloat(30.0f) + 70.0f, Rand_ZeroFloat(5.0f) + 15.0f, false); } } @@ -240,6 +239,9 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { extraScaleY = 150.0f; break; + + default: + break; } if (this->workTimer[WORK_TIMER_OUT_OF_WATER] == 0) { @@ -322,6 +324,9 @@ void EnTanron3_Live(EnTanron3* this, PlayState* play) { EnTanron3_CreateEffect(play, &effectPos); } break; + + default: + break; } Actor_MoveWithGravity(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index bede359592..102dd29278 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -21,12 +21,12 @@ void EnTanron4_SetupFlyNearActor(EnTanron4* this); void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play); void EnTanron4_FlyNearActor(EnTanron4* this, PlayState* play); -typedef enum { +typedef enum SeagullFlyState { /* 0 */ SEAGULL_FLY_FLAP, /* 1 */ SEAGULL_FLY_GLIDE } SeagullFlyState; -typedef enum { +typedef enum SeagullTimer { /* 0 */ SEAGULL_TIMER_FLY_STATE, /* 1 */ SEAGULL_TIMER_CHOOSE_TARGET } SeagullTimer; @@ -105,7 +105,7 @@ void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play) { } xDiff = this->targetPos.x - this->actor.world.pos.x; - yDiff = (this->targetPos.y + this->timeInfluence) - this->actor.world.pos.y; + yDiff = this->targetPos.y + this->timeInfluence - this->actor.world.pos.y; zDiff = this->targetPos.z - this->actor.world.pos.z; distToTarget = sqrtf(SQ(xDiff) + SQ(zDiff)); @@ -159,6 +159,9 @@ void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play) { this->skelAnime.curFrame = 2.0f + KREG(42); } break; + + default: + break; } this->actor.shape.rot.x = -this->actor.world.rot.x; @@ -237,6 +240,9 @@ void EnTanron4_FlyNearActor(EnTanron4* this, PlayState* play) { this->skelAnime.curFrame = 2.0f + KREG(42); } break; + + default: + break; } this->actor.shape.rot.x = -this->actor.world.rot.x; diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index 6b4154fa1f..59070ede46 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -37,7 +37,7 @@ void EnTanron5_Draw(Actor* thisx, PlayState* play); void EnTanron5_RuinFragmentItemDrop_Update(Actor* thisx, PlayState* play2); void EnTanron5_ItemDrop_Draw(Actor* thisx, PlayState* play); -typedef enum { +typedef enum TwinmoldPropItemDropType { /* 0 */ TWINMOLD_PROP_ITEM_DROP_TYPE_10_ARROWS, /* 1 */ TWINMOLD_PROP_ITEM_DROP_TYPE_MAGIC_JAR_BIG } TwinmoldPropItemDropType; diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.c b/src/overlays/actors/ovl_En_Test2/z_en_test2.c index fef4108765..bedbb3d08d 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.c +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.c @@ -39,20 +39,20 @@ ActorInit En_Test2_InitVars = { /**/ NULL, }; -static EnTest2ModelInfo sModelInfo[] = { - { object_dekucity_ana_obj_DL_000040, NULL, NULL }, - { object_sichitai_obj_DL_001820, NULL, NULL }, - { object_yukimura_obj_DL_0008C0, NULL, NULL }, - { object_hakugin_obj_DL_0016D8, NULL, object_hakugin_obj_Matanimheader_0017A8 }, - { object_hakugin_obj_DL_002018, NULL, object_hakugin_obj_Matanimheader_0020E8 }, - { object_hakugin_obj_DL_005268, NULL, object_hakugin_obj_Matanimheader_005338 }, - { object_meganeana_obj_DL_000110, object_meganeana_obj_DL_000080, NULL }, - { object_haka_obj_DL_000F70, NULL, NULL }, - { object_haka_obj_DL_001200, NULL, NULL }, - { object_hakugin_obj_DL_004928, NULL, object_hakugin_obj_Matanimheader_0049F8 }, - { object_hakugin_obj_DL_002978, NULL, object_hakugin_obj_Matanimheader_002A58 }, - { object_hakugin_obj_DL_000D38, NULL, object_hakugin_obj_Matanimheader_000E48 }, - { object_hakugin_obj_DL_0035A8, NULL, object_hakugin_obj_Matanimheader_003888 }, +static EnTest2ModelInfo sModelInfo[EN_TEST2_TYPE_MAX] = { + { object_dekucity_ana_obj_DL_000040, NULL, NULL }, // EN_TEST2_TYPE_0 + { object_sichitai_obj_DL_001820, NULL, NULL }, // EN_TEST2_TYPE_1 + { object_yukimura_obj_DL_0008C0, NULL, NULL }, // EN_TEST2_TYPE_2 + { object_hakugin_obj_DL_0016D8, NULL, object_hakugin_obj_Matanimheader_0017A8 }, // EN_TEST2_TYPE_3 + { object_hakugin_obj_DL_002018, NULL, object_hakugin_obj_Matanimheader_0020E8 }, // EN_TEST2_TYPE_4 + { object_hakugin_obj_DL_005268, NULL, object_hakugin_obj_Matanimheader_005338 }, // EN_TEST2_TYPE_5 + { object_meganeana_obj_DL_000110, object_meganeana_obj_DL_000080, NULL }, // EN_TEST2_TYPE_6 + { object_haka_obj_DL_000F70, NULL, NULL }, // EN_TEST2_TYPE_7 + { object_haka_obj_DL_001200, NULL, NULL }, // EN_TEST2_TYPE_8 + { object_hakugin_obj_DL_004928, NULL, object_hakugin_obj_Matanimheader_0049F8 }, // EN_TEST2_TYPE_9 + { object_hakugin_obj_DL_002978, NULL, object_hakugin_obj_Matanimheader_002A58 }, // EN_TEST2_TYPE_10 + { object_hakugin_obj_DL_000D38, NULL, object_hakugin_obj_Matanimheader_000E48 }, // EN_TEST2_TYPE_11 + { object_hakugin_obj_DL_0035A8, NULL, object_hakugin_obj_Matanimheader_003888 }, // EN_TEST2_TYPE_12 }; static InitChainEntry sInitChain[] = { @@ -62,17 +62,27 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_STOP), }; -static s16 sObjectIds[] = { - OBJECT_DEKUCITY_ANA_OBJ, OBJECT_SICHITAI_OBJ, OBJECT_YUKIMURA_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, - OBJECT_HAKUGIN_OBJ, OBJECT_MEGANEANA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKUGIN_OBJ, - OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, +static s16 sObjectIds[EN_TEST2_TYPE_MAX] = { + OBJECT_DEKUCITY_ANA_OBJ, // EN_TEST2_TYPE_0 + OBJECT_SICHITAI_OBJ, // EN_TEST2_TYPE_1 + OBJECT_YUKIMURA_OBJ, // EN_TEST2_TYPE_2 + OBJECT_HAKUGIN_OBJ, // EN_TEST2_TYPE_3 + OBJECT_HAKUGIN_OBJ, // EN_TEST2_TYPE_4 + OBJECT_HAKUGIN_OBJ, // EN_TEST2_TYPE_5 + OBJECT_MEGANEANA_OBJ, // EN_TEST2_TYPE_6 + OBJECT_HAKA_OBJ, // EN_TEST2_TYPE_7 + OBJECT_HAKA_OBJ, // EN_TEST2_TYPE_8 + OBJECT_HAKUGIN_OBJ, // EN_TEST2_TYPE_9 + OBJECT_HAKUGIN_OBJ, // EN_TEST2_TYPE_10 + OBJECT_HAKUGIN_OBJ, // EN_TEST2_TYPE_11 + OBJECT_HAKUGIN_OBJ, // EN_TEST2_TYPE_12 }; void EnTest2_Init(Actor* thisx, PlayState* play) { EnTest2* this = THIS; Actor_ProcessInitChain(&this->actor, sInitChain); - if ((this->actor.params == EN_TEST2_PARAM_B) || (this->actor.params == EN_TEST2_PARAM_C)) { + if ((ENTEST2_GET_TYPE(&this->actor) == EN_TEST2_TYPE_11) || (ENTEST2_GET_TYPE(&this->actor) == EN_TEST2_TYPE_12)) { this->actor.flags |= ACTOR_FLAG_20; } } @@ -83,19 +93,22 @@ void EnTest2_Update(Actor* thisx, PlayState* play) { EnTest2ModelInfo* modelInfo; EnTest2* this = THIS; - objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]); + objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[ENTEST2_GET_TYPE(&this->actor)]); if (objectSlot <= OBJECT_SLOT_NONE) { Actor_Kill(&this->actor); return; } + if (Object_IsLoaded(&play->objectCtx, objectSlot)) { - modelInfo = &sModelInfo[this->actor.params]; + modelInfo = &sModelInfo[ENTEST2_GET_TYPE(&this->actor)]; this->actor.objectSlot = objectSlot; this->actor.draw = EnTest2_Draw; + if (modelInfo->animMat != NULL) { Actor_SetObjectDependency(play, &this->actor); this->animMat = Lib_SegmentedToVirtual(modelInfo->animMat); } + if (play->roomCtx.curRoom.lensMode != LENS_MODE_SHOW_ACTORS) { this->actor.update = EnTest2_UpdateForLens; } else { @@ -117,11 +130,12 @@ void EnTest2_UpdateForLens(Actor* thisx, PlayState* play) { void EnTest2_Draw(Actor* thisx, PlayState* play) { s32 pad; EnTest2* this = THIS; - Gfx* dList = sModelInfo[this->actor.params].dList2; + Gfx* dList = sModelInfo[ENTEST2_GET_TYPE(&this->actor)].dList2; if (this->animMat != NULL) { AnimatedMat_Draw(play, this->animMat); } + if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS)) { OPEN_DISPS(play->state.gfxCtx); @@ -131,13 +145,13 @@ void EnTest2_Draw(Actor* thisx, PlayState* play) { if (dList != NULL) { gSPDisplayList(POLY_XLU_DISP++, dList); } - gSPDisplayList(POLY_XLU_DISP++, sModelInfo[this->actor.params].dList1); + gSPDisplayList(POLY_XLU_DISP++, sModelInfo[ENTEST2_GET_TYPE(&this->actor)].dList1); CLOSE_DISPS(play->state.gfxCtx); } else { if (dList != NULL) { Gfx_DrawDListXlu(play, dList); } - Gfx_DrawDListOpa(play, sModelInfo[this->actor.params].dList1); + Gfx_DrawDListOpa(play, sModelInfo[ENTEST2_GET_TYPE(&this->actor)].dList1); } } diff --git a/src/overlays/actors/ovl_En_Test2/z_en_test2.h b/src/overlays/actors/ovl_En_Test2/z_en_test2.h index d54dbb2655..15b5937dd0 100644 --- a/src/overlays/actors/ovl_En_Test2/z_en_test2.h +++ b/src/overlays/actors/ovl_En_Test2/z_en_test2.h @@ -5,14 +5,28 @@ struct EnTest2; +#define ENTEST2_GET_TYPE(thisx) ((thisx)->params) + +typedef enum EnTest2Type { + /* 0x0 */ EN_TEST2_TYPE_0, + /* 0x1 */ EN_TEST2_TYPE_1, + /* 0x2 */ EN_TEST2_TYPE_2, + /* 0x3 */ EN_TEST2_TYPE_3, + /* 0x4 */ EN_TEST2_TYPE_4, + /* 0x5 */ EN_TEST2_TYPE_5, + /* 0x6 */ EN_TEST2_TYPE_6, + /* 0x7 */ EN_TEST2_TYPE_7, + /* 0x8 */ EN_TEST2_TYPE_8, + /* 0x9 */ EN_TEST2_TYPE_9, + /* 0xA */ EN_TEST2_TYPE_10, + /* 0xB */ EN_TEST2_TYPE_11, + /* 0xC */ EN_TEST2_TYPE_12, + /* 0xD */ EN_TEST2_TYPE_MAX +} EnTest2Type; + typedef struct EnTest2 { /* 0x000 */ Actor actor; /* 0x144 */ AnimatedMaterial* animMat; } EnTest2; // size = 0x148 -typedef enum { - /* 0xB */ EN_TEST2_PARAM_B = 0xB, - /* 0xC */ EN_TEST2_PARAM_C -} EnTest2_Param; - #endif // Z_EN_TEST2_H diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index cf396f45f4..d98b9e0e1a 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -36,7 +36,6 @@ typedef struct { /* 0x4 */ EnTest3ActionFunc actionFunc; } struct_80A4168C; // size = 0x8 -// Main functions void EnTest3_Init(Actor* thisx, PlayState* play2); void EnTest3_Destroy(Actor* thisx, PlayState* play2); void EnTest3_Update(Actor* thisx, PlayState* play2); @@ -112,41 +111,85 @@ static EnTest3UnkFunc D_80A416C0[] = { }; static PlayerAgeProperties sAgeProperties = { + // ceilingCheckHeight 40.0f, + // shadowScale 60.0f, + // unk_08 11.0f / 17.0f, + // unk_0C 71.0f, + // unk_10 50.0f, + // unk_14 49.0f, + // unk_18 39.0f, + // unk_1C 27.0f, + // unk_20 19.0f, + // unk_24 22.0f, + // unk_28 32.4f, + // unk_2C 32.0f, + // unk_30 48.0f, + // unk_34 11.0f / 17.0f * 70.0f, + // wallCheckRadius 14.0f, + // unk_3C 12.0f, + // unk_40 55.0f, + // unk_44 { 0xFFE8, 0x0DED, 0x036C }, { { 0xFFE8, 0x0D92, 0x035E }, { 0xFFE8, 0x1371, 0x03A9 }, { 0x0008, 0x1256, 0x017C }, { 0x0009, 0x17EA, 0x0167 } }, { { 0xFFE8, 0x1371, 0x03A9 }, { 0xFFE8, 0x195F, 0x03A9 }, { 0x0009, 0x17EA, 0x0167 }, { 0x0009, 0x1E0D, 0x017C } }, { { 0x0008, 0x1256, 0x017C }, { 0x0009, 0x17EA, 0x0167 }, { 0xF9C8, 0x1256, 0x017C }, { 0xF9C9, 0x17EA, 0x0167 } }, - 0x0020, - 0x0000, + // voiceSfxIdOffset + SFX_VOICE_BANK_SIZE * 1, + // surfaceSfxIdOffset + 0, + // unk_98 22.0f, + // unk_9C 29.4343f, + // openChestAnim &gPlayerAnim_clink_demo_Tbox_open, + // unk_A4 &gPlayerAnim_clink_demo_goto_future, + // unk_A8 &gPlayerAnim_clink_demo_return_to_future, + // unk_AC &gPlayerAnim_clink_normal_climb_startA, + // unk_B0 &gPlayerAnim_clink_normal_climb_startB, - { &gPlayerAnim_clink_normal_climb_upL, &gPlayerAnim_clink_normal_climb_upR, &gPlayerAnim_link_normal_Fclimb_upL, - &gPlayerAnim_link_normal_Fclimb_upR }, - { &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR }, - { &gPlayerAnim_clink_normal_climb_endAL, &gPlayerAnim_clink_normal_climb_endAR }, - { &gPlayerAnim_clink_normal_climb_endBR, &gPlayerAnim_clink_normal_climb_endBL }, + // unk_B4 + { + &gPlayerAnim_clink_normal_climb_upL, + &gPlayerAnim_clink_normal_climb_upR, + &gPlayerAnim_link_normal_Fclimb_upL, + &gPlayerAnim_link_normal_Fclimb_upR, + }, + // unk_C4 + { + &gPlayerAnim_link_normal_Fclimb_sideL, + &gPlayerAnim_link_normal_Fclimb_sideR, + }, + // unk_CC + { + &gPlayerAnim_clink_normal_climb_endAL, + &gPlayerAnim_clink_normal_climb_endAR, + }, + // unk_D4 + { + &gPlayerAnim_clink_normal_climb_endBR, + &gPlayerAnim_clink_normal_climb_endBL, + }, }; static EffectBlureInit2 sBlureInit = { @@ -209,7 +252,7 @@ s32 func_80A3E7E0(EnTest3* this, EnTest3ActionFunc actionFunc) { } else { this->unk_D94 = actionFunc; this->unk_D8A = 0; - this->unk_D88 = 0; + this->scheduleResult = 0; return true; } } @@ -218,6 +261,7 @@ s32 func_80A3E80C(EnTest3* this, PlayState* play, s32 arg2) { s32 pad; D_80A4168C[arg2].unk_0(this, play); + if (D_80A4168C[arg2].actionFunc == NULL) { // D_80A4168C[arg2].actionFunc is always NULL return false; @@ -243,7 +287,7 @@ s32 func_80A3E898(EnTest3* this, PlayState* play) { } if (textId == 0xFFFF) { Message_CloseTextbox(play); - } else if (textId) { // != 0 + } else if ((u32)textId != 0) { Message_ContinueTextbox(play, textId); } if (textId == 0x296B) { @@ -386,7 +430,7 @@ void EnTest3_Init(Actor* thisx, PlayState* play2) { this->player.heldItemAction = PLAYER_IA_NONE; this->player.heldItemId = ITEM_OCARINA_OF_TIME; - Player_SetModelGroup(&this->player, 3); + Player_SetModelGroup(&this->player, PLAYER_MODELGROUP_DEFAULT); play->playerInit(&this->player, play, &gKafeiSkel); Effect_Add(play, &this->player.meleeWeaponEffectIndex[0], EFFECT_BLURE2, 0, 0, &sBlureInit); @@ -398,6 +442,7 @@ void EnTest3_Init(Actor* thisx, PlayState* play2) { this->unk_D90 = GET_PLAYER(play); this->player.giObjectSegment = this->unk_D90->giObjectSegment; this->player.tatlActor = this->unk_D90->tatlActor; + if ((CURRENT_DAY != 3) || CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) || !CHECK_WEEKEVENTREG(WEEKEVENTREG_51_08)) { this->player.currentMask = PLAYER_MASK_KEATON; @@ -565,7 +610,8 @@ s32 func_80A3F62C(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul &D_80A41854[0], &D_80A41854[1], &D_80A41854[11], &D_80A41854[12], &D_80A41854[19], }; - if (((func_80A3F15C(this, play, arg2) || (this->unk_D88 >= 8)) && ((arg2->unk_1_4 == 1) || (arg2->unk_1_4 == 2))) || + if (((func_80A3F15C(this, play, arg2) || (this->scheduleResult >= 8)) && + ((arg2->unk_1_4 == 1) || (arg2->unk_1_4 == 2))) || (arg2->unk_1_4 == 4)) { if (arg2->unk_1_4 == 4) { this->player.actor.home.rot.y = 0x7FFF; @@ -599,9 +645,9 @@ s32 func_80A3F73C(EnTest3* this, PlayState* play) { play->tryPlayerCsAction(play, &this->player, PLAYER_CSACTION_WAIT); } Actor_OfferTalkNearColChkInfoCylinder(&this->player.actor, play); - if (this->unk_D88 == 3) { + if (this->scheduleResult == 3) { func_80A3F534(this, play); - } else if (this->unk_D88 == 5) { + } else if (this->scheduleResult == 5) { func_80A3F5A4(this, play); } this->player.actor.textId = this->unk_D78->textId; @@ -671,7 +717,7 @@ s32 func_80A3FA58(EnTest3* this, PlayState* play) { this->unk_D8A++; if (this->unk_D8A == 0) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_51_04); - this->unk_D88 = 0; + this->scheduleResult = 0; } } return false; @@ -690,7 +736,7 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { this->player.actor.textId = this->unk_D78->textId; } } else if (D_80A41D20 == 1) { - if (this->csId >= 0) { + if (this->csId > CS_ID_NONE) { if (func_80A3E9DC(this, play)) { this->csId = CS_ID_NONE; Environment_StopTime(); @@ -798,7 +844,7 @@ s32 func_80A40098(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul func_80A3F15C(this, play, arg2); this->unk_D7C = SubS_GetAdditionalPath(play, KAFEI_GET_PATH_INDEX(&this->player.actor), ABS_ALT(arg2->unk_1_0) - 1); - if ((this->unk_D88 < 7) && (this->unk_D88 != 0) && (this->unk_D80 >= 0)) { + if ((this->scheduleResult < 7) && (this->scheduleResult != 0) && (this->unk_D80 >= 0)) { startTime = now; } else { startTime = scheduleOutput->time0; @@ -852,10 +898,10 @@ s32 func_80A40230(EnTest3* this, PlayState* play) { this->unk_D98 = gZeroVec3f; if (SubS_TimePathing_Update(this->unk_D7C, &this->unk_DA4, &this->unk_DB4, this->unk_DAC, this->unk_DA8, &this->unk_DB0, knots, &this->unk_D98, this->unk_D80)) { - if (this->unk_D88 == 0x14) { + if (this->scheduleResult == 0x14) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_58_80); this->player.actor.draw = NULL; - } else if (this->unk_D88 == 9) { + } else if (this->scheduleResult == 9) { D_80A41D64 = 2; } ret = true; @@ -895,12 +941,12 @@ void func_80A40678(EnTest3* this, PlayState* play) { struct_80A41828* sp3C; ScheduleOutput scheduleOutput; - this->unk_D80 = ((this->unk_D88 == 20) || (this->unk_D88 == 10) || (this->unk_D88 == 9)) ? 3 - : Play_InCsMode(play) ? 0 + this->unk_D80 = ((this->scheduleResult == 20) || (this->scheduleResult == 10) || (this->scheduleResult == 9)) ? 3 + : Play_InCsMode(play) ? 0 : R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (Schedule_RunScript(play, sScheduleScript, &scheduleOutput)) { - if (this->unk_D88 != scheduleOutput.result) { + if (this->scheduleResult != scheduleOutput.result) { sp3C = &D_80A41828[scheduleOutput.result]; func_80A3F114(this, play); if (sp3C->unk_0 != 4) { @@ -918,8 +964,8 @@ void func_80A40678(EnTest3* this, PlayState* play) { } else { scheduleOutput.result = 0; } - this->unk_D88 = scheduleOutput.result; - sp3C = &D_80A41828[this->unk_D88]; + this->scheduleResult = scheduleOutput.result; + sp3C = &D_80A41828[this->scheduleResult]; D_80A417E8[sp3C->unk_0].unk_4(this, play); } @@ -996,7 +1042,7 @@ void EnTest3_Update(Actor* thisx, PlayState* play2) { } else if (this->player.actor.category == ACTORCAT_PLAYER) { func_80A409D4(this, play); } else if (play->tryPlayerCsAction(play, &this->player, PLAYER_CSACTION_NONE)) { - if (this->unk_D88 >= 7) { + if (this->scheduleResult >= 7) { Vec3f worldPos; Math_Vec3f_Copy(&worldPos, &this->player.actor.world.pos); @@ -1131,8 +1177,8 @@ void EnTest3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dL } else if (limbIndex == KAFEI_LIMB_HEAD) { Actor* actor730 = this->player.lockOnActor; - if ((*dList1 != NULL) && this->player.currentMask && !(this->player.stateFlags2 & PLAYER_STATE2_1000000)) { - // this->player.currentMask != PLAYER_MASK_NONE + if ((*dList1 != NULL) && ((u32)this->player.currentMask != PLAYER_MASK_NONE) && + !(this->player.stateFlags2 & PLAYER_STATE2_1000000)) { if ((this->player.skelAnime.animation != &gPlayerAnim_cl_maskoff) && ((this->player.skelAnime.animation != &gPlayerAnim_cl_setmask) || (this->player.skelAnime.curFrame >= 12.0f))) { diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.h b/src/overlays/actors/ovl_En_Test3/z_en_test3.h index 17c7041293..1b36566837 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.h +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.h @@ -22,7 +22,7 @@ typedef struct EnTest3 { /* 0xD7C */ Path* unk_D7C; /* 0xD80 */ s32 unk_D80; /* 0xD84 */ f32 unk_D84; - /* 0xD88 */ s8 unk_D88; + /* 0xD88 */ s8 scheduleResult; /* 0xD89 */ u8 unk_D89; /* 0xD8A */ s16 unk_D8A; /* 0xD8C */ u8 unk_D8C; diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index f0d0033028..702bb8dbfd 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -90,8 +90,13 @@ static DamageTable sDamageTable = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -static AnimationInfoS sAnimationInfo[] = { - { &gHoneyAndDarlingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +typedef enum EnTgAnimation { + /* 0 */ ENTG_ANIM_IDLE, + /* 1 */ ENTG_ANIM_MAX +} EnTgAnimation; + +static AnimationInfoS sAnimationInfo[ENTG_ANIM_MAX] = { + { &gHoneyAndDarlingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENTG_ANIM_IDLE }; void EnTg_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s16 animIndex) { @@ -126,7 +131,7 @@ void EnTg_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gHoneyAndDarlingSkel, NULL, this->jointTable, this->morphTable, HONEY_AND_DARLING_LIMB_MAX); - EnTg_ChangeAnim(&this->skelAnime, sAnimationInfo, 0); + EnTg_ChangeAnim(&this->skelAnime, sAnimationInfo, ENTG_ANIM_IDLE); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 2b0571e48d..ba68fc3e0f 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -167,7 +167,7 @@ void EnThiefbird_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 1500.0f, ActorShadow_DrawCircle, 35.0f); if (this->actor.params == 1) { - D_80C1392C = 1; + D_80C1392C = true; Math_Vec3f_Copy(&D_80C13920, &this->actor.world.pos); Actor_Kill(&this->actor); return; @@ -491,10 +491,8 @@ void func_80C11590(EnThiefbird* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_192 = this->actor.wallYaw; - } else { - if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { - this->unk_192 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); - } + } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { + this->unk_192 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } if (!Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 5, 0x300, 0x10) && onAnimFirstFrame && @@ -584,7 +582,7 @@ void func_80C1193C(EnThiefbird* this, PlayState* play) { this->collider.base.atFlags &= ~AT_HIT; Actor_PlaySfx(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); if (!(this->collider.base.atFlags & AT_BOUNCED)) { - if ((D_80C1392C != 0) && (CUR_UPG_VALUE(UPG_QUIVER) != 0) && + if (D_80C1392C && (CUR_UPG_VALUE(UPG_QUIVER) != 0) && ((STOLEN_ITEM_1 == STOLEN_ITEM_NONE) || (STOLEN_ITEM_2 == STOLEN_ITEM_NONE)) && (Rand_ZeroOne() < 0.5f) && func_80C10B0C(this, play)) { func_80C1242C(this); @@ -626,12 +624,11 @@ void func_80C11D14(EnThiefbird* this, PlayState* play) { } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - if (this->unk_18E < 38) { - func_80C114C0(this, play); - this->actor.speed = 4.0f; - } else { + if (this->unk_18E >= 38) { return; } + func_80C114C0(this, play); + this->actor.speed = 4.0f; } if (this->unk_18E < 20) { @@ -706,6 +703,7 @@ void func_80C11F6C(EnThiefbird* this, PlayState* play) { } this->unk_18E = 40; + if (Rand_ZeroOne() < 0.9f) { Item_DropCollectible(play, &this->actor.focus.pos, ITEM00_RUPEE_GREEN); } @@ -728,12 +726,11 @@ void func_80C1215C(EnThiefbird* this, PlayState* play) { } if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { - if (this->unk_18E < 38) { - func_80C114C0(this, play); - this->actor.speed = 4.0f; - } else { + if (this->unk_18E >= 38) { return; } + func_80C114C0(this, play); + this->actor.speed = 4.0f; } SkelAnime_Update(&this->skelAnime); @@ -803,6 +800,7 @@ void func_80C124B0(EnThiefbird* this, PlayState* play) { s16 temp_v1; SkelAnime_Update(&this->skelAnime); + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_192 = this->actor.wallYaw; } else { @@ -812,6 +810,7 @@ void func_80C124B0(EnThiefbird* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_192, 6, 0x1000, 0x100); Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &D_80C13920), 6, 0x1000, 0x100); + temp_v0 = func_800BC270(play, &this->actor, 80.0f, 0x138B0); if (temp_v0 != NULL) { temp_v1 = temp_v0->world.rot.x - Actor_WorldPitchTowardPoint(temp_v0, &this->actor.focus.pos); @@ -989,7 +988,7 @@ void func_80C12D00(EnThiefbird* this) { EnThiefbirdUnkStruct* ptr = &this->unk_3F0[0]; for (i = 0; i < ARRAY_COUNT(this->unk_3F0); i++, ptr++) { - if (ptr->unk_22) { + if (ptr->unk_22 != 0) { ptr->unk_22--; Math_Vec3f_Sum(&ptr->unk_00, &ptr->unk_0C, &ptr->unk_00); Math_Vec3f_Sum(&ptr->unk_0C, &D_80C1368C, &ptr->unk_0C); @@ -1048,6 +1047,7 @@ void EnThiefbird_Update(Actor* thisx, PlayState* play2) { } func_80C12D00(this); + if (((this->skelAnime.animation == &gTakkuriFlyAnim) && Animation_OnFrame(&this->skelAnime, 13.0f)) || ((this->skelAnime.animation == &gTakkuriFlyWithItemAnim) && Animation_OnFrame(&this->skelAnime, 1.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_FLUTTER); diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 711e5a039e..312f080d92 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -6,7 +6,6 @@ #include "z_en_tite.h" #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#include "objects/object_tite/object_tite.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200) @@ -132,17 +131,15 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -static s32 sTexturesDesegmented = false; -static Vec3f D_80896B64 = { 0.0f, 0.3f, 0.0f }; - void EnTite_Init(Actor* thisx, PlayState* play) { + static s32 sTexturesDesegmented = false; EnTite* this = THIS; s32 i; s32 j; Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_Init(play, &this->skelAnime, &object_tite_Skel_003A20, &object_tite_Anim_0012E4, this->jointTable, - this->morphTable, 25); + this->morphTable, OBJECT_TITE_LIMB_MAX); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 60.0f); Actor_SetFocus(&this->actor, 20.0f); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -236,7 +233,8 @@ void func_80893B70(EnTite* this) { } void func_80893BCC(EnTite* this, PlayState* play) { - Vec3f sp7C; + static Vec3f sAccel = { 0.0f, 0.3f, 0.0f }; + Vec3f pos; s32 i; s32 j; @@ -254,10 +252,10 @@ void func_80893BCC(EnTite* this, PlayState* play) { for (i = ENTITE_BODYPART_5; i < ENTITE_BODYPART_MAX; i++) { for (j = 0; j < 2; j++) { bodyPartPos = &this->bodyPartsPos[i]; - sp7C.x = bodyPartPos->x + Rand_CenteredFloat(1.0f); - sp7C.y = bodyPartPos->y + Rand_CenteredFloat(1.0f); - sp7C.z = bodyPartPos->z + Rand_CenteredFloat(1.0f); - func_800B0DE0(play, &sp7C, &gZeroVec3f, &D_80896B64, &D_80896B3C, &D_80896B40, + pos.x = bodyPartPos->x + Rand_CenteredFloat(1.0f); + pos.y = bodyPartPos->y + Rand_CenteredFloat(1.0f); + pos.z = bodyPartPos->z + Rand_CenteredFloat(1.0f); + func_800B0DE0(play, &pos, &gZeroVec3f, &sAccel, &D_80896B3C, &D_80896B40, (s32)Rand_ZeroFloat(16.0f) + 80, 15); } } @@ -909,9 +907,9 @@ void func_80895E28(EnTite* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y += 0x1E00; - sp44.x = (Math_SinS(this->actor.shape.rot.y) * 25.0f) + this->actor.world.pos.x; + sp44.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y) * 25.0f; sp44.y = this->actor.world.pos.y + 15.0f; - sp44.z = (Math_CosS(this->actor.shape.rot.y) * 25.0f) + this->actor.world.pos.z; + sp44.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y) * 25.0f; sp36 = BINANG_SUB(this->actor.shape.rot.y, 0x4000); @@ -1188,7 +1186,7 @@ void EnTite_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts2[limbIndex]]); } - if (limbIndex == 24) { + if (limbIndex == OBJECT_TITE_LIMB_18) { this->unk_2BA = -1; } } else if (sLimbToBodyParts2[limbIndex] != BODYPART_NONE) { diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.h b/src/overlays/actors/ovl_En_Tite/z_en_tite.h index 66fec66b39..a4902744a3 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.h +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.h @@ -2,12 +2,13 @@ #define Z_EN_TITE_H #include "global.h" +#include "objects/object_tite/object_tite.h" struct EnTite; typedef void (*EnTiteActionFunc)(struct EnTite*, PlayState*); -typedef enum { +typedef enum EnTiteParam { /* -4 */ ENTITE_MINUS_4 = -4, /* -3 */ ENTITE_MINUS_3, /* -2 */ ENTITE_MINUS_2, @@ -31,8 +32,8 @@ typedef enum EnTiteBodyPart { typedef struct EnTite { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[25]; - /* 0x21E */ Vec3s morphTable[25]; + /* 0x188 */ Vec3s jointTable[OBJECT_TITE_LIMB_MAX]; + /* 0x21E */ Vec3s morphTable[OBJECT_TITE_LIMB_MAX]; /* 0x2B4 */ EnTiteActionFunc actionFunc; /* 0x2B8 */ u8 unk_2B8; /* 0x2B9 */ u8 unk_2B9; diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 7b10a1aa40..a5b0fafb6e 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -7,7 +7,6 @@ #include "z_en_tk.h" #include "overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" -#include "objects/object_tk/object_tk.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) @@ -103,11 +102,28 @@ static u32 D_80AEF85C[] = { 0xFF000000, }; -static AnimationSpeedInfo D_80AEF868[] = { - { &object_tk_Anim_001FA8, 1.0f, ANIMMODE_LOOP, -10.0f }, { &object_tk_Anim_001FA8, 2.0f, ANIMMODE_LOOP, -10.0f }, - { &object_tk_Anim_0030A4, 1.0f, ANIMMODE_LOOP, -10.0f }, { &object_tk_Anim_001144, 1.0f, ANIMMODE_ONCE, -10.0f }, - { &object_tk_Anim_003724, 1.0f, ANIMMODE_ONCE, -10.0f }, { &object_tk_Anim_003FB8, 1.0f, ANIMMODE_LOOP, -10.0f }, - { &object_tk_Anim_0020C8, 1.0f, ANIMMODE_LOOP, -10.0f }, { &object_tk_Anim_003B10, 1.0f, ANIMMODE_LOOP, -10.0f }, +typedef enum EnTkAnimation { + /* -1 */ ENTK_ANIM_NONE = -1, + /* 0 */ ENTK_ANIM_0, + /* 1 */ ENTK_ANIM_1, + /* 2 */ ENTK_ANIM_2, + /* 3 */ ENTK_ANIM_3, + /* 4 */ ENTK_ANIM_4, + /* 5 */ ENTK_ANIM_5, + /* 6 */ ENTK_ANIM_6, + /* 7 */ ENTK_ANIM_7, + /* 8 */ ENTK_ANIM_MAX +} EnTkAnimation; + +static AnimationSpeedInfo sAnimationSpeedInfo[ENTK_ANIM_MAX] = { + { &object_tk_Anim_001FA8, 1.0f, ANIMMODE_LOOP, -10.0f }, // ENTK_ANIM_0 + { &object_tk_Anim_001FA8, 2.0f, ANIMMODE_LOOP, -10.0f }, // ENTK_ANIM_1 + { &object_tk_Anim_0030A4, 1.0f, ANIMMODE_LOOP, -10.0f }, // ENTK_ANIM_2 + { &object_tk_Anim_001144, 1.0f, ANIMMODE_ONCE, -10.0f }, // ENTK_ANIM_3 + { &object_tk_Anim_003724, 1.0f, ANIMMODE_ONCE, -10.0f }, // ENTK_ANIM_4 + { &object_tk_Anim_003FB8, 1.0f, ANIMMODE_LOOP, -10.0f }, // ENTK_ANIM_5 + { &object_tk_Anim_0020C8, 1.0f, ANIMMODE_LOOP, -10.0f }, // ENTK_ANIM_6 + { &object_tk_Anim_003B10, 1.0f, ANIMMODE_LOOP, -10.0f }, // ENTK_ANIM_7 }; static s32 D_80AEF8E8[2] = { 0, 0 }; @@ -146,48 +162,48 @@ void func_80AEC460(EnTk* this) { } } -f32 func_80AEC524(f32 arg0) { - f32 temp_f0; +f32 func_80AEC524(f32 animCurFrame) { + f32 lerp; f32 ret; - s32 temp_a0; - s32 temp_a1; + s32 index2; + s32 index1; - while ((arg0 >= ARRAY_COUNT(D_80AEF8F0)) || (arg0 < 0.0f)) { - if (arg0 >= ARRAY_COUNT(D_80AEF8F0)) { - arg0 -= ARRAY_COUNT(D_80AEF8F0); - } else if (arg0 < 0.0f) { - arg0 += ARRAY_COUNT(D_80AEF8F0); + while ((animCurFrame >= ARRAY_COUNT(D_80AEF8F0)) || (animCurFrame < 0.0f)) { + if (animCurFrame >= ARRAY_COUNT(D_80AEF8F0)) { + animCurFrame -= ARRAY_COUNT(D_80AEF8F0); + } else if (animCurFrame < 0.0f) { + animCurFrame += ARRAY_COUNT(D_80AEF8F0); } } - // temp_f0 always becomes 0 - temp_a1 = arg0; - temp_a0 = temp_a1 + 1; - temp_f0 = arg0 - temp_a1; + // lerp always becomes 0 + index1 = animCurFrame; + index2 = index1 + 1; + lerp = animCurFrame - index1; - if (arg0 != temp_a1) { - if (temp_a0 >= ARRAY_COUNT(D_80AEF8F0)) { - temp_a0 -= ARRAY_COUNT(D_80AEF8F0); - ret = (((D_80AEF8F0[temp_a0] + D_80AEF8F0[ARRAY_COUNT(D_80AEF8F0) - 1]) - D_80AEF8F0[temp_a1]) * temp_f0) + - D_80AEF8F0[temp_a1]; + if (index1 != animCurFrame) { + if (index2 >= ARRAY_COUNT(D_80AEF8F0)) { + index2 -= ARRAY_COUNT(D_80AEF8F0); + ret = LERPIMP_ALT(D_80AEF8F0[index1], D_80AEF8F0[index2] + D_80AEF8F0[ARRAY_COUNT(D_80AEF8F0) - 1], lerp); } else { - ret = ((D_80AEF8F0[temp_a0] - D_80AEF8F0[temp_a1]) * temp_f0) + D_80AEF8F0[temp_a1]; + ret = LERPIMP_ALT(D_80AEF8F0[index1], D_80AEF8F0[index2], lerp); } } else { - ret = D_80AEF8F0[temp_a1]; + ret = D_80AEF8F0[index1]; } return ret; } -void func_80AEC658(SkelAnime* skelAnime, f32 arg1, f32 arg2, f32* arg3, f32* arg4) { - static f32 D_80AEF9B4[] = { 0.95f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 1.25f, 1.48f, 1.68f, 1.77f, 1.88f, 1.88f, 1.84f, - 1.77f, 1.62f, 1.43f, 1.22f, 0.93f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.96f, 1.23f, 1.5f, - 1.66f, 1.79f, 1.88f, 1.89f, 1.88f, 1.81f, 1.67f, 1.46f, 1.24f }; +void func_80AEC658(SkelAnime* skelAnime, f32 animCurFrame, f32 arg2, f32* arg3, f32* arg4) { + static f32 D_80AEF9B4[] = { + 0.95f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, + 1.25f, 1.48f, 1.68f, 1.77f, 1.88f, 1.88f, 1.84f, 1.77f, 1.62f, 1.43f, 1.22f, 0.93f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.96f, 1.23f, + 1.5f, 1.66f, 1.79f, 1.88f, 1.89f, 1.88f, 1.81f, 1.67f, 1.46f, 1.24f, + }; *arg3 = D_80AEF9B4[(s32)skelAnime->curFrame] * 0.5f * skelAnime->playSpeed * arg2; - *arg4 = (func_80AEC524(skelAnime->curFrame) - func_80AEC524(arg1)) * arg2; + *arg4 = (func_80AEC524(skelAnime->curFrame) - func_80AEC524(animCurFrame)) * arg2; while (*arg4 < 0.0f) { *arg4 += D_80AEF8F0[(s32)skelAnime->animLength - 1] * arg2; @@ -220,11 +236,12 @@ void EnTk_Init(Actor* thisx, PlayState* play) { } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_tk_Skel_00B9E8, NULL, this->jointTable, this->morphTable, 18); + SkelAnime_InitFlex(play, &this->skelAnime, &object_tk_Skel_00B9E8, NULL, this->jointTable, this->morphTable, + OBJECT_TK_LIMB_MAX); Animation_Change(&this->skelAnime, &object_tk_Anim_0030A4, 1.0f, 0.0f, Animation_GetLastFrame(&object_tk_Anim_0030A4.common), ANIMMODE_LOOP, 0.0f); this->unk_318 = 0; - this->unk_2D4 = -1; + this->animIndex = ENTK_ANIM_NONE; Actor_SetScale(&this->actor, 0.01f); this->actor.targetMode = TARGET_MODE_1; this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -241,7 +258,7 @@ void EnTk_Init(Actor* thisx, PlayState* play) { this->actor.gravity = -1.0f; this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.flags |= ACTOR_FLAG_10; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_0, &this->animIndex); SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); switch (this->unk_2B0) { @@ -279,7 +296,7 @@ void EnTk_Destroy(Actor* thisx, PlayState* play) { void func_80AECA3C(EnTk* this, PlayState* play) { this->unk_316 = 0; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); this->actionFunc = func_80AECA90; } @@ -295,9 +312,9 @@ void func_80AECA90(EnTk* this, PlayState* play) { void func_80AECB0C(EnTk* this, PlayState* play) { this->actor.speed = 0.0f; - this->unk_3CC = 0xFF; + this->scheduleResult = 0xFF; this->unk_2DC = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_0, &this->animIndex); this->actionFunc = func_80AECB6C; } @@ -307,8 +324,8 @@ void func_80AECB6C(EnTk* this, PlayState* play) { s32 temp3; f32 sp48; f32 sp44; - ScheduleOutput sp34; - u8 temp4; + ScheduleOutput scheduleOutput; + u8 scheduleResult; this->actor.textId = 0; if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { @@ -325,11 +342,11 @@ void func_80AECB6C(EnTk* this, PlayState* play) { } if (this->unk_2CA & 0x10) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 5, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_5, &this->animIndex); sp48 = 1.0f; sp44 = 22.0f; } else { - func_80AEC658(&this->skelAnime, this->unk_320, 1.0f, &sp48, &sp44); + func_80AEC658(&this->skelAnime, this->animCurFrame, 1.0f, &sp48, &sp44); } temp2 = R_TIME_SPEED * sp44; @@ -341,25 +358,25 @@ void func_80AECB6C(EnTk* this, PlayState* play) { this->unk_2DC -= temp3; this->unk_2E0 += R_TIME_SPEED; - if (Schedule_RunScript(play, D_80AEF800, &sp34)) { - if ((this->unk_3CC != sp34.result) && !func_80AED354(this, play, &sp34)) { + if (Schedule_RunScript(play, D_80AEF800, &scheduleOutput)) { + if ((this->scheduleResult != scheduleOutput.result) && !func_80AED354(this, play, &scheduleOutput)) { return; } - temp4 = sp34.result; + scheduleResult = scheduleOutput.result; } else { - sp34.result = 0; - temp4 = sp34.result; + scheduleOutput.result = 0; + scheduleResult = scheduleOutput.result; } - if (!temp4 && (this->unk_3CC != 0)) { + if (!scheduleResult && (this->scheduleResult != 0)) { this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - } else if (temp4 && (this->unk_3CC == 0)) { + } else if (scheduleResult && (this->scheduleResult == 0)) { this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.draw = EnTk_Draw; } - this->unk_3CC = sp34.result; + this->scheduleResult = scheduleOutput.result; func_80AECE0C(this, play); if (this->unk_3CE & 8) { @@ -369,7 +386,7 @@ void func_80AECB6C(EnTk* this, PlayState* play) { } void func_80AECE0C(EnTk* this, PlayState* play) { - if (this->unk_3CC != 0) { + if (this->scheduleResult != 0) { //! FAKE: if (1) {} func_80AECE60(this, play); @@ -509,7 +526,7 @@ s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) { return false; } - if ((this->unk_3CC <= 0) && (this->unk_3CC != 0) && (this->timePathTimeSpeed >= 0)) { + if ((this->scheduleResult <= 0) && (this->scheduleResult != 0) && (this->timePathTimeSpeed >= 0)) { phi_a1 = sp1E; } else { phi_a1 = scheduleOutput->time0; @@ -526,7 +543,7 @@ s32 func_80AED38C(EnTk* this, PlayState* play, ScheduleOutput* scheduleOutput) { } void func_80AED4F8(EnTk* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); this->actionFunc = func_80AED610; } @@ -546,15 +563,16 @@ void func_80AED544(EnTk* this, PlayState* play) { } void func_80AED610(EnTk* this, PlayState* play) { - if ((this->unk_2D4 == 4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 7, &this->unk_2D4); + if ((this->animIndex == ENTK_ANIM_4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_7, &this->animIndex); } switch (Message_GetState(&play->msgCtx)) { case TEXT_STATE_NONE: if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer - 0x1555, 0x71C)) { if (Player_GetMask(play) == PLAYER_MASK_CAPTAIN) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 4, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_4, + &this->animIndex); Message_StartTextbox(play, 0x13FD, &this->actor); } else if (CURRENT_DAY != 2) { func_80AED544(this, play); @@ -580,7 +598,8 @@ void func_80AED610(EnTk* this, PlayState* play) { switch (play->msgCtx.currentTextId) { case 0x13FD: this->unk_2CA |= 0x10; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_0, + &this->animIndex); this->skelAnime.playSpeed = 10.0f; this->actionFunc = func_80AECB6C; break; @@ -616,12 +635,16 @@ void func_80AED610(EnTk* this, PlayState* play) { case 0x1411: case 0x1412: default: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_0, + &this->animIndex); this->actionFunc = func_80AECB6C; break; } } break; + + default: + break; } } @@ -629,11 +652,11 @@ void func_80AED898(EnTk* this, PlayState* play) { this->unk_316 = 0; this->actor.speed = 0.0f; if (this->unk_2CA & 0x1000) { - if ((this->unk_2D4 == 4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 7, &this->unk_2D4); + if ((this->animIndex == ENTK_ANIM_4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_7, &this->animIndex); } } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); } this->actionFunc = func_80AED940; } @@ -643,7 +666,7 @@ void func_80AED940(EnTk* this, PlayState* play) { Actor* actor; Vec3f sp44; - if ((this->unk_2D4 != 4) && (this->unk_2D4 != 7)) { + if ((this->animIndex != ENTK_ANIM_4) && (this->animIndex != ENTK_ANIM_7)) { s16 temp_v0 = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer) + 0x1555; if (ABS(temp_v0) < 0x1800) { @@ -662,8 +685,8 @@ void func_80AED940(EnTk* this, PlayState* play) { } } - if ((this->unk_2D4 == 4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 7, &this->unk_2D4); + if ((this->animIndex == ENTK_ANIM_4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_7, &this->animIndex); } if (!(this->unk_2CA & 0x40)) { @@ -704,7 +727,7 @@ void func_80AEDBEC(EnTk* this, PlayState* play) { this->actor.params = -1; this->csLength = 0; this->actor.speed = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); this->actionFunc = func_80AEDC4C; } @@ -719,7 +742,7 @@ void func_80AEDC4C(EnTk* this, PlayState* play) { void func_80AEDCBC(EnTk* this, PlayState* play) { this->actor.speed = 10.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 5, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_5, &this->animIndex); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_2EC); Math_Vec3f_Copy(&this->actor.prevPos, &this->unk_2EC); Math_Vec3s_Copy(&this->actor.world.rot, &this->unk_2F8); @@ -738,7 +761,7 @@ void func_80AEDD4C(EnTk* this, PlayState* play) { void func_80AEDDA0(EnTk* this, PlayState* play) { this->actor.speed = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); this->actor.flags |= ACTOR_FLAG_10000; this->unk_2CA |= 0x80; this->actionFunc = func_80AED940; @@ -768,12 +791,17 @@ void func_80AEDE10(EnTk* this, PlayState* play) { case 4: Message_StartTextbox(play, 0x140F, &this->actor); - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, + &this->animIndex); break; case 3: Message_StartTextbox(play, 0x1410, &this->actor); - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, + &this->animIndex); + break; + + default: break; } break; @@ -781,14 +809,17 @@ void func_80AEDE10(EnTk* this, PlayState* play) { case 2: this->unk_2E6 = 0x1414; break; + + default: + break; } this->actionFunc = func_80AEDF5C; } void func_80AEDF5C(EnTk* this, PlayState* play) { - if ((this->unk_2D4 == 4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 7, &this->unk_2D4); + if ((this->animIndex == ENTK_ANIM_4) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_7, &this->animIndex); } switch (Message_GetState(&play->msgCtx)) { @@ -804,9 +835,11 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { !Math_SmoothStepToS(&this->unk_31C, 0, 3, 0x71C, 10) && (this->actor.shape.rot.y == (s16)(this->actor.yawTowardsPlayer - 0x1555))) { if (this->unk_2E6 == 0x1404) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 4, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_4, + &this->animIndex); } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, + &this->animIndex); } Message_StartTextbox(play, this->unk_2E6, &this->actor); } @@ -815,12 +848,16 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { case 0x1414: Message_StartTextbox(play, this->unk_2E6, &this->actor); break; + + default: + break; } break; case TEXT_STATE_NEXT: case TEXT_STATE_CLOSING: case TEXT_STATE_FADING: + default: break; case TEXT_STATE_CHOICE: @@ -887,6 +924,9 @@ void func_80AEDF5C(EnTk* this, PlayState* play) { case 0x1414: func_80AECA3C(this, play); break; + + default: + break; } } break; @@ -943,7 +983,7 @@ void func_80AEE414(EnTk* this, PlayState* play) { void func_80AEE478(EnTk* this, PlayState* play) { this->unk_310 = 2; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 3, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_3, &this->animIndex); this->actionFunc = func_80AEE4D0; } @@ -1103,6 +1143,9 @@ void func_80AEEAD4(EnTk* this, PlayState* play) { case 4: func_80AEF1C4(this, play); break; + + default: + break; } this->unk_2D0 = sp24; } @@ -1136,7 +1179,7 @@ void func_80AEEB88(EnTk* this, PlayState* play) { } this->unk_2C6 = 100; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 1, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_1, &this->animIndex); this->unk_30C = func_80AEED38; } @@ -1177,10 +1220,10 @@ void func_80AEED38(EnTk* this, PlayState* play) { } if (this->unk_2CA & 0x200) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 1, &this->unk_2D4); - func_80AEC658(&this->skelAnime, this->unk_320, 1.0f, &this->actor.speed, &sp64); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_1, &this->animIndex); + func_80AEC658(&this->skelAnime, this->animCurFrame, 1.0f, &this->actor.speed, &sp64); } if (this->actor.speed > 0.5f) { @@ -1196,7 +1239,7 @@ void func_80AEED38(EnTk* this, PlayState* play) { } void func_80AEF048(EnTk* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 1, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_1, &this->animIndex); this->unk_30C = func_80AEF094; } @@ -1204,10 +1247,10 @@ void func_80AEF094(EnTk* this, PlayState* play) { f32 sp2C; if (this->unk_2CA & 0x200) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 1, &this->unk_2D4); - func_80AEC658(&this->skelAnime, this->unk_320, 1.0f, &this->actor.speed, &sp2C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_1, &this->animIndex); + func_80AEC658(&this->skelAnime, this->animCurFrame, 1.0f, &this->actor.speed, &sp2C); } if (this->actor.speed >= 0.5f) { @@ -1218,7 +1261,7 @@ void func_80AEF094(EnTk* this, PlayState* play) { void func_80AEF15C(EnTk* this, PlayState* play) { this->actor.speed = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); this->unk_30C = func_80AEF1B4; } @@ -1226,7 +1269,7 @@ void func_80AEF1B4(EnTk* this, PlayState* play) { } void func_80AEF1C4(EnTk* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); this->unk_30C = func_80AEF210; } @@ -1235,7 +1278,7 @@ void func_80AEF210(EnTk* this, PlayState* play) { void func_80AEF220(EnTk* this, PlayState* play) { this->actor.speed = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 2, &this->unk_2D4); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, ENTK_ANIM_2, &this->animIndex); this->unk_30C = func_80AEF278; } @@ -1256,10 +1299,10 @@ void func_80AEF2D8(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - this->unk_320 = this->skelAnime.curFrame; + this->animCurFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - if ((this->actor.draw != NULL) && ((this->unk_2D4 == 0) || (this->unk_2D4 == 1)) && + if ((this->actor.draw != NULL) && ((this->animIndex == ENTK_ANIM_0) || (this->animIndex == ENTK_ANIM_1)) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 24.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WALK); } @@ -1277,11 +1320,11 @@ void EnTk_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->unk_320 = this->skelAnime.curFrame; + this->animCurFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); func_80AEC460(this); - if (((this->unk_2D4 == 0) || (this->unk_2D4 == 1)) && + if (((this->animIndex == ENTK_ANIM_0) || (this->animIndex == ENTK_ANIM_1)) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 24.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_WALK); } @@ -1338,7 +1381,7 @@ void func_80AEF5F4(Actor* thisx, PlayState* play) { s32 EnTk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnTk* this = THIS; - if (limbIndex == 16) { + if (limbIndex == OBJECT_TK_LIMB_10) { rot->z += this->unk_31A; rot->y += this->unk_31C; } @@ -1351,11 +1394,11 @@ void EnTk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, if (this->unk_2B0 != 2) { switch (limbIndex) { - case 16: + case OBJECT_TK_LIMB_10: Matrix_MultZero(&this->actor.focus.pos); break; - case 14: + case OBJECT_TK_LIMB_0E: Matrix_MultVec3f(&D_80AEFA84, &this->unk_2B4); OPEN_DISPS(play->state.gfxCtx); @@ -1365,6 +1408,9 @@ void EnTk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, CLOSE_DISPS(play->state.gfxCtx); break; + + default: + break; } } } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.h b/src/overlays/actors/ovl_En_Tk/z_en_tk.h index 46e9b0b967..b6d2b12a04 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.h +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.h @@ -2,6 +2,7 @@ #define Z_EN_TK_H #include "global.h" +#include "objects/object_tk/object_tk.h" struct EnTk; @@ -17,8 +18,8 @@ typedef struct EnTk { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnTkActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ Vec3s jointTable[18]; - /* 0x244 */ Vec3s morphTable[18]; + /* 0x1D8 */ Vec3s jointTable[OBJECT_TK_LIMB_MAX]; + /* 0x244 */ Vec3s morphTable[OBJECT_TK_LIMB_MAX]; /* 0x2B0 */ s8 unk_2B0; /* 0x2B1 */ s8 switchFlag; /* 0x2B4 */ Vec3f unk_2B4; @@ -30,7 +31,7 @@ typedef struct EnTk { /* 0x2CA */ u16 unk_2CA; /* 0x2CC */ s16 unk_2CC; /* 0x2D0 */ s32 unk_2D0; - /* 0x2D4 */ s32 unk_2D4; + /* 0x2D4 */ s32 animIndex; /* 0x2D8 */ f32 unk_2D8; /* 0x2DC */ f32 unk_2DC; /* 0x2E0 */ s32 unk_2E0; @@ -47,12 +48,12 @@ typedef struct EnTk { /* 0x318 */ s16 unk_318; /* 0x31A */ s16 unk_31A; /* 0x31C */ s16 unk_31C; - /* 0x320 */ f32 unk_320; + /* 0x320 */ f32 animCurFrame; /* 0x324 */ Vec3f unk_324[6]; /* 0x36C */ s32 unk_36C; /* 0x370 */ UNK_TYPE1 unk370[0x58]; /* 0x3C8 */ Path* timePath; - /* 0x3CC */ u8 unk_3CC; + /* 0x3CC */ u8 scheduleResult; /* 0x3CE */ u16 unk_3CE; /* 0x3D0 */ s32 timePathTimeSpeed; /* 0x3D4 */ Vec3f timePathTargetPos; diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index d202b02c99..34a45376d9 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -5,7 +5,6 @@ */ #include "z_en_toto.h" -#include "objects/object_zm/object_zm.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) @@ -99,8 +98,20 @@ static EnTotoText D_80BA502C[] = { { 0, 0, 0x2AE1 }, { 0, 0, 0x2AE2 }, { 4, 0, 0x2AE3 }, { 4, 0, 0x2AE4 }, }; -static AnimationHeader* D_80BA5078[] = { &object_zm_Anim_0028B8, &object_zm_Anim_00B894, &object_zm_Anim_002F20, - &object_zm_Anim_00BC08 }; +typedef enum EnTotoAnimation { + /* 0 */ ENTOTO_ANIM_0, + /* 1 */ ENTOTO_ANIM_1, + /* 2 */ ENTOTO_ANIM_2, + /* 3 */ ENTOTO_ANIM_3, + /* 4 */ ENTOTO_ANIM_MAX +} EnTotoAnimation; + +static AnimationHeader* sAnimations[ENTOTO_ANIM_MAX] = { + &object_zm_Anim_0028B8, // ENTOTO_ANIM_0 + &object_zm_Anim_00B894, // ENTOTO_ANIM_1 + &object_zm_Anim_002F20, // ENTOTO_ANIM_2 + &object_zm_Anim_00BC08, // ENTOTO_ANIM_3 +}; static EnTotoText D_80BA5088[] = { { 5, 0, 0 }, { 6, 20, 0 }, { 7, 0, 0 }, { 8, 9, 0 }, { 9, 10, 0 }, { 1, 0, 0 }, { 10, 0, 0 }, @@ -149,7 +160,7 @@ static EnTotoActionFunc D_80BA51B8[] = { }; void func_80BA36C0(EnToto* this, PlayState* play, s32 index) { - this->unk2B7 = 0; + this->unk2B7 = false; this->actionFuncIndex = index; D_80BA501C[this->actionFuncIndex](this, play); } @@ -168,7 +179,7 @@ void EnToto_Init(Actor* thisx, PlayState* play) { this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; SkelAnime_InitFlex(play, &this->skelAnime, &object_zm_Skel_00A978, ((play->sceneId == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), - this->jointTable, this->morphTable, 18); + this->jointTable, this->morphTable, OBJECT_ZM_LIMB_MAX); func_80BA36C0(this, play, 0); this->actor.shape.rot.x = 0; } @@ -183,22 +194,22 @@ void func_80BA383C(EnToto* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime) && (this->actionFuncIndex == 1) && (this->skelAnime.animation != &object_zm_Anim_000C80)) { if ((play->msgCtx.currentTextId != 0x2A98) && (play->msgCtx.currentTextId != 0x2A99)) { - if ((this->unk2B4 & 1) || (Rand_ZeroOne() > 0.5f)) { - this->unk2B4 = (this->unk2B4 + 1) & 3; + if ((this->animIndex & 1) || (Rand_ZeroOne() > 0.5f)) { + this->animIndex = (this->animIndex + 1) & 3; } } - Animation_PlayOnce(&this->skelAnime, D_80BA5078[this->unk2B4]); + Animation_PlayOnce(&this->skelAnime, sAnimations[this->animIndex]); } func_800BBB74(&this->blinkInfo, 20, 80, 3); } void func_80BA3930(EnToto* this, PlayState* play) { - AnimationHeader* animationHeader = &object_zm_Anim_00C880; + AnimationHeader* anim = &object_zm_Anim_00C880; if (play->sceneId == SCENE_SONCHONOIE) { - animationHeader = &object_zm_Anim_003AA8; + anim = &object_zm_Anim_003AA8; } - Animation_MorphToLoop(&this->skelAnime, animationHeader, -4.0f); + Animation_MorphToLoop(&this->skelAnime, anim, -4.0f); } s32 func_80BA397C(EnToto* this, s16 arg1) { @@ -262,7 +273,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { void func_80BA3BFC(EnToto* this, PlayState* play) { if (play->sceneId == SCENE_SONCHONOIE) { Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_000C80, -4.0f); - this->unk2B4 = 0; + this->animIndex = ENTOTO_ANIM_0; } else { if (this->text->unk0 == 4) { Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_TOTO); @@ -297,12 +308,12 @@ void func_80BA3DBC(EnToto* this, PlayState* play) { Player* player; func_80BA383C(this, play); - if (this->unk2B7 == 0) { + if (!this->unk2B7) { if (!func_80BA4C44(this, play)) { return; } if ((this->text->unk1 != 0) && ENTOTO_WEEK_EVENT_FLAGS) { - this->unk2B7 = 1; + this->unk2B7 = true; return; } } else { @@ -637,9 +648,8 @@ s32 func_80BA4C0C(EnToto* this, PlayState* play) { } s32 func_80BA4C44(EnToto* this, PlayState* play) { - s32 ret; + s32 ret = D_80BA5174[this->text->unk0](this, play); - ret = D_80BA5174[this->text->unk0](this, play); if (ret != 0) { this->text += ret; return func_80BA4C0C(this, play); diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.h b/src/overlays/actors/ovl_En_Toto/z_en_toto.h index dbcec32cf5..11578cd238 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.h +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.h @@ -2,6 +2,7 @@ #define Z_EN_TOTO_H #include "global.h" +#include "objects/object_zm/object_zm.h" struct EnToto; @@ -28,15 +29,15 @@ typedef struct EnTotoUnkStruct2 { typedef struct EnToto { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[18]; - /* 0x1F4 */ Vec3s morphTable[18]; + /* 0x188 */ Vec3s jointTable[OBJECT_ZM_LIMB_MAX]; + /* 0x1F4 */ Vec3s morphTable[OBJECT_ZM_LIMB_MAX]; /* 0x260 */ BlinkInfo blinkInfo; /* 0x264 */ ColliderCylinder collider; /* 0x2B0 */ u8 actionFuncIndex; /* 0x2B1 */ u8 unk2B1; /* 0x2B2 */ s8 csId; /* 0x2B3 */ u8 unk2B3; - /* 0x2B4 */ u8 unk2B4; + /* 0x2B4 */ u8 animIndex; /* 0x2B5 */ u8 cueId; /* 0x2B6 */ u8 unk2B6; /* 0x2B7 */ u8 unk2B7; 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 949b765be3..4fa51f095d 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -64,30 +64,31 @@ void EnTrt_Blink(EnTrt* this); void EnTrt_OpenEyes2(EnTrt* this); void EnTrt_NodOff(EnTrt* this); -typedef enum { - /* 0 */ TRT_ANIM_IDLE, - /* 1 */ TRT_ANIM_HALF_AWAKE, - /* 2 */ TRT_ANIM_SLEEPING, - /* 3 */ TRT_ANIM_WAKE_UP, - /* 4 */ TRT_ANIM_SURPRISED, - /* 5 */ TRT_ANIM_HANDS_ON_COUNTER, - /* 6 */ TRT_ANIM_HOVER, - /* 7 */ TRT_ANIM_FLY_LOOK_AROUND, - /* 8 */ TRT_ANIM_FLY_DOWN, - /* 9 */ TRT_ANIM_FLY +typedef enum TrtAnimation { + /* 0 */ TRT_ANIM_IDLE, + /* 1 */ TRT_ANIM_HALF_AWAKE, + /* 2 */ TRT_ANIM_SLEEPING, + /* 3 */ TRT_ANIM_WAKE_UP, + /* 4 */ TRT_ANIM_SURPRISED, + /* 5 */ TRT_ANIM_HANDS_ON_COUNTER, + /* 6 */ TRT_ANIM_HOVER, + /* 7 */ TRT_ANIM_FLY_LOOK_AROUND, + /* 8 */ TRT_ANIM_FLY_DOWN, + /* 9 */ TRT_ANIM_FLY, + /* 10 */ TRT_ANIM_MAX } TrtAnimation; -static AnimationInfoS sAnimationInfo[] = { - { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +static AnimationInfoS sAnimationInfo[TRT_ANIM_MAX] = { + { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT_ANIM_IDLE + { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT_ANIM_HALF_AWAKE + { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT_ANIM_SLEEPING + { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT_ANIM_WAKE_UP + { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT_ANIM_SURPRISED + { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT_ANIM_HANDS_ON_COUNTER + { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT_ANIM_HOVER + { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT_ANIM_FLY_LOOK_AROUND + { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT_ANIM_FLY_DOWN + { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT_ANIM_FLY }; ActorInit En_Trt_InitVars = { @@ -111,16 +112,18 @@ static ShopItem sShop[] = { }; void EnTrt_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) { - f32 frameCount; + f32 endFrame; animationInfo += animIndex; + if (animationInfo->frameCount < 0) { - frameCount = Animation_GetLastFrame(animationInfo->animation); + endFrame = Animation_GetLastFrame(animationInfo->animation); } else { - frameCount = animationInfo->frameCount; + endFrame = animationInfo->frameCount; } - Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, - frameCount, animationInfo->mode, animationInfo->morphFrames); + + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, endFrame, + animationInfo->mode, animationInfo->morphFrames); } bool EnTrt_TestItemSelected(PlayState* play) { @@ -862,8 +865,8 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { this->blinkFunc = EnTrt_EyesClosed; this->timer = 45; this->actionFunc = EnTrt_BeginInteraction; - } else if ((player->actor.world.pos.x >= -50.0f && player->actor.world.pos.x <= -25.0f) && - (player->actor.world.pos.z >= -19.0f && player->actor.world.pos.z <= 30.0f)) { + } else if ((player->actor.world.pos.x >= -50.0f) && (player->actor.world.pos.x <= -25.0f) && + (player->actor.world.pos.z >= -19.0f) && (player->actor.world.pos.z <= 30.0f)) { Actor_OfferTalk(&this->actor, play, 200.0f); } if (DECR(this->timer) == 0) { @@ -879,7 +882,7 @@ void EnTrt_IdleAwake(EnTrt* this, PlayState* play) { void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { s16 curFrame = this->skelAnime.curFrame / this->skelAnime.playSpeed; - s16 animLastFrame = Animation_GetLastFrame(&gKotakeWakeUpAnim) / TRUNCF_BINANG(this->skelAnime.playSpeed); + s16 endFrame = Animation_GetLastFrame(&gKotakeWakeUpAnim) / TRUNCF_BINANG(this->skelAnime.playSpeed); if (this->cutsceneState == ENTRT_CUTSCENESTATE_WAITING) { if (CutsceneManager_IsNext(this->csId)) { @@ -890,7 +893,7 @@ void EnTrt_BeginInteraction(EnTrt* this, PlayState* play) { } } else if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { if (this->animIndex != TRT_ANIM_HANDS_ON_COUNTER) { - if (curFrame == animLastFrame) { + if (curFrame == endFrame) { EnTrt_ChangeAnim(&this->skelAnime, sAnimationInfo, TRT_ANIM_WAKE_UP); this->animIndex = TRT_ANIM_WAKE_UP; this->blinkFunc = EnTrt_OpenEyesThenSetToBlink; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index db0c0cfa12..fe9ac500ac 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -26,30 +26,31 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play); void func_80AD5234(EnTrt2* this, PlayState* play); void func_80AD56E8(Actor* thisx, PlayState* play); -typedef enum { - /* 0 */ TRT2_ANIM_IDLE, - /* 1 */ TRT2_ANIM_HALF_AWAKE, - /* 2 */ TRT2_ANIM_SLEEPING, - /* 3 */ TRT2_ANIM_WAKE_UP, - /* 4 */ TRT2_ANIM_SURPRISED, - /* 5 */ TRT2_ANIM_HANDS_ON_COUNTER, - /* 6 */ TRT2_ANIM_HOVER, - /* 7 */ TRT2_ANIM_FLY_LOOK_AROUND, - /* 8 */ TRT2_ANIM_FLY_DOWN, - /* 9 */ TRT2_ANIM_FLY +typedef enum Trt2Animation { + /* 0 */ TRT2_ANIM_IDLE, + /* 1 */ TRT2_ANIM_HALF_AWAKE, + /* 2 */ TRT2_ANIM_SLEEPING, + /* 3 */ TRT2_ANIM_WAKE_UP, + /* 4 */ TRT2_ANIM_SURPRISED, + /* 5 */ TRT2_ANIM_HANDS_ON_COUNTER, + /* 6 */ TRT2_ANIM_HOVER, + /* 7 */ TRT2_ANIM_FLY_LOOK_AROUND, + /* 8 */ TRT2_ANIM_FLY_DOWN, + /* 9 */ TRT2_ANIM_FLY, + /* 10 */ TRT2_ANIM_MAX } Trt2Animation; -static AnimationInfoS sAnimationInfo[] = { - { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +static AnimationInfoS sAnimationInfo[TRT2_ANIM_MAX] = { + { &gKotakeIdleAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT2_ANIM_IDLE + { &gKotakeHalfAwakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT2_ANIM_HALF_AWAKE + { &gKotakeSleepingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT2_ANIM_SLEEPING + { &gKotakeWakeUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT2_ANIM_WAKE_UP + { &gKotakeSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // TRT2_ANIM_SURPRISED + { &gKotakeHandsOnCounterAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT2_ANIM_HANDS_ON_COUNTER + { &gKotakeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT2_ANIM_HOVER + { &gKotakeFlyLookAroundAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT2_ANIM_FLY_LOOK_AROUND + { &gKotakeFlyDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT2_ANIM_FLY_DOWN + { &gKotakeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TRT2_ANIM_FLY }; ActorInit En_Trt2_InitVars = { @@ -716,7 +717,7 @@ s32 func_80AD4CCC(EnTrt2* this, PlayState* play) { } void func_80AD4DB4(EnTrt2* this, PlayState* play) { - static Vec3f D_80AD5904 = { 0.0f, 50.0f, 0.0 }; + static Vec3f D_80AD5904 = { 0.0f, 50.0f, 0.0f }; this->actor.flags &= ~ACTOR_FLAG_10; Actor_SetObjectDependency(play, &this->actor); diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index 89ba305efc..ff8829bf23 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -21,29 +21,8 @@ s32 func_80A8777C(Actor* thisx, PlayState* play); s32 func_80A87880(Actor* thisx, PlayState* play); s32 func_80A87B48(Actor* thisx, PlayState* play); s32 func_80A87DC0(Actor* thisx, PlayState* play); -void func_80A87FD0(EnTru* this, PlayState* play); void func_80A881E0(EnTru* this, PlayState* play); -typedef enum { - /* 0x00 */ KOUME_ANIM_INJURED_LYING_DOWN, - /* 0x01 */ KOUME_ANIM_INJURED_LYING_DOWN_MORPH, - /* 0x02 */ KOUME_ANIM_TRY_GET_UP, - /* 0x03 */ KOUME_ANIM_INJURED_RAISE_HEAD, - /* 0x04 */ KOUME_ANIM_INJURED_TALK, - /* 0x05 */ KOUME_ANIM_INJURED_HEAD_UP, - /* 0x06 */ KOUME_ANIM_INJURED_HEAD_UP_MORPH, - /* 0x07 */ KOUME_ANIM_TAKE, - /* 0x08 */ KOUME_ANIM_SHAKE, // Unused - /* 0x09 */ KOUME_ANIM_DRINK, - /* 0x0A */ KOUME_ANIM_FINISHED_DRINKING, - /* 0x0B */ KOUME_ANIM_HEALED, - /* 0x0C */ KOUME_ANIM_HOVER1, - /* 0x0D */ KOUME_ANIM_TAKE_OFF, - /* 0x0E */ KOUME_ANIM_FLY, - /* 0x0F */ KOUME_ANIM_HOVER2, - /* 0x10 */ KOUME_ANIM_MAX -} KoumeAnimation; - static MsgScript D_80A88910[] = { /* 0x0000 0x03 */ MSCRIPT_CMD_BEGIN_TEXT(0x0852), /* 0x0003 0x01 */ MSCRIPT_CMD_AWAIT_TEXT(), @@ -194,29 +173,44 @@ static ColliderSphereInit sSphereInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 20, 0, 0, MASS_IMMOVABLE }; -static AnimationInfoS sAnimationInfo[] = { - { &gKoumeInjuredLyingDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKoumeInjuredLyingDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gKoumeTryGetUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gKoumeInjuredRaiseHeadAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKoumeInjuredTalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gKoumeInjuredHeadUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKoumeInjuredHeadUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gKoumeTakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKoumeShakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gKoumeDrinkAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gKoumeFinishedDrinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - { &gKoumeHealedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gKoumeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKoumeTakeOffAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, - { &gKoumeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - { &gKoumeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, -}; +typedef enum KoumeAnimation { + /* 0x00 */ KOUME_ANIM_INJURED_LYING_DOWN, + /* 0x01 */ KOUME_ANIM_INJURED_LYING_DOWN_MORPH, + /* 0x02 */ KOUME_ANIM_TRY_GET_UP, + /* 0x03 */ KOUME_ANIM_INJURED_RAISE_HEAD, + /* 0x04 */ KOUME_ANIM_INJURED_TALK, + /* 0x05 */ KOUME_ANIM_INJURED_HEAD_UP, + /* 0x06 */ KOUME_ANIM_INJURED_HEAD_UP_MORPH, + /* 0x07 */ KOUME_ANIM_TAKE, + /* 0x08 */ KOUME_ANIM_SHAKE, // Unused + /* 0x09 */ KOUME_ANIM_DRINK, + /* 0x0A */ KOUME_ANIM_FINISHED_DRINKING, + /* 0x0B */ KOUME_ANIM_HEALED, + /* 0x0C */ KOUME_ANIM_HOVER1, + /* 0x0D */ KOUME_ANIM_TAKE_OFF, + /* 0x0E */ KOUME_ANIM_FLY, + /* 0x0F */ KOUME_ANIM_HOVER2, + /* 0x10 */ KOUME_ANIM_MAX +} KoumeAnimation; -static Vec3f D_80A8B3D8 = { 0.0f, 24.0f, 16.0f }; -static Vec3f D_80A8B3E4 = { 0.0f, -3.0f, 3.0f }; -static Vec3f D_80A8B3F0 = { 0.0f, 0.5f, 0.0f }; -static Vec3f D_80A8B3FC = { 3000.0f, -800.0f, 0.0f }; +static AnimationInfoS sAnimationInfo[KOUME_ANIM_MAX] = { + { &gKoumeInjuredLyingDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // KOUME_ANIM_INJURED_LYING_DOWN + { &gKoumeInjuredLyingDownAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // KOUME_ANIM_INJURED_LYING_DOWN_MORPH + { &gKoumeTryGetUpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // KOUME_ANIM_TRY_GET_UP + { &gKoumeInjuredRaiseHeadAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // KOUME_ANIM_INJURED_RAISE_HEAD + { &gKoumeInjuredTalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // KOUME_ANIM_INJURED_TALK + { &gKoumeInjuredHeadUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // KOUME_ANIM_INJURED_HEAD_UP + { &gKoumeInjuredHeadUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // KOUME_ANIM_INJURED_HEAD_UP_MORPH + { &gKoumeTakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // KOUME_ANIM_TAKE + { &gKoumeShakeAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // KOUME_ANIM_SHAKE + { &gKoumeDrinkAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // KOUME_ANIM_DRINK + { &gKoumeFinishedDrinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // KOUME_ANIM_FINISHED_DRINKING + { &gKoumeHealedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // KOUME_ANIM_HEALED + { &gKoumeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // KOUME_ANIM_HOVER1 + { &gKoumeTakeOffAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // KOUME_ANIM_TAKE_OFF + { &gKoumeFlyAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // KOUME_ANIM_FLY + { &gKoumeHoverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // KOUME_ANIM_HOVER2 +}; void func_80A85620(EnTruUnkStruct* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { s16 i; @@ -461,6 +455,9 @@ s32 func_80A86460(EnTru* this) { } s32 func_80A86674(EnTru* this) { + static Vec3f D_80A8B3D8 = { 0.0f, 24.0f, 16.0f }; + static Vec3f D_80A8B3E4 = { 0.0f, -3.0f, 3.0f }; + static Vec3f D_80A8B3F0 = { 0.0f, 0.5f, 0.0f }; s32 pad; Vec3f sp40; Vec3f sp34; @@ -1248,6 +1245,7 @@ void EnTru_Update(Actor* thisx, PlayState* play) { } s32 EnTru_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + static Vec3f D_80A8B3FC = { 3000.0f, -800.0f, 0.0f }; s32 pad; EnTru* this = THIS; diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index a64532085c..438257575c 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -97,6 +97,9 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) { this->actor.textId = 0x108A; } break; + + default: + break; } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_GREAT_BAY_TEMPLE)) { @@ -500,9 +503,15 @@ void func_80AE0704(EnTsn* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_TALK; this->actionFunc = func_80AE04C4; break; + + default: + break; } } break; + + default: + break; } if (this->unk_220 & 2) { @@ -599,12 +608,12 @@ s32 EnTsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p EnTsn* this = THIS; s16 shifted = this->headRot.x >> 1; - if (limbIndex == 15) { + if (limbIndex == OBJECT_TSN_LIMB_0F) { rot->x += this->headRot.y; rot->z += shifted; } - if (limbIndex == 8) { + if (limbIndex == OBJECT_TSN_LIMB_08) { rot->x += this->torsoRot.y; rot->z += shifted; } @@ -615,7 +624,7 @@ void EnTsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnTsn* this = THIS; Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - if (limbIndex == 15) { + if (limbIndex == OBJECT_TSN_LIMB_0F) { Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index e736c1c413..a811ee8bd5 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -826,7 +826,7 @@ void func_80991C04(EnWf* this) { void func_80991C80(EnWf* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 sp30; - s32 sp2C; + s32 onAnim15thFrame; s16 sp2A; sp2A = BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y); @@ -843,15 +843,16 @@ void func_80991C80(EnWf* this, PlayState* play) { this->collider1.base.atFlags &= ~AT_ON; } - sp2C = Animation_OnFrame(&this->skelAnime, 15.0f); - if (((sp2C != 0) && !Actor_IsTargeted(play, &this->actor) && + onAnim15thFrame = Animation_OnFrame(&this->skelAnime, 15.0f); + + if ((onAnim15thFrame && !Actor_IsTargeted(play, &this->actor) && (!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) || SkelAnime_Update(&this->skelAnime)) { - if ((sp2C == 0) && (this->unk_2A0 != 0)) { + if (!onAnim15thFrame && (this->unk_2A0 != 0)) { this->actor.shape.rot.y += TRUNCF_BINANG(0xCCC * (1.5f + ((this->unk_2A0 - 4) * 0.4f))); func_80990C6C(this, play, 1); this->unk_2A0--; - } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (sp2C == 0)) { + } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && !onAnim15thFrame) { func_80991200(this); this->unk_2A0 = (s32)Rand_ZeroFloat(5.0f) + 5; if (sp30 >= 0x32C9) { diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index 42deb99164..c003f0cc28 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -75,7 +75,7 @@ static PlayerAnimationHeader* gPlayerAnimations[] = { static Vec3f D_80BFB2E8 = { 0.0f, 0.5f, 0.0f }; -static Vec3f D_80BFB2F4 = { 500.0f, -500.0, 0.0f }; +static Vec3f D_80BFB2F4 = { 500.0f, -500.0f, 0.0f }; static Vec3f D_80BFB300 = { 500.0f, -500.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 770ecd6ef2..9bbd3c817d 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -1160,7 +1160,7 @@ void func_80B98CA8(EnZot* this, PlayState* play) { } if ((GET_PLAYER_FORM == PLAYER_FORM_ZORA) || (this->actor.xzDistToPlayer < 100.0f)) { - func_800B874C(&this->actor, play, 120.0, 100.0f); + func_800B874C(&this->actor, play, 120.0f, 100.0f); } } diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index f5cca739ba..f46710fb25 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -592,7 +592,7 @@ void func_809381C4(ObjBean* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - if (this->dyna.actor.csId >= 0) { + if (this->dyna.actor.csId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_1); } this->unk_1E4 = 2; @@ -749,7 +749,7 @@ void func_8093876C(ObjBean* this) { void func_80938780(ObjBean* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - if (this->dyna.actor.csId >= 0) { + if (this->dyna.actor.csId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_1); } this->unk_1B4 = 36; diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 6bc2823a5d..67bd2fd2d4 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -493,7 +493,7 @@ void func_8098E0B8(ObjComb* this, PlayState* play) { return; } - if ((this->unk_1B4 == 10) && (this->unk_1B6 != 0) && (this->unk_1B5 == 2) && (this->actor.csId >= 0)) { + if ((this->unk_1B4 == 10) && (this->unk_1B6 != 0) && (this->unk_1B5 == 2) && (this->actor.csId > CS_ID_NONE)) { if (CutsceneManager_GetCurrentCsId() == this->actor.csId) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_4); } diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index 36f8186d9e..e7f4746bbd 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -64,8 +64,8 @@ static s16 sObjectIds[] = { * When these small oscillations happen, the game determines how to scale the appropriate * axes by using this table. */ -static f32 oscillationTable[] = { - -1.0, -1.0, -1.0, -0.7, 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, -1.0, -0.7, 0.0, 0.7, 1.0, 0.7, 0.0, -0.7, +static f32 sOscillationTable[] = { + -1.0f, -1.0f, -1.0f, -0.7f, 0.0f, 0.7f, 1.0f, 0.7f, 0.0f, -0.7f, -1.0f, -0.7f, 0.0f, 0.7f, 1.0f, 0.7f, 0.0f, -0.7f, }; void ObjEtcetera_Init(Actor* thisx, PlayState* play) { @@ -115,7 +115,7 @@ void ObjEtcetera_DoNormalOscillation(ObjEtcetera* this, PlayState* play) { s32 requiredScopeTemp; Actor_SetScale(&this->dyna.actor, - (oscillationTable[play->gameplayFrames % 18] * (0.0001f * this->oscillationTimer)) + 0.01f); + (sOscillationTable[play->gameplayFrames % 18] * (0.0001f * this->oscillationTimer)) + 0.01f); this->dyna.actor.scale.y = 0.02f; this->oscillationTimer--; } else { diff --git a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c index 5f15c41cf1..e603aa563e 100644 --- a/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c +++ b/src/overlays/actors/ovl_Obj_Hunsui/z_obj_hunsui.c @@ -585,9 +585,9 @@ void func_80B9D714(ObjHunsui* this, PlayState* play) { csId = this->dyna.actor.csId; if (this->unk_16E == 0) { - if ((csId >= 0) && !CutsceneManager_IsNext(csId)) { + if ((csId > CS_ID_NONE) && !CutsceneManager_IsNext(csId)) { CutsceneManager_Queue(csId); - } else if (csId >= 0) { + } else if (csId > CS_ID_NONE) { CutsceneManager_StartWithPlayerCs(csId, &this->dyna.actor); this->unk_16E = -1; } else { 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 b9f2bdc440..439ac4754f 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -1223,7 +1223,7 @@ void func_80A25FD4(ObjIceblock* this, PlayState* play) { } void func_80A260E8(ObjIceblock* this) { - static f32 D_80A26FC0[] = { 14.0, -14.0, 14.0, -14.0 }; + static f32 D_80A26FC0[] = { 14.0f, -14.0f, 14.0f, -14.0f }; this->unk_260 = D_80A26FC0[this->unk_26C]; this->unk_25C = 0.0f; diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 0c17f934f9..d3fb818ef3 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -128,7 +128,7 @@ void ObjMakekinsuta_Update(Actor* thisx, PlayState* play) { void func_8099FD7C(Actor* thisx, PlayState* play) { if (CutsceneManager_IsNext(thisx->csId)) { CutsceneManager_StartWithPlayerCs(thisx->csId, thisx); - if (thisx->csId >= 0) { + if (thisx->csId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(play, thisx, PLAYER_CSACTION_4); } func_8099FB64(thisx, play); diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 28b715f1c2..ce1804e1a0 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -678,7 +678,7 @@ void func_80B30A2C(ObjSpidertent* this) { void func_80B30A4C(ObjSpidertent* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - if (this->dyna.actor.csId >= 0) { + if (this->dyna.actor.csId > CS_ID_NONE) { Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_1); } Flags_SetSwitch(play, OBJSPIDERTENT_GET_SWITCH_FLAG(&this->dyna.actor)); diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 118cf48f40..a34d8e6a8d 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -866,7 +866,7 @@ void ObjSwitch_LargeFloorSwitchPushDownInit(ObjSwitch* this) { void ObjSwitch_LargeFloorSwitchPushDown(ObjSwitch* this, PlayState* play) { this->dyna.actor.scale.y -= 0.074250005f; - if (this->dyna.actor.scale.y <= 33.0f / 2000.0f) { + if (this->dyna.actor.scale.y <= (33.0f / 2000.0f)) { ObjSwitch_PlayFootSwitchSfx(this); Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); ObjSwitch_StopCutscene(this); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index fd11eb3255..d780ba3da4 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -241,7 +241,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { if (groupSize == 0) { if ((type == OBJ_SYOKUDAI_TYPE_NO_SWITCH) && (switchFlag == OBJ_SYOKUDAI_SWITCH_FLAG_NONE)) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; - } else if (thisx->csId >= 0) { + } else if (thisx->csId > CS_ID_NONE) { this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH; } else { Flags_SetSwitch(play, switchFlag); diff --git a/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c b/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c index cf04be0808..02e0977f5b 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Turret/z_obj_tokei_turret.c @@ -51,7 +51,7 @@ void ObjTokeiTurret_Init(Actor* thisx, PlayState* play) { DynaPolyActor_LoadMesh(play, &this->dyna, &gClockTownTurretPlatformCol); } } else { - this->dyna.actor.uncullZoneDownward = this->dyna.actor.uncullZoneScale = 1300.0; + this->dyna.actor.uncullZoneDownward = this->dyna.actor.uncullZoneScale = 1300.0f; } } diff --git a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c index 3d5f1265c5..1a7408ea19 100644 --- a/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c +++ b/src/overlays/actors/ovl_Obj_Y2shutter/z_obj_y2shutter.c @@ -108,9 +108,9 @@ void ObjY2shutter_Update(Actor* thisx, PlayState* play) { s16 csId = this->dyna.actor.csId; if (this->openTimer == 0) { - if ((csId >= 0) && !CutsceneManager_IsNext(csId)) { + if ((csId > CS_ID_NONE) && !CutsceneManager_IsNext(csId)) { CutsceneManager_Queue(csId); - } else if (csId >= 0) { + } else if (csId > CS_ID_NONE) { CutsceneManager_StartWithPlayerCs(csId, &this->dyna.actor); this->openTimer = -1; } else { diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index 4ec6e05aab..d72980ec27 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -189,7 +189,7 @@ void OceffStorm_Draw2(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, scroll * 8, scroll * 4, 64, 64, 1, scroll * 4, scroll * 4, 64, 64)); gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH << 2, SCREEN_HEIGHT << 2, G_TX_RENDERTILE, 0, 0, - (s32)(0.13671875 * (1 << 10)), (s32)(-0.13671875 * (1 << 10))); + (s32)(0.13671875f * (1 << 10)), (s32)(-0.13671875f * (1 << 10))); CLOSE_DISPS(play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 358f503942..c71e340203 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -747,9 +747,6 @@ void Player_RequestRumble(PlayState* play, Player* this, s32 sourceIntensity, s3 } } -// TODO: less dumb name -#define SFX_VOICE_BANK_SIZE 0x20 - PlayerAgeProperties sPlayerAgeProperties[PLAYER_FORM_MAX] = { { // ceilingCheckHeight diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index dce154a10d..78dfb64119 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -5878,7 +5878,7 @@ 0x80896B44:("D_80896B44","UNK_TYPE1","",0x1), 0x80896B50:("D_80896B50","UNK_TYPE1","",0x1), 0x80896B60:("sTexturesDesegmented","UNK_TYPE4","",0x4), - 0x80896B64:("D_80896B64","UNK_TYPE1","",0x1), + 0x80896B64:("sAccel","UNK_TYPE1","",0x1), 0x80896B70:("D_80896B70","UNK_TYPE1","",0x1), 0x80896B8C:("D_80896B8C","UNK_TYPE1","",0x1), 0x80896BA4:("D_80896BA4","UNK_TYPE1","",0x1), @@ -13032,7 +13032,7 @@ 0x80AEF800:("D_80AEF800","UNK_TYPE1","",0x1), 0x80AEF810:("En_Tk_InitVars","UNK_TYPE1","",0x1), 0x80AEF830:("D_80AEF830","UNK_TYPE1","",0x1), - 0x80AEF868:("D_80AEF868","UNK_TYPE1","",0x1), + 0x80AEF868:("sAnimationSpeedInfo","UNK_TYPE1","",0x1), 0x80AEF8EC:("D_80AEF8EC","UNK_TYPE1","",0x1), 0x80AEF8F0:("D_80AEF8F0","UNK_TYPE1","",0x1), 0x80AEF9B4:("D_80AEF9B4","f32","[49]",0xC4), @@ -15129,7 +15129,7 @@ 0x80BA5048:("D_80BA5048","UNK_TYPE1","",0x1), 0x80BA5068:("D_80BA5068","UNK_TYPE1","",0x1), 0x80BA5074:("D_80BA5074","UNK_TYPE1","",0x1), - 0x80BA5078:("D_80BA5078","UNK_TYPE1","",0x1), + 0x80BA5078:("sAnimations","UNK_TYPE1","",0x1), 0x80BA5088:("D_80BA5088","UNK_TYPE1","",0x1), 0x80BA50BC:("D_80BA50BC","UNK_TYPE1","",0x1), 0x80BA50DC:("D_80BA50DC","UNK_TYPE1","",0x1), @@ -15270,8 +15270,8 @@ 0x80BB8170:("D_80BB8170","UNK_TYPE1","",0x1), 0x80BB8190:("D_80BB8190","UNK_TYPE1","",0x1), 0x80BB81BC:("D_80BB81BC","UNK_TYPE1","",0x1), - 0x80BB81E8:("D_80BB81E8","UNK_TYPE1","",0x1), - 0x80BB81EC:("D_80BB81EC","UNK_TYPE1","",0x1), + 0x80BB81E8:("sPrimColor","UNK_TYPE1","",0x1), + 0x80BB81EC:("sEnvColor","UNK_TYPE1","",0x1), 0x80BB81F0:("D_80BB81F0","f32","",0x4), 0x80BB81F4:("D_80BB81F4","f32","",0x4), 0x80BB81F8:("D_80BB81F8","f32","",0x4),