Save states (#300)

This commit is contained in:
louist103 2022-05-12 13:28:24 -04:00 committed by GitHub
parent 5746305157
commit 635fb71b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 2084 additions and 634 deletions

View File

@ -1,3 +1,6 @@
#ifndef CONFIG_FILE_H
#define CONFIG_FILE_H
#pragma once #pragma once
#include <string> #include <string>
@ -35,3 +38,5 @@ namespace Ship {
mINI::INIFile File; mINI::INIFile File;
}; };
} }
#endif

View File

@ -1,3 +1,6 @@
#ifndef GAME_VERSION_H
#define GAME_VERSION_H
#pragma once #pragma once
#define OOT_NTSC_10 0xEC7011B7 #define OOT_NTSC_10 0xEC7011B7
@ -17,4 +20,6 @@
#define OOT_PAL_GC_MQ_DBG 0x917D18F6 #define OOT_PAL_GC_MQ_DBG 0x917D18F6
#define OOT_IQUE_TW 0x3D81FB3E #define OOT_IQUE_TW 0x3D81FB3E
#define OOT_IQUE_CN 0xB1E1E07B #define OOT_IQUE_CN 0xB1E1E07B
#define OOT_UNKNOWN 0xFFFFFFFF #define OOT_UNKNOWN 0xFFFFFFFF
#endif

View File

@ -1,3 +1,6 @@
#ifndef GLOBAL_CTX_2
#define GLOBAL_CTX_2
#pragma once #pragma once
#ifdef __cplusplus #ifdef __cplusplus
@ -38,4 +41,6 @@ namespace Ship {
std::string PatchesPath; std::string PatchesPath;
}; };
} }
#endif #endif
#endif

View File

@ -24,6 +24,7 @@
#include <chrono> #include <chrono>
#include "SohHooks.h" #include "SohHooks.h"
#include "SohConsole.h" #include "SohConsole.h"
#include <iostream> #include <iostream>
extern "C" { extern "C" {
@ -328,6 +329,8 @@ namespace Ship {
GlobalCtx2::GetInstance()->GetWindow()->ToggleFullscreen(); GlobalCtx2::GetInstance()->GetWindow()->ToggleFullscreen();
} }
// OTRTODO: Rig with Kirito's console? // OTRTODO: Rig with Kirito's console?
//if (dwScancode == Ship::stoi(Conf["KEYBOARD SHORTCUTS"]["KEY_CONSOLE"])) { //if (dwScancode == Ship::stoi(Conf["KEYBOARD SHORTCUTS"]["KEY_CONSOLE"])) {
// ToggleConsole(); // ToggleConsole();

View File

@ -29,6 +29,7 @@ void gDPSetTextureImage(Gfx* pkt, u32 f, u32 s, u32 w, uintptr_t i);
void gSPDisplayList(Gfx* pkt, Gfx* dl); void gSPDisplayList(Gfx* pkt, Gfx* dl);
void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset); void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset);
void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0); void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0);
void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr);
void cleararena(void); void cleararena(void);
void bootproc(void); void bootproc(void);
@ -2406,6 +2407,7 @@ void Heaps_Free(void);
#ifdef __cplusplus #ifdef __cplusplus
#undef this #undef this
}; };
#undef this
#endif #endif
#endif #endif

View File

@ -1,7 +1,12 @@
#ifndef STDDEF_H #ifndef STDDEF_H
#define STDDEF_H #define STDDEF_H
#ifndef __cplusplus
#define NULL ((void*)0) #define NULL ((void*)0)
#else
#define NULL nullptr
#endif
#if 0 #if 0
#define size_t unsigned long #define size_t unsigned long
#define ssize_t long #define ssize_t long

View File

@ -30,6 +30,9 @@
#include "ichain.h" #include "ichain.h"
#include "regs.h" #include "regs.h"
#define AUDIO_HEAP_SIZE 0x38000
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 4)
#ifdef __cplusplus #ifdef __cplusplus
namespace Ship namespace Ship
{ {

View File

@ -180,6 +180,7 @@
<ClCompile Include="soh\Enhancements\debugger\debugSaveEditor.cpp" /> <ClCompile Include="soh\Enhancements\debugger\debugSaveEditor.cpp" />
<ClCompile Include="soh\Enhancements\debugger\ImGuiHelpers.cpp" /> <ClCompile Include="soh\Enhancements\debugger\ImGuiHelpers.cpp" />
<ClCompile Include="soh\Enhancements\gameconsole.c" /> <ClCompile Include="soh\Enhancements\gameconsole.c" />
<ClCompile Include="soh\Enhancements\savestates.cpp" />
<ClCompile Include="soh\GbiWrap.cpp" /> <ClCompile Include="soh\GbiWrap.cpp" />
<ClCompile Include="soh\gu_pc.c" /> <ClCompile Include="soh\gu_pc.c" />
<ClCompile Include="soh\OTRGlobals.cpp" /> <ClCompile Include="soh\OTRGlobals.cpp" />
@ -328,7 +329,6 @@
<ClCompile Include="src\code\z_msgevent.c" /> <ClCompile Include="src\code\z_msgevent.c" />
<ClCompile Include="src\code\z_olib.c" /> <ClCompile Include="src\code\z_olib.c" />
<ClCompile Include="src\code\z_onepointdemo.c" /> <ClCompile Include="src\code\z_onepointdemo.c" />
<ClCompile Include="src\code\z_onepointdemo_data.c" />
<ClCompile Include="src\code\z_parameter.c" /> <ClCompile Include="src\code\z_parameter.c" />
<ClCompile Include="src\code\z_path.c" /> <ClCompile Include="src\code\z_path.c" />
<ClCompile Include="src\code\z_play.c" /> <ClCompile Include="src\code\z_play.c" />
@ -926,10 +926,12 @@
<ClInclude Include="soh\Enhancements\cvar.h" /> <ClInclude Include="soh\Enhancements\cvar.h" />
<ClInclude Include="soh\Enhancements\debugconsole.h" /> <ClInclude Include="soh\Enhancements\debugconsole.h" />
<ClInclude Include="soh\Enhancements\debugger\colViewer.h" /> <ClInclude Include="soh\Enhancements\debugger\colViewer.h" />
<ClInclude Include="soh\Enhancements\savestates.h" />
<ClInclude Include="soh\Enhancements\debugger\debugger.h" /> <ClInclude Include="soh\Enhancements\debugger\debugger.h" />
<ClInclude Include="soh\Enhancements\debugger\debugSaveEditor.h" /> <ClInclude Include="soh\Enhancements\debugger\debugSaveEditor.h" />
<ClInclude Include="soh\Enhancements\debugger\ImGuiHelpers.h" /> <ClInclude Include="soh\Enhancements\debugger\ImGuiHelpers.h" />
<ClInclude Include="soh\gameconsole.h" /> <ClInclude Include="soh\gameconsole.h" />
<ClInclude Include="soh\OTRAudio.h" />
<ClInclude Include="soh\OTRGlobals.h" /> <ClInclude Include="soh\OTRGlobals.h" />
<ClInclude Include="soh\util.h" /> <ClInclude Include="soh\util.h" />
<ClInclude Include="src\overlays\actors\ovl_Arms_Hook\z_arms_hook.h" /> <ClInclude Include="src\overlays\actors\ovl_Arms_Hook\z_arms_hook.h" />
@ -1409,4 +1411,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -630,9 +630,6 @@
<ClCompile Include="src\code\z_onepointdemo.c"> <ClCompile Include="src\code\z_onepointdemo.c">
<Filter>Source Files\src\code</Filter> <Filter>Source Files\src\code</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\code\z_onepointdemo_data.c">
<Filter>Source Files\src\code</Filter>
</ClCompile>
<ClCompile Include="src\code\z_parameter.c"> <ClCompile Include="src\code\z_parameter.c">
<Filter>Source Files\src\code</Filter> <Filter>Source Files\src\code</Filter>
</ClCompile> </ClCompile>
@ -2190,6 +2187,12 @@
<ClCompile Include="soh\Enhancements\debugger\ImGuiHelpers.cpp"> <ClCompile Include="soh\Enhancements\debugger\ImGuiHelpers.cpp">
<Filter>Source Files\soh\Enhancements\debugger</Filter> <Filter>Source Files\soh\Enhancements\debugger</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\code\z_cheap_proc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="soh\Enhancements\savestates.cpp">
<Filter>Source Files\soh\Enhancements</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\overlays\actors\ovl_kaleido_scope\z_kaleido_scope.h"> <ClInclude Include="src\overlays\actors\ovl_kaleido_scope\z_kaleido_scope.h">
@ -3746,6 +3749,12 @@
<ClInclude Include="soh\Enhancements\debugger\ImGuiHelpers.h"> <ClInclude Include="soh\Enhancements\debugger\ImGuiHelpers.h">
<Filter>Header Files\soh\Enhancements\debugger</Filter> <Filter>Header Files\soh\Enhancements\debugger</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="soh\Enhancements\savestates.h">
<Filter>Source Files\soh\Enhancements</Filter>
</ClInclude>
<ClInclude Include="soh\OTRAudio.h">
<Filter>Source Files\soh</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="include\macro.inc"> <None Include="include\macro.inc">

View File

@ -1,7 +1,15 @@
#ifdef _MSC_VER
#define NOGDI
#endif
#include "debugconsole.h" #include "debugconsole.h"
#include "../libultraship/SohImGuiImpl.h" #include "../libultraship/SohImGuiImpl.h"
#include "savestates.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include "soh/OTRGlobals.h"
#define Path _Path #define Path _Path
#define PATH_HACK #define PATH_HACK
@ -303,6 +311,66 @@ static bool EntranceHandler(const std::vector<std::string>& args) {
gSaveContext.nextTransition = 11; gSaveContext.nextTransition = 11;
} }
static bool SaveStateHandler(const std::vector<std::string>& args) {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE });
switch (rtn) {
case SaveStateReturn::SUCCESS:
INFO("[SOH] Saved state to slot %u", slot);
return CMD_SUCCESS;
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
ERROR("[SOH] Can not save a state outside of \"GamePlay\"");
return CMD_FAILED;
}
}
static bool LoadStateHandler(const std::vector<std::string>& args) {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD });
switch (rtn) {
case SaveStateReturn::SUCCESS:
INFO("[SOH] Loaded state from slot %u", slot);
return CMD_SUCCESS;
case SaveStateReturn::FAIL_INVALID_SLOT:
ERROR("[SOH] Invalid State Slot Number (%u)", slot);
return CMD_FAILED;
case SaveStateReturn::FAIL_STATE_EMPTY:
ERROR("[SOH] State Slot (%u) is empty", slot);
return CMD_FAILED;
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
ERROR("[SOH] Can not load a state outside of \"GamePlay\"");
return CMD_FAILED;
}
}
static bool StateSlotSelectHandler(const std::vector<std::string>& args) {
if (args.size() != 2) {
ERROR("[SOH] Unexpected arguments passed");
return CMD_FAILED;
}
int slot;
try {
slot = std::stoi(args[1], nullptr, 10);
} catch (std::invalid_argument const& ex) {
ERROR("[SOH] SaveState slot value must be a number.");
return CMD_FAILED;
}
if (slot < 0) {
ERROR("[SOH] Invalid slot passed. Slot must be between 0 and 2");
return CMD_FAILED;
}
OTRGlobals::Instance->gSaveStateMgr->SetCurrentSlot(slot);
INFO("[SOH] Slot %u selected", OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot());
return CMD_SUCCESS;
}
#define VARTYPE_INTEGER 0 #define VARTYPE_INTEGER 0
#define VARTYPE_FLOAT 1 #define VARTYPE_FLOAT 1
#define VARTYPE_STRING 2 #define VARTYPE_STRING 2
@ -416,6 +484,13 @@ void DebugConsole_Init(void) {
{ { "slot", ArgumentType::NUMBER }, { "item id", ArgumentType::NUMBER } } }); { { "slot", ArgumentType::NUMBER }, { "item id", ArgumentType::NUMBER } } });
CMD_REGISTER("entrance", CMD_REGISTER("entrance",
{ EntranceHandler, "Sends player to the entered entrance (hex)", { { "entrance", ArgumentType::NUMBER } } }); { EntranceHandler, "Sends player to the entered entrance (hex)", { { "entrance", ArgumentType::NUMBER } } });
CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." });
CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." });
CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", {
{ "Slot number", ArgumentType::NUMBER, }
} });
DebugConsole_LoadCVars();
} }
template <typename Numeric> bool is_number(const std::string& s) { template <typename Numeric> bool is_number(const std::string& s) {

View File

@ -0,0 +1,957 @@
#include "savestates.h"
#include "GameVersions.h"
#include <cstdio> // std::sprintf
#include "spdlog/spdlog.h"
#include <soh/OTRGlobals.h>
#include <soh/OTRAudio.h>
#include <SohImGuiImpl.h>
#include "z64.h"
#include "z64save.h"
#include <variables.h>
#include <functions.h>
#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"
extern "C" GlobalContext* gGlobalCtx;
// FROM z_lights.c
// I didn't feel like moving it into a header file.
#define LIGHTS_BUFFER_SIZE 32
typedef struct {
/* 0x000 */ s32 numOccupied;
/* 0x004 */ s32 searchIndex;
/* 0x008 */ LightNode buf[LIGHTS_BUFFER_SIZE];
} LightsBuffer; // size = 0x188
#include "savestates_extern.inc"
typedef struct SaveStateInfo {
unsigned char sysHeapCopy[SYSTEM_HEAP_SIZE];
unsigned char audioHeapCopy[AUDIO_HEAP_SIZE];
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
unk_D_8016E750 unk_D_8016E750Copy[4];
ActiveSound gActiveSoundsCopy[7][MAX_CHANNELS_PER_BANK];
uint8_t gSoundBankMutedCopy[7];
u8 D_801333F0_copy;
u8 gAudioSfxSwapOff_copy;
uint16_t gAudioSfxSwapSource_copy[10];
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 D_8011DB08_copy;
int16_t D_8011DB0C_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;
//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;
//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;
} SaveStateInfo;
class SaveState {
friend class SaveStateMgr;
public:
SaveState(std::shared_ptr<SaveStateMgr> mgr, unsigned int slot);
private:
unsigned int slot;
std::shared_ptr<SaveStateMgr> saveStateMgr;
std::shared_ptr<SaveStateInfo> info;
void Save(void);
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);
SaveStateInfo* GetSaveStateInfo(void);
};
SaveStateMgr::SaveStateMgr() {
this->SetCurrentSlot(0);
}
SaveStateMgr::~SaveStateMgr() {
this->states.clear();
}
SaveState::SaveState(std::shared_ptr<SaveStateMgr> mgr, unsigned int slot) : saveStateMgr(mgr), slot(slot), info(nullptr) {
this->info = std::make_shared<SaveStateInfo>();
}
void SaveState::BackupSeqScriptState(void) {
for (unsigned int i = 0; i < 4; i++) {
info->seqScriptStateCopy[i].value = gAudioContext.seqPlayers[i].scriptState.value;
info->seqScriptStateCopy[i].remLoopIters[0] = gAudioContext.seqPlayers[i].scriptState.remLoopIters[0];
info->seqScriptStateCopy[i].remLoopIters[1] = gAudioContext.seqPlayers[i].scriptState.remLoopIters[1];
info->seqScriptStateCopy[i].remLoopIters[2] = gAudioContext.seqPlayers[i].scriptState.remLoopIters[2];
info->seqScriptStateCopy[i].remLoopIters[3] = gAudioContext.seqPlayers[i].scriptState.remLoopIters[3];
info->seqScriptStateCopy[i].depth = gAudioContext.seqPlayers[i].scriptState.depth;
info->seqScriptStateCopy[i].pc = (u8*)((uintptr_t)gAudioContext.seqPlayers[i].scriptState.pc - (uintptr_t)gAudioHeap);
info->seqScriptStateCopy[i].stack[0] =
(u8*)((uintptr_t)gAudioContext.seqPlayers[i].scriptState.stack[0] - (uintptr_t)gAudioHeap);
info->seqScriptStateCopy[i].stack[1] =
(u8*)((uintptr_t)gAudioContext.seqPlayers[i].scriptState.stack[1] - (uintptr_t)gAudioHeap);
info->seqScriptStateCopy[i].stack[2] =
(u8*)((uintptr_t)gAudioContext.seqPlayers[i].scriptState.stack[2] - (uintptr_t)gAudioHeap);
info->seqScriptStateCopy[i].stack[3] =
(u8*)((uintptr_t)gAudioContext.seqPlayers[i].scriptState.stack[3] - (uintptr_t)gAudioHeap);
}
}
void SaveState::LoadSeqScriptState(void) {
for (unsigned int i = 0; i < 4; i++) {
gAudioContext.seqPlayers[i].scriptState.value = info->seqScriptStateCopy[i].value;
gAudioContext.seqPlayers[i].scriptState.remLoopIters[0] = info->seqScriptStateCopy[i].remLoopIters[0];
gAudioContext.seqPlayers[i].scriptState.remLoopIters[1] = info->seqScriptStateCopy[i].remLoopIters[1];
gAudioContext.seqPlayers[i].scriptState.remLoopIters[2] = info->seqScriptStateCopy[i].remLoopIters[2];
gAudioContext.seqPlayers[i].scriptState.remLoopIters[3] = info->seqScriptStateCopy[i].remLoopIters[3];
gAudioContext.seqPlayers[i].scriptState.depth = info->seqScriptStateCopy[i].depth;
gAudioContext.seqPlayers[i].scriptState.pc =
(u8*)((uintptr_t)info->seqScriptStateCopy[i].pc + (uintptr_t)gAudioHeap);
gAudioContext.seqPlayers[i].scriptState.stack[0] =
(u8*)((uintptr_t)info->seqScriptStateCopy[i].stack[0] + (uintptr_t)gAudioHeap);
gAudioContext.seqPlayers[i].scriptState.stack[1] =
(u8*)((uintptr_t)info->seqScriptStateCopy[i].stack[1] + (uintptr_t)gAudioHeap);
gAudioContext.seqPlayers[i].scriptState.stack[2] =
(u8*)((uintptr_t)info->seqScriptStateCopy[i].stack[2] + (uintptr_t)gAudioHeap);
gAudioContext.seqPlayers[i].scriptState.stack[3] =
(u8*)((uintptr_t)info->seqScriptStateCopy[i].stack[3] + (uintptr_t)gAudioHeap);
}
}
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->D_8011DB08_copy = D_8011DB08;
info->D_8011DB0C_copy = D_8011DB0C;
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));
D_8011DB08 = info->D_8011DB08_copy;
D_8011DB0C = info->D_8011DB0C_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;
}
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;
}
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;
}
extern "C" void ProcessSaveStateRequests(void) {
OTRGlobals::Instance->gSaveStateMgr->ProcessSaveStateRequests();
}
void SaveStateMgr::SetCurrentSlot(unsigned int slot) {
SohImGui::overlay->TextDrawNotification(1.0f, true, "slot %u set", slot);
this->currentSlot = slot;
}
unsigned int SaveStateMgr::GetCurrentSlot(void) {
return this->currentSlot;
}
void SaveStateMgr::ProcessSaveStateRequests(void) {
while (!this->requests.empty()) {
const auto& request = this->requests.front();
switch (request.type) {
case RequestType::SAVE:
if (!this->states.contains(request.slot)) {
this->states[request.slot] = std::make_shared<SaveState>(OTRGlobals::Instance->gSaveStateMgr, request.slot);
}
this->states[request.slot]->Save();
SohImGui::overlay->TextDrawNotification(1.0f, true, "saved state %u", request.slot);
break;
case RequestType::LOAD:
if (this->states.contains(request.slot)) {
this->states[request.slot]->Load();
SohImGui::overlay->TextDrawNotification(1.0f, true, "loaded state %u", request.slot);
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
}
break;
[[unlikely]] default:
SPDLOG_ERROR("Invalid SaveState request type: {}", request.type);
break;
}
this->requests.pop();
}
}
SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) {
if (gGlobalCtx == nullptr) {
SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\"");
SohImGui::overlay->TextDrawNotification(1.0f, true, "states not available here", request.slot);
return SaveStateReturn::FAIL_WRONG_GAMESTATE;
}
switch (request.type) {
case RequestType::SAVE:
requests.push(request);
break;
case RequestType::LOAD:
if (states.contains(request.slot)) {
requests.push(request);
} else {
SPDLOG_ERROR("Invalid SaveState slot: {}", request.type);
SohImGui::overlay->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot);
return SaveStateReturn::FAIL_INVALID_SLOT;
}
break;
[[unlikely]] default:
SPDLOG_ERROR("Invalid SaveState request type: {}", request.type);
return SaveStateReturn::FAIL_BAD_REQUEST;
break;
}
}
void SaveState::Save(void) {
std::unique_lock<std::mutex> Lock(audio.mutex);
memcpy(&info->sysHeapCopy, gSystemHeap, SYSTEM_HEAP_SIZE /* sizeof(gSystemHeap) */);
memcpy(&info->audioHeapCopy, gAudioHeap, AUDIO_HEAP_SIZE /* sizeof(gAudioContext) */);
memcpy(&info->audioContextCopy, &gAudioContext, sizeof(AudioContext));
memcpy(&info->unk_D_8016E750Copy, D_8016E750, sizeof(info->unk_D_8016E750Copy));
BackupSeqScriptState();
memcpy(info->gActiveSoundsCopy, gActiveSounds, sizeof(gActiveSounds));
memcpy(&info->gSoundBankMutedCopy, gSoundBankMuted, sizeof(info->gSoundBankMutedCopy));
info->D_801333F0_copy = D_801333F0;
info->gAudioSfxSwapOff_copy = gAudioSfxSwapOff;
memcpy(&info->gAudioSfxSwapSource_copy, gAudioSfxSwapSource,
sizeof(info->gAudioSfxSwapSource_copy));
memcpy(&info->gAudioSfxSwapTarget_copy, gAudioSfxSwapTarget,
sizeof(info->gAudioSfxSwapTarget_copy));
memcpy(&info->gAudioSfxSwapMode_copy, gAudioSfxSwapMode,
sizeof(info->gAudioSfxSwapMode_copy));
info->D_801755D0_copy = D_801755D0;
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();
}
void SaveState::Load(void) {
std::unique_lock<std::mutex> Lock(audio.mutex);
memcpy(gSystemHeap, &info->sysHeapCopy, SYSTEM_HEAP_SIZE);
memcpy(gAudioHeap, &info->audioHeapCopy, AUDIO_HEAP_SIZE);
memcpy(&gAudioContext, &info->audioContextCopy, sizeof(AudioContext));
memcpy(D_8016E750, &info->unk_D_8016E750Copy, sizeof(info->unk_D_8016E750Copy));
LoadSeqScriptState();
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));
D_801333F0 = info->D_801333F0_copy;
gAudioSfxSwapOff = info->gAudioSfxSwapOff_copy;
memcpy(gAudioSfxSwapSource, &info->gAudioSfxSwapSource_copy,
sizeof(info->gAudioSfxSwapSource_copy));
memcpy(gAudioSfxSwapTarget, &info->gAudioSfxSwapTarget_copy,
sizeof(info->gAudioSfxSwapTarget_copy));
memcpy(gAudioSfxSwapMode, &info->gAudioSfxSwapMode_copy,
sizeof(info->gAudioSfxSwapMode_copy));
//Various static data
D_801755D0 = info->D_801755D0_copy;
LoadCameraData();
LoadOnePointDemoData();
LoadOverlayStaticData();
LoadMiscCodeData();
}

View File

@ -0,0 +1,62 @@
#ifndef SAVE_STATES_H
#define SAVE_STATES_H
#include <cstdint>
#include <queue>
#include <unordered_map>
#include <memory>
#include <mutex>
enum class SaveStateReturn {
SUCCESS,
FAIL_INVALID_SLOT,
FAIL_NO_MEMORY,
FAIL_STATE_EMPTY,
FAIL_WRONG_GAMESTATE,
FAIL_BAD_REQUEST,
};
typedef struct SaveStateHeader {
uint32_t stateMagic;
uint32_t stateVersion;
//uint32_t gameVersion;
} SaveStateHeader;
enum class RequestType {
SAVE,
LOAD,
};
typedef struct SaveStateRequest {
unsigned int slot;
RequestType type;
} SaveStateRequest;
class SaveState;
class SaveStateMgr {
friend class SaveState;
private:
unsigned int currentSlot;
std::unordered_map<unsigned int, std::shared_ptr<SaveState>> states;
std::queue <SaveStateRequest> requests;
std::mutex mutex;
public:
SaveStateReturn AddRequest(const SaveStateRequest request);
SaveStateMgr();
~SaveStateMgr();
void SetCurrentSlot(unsigned int slot);
unsigned int GetCurrentSlot(void);
SaveStateMgr& operator=(const SaveStateMgr& rhs) = delete;
SaveStateMgr(const SaveStateMgr& rhs) = delete;
void ProcessSaveStateRequests(void);
};
extern std::shared_ptr<SaveStateMgr> gSaveStateMgr;
#endif

View File

@ -0,0 +1,257 @@
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 D_8011DB08;
extern "C" int16_t D_8011DB0C;
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;
// 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;

8
soh/soh/OTRAudio.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
static struct {
std::condition_variable cv_to_thread, cv_from_thread;
std::mutex mutex;
bool initialized;
bool processing;
} audio;

View File

@ -1,4 +1,5 @@
#include "OTRGlobals.h" #include "OTRGlobals.h"
#include "OTRAudio.h"
#include <iostream> #include <iostream>
#include <locale> #include <locale>
#include <codecvt> #include <codecvt>
@ -33,17 +34,14 @@
#include "macros.h" #include "macros.h"
#include <Utils/StringHelper.h> #include <Utils/StringHelper.h>
#include <SDL2/SDL_scancode.h>
OTRGlobals* OTRGlobals::Instance; OTRGlobals* OTRGlobals::Instance;
static struct {
std::condition_variable cv_to_thread, cv_from_thread;
std::mutex mutex;
bool initialized;
bool processing;
} audio;
OTRGlobals::OTRGlobals() { OTRGlobals::OTRGlobals() {
context = Ship::GlobalCtx2::CreateInstance("Ship of Harkinian"); context = Ship::GlobalCtx2::CreateInstance("Ship of Harkinian");
gSaveStateMgr = std::make_shared<SaveStateMgr>();
context->GetWindow()->Init(); context->GetWindow()->Init();
} }
@ -114,6 +112,63 @@ extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
} }
extern "C" void Graph_StartFrame() { extern "C" void Graph_StartFrame() {
// Why -1?
int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->lastScancode;
OTRGlobals::Instance->context->GetWindow()->lastScancode = -1;
switch (dwScancode - 1) {
case SDL_SCANCODE_F5: {
const unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn stateReturn =
OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE });
switch (stateReturn) {
case SaveStateReturn::SUCCESS:
SPDLOG_INFO("[SOH] Saved state to slot {}", slot);
break;
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
SPDLOG_ERROR("[SOH] Can not save a state outside of \"GamePlay\"");
break;
[[unlikely]] default:
break;
}
break;
}
case SDL_SCANCODE_F6: {
unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
slot++;
if (slot > 5) {
slot = 0;
}
OTRGlobals::Instance->gSaveStateMgr->SetCurrentSlot(slot);
SPDLOG_INFO("Set SaveState slot to {}.", slot);
break;
}
case SDL_SCANCODE_F7: {
const unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot();
const SaveStateReturn stateReturn =
OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD });
switch (stateReturn) {
case SaveStateReturn::SUCCESS:
SPDLOG_INFO("[SOH] Loaded state from slot {}", slot);
break;
case SaveStateReturn::FAIL_INVALID_SLOT:
SPDLOG_ERROR("[SOH] Invalid State Slot Number {}", slot);
break;
case SaveStateReturn::FAIL_STATE_EMPTY:
SPDLOG_ERROR("[SOH] State Slot {} is empty", slot);
break;
case SaveStateReturn::FAIL_WRONG_GAMESTATE:
SPDLOG_ERROR("[SOH] Can not load a state outside of \"GamePlay\"");
break;
[[unlikely]] default:
break;
}
break;
}
}
OTRGlobals::Instance->context->GetWindow()->StartFrame(); OTRGlobals::Instance->context->GetWindow()->StartFrame();
} }
@ -131,6 +186,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
audio.cv_to_thread.wait(Lock); audio.cv_to_thread.wait(Lock);
} }
} }
std::unique_lock<std::mutex> Lock(audio.mutex);
//AudioMgr_ThreadEntry(&gAudioMgr); //AudioMgr_ThreadEntry(&gAudioMgr);
// 528 and 544 relate to 60 fps at 32 kHz 32000/60 = 533.333.. // 528 and 544 relate to 60 fps at 32 kHz 32000/60 = 533.333..
// in an ideal world, one third of the calls should use num_samples=544 and two thirds num_samples=528 // in an ideal world, one third of the calls should use num_samples=544 and two thirds num_samples=528
@ -156,10 +212,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
// printf("Audio samples before submitting: %d\n", audio_api->buffered()); // printf("Audio samples before submitting: %d\n", audio_api->buffered());
AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE)); AudioPlayer_Play((u8*)audio_buffer, num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
{ audio.processing = false;
std::unique_lock<std::mutex> Lock(audio.mutex);
audio.processing = false;
}
audio.cv_from_thread.notify_one(); audio.cv_from_thread.notify_one();
} }
}).detach(); }).detach();

View File

@ -1,17 +1,22 @@
#ifndef OTR_GLOBALS_H
#define OTR_GLOBALS_H
#pragma once #pragma once
#include "GlobalCtx2.h" #include "GlobalCtx2.h"
#ifdef __cplusplus #ifdef __cplusplus
#include "Enhancements/savestates.h"
class OTRGlobals class OTRGlobals
{ {
public: public:
static OTRGlobals* Instance; static OTRGlobals* Instance;
std::shared_ptr<Ship::GlobalCtx2> context; std::shared_ptr<Ship::GlobalCtx2> context;
std::shared_ptr<SaveStateMgr> gSaveStateMgr;
OTRGlobals(); OTRGlobals();
~OTRGlobals(); ~OTRGlobals();
private: private:
@ -68,3 +73,5 @@ void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples); void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
int Controller_ShouldRumble(size_t i); int Controller_ShouldRumble(size_t i);
#endif #endif
#endif

View File

@ -6,9 +6,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#define AUDIO_HEAP_SIZE 0x38000
#define SYSTEM_HEAP_SIZE (1024 * 1024 * 128)
u8* gAudioHeap; u8* gAudioHeap;
u8* gSystemHeap; u8* gSystemHeap;

View File

@ -431,6 +431,8 @@ static struct RunFrameContext {
extern AudioMgr gAudioMgr; extern AudioMgr gAudioMgr;
extern void ProcessSaveStateRequests(void);
static void RunFrame() static void RunFrame()
{ {
u32 size; u32 size;
@ -487,6 +489,7 @@ static void RunFrame()
//uint64_t diff = (ticksB - ticksA) / (freq / 1000); //uint64_t diff = (ticksB - ticksA) / (freq / 1000);
//printf("Frame simulated in %ims\n", diff); //printf("Frame simulated in %ims\n", diff);
runFrameContext.state = 1; runFrameContext.state = 1;
ProcessSaveStateRequests();
return; return;
nextFrame:; nextFrame:;
} }

View File

@ -565,10 +565,10 @@ s16 Camera_XZAngle(Vec3f* to, Vec3f* from) {
return DEGF_TO_BINANG(RADF_TO_DEGF(Math_FAtan2F(from->x - to->x, from->z - to->z))); 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;
s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) { s16 func_80044ADC(Camera* camera, s16 yaw, s16 arg2) {
static f32 D_8015CE50;
static f32 D_8015CE54;
static CamColChk D_8015CE58;
Vec3f playerPos; Vec3f playerPos;
Vec3f rotatedPos; Vec3f rotatedPos;
Vec3f floorNorm; Vec3f floorNorm;
@ -7221,9 +7221,9 @@ s32 Camera_DbgChangeMode(Camera* camera) {
return true; return true;
} }
s16 D_8011DB08 = 0x3F0;
s16 D_8011DB0C = 0x156;
void func_80058E8C(Camera* camera) { void func_80058E8C(Camera* camera) {
static s16 D_8011DB08 = 0x3F0;
static s16 D_8011DB0C = 0x156;
s32 pad3; s32 pad3;
f32 sp60; f32 sp60;
s32 pad; s32 pad;
@ -7299,8 +7299,8 @@ void func_80058E8C(Camera* camera) {
} }
} }
s32 sOOBTimer = 0;
Vec3s Camera_Update(Camera* camera) { Vec3s Camera_Update(Camera* camera) {
static s32 sOOBTimer = 0;
Vec3f viewAt; Vec3f viewAt;
Vec3f viewEye; Vec3f viewEye;
Vec3f viewUp; Vec3f viewUp;

View File

@ -52,7 +52,7 @@ static MapMarkDataOverlay sMapMarkDataOvl = {
gMapMarkDataTable, gMapMarkDataTable,
}; };
static MapMarkData** sLoadedMarkDataTable; MapMarkData** sLoadedMarkDataTable;
void MapMark_Init(GlobalContext* globalCtx) { void MapMark_Init(GlobalContext* globalCtx) {
MapMarkDataOverlay* overlay = &sMapMarkDataOvl; MapMarkDataOverlay* overlay = &sMapMarkDataOvl;

View File

@ -4,9 +4,9 @@
static s16 sDisableAttention = false; static s16 sDisableAttention = false;
static s16 sUnused = -1; static s16 sUnused = -1;
static s32 sPrevFrameCs1100 = -4096; s32 sPrevFrameCs1100 = -4096;
#include "z_onepointdemo_data.c" #include "z_onepointdemo_data.inc"
void OnePointCutscene_AddVecSphToVec3f(Vec3f* dst, Vec3f* src, VecSph* vecSph) { void OnePointCutscene_AddVecSphToVec3f(Vec3f* dst, Vec3f* src, VecSph* vecSph) {
Vec3f out; Vec3f out;

View File

@ -1,6 +1,6 @@
#include "global.h" #include "global.h"
static CutsceneCameraPoint D_8012013C[14] = { CutsceneCameraPoint D_8012013C[14] = {
{ CS_CMD_CONTINUE, 25, 40, 70.79991f, { -1814, 533, -1297 } }, { CS_CMD_CONTINUE, 25, 40, 70.79991f, { -1814, 533, -1297 } },
{ CS_CMD_CONTINUE, 20, 40, 70.99991f, { -1805, 434, -1293 } }, { CS_CMD_CONTINUE, 20, 40, 70.99991f, { -1805, 434, -1293 } },
{ CS_CMD_CONTINUE, 10, 30, 60.0f, { -1794, 323, -1280 } }, { CS_CMD_CONTINUE, 10, 30, 60.0f, { -1794, 323, -1280 } },
@ -16,7 +16,7 @@ static CutsceneCameraPoint D_8012013C[14] = {
{ CS_CMD_STOP, 0, 50, 60.0f, { -1974, 12, -1179 } }, { CS_CMD_STOP, 0, 50, 60.0f, { -1974, 12, -1179 } },
{ CS_CMD_STOP, 0, 30, 60.0f, { -1974, 12, -1179 } }, { CS_CMD_STOP, 0, 30, 60.0f, { -1974, 12, -1179 } },
}; };
static CutsceneCameraPoint D_8012021C[14] = { 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, 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, { -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 } }, { 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 } }, { CS_CMD_STOP, 0, 0, 60.0f, { 0, 62, -119 } }, { CS_CMD_STOP, 0, 0, 60.0f, { 0, 62, -119 } },
}; };
static CutsceneCameraPoint D_801204D4[14] = { CutsceneCameraPoint D_801204D4[14] = {
{ CS_CMD_CONTINUE, -15, 40, 80.600006f, { -60, 332, 183 } }, { CS_CMD_CONTINUE, -15, 40, 80.600006f, { -60, 332, 183 } },
{ CS_CMD_CONTINUE, -22, 30, 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 } }, { CS_CMD_CONTINUE, -20, 38, 80.600006f, { -118, 344, 41 } },
@ -70,7 +70,7 @@ static CutsceneCameraPoint D_801204D4[14] = {
{ CS_CMD_STOP, 6, 30, 85.199936f, { 25, 127, -950 } }, { CS_CMD_STOP, 6, 30, 85.199936f, { 25, 127, -950 } },
{ CS_CMD_STOP, 0, 30, 85.199936f, { 25, 127, -950 } }, { CS_CMD_STOP, 0, 30, 85.199936f, { 25, 127, -950 } },
}; };
static CutsceneCameraPoint D_801205B4[14] = { CutsceneCameraPoint D_801205B4[14] = {
{ CS_CMD_CONTINUE, 0, 0, 60.0f, { -225, 785, -242 } }, { 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, { -245, 784, -242 } },
{ CS_CMD_CONTINUE, -21, 0, 80.600006f, { -288, 485, -379 } }, { 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_801208E4 = 90;
static s16 D_801208E8 = 8; static s16 D_801208E8 = 8;
static OnePointCsFull D_801208EC[3] = { 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 } }, { 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80120964[2] = { 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 } }, { 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 } }, { 0x81, 0xFF, 0xA121, 1, 0, 75.0f, 0.6f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 0.0f, 150.0f } },
}; };
static OnePointCsFull D_801209B4[4] = { 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 } }, { 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 } }, { 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 } }, { 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 } }, { 0x8B, 0xFF, 0x0022, 5000, 0, 75.0f, 0.005f, { 0.0f, 0.0f, -10.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80120ACC[5] = { 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 } }, { 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 } }, { 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 } }, { 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 @@ static 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 } }, { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80120B94[11] = { 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 } }, { 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, 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 } }, { 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 @@ static 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 } }, { 0x98, 0xFF, 0x0000, 1, 0, 50.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80120D4C[7] = { 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 } }, { 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, 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80120FA4[6] = { 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 } }, { 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 } }, { 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80121184[2] = { 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_801211D4[2] = { 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 } }, { 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 } }, { 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 } }, { 0x8F, 0x08, 0x4141, 1000, 0, 75.0f, 0.6f, { 0.0f, 0.0f, 10.0f }, { 0.0f, 0.0f, 100.0f } },
}; };
static OnePointCsFull D_8012133C[3] = { 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 } }, { 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 } }, { 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 } }, { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_801213B4[5] = { 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 } }, { 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 } }, { 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 } }, { 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 } }, { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_8012151C[2] = { 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_8012156C[2] = { 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 } }, { 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 } }, { 0x81, 0xFF, 0x4242, -1, 0, 65.0f, 1.0f, { -50.0f, 60.0f, 0.0f }, { -60.0f, 40.0f, 150.0f } },
}; };
static OnePointCsFull D_801215BC[1] = { 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80121C24[7] = { 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 } }, { 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 } }, { 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 } }, { 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 @@ static 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 } }, { 0x11, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80121D3C[3] = { 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 } }, { 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 } }, { 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80121F1C[4] = { 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 } }, { 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, 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 } }, { 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 } }, { 0x11, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80121FBC[4] = { 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 } }, { 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 } }, { 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 } }, { 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 } }, { 0x01, 0x01, 0x21A1, 10, 0, 60.0f, 1.0f, { 0.0f, -10.0f, 0.0f }, { 0.0f, 10.0f, -200.0f } },
}; };
static OnePointCsFull D_801220D4[5] = { 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 } }, { 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, 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 } }, { 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 } }, { 0x11, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80122714[4] = { 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 } }, { 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, -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 } }, { 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 } }, { 0x0F, 0xFF, 0x0101, 999, 5, 60.0f, 1.0f, { -70.0f, 140.0f, 25.0f }, { 10.0f, 180.0f, 195.0f } },
}; };
static OnePointCsFull D_80122CB4[2] = { 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 } }, { 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 } }, { 0x02, 0xFF, 0x4242, -1, 0, 60.0f, 1.0f, { 0.0f, 0.0f, -100.0f }, { 0.0f, 0.0f, 0.0f } },
}; };
static OnePointCsFull D_80122D04[2] = { 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 } }, { 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 } }, { 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 } }, { 0x11, 0xFF, 0x0000, 1, -1, -1.0f, -1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80122E44[2][7] = { 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 } }, { 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 } }, { 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 } }, { 0x92, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_8012313C[3] = { 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 } }, { 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 } }, { 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 } }, { 0x92, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_801231B4[4] = { 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 } }, { 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 } }, { 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 } }, { 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 } }, { 0x81, 0xC5, 0x4343, -1, 0, -1.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80123254[2] = { 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 } }, { 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 } }, { 0x03, 0xC5, 0x0101, 49, 0, 50.0f, 0.05f, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } },
}; };
static OnePointCsFull D_801232A4[1] = { 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 } }, { 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 } }, { 0x0F, 0xFF, 0x0000, 100, -45, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },
}; };
static OnePointCsFull D_80123894[3] = { 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, 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 } }, { 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 } }, { 0x0D, 0xFF, 0x0000, 120, 0, 180.0f, 0.4f, { 0.0f, -5.0f, 0.0f }, { 0.0f, 2.0f, 40.0f } },
}; };
static OnePointCsFull D_8012390C[2] = { 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, 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 } }, { 0x0F, 0xFF, 0x4242, 180, 0, 60.0f, 1.0f, { 0.0f, 78.0f, 0.0f }, { 0.0f, 78.0f, 200.0f } },
}; };
static OnePointCsFull D_8012395C[3] = { 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, 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 } }, { 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 } }, { 0x0D, 0xFF, 0x0000, 120, 0, 180.0f, 0.4f, { 0.0f, -5.0f, 0.0f }, { 0.0f, 2.0f, 45.0f } },
}; };
static OnePointCsFull D_801239D4[3] = { 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 } }, { 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 } }, { 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 } }, { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } },

View File

@ -421,7 +421,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
input = globalCtx->state.input; input = globalCtx->state.input;
if ((SREG(1) < 0) || (DREG(0) != 0)) { if ((SREG(1) < 0) || (DREG(0) != 0)) {
SREG(1) = 0; SREG(1) = 0;
ZeldaArena_Display(); ZeldaArena_Display();
} }

View File

@ -121,8 +121,8 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) {
} }
} }
static Vec3f velocity = { 0.0f, 5.0f, 0.0f }; Vec3f sBgDdanKdVelocity = { 0.0f, 5.0f, 0.0f };
static Vec3f accel = { 0.0f, -0.45f, 0.0f }; Vec3f sBgDdanKdAccel = { 0.0f, -0.45f, 0.0f };
void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
Vec3f pos1; Vec3f pos1;
@ -158,11 +158,11 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_80033480(globalCtx, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1); func_80033480(globalCtx, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1);
velocity.x = Rand_CenteredFloat(3.0f); sBgDdanKdVelocity.x = Rand_CenteredFloat(3.0f);
velocity.z = Rand_CenteredFloat(3.0f); sBgDdanKdVelocity.z = Rand_CenteredFloat(3.0f);
func_8003555C(globalCtx, &pos1, &velocity, &accel); func_8003555C(globalCtx, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel);
func_8003555C(globalCtx, &pos2, &velocity, &accel); func_8003555C(globalCtx, &pos2, &sBgDdanKdVelocity, &sBgDdanKdAccel);
pos1 = this->dyna.actor.world.pos; pos1 = this->dyna.actor.world.pos;
pos1.z += 560.0f + Rand_ZeroOne() * 5.0f; pos1.z += 560.0f + Rand_ZeroOne() * 5.0f;
@ -170,7 +170,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f); pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f);
func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); func_80033480(globalCtx, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_8003555C(globalCtx, &pos1, &velocity, &accel); func_8003555C(globalCtx, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel);
} }
Camera_AddQuake(&globalCtx->mainCamera, 0, effectStrength * 0.6f, 3); Camera_AddQuake(&globalCtx->mainCamera, 0, effectStrength * 0.6f, 3);
Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4, &D_801333E0, Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4, &D_801333E0,
@ -192,11 +192,11 @@ void BgDdanKd_Draw(Actor* thisx, GlobalContext* globalCtx) {
} }
void BgDdanKd_Reset(void) { void BgDdanKd_Reset(void) {
velocity.x = 0.0f; sBgDdanKdVelocity.x = 0.0f;
velocity.y = 5.0f; sBgDdanKdVelocity.y = 5.0f;
velocity.z = 0.0f; sBgDdanKdVelocity.z = 0.0f;
accel.x = 0.0f; sBgDdanKdAccel.x = 0.0f;
accel.y = -0.45f; sBgDdanKdAccel.y = -0.45f;
accel.z = 0.0f; sBgDdanKdAccel.z = 0.0f;
} }

View File

@ -74,13 +74,13 @@ static ColliderCylinderInit sColCylinderInitLeftRight = {
{ 50, 60, 280, { 0, 0, 0 } }, { 50, 60, 280, { 0, 0, 0 } },
}; };
static s16 sFirstExplosiveFlag = false; s16 sBgDodoagoFirstExplosiveFlag = false;
static u8 sDisableBombCatcher; u8 sBgDodoagoDisableBombCatcher;
static u8 sUnused[90]; // unknown length //static u8 sUnused[90]; // unknown length
static s32 sTimer; s32 sBgDodoagoTimer;
void BgDodoago_SetupAction(BgDodoago* this, BgDodoagoActionFunc actionFunc) { void BgDodoago_SetupAction(BgDodoago* this, BgDodoagoActionFunc actionFunc) {
this->actionFunc = actionFunc; this->actionFunc = actionFunc;
@ -135,7 +135,7 @@ void BgDodoago_Init(Actor* thisx, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight); Collider_SetCylinder(globalCtx, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight);
BgDodoago_SetupAction(this, BgDodoago_WaitExplosives); BgDodoago_SetupAction(this, BgDodoago_WaitExplosives);
sDisableBombCatcher = false; sBgDodoagoDisableBombCatcher = false;
} }
void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgDodoago_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@ -170,16 +170,16 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) {
} else { } else {
OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, MAIN_CAM); OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, MAIN_CAM);
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
sTimer += 30; sBgDodoagoTimer += 30;
return; return;
} }
// the flag is never set back to false, so this only runs once // the flag is never set back to false, so this only runs once
if (!sFirstExplosiveFlag) { if (!sBgDodoagoFirstExplosiveFlag) {
// this disables the bomb catcher (see BgDodoago_Update) for a few seconds // this disables the bomb catcher (see BgDodoago_Update) for a few seconds
this->dyna.actor.parent = explosive; this->dyna.actor.parent = explosive;
sFirstExplosiveFlag = true; sBgDodoagoFirstExplosiveFlag = true;
sTimer = 50; sBgDodoagoTimer = 50;
} }
} else if (Flags_GetEventChkInf(0xB0)) { } else if (Flags_GetEventChkInf(0xB0)) {
Collider_UpdateCylinder(&this->dyna.actor, &this->colliderMain); Collider_UpdateCylinder(&this->dyna.actor, &this->colliderMain);
@ -219,11 +219,11 @@ void BgDodoago_OpenJaw(BgDodoago* this, GlobalContext* globalCtx) {
} }
if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) { if (globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || globalCtx->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) {
sTimer--; sBgDodoagoTimer--;
return; return;
} }
if (sTimer == 108) { if (sBgDodoagoTimer == 108) {
for (i = ARRAY_COUNT(dustOffsets) - 1; i >= 0; i--) { for (i = ARRAY_COUNT(dustOffsets) - 1; i >= 0; i--) {
pos.x = dustOffsets[i].x + this->dyna.actor.world.pos.x; pos.x = dustOffsets[i].x + this->dyna.actor.world.pos.x;
pos.y = dustOffsets[i].y + this->dyna.actor.world.pos.y; pos.y = dustOffsets[i].y + this->dyna.actor.world.pos.y;
@ -290,16 +290,16 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) {
this->dyna.actor.parent = &bomb->actor; this->dyna.actor.parent = &bomb->actor;
bomb->timer = 50; bomb->timer = 50;
bomb->actor.speedXZ = 0.0f; bomb->actor.speedXZ = 0.0f;
sTimer = 0; sBgDodoagoTimer = 0;
} }
} }
} else { } else {
sTimer++; sBgDodoagoTimer++;
Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F); Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
if (!sDisableBombCatcher && sTimer > 140) { if (!sBgDodoagoDisableBombCatcher && sBgDodoagoTimer > 140) {
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
// this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher // this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher
sDisableBombCatcher++; sBgDodoagoDisableBombCatcher++;
} else { } else {
this->dyna.actor.parent = NULL; this->dyna.actor.parent = NULL;
} }
@ -322,7 +322,7 @@ void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx) {
} }
void BgDodoago_Reset(void) { void BgDodoago_Reset(void) {
sFirstExplosiveFlag = false; sBgDodoagoFirstExplosiveFlag = false;
sDisableBombCatcher = 0; sBgDodoagoDisableBombCatcher = 0;
sTimer = 0; sBgDodoagoTimer = 0;
} }

View File

@ -47,7 +47,7 @@ void BgHakaGate_SkullOfTruth(BgHakaGate* this, GlobalContext* globalCtx);
void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx); void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx);
static s16 sSkullOfTruthRotY = 0x100; static s16 sSkullOfTruthRotY = 0x100;
static u8 sPuzzleState = 1; static u8 sBgPoEventPuzzleState = 1;
static f32 sStatueDistToPlayer = 0; static f32 sStatueDistToPlayer = 0;
static s16 sStatueRotY; static s16 sStatueRotY;
@ -82,7 +82,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) {
if (sSkullOfTruthRotY != 0x100) { if (sSkullOfTruthRotY != 0x100) {
this->actionFunc = BgHakaGate_FalseSkull; this->actionFunc = BgHakaGate_FalseSkull;
} else if (ABS(thisx->shape.rot.y) < 0x4000) { } else if (ABS(thisx->shape.rot.y) < 0x4000) {
if ((Rand_ZeroOne() * 3.0f) < sPuzzleState) { if ((Rand_ZeroOne() * 3.0f) < sBgPoEventPuzzleState) {
this->vIsSkullOfTruth = true; this->vIsSkullOfTruth = true;
sSkullOfTruthRotY = thisx->shape.rot.y + 0x8000; sSkullOfTruthRotY = thisx->shape.rot.y + 0x8000;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) { if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
@ -91,7 +91,7 @@ void BgHakaGate_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = BgHakaGate_SkullOfTruth; this->actionFunc = BgHakaGate_SkullOfTruth;
} }
} else { } else {
sPuzzleState++; sBgPoEventPuzzleState++;
this->actionFunc = BgHakaGate_FalseSkull; this->actionFunc = BgHakaGate_FalseSkull;
} }
} else { } else {
@ -141,7 +141,7 @@ void BgHakaGate_Destroy(Actor* thisx, GlobalContext* globalCtx) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
if (this->dyna.actor.params == BGHAKAGATE_STATUE) { if (this->dyna.actor.params == BGHAKAGATE_STATUE) {
sSkullOfTruthRotY = 0x100; sSkullOfTruthRotY = 0x100;
sPuzzleState = 1; sBgPoEventPuzzleState = 1;
} }
} }
@ -178,7 +178,7 @@ void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) {
} }
} }
} else { } else {
if (sPuzzleState == SKULL_OF_TRUTH_FOUND) { if (sBgPoEventPuzzleState == SKULL_OF_TRUTH_FOUND) {
this->actionFunc = BgHakaGate_StatueInactive; this->actionFunc = BgHakaGate_StatueInactive;
} else { } else {
this->vTimer = 0; this->vTimer = 0;
@ -243,7 +243,7 @@ void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) {
sStatueDistToPlayer = 0.0f; sStatueDistToPlayer = 0.0f;
if (ABS(yawDiff) < 0x80) { if (ABS(yawDiff) < 0x80) {
Flags_SetSwitch(globalCtx, this->switchFlag); Flags_SetSwitch(globalCtx, this->switchFlag);
sPuzzleState = SKULL_OF_TRUTH_FOUND; sBgPoEventPuzzleState = SKULL_OF_TRUTH_FOUND;
this->actionFunc = BgHakaGate_DoNothing; this->actionFunc = BgHakaGate_DoNothing;
} else { } else {
func_80078884(NA_SE_SY_ERROR); func_80078884(NA_SE_SY_ERROR);

View File

@ -28,7 +28,7 @@ void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx);
void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx); void func_80880C0C(BgHakaTrap* this, GlobalContext* globalCtx);
void func_80880D68(BgHakaTrap* this); void func_80880D68(BgHakaTrap* this);
static UNK_TYPE D_80880F30 = 0; UNK_TYPE D_80880F30 = 0;
const ActorInit Bg_Haka_Trap_InitVars = { const ActorInit Bg_Haka_Trap_InitVars = {
ACTOR_BG_HAKA_TRAP, ACTOR_BG_HAKA_TRAP,
@ -107,7 +107,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
}; };
static UNK_TYPE D_80881014 = 0; UNK_TYPE D_80881014 = 0;
void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) { void BgHakaTrap_Init(Actor* thisx, GlobalContext* globalCtx) {
BgHakaTrap* this = (BgHakaTrap*)thisx; BgHakaTrap* this = (BgHakaTrap*)thisx;
s32 pad; s32 pad;

View File

@ -120,7 +120,7 @@ void func_8088B24C(BgHidanRock* this) {
this->actionFunc = func_8088B990; this->actionFunc = func_8088B990;
} }
static f32 D_8088BFC0 = 0.0f; f32 D_8088BFC0 = 0.0f;
void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) {
f32 sp2C; f32 sp2C;
s32 temp_v1; s32 temp_v1;

View File

@ -23,7 +23,7 @@ void BgJya1flift_SetupDoNothing(BgJya1flift* this);
void BgJya1flift_ResetMoveDelay(BgJya1flift* this); void BgJya1flift_ResetMoveDelay(BgJya1flift* this);
void BgJya1flift_DelayMove(BgJya1flift* this, GlobalContext* globalCtx); void BgJya1flift_DelayMove(BgJya1flift* this, GlobalContext* globalCtx);
static u8 sIsSpawned = false; static u8 sKankyoIsSpawned = false;
const ActorInit Bg_Jya_1flift_InitVars = { const ActorInit Bg_Jya_1flift_InitVars = {
ACTOR_BG_JYA_1FLIFT, ACTOR_BG_JYA_1FLIFT,
@ -94,9 +94,9 @@ void BgJya1flift_InitCollision(Actor* thisx, GlobalContext* globalCtx) {
void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) { void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJya1flift* this = (BgJya1flift*)thisx; BgJya1flift* this = (BgJya1flift*)thisx;
// "1 F lift" // "1 F lift"
osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sIsSpawned, globalCtx->roomCtx.curRoom.num); osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sKankyoIsSpawned, globalCtx->roomCtx.curRoom.num);
this->hasInitialized = false; this->hasInitialized = false;
if (sIsSpawned) { if (sKankyoIsSpawned) {
Actor_Kill(thisx); Actor_Kill(thisx);
return; return;
} }
@ -109,7 +109,7 @@ void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJya1flift_SetupWaitForSwitch(this); BgJya1flift_SetupWaitForSwitch(this);
} }
thisx->room = -1; thisx->room = -1;
sIsSpawned = true; sKankyoIsSpawned = true;
this->hasInitialized = true; this->hasInitialized = true;
} }
@ -117,7 +117,7 @@ void BgJya1flift_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgJya1flift* this = (BgJya1flift*)thisx; BgJya1flift* this = (BgJya1flift*)thisx;
if (this->hasInitialized) { if (this->hasInitialized) {
sIsSpawned = false; sKankyoIsSpawned = false;
Collider_DestroyCylinder(globalCtx, &this->collider); Collider_DestroyCylinder(globalCtx, &this->collider);
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }

View File

@ -14,7 +14,7 @@ void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx); void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx);
void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx); void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx);
static u8 sIsSpawned = false; static u8 sKankyoIsSpawned = false;
const ActorInit Bg_Jya_Bigmirror_InitVars = { const ActorInit Bg_Jya_Bigmirror_InitVars = {
ACTOR_BG_JYA_BIGMIRROR, ACTOR_BG_JYA_BIGMIRROR,
@ -176,7 +176,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) {
void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) { void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; BgJyaBigmirror* this = (BgJyaBigmirror*)thisx;
if (sIsSpawned) { if (sKankyoIsSpawned) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
} }
@ -185,7 +185,7 @@ void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) {
this->cobraInfo[0].rotY = sCobraSpawnData[0].initRotY; this->cobraInfo[0].rotY = sCobraSpawnData[0].initRotY;
this->cobraInfo[1].rotY = sCobraSpawnData[1].initRotY; this->cobraInfo[1].rotY = sCobraSpawnData[1].initRotY;
this->actor.room = -1; this->actor.room = -1;
sIsSpawned = true; sKankyoIsSpawned = true;
this->spawned = true; this->spawned = true;
this->mirRayObjIndex = -1; this->mirRayObjIndex = -1;
@ -197,7 +197,7 @@ void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; BgJyaBigmirror* this = (BgJyaBigmirror*)thisx;
if (this->spawned) { if (this->spawned) {
sIsSpawned = false; sKankyoIsSpawned = false;
} }
} }

View File

@ -20,7 +20,7 @@ void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx);
void BgJyaLift_SetupMove(BgJyaLift* this); void BgJyaLift_SetupMove(BgJyaLift* this);
void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx); void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx);
static s16 sIsSpawned = false; static s16 sKankyoIsSpawned = false;
const ActorInit Bg_Jya_Lift_InitVars = { const ActorInit Bg_Jya_Lift_InitVars = {
ACTOR_BG_JYA_LIFT, ACTOR_BG_JYA_LIFT,
@ -55,7 +55,7 @@ void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJyaLift* this = (BgJyaLift*)thisx; BgJyaLift* this = (BgJyaLift*)thisx;
this->isSpawned = false; this->isSpawned = false;
if (sIsSpawned) { if (sKankyoIsSpawned) {
Actor_Kill(thisx); Actor_Kill(thisx);
return; return;
} }
@ -70,7 +70,7 @@ void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) {
BgJyaLift_SetInitPosY(this); BgJyaLift_SetInitPosY(this);
} }
thisx->room = -1; thisx->room = -1;
sIsSpawned = true; sKankyoIsSpawned = true;
this->isSpawned = true; this->isSpawned = true;
} }
@ -81,7 +81,7 @@ void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx) {
// "Goddess Lift DT" // "Goddess Lift DT"
osSyncPrintf("女神リフト DT\n"); osSyncPrintf("女神リフト DT\n");
sIsSpawned = false; sKankyoIsSpawned = false;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
} }
} }

View File

@ -28,7 +28,7 @@ const ActorInit Bg_Menkuri_Eye_InitVars = {
(ActorResetFunc)BgMenkuriEye_Reset, (ActorResetFunc)BgMenkuriEye_Reset,
}; };
static s32 D_8089C1A0; s32 D_8089C1A0;
static ColliderJntSphElementInit sJntSphElementsInit[1] = { static ColliderJntSphElementInit sJntSphElementsInit[1] = {
{ {

View File

@ -17,7 +17,7 @@ void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx);
void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCtx); void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCtx);
void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx); void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx);
static s16 sIsSpawned = false; static s16 sKankyoIsSpawned = false;
const ActorInit Bg_Mori_Elevator_InitVars = { const ActorInit Bg_Mori_Elevator_InitVars = {
ACTOR_BG_MORI_ELEVATOR, ACTOR_BG_MORI_ELEVATOR,
@ -87,18 +87,18 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
this->unk_172 = sIsSpawned; this->unk_172 = sKankyoIsSpawned;
this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) { if (this->moriTexObjIndex < 0) {
Actor_Kill(thisx); Actor_Kill(thisx);
// "Forest Temple obj elevator Bank Danger!" // "Forest Temple obj elevator Bank Danger!"
osSyncPrintf("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277); osSyncPrintf("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277);
} else { } else {
switch (sIsSpawned) { switch (sKankyoIsSpawned) {
case false: case false:
// "Forest Temple elevator CT" // "Forest Temple elevator CT"
osSyncPrintf("森の神殿 elevator CT\n"); osSyncPrintf("森の神殿 elevator CT\n");
sIsSpawned = true; sKankyoIsSpawned = true;
this->dyna.actor.room = -1; this->dyna.actor.room = -1;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
@ -120,7 +120,7 @@ void BgMoriElevator_Destroy(Actor* thisx, GlobalContext* globalCtx) {
// "Forest Temple elevator DT" // "Forest Temple elevator DT"
osSyncPrintf("森の神殿 elevator DT\n"); osSyncPrintf("森の神殿 elevator DT\n");
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
sIsSpawned = false; sKankyoIsSpawned = false;
} }
} }

View File

@ -28,7 +28,7 @@ void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, GlobalContext* globalCtx
void BgMoriHineri_DoNothing(BgMoriHineri* this, GlobalContext* globalCtx); void BgMoriHineri_DoNothing(BgMoriHineri* this, GlobalContext* globalCtx);
void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx); void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx);
static s16 sNextCamIdx = SUBCAM_NONE; s16 sBgMoriHineriNextCamIdx = SUBCAM_NONE;
const ActorInit Bg_Mori_Hineri_InitVars = { const ActorInit Bg_Mori_Hineri_InitVars = {
ACTOR_BG_MORI_HINERI, ACTOR_BG_MORI_HINERI,
@ -194,28 +194,28 @@ void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx) {
OnePointCutscene_EndCutscene(globalCtx, mainCamChildIdx); OnePointCutscene_EndCutscene(globalCtx, mainCamChildIdx);
} }
OnePointCutscene_Init(globalCtx, 3260, 40, &this->dyna.actor, MAIN_CAM); OnePointCutscene_Init(globalCtx, 3260, 40, &this->dyna.actor, MAIN_CAM);
sNextCamIdx = OnePointCutscene_Init(globalCtx, 3261, 40, &this->dyna.actor, MAIN_CAM); sBgMoriHineriNextCamIdx = OnePointCutscene_Init(globalCtx, 3261, 40, &this->dyna.actor, MAIN_CAM);
} }
} }
void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) { void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) {
s8 objBankIndex; s8 objBankIndex;
if (globalCtx->activeCamera == sNextCamIdx) { if (globalCtx->activeCamera == sBgMoriHineriNextCamIdx) {
if (sNextCamIdx != MAIN_CAM) { if (sBgMoriHineriNextCamIdx != MAIN_CAM) {
objBankIndex = this->dyna.actor.objBankIndex; objBankIndex = this->dyna.actor.objBankIndex;
this->dyna.actor.objBankIndex = this->moriHineriObjIdx; this->dyna.actor.objBankIndex = this->moriHineriObjIdx;
this->moriHineriObjIdx = objBankIndex; this->moriHineriObjIdx = objBankIndex;
this->dyna.actor.params ^= 1; this->dyna.actor.params ^= 1;
sNextCamIdx = MAIN_CAM; sBgMoriHineriNextCamIdx = MAIN_CAM;
func_80078884(NA_SE_SY_TRE_BOX_APPEAR); func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
} else { } else {
this->dyna.actor.draw = NULL; this->dyna.actor.draw = NULL;
this->actionFunc = func_808A3D58; this->actionFunc = func_808A3D58;
sNextCamIdx = SUBCAM_NONE; sBgMoriHineriNextCamIdx = SUBCAM_NONE;
} }
} }
if ((sNextCamIdx >= SUBCAM_FIRST) && if ((sBgMoriHineriNextCamIdx >= SUBCAM_FIRST) &&
((GET_ACTIVE_CAM(globalCtx)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) { ((GET_ACTIVE_CAM(globalCtx)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) {
func_8002F948(&this->dyna.actor, NA_SE_EV_FLOOR_ROLLING - SFX_FLAG); func_8002F948(&this->dyna.actor, NA_SE_EV_FLOOR_ROLLING - SFX_FLAG);
} }
@ -283,5 +283,5 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) {
} }
void BgMoriHineri_Reset() { void BgMoriHineri_Reset() {
sNextCamIdx = SUBCAM_NONE; sBgMoriHineriNextCamIdx = SUBCAM_NONE;
} }

View File

@ -19,7 +19,7 @@ void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, GlobalContext* globalCtx)
void BgMoriIdomizu_SetupMain(BgMoriIdomizu* this); void BgMoriIdomizu_SetupMain(BgMoriIdomizu* this);
void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx); void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx);
static s16 sIsSpawned = false; static s16 sKankyoIsSpawned = false;
const ActorInit Bg_Mori_Idomizu_InitVars = { const ActorInit Bg_Mori_Idomizu_InitVars = {
ACTOR_BG_MORI_IDOMIZU, ACTOR_BG_MORI_IDOMIZU,
@ -50,7 +50,7 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx;
if (sIsSpawned) { if (sKankyoIsSpawned) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
} }
@ -76,7 +76,7 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) {
return; return;
} }
BgMoriIdomizu_SetupWaitForMoriTex(this); BgMoriIdomizu_SetupWaitForMoriTex(this);
sIsSpawned = true; sKankyoIsSpawned = true;
this->isLoaded = true; this->isLoaded = true;
this->actor.room = -1; this->actor.room = -1;
// "Forest Temple well water" // "Forest Temple well water"
@ -88,7 +88,7 @@ void BgMoriIdomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx;
if (this->isLoaded) { if (this->isLoaded) {
sIsSpawned = false; sKankyoIsSpawned = false;
} }
} }

View File

@ -80,11 +80,11 @@ static ColliderTrisInit sTrisInit = {
sTrisElementsInit, sTrisElementsInit,
}; };
static u8 sBlocksAtRest = 0; u8 sBgPoEventBlocksAtRest = 0;
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
static u8 sPuzzleState; u8 sBgPoEventPuzzleState;
void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) { void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) {
static s16 paintingPosX[] = { -1302, -866, 1421, 985 }; static s16 paintingPosX[] = { -1302, -866, 1421, 985 };
@ -142,10 +142,10 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, GlobalContext* globalCtx) {
} }
this->timer = 0; this->timer = 0;
if (this->type == 4) { if (this->type == 4) {
sPuzzleState = 0; sBgPoEventPuzzleState = 0;
this->actionFunc = BgPoEvent_AmyWait; this->actionFunc = BgPoEvent_AmyWait;
} else { } else {
sPuzzleState = (s32)(Rand_ZeroOne() * 3.0f) % 3; sBgPoEventPuzzleState = (s32)(Rand_ZeroOne() * 3.0f) % 3;
this->actionFunc = BgPoEvent_PaintingEmpty; this->actionFunc = BgPoEvent_PaintingEmpty;
} }
} }
@ -236,7 +236,7 @@ void BgPoEvent_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) { void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) {
this->dyna.actor.world.pos.y = 833.0f; this->dyna.actor.world.pos.y = 833.0f;
if (sPuzzleState == 0x3F) { if (sBgPoEventPuzzleState == 0x3F) {
if (this->type == 1) { if (this->type == 1) {
OnePointCutscene_Init(globalCtx, 3150, 65, NULL, MAIN_CAM); OnePointCutscene_Init(globalCtx, 3150, 65, NULL, MAIN_CAM);
} }
@ -244,14 +244,14 @@ void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) {
this->actionFunc = BgPoEvent_BlockShake; this->actionFunc = BgPoEvent_BlockShake;
} else if (this->dyna.actor.xzDistToPlayer > 50.0f) { } else if (this->dyna.actor.xzDistToPlayer > 50.0f) {
if (this->type != 1) { if (this->type != 1) {
sPuzzleState |= (1 << this->index); sBgPoEventPuzzleState |= (1 << this->index);
} else { } else {
sPuzzleState |= 0x10; sBgPoEventPuzzleState |= 0x10;
} }
} else if (this->type != 1) { } else if (this->type != 1) {
sPuzzleState &= ~(1 << this->index); sBgPoEventPuzzleState &= ~(1 << this->index);
} else { } else {
sPuzzleState &= ~0x10; sBgPoEventPuzzleState &= ~0x10;
} }
} }
@ -265,7 +265,7 @@ void BgPoEvent_BlockShake(BgPoEvent* this, GlobalContext* globalCtx) {
} }
if (this->timer == 0) { if (this->timer == 0) {
this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x;
sPuzzleState = 0; sBgPoEventPuzzleState = 0;
this->timer = 60; this->timer = 60;
this->actionFunc = BgPoEvent_BlockFall; this->actionFunc = BgPoEvent_BlockFall;
} }
@ -299,9 +299,9 @@ void BgPoEvent_CheckBlock(BgPoEvent* this) {
} }
} }
if ((phi_v1 == phi_a1) && ((phi_t0 - phi_a3) == 60)) { if ((phi_v1 == phi_a1) && ((phi_t0 - phi_a3) == 60)) {
sPuzzleState |= (1 << this->index); sBgPoEventPuzzleState |= (1 << this->index);
} else { } else {
sPuzzleState &= ~(1 << this->index); sBgPoEventPuzzleState &= ~(1 << this->index);
} }
} }
@ -312,7 +312,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, 433.0f, this->dyna.actor.velocity.y)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, 433.0f, this->dyna.actor.velocity.y)) {
this->dyna.actor.flags &= ~ACTOR_FLAG_5; this->dyna.actor.flags &= ~ACTOR_FLAG_5;
this->dyna.actor.velocity.y = 0.0f; this->dyna.actor.velocity.y = 0.0f;
sBlocksAtRest++; sBgPoEventBlocksAtRest++;
if (this->type != 1) { if (this->type != 1) {
BgPoEvent_CheckBlock(this); BgPoEvent_CheckBlock(this);
} else { } else {
@ -334,7 +334,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx); Player* player = GET_PLAYER(globalCtx);
Actor* amy; Actor* amy;
if (sPuzzleState == 0xF) { if (sBgPoEventPuzzleState == 0xF) {
this->actionFunc = BgPoEvent_BlockSolved; this->actionFunc = BgPoEvent_BlockSolved;
if ((this->type == 0) && (this->index == 0)) { if ((this->type == 0) && (this->index == 0)) {
amy = amy =
@ -348,23 +348,23 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) {
gSaveContext.timer1State = 0xA; gSaveContext.timer1State = 0xA;
} }
} else { } else {
if ((gSaveContext.timer1Value == 0) && (sBlocksAtRest == 5)) { if ((gSaveContext.timer1Value == 0) && (sBgPoEventBlocksAtRest == 5)) {
player->stateFlags2 &= ~0x10; player->stateFlags2 &= ~0x10;
sPuzzleState = 0x10; sBgPoEventPuzzleState = 0x10;
sBlocksAtRest = 0; sBgPoEventBlocksAtRest = 0;
} }
if ((sPuzzleState == 0x40) || ((sPuzzleState == 0x10) && !Player_InCsMode(globalCtx))) { if ((sBgPoEventPuzzleState == 0x40) || ((sBgPoEventPuzzleState == 0x10) && !Player_InCsMode(globalCtx))) {
this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z; this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z;
this->actionFunc = BgPoEvent_BlockReset; this->actionFunc = BgPoEvent_BlockReset;
if (sPuzzleState == 0x10) { if (sBgPoEventPuzzleState == 0x10) {
sPuzzleState = 0x40; sBgPoEventPuzzleState = 0x40;
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_RISING); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_RISING);
func_8002DF54(globalCtx, &player->actor, 8); func_8002DF54(globalCtx, &player->actor, 8);
} }
} else if (this->dyna.unk_150 != 0.0f) { } else if (this->dyna.unk_150 != 0.0f) {
if (this->direction == 0) { if (this->direction == 0) {
if (func_800435D8(globalCtx, &this->dyna, 0x1E, 0x32, -0x14) != 0) { if (func_800435D8(globalCtx, &this->dyna, 0x1E, 0x32, -0x14) != 0) {
sBlocksAtRest--; sBgPoEventBlocksAtRest--;
this->direction = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f; this->direction = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f;
this->actionFunc = BgPoEvent_BlockPush; this->actionFunc = BgPoEvent_BlockPush;
} else { } else {
@ -382,7 +382,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) {
} }
} }
static f32 blockPushDist = 0.0f; f32 sBgPoEventblockPushDist = 0.0f;
void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) {
f32 displacement; f32 displacement;
s32 blockStop; s32 blockStop;
@ -390,8 +390,8 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) {
this->dyna.actor.speedXZ += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.1f; this->dyna.actor.speedXZ += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.1f;
this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f); this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f);
blockStop = Math_StepToF(&blockPushDist, 20.0f, this->dyna.actor.speedXZ); blockStop = Math_StepToF(&sBgPoEventblockPushDist, 20.0f, this->dyna.actor.speedXZ);
displacement = this->direction * blockPushDist; displacement = this->direction * sBgPoEventblockPushDist;
this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.x;
this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.z; this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.z;
if (blockStop) { if (blockStop) {
@ -402,10 +402,10 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) {
this->dyna.unk_150 = 0.0f; this->dyna.unk_150 = 0.0f;
this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x; this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x;
this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z; this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z;
blockPushDist = 0.0f; sBgPoEventblockPushDist = 0.0f;
this->dyna.actor.speedXZ = 0.0f; this->dyna.actor.speedXZ = 0.0f;
this->direction = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3 : 5; this->direction = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3 : 5;
sBlocksAtRest++; sBgPoEventBlocksAtRest++;
this->actionFunc = BgPoEvent_BlockIdle; this->actionFunc = BgPoEvent_BlockIdle;
if (this->type == 1) { if (this->type == 1) {
return; return;
@ -428,7 +428,7 @@ void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) {
this->index = (this->index + 1) % 4; this->index = (this->index + 1) % 4;
this->actionFunc = BgPoEvent_BlockFall; this->actionFunc = BgPoEvent_BlockFall;
sPuzzleState = 0; sBgPoEventPuzzleState = 0;
if (this->type == 1) { if (this->type == 1) {
this->timer += 10; this->timer += 10;
this->timer = CLAMP_MAX(this->timer, 120); this->timer = CLAMP_MAX(this->timer, 120);
@ -443,14 +443,14 @@ void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx) {
player->stateFlags2 &= ~0x10; player->stateFlags2 &= ~0x10;
} }
if (Math_StepToF(&this->dyna.actor.world.pos.y, 369.0f, 2.0f)) { if (Math_StepToF(&this->dyna.actor.world.pos.y, 369.0f, 2.0f)) {
sPuzzleState = 0x20; sBgPoEventPuzzleState = 0x20;
Actor_Kill(&this->dyna.actor); Actor_Kill(&this->dyna.actor);
} }
} }
void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) { void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & AC_HIT) { if (this->collider.base.acFlags & AC_HIT) {
sPuzzleState |= 0x20; sBgPoEventPuzzleState |= 0x20;
this->timer = 5; this->timer = 5;
Actor_SetColorFilter(&this->dyna.actor, 0x4000, 0xFF, 0, 5); Actor_SetColorFilter(&this->dyna.actor, 0x4000, 0xFF, 0, 5);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_PO_LAUGH2); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_PO_LAUGH2);
@ -461,12 +461,12 @@ void BgPoEvent_AmyWait(BgPoEvent* this, GlobalContext* globalCtx) {
void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx) { void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx) {
Vec3f pos; Vec3f pos;
if (sPuzzleState == 0xF) { if (sBgPoEventPuzzleState == 0xF) {
pos.x = this->dyna.actor.world.pos.x - 5.0f; pos.x = this->dyna.actor.world.pos.x - 5.0f;
pos.y = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.y; pos.y = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.y;
pos.z = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.z; pos.z = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.z;
EffectSsDeadDb_Spawn(globalCtx, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true); EffectSsDeadDb_Spawn(globalCtx, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true);
} else if (sPuzzleState == 0x20) { } else if (sBgPoEventPuzzleState == 0x20) {
Actor_Kill(&this->dyna.actor); Actor_Kill(&this->dyna.actor);
} else { } else {
DECR(this->timer); DECR(this->timer);
@ -476,14 +476,14 @@ void BgPoEvent_AmyPuzzle(BgPoEvent* this, GlobalContext* globalCtx) {
s32 BgPoEvent_NextPainting(BgPoEvent* this) { s32 BgPoEvent_NextPainting(BgPoEvent* this) {
if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.child != NULL)) { if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.child != NULL)) {
if (Rand_ZeroOne() < 0.5f) { if (Rand_ZeroOne() < 0.5f) {
sPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index; sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index;
} else { } else {
sPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index; sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index;
} }
} else if (this->dyna.actor.parent != NULL) { } else if (this->dyna.actor.parent != NULL) {
sPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index; sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index;
} else if (this->dyna.actor.child != NULL) { } else if (this->dyna.actor.child != NULL) {
sPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index; sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index;
} else { } else {
return false; return false;
} }
@ -491,7 +491,7 @@ s32 BgPoEvent_NextPainting(BgPoEvent* this) {
} }
void BgPoEvent_PaintingEmpty(BgPoEvent* this, GlobalContext* globalCtx) { void BgPoEvent_PaintingEmpty(BgPoEvent* this, GlobalContext* globalCtx) {
if (sPuzzleState == this->index) { if (sBgPoEventPuzzleState == this->index) {
this->timer = 255; this->timer = 255;
this->actionFunc = BgPoEvent_PaintingAppear; this->actionFunc = BgPoEvent_PaintingAppear;
} }
@ -636,7 +636,7 @@ void BgPoEvent_Draw(Actor* thisx, GlobalContext* globalCtx) {
} }
void BgPoEvent_Reset(void) { void BgPoEvent_Reset(void) {
sBlocksAtRest = 0; sBgPoEventBlocksAtRest = 0;
sPuzzleState = 0; sBgPoEventPuzzleState = 0;
blockPushDist = 0.0f; sBgPoEventblockPushDist = 0.0f;
} }

View File

@ -45,7 +45,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
}; };
static u32 D_808A9508 = 0; u32 D_808A9508 = 0;
void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) { void BgRelayObjects_Init(Actor* thisx, GlobalContext* globalCtx) {
BgRelayObjects* this = (BgRelayObjects*)thisx; BgRelayObjects* this = (BgRelayObjects*)thisx;
s32 pad; s32 pad;

View File

@ -84,7 +84,7 @@ void func_808B7710(Actor* thisx, GlobalContext* globalCtx) {
this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE;
} }
static s16 D_808B85D0 = 0; s16 D_808B85D0 = 0;
void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) { void func_808B7770(BgSpot18Basket* this, GlobalContext* globalCtx, f32 arg2) {
Vec3f acceleration; Vec3f acceleration;
Vec3f velocity; Vec3f velocity;

View File

@ -105,35 +105,17 @@ 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 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 }; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
static EnGanonMant* sCape; EnGanonMant* sBossGanonCape;
static s32 sSeed1; s32 sBossGanonSeed1;
static s32 sSeed2; s32 sBossGanonSeed3;
static s32 sSeed3; s32 sBossGanonSeed2;
static BossGanon* sGanondorf; BossGanon* sBossGanonGanondorf;
static EnZl3* sZelda; EnZl3* sBossGanonZelda;
typedef struct { GanondorfEffect sBossGanonEffectBuf[200];
/* 0x00 */ u8 type;
/* 0x01 */ u8 timer;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ Vec3f accel;
/* 0x28 */ Color_RGB8 color;
/* 0x2C */ s16 alpha;
/* 0x2E */ s16 unk_2E;
/* 0x30 */ s16 unk_30;
/* 0x34 */ f32 scale;
/* 0x38 */ f32 unk_38; // scale target mostly, but used for other things
/* 0x3C */ f32 unk_3C; // mostly z rot
/* 0x40 */ f32 unk_40;
/* 0x44 */ f32 unk_44; // mostly x rot
/* 0x48 */ f32 unk_48; // mostly y rot
} GanondorfEffect; // size = 0x4C
GanondorfEffect sEffectBuf[200];
void BossGanonEff_SpawnWindowShard(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, f32 scale) { void BossGanonEff_SpawnWindowShard(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, f32 scale) {
static Color_RGB8 shardColors[] = { { 255, 175, 85 }, { 155, 205, 155 }, { 155, 125, 55 } }; static Color_RGB8 shardColors[] = { { 255, 175, 85 }, { 155, 205, 155 }, { 155, 125, 55 } };
@ -348,13 +330,13 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) {
if (thisx->params < 0x64) { if (thisx->params < 0x64) {
Flags_SetSwitch(globalCtx, 0x14); Flags_SetSwitch(globalCtx, 0x14);
globalCtx->specialEffects = sEffectBuf; globalCtx->specialEffects = sBossGanonEffectBuf;
for (i = 0; i < ARRAY_COUNT(sEffectBuf); i++) { for (i = 0; i < ARRAY_COUNT(sBossGanonEffectBuf); i++) {
sEffectBuf[i].type = GDF_EFF_NONE; sBossGanonEffectBuf[i].type = GDF_EFF_NONE;
} }
sGanondorf = this; sBossGanonGanondorf = this;
thisx->colChkInfo.health = 40; thisx->colChkInfo.health = 40;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
ActorShape_Init(&thisx->shape, 0, NULL, 0); ActorShape_Init(&thisx->shape, 0, NULL, 0);
@ -381,7 +363,7 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) {
BossGanon_SetupTowerCutscene(this, globalCtx); BossGanon_SetupTowerCutscene(this, globalCtx);
} }
sCape = (EnGanonMant*)Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_GANON_MANT, 0.0f, sBossGanonCape = (EnGanonMant*)Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_GANON_MANT, 0.0f,
0.0f, 0.0f, 0, 0, 0, 1); 0.0f, 0.0f, 0, 0, 0, 1);
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BOSS); Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_BOSS);
} else { } else {
@ -538,10 +520,10 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment); gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->animBankIndex].segment);
sCape->backPush = -2.0f; sBossGanonCape->backPush = -2.0f;
sCape->backSwayMagnitude = 0.25f; sBossGanonCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -1.0f; sBossGanonCape->sideSwayMagnitude = -1.0f;
sCape->minDist = 0.0f; sBossGanonCape->minDist = 0.0f;
this->csTimer++; this->csTimer++;
@ -584,13 +566,13 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
this->useOpenHand = true; this->useOpenHand = true;
BossGanon_SetIntroCsCamera(this, 0); BossGanon_SetIntroCsCamera(this, 0);
this->csState = 1; this->csState = 1;
sZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f, sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f,
220.0f, -150.0f, 0, 0, 0, 0x2000); 220.0f, -150.0f, 0, 0, 0, 0x2000);
} }
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GANON_ORGAN, 0.0f, 0.0f, 0.0f, 0, Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GANON_ORGAN, 0.0f, 0.0f, 0.0f, 0,
0, 0, 1); 0, 0, 1);
sCape->minY = 57.0f; sBossGanonCape->minY = 57.0f;
// fallthrough // fallthrough
case 1: case 1:
this->envLightMode = 3; this->envLightMode = 3;
@ -736,7 +718,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
this->csState = 9; this->csState = 9;
this->csTimer = 0; this->csTimer = 0;
func_8002DF54(globalCtx, &this->actor, 8); func_8002DF54(globalCtx, &this->actor, 8);
sZelda->unk_3C8 = 0; sBossGanonZelda->unk_3C8 = 0;
this->triforceType = GDF_TRIFORCE_ZELDA; this->triforceType = GDF_TRIFORCE_ZELDA;
this->fwork[GDF_TRIFORCE_SCALE] = 10.0f; this->fwork[GDF_TRIFORCE_SCALE] = 10.0f;
this->fwork[GDF_TRIFORCE_PRIM_A] = 0.0f; this->fwork[GDF_TRIFORCE_PRIM_A] = 0.0f;
@ -755,7 +737,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->fwork[GDF_TRIFORCE_ENV_G], 200.0f, 1.0f, 3.0f); Math_ApproachF(&this->fwork[GDF_TRIFORCE_ENV_G], 200.0f, 1.0f, 3.0f);
if (this->csTimer == 30) { if (this->csTimer == 30) {
sZelda->unk_3C8 = 1; sBossGanonZelda->unk_3C8 = 1;
} }
if (this->csTimer >= 32) { if (this->csTimer >= 32) {
@ -847,7 +829,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
this->csTimer = 0; this->csTimer = 0;
BossGanon_SetIntroCsCamera(this, 11); BossGanon_SetIntroCsCamera(this, 11);
this->unk_198 = 2; this->unk_198 = 2;
sZelda->unk_3C8 = 2; sBossGanonZelda->unk_3C8 = 2;
this->timers[2] = 110; this->timers[2] = 110;
this->envLightMode = 3; this->envLightMode = 3;
} }
@ -883,7 +865,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
if (this->csTimer > 10) { if (this->csTimer > 10) {
if (this->csTimer == 62) { if (this->csTimer == 62) {
sCape->attachRightArmTimer = 20.0f; sBossGanonCape->attachRightArmTimer = 20.0f;
} }
if (this->csTimer == 57) { if (this->csTimer == 57) {
@ -1076,7 +1058,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f);
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
this->actor.shape.yOffset = 0.0f; this->actor.shape.yOffset = 0.0f;
sCape->attachShouldersTimer = 18.0f; sBossGanonCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->unk_198 = 0; this->unk_198 = 0;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_GANONDORF_BOSS); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_GANONDORF_BOSS);
@ -1101,9 +1083,9 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->actor.world.pos.y, 228.0f, 0.05f, 2.0f); Math_ApproachF(&this->actor.world.pos.y, 228.0f, 0.05f, 2.0f);
Math_ApproachF(&this->actor.world.pos.z, -230.0f, 0.05f, 4.0f); Math_ApproachF(&this->actor.world.pos.z, -230.0f, 0.05f, 4.0f);
sCape->backPush = -3.0f; sBossGanonCape->backPush = -3.0f;
sCape->backSwayMagnitude = 0.25f; sBossGanonCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -3.0f; sBossGanonCape->sideSwayMagnitude = -3.0f;
sin = Math_SinS(this->csTimer * 1500); sin = Math_SinS(this->csTimer * 1500);
this->actor.velocity.y = this->fwork[GDF_FWORK_0] * sin * 0.04f; this->actor.velocity.y = this->fwork[GDF_FWORK_0] * sin * 0.04f;
@ -1136,10 +1118,10 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) {
BossGanon_SetupWait(this, globalCtx); BossGanon_SetupWait(this, globalCtx);
} }
if (sZelda != NULL) { if (sBossGanonZelda != NULL) {
sZelda->actor.world.pos.x = 0.0f; sBossGanonZelda->actor.world.pos.x = 0.0f;
sZelda->actor.world.pos.y = 350.0f; sBossGanonZelda->actor.world.pos.y = 350.0f;
sZelda->actor.world.pos.z = 0.0f; sBossGanonZelda->actor.world.pos.z = 0.0f;
} }
} }
@ -1529,7 +1511,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
this->fwork[1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_00EA00); this->fwork[1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_00EA00);
this->csState = 101; this->csState = 101;
this->skelAnime.playSpeed = 0.0f; this->skelAnime.playSpeed = 0.0f;
sZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f, sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 0.0f,
6000.0f, 0.0f, 0, 0, 0, 0x2000); 6000.0f, 0.0f, 0, 0, 0, 0x2000);
player->actor.world.pos.x = -472.0f; player->actor.world.pos.x = -472.0f;
@ -1551,12 +1533,12 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
this->csCamAt.z = -100.0f; this->csCamAt.z = -100.0f;
sCape->backPush = -2.0f; sBossGanonCape->backPush = -2.0f;
sCape->backSwayMagnitude = 0.25f; sBossGanonCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -1.0f; sBossGanonCape->sideSwayMagnitude = -1.0f;
sCape->minDist = 0.0f; sBossGanonCape->minDist = 0.0f;
sCape->minY = 4104.0f; sBossGanonCape->minY = 4104.0f;
sCape->tearTimer = 20; sBossGanonCape->tearTimer = 20;
this->whiteFillAlpha = 255.0f; this->whiteFillAlpha = 255.0f;
globalCtx->envCtx.unk_D8 = 1.0f; globalCtx->envCtx.unk_D8 = 1.0f;
@ -1620,27 +1602,27 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
if (this->csTimer == 90) { if (this->csTimer == 90) {
this->csState = 103; this->csState = 103;
this->csTimer = 0; this->csTimer = 0;
sZelda->actor.world.pos.x = -472.0f; sBossGanonZelda->actor.world.pos.x = -472.0f;
sZelda->actor.world.pos.y = 4352.0f; sBossGanonZelda->actor.world.pos.y = 4352.0f;
sZelda->actor.world.pos.z = -200.0f; sBossGanonZelda->actor.world.pos.z = -200.0f;
sZelda->unk_3C8 = 3; sBossGanonZelda->unk_3C8 = 3;
} }
break; break;
case 103: case 103:
Audio_PlayActorSound2(&sZelda->actor, NA_SE_EV_DOWN_TO_GROUND - SFX_FLAG); Audio_PlayActorSound2(&sBossGanonZelda->actor, NA_SE_EV_DOWN_TO_GROUND - SFX_FLAG);
Math_ApproachF(&sZelda->actor.world.pos.y, 4102.0f, 0.05f, 1.5f); Math_ApproachF(&sBossGanonZelda->actor.world.pos.y, 4102.0f, 0.05f, 1.5f);
this->csCamEye.x = -242.0f; this->csCamEye.x = -242.0f;
this->csCamEye.y = 4122.0f; this->csCamEye.y = 4122.0f;
this->csCamEye.z = -190.0f; this->csCamEye.z = -190.0f;
this->csCamAt.x = sZelda->actor.world.pos.x; this->csCamAt.x = sBossGanonZelda->actor.world.pos.x;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f; this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z; this->csCamAt.z = sBossGanonZelda->actor.world.pos.z;
if (this->csTimer == 200) { if (this->csTimer == 200) {
sZelda->actor.world.pos.y = 4102.0f; sBossGanonZelda->actor.world.pos.y = 4102.0f;
this->csState = 104; this->csState = 104;
this->csTimer = 0; this->csTimer = 0;
} else { } else {
@ -1652,20 +1634,20 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
this->csCamEye.y = 4147.0f; this->csCamEye.y = 4147.0f;
this->csCamEye.z = -200.0f; this->csCamEye.z = -200.0f;
this->csCamAt.x = sZelda->actor.world.pos.x; this->csCamAt.x = sBossGanonZelda->actor.world.pos.x;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f; this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z; this->csCamAt.z = sBossGanonZelda->actor.world.pos.z;
if (this->csTimer >= 10) { if (this->csTimer >= 10) {
Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f);
} }
if (this->csTimer == 10) { if (this->csTimer == 10) {
sZelda->unk_3C8 = 8; sBossGanonZelda->unk_3C8 = 8;
} }
if (this->csTimer == 50) { if (this->csTimer == 50) {
sZelda->unk_3C8 = 4; sBossGanonZelda->unk_3C8 = 4;
} }
if (this->csTimer == 100) { if (this->csTimer == 100) {
@ -1679,9 +1661,9 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
this->csCamEye.y = 4154.0f; this->csCamEye.y = 4154.0f;
this->csCamEye.z = -182.0f; this->csCamEye.z = -182.0f;
this->csCamAt.x = sZelda->actor.world.pos.x - 5.0f; this->csCamAt.x = sBossGanonZelda->actor.world.pos.x - 5.0f;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f; this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z - 25.0f; this->csCamAt.z = sBossGanonZelda->actor.world.pos.z - 25.0f;
if (this->csTimer == 10) { if (this->csTimer == 10) {
Message_StartTextbox(globalCtx, 0x70D0, NULL); Message_StartTextbox(globalCtx, 0x70D0, NULL);
@ -1698,7 +1680,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
func_80078884(NA_SE_EV_EARTHQUAKE - SFX_FLAG); func_80078884(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
if (this->csTimer == 20) { if (this->csTimer == 20) {
sZelda->unk_3C8 = 5; sBossGanonZelda->unk_3C8 = 5;
func_8002DF54(globalCtx, &this->actor, 0x39); func_8002DF54(globalCtx, &this->actor, 0x39);
} }
@ -1747,15 +1729,15 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
this->csCamEye.y = 4154.0f; this->csCamEye.y = 4154.0f;
this->csCamEye.z = -182.0f; this->csCamEye.z = -182.0f;
this->csCamAt.x = sZelda->actor.world.pos.x - 5.0f; this->csCamAt.x = sBossGanonZelda->actor.world.pos.x - 5.0f;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f; this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z - 25.0f; this->csCamAt.z = sBossGanonZelda->actor.world.pos.z - 25.0f;
this->unk_70C = Math_SinS(this->csTimer * 0x6300) * 0.3f; this->unk_70C = Math_SinS(this->csTimer * 0x6300) * 0.3f;
func_80078884(NA_SE_EV_EARTHQUAKE - SFX_FLAG); func_80078884(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
if (this->csTimer == 70) { if (this->csTimer == 70) {
sZelda->unk_3C8 = 6; sBossGanonZelda->unk_3C8 = 6;
} }
if (this->csTimer == 90) { if (this->csTimer == 90) {
@ -1778,12 +1760,12 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
this->csCamEye.y = 4154.0f; this->csCamEye.y = 4154.0f;
this->csCamEye.z = -242.0f; this->csCamEye.z = -242.0f;
this->csCamAt.x = (sZelda->actor.world.pos.x - 5.0f) - 30.0f; this->csCamAt.x = (sBossGanonZelda->actor.world.pos.x - 5.0f) - 30.0f;
this->csCamAt.y = (sZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f; this->csCamAt.y = (sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f;
this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f; this->csCamAt.z = (sBossGanonZelda->actor.world.pos.z - 25.0f) + 80.0f;
if ((this->csTimer > 50) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { if ((this->csTimer > 50) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) {
sZelda->unk_3C8 = 7; sBossGanonZelda->unk_3C8 = 7;
this->csState = 108; this->csState = 108;
this->csTimer = 0; this->csTimer = 0;
} }
@ -1793,9 +1775,9 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx)
this->unk_70C = Math_SinS(this->csTimer * 0x6300) * 0.8f; this->unk_70C = Math_SinS(this->csTimer * 0x6300) * 0.8f;
func_80078884(NA_SE_EV_EARTHQUAKE - SFX_FLAG); func_80078884(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
this->csCamAt.x = (sZelda->actor.world.pos.x - 5.0f) - 30.0f; this->csCamAt.x = (sBossGanonZelda->actor.world.pos.x - 5.0f) - 30.0f;
this->csCamAt.y = (sZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f; this->csCamAt.y = (sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f;
this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f; this->csCamAt.z = (sBossGanonZelda->actor.world.pos.z - 25.0f) + 80.0f;
if (this->csTimer > 50) { if (this->csTimer > 50) {
mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM);
@ -1905,7 +1887,7 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) {
break; break;
case 1: case 1:
sCape->gravity = -1.0f; sBossGanonCape->gravity = -1.0f;
this->envLightMode = 1; this->envLightMode = 1;
Math_ApproachF(&this->actor.velocity.y, -50.0f, 1.0f, 10.0f); Math_ApproachF(&this->actor.velocity.y, -50.0f, 1.0f, 10.0f);
this->actor.world.pos.y += this->actor.velocity.y; this->actor.world.pos.y += this->actor.velocity.y;
@ -1952,7 +1934,7 @@ void BossGanon_PoundFloor(BossGanon* this, GlobalContext* globalCtx) {
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfGetUp3Anim); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfGetUp3Anim);
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f);
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
sCape->attachShouldersTimer = 18.0f; sBossGanonCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->unk_1C2 = 4; this->unk_1C2 = 4;
} }
@ -2136,7 +2118,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) {
} }
if (this->timers[0] == 1) { if (this->timers[0] == 1) {
sCape->attachLeftArmTimer = 15.0f; sBossGanonCape->attachLeftArmTimer = 15.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
} }
@ -2174,7 +2156,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, GlobalContext* globalCtx) {
} }
if (Animation_OnFrame(&this->skelAnime, 3.0f)) { if (Animation_OnFrame(&this->skelAnime, 3.0f)) {
sCape->attachShouldersTimer = 26.0f; sBossGanonCape->attachShouldersTimer = 26.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
} }
@ -2202,7 +2184,7 @@ void BossGanon_SetupWait(BossGanon* this, GlobalContext* globalCtx) {
this->fwork[GDF_FWORK_0] = 0.0f; this->fwork[GDF_FWORK_0] = 0.0f;
this->timers[0] = (s16)Rand_ZeroFloat(64.0f) + 30; this->timers[0] = (s16)Rand_ZeroFloat(64.0f) + 30;
this->unk_1C2 = 0; this->unk_1C2 = 0;
sCape->minY = 2.0f; sBossGanonCape->minY = 2.0f;
} }
void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) { void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) {
@ -2213,10 +2195,10 @@ void BossGanon_Wait(BossGanon* this, GlobalContext* globalCtx) {
this->legSwayEnabled = true; this->legSwayEnabled = true;
sCape->backPush = -3.0f; sBossGanonCape->backPush = -3.0f;
sCape->backSwayMagnitude = 0.25f; sBossGanonCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -3.0f; sBossGanonCape->sideSwayMagnitude = -3.0f;
sCape->minDist = 20.0f; sBossGanonCape->minDist = 20.0f;
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
@ -2271,10 +2253,10 @@ void BossGanon_SetupChargeLightBall(BossGanon* this, GlobalContext* globalCtx) {
void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) { void BossGanon_ChargeLightBall(BossGanon* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
sCape->backPush = -3.0f; sBossGanonCape->backPush = -3.0f;
sCape->backSwayMagnitude = 1.25f; sBossGanonCape->backSwayMagnitude = 1.25f;
sCape->sideSwayMagnitude = -2.0f; sBossGanonCape->sideSwayMagnitude = -2.0f;
sCape->minDist = 10.0f; sBossGanonCape->minDist = 10.0f;
if (this->timers[0] < 17) { if (this->timers[0] < 17) {
this->envLightMode = 1; this->envLightMode = 1;
@ -2355,7 +2337,7 @@ void BossGanon_PlayTennis(BossGanon* this, GlobalContext* globalCtx) {
rand = Rand_ZeroOne() * 1.99f; rand = Rand_ZeroOne() * 1.99f;
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(volleyAnims[rand]); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(volleyAnims[rand]);
Animation_MorphToPlayOnce(&this->skelAnime, volleyAnims[rand], 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, volleyAnims[rand], 0.0f);
sCape->attachRightArmTimer = capeRightArmDurations[rand]; sBossGanonCape->attachRightArmTimer = capeRightArmDurations[rand];
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->startVolley = false; this->startVolley = false;
} }
@ -2383,7 +2365,7 @@ void BossGanon_SetupBlock(BossGanon* this, GlobalContext* globalCtx) {
} }
this->unk_1C2 = 0; this->unk_1C2 = 0;
sCape->attachLeftArmTimer = this->timers[0] = 10; sBossGanonCape->attachLeftArmTimer = this->timers[0] = 10;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->handLightBallScale = 0.0f; this->handLightBallScale = 0.0f;
} }
@ -2391,10 +2373,10 @@ void BossGanon_SetupBlock(BossGanon* this, GlobalContext* globalCtx) {
void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) { void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) {
this->collider.base.colType = 9; this->collider.base.colType = 9;
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
sCape->backPush = -9.0f; sBossGanonCape->backPush = -9.0f;
sCape->backSwayMagnitude = 0.25f; sBossGanonCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -2.0f; sBossGanonCape->sideSwayMagnitude = -2.0f;
sCape->minDist = 13.0f; sBossGanonCape->minDist = 13.0f;
if (this->unk_1C2 == 0) { if (this->unk_1C2 == 0) {
if (this->timers[0] == 0) { if (this->timers[0] == 0) {
@ -2402,11 +2384,11 @@ void BossGanon_Block(BossGanon* this, GlobalContext* globalCtx) {
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfBlockReleaseAnim, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfBlockReleaseAnim, 0.0f);
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfBlockReleaseAnim); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfBlockReleaseAnim);
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
sCape->attachShouldersTimer = 15.0f; sBossGanonCape->attachShouldersTimer = 15.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
} }
} else { } else {
sCape->sideSwayMagnitude = -13.0f; sBossGanonCape->sideSwayMagnitude = -13.0f;
if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) { if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) {
BossGanon_SetupWait(this, globalCtx); BossGanon_SetupWait(this, globalCtx);
@ -2429,7 +2411,7 @@ void BossGanon_SetupHitByLightBall(BossGanon* this, GlobalContext* globalCtx) {
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfBigMagicHitAnim); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfBigMagicHitAnim);
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfBigMagicHitAnim, 0); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfBigMagicHitAnim, 0);
this->timers[0] = 70; this->timers[0] = 70;
sCape->attachRightArmTimer = sCape->attachLeftArmTimer = 0; sBossGanonCape->attachRightArmTimer = sBossGanonCape->attachLeftArmTimer = 0;
for (i = 1; i < 15; i++) { for (i = 1; i < 15; i++) {
this->unk_4E4[i] = D_808E4C58[i]; this->unk_4E4[i] = D_808E4C58[i];
@ -2466,7 +2448,7 @@ void BossGanon_HitByLightBall(BossGanon* this, GlobalContext* globalCtx) {
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f);
this->unk_1C2 = 2; this->unk_1C2 = 2;
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
sCape->attachShouldersTimer = 18.0f; sBossGanonCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_RESTORE); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_RESTORE);
this->timers[2] = 130; this->timers[2] = 130;
@ -2500,7 +2482,7 @@ void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) {
BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1); BossGanon_SetAnimationObject(this, globalCtx, OBJECT_GANON_ANIME1);
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfLightArrowHitAnim); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfLightArrowHitAnim);
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfLightArrowHitAnim, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfLightArrowHitAnim, 0.0f);
sCape->attachRightArmTimer = sCape->attachLeftArmTimer = 0; sBossGanonCape->attachRightArmTimer = sBossGanonCape->attachLeftArmTimer = 0;
this->actionFunc = BossGanon_Vulnerable; this->actionFunc = BossGanon_Vulnerable;
this->actor.velocity.x = 0.0f; this->actor.velocity.x = 0.0f;
@ -2508,10 +2490,10 @@ void BossGanon_SetupVulnerable(BossGanon* this, GlobalContext* globalCtx) {
this->actor.velocity.z = 0.0f; this->actor.velocity.z = 0.0f;
this->unk_1C2 = 0; this->unk_1C2 = 0;
sCape->backPush = -4.0f; sBossGanonCape->backPush = -4.0f;
sCape->backSwayMagnitude = 0.75f; sBossGanonCape->backSwayMagnitude = 0.75f;
sCape->sideSwayMagnitude = -3.0f; sBossGanonCape->sideSwayMagnitude = -3.0f;
sCape->minDist = 20.0f; sBossGanonCape->minDist = 20.0f;
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x, Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BOSS_GANON, this->unk_1FC.x,
@ -2571,7 +2553,7 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) {
break; break;
case 2: case 2:
sCape->minDist = 0.0f; sBossGanonCape->minDist = 0.0f;
this->actor.velocity.y = this->actor.velocity.y - 0.5f; this->actor.velocity.y = this->actor.velocity.y - 0.5f;
if (this->actor.world.pos.y < 40.0f) { if (this->actor.world.pos.y < 40.0f) {
@ -2625,7 +2607,7 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) {
this->unk_1C2 = 6; this->unk_1C2 = 6;
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfGetUp2Anim); this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gDorfGetUp2Anim);
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp2Anim, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp2Anim, 0.0f);
sCape->minDist = 20.0f; sBossGanonCape->minDist = 20.0f;
this->unk_19F = 1; this->unk_19F = 1;
} }
break; break;
@ -2646,7 +2628,7 @@ void BossGanon_Vulnerable(BossGanon* this, GlobalContext* globalCtx) {
Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f); Animation_MorphToPlayOnce(&this->skelAnime, &gDorfGetUp3Anim, 0.0f);
this->unk_1C2 = 8; this->unk_1C2 = 8;
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
sCape->attachShouldersTimer = 18.0f; sBossGanonCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE); Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_RESTORE); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_RESTORE);
break; break;
@ -2743,10 +2725,10 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) {
this->actor.colChkInfo.health -= damage; this->actor.colChkInfo.health -= damage;
} }
for (i = 0; i < ARRAY_COUNT(sCape->strands); i++) { for (i = 0; i < ARRAY_COUNT(sBossGanonCape->strands); i++) {
for (j = 1; j < 12; j++) { for (j = 1; j < 12; j++) {
sCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f); sBossGanonCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f);
sCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f); sBossGanonCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f);
} }
} }
@ -2762,16 +2744,16 @@ void BossGanon_UpdateDamage(BossGanon* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_CUTBODY); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_CUTBODY);
BossGanon_SetupDamaged(this, globalCtx); BossGanon_SetupDamaged(this, globalCtx);
this->unk_1A6 = 15; this->unk_1A6 = 15;
sCape->tearTimer = 1; sBossGanonCape->tearTimer = 1;
} }
} }
} else if (acHitInfo->toucher.dmgFlags & 0x1F8A4) { } else if (acHitInfo->toucher.dmgFlags & 0x1F8A4) {
Audio_PlayActorSound2(&this->actor, 0); Audio_PlayActorSound2(&this->actor, 0);
for (i = 0; i < ARRAY_COUNT(sCape->strands); i++) { for (i = 0; i < ARRAY_COUNT(sBossGanonCape->strands); i++) {
for (j = 1; j < 12; j++) { for (j = 1; j < 12; j++) {
sCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f); sBossGanonCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f);
sCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f); sBossGanonCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f);
} }
} }
} }
@ -2841,7 +2823,7 @@ void BossGanon_Update(Actor* thisx, GlobalContext* globalCtx2) {
} }
this->collider.base.colType = 3; this->collider.base.colType = 3;
sCape->gravity = -3.0f; sBossGanonCape->gravity = -3.0f;
this->shockGlow = false; this->shockGlow = false;
this->actor.flags &= ~ACTOR_FLAG_0; this->actor.flags &= ~ACTOR_FLAG_0;
this->unk_1A2++; this->unk_1A2++;
@ -3334,20 +3316,20 @@ void BossGanon_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
} }
void BossGanon_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) { void BossGanon_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) {
sSeed1 = seedInit0; sBossGanonSeed1 = seedInit0;
sSeed2 = seedInit1; sBossGanonSeed2 = seedInit1;
sSeed3 = seedInit2; sBossGanonSeed3 = seedInit2;
} }
f32 BossGanon_RandZeroOne(void) { f32 BossGanon_RandZeroOne(void) {
// Wichmann-Hill algorithm // Wichmann-Hill algorithm
f32 randFloat; f32 randFloat;
sSeed1 = (sSeed1 * 171) % 30269; sBossGanonSeed1 = (sBossGanonSeed1 * 171) % 30269;
sSeed2 = (sSeed2 * 172) % 30307; sBossGanonSeed2 = (sBossGanonSeed2 * 172) % 30307;
sSeed3 = (sSeed3 * 170) % 30323; sBossGanonSeed3 = (sBossGanonSeed3 * 170) % 30323;
randFloat = (sSeed1 / 30269.0f) + (sSeed2 / 30307.0f) + (sSeed3 / 30323.0f); randFloat = (sBossGanonSeed1 / 30269.0f) + (sBossGanonSeed2 / 30307.0f) + (sBossGanonSeed3 / 30323.0f);
while (randFloat >= 1.0f) { while (randFloat >= 1.0f) {
randFloat -= 1.0f; randFloat -= 1.0f;
@ -3559,7 +3541,7 @@ void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) {
this->triforcePos.y += 3.0f; this->triforcePos.y += 3.0f;
this->triforcePos.z += -2.0f; this->triforcePos.z += -2.0f;
} else if (this->triforceType == GDF_TRIFORCE_ZELDA) { } else if (this->triforceType == GDF_TRIFORCE_ZELDA) {
this->triforcePos = sZelda->unk_31C; this->triforcePos = sBossGanonZelda->unk_31C;
this->triforcePos.y += 1.8f; this->triforcePos.y += 1.8f;
this->triforcePos.z += 4.0f; this->triforcePos.z += 4.0f;
@ -3734,9 +3716,9 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, GlobalContext* globalC
for (i = 0; i < 12; i++) { for (i = 0; i < 12; i++) {
for (j = 0; j < 12; j++) { for (j = 0; j < 12; j++) {
sp7C.x = sCape->strands[i].joints[j].x - this->actor.world.pos.x; sp7C.x = sBossGanonCape->strands[i].joints[j].x - this->actor.world.pos.x;
sp7C.y = sCape->strands[i].joints[j].y - this->actor.world.pos.y + 76.0f + 100.0f + 30.0f; sp7C.y = sBossGanonCape->strands[i].joints[j].y - this->actor.world.pos.y + 76.0f + 100.0f + 30.0f;
sp7C.z = sCape->strands[i].joints[j].z - this->actor.world.pos.z; sp7C.z = sBossGanonCape->strands[i].joints[j].z - this->actor.world.pos.z;
Matrix_MultVec3f(&sp7C, &sp70); Matrix_MultVec3f(&sp7C, &sp70);
@ -3746,7 +3728,7 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, GlobalContext* globalC
baseX = (s32)(sp70.x + 32.0f); baseX = (s32)(sp70.x + 32.0f);
baseY = (s16)sp70.y * 0x40; baseY = (s16)sp70.y * 0x40;
if (!sCape->strands[i].torn[j]) { if (!sBossGanonCape->strands[i].torn[j]) {
for (y = -1, addY = -0x40; y <= 1; y++, addY += 0x40) { for (y = -1, addY = -0x40; y <= 1; y++, addY += 0x40) {
for (x = -3; x <= 3; x++) { for (x = -3; x <= 3; x++) {
index = baseX + x + baseY + addY; index = baseX + x + baseY + addY;
@ -3827,13 +3809,13 @@ void BossGanon_Draw(Actor* thisx, GlobalContext* globalCtx) {
BossGanon_DrawEffects(globalCtx); BossGanon_DrawEffects(globalCtx);
sCape->actor.world.pos = this->actor.world.pos; sBossGanonCape->actor.world.pos = this->actor.world.pos;
sCape->rightForearmPos = this->unk_214; sBossGanonCape->rightForearmPos = this->unk_214;
sCape->leftForearmPos = this->unk_220; sBossGanonCape->leftForearmPos = this->unk_220;
sCape->rightShoulderPos = this->unk_22C; sBossGanonCape->rightShoulderPos = this->unk_22C;
sCape->leftShoulderPos = this->unk_238; sBossGanonCape->leftShoulderPos = this->unk_238;
BossGanon_DrawShock(this, globalCtx); BossGanon_DrawShock(this, globalCtx);
BossGanon_DrawHandLightBall(this, globalCtx); BossGanon_DrawHandLightBall(this, globalCtx);
@ -4628,7 +4610,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) {
spA0.x = 0.0f; spA0.x = 0.0f;
spA0.y = 0.0f; spA0.y = 0.0f;
for (i = 0; i < ARRAY_COUNT(sEffectBuf); i++, eff++) { for (i = 0; i < ARRAY_COUNT(sBossGanonEffectBuf); i++, eff++) {
if (eff->type != GDF_EFF_NONE) { if (eff->type != GDF_EFF_NONE) {
eff->pos.x += eff->velocity.x; eff->pos.x += eff->velocity.x;
eff->pos.y += eff->velocity.y; eff->pos.y += eff->velocity.y;
@ -4662,9 +4644,9 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) {
eff->alpha = 255; eff->alpha = 255;
} }
} else if (eff->type == GDF_EFF_BLACK_DOT) { } else if (eff->type == GDF_EFF_BLACK_DOT) {
xDiff = sGanondorf->unk_278.x - eff->pos.x; xDiff = sBossGanonGanondorf->unk_278.x - eff->pos.x;
yDiff = sGanondorf->unk_278.y - eff->pos.y; yDiff = sBossGanonGanondorf->unk_278.y - eff->pos.y;
zDiff = sGanondorf->unk_278.z - eff->pos.z; zDiff = sBossGanonGanondorf->unk_278.z - eff->pos.z;
yRot = Math_FAtan2F(xDiff, zDiff); yRot = Math_FAtan2F(xDiff, zDiff);
@ -4704,9 +4686,9 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) {
if (eff->unk_2E == GDF_SHOCK_DORF_YELLOW) { if (eff->unk_2E == GDF_SHOCK_DORF_YELLOW) {
bodyPart = (s16)Rand_ZeroFloat(13.9f) + 1; bodyPart = (s16)Rand_ZeroFloat(13.9f) + 1;
eff->pos.x = sGanondorf->unk_2EC[bodyPart].x + Rand_CenteredFloat(20.0f); eff->pos.x = sBossGanonGanondorf->unk_2EC[bodyPart].x + Rand_CenteredFloat(20.0f);
eff->pos.y = sGanondorf->unk_2EC[bodyPart].y + Rand_CenteredFloat(20.0f); eff->pos.y = sBossGanonGanondorf->unk_2EC[bodyPart].y + Rand_CenteredFloat(20.0f);
eff->pos.z = sGanondorf->unk_2EC[bodyPart].z + Rand_CenteredFloat(20.0f); eff->pos.z = sBossGanonGanondorf->unk_2EC[bodyPart].z + Rand_CenteredFloat(20.0f);
} else { } else {
bodyPart = (s16)Rand_ZeroFloat(17.9f); bodyPart = (s16)Rand_ZeroFloat(17.9f);
@ -4799,7 +4781,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) {
if (((eff->scale * 150.0f) < distToPlayer) && (distToPlayer < (eff->scale * 300.0f))) { if (((eff->scale * 150.0f) < distToPlayer) && (distToPlayer < (eff->scale * 300.0f))) {
eff->timer = 150; eff->timer = 150;
func_8002F6D4(globalCtx, &sGanondorf->actor, 7.0f, sGanondorf->actor.yawTowardsPlayer, 0.0f, func_8002F6D4(globalCtx, &sBossGanonGanondorf->actor, 7.0f, sBossGanonGanondorf->actor.yawTowardsPlayer, 0.0f,
0x20); 0x20);
} }
} }
@ -4940,7 +4922,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) {
255); 255);
gDPSetEnvColor(POLY_XLU_DISP++, sLightningEnvColors[(eff->timer * 3) + 0], gDPSetEnvColor(POLY_XLU_DISP++, sLightningEnvColors[(eff->timer * 3) + 0],
sLightningEnvColors[(eff->timer * 3) + 1], sLightningEnvColors[(eff->timer * 3) + 2], 0); sLightningEnvColors[(eff->timer * 3) + 1], sLightningEnvColors[(eff->timer * 3) + 2], 0);
Matrix_Translate(sGanondorf->unk_260.x, sGanondorf->unk_260.y, sGanondorf->unk_260.z, MTXMODE_NEW); Matrix_Translate(sBossGanonGanondorf->unk_260.x, sBossGanonGanondorf->unk_260.y, sBossGanonGanondorf->unk_260.z, MTXMODE_NEW);
Matrix_RotateY(eff->unk_48, MTXMODE_APPLY); Matrix_RotateY(eff->unk_48, MTXMODE_APPLY);
Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY); Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY);
Matrix_Scale(eff->scale, eff->scale, eff->scale, MTXMODE_APPLY); Matrix_Scale(eff->scale, eff->scale, eff->scale, MTXMODE_APPLY);
@ -5032,16 +5014,11 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) {
#include "overlays/ovl_Boss_Ganon/ovl_Boss_Ganon.h" #include "overlays/ovl_Boss_Ganon/ovl_Boss_Ganon.h"
void BossGanon_Reset(void) { void BossGanon_Reset(void) {
sBossGanonSeed1 = 0;
static EnGanonMant* sCape; sBossGanonSeed2 = 0;
sBossGanonSeed3 = 0;
sSeed1 = 0; sBossGanonGanondorf = NULL;
sSeed2 = 0; sBossGanonZelda = NULL;
sSeed3 = 0; sBossGanonCape = NULL;
sGanondorf = NULL; memset(sBossGanonEffectBuf, 0, sizeof(sBossGanonEffectBuf));
sZelda = NULL; }
sCape = NULL;
memset(sEffectBuf, 0, sizeof(sEffectBuf));
}

View File

@ -53,6 +53,24 @@ typedef enum {
/* 2 */ GDF_TRIFORCE_DORF /* 2 */ GDF_TRIFORCE_DORF
} GanondorfTriforceType; } GanondorfTriforceType;
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 timer;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ Vec3f accel;
/* 0x28 */ Color_RGB8 color;
/* 0x2C */ s16 alpha;
/* 0x2E */ s16 unk_2E;
/* 0x30 */ s16 unk_30;
/* 0x34 */ f32 scale;
/* 0x38 */ f32 unk_38; // scale target mostly, but used for other things
/* 0x3C */ f32 unk_3C; // mostly z rot
/* 0x40 */ f32 unk_40;
/* 0x44 */ f32 unk_44; // mostly x rot
/* 0x48 */ f32 unk_48; // mostly y rot
} GanondorfEffect; // size = 0x4C
typedef struct BossGanon { typedef struct BossGanon {
/* 0x0000 */ Actor actor; /* 0x0000 */ Actor actor;
/* 0x014C */ s32 animBankIndex; /* 0x014C */ s32 animBankIndex;

View File

@ -49,21 +49,40 @@ const ActorInit Boss_Ganon2_InitVars = {
#include "z_boss_ganon2_data.c" #include "z_boss_ganon2_data.c"
Vec3f D_8090EB20;
EnZl3* sBossGanon2Zelda;
Actor* D_8090EB30;
BossGanon2Effect sBossGanon2Particles[100];
s32 sBossGanon2Seed1;
s32 sBossGanon2Seed2;
s32 sBossGanon2Seed3;
Vec3f D_809105D8[4];
Vec3f D_80910608[4];
s8 D_80910638;
void BossGanon2_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) { void BossGanon2_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) {
sSeed1 = seedInit0; sBossGanon2Seed1 = seedInit0;
sSeed2 = seedInit1; sBossGanon2Seed2 = seedInit1;
sSeed3 = seedInit2; sBossGanon2Seed3 = seedInit2;
} }
f32 BossGanon2_RandZeroOne(void) { f32 BossGanon2_RandZeroOne(void) {
// Wichmann-Hill algorithm // Wichmann-Hill algorithm
f32 randFloat; f32 randFloat;
sSeed1 = (sSeed1 * 171) % 30269; sBossGanon2Seed1 = (sBossGanon2Seed1 * 171) % 30269;
sSeed2 = (sSeed2 * 172) % 30307; sBossGanon2Seed2 = (sBossGanon2Seed2 * 172) % 30307;
sSeed3 = (sSeed3 * 170) % 30323; sBossGanon2Seed3 = (sBossGanon2Seed3 * 170) % 30323;
randFloat = (sSeed1 / 30269.0f) + (sSeed2 / 30307.0f) + (sSeed3 / 30323.0f); randFloat = (sBossGanon2Seed1 / 30269.0f) + (sBossGanon2Seed2 / 30307.0f) + (sBossGanon2Seed3 / 30323.0f);
while (randFloat >= 1.0f) { while (randFloat >= 1.0f) {
randFloat -= 1.0f; randFloat -= 1.0f;
} }
@ -114,7 +133,7 @@ void func_808FD27C(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, f
BossGanon2Effect* effect = globalCtx->specialEffects; BossGanon2Effect* effect = globalCtx->specialEffects;
s16 i; s16 i;
for (i = 0; i < ARRAY_COUNT(sParticles); i++, effect++) { for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) {
if (effect->type == 0) { if (effect->type == 0) {
effect->type = 2; effect->type = 2;
effect->position = *position; effect->position = *position;
@ -136,10 +155,10 @@ void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
s16 i; s16 i;
globalCtx->specialEffects = sParticles; globalCtx->specialEffects = sBossGanon2Particles;
for (i = 0; i < ARRAY_COUNT(sParticles); i++) { for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++) {
sParticles[i].type = 0; sBossGanon2Particles[i].type = 0;
} }
this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.mass = MASS_IMMOVABLE;
@ -204,13 +223,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE);
this->unk_39C = 1; this->unk_39C = 1;
sZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 970.0f, sBossGanon2Zelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 970.0f,
1086.0f, -200.0f, 0, 0, 0, 1); 1086.0f, -200.0f, 0, 0, 0, 1);
sZelda->unk_3C8 = 0; sBossGanon2Zelda->unk_3C8 = 0;
sZelda->actor.world.pos.x = 970.0f; sBossGanon2Zelda->actor.world.pos.x = 970.0f;
sZelda->actor.world.pos.y = 1086.0f; sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -214.0f; sBossGanon2Zelda->actor.world.pos.z = -214.0f;
sZelda->actor.shape.rot.y = -0x7000; sBossGanon2Zelda->actor.shape.rot.y = -0x7000;
this->unk_3BC.x = 0.0f; this->unk_3BC.x = 0.0f;
this->unk_3BC.y = 1.0f; this->unk_3BC.y = 1.0f;
this->unk_3BC.z = 0.0f; this->unk_3BC.z = 0.0f;
@ -258,20 +277,20 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
player->actor.world.pos.x = 970.0f; player->actor.world.pos.x = 970.0f;
player->actor.world.pos.y = 1086.0f; player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -166.0f; player->actor.world.pos.z = -166.0f;
sZelda->actor.world.pos.x = 974.0f; sBossGanon2Zelda->actor.world.pos.x = 974.0f;
sZelda->actor.world.pos.y = 1086.0f; sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f; sBossGanon2Zelda->actor.world.pos.z = -186.0f;
player->actor.shape.rot.y = -0x5000; player->actor.shape.rot.y = -0x5000;
sZelda->actor.shape.rot.y = -0x5000; sBossGanon2Zelda->actor.shape.rot.y = -0x5000;
if (this->unk_398 == 60) { if (this->unk_398 == 60) {
Message_StartTextbox(globalCtx, 0x70D4, NULL); Message_StartTextbox(globalCtx, 0x70D4, NULL);
} }
if (this->unk_398 == 40) { if (this->unk_398 == 40) {
sZelda->unk_3C8 = 1; sBossGanon2Zelda->unk_3C8 = 1;
func_8002DF54(globalCtx, &this->actor, 0x4E); func_8002DF54(globalCtx, &this->actor, 0x4E);
} }
if (this->unk_398 == 85) { if (this->unk_398 == 85) {
sZelda->unk_3C8 = 2; sBossGanon2Zelda->unk_3C8 = 2;
func_8002DF54(globalCtx, &this->actor, 0x4F); func_8002DF54(globalCtx, &this->actor, 0x4F);
} }
this->unk_3A4.x = 930.0f; this->unk_3A4.x = 930.0f;
@ -300,14 +319,14 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
} }
if (this->unk_398 == 20) { if (this->unk_398 == 20) {
sZelda->unk_3C8 = 3; sBossGanon2Zelda->unk_3C8 = 3;
func_8002DF54(globalCtx, &this->actor, 0x50); func_8002DF54(globalCtx, &this->actor, 0x50);
} }
if (this->unk_398 == 55) { if (this->unk_398 == 55) {
this->unk_39C = 4; this->unk_39C = 4;
this->unk_398 = 0; this->unk_398 = 0;
this->unk_410.x = 0.0f; this->unk_410.x = 0.0f;
sZelda->unk_3C8 = 4; sBossGanon2Zelda->unk_3C8 = 4;
func_8002DF54(globalCtx, &this->actor, 0x50); func_8002DF54(globalCtx, &this->actor, 0x50);
} }
break; break;
@ -347,11 +366,11 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
player->actor.world.pos.x = 490.0f; player->actor.world.pos.x = 490.0f;
player->actor.world.pos.y = 1086.0f; player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -166.0f; player->actor.world.pos.z = -166.0f;
sZelda->actor.world.pos.x = 724.0f; sBossGanon2Zelda->actor.world.pos.x = 724.0f;
sZelda->actor.world.pos.y = 1086.0f; sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f; sBossGanon2Zelda->actor.world.pos.z = -186.0f;
player->actor.shape.rot.y = -0x4000; player->actor.shape.rot.y = -0x4000;
sZelda->actor.shape.rot.y = -0x5000; sBossGanon2Zelda->actor.shape.rot.y = -0x5000;
this->unk_3A4.x = 410.0f; this->unk_3A4.x = 410.0f;
this->unk_3A4.y = 1096.0f; this->unk_3A4.y = 1096.0f;
this->unk_3A4.z = -110.0f; this->unk_3A4.z = -110.0f;
@ -370,7 +389,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
this->unk_339 = 4; this->unk_339 = 4;
} }
if (this->unk_398 == 30) { if (this->unk_398 == 30) {
sZelda->unk_3C8 = 5; sBossGanon2Zelda->unk_3C8 = 5;
func_8002DF54(globalCtx, &this->actor, 0x51); func_8002DF54(globalCtx, &this->actor, 0x51);
} }
if (this->unk_398 == 50) { if (this->unk_398 == 50) {
@ -384,11 +403,11 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
player->actor.world.pos.x = 490.0f; player->actor.world.pos.x = 490.0f;
player->actor.world.pos.y = 1086.0f; player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -166.0f; player->actor.world.pos.z = -166.0f;
sZelda->actor.world.pos.x = 724.0f; sBossGanon2Zelda->actor.world.pos.x = 724.0f;
sZelda->actor.world.pos.y = 1086.0f; sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f; sBossGanon2Zelda->actor.world.pos.z = -186.0f;
player->actor.shape.rot.y = -0x4000; player->actor.shape.rot.y = -0x4000;
sZelda->actor.shape.rot.y = -0x5000; sBossGanon2Zelda->actor.shape.rot.y = -0x5000;
this->unk_3A4.x = 450.0f; this->unk_3A4.x = 450.0f;
this->unk_3A4.y = 1121.0f; this->unk_3A4.y = 1121.0f;
this->unk_3A4.z = -158.0f; this->unk_3A4.z = -158.0f;
@ -457,9 +476,9 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
player->actor.world.pos.y = 1086.0f; player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -266.0f; player->actor.world.pos.z = -266.0f;
player->actor.shape.rot.y = -0x4000; player->actor.shape.rot.y = -0x4000;
sZelda->actor.world.pos.x = 724.0f; sBossGanon2Zelda->actor.world.pos.x = 724.0f;
sZelda->actor.world.pos.y = 1086.0f; sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f; sBossGanon2Zelda->actor.world.pos.z = -186.0f;
this->unk_3A4.x = this->actor.world.pos.x + -10.0f; this->unk_3A4.x = this->actor.world.pos.x + -10.0f;
this->unk_3A4.y = this->actor.world.pos.y + 80.0f; this->unk_3A4.y = this->actor.world.pos.y + 80.0f;
this->unk_3A4.z = this->actor.world.pos.z + 50.0f; this->unk_3A4.z = this->actor.world.pos.z + 50.0f;
@ -770,9 +789,9 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
BossGanon2Effect* effect = globalCtx->specialEffects; BossGanon2Effect* effect = globalCtx->specialEffects;
effect->unk_2E = 1; effect->unk_2E = 1;
effect->position.x = sZelda->actor.world.pos.x + 50.0f + 10.0f; effect->position.x = sBossGanon2Zelda->actor.world.pos.x + 50.0f + 10.0f;
effect->position.y = sZelda->actor.world.pos.y + 350.0f; effect->position.y = sBossGanon2Zelda->actor.world.pos.y + 350.0f;
effect->position.z = sZelda->actor.world.pos.z - 25.0f; effect->position.z = sBossGanon2Zelda->actor.world.pos.z - 25.0f;
effect->velocity.x = 0.0f; effect->velocity.x = 0.0f;
effect->velocity.z = 0.0f; effect->velocity.z = 0.0f;
effect->velocity.y = -30.0f; effect->velocity.y = -30.0f;
@ -782,15 +801,15 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
break; break;
} }
case 26: case 26:
this->unk_3A4.x = sZelda->actor.world.pos.x + 100.0f + 30.0f; this->unk_3A4.x = sBossGanon2Zelda->actor.world.pos.x + 100.0f + 30.0f;
this->unk_3A4.y = sZelda->actor.world.pos.y + 10.0f; this->unk_3A4.y = sBossGanon2Zelda->actor.world.pos.y + 10.0f;
this->unk_3A4.z = sZelda->actor.world.pos.z + 5.0f; this->unk_3A4.z = sBossGanon2Zelda->actor.world.pos.z + 5.0f;
this->unk_3B0.x = sZelda->actor.world.pos.x; this->unk_3B0.x = sBossGanon2Zelda->actor.world.pos.x;
this->unk_3B0.y = sZelda->actor.world.pos.y + 30.0f; this->unk_3B0.y = sBossGanon2Zelda->actor.world.pos.y + 30.0f;
this->unk_3B0.z = sZelda->actor.world.pos.z - 20.0f; this->unk_3B0.z = sBossGanon2Zelda->actor.world.pos.z - 20.0f;
this->unk_3BC.z = -0.5f; this->unk_3BC.z = -0.5f;
if (this->unk_398 == 13) { if (this->unk_398 == 13) {
sZelda->unk_3C8 = 6; sBossGanon2Zelda->unk_3C8 = 6;
} }
if (this->unk_398 == 50) { if (this->unk_398 == 50) {
this->unk_39C = 27; this->unk_39C = 27;
@ -879,7 +898,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
func_808FFDB0(this, globalCtx); func_808FFDB0(this, globalCtx);
this->unk_1A2[1] = 50; this->unk_1A2[1] = 50;
this->actor.flags |= ACTOR_FLAG_0; this->actor.flags |= ACTOR_FLAG_0;
sZelda->unk_3C8 = 7; sBossGanon2Zelda->unk_3C8 = 7;
} }
break; break;
} }
@ -1323,12 +1342,12 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) {
break; break;
case 2: case 2:
this->unk_1A2[0] = 300; this->unk_1A2[0] = 300;
this->unk_3A4.x = sZelda->actor.world.pos.x - 100.0f; this->unk_3A4.x = sBossGanon2Zelda->actor.world.pos.x - 100.0f;
this->unk_3A4.y = sZelda->actor.world.pos.y + 30.0f; this->unk_3A4.y = sBossGanon2Zelda->actor.world.pos.y + 30.0f;
this->unk_3A4.z = (sZelda->actor.world.pos.z + 30.0f) - 60.0f; this->unk_3A4.z = (sBossGanon2Zelda->actor.world.pos.z + 30.0f) - 60.0f;
this->unk_3B0.x = sZelda->actor.world.pos.x; this->unk_3B0.x = sBossGanon2Zelda->actor.world.pos.x;
this->unk_3B0.y = sZelda->actor.world.pos.y + 30.0f; this->unk_3B0.y = sBossGanon2Zelda->actor.world.pos.y + 30.0f;
this->unk_3B0.z = sZelda->actor.world.pos.z - 10.0f; this->unk_3B0.z = sBossGanon2Zelda->actor.world.pos.z - 10.0f;
Math_ApproachZeroF(&this->unk_324, 1.0f, 5.0f); Math_ApproachZeroF(&this->unk_324, 1.0f, 5.0f);
Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 1.0f / 51); Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 1.0f / 51);
if (this->unk_1A2[1] == 80) { if (this->unk_1A2[1] == 80) {
@ -1356,8 +1375,8 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) {
func_8002DF54(globalCtx, &this->actor, 0x60); func_8002DF54(globalCtx, &this->actor, 0x60);
this->unk_398 = 0; this->unk_398 = 0;
case 11: case 11:
player->actor.world.pos.x = sZelda->actor.world.pos.x + 50.0f + 10.0f; player->actor.world.pos.x = sBossGanon2Zelda->actor.world.pos.x + 50.0f + 10.0f;
player->actor.world.pos.z = sZelda->actor.world.pos.z - 25.0f; player->actor.world.pos.z = sBossGanon2Zelda->actor.world.pos.z - 25.0f;
player->actor.shape.rot.y = -0x8000; player->actor.shape.rot.y = -0x8000;
this->unk_3A4.x = (player->actor.world.pos.x + 100.0f) - 80.0f; this->unk_3A4.x = (player->actor.world.pos.x + 100.0f) - 80.0f;
this->unk_3A4.y = (player->actor.world.pos.y + 60.0f) - 40.0f; this->unk_3A4.y = (player->actor.world.pos.y + 60.0f) - 40.0f;
@ -1482,7 +1501,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
func_8002DF54(globalCtx, &this->actor, 8); func_8002DF54(globalCtx, &this->actor, 8);
this->unk_39C = 1; this->unk_39C = 1;
this->unk_398 = 0; this->unk_398 = 0;
sZelda->unk_3C8 = 9; sBossGanon2Zelda->unk_3C8 = 9;
this->unk_31C = 0; this->unk_31C = 0;
this->unk_1A2[2] = 0; this->unk_1A2[2] = 0;
this->unk_336 = 0; this->unk_336 = 0;
@ -1522,9 +1541,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
player->actor.shape.rot.y = -0x4000; player->actor.shape.rot.y = -0x4000;
player->actor.world.pos.x = 200.0f; player->actor.world.pos.x = 200.0f;
player->actor.world.pos.z = 30.0f; player->actor.world.pos.z = 30.0f;
sZelda->actor.world.pos.x = 340.0f; sBossGanon2Zelda->actor.world.pos.x = 340.0f;
sZelda->actor.world.pos.z = -250.0f; sBossGanon2Zelda->actor.world.pos.z = -250.0f;
sZelda->actor.world.rot.y = sZelda->actor.shape.rot.y = -0x2000; sBossGanon2Zelda->actor.world.rot.y = sBossGanon2Zelda->actor.shape.rot.y = -0x2000;
this->unk_3A4.x = 250; this->unk_3A4.x = 250;
this->unk_3A4.y = 1150.0f; this->unk_3A4.y = 1150.0f;
this->unk_3A4.z = 0.0f; this->unk_3A4.z = 0.0f;
@ -1543,9 +1562,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
this->unk_3A4.x = 250; this->unk_3A4.x = 250;
this->unk_3A4.y = 1150.0f; this->unk_3A4.y = 1150.0f;
this->unk_3A4.z = 0.0f; this->unk_3A4.z = 0.0f;
Math_ApproachF(&this->unk_3B0.x, sZelda->actor.world.pos.x, 0.2f, 20.0f); Math_ApproachF(&this->unk_3B0.x, sBossGanon2Zelda->actor.world.pos.x, 0.2f, 20.0f);
Math_ApproachF(&this->unk_3B0.y, sZelda->actor.world.pos.y + 50.0f, 0.2f, 10.0f); Math_ApproachF(&this->unk_3B0.y, sBossGanon2Zelda->actor.world.pos.y + 50.0f, 0.2f, 10.0f);
Math_ApproachF(&this->unk_3B0.z, sZelda->actor.world.pos.z, 0.2f, 20.0f); Math_ApproachF(&this->unk_3B0.z, sBossGanon2Zelda->actor.world.pos.z, 0.2f, 20.0f);
if (this->unk_398 == 50) { if (this->unk_398 == 50) {
this->unk_39C = 3; this->unk_39C = 3;
this->unk_398 = 0; this->unk_398 = 0;
@ -1557,9 +1576,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
this->unk_3A4.x = 330.0f; this->unk_3A4.x = 330.0f;
this->unk_3A4.y = 1120.0f; this->unk_3A4.y = 1120.0f;
this->unk_3A4.z = -150.0f; this->unk_3A4.z = -150.0f;
this->unk_3B0.x = sZelda->actor.world.pos.x; this->unk_3B0.x = sBossGanon2Zelda->actor.world.pos.x;
this->unk_3B0.y = sZelda->actor.world.pos.y + 40.0f; this->unk_3B0.y = sBossGanon2Zelda->actor.world.pos.y + 40.0f;
this->unk_3B0.z = sZelda->actor.world.pos.z; this->unk_3B0.z = sBossGanon2Zelda->actor.world.pos.z;
if (this->unk_398 == 10) { if (this->unk_398 == 10) {
Message_StartTextbox(globalCtx, 0x70D8, NULL); Message_StartTextbox(globalCtx, 0x70D8, NULL);
} }
@ -1572,7 +1591,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
if (this->unk_398 > 10) { if (this->unk_398 > 10) {
Math_ApproachZeroF(&this->unk_37C, 1.0f, 10.0f); Math_ApproachZeroF(&this->unk_37C, 1.0f, 10.0f);
if (this->unk_398 == 30) { if (this->unk_398 == 30) {
sZelda->unk_3C8 = 10; sBossGanon2Zelda->unk_3C8 = 10;
} }
this->unk_339 = 23; this->unk_339 = 23;
Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f); Math_ApproachZeroF(&globalCtx->envCtx.unk_D8, 1.0f, 0.05f);
@ -1743,7 +1762,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
if (this->unk_398 == 40) { if (this->unk_398 == 40) {
this->unk_39C = 9; this->unk_39C = 9;
this->unk_398 = 0; this->unk_398 = 0;
sZelda->unk_3C8 = 11; sBossGanon2Zelda->unk_3C8 = 11;
Message_StartTextbox(globalCtx, 0x70D9, NULL); Message_StartTextbox(globalCtx, 0x70D9, NULL);
this->unk_336 = 0; this->unk_336 = 0;
globalCtx->envCtx.unk_D8 = 0.0f; globalCtx->envCtx.unk_D8 = 0.0f;
@ -1754,9 +1773,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
this->unk_3A4.x = 330.0f; this->unk_3A4.x = 330.0f;
this->unk_3A4.y = 1120.0f; this->unk_3A4.y = 1120.0f;
this->unk_3A4.z = -150.0f; this->unk_3A4.z = -150.0f;
this->unk_3B0.x = sZelda->actor.world.pos.x; this->unk_3B0.x = sBossGanon2Zelda->actor.world.pos.x;
this->unk_3B0.y = sZelda->actor.world.pos.y + 40.0f; this->unk_3B0.y = sBossGanon2Zelda->actor.world.pos.y + 40.0f;
this->unk_3B0.z = sZelda->actor.world.pos.z; this->unk_3B0.z = sBossGanon2Zelda->actor.world.pos.z;
if (this->unk_398 > 60) { if (this->unk_398 > 60) {
this->unk_39C = 10; this->unk_39C = 10;
this->unk_398 = 0; this->unk_398 = 0;
@ -1771,26 +1790,26 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) {
if ((this->unk_398 >= 40) && (this->unk_398 <= 110)) { if ((this->unk_398 >= 40) && (this->unk_398 <= 110)) {
Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.02f); Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.02f);
Math_ApproachF(&this->unk_384, 10.0f, 0.1f, 0.2f); Math_ApproachF(&this->unk_384, 10.0f, 0.1f, 0.2f);
Audio_PlayActorSound2(&sZelda->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG); Audio_PlayActorSound2(&sBossGanon2Zelda->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG);
} else { } else {
Math_ApproachZeroF(&this->unk_384, 1.0f, 0.2f); Math_ApproachZeroF(&this->unk_384, 1.0f, 0.2f);
} }
if (this->unk_398 > 130) { if (this->unk_398 > 130) {
Math_ApproachF(&this->unk_3B0.y, (sZelda->actor.world.pos.y + 40.0f + 10.0f) - 20.0f, 0.1f, Math_ApproachF(&this->unk_3B0.y, (sBossGanon2Zelda->actor.world.pos.y + 40.0f + 10.0f) - 20.0f, 0.1f,
this->unk_410.x); this->unk_410.x);
} else { } else {
Math_ApproachF(&this->unk_3B0.y, sZelda->actor.world.pos.y + 40.0f + 10.0f, 0.05f, Math_ApproachF(&this->unk_3B0.y, sBossGanon2Zelda->actor.world.pos.y + 40.0f + 10.0f, 0.05f,
this->unk_410.x * 0.25f); this->unk_410.x * 0.25f);
} }
Math_ApproachF(&this->unk_410.x, 1.0f, 1.0f, 0.01f); Math_ApproachF(&this->unk_410.x, 1.0f, 1.0f, 0.01f);
if (this->unk_398 == 10) { if (this->unk_398 == 10) {
sZelda->unk_3C8 = 12; sBossGanon2Zelda->unk_3C8 = 12;
} }
if (this->unk_398 == 110) { if (this->unk_398 == 110) {
sZelda->unk_3C8 = 13; sBossGanon2Zelda->unk_3C8 = 13;
} }
if (this->unk_398 == 140) { if (this->unk_398 == 140) {
Audio_PlayActorSound2(&sZelda->actor, NA_SE_EV_HUMAN_BOUND); Audio_PlayActorSound2(&sBossGanon2Zelda->actor, NA_SE_EV_HUMAN_BOUND);
} }
if (this->unk_398 < 160) { if (this->unk_398 < 160) {
break; break;
@ -1845,7 +1864,7 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) {
} }
func_8002F6D4(globalCtx, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, 0); func_8002F6D4(globalCtx, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, 0);
sZelda->unk_3C8 = 8; sBossGanon2Zelda->unk_3C8 = 8;
this->unk_316 = 10; this->unk_316 = 10;
break; break;
} }
@ -1864,7 +1883,7 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) {
player->isBurning = true; player->isBurning = true;
func_8002F6D4(globalCtx, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); func_8002F6D4(globalCtx, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10);
sZelda->unk_3C8 = 8; sBossGanon2Zelda->unk_3C8 = 8;
} }
} }
} }
@ -2168,7 +2187,7 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) {
if (D_80906D78 != 0) { if (D_80906D78 != 0) {
D_80906D78 = 0; D_80906D78 = 0;
for (i2 = 0; i2 < ARRAY_COUNT(sParticles); i2++) { for (i2 = 0; i2 < ARRAY_COUNT(sBossGanon2Particles); i2++) {
angle = Rand_ZeroFloat(2 * M_PI); angle = Rand_ZeroFloat(2 * M_PI);
sp44 = Rand_ZeroFloat(40.0f) + 10.0f; sp44 = Rand_ZeroFloat(40.0f) + 10.0f;
sp58 = this->actor.world.pos; sp58 = this->actor.world.pos;
@ -2641,7 +2660,7 @@ void func_80904FC8(BossGanon2* this, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 200); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 200);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0);
gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308);
Matrix_Translate(sZelda->actor.world.pos.x, sZelda->actor.world.pos.y + 80.0f, sZelda->actor.world.pos.z, Matrix_Translate(sBossGanon2Zelda->actor.world.pos.x, sBossGanon2Zelda->actor.world.pos.y + 80.0f, sBossGanon2Zelda->actor.world.pos.z,
MTXMODE_NEW); MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
Matrix_Scale(this->unk_384, this->unk_384, this->unk_384, MTXMODE_APPLY); Matrix_Scale(this->unk_384, this->unk_384, this->unk_384, MTXMODE_APPLY);
@ -2728,8 +2747,8 @@ void func_80905674(BossGanon2* this, GlobalContext* globalCtx) {
this->unk_19C * -8, 32, 32)); this->unk_19C * -8, 32, 32));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_37C); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_37C);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128);
Matrix_Translate(sZelda->actor.world.pos.x + 100.0f, sZelda->actor.world.pos.y + 35.0f + 7.0f, Matrix_Translate(sBossGanon2Zelda->actor.world.pos.x + 100.0f, sBossGanon2Zelda->actor.world.pos.y + 35.0f + 7.0f,
sZelda->actor.world.pos.z - 100.0f, MTXMODE_NEW); sBossGanon2Zelda->actor.world.pos.z - 100.0f, MTXMODE_NEW);
Matrix_RotateY(-M_PI / 4.0f, MTXMODE_APPLY); Matrix_RotateY(-M_PI / 4.0f, MTXMODE_APPLY);
Matrix_Scale(0.040000003f, 0.040000003f, this->unk_380, MTXMODE_APPLY); Matrix_Scale(0.040000003f, 0.040000003f, this->unk_380, MTXMODE_APPLY);
Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY); Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY);
@ -2826,7 +2845,7 @@ void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx) {
Vec3f sp78; Vec3f sp78;
s16 i; s16 i;
for (i = 0; i < ARRAY_COUNT(sParticles); i++, effect++) { for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) {
if (effect->type != 0) { if (effect->type != 0) {
effect->position.x += effect->velocity.x; effect->position.x += effect->velocity.x;
effect->position.y += effect->velocity.y; effect->position.y += effect->velocity.y;
@ -2934,7 +2953,7 @@ void func_809060E8(GlobalContext* globalCtx) {
effect = effects; effect = effects;
for (i = 0; i < ARRAY_COUNT(sParticles); i++, effect++) { for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) {
if (effect->type == 2) { if (effect->type == 2) {
if (!usingObjectGEff) { if (!usingObjectGEff) {
BossGanon2_SetObjectSegment(NULL, globalCtx, OBJECT_GEFF, true); BossGanon2_SetObjectSegment(NULL, globalCtx, OBJECT_GEFF, true);
@ -3080,12 +3099,12 @@ void BossGanon2_Reset(void) {
D_8090EB20.y = 0; D_8090EB20.y = 0;
D_8090EB20.z = 0; D_8090EB20.z = 0;
D_80910638 = 0; D_80910638 = 0;
sZelda = NULL; sBossGanon2Zelda = NULL;
D_8090EB30 = NULL; D_8090EB30 = NULL;
sSeed1 = 0; sBossGanon2Seed1 = 0;
sSeed2 = 0; sBossGanon2Seed2 = 0;
sSeed3 = 0; sBossGanon2Seed3 = 0;
memset(D_809105D8, 0, sizeof(D_809105D8)); memset(D_809105D8, 0, sizeof(D_809105D8));
memset(D_80910608, 0, sizeof(D_80910608)); memset(D_80910608, 0, sizeof(D_80910608));
memset(sParticles, 0, sizeof(sParticles)); memset(sBossGanon2Particles, 0, sizeof(sBossGanon2Particles));
} }

View File

@ -4,6 +4,20 @@
#include "ultra64.h" #include "ultra64.h"
#include "global.h" #include "global.h"
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 unk_01;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ Vec3f accel;
/* 0x28 */ char unk_28[0x6];
/* 0x2E */ s16 unk_2E;
/* 0x30 */ char unk_30[0x4];
/* 0x34 */ f32 scale;
/* 0x38 */ Vec3f unk_38;
} BossGanon2Effect; // size = 0x44
struct BossGanon2; struct BossGanon2;
typedef void (*BossGanon2ActionFunc)(struct BossGanon2*, GlobalContext*); typedef void (*BossGanon2ActionFunc)(struct BossGanon2*, GlobalContext*);

View File

@ -2,19 +2,6 @@
#include "overlays/actors/ovl_En_Zl3/z_en_zl3.h" #include "overlays/actors/ovl_En_Zl3/z_en_zl3.h"
#include "objects/object_ganon2/object_ganon2.h" #include "objects/object_ganon2/object_ganon2.h"
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 unk_01;
/* 0x04 */ Vec3f position;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ Vec3f accel;
/* 0x28 */ char unk_28[0x6];
/* 0x2E */ s16 unk_2E;
/* 0x30 */ char unk_30[0x4];
/* 0x34 */ f32 scale;
/* 0x38 */ Vec3f unk_38;
} BossGanon2Effect; // size = 0x44
static Vec3f D_80906D60 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80906D60 = { 0.0f, 0.0f, 0.0f };
static Vec3f D_80906D6C = { 0.0f, 0.0f, 500.0f }; static Vec3f D_80906D6C = { 0.0f, 0.0f, 500.0f };
@ -326,31 +313,7 @@ static s16 D_809071CC[] = { 1, -1, 1, 1, 3, 4, 1, 6, 7, 2, 9, 10, 2, 12, 13 };
static u8 D_809071EC[] = { 3, 2, 2, 1, 3, 3, 1, 3, 3, 1, 0, 3, 1, 0, 3 }; static u8 D_809071EC[] = { 3, 2, 2, 1, 3, 3, 1, 3, 3, 1, 0, 3, 1, 0, 3 };
// padding
static u32 D_809071FC[2] = { 0 };
#include "overlays/ovl_Boss_Ganon2/ovl_Boss_Ganon2.h" #include "overlays/ovl_Boss_Ganon2/ovl_Boss_Ganon2.h"
static Vec3f D_8090EB20; // padding
//static u32 D_809071FC[2] = { 0 };
static EnZl3* sZelda;
static Actor* D_8090EB30;
// unused
static UNK_TYPE D_8090EB34;
static BossGanon2Effect sParticles[100];
static s32 sSeed1;
static s32 sSeed2;
static s32 sSeed3;
// unused
static UNK_TYPE D_809105DC;
static Vec3f D_809105D8[4];
static Vec3f D_80910608[4];
static s8 D_80910638;

View File

@ -144,25 +144,25 @@ static f32 sFlatWidth[41] = {
#include "z_boss_mo_colchk.c" #include "z_boss_mo_colchk.c"
static BossMoEffect sEffects[300]; static BossMoEffect sEffects[300];
static s32 sSeed1; static s32 sBossGanonSeed1;
static s32 sSeed2; static s32 sBossGanonSeed2;
static s32 sSeed3; static s32 sBossGanonSeed3;
void BossMo_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) { void BossMo_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) {
sSeed1 = seedInit0; sBossGanonSeed1 = seedInit0;
sSeed2 = seedInit1; sBossGanonSeed2 = seedInit1;
sSeed3 = seedInit2; sBossGanonSeed3 = seedInit2;
} }
f32 BossMo_RandZeroOne(void) { f32 BossMo_RandZeroOne(void) {
// Wichmann-Hill algorithm // Wichmann-Hill algorithm
f32 randFloat; f32 randFloat;
sSeed1 = (sSeed1 * 171) % 30269; sBossGanonSeed1 = (sBossGanonSeed1 * 171) % 30269;
sSeed2 = (sSeed2 * 172) % 30307; sBossGanonSeed2 = (sBossGanonSeed2 * 172) % 30307;
sSeed3 = (sSeed3 * 170) % 30323; sBossGanonSeed3 = (sBossGanonSeed3 * 170) % 30323;
randFloat = (sSeed1 / 30269.0f) + (sSeed2 / 30307.0f) + (sSeed3 / 30323.0f); randFloat = (sBossGanonSeed1 / 30269.0f) + (sBossGanonSeed2 / 30307.0f) + (sBossGanonSeed3 / 30323.0f);
while (randFloat >= 1.0f) { while (randFloat >= 1.0f) {
randFloat -= 1.0f; randFloat -= 1.0f;
} }
@ -3588,7 +3588,7 @@ void BossMo_Reset(void) {
sMorphaTent1 = NULL; sMorphaTent1 = NULL;
sMorphaTent2 = NULL; sMorphaTent2 = NULL;
memset(sEffects, 0, sizeof(sEffects)); memset(sEffects, 0, sizeof(sEffects));
sSeed1 = 0; sBossGanonSeed1 = 0;
sSeed2 = 0; sBossGanonSeed2 = 0;
sSeed3 = 0; sBossGanonSeed3 = 0;
} }

View File

@ -7,34 +7,6 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5) #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5)
typedef enum {
/* 0 */ TWEFF_NONE,
/* 1 */ TWEFF_DOT,
/* 2 */ TWEFF_2,
/* 3 */ TWEFF_3,
/* 4 */ TWEFF_RING,
/* 5 */ TWEFF_PLYR_FRZ,
/* 6 */ TWEFF_FLAME,
/* 7 */ TWEFF_MERGEFLAME,
/* 8 */ TWEFF_SHLD_BLST,
/* 9 */ TWEFF_SHLD_DEFL,
/* 10 */ TWEFF_SHLD_HIT
} TwEffType;
typedef enum {
/* 0 */ EFF_ARGS,
/* 1 */ EFF_UNKS1,
/* 2 */ EFF_WORK_MAX
} EffectWork;
typedef enum {
/* 0 */ EFF_SCALE,
/* 1 */ EFF_DIST,
/* 2 */ EFF_ROLL,
/* 3 */ EFF_YAW,
/* 4 */ EFF_FWORK_MAX
} EffectFWork;
typedef enum { typedef enum {
/* 0x00 */ TW_KOTAKE, /* 0x00 */ TW_KOTAKE,
/* 0x01 */ TW_KOUME, /* 0x01 */ TW_KOUME,
@ -47,19 +19,6 @@ typedef enum {
/* 0x69 */ TW_DEATHBALL_KOUME /* 0x69 */ TW_DEATHBALL_KOUME
} TwinrovaType; } TwinrovaType;
typedef struct {
/* 0x0000 */ u8 type;
/* 0x0001 */ u8 frame;
/* 0x0004 */ Vec3f pos;
/* 0x0010 */ Vec3f curSpeed;
/* 0x001C */ Vec3f accel;
/* 0x0028 */ Color_RGB8 color;
/* 0x002C */ s16 alpha;
/* 0x002E */ s16 work[EFF_WORK_MAX];
/* 0x0034 */ f32 workf[EFF_FWORK_MAX];
/* 0x0044 */ Actor* target;
} BossTwEffect;
void BossTw_Init(Actor* thisx, GlobalContext* globalCtx); void BossTw_Init(Actor* thisx, GlobalContext* globalCtx);
void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx); void BossTw_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BossTw_Update(Actor* thisx, GlobalContext* globalCtx); void BossTw_Update(Actor* thisx, GlobalContext* globalCtx);
@ -200,7 +159,7 @@ static Vec3f sTwinrovaPillarPos[] = {
{ 0.0f, 380.0f, -580.0f }, { 0.0f, 380.0f, -580.0f },
}; };
static u8 sTwInitalized = false; u8 sTwInitalized = false;
static InitChainEntry sInitChain[] = { static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE), ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE),
@ -233,7 +192,7 @@ static u8 D_8094C878;
static s16 D_8094C87A; static s16 D_8094C87A;
static s16 D_8094C87C; static s16 D_8094C87C;
static u8 D_8094C87E; static u8 D_8094C87E;
static BossTwEffect sTwEffects[150]; BossTwEffect sTwEffects[150];
void BossTw_AddDotEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale, void BossTw_AddDotEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale,
s16 args, s16 countLimit) { s16 args, s16 countLimit) {

View File

@ -4,9 +4,46 @@
#include "ultra64.h" #include "ultra64.h"
#include "global.h" #include "global.h"
struct BossTw; typedef enum {
/* 0 */ TWEFF_NONE,
/* 1 */ TWEFF_DOT,
/* 2 */ TWEFF_2,
/* 3 */ TWEFF_3,
/* 4 */ TWEFF_RING,
/* 5 */ TWEFF_PLYR_FRZ,
/* 6 */ TWEFF_FLAME,
/* 7 */ TWEFF_MERGEFLAME,
/* 8 */ TWEFF_SHLD_BLST,
/* 9 */ TWEFF_SHLD_DEFL,
/* 10 */ TWEFF_SHLD_HIT
} TwEffType;
typedef void (*BossTwActionFunc)(struct BossTw* this, GlobalContext* globalCtx); typedef enum {
/* 0 */ EFF_ARGS,
/* 1 */ EFF_UNKS1,
/* 2 */ EFF_WORK_MAX
} EffectWork;
typedef enum {
/* 0 */ EFF_SCALE,
/* 1 */ EFF_DIST,
/* 2 */ EFF_ROLL,
/* 3 */ EFF_YAW,
/* 4 */ EFF_FWORK_MAX
} EffectFWork;
typedef struct {
/* 0x0000 */ u8 type;
/* 0x0001 */ u8 frame;
/* 0x0004 */ Vec3f pos;
/* 0x0010 */ Vec3f curSpeed;
/* 0x001C */ Vec3f accel;
/* 0x0028 */ Color_RGB8 color;
/* 0x002C */ s16 alpha;
/* 0x002E */ s16 work[EFF_WORK_MAX];
/* 0x0034 */ f32 workf[EFF_FWORK_MAX];
/* 0x0044 */ Actor* target;
} BossTwEffect;
typedef enum { typedef enum {
/* 0 */ CS_TIMER_1, /* 0 */ CS_TIMER_1,
@ -55,6 +92,10 @@ typedef enum {
/* 26 */ FWORK_MAX /* 26 */ FWORK_MAX
} TwFwork; } TwFwork;
struct BossTw;
typedef void (*BossTwActionFunc)(struct BossTw*, GlobalContext* globalCtx);
typedef struct BossTw { typedef struct BossTw {
/* 0x0000 */ Actor actor; /* 0x0000 */ Actor actor;
/* 0x014C */ BossTwActionFunc actionFunc; /* 0x014C */ BossTwActionFunc actionFunc;

View File

@ -307,7 +307,7 @@ void func_8096712C(Demo6K* this, GlobalContext* globalCtx) {
} }
} }
static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f sDemo6kVelocity = { 0.0f, 0.0f, 0.0f };
void func_80967244(Demo6K* this, GlobalContext* globalCtx) { void func_80967244(Demo6K* this, GlobalContext* globalCtx) {
static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f };
static Color_RGBA8 primColor = { 255, 255, 255, 0 }; static Color_RGBA8 primColor = { 255, 255, 255, 0 };
@ -324,9 +324,9 @@ void func_80967244(Demo6K* this, GlobalContext* globalCtx) {
rand1 = Rand_ZeroFloat(0xFFFF); rand1 = Rand_ZeroFloat(0xFFFF);
rand2 = Rand_ZeroFloat(0xFFFF); rand2 = Rand_ZeroFloat(0xFFFF);
velocity.x = Math_SinS(rand2) * Math_CosS(rand1) * 20.0f; sDemo6kVelocity.x = Math_SinS(rand2) * Math_CosS(rand1) * 20.0f;
velocity.z = Math_CosS(rand2) * Math_CosS(rand1) * 20.0f; sDemo6kVelocity.z = Math_CosS(rand2) * Math_CosS(rand1) * 20.0f;
velocity.y = Math_SinS(rand1) * 20.0f; sDemo6kVelocity.y = Math_SinS(rand1) * 20.0f;
accel.y = 0.0f; accel.y = 0.0f;
@ -342,7 +342,7 @@ void func_80967244(Demo6K* this, GlobalContext* globalCtx) {
scale = 18000; scale = 18000;
} }
EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, 20); EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &sDemo6kVelocity, &accel, &primColor, &envColor, scale, 20);
} }
void func_80967410(Demo6K* this, GlobalContext* globalCtx) { void func_80967410(Demo6K* this, GlobalContext* globalCtx) {
@ -820,7 +820,7 @@ void func_809691BC(Demo6K* this, GlobalContext* globalCtx, s32 params) {
} }
void Demo6K_Reset(void) { void Demo6K_Reset(void) {
velocity.x = 0.0f; sDemo6kVelocity.x = 0.0f;
velocity.y = 0.0f; sDemo6kVelocity.y = 0.0f;
velocity.z = 0.0f; sDemo6kVelocity.z = 0.0f;
} }

View File

@ -132,7 +132,7 @@ void DemoKekkai_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyCylinder(globalCtx, &this->collider2); Collider_DestroyCylinder(globalCtx, &this->collider2);
} }
static Vec3f vel = { 0.0f, 0.0f, 0.0f }; Vec3f demoKekkaiVel = { 0.0f, 0.0f, 0.0f };
void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) { void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) {
static Vec3f accel = { 0.0f, 0.0f, 0.0f }; static Vec3f accel = { 0.0f, 0.0f, 0.0f };
static Color_RGBA8 lightYellow = { 255, 255, 170, 0 }; static Color_RGBA8 lightYellow = { 255, 255, 170, 0 };
@ -144,15 +144,15 @@ void DemoKekkai_SpawnParticles(DemoKekkai* this, GlobalContext* globalCtx) {
s16 roll = Rand_ZeroFloat(65535.0f); s16 roll = Rand_ZeroFloat(65535.0f);
s16 yaw = Rand_ZeroFloat(65535.0f); s16 yaw = Rand_ZeroFloat(65535.0f);
vel.x = Math_SinS(yaw) * Math_CosS(roll) * Rand_ZeroFloat(8.0f); demoKekkaiVel.x = Math_SinS(yaw) * Math_CosS(roll) * Rand_ZeroFloat(8.0f);
vel.z = Math_CosS(yaw) * Math_CosS(roll) * Rand_ZeroFloat(8.0f); demoKekkaiVel.z = Math_CosS(yaw) * Math_CosS(roll) * Rand_ZeroFloat(8.0f);
vel.y = Math_SinS(roll) * Rand_ZeroFloat(3.0f); demoKekkaiVel.y = Math_SinS(roll) * Rand_ZeroFloat(3.0f);
pos.x = (vel.x * 7.0f) + this->actor.world.pos.x; pos.x = (demoKekkaiVel.x * 7.0f) + this->actor.world.pos.x;
pos.y = (vel.y * 20.0f) + this->actor.world.pos.y + 120.0f; pos.y = (demoKekkaiVel.y * 20.0f) + this->actor.world.pos.y + 120.0f;
pos.z = (vel.z * 7.0f) + this->actor.world.pos.z; pos.z = (demoKekkaiVel.z * 7.0f) + this->actor.world.pos.z;
EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &vel, &accel, &lightYellow, &darkRed, 3000, EffectSsKiraKira_SpawnFocused(globalCtx, &pos, &demoKekkaiVel, &accel, &lightYellow, &darkRed, 3000,
(s32)Rand_ZeroFloat(40.0f) + 45); (s32)Rand_ZeroFloat(40.0f) + 45);
} }
} }
@ -338,7 +338,7 @@ void DemoKekkai_DrawTowerBarrier(Actor* thisx, GlobalContext* globalCtx) {
} }
void DemoKekkai_Reset(void) { void DemoKekkai_Reset(void) {
vel.x = 0.0f; demoKekkaiVel.x = 0.0f;
vel.y = 0.0f; demoKekkaiVel.y = 0.0f;
vel.z = 0.0f; demoKekkaiVel.z = 0.0f;
} }

View File

@ -53,7 +53,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 4000, ICHAIN_STOP), ICHAIN_F32(uncullZoneDownward, 4000, ICHAIN_STOP),
}; };
static s16 sWarpTimerTarget; s16 sWarpTimerTarget;
void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) {
this->actionFunc = actionFunc; this->actionFunc = actionFunc;

View File

@ -122,7 +122,7 @@ static DamageTable sDamageTable = {
/* Unknown 2 */ DMG_ENTRY(0, 0x0), /* Unknown 2 */ DMG_ENTRY(0, 0x0),
}; };
static s32 sSlugGroup = 0; s32 sSlugGroup = 0;
void EnBw_SetupAction(EnBw* this, EnBwActionFunc actionFunc) { void EnBw_SetupAction(EnBw* this, EnBwActionFunc actionFunc) {
this->actionFunc = actionFunc; this->actionFunc = actionFunc;

View File

@ -35,7 +35,7 @@ const ActorInit En_Clear_Tag_InitVars = {
(ActorResetFunc)EnClearTag_Reset, (ActorResetFunc)EnClearTag_Reset,
}; };
static u8 sIsEffectsInitialized = false; u8 sClearTagIsEffectsInitialized = false;
static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f }; static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f };
@ -79,10 +79,10 @@ static ColliderCylinderInit sLaserCylinderInit = {
{ 15, 30, 10, { 0, 0, 0 } }, { 15, 30, 10, { 0, 0, 0 } },
}; };
static UNK_TYPE4 D_809D5C98 = 0; // unused //static UNK_TYPE4 D_809D5C98 = 0; // unused
static UNK_TYPE4 D_809D5C9C = 0; // unused //static UNK_TYPE4 D_809D5C9C = 0; // unused
static EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT]; EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT];
#include "overlays/ovl_En_Clear_Tag/ovl_En_Clear_Tag.h" #include "overlays/ovl_En_Clear_Tag/ovl_En_Clear_Tag.h"
@ -273,8 +273,8 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) {
} }
// Initialize all effects to available if effects have not been initialized. // Initialize all effects to available if effects have not been initialized.
if (!sIsEffectsInitialized) { if (!sClearTagIsEffectsInitialized) {
sIsEffectsInitialized = true; sClearTagIsEffectsInitialized = true;
globalCtx->specialEffects = &sClearTagEffects[0]; globalCtx->specialEffects = &sClearTagEffects[0];
for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++) { for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++) {
sClearTagEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE; sClearTagEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE;
@ -1027,5 +1027,5 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) {
void EnClearTag_Reset(void) { void EnClearTag_Reset(void) {
memset(sClearTagEffects, 0, sizeof(sClearTagEffects)); memset(sClearTagEffects, 0, sizeof(sClearTagEffects));
sIsEffectsInitialized = false; sClearTagIsEffectsInitialized = false;
} }

View File

@ -84,18 +84,7 @@ sEnFrPointers.flags = 12
- Deactivate frogs, frogs will jump back into the water - Deactivate frogs, frogs will jump back into the water
*/ */
typedef struct { EnFrPointers sEnFrPointers = {
u8 flags;
EnFr* frogs[5];
} EnFrPointers;
typedef struct {
f32 xzDist;
f32 yaw;
f32 yDist;
} LogSpotToFromWater;
static EnFrPointers sEnFrPointers = {
0x00, 0x00,
{ {
NULL, NULL,
@ -106,6 +95,7 @@ static EnFrPointers sEnFrPointers = {
}, },
}; };
// Flags for gSaveContext.eventChkInf[13] // Flags for gSaveContext.eventChkInf[13]
static u16 sSongIndex[] = { static u16 sSongIndex[] = {
0x0002, 0x0004, 0x0010, 0x0008, 0x0020, 0x0040, 0x0001, 0x0000, 0x0002, 0x0004, 0x0010, 0x0008, 0x0020, 0x0040, 0x0001, 0x0000,

View File

@ -28,6 +28,12 @@ typedef enum {
/* 07 */ FROG_NO_SONG /* 07 */ FROG_NO_SONG
} FrogSongType; } FrogSongType;
typedef struct {
f32 xzDist;
f32 yaw;
f32 yDist;
} LogSpotToFromWater;
typedef struct EnFr { typedef struct EnFr {
/* 0x0000 */ Actor actor; /* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime; // Frog Skeleton /* 0x014C */ SkelAnime skelAnime; // Frog Skeleton
@ -69,4 +75,9 @@ typedef struct EnFr {
/* 0x03B8 */ Vec3f posButterflyLight; // Used in Lights_PointNoGlowSetInfo() /* 0x03B8 */ Vec3f posButterflyLight; // Used in Lights_PointNoGlowSetInfo()
} EnFr; // size = 0x03C4 } EnFr; // size = 0x03C4
typedef struct {
u8 flags;
EnFr* frogs[5];
} EnFrPointers;
#endif #endif

View File

@ -96,7 +96,7 @@ static ColliderCylinderInit D_80A4B7CC = {
{ 15, 30, 10, { 0, 0, 0 } }, { 15, 30, 10, { 0, 0, 0 } },
}; };
static u8 sSpawnNum = 0; u8 sSpawnNum = 0;
static Vec3f sDeadEffectVel = { 0.0f, 0.0f, 0.0f }; static Vec3f sDeadEffectVel = { 0.0f, 0.0f, 0.0f };
static InitChainEntry sInitChain[] = { static InitChainEntry sInitChain[] = {

View File

@ -32,9 +32,9 @@ void func_80A7D26C(EnInsect* this, GlobalContext* globalCtx);
void func_80A7D39C(EnInsect* this); void func_80A7D39C(EnInsect* this);
void func_80A7D460(EnInsect* this, GlobalContext* globalCtx); void func_80A7D460(EnInsect* this, GlobalContext* globalCtx);
static f32 D_80A7DEB0 = 0.0f; f32 D_80A7DEB0 = 0.0f;
static s16 D_80A7DEB4 = 0; s16 D_80A7DEB4 = 0;
static s16 D_80A7DEB8 = 0; s16 D_80A7DEB8 = 0;
const ActorInit En_Insect_InitVars = { const ActorInit En_Insect_InitVars = {
ACTOR_EN_INSECT, ACTOR_EN_INSECT,

View File

@ -29,8 +29,8 @@ void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx);
void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx); void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx);
void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx); void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx);
static s16 sRotSpeedX = 0; s16 sRockRotSpeedX = 0;
static s16 sRotSpeedY = 0; s16 sRockRotSpeedY = 0;
const ActorInit En_Ishi_InitVars = { const ActorInit En_Ishi_InitVars = {
ACTOR_EN_ISHI, ACTOR_EN_ISHI,
@ -405,11 +405,11 @@ void EnIshi_SetupFly(EnIshi* this) {
this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ; this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ;
this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ; this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ;
if ((this->actor.params & 1) == ROCK_SMALL) { if ((this->actor.params & 1) == ROCK_SMALL) {
sRotSpeedX = (Rand_ZeroOne() - 0.5f) * 16000.0f; sRockRotSpeedX = (Rand_ZeroOne() - 0.5f) * 16000.0f;
sRotSpeedY = (Rand_ZeroOne() - 0.5f) * 2400.0f; sRockRotSpeedY = (Rand_ZeroOne() - 0.5f) * 2400.0f;
} else { } else {
sRotSpeedX = (Rand_ZeroOne() - 0.5f) * 8000.0f; sRockRotSpeedX = (Rand_ZeroOne() - 0.5f) * 8000.0f;
sRotSpeedY = (Rand_ZeroOne() - 0.5f) * 1600.0f; sRockRotSpeedY = (Rand_ZeroOne() - 0.5f) * 1600.0f;
} }
this->actor.colChkInfo.mass = 240; this->actor.colChkInfo.mass = 240;
this->actionFunc = EnIshi_Fly; this->actionFunc = EnIshi_Fly;
@ -455,8 +455,8 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) {
EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1300, 8); EffectSsGRipple_Spawn(globalCtx, &contactPos, 500, 1300, 8);
} }
this->actor.minVelocityY = -6.0f; this->actor.minVelocityY = -6.0f;
sRotSpeedX >>= 2; sRockRotSpeedX >>= 2;
sRotSpeedY >>= 2; sRockRotSpeedY >>= 2;
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L);
this->actor.bgCheckFlags &= ~0x40; this->actor.bgCheckFlags &= ~0x40;
} }
@ -464,8 +464,8 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) {
EnIshi_Fall(this); EnIshi_Fall(this);
func_80A7ED94(&this->actor.velocity, D_80A7FA28[type]); func_80A7ED94(&this->actor.velocity, D_80A7FA28[type]);
func_8002D7EC(&this->actor); func_8002D7EC(&this->actor);
this->actor.shape.rot.x += sRotSpeedX; this->actor.shape.rot.x += sRockRotSpeedX;
this->actor.shape.rot.y += sRotSpeedY; this->actor.shape.rot.y += sRockRotSpeedY;
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5);
Collider_UpdateCylinder(&this->actor, &this->collider); Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
@ -502,6 +502,6 @@ void EnIshi_Draw(Actor* thisx, GlobalContext* globalCtx) {
} }
void EnIshi_Reset(void) { void EnIshi_Reset(void) {
sRotSpeedX = 0; sRockRotSpeedX = 0;
sRotSpeedY = 0; sRockRotSpeedY = 0;
} }

View File

@ -35,7 +35,7 @@ void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 s
void EnNiw_FeatherUpdate(EnNiw* this, GlobalContext* globalCtx); void EnNiw_FeatherUpdate(EnNiw* this, GlobalContext* globalCtx);
void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx); void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx);
static s16 D_80AB85E0 = 0; s16 D_80AB85E0 = 0;
const ActorInit En_Niw_InitVars = { const ActorInit En_Niw_InitVars = {
ACTOR_EN_NIW, ACTOR_EN_NIW,
@ -70,9 +70,9 @@ static s16 sKakarikoFlagList[] = {
0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000,
}; };
static u8 sLowerRiverSpawned = false; u8 sLowerRiverSpawned = false;
static u8 sUpperRiverSpawned = false; u8 sUpperRiverSpawned = false;
static ColliderCylinderInit sCylinderInit1 = { static ColliderCylinderInit sCylinderInit1 = {
{ {

View File

@ -126,7 +126,7 @@ static DamageTable sDamageTable = {
/* Unknown 2 */ DMG_ENTRY(0, 0x0), /* Unknown 2 */ DMG_ENTRY(0, 0x0),
}; };
static s32 sNumSpawned = 0; s32 sEnPoFieldNumSpawned = 0;
static Vec3f sFieldMiddle = { -1000.0f, 0.0f, 6500.0f }; static Vec3f sFieldMiddle = { -1000.0f, 0.0f, 6500.0f };
@ -145,22 +145,22 @@ static EnPoFieldInfo sPoFieldInfo[2] = {
static Vec3f D_80AD714C = { 0.0f, 1400.0f, 0.0f }; static Vec3f D_80AD714C = { 0.0f, 1400.0f, 0.0f };
static Vec3s sSpawnPositions[10]; Vec3s sEnPoFieldSpawnPositions[10];
static u8 sSpawnSwitchFlags[10]; u8 sEnPoFieldSpawnSwitchFlags[10];
static MtxF sLimb7Mtx; static MtxF sLimb7Mtx;
void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx) { void EnPoField_Init(Actor* thisx, GlobalContext* globalCtx) {
EnPoField* this = (EnPoField*)thisx; EnPoField* this = (EnPoField*)thisx;
s32 pad; s32 pad;
if (sNumSpawned != 10) { if (sEnPoFieldNumSpawned != 10) {
sSpawnPositions[sNumSpawned].x = this->actor.world.pos.x; sEnPoFieldSpawnPositions[sEnPoFieldNumSpawned].x = this->actor.world.pos.x;
sSpawnPositions[sNumSpawned].y = this->actor.world.pos.y; sEnPoFieldSpawnPositions[sEnPoFieldNumSpawned].y = this->actor.world.pos.y;
sSpawnPositions[sNumSpawned].z = this->actor.world.pos.z; sEnPoFieldSpawnPositions[sEnPoFieldNumSpawned].z = this->actor.world.pos.z;
sSpawnSwitchFlags[sNumSpawned] = this->actor.params & 0xFF; sEnPoFieldSpawnSwitchFlags[sEnPoFieldNumSpawned] = this->actor.params & 0xFF;
sNumSpawned++; sEnPoFieldNumSpawned++;
} }
if (sNumSpawned >= 2) { if (sEnPoFieldNumSpawned >= 2) {
this->actor.params = 0xFF; this->actor.params = 0xFF;
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
return; return;
@ -407,10 +407,10 @@ void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) {
this->actionTimer--; this->actionTimer--;
} }
if (this->actionTimer == 0) { if (this->actionTimer == 0) {
for (i = 0; i < sNumSpawned; i++) { for (i = 0; i < sEnPoFieldNumSpawned; i++) {
if (fabsf(sSpawnPositions[i].x - player->actor.world.pos.x) < 150.0f && if (fabsf(sEnPoFieldSpawnPositions[i].x - player->actor.world.pos.x) < 150.0f &&
fabsf(sSpawnPositions[i].z - player->actor.world.pos.z) < 150.0f) { fabsf(sEnPoFieldSpawnPositions[i].z - player->actor.world.pos.z) < 150.0f) {
if (Flags_GetSwitch(globalCtx, sSpawnSwitchFlags[i])) { if (Flags_GetSwitch(globalCtx, sEnPoFieldSpawnSwitchFlags[i])) {
if (player->stateFlags1 & 0x800000) { // Player riding Epona if (player->stateFlags1 & 0x800000) { // Player riding Epona
return; return;
} else { } else {
@ -711,7 +711,7 @@ void EnPoField_SoulInteract(EnPoField* this, GlobalContext* globalCtx) {
} else { } else {
this->actor.textId = 0x508F; this->actor.textId = 0x508F;
Item_Give(globalCtx, ITEM_BIG_POE); Item_Give(globalCtx, ITEM_BIG_POE);
Flags_SetSwitch(globalCtx, sSpawnSwitchFlags[this->spawnFlagIndex]); Flags_SetSwitch(globalCtx, sEnPoFieldSpawnSwitchFlags[this->spawnFlagIndex]);
} }
} else { } else {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH); Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH);
@ -1009,8 +1009,8 @@ void EnPoField_DrawSoul(Actor* thisx, GlobalContext* globalCtx) {
} }
void EnPoField_Reset(void) { void EnPoField_Reset(void) {
sNumSpawned = 0; sEnPoFieldNumSpawned = 0;
memset(sSpawnPositions, 0, sizeof(sSpawnPositions)); memset(sEnPoFieldSpawnPositions, 0, sizeof(sEnPoFieldSpawnPositions));
memset(sSpawnSwitchFlags, 0, sizeof(sSpawnSwitchFlags)); memset(sEnPoFieldSpawnSwitchFlags, 0, sizeof(sEnPoFieldSpawnSwitchFlags));
} }

View File

@ -35,7 +35,7 @@ const ActorInit En_Takara_Man_InitVars = {
(ActorResetFunc)EnTakaraMan_Reset, (ActorResetFunc)EnTakaraMan_Reset,
}; };
static u8 sTakaraIsInitialized = false; u8 sTakaraIsInitialized = false;
void EnTakaraMan_Reset(Actor* thisx, GlobalContext* globalCtx) { void EnTakaraMan_Reset(Actor* thisx, GlobalContext* globalCtx) {
sTakaraIsInitialized = false; sTakaraIsInitialized = false;

View File

@ -447,7 +447,7 @@ void func_80B3D118(GlobalContext* globalCtx) {
static Vec3f D_80B42DA0; static Vec3f D_80B42DA0;
static s32 D_80B41D90 = 0; s32 D_80B41D90 = 0;
void EnXc_SetColossusWindSFX(GlobalContext* globalCtx) { void EnXc_SetColossusWindSFX(GlobalContext* globalCtx) {
if (gSaveContext.sceneSetupIndex == 4) { if (gSaveContext.sceneSetupIndex == 4) {
static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; static Vec3f sPos = { 0.0f, 0.0f, 0.0f };
@ -484,17 +484,17 @@ void EnXc_SetColossusWindSFX(GlobalContext* globalCtx) {
} }
} }
static s32 sFlameSpawned = false; s32 sEnXcFlameSpawned = false;
void EnXc_SpawnFlame(EnXc* this, GlobalContext* globalCtx) { void EnXc_SpawnFlame(EnXc* this, GlobalContext* globalCtx) {
if (!sFlameSpawned) { if (!sEnXcFlameSpawned) {
CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0);
f32 xPos = npcAction->startPos.x; f32 xPos = npcAction->startPos.x;
f32 yPos = npcAction->startPos.y; f32 yPos = npcAction->startPos.y;
f32 zPos = npcAction->startPos.z; f32 zPos = npcAction->startPos.z;
this->flameActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5); this->flameActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5);
sFlameSpawned = true; sEnXcFlameSpawned = true;
} }
} }
@ -519,7 +519,7 @@ void EnXc_DestroyFlame(EnXc* this) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
} }
static s32 D_80B41DA8 = 1; s32 D_80B41DA8 = 1;
void EnXc_InitFlame(EnXc* this, GlobalContext* globalCtx) { void EnXc_InitFlame(EnXc* this, GlobalContext* globalCtx) {
s32 pad; s32 pad;
s16 sceneNum = globalCtx->sceneNum; s16 sceneNum = globalCtx->sceneNum;
@ -1402,7 +1402,7 @@ void func_80B3F534(GlobalContext* globalCtx) {
} }
} }
static s32 D_80B41DAC = 1; s32 D_80B41DAC = 1;
void func_80B3F59C(EnXc* this, GlobalContext* globalCtx) { void func_80B3F59C(EnXc* this, GlobalContext* globalCtx) {
CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0); CsCmdActorAction* npcAction = EnXc_GetCsCmd(globalCtx, 0);
@ -2430,7 +2430,7 @@ const ActorInit En_Xc_InitVars = {
void EnXc_Reset(void) { void EnXc_Reset(void) {
D_80B41D90 = 0; D_80B41D90 = 0;
sFlameSpawned = false; sEnXcFlameSpawned = false;
D_80B41DA8 = 1; D_80B41DA8 = 1;
D_80B41DAC = 1; D_80B41DAC = 1;
} }

View File

@ -97,8 +97,8 @@ static Vec3f sPlatformPositions[] = {
}; };
// These seem to relate to the tagging in/out the minibosses do // These seem to relate to the tagging in/out the minibosses do
static s16 D_80B4A1B0 = 0; s16 D_80B4A1B0 = 0;
static s16 D_80B4A1B4 = 1; s16 D_80B4A1B4 = 1;
const ActorInit En_Zf_InitVars = { const ActorInit En_Zf_InitVars = {
ACTOR_EN_ZF, ACTOR_EN_ZF,

View File

@ -45,7 +45,7 @@ static void* sEyeTextures[] = { gZelda2EyeOpenTex, gZelda2EyeHalfTex, gZelda2Eye
static void* sMouthTextures[] = { gZelda2MouthSeriousTex, gZelda2MouthHappyTex, gZelda2MouthOpenTex }; static void* sMouthTextures[] = { gZelda2MouthSeriousTex, gZelda2MouthHappyTex, gZelda2MouthOpenTex };
static s32 D_80B5A468 = 0; s32 D_80B5A468 = 0;
static Vec3f D_80B5A46C = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80B5A46C = { 0.0f, 0.0f, 0.0f };
@ -55,7 +55,7 @@ static f32 D_80B5A484 = 0.0f;
static Vec3f D_80B5A488 = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80B5A488 = { 0.0f, 0.0f, 0.0f };
static s32 D_80B5A494 = -1; s32 D_80B5A494 = -1;
static Vec3f D_80B5A498 = { 148.0f, 260.0f, -87.0f }; static Vec3f D_80B5A498 = { 148.0f, 260.0f, -87.0f };
@ -63,7 +63,7 @@ static Vec3f D_80B5A4A4 = { -12.0f, 260.0f, -147.0f };
static Vec3f D_80B5A4B0 = { 42.0f, 260.0f, 13.0f }; static Vec3f D_80B5A4B0 = { 42.0f, 260.0f, 13.0f };
static u32 D_80B5A4BC = 0; u32 D_80B5A4BC = 0;
void func_80B533B0(Actor* thisx, GlobalContext* globalCtx) { void func_80B533B0(Actor* thisx, GlobalContext* globalCtx) {
EnZl3* this = (EnZl3*)thisx; EnZl3* this = (EnZl3*)thisx;

View File

@ -57,8 +57,8 @@ const ActorInit Object_Kankyo_InitVars = {
(ActorResetFunc)ObjectKankyo_Reset, (ActorResetFunc)ObjectKankyo_Reset,
}; };
static u8 sIsSpawned = false; u8 sKankyoIsSpawned = false;
static s16 sTrailingFairies = 0; s16 sTrailingFairies = 0;
void ObjectKankyo_SetupAction(ObjectKankyo* this, ObjectKankyoActionFunc action) { void ObjectKankyo_SetupAction(ObjectKankyo* this, ObjectKankyoActionFunc action) {
this->actionFunc = action; this->actionFunc = action;
@ -76,18 +76,18 @@ void ObjectKankyo_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.room = -1; this->actor.room = -1;
switch (this->actor.params) { switch (this->actor.params) {
case 0: case 0:
if (!sIsSpawned) { if (!sKankyoIsSpawned) {
ObjectKankyo_SetupAction(this, ObjectKankyo_Fairies); ObjectKankyo_SetupAction(this, ObjectKankyo_Fairies);
sIsSpawned = true; sKankyoIsSpawned = true;
} else { } else {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
} }
break; break;
case 3: case 3:
if (!sIsSpawned) { if (!sKankyoIsSpawned) {
ObjectKankyo_SetupAction(this, ObjectKankyo_Snow); ObjectKankyo_SetupAction(this, ObjectKankyo_Snow);
sIsSpawned = true; sKankyoIsSpawned = true;
} else { } else {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
} }
@ -939,6 +939,6 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, GlobalContext* globalCtx2) {
} }
void ObjectKankyo_Reset(void) { void ObjectKankyo_Reset(void) {
sIsSpawned = false; sKankyoIsSpawned = false;
sTrailingFairies = 0; sTrailingFairies = 0;
} }

View File

@ -4804,7 +4804,7 @@ s32 func_8083ADD4(GlobalContext* globalCtx, Player* this) {
void func_8083AE40(Player* this, s16 objectId) { void func_8083AE40(Player* this, s16 objectId) {
s32 pad; s32 pad;
u32 size; size_t size;
if (objectId != OBJECT_INVALID) { if (objectId != OBJECT_INVALID) {
this->giObjectLoading = true; this->giObjectLoading = true;
@ -4815,7 +4815,7 @@ void func_8083AE40(Player* this, s16 objectId) {
LOG_HEX("size", size, "../z_player.c", 9090); LOG_HEX("size", size, "../z_player.c", 9090);
ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091); ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091);
DmaMgr_SendRequest2(&this->giObjectDmaRequest, (u32)this->giObjectSegment, gObjectTable[objectId].vromStart, DmaMgr_SendRequest2(&this->giObjectDmaRequest, (uintptr_t)this->giObjectSegment, gObjectTable[objectId].vromStart,
size, 0, &this->giObjectLoadQueue, NULL, "../z_player.c", 9099); size, 0, &this->giObjectLoadQueue, NULL, "../z_player.c", 9099);
} }
} }
@ -10751,7 +10751,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f }; static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f };
void Player_Update(Actor* thisx, GlobalContext* globalCtx) { void Player_Update(Actor* thisx, GlobalContext* globalCtx) {
static Vec3f sDogSpawnPos; static Vec3f sDogSpawnPos;
Player* this = (Player*)thisx; Player* this = (Player*)thisx;
s32 dogParams; s32 dogParams;
s32 pad; s32 pad;