From a448168d372113e6251afba25153f2065a4caabf Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sat, 23 Nov 2024 12:04:34 +1100 Subject: [PATCH] Player Docs: Rename Init Mode to Start Mode (#1744) * rename to start mode * cleanup * rm declarations --- include/z64player.h | 51 ++++---- src/code/z_player_lib.c | 2 +- src/code/z_scene.c | 6 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 2 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 2 +- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 6 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 4 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 2 +- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 2 +- .../actors/ovl_En_Warp_tag/z_en_warp_tag.c | 4 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 10 +- .../actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c | 2 +- .../actors/ovl_player_actor/z_player.c | 120 ++++++++---------- tools/disasm/functions.txt | 28 ++-- tools/disasm/variables.txt | 4 +- 16 files changed, 114 insertions(+), 133 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index 4b73455057..d511845ecd 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -13,6 +13,31 @@ struct Player; struct PlayState; +#define PLAYER_GET_BG_CAM_INDEX(thisx) ((thisx)->params & 0xFF) +#define PLAYER_GET_START_MODE(thisx) (((thisx)->params & 0xF00) >> 8) + +typedef enum PlayerStartMode { + /* 0x0 */ PLAYER_START_MODE_0, + /* 0x1 */ PLAYER_START_MODE_1, // Spawning after pulling/putting-back Master sword // OoT leftover + /* 0x2 */ PLAYER_START_MODE_2, + /* 0x3 */ PLAYER_START_MODE_3, + /* 0x4 */ PLAYER_START_MODE_4, + /* 0x5 */ PLAYER_START_MODE_5, + /* 0x6 */ PLAYER_START_MODE_6, + /* 0x7 */ PLAYER_START_MODE_7, + /* 0x8 */ PLAYER_START_MODE_8, + /* 0x9 */ PLAYER_START_MODE_9, + /* 0xA */ PLAYER_START_MODE_A, + /* 0xB */ PLAYER_START_MODE_B, + /* 0xC */ PLAYER_START_MODE_TELESCOPE, + /* 0xD */ PLAYER_START_MODE_D, + /* 0xE */ PLAYER_START_MODE_E, + /* 0xF */ PLAYER_START_MODE_F, + /* 0x10 */ PLAYER_START_MODE_MAX // Must not exceed 0x10 as `PLAYER_GET_START_MODE` is limited to a nibble in player params +} PlayerStartMode; + +#define PLAYER_PARAMS(startBgCamIndex, startMode) ((startBgCamIndex & 0xFF) | ((startMode & 0xF) << 8)) + typedef enum PlayerShield { /* 0 */ PLAYER_SHIELD_NONE, /* 1 */ PLAYER_SHIELD_HEROS_SHIELD, @@ -1074,32 +1099,6 @@ typedef enum PlayerCueId { // Currently locked onto a hostile actor. Triggers a "battle" variant of many actions. #define PLAYER_STATE3_HOSTILE_LOCK_ON (1 << 31) - -#define PLAYER_GET_BG_CAM_INDEX(thisx) ((thisx)->params & 0xFF) -#define PLAYER_GET_INITMODE(thisx) (((thisx)->params & 0xF00) >> 8) - -typedef enum PlayerInitMode { - /* 0x0 */ PLAYER_INITMODE_0, - /* 0x1 */ PLAYER_INITMODE_1, // Spawning after pulling/putting-back Master sword // OoT leftover - /* 0x2 */ PLAYER_INITMODE_2, - /* 0x3 */ PLAYER_INITMODE_3, - /* 0x4 */ PLAYER_INITMODE_4, - /* 0x5 */ PLAYER_INITMODE_5, - /* 0x6 */ PLAYER_INITMODE_6, - /* 0x7 */ PLAYER_INITMODE_7, - /* 0x8 */ PLAYER_INITMODE_8, - /* 0x9 */ PLAYER_INITMODE_9, - /* 0xA */ PLAYER_INITMODE_A, - /* 0xB */ PLAYER_INITMODE_B, - /* 0xC */ PLAYER_INITMODE_TELESCOPE, - /* 0xD */ PLAYER_INITMODE_D, - /* 0xE */ PLAYER_INITMODE_E, - /* 0xF */ PLAYER_INITMODE_F, - /* 0x10 */ PLAYER_INITMODE_MAX // Must not exceed 0x10 as `PLAYER_GET_INITMODE` is limited to a nibble in player params -} PlayerInitMode; - -#define PLAYER_PARAMS(startBgCamIndex, initMode) ((startBgCamIndex & 0xFF) | ((initMode & 0xF) << 8)) - typedef enum PlayerUnkAA5 { /* 0 */ PLAYER_UNKAA5_0, /* 1 */ PLAYER_UNKAA5_1, diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 55f89a3eb6..ce3ba3c87a 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -80,7 +80,7 @@ void func_80127B64(struct_801F58B0 arg0[], s32 count, Vec3f* arg2); s32 func_801226E0(PlayState* play, s32 arg1) { if (arg1 == 0) { - Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B)); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B)); if (play->sceneId == SCENE_KAKUSIANA) { return 1; } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 6249163578..921031bf0d 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -162,9 +162,9 @@ void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { play->linkActorEntry = (ActorEntry*)Lib_SegmentedToVirtual(cmd->spawnList.segment) + play->setupEntranceList[play->curSpawn].spawn; - if ((PLAYER_GET_INITMODE(play->linkActorEntry) == PLAYER_INITMODE_TELESCOPE) || - ((gSaveContext.respawnFlag == 2) && - (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE)))) { + if ((PLAYER_GET_START_MODE(play->linkActorEntry) == PLAYER_START_MODE_TELESCOPE) || + ((gSaveContext.respawnFlag == 2) && (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_TELESCOPE)))) { // Skull Kid Object Object_SpawnPersistent(&play->objectCtx, OBJECT_STK); return; 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 e3dbf1cfa2..15a9b25737 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -141,7 +141,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { } else { s32 destinationIdx = DOORANA_GET_ENTRANCE(&this->actor); - Play_SetupRespawnPoint(play, RESPAWN_MODE_UNK_3, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_4)); + Play_SetupRespawnPoint(play, RESPAWN_MODE_UNK_3, PLAYER_PARAMS(0xFF, PLAYER_START_MODE_4)); gSaveContext.respawn[RESPAWN_MODE_UNK_3].pos.y = this->actor.world.pos.y; gSaveContext.respawn[RESPAWN_MODE_UNK_3].yaw = this->actor.home.rot.y; 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 9f129fc133..9b022157af 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -953,7 +953,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { player = GET_PLAYER(play); Play_SetRespawnData(play, RESPAWN_MODE_DOWN, Entrance_CreateFromSpawn(0), player->unk_3CE, - PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B), &player->unk_3C0, player->unk_3CC); func_80169EFC(play); if ((CURRENT_TIME > CLOCK_TIME(18, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 0))) { diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index e01bc7bba7..ffbba017f1 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -454,7 +454,7 @@ void EnTest4_HandleEvents(EnTest4* this, PlayState* play) { // Turn day with DayTelop cutscene gSaveContext.screenScale = 0.0f; Play_SetRespawnData(play, RESPAWN_MODE_DOWN, Entrance_CreateFromSpawn(0), player->unk_3CE, - PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B), &player->unk_3C0, player->unk_3CC); func_80169EFC(play); if (player->stateFlags1 & PLAYER_STATE1_800000) { EnHorse* rideActor = (EnHorse*)player->rideActor; @@ -507,9 +507,9 @@ void EnTest4_HandleEvents(EnTest4* this, PlayState* play) { u32 entrance = gSaveContext.save.entrance; if (play->actorCtx.flags & ACTORCTX_FLAG_TELESCOPE_ON) { - playerParams = PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE); + playerParams = PLAYER_PARAMS(0xFF, PLAYER_START_MODE_TELESCOPE); } else { - playerParams = PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B); + playerParams = PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B); } Play_SetRespawnData(play, RESPAWN_MODE_RETURN, entrance, player->unk_3CE, playerParams, diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index ccacd76cd8..787722135b 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -1082,7 +1082,7 @@ void EnTest6_SharedSoTCutscene(EnTest6* this, PlayState* play) { case SOTCS_CUEID_DOUBLE_END: Play_SetRespawnData(play, RESPAWN_MODE_RETURN, ((void)0, gSaveContext.save.entrance), player->unk_3CE, - PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B), &player->unk_3C0, player->unk_3CC); this->drawType = SOTCS_DRAW_TYPE_NONE; play->transitionTrigger = TRANS_TRIGGER_START; play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; @@ -1164,7 +1164,7 @@ void EnTest6_SharedSoTCutscene(EnTest6* this, PlayState* play) { case SOTCS_CUEID_DOUBLE_END: if (CURRENT_TIME > CLOCK_TIME(12, 0)) { Play_SetRespawnData(play, RESPAWN_MODE_RETURN, ((void)0, gSaveContext.save.entrance), - player->unk_3CE, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, + player->unk_3CE, PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B), &player->unk_3C0, player->unk_3CC); this->drawType = SOTCS_DRAW_TYPE_NONE; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index b70c348323..d45a51329e 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -662,7 +662,7 @@ void EnTest7_WarpCsWarp(EnTest7* this, PlayState* play) { } else if (OWL_WARP_CS_GET_OCARINA_MODE(&this->actor) == OCARINA_MODE_WARP_TO_ENTRANCE) { func_80169F78(play); gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = - PLAYER_PARAMS(gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams, PLAYER_INITMODE_6); + PLAYER_PARAMS(gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams, PLAYER_START_MODE_6); gSaveContext.respawnFlag = -6; } else { play->nextEntrance = diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 8f488bcb0e..654f3cc9f5 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -81,7 +81,7 @@ void EnTorch2_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); Play_SetRespawnData(play, this->actor.params + RESPAWN_MODE_GORON - 1, 0xFF, 0, - PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &this->actor.world.pos, this->actor.shape.rot.y); + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B), &this->actor.world.pos, this->actor.shape.rot.y); play->actorCtx.elegyShells[this->actor.params] = NULL; } 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 5a52703a49..94c43783f9 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -571,7 +571,7 @@ s32 func_80BA47E0(EnToto* this, PlayState* play) { Math_Vec3s_ToVec3f(&spawnPos, &D_80BA50DC[i].unk6); Actor_Spawn(&play->actorCtx, play, ACTOR_PLAYER, spawnPos.x, spawnPos.y, spawnPos.z, i + 2, 0, 0, - PLAYER_PARAMS(0xFF, PLAYER_INITMODE_F) | 0xFFFFF000); + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_F) | 0xFFFFF000); } } func_80BA402C(this, play); diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index 94117416b1..7a63ed8e71 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -205,9 +205,9 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { newRespawnPos.z = playerActorEntry->pos.z; if (WARPTAG_GET_3C0_MAX(&this->dyna.actor) == WARPTAG_3C0_MAX) { - playerParams = PLAYER_PARAMS(0xFF, PLAYER_INITMODE_9); + playerParams = PLAYER_PARAMS(0xFF, PLAYER_START_MODE_9); } else { // not used by any known variant - playerParams = PLAYER_PARAMS(0xFF, PLAYER_INITMODE_8); + playerParams = PLAYER_PARAMS(0xFF, PLAYER_START_MODE_8); } // why are we getting player home rotation from the room data? doesnt player have home.rot.y? diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 3b56325b7f..a3cbb3d3c9 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -60,11 +60,11 @@ static s16 sSpawnActorIds[OBJMURE_TYPE_MAX] = { }; static s16 sSpawnParams[OBJMURE_TYPE_MAX] = { - KUSA_BUSH_PARAMS(false, 0, false), // OBJMURE_TYPE_GRASS - PLAYER_PARAMS(2, PLAYER_INITMODE_0), // OBJMURE_TYPE_UNDEFINED - FISH_PARAMS(ENFISH_MINUS1), // OBJMURE_TYPE_FISH - ENINSECT_PARAMS(false), // OBJMURE_TYPE_BUGS - BUTTERFLY_PARAMS(BUTTERFLY_MINUS1), // OBJMURE_TYPE_BUTTERFLY + KUSA_BUSH_PARAMS(false, 0, false), // OBJMURE_TYPE_GRASS + PLAYER_PARAMS(2, PLAYER_START_MODE_0), // OBJMURE_TYPE_UNDEFINED + FISH_PARAMS(ENFISH_MINUS1), // OBJMURE_TYPE_FISH + ENINSECT_PARAMS(false), // OBJMURE_TYPE_BUGS + BUTTERFLY_PARAMS(BUTTERFLY_MINUS1), // OBJMURE_TYPE_BUTTERFLY }; static InitChainEntry sInitChain[] = { diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index fd58937f81..883730af64 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -455,7 +455,7 @@ void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; play->transitionType = TRANS_TYPE_FADE_BLACK; if (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams == - PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE)) { + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_TELESCOPE)) { gSaveContext.nextTransitionType = TRANS_TYPE_CIRCLE; } else { gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index cd454fd8b7..a801663312 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -253,24 +253,6 @@ s32 Player_ActionHandler_12(Player* this, PlayState* play); s32 Player_ActionHandler_13(Player* this, PlayState* play); s32 Player_ActionHandler_14(Player* this, PlayState* play); -/* Init Mode functions */ -void Player_InitMode_0(PlayState* play, Player* this); -void Player_InitMode_1(PlayState* play, Player* this); -void Player_InitMode_2(PlayState* play, Player* this); -void Player_InitMode_3(PlayState* play, Player* this); -void Player_InitMode_4(PlayState* play, Player* this); -void Player_InitMode_5(PlayState* play, Player* this); -void Player_InitMode_6(PlayState* play, Player* this); -void Player_InitMode_7(PlayState* play, Player* this); -void func_80841744(PlayState* play, Player* this); -void func_80841744(PlayState* play, Player* this); -void func_8083ADF0(PlayState* play, Player* this); -void Player_InitMode_B(PlayState* play, Player* this); -void Player_InitMode_Telescope(PlayState* play, Player* this); -void Player_InitMode_D(PlayState* play, Player* this); -void func_8083ADF0(PlayState* play, Player* this); -void Player_InitMode_F(PlayState* play, Player* this); - /* Cutscene functions */ void Player_CsAction_0(PlayState* play, Player* this, CsCmdActorCue* cue); void Player_CsAction_1(PlayState* play, Player* this, CsCmdActorCue* cue); @@ -8648,7 +8630,7 @@ void func_8083A98C(Actor* thisx, PlayState* play2) { } // Set up using a telescope -void Player_InitMode_Telescope(PlayState* play, Player* this) { +void Player_StartMode_Telescope(PlayState* play, Player* this) { this->actor.update = func_8083A98C; this->actor.draw = NULL; if (play->sceneId == SCENE_00KEIKOKU) { @@ -8667,18 +8649,17 @@ void Player_InitMode_Telescope(PlayState* play, Player* this) { play->actorCtx.flags |= ACTORCTX_FLAG_TELESCOPE_ON; } -void Player_InitMode_B(PlayState* play, Player* this) { +void Player_StartMode_B(PlayState* play, Player* this) { func_8085B384(this, play); } -void Player_InitMode_D(PlayState* play, Player* this) { +void Player_StartMode_D(PlayState* play, Player* this) { if (func_8083A878(play, this, 180.0f)) { this->av2.actionVar2 = -20; } } -// InitModes 0xA and 0xE -void func_8083ADF0(PlayState* play, Player* this) { +void Player_StartMode_E(PlayState* play, Player* this) { this->speedXZ = 2.0f; gSaveContext.entranceSpeed = 2.0f; @@ -8687,7 +8668,7 @@ void func_8083ADF0(PlayState* play, Player* this) { } } -void Player_InitMode_F(PlayState* play, Player* this) { +void Player_StartMode_F(PlayState* play, Player* this) { if (gSaveContext.entranceSpeed < 0.1f) { gSaveContext.entranceSpeed = 0.1f; } @@ -10870,12 +10851,12 @@ s32 func_808411D4(PlayState* play, Player* this, f32* arg2, s32 arg3) { return sp2C; } -void Player_InitMode_0(PlayState* play, Player* this) { +void Player_StartMode_0(PlayState* play, Player* this) { this->actor.update = func_801229EC; this->actor.draw = NULL; } -void Player_InitMode_2(PlayState* play, Player* this) { +void Player_StartMode_2(PlayState* play, Player* this) { Player_SetAction(play, this, Player_Action_76, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, PLAYER_ANIM_ADJUSTED_SPEED, @@ -10909,7 +10890,7 @@ void func_80841358(PlayState* play, Player* this, s32 arg2) { Vec3f D_8085D2B4 = { -1.0f, 69.0f, 20.0f }; -void Player_InitMode_1(PlayState* play, Player* this) { +void Player_StartMode_1(PlayState* play, Player* this) { Player_SetAction(play, this, Player_Action_66, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; Math_Vec3f_Copy(&this->actor.world.pos, &D_8085D2B4); @@ -10924,30 +10905,30 @@ void Player_InitMode_1(PlayState* play, Player* this) { this->av2.actionVar2 = 20; } -void Player_InitMode_3(PlayState* play, Player* this) { +void Player_StartMode_3(PlayState* play, Player* this) { Player_SetAction(play, this, Player_Action_78, 0); Player_AnimReplace_Setup(play, this, ANIM_FLAG_1 | ANIM_FLAG_UPDATE_Y | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE | ANIM_FLAG_80); } -void Player_InitMode_4(PlayState* play, Player* this) { +void Player_StartMode_4(PlayState* play, Player* this) { func_80834DB8(this, &gPlayerAnim_link_normal_jump, 12.0f, play); Player_SetAction(play, this, Player_Action_79, 0); this->stateFlags1 |= PLAYER_STATE1_20000000; this->fallStartHeight = this->actor.world.pos.y; } -void Player_InitMode_7(PlayState* play, Player* this) { +void Player_StartMode_7(PlayState* play, Player* this) { func_80833B18(play, this, 1, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); } -void Player_InitMode_5(PlayState* play, Player* this) { +void Player_StartMode_5(PlayState* play, Player* this) { Player_SetAction(play, this, Player_Action_75, 0); this->actor.draw = NULL; this->stateFlags1 |= PLAYER_STATE1_20000000; } -void Player_InitMode_6(PlayState* play, Player* this) { +void Player_StartMode_6(PlayState* play, Player* this) { if (gSaveContext.save.isOwlSave) { Player_SetAction(play, this, Player_Action_0, 0); Player_Anim_PlayLoopMorph(play, this, D_8085BE84[PLAYER_ANIMGROUP_nwait][this->modelAnimType]); @@ -10964,10 +10945,9 @@ void Player_InitMode_6(PlayState* play, Player* this) { } } -// InitModes 0x8 and 0x9 -void func_80841744(PlayState* play, Player* this) { +void Player_StartMode_WarpTag(PlayState* play, Player* this) { Player_SetAction(play, this, Player_Action_91, 0); - if (PLAYER_GET_INITMODE(&this->actor) == PLAYER_INITMODE_8) { + if (PLAYER_GET_START_MODE(&this->actor) == PLAYER_START_MODE_8) { Player_Anim_PlayOnceAdjustedReverse(play, this, D_8085D17C[this->transformation]); this->itemAction = PLAYER_IA_OCARINA; Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); @@ -10990,9 +10970,9 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe Actor_ProcessInitChain(&this->actor, sInitChain); this->yaw = this->actor.world.rot.y; - if ((PLAYER_GET_INITMODE(&this->actor) != PLAYER_INITMODE_TELESCOPE) && - ((gSaveContext.respawnFlag != 2) || - (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams != PLAYER_PARAMS(0xFF, PLAYER_INITMODE_TELESCOPE)))) { + if ((PLAYER_GET_START_MODE(&this->actor) != PLAYER_START_MODE_TELESCOPE) && + ((gSaveContext.respawnFlag != 2) || (gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams != + PLAYER_PARAMS(0xFF, PLAYER_START_MODE_TELESCOPE)))) { func_808309CC(play, this); SkelAnime_InitPlayer(play, &this->skelAnime, skelHeader, D_8085BE84[PLAYER_ANIMGROUP_wait][this->modelAnimType], 1 | 8, this->jointTableBuffer, this->morphTableBuffer, PLAYER_LIMB_MAX); @@ -11027,27 +11007,27 @@ void func_80841A50(PlayState* play, Player* this) { } } -typedef void (*PlayerInitModeFunc)(PlayState*, Player*); +typedef void (*PlayerStartModeFunc)(PlayState*, Player*); // Initialisation functions for various gameplay modes depending on spawn params. // There may be at most 0x10 due to it using a single nybble. -PlayerInitModeFunc sPlayerInitModeFuncs[PLAYER_INITMODE_MAX] = { - Player_InitMode_0, // PLAYER_INITMODE_0 - Player_InitMode_1, // PLAYER_INITMODE_1 - Player_InitMode_2, // PLAYER_INITMODE_2 - Player_InitMode_3, // PLAYER_INITMODE_3 - Player_InitMode_4, // PLAYER_INITMODE_4 - Player_InitMode_5, // PLAYER_INITMODE_5 - Player_InitMode_6, // PLAYER_INITMODE_6 - Player_InitMode_7, // PLAYER_INITMODE_7 - func_80841744, // PLAYER_INITMODE_8 - func_80841744, // PLAYER_INITMODE_9 - func_8083ADF0, // PLAYER_INITMODE_A - Player_InitMode_B, // PLAYER_INITMODE_B - Player_InitMode_Telescope, // PLAYER_INITMODE_TELESCOPE - Player_InitMode_D, // PLAYER_INITMODE_D - func_8083ADF0, // PLAYER_INITMODE_E - Player_InitMode_F, // PLAYER_INITMODE_F +PlayerStartModeFunc sStartModeFuncs[PLAYER_START_MODE_MAX] = { + Player_StartMode_0, // PLAYER_START_MODE_0 + Player_StartMode_1, // PLAYER_START_MODE_1 + Player_StartMode_2, // PLAYER_START_MODE_2 + Player_StartMode_3, // PLAYER_START_MODE_3 + Player_StartMode_4, // PLAYER_START_MODE_4 + Player_StartMode_5, // PLAYER_START_MODE_5 + Player_StartMode_6, // PLAYER_START_MODE_6 + Player_StartMode_7, // PLAYER_START_MODE_7 + Player_StartMode_WarpTag, // PLAYER_START_MODE_8 + Player_StartMode_WarpTag, // PLAYER_START_MODE_9 + Player_StartMode_E, // PLAYER_START_MODE_A + Player_StartMode_B, // PLAYER_START_MODE_B + Player_StartMode_Telescope, // PLAYER_START_MODE_TELESCOPE + Player_StartMode_D, // PLAYER_START_MODE_D + Player_StartMode_E, // PLAYER_START_MODE_E + Player_StartMode_F, // PLAYER_START_MODE_F }; // sBlureInit @@ -11074,7 +11054,6 @@ EffectTireMarkInit D_8085D330 = { 0, 63, { 0, 0, 15, 100 } }; Color_RGBA8 D_8085D338 = { 0, 0, 15, 100 }; // sTireMarkOtherColor ? Color_RGBA8 D_8085D33C = { 0, 0, 0, 150 }; -Vec3f D_8085D340 = { 0.0f, 50.0f, 0.0f }; void Player_Init(Actor* thisx, PlayState* play) { s32 pad; @@ -11082,7 +11061,7 @@ void Player_Init(Actor* thisx, PlayState* play) { s8 objectSlot; s32 respawnFlag; s32 var_a1; - PlayerInitMode initMode; + PlayerStartMode startMode; play->playerInit = Player_InitCommon; play->playerUpdate = Player_UpdateCommon; @@ -11281,7 +11260,7 @@ void Player_Init(Actor* thisx, PlayState* play) { var_a1 = ((respawnFlag == 4) || (gSaveContext.respawnFlag == -4)) ? 1 : 0; if (func_801226E0(play, var_a1) == 0) { - gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = PLAYER_PARAMS(thisx->params, PLAYER_INITMODE_D); + gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = PLAYER_PARAMS(thisx->params, PLAYER_START_MODE_D); } gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 1; @@ -11289,21 +11268,24 @@ void Player_Init(Actor* thisx, PlayState* play) { gSaveContext.respawn[RESPAWN_MODE_TOP] = gSaveContext.respawn[RESPAWN_MODE_DOWN]; } gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = - PLAYER_PARAMS(gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams, PLAYER_INITMODE_D); + PLAYER_PARAMS(gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams, PLAYER_START_MODE_D); - initMode = PLAYER_GET_INITMODE(&this->actor); - if (((initMode == PLAYER_INITMODE_5) || (initMode == PLAYER_INITMODE_6)) && + startMode = PLAYER_GET_START_MODE(&this->actor); + + if (((startMode == PLAYER_START_MODE_5) || (startMode == PLAYER_START_MODE_6)) && (gSaveContext.save.cutsceneIndex >= 0xFFF0)) { - initMode = PLAYER_INITMODE_D; + startMode = PLAYER_START_MODE_D; } - sPlayerInitModeFuncs[initMode](play, this); + sStartModeFuncs[startMode](play, this); if ((this->actor.draw != NULL) && gSaveContext.save.hasTatl && ((gSaveContext.gameMode == GAMEMODE_NORMAL) || (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) && (play->sceneId != SCENE_SPOT00)) { - this->tatlActor = - Player_SpawnFairy(play, this, &this->actor.world.pos, &D_8085D340, FAIRY_PARAMS(FAIRY_TYPE_0, false, 0)); + static Vec3f sTatlSpawnPosOffset = { 0.0f, 50.0f, 0.0f }; + + this->tatlActor = Player_SpawnFairy(play, this, &this->actor.world.pos, &sTatlSpawnPosOffset, + FAIRY_PARAMS(FAIRY_TYPE_0, false, 0)); if (gSaveContext.dogParams != 0) { gSaveContext.dogParams |= 0x8000; @@ -13721,7 +13703,7 @@ void func_80848640(PlayState* play, Player* this) { if (torch2 != NULL) { play->actorCtx.elegyShells[this->transformation] = torch2; - Play_SetupRespawnPoint(play, this->transformation + 3, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B)); + Play_SetupRespawnPoint(play, this->transformation + 3, PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B)); } effChange = Actor_Spawn(&play->actorCtx, play, ACTOR_EFF_CHANGE, this->actor.world.pos.x, this->actor.world.pos.y, @@ -15851,7 +15833,7 @@ void Player_Action_36(Player* this, PlayState* play) { } Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); - Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B)); + Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(0xFF, PLAYER_START_MODE_B)); } } } else if (!(this->stateFlags1 & PLAYER_STATE1_20000000) && PlayerAnimation_OnFrame(&this->skelAnime, 15.0f)) { @@ -18746,7 +18728,7 @@ void Player_Action_91(Player* this, PlayState* play) { if (BINANG_SUB(this->actor.shape.rot.y, this->actor.world.rot.y) >= 0) { this->actor.shape.rot.y = this->actor.world.rot.y; Player_StopCutscene(this); - if (PLAYER_GET_INITMODE(&this->actor) == PLAYER_INITMODE_8) { + if (PLAYER_GET_START_MODE(&this->actor) == PLAYER_START_MODE_8) { anim = D_8085D17C[this->transformation]; func_80836A5C(this, play); PlayerAnimation_Change(play, &this->skelAnime, anim, -PLAYER_ANIM_ADJUSTED_SPEED, diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index f6582b96b0..c2c60baf7f 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -4500,11 +4500,11 @@ 0x8083A844:("func_8083A844",), 0x8083A878:("func_8083A878",), 0x8083A98C:("func_8083A98C",), - 0x8083AD04:("Player_InitMode_Telescope",), - 0x8083AD8C:("Player_InitMode_B",), - 0x8083ADB8:("Player_InitMode_D",), - 0x8083ADF0:("func_8083ADF0",), - 0x8083AE38:("Player_InitMode_F",), + 0x8083AD04:("Player_StartMode_Telescope",), + 0x8083AD8C:("Player_StartMode_B",), + 0x8083ADB8:("Player_StartMode_D",), + 0x8083ADF0:("Player_StartMode_E",), + 0x8083AE38:("Player_StartMode_F",), 0x8083AECC:("func_8083AECC",), 0x8083AF30:("func_8083AF30",), 0x8083AF8C:("func_8083AF8C",), @@ -4590,16 +4590,16 @@ 0x80840F34:("func_80840F34",), 0x80840F90:("func_80840F90",), 0x808411D4:("func_808411D4",), - 0x808412A0:("Player_InitMode_0",), - 0x808412BC:("Player_InitMode_2",), + 0x808412A0:("Player_StartMode_0",), + 0x808412BC:("Player_StartMode_2",), 0x80841358:("func_80841358",), - 0x80841408:("Player_InitMode_1",), - 0x808414E0:("Player_InitMode_3",), - 0x80841528:("Player_InitMode_4",), - 0x808415A0:("Player_InitMode_7",), - 0x808415E4:("Player_InitMode_5",), - 0x80841624:("Player_InitMode_6",), - 0x80841744:("func_80841744",), + 0x80841408:("Player_StartMode_1",), + 0x808414E0:("Player_StartMode_3",), + 0x80841528:("Player_StartMode_4",), + 0x808415A0:("Player_StartMode_7",), + 0x808415E4:("Player_StartMode_5",), + 0x80841624:("Player_StartMode_6",), + 0x80841744:("Player_StartMode_WarpTag",), 0x8084182C:("Player_InitCommon",), 0x80841A50:("func_80841A50",), 0x80841AC4:("Player_Init",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 1041cf3778..ff23ed4f94 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4900,12 +4900,12 @@ 0x8085D2B4:("D_8085D2B4","UNK_TYPE1","",0x1), 0x8085D2C0:("sInitChain","ActorInitVar","",0x4), 0x8085D2C4:("sPlayerSkeletonBaseTransl","UNK_TYPE4","",0x4), - 0x8085D2CC:("sPlayerInitModeFuncs","UNK_PTR","",0x4), + 0x8085D2CC:("sStartModeFuncs","UNK_PTR","",0x4), 0x8085D30C:("D_8085D30C","EffectBlureInit2","",0x24), 0x8085D330:("D_8085D330","EffectTireMarkInit","",0x8), 0x8085D338:("D_8085D338","UNK_TYPE4","",0x4), 0x8085D33C:("D_8085D33C","UNK_TYPE4","",0x4), - 0x8085D340:("D_8085D340","UNK_TYPE1","",0x1), + 0x8085D340:("sTatlSpawnPosOffset","UNK_TYPE1","",0x1), 0x8085D34C:("D_8085D34C","UNK_TYPE1","",0x1), 0x8085D354:("D_8085D354","UNK_TYPE1","",0x1), 0x8085D358:("sInteractWallCheckOffset","Vec3f","",0xC),