From 26d6028ff1808204aa2978c6c0fe79e5cea9f2bd Mon Sep 17 00:00:00 2001 From: fig02 Date: Sun, 16 Oct 2022 18:00:18 -0400 Subject: Rename scene lists (#1344) * first pass * revert unwanted zap change * review * name Actor_InitContext, change arg name * change bzero to use type --- src/code/z_actor.c | 15 +++++------ src/code/z_path.c | 2 +- src/code/z_play.c | 17 +++++++----- src/code/z_room.c | 2 +- src/code/z_scene.c | 76 +++++++++++++++++++++++++++--------------------------- 5 files changed, 57 insertions(+), 55 deletions(-) (limited to 'src/code') diff --git a/src/code/z_actor.c b/src/code/z_actor.c index e1f939029..e81004620 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1953,15 +1953,14 @@ void Actor_DisableLens(PlayState* play) { } } -// Actor_InitContext -void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEntry) { +void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* playerEntry) { ActorOverlay* overlayEntry; SavedSceneFlags* savedSceneFlags; s32 i; savedSceneFlags = &gSaveContext.sceneFlags[play->sceneId]; - bzero(actorCtx, sizeof(*actorCtx)); + bzero(actorCtx, sizeof(ActorContext)); ActorOverlayTable_Init(); Matrix_MtxFCopy(&play->billboardMtxF, &gMtxFClear); @@ -1983,7 +1982,7 @@ void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEnt actorCtx->absoluteSpace = NULL; - Actor_SpawnEntry(actorCtx, actorEntry, play); + Actor_SpawnEntry(actorCtx, playerEntry, play); func_8002C0C0(&actorCtx->targetCtx, actorCtx->actorLists[ACTORCAT_PLAYER].head, play); func_8002FA60(play); } @@ -2024,12 +2023,12 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { sp74 = NULL; unkFlag = 0; - if (play->numSetupActors != 0) { - actorEntry = &play->setupActorList[0]; - for (i = 0; i < play->numSetupActors; i++) { + if (play->numActorEntries != 0) { + actorEntry = &play->actorEntryList[0]; + for (i = 0; i < play->numActorEntries; i++) { Actor_SpawnEntry(&play->actorCtx, actorEntry++, play); } - play->numSetupActors = 0; + play->numActorEntries = 0; } if (actorCtx->unk_02 != 0) { diff --git a/src/code/z_path.c b/src/code/z_path.c index db3c8af4d..d27530eb3 100644 --- a/src/code/z_path.c +++ b/src/code/z_path.c @@ -4,7 +4,7 @@ Path* Path_GetByIndex(PlayState* play, s16 index, s16 max) { Path* path; if (index != max) { - path = &play->setupPathList[index]; + path = &play->pathList[index]; } else { path = NULL; } diff --git a/src/code/z_play.c b/src/code/z_play.c index 542eb08ce..f768d7a9d 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -403,7 +403,7 @@ void Play_Init(GameState* thisx) { (s32)(zAllocAligned + zAllocSize) - (s32)(zAllocAligned - zAlloc)); Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL); - func_800304DC(this, &this->actorCtx, this->linkActorEntry); + Actor_InitContext(this, &this->actorCtx, this->playerEntry); while (!func_800973FC(this, &this->roomCtx)) { ; // Empty Loop @@ -1399,14 +1399,17 @@ void Play_InitEnvironment(PlayState* this, s16 skyboxId) { } void Play_InitScene(PlayState* this, s32 spawn) { - this->curSpawn = spawn; - this->linkActorEntry = NULL; + this->spawn = spawn; + + this->playerEntry = NULL; this->unk_11DFC = NULL; - this->setupEntranceList = NULL; - this->setupExitList = NULL; + this->spawnList = NULL; + this->exitList = NULL; this->naviQuestHints = NULL; - this->setupPathList = NULL; - this->numSetupActors = 0; + this->pathList = NULL; + + this->numActorEntries = 0; + Object_InitBank(this, &this->objectCtx); LightContext_Init(this, &this->lightCtx); TransitionActor_InitContext(&this->state, &this->transiActorCtx); diff --git a/src/code/z_room.c b/src/code/z_room.c index 953739f2a..8447a0460 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -582,7 +582,7 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) { roomCtx->status = 0; frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex) - : play->setupEntranceList[play->curSpawn].room; + : play->spawnList[play->spawn].room; func_8009728C(play, roomCtx, frontRoom); return maxRoomSize; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 10de2959c..7f8598fa7 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -182,22 +182,22 @@ s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) { return 0; } -void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { - ActorEntry* linkEntry = play->linkActorEntry = - (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.data) + play->setupEntranceList[play->curSpawn].spawn; +void Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) { + ActorEntry* playerEntry = play->playerEntry = + (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->playerEntryList.data) + play->spawnList[play->spawn].playerEntryIndex; s16 linkObjectId; play->linkAgeOnLoad = ((void)0, gSaveContext.linkAge); linkObjectId = gLinkObjectIds[((void)0, gSaveContext.linkAge)]; - gActorOverlayTable[linkEntry->id].initInfo->objectId = linkObjectId; + gActorOverlayTable[playerEntry->id].initInfo->objectId = linkObjectId; Object_Spawn(&play->objectCtx, linkObjectId); } -void Scene_CommandActorList(PlayState* play, SceneCmd* cmd) { - play->numSetupActors = cmd->actorList.length; - play->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.data); +void Scene_CommandActorEntryList(PlayState* play, SceneCmd* cmd) { + play->numActorEntries = cmd->actorEntryList.length; + play->actorEntryList = SEGMENTED_TO_VIRTUAL(cmd->actorEntryList.data); } void Scene_CommandUnused2(PlayState* play, SceneCmd* cmd) { @@ -221,8 +221,8 @@ void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) { play->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.data); } -void Scene_CommandEntranceList(PlayState* play, SceneCmd* cmd) { - play->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.data); +void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) { + play->spawnList = SEGMENTED_TO_VIRTUAL(cmd->spawnList.data); } void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { @@ -308,10 +308,10 @@ void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) { } void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) { - play->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.data); + play->pathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.data); } -void Scene_CommandTransitionActorList(PlayState* play, SceneCmd* cmd) { +void Scene_CommandTransitionActorEntryList(PlayState* play, SceneCmd* cmd) { play->transiActorCtx.numActors = cmd->transiActorList.length; play->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.data); } @@ -386,7 +386,7 @@ void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) { } void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) { - play->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.data); + play->exitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.data); } void Scene_CommandUndefined9(PlayState* play, SceneCmd* cmd) { @@ -470,32 +470,32 @@ void Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) { } void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*) = { - Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST - Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST - Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 - Scene_CommandCollisionHeader, // SCENE_CMD_ID_COLLISION_HEADER - Scene_CommandRoomList, // SCENE_CMD_ID_ROOM_LIST - Scene_CommandWindSettings, // SCENE_CMD_ID_WIND_SETTINGS - Scene_CommandEntranceList, // SCENE_CMD_ID_ENTRANCE_LIST - Scene_CommandSpecialFiles, // SCENE_CMD_ID_SPECIAL_FILES - Scene_CommandRoomBehavior, // SCENE_CMD_ID_ROOM_BEHAVIOR - Scene_CommandUndefined9, // SCENE_CMD_ID_UNDEFINED_9 - Scene_CommandRoomShape, // SCENE_CMD_ID_ROOM_SHAPE - Scene_CommandObjectList, // SCENE_CMD_ID_OBJECT_LIST - Scene_CommandLightList, // SCENE_CMD_ID_LIGHT_LIST - Scene_CommandPathList, // SCENE_CMD_ID_PATH_LIST - Scene_CommandTransitionActorList, // SCENE_CMD_ID_TRANSITION_ACTOR_LIST - Scene_CommandLightSettingsList, // SCENE_CMD_ID_LIGHT_SETTINGS_LIST - Scene_CommandTimeSettings, // SCENE_CMD_ID_TIME_SETTINGS - Scene_CommandSkyboxSettings, // SCENE_CMD_ID_SKYBOX_SETTINGS - Scene_CommandSkyboxDisables, // SCENE_CMD_ID_SKYBOX_DISABLES - Scene_CommandExitList, // SCENE_CMD_ID_EXIT_LIST - NULL, // SCENE_CMD_ID_END - Scene_CommandSoundSettings, // SCENE_CMD_ID_SOUND_SETTINGS - Scene_CommandEchoSettings, // SCENE_CMD_ID_ECHO_SETTINGS - Scene_CommandCutsceneData, // SCENE_CMD_ID_CUTSCENE_DATA - Scene_CommandAlternateHeaderList, // SCENE_CMD_ID_ALTERNATE_HEADER_LIST - Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS + Scene_CommandPlayerEntryList, // SCENE_CMD_ID_SPAWN_LIST + Scene_CommandActorEntryList, // SCENE_CMD_ID_ACTOR_LIST + Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 + Scene_CommandCollisionHeader, // SCENE_CMD_ID_COLLISION_HEADER + Scene_CommandRoomList, // SCENE_CMD_ID_ROOM_LIST + Scene_CommandWindSettings, // SCENE_CMD_ID_WIND_SETTINGS + Scene_CommandSpawnList, // SCENE_CMD_ID_ENTRANCE_LIST + Scene_CommandSpecialFiles, // SCENE_CMD_ID_SPECIAL_FILES + Scene_CommandRoomBehavior, // SCENE_CMD_ID_ROOM_BEHAVIOR + Scene_CommandUndefined9, // SCENE_CMD_ID_UNDEFINED_9 + Scene_CommandRoomShape, // SCENE_CMD_ID_ROOM_SHAPE + Scene_CommandObjectList, // SCENE_CMD_ID_OBJECT_LIST + Scene_CommandLightList, // SCENE_CMD_ID_LIGHT_LIST + Scene_CommandPathList, // SCENE_CMD_ID_PATH_LIST + Scene_CommandTransitionActorEntryList, // SCENE_CMD_ID_TRANSITION_ACTOR_LIST + Scene_CommandLightSettingsList, // SCENE_CMD_ID_LIGHT_SETTINGS_LIST + Scene_CommandTimeSettings, // SCENE_CMD_ID_TIME_SETTINGS + Scene_CommandSkyboxSettings, // SCENE_CMD_ID_SKYBOX_SETTINGS + Scene_CommandSkyboxDisables, // SCENE_CMD_ID_SKYBOX_DISABLES + Scene_CommandExitList, // SCENE_CMD_ID_EXIT_LIST + NULL, // SCENE_CMD_ID_END + Scene_CommandSoundSettings, // SCENE_CMD_ID_SOUND_SETTINGS + Scene_CommandEchoSettings, // SCENE_CMD_ID_ECHO_SETTINGS + Scene_CommandCutsceneData, // SCENE_CMD_ID_CUTSCENE_DATA + Scene_CommandAlternateHeaderList, // SCENE_CMD_ID_ALTERNATE_HEADER_LIST + Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS }; RomFile sNaviQuestHintFiles[] = { -- cgit v1.2.3