diff --git a/libultraship b/libultraship index 04ef63c74..7d60dd371 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 04ef63c74270dfe9df458bd8335aac7a7097468a +Subproject commit 7d60dd37120d3b37938a2ed7377007971171c8be diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index b811c898f..3c12c41a9 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -548,12 +548,16 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-missing-field-initializers -Wno-parentheses -Wno-narrowing - -Wno-c++11-narrowing - -Wno-implicit-function-declaration -Wno-missing-braces - -Wno-incompatible-pointer-types + $<$: + -Werror-implicit-function-declaration + -Wno-incompatible-pointer-types + > $<$:-fpermissive> - $<$:-Wno-deprecated-enum-enum-conversion> + $<$: + -Wno-c++11-narrowing + -Wno-deprecated-enum-enum-conversion + > -pthread ) @@ -570,12 +574,16 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-missing-field-initializers -Wno-parentheses -Wno-narrowing - -Wno-c++11-narrowing - -Wno-implicit-function-declaration -Wno-missing-braces - -Wno-incompatible-pointer-types + $<$: + -Werror-implicit-function-declaration + -Wno-incompatible-pointer-types + > $<$:-fpermissive> - $<$:-Wno-deprecated-enum-enum-conversion> + $<$: + -Wno-c++11-narrowing + -Wno-deprecated-enum-enum-conversion + > -pthread ) @@ -592,11 +600,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-narrowing -Wno-switch-outside-range $<$: + -Werror-implicit-function-declaration -Wno-incompatible-pointer-types -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers -Wno-int-conversion - -Wno-implicit-function-declaration -Wno-builtin-declaration-mismatch -Wno-switch-unreachable -Wno-stringop-overflow @@ -616,7 +624,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces - -Wno-incompatible-pointer-types + $<$: + -Werror-implicit-function-declaration + -Wno-incompatible-pointer-types + > $<$:-fpermissive> $<$:-Wno-deprecated-enum-enum-conversion> -pthread diff --git a/soh/include/functions.h b/soh/include/functions.h index 8bce5eb69..9bc1d0615 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -27,6 +27,8 @@ void gSPDisplayList(Gfx* pkt, Gfx* dl); void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset); void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0); void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr); +void gDPSetTextureImageFB(Gfx* pkt, u32 format, u32 size, u32 width, int fb); + void cleararena(void); void bootproc(void); @@ -180,6 +182,7 @@ void __osSetWatchLo(u32); EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params); EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params); +void EnItem00_CustomItemsParticles(Actor* Parent, PlayState* play, GetItemEntry giEntry); void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnPos, s16 params); void EffectBlure_ChangeType(EffectBlure* this, int type); void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2); @@ -569,6 +572,9 @@ void Flags_UnsetRandomizerInf(RandomizerInf flag); u16 func_80037C30(PlayState* play, s16 arg1); s32 func_80037D98(PlayState* play, Actor* actor, s16 arg2, s32* arg3); s32 func_80038290(PlayState* play, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4); +GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, PlayState* play); +s16 GetChestGameRandoGiDrawId(s8 room, s16 ogDrawId, PlayState* play); + // ? func_80038600(?); u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList*); void func_80038A28(CollisionPoly* poly, f32 tx, f32 ty, f32 tz, MtxF* dest); @@ -1207,10 +1213,12 @@ Gfx* Gfx_SetupDL_66(Gfx* gfx); Gfx* func_800947AC(Gfx* gfx); void Gfx_SetupDL_42Opa(GraphicsContext* gfxCtx); void Gfx_SetupDL_42Overlay(GraphicsContext* gfxCtx); +void Gfx_SetupDL_42Kal(GraphicsContext* gfxCtx); void Gfx_SetupDL_27Xlu(GraphicsContext* gfxCtx); void Gfx_SetupDL_60NoCDXlu(GraphicsContext* gfxCtx); void Gfx_SetupDL_61Xlu(GraphicsContext* gfxCtx); void Gfx_SetupDL_56Ptr(Gfx** gfxp); +void Gfx_SetupDL_39Kal(GraphicsContext* gfxp); Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height); Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y); Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height); @@ -1345,6 +1353,7 @@ void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDe void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest); void SkinMatrix_GetClear(MtxF** mf); +void SkinMatrix_Clear(MtxF* mf); void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest); s32 SkinMatrix_Invert(MtxF* src, MtxF* dest); void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z); @@ -2101,6 +2110,7 @@ void PreviewSequence(u16 seqId); void func_800F5B58(void); void func_800F5BF0(u8 natureAmbienceId); void Audio_PlayFanfare(u16); +void Audio_PlayFanfare_Rando(GetItemEntry getItem); void func_800F5C2C(void); void func_800F5E18(u8 playerIdx, u16 seqId, u8 fadeTimer, s8 arg3, s8 arg4); void Audio_SetSequenceMode(u8 seqMode); diff --git a/soh/include/macros.h b/soh/include/macros.h index 74d74cef1..eb6fba848 100644 --- a/soh/include/macros.h +++ b/soh/include/macros.h @@ -245,14 +245,6 @@ extern GraphicsContext* __gfxCtx; #define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } -// #region SOH [WiiU] -#ifdef __WIIU__ -#define ASSERT(expression) (void)((!!(expression)) || (_assert(#expression, __FILE__, (unsigned)(__LINE__)), 0)) -#else -#define ASSERT(expression) (void)((!!(expression)) || (__assert(#expression, __FILE__, (unsigned)(__LINE__)), 0)) -#endif -// #endregion - #define gDPSetTileCustom(pkt, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \ do { \ gDPPipeSync(pkt); \ diff --git a/soh/soh/Enhancements/audio/AudioEditor.h b/soh/soh/Enhancements/audio/AudioEditor.h index 5ca4457e3..dc058371d 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.h +++ b/soh/soh/Enhancements/audio/AudioEditor.h @@ -1,6 +1,8 @@ #pragma once #include "stdint.h" +#ifdef __cplusplus + #include #include @@ -16,3 +18,13 @@ class AudioEditor : public LUS::GuiWindow { void AudioEditor_RandomizeAll(); void AudioEditor_ResetAll(); + +extern "C" { +#endif + +u16 AudioEditor_GetReplacementSeq(u16 seqId); + + +#ifdef __cplusplus +} +#endif diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index fceb9c84a..ab2bbf9d8 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -1,6 +1,7 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/speechsynthesizer/SpeechSynthesizer.h" +#include #include #include #include @@ -43,7 +44,7 @@ std::string GetParameritizedText(std::string key, TextBank bank, const char* arg size_t index = value.find(searchString); if (index != std::string::npos) { - ASSERT(arg != nullptr); + assert(arg != nullptr); value.replace(index, searchString.size(), std::string(arg)); return value; } else { @@ -59,7 +60,7 @@ std::string GetParameritizedText(std::string key, TextBank bank, const char* arg size_t index = value.find(searchString); if (index != std::string::npos) { - ASSERT(arg != nullptr); + assert(arg != nullptr); value.replace(index, searchString.size(), std::string(arg)); return value; } else { @@ -75,7 +76,7 @@ std::string GetParameritizedText(std::string key, TextBank bank, const char* arg size_t index = value.find(searchString); if (index != std::string::npos) { - ASSERT(arg != nullptr); + assert(arg != nullptr); value.replace(index, searchString.size(), std::string(arg)); return value; } else { @@ -158,7 +159,7 @@ void RegisterOnInterfaceUpdateHook() { auto translation = GetParameritizedText((seconds > 1) ? "seconds_plural" : "seconds_singular", TEXT_BANK_MISC, arg); announceBuf += snprintf(announceBuf, sizeof(ttsAnnounceBuf), "%s", translation.c_str()); } - ASSERT(announceBuf < ttsAnnounceBuf + sizeof(ttsAnnounceBuf)); + assert(announceBuf < ttsAnnounceBuf + sizeof(ttsAnnounceBuf)); SpeechSynthesizer::Instance->Speak(ttsAnnounceBuf, GetLanguageCode()); prevTimer = timer; } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 05ea04e12..bef92f306 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -45,9 +45,11 @@ uint32_t IsGameMasterQuest(); void DeinitOTR(void); void VanillaItemTable_Init(); void OTRAudio_Init(); +void OTRMessage_Init(); void InitAudio(); void Graph_StartFrame(); void Graph_ProcessGfxCommands(Gfx* commands); +void Graph_ProcessFrame(void (*run_one_game_iter)(void)); void OTRLogString(const char* src); void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char)); void OTRGetPixelDepthPrepare(float x, float y); diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 5454a0d9c..b6dd50e36 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -50,7 +50,6 @@ extern "C" void OTRPlay_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) { scene->unk_13 = 0; - //ASSERT(play->sceneSegment != NULL); //gSegments[2] = VIRTUAL_TO_PHYSICAL(play->sceneSegment); OTRPlay_InitScene(play, spawn); diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 349e624d0..b49fc919e 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -11,6 +11,7 @@ #include "soh/resource/type/Text.h" #include #include +#include #include "soh/resource/type/scenecommand/SetCameraSettings.h" #include "soh/resource/type/scenecommand/SetCutscenes.h" #include "soh/resource/type/scenecommand/SetStartPositionList.h" @@ -520,7 +521,7 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - ASSERT(roomNum < play->numRooms); + assert(roomNum < play->numRooms); if (roomNum >= play->numRooms) return 0; // UH OH diff --git a/soh/src/boot/assert.c b/soh/src/boot/assert.c deleted file mode 100644 index f84f4d46f..000000000 --- a/soh/src/boot/assert.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "global.h" - -#ifndef __SWITCH__ -#ifdef __WIIU__ -void _assert(const char* exp, const char* file, s32 line) { -#else -void __assert(const char* exp, const char* file, s32 line) { -#endif - char msg[256]; - - osSyncPrintf("Assertion failed: %s, file %s, line %d, thread %d\n", exp, file, line, osGetThreadId(NULL)); - sprintf(msg, "ASSERT: %s:%d(%d)", file, line, osGetThreadId(NULL)); - Fault_AddHungupAndCrashImpl(msg, exp); -} -#endif \ No newline at end of file diff --git a/soh/src/boot/z_std_dma.c b/soh/src/boot/z_std_dma.c index 8df938297..fd1f85f01 100644 --- a/soh/src/boot/z_std_dma.c +++ b/soh/src/boot/z_std_dma.c @@ -1,5 +1,7 @@ #include "global.h" #include "vt.h" +#include +#include StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; @@ -123,9 +125,9 @@ end: s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { s32 ret; - ASSERT(pihandle == gCartHandle); - ASSERT(direction == OS_READ); - ASSERT(mb != NULL); + assert(pihandle == gCartHandle); + assert(direction == OS_READ); + assert(mb != NULL); if (D_80009460 == 10) { osSyncPrintf("%10lld サウンドDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), mb->dramAddr, @@ -183,14 +185,14 @@ void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, cons osSyncPrintf(VT_RST); if (req->filename) { - sprintf(buff1, "DMA ERROR: %s %d", req->filename, req->line); + snprintf(buff1, sizeof(buff1), "DMA ERROR: %s %d", req->filename, req->line); } else if (sDmaMgrCurFileName) { - sprintf(buff1, "DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine); + snprintf(buff1, sizeof(buff1), "DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine); } else { - sprintf(buff1, "DMA ERROR: %s", errorName != NULL ? errorName : "???"); + snprintf(buff1, sizeof(buff1), "DMA ERROR: %s", errorName != NULL ? errorName : "???"); } - sprintf(buff2, "%07X %08X %X %s", vrom, ram, size, file != NULL ? file : "???"); + snprintf(buff2, sizeof(buff1), "%07X %08X %X %s", vrom, ram, size, file != NULL ? file : "???"); Fault_AddHungupAndCrashImpl(buff1, buff2); } diff --git a/soh/src/buffers/heaps.c b/soh/src/buffers/heaps.c index 410c843a5..2191ae72f 100644 --- a/soh/src/buffers/heaps.c +++ b/soh/src/buffers/heaps.c @@ -3,6 +3,7 @@ #ifndef __APPLE__ #include #endif +#include #ifndef _MSC_VER #include diff --git a/soh/src/code/PreRender.c b/soh/src/code/PreRender.c index 0458601f1..343919e0e 100644 --- a/soh/src/code/PreRender.c +++ b/soh/src/code/PreRender.c @@ -2,6 +2,7 @@ #include "alloca.h" #include +#include void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { this->widthSave = width; @@ -474,9 +475,9 @@ void func_800C2FE4(PreRender* this) { s32 x; s32 y; s32 phi_v0; - u8* buffR = alloca(this->width); - u8* buffG = alloca(this->width); - u8* buffB = alloca(this->width); + u8* buffR = malloc(this->width); + u8* buffG = malloc(this->width); + u8* buffB = malloc(this->width); s32 pad[3]; s32 pxR; s32 pxG; @@ -538,6 +539,9 @@ void func_800C2FE4(PreRender* this) { this->fbufSave[x + y * this->width] = pxOut.rgba; } } + free(buffR); + free(buffB); + free(buffG); } void PreRender_Calc(PreRender* this) { diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index 583ce84fe..7c02b7b9c 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -6,6 +6,7 @@ #include "global.h" #include "soh/OTRGlobals.h" #include "soh/Enhancements/audio/AudioCollection.h" +#include "soh/Enhancements/audio/AudioEditor.h" #define MK_ASYNC_MSG(retData, tableType, id, status) (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (status)) #define ASYNC_TBLTYPE(v) ((u8)(v >> 16)) diff --git a/soh/src/code/audio_seqplayer.c b/soh/src/code/audio_seqplayer.c index 9e9ee645c..8d484575d 100644 --- a/soh/src/code/audio_seqplayer.c +++ b/soh/src/code/audio_seqplayer.c @@ -3,6 +3,8 @@ #include #include "global.h" +#include "soh/Enhancements/audio/AudioEditor.h" + extern char** sequenceMap; #define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80) diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 2838cbdc5..3f0c91001 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -1,5 +1,6 @@ #include #include "global.h" +#include "soh/Enhancements/audio/AudioEditor.h" // TODO: can these macros be shared between files? code_800F9280 seems to use // versions without any casts... diff --git a/soh/src/code/code_800F7260.c b/soh/src/code/code_800F7260.c index 5395e0691..e62291c0d 100644 --- a/soh/src/code/code_800F7260.c +++ b/soh/src/code/code_800F7260.c @@ -2,6 +2,8 @@ #include "global.h" #include "vt.h" +#include "soh/Enhancements/audio/AudioEditor.h" + typedef struct { /* 0x00 */ u16 sfxId; /* 0x04 */ Vec3f* pos; diff --git a/soh/src/code/code_800F9280.c b/soh/src/code/code_800F9280.c index 2963b543a..4b519dc77 100644 --- a/soh/src/code/code_800F9280.c +++ b/soh/src/code/code_800F9280.c @@ -2,6 +2,8 @@ #include "global.h" #include "soh/mixer.h" +#include "soh/Enhancements/audio/AudioEditor.h" + typedef struct { u8 unk_0; u8 unk_1; // importance? diff --git a/soh/src/code/fault.c b/soh/src/code/fault.c index f7414766a..fe7f7f966 100644 --- a/soh/src/code/fault.c +++ b/soh/src/code/fault.c @@ -1,6 +1,6 @@ #include "global.h" #include "vt.h" -#include "alloca.h" +#include // data const char* sExceptionNames[] = { @@ -1124,6 +1124,6 @@ void Fault_AddHungupAndCrashImpl(const char* arg0, const char* arg1) { void Fault_AddHungupAndCrash(const char* filename, u32 line) { char msg[256]; - sprintf(msg, "HungUp %s:%d", filename, line); + snprintf(msg, sizeof(msg), "HungUp %s:%d", filename, line); Fault_AddHungupAndCrashImpl(msg, NULL); } diff --git a/soh/src/code/game.c b/soh/src/code/game.c index 09e35ea0f..4167a5a96 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -3,6 +3,7 @@ #include "vt.h" #include "libultraship/bridge.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" SpeedMeter D_801664D0; struct_801664F0 D_801664F0; @@ -16,6 +17,7 @@ u16 sLastButtonPressed; int gfx_create_framebuffer(uint32_t width, uint32_t height); void gfx_texture_cache_clear(); + void GameState_FaultPrint(void) { static char sBtnChars[] = "ABZSuldr*+LRudlr"; s32 i; diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index 21d4526f3..85169db77 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -3,9 +3,12 @@ #include "regs.h" #include +#include +#include #include "soh/Enhancements/debugger/colViewer.h" #include "soh/Enhancements/gameconsole.h" +#include "soh/OTRGlobals.h" #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 @@ -16,6 +19,9 @@ FaultClient sGraphFaultClient; CfbInfo sGraphCfbInfos[3]; FaultClient sGraphUcodeFaultClient; +void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId); +void PadMgr_ThreadEntry(PadMgr* padMgr); + // clang-format off UCodeInfo D_8012D230[3] = { //{ UCODE_F3DZEX, D_80155F50 }, @@ -461,7 +467,7 @@ static void RunFrame() { osSyncPrintf("確保失敗\n"); // "Failure to secure" - sprintf(faultMsg, "CLASS SIZE= %d bytes", size); + snprintf(faultMsg, sizeof(faultMsg), "CLASS SIZE= %d bytes", size); Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg); } GameState_Init(runFrameContext.gameState, runFrameContext.ovl->init, &runFrameContext.gfxCtx); @@ -478,15 +484,15 @@ static void RunFrame() while (GameState_IsRunning(runFrameContext.gameState)) { - uint64_t ticksA, ticksB; - ticksA = GetPerfCounter(); + //uint64_t ticksA, ticksB; + //ticksA = GetPerfCounter(); Graph_StartFrame(); PadMgr_ThreadEntry(&gPadMgr); Graph_Update(&runFrameContext.gfxCtx, runFrameContext.gameState); - ticksB = GetPerfCounter(); + //ticksB = GetPerfCounter(); Graph_ProcessGfxCommands(runFrameContext.gfxCtx.workBuffer); diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c index 81227f11e..abfa029e1 100644 --- a/soh/src/code/padmgr.c +++ b/soh/src/code/padmgr.c @@ -1,16 +1,13 @@ #include "global.h" #include "vt.h" +#include #include "soh/Enhancements/game-interactor/GameInteractor.h" -//#include - -#ifdef _MSC_VER -extern void* __cdecl memset(_Out_writes_bytes_all_(_Size) void* _Dst, _In_ int _Val, _In_ size_t _Size); -#endif - s32 D_8012D280 = 1; +void OTRControllerCallback(uint8_t rumble); + OSMesgQueue* PadMgr_LockSerialMesgQueue(PadMgr* padMgr) { OSMesgQueue* ctrlrQ = NULL; diff --git a/soh/src/code/sched.c b/soh/src/code/sched.c index 0970b4fd9..5edbbf079 100644 --- a/soh/src/code/sched.c +++ b/soh/src/code/sched.c @@ -1,6 +1,7 @@ #include "global.h" #include +#include #define RSP_DONE_MSG 667 #define RDP_DONE_MSG 668 @@ -102,7 +103,7 @@ void Sched_HandleStart(SchedContext* sc) { void Sched_QueueTask(SchedContext* sc, OSScTask* task) { s32 type = task->list.t.type; - ASSERT((type == M_AUDTASK) || (type == M_GFXTASK) || (type == M_NJPEGTASK) || (type == M_NULTASK)); + assert((type == M_AUDTASK) || (type == M_GFXTASK) || (type == M_NJPEGTASK) || (type == M_NULTASK)); if (type == M_AUDTASK) { if (sLogScheduler) { @@ -134,7 +135,7 @@ void Sched_QueueTask(SchedContext* sc, OSScTask* task) { void Sched_Yield(SchedContext* sc) { if (!(sc->curRSPTask->state & OS_SC_YIELD)) { - ASSERT(sc->curRSPTask->list.t.type != M_AUDTASK); + assert(sc->curRSPTask->list.t.type != M_AUDTASK); sc->curRSPTask->state |= OS_SC_YIELD; @@ -153,14 +154,14 @@ OSScTask* func_800C89D4(SchedContext* sc, OSScTask* task) { if (sc->pendingSwapBuf1 != NULL) { if (0) { - ASSERT(sc->pendingSwapBuf1 != NULL); + assert(sc->pendingSwapBuf1 != NULL); } return NULL; } if (sc->pendingSwapBuf2 != NULL) { if (0) { - ASSERT(sc->pendingSwapBuf2 != NULL); + assert(sc->pendingSwapBuf2 != NULL); } return NULL; } @@ -246,7 +247,7 @@ u32 Sched_IsComplete(SchedContext* sc, OSScTask* task) { } void Sched_RunTask(SchedContext* sc, OSScTask* spTask, OSScTask* dpTask) { - ASSERT(sc->curRSPTask == NULL); + assert(sc->curRSPTask == NULL); if (spTask != NULL) { if (spTask->list.t.type == M_NULTASK) { if (spTask->flags & OS_SC_NEEDS_RSP) { @@ -356,7 +357,7 @@ void Sched_HandleRSPDone(SchedContext* sc) { OSScTask* nextRDP = NULL; s32 state; - ASSERT(sc->curRSPTask != NULL); + assert(sc->curRSPTask != NULL); if (sc->curRSPTask->list.t.type == M_AUDTASK) { gRSPAudioTotalTime += osGetTime() - sRSPAudioStartTime; @@ -405,8 +406,8 @@ void Sched_HandleRDPDone(SchedContext* sc) { s32 state; gRDPTotalTime = osGetTime() - sRDPStartTime; - ASSERT(sc->curRDPTask != NULL); - ASSERT(sc->curRDPTask->list.t.type == M_GFXTASK); + assert(sc->curRDPTask != NULL); + assert(sc->curRDPTask->list.t.type == M_GFXTASK); curTask = sc->curRDPTask; sc->curRDPTask = NULL; curTask->state &= ~OS_SC_DP; diff --git a/soh/src/code/sys_matrix.c b/soh/src/code/sys_matrix.c index 06e2e881f..c0f326673 100644 --- a/soh/src/code/sys_matrix.c +++ b/soh/src/code/sys_matrix.c @@ -1,6 +1,7 @@ #include "global.h" #include "soh/frame_interpolation.h" +#include // clang-format off Mtx gMtxClear = { @@ -35,7 +36,7 @@ void Matrix_Push(void) { void Matrix_Pop(void) { FrameInterpolation_RecordMatrixPop(); sCurrentMatrix--; - ASSERT(sCurrentMatrix >= sMatrixStack); + assert(sCurrentMatrix >= sMatrixStack); } void Matrix_Get(MtxF* dest) { diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 7a30a35ee..3b3b4a970 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -9,13 +9,13 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/enemyrandomizer.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + #include "soh/ActorDB.h" -#if defined(_MSC_VER) || defined(__GNUC__) #include #include #include -#endif #if defined(_MSC_VER) || defined(__GNUC__) #include "textures/place_title_cards/g_pn_49.h" @@ -2570,7 +2570,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actor->colorFilterTimer--; } actor->update(actor, play); - GameInteractor_ExecuteOnActorUpdate(actor, play); + GameInteractor_ExecuteOnActorUpdate(actor); func_8003F8EC(play, &play->colCtx.dyna, actor); } @@ -2900,7 +2900,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) { if ((actor->flags & ACTOR_FLAG_LENS) && ((play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || play->actorCtx.lensActive || (actor->room != play->roomCtx.curRoom.num))) { - ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX); + assert(invisibleActorCounter < INVISIBLE_ACTOR_MAX); invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; } else { @@ -3127,7 +3127,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos ActorDBEntry* dbEntry = ActorDB_Retrieve(actorId); - ASSERT(dbEntry->valid); + assert(dbEntry->valid); if (HREG(20) != 0) { // "Actor class addition [%d:%s]" @@ -3165,7 +3165,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos return NULL; } - ASSERT(dbEntry->numLoaded < 255); + assert(dbEntry->numLoaded < 255); dbEntry->numLoaded++; diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c index 22e89e291..be94d8b8a 100644 --- a/soh/src/code/z_bgcheck.c +++ b/soh/src/code/z_bgcheck.c @@ -2,6 +2,7 @@ #include "vt.h" #include +#include #define SS_NULL 0xFFFF @@ -87,7 +88,7 @@ void SSNodeList_SetSSListHead(SSNodeList* nodeList, SSList* ssList, s16* polyId) void DynaSSNodeList_SetSSListHead(DynaSSNodeList* nodeList, SSList* ssList, s16* polyId) { u16 newNodeId = DynaSSNodeList_GetNextNodeIdx(nodeList); - ASSERT(newNodeId != SS_NULL); + assert(newNodeId != SS_NULL); SSNode_SetValue(&nodeList->tbl[newNodeId], polyId, ssList->head); ssList->head = newNodeId; } @@ -106,7 +107,7 @@ void DynaSSNodeList_Initialize(PlayState* play, DynaSSNodeList* nodeList) { void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* nodeList, s32 max) { nodeList->tbl = THA_AllocEndAlign(&play->state.tha, max * sizeof(SSNode), -2); - ASSERT(nodeList->tbl != NULL); + assert(nodeList->tbl != NULL); nodeList->max = max; nodeList->count = 0; @@ -709,7 +710,7 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } } - ASSERT(!IS_ZERO(normalXZ)); + assert(!IS_ZERO(normalXZ)); invNormalXZ = 1.0f / normalXZ; temp_f16 = fabsf(nz) * invNormalXZ; @@ -790,7 +791,7 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } } - ASSERT(!IS_ZERO(normalXZ)); + assert(!IS_ZERO(normalXZ)); invNormalXZ = 1.0f / normalXZ; temp_f16 = fabsf(nx) * invNormalXZ; @@ -2446,11 +2447,11 @@ void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPoly this->count = 0; this->tbl = THA_AllocEndAlign(&play->state.tha, tblMax * sizeof(SSNode), -2); - ASSERT(this->tbl != NULL); + assert(this->tbl != NULL); this->polyCheckTbl = GAMESTATE_ALLOC_MC(&play->state, numPolys); - ASSERT(this->polyCheckTbl != NULL); + assert(this->polyCheckTbl != NULL); } /** @@ -2460,7 +2461,7 @@ SSNode* SSNodeList_GetNextNode(SSNodeList* this) { SSNode* result = &this->tbl[this->count]; this->count++; - ASSERT(this->count < this->max); + assert(this->count < this->max); if (!(this->count < this->max)) { return NULL; } @@ -2473,7 +2474,7 @@ SSNode* SSNodeList_GetNextNode(SSNodeList* this) { u16 SSNodeList_GetNextNodeIdx(SSNodeList* this) { u16 new_index = this->count++; - ASSERT(new_index < this->max); + assert(new_index < this->max); return new_index; } @@ -2579,7 +2580,7 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) { */ void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) { *polyList = THA_AllocEndAlign(&play->state.tha, numPolys * sizeof(CollisionPoly), -2); - ASSERT(*polyList != NULL); + assert(*polyList != NULL); } /** @@ -2594,7 +2595,7 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) { */ void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) { *vtxList = THA_AllocEndAlign(&play->state.tha, numVtx * sizeof(Vec3s), -2); - ASSERT(*vtxList != NULL); + assert(*vtxList != NULL); } /** @@ -2811,8 +2812,8 @@ void DynaPoly_ExpandSRT(PlayState* play, DynaCollisionContext* dyna, s32 bgId, s *vtxStartIndex + pbgdata->numVertices, dyna->vtxListMax); } - ASSERT(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons); - ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices); + assert(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons); + assert(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices); if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) && (BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) { @@ -3245,7 +3246,7 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo poly = &dyna->polyList[polyId]; CollisionPoly_GetNormalF(poly, &nx, &ny, &nz); normalXZ = sqrtf(SQ(nx) + SQ(nz)); - ASSERT(!IS_ZERO(normalXZ)); + assert(!IS_ZERO(normalXZ)); planeDist = Math3D_DistPlaneToPos(nx, ny, nz, poly->dist, &resultPos); if (radius < fabsf(planeDist) || COLPOLY_VIA_FLAG_TEST(poly->flags_vIA, xpFlags)) { @@ -3318,7 +3319,7 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo poly = &dyna->polyList[polyId]; CollisionPoly_GetNormalF(poly, &nx, &ny, &nz); normalXZ = sqrtf(SQ(nx) + SQ(nz)); - ASSERT(!IS_ZERO(normalXZ)); + assert(!IS_ZERO(normalXZ)); planeDist = Math3D_DistPlaneToPos(nx, ny, nz, poly->dist, &resultPos); if (radius < fabsf(planeDist) || COLPOLY_VIA_FLAG_TEST(poly->flags_vIA, xpFlags)) { diff --git a/soh/src/code/z_collision_check.c b/soh/src/code/z_collision_check.c index d04a097cf..c4716c947 100644 --- a/soh/src/code/z_collision_check.c +++ b/soh/src/code/z_collision_check.c @@ -2,6 +2,7 @@ #include "vt.h" #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" +#include typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkBloodFunc)(PlayState*, Collider*, Vec3f*); @@ -71,7 +72,7 @@ void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, gDPPipeSync(POLY_OPA_DISP++); vtxTbl = Graph_Alloc(gfxCtx, 3 * sizeof(Vtx)); - ASSERT(vtxTbl != NULL); + assert(vtxTbl != NULL); vtxTbl[0].n.ob[0] = vA->x; vtxTbl[0].n.ob[1] = vA->y; @@ -453,7 +454,7 @@ s32 Collider_SetJntSph(PlayState* play, ColliderJntSph* dest, Actor* actor, Coll Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; - ASSERT(dest->elements != NULL); + assert(dest->elements != NULL); for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { @@ -790,7 +791,7 @@ s32 Collider_SetTris(PlayState* play, ColliderTris* dest, Actor* actor, Collider Collider_SetBase(play, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; - ASSERT(dest->elements != NULL); + assert(dest->elements != NULL); for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { @@ -1185,7 +1186,7 @@ s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Coll if (FrameAdvance_IsEnabled(play) == true) { return -1; } - ASSERT(collider->shape <= COLSHAPE_QUAD); + assert(collider->shape <= COLSHAPE_QUAD); sATResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1210,7 +1211,7 @@ s32 CollisionCheck_SetAT(PlayState* play, CollisionCheckContext* colChkCtx, Coll */ s32 CollisionCheck_SetAT_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { - ASSERT(collider->shape <= COLSHAPE_QUAD); + assert(collider->shape <= COLSHAPE_QUAD); if (GameInteractor_SecondCollisionUpdate()) { return -1; @@ -1264,7 +1265,7 @@ s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Coll if (FrameAdvance_IsEnabled(play) == true) { return -1; } - ASSERT(collider->shape <= COLSHAPE_QUAD); + assert(collider->shape <= COLSHAPE_QUAD); sACResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1289,7 +1290,7 @@ s32 CollisionCheck_SetAC(PlayState* play, CollisionCheckContext* colChkCtx, Coll */ s32 CollisionCheck_SetAC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { - ASSERT(collider->shape <= COLSHAPE_QUAD); + assert(collider->shape <= COLSHAPE_QUAD); if (GameInteractor_SecondCollisionUpdate()) { return -1; @@ -1344,7 +1345,7 @@ s32 CollisionCheck_SetOC(PlayState* play, CollisionCheckContext* colChkCtx, Coll return -1; } - ASSERT(collider->shape <= COLSHAPE_QUAD); + assert(collider->shape <= COLSHAPE_QUAD); sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { @@ -1379,7 +1380,7 @@ s32 CollisionCheck_SetOC_SAC(PlayState* play, CollisionCheckContext* colChkCtx, return -1; } - ASSERT(collider->shape <= COLSHAPE_QUAD); + assert(collider->shape <= COLSHAPE_QUAD); sOCResetFuncs[collider->shape](play, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -3022,7 +3023,7 @@ void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colChkCt return; } - ASSERT(info->acHitInfo != NULL); + assert(info->acHitInfo != NULL); tbl = collider->actor->colChkInfo.damageTable; if (tbl == NULL) { damage = (f32)info->acHitInfo->toucher.damage - info->bumper.defense; diff --git a/soh/src/code/z_construct.c b/soh/src/code/z_construct.c index 1aae3fcf8..b95902cc5 100644 --- a/soh/src/code/z_construct.c +++ b/soh/src/code/z_construct.c @@ -1,5 +1,6 @@ #include "global.h" #include +#include void func_80110990(PlayState* play) { Map_Destroy(play); @@ -37,7 +38,7 @@ void func_801109B0(PlayState* play) { osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment); - ASSERT(interfaceCtx->parameterSegment != NULL); + assert(interfaceCtx->parameterSegment != NULL); DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (uintptr_t)_parameter_staticSegmentRomStart, parameterSize, __FILE__, 162); @@ -46,7 +47,7 @@ void func_801109B0(PlayState* play) { osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480); // "DO Action Texture Initialization" osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->doActionSegment); - ASSERT(interfaceCtx->doActionSegment != NULL); + assert(interfaceCtx->doActionSegment != NULL); interfaceCtx->doActionSegment[0] = gAttackDoActionENGTex; interfaceCtx->doActionSegment[1] = gCheckDoActionENGTex; @@ -59,7 +60,7 @@ void func_801109B0(PlayState* play) { osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000); osSyncPrintf("parameter->icon_itemSegment=%x\n", interfaceCtx->iconItemSegment); - ASSERT(interfaceCtx->iconItemSegment != NULL); + assert(interfaceCtx->iconItemSegment != NULL); osSyncPrintf("Register_Item[%x, %x, %x, %x]\n", gSaveContext.equips.buttonItems[0], gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2], @@ -154,7 +155,7 @@ void Message_Init(PlayState* play) { osSyncPrintf("message->fukidashiSegment=%x\n", msgCtx->textboxSegment); osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200); // "Textbox game_alloc=%x" - ASSERT(msgCtx->textboxSegment != NULL); + assert(msgCtx->textboxSegment != NULL); Font_LoadOrderedFont(&play->msgCtx.font); diff --git a/soh/src/code/z_eff_blure.c b/soh/src/code/z_eff_blure.c index 454525868..91ac43766 100644 --- a/soh/src/code/z_eff_blure.c +++ b/soh/src/code/z_eff_blure.c @@ -2,6 +2,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "soh/frame_interpolation.h" +#include void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { EffectBlureElement* elem; @@ -618,7 +619,7 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem Vec3f sp118; Vec3f sp10C; - ASSERT(index - 1 >= 0); + assert(index - 1 >= 0); ratio = (f32)(elem - 1)->timer / (f32)this->elemDuration; EffectBlure_GetComputedValues(this, index - 1, ratio, &sp1EC, &sp1E4, &sp1DC, &sp1D8); @@ -638,7 +639,7 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem Vec3f sp100; Vec3f spF4; - ASSERT(index + 2 < this->numElements); + assert(index + 2 < this->numElements); ratio = (f32)(elem + 2)->timer / (f32)this->elemDuration; EffectBlure_GetComputedValues(this, index + 2, ratio, &sp1EC, &sp1E4, &sp1DC, &sp1D8); diff --git a/soh/src/code/z_effect_soft_sprite.c b/soh/src/code/z_effect_soft_sprite.c index 96c4c7b7f..ee6c7e951 100644 --- a/soh/src/code/z_effect_soft_sprite.c +++ b/soh/src/code/z_effect_soft_sprite.c @@ -2,6 +2,7 @@ #include "vt.h" #include "soh/frame_interpolation.h" +#include EffectSsInfo sEffectSsInfo = { 0 }; // "EffectSS2Info" @@ -18,7 +19,7 @@ void EffectSs_InitInfo(PlayState* play, s32 tableSize) { sEffectSsInfo.table = GAMESTATE_ALLOC_MC(&play->state, tableSize * sizeof(EffectSs)); - ASSERT(sEffectSsInfo.table != NULL); + assert(sEffectSsInfo.table != NULL); sEffectSsInfo.searchStartIndex = 0; sEffectSsInfo.tableSize = tableSize; @@ -175,7 +176,7 @@ void EffectSs_Spawn(PlayState* play, s32 type, s32 priority, void* initParams) { overlayEntry = &gEffectSsOverlayTable[type]; - ASSERT(type < EFFECT_SS_TYPE_MAX); + assert(type < EFFECT_SS_TYPE_MAX); if (EffectSs_FindSlot(priority, &index) != 0) { // Abort because we couldn't find a suitable slot to add this effect in diff --git a/soh/src/code/z_elf_message.c b/soh/src/code/z_elf_message.c index ea1f504a8..c2587f8f6 100644 --- a/soh/src/code/z_elf_message.c +++ b/soh/src/code/z_elf_message.c @@ -1,5 +1,6 @@ #include "global.h" #include "z64elf_message.h" +#include ElfMessage sChildSariaMsgs[] = { ELF_MSG_STRENGTH_UPG(SKIP, 3, false, 0), @@ -59,7 +60,7 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) { } LOG_STRING("企画外 条件"); // "Unplanned conditions" - ASSERT(0); + assert(0); return false; } @@ -142,7 +143,7 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) { return msg->byte2 | 0x100; default: LOG_STRING("企画外 条件"); // "Unplanned conditions" - ASSERT(0); + assert(0); } msg++; } diff --git a/soh/src/code/z_fcurve_data_skelanime.c b/soh/src/code/z_fcurve_data_skelanime.c index a0eeace16..c75450be2 100644 --- a/soh/src/code/z_fcurve_data_skelanime.c +++ b/soh/src/code/z_fcurve_data_skelanime.c @@ -1,4 +1,5 @@ #include "global.h" +#include void SkelCurve_Clear(SkelAnimeCurve* skelCurve) { skelCurve->limbCount = 0; @@ -24,7 +25,7 @@ s32 SkelCurve_Init(PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList skelCurve->limbList = SEGMENTED_TO_VIRTUAL(limbList->limbs); skelCurve->transforms = ZELDA_ARENA_MALLOC_DEBUG(sizeof(*skelCurve->transforms) * skelCurve->limbCount); - ASSERT(skelCurve->transforms != NULL); + assert(skelCurve->transforms != NULL); skelCurve->animCurFrame = 0.0f; return 1; } diff --git a/soh/src/code/z_horse.c b/soh/src/code/z_horse.c index 2c51ff296..f8e0f4b53 100644 --- a/soh/src/code/z_horse.c +++ b/soh/src/code/z_horse.c @@ -1,5 +1,6 @@ #include "global.h" #include "vt.h" +#include s32 func_8006CFC0(s32 scene) { s32 validScenes[] = { SCENE_SPOT00, SCENE_SPOT06, SCENE_SPOT09, SCENE_SPOT12, SCENE_SPOT20 }; @@ -52,7 +53,7 @@ void func_8006D0EC(PlayState* play, Player* player) { player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x, player->actor.shape.rot.y, player->actor.shape.rot.z, 9, true); - ASSERT(player->rideActor != NULL); + assert(player->rideActor != NULL); Actor_MountHorse(play, player, player->rideActor); func_8002DE74(play, player); @@ -70,7 +71,7 @@ void func_8006D0EC(PlayState* play, Player* player) { } else if ((gSaveContext.entranceIndex == 1230) && (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED))) { Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1, true); - ASSERT(horseActor != NULL); + assert(horseActor != NULL); } else if ((play->sceneNum == gSaveContext.horseData.scene) && (((Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) != 0) && (!gSaveContext.n64ddFlag || (gSaveContext.n64ddFlag && CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && @@ -83,7 +84,7 @@ void func_8006D0EC(PlayState* play, Player* player) { Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x, gSaveContext.horseData.pos.y, gSaveContext.horseData.pos.z, 0, gSaveContext.horseData.angle, 0, 1, true); - ASSERT(horseActor != NULL); + assert(horseActor != NULL); if (play->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } @@ -97,7 +98,7 @@ void func_8006D0EC(PlayState* play, Player* player) { } else if ((play->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) { Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1, true); - ASSERT(horseActor != NULL); + assert(horseActor != NULL); } else if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) { for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) { HorseSpawn* horseSpawn = &horseSpawns[i]; @@ -105,7 +106,7 @@ void func_8006D0EC(PlayState* play, Player* player) { Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y, horseSpawn->pos.z, 0, horseSpawn->angle, 0, horseSpawn->type, true); - ASSERT(horseActor != NULL); + assert(horseActor != NULL); if (play->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } @@ -155,7 +156,7 @@ void func_8006D684(PlayState* play, Player* player) { player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, spawnPos.z, 0, player->actor.world.rot.y, 0, 7, true); - ASSERT(player->rideActor != NULL); + assert(player->rideActor != NULL); Actor_MountHorse(play, player, player->rideActor); func_8002DE74(play, player); @@ -164,7 +165,7 @@ void func_8006D684(PlayState* play, Player* player) { (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) == 0) && (DREG(1) == 0)) { player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5, true); - ASSERT(player->rideActor != NULL); + assert(player->rideActor != NULL); Actor_MountHorse(play, player, player->rideActor); func_8002DE74(play, player); @@ -194,7 +195,7 @@ void func_8006D684(PlayState* play, Player* player) { player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, player->actor.world.rot.y, 0, D_8011F9B8[i].type, true); - ASSERT(player->rideActor != NULL); + assert(player->rideActor != NULL); Actor_MountHorse(play, player, player->rideActor); func_8002DE74(play, player); @@ -209,7 +210,7 @@ void func_8006D684(PlayState* play, Player* player) { player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp, true); - ASSERT(player->rideActor != NULL); + assert(player->rideActor != NULL); player->actor.world.pos.x = D_8011F9B8[i].pos.x; player->actor.world.pos.y = D_8011F9B8[i].pos.y; diff --git a/soh/src/code/z_jpeg.c b/soh/src/code/z_jpeg.c index 79fe1ed46..a812ef73b 100644 --- a/soh/src/code/z_jpeg.c +++ b/soh/src/code/z_jpeg.c @@ -1,5 +1,6 @@ #include "global.h" #include "vt.h" +#include #define MARKER_ESCAPE 0x00 #define MARKER_SOI 0xD8 @@ -250,7 +251,7 @@ s32 Jpeg_Decode(void* data, void* zbuffer, void* work, u32 workSize) { time = osGetTime(); // (?) I guess MB_SIZE=0x180, PROC_OF_MBS=5 which means data is not a part of JpegWork - ASSERT(workSize >= sizeof(JpegWork)); + assert(workSize >= sizeof(JpegWork)); osCreateMesgQueue(&ctx.mq, &ctx.msg, 1); MsgEvent_SendNullTask(); diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index 70fcc3552..5835cb399 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -214,6 +214,11 @@ LightInfo sSGameOverLightInfo; u8 sGameOverLightsIntensity; u16 D_8015FDB0; +void LoadSkyboxPalette(SkyboxContext* skyboxCtx, int paletteIndex, char* palTex, int width, + int height); +void LoadSkyboxTex(SkyboxContext* skyboxCtx, int segmentIndex, int imageIndex, char* tex, int width, int height, int offsetW, int offsetH); +void Skybox_Update(SkyboxContext* skyboxCtx); + s32 func_8006F0A0(s32 a0) { s32 ret = ((a0 >> 4 & 0x7FF) << D_8011FAF0[a0 >> 15 & 7].unk_00) + D_8011FAF0[a0 >> 15 & 7].unk_04; diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index 7d619676b..49cbdfdf5 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -4,6 +4,7 @@ #include "textures/parameter_static/parameter_static.h" #include "textures/map_i_static/map_i_static.h" #include "textures/map_grand_static/map_grand_static.h" +#include MapData* gMapData; @@ -527,7 +528,7 @@ void Map_Init(PlayState* play) { // "MAP texture initialization scene_data_ID=%d mapSegment=%x" osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", play->sceneNum, interfaceCtx->mapSegment, play); - ASSERT(interfaceCtx->mapSegment != NULL); + assert(interfaceCtx->mapSegment != NULL); switch (play->sceneNum) { case SCENE_SPOT00: diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index cf8759a23..327e85df2 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -8,6 +8,8 @@ #include "textures/message_static/message_static.h" #include "textures/message_texture_static/message_texture_static.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/OTRGlobals.h" s16 sTextFade = false; // original name: key_off_flag ? diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 6ea4874f3..3895cb3a9 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -6,6 +6,7 @@ #include "soh_assets.h" #include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" + #include "libultraship/bridge.h" #include "soh/Enhancements/gameplaystats.h" #include "soh/Enhancements/boss-rush/BossRushTypes.h" @@ -13,15 +14,13 @@ #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/enhancementTypes.h" -#ifdef _MSC_VER -#include #include +#include #include -#endif #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" - +#include "soh/Enhancements/randomizer/randomizer_grotto.h" #define DO_ACTION_TEX_WIDTH() 48 #define DO_ACTION_TEX_HEIGHT() 16 diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 4cece3fa7..352ae03cd 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -10,10 +10,12 @@ #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include #include "soh/Enhancements/enhancementTypes.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include #include +#include void* D_8012D1F0 = NULL; //UNK_TYPE D_8012D1F4 = 0; // unused @@ -33,12 +35,17 @@ PlayState* gPlayState; s16 gEnPartnerId; +void OTRPlay_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn); + +void enableBetaQuest(); +void disableBetaQuest(); + void func_800BC450(PlayState* play) { Camera_ChangeDataIdx(GET_ACTIVE_CAM(play), play->unk_1242B - 1); } void func_800BC490(PlayState* play, s16 point) { - ASSERT(point == 1 || point == 2); + assert(point == 1 || point == 2); play->unk_1242B = point; diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 8048a6097..ed9b359e1 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -8,6 +8,8 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" +#include + typedef struct { /* 0x00 */ u8 flag; /* 0x02 */ u16 textId; @@ -1712,6 +1714,7 @@ s32 func_80091880(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s } #include +void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play); void Pause_DrawTriforceSpot(PlayState* play, s32 showLightColumn) { static DemoEffect triforce; diff --git a/soh/src/code/z_rcp.c b/soh/src/code/z_rcp.c index d74bd8975..adfa946e7 100644 --- a/soh/src/code/z_rcp.c +++ b/soh/src/code/z_rcp.c @@ -1,4 +1,5 @@ #include "global.h" +#include Gfx sSetupDL[SETUPDL_MAX][6] = { { @@ -852,7 +853,7 @@ Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far) { far++; } - ASSERT(near != far); + assert(near != far); gDPSetFogColor(gfx++, r, g, b, a); @@ -873,7 +874,7 @@ Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far) if (far == near) { far++; } - ASSERT(near != far); + assert(near != far); gDPPipeSync(gfx++); gDPSetFogColor(gfx++, r, g, b, a); diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 17b2feb82..7c4001f95 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -5,6 +5,8 @@ #include "global.h" #include "vt.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include +#include void func_80095AB4(PlayState* play, Room* room, u32 flags); void func_80095D04(PlayState* play, Room* room, u32 flags); @@ -27,6 +29,9 @@ Gfx D_801270B0[] = { gsSPEndDisplayList(), }; +s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum); +s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx); + void (*sRoomDrawHandlers[])(PlayState* play, Room* room, u32 flags) = { func_80095AB4, func_80096F6C, @@ -122,7 +127,7 @@ void func_80095D04(PlayState* play, Room* room, u32 flags) { polygonDlist = SEGMENTED_TO_VIRTUAL(polygon2->start); spA4 = spB8; - ASSERT(polygon2->num <= SHAPE_SORT_MAX); + assert(polygon2->num <= SHAPE_SORT_MAX); sp78 = polygonDlist; for (sp9C = 0; sp9C < polygon2->num; sp9C++, polygonDlist++) { @@ -586,7 +591,7 @@ s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - ASSERT(roomNum < play->numRooms); + assert(roomNum < play->numRooms); size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart; roomCtx->unk_34 = (void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); @@ -629,7 +634,7 @@ void Room_Draw(PlayState* play, Room* room, u32 flags) { if (room->segment != NULL) { gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); - ASSERT(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers)); + assert(room->meshHeader->base.type < ARRAY_COUNTU(sRoomDrawHandlers)); sRoomDrawHandlers[room->meshHeader->base.type](play, room, flags); } } diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index 63529e199..f5c00ada3 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -1,6 +1,7 @@ #include "global.h" #include "vt.h" #include "soh/ActorDB.h" +#include RomFile sNaviMsgFiles[]; @@ -15,7 +16,7 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) { osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (uintptr_t)objectCtx->status[objectCtx->num].segment + size, objectCtx->spaceEnd); - ASSERT(((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) && + assert(((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) && (((uintptr_t)objectCtx->status[objectCtx->num].segment + size) < (uintptr_t)objectCtx->spaceEnd))); DmaMgr_SendRequest1(objectCtx->status[objectCtx->num].segment, gObjectTable[objectId].vromStart, size, @@ -153,7 +154,7 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) { nextPtr = (void*)ALIGN16((uintptr_t)status->segment + size); - ASSERT(nextPtr < objectCtx->spaceEnd); + assert(nextPtr < objectCtx->spaceEnd); // "Object exchange free size=%08x" osSyncPrintf("オブジェクト入れ替え空きサイズ=%08x\n", (uintptr_t)objectCtx->spaceEnd - (uintptr_t)nextPtr); @@ -284,7 +285,7 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) { status++; } - ASSERT(cmd->objectList.num <= OBJECT_EXCHANGE_BANK_MAX); + assert(cmd->objectList.num <= OBJECT_EXCHANGE_BANK_MAX); while (k < cmd->objectList.num) { nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry); diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index 908a83bcf..5b687e97c 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -1,5 +1,8 @@ #include "global.h" #include "vt.h" +#include +#include +#include #define ANIM_INTERP 1 @@ -865,7 +868,7 @@ void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animati char animPath[2048]; - sprintf(animPath, "misc/link_animetion/gPlayerAnimData_%06X", (((uintptr_t)linkAnimHeader->segment - 0x07000000))); + snprintf(animPath, sizeof(animPath), "misc/link_animetion/gPlayerAnimData_%06X", (((uintptr_t)linkAnimHeader->segment - 0x07000000))); //printf("Streaming %s, seg = %08X\n", animPath, linkAnimHeader->segment); @@ -1108,7 +1111,7 @@ void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeade skelAnime->jointTable = ZELDA_ARENA_MALLOC_DEBUG(allocSize); skelAnime->morphTable = ZELDA_ARENA_MALLOC_DEBUG(allocSize); } else { - ASSERT(limbBufCount == limbCount); + assert(limbBufCount == limbCount); skelAnime->jointTable = (Vec3s*)ALIGN16((uintptr_t)jointTable); skelAnime->morphTable = (Vec3s*)ALIGN16((uintptr_t)morphTable); @@ -1441,7 +1444,7 @@ s32 SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skelet skelAnime->morphTable = ZELDA_ARENA_MALLOC_DEBUG(skelAnime->limbCount * sizeof(*skelAnime->morphTable)); } else { - ASSERT(limbCount == skelAnime->limbCount); + assert(limbCount == skelAnime->limbCount); skelAnime->jointTable = jointTable; skelAnime->morphTable = morphTable; } @@ -1477,7 +1480,7 @@ s32 SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader skelAnime->morphTable = ZELDA_ARENA_MALLOC_DEBUG(skelAnime->limbCount * sizeof(*skelAnime->morphTable)); } else { - ASSERT(limbCount == skelAnime->limbCount); + assert(limbCount == skelAnime->limbCount); skelAnime->jointTable = jointTable; skelAnime->morphTable = morphTable; } diff --git a/soh/src/code/z_skin_awb.c b/soh/src/code/z_skin_awb.c index eea1967a9..d0ebe75b4 100644 --- a/soh/src/code/z_skin_awb.c +++ b/soh/src/code/z_skin_awb.c @@ -1,5 +1,6 @@ #include "global.h" #include "overlays/actors/ovl_En_fHG/z_en_fhg.h" +#include /** * Initialises the Vtx buffers used for limb at index `limbIndex` @@ -53,7 +54,7 @@ void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, Anim skin->vtxTable = ZELDA_ARENA_MALLOC_DEBUG(limbCount * sizeof(SkinLimbVtx)); - ASSERT(skin->vtxTable != NULL); + assert(skin->vtxTable != NULL); for (i = 0; i < limbCount; i++) { SkinLimbVtx* vtxEntry = &skin->vtxTable[i]; @@ -71,11 +72,11 @@ void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, Anim vtxEntry->buf[0] = ZELDA_ARENA_MALLOC_DEBUG(animatedLimbData->totalVtxCount * sizeof(Vtx)); - ASSERT(vtxEntry->buf[0] != NULL); + assert(vtxEntry->buf[0] != NULL); vtxEntry->buf[1] = ZELDA_ARENA_MALLOC_DEBUG(animatedLimbData->totalVtxCount * sizeof(Vtx)); - ASSERT(vtxEntry->buf[1] != NULL); + assert(vtxEntry->buf[1] != NULL); Skin_InitAnimatedLimb(play, skin, i); } diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index b531bb05d..7e22f8989 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -8,6 +8,8 @@ #define NUM_DUNGEONS 8 #define NUM_COWS 10 +void Save_LoadFile(void); + /** * Initialize new save. * This save has an empty inventory with 3 hearts and single magic. diff --git a/soh/src/code/z_view.c b/soh/src/code/z_view.c index 6ea62941c..42e4bcce7 100644 --- a/soh/src/code/z_view.c +++ b/soh/src/code/z_view.c @@ -3,6 +3,7 @@ #include #include +#include #include "soh/frame_interpolation.h" @@ -176,10 +177,10 @@ void func_800AA550(View* view) { lrx = view->viewport.rightX - varX; lry = view->viewport.bottomY - varY; - ASSERT(ulx >= 0); - ASSERT(uly >= 0); - ASSERT(lrx <= SCREEN_WIDTH); - ASSERT(lry <= SCREEN_HEIGHT); + assert(ulx >= 0); + assert(uly >= 0); + assert(lrx <= SCREEN_WIDTH); + assert(lry <= SCREEN_HEIGHT); OPEN_DISPS(gfxCtx); diff --git a/soh/src/code/z_vismono.c b/soh/src/code/z_vismono.c index 8b01a8f8c..c277eb971 100644 --- a/soh/src/code/z_vismono.c +++ b/soh/src/code/z_vismono.c @@ -1,5 +1,6 @@ #include "global.h" #include +#include // (Note: 80 = SCREEN_HEIGHT/3, see VisMono_DrawTexture) // This may not have been kept up-to-date with the code, 1+1+1+80*(7+2+2+3)+1+1 makes more sense @@ -101,7 +102,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) { LOG_ADDRESS("mono_dl + (1+3+1+1+80*(7+2+2+3)+1)", monoDL + DLSIZE); LOG_ADDRESS("(1+3+1+1+80*(7+2+2+3)+1)", DLSIZE); } - ASSERT(glistpEnd <= monoDL + DLSIZE); + assert(glistpEnd <= monoDL + DLSIZE); } gDPPipeSync(gfx++); @@ -131,6 +132,6 @@ void VisMono_DrawOld(VisMono* this) { if (!this->monoDl) { this->monoDl = SYSTEM_ARENA_MALLOC_DEBUG(DLSIZE * sizeof(Gfx)); glistpEnd = VisMono_DrawTexture(this, this->monoDl); - ASSERT(glistpEnd <= this->monoDl + DLSIZE); + assert(glistpEnd <= this->monoDl + DLSIZE); } } diff --git a/soh/src/code/z_vr_box.c b/soh/src/code/z_vr_box.c index 457cad3db..b77c3d869 100644 --- a/soh/src/code/z_vr_box.c +++ b/soh/src/code/z_vr_box.c @@ -2,6 +2,7 @@ #include "vt.h" #include +#include #include "z64environment.h" #include "assets/textures/backgrounds/vr_ALVR_static.h" @@ -961,24 +962,24 @@ void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) { if (skyboxCtx->unk_140 != 0) { skyboxCtx->dListBuf = GAMESTATE_ALLOC_MC(state, 8 * 150 * sizeof(Gfx)); - ASSERT(skyboxCtx->dListBuf != NULL); + assert(skyboxCtx->dListBuf != NULL); skyboxCtx->roomVtx = GAMESTATE_ALLOC_MC(state, 256 * sizeof(Vtx)); - ASSERT(skyboxCtx->roomVtx != NULL); + assert(skyboxCtx->roomVtx != NULL); func_800AEFC8(skyboxCtx, skyboxId); } else { skyboxCtx->dListBuf = GAMESTATE_ALLOC_MC(state, 12 * 150 * sizeof(Gfx)); - ASSERT(skyboxCtx->dListBuf != NULL); + assert(skyboxCtx->dListBuf != NULL); if (skyboxId == SKYBOX_CUTSCENE_MAP) { skyboxCtx->roomVtx = GAMESTATE_ALLOC_MC(state, 192 * sizeof(Vtx)); - ASSERT(skyboxCtx->roomVtx != NULL); + assert(skyboxCtx->roomVtx != NULL); func_800AF178(skyboxCtx, 6); } else { skyboxCtx->roomVtx = GAMESTATE_ALLOC_MC(state, 160 * sizeof(Vtx)); - ASSERT(skyboxCtx->roomVtx != NULL); + assert(skyboxCtx->roomVtx != NULL); func_800AF178(skyboxCtx, 5); } diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index 257847a7d..e10eb04be 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -6,6 +6,7 @@ #include "z_bg_gnd_iceblock.h" #include "objects/object_demo_kekkai/object_demo_kekkai.h" +#include #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED) @@ -64,7 +65,7 @@ void BgGndIceblock_Init(Actor* thisx, PlayState* play) { sBlockPositions[1] = 14; } else { LOG_FLOAT("thisx->world.position.x", this->dyna.actor.world.pos.x); - ASSERT(0); + assert(0); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 114705a1f..37402f22a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -28,6 +28,8 @@ void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, PlayState* play); void BgMoriHineri_DoNothing(BgMoriHineri* this, PlayState* play); void func_808A3D58(BgMoriHineri* this, PlayState* play); +s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); + s16 sBgMoriHineriNextCamIdx = SUBCAM_NONE; const ActorInit Bg_Mori_Hineri_InitVars = { diff --git a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index eb96e3614..42f946b53 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -48,6 +48,8 @@ void BgSpot06Objects_WaterPlaneCutsceneWait(BgSpot06Objects* this, PlayState* pl void BgSpot06Objects_WaterPlaneCutsceneRise(BgSpot06Objects* this, PlayState* play); void BgSpot06Objects_WaterPlaneCutsceneLower(BgSpot06Objects* this, PlayState* play); +s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); + const ActorInit Bg_Spot06_Objects_InitVars = { ACTOR_BG_SPOT06_OBJECTS, ACTORCAT_PROP, diff --git a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 48f127fab..4cc99fe0a 100644 --- a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -11,6 +11,7 @@ #include "objects/object_gnd_magic/object_gnd_magic.h" #include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h" #include "soh/frame_interpolation.h" +#include #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED @@ -87,7 +88,7 @@ void Demo6K_Init(Actor* thisx, PlayState* play) { osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { - ASSERT(objBankIndex < 0); + assert(objBankIndex < 0); } else { this->objBankIndex = objBankIndex; } @@ -174,7 +175,7 @@ void Demo6K_Init(Actor* thisx, PlayState* play) { this->unk_293 = params - 14; break; default: - ASSERT(0); + assert(0); break; } diff --git a/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 6e74bb338..e57b4ba8a 100644 --- a/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/soh/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -9,6 +9,7 @@ #include "objects/object_triforce_spot/object_triforce_spot.h" #include "objects/object_efc_tw/object_efc_tw.h" #include "objects/object_gi_jewel/object_gi_jewel.h" +#include #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED) @@ -199,7 +200,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectIndex); if (objectIndex < 0) { - ASSERT(objectIndex < 0); + assert(objectIndex < 0); } else { this->initObjectBankIndex = objectIndex; } @@ -509,7 +510,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { break; default: - ASSERT(0); + assert(0); break; } @@ -688,7 +689,7 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { s32 effectType = (this->actor.params & 0x00FF); if (!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { - ASSERT(!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)); + assert(!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)); } if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { diff --git a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index f4239a656..d7ef31618 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -4,6 +4,7 @@ #include "objects/object_efc_star_field/object_efc_star_field.h" #include "objects/object_toki_objects/object_toki_objects.h" #include "soh/frame_interpolation.h" +#include #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED) @@ -187,7 +188,7 @@ void DemoKankyo_Init(Actor* thisx, PlayState* play) { osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { - ASSERT(objBankIndex < 0); + assert(objBankIndex < 0); } else { this->objBankIndex = objBankIndex; } diff --git a/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index 068bb1799..b09048e47 100644 --- a/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/soh/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -1,6 +1,7 @@ #include "z_demo_tre_lgt.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" #include "objects/object_box/object_box.h" +#include #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED @@ -54,7 +55,7 @@ void DemoTreLgt_Init(Actor* thisx, PlayState* play) { osSyncPrintf("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n"); } - ASSERT(true); + assert(true); this->unk_170 = 255; this->unk_174 = 255; diff --git a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index c38bb6d34..d95c85b02 100644 --- a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -7,6 +7,7 @@ #include "z_door_ana.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include "soh/Enhancements/randomizer/randomizer_grotto.h" #define FLAGS ACTOR_FLAG_NO_FREEZE_OCARINA @@ -19,6 +20,9 @@ void DoorAna_WaitClosed(DoorAna* this, PlayState* play); void DoorAna_WaitOpen(DoorAna* this, PlayState* play); void DoorAna_GrabPlayer(DoorAna* this, PlayState* play); +s16 GetChestGameRandoGiDrawId(s8 room, s16 ogDrawId, PlayState* play); +void Grotto_OverrideActorEntrance(Actor* thisx); + const ActorInit Door_Ana_InitVars = { ACTOR_DOOR_ANA, ACTORCAT_ITEMACTION, diff --git a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 7df89937b..384df7fbf 100644 --- a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -8,6 +8,7 @@ #include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" +#include #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED) diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index 932d4a16d..d59c61de4 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -2,6 +2,7 @@ #include "objects/object_box/object_box.h" #include "soh_assets.h" #include "soh/Enhancements/enhancementTypes.h" +#include #define FLAGS 0 @@ -872,7 +873,7 @@ Gfx* EnBox_EmptyDList(GraphicsContext* gfxCtx) { Gfx* dList; dList = Graph_Alloc(gfxCtx, sizeof(Gfx)); - ASSERT(dList != NULL); + assert(dList != NULL); dListHead = dList; gSPEndDisplayList(dListHead++); @@ -886,7 +887,7 @@ Gfx* func_809CA4A0(GraphicsContext* gfxCtx) { Gfx* dListHead; dListHead = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx)); - ASSERT(dListHead != NULL); + assert(dListHead != NULL); dList = dListHead; gDPSetRenderMode(dListHead++, @@ -904,7 +905,7 @@ Gfx* func_809CA518(GraphicsContext* gfxCtx) { Gfx* dListHead; dListHead = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx)); - ASSERT(dListHead != NULL); + assert(dListHead != NULL); dList = dListHead; gDPSetRenderMode(dListHead++, diff --git a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c index a2825514c..1073dd484 100644 --- a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -6,6 +6,7 @@ #include "z_en_elf.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED | ACTOR_FLAG_NO_FREEZE_OCARINA) @@ -404,7 +405,7 @@ void EnElf_Init(Actor* thisx, PlayState* play) { } break; default: - ASSERT(0); + assert(0); break; } @@ -814,7 +815,7 @@ void func_80A03AB0(EnElf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->func_2C8 == NULL) { - ASSERT(this->func_2C8 == NULL); + assert(this->func_2C8 == NULL); } this->func_2C8(this, play); diff --git a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 1b66eb1fd..38c54471f 100644 --- a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -2,6 +2,7 @@ #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "vt.h" #include "objects/object_fr/object_fr.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_NO_FREEZE_OCARINA) @@ -227,7 +228,7 @@ void EnFr_Init(Actor* thisx, PlayState* play) { // "The argument is wrong!!" osSyncPrintf("%s[%d] : 引数が間違っている!!(%d)\n", __FILE__, __LINE__, this->actor.params); osSyncPrintf(VT_RST); - ASSERT((this->actor.params >= 6) || (this->actor.params < 0)); + assert((this->actor.params >= 6) || (this->actor.params < 0)); } this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); @@ -237,7 +238,7 @@ void EnFr_Init(Actor* thisx, PlayState* play) { // "There is no bank!!" osSyncPrintf("%s[%d] : バンクが無いよ!!\n", __FILE__, __LINE__); osSyncPrintf(VT_RST); - ASSERT(this->objBankIndex < 0); + assert(this->objBankIndex < 0); } } } diff --git a/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 9fd064f5a..f3b30c7d4 100644 --- a/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/soh/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -8,6 +8,7 @@ #include "vt.h" #include "objects/object_gla/object_gla.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) @@ -157,7 +158,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 6; break; default: - ASSERT(0); + assert(0); } this->stateFlags = 0; diff --git a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 01475f9ae..96d0c5ec3 100644 --- a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -7,6 +7,10 @@ #include "z_en_girla.h" #include "vt.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/OTRGlobals.h" +#include + #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) void EnGirlA_Init(Actor* thisx, PlayState* play); @@ -70,6 +74,8 @@ void EnGirlA_BuyEvent_GoronTunic(PlayState* play, EnGirlA* this); void EnGirlA_BuyEvent_ZoraTunic(PlayState* play, EnGirlA* this); void EnGirlA_BuyEvent_Randomizer(PlayState* play, EnGirlA* this); +s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); + const ActorInit En_GirlA_InitVars = { ACTOR_EN_GIRLA, ACTORCAT_PROP, @@ -406,7 +412,7 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("引数がおかしいよ(arg_data=%d)!!\n", this->actor.params); osSyncPrintf(VT_RST); - ASSERT((params >= SI_MAX) && (params < 0)); + assert((params >= SI_MAX) && (params < 0)); return; } @@ -435,7 +441,7 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) { osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("バンクが無いよ!!(%s)\n", sShopItemDescriptions[params]); osSyncPrintf(VT_RST); - ASSERT(this->objBankIndex < 0); + assert(this->objBankIndex < 0); return; } diff --git a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c index ef171a89a..dfbd02309 100644 --- a/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/soh/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -8,6 +8,7 @@ #include "objects/object_oF1d_map/object_oF1d_map.h" #include "objects/object_gm/object_gm.h" #include "vt.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) @@ -78,7 +79,7 @@ void EnGm_Init(Actor* thisx, PlayState* play) { // "There is no model bank! !! (Medi Goron)" osSyncPrintf("モデル バンクが無いよ!!(中ゴロン)\n"); osSyncPrintf(VT_RST); - ASSERT(this->objGmBankIndex < 0); + assert(this->objGmBankIndex < 0); } this->updateFunc = func_80A3D838; diff --git a/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 549b8d9e1..81c7ae38e 100644 --- a/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/soh/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -8,6 +8,7 @@ #include "objects/object_os_anime/object_os_anime.h" #include "objects/object_boj/object_boj.h" #include "vt.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) @@ -62,7 +63,7 @@ void EnGuest_Init(Actor* thisx, PlayState* play) { // "No such bank!!" osSyncPrintf("%s[%d] : バンクが無いよ!!\n", __FILE__, __LINE__); osSyncPrintf(VT_RST); - ASSERT(this->osAnimeBankIndex < 0); + assert(this->osAnimeBankIndex < 0); } } } diff --git a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 58efc9abb..c948a4335 100644 --- a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -9,6 +9,7 @@ #include "objects/object_horse/object_horse.h" #include "objects/object_hni/object_hni.h" #include "scenes/overworld/spot09/spot09_scene.h" +#include #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED @@ -869,8 +870,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_IN, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.shape.rot.x, this->actor.shape.rot.y, 1, 1, true); if (this->rider == NULL) { - //__assert("this->race.rider != NULL"); - ASSERT(this->rider == NULL); + assert(this->rider == NULL); } if (!(gSaveContext.eventInf[0] & 0x40)) { this->ingoHorseMaxSpeed = 12.07f; diff --git a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 75c0669fa..6ffe5478f 100644 --- a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -15,6 +15,7 @@ #include "objects/object_masterkokirihead/object_masterkokirihead.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) @@ -599,7 +600,7 @@ void EnOssan_Init(Actor* thisx, PlayState* play) { osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("引数がおかしいよ(arg_data=%d)!!\n", this->actor.params); osSyncPrintf(VT_RST); - ASSERT(this->actor.params > OSSAN_TYPE_MASK && this->actor.params < OSSAN_TYPE_KOKIRI); + assert(this->actor.params > OSSAN_TYPE_MASK && this->actor.params < OSSAN_TYPE_KOKIRI); return; } @@ -631,7 +632,7 @@ void EnOssan_Init(Actor* thisx, PlayState* play) { osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("バンクが無いよ!!(%s)\n", sShopkeeperPrintName[this->actor.params]); osSyncPrintf(VT_RST); - ASSERT(this->objBankIndex1 < 0); + assert(this->objBankIndex1 < 0); return; } @@ -640,7 +641,7 @@ void EnOssan_Init(Actor* thisx, PlayState* play) { osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("予備バンクが無いよ!!(%s)\n", sShopkeeperPrintName[this->actor.params]); osSyncPrintf(VT_RST); - ASSERT(EnOssan_TryGetObjBankIndexes(this, play, objectIds) == 0); + assert(EnOssan_TryGetObjBankIndexes(this, play, objectIds) == 0); return; } diff --git a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 22d490799..4d169a20f 100644 --- a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -9,6 +9,7 @@ #include "scenes/overworld/spot06/spot06_scene.h" #include "scenes/overworld/spot16/spot16_scene.h" #include "vt.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) @@ -989,7 +990,7 @@ void func_80ACC00C(EnOwl* this, PlayState* play) { this->actor.draw = NULL; break; default: - ASSERT(0); + assert(0); break; } diff --git a/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c b/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c index 16168d258..60e0e8b48 100644 --- a/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c +++ b/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c @@ -20,6 +20,10 @@ void EnPartner_Update(Actor* thisx, PlayState* play); void EnPartner_Draw(Actor* thisx, PlayState* play); void EnPartner_SpawnSparkles(EnPartner* this, PlayState* play, s32 sparkleLife); +void func_808328EC(Player* this, u16 sfxId); +void func_808429B4(PlayState* play, s32 speed, s32 y, s32 countdown); +s32 spawn_boomerang_ivan(EnPartner* this, PlayState* play); + static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 8, ICHAIN_STOP), }; diff --git a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c index bc5c7630e..19baa7332 100644 --- a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -7,6 +7,7 @@ #include "z_en_rr.h" #include "objects/object_rr/object_rr.h" #include "vt.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED | ACTOR_FLAG_DRAGGED_BY_HOOKSHOT) @@ -789,7 +790,7 @@ void EnRr_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (this->hasPlayer == 0x3F80) { // checks if 1.0f has been stored to hasPlayer's address - ASSERT(this->hasPlayer == 0x3F80); + assert(this->hasPlayer == 0x3F80); } Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f); diff --git a/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 6371a8983..59204c6ca 100644 --- a/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/soh/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -8,6 +8,7 @@ #include "z_en_sth.h" #include "objects/object_ahg/object_ahg.h" #include "objects/object_boj/object_boj.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) @@ -128,7 +129,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { osSyncPrintf("bank_ID = %d\n", objectBankIdx); if (objectBankIdx < 0) { - ASSERT(objectBankIdx < 0); + assert(objectBankIdx < 0); } this->objectBankIdx = objectBankIdx; this->drawFunc = EnSth_Draw; diff --git a/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c index f1de1cb0b..cfbee6604 100644 --- a/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/soh/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -6,6 +6,7 @@ #include "z_en_tr.h" #include "objects/object_tr/object_tr.h" +#include #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED @@ -114,7 +115,7 @@ void EnTr_Init(Actor* thisx, PlayState* play) { break; default: - ASSERT(0); + assert(0); break; } } diff --git a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c index 45f670613..20ec82e83 100644 --- a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -6,6 +6,7 @@ #include "z_en_vali.h" #include "objects/object_vali/object_vali.h" +#include #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_IGNORE_QUAKE) diff --git a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 7a3c76f4b..50d4225f7 100644 --- a/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/soh/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -15,6 +15,7 @@ #include "objects/object_ganon/object_ganon.h" #include "objects/object_opening_demo1/object_opening_demo1.h" #include "soh/frame_interpolation.h" +#include #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED @@ -170,10 +171,10 @@ void EnViewer_InitImpl(EnViewer* this, PlayState* play) { EnViewerInitData* initData = &sInitData[this->actor.params >> 8]; s32 skelObjBankIndex = Object_GetIndex(&play->objectCtx, initData->skeletonObject); - ASSERT(skelObjBankIndex >= 0); + assert(skelObjBankIndex >= 0); this->animObjBankIndex = Object_GetIndex(&play->objectCtx, initData->animObject); - ASSERT(this->animObjBankIndex >= 0); + assert(this->animObjBankIndex >= 0); if (!Object_IsLoaded(&play->objectCtx, skelObjBankIndex) || !Object_IsLoaded(&play->objectCtx, this->animObjBankIndex)) { diff --git a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index 06836b310..e7822399c 100644 --- a/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/soh/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -5,6 +5,7 @@ */ #include "z_item_etcetera.h" +#include #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED @@ -21,7 +22,6 @@ void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, PlayState* play); void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, PlayState* play); void func_80B85B28(ItemEtcetera* this, PlayState* play); void ItemEtcetera_UpdateFireArrow(ItemEtcetera* this, PlayState* play); -GetItemEntry GetChestGameRandoGetItem(s8 room, s16 ogDrawId, PlayState* play); const ActorInit Item_Etcetera_InitVars = { ACTOR_ITEM_ETCETERA, @@ -69,7 +69,7 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) { objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[type]); osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { - ASSERT(objBankIndex < 0); + assert(objBankIndex < 0); } else { this->objBankIndex = objBankIndex; } diff --git a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 15c3be23f..1bd56fcce 100644 --- a/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/soh/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -10,6 +10,7 @@ #include "objects/object_spot02_objects/object_spot02_objects.h" #include "soh/frame_interpolation.h" +#include #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED | ACTOR_FLAG_NO_FREEZE_OCARINA) @@ -792,7 +793,7 @@ void ObjectKankyo_SunGraveSparkInit(ObjectKankyo* this, PlayState* play) { s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_SPOT02_OBJECTS); if (objBankIndex < 0) { - ASSERT(objBankIndex < 0); + assert(objBankIndex < 0); } else { this->requiredObjBankIndex = objBankIndex; } @@ -893,7 +894,7 @@ void ObjectKankyo_InitBeams(ObjectKankyo* this, PlayState* play) { s32 objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_DEMO_KEKKAI); if (objectIndex < 0) { - ASSERT(objectIndex < 0); + assert(objectIndex < 0); } else { this->requiredObjBankIndex = objectIndex; } diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index ac70e56ff..86a6854cf 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -26,6 +26,13 @@ #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include #include "soh/Enhancements/enhancementTypes.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/Enhancements/randomizer/randomizer_grotto.h" +#include "soh/frame_interpolation.h" + +#include +#include +#include typedef enum { /* 0x00 */ KNOB_ANIM_ADULT_L, @@ -1279,13 +1286,13 @@ static LinkAnimationHeader* D_808543D4[] = { }; // return type can't be void due to regalloc in func_8084FCAC -s32 func_80832210(Player* this) { +void func_80832210(Player* this) { this->actor.speedXZ = 0.0f; this->linearVelocity = 0.0f; } // return type can't be void due to regalloc in func_8083F72C -s32 func_80832224(Player* this) { +void func_80832224(Player* this) { func_80832210(this); this->unk_6AD = 0; } @@ -4986,7 +4993,7 @@ void func_8083AE40(Player* this, s16 objectId) { size = gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart; LOG_HEX("size", size); - ASSERT(size <= 1024 * 8); + assert(size <= 1024 * 8); DmaMgr_SendRequest2(&this->giObjectDmaRequest, (uintptr_t)this->giObjectSegment, gObjectTable[objectId].vromStart, size, 0, &this->giObjectLoadQueue, OS_MESG_PTR(NULL), diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 5a97863c2..d334b6dd2 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -14,9 +14,16 @@ #include "soh/Enhancements/boss-rush/BossRush.h" #include "soh/Enhancements/custom-message/CustomMessageTypes.h" #include "soh/Enhancements/enhancementTypes.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include + #define MIN_QUEST (ResourceMgr_GameHasOriginal() ? FS_QUEST_NORMAL : FS_QUEST_MASTER) #define MAX_QUEST FS_QUEST_BOSSRUSH + +void Sram_InitDebugSave(void); +void Sram_InitBossRushSave(); + u8 hasRandomizerQuest() { if (strnlen(CVarGetString("gSpoilerLog", ""), 1) != 0) { return 1; @@ -2870,12 +2877,12 @@ void FileChoose_Init(GameState* thisx) { osSyncPrintf("SIZE=%x\n", size); this->staticSegment = GAMESTATE_ALLOC_MC(&this->state, size); - ASSERT(this->staticSegment != NULL); + assert(this->staticSegment != NULL); DmaMgr_SendRequest1(this->staticSegment, (u32)_title_staticSegmentRomStart, size, __FILE__, __LINE__); size = (u32)_parameter_staticSegmentRomEnd - (u32)_parameter_staticSegmentRomStart; this->parameterSegment = GAMESTATE_ALLOC_MC(&this->state, size); - ASSERT(this->parameterSegment != NULL); + assert(this->parameterSegment != NULL); DmaMgr_SendRequest1(this->parameterSegment, (u32)_parameter_staticSegmentRomStart, size, __FILE__, __LINE__); diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index f502d3ce4..6f155e367 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -1,4 +1,5 @@ #include "file_choose.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" // when choosing a file to copy or erase, the 6 main menu buttons are placed at these offsets static s16 sChooseFileYOffsets[] = { -48, -48, -48, -24, -24, 0 }; diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c index 17d63fb0d..dba736f8e 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c @@ -1,6 +1,8 @@ #include "file_choose.h" #include "textures/title_static/title_static.h" #include "assets/overlays/ovl_File_Choose/ovl_file_choose.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + static s16 D_808124C0[] = { 0x0002, 0x0003, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0001, 0x0002, 0x0000, 0x0001, diff --git a/soh/src/overlays/gamestates/ovl_opening/z_opening.c b/soh/src/overlays/gamestates/ovl_opening/z_opening.c index a45e2db74..3ecd61fca 100644 --- a/soh/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/soh/src/overlays/gamestates/ovl_opening/z_opening.c @@ -6,6 +6,8 @@ #include "global.h" +void Sram_InitDebugSave(void); + void Opening_SetupTitleScreen(OpeningContext* this) { gSaveContext.gameMode = 1; this->state.running = false; diff --git a/soh/src/overlays/gamestates/ovl_select/z_select.c b/soh/src/overlays/gamestates/ovl_select/z_select.c index 05a0252c9..b4493854c 100644 --- a/soh/src/overlays/gamestates/ovl_select/z_select.c +++ b/soh/src/overlays/gamestates/ovl_select/z_select.c @@ -7,12 +7,13 @@ #include #include "global.h" #include "vt.h" -#include "alloca.h" #include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include "soh/Enhancements/randomizer/randomizer_grotto.h" void Select_SwitchBetterWarpMode(SelectContext* this, u8 isBetterWarpMode); +void Sram_InitDebugSave(void); void Select_LoadTitle(SelectContext* this) { this->state.running = false; @@ -1458,7 +1459,7 @@ void Better_Select_PrintMQSetting(SelectContext* this, GfxPrint* printer) { void Select_DrawMenu(SelectContext* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; - GfxPrint* printer; + GfxPrint printer; OPEN_DISPS(gfxCtx); @@ -1468,28 +1469,28 @@ void Select_DrawMenu(SelectContext* this) { func_800AAA50(&this->view, 0xF); Gfx_SetupDL_28Opa(gfxCtx); - printer = alloca(sizeof(GfxPrint)); - GfxPrint_Init(printer); - GfxPrint_Open(printer, POLY_OPA_DISP); + //printer = alloca(sizeof(GfxPrint)); + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, POLY_OPA_DISP); if (this->isBetterWarp) { - Better_Select_PrintTimeSetting(this, printer); - Better_Select_PrintAgeSetting(this, printer, ((void)0, gSaveContext.linkAge)); - Better_Select_PrintMQSetting(this, printer); - Better_Select_PrintMenu(this, printer); + Better_Select_PrintTimeSetting(this, &printer); + Better_Select_PrintAgeSetting(this, &printer, ((void)0, gSaveContext.linkAge)); + Better_Select_PrintMQSetting(this, &printer); + Better_Select_PrintMenu(this, &printer); } else { - Select_PrintMenu(this, printer); - Select_PrintAgeSetting(this, printer, ((void)0, gSaveContext.linkAge)); - Select_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.cutsceneIndex)); + Select_PrintMenu(this, &printer); + Select_PrintAgeSetting(this, &printer, ((void)0, gSaveContext.linkAge)); + Select_PrintCutsceneSetting(this, &printer, ((void)0, gSaveContext.cutsceneIndex)); } - POLY_OPA_DISP = GfxPrint_Close(printer); - GfxPrint_Destroy(printer); + POLY_OPA_DISP = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); CLOSE_DISPS(gfxCtx); } void Select_DrawLoadingScreen(SelectContext* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; - GfxPrint* printer; + GfxPrint printer; OPEN_DISPS(gfxCtx); @@ -1499,12 +1500,12 @@ void Select_DrawLoadingScreen(SelectContext* this) { func_800AAA50(&this->view, 0xF); Gfx_SetupDL_28Opa(gfxCtx); - printer = alloca(sizeof(GfxPrint)); - GfxPrint_Init(printer); - GfxPrint_Open(printer, POLY_OPA_DISP); - Select_PrintLoadingMessage(this, printer); - POLY_OPA_DISP = GfxPrint_Close(printer); - GfxPrint_Destroy(printer); + //printer = alloca(sizeof(GfxPrint)); + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, POLY_OPA_DISP); + Select_PrintLoadingMessage(this, &printer); + POLY_OPA_DISP = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); CLOSE_DISPS(gfxCtx); } @@ -1589,7 +1590,6 @@ void Select_SwitchBetterWarpMode(SelectContext* this, u8 isBetterWarpMode) { void Select_Init(GameState* thisx) { SelectContext* this = (SelectContext*)thisx; size_t size; - s32 pad; this->state.main = Select_Main; this->state.destroy = Select_Destroy; diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index 2ba99231a..d123e7e90 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -273,7 +273,6 @@ void Title_Init(GameState* thisx) { this->staticSegment = NULL; //this->staticSegment = GAMESTATE_ALLOC_MC(&this->state, size); osSyncPrintf("z_title.c\n"); - //ASSERT(this->staticSegment != NULL); //ResourceMgr_LoadDirectory("nintendo_rogo_static*"); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index c1f17f177..4b8a80f9e 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -1,5 +1,6 @@ #include "z_kaleido_scope.h" #include +#include #include "textures/item_name_static/item_name_static.h" #include "textures/icon_item_static/icon_item_static.h" @@ -16,7 +17,10 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include "soh/Enhancements/randomizer/randomizer_grotto.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + static void* sEquipmentFRATexs[] = { gPauseEquipment00FRATex, gPauseEquipment01Tex, gPauseEquipment02Tex, gPauseEquipment03Tex, gPauseEquipment04Tex,