diff --git a/Makefile b/Makefile index 32ad427f46..b0553fd47d 100644 --- a/Makefile +++ b/Makefile @@ -238,7 +238,7 @@ $(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/__osMalloc.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/code_800FC620.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/code_800FCE80.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/code_800FD970.o: OPTFLAGS := -O2 +$(BUILD_DIR)/src/code/rand.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/gfxprint.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2 diff --git a/README.md b/README.md index 8e9b44817b..0e3e1bd13d 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ cd oot #### 3. Prepare a base ROM Place a copy of the Master Quest (Debug) ROM inside the `baseroms/gc-eu-mq-dbg/` folder. +If you are under WSL, you can run the command `explorer.exe .` to open the current directory in the Windows file explorer. Rename the file to `baserom.z64`, `baserom.n64` or `baserom.v64`, depending on the original extension. @@ -115,7 +116,7 @@ make setup ``` This downloads some dependencies (from pip), and compiles tools for the build process. -Then it generates a new ROM "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64" that will have the overdump removed and the header patched. +Then it generates a new ROM `baseroms/gc-eu-mq-dbg/baserom-decompressed.z64` that will have the overdump removed and the header patched. It will also extract the individual assets from the ROM. #### 5. Build the ROM diff --git a/data/fault_drawer.bss.s b/data/fault_drawer.bss.s index 0c64984b33..89a29d8bb4 100644 --- a/data/fault_drawer.bss.s +++ b/data/fault_drawer.bss.s @@ -13,6 +13,7 @@ glabel sFaultDrawer .space 0x3C + .space 0x04 # padding -glabel D_8016B6BC - .space 0x24 +glabel D_8016B6C0 + .space 0x20 diff --git a/include/fault.h b/include/fault.h index 778f708e9b..df125487e5 100644 --- a/include/fault.h +++ b/include/fault.h @@ -44,7 +44,7 @@ void Fault_Init(void); // Fatal Errors NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2); -NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line); +NORETURN void Fault_AddHungupAndCrash(const char* file, int line); // Client Registration diff --git a/include/functions.h b/include/functions.h index a7cf8c2eb8..9b3e0bf72c 100644 --- a/include/functions.h +++ b/include/functions.h @@ -39,7 +39,7 @@ void isPrintfInit(void); void rmonPrintf(const char* fmt, ...); #if OOT_DEBUG void* is_proutSyncPrintf(void* arg, const char* str, size_t count); -NORETURN void func_80002384(const char* exp, const char* file, u32 line); +NORETURN void func_80002384(const char* exp, const char* file, int line); #endif OSPiHandle* osDriveRomInit(void); void Mio0_Decompress(u8* src, u8* dst); @@ -51,11 +51,11 @@ u32 StackCheck_CheckAll(void); u32 StackCheck_Check(StackEntry* entry); #if OOT_DEBUG void LogUtils_LogHexDump(void* ptr, s32 size0); -void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line); -void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s32 line); -void LogUtils_LogThreadId(const char* name, s32 line); +void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line); +void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line); +void LogUtils_LogThreadId(const char* name, int line); #endif -void LogUtils_HungupThread(const char* name, s32 line); +void LogUtils_HungupThread(const char* name, int line); void LogUtils_ResetHungup(void); void __osPiCreateAccessQueue(void); void __osPiGetAccess(void); @@ -913,10 +913,10 @@ void ZeldaArena_Cleanup(void); u8 ZeldaArena_IsInitialized(void); #if OOT_DEBUG void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); -void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line); -void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line); -void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line); -void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line); +void* ZeldaArena_MallocDebug(u32 size, const char* file, int line); +void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line); +void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void ZeldaArena_FreeDebug(void* ptr, const char* file, int line); void ZeldaArena_Display(void); #endif void MapMark_Init(PlayState* play); @@ -1316,8 +1316,8 @@ void GameState_Destroy(GameState* gameState); GameStateFunc GameState_GetInit(GameState* gameState); u32 GameState_IsRunning(GameState* gameState); #if OOT_DEBUG -void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line); -void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line); +void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line); +void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line); #endif void* GameAlloc_Malloc(GameAlloc* this, u32 size); void GameAlloc_Free(GameAlloc* this, void* data); @@ -1333,8 +1333,8 @@ void Graph_ThreadEntry(void*); void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size); void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size); #if OOT_DEBUG -void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); -void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); +void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line); +void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line); #endif Gfx* Gfx_Open(Gfx* gfx); Gfx* Gfx_Close(Gfx* gfx, Gfx* dst); @@ -1437,8 +1437,8 @@ void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation); void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot); Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest); #if OOT_DEBUG -Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line); -Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line); +Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line); +Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, const char* file, int line); #else Mtx* Matrix_ToMtx(Mtx* dest); Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx); @@ -1453,7 +1453,7 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag); void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag); void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode); #if OOT_DEBUG -MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line); +MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line); #endif void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, f32 translateZ); @@ -1476,10 +1476,10 @@ void DebugArena_Cleanup(void); u8 DebugArena_IsInitialized(void); #if OOT_DEBUG void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); -void* DebugArena_MallocDebug(u32 size, const char* file, s32 line); -void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line); -void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line); -void DebugArena_FreeDebug(void* ptr, const char* file, s32 line); +void* DebugArena_MallocDebug(u32 size, const char* file, int line); +void* DebugArena_MallocRDebug(u32 size, const char* file, int line); +void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void DebugArena_FreeDebug(void* ptr, const char* file, int line); void DebugArena_Display(void); #endif void UCodeDisas_Init(UCodeDisas*); @@ -1774,10 +1774,10 @@ void SystemArena_Init(void* start, u32 size); void SystemArena_Cleanup(void); u8 SystemArena_IsInitialized(void); #if OOT_DEBUG -void* SystemArena_MallocDebug(u32 size, const char* file, s32 line); -void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line); -void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line); -void SystemArena_FreeDebug(void* ptr, const char* file, s32 line); +void* SystemArena_MallocDebug(u32 size, const char* file, int line); +void* SystemArena_MallocRDebug(u32 size, const char* file, int line); +void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line); +void SystemArena_FreeDebug(void* ptr, const char* file, int line); void SystemArena_Display(void); #endif u32 Rand_Next(void); @@ -1799,10 +1799,10 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize); void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc); u32 __osCheckArena(Arena* arena); #if OOT_DEBUG -void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line); -void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line); -void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line); -void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line); +void* __osMallocDebug(Arena* arena, u32 size, const char* file, int line); +void* __osMallocRDebug(Arena* arena, u32 size, const char* file, int line); +void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line); +void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line); void __osDisplayArena(Arena* arena); #endif s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args); diff --git a/include/macros.h b/include/macros.h index b0a35844f4..97627d9b4c 100644 --- a/include/macros.h +++ b/include/macros.h @@ -114,7 +114,7 @@ // argument errors instead. // Note some tools define __sgi but preprocess with a modern cpp implementation, // ensure that these do not use the IDO workaround to avoid errors. -#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !PERMUTER && !M2CTX) +#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !M2CTX) #if OOT_DEBUG #define PRINTF osSyncPrintf diff --git a/include/terminal.h b/include/terminal.h index f4ed8d6103..99213b1792 100644 --- a/include/terminal.h +++ b/include/terminal.h @@ -28,12 +28,24 @@ #define VT_SGR(n) VT_ESC VT_CSI n "m" // Add more macros if necessary +#if OOT_DEBUG + #define VT_COL(back, fore) VT_SGR(VT_COLOR(BACKGROUND, back) ";" VT_COLOR(FOREGROUND, fore)) #define VT_FGCOL(color) VT_SGR(VT_COLOR(FOREGROUND, color)) #define VT_BGCOL(color) VT_SGR(VT_COLOR(BACKGROUND, color)) #define VT_RST VT_SGR("") #define VT_CLS VT_ED(2) +#else + +#define VT_COL(back, fore) "" +#define VT_FGCOL(color) "" +#define VT_BGCOL(color) "" +#define VT_RST "" +#define VT_CLS "" + +#endif + // ASCII BEL character, plays an alert tone #define BEL '\a' diff --git a/include/variables.h b/include/variables.h index f0fa2b9fe8..0c498046cd 100644 --- a/include/variables.h +++ b/include/variables.h @@ -143,13 +143,17 @@ extern u16 D_801333D0; extern Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; +#if OOT_DEBUG extern u8 D_801333F0; extern u8 gAudioSfxSwapOff; extern u8 D_801333F8; +#endif extern u8 gSeqCmdWritePos; extern u8 gSeqCmdReadPos; extern u8 gStartSeqDisabled; +#if OOT_DEBUG extern u8 gAudioDebugPrintSeqCmd; +#endif extern u8 gSoundModeList[]; extern u8 gAudioSpecId; extern u8 D_80133418; diff --git a/include/z64.h b/include/z64.h index 92ce7fb686..5175c15cd1 100644 --- a/include/z64.h +++ b/include/z64.h @@ -717,7 +717,7 @@ typedef struct ArenaNode { /* 0x0C */ struct ArenaNode* prev; #if OOT_DEBUG // TODO: This debug info is also present in N64 retail builds /* 0x10 */ const char* filename; - /* 0x14 */ s32 line; + /* 0x14 */ int line; /* 0x18 */ OSId threadId; /* 0x1C */ Arena* arena; /* 0x20 */ OSTime time; diff --git a/include/z64dma.h b/include/z64dma.h index fb9d03c720..e740fcba9e 100755 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -9,7 +9,7 @@ typedef struct { /* 0x04 */ void* dramAddr; // DRAM address (destination) /* 0x08 */ size_t size; // File Transfer size /* 0x0C */ const char* filename; // Filename for debugging - /* 0x10 */ s32 line; // Line for debugging + /* 0x10 */ int line; // Line number for debugging /* 0x14 */ s32 unk_14; /* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message /* 0x1C */ OSMesg notifyMsg; // Completion notification message @@ -48,8 +48,8 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, s32 DmaMgr_RequestSync(void* ram, uintptr_t vrom, size_t size); #if OOT_DEBUG s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, - OSMesg msg, const char* file, s32 line); -s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, s32 line); + OSMesg msg, const char* file, int line); +s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line); #endif // Special-purpose DMA Requests diff --git a/spec b/spec index df4a354ac3..ad24d44436 100644 --- a/spec +++ b/spec @@ -482,7 +482,7 @@ beginseg include "$(BUILD_DIR)/src/code/code_800FCE80.o" include "$(BUILD_DIR)/src/code/fp.o" include "$(BUILD_DIR)/src/code/system_malloc.o" - include "$(BUILD_DIR)/src/code/code_800FD970.o" + include "$(BUILD_DIR)/src/code/rand.o" include "$(BUILD_DIR)/src/code/__osMalloc.o" #if !OOT_DEBUG include "$(BUILD_DIR)/src/libultra/libc/sprintf.o" diff --git a/src/audio/data.c b/src/audio/data.c index 6a4c29eda7..1c84d5e704 100644 --- a/src/audio/data.c +++ b/src/audio/data.c @@ -44,18 +44,20 @@ s8 gSfxDefaultReverb = 0; s32 D_801333EC = 0; // unused +#if OOT_DEBUG u8 D_801333F0 = 0; - u8 gAudioSfxSwapOff = 0; - u8 D_801333F8 = 0; - s32 D_801333FC = 0; // unused +#endif u8 gSeqCmdWritePos = 0; u8 gSeqCmdReadPos = 0; u8 gStartSeqDisabled = false; + +#if OOT_DEBUG u8 gAudioDebugPrintSeqCmd = true; +#endif u8 gSoundModeList[] = { SOUNDMODE_STEREO, diff --git a/src/audio/general.c b/src/audio/general.c index a70a35823b..f261a5ae55 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -1212,8 +1212,10 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = { { 0, { 0 } }, }; +#if OOT_DEBUG u32 sAudioUpdateStartTime; u32 sAudioUpdateEndTime; +#endif f32 D_8016B7A8; f32 D_8016B7AC; f32 D_8016B7B0; @@ -1223,20 +1225,26 @@ FreqLerp sWaterfallFreqScaleLerp; f32 D_8016B7D8; s8 D_8016B7DC; f32 D_8016B7E0; +#if OOT_DEBUG u16 D_8016B7E4; struct { char str[5]; u16 num; } sAudioScrPrtBuf[SCROLL_PRINT_BUF_SIZE]; +#endif u8 sRiverSoundMainBgmVol; u8 sRiverSoundMainBgmCurrentVol; u8 sRiverSoundMainBgmLower; u8 sRiverSoundMainBgmRestore; u8 sGanonsTowerVol; SfxPlayerState sSfxChannelState[0x10]; +#if OOT_DEBUG char sBinToStrBuf[0x20]; +#endif u8 sMalonSingingTimer; +#if OOT_DEBUG u8 sAudioSpecPeakNumNotes[0x12]; +#endif u8 sMalonSingingDisabled; u8 D_8016B9F3; u8 sFanfareStartTimer; @@ -1264,8 +1272,10 @@ u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX]; u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX]; u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX]; OcarinaNote sScarecrowsLongSongSecondNote; +#if OOT_DEBUG u8 sIsMalonSinging; f32 sMalonSingingDist; +#endif void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest); diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 9f87874678..a11d8dc0ec 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -33,9 +33,12 @@ ActiveSfx gActiveSfx[7][3]; u8 sCurSfxPlayerChannelIndex; u8 gSfxBankMuted[7]; UnusedBankLerp sUnusedBankLerp[7]; + +#if OOT_DEBUG u16 gAudioSfxSwapSource[10]; u16 gAudioSfxSwapTarget[10]; u8 gAudioSfxSwapMode[10]; +#endif void Audio_SetSfxBanksMute(u16 muteMask) { u8 bankId; diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index b5d077212a..dc2cedc4b8 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -1,11 +1,11 @@ #include "global.h" -OSPiHandle* sISVHandle; // official name : is_Handle - #define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000) #define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) #if OOT_DEBUG +OSPiHandle* sISVHandle; // official name : is_Handle + void isPrintfInit(void) { sISVHandle = osCartRomInit(); osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, 0); @@ -95,7 +95,7 @@ void* is_proutSyncPrintf(void* arg, const char* str, size_t count) { return (void*)1; } -NORETURN void func_80002384(const char* exp, const char* file, u32 line) { +NORETURN void func_80002384(const char* exp, const char* file, int line) { osSyncPrintf("File:%s Line:%d %s \n", file, line, exp); while (true) { ; diff --git a/src/boot/logutils.c b/src/boot/logutils.c index 1015984820..68fcda21a4 100644 --- a/src/boot/logutils.c +++ b/src/boot/logutils.c @@ -2,7 +2,7 @@ #include "terminal.h" #if OOT_DEBUG -f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f32 value, const char* minName, f32 min, +f32 LogUtils_CheckFloatRange(const char* exp, int line, const char* valueName, f32 value, const char* minName, f32 min, const char* maxName, f32 max) { if (value < min || max < value) { PRINTF("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, line, minName, min, valueName, value, maxName, @@ -11,7 +11,7 @@ f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f return value; } -s32 LogUtils_CheckIntRange(const char* exp, s32 line, const char* valueName, s32 value, const char* minName, s32 min, +s32 LogUtils_CheckIntRange(const char* exp, int line, const char* valueName, s32 value, const char* minName, s32 min, const char* maxName, s32 max) { if (value < min || max < value) { PRINTF("%s %d: range error %s(%d) < %s(%d) < %s(%d)\n", exp, line, minName, min, valueName, value, maxName, @@ -73,11 +73,11 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) { } } -void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, s32 line) { +void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, int line) { PRINTF(VT_COL(RED, WHITE) "%s %d %s[%d] max=%u ptr=%08x\n" VT_RST, file, line, name, value, max, ptr); } -void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, s32 line) { +void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, int line) { u32 mask = (unk - 1); if (value & mask) { @@ -85,24 +85,24 @@ void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* fi } } -void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line) { +void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, int line) { if (ptr == NULL) { PRINTF(VT_COL(RED, WHITE) "%s %d:%s は はヌルポインタです\n" VT_RST, file, line, exp); } } -void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s32 line) { +void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, int line) { if (ptr == NULL || (u32)ptr < 0x80000000 || (0x80000000 + osMemSize) <= (u32)ptr) { PRINTF(VT_COL(RED, WHITE) "%s %d:ポインタ %s(%08x) が異常です\n" VT_RST, file, line, exp, ptr); } } -void LogUtils_LogThreadId(const char* name, s32 line) { +void LogUtils_LogThreadId(const char* name, int line) { PRINTF("<%d %s %d>", osGetThreadId(NULL), name, line); } #endif -void LogUtils_HungupThread(const char* name, s32 line) { +void LogUtils_HungupThread(const char* name, int line) { OSId threadId = osGetThreadId(NULL); PRINTF("*** HungUp in thread %d, [%s:%d] ***\n", threadId, name, line); diff --git a/src/boot/stackcheck.c b/src/boot/stackcheck.c index f7eefad718..aa0972d2f8 100644 --- a/src/boot/stackcheck.c +++ b/src/boot/stackcheck.c @@ -98,6 +98,11 @@ u32 StackCheck_GetState(StackEntry* entry) { ret = STACK_STATUS_OK; } +#if !OOT_DEBUG + // This string is still in .rodata for retail builds + (void)"(null)"; +#endif + PRINTF("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free, entry->name != NULL ? entry->name : "(null)"); PRINTF(VT_RST); diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index a949197bf4..4fc8bc370e 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -598,7 +598,7 @@ void DmaMgr_Init(void) { * @see DmaMgr_RequestAsync */ s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk5, OSMesgQueue* queue, - OSMesg msg, const char* file, s32 line) { + OSMesg msg, const char* file, int line) { req->filename = file; req->line = line; return DmaMgr_RequestAsync(req, ram, vrom, size, unk5, queue, msg); @@ -609,7 +609,7 @@ s32 DmaMgr_RequestAsyncDebug(DmaRequest* req, void* ram, uintptr_t vrom, size_t * * @see DmaMgr_RequestSync */ -s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, s32 line) { +s32 DmaMgr_RequestSyncDebug(void* ram, uintptr_t vrom, size_t size, const char* file, int line) { DmaRequest req; s32 ret; OSMesgQueue queue; diff --git a/src/code/__osMalloc.c b/src/code/__osMalloc.c index 6119f8af07..52b9a973c6 100644 --- a/src/code/__osMalloc.c +++ b/src/code/__osMalloc.c @@ -100,7 +100,7 @@ void ArenaImpl_UnsetCheckFreeBlock(Arena* arena) { arena->flag &= ~CHECK_FREE_BLOCK_FLAG; } -void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* arena) { +void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, int line, Arena* arena) { node->filename = file; node->line = line; node->threadId = osGetThreadId(NULL); @@ -254,7 +254,7 @@ void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) { } } -void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line) { +void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, int line) { ArenaNode* iter; u32 blockSize; ArenaNode* newNode; @@ -299,7 +299,7 @@ void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line) return alloc; } -void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) { +void* __osMallocDebug(Arena* arena, u32 size, const char* file, int line) { void* alloc; ArenaImpl_Lock(arena); @@ -309,7 +309,7 @@ void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) { return alloc; } -void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line) { +void* __osMallocRDebug(Arena* arena, u32 size, const char* file, int line) { ArenaNode* iter; ArenaNode* newNode; u32 blockSize; @@ -528,7 +528,7 @@ void __osFree(Arena* arena, void* ptr) { } #if OOT_DEBUG -void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) { +void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, int line) { ArenaNode* node; ArenaNode* next; ArenaNode* prev; @@ -586,7 +586,7 @@ void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) { } } -void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line) { +void __osFreeDebug(Arena* arena, void* ptr, const char* file, int line) { ArenaImpl_Lock(arena); __osFree_NoLockDebug(arena, ptr, file, line); ArenaImpl_Unlock(arena); @@ -695,7 +695,7 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) { } #if OOT_DEBUG -void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line) { +void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, int line) { return __osRealloc(arena, ptr, newSize); } #endif diff --git a/src/code/code_800FD970.c b/src/code/code_800FD970.c deleted file mode 100644 index cc9dc5e63c..0000000000 --- a/src/code/code_800FD970.c +++ /dev/null @@ -1,79 +0,0 @@ -#include "global.h" - -// The latest generated random number, used to generate the next number in the sequence. -static u32 sRandInt = 1; - -// Space to store a value to be re-interpreted as a float. -static u32 sRandFloat; - -/** - * Gets the next integer in the sequence of pseudo-random numbers. - */ -u32 Rand_Next(void) { - return sRandInt = (sRandInt * 1664525) + 1013904223; -} - -/** - * Seeds the pseudo-random number generator by providing a starting value. - */ -void Rand_Seed(u32 seed) { - sRandInt = seed; -} - -/** - * Returns a pseudo-random floating-point number between 0.0f and 1.0f, by generating - * the next integer and masking it to an IEEE-754 compliant floating-point number - * between 1.0f and 2.0f, returning the result subtract 1.0f. - */ -f32 Rand_ZeroOne(void) { - sRandInt = (sRandInt * 1664525) + 1013904223; - sRandFloat = ((sRandInt >> 9) | 0x3F800000); - return *((f32*)&sRandFloat) - 1.0f; -} - -/** - * Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same - * manner in which Rand_ZeroOne generates its result. - */ -f32 Rand_Centered(void) { - sRandInt = (sRandInt * 1664525) + 1013904223; - sRandFloat = ((sRandInt >> 9) | 0x3F800000); - return *((f32*)&sRandFloat) - 1.5f; -} - -/** - * Seeds a pseudo-random number at rndNum with a provided seed. - */ -void Rand_Seed_Variable(u32* rndNum, u32 seed) { - *rndNum = seed; -} - -/** - * Generates the next pseudo-random integer from the provided rndNum. - */ -u32 Rand_Next_Variable(u32* rndNum) { - return *rndNum = (*rndNum * 1664525) + 1013904223; -} - -/** - * Generates the next pseudo-random floating-point number between 0.0f and - * 1.0f from the provided rndNum. - */ -f32 Rand_ZeroOne_Variable(u32* rndNum) { - u32 next = (*rndNum * 1664525) + 1013904223; - - sRandFloat = ((*rndNum = next) >> 9) | 0x3F800000; - return *((f32*)&sRandFloat) - 1.0f; -} - -/** - * Generates the next pseudo-random floating-point number between -0.5f and - * 0.5f from the provided rndNum. - */ -f32 Rand_Centered_Variable(u32* rndNum) { - u32 next = (*rndNum * 1664525) + 1013904223; - - *rndNum = next; - sRandFloat = (next >> 9) | 0x3F800000; - return *((f32*)&sRandFloat) - 1.5f; -} diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index 1f00167bd2..3ca092bd36 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -36,7 +36,7 @@ void* DebugArena_Malloc(u32 size) { } #if OOT_DEBUG -void* DebugArena_MallocDebug(u32 size, const char* file, s32 line) { +void* DebugArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sDebugArena, size, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_DEBUG", "確保"); // "Secure" @@ -52,7 +52,7 @@ void* DebugArena_MallocR(u32 size) { } #if OOT_DEBUG -void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line) { +void* DebugArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sDebugArena, size, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_r_DEBUG", "確保"); // "Secure" @@ -67,7 +67,7 @@ void* DebugArena_Realloc(void* ptr, u32 newSize) { } #if OOT_DEBUG -void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { +void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing" return ptr; @@ -79,7 +79,7 @@ void DebugArena_Free(void* ptr) { } #if OOT_DEBUG -void DebugArena_FreeDebug(void* ptr, const char* file, s32 line) { +void DebugArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sDebugArena, ptr, file, line); } #endif diff --git a/src/code/fault.c b/src/code/fault.c index 593613f50f..8b05fb8208 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -1322,7 +1322,7 @@ NORETURN void Fault_AddHungupAndCrashImpl(const char* exp1, const char* exp2) { * Like `Fault_AddHungupAndCrashImpl`, however provides a fixed message containing * filename and line number */ -NORETURN void Fault_AddHungupAndCrash(const char* file, s32 line) { +NORETURN void Fault_AddHungupAndCrash(const char* file, int line) { char msg[256]; sprintf(msg, "HungUp %s:%d", file, line); diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index 181e682691..8f5fbcbe49 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -102,11 +102,11 @@ FaultDrawer sFaultDrawerDefault = { #ifndef NON_MATCHING // TODO: match .bss (has reordering issues) extern FaultDrawer sFaultDrawer; -extern char D_8016B6BC[0x24]; +extern char D_8016B6C0[0x20]; #else // Non-matching version for struct shiftability FaultDrawer sFaultDrawer; -char D_8016B6BC[0x24]; +char D_8016B6C0[0x20]; #endif void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) { diff --git a/src/code/game.c b/src/code/game.c index ea6e399f5b..7d290e3329 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -6,10 +6,11 @@ VisCvg sVisCvg; VisZBuf sVisZBuf; VisMono sVisMono; ViMode sViMode; + +#if OOT_DEBUG FaultClient sGameFaultClient; u16 sLastButtonPressed; -#if OOT_DEBUG void GameState_FaultPrint(void) { static char sBtnChars[] = "ABZSuldr*+LRudlr"; s32 i; @@ -408,7 +409,10 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g gameState->destroy = NULL; gameState->running = 1; startTime = osGetTime(); - gameState->size = gameState->init = 0; + + // Thse assignments must be written this way for matching and to avoid a warning due to casting a pointer to an + // integer without a cast. This assigns init = NULL and size = 0. + gameState->size = (u32)(gameState->init = NULL); { s32 requiredScopeTemp; @@ -494,7 +498,7 @@ u32 GameState_IsRunning(GameState* gameState) { } #if OOT_DEBUG -void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line) { +void* GameState_Alloc(GameState* gameState, size_t size, const char* file, int line) { void* ret; if (THA_IsCrash(&gameState->tha)) { diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index c5e8e52432..b80ece7b26 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -13,7 +13,7 @@ void GameAlloc_Log(GameAlloc* this) { } #if OOT_DEBUG -void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) { +void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, int line) { GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line); if (ptr != NULL) { diff --git a/src/code/graph.c b/src/code/graph.c index 36cfa633d9..4f230b205d 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -14,8 +14,13 @@ OSTime sGraphPrevUpdateEndTime; */ OSTime sGraphPrevTaskTimeStart; +#if OOT_DEBUG FaultClient sGraphFaultClient; +#endif + CfbInfo sGraphCfbInfos[3]; + +#if OOT_DEBUG FaultClient sGraphUcodeFaultClient; UCodeInfo D_8012D230[3] = { @@ -30,7 +35,6 @@ UCodeInfo D_8012D248[3] = { { UCODE_S2DEX, gspS2DEX2d_fifoTextStart }, }; -#if OOT_DEBUG void Graph_FaultClient(void) { void* nextFb = osViGetNextFramebuffer(); void* newFb = (SysCfb_GetFbPtr(0) != nextFb) ? SysCfb_GetFbPtr(0) : SysCfb_GetFbPtr(1); @@ -501,7 +505,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) { } #if OOT_DEBUG -void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) { +void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) { dispRefs[0] = gfxCtx->polyOpa.p; dispRefs[1] = gfxCtx->polyXlu.p; @@ -513,7 +517,7 @@ void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, } } -void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) { +void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, int line) { if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) { if (dispRefs[0] + 1 == gfxCtx->polyOpa.p) { gfxCtx->polyOpa.p = dispRefs[0]; diff --git a/src/code/rand.c b/src/code/rand.c new file mode 100644 index 0000000000..4a0c5dc4a3 --- /dev/null +++ b/src/code/rand.c @@ -0,0 +1,162 @@ +/** + * @file rand.c + * + * This file implements the primary random number generator the game relies on. The generator is pseudo-random and + * implemented as a Linear Congruential Generator (LCG). + * + * A LCG computes random numbers sequentially via the relation + * X(n+1) = (a * X(n) + c) mod m + * where m is the modulus, a is the multiplier and c is the increment. + * + * These three parameters (a,c,m) completely specify the LCG and should be chosen such that + * - m > 0 + * - 0 < a < m + * - 0 <= c < m + * + * The period of the LCG (a, c, m) is the smallest period p such that X(n + p) = X(n), past n=p the sequence will repeat + * itself in its outputs. + * A good LCG should have the maximum possible period, which will be equal to m as there are at most m possible values + * for X. This occurs when (Hull, T.E., & Dobell, A.R. (1962). Random Number Generators. Siam Review, 4, 230-254.): + * - m,c are relatively prime, that is the only integer that divides both m and c with no remainder is 1. + * - a - 1 is divisible by all prime factors of m. + * - a - 1 is divisible by 4 if m is divisible by 4. + * + * Ideally m is chosen to be a large power of 2 so that the modulo operation is inexpensive to compute. In this case the + * prime factors of m = 2^k are just k copies of 2. For k > 1 m is divisible by 4, so a - 1 must be divisible by 4. 2^k + * and c can easily be made relatively prime by making c an odd number. + * If we let k=32 to match the size of an integer, the modulo operation is made implicit by the width of the data type + * and becomes free to compute. + * + * The parameter a should be selected such that a-1 is divisible by 4 (and hence divisible by 2) and c should be any odd + * number. The precise values should fare well against the spectral test, a measure of "how random" a particular LCG is. + * A pair (a,c) that satisfies these requirements is (1664525, 1013904223), recommended by "Numerical Recipes in C: The + * Art of Scientific Computing" (p. 284). + * + * Therefore, the LCG with parameters (1664525, 1013904223, 2^32) that is implemented in this file has a maximal period + * of 2^32 and produces high-quality pseudo-random numbers. + * + * @note If sampling the LCG for a n-bit number it is important to use the upper n bits instead of the lower n bits of + * the LCG output. The lower n bits only have a period of 2^n which may significantly worsen the quality of the + * resulting random numbers compared to the quality of the full 32-bit result. + * + * @note Original name: qrand.c + */ +#include "ultra64.h" + +#define RAND_MULTIPLIER 1664525 +#define RAND_INCREMENT 1013904223 + +/** + * The latest generated random number, used to generate the next number in the sequence. + * + * @note Original name: __qrand_idum + */ +static u32 sRandInt = 1; + +/** + * Space to store a value to be re-interpreted as a float. + * + * @note Orignal name: __qrand_itemp + */ +static fu sRandFloat; + +/** + * Gets the next integer in the sequence of pseudo-random numbers. + * + * @note Original name: qrand + */ +u32 Rand_Next(void) { + return sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT; +} + +/** + * Seeds the pseudo-random number generator by providing a starting value. + * + * @note Original name: sqrand + */ +void Rand_Seed(u32 seed) { + sRandInt = seed; +} + +/** + * Returns a pseudo-random floating-point number between 0.0f and 1.0f, by generating the next integer and masking it + * to an IEEE-754 compliant floating-point number between 1.0f and 2.0f, returning the result subtract 1.0f. + * + * @note This technique for generating pseudo-random floats is recommended as a particularly fast but potentially + * non-portable generator in "Numerical Recipes in C: The Art of Scientic Computing", pp. 284-5. + * + * @note Original name: fqrand + */ +f32 Rand_ZeroOne(void) { + sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT; + // Samples the upper 23 bits to avoid effectively reducing the LCG period. + sRandFloat.i = (sRandInt >> 9) | 0x3F800000; + return sRandFloat.f - 1.0f; +} + +/** + * Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same manner in which Rand_ZeroOne + * generates its result. + * + * @see Rand_ZeroOne + * + * @note Original name: fqrand2 + */ +f32 Rand_Centered(void) { + sRandInt = sRandInt * RAND_MULTIPLIER + RAND_INCREMENT; + sRandFloat.i = (sRandInt >> 9) | 0x3F800000; + return sRandFloat.f - 1.5f; +} + +//! All functions below are unused variants of the above four, that use a provided random number variable instead of the +//! internal `sRandInt` + +/** + * Seeds a pseudo-random number at rndNum with a provided starting value. + * + * @see Rand_Seed + * + * @note Original name: sqrand_r + */ +void Rand_Seed_Variable(u32* rndNum, u32 seed) { + *rndNum = seed; +} + +/** + * Generates the next pseudo-random integer from the provided rndNum. + * + * @see Rand_Next + * + * @note Original name: qrand_r + */ +u32 Rand_Next_Variable(u32* rndNum) { + return *rndNum = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT; +} + +/** + * Generates the next pseudo-random floating-point number between 0.0f and 1.0f from the provided rndNum. + * + * @see Rand_ZeroOne + * + * @note Original name: fqrand_r + */ +f32 Rand_ZeroOne_Variable(u32* rndNum) { + u32 next = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT; + + sRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000; + return sRandFloat.f - 1.0f; +} + +/** + * Generates the next pseudo-random floating-point number between -0.5f and 0.5f from the provided rndNum. + * + * @see Rand_ZeroOne, Rand_Centered + * + * @note Original name: fqrand2_r + */ +f32 Rand_Centered_Variable(u32* rndNum) { + u32 next = (*rndNum) * RAND_MULTIPLIER + RAND_INCREMENT; + + sRandFloat.i = ((*rndNum = next) >> 9) | 0x3F800000; + return sRandFloat.f - 1.5f; +} diff --git a/src/code/sched.c b/src/code/sched.c index b398f3e457..fbfc42dc07 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -45,14 +45,14 @@ #define RDP_DONE_MSG 668 #define NOTIFY_MSG 670 // original name: ENTRY_MSG -vs32 sSchedDebugPrintfEnabled = false; - OSTime sRSPGfxTimeStart; OSTime sRSPAudioTimeStart; OSTime sRSPOtherTimeStart; OSTime sRDPTimeStart; #if OOT_DEBUG +vs32 sSchedDebugPrintfEnabled = false; + #define SCHED_DEBUG_PRINTF \ if (sSchedDebugPrintfEnabled) \ PRINTF diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index b90ddaad52..2ca6e4cf47 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -605,11 +605,11 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { #if OOT_DEBUG -Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) { +Mtx* Matrix_ToMtx(Mtx* dest, const char* file, int line) { return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest); } -Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line) { +Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, const char* file, int line) { return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx)), file, line); } @@ -970,7 +970,7 @@ void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) { } #if OOT_DEBUG -MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) { +MtxF* Matrix_CheckFloats(MtxF* mf, const char* file, int line) { s32 i, j; for (i = 0; i < 4; i++) { diff --git a/src/code/system_malloc.c b/src/code/system_malloc.c index 74e69ed46f..efee95dbdc 100644 --- a/src/code/system_malloc.c +++ b/src/code/system_malloc.c @@ -36,7 +36,7 @@ void* SystemArena_Malloc(u32 size) { } #if OOT_DEBUG -void* SystemArena_MallocDebug(u32 size, const char* file, s32 line) { +void* SystemArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&gSystemArena, size, file, line); SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_DEBUG", "確保"); // "Secure" @@ -52,7 +52,7 @@ void* SystemArena_MallocR(u32 size) { } #if OOT_DEBUG -void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line) { +void* SystemArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&gSystemArena, size, file, line); SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_r_DEBUG", "確保"); // "Secure" @@ -67,7 +67,7 @@ void* SystemArena_Realloc(void* ptr, u32 newSize) { } #if OOT_DEBUG -void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { +void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&gSystemArena, ptr, newSize, file, line); SYSTEM_ARENA_CHECK_POINTER(ptr, newSize, "realloc_DEBUG", "再確保"); // "Re-securing" return ptr; @@ -79,7 +79,7 @@ void SystemArena_Free(void* ptr) { } #if OOT_DEBUG -void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) { +void SystemArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&gSystemArena, ptr, file, line); } #endif diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 23159e7ede..0dd90d3352 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -23,6 +23,8 @@ #undef DEFINE_ACTOR_UNSET // Actor Overlay Table definition +#if OOT_DEBUG + #define DEFINE_ACTOR(name, _1, allocType, nameString) \ { (uintptr_t)_ovl_##name##SegmentRomStart, \ (uintptr_t)_ovl_##name##SegmentRomEnd, \ @@ -37,6 +39,24 @@ #define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \ { 0, 0, NULL, NULL, NULL, &name##_InitVars, nameString, allocType, 0 }, +#else + +// Actor name is set to NULL in retail builds +#define DEFINE_ACTOR(name, _1, allocType, _3) \ + { (uintptr_t)_ovl_##name##SegmentRomStart, \ + (uintptr_t)_ovl_##name##SegmentRomEnd, \ + _ovl_##name##SegmentStart, \ + _ovl_##name##SegmentEnd, \ + NULL, \ + &name##_InitVars, \ + NULL, \ + allocType, \ + 0 }, + +#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, _3) { 0, 0, NULL, NULL, NULL, &name##_InitVars, NULL, allocType, 0 }, + +#endif + #define DEFINE_ACTOR_UNSET(_0) { 0 }, ActorOverlay gActorOverlayTable[] = { diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index b3f0cd2a5c..4906fc556e 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -83,7 +83,7 @@ u16 sSurfaceMaterialToSfxOffset[SURFACE_MATERIAL_MAX] = { /** * original name: T_BGCheck_PosErrorCheck */ -s32 BgCheck_PosErrorCheck(Vec3f* pos, char* file, s32 line) { +s32 BgCheck_PosErrorCheck(Vec3f* pos, const char* file, int line) { if (pos->x >= BGCHECK_XYZ_ABSMAX || pos->x <= -BGCHECK_XYZ_ABSMAX || pos->y >= BGCHECK_XYZ_ABSMAX || pos->y <= -BGCHECK_XYZ_ABSMAX || pos->z >= BGCHECK_XYZ_ABSMAX || pos->z <= -BGCHECK_XYZ_ABSMAX) { PRINTF(VT_FGCOL(RED)); diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 8fd35af197..652b6f643a 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -29,6 +29,7 @@ Color_RGBA8 sDebugCamTextColors[] = { { 128, 255, 32, 128 }, // DEBUG_CAM_TEXT_GREEN }; +#if OOT_DEBUG InputCombo sRegGroupInputCombos[REG_GROUPS] = { { BTN_L, BTN_CUP }, // REG { BTN_L, BTN_CLEFT }, // SREG @@ -93,6 +94,7 @@ char sRegGroupChars[REG_GROUPS] = { 'k', // kREG 'b', // bREG }; +#endif void Regs_Init(void) { s32 i; diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index 41685a60e2..f4910479d5 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -35,7 +35,7 @@ void* ZeldaArena_Malloc(u32 size) { } #if OOT_DEBUG -void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line) { +void* ZeldaArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sZeldaArena, size, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_DEBUG", "確保"); // "Secure" @@ -51,7 +51,7 @@ void* ZeldaArena_MallocR(u32 size) { } #if OOT_DEBUG -void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line) { +void* ZeldaArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_r_DEBUG", "確保"); // "Secure" @@ -66,7 +66,7 @@ void* ZeldaArena_Realloc(void* ptr, u32 newSize) { } #if OOT_DEBUG -void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { +void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line); ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc_DEBUG", "再確保"); // "Re-securing" return ptr; @@ -78,7 +78,7 @@ void ZeldaArena_Free(void* ptr) { } #if OOT_DEBUG -void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line) { +void ZeldaArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sZeldaArena, ptr, file, line); } #endif diff --git a/src/code/z_play.c b/src/code/z_play.c index 62b6f9287d..2e499c9a0e 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -10,9 +10,12 @@ TransitionTile sTransitionTile; s32 gTransitionTileState; VisMono sPlayVisMono; Color_RGBA8_u32 gVisMonoColor; + +#if OOT_DEBUG FaultClient D_801614B8; +#endif + s16 sTransitionFillTimer; -u64 sDebugCutsceneScriptBuf[0xA00]; void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn); @@ -451,7 +454,10 @@ void Play_Init(GameState* thisx) { AnimationContext_Update(this, &this->animationCtx); gSaveContext.respawnFlag = 0; - if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) { +#if OOT_DEBUG + if (R_USE_DEBUG_CUTSCENE) { + static u64 sDebugCutsceneScriptBuf[0xA00]; + gDebugCutsceneScript = sDebugCutsceneScriptBuf; PRINTF("\nkawauso_data=[%x]", gDebugCutsceneScript); @@ -459,6 +465,7 @@ void Play_Init(GameState* thisx) { // Presumably the ROM was larger at a previous point in development when this debug feature was used. DmaMgr_DmaRomToRam(0x03FEB000, gDebugCutsceneScript, sizeof(sDebugCutsceneScriptBuf)); } +#endif } void Play_Update(PlayState* this) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index b20e9f1c12..cc078dc8bf 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -347,11 +347,13 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) { Actor_MoveXZGravity(&this->dyna.actor); func_80888694(this, (BgHidanHamstep*)this->dyna.actor.parent); +#if OOT_DEBUG if (((this->dyna.actor.params & 0xFF) <= 0) || ((this->dyna.actor.params & 0xFF) >= 6)) { // "[Hammer Step] arg_data strange (arg_data = %d)" PRINTF("【ハンマーステップ】 arg_data おかしい (arg_data = %d)", this->dyna.actor.params); PRINTF("%s %d\n", "../z_bg_hidan_hamstep.c", 696); } +#endif if (((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) <= sYPosOffsets[(this->dyna.actor.params & 0xFF) - 1]) && diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index 0d476066de..ce8149375f 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -82,6 +82,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) { s32 i; s32 j; CollisionHeader* collisionHeader = NULL; + Vec3f* vtx; Actor_ProcessInitChain(thisx, sInitChain); this->unk_16A = thisx->params & 0x3F; @@ -103,7 +104,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) { if (1) { for (j = 0; j < 3; j++) { - Vec3f* vtx = &colliderElementInit->dim.vtx[j]; + vtx = &colliderElementInit->dim.vtx[j]; vertices[j].x = vtx->z * sinRotY + (thisx->home.pos.x + vtx->x * cosRotY); vertices[j].y = vtx->y + thisx->home.pos.y; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index 4bcee5a11a..c7890ace87 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -73,9 +73,12 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) { ((s32)thisx->params >> 8) & 0xFF); Actor_ProcessInitChain(thisx, sInitChain); + +#if OOT_DEBUG if (((thisx->params & 0xFF) < 0) || ((thisx->params & 0xFF) >= 3)) { PRINTF("arg_data おかしい 【格子】\n"); } +#endif CollisionHeader_GetVirtual(sMetalFencesCollisions[thisx->params & 0xFF], &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 0e0f1f6062..9cba8f54de 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -130,9 +130,10 @@ void func_8088CEC0(BgHidanSekizou* this, s32 arg1, s16 arg2) { s32 end = start + 3; f32 sp30 = Math_SinS(arg2); f32 sp2C = Math_CosS(arg2); + ColliderJntSphElement* element; for (i = start; i < end; i++) { - ColliderJntSphElement* element = &this->collider.elements[i]; + element = &this->collider.elements[i]; element->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + (sp2C * element->dim.modelSphere.center.x) + (sp30 * element->dim.modelSphere.center.z); @@ -301,8 +302,8 @@ Gfx* func_8088D9F4(PlayState* play, BgHidanSekizou* this, s16 arg2, MtxF* arg3, f32 phi_f12; arg6 = (((arg6 + arg2) % 8) * 7) * (1 / 7.0f); - arg2++; gSPSegment(arg7++, 9, SEGMENTED_TO_VIRTUAL(sFireballsTexs[arg6])); + arg2++; if (arg2 != 4) { phi_f12 = arg2 + ((4 - this->unk_170) / 4.0f); } else { diff --git a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c index 343b1250c0..0d8f5a34d2 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shutter/z_bg_ice_shutter.c @@ -49,7 +49,6 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) { f32 sp24; CollisionHeader* colHeader; s32 sp28; - f32 temp_f6; colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -78,7 +77,8 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) { } if (sp28 == 2) { - temp_f6 = Math_SinS(this->dyna.actor.shape.rot.x) * 50.0f; + f32 temp_f6 = Math_SinS(this->dyna.actor.shape.rot.x) * 50.0f; + this->dyna.actor.focus.pos.x = (Math_SinS(this->dyna.actor.shape.rot.y) * temp_f6) + this->dyna.actor.home.pos.x; this->dyna.actor.focus.pos.y = this->dyna.actor.home.pos.y; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index a66909bd6c..a8e3c1ad7e 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -74,10 +74,12 @@ void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { this->puzzleFlags &= ~cobraPuzzleFlags[i]; } +#if OOT_DEBUG if (curCobraInfo->cobra->dyna.actor.update == NULL) { // "Cobra deleted" PRINTF("Error : コブラ削除された (%s %d)\n", "../z_bg_jya_bigmirror.c", 203); } +#endif } else { curCobraInfo->cobra = (BgJyaCobra*)Actor_SpawnAsChild( &play->actorCtx, &this->actor, play, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, curSpawnData->pos.y, @@ -136,17 +138,10 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { this->lightBeams[1] = NULL; this->lightBeams[0] = NULL; } else { - puzzleSolved = !!(this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM)); - - if (puzzleSolved) { - puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED); - - if (puzzleSolved) { - puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED); - } - } - lightBeamToggles[0] = puzzleSolved; // Only spawn if puzzle solved - if (1) {} + // Only spawn if puzzle solved + lightBeamToggles[0] = (this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM)) && + (this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED) && + (this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED); lightBeamToggles[1] = lightBeamToggles[2] = this->puzzleFlags & (BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM); @@ -158,10 +153,12 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y, sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]); +#if OOT_DEBUG if (this->lightBeams[i] == NULL) { // "Mir Ray generation failed" PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 310); } +#endif } } else { if (this->lightBeams[i] != NULL) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c index af9ced88f4..6ef2ddd84c 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c +++ b/src/overlays/actors/ovl_Bg_Jya_Ironobj/z_bg_jya_ironobj.c @@ -106,10 +106,13 @@ void BgJyaIronobj_SpawnPillarParticles(BgJyaIronobj* this, PlayState* play, EnIk f32 sins; s32 pad[2]; +#if OOT_DEBUG if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 233, enIk->unk_2FF); return; } +#endif + PRINTF("¢ attack_type(%d)\n", enIk->unk_2FF); rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1]; @@ -169,10 +172,13 @@ void BgJyaIronobj_SpawnThroneParticles(BgJyaIronobj* this, PlayState* play, EnIk f32 sins; s32 pad[2]; +#if OOT_DEBUG if (enIk->unk_2FF <= 0 || enIk->unk_2FF >= 4) { PRINTF("Error 攻撃方法が分からない(%s %d)\n", "../z_bg_jya_ironobj.c", 362, enIk->unk_2FF); return; } +#endif + PRINTF("¢ attack_type(%d)\n", enIk->unk_2FF); rotY = Actor_WorldYawTowardActor(&this->dyna.actor, &enIk->actor) + D_808994D8[enIk->unk_2FF - 1]; for (i = 0; i < 8; i++) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 788f16adff..4acd8fbf03 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -217,10 +217,11 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, PlayState* play) { void BgJyaMegami_SetupExplode(BgJyaMegami* this) { u32 i; + Vec3f* pos = &this->dyna.actor.world.pos; this->actionFunc = BgJyaMegami_Explode; for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { - Math_Vec3f_Copy(&this->pieces[i].pos, &this->dyna.actor.world.pos); + Math_Vec3f_Copy(&this->pieces[i].pos, pos); this->pieces[i].vel.x = sPiecesInit[i].velX; } this->explosionTimer = 0; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 0ab3facdac..f829706fc5 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -182,7 +182,14 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); switch ((u16)this->dyna.actor.params & 0xF) { - case MIZUBWALL_FLOOR: + case MIZUBWALL_FLOOR: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -194,12 +201,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -217,7 +220,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_RUTO_ROOM: + } + case MIZUBWALL_RUTO_ROOM: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -229,12 +240,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitRutoWall); i++) { for (j = 0; j < 3; j++) { @@ -252,7 +259,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_UNUSED: + } + case MIZUBWALL_UNUSED: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -264,12 +279,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -289,7 +300,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_STINGER_ROOM_1: + } + case MIZUBWALL_STINGER_ROOM_1: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -302,12 +321,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -327,7 +342,15 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; - case MIZUBWALL_STINGER_ROOM_2: + } + case MIZUBWALL_STINGER_ROOM_2: { + f32 sin; + f32 cos; + s32 i; + s32 j; + Vec3f offset; + Vec3f vtx[3]; + if (Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dList = NULL; @@ -340,12 +363,8 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { this->dyna.actor.params); Actor_Kill(&this->dyna.actor); } else { - f32 sin = Math_SinS(this->dyna.actor.shape.rot.y); - f32 cos = Math_CosS(this->dyna.actor.shape.rot.y); - s32 i; - s32 j; - Vec3f offset; - Vec3f vtx[3]; + sin = Math_SinS(this->dyna.actor.shape.rot.y); + cos = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < ARRAY_COUNT(sTrisElementInitFloor); i++) { for (j = 0; j < 3; j++) { @@ -365,6 +384,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) { } } break; + } } } @@ -377,9 +397,8 @@ void BgMizuBwall_Destroy(Actor* thisx, PlayState* play) { } void BgMizuBwall_SetAlpha(BgMizuBwall* this, PlayState* play) { - f32 waterLevel = play->colCtx.colHeader->waterBoxes[2].ySurface; - - if (play->colCtx.colHeader->waterBoxes) {} + WaterBox* waterBoxes = play->colCtx.colHeader->waterBoxes; + f32 waterLevel = waterBoxes[2].ySurface; if (waterLevel < WATER_TEMPLE_WATER_F1_Y) { this->scrollAlpha1 = 255; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 050f850aaa..c0071bed5c 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -53,6 +53,7 @@ static InitChainEntry sInitChain[] = { u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) { u32 ret; +#if OOT_DEBUG if (bREG(0) != 0) { switch (bREG(1)) { case 0: @@ -67,6 +68,8 @@ u32 BgMizuWater_GetWaterLevelActionIndex(s16 switchFlag, PlayState* play) { } bREG(0) = 0; } +#endif + if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F1_FLAG)) { ret = 3; } else if (Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG) && (switchFlag != WATER_TEMPLE_WATER_F2_FLAG)) { @@ -297,10 +300,13 @@ void BgMizuWater_Update(Actor* thisx, PlayState* play) { s32 unk1; s32 pad; +#if OOT_DEBUG if (bREG(15) == 0) { PRINTF("%x %x %x\n", Flags_GetSwitch(play, WATER_TEMPLE_WATER_F1_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F2_FLAG), Flags_GetSwitch(play, WATER_TEMPLE_WATER_F3_FLAG)); } +#endif + if (this->type == 0) { posY = this->actor.world.pos.y; unk0 = 0; diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index 12072ce5ff..8b50d4b5dd 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -88,27 +88,31 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) { this->unk_172 = sIsSpawned; this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); + +#if OOT_DEBUG if (this->moriTexObjectSlot < 0) { Actor_Kill(thisx); // "Forest Temple obj elevator Bank Danger!" PRINTF("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277); - } else { - switch (sIsSpawned) { - case false: - // "Forest Temple elevator CT" - PRINTF("森の神殿 elevator CT\n"); - sIsSpawned = true; - this->dyna.actor.room = -1; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - BgMoriElevator_SetupWaitAfterInit(this); - break; - case true: - Actor_Kill(thisx); - break; - } + return; + } +#endif + + switch (sIsSpawned) { + case false: + // "Forest Temple elevator CT" + PRINTF("森の神殿 elevator CT\n"); + sIsSpawned = true; + this->dyna.actor.room = -1; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); + CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + BgMoriElevator_SetupWaitAfterInit(this); + break; + case true: + Actor_Kill(thisx); + break; } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 74d4621487..cab9eed7d5 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -12,7 +12,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play); void BgMoriRakkatenjo_Destroy(Actor* thisx, PlayState* play); -void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play); +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play2); void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play); void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this); @@ -52,6 +52,8 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); + +#if OOT_DEBUG // "Forest Temple obj. Falling Ceiling" PRINTF("森の神殿 obj. 落下天井 (home posY %f)\n", this->dyna.actor.home.pos.y); if ((fabsf(1991.0f - this->dyna.actor.home.pos.x) > 0.001f) || @@ -64,6 +66,8 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { // "The set Angle has changed. Let's fix the program." PRINTF("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n"); } +#endif + this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX); if (this->moriTexObjectSlot < 0) { // "Forest Temple obj Falling Ceiling Bank Danger!" @@ -197,8 +201,8 @@ void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, PlayState* play) { } } -void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play) { - s32 pad; +void BgMoriRakkatenjo_Update(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; if (this->timer > 0) { diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 3a8815ea2f..1fafea47cd 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -197,8 +197,9 @@ void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, PlayState* play) } void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { - BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; s32 pad; + BgSpot00Hanebasi* this = (BgSpot00Hanebasi*)thisx; + Player* player; this->actionFunc(this, play); @@ -206,7 +207,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { if (play->sceneId == SCENE_HYRULE_FIELD) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !GET_EVENTCHKINF(EVENTCHKINF_80) && LINK_IS_CHILD) { - Player* player = GET_PLAYER(play); + player = GET_PLAYER(play); if ((player->actor.world.pos.x > -450.0f) && (player->actor.world.pos.x < 450.0f) && (player->actor.world.pos.z > 1080.0f) && (player->actor.world.pos.z < 1700.0f) && diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index 513b8c20b3..a8e6ce6559 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -117,10 +117,11 @@ void func_808AAE6C(BgSpot01Idohashira* this, PlayState* play) { void func_808AAF34(BgSpot01Idohashira* this, PlayState* play) { s32 pad[2]; - Vec3f dest; - Vec3f src; if (this->unk_170 != 0) { + Vec3f dest; + Vec3f src; + src.x = kREG(20) + 1300.0f; src.y = kREG(21) + 200.0f; src.z = 0.0f; @@ -170,13 +171,11 @@ void func_808AB18C(BgSpot01Idohashira* this) { f32 func_808AB1DC(f32 arg0, f32 arg1, u16 arg2, u16 arg3, u16 arg4) { f32 temp_f12; f32 regFloat; - f32 diff23; - f32 diff43; + f32 diff23 = arg2 - arg3; + f32 diff43 = arg4 - arg3; - diff23 = arg2 - arg3; if (diff23 != 0.0f) { regFloat = kREG(9) + 30.0f; - diff43 = arg4 - arg3; temp_f12 = regFloat * diff43; return (((((arg1 - arg0) - temp_f12) / SQ(diff23)) * diff43) * diff43) + temp_f12; } diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index a652df6420..1f1f9da166 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -13,8 +13,8 @@ void BgSpot02Objects_Init(Actor* thisx, PlayState* play); void BgSpot02Objects_Destroy(Actor* thisx, PlayState* play); void BgSpot02Objects_Update(Actor* thisx, PlayState* play); void BgSpot02Objects_Draw(Actor* thisx, PlayState* play); -void func_808ACCB8(Actor* thisx, PlayState* play); -void func_808AD450(Actor* thisx, PlayState* play); +void func_808ACCB8(Actor* thisx, PlayState* play2); +void func_808AD450(Actor* thisx, PlayState* play2); void func_808AC8FC(BgSpot02Objects* this, PlayState* play); void func_808AC908(BgSpot02Objects* this, PlayState* play); @@ -212,10 +212,10 @@ void func_808ACC34(BgSpot02Objects* this, PlayState* play) { } } -void func_808ACCB8(Actor* thisx, PlayState* play) { +void func_808ACCB8(Actor* thisx, PlayState* play2) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; + PlayState* play = (PlayState*)play2; f32 rate; - s32 pad; u8 redPrim; u8 greenPrim; u8 bluePrim; @@ -225,6 +225,8 @@ void func_808ACCB8(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 600); + if (1) {} + if (play->csCtx.state != CS_STATE_IDLE && play->csCtx.actorCues[0] != NULL && play->csCtx.actorCues[0]->id == 2) { if (this->unk_16A < 5) { rate = (this->unk_16A / 5.0f); @@ -278,9 +280,9 @@ void func_808AD3D4(BgSpot02Objects* this, PlayState* play) { } } -void func_808AD450(Actor* thisx, PlayState* play) { +void func_808AD450(Actor* thisx, PlayState* play2) { BgSpot02Objects* this = (BgSpot02Objects*)thisx; - s32 pad; + PlayState* play = (PlayState*)play2; f32 lerp; OPEN_DISPS(play->state.gfxCtx, "../z_bg_spot02_objects.c", 736); diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index ff24dcc5ca..78d1e3d376 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -147,6 +147,8 @@ void BgSpot03Taki_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, object_spot03_object_DL_001580); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_spot03_taki.c", 358); this->bufferIndex = this->bufferIndex == 0; diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 8784b28e24..1729cc935c 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -111,11 +111,12 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) { if (LINK_IS_ADULT && Flags_GetSwitch(play, this->switchFlag)) { thisx->world.pos.y = thisx->home.pos.y + 120.0f; this->actionFunc = BgSpot06Objects_DoNothing; - } else { this->actionFunc = BgSpot06Objects_GateWaitForSwitch; } + if (1) {} + break; case LHO_WATER_TEMPLE_ENTRANCE_LOCK: Actor_ProcessInitChain(thisx, sInitChain); diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index c65737af97..ff7c8e28ba 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -125,7 +125,6 @@ void BgSpot11Oasis_Update(Actor* thisx, PlayState* play) { BgSpot11Oasis* this = (BgSpot11Oasis*)thisx; s32 pad; u32 gameplayFrames; - Vec3f sp30; this->actionFunc(this, play); if (this->actionFunc == func_808B2980) { @@ -136,6 +135,8 @@ void BgSpot11Oasis_Update(Actor* thisx, PlayState* play) { if (this->unk_150 && (this->actor.projectedPos.z < 400.0f) && (this->actor.projectedPos.z > -40.0f)) { gameplayFrames = play->gameplayFrames; if (gameplayFrames & 4) { + Vec3f sp30; + Math_Vec3f_Sum(&this->actor.world.pos, &D_808B2E34[this->unk_151], &sp30); EffectSsBubble_Spawn(play, &sp30, 0.0f, 15.0f, 50.0f, (Rand_ZeroOne() * 0.12f) + 0.02f); if (Rand_ZeroOne() < 0.3f) { diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 7a7a485617..c147daa300 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -230,8 +230,8 @@ s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) { } void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { + s16 shouldLive = true; BgSpot16Bombstone* this = (BgSpot16Bombstone*)thisx; - s16 shouldLive; func_808B4C30(this); @@ -240,6 +240,7 @@ void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { // The boulder is intact shouldLive = func_808B4D9C(this, play); break; + case 0: case 1: case 2: @@ -249,11 +250,14 @@ void BgSpot16Bombstone_Init(Actor* thisx, PlayState* play) { // The boulder is debris shouldLive = func_808B4E58(this, play); break; + +#if OOT_DEBUG default: PRINTF("Error : arg_data おかしいな(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot16_bombstone.c", 668, this->actor.params); shouldLive = false; break; +#endif } if (!shouldLive) { @@ -451,12 +455,14 @@ void func_808B5950(BgSpot16Bombstone* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); } +#if OOT_DEBUG if (mREG(64) == 1) { func_808B561C(this, play); mREG(64) = -10; } else if (mREG(64) < 0) { mREG(64)++; } +#endif } void func_808B5A78(BgSpot16Bombstone* this) { diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 84ca72ef57..6eae47eb98 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -91,33 +91,33 @@ void func_808B7770(BgSpot18Basket* this, PlayState* play, f32 arg2) { s32 i; f32 randomValue; f32 sinValue; - s32 count; - for (i = 0, count = 2; i != count; i++) { - if (play) {} - if (!(arg2 < Rand_ZeroOne())) { - D_808B85D0 += 0x7530; - - sinValue = Math_SinS(D_808B85D0); - cosValue = Math_CosS(D_808B85D0); - - randomValue = (Rand_ZeroOne() * 35.0f) + 35.0f; - - position.x = (randomValue * sinValue) + this->dyna.actor.world.pos.x; - position.y = this->dyna.actor.world.pos.y + 10.0f; - position.z = (randomValue * cosValue) + this->dyna.actor.world.pos.z; - - velocity.x = sinValue; - velocity.y = 0.0f; - velocity.z = cosValue; - - acceleration.x = 0.0f; - acceleration.y = 0.5f; - acceleration.z = 0.0f; - - func_800286CC(play, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), - ((Rand_ZeroOne() * 30) + 80)); + for (i = 0; i != 2; i++) { + if (arg2 < Rand_ZeroOne()) { + continue; } + + D_808B85D0 += 0x7530; + + sinValue = Math_SinS(D_808B85D0); + cosValue = Math_CosS(D_808B85D0); + + randomValue = (Rand_ZeroOne() * 35.0f) + 35.0f; + + position.x = (randomValue * sinValue) + this->dyna.actor.world.pos.x; + position.y = this->dyna.actor.world.pos.y + 10.0f; + position.z = (randomValue * cosValue) + this->dyna.actor.world.pos.z; + + velocity.x = sinValue; + velocity.y = 0.0f; + velocity.z = cosValue; + + acceleration.x = 0.0f; + acceleration.y = 0.5f; + acceleration.z = 0.0f; + + func_800286CC(play, &position, &velocity, &acceleration, ((Rand_ZeroOne() * 16) + 80), + ((Rand_ZeroOne() * 30) + 80)); } } @@ -240,9 +240,6 @@ void func_808B7D38(BgSpot18Basket* this) { } void func_808B7D50(BgSpot18Basket* this, PlayState* play) { - f32 tempValue2; - f32 tempValue; - if (this->unk_216 > 120) { Math_StepToS(&this->unk_210, 0x3E8, 0x32); } else { @@ -281,11 +278,12 @@ void func_808B7D50(BgSpot18Basket* this, PlayState* play) { func_808B7770(this, play, 0.8f); } - tempValue2 = (this->unk_210 - 500) * 0.0006f; + { + f32 tempValue2 = (this->unk_210 - 500) * 0.0006f; + f32 tempValue = CLAMP(tempValue2, 0.0f, 1.5f); - tempValue = CLAMP(tempValue2, 0.0f, 1.5f); - - func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, tempValue); + func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, tempValue); + } } void func_808B7F74(BgSpot18Basket* this) { @@ -308,9 +306,7 @@ void func_808B7F74(BgSpot18Basket* this) { void func_808B7FC0(BgSpot18Basket* this, PlayState* play) { s32 pad; s32 tempUnk214; - f32 tempUnk210; s16 arrayValue; - f32 clampedTempUnk210; this->unk_212 += 0xBB8; @@ -343,11 +339,12 @@ void func_808B7FC0(BgSpot18Basket* this, PlayState* play) { func_808B7770(this, play, 0.3f); } - tempUnk210 = (this->unk_210 - 500) * 0.0006f; + { + f32 tempUnk210 = (this->unk_210 - 500) * 0.0006f; + f32 clampedTempUnk210 = CLAMP(tempUnk210, 0.0f, 1.5f); - clampedTempUnk210 = CLAMP(tempUnk210, 0.0f, 1.5f); - - func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, clampedTempUnk210); + func_800F436C(&this->dyna.actor.projectedPos, NA_SE_EV_WALL_MOVE_SP - SFX_FLAG, clampedTempUnk210); + } } void func_808B818C(BgSpot18Basket* this) { diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 6b3d8095a8..4c284b9b15 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -111,7 +111,7 @@ s32 func_808B8910(BgSpot18Obj* this, PlayState* play) { case 2: PRINTF("Error : Obj出現判定が設定されていない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 202, this->dyna.actor.params); - break; + return 0; default: PRINTF("Error : Obj出現判定失敗(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot18_obj.c", 210, this->dyna.actor.params); @@ -235,11 +235,9 @@ void func_808B8E7C(BgSpot18Obj* this, PlayState* play) { void func_808B8EE0(BgSpot18Obj* this) { this->actionFunc = func_808B8F08; - this->dyna.actor.world.rot.y = 0; this->dyna.actor.speed = 0.0f; - this->dyna.actor.velocity.z = 0.0f; - this->dyna.actor.velocity.y = 0.0f; - this->dyna.actor.velocity.x = 0.0f; + this->dyna.actor.velocity.x = this->dyna.actor.velocity.y = this->dyna.actor.velocity.z = 0.0f; + this->dyna.actor.world.rot.y = 0; } void func_808B8F08(BgSpot18Obj* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index 706cbdee06..0b32afe5ee 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -171,10 +171,10 @@ void BgYdanHasi_Update(Actor* thisx, PlayState* play) { void BgYdanHasi_Draw(Actor* thisx, PlayState* play) { static Gfx* dLists[] = { gDTSlidingPlatformDL, gDTWaterPlaneDL, gDTRisingPlatformsDL }; - BgYdanHasi* this = (BgYdanHasi*)thisx; + s16 params = thisx->params; - if (this->dyna.actor.params == HASI_WATER_BLOCK || this->dyna.actor.params == HASI_THREE_BLOCKS) { - Gfx_DrawDListOpa(play, dLists[this->dyna.actor.params]); + if (params == HASI_WATER_BLOCK || params == HASI_THREE_BLOCKS) { + Gfx_DrawDListOpa(play, dLists[params]); } else { OPEN_DISPS(play->state.gfxCtx, "../z_bg_ydan_hasi.c", 577); diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 03114d1627..5441cae92f 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -417,6 +417,9 @@ void BgYdanSp_Draw(Actor* thisx, PlayState* play) { MtxF mtxF; OPEN_DISPS(play->state.gfxCtx, "../z_bg_ydan_sp.c", 781); + + if (1) {} + Gfx_SetupDL_25Xlu(play->state.gfxCtx); if (thisx->params == WEB_WALL) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_bg_ydan_sp.c", 787), diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 248357509c..3b7d2ee86c 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -1293,8 +1293,8 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) { s32 pad2; s16 i; s32 pad; - BossGanondrof* this = (BossGanondrof*)thisx; EnfHG* horse; + BossGanondrof* this = (BossGanondrof*)thisx; PRINTF("MOVE START %d\n", this->actor.params); this->actor.flags &= ~ACTOR_FLAG_10; @@ -1303,8 +1303,8 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - this->work[GND_VARIANCE_TIMER]++; horse = (EnfHG*)this->actor.child; + this->work[GND_VARIANCE_TIMER]++; PRINTF("MOVE START EEEEEEEEEEEEEEEEEEEEEE%d\n", this->actor.params); this->actionFunc(this, play); @@ -1520,6 +1520,7 @@ void BossGanondrof_Draw(Actor* thisx, PlayState* play) { BossGanondrof_PostLimbDraw, this); PRINTF("DRAW 22\n"); POLY_OPA_DISP = Play_SetFog(play, POLY_OPA_DISP); + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganondrof.c", 3814); PRINTF("DRAW END %d\n", this->actor.params); } diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index cb7f787c62..4de75e45a5 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -672,7 +672,8 @@ void BossGoma_SetupEncounterState4(BossGoma* this, PlayState* play) { void BossGoma_Encounter(BossGoma* this, PlayState* play) { Camera* mainCam; Player* player = GET_PLAYER(play); - s32 pad[2]; + f32 s; + s32 pad; Math_ApproachZeroF(&this->actor.speed, 0.5f, 2.0f); @@ -761,7 +762,8 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { } if (this->frameCount >= 228) { - mainCam = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; @@ -909,8 +911,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) { this->subCamAt.z = this->actor.world.pos.z; if (this->framesUntilNextAction != 0) { - f32 s = sinf(this->framesUntilNextAction * 3.1415f * 0.5f); - + s = sinf(this->framesUntilNextAction * 3.1415f * 0.5f); this->subCamAt.y = this->framesUntilNextAction * s * 0.7f + this->actor.world.pos.y; } else { Math_ApproachF(&this->subCamAt.y, this->actor.focus.pos.y, 0.1f, 10.0f); @@ -2047,9 +2048,8 @@ void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r static Vec3f zero = { 0.0f, 0.0f, 0.0f }; Vec3f childPos; Vec3s childRot; - EnGoma* babyGohma; BossGoma* this = (BossGoma*)thisx; - s32 pad; + s32 pad[2]; MtxF mtx; if (limbIndex == BOSSGOMA_LIMB_TAIL4) { // tail end/last part @@ -2073,6 +2073,8 @@ void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r } if (this->deadLimbsState[limbIndex] == 1) { + EnGoma* babyGohma; + this->deadLimbsState[limbIndex] = 2; Matrix_MultVec3f(&zero, &childPos); Matrix_Get(&mtx); diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 99447a19bb..eeedcb4e24 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -407,51 +407,14 @@ void BossMo_SetupTentacle(BossMo* this, PlayState* play) { } void BossMo_Tentacle(BossMo* this, PlayState* play) { - s16 tentXrot; - s16 sp1B4 = 0; - s32 buttons; - Player* player = GET_PLAYER(play); - s16 indS0; s16 indS1; - Camera* mainCam1; - Camera* mainCam2; - BossMo* otherTent = (BossMo*)this->otherTent; - f32 maxSwingRateX; - f32 maxSwingLagX; - f32 maxSwingSizeX; - f32 maxSwingRateZ; - f32 maxSwingLagZ; - f32 maxSwingSizeZ; - f32 swingRateAccel; - f32 swingSizeAccel; - s16 rippleCount; - s16 indT5; - Vec3f ripplePos; - f32 randAngle; - f32 randFloat; + s16 sp1B4 = 0; + Player* player = GET_PLAYER(play); f32 tempf1; f32 tempf2; f32 sin; f32 cos; - f32 temp; - f32 dx; - f32 dy; - f32 dz; - Vec3f sp138; - Vec3f sp12C; - Vec3f sp120; - s32 pad11C; - s32 pad118; - s32 pad114; - s32 pad110; - s32 pad10C; - s32 pad108; - Vec3f spFC; - Vec3f spF0; - f32 padEC; - Vec3f spE0; - Vec3f spD4; - Vec3f spC8; + BossMo* otherTent = (BossMo*)this->otherTent; if (this->work[MO_TENT_ACTION_STATE] <= MO_TENT_DEATH_3) { this->actor.world.pos.y = MO_WATER_LEVEL(play); @@ -460,6 +423,15 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { (this->work[MO_TENT_ACTION_STATE] >= MO_TENT_DEATH_START) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_RETREAT) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_SWING) || (this->work[MO_TENT_ACTION_STATE] == MO_TENT_SHAKE)) { + f32 maxSwingRateX; + f32 maxSwingLagX; + f32 maxSwingSizeX; + f32 maxSwingRateZ; + f32 maxSwingLagZ; + f32 maxSwingSizeZ; + f32 swingRateAccel; + f32 swingSizeAccel; + if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_READY) { if (sMorphaCore->csState != MO_BATTLE) { maxSwingRateX = 2000.0f; @@ -570,25 +542,33 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->timers[0] = 60; } } - if (this->timers[0] > 50) { - rippleCount = 1; - } else if (this->timers[0] > 40) { - rippleCount = 3; - } else if (this->timers[0] > 30) { - rippleCount = 5; - } else if (this->timers[0] > 20) { - rippleCount = 8; - } else { - rippleCount = 3; - } - for (indS1 = 0; indS1 < rippleCount; indS1++) { - randFloat = Rand_ZeroFloat(50.0f); - randAngle = Rand_ZeroFloat(0x10000); - ripplePos = this->actor.world.pos; - ripplePos.x += sinf(randAngle) * randFloat; - ripplePos.z += cosf(randAngle) * randFloat; - ripplePos.y = MO_WATER_LEVEL(play); - BossMo_SpawnRipple(play->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); + if (1) { + s16 rippleCount; + Vec3f ripplePos; + f32 randAngle; + f32 randFloat; + s32 pad; + + if (this->timers[0] > 50) { + rippleCount = 1; + } else if (this->timers[0] > 40) { + rippleCount = 3; + } else if (this->timers[0] > 30) { + rippleCount = 5; + } else if (this->timers[0] > 20) { + rippleCount = 8; + } else { + rippleCount = 3; + } + for (indS1 = 0; indS1 < rippleCount; indS1++) { + randFloat = Rand_ZeroFloat(50.0f); + randAngle = Rand_ZeroFloat(0x10000); + ripplePos = this->actor.world.pos; + ripplePos.x += sinf(randAngle) * randFloat; + ripplePos.z += cosf(randAngle) * randFloat; + ripplePos.y = MO_WATER_LEVEL(play); + BossMo_SpawnRipple(play->specialEffects, &ripplePos, 40.0f, 110.0f, 80, 290, MO_FX_SMALL_RIPPLE); + } } break; case MO_TENT_READY: @@ -634,7 +614,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->attackAngleMod = Rand_CenteredFloat(0x1000); } } else { - tentXrot = this->tentRot[28].x; + s16 tentXrot = this->tentRot[28].x; + if ((this->timers[0] == 0) && (tentXrot >= 0) && (sp1B4 < 0)) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_ATTACK; if (this == sMorphaTent1) { @@ -661,9 +642,10 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentMaxAngle, 0.5f, 1.0f, 0.01); Math_ApproachF(&this->tentSpeed, 160.0f, 1.0f, 50.0f); if ((this->timers[0] == 0) || (this->playerHitTimer != 0)) { - dx = this->tentPos[22].x - player->actor.world.pos.x; - dy = this->tentPos[22].y - player->actor.world.pos.y; - dz = this->tentPos[22].z - player->actor.world.pos.z; + f32 dx = this->tentPos[22].x - player->actor.world.pos.x; + f32 dy = this->tentPos[22].y - player->actor.world.pos.y; + f32 dz = this->tentPos[22].z - player->actor.world.pos.z; + if ((fabsf(dy) < 50.0f) && !HAS_LINK(otherTent) && (sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 120.0f)) { this->tentMaxAngle = .001f; this->work[MO_TENT_ACTION_STATE] = MO_TENT_CURL; @@ -765,7 +747,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachS(&player->actor.shape.rot.y, this->grabPosRot.rot.y, 2, 0x7D0); Math_ApproachS(&player->actor.shape.rot.z, this->grabPosRot.rot.z, 2, 0x7D0); if (this->timers[0] == 0) { - mainCam1 = Play_GetCamera(play, CAM_ID_MAIN); + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); + this->work[MO_TENT_ACTION_STATE] = MO_TENT_SHAKE; this->tentMaxAngle = .001f; this->fwork[MO_TENT_SWING_RATE_X] = this->fwork[MO_TENT_SWING_RATE_Z] = @@ -778,8 +761,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); - this->subCamEye = mainCam1->eye; - this->subCamAt = mainCam1->at; + this->subCamEye = mainCam->eye; + this->subCamAt = mainCam->at; this->subCamYaw = Math_FAtan2F(this->subCamEye.x - this->actor.world.pos.x, this->subCamEye.z - this->actor.world.pos.z); this->subCamYawRate = 0; @@ -798,12 +781,14 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } Math_ApproachF(&this->waterLevelMod, -5.0f, 0.1f, 0.4f); sp1B4 = this->tentRot[15].x; - buttons = play->state.input[0].press.button; - if (CHECK_BTN_ALL(buttons, BTN_A) || CHECK_BTN_ALL(buttons, BTN_B)) { + if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_A) || + CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B)) { this->mashCounter++; } for (indS1 = 0; indS1 < 41; indS1++) { if (indS1 < 20) { + f32 temp; + sin = Math_SinS(((s16)this->fwork[MO_TENT_SWING_LAG_X] * indS1) + this->xSwing); tempf1 = this->fwork[MO_TENT_SWING_SIZE_X] * (indS1 * 0.025f * sin); cos = Math_SinS(((s16)this->fwork[MO_TENT_SWING_LAG_Z] * indS1) + this->zSwing); @@ -828,7 +813,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentSpeed, 480.0f, 1.0f, 10.0f); Math_ApproachF(&this->tentPulse, 0.3f, 0.5f, 0.03f); if ((this->mashCounter >= 40) || (this->timers[0] == 0)) { - tentXrot = this->tentRot[15].x; + s16 tentXrot = this->tentRot[15].x; + if ((tentXrot < 0) && (sp1B4 >= 0)) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT; this->work[MO_TENT_INVINC_TIMER] = 50; @@ -844,6 +830,9 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } } if (this->subCamId != SUB_CAM_ID_DONE) { + Vec3f sp138; + Vec3f sp12C; + sp138.x = 0; sp138.y = 100.0f; sp138.z = 200.0f; @@ -869,6 +858,12 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } Math_ApproachF(&this->tentRippleSize, 0.15f, 0.5f, 0.01); if (this->meltIndex < 41) { + Vec3f sp120; + s16 indS0; + s32 pad118; + s32 pad114; + s32 pad110; + for (indS0 = 0; indS0 < 10; indS0++) { sp120 = this->tentPos[this->meltIndex]; sp120.x += Rand_CenteredFloat(30.0f); @@ -895,10 +890,11 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->subCamAt.z, player->actor.world.pos.z, 0.5f, 50.0f); Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); if (player->actor.world.pos.y <= 42.0f) { - mainCam2 = Play_GetCamera(play, CAM_ID_MAIN); - mainCam2->eye = this->subCamEye; - mainCam2->eyeNext = this->subCamEye; - mainCam2->at = this->subCamAt; + Camera* mainCam = Play_GetCamera(play, CAM_ID_MAIN); + + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; Play_ReturnToMainCam(play, this->subCamId, 0); this->subCamId = SUB_CAM_ID_DONE; Cutscene_StopManual(play, &play->csCtx); @@ -917,11 +913,14 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentMaxAngle, 0.5f, 1.0f, 0.01); Math_ApproachF(&this->tentSpeed, 320.0f, 1.0f, 50.0f); if (this->timers[0] == 0) { + s16 indS0; + Vec3f spFC; + Vec3f spF0; + this->actor.flags &= ~ACTOR_FLAG_0; Math_ApproachF(&this->baseAlpha, 0.0, 1.0f, 5.0f); for (indS1 = 0; indS1 < 40; indS1++) { - indT5 = Rand_ZeroFloat(20.9f); - indS0 = sTentSpawnIndex[indT5]; + indS0 = sTentSpawnIndex[(s16)Rand_ZeroFloat(20.9f)]; spFC.x = 0; spFC.y = 0; spFC.z = 0; @@ -1067,6 +1066,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachF(&this->tentSpeed, 0.1f, 1.0f, 0.005f); this->actor.velocity.y = 0.0; } else { + f32 padEC; + this->fwork[MO_TENT_MAX_STRETCH] = 0.2f; this->fwork[MO_TENT_MAX_STRETCH] += Math_SinS(this->work[MO_TENT_MOVE_TIMER] * 0x2000) * 0.05f; padEC = Math_CosS(this->work[MO_TENT_MOVE_TIMER] * 0x2000) * 0.0005f; @@ -1081,6 +1082,10 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->timers[0] = 60; Sfx_PlaySfxAtPos(&this->tentTipPos, NA_SE_EN_MOFER_CORE_JUMP); for (indS1 = 0; indS1 < 300; indS1++) { + Vec3f spE0; + Vec3f spD4; + Vec3f spC8; + spC8.x = 0.0; spC8.y = 0.0; spC8.z = indS1 * 0.03f; @@ -1137,11 +1142,11 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { void BossMo_TentCollisionCheck(BossMo* this, PlayState* play) { s16 i1; + s16 i2; + ColliderElement* acHitElem; for (i1 = 0; i1 < ARRAY_COUNT(this->tentElements); i1++) { if (this->tentCollider.elements[i1].base.bumperFlags & BUMP_HIT) { - s16 i2; - ColliderElement* acHitElem; for (i2 = 0; i2 < 19; i2++) { this->tentCollider.elements[i2].base.bumperFlags &= ~BUMP_HIT; @@ -1352,13 +1357,14 @@ void BossMo_IntroCs(BossMo* this, PlayState* play) { this->work[MO_TENT_ACTION_STATE] = MO_CORE_INTRO_REVEAL; this->actor.flags &= ~ACTOR_FLAG_0; sMorphaTent1->actor.flags |= ACTOR_FLAG_0; - } else { - sMorphaTent1->xSwing = 0xCEC; - sMorphaTent1->fwork[MO_TENT_SWING_RATE_X] = 0.0f; - sMorphaTent1->fwork[MO_TENT_SWING_LAG_X] = 1000.0f; - sMorphaTent1->fwork[MO_TENT_SWING_SIZE_X] = 2500.0f; - break; + goto intro_reveal; } + sMorphaTent1->xSwing = 0xCEC; + sMorphaTent1->fwork[MO_TENT_SWING_RATE_X] = 0.0f; + sMorphaTent1->fwork[MO_TENT_SWING_LAG_X] = 1000.0f; + sMorphaTent1->fwork[MO_TENT_SWING_SIZE_X] = 2500.0f; + break; + intro_reveal: case MO_INTRO_REVEAL: if (this->timers[2] >= 160) { this->subCamEye.x = 150.0f; @@ -1858,13 +1864,6 @@ void BossMo_Core(BossMo* this, PlayState* play) { s16 index; // not on stack f32 sp88; s32 pad84; - f32 sp80; - f32 sp7C; - Vec3f sp70; - Vec3f sp64; - f32 sp60; - f32 sp5C; - f32 sp58; this->waterTex1x += -1.0f; this->waterTex1y += -1.0f; @@ -2028,6 +2027,11 @@ void BossMo_Core(BossMo* this, PlayState* play) { Math_ApproachF(&this->actor.world.pos.z, this->targetPos.z, 0.5f, this->actor.speed); Math_ApproachF(&this->actor.speed, 30.0f, 1.0f, 1.0f); } else { + f32 sp80; + f32 sp7C; + Vec3f sp70; + Vec3f sp64; + switch (this->work[MO_TENT_ACTION_STATE]) { case MO_CORE_MOVE: sp80 = Math_SinS(this->work[MO_TENT_VAR_TIMER] * 0x800) * 100.0f; @@ -2165,6 +2169,9 @@ void BossMo_Core(BossMo* this, PlayState* play) { } else { this->timers[3] = 8; for (i = 0; i < 10; i++) { + f32 sp60; + f32 sp5C; + sp5C = Rand_ZeroFloat(3.14f); sp60 = Rand_ZeroFloat(0.6f) + 1.6f; effectVelocity.x = Math_SinS(((i * (f32)0x10000) / 10.0f) + sp5C) * sp60; @@ -2187,6 +2194,8 @@ void BossMo_Core(BossMo* this, PlayState* play) { } if ((this->actor.world.pos.y < MO_WATER_LEVEL(play)) || (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK)) { for (i = 0; i < 3; i++) { + f32 sp58; + effectAccel.x = effectAccel.z = 0.0f; effectVelocity.x = effectVelocity.y = effectVelocity.z = 0.0f; if (this->work[MO_TENT_ACTION_STATE] >= MO_CORE_ATTACK) { @@ -2725,7 +2734,6 @@ void BossMo_DrawTent(Actor* thisx, PlayState* play) { u16 texCoordScale; OPEN_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 6958); - if (1) {} Gfx_SetupDL_25Opa(play->state.gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, (s8)(this->baseAlpha * 1.5f)); gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0); @@ -2743,6 +2751,7 @@ void BossMo_DrawTent(Actor* thisx, PlayState* play) { if (this->drawActor) { BossMo_DrawTentacle(this, play); } + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_boss_mo.c", 7023); } diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index df893e790e..b36c58bd7e 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -363,10 +363,11 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { player->actor.world.pos.x = sRoomCenter.x; player->actor.world.pos.y = ROOM_CENTER_Y + 1000.0f; player->actor.world.pos.z = sRoomCenter.z; - player->speedXZ = player->actor.velocity.y = 0.0f; + player->speedXZ = 0.0f; player->actor.shape.rot.y = -0x8000; player->zTargetYaw = -0x8000; player->yaw = -0x8000; + player->actor.velocity.y = 0.0f; player->fallStartHeight = 0; player->stateFlags1 |= PLAYER_STATE1_5; @@ -654,8 +655,10 @@ void BossSst_HeadNeutral(BossSst* this, PlayState* play) { } if (this->timer == 0) { - if ((GET_PLAYER(play)->actor.world.pos.y > -50.0f) && - !(GET_PLAYER(play)->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14))) { + Player* player = GET_PLAYER(play); + + if ((player->actor.world.pos.y > -50.0f) && + !(player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_13 | PLAYER_STATE1_14))) { sHands[Rand_ZeroOne() <= 0.5f]->ready = true; BossSst_HeadSetupWait(this); } else { @@ -825,9 +828,8 @@ void BossSst_HeadSetupStunned(BossSst* this) { } void BossSst_HeadStunned(BossSst* this, PlayState* play) { - f32 bounce; - s32 animFinish; f32 currentFrame; + s32 animFinish; Math_StepToF(&sHandOffsets[LEFT].z, 600.0f, 20.0f); Math_StepToF(&sHandOffsets[RIGHT].z, 600.0f, 20.0f); @@ -837,7 +839,8 @@ void BossSst_HeadStunned(BossSst* this, PlayState* play) { animFinish = SkelAnime_Update(&this->skelAnime); currentFrame = this->skelAnime.curFrame; if (currentFrame <= 6.0f) { - bounce = (sinf((M_PI / 11) * currentFrame) * 100.0f) + (this->actor.home.pos.y - 180.0f); + f32 bounce = (sinf((M_PI / 11) * currentFrame) * 100.0f) + (this->actor.home.pos.y - 180.0f); + if (this->actor.world.pos.y < bounce) { this->actor.world.pos.y = bounce; } @@ -1565,7 +1568,6 @@ void BossSst_HandSetupSweep(BossSst* this) { void BossSst_HandSweep(BossSst* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 newTargetYaw; SkelAnime_Update(&this->skelAnime); this->handAngSpeed += 0x60; @@ -1575,6 +1577,8 @@ void BossSst_HandSweep(BossSst* this, PlayState* play) { this->colliderJntSph.base.ocFlags1 &= ~OC1_NO_PUSH; BossSst_HandSetupRetreat(this); } else if (this->colliderJntSph.base.atFlags & AT_HIT) { + s16 newTargetYaw; + this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->ready = true; func_8002F71C(play, &this->actor, 5.0f, this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); @@ -2772,57 +2776,41 @@ void BossSst_DrawHand(Actor* thisx, PlayState* play) { s32 BossSst_OverrideHeadDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { BossSst* this = (BossSst*)thisx; - s32 shakeAmp; - s32 pad; - s32 timer12; - f32 shakeMod; if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_REACT_TO_LENS) && this->vVanish) { *dList = NULL; } else if (this->actionFunc == BossSst_HeadThrash) { // Animation modifications for death cutscene - shakeAmp = (this->timer / 10) + 1; + s32 shakeAmp = (this->timer / 10) + 1; + if ((limbIndex == 3) || (limbIndex == 39) || (limbIndex == 42)) { - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf((this->timer % 5) * (M_PI / 5)); - rot->z -= ((0x800 * Rand_ZeroOne() + 0x1000) / 0x10) * shakeAmp * shakeMod + 0x1000; + rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->z -= + ((0x800 * Rand_ZeroOne() + 0x1000) / 0x10) * shakeAmp * sinf((this->timer % 5) * (M_PI / 5)) + 0x1000; if (limbIndex == 3) { - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; + rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); } } else if ((limbIndex == 5) || (limbIndex == 6)) { - - shakeMod = sinf((this->timer % 5) * (M_PI / 5)); - rot->z -= ((0x280 * Rand_ZeroOne() + 0x500) / 0x10) * shakeAmp * shakeMod + 0x500; + rot->z -= + ((0x280 * Rand_ZeroOne() + 0x500) / 0x10) * shakeAmp * sinf((this->timer % 5) * (M_PI / 5)) + 0x500; if (limbIndex == 5) { - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * shakeMod; + rot->x += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->y += ((0x500 * Rand_ZeroOne() + 0xA00) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); } } else if (limbIndex == 2) { - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->x += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf(this->timer * (M_PI / 5)); - rot->y += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * shakeMod; - - shakeMod = sinf((this->timer % 5) * (M_PI / 5)); - rot->z -= ((0x100 * Rand_ZeroOne() + 0x200) / 0x10) * shakeAmp * shakeMod + 0x200; + rot->x += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->y += ((0x200 * Rand_ZeroOne() + 0x400) / 0x10) * shakeAmp * sinf(this->timer * (M_PI / 5)); + rot->z -= + ((0x100 * Rand_ZeroOne() + 0x200) / 0x10) * shakeAmp * sinf((this->timer % 5) * (M_PI / 5)) + 0x200; } } else if (this->actionFunc == BossSst_HeadDeath) { + s32 timer12; + if (this->timer > 48) { timer12 = this->timer - 36; } else { - pad = ((this->timer > 6) ? 6 : this->timer); - timer12 = pad * 2; + timer12 = ((this->timer > 6) ? 6 : this->timer) * 2; } if ((limbIndex == 3) || (limbIndex == 39) || (limbIndex == 42)) { @@ -2947,14 +2935,16 @@ void BossSst_SpawnHeadShadow(BossSst* this) { s32 i; f32 sn; f32 cs; + BossSstEffect* shadow; + Vec3f* offset; this->effectMode = BONGO_SHADOW; sn = Math_SinS(this->actor.shape.rot.y); cs = Math_CosS(this->actor.shape.rot.y); for (i = 0; i < 3; i++) { - BossSstEffect* shadow = &this->effects[i]; - Vec3f* offset = &shadowOffset[i]; + shadow = &this->effects[i]; + offset = &shadowOffset[i]; shadow->pos.x = this->actor.world.pos.x + (sn * offset->z) + (cs * offset->x); shadow->pos.y = 0.0f; @@ -2983,12 +2973,13 @@ void BossSst_SpawnShockwave(BossSst* this) { s32 i; s32 scale = 120; s32 alpha = 250; + BossSstEffect* shockwave; Actor_PlaySfx(&this->actor, NA_SE_EN_SHADEST_HAND_WAVE); this->effectMode = BONGO_SHOCKWAVE; for (i = 0; i < 3; i++) { - BossSstEffect* shockwave = &this->effects[i]; + shockwave = &this->effects[i]; Math_Vec3f_Copy(&shockwave->pos, &this->actor.world.pos); shockwave->move = (i + 9) * 2; @@ -3049,6 +3040,7 @@ void BossSst_SpawnIceShard(BossSst* this) { s32 i; Vec3f spawnPos; f32 offXZ; + BossSstEffect* ice; this->effectMode = BONGO_ICE; offXZ = Math_CosS(this->actor.shape.rot.x) * 50.0f; @@ -3057,7 +3049,7 @@ void BossSst_SpawnIceShard(BossSst* this) { spawnPos.z = Math_SinS(this->actor.shape.rot.y) * offXZ + this->actor.world.pos.z; for (i = 0; i < 18; i++) { - BossSstEffect* ice = &this->effects[i]; + ice = &this->effects[i]; Math_Vec3f_Copy(&ice->pos, &spawnPos); ice->status = 1; @@ -3120,9 +3112,12 @@ void BossSst_UpdateEffects(Actor* thisx, PlayState* play) { this->effectMode = BONGO_NULL; } } else if (this->effectMode == BONGO_SHOCKWAVE) { + BossSstEffect* effect2; + s32 scale; + for (i = 0; i < 3; i++) { - BossSstEffect* effect2 = &this->effects[i]; - s32 scale = effect2->move * 2; + effect2 = &this->effects[i]; + scale = effect2->move * 2; effect2->scale += CLAMP_MAX(scale, 20) + i; if (effect2->move != 0) { diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index c01a1b590e..abf3fc96e5 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -790,7 +790,6 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { Vec3f offset; Vec3f beamDistFromPlayer; Player* player = GET_PLAYER(play); - s16 i; offset.x = player->actor.world.pos.x - this->beamOrigin.x; offset.y = player->actor.world.pos.y - this->beamOrigin.y; @@ -812,6 +811,8 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { sFreezeState = 1; } } else if (!player->bodyIsBurning) { + s16 i; + for (i = 0; i < PLAYER_BODYPART_MAX; i++) { player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } @@ -3301,6 +3302,8 @@ void func_80941BC0(BossTw* this, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaEffectHaloDL)); Matrix_Pop(); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6461); } @@ -3533,9 +3536,10 @@ void BossTw_Draw(Actor* thisx, PlayState* play2) { } if (this->actor.params == TW_KOTAKE) { + Vec3f diff; + if (this->workf[UNK_F9] > 0.0f) { if (this->workf[UNK_F11] > 0.0f) { - Vec3f diff; diff.x = this->groundBlastPos2.x - player->actor.world.pos.x; diff.y = this->groundBlastPos2.y - player->actor.world.pos.y; diff.z = this->groundBlastPos2.z - player->actor.world.pos.z; @@ -3564,6 +3568,8 @@ void BossTw_Draw(Actor* thisx, PlayState* play2) { } } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7123); } @@ -4077,7 +4083,7 @@ void BossTw_BlastFire(BossTw* this, PlayState* play) { break; } - { + if (1) { f32 sp4C = sGroundBlastType == 2 ? 3.0f : 1.0f; Math_ApproachF(&sKoumePtr->workf[UNK_F9], 0.0f, 1.0f, 10.0f * sp4C); @@ -4231,6 +4237,8 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) { case TW_ICE_BLAST_GROUND: if (this->timers[0] != 0) { + s32 pad; + if (this->timers[0] == 1) { sEnvType = 0; } @@ -4242,7 +4250,6 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); if (this->timers[0] > (sTwinrovaPtr->actionFunc == BossTw_Wait ? 70 : 20)) { - s32 pad; Vec3f pos; Vec3f velocity; Vec3f accel; @@ -4320,12 +4327,13 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) { s32 BossTw_BlastShieldCheck(BossTw* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 ret = false; - ColliderElement* acHitElem; if (1) {} if (this->csState1 == 1) { if (this->collider.base.acFlags & AC_HIT) { + ColliderElement* acHitElem; + this->collider.base.acFlags &= ~AC_HIT; this->collider.base.atFlags &= ~AT_HIT; acHitElem = this->collider.elem.acHitElem; @@ -4565,17 +4573,6 @@ void BossTw_UpdateEffects(PlayState* play) { s16 j; s16 colorIdx; Vec3f off; - Vec3f spF4; - Vec3f spE8; - Vec3f spDC; - Vec3f spD0; - f32 phi_f22; - Vec3f spC0; - Vec3f spB4; - Vec3f spA8; - s16 spA6; - f32 phi_f0; - Actor* unk44; for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) { if (eff->type != TWEFF_NONE) { @@ -4654,6 +4651,10 @@ void BossTw_UpdateEffects(PlayState* play) { off.z = sTwinrovaPtr->actor.world.pos.z - eff->pos.z; if (sTwinrovaPtr->actionFunc != BossTw_TwinrovaStun) { + Vec3f spF4; + Vec3f spE8; + Vec3f spDC; + if ((SQ(off.x) + SQ(off.y) + SQ(off.z)) < SQ(60.0f)) { for (j = 0; j < 50; j++) { spF4.x = sTwinrovaPtr->actor.world.pos.x + Rand_CenteredFloat(35.0f); @@ -4715,6 +4716,8 @@ void BossTw_UpdateEffects(PlayState* play) { Math_ApproachF(&eff->workf[EFF_DIST], 1000.0f, 1.0f, 10.0f); if (eff->work[EFF_UNKS1] >= 0x10) { if ((eff->work[EFF_UNKS1] == 16) && (sp113 == 0)) { + Vec3f spD0; + sp113 = 1; spD0 = eff->pos; if (eff->pos.y > 40.0f) { @@ -4722,8 +4725,7 @@ void BossTw_UpdateEffects(PlayState* play) { } else { spD0.y = -50.0f; } - sTwinrovaPtr->groundBlastPos.y = phi_f0 = BossTw_GetFloorY(&spD0); - if (phi_f0 >= 0.0f) { + if ((sTwinrovaPtr->groundBlastPos.y = BossTw_GetFloorY(&spD0)) >= 0.0f) { if (sTwinrovaPtr->groundBlastPos.y != 35.0f) { sTwinrovaPtr->groundBlastPos.x = eff->pos.x; sTwinrovaPtr->groundBlastPos.z = eff->pos.z; @@ -4790,7 +4792,7 @@ void BossTw_UpdateEffects(PlayState* play) { } } else if (eff->type == TWEFF_PLYR_FRZ) { if (eff->work[EFF_ARGS] < eff->frame) { - phi_f0 = 1.0f; + f32 phi_f0 = 1.0f; if (eff->target != NULL || sGroundBlastType == 1) { phi_f0 *= 3.0f; @@ -4834,7 +4836,11 @@ void BossTw_UpdateEffects(PlayState* play) { } if ((eff->workf[EFF_DIST] > 0.4f) && ((eff->frame & 7) == 0)) { - spA6 = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); + Vec3f spC0; + Vec3f spB4; + Vec3f spA8; + s16 spA6 = Rand_ZeroFloat(PLAYER_BODYPART_MAX - 0.1f); + f32 phi_f22; if (eff->target == NULL) { spC0.x = player->bodyPartsPos[spA6].x + Rand_CenteredFloat(5.0f); @@ -4842,7 +4848,8 @@ void BossTw_UpdateEffects(PlayState* play) { spC0.z = player->bodyPartsPos[spA6].z + Rand_CenteredFloat(5.0f); phi_f22 = 10.0f; } else { - unk44 = eff->target; + Actor* unk44 = eff->target; + spC0.x = unk44->world.pos.x + Rand_CenteredFloat(40.0f); spC0.y = unk44->world.pos.y + Rand_CenteredFloat(40.0f); spC0.z = unk44->world.pos.z + Rand_CenteredFloat(40.0f); @@ -4899,10 +4906,11 @@ void BossTw_DrawEffects(PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); s16 phi_s4; - BossTwEffect* currentEffect = play->specialEffects; + BossTwEffect* currentEffect; BossTwEffect* effectHead; GraphicsContext* gfxCtx = play->state.gfxCtx; + currentEffect = play->specialEffects; effectHead = currentEffect; OPEN_DISPS(gfxCtx, "../z_boss_tw.c", 9592); @@ -5028,10 +5036,10 @@ void BossTw_DrawEffects(PlayState* play) { currentEffect = effectHead; for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) { - Actor* actor; - Vec3f off; - if (currentEffect->type == TWEFF_PLYR_FRZ) { + Actor* actor; + Vec3f off; + if (materialFlag == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceSurroundingPlayerMaterialDL)); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255); @@ -5204,7 +5212,7 @@ void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play) { sEnvType = twMagic->blastType + 1; - { + if (1) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 554c45e5ae..7b189e8754 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -1121,7 +1121,6 @@ void BossVa_SetupBodyPhase2(BossVa* this, PlayState* play) { void BossVa_BodyPhase2(BossVa* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f sp48; if (this->actor.colorFilterTimer == 0) { sPhase2Timer++; @@ -1166,7 +1165,8 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { } if ((sPhase2Timer > 10) && !(sPhase2Timer & 7) && (this->actor.speed == 1.0f)) { - sp48 = this->actor.world.pos; + Vec3f sp48 = this->actor.world.pos; + sp48.y += 310.0f + (this->actor.shape.yOffset * this->actor.scale.y); sp48.x += -10.0f; sp48.z += 220.0f; @@ -1918,19 +1918,6 @@ void BossVa_ZapperAttack(BossVa* this, PlayState* play) { u32 sp88; Vec3f sp7C; s32 pad3; - f32 sp74; - s32 i; - s16 sp6E; - s16 sp6C; - f32 sp68; - f32 sp64; - f32 sp60; - f32 sp5C; - s16 sp5A; - s16 sp58; - s16 sp56; - s16 sp54; - f32 sp50; boomerang = BossVa_FindBoomerang(play); @@ -1939,6 +1926,20 @@ void BossVa_ZapperAttack(BossVa* this, PlayState* play) { sp7C.y += 10.0f; sp8E = 0x3E80; } else { + f32 sp74; + s32 i; + s16 sp6E; + s16 sp6C; + f32 sp68; + f32 sp64; + f32 sp60; + f32 sp5C; + s16 sp5A; + s16 sp58; + s16 sp56; + s16 sp54; + f32 sp50; + sp74 = R_UPDATE_RATE * 0.5f; sp8E = 0x4650; @@ -3148,6 +3149,8 @@ void BossVa_BariPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* gSPDisplayList(POLY_XLU_DISP++, *dList); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 4517); } @@ -3279,10 +3282,6 @@ void BossVa_UpdateEffects(PlayState* play) { s16 spB6; s16 i; f32 spB0; - f32 spAC; - s16 pitch; - BossVa* refActor2; - BossVa* refActor; for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) { if (effect->type == VA_NONE) { @@ -3300,15 +3299,16 @@ void BossVa_UpdateEffects(PlayState* play) { effect->velocity.z += effect->accel.z; if ((effect->type == VA_LARGE_SPARK) || (effect->type == VA_SMALL_SPARK)) { - refActor = effect->parent; + BossVa* refActor = effect->parent; effect->rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x2000; effect->rot.y += (s16)(Rand_ZeroOne() * 0x2710) + 0x2000; if ((effect->mode == SPARK_TETHER) || (effect->mode == SPARK_UNUSED)) { - pitch = effect->rot.x - Math_Vec3f_Pitch(&refActor->actor.world.pos, &GET_BODY(refActor)->unk_1D8); - spAC = Math_SinS(refActor->actor.world.rot.y); - effect->pos.x = refActor->actor.world.pos.x - (effect->offset.x * spAC); + s16 pitch = effect->rot.x - Math_Vec3f_Pitch(&refActor->actor.world.pos, &GET_BODY(refActor)->unk_1D8); + + spB0 = Math_SinS(refActor->actor.world.rot.y); + effect->pos.x = refActor->actor.world.pos.x - (effect->offset.x * spB0); spB0 = Math_CosS(refActor->actor.world.rot.y); effect->pos.z = refActor->actor.world.pos.z - (effect->offset.x * spB0); spB0 = Math_CosS(-pitch); @@ -3347,13 +3347,13 @@ void BossVa_UpdateEffects(PlayState* play) { } if (effect->type == VA_SPARK_BALL) { - refActor2 = effect->parent; + BossVa* refActor = effect->parent; effect->rot.z += (s16)(Rand_ZeroOne() * 0x2710) + 0x24A8; - effect->pos.x = effect->offset.x + refActor2->actor.world.pos.x; + effect->pos.x = effect->offset.x + refActor->actor.world.pos.x; effect->pos.y = - refActor2->actor.world.pos.y + 310.0f + (refActor2->actor.shape.yOffset * refActor2->actor.scale.y); - effect->pos.z = effect->offset.z + refActor2->actor.world.pos.z; + refActor->actor.world.pos.y + 310.0f + (refActor->actor.shape.yOffset * refActor->actor.scale.y); + effect->pos.z = effect->offset.z + refActor->actor.world.pos.z; effect->mode = (effect->mode + 1) & 7; if (effect->timer < 100) { @@ -3378,9 +3378,9 @@ void BossVa_UpdateEffects(PlayState* play) { if (effect->type == VA_BLOOD) { if (effect->mode < BLOOD_SPOT) { + f32 floorY; Vec3f checkPos; CollisionPoly* groundPoly; - f32 floorY; checkPos = effect->pos; checkPos.y -= effect->velocity.y + 4.0f; @@ -3415,9 +3415,9 @@ void BossVa_UpdateEffects(PlayState* play) { if (effect->type == VA_GORE) { if (effect->mode == GORE_PERMANENT) { + f32 floorY; Vec3f checkPos; CollisionPoly* groundPoly; - f32 floorY; checkPos = effect->pos; checkPos.y -= effect->velocity.y + 4.0f; @@ -3452,10 +3452,9 @@ void BossVa_UpdateEffects(PlayState* play) { } if (effect->type == VA_TUMOR) { + BossVa* refActor = effect->parent; s16 yaw; - refActor = effect->parent; - effect->rot.z += 0x157C; effect->envColor[3] = (s16)(Math_SinS(effect->rot.z) * 50.0f) + 80; Math_SmoothStepToF(&effect->scale, effect->scaleMod, 1.0f, 0.01f, 0.005f); @@ -3982,7 +3981,7 @@ void BossVa_DrawDoor(PlayState* play, s16 scale) { Matrix_Get(&doorMtx); - for (i = 0; i < 8; i++, segAngle -= M_PI / 4) { + for (i = 0; i < 8; i++) { Matrix_Put(&doorMtx); Matrix_RotateZ(segAngle, MTXMODE_APPLY); Matrix_Translate(0.0f, doorPieceLength[i] * yScale, 0.0f, MTXMODE_APPLY); @@ -3990,6 +3989,7 @@ void BossVa_DrawDoor(PlayState* play, s16 scale) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_boss_va.c", 5621), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, doorPieceDispList[i]); + segAngle -= M_PI / 4; } CLOSE_DISPS(play->state.gfxCtx, "../z_boss_va.c", 5629); diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 1a8b35ee4a..c2b949c27c 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -775,8 +775,6 @@ void func_80968FB0(Actor* thisx, PlayState* play) { f32 scaleFactor; s32 pad; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_demo_6k.c", 1386); Gfx_SetupDL_25Xlu(play->state.gfxCtx); @@ -787,6 +785,7 @@ void func_80968FB0(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, displayList); gDPPipeSync(displayList++); + if (displayList) {} gDPSetPrimColor(displayList++, 0, 0x80, 255, 255, 255, this->unk_293); gDPSetRenderMode(displayList++, G_RM_PASS, G_RM_ZB_CLD_SURF2); gSPEndDisplayList(displayList++); diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index d5ff49ceb5..6be44f199a 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -68,6 +68,7 @@ void DemoDu_SetMouthTexIndex(DemoDu* this, s16 mouthTexIndex) { this->mouthTexIndex = mouthTexIndex; } +#if OOT_DEBUG // Resets all the values used in this cutscene. void DemoDu_CsAfterGanon_Reset(DemoDu* this) { this->updateIndex = CS_CHAMBERAFTERGANON_SUBSCENE(0); @@ -87,12 +88,12 @@ void DemoDu_CsAfterGanon_CheckIfShouldReset(DemoDu* this, PlayState* play) { DemoDu_CsAfterGanon_Reset(this); } D_8096CE94 = false; - return; } } else if (!D_8096CE94) { D_8096CE94 = true; } } +#endif s32 DemoDu_UpdateSkelAnime(DemoDu* this) { return SkelAnime_Update(&this->skelAnime); @@ -104,8 +105,11 @@ void DemoDu_UpdateBgCheckInfo(DemoDu* this, PlayState* play) { CsCmdActorCue* DemoDu_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -774,7 +778,9 @@ void DemoDu_CsAfterGanon_BackTo01(DemoDu* this, PlayState* play) { void DemoDu_UpdateCs_AG_00(DemoDu* this, PlayState* play) { DemoDu_CsAfterGanon_AdvanceTo01(this, play); +#if OOT_DEBUG DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); +#endif } void DemoDu_UpdateCs_AG_01(DemoDu* this, PlayState* play) { @@ -782,7 +788,9 @@ void DemoDu_UpdateCs_AG_01(DemoDu* this, PlayState* play) { DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsAfterGanon_AdvanceTo02(this, play); +#if OOT_DEBUG DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); +#endif } void DemoDu_UpdateCs_AG_02(DemoDu* this, PlayState* play) { @@ -790,7 +798,9 @@ void DemoDu_UpdateCs_AG_02(DemoDu* this, PlayState* play) { DemoDu_UpdateSkelAnime(this); DemoDu_UpdateEyes(this); DemoDu_CsAfterGanon_BackTo01(this, play); +#if OOT_DEBUG DemoDu_CsAfterGanon_CheckIfShouldReset(this, play); +#endif } // Similar to DemoDu_Draw_01, but this uses POLY_XLU_DISP. Also uses this->shadowAlpha for setting the env color. diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 91dc9bf45b..fa4879e26c 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -334,10 +334,12 @@ void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { CsCmdActorCue* DemoEc_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; - } else { - return NULL; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + + return NULL; } void DemoEc_SetStartPosRotFromCue(DemoEc* this, PlayState* play, s32 cueChannel) { diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 7a7c8be056..e5db2e88a0 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -1808,21 +1808,21 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; - u8* alpha; - Gfx* disp; + uintptr_t flashDList = (uintptr_t)gEffFlash1DL; + s32 pad2; OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2842); if (!DemoEffect_CheckForCue(this, play, 1)) { - if (this->light.flicker == 0) { this->light.flicker = 1; } else { - disp = (Gfx*)(uintptr_t)gEffFlash1DL; // necessary to match but probably fake - alpha = &this->light.alpha; Gfx_SetupDL_25Xlu(play->state.gfxCtx); + // `(*this).light.alpha` is probably fake and indicates that `alpha` + // may have been part of an array (possibly a "workbuf" array + // instead of the union of structs we have now). gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, this->primXluColor[0], this->primXluColor[1], - this->primXluColor[2], *alpha); + this->primXluColor[2], (*this).light.alpha); gDPSetEnvColor(POLY_XLU_DISP++, this->envXluColor[0], this->envXluColor[1], this->envXluColor[2], 255); Matrix_Scale(((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, ((this->light.scaleFlag & 1) * 0.05f) + 1.0f, MTXMODE_APPLY); @@ -1831,14 +1831,13 @@ void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play) { Matrix_RotateZ(DEG_TO_RAD(this->light.rotation), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2866), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); - if (disp) {}; - gSPDisplayList(POLY_XLU_DISP++, disp); + gSPDisplayList(POLY_XLU_DISP++, flashDList); Matrix_Pop(); Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(-(f32)this->light.rotation), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_demo_effect.c", 2874), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, disp); + gSPDisplayList(POLY_XLU_DISP++, flashDList); } } @@ -2004,8 +2003,8 @@ s32 DemoEffect_OverrideLimbDrawTimeWarp(PlayState* play, SkelCurve* skelCurve, s } void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { - DemoEffect* this = (DemoEffect*)thisx; GraphicsContext* gfxCtx = play->state.gfxCtx; + DemoEffect* this = (DemoEffect*)thisx; u8 effectType = (this->actor.params & 0x00FF); if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL || diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index 1189fd3bc1..b80f419979 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -52,7 +52,9 @@ void DemoExt_PlayVortexSFX(DemoExt* this) { CsCmdActorCue* DemoExt_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } return NULL; diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index 7bbd6c7ea4..ee75d038d7 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -165,7 +165,9 @@ void func_809782A0(DemoGeff* this, PlayState* play) { void func_80978308(DemoGeff* this, PlayState* play) { func_809781FC(this, play); func_809782A0(this, play); +#if OOT_DEBUG func_80978030(this, play); +#endif } void func_80978344(DemoGeff* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 867bd9aeb5..3df0db29d0 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -263,7 +263,7 @@ s32 DemoGj_InitSetIndices(DemoGj* this, PlayState* play, s32 updateMode, s32 dra } void DemoGj_DrawCommon(DemoGj* this, PlayState* play, Gfx* displayList) { - if (kREG(0) == 0) { + if (!OOT_DEBUG || kREG(0) == 0) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_demo_gj.c", 1163); @@ -454,7 +454,7 @@ s32 DemoGj_IsGanondorfFloatingInAir(DemoGj* this, PlayState* play) { void DemoGj_SetupMovement(DemoGj* this, PlayState* play) { Actor* actor = &this->dyna.actor; - Player* player; + s32 pad; Vec3f* pos = &actor->world.pos; Vec3s* unk_172; f32 xDistance; @@ -544,7 +544,8 @@ void DemoGj_SetupMovement(DemoGj* this, PlayState* play) { } if (xDistance == 0.0f && zDistance == 0.0f) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); + xDistance = player->actor.world.pos.x - pos->x; zDistance = player->actor.world.pos.z - pos->z; @@ -974,8 +975,10 @@ void DemoGj_InitDestructableRubble1(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit1); } +#if OOT_DEBUG void DemoGj_DoNothing1(DemoGj* this, PlayState* play) { } +#endif /* * Moves the ColliderCylinder's relative to the actor's position. @@ -1092,7 +1095,9 @@ void DemoGj_Update15(DemoGj* this, PlayState* play) { // func_8097B370 void DemoGj_Update18(DemoGj* this, PlayState* play) { func_8097B22C(this, play); +#if OOT_DEBUG DemoGj_DoNothing1(this, play); +#endif } void DemoGj_DrawDestructableRubble1(DemoGj* this, PlayState* play) { @@ -1107,8 +1112,10 @@ void DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[2], &sCylinderInit2); } +#if OOT_DEBUG void DemoGj_DoNothing2(DemoGj* this, PlayState* play) { } +#endif // Moves the ColliderCylinder's relative to the actor's position. void func_8097B450(DemoGj* this, PlayState* play) { @@ -1223,7 +1230,9 @@ void DemoGj_Update16(DemoGj* this, PlayState* play) { // func_8097B894 void DemoGj_Update19(DemoGj* this, PlayState* play) { func_8097B750(this, play); +#if OOT_DEBUG DemoGj_DoNothing2(this, play); +#endif } void DemoGj_DemoGj_InitDestructableRubble2(DemoGj* this, PlayState* play) { @@ -1236,8 +1245,10 @@ void DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { DemoGj_InitCylinder(this, play, &this->cylinders[0], &sCylinderInit3); } +#if OOT_DEBUG void DemoGj_DoNothing3(DemoGj* this, PlayState* play) { } +#endif void DemoGj_DirectedDoubleExplosion(DemoGj* this, PlayState* play, Vec3f* direction) { Vec3f pos; @@ -1308,7 +1319,9 @@ void DemoGj_Update17(DemoGj* this, PlayState* play) { // func_8097BBA8 void DemoGj_Update20(DemoGj* this, PlayState* play) { func_8097BA48(this, play); +#if OOT_DEBUG DemoGj_DoNothing3(this, play); +#endif } void DemoGj_DemoGj_InitDestructableRubbleTall(DemoGj* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 730b63d49c..432b8ce63d 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -209,9 +209,12 @@ s32 func_8097CDB0(DemoGo* this, PlayState* play, u16 cueId) { CutsceneContext* csCtx = &play->csCtx; s32 cueChannel = DemoGo_GetCueChannel(this); - if ((csCtx->state != CS_STATE_IDLE) && (csCtx->actorCues[cueChannel] != NULL) && - (csCtx->actorCues[cueChannel]->id == cueId)) { - return true; + if (csCtx->state != CS_STATE_IDLE) { + CsCmdActorCue* cue = csCtx->actorCues[cueChannel]; + + if (cue != NULL && cue->id == cueId) { + return true; + } } return false; @@ -341,13 +344,13 @@ void func_8097D29C(DemoGo* this, PlayState* play) { s16 eyeTexIdx = this->unk_190; SkelAnime* skelAnime = &this->skelAnime; void* eyeTexture = sEyeTextures[eyeTexIdx]; - void* mouthTexture = gGoronCsMouthSmileTex; + s32 pad2; OPEN_DISPS(play->state.gfxCtx, "../z_demo_go.c", 732); Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTexture)); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(mouthTexture)); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthSmileTex)); SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, this); diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 5190d79c69..c3ce4fa67a 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -265,7 +265,6 @@ void func_8097E454(PlayState* play, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* a s16 phi_s0; s16 dustScaleStep = 15.0f * scale; f32 dustScale = 300.0f * scale; - Vec3f pos; if ((!FrameAdvance_IsEnabled(play)) && (arg7 > 0) && (arg6 > 0)) { frames = (ABS((s32)play->gameplayFrames) % arg7); @@ -273,6 +272,7 @@ void func_8097E454(PlayState* play, Vec3f* spawnerPos, Vec3f* velocity, Vec3f* a increment = 0x10000 / arg6; for (i = frames; i < arg6; i += arg7) { + Vec3f pos; pos.x = (Math_SinS(phi_s0) * arg4) + spawnerPos->x; pos.y = spawnerPos->y; @@ -437,7 +437,7 @@ void func_8097ED64(DemoGt* this, PlayState* play, s32 cueChannel) { } u8 DemoGt_IsCutsceneLayer(void) { - if (kREG(2) != 0) { + if (OOT_DEBUG && (kREG(2) != 0)) { return true; } else if (!IS_CUTSCENE_LAYER) { return false; @@ -503,7 +503,7 @@ void func_8097EF40(DemoGt* this, PlayState* play) { Vec3f* pos = &this->dyna.actor.world.pos; s32 pad; - if ((kREG(1) == 20) || (csCurFrame == 220)) { + if ((OOT_DEBUG && (kREG(1) == 20)) || (csCurFrame == 220)) { dustPos.x = pos->x + 256.0f; dustPos.y = pos->y + 679.0f; dustPos.z = pos->z + 82.0f; @@ -526,7 +526,12 @@ void func_8097F0AC(DemoGt* this, PlayState* play) { u16 csCurFrame = play->csCtx.curFrame; s32 pad2; - if ((csCurFrame == 140) || (kREG(1) == 19)) { +#if OOT_DEBUG + if (csCurFrame == 140 || kREG(1) == 19) +#else + if (csCurFrame == 140) +#endif + { sp38.x = this->dyna.actor.world.pos.x + 260.0f; sp38.y = this->dyna.actor.world.pos.y + 340.0f; sp38.z = this->dyna.actor.world.pos.z + 45.0f; @@ -562,7 +567,6 @@ void func_8097F280(DemoGt* this, PlayState* play) { s32* unk178 = this->unk_178; s32* unk188 = this->unk_188; s32* unk198 = this->unk_198; - f32 temp_f0; if (play->csCtx.curFrame < 160) { unk178[0] = 100; @@ -576,7 +580,7 @@ void func_8097F280(DemoGt* this, PlayState* play) { unk198[0]++; unk198[1]--; } else if (play->csCtx.curFrame < 170) { - temp_f0 = Environment_LerpWeightAccelDecel(170, 160, play->csCtx.curFrame, 0, 0); + f32 temp_f0 = Environment_LerpWeightAccelDecel(170, 160, play->csCtx.curFrame, 0, 0); unk178[0] = (temp_f0 * -63.0f) + 163.0f; unk178[1] = (temp_f0 * -155.0f) + 255.0f; @@ -700,13 +704,14 @@ void func_8097F960(DemoGt* this, PlayState* play) { } void func_8097F96C(DemoGt* this, PlayState* play) { - static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; u16 csCurFrame = play->csCtx.curFrame; - if (((csCurFrame > 1059) && (csCurFrame < 1062)) || kREG(1) == 17) { + if (((csCurFrame > 1059) && (csCurFrame < 1062)) || (OOT_DEBUG && (kREG(1) == 17))) { + static Actor* cloudRing = NULL; + pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 612.0f; pos.z = this->dyna.actor.world.pos.z; @@ -730,7 +735,7 @@ void func_8097FA1C(DemoGt* this, PlayState* play) { Vec3f velOffset = { -12.0f, -17.0, 5.0 }; s32 pad1[3]; - if (((csCurFrame > 502) && !(csCurFrame >= 581)) || (kREG(1) == 5)) { + if (((csCurFrame > 502) && !(csCurFrame >= 581)) || (OOT_DEBUG && (kREG(1) == 5))) { dustPos.x = pos->x + 300.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z - 377.0f; @@ -739,19 +744,20 @@ void func_8097FA1C(DemoGt* this, PlayState* play) { } void func_8097FAFC(DemoGt* this, PlayState* play) { - static Vec3f velocity = { 0.0f, 1.0f, 0.0f }; - static Vec3f accel = { 0.0f, 0.0f, 0.0f }; - static f32 arg4 = 280.0f; - static f32 scale = 8.0f; - static s32 arg6 = 11; - static s32 arg7 = 1; - static s16 life = 3; s32 pad[2]; u16 csCurFrame = play->csCtx.curFrame; Vec3f pos; f32 new_var = -200.0; - if (((csCurFrame > 582) && (csCurFrame < 683)) || (kREG(1) == 6)) { + if (((csCurFrame > 582) && (csCurFrame < 683)) || (OOT_DEBUG && (kREG(1) == 6))) { + static Vec3f velocity = { 0.0f, 1.0f, 0.0f }; + static Vec3f accel = { 0.0f, 0.0f, 0.0f }; + static f32 arg4 = 280.0f; + static f32 scale = 8.0f; + static s32 arg6 = 11; + static s32 arg7 = 1; + static s16 life = 3; + pos = this->dyna.actor.world.pos; pos.y += 680.0f; @@ -773,7 +779,7 @@ void func_8097FC1C(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if (csCurFrame > 682 || kREG(1) == 7) { + if (csCurFrame > 682 || (OOT_DEBUG && (kREG(1) == 7))) { dustPos.x = pos->x + 260.0f; dustPos.y = pos->y + 360.0f; dustPos.z = pos->z + 260.0f; @@ -786,7 +792,12 @@ void func_8097FCE4(DemoGt* this, PlayState* play) { Vec3f vec; u16 csCurFrame = play->csCtx.curFrame; - if (csCurFrame == 503 || kREG(1) == 4) { +#if OOT_DEBUG + if (csCurFrame == 503 || kREG(1) == 4) +#else + if (csCurFrame == 503) +#endif + { vec.x = this->dyna.actor.world.pos.x + 300.0f; vec.y = this->dyna.actor.world.pos.y + 560.0f; vec.z = this->dyna.actor.world.pos.z - 377.0f; @@ -881,12 +892,13 @@ void func_80980178(DemoGt* this, PlayState* play) { } void func_80980184(DemoGt* this, PlayState* play) { - static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; if ((play->csCtx.curFrame > 1027) && (play->csCtx.curFrame < 1031)) { + static Actor* cloudRing = NULL; + pos.x = this->dyna.actor.world.pos.x; pos.y = this->dyna.actor.world.pos.y + 247.0f; pos.z = this->dyna.actor.world.pos.z; @@ -903,12 +915,13 @@ void func_80980184(DemoGt* this, PlayState* play) { } void func_80980218(DemoGt* this, PlayState* play) { - static Actor* cloudRing = NULL; s32 pad[4]; Vec3f pos; Actor* actor; if ((play->csCtx.curFrame > 997) && (play->csCtx.curFrame < 1001)) { + static Actor* cloudRing = NULL; + pos.x = this->dyna.actor.home.pos.x; pos.y = this->dyna.actor.home.pos.y + 38.0f; pos.z = this->dyna.actor.home.pos.z; @@ -964,7 +977,7 @@ void func_80980430(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -3.0f, 0.0f }; s32 pad1[3]; - if (csCurFrame > 709 || kREG(1) == 8) { + if (csCurFrame > 709 || (OOT_DEBUG && (kREG(1) == 8))) { dustPos.x = pos->x + 760.0f; dustPos.y = pos->y - 40.0f; dustPos.z = pos->z - 240.0f; @@ -980,7 +993,7 @@ void func_80980504(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 704) || kREG(1) == 9) { + if ((csCurFrame > 704) || (OOT_DEBUG && (kREG(1) == 9))) { dustPos.x = pos->x + 830.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 390.0f; @@ -996,7 +1009,7 @@ void func_809805D8(DemoGt* this, PlayState* play) { Vec3f velOffset = { 15.0f, -26.0, 0.0f }; s32 pad1[3]; - if (((csCurFrame > 739) && (csCurFrame < 781)) || kREG(1) == 11) { + if (((csCurFrame > 739) && (csCurFrame < 781)) || (OOT_DEBUG && (kREG(1) == 11))) { dustPos.x = homePos->x + 550.0f; dustPos.y = homePos->y - 110.0f; dustPos.z = homePos->z + 50.0f; @@ -1012,7 +1025,7 @@ void func_809806B8(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 964) || (kREG(1) == 12)) { + if ((csCurFrame > 964) || (OOT_DEBUG && (kREG(1) == 12))) { dustPos.x = pos->x + 460.0f; dustPos.y = pos->y + 60.0f; dustPos.z = pos->z + 760.0f; @@ -1028,7 +1041,7 @@ void func_8098078C(DemoGt* this, PlayState* play) { Vec3f velOffset = { 5.0f, -16.0f, -16.0f }; s32 pad1[3]; - if ((csCurFrame > 939) || (kREG(1) == 14)) { + if ((csCurFrame > 939) || (OOT_DEBUG && (kREG(1) == 14))) { dustPos.x = pos->x + 360.0f; dustPos.y = pos->y + 70.0f; dustPos.z = pos->z - 640.0f; @@ -1042,7 +1055,7 @@ void func_8098085C(DemoGt* this, PlayState* play) { u16 csCurFrame = play->csCtx.curFrame; Vec3f* pos = &this->dyna.actor.world.pos; - if ((csCurFrame == 58) || (kREG(1) == 1)) { + if ((csCurFrame == 58) || (OOT_DEBUG && (kREG(1) == 1))) { sp28.x = pos->x + 900.0f; sp28.y = pos->y - 50.0f; sp28.z = pos->z + 93.0f; @@ -1068,7 +1081,7 @@ void func_809809C0(DemoGt* this, PlayState* play2) { Vec3f sp54; s16 pad[3]; - if (((csCurFrame > 469) && (csCurFrame < 481)) || (kREG(1) == 3)) { + if (((csCurFrame > 469) && (csCurFrame < 481)) || (OOT_DEBUG && (kREG(1) == 3))) { Vec3f sp40 = { 20.0f, 6.0f, 0.0f }; Vec3f sp34 = { 0.0f, 0.0f, 0.0f }; s16 pad2[3]; @@ -1088,7 +1101,7 @@ void func_80980AD4(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 477) || (kREG(2) == 1)) { + if ((csCurFrame == 477) || (OOT_DEBUG && (kREG(2) == 1))) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; @@ -1103,7 +1116,7 @@ void func_80980B68(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 317) || (kREG(3) == 1)) { + if ((csCurFrame == 317) || (OOT_DEBUG && (kREG(3) == 1))) { pos.x = this->dyna.actor.world.pos.x + 980.0f; pos.y = this->dyna.actor.world.pos.y + 410.0f; pos.z = this->dyna.actor.world.pos.z - 177.0f; @@ -1117,7 +1130,7 @@ void func_80980BFC(DemoGt* this, PlayState* play) { Vec3f pos; u16 csCurFrame = play->csCtx.curFrame; - if ((csCurFrame == 740) || (kREG(4) == 1)) { + if ((csCurFrame == 740) || (OOT_DEBUG && (kREG(4) == 1))) { pos.x = this->dyna.actor.world.pos.x + 790.0f; pos.y = this->dyna.actor.world.pos.y + 60.0f; pos.z = this->dyna.actor.world.pos.z + 23.0f; @@ -1322,7 +1335,7 @@ void func_80981458(DemoGt* this, PlayState* play) { Vec3f dustPos; u16 csCurFrame = play->csCtx.curFrame; - if (((csCurFrame > 855) && (csCurFrame < 891)) || (kREG(1) == 13)) { + if (((csCurFrame > 855) && (csCurFrame < 891)) || (OOT_DEBUG && (kREG(1) == 13))) { Vec3f velOffset = { 0.0f, -30.0f, 0.0f }; s32 pad1[3]; diff --git a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index dd1d7e3cc5..199fb04f7e 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -36,8 +36,11 @@ s32 DemoIk_UpdateSkelAnime(DemoIk* this) { CsCmdActorCue* DemoIk_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -256,8 +259,8 @@ void DemoIk_Type1Action2(DemoIk* this, PlayState* play) { } void DemoIk_Type1PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - DemoIk* this = (DemoIk*)thisx; GraphicsContext* gfxCtx = play->state.gfxCtx; + DemoIk* this = (DemoIk*)thisx; OPEN_DISPS(gfxCtx, "../z_demo_ik_inArmer.c", 385); if (limbIndex == 1) { diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 71e2ee06ef..eac76aa693 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -118,6 +118,7 @@ void func_80984BE0(DemoIm* this) { } } +#if OOT_DEBUG void func_80984C68(DemoIm* this) { this->action = 7; this->drawConfig = 0; @@ -143,6 +144,7 @@ void func_80984C8C(DemoIm* this, PlayState* play) { } } } +#endif void DemoIm_InitCollider(Actor* thisx, PlayState* play) { DemoIm* this = (DemoIm*)thisx; @@ -497,7 +499,9 @@ void func_80985B34(DemoIm* this, PlayState* play) { void func_80985C10(DemoIm* this, PlayState* play) { func_80985948(this, play); +#if OOT_DEBUG func_80984C8C(this, play); +#endif } void func_80985C40(DemoIm* this, PlayState* play) { @@ -505,7 +509,9 @@ void func_80985C40(DemoIm* this, PlayState* play) { DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_809859E0(this, play); +#if OOT_DEBUG func_80984C8C(this, play); +#endif } void func_80985C94(DemoIm* this, PlayState* play) { @@ -513,7 +519,9 @@ void func_80985C94(DemoIm* this, PlayState* play) { DemoIm_UpdateSkelAnime(this); func_80984BE0(this); func_80985B34(this, play); +#if OOT_DEBUG func_80984C8C(this, play); +#endif } void DemoIm_DrawTranslucent(DemoIm* this, PlayState* play) { @@ -899,6 +907,8 @@ void func_80986BF8(DemoIm* this, PlayState* play) { void func_80986C30(DemoIm* this, PlayState* play) { if (func_80986A5C(this, play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardLullabyCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_59); @@ -924,10 +934,15 @@ void func_80986CFC(DemoIm* this, PlayState* play) { } void func_80986D40(DemoIm* this, PlayState* play) { +#if OOT_DEBUG if (gSaveContext.sceneLayer == 6) { this->action = 19; this->drawConfig = 1; - } else if (GET_EVENTCHKINF(EVENTCHKINF_80)) { + return; + } +#endif + + if (GET_EVENTCHKINF(EVENTCHKINF_80)) { Actor_Kill(&this->actor); } else if (!GET_EVENTCHKINF(EVENTCHKINF_59)) { this->action = 23; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 103ddcb3ce..f2f1941750 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -277,7 +277,6 @@ void DemoKankyo_Destroy(Actor* thisx, PlayState* play) { void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 temp; if (this->actor.objectSlot == this->requiredObjectSlot) { switch (this->actor.params) { @@ -302,12 +301,14 @@ void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) { play->envCtx.screenFillColor[2] = 0xFF; play->envCtx.fillScreen = false; if (this->warpTimer < 21 && this->warpTimer >= 15) { - temp = (this->warpTimer - 15.0f) / 5.0f; + f32 temp = (this->warpTimer - 15.0f) / 5.0f; + play->envCtx.fillScreen = true; play->envCtx.screenFillColor[3] = 255 - 255 * temp; } if (this->warpTimer < 15 && this->warpTimer >= 4) { - temp = (this->warpTimer - 4.0f) / 10.0f; + f32 temp = (this->warpTimer - 4.0f) / 10.0f; + play->envCtx.fillScreen = true; play->envCtx.screenFillColor[3] = 255 * temp; } diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 84c183b43e..ba19c5c25d 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -126,6 +126,7 @@ void DemoSa_SetMouthIndex(DemoSa* this, s16 mouthIndex) { this->mouthIndex = mouthIndex; } +#if OOT_DEBUG void func_8098E530(DemoSa* this) { this->action = 7; this->drawConfig = 0; @@ -149,6 +150,7 @@ void func_8098E554(DemoSa* this, PlayState* play) { *something = 1; } } +#endif void func_8098E5C8(DemoSa* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); @@ -160,7 +162,9 @@ s32 DemoSa_UpdateSkelAnime(DemoSa* this) { CsCmdActorCue* DemoSa_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } return NULL; @@ -438,7 +442,9 @@ void func_8098F050(DemoSa* this, PlayState* play) { void func_8098F0E8(DemoSa* this, PlayState* play) { func_8098EEA8(this, play); +#if OOT_DEBUG func_8098E554(this, play); +#endif } void func_8098F118(DemoSa* this, PlayState* play) { @@ -446,7 +452,9 @@ void func_8098F118(DemoSa* this, PlayState* play) { DemoSa_UpdateSkelAnime(this); func_8098E480(this); func_8098EEFC(this, play); +#if OOT_DEBUG func_8098E554(this, play); +#endif } void func_8098F16C(DemoSa* this, PlayState* play) { @@ -454,7 +462,9 @@ void func_8098F16C(DemoSa* this, PlayState* play) { DemoSa_UpdateSkelAnime(this); func_8098EDB0(this); func_8098F050(this, play); +#if OOT_DEBUG func_8098E554(this, play); +#endif } void DemoSa_DrawXlu(DemoSa* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c index ec53977501..19272d5042 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -58,12 +58,10 @@ void func_80991298(DemoShd* this, PlayState* play) { } if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorCue* cue = play->csCtx.actorCues[0]; - - if (cue != NULL) { - if (cue->id == 2) { + if (play->csCtx.actorCues[0] != NULL) { + if (play->csCtx.actorCues[0]->id == 2) { if (!(this->unk_14C & 1)) { - this->unk_14E = cue->startPos.x; + this->unk_14E = play->csCtx.actorCues[0]->startPos.x; } this->unk_14C |= 1; } else { @@ -73,12 +71,10 @@ void func_80991298(DemoShd* this, PlayState* play) { } if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorCue* cue = play->csCtx.actorCues[1]; - - if (cue != NULL) { - if (cue->id == 2) { + if (play->csCtx.actorCues[1] != NULL) { + if (play->csCtx.actorCues[1]->id == 2) { if (!(this->unk_14C & 2)) { - this->unk_14E = cue->startPos.x; + this->unk_14E = play->csCtx.actorCues[1]->startPos.x; } this->unk_14C |= 2; } else { @@ -101,8 +97,6 @@ void DemoShd_Draw(Actor* thisx, PlayState* play) { s32 pad; u32 unk_14E = this->unk_14E; - if (1) {} // Necessary to match, can be anywhere in the function - OPEN_DISPS(play->state.gfxCtx, "../z_demo_shd.c", 726); Gfx_SetupDL_25Xlu(play->state.gfxCtx); @@ -123,5 +117,7 @@ void DemoShd_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, D_809934B8); } + if (1) {} // Necessary to match + CLOSE_DISPS(play->state.gfxCtx, "../z_demo_shd.c", 762); } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index 52c111c58a..dbddf17995 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -456,12 +456,10 @@ s32 DoorWarp1_PlayerInRange(DoorWarp1* this, PlayState* play) { } void DoorWarp1_ChildWarpIdle(DoorWarp1* this, PlayState* play) { - Player* player; - Actor_PlaySfx(&this->actor, NA_SE_EV_WARP_HOLE - SFX_FLAG); if (DoorWarp1_PlayerInRange(this, play)) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); Audio_PlaySfxGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -830,12 +828,10 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } void DoorWarp1_Destination(DoorWarp1* this, PlayState* play) { - f32 alphaFrac; + f32 alphaFrac = 1.0f; - this->warpTimer++; this->unk_194 = 5.0f; - - alphaFrac = 1.0f; + this->warpTimer++; if (this->warpTimer < 20) { alphaFrac = this->warpTimer / 20.f; } else if (this->warpTimer >= 60) { diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 1c07031a0c..893360582f 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -273,31 +273,32 @@ void EffDust_DrawFunc_8099E4F4(Actor* thisx, PlayState* play2) { Gfx_SetupDL_25Opa(gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 128, 128, 128, 255); - gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 0); initialPositions = this->initialPositions; distanceTraveled = this->distanceTraveled; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 128, 128, 128, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 0); gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); - for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) { - if (!(*distanceTraveled < 1.0f)) { - continue; + for (i = 0; i < 64; i++) { + if (*distanceTraveled < 1.0f) { + aux = 1.0f - SQ(*distanceTraveled); + Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), + this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))), + this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))), + MTXMODE_NEW); + + Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 449), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } - aux = 1.0f - SQ(*distanceTraveled); - Matrix_Translate(this->actor.world.pos.x + (initialPositions->x * ((this->dx * aux) + (1.0f - this->dx))), - this->actor.world.pos.y + (initialPositions->y * ((this->dy * aux) + (1.0f - this->dy))), - this->actor.world.pos.z + (initialPositions->z * ((this->dz * aux) + (1.0f - this->dz))), - MTXMODE_NEW); - - Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, MTXMODE_APPLY); - Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); - - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 449), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); + initialPositions++; + distanceTraveled++; } CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 458); @@ -318,6 +319,10 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) { Gfx_SetupDL_25Opa(gfxCtx); gDPPipeSync(POLY_XLU_DISP++); + + initialPositions = this->initialPositions; + distanceTraveled = this->distanceTraveled; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); if (player->unk_858 >= 0.85f) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); @@ -325,34 +330,32 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, PlayState* play2) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 0); } - initialPositions = this->initialPositions; - distanceTraveled = this->distanceTraveled; - gSPSegment(POLY_XLU_DISP++, 0x08, sEmptyDL); - for (i = 0; i < 64; i++, initialPositions++, distanceTraveled++) { - if (!(*distanceTraveled < 1.0f)) { - continue; + for (i = 0; i < 64; i++) { + if (*distanceTraveled < 1.0f) { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); + + aux = 1.0f - SQ(*distanceTraveled); + + Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); + + Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)), + initialPositions->y * (1.0f - *distanceTraveled) + 320.0f, + initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY); + + Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, + *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); + + Matrix_ReplaceRotation(&play->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 506), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); } - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, *distanceTraveled * 255); - - aux = 1.0f - SQ(*distanceTraveled); - - Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); - - Matrix_Translate(initialPositions->x * ((this->dx * aux) + (1.0f - this->dx)), - initialPositions->y * (1.0f - *distanceTraveled) + 320.0f, - initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY); - - Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, - *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - - Matrix_ReplaceRotation(&play->billboardMtxF); - - gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(gfxCtx, "../z_eff_dust.c", 506), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffSparklesDL)); + initialPositions++; + distanceTraveled++; } CLOSE_DISPS(gfxCtx, "../z_eff_dust.c", 515); diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index dfa44b0cd4..d326f93b5c 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -13,7 +13,9 @@ void ElfMsg_Init(Actor* thisx, PlayState* play); void ElfMsg_Destroy(Actor* thisx, PlayState* play); void ElfMsg_Update(Actor* thisx, PlayState* play); +#if OOT_DEBUG void ElfMsg_Draw(Actor* thisx, PlayState* play); +#endif void ElfMsg_CallNaviCuboid(ElfMsg* this, PlayState* play); void ElfMsg_CallNaviCylinder(ElfMsg* this, PlayState* play); @@ -27,7 +29,11 @@ ActorInit Elf_Msg_InitVars = { /**/ ElfMsg_Init, /**/ ElfMsg_Destroy, /**/ ElfMsg_Update, +#if OOT_DEBUG /**/ ElfMsg_Draw, +#else + /**/ NULL, +#endif }; static InitChainEntry sInitChain[] = { @@ -163,6 +169,7 @@ void ElfMsg_Update(Actor* thisx, PlayState* play) { } } +#if OOT_DEBUG #include "assets/overlays/ovl_Elf_Msg/ovl_Elf_Msg.c" void ElfMsg_Draw(Actor* thisx, PlayState* play) { @@ -191,3 +198,4 @@ void ElfMsg_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_elf_msg.c", 457); } +#endif diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index d36f9813cb..0e94e73927 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -12,7 +12,9 @@ void ElfMsg2_Init(Actor* thisx, PlayState* play); void ElfMsg2_Destroy(Actor* thisx, PlayState* play); void ElfMsg2_Update(Actor* thisx, PlayState* play); +#if OOT_DEBUG void ElfMsg2_Draw(Actor* thisx, PlayState* play); +#endif s32 ElfMsg2_GetMessageId(ElfMsg2* this); void ElfMsg2_WaitUntilActivated(ElfMsg2* this, PlayState* play); @@ -27,7 +29,11 @@ ActorInit Elf_Msg2_InitVars = { /**/ ElfMsg2_Init, /**/ ElfMsg2_Destroy, /**/ ElfMsg2_Update, +#if OOT_DEBUG /**/ ElfMsg2_Draw, +#else + /**/ NULL, +#endif }; static InitChainEntry sInitChain[] = { @@ -147,6 +153,7 @@ void ElfMsg2_Update(Actor* thisx, PlayState* play) { } } +#if OOT_DEBUG #include "assets/overlays/ovl_Elf_Msg2/ovl_Elf_Msg2.c" void ElfMsg2_Draw(Actor* thisx, PlayState* play) { @@ -165,3 +172,4 @@ void ElfMsg2_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_elf_msg2.c", 367); } +#endif diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 932308eb20..de26bf1140 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -782,7 +782,6 @@ void EnAm_TransformSwordHitbox(Actor* thisx, PlayState* play) { void EnAm_UpdateDamage(EnAm* this, PlayState* play) { s32 pad; - Vec3f sparkPos; if (this->deathTimer == 0) { if (this->blockCollider.base.acFlags & AC_BOUNCED) { @@ -810,7 +809,8 @@ void EnAm_UpdateDamage(EnAm* this, PlayState* play) { this->dyna.actor.colChkInfo.health = 0; } } else if (this->dyna.actor.colChkInfo.damageEffect == AM_DMGEFF_STUN) { - sparkPos = this->dyna.actor.world.pos; + Vec3f sparkPos = this->dyna.actor.world.pos; + sparkPos.y += 50.0f; CollisionCheck_SpawnShieldParticlesMetal(play, &sparkPos); } @@ -836,8 +836,6 @@ void EnAm_Update(Actor* thisx, PlayState* play) { EnBom* bomb; Vec3f dustPos; s32 i; - f32 dustPosScale; - s32 pad1; if (this->dyna.actor.params != ARMOS_STATUE) { EnAm_UpdateDamage(this, play); @@ -854,7 +852,8 @@ void EnAm_Update(Actor* thisx, PlayState* play) { this->deathTimer--; if (this->deathTimer == 0) { - dustPosScale = play->gameplayFrames * 10; + f32 dustPosScale = play->gameplayFrames * 10; + s32 pad1; EnAm_SpawnEffects(this, play); bomb = @@ -943,9 +942,9 @@ static Vec3f sIcePosOffsets[] = { }; void EnAm_Draw(Actor* thisx, PlayState* play) { - s32 pad; - Vec3f sp68; EnAm* this = (EnAm*)thisx; + Vec3f sp68; + s32 index; OPEN_DISPS(play->state.gfxCtx, "../z_en_am.c", 1580); @@ -959,7 +958,6 @@ void EnAm_Draw(Actor* thisx, PlayState* play) { this->iceTimer--; if ((this->iceTimer % 4) == 0) { - s32 index; index = this->iceTimer >> 2; diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 84a05c3b16..39b86fc6b3 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -246,8 +246,6 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { s32 atTouched; u16 sfxId; Actor* hitActor; - Vec3f sp60; - Vec3f sp54; if (DECR(this->timer) == 0) { Actor_Kill(&this->actor); @@ -342,6 +340,9 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) { if (this->hitActor != NULL) { if (this->hitActor->update != NULL) { + Vec3f sp60; + Vec3f sp54; + Math_Vec3f_Sum(&this->unk_210, &this->unk_250, &sp60); Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_250, &sp54); diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index c5c4392382..f42593a57e 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -297,8 +297,6 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { EnAttackNiw* this = (EnAttackNiw*)thisx; EnNiw* cucco; Player* player = GET_PLAYER(play); - s32 pad; - Vec3f sp30; PlayState* play2 = play; this->unk_28C++; @@ -343,6 +341,9 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actionFunc != func_809B5C18)) { + Vec3f sp30; + s32 pad; + Math_Vec3f_Copy(&sp30, &this->actor.world.pos); sp30.y += this->actor.yDistToWater; EffectSsGSplash_Spawn(play, &sp30, NULL, NULL, 0, 0x190); diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 965df7954f..03528ef5e3 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -492,6 +492,7 @@ void EnBa_Draw(Actor* thisx, PlayState* play) { Matrix_RotateZYX(this->unk_2A8[i].x, this->unk_2A8[i].y, this->unk_2A8[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk_200[i].x, this->unk_200[i].y, this->unk_200[i].z, MTXMODE_APPLY); if ((i == 6) || (i == 13)) { + if (mtx) {} switch (i) { case 13: Collider_UpdateSpheres(i, &this->collider); diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index b6bca7f72f..7ff5296e23 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -291,9 +291,10 @@ void EnBb_SpawnFlameTrail(PlayState* play, EnBb* this, s16 startAtZero) { void EnBb_KillFlameTrail(EnBb* this) { Actor* actor = &this->actor; + Actor* nextActor; while (actor->child != NULL) { - Actor* nextActor = actor->child; + nextActor = actor->child; if (nextActor->id == ACTOR_EN_BB) { nextActor->parent = NULL; @@ -408,10 +409,10 @@ void EnBb_Destroy(Actor* thisx, PlayState* play) { void EnBb_SetupFlameTrail(EnBb* this) { this->action = BB_FLAME_TRAIL; this->moveMode = BBMOVE_NOCLIP; - this->actor.flags &= ~ACTOR_FLAG_0; this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; this->actor.speed = 0.0f; + this->actor.flags &= ~ACTOR_FLAG_0; EnBb_SetupAction(this, EnBb_FlameTrail); } diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index 1febc79760..ba1920a321 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -121,9 +121,7 @@ void func_809BC2A4(EnBdfire* this, PlayState* play) { void func_809BC598(EnBdfire* this, PlayState* play) { s16 quarterTurn; Player* player = GET_PLAYER(play); - f32 distToBurn; BossDodongo* bossDodongo; - s16 i; bossDodongo = ((BossDodongo*)this->actor.parent); this->unk_158 = bossDodongo->unk_1A2; @@ -164,8 +162,11 @@ void func_809BC598(EnBdfire* this, PlayState* play) { return; } } else if (!player->bodyIsBurning) { - distToBurn = (this->actor.scale.x * 130.0f) / 4.2000003f; + f32 distToBurn = (this->actor.scale.x * 130.0f) / 4.2000003f; + if (this->actor.xyzDistToPlayerSq < SQ(distToBurn)) { + s16 i; + for (i = 0; i < 18; i++) { player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index e58bd6b2a4..b982fa7ddb 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -837,6 +837,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, temp_f0, temp_f0, temp_f0, 255); + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1945); } } else if (limbIndex == 10) { @@ -848,7 +849,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, intensity, intensity, intensity, intensity); - + if (1) {} CLOSE_DISPS(play->state.gfxCtx, "../z_en_bigokuta.c", 1972); } else if (limbIndex == 17 && this->actionFunc == func_809BE26C) { if (this->unk_198 < 5) { diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index de0a12eebf..6410634593 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -143,12 +143,12 @@ void EnBili_SetupFloatIdle(EnBili* this) { this->actor.speed = 0.7f; this->collider.elem.bumper.effect = 1; // Shock? this->timer = 32; - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->actionFunc = EnBili_FloatIdle; this->actor.home.pos.y = this->actor.world.pos.y; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; + this->collider.base.atFlags |= AT_ON; + this->collider.base.acFlags |= AC_ON; + this->actionFunc = EnBili_FloatIdle; } /** diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 6d0ecbc276..d091fbe3a0 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -474,7 +474,7 @@ Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, PlayState* play) { Matrix_ReplaceRotation(&play->billboardMtxF); gSPMatrix(displayListHead++, MATRIX_NEW(gfxCtx, "../z_en_bombf.c", 1021), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPEndDisplayList(displayListHead); + gSPEndDisplayList(displayListHead++); return displayList; } @@ -482,8 +482,6 @@ void EnBombf_Draw(Actor* thisx, PlayState* play) { s32 pad; EnBombf* this = (EnBombf*)thisx; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_bombf.c", 1034); if (thisx->params <= BOMBFLOWER_BODY) { @@ -510,5 +508,7 @@ void EnBombf_Draw(Actor* thisx, PlayState* play) { Collider_UpdateSpheres(0, &this->explosionCollider); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bombf.c", 1063); } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 579cc5920b..a92aa86d5e 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -272,5 +272,7 @@ void EnBoom_Draw(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBoomerangRefDL); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_boom.c", 604); } diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 23f49a4625..d8082a7973 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -425,6 +425,8 @@ void EnBubble_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, gBubbleDL); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bubble.c", 1226); if (this->actionFunc != EnBubble_Disappear) { diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index 4a5b89f85c..1516d57d55 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -859,7 +859,7 @@ void EnBw_Draw(Actor* thisx, PlayState* play2) { POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBw_OverrideLimbDraw, NULL, this, POLY_OPA_DISP); } else { - Gfx_SetupDL_25Xlu(play->state.gfxCtx); + Gfx_SetupDL_25Xlu(play2->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 0, 0, 0, this->color1.a); gDPSetEnvColor(POLY_XLU_DISP++, this->color1.r, this->color1.g, this->color1.b, this->color1.a); @@ -906,5 +906,8 @@ void EnBw_Draw(Actor* thisx, PlayState* play2) { EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &icePos, 0x96, 0x96, 0x96, 0xFA, 0xEB, 0xF5, 0xFF, 1.3f); } } + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_bw.c", 1521); } diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 0e6b72e037..35f1565912 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -205,6 +205,7 @@ void EnBx_Draw(Actor* thisx, PlayState* play) { s32 pad; Mtx* mtx = GRAPH_ALLOC(play->state.gfxCtx, 4 * sizeof(Mtx)); s16 i; + s16 off; OPEN_DISPS(play->state.gfxCtx, "../z_en_bx.c", 464); @@ -226,7 +227,7 @@ void EnBx_Draw(Actor* thisx, PlayState* play) { thisx->scale.z = thisx->scale.x = (Math_CosS(this->unk_14E) * 0.0075f) + 0.015f; for (i = 3; i >= 0; i--) { - s16 off = (0x2000 * i); + off = (0x2000 * i); this->unk_184[i].z = this->unk_184[i].x = (Math_CosS(this->unk_14E + off) * 0.0075f) + 0.015f; this->unk_1B4[i].x = thisx->shape.rot.x; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index f415f0f100..f13b19221f 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -283,11 +283,15 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { * This is used for the ground flash display lists and Arwing shadow display lists to snap onto the floor. */ void EnClearTag_CalculateFloorTangent(EnClearTag* this) { + f32 x; + f32 y; + f32 z; + // If there is a floor poly below the Arwing, calculate the floor tangent. if (this->actor.floorPoly != NULL) { - f32 x = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); - f32 y = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); - f32 z = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); + x = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); + y = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); + z = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); this->floorTangent.x = -Math_FAtan2F(-z * y, 1.0f); this->floorTangent.z = Math_FAtan2F(-x * y, 1.0f); diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index caa64d3009..3cd26ef460 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -285,8 +285,6 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 facingPlayer; - Vec3f pos; - s16 target; SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -296,6 +294,9 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { facingPlayer = Actor_IsFacingPlayer(&this->actor, 0x2800); if (facingPlayer) { + Vec3f pos; + s16 target; + pos.x = player->actor.world.pos.x; pos.y = player->actor.world.pos.y + 20.0f; pos.z = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index 14c454455f..f5694d2bf0 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -296,8 +296,6 @@ void EnDh_SetupAttack(EnDh* this) { } void EnDh_Attack(EnDh* this, PlayState* play) { - s32 pad; - if (SkelAnime_Update(&this->skelAnime)) { this->actionState++; } else if ((this->actor.xzDistToPlayer > 100.0f) || !Actor_IsFacingPlayer(&this->actor, 60 * 0x10000 / 360)) { @@ -336,6 +334,8 @@ void EnDh_Attack(EnDh* this, PlayState* play) { break; case 3: if ((this->actor.xzDistToPlayer <= 100.0f) && (Actor_IsFacingPlayer(&this->actor, 60 * 0x10000 / 360))) { + s32 pad; + Animation_Change(&this->skelAnime, &object_dh_Anim_004658, 1.0f, 20.0f, Animation_GetLastFrame(&object_dh_Anim_004658), ANIMMODE_ONCE, -6.0f); this->actionState = 0; diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index df3e4ceab4..6e33517bf3 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -125,6 +125,8 @@ void EnDivingGame_SpawnRuppy(EnDivingGame* this, PlayState* play) { } s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { + s32 rupeesNeeded; + if ((gSaveContext.timerState == TIMER_STATE_STOP) && !Play_InCsMode(play)) { // Failed. gSaveContext.timerState = TIMER_STATE_OFF; @@ -138,7 +140,7 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { this->actionFunc = func_809EE048; return true; } else { - s32 rupeesNeeded = 5; + rupeesNeeded = 5; if (GET_EVENTCHKINF(EVENTCHKINF_38)) { rupeesNeeded = 10; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 233d17d613..4268bc2ba2 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -77,6 +77,7 @@ static u16 sStartingTextIds[] = { 0x10A0, 0x10A1, 0x10A2, 0x10CA, 0x10CB, 0x10CC, 0x10CD, 0x10CE, 0x10CF, 0x10DC, 0x10DD, }; +#if OOT_DEBUG static char* sItemDebugTxt[] = { "デクの実売り ", // "Deku Nuts" "デクの棒売り ", // "Deku Sticks" @@ -90,6 +91,7 @@ static char* sItemDebugTxt[] = { "デクの棒持てる数を増やす", // "Deku Stick Upgrade" "デクの実持てる数を増やす", // "Deku Nut Upgrade" }; +#endif static DnsItemEntry sItemDekuNuts = { 20, 5, GI_DEKU_NUTS_5_2, EnDns_CanBuyDekuNuts, EnDns_PayForDekuNuts }; static DnsItemEntry sItemDekuSticks = { 15, 1, GI_DEKU_STICKS_1, EnDns_CanBuyDekuSticks, EnDns_PayPrice }; diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index f1fefedd8b..4de5e81918 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -216,16 +216,23 @@ void EnDntNomal_TargetWait(EnDntNomal* this, PlayState* play) { f32 dz; Vec3f scoreAccel = { 0.0f, 0.0f, 0.0f }; Vec3f scoreVel = { 0.0f, 0.0f, 0.0f }; + s32 pad; - this->targetVtx[0].x = this->targetVtx[1].x = this->targetVtx[2].x = this->targetVtx[3].x = targetX; + this->targetVtx[0].x = targetX; + this->targetVtx[0].y = targetY - 24.0f; + this->targetVtx[0].z = targetZ + 24.0f; - this->targetVtx[1].y = this->targetVtx[0].y = targetY - 24.0f; + this->targetVtx[1].x = targetX; + this->targetVtx[1].y = targetY - 24.0f; + this->targetVtx[1].z = targetZ - 24.0f; - this->targetVtx[2].z = this->targetVtx[0].z = targetZ + 24.0f; + this->targetVtx[2].x = targetX; + this->targetVtx[2].y = targetY + 24.0f; + this->targetVtx[2].z = targetZ + 24.0f; - this->targetVtx[3].z = this->targetVtx[1].z = targetZ - 24.0f; - - this->targetVtx[3].y = this->targetVtx[2].y = targetY + 24.0f; + this->targetVtx[3].x = targetX; + this->targetVtx[3].y = targetY + 24.0f; + this->targetVtx[3].z = targetZ - 24.0f; SkelAnime_Update(&this->skelAnime); if ((this->targetQuad.base.acFlags & AC_HIT) || BREG(0)) { diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 05c4c1a783..3d8e0e57ce 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -215,6 +215,8 @@ void EnDs_Wait(EnDs* this, PlayState* play) { player->actor.textId = 0x500C; this->actionFunc = EnDs_OfferBluePotion; } else { + s16 pad; + if (INV_CONTENT(ITEM_ODD_MUSHROOM) == ITEM_ODD_MUSHROOM) { player->actor.textId = 0x5049; } else { diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index ea124d0436..56ec047023 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -362,13 +362,15 @@ void func_809FE4A4(EnDu* this, PlayState* play) { void func_809FE638(EnDu* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & PLAYER_STATE1_29)) { - OnePointCutscene_Init(play, 3330, -99, &this->actor, CAM_ID_MAIN); - player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; - Audio_PlayFanfare(NA_BGM_APPEAR); - EnDu_SetupAction(this, func_809FE6CC); - this->unk_1E2 = 0x32; + if (player->stateFlags1 & PLAYER_STATE1_29) { + return; } + + OnePointCutscene_Init(play, 3330, -99, &this->actor, CAM_ID_MAIN); + player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; + Audio_PlayFanfare(NA_BGM_APPEAR); + EnDu_SetupAction(this, func_809FE6CC); + this->unk_1E2 = 0x32; } void func_809FE6CC(EnDu* this, PlayState* play) { @@ -527,11 +529,13 @@ void func_809FEC14(EnDu* this, PlayState* play) { } void func_809FEC70(EnDu* this, PlayState* play) { + f32 xzRange; + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; EnDu_SetupAction(this, func_809FECE4); } else { - f32 xzRange = this->actor.xzDistToPlayer + 1.0f; + xzRange = this->actor.xzDistToPlayer + 1.0f; Actor_OfferGetItem(&this->actor, play, GI_GORONS_BRACELET, xzRange, fabsf(this->actor.yDistToPlayer) + 1.0f); } diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index 1896074334..0f9fb333e9 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -93,8 +93,8 @@ void EnDyExtra_Draw(Actor* thisx, PlayState* play) { static u8 D_809FFC50[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02, 0x00 }; EnDyExtra* this = (EnDyExtra*)thisx; - s32 pad; GraphicsContext* gfxCtx = play->state.gfxCtx; + s32 pad; Vtx* vertices = SEGMENTED_TO_VIRTUAL(gGreatFairySpiralBeamVtx); s32 i; u8 unk[3]; diff --git a/src/overlays/actors/ovl_En_Eg/z_en_eg.c b/src/overlays/actors/ovl_En_Eg/z_en_eg.c index c53100adae..7b3940994d 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -48,7 +48,8 @@ void EnEg_Init(Actor* thisx, PlayState* play) { } void func_809FFDC8(EnEg* this, PlayState* play) { - if (!sVoided && (gSaveContext.subTimerSeconds <= 0) && Flags_GetSwitch(play, 0x36) && (kREG(0) == 0)) { + if (!sVoided && (gSaveContext.subTimerSeconds <= 0) && Flags_GetSwitch(play, 0x36) && + (!OOT_DEBUG || kREG(0) == 0)) { // Void the player out Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c index 6b4a7a860b..099dc5b29a 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -304,9 +304,9 @@ void EnEiyer_SetupDie(EnEiyer* this) { } void EnEiyer_SetupDead(EnEiyer* this) { - this->actor.colorFilterParams |= 0x2000; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; + this->actor.colorFilterParams |= 0x2000; this->actionFunc = EnEiyer_Dead; } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index fb9d118719..6de4a0c58b 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -808,7 +808,6 @@ void func_80A03AB0(EnElf* this, PlayState* play) { void EnElf_UpdateLights(EnElf* this, PlayState* play) { s16 glowLightRadius; - Player* player; glowLightRadius = 100; @@ -817,7 +816,8 @@ void EnElf_UpdateLights(EnElf* this, PlayState* play) { } if (this->fairyFlags & 0x20) { - player = GET_PLAYER(play); + Player* player = GET_PLAYER(play); + Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, player->actor.world.pos.x, (s16)(player->actor.world.pos.y) + 60.0f, player->actor.world.pos.z, 255, 255, 255, 200); @@ -1379,9 +1379,15 @@ void func_80A053F0(Actor* thisx, PlayState* play) { if (player->naviTextId == 0) { if (player->unk_664 == NULL) { +#if OOT_DEBUG if (((gSaveContext.save.info.playerData.naviTimer >= 600) && (gSaveContext.save.info.playerData.naviTimer <= 3000)) || - (nREG(89) != 0)) { + (nREG(89) != 0)) +#else + if ((gSaveContext.save.info.playerData.naviTimer >= 600) && + (gSaveContext.save.info.playerData.naviTimer <= 3000)) +#endif + { player->naviTextId = QuestHint_GetNaviTextId(play); if (player->naviTextId == 0x15F) { @@ -1417,6 +1423,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { this->actionFunc(this, play); thisx->shape.rot.y = this->unk_2BC; +#if OOT_DEBUG // `gSaveContext.save.info.sceneFlags[127].chest` (like in the debug string) instead of `HIGH_SCORE(HS_HBA)` // matches too, but, with how the `SaveContext` struct is currently defined, it is an out-of-bounds read in the // `sceneFlags` array. It is theorized the original `room_inf` (currently `sceneFlags`) was an array of length @@ -1426,6 +1433,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { if ((nREG(81) != 0) && (HIGH_SCORE(HS_HBA) != 0)) { LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", HIGH_SCORE(HS_HBA), "../z_en_elf.c", 2595); } +#endif if (!Play_InCsMode(play)) { if (gSaveContext.save.info.playerData.naviTimer < 25800) { @@ -1535,7 +1543,7 @@ void EnElf_Draw(Actor* thisx, PlayState* play) { gDPSetRenderMode(dListHead++, G_RM_PASS, G_RM_ZB_CLD_SURF2); } - gSPEndDisplayList(dListHead++); + gSPEndDisplayList(dListHead); gDPSetEnvColor(POLY_XLU_DISP++, (u8)this->outerColor.r, (u8)this->outerColor.g, (u8)this->outerColor.b, (u8)(envAlpha * alphaScale)); POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index 7efa5a09a6..cab41eec90 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -338,9 +338,9 @@ void EnEncount2_UpdateEffects(EnEncount2* this, PlayState* play) { } void EnEncount2_DrawEffects(Actor* thisx, PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; EnEncount2* this = (EnEncount2*)thisx; EnEncount2Effect* effect = this->effects; - GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; s32 objectSlot; diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 3417ca1444..f36ea32563 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -315,6 +315,7 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, PlayState* play) { f32 distToBlowUp = 50.0f; s16 explosionScale; s16 explosionScaleStep; + s32 pad; if (this->type == 2) { distToBlowUp = 30.0f; diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 2b7f6bedde..886680a57f 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -773,11 +773,11 @@ void EnFd_Draw(Actor* thisx, PlayState* play) { if (this->actionFunc != EnFd_Reappear && !(this->fadeAlpha < 0.9f)) { if (1) {} Gfx_SetupDL_25Xlu(play->state.gfxCtx); - clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth / 8].r, primColors[clampedHealth / 8].g, - primColors[clampedHealth / 8].b, (u8)this->fadeAlpha); - gDPSetEnvColor(POLY_XLU_DISP++, envColors[clampedHealth / 8].r, envColors[clampedHealth / 8].g, - envColors[clampedHealth / 8].b, (u8)this->fadeAlpha); + clampedHealth = CLAMP(thisx->colChkInfo.health - 1, 0, 23) / 8; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, primColors[clampedHealth].r, primColors[clampedHealth].g, + primColors[clampedHealth].b, (u8)this->fadeAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, envColors[clampedHealth].r, envColors[clampedHealth].g, + envColors[clampedHealth].b, (u8)this->fadeAlpha); gSPSegment(POLY_XLU_DISP++, 0x8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x40, 1, 0, 0xFF - (u8)(frames * 6), 8, 0x40)); @@ -875,9 +875,10 @@ void EnFd_DrawEffectsFlames(EnFd* this, PlayState* play) { static void* dustTextures[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex, }; - s32 materialFlag; s16 i; s16 idx; + s16 pad; + s16 materialFlag; EnFdEffect* eff = this->effects; OPEN_DISPS(play->state.gfxCtx, "../z_en_fd.c", 1969); diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index f483481622..e079c8194e 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -283,7 +283,6 @@ void EnFhgFire_LightningTrail(EnFhgFire* this, PlayState* play) { void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f pos; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -291,7 +290,8 @@ void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { } if (Rand_ZeroOne() < 0.5f) { - pos = this->actor.world.pos; + Vec3f pos = this->actor.world.pos; + pos.y -= 20.0f; EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, 200, FHGFLASH_SHOCK_NO_ACTOR); } @@ -447,7 +447,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { Actor_SetScale(&this->actor, 5.25f); } this->actor.shape.rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x4000; - { + if (1) { u8 lightBallColor1 = FHGFLASH_LIGHTBALL_GREEN; s16 i1; Vec3f spD4; @@ -527,7 +527,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { &gSfxDefaultReverb); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); } - } else if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) { + break; + } + if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) { killMode = BALL_BURST; Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_HIT_THUNDER); if ((bossGnd->flyMode >= GND_FLY_VOLLEY) && (this->work[FHGFIRE_RETURN_COUNT] >= 2)) { @@ -642,7 +644,6 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { EnfHG* horse = (EnfHG*)this->actor.parent; - f32 scrollDirection; this->fwork[FHGFIRE_WARP_TEX_1_X] += 25.0f * this->fwork[FHGFIRE_WARP_TEX_SPEED]; this->fwork[FHGFIRE_WARP_TEX_1_Y] -= 40.0f * this->fwork[FHGFIRE_WARP_TEX_SPEED]; @@ -662,7 +663,8 @@ void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { } if (this->work[FHGFIRE_TIMER] > 50) { - scrollDirection = 1.0f; + f32 scrollDirection = 1.0f; + if (this->actor.params > FHGFIRE_WARP_EMERGE) { scrollDirection = -1.0f; } diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index d48103610b..5fe572eb0b 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -287,8 +287,8 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { this->skelAnime.playSpeed = 3.0f; this->actor.shape.rot.x = 0x1554; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->actor.speed = 3.0f; this->timer = 50; + this->actor.speed = 3.0f; this->actionFunc = EnFirefly_DisturbDiveAttack; } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 051e5e1cb8..1ebc39c90a 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -472,11 +472,11 @@ void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play) { void EnFish_Dropped_SetupSwimAway(EnFish* this) { this->actor.home.pos = this->actor.world.pos; - this->actor.flags |= ACTOR_FLAG_4; - this->timer = 200; this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; this->actor.shape.yOffset = 0.0f; + this->actor.flags |= ACTOR_FLAG_4; + this->timer = 200; EnFish_SetInWaterAnimation(this); this->actionFunc = EnFish_Dropped_SwimAway; this->unk_250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; @@ -624,6 +624,8 @@ void EnFish_UpdateCutscene(EnFish* this, PlayState* play) { f32 lerp; s32 bgId; + if (play) {} + if (cue == NULL) { // "Warning : DEMO ended without dousa (action) 3 termination being called" PRINTF("Warning : dousa 3 消滅 が呼ばれずにデモが終了した(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1169, diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 8a67e84b55..64ae25bba1 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -256,6 +256,8 @@ void EnFz_Damaged(EnFz* this, PlayState* play, Vec3f* vec, s32 numEffects, f32 u f32 scale; s32 life; + accel.x = accel.z = 0.0f; + accel.y = -1.0f; primColor.r = 155; primColor.g = 255; primColor.b = 255; @@ -263,8 +265,6 @@ void EnFz_Damaged(EnFz* this, PlayState* play, Vec3f* vec, s32 numEffects, f32 u envColor.r = 200; envColor.g = 200; envColor.b = 200; - accel.x = accel.z = 0.0f; - accel.y = -1.0f; for (i = 0; i < numEffects; i++) { scale = Rand_CenteredFloat(0.3f) + 0.6f; @@ -476,10 +476,10 @@ void EnFz_MoveTowardsPlayer(EnFz* this, PlayState* play) { void EnFz_SetupAimForFreeze(EnFz* this) { this->state = 1; - this->timer = 40; - this->actionFunc = EnFz_AimForFreeze; this->speedXZ = 0.0f; this->actor.speed = 0.0f; + this->timer = 40; + this->actionFunc = EnFz_AimForFreeze; } void EnFz_AimForFreeze(EnFz* this, PlayState* play) { @@ -547,16 +547,16 @@ void EnFz_BlowSmoke(EnFz* this, PlayState* play) { void EnFz_SetupDespawn(EnFz* this, PlayState* play) { this->state = 0; + this->speedXZ = 0.0f; + this->actor.gravity = 0.0f; + this->actor.velocity.y = 0.0f; + this->actor.speed = 0.0f; this->updateBgInfo = true; this->isFreezing = false; this->isDespawning = true; this->actor.flags &= ~ACTOR_FLAG_0; this->isActive = false; this->timer = 60; - this->speedXZ = 0.0f; - this->actor.gravity = 0.0f; - this->actor.velocity.y = 0.0f; - this->actor.speed = 0.0f; Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x60); this->actionFunc = EnFz_Despawn; @@ -573,9 +573,9 @@ void EnFz_SetupMelt(EnFz* this) { this->isFreezing = false; this->isDespawning = true; this->actor.flags &= ~ACTOR_FLAG_0; - this->actionFunc = EnFz_Melt; this->actor.speed = 0.0f; this->speedXZ = 0.0f; + this->actionFunc = EnFz_Melt; } void EnFz_Melt(EnFz* this, PlayState* play) { @@ -859,10 +859,10 @@ void EnFz_UpdateIceSmoke(EnFz* this, PlayState* play) { } void EnFz_DrawEffects(EnFz* this, PlayState* play) { - EnFzEffect* effect = this->effects; s16 i; GraphicsContext* gfxCtx = play->state.gfxCtx; u8 materialFlag = 0; + EnFzEffect* effect = this->effects; OPEN_DISPS(gfxCtx, "../z_en_fz.c", 1384); @@ -872,7 +872,7 @@ void EnFz_DrawEffects(EnFz* this, PlayState* play) { if (effect->type > 0) { gDPPipeSync(POLY_XLU_DISP++); - if (!materialFlag) { + if (materialFlag == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL)); materialFlag++; } diff --git a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c index 0aea936670..2ccb862d62 100644 --- a/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c +++ b/src/overlays/actors/ovl_En_Ganon_Mant/z_en_ganon_mant.c @@ -391,14 +391,14 @@ void EnGanonMant_Draw(Actor* thisx, PlayState* play) { f32 diffHalfDist; f32 yDiff; f32 yaw; - Vec3f* rightPos; - Vec3f* leftPos; - s16 strandIdx; - Vec3f midpoint; - s16 nextStrandIdx; if (this->updateHasRun) { // Only run this if update has run since last draw + Vec3f* rightPos; + Vec3f* leftPos; + s16 strandIdx; + Vec3f midpoint; + s16 nextStrandIdx; // Choose endpoints if (this->attachRightArmTimer != 0.0f) { diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 4ee2521ae9..aafcf0d06c 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -183,6 +183,8 @@ void EnGb_Init(Actor* thisx, PlayState* play) { this->actionTimer = (s16)Rand_ZeroFloat(100.0f) + 100; for (i = 0; i < ARRAY_COUNT(sCagedSoulPositions); i++) { + s32 pad; + this->cagedSouls[i].infoIdx = (s32)Rand_ZeroFloat(30.0f) % 3; this->cagedSouls[i].unk_14.x = this->cagedSouls[i].translation.x = sCagedSoulPositions[i].x + this->dyna.actor.world.pos.x; @@ -280,6 +282,8 @@ void func_80A2F83C(EnGb* this, PlayState* play) { } } if (Actor_TalkOfferAccepted(&this->dyna.actor, play)) { + s32 pad; + switch (func_8002F368(play)) { case EXCH_ITEM_NONE: func_80A2F180(this); @@ -294,9 +298,7 @@ void func_80A2F83C(EnGb* this, PlayState* play) { this->actionFunc = func_80A2FA50; break; } - return; - } - if (this->dyna.actor.xzDistToPlayer < 100.0f) { + } else if (this->dyna.actor.xzDistToPlayer < 100.0f) { Actor_OfferTalkExchangeEquiCylinder(&this->dyna.actor, play, 100.0f, EXCH_ITEM_BOTTLE_POE); } } @@ -440,7 +442,6 @@ void EnGb_Draw(Actor* thisx, PlayState* play) { void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play) { f32 temp_f20; - s16 rot; s32 i; for (i = 0; i < 4; i++) { @@ -499,12 +500,14 @@ void EnGb_UpdateCagedSouls(EnGb* this, PlayState* play) { this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y + temp_f20; this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z; } else if (i == 1) { - rot = this->dyna.actor.world.rot.y - 0x4000; + s16 rot = this->dyna.actor.world.rot.y - 0x4000; + this->cagedSouls[i].translation.x = this->cagedSouls[i].unk_14.x + Math_SinS(rot) * temp_f20; this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z + Math_CosS(rot) * temp_f20; this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y; } else { - rot = this->dyna.actor.world.rot.y + 0x4000; + s16 rot = this->dyna.actor.world.rot.y + 0x4000; + this->cagedSouls[i].translation.x = this->cagedSouls[i].unk_14.x + Math_SinS(rot) * temp_f20; this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z + Math_CosS(rot) * temp_f20; this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 705faf6041..e1317e5ba9 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -112,8 +112,8 @@ void EnGe2_ChangeAction(EnGe2* this, s32 i) { } void EnGe2_Init(Actor* thisx, PlayState* play) { - s32 pad; EnGe2* this = (EnGe2*)thisx; + s16 params = this->actor.params; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); @@ -133,7 +133,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; - switch (this->actor.params & 0xFF) { + switch (thisx->params & 0xFF) { case GE2_TYPE_PATROLLING: EnGe2_ChangeAction(this, GE2_ACTION_WALK); if (EnGe2_CheckCarpentersFreed()) { @@ -156,6 +156,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { break; default: ASSERT(0, "0", "../z_en_ge2.c", 418); + break; } this->stateFlags = 0; @@ -165,7 +166,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; this->walkDirection = this->actor.world.rot.y; - this->walkDuration = ((this->actor.params & 0xFF00) >> 8) * 10; + this->walkDuration = ((thisx->params & 0xFF00) >> 8) * 10; } void EnGe2_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index ea9772ca03..ba58e9dbdd 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -274,7 +274,6 @@ s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) { Actor* thisx = &this->actor; s16 angleToWall; s16 angleToLink; - Actor* bomb; angleToWall = thisx->wallYaw - thisx->shape.rot.y; angleToWall = ABS(angleToWall); @@ -306,22 +305,29 @@ s32 EnGeldB_ReactToPlayer(PlayState* play, EnGeldB* this, s16 arg2) { EnGeldB_SetupRollBack(this); return true; } - } else if ((bomb = Actor_FindNearby(play, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) { - thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; - if (((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || (bomb->id == ACTOR_EN_BOM_CHU)) { - if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) && - ((s16)(thisx->shape.rot.y - (bomb->world.rot.y - 0x8000)) < 0x3E80)) { - EnGeldB_SetupJump(this); - return true; + } else { + Actor* bomb = Actor_FindNearby(play, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f); + + if (bomb != NULL) { + thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; + if (((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || + (bomb->id == ACTOR_EN_BOM_CHU)) { + if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) && + ((s16)(thisx->shape.rot.y - (bomb->world.rot.y - 0x8000)) < 0x3E80)) { + EnGeldB_SetupJump(this); + return true; + } else { + EnGeldB_SetupSidestep(this, play); + return true; + } } else { - EnGeldB_SetupSidestep(this, play); + EnGeldB_SetupRollBack(this); return true; } - } else { - EnGeldB_SetupRollBack(this); - return true; } - } else if (arg2) { + } + + if (arg2) { if (angleToLink >= 0x1B58) { EnGeldB_SetupSidestep(this, play); return true; diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index e05caa58fa..0f6569d869 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -79,6 +79,7 @@ ActorInit En_GirlA_InitVars = { /**/ NULL, }; +#if OOT_DEBUG static char* sShopItemDescriptions[] = { "デクの実×5 ", // "Deku nut x5" "矢×30 ", // "Arrow x30" @@ -131,6 +132,7 @@ static char* sShopItemDescriptions[] = { "赤クスリ ", // "Red medicine" "赤クスリ " // "Red medicine" }; +#endif static s16 sMaskShopItems[8] = { ITEM_MASK_KEATON, ITEM_MASK_SPOOKY, ITEM_MASK_SKULL, ITEM_MASK_BUNNY_HOOD, @@ -895,12 +897,11 @@ void EnGirlA_Noop(EnGirlA* this, PlayState* play) { void EnGirlA_SetItemDescription(PlayState* play, EnGirlA* this) { ShopItemEntry* tmp = &shopItemEntries[this->actor.params]; s32 params = this->actor.params; - s32 maskId; - s32 isMaskFreeToBorrow; if ((this->actor.params >= SI_KEATON_MASK) && (this->actor.params <= SI_MASK_OF_TRUTH)) { - maskId = this->actor.params - SI_KEATON_MASK; - isMaskFreeToBorrow = false; + s32 maskId = this->actor.params - SI_KEATON_MASK; + s32 isMaskFreeToBorrow = false; + switch (this->actor.params) { case SI_KEATON_MASK: if (GET_ITEMGETINF(ITEMGETINF_38)) { diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index a281827ae4..14a22e3408 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -397,13 +397,13 @@ void EnGoma_SetupDead(EnGoma* this) { } void EnGoma_Dead(EnGoma* this, PlayState* play) { - Vec3f accel; - Vec3f pos; - SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speed, 1.0f, 2.0f); if (this->actionTimer == 2) { + Vec3f accel; + Vec3f pos; + pos.x = this->actor.world.pos.x; pos.y = (this->actor.world.pos.y + 5.0f) - 10.0f; pos.z = this->actor.world.pos.z; @@ -604,7 +604,6 @@ void EnGoma_LookAtPlayer(EnGoma* this, PlayState* play) { } void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { - static Vec3f sShieldKnockbackVel = { 0.0f, 0.0f, 20.0f }; Player* player = GET_PLAYER(play); if (this->hurtTimer != 0) { @@ -632,6 +631,8 @@ void EnGoma_UpdateHit(EnGoma* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.speed = -5.0f; } else { + static Vec3f sShieldKnockbackVel = { 0.0f, 0.0f, 20.0f }; + Matrix_RotateY(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&sShieldKnockbackVel, &this->shieldKnockbackVel); this->invincibilityTimer = 5; diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 7742d2f572..59068e93d6 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -84,7 +84,13 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_HEAVY }; -static f32 sUnused[] = { 10.0f, 9.2f }; +static f32 sSpeeds[] = { 10.0f, 9.2f }; + +#if OOT_DEBUG +#define EN_GOROIWA_SPEED(this) (R_EN_GOROIWA_SPEED * 0.01f) +#else +#define EN_GOROIWA_SPEED(this) sSpeeds[(this)->isInKokiri] +#endif void EnGoroiwa_UpdateCollider(EnGoroiwa* this) { static f32 yOffsets[] = { 0.0f, 59.5f }; @@ -129,10 +135,14 @@ s32 EnGoroiwa_Vec3fNormalize(Vec3f* ret, Vec3f* a) { void EnGoroiwa_SetSpeed(EnGoroiwa* this, PlayState* play) { if (play->sceneId == SCENE_KOKIRI_FOREST) { this->isInKokiri = true; +#if OOT_DEBUG R_EN_GOROIWA_SPEED = 920; +#endif } else { this->isInKokiri = false; +#if OOT_DEBUG R_EN_GOROIWA_SPEED = 1000; +#endif } } @@ -242,11 +252,13 @@ s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, PlayState* play) { Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint; if (nextPointPos->x == currentPointPos->x && nextPointPos->z == currentPointPos->z) { +#if OOT_DEBUG if (nextPointPos->y == currentPointPos->y) { // "Error: Invalid path data (points overlap)" PRINTF("Error : レールデータ不正(点が重なっている)"); PRINTF("(%s %d)(arg_data 0x%04x)\n", "../z_en_gr.c", 559, this->actor.params); } +#endif if (nextPointPos->y > currentPointPos->y) { return 1; @@ -299,7 +311,7 @@ s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, PlayState* play) { s32 pad; Vec3s* nextPointPos; - Math_StepToF(&this->actor.speed, R_EN_GOROIWA_SPEED * 0.01f, 0.3f); + Math_StepToF(&this->actor.speed, EN_GOROIWA_SPEED(this), 0.3f); Actor_UpdateVelocityXZGravity(&this->actor); path = &play->pathList[this->actor.params & 0xFF]; nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; @@ -322,7 +334,7 @@ s32 EnGoroiwa_Move(EnGoroiwa* this, PlayState* play) { nextPointPosF.x = nextPointPos->x; nextPointPosF.y = nextPointPos->y; nextPointPosF.z = nextPointPos->z; - Math_StepToF(&this->actor.speed, R_EN_GOROIWA_SPEED * 0.01f, 0.3f); + Math_StepToF(&this->actor.speed, EN_GOROIWA_SPEED(this), 0.3f); if (Math3D_Vec3fDistSq(&nextPointPosF, &this->actor.world.pos) < SQ(5.0f)) { Math_Vec3f_Diff(&nextPointPosF, &this->actor.world.pos, &posDiff); } else { @@ -346,7 +358,7 @@ s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, PlayState* play) { Path* path = &play->pathList[this->actor.params & 0xFF]; Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint; - Math_StepToF(&this->actor.velocity.y, (R_EN_GOROIWA_SPEED * 0.01f) * 0.5f, 0.18f); + Math_StepToF(&this->actor.velocity.y, EN_GOROIWA_SPEED(this) * 0.5f, 0.18f); this->actor.world.pos.x = nextPointPos->x; this->actor.world.pos.z = nextPointPos->z; return Math_StepToF(&this->actor.world.pos.y, nextPointPos->y, fabsf(this->actor.velocity.y)); @@ -435,7 +447,6 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, PlayState* play) { Vec3f rollAxis; Vec3f unitRollAxis; MtxF mtx; - Vec3f unusedDiff; if (this->stateFlags & ENGOROIWA_RETAIN_ROT_SPEED) { rollAngleDiff = this->prevRollAngleDiff; @@ -446,6 +457,8 @@ void EnGoroiwa_UpdateRotation(EnGoroiwa* this, PlayState* play) { rollAngleDiff *= this->rollRotSpeed; rollAxisPtr = &rollAxis; if (this->stateFlags & ENGOROIWA_RETAIN_ROT_SPEED) { + Vec3f unusedDiff; + /* * EnGoroiwa_GetPrevWaypointDiff has no side effects and its result goes unused, * its result was probably meant to be used instead of the actor's velocity in the diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 2563fd6bac..3964881ebe 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -139,9 +139,15 @@ s32 func_80A4E3EC(EnGs* this, PlayState* play) { void func_80A4E470(EnGs* this, PlayState* play) { Player* player = GET_PLAYER(play); +#if OOT_DEBUG bREG(15) = 0; +#endif + if (this->actor.xzDistToPlayer <= 100.0f) { +#if OOT_DEBUG bREG(15) = 1; +#endif + if (this->unk_19D == 0) { player->stateFlags2 |= PLAYER_STATE2_23; if (player->stateFlags2 & PLAYER_STATE2_24) { @@ -285,19 +291,6 @@ void func_80A4EB3C(EnGs* this, PlayState* play) { } void func_80A4ED34(EnGs* this, PlayState* play) { - static Color_RGBA8 flashRed = { 255, 50, 50, 0 }; - static Color_RGBA8 flashBlue = { 50, 50, 255, 0 }; - static Color_RGBA8 baseWhite = { 255, 255, 255, 0 }; - static Vec3f dustAccel = { 0.0f, -0.3f, 0.0f }; - static Color_RGBA8 dustPrim = { 200, 200, 200, 128 }; - static Color_RGBA8 dustEnv = { 100, 100, 100, 0 }; - static Vec3f bomb2Velocity = { 0.0f, 0.0f, 0.0f }; - static Vec3f bomb2Accel = { 0.0f, 0.0f, 0.0f }; - u8 i; - Vec3f dustPos; - Vec3f dustVelocity; - Vec3f bomb2Pos; - if (this->unk_19F == 0) { this->unk_200 = 40; this->unk_19F++; @@ -312,6 +305,10 @@ void func_80A4ED34(EnGs* this, PlayState* play) { } if (this->unk_19F == 2) { + static Color_RGBA8 flashRed = { 255, 50, 50, 0 }; + static Color_RGBA8 flashBlue = { 50, 50, 255, 0 }; + static Color_RGBA8 baseWhite = { 255, 255, 255, 0 }; + this->unk_200--; Color_RGBA8_Copy(&this->flashColor, &baseWhite); if ((this->unk_200 < 80) && ((this->unk_200 % 20) < 8)) { @@ -337,7 +334,15 @@ void func_80A4ED34(EnGs* this, PlayState* play) { } if (this->unk_19F == 3) { + u8 i; + for (i = 0; i < 3; i++) { + static Vec3f dustAccel = { 0.0f, -0.3f, 0.0f }; + static Color_RGBA8 dustPrim = { 200, 200, 200, 128 }; + static Color_RGBA8 dustEnv = { 100, 100, 100, 0 }; + Vec3f dustPos; + Vec3f dustVelocity; + dustVelocity.x = Rand_CenteredFloat(15.0f); dustVelocity.y = Rand_ZeroFloat(-1.0f); dustVelocity.z = Rand_CenteredFloat(15.0f); @@ -362,6 +367,10 @@ void func_80A4ED34(EnGs* this, PlayState* play) { if (this->unk_19F == 4) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1); if (this->actor.bgCheckFlags & (BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) { + static Vec3f bomb2Velocity = { 0.0f, 0.0f, 0.0f }; + static Vec3f bomb2Accel = { 0.0f, 0.0f, 0.0f }; + Vec3f bomb2Pos; + bomb2Pos.x = this->actor.world.pos.x; bomb2Pos.y = this->actor.world.pos.y; bomb2Pos.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index c7e05bc863..7255fba4aa 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -17,7 +17,7 @@ void EnHeishi2_Init(Actor* thisx, PlayState* play); void EnHeishi2_Destroy(Actor* thisx, PlayState* play); void EnHeishi2_Update(Actor* thisx, PlayState* play); -void EnHeishi2_Draw(Actor* thisx, PlayState* play); +void EnHeishi2_Draw(Actor* thisx, PlayState* play2); void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play); void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play); @@ -389,7 +389,6 @@ void func_80A5399C(EnHeishi2* this, PlayState* play) { void func_80A53AD4(EnHeishi2* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 exchangeItemId; s16 yawDiffTemp; s16 yawDiff; @@ -400,8 +399,10 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { this->actor.textId = 0x200E; } this->unk_300 = TEXT_STATE_DONE; + if (Actor_TalkOfferAccepted(&this->actor, play)) { - exchangeItemId = func_8002F368(play); + s32 exchangeItemId = func_8002F368(play); + if (exchangeItemId == EXCH_ITEM_ZELDAS_LETTER) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); player->actor.textId = 0x2010; @@ -410,12 +411,14 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { } else if (exchangeItemId != EXCH_ITEM_NONE) { player->actor.textId = 0x200F; } - } else { - yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - yawDiff = ABS(yawDiffTemp); - if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { - Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, EXCH_ITEM_ZELDAS_LETTER); - } + return; + } + + yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + yawDiff = ABS(yawDiffTemp); + + if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, EXCH_ITEM_ZELDAS_LETTER); } } @@ -834,9 +837,9 @@ void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1777); } -void EnHeishi2_Draw(Actor* thisx, PlayState* play) { +void EnHeishi2_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; EnHeishi2* this = (EnHeishi2*)thisx; - Mtx* mtx; s32 linkChildObjectSlot; OPEN_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1792); @@ -848,6 +851,8 @@ void EnHeishi2_Draw(Actor* thisx, PlayState* play) { if ((this->type == 5) && GET_INFTABLE(INFTABLE_77)) { linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD); if (linkChildObjectSlot >= 0) { + Mtx* mtx; + Matrix_Put(&this->mtxf_330); Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(70), MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index b0a853b023..691f0bb641 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -211,6 +211,8 @@ void func_80A56614(EnHeishi4* this, PlayState* play) { } void func_80A5673C(EnHeishi4* this, PlayState* play) { + f32 frames; + if (GET_EVENTCHKINF(EVENTCHKINF_45)) { PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ マスターソード祝入手! ☆☆☆☆☆ \n" VT_RST); Actor_Kill(&this->actor); @@ -219,7 +221,7 @@ void func_80A5673C(EnHeishi4* this, PlayState* play) { this->unk_284 = 0; if (GET_EVENTCHKINF(EVENTCHKINF_80)) { if (!GET_INFTABLE(INFTABLE_6C)) { - f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardAnim_00C444); + frames = Animation_GetLastFrame(&gEnHeishiDyingGuardAnim_00C444); Animation_Change(&this->skelAnime, &gEnHeishiDyingGuardAnim_00C444, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0x7007; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 351b29267a..20324e670a 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -529,14 +529,13 @@ void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnA void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f curWaypointPos; Vec3f prevWaypointPos; - f32 playerDist; + s32 prevWaypoint; f32 sp50; s16 relPlayerYaw; f32 px; f32 pz; f32 d; f32 distSq; - s32 prevWaypoint; EnHorse_RaceWaypointPos(raceInfo->waypoints, this->curRaceWaypoint, &curWaypointPos); Math3D_RotateXZPlane(&curWaypointPos, raceInfo->waypoints[this->curRaceWaypoint].angle, &px, &pz, &d); @@ -559,14 +558,15 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceIn EnHorse_RotateToPoint(this, play, &curWaypointPos, 400); if (distSq < SQ(300.0f)) { - playerDist = this->actor.xzDistToPlayer; - if (playerDist < 130.0f || this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + if (this->actor.xzDistToPlayer < 130.0f || this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + s32 pad; + if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { this->actor.world.rot.y -= 280; } else { this->actor.world.rot.y += 280; } - } else if (playerDist < 300.0f) { + } else if (this->actor.xzDistToPlayer < 300.0f) { if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { this->actor.world.rot.y += 280; } else { @@ -1320,8 +1320,7 @@ void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { } void EnHorse_StartGallopingInterruptable(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; EnHorse_StartGalloping(this); } @@ -1334,8 +1333,7 @@ void EnHorse_StartGalloping(EnHorse* this) { } void EnHorse_MountedGallopReset(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; this->action = ENHORSE_ACT_MOUNTED_GALLOP; this->animationIdx = ENHORSE_ANIM_GALLOP; this->unk_234 = 0; @@ -1498,8 +1496,7 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { } void EnHorse_StartReversingInterruptable(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; EnHorse_StartReversing(this); } @@ -1906,7 +1903,6 @@ void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { f32 distToPlayer; - f32 angleDiff; R_EPONAS_SONG_PLAYED = false; distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); @@ -1914,6 +1910,8 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { // First rotate if the player is behind if ((this->playerDir == PLAYER_DIR_BACK_R || this->playerDir == PLAYER_DIR_BACK_L) && (distToPlayer > 300.0f && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER))) { + f32 angleDiff; + this->animationIdx = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); @@ -2182,6 +2180,8 @@ void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { f32 temp_f2; + Vec3s* jointTable; + f32 y; if (this->cutsceneFlags & 1) { EnHorse_CsMoveToPoint(this, play, cue); @@ -2210,9 +2210,6 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { } if (SkelAnime_Update(&this->skin.skelAnime) || (temp_f2 > 19.0f && this->actor.world.pos.y < (this->actor.floorHeight - this->actor.velocity.y) + 80.0f)) { - Vec3s* jointTable; - f32 y; - this->cutsceneFlags |= 1; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -3411,8 +3408,9 @@ void EnHorse_UpdatePlayerDir(EnHorse* this, PlayState* play) { s16 angle; f32 s; f32 c; + Player* player = GET_PLAYER(play); - angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + angle = Actor_WorldYawTowardActor(&this->actor, &player->actor) - this->actor.world.rot.y; s = Math_SinS(angle); c = Math_CosS(angle); if (s > 0.8660254f) { // sin(60 degrees) diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index ed63cd139b..53c09dc472 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -136,12 +136,14 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) Player* player = GET_PLAYER(play); s32 i; EnHorse* ingoHorse; - EnHorse* horse; + Player* player2 = player; if ((this->startTimer > 50) && !(this->startFlags & INGORACE_SET_TIMER)) { this->startFlags |= INGORACE_SET_TIMER; Interface_SetTimer(0); } else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->startFlags & INGORACE_PLAYER_MOVE)) { + EnHorse* horse; + this->startFlags |= INGORACE_PLAYER_MOVE; horse = (EnHorse*)player->rideActor; horse->inRace = 1; @@ -175,8 +177,6 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) } if (this->result == INGORACE_NO_RESULT) { - Player* player2 = player; - if ((player2->rideActor != NULL) && (this->playerCheck[2] == 1) && AT_FINISH_LINE(player2->rideActor)) { this->playerFinish++; if (this->playerFinish > 0) { @@ -319,6 +319,8 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play s32 i; Player* player = GET_PLAYER(play); EnHorse* horse; + Player* player2 = player; + f32 dist; if (!(this->raceFlags & MALONRACE_PLAYER_ON_MARK) && AT_FINISH_LINE(player->rideActor)) { this->raceFlags |= MALONRACE_PLAYER_ON_MARK; @@ -330,10 +332,12 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play this->raceFlags |= MALONRACE_SET_TIMER; Interface_SetTimer(0); } else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->raceFlags & MALONRACE_PLAYER_MOVE)) { - this->raceFlags |= MALONRACE_PLAYER_MOVE; - horse = (EnHorse*)player->rideActor; + EnHorse* rideHorse; - horse->inRace = 1; + this->raceFlags |= MALONRACE_PLAYER_MOVE; + rideHorse = (EnHorse*)player->rideActor; + + rideHorse->inRace = 1; } else if ((this->startTimer > 81) && !(this->raceFlags & MALONRACE_START_SFX)) { this->raceFlags |= MALONRACE_START_SFX; Audio_PlaySfxGeneral(NA_SE_SY_START_SHOT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -342,9 +346,6 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play this->startTimer++; if (this->result == MALONRACE_NO_RESULT) { - Player* player2 = player; - f32 dist; - for (i = 0; i < 16; i++) { if ((this->lapCount == 0) && (i >= 8)) { break; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 8c50ffc8de..2eedfd0b65 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -344,8 +344,6 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { f32 distFromLink; s32 animationEnded; s32 newAnimationIdx; - f32 distFromHome; - f32 distLinkFromHome; func_80A69F5C(this, play); player = GET_PLAYER(play); @@ -369,8 +367,9 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { animationEnded = SkelAnime_Update(&this->skin.skelAnime); if (animationEnded || (this->animationIdx == 1) || (this->animationIdx == 0)) { if (GET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH)) { - distFromHome = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); - distLinkFromHome = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos); + f32 distFromHome = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); + f32 distLinkFromHome = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos); + if (distLinkFromHome > 250.0f) { if (distFromHome >= 300.0f) { newAnimationIdx = 4; diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 01a1ebc249..5b8aebc28b 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -31,7 +31,7 @@ typedef enum { void EnHorseNormal_Init(Actor* thisx, PlayState* play); void EnHorseNormal_Destroy(Actor* thisx, PlayState* play); void EnHorseNormal_Update(Actor* thisx, PlayState* play); -void EnHorseNormal_Draw(Actor* thisx, PlayState* play); +void EnHorseNormal_Draw(Actor* thisx, PlayState* play2); void func_80A6B91C(EnHorseNormal* this, PlayState* play); void func_80A6BC48(EnHorseNormal* this); @@ -333,10 +333,10 @@ void EnHorseNormal_CycleAnimations(EnHorseNormal* this, PlayState* play) { void func_80A6BC48(EnHorseNormal* this) { this->action = HORSE_WANDER; this->animationIdx = 0; - this->unk_21C = 0; - this->unk_21E = 0; this->actor.speed = 0.0f; this->unk_218 = 0.0f; + this->unk_21C = 0; + this->unk_21E = 0; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -484,10 +484,10 @@ void EnHorseNormal_Wander(EnHorseNormal* this, PlayState* play) { void func_80A6C4CC(EnHorseNormal* this) { this->action = HORSE_WAIT; this->animationIdx = 0; - this->unk_21C = 0; - this->unk_21E = 0; this->actor.speed = 0.0f; this->unk_218 = 0.0f; + this->unk_21C = 0; + this->unk_21E = 0; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -516,11 +516,11 @@ void EnHorseNormal_Wait(EnHorseNormal* this, PlayState* play) { void func_80A6C6B0(EnHorseNormal* this) { this->action = HORSE_WAIT_CLONE; this->animationIdx = 0; + this->actor.speed = 0.0f; + this->unk_218 = 0.0f; this->unk_21C = 0; this->unk_21E = 0; this->actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; - this->actor.speed = 0.0f; - this->unk_218 = 0.0f; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -648,9 +648,9 @@ void func_80A6CC88(PlayState* play, EnHorseNormal* this, Vec3f* arg2) { } } -void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { +void EnHorseNormal_Draw(Actor* thisx, PlayState* play2) { EnHorseNormal* this = (EnHorseNormal*)thisx; - Mtx* mtx2; + PlayState* play = (PlayState*)play2; OPEN_DISPS(play->state.gfxCtx, "../z_en_horse_normal.c", 2224); @@ -662,7 +662,7 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { if (this->action == HORSE_WAIT_CLONE) { MtxF skinMtx; - Mtx* mtx1; + Mtx* mtx; Vec3f clonePos = { 0.0f, 0.0f, 0.0f }; s16 cloneRotY; f32 distFromGround = this->actor.world.pos.y - this->actor.floorHeight; @@ -702,12 +702,12 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { this->actor.shape.rot.x, cloneRotY, this->actor.shape.rot.z, clonePos.x, (this->actor.shape.yOffset * this->actor.scale.y) + clonePos.y, clonePos.z); - mtx1 = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); - if (mtx1 == NULL) { + mtx = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); + if (mtx == NULL) { return; } gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_OPA_DISP++, mtx1, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_800A63CC(&this->actor, play, &this->skin, NULL, NULL, true, 0, SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS | SKIN_DRAW_FLAG_CUSTOM_MATRIX); this->cloneCollider.dim.pos.x = clonePos.x; @@ -720,9 +720,9 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { temp_f0_4 = (1.0f - (distFromGround * 0.01f)) * this->actor.shape.shadowScale; Matrix_Scale(this->actor.scale.x * temp_f0_4, 1.0f, this->actor.scale.z * temp_f0_4, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(cloneRotY), MTXMODE_APPLY); - mtx2 = MATRIX_NEW(play->state.gfxCtx, "../z_en_horse_normal.c", 2329); - if (mtx2 != NULL) { - gSPMatrix(POLY_XLU_DISP++, mtx2, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + mtx = MATRIX_NEW(play->state.gfxCtx, "../z_en_horse_normal.c", 2329); + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHorseShadowDL); } } diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index b0ae4a2353..7394b7c5d4 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -1106,8 +1106,6 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po u8 i; void* ptr; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2170); if (limbIndex == 15) { @@ -1143,6 +1141,8 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po rot->z += Math_CosS(this->unk_23C[limbIndex]) * 200.0f; } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2228); return false; diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index 10d4addaeb..1528f2b20e 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -356,9 +356,13 @@ void EnIceHono_Update(Actor* thisx, PlayState* play) { sin156 = Math_SinS(this->unk_156); sin154 = Math_SinS(this->unk_154); intensity = (Rand_ZeroOne() * 0.05f) + ((sin154 * 0.125f) + (sin156 * 0.1f)) + 0.425f; + +#if OOT_DEBUG if ((intensity > 0.7f) || (intensity < 0.2f)) { PRINTF("ありえない値(ratio = %f)\n", intensity); // "impossible value(ratio = %f)" } +#endif + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 10, this->actor.world.pos.z, (s32)(155.0f * intensity), (s32)(210.0f * intensity), (s32)(255.0f * intensity), 1400); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 618aaddfac..cc8dabe251 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -708,18 +708,13 @@ void EnIk_Die(EnIk* this, PlayState* play) { } void EnIk_UpdateDamage(EnIk* this, PlayState* play) { - f32 frames; - s16 pad; - u8 prevHealth; - s32 damageEffect; - Vec3f sparksPos; if ((this->unk_2F8 == 3) || (this->unk_2F8 == 2)) { return; } if (this->shieldCollider.base.acFlags & AC_BOUNCED) { - frames = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; + f32 frames = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; if (this->skelAnime.curFrame < frames) { this->skelAnime.curFrame = frames; @@ -728,7 +723,11 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { this->shieldCollider.base.acFlags &= ~AC_BOUNCED; this->bodyCollider.base.acFlags &= ~AC_HIT; } else if (this->bodyCollider.base.acFlags & AC_HIT) { - sparksPos = this->actor.world.pos; + s16 pad; + u8 prevHealth; + s32 damageEffect; + Vec3f sparksPos = this->actor.world.pos; + sparksPos.y += 50.0f; Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, true); @@ -1120,10 +1119,12 @@ s32 EnIk_UpdateSkelAnime(EnIk* this) { CsCmdActorCue* EnIk_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; - } else { - return NULL; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + + return NULL; } void EnIk_SetStartPosRotFromCue(EnIk* this, PlayState* play, s32 cueChannel) { diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index f8895308c9..f6fcd43c62 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -88,8 +88,8 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { Vtx* phi_s0_2; Vec3f sp108; Vec3f spFC; - Actor* actorProfessor; - Actor* actorBeanGuy; + f32 rotX; + f32 rotZ; f32 dxVtx; f32 dyVtx; f32 dzVtx; @@ -148,6 +148,9 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { // Credits scene. The magic carpet man is friends with the bean guy and the lakeside professor. if ((gSaveContext.save.entranceIndex == ENTR_LON_LON_RANCH_0) && (gSaveContext.sceneLayer == 8)) { + Actor* actorProfessor; + Actor* actorBeanGuy; + isInCreditsScene = true; actorProfessor = play->actorCtx.actorLists[ACTORCAT_NPC].head; @@ -320,10 +323,6 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { // Fancy math to smooth each part of the wave considering its neighborhood. for (i = 0; i < ARRAY_COUNT(sCarpetOddVtx); i++, carpetVtx++) { - f32 rotX; - f32 rotZ; - s32 pad; - // Carpet size is 12x12. if ((i % 12) == 11) { // Last column. j = i - 1; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index d14687b630..bd5edc270c 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -194,10 +194,14 @@ static u16 sCutFlags[] = { }; void EnKanban_SetFloorRot(EnKanban* this) { + f32 nx; + f32 ny; + f32 nz; + if (this->actor.floorPoly != NULL) { - f32 nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); - f32 ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); - f32 nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); + nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); + ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); + nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); this->floorRot.x = -Math_FAtan2F(-nz * ny, 1.0f); this->floorRot.z = Math_FAtan2F(-nx * ny, 1.0f); @@ -437,7 +441,6 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { f32 tempY; f32 tempZ; f32 tempYDistToWater; - u8 onGround; Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 50.0f, @@ -460,107 +463,112 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { this->actor.yDistToWater = tempYDistToWater; PRINTF(VT_RST); - onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); - if (this->spinXFlag) { - this->spinRot.x += this->spinVel.x; - this->spinVel.x -= 0x800; - if ((this->spinRot.x <= 0) && onGround) { - this->spinRot.x = 0; - this->spinVel.x = 0; + + if (1) { + u8 onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); + + if (this->spinXFlag) { + this->spinRot.x += this->spinVel.x; + this->spinVel.x -= 0x800; + if ((this->spinRot.x <= 0) && onGround) { + this->spinRot.x = 0; + this->spinVel.x = 0; + } + } else { + this->spinRot.x -= this->spinVel.x; + this->spinVel.x -= 0x800; + if ((this->spinRot.x >= 0) && onGround) { + this->spinRot.x = 0; + this->spinVel.x = 0; + } } - } else { - this->spinRot.x -= this->spinVel.x; - this->spinVel.x -= 0x800; - if ((this->spinRot.x >= 0) && onGround) { - this->spinRot.x = 0; - this->spinVel.x = 0; + if (this->spinVel.x < -0xC00) { + this->spinVel.x = -0xC00; } - } - if (this->spinVel.x < -0xC00) { - this->spinVel.x = -0xC00; - } - if (this->spinZFlag) { - this->spinRot.z += this->spinVel.z; - this->spinVel.z -= 0x800; - if ((this->spinRot.z <= 0) && onGround) { - this->spinRot.z = 0; - this->spinVel.z = 0; + if (this->spinZFlag) { + this->spinRot.z += this->spinVel.z; + this->spinVel.z -= 0x800; + if ((this->spinRot.z <= 0) && onGround) { + this->spinRot.z = 0; + this->spinVel.z = 0; + } + } else { + this->spinRot.z -= this->spinVel.z; + this->spinVel.z -= 0x800; + if ((this->spinRot.z >= 0) && onGround) { + this->spinRot.z = 0; + this->spinVel.z = 0; + } } - } else { - this->spinRot.z -= this->spinVel.z; - this->spinVel.z -= 0x800; - if ((this->spinRot.z >= 0) && onGround) { - this->spinRot.z = 0; - this->spinVel.z = 0; + if (this->spinVel.z < -0xC00) { + this->spinVel.z = -0xC00; + } + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.speed *= -0.5f; + Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); + } + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + this->actionState = ENKANBAN_WATER; + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); + this->bounceX = this->bounceZ = 0; + this->actor.world.pos.y += this->actor.yDistToWater; + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); + this->actor.velocity.y = 0.0f; + this->actor.gravity = 0.0f; + PRINTF(" WAT Y = %f\n", this->actor.yDistToWater); + PRINTF(" POS Y = %f\n", this->actor.world.pos.y); + PRINTF(" GROUND Y = %f\n", this->actor.floorHeight); + break; + } + + if (onGround) { + if (this->bounceCount <= 0) { + this->bounceCount++; + this->actor.velocity.y *= -0.3f; + this->actor.world.rot.y += (s16)Rand_CenteredFloat(16384.0f); + } else { + this->actor.velocity.y = 0.0f; + } + this->actor.speed *= 0.7f; + if ((this->spinRot.x == 0) && (this->bounceX != 0)) { + this->spinVel.x = this->bounceX * 0x200; + if (this->bounceX != 0) { + this->bounceX -= 5; + if (this->bounceX <= 0) { + this->bounceX = 0; + } + } + if (Rand_ZeroOne() < 0.5f) { + this->spinXFlag = true; + } else { + this->spinXFlag = false; + } + bounced = true; + } + if ((this->spinRot.z == 0) && (this->bounceZ != 0)) { + this->spinVel.z = this->bounceZ * 0x200; + if (this->bounceZ != 0) { + this->bounceZ -= 5; + if (this->bounceZ <= 0) { + this->bounceZ = 0; + } + } + if (Rand_ZeroOne() < 0.5f) { + this->spinZFlag = true; + } else { + this->spinZFlag = false; + } + bounced = true; + } + Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000); + } else { + this->actor.shape.rot.y += this->spinVel.y; + this->actor.shape.rot.x += this->direction * 0x7D0; } - } - if (this->spinVel.z < -0xC00) { - this->spinVel.z = -0xC00; - } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - this->actor.speed *= -0.5f; - Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); - } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - this->actionState = ENKANBAN_WATER; - Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); - this->bounceX = this->bounceZ = 0; - this->actor.world.pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); - EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); - EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); - this->actor.velocity.y = 0.0f; - this->actor.gravity = 0.0f; - PRINTF(" WAT Y = %f\n", this->actor.yDistToWater); - PRINTF(" POS Y = %f\n", this->actor.world.pos.y); - PRINTF(" GROUND Y = %f\n", this->actor.floorHeight); - break; } - if (onGround) { - if (this->bounceCount <= 0) { - this->bounceCount++; - this->actor.velocity.y *= -0.3f; - this->actor.world.rot.y += (s16)Rand_CenteredFloat(16384.0f); - } else { - this->actor.velocity.y = 0.0f; - } - this->actor.speed *= 0.7f; - if ((this->spinRot.x == 0) && (this->bounceX != 0)) { - this->spinVel.x = this->bounceX * 0x200; - if (this->bounceX != 0) { - this->bounceX -= 5; - if (this->bounceX <= 0) { - this->bounceX = 0; - } - } - if (Rand_ZeroOne() < 0.5f) { - this->spinXFlag = true; - } else { - this->spinXFlag = false; - } - bounced = true; - } - if ((this->spinRot.z == 0) && (this->bounceZ != 0)) { - this->spinVel.z = this->bounceZ * 0x200; - if (this->bounceZ != 0) { - this->bounceZ -= 5; - if (this->bounceZ <= 0) { - this->bounceZ = 0; - } - } - if (Rand_ZeroOne() < 0.5f) { - this->spinZFlag = true; - } else { - this->spinZFlag = false; - } - bounced = true; - } - Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000); - } else { - this->actor.shape.rot.y += this->spinVel.y; - this->actor.shape.rot.x += this->direction * 0x7D0; - } if (bounced) { s16 dustCount; s16 j; diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 4b20f4018c..e1e6068017 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -47,13 +47,6 @@ static ColliderCylinderInit D_80AA0420 = { static u32 D_80AA044C[] = { DMG_SPIN_MASTER, DMG_SPIN_KOKIRI, DMG_SPIN_GIANT }; static u32 D_80AA0458[] = { DMG_JUMP_MASTER, DMG_JUMP_KOKIRI, DMG_JUMP_GIANT }; -static u16 sSfxIds[] = { - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, -}; - // Setup action void func_80A9EFE0(EnMThunder* this, EnMThunderActionFunc actionFunc) { this->actionFunc = actionFunc; @@ -207,8 +200,19 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { func_80A9EFE0(this, func_80A9F9B4); this->unk_1C4 = 8; - Audio_PlaySfxGeneral(sSfxIds[this->unk_1C6], &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + + { + static u16 sSfxIds[] = { + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + }; + + Audio_PlaySfxGeneral(sSfxIds[this->unk_1C6], &player->actor.projectedPos, 4, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + this->unk_1AC = 1.0f; return; } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 6265291986..99622ab6b9 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -264,8 +264,8 @@ void func_80AA204C(EnMa2* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_24) { - player->unk_6A8 = &this->actor; player->stateFlags2 |= PLAYER_STATE2_25; + player->unk_6A8 = &this->actor; Message_StartOcarina(play, OCARINA_ACTION_CHECK_EPONA); this->actionFunc = func_80AA20E4; } else if (this->actor.xzDistToPlayer < 30.0f + this->collider.dim.radius) { diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 44f1e64336..621d2e4a95 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -1052,13 +1052,13 @@ void EnMb_ClubDamaged(EnMb* this, PlayState* play) { } void EnMb_ClubDamagedWhileKneeling(EnMb* this, PlayState* play) { - s32 pad; - if (SkelAnime_Update(&this->skelAnime)) { if (this->timer3 != 0) { this->timer3--; if (this->timer3 == 0) { if (this->timer1 == 0) { + s32 pad; + Animation_Change(&this->skelAnime, &gEnMbClubStandUpAnim, 3.0f, 0.0f, Animation_GetLastFrame(&gEnMbClubStandUpAnim), ANIMMODE_ONCE_INTERP, 0.0f); this->timer1 = 1; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 6ad429adbb..28202269f9 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -512,8 +512,6 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; - if (0) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1065); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -560,6 +558,8 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { } } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1141); } diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index ec0af71d89..0d3c3b767d 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -192,6 +192,7 @@ void EnNb_UpdateEyes(EnNb* this) { } } +#if OOT_DEBUG void func_80AB11EC(EnNb* this) { this->action = NB_ACTION_7; this->drawMode = NB_DRAW_NOTHING; @@ -219,6 +220,7 @@ void func_80AB1210(EnNb* this, PlayState* play) { } } } +#endif void func_80AB1284(EnNb* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); @@ -230,7 +232,9 @@ s32 EnNb_UpdateSkelAnime(EnNb* this) { CsCmdActorCue* EnNb_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } return NULL; @@ -527,7 +531,9 @@ void EnNb_SetupLightOrb(EnNb* this, PlayState* play) { void EnNb_Hide(EnNb* this, PlayState* play) { EnNb_SetupHide(this, play); +#if OOT_DEBUG func_80AB1210(this, play); +#endif } void EnNb_Fade(EnNb* this, PlayState* play) { @@ -535,7 +541,9 @@ void EnNb_Fade(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_CheckToFade(this, play); +#if OOT_DEBUG func_80AB1210(this, play); +#endif } void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { @@ -543,7 +551,9 @@ void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupLightOrb(this, play); +#if OOT_DEBUG func_80AB1210(this, play); +#endif } void EnNb_DrawTransparency(EnNb* this, PlayState* play) { @@ -1118,6 +1128,8 @@ void EnNb_CrawlspaceSpawnCheck(EnNb* this, PlayState* play) { this->action = NB_CROUCH_CRAWLSPACE; this->drawMode = NB_DRAW_DEFAULT; } else { + s32 pad; + EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, 0.0f, 0); this->headTurnFlag = 1; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1207,6 +1219,8 @@ void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { void func_80AB3838(EnNb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = NB_IN_DIALOG; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1299,6 +1313,8 @@ void func_80AB3A7C(EnNb* this, PlayState* play, s32 animFinished) { void func_80AB3B04(EnNb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = NB_ACTION_30; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1469,6 +1485,8 @@ s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (this->headTurnFlag != 0) { if (limbIndex == NB_LIMB_TORSO) { + s32 pad; + rot->x += interactInfo->torsoRot.y; rot->y -= interactInfo->torsoRot.x; ret = false; diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 847710b580..b48616a46d 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -11,7 +11,7 @@ void EnNiwLady_Destroy(Actor* thisx, PlayState* play); void EnNiwLady_Update(Actor* thisx, PlayState* play); void func_80AB9F24(EnNiwLady* this, PlayState* play); -void EnNiwLady_Draw(Actor* thisx, PlayState* play); +void EnNiwLady_Draw(Actor* thisx, PlayState* play2); void func_80ABA21C(EnNiwLady* this, PlayState* play); void func_80ABAD38(EnNiwLady* this, PlayState* play); void func_80ABA778(EnNiwLady* this, PlayState* play); @@ -199,6 +199,7 @@ void func_80ABA21C(EnNiwLady* this, PlayState* play) { void func_80ABA244(EnNiwLady* this, PlayState* play) { EnNiw* currentCucco; + s32 pad[2]; s32 phi_s1; this->cuccosInPen = 0; @@ -223,7 +224,7 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) { } currentCucco = (EnNiw*)currentCucco->actor.next; } - if (BREG(7) != 0) { + if (OOT_DEBUG && BREG(7) != 0) { this->cuccosInPen = BREG(7) - 1; } phi_s1 = this->cuccosInPen; @@ -358,13 +359,13 @@ void func_80ABA778(EnNiwLady* this, PlayState* play) { void func_80ABA878(EnNiwLady* this, PlayState* play) { Player* player = GET_PLAYER(play); - s8 playerExchangeItemId; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 11; } if (Actor_TalkOfferAccepted(&this->actor, play)) { - playerExchangeItemId = func_8002F368(play); + s8 playerExchangeItemId = func_8002F368(play); + if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); player->actor.textId = sTradeItemTextIds[5]; @@ -379,9 +380,10 @@ void func_80ABA878(EnNiwLady* this, PlayState* play) { this->unk_26E = this->unk_27A + 21; this->actionFunc = !this->unk_273 ? func_80ABA778 : func_80ABA9B8; } - } else { - Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 50.0f, EXCH_ITEM_POCKET_CUCCO); + return; } + + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 50.0f, EXCH_ITEM_POCKET_CUCCO); } void func_80ABA9B8(EnNiwLady* this, PlayState* play) { @@ -573,10 +575,10 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 return false; } -void EnNiwLady_Draw(Actor* thisx, PlayState* play) { +void EnNiwLady_Draw(Actor* thisx, PlayState* play2) { static void* sEyeTextures[] = { gCuccoLadyEyeOpenTex, gCuccoLadyEyeHalfTex, gCuccoLadyEyeClosedTex }; EnNiwLady* this = (EnNiwLady*)thisx; - s32 pad; + PlayState* play = (PlayState*)play2; OPEN_DISPS(play->state.gfxCtx, "../z_en_niw_lady.c", 1347); if (this->unk_27E != 0) { diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 0ec08037fe..126a99728a 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -139,8 +139,8 @@ void EnNy_Init(Actor* thisx, PlayState* play) { PRINTF("ダミーニュウ イニシャル[ %d ] !!\n", this->actor.params); PRINTF("En_Ny_actor_move2[ %x ] !!\n", EnNy_UpdateUnused); this->actor.colChkInfo.mass = 0xFF; - this->collider.base.colType = COLTYPE_METAL; this->actor.update = EnNy_UpdateUnused; + this->collider.base.colType = COLTYPE_METAL; } } @@ -368,7 +368,6 @@ void EnNy_Update(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; f32 temp_f20; f32 temp_f22; - s32 i; this->timer++; temp_f20 = this->unk_1E0 - 0.25f; @@ -391,6 +390,8 @@ void EnNy_Update(Actor* thisx, PlayState* play) { this->unk_1F0 = temp_f22; this->actor.world.pos.y += temp_f22; if (EnNy_CollisionCheck(this, play) != 0) { + s32 i; + for (i = 0; i < 8; i++) { this->unk_1F8[i].x = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.x); this->unk_1F8[i].y = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.y); diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 61d2ea57a2..d89c860924 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -679,10 +679,11 @@ s32 EnOkuta_GetSnoutScale(EnOkuta* this, f32 curFrame, Vec3f* scale) { s32 EnOkuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnOkuta* this = (EnOkuta*)thisx; - f32 curFrame = this->skelAnime.curFrame; + f32 curFrame; Vec3f scale; s32 doScale = false; + curFrame = this->skelAnime.curFrame; if (this->actionFunc == EnOkuta_Die) { curFrame += this->timer; } diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 1f8d80e66d..070944d501 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -141,6 +141,7 @@ static s16 sItemShelfRot[] = { 0xEAAC, 0xEAAC, 0xEAAC, 0xEAAC, 0x1554, 0x1554, 0 // unused values? static s16 D_80AC8904[] = { 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025 }; +#if OOT_DEBUG static char* sShopkeeperPrintName[] = { "コキリの店 ", // "Kokiri Shop" "薬屋 ", // "Potion Shop" @@ -154,6 +155,7 @@ static char* sShopkeeperPrintName[] = { "インゴーの店", // "Ingo Store" "お面屋 ", // "Mask Shop" }; +#endif typedef struct { /* 0x00 */ s16 objId; @@ -888,6 +890,8 @@ void EnOssan_State_StartConversation(EnOssan* this, PlayState* play, Player* pla if (this->actor.params == OSSAN_TYPE_MASK && dialogState == TEXT_STATE_CHOICE) { if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0]) && Message_ShouldAdvance(play)) { + s32 pad; + switch (play->msgCtx.choiceIndex) { case 0: EnOssan_StartShopping(play, this); @@ -1691,6 +1695,8 @@ void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player selectedItem = this->shelfSlots[this->cursorIndex]; selectedItem->updateStockedItemFunc(play, selectedItem); if (!EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { + s32 pad; + switch (play->msgCtx.choiceIndex) { case 0: PRINTF(VT_FGCOL(YELLOW) "★★★ 続けるよ!! ★★★" VT_RST "\n"); @@ -2275,15 +2281,17 @@ void EnOssan_DrawTextRec(PlayState* play, s32 r, s32 g, s32 b, s32 a, f32 x, f32 gDPSetPrimColor(OVERLAY_DISP++, 0, 0, r, g, b, a); w = 8.0f * z; + ulx = (x - w) * 4.0f; + lrx = (x + w) * 4.0f; + h = 12.0f * z; + uly = (y - h) * 4.0f; + lry = (y + h) * 4.0f; + texCoordScale = (1.0f / z) * 1024; dsdx = texCoordScale * dx; dtdy = dy * texCoordScale; - ulx = (x - w) * 4.0f; - uly = (y - h) * 4.0f; - lrx = (x + w) * 4.0f; - lry = (y + h) * 4.0f; gSPTextureRectangle(OVERLAY_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); CLOSE_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4242); } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index e0789d8148..c2cbe4b9d4 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -1368,6 +1368,7 @@ void func_80ACD2CC(EnOwl* this, PlayState* play) { Vec3f pos; s32 angle; f32 t = func_80ACD1C4(play, 7); + f32 phi_f2; pos.x = play->csCtx.actorCues[7]->startPos.x; pos.y = play->csCtx.actorCues[7]->startPos.y; @@ -1379,8 +1380,7 @@ void func_80ACD2CC(EnOwl* this, PlayState* play) { angle = (s16)((t * angle) + this->actor.world.rot.z); angle = (u16)angle; if (this->actionFlags & 4) { - f32 phi_f2 = play->csCtx.actorCues[7]->rot.x; - + phi_f2 = play->csCtx.actorCues[7]->rot.x; phi_f2 *= 10.0f * (360.0f / 0x10000); if (phi_f2 < 0.0f) { phi_f2 += 360.0f; diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 973b02717c..5aa146fc51 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -416,6 +416,8 @@ void EnPeehat_Ground_SetStateRise(EnPeehat* this) { } void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play) { + Vec3f pos; + Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -433,7 +435,7 @@ void EnPeehat_Ground_StateRise(EnPeehat* this, PlayState* play) { this->actor.world.pos.y += 6.5f; } if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { - Vec3f pos = this->actor.world.pos; + pos = this->actor.world.pos; pos.y = this->actor.floorHeight; func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } @@ -457,6 +459,8 @@ void EnPeehat_Flying_SetStateRise(EnPeehat* this) { } void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play) { + Vec3f pos; + Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 50.0f, 0.0f); if (Math_SmoothStepToS(&this->bladeRotVel, 4000, 1, 800, 0) == 0) { if (this->animTimer != 0) { @@ -476,7 +480,7 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, PlayState* play) { this->actor.world.pos.y += 18.0f; } if (this->actor.world.pos.y - this->actor.floorHeight < 80.0f) { - Vec3f pos = this->actor.world.pos; + pos = this->actor.world.pos; pos.y = this->actor.floorHeight; func_80033480(play, &pos, 90.0f, 1, 0x96, 100, 1); } @@ -854,12 +858,11 @@ void EnPeehat_SetStateExplode(EnPeehat* this) { } void EnPeehat_StateExplode(EnPeehat* this, PlayState* play) { - EnBom* bomb; s32 pad[2]; if (this->animTimer == 5) { - bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x602, 0); + EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x602, 0); if (bomb != NULL) { bomb->timer = 0; } @@ -919,6 +922,10 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { EnPeehat* this = (EnPeehat*)thisx; s32 i; Player* player = GET_PLAYER(play); + Vec3f posResult; + CollisionPoly* poly; + s32 bgId; + Vec3f* posB; // If Adult Peahat if (thisx->params <= 0) { @@ -978,10 +985,8 @@ void EnPeehat_Update(Actor* thisx, PlayState* play) { // if PEAHAT_TYPE_GROUNDED if (thisx->params < 0 && (thisx->flags & ACTOR_FLAG_6)) { for (i = 1; i >= 0; i--) { - Vec3f posResult; - CollisionPoly* poly = NULL; - s32 bgId; - Vec3f* posB = &this->bladeTip[i]; + poly = NULL; + posB = &this->bladeTip[i]; if (BgCheck_EntityLineTest1(&play->colCtx, &thisx->world.pos, posB, &posResult, &poly, true, true, false, true, &bgId) == true) { diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 9c2de64682..ef39e231ea 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -795,6 +795,9 @@ void EnPoField_DrawFlame(EnPoField* this, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_po_field.c", 1709), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 1712); } } @@ -996,6 +999,9 @@ void EnPoField_DrawSoul(Actor* thisx, PlayState* play) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPoeFieldSoulDL); } + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_po_field.c", 2149); EnPoField_DrawFlame(this, play); } diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index f526e0508d..bca1a872d5 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -290,8 +290,6 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { Vec3f vec; f32 multiplier; s32 pad; - Vec3f sp60; - s32 pad1; this->actionTimer++; if (this->actionTimer < 8) { @@ -323,6 +321,9 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { } if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f) != 0) { if (this->hookshotSlotFull != 0) { + Vec3f sp60; + s32 pad1; + sp60.x = this->actor.world.pos.x; sp60.y = this->actor.floorHeight; sp60.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 21a4869bbe..bb18687afd 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -466,10 +466,12 @@ void EnRd_SetupWalkToParent(EnRd* this) { * fade away. */ void EnRd_WalkToParent(EnRd* this, PlayState* play) { + s32 pad; + s16 targetY; + Vec3f parentPos; + if (this->actor.parent != NULL) { - s32 pad; - s16 targetY; - Vec3f parentPos = this->actor.parent->world.pos; + parentPos = this->actor.parent->world.pos; targetY = Actor_WorldYawTowardPoint(&this->actor, &parentPos); @@ -992,5 +994,7 @@ void EnRd_Draw(Actor* thisx, PlayState* play) { func_80033C30(&thisPos, &sShadowScale, this->alpha, play); } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_rd.c", 1735); } diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index 068bd64b64..d3c74b7908 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -50,6 +50,7 @@ void func_80AE72D0(EnRl* this) { } } +#if OOT_DEBUG void func_80AE7358(EnRl* this) { Animation_Change(&this->skelAnime, &object_rl_Anim_000A3C, 1.0f, 0.0f, Animation_GetLastFrame(&object_rl_Anim_000A3C), ANIMMODE_LOOP, 0.0f); @@ -75,6 +76,7 @@ void func_80AE73D8(EnRl* this, PlayState* play) { D_80AE81AC = 1; } } +#endif void func_80AE744C(EnRl* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); @@ -243,8 +245,9 @@ void func_80AE79A4(EnRl* this, PlayState* play) { void func_80AE7AF8(EnRl* this, PlayState* play) { if (func_80AE74B4(this, play, 3, 0)) { - Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, - Animation_GetLastFrame(&object_rl_Anim_00040C), ANIMMODE_ONCE, -8.0f); + f32 frame = Animation_GetLastFrame(&object_rl_Anim_00040C); + + Animation_Change(&this->skelAnime, &object_rl_Anim_00040C, 1.0f, 0.0f, frame, ANIMMODE_ONCE, -8.0f); this->action = 6; } else if (func_80AE74FC(this, play, 4, 0)) { this->action = 5; @@ -269,7 +272,9 @@ void func_80AE7BF8(EnRl* this, s32 arg1) { void func_80AE7C64(EnRl* this, PlayState* play) { func_80AE7954(this, play); +#if OOT_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7C94(EnRl* this, PlayState* play) { @@ -277,7 +282,9 @@ void func_80AE7C94(EnRl* this, PlayState* play) { func_80AE7494(this); func_80AE72D0(this); func_80AE79A4(this, play); +#if OOT_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7CE8(EnRl* this, PlayState* play) { @@ -287,7 +294,9 @@ void func_80AE7CE8(EnRl* this, PlayState* play) { temp = func_80AE7494(this); func_80AE72D0(this); func_80AE7BF8(this, temp); +#if OOT_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7D40(EnRl* this, PlayState* play) { @@ -295,7 +304,9 @@ void func_80AE7D40(EnRl* this, PlayState* play) { func_80AE7494(this); func_80AE72D0(this); func_80AE7AF8(this, play); +#if OOT_DEBUG func_80AE73D8(this, play); +#endif } void func_80AE7D94(EnRl* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index b2bf3132bd..018420cef0 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -76,10 +76,12 @@ ActorInit En_Rr_InitVars = { /**/ EnRr_Draw, }; +#if OOT_DEBUG static char* sDropNames[] = { // "type 7", "small magic jar", "arrow", "fairy", "20 rupees", "50 rupees" "タイプ7 ", "魔法の壷小", "矢 ", "妖精 ", "20ルピー ", "50ルピー ", }; +#endif static ColliderCylinderInitType1 sCylinderInit1 = { { @@ -337,8 +339,8 @@ void EnRr_SetupDamage(EnRr* this) { s32 i; this->reachState = 0; - this->actionTimer = 20; this->segMoveRate = 0.0f; + this->actionTimer = 20; this->segPhaseVelTarget = 2500.0f; this->pulseSizeTarget = 0.0f; this->wobbleSizeTarget = 0.0f; diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 60ea69ceee..b9df80354a 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -340,6 +340,7 @@ s32 func_80AEB1B4(PlayState* play) { return Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING; } +#if OOT_DEBUG void func_80AEB1D8(EnRu1* this) { this->action = 36; this->drawConfig = 0; @@ -357,6 +358,7 @@ void func_80AEB220(EnRu1* this, PlayState* play) { func_80AEB1D8(this); } } +#endif void func_80AEB264(EnRu1* this, AnimationHeader* animation, u8 arg2, f32 morphFrames, s32 arg4) { s32 pad[2]; @@ -633,10 +635,10 @@ void func_80AEBD94(EnRu1* this, PlayState* play) { void func_80AEBE3C(EnRu1* this, PlayState* play, s32 arg2) { s32 pad[2]; - f32 frameCount; if (arg2 != 0) { - frameCount = Animation_GetLastFrame(&gRutoChildTreadWaterAnim); + f32 frameCount = Animation_GetLastFrame(&gRutoChildTreadWaterAnim); + func_80AEB7D0(this); Animation_Change(&this->skelAnime, &gRutoChildTreadWaterAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); this->action = 3; @@ -660,6 +662,8 @@ void func_80AEBEC8(EnRu1* this, PlayState* play) { void func_80AEBF60(EnRu1* this, PlayState* play) { if (func_80AEB480(play, 6)) { + s32 pad; + func_80AEB7D0(this); this->action = 5; this->unk_364 = this->actor.world.pos; @@ -758,14 +762,14 @@ void func_80AEC2C0(EnRu1* this, PlayState* play) { } void func_80AEC320(EnRu1* this, PlayState* play) { - s8 actorRoom; - if (!GET_INFTABLE(INFTABLE_141)) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 7; EnRu1_SetMouthIndex(this, 1); } else if (GET_INFTABLE(INFTABLE_147) && !GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_145)) { if (!func_80AEB020(this, play)) { + s8 actorRoom; + func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -910,6 +914,8 @@ void func_80AEC9C4(EnRu1* this) { void func_80AECA18(EnRu1* this) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + s32 pad; + this->action = 13; this->unk_26C = 0.0f; this->actor.velocity.y = 0.0f; @@ -1167,11 +1173,11 @@ void func_80AED414(EnRu1* this, PlayState* play) { } void func_80AED44C(EnRu1* this, PlayState* play) { - s8 actorRoom; - if (GET_INFTABLE(INFTABLE_141) && !GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_147)) { if (!func_80AEB020(this, play)) { + s8 actorRoom; + func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); actorRoom = this->actor.room; this->action = 22; @@ -1252,12 +1258,13 @@ void func_80AED6F8(PlayState* play) { } void func_80AED738(EnRu1* this, PlayState* play) { - u32 temp_v0; - if (func_80AED624(this, play)) { + s32 pad; + this->unk_2A4 += 1.0f; if (this->unk_2A4 < 20.0f) { - temp_v0 = ((20.0f - this->unk_2A4) * 255.0f) / 20.0f; + u32 temp_v0 = ((20.0f - this->unk_2A4) * 255.0f) / 20.0f; + this->alpha = temp_v0; this->actor.shape.shadowAlpha = temp_v0; } else { @@ -1320,17 +1327,13 @@ void func_80AEDAE0(EnRu1* this, PlayState* play) { } void func_80AEDB30(EnRu1* this, PlayState* play) { - DynaPolyActor* dynaPolyActor; f32* velocityY; f32* speedXZ; f32* gravity; - s16 wallYaw; - s16 rotY; - s32 temp_a1_2; - s32 temp_a0; - s32 phi_v1; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + DynaPolyActor* dynaPolyActor; + velocityY = &this->actor.velocity.y; dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (*velocityY <= 0.0f) { @@ -1367,6 +1370,8 @@ void func_80AEDB30(EnRu1* this, PlayState* play) { } } if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { + s32 pad; + speedXZ = &this->actor.speed; velocityY = &this->actor.velocity.y; if (*speedXZ >= (kREG(27) * 0.01f) + 3.0f) { @@ -1382,6 +1387,12 @@ void func_80AEDB30(EnRu1* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { speedXZ = &this->actor.speed; if (*speedXZ != 0.0f) { + s16 wallYaw; + s16 rotY; + s32 temp_a1_2; + s32 temp_a0; + s32 phi_v1; + rotY = this->actor.world.rot.y; wallYaw = this->actor.wallYaw; temp_a0 = (wallYaw * 2) - rotY; @@ -1442,7 +1453,6 @@ void func_80AEE050(EnRu1* this) { s32 pad; f32 sp28; f32 sp24; - f32 temp_f10; EnRu1* thisx = this; // necessary to match if (this->unk_350 == 0) { @@ -1475,6 +1485,8 @@ void func_80AEE050(EnRu1* this) { this->unk_350 = 2; this->unk_360 = 0.0f; } else { + f32 temp_f10; + sp28 = this->unk_358; sp24 = this->unk_354; temp_f10 = Math_CosS(this->unk_35C) * -sp28; @@ -1560,6 +1572,8 @@ void func_80AEE488(EnRu1* this, PlayState* play) { this->action = 31; func_80AED520(this, play); } else if (!func_80AEE394(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + s32 pad; + this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); this->actor.gravity = -((kREG(23) * 0.01f) + 1.3f); this->action = 28; @@ -1570,11 +1584,16 @@ void func_80AEE568(EnRu1* this, PlayState* play) { if (!func_80AEE394(this, play)) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed == 0.0f) && (this->actor.minVelocityY == 0.0f)) { + s32 pad; + func_80AEE02C(this); Actor_OfferCarry(&this->actor, play); this->action = 27; func_80AEADD8(this); - } else if (this->actor.yDistToWater > 0.0f) { + return; + } + + if (this->actor.yDistToWater > 0.0f) { this->action = 29; this->unk_350 = 0; } @@ -1616,13 +1635,13 @@ s32 func_80AEE6D0(EnRu1* this, PlayState* play) { } void func_80AEE7C4(EnRu1* this, PlayState* play) { - f32 frameCount; - s32 pad[13]; + s32 pad[9]; Player* player; f32* unk_370 = &this->unk_370; if (Actor_HasNoParent(&this->actor, play)) { - frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + f32 frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); func_80AED6DC(this, play); this->actor.speed *= (kREG(25) * 0.01f) + 1.0f; @@ -1632,45 +1651,49 @@ void func_80AEE7C4(EnRu1* this, PlayState* play) { func_80AED57C(this); this->action = 28; *unk_370 = 0.0f; - return; - } + } else if (func_80AEE6D0(this, play)) { + s32 pad; - if (func_80AEE6D0(this, play)) { *unk_370 = 0.0f; - return; - } + } else { + player = GET_PLAYER(play); + if (player->stateFlags2 & PLAYER_STATE2_28) { + this->unk_370 += 1.0f; + if (this->action != 32) { + if (*unk_370 > 30.0f) { + if (Rand_S16Offset(0, 3) == 0) { + f32 frameCount = Animation_GetLastFrame(&gRutoChildSquirmAnim); - player = GET_PLAYER(play); - if (player->stateFlags2 & PLAYER_STATE2_28) { - this->unk_370 += 1.0f; - if (this->action != 32) { - if (*unk_370 > 30.0f) { - if (Rand_S16Offset(0, 3) == 0) { - frameCount = Animation_GetLastFrame(&gRutoChildSquirmAnim); - Animation_Change(&this->skelAnime, &gRutoChildSquirmAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, - -8.0f); - func_80AED5DC(this); - this->action = 32; + Animation_Change(&this->skelAnime, &gRutoChildSquirmAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, + -8.0f); + func_80AED5DC(this); + this->action = 32; + } + *unk_370 = 0.0f; + } + } else { + if (*unk_370 > 50.0f) { + f32 frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + + Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, + -8.0f); + this->action = 31; + *unk_370 = 0.0f; } - *unk_370 = 0.0f; } } else { - if (*unk_370 > 50.0f) { - frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); - Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); - this->action = 31; - *unk_370 = 0.0f; - } + f32 frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); + + Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); + *unk_370 = 0.0f; } - } else { - frameCount = Animation_GetLastFrame(&gRutoChildSittingAnim); - Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0, frameCount, ANIMMODE_LOOP, -8.0f); - *unk_370 = 0.0f; } } s32 func_80AEEAC8(EnRu1* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + s32 pad; + func_80AEE02C(this); Actor_OfferCarry(&this->actor, play); this->action = 27; @@ -1808,10 +1831,9 @@ void func_80AEF080(EnRu1* this) { } s32 func_80AEF0BC(EnRu1* this, PlayState* play) { - s32 frameCount; - if (GET_INFTABLE(INFTABLE_142)) { - frameCount = Animation_GetLastFrame(&gRutoChildSitAnim); + f32 frameCount = Animation_GetLastFrame(&gRutoChildSitAnim); + Animation_Change(&this->skelAnime, &gRutoChildSitAnim, 1.0f, 0, frameCount, ANIMMODE_ONCE, -8.0f); play->msgCtx.msgMode = MSGMODE_PAUSED; this->action = 26; @@ -2000,7 +2022,7 @@ void func_80AEF890(EnRu1* this, PlayState* play) { s32 pad[2]; s8 curRoomNum; - if (!IS_CUTSCENE_LAYER && (EnRu1_IsCsStateIdle(play))) { + if (!(OOT_DEBUG && IS_CUTSCENE_LAYER) && EnRu1_IsCsStateIdle(play)) { curRoomNum = play->roomCtx.curRoom.num; SET_INFTABLE(INFTABLE_145); Flags_SetSwitch(play, func_80AEADE0(this)); @@ -2033,7 +2055,9 @@ void func_80AEF9D8(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF624(this, play); +#if OOT_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFA2C(EnRu1* this, PlayState* play) { @@ -2047,7 +2071,9 @@ void func_80AEFA2C(EnRu1* this, PlayState* play) { func_80AEF5B8(this); func_80AEF40C(this); func_80AEF728(this, something); +#if OOT_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFAAC(EnRu1* this, PlayState* play) { @@ -2055,7 +2081,9 @@ void func_80AEFAAC(EnRu1* this, PlayState* play) { func_80AEAECC(this, play); EnRu1_UpdateSkelAnime(this); func_80AEF79C(this, play); +#if OOT_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFB04(EnRu1* this, PlayState* play) { @@ -2066,7 +2094,9 @@ void func_80AEFB04(EnRu1* this, PlayState* play) { something = EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF820(this, something); +#if OOT_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFB68(EnRu1* this, PlayState* play) { @@ -2075,7 +2105,9 @@ void func_80AEFB68(EnRu1* this, PlayState* play) { EnRu1_UpdateSkelAnime(this); EnRu1_UpdateEyes(this); func_80AEF890(this, play); +#if OOT_DEBUG func_80AEB220(this, play); +#endif } void func_80AEFBC8(EnRu1* this, PlayState* play) { @@ -2094,6 +2126,8 @@ void func_80AEFC24(EnRu1* this, PlayState* play) { void func_80AEFC54(EnRu1* this, PlayState* play) { if (GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_146)) { + s32 pad; + func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 41; this->unk_28C = EnRu1_FindSwitch(play); @@ -2196,6 +2230,7 @@ void func_80AEFF94(EnRu1* this, PlayState* play) { } } +#if OOT_DEBUG void func_80AF0050(EnRu1* this, PlayState* play) { func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0); this->action = 36; @@ -2203,6 +2238,7 @@ void func_80AF0050(EnRu1* this, PlayState* play) { this->unk_28C = EnRu1_FindSwitch(play); this->actor.room = -1; } +#endif void EnRu1_Update(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; @@ -2245,9 +2281,11 @@ void EnRu1_Init(Actor* thisx, PlayState* play) { case 6: func_80AEFF94(this, play); break; +#if OOT_DEBUG case 10: func_80AF0050(this, play); break; +#endif default: Actor_Kill(&this->actor); // "Relevant arge_data = %d unacceptable" @@ -2287,10 +2325,11 @@ s32 EnRu1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnRu1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnRu1* this = (EnRu1*)thisx; - Vec3f vec1; - Vec3f vec2; if (limbIndex == RUTO_CHILD_HEAD) { + Vec3f vec1; + Vec3f vec2; + vec1 = sMultVec; Matrix_MultVec3f(&vec1, &vec2); this->actor.focus.pos.x = vec2.x; diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 94bb97e3f4..00cb959f12 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -136,6 +136,7 @@ s32 func_80AF26A0(EnRu2* this) { return params & 0xFF; } +#if OOT_DEBUG void func_80AF26AC(EnRu2* this) { this->action = 7; this->drawConfig = 0; @@ -163,6 +164,7 @@ void func_80AF26D0(EnRu2* this, PlayState* play) { } } } +#endif void func_80AF2744(EnRu2* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); @@ -174,8 +176,11 @@ s32 EnRu2_UpdateSkelAnime(EnRu2* this) { CsCmdActorCue* EnRu2_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -446,7 +451,9 @@ void func_80AF30AC(EnRu2* this, PlayState* play) { void func_80AF3144(EnRu2* this, PlayState* play) { func_80AF2F04(this, play); +#if OOT_DEBUG func_80AF26D0(this, play); +#endif } void func_80AF3174(EnRu2* this, PlayState* play) { @@ -454,7 +461,9 @@ void func_80AF3174(EnRu2* this, PlayState* play) { EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF2F58(this, play); +#if OOT_DEBUG func_80AF26D0(this, play); +#endif } void func_80AF31C8(EnRu2* this, PlayState* play) { @@ -462,7 +471,9 @@ void func_80AF31C8(EnRu2* this, PlayState* play) { EnRu2_UpdateSkelAnime(this); func_80AF2608(this); func_80AF30AC(this, play); +#if OOT_DEBUG func_80AF26D0(this, play); +#endif } void func_80AF321C(EnRu2* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 2994a7a7fb..a055e7ea84 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -613,10 +613,12 @@ void func_80AF6448(EnSa* this, PlayState* play) { } void func_80AF67D0(EnSa* this, PlayState* play) { - if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { - Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); - this->actionFunc = func_80AF6448; + if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { + return; } + + Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); + this->actionFunc = func_80AF6448; } void func_80AF683C(EnSa* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 79a4ba9d9f..0d28bea18f 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -118,8 +118,6 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { f32 dZ; s16 angle; s16 dAngle; - f32 dist2d; - f32 speedScale; dX = player->actor.world.pos.x - this->dyna.actor.world.pos.x; dY = player->actor.world.pos.y - this->dyna.actor.world.pos.y; @@ -139,7 +137,8 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { this->appliedSpeed = 0.0f; this->targetAppliedSpeed = 0.0f; } else { - dist2d = sqrtf(SQ(dX) + SQ(dZ)); + f32 dist2d = sqrtf(SQ(dX) + SQ(dZ)); + this->applySpeed = true; this->splashTimer = 0; angle = RAD_TO_BINANG(Math_FAtan2F(dX, dZ)); @@ -149,6 +148,8 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { Math_SmoothStepToF(&player->actor.world.pos.y, this->dyna.actor.world.pos.y, 0.5f, 4.0f, 1.0f); if ((dAngle < 0x4000) && (dAngle > -0x4000)) { + f32 speedScale; + this->appliedYaw = player->actor.world.rot.y ^ 0x8000; speedScale = dist2d / (this->dyna.actor.scale.x * 40.0f * 10.0f); speedScale = CLAMP_MIN(speedScale, 0.0f); @@ -292,6 +293,9 @@ void EnSiofuki_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, x, y, 64, 64, 1, x, y, 64, 64)); gSPDisplayList(POLY_XLU_DISP++, object_siofuki_DL_000B70); + + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_siofuki.c", 674); if (this->sfxFlags & 1) { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 3fd564e7ab..b2e08703d9 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -531,10 +531,10 @@ void EnSkb_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 EnSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnSkb_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSkb* this = (EnSkb*)thisx; + PlayState* play = (PlayState*)play2; s16 color; - s16 pad[2]; if (limbIndex == 11) { if ((this->breakFlags & 2) == 0) { // head limb, head is still attached diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 0e4e5e4ee2..758a2649a1 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1513,7 +1513,8 @@ void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play) { player->stateFlags3 |= PLAYER_STATE3_5; // makes player take ocarina out right away after closing box this->actionFunc = EnSkj_SetupWaitForOcarina; - } break; + break; + } case 1: // no this->actionFunc = EnSkj_CleanupOcarinaGame; break; diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 4aa759f569..90c72cf991 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -40,7 +40,9 @@ void EnSyatekiMan_RestartGame(EnSyatekiMan* this, PlayState* play); void EnSyatekiMan_BlinkWait(EnSyatekiMan* this); void EnSyatekiMan_Blink(EnSyatekiMan* this); +#if OOT_DEBUG void EnSyatekiMan_SetBgm(void); +#endif ActorInit En_Syateki_Man_InitVars = { /**/ ACTOR_EN_SYATEKI_MAN, @@ -54,6 +56,7 @@ ActorInit En_Syateki_Man_InitVars = { /**/ EnSyatekiMan_Draw, }; +#if OOT_DEBUG static u16 sBgmList[] = { NA_BGM_GENERAL_SFX, NA_BGM_NATURE_AMBIENCE, @@ -144,6 +147,7 @@ static u16 sBgmList[] = { NA_BGM_GANON_BOSS, NA_BGM_END_DEMO, }; +#endif static s16 sTextIds[] = { 0x2B, 0x2E, 0xC8, 0x2D }; @@ -468,7 +472,11 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { this->timer--; } this->actionFunc(this, play); + +#if OOT_DEBUG EnSyatekiMan_SetBgm(); +#endif + this->blinkFunc(this); this->actor.focus.pos.y = 70.0f; Actor_SetFocus(&this->actor, 70.0f); @@ -503,9 +511,11 @@ void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { EnSyatekiMan_OverrideLimbDraw, NULL, this); } +#if OOT_DEBUG void EnSyatekiMan_SetBgm(void) { if (BREG(80)) { BREG(80) = false; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, sBgmList[BREG(81)]); } } +#endif diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index 5d306488a6..d5918f9363 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -760,9 +760,11 @@ void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, PlayState* play) { void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; - EnSyatekiNiwEffect* effect = &this->effects[0]; + EnSyatekiNiwEffect* effect; u8 materialFlag = 0; + effect = &this->effects[0]; + OPEN_DISPS(gfxCtx, "../z_en_syateki_niw.c", 1234); Gfx_SetupDL_25Xlu(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Tana/z_en_tana.c b/src/overlays/actors/ovl_En_Tana/z_en_tana.c index aa7aeb97f0..a3cf4949c6 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -27,6 +27,7 @@ ActorInit En_Tana_InitVars = { /**/ NULL, }; +#if OOT_DEBUG //! @bug A third entry is missing here. When printing the string indexed by `params` for type 2, the //! next data entry will be dereferenced and print garbage, stopping any future printing. //! In a non-matching context, this can cause a crash if the next item isn't a valid pointer. @@ -37,6 +38,7 @@ static const char* sShelfTypes[] = { "", #endif }; +#endif static const ActorFunc sDrawFuncs[] = { EnTana_DrawWoodenShelves, diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index e050fc3321..af9653e9d6 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -568,12 +568,11 @@ void EnTest_SetupWalkAndBlock(EnTest* this) { void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { s32 pad; f32 checkDist = 0.0f; - s32 pad1; + s32 absPlaySpeed; s32 prevFrame; s32 beforeCurFrame; f32 playSpeed; Player* player = GET_PLAYER(play); - s32 absPlaySpeed; s16 yawDiff; if (!EnTest_ReactToProjectile(play, this)) { @@ -601,6 +600,8 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { } if (ABS(this->actor.speed) < 3.0f) { + s32 pad; + Animation_Change(&this->skelAnime, &gStalfosSlowAdvanceAnim, 0.0f, this->skelAnime.curFrame, Animation_GetLastFrame(&gStalfosSlowAdvanceAnim), 0, -6.0f); playSpeed = this->actor.speed * 10.0f; @@ -1819,9 +1820,9 @@ void EnTest_Update(Actor* thisx, PlayState* play) { } } -s32 EnTest_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnTest_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnTest* this = (EnTest*)thisx; - s32 pad; + PlayState* play = (PlayState*)play2; if (limbIndex == STALFOS_LIMB_HEAD_ROOT) { rot->x += this->headRot.y; diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index cdd8d34020..e543158d06 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -265,7 +265,6 @@ void EnTite_SetupAttack(EnTite* this) { void EnTite_Attack(EnTite* this, PlayState* play) { s16 angleToPlayer; s32 attackState; - Vec3f ripplePos; if (SkelAnime_Update(&this->skelAnime)) { attackState = this->vAttackState; // for deciding whether to change animation @@ -303,7 +302,8 @@ void EnTite_Attack(EnTite* this, PlayState* play) { } else { this->actor.gravity = 0.0f; if (this->actor.velocity.y < -8.0f) { - ripplePos = this->actor.world.pos; + Vec3f ripplePos = this->actor.world.pos; + ripplePos.y += this->actor.yDistToWater; this->vAttackState++; // TEKTITE_SUBMERGED this->actor.velocity.y *= 0.75f; diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 24eef2901e..32df4ef157 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -202,15 +202,10 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { Input* input = &sInput; Camera* mainCam; s16 sp66; - u8 staggerThreshold; s8 stickY; - s32 pad60; + u32 pad54; Actor* attackItem; s16 sp5A; - s16 pad58; - u32 pad54; - f32 sp50; - s16 sp4E; sp5A = player->actor.shape.rot.y - this->actor.shape.rot.y; input->cur.button = 0; @@ -410,44 +405,47 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { // Handles movement and attacks when not reacting to Link's actions sStickAngle = thisx->yawTowardsPlayer; - sp50 = 0.0f; if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && (ABS(sp5A) >= 0x7800) && (this->actor.isTargeted || !(player->stateFlags1 & PLAYER_STATE1_22))) { EnTorch2_SwingSword(play, input, this); - } else if (((this->actor.xzDistToPlayer <= 70.0f) || - ((this->actor.xzDistToPlayer <= 80.0f + sp50) && - (player->meleeWeaponState != 0))) && - (this->meleeWeaponState == 0)) { - if (!EnTorch2_SwingSword(play, input, this) && (this->meleeWeaponState == 0) && - (sCounterState == 0)) { - EnTorch2_Backflip(this, input, &this->actor); - } - } else if (this->actor.xzDistToPlayer <= 50 + sp50) { - sStickTilt = 127.0f; - sStickAngle = this->actor.yawTowardsPlayer; - if (!this->actor.isTargeted) { - Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); - } - } else if (this->actor.xzDistToPlayer > 100.0f + sp50) { - if ((player->meleeWeaponState == 0) || - !((player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && - (player->meleeWeaponAnimation <= PLAYER_MWA_BIG_SPIN_2H)) || - (this->actor.xzDistToPlayer >= 280.0f)) { + } else { + f32 sp50 = 0.0f; + + if (((this->actor.xzDistToPlayer <= 70.0f) || + ((this->actor.xzDistToPlayer <= 80.0f + sp50) && (player->meleeWeaponState != 0))) && + (this->meleeWeaponState == 0)) { + if (!EnTorch2_SwingSword(play, input, this) && (this->meleeWeaponState == 0) && + (sCounterState == 0)) { + EnTorch2_Backflip(this, input, &this->actor); + } + } else if (this->actor.xzDistToPlayer <= 50 + sp50) { sStickTilt = 127.0f; sStickAngle = this->actor.yawTowardsPlayer; if (!this->actor.isTargeted) { Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); } - } else { - EnTorch2_Backflip(this, input, &this->actor); - } - } else if (((ABS(sp5A) < 0x7800) && (ABS(sp5A) >= 0x3000)) || - !EnTorch2_SwingSword(play, input, this)) { - sStickAngle = this->actor.yawTowardsPlayer; - sStickTilt = 127.0f; - if (!this->actor.isTargeted) { - Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); + } else if (this->actor.xzDistToPlayer > 100.0f + sp50) { + if ((player->meleeWeaponState == 0) || + !((player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) && + (player->meleeWeaponAnimation <= PLAYER_MWA_BIG_SPIN_2H)) || + (this->actor.xzDistToPlayer >= 280.0f)) { + sStickTilt = 127.0f; + sStickAngle = this->actor.yawTowardsPlayer; + if (!this->actor.isTargeted) { + Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, + 0); + } + } else { + EnTorch2_Backflip(this, input, &this->actor); + } + } else if (((ABS(sp5A) < 0x7800) && (ABS(sp5A) >= 0x3000)) || + !EnTorch2_SwingSword(play, input, this)) { + sStickAngle = this->actor.yawTowardsPlayer; + sStickTilt = 127.0f; + if (!this->actor.isTargeted) { + Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0); + } } } } @@ -495,8 +493,9 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { this->actor.world.pos.x = (Math_SinS(player->actor.shape.rot.y) * -120.0f) + player->actor.world.pos.x; this->actor.world.pos.z = (Math_CosS(player->actor.shape.rot.y) * -120.0f) + player->actor.world.pos.z; if (Actor_WorldDistXYZToPoint(&this->actor, &sSpawnPoint) > 800.0f) { - sp50 = Rand_ZeroOne() * 20.0f; - sp4E = Rand_CenteredFloat(4000.0f); + f32 sp50 = Rand_ZeroOne() * 20.0f; + s16 sp4E = Rand_CenteredFloat(4000.0f); + this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&sSpawnPoint, &player->actor.world.pos); this->actor.world.pos.x = @@ -640,7 +639,8 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { * if he's had to counter with enough different sword animations in a row. */ if (this->speedXZ == -18.0f) { - staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 6; + u8 staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 6; + if (gSaveContext.save.info.playerData.health < 0x50) { staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 3; } diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index e1f05e02ce..fa9a5fca8e 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -241,6 +241,8 @@ void func_80B23254(EnTr* this, PlayState* play, s32 arg2, f32 arg3, f32 scale) { } void EnTr_ShrinkVanish(EnTr* this, PlayState* play) { + s32 temp_hi; + if (this->timer >= 17) { this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; } else { @@ -248,7 +250,7 @@ void EnTr_ShrinkVanish(EnTr* this, PlayState* play) { Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; } else if (this->timer > 0) { - s32 temp_hi = (this->timer * 2) % 7; + temp_hi = (this->timer * 2) % 7; func_80B23254(this, play, temp_hi, 5.0f, 0.2f); func_80B23254(this, play, (temp_hi + 1) % 7, 5.0f, 0.2f); diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 8bdcea0032..c675e84d33 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -135,7 +135,6 @@ void EnTrap_Update(Actor* thisx, PlayState* play) { Vec3f colPoint; // unused return value from function CollisionPoly* colPoly; // unused return value from function s32 bgId; // unused return value from function - f32 temp_cond; touchingActor = false; blockedOnReturn = false; @@ -209,7 +208,8 @@ void EnTrap_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(thisx, NA_SE_EV_SPINE_TRAP_MOVE); } } else if (thisx->params & SPIKETRAP_MODE_CIRCULAR) { - temp_cond = Math_SinS(this->vAngularPos); + f32 temp_cond = Math_SinS(this->vAngularPos); + this->vAngularPos += this->vAngularVel; // Every full circle make a sound: if ((temp_cond < 0.0f) && (Math_SinS(this->vAngularPos) >= 0.0f)) { diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c index 2af941834e..30ab7d6afb 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -572,10 +572,10 @@ void EnVali_Update(Actor* thisx, PlayState* play) { void EnVali_PulseOutside(EnVali* this, f32 curFrame, Vec3f* scale) { f32 scaleChange; + s32 scalePhase; if (this->actionFunc == EnVali_Attacked) { - s32 scalePhase = 20 - (this->lightningTimer % 20); - + scalePhase = 20 - (this->lightningTimer % 20); if (scalePhase >= 10) { scalePhase -= 10; } @@ -607,10 +607,10 @@ void EnVali_PulseOutside(EnVali* this, f32 curFrame, Vec3f* scale) { void EnVali_PulseInsides(EnVali* this, f32 curFrame, Vec3f* scale) { f32 scaleChange; + s32 scalePhase; if (this->actionFunc == EnVali_Attacked) { - s32 scalePhase = 20 - (this->lightningTimer % 20); - + scalePhase = 20 - (this->lightningTimer % 20); if (scalePhase >= 10) { scalePhase -= 10; } diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index d10ebe4539..e9cdcddabf 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -368,15 +368,13 @@ void EnVm_SetupDie(EnVm* this) { } void EnVm_Die(EnVm* this, PlayState* play) { - EnBom* bomb; - this->beamRot.x += 0x5DC; this->headRotY += 0x9C4; Actor_MoveXZGravity(&this->actor); if (--this->timer == 0) { - bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); + EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 11e0c9b11a..6793ae1cef 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -609,6 +609,8 @@ void EnWallmas_DrawXlu(EnWallmas* this, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_wallmas.c", 1421), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_wallmas.c", 1426); } diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index d5e321ff50..9ff20a2e51 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -199,9 +199,9 @@ void func_80B32724(EnWeiyer* this) { } void func_80B327B0(EnWeiyer* this) { - this->actor.colorFilterParams |= 0x2000; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; + this->actor.colorFilterParams |= 0x2000; this->actionFunc = func_80B33338; } diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 27d1641141..9863713a19 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -285,7 +285,6 @@ s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { s32 pad; s16 wallYawDiff; s16 playerYawDiff; - Actor* explosive; wallYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; wallYawDiff = ABS(wallYawDiff); @@ -321,26 +320,27 @@ s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { EnWf_SetupBackflipAway(this); return true; } - } + } else { + Actor* explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); - explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + if (explosive != NULL) { + this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (explosive != NULL) { - this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || - (explosive->id == ACTOR_EN_BOM_CHU)) { - if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && - (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { - EnWf_SetupSomersaultAndAttack(this); - return true; + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || + (explosive->id == ACTOR_EN_BOM_CHU)) { + if ((explosive->id == ACTOR_EN_BOM_CHU) && + (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && + (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { + EnWf_SetupSomersaultAndAttack(this); + return true; + } else { + EnWf_SetupSidestep(this, play); + return true; + } } else { - EnWf_SetupSidestep(this, play); + EnWf_SetupBackflipAway(this); return true; } - } else { - EnWf_SetupBackflipAway(this); - return true; } } diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index d6fb2b59b9..3df3e36bfb 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -226,8 +226,9 @@ void func_80B3C7D4(EnXc* this, s32 action1, s32 action2, s32 action3) { } } +#if OOT_DEBUG s32 EnXc_NoCutscenePlaying(PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } return false; @@ -244,6 +245,7 @@ void func_80B3C888(EnXc* this, PlayState* play) { func_80B3C820(this); } } +#endif void func_80B3C8CC(EnXc* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; @@ -280,6 +282,8 @@ void func_80B3C9EC(EnXc* this) { void func_80B3CA38(EnXc* this, PlayState* play) { // If Player is adult but hasn't learned Minuet of Forest if (!GET_EVENTCHKINF(EVENTCHKINF_50) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_INIT; } else { Actor_Kill(&this->actor); @@ -287,12 +291,17 @@ void func_80B3CA38(EnXc* this, PlayState* play) { } s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { - if (this->actor.params == SHEIK_TYPE_MINUET) { - Player* player = GET_PLAYER(play); - f32 z = player->actor.world.pos.z; + Player* player; + f32 playerPosZ; - if (z < -2225.0f) { + if (this->actor.params == SHEIK_TYPE_MINUET) { + player = GET_PLAYER(play); + playerPosZ = player->actor.world.pos.z; + + if (playerPosZ < -2225.0f) { if (!Play_InCsMode(play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gMinuetCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_50); @@ -308,6 +317,8 @@ s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { void func_80B3CB58(EnXc* this, PlayState* play) { // If hasn't learned Bolero and Player is Adult if (!GET_EVENTCHKINF(EVENTCHKINF_51) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_INIT; } else { Actor_Kill(&this->actor); @@ -324,6 +335,8 @@ s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { if ((posRot->pos.x > -784.0f) && (posRot->pos.x < -584.0f) && (posRot->pos.y > 447.0f) && (posRot->pos.y < 647.0f) && (posRot->pos.z > -446.0f) && (posRot->pos.z < -246.0f) && !Play_InCsMode(play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gDeathMountainCraterBoleroCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_51); @@ -336,9 +349,10 @@ s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { } void EnXc_SetupSerenadeAction(EnXc* this, PlayState* play) { - // Player is adult and does not have iron boots and has not learned Serenade - if (!CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && + if (!(CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && OOT_DEBUG) && !GET_EVENTCHKINF(EVENTCHKINF_52) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_SERENADE; PRINTF("水のセレナーデ シーク誕生!!!!!!!!!!!!!!!!!!\n"); } else { @@ -354,15 +368,18 @@ s32 EnXc_SerenadeCS(EnXc* this, PlayState* play) { if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && !(stateFlags & PLAYER_STATE1_29) && !Play_InCsMode(play)) { + s32 pad; + Cutscene_SetScript(play, gIceCavernSerenadeCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_52); // Learned Serenade of Water Flag Item_Give(play, ITEM_SONG_SERENADE); PRINTF("ブーツを取った!!!!!!!!!!!!!!!!!!\n"); return true; + } else { + PRINTF("はやくブーツを取るべし!!!!!!!!!!!!!!!!!!\n"); + return false; } - PRINTF("はやくブーツを取るべし!!!!!!!!!!!!!!!!!!\n"); - return false; } return true; } @@ -471,9 +488,10 @@ void EnXc_SetColossusWindSFX(PlayState* play) { if (D_80B41D90 != 0) { f32 speed = Math3D_Vec3f_DistXYZ(&D_80B42DB0, eye) / 7.058922f; +#if OOT_DEBUG sMaxSpeed = CLAMP_MIN(sMaxSpeed, speed); - PRINTF("MAX speed = %f\n", sMaxSpeed); +#endif speed = CLAMP_MAX(speed, 2.0f); func_800F436C(&sPos, NA_SE_EV_FLYING_AIR - SFX_FLAG, 0.6f + (0.4f * speed)); @@ -784,6 +802,8 @@ void EnXc_SetupHarpPutawayAction(EnXc* this, PlayState* play) { curFrame = this->skelAnime.curFrame; animFrameCount = this->skelAnime.endFrame; if (curFrame >= animFrameCount) { + s32 pad; + Animation_Change(&this->skelAnime, &gSheikInitialHarpAnim, -1.0f, Animation_GetLastFrame(&gSheikInitialHarpAnim), 0.0f, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_PUT_HARP_AWAY; @@ -873,6 +893,8 @@ void EnXc_SetupDisappear(EnXc* this, PlayState* play) { // Sheik fades away if end of Bolero CS, kill actor otherwise if (sceneId == SCENE_DEATH_MOUNTAIN_CRATER) { + s32 pad; + this->action = SHEIK_ACTION_FADE; this->drawMode = SHEIK_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -1666,7 +1688,9 @@ void EnXc_ActionFunc54(EnXc* this, PlayState* play) { EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupShowTriforceAction(this, play); +#if OOT_DEBUG func_80B3C888(this, play); +#endif } void EnXc_ShowTriforce(EnXc* this, PlayState* play) { @@ -1677,7 +1701,9 @@ void EnXc_ShowTriforce(EnXc* this, PlayState* play) { EnXc_CalcTriforce(&this->actor, play); func_80B3FAE0(this); EnXc_SetupShowTriforceIdleAction(this, animFinished); +#if OOT_DEBUG func_80B3C888(this, play); +#endif } void EnXc_ShowTriforceIdle(EnXc* this, PlayState* play) { @@ -1814,11 +1840,13 @@ void EnXc_SetupDefenseStance(Actor* thisx) { } void EnXc_SetupContortions(EnXc* this, PlayState* play) { - s32 pad; + s32 pad[2]; SkelAnime* skelAnime = &this->skelAnime; - f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); - Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); +#if OOT_DEBUG + Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikIdleAnim), ANIMMODE_LOOP, + 0.0f); +#endif func_80B3C588(this, play, 4); func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikContortionsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikContortionsAnim), @@ -2171,6 +2199,8 @@ void EnXc_InitTempleOfTime(EnXc* this, PlayState* play) { void EnXc_SetupDialogueAction(EnXc* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = SHEIK_ACTION_IN_DIALOGUE; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -2339,9 +2369,11 @@ void EnXc_Init(Actor* thisx, PlayState* play) { case SHEIK_TYPE_9: EnXc_InitTempleOfTime(this, play); break; +#if OOT_DEBUG case SHEIK_TYPE_0: EnXc_DoNothing(this, play); break; +#endif default: PRINTF(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); EnXc_DoNothing(this, play); @@ -2353,6 +2385,8 @@ s32 EnXc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (this->unk_30C != 0) { if (limbIndex == 9) { + s32 pad; + rot->x += this->interactInfo.torsoRot.y; rot->y -= this->interactInfo.torsoRot.x; } else if (limbIndex == 16) { diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 9d1c93926f..ddf9af8e79 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -412,9 +412,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_INNER_MAX; // Will never retreat to the last two s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN; f32 largeMaxRange = 99999.0f; - s16 altNextPlatform = -1; - s16 nextPlatform = -1; - s16 playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform); + s16 nextPlatform; + s16 altNextPlatform; + s16 playerPlatform; + + altNextPlatform = nextPlatform = -1; + playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform); // Set up search constraints // Upstairs @@ -436,9 +439,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P if ((curLoopPlatform == initialPlatform) || (curLoopPlatform == playerPlatform)) { continue; } - if ((playerPlatform == -1) && - (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist)) { - continue; + if (playerPlatform == -1) { + s16 pad; + + if (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist) { + continue; + } } distToCurLoopPlatform = Math_Vec3f_DistXYZ(pos, &sPlatformPositions[curLoopPlatform]); @@ -490,6 +496,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl f32 largeMaxRange = 99999.0f; s16 phi_s2 = curPlatform; s16 phi_s3 = arg2; + f32 curPlatformDistToPlayer; // Upstairs if (pos->y > 200.0f) { @@ -503,7 +510,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl continue; } if (curLoopPlatform != nextPlatform) { - f32 curPlatformDistToPlayer = + curPlatformDistToPlayer = Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]); if (curPlatformDistToPlayer < smallMaxRange) { @@ -1783,27 +1790,31 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { if (this->unk_3F8) { this->actor.speed = -this->actor.speed; } - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - if (this->actor.speed >= 0.0f) { - phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; + } else { + s16 pad; + + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (this->actor.speed >= 0.0f) { + phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; + } else { + phi_v0_4 = this->actor.shape.rot.y - 0x3FFF; + } + + phi_v0_4 = this->actor.wallYaw - phi_v0_4; } else { - phi_v0_4 = this->actor.shape.rot.y - 0x3FFF; + this->actor.speed *= -0.8f; + phi_v0_4 = 0; } - phi_v0_4 = this->actor.wallYaw - phi_v0_4; - } else { - this->actor.speed *= -0.8f; - phi_v0_4 = 0; - } - - if (ABS(phi_v0_4) > 0x4000) { - this->actor.speed *= -0.8f; - if (this->actor.speed < 0.0f) { - this->actor.speed -= 0.5f; - } else { - this->actor.speed += 0.5f; + if (ABS(phi_v0_4) > 0x4000) { + this->actor.speed *= -0.8f; + if (this->actor.speed < 0.0f) { + this->actor.speed -= 0.5f; + } else { + this->actor.speed += 0.5f; + } } } } @@ -1873,6 +1884,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { } else if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) && (D_80B4A1B4 == this->actor.params)) { EnZf_SetupHopAndTaunt(this); } else { + s16 pad; + this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && @@ -1889,10 +1902,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { this->unk_3F0--; } if (prevFrame != (s32)this->skelAnime.curFrame) { - s32 afterPrevFrame = absPlaySpeed + prevFrame; - - if (((beforeCurFrame < 14) && (afterPrevFrame >= 16)) || - ((beforeCurFrame < 27) && (afterPrevFrame >= 29))) { + if (((beforeCurFrame < 14) && (absPlaySpeed + prevFrame >= 16)) || + ((beforeCurFrame < 27) && (absPlaySpeed + prevFrame >= 29))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index f0a2d69a21..d518e4da43 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -212,8 +212,11 @@ s32 EnZl2_UpdateSkelAnime(EnZl2* this) { CsCmdActorCue* EnZl2_GetCue(PlayState* play, s32 cueChannel) { if (play->csCtx.state != CS_STATE_IDLE) { - return play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + + return cue; } + return NULL; } @@ -334,7 +337,11 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) { } if (arg2 == 2) { + s32 pad; + if ((this->action == 5) || (this->action == 30)) { + s32 temp_t0; + curFrame = this->skelAnime.curFrame; unk_278 = this->unk_278; temp_t0 = (s32)((3500.0f * curFrame) / unk_278) + phi_a0; @@ -343,13 +350,15 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) { phi_v0 /= -2; } } else if ((this->action == 6) || (this->action == 31)) { - temp_t0 = phi_a0 + 0xDAC; + s32 temp_t0 = phi_a0 + 0xDAC; + if (temp_t0 >= temp_v1) { temp_v1 = temp_t0; phi_v0 /= -2; } } else if (this->action == 20) { - temp_t0 = phi_a0 - 0x3E8; + s32 temp_t0 = phi_a0 - 0x3E8; + if (temp_t0 >= temp_v1) { temp_v1 = temp_t0; phi_v0 /= -2; @@ -1563,9 +1572,11 @@ void func_80B52114(EnZl2* this, PlayState* play) { case 4: func_80B51D0C(this, play); break; +#if OOT_DEBUG case 0: func_80B4FD90(this, play); break; +#endif default: PRINTF(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); func_80B4FD90(this, play); @@ -1578,10 +1589,12 @@ void func_80B521A0(EnZl2* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME1); s32 pad2; +#if OOT_DEBUG if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl2_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; } +#endif if (Object_IsLoaded(objectCtx, objectSlot)) { this->zl2Anime1ObjectSlot = objectSlot; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 24e97ebd1d..dc1f5ea812 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -271,7 +271,6 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { s32 temp_a0; s32 phi_v0; s32 phi_v1; - s32 phi_v1_2; if (idx == 2) { phi_a1 = 15000; @@ -315,18 +314,26 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (idx == 2 && (action == 5 || action == 24)) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else if (idx == 2 && action == 22 && skelAnime->mode == 2) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else if (idx == 2 && (action == 20 || action == 21) && skelAnime->mode == 2) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else { if (phi_v1 != 0) { + s32 pad; + phi_v0 += (phi_v1 - phi_v0) / 16; } } @@ -352,8 +359,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E0 = this->unk_3E0; + s32 phi_v1_2 = (s32)(((unk_3E0 - curFrame) / unk_3E0) * -2000.0f) + phi_a1; - phi_v1_2 = (s32)(((unk_3E0 - curFrame) / unk_3E0) * -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -365,8 +372,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E4 = this->unk_3E4; + s32 phi_v1_2 = (s32)((curFrame / unk_3E4) * -2000.0f) + phi_a1; - phi_v1_2 = (s32)((curFrame / unk_3E4) * -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -374,7 +381,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 2000; + s32 phi_v1_2 = phi_a1 - 2000; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -386,6 +394,7 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3F4 = this->unk_3F4; + s32 phi_v1_2; if (curFrame <= 42.0f) { phi_v1_2 = phi_a1 - 2000; @@ -400,7 +409,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 + 4200; + s32 phi_v1_2 = phi_a1 + 4200; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -412,8 +422,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3EC = this->unk_3EC; + s32 phi_v1_2 = (s32)(((curFrame / unk_3EC) * -5200.0f) + 4200.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3EC) * -5200.0f) + 4200.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -421,7 +431,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 2000; + s32 phi_v1_2 = phi_a1 - 2000; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -433,8 +444,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3F0 = this->unk_3F0; + s32 phi_v1_2 = (s32)(((curFrame / unk_3F0) * -7600.0f) + -2000.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3F0) * -7600.0f) + -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -442,7 +453,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 9600; + s32 phi_v1_2 = phi_a1 - 9600; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -454,8 +466,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E8 = this->unk_3E8; + s32 phi_v1_2 = (s32)(((curFrame / unk_3E8) * 21000.0f) + -9600.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3E8) * 21000.0f) + -9600.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -463,7 +475,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 + 11400; + s32 phi_v1_2 = phi_a1 + 11400; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -477,8 +490,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E0 = this->unk_3E0; + s32 phi_v1_2 = (s32)((curFrame / unk_3E0) * -7000.0f) + phi_a1; - phi_v1_2 = (s32)((curFrame / unk_3E0) * -7000.0f) + phi_a1; if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -486,7 +499,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 7000; + s32 phi_v1_2 = phi_a1 - 7000; + if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -498,8 +512,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E4 = this->unk_3E4; + s32 phi_v1_2 = (s32)(((unk_3E4 - curFrame) / unk_3E4) * -7000.0f) + phi_a1; - phi_v1_2 = (s32)(((unk_3E4 - curFrame) / unk_3E4) * -7000.0f) + phi_a1; if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -582,17 +596,18 @@ void func_80B54360(EnZl3* this, s16 arg1, s32 arg2) { } s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - s32 pad[3]; + s32 pad[2]; EnZl3* this = (EnZl3*)thisx; - s16* unk_28C = this->unk_28C; - Mtx* sp78; - MtxF sp38; - Vec3s sp30; Vec3s* headRot = &this->interactInfo.headRot; Vec3s* torsoRot = &this->interactInfo.torsoRot; if (limbIndex == 14) { - sp78 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + Mtx* sp78 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + MtxF sp38; + Vec3s sp30; + s16* unk_28C = this->unk_28C; + s32 pad2; + rot->x += headRot->y; rot->z += headRot->x; gSPSegment((*gfx)++, 0x0C, sp78); @@ -687,16 +702,16 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s void EnZl3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl3* this = (EnZl3*)thisx; s32 pad; - Vec3f sp34; - s32 pad2; - Vec3f sp24; - Vec3f sp18; if (limbIndex == 13) { - sp34 = D_80B5A46C; + Vec3f sp34 = D_80B5A46C; + s32 pad2; + Matrix_MultVec3f(&sp34, &this->unk_31C); } else if (limbIndex == 14) { - sp24 = D_80B5A478; + Vec3f sp24 = D_80B5A478; + Vec3f sp18; + Matrix_MultVec3f(&sp24, &sp18); this->actor.focus.pos.x = sp18.x; this->actor.focus.pos.y = sp18.y; @@ -796,6 +811,8 @@ void func_80B55054(EnZl3* this) { f32* temp_v0 = &this->unk_2EC; if (*temp_v0 < 19.0f) { + s32 pad; + ((DoorWarp1*)child)->crystalAlpha = (20.0f - *temp_v0) * 12.75f; *temp_v0 += 1.0f; } else { @@ -1777,8 +1794,12 @@ void func_80B5764C(EnZl3* this, PlayState* play) { } s32 func_80B576C8(EnZl3* this, PlayState* play) { - if (func_80B575F0(this, play) && (this->unk_3D8 == 0)) { - return 1; + if (func_80B575F0(this, play)) { + s32 pad; + + if (this->unk_3D8 == 0) { + return 1; + } } return 0; } @@ -1986,6 +2007,8 @@ s32 func_80B57D80(EnZl3* this, PlayState* play) { void func_80B57EAC(EnZl3* this, PlayState* play) { if (func_80B57324(this, play)) { + s32 pad; + this->action = 26; } else { func_80B57350(this, play); @@ -2028,6 +2051,8 @@ void func_80B58014(EnZl3* this, PlayState* play) { this->action = 29; func_80B538B0(this); } else if (func_80B57C8C(this) && func_80B57F84(this, play)) { + s32 pad; + OnePointCutscene_Init(play, 4000, -99, &this->actor, CAM_ID_MAIN); this->unk_3D0 = 0; } else if (func_80B576C8(this, play) && func_80B575B0(this, play) && !Play_InCsMode(play)) { @@ -2129,7 +2154,7 @@ void func_80B584B4(EnZl3* this, PlayState* play) { } void func_80B58624(EnZl3* this, PlayState* play) { - s32 pad[4]; + s32 pad[3]; f32* unk_3CC = &this->unk_3CC; if (*unk_3CC == (kREG(18) + 10.0f)) { @@ -2137,6 +2162,8 @@ void func_80B58624(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_008050, 0, -12.0f, 0); func_80B5772C(this, play); } else if (*unk_3CC == kREG(19) + 20.0f) { + s32 pad2; + *unk_3CC += 1.0f; this->actor.textId = 0x71AC; Message_StartTextbox(play, this->actor.textId, NULL); @@ -2508,9 +2535,9 @@ s32 func_80B59768(EnZl3* this, PlayState* play) { } void func_80B59828(EnZl3* this, PlayState* play) { - if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { - s16 newRotY; + s16 newRotY; + if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, 0.0f, 0); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; func_80B56F10(this, play); @@ -2616,10 +2643,12 @@ void func_80B59DB8(EnZl3* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME2); s32 pad2; +#if OOT_DEBUG if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl3_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; } +#endif if (Object_IsLoaded(objectCtx, objectSlot)) { this->zl2Anime2ObjectSlot = objectSlot; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 5484f67442..4c87d44e01 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2061,10 +2061,10 @@ LinkAnimationHeader* func_80833338(Player* this) { } s32 func_80833350(Player* this) { - LinkAnimationHeader** entry; - s32 i; - if (func_80833338(this) != this->skelAnime.animation) { + LinkAnimationHeader** entry; + s32 i; + for (i = 0, entry = &D_80853D7C[0][0]; i < 28; i++, entry++) { if (this->skelAnime.animation == *entry) { return i + 1; @@ -4480,9 +4480,6 @@ s32 Player_ActionChange_12(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp34; f32 temp; - f32 wallPolyNormalX; - f32 wallPolyNormalZ; - f32 sp24; if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->ledgeClimbType >= PLAYER_LEDGE_CLIMB_2) && (!(this->stateFlags1 & PLAYER_STATE1_27) || (this->ageProperties->unk_14 > this->yDistToLedge))) { @@ -4524,9 +4521,9 @@ s32 Player_ActionChange_12(Player* this, PlayState* play) { anim = &gPlayerAnim_link_normal_250jump_start; this->speedXZ = 1.0f; } else { - wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); - wallPolyNormalZ = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.z); - sp24 = this->distToInteractWall + 0.5f; + f32 wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); + f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.z); + f32 sp24 = this->distToInteractWall + 0.5f; this->stateFlags1 |= PLAYER_STATE1_14; @@ -4666,9 +4663,6 @@ u8 sReturnEntranceGroupIndices[] = { s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) { s32 exitIndex; s32 temp; - s32 sp34; - f32 speedXZ; - s32 yaw; if (this->actor.category == ACTORCAT_PLAYER) { exitIndex = 0; @@ -4677,8 +4671,7 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol (this->csAction == PLAYER_CSACTION_NONE) && !(this->stateFlags1 & PLAYER_STATE1_0) && (((poly != NULL) && (exitIndex = SurfaceType_GetExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) || (func_8083816C(sFloorType) && (this->floorProperty == FLOOR_PROPERTY_12)))) { - - sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; + s32 sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_27 | PLAYER_STATE1_29)) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sp34 < 100) && (sYDistToFloor > 100.0f)) { @@ -4727,7 +4720,8 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } else { - speedXZ = this->speedXZ; + f32 speedXZ = this->speedXZ; + s32 yaw; if (speedXZ < 0.0f) { this->actor.world.rot.y += 0x8000; @@ -4851,19 +4845,14 @@ s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, Colli } s32 Player_ActionChange_1(Player* this, PlayState* play) { - SlidingDoorActorBase* slidingDoor; - DoorActorBase* door; + Actor* attachedActor; + s32 pad3; s32 doorDirection; f32 sp78; f32 sp74; Actor* doorActor; f32 sp6C; - s32 pad3; s32 frontRoom; - Actor* attachedActor; - LinkAnimationHeader* sp5C; - CollisionPoly* groundPoly; - Vec3f checkPos; if ((this->doorType != PLAYER_DOORTYPE_NONE) && (!(this->stateFlags1 & PLAYER_STATE1_11) || @@ -4882,7 +4871,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { sp74 = Math_SinS(doorActor->shape.rot.y); if (this->doorType == PLAYER_DOORTYPE_SLIDING) { - slidingDoor = (SlidingDoorActorBase*)doorActor; + SlidingDoorActorBase* slidingDoor = (SlidingDoorActorBase*)doorActor; this->yaw = slidingDoor->dyna.actor.home.rot.y; if (doorDirection > 0) { @@ -4926,7 +4915,8 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { } } else { // The door actor can be either EnDoor or DoorKiller. - door = (DoorActorBase*)doorActor; + DoorActorBase* door = (DoorActorBase*)doorActor; + LinkAnimationHeader* sp5C; door->openAnim = (doorDirection < 0.0f) ? (LINK_IS_ADULT ? DOOR_OPEN_ANIM_ADULT_L : DOOR_OPEN_ANIM_CHILD_L) @@ -4983,6 +4973,9 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { Actor_DisableLens(play); if (ENDOOR_GET_TYPE(doorActor) == DOOR_SCENEEXIT) { + CollisionPoly* groundPoly; + Vec3f checkPos; + checkPos.x = doorActor->world.pos.x - (sp6C * sp74); checkPos.y = doorActor->world.pos.y + 10.0f; checkPos.z = doorActor->world.pos.z - (sp6C * sp78); @@ -6716,24 +6709,33 @@ void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { Sfx_PlaySfxCentered((this->getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } +#if OOT_DEBUG +#define DEBUG_iREG_67 iREG(67) +#else +#define DEBUG_iREG_67 0 +#endif + s32 Player_ActionChange_2(Player* this, PlayState* play) { Actor* interactedActor; - if (iREG(67) || + if (DEBUG_iREG_67 || (((interactedActor = this->interactRangeActor) != NULL) && TitleCard_Clear(play, &play->actorCtx.titleCtx))) { - if (iREG(67) || (this->getItemId > GI_NONE)) { - if (iREG(67)) { + if (DEBUG_iREG_67 || (this->getItemId > GI_NONE)) { + if (DEBUG_iREG_67) { this->getItemId = iREG(68); } if (this->getItemId < GI_MAX) { GetItemEntry* giEntry = &sGetItemTable[this->getItemId - 1]; +#if OOT_DEBUG if ((interactedActor != &this->actor) && !iREG(67)) { interactedActor->parent = &this->actor; } - iREG(67) = false; +#else + interactedActor->parent = &this->actor; +#endif if ((Item_CheckObtainability(giEntry->itemId) == ITEM_NONE) || (play->sceneId == SCENE_BOMBCHU_BOWLING_ALLEY)) { @@ -7782,6 +7784,8 @@ void func_80841138(Player* this, PlayState* play) { f32 temp2; if (this->unk_864 < 1.0f) { + s32 pad; + temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); LinkAnimation_LoadToJoint(play, &this->skelAnime, @@ -8074,6 +8078,8 @@ void func_80841EE4(Player* this, PlayState* play) { f32 temp2; if (this->unk_864 < 1.0f) { + s32 pad; + temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); @@ -8867,8 +8873,10 @@ void Player_Action_8084411C(Player* this, PlayState* play) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Actor* heldActor; + if (this->stateFlags1 & PLAYER_STATE1_11) { - Actor* heldActor = this->heldActor; + heldActor = this->heldActor; if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { @@ -10727,15 +10735,15 @@ void Player_UpdateBodyBurn(PlayState* play, Player* this) { sp54 = (s32)(this->speedXZ * 0.4f) + 1; } - spawnedFlame = false; - timerPtr = this->bodyFlameTimers; - if (this->stateFlags2 & PLAYER_STATE2_3) { sp58 = 100; } else { sp58 = 0; } + spawnedFlame = false; + timerPtr = this->bodyFlameTimers; + func_8083819C(this, play); for (i = 0; i < PLAYER_BODYPART_MAX; i++, timerPtr++) { @@ -11378,8 +11386,6 @@ static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = { static Vec3s D_80854864 = { 0, 0, 0 }; void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, OverrideLimbDrawOpa overrideLimbDraw) { - static s32 D_8085486C = 255; - OPEN_DISPS(play->state.gfxCtx, "../z_player.c", 19228); gSPSegment(POLY_OPA_DISP++, 0x0C, cullDList); @@ -11416,15 +11422,14 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, } if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - !(this->stateFlags1 & PLAYER_STATE1_23) && (this->hoverBootsTimer != 0)) { - s32 sp5C; - s32 hoverBootsTimer = this->hoverBootsTimer; + !(this->stateFlags1 & PLAYER_STATE1_23) && ((u32)this->hoverBootsTimer != 0)) { + static s32 D_8085486C = 255; if (this->hoverBootsTimer < 19) { - if (hoverBootsTimer >= 15) { - D_8085486C = (19 - hoverBootsTimer) * 51.0f; - } else if (hoverBootsTimer < 19) { - sp5C = hoverBootsTimer; + if (this->hoverBootsTimer >= 15) { + D_8085486C = (19 - this->hoverBootsTimer) * 51.0f; + } else if (this->hoverBootsTimer < 19) { + s32 sp5C = this->hoverBootsTimer; if (sp5C > 9) { sp5C = 9; @@ -11451,6 +11456,8 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, } } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_player.c", 19328); } @@ -13010,6 +13017,8 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { this->stateFlags2 &= ~(PLAYER_STATE2_23 | PLAYER_STATE2_24 | PLAYER_STATE2_25); this->unk_6A8 = NULL; } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { + s32 pad; + gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex = sWarpSongEntrances[play->msgCtx.lastPlayedSong]; gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x5FF; gSaveContext.respawn[RESPAWN_MODE_RETURN].data = play->msgCtx.lastPlayedSong; @@ -13161,13 +13170,13 @@ void Player_Action_8084E9AC(Player* this, PlayState* play) { } } -static u8 D_808549FC[] = { - 0x01, 0x03, 0x02, 0x04, 0x04, -}; - void Player_Action_8084EAC0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->av2.actionVar2 == 0) { + static u8 D_808549FC[] = { + 0x01, 0x03, 0x02, 0x04, 0x04, + }; + if (this->itemAction == PLAYER_IA_BOTTLE_POE) { s32 rand = Rand_S16Offset(-1, 3); @@ -13202,11 +13211,10 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_wait); this->av2.actionVar2 = 1; - return; + } else { + func_8083C0E8(this, play); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); } - - func_8083C0E8(this, play); - Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); } else if (this->av2.actionVar2 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_end); @@ -13368,6 +13376,8 @@ void Player_Action_8084F104(Player* this, PlayState* play) { } if (this->av2.actionVar2 == 0) { + s32 pad; + Message_StartTextbox(play, this->actor.textId, &this->actor); if ((this->itemAction == PLAYER_IA_CHICKEN) || (this->itemAction == PLAYER_IA_POCKET_CUCCO)) { @@ -13947,27 +13957,6 @@ static LinkAnimationHeader* D_80854A70[] = { static u8 D_80854A7C[] = { 70, 10, 10 }; -static AnimSfxEntry D_80854A80[] = { - { NA_SE_PL_SKIP, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, - { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, -}; - -static AnimSfxEntry D_80854A8C[][2] = { - { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, - { NA_SE_VO_LI_MAGIC_FROL, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 30) }, - }, - { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, - { NA_SE_VO_LI_MAGIC_NALE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 44) }, - }, - { - { NA_SE_VO_LI_MAGIC_ATTACK, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, - { NA_SE_IT_SWORD_SWING_HARD, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, - }, -}; - void Player_Action_808507F4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->av1.actionVar1 < 0) { @@ -14018,8 +14007,29 @@ void Player_Action_808507F4(Player* this, PlayState* play) { } } else if (this->av1.actionVar1 >= 0) { if (this->av2.actionVar2 == 0) { + static AnimSfxEntry D_80854A80[] = { + { NA_SE_PL_SKIP, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, + }; + Player_ProcessAnimSfxList(this, D_80854A80); } else if (this->av2.actionVar2 == 1) { + static AnimSfxEntry D_80854A8C[][2] = { + { + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, + { NA_SE_VO_LI_MAGIC_FROL, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 30) }, + }, + { + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, + { NA_SE_VO_LI_MAGIC_NALE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 44) }, + }, + { + { NA_SE_VO_LI_MAGIC_ATTACK, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, + { NA_SE_IT_SWORD_SWING_HARD, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + }, + }; + Player_ProcessAnimSfxList(this, D_80854A8C[this->av1.actionVar1]); if ((this->av1.actionVar1 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { this->stateFlags1 &= ~(PLAYER_STATE1_28 | PLAYER_STATE1_29); @@ -15127,7 +15137,6 @@ void func_80852C0C(PlayState* play, Player* this, s32 csAction) { void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { CsCmdActorCue* cue = play->csCtx.playerCue; s32 pad; - s32 csAction; if (play->csCtx.state == CS_STATE_STOP) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); @@ -15138,34 +15147,35 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { if (cue == NULL) { this->actor.flags &= ~ACTOR_FLAG_6; - return; - } + } else { + s32 csAction; - if (this->cueId != cue->id) { - csAction = sCueToCsActionMap[cue->id]; + if (this->cueId != cue->id) { + csAction = sCueToCsActionMap[cue->id]; - if (csAction >= PLAYER_CSACTION_NONE) { - if ((csAction == PLAYER_CSACTION_3) || (csAction == PLAYER_CSACTION_4)) { - func_80852A54(play, this, cue); - } else { - func_808529D0(play, this, cue); + if (csAction >= PLAYER_CSACTION_NONE) { + if ((csAction == PLAYER_CSACTION_3) || (csAction == PLAYER_CSACTION_4)) { + func_80852A54(play, this, cue); + } else { + func_808529D0(play, this, cue); + } } + + D_80858AA0 = this->skelAnime.moveFlags; + + func_80832DBC(this); + PRINTF("TOOL MODE=%d\n", csAction); + func_80852C0C(play, this, ABS(csAction)); + func_80852B4C(play, this, cue, &D_80854B18[ABS(csAction)]); + + this->av2.actionVar2 = 0; + this->av1.actionVar1 = 0; + this->cueId = cue->id; } - D_80858AA0 = this->skelAnime.moveFlags; - - func_80832DBC(this); - PRINTF("TOOL MODE=%d\n", csAction); - func_80852C0C(play, this, ABS(csAction)); - func_80852B4C(play, this, cue, &D_80854B18[ABS(csAction)]); - - this->av2.actionVar2 = 0; - this->av1.actionVar1 = 0; - this->cueId = cue->id; + csAction = sCueToCsActionMap[this->cueId]; + func_80852B4C(play, this, cue, &D_80854E50[ABS(csAction)]); } - - csAction = sCueToCsActionMap[this->cueId]; - func_80852B4C(play, this, cue, &D_80854E50[ABS(csAction)]); } void Player_Action_CsAction(Player* this, PlayState* play) { diff --git a/tools/disasm/disasm.py b/tools/disasm/disasm.py index 9435f3cd2c..d0affdd485 100755 --- a/tools/disasm/disasm.py +++ b/tools/disasm/disasm.py @@ -88,6 +88,7 @@ def main(): context = spimdisasm.common.Context() context.parseArgs(args) context.changeGlobalSegmentRanges(0x00000000, 0x01000000, 0x8000000, 0x81000000) + context.addBannedSymbolRange(0x0000F000, 0x00010100) context.addBannedSymbolRange(0x10000000, 0x80000300) context.addBannedSymbolRange(0xA0000000, 0xFFFFFFFF) diff --git a/tools/disasm/gc-eu-mq/files_code.csv b/tools/disasm/gc-eu-mq/files_code.csv index 9de88579f9..d22e15fe08 100644 --- a/tools/disasm/gc-eu-mq/files_code.csv +++ b/tools/disasm/gc-eu-mq/files_code.csv @@ -132,7 +132,7 @@ BCBE0,800CDAE0,src/code/padsetup BCD20,800CDC20,src/code/code_800FCE80 BD230,800CE130,src/code/fp BD390,800CE290,src/code/system_malloc -BD560,800CE460,src/code/code_800FD970 +BD560,800CE460,src/code/rand BD720,800CE620,src/code/__osMalloc BE4D0,800CF3D0,src/libultra/libc/sprintf BE5A0,800CF4A0,src/code/printutils @@ -295,7 +295,7 @@ F0640,80101540,src/code/logseverity F0650,80101550,src/code/gfxprint F0F00,80101E00,src/code/code_800FC620 F0F20,80101E20,src/code/fp -F0F30,80101E30,src/code/code_800FD970 +F0F30,80101E30,src/code/rand F0F40,80101E40,src/code/__osMalloc F0F50,80101E50,src/libultra/gu/sins F1750,80102650,src/libultra/io/siacs @@ -451,7 +451,7 @@ offset,vram,.bss 119530,8012A430,src/code/gfxprint 119540,8012A440,src/code/code_800FCE80 119550,8012A450,src/code/system_malloc -119580,8012A480,src/code/code_800FD970 +119580,8012A480,src/code/rand 119590,8012A490,src/code/__osMalloc 1195A0,8012A4A0,src/code/jpegdecoder 1195B0,8012A4B0,src/libultra/io/sptask diff --git a/tools/disasm/gc-eu-mq/functions.txt b/tools/disasm/gc-eu-mq/functions.txt index cd5d63da24..7b75f6ab7c 100644 --- a/tools/disasm/gc-eu-mq/functions.txt +++ b/tools/disasm/gc-eu-mq/functions.txt @@ -7460,7 +7460,7 @@ EnCs_ChangeAnim = 0x809CD450; // type:func EnCs_Init = 0x809CD574; // type:func EnCs_Destroy = 0x809CD708; // type:func EnCs_GetTalkState = 0x809CD734; // type:func -EnCs_GetTextID = 0x809CD868; // type:func +EnCs_GetTextId = 0x809CD868; // type:func EnCs_HandleTalking = 0x809CD8EC; // type:func EnCs_GetwaypointCount = 0x809CDA38; // type:func EnCs_GetPathPoint = 0x809CDA4C; // type:func @@ -7505,7 +7505,7 @@ EnDaikuKakariko_PostLimbDraw = 0x809D0D30; // type:func EnDaikuKakariko_Draw = 0x809D0DAC; // type:func EnDekubaba_Init = 0x809D1180; // type:func EnDekubaba_Destroy = 0x809D13C4; // type:func -EnDekubaba_DisableHitboxes = 0x809D13F0; // type:func +EnDekubaba_DisableACColliderElems = 0x809D13F0; // type:func EnDekubaba_SetupWait = 0x809D1478; // type:func EnDekubaba_SetupGrow = 0x809D16E0; // type:func EnDekubaba_SetupRetract = 0x809D1810; // type:func diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index 57c19f3b50..472edb6964 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -1,3 +1,6 @@ +build_system = "make" +compiler_type = "ido" # adjusts default weights for permuting + [preserve_macros] "g[DS]P.*" = "void" "gDma.*" = "void" @@ -10,7 +13,6 @@ OPEN_DISPS = "void" CLOSE_DISPS = "void" GRAPH_ALLOC = "void*" LOG_UTILS_CHECK_NULL_POINTER = "void" -PRINTF = "void" WORK_DISP = "void*" POLY_OPA_DISP = "void*" POLY_XLU_DISP = "void*" @@ -20,10 +22,14 @@ ABS = "int" SQ = "int" CLAMP = "int" +# If changing to not preserve these, add a check for the permuter to IDO_PRINTF_WORKAROUND, +# so that modern CPP (used by the permuter import) does not error on the IDO-specific hack. +# For example: +# #define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !PERMUTER && !M2CTX) +PRINTF = "void" +SCHED_DEBUG_PRINTF = "void" +ACTOR_DEBUG_PRINTF = "void" + [decompme.compilers] -"tools/ido_recomp/linux/7.1/cc" = "ido7.1" -"tools/ido_recomp/macos/7.1/cc" = "ido7.1" -"tools/ido_recomp/windows/7.1/cc" = "ido7.1" -"tools/ido_recomp/linux/5.3/cc" = "ido5.3" -"tools/ido_recomp/macos/5.3/cc" = "ido5.3" -"tools/ido_recomp/windows/5.3/cc" = "ido5.3" +"tools/ido_recomp/*/7.1/cc" = "ido7.1" +"tools/ido_recomp/*/5.3/cc" = "ido5.3"