pull in startMode docs (#4988)

This commit is contained in:
briaguya 2025-02-03 15:58:49 -08:00 committed by GitHub
parent c7f335f23c
commit 8ae8770db8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 69 additions and 45 deletions

View File

@ -7,6 +7,29 @@
struct Player; struct Player;
// Determines behavior when spawning. See `PlayerStartMode`.
#define PLAYER_GET_START_MODE(thisx) (thisx->params & 0xF00) >> 8
typedef enum PlayerStartMode {
/* 0 */ PLAYER_START_MODE_NOTHING, // Update is empty and draw function is NULL, nothing occurs. Useful in cutscenes, for example.
/* 1 */ PLAYER_START_MODE_TIME_TRAVEL, // Arriving from time travel. Automatically adjusts by age.
/* 2 */ PLAYER_START_MODE_BLUE_WARP, // Arriving from a blue warp.
/* 3 */ PLAYER_START_MODE_DOOR, // Unused. Use a door immediately if one is nearby. If no door is in usable range, a softlock occurs.
/* 4 */ PLAYER_START_MODE_GROTTO, // Arriving from a grotto, launched upward from the ground.
/* 5 */ PLAYER_START_MODE_WARP_SONG, // Arriving from a warp song.
/* 6 */ PLAYER_START_MODE_FARORES_WIND, // Arriving from a Farores Wind warp.
/* 7 */ PLAYER_START_MODE_KNOCKED_OVER, // Knocked over on the ground and flashing red.
/* 8 */ PLAYER_START_MODE_UNUSED_8, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW.
/* 9 */ PLAYER_START_MODE_UNUSED_9, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW.
/* 10 */ PLAYER_START_MODE_UNUSED_10, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW.
/* 11 */ PLAYER_START_MODE_UNUSED_11, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW.
/* 12 */ PLAYER_START_MODE_UNUSED_12, // Unused, behaves the same as PLAYER_START_MODE_MOVE_FORWARD_SLOW.
/* 13 */ PLAYER_START_MODE_IDLE, // Idle standing still, or swim if in water.
/* 14 */ PLAYER_START_MODE_MOVE_FORWARD_SLOW, // Take a few steps forward at a slow speed (2.0f), or swim if in water.
/* 15 */ PLAYER_START_MODE_MOVE_FORWARD, // Take a few steps forward, using the speed from the last exit (gSaveContext.entranceSpeed), or swim if in water.
/* 16 */ PLAYER_START_MODE_MAX // Note: By default, this param has 4 bits allocated. The max value is 16.
} PlayerStartMode;
typedef enum PlayerSword { typedef enum PlayerSword {
/* 0 */ PLAYER_SWORD_NONE, /* 0 */ PLAYER_SWORD_NONE,
/* 1 */ PLAYER_SWORD_KOKIRI, /* 1 */ PLAYER_SWORD_KOKIRI,

View File

@ -157,17 +157,17 @@ s32 func_80835C08(Player* this, PlayState* play);
void Player_UseItem(PlayState* play, Player* this, s32 item); void Player_UseItem(PlayState* play, Player* this, s32 item);
void func_80839F90(Player* this, PlayState* play); void func_80839F90(Player* this, PlayState* play);
s32 func_8083C61C(PlayState* play, Player* this); s32 func_8083C61C(PlayState* play, Player* this);
void func_8083CA20(PlayState* play, Player* this); void Player_StartMode_Idle(PlayState* play, Player* this);
void func_8083CA54(PlayState* play, Player* this); void Player_StartMode_MoveForwardSlow(PlayState* play, Player* this);
void func_8083CA9C(PlayState* play, Player* this); void Player_StartMode_MoveForward(PlayState* play, Player* this);
void func_80846648(PlayState* play, Player* this); void Player_StartMode_Nothing(PlayState* play, Player* this);
void func_80846660(PlayState* play, Player* this); void Player_StartMode_BlueWarp(PlayState* play, Player* this);
void func_808467D4(PlayState* play, Player* this); void Player_StartMode_TimeTravel(PlayState* play, Player* this);
void func_808468A8(PlayState* play, Player* this); void Player_StartMode_Door(PlayState* play, Player* this);
void func_808468E8(PlayState* play, Player* this); void Player_StartMode_Grotto(PlayState* play, Player* this);
void func_80846978(PlayState* play, Player* this); void Player_StartMode_KnockedOver(PlayState* play, Player* this);
void func_808469BC(PlayState* play, Player* this); void Player_StartMode_WarpSong(PlayState* play, Player* this);
void func_80846A68(PlayState* play, Player* this); void Player_StartMode_FaroresWind(PlayState* play, Player* this);
void Player_UpdateCommon(Player* this, PlayState* play, Input* input); void Player_UpdateCommon(Player* this, PlayState* play, Input* input);
void func_8084FF7C(Player* this); void func_8084FF7C(Player* this);
void Player_UpdateBunnyEars(Player* this); void Player_UpdateBunnyEars(Player* this);
@ -6618,13 +6618,13 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) {
return 1; return 1;
} }
void func_8083CA20(PlayState* play, Player* this) { void Player_StartMode_Idle(PlayState* play, Player* this) {
if (func_8083C910(play, this, 180.0f)) { if (func_8083C910(play, this, 180.0f)) {
this->av2.actionVar2 = -20; this->av2.actionVar2 = -20;
} }
} }
void func_8083CA54(PlayState* play, Player* this) { void Player_StartMode_MoveForwardSlow(PlayState* play, Player* this) {
this->linearVelocity = 2.0f; this->linearVelocity = 2.0f;
gSaveContext.entranceSpeed = 2.0f; gSaveContext.entranceSpeed = 2.0f;
if (func_8083C910(play, this, 120.0f)) { if (func_8083C910(play, this, 120.0f)) {
@ -6632,7 +6632,7 @@ void func_8083CA54(PlayState* play, Player* this) {
} }
} }
void func_8083CA9C(PlayState* play, Player* this) { void Player_StartMode_MoveForward(PlayState* play, Player* this) {
if (gSaveContext.entranceSpeed < 0.1f) { if (gSaveContext.entranceSpeed < 0.1f) {
gSaveContext.entranceSpeed = 0.1f; gSaveContext.entranceSpeed = 0.1f;
} }
@ -10614,12 +10614,12 @@ static ColliderQuadInit D_808546A0 = {
void func_8084663C(Actor* thisx, PlayState* play) { void func_8084663C(Actor* thisx, PlayState* play) {
} }
void func_80846648(PlayState* play, Player* this) { void Player_StartMode_Nothing(PlayState* play, Player* this) {
this->actor.update = func_8084663C; this->actor.update = func_8084663C;
this->actor.draw = NULL; this->actor.draw = NULL;
} }
void func_80846660(PlayState* play, Player* this) { void Player_StartMode_BlueWarp(PlayState* play, Player* this) {
Player_SetupAction(play, this, Player_Action_8084F710, 0); Player_SetupAction(play, this, Player_Action_8084F710, 0);
if ((play->sceneNum == SCENE_LAKE_HYLIA) && (gSaveContext.sceneSetupIndex >= 4)) { if ((play->sceneNum == SCENE_LAKE_HYLIA) && (gSaveContext.sceneSetupIndex >= 4)) {
this->av1.actionVar1 = 1; this->av1.actionVar1 = 1;
@ -10652,7 +10652,7 @@ void func_80846720(PlayState* play, Player* this, s32 arg2) {
static Vec3f D_808546F4 = { -1.0f, 69.0f, 20.0f }; static Vec3f D_808546F4 = { -1.0f, 69.0f, 20.0f };
void func_808467D4(PlayState* play, Player* this) { void Player_StartMode_TimeTravel(PlayState* play, Player* this) {
Player_SetupAction(play, this, Player_Action_8084E9AC, 0); Player_SetupAction(play, this, Player_Action_8084E9AC, 0);
this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE;
Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4); Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4);
@ -10666,12 +10666,12 @@ void func_808467D4(PlayState* play, Player* this) {
this->av2.actionVar2 = 20; this->av2.actionVar2 = 20;
} }
void func_808468A8(PlayState* play, Player* this) { void Player_StartMode_Door(PlayState* play, Player* this) {
Player_SetupAction(play, this, Player_Action_8084F9A0, 0); Player_SetupAction(play, this, Player_Action_8084F9A0, 0);
Player_StartAnimMovement(play, this, 0x9B); Player_StartAnimMovement(play, this, 0x9B);
} }
void func_808468E8(PlayState* play, Player* this) { void Player_StartMode_Grotto(PlayState* play, Player* this) {
func_808389E8(this, &gPlayerAnim_link_normal_jump, 12.0f, play); func_808389E8(this, &gPlayerAnim_link_normal_jump, 12.0f, play);
Player_SetupAction(play, this, Player_Action_8084F9C0, 0); Player_SetupAction(play, this, Player_Action_8084F9C0, 0);
this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE;
@ -10679,11 +10679,11 @@ void func_808468E8(PlayState* play, Player* this) {
OnePointCutscene_Init(play, 5110, 40, &this->actor, MAIN_CAM); OnePointCutscene_Init(play, 5110, 40, &this->actor, MAIN_CAM);
} }
void func_80846978(PlayState* play, Player* this) { void Player_StartMode_KnockedOver(PlayState* play, Player* this) {
func_80837C0C(play, this, PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); func_80837C0C(play, this, PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0);
} }
void func_808469BC(PlayState* play, Player* this) { void Player_StartMode_WarpSong(PlayState* play, Player* this) {
Player_SetupAction(play, this, Player_Action_8084F698, 0); Player_SetupAction(play, this, Player_Action_8084F698, 0);
this->actor.draw = NULL; this->actor.draw = NULL;
this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE;
@ -10696,7 +10696,7 @@ Actor* Player_SpawnMagicSpell(PlayState* play, Player* this, s32 spell) {
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0, true); this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0, true);
} }
void func_80846A68(PlayState* play, Player* this) { void Player_StartMode_FaroresWind(PlayState* play, Player* this) {
this->actor.draw = NULL; this->actor.draw = NULL;
Player_SetupAction(play, this, Player_Action_8085076C, 0); Player_SetupAction(play, this, Player_Action_8085076C, 0);
this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE;
@ -10743,23 +10743,23 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe
this->ivanDamageMultiplier = 1; this->ivanDamageMultiplier = 1;
} }
static void (*D_80854738[])(PlayState* play, Player* this) = { static void (*sStartModeFuncs[PLAYER_START_MODE_MAX])(PlayState* play, Player* this) = {
/* 0x0 */ func_80846648, Player_StartMode_Nothing, // PLAYER_START_MODE_NOTHING
/* 0x1 */ func_808467D4, // From time travel Player_StartMode_TimeTravel, // PLAYER_START_MODE_TIME_TRAVEL
/* 0x2 */ func_80846660, Player_StartMode_BlueWarp, // PLAYER_START_MODE_BLUE_WARP
/* 0x3 */ func_808468A8, Player_StartMode_Door, // PLAYER_START_MODE_DOOR
/* 0x4 */ func_808468E8, Player_StartMode_Grotto, // PLAYER_START_MODE_GROTTO
/* 0x5 */ func_808469BC, Player_StartMode_WarpSong, // PLAYER_START_MODE_WARP_SONG
/* 0x6 */ func_80846A68, Player_StartMode_FaroresWind, // PLAYER_START_MODE_FARORES_WIND
/* 0x7 */ func_80846978, Player_StartMode_KnockedOver, // PLAYER_START_MODE_KNOCKED_OVER
/* 0x8 */ func_8083CA54, Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_8
/* 0x9 */ func_8083CA54, Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_9
/* 0xA */ func_8083CA54, Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_10
/* 0xB */ func_8083CA54, Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_11
/* 0xC */ func_8083CA54, Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_UNUSED_12
/* 0xD */ func_8083CA20, Player_StartMode_Idle, // PLAYER_START_MODE_IDLE
/* 0xE */ func_8083CA54, Player_StartMode_MoveForwardSlow, // PLAYER_START_MODE_MOVE_FORWARD_SLOW
/* 0xF */ func_8083CA9C, Player_StartMode_MoveForward, // PLAYER_START_MODE_MOVE_FORWARD
}; };
static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f }; static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f };
@ -10769,7 +10769,7 @@ void Player_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2; PlayState* play = play2;
SceneTableEntry* scene = play->loadedScene; SceneTableEntry* scene = play->loadedScene;
u32 titleFileSize; u32 titleFileSize;
s32 initMode; s32 startMode;
s32 respawnFlag; s32 respawnFlag;
s32 respawnMode; s32 respawnMode;
@ -10858,16 +10858,17 @@ void Player_Init(Actor* thisx, PlayState* play2) {
gSaveContext.infTable[26] |= gBitFlags[play->sceneNum]; gSaveContext.infTable[26] |= gBitFlags[play->sceneNum];
} }
initMode = (thisx->params & 0xF00) >> 8; startMode = PLAYER_GET_START_MODE(thisx);
if ((initMode == 5) || (initMode == 6)) {
if ((startMode == PLAYER_START_MODE_WARP_SONG) || (startMode == PLAYER_START_MODE_FARORES_WIND)) {
if (gSaveContext.cutsceneIndex >= 0xFFF0) { if (gSaveContext.cutsceneIndex >= 0xFFF0) {
initMode = 13; startMode = PLAYER_START_MODE_IDLE;
} }
} }
D_80854738[initMode](play, this); sStartModeFuncs[startMode](play, this);
if (initMode != 0) { if (startMode != PLAYER_START_MODE_NOTHING) {
if ((gSaveContext.gameMode == 0) || (gSaveContext.gameMode == 3)) { if ((gSaveContext.gameMode == 0) || (gSaveContext.gameMode == 3)) {
this->naviActor = Player_SpawnFairy(play, this, &thisx->world.pos, &D_80854778, FAIRY_NAVI); this->naviActor = Player_SpawnFairy(play, this, &thisx->world.pos, &D_80854778, FAIRY_NAVI);
if (gSaveContext.dogParams != 0) { if (gSaveContext.dogParams != 0) {