1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-21 22:35:23 +00:00

document player params

This commit is contained in:
fig02 2024-11-24 00:33:55 -05:00
parent 33391c0a5b
commit eaf9127aaa
6 changed files with 22 additions and 14 deletions

View file

@ -7,7 +7,13 @@
struct Player;
#define PLAYER_GET_START_MODE(thisx) PARAMS_GET_S(thisx->params, 8, 4)
#define PLAYER_PARAMS(startMode, startBgCamIndex) (PARAMS_PACK(startMode, 8, 4) | PARAMS_PACK(startBgCamIndex, 0, 8))
// Determines behavior when spawning. See `PlayerStartMode`.
#define PLAYER_GET_START_MODE(thisx) PARAMS_GET_S((thisx)->params, 8, 4)
// Sets inital `bgCamIndex` which determines camera setting used from scene data.
#define PLAYER_GET_START_BG_CAM_INDEX(thisx) PARAMS_GET_S((thisx)->params, 0, 8)
typedef enum PlayerStartMode {
/* 0 */ PLAYER_START_MODE_NOTHING, // Update is empty and draw function is NULL, nothing occurs. Useful in cutscenes, for example.

View file

@ -2186,7 +2186,7 @@ void Actor_DrawFaroresWindPointer(PlayState* play) {
if (D_8015BC18 == 0.0f) {
gSaveContext.respawn[RESPAWN_MODE_TOP] = gSaveContext.respawn[RESPAWN_MODE_DOWN];
gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = 0x06FF;
gSaveContext.respawn[RESPAWN_MODE_TOP].playerParams = PLAYER_PARAMS(PLAYER_START_MODE_FARORES_WIND, -1);
gSaveContext.respawn[RESPAWN_MODE_TOP].data = 40;
}

View file

@ -483,8 +483,9 @@ void Play_Init(GameState* thisx) {
Camera_InitDataUsingPlayer(&this->mainCamera, player);
Camera_RequestMode(&this->mainCamera, CAM_MODE_NORMAL);
playerStartBgCamIndex = PARAMS_GET_U(player->actor.params, 0, 8);
if (playerStartBgCamIndex != 0xFF) {
playerStartBgCamIndex = PLAYER_GET_START_BG_CAM_INDEX(&player->actor);
if (playerStartBgCamIndex != -1) {
PRINTF("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartBgCamIndex);
Camera_RequestBgCam(&this->mainCamera, playerStartBgCamIndex);
}
@ -1900,7 +1901,7 @@ void Play_LoadToLastEntrance(PlayState* this) {
}
void Play_TriggerRespawn(PlayState* this) {
Play_SetupRespawnPoint(this, RESPAWN_MODE_DOWN, 0xDFF);
Play_SetupRespawnPoint(this, RESPAWN_MODE_DOWN, PLAYER_PARAMS(PLAYER_START_MODE_IDLE, -1));
Play_LoadToLastEntrance(this);
}

View file

@ -131,7 +131,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) {
if ((this->actor.attentionRangeType != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(player->stateFlags1 & PLAYER_STATE1_31) && (player->av1.actionVar1 == 0)) {
destinationIdx = PARAMS_GET_U(this->actor.params, 12, 3) - 1;
Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF);
Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, PLAYER_PARAMS(PLAYER_START_MODE_GROTTO, -1));
gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.home.rot.y;
gSaveContext.respawn[RESPAWN_MODE_RETURN].data = PARAMS_GET_U(this->actor.params, 0, 16);

View file

@ -821,7 +821,7 @@ void DoorShutter_SetupClosed(DoorShutter* this, PlayState* play) {
play->roomCtx.activeBufPage ^= 1;
}
Room_FinishRoomChange(play, &play->roomCtx);
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0x0EFF);
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(PLAYER_START_MODE_MOVE_FORWARD_SLOW, -1));
}
this->isActive = false;
this->dyna.actor.velocity.y = 0.0f;

View file

@ -4815,7 +4815,7 @@ s32 func_808382DC(Player* this, PlayState* play) {
respawnInfo = &fallingSpikeTrapRespawn;
}
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF);
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(PLAYER_START_MODE_IDLE, -1));
gSaveContext.respawn[RESPAWN_MODE_DOWN].pos = respawnInfo->pos;
gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw = respawnInfo->yaw;
}
@ -10186,7 +10186,7 @@ s32 func_80845BA0(PlayState* play, Player* this, f32* arg2, s32 arg3) {
s32 func_80845C68(PlayState* play, s32 arg1) {
if (arg1 == 0) {
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF);
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(PLAYER_START_MODE_IDLE, -1));
}
gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 0;
return arg1;
@ -10272,7 +10272,7 @@ void Player_Action_80845EF8(Player* this, PlayState* play) {
Room_FinishRoomChange(play, &play->roomCtx);
}
Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN));
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0xDFF);
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(PLAYER_START_MODE_IDLE, -1));
}
return;
}
@ -10747,7 +10747,8 @@ void Player_Init(Actor* thisx, PlayState* play2) {
}
if (func_80845C68(play, (respawnFlag == 2) ? 1 : 0) == 0) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = PARAMS_GET_S(thisx->params, 0, 8) | 0xD00;
gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams =
PLAYER_PARAMS(PLAYER_START_MODE_IDLE, PLAYER_GET_START_BG_CAM_INDEX(thisx));
}
gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 1;
@ -13780,7 +13781,7 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) {
s32 pad;
gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex = sWarpSongEntrances[play->msgCtx.lastPlayedSong];
gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x5FF;
gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = PLAYER_PARAMS(PLAYER_START_MODE_WARP_SONG, -1);
gSaveContext.respawn[RESPAWN_MODE_RETURN].data = play->msgCtx.lastPlayedSong;
this->csAction = PLAYER_CSACTION_NONE;
@ -14779,13 +14780,13 @@ void Player_Action_808507F4(Player* this, PlayState* play) {
if (this->av2.actionVar2 == 0) {
gSaveContext.respawn[RESPAWN_MODE_TOP].data = 1;
Play_SetupRespawnPoint(play, RESPAWN_MODE_TOP, 0x6FF);
Play_SetupRespawnPoint(play, RESPAWN_MODE_TOP, PLAYER_PARAMS(PLAYER_START_MODE_FARORES_WIND, -1));
gSaveContext.save.info.fw.set = 1;
gSaveContext.save.info.fw.pos.x = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x;
gSaveContext.save.info.fw.pos.y = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.y;
gSaveContext.save.info.fw.pos.z = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.z;
gSaveContext.save.info.fw.yaw = gSaveContext.respawn[RESPAWN_MODE_DOWN].yaw;
gSaveContext.save.info.fw.playerParams = 0x6FF;
gSaveContext.save.info.fw.playerParams = PLAYER_PARAMS(PLAYER_START_MODE_FARORES_WIND, -1);
gSaveContext.save.info.fw.entranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex;
gSaveContext.save.info.fw.roomIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].roomIndex;
gSaveContext.save.info.fw.tempSwchFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags;