diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 16da97afad..615fdeafe6 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -135,7 +135,6 @@ source_group("include" FILES ${Header_Files__include}) file(GLOB_RECURSE soh__ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "soh/*.c" "soh/*.cpp" "soh/*.h" "soh/*.hpp") # Add specific files that don't match the pattern -list(APPEND soh__ ${CMAKE_CURRENT_SOURCE_DIR}/soh/Enhancements/savestates_extern.inc) list(APPEND soh__ ${CMAKE_CURRENT_SOURCE_DIR}/soh/Enhancements/speechsynthesizer/DarwinSpeechSynthesizer.mm) # Create source groups that match the real file directory paths diff --git a/soh/soh/Enhancements/savestate_serialize.h b/soh/soh/Enhancements/savestate_serialize.h new file mode 100644 index 0000000000..fdc4cdc4fe --- /dev/null +++ b/soh/soh/Enhancements/savestate_serialize.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum SaveStateMode { + SHIP_SAVESTATE_MEASURE, + SHIP_SAVESTATE_SAVE, + SHIP_SAVESTATE_LOAD, +} SaveStateMode; + +typedef struct SaveStateCtx { + unsigned char* buffer; + size_t offset; + SaveStateMode mode; +} SaveStateCtx; + +static inline void SaveState_Blob(SaveStateCtx* ctx, void* data, size_t len) { + switch (ctx->mode) { + case SHIP_SAVESTATE_SAVE: + memcpy(ctx->buffer + ctx->offset, data, len); + break; + case SHIP_SAVESTATE_LOAD: + memcpy(data, ctx->buffer + ctx->offset, len); + break; + case SHIP_SAVESTATE_MEASURE: + default: + break; + } + ctx->offset += len; +} + +#define SHIP_SAVESTATE_SERIALIZE_FIELD(field) SaveState_Blob(ctx, &(field), sizeof(field)); +#define SHIP_SAVESTATE_DEFINE(Tag, FIELDS) \ + void Tag##_SaveState(SaveStateCtx* ctx) { \ + FIELDS(SHIP_SAVESTATE_SERIALIZE_FIELD) \ + } + +#ifdef __cplusplus +} +#endif diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index acf4fcd634..00605ece26 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -1,5 +1,6 @@ #include "savestates.h" +#include #include #include @@ -12,26 +13,69 @@ #include "z64save.h" #include #include -#include "z64map_mark.h" -#include "../../src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.h" -#include "../../src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h" -#include "../../src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h" -#include "../../src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#include "../../src/overlays/actors/ovl_En_Fr/z_en_fr.h" +#include "savestate_serialize.h" extern "C" PlayState* gPlayState; -// FROM z_lights.c -// I didn't feel like moving it into a header file. -#define LIGHTS_BUFFER_SIZE 32 +extern "C" void BgDdanKd_SaveState(SaveStateCtx* ctx); +extern "C" void BgDodoago_SaveState(SaveStateCtx* ctx); +extern "C" void BgHakaTrap_SaveState(SaveStateCtx* ctx); +extern "C" void BgHidanRock_SaveState(SaveStateCtx* ctx); +extern "C" void BgMenkuriEye_SaveState(SaveStateCtx* ctx); +extern "C" void BgMoriHineri_SaveState(SaveStateCtx* ctx); +extern "C" void BgPoEvent_SaveState(SaveStateCtx* ctx); +extern "C" void BgRelayObjects_SaveState(SaveStateCtx* ctx); +extern "C" void BgSpot18Basket_SaveState(SaveStateCtx* ctx); +extern "C" void BossGanon_SaveState(SaveStateCtx* ctx); +extern "C" void BossGanon2_SaveState(SaveStateCtx* ctx); +extern "C" void BossTw_SaveState(SaveStateCtx* ctx); +extern "C" void Demo6k_SaveState(SaveStateCtx* ctx); +extern "C" void DemoDu_SaveState(SaveStateCtx* ctx); +extern "C" void DemoKekkai_SaveState(SaveStateCtx* ctx); +extern "C" void DoorWarp1_SaveState(SaveStateCtx* ctx); +extern "C" void EnBw_SaveState(SaveStateCtx* ctx); +extern "C" void EnClearTag_SaveState(SaveStateCtx* ctx); +extern "C" void EnFr_SaveState(SaveStateCtx* ctx); +extern "C" void EnGoma_SaveState(SaveStateCtx* ctx); +extern "C" void EnInsect_SaveState(SaveStateCtx* ctx); +extern "C" void EnIshi_SaveState(SaveStateCtx* ctx); +extern "C" void EnNiw_SaveState(SaveStateCtx* ctx); +extern "C" void EnPoField_SaveState(SaveStateCtx* ctx); +extern "C" void EnTakaraMan_SaveState(SaveStateCtx* ctx); +extern "C" void EnXc_SaveState(SaveStateCtx* ctx); +extern "C" void EnZf_SaveState(SaveStateCtx* ctx); +extern "C" void EnZl3_SaveState(SaveStateCtx* ctx); +extern "C" void ObjectKankyo_SaveState(SaveStateCtx* ctx); +extern "C" void EnHeishi1_SaveState(SaveStateCtx* ctx); -typedef struct { - /* 0x000 */ s32 numOccupied; - /* 0x004 */ s32 searchIndex; - /* 0x008 */ LightNode buf[LIGHTS_BUFFER_SIZE]; -} LightsBuffer; // size = 0x188 +extern "C" void Matrix_SaveState(SaveStateCtx* ctx); +extern "C" void Lights_SaveState(SaveStateCtx* ctx); +extern "C" void MapMark_SaveState(SaveStateCtx* ctx); +extern "C" void Camera_SaveState(SaveStateCtx* ctx); +extern "C" void OnePointCutscene_SaveState(SaveStateCtx* ctx); +extern "C" void Environment_SaveState(SaveStateCtx* ctx); +extern "C" void MapExp_SaveState(SaveStateCtx* ctx); +extern "C" void AudioOca_SaveState(SaveStateCtx* ctx); +extern "C" void MessagePAL_SaveState(SaveStateCtx* ctx); -#include "savestates_extern.inc" +static void SaveOverlayState(std::unique_ptr& buf, void (*fn)(SaveStateCtx*)) { + SaveStateCtx ctx = {}; + ctx.mode = SHIP_SAVESTATE_MEASURE; + fn(&ctx); + buf = std::make_unique(ctx.offset); + ctx.mode = SHIP_SAVESTATE_SAVE; + ctx.buffer = buf.get(); + ctx.offset = 0; + fn(&ctx); +} + +static void LoadOverlayState(std::unique_ptr& buf, void (*fn)(SaveStateCtx*)) { + SaveStateCtx ctx = {}; + ctx.mode = SHIP_SAVESTATE_LOAD; + ctx.buffer = buf.get(); + ctx.offset = 0; + fn(&ctx); +} typedef struct SaveStateInfo { unsigned char sysHeapCopy[SYSTEM_HEAP_SIZE]; @@ -39,12 +83,8 @@ typedef struct SaveStateInfo { SaveContext saveContextCopy; GameInfo gameInfoCopy; - LightsBuffer lightBufferCopy; AudioContext audioContextCopy; - MtxF mtxStackCopy[20]; // always 20 matricies - MtxF currentMtxCopy; uint32_t rngSeed; - int16_t blueWarpTimerCopy; /* From door_warp_1 */ SeqScriptState seqScriptStateCopy[4]; // Unrelocated ActiveSequence gActiveSeqsCopy[4]; @@ -58,270 +98,49 @@ typedef struct SaveStateInfo { uint16_t gAudioSfxSwapTarget_copy[10]; uint8_t gAudioSfxSwapMode_copy[10]; void (*D_801755D0_copy)(void); - MapMarkData** sLoadedMarkDataTableCopy; - // Static Data - - // Camera data - int32_t sInitRegs_copy; - int32_t gDbgCamEnabled_copy; - int32_t sDbgModeIdx_copy; - int16_t sNextUID_copy; - int32_t sCameraInterfaceFlags_copy; - int32_t sCameraInterfaceAlpha_copy; - int32_t sCameraShrinkWindowVal_copy; - int32_t D_8011D3AC_copy; - int32_t sDemo5PrevAction12Frame_copy; - int32_t sDemo5PrevSfxFrame_copy; - int32_t D_8011D3F0_copy; - OnePointCsFull D_8011D6AC_copy[3]; - OnePointCsFull D_8011D724_copy[3]; - OnePointCsFull D_8011D79C_copy[3]; - OnePointCsFull D_8011D83C_copy[2]; - OnePointCsFull D_8011D88C_copy[2]; - OnePointCsFull D_8011D8DC_copy[3]; - OnePointCsFull D_8011D954_copy[4]; - OnePointCsFull D_8011D9F4_copy[3]; - int16_t depthPhase_copy; - int16_t screenPlanePhase_copy; - int32_t sOOBTimer_copy; - f32 D_8015CE50_copy; - f32 D_8015CE54_copy; - CamColChk D_8015CE58_copy; - - // Gameover - uint16_t gGameOverTimer_copy; - - // One point demo - uint32_t sPrevFrameCs1100_copy; - CutsceneCameraPoint D_8012013C_copy[14]; - CutsceneCameraPoint D_8012021C_copy[14]; - CutsceneCameraPoint D_801204D4_copy[14]; - CutsceneCameraPoint D_801205B4_copy[14]; - OnePointCsFull D_801208EC_copy[3]; - OnePointCsFull D_80120964_copy[2]; - OnePointCsFull D_801209B4_copy[4]; - OnePointCsFull D_80120ACC_copy[5]; - OnePointCsFull D_80120B94_copy[11]; - OnePointCsFull D_80120D4C_copy[7]; - OnePointCsFull D_80120FA4_copy[6]; - OnePointCsFull D_80121184_copy[2]; - OnePointCsFull D_801211D4_copy[2]; - OnePointCsFull D_8012133C_copy[3]; - OnePointCsFull D_801213B4_copy[5]; - OnePointCsFull D_8012151C_copy[2]; - OnePointCsFull D_8012156C_copy[2]; - OnePointCsFull D_801215BC_copy[1]; - OnePointCsFull D_80121C24_copy[7]; - OnePointCsFull D_80121D3C_copy[3]; - OnePointCsFull D_80121F1C_copy[4]; - OnePointCsFull D_80121FBC_copy[4]; - OnePointCsFull D_801220D4_copy[5]; - OnePointCsFull D_80122714_copy[4]; - OnePointCsFull D_80122CB4_copy[2]; - OnePointCsFull D_80122D04_copy[2]; - OnePointCsFull D_80122E44_copy[2][7]; - OnePointCsFull D_8012313C_copy[3]; - OnePointCsFull D_801231B4_copy[4]; - OnePointCsFull D_80123254_copy[2]; - OnePointCsFull D_801232A4_copy[1]; - OnePointCsFull D_80123894_copy[3]; - OnePointCsFull D_8012390C_copy[2]; - OnePointCsFull D_8012395C_copy[3]; - OnePointCsFull D_801239D4_copy[3]; - - uint16_t gTimeIncrement_copy; + // Static data (per-translation-unit, serialized via SHIP_SAVESTATE_DEFINE) + std::unique_ptr matrixState; + std::unique_ptr lightsState; + std::unique_ptr doorWarp1State; + std::unique_ptr mapMarkState; + std::unique_ptr cameraState; + std::unique_ptr onePointCutsceneState; + std::unique_ptr environmentState; + std::unique_ptr mapExpState; + std::unique_ptr audioOcaState; + std::unique_ptr messagePalState; // Overlay static data - // z_bg_ddan_kd - Vec3f sBgDdanKdVelocity_copy; - Vec3f sBgDdanKdAccel_copy; - - // z_bg_dodoago - s16 sBgDodoagoFirstExplosiveFlag_copy; - u8 sBgDodoagoDisableBombCatcher_copy; - s32 sBgDodoagoTimer_copy; - - // z_bg_haka_trap - uint32_t D_80880F30_copy; - uint32_t D_80881014_copy; - - // z_bg_hidan_rock - float D_8088BFC0_copy; - - // z_bg_menkuri_eye - int32_t D_8089C1A0_copy; - - // z_bg_mori_hineri - int16_t sBgMoriHineriNextCamIdx_copy; - - // z_bg_po_event - uint8_t sBgPoEventBlocksAtRest_copy; - uint8_t sBgPoEventPuzzleState_copy; - float sBgPoEventblockPushDist_copy; - - // z_bg_relay_objects - uint32_t D_808A9508_copy; - - // z_bg_spot18_basket - int16_t D_808B85D0_copy; - - // z_boss_ganon - uint32_t sBossGanonSeed1_copy; - uint32_t sBossGanonSeed2_copy; - uint32_t sBossGanonSeed3_copy; - void* sBossGanonGanondorf_copy; - void* sBossGanonZelda_copy; - void* sBossGanonCape_copy; - GanondorfEffect sBossGanonEffectBuf_copy[200]; - - // z_boss_ganon - uint32_t sBossGanonSeed1; - uint32_t sBossGanonSeed2; - uint32_t sBossGanonSeed3; - void* sBossGanonGanondorf; - void* sBossGanonZelda; - void* sBossGanonCape; - GanondorfEffect sBossGanonEffectBuf[200]; - - // z_boss_ganon2 - Vec3f D_8090EB20_copy; - int8_t D_80910638_copy; - void* sBossGanon2Zelda_copy; - void* D_8090EB30_copy; - int32_t sBossGanon2Seed1_copy; - int32_t sBossGanon2Seed2_copy; - int32_t sBossGanon2Seed3_copy; - Vec3f D_809105D8_copy[4]; - Vec3f D_80910608_copy[4]; - BossGanon2Effect sBossGanon2Particles_copy[100]; - - // z_boss_tw - uint8_t sTwInitalized_copy; - BossTwEffect sTwEffects_copy[150]; - - // z_demo_6k - Vec3f sDemo6kVelocity_copy; - - // z_demo_du - int32_t D_8096CE94_copy; - - // z_demo_kekkai - Vec3f demoKekkaiVel_copy; - - // z_en_bw - int32_t sSlugGroup_copy; - - // z_en_clear_tag - uint8_t sClearTagIsEffectInitialized_copy; - EnClearTagEffect sClearTagEffects_copy[CLEAR_TAG_EFFECT_MAX_COUNT]; - - // z_en_fr - EnFrPointers sEnFrPointers_copy; - - // z_en_goma - uint8_t sSpawnNum_copy; - - // z_en_insect - float D_80A7DEB0_copy; - int16_t D_80A7DEB4_copy; - int16_t D_80A7DEB8_copy; - - // z_en_ishi - int16_t sRockRotSpeedX_copy; - int16_t sRockRotSpeedY_copy; - - // z_en_niw - int16_t D_80AB85E0_copy; - uint8_t sLowerRiverSpawned_copy; - uint8_t sUpperRiverSpawned_copy; - - // z_en_po_field - int32_t sEnPoFieldNumSpawned_copy; - Vec3s sEnPoFieldSpawnPositions_copy[10]; - u8 sEnPoFieldSpawnSwitchFlags_copy[10]; - - // z_en_takara_man - uint8_t sTakaraIsInitialized_copy; - - // z_en_xc - int32_t D_80B41D90_copy; - int32_t sEnXcFlameSpawned_copy; - int32_t D_80B41DA8_copy; - int32_t D_80B41DAC_copy; - - // z_en_zf - int16_t D_80B4A1B0_copy; - int16_t D_80B4A1B4_copy; - - int32_t D_80B5A468_copy; - int32_t D_80B5A494_copy; - int32_t D_80B5A4BC_copy; - - uint8_t sKankyoIsSpawned_copy; - int16_t sTrailingFairies_copy; - - // z_en_heishi1 - uint32_t sHeishi1PlayerIsCaughtCopy; - - // Misc static data - // z_map_exp - - s16 sPlayerInitialPosX_copy; - s16 sPlayerInitialPosZ_copy; - s16 sPlayerInitialDirection_copy; - - // code_800E(something. fill me in later) - u8 sOcarinaInpEnabled_copy; - s8 D_80130F10_copy; - u8 sCurOcarinaBtnVal_copy; - u8 sPrevOcarinaNoteVal_copy; - u8 sCurOcarinaBtnIdx_copy; - u8 sLearnSongLastBtn_copy; - f32 D_80130F24_copy; - f32 D_80130F28_copy; - s8 D_80130F2C_copy; - s8 D_80130F30_copy; - s8 D_80130F34_copy; - u8 sDisplayedNoteValue_copy; - u8 sPlaybackState_copy; - u32 D_80130F3C_copy; - u32 sNotePlaybackTimer_copy; - u16 sPlaybackNotePos_copy; - u16 sStaffPlaybackPos_copy; - - u32 sCurOcarinaBtnPress_copy; - u32 D_8016BA10_copy; - u32 sPrevOcarinaBtnPress_copy; - s32 D_8016BA18_copy; - s32 D_8016BA1C_copy; - u8 sCurOcarinaSong_copy[8]; - u8 sOcarinaSongAppendPos_copy; - u8 sOcarinaHasStartedSong_copy; - u8 sOcarinaSongNoteStartIdx_copy; - u8 sOcarinaSongCnt_copy; - u16 sOcarinaAvailSongs_copy; - u8 sStaffPlayingPos_copy; - u16 sLearnSongPos_copy[0x10]; - u16 D_8016BA50_copy[0x10]; - u16 D_8016BA70_copy[0x10]; - u8 sLearnSongExpectedNote_copy[0x10]; - OcarinaNote D_8016BAA0_copy; - u8 sAudioHasMalonBgm_copy; - f32 sAudioMalonBgmDist_copy; - - // Message_PAL - s16 sOcarinaNoteBufPos_copy; - s16 sOcarinaNoteBufLen_copy; - u8 sOcarinaNoteBuf_copy[12]; - - u8 D_8014B2F4_copy; - u8 sTextboxSkipped_copy; - u16 sNextTextId_copy; - s16 sLastPlayedSong_copy; - s16 sHasSunsSong_copy; - s16 sMessageHasSetSfx_copy; - u16 sOcarinaSongBitFlags_copy; + std::unique_ptr bgDdanKdState; + std::unique_ptr bgDodoagoState; + std::unique_ptr bgHakaTrapState; + std::unique_ptr bgHidanRockState; + std::unique_ptr bgMenkuriEyeState; + std::unique_ptr bgMoriHineriState; + std::unique_ptr bgPoEventState; + std::unique_ptr bgRelayObjectsState; + std::unique_ptr bgSpot18BasketState; + std::unique_ptr bossGanonState; + std::unique_ptr bossGanon2State; + std::unique_ptr bossTwState; + std::unique_ptr demo6kState; + std::unique_ptr demoDuState; + std::unique_ptr demoKekkaiState; + std::unique_ptr enBwState; + std::unique_ptr enClearTagState; + std::unique_ptr enFrState; + std::unique_ptr enGomaState; + std::unique_ptr enInsectState; + std::unique_ptr enIshiState; + std::unique_ptr enNiwState; + std::unique_ptr enPoFieldState; + std::unique_ptr enTakaraManState; + std::unique_ptr enXcState; + std::unique_ptr enZfState; + std::unique_ptr enZl3State; + std::unique_ptr objectKankyoState; + std::unique_ptr enHeishi1State; u8 transitionActorCount_copy; s16 transitionActorIds_copy[256]; @@ -343,14 +162,8 @@ class SaveState { void Load(void); void BackupSeqScriptState(void); void LoadSeqScriptState(void); - void BackupCameraData(void); - void LoadCameraData(void); - void SaveOnePointDemoData(void); - void LoadOnePointDemoData(void); void SaveOverlayStaticData(void); void LoadOverlayStaticData(void); - void SaveMiscCodeData(void); - void LoadMiscCodeData(void); void SaveTransitionActors(void); void LoadTransitionActors(void); @@ -419,401 +232,88 @@ void SaveState::LoadSeqScriptState(void) { } } -void SaveState::BackupCameraData(void) { - info->sInitRegs_copy = sInitRegs; - info->gDbgCamEnabled_copy = gDbgCamEnabled; - info->sNextUID_copy = sNextUID; - info->sCameraInterfaceFlags_copy = sCameraInterfaceFlags; - info->sCameraInterfaceAlpha_copy = sCameraInterfaceAlpha; - info->sCameraShrinkWindowVal_copy = sCameraShrinkWindowVal; - info->D_8011D3AC_copy = D_8011D3AC; - info->sDemo5PrevAction12Frame_copy = sDemo5PrevAction12Frame; - info->sDemo5PrevSfxFrame_copy = sDemo5PrevSfxFrame; - info->D_8011D3F0_copy = D_8011D3F0; - memcpy(info->D_8011D6AC_copy, D_8011D6AC, sizeof(info->D_8011D6AC_copy)); - memcpy(info->D_8011D724_copy, D_8011D724, sizeof(info->D_8011D724_copy)); - memcpy(info->D_8011D79C_copy, D_8011D79C, sizeof(info->D_8011D79C_copy)); - memcpy(info->D_8011D83C_copy, D_8011D83C, sizeof(info->D_8011D83C_copy)); - memcpy(info->D_8011D88C_copy, D_8011D88C, sizeof(info->D_8011D88C_copy)); - memcpy(info->D_8011D8DC_copy, D_8011D8DC, sizeof(info->D_8011D8DC_copy)); - memcpy(info->D_8011D954_copy, D_8011D954, sizeof(info->D_8011D954_copy)); - memcpy(info->D_8011D9F4_copy, D_8011D9F4, sizeof(info->D_8011D9F4_copy)); - info->depthPhase_copy = depthPhase; - info->screenPlanePhase_copy = screenPlanePhase; - info->sOOBTimer_copy = sOOBTimer; - info->D_8015CE50_copy = D_8015CE50; - info->D_8015CE54_copy = D_8015CE54; - memcpy(&info->D_8015CE58_copy, &D_8015CE58, sizeof(info->D_8015CE58_copy)); -} - -void SaveState::LoadCameraData(void) { - sInitRegs = info->sInitRegs_copy; - gDbgCamEnabled = info->gDbgCamEnabled_copy; - sDbgModeIdx = info->sDbgModeIdx_copy; - sNextUID = info->sNextUID_copy; - sCameraInterfaceAlpha = info->sCameraInterfaceAlpha_copy; - sCameraInterfaceFlags = info->sCameraInterfaceFlags_copy; - sCameraShrinkWindowVal = info->sCameraShrinkWindowVal_copy; - D_8011D3AC = info->D_8011D3AC_copy; - sDemo5PrevAction12Frame = info->sDemo5PrevAction12Frame_copy; - sDemo5PrevSfxFrame = info->sDemo5PrevSfxFrame_copy; - D_8011D3F0 = info->D_8011D3F0_copy; - memcpy(D_8011D6AC, info->D_8011D6AC_copy, sizeof(info->D_8011D6AC_copy)); - memcpy(D_8011D724, info->D_8011D724_copy, sizeof(info->D_8011D724_copy)); - memcpy(D_8011D79C, info->D_8011D79C_copy, sizeof(info->D_8011D79C_copy)); - memcpy(D_8011D83C, info->D_8011D83C_copy, sizeof(info->D_8011D83C_copy)); - memcpy(D_8011D88C, info->D_8011D88C_copy, sizeof(info->D_8011D88C_copy)); - memcpy(D_8011D8DC, info->D_8011D8DC_copy, sizeof(info->D_8011D8DC_copy)); - memcpy(D_8011D954, info->D_8011D954_copy, sizeof(info->D_8011D954_copy)); - memcpy(D_8011D9F4, info->D_8011D9F4_copy, sizeof(info->D_8011D9F4_copy)); - depthPhase = info->depthPhase_copy; - screenPlanePhase = info->screenPlanePhase_copy; - sOOBTimer = info->sOOBTimer_copy; - D_8015CE50 = info->D_8015CE50_copy; - D_8015CE54 = info->D_8015CE54_copy; - memcpy(&D_8015CE58, &info->D_8015CE58_copy, sizeof(info->D_8015CE58_copy)); -} - -void SaveState::SaveOnePointDemoData(void) { - info->sPrevFrameCs1100_copy = sPrevFrameCs1100; - memcpy(info->D_8012013C_copy, D_8012013C, sizeof(info->D_8012013C_copy)); - memcpy(info->D_8012021C_copy, D_8012021C, sizeof(info->D_8012021C_copy)); - memcpy(info->D_801204D4_copy, D_801204D4, sizeof(info->D_801204D4_copy)); - memcpy(info->D_801205B4_copy, D_801205B4, sizeof(info->D_801205B4_copy)); - memcpy(info->D_801208EC_copy, D_801208EC, sizeof(info->D_801208EC_copy)); - memcpy(info->D_80120964_copy, D_80120964, sizeof(info->D_80120964_copy)); - memcpy(info->D_801209B4_copy, D_801209B4, sizeof(info->D_801209B4_copy)); - memcpy(info->D_80120ACC_copy, D_80120ACC, sizeof(info->D_80120ACC_copy)); - memcpy(info->D_80120B94_copy, D_80120B94, sizeof(info->D_80120B94_copy)); - memcpy(info->D_80120D4C_copy, D_80120D4C, sizeof(info->D_80120D4C_copy)); - memcpy(info->D_80120FA4_copy, D_80120FA4, sizeof(info->D_80120FA4_copy)); - memcpy(info->D_80121184_copy, D_80121184, sizeof(info->D_80121184_copy)); - memcpy(info->D_801211D4_copy, D_801211D4, sizeof(info->D_801211D4_copy)); - memcpy(info->D_8012133C_copy, D_8012133C, sizeof(info->D_8012133C_copy)); - memcpy(info->D_801213B4_copy, D_801213B4, sizeof(info->D_801213B4_copy)); - memcpy(info->D_8012151C_copy, D_8012151C, sizeof(info->D_8012151C_copy)); - memcpy(info->D_8012156C_copy, D_8012156C, sizeof(info->D_8012156C_copy)); - memcpy(info->D_801215BC_copy, D_801215BC, sizeof(info->D_801215BC_copy)); - memcpy(info->D_80121C24_copy, D_80121C24, sizeof(info->D_80121C24_copy)); - memcpy(info->D_80121D3C_copy, D_80121D3C, sizeof(info->D_80121D3C_copy)); - memcpy(info->D_80121F1C_copy, D_80121F1C, sizeof(info->D_80121F1C_copy)); - memcpy(info->D_80121FBC_copy, D_80121FBC, sizeof(info->D_80121FBC_copy)); - memcpy(info->D_801220D4_copy, D_801220D4, sizeof(info->D_801220D4_copy)); - memcpy(info->D_80122714_copy, D_80122714, sizeof(info->D_80122714_copy)); - memcpy(info->D_80122CB4_copy, D_80122CB4, sizeof(info->D_80122CB4_copy)); - memcpy(info->D_80122D04_copy, D_80122D04, sizeof(info->D_80122D04_copy)); - memcpy(info->D_80122E44_copy, D_80122E44, sizeof(info->D_80122E44_copy)); - memcpy(info->D_8012313C_copy, D_8012313C, sizeof(info->D_8012313C_copy)); - memcpy(info->D_801231B4_copy, D_801231B4, sizeof(info->D_801231B4_copy)); - memcpy(info->D_80123254_copy, D_80123254, sizeof(info->D_80123254_copy)); - memcpy(info->D_801232A4_copy, D_801232A4, sizeof(info->D_801232A4_copy)); - memcpy(info->D_80123894_copy, D_80123894, sizeof(info->D_80123894_copy)); - memcpy(info->D_8012390C_copy, D_8012390C, sizeof(info->D_8012390C_copy)); - memcpy(info->D_8012395C_copy, D_8012395C, sizeof(info->D_8012395C_copy)); - memcpy(info->D_801239D4_copy, D_801239D4, sizeof(info->D_801239D4_copy)); -} - -void SaveState::LoadOnePointDemoData(void) { - sPrevFrameCs1100 = info->sPrevFrameCs1100_copy; - memcpy(D_8012013C, info->D_8012013C_copy, sizeof(info->D_8012013C_copy)); - memcpy(D_8012021C, info->D_8012021C_copy, sizeof(info->D_8012021C_copy)); - memcpy(D_801204D4, info->D_801204D4_copy, sizeof(info->D_801204D4_copy)); - memcpy(D_801205B4, info->D_801205B4_copy, sizeof(info->D_801205B4_copy)); - memcpy(D_801208EC, info->D_801208EC_copy, sizeof(info->D_801208EC_copy)); - memcpy(D_80120964, info->D_80120964_copy, sizeof(info->D_80120964_copy)); - memcpy(D_801209B4, info->D_801209B4_copy, sizeof(info->D_801209B4_copy)); - memcpy(D_80120ACC, info->D_80120ACC_copy, sizeof(info->D_80120ACC_copy)); - memcpy(D_80120B94, info->D_80120B94_copy, sizeof(info->D_80120B94_copy)); - memcpy(D_80120D4C, info->D_80120D4C_copy, sizeof(info->D_80120D4C_copy)); - memcpy(D_80120FA4, info->D_80120FA4_copy, sizeof(info->D_80120FA4_copy)); - memcpy(D_80121184, info->D_80121184_copy, sizeof(info->D_80121184_copy)); - memcpy(D_801211D4, info->D_801211D4_copy, sizeof(info->D_801211D4_copy)); - memcpy(D_8012133C, info->D_8012133C_copy, sizeof(info->D_8012133C_copy)); - memcpy(D_801213B4, info->D_801213B4_copy, sizeof(info->D_801213B4_copy)); - memcpy(D_8012151C, info->D_8012151C_copy, sizeof(info->D_8012151C_copy)); - memcpy(D_8012156C, info->D_8012156C_copy, sizeof(info->D_8012156C_copy)); - memcpy(D_801215BC, info->D_801215BC_copy, sizeof(info->D_801215BC_copy)); - memcpy(D_80121C24, info->D_80121C24_copy, sizeof(info->D_80121C24_copy)); - memcpy(D_80121D3C, info->D_80121D3C_copy, sizeof(info->D_80121D3C_copy)); - memcpy(D_80121F1C, info->D_80121F1C_copy, sizeof(info->D_80121F1C_copy)); - memcpy(D_80121FBC, info->D_80121FBC_copy, sizeof(info->D_80121FBC_copy)); - memcpy(D_801220D4, info->D_801220D4_copy, sizeof(info->D_801220D4_copy)); - memcpy(D_80122714, info->D_80122714_copy, sizeof(info->D_80122714_copy)); - memcpy(D_80122CB4, info->D_80122CB4_copy, sizeof(info->D_80122CB4_copy)); - memcpy(D_80122D04, info->D_80122D04_copy, sizeof(info->D_80122D04_copy)); - memcpy(D_80122E44, info->D_80122E44_copy, sizeof(info->D_80122E44_copy)); - memcpy(D_8012313C, info->D_8012313C_copy, sizeof(info->D_8012313C_copy)); - memcpy(D_801231B4, info->D_801231B4_copy, sizeof(info->D_801231B4_copy)); - memcpy(D_80123254, info->D_80123254_copy, sizeof(info->D_80123254_copy)); - memcpy(D_801232A4, info->D_801232A4_copy, sizeof(info->D_801232A4_copy)); - memcpy(D_80123894, info->D_80123894_copy, sizeof(info->D_80123894_copy)); - memcpy(D_8012390C, info->D_8012390C_copy, sizeof(info->D_8012390C_copy)); - memcpy(D_8012395C, info->D_8012395C_copy, sizeof(info->D_8012395C_copy)); - memcpy(D_801239D4, info->D_801239D4_copy, sizeof(info->D_801239D4_copy)); -} - void SaveState::SaveOverlayStaticData(void) { - info->sBgDdanKdVelocity_copy = sBgDdanKdVelocity; - info->sBgDdanKdAccel_copy = sBgDdanKdAccel; - info->sBgDodoagoFirstExplosiveFlag_copy = sBgDodoagoFirstExplosiveFlag; - info->sBgDodoagoDisableBombCatcher_copy = sBgDodoagoDisableBombCatcher; - info->sBgDodoagoTimer_copy = sBgDodoagoTimer; - info->D_80880F30_copy = D_80880F30; - info->D_80881014_copy = D_80881014; - info->D_8088BFC0_copy = D_8088BFC0; - info->sBgMoriHineriNextCamIdx_copy = sBgMoriHineriNextCamIdx; - info->sBgPoEventBlocksAtRest_copy = sBgPoEventBlocksAtRest; - info->sBgPoEventPuzzleState_copy = sBgPoEventPuzzleState; - info->sBgPoEventblockPushDist_copy = sBgPoEventblockPushDist; - info->D_808A9508_copy = D_808A9508; - info->D_808B85D0_copy = D_808B85D0; - info->sBossGanonSeed1_copy = sBossGanonSeed1; - info->sBossGanonSeed2_copy = sBossGanonSeed2; - info->sBossGanonSeed3_copy = sBossGanonSeed3; - info->sBossGanonGanondorf_copy = sBossGanonGanondorf; - info->sBossGanonZelda_copy = sBossGanonZelda; - info->sBossGanonCape_copy = sBossGanonCape; - memcpy(info->sBossGanonEffectBuf_copy, sBossGanonEffectBuf, sizeof(info->sBossGanonEffectBuf_copy)); - info->D_8090EB20_copy = D_8090EB20; - info->D_80910638_copy = D_80910638; - info->sBossGanon2Zelda_copy = sBossGanon2Zelda; - info->D_8090EB30_copy = D_8090EB30; - info->sBossGanon2Seed1_copy = sBossGanon2Seed1; - info->sBossGanon2Seed2_copy = sBossGanon2Seed2; - info->sBossGanon2Seed3_copy = sBossGanon2Seed3; - memcpy(info->D_809105D8_copy, D_809105D8, sizeof(D_809105D8)); - memcpy(info->D_80910608_copy, D_80910608, sizeof(D_80910608)); - memcpy(info->sBossGanon2Particles_copy, sBossGanon2Particles, sizeof(sBossGanon2Particles)); - info->sTwInitalized_copy = sTwInitalized; - memcpy(info->sTwEffects_copy, sTwEffects, sizeof(sTwEffects)); - info->sDemo6kVelocity_copy = sDemo6kVelocity; - info->D_8096CE94_copy = D_8096CE94; - info->demoKekkaiVel_copy = demoKekkaiVel; - info->sSlugGroup_copy = sSlugGroup; - info->sClearTagIsEffectInitialized_copy = sClearTagIsEffectsInitialized; - memcpy(info->sClearTagEffects_copy, sClearTagEffects, sizeof(sClearTagEffects)); - - memcpy(&info->sEnFrPointers_copy, &sEnFrPointers, sizeof(info->sEnFrPointers_copy)); - info->sSpawnNum_copy = sSpawnNum; - - info->D_80A7DEB0_copy = D_80A7DEB0; - info->D_80A7DEB4_copy = D_80A7DEB4; - info->D_80A7DEB8_copy = D_80A7DEB8; - info->sRockRotSpeedX_copy = sRockRotSpeedX; - info->sRockRotSpeedY_copy = sRockRotSpeedY; - info->D_80AB85E0_copy = D_80AB85E0; - info->sLowerRiverSpawned_copy = sLowerRiverSpawned; - info->sUpperRiverSpawned_copy = sUpperRiverSpawned; - info->sEnPoFieldNumSpawned_copy = sEnPoFieldNumSpawned; - memcpy(info->sEnPoFieldSpawnPositions_copy, sEnPoFieldSpawnPositions, sizeof(info->sEnPoFieldSpawnPositions_copy)); - memcpy(info->sEnPoFieldSpawnSwitchFlags_copy, sEnPoFieldSpawnSwitchFlags, - sizeof(info->sEnPoFieldSpawnSwitchFlags_copy)); - - info->sTakaraIsInitialized_copy = sTakaraIsInitialized; - info->D_80B41D90_copy = D_80B41D90; - info->sEnXcFlameSpawned_copy = sEnXcFlameSpawned; - info->D_80B41DA8_copy = D_80B41DA8; - info->D_80B41DAC_copy = D_80B41DAC; - info->D_80B4A1B0_copy = D_80B4A1B0; - info->D_80B4A1B4_copy = D_80B4A1B4; - info->D_80B5A468_copy = D_80B5A468; - info->D_80B5A494_copy = D_80B5A494; - info->D_80B5A4BC_copy = D_80B5A4BC; - info->sKankyoIsSpawned_copy = sKankyoIsSpawned; - info->sTrailingFairies_copy = sTrailingFairies; - - info->sHeishi1PlayerIsCaughtCopy = sHeishi1PlayerIsCaught; + SaveOverlayState(info->matrixState, Matrix_SaveState); + SaveOverlayState(info->lightsState, Lights_SaveState); + SaveOverlayState(info->doorWarp1State, DoorWarp1_SaveState); + SaveOverlayState(info->mapMarkState, MapMark_SaveState); + SaveOverlayState(info->cameraState, Camera_SaveState); + SaveOverlayState(info->onePointCutsceneState, OnePointCutscene_SaveState); + SaveOverlayState(info->environmentState, Environment_SaveState); + SaveOverlayState(info->mapExpState, MapExp_SaveState); + SaveOverlayState(info->audioOcaState, AudioOca_SaveState); + SaveOverlayState(info->messagePalState, MessagePAL_SaveState); + SaveOverlayState(info->bgDdanKdState, BgDdanKd_SaveState); + SaveOverlayState(info->bgDodoagoState, BgDodoago_SaveState); + SaveOverlayState(info->bgHakaTrapState, BgHakaTrap_SaveState); + SaveOverlayState(info->bgHidanRockState, BgHidanRock_SaveState); + SaveOverlayState(info->bgMenkuriEyeState, BgMenkuriEye_SaveState); + SaveOverlayState(info->bgMoriHineriState, BgMoriHineri_SaveState); + SaveOverlayState(info->bgPoEventState, BgPoEvent_SaveState); + SaveOverlayState(info->bgRelayObjectsState, BgRelayObjects_SaveState); + SaveOverlayState(info->bgSpot18BasketState, BgSpot18Basket_SaveState); + SaveOverlayState(info->bossGanonState, BossGanon_SaveState); + SaveOverlayState(info->bossGanon2State, BossGanon2_SaveState); + SaveOverlayState(info->bossTwState, BossTw_SaveState); + SaveOverlayState(info->demo6kState, Demo6k_SaveState); + SaveOverlayState(info->demoDuState, DemoDu_SaveState); + SaveOverlayState(info->demoKekkaiState, DemoKekkai_SaveState); + SaveOverlayState(info->enBwState, EnBw_SaveState); + SaveOverlayState(info->enClearTagState, EnClearTag_SaveState); + SaveOverlayState(info->enFrState, EnFr_SaveState); + SaveOverlayState(info->enGomaState, EnGoma_SaveState); + SaveOverlayState(info->enInsectState, EnInsect_SaveState); + SaveOverlayState(info->enIshiState, EnIshi_SaveState); + SaveOverlayState(info->enNiwState, EnNiw_SaveState); + SaveOverlayState(info->enPoFieldState, EnPoField_SaveState); + SaveOverlayState(info->enTakaraManState, EnTakaraMan_SaveState); + SaveOverlayState(info->enXcState, EnXc_SaveState); + SaveOverlayState(info->enZfState, EnZf_SaveState); + SaveOverlayState(info->enZl3State, EnZl3_SaveState); + SaveOverlayState(info->objectKankyoState, ObjectKankyo_SaveState); + SaveOverlayState(info->enHeishi1State, EnHeishi1_SaveState); } void SaveState::LoadOverlayStaticData(void) { - sBgDdanKdVelocity = info->sBgDdanKdVelocity_copy; - sBgDdanKdAccel = info->sBgDdanKdAccel_copy; - sBgDodoagoFirstExplosiveFlag = info->sBgDodoagoFirstExplosiveFlag_copy; - sBgDodoagoDisableBombCatcher = info->sBgDodoagoDisableBombCatcher_copy; - sBgDodoagoTimer = info->sBgDodoagoTimer_copy; - D_80880F30 = info->D_80880F30_copy; - D_80881014 = info->D_80881014_copy; - D_8088BFC0 = info->D_8088BFC0_copy; - sBgMoriHineriNextCamIdx = info->sBgMoriHineriNextCamIdx_copy; - sBgPoEventBlocksAtRest = info->sBgPoEventBlocksAtRest_copy; - sBgPoEventPuzzleState = info->sBgPoEventPuzzleState_copy; - sBgPoEventblockPushDist = info->sBgPoEventblockPushDist_copy; - D_808A9508 = info->D_808A9508_copy; - D_808B85D0 = info->D_808B85D0_copy; - sBossGanonSeed1 = info->sBossGanonSeed1_copy; - sBossGanonSeed2 = info->sBossGanonSeed2_copy; - sBossGanonSeed3 = info->sBossGanonSeed3_copy; - sBossGanonGanondorf = info->sBossGanonGanondorf_copy; - sBossGanonZelda = info->sBossGanonZelda_copy; - sBossGanonCape = info->sBossGanonCape_copy; - memcpy(sBossGanonEffectBuf, info->sBossGanonEffectBuf_copy, sizeof(info->sBossGanonEffectBuf_copy)); - - D_8090EB20 = info->D_8090EB20_copy; - D_80910638 = info->D_80910638_copy; - sBossGanon2Zelda = info->sBossGanon2Zelda_copy; - D_8090EB30 = info->D_8090EB30_copy; - sBossGanon2Seed1 = info->sBossGanon2Seed1_copy; - sBossGanon2Seed2 = info->sBossGanon2Seed2_copy; - sBossGanon2Seed3 = info->sBossGanon2Seed3_copy; - memcpy(D_809105D8, info->D_809105D8_copy, sizeof(D_809105D8)); - memcpy(D_80910608, info->D_80910608_copy, sizeof(D_80910608)); - memcpy(sBossGanon2Particles, info->sBossGanon2Particles_copy, sizeof(sBossGanon2Particles)); - sTwInitalized = info->sTwInitalized_copy; - memcpy(sTwEffects, info->sTwEffects_copy, sizeof(sTwEffects)); - sDemo6kVelocity = info->sDemo6kVelocity_copy; - - D_8096CE94 = info->D_8096CE94_copy; - demoKekkaiVel = info->demoKekkaiVel_copy; - sSlugGroup = info->sSlugGroup_copy; - sClearTagIsEffectsInitialized = info->sClearTagIsEffectInitialized_copy; - memcpy(sClearTagEffects, info->sClearTagEffects_copy, sizeof(sClearTagEffects)); - - D_80A7DEB0 = info->D_80A7DEB0_copy; - D_80A7DEB4 = info->D_80A7DEB4_copy; - D_80A7DEB8 = info->D_80A7DEB8_copy; - sRockRotSpeedX = info->sRockRotSpeedX_copy; - sRockRotSpeedY = info->sRockRotSpeedY_copy; - D_80AB85E0 = info->D_80AB85E0_copy; - sLowerRiverSpawned = info->sLowerRiverSpawned_copy; - sUpperRiverSpawned = info->sUpperRiverSpawned_copy; - sEnPoFieldNumSpawned = info->sEnPoFieldNumSpawned_copy; - memcpy(sEnPoFieldSpawnPositions, info->sEnPoFieldSpawnPositions_copy, sizeof(info->sEnPoFieldSpawnPositions_copy)); - memcpy(sEnPoFieldSpawnSwitchFlags, info->sEnPoFieldSpawnSwitchFlags_copy, - sizeof(info->sEnPoFieldSpawnSwitchFlags_copy)); - - sTakaraIsInitialized = info->sTakaraIsInitialized_copy; - D_80B41D90 = info->D_80B41D90_copy; - sEnXcFlameSpawned = info->sEnXcFlameSpawned_copy; - D_80B41DA8 = info->D_80B41DA8_copy; - D_80B41DAC = info->D_80B41DAC_copy; - D_80B4A1B0 = info->D_80B4A1B0_copy; - D_80B4A1B4 = info->D_80B4A1B4_copy; - D_80B5A468 = info->D_80B5A468_copy; - D_80B5A494 = info->D_80B5A494_copy; - D_80B5A4BC = info->D_80B5A4BC_copy; - sKankyoIsSpawned = info->sKankyoIsSpawned_copy; - sTrailingFairies = info->sTrailingFairies_copy; - - sHeishi1PlayerIsCaught = info->sHeishi1PlayerIsCaughtCopy; -} - -void SaveState::SaveMiscCodeData(void) { - info->gGameOverTimer_copy = gGameOverTimer; - info->gTimeIncrement_copy = gTimeIncrement; - info->sLoadedMarkDataTableCopy = sLoadedMarkDataTable; - - info->sPlayerInitialPosX_copy = sPlayerInitialPosX; - info->sPlayerInitialPosZ_copy = sPlayerInitialPosZ; - info->sPlayerInitialDirection_copy = sPlayerInitialDirection; - - info->sOcarinaInpEnabled_copy = sOcarinaInpEnabled; - info->D_80130F10_copy = D_80130F10; - info->sCurOcarinaBtnVal_copy = sCurOcarinaBtnVal; - info->sPrevOcarinaNoteVal_copy = sPrevOcarinaNoteVal; - info->sCurOcarinaBtnIdx_copy = sCurOcarinaBtnIdx; - info->sLearnSongLastBtn_copy = sLearnSongLastBtn; - info->D_80130F24_copy = D_80130F24; - info->D_80130F28_copy = D_80130F28; - info->D_80130F2C_copy = D_80130F2C; - info->D_80130F30_copy = D_80130F30; - info->D_80130F34_copy = D_80130F34; - info->sPlaybackState_copy = sPlaybackState; - info->D_80130F3C_copy = D_80130F3C; - info->sNotePlaybackTimer_copy = sNotePlaybackTimer; - info->sPlaybackNotePos_copy = sPlaybackNotePos; - info->sStaffPlaybackPos_copy = sStaffPlaybackPos; - - info->sCurOcarinaBtnPress_copy = sCurOcarinaBtnPress; - info->D_8016BA10_copy = D_8016BA10; - info->sPrevOcarinaBtnPress_copy = sPrevOcarinaBtnPress; - info->D_8016BA18_copy = D_8016BA18; - info->D_8016BA1C_copy = D_8016BA1C; - memcpy(info->sCurOcarinaSong_copy, sCurOcarinaSong, sizeof(sCurOcarinaSong)); - info->sOcarinaSongAppendPos_copy = sOcarinaSongAppendPos; - info->sOcarinaHasStartedSong_copy = sOcarinaHasStartedSong; - info->sOcarinaSongNoteStartIdx_copy = sOcarinaSongNoteStartIdx; - info->sOcarinaSongCnt_copy = sOcarinaSongCnt; - info->sOcarinaAvailSongs_copy = sOcarinaAvailSongs; - info->sStaffPlayingPos_copy = sStaffPlayingPos; - memcpy(info->sLearnSongPos_copy, sLearnSongPos, sizeof(sLearnSongPos)); - memcpy(info->D_8016BA50_copy, D_8016BA50, sizeof(D_8016BA50)); - memcpy(info->D_8016BA70_copy, D_8016BA70, sizeof(D_8016BA70)); - memcpy(info->sLearnSongExpectedNote_copy, sLearnSongExpectedNote, sizeof(sLearnSongExpectedNote)); - memcpy(&info->D_8016BAA0_copy, &D_8016BAA0, sizeof(D_8016BAA0)); - info->sAudioHasMalonBgm_copy = sAudioHasMalonBgm; - info->sAudioMalonBgmDist_copy = sAudioMalonBgmDist; - info->sDisplayedNoteValue_copy = sDisplayedNoteValue; - - info->sOcarinaNoteBufPos_copy = sOcarinaNoteBufPos; - info->sOcarinaNoteBufLen_copy = sOcarinaNoteBufLen; - memcpy(info->sOcarinaNoteBuf_copy, sOcarinaNoteBuf, sizeof(sOcarinaNoteBuf)); - info->D_8014B2F4_copy = D_8014B2F4; - info->sTextboxSkipped_copy = sTextboxSkipped; - info->sNextTextId_copy = sNextTextId; - info->sLastPlayedSong_copy = sLastPlayedSong; - info->sHasSunsSong_copy = sHasSunsSong; - info->sMessageHasSetSfx_copy = sMessageHasSetSfx; - info->sOcarinaSongBitFlags_copy = sOcarinaSongBitFlags; -} - -void SaveState::LoadMiscCodeData(void) { - gGameOverTimer = info->gGameOverTimer_copy; - gTimeIncrement = info->gTimeIncrement_copy; - sLoadedMarkDataTable = info->sLoadedMarkDataTableCopy; - - sPlayerInitialPosX = info->sPlayerInitialPosX_copy; - sPlayerInitialPosZ = info->sPlayerInitialPosZ_copy; - sPlayerInitialDirection = info->sPlayerInitialDirection_copy; - - sOcarinaInpEnabled = info->sOcarinaInpEnabled_copy; - D_80130F10 = info->D_80130F10_copy; - sCurOcarinaBtnVal = info->sCurOcarinaBtnVal_copy; - sPrevOcarinaNoteVal = info->sPrevOcarinaNoteVal_copy; - sCurOcarinaBtnIdx = info->sCurOcarinaBtnIdx_copy; - sLearnSongLastBtn = info->sLearnSongLastBtn_copy; - D_80130F24 = info->D_80130F24_copy; - D_80130F28 = info->D_80130F28_copy; - D_80130F2C = info->D_80130F2C_copy; - D_80130F30 = info->D_80130F30_copy; - D_80130F34 = info->D_80130F34_copy; - sPlaybackState = info->sPlaybackState_copy; - D_80130F3C = info->D_80130F3C_copy; - sNotePlaybackTimer = info->sNotePlaybackTimer_copy; - sPlaybackNotePos = info->sPlaybackNotePos_copy; - sStaffPlaybackPos = info->sStaffPlaybackPos_copy; - - sCurOcarinaBtnPress = info->sCurOcarinaBtnPress_copy; - D_8016BA10 = info->D_8016BA10_copy; - sPrevOcarinaBtnPress = info->sPrevOcarinaBtnPress_copy; - D_8016BA18 = info->D_8016BA18_copy; - D_8016BA1C = info->D_8016BA1C_copy; - memcpy(sCurOcarinaSong, info->sCurOcarinaSong_copy, sizeof(sCurOcarinaSong)); - sOcarinaSongAppendPos = info->sOcarinaSongAppendPos_copy; - sOcarinaHasStartedSong = info->sOcarinaHasStartedSong_copy; - sOcarinaSongNoteStartIdx = info->sOcarinaSongNoteStartIdx_copy; - sOcarinaSongCnt = info->sOcarinaSongCnt_copy; - sOcarinaAvailSongs = info->sOcarinaAvailSongs_copy; - sStaffPlayingPos = info->sStaffPlayingPos_copy; - memcpy(info->sLearnSongPos_copy, info->sLearnSongPos_copy, sizeof(sLearnSongPos)); - memcpy(info->D_8016BA50_copy, info->D_8016BA50_copy, sizeof(D_8016BA50)); - memcpy(info->D_8016BA70_copy, info->D_8016BA70_copy, sizeof(D_8016BA70)); - memcpy(info->sLearnSongExpectedNote_copy, info->sLearnSongExpectedNote_copy, sizeof(sLearnSongExpectedNote)); - memcpy(&D_8016BAA0, &info->D_8016BAA0_copy, sizeof(D_8016BAA0)); - sAudioHasMalonBgm = info->sAudioHasMalonBgm_copy; - sAudioMalonBgmDist = info->sAudioMalonBgmDist_copy; - sDisplayedNoteValue = info->sDisplayedNoteValue_copy; - - sOcarinaNoteBufPos = info->sOcarinaNoteBufPos_copy; - sOcarinaNoteBufLen = info->sOcarinaNoteBufLen_copy; - memcpy(sOcarinaNoteBuf, info->sOcarinaNoteBuf_copy, sizeof(sOcarinaNoteBuf)); - - D_8014B2F4 = info->D_8014B2F4_copy; - sTextboxSkipped = info->sTextboxSkipped_copy; - sNextTextId = info->sNextTextId_copy; - sLastPlayedSong = info->sLastPlayedSong_copy; - sHasSunsSong = info->sHasSunsSong_copy; - sMessageHasSetSfx = info->sMessageHasSetSfx_copy; - sOcarinaSongBitFlags = info->sOcarinaSongBitFlags_copy; + LoadOverlayState(info->matrixState, Matrix_SaveState); + LoadOverlayState(info->lightsState, Lights_SaveState); + LoadOverlayState(info->doorWarp1State, DoorWarp1_SaveState); + LoadOverlayState(info->mapMarkState, MapMark_SaveState); + LoadOverlayState(info->cameraState, Camera_SaveState); + LoadOverlayState(info->onePointCutsceneState, OnePointCutscene_SaveState); + LoadOverlayState(info->environmentState, Environment_SaveState); + LoadOverlayState(info->mapExpState, MapExp_SaveState); + LoadOverlayState(info->audioOcaState, AudioOca_SaveState); + LoadOverlayState(info->messagePalState, MessagePAL_SaveState); + LoadOverlayState(info->bgDdanKdState, BgDdanKd_SaveState); + LoadOverlayState(info->bgDodoagoState, BgDodoago_SaveState); + LoadOverlayState(info->bgHakaTrapState, BgHakaTrap_SaveState); + LoadOverlayState(info->bgHidanRockState, BgHidanRock_SaveState); + LoadOverlayState(info->bgMenkuriEyeState, BgMenkuriEye_SaveState); + LoadOverlayState(info->bgMoriHineriState, BgMoriHineri_SaveState); + LoadOverlayState(info->bgPoEventState, BgPoEvent_SaveState); + LoadOverlayState(info->bgRelayObjectsState, BgRelayObjects_SaveState); + LoadOverlayState(info->bgSpot18BasketState, BgSpot18Basket_SaveState); + LoadOverlayState(info->bossGanonState, BossGanon_SaveState); + LoadOverlayState(info->bossGanon2State, BossGanon2_SaveState); + LoadOverlayState(info->bossTwState, BossTw_SaveState); + LoadOverlayState(info->demo6kState, Demo6k_SaveState); + LoadOverlayState(info->demoDuState, DemoDu_SaveState); + LoadOverlayState(info->demoKekkaiState, DemoKekkai_SaveState); + LoadOverlayState(info->enBwState, EnBw_SaveState); + LoadOverlayState(info->enClearTagState, EnClearTag_SaveState); + LoadOverlayState(info->enFrState, EnFr_SaveState); + LoadOverlayState(info->enGomaState, EnGoma_SaveState); + LoadOverlayState(info->enInsectState, EnInsect_SaveState); + LoadOverlayState(info->enIshiState, EnIshi_SaveState); + LoadOverlayState(info->enNiwState, EnNiw_SaveState); + LoadOverlayState(info->enPoFieldState, EnPoField_SaveState); + LoadOverlayState(info->enTakaraManState, EnTakaraMan_SaveState); + LoadOverlayState(info->enXcState, EnXc_SaveState); + LoadOverlayState(info->enZfState, EnZf_SaveState); + LoadOverlayState(info->enZl3State, EnZl3_SaveState); + LoadOverlayState(info->objectKankyoState, ObjectKankyo_SaveState); + LoadOverlayState(info->enHeishi1State, EnHeishi1_SaveState); } void SaveState::SaveTransitionActors(void) { @@ -926,16 +426,9 @@ void SaveState::Save(void) { memcpy(&info->saveContextCopy, &gSaveContext, sizeof(gSaveContext)); memcpy(&info->gameInfoCopy, gGameInfo, sizeof(*gGameInfo)); - memcpy(&info->lightBufferCopy, &sLightsBuffer, sizeof(sLightsBuffer)); - memcpy(&info->mtxStackCopy, sMatrixStack, sizeof(MtxF) * 20); - memcpy(&info->currentMtxCopy, sCurrentMatrix, sizeof(MtxF)); // Various static data - info->blueWarpTimerCopy = sWarpTimerTarget; - BackupCameraData(); - SaveOnePointDemoData(); SaveOverlayStaticData(); - SaveMiscCodeData(); SaveTransitionActors(); } @@ -950,10 +443,6 @@ void SaveState::Load(void) { memcpy(&gSaveContext, &info->saveContextCopy, sizeof(gSaveContext)); memcpy(gGameInfo, &info->gameInfoCopy, sizeof(*gGameInfo)); - memcpy(&sLightsBuffer, &info->lightBufferCopy, sizeof(sLightsBuffer)); - memcpy(sMatrixStack, &info->mtxStackCopy, sizeof(MtxF) * 20); - memcpy(sCurrentMatrix, &info->currentMtxCopy, sizeof(MtxF)); - sWarpTimerTarget = info->blueWarpTimerCopy; memcpy(gActiveSounds, info->gActiveSoundsCopy, sizeof(gActiveSounds)); memcpy(gSoundBankMuted, &info->gSoundBankMutedCopy, sizeof(info->gSoundBankMutedCopy)); @@ -966,9 +455,6 @@ void SaveState::Load(void) { // Various static data D_801755D0 = info->D_801755D0_copy; - LoadCameraData(); - LoadOnePointDemoData(); LoadOverlayStaticData(); - LoadMiscCodeData(); LoadTransitionActors(); } \ No newline at end of file diff --git a/soh/soh/Enhancements/savestates_extern.inc b/soh/soh/Enhancements/savestates_extern.inc deleted file mode 100644 index 33aeabf4c5..0000000000 --- a/soh/soh/Enhancements/savestates_extern.inc +++ /dev/null @@ -1,260 +0,0 @@ -extern "C" MtxF* sMatrixStack; -extern "C" MtxF* sCurrentMatrix; -extern "C" LightsBuffer sLightsBuffer; -extern "C" s16 sWarpTimerTarget; -extern "C" MapMarkData** sLoadedMarkDataTable; - -//Camera static data -extern "C" int32_t sInitRegs; -extern "C" int32_t gDbgCamEnabled; -extern "C" int32_t sDbgModeIdx; -extern "C" int16_t sNextUID; -extern "C" int32_t sCameraInterfaceFlags; -extern "C" int32_t sCameraInterfaceAlpha; -extern "C" int32_t sCameraShrinkWindowVal; -extern "C" int32_t D_8011D3AC; -extern "C" int32_t sDemo5PrevAction12Frame; -extern "C" int32_t sDemo5PrevSfxFrame; -extern "C" int32_t D_8011D3F0; -extern "C" OnePointCsFull D_8011D6AC[]; -extern "C" OnePointCsFull D_8011D724[]; -extern "C" OnePointCsFull D_8011D79C[]; -extern "C" OnePointCsFull D_8011D83C[]; -extern "C" OnePointCsFull D_8011D88C[]; -extern "C" OnePointCsFull D_8011D8DC[]; -extern "C" OnePointCsFull D_8011D954[]; -extern "C" OnePointCsFull D_8011D9F4[]; -extern "C" int16_t depthPhase; -extern "C" int16_t screenPlanePhase; -extern "C" int32_t sOOBTimer; -extern "C" f32 D_8015CE50; -extern "C" f32 D_8015CE54; -extern "C" CamColChk D_8015CE58; - -//Gameover -extern "C" uint16_t gGameOverTimer; - -//One Point Demo -extern "C" uint32_t sPrevFrameCs1100; -extern "C" CutsceneCameraPoint D_8012013C[14]; -extern "C" CutsceneCameraPoint D_8012021C[14]; -extern "C" CutsceneCameraPoint D_801204D4[14]; -extern "C" CutsceneCameraPoint D_801205B4[14]; -extern "C" OnePointCsFull D_801208EC[3]; -extern "C" OnePointCsFull D_80120964[2]; -extern "C" OnePointCsFull D_801209B4[4]; -extern "C" OnePointCsFull D_80120ACC[5]; -extern "C" OnePointCsFull D_80120B94[11]; -extern "C" OnePointCsFull D_80120D4C[7]; -extern "C" OnePointCsFull D_80120FA4[6]; -extern "C" OnePointCsFull D_80121184[2]; -extern "C" OnePointCsFull D_801211D4[2]; -extern "C" OnePointCsFull D_8012133C[3]; -extern "C" OnePointCsFull D_801213B4[5]; -extern "C" OnePointCsFull D_8012151C[2]; -extern "C" OnePointCsFull D_8012156C[2]; -extern "C" OnePointCsFull D_801215BC[1]; -extern "C" OnePointCsFull D_80121C24[7]; -extern "C" OnePointCsFull D_80121D3C[3]; -extern "C" OnePointCsFull D_80121F1C[4]; -extern "C" OnePointCsFull D_80121FBC[4]; -extern "C" OnePointCsFull D_801220D4[5]; -extern "C" OnePointCsFull D_80122714[4]; -extern "C" OnePointCsFull D_80122CB4[2]; -extern "C" OnePointCsFull D_80122D04[2]; -extern "C" OnePointCsFull D_80122E44[2][7]; -extern "C" OnePointCsFull D_8012313C[3]; -extern "C" OnePointCsFull D_801231B4[4]; -extern "C" OnePointCsFull D_80123254[2]; -extern "C" OnePointCsFull D_801232A4[1]; -extern "C" OnePointCsFull D_80123894[3]; -extern "C" OnePointCsFull D_8012390C[2]; -extern "C" OnePointCsFull D_8012395C[3]; -extern "C" OnePointCsFull D_801239D4[3]; - -// z_bg_ddan_kd -extern "C" Vec3f sBgDdanKdVelocity; -extern "C" Vec3f sBgDdanKdAccel; - -// z_bg_dodoago -extern "C" s16 sBgDodoagoFirstExplosiveFlag; -extern "C" u8 sBgDodoagoDisableBombCatcher; -extern "C" s32 sBgDodoagoTimer; - -// z_bg_haka_trap -extern "C" uint32_t D_80880F30; -extern "C" uint32_t D_80881014; - -// z_bg_hidan_rock -extern "C" float D_8088BFC0; - -// z_bg_menkuri_eye -extern "C" int32_t D_8089C1A0; - -// z_bg_mori_hineri -extern "C" int16_t sBgMoriHineriNextCamIdx; - -// z_bg_po_event -extern "C" uint8_t sBgPoEventBlocksAtRest; -extern "C" uint8_t sBgPoEventPuzzleState; -extern "C" float sBgPoEventblockPushDist; - -// z_bg_relay_objects -extern "C" uint32_t D_808A9508; - -// z_bg_spot18_basket -extern "C" int16_t D_808B85D0; - -// z_boss_ganon -extern "C" uint32_t sBossGanonSeed1; -extern "C" uint32_t sBossGanonSeed2; -extern "C" uint32_t sBossGanonSeed3; -extern "C" void* sBossGanonGanondorf; -extern "C" void* sBossGanonZelda; -extern "C" void* sBossGanonCape; -extern "C" GanondorfEffect sBossGanonEffectBuf[200]; - -// z_boss_ganon2 -extern "C" Vec3f D_8090EB20; -extern "C" int8_t D_80910638; -extern "C" void* sBossGanon2Zelda; -extern "C" void* D_8090EB30; -extern "C" int32_t sBossGanon2Seed1; -extern "C" int32_t sBossGanon2Seed2; -extern "C" int32_t sBossGanon2Seed3; -extern "C" Vec3f D_809105D8[4]; -extern "C" Vec3f D_80910608[4]; -extern "C" BossGanon2Effect sBossGanon2Particles[100]; - -// z_boss_tw -extern "C" uint8_t sTwInitalized; -extern "C" BossTwEffect sTwEffects[150]; - -// z_demo_6k -extern "C" Vec3f sDemo6kVelocity; - -// z_demo_du -extern "C" int32_t D_8096CE94; - -// z_demo_kekkai -extern "C" Vec3f demoKekkaiVel; - -// z_en_bw -extern "C" int32_t sSlugGroup; - -// z_en_clear_tag -extern "C" uint8_t sClearTagIsEffectsInitialized; -extern "C" EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT]; - -// z_en_fr -extern "C" EnFrPointers sEnFrPointers; - -// z_en_goma -extern "C" uint8_t sSpawnNum; - -// z_en_in -extern "C" int32_t D_80A7B998; - -// z_en_insect -extern "C" float D_80A7DEB0; -extern "C" int16_t D_80A7DEB4; -extern "C" int16_t D_80A7DEB8; - -// z_en_ishi -extern "C" int16_t sRockRotSpeedX; -extern "C" int16_t sRockRotSpeedY; - -// z_en_niw -extern "C" int16_t D_80AB85E0; -extern "C" uint8_t sLowerRiverSpawned; -extern "C" uint8_t sUpperRiverSpawned; - -// z_en_po_field -extern "C" int32_t sEnPoFieldNumSpawned; -extern "C" Vec3s sEnPoFieldSpawnPositions[10]; -extern "C" u8 sEnPoFieldSpawnSwitchFlags[10]; - -// z_en_takara_man -extern "C" uint8_t sTakaraIsInitialized; - -// z_en_xc -extern "C" int32_t D_80B41D90; -extern "C" int32_t sEnXcFlameSpawned; -extern "C" int32_t D_80B41DA8; -extern "C" int32_t D_80B41DAC; - -// z_en_zf -extern "C" int16_t D_80B4A1B0; -extern "C" int16_t D_80B4A1B4; - -extern "C" int32_t D_80B5A468; -extern "C" int32_t D_80B5A494; -extern "C" int32_t D_80B5A4BC; - -extern "C" uint8_t sKankyoIsSpawned; -extern "C" int16_t sTrailingFairies; - -extern "C" uint16_t gTimeIncrement; - -extern "C" s16 sPlayerInitialPosX; -extern "C" s16 sPlayerInitialPosZ; -extern "C" s16 sPlayerInitialDirection; - -// z_en_heishi1 -extern "C" s32 sHeishi1PlayerIsCaught; - -// code_800EC960 -// Related to ocarina -extern "C" u8 sOcarinaInpEnabled; -extern "C" s8 D_80130F10; -extern "C" u8 sCurOcarinaBtnVal; -extern "C" u8 sPrevOcarinaNoteVal; -extern "C" u8 sCurOcarinaBtnIdx; -extern "C" u8 sLearnSongLastBtn; -extern "C" f32 D_80130F24; -extern "C" f32 D_80130F28; -extern "C" s8 D_80130F2C; -extern "C" s8 D_80130F30; -extern "C" s8 D_80130F34; -extern "C" u8 sPlaybackState; -extern "C" u32 D_80130F3C; -extern "C" u32 sNotePlaybackTimer; -extern "C" u16 sPlaybackNotePos; -extern "C" u16 sStaffPlaybackPos; - -//IDK what this is but it looks important -extern "C" u32 sCurOcarinaBtnPress; -extern "C" u32 D_8016BA10; -extern "C" u32 sPrevOcarinaBtnPress; -extern "C" s32 D_8016BA18; -extern "C" s32 D_8016BA1C; -extern "C" u8 sCurOcarinaSong[8]; -extern "C" u8 sOcarinaSongAppendPos; -extern "C" u8 sOcarinaHasStartedSong; -extern "C" u8 sOcarinaSongNoteStartIdx; -extern "C" u8 sOcarinaSongCnt; -extern "C" u16 sOcarinaAvailSongs; -extern "C" u8 sStaffPlayingPos; -extern "C" u16 sLearnSongPos[0x10]; -extern "C" u16 D_8016BA50[0x10]; -extern "C" u16 D_8016BA70[0x10]; -extern "C" u8 sLearnSongExpectedNote[0x10]; -extern "C" OcarinaNote D_8016BAA0; -extern "C" u8 sAudioHasMalonBgm; -extern "C" f32 sAudioMalonBgmDist; -extern "C" u8 sDisplayedNoteValue; - - - -// z_message_PAL -extern "C" s16 sOcarinaNoteBufPos; -extern "C" s16 sOcarinaNoteBufLen; -extern "C" u8 sOcarinaNoteBuf[12]; - -extern "C" u8 D_8014B2F4; -extern "C" u8 sTextboxSkipped; -extern "C" u16 sNextTextId; -extern "C" s16 sLastPlayedSong; -extern "C" s16 sHasSunsSong; -extern "C" s16 sMessageHasSetSfx; -extern "C" u16 sOcarinaSongBitFlags; \ No newline at end of file diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index a9950908f1..406f3348e2 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -5,6 +5,7 @@ #include "soh/Enhancements/audio/AudioEditor.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" // TODO: can these macros be shared between files? code_800F9280 seems to use // versions without any casts... @@ -848,24 +849,24 @@ s32 sOcarinaB4BtnMap = BTN_CLEFT; s32 sOcarinaA4BtnMap = BTN_CRIGHT; s32 sOcarinaF4BtnMap = BTN_CDOWN; s32 sOcarinaD4BtnMap = BTN_A; -u8 sOcarinaInpEnabled = 0; -s8 D_80130F10 = 0; // "OCA", ocarina active? -u8 sCurOcarinaBtnVal = 0xFF; -u8 sPrevOcarinaNoteVal = 0; -u8 sCurOcarinaBtnIdx = 0; // note index? -u8 sLearnSongLastBtn = 0; -f32 D_80130F24 = 1.0f; +static u8 sOcarinaInpEnabled = 0; +static s8 D_80130F10 = 0; // "OCA", ocarina active? +static u8 sCurOcarinaBtnVal = 0xFF; +static u8 sPrevOcarinaNoteVal = 0; +static u8 sCurOcarinaBtnIdx = 0; // note index? +static u8 sLearnSongLastBtn = 0; +static f32 D_80130F24 = 1.0f; f32 D_80130F28 = 87.0f / 127.0f; -s8 D_80130F2C = 0; // pitch? -s8 D_80130F30 = 0x57; -s8 D_80130F34 = 0; -u8 sPlaybackState = 0; // 80130F38 -u32 D_80130F3C = 0; // "SEQ" -u32 sNotePlaybackTimer = 0; -u16 sPlaybackNotePos = 0; -u16 sStaffPlaybackPos = 0; +static s8 D_80130F2C = 0; // pitch? +static s8 D_80130F30 = 0x57; +static s8 D_80130F34 = 0; +static u8 sPlaybackState = 0; // 80130F38 +static u32 D_80130F3C = 0; // "SEQ" +static u32 sNotePlaybackTimer = 0; +static u16 sPlaybackNotePos = 0; +static u16 sStaffPlaybackPos = 0; u16 D_80130F4C = 0; -u8 sDisplayedNoteValue = 0xFF; // Note to display on screen? +static u8 sDisplayedNoteValue = 0xFF; // Note to display on screen? u8 sNotePlaybackVolume = 0; u8 sNotePlaybackVibrato = 0; s8 sNotePlaybackTone = 0; @@ -1231,25 +1232,64 @@ typedef struct { s8 y; } OcarinaStick; OcarinaStick sCurOcaStick; -u32 sCurOcarinaBtnPress; -u32 D_8016BA10; -u32 sPrevOcarinaBtnPress; -s32 D_8016BA18; -s32 D_8016BA1C; -u8 sCurOcarinaSong[8]; -u8 sOcarinaSongAppendPos; -u8 sOcarinaHasStartedSong; -u8 sOcarinaSongNoteStartIdx; -u8 sOcarinaSongCnt; -u16 sOcarinaAvailSongs; -u8 sStaffPlayingPos; -u16 sLearnSongPos[0x10]; -u16 D_8016BA50[0x10]; -u16 D_8016BA70[0x10]; -u8 sLearnSongExpectedNote[0x10]; -OcarinaNote D_8016BAA0; -u8 sAudioHasMalonBgm; -f32 sAudioMalonBgmDist; +static u32 sCurOcarinaBtnPress; +static u32 D_8016BA10; +static u32 sPrevOcarinaBtnPress; +static s32 D_8016BA18; +static s32 D_8016BA1C; +static u8 sCurOcarinaSong[8]; +static u8 sOcarinaSongAppendPos; +static u8 sOcarinaHasStartedSong; +static u8 sOcarinaSongNoteStartIdx; +static u8 sOcarinaSongCnt; +static u16 sOcarinaAvailSongs; +static u8 sStaffPlayingPos; +static u16 sLearnSongPos[0x10]; +static u16 D_8016BA50[0x10]; +static u16 D_8016BA70[0x10]; +static u8 sLearnSongExpectedNote[0x10]; +static OcarinaNote D_8016BAA0; +static u8 sAudioHasMalonBgm; +static f32 sAudioMalonBgmDist; + +#define AUDIO_OCA_SHIP_SAVESTATE_FIELDS(F) \ + F(sOcarinaInpEnabled) \ + F(D_80130F10) \ + F(sCurOcarinaBtnVal) \ + F(sPrevOcarinaNoteVal) \ + F(sCurOcarinaBtnIdx) \ + F(sLearnSongLastBtn) \ + F(D_80130F24) \ + F(D_80130F28) \ + F(D_80130F2C) \ + F(D_80130F30) \ + F(D_80130F34) \ + F(sPlaybackState) \ + F(D_80130F3C) \ + F(sNotePlaybackTimer) \ + F(sPlaybackNotePos) \ + F(sStaffPlaybackPos) \ + F(sCurOcarinaBtnPress) \ + F(D_8016BA10) \ + F(sPrevOcarinaBtnPress) \ + F(D_8016BA18) \ + F(D_8016BA1C) \ + F(sCurOcarinaSong) \ + F(sOcarinaSongAppendPos) \ + F(sOcarinaHasStartedSong) \ + F(sOcarinaSongNoteStartIdx) \ + F(sOcarinaSongCnt) \ + F(sOcarinaAvailSongs) \ + F(sStaffPlayingPos) \ + F(sLearnSongPos) \ + F(D_8016BA50) \ + F(D_8016BA70) \ + F(sLearnSongExpectedNote) \ + F(D_8016BAA0) \ + F(sAudioHasMalonBgm) \ + F(sAudioMalonBgmDist) \ + F(sDisplayedNoteValue) +SHIP_SAVESTATE_DEFINE(AudioOca, AUDIO_OCA_SHIP_SAVESTATE_FIELDS) // Start debug bss u32 sDebugPadHold; diff --git a/soh/src/code/code_800F9280.c b/soh/src/code/code_800F9280.c index 85d44ec4e8..90eaadda07 100644 --- a/soh/src/code/code_800F9280.c +++ b/soh/src/code/code_800F9280.c @@ -379,9 +379,6 @@ void Audio_ProcessSeqCmd(u32 cmd) { } } -extern f32 D_80130F24; -extern f32 D_80130F28; - void Audio_QueueSeqCmd(u32 cmd) { // Replacement is resolved per-command in func_800F9280(). sAudioSeqCmds[sSeqCmdWrPos++] = cmd; diff --git a/soh/src/code/sys_matrix.c b/soh/src/code/sys_matrix.c index 3e4798d2e1..a58e6dcc8a 100644 --- a/soh/src/code/sys_matrix.c +++ b/soh/src/code/sys_matrix.c @@ -1,6 +1,7 @@ #include "global.h" #include "soh/frame_interpolation.h" +#include "soh/Enhancements/savestate_serialize.h" #include // clang-format off @@ -19,8 +20,13 @@ MtxF gMtxFClear = { }; // clang-format on -MtxF* sMatrixStack; // "Matrix_stack" -MtxF* sCurrentMatrix; // "Matrix_now" +static MtxF* sMatrixStack; // "Matrix_stack" +static MtxF* sCurrentMatrix; // "Matrix_now" + +void Matrix_SaveState(SaveStateCtx* ctx) { + SaveState_Blob(ctx, sMatrixStack, sizeof(MtxF) * 20); + SaveState_Blob(ctx, sCurrentMatrix, sizeof(MtxF)); +} void Matrix_Init(GameState* gameState) { sCurrentMatrix = GAMESTATE_ALLOC_MC(gameState, 20 * sizeof(MtxF)); diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index 91283daf14..68bc909e20 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -9,6 +9,7 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/controls/Mouse.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags); s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags); @@ -573,9 +574,9 @@ s16 Camera_XZAngle(Vec3f* to, Vec3f* from) { return DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(from->x - to->x, from->z - to->z))); } -f32 D_8015CE50; -f32 D_8015CE54; -CamColChk D_8015CE58; +static f32 D_8015CE50; +static f32 D_8015CE54; +static CamColChk D_8015CE58; s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) { Vec3f playerPos; Vec3f rotatedPos; @@ -7424,8 +7425,8 @@ s32 Camera_DbgChangeMode(Camera* camera) { return true; } -s16 depthPhase = 0x3F0; -s16 screenPlanePhase = 0x156; +static s16 depthPhase = 0x3F0; +static s16 screenPlanePhase = 0x156; void Camera_UpdateDistortion(Camera* camera) { f32 scaleFactor; f32 speedFactor; @@ -7509,7 +7510,7 @@ void Camera_UpdateDistortion(Camera* camera) { } } -s32 sOOBTimer = 0; +static s32 sOOBTimer = 0; Vec3s Camera_Update(Camera* camera) { Vec3f viewAt; Vec3f viewEye; @@ -8353,3 +8354,31 @@ s16 func_8005B1A4(Camera* camera) { return camera->thisIdx; } + +#define CAMERA_SHIP_SAVESTATE_FIELDS(F) \ + F(sInitRegs) \ + F(gDbgCamEnabled) \ + F(sDbgModeIdx) \ + F(sNextUID) \ + F(sCameraInterfaceFlags) \ + F(sCameraInterfaceAlpha) \ + F(sCameraShrinkWindowVal) \ + F(D_8011D3AC) \ + F(sDemo5PrevAction12Frame) \ + F(sDemo5PrevSfxFrame) \ + F(D_8011D3F0) \ + F(D_8011D6AC) \ + F(D_8011D724) \ + F(D_8011D79C) \ + F(D_8011D83C) \ + F(D_8011D88C) \ + F(D_8011D8DC) \ + F(D_8011D954) \ + F(D_8011D9F4) \ + F(depthPhase) \ + F(screenPlanePhase) \ + F(sOOBTimer) \ + F(D_8015CE50) \ + F(D_8015CE54) \ + F(D_8015CE58) +SHIP_SAVESTATE_DEFINE(Camera, CAMERA_SHIP_SAVESTATE_FIELDS) diff --git a/soh/src/code/z_camera_data.inc b/soh/src/code/z_camera_data.inc index 90b1874c73..26ebf5f086 100644 --- a/soh/src/code/z_camera_data.inc +++ b/soh/src/code/z_camera_data.inc @@ -2220,16 +2220,16 @@ s32 (*sCameraFunctions[])(Camera*) = { Camera_Special9, }; -s32 sInitRegs = 1; +static s32 sInitRegs = 1; s32 gDbgCamEnabled = 0; -s32 sDbgModeIdx = -1; -s16 sNextUID = 0; +static s32 sDbgModeIdx = -1; +static s16 sNextUID = 0; -s32 sCameraInterfaceFlags = 1; +static s32 sCameraInterfaceFlags = 1; -s32 sCameraInterfaceAlpha = 0x02; -s32 sCameraShrinkWindowVal = 0x20; +static s32 sCameraInterfaceAlpha = 0x02; +static s32 sCameraShrinkWindowVal = 0x20; s32 D_8011D3AC = -1; s16 D_8011D3B0[] = { @@ -2242,9 +2242,9 @@ s16 D_8011D3CC[] = { s32 sUpdateCameraDirection = 0; s32 D_8011D3EC = 0; -s32 D_8011D3F0 = 0; +static s32 D_8011D3F0 = 0; -s32 sDemo5PrevAction12Frame = -16; +static s32 sDemo5PrevAction12Frame = -16; char sCameraFunctionNames[][8] = { "NONE ", "NORM0()", "NORM1()", "NORM2()", "NORM3()", "NORM4()", "PARA0()", "PARA1()", "PARA2()", "PARA3()", @@ -2274,10 +2274,10 @@ Vec3f D_8011D678[] = { /******************************************************* * OnePoint initalization values for Demo5 ********************************************************/ -s32 sDemo5PrevSfxFrame = -200; +static s32 sDemo5PrevSfxFrame = -200; // target is player, far from eye -OnePointCsFull D_8011D6AC[] = { +static OnePointCsFull D_8011D6AC[] = { { // initflags & 0x00FF (at): 2, atTarget is view lookAt + atInit // initFlags & 0xFF00 (eye): none // action: 15, copy at, eye, roll, fov to camera @@ -2319,14 +2319,14 @@ OnePointCsFull D_8011D6AC[] = { }; // target is player close to current eye -OnePointCsFull D_8011D724[] = { +static OnePointCsFull D_8011D724[] = { { 0x8F, 0xFF, 0x2424, 0x0001, 0x0000, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 10.0f, -20.0f } }, { 0x81, 0xFF, 0x2121, 0x0013, 0x0000, 50.0f, 1.0f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 60.0f } }, { 0x12, 0xFF, 0x0000, 0x0001, 0x0000, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; // target is close to player -OnePointCsFull D_8011D79C[] = { +static OnePointCsFull D_8011D79C[] = { { 0xCF, 0xFF, 0x0002, 0x0001, 0x0000, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0xC1, 0xFF, 0x0303, 0x0013, 0x0000, 45.0f, 1.0f, { 0.0f, -20.0f, 0.0f }, { 0.0f, -10.0f, 5.0f } }, { @@ -2344,7 +2344,7 @@ OnePointCsFull D_8011D79C[] = { }; // target is within 300 units of eye, and player is within 30 units of eye -OnePointCsFull D_8011D83C[] = { +static OnePointCsFull D_8011D83C[] = { { 0x83, 0xFF, 0x2141, 0x0014, 0x0000, 45.0f, 0.2f, { 0.0f, 0.0f, 10.0f }, { 0.0f, 0.0f, 10.0f } }, { 0x12, 0xFF, 0x0000, 0x0001, 0x0000, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; @@ -2352,20 +2352,20 @@ OnePointCsFull D_8011D83C[] = { // target is within 700 units of eye, angle between player/eye and target/eye is less than // 76.9 degrees. The x/y coordinates of the target on screen is between (21, 41) and (300, 200), // and the player is farther than 30 units of the eye -OnePointCsFull D_8011D88C[] = { +static OnePointCsFull D_8011D88C[] = { { 0x81, 0xFF, 0x0303, 0x0014, 0x0000, 45.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x12, 0xFF, 0x0000, 0x0001, 0x0000, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; // same as above, but the target is NOT within the screen area. -OnePointCsFull D_8011D8DC[] = { +static OnePointCsFull D_8011D8DC[] = { { 0x8F, 0xFF, 0x0404, 0x0014, 0x0001, 50.0f, 1.0f, { 0.0f, 5.0f, 10.0f }, { 0.0f, 10.0f, -80.0f } }, { 0x82, 0xFF, 0x2121, 0x0005, 0x0000, 60.0f, 1.0f, { 0.0f, 5.0f, 0.0f }, { 5.0f, 5.0f, -200.0f } }, { 0x12, 0xFF, 0x0000, 0x0001, 0x0000, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; // target is a door. -OnePointCsFull D_8011D954[] = { +static OnePointCsFull D_8011D954[] = { { 0x0F, 0xFF, 0xC1C1, 0x0014, 0x0000, 60.0f, 1.0f, { 0.0f, 0.0f, 50.0f }, { 0.0f, 0.0f, 250.0f } }, { 0x83, 0xFF, 0x05B1, 0x0005, 0x0000, 60.0f, 0.1f, { 0.0f, 10.0f, 50.0f }, { 0.0f, 10.0f, 100.0f } }, { 0x82, 0xFF, 0x2121, 0x0005, 0x0002, 60.0f, 1.0f, { 0.0f, 10.0f, 0.0f }, { 0.0f, 20.0f, -150.0f } }, @@ -2373,7 +2373,7 @@ OnePointCsFull D_8011D954[] = { }; // otherwise -OnePointCsFull D_8011D9F4[] = { +static OnePointCsFull D_8011D9F4[] = { { 0x8F, 0xFF, 0x0504, 0x0014, 0x0002, 60.0f, 1.0f, { 0.0f, 5.0f, 50.0f }, { 0.0f, 20.0f, 300.0f } }, { 0x82, 0xFF, 0x2121, 0x0005, 0x0002, 60.0f, 1.0f, { 0.0f, 10.0f, 0.0f }, { 0.0f, 20.0f, -150.0f } }, { 0x12, 0xFF, 0x0000, 0x0001, 0x0000, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index 9518213f2d..8a413f15c4 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -8,6 +8,7 @@ #include "soh/ResourceManagerHelpers.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" typedef enum { /* 0 */ LENS_FLARE_CIRCLE0, @@ -59,6 +60,9 @@ u8 gSkyboxBlendingEnabled = false; u16 gTimeIncrement = 0; +#define ENVIRONMENT_SHIP_SAVESTATE_FIELDS(F) F(gTimeIncrement) +SHIP_SAVESTATE_DEFINE(Environment, ENVIRONMENT_SHIP_SAVESTATE_FIELDS) + u16 D_8011FB44 = 0xFFFC; struct_8011FB48 D_8011FB48[][7] = { diff --git a/soh/src/code/z_lights.c b/soh/src/code/z_lights.c index 8a0fa68fd0..da5e0e9058 100644 --- a/soh/src/code/z_lights.c +++ b/soh/src/code/z_lights.c @@ -6,6 +6,7 @@ #include "soh/frame_interpolation.h" #include "soh/OTRGlobals.h" +#include "soh/Enhancements/savestate_serialize.h" #define LIGHTS_BUFFER_SIZE 32 //#define LIGHTS_BUFFER_SIZE 1024 // Kill me @@ -16,7 +17,10 @@ typedef struct { /* 0x008 */ LightNode buf[LIGHTS_BUFFER_SIZE]; } LightsBuffer; // size = 0x188 -LightsBuffer sLightsBuffer; +static LightsBuffer sLightsBuffer; + +#define LIGHTS_SHIP_SAVESTATE_FIELDS(F) F(sLightsBuffer) +SHIP_SAVESTATE_DEFINE(Lights, LIGHTS_SHIP_SAVESTATE_FIELDS) void Lights_PointSetInfo(LightInfo* info, s16 x, s16 y, s16 z, u8 r, u8 g, u8 b, s16 radius, s32 type) { info->type = type; diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index 681e20f05f..89d2770d01 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -9,14 +9,21 @@ #include "soh/OTRGlobals.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" MapData* gMapData; -s16 sPlayerInitialPosX = 0; -s16 sPlayerInitialPosZ = 0; -s16 sPlayerInitialDirection = 0; +static s16 sPlayerInitialPosX = 0; +static s16 sPlayerInitialPosZ = 0; +static s16 sPlayerInitialDirection = 0; s16 sEntranceIconMapIndex = 0; +#define MAP_EXP_SHIP_SAVESTATE_FIELDS(F) \ + F(sPlayerInitialPosX) \ + F(sPlayerInitialPosZ) \ + F(sPlayerInitialDirection) +SHIP_SAVESTATE_DEFINE(MapExp, MAP_EXP_SHIP_SAVESTATE_FIELDS) + s16 Top_MM_Margin = 0; s16 Left_MM_Margin = 0; s16 Right_MM_Margin = 0; diff --git a/soh/src/code/z_map_mark.c b/soh/src/code/z_map_mark.c index 4d1496fb40..02712089f8 100644 --- a/soh/src/code/z_map_mark.c +++ b/soh/src/code/z_map_mark.c @@ -4,6 +4,7 @@ #include "soh/OTRGlobals.h" #include "soh/ResourceManagerHelpers.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" +#include "soh/Enhancements/savestate_serialize.h" typedef struct { /* 0x00 */ void* texture; @@ -55,7 +56,10 @@ static MapMarkInfo sMapMarkInfoTable[] = { // gMapMarkDataTableVanilla, // }; -MapMarkData** sLoadedMarkDataTable; +static MapMarkData** sLoadedMarkDataTable; + +#define MAP_MARK_SHIP_SAVESTATE_FIELDS(F) F(sLoadedMarkDataTable) +SHIP_SAVESTATE_DEFINE(MapMark, MAP_MARK_SHIP_SAVESTATE_FIELDS) void MapMark_Init(PlayState* play) { // MapMarkDataOverlay* overlay = &sMapMarkDataOvl; diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 60cbef0bda..809a5d1afd 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -14,6 +14,7 @@ #include "soh/OTRGlobals.h" #include "soh/SaveManager.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" // #region SOH [NTSC] - Allows custom messages to work on japanese static bool sDisplayNextMessageAsEnglish = false; @@ -23,27 +24,27 @@ static u16 sTextBoxNum = 0; s16 sTextFade = false; // original name: key_off_flag ? -u8 D_8014B2F4 = 0; +static u8 D_8014B2F4 = 0; -s16 sOcarinaNoteBufPos = 0; +static s16 sOcarinaNoteBufPos = 0; -s16 sOcarinaNoteBufLen = 0; +static s16 sOcarinaNoteBufLen = 0; -u8 sTextboxSkipped = false; +static u8 sTextboxSkipped = false; -u16 sNextTextId = 0; +static u16 sNextTextId = 0; s16 sTextIsCredits = false; UNK_TYPE D_8014B30C = 0; -s16 sLastPlayedSong = 0xFF; // last played song? +static s16 sLastPlayedSong = 0xFF; // last played song? -s16 sHasSunsSong = false; +static s16 sHasSunsSong = false; s16 sMessageHasSetSfx = false; -u16 sOcarinaSongBitFlags = 0; // ocarina bit flags +static u16 sOcarinaSongBitFlags = 0; // ocarina bit flags MessageTableEntry* sNesMessageEntryTablePtr = NULL; MessageTableEntry* sGerMessageEntryTablePtr = NULL; @@ -71,7 +72,7 @@ s16 sTextboxBackgroundYOffsets[] = { }; // original name: onpu_buff -u8 sOcarinaNoteBuf[12] = { 0 }; +static u8 sOcarinaNoteBuf[12] = { 0 }; s16 sOcarinaNotesAlphaValues[9] = { 0 }; @@ -4706,3 +4707,17 @@ UNK_TYPE D_80153D7C = 0x00000000; // This should be part of z_game_over.c, but cannot be moved there as the entire // late_rodata section of this file is in the way s16 gGameOverTimer = 0; + +#define MESSAGE_PAL_SHIP_SAVESTATE_FIELDS(F) \ + F(sOcarinaNoteBufPos) \ + F(sOcarinaNoteBufLen) \ + F(sOcarinaNoteBuf) \ + F(D_8014B2F4) \ + F(sTextboxSkipped) \ + F(sNextTextId) \ + F(sLastPlayedSong) \ + F(sHasSunsSong) \ + F(sMessageHasSetSfx) \ + F(sOcarinaSongBitFlags) \ + F(gGameOverTimer) +SHIP_SAVESTATE_DEFINE(MessagePAL, MESSAGE_PAL_SHIP_SAVESTATE_FIELDS) diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 870337fd19..3b3f87fc81 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -2,13 +2,53 @@ #include "vt.h" #include "overlays/actors/ovl_En_Sw/z_en_sw.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" static s16 sDisableAttention = false; static s16 sUnused = -1; -s32 sPrevFrameCs1100 = -4096; +static s32 sPrevFrameCs1100 = -4096; #include "z_onepointdemo_data.inc" +#define ONE_POINT_CUTSCENE_SHIP_SAVESTATE_FIELDS(F) \ + F(sPrevFrameCs1100) \ + F(D_8012013C) \ + F(D_8012021C) \ + F(D_801204D4) \ + F(D_801205B4) \ + F(D_801208EC) \ + F(D_80120964) \ + F(D_801209B4) \ + F(D_80120ACC) \ + F(D_80120B94) \ + F(D_80120D4C) \ + F(D_80120FA4) \ + F(D_80121184) \ + F(D_801211D4) \ + F(D_8012133C) \ + F(D_801213B4) \ + F(D_8012151C) \ + F(D_8012156C) \ + F(D_801215BC) \ + F(D_80121C24) \ + F(D_80121D3C) \ + F(D_80121F1C) \ + F(D_80121FBC) \ + F(D_801220D4) \ + F(D_80122714) \ + F(D_80122CB4) \ + F(D_80122D04) \ + F(D_80122E44) \ + F(D_8012313C) \ + F(D_801231B4) \ + F(D_80123254) \ + F(D_801232A4) \ + F(D_80123894) \ + F(D_8012390C) \ + F(D_8012395C) \ + F(D_801239D4) +SHIP_SAVESTATE_DEFINE(OnePointCutscene, ONE_POINT_CUTSCENE_SHIP_SAVESTATE_FIELDS) + void OnePointCutscene_AddVecSphToVec3f(Vec3f* dst, Vec3f* src, VecSph* vecSph) { Vec3f out; Vec3f vec; diff --git a/soh/src/code/z_onepointdemo_data.inc b/soh/src/code/z_onepointdemo_data.inc index 2488be71b3..1d1838b058 100644 --- a/soh/src/code/z_onepointdemo_data.inc +++ b/soh/src/code/z_onepointdemo_data.inc @@ -1,6 +1,6 @@ #include "global.h" -CutsceneCameraPoint D_8012013C[14] = { +static CutsceneCameraPoint D_8012013C[14] = { { CS_CMD_CONTINUE, 25, 40, 70.79991f, { -1814, 533, -1297 } }, { CS_CMD_CONTINUE, 20, 40, 70.99991f, { -1805, 434, -1293 } }, { CS_CMD_CONTINUE, 10, 30, 60.0f, { -1794, 323, -1280 } }, @@ -16,7 +16,7 @@ CutsceneCameraPoint D_8012013C[14] = { { CS_CMD_STOP, 0, 50, 60.0f, { -1974, 12, -1179 } }, { CS_CMD_STOP, 0, 30, 60.0f, { -1974, 12, -1179 } }, }; -CutsceneCameraPoint D_8012021C[14] = { +static CutsceneCameraPoint D_8012021C[14] = { { CS_CMD_CONTINUE, 0, 0, 60.0f, { -1751, 604, -1233 } }, { CS_CMD_CONTINUE, 0, 0, 60.0f, { -1752, 516, -1233 } }, { CS_CMD_CONTINUE, 0, 0, 60.0f, { -1751, 417, -1233 } }, { CS_CMD_CONTINUE, 0, 0, 60.0f, { -1767, 306, -1219 } }, { CS_CMD_CONTINUE, 0, 0, 60.0f, { -1776, 257, -1205 } }, { CS_CMD_CONTINUE, 0, 0, 60.0f, { -1881, 147, -1149 } }, @@ -54,7 +54,7 @@ static CutsceneCameraPoint D_80120434[10] = { { CS_CMD_STOP, 0, 0, 60.0f, { 0, 62, -119 } }, { CS_CMD_STOP, 0, 0, 60.0f, { 0, 62, -119 } }, }; -CutsceneCameraPoint D_801204D4[14] = { +static CutsceneCameraPoint D_801204D4[14] = { { CS_CMD_CONTINUE, -15, 40, 80.600006f, { -60, 332, 183 } }, { CS_CMD_CONTINUE, -22, 30, 80.600006f, { -60, 332, 183 } }, { CS_CMD_CONTINUE, -20, 38, 80.600006f, { -118, 344, 41 } }, @@ -70,7 +70,7 @@ CutsceneCameraPoint D_801204D4[14] = { { CS_CMD_STOP, 6, 30, 85.199936f, { 25, 127, -950 } }, { CS_CMD_STOP, 0, 30, 85.199936f, { 25, 127, -950 } }, }; -CutsceneCameraPoint D_801205B4[14] = { +static CutsceneCameraPoint D_801205B4[14] = { { CS_CMD_CONTINUE, 0, 0, 60.0f, { -225, 785, -242 } }, { CS_CMD_CONTINUE, -21, 0, 80.600006f, { -245, 784, -242 } }, { CS_CMD_CONTINUE, -21, 0, 80.600006f, { -288, 485, -379 } }, @@ -118,18 +118,18 @@ static s16 D_801208E0 = 12; static s16 D_801208E4 = 90; static s16 D_801208E8 = 8; -OnePointCsFull D_801208EC[3] = { +static OnePointCsFull D_801208EC[3] = { { 0x0F, 0x08, 0x0101, 1, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x81, 0xFF, 0x0101, 1, 0, 60.0f, 1.0f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 150.0f } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80120964[2] = { +static OnePointCsFull D_80120964[2] = { { 0x8F, 0xFF, 0x0101, 1, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x81, 0xFF, 0xA121, 1, 0, 75.0f, 0.6f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 150.0f } }, }; -OnePointCsFull D_801209B4[4] = { +static OnePointCsFull D_801209B4[4] = { { 0x8F, 0x08, 0x0101, 1, 0, 60.0f, 0.9f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x84, 0x01, 0x0100, 29, 0, 45.0f, 0.1f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 150.0f } }, { 0x83, 0xFF, 0x0000, 10, 0, 60.0f, 0.2f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 150.0f } }, @@ -142,7 +142,7 @@ static OnePointCsFull D_80120A54[3] = { { 0x8B, 0xFF, 0x0022, 5000, 0, 75.0f, 0.005f, { 0.0f, 0.0f, -10.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80120ACC[5] = { +static OnePointCsFull D_80120ACC[5] = { { 0x8F, 0xFF, 0x0442, 10, 0, 40.0f, 1.0f, { -10.0f, 45.0f, 20.0f }, { 20.0f, 30.0f, 160.0f } }, { 0x95, 0xFF, 0x0000, 1, 0, 40.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x8F, 0x01, 0x0442, 10, 0, 40.0f, 1.0f, { -10.0f, 45.0f, 20.0f }, { 20.0f, 30.0f, 160.0f } }, @@ -150,7 +150,7 @@ OnePointCsFull D_80120ACC[5] = { { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80120B94[11] = { +static OnePointCsFull D_80120B94[11] = { { 0x8F, 0x01, 0x2142, 1, 0, 40.0f, 1.0f, { 20.0f, 40.0f, 20.0f }, { -20.0f, 0.0f, -30.0f } }, { 0x84, 0xFF, 0x0404, 19, 5, 70.0f, 0.01f, { 0.0f, 30.0f, 20.0f }, { 120.0f, 60.0f, 120.0f } }, { 0x84, 0xFF, 0x0404, 20, 0, 60.0f, 0.01f, { 0.0f, 20.0f, 20.0f }, { 120.0f, 60.0f, 120.0f } }, @@ -164,7 +164,7 @@ OnePointCsFull D_80120B94[11] = { { 0x98, 0xFF, 0x0000, 1, 0, 50.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80120D4C[7] = { +static OnePointCsFull D_80120D4C[7] = { { 0x8F, 0x01, 0x2142, 1, 0, 40.0f, 1.0f, { 20.0f, 40.0f, 20.0f }, { -20.0f, 0.0f, -30.0f } }, { 0x84, 0xFF, 0x0404, 19, 5, 70.0f, 0.01f, { 0.0f, 30.0f, 20.0f }, { 120.0f, 60.0f, 120.0f } }, { 0x84, 0xFF, 0x0404, 20, 0, 60.0f, 0.01f, { 0.0f, 20.0f, 20.0f }, { 120.0f, 60.0f, 120.0f } }, @@ -185,7 +185,7 @@ static OnePointCsFull D_80120E64[8] = { { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80120FA4[6] = { +static OnePointCsFull D_80120FA4[6] = { { 0x8F, 0x01, 0x2143, 30, 0, 70.0f, 0.4f, { 0.0f, 40.0f, 50.0f }, { 30.0f, 10.0f, -50.0f } }, { 0x95, 0xFF, 0x0000, 1, 0, 50.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x8F, 0xFF, 0x2222, 10, 0, 42.0f, 1.0f, { 0.0f, 40.0f, 0.0f }, { 0.0f, 85.0f, 45.0f } }, @@ -206,12 +206,12 @@ static OnePointCsFull D_8012110C[3] = { { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80121184[2] = { +static OnePointCsFull D_80121184[2] = { { 0x83, 0x01, 0x0101, 40, 0, -1.0f, 0.1f, { 0.0f, 10.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_801211D4[2] = { +static OnePointCsFull D_801211D4[2] = { { 0x8F, 0x08, 0x0101, 50, 0, 60.0f, 1.0f, { 0.0f, 10.0f, 0.0f }, { -10.0f, 85.0f, 0.0f } }, { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; @@ -229,13 +229,13 @@ static OnePointCsFull D_80121314[1] = { { 0x8F, 0x08, 0x4141, 1000, 0, 75.0f, 0.6f, { 0.0f, 0.0f, 10.0f }, { 0.0f, 0.0f, 100.0f } }, }; -OnePointCsFull D_8012133C[3] = { +static OnePointCsFull D_8012133C[3] = { { 0x8F, 0x01, 0x0141, 40, 0, 75.0f, 1.0f, { 0.0f, 60.0f, 0.0f }, { 0.0f, 0.0f, 100.0f } }, { 0x83, 0xFF, 0x2121, 20, 0, 60.0f, 0.2f, { 0.0f, -10.0f, -10.0f }, { 0.0f, 10.0f, -100.0f } }, { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_801213B4[5] = { +static OnePointCsFull D_801213B4[5] = { { 0x8F, 0x08, 0xC2C2, 40, 0, 70.0f, 1.0f, { 80.0f, 0.0f, 20.0f }, { 20.0f, 0.0f, 80.0f } }, { 0x8B, 0x01, 0xC2C2, 120, 0, 70.0f, 0.1f, { 80.0f, 0.0f, 20.0f }, { 20.0f, 0.0f, 80.0f } }, { 0x8F, 0x53, 0xC2C2, 30, 0, 50.0f, 1.0f, { 60.0f, 0.0f, 20.0f }, { 60.0f, 0.0f, 60.0f } }, @@ -250,17 +250,17 @@ static OnePointCsFull D_8012147C[4] = { { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_8012151C[2] = { +static OnePointCsFull D_8012151C[2] = { { 0x0F, 0x01, 0x0101, 29, 0, 60.0f, 1.0f, { -700.0f, 875.0f, -100.0f }, { -550.0f, 920.0f, -150.0f } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_8012156C[2] = { +static OnePointCsFull D_8012156C[2] = { { 0x8F, 0x4D, 0x4242, 1, 0, 65.0f, 1.0f, { 60.0f, 30.0f, 0.0f }, { 50.0f, 20.0f, 150.0f } }, { 0x81, 0xFF, 0x4242, -1, 0, 65.0f, 1.0f, { -50.0f, 60.0f, 0.0f }, { -60.0f, 40.0f, 150.0f } }, }; -OnePointCsFull D_801215BC[1] = { +static OnePointCsFull D_801215BC[1] = { { 0x0F, 0xFF, 0x0101, 5, 0, 65.0f, 1.0f, { -1185.0f, 655.0f, 1185.0f }, { -1255.0f, 735.0f, 1255.0f } }, }; @@ -331,7 +331,7 @@ static OnePointCsFull D_80121A44[12] = { { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80121C24[7] = { +static OnePointCsFull D_80121C24[7] = { { 0x0F, 0x05, 0x0101, 1, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x03, 0xFF, 0x0101, 89, 0, 50.0f, 0.4f, { 125.0f, 320.0f, -1500.0f }, { 125.0f, 500.0f, -1150.0f } }, { 0x0F, 0x08, 0x0101, 40, 4, 55.0f, 1.0f, { 0.0f, 375.0f, -1440.0f }, { 5.0f, 365.0f, -1315.0f } }, @@ -341,7 +341,7 @@ OnePointCsFull D_80121C24[7] = { { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80121D3C[3] = { +static OnePointCsFull D_80121D3C[3] = { { 0x0F, 0xFF, 0x0101, 1, 0, 60.0f, 1.0f, { 1023.0f, 738.0f, -2628.0f }, { 993.0f, 770.0f, -2740.0f } }, { 0x02, 0xFF, 0x0101, 4, 0, 50.0f, 1.0f, { 1255.0f, 350.0f, -1870.0f }, { 1240.0f, 575.0f, -2100.0f } }, { 0x0F, 0xFF, 0x0000, -1, 0, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, @@ -359,14 +359,14 @@ static OnePointCsFull D_80121DB4[9] = { { 0x12, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80121F1C[4] = { +static OnePointCsFull D_80121F1C[4] = { { 0x0F, 0x08, 0x0101, 10, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x01, 0xFF, 0x2121, 10, 0, 50.0f, 0.5f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 150.0f } }, { 0x01, 0x02, 0x2121, 23, 0, 50.0f, 0.5f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 150.0f } }, { 0x11, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80121FBC[4] = { +static OnePointCsFull D_80121FBC[4] = { { 0x0F, 0xFF, 0x0101, 5, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x01, 0xFF, 0x0101, 10, 0, 30.0f, 1.0f, { -2130.0f, 2885.0f, -1055.0f }, { -2085.0f, 2875.0f, -1145.0f } }, { 0x0F, 0xFF, 0x0000, 30, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, @@ -379,7 +379,7 @@ static OnePointCsFull D_8012205C[3] = { { 0x01, 0x01, 0x21A1, 10, 0, 60.0f, 1.0f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 10.0f, -200.0f } }, }; -OnePointCsFull D_801220D4[5] = { +static OnePointCsFull D_801220D4[5] = { { 0x0F, 0x01, 0x0101, 5, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x01, 0xFF, 0x4141, 10, 5, 55.0f, 0.75f, { 400.0f, -50.0f, 800.0f }, { 600.0f, -60.0f, 800.0f } }, { 0x01, 0xFF, 0x4141, 15, 10, 40.0f, 0.75f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 10.0f, 200.0f } }, @@ -443,7 +443,7 @@ static OnePointCsFull D_8012269C[3] = { { 0x11, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80122714[4] = { +static OnePointCsFull D_80122714[4] = { { 0x0F, 0xFF, 0x0101, 20, 0, 45.0f, 1.0f, { -915.0f, -2185.0f, 6335.0f }, { -915.0f, -2290.0f, 6165.0f } }, { 0x02, 0xFF, 0x0101, -1, 0, 80.0f, 0.8f, { -920.0f, -2270.0f, 6140.0f }, { -920.0f, -2280.0f, 6070.0f } }, { 0x02, 0xFF, 0x0101, 20, 0, 80.0f, 0.9f, { -920.0f, -2300.0f, 6140.0f }, { -920.0f, -2300.0f, 6070.0f } }, @@ -512,12 +512,12 @@ static OnePointCsFull D_80122C8C[1] = { { 0x0F, 0xFF, 0x0101, 999, 5, 60.0f, 1.0f, { -70.0f, 140.0f, 25.0f }, { 10.0f, 180.0f, 195.0f } }, }; -OnePointCsFull D_80122CB4[2] = { +static OnePointCsFull D_80122CB4[2] = { { 0x0F, 0xFF, 0x4242, 5, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 1000.0f }, { 0.0f, 0.0f, 1100.0f } }, { 0x02, 0xFF, 0x4242, -1, 0, 60.0f, 1.0f, { 0.0f, 0.0f, -100.0f }, { 0.0f, 0.0f, 0.0f } }, }; -OnePointCsFull D_80122D04[2] = { +static OnePointCsFull D_80122D04[2] = { { 0x0F, 0xFF, 0x4242, 10, 0, 60.0f, 1.0f, { 0.0f, 0.0f, -100.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x02, 0xFF, 0x4242, -1, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 1000.0f }, { 0.0f, 0.0f, 1100.0f } }, }; @@ -534,7 +534,7 @@ static OnePointCsFull D_80122DCC[3] = { { 0x11, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80122E44[2][7] = { +static OnePointCsFull D_80122E44[2][7] = { { { 0x83, 0xFF, 0x2222, 10, 5, 90.0f, 0.2f, { 50.0f, 100.0f, 140.0f }, { -30.0f, 10.0f, -20.0f } }, { 0x8F, 0xFF, 0x0000, 20, 0, 90.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, @@ -563,25 +563,25 @@ static OnePointCsFull D_80123074[5] = { { 0x92, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_8012313C[3] = { +static OnePointCsFull D_8012313C[3] = { { 0x8F, 0xFF, 0xA2A2, 20, 8, 70.0f, 1.0f, { 65.0f, -150.0f, 50.0f }, { 30.0f, 10.0f, 90.0f } }, { 0x81, 0xFF, 0xA2A2, 100, 0, 60.0f, 1.0f, { 70.0f, -160.0f, 50.0f }, { 25.0f, 180.0f, 180.0f } }, { 0x92, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_801231B4[4] = { +static OnePointCsFull D_801231B4[4] = { { 0x8F, 0xC5, 0x4343, 1, 0, 50.0f, 1.0f, { 0.0f, 20.0f, 0.0f }, { 0.0f, 5.0f, -1.0f } }, { 0x81, 0xC5, 0x4343, 48, 0, 50.0f, 0.75f, { 0.0f, 80.0f, 0.0f }, { 0.0f, 15.0f, -1.0f } }, { 0x8F, 0xC5, 0x4343, 1, 5, 45.0f, 1.0f, { 0.0f, 0.0f, 30.0f }, { 30.0f, 120.0f, 60.0f } }, { 0x81, 0xC5, 0x4343, -1, 0, -1.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80123254[2] = { +static OnePointCsFull D_80123254[2] = { { 0x0F, 0xFF, 0x0101, 1, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x03, 0xC5, 0x0101, 49, 0, 50.0f, 0.05f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, }; -OnePointCsFull D_801232A4[1] = { +static OnePointCsFull D_801232A4[1] = { { 0x0F, 0x45, 0x0101, 9999, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, }; @@ -646,24 +646,24 @@ static OnePointCsFull D_801237CC[5] = { { 0x0F, 0xFF, 0x0000, 100, -45, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_80123894[3] = { +static OnePointCsFull D_80123894[3] = { { 0x0F, 0xFF, 0x0101, 60, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x0F, 0xFF, 0x4242, 30, 0, 50.0f, 1.0f, { 0.0f, 28.0f, 0.0f }, { 0.0f, 20.0f, 40.0f } }, { 0x0D, 0xFF, 0x0000, 120, 0, 180.0f, 0.4f, { 0.0f, -5.0f, 0.0f }, { 0.0f, 2.0f, 40.0f } }, }; -OnePointCsFull D_8012390C[2] = { +static OnePointCsFull D_8012390C[2] = { { 0x0F, 0xFF, 0x0101, 30, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x0F, 0xFF, 0x4242, 180, 0, 60.0f, 1.0f, { 0.0f, 78.0f, 0.0f }, { 0.0f, 78.0f, 200.0f } }, }; -OnePointCsFull D_8012395C[3] = { +static OnePointCsFull D_8012395C[3] = { { 0x0F, 0xFF, 0x0101, 60, 0, 60.0f, 1.0f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x0F, 0xFF, 0x4242, 30, 0, 50.0f, 1.0f, { 0.0f, 28.0f, 0.0f }, { 0.0f, 20.0f, -45.0f } }, { 0x0D, 0xFF, 0x0000, 120, 0, 180.0f, 0.4f, { 0.0f, -5.0f, 0.0f }, { 0.0f, 2.0f, 45.0f } }, }; -OnePointCsFull D_801239D4[3] = { +static OnePointCsFull D_801239D4[3] = { { 0x0F, 0xFF, 0x4242, 5, 0, 60.0f, 1.0f, { 0.0f, 20.0f, 0.0f }, { 0.0f, 40.0f, -120.0f } }, { 0x09, 0xFF, 0x4242, 0, 0, 60.0f, 1.0f, { 0.0f, 20.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, diff --git a/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index 908988cff1..e8d4cb728b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/soh/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -6,6 +6,7 @@ #include "z_bg_ddan_kd.h" #include "objects/object_ddan_objects/object_ddan_objects.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -121,8 +122,14 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play) { } } -Vec3f sBgDdanKdVelocity = { 0.0f, 5.0f, 0.0f }; -Vec3f sBgDdanKdAccel = { 0.0f, -0.45f, 0.0f }; +static Vec3f sBgDdanKdVelocity = { 0.0f, 5.0f, 0.0f }; +static Vec3f sBgDdanKdAccel = { 0.0f, -0.45f, 0.0f }; + +#define BG_DDAN_KD_SHIP_SAVESTATE_FIELDS(F) \ + F(sBgDdanKdVelocity) \ + F(sBgDdanKdAccel) + +SHIP_SAVESTATE_DEFINE(BgDdanKd, BG_DDAN_KD_SHIP_SAVESTATE_FIELDS) void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) { Vec3f pos1; diff --git a/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 4fd8477664..2387c47134 100644 --- a/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/soh/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -7,6 +7,7 @@ #include "z_bg_dodoago.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" #include "objects/object_ddan_objects/object_ddan_objects.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS 0 @@ -74,13 +75,20 @@ static ColliderCylinderInit sColCylinderInitLeftRight = { { 50, 60, 280, { 0, 0, 0 } }, }; -s16 sBgDodoagoFirstExplosiveFlag = false; +static s16 sBgDodoagoFirstExplosiveFlag = false; -u8 sBgDodoagoDisableBombCatcher; +static u8 sBgDodoagoDisableBombCatcher; // static u8 sUnused[90]; // unknown length -s32 sBgDodoagoTimer; +static s32 sBgDodoagoTimer; + +#define BG_DODOAGO_SHIP_SAVESTATE_FIELDS(F) \ + F(sBgDodoagoFirstExplosiveFlag) \ + F(sBgDodoagoDisableBombCatcher) \ + F(sBgDodoagoTimer) + +SHIP_SAVESTATE_DEFINE(BgDodoago, BG_DODOAGO_SHIP_SAVESTATE_FIELDS) void BgDodoago_SetupAction(BgDodoago* this, BgDodoagoActionFunc actionFunc) { this->actionFunc = actionFunc; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 4364f713d7..432fc65a21 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -6,6 +6,7 @@ #include "z_bg_haka_trap.h" #include "objects/object_haka_objects/object_haka_objects.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS 0 @@ -28,7 +29,7 @@ void BgHakaTrap_FireBarrier_Idle(BgHakaTrap* this, PlayState* play); void BgHakaTrap_FireBarrier_UpdateLayout(BgHakaTrap* this, PlayState* play); void BgHakaTrap_GetSwitchFlag(BgHakaTrap* this); -UNK_TYPE D_80880F30 = 0; +static UNK_TYPE D_80880F30 = 0; const ActorInit Bg_Haka_Trap_InitVars = { ACTOR_BG_HAKA_TRAP, @@ -107,7 +108,14 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -UNK_TYPE D_80881014 = 0; +static UNK_TYPE D_80881014 = 0; + +#define BG_HAKA_TRAP_SHIP_SAVESTATE_FIELDS(F) \ + F(D_80880F30) \ + F(D_80881014) + +SHIP_SAVESTATE_DEFINE(BgHakaTrap, BG_HAKA_TRAP_SHIP_SAVESTATE_FIELDS) + void BgHakaTrap_Init(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; s32 pad; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 304bbd8813..9b6780ce55 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -6,6 +6,7 @@ #include "z_bg_hidan_rock.h" #include "objects/object_hidan_objects/object_hidan_objects.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS 0 @@ -120,7 +121,12 @@ void func_8088B24C(BgHidanRock* this) { this->actionFunc = func_8088B990; } -f32 D_8088BFC0 = 0.0f; +static f32 D_8088BFC0 = 0.0f; + +#define BG_HIDAN_ROCK_SHIP_SAVESTATE_FIELDS(F) F(D_8088BFC0) + +SHIP_SAVESTATE_DEFINE(BgHidanRock, BG_HIDAN_ROCK_SHIP_SAVESTATE_FIELDS) + void func_8088B268(BgHidanRock* this, PlayState* play) { f32 sp2C; s32 temp_v1; diff --git a/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index 20851b2006..08a5cf34d1 100644 --- a/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/soh/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -7,6 +7,7 @@ #include "z_bg_menkuri_eye.h" #include "objects/object_menkuri_objects/object_menkuri_objects.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_DRAW_CULLING_DISABLED @@ -29,7 +30,11 @@ const ActorInit Bg_Menkuri_Eye_InitVars = { (ActorResetFunc)BgMenkuriEye_Reset, }; -s32 D_8089C1A0; +static s32 D_8089C1A0; + +#define BG_MENKURI_EYE_SHIP_SAVESTATE_FIELDS(F) F(D_8089C1A0) + +SHIP_SAVESTATE_DEFINE(BgMenkuriEye, BG_MENKURI_EYE_SHIP_SAVESTATE_FIELDS) static ColliderJntSphElementInit sJntSphElementsInit[1] = { { diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 4124c2b3d0..b5387ebba5 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -12,6 +12,7 @@ #include "objects/object_mori_hineri2/object_mori_hineri2.h" #include "objects/object_mori_hineri2a/object_mori_hineri2a.h" #include "objects/object_mori_tex/object_mori_tex.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -30,7 +31,11 @@ void func_808A3D58(BgMoriHineri* this, PlayState* play); s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); -s16 sBgMoriHineriNextCamIdx = SUBCAM_NONE; +static s16 sBgMoriHineriNextCamIdx = SUBCAM_NONE; + +#define BG_MORI_HINERI_SHIP_SAVESTATE_FIELDS(F) F(sBgMoriHineriNextCamIdx) + +SHIP_SAVESTATE_DEFINE(BgMoriHineri, BG_MORI_HINERI_SHIP_SAVESTATE_FIELDS) const ActorInit Bg_Mori_Hineri_InitVars = { ACTOR_BG_MORI_HINERI, diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index ce75b65ace..80c42c76dc 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -8,6 +8,7 @@ #include "objects/object_po_sisters/object_po_sisters.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS 0 @@ -82,11 +83,11 @@ static ColliderTrisInit sTrisInit = { sTrisElementsInit, }; -u8 sBgPoEventBlocksAtRest = 0; +static u8 sBgPoEventBlocksAtRest = 0; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; -u8 sBgPoEventPuzzleState; +static u8 sBgPoEventPuzzleState; void BgPoEvent_InitPaintings(BgPoEvent* this, PlayState* play) { static s16 paintingPosX[] = { -1302, -866, 1421, 985 }; @@ -382,7 +383,15 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { } } -f32 sBgPoEventblockPushDist = 0.0f; +static f32 sBgPoEventblockPushDist = 0.0f; + +#define BG_PO_EVENT_SHIP_SAVESTATE_FIELDS(F) \ + F(sBgPoEventBlocksAtRest) \ + F(sBgPoEventPuzzleState) \ + F(sBgPoEventblockPushDist) + +SHIP_SAVESTATE_DEFINE(BgPoEvent, BG_PO_EVENT_SHIP_SAVESTATE_FIELDS) + void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) { f32 displacement; s32 blockStop; diff --git a/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 166fff64d1..ed285417ec 100644 --- a/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -7,6 +7,7 @@ #include "z_bg_relay_objects.h" #include "objects/object_relay_objects/object_relay_objects.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -46,7 +47,12 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -u32 D_808A9508 = 0; +static u32 D_808A9508 = 0; + +#define BG_RELAY_OBJECTS_SHIP_SAVESTATE_FIELDS(F) F(D_808A9508) + +SHIP_SAVESTATE_DEFINE(BgRelayObjects, BG_RELAY_OBJECTS_SHIP_SAVESTATE_FIELDS) + void BgRelayObjects_Init(Actor* thisx, PlayState* play) { BgRelayObjects* this = (BgRelayObjects*)thisx; s32 pad; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index d59a6598c1..1eaa3962c0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -2,6 +2,7 @@ #include "objects/object_spot18_obj/object_spot18_obj.h" #include "vt.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -85,7 +86,12 @@ void BgSpot18Basket_InitColliderJntSph(Actor* thisx, PlayState* play) { this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; } -s16 D_808B85D0 = 0; +static s16 D_808B85D0 = 0; + +#define BG_SPOT18_BASKET_SHIP_SAVESTATE_FIELDS(F) F(D_808B85D0) + +SHIP_SAVESTATE_DEFINE(BgSpot18Basket, BG_SPOT18_BASKET_SHIP_SAVESTATE_FIELDS) + void BgSpot18Basket_SpawnDustClouds(BgSpot18Basket* this, PlayState* play, f32 arg2) { Vec3f acceleration; Vec3f velocity; diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index cb6190d60c..d5d496f647 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -13,6 +13,7 @@ #include "soh/frame_interpolation.h" #include "soh/OTRGlobals.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #include #include @@ -112,17 +113,27 @@ static ColliderCylinderInit sLightBallCylinderInit = { static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 }; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; -EnGanonMant* sBossGanonCape; +static EnGanonMant* sBossGanonCape; -s32 sBossGanonSeed1; -s32 sBossGanonSeed3; -s32 sBossGanonSeed2; +static s32 sBossGanonSeed1; +static s32 sBossGanonSeed3; +static s32 sBossGanonSeed2; -BossGanon* sBossGanonGanondorf; +static BossGanon* sBossGanonGanondorf; -EnZl3* sBossGanonZelda; +static EnZl3* sBossGanonZelda; -GanondorfEffect sBossGanonEffectBuf[200]; +static GanondorfEffect sBossGanonEffectBuf[200]; + +#define BOSS_GANON_SHIP_SAVESTATE_FIELDS(F) \ + F(sBossGanonSeed1) \ + F(sBossGanonSeed2) \ + F(sBossGanonSeed3) \ + F(sBossGanonGanondorf) \ + F(sBossGanonZelda) \ + F(sBossGanonCape) \ + F(sBossGanonEffectBuf) +SHIP_SAVESTATE_DEFINE(BossGanon, BOSS_GANON_SHIP_SAVESTATE_FIELDS) static u8 sWindowShatterTex[2048] = { { 0 } }; diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 4b14410db8..77f1d7061c 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -10,6 +10,7 @@ #include "soh/OTRGlobals.h" #include "soh/ResourceManagerHelpers.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #include @@ -56,23 +57,36 @@ const ActorInit Boss_Ganon2_InitVars = { #include "z_boss_ganon2_data.c" -Vec3f D_8090EB20; +static Vec3f D_8090EB20; -EnZl3* sBossGanon2Zelda; +static EnZl3* sBossGanon2Zelda; -Actor* D_8090EB30; +static Actor* D_8090EB30; -BossGanon2Effect sBossGanon2Particles[100]; +static BossGanon2Effect sBossGanon2Particles[100]; -s32 sBossGanon2Seed1; -s32 sBossGanon2Seed2; -s32 sBossGanon2Seed3; +static s32 sBossGanon2Seed1; +static s32 sBossGanon2Seed2; +static s32 sBossGanon2Seed3; -Vec3f D_809105D8[4]; +static Vec3f D_809105D8[4]; -Vec3f D_80910608[4]; +static Vec3f D_80910608[4]; -s8 D_80910638; +static s8 D_80910638; + +#define BOSS_GANON2_SHIP_SAVESTATE_FIELDS(F) \ + F(D_8090EB20) \ + F(D_80910638) \ + F(sBossGanon2Zelda) \ + F(D_8090EB30) \ + F(sBossGanon2Seed1) \ + F(sBossGanon2Seed2) \ + F(sBossGanon2Seed3) \ + F(D_809105D8) \ + F(D_80910608) \ + F(sBossGanon2Particles) +SHIP_SAVESTATE_DEFINE(BossGanon2, BOSS_GANON2_SHIP_SAVESTATE_FIELDS) void BossGanon2_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) { sBossGanon2Seed1 = seedInit0; diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index e425a2c116..44e9341452 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -6,6 +6,7 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #include @@ -165,7 +166,7 @@ static Vec3f sTwinrovaPillarPos[] = { { 0.0f, 380.0f, -580.0f }, }; -u8 sTwInitalized = false; +static u8 sTwInitalized = false; static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), @@ -198,7 +199,13 @@ static u8 D_8094C878; static s16 D_8094C87A; static s16 D_8094C87C; static u8 D_8094C87E; -BossTwEffect sTwEffects[150]; +static BossTwEffect sTwEffects[150]; + +#define BOSS_TW_SHIP_SAVESTATE_FIELDS(F) \ + F(sTwInitalized) \ + F(sTwEffects) + +SHIP_SAVESTATE_DEFINE(BossTw, BOSS_TW_SHIP_SAVESTATE_FIELDS) void BossTw_AddDotEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, s16 args, s16 countLimit) { diff --git a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 8b638c027b..63de6e2daa 100644 --- a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -13,6 +13,7 @@ #include "soh/frame_interpolation.h" #include #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -309,7 +310,11 @@ void func_8096712C(Demo6K* this, PlayState* play) { } } -Vec3f sDemo6kVelocity = { 0.0f, 0.0f, 0.0f }; +static Vec3f sDemo6kVelocity = { 0.0f, 0.0f, 0.0f }; + +#define DEMO_6K_SHIP_SAVESTATE_FIELDS(F) F(sDemo6kVelocity) + +SHIP_SAVESTATE_DEFINE(Demo6k, DEMO_6K_SHIP_SAVESTATE_FIELDS) void func_80967244(Demo6K* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; diff --git a/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index 4832bf3843..552877a583 100644 --- a/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -4,6 +4,7 @@ #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "vt.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -79,7 +80,12 @@ void DemoDu_CsAfterGanon_Reset(DemoDu* this) { this->unk_1A4 = 0.0f; } -s32 D_8096CE94 = false; +static s32 D_8096CE94 = false; + +#define DEMO_DU_SHIP_SAVESTATE_FIELDS(F) F(D_8096CE94) + +SHIP_SAVESTATE_DEFINE(DemoDu, DEMO_DU_SHIP_SAVESTATE_FIELDS) + void DemoDu_CsAfterGanon_CheckIfShouldReset(DemoDu* this, PlayState* play) { if (play->csCtx.state == CS_STATE_IDLE) { diff --git a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index add2548be4..3e2da23e09 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -9,6 +9,7 @@ #include "scenes/dungeons/ganontika/ganontika_scene.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -139,7 +140,12 @@ void DemoKekkai_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider2); } -Vec3f demoKekkaiVel = { 0.0f, 0.0f, 0.0f }; +static Vec3f demoKekkaiVel = { 0.0f, 0.0f, 0.0f }; + +#define DEMO_KEKKAI_SHIP_SAVESTATE_FIELDS(F) F(demoKekkaiVel) + +SHIP_SAVESTATE_DEFINE(DemoKekkai, DEMO_KEKKAI_SHIP_SAVESTATE_FIELDS) + void DemoKekkai_SpawnParticles(DemoKekkai* this, PlayState* play) { static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 lightYellow = { 255, 255, 170, 0 }; diff --git a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index fe173d449f..0297bf46ac 100644 --- a/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/soh/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -2,6 +2,7 @@ #include "objects/object_warp1/object_warp1.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS 0 @@ -55,7 +56,10 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 4000, ICHAIN_STOP), }; -s16 sWarpTimerTarget; +static s16 sWarpTimerTarget; + +#define DOOR_WARP1_SHIP_SAVESTATE_FIELDS(F) F(sWarpTimerTarget) +SHIP_SAVESTATE_DEFINE(DoorWarp1, DOOR_WARP1_SHIP_SAVESTATE_FIELDS) void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { this->actionFunc = actionFunc; diff --git a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c index abed17d28c..6abcdbfbc6 100644 --- a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -9,6 +9,7 @@ #include "objects/object_bw/object_bw.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -124,7 +125,11 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -s32 sSlugGroup = 0; +static s32 sSlugGroup = 0; + +#define EN_BW_SHIP_SAVESTATE_FIELDS(F) F(sSlugGroup) + +SHIP_SAVESTATE_DEFINE(EnBw, EN_BW_SHIP_SAVESTATE_FIELDS) void EnBw_SetupAction(EnBw* this, EnBwActionFunc actionFunc) { this->actionFunc = actionFunc; diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 580ff52655..c535e37d7d 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -4,6 +4,7 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -39,7 +40,7 @@ const ActorInit En_Clear_Tag_InitVars = { (ActorResetFunc)EnClearTag_Reset, }; -u8 sClearTagIsEffectsInitialized = false; +static u8 sClearTagIsEffectsInitialized = false; static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f }; @@ -86,7 +87,13 @@ static ColliderCylinderInit sLaserCylinderInit = { // static UNK_TYPE4 D_809D5C98 = 0; // unused // static UNK_TYPE4 D_809D5C9C = 0; // unused -EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT]; +static EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT]; + +#define EN_CLEAR_TAG_SHIP_SAVESTATE_FIELDS(F) \ + F(sClearTagIsEffectsInitialized) \ + F(sClearTagEffects) + +SHIP_SAVESTATE_DEFINE(EnClearTag, EN_CLEAR_TAG_SHIP_SAVESTATE_FIELDS) #include "overlays/ovl_En_Clear_Tag/ovl_En_Clear_Tag.h" diff --git a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c index b561b2305a..8bfec6a66e 100644 --- a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -5,6 +5,7 @@ #include #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -89,7 +90,7 @@ sEnFrPointers.flags = 12 - Deactivate frogs, frogs will jump back into the water */ -EnFrPointers sEnFrPointers = { +static EnFrPointers sEnFrPointers = { 0x00, { NULL, @@ -100,6 +101,10 @@ EnFrPointers sEnFrPointers = { }, }; +#define EN_FR_SHIP_SAVESTATE_FIELDS(F) F(sEnFrPointers) + +SHIP_SAVESTATE_DEFINE(EnFr, EN_FR_SHIP_SAVESTATE_FIELDS) + // Flags for gSaveContext.eventChkInf[13] static u16 sSongIndex[] = { 0x0002, 0x0004, 0x0010, 0x0008, 0x0020, 0x0040, 0x0001, 0x0000, diff --git a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 60c8e6d7a5..7c07e0f301 100644 --- a/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/soh/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -5,6 +5,7 @@ #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -100,9 +101,13 @@ static ColliderCylinderInit D_80A4B7CC = { { 15, 30, 10, { 0, 0, 0 } }, }; -u8 sSpawnNum = 0; +static u8 sSpawnNum = 0; static Vec3f sDeadEffectVel = { 0.0f, 0.0f, 0.0f }; +#define EN_GOMA_SHIP_SAVESTATE_FIELDS(F) F(sSpawnNum) + +SHIP_SAVESTATE_DEFINE(EnGoma, EN_GOMA_SHIP_SAVESTATE_FIELDS) + static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, 3, ICHAIN_CONTINUE), ICHAIN_S8(naviEnemyId, 0x03, ICHAIN_CONTINUE), diff --git a/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 9107ed6b48..97c6d9786e 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/soh/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -9,6 +9,7 @@ #include "vt.h" #include "soh/ResourceManagerHelpers.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -32,7 +33,11 @@ void EnHeishi1_TurnTowardLink(EnHeishi1* this, PlayState* play); void EnHeishi1_Kick(EnHeishi1* this, PlayState* play); void EnHeishi1_WaitNight(EnHeishi1* this, PlayState* play); -s32 sHeishi1PlayerIsCaught = false; +static s32 sHeishi1PlayerIsCaught = false; + +#define EN_HEISHI1_SHIP_SAVESTATE_FIELDS(F) F(sHeishi1PlayerIsCaught) + +SHIP_SAVESTATE_DEFINE(EnHeishi1, EN_HEISHI1_SHIP_SAVESTATE_FIELDS) const ActorInit En_Heishi1_InitVars = { ACTOR_EN_HEISHI1, diff --git a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c index d0dfb26494..9d6b2add67 100644 --- a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -8,6 +8,7 @@ #include "vt.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS 0 @@ -33,9 +34,16 @@ void EnInsect_Drown(EnInsect* this, PlayState* play); void EnInsect_SetupDropped(EnInsect* this); void EnInsect_Dropped(EnInsect* this, PlayState* play); -f32 D_80A7DEB0 = 0.0f; -s16 D_80A7DEB4 = 0; -s16 D_80A7DEB8 = 0; +static f32 D_80A7DEB0 = 0.0f; +static s16 D_80A7DEB4 = 0; +s16 D_80A7DEB8 = 0; // not static: read by NoBugsDespawn.cpp + +#define EN_INSECT_SHIP_SAVESTATE_FIELDS(F) \ + F(D_80A7DEB0) \ + F(D_80A7DEB4) \ + F(D_80A7DEB8) + +SHIP_SAVESTATE_DEFINE(EnInsect, EN_INSECT_SHIP_SAVESTATE_FIELDS) const ActorInit En_Insect_InitVars = { ACTOR_EN_INSECT, diff --git a/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 90ef185ed9..7ec80eea29 100644 --- a/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/soh/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -9,6 +9,7 @@ #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "soh/OTRGlobals.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #include "vt.h" @@ -31,8 +32,14 @@ void EnIshi_SpawnFragmentsLarge(EnIshi* this, PlayState* play); void EnIshi_SpawnDustSmall(EnIshi* this, PlayState* play); void EnIshi_SpawnDustLarge(EnIshi* this, PlayState* play); -s16 sRockRotSpeedX = 0; -s16 sRockRotSpeedY = 0; +static s16 sRockRotSpeedX = 0; +static s16 sRockRotSpeedY = 0; + +#define EN_ISHI_SHIP_SAVESTATE_FIELDS(F) \ + F(sRockRotSpeedX) \ + F(sRockRotSpeedY) + +SHIP_SAVESTATE_DEFINE(EnIshi, EN_ISHI_SHIP_SAVESTATE_FIELDS) const ActorInit En_Ishi_InitVars = { ACTOR_EN_ISHI, diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 6507bceb82..4ed41bc1a7 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -10,6 +10,7 @@ #include "vt.h" #include "soh/frame_interpolation.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_THROW_ONLY) @@ -37,7 +38,7 @@ void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 s void EnNiw_FeatherUpdate(EnNiw* this, PlayState* play); void EnNiw_FeatherDraw(EnNiw* this, PlayState* play); -s16 D_80AB85E0 = 0; +static s16 D_80AB85E0 = 0; const ActorInit En_Niw_InitVars = { ACTOR_EN_NIW, @@ -72,9 +73,16 @@ static s16 sKakarikoFlagList[] = { 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, }; -u8 sLowerRiverSpawned = false; +static u8 sLowerRiverSpawned = false; -u8 sUpperRiverSpawned = false; +static u8 sUpperRiverSpawned = false; + +#define EN_NIW_SHIP_SAVESTATE_FIELDS(F) \ + F(D_80AB85E0) \ + F(sLowerRiverSpawned) \ + F(sUpperRiverSpawned) + +SHIP_SAVESTATE_DEFINE(EnNiw, EN_NIW_SHIP_SAVESTATE_FIELDS) static ColliderCylinderInit sCylinderInit1 = { { diff --git a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index aa7c66526b..d9ec4e06c2 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -9,6 +9,7 @@ #include "objects/object_po_field/object_po_field.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #include @@ -130,7 +131,7 @@ static DamageTable sDamageTable = { /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -s32 sEnPoFieldNumSpawned = 0; +static s32 sEnPoFieldNumSpawned = 0; static Vec3f sFieldMiddle = { -1000.0f, 0.0f, 6500.0f }; @@ -149,10 +150,17 @@ static EnPoFieldInfo sPoFieldInfo[2] = { static Vec3f D_80AD714C = { 0.0f, 1400.0f, 0.0f }; -Vec3s sEnPoFieldSpawnPositions[10]; -u8 sEnPoFieldSpawnSwitchFlags[10]; +static Vec3s sEnPoFieldSpawnPositions[10]; +static u8 sEnPoFieldSpawnSwitchFlags[10]; static MtxF sLimb7Mtx; +#define EN_PO_FIELD_SHIP_SAVESTATE_FIELDS(F) \ + F(sEnPoFieldNumSpawned) \ + F(sEnPoFieldSpawnPositions) \ + F(sEnPoFieldSpawnSwitchFlags) + +SHIP_SAVESTATE_DEFINE(EnPoField, EN_PO_FIELD_SHIP_SAVESTATE_FIELDS) + void EnPoField_Init(Actor* thisx, PlayState* play) { EnPoField* this = (EnPoField*)thisx; s32 pad; diff --git a/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c b/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c index 6b3fab93af..7121096387 100644 --- a/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c +++ b/soh/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c @@ -9,6 +9,7 @@ #include "objects/object_ts/object_ts.h" #include "soh/OTRGlobals.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -40,7 +41,11 @@ const ActorInit En_Takara_Man_InitVars = { (ActorResetFunc)EnTakaraMan_Reset, }; -u8 sTakaraIsInitialized = false; +static u8 sTakaraIsInitialized = false; + +#define EN_TAKARA_MAN_SHIP_SAVESTATE_FIELDS(F) F(sTakaraIsInitialized) + +SHIP_SAVESTATE_DEFINE(EnTakaraMan, EN_TAKARA_MAN_SHIP_SAVESTATE_FIELDS) void EnTakaraMan_Reset(Actor* thisx, PlayState* play) { sTakaraIsInitialized = false; diff --git a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c index ad3c000f3c..8e93c9dc93 100644 --- a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -15,6 +15,7 @@ #include "vt.h" #include "soh/ResourceManagerHelpers.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -491,7 +492,7 @@ void func_80B3D118(PlayState* play) { static Vec3f D_80B42DA0; -s32 D_80B41D90 = 0; +static s32 D_80B41D90 = 0; void EnXc_SetColossusWindSFX(PlayState* play) { if (gSaveContext.sceneLayer == 4) { static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; @@ -528,7 +529,7 @@ void EnXc_SetColossusWindSFX(PlayState* play) { } } -s32 sEnXcFlameSpawned = false; +static s32 sEnXcFlameSpawned = false; void EnXc_SpawnFlame(EnXc* this, PlayState* play) { if (!sEnXcFlameSpawned) { @@ -563,7 +564,7 @@ void EnXc_DestroyFlame(EnXc* this) { Actor_Kill(&this->actor); } -s32 D_80B41DA8 = 1; +static s32 D_80B41DA8 = 1; void EnXc_InitFlame(EnXc* this, PlayState* play) { s32 pad; s16 sceneNum = play->sceneNum; @@ -1442,7 +1443,16 @@ void func_80B3F534(PlayState* play) { } } -s32 D_80B41DAC = 1; +static s32 D_80B41DAC = 1; + +#define EN_XC_SHIP_SAVESTATE_FIELDS(F) \ + F(D_80B41D90) \ + F(sEnXcFlameSpawned) \ + F(D_80B41DA8) \ + F(D_80B41DAC) + +SHIP_SAVESTATE_DEFINE(EnXc, EN_XC_SHIP_SAVESTATE_FIELDS) + void func_80B3F59C(EnXc* this, PlayState* play) { CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 0); diff --git a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c index bb01a56b5d..7398186777 100644 --- a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -8,6 +8,7 @@ #include "objects/object_zf/object_zf.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) @@ -99,8 +100,14 @@ static Vec3f sPlatformPositions[] = { }; // These seem to relate to the tagging in/out the minibosses do -s16 D_80B4A1B0 = 0; -s16 D_80B4A1B4 = 1; +static s16 D_80B4A1B0 = 0; +static s16 D_80B4A1B4 = 1; + +#define EN_ZF_SHIP_SAVESTATE_FIELDS(F) \ + F(D_80B4A1B0) \ + F(D_80B4A1B4) + +SHIP_SAVESTATE_DEFINE(EnZf, EN_ZF_SHIP_SAVESTATE_FIELDS) const ActorInit En_Zf_InitVars = { ACTOR_EN_ZF, diff --git a/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 6db4fa1a55..9f85b3f20a 100644 --- a/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/soh/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -13,6 +13,7 @@ #include "objects/object_zl2_anime2/object_zl2_anime2.h" #include "soh/ResourceManagerHelpers.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/savestate_serialize.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -47,7 +48,7 @@ static void* sEyeTextures[] = { gZelda2EyeOpenTex, gZelda2EyeHalfTex, gZelda2Eye static void* sMouthTextures[] = { gZelda2MouthSeriousTex, gZelda2MouthHappyTex, gZelda2MouthOpenTex }; -s32 D_80B5A468 = 0; +static s32 D_80B5A468 = 0; static Vec3f D_80B5A46C = { 0.0f, 0.0f, 0.0f }; @@ -57,7 +58,7 @@ static f32 D_80B5A484 = 0.0f; static Vec3f D_80B5A488 = { 0.0f, 0.0f, 0.0f }; -s32 D_80B5A494 = -1; +static s32 D_80B5A494 = -1; static Vec3f D_80B5A498 = { 148.0f, 260.0f, -87.0f }; @@ -65,7 +66,14 @@ static Vec3f D_80B5A4A4 = { -12.0f, 260.0f, -147.0f }; static Vec3f D_80B5A4B0 = { 42.0f, 260.0f, 13.0f }; -u32 D_80B5A4BC = 0; +static u32 D_80B5A4BC = 0; + +#define EN_ZL3_SHIP_SAVESTATE_FIELDS(F) \ + F(D_80B5A468) \ + F(D_80B5A494) \ + F(D_80B5A4BC) + +SHIP_SAVESTATE_DEFINE(EnZl3, EN_ZL3_SHIP_SAVESTATE_FIELDS) void func_80B533B0(Actor* thisx, PlayState* play) { EnZl3* this = (EnZl3*)thisx; diff --git a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index c3d044522c..edc44d8cbe 100644 --- a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -10,6 +10,7 @@ #include "objects/object_spot02_objects/object_spot02_objects.h" #include "soh/frame_interpolation.h" +#include "soh/Enhancements/savestate_serialize.h" #include #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) @@ -60,8 +61,14 @@ const ActorInit Object_Kankyo_InitVars = { (ActorResetFunc)ObjectKankyo_Reset, }; -u8 sKankyoIsSpawned = false; -s16 sTrailingFairies = 0; +static u8 sKankyoIsSpawned = false; +static s16 sTrailingFairies = 0; + +#define OBJECT_KANKYO_SHIP_SAVESTATE_FIELDS(F) \ + F(sKankyoIsSpawned) \ + F(sTrailingFairies) + +SHIP_SAVESTATE_DEFINE(ObjectKankyo, OBJECT_KANKYO_SHIP_SAVESTATE_FIELDS) void ObjectKankyo_SetupAction(ObjectKankyo* this, ObjectKankyoActionFunc action) { this->actionFunc = action;