diff --git a/src/boot/assert.c b/src/boot/assert.c index dc09d1a1cc..00dcd4f344 100644 --- a/src/boot/assert.c +++ b/src/boot/assert.c @@ -1,7 +1,6 @@ #include -void __assert(const char* exp, const char* file, s32 line) -{ +void __assert(const char* exp, const char* file, s32 line) { char msg[256]; osSyncPrintf("Assertion failed: %s, file %s, line %d, thread %d\n", exp, file, line, osGetThreadId(NULL)); sprintf(msg, "ASSERT: %s:%d(%d)", file, line, osGetThreadId(NULL)); diff --git a/src/boot/boot_main.c b/src/boot/boot_main.c index f551d921be..06d4339195 100644 --- a/src/boot/boot_main.c +++ b/src/boot/boot_main.c @@ -7,14 +7,12 @@ u8 sIdleThreadStack[0x400]; StackEntry sIdleThreadInfo; u8 sBootThreadStack[0x400]; -void cleararena(void) -{ +void cleararena(void) { bzero(_dmadataSegmentStart, (u8*)osMemSize - OS_K0_TO_PHYSICAL(_dmadataSegmentStart)); } -void bootproc(void) -{ - StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack+sizeof(sBootThreadStack), 0, -1, "boot"); +void bootproc(void) { + StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack + sizeof(sBootThreadStack), 0, -1, "boot"); osMemSize = osGetMemSize(); cleararena(); @@ -25,8 +23,8 @@ void bootproc(void) osDriveRomInit(); isPrintfInit(); Locale_Init(); - - StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack+sizeof(sIdleThreadStack), 0, 256, "idle"); - osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, 0, sIdleThreadStack+sizeof(sIdleThreadStack), 10); + + StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack + sizeof(sIdleThreadStack), 0, 256, "idle"); + osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, 0, sIdleThreadStack + sizeof(sIdleThreadStack), 10); osStartThread(&sIdleThread); } diff --git a/src/boot/idle.c b/src/boot/idle.c index 7c6a9207aa..6ab012a4c3 100644 --- a/src/boot/idle.c +++ b/src/boot/idle.c @@ -17,15 +17,15 @@ u32 gViConfigFeatures = OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF; f32 gViConfigXScale = 1.0; f32 gViConfigYScale = 1.0; -void Main_ThreadEntry(void* arg0) -{ +void Main_ThreadEntry(void* arg0) { OSTime var1; osSyncPrintf("mainx 実行開始\n"); DmaMgr_Start(); osSyncPrintf("codeセグメントロード中..."); var1 = osGetTime(); - DmaMgr_SendRequest1((u32)_dmadataSegmentEnd, (u32)_codeSegmentRomStart, _codeSegmentRomEnd - _codeSegmentRomStart, "../idle.c", 238); + DmaMgr_SendRequest1((u32)_dmadataSegmentEnd, (u32)_codeSegmentRomStart, _codeSegmentRomEnd - _codeSegmentRomStart, + "../idle.c", 238); var1 -= osGetTime(); osSyncPrintf("\rcodeセグメントロード中...完了\n"); osSyncPrintf("転送時間 %6.3f\n"); @@ -35,8 +35,7 @@ void Main_ThreadEntry(void* arg0) osSyncPrintf("mainx 実行終了\n"); } -void Idle_ThreadEntry(void* a0) -{ +void Idle_ThreadEntry(void* a0) { osSyncPrintf("アイドルスレッド(idleproc)実行開始\n"); osSyncPrintf("作製者 : %s\n", gBuildTeam); osSyncPrintf("作成日時 : %s\n", gBuildDate); @@ -57,8 +56,7 @@ void Idle_ThreadEntry(void* a0) gViConfigXScale = 1.0f; gViConfigYScale = 1.0f; - switch (osTvType) - { + switch (osTvType) { case 1: D_80013960 = 2; gViConfigMode = osViModeNtscLan1; @@ -82,11 +80,12 @@ void Idle_ThreadEntry(void* a0) osViBlack(1); osViSwapBuffer(0x803da80); osCreatePiManager(0x96, &gPiMgrCmdQ, sPiMgrCmdBuff, 0x32); - StackCheck_Init(&sMainStackInfo, sMainStack, sMainStack+sizeof(sMainStack), 0, 0x400, "main"); - osCreateThread(&sMainThread, 3, Main_ThreadEntry, a0, sMainStack+sizeof(sMainStack), 10); + StackCheck_Init(&sMainStackInfo, sMainStack, sMainStack + sizeof(sMainStack), 0, 0x400, "main"); + osCreateThread(&sMainThread, 3, Main_ThreadEntry, a0, sMainStack + sizeof(sMainStack), 10); osStartThread(&sMainThread); osSetThreadPri(NULL, 0); - while(1) + while (1) { ; + } } diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index 3f7a996b32..6214545275 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -1,82 +1,76 @@ #include #include -OSPiHandle* sISVHandle; //official name : is_Handle +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))) -void isPrintfInit() -{ +void isPrintfInit() { sISVHandle = osCartRomInit(); osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, 0); osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->get, 0); - osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->magic, ASCII_TO_U32('I','S','6','4')); + osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->magic, ASCII_TO_U32('I', 'S', '6', '4')); } -void osSyncPrintfUnused(const char* fmt, ...) -{ +void osSyncPrintfUnused(const char* fmt, ...) { va_list args; va_start(args, fmt); _Printf(&is_proutSyncPrintf, NULL, fmt, args); } -void osSyncPrintf(const char* fmt, ...) -{ +void osSyncPrintf(const char* fmt, ...) { va_list args; va_start(args, fmt); _Printf(&is_proutSyncPrintf, NULL, fmt, args); } -//assumption -void rmonPrintf(const char* fmt, ...) -{ +// assumption +void rmonPrintf(const char* fmt, ...) { va_list args; va_start(args, fmt); _Printf(&is_proutSyncPrintf, NULL, fmt, args); } -u32 is_proutSyncPrintf(void* arg0, const char *str, s32 count) -{ +u32 is_proutSyncPrintf(void* arg0, const char* str, s32 count) { u32 data; s32 pos; s32 start; s32 end; osEPiReadIo(sISVHandle, (u32)&gISVDbgPrnAdrs->magic, &data); - if (data != ASCII_TO_U32('I','S','6','4')) + if (data != ASCII_TO_U32('I', 'S', '6', '4')) { return 1; + } osEPiReadIo(sISVHandle, (u32)&gISVDbgPrnAdrs->get, &data); pos = data; osEPiReadIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, &data); start = data; end = start + count; - if (end >= 0xffe0) - { + if (end >= 0xffe0) { end -= 0xffe0; - if (pos < end || start < pos) + if (pos < end || start < pos) { return 1; - } - else - { - if (start < pos && pos < end) + } + } else { + if (start < pos && pos < end) { return 1; + } } - while (count) - { + while (count) { u32 addr = (u32)&gISVDbgPrnAdrs->data + (start & 0xffffffc); s32 shift = ((3 - (start & 3)) * 8); - if (*str) - { + if (*str) { osEPiReadIo(sISVHandle, addr, &data); osEPiWriteIo(sISVHandle, addr, (*str << shift) | (data & ~(0xff << shift))); start++; - if (start >= 0xffe0) + if (start >= 0xffe0) { start -= 0xffe0; + } } count--; str++; @@ -85,9 +79,9 @@ u32 is_proutSyncPrintf(void* arg0, const char *str, s32 count) return 1; } -void func_80002384(const char* exp, const char* file, u32 line) -{ +void func_80002384(const char* exp, const char* file, u32 line) { osSyncPrintf("File:%s Line:%d %s \n", file, line, exp); - while (true) + while (true) { ; + } } diff --git a/src/boot/logutils.c b/src/boot/logutils.c index 9d0022824e..ca678a9fc0 100644 --- a/src/boot/logutils.c +++ b/src/boot/logutils.c @@ -2,22 +2,25 @@ #include #include -float LogUtils_CheckFloatRange(const char* exp, s32 arg1, const char* var1Name, float var1, const char* var2Name, float var2, const char* var3Name, float var3) -{ - if (var1 < var2 || var3 < var1) - osSyncPrintf("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, arg1, var2Name, var2, var1Name, var1, var3Name, var3); +float LogUtils_CheckFloatRange(const char* exp, s32 arg1, const char* var1Name, float var1, const char* var2Name, + float var2, const char* var3Name, float var3) { + if (var1 < var2 || var3 < var1) { + osSyncPrintf("%s %d: range error %s(%f) < %s(%f) < %s(%f)\n", exp, arg1, var2Name, var2, var1Name, var1, + var3Name, var3); + } return var1; } -s32 LogUtils_CheckIntRange(const char* exp, s32 arg1, const char* var1Name, s32 var1, const char* var2Name, s32 var2, const char* var3Name, s32 var3) -{ - if (var1 < var2 || var3 < var1) - osSyncPrintf("%s %d: range error %s(%d) < %s(%d) < %s(%d)\n", exp, arg1, var2Name, var2, var1Name, var1, var3Name, var3); +s32 LogUtils_CheckIntRange(const char* exp, s32 arg1, const char* var1Name, s32 var1, const char* var2Name, s32 var2, + const char* var3Name, s32 var3) { + if (var1 < var2 || var3 < var1) { + osSyncPrintf("%s %d: range error %s(%d) < %s(%d) < %s(%d)\n", exp, arg1, var2Name, var2, var1Name, var1, + var3Name, var3); + } return var1; } -void LogUtils_LogHexDump(void* ptr, s32 size0) -{ +void LogUtils_LogHexDump(void* ptr, s32 size0) { u8* addr = (u8*)ptr; s32 size = (s32)size0; s32 rest; @@ -28,40 +31,39 @@ void LogUtils_LogHexDump(void* ptr, s32 size0) osSyncPrintf("address off +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +a +b +c +d +e +f 0123456789abcdef\n"); off = 0; - while (size > 0) - { + while (size > 0) { osSyncPrintf("%08x %04x", addr, off); rest = (size < 0x10) ? size : 0x10; i = 0; - while (true) - { - if(i < rest) + while (true) { + if (i < rest) { osSyncPrintf(" %02x", *((u8*)addr + i)); - else + } else { osSyncPrintf(" "); + } i++; - if (i > 0xf) + if (i > 0xf) { break; + } } osSyncPrintf(" "); i = 0; - while (true) - { - if(i < rest) - { - u8 a = *(addr+i); + while (true) { + if (i < rest) { + u8 a = *(addr + i); osSyncPrintf("%c", (a >= 0x20 && a < 0x7f) ? a : '.'); - } - else + } else { osSyncPrintf(" "); + } i++; - if (i > 0xf) + if (i > 0xf) { break; + } } osSyncPrintf("\n"); size -= rest; @@ -70,46 +72,43 @@ 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, s32 line) { osSyncPrintf(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) -{ - u32 mask = (unk - 1); - if (value & mask) - osSyncPrintf(VT_COL(RED, WHITE) "%s %d:%s(%08x) は バウンダリ(%d)違反です\n" VT_RST, file, line, name, value, unk); +void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, s32 line) { + u32 mask = (unk - 1); + if (value & mask) { + osSyncPrintf(VT_COL(RED, WHITE) "%s %d:%s(%08x) は バウンダリ(%d)違反です\n" VT_RST, file, line, name, value, + unk); + } } -void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line) -{ - if (!ptr) +void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line) { + if (!ptr) { osSyncPrintf(VT_COL(RED, WHITE) "%s %d:%s は はヌルポインタです\n" VT_RST, file, line, exp); + } } -//check valid pointer -void LogUtils_CheckValidPointer(const char* exp, void* ptr0, const char* file, s32 line) -{ +// check valid pointer +void LogUtils_CheckValidPointer(const char* exp, void* ptr0, const char* file, s32 line) { u32 ptr = (u32)ptr0; - if (!ptr || ptr < 0x80000000U || (0x80000000U + osMemSize) <= ptr) + if (!ptr || ptr < 0x80000000U || (0x80000000U + osMemSize) <= ptr) { osSyncPrintf(VT_COL(RED, WHITE) "%s %d:ポインタ %s(%08x) が異常です\n" VT_RST, file, line, exp, ptr); + } } -//there's probalby a macro like this : MACRO(exp) LogUtils_LogThreadId(__FILE__, __LINE__); osSyncPrintf(exp) -void LogUtils_LogThreadId(const char* name, s32 line) -{ +// there's probalby a macro like this : MACRO(exp) LogUtils_LogThreadId(__FILE__, __LINE__); osSyncPrintf(exp) +void LogUtils_LogThreadId(const char* name, s32 line) { osSyncPrintf("<%d %s %d>", osGetThreadId(NULL), name, line); } -void LogUtils_HungupThread(const char* name, s32 line) -{ +void LogUtils_HungupThread(const char* name, s32 line) { osSyncPrintf("*** HungUp in thread %d, [%s:%d] ***\n", osGetThreadId(NULL), name, line); Fault_AddHungupAndCrash(name, line); } -void LogUtils_ResetHungup() -{ +void LogUtils_ResetHungup() { osSyncPrintf("*** Reset ***\n"); Fault_AddHungupAndCrash("Reset", 0); -} \ No newline at end of file +} diff --git a/src/boot/stackcheck.c b/src/boot/stackcheck.c index d8d0b8fe2d..2ea3fad41b 100644 --- a/src/boot/stackcheck.c +++ b/src/boot/stackcheck.c @@ -5,137 +5,130 @@ StackEntry* sStackInfoListStart = NULL; StackEntry* sStackInfoListEnd = NULL; -void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, const char* name) -{ +void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, + const char* name) { StackEntry* iter; u32* addr; - if (!entry) + if (!entry) { sStackInfoListStart = NULL; - else - { + } else { entry->head = (u32)stackTop; entry->tail = (u32)stackBottom; entry->initValue = initValue; entry->minSpace = minSpace; entry->name = name; iter = sStackInfoListStart; - while (iter) - { - if (iter == entry) - { + while (iter) { + if (iter == entry) { osSyncPrintf(VT_COL(RED, WHITE) "stackcheck_init: %08x は既にリスト中にある\n" VT_RST, entry); return; } iter = iter->next; } - + entry->prev = sStackInfoListEnd; entry->next = NULL; - - if (sStackInfoListEnd) + + if (sStackInfoListEnd) { sStackInfoListEnd->next = entry; + } sStackInfoListEnd = entry; - if (!sStackInfoListStart) + if (!sStackInfoListStart) { sStackInfoListStart = entry; + } - if (entry->minSpace != -1) - { + if (entry->minSpace != -1) { addr = (u32*)entry->head; - while ((u32)addr < entry->tail) + while ((u32)addr < entry->tail) { *addr++ = entry->initValue; + } } } } -void StackCheck_Cleanup(StackEntry* entry) -{ +void StackCheck_Cleanup(StackEntry* entry) { bool inconsistency = false; - if (!entry->prev) - { - if (entry == sStackInfoListStart) + if (!entry->prev) { + if (entry == sStackInfoListStart) { sStackInfoListStart = entry->next; - else + } else { inconsistency = true; - } - else + } + } else { entry->prev->next = entry->next; - - if (!entry->next) - { - if (entry == sStackInfoListEnd) - sStackInfoListEnd = entry->prev; - else - inconsistency = true; } - if (inconsistency) + + if (!entry->next) { + if (entry == sStackInfoListEnd) { + sStackInfoListEnd = entry->prev; + } else { + inconsistency = true; + } + } + if (inconsistency) { osSyncPrintf(VT_COL(RED, WHITE) "stackcheck_cleanup: %08x リスト不整合です\n" VT_RST, entry); + } } -StackStatus StackCheck_GetState(StackEntry* entry) -{ +StackStatus StackCheck_GetState(StackEntry* entry) { u32* last; u32 used; u32 free; s32 ret; - for (last = (u32*)entry->head; (u32)last < entry->tail; last++) - { - if (entry->initValue != *last) + for (last = (u32*)entry->head; (u32)last < entry->tail; last++) { + if (entry->initValue != *last) { break; + } } used = entry->tail - (u32)last; free = (u32)last - entry->head; - if (free == 0) - { + if (free == 0) { ret = STACK_STATUS_OVERFLOW; osSyncPrintf(VT_FGCOL(RED)); - } - else if (free < entry->minSpace && entry->minSpace != -1) - { + } else if (free < entry->minSpace && entry->minSpace != -1) { ret = STACK_STATUS_WARNING; osSyncPrintf(VT_FGCOL(YELLOW)); - } - else - { + } else { osSyncPrintf(VT_FGCOL(GREEN)); ret = STACK_STATUS_OK; } - osSyncPrintf("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free, entry->name ? entry->name : "(null)"); + osSyncPrintf("head=%08x tail=%08x last=%08x used=%08x free=%08x [%s]\n", entry->head, entry->tail, last, used, free, + entry->name ? entry->name : "(null)"); osSyncPrintf(VT_RST); - if (ret != STACK_STATUS_OK) + if (ret != STACK_STATUS_OK) { LogUtils_LogHexDump(entry->head, entry->tail - entry->head); + } return ret; } - -u32 StackCheck_CheckAll() -{ +u32 StackCheck_CheckAll() { u32 ret = 0; StackEntry* iter = sStackInfoListStart; - while(iter) - { + while (iter) { u32 state = StackCheck_GetState(iter); - if (state != STACK_STATUS_OK) + if (state != STACK_STATUS_OK) { ret = 1; + } iter = iter->next; } return ret; } -u32 StackCheck_Check(StackEntry* entry) -{ - if (!entry) +u32 StackCheck_Check(StackEntry* entry) { + if (!entry) { return StackCheck_CheckAll(); - else + } else { return StackCheck_GetState(entry); + } } diff --git a/src/boot/viconfig.c b/src/boot/viconfig.c index 9fe1efd40e..a31aa45371 100644 --- a/src/boot/viconfig.c +++ b/src/boot/viconfig.c @@ -2,35 +2,34 @@ #include #include -//this should probably go elsewhere but right now viconfig.o is the only object between idle and z_std_dma +// this should probably go elsewhere but right now viconfig.o is the only object between idle and z_std_dma OSPiHandle* gCartHandle = 0; -void ViConfig_UpdateVi(u32 arg0) -{ - if (arg0 != 0) - { +void ViConfig_UpdateVi(u32 arg0) { + if (arg0 != 0) { osSyncPrintf(VT_COL(YELLOW, BLACK) "osViSetYScale1(%f);\n" VT_RST, 1.0f); - if (osTvType == 0) + if (osTvType == 0) { osViSetMode(&osViModePalLan1); + } osViSetYScale(1.0f); - } - else - { + } else { osViSetMode(&gViConfigMode); - if (gViConfigAdditionalScanLines != 0) + if (gViConfigAdditionalScanLines != 0) { osViExtendVStart(gViConfigAdditionalScanLines); + } - if (gViConfigFeatures != 0) + if (gViConfigFeatures != 0) { osViSetSpecialFeatures(gViConfigFeatures); + } - if (gViConfigXScale != 1.0f) + if (gViConfigXScale != 1.0f) { osViSetXScale(gViConfigXScale); + } - if (gViConfigYScale != 1.0f) - { + if (gViConfigYScale != 1.0f) { osSyncPrintf(VT_COL(YELLOW, BLACK) "osViSetYScale3(%f);\n" VT_RST, gViConfigYScale); osViSetYScale(gViConfigYScale); } @@ -39,10 +38,10 @@ void ViConfig_UpdateVi(u32 arg0) gViConfigUseDefault = arg0; } -void ViConfig_UpdateBlack() -{ - if (gViConfigUseDefault != 0) +void ViConfig_UpdateBlack() { + if (gViConfigUseDefault != 0) { osViBlack(1); - else + } else { osViBlack(0); + } } diff --git a/src/boot/yaz0.c b/src/boot/yaz0.c index 03f4a720e0..5954e28aaa 100644 --- a/src/boot/yaz0.c +++ b/src/boot/yaz0.c @@ -7,50 +7,45 @@ u32 sYaz0CurRomStart; u32 sYaz0CurSize; u32 sYaz0MaxPtr; -void* Yaz0_FirstDMA() -{ +void* Yaz0_FirstDMA() { u32 pad0; u32 pad1; u32 dmaSize; u32 curSize; sYaz0MaxPtr = sYaz0CurDataEnd - 0x19; - + curSize = sYaz0CurDataEnd - (u32)sYaz0DataBuffer; - dmaSize = (curSize > sYaz0CurSize) - ? sYaz0CurSize - : curSize; - + dmaSize = (curSize > sYaz0CurSize) ? sYaz0CurSize : curSize; + DmaMgr_DMARomToRam(sYaz0CurRomStart, sYaz0DataBuffer, dmaSize); sYaz0CurRomStart += dmaSize; sYaz0CurSize -= dmaSize; return sYaz0DataBuffer; } -void* Yaz0_NextDMA(void* curSrcPos) -{ +void* Yaz0_NextDMA(void* curSrcPos) { u8* dst; u32 restSize; u32 dmaSize; restSize = sYaz0CurDataEnd - (u32)curSrcPos; - dst = (restSize & 7) - ? (sYaz0DataBuffer - (restSize & 7)) + 8 - : sYaz0DataBuffer; + dst = (restSize & 7) ? (sYaz0DataBuffer - (restSize & 7)) + 8 : sYaz0DataBuffer; bcopy(curSrcPos, dst, restSize); dmaSize = (sYaz0CurDataEnd - (u32)dst) - restSize; - if (sYaz0CurSize < dmaSize) + if (sYaz0CurSize < dmaSize) { dmaSize = sYaz0CurSize; + } - if (dmaSize != 0) - { + if (dmaSize != 0) { DmaMgr_DMARomToRam(sYaz0CurRomStart, (u32)dst + restSize, dmaSize); sYaz0CurRomStart += dmaSize; sYaz0CurSize -= dmaSize; - if (!sYaz0CurSize) + if (!sYaz0CurSize) { sYaz0MaxPtr = (u32)dst + restSize + dmaSize; + } } return dst; @@ -60,8 +55,7 @@ void* Yaz0_NextDMA(void* curSrcPos) // has an extra check at the start of the small compressed loop // along with an extra move instruction // maybe some regalloc differences besides these issues -void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) -{ +void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) { u32 bitIdx; u8* src; u8* dstEnd; @@ -76,10 +70,8 @@ void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) src = hdr->data; dstEnd = dst + hdr->decSize; - do - { - if (bitIdx == 0) - { + do { + if (bitIdx == 0) { if ((sYaz0MaxPtr < (u32)src) && (sYaz0CurSize != 0)) src = Yaz0_NextDMA(src); @@ -90,19 +82,16 @@ void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) curDecBit = chunkHeader & (1 << 7); chunkHeader <<= 1; - if (curDecBit) // uncompressed - { + if (curDecBit) { // uncompressed *dst++ = *src++; - } - else // compressed - { + } else { // compressed nibble = *src >> 4; backPtr = dst - (*(src + 1) | (*src & 0xF) << 8); src += 2; - chunkSize = (nibble == 0) // N = chunkSize; B = back offset - ? *src++ + 0x12 // 3 bytes 0B BB NN - : nibble + 2; // 2 bytes NB BB + chunkSize = (nibble == 0) // N = chunkSize; B = back offset + ? *src++ + 0x12 // 3 bytes 0B BB NN + : nibble + 2; // 2 bytes NB BB for (off = chunkSize; off > 0; off--) *dst++ = *(backPtr++ - 1); @@ -115,8 +104,7 @@ void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) #pragma GLOBAL_ASM("asm/non_matchings/boot/yaz0/Yaz0_DecompressImpl.s") #endif -void Yaz0_Decompress(u32 romStart, void* dst, u32 size) -{ +void Yaz0_Decompress(u32 romStart, void* dst, u32 size) { sYaz0CurRomStart = romStart; sYaz0CurSize = size; sYaz0CurDataEnd = sYaz0DataBuffer + sizeof(sYaz0DataBuffer); diff --git a/src/boot/z_locale.c b/src/boot/z_locale.c index ecd8ce1df9..4d2956e3ed 100644 --- a/src/boot/z_locale.c +++ b/src/boot/z_locale.c @@ -6,16 +6,14 @@ u32 gCurrentRegion = 0; LocaleCartInfo sCartInfo; -//temporary +// temporary extern PadMgr gPadMgr; -void Locale_Init() -{ +void Locale_Init() { osEPiReadIo(gCartHandle, 0x38, &sCartInfo.mediaFormat); osEPiReadIo(gCartHandle, 0x3C, &sCartInfo.regionInfo); - switch (sCartInfo.countryCode) - { + switch (sCartInfo.countryCode) { case 'J': // "NTSC-U (North America)" gCurrentRegion = REGION_US; break; @@ -36,39 +34,39 @@ void Locale_Init() osSyncPrintf("z_locale_init:日本用かアメリカ用か3コンで判断させる\n"); } -void Locale_ResetRegion() -{ +void Locale_ResetRegion() { gCurrentRegion = REGION_NULL; } -u32 func_80001F48() -{ - PadMgr* padMgr = (PadMgr*)(u32)&gPadMgr; //cast required to match +u32 func_80001F48() { + PadMgr* padMgr = (PadMgr*)(u32)&gPadMgr; // cast required to match - if (gCurrentRegion == REGION_NATIVE) + if (gCurrentRegion == REGION_NATIVE) { return 0; + } - if (padMgr->unk_2A8 & 4) + if (padMgr->unk_2A8 & 4) { return 0; + } return 1; } -u32 func_80001F8C() -{ - PadMgr* padMgr = (PadMgr*)(u32)&gPadMgr; //cast required to match +u32 func_80001F8C() { + PadMgr* padMgr = (PadMgr*)(u32)&gPadMgr; // cast required to match - if (gCurrentRegion == REGION_NATIVE) + if (gCurrentRegion == REGION_NATIVE) { return 0; + } - if (padMgr->unk_2A8 & 4) + if (padMgr->unk_2A8 & 4) { return 1; + } return 0; } // This function appears to be unused? -u32 Locale_IsRegionNative() -{ +u32 Locale_IsRegionNative() { return gCurrentRegion == REGION_NATIVE; } diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 39618b8aba..b6c7a8f13a 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -13,1564 +13,1563 @@ s32 sDmaMgrCurFileLine; u32 D_80009460 = 0; u32 sDmaMgrDmaBuffSize = 0x2000; u32 sDmaMgrDataExistError = 0; -const char* sDmaMgrFileNames[0x5FC] = -{ - "makerom", - "boot", - "dmadata", - "Audiobank", - "Audioseq", - "Audiotable", - "link_animetion", - "icon_item_static", - "icon_item_24_static", - "icon_item_field_static", - "icon_item_dungeon_static", - "icon_item_gameover_static", - "icon_item_nes_static", - "icon_item_ger_static", - "icon_item_fra_static", - "item_name_static", - "map_name_static", - "do_action_static", - "message_static", - "message_texture_static", - "nes_font_static", - "nes_message_data_static", - "ger_message_data_static", - "fra_message_data_static", - "staff_message_data_static", - "map_grand_static", - "map_i_static", - "map_48x85_static", - "code", - "ovl_title", - "ovl_select", - "ovl_opening", - "ovl_file_choose", - "ovl_kaleido_scope", - "ovl_player_actor", - "ovl_map_mark_data", - "ovl_En_Test", - "ovl_Arms_Hook", - "ovl_Arrow_Fire", - "ovl_Arrow_Ice", - "ovl_Arrow_Light", - "ovl_Bg_Bdan_Objects", - "ovl_Bg_Bdan_Switch", - "ovl_Bg_Bom_Guard", - "ovl_Bg_Bombwall", - "ovl_Bg_Bowl_Wall", - "ovl_Bg_Breakwall", - "ovl_Bg_Ddan_Jd", - "ovl_Bg_Ddan_Kd", - "ovl_Bg_Dodoago", - "ovl_Bg_Dy_Yoseizo", - "ovl_Bg_Ganon_Otyuka", - "ovl_Bg_Gate_Shutter", - "ovl_Bg_Gjyo_Bridge", - "ovl_Bg_Gnd_Darkmeiro", - "ovl_Bg_Gnd_Firemeiro", - "ovl_Bg_Gnd_Iceblock", - "ovl_Bg_Gnd_Nisekabe", - "ovl_Bg_Gnd_Soulmeiro", - "ovl_Bg_Haka", - "ovl_Bg_Haka_Gate", - "ovl_Bg_Haka_Huta", - "ovl_Bg_Haka_Megane", - "ovl_Bg_Haka_MeganeBG", - "ovl_Bg_Haka_Sgami", - "ovl_Bg_Haka_Ship", - "ovl_Bg_Haka_Trap", - "ovl_Bg_Haka_Tubo", - "ovl_Bg_Haka_Water", - "ovl_Bg_Haka_Zou", - "ovl_Bg_Heavy_Block", - "ovl_Bg_Hidan_Curtain", - "ovl_Bg_Hidan_Dalm", - "ovl_Bg_Hidan_Firewall", - "ovl_Bg_Hidan_Fslift", - "ovl_Bg_Hidan_Fwbig", - "ovl_Bg_Hidan_Hamstep", - "ovl_Bg_Hidan_Hrock", - "ovl_Bg_Hidan_Kousi", - "ovl_Bg_Hidan_Kowarerukabe", - "ovl_Bg_Hidan_Rock", - "ovl_Bg_Hidan_Rsekizou", - "ovl_Bg_Hidan_Sekizou", - "ovl_Bg_Hidan_Sima", - "ovl_Bg_Hidan_Syoku", - "ovl_Bg_Ice_Objects", - "ovl_Bg_Ice_Shelter", - "ovl_Bg_Ice_Shutter", - "ovl_Bg_Ice_Turara", - "ovl_Bg_Ingate", - "ovl_Bg_Jya_1flift", - "ovl_Bg_Jya_Amishutter", - "ovl_Bg_Jya_Bigmirror", - "ovl_Bg_Jya_Block", - "ovl_Bg_Jya_Bombchuiwa", - "ovl_Bg_Jya_Bombiwa", - "ovl_Bg_Jya_Cobra", - "ovl_Bg_Jya_Goroiwa", - "ovl_Bg_Jya_Haheniron", - "ovl_Bg_Jya_Ironobj", - "ovl_Bg_Jya_Kanaami", - "ovl_Bg_Jya_Lift", - "ovl_Bg_Jya_Megami", - "ovl_Bg_Jya_Zurerukabe", - "ovl_Bg_Menkuri_Eye", - "ovl_Bg_Menkuri_Kaiten", - "ovl_Bg_Menkuri_Nisekabe", - "ovl_Bg_Mizu_Bwall", - "ovl_Bg_Mizu_Movebg", - "ovl_Bg_Mizu_Shutter", - "ovl_Bg_Mizu_Uzu", - "ovl_Bg_Mizu_Water", - "ovl_Bg_Mjin", - "ovl_Bg_Mori_Bigst", - "ovl_Bg_Mori_Elevator", - "ovl_Bg_Mori_Hashigo", - "ovl_Bg_Mori_Hashira4", - "ovl_Bg_Mori_Hineri", - "ovl_Bg_Mori_Idomizu", - "ovl_Bg_Mori_Kaitenkabe", - "ovl_Bg_Mori_Rakkatenjo", - "ovl_Bg_Po_Event", - "ovl_Bg_Po_Syokudai", - "ovl_Bg_Pushbox", - "ovl_Bg_Relay_Objects", - "ovl_Bg_Spot00_Break", - "ovl_Bg_Spot00_Hanebasi", - "ovl_Bg_Spot01_Fusya", - "ovl_Bg_Spot01_Idohashira", - "ovl_Bg_Spot01_Idomizu", - "ovl_Bg_Spot01_Idosoko", - "ovl_Bg_Spot01_Objects2", - "ovl_Bg_Spot02_Objects", - "ovl_Bg_Spot03_Taki", - "ovl_Bg_Spot05_Soko", - "ovl_Bg_Spot06_Objects", - "ovl_Bg_Spot07_Taki", - "ovl_Bg_Spot08_Bakudankabe", - "ovl_Bg_Spot08_Iceblock", - "ovl_Bg_Spot09_Obj", - "ovl_Bg_Spot11_Bakudankabe", - "ovl_Bg_Spot11_Oasis", - "ovl_Bg_Spot12_Gate", - "ovl_Bg_Spot12_Saku", - "ovl_Bg_Spot15_Rrbox", - "ovl_Bg_Spot15_Saku", - "ovl_Bg_Spot16_Bombstone", - "ovl_Bg_Spot16_Doughnut", - "ovl_Bg_Spot17_Bakudankabe", - "ovl_Bg_Spot17_Funen", - "ovl_Bg_Spot18_Basket", - "ovl_Bg_Spot18_Futa", - "ovl_Bg_Spot18_Obj", - "ovl_Bg_Spot18_Shutter", - "ovl_Bg_Sst_Floor", - "ovl_Bg_Toki_Hikari", - "ovl_Bg_Toki_Swd", - "ovl_Bg_Treemouth", - "ovl_Bg_Umajump", - "ovl_Bg_Vb_Sima", - "ovl_Bg_Ydan_Hasi", - "ovl_Bg_Ydan_Maruta", - "ovl_Bg_Ydan_Sp", - "ovl_Bg_Zg", - "ovl_Boss_Dodongo", - "ovl_Boss_Fd", - "ovl_Boss_Fd2", - "ovl_Boss_Ganon", - "ovl_Boss_Ganon2", - "ovl_Boss_Ganondrof", - "ovl_Boss_Goma", - "ovl_Boss_Mo", - "ovl_Boss_Sst", - "ovl_Boss_Tw", - "ovl_Boss_Va", - "ovl_Demo_6K", - "ovl_Demo_Du", - "ovl_Demo_Ec", - "ovl_Demo_Effect", - "ovl_Demo_Ext", - "ovl_Demo_Geff", - "ovl_Demo_Gj", - "ovl_Demo_Go", - "ovl_Demo_Gt", - "ovl_Demo_Ik", - "ovl_Demo_Im", - "ovl_Demo_Kankyo", - "ovl_Demo_Kekkai", - "ovl_Demo_Sa", - "ovl_Demo_Shd", - "ovl_Demo_Tre_Lgt", - "ovl_Door_Ana", - "ovl_Door_Gerudo", - "ovl_Door_Killer", - "ovl_Door_Shutter", - "ovl_Door_Toki", - "ovl_Door_Warp1", - "ovl_Efc_Erupc", - "ovl_Eff_Dust", - "ovl_Effect_Ss_Blast", - "ovl_Effect_Ss_Bomb", - "ovl_Effect_Ss_Bomb2", - "ovl_Effect_Ss_Bubble", - "ovl_Effect_Ss_D_Fire", - "ovl_Effect_Ss_Dead_Db", - "ovl_Effect_Ss_Dead_Dd", - "ovl_Effect_Ss_Dead_Ds", - "ovl_Effect_Ss_Dead_Sound", - "ovl_Effect_Ss_Dt_Bubble", - "ovl_Effect_Ss_Dust", - "ovl_Effect_Ss_En_Fire", - "ovl_Effect_Ss_En_Ice", - "ovl_Effect_Ss_Extra", - "ovl_Effect_Ss_Fcircle", - "ovl_Effect_Ss_Fhg_Flash", - "ovl_Effect_Ss_Fire_Tail", - "ovl_Effect_Ss_G_Fire", - "ovl_Effect_Ss_G_Magma", - "ovl_Effect_Ss_G_Magma2", - "ovl_Effect_Ss_G_Ripple", - "ovl_Effect_Ss_G_Spk", - "ovl_Effect_Ss_G_Splash", - "ovl_Effect_Ss_Hahen", - "ovl_Effect_Ss_HitMark", - "ovl_Effect_Ss_Ice_Piece", - "ovl_Effect_Ss_Ice_Smoke", - "ovl_Effect_Ss_K_Fire", - "ovl_Effect_Ss_Kakera", - "ovl_Effect_Ss_KiraKira", - "ovl_Effect_Ss_Lightning", - "ovl_Effect_Ss_Sibuki", - "ovl_Effect_Ss_Sibuki2", - "ovl_Effect_Ss_Solder_Srch_Ball", - "ovl_Effect_Ss_Stick", - "ovl_Effect_Ss_Stone1", - "ovl_Elf_Msg", - "ovl_Elf_Msg2", - "ovl_En_Am", - "ovl_En_Ani", - "ovl_En_Anubice", - "ovl_En_Anubice_Fire", - "ovl_En_Anubice_Tag", - "ovl_En_Arow_Trap", - "ovl_En_Arrow", - "ovl_En_Attack_Niw", - "ovl_En_Ba", - "ovl_En_Bb", - "ovl_En_Bdfire", - "ovl_En_Bigokuta", - "ovl_En_Bili", - "ovl_En_Bird", - "ovl_En_Blkobj", - "ovl_En_Bom", - "ovl_En_Bom_Bowl_Man", - "ovl_En_Bom_Bowl_Pit", - "ovl_En_Bom_Chu", - "ovl_En_Bombf", - "ovl_En_Boom", - "ovl_En_Box", - "ovl_En_Brob", - "ovl_En_Bubble", - "ovl_En_Butte", - "ovl_En_Bw", - "ovl_En_Bx", - "ovl_En_Changer", - "ovl_En_Clear_Tag", - "ovl_En_Cow", - "ovl_En_Crow", - "ovl_En_Cs", - "ovl_En_Daiku", - "ovl_En_Daiku_Kakariko", - "ovl_En_Dekubaba", - "ovl_En_Dekunuts", - "ovl_En_Dh", - "ovl_En_Dha", - "ovl_En_Diving_Game", - "ovl_En_Dns", - "ovl_En_Dnt_Demo", - "ovl_En_Dnt_Jiji", - "ovl_En_Dnt_Nomal", - "ovl_En_Dodojr", - "ovl_En_Dodongo", - "ovl_En_Dog", - "ovl_En_Door", - "ovl_En_Ds", - "ovl_En_Du", - "ovl_En_Dy_Extra", - "ovl_En_Eg", - "ovl_En_Eiyer", - "ovl_En_Elf", - "ovl_En_Encount1", - "ovl_En_Encount2", - "ovl_En_Ex_Item", - "ovl_En_Ex_Ruppy", - "ovl_En_Fd", - "ovl_En_Fd_Fire", - "ovl_En_Fhg_Fire", - "ovl_En_Fire_Rock", - "ovl_En_Firefly", - "ovl_En_Fish", - "ovl_En_Floormas", - "ovl_En_Fr", - "ovl_En_Fu", - "ovl_En_Fw", - "ovl_En_Fz", - "ovl_En_G_Switch", - "ovl_En_Ganon_Mant", - "ovl_En_Ganon_Organ", - "ovl_En_Gb", - "ovl_En_Ge1", - "ovl_En_Ge2", - "ovl_En_Ge3", - "ovl_En_GeldB", - "ovl_En_GirlA", - "ovl_En_Gm", - "ovl_En_Go", - "ovl_En_Go2", - "ovl_En_Goma", - "ovl_En_Goroiwa", - "ovl_En_Gs", - "ovl_En_Guest", - "ovl_En_Hata", - "ovl_En_Heishi1", - "ovl_En_Heishi2", - "ovl_En_Heishi3", - "ovl_En_Heishi4", - "ovl_En_Hintnuts", - "ovl_En_Holl", - "ovl_En_Honotrap", - "ovl_En_Horse", - "ovl_En_Horse_Game_Check", - "ovl_En_Horse_Ganon", - "ovl_En_Horse_Link_Child", - "ovl_En_Horse_Normal", - "ovl_En_Horse_Zelda", - "ovl_En_Hs", - "ovl_En_Hs2", - "ovl_En_Hy", - "ovl_En_Ice_Hono", - "ovl_En_Ik", - "ovl_En_In", - "ovl_En_Insect", - "ovl_En_Ishi", - "ovl_En_It", - "ovl_En_Jj", - "ovl_En_Js", - "ovl_En_Jsjutan", - "ovl_En_Kakasi", - "ovl_En_Kakasi2", - "ovl_En_Kakasi3", - "ovl_En_Kanban", - "ovl_En_Karebaba", - "ovl_En_Ko", - "ovl_En_Kusa", - "ovl_En_Kz", - "ovl_En_Light", - "ovl_En_Lightbox", - "ovl_En_M_Fire1", - "ovl_En_M_Thunder", - "ovl_En_Ma1", - "ovl_En_Ma2", - "ovl_En_Ma3", - "ovl_En_Mag", - "ovl_En_Mb", - "ovl_En_Md", - "ovl_En_Mk", - "ovl_En_Mm", - "ovl_En_Mm2", - "ovl_En_Ms", - "ovl_En_Mu", - "ovl_En_Nb", - "ovl_En_Niw", - "ovl_En_Niw_Girl", - "ovl_En_Niw_Lady", - "ovl_En_Nutsball", - "ovl_En_Nwc", - "ovl_En_Ny", - "ovl_En_OE2", - "ovl_En_Okarina_Effect", - "ovl_En_Okarina_Tag", - "ovl_En_Okuta", - "ovl_En_Ossan", - "ovl_En_Owl", - "ovl_En_Part", - "ovl_En_Peehat", - "ovl_En_Po_Desert", - "ovl_En_Po_Field", - "ovl_En_Po_Relay", - "ovl_En_Po_Sisters", - "ovl_En_Poh", - "ovl_En_Pu_box", - "ovl_En_Rd", - "ovl_En_Reeba", - "ovl_En_River_Sound", - "ovl_En_Rl", - "ovl_En_Rr", - "ovl_En_Ru1", - "ovl_En_Ru2", - "ovl_En_Sa", - "ovl_En_Sb", - "ovl_En_Scene_Change", - "ovl_En_Sda", - "ovl_En_Shopnuts", - "ovl_En_Si", - "ovl_En_Siofuki", - "ovl_En_Skb", - "ovl_En_Skj", - "ovl_En_Skjneedle", - "ovl_En_Ssh", - "ovl_En_St", - "ovl_En_Sth", - "ovl_En_Stream", - "ovl_En_Sw", - "ovl_En_Syateki_Itm", - "ovl_En_Syateki_Man", - "ovl_En_Syateki_Niw", - "ovl_En_Ta", - "ovl_En_Takara_Man", - "ovl_En_Tana", - "ovl_En_Tg", - "ovl_En_Tite", - "ovl_En_Tk", - "ovl_En_Torch", - "ovl_En_Torch2", - "ovl_En_Toryo", - "ovl_En_Tp", - "ovl_En_Tr", - "ovl_En_Trap", - "ovl_En_Tubo_Trap", - "ovl_En_Vali", - "ovl_En_Vase", - "ovl_En_Vb_Ball", - "ovl_En_Viewer", - "ovl_En_Vm", - "ovl_En_Wall_Tubo", - "ovl_En_Wallmas", - "ovl_En_Weather_Tag", - "ovl_En_Weiyer", - "ovl_En_Wf", - "ovl_En_Wonder_Item", - "ovl_En_Wonder_Talk", - "ovl_En_Wonder_Talk2", - "ovl_En_Wood02", - "ovl_En_Xc", - "ovl_En_Yabusame_Mark", - "ovl_En_Yukabyun", - "ovl_En_Zf", - "ovl_En_Zl1", - "ovl_En_Zl2", - "ovl_En_Zl3", - "ovl_En_Zl4", - "ovl_En_Zo", - "ovl_En_fHG", - "ovl_End_Title", - "ovl_Fishing", - "ovl_Item_B_Heart", - "ovl_Item_Etcetera", - "ovl_Item_Inbox", - "ovl_Item_Ocarina", - "ovl_Item_Shield", - "ovl_Magic_Dark", - "ovl_Magic_Fire", - "ovl_Magic_Wind", - "ovl_Mir_Ray", - "ovl_Obj_Bean", - "ovl_Obj_Blockstop", - "ovl_Obj_Bombiwa", - "ovl_Obj_Comb", - "ovl_Obj_Dekujr", - "ovl_Obj_Elevator", - "ovl_Obj_Hamishi", - "ovl_Obj_Hana", - "ovl_Obj_Hsblock", - "ovl_Obj_Ice_Poly", - "ovl_Obj_Kibako", - "ovl_Obj_Kibako2", - "ovl_Obj_Lift", - "ovl_Obj_Lightswitch", - "ovl_Obj_Makekinsuta", - "ovl_Obj_Makeoshihiki", - "ovl_Obj_Mure", - "ovl_Obj_Mure2", - "ovl_Obj_Mure3", - "ovl_Obj_Oshihiki", - "ovl_Obj_Roomtimer", - "ovl_Obj_Switch", - "ovl_Obj_Syokudai", - "ovl_Obj_Timeblock", - "ovl_Obj_Tsubo", - "ovl_Obj_Warp2block", - "ovl_Object_Kankyo", - "ovl_Oceff_Spot", - "ovl_Oceff_Storm", - "ovl_Oceff_Wipe", - "ovl_Oceff_Wipe2", - "ovl_Oceff_Wipe3", - "ovl_Oceff_Wipe4", - "ovl_Shot_Sun", - "gameplay_keep", - "gameplay_field_keep", - "gameplay_dangeon_keep", - "gameplay_object_exchange_static", - "object_link_boy", - "object_link_child", - "object_box", - "object_human", - "object_okuta", - "object_poh", - "object_wallmaster", - "object_dy_obj", - "object_firefly", - "object_dodongo", - "object_fire", - "object_niw", - "object_tite", - "object_reeba", - "object_peehat", - "object_kingdodongo", - "object_horse", - "object_zf", - "object_goma", - "object_zl1", - "object_gol", - "object_bubble", - "object_dodojr", - "object_torch2", - "object_bl", - "object_tp", - "object_oA1", - "object_st", - "object_bw", - "object_ei", - "object_horse_normal", - "object_oB1", - "object_o_anime", - "object_spot04_objects", - "object_ddan_objects", - "object_hidan_objects", - "object_horse_ganon", - "object_oA2", - "object_spot00_objects", - "object_mb", - "object_bombf", - "object_sk2", - "object_oE1", - "object_oE_anime", - "object_oE2", - "object_ydan_objects", - "object_gnd", - "object_am", - "object_dekubaba", - "object_oA3", - "object_oA4", - "object_oA5", - "object_oA6", - "object_oA7", - "object_jj", - "object_oA8", - "object_oA9", - "object_oB2", - "object_oB3", - "object_oB4", - "object_horse_zelda", - "object_opening_demo1", - "object_warp1", - "object_b_heart", - "object_dekunuts", - "object_oE3", - "object_oE4", - "object_menkuri_objects", - "object_oE5", - "object_oE6", - "object_oE7", - "object_oE8", - "object_oE9", - "object_oE10", - "object_oE11", - "object_oE12", - "object_vali", - "object_oA10", - "object_oA11", - "object_mizu_objects", - "object_fhg", - "object_ossan", - "object_mori_hineri1", - "object_Bb", - "object_toki_objects", - "object_yukabyun", - "object_zl2", - "object_mjin", - "object_mjin_flash", - "object_mjin_dark", - "object_mjin_flame", - "object_mjin_ice", - "object_mjin_soul", - "object_mjin_wind", - "object_mjin_oka", - "object_haka_objects", - "object_spot06_objects", - "object_ice_objects", - "object_relay_objects", - "object_mori_hineri1a", - "object_mori_hineri2", - "object_mori_hineri2a", - "object_mori_objects", - "object_mori_tex", - "object_spot08_obj", - "object_warp2", - "object_hata", - "object_bird", - "object_wood02", - "object_lightbox", - "object_pu_box", - "object_trap", - "object_vase", - "object_im", - "object_ta", - "object_tk", - "object_xc", - "object_vm", - "object_bv", - "object_hakach_objects", - "object_efc_crystal_light", - "object_efc_fire_ball", - "object_efc_flash", - "object_efc_lgt_shower", - "object_efc_star_field", - "object_god_lgt", - "object_light_ring", - "object_triforce_spot", - "object_medal", - "object_bdan_objects", - "object_sd", - "object_rd", - "object_po_sisters", - "object_heavy_object", - "object_gndd", - "object_fd", - "object_du", - "object_fw", - "object_horse_link_child", - "object_spot02_objects", - "object_haka", - "object_ru1", - "object_syokudai", - "object_fd2", - "object_dh", - "object_rl", - "object_efc_tw", - "object_demo_tre_lgt", - "object_gi_key", - "object_mir_ray", - "object_brob", - "object_gi_jewel", - "object_spot09_obj", - "object_spot18_obj", - "object_bdoor", - "object_spot17_obj", - "object_shop_dungen", - "object_nb", - "object_mo", - "object_sb", - "object_gi_melody", - "object_gi_heart", - "object_gi_compass", - "object_gi_bosskey", - "object_gi_medal", - "object_gi_nuts", - "object_sa", - "object_gi_hearts", - "object_gi_arrowcase", - "object_gi_bombpouch", - "object_in", - "object_tr", - "object_spot16_obj", - "object_oE1s", - "object_oE4s", - "object_os_anime", - "object_gi_bottle", - "object_gi_stick", - "object_gi_map", - "object_oF1d_map", - "object_ru2", - "object_gi_shield_1", - "object_dekujr", - "object_gi_magicpot", - "object_gi_bomb_1", - "object_oF1s", - "object_ma2", - "object_gi_purse", - "object_hni", - "object_tw", - "object_rr", - "object_bxa", - "object_anubice", - "object_gi_gerudo", - "object_gi_arrow", - "object_gi_bomb_2", - "object_gi_egg", - "object_gi_scale", - "object_gi_shield_2", - "object_gi_hookshot", - "object_gi_ocarina", - "object_gi_milk", - "object_ma1", - "object_ganon", - "object_sst", - "object_ny", - "object_fr", - "object_gi_pachinko", - "object_gi_boomerang", - "object_gi_bow", - "object_gi_glasses", - "object_gi_liquid", - "object_ani", - "object_demo_6k", - "object_gi_shield_3", - "object_gi_letter", - "object_spot15_obj", - "object_jya_obj", - "object_gi_clothes", - "object_gi_bean", - "object_gi_fish", - "object_gi_saw", - "object_gi_hammer", - "object_gi_grass", - "object_gi_longsword", - "object_spot01_objects", - "object_md", - "object_km1", - "object_kw1", - "object_zo", - "object_kz", - "object_umajump", - "object_masterkokiri", - "object_masterkokirihead", - "object_mastergolon", - "object_masterzoora", - "object_aob", - "object_ik", - "object_ahg", - "object_cne", - "object_gi_niwatori", - "object_skj", - "object_gi_bottle_letter", - "object_bji", - "object_bba", - "object_gi_ocarina_0", - "object_ds", - "object_ane", - "object_boj", - "object_spot03_object", - "object_spot07_object", - "object_fz", - "object_bob", - "object_ge1", - "object_yabusame_point", - "object_gi_boots_2", - "object_gi_seed", - "object_gnd_magic", - "object_d_elevator", - "object_d_hsblock", - "object_d_lift", - "object_mamenoki", - "object_goroiwa", - "object_toryo", - "object_daiku", - "object_nwc", - "object_blkobj", - "object_gm", - "object_ms", - "object_hs", - "object_ingate", - "object_lightswitch", - "object_kusa", - "object_tsubo", - "object_gi_gloves", - "object_gi_coin", - "object_kanban", - "object_gjyo_objects", - "object_owl", - "object_mk", - "object_fu", - "object_gi_ki_tan_mask", - "object_gi_redead_mask", - "object_gi_skj_mask", - "object_gi_rabit_mask", - "object_gi_truth_mask", - "object_ganon_objects", - "object_siofuki", - "object_stream", - "object_mm", - "object_fa", - "object_os", - "object_gi_eye_lotion", - "object_gi_powder", - "object_gi_mushroom", - "object_gi_ticketstone", - "object_gi_brokensword", - "object_js", - "object_cs", - "object_gi_prescription", - "object_gi_bracelet", - "object_gi_soldout", - "object_gi_frog", - "object_mag", - "object_door_gerudo", - "object_gt", - "object_efc_erupc", - "object_zl2_anime1", - "object_zl2_anime2", - "object_gi_golonmask", - "object_gi_zoramask", - "object_gi_gerudomask", - "object_ganon2", - "object_ka", - "object_ts", - "object_zg", - "object_gi_hoverboots", - "object_gi_m_arrow", - "object_ds2", - "object_ec", - "object_fish", - "object_gi_sutaru", - "object_gi_goddess", - "object_ssh", - "object_bigokuta", - "object_bg", - "object_spot05_objects", - "object_spot12_obj", - "object_bombiwa", - "object_hintnuts", - "object_rs", - "object_spot00_break", - "object_gla", - "object_shopnuts", - "object_geldb", - "object_gr", - "object_dog", - "object_jya_iron", - "object_jya_door", - "object_spot01_objects2", - "object_spot11_obj", - "object_kibako2", - "object_dns", - "object_dnk", - "object_gi_fire", - "object_gi_insect", - "object_gi_butterfly", - "object_gi_ghost", - "object_gi_soul", - "object_bowl", - "object_po_field", - "object_demo_kekkai", - "object_efc_doughnut", - "object_gi_dekupouch", - "object_ganon_anime1", - "object_ganon_anime2", - "object_ganon_anime3", - "object_gi_rupy", - "object_spot01_matoya", - "object_spot01_matoyab", - "object_po_composer", - "object_mu", - "object_wf", - "object_skb", - "object_gj", - "object_geff", - "object_haka_door", - "object_gs", - "object_ps", - "object_bwall", - "object_crow", - "object_cow", - "object_cob", - "object_gi_sword_1", - "object_door_killer", - "object_ouke_haka", - "object_timeblock", - "object_zl4", - "g_pn_01", - "g_pn_02", - "g_pn_03", - "g_pn_04", - "g_pn_05", - "g_pn_06", - "g_pn_07", - "g_pn_08", - "g_pn_09", - "g_pn_10", - "g_pn_11", - "g_pn_12", - "g_pn_13", - "g_pn_14", - "g_pn_15", - "g_pn_16", - "g_pn_17", - "g_pn_18", - "g_pn_19", - "g_pn_20", - "g_pn_21", - "g_pn_22", - "g_pn_23", - "g_pn_24", - "g_pn_25", - "g_pn_26", - "g_pn_27", - "g_pn_28", - "g_pn_29", - "g_pn_30", - "g_pn_31", - "g_pn_32", - "g_pn_33", - "g_pn_34", - "g_pn_35", - "g_pn_36", - "g_pn_37", - "g_pn_38", - "g_pn_39", - "g_pn_40", - "g_pn_41", - "g_pn_42", - "g_pn_43", - "g_pn_44", - "g_pn_45", - "g_pn_46", - "g_pn_47", - "g_pn_48", - "g_pn_49", - "g_pn_50", - "g_pn_51", - "g_pn_52", - "g_pn_53", - "g_pn_54", - "g_pn_55", - "g_pn_56", - "g_pn_57", - "z_select_static", - "nintendo_rogo_static", - "title_static", - "parameter_static", - "vr_fine0_static", - "vr_fine0_pal_static", - "vr_fine1_static", - "vr_fine1_pal_static", - "vr_fine2_static", - "vr_fine2_pal_static", - "vr_fine3_static", - "vr_fine3_pal_static", - "vr_cloud0_static", - "vr_cloud0_pal_static", - "vr_cloud1_static", - "vr_cloud1_pal_static", - "vr_cloud2_static", - "vr_cloud2_pal_static", - "vr_cloud3_static", - "vr_cloud3_pal_static", - "vr_holy0_static", - "vr_holy0_pal_static", - "vr_holy1_static", - "vr_holy1_pal_static", - "vr_MDVR_static", - "vr_MDVR_pal_static", - "vr_MNVR_static", - "vr_MNVR_pal_static", - "vr_RUVR_static", - "vr_RUVR_pal_static", - "vr_LHVR_static", - "vr_LHVR_pal_static", - "vr_KHVR_static", - "vr_KHVR_pal_static", - "vr_K3VR_static", - "vr_K3VR_pal_static", - "vr_K4VR_static", - "vr_K4VR_pal_static", - "vr_K5VR_static", - "vr_K5VR_pal_static", - "vr_SP1a_static", - "vr_SP1a_pal_static", - "vr_MLVR_static", - "vr_MLVR_pal_static", - "vr_KKRVR_static", - "vr_KKRVR_pal_static", - "vr_KR3VR_static", - "vr_KR3VR_pal_static", - "vr_IPVR_static", - "vr_IPVR_pal_static", - "vr_KSVR_static", - "vr_KSVR_pal_static", - "vr_GLVR_static", - "vr_GLVR_pal_static", - "vr_ZRVR_static", - "vr_ZRVR_pal_static", - "vr_DGVR_static", - "vr_DGVR_pal_static", - "vr_ALVR_static", - "vr_ALVR_pal_static", - "vr_NSVR_static", - "vr_NSVR_pal_static", - "vr_LBVR_static", - "vr_LBVR_pal_static", - "vr_TTVR_static", - "vr_TTVR_pal_static", - "vr_FCVR_static", - "vr_FCVR_pal_static", - "elf_message_field", - "elf_message_ydan", - "syotes_scene", - "syotes_room_0", - "syotes2_scene", - "syotes2_room_0", - "depth_test_scene", - "depth_test_room_0", - "spot00_scene", - "spot00_room_0", - "spot01_scene", - "spot01_room_0", - "spot02_scene", - "spot02_room_0", - "spot02_room_1", - "spot03_scene", - "spot03_room_0", - "spot03_room_1", - "spot04_scene", - "spot04_room_0", - "spot04_room_1", - "spot04_room_2", - "spot05_scene", - "spot05_room_0", - "spot06_scene", - "spot06_room_0", - "spot07_scene", - "spot07_room_0", - "spot07_room_1", - "spot08_scene", - "spot08_room_0", - "spot09_scene", - "spot09_room_0", - "spot10_scene", - "spot10_room_0", - "spot10_room_1", - "spot10_room_2", - "spot10_room_3", - "spot10_room_4", - "spot10_room_5", - "spot10_room_6", - "spot10_room_7", - "spot10_room_8", - "spot10_room_9", - "spot11_scene", - "spot11_room_0", - "spot12_scene", - "spot12_room_0", - "spot12_room_1", - "spot13_scene", - "spot13_room_0", - "spot13_room_1", - "spot15_scene", - "spot15_room_0", - "spot16_scene", - "spot16_room_0", - "spot17_scene", - "spot17_room_0", - "spot17_room_1", - "spot18_scene", - "spot18_room_0", - "spot18_room_1", - "spot18_room_2", - "spot18_room_3", - "ydan_scene", - "ydan_room_0", - "ydan_room_1", - "ydan_room_2", - "ydan_room_3", - "ydan_room_4", - "ydan_room_5", - "ydan_room_6", - "ydan_room_7", - "ydan_room_8", - "ydan_room_9", - "ydan_room_10", - "ydan_room_11", - "ddan_scene", - "ddan_room_0", - "ddan_room_1", - "ddan_room_2", - "ddan_room_3", - "ddan_room_4", - "ddan_room_5", - "ddan_room_6", - "ddan_room_7", - "ddan_room_8", - "ddan_room_9", - "ddan_room_10", - "ddan_room_11", - "ddan_room_12", - "ddan_room_13", - "ddan_room_14", - "ddan_room_15", - "ddan_room_16", - "bdan_scene", - "bdan_room_0", - "bdan_room_1", - "bdan_room_2", - "bdan_room_3", - "bdan_room_4", - "bdan_room_5", - "bdan_room_6", - "bdan_room_7", - "bdan_room_8", - "bdan_room_9", - "bdan_room_10", - "bdan_room_11", - "bdan_room_12", - "bdan_room_13", - "bdan_room_14", - "bdan_room_15", - "Bmori1_scene", - "Bmori1_room_0", - "Bmori1_room_1", - "Bmori1_room_2", - "Bmori1_room_3", - "Bmori1_room_4", - "Bmori1_room_5", - "Bmori1_room_6", - "Bmori1_room_7", - "Bmori1_room_8", - "Bmori1_room_9", - "Bmori1_room_10", - "Bmori1_room_11", - "Bmori1_room_12", - "Bmori1_room_13", - "Bmori1_room_14", - "Bmori1_room_15", - "Bmori1_room_16", - "Bmori1_room_17", - "Bmori1_room_18", - "Bmori1_room_19", - "Bmori1_room_20", - "Bmori1_room_21", - "Bmori1_room_22", - "HIDAN_scene", - "HIDAN_room_0", - "HIDAN_room_1", - "HIDAN_room_2", - "HIDAN_room_3", - "HIDAN_room_4", - "HIDAN_room_5", - "HIDAN_room_6", - "HIDAN_room_7", - "HIDAN_room_8", - "HIDAN_room_9", - "HIDAN_room_10", - "HIDAN_room_11", - "HIDAN_room_12", - "HIDAN_room_13", - "HIDAN_room_14", - "HIDAN_room_15", - "HIDAN_room_16", - "HIDAN_room_17", - "HIDAN_room_18", - "HIDAN_room_19", - "HIDAN_room_20", - "HIDAN_room_21", - "HIDAN_room_22", - "HIDAN_room_23", - "HIDAN_room_24", - "HIDAN_room_25", - "HIDAN_room_26", - "MIZUsin_scene", - "MIZUsin_room_0", - "MIZUsin_room_1", - "MIZUsin_room_2", - "MIZUsin_room_3", - "MIZUsin_room_4", - "MIZUsin_room_5", - "MIZUsin_room_6", - "MIZUsin_room_7", - "MIZUsin_room_8", - "MIZUsin_room_9", - "MIZUsin_room_10", - "MIZUsin_room_11", - "MIZUsin_room_12", - "MIZUsin_room_13", - "MIZUsin_room_14", - "MIZUsin_room_15", - "MIZUsin_room_16", - "MIZUsin_room_17", - "MIZUsin_room_18", - "MIZUsin_room_19", - "MIZUsin_room_20", - "MIZUsin_room_21", - "MIZUsin_room_22", - "jyasinzou_scene", - "jyasinzou_room_0", - "jyasinzou_room_1", - "jyasinzou_room_2", - "jyasinzou_room_3", - "jyasinzou_room_4", - "jyasinzou_room_5", - "jyasinzou_room_6", - "jyasinzou_room_7", - "jyasinzou_room_8", - "jyasinzou_room_9", - "jyasinzou_room_10", - "jyasinzou_room_11", - "jyasinzou_room_12", - "jyasinzou_room_13", - "jyasinzou_room_14", - "jyasinzou_room_15", - "jyasinzou_room_16", - "jyasinzou_room_17", - "jyasinzou_room_18", - "jyasinzou_room_19", - "jyasinzou_room_20", - "jyasinzou_room_21", - "jyasinzou_room_22", - "jyasinzou_room_23", - "jyasinzou_room_24", - "jyasinzou_room_25", - "jyasinzou_room_26", - "jyasinzou_room_27", - "jyasinzou_room_28", - "HAKAdan_scene", - "HAKAdan_room_0", - "HAKAdan_room_1", - "HAKAdan_room_2", - "HAKAdan_room_3", - "HAKAdan_room_4", - "HAKAdan_room_5", - "HAKAdan_room_6", - "HAKAdan_room_7", - "HAKAdan_room_8", - "HAKAdan_room_9", - "HAKAdan_room_10", - "HAKAdan_room_11", - "HAKAdan_room_12", - "HAKAdan_room_13", - "HAKAdan_room_14", - "HAKAdan_room_15", - "HAKAdan_room_16", - "HAKAdan_room_17", - "HAKAdan_room_18", - "HAKAdan_room_19", - "HAKAdan_room_20", - "HAKAdan_room_21", - "HAKAdan_room_22", - "HAKAdanCH_scene", - "HAKAdanCH_room_0", - "HAKAdanCH_room_1", - "HAKAdanCH_room_2", - "HAKAdanCH_room_3", - "HAKAdanCH_room_4", - "HAKAdanCH_room_5", - "HAKAdanCH_room_6", - "ice_doukutu_scene", - "ice_doukutu_room_0", - "ice_doukutu_room_1", - "ice_doukutu_room_2", - "ice_doukutu_room_3", - "ice_doukutu_room_4", - "ice_doukutu_room_5", - "ice_doukutu_room_6", - "ice_doukutu_room_7", - "ice_doukutu_room_8", - "ice_doukutu_room_9", - "ice_doukutu_room_10", - "ice_doukutu_room_11", - "men_scene", - "men_room_0", - "men_room_1", - "men_room_2", - "men_room_3", - "men_room_4", - "men_room_5", - "men_room_6", - "men_room_7", - "men_room_8", - "men_room_9", - "men_room_10", - "ganontika_scene", - "ganontika_room_0", - "ganontika_room_1", - "ganontika_room_2", - "ganontika_room_3", - "ganontika_room_4", - "ganontika_room_5", - "ganontika_room_6", - "ganontika_room_7", - "ganontika_room_8", - "ganontika_room_9", - "ganontika_room_10", - "ganontika_room_11", - "ganontika_room_12", - "ganontika_room_13", - "ganontika_room_14", - "ganontika_room_15", - "ganontika_room_16", - "ganontika_room_17", - "ganontika_room_18", - "ganontika_room_19", - "market_day_scene", - "market_day_room_0", - "market_night_scene", - "market_night_room_0", - "testroom_scene", - "testroom_room_0", - "testroom_room_1", - "testroom_room_2", - "testroom_room_3", - "testroom_room_4", - "kenjyanoma_scene", - "kenjyanoma_room_0", - "tokinoma_scene", - "tokinoma_room_0", - "tokinoma_room_1", - "sutaru_scene", - "sutaru_room_0", - "link_home_scene", - "link_home_room_0", - "kokiri_shop_scene", - "kokiri_shop_room_0", - "kokiri_home_scene", - "kokiri_home_room_0", - "kakusiana_scene", - "kakusiana_room_0", - "kakusiana_room_1", - "kakusiana_room_2", - "kakusiana_room_3", - "kakusiana_room_4", - "kakusiana_room_5", - "kakusiana_room_6", - "kakusiana_room_7", - "kakusiana_room_8", - "kakusiana_room_9", - "kakusiana_room_10", - "kakusiana_room_11", - "kakusiana_room_12", - "kakusiana_room_13", - "entra_scene", - "entra_room_0", - "moribossroom_scene", - "moribossroom_room_0", - "moribossroom_room_1", - "syatekijyou_scene", - "syatekijyou_room_0", - "shop1_scene", - "shop1_room_0", - "hairal_niwa_scene", - "hairal_niwa_room_0", - "ganon_tou_scene", - "ganon_tou_room_0", - "sasatest_scene", - "sasatest_room_0", - "market_alley_scene", - "market_alley_room_0", - "spot20_scene", - "spot20_room_0", - "market_ruins_scene", - "market_ruins_room_0", - "entra_n_scene", - "entra_n_room_0", - "enrui_scene", - "enrui_room_0", - "market_alley_n_scene", - "market_alley_n_room_0", - "hiral_demo_scene", - "hiral_demo_room_0", - "kokiri_home3_scene", - "kokiri_home3_room_0", - "malon_stable_scene", - "malon_stable_room_0", - "kakariko_scene", - "kakariko_room_0", - "bdan_boss_scene", - "bdan_boss_room_0", - "bdan_boss_room_1", - "FIRE_bs_scene", - "FIRE_bs_room_0", - "FIRE_bs_room_1", - "hut_scene", - "hut_room_0", - "daiyousei_izumi_scene", - "daiyousei_izumi_room_0", - "hakaana_scene", - "hakaana_room_0", - "yousei_izumi_tate_scene", - "yousei_izumi_tate_room_0", - "yousei_izumi_yoko_scene", - "yousei_izumi_yoko_room_0", - "golon_scene", - "golon_room_0", - "zoora_scene", - "zoora_room_0", - "drag_scene", - "drag_room_0", - "alley_shop_scene", - "alley_shop_room_0", - "night_shop_scene", - "night_shop_room_0", - "impa_scene", - "impa_room_0", - "labo_scene", - "labo_room_0", - "tent_scene", - "tent_room_0", - "nakaniwa_scene", - "nakaniwa_room_0", - "ddan_boss_scene", - "ddan_boss_room_0", - "ddan_boss_room_1", - "ydan_boss_scene", - "ydan_boss_room_0", - "ydan_boss_room_1", - "HAKAdan_bs_scene", - "HAKAdan_bs_room_0", - "HAKAdan_bs_room_1", - "MIZUsin_bs_scene", - "MIZUsin_bs_room_0", - "MIZUsin_bs_room_1", - "ganon_scene", - "ganon_room_0", - "ganon_room_1", - "ganon_room_2", - "ganon_room_3", - "ganon_room_4", - "ganon_room_5", - "ganon_room_6", - "ganon_room_7", - "ganon_room_8", - "ganon_room_9", - "ganon_boss_scene", - "ganon_boss_room_0", - "jyasinboss_scene", - "jyasinboss_room_0", - "jyasinboss_room_1", - "jyasinboss_room_2", - "jyasinboss_room_3", - "kokiri_home4_scene", - "kokiri_home4_room_0", - "kokiri_home5_scene", - "kokiri_home5_room_0", - "ganon_final_scene", - "ganon_final_room_0", - "kakariko3_scene", - "kakariko3_room_0", - "hairal_niwa2_scene", - "hairal_niwa2_room_0", - "hakasitarelay_scene", - "hakasitarelay_room_0", - "hakasitarelay_room_1", - "hakasitarelay_room_2", - "hakasitarelay_room_3", - "hakasitarelay_room_4", - "hakasitarelay_room_5", - "hakasitarelay_room_6", - "shrine_scene", - "shrine_room_0", - "turibori_scene", - "turibori_room_0", - "shrine_n_scene", - "shrine_n_room_0", - "shrine_r_scene", - "shrine_r_room_0", - "hakaana2_scene", - "hakaana2_room_0", - "gerudoway_scene", - "gerudoway_room_0", - "gerudoway_room_1", - "gerudoway_room_2", - "gerudoway_room_3", - "gerudoway_room_4", - "gerudoway_room_5", - "hairal_niwa_n_scene", - "hairal_niwa_n_room_0", - "bowling_scene", - "bowling_room_0", - "hakaana_ouke_scene", - "hakaana_ouke_room_0", - "hakaana_ouke_room_1", - "hakaana_ouke_room_2", - "hylia_labo_scene", - "hylia_labo_room_0", - "souko_scene", - "souko_room_0", - "souko_room_1", - "souko_room_2", - "miharigoya_scene", - "miharigoya_room_0", - "mahouya_scene", - "mahouya_room_0", - "takaraya_scene", - "takaraya_room_0", - "takaraya_room_1", - "takaraya_room_2", - "takaraya_room_3", - "takaraya_room_4", - "takaraya_room_5", - "takaraya_room_6", - "ganon_sonogo_scene", - "ganon_sonogo_room_0", - "ganon_sonogo_room_1", - "ganon_sonogo_room_2", - "ganon_sonogo_room_3", - "ganon_sonogo_room_4", - "ganon_demo_scene", - "ganon_demo_room_0", - "besitu_scene", - "besitu_room_0", - "face_shop_scene", - "face_shop_room_0", - "kinsuta_scene", - "kinsuta_room_0", - "ganontikasonogo_scene", - "ganontikasonogo_room_0", - "ganontikasonogo_room_1", - "test01_scene", - "test01_room_0", - "bump_texture_static", - "anime_model_1_static", - "anime_model_2_static", - "anime_model_3_static", - "anime_model_4_static", - "anime_model_5_static", - "anime_model_6_static", - "anime_texture_1_static", - "anime_texture_2_static", - "anime_texture_3_static", - "anime_texture_4_static", - "anime_texture_5_static", - "anime_texture_6_static", +const char* sDmaMgrFileNames[0x5FC] = { + "makerom", + "boot", + "dmadata", + "Audiobank", + "Audioseq", + "Audiotable", + "link_animetion", + "icon_item_static", + "icon_item_24_static", + "icon_item_field_static", + "icon_item_dungeon_static", + "icon_item_gameover_static", + "icon_item_nes_static", + "icon_item_ger_static", + "icon_item_fra_static", + "item_name_static", + "map_name_static", + "do_action_static", + "message_static", + "message_texture_static", + "nes_font_static", + "nes_message_data_static", + "ger_message_data_static", + "fra_message_data_static", + "staff_message_data_static", + "map_grand_static", + "map_i_static", + "map_48x85_static", + "code", + "ovl_title", + "ovl_select", + "ovl_opening", + "ovl_file_choose", + "ovl_kaleido_scope", + "ovl_player_actor", + "ovl_map_mark_data", + "ovl_En_Test", + "ovl_Arms_Hook", + "ovl_Arrow_Fire", + "ovl_Arrow_Ice", + "ovl_Arrow_Light", + "ovl_Bg_Bdan_Objects", + "ovl_Bg_Bdan_Switch", + "ovl_Bg_Bom_Guard", + "ovl_Bg_Bombwall", + "ovl_Bg_Bowl_Wall", + "ovl_Bg_Breakwall", + "ovl_Bg_Ddan_Jd", + "ovl_Bg_Ddan_Kd", + "ovl_Bg_Dodoago", + "ovl_Bg_Dy_Yoseizo", + "ovl_Bg_Ganon_Otyuka", + "ovl_Bg_Gate_Shutter", + "ovl_Bg_Gjyo_Bridge", + "ovl_Bg_Gnd_Darkmeiro", + "ovl_Bg_Gnd_Firemeiro", + "ovl_Bg_Gnd_Iceblock", + "ovl_Bg_Gnd_Nisekabe", + "ovl_Bg_Gnd_Soulmeiro", + "ovl_Bg_Haka", + "ovl_Bg_Haka_Gate", + "ovl_Bg_Haka_Huta", + "ovl_Bg_Haka_Megane", + "ovl_Bg_Haka_MeganeBG", + "ovl_Bg_Haka_Sgami", + "ovl_Bg_Haka_Ship", + "ovl_Bg_Haka_Trap", + "ovl_Bg_Haka_Tubo", + "ovl_Bg_Haka_Water", + "ovl_Bg_Haka_Zou", + "ovl_Bg_Heavy_Block", + "ovl_Bg_Hidan_Curtain", + "ovl_Bg_Hidan_Dalm", + "ovl_Bg_Hidan_Firewall", + "ovl_Bg_Hidan_Fslift", + "ovl_Bg_Hidan_Fwbig", + "ovl_Bg_Hidan_Hamstep", + "ovl_Bg_Hidan_Hrock", + "ovl_Bg_Hidan_Kousi", + "ovl_Bg_Hidan_Kowarerukabe", + "ovl_Bg_Hidan_Rock", + "ovl_Bg_Hidan_Rsekizou", + "ovl_Bg_Hidan_Sekizou", + "ovl_Bg_Hidan_Sima", + "ovl_Bg_Hidan_Syoku", + "ovl_Bg_Ice_Objects", + "ovl_Bg_Ice_Shelter", + "ovl_Bg_Ice_Shutter", + "ovl_Bg_Ice_Turara", + "ovl_Bg_Ingate", + "ovl_Bg_Jya_1flift", + "ovl_Bg_Jya_Amishutter", + "ovl_Bg_Jya_Bigmirror", + "ovl_Bg_Jya_Block", + "ovl_Bg_Jya_Bombchuiwa", + "ovl_Bg_Jya_Bombiwa", + "ovl_Bg_Jya_Cobra", + "ovl_Bg_Jya_Goroiwa", + "ovl_Bg_Jya_Haheniron", + "ovl_Bg_Jya_Ironobj", + "ovl_Bg_Jya_Kanaami", + "ovl_Bg_Jya_Lift", + "ovl_Bg_Jya_Megami", + "ovl_Bg_Jya_Zurerukabe", + "ovl_Bg_Menkuri_Eye", + "ovl_Bg_Menkuri_Kaiten", + "ovl_Bg_Menkuri_Nisekabe", + "ovl_Bg_Mizu_Bwall", + "ovl_Bg_Mizu_Movebg", + "ovl_Bg_Mizu_Shutter", + "ovl_Bg_Mizu_Uzu", + "ovl_Bg_Mizu_Water", + "ovl_Bg_Mjin", + "ovl_Bg_Mori_Bigst", + "ovl_Bg_Mori_Elevator", + "ovl_Bg_Mori_Hashigo", + "ovl_Bg_Mori_Hashira4", + "ovl_Bg_Mori_Hineri", + "ovl_Bg_Mori_Idomizu", + "ovl_Bg_Mori_Kaitenkabe", + "ovl_Bg_Mori_Rakkatenjo", + "ovl_Bg_Po_Event", + "ovl_Bg_Po_Syokudai", + "ovl_Bg_Pushbox", + "ovl_Bg_Relay_Objects", + "ovl_Bg_Spot00_Break", + "ovl_Bg_Spot00_Hanebasi", + "ovl_Bg_Spot01_Fusya", + "ovl_Bg_Spot01_Idohashira", + "ovl_Bg_Spot01_Idomizu", + "ovl_Bg_Spot01_Idosoko", + "ovl_Bg_Spot01_Objects2", + "ovl_Bg_Spot02_Objects", + "ovl_Bg_Spot03_Taki", + "ovl_Bg_Spot05_Soko", + "ovl_Bg_Spot06_Objects", + "ovl_Bg_Spot07_Taki", + "ovl_Bg_Spot08_Bakudankabe", + "ovl_Bg_Spot08_Iceblock", + "ovl_Bg_Spot09_Obj", + "ovl_Bg_Spot11_Bakudankabe", + "ovl_Bg_Spot11_Oasis", + "ovl_Bg_Spot12_Gate", + "ovl_Bg_Spot12_Saku", + "ovl_Bg_Spot15_Rrbox", + "ovl_Bg_Spot15_Saku", + "ovl_Bg_Spot16_Bombstone", + "ovl_Bg_Spot16_Doughnut", + "ovl_Bg_Spot17_Bakudankabe", + "ovl_Bg_Spot17_Funen", + "ovl_Bg_Spot18_Basket", + "ovl_Bg_Spot18_Futa", + "ovl_Bg_Spot18_Obj", + "ovl_Bg_Spot18_Shutter", + "ovl_Bg_Sst_Floor", + "ovl_Bg_Toki_Hikari", + "ovl_Bg_Toki_Swd", + "ovl_Bg_Treemouth", + "ovl_Bg_Umajump", + "ovl_Bg_Vb_Sima", + "ovl_Bg_Ydan_Hasi", + "ovl_Bg_Ydan_Maruta", + "ovl_Bg_Ydan_Sp", + "ovl_Bg_Zg", + "ovl_Boss_Dodongo", + "ovl_Boss_Fd", + "ovl_Boss_Fd2", + "ovl_Boss_Ganon", + "ovl_Boss_Ganon2", + "ovl_Boss_Ganondrof", + "ovl_Boss_Goma", + "ovl_Boss_Mo", + "ovl_Boss_Sst", + "ovl_Boss_Tw", + "ovl_Boss_Va", + "ovl_Demo_6K", + "ovl_Demo_Du", + "ovl_Demo_Ec", + "ovl_Demo_Effect", + "ovl_Demo_Ext", + "ovl_Demo_Geff", + "ovl_Demo_Gj", + "ovl_Demo_Go", + "ovl_Demo_Gt", + "ovl_Demo_Ik", + "ovl_Demo_Im", + "ovl_Demo_Kankyo", + "ovl_Demo_Kekkai", + "ovl_Demo_Sa", + "ovl_Demo_Shd", + "ovl_Demo_Tre_Lgt", + "ovl_Door_Ana", + "ovl_Door_Gerudo", + "ovl_Door_Killer", + "ovl_Door_Shutter", + "ovl_Door_Toki", + "ovl_Door_Warp1", + "ovl_Efc_Erupc", + "ovl_Eff_Dust", + "ovl_Effect_Ss_Blast", + "ovl_Effect_Ss_Bomb", + "ovl_Effect_Ss_Bomb2", + "ovl_Effect_Ss_Bubble", + "ovl_Effect_Ss_D_Fire", + "ovl_Effect_Ss_Dead_Db", + "ovl_Effect_Ss_Dead_Dd", + "ovl_Effect_Ss_Dead_Ds", + "ovl_Effect_Ss_Dead_Sound", + "ovl_Effect_Ss_Dt_Bubble", + "ovl_Effect_Ss_Dust", + "ovl_Effect_Ss_En_Fire", + "ovl_Effect_Ss_En_Ice", + "ovl_Effect_Ss_Extra", + "ovl_Effect_Ss_Fcircle", + "ovl_Effect_Ss_Fhg_Flash", + "ovl_Effect_Ss_Fire_Tail", + "ovl_Effect_Ss_G_Fire", + "ovl_Effect_Ss_G_Magma", + "ovl_Effect_Ss_G_Magma2", + "ovl_Effect_Ss_G_Ripple", + "ovl_Effect_Ss_G_Spk", + "ovl_Effect_Ss_G_Splash", + "ovl_Effect_Ss_Hahen", + "ovl_Effect_Ss_HitMark", + "ovl_Effect_Ss_Ice_Piece", + "ovl_Effect_Ss_Ice_Smoke", + "ovl_Effect_Ss_K_Fire", + "ovl_Effect_Ss_Kakera", + "ovl_Effect_Ss_KiraKira", + "ovl_Effect_Ss_Lightning", + "ovl_Effect_Ss_Sibuki", + "ovl_Effect_Ss_Sibuki2", + "ovl_Effect_Ss_Solder_Srch_Ball", + "ovl_Effect_Ss_Stick", + "ovl_Effect_Ss_Stone1", + "ovl_Elf_Msg", + "ovl_Elf_Msg2", + "ovl_En_Am", + "ovl_En_Ani", + "ovl_En_Anubice", + "ovl_En_Anubice_Fire", + "ovl_En_Anubice_Tag", + "ovl_En_Arow_Trap", + "ovl_En_Arrow", + "ovl_En_Attack_Niw", + "ovl_En_Ba", + "ovl_En_Bb", + "ovl_En_Bdfire", + "ovl_En_Bigokuta", + "ovl_En_Bili", + "ovl_En_Bird", + "ovl_En_Blkobj", + "ovl_En_Bom", + "ovl_En_Bom_Bowl_Man", + "ovl_En_Bom_Bowl_Pit", + "ovl_En_Bom_Chu", + "ovl_En_Bombf", + "ovl_En_Boom", + "ovl_En_Box", + "ovl_En_Brob", + "ovl_En_Bubble", + "ovl_En_Butte", + "ovl_En_Bw", + "ovl_En_Bx", + "ovl_En_Changer", + "ovl_En_Clear_Tag", + "ovl_En_Cow", + "ovl_En_Crow", + "ovl_En_Cs", + "ovl_En_Daiku", + "ovl_En_Daiku_Kakariko", + "ovl_En_Dekubaba", + "ovl_En_Dekunuts", + "ovl_En_Dh", + "ovl_En_Dha", + "ovl_En_Diving_Game", + "ovl_En_Dns", + "ovl_En_Dnt_Demo", + "ovl_En_Dnt_Jiji", + "ovl_En_Dnt_Nomal", + "ovl_En_Dodojr", + "ovl_En_Dodongo", + "ovl_En_Dog", + "ovl_En_Door", + "ovl_En_Ds", + "ovl_En_Du", + "ovl_En_Dy_Extra", + "ovl_En_Eg", + "ovl_En_Eiyer", + "ovl_En_Elf", + "ovl_En_Encount1", + "ovl_En_Encount2", + "ovl_En_Ex_Item", + "ovl_En_Ex_Ruppy", + "ovl_En_Fd", + "ovl_En_Fd_Fire", + "ovl_En_Fhg_Fire", + "ovl_En_Fire_Rock", + "ovl_En_Firefly", + "ovl_En_Fish", + "ovl_En_Floormas", + "ovl_En_Fr", + "ovl_En_Fu", + "ovl_En_Fw", + "ovl_En_Fz", + "ovl_En_G_Switch", + "ovl_En_Ganon_Mant", + "ovl_En_Ganon_Organ", + "ovl_En_Gb", + "ovl_En_Ge1", + "ovl_En_Ge2", + "ovl_En_Ge3", + "ovl_En_GeldB", + "ovl_En_GirlA", + "ovl_En_Gm", + "ovl_En_Go", + "ovl_En_Go2", + "ovl_En_Goma", + "ovl_En_Goroiwa", + "ovl_En_Gs", + "ovl_En_Guest", + "ovl_En_Hata", + "ovl_En_Heishi1", + "ovl_En_Heishi2", + "ovl_En_Heishi3", + "ovl_En_Heishi4", + "ovl_En_Hintnuts", + "ovl_En_Holl", + "ovl_En_Honotrap", + "ovl_En_Horse", + "ovl_En_Horse_Game_Check", + "ovl_En_Horse_Ganon", + "ovl_En_Horse_Link_Child", + "ovl_En_Horse_Normal", + "ovl_En_Horse_Zelda", + "ovl_En_Hs", + "ovl_En_Hs2", + "ovl_En_Hy", + "ovl_En_Ice_Hono", + "ovl_En_Ik", + "ovl_En_In", + "ovl_En_Insect", + "ovl_En_Ishi", + "ovl_En_It", + "ovl_En_Jj", + "ovl_En_Js", + "ovl_En_Jsjutan", + "ovl_En_Kakasi", + "ovl_En_Kakasi2", + "ovl_En_Kakasi3", + "ovl_En_Kanban", + "ovl_En_Karebaba", + "ovl_En_Ko", + "ovl_En_Kusa", + "ovl_En_Kz", + "ovl_En_Light", + "ovl_En_Lightbox", + "ovl_En_M_Fire1", + "ovl_En_M_Thunder", + "ovl_En_Ma1", + "ovl_En_Ma2", + "ovl_En_Ma3", + "ovl_En_Mag", + "ovl_En_Mb", + "ovl_En_Md", + "ovl_En_Mk", + "ovl_En_Mm", + "ovl_En_Mm2", + "ovl_En_Ms", + "ovl_En_Mu", + "ovl_En_Nb", + "ovl_En_Niw", + "ovl_En_Niw_Girl", + "ovl_En_Niw_Lady", + "ovl_En_Nutsball", + "ovl_En_Nwc", + "ovl_En_Ny", + "ovl_En_OE2", + "ovl_En_Okarina_Effect", + "ovl_En_Okarina_Tag", + "ovl_En_Okuta", + "ovl_En_Ossan", + "ovl_En_Owl", + "ovl_En_Part", + "ovl_En_Peehat", + "ovl_En_Po_Desert", + "ovl_En_Po_Field", + "ovl_En_Po_Relay", + "ovl_En_Po_Sisters", + "ovl_En_Poh", + "ovl_En_Pu_box", + "ovl_En_Rd", + "ovl_En_Reeba", + "ovl_En_River_Sound", + "ovl_En_Rl", + "ovl_En_Rr", + "ovl_En_Ru1", + "ovl_En_Ru2", + "ovl_En_Sa", + "ovl_En_Sb", + "ovl_En_Scene_Change", + "ovl_En_Sda", + "ovl_En_Shopnuts", + "ovl_En_Si", + "ovl_En_Siofuki", + "ovl_En_Skb", + "ovl_En_Skj", + "ovl_En_Skjneedle", + "ovl_En_Ssh", + "ovl_En_St", + "ovl_En_Sth", + "ovl_En_Stream", + "ovl_En_Sw", + "ovl_En_Syateki_Itm", + "ovl_En_Syateki_Man", + "ovl_En_Syateki_Niw", + "ovl_En_Ta", + "ovl_En_Takara_Man", + "ovl_En_Tana", + "ovl_En_Tg", + "ovl_En_Tite", + "ovl_En_Tk", + "ovl_En_Torch", + "ovl_En_Torch2", + "ovl_En_Toryo", + "ovl_En_Tp", + "ovl_En_Tr", + "ovl_En_Trap", + "ovl_En_Tubo_Trap", + "ovl_En_Vali", + "ovl_En_Vase", + "ovl_En_Vb_Ball", + "ovl_En_Viewer", + "ovl_En_Vm", + "ovl_En_Wall_Tubo", + "ovl_En_Wallmas", + "ovl_En_Weather_Tag", + "ovl_En_Weiyer", + "ovl_En_Wf", + "ovl_En_Wonder_Item", + "ovl_En_Wonder_Talk", + "ovl_En_Wonder_Talk2", + "ovl_En_Wood02", + "ovl_En_Xc", + "ovl_En_Yabusame_Mark", + "ovl_En_Yukabyun", + "ovl_En_Zf", + "ovl_En_Zl1", + "ovl_En_Zl2", + "ovl_En_Zl3", + "ovl_En_Zl4", + "ovl_En_Zo", + "ovl_En_fHG", + "ovl_End_Title", + "ovl_Fishing", + "ovl_Item_B_Heart", + "ovl_Item_Etcetera", + "ovl_Item_Inbox", + "ovl_Item_Ocarina", + "ovl_Item_Shield", + "ovl_Magic_Dark", + "ovl_Magic_Fire", + "ovl_Magic_Wind", + "ovl_Mir_Ray", + "ovl_Obj_Bean", + "ovl_Obj_Blockstop", + "ovl_Obj_Bombiwa", + "ovl_Obj_Comb", + "ovl_Obj_Dekujr", + "ovl_Obj_Elevator", + "ovl_Obj_Hamishi", + "ovl_Obj_Hana", + "ovl_Obj_Hsblock", + "ovl_Obj_Ice_Poly", + "ovl_Obj_Kibako", + "ovl_Obj_Kibako2", + "ovl_Obj_Lift", + "ovl_Obj_Lightswitch", + "ovl_Obj_Makekinsuta", + "ovl_Obj_Makeoshihiki", + "ovl_Obj_Mure", + "ovl_Obj_Mure2", + "ovl_Obj_Mure3", + "ovl_Obj_Oshihiki", + "ovl_Obj_Roomtimer", + "ovl_Obj_Switch", + "ovl_Obj_Syokudai", + "ovl_Obj_Timeblock", + "ovl_Obj_Tsubo", + "ovl_Obj_Warp2block", + "ovl_Object_Kankyo", + "ovl_Oceff_Spot", + "ovl_Oceff_Storm", + "ovl_Oceff_Wipe", + "ovl_Oceff_Wipe2", + "ovl_Oceff_Wipe3", + "ovl_Oceff_Wipe4", + "ovl_Shot_Sun", + "gameplay_keep", + "gameplay_field_keep", + "gameplay_dangeon_keep", + "gameplay_object_exchange_static", + "object_link_boy", + "object_link_child", + "object_box", + "object_human", + "object_okuta", + "object_poh", + "object_wallmaster", + "object_dy_obj", + "object_firefly", + "object_dodongo", + "object_fire", + "object_niw", + "object_tite", + "object_reeba", + "object_peehat", + "object_kingdodongo", + "object_horse", + "object_zf", + "object_goma", + "object_zl1", + "object_gol", + "object_bubble", + "object_dodojr", + "object_torch2", + "object_bl", + "object_tp", + "object_oA1", + "object_st", + "object_bw", + "object_ei", + "object_horse_normal", + "object_oB1", + "object_o_anime", + "object_spot04_objects", + "object_ddan_objects", + "object_hidan_objects", + "object_horse_ganon", + "object_oA2", + "object_spot00_objects", + "object_mb", + "object_bombf", + "object_sk2", + "object_oE1", + "object_oE_anime", + "object_oE2", + "object_ydan_objects", + "object_gnd", + "object_am", + "object_dekubaba", + "object_oA3", + "object_oA4", + "object_oA5", + "object_oA6", + "object_oA7", + "object_jj", + "object_oA8", + "object_oA9", + "object_oB2", + "object_oB3", + "object_oB4", + "object_horse_zelda", + "object_opening_demo1", + "object_warp1", + "object_b_heart", + "object_dekunuts", + "object_oE3", + "object_oE4", + "object_menkuri_objects", + "object_oE5", + "object_oE6", + "object_oE7", + "object_oE8", + "object_oE9", + "object_oE10", + "object_oE11", + "object_oE12", + "object_vali", + "object_oA10", + "object_oA11", + "object_mizu_objects", + "object_fhg", + "object_ossan", + "object_mori_hineri1", + "object_Bb", + "object_toki_objects", + "object_yukabyun", + "object_zl2", + "object_mjin", + "object_mjin_flash", + "object_mjin_dark", + "object_mjin_flame", + "object_mjin_ice", + "object_mjin_soul", + "object_mjin_wind", + "object_mjin_oka", + "object_haka_objects", + "object_spot06_objects", + "object_ice_objects", + "object_relay_objects", + "object_mori_hineri1a", + "object_mori_hineri2", + "object_mori_hineri2a", + "object_mori_objects", + "object_mori_tex", + "object_spot08_obj", + "object_warp2", + "object_hata", + "object_bird", + "object_wood02", + "object_lightbox", + "object_pu_box", + "object_trap", + "object_vase", + "object_im", + "object_ta", + "object_tk", + "object_xc", + "object_vm", + "object_bv", + "object_hakach_objects", + "object_efc_crystal_light", + "object_efc_fire_ball", + "object_efc_flash", + "object_efc_lgt_shower", + "object_efc_star_field", + "object_god_lgt", + "object_light_ring", + "object_triforce_spot", + "object_medal", + "object_bdan_objects", + "object_sd", + "object_rd", + "object_po_sisters", + "object_heavy_object", + "object_gndd", + "object_fd", + "object_du", + "object_fw", + "object_horse_link_child", + "object_spot02_objects", + "object_haka", + "object_ru1", + "object_syokudai", + "object_fd2", + "object_dh", + "object_rl", + "object_efc_tw", + "object_demo_tre_lgt", + "object_gi_key", + "object_mir_ray", + "object_brob", + "object_gi_jewel", + "object_spot09_obj", + "object_spot18_obj", + "object_bdoor", + "object_spot17_obj", + "object_shop_dungen", + "object_nb", + "object_mo", + "object_sb", + "object_gi_melody", + "object_gi_heart", + "object_gi_compass", + "object_gi_bosskey", + "object_gi_medal", + "object_gi_nuts", + "object_sa", + "object_gi_hearts", + "object_gi_arrowcase", + "object_gi_bombpouch", + "object_in", + "object_tr", + "object_spot16_obj", + "object_oE1s", + "object_oE4s", + "object_os_anime", + "object_gi_bottle", + "object_gi_stick", + "object_gi_map", + "object_oF1d_map", + "object_ru2", + "object_gi_shield_1", + "object_dekujr", + "object_gi_magicpot", + "object_gi_bomb_1", + "object_oF1s", + "object_ma2", + "object_gi_purse", + "object_hni", + "object_tw", + "object_rr", + "object_bxa", + "object_anubice", + "object_gi_gerudo", + "object_gi_arrow", + "object_gi_bomb_2", + "object_gi_egg", + "object_gi_scale", + "object_gi_shield_2", + "object_gi_hookshot", + "object_gi_ocarina", + "object_gi_milk", + "object_ma1", + "object_ganon", + "object_sst", + "object_ny", + "object_fr", + "object_gi_pachinko", + "object_gi_boomerang", + "object_gi_bow", + "object_gi_glasses", + "object_gi_liquid", + "object_ani", + "object_demo_6k", + "object_gi_shield_3", + "object_gi_letter", + "object_spot15_obj", + "object_jya_obj", + "object_gi_clothes", + "object_gi_bean", + "object_gi_fish", + "object_gi_saw", + "object_gi_hammer", + "object_gi_grass", + "object_gi_longsword", + "object_spot01_objects", + "object_md", + "object_km1", + "object_kw1", + "object_zo", + "object_kz", + "object_umajump", + "object_masterkokiri", + "object_masterkokirihead", + "object_mastergolon", + "object_masterzoora", + "object_aob", + "object_ik", + "object_ahg", + "object_cne", + "object_gi_niwatori", + "object_skj", + "object_gi_bottle_letter", + "object_bji", + "object_bba", + "object_gi_ocarina_0", + "object_ds", + "object_ane", + "object_boj", + "object_spot03_object", + "object_spot07_object", + "object_fz", + "object_bob", + "object_ge1", + "object_yabusame_point", + "object_gi_boots_2", + "object_gi_seed", + "object_gnd_magic", + "object_d_elevator", + "object_d_hsblock", + "object_d_lift", + "object_mamenoki", + "object_goroiwa", + "object_toryo", + "object_daiku", + "object_nwc", + "object_blkobj", + "object_gm", + "object_ms", + "object_hs", + "object_ingate", + "object_lightswitch", + "object_kusa", + "object_tsubo", + "object_gi_gloves", + "object_gi_coin", + "object_kanban", + "object_gjyo_objects", + "object_owl", + "object_mk", + "object_fu", + "object_gi_ki_tan_mask", + "object_gi_redead_mask", + "object_gi_skj_mask", + "object_gi_rabit_mask", + "object_gi_truth_mask", + "object_ganon_objects", + "object_siofuki", + "object_stream", + "object_mm", + "object_fa", + "object_os", + "object_gi_eye_lotion", + "object_gi_powder", + "object_gi_mushroom", + "object_gi_ticketstone", + "object_gi_brokensword", + "object_js", + "object_cs", + "object_gi_prescription", + "object_gi_bracelet", + "object_gi_soldout", + "object_gi_frog", + "object_mag", + "object_door_gerudo", + "object_gt", + "object_efc_erupc", + "object_zl2_anime1", + "object_zl2_anime2", + "object_gi_golonmask", + "object_gi_zoramask", + "object_gi_gerudomask", + "object_ganon2", + "object_ka", + "object_ts", + "object_zg", + "object_gi_hoverboots", + "object_gi_m_arrow", + "object_ds2", + "object_ec", + "object_fish", + "object_gi_sutaru", + "object_gi_goddess", + "object_ssh", + "object_bigokuta", + "object_bg", + "object_spot05_objects", + "object_spot12_obj", + "object_bombiwa", + "object_hintnuts", + "object_rs", + "object_spot00_break", + "object_gla", + "object_shopnuts", + "object_geldb", + "object_gr", + "object_dog", + "object_jya_iron", + "object_jya_door", + "object_spot01_objects2", + "object_spot11_obj", + "object_kibako2", + "object_dns", + "object_dnk", + "object_gi_fire", + "object_gi_insect", + "object_gi_butterfly", + "object_gi_ghost", + "object_gi_soul", + "object_bowl", + "object_po_field", + "object_demo_kekkai", + "object_efc_doughnut", + "object_gi_dekupouch", + "object_ganon_anime1", + "object_ganon_anime2", + "object_ganon_anime3", + "object_gi_rupy", + "object_spot01_matoya", + "object_spot01_matoyab", + "object_po_composer", + "object_mu", + "object_wf", + "object_skb", + "object_gj", + "object_geff", + "object_haka_door", + "object_gs", + "object_ps", + "object_bwall", + "object_crow", + "object_cow", + "object_cob", + "object_gi_sword_1", + "object_door_killer", + "object_ouke_haka", + "object_timeblock", + "object_zl4", + "g_pn_01", + "g_pn_02", + "g_pn_03", + "g_pn_04", + "g_pn_05", + "g_pn_06", + "g_pn_07", + "g_pn_08", + "g_pn_09", + "g_pn_10", + "g_pn_11", + "g_pn_12", + "g_pn_13", + "g_pn_14", + "g_pn_15", + "g_pn_16", + "g_pn_17", + "g_pn_18", + "g_pn_19", + "g_pn_20", + "g_pn_21", + "g_pn_22", + "g_pn_23", + "g_pn_24", + "g_pn_25", + "g_pn_26", + "g_pn_27", + "g_pn_28", + "g_pn_29", + "g_pn_30", + "g_pn_31", + "g_pn_32", + "g_pn_33", + "g_pn_34", + "g_pn_35", + "g_pn_36", + "g_pn_37", + "g_pn_38", + "g_pn_39", + "g_pn_40", + "g_pn_41", + "g_pn_42", + "g_pn_43", + "g_pn_44", + "g_pn_45", + "g_pn_46", + "g_pn_47", + "g_pn_48", + "g_pn_49", + "g_pn_50", + "g_pn_51", + "g_pn_52", + "g_pn_53", + "g_pn_54", + "g_pn_55", + "g_pn_56", + "g_pn_57", + "z_select_static", + "nintendo_rogo_static", + "title_static", + "parameter_static", + "vr_fine0_static", + "vr_fine0_pal_static", + "vr_fine1_static", + "vr_fine1_pal_static", + "vr_fine2_static", + "vr_fine2_pal_static", + "vr_fine3_static", + "vr_fine3_pal_static", + "vr_cloud0_static", + "vr_cloud0_pal_static", + "vr_cloud1_static", + "vr_cloud1_pal_static", + "vr_cloud2_static", + "vr_cloud2_pal_static", + "vr_cloud3_static", + "vr_cloud3_pal_static", + "vr_holy0_static", + "vr_holy0_pal_static", + "vr_holy1_static", + "vr_holy1_pal_static", + "vr_MDVR_static", + "vr_MDVR_pal_static", + "vr_MNVR_static", + "vr_MNVR_pal_static", + "vr_RUVR_static", + "vr_RUVR_pal_static", + "vr_LHVR_static", + "vr_LHVR_pal_static", + "vr_KHVR_static", + "vr_KHVR_pal_static", + "vr_K3VR_static", + "vr_K3VR_pal_static", + "vr_K4VR_static", + "vr_K4VR_pal_static", + "vr_K5VR_static", + "vr_K5VR_pal_static", + "vr_SP1a_static", + "vr_SP1a_pal_static", + "vr_MLVR_static", + "vr_MLVR_pal_static", + "vr_KKRVR_static", + "vr_KKRVR_pal_static", + "vr_KR3VR_static", + "vr_KR3VR_pal_static", + "vr_IPVR_static", + "vr_IPVR_pal_static", + "vr_KSVR_static", + "vr_KSVR_pal_static", + "vr_GLVR_static", + "vr_GLVR_pal_static", + "vr_ZRVR_static", + "vr_ZRVR_pal_static", + "vr_DGVR_static", + "vr_DGVR_pal_static", + "vr_ALVR_static", + "vr_ALVR_pal_static", + "vr_NSVR_static", + "vr_NSVR_pal_static", + "vr_LBVR_static", + "vr_LBVR_pal_static", + "vr_TTVR_static", + "vr_TTVR_pal_static", + "vr_FCVR_static", + "vr_FCVR_pal_static", + "elf_message_field", + "elf_message_ydan", + "syotes_scene", + "syotes_room_0", + "syotes2_scene", + "syotes2_room_0", + "depth_test_scene", + "depth_test_room_0", + "spot00_scene", + "spot00_room_0", + "spot01_scene", + "spot01_room_0", + "spot02_scene", + "spot02_room_0", + "spot02_room_1", + "spot03_scene", + "spot03_room_0", + "spot03_room_1", + "spot04_scene", + "spot04_room_0", + "spot04_room_1", + "spot04_room_2", + "spot05_scene", + "spot05_room_0", + "spot06_scene", + "spot06_room_0", + "spot07_scene", + "spot07_room_0", + "spot07_room_1", + "spot08_scene", + "spot08_room_0", + "spot09_scene", + "spot09_room_0", + "spot10_scene", + "spot10_room_0", + "spot10_room_1", + "spot10_room_2", + "spot10_room_3", + "spot10_room_4", + "spot10_room_5", + "spot10_room_6", + "spot10_room_7", + "spot10_room_8", + "spot10_room_9", + "spot11_scene", + "spot11_room_0", + "spot12_scene", + "spot12_room_0", + "spot12_room_1", + "spot13_scene", + "spot13_room_0", + "spot13_room_1", + "spot15_scene", + "spot15_room_0", + "spot16_scene", + "spot16_room_0", + "spot17_scene", + "spot17_room_0", + "spot17_room_1", + "spot18_scene", + "spot18_room_0", + "spot18_room_1", + "spot18_room_2", + "spot18_room_3", + "ydan_scene", + "ydan_room_0", + "ydan_room_1", + "ydan_room_2", + "ydan_room_3", + "ydan_room_4", + "ydan_room_5", + "ydan_room_6", + "ydan_room_7", + "ydan_room_8", + "ydan_room_9", + "ydan_room_10", + "ydan_room_11", + "ddan_scene", + "ddan_room_0", + "ddan_room_1", + "ddan_room_2", + "ddan_room_3", + "ddan_room_4", + "ddan_room_5", + "ddan_room_6", + "ddan_room_7", + "ddan_room_8", + "ddan_room_9", + "ddan_room_10", + "ddan_room_11", + "ddan_room_12", + "ddan_room_13", + "ddan_room_14", + "ddan_room_15", + "ddan_room_16", + "bdan_scene", + "bdan_room_0", + "bdan_room_1", + "bdan_room_2", + "bdan_room_3", + "bdan_room_4", + "bdan_room_5", + "bdan_room_6", + "bdan_room_7", + "bdan_room_8", + "bdan_room_9", + "bdan_room_10", + "bdan_room_11", + "bdan_room_12", + "bdan_room_13", + "bdan_room_14", + "bdan_room_15", + "Bmori1_scene", + "Bmori1_room_0", + "Bmori1_room_1", + "Bmori1_room_2", + "Bmori1_room_3", + "Bmori1_room_4", + "Bmori1_room_5", + "Bmori1_room_6", + "Bmori1_room_7", + "Bmori1_room_8", + "Bmori1_room_9", + "Bmori1_room_10", + "Bmori1_room_11", + "Bmori1_room_12", + "Bmori1_room_13", + "Bmori1_room_14", + "Bmori1_room_15", + "Bmori1_room_16", + "Bmori1_room_17", + "Bmori1_room_18", + "Bmori1_room_19", + "Bmori1_room_20", + "Bmori1_room_21", + "Bmori1_room_22", + "HIDAN_scene", + "HIDAN_room_0", + "HIDAN_room_1", + "HIDAN_room_2", + "HIDAN_room_3", + "HIDAN_room_4", + "HIDAN_room_5", + "HIDAN_room_6", + "HIDAN_room_7", + "HIDAN_room_8", + "HIDAN_room_9", + "HIDAN_room_10", + "HIDAN_room_11", + "HIDAN_room_12", + "HIDAN_room_13", + "HIDAN_room_14", + "HIDAN_room_15", + "HIDAN_room_16", + "HIDAN_room_17", + "HIDAN_room_18", + "HIDAN_room_19", + "HIDAN_room_20", + "HIDAN_room_21", + "HIDAN_room_22", + "HIDAN_room_23", + "HIDAN_room_24", + "HIDAN_room_25", + "HIDAN_room_26", + "MIZUsin_scene", + "MIZUsin_room_0", + "MIZUsin_room_1", + "MIZUsin_room_2", + "MIZUsin_room_3", + "MIZUsin_room_4", + "MIZUsin_room_5", + "MIZUsin_room_6", + "MIZUsin_room_7", + "MIZUsin_room_8", + "MIZUsin_room_9", + "MIZUsin_room_10", + "MIZUsin_room_11", + "MIZUsin_room_12", + "MIZUsin_room_13", + "MIZUsin_room_14", + "MIZUsin_room_15", + "MIZUsin_room_16", + "MIZUsin_room_17", + "MIZUsin_room_18", + "MIZUsin_room_19", + "MIZUsin_room_20", + "MIZUsin_room_21", + "MIZUsin_room_22", + "jyasinzou_scene", + "jyasinzou_room_0", + "jyasinzou_room_1", + "jyasinzou_room_2", + "jyasinzou_room_3", + "jyasinzou_room_4", + "jyasinzou_room_5", + "jyasinzou_room_6", + "jyasinzou_room_7", + "jyasinzou_room_8", + "jyasinzou_room_9", + "jyasinzou_room_10", + "jyasinzou_room_11", + "jyasinzou_room_12", + "jyasinzou_room_13", + "jyasinzou_room_14", + "jyasinzou_room_15", + "jyasinzou_room_16", + "jyasinzou_room_17", + "jyasinzou_room_18", + "jyasinzou_room_19", + "jyasinzou_room_20", + "jyasinzou_room_21", + "jyasinzou_room_22", + "jyasinzou_room_23", + "jyasinzou_room_24", + "jyasinzou_room_25", + "jyasinzou_room_26", + "jyasinzou_room_27", + "jyasinzou_room_28", + "HAKAdan_scene", + "HAKAdan_room_0", + "HAKAdan_room_1", + "HAKAdan_room_2", + "HAKAdan_room_3", + "HAKAdan_room_4", + "HAKAdan_room_5", + "HAKAdan_room_6", + "HAKAdan_room_7", + "HAKAdan_room_8", + "HAKAdan_room_9", + "HAKAdan_room_10", + "HAKAdan_room_11", + "HAKAdan_room_12", + "HAKAdan_room_13", + "HAKAdan_room_14", + "HAKAdan_room_15", + "HAKAdan_room_16", + "HAKAdan_room_17", + "HAKAdan_room_18", + "HAKAdan_room_19", + "HAKAdan_room_20", + "HAKAdan_room_21", + "HAKAdan_room_22", + "HAKAdanCH_scene", + "HAKAdanCH_room_0", + "HAKAdanCH_room_1", + "HAKAdanCH_room_2", + "HAKAdanCH_room_3", + "HAKAdanCH_room_4", + "HAKAdanCH_room_5", + "HAKAdanCH_room_6", + "ice_doukutu_scene", + "ice_doukutu_room_0", + "ice_doukutu_room_1", + "ice_doukutu_room_2", + "ice_doukutu_room_3", + "ice_doukutu_room_4", + "ice_doukutu_room_5", + "ice_doukutu_room_6", + "ice_doukutu_room_7", + "ice_doukutu_room_8", + "ice_doukutu_room_9", + "ice_doukutu_room_10", + "ice_doukutu_room_11", + "men_scene", + "men_room_0", + "men_room_1", + "men_room_2", + "men_room_3", + "men_room_4", + "men_room_5", + "men_room_6", + "men_room_7", + "men_room_8", + "men_room_9", + "men_room_10", + "ganontika_scene", + "ganontika_room_0", + "ganontika_room_1", + "ganontika_room_2", + "ganontika_room_3", + "ganontika_room_4", + "ganontika_room_5", + "ganontika_room_6", + "ganontika_room_7", + "ganontika_room_8", + "ganontika_room_9", + "ganontika_room_10", + "ganontika_room_11", + "ganontika_room_12", + "ganontika_room_13", + "ganontika_room_14", + "ganontika_room_15", + "ganontika_room_16", + "ganontika_room_17", + "ganontika_room_18", + "ganontika_room_19", + "market_day_scene", + "market_day_room_0", + "market_night_scene", + "market_night_room_0", + "testroom_scene", + "testroom_room_0", + "testroom_room_1", + "testroom_room_2", + "testroom_room_3", + "testroom_room_4", + "kenjyanoma_scene", + "kenjyanoma_room_0", + "tokinoma_scene", + "tokinoma_room_0", + "tokinoma_room_1", + "sutaru_scene", + "sutaru_room_0", + "link_home_scene", + "link_home_room_0", + "kokiri_shop_scene", + "kokiri_shop_room_0", + "kokiri_home_scene", + "kokiri_home_room_0", + "kakusiana_scene", + "kakusiana_room_0", + "kakusiana_room_1", + "kakusiana_room_2", + "kakusiana_room_3", + "kakusiana_room_4", + "kakusiana_room_5", + "kakusiana_room_6", + "kakusiana_room_7", + "kakusiana_room_8", + "kakusiana_room_9", + "kakusiana_room_10", + "kakusiana_room_11", + "kakusiana_room_12", + "kakusiana_room_13", + "entra_scene", + "entra_room_0", + "moribossroom_scene", + "moribossroom_room_0", + "moribossroom_room_1", + "syatekijyou_scene", + "syatekijyou_room_0", + "shop1_scene", + "shop1_room_0", + "hairal_niwa_scene", + "hairal_niwa_room_0", + "ganon_tou_scene", + "ganon_tou_room_0", + "sasatest_scene", + "sasatest_room_0", + "market_alley_scene", + "market_alley_room_0", + "spot20_scene", + "spot20_room_0", + "market_ruins_scene", + "market_ruins_room_0", + "entra_n_scene", + "entra_n_room_0", + "enrui_scene", + "enrui_room_0", + "market_alley_n_scene", + "market_alley_n_room_0", + "hiral_demo_scene", + "hiral_demo_room_0", + "kokiri_home3_scene", + "kokiri_home3_room_0", + "malon_stable_scene", + "malon_stable_room_0", + "kakariko_scene", + "kakariko_room_0", + "bdan_boss_scene", + "bdan_boss_room_0", + "bdan_boss_room_1", + "FIRE_bs_scene", + "FIRE_bs_room_0", + "FIRE_bs_room_1", + "hut_scene", + "hut_room_0", + "daiyousei_izumi_scene", + "daiyousei_izumi_room_0", + "hakaana_scene", + "hakaana_room_0", + "yousei_izumi_tate_scene", + "yousei_izumi_tate_room_0", + "yousei_izumi_yoko_scene", + "yousei_izumi_yoko_room_0", + "golon_scene", + "golon_room_0", + "zoora_scene", + "zoora_room_0", + "drag_scene", + "drag_room_0", + "alley_shop_scene", + "alley_shop_room_0", + "night_shop_scene", + "night_shop_room_0", + "impa_scene", + "impa_room_0", + "labo_scene", + "labo_room_0", + "tent_scene", + "tent_room_0", + "nakaniwa_scene", + "nakaniwa_room_0", + "ddan_boss_scene", + "ddan_boss_room_0", + "ddan_boss_room_1", + "ydan_boss_scene", + "ydan_boss_room_0", + "ydan_boss_room_1", + "HAKAdan_bs_scene", + "HAKAdan_bs_room_0", + "HAKAdan_bs_room_1", + "MIZUsin_bs_scene", + "MIZUsin_bs_room_0", + "MIZUsin_bs_room_1", + "ganon_scene", + "ganon_room_0", + "ganon_room_1", + "ganon_room_2", + "ganon_room_3", + "ganon_room_4", + "ganon_room_5", + "ganon_room_6", + "ganon_room_7", + "ganon_room_8", + "ganon_room_9", + "ganon_boss_scene", + "ganon_boss_room_0", + "jyasinboss_scene", + "jyasinboss_room_0", + "jyasinboss_room_1", + "jyasinboss_room_2", + "jyasinboss_room_3", + "kokiri_home4_scene", + "kokiri_home4_room_0", + "kokiri_home5_scene", + "kokiri_home5_room_0", + "ganon_final_scene", + "ganon_final_room_0", + "kakariko3_scene", + "kakariko3_room_0", + "hairal_niwa2_scene", + "hairal_niwa2_room_0", + "hakasitarelay_scene", + "hakasitarelay_room_0", + "hakasitarelay_room_1", + "hakasitarelay_room_2", + "hakasitarelay_room_3", + "hakasitarelay_room_4", + "hakasitarelay_room_5", + "hakasitarelay_room_6", + "shrine_scene", + "shrine_room_0", + "turibori_scene", + "turibori_room_0", + "shrine_n_scene", + "shrine_n_room_0", + "shrine_r_scene", + "shrine_r_room_0", + "hakaana2_scene", + "hakaana2_room_0", + "gerudoway_scene", + "gerudoway_room_0", + "gerudoway_room_1", + "gerudoway_room_2", + "gerudoway_room_3", + "gerudoway_room_4", + "gerudoway_room_5", + "hairal_niwa_n_scene", + "hairal_niwa_n_room_0", + "bowling_scene", + "bowling_room_0", + "hakaana_ouke_scene", + "hakaana_ouke_room_0", + "hakaana_ouke_room_1", + "hakaana_ouke_room_2", + "hylia_labo_scene", + "hylia_labo_room_0", + "souko_scene", + "souko_room_0", + "souko_room_1", + "souko_room_2", + "miharigoya_scene", + "miharigoya_room_0", + "mahouya_scene", + "mahouya_room_0", + "takaraya_scene", + "takaraya_room_0", + "takaraya_room_1", + "takaraya_room_2", + "takaraya_room_3", + "takaraya_room_4", + "takaraya_room_5", + "takaraya_room_6", + "ganon_sonogo_scene", + "ganon_sonogo_room_0", + "ganon_sonogo_room_1", + "ganon_sonogo_room_2", + "ganon_sonogo_room_3", + "ganon_sonogo_room_4", + "ganon_demo_scene", + "ganon_demo_room_0", + "besitu_scene", + "besitu_room_0", + "face_shop_scene", + "face_shop_room_0", + "kinsuta_scene", + "kinsuta_room_0", + "ganontikasonogo_scene", + "ganontikasonogo_room_0", + "ganontikasonogo_room_1", + "test01_scene", + "test01_room_0", + "bump_texture_static", + "anime_model_1_static", + "anime_model_2_static", + "anime_model_3_static", + "anime_model_4_static", + "anime_model_5_static", + "anime_model_6_static", + "anime_texture_1_static", + "anime_texture_2_static", + "anime_texture_3_static", + "anime_texture_4_static", + "anime_texture_5_static", + "anime_texture_6_static", "softsprite_matrix_static", }; -s32 DmaMgr_CompareName(const char* name1, const char* name2) -{ - while (*name1 != 0u) - { - if (*name1 > *name2) +s32 DmaMgr_CompareName(const char* name1, const char* name2) { + while (*name1 != 0u) { + if (*name1 > *name2) { return 1; + } - if (*name1 < *name2) + if (*name1 < *name2) { return -1; + } name1++; name2++; } - if (*name2 > 0) + if (*name2 > 0) { return -1; + } return 0; } -s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) -{ +s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) { OSIoMesg ioMsg; OSMesgQueue queue; OSMesg msg; @@ -1579,15 +1578,15 @@ s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) u32 pad[2]; buffSize = sDmaMgrDmaBuffSize; - if (buffSize == 0) + if (buffSize == 0) { buffSize = 0x2000; + } osInvalICache((void*)ram, size); osInvalDCache((void*)ram, size); osCreateMesgQueue(&queue, &msg, 1); - while (size > buffSize) - { + while (size > buffSize) { if (1) {} // Necessary to match ioMsg.hdr.pri = OS_MESG_PRI_NORMAL; @@ -1596,22 +1595,24 @@ s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) ioMsg.dramAddr = (void*)ram; ioMsg.size = buffSize; - if (D_80009460 == 10) - osSyncPrintf("%10lld ノーマルDMA %08x %08x %08x (%d)\n", - OS_CYCLES_TO_USEC(osGetTime()), ioMsg.dramAddr, ioMsg.devAddr, ioMsg.size, gPiMgrCmdQ.validCount); + if (D_80009460 == 10) { + osSyncPrintf("%10lld ノーマルDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), ioMsg.dramAddr, + ioMsg.devAddr, ioMsg.size, gPiMgrCmdQ.validCount); + } ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ); - if (ret) + if (ret) { goto DmaMgr_DMARomToRam_end; + } - if (D_80009460 == 10) - osSyncPrintf("%10lld ノーマルDMA START (%d)\n", - OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount); + if (D_80009460 == 10) { + osSyncPrintf("%10lld ノーマルDMA START (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount); + } osRecvMesg(&queue, NULL, 1); - if (D_80009460 == 10) - osSyncPrintf("%10lld ノーマルDMA END (%d)\n", - OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount); + if (D_80009460 == 10) { + osSyncPrintf("%10lld ノーマルDMA END (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount); + } size -= buffSize; rom += buffSize; @@ -1626,18 +1627,20 @@ s32 DmaMgr_DMARomToRam(u32 rom, u32 ram, u32 size) ioMsg.dramAddr = (void*)ram; ioMsg.size = size; - if (D_80009460 == 10) - osSyncPrintf("%10lld ノーマルDMA %08x %08x %08x (%d)\n", - OS_CYCLES_TO_USEC(osGetTime()), ioMsg.dramAddr, ioMsg.devAddr, ioMsg.size, gPiMgrCmdQ.validCount); + if (D_80009460 == 10) { + osSyncPrintf("%10lld ノーマルDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), ioMsg.dramAddr, + ioMsg.devAddr, ioMsg.size, gPiMgrCmdQ.validCount); + } ret = osEPiStartDma(gCartHandle, &ioMsg, OS_READ); - if (ret) + if (ret) { goto DmaMgr_DMARomToRam_end; + } osRecvMesg(&queue, NULL, 1); - if (D_80009460 == 10) - osSyncPrintf("%10lld ノーマルDMA END (%d)\n", - OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount); + if (D_80009460 == 10) { + osSyncPrintf("%10lld ノーマルDMA END (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), gPiMgrCmdQ.validCount); + } DmaMgr_DMARomToRam_end: osInvalICache((void*)ram, size); @@ -1646,31 +1649,34 @@ DmaMgr_DMARomToRam_end: return ret; } -s32 DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) -{ +s32 DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { s32 ret; - if (pihandle != gCartHandle) + if (pihandle != gCartHandle) { __assert("pihandle == carthandle", "../z_std_dma.c", 530); - - if (direction != OS_READ) - __assert("direction == OS_READ", "../z_std_dma.c", 531); - - if (mb == NULL) - __assert("mb != NULL", "../z_std_dma.c", 532); + } - if (D_80009460 == 10) - osSyncPrintf("%10lld サウンドDMA %08x %08x %08x (%d)\n", - OS_CYCLES_TO_USEC(osGetTime()), mb->dramAddr, mb->devAddr, mb->size, gPiMgrCmdQ.validCount); + if (direction != OS_READ) { + __assert("direction == OS_READ", "../z_std_dma.c", 531); + } + + if (mb == NULL) { + __assert("mb != NULL", "../z_std_dma.c", 532); + } + + if (D_80009460 == 10) { + osSyncPrintf("%10lld サウンドDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), mb->dramAddr, + mb->devAddr, mb->size, gPiMgrCmdQ.validCount); + } ret = osEPiStartDma(pihandle, mb, direction); - if (ret) + if (ret) { osSyncPrintf("OOPS!!\n"); + } return ret; } -void DmaMgr_DmaCallback1(u32 ram, u32 rom, u32 size) -{ +void DmaMgr_DmaCallback1(u32 ram, u32 rom, u32 size) { OSPiHandle* handle; OSMesgQueue queue; OSMesg msg; @@ -1693,13 +1699,12 @@ void DmaMgr_DmaCallback1(u32 ram, u32 rom, u32 size) return; } -void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) -{ +void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, const char* errorDesc) { u32 vrom; u32 ram; u32 size; - char buff1 [80]; - char buff2 [80]; + char buff1[80]; + char buff2[80]; vrom = req->vromAddr; ram = (u32)req->dramAddr; @@ -1708,60 +1713,61 @@ void DmaMgr_Error(DmaRequest* req, const char* file, const char* errorName, cons osSyncPrintf("%c", 7); osSyncPrintf(VT_FGCOL(RED)); osSyncPrintf("DMA致命的エラー(%s)\nROM:%X RAM:%X SIZE:%X %s\n", - errorDesc ? errorDesc : (errorName ? errorName : "???"), - vrom, ram, size, file ? file : "???"); + errorDesc ? errorDesc : (errorName ? errorName : "???"), vrom, ram, size, file ? file : "???"); - if (req->filename) + if (req->filename) { osSyncPrintf("DMA ERROR: %s %d", req->filename, req->line); - else if (sDmaMgrCurFileName) + } else if (sDmaMgrCurFileName) { osSyncPrintf("DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine); + } osSyncPrintf(VT_RST); - if (req->filename) + if (req->filename) { sprintf(buff1, "DMA ERROR: %s %d", req->filename, req->line); - else if (sDmaMgrCurFileName) + } else if (sDmaMgrCurFileName) { sprintf(buff1, "DMA ERROR: %s %d", sDmaMgrCurFileName, sDmaMgrCurFileLine); - else + } else { sprintf(buff1, "DMA ERROR: %s", errorName ? errorName : "???"); - + } + sprintf(buff2, "%07X %08X %X %s", vrom, ram, size, file ? file : "???"); Fault_AddHungupAndCrashImpl(buff1, buff2); } -const char* DmaMgr_GetFileNameImpl(u32 vrom) -{ +const char* DmaMgr_GetFileNameImpl(u32 vrom) { DmaEntry* iter; const char** name; iter = gDmaDataTable; name = sDmaMgrFileNames; - while (iter->vromEnd) - { - if (vrom >= iter->vromStart && vrom < iter->vromEnd) + while (iter->vromEnd) { + if (vrom >= iter->vromStart && vrom < iter->vromEnd) { return *name; + } iter++; name++; } - // BUG: since the devs forgot to return in case the file isn't found, the return value will be a pointer to the end of gDmaDataTable + // BUG: since the devs forgot to return in case the file isn't found, the return value will be a pointer to the end + // of gDmaDataTable } -const char* DmaMgr_GetFileName(u32 vrom) -{ +const char* DmaMgr_GetFileName(u32 vrom) { const char* ret = DmaMgr_GetFileNameImpl(vrom); - if (!ret) + if (!ret) { return "(unknown)"; + } - if (DmaMgr_CompareName(ret, "kanji") == 0 || DmaMgr_CompareName(ret, "link_animetion") == 0) + if (DmaMgr_CompareName(ret, "kanji") == 0 || DmaMgr_CompareName(ret, "link_animetion") == 0) { return NULL; + } return ret; } -void DmaMgr_ProcessMsg(DmaRequest* req) -{ +void DmaMgr_ProcessMsg(DmaRequest* req) { u32 vrom; void* ram; u32 size; @@ -1781,35 +1787,33 @@ void DmaMgr_ProcessMsg(DmaRequest* req) // defined in .rodata but not used "DMA ROM:%08X RAM:%08X SIZE:%08X %s\n"; - while (iter->vromEnd) - { - if (vrom >= iter->vromStart && vrom < iter->vromEnd) - { + while (iter->vromEnd) { + if (vrom >= iter->vromStart && vrom < iter->vromEnd) { if (1) {} // Necessary to match - if (iter->romEnd == 0) - { - if (iter->vromEnd < vrom + size) + if (iter->romEnd == 0) { + if (iter->vromEnd < vrom + size) { DmaMgr_Error(req, filename, "Segment Alignment Error", "セグメント境界をまたがってDMA転送することはできません"); + } DmaMgr_DMARomToRam(iter->romStart + (vrom - iter->vromStart), (u32)ram, size); found = true; "No Press ROM:%08X RAM:%08X SIZE:%08X\n"; - } - else - { + } else { romStart = iter->romStart; romSize = iter->romEnd - iter->romStart; - if (vrom != iter->vromStart) + if (vrom != iter->vromStart) { DmaMgr_Error(req, filename, "Can't Transfer Segment", "圧縮されたセグメントの途中からはDMA転送することはできません"); + } - if (size != iter->vromEnd - iter->vromStart) + if (size != iter->vromEnd - iter->vromStart) { DmaMgr_Error(req, filename, "Can't Transfer Segment", "圧縮されたセグメントの一部だけをDMA転送することはできません"); + } osSetThreadPri(NULL, 0x0A); Yaz0_Decompress(romStart, ram, romSize); @@ -1823,10 +1827,8 @@ void DmaMgr_ProcessMsg(DmaRequest* req) iter++; } - if (!found) - { - if (sDmaMgrDataExistError) - { + if (!found) { + if (sDmaMgrDataExistError) { DmaMgr_Error(req, NULL, "DATA DON'T EXIST", "該当するデータが存在しません"); return; } @@ -1837,25 +1839,23 @@ void DmaMgr_ProcessMsg(DmaRequest* req) } } -void DmaMgr_ThreadEntry(void* arg0) -{ +void DmaMgr_ThreadEntry(void* arg0) { OSMesg msg; DmaRequest* req; - + osSyncPrintf("DMAマネージャスレッド実行開始\n"); - while (true) - { + while (true) { osRecvMesg(&sDmaMgrMsgQueue, &msg, 1); req = (DmaRequest*)msg; - if (!req) + if (!req) { break; - + } + // strings present in .rodata but not actually used in the function, probably a removed function "DMA登録受付 dmap=%08x\n"; DmaMgr_ProcessMsg(req); - if (req->notifyQueue) - { + if (req->notifyQueue) { osSendMesg(req->notifyQueue, req->notifyMsg, 0); "osSendMesg: dmap=%08x, mq=%08x, m=%08x \n"; } @@ -1863,13 +1863,13 @@ void DmaMgr_ThreadEntry(void* arg0) osSyncPrintf("DMAマネージャスレッド実行終了\n"); } -s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg) -{ +s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg) { static s32 sDmaMgrQueueFullLogged = 0; - if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || - (vrom & 1) || (vrom > 0x4000000U) || (size == 0) || (size & 1)) + if ((1 && (ram == 0)) || (osMemSize < ram + size + 0x80000000) || (vrom & 1) || (vrom > 0x4000000U) || + (size == 0) || (size & 1)) { DmaMgr_Error(req, NULL, "ILLIGAL DMA-FUNCTION CALL", "パラメータ異常です"); + } req->vromAddr = vrom; req->dramAddr = (void*)ram; @@ -1878,10 +1878,8 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk req->notifyQueue = queue; req->notifyMsg = msg; - if (1) - { - if ((sDmaMgrQueueFullLogged == 0) && (sDmaMgrMsgQueue.validCount >= sDmaMgrMsgQueue.msgCount)) - { + if (1) { + if ((sDmaMgrQueueFullLogged == 0) && (sDmaMgrMsgQueue.validCount >= sDmaMgrMsgQueue.msgCount)) { sDmaMgrQueueFullLogged++; osSyncPrintf("%c", 7); osSyncPrintf(VT_FGCOL(RED)); @@ -1897,8 +1895,7 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk return 0; } -s32 DmaMgr_SendRequest0(u32 ram, u32 vrom, u32 size) -{ +s32 DmaMgr_SendRequest0(u32 ram, u32 vrom, u32 size) { DmaRequest req; OSMesgQueue queue; OSMesg msg; @@ -1906,22 +1903,23 @@ s32 DmaMgr_SendRequest0(u32 ram, u32 vrom, u32 size) osCreateMesgQueue(&queue, &msg, 1); ret = DmaMgr_SendRequestImpl(&req, ram, vrom, size, 0, &queue, NULL); - if (ret == -1) + if (ret == -1) { return ret; - + } + osRecvMesg(&queue, NULL, 1); return 0; } -void DmaMgr_Start() -{ +void DmaMgr_Start() { const char** name; s32 idx; DmaEntry* iter; if (_dmadataSegmentRomStart) {} // Necessary to match - DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, (u32)_dmadataSegmentStart, (u32)_dmadataSegmentRomEnd - (u32)_dmadataSegmentRomStart); + DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, (u32)_dmadataSegmentStart, + (u32)_dmadataSegmentRomEnd - (u32)_dmadataSegmentRomStart); osSyncPrintf("dma_rom_ad[]\n"); sDmaMgrDataExistError = 0; @@ -1929,45 +1927,44 @@ void DmaMgr_Start() iter = gDmaDataTable; idx = 0; - while (iter->vromEnd != 0) - { - if (iter->romEnd != 0) + while (iter->vromEnd != 0) { + if (iter->romEnd != 0) { sDmaMgrDataExistError = 1; + } - osSyncPrintf("%3d %08x %08x %08x %08x %08x %c %s\n", - idx, iter->vromStart, iter->vromEnd, iter->romStart, iter->romEnd, - (iter->romEnd != 0) ? iter->romEnd - iter->romStart : iter->vromEnd - iter->vromStart, - (((iter->romEnd != 0) ? iter->romEnd - iter->romStart : 0) > 0x10000) ? '*' : ' ', - name ? *name : ""); + osSyncPrintf( + "%3d %08x %08x %08x %08x %08x %c %s\n", idx, iter->vromStart, iter->vromEnd, iter->romStart, iter->romEnd, + (iter->romEnd != 0) ? iter->romEnd - iter->romStart : iter->vromEnd - iter->vromStart, + (((iter->romEnd != 0) ? iter->romEnd - iter->romStart : 0) > 0x10000) ? '*' : ' ', name ? *name : ""); idx++; iter++; - if (name) + if (name) { name++; + } } - if ((u32)_bootSegmentRomStart != gDmaDataTable[0].vromEnd) - { - osSyncPrintf("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart, gDmaDataTable[0].vromEnd); + if ((u32)_bootSegmentRomStart != gDmaDataTable[0].vromEnd) { + osSyncPrintf("_bootSegmentRomStart(%08x) != dma_rom_ad[0].rom_b(%08x)\n", _bootSegmentRomStart, + gDmaDataTable[0].vromEnd); Fault_AddHungupAndCrash("../z_std_dma.c", 1055); } - osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, sizeof(sDmaMgrMsgs)/sizeof(sDmaMgrMsgs[0])); - StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack+sizeof(sDmaMgrStack), 0, 0x100, "dmamgr"); - osCreateThread(&sDmaMgrThread, 0x12, &DmaMgr_ThreadEntry, 0, sDmaMgrStack+sizeof(sDmaMgrStack) ,0x10); + osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, sizeof(sDmaMgrMsgs) / sizeof(sDmaMgrMsgs[0])); + StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 0x100, "dmamgr"); + osCreateThread(&sDmaMgrThread, 0x12, &DmaMgr_ThreadEntry, 0, sDmaMgrStack + sizeof(sDmaMgrStack), 0x10); osStartThread(&sDmaMgrThread); } -s32 DmaMgr_SendRequest2(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg, const char* file, s32 line) -{ +s32 DmaMgr_SendRequest2(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg, + const char* file, s32 line) { req->filename = file; req->line = line; DmaMgr_SendRequestImpl(req, ram, vrom, size, unk5, queue, msg); } -s32 DmaMgr_SendRequest1(void* ram0, u32 vrom, u32 size, const char* file, s32 line) -{ +s32 DmaMgr_SendRequest1(void* ram0, u32 vrom, u32 size, const char* file, s32 line) { DmaRequest req; s32 ret; OSMesgQueue queue; @@ -1979,9 +1976,10 @@ s32 DmaMgr_SendRequest1(void* ram0, u32 vrom, u32 size, const char* file, s32 li req.line = line; osCreateMesgQueue(&queue, &msg, 1); ret = DmaMgr_SendRequestImpl(&req, ram, vrom, size, 0, &queue, 0); - if (ret == -1) + if (ret == -1) { return ret; - + } + osRecvMesg(&queue, NULL, 1); return 0; } diff --git a/src/buffers/gfxbuffers.c b/src/buffers/gfxbuffers.c index 6423e4c122..9a538bf311 100644 --- a/src/buffers/gfxbuffers.c +++ b/src/buffers/gfxbuffers.c @@ -4,7 +4,7 @@ u64 gGfxSPTaskOutputBuffer[0x3000]; // 0xC00 bytes -u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE]; +u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE]; // 0x400 bytes u8 gGfxSPTaskStack[0x400]; diff --git a/src/code/TwoHeadArena.c b/src/code/TwoHeadArena.c index b466954428..23cfa00f81 100644 --- a/src/code/TwoHeadArena.c +++ b/src/code/TwoHeadArena.c @@ -1,172 +1,141 @@ #include -void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size) -{ +void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size) { THA_Ct((TwoHeadArena*)thga, start, size); } -void THGA_Dt(TwoHeadGfxArena* thga) -{ +void THGA_Dt(TwoHeadGfxArena* thga) { THA_Dt((TwoHeadArena*)thga); } -u32 THGA_IsCrash(TwoHeadGfxArena* thga) -{ +u32 THGA_IsCrash(TwoHeadGfxArena* thga) { return THA_IsCrash((TwoHeadArena*)thga); } -void THGA_Init(TwoHeadGfxArena* thga) -{ +void THGA_Init(TwoHeadGfxArena* thga) { THA_Init((TwoHeadArena*)thga); } -s32 THGA_GetSize(TwoHeadGfxArena* thga) -{ +s32 THGA_GetSize(TwoHeadGfxArena* thga) { return THA_GetSize((TwoHeadArena*)thga); } -Gfx* THGA_GetHead(TwoHeadGfxArena* thga) -{ +Gfx* THGA_GetHead(TwoHeadGfxArena* thga) { return THA_GetHead((TwoHeadArena*)thga); } -void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* start) -{ +void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* start) { THA_SetHead((TwoHeadArena*)thga, start); } -Gfx* THGA_GetTail(TwoHeadGfxArena* thga) -{ +Gfx* THGA_GetTail(TwoHeadGfxArena* thga) { return THA_GetTail((TwoHeadArena*)thga); } -Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count) -{ +Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count) { return THA_AllocStart((TwoHeadArena*)thga, count * 8); } -Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga) -{ +Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga) { return THGA_AllocStartArray8(thga, 1); } -Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga) -{ +Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga) { return THGA_AllocStart8(thga); } -Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, u32 size) -{ +Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, u32 size) { return THA_AllocEnd((TwoHeadArena*)thga, size); } -Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count) -{ +Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count) { return THGA_AllocEnd(thga, count * 0x40); } -Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga) -{ +Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga) { return THGA_AllocEnd(thga, 0x40); } -Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count) -{ +Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count) { return THGA_AllocEnd(thga, count * 0x10); } -Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga) -{ +Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga) { return THGA_AllocEnd(thga, 0x10); } - - - - -void* THA_GetHead(TwoHeadArena* tha) -{ +void* THA_GetHead(TwoHeadArena* tha) { return tha->head; } -void THA_SetHead(TwoHeadArena* tha, void* start) -{ +void THA_SetHead(TwoHeadArena* tha, void* start) { tha->head = start; } -void* THA_GetTail(TwoHeadArena* tha) -{ +void* THA_GetTail(TwoHeadArena* tha) { return tha->tail; } -void* THA_AllocStart(TwoHeadArena* tha, u32 size) -{ +void* THA_AllocStart(TwoHeadArena* tha, u32 size) { void* start = tha->head; tha->head += size; return start; } -void* THA_AllocStart1(TwoHeadArena* tha) -{ +void* THA_AllocStart1(TwoHeadArena* tha) { return THA_AllocStart(tha, 1); } -void* THA_AllocEnd(TwoHeadArena* tha, u32 size) -{ +void* THA_AllocEnd(TwoHeadArena* tha, u32 size) { u32 mask; u32* temp; - if (size == 8) + if (size == 8) { mask = ~7; - else if (size == 4 || size == 12) + } else if (size == 4 || size == 12) { mask = ~3; - else if (size == 2 || size == 6 || size == 10 || size == 12 || size == 14) + } else if (size == 2 || size == 6 || size == 10 || size == 12 || size == 14) { mask = ~1; - else + } else { mask = (size >= 0x10) ? ~0xF : 0; + } temp = (u32*)&tha->tail; // required to match return tha->tail = (void*)(((*temp & mask) - size) & mask); } -void* THA_AllocEndAlign16(TwoHeadArena *tha, u32 size) -{ - void* ret = (void*)(u32)((((u32)tha->tail & ~0xF) - size) & ((~(0xF & 0xFFFFFFFFFFFFFFFF)) & 0xFFFFFFFFu)); // required to match +void* THA_AllocEndAlign16(TwoHeadArena* tha, u32 size) { + void* ret = (void*)(u32)((((u32)tha->tail & ~0xF) - size) & + ((~(0xF & 0xFFFFFFFFFFFFFFFF)) & 0xFFFFFFFFu)); // required to match tha->tail = ret; return ret; } -void* THA_AllocEndAlign(TwoHeadArena* tha, u32 size, u32 mask) -{ +void* THA_AllocEndAlign(TwoHeadArena* tha, u32 size, u32 mask) { void* ret = (void*)((((u32)tha->tail & mask) - size) & mask); tha->tail = ret; return ret; } -s32 THA_GetSize(TwoHeadArena* tha) -{ +s32 THA_GetSize(TwoHeadArena* tha) { return tha->tail - tha->head; } -u32 THA_IsCrash(TwoHeadArena* tha) -{ +u32 THA_IsCrash(TwoHeadArena* tha) { return THA_GetSize(tha) < 0; } -void THA_Init(TwoHeadArena* tha) -{ +void THA_Init(TwoHeadArena* tha) { tha->head = tha->bufp; tha->tail = tha->bufp + tha->size; } -void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size) -{ +void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size) { tha->bufp = ptr; tha->size = size; THA_Init(tha); } -void THA_Dt(TwoHeadArena* tha) -{ +void THA_Dt(TwoHeadArena* tha) { bzero(tha, sizeof(TwoHeadArena)); } diff --git a/src/code/__osMalloc.c b/src/code/__osMalloc.c index 34d602f0ad..d5501c663d 100644 --- a/src/code/__osMalloc.c +++ b/src/code/__osMalloc.c @@ -1,63 +1,53 @@ #include #include -#define FILL_ALLOCBLOCK (1 << 0) -#define FILL_FREEBLOCK (1 << 1) -#define CHECK_FREE_BLOCK (1 << 2) +#define FILL_ALLOCBLOCK (1 << 0) +#define FILL_FREEBLOCK (1 << 1) +#define CHECK_FREE_BLOCK (1 << 2) -#define NODE_MAGIC (0x7373) +#define NODE_MAGIC (0x7373) -#define BLOCK_UNINIT_MAGIC (0xAB) -#define BLOCK_UNINIT_MAGIC_32 (0xABABABAB) -#define BLOCK_ALLOC_MAGIC (0xCD) -#define BLOCK_ALLOC_MAGIC_32 (0xCDCDCDCD) -#define BLOCK_FREE_MAGIC (0xEF) -#define BLOCK_FREE_MAGIC_32 (0xEFEFEFEF) +#define BLOCK_UNINIT_MAGIC (0xAB) +#define BLOCK_UNINIT_MAGIC_32 (0xABABABAB) +#define BLOCK_ALLOC_MAGIC (0xCD) +#define BLOCK_ALLOC_MAGIC_32 (0xCDCDCDCD) +#define BLOCK_FREE_MAGIC (0xEF) +#define BLOCK_FREE_MAGIC_32 (0xEFEFEFEF) OSMesg sArenaLockMsg; u32 __osMalloc_FreeBlockTest_Enable; -bool ArenaImpl_GetFillAllocBlock(Arena* arena) -{ +bool ArenaImpl_GetFillAllocBlock(Arena* arena) { return (arena->flag & FILL_ALLOCBLOCK) != 0; } -bool ArenaImpl_GetFillFreeBlock(Arena* arena) -{ +bool ArenaImpl_GetFillFreeBlock(Arena* arena) { return (arena->flag & FILL_FREEBLOCK) != 0; } -bool ArenaImpl_GetCheckFreeBlock(Arena* arena) -{ +bool ArenaImpl_GetCheckFreeBlock(Arena* arena) { return (arena->flag & CHECK_FREE_BLOCK) != 0; } -void ArenaImpl_SetFillAllocBlock(Arena* arena) -{ +void ArenaImpl_SetFillAllocBlock(Arena* arena) { arena->flag |= FILL_ALLOCBLOCK; } -void ArenaImpl_SetFillFreeBlock(Arena* arena) -{ +void ArenaImpl_SetFillFreeBlock(Arena* arena) { arena->flag |= FILL_FREEBLOCK; } -void ArenaImpl_SetCheckFreeBlock(Arena* arena) -{ +void ArenaImpl_SetCheckFreeBlock(Arena* arena) { arena->flag |= CHECK_FREE_BLOCK; } -void ArenaImpl_UnsetFillAllocBlock(Arena* arena) -{ +void ArenaImpl_UnsetFillAllocBlock(Arena* arena) { arena->flag &= ~FILL_ALLOCBLOCK; } -void ArenaImpl_UnsetFillFreeBlock(Arena* arena) -{ +void ArenaImpl_UnsetFillFreeBlock(Arena* arena) { arena->flag &= ~FILL_FREEBLOCK; } -void ArenaImpl_UnsetCheckFreeBlock(Arena* arena) -{ +void ArenaImpl_UnsetCheckFreeBlock(Arena* arena) { arena->flag &= ~CHECK_FREE_BLOCK; } -void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* arena) -{ +void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* arena) { node->filename = file; node->line = line; node->threadId = osGetThreadId(NULL); @@ -65,28 +55,23 @@ void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* node->time = osGetTime(); } -void ArenaImpl_LockInit(Arena* arena) -{ +void ArenaImpl_LockInit(Arena* arena) { osCreateMesgQueue(&arena->lock, &sArenaLockMsg, 1); } -void ArenaImpl_Lock(Arena* arena) -{ +void ArenaImpl_Lock(Arena* arena) { osSendMesg(&arena->lock, NULL, OS_MESG_BLOCK); } -void ArenaImpl_Unlock(Arena* arena) -{ +void ArenaImpl_Unlock(Arena* arena) { osRecvMesg(&arena->lock, NULL, OS_MESG_BLOCK); } -ArenaNode* ArenaImpl_GetNextBlock(ArenaNode* node) -{ +ArenaNode* ArenaImpl_GetNextBlock(ArenaNode* node) { ArenaNode* ret; ret = node->next; - if (ret && (!ret || (ret->magic != NODE_MAGIC))) - { + if (ret && (!ret || (ret->magic != NODE_MAGIC))) { osSyncPrintf(VT_COL(RED, WHITE) "緊急事態!メモリリーク発見! (block=%08x)\n" VT_RST, ret); ret = NULL; node->next = NULL; @@ -95,13 +80,11 @@ ArenaNode* ArenaImpl_GetNextBlock(ArenaNode* node) return ret; } -ArenaNode* ArenaImpl_GetPrevBlock(ArenaNode* node) -{ +ArenaNode* ArenaImpl_GetPrevBlock(ArenaNode* node) { ArenaNode* ret; ret = node->prev; - if (ret && (!ret || (ret->magic != NODE_MAGIC))) - { + if (ret && (!ret || (ret->magic != NODE_MAGIC))) { osSyncPrintf(VT_COL(RED, WHITE) "緊急事態!メモリリーク発見! (block=%08x)\n" VT_RST, ret); ret = NULL; node->prev = NULL; @@ -110,16 +93,13 @@ ArenaNode* ArenaImpl_GetPrevBlock(ArenaNode* node) return ret; } -ArenaNode* ArenaImpl_GetLastBlock(Arena* arena) -{ +ArenaNode* ArenaImpl_GetLastBlock(Arena* arena) { ArenaNode* ret = NULL; ArenaNode* iter; - if (arena && arena->head && arena->head->magic == NODE_MAGIC) - { + if (arena && arena->head && arena->head->magic == NODE_MAGIC) { iter = arena->head; - while (iter) - { + while (iter) { ret = iter; iter = ArenaImpl_GetNextBlock(iter); } @@ -128,29 +108,25 @@ ArenaNode* ArenaImpl_GetLastBlock(Arena* arena) return ret; } -void __osMallocInit(Arena* arena, void* start, u32 size) -{ +void __osMallocInit(Arena* arena, void* start, u32 size) { bzero(arena, sizeof(Arena)); ArenaImpl_LockInit(arena); __osMallocAddBlock(arena, start, size); arena->isInit = true; } -void __osMallocAddBlock(Arena* arena, void* start, s32 size) -{ +void __osMallocAddBlock(Arena* arena, void* start, s32 size) { s32 diff; s32 size2; ArenaNode* firstNode; ArenaNode* lastNode; - - if (start) - { + + if (start) { firstNode = (ArenaNode*)ALIGN16((u32)start); diff = (s32)firstNode - (s32)start; size2 = (size - diff) & ~0xF; - if (size2 > (s32)sizeof(ArenaNode)) - { - func_80106860(firstNode, BLOCK_UNINIT_MAGIC, size2); //memset + if (size2 > (s32)sizeof(ArenaNode)) { + func_80106860(firstNode, BLOCK_UNINIT_MAGIC, size2); // memset firstNode->next = NULL; firstNode->prev = NULL; firstNode->size = size2 - sizeof(ArenaNode); @@ -158,13 +134,10 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) firstNode->magic = NODE_MAGIC; ArenaImpl_Lock(arena); lastNode = ArenaImpl_GetLastBlock(arena); - if (!lastNode) - { + if (!lastNode) { arena->head = firstNode; arena->start = start; - } - else - { + } else { firstNode->prev = lastNode; lastNode->next = firstNode; } @@ -173,53 +146,47 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) } } -void ArenaImpl_RemoveAllBlocks(Arena* arena) -{ +void ArenaImpl_RemoveAllBlocks(Arena* arena) { ArenaNode* iter; ArenaNode* next; ArenaImpl_Lock(arena); iter = arena->head; - while (iter) - { + while (iter) { next = ArenaImpl_GetNextBlock(iter); - func_80106860(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode)); //memset + func_80106860(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode)); // memset iter = next; } ArenaImpl_Unlock(arena); } -void __osMallocCleanup(Arena* arena) -{ +void __osMallocCleanup(Arena* arena) { ArenaImpl_RemoveAllBlocks(arena); bzero(arena, sizeof(*arena)); } -u8 __osMallocIsInitalized(Arena* arena) -{ +u8 __osMallocIsInitalized(Arena* arena) { return arena->isInit; } -void __osMalloc_FreeBlockTest(Arena *arena, ArenaNode *node) -{ - ArenaNode *node2; +void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) { + ArenaNode* node2; u32* start; u32* end; u32* iter; node2 = node; - if (__osMalloc_FreeBlockTest_Enable) - { + if (__osMalloc_FreeBlockTest_Enable) { start = (u32*)((u32)node + sizeof(ArenaNode)); - end = (u32*)((u32) start + node2->size); + end = (u32*)((u32)start + node2->size); iter = start; - while (iter < end) - { - if (*iter != BLOCK_UNINIT_MAGIC_32 && *iter != BLOCK_FREE_MAGIC_32) - { - osSyncPrintf(VT_COL(RED, WHITE) "緊急事態!メモリリーク検出! (block=%08x s=%08x e=%08x p=%08x)\n" VT_RST, node, start, end, iter); + while (iter < end) { + if (*iter != BLOCK_UNINIT_MAGIC_32 && *iter != BLOCK_FREE_MAGIC_32) { + osSyncPrintf( + VT_COL(RED, WHITE) "緊急事態!メモリリーク検出! (block=%08x s=%08x e=%08x p=%08x)\n" VT_RST, node, + start, end, iter); __osDisplayArena(arena); return; } @@ -228,29 +195,26 @@ void __osMalloc_FreeBlockTest(Arena *arena, ArenaNode *node) } } -void* __osMalloc_NoLockDebug(Arena *arena, u32 size, const char *file, s32 line) -{ - ArenaNode *iter; +void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line) { + ArenaNode* iter; u32 blockSize; - ArenaNode *newNode; - void *ret; - ArenaNode *next; + ArenaNode* newNode; + void* ret; + ArenaNode* next; ret = NULL; iter = arena->head; size = ALIGN16(size); blockSize = ALIGN16(size) + sizeof(ArenaNode); - while (iter) - { - if (iter->isFree && iter->size >= size) - { - if (arena->flag & CHECK_FREE_BLOCK) + while (iter) { + if (iter->isFree && iter->size >= size) { + if (arena->flag & CHECK_FREE_BLOCK) { __osMalloc_FreeBlockTest(arena, iter); + } - if (blockSize < iter->size) - { - newNode = (ArenaNode *)((u32)iter + blockSize); + if (blockSize < iter->size) { + newNode = (ArenaNode*)((u32)iter + blockSize); newNode->next = ArenaImpl_GetNextBlock(iter); newNode->prev = iter; newNode->size = iter->size - blockSize; @@ -260,15 +224,17 @@ void* __osMalloc_NoLockDebug(Arena *arena, u32 size, const char *file, s32 line) iter->next = newNode; iter->size = size; next = ArenaImpl_GetNextBlock(newNode); - if (next) + if (next) { next->prev = newNode; + } } iter->isFree = false; ArenaImpl_SetDebugInfo(iter, file, line, arena); - ret = (void *)((u32)iter + sizeof(ArenaNode)); - if (arena->flag & FILL_ALLOCBLOCK) + ret = (void*)((u32)iter + sizeof(ArenaNode)); + if (arena->flag & FILL_ALLOCBLOCK) { func_80106860(ret, BLOCK_ALLOC_MAGIC, size); + } break; } @@ -279,8 +245,7 @@ void* __osMalloc_NoLockDebug(Arena *arena, u32 size, const char *file, s32 line) return ret; } -void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) -{ +void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) { void* ret; ArenaImpl_Lock(arena); ret = __osMalloc_NoLockDebug(arena, size, file, line); @@ -288,29 +253,27 @@ void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) return ret; } -void* __osMallocRDebug(Arena *arena, u32 size, const char *file, s32 line) -{ - ArenaNode *iter; - ArenaNode *newNode; +void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line) { + ArenaNode* iter; + ArenaNode* newNode; u32 blockSize; - ArenaNode *next; - void *ret; + ArenaNode* next; + void* ret; ret = NULL; size = ALIGN16(size); ArenaImpl_Lock(arena); - iter = ArenaImpl_GetLastBlock(arena);; - while (iter) - { - if (iter->isFree && iter->size >= size) - { - if (arena->flag & CHECK_FREE_BLOCK) + iter = ArenaImpl_GetLastBlock(arena); + + while (iter) { + if (iter->isFree && iter->size >= size) { + if (arena->flag & CHECK_FREE_BLOCK) { __osMalloc_FreeBlockTest(arena, iter); + } blockSize = ALIGN16(size) + sizeof(ArenaNode); - if (blockSize < iter->size) - { - newNode = (ArenaNode *)((u32)iter + (iter->size - size)); + if (blockSize < iter->size) { + newNode = (ArenaNode*)((u32)iter + (iter->size - size)); newNode->next = ArenaImpl_GetNextBlock(iter); newNode->prev = iter; newNode->size = size; @@ -319,17 +282,19 @@ void* __osMallocRDebug(Arena *arena, u32 size, const char *file, s32 line) iter->next = newNode; iter->size -= blockSize; next = ArenaImpl_GetNextBlock(newNode); - if (next) + if (next) { next->prev = newNode; + } iter = newNode; } iter->isFree = false; ArenaImpl_SetDebugInfo(iter, file, line, arena); - ret = (void *)((u32)iter + sizeof(ArenaNode)); - if (arena->flag & FILL_ALLOCBLOCK) + ret = (void*)((u32)iter + sizeof(ArenaNode)); + if (arena->flag & FILL_ALLOCBLOCK) { func_80106860(ret, BLOCK_ALLOC_MAGIC, size); + } break; } @@ -341,30 +306,27 @@ void* __osMallocRDebug(Arena *arena, u32 size, const char *file, s32 line) return ret; } -void* __osMalloc_NoLock(Arena *arena, u32 size) -{ - ArenaNode *iter; +void* __osMalloc_NoLock(Arena* arena, u32 size) { + ArenaNode* iter; u32 blockSize; - ArenaNode *newNode; - void *ret; - ArenaNode *next; + ArenaNode* newNode; + void* ret; + ArenaNode* next; ret = NULL; iter = arena->head; size = ALIGN16(size); blockSize = ALIGN16(size) + sizeof(ArenaNode); - while (iter) - { + while (iter) { - if (iter->isFree && iter->size >= size) - { - if (arena->flag & CHECK_FREE_BLOCK) + if (iter->isFree && iter->size >= size) { + if (arena->flag & CHECK_FREE_BLOCK) { __osMalloc_FreeBlockTest(arena, iter); + } - if (blockSize < iter->size) - { - newNode = (ArenaNode *)((u32)iter + blockSize); + if (blockSize < iter->size) { + newNode = (ArenaNode*)((u32)iter + blockSize); newNode->next = ArenaImpl_GetNextBlock(iter); newNode->prev = iter; newNode->size = iter->size - blockSize; @@ -374,15 +336,17 @@ void* __osMalloc_NoLock(Arena *arena, u32 size) iter->next = newNode; iter->size = size; next = ArenaImpl_GetNextBlock(newNode); - if (next) + if (next) { next->prev = newNode; + } } iter->isFree = false; ArenaImpl_SetDebugInfo(iter, NULL, 0, arena); - ret = (void *)((u32)iter + sizeof(ArenaNode)); - if (arena->flag & FILL_ALLOCBLOCK) + ret = (void*)((u32)iter + sizeof(ArenaNode)); + if (arena->flag & FILL_ALLOCBLOCK) { func_80106860(ret, BLOCK_ALLOC_MAGIC, size); + } break; } @@ -393,8 +357,7 @@ void* __osMalloc_NoLock(Arena *arena, u32 size) return ret; } -void* __osMalloc(Arena* arena, u32 size) -{ +void* __osMalloc(Arena* arena, u32 size) { void* ret; ArenaImpl_Lock(arena); ret = __osMalloc_NoLock(arena, size); @@ -402,29 +365,27 @@ void* __osMalloc(Arena* arena, u32 size) return ret; } -void* __osMallocR(Arena *arena, u32 size) -{ - ArenaNode *iter; - ArenaNode *newNode; +void* __osMallocR(Arena* arena, u32 size) { + ArenaNode* iter; + ArenaNode* newNode; u32 blockSize; - ArenaNode *next; - void *ret; + ArenaNode* next; + void* ret; ret = NULL; size = ALIGN16(size); ArenaImpl_Lock(arena); - iter = ArenaImpl_GetLastBlock(arena);; - while (iter) - { - if (iter->isFree && iter->size >= size) - { - if (arena->flag & CHECK_FREE_BLOCK) + iter = ArenaImpl_GetLastBlock(arena); + + while (iter) { + if (iter->isFree && iter->size >= size) { + if (arena->flag & CHECK_FREE_BLOCK) { __osMalloc_FreeBlockTest(arena, iter); + } blockSize = ALIGN16(size) + sizeof(ArenaNode); - if (blockSize < iter->size) - { - newNode = (ArenaNode *)((u32)iter + (iter->size - size)); + if (blockSize < iter->size) { + newNode = (ArenaNode*)((u32)iter + (iter->size - size)); newNode->next = ArenaImpl_GetNextBlock(iter); newNode->prev = iter; newNode->size = size; @@ -433,17 +394,19 @@ void* __osMallocR(Arena *arena, u32 size) iter->next = newNode; iter->size -= blockSize; next = ArenaImpl_GetNextBlock(newNode); - if (next) + if (next) { next->prev = newNode; - + } + iter = newNode; } iter->isFree = false; ArenaImpl_SetDebugInfo(iter, NULL, 0, arena); - ret = (void *)((u32)iter + sizeof(ArenaNode)); - if (arena->flag & FILL_ALLOCBLOCK) + ret = (void*)((u32)iter + sizeof(ArenaNode)); + if (arena->flag & FILL_ALLOCBLOCK) { func_80106860(ret, BLOCK_ALLOC_MAGIC, size); + } break; } @@ -455,30 +418,27 @@ void* __osMallocR(Arena *arena, u32 size) return ret; } -void __osFree_NoLock(Arena* arena, void* ptr) -{ +void __osFree_NoLock(Arena* arena, void* ptr) { ArenaNode* node; ArenaNode* next; ArenaNode* prev; ArenaNode* newNext; - if (ptr) - { + if (ptr) { node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode)); - if (node == NULL || node->magic != NODE_MAGIC) - { - osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x)\n" VT_RST, ptr); //__osFree: Unauthorized release (%08x) + if (node == NULL || node->magic != NODE_MAGIC) { + osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x)\n" VT_RST, + ptr); // __osFree: Unauthorized release (%08x) return; } - if (node->isFree) - { - osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x)\n" VT_RST, ptr); //__osFree: Double release (%08x) + if (node->isFree) { + osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x)\n" VT_RST, ptr); // __osFree: Double release (%08x) return; } - if (arena != node->arena && arena != NULL) - { - //__osFree:Tried to release in a different way than when it was secured (%08x:%08x) - osSyncPrintf(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena, node->arena); + if (arena != node->arena && arena != NULL) { + // __osFree:Tried to release in a different way than when it was secured (%08x:%08x) + osSyncPrintf(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena, + node->arena); return; } @@ -486,68 +446,66 @@ void __osFree_NoLock(Arena* arena, void* ptr) prev = ArenaImpl_GetPrevBlock(node); node->isFree = true; ArenaImpl_SetDebugInfo(node, NULL, 0, arena); - if (arena->flag & FILL_FREEBLOCK) - { + if (arena->flag & FILL_FREEBLOCK) { func_80106860((u32)node + sizeof(ArenaNode), BLOCK_FREE_MAGIC, node->size); } newNext = next; - if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) - { + if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) { newNext = ArenaImpl_GetNextBlock(next); - if (newNext) + if (newNext) { newNext->prev = node; - + } + node->size += next->size + sizeof(ArenaNode); - if (arena->flag & FILL_FREEBLOCK) + if (arena->flag & FILL_FREEBLOCK) { func_80106860(next, BLOCK_FREE_MAGIC, sizeof(ArenaNode)); + } node->next = newNext; next = newNext; } - if (prev && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) - { - if (next) + if (prev && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) { + if (next) { next->prev = prev; + } prev->next = next; prev->size += node->size + sizeof(ArenaNode); - if (arena->flag & FILL_FREEBLOCK) + if (arena->flag & FILL_FREEBLOCK) { func_80106860(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode)); + } } } } -void __osFree(Arena* arena, void* ptr) -{ +void __osFree(Arena* arena, void* ptr) { ArenaImpl_Lock(arena); __osFree_NoLock(arena, ptr); ArenaImpl_Unlock(arena); } -void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) -{ +void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) { ArenaNode* node; ArenaNode* next; ArenaNode* prev; ArenaNode* newNext; - if (ptr) - { + if (ptr) { node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode)); - if (node == NULL || node->magic != NODE_MAGIC) - { - osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line); //__osFree: Unauthorized release (%08x) + if (node == NULL || node->magic != NODE_MAGIC) { + osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, + line); // __osFree: Unauthorized release (%08x) return; } - if (node->isFree) - { - osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line); //__osFree: Double release (%08x) + if (node->isFree) { + osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, + line); // __osFree: Double release (%08x) return; } - if (arena != node->arena && arena != NULL) - { - //__osFree:Tried to release in a different way than when it was secured (%08x:%08x) - osSyncPrintf(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena, node->arena); + if (arena != node->arena && arena != NULL) { + // __osFree:Tried to release in a different way than when it was secured (%08x:%08x) + osSyncPrintf(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena, + node->arena); return; } @@ -555,46 +513,45 @@ void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) prev = ArenaImpl_GetPrevBlock(node); node->isFree = true; ArenaImpl_SetDebugInfo(node, file, line, arena); - if (arena->flag & FILL_FREEBLOCK) - { + if (arena->flag & FILL_FREEBLOCK) { func_80106860((u32)node + sizeof(ArenaNode), BLOCK_FREE_MAGIC, node->size); } newNext = node->next; - if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) - { + if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) { newNext = ArenaImpl_GetNextBlock(next); - if (newNext) + if (newNext) { newNext->prev = node; - + } + node->size += next->size + sizeof(ArenaNode); - if (arena->flag & FILL_FREEBLOCK) + if (arena->flag & FILL_FREEBLOCK) { func_80106860(next, BLOCK_FREE_MAGIC, sizeof(ArenaNode)); + } node->next = newNext; next = newNext; } - if (prev && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) - { - if (next) + if (prev && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) { + if (next) { next->prev = prev; + } prev->next = next; prev->size += node->size + sizeof(ArenaNode); - if (arena->flag & FILL_FREEBLOCK) + if (arena->flag & FILL_FREEBLOCK) { func_80106860(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode)); + } } } } -void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line) -{ +void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line) { ArenaImpl_Lock(arena); __osFree_NoLockDebug(arena, ptr, file, line); ArenaImpl_Unlock(arena); } -void* __osRealloc(Arena* arena, void* ptr, u32 newSize) -{ +void* __osRealloc(Arena* arena, void* ptr, u32 newSize) { void* newAlloc; ArenaNode* node; ArenaNode* next; @@ -611,60 +568,46 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) newSize = ALIGN16(newSize); osSyncPrintf("__osRealloc(%08x, %d)\n", ptr, newSize); ArenaImpl_Lock(arena); - if (!ptr) - { + if (!ptr) { ptr = __osMalloc_NoLock(arena, newSize); - } - else if (!newSize) - { + } else if (!newSize) { __osFree_NoLock(arena, ptr); ptr = NULL; - } - else - { + } else { node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode)); - if (newSize == node->size) - { - //Does nothing because the memory block size does not change + if (newSize == node->size) { + // Does nothing because the memory block size does not change osSyncPrintf("メモリブロックサイズが変わらないためなにもしません\n"); - } - else if (node->size < newSize) - { + } else if (node->size < newSize) { next = ArenaImpl_GetNextBlock(node); sizeDiff = newSize - node->size; - if ((u32)next == ((u32)node + node->size + sizeof(ArenaNode)) && next->isFree && next->size >= sizeDiff) - { - //Merge because there is a free block after the current memory block + if ((u32)next == ((u32)node + node->size + sizeof(ArenaNode)) && next->isFree && next->size >= sizeDiff) { + // Merge because there is a free block after the current memory block osSyncPrintf("現メモリブロックの後ろにフリーブロックがあるので結合します\n"); next->size -= sizeDiff; overNext = ArenaImpl_GetNextBlock(next); newNext = (ArenaNode*)((u32)next + sizeDiff); - if (overNext) + if (overNext) { overNext->prev = newNext; + } node->next = newNext; node->size = newSize; - func_801068B0(newNext, next, sizeof(ArenaNode)); //memcpy - } - else - { - //Allocate a new memory block and move the contents + func_801068B0(newNext, next, sizeof(ArenaNode)); // memcpy + } else { + // Allocate a new memory block and move the contents osSyncPrintf("新たにメモリブロックを確保して内容を移動します\n"); newAlloc = __osMalloc_NoLock(arena, newSize); - if (newAlloc) - { + if (newAlloc) { bcopy(ptr, newAlloc, node->size); __osFree_NoLock(arena, ptr); } ptr = newAlloc; } - } - else if (newSize < node->size) - { + } else if (newSize < node->size) { next2 = ArenaImpl_GetNextBlock(node); - if (next2 && next2->isFree) - { + if (next2 && next2->isFree) { blockSize = ALIGN16(newSize) + sizeof(ArenaNode); - //Increased free block behind current memory block + // Increased free block behind current memory block osSyncPrintf("現メモリブロックの後ろのフリーブロックを大きくしました\n"); newNext2 = (ArenaNode*)((u32)node + blockSize); localCopy = *next2; @@ -673,13 +616,12 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) node->next = newNext2; node->size = newSize; overNext2 = ArenaImpl_GetNextBlock(newNext2); - if (overNext2) + if (overNext2) { overNext2->prev = newNext2; - } - else if (newSize + sizeof(ArenaNode) < node->size) - { + } + } else if (newSize + sizeof(ArenaNode) < node->size) { blockSize = ALIGN16(newSize) + sizeof(ArenaNode); - //Generated because there is no free block after the current memory block + // Generated because there is no free block after the current memory block osSyncPrintf("現メモリブロックの後ろにフリーブロックがないので生成します\n"); newNext2 = (ArenaNode*)((u32)node + blockSize); newNext2->next = ArenaImpl_GetNextBlock(node); @@ -690,12 +632,11 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) node->next = newNext2; node->size = newSize; overNext2 = ArenaImpl_GetNextBlock(newNext2); - if (overNext2) + if (overNext2) { overNext2->prev = newNext2; - } - else - { - //There is no room to generate free blocks + } + } else { + // There is no room to generate free blocks osSyncPrintf("フリーブロック生成するだけの空きがありません\n"); ptr = NULL; } @@ -706,13 +647,11 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) return ptr; } -void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line) -{ +void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line) { return __osRealloc(arena, ptr, newSize); } -void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) -{ +void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaNode* iter; ArenaImpl_Lock(arena); @@ -722,16 +661,15 @@ void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAll *outAlloc = 0; iter = arena->head; - while (iter) - { - if (iter->isFree) - { + while (iter) { + if (iter->isFree) { *outFree += iter->size; - if (*outMaxFree < iter->size) + if (*outMaxFree < iter->size) { *outMaxFree = iter->size; - } - else + } + } else { *outAlloc += iter->size; + } iter = ArenaImpl_GetNextBlock(iter); } @@ -739,17 +677,15 @@ void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAll ArenaImpl_Unlock(arena); } -void __osDisplayArena(Arena* arena) -{ +void __osDisplayArena(Arena* arena) { u32 freeSize; u32 allocatedSize; u32 maxFree; ArenaNode* iter; ArenaNode* next; - if (!__osMallocIsInitalized(arena)) - { - //Arena is not initalized + if (!__osMallocIsInitalized(arena)) { + // Arena is not initalized osSyncPrintf("アリーナは初期化されていません\n"); return; } @@ -760,40 +696,36 @@ void __osDisplayArena(Arena* arena) freeSize = 0; allocatedSize = 0; - //Arena contents (0x%08x) + // Arena contents (0x%08x) osSyncPrintf("アリーナの内容 (0x%08x)\n", arena); - //Memory node range status size [time s ms us ns: TID: src: line] + // Memory node range status size [time s ms us ns: TID: src: line] osSyncPrintf("メモリブロック範囲 status サイズ [時刻 s ms us ns: TID:src:行]\n"); iter = arena->head; - while (iter) - { - if (iter && iter->magic == NODE_MAGIC) - { + while (iter) { + if (iter && iter->magic == NODE_MAGIC) { next = iter->next; osSyncPrintf("%08x-%08x%c %s %08x", iter, ((u32)iter + sizeof(ArenaNode) + iter->size), - (!next) ? '$' : (iter != next->prev ? '!' : ' '), - iter->isFree ? "空き" : "確保", //? "Free" : "Secure" - iter->size); - - if (!iter->isFree) - osSyncPrintf(" [%016llu:%2d:%s:%d]", (iter->time*64ll)/3ull, iter->threadId, iter->filename ? iter->filename : "**NULL**", iter->line); + (!next) ? '$' : (iter != next->prev ? '!' : ' '), + iter->isFree ? "空き" : "確保", //? "Free" : "Secure" + iter->size); + + if (!iter->isFree) { + osSyncPrintf(" [%016llu:%2d:%s:%d]", (iter->time * 64ll) / 3ull, iter->threadId, + iter->filename ? iter->filename : "**NULL**", iter->line); + } osSyncPrintf("\n"); - if (iter->isFree) - { + if (iter->isFree) { freeSize += iter->size; - if (maxFree < iter->size) + if (maxFree < iter->size) { maxFree = iter->size; - } - else - { + } + } else { allocatedSize += iter->size; } - } - else - { + } else { osSyncPrintf("%08x Block Invalid\n", iter); next = NULL; } @@ -801,15 +733,14 @@ void __osDisplayArena(Arena* arena) iter = next; } - osSyncPrintf("確保ブロックサイズの合計 0x%08x バイト\n", allocatedSize); //Total reserved node size 0x%08x bytes - osSyncPrintf("空きブロックサイズの合計 0x%08x バイト\n", freeSize); //Total free node size 0x%08x bytes - osSyncPrintf("最大空きブロックサイズ 0x%08x バイト\n", maxFree); //Maximum free node size 0x%08x bytes + osSyncPrintf("確保ブロックサイズの合計 0x%08x バイト\n", allocatedSize); // Total reserved node size 0x%08x bytes + osSyncPrintf("空きブロックサイズの合計 0x%08x バイト\n", freeSize); // Total free node size 0x%08x bytes + osSyncPrintf("最大空きブロックサイズ 0x%08x バイト\n", maxFree); // Maximum free node size 0x%08x bytes ArenaImpl_Unlock(arena); } -void ArenaImpl_FaultClient(Arena* arena) -{ +void ArenaImpl_FaultClient(Arena* arena) { u32 freeSize; u32 allocatedSize; u32 maxFree; @@ -817,8 +748,7 @@ void ArenaImpl_FaultClient(Arena* arena) ArenaNode* next; FaultDrawer_Printf("ARENA INFO (0x%08x)\n", arena); - if (!__osMallocIsInitalized(arena)) - { + if (!__osMallocIsInitalized(arena)) { FaultDrawer_Printf("Arena is uninitalized\n", arena); return; } @@ -830,31 +760,23 @@ void ArenaImpl_FaultClient(Arena* arena) FaultDrawer_Printf("Memory Block Region status size\n"); iter = arena->head; - while (iter) - { - if (iter && iter->magic == NODE_MAGIC) - { + while (iter) { + if (iter && iter->magic == NODE_MAGIC) { next = iter->next; FaultDrawer_Printf("%08x-%08x%c %s %08x", iter, ((u32)iter + sizeof(ArenaNode) + iter->size), - (!next) ? '$' : (iter != next->prev ? '!' : ' '), - iter->isFree ? "F" : "A", - iter->size); - + (!next) ? '$' : (iter != next->prev ? '!' : ' '), iter->isFree ? "F" : "A", iter->size); + FaultDrawer_Printf("\n"); - if (iter->isFree) - { + if (iter->isFree) { freeSize += iter->size; - if (maxFree < iter->size) + if (maxFree < iter->size) { maxFree = iter->size; - } - else - { + } + } else { allocatedSize += iter->size; } - } - else - { + } else { FaultDrawer_SetFontColor(0xF801); FaultDrawer_Printf("%08x Block Invalid\n", iter); next = NULL; @@ -869,37 +791,32 @@ void ArenaImpl_FaultClient(Arena* arena) FaultDrawer_Printf("Largest Free Block Size %08x\n", maxFree); } -u32 __osCheckArena(Arena* arena) -{ - ArenaNode *iter; +u32 __osCheckArena(Arena* arena) { + ArenaNode* iter; u32 error; error = 0; ArenaImpl_Lock(arena); - //Checking the contents of the arena. . . (%08x) + // Checking the contents of the arena. . . (%08x) osSyncPrintf("アリーナの内容をチェックしています... (%08x)\n", arena); iter = arena->head; - while (iter) - { - if (iter && iter->magic == NODE_MAGIC) - { - //Oops!! (%08x %08x) + while (iter) { + if (iter && iter->magic == NODE_MAGIC) { + // Oops!! (%08x %08x) osSyncPrintf(VT_COL(RED, WHITE) "おおっと!! (%08x %08x)\n" VT_RST, iter, iter->magic); error = 1; break; } iter = ArenaImpl_GetNextBlock(iter); } - if (!error) - { - //The arena is still going well + if (!error) { + // The arena is still going well osSyncPrintf("アリーナはまだ、いけそうです\n"); } ArenaImpl_Unlock(arena); return error; } -u8 func_800FF334(Arena* arena) -{ +u8 func_800FF334(Arena* arena) { return arena->unk_20; } diff --git a/src/code/audioMgr.c b/src/code/audioMgr.c index a834c746e5..2372355de2 100644 --- a/src/code/audioMgr.c +++ b/src/code/audioMgr.c @@ -14,4 +14,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3FC4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3FEC.s") - diff --git a/src/code/code_80026B00.c b/src/code/code_80026B00.c index 3cd8d47726..beb5006eed 100644 --- a/src/code/code_80026B00.c +++ b/src/code/code_80026B00.c @@ -1,15 +1,13 @@ #include #include -GlobalContext* func_80026B00(void) -{ +GlobalContext* func_80026B00(void) { return D_80157DA0; } #pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/func_80026B0C.s") -void func_80026C1C(u8* arg0) -{ +void func_80026C1C(u8* arg0) { arg0[0] = 0; arg0[1] = 0; arg0[2] = 0; diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index c03b84f3e7..344c4ddb51 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -3,59 +3,56 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_800430A0/func_800430A0.s") -void func_800432A0(CollisionContext* colCtx, u32 floorPolySource, Actor* actor) -{ - if (func_8003E934(floorPolySource) != 0) - { +void func_800432A0(CollisionContext* colCtx, u32 floorPolySource, Actor* actor) { + if (func_8003E934(floorPolySource) != 0) { s16 v1 = colCtx->dyna.actorMeshArr[floorPolySource].rot2.y - colCtx->dyna.actorMeshArr[floorPolySource].rot1.y; - if (actor->id == 0) + if (actor->id == 0) { ((Player*)actor)->unk_83C += v1; + } actor->shape.rot.y += v1; actor->posRot.rot.y += v1; } } -void func_80043334(CollisionContext* colCtx, Actor* actor, u32 floorPolySource) -{ - if (func_8003E934(floorPolySource) != 0) - { +void func_80043334(CollisionContext* colCtx, Actor* actor, u32 floorPolySource) { + if (func_8003E934(floorPolySource) != 0) { DynaPolyActor* dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource); - if (dynaActor != NULL) - { + if (dynaActor != NULL) { func_800434A8(dynaActor); - if ((actor->flags & 0x4000000) == 0x4000000) + if ((actor->flags & 0x4000000) == 0x4000000) { func_80043538(dynaActor); + } } } } -s32 func_800433A4(CollisionContext* colCtx, u32 floorPolySource, Actor* actor) -{ +s32 func_800433A4(CollisionContext* colCtx, u32 floorPolySource, Actor* actor) { s32 sp24 = 0; DynaPolyActor* dynaActor; - if (func_8003E934(floorPolySource) == 0) + if (func_8003E934(floorPolySource) == 0) { return 0; + } - if ((colCtx->dyna.flags[floorPolySource] & 2) || !(colCtx->dyna.flags[floorPolySource] & 1)) + if ((colCtx->dyna.flags[floorPolySource] & 2) || !(colCtx->dyna.flags[floorPolySource] & 1)) { return 0; + } dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource); - if (dynaActor == NULL) + if (dynaActor == NULL) { return 0; + } - if (dynaActor->unk_15C & 1) - { + if (dynaActor->unk_15C & 1) { func_800430A0(colCtx, floorPolySource, actor); sp24 = 1; } - if (dynaActor->unk_15C & 2) - { + if (dynaActor->unk_15C & 2) { func_800432A0(colCtx, floorPolySource, actor); sp24 = 1; } diff --git a/src/code/code_80043480.c b/src/code/code_80043480.c index 7a040602fc..ddd8d0e994 100644 --- a/src/code/code_80043480.c +++ b/src/code/code_80043480.c @@ -1,8 +1,7 @@ #include #include -void DynaPolyInfo_SetActorMove(DynaPolyActor* dynaActor, DynaPolyMoveFlag flags) -{ +void DynaPolyInfo_SetActorMove(DynaPolyActor* dynaActor, DynaPolyMoveFlag flags) { dynaActor->dynaPolyId = -1; dynaActor->unk_15C = flags; dynaActor->unk_160 = 0; @@ -10,77 +9,72 @@ void DynaPolyInfo_SetActorMove(DynaPolyActor* dynaActor, DynaPolyMoveFlag flags) dynaActor->unk_154 = 0.0f; } -void func_800434A0(DynaPolyActor *dynaActor) -{ +void func_800434A0(DynaPolyActor* dynaActor) { dynaActor->unk_160 = 0; } -void func_800434A8(DynaPolyActor *dynaActor) -{ +void func_800434A8(DynaPolyActor* dynaActor) { dynaActor->unk_160 |= 1; } -void func_800434B8(DynaPolyActor *dynaActor) -{ +void func_800434B8(DynaPolyActor* dynaActor) { dynaActor->unk_160 |= 2; } -void func_800434C8(CollisionContext* colCtx, u32 floorPolySource) -{ - DynaPolyActor *dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource); +void func_800434C8(CollisionContext* colCtx, u32 floorPolySource) { + DynaPolyActor* dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource); - if (dynaActor != NULL) + if (dynaActor != NULL) { func_800434B8(dynaActor); + } } -void func_800434F8(DynaPolyActor* dynaActor) -{ +void func_800434F8(DynaPolyActor* dynaActor) { dynaActor->unk_160 |= 4; } -void func_80043508(CollisionContext* colCtx, u32 floorPolySource) -{ - DynaPolyActor *dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource); +void func_80043508(CollisionContext* colCtx, u32 floorPolySource) { + DynaPolyActor* dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource); - if (dynaActor != NULL) + if (dynaActor != NULL) { func_800434F8(dynaActor); + } } -void func_80043538(DynaPolyActor* dynaActor) -{ +void func_80043538(DynaPolyActor* dynaActor) { dynaActor->unk_160 |= 8; } -s32 func_80043548(DynaPolyActor* dynaActor) -{ - if (dynaActor->unk_160 & 1) +s32 func_80043548(DynaPolyActor* dynaActor) { + if (dynaActor->unk_160 & 1) { return 1; - else + } else { return 0; + } } -s32 func_8004356C(DynaPolyActor* dynaActor) -{ - if (dynaActor->unk_160 & 2) +s32 func_8004356C(DynaPolyActor* dynaActor) { + if (dynaActor->unk_160 & 2) { return 1; - else + } else { return 0; + } } -s32 func_80043590(DynaPolyActor* dynaActor) -{ - if (dynaActor->unk_160 & 4) +s32 func_80043590(DynaPolyActor* dynaActor) { + if (dynaActor->unk_160 & 4) { return 1; - else + } else { return 0; + } } -s32 func_800435B4(DynaPolyActor* dynaActor) -{ - if (dynaActor->unk_160 & 8) +s32 func_800435B4(DynaPolyActor* dynaActor) { + if (dynaActor->unk_160 & 8) { return 1; - else + } else { return 0; + } } #pragma GLOBAL_ASM("asm/non_matchings/code/code_80043480/func_800435D8.s") diff --git a/src/code/code_80069420.c b/src/code/code_80069420.c index f0be5b4c36..ee9a179d7d 100644 --- a/src/code/code_80069420.c +++ b/src/code/code_80069420.c @@ -1,13 +1,11 @@ #include #include -void* MemCopy(void* dest, void* src, s32 size) -{ +void* MemCopy(void* dest, void* src, s32 size) { u8* destu = (u8*)dest; u8* srcu = (u8*)src; - while (size > 0) - { + while (size > 0) { *destu++ = *srcu++; size--; } @@ -15,13 +13,11 @@ void* MemCopy(void* dest, void* src, s32 size) return dest; } -void* MemSet(void* dest, s32 val, s32 size) -{ +void* MemSet(void* dest, s32 val, s32 size) { u8* destu = (u8*)dest; s32 s = size; - while (s > 0) - { + while (s > 0) { *destu++ = val; s--; } diff --git a/src/code/code_8006C360.c b/src/code/code_8006C360.c index fa48f62edd..01cf89b4df 100644 --- a/src/code/code_8006C360.c +++ b/src/code/code_8006C360.c @@ -1,8 +1,7 @@ #include #include -u16 D_8011F3F0[60][9] = -{ +u16 D_8011F3F0[60][9] = { { 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 }, { 0x0000, 0x7128, 0x7129, 0x7128, 0x7128, 0x7128, 0x7128, 0x712A, 0x712B }, { 0x0000, 0x7128, 0x712B, 0x7128, 0x7128, 0x7129, 0x7128, 0x712B, 0x7128 }, @@ -65,8 +64,7 @@ u16 D_8011F3F0[60][9] = { 0x0000, 0x7104, 0x7105, 0x7107, 0x7105, 0x710C, 0x7105, 0x7107, 0x7107 }, }; -u16 func_8006C360(GlobalContext* globalCtx, u32 idx) -{ +u16 func_8006C360(GlobalContext* globalCtx, u32 idx) { u8 mask = func_8008F080(globalCtx); return D_8011F3F0[idx][mask]; } diff --git a/src/code/code_8006C3A0.c b/src/code/code_8006C3A0.c index 88889621b0..1b7c77c4c1 100644 --- a/src/code/code_8006C3A0.c +++ b/src/code/code_8006C3A0.c @@ -8,4 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C3A0/func_8006C438.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C3A0/func_8006C4A4.s") - diff --git a/src/code/code_8006C510.c b/src/code/code_8006C510.c index 5568b32e92..20fa80747e 100644 --- a/src/code/code_8006C510.c +++ b/src/code/code_8006C510.c @@ -4,4 +4,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C510/func_8006C510.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C510/func_8006C5A8.s") - diff --git a/src/code/code_8006EA30.c b/src/code/code_8006EA30.c index f433ed6b08..41104fea7b 100644 --- a/src/code/code_8006EA30.c +++ b/src/code/code_8006EA30.c @@ -5,10 +5,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006ECF4.s") -void func_8006EE48(UNK_TYPE arg0) -{ - +void func_8006EE48(UNK_TYPE arg0) { } #pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006EE50.s") - diff --git a/src/code/code_8007BF90.c b/src/code/code_8007BF90.c index f947e042b0..c51b222f99 100644 --- a/src/code/code_8007BF90.c +++ b/src/code/code_8007BF90.c @@ -3,8 +3,7 @@ Vec3f* func_8007C1AC(Vec3f* dest, struct_80045714* arg1); -f32 func_8007BF90(Vec3f* a, Vec3f* b) -{ +f32 func_8007BF90(Vec3f* a, Vec3f* b) { f32 dx = a->x - b->x; f32 dy = a->y - b->y; f32 dz = a->z - b->z; @@ -12,8 +11,7 @@ f32 func_8007BF90(Vec3f* a, Vec3f* b) return sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); } -f32 func_8007BFD0(Vec3f* a, Vec3f* b, Vec3f* dest) -{ +f32 func_8007BFD0(Vec3f* a, Vec3f* b, Vec3f* dest) { dest->x = a->x - b->x; dest->y = a->y - b->y; dest->z = a->z - b->z; @@ -21,20 +19,17 @@ f32 func_8007BFD0(Vec3f* a, Vec3f* b, Vec3f* dest) return sqrtf(SQ(dest->x) + SQ(dest->y) + SQ(dest->z)); } -f32 func_8007C028(Vec3f* a, Vec3f* b) -{ +f32 func_8007C028(Vec3f* a, Vec3f* b) { return sqrtf(SQ(a->x - b->x) + SQ(a->z - b->z)); } -f32 func_8007C058(f32 arg0, f32 arg1) -{ +f32 func_8007C058(f32 arg0, f32 arg1) { return (arg1 <= fabsf(arg0)) ? arg0 : ((arg0 >= 0) ? arg1 : -arg1); } #pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C0A8.s") -Vec3f* func_8007C0F8(Vec3f* dest, Vec3f* a, Vec3f* b) -{ +Vec3f* func_8007C0F8(Vec3f* dest, Vec3f* a, Vec3f* b) { Vec3f v1; Vec3f v2; f32 temp; @@ -54,8 +49,7 @@ Vec3f* func_8007C0F8(Vec3f* dest, Vec3f* a, Vec3f* b) return dest; } -Vec3f* func_8007C1AC(Vec3f* dest, struct_80045714* arg1) -{ +Vec3f* func_8007C1AC(Vec3f* dest, struct_80045714* arg1) { Vec3f v; f32 sin4; f32 cos4; @@ -78,8 +72,7 @@ Vec3f* func_8007C1AC(Vec3f* dest, struct_80045714* arg1) void func_8007C3F4(struct_80045714* arg0, Vec3f* arg1); -void func_8007C25C(Vec3f* dest, struct_80045714* arg1) -{ +void func_8007C25C(Vec3f* dest, struct_80045714* arg1) { struct_80045714 var; var.unk_00 = arg1->unk_00; @@ -95,8 +88,7 @@ void func_8007C25C(Vec3f* dest, struct_80045714* arg1) void func_8007C29C(struct_80045714* arg0, Vec3f* arg1); -void func_8007C440(struct_80045714* arg0, Vec3f* a, Vec3f* b) -{ +void func_8007C440(struct_80045714* arg0, Vec3f* a, Vec3f* b) { Vec3f var; var.x = b->x - a->x; @@ -106,8 +98,7 @@ void func_8007C440(struct_80045714* arg0, Vec3f* a, Vec3f* b) func_8007C29C(arg0, &var); } -void func_8007C490(struct_80045714* arg0, Vec3f* a, Vec3f* b) -{ +void func_8007C490(struct_80045714* arg0, Vec3f* a, Vec3f* b) { Vec3f var; var.x = b->x - a->x; @@ -117,8 +108,7 @@ void func_8007C490(struct_80045714* arg0, Vec3f* a, Vec3f* b) func_8007C3F4(arg0, &var); } -Vec3f* func_8007C4E0(Vec3f* dest, Vec3f* a, Vec3f* b) -{ +Vec3f* func_8007C4E0(Vec3f* dest, Vec3f* a, Vec3f* b) { Vec3f var; var.x = Math_atan2f(b->z - a->z, b->y - a->y); @@ -133,4 +123,3 @@ Vec3f* func_8007C4E0(Vec3f* dest, Vec3f* a, Vec3f* b) #pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C574.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C5E0.s") - diff --git a/src/code/code_80097A00.c b/src/code/code_80097A00.c index f30e01f1a5..d709fd8c92 100644 --- a/src/code/code_80097A00.c +++ b/src/code/code_80097A00.c @@ -2,244 +2,77 @@ #include // Bit Flag array in which gBitFlags[n] is literally (1 << n) -u32 gBitFlags[] = -{ - (1 << 0), (1 << 1), (1 << 2), (1 << 3), - (1 << 4), (1 << 5), (1 << 6), (1 << 7), - (1 << 8), (1 << 9), (1 << 10), (1 << 11), - (1 << 12), (1 << 13), (1 << 14), (1 << 15), - (1 << 16), (1 << 17), (1 << 18), (1 << 19), - (1 << 20), (1 << 21), (1 << 22), (1 << 23), - (1 << 24), (1 << 25), (1 << 26), (1 << 27), - (1 << 28), (1 << 29), (1 << 30), (1 << 31), +u32 gBitFlags[] = { + (1 << 0), (1 << 1), (1 << 2), (1 << 3), (1 << 4), (1 << 5), (1 << 6), (1 << 7), + (1 << 8), (1 << 9), (1 << 10), (1 << 11), (1 << 12), (1 << 13), (1 << 14), (1 << 15), + (1 << 16), (1 << 17), (1 << 18), (1 << 19), (1 << 20), (1 << 21), (1 << 22), (1 << 23), + (1 << 24), (1 << 25), (1 << 26), (1 << 27), (1 << 28), (1 << 29), (1 << 30), (1 << 31), }; u16 gEquipMasks[] = { 0x000F, 0x00F0, 0x0F00, 0xF000 }; u16 gEquipNegMasks[] = { 0xFFF0, 0xFF0F, 0xF0FF, 0x0FFF }; -u32 gUpgradeMasks[] = { 0x00000007, 0x00000038, 0x000001C0, 0x00000E00, 0x00003000, 0x0001C000, 0x000E0000, 0x00700000 }; -u32 gUpgradeNegMasks[] = { 0xFFFFFFF8, 0xFFFFFFC7, 0xFFFFFE3F, 0xFFFFF1FF, 0xFFFFCFFF, 0xFFFE3FFF, 0xFFF1FFFF, 0xFF8FFFFF }; +u32 gUpgradeMasks[] = { + 0x00000007, 0x00000038, 0x000001C0, 0x00000E00, 0x00003000, 0x0001C000, 0x000E0000, 0x00700000, +}; +u32 gUpgradeNegMasks[] = { + 0xFFFFFFF8, 0xFFFFFFC7, 0xFFFFFE3F, 0xFFFFF1FF, 0xFFFFCFFF, 0xFFFE3FFF, 0xFFF1FFFF, 0xFF8FFFFF, +}; u8 gEquipShifts[] = { 0, 4, 8, 12 }; u8 gUpgradeShifts[] = { 0, 3, 6, 9, 12, 14, 17, 20 }; -u16 gUpgradeCapacities[][4] = -{ - { 0, 30, 40, 50 }, // Quivers - { 0, 20, 30, 40 }, // Bomb Bags - { 0, 0, 0, 0 }, // Unused (Scale) - { 0, 0, 0, 0 }, // Unused (Strength) - { 99, 200, 500, 500 }, // Wallets - { 0, 30, 40, 50 }, // Deku Seed Bullet Bags - { 0, 10, 20, 30 }, // Deku Stick Upgrades - { 0, 20, 30, 40 }, // Deku Nut Upgrades +u16 gUpgradeCapacities[][4] = { + { 0, 30, 40, 50 }, // Quivers + { 0, 20, 30, 40 }, // Bomb Bags + { 0, 0, 0, 0 }, // Unused (Scale) + { 0, 0, 0, 0 }, // Unused (Strength) + { 99, 200, 500, 500 }, // Wallets + { 0, 30, 40, 50 }, // Deku Seed Bullet Bags + { 0, 10, 20, 30 }, // Deku Stick Upgrades + { 0, 20, 30, 40 }, // Deku Nut Upgrades }; u32 D_8012723C[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }; // Unused -u32 D_8012724C[] = { 0, 8, 16, 24 }; // Unused +u32 D_8012724C[] = { 0, 8, 16, 24 }; // Unused // TODO: use symbols for these icon textures once textures are properly in C -u32 gItemIcons[] = -{ - 0x08000000, - 0x08001000, - 0x08002000, - 0x08003000, - 0x08004000, - 0x08005000, - 0x08006000, - 0x08007000, - 0x08008000, - 0x08009000, - 0x0800A000, - 0x0800B000, - 0x0800C000, - 0x0800D000, - 0x0800E000, - 0x0800F000, - 0x08010000, - 0x08011000, - 0x08012000, - 0x08013000, - 0x08014000, - 0x08015000, - 0x08016000, - 0x08017000, - 0x08018000, - 0x08019000, - 0x0801A000, - 0x0801B000, - 0x0801C000, - 0x0801D000, - 0x0801E000, - 0x0801F000, - 0x08020000, - 0x08021000, - 0x08022000, - 0x08023000, - 0x08024000, - 0x08025000, - 0x08026000, - 0x08027000, - 0x08028000, - 0x08029000, - 0x0802A000, - 0x0802B000, - 0x0802C000, - 0x0802D000, - 0x0802E000, - 0x0802F000, - 0x08030000, - 0x08031000, - 0x08032000, - 0x08033000, - 0x08034000, - 0x08035000, - 0x08036000, - 0x08037000, - 0x08038000, - 0x08039000, - 0x0803A000, - 0x0803B000, - 0x0803C000, - 0x0803D000, - 0x0803E000, - 0x0803F000, - 0x08040000, - 0x08041000, - 0x08042000, - 0x08043000, - 0x08044000, - 0x08045000, - 0x08046000, - 0x08047000, - 0x08048000, - 0x08049000, - 0x0804A000, - 0x0804B000, - 0x0804C000, - 0x0804D000, - 0x0804E000, - 0x0804F000, - 0x08050000, - 0x08051000, - 0x08052000, - 0x08053000, - 0x08054000, - 0x08055000, - 0x08056000, - 0x08057000, - 0x08058000, - 0x08059000, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x08089440, - 0x09000000, - 0x09000900, - 0x09001200, - 0x09001B00, - 0x09002400, - 0x09002D00, - 0x09003600, - 0x09003F00, - 0x09004800, - 0x09005100, - 0x09005A00, - 0x09006300, - 0x09006C00, - 0x09007500, - 0x09007E00, - 0x09009000, - 0x09008700, - 0x09007E00, - 0x0900A200, - 0x0900AB00, - 0x0805A000, - 0x0805A900, - 0x0805B200, - 0x02002D40, - 0x02002A40, - 0x02002C40, - 0x02002B40, - 0x02002940, +u32 gItemIcons[] = { + 0x08000000, 0x08001000, 0x08002000, 0x08003000, 0x08004000, 0x08005000, 0x08006000, 0x08007000, 0x08008000, + 0x08009000, 0x0800A000, 0x0800B000, 0x0800C000, 0x0800D000, 0x0800E000, 0x0800F000, 0x08010000, 0x08011000, + 0x08012000, 0x08013000, 0x08014000, 0x08015000, 0x08016000, 0x08017000, 0x08018000, 0x08019000, 0x0801A000, + 0x0801B000, 0x0801C000, 0x0801D000, 0x0801E000, 0x0801F000, 0x08020000, 0x08021000, 0x08022000, 0x08023000, + 0x08024000, 0x08025000, 0x08026000, 0x08027000, 0x08028000, 0x08029000, 0x0802A000, 0x0802B000, 0x0802C000, + 0x0802D000, 0x0802E000, 0x0802F000, 0x08030000, 0x08031000, 0x08032000, 0x08033000, 0x08034000, 0x08035000, + 0x08036000, 0x08037000, 0x08038000, 0x08039000, 0x0803A000, 0x0803B000, 0x0803C000, 0x0803D000, 0x0803E000, + 0x0803F000, 0x08040000, 0x08041000, 0x08042000, 0x08043000, 0x08044000, 0x08045000, 0x08046000, 0x08047000, + 0x08048000, 0x08049000, 0x0804A000, 0x0804B000, 0x0804C000, 0x0804D000, 0x0804E000, 0x0804F000, 0x08050000, + 0x08051000, 0x08052000, 0x08053000, 0x08054000, 0x08055000, 0x08056000, 0x08057000, 0x08058000, 0x08059000, + 0x08089440, 0x08089440, 0x08089440, 0x08089440, 0x08089440, 0x08089440, 0x08089440, 0x08089440, 0x08089440, + 0x08089440, 0x08089440, 0x08089440, 0x09000000, 0x09000900, 0x09001200, 0x09001B00, 0x09002400, 0x09002D00, + 0x09003600, 0x09003F00, 0x09004800, 0x09005100, 0x09005A00, 0x09006300, 0x09006C00, 0x09007500, 0x09007E00, + 0x09009000, 0x09008700, 0x09007E00, 0x0900A200, 0x0900AB00, 0x0805A000, 0x0805A900, 0x0805B200, 0x02002D40, + 0x02002A40, 0x02002C40, 0x02002B40, 0x02002940, }; // Used to map item IDs to inventory slots -u8 gItemSlots[] = -{ - SLOT_STICK, - SLOT_NUT, - SLOT_BOMB, - SLOT_BOW, - SLOT_ARROW_FIRE, - SLOT_DINS_FIRE, - SLOT_SLINGSHOT, - SLOT_OCARINA, - SLOT_OCARINA, - SLOT_BOMBCHU, - SLOT_HOOKSHOT, - SLOT_HOOKSHOT, - SLOT_ARROW_ICE, - SLOT_FARORES_WIND, - SLOT_BOOMERANG, - SLOT_LENS, - SLOT_BEAN, - SLOT_HAMMER, - SLOT_ARROW_LIGHT, - SLOT_NAYRUS_LOVE, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_BOTTLE_1, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_CHILD, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT, - SLOT_TRADE_ADULT +u8 gItemSlots[] = { + SLOT_STICK, SLOT_NUT, SLOT_BOMB, SLOT_BOW, SLOT_ARROW_FIRE, SLOT_DINS_FIRE, + SLOT_SLINGSHOT, SLOT_OCARINA, SLOT_OCARINA, SLOT_BOMBCHU, SLOT_HOOKSHOT, SLOT_HOOKSHOT, + SLOT_ARROW_ICE, SLOT_FARORES_WIND, SLOT_BOOMERANG, SLOT_LENS, SLOT_BEAN, SLOT_HAMMER, + SLOT_ARROW_LIGHT, SLOT_NAYRUS_LOVE, SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_BOTTLE_1, + SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_BOTTLE_1, + SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_BOTTLE_1, SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, + SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, + SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, SLOT_TRADE_CHILD, SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, + SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, + SLOT_TRADE_ADULT, SLOT_TRADE_ADULT, }; -void Inventory_ChangeEquipment(s16 equipment, u16 value) -{ +void Inventory_ChangeEquipment(s16 equipment, u16 value) { gSaveContext.equips.equipment &= gEquipNegMasks[equipment]; gSaveContext.equips.equipment |= value << gEquipShifts[equipment]; } -u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) -{ +u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { Player* player = PLAYER; s32 pad; u16 sp26; @@ -249,18 +82,17 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) // Translates to: "Erasing equipment item = %d zzz=%d" osSyncPrintf("装備アイテム抹消 = %d zzz=%d\n", equipment, sp26); - if (sp26) - { + if (sp26) { sp26 >>= gEquipShifts[equipment]; gSaveContext.equips.equipment &= gEquipNegMasks[equipment]; gSaveContext.equipment ^= gBitFlags[sp26 - 1] << gEquipShifts[equipment]; - if (equipment == EQUIP_TUNIC) + if (equipment == EQUIP_TUNIC) { gSaveContext.equips.equipment |= 0x0100; + } - if (equipment == EQUIP_SWORD) - { + if (equipment == EQUIP_SWORD) { gSaveContext.equips.button_items[0] = ITEM_NONE; gSaveContext.inf_table[29] = 1; } @@ -272,8 +104,7 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) return sp26; } -void Inventory_ChangeUpgrade(s16 upgrade, s16 value) -{ +void Inventory_ChangeUpgrade(s16 upgrade, s16 value) { gSaveContext.upgrades &= gUpgradeNegMasks[upgrade]; gSaveContext.upgrades |= value << gUpgradeShifts[upgrade]; } diff --git a/src/code/code_800A9D40.c b/src/code/code_800A9D40.c index 960994614d..c32d31d4e6 100644 --- a/src/code/code_800A9D40.c +++ b/src/code/code_800A9D40.c @@ -1,23 +1,20 @@ #include #include -typedef struct -{ +typedef struct { /* 0x00 */ OSPiHandle piHandle; /* 0x74 */ OSIoMesg ioMesg; /* 0x8C */ OSMesgQueue mesgQ; } struct_800A9D40; -struct_800A9D40 D_8012A690 = {0}; +struct_800A9D40 D_8012A690 = { 0 }; void func_800A9D40(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration, - u8 handlePulse, u32 handleSpeed) -{ + u8 handlePulse, u32 handleSpeed) { u32 int_disabled; - OSPiHandle *handle = &D_8012A690.piHandle; - if ((u32) OS_PHYSICAL_TO_K1(addr) != (*handle).baseAddress) - { + OSPiHandle* handle = &D_8012A690.piHandle; + if ((u32)OS_PHYSICAL_TO_K1(addr) != (*handle).baseAddress) { D_8012A690.piHandle.type = handleType; (*handle).baseAddress = OS_PHYSICAL_TO_K1(addr); D_8012A690.piHandle.latency = handleLatency; @@ -37,8 +34,7 @@ void func_800A9D40(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u } } -void func_800A9E14(UNK_PTR dramAddr, size_t size, UNK_TYPE arg2) -{ +void func_800A9E14(UNK_PTR dramAddr, size_t size, UNK_TYPE arg2) { OSMesg mesg; osCreateMesgQueue(&D_8012A690.mesgQ, &mesg, 1); @@ -50,8 +46,7 @@ void func_800A9E14(UNK_PTR dramAddr, size_t size, UNK_TYPE arg2) osInvalDCache(dramAddr, size); } -void Sram_ReadWrite(UNK_TYPE arg0, UNK_PTR dramAddr, size_t size, UNK_TYPE arg3) -{ +void Sram_ReadWrite(UNK_TYPE arg0, UNK_PTR dramAddr, size_t size, UNK_TYPE arg3) { osSyncPrintf("ssSRAMReadWrite:%08x %08x %08x %d\n", arg0, dramAddr, size, arg3); func_800A9D40(arg0, 3, 1, 5, 0xd, 2, 0xc, 0); func_800A9E14(dramAddr, size, arg3); diff --git a/src/code/code_800A9F30.c b/src/code/code_800A9F30.c index ad603fabeb..ddc8c02238 100644 --- a/src/code/code_800A9F30.c +++ b/src/code/code_800A9F30.c @@ -5,26 +5,23 @@ extern u8 D_80160FD0[]; extern PadMgr gPadMgr; -void func_800A9F30(s32 a, s32 b) -{ +void func_800A9F30(s32 a, s32 b) { func_800D2E30(&D_80160FD0); func_800C7948(a, &D_80160FD0); } -void func_800A9F6C(f32 a, u8 b, u8 c, u8 d) -{ +void func_800A9F6C(f32 a, u8 b, u8 c, u8 d) { s32 temp1, temp2; - if (1000000.0f < a) + if (1000000.0f < a) { temp1 = 1000; - else + } else { temp1 = sqrtf(a); + } - if ((temp1 < 1000) && (b != 0) && (d != 0)) - { + if ((temp1 < 1000) && (b != 0) && (d != 0)) { temp2 = b - (temp1 * 255) / 1000; - if (temp2 > 0) - { + if (temp2 > 0) { D_801610DA = temp2; D_80160FD0[0x10B] = c; D_80160FD0[0x10C] = d; @@ -35,22 +32,19 @@ void func_800A9F6C(f32 a, u8 b, u8 c, u8 d) #pragma GLOBAL_ASM("asm/non_matchings/code/code_800A9F30/func_800AA000.s") // this function is very similar to the one above but has a loop in it I can't figure out -void func_800AA0B4(void) -{ +void func_800AA0B4(void) { func_800D3140(&D_80160FD0); gPadMgr.unk_460 = func_800A9F30; gPadMgr.unk_464 = 0; - if (0) ; // Necessary to match + if (0) {} // Necessary to match } -void func_800AA0F0(void) -{ +void func_800AA0F0(void) { PadMgr* padmgr = &gPadMgr; - if ((padmgr->unk_460 == func_800A9F30) && (padmgr->unk_464 == 0)) - { + if ((padmgr->unk_460 == func_800A9F30) && (padmgr->unk_464 == 0)) { padmgr->unk_460 = NULL; padmgr->unk_464 = 0; } @@ -58,22 +52,18 @@ void func_800AA0F0(void) func_800D3178(&D_80160FD0); } -u32 func_800AA148(void) -{ +u32 func_800AA148(void) { return ((gPadMgr.unk_2AE[0] ^ 1) == 0); } -void func_800AA15C(void) -{ +void func_800AA15C(void) { D_801610D4 = 2; } -void func_800AA16C(void) -{ +void func_800AA16C(void) { D_801610D4 = 0; } -void func_800AA178(u32 a) -{ +void func_800AA178(u32 a) { D_801610D5 = !!a; } diff --git a/src/code/code_800ACE70.c b/src/code/code_800ACE70.c index 9f606cffac..5bf69cc48b 100644 --- a/src/code/code_800ACE70.c +++ b/src/code/code_800ACE70.c @@ -1,75 +1,63 @@ #include -typedef struct -{ +typedef struct { /* 0x00 */ u32 type; /* 0x04 */ u32 setScissor; - /* 0x08 */ union - { + /* 0x08 */ union { Color_RGBA8 c; u32 rgba; } color; /* 0x0C */ u32 unk_0C; } struct_801664F0; -Gfx D_8012AC00[] = -{ - gsDPSetOtherMode( - G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | - G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), - gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), +Gfx D_8012AC00[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), gsDPPipeSync(), gsDPSetBlendColor(0, 0, 0, 8), gsSPEndDisplayList(), }; -Gfx D_8012AC28[] = -{ - gsDPSetOtherMode( - G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | - G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG,G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), - gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), +Gfx D_8012AC28[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), gsSPEndDisplayList(), }; -Gfx D_8012AC40[] = -{ - gsDPSetOtherMode( - G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | - G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), +Gfx D_8012AC40[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), - gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), gsSPEndDisplayList(), }; -Gfx D_8012AC58[] = -{ +Gfx D_8012AC58[] = { gsDPSetCombineLERP(K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, K5, K5, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE), - gsDPSetOtherMode( - G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | - G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), - gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), - gsDPSetOtherMode( - G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | - G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), - gsDPFillRectangle(0, 0, SCREEN_WIDTH-1, SCREEN_HEIGHT-1), + gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), gsSPEndDisplayList(), }; -//Init func -void func_800ACE70(struct_801664F0* this) -{ +// Init func +void func_800ACE70(struct_801664F0* this) { this->type = 0; this->setScissor = false; this->color.c.r = 0xFF; @@ -78,15 +66,12 @@ void func_800ACE70(struct_801664F0* this) this->color.c.a = 0xFF; } -//Destroy func -void func_800ACE90(struct_801664F0* this) -{ - +// Destroy func +void func_800ACE90(struct_801664F0* this) { } -//Update func -void func_800ACE98(struct_801664F0* this, Gfx** gfxp) -{ +// Update func +void func_800ACE98(struct_801664F0* this, Gfx** gfxp) { Gfx* gfx; gfx = *gfxp; @@ -94,37 +79,27 @@ void func_800ACE98(struct_801664F0* this, Gfx** gfxp) gDPPipeSync(gfx++); gDPSetPrimDepth(gfx++, -1, -1); - if (this->setScissor == true) - { + if (this->setScissor == true) { gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } - - switch(this->type) - { + + switch (this->type) { case 1: - { gSPDisplayList(gfx++, D_8012AC40); break; - } case 2: - { gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); gSPDisplayList(gfx++, D_8012AC58); break; - } case 3: - { gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba); gSPDisplayList(gfx++, D_8012AC00); break; - } case 4: - { gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba); gSPDisplayList(gfx++, D_8012AC28); break; - } - } + } gDPPipeSync(gfx++); *gfxp = gfx; diff --git a/src/code/code_800FBCE0.c b/src/code/code_800FBCE0.c index 2516388830..2c17e6fa28 100644 --- a/src/code/code_800FBCE0.c +++ b/src/code/code_800FBCE0.c @@ -1,10 +1,13 @@ #include -#define printSpStatus(x, name) if (x & SP_STATUS_##name) osSyncPrintf(#name " ") -#define printDpStatus(x, name) if (x & DPC_STATUS_##name) osSyncPrintf(#name " ") +#define printSpStatus(x, name) \ + if (x & SP_STATUS_##name) \ + osSyncPrintf(#name " ") +#define printDpStatus(x, name) \ + if (x & DPC_STATUS_##name) \ + osSyncPrintf(#name " ") -void func_800FBCE0() -{ +void func_800FBCE0() { u32 spStatus = __osSpGetStatus(); u32 dpStatus = osDpGetStatus(); @@ -41,10 +44,9 @@ void func_800FBCE0() osSyncPrintf("\n"); } -void func_800FBFD8() -{ +void func_800FBFD8() { func_800FBCE0(); osDpSetStatus(DPC_SET_FREEZE | DPC_SET_FLUSH); __osSpSetStatus(SP_SET_HALT | SP_SET_SIG2 | SP_CLR_INTR_BREAK); func_800FBCE0(); -} \ No newline at end of file +} diff --git a/src/code/code_800FC620.c b/src/code/code_800FC620.c index 81f0f53e77..b0b16b8b7d 100644 --- a/src/code/code_800FC620.c +++ b/src/code/code_800FC620.c @@ -1,52 +1,44 @@ #include typedef void (*arg3_800FC868)(void*); -typedef void (*arg3_800FC8D8)(void*,u32); -typedef void (*arg3_800FC948)(void*,u32,u32,u32,u32,u32,u32,u32,u32); -typedef void (*arg3_800FCA18)(void*,u32); +typedef void (*arg3_800FC8D8)(void*, u32); +typedef void (*arg3_800FC948)(void*, u32, u32, u32, u32, u32, u32, u32, u32); +typedef void (*arg3_800FCA18)(void*, u32); -typedef struct InitFunc -{ +typedef struct InitFunc { s32 nextOffset; void (*func)(void); } InitFunc; -//.data -void *sInitFuncs = NULL; +// .data +void* sInitFuncs = NULL; -char sNew[4] = -{ - 'n', 'e', 'w', +char sNew[4] = { 'n', 'e', 'w' }; + +char D_80134488[0x18] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00, + 0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, }; -char D_80134488[0x18] = -{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7F, 0x80, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; - -s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, void *allocatedVRamAddr) -{ +s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void* vRamStart, void* vRamEnd, void* allocatedVRamAddr) { u32 pad; u32 end; u32 bssSize; - OverlayRelocationSection *ovl; + OverlayRelocationSection* ovl; u32 relocCnt; u32 ovlOffset; u32 size; - if(gOverlayLogSeverity >= 3) - { + if (gOverlayLogSeverity >= 3) { // Start loading dynamic link function osSyncPrintf("\nダイナミックリンクファンクションのロードを開始します\n"); } - if(gOverlayLogSeverity >= 3) - { + if (gOverlayLogSeverity >= 3) { size = vRomEnd - vRomStart; - //DMA transfer of TEXT, DATA, RODATA + rel (%08x-%08x) - osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedVRamAddr, (u32)allocatedVRamAddr + size); + // DMA transfer of TEXT, DATA, RODATA + rel (%08x-%08x) + osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedVRamAddr, + (u32)allocatedVRamAddr + size); } size = vRomEnd - vRomStart; @@ -56,13 +48,12 @@ s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, voi ovlOffset = ((s32*)end)[-1]; ovl = (OverlayRelocationSection*)((u32)end - ovlOffset); - if(gOverlayLogSeverity >= 3) - { - osSyncPrintf("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovl->textSize, ovl->dataSize, ovl->rodataSize, ovl->bssSize); + if (gOverlayLogSeverity >= 3) { + osSyncPrintf("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovl->textSize, ovl->dataSize, ovl->rodataSize, + ovl->bssSize); } - if(gOverlayLogSeverity >= 3) - { + if (gOverlayLogSeverity >= 3) { // Relocate osSyncPrintf("リロケーションします\n"); } @@ -70,10 +61,8 @@ s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, voi Overlay_DoRelocation(allocatedVRamAddr, ovl, vRamStart); bssSize = ovl->bssSize; - if(bssSize != 0) - { - if(gOverlayLogSeverity >= 3) - { + if (bssSize != 0) { + if (gOverlayLogSeverity >= 3) { // Clear BSS area (% 08x-% 08x) osSyncPrintf("BSS領域をクリアします(%08x-%08x)\n", end, end + ovl->bssSize); } @@ -85,8 +74,7 @@ s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, voi } size = (u32)&ovl->relocations[ovl->nRelocations] - (u32)ovl; - if(gOverlayLogSeverity >= 3) - { + if (gOverlayLogSeverity >= 3) { // Clear REL area (%08x-%08x) osSyncPrintf("REL領域をクリアします(%08x-%08x)\n", ovl, (u32)ovl + size); } @@ -97,8 +85,7 @@ s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, voi osWritebackDCache(allocatedVRamAddr, size); osInvalICache(allocatedVRamAddr, size); - if(gOverlayLogSeverity >= 3) - { + if (gOverlayLogSeverity >= 3) { // Finish loading dynamic link function osSyncPrintf("ダイナミックリンクファンクションのロードを終了します\n\n"); } @@ -106,10 +93,8 @@ s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, voi } // possibly some kind of new() function -void *func_800FC800(u32 size) -{ - if (size == 0) - { +void* func_800FC800(u32 size) { + if (size == 0) { size = 1; } @@ -117,106 +102,87 @@ void *func_800FC800(u32 size) } // possible some kind of delete() function -void func_800FC83C(void *ptr) -{ - if (ptr != NULL) - { +void func_800FC83C(void* ptr) { + if (ptr != NULL) { __osFree(&gSystemArena, ptr); } } -void func_800FC868(void *blk, u32 nBlk, u32 blkSize, arg3_800FC868 arg3) -{ +void func_800FC868(void* blk, u32 nBlk, u32 blkSize, arg3_800FC868 arg3) { u32 pos; - for (pos = (u32)blk; pos < (u32)blk + (nBlk * blkSize); pos = (u32)pos + (blkSize & ~0)) - { + for (pos = (u32)blk; pos < (u32)blk + (nBlk * blkSize); pos = (u32)pos + (blkSize & ~0)) { arg3((void*)pos); } } -void func_800FC8D8(void *blk, u32 nBlk, s32 blkSize, arg3_800FC8D8 arg3) -{ +void func_800FC8D8(void* blk, u32 nBlk, s32 blkSize, arg3_800FC8D8 arg3) { u32 pos; - for (pos = (u32)blk; pos < (u32)blk + (nBlk * blkSize); pos = (u32)pos + (blkSize & ~0)) - { + for (pos = (u32)blk; pos < (u32)blk + (nBlk * blkSize); pos = (u32)pos + (blkSize & ~0)) { arg3((void*)pos, 2); } } -void *func_800FC948(void *blk, u32 nBlk, u32 blkSize, arg3_800FC948 arg3) -{ +void* func_800FC948(void* blk, u32 nBlk, u32 blkSize, arg3_800FC948 arg3) { u32 pos; - if (blk == NULL) - { + if (blk == NULL) { blk = func_800FC800(nBlk * blkSize); } - if (blk != NULL && arg3 != NULL) - { + if (blk != NULL && arg3 != NULL) { pos = (u32)blk; - while(pos < (u32)blk + (nBlk * blkSize)) - { + while (pos < (u32)blk + (nBlk * blkSize)) { arg3((void*)pos, 0, 0, 0, 0, 0, 0, 0, 0); pos = (u32)pos + (blkSize & ~0); } - } return blk; } -void func_800FCA18(void *blk, u32 nBlk, u32 blkSize, arg3_800FCA18 arg3, s32 arg4) -{ +void func_800FCA18(void* blk, u32 nBlk, u32 blkSize, arg3_800FCA18 arg3, s32 arg4) { u32 pos; - u32 end ; + u32 end; s32 masked_arg2; - if (blk == 0) - { + if (blk == 0) { return; } - if (arg3 != 0) - { + if (arg3 != 0) { end = (u32)blk; masked_arg2 = (s32)(blkSize & ~0); pos = (u32)end + (nBlk * blkSize); - if (masked_arg2) { } + if (masked_arg2) {} - while (pos > end) - { + while (pos > end) { do { pos -= masked_arg2; arg3((void*)pos, 2); } while (0); } - if (!masked_arg2){ } + if (!masked_arg2) {} } - if (arg4 != 0) - { + if (arg4 != 0) { func_800FC83C(blk); } } -void func_800FCB34(void) -{ - InitFunc *initFunc; +void func_800FCB34(void) { + InitFunc* initFunc; u32 nextOffset; - InitFunc *prev; + InitFunc* prev; initFunc = (InitFunc*)&sInitFuncs; nextOffset = initFunc->nextOffset; prev = NULL; - while(nextOffset != 0) - { + while (nextOffset != 0) { initFunc = (InitFunc*)((s32)initFunc + nextOffset); - if(initFunc->func != NULL) - { + if (initFunc->func != NULL) { (*initFunc->func)(); } @@ -228,8 +194,7 @@ void func_800FCB34(void) sInitFuncs = prev; } -void SystemHeap_Init(void *start, u32 size) -{ +void SystemHeap_Init(void* start, u32 size) { SystemArena_Init(start, size); func_800FCB34(); -} \ No newline at end of file +} diff --git a/src/code/code_800FCE80.c b/src/code/code_800FCE80.c index 60afd1dfb7..5180c24447 100644 --- a/src/code/code_800FCE80.c +++ b/src/code/code_800FCE80.c @@ -4,65 +4,47 @@ s32 use_cfrac; -f32 Math_tanf(f32 x) -{ +f32 Math_tanf(f32 x) { f32 sin = sinf(x); f32 cos = cosf(x); return sin / cos; } -f32 Math_floorf(f32 x) -{ +f32 Math_floorf(f32 x) { return floorf(x); } -f32 Math_ceilf(f32 x) -{ +f32 Math_ceilf(f32 x) { return ceilf(x); } -f32 Math_roundf(f32 x) -{ +f32 Math_roundf(f32 x) { return roundf(x); } -f32 Math_truncf(f32 x) -{ +f32 Math_truncf(f32 x) { return truncf(x); } -f32 Math_nearbyintf(f32 x) -{ +f32 Math_nearbyintf(f32 x) { return nearbyintf(x); } /* Arctangent approximation using a Taylor series (one quadrant) */ -f32 Math_atanf_taylor_q(f32 x) -{ - static const f32 coeffs[] = - { - -1.f / 3, - +1.f / 5, - -1.f / 7, - +1.f / 9, - -1.f / 11, - +1.f / 13, - -1.f / 15, - +1.f / 17, - 0.f, +f32 Math_atanf_taylor_q(f32 x) { + static const f32 coeffs[] = { + -1.f / 3, +1.f / 5, -1.f / 7, +1.f / 9, -1.f / 11, +1.f / 13, -1.f / 15, +1.f / 17, 0.f, }; f32 poly = x; f32 sq = SQ(x); f32 exp = x * sq; - const f32 *c = coeffs; + const f32* c = coeffs; f32 term; - while (1) - { + while (1) { term = *c++ * exp; - if (poly + term == poly) - { + if (poly + term == poly) { break; } poly = poly + term; @@ -73,157 +55,107 @@ f32 Math_atanf_taylor_q(f32 x) } /* Ditto for two quadrants */ -f32 Math_atanf_taylor(f32 x) -{ +f32 Math_atanf_taylor(f32 x) { f32 t; f32 q; - if (x > 0.f) - { + if (x > 0.f) { t = x; - } - else if (x < 0.f) - { + } else if (x < 0.f) { t = -x; - } - else if (x == 0.f) - { + } else if (x == 0.f) { return 0.f; - } - else - { + } else { return qNaN0x10000; } - if (t <= M_SQRT2 - 1.f) - { + if (t <= M_SQRT2 - 1.f) { return Math_atanf_taylor_q(x); } - if (t >= M_SQRT2 + 1.f) - { + if (t >= M_SQRT2 + 1.f) { q = M_PI / 2 - Math_atanf_taylor_q(1.f / t); - } - else - { + } else { q = M_PI / 4 - Math_atanf_taylor_q((1.f - t) / (1.f + t)); } - if (x > 0.f) - { + if (x > 0.f) { return q; - } - else - { + } else { return -q; } } /* Arctangent approximation using a continued fraction */ -f32 Math_atanf_cfrac(f32 x) -{ +f32 Math_atanf_cfrac(f32 x) { s32 sector; f32 z; f32 conv; f32 sq; s32 i; - if (x >= -1.f && x <= 1.f) - { + if (x >= -1.f && x <= 1.f) { sector = 0; - } - else if (x > 1.f) - { + } else if (x > 1.f) { sector = 1; x = 1.f / x; - } - else if (x < -1.f) - { + } else if (x < -1.f) { sector = -1; x = 1.f / x; - } - else - { + } else { return qNaN0x10000; } sq = SQ(x); conv = 0.f; z = 8.f; - for (i = 8; i != 0; i--) - { + for (i = 8; i != 0; i--) { conv = SQ(z) * sq / (2.f * z + 1.f + conv); z -= 1.f; } conv = x / (1.f + conv); - if (sector == 0) - { + if (sector == 0) { return conv; - } - else if (sector > 0) - { + } else if (sector > 0) { return M_PI / 2 - conv; - } - else - { + } else { return -M_PI / 2 - conv; } } -f32 Math_atanf(f32 x) -{ - if (use_cfrac == 0) - { +f32 Math_atanf(f32 x) { + if (use_cfrac == 0) { return Math_atanf_taylor(x); - } - else - { + } else { return Math_atanf_cfrac(x); } } -f32 Math_atan2f(f32 y, f32 x) -{ - if (x == 0.f) - { - if (y == 0.f) - { +f32 Math_atan2f(f32 y, f32 x) { + if (x == 0.f) { + if (y == 0.f) { return 0.f; - } - else if (y > 0.f) - { + } else if (y > 0.f) { return M_PI / 2; - } - else if (y < 0.f) - { + } else if (y < 0.f) { return -M_PI / 2; - } - else - { + } else { return qNaN0x10000; } - } - else if (x >= 0.f) - { + } else if (x >= 0.f) { return Math_atanf(y / x); - } - else if (y < 0.f) - { + } else if (y < 0.f) { return Math_atanf(y / x) - M_PI; - } - else - { + } else { return M_PI - Math_atanf(-(y / x)); } } -f32 Math_asinf(f32 x) -{ +f32 Math_asinf(f32 x) { return Math_atan2f(x, sqrtf(1.f - SQ(x))); } -f32 Math_acosf(f32 x) -{ +f32 Math_acosf(f32 x) { return M_PI / 2 - Math_asinf(x); } diff --git a/src/code/db_camera.c b/src/code/db_camera.c index e0580f6b7c..b1e858e638 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -80,4 +80,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B958C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B9638.s") - diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index 6e63e1c4a6..789e382af6 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -1,131 +1,112 @@ #include -#define LOG_SEVERITY_NOLOG 0 -#define LOG_SEVERITY_ERROR 2 -#define LOG_SEVERITY_VERBOSE 3 +#define LOG_SEVERITY_NOLOG 0 +#define LOG_SEVERITY_ERROR 2 +#define LOG_SEVERITY_VERBOSE 3 s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR; Arena sDebugArena; -void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) -{ - if (!ptr) - { - if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR) - { +void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { + if (!ptr) { + if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR) { //"%s: %u bytes %s failed\n" osSyncPrintf("%s: %u バイトの%sに失敗しました\n", name, size, action); - __osDisplayArena(&sDebugArena); + __osDisplayArena(&sDebugArena); return; } - } - else if (gDebugArenaLogSeverity >= LOG_SEVERITY_VERBOSE) - { + } else if (gDebugArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { //"%s: %u bytes %s succeeded\n" osSyncPrintf("%s: %u バイトの%sに成功しました\n", name, size, action); } } -void* DebugArena_Malloc(u32 size) -{ +void* DebugArena_Malloc(u32 size) { void* ptr; ptr = __osMalloc(&sDebugArena, size); - DebugArena_CheckPointer(ptr, size, "debug_malloc", "確保"); //Secure + DebugArena_CheckPointer(ptr, size, "debug_malloc", "確保"); // Secure return ptr; } -void* DebugArena_MallocDebug(u32 size, const char* file, s32 line) -{ +void* DebugArena_MallocDebug(u32 size, const char* file, s32 line) { void* ptr; ptr = __osMallocDebug(&sDebugArena, size, file, line); - DebugArena_CheckPointer(ptr, size, "debug_malloc_DEBUG", "確保"); //Secure + DebugArena_CheckPointer(ptr, size, "debug_malloc_DEBUG", "確保"); // Secure return ptr; } -void* DebugArena_MallocR(u32 size) -{ +void* DebugArena_MallocR(u32 size) { void* ptr; ptr = __osMallocR(&sDebugArena, size); - DebugArena_CheckPointer(ptr, size, "debug_malloc_r", "確保"); //Secure + DebugArena_CheckPointer(ptr, size, "debug_malloc_r", "確保"); // Secure return ptr; } -void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line) -{ +void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line) { void* ptr; ptr = __osMallocRDebug(&sDebugArena, size, file, line); - DebugArena_CheckPointer(ptr, size, "debug_malloc_r_DEBUG", "確保"); //Secure + DebugArena_CheckPointer(ptr, size, "debug_malloc_r_DEBUG", "確保"); // Secure return ptr; } -void* DebugArena_Realloc(void* ptr, u32 newSize) -{ +void* DebugArena_Realloc(void* ptr, u32 newSize) { ptr = __osRealloc(&sDebugArena, ptr, newSize); DebugArena_CheckPointer(ptr, newSize, "debug_realloc", "再確保"); // Re-securing return ptr; } -void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) -{ +void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line); DebugArena_CheckPointer(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // Re-securing return ptr; } -void DebugArena_Free(void* ptr) -{ +void DebugArena_Free(void* ptr) { __osFree(&sDebugArena, ptr); } -void DebugArena_FreeDebug(void* ptr, const char* file, s32 line) -{ +void DebugArena_FreeDebug(void* ptr, const char* file, s32 line) { __osFreeDebug(&sDebugArena, ptr, file, line); } -void* DebugArena_Calloc(u32 num, u32 size) -{ +void* DebugArena_Calloc(u32 num, u32 size) { void* ret; u32 n; - - n = num*size; + + n = num * size; ret = __osMalloc(&sDebugArena, n); - if (ret) + if (ret) { bzero(ret, n); + } DebugArena_CheckPointer(ret, n, "debug_calloc", "確保"); return ret; } -void DebugArena_Display() -{ - //Zelda heap display (devs forgot to change "Zelda" to "Debug" apparently) +void DebugArena_Display() { + // Zelda heap display (devs forgot to change "Zelda" to "Debug" apparently) osSyncPrintf("ゼルダヒープ表示\n"); __osDisplayArena(&sDebugArena); } -void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) -{ +void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaImpl_GetSizes(&sDebugArena, outMaxFree, outFree, outAlloc); } -void DebugArena_Check() -{ +void DebugArena_Check() { __osCheckArena(&sDebugArena); } -void DebugArena_Init(void* start, u32 size) -{ +void DebugArena_Init(void* start, u32 size) { gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; __osMallocInit(&sDebugArena, start, size); } -void DebugArena_Cleanup() -{ +void DebugArena_Cleanup() { gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; __osMallocCleanup(&sDebugArena); } -u8 DebugArena_IsInitalized() -{ +u8 DebugArena_IsInitalized() { return __osMallocIsInitalized(&sDebugArena); } diff --git a/src/code/fault.c b/src/code/fault.c index 4af2d6c606..7884c50578 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -3,9 +3,8 @@ #include #include -//data -const char* sExceptionNames[] = -{ +// data +const char* sExceptionNames[] = { "Interrupt", "TLB modification", "TLB exception on load", @@ -32,7 +31,7 @@ const char* sExceptionNames[] = "Inexact operation", }; -//bss +// bss FaultThreadStruct* sFaultStructPtr; u8 sFaultIsWaitingForInput; char sFaultStack[0x600]; @@ -41,23 +40,22 @@ FaultThreadStruct gFaultStruct; #pragma GLOBAL_ASM("asm/non_matchings/code/fault/pad_800D3F10.s") -void Fault_SleepImpl(u32 duration) -{ +void Fault_SleepImpl(u32 duration) { u64 value = (duration * OS_CPU_COUNTER) / 1000ull; func_800FF3A0(value); } -void Fault_ClientProcessThread(FaultClientContext* ctx) -{ - if (ctx->callback) +void Fault_ClientProcessThread(FaultClientContext* ctx) { + if (ctx->callback) { ctx->ret = ctx->callback(ctx->param0, ctx->param1); + } - if (ctx->queue) + if (ctx->queue) { osSendMesg(ctx->queue, ctx->msg, 1); + } } -void Fault_ProcessClientContext(FaultClientContext* ctx) -{ +void Fault_ProcessClientContext(FaultClientContext* ctx) { OSMesgQueue queue; OSMesg msg; OSMesg recMsg; @@ -72,27 +70,23 @@ void Fault_ProcessClientContext(FaultClientContext* ctx) ctx->queue = &queue; ctx->msg = NULL; - if (sFaultStructPtr->currClientThreadSp != 0) - { + if (sFaultStructPtr->currClientThreadSp != 0) { thread = alloca(sizeof(OSThread)); osCreateThread(thread, 2, Fault_ClientProcessThread, ctx, sFaultStructPtr->currClientThreadSp, 0x7E); osStartThread(thread); - } - else - { + } else { Fault_ClientProcessThread(ctx); } - while (true) - { + while (true) { osSetTimer(&timer, OS_USEC_TO_CYCLES(1000000), 0, &queue, (OSMesg)timerMsgVal); osRecvMesg(&queue, &recMsg, 1); - if (recMsg != (OSMesg)666) + if (recMsg != (OSMesg)666) { break; + } - if (!sFaultIsWaitingForInput) - { + if (!sFaultIsWaitingForInput) { ctx->ret = -1; break; } @@ -100,15 +94,13 @@ void Fault_ProcessClientContext(FaultClientContext* ctx) osStopTimer(&timer); - if (thread != NULL) - { + if (thread != NULL) { osStopThread(thread); osDestroyThread(thread); } } -u32 Fault_ProcessClient(u32 callback, u32 param0, u32 param1) -{ +u32 Fault_ProcessClient(u32 callback, u32 param0, u32 param1) { FaultClientContext a; a.callback = callback; a.param0 = param0; @@ -120,8 +112,7 @@ u32 Fault_ProcessClient(u32 callback, u32 param0, u32 param1) #ifdef NON_MATCHING // minor ordering differences -void Fault_AddClient(FaultClient* client, void* callback, void* param0, void* param1) -{ +void Fault_AddClient(FaultClient* client, void* callback, void* param0, void* param1) { OSIntMask mask; u32 alreadyExists; FaultClient* iter; @@ -130,10 +121,8 @@ void Fault_AddClient(FaultClient* client, void* callback, void* param0, void* pa mask = osSetIntMask(1); iter = sFaultStructPtr->clients; - while (iter) - { - if (iter == client) - { + while (iter) { + if (iter == client) { alreadyExists = true; goto end; } @@ -188,8 +177,9 @@ void Fault_RemoveClient(FaultClient* client) { osSetIntMask(mask); - if (listIsEmpty) + if (listIsEmpty) { osSyncPrintf(VT_COL(RED, WHITE) "fault_RemoveClient: %08x リスト不整合です\n" VT_RST, client); + } } #pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_AddAddrConvClient.s") @@ -228,24 +218,23 @@ void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) { osSetIntMask(mask); if (listIsEmpty) { - osSyncPrintf(VT_COL(RED, WHITE) "fault_AddressConverterRemoveClient: %08x は既にリスト中にある\n" VT_RST, client); + osSyncPrintf(VT_COL(RED, WHITE) "fault_AddressConverterRemoveClient: %08x は既にリスト中にある\n" VT_RST, + client); } } -u32 Fault_ConvertAddress(FaultAddrConvClient* client) -{ +u32 Fault_ConvertAddress(FaultAddrConvClient* client) { u32 ret; FaultAddrConvClient* iter = sFaultStructPtr->addrConvClients; - while(iter) - { - if (iter->callback) - { + while (iter) { + if (iter->callback) { ret = Fault_ProcessClient(iter->callback, client, iter->param); - if (ret == -1) + if (ret == -1) { Fault_RemoveAddrConvClient(iter); - else if (ret) + } else if (ret) { return ret; + } } iter = iter->next; } @@ -253,35 +242,29 @@ u32 Fault_ConvertAddress(FaultAddrConvClient* client) return 0; } -void Fault_Sleep(u32 duration) -{ +void Fault_Sleep(u32 duration) { Fault_SleepImpl(duration); } -void Fault_PadCallback(Input* input) -{ - //BUG: this function is not called correctly and thus will crash from reading a bad pointer at 0x800C7E4C +void Fault_PadCallback(Input* input) { + // BUG: this function is not called correctly and thus will crash from reading a bad pointer at 0x800C7E4C func_800C7E08(input, 0); } -void Fault_UpdatePadImpl() -{ +void Fault_UpdatePadImpl() { sFaultStructPtr->padCallback(&sFaultStructPtr->padInput); } #ifdef NON_MATCHING // ordering differences and possibly regalloc -u32 Fault_WaitForInputImpl() -{ +u32 Fault_WaitForInputImpl() { u16 kDown; u32 exitDebugger; s32 count = 600; Input* curInput = &sFaultStructPtr->padInput; - while (true) - { - while (true) - { + while (true) { + while (true) { Fault_Sleep(0x10); Fault_UpdatePadImpl(); @@ -316,71 +299,63 @@ u32 Fault_WaitForInputImpl() #pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_WaitForInputImpl.s") #endif -void Fault_WaitForInput() -{ +void Fault_WaitForInput() { sFaultIsWaitingForInput = 1; Fault_WaitForInputImpl(); sFaultIsWaitingForInput = 0; } -void Fault_DrawRec(s32 x, s32 y, s32 w, s32 h, u16 color) -{ +void Fault_DrawRec(s32 x, s32 y, s32 w, s32 h, u16 color) { FaultDrawer_DrawRecImpl(x, y, x + w - 1, y + h - 1, color); } -void Fault_FillScreenBlack() -{ +void Fault_FillScreenBlack() { FaultDrawer_SetForeColor(0xFFFF); FaultDrawer_SetBackColor(1); FaultDrawer_FillScreen(); FaultDrawer_SetBackColor(0); } -void Fault_FillScreenRed() -{ +void Fault_FillScreenRed() { FaultDrawer_SetForeColor(0xFFFF); FaultDrawer_SetBackColor(0xF001); FaultDrawer_FillScreen(); FaultDrawer_SetBackColor(0); } -void Fault_DrawCornerRec(u16 color) -{ +void Fault_DrawCornerRec(u16 color) { Fault_DrawRec(0x16, 0x10, 8, 1, color); } -void Fault_PrintFReg(s32 idx, f32* value) -{ +void Fault_PrintFReg(s32 idx, f32* value) { u32 raw = *(u32*)value; s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f; - if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) + if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) { FaultDrawer_Printf("F%02d:%14.7e ", idx, *value); - else + } else { FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw); + } } -void Fault_LogFReg(s32 idx, f32* value) -{ +void Fault_LogFReg(s32 idx, f32* value) { u32 raw = *(u32*)value; s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f; - if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) + if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) { osSyncPrintf("F%02d:%14.7e ", idx, *value); - else + } else { osSyncPrintf("F%02d: %08x(16) ", idx, *(u32*)value); + } } -void Fault_PrintFPCR(u32 value) -{ +void Fault_PrintFPCR(u32 value) { s32 i; u32 flag = 0x20000; FaultDrawer_Printf("FPCSR:%08xH ", value); - for (i = 0; i < 6; i++) - { - if (value & flag) - { - FaultDrawer_Printf("(%s)", sExceptionNames[i+18]); + for (i = 0; i < 6; i++) { + if (value & flag) { + FaultDrawer_Printf("(%s)", sExceptionNames[i + 18]); break; } flag >>= 1; @@ -388,30 +363,28 @@ void Fault_PrintFPCR(u32 value) FaultDrawer_Printf("\n"); } -void Fault_LogFPCR(u32 value) -{ +void Fault_LogFPCR(u32 value) { s32 i; u32 flag = 0x20000; osSyncPrintf("FPCSR:%08xH ", value); - for (i = 0; i < 6; i++) - { - if (value & flag) - { - osSyncPrintf("(%s)\n", sExceptionNames[i+18]); + for (i = 0; i < 6; i++) { + if (value & flag) { + osSyncPrintf("(%s)\n", sExceptionNames[i + 18]); break; } flag >>= 1; } } -void Fault_PrintThreadContext(OSThread* t) -{ - __OSThreadContext *ctx; - s32 causeStrIdx = (s32) ((((u32) t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; - if (causeStrIdx == 0x17) +void Fault_PrintThreadContext(OSThread* t) { + __OSThreadContext* ctx; + s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; + if (causeStrIdx == 0x17) { causeStrIdx = 0x10; - if (causeStrIdx == 0x1f) + } + if (causeStrIdx == 0x1f) { causeStrIdx = 0x11; + } FaultDrawer_FillScreen(); FaultDrawer_SetCharPad(-2, 4); @@ -462,14 +435,15 @@ void Fault_PrintThreadContext(OSThread* t) FaultDrawer_SetCharPad(0, 0); } -void Fault_LogThreadContext(OSThread* t) -{ - __OSThreadContext *ctx; - s32 causeStrIdx = (s32) ((((u32) t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; - if (causeStrIdx == 0x17) +void Fault_LogThreadContext(OSThread* t) { + __OSThreadContext* ctx; + s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10; + if (causeStrIdx == 0x17) { causeStrIdx = 0x10; - if (causeStrIdx == 0x1f) + } + if (causeStrIdx == 0x1f) { causeStrIdx = 0x11; + } ctx = &t->context; osSyncPrintf("\n"); @@ -515,26 +489,23 @@ void Fault_LogThreadContext(OSThread* t) osSyncPrintf("\n"); } -OSThread* Fault_FindFaultedThread() -{ +OSThread* Fault_FindFaultedThread() { OSThread* iter = func_80104140(); - while (iter->priority != -1) - { - if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) + while (iter->priority != -1) { + if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) { return iter; + } iter = iter->tlnext; } return NULL; } -void Fault_Wait5Seconds(void) -{ - OSTime start[2]; //to make the function allocate 0x28 bytes of stack instead of 0x20 +void Fault_Wait5Seconds(void) { + OSTime start[2]; // to make the function allocate 0x28 bytes of stack instead of 0x20 start[0] = osGetTime(); - do - { + do { Fault_Sleep(0x10); - } while ((osGetTime() - start[0]) < OS_USEC_TO_CYCLES(5000000)+1); //0xdf84759 + } while ((osGetTime() - start[0]) < OS_USEC_TO_CYCLES(5000000) + 1); // 0xdf84759 sFaultStructPtr->faultActive = true; } @@ -561,7 +532,7 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) { Fault_FillScreenBlack(); FaultDrawer_SetCharPad(-2, 0); - FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title? title : "PrintDump", alignedAddr); + FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title ? title : "PrintDump", alignedAddr); if (alignedAddr >= (u32*)0x80000000 && alignedAddr < (u32*)0xC0000000) { for (y = 0x1C; y != 0xE2; y += 9) { FaultDrawer_DrawText(0x18, y, "%06x", writeAddr); @@ -577,15 +548,13 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) { #ifdef NON_MATCHING // saved register and stack usage differences // possibly some minor ordering and regalloc differences -void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) -{ +void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) { Input* curInput = &sFaultStructPtr->padInput; u32 addr = pc; s32 count; s32 off; - while (true) - { + while (true) { if (addr < 0x80000000) addr = 0x80000000; if (addr > 0x807fff00) @@ -595,8 +564,7 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) Fault_DrawMemDumpPage("Dump", (u32*)addr, 0); count = 600; - while (sFaultStructPtr->faultActive) - { + while (sFaultStructPtr->faultActive) { if (count == 0) return; @@ -607,8 +575,7 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) sFaultStructPtr->faultActive = false; } - do - { + do { Fault_Sleep(0x10); Fault_UpdatePadImpl(); } while (curInput->padPressed == 0); @@ -652,8 +619,7 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) #pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_LogStackTrace.s") -void Fault_ResumeThread(OSThread* t) -{ +void Fault_ResumeThread(OSThread* t) { t->context.cause = 0; t->context.fpcsr = 0; t->context.pc += 4; @@ -663,39 +629,39 @@ void Fault_ResumeThread(OSThread* t) osStartThread(t); } -void Fault_CommitFB() -{ +void Fault_CommitFB() { u16* fb; osViSetYScale(1.0f); osViSetMode(&osViModeNtscLan1); - osViSetSpecialFeatures(0x42); //gama_disable|dither_fliter_enable_aa_mode3_disable + osViSetSpecialFeatures(0x42); // gama_disable|dither_fliter_enable_aa_mode3_disable osViBlack(false); - if (sFaultStructPtr->fb) + if (sFaultStructPtr->fb) { fb = sFaultStructPtr->fb; - else - { + } else { fb = (u16*)osViGetNextFramebuffer(); - if ((u32)fb == 0x80000000) + if ((u32)fb == 0x80000000) { fb = (u16*)((osMemSize | 0x80000000) - 0x25800); + } } osViSwapBuffer(fb); FaultDrawer_SetDrawerFB(fb, 0x140, 0xf0); } -void Fault_ProcessClients(void) -{ +void Fault_ProcessClients(void) { FaultClient* iter = sFaultStructPtr->clients; s32 idx = 0; - while(iter) - { - if (iter->callback) - { + while (iter) { + if (iter->callback) { Fault_FillScreenBlack(); FaultDrawer_SetCharPad(-2, 0); - FaultDrawer_Printf("\x1a""8CallBack (%d) %08x %08x %08x\n""\x1a""7", idx++, iter, iter->param1, iter->param2); + FaultDrawer_Printf("\x1a" + "8CallBack (%d) %08x %08x %08x\n" + "\x1a" + "7", + idx++, iter, iter->param1, iter->param2); FaultDrawer_SetCharPad(0, 0); Fault_ProcessClient(iter->callback, iter->param1, iter->param2); Fault_WaitForInput(); @@ -705,45 +671,34 @@ void Fault_ProcessClients(void) } } -void Fault_UpdatePad() -{ +void Fault_UpdatePad() { Fault_UpdatePadImpl(); } #ifdef NON_MATCHING // saved register and stack usage differences -void Fault_ThreadEntry(void* arg) -{ +void Fault_ThreadEntry(void* arg) { OSThread* faultedThread; OSMesg msg; osSetEventMesg(OS_EVENT_CPU_BREAK, &sFaultStructPtr->queue, 1); osSetEventMesg(OS_EVENT_FAULT, &sFaultStructPtr->queue, 2); - while (true) - { - do - { + while (true) { + do { osRecvMesg(&sFaultStructPtr->queue, &msg, 1); - if (msg == (OSMesg)1) - { + if (msg == (OSMesg)1) { sFaultStructPtr->msgId = 1; osSyncPrintf("フォルトマネージャ:OS_EVENT_CPU_BREAKを受信しました\n"); - } - else if (1 && msg == (OSMesg)2) - { + } else if (1 && msg == (OSMesg)2) { sFaultStructPtr->msgId = 2; osSyncPrintf("フォルトマネージャ:OS_EVENT_FAULTを受信しました\n"); - } - else if (msg == (OSMesg)3) - { + } else if (msg == (OSMesg)3) { Fault_UpdatePad(); faultedThread = NULL; continue; - } - else - { + } else { sFaultStructPtr->msgId = 3; osSyncPrintf("フォルトマネージャ:不明なメッセージを受信しました\n"); } @@ -751,8 +706,7 @@ void Fault_ThreadEntry(void* arg) faultedThread = __osGetCurrFaultedThread(); osSyncPrintf("__osGetCurrFaultedThread()=%08x\n", faultedThread); - if (faultedThread == NULL) - { + if (faultedThread == NULL) { faultedThread = Fault_FindFaultedThread(); osSyncPrintf("FindFaultedThread()=%08x\n", faultedThread); } @@ -769,8 +723,7 @@ void Fault_ThreadEntry(void* arg) if (sFaultStructPtr->faultActive) Fault_Wait5Seconds(); - else - { + else { Fault_DrawCornerRec(0xF801); Fault_WaitForButtonCombo(); } @@ -779,8 +732,7 @@ void Fault_ThreadEntry(void* arg) FaultDrawer_SetForeColor(0xFFFF); FaultDrawer_SetBackColor(0); - do - { + do { Fault_PrintThreadContext(faultedThread); Fault_LogThreadContext(faultedThread); Fault_WaitForInput(); @@ -799,10 +751,7 @@ void Fault_ThreadEntry(void* arg) Fault_WaitForInput(); } while (!sFaultStructPtr->exitDebugger); - while (!sFaultStructPtr->exitDebugger) - { - - } + while (!sFaultStructPtr->exitDebugger) {} Fault_ResumeThread(faultedThread); } @@ -811,14 +760,12 @@ void Fault_ThreadEntry(void* arg) #pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_ThreadEntry.s") #endif -void Fault_SetFB(void* fb, u16 w, u16 h) -{ +void Fault_SetFB(void* fb, u16 w, u16 h) { sFaultStructPtr->fb = fb; FaultDrawer_SetDrawerFB(fb, w, h); } -void Fault_Start(void) -{ +void Fault_Start(void) { sFaultStructPtr = &gFaultStruct; bzero(sFaultStructPtr, sizeof(FaultThreadStruct)); FaultDrawer_SetDefault(); @@ -832,13 +779,12 @@ void Fault_Start(void) sFaultStructPtr->faultActive = false; gFaultStruct.faultHandlerEnabled = true; osCreateMesgQueue(&sFaultStructPtr->queue, &sFaultStructPtr->msg, 1); - StackCheck_Init(sFaultThreadInfo, &sFaultStack, sFaultStack+sizeof(sFaultStack), 0, 0x100, "fault"); + StackCheck_Init(sFaultThreadInfo, &sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, "fault"); osCreateThread(&sFaultStructPtr->thread, 2, &Fault_ThreadEntry, 0, sFaultThreadInfo, 0x7f); osStartThread(&sFaultStructPtr->thread); } -void Fault_HangupFaultClient(const char* arg0, const char* arg1) -{ +void Fault_HangupFaultClient(const char* arg0, const char* arg1) { osSyncPrintf("HungUp on Thread %d\n", osGetThreadId(0)); osSyncPrintf("%s\n", arg0 ? arg0 : "(NULL)"); osSyncPrintf("%s\n", arg1 ? arg1 : "(NULL)"); @@ -847,16 +793,14 @@ void Fault_HangupFaultClient(const char* arg0, const char* arg1) FaultDrawer_Printf("%s\n", arg1 ? arg1 : "(NULL)"); } -void Fault_AddHungupAndCrashImpl(const char* arg0, const char* arg1) -{ +void Fault_AddHungupAndCrashImpl(const char* arg0, const char* arg1) { FaultClient client; char padd[4]; Fault_AddClient(&client, &Fault_HangupFaultClient, arg0, arg1); - *(u32*)0x11111111 = 0; //trigger an exception + *(u32*)0x11111111 = 0; // trigger an exception } -void Fault_AddHungupAndCrash(const char* filename, u32 line) -{ +void Fault_AddHungupAndCrash(const char* filename, u32 line) { char msg[256]; sprintf(msg, "HungUp %s:%d", filename, line); Fault_AddHungupAndCrashImpl(msg, NULL); diff --git a/src/code/fault_drawer.c b/src/code/fault_drawer.c index 82a7e83b05..8d85af18b3 100644 --- a/src/code/fault_drawer.c +++ b/src/code/fault_drawer.c @@ -2,77 +2,72 @@ #include #include -//rodata +// rodata const u32 sFaultDrawerFont[] = { - 0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700, - 0x01562990, 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000, - 0x08BFFB00, 0x0EFFFFC0, 0x0BF00FB0, 0x0FF00330, 0x0FF00FF0, 0x0FF00220, 0x0CFBBF60, 0x0FFCCE20, - 0x0DD44FF0, 0x0FF00220, 0x0FF00FF0, 0x0FF00330, 0x0CFBBF40, 0x0EF77740, 0x00000000, 0x00000000, - 0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700, - 0x01562990, 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000, - 0x08BFFB00, 0x000DE000, 0x0BF00FB0, 0x005DE600, 0x0FF00FF0, 0x055CC660, 0x0CFBBF60, 0x773FF377, - 0x0DD44FF0, 0xBB3FF3BB, 0x0FF00FF0, 0x099CCAA0, 0x0CFBBF40, 0x009DEA00, 0x00000000, 0x000DE000, - 0x04C22C40, 0x028D5020, 0x0CCAACC0, 0x21F91710, 0x04C22C40, 0x12493400, 0x00820800, 0x01975110, - 0x088A8880, 0x04615241, 0x00800800, 0x43117530, 0x00A20800, 0x60055600, 0x00000000, 0x04400040, - 0x00221100, 0x00000080, 0x000FB000, 0x00000880, 0x040DA400, 0x00008800, 0x08CDE880, 0x022AA220, - 0x08CDE880, 0x02AA2220, 0x040DA400, 0x0CD10000, 0x000FB000, 0x8C510000, 0x00221100, 0x81100000, - 0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700, - 0x01562990, 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000, - 0x00333300, 0x04489980, 0x033CC330, 0x00CD1088, 0x033CC330, 0x02BF62A8, 0x00333320, 0x01104C80, - 0x01100330, 0x0015C800, 0x033CC330, 0x02673220, 0x003FF300, 0x04409900, 0x00880000, 0x00000000, - 0x05DFFD10, 0x07FFFF60, 0x1CE00EC1, 0x0FF00990, 0x1EE11661, 0x0FF00110, 0x1EF45621, 0x0FF66710, - 0x1EF23661, 0x0FF08990, 0x1EF10FE1, 0x0FF00990, 0x16ECCE21, 0x07FBBB20, 0x01111110, 0x00000000, - 0x09B66FD0, 0x27D88E60, 0x0992ED10, 0x2FF02EE0, 0x099AE510, 0x2FF62EE0, 0x099B7510, 0x2FD64EE0, - 0x0DDAE510, 0x2FD04EE0, 0x0DD2ED10, 0x2FD00EE0, 0x09F66F90, 0x27D99F70, 0x00000000, 0x00000000, - 0x07FFFF00, 0x8F711FF0, 0x2FD00FF0, 0x8F711FF0, 0x2FD00770, 0x8E611EE0, 0x27DDDF60, 0x8E691EE0, - 0x27764AA0, 0x8EE99EE0, 0x2FD06E80, 0x8AE7FEA0, 0x07FA8E60, 0x88277A80, 0x00000000, 0x00000000, - 0x077CCFF0, 0x13266011, 0x077CCFF0, 0x03766510, 0x0239D720, 0x04533540, 0x002FF200, 0x01133110, - 0x005FB100, 0x00033000, 0x055EE550, 0x01133110, 0x055EEDD0, 0x02233000, 0x00088880, 0x8AABB888, - 0x00001100, 0x00044510, 0x04623320, 0x00440110, 0x04C89AA0, 0x00EEAB10, 0x0CE66720, 0x0EF55FB0, - 0x0EE00660, 0x0BF62B90, 0x0EE00660, 0x03FC8990, 0x04EEEEA0, 0x00773BB0, 0x00000000, 0x08888800, - 0x09900000, 0x00111000, 0x09922440, 0x00011000, 0x09908800, 0x26EFDE20, 0x099BB540, 0x2EC33CE2, - 0x0D9A2550, 0x2EC33CE2, 0x0DDAA550, 0x2EC33CE2, 0x09D6ED10, 0x26CBBC62, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00011000, 0x05FBFFE0, 0x8E6116E8, 0x0FF40330, 0x8F7117F8, - 0x07FC8B30, 0x8E6996E8, 0x05733BA0, 0x8A6DD6A8, 0x0DD88A20, 0x08A779B2, 0x01100220, 0x00000000, - 0x00000080, 0x8A011000, 0x00000800, 0x80A11000, 0x07744F70, 0x80A99000, 0x0231DF20, 0x84E60004, - 0x0027DA20, 0xC8AA4C40, 0x00573B20, 0x00A11800, 0x05546F50, 0x00A99800, 0x02222080, 0x02001888, + 0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700, 0x01562990, + 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000, 0x08BFFB00, 0x0EFFFFC0, + 0x0BF00FB0, 0x0FF00330, 0x0FF00FF0, 0x0FF00220, 0x0CFBBF60, 0x0FFCCE20, 0x0DD44FF0, 0x0FF00220, 0x0FF00FF0, + 0x0FF00330, 0x0CFBBF40, 0x0EF77740, 0x00000000, 0x00000000, 0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, + 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700, 0x01562990, 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, + 0x026EF700, 0x00000000, 0x00000000, 0x08BFFB00, 0x000DE000, 0x0BF00FB0, 0x005DE600, 0x0FF00FF0, 0x055CC660, + 0x0CFBBF60, 0x773FF377, 0x0DD44FF0, 0xBB3FF3BB, 0x0FF00FF0, 0x099CCAA0, 0x0CFBBF40, 0x009DEA00, 0x00000000, + 0x000DE000, 0x04C22C40, 0x028D5020, 0x0CCAACC0, 0x21F91710, 0x04C22C40, 0x12493400, 0x00820800, 0x01975110, + 0x088A8880, 0x04615241, 0x00800800, 0x43117530, 0x00A20800, 0x60055600, 0x00000000, 0x04400040, 0x00221100, + 0x00000080, 0x000FB000, 0x00000880, 0x040DA400, 0x00008800, 0x08CDE880, 0x022AA220, 0x08CDE880, 0x02AA2220, + 0x040DA400, 0x0CD10000, 0x000FB000, 0x8C510000, 0x00221100, 0x81100000, 0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, + 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700, 0x01562990, 0x05589760, 0x0DD22990, 0x05599770, + 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000, 0x00333300, 0x04489980, 0x033CC330, 0x00CD1088, 0x033CC330, + 0x02BF62A8, 0x00333320, 0x01104C80, 0x01100330, 0x0015C800, 0x033CC330, 0x02673220, 0x003FF300, 0x04409900, + 0x00880000, 0x00000000, 0x05DFFD10, 0x07FFFF60, 0x1CE00EC1, 0x0FF00990, 0x1EE11661, 0x0FF00110, 0x1EF45621, + 0x0FF66710, 0x1EF23661, 0x0FF08990, 0x1EF10FE1, 0x0FF00990, 0x16ECCE21, 0x07FBBB20, 0x01111110, 0x00000000, + 0x09B66FD0, 0x27D88E60, 0x0992ED10, 0x2FF02EE0, 0x099AE510, 0x2FF62EE0, 0x099B7510, 0x2FD64EE0, 0x0DDAE510, + 0x2FD04EE0, 0x0DD2ED10, 0x2FD00EE0, 0x09F66F90, 0x27D99F70, 0x00000000, 0x00000000, 0x07FFFF00, 0x8F711FF0, + 0x2FD00FF0, 0x8F711FF0, 0x2FD00770, 0x8E611EE0, 0x27DDDF60, 0x8E691EE0, 0x27764AA0, 0x8EE99EE0, 0x2FD06E80, + 0x8AE7FEA0, 0x07FA8E60, 0x88277A80, 0x00000000, 0x00000000, 0x077CCFF0, 0x13266011, 0x077CCFF0, 0x03766510, + 0x0239D720, 0x04533540, 0x002FF200, 0x01133110, 0x005FB100, 0x00033000, 0x055EE550, 0x01133110, 0x055EEDD0, + 0x02233000, 0x00088880, 0x8AABB888, 0x00001100, 0x00044510, 0x04623320, 0x00440110, 0x04C89AA0, 0x00EEAB10, + 0x0CE66720, 0x0EF55FB0, 0x0EE00660, 0x0BF62B90, 0x0EE00660, 0x03FC8990, 0x04EEEEA0, 0x00773BB0, 0x00000000, + 0x08888800, 0x09900000, 0x00111000, 0x09922440, 0x00011000, 0x09908800, 0x26EFDE20, 0x099BB540, 0x2EC33CE2, + 0x0D9A2550, 0x2EC33CE2, 0x0DDAA550, 0x2EC33CE2, 0x09D6ED10, 0x26CBBC62, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00011000, 0x05FBFFE0, 0x8E6116E8, 0x0FF40330, 0x8F7117F8, 0x07FC8B30, 0x8E6996E8, + 0x05733BA0, 0x8A6DD6A8, 0x0DD88A20, 0x08A779B2, 0x01100220, 0x00000000, 0x00000080, 0x8A011000, 0x00000800, + 0x80A11000, 0x07744F70, 0x80A99000, 0x0231DF20, 0x84E60004, 0x0027DA20, 0xC8AA4C40, 0x00573B20, 0x00A11800, + 0x05546F50, 0x00A99800, 0x02222080, 0x02001888, }; -//data -FaultDrawer sFaultDrawerDefault = -{ - (u16*)0x803DA800, //fb - 320, 240, //w, h - 16, 223, //yStart, yEnd - 22, 297,//xStart, xEnd - 0xFFFF, 0x0000, //foreColor, backColor - 22, 16, //cursorX, cursorY - sFaultDrawerFont, //font +// data +// clang-format off +FaultDrawer sFaultDrawerDefault = { + (u16*)0x803DA800, // fb + 320, 240, // w, h + 16, 223, // yStart, yEnd + 22, 297, // xStart, xEnd + 0xFFFF, 0x0000, // foreColor, backColor + 22, 16, // cursorX, cursorY + sFaultDrawerFont, // font 8, 8, 0, 0, - { //printColors + { // printColors 0x0001, 0xF801, 0x07C1, 0xFFC1, 0x003F, 0xF83F, 0x07FF, 0xFFFF, 0x7BDF, 0xB5AD }, - 0, //escCode - 0, //osSyncPrintfEnabled - NULL, //inputCallback + 0, // escCode + 0, // osSyncPrintfEnabled + NULL, // inputCallback }; +// clang-format on -//bss +// bss FaultDrawer sFaultDrawerStruct; char D_8016B6C0[0x20]; //? unused -void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) -{ +void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) { sFaultDrawerStruct.osSyncPrintfEnabled = enabled; } #ifdef NON_MATCHING -void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 color) -{ - if (sFaultDrawerStruct.w - xstart > 0 && sFaultDrawerStruct.h - ystart > 0) - { +void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 color) { + if (sFaultDrawerStruct.w - xstart > 0 && sFaultDrawerStruct.h - ystart > 0) { s32 x, y; for (y = 0; y <= yend - ystart; y++) @@ -88,8 +83,7 @@ void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 col #ifdef NON_MATCHING // regalloc and minor ordering differences -void FaultDrawer_DrawChar(char c) -{ +void FaultDrawer_DrawChar(char c) { s32 x, y; u32* dataPtr; u16* fb; @@ -102,14 +96,11 @@ void FaultDrawer_DrawChar(char c) if ((sFaultDrawerStruct.xStart <= sFaultDrawerStruct.cursorX) && ((sFaultDrawerStruct.charW + sFaultDrawerStruct.cursorX - 1) <= sFaultDrawerStruct.xEnd) && (sFaultDrawerStruct.yStart <= sFaultDrawerStruct.cursorY) && - ((sFaultDrawerStruct.charH + sFaultDrawerStruct.cursorY - 1) <= sFaultDrawerStruct.yEnd)) - { - for (y = 0; y < sFaultDrawerStruct.charH; y++) - { + ((sFaultDrawerStruct.charH + sFaultDrawerStruct.cursorY - 1) <= sFaultDrawerStruct.yEnd)) { + for (y = 0; y < sFaultDrawerStruct.charH; y++) { u32 mask = 0x10000000 << (c % 4); u32 data = *dataPtr; - for (x = 0; x < sFaultDrawerStruct.charW; x++) - { + for (x = 0; x < sFaultDrawerStruct.charW; x++) { if (mask & data) fb[x] = sFaultDrawerStruct.foreColor; else if (sFaultDrawerStruct.backColor & 1) @@ -125,93 +116,89 @@ void FaultDrawer_DrawChar(char c) #pragma GLOBAL_ASM("asm/non_matchings/code/fault_drawer/FaultDrawer_DrawChar.s") #endif -s32 FaultDrawer_ColorToPrintColor(u16 color) -{ +s32 FaultDrawer_ColorToPrintColor(u16 color) { s32 i; - for (i = 0; i < 10; i++) - if (color == sFaultDrawerStruct.printColors[i]) + for (i = 0; i < 10; i++) { + if (color == sFaultDrawerStruct.printColors[i]) { return i; + } + } return -1; } -void FaultDrawer_UpdatePrintColor() -{ +void FaultDrawer_UpdatePrintColor() { s32 idx; - if (sFaultDrawerStruct.osSyncPrintfEnabled) - { + if (sFaultDrawerStruct.osSyncPrintfEnabled) { osSyncPrintf(VT_RST); idx = FaultDrawer_ColorToPrintColor(sFaultDrawerStruct.foreColor); - if (idx >= 0 && idx < 8) + if (idx >= 0 && idx < 8) { osSyncPrintf(VT_SGR("3%d"), idx); + } idx = FaultDrawer_ColorToPrintColor(sFaultDrawerStruct.backColor); - if (idx >= 0 && idx < 8) + if (idx >= 0 && idx < 8) { osSyncPrintf(VT_SGR("4%d"), idx); + } } } -void FaultDrawer_SetForeColor(u16 color) -{ +void FaultDrawer_SetForeColor(u16 color) { sFaultDrawerStruct.foreColor = color; FaultDrawer_UpdatePrintColor(); } -void FaultDrawer_SetBackColor(u16 color) -{ +void FaultDrawer_SetBackColor(u16 color) { sFaultDrawerStruct.backColor = color; FaultDrawer_UpdatePrintColor(); } -void FaultDrawer_SetFontColor(u16 color) -{ - FaultDrawer_SetForeColor((u16)(color | 1)); //force alpha to be set +void FaultDrawer_SetFontColor(u16 color) { + FaultDrawer_SetForeColor((u16)(color | 1)); // force alpha to be set } -void FaultDrawer_SetCharPad(s8 padW, s8 padH) -{ +void FaultDrawer_SetCharPad(s8 padW, s8 padH) { sFaultDrawerStruct.charWPad = padW; sFaultDrawerStruct.charHPad = padH; } -void FaultDrawer_SetCursor(s32 x, s32 y) -{ - if (sFaultDrawerStruct.osSyncPrintfEnabled) - osSyncPrintf(VT_CUP("%d", "%d"), (y - sFaultDrawerStruct.yStart) / (sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad), (x - sFaultDrawerStruct.xStart) / (sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad)); +void FaultDrawer_SetCursor(s32 x, s32 y) { + if (sFaultDrawerStruct.osSyncPrintfEnabled) { + osSyncPrintf(VT_CUP("%d", "%d"), + (y - sFaultDrawerStruct.yStart) / (sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad), + (x - sFaultDrawerStruct.xStart) / (sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad)); + } sFaultDrawerStruct.cursorX = x; sFaultDrawerStruct.cursorY = y; } -void FaultDrawer_FillScreen() -{ - if (sFaultDrawerStruct.osSyncPrintfEnabled) +void FaultDrawer_FillScreen() { + if (sFaultDrawerStruct.osSyncPrintfEnabled) { osSyncPrintf(VT_CLS); + } - FaultDrawer_DrawRecImpl(sFaultDrawerStruct.xStart, sFaultDrawerStruct.yStart, sFaultDrawerStruct.xEnd, sFaultDrawerStruct.yEnd, sFaultDrawerStruct.backColor | 1); + FaultDrawer_DrawRecImpl(sFaultDrawerStruct.xStart, sFaultDrawerStruct.yStart, sFaultDrawerStruct.xEnd, + sFaultDrawerStruct.yEnd, sFaultDrawerStruct.backColor | 1); FaultDrawer_SetCursor(sFaultDrawerStruct.xStart, sFaultDrawerStruct.yStart); } -u32 FaultDrawer_FormatStringFunc(u32 arg0, const char* str, s32 count) -{ - for (count; count != 0; count--, str++) - { +u32 FaultDrawer_FormatStringFunc(u32 arg0, const char* str, s32 count) { + for (count; count != 0; count--, str++) { s32 curXStart; s32 curXEnd; - if (sFaultDrawerStruct.escCode) - { + if (sFaultDrawerStruct.escCode) { sFaultDrawerStruct.escCode = false; - if (*str > 0x30 && *str < 0x3A) + if (*str > 0x30 && *str < 0x3A) { FaultDrawer_SetForeColor(sFaultDrawerStruct.printColors[*str - 0x30]); + } curXStart = sFaultDrawerStruct.cursorX; curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW; - } - else - { - switch (*str) - { + } else { + switch (*str) { case '\n': - if (sFaultDrawerStruct.osSyncPrintfEnabled) + if (sFaultDrawerStruct.osSyncPrintfEnabled) { osSyncPrintf("\n"); + } sFaultDrawerStruct.cursorX = sFaultDrawerStruct.w; curXStart = sFaultDrawerStruct.cursorX; @@ -223,8 +210,9 @@ u32 FaultDrawer_FormatStringFunc(u32 arg0, const char* str, s32 count) curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW; break; default: - if (sFaultDrawerStruct.osSyncPrintfEnabled) + if (sFaultDrawerStruct.osSyncPrintfEnabled) { osSyncPrintf("%c", *str); + } FaultDrawer_DrawChar(*str); sFaultDrawerStruct.cursorX += sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad; @@ -234,14 +222,11 @@ u32 FaultDrawer_FormatStringFunc(u32 arg0, const char* str, s32 count) } } - if (curXEnd <= curXStart) - { + if (curXEnd <= curXStart) { sFaultDrawerStruct.cursorX = sFaultDrawerStruct.xStart; sFaultDrawerStruct.cursorY += sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad; - if (sFaultDrawerStruct.yEnd - sFaultDrawerStruct.charH <= sFaultDrawerStruct.cursorY) - { - if (sFaultDrawerStruct.inputCallback) - { + if (sFaultDrawerStruct.yEnd - sFaultDrawerStruct.charH <= sFaultDrawerStruct.cursorY) { + if (sFaultDrawerStruct.inputCallback) { sFaultDrawerStruct.inputCallback(); FaultDrawer_FillScreen(); } @@ -255,21 +240,18 @@ u32 FaultDrawer_FormatStringFunc(u32 arg0, const char* str, s32 count) return arg0; } -void FaultDrawer_VPrintf(const char* str, char* args) //va_list -{ +void FaultDrawer_VPrintf(const char* str, char* args) { // va_list _Printf(&FaultDrawer_FormatStringFunc, &sFaultDrawerStruct, str, args); } -void FaultDrawer_Printf(const char* fmt, ...) -{ +void FaultDrawer_Printf(const char* fmt, ...) { va_list args; va_start(args, fmt); FaultDrawer_VPrintf(fmt, args); } -void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) -{ +void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) { va_list args; va_start(args, fmt); @@ -277,25 +259,21 @@ void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...) FaultDrawer_VPrintf(fmt, args); } -void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) -{ +void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h) { sFaultDrawerStruct.fb = (u16*)fb; sFaultDrawerStruct.w = w; sFaultDrawerStruct.h = h; } -void FaultDrawer_SetInputCallback(void(*callback)()) -{ +void FaultDrawer_SetInputCallback(void (*callback)()) { sFaultDrawerStruct.inputCallback = callback; } -void FaultDrawer_WritebackFBDCache() -{ - osWritebackDCache(sFaultDrawerStruct.fb, sFaultDrawerStruct.w*sFaultDrawerStruct.h*2); +void FaultDrawer_WritebackFBDCache() { + osWritebackDCache(sFaultDrawerStruct.fb, sFaultDrawerStruct.w * sFaultDrawerStruct.h * 2); } -void FaultDrawer_SetDefault() -{ +void FaultDrawer_SetDefault() { bcopy(&sFaultDrawerDefault, &sFaultDrawerStruct, sizeof(FaultDrawer)); sFaultDrawerStruct.fb = (u16*)((osMemSize | 0x80000000) - 0x25800); } diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index 87a32db16b..9ec6886b2f 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -1,26 +1,22 @@ #include -void GameAlloc_Log(GameAlloc* this) -{ +void GameAlloc_Log(GameAlloc* this) { GameAllocEntry* iter; osSyncPrintf("this = %08x\n", this); iter = this->base.next; - while (iter != &this->base) - { + while (iter != &this->base) { osSyncPrintf("ptr = %08x size = %d\n", iter, iter->size); iter = iter->next; } } -void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) -{ +void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) { GameAllocEntry* ptr; - ptr = SystemArena_MallocDebug(size+sizeof(GameAllocEntry), file, line); - if (ptr) - { + ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line); + if (ptr) { ptr->size = size; ptr->prev = this->head; this->head->next = ptr; @@ -28,18 +24,16 @@ void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 lin ptr->next = &this->base; this->base.prev = this->head; return ptr + 1; - } - else + } else { return NULL; + } } -void* GameAlloc_Malloc(GameAlloc* this, u32 size) -{ +void* GameAlloc_Malloc(GameAlloc* this, u32 size) { GameAllocEntry* ptr; - ptr = SystemArena_MallocDebug(size+sizeof(GameAllocEntry), "../gamealloc.c", 93); - if (ptr) - { + ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), "../gamealloc.c", 93); + if (ptr) { ptr->size = size; ptr->prev = this->head; this->head->next = ptr; @@ -47,17 +41,15 @@ void* GameAlloc_Malloc(GameAlloc* this, u32 size) ptr->next = &this->base; this->base.prev = this->head; return ptr + 1; - } - else + } else { return NULL; + } } -void GameAlloc_Free(GameAlloc* this, void* data) -{ +void GameAlloc_Free(GameAlloc* this, void* data) { GameAllocEntry* ptr; - if (data) - { + if (data) { ptr = &((GameAllocEntry*)data)[-1]; LogUtils_CheckNullPointer("ptr->prev", ptr->prev, "../gamealloc.c", 120); LogUtils_CheckNullPointer("ptr->next", ptr->next, "../gamealloc.c", 121); @@ -68,14 +60,12 @@ void GameAlloc_Free(GameAlloc* this, void* data) } } -void GameAlloc_Cleanup(GameAlloc* this) -{ +void GameAlloc_Cleanup(GameAlloc* this) { GameAllocEntry* next; GameAllocEntry* cur; next = this->base.next; - while (&this->base != next) - { + while (&this->base != next) { cur = next; next = next->next; SystemArena_FreeDebug(cur, "../gamealloc.c", 145); @@ -84,11 +74,9 @@ void GameAlloc_Cleanup(GameAlloc* this) this->head = &this->base; this->base.next = &this->base; this->base.prev = &this->base; - } -void GameAlloc_Init(GameAlloc* this) -{ +void GameAlloc_Init(GameAlloc* this) { this->head = &this->base; this->base.next = &this->base; this->base.prev = &this->base; diff --git a/src/code/gfxprint.c b/src/code/gfxprint.c index 340d4702a7..fbcca3cee5 100644 --- a/src/code/gfxprint.c +++ b/src/code/gfxprint.c @@ -1,188 +1,196 @@ #include #include -//.bss +// .bss u8 D_801755F0; -//.data -u16 sGfxPrintFontTLUT[64] = -{ - 0x0000, 0xFFFF, 0x0000, 0xFFFF, - 0x0000, 0xFFFF, 0x0000, 0xFFFF, - 0x0000, 0xFFFF, 0x0000, 0xFFFF, - 0x0000, 0xFFFF, 0x0000, 0xFFFF, - 0x0000, 0x0000, 0xFFFF, 0xFFFF, - 0x0000, 0x0000, 0xFFFF, 0xFFFF, - 0x0000, 0x0000, 0xFFFF, 0xFFFF, - 0x0000, 0x0000, 0xFFFF, 0xFFFF, - 0x0000, 0x0000, 0x0000, 0x0000, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0x0000, 0x0000, 0x0000, 0x0000, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, - 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, +// .data +u16 sGfxPrintFontTLUT[64] = { + 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0xFFFF, 0x0000, + 0xFFFF, 0x0000, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, + 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, }; -u16 sGfxPrintUnkTLUT[16] = -{ - 0xF801, 0xFBC1, 0xFFC1, 0x07C1, - 0x0421, 0x003F, 0x803F, 0xF83F, - 0xF801, 0xFBC1, 0xFFC1, 0x07C1, - 0x0421, 0x003F, 0x803F, 0xF83F, +u16 sGfxPrintUnkTLUT[16] = { + 0xF801, 0xFBC1, 0xFFC1, 0x07C1, 0x0421, 0x003F, 0x803F, 0xF83F, + 0xF801, 0xFBC1, 0xFFC1, 0x07C1, 0x0421, 0x003F, 0x803F, 0xF83F, }; u8 sGfxPrintUnkData[8] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }; -u8 sGfxPrintFontData[(16*256)/2] = -{ - 0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00, - 0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0xBF, 0xFB, 0x00, 0x0E, 0xFF, 0xFF, 0xC0, 0x0B, 0xF0, 0x0F, 0xB0, 0x0F, 0xF0, 0x03, 0x30, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0xF0, 0x02, 0x20, 0x0C, 0xFB, 0xBF, 0x60, 0x0F, 0xFC, 0xCE, 0x20, - 0x0D, 0xD4, 0x4F, 0xF0, 0x0F, 0xF0, 0x02, 0x20, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0xF0, 0x03, 0x30, 0x0C, 0xFB, 0xBF, 0x40, 0x0E, 0xF7, 0x77, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00, - 0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0xBF, 0xFB, 0x00, 0x00, 0x0D, 0xE0, 0x00, 0x0B, 0xF0, 0x0F, 0xB0, 0x00, 0x5D, 0xE6, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x05, 0x5C, 0xC6, 0x60, 0x0C, 0xFB, 0xBF, 0x60, 0x77, 0x3F, 0xF3, 0x77, - 0x0D, 0xD4, 0x4F, 0xF0, 0xBB, 0x3F, 0xF3, 0xBB, 0x0F, 0xF0, 0x0F, 0xF0, 0x09, 0x9C, 0xCA, 0xA0, 0x0C, 0xFB, 0xBF, 0x40, 0x00, 0x9D, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xE0, 0x00, - 0x04, 0xC2, 0x2C, 0x40, 0x02, 0x8D, 0x50, 0x20, 0x0C, 0xCA, 0xAC, 0xC0, 0x21, 0xF9, 0x17, 0x10, 0x04, 0xC2, 0x2C, 0x40, 0x12, 0x49, 0x34, 0x00, 0x00, 0x82, 0x08, 0x00, 0x01, 0x97, 0x51, 0x10, - 0x08, 0x8A, 0x88, 0x80, 0x04, 0x61, 0x52, 0x41, 0x00, 0x80, 0x08, 0x00, 0x43, 0x11, 0x75, 0x30, 0x00, 0xA2, 0x08, 0x00, 0x60, 0x05, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x40, - 0x00, 0x22, 0x11, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0F, 0xB0, 0x00, 0x00, 0x00, 0x08, 0x80, 0x04, 0x0D, 0xA4, 0x00, 0x00, 0x00, 0x88, 0x00, 0x08, 0xCD, 0xE8, 0x80, 0x02, 0x2A, 0xA2, 0x20, - 0x08, 0xCD, 0xE8, 0x80, 0x02, 0xAA, 0x22, 0x20, 0x04, 0x0D, 0xA4, 0x00, 0x0C, 0xD1, 0x00, 0x00, 0x00, 0x0F, 0xB0, 0x00, 0x8C, 0x51, 0x00, 0x00, 0x00, 0x22, 0x11, 0x00, 0x81, 0x10, 0x00, 0x00, - 0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00, - 0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x33, 0x33, 0x00, 0x04, 0x48, 0x99, 0x80, 0x03, 0x3C, 0xC3, 0x30, 0x00, 0xCD, 0x10, 0x88, 0x03, 0x3C, 0xC3, 0x30, 0x02, 0xBF, 0x62, 0xA8, 0x00, 0x33, 0x33, 0x20, 0x01, 0x10, 0x4C, 0x80, - 0x01, 0x10, 0x03, 0x30, 0x00, 0x15, 0xC8, 0x00, 0x03, 0x3C, 0xC3, 0x30, 0x02, 0x67, 0x32, 0x20, 0x00, 0x3F, 0xF3, 0x00, 0x04, 0x40, 0x99, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0xDF, 0xFD, 0x10, 0x07, 0xFF, 0xFF, 0x60, 0x1C, 0xE0, 0x0E, 0xC1, 0x0F, 0xF0, 0x09, 0x90, 0x1E, 0xE1, 0x16, 0x61, 0x0F, 0xF0, 0x01, 0x10, 0x1E, 0xF4, 0x56, 0x21, 0x0F, 0xF6, 0x67, 0x10, - 0x1E, 0xF2, 0x36, 0x61, 0x0F, 0xF0, 0x89, 0x90, 0x1E, 0xF1, 0x0F, 0xE1, 0x0F, 0xF0, 0x09, 0x90, 0x16, 0xEC, 0xCE, 0x21, 0x07, 0xFB, 0xBB, 0x20, 0x01, 0x11, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x09, 0xB6, 0x6F, 0xD0, 0x27, 0xD8, 0x8E, 0x60, 0x09, 0x92, 0xED, 0x10, 0x2F, 0xF0, 0x2E, 0xE0, 0x09, 0x9A, 0xE5, 0x10, 0x2F, 0xF6, 0x2E, 0xE0, 0x09, 0x9B, 0x75, 0x10, 0x2F, 0xD6, 0x4E, 0xE0, - 0x0D, 0xDA, 0xE5, 0x10, 0x2F, 0xD0, 0x4E, 0xE0, 0x0D, 0xD2, 0xED, 0x10, 0x2F, 0xD0, 0x0E, 0xE0, 0x09, 0xF6, 0x6F, 0x90, 0x27, 0xD9, 0x9F, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0xFF, 0xFF, 0x00, 0x8F, 0x71, 0x1F, 0xF0, 0x2F, 0xD0, 0x0F, 0xF0, 0x8F, 0x71, 0x1F, 0xF0, 0x2F, 0xD0, 0x07, 0x70, 0x8E, 0x61, 0x1E, 0xE0, 0x27, 0xDD, 0xDF, 0x60, 0x8E, 0x69, 0x1E, 0xE0, - 0x27, 0x76, 0x4A, 0xA0, 0x8E, 0xE9, 0x9E, 0xE0, 0x2F, 0xD0, 0x6E, 0x80, 0x8A, 0xE7, 0xFE, 0xA0, 0x07, 0xFA, 0x8E, 0x60, 0x88, 0x27, 0x7A, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x7C, 0xCF, 0xF0, 0x13, 0x26, 0x60, 0x11, 0x07, 0x7C, 0xCF, 0xF0, 0x03, 0x76, 0x65, 0x10, 0x02, 0x39, 0xD7, 0x20, 0x04, 0x53, 0x35, 0x40, 0x00, 0x2F, 0xF2, 0x00, 0x01, 0x13, 0x31, 0x10, - 0x00, 0x5F, 0xB1, 0x00, 0x00, 0x03, 0x30, 0x00, 0x05, 0x5E, 0xE5, 0x50, 0x01, 0x13, 0x31, 0x10, 0x05, 0x5E, 0xED, 0xD0, 0x02, 0x23, 0x30, 0x00, 0x00, 0x08, 0x88, 0x80, 0x8A, 0xAB, 0xB8, 0x88, - 0x00, 0x00, 0x11, 0x00, 0x00, 0x04, 0x45, 0x10, 0x04, 0x62, 0x33, 0x20, 0x00, 0x44, 0x01, 0x10, 0x04, 0xC8, 0x9A, 0xA0, 0x00, 0xEE, 0xAB, 0x10, 0x0C, 0xE6, 0x67, 0x20, 0x0E, 0xF5, 0x5F, 0xB0, - 0x0E, 0xE0, 0x06, 0x60, 0x0B, 0xF6, 0x2B, 0x90, 0x0E, 0xE0, 0x06, 0x60, 0x03, 0xFC, 0x89, 0x90, 0x04, 0xEE, 0xEE, 0xA0, 0x00, 0x77, 0x3B, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0x88, 0x00, - 0x09, 0x90, 0x00, 0x00, 0x00, 0x11, 0x10, 0x00, 0x09, 0x92, 0x24, 0x40, 0x00, 0x01, 0x10, 0x00, 0x09, 0x90, 0x88, 0x00, 0x26, 0xEF, 0xDE, 0x20, 0x09, 0x9B, 0xB5, 0x40, 0x2E, 0xC3, 0x3C, 0xE2, - 0x0D, 0x9A, 0x25, 0x50, 0x2E, 0xC3, 0x3C, 0xE2, 0x0D, 0xDA, 0xA5, 0x50, 0x2E, 0xC3, 0x3C, 0xE2, 0x09, 0xD6, 0xED, 0x10, 0x26, 0xCB, 0xBC, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x05, 0xFB, 0xFF, 0xE0, 0x8E, 0x61, 0x16, 0xE8, 0x0F, 0xF4, 0x03, 0x30, 0x8F, 0x71, 0x17, 0xF8, - 0x07, 0xFC, 0x8B, 0x30, 0x8E, 0x69, 0x96, 0xE8, 0x05, 0x73, 0x3B, 0xA0, 0x8A, 0x6D, 0xD6, 0xA8, 0x0D, 0xD8, 0x8A, 0x20, 0x08, 0xA7, 0x79, 0xB2, 0x01, 0x10, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x8A, 0x01, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x80, 0xA1, 0x10, 0x00, 0x07, 0x74, 0x4F, 0x70, 0x80, 0xA9, 0x90, 0x00, 0x02, 0x31, 0xDF, 0x20, 0x84, 0xE6, 0x00, 0x04, - 0x00, 0x27, 0xDA, 0x20, 0xC8, 0xAA, 0x4C, 0x40, 0x00, 0x57, 0x3B, 0x20, 0x00, 0xA1, 0x18, 0x00, 0x05, 0x54, 0x6F, 0x50, 0x00, 0xA9, 0x98, 0x00, 0x02, 0x22, 0x20, 0x80, 0x02, 0x00, 0x18, 0x88, - 0x00, 0x04, 0x44, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40, 0x0C, 0x44, 0x44, 0x00, 0x00, 0x04, 0x40, 0x00, 0x88, 0xC0, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x0C, 0x46, 0xA4, 0x40, - 0x00, 0x0C, 0xC0, 0x00, 0x08, 0x8E, 0xE0, 0x00, 0x02, 0x08, 0x80, 0x00, 0x80, 0xD0, 0x88, 0x00, 0x28, 0xA8, 0x80, 0x00, 0x88, 0xCD, 0x4C, 0x40, 0x0A, 0x88, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0x00, 0x80, 0x01, 0x06, 0x10, 0x00, 0x56, 0xE7, 0x50, 0x80, 0x02, 0x1F, 0xF1, 0x00, - 0x38, 0x8C, 0xB8, 0x00, 0x0B, 0xF6, 0x0B, 0x00, 0x94, 0xC0, 0x28, 0x00, 0x06, 0x07, 0x6A, 0x00, 0xCB, 0xA6, 0xC8, 0x00, 0x00, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0A, 0x80, 0x00, 0x00, 0x39, 0x14, 0x20, 0x02, 0x22, 0x24, 0x00, 0x08, 0xAE, 0xA8, 0x60, 0x04, 0x28, 0x99, 0x70, 0x07, 0x75, 0xD1, 0x04, 0x0F, 0xB3, 0x33, 0xD0, 0x00, 0xAE, 0xBE, 0xA4, - 0x25, 0x15, 0x20, 0xA0, 0x02, 0x61, 0x0C, 0x02, 0x20, 0x42, 0x08, 0x20, 0x2C, 0x30, 0x14, 0x02, 0x02, 0x28, 0x82, 0x00, 0x03, 0xAC, 0xC1, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x08, 0x12, 0x00, 0x08, 0x00, 0x28, 0x00, 0x0A, 0xCF, 0xEE, 0x20, 0x0B, 0x62, 0x2E, 0x20, 0x02, 0x10, 0x82, 0x40, 0x01, 0x44, 0xE4, 0x40, 0x03, 0x00, 0x0E, 0x00, 0x8D, 0xEA, 0xAC, 0x00, - 0x02, 0x10, 0x0A, 0x00, 0x01, 0xE0, 0x24, 0x00, 0x0C, 0x21, 0x02, 0x00, 0x09, 0x42, 0x21, 0x00, 0x00, 0xCC, 0xF4, 0x40, 0x02, 0xBF, 0xD4, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x0C, 0xCC, 0xC4, 0x40, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x02, 0xA0, 0x40, - 0x00, 0x0C, 0xC0, 0x00, 0x04, 0xCE, 0x64, 0x40, 0x02, 0x08, 0x80, 0x00, 0x00, 0x90, 0x00, 0x40, 0x28, 0xA8, 0x80, 0x00, 0x08, 0x01, 0x04, 0x00, 0x0A, 0x88, 0x80, 0x00, 0x04, 0x44, 0x40, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x54, 0x44, 0x00, 0xEE, 0xFE, 0xE0, 0x00, 0x09, 0x3B, 0x3F, 0x00, - 0x21, 0xD8, 0x20, 0x00, 0x00, 0x54, 0x4F, 0x00, 0x18, 0x58, 0x20, 0x00, 0x00, 0x01, 0x86, 0x00, 0xC6, 0x7E, 0x40, 0x00, 0x00, 0xEF, 0x66, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x04, 0x00, 0x00, 0xC0, 0x20, 0x00, 0xAA, 0xAA, 0xEA, 0x20, 0xEF, 0xFF, 0xFF, 0x00, 0x80, 0x44, 0x19, 0x30, 0x00, 0x49, 0x24, 0x00, 0xC5, 0x35, 0x1B, 0x10, 0x00, 0x4B, 0x24, 0x00, - 0x01, 0x35, 0xA0, 0x00, 0x8C, 0xA9, 0xAC, 0x80, 0x00, 0x2C, 0x00, 0x00, 0x04, 0x21, 0xA4, 0x00, 0x2A, 0x84, 0x00, 0x00, 0x73, 0x11, 0xF1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0B, 0x11, 0x19, 0x00, 0x00, 0x40, 0x00, 0x00, 0x8F, 0xEE, 0xEF, 0xE0, 0x0B, 0x76, 0x66, 0xD0, 0x1A, 0x00, 0x0B, 0x40, 0x4C, 0x40, 0x02, 0xD0, 0x28, 0x00, 0x1A, 0x40, 0x01, 0xD0, 0x2C, 0x10, - 0x00, 0x00, 0x38, 0x40, 0x00, 0x40, 0x28, 0x10, 0x00, 0x01, 0xA0, 0x40, 0x00, 0x42, 0x83, 0x00, 0x05, 0xFE, 0x44, 0x40, 0x03, 0xFD, 0x54, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x09, 0x99, 0x9B, 0x00, 0x00, 0x10, 0x20, 0x00, 0x07, 0x26, 0x21, 0x40, 0x2A, 0xFE, 0xEE, 0xA0, 0x8D, 0x8C, 0xA9, 0xC0, 0x00, 0x10, 0x20, 0x80, 0x32, 0x33, 0xB3, 0x60, 0x00, 0x19, 0x28, 0x00, - 0x00, 0x00, 0xA1, 0x40, 0x00, 0x10, 0xB1, 0x00, 0x00, 0x08, 0x34, 0x00, 0x00, 0x1A, 0x08, 0x00, 0x05, 0xF7, 0x40, 0x00, 0x8E, 0xF4, 0x44, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x14, 0x02, 0x80, 0x00, 0x04, 0x00, 0x00, 0x1D, 0x11, 0xDB, 0x00, 0xDD, 0xFD, 0xDD, 0xD0, 0x0C, 0x88, 0x07, 0x00, 0x02, 0x06, 0x00, 0x90, 0x48, 0x00, 0x34, 0x00, 0x2C, 0x04, 0x2C, 0x10, - 0x48, 0x11, 0x21, 0x40, 0x04, 0x84, 0x83, 0x40, 0x59, 0x03, 0x00, 0x50, 0x40, 0x0C, 0x10, 0x60, 0x42, 0xA9, 0x88, 0xC0, 0x40, 0x15, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x02, 0x00, 0x40, 0x08, 0x98, 0x88, 0x80, 0x08, 0xF9, 0x98, 0xC0, 0x06, 0x77, 0x75, 0x50, 0x02, 0x0C, 0x05, 0x00, 0x19, 0x98, 0xA8, 0xD0, 0x0B, 0x99, 0xCA, 0x80, 0x04, 0x54, 0x65, 0xC0, - 0x20, 0x08, 0x50, 0x20, 0x00, 0x10, 0x20, 0xC0, 0x31, 0x1C, 0x04, 0x20, 0x00, 0x01, 0x28, 0x40, 0x26, 0x63, 0xBB, 0xE0, 0x26, 0xEF, 0xE6, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x02, 0x01, 0x00, 0xC8, 0xC0, 0x00, 0x00, 0x0F, 0x8A, 0x89, 0x80, 0xC3, 0xF3, 0x11, 0x30, 0x0F, 0x02, 0x01, 0x80, 0xC9, 0xC0, 0x00, 0x30, 0x0F, 0x02, 0x05, 0xA0, 0x00, 0x00, 0x00, 0x30, - 0x0E, 0x02, 0x05, 0xA0, 0x00, 0x00, 0x00, 0x30, 0x0E, 0x02, 0x52, 0x80, 0x00, 0x00, 0x03, 0x00, 0x2C, 0xDF, 0xA8, 0x80, 0x02, 0x33, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0x88, 0x00, 0x01, 0x02, 0x80, 0x00, 0x03, 0xFF, 0xF7, 0x00, 0x0F, 0x26, 0xE4, 0x72, 0xCC, 0x38, 0x00, 0x40, 0x0C, 0x38, 0x99, 0x00, 0x03, 0x0A, 0x31, 0x50, 0x0C, 0xB1, 0x82, 0x80, - 0x03, 0x28, 0x06, 0x00, 0x87, 0x88, 0x2A, 0xA0, 0x01, 0x05, 0xC2, 0x00, 0x85, 0x82, 0xC2, 0x80, 0x10, 0x00, 0x39, 0x10, 0x08, 0x51, 0xBF, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x04, 0x00, 0x48, 0x9D, 0xCC, 0x40, 0xC9, 0xE6, 0x7F, 0x40, 0x40, 0x00, 0x94, 0x00, 0x5B, 0x21, 0x0C, 0xB0, 0x48, 0xAE, 0xCC, 0x40, 0xE1, 0x30, 0x0C, 0x30, 0x43, 0x01, 0xA4, 0x00, - 0xE1, 0x24, 0x5D, 0x30, 0x78, 0x8C, 0xD6, 0x10, 0xF1, 0x60, 0x94, 0x70, 0xD0, 0x40, 0x9C, 0x70, 0x0B, 0x8C, 0x53, 0x00, 0x0C, 0x9D, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x39, 0x50, 0x00, 0x00, 0x88, 0xF0, 0x00, 0x2E, 0xAF, 0xC6, 0x00, 0x03, 0x01, 0x77, 0x60, 0x04, 0xF0, 0x41, 0x60, 0x03, 0x92, 0xF8, 0x12, 0x0F, 0xBD, 0x91, 0x40, 0x1B, 0x28, 0x60, 0x92, - 0x70, 0xF4, 0x01, 0xF0, 0x0A, 0xD4, 0x65, 0x82, 0x53, 0xE0, 0x01, 0xE0, 0x04, 0x10, 0x68, 0x60, 0x04, 0x2A, 0xBE, 0x00, 0x00, 0x4F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x3A, 0xEE, 0x00, 0xC8, 0xC0, 0x00, 0x00, 0x0D, 0x84, 0xA5, 0x00, 0xC1, 0xC2, 0x11, 0x00, 0x45, 0x0E, 0x27, 0x00, 0xD9, 0xC3, 0x00, 0x10, 0x07, 0xF8, 0x8D, 0x20, 0x01, 0x30, 0x00, 0x10, - 0xAC, 0x02, 0x25, 0xA0, 0x01, 0x22, 0x00, 0x10, 0x44, 0x20, 0x16, 0xA0, 0x13, 0x02, 0x00, 0x30, 0x04, 0x1B, 0xAA, 0x40, 0x21, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +u8 sGfxPrintFontData[(16 * 256) / 2] = { + 0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, + 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00, 0x01, 0x56, 0x29, 0x90, 0x05, 0x58, + 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xBF, 0xFB, 0x00, 0x0E, 0xFF, 0xFF, 0xC0, 0x0B, 0xF0, 0x0F, 0xB0, + 0x0F, 0xF0, 0x03, 0x30, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0xF0, 0x02, 0x20, 0x0C, 0xFB, 0xBF, 0x60, 0x0F, 0xFC, 0xCE, + 0x20, 0x0D, 0xD4, 0x4F, 0xF0, 0x0F, 0xF0, 0x02, 0x20, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0xF0, 0x03, 0x30, 0x0C, 0xFB, + 0xBF, 0x40, 0x0E, 0xF7, 0x77, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDF, 0xFD, 0x00, 0x0A, + 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, + 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00, 0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, + 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0xBF, 0xFB, 0x00, 0x00, 0x0D, 0xE0, 0x00, 0x0B, 0xF0, 0x0F, 0xB0, 0x00, 0x5D, 0xE6, 0x00, 0x0F, + 0xF0, 0x0F, 0xF0, 0x05, 0x5C, 0xC6, 0x60, 0x0C, 0xFB, 0xBF, 0x60, 0x77, 0x3F, 0xF3, 0x77, 0x0D, 0xD4, 0x4F, 0xF0, + 0xBB, 0x3F, 0xF3, 0xBB, 0x0F, 0xF0, 0x0F, 0xF0, 0x09, 0x9C, 0xCA, 0xA0, 0x0C, 0xFB, 0xBF, 0x40, 0x00, 0x9D, 0xEA, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xE0, 0x00, 0x04, 0xC2, 0x2C, 0x40, 0x02, 0x8D, 0x50, 0x20, 0x0C, 0xCA, + 0xAC, 0xC0, 0x21, 0xF9, 0x17, 0x10, 0x04, 0xC2, 0x2C, 0x40, 0x12, 0x49, 0x34, 0x00, 0x00, 0x82, 0x08, 0x00, 0x01, + 0x97, 0x51, 0x10, 0x08, 0x8A, 0x88, 0x80, 0x04, 0x61, 0x52, 0x41, 0x00, 0x80, 0x08, 0x00, 0x43, 0x11, 0x75, 0x30, + 0x00, 0xA2, 0x08, 0x00, 0x60, 0x05, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x40, 0x00, 0x22, 0x11, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0F, 0xB0, 0x00, 0x00, 0x00, 0x08, 0x80, 0x04, 0x0D, 0xA4, 0x00, 0x00, 0x00, + 0x88, 0x00, 0x08, 0xCD, 0xE8, 0x80, 0x02, 0x2A, 0xA2, 0x20, 0x08, 0xCD, 0xE8, 0x80, 0x02, 0xAA, 0x22, 0x20, 0x04, + 0x0D, 0xA4, 0x00, 0x0C, 0xD1, 0x00, 0x00, 0x00, 0x0F, 0xB0, 0x00, 0x8C, 0x51, 0x00, 0x00, 0x00, 0x22, 0x11, 0x00, + 0x81, 0x10, 0x00, 0x00, 0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, + 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00, 0x01, 0x56, + 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, + 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x00, 0x04, 0x48, 0x99, 0x80, + 0x03, 0x3C, 0xC3, 0x30, 0x00, 0xCD, 0x10, 0x88, 0x03, 0x3C, 0xC3, 0x30, 0x02, 0xBF, 0x62, 0xA8, 0x00, 0x33, 0x33, + 0x20, 0x01, 0x10, 0x4C, 0x80, 0x01, 0x10, 0x03, 0x30, 0x00, 0x15, 0xC8, 0x00, 0x03, 0x3C, 0xC3, 0x30, 0x02, 0x67, + 0x32, 0x20, 0x00, 0x3F, 0xF3, 0x00, 0x04, 0x40, 0x99, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, + 0xDF, 0xFD, 0x10, 0x07, 0xFF, 0xFF, 0x60, 0x1C, 0xE0, 0x0E, 0xC1, 0x0F, 0xF0, 0x09, 0x90, 0x1E, 0xE1, 0x16, 0x61, + 0x0F, 0xF0, 0x01, 0x10, 0x1E, 0xF4, 0x56, 0x21, 0x0F, 0xF6, 0x67, 0x10, 0x1E, 0xF2, 0x36, 0x61, 0x0F, 0xF0, 0x89, + 0x90, 0x1E, 0xF1, 0x0F, 0xE1, 0x0F, 0xF0, 0x09, 0x90, 0x16, 0xEC, 0xCE, 0x21, 0x07, 0xFB, 0xBB, 0x20, 0x01, 0x11, + 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x09, 0xB6, 0x6F, 0xD0, 0x27, 0xD8, 0x8E, 0x60, 0x09, 0x92, 0xED, 0x10, 0x2F, + 0xF0, 0x2E, 0xE0, 0x09, 0x9A, 0xE5, 0x10, 0x2F, 0xF6, 0x2E, 0xE0, 0x09, 0x9B, 0x75, 0x10, 0x2F, 0xD6, 0x4E, 0xE0, + 0x0D, 0xDA, 0xE5, 0x10, 0x2F, 0xD0, 0x4E, 0xE0, 0x0D, 0xD2, 0xED, 0x10, 0x2F, 0xD0, 0x0E, 0xE0, 0x09, 0xF6, 0x6F, + 0x90, 0x27, 0xD9, 0x9F, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFF, 0x00, 0x8F, 0x71, + 0x1F, 0xF0, 0x2F, 0xD0, 0x0F, 0xF0, 0x8F, 0x71, 0x1F, 0xF0, 0x2F, 0xD0, 0x07, 0x70, 0x8E, 0x61, 0x1E, 0xE0, 0x27, + 0xDD, 0xDF, 0x60, 0x8E, 0x69, 0x1E, 0xE0, 0x27, 0x76, 0x4A, 0xA0, 0x8E, 0xE9, 0x9E, 0xE0, 0x2F, 0xD0, 0x6E, 0x80, + 0x8A, 0xE7, 0xFE, 0xA0, 0x07, 0xFA, 0x8E, 0x60, 0x88, 0x27, 0x7A, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x07, 0x7C, 0xCF, 0xF0, 0x13, 0x26, 0x60, 0x11, 0x07, 0x7C, 0xCF, 0xF0, 0x03, 0x76, 0x65, 0x10, 0x02, 0x39, + 0xD7, 0x20, 0x04, 0x53, 0x35, 0x40, 0x00, 0x2F, 0xF2, 0x00, 0x01, 0x13, 0x31, 0x10, 0x00, 0x5F, 0xB1, 0x00, 0x00, + 0x03, 0x30, 0x00, 0x05, 0x5E, 0xE5, 0x50, 0x01, 0x13, 0x31, 0x10, 0x05, 0x5E, 0xED, 0xD0, 0x02, 0x23, 0x30, 0x00, + 0x00, 0x08, 0x88, 0x80, 0x8A, 0xAB, 0xB8, 0x88, 0x00, 0x00, 0x11, 0x00, 0x00, 0x04, 0x45, 0x10, 0x04, 0x62, 0x33, + 0x20, 0x00, 0x44, 0x01, 0x10, 0x04, 0xC8, 0x9A, 0xA0, 0x00, 0xEE, 0xAB, 0x10, 0x0C, 0xE6, 0x67, 0x20, 0x0E, 0xF5, + 0x5F, 0xB0, 0x0E, 0xE0, 0x06, 0x60, 0x0B, 0xF6, 0x2B, 0x90, 0x0E, 0xE0, 0x06, 0x60, 0x03, 0xFC, 0x89, 0x90, 0x04, + 0xEE, 0xEE, 0xA0, 0x00, 0x77, 0x3B, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0x88, 0x00, 0x09, 0x90, 0x00, 0x00, + 0x00, 0x11, 0x10, 0x00, 0x09, 0x92, 0x24, 0x40, 0x00, 0x01, 0x10, 0x00, 0x09, 0x90, 0x88, 0x00, 0x26, 0xEF, 0xDE, + 0x20, 0x09, 0x9B, 0xB5, 0x40, 0x2E, 0xC3, 0x3C, 0xE2, 0x0D, 0x9A, 0x25, 0x50, 0x2E, 0xC3, 0x3C, 0xE2, 0x0D, 0xDA, + 0xA5, 0x50, 0x2E, 0xC3, 0x3C, 0xE2, 0x09, 0xD6, 0xED, 0x10, 0x26, 0xCB, 0xBC, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, + 0x05, 0xFB, 0xFF, 0xE0, 0x8E, 0x61, 0x16, 0xE8, 0x0F, 0xF4, 0x03, 0x30, 0x8F, 0x71, 0x17, 0xF8, 0x07, 0xFC, 0x8B, + 0x30, 0x8E, 0x69, 0x96, 0xE8, 0x05, 0x73, 0x3B, 0xA0, 0x8A, 0x6D, 0xD6, 0xA8, 0x0D, 0xD8, 0x8A, 0x20, 0x08, 0xA7, + 0x79, 0xB2, 0x01, 0x10, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8A, 0x01, 0x10, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x80, 0xA1, 0x10, 0x00, 0x07, 0x74, 0x4F, 0x70, 0x80, 0xA9, 0x90, 0x00, 0x02, 0x31, 0xDF, 0x20, + 0x84, 0xE6, 0x00, 0x04, 0x00, 0x27, 0xDA, 0x20, 0xC8, 0xAA, 0x4C, 0x40, 0x00, 0x57, 0x3B, 0x20, 0x00, 0xA1, 0x18, + 0x00, 0x05, 0x54, 0x6F, 0x50, 0x00, 0xA9, 0x98, 0x00, 0x02, 0x22, 0x20, 0x80, 0x02, 0x00, 0x18, 0x88, 0x00, 0x04, + 0x44, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40, 0x0C, 0x44, 0x44, 0x00, 0x00, 0x04, 0x40, 0x00, 0x88, + 0xC0, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x0C, 0x46, 0xA4, 0x40, 0x00, 0x0C, 0xC0, 0x00, 0x08, 0x8E, 0xE0, 0x00, + 0x02, 0x08, 0x80, 0x00, 0x80, 0xD0, 0x88, 0x00, 0x28, 0xA8, 0x80, 0x00, 0x88, 0xCD, 0x4C, 0x40, 0x0A, 0x88, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xE0, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x88, 0x00, 0x80, 0x01, 0x06, 0x10, 0x00, 0x56, 0xE7, 0x50, 0x80, 0x02, 0x1F, 0xF1, 0x00, 0x38, + 0x8C, 0xB8, 0x00, 0x0B, 0xF6, 0x0B, 0x00, 0x94, 0xC0, 0x28, 0x00, 0x06, 0x07, 0x6A, 0x00, 0xCB, 0xA6, 0xC8, 0x00, + 0x00, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x80, 0x00, 0x00, 0x39, 0x14, + 0x20, 0x02, 0x22, 0x24, 0x00, 0x08, 0xAE, 0xA8, 0x60, 0x04, 0x28, 0x99, 0x70, 0x07, 0x75, 0xD1, 0x04, 0x0F, 0xB3, + 0x33, 0xD0, 0x00, 0xAE, 0xBE, 0xA4, 0x25, 0x15, 0x20, 0xA0, 0x02, 0x61, 0x0C, 0x02, 0x20, 0x42, 0x08, 0x20, 0x2C, + 0x30, 0x14, 0x02, 0x02, 0x28, 0x82, 0x00, 0x03, 0xAC, 0xC1, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x12, 0x00, 0x08, 0x00, 0x28, 0x00, 0x0A, 0xCF, 0xEE, 0x20, 0x0B, 0x62, 0x2E, 0x20, 0x02, 0x10, 0x82, + 0x40, 0x01, 0x44, 0xE4, 0x40, 0x03, 0x00, 0x0E, 0x00, 0x8D, 0xEA, 0xAC, 0x00, 0x02, 0x10, 0x0A, 0x00, 0x01, 0xE0, + 0x24, 0x00, 0x0C, 0x21, 0x02, 0x00, 0x09, 0x42, 0x21, 0x00, 0x00, 0xCC, 0xF4, 0x40, 0x02, 0xBF, 0xD4, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x0C, 0xCC, 0xC4, 0x40, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x02, 0xA0, + 0x40, 0x00, 0x0C, 0xC0, 0x00, 0x04, 0xCE, 0x64, 0x40, 0x02, 0x08, 0x80, 0x00, 0x00, 0x90, 0x00, 0x40, 0x28, 0xA8, + 0x80, 0x00, 0x08, 0x01, 0x04, 0x00, 0x0A, 0x88, 0x80, 0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x54, 0x44, 0x00, + 0xEE, 0xFE, 0xE0, 0x00, 0x09, 0x3B, 0x3F, 0x00, 0x21, 0xD8, 0x20, 0x00, 0x00, 0x54, 0x4F, 0x00, 0x18, 0x58, 0x20, + 0x00, 0x00, 0x01, 0x86, 0x00, 0xC6, 0x7E, 0x40, 0x00, 0x00, 0xEF, 0x66, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0xC0, 0x20, 0x00, 0xAA, 0xAA, 0xEA, 0x20, 0xEF, 0xFF, 0xFF, 0x00, 0x80, + 0x44, 0x19, 0x30, 0x00, 0x49, 0x24, 0x00, 0xC5, 0x35, 0x1B, 0x10, 0x00, 0x4B, 0x24, 0x00, 0x01, 0x35, 0xA0, 0x00, + 0x8C, 0xA9, 0xAC, 0x80, 0x00, 0x2C, 0x00, 0x00, 0x04, 0x21, 0xA4, 0x00, 0x2A, 0x84, 0x00, 0x00, 0x73, 0x11, 0xF1, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x11, 0x19, 0x00, 0x00, 0x40, 0x00, 0x00, 0x8F, 0xEE, + 0xEF, 0xE0, 0x0B, 0x76, 0x66, 0xD0, 0x1A, 0x00, 0x0B, 0x40, 0x4C, 0x40, 0x02, 0xD0, 0x28, 0x00, 0x1A, 0x40, 0x01, + 0xD0, 0x2C, 0x10, 0x00, 0x00, 0x38, 0x40, 0x00, 0x40, 0x28, 0x10, 0x00, 0x01, 0xA0, 0x40, 0x00, 0x42, 0x83, 0x00, + 0x05, 0xFE, 0x44, 0x40, 0x03, 0xFD, 0x54, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x99, 0x9B, + 0x00, 0x00, 0x10, 0x20, 0x00, 0x07, 0x26, 0x21, 0x40, 0x2A, 0xFE, 0xEE, 0xA0, 0x8D, 0x8C, 0xA9, 0xC0, 0x00, 0x10, + 0x20, 0x80, 0x32, 0x33, 0xB3, 0x60, 0x00, 0x19, 0x28, 0x00, 0x00, 0x00, 0xA1, 0x40, 0x00, 0x10, 0xB1, 0x00, 0x00, + 0x08, 0x34, 0x00, 0x00, 0x1A, 0x08, 0x00, 0x05, 0xF7, 0x40, 0x00, 0x8E, 0xF4, 0x44, 0xC0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x02, 0x80, 0x00, 0x04, 0x00, 0x00, 0x1D, 0x11, 0xDB, 0x00, 0xDD, 0xFD, 0xDD, + 0xD0, 0x0C, 0x88, 0x07, 0x00, 0x02, 0x06, 0x00, 0x90, 0x48, 0x00, 0x34, 0x00, 0x2C, 0x04, 0x2C, 0x10, 0x48, 0x11, + 0x21, 0x40, 0x04, 0x84, 0x83, 0x40, 0x59, 0x03, 0x00, 0x50, 0x40, 0x0C, 0x10, 0x60, 0x42, 0xA9, 0x88, 0xC0, 0x40, + 0x15, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x02, 0x00, 0x40, 0x08, 0x98, 0x88, 0x80, + 0x08, 0xF9, 0x98, 0xC0, 0x06, 0x77, 0x75, 0x50, 0x02, 0x0C, 0x05, 0x00, 0x19, 0x98, 0xA8, 0xD0, 0x0B, 0x99, 0xCA, + 0x80, 0x04, 0x54, 0x65, 0xC0, 0x20, 0x08, 0x50, 0x20, 0x00, 0x10, 0x20, 0xC0, 0x31, 0x1C, 0x04, 0x20, 0x00, 0x01, + 0x28, 0x40, 0x26, 0x63, 0xBB, 0xE0, 0x26, 0xEF, 0xE6, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x02, 0x01, 0x00, 0xC8, 0xC0, 0x00, 0x00, 0x0F, 0x8A, 0x89, 0x80, 0xC3, 0xF3, 0x11, 0x30, 0x0F, 0x02, 0x01, 0x80, + 0xC9, 0xC0, 0x00, 0x30, 0x0F, 0x02, 0x05, 0xA0, 0x00, 0x00, 0x00, 0x30, 0x0E, 0x02, 0x05, 0xA0, 0x00, 0x00, 0x00, + 0x30, 0x0E, 0x02, 0x52, 0x80, 0x00, 0x00, 0x03, 0x00, 0x2C, 0xDF, 0xA8, 0x80, 0x02, 0x33, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x88, 0x00, 0x01, 0x02, 0x80, 0x00, 0x03, 0xFF, 0xF7, 0x00, 0x0F, + 0x26, 0xE4, 0x72, 0xCC, 0x38, 0x00, 0x40, 0x0C, 0x38, 0x99, 0x00, 0x03, 0x0A, 0x31, 0x50, 0x0C, 0xB1, 0x82, 0x80, + 0x03, 0x28, 0x06, 0x00, 0x87, 0x88, 0x2A, 0xA0, 0x01, 0x05, 0xC2, 0x00, 0x85, 0x82, 0xC2, 0x80, 0x10, 0x00, 0x39, + 0x10, 0x08, 0x51, 0xBF, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x48, 0x9D, + 0xCC, 0x40, 0xC9, 0xE6, 0x7F, 0x40, 0x40, 0x00, 0x94, 0x00, 0x5B, 0x21, 0x0C, 0xB0, 0x48, 0xAE, 0xCC, 0x40, 0xE1, + 0x30, 0x0C, 0x30, 0x43, 0x01, 0xA4, 0x00, 0xE1, 0x24, 0x5D, 0x30, 0x78, 0x8C, 0xD6, 0x10, 0xF1, 0x60, 0x94, 0x70, + 0xD0, 0x40, 0x9C, 0x70, 0x0B, 0x8C, 0x53, 0x00, 0x0C, 0x9D, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x39, 0x50, 0x00, 0x00, 0x88, 0xF0, 0x00, 0x2E, 0xAF, 0xC6, 0x00, 0x03, 0x01, 0x77, 0x60, 0x04, 0xF0, + 0x41, 0x60, 0x03, 0x92, 0xF8, 0x12, 0x0F, 0xBD, 0x91, 0x40, 0x1B, 0x28, 0x60, 0x92, 0x70, 0xF4, 0x01, 0xF0, 0x0A, + 0xD4, 0x65, 0x82, 0x53, 0xE0, 0x01, 0xE0, 0x04, 0x10, 0x68, 0x60, 0x04, 0x2A, 0xBE, 0x00, 0x00, 0x4F, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3A, 0xEE, 0x00, 0xC8, 0xC0, 0x00, 0x00, 0x0D, 0x84, 0xA5, + 0x00, 0xC1, 0xC2, 0x11, 0x00, 0x45, 0x0E, 0x27, 0x00, 0xD9, 0xC3, 0x00, 0x10, 0x07, 0xF8, 0x8D, 0x20, 0x01, 0x30, + 0x00, 0x10, 0xAC, 0x02, 0x25, 0xA0, 0x01, 0x22, 0x00, 0x10, 0x44, 0x20, 0x16, 0xA0, 0x13, 0x02, 0x00, 0x30, 0x04, + 0x1B, 0xAA, 0x40, 0x21, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -#define gDPSetPrimColorMod(pkt, m, l, rgba) \ -_DW({ \ - Gfx *_g = (Gfx *)(pkt); \ - \ - _g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | \ - _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \ - _g->words.w1 = (rgba); \ -}) +#define gDPSetPrimColorMod(pkt, m, l, rgba) \ + _DW({ \ + Gfx* _g = (Gfx*)(pkt); \ + \ + _g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \ + _g->words.w1 = (rgba); \ + }) #ifdef NON_MATCHING // regalloc and minor ordering differences -void GfxPrint_InitDlist(GfxPrint* this) -{ +void GfxPrint_InitDlist(GfxPrint* this) { s32 width = 16; s32 height = 256; s32 i; gDPPipeSync(this->dlist++); gDPSetOtherMode(this->dlist++, - G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | - G_TT_IA16 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_IA16 | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); - gDPSetCombineLERP(this->dlist++, - 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, - 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0); + gDPSetCombineLERP(this->dlist++, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0, 0, 0, 0, TEXEL0); gDPSetTextureImage(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b_LOAD_BLOCK, 1, sGfxPrintFontData); - gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b_LOAD_BLOCK, - 0, 0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync(this->dlist++); - gDPLoadBlock(this->dlist++, G_TX_LOADTILE, 0, 0, - (((width)*(height) + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, - CALC_DXT(width, G_IM_SIZ_4b_BYTES)); + gDPLoadBlock(this->dlist++, G_TX_LOADTILE, 0, 0, (((width) * (height) + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, + CALC_DXT(width, G_IM_SIZ_4b_BYTES)); gDPPipeSync(this->dlist++); - gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, - 1, 0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(this->dlist++, G_TX_RENDERTILE, 0, 0, - ((width)-1) << G_TEXTURE_IMAGE_FRAC, + gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTileSize(this->dlist++, G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, ((height)-1) << G_TEXTURE_IMAGE_FRAC); gDPLoadTLUT(this->dlist++, 64, 256, sGfxPrintFontTLUT); - for (i = 1; i < 4; i++) - { - gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, - 1, 0, i * 2, i, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + for (i = 1; i < 4; i++) { + gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2, i, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPSetTileSize(this->dlist++, i * 2, 0, 0, 60, 1020); } gDPSetPrimColorMod(this->dlist++, 0, 0, *(u32*)&this->color); gDPSetTextureImage(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_8b, 1, sGfxPrintUnkData); - gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_8b, - 1, 0, G_TX_LOADTILE, 0 , - G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD); + gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_8b, 1, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, 3, + G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD); gDPLoadSync(this->dlist++); gDPLoadTile(this->dlist++, G_TX_LOADTILE, 0, 0, 2, 28); gDPPipeSync(this->dlist++); - gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_8b, - 1, 0, 1, 4, - G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD, + gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_8b, 1, 0, 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD); gDPSetTileSize(this->dlist++, 1, 0, 0, 4, 28); gDPLoadTLUT(this->dlist++, 16, 320, sGfxPrintUnkTLUT); - for (i = 1; i < 4; i++) - { - gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, - 1, 0, i * 2 + 1, 4, - G_TX_NOMIRROR | G_TX_WRAP, 3, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD); + for (i = 1; i < 4; i++) { + gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2 + 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3, + G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD); gDPSetTileSize(this->dlist++, i * 2 + 1, 0, 0, 4, 28); } } @@ -190,8 +198,7 @@ void GfxPrint_InitDlist(GfxPrint* this) #pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_InitDlist.s") #endif -void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a) -{ +void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a) { this->color.r = r; this->color.g = g; this->color.b = b; @@ -200,89 +207,61 @@ void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a) gDPSetPrimColorMod(this->dlist++, 0, 0, *(u32*)&this->color); } - -void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y) -{ +void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y) { this->posX = this->baseX + (x << 2); this->posY = this->baseY + (y << 2); } -void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y) -{ +void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y) { GfxPrint_SetPosPx(this, x << 3, y << 3); } -void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y) -{ +void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y) { this->baseX = x << 2; this->baseY = y << 2; } #ifdef NON_MATCHING // regalloc and ordering differences -void GfxPrint_PrintCharImpl(GfxPrint* this, char c) -{ - if (this->flag & GFXPRINT_UPDATE_MODE) - { +void GfxPrint_PrintCharImpl(GfxPrint* this, char c) { + if (this->flag & GFXPRINT_UPDATE_MODE) { this->flag &= ~GFXPRINT_UPDATE_MODE; gDPPipeSync(this->dlist++); - if (this->flag & GFXPRINT_USE_RGBA16) - { + if (this->flag & GFXPRINT_USE_RGBA16) { gDPSetTextureLUT(this->dlist++, G_TT_RGBA16); gDPSetCycleType(this->dlist++, G_CYC_2CYCLE); gDPSetRenderMode(this->dlist++, G_RM_OPA_CI, G_RM_XLU_SURF2); - gDPSetCombineLERP(this->dlist++, - TEXEL0, 0, TEXEL1, 0, TEXEL0, 0, TEXEL1, 0, - 0, 0, 0, COMBINED, 0, 0, 0, COMBINED); - } - else - { + gDPSetCombineLERP(this->dlist++, TEXEL0, 0, TEXEL1, 0, TEXEL0, 0, TEXEL1, 0, 0, 0, 0, COMBINED, 0, 0, 0, + COMBINED); + } else { gDPSetTextureLUT(this->dlist++, G_TT_IA16); gDPSetCycleType(this->dlist++, G_CYC_1CYCLE); gDPSetRenderMode(this->dlist++, G_RM_XLU_SURF, G_RM_XLU_SURF2); - gDPSetCombineLERP(this->dlist++, - TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0, - TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0); + gDPSetCombineLERP(this->dlist++, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, TEXEL0, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, + TEXEL0); } } - if (this->flag & GFXPRINT_FLAG4) - { + if (this->flag & GFXPRINT_FLAG4) { gDPSetPrimColorMod(this->dlist++, 0, 0, 0); if (this->flag & GFXPRINT_FLAG64) - gSPTextureRectangle(this->dlist++, - (this->posX + 4) << 1, (this->posY + 4) << 1, - (this->posX + 4 + 32) << 1, (this->posY + 4 + 32) << 1, - c * 2, - (u16)(c & 4) * 64, (u16)(c >> 3) * 256, - 512, 512); + gSPTextureRectangle(this->dlist++, (this->posX + 4) << 1, (this->posY + 4) << 1, (this->posX + 4 + 32) << 1, + (this->posY + 4 + 32) << 1, c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512); else - gSPTextureRectangle(this->dlist++, - this->posX + 4, this->posY + 4, - this->posX + 4 + 32, this->posY + 4 + 32, - c * 2, - (u16)(c & 4) * 64, (u16)(c >> 3) * 256, - 1024, 1024); + gSPTextureRectangle(this->dlist++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32, + c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024); gDPSetPrimColorMod(this->dlist++, 0, 0, *(u32*)&this->color); } if (this->flag & GFXPRINT_FLAG64) - gSPTextureRectangle(this->dlist++, - (this->posX) << 1, (this->posY) << 1, - (this->posX + 32) << 1, (this->posY + 32) << 1, - c * 2, - (u16)(c & 4) * 64, (u16)(c >> 3) * 256, - 512, 512); + gSPTextureRectangle(this->dlist++, (this->posX) << 1, (this->posY) << 1, (this->posX + 32) << 1, + (this->posY + 32) << 1, c * 2, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 512, 512); else - gSPTextureRectangle(this->dlist++, - this->posX, this->posY, - this->posX + 32, this->posY + 32, - c * 2, - (u16)(c & 4) * 64, (u16)(c >> 3) * 256, - 1024, 1024); + gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, c * 2, + (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024); this->posX += 32; } @@ -290,33 +269,24 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, char c) #pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_PrintCharImpl.s") #endif -void GfxPrint_PrintChar(GfxPrint* this, u8 c) -{ +void GfxPrint_PrintChar(GfxPrint* this, u8 c) { u8 charParam = c; - if (c == ' ') - { + if (c == ' ') { this->posX += 0x20; - } - else if (c > 0x20 && c < 0x7F) - { + } else if (c > 0x20 && c < 0x7F) { GfxPrint_PrintCharImpl(this, charParam); - } - else if (c >= 0xA0 && c < 0xE0) - { - if (this->flag & GFXPRINT_FLAG1) - { - if (c < 0xC0) + } else if (c >= 0xA0 && c < 0xE0) { + if (this->flag & GFXPRINT_FLAG1) { + if (c < 0xC0) { charParam = c - 0x20; - else + } else { charParam = c + 0x20; + } } GfxPrint_PrintCharImpl(this, charParam); - } - else - { - switch (c) - { + } else { + switch (c) { case 0: break; case '\n': @@ -325,8 +295,7 @@ void GfxPrint_PrintChar(GfxPrint* this, u8 c) this->posX = this->baseX; break; case '\t': - do - { + do { GfxPrint_PrintCharImpl(this, 0x20); } while ((this->posX - this->baseX) % 256); break; @@ -351,32 +320,28 @@ void GfxPrint_PrintChar(GfxPrint* this, u8 c) } } -void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, size_t charSize, size_t charCount) -{ +void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, size_t charSize, size_t charCount) { const char* str = (const char*)buffer; size_t count = charSize * charCount; - while (count) - { + while (count) { GfxPrint_PrintChar(this, *str++); count--; } } -void GfxPrint_PrintString(GfxPrint* this, const char* str) -{ - while (*str) +void GfxPrint_PrintString(GfxPrint* this, const char* str) { + while (*str) { GfxPrint_PrintChar(this, *(str++)); + } } -GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) -{ +GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) { GfxPrint_PrintStringWithSize(this, str, sizeof(char), size); return this; } -void GfxPrint_Ctor(GfxPrint* this) -{ +void GfxPrint_Ctor(GfxPrint* this) { this->flag &= ~GFXPRINT_OPEN; this->callback = &GfxPrint_Callback; @@ -392,31 +357,27 @@ void GfxPrint_Ctor(GfxPrint* this) this->flag |= GFXPRINT_FLAG4; this->flag |= GFXPRINT_UPDATE_MODE; - if ((D_801755F0 & GFXPRINT_FLAG64)) + if ((D_801755F0 & GFXPRINT_FLAG64)) { this->flag |= GFXPRINT_FLAG64; //? dsdx/dtdy - else + } else { this->flag &= ~GFXPRINT_FLAG64; + } } -void GfxPrint_Dtor(GfxPrint* this) -{ - +void GfxPrint_Dtor(GfxPrint* this) { } -void GfxPrint_Open(GfxPrint* this, Gfx* dlist) -{ - if (!(this->flag & GFXPRINT_OPEN)) - { +void GfxPrint_Open(GfxPrint* this, Gfx* dlist) { + if (!(this->flag & GFXPRINT_OPEN)) { this->flag |= GFXPRINT_OPEN; this->dlist = dlist; GfxPrint_InitDlist(this); - } - else + } else { osSyncPrintf("gfxprint_open:2重オープンです\n"); + } } -Gfx* GfxPrint_Close(GfxPrint* this) -{ +Gfx* GfxPrint_Close(GfxPrint* this) { Gfx* ret; this->flag &= ~GFXPRINT_OPEN; @@ -426,13 +387,11 @@ Gfx* GfxPrint_Close(GfxPrint* this) return ret; } -void GfxPrint_VPrintf(GfxPrint *this, const char *fmt, va_list args) -{ +void GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) { func_800FF340(&this->callback, fmt, args); } -void GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) -{ +void GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) { va_list args; va_start(args, fmt); diff --git a/src/code/irqmgr.c b/src/code/irqmgr.c index eb7eb780b1..35be0e3535 100644 --- a/src/code/irqmgr.c +++ b/src/code/irqmgr.c @@ -6,18 +6,17 @@ volatile OSTime sIrqMgrResetTime = 0; volatile OSTime sIrqMgrRetraceTime = 0; u32 sIrqMgrRetraceCount = 0; -#define RETRACE_MSG 666 -#define PRE_NMI_MSG 669 -#define PRENMI450_MSG 671 -#define PRENMI480_MSG 672 -#define PRENMI500_MSG 673 +#define RETRACE_MSG 666 +#define PRE_NMI_MSG 669 +#define PRENMI450_MSG 671 +#define PRENMI480_MSG 672 +#define PRENMI500_MSG 673 -#define STATUS_IDLE 0 -#define STATUS_PRENMI 1 -#define STATUS_NMI 2 +#define STATUS_IDLE 0 +#define STATUS_PRENMI 1 +#define STATUS_NMI 2 -void IrqMgr_AddClient(IrqMgr* this, IrqMgrClient* c, OSMesgQueue* msgQ) -{ +void IrqMgr_AddClient(IrqMgr* this, IrqMgrClient* c, OSMesgQueue* msgQ) { u32 prevMask; LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 96); @@ -32,15 +31,16 @@ void IrqMgr_AddClient(IrqMgr* this, IrqMgrClient* c, OSMesgQueue* msgQ) osSetIntMask(prevMask); - if (this->resetStatus > STATUS_IDLE) - osSendMesg(c->queue, (OSMesg)&this->prenmiMsg, OS_MESG_NOBLOCK); + if (this->resetStatus > STATUS_IDLE) { + osSendMesg(c->queue, (OSMesg) & this->prenmiMsg, OS_MESG_NOBLOCK); + } - if (this->resetStatus >= STATUS_NMI) - osSendMesg(c->queue, (OSMesg)&this->nmiMsg, OS_MESG_NOBLOCK); + if (this->resetStatus >= STATUS_NMI) { + osSendMesg(c->queue, (OSMesg) & this->nmiMsg, OS_MESG_NOBLOCK); + } } -void IrqMgr_RemoveClient(IrqMgr* this, IrqMgrClient* c) -{ +void IrqMgr_RemoveClient(IrqMgr* this, IrqMgrClient* c) { IrqMgrClient* iter; IrqMgrClient* lastIter; u32 prevMask; @@ -50,17 +50,16 @@ void IrqMgr_RemoveClient(IrqMgr* this, IrqMgrClient* c) LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 129); LogUtils_CheckNullPointer("c", c, "../irqmgr.c", 130); - + prevMask = osSetIntMask(1); - while (iter) - { - if (iter == c) - { - if (lastIter) + while (iter) { + if (iter == c) { + if (lastIter) { lastIter->prev = c->prev; - else + } else { this->clients = c->prev; + } break; } lastIter = iter; @@ -70,160 +69,150 @@ void IrqMgr_RemoveClient(IrqMgr* this, IrqMgrClient* c) osSetIntMask(prevMask); } -void IrqMgr_SendMesgForClient(IrqMgr* this, OSMesg msg) -{ +void IrqMgr_SendMesgForClient(IrqMgr* this, OSMesg msg) { IrqMgrClient* iter; iter = this->clients; - while(iter) - { - if (iter->queue->validCount >= iter->queue->msgCount) - //irqmgr_SendMesgForClient: Message queue is overflowing mq=%08x cnt=%d - osSyncPrintf(VT_COL(RED, WHITE) "irqmgr_SendMesgForClient:メッセージキューがあふれています mq=%08x cnt=%d\n" VT_RST, iter->queue, iter->queue->validCount); - else + while (iter) { + if (iter->queue->validCount >= iter->queue->msgCount) { + // irqmgr_SendMesgForClient: Message queue is overflowing mq=%08x cnt=%d + osSyncPrintf( + VT_COL(RED, WHITE) "irqmgr_SendMesgForClient:メッセージキューがあふれています mq=%08x cnt=%d\n" VT_RST, + iter->queue, iter->queue->validCount); + } else { osSendMesg(iter->queue, msg, OS_MESG_NOBLOCK); - + } + iter = iter->prev; } } -void IrqMgr_JamMesgForClient(IrqMgr* this, OSMesg msg) -{ +void IrqMgr_JamMesgForClient(IrqMgr* this, OSMesg msg) { IrqMgrClient* iter; iter = this->clients; - while(iter) - { - if (iter->queue->validCount >= iter->queue->msgCount) - //irqmgr_JamMesgForClient: Message queue is overflowing mq=%08x cnt=%d - osSyncPrintf(VT_COL(RED, WHITE) "irqmgr_JamMesgForClient:メッセージキューがあふれています mq=%08x cnt=%d\n" VT_RST, iter->queue, iter->queue->validCount); - else - //mistake? the function's name suggests it would use osJamMesg + while (iter) { + if (iter->queue->validCount >= iter->queue->msgCount) { + // irqmgr_JamMesgForClient: Message queue is overflowing mq=%08x cnt=%d + osSyncPrintf( + VT_COL(RED, WHITE) "irqmgr_JamMesgForClient:メッセージキューがあふれています mq=%08x cnt=%d\n" VT_RST, + iter->queue, iter->queue->validCount); + } else { + // mistake? the function's name suggests it would use osJamMesg osSendMesg(iter->queue, msg, OS_MESG_NOBLOCK); - + } + iter = iter->prev; } } -void IrqMgr_HandlePreNMI(IrqMgr *this) -{ - u64 temp = STATUS_PRENMI; //required to match +void IrqMgr_HandlePreNMI(IrqMgr* this) { + u64 temp = STATUS_PRENMI; // required to match gIrqMgrResetStatus = temp; this->resetStatus = STATUS_PRENMI; sIrqMgrResetTime = this->resetTime = osGetTime(); osSetTimer(&this->timer, OS_USEC_TO_CYCLES(450000), 0ull, &this->queue, (OSMesg)PRENMI450_MSG); - IrqMgr_JamMesgForClient(this, (OSMesg)&this->prenmiMsg); + IrqMgr_JamMesgForClient(this, (OSMesg) & this->prenmiMsg); } -void IrqMgr_CheckStack() -{ - osSyncPrintf("irqmgr.c: PRENMIから0.5秒経過\n"); //0.5 seconds after PRENMI - if (StackCheck_Check(NULL) == 0) - { - osSyncPrintf("スタックは大丈夫みたいです\n"); //The stack looks ok - } - else - { +void IrqMgr_CheckStack() { + osSyncPrintf("irqmgr.c: PRENMIから0.5秒経過\n"); // 0.5 seconds after PRENMI + if (StackCheck_Check(NULL) == 0) { + osSyncPrintf("スタックは大丈夫みたいです\n"); // The stack looks ok + } else { osSyncPrintf("%c", 7); osSyncPrintf(VT_FGCOL(RED)); - osSyncPrintf("スタックがオーバーフローしたか危険な状態です\n"); //Stack overflow or dangerous - osSyncPrintf("早々にスタックサイズを増やすか、スタックを消費しないようにしてください\n"); //Increase stack size early or don't consume stack + osSyncPrintf("スタックがオーバーフローしたか危険な状態です\n"); // Stack overflow or dangerous + osSyncPrintf( + "早々にスタックサイズを増やすか、スタックを消費しないようにしてください\n"); // Increase stack size early or + // don't consume stack osSyncPrintf(VT_RST); } } -void IrqMgr_HandlePRENMI450(IrqMgr* this) -{ - u64 temp = STATUS_NMI; //required to match +void IrqMgr_HandlePRENMI450(IrqMgr* this) { + u64 temp = STATUS_NMI; // required to match gIrqMgrResetStatus = temp; this->resetStatus = STATUS_NMI; osSetTimer(&this->timer, OS_USEC_TO_CYCLES(30000), 0ull, &this->queue, (OSMesg)PRENMI480_MSG); - IrqMgr_SendMesgForClient(this, (OSMesg)&this->nmiMsg); + IrqMgr_SendMesgForClient(this, (OSMesg) & this->nmiMsg); } -void IrqMgr_HandlePRENMI480(IrqMgr* this) -{ +void IrqMgr_HandlePRENMI480(IrqMgr* this) { u32 ret; osSetTimer(&this->timer, OS_USEC_TO_CYCLES(20000), 0ull, &this->queue, (OSMesg)PRENMI500_MSG); - ret = func_801031F0(); //osAfterPreNMI - if (ret) - { - osSyncPrintf("osAfterPreNMIが %d を返しました!?\n", ret); //osAfterPreNMI returned %d !? + ret = func_801031F0(); // osAfterPreNMI + if (ret) { + osSyncPrintf("osAfterPreNMIが %d を返しました!?\n", ret); // osAfterPreNMI returned %d !? osSetTimer(&this->timer, OS_USEC_TO_CYCLES(1000), 0ull, &this->queue, (OSMesg)PRENMI480_MSG); } } -void IrqMgr_HandlePRENMI500(IrqMgr* this) -{ +void IrqMgr_HandlePRENMI500(IrqMgr* this) { IrqMgr_CheckStack(); } -void IrqMgr_HandleRetrace(IrqMgr* this) -{ - if (sIrqMgrRetraceTime == 0ull) - { - if (this->retraceTime == 0) +void IrqMgr_HandleRetrace(IrqMgr* this) { + if (sIrqMgrRetraceTime == 0ull) { + if (this->retraceTime == 0) { this->retraceTime = osGetTime(); - else + } else { sIrqMgrRetraceTime = osGetTime() - this->retraceTime; + } } sIrqMgrRetraceCount++; - IrqMgr_SendMesgForClient(this, (OSMesg)&this->retraceMsg); + IrqMgr_SendMesgForClient(this, (OSMesg) & this->retraceMsg); } -void IrqMgr_ThreadEntry(void* arg0) -{ +void IrqMgr_ThreadEntry(void* arg0) { OSMesg msg; IrqMgr* this; u8 exit; this = (IrqMgr*)arg0; msg = 0; - osSyncPrintf("IRQマネージャスレッド実行開始\n"); //Start IRQ manager thread execution + osSyncPrintf("IRQマネージャスレッド実行開始\n"); // Start IRQ manager thread execution exit = false; - while (!exit) - { + while (!exit) { osRecvMesg(&this->queue, &msg, OS_MESG_BLOCK); - switch ((u32)msg) - { + switch ((u32)msg) { case RETRACE_MSG: IrqMgr_HandleRetrace(this); break; case PRE_NMI_MSG: osSyncPrintf("PRE_NMI_MSG\n"); - osSyncPrintf("スケジューラ:PRE_NMIメッセージを受信\n"); //Scheduler: Receives PRE_NMI message + osSyncPrintf("スケジューラ:PRE_NMIメッセージを受信\n"); // Scheduler: Receives PRE_NMI message IrqMgr_HandlePreNMI(this); break; case PRENMI450_MSG: osSyncPrintf("PRENMI450_MSG\n"); - osSyncPrintf("スケジューラ:PRENMI450メッセージを受信\n"); //Scheduler: Receives PRENMI450 message + osSyncPrintf("スケジューラ:PRENMI450メッセージを受信\n"); // Scheduler: Receives PRENMI450 message IrqMgr_HandlePRENMI450(this); break; case PRENMI480_MSG: osSyncPrintf("PRENMI480_MSG\n"); - osSyncPrintf("スケジューラ:PRENMI480メッセージを受信\n"); //Scheduler: Receives PRENMI480 message + osSyncPrintf("スケジューラ:PRENMI480メッセージを受信\n"); // Scheduler: Receives PRENMI480 message IrqMgr_HandlePRENMI480(this); break; case PRENMI500_MSG: osSyncPrintf("PRENMI500_MSG\n"); - osSyncPrintf("スケジューラ:PRENMI500メッセージを受信\n"); //Scheduler: Receives PRENMI500 message + osSyncPrintf("スケジューラ:PRENMI500メッセージを受信\n"); // Scheduler: Receives PRENMI500 message exit = true; IrqMgr_HandlePRENMI500(this); break; default: - osSyncPrintf("irqmgr.c:予期しないメッセージを受け取りました(%08x)\n", msg); //Unexpected message received + osSyncPrintf("irqmgr.c:予期しないメッセージを受け取りました(%08x)\n", + msg); // Unexpected message received break; - } } - osSyncPrintf("IRQマネージャスレッド実行終了\n"); //End of IRQ manager thread execution + osSyncPrintf("IRQマネージャスレッド実行終了\n"); // End of IRQ manager thread execution } -void IrqMgr_Create(IrqMgr* this, void* stack, OSPri pri, u8 retraceCount) -{ +void IrqMgr_Create(IrqMgr* this, void* stack, OSPri pri, u8 retraceCount) { LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 346); LogUtils_CheckNullPointer("stack", stack, "../irqmgr.c", 347); this->clients = NULL; diff --git a/src/code/listalloc.c b/src/code/listalloc.c index 20cc88e1c1..b7d97281c7 100644 --- a/src/code/listalloc.c +++ b/src/code/listalloc.c @@ -1,64 +1,66 @@ #include -ListAlloc* ListAlloc_Init(ListAlloc* this) -{ +ListAlloc* ListAlloc_Init(ListAlloc* this) { this->prev = NULL; this->next = NULL; return this; } -void* ListAlloc_Alloc(ListAlloc* this, u32 size) -{ +void* ListAlloc_Alloc(ListAlloc* this, u32 size) { ListAlloc* ptr; ListAlloc* next; - + ptr = SystemArena_MallocDebug(size + sizeof(ListAlloc), "../listalloc.c", 40); - if (!ptr) + if (!ptr) { return NULL; + } next = this->next; - if (next) + if (next) { next->next = ptr; - + } + ptr->prev = next; ptr->next = NULL; this->next = ptr; - if (!this->prev) + if (!this->prev) { this->prev = ptr; + } return (u8*)ptr + sizeof(ListAlloc); } -void ListAlloc_Free(ListAlloc* this, void* data) -{ +void ListAlloc_Free(ListAlloc* this, void* data) { ListAlloc* ptr; ptr = &((ListAlloc*)data)[-1]; - if (ptr->prev) + if (ptr->prev) { ptr->prev->next = ptr->next; + } - if (ptr->next) + if (ptr->next) { ptr->next->prev = ptr->prev; + } - if (this->prev == ptr) + if (this->prev == ptr) { this->prev = ptr->next; + } - if (this->next == ptr) + if (this->next == ptr) { this->next = ptr->prev; + } SystemArena_FreeDebug(ptr, "../listalloc.c", 72); } -void ListAlloc_FreeAll(ListAlloc* this) -{ +void ListAlloc_FreeAll(ListAlloc* this) { ListAlloc* iter; iter = this->prev; - while (iter) - { + while (iter) { ListAlloc_Free(this, (u8*)iter + sizeof(ListAlloc)); iter = this->prev; } diff --git a/src/code/loadfragment2.c b/src/code/loadfragment2.c index b47bae4c11..2a304bbeb8 100644 --- a/src/code/loadfragment2.c +++ b/src/code/loadfragment2.c @@ -1,20 +1,18 @@ #include -void *Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd) -{ - void *allocatedVRamAddr; +void* Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, void* vRamStart, void* vRamEnd) { + void* allocatedVRamAddr; allocatedVRamAddr = SystemArena_MallocRDebug((s32)vRamEnd - (s32)vRamStart, "../loadfragment2.c", 31); - if(gOverlayLogSeverity >= 3) - { - osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr, ((u32)vRamEnd - (u32)vRamStart) + (u32)allocatedVRamAddr, (u32)vRamStart - (u32)allocatedVRamAddr); + if (gOverlayLogSeverity >= 3) { + osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr, + ((u32)vRamEnd - (u32)vRamStart) + (u32)allocatedVRamAddr, (u32)vRamStart - (u32)allocatedVRamAddr); } - if(allocatedVRamAddr != NULL) - { + if (allocatedVRamAddr != NULL) { Overlay_Load(vRomStart, vRomEnd, vRamStart, vRamEnd, allocatedVRamAddr); } return allocatedVRamAddr; -} \ No newline at end of file +} diff --git a/src/code/logseverity.c b/src/code/logseverity.c index b62552e1b7..25bc68c46f 100644 --- a/src/code/logseverity.c +++ b/src/code/logseverity.c @@ -1,3 +1,3 @@ #include -s32 gOverlayLogSeverity = 2; \ No newline at end of file +s32 gOverlayLogSeverity = 2; diff --git a/src/code/main.c b/src/code/main.c index 987654a416..5e2b9a89e9 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -23,21 +23,19 @@ StackEntry sSchedStackInfo; StackEntry sAudioStackInfo; StackEntry sPadMgrStackInfo; StackEntry sIrqMgrStackInfo; -u8 gAudioMgr[0x298]; //type should be AudioMgr +u8 gAudioMgr[0x298]; // type should be AudioMgr OSMesgQueue sSiIntMsgQ; OSMesg sSiIntMsgBuf[1]; - -void Main_LogSystemHeap() -{ +void Main_LogSystemHeap() { osSyncPrintf(VT_FGCOL(GREEN)); - //System heap size% 08x (% dKB) Start address% 08x - osSyncPrintf("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap); + // System heap size% 08x (% dKB) Start address% 08x + osSyncPrintf("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, + gSystemHeap); osSyncPrintf(VT_RST); } -void Main(void* arg0) -{ +void Main(void* arg0) { IrqMgrClient irqClient; OSMesgQueue irqMgrMsgQ; OSMesg irqMgrMsgBuf[60]; @@ -45,9 +43,9 @@ void Main(void* arg0) u32 fb; s32 debugHeap; s32 debugHeapSize; - s16 *msg; + s16* msg; - osSyncPrintf("mainproc 実行開始\n"); //Start running + osSyncPrintf("mainproc 実行開始\n"); // Start running gScreenWidth = SCREEN_WIDTH; gScreenHeight = SCREEN_HEIGHT; gAppNmiBufferPtr = (PreNmiBuff*)osAppNmiBuffer; @@ -57,15 +55,12 @@ void Main(void* arg0) sysHeap = (u32)gSystemHeap; fb = SysCfb_GetFbPtr(0); gSystemHeapSize = (fb - sysHeap); - osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize); //System heap initalization - SystemHeap_Init(sysHeap, gSystemHeapSize); //initializes the system heap - if (osMemSize >= 0x800000U) - { + osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize); // System heap initalization + SystemHeap_Init(sysHeap, gSystemHeapSize); // initializes the system heap + if (osMemSize >= 0x800000U) { debugHeap = SysCfb_GetFbEnd(); - debugHeapSize = (s32) (0x80600000 - debugHeap); - } - else - { + debugHeapSize = (s32)(0x80600000 - debugHeap); + } else { debugHeapSize = 0x400; debugHeap = SystemArena_MallocDebug(debugHeapSize, "../main.c", 0x235); } @@ -81,43 +76,42 @@ void Main(void* arg0) Main_LogSystemHeap(); osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3c); - StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack+sizeof(sIrqMgrStack), 0, 0x100, "irqmgr"); + StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 0x100, "irqmgr"); IrqMgr_Create(&gIrqMgr, &sGraphStackInfo, 0x11, 1); - osSyncPrintf("タスクスケジューラの初期化\n"); //Initialize the task scheduler - StackCheck_Init(&sSchedStackInfo, sSchedStack, sSchedStack+sizeof(sSchedStack), 0, 0x100, "sched"); + osSyncPrintf("タスクスケジューラの初期化\n"); // Initialize the task scheduler + StackCheck_Init(&sSchedStackInfo, sSchedStack, sSchedStack + sizeof(sSchedStack), 0, 0x100, "sched"); func_800C9874(&gSchedContext, &sAudioStack, 0xf, D_80013960, 1, &gIrqMgr); IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ); - StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack+sizeof(sAudioStack), 0, 0x100, "audio"); - func_800C3FEC(&gAudioMgr, sAudioStack+sizeof(sAudioStack), 0xc, 0xa, &gSchedContext, &gIrqMgr); + StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack + sizeof(sAudioStack), 0, 0x100, "audio"); + func_800C3FEC(&gAudioMgr, sAudioStack + sizeof(sAudioStack), 0xc, 0xa, &gSchedContext, &gIrqMgr); - StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack+sizeof(sPadMgrStack), 0, 0x100, "padmgr"); + StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack + sizeof(sPadMgrStack), 0, 0x100, "padmgr"); PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, 0xe, &sIrqMgrStack); func_800C3FC4(&gAudioMgr); - StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack+sizeof(sGraphStack), 0, 0x100, "graph"); - osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg0, sGraphStack+sizeof(sGraphStack), 0xb); + StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack + sizeof(sGraphStack), 0, 0x100, "graph"); + osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg0, sGraphStack + sizeof(sGraphStack), 0xb); osStartThread(&sGraphThread); osSetThreadPri(0, 0xf); - while (true) - { + while (true) { msg = NULL; osRecvMesg(&irqMgrMsgQ, &msg, OS_MESG_BLOCK); - if (msg == NULL) + if (msg == NULL) { break; - if (*msg == OS_SC_PRE_NMI_MSG) - { - osSyncPrintf("main.c: リセットされたみたいだよ\n"); //Looks like it's been reset + } + if (*msg == OS_SC_PRE_NMI_MSG) { + osSyncPrintf("main.c: リセットされたみたいだよ\n"); // Looks like it's been reset PreNmiBuff_SetReset(gAppNmiBufferPtr); } } - osSyncPrintf("mainproc 後始末\n"); //Cleanup + osSyncPrintf("mainproc 後始末\n"); // Cleanup osDestroyThread(&sGraphThread); func_800FBFD8(); - osSyncPrintf("mainproc 実行終了\n"); //End of execution + osSyncPrintf("mainproc 実行終了\n"); // End of execution } diff --git a/src/code/padmgr.c b/src/code/padmgr.c index 163e546b14..5cc539dbf0 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -8,50 +8,53 @@ s32 D_8012D280 = 1; -OSMesgQueue* PadMgr_LockGetControllerQueue(PadMgr* padmgr) -{ +OSMesgQueue* PadMgr_LockGetControllerQueue(PadMgr* padmgr) { OSMesgQueue* ctrlrqueue = NULL; - if (D_8012D280 > 2) - //EUC-JP: ロック待ち | Waiting for lock - osSyncPrintf("%2d %d serialMsgQロック待ち %08x %08x %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, padmgr, &padmgr->queue1, &ctrlrqueue); + if (D_8012D280 > 2) { + // EUC-JP: ロック待ち | Waiting for lock + osSyncPrintf("%2d %d serialMsgQロック待ち %08x %08x %08x\n", osGetThreadId(NULL), + padmgr->queue1.validCount, padmgr, &padmgr->queue1, &ctrlrqueue); + } osRecvMesg(&padmgr->queue1, &ctrlrqueue, OS_MESG_BLOCK); - if (D_8012D280 > 2) - //EUC-JP: をロックしました | Locked - osSyncPrintf("%2d %d serialMsgQをロックしました %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, ctrlrqueue); + if (D_8012D280 > 2) { + // EUC-JP: をロックしました | Locked + osSyncPrintf("%2d %d serialMsgQをロックしました %08x\n", osGetThreadId(NULL), + padmgr->queue1.validCount, ctrlrqueue); + } return ctrlrqueue; } -void PadMgr_UnlockReleaseControllerQueue(PadMgr* padmgr, OSMesgQueue* ctrlrqueue) -{ - if (D_8012D280 > 2) - //EUC-JP: ロック解除します | Unlock - osSyncPrintf("%2d %d serialMsgQロック解除します %08x %08x %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue); +void PadMgr_UnlockReleaseControllerQueue(PadMgr* padmgr, OSMesgQueue* ctrlrqueue) { + if (D_8012D280 > 2) { + // EUC-JP: ロック解除します | Unlock + osSyncPrintf("%2d %d serialMsgQロック解除します %08x %08x %08x\n", osGetThreadId(NULL), + padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue); + } osSendMesg(&padmgr->queue1, ctrlrqueue, OS_MESG_BLOCK); - if (D_8012D280 > 2) - //EUC-JP: ロック解除しました | Unlocked - osSyncPrintf("%2d %d serialMsgQロック解除しました %08x %08x %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue); + if (D_8012D280 > 2) { + // EUC-JP: ロック解除しました | Unlocked + osSyncPrintf("%2d %d serialMsgQロック解除しました %08x %08x %08x\n", osGetThreadId(NULL), + padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue); + } } -void PadMgr_Lock2(PadMgr* padmgr) -{ +void PadMgr_Lock2(PadMgr* padmgr) { osRecvMesg(&padmgr->queue2, NULL, OS_MESG_BLOCK); } -void PadMgr_Unlock2(PadMgr* padmgr) -{ +void PadMgr_Unlock2(PadMgr* padmgr) { osSendMesg(&padmgr->queue2, NULL, OS_MESG_BLOCK); } #ifdef NON_MATCHING // regalloc and minor ordering differences -void func_800C740C(PadMgr* padmgr) -{ +void func_800C740C(PadMgr* padmgr) { static u32 D_8012D284 = 0; static u32 D_8016A4F0; s32 temp; @@ -65,54 +68,39 @@ void func_800C740C(PadMgr* padmgr) ctrlrqueue = PadMgr_LockGetControllerQueue(padmgr); var1 = 0; - for (i = 0; i < 4; i++) - { - if (padmgr->unk_2AA[i] != 0) - { - if (padmgr->pad_status[i].status & 1) - { - if (padmgr->unk_2AE[i] == temp) - { - if (padmgr->unk_2B2[i] != 0) - { - if (padmgr->unk_2B6[i] < 3) - { + for (i = 0; i < 4; i++) { + if (padmgr->unk_2AA[i] != 0) { + if (padmgr->pad_status[i].status & 1) { + if (padmgr->unk_2AE[i] == temp) { + if (padmgr->unk_2B2[i] != 0) { + if (padmgr->unk_2B6[i] < 3) { osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック ぶるぶるぶるぶる"); osSyncPrintf(VT_RST); - if (osSetVibration(&padmgr->unk_controller[i], temp) != 0) - { + if (osSetVibration(&padmgr->unk_controller[i], temp) != 0) { padmgr->unk_2AE[i] = 0; osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックで通信エラーが発生しました"); osSyncPrintf(VT_RST); - } - else - { + } else { padmgr->unk_2B6[i] = 3; } var1 = 1; } - } - else - { - if (padmgr->unk_2B6[i] != 0) - { + } else { + if (padmgr->unk_2B6[i] != 0) { osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止"); osSyncPrintf(VT_RST); - if (osSetVibration(&padmgr->unk_controller[i], 0) != 0) - { + if (osSetVibration(&padmgr->unk_controller[i], 0) != 0) { padmgr->unk_2AE[i] = 0; osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックで通信エラーが発生しました"); osSyncPrintf(VT_RST); - } - else - { + } else { padmgr->unk_2B6[i]--; } @@ -120,22 +108,17 @@ void func_800C740C(PadMgr* padmgr) } } } - } - else - { - if (padmgr->unk_2AE[i] != 0) - { - if (padmgr->unk_2AE[i] == 1) - { + } else { + if (padmgr->unk_2AE[i] != 0) { + if (padmgr->unk_2AE[i] == 1) { osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックが抜かれたようです"); osSyncPrintf(VT_RST); padmgr->unk_2AE[i] = 0; - } - else - { + } else { osSyncPrintf(VT_FGCOL(YELLOW)); - osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックではないコントローラパックが抜かれたようです"); + osSyncPrintf("padmgr: %dコン: %s\n", i + 1, + "振動パックではないコントローラパックが抜かれたようです"); osSyncPrintf(VT_RST); padmgr->unk_2AE[i] = 0; } @@ -144,29 +127,22 @@ void func_800C740C(PadMgr* padmgr) } } - if (!var1) - { + if (!var1) { var3 = D_8016A4F0 % 4; - if ((padmgr->unk_2AA[var3] != 0) && (padmgr->pad_status[var3].status & 1) && (padmgr->unk_2AE[var3] != 1)) - { + if ((padmgr->unk_2AA[var3] != 0) && (padmgr->pad_status[var3].status & 1) && (padmgr->unk_2AE[var3] != 1)) { var4 = osProbeVibrationPack(ctrlrqueue, &padmgr->unk_controller[var3], var3); - if (var4 == 0) - { + if (var4 == 0) { padmgr->unk_2AE[var3] = 1; osSetVibration(&padmgr->unk_controller[var3], 1); osSetVibration(&padmgr->unk_controller[var3], 0); osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("padmgr: %dコン: %s\n", var3 + 1, "振動パックを認識しました"); osSyncPrintf(VT_RST); - } - else if (var4 == 11) - { + } else if (var4 == 11) { padmgr->unk_2AE[var3] = 2; - } - else if (var4 == 4) - { + } else if (var4 == 4) { LogUtils_LogThreadId("../padmgr.c", 282); osSyncPrintf("++errcnt = %d\n", ++D_8012D284); osSyncPrintf(VT_FGCOL(YELLOW)); @@ -185,22 +161,18 @@ u32 D_8016A4F0; #pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C740C.s") #endif -//func_800A2300 in 1.0 -void func_800C7818(PadMgr* padmgr) -{ +// func_800A2300 in 1.0 +void func_800C7818(PadMgr* padmgr) { s32 i; OSMesgQueue* ctrlrqueue; ctrlrqueue = PadMgr_LockGetControllerQueue(padmgr); - for (i = 0; i < 4; i++) - { - if (osProbeVibrationPack(ctrlrqueue, &padmgr->unk_controller[i], i) == 0) - { - if ((gFaultStruct.msgId == 0) && (padmgr->unk_45D != 0)) - { + for (i = 0; i < 4; i++) { + if (osProbeVibrationPack(ctrlrqueue, &padmgr->unk_controller[i], i) == 0) { + if ((gFaultStruct.msgId == 0) && (padmgr->unk_45D != 0)) { osSyncPrintf(VT_FGCOL(YELLOW)); - //EUC-JP: コン | 'Con'? , EUC-JP: 振動パック 停止 | Stop vibration pack + // EUC-JP: コン | 'Con'? , EUC-JP: 振動パック 停止 | Stop vibration pack osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止"); osSyncPrintf(VT_RST); } @@ -212,13 +184,11 @@ void func_800C7818(PadMgr* padmgr) PadMgr_UnlockReleaseControllerQueue(padmgr, ctrlrqueue); } -void func_800C7928(PadMgr* padmgr) -{ +void func_800C7928(PadMgr* padmgr) { padmgr->unk_45C = 3; } -void func_800C7934(PadMgr* padmgr, u32 a1, u32 a2) -{ +void func_800C7934(PadMgr* padmgr, u32 a1, u32 a2) { padmgr->unk_2B2[a1] = a2; padmgr->unk_45D = 0xF0; } @@ -226,8 +196,7 @@ void func_800C7934(PadMgr* padmgr, u32 a1, u32 a2) #ifdef NON_MATCHING // minor ordering difference // 800A23CC in 1.0 -void func_800C7948(PadMgr* padmgr, u8* a1) -{ +void func_800C7948(PadMgr* padmgr, u8* a1) { padmgr->unk_2B2[0] = a1[0]; padmgr->unk_2B2[1] = a1[1]; padmgr->unk_2B2[2] = a1[2]; @@ -243,46 +212,45 @@ void func_800C7948(PadMgr* padmgr, u8* a1) #pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C7C14.s") -void func_800C7DD0(PadMgr* padmgr) -{ +void func_800C7DD0(PadMgr* padmgr) { osSyncPrintf("padmgr_HandlePreNMI()\n"); padmgr->unk_45E = 1; func_800C7928(padmgr); } #pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C7E08.s") -//void func_800C7E08(Input*, u32); +// void func_800C7E08(Input*, u32); -//800A2918 in 1.0 -void PadMgr_Run(PadMgr* padmgr) -{ +// 800A2918 in 1.0 +void PadMgr_Run(PadMgr* padmgr) { s16* mesg; s32 bVar2; mesg = NULL; - //EUC-JP: コントローラスレッド実行開始 | Start of controller thread execution + // EUC-JP: コントローラスレッド実行開始 | Start of controller thread execution osSyncPrintf("コントローラスレッド実行開始\n"); bVar2 = 0; - while (bVar2 == 0) - { - if ((D_8012D280 > 2) && (padmgr->queue3.validCount == 0)) - //EUC-JP: コントローラスレッドイベント待ち | Waiting for controller thread event - osSyncPrintf("コントローラスレッドイベント待ち %lld\n" , (osGetTime() * 64) / 3000); + while (bVar2 == 0) { + if ((D_8012D280 > 2) && (padmgr->queue3.validCount == 0)) { + // EUC-JP: コントローラスレッドイベント待ち | Waiting for controller thread event + osSyncPrintf("コントローラスレッドイベント待ち %lld\n", (osGetTime() * 64) / 3000); + } osRecvMesg(&padmgr->queue3, &mesg, OS_MESG_BLOCK); LogUtils_CheckNullPointer("msg", mesg, "../padmgr.c", 563); - switch (*mesg) - { + switch (*mesg) { case OS_SC_RETRACE_MSG: - if (D_8012D280 > 2) + if (D_8012D280 > 2) { osSyncPrintf("padmgr_HandleRetraceMsg START %lld\n", (osGetTime() * 64) / 3000); + } func_800C7C14(padmgr); - if (D_8012D280 > 2) + if (D_8012D280 > 2) { osSyncPrintf("padmgr_HandleRetraceMsg END %lld\n", (osGetTime() * 64) / 3000); + } break; case OS_SC_PRE_NMI_MSG: @@ -295,14 +263,13 @@ void PadMgr_Run(PadMgr* padmgr) } IrqMgr_RemoveClient(padmgr->unk_78, &padmgr->unk_70); - //EUC-JP: コントローラスレッド実行終了 | Controller thread execution end + // EUC-JP: コントローラスレッド実行終了 | Controller thread execution end osSyncPrintf("コントローラスレッド実行終了\n"); } -//func_800A2A14 in 1.0 -void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* ctrlrqueue, UNK_TYPE arg2, OSId id, OSPri priority, void* stack) -{ - //EUC-JP: パッドマネージャ作成 | Create pad manager +// func_800A2A14 in 1.0 +void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* ctrlrqueue, UNK_TYPE arg2, OSId id, OSPri priority, void* stack) { + // EUC-JP: パッドマネージャ作成 | Create pad manager osSyncPrintf("パッドマネージャ作成 padmgr_Create()\n"); bzero(padmgr, sizeof(PadMgr)); padmgr->unk_78 = arg2; diff --git a/src/code/relocation.c b/src/code/relocation.c index 6e429742cd..80839b9d99 100644 --- a/src/code/relocation.c +++ b/src/code/relocation.c @@ -1,3 +1,3 @@ #include -#pragma GLOBAL_ASM("asm/non_matchings/code/relocation/Overlay_DoRelocation.s") \ No newline at end of file +#pragma GLOBAL_ASM("asm/non_matchings/code/relocation/Overlay_DoRelocation.s") diff --git a/src/code/sched.c b/src/code/sched.c index dcf38e22b9..af971ff2e2 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -4,14 +4,13 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C82A0.s") -void func_800C84E4(SchedContext* sc, UNK_TYPE arg1) -{ - if (sc->unk_24C != 0) - { +void func_800C84E4(SchedContext* sc, UNK_TYPE arg1) { + if (sc->unk_24C != 0) { sc->unk_24C = 0; - if (gIrqMgrResetStatus == 0) + if (gIrqMgrResetStatus == 0) { ViConfig_UpdateVi(0); + } } func_800C82A0(arg1); @@ -19,26 +18,25 @@ void func_800C84E4(SchedContext* sc, UNK_TYPE arg1) #pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C8534.s") -void func_800C87CC(SchedContext* sc) -{ +void func_800C87CC(SchedContext* sc) { ViConfig_UpdateVi(1); } #pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C87F0.s") -void func_800C8910(SchedContext* sc) -{ - if (!(sc->curRSPTask->state & 0x10)) - { - if (sc->curRSPTask->list.t.type == M_AUDTASK) +void func_800C8910(SchedContext* sc) { + if (!(sc->curRSPTask->state & 0x10)) { + if (sc->curRSPTask->list.t.type == M_AUDTASK) { __assert("sc->curRSPTask->list.t.type != M_AUDTASK", "../sched.c", 496); + } sc->curRSPTask->state |= 0x10; osSpTaskYield(); - if (D_8012D290 != 0) + if (D_8012D290 != 0) { osSyncPrintf("%08d:osSpTaskYield\n", (u32)((osGetTime() * 64) / 3000)); + } } } @@ -46,39 +44,37 @@ void func_800C8910(SchedContext* sc) #pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C8A94.s") -typedef struct -{ - /* 0x00 */ char unk_00[0x04]; - /* 0x00 */ u32 unk_04; - /* 0x00 */ u32 unk_08; +typedef struct { + /* 0x00 */ char unk_00[0x04]; + /* 0x00 */ u32 unk_04; + /* 0x00 */ u32 unk_08; /* 0x0C */ UNK_TYPE unk_0C; - /* 0x10 */ char unk_10[0x40]; + /* 0x10 */ char unk_10[0x40]; /* 0x50 */ OSMesgQueue* msgQ; - /* 0x54 */ OSMesg msg; + /* 0x54 */ OSMesg msg; } struct_800C8C40; -void func_800C8BC4(SchedContext* sc, struct_800C8C40* arg1) -{ - if (sc->pendingSwapBuf1 == 0) - { +void func_800C8BC4(SchedContext* sc, struct_800C8C40* arg1) { + if (sc->pendingSwapBuf1 == 0) { sc->pendingSwapBuf1 = arg1->unk_0C; LogUtils_CheckValidPointer("sc->pending_swapbuffer1", sc->pendingSwapBuf1, "../sched.c", 618); - if ((sc->unk_240 == NULL) || (sc->unk_240->unk_12 < 1)) + if ((sc->unk_240 == NULL) || (sc->unk_240->unk_12 < 1)) { func_800C84E4(sc, arg1->unk_0C); + } } } -u32 func_800C8C40(SchedContext* sc, struct_800C8C40* arg1) -{ - if (!(arg1->unk_04 & 3)) - { - if (arg1->msgQ != NULL) +u32 func_800C8C40(SchedContext* sc, struct_800C8C40* arg1) { + if (!(arg1->unk_04 & 3)) { + if (arg1->msgQ != NULL) { osSendMesg(arg1->msgQ, arg1->msg, OS_MESG_BLOCK); + } - if (arg1->unk_08 & 0x40) + if (arg1->unk_08 & 0x40) { func_800C8BC4(sc, arg1); + } return 1; } @@ -96,18 +92,17 @@ u32 func_800C8C40(SchedContext* sc, struct_800C8C40* arg1) #pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C94B4.s") -void func_800C95F8(OSMesgQueue* mq) -{ - if (D_8012D290 != 0) +void func_800C95F8(OSMesgQueue* mq) { + if (D_8012D290 != 0) { osSyncPrintf("osScKickEntryMsg\n"); + } osSendMesg(mq, 670, OS_MESG_BLOCK); } #pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C9644.s") -void func_800C9874(SchedContext* sc, void* stack, OSPri priority, UNK_TYPE arg3, UNK_TYPE arg4, UNK_TYPE arg5) -{ +void func_800C9874(SchedContext* sc, void* stack, OSPri priority, UNK_TYPE arg3, UNK_TYPE arg4, UNK_TYPE arg5) { bzero(sc, sizeof(SchedContext)); sc->unk_24C = 1; osCreateMesgQueue(&sc->interruptQ, sc->intBuf, 8); diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index 3c5cecf9c2..ec5e93b070 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -1,36 +1,30 @@ #include #include -typedef struct -{ +typedef struct { /* 0x00 */ char unk_00[0x18]; - /* 0x18 */ s32 unk_18; - /* 0x1C */ s32 unk_1C; + /* 0x18 */ s32 unk_18; + /* 0x1C */ s32 unk_1C; } struct_801664D0; // size = 0x20 extern struct_801664D0 D_801664D0; -void func_800C9940(struct_801664D0* arg0, u32 arg1, u32 arg2) -{ +void func_800C9940(struct_801664D0* arg0, u32 arg1, u32 arg2) { LogUtils_CheckNullPointer("this", arg0, "../speed_meter.c", 181); arg0->unk_18 = arg1; arg0->unk_1C = arg2; } -void func_800C9998(struct_801664D0* arg0) -{ +void func_800C9998(struct_801664D0* arg0) { func_800C9940(arg0, 0x20, 0x16); } -void func_800C99BC(struct_801664D0* arg0) -{ - +void func_800C99BC(struct_801664D0* arg0) { } #pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_800C99C4.s") -typedef struct -{ +typedef struct { /* 0x00 */ u32 unk_00; /* 0x04 */ u32 unk_04; /* 0x08 */ u16 unk_08; @@ -41,8 +35,8 @@ typedef struct /* 0x18 */ u32 unk_18; } struct_800C9E08; -void func_800C9E08(struct_800C9E08* arg0, u32 arg1, u32 arg2, u16 arg3, u16 arg4, u32 arg5, u32 arg6, u32 arg7, u32 arg8) -{ +void func_800C9E08(struct_800C9E08* arg0, u32 arg1, u32 arg2, u16 arg3, u16 arg4, u32 arg5, u32 arg6, u32 arg7, + u32 arg8) { arg0->unk_00 = arg1; arg0->unk_04 = arg2; arg0->unk_08 = arg3; diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index 182e53f4d3..454b63a58d 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -1,66 +1,55 @@ #include -volatile u32 sSysCfbFbPtr[2]; //may not be volatile but it currently gets SysCfb_Init closer from matching +volatile u32 sSysCfbFbPtr[2]; // may not be volatile but it currently gets SysCfb_Init closer from matching u32 sSysCfbEnd; -//small reaordering +// small reaordering #ifdef NON_MATCHING -void SysCfb_Init(s32 n64dd) -{ - if (osMemSize >= 0x800000U) - { - //8MB or more memory is installed +void SysCfb_Init(s32 n64dd) { + if (osMemSize >= 0x800000U) { + // 8MB or more memory is installed osSyncPrintf("8Mバイト以上のメモリが搭載されています\n"); - if (n64dd == 1) - { - //RAM 8M mode (N64DD compatible) + if (n64dd == 1) { + // RAM 8M mode (N64DD compatible) osSyncPrintf("RAM 8M mode (N64DD対応)\n"); sSysCfbEnd = 0x805FB000; - } - else - { - //The margin for this version is% dK bytes + } else { + // The margin for this version is% dK bytes osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024)); sSysCfbEnd = 0x8044BE80; } - } - else if (osMemSize >= 0x400000U) - { + } else if (osMemSize >= 0x400000U) { sSysCfbEnd = 0x80400000; osSyncPrintf("RAM4M mode\n"); - } - else - { + } else { LogUtils_HungupThread("../sys_cfb.c", 0x162); } sSysCfbEnd &= ~0x3f; - //The final address used by the system is% 08x + // The final address used by the system is% 08x osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd); - sSysCfbFbPtr[0] = sSysCfbEnd - (SCREEN_WIDTH*SCREEN_HEIGHT*4); - sSysCfbFbPtr[1] = sSysCfbEnd - (SCREEN_WIDTH*SCREEN_HEIGHT*2); - //Frame buffer addresses are% 08x and% 08x + sSysCfbFbPtr[0] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 4); + sSysCfbFbPtr[1] = sSysCfbEnd - (SCREEN_WIDTH * SCREEN_HEIGHT * 2); + // Frame buffer addresses are% 08x and% 08x osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/sys_cfb/SysCfb_Init.s") #endif -void SysCfb_Reset() -{ +void SysCfb_Reset() { sSysCfbFbPtr[0] = 0; sSysCfbFbPtr[1] = 0; sSysCfbEnd = 0; } -u32 SysCfb_GetFbPtr(s32 idx) -{ - if (idx < 2) +u32 SysCfb_GetFbPtr(s32 idx) { + if (idx < 2) { return sSysCfbFbPtr[idx]; + } return 0; } -u32 SysCfb_GetFbEnd() -{ +u32 SysCfb_GetFbEnd() { return sSysCfbEnd; -} \ No newline at end of file +} diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 75afbc5ee3..b300f189d1 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -1,83 +1,74 @@ #include #include -Mtx gMtxClear = -{ +// clang-format off +Mtx gMtxClear = { 65536, 0, 1, 0, 0, 65536, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, }; -MtxF gMtxFClear = -{ +MtxF gMtxFClear = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, }; +// clang-format on -MtxF* sMatrixStack; // "Matrix_stack" +MtxF* sMatrixStack; // "Matrix_stack" MtxF* sCurrentMatrix; // "Matrix_now" -void Matrix_Init(GameState* gameState) -{ +void Matrix_Init(GameState* gameState) { sCurrentMatrix = Game_Alloc(gameState, 20 * sizeof(MtxF), "../sys_matrix.c", 153); sMatrixStack = sCurrentMatrix; } -void Matrix_Push(void) -{ +void Matrix_Push(void) { Matrix_MtxFCopy(sCurrentMatrix + 1, sCurrentMatrix); sCurrentMatrix++; } -void Matrix_Pull(void) -{ +void Matrix_Pull(void) { sCurrentMatrix--; - if (sCurrentMatrix < sMatrixStack) + if (sCurrentMatrix < sMatrixStack) { __assert("Matrix_now >= Matrix_stack", "../sys_matrix.c", 176); + } } -void Matrix_Get(MtxF* dest) -{ +void Matrix_Get(MtxF* dest) { Matrix_MtxFCopy(dest, sCurrentMatrix); } -void Matrix_Put(MtxF* src) -{ +void Matrix_Put(MtxF* src) { Matrix_MtxFCopy(sCurrentMatrix, src); } -MtxF* Matrix_GetCurrent(void) -{ +MtxF* Matrix_GetCurrent(void) { return sCurrentMatrix; } -void Matrix_Mult(MtxF* mf, u8 mode) -{ +void Matrix_Mult(MtxF* mf, u8 mode) { MtxF* cmf = Matrix_GetCurrent(); - if (mode == MTXMODE_APPLY) + if (mode == MTXMODE_APPLY) { func_800A6FA0(cmf, mf, cmf); - else + } else { Matrix_MtxFCopy(sCurrentMatrix, mf); + } } #ifdef NON_MATCHING // minor ordering and regalloc differences -void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) -{ +void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) { MtxF* cmf = sCurrentMatrix; - if (mode == MTXMODE_APPLY) - { + if (mode == MTXMODE_APPLY) { cmf->wx += cmf->xx * x + cmf->yx * y + cmf->zx * z; cmf->wy += cmf->xy * x + cmf->yy * y + cmf->zy * z; cmf->wz += cmf->xz * x + cmf->yz * y + cmf->zz * z; cmf->ww += cmf->xw * x + cmf->yw * y + cmf->zw * z; - } - else - { + } else { func_800A7A24(cmf, x, y, z); } } @@ -85,12 +76,10 @@ void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) #pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_Translate.s") #endif -void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) -{ +void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) { MtxF* cmf = sCurrentMatrix; - if (mode == MTXMODE_APPLY) - { + if (mode == MTXMODE_APPLY) { cmf->xx *= x; cmf->xy *= x; cmf->xz *= x; @@ -103,25 +92,20 @@ void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) cmf->xw *= x; cmf->yw *= y; cmf->zw *= z; - } - else - { + } else { func_800A76A4(cmf, x, y, z); } } -void Matrix_RotateX(f32 x, u8 mode) -{ +void Matrix_RotateX(f32 x, u8 mode) { MtxF* cmf; f32 sin; f32 cos; f32 temp1; f32 temp2; - if (mode == MTXMODE_APPLY) - { - if (x != 0) - { + if (mode == MTXMODE_APPLY) { + if (x != 0) { cmf = sCurrentMatrix; sin = sinf(x); @@ -147,18 +131,13 @@ void Matrix_RotateX(f32 x, u8 mode) cmf->yw = temp1 * cos + temp2 * sin; cmf->zw = temp2 * cos - temp1 * sin; } - } - else - { + } else { cmf = sCurrentMatrix; - if (x != 0) - { + if (x != 0) { sin = sinf(x); cos = cosf(x); - } - else - { + } else { sin = 0.0f; cos = 1.0f; } @@ -182,18 +161,15 @@ void Matrix_RotateX(f32 x, u8 mode) } } -void Matrix_RotateY(f32 y, u8 mode) -{ +void Matrix_RotateY(f32 y, u8 mode) { MtxF* cmf; f32 sin; f32 cos; f32 temp1; f32 temp2; - if (mode == MTXMODE_APPLY) - { - if (y != 0) - { + if (mode == MTXMODE_APPLY) { + if (y != 0) { cmf = sCurrentMatrix; sin = sinf(y); @@ -219,18 +195,13 @@ void Matrix_RotateY(f32 y, u8 mode) cmf->xw = temp1 * cos - temp2 * sin; cmf->zw = temp1 * sin + temp2 * cos; } - } - else - { + } else { cmf = sCurrentMatrix; - if (y != 0) - { + if (y != 0) { sin = sinf(y); cos = cosf(y); - } - else - { + } else { sin = 0.0f; cos = 1.0f; } @@ -254,18 +225,15 @@ void Matrix_RotateY(f32 y, u8 mode) } } -void Matrix_RotateZ(f32 z, u8 mode) -{ +void Matrix_RotateZ(f32 z, u8 mode) { MtxF* cmf; f32 sin; f32 cos; f32 temp1; f32 temp2; - if (mode == MTXMODE_APPLY) - { - if (z != 0) - { + if (mode == MTXMODE_APPLY) { + if (z != 0) { cmf = sCurrentMatrix; sin = sinf(z); @@ -291,18 +259,13 @@ void Matrix_RotateZ(f32 z, u8 mode) cmf->xw = temp1 * cos + temp2 * sin; cmf->yw = temp2 * cos - temp1 * sin; } - } - else - { + } else { cmf = sCurrentMatrix; - if (z != 0) - { + if (z != 0) { sin = sinf(z); cos = cosf(z); - } - else - { + } else { sin = 0.0f; cos = 1.0f; } @@ -326,16 +289,14 @@ void Matrix_RotateZ(f32 z, u8 mode) } } -void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode) -{ +void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode) { MtxF* cmf = sCurrentMatrix; f32 temp1; f32 temp2; f32 sin; f32 cos; - if (mode == MTXMODE_APPLY) - { + if (mode == MTXMODE_APPLY) { sin = Math_Sins(z); cos = Math_Coss(z); @@ -359,8 +320,7 @@ void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode) cmf->xw = temp1 * cos + temp2 * sin; cmf->yw = temp2 * cos - temp1 * sin; - if (y != 0) - { + if (y != 0) { sin = Math_Sins(y); cos = Math_Coss(y); @@ -385,8 +345,7 @@ void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode) cmf->zw = temp1 * sin + temp2 * cos; } - if (x != 0) - { + if (x != 0) { sin = Math_Sins(x); cos = Math_Coss(x); @@ -410,15 +369,12 @@ void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode) cmf->yw = temp1 * cos + temp2 * sin; cmf->zw = temp2 * cos - temp1 * sin; } - } - else - { + } else { func_800A7704(cmf, x, y, z); } } -void func_800D1340(Vec3f* arg0, Vec3s* arg1) -{ +void func_800D1340(Vec3f* arg0, Vec3s* arg1) { MtxF* cmf = sCurrentMatrix; f32 sin; f32 cos; @@ -452,8 +408,7 @@ void func_800D1340(Vec3f* arg0, Vec3s* arg1) cmf->xw = temp1 * cos + temp2 * sin; cmf->yw = temp2 * cos - temp1 * sin; - if (arg1->y != 0) - { + if (arg1->y != 0) { sin = Math_Sins(arg1->y); cos = Math_Coss(arg1->y); @@ -478,8 +433,7 @@ void func_800D1340(Vec3f* arg0, Vec3s* arg1) cmf->zw = temp1 * sin + temp2 * cos; } - if (arg1->x != 0) - { + if (arg1->x != 0) { sin = Math_Sins(arg1->x); cos = Math_Coss(arg1->x); @@ -507,8 +461,7 @@ void func_800D1340(Vec3f* arg0, Vec3s* arg1) #ifdef NON_MATCHING // regalloc differences -void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) -{ +void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) { MtxF* cmf = sCurrentMatrix; f32 sp30; f32 sp2C; @@ -528,8 +481,7 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) cmf->zw = 0.0f; cmf->ww = 1.0f; - if (vec->x != 0) - { + if (vec->x != 0) { sp24 = Math_Sins(vec->x); sp28 = Math_Coss(vec->x); @@ -539,9 +491,7 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) cmf->yz = sp2C * sp24; cmf->zx = sp30 * sp28; cmf->yx = sp30 * sp24; - } - else - { + } else { cmf->zz = sp2C; cmf->zx = sp30; cmf->zy = 0.0f; @@ -550,8 +500,7 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) cmf->yy = 1.0f; } - if (vec->z != 0) - { + if (vec->z != 0) { sp24 = Math_Sins(vec->z); sp28 = Math_Coss(vec->z); @@ -568,9 +517,7 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) sp2C = cmf->yy; cmf->xy = sp2C * sp24; cmf->yy = sp2C * sp28; - } - else - { + } else { cmf->xy = 0.0f; } } @@ -580,74 +527,73 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) #ifdef NON_MATCHING // mostly regalloc differences -Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) -{ +Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { u16* m1 = (u16*)&dest->m[0][0]; u16* m2 = (u16*)&dest->m[2][0]; s32 temp; temp = src->xx * 65536.0f; - m1[0] = (temp >> 0x10) & 0xFFFF;; + m1[0] = (temp >> 0x10) & 0xFFFF; m2[0] = temp & 0xFFFF; temp = src->xy * 65536.0f; - m1[1] = (temp >> 0x10) & 0xFFFF;; + m1[1] = (temp >> 0x10) & 0xFFFF; m2[1] = temp & 0xFFFF; temp = src->xz * 65536.0f; - m1[2] = (temp >> 0x10) & 0xFFFF;; + m1[2] = (temp >> 0x10) & 0xFFFF; m2[2] = temp & 0xFFFF; temp = src->xw * 65536.0f; - m1[3] = (temp >> 0x10) & 0xFFFF;; + m1[3] = (temp >> 0x10) & 0xFFFF; m2[3] = temp & 0xFFFF; temp = src->yx * 65536.0f; - m1[4] = (temp >> 0x10) & 0xFFFF;; + m1[4] = (temp >> 0x10) & 0xFFFF; m2[4] = temp & 0xFFFF; temp = src->yy * 65536.0f; - m1[5] = (temp >> 0x10) & 0xFFFF;; + m1[5] = (temp >> 0x10) & 0xFFFF; m2[5] = temp & 0xFFFF; temp = src->yz * 65536.0f; - m1[6] = (temp >> 0x10) & 0xFFFF;; + m1[6] = (temp >> 0x10) & 0xFFFF; m2[6] = temp & 0xFFFF; temp = src->yw * 65536.0f; - m1[7] = (temp >> 0x10) & 0xFFFF;; + m1[7] = (temp >> 0x10) & 0xFFFF; m2[7] = temp & 0xFFFF; temp = src->zx * 65536.0f; - m1[8] = (temp >> 0x10) & 0xFFFF;; + m1[8] = (temp >> 0x10) & 0xFFFF; m2[8] = temp & 0xFFFF; temp = src->zy * 65536.0f; - m1[9] = (temp >> 0x10) & 0xFFFF;; + m1[9] = (temp >> 0x10) & 0xFFFF; m2[9] = temp & 0xFFFF; temp = src->zz * 65536.0f; - m1[10] = (temp >> 0x10) & 0xFFFF;; + m1[10] = (temp >> 0x10) & 0xFFFF; m2[10] = temp & 0xFFFF; temp = src->zw * 65536.0f; - m1[11] = (temp >> 0x10) & 0xFFFF;; + m1[11] = (temp >> 0x10) & 0xFFFF; m2[11] = temp & 0xFFFF; temp = src->wx * 65536.0f; - m1[12] = (temp >> 0x10) & 0xFFFF;; + m1[12] = (temp >> 0x10) & 0xFFFF; m2[12] = temp & 0xFFFF; temp = src->wy * 65536.0f; - m1[13] = (temp >> 0x10) & 0xFFFF;; + m1[13] = (temp >> 0x10) & 0xFFFF; m2[13] = temp & 0xFFFF; temp = src->wz * 65536.0f; - m1[14] = (temp >> 0x10) & 0xFFFF;; + m1[14] = (temp >> 0x10) & 0xFFFF; m2[14] = temp & 0xFFFF; temp = src->ww * 65536.0f; - m1[15] = (temp >> 0x10) & 0xFFFF;; + m1[15] = (temp >> 0x10) & 0xFFFF; m2[15] = temp & 0xFFFF; return dest; @@ -656,23 +602,19 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) #pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MtxFToMtx.s") #endif -Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) -{ +Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) { return Matrix_MtxFToMtx(Matrix_CheckFloats(sCurrentMatrix, file, line), dest); } -Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line) -{ +Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line) { return Matrix_ToMtx(Graph_Alloc(gfxCtx, sizeof(Mtx)), file, line); } -Mtx* Matrix_MtxFToNewMtx(MtxF* src, GraphicsContext* gfxCtx) -{ +Mtx* Matrix_MtxFToNewMtx(MtxF* src, GraphicsContext* gfxCtx) { return Matrix_MtxFToMtx(src, Graph_Alloc(gfxCtx, sizeof(Mtx))); } -void Matrix_MultVec3f(Vec3f* src, Vec3f* dest) -{ +void Matrix_MultVec3f(Vec3f* src, Vec3f* dest) { MtxF* cmf = sCurrentMatrix; dest->x = cmf->wx + (cmf->xx * src->x + cmf->yx * src->y + cmf->zx * src->z); @@ -680,8 +622,7 @@ void Matrix_MultVec3f(Vec3f* src, Vec3f* dest) dest->z = cmf->wz + (cmf->xz * src->x + cmf->yz * src->y + cmf->zz * src->z); } -void Matrix_MtxFCopy(MtxF* dest, MtxF* src) -{ +void Matrix_MtxFCopy(MtxF* dest, MtxF* src) { dest->xx = src->xx; dest->xy = src->xy; dest->xz = src->xz; @@ -716,8 +657,7 @@ void Matrix_MtxFCopy(MtxF* dest, MtxF* src) dest->ww = src->ww; } -void Matrix_MtxToMtxF(Mtx* src, MtxF* dest) -{ +void Matrix_MtxToMtxF(Mtx* src, MtxF* dest) { u16* m1 = (u16*)&src->m[0][0]; u16* m2 = (u16*)&src->m[2][0]; @@ -739,15 +679,13 @@ void Matrix_MtxToMtxF(Mtx* src, MtxF* dest) dest->ww = ((m1[15] << 0x10) | m2[15]) * (1 / 65536.0f); } -void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf) -{ +void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf) { dest->x = mf->wx + (mf->xx * src->x + mf->yx * src->y + mf->zx * src->z); dest->y = mf->wy + (mf->xy * src->x + mf->yy * src->y + mf->zy * src->z); dest->z = mf->wz + (mf->xz * src->x + mf->yz * src->y + mf->zz * src->z); } -void Matrix_Reverse(MtxF* mf) -{ +void Matrix_Reverse(MtxF* mf) { f32 temp; temp = mf->xy; @@ -764,8 +702,7 @@ void Matrix_Reverse(MtxF* mf) } #ifdef NON_MATCHING -void func_800D1FD4(MtxF* mf) -{ +void func_800D1FD4(MtxF* mf) { MtxF* cmf = sCurrentMatrix; f32 temp; @@ -790,12 +727,10 @@ void func_800D1FD4(MtxF* mf) #ifdef NON_MATCHING // same differences as func_800D2264 -void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) -{ +void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) { vec->x = Math_atan2f(-mf->zy, sqrtf(SQ(mf->zx) + SQ(mf->zz))) * (32768 / M_PI); - if ((vec->x == 0x4000) || (vec->x == -0x4000)) - { + if ((vec->x == 0x4000) || (vec->x == -0x4000)) { vec->z = 0; vec->y = Math_atan2f(-mf->xz, mf->xx) * (32768 / M_PI); return; @@ -806,8 +741,9 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) if (!flag) vec->z = Math_atan2f(mf->xy, mf->yy) * (32768 / M_PI); else - vec->z = Math_atan2f(mf->xy / sqrtf(SQ(mf->xx) + SQ(mf->xz) + SQ(mf->xy)), - mf->yy / sqrtf(SQ(mf->yx) + SQ(mf->yz) + SQ(mf->yy))) * (32768 / M_PI); + vec->z = Math_atan2f(mf->xy / sqrtf(SQ(mf->xx) + SQ(mf->xz) + SQ(mf->xy)), + mf->yy / sqrtf(SQ(mf->yx) + SQ(mf->yz) + SQ(mf->yy))) * + (32768 / M_PI); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D20CC.s") @@ -815,12 +751,10 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) #ifdef NON_MATCHING // same differences as func_800D20CC -void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) -{ +void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) { vec->y = Math_atan2f(-mf->xz, sqrtf(SQ(mf->xx) + SQ(mf->xy))) * (32768 / M_PI); - if ((vec->y == 0x4000) || (vec->y == -0x4000)) - { + if ((vec->y == 0x4000) || (vec->y == -0x4000)) { vec->x = 0; vec->z = Math_atan2f(-mf->yx, mf->yy) * (32768 / M_PI); return; @@ -831,8 +765,9 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) if (!flag) vec->x = Math_atan2f(mf->yz, mf->zz) * (32768 / M_PI); else - vec->x = Math_atan2f(mf->yz / sqrtf(SQ(mf->yx) + SQ(mf->yy) + SQ(mf->yz)), - mf->zz / sqrtf(SQ(mf->zx) + SQ(mf->zy) + SQ(mf->zz))) * (32768 / M_PI); + vec->x = Math_atan2f(mf->yz / sqrtf(SQ(mf->yx) + SQ(mf->yy) + SQ(mf->yz)), + mf->zz / sqrtf(SQ(mf->zx) + SQ(mf->zy) + SQ(mf->zz))) * + (32768 / M_PI); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D2264.s") @@ -840,8 +775,7 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) #ifdef NON_MATCHING // regalloc differences -void func_800D23FC(f32 f, Vec3f* vec, u8 mode) -{ +void func_800D23FC(f32 f, Vec3f* vec, u8 mode) { MtxF* cmf; f32 sin; f32 cos; @@ -851,10 +785,8 @@ void func_800D23FC(f32 f, Vec3f* vec, u8 mode) f32 temp3; f32 temp4; - if (mode == MTXMODE_APPLY) - { - if (f != 0) - { + if (mode == MTXMODE_APPLY) { + if (f != 0) { cmf = sCurrentMatrix; sin = sinf(f); @@ -884,13 +816,10 @@ void func_800D23FC(f32 f, Vec3f* vec, u8 mode) cmf->yz = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); cmf->zz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); } - } - else - { + } else { cmf = sCurrentMatrix; - if (f != 0) - { + if (f != 0) { sin = sinf(f); cos = cosf(f); rCos = 1.0f - cos; @@ -921,9 +850,7 @@ void func_800D23FC(f32 f, Vec3f* vec, u8 mode) cmf->wy = 0.0f; cmf->wz = 0.0f; cmf->ww = 1.0f; - } - else - { + } else { cmf->xy = 0.0f; cmf->xz = 0.0f; cmf->xw = 0.0f; @@ -947,17 +874,16 @@ void func_800D23FC(f32 f, Vec3f* vec, u8 mode) #pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_800D23FC.s") #endif -MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) -{ +MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) { s32 i, j; - for (i = 0; i < 4; i++) - { - for (j = 0; j < 4; j++) - { - if (!(-32768.0f <= mf->mf[i][j]) || !(mf->mf[i][j] < 32768.0f)) - { - osSyncPrintf("%s %d: [%s] =\n/ %12.6f %12.6f %12.6f %12.6f \\\n| %12.6f %12.6f %12.6f %12.6f |\n| %12.6f %12.6f %12.6f %12.6f |\n\\ %12.6f %12.6f %12.6f %12.6f /\n", file, line, "mf", mf->xx, mf->yx, mf->zx, mf->wx, mf->xy, mf->yy, mf->zy, mf->wy, mf->xz, mf->yz, mf->zz, mf->wz, mf->xw, mf->yw, mf->zw, mf->ww); + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + if (!(-32768.0f <= mf->mf[i][j]) || !(mf->mf[i][j] < 32768.0f)) { + osSyncPrintf("%s %d: [%s] =\n/ %12.6f %12.6f %12.6f %12.6f \\\n| %12.6f %12.6f %12.6f %12.6f |\n| " + "%12.6f %12.6f %12.6f %12.6f |\n\\ %12.6f %12.6f %12.6f %12.6f /\n", + file, line, "mf", mf->xx, mf->yx, mf->zx, mf->wx, mf->xy, mf->yy, mf->zy, mf->wy, mf->xz, + mf->yz, mf->zz, mf->wz, mf->xw, mf->yw, mf->zw, mf->ww); Fault_AddHungupAndCrash(file, line); } } @@ -966,8 +892,7 @@ MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) return mf; } -void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) -{ +void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { mf->xy = 0.0f; mf->xz = 0.0f; mf->xw = 0.0f; @@ -986,16 +911,14 @@ void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) mf->ww = 1.0f; } -void func_800D2A98(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) -{ +void func_800D2A98(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { MtxF mf; func_800D2A34(&mf, arg1, arg2, arg3, arg4); func_801064E0(&mf, mtx); } -void func_800D2AE4(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) -{ +void func_800D2AE4(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { u16* m1 = (u16*)&mtx->m[0][0]; u16* m2 = (u16*)&mtx->m[2][0]; u32 temp; @@ -1047,8 +970,7 @@ void func_800D2AE4(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) m2[15] = 0; } -void func_800D2BD0(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) -{ +void func_800D2BD0(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) { u16* m1 = (u16*)&mtx->m[0][0]; u16* m2 = (u16*)&mtx->m[2][0]; u32 temp; @@ -1102,8 +1024,7 @@ void func_800D2BD0(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f #ifdef NON_MATCHING // minor ordering and regalloc differences -void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) -{ +void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) { u16* m1 = (u16*)&mtx->m[0][0]; u16* m2 = (u16*)&mtx->m[2][0]; u32 temp; diff --git a/src/code/sys_ucode.c b/src/code/sys_ucode.c index 0bd1690905..f23c7239a0 100644 --- a/src/code/sys_ucode.c +++ b/src/code/sys_ucode.c @@ -1,21 +1,17 @@ #include -u32 SysUcode_GetUCodeBoot() -{ +u32 SysUcode_GetUCodeBoot() { return &D_80009320; } -u32 SysUcode_GetUcodeBootSize() -{ +u32 SysUcode_GetUcodeBootSize() { return (u32)&D_800093F0 - (u32)&D_80009320; } -u32 SysUcode_GetUcode() -{ +u32 SysUcode_GetUcode() { return D_8012DBA0; } -u32 SysUcode_GetUcodeData() -{ +u32 SysUcode_GetUcodeData() { return D_8012DBA4; } diff --git a/src/code/system_malloc.c b/src/code/system_malloc.c index d7c91bbf38..3c75b60654 100644 --- a/src/code/system_malloc.c +++ b/src/code/system_malloc.c @@ -1,131 +1,112 @@ #include -#define LOG_SEVERITY_NOLOG 0 -#define LOG_SEVERITY_ERROR 2 -#define LOG_SEVERITY_VERBOSE 3 +#define LOG_SEVERITY_NOLOG 0 +#define LOG_SEVERITY_ERROR 2 +#define LOG_SEVERITY_VERBOSE 3 s32 gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; Arena gSystemArena; -void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) -{ - if (!ptr) - { - if (gSystemArenaLogSeverity >= LOG_SEVERITY_ERROR) - { +void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { + if (!ptr) { + if (gSystemArenaLogSeverity >= LOG_SEVERITY_ERROR) { //"%s: %u bytes %s failed\n" osSyncPrintf("%s: %u バイトの%sに失敗しました\n", name, size, action); __osDisplayArena(&gSystemArena); return; } - } - else if (gSystemArenaLogSeverity >= LOG_SEVERITY_VERBOSE) - { + } else if (gSystemArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { //"%s: %u bytes %s succeeded\n" osSyncPrintf("%s: %u バイトの%sに成功しました\n", name, size, action); } } -void* SystemArena_Malloc(u32 size) -{ +void* SystemArena_Malloc(u32 size) { void* ptr; ptr = __osMalloc(&gSystemArena, size); - SystemArena_CheckPointer(ptr, size, "malloc", "確保"); //Secure + SystemArena_CheckPointer(ptr, size, "malloc", "確保"); // Secure return ptr; } -void* SystemArena_MallocDebug(u32 size, const char* file, s32 line) -{ +void* SystemArena_MallocDebug(u32 size, const char* file, s32 line) { void* ptr; ptr = __osMallocDebug(&gSystemArena, size, file, line); - SystemArena_CheckPointer(ptr, size, "malloc_DEBUG", "確保"); //Secure + SystemArena_CheckPointer(ptr, size, "malloc_DEBUG", "確保"); // Secure return ptr; } -void* SystemArena_MallocR(u32 size) -{ +void* SystemArena_MallocR(u32 size) { void* ptr; ptr = __osMallocR(&gSystemArena, size); - SystemArena_CheckPointer(ptr, size, "malloc_r", "確保"); //Secure + SystemArena_CheckPointer(ptr, size, "malloc_r", "確保"); // Secure return ptr; } -void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line) -{ +void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line) { void* ptr; ptr = __osMallocRDebug(&gSystemArena, size, file, line); - SystemArena_CheckPointer(ptr, size, "malloc_r_DEBUG", "確保"); //Secure + SystemArena_CheckPointer(ptr, size, "malloc_r_DEBUG", "確保"); // Secure return ptr; } -void* SystemArena_Realloc(void* ptr, u32 newSize) -{ +void* SystemArena_Realloc(void* ptr, u32 newSize) { ptr = __osRealloc(&gSystemArena, ptr, newSize); SystemArena_CheckPointer(ptr, newSize, "realloc", "再確保"); // Re-securing return ptr; } -void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) -{ +void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { ptr = __osReallocDebug(&gSystemArena, ptr, newSize, file, line); SystemArena_CheckPointer(ptr, newSize, "realloc_DEBUG", "再確保"); // Re-securing return ptr; } -void SystemArena_Free(void* ptr) -{ +void SystemArena_Free(void* ptr) { __osFree(&gSystemArena, ptr); } -void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) -{ +void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) { __osFreeDebug(&gSystemArena, ptr, file, line); } -void* SystemArena_Calloc(u32 num, u32 size) -{ +void* SystemArena_Calloc(u32 num, u32 size) { void* ret; u32 n; - n = num*size; + n = num * size; ret = __osMalloc(&gSystemArena, n); - if (ret) + if (ret) { bzero(ret, n); + } SystemArena_CheckPointer(ret, n, "calloc", "確保"); return ret; } -void SystemArena_Display() -{ - //System heap display +void SystemArena_Display() { + // System heap display osSyncPrintf("システムヒープ表示\n"); __osDisplayArena(&gSystemArena); } -void SystemArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) -{ +void SystemArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaImpl_GetSizes(&gSystemArena, outMaxFree, outFree, outAlloc); } -void SystemArena_Check() -{ +void SystemArena_Check() { __osCheckArena(&gSystemArena); } -void SystemArena_Init(void* start, u32 size) -{ +void SystemArena_Init(void* start, u32 size) { gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; __osMallocInit(&gSystemArena, start, size); } -void SystemArena_Cleanup() -{ +void SystemArena_Cleanup() { gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG; __osMallocCleanup(&gSystemArena); } -u8 SystemArena_IsInitalized() -{ +u8 SystemArena_IsInitalized() { return __osMallocIsInitalized(&gSystemArena); } diff --git a/src/code/title_setup.c b/src/code/title_setup.c index b0c3e76f99..827987d33c 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -1,21 +1,17 @@ #include -void TitleSetup_InitImpl(GameState* gameState) -{ - //Zelda common data initalization +void TitleSetup_InitImpl(GameState* gameState) { + // Zelda common data initalization osSyncPrintf("ゼルダ共通データ初期化\n"); SaveContext_Init(); gameState->running = false; SET_NEXT_GAMESTATE(gameState, Title_Init, TitleContext); } -void TitleSetup_Destroy(GameState* gameState) -{ - +void TitleSetup_Destroy(GameState* gameState) { } -void TitleSetup_Init(GameState* gameState) -{ +void TitleSetup_Init(GameState* gameState) { gameState->destroy = TitleSetup_Destroy; TitleSetup_InitImpl(gameState); -} \ No newline at end of file +} diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index 2117a771a0..ab09cbac5a 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -2,109 +2,110 @@ #include #include -void Overlay_LoadGameState(GameStateOverlay* overlayEntry) -{ - if (overlayEntry->loadedRamAddr != NULL) - { +void Overlay_LoadGameState(GameStateOverlay* overlayEntry) { + if (overlayEntry->loadedRamAddr != NULL) { // Translates to: "ALREADY LINKED" osSyncPrintf("既にリンクされています\n"); return; } - if (overlayEntry->vramStart == 0) + if (overlayEntry->vramStart == 0) { overlayEntry->unk_28 = 0; - else - { + } else { overlayEntry->loadedRamAddr = Overlay_AllocateAndLoad(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd); - if (overlayEntry->loadedRamAddr == NULL) - { + if (overlayEntry->loadedRamAddr == NULL) { // Translates to: "LOADING FAILED" osSyncPrintf("ロードに失敗しました\n"); return; } osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("OVL(d):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", - overlayEntry->vramStart, overlayEntry->vramEnd, + osSyncPrintf("OVL(d):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, (u32)overlayEntry->loadedRamAddr + (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart, - (u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr, - ""); + (u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr, ""); osSyncPrintf(VT_RST); - if (overlayEntry->unk_14 != NULL) + if (overlayEntry->unk_14 != NULL) { overlayEntry->unk_14 = (void*)((u32)overlayEntry->unk_14 - (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->unk_14 = NULL; + } - if (overlayEntry->init != NULL) + if (overlayEntry->init != NULL) { overlayEntry->init = (void*)((u32)overlayEntry->init - (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->init = NULL; + } - if (overlayEntry->destroy != NULL) + if (overlayEntry->destroy != NULL) { overlayEntry->destroy = (void*)((u32)overlayEntry->destroy - (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->destroy = NULL; + } - if (overlayEntry->unk_20 != NULL) + if (overlayEntry->unk_20 != NULL) { overlayEntry->unk_20 = (void*)((u32)overlayEntry->unk_20 - (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->unk_20 = NULL; + } - if (overlayEntry->unk_24 != NULL) + if (overlayEntry->unk_24 != NULL) { overlayEntry->unk_24 = (void*)((u32)overlayEntry->unk_24 - (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->unk_24 = NULL; + } overlayEntry->unk_28 = 0; } } -void Overlay_FreeGameState(GameStateOverlay* overlayEntry) -{ - if (overlayEntry->loadedRamAddr != NULL) - { +void Overlay_FreeGameState(GameStateOverlay* overlayEntry) { + if (overlayEntry->loadedRamAddr != NULL) { s32 temp = overlayEntry->unk_28 != 0 ? -1 : 0; - if (temp == 0) - { - if (overlayEntry->unk_14 != NULL) + if (temp == 0) { + if (overlayEntry->unk_14 != NULL) { overlayEntry->unk_14 = (void*)((u32)overlayEntry->unk_14 + (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->unk_14 = NULL; + } - if (overlayEntry->init != NULL) + if (overlayEntry->init != NULL) { overlayEntry->init = (void*)((u32)overlayEntry->init + (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->init = NULL; + } - if (overlayEntry->destroy != NULL) + if (overlayEntry->destroy != NULL) { overlayEntry->destroy = (void*)((u32)overlayEntry->destroy + (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->destroy = NULL; + } - if (overlayEntry->unk_20 != NULL) + if (overlayEntry->unk_20 != NULL) { overlayEntry->unk_20 = (void*)((u32)overlayEntry->unk_20 + (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->unk_20 = NULL; + } - if (overlayEntry->unk_24 != NULL) + if (overlayEntry->unk_24 != NULL) { overlayEntry->unk_24 = (void*)((u32)overlayEntry->unk_24 + (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)); - else + } else { overlayEntry->unk_24 = NULL; + } SystemArena_FreeDebug(overlayEntry->loadedRamAddr, "../z_DLF.c", 149); overlayEntry->loadedRamAddr = NULL; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 958cc4dad2..be598da4a1 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2,57 +2,54 @@ #include #include -void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3) -{ +void ActorShape_Init(ActorShape* shape, f32 arg1, void* shadowDrawFunc, f32 arg3) { shape->unk_08 = arg1; shape->shadowDrawFunc = shadowDrawFunc; shape->unk_10 = arg3; shape->unk_14 = -1; } -void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx, u32 dlist, Color_RGBA8* color) -{ +void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx, u32 dlist, Color_RGBA8* color) { f32 temp1; f32 temp2; MtxF sp60; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (actor->floorPoly != NULL) - { + if (actor->floorPoly != NULL) { temp1 = actor->posRot.pos.y - actor->unk_80; - if (temp1 >= -50.0f && temp1 < 500.0f) - { + if (temp1 >= -50.0f && temp1 < 500.0f) { gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 1553); gfxCtx->polyOpa.p = func_80093774(gfxCtx->polyOpa.p, 0x2C); - gDPSetCombineLERP(gfxCtx->polyOpa.p++, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, - 0, 0, 0, COMBINED, 0, 0, 0, COMBINED); + gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, + 0, COMBINED); temp1 = (temp1 < 0.0f) ? 0.0f : ((temp1 > 150.0f) ? 150.0f : temp1); temp2 = 1.0f - (temp1 * (1.f / 350)); - if (color != NULL) + if (color != NULL) { gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, color->r, color->g, color->b, (u32)(actor->shape.unk_14 * temp2) & 0xFF); - else - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, - (u32)(actor->shape.unk_14 * temp2) & 0xFF); + } else { + gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, (u32)(actor->shape.unk_14 * temp2) & 0xFF); + } func_80038A28(actor->floorPoly, actor->posRot.pos.x, actor->unk_80, actor->posRot.pos.z, &sp60); Matrix_Put(&sp60); - if (dlist != (u32)&D_04049210) + if (dlist != (u32)&D_04049210) { Matrix_RotateY(actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); + } temp2 = (1.0f - (temp1 * (1.f / 350))) * actor->shape.unk_10; Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1588), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1588), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dlist); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 1594); @@ -60,25 +57,21 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global } } -void ActorShadow_DrawFunc_Circle(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) -{ +void ActorShadow_DrawFunc_Circle(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { func_8002B200(actor, lightMapper, globalCtx, &D_04049210, NULL); } Color_RGBA8 D_80115F80 = { 0xFF, 0xFF, 0xFF, 0xFF }; -void ActorShadow_DrawFunc_WhiteCircle(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) -{ +void ActorShadow_DrawFunc_WhiteCircle(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { func_8002B200(actor, lightMapper, globalCtx, &D_04049210, &D_80115F80); } -void ActorShadow_DrawFunc_Squiggly(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) -{ +void ActorShadow_DrawFunc_Squiggly(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { func_8002B200(actor, lightMapper, globalCtx, &D_04049AD0, NULL); } -void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) -{ +void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; f32 sp58; Gfx* gfxArr[7]; @@ -95,7 +88,8 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, Matrix_RotateY(sp58, MTXMODE_APPLY); Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1687), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1687), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, &D_04048180); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 1693); @@ -103,8 +97,7 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, #ifdef NON_MATCHING // this function still needs a lot of work -void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) -{ +void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { GraphicsContext* gfxCtx; MtxF spE8; Vec2f spE0; @@ -129,8 +122,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa temp_f20 = actor->posRot.pos.y - actor->unk_80; - if (temp_f20 > 20.0f) - { + if (temp_f20 > 20.0f) { temp_10 = actor->shape.unk_10; actor->shape.unk_10 *= 0.3f; temp_14 = actor->shape.unk_14; @@ -140,8 +132,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa actor->shape.unk_14 = temp_14; } - if (temp_f20 < 200.0f) - { + if (temp_f20 < 200.0f) { spAC = &spE0.x; gfxCtx = globalCtx->state.gfxCtx; temp_s6 = lightMapper->numLights - 2; @@ -153,8 +144,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa phi_s7 = &actor->unk_CC; - for (index = 0; index < 2; index++) - { + for (index = 0; index < 2; index++) { phi_s7->y += 50.0f; *spAC = func_800BFCB8(globalCtx, &spE8, phi_s7); phi_s7->y -= 50.0f; @@ -163,8 +153,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa phi_f2 = phi_s7->y - *spAC; - if ((phi_f2 >= -1.0f) && (phi_f2 < 500.0f)) - { + if ((phi_f2 >= -1.0f) && (phi_f2 < 500.0f)) { phi_s0 = lightMapper->lights; if (phi_f2 <= 0.0f) @@ -183,13 +172,10 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa phi_s2 = 0; - for (phi_s1 = 0; phi_s1 < temp_s6; phi_s1++) - { - if (phi_s0->l.dir[1] > 0) - { + for (phi_s1 = 0; phi_s1 < temp_s6; phi_s1++) { + if (phi_s0->l.dir[1] > 0) { temp_lo = ABS(phi_s0->l.dir[1]) * ((phi_s0->l.col[0] + phi_s0->l.col[1]) + phi_s0->l.col[2]); - if (temp_lo > 0) - { + if (temp_lo > 0) { func_8002B66C(globalCtx, phi_s0, &spE8, temp_lo, temp_f24, temp_f22_2, temp_f20_2); phi_s2 += temp_lo; } @@ -197,11 +183,10 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa phi_s0++; } - for (phi_s1 = 0; phi_s1 < 2; phi_s1++) - { - if (phi_s0->l.dir[1] > 0) - { - temp_a3 = (ABS(phi_s0->l.dir[1]) * ((phi_s0->l.col[0] + phi_s0->l.col[1]) + phi_s0->l.col[2])) - (phi_s2 * 8); + for (phi_s1 = 0; phi_s1 < 2; phi_s1++) { + if (phi_s0->l.dir[1] > 0) { + temp_a3 = (ABS(phi_s0->l.dir[1]) * ((phi_s0->l.col[0] + phi_s0->l.col[1]) + phi_s0->l.col[2])) - + (phi_s2 * 8); if (temp_a3 > 0) func_8002B66C(globalCtx, phi_s0, &spE8, temp_a3, temp_f24, temp_f22_2, temp_f20_2); } @@ -215,8 +200,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa if (!(actor->bgCheckFlags & 1)) actor->shape.unk_15 = 0; - else if (actor->shape.unk_15 == 3) - { + else if (actor->shape.unk_15 == 3) { temp_f0 = actor->unk_CC.y - actor->unk_D8.y; if ((spE0.x + temp_f0) < (spE0.y - temp_f0)) actor->shape.unk_15 = 2; @@ -231,28 +215,25 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/ActorShadow_DrawFunc_Teardrop.s") #endif -void func_8002BDB0(Actor* actor, s32 arg1, s32 arg2, UNK_PTR arg3, s32 arg4, UNK_PTR arg5) -{ - if (arg1 == arg2) +void func_8002BDB0(Actor* actor, s32 arg1, s32 arg2, UNK_PTR arg3, s32 arg4, UNK_PTR arg5) { + if (arg1 == arg2) { Matrix_MultVec3f(arg3, &actor->unk_CC); - else if (arg1 == arg4) + } else if (arg1 == arg4) { Matrix_MultVec3f(arg5, &actor->unk_D8); + } } -void func_8002BE04(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3) -{ +void func_8002BE04(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, f32* arg3) { func_800A6E10(&globalCtx->mf_11D60, arg1, arg2, arg3); *arg3 = (*arg3 < 1.0f) ? 1.0f : (1.0f / *arg3); } -typedef struct -{ +typedef struct { /* 0x00 */ Color_RGBA8 inner; /* 0x04 */ Color_RGBA8 outer; } NaviColor; // size = 0x8 -NaviColor sNaviColorList[] = -{ +NaviColor sNaviColorList[] = { { { 0x00, 0xFF, 0x00, 0xFF }, { 0x00, 0xFF, 0x00, 0x00 } }, { { 0x00, 0xFF, 0x00, 0xFF }, { 0x00, 0xFF, 0x00, 0x00 } }, { { 0xFF, 0xFF, 0xFF, 0xFF }, { 0x00, 0x00, 0xFF, 0x00 } }, @@ -269,21 +250,18 @@ NaviColor sNaviColorList[] = }; // unused -Gfx D_80115FF0[] = -{ +Gfx D_80115FF0[] = { gsSPEndDisplayList(), }; -void func_8002BE64(TargetContext* targetCtx, s32 index, f32 arg2, f32 arg3, f32 arg4) -{ +void func_8002BE64(TargetContext* targetCtx, s32 index, f32 arg2, f32 arg3, f32 arg4) { targetCtx->arr_50[index].pos.x = arg2; targetCtx->arr_50[index].pos.y = arg3; targetCtx->arr_50[index].pos.z = arg4; targetCtx->arr_50[index].unk_0C = targetCtx->unk_44; } -void func_8002BE98(TargetContext* targetCtx, s32 actorType, GlobalContext* globalCtx) -{ +void func_8002BE98(TargetContext* targetCtx, s32 actorType, GlobalContext* globalCtx) { TargetContextEntry* entry; NaviColor* naviColor; s32 i; @@ -295,8 +273,7 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorType, GlobalContext* globa naviColor = &sNaviColorList[actorType]; entry = &targetCtx->arr_50[0]; - for (i = 0; i < ARRAY_COUNT(targetCtx->arr_50); i++) - { + for (i = 0; i < ARRAY_COUNT(targetCtx->arr_50); i++) { func_8002BE64(targetCtx, i, 0.0f, 0.0f, 0.0f); entry->color.r = naviColor->inner.r; entry->color.g = naviColor->inner.g; @@ -305,8 +282,7 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorType, GlobalContext* globa } } -void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorType, GlobalContext* globalCtx) -{ +void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorType, GlobalContext* globalCtx) { NaviColor* naviColor = &sNaviColorList[actorType]; targetCtx->naviRefPos.x = actor->posRot2.pos.x; targetCtx->naviRefPos.y = actor->posRot2.pos.y + (actor->unk_4C * actor->scale.y); @@ -321,8 +297,7 @@ void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorType, Global targetCtx->naviOuter.a = naviColor->outer.a; } -void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* globalCtx) -{ +void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* globalCtx) { targetCtx->arrowPointedActor = NULL; targetCtx->targetedActor = NULL; targetCtx->unk_40 = 0.0f; @@ -336,8 +311,7 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global #ifdef NON_MATCHING // this function still needs some work -void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) -{ +void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Actor* actor; Player* player; GraphicsContext* gfxCtx; @@ -356,10 +330,9 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) Vec3f* vec; gfxCtx = globalCtx->state.gfxCtx; - func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 2029); + func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 2029); - if (targetCtx->unk_48 != 0) - { + if (targetCtx->unk_48 != 0) { player = PLAYER; spCE = 0xFF; @@ -370,13 +343,10 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) else spB8 = 3; - if (targetCtx->targetedActor != NULL) - { + if (targetCtx->targetedActor != NULL) { Math_Vec3f_Copy(&targetCtx->targetCenterPos, &targetCtx->targetedActor->posRot2.pos); var1 = (500.0f - targetCtx->unk_44) / 420.0f; - } - else - { + } else { targetCtx->unk_48 -= 0x78; if (targetCtx->unk_48 < 0) targetCtx->unk_48 = 0; @@ -399,16 +369,13 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z); - if ((!(player->stateFlags1 & 0x40)) || (targetCtx->targetedActor != player->unk_664)) - { + if ((!(player->stateFlags1 & 0x40)) || (targetCtx->targetedActor != player->unk_664)) { gfxCtx->overlay.p = func_80093774(gfxCtx->overlay.p, 0x39); - for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++) - { + for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++) { entry = &targetCtx->arr_50[spAC]; - if (entry->unk_0C < 500.0f) - { + if (entry->unk_0C < 500.0f) { if (entry->unk_0C <= 120.0f) var2 = 0.15f; else @@ -417,17 +384,17 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) Matrix_Translate(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW); Matrix_Scale(var2, 0.15f, 1.0f, MTXMODE_APPLY); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - entry->color.r, entry->color.g, entry->color.b, (u8)spCE); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, entry->color.r, entry->color.g, entry->color.b, + (u8)spCE); Matrix_RotateZ((targetCtx->unk_4B & 0x7F) * (M_PI / 64), MTXMODE_APPLY); - for (i = 0; i < 4; i++) - { + for (i = 0; i < 4; i++) { Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(entry->unk_0C, entry->unk_0C, 0.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2116), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2116), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->overlay.p++, &D_0404D450); Matrix_Pull(); } @@ -442,25 +409,19 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) } actor = targetCtx->unk_94; - if ((actor != NULL) && !(actor->flags & 0x8000000)) - { + if ((actor != NULL) && !(actor->flags & 0x8000000)) { NaviColor* naviColor = &sNaviColorList[actor->type]; gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 0x7); - Matrix_Translate(actor->posRot2.pos.x, - actor->posRot2.pos.y + (actor->unk_4C * actor->scale.y) + 17.0f, - actor->posRot2.pos.z, - MTXMODE_NEW); + Matrix_Translate(actor->posRot2.pos.x, actor->posRot2.pos.y + (actor->unk_4C * actor->scale.y) + 17.0f, + actor->posRot2.pos.z, MTXMODE_NEW); Matrix_RotateY((f32)((u16)(globalCtx->gameplayFrames * 3000)) * (M_PI / 32768), MTXMODE_APPLY); - Matrix_Scale((iREG(27) + 35) / 1000.0f, - (iREG(28) + 60) / 1000.0f, - (iREG(29) + 50) / 1000.0f, - MTXMODE_APPLY); + Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, - naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 0xFF); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2153), G_MTX_MODELVIEW | G_MTX_LOAD); + gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 0xFF); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2153), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, &D_0400CB70); } @@ -470,8 +431,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_8002C124.s") #endif -void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, GlobalContext* globalCtx) -{ +void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, GlobalContext* globalCtx) { s32 pad; Actor* unkActor; s32 actorType; @@ -487,39 +447,37 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl unkActor = NULL; - if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) + if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) { targetCtx->unk_94 = NULL; - else - { + } else { func_80032AF0(globalCtx, &globalCtx->actorCtx, &unkActor, player); targetCtx->unk_94 = unkActor; } - if (targetCtx->unk_8C != NULL) - { + if (targetCtx->unk_8C != NULL) { unkActor = targetCtx->unk_8C; targetCtx->unk_8C = NULL; - } - else if (actorArg != NULL) + } else if (actorArg != NULL) { unkActor = actorArg; + } - if (unkActor != NULL) + if (unkActor != NULL) { actorType = unkActor->type; - else + } else { actorType = player->actor.type; + } - if ((unkActor != targetCtx->arrowPointedActor) || (actorType != targetCtx->activeType)) - { + if ((unkActor != targetCtx->arrowPointedActor) || (actorType != targetCtx->activeType)) { targetCtx->arrowPointedActor = unkActor; targetCtx->activeType = actorType; targetCtx->unk_40 = 1.0f; } - if (unkActor == NULL) + if (unkActor == NULL) { unkActor = &player->actor; + } - if (Math_ApproxF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) - { + if (Math_ApproxF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) { temp1 = 0.25f / targetCtx->unk_40; temp2 = unkActor->posRot.pos.x - targetCtx->naviRefPos.x; temp3 = (unkActor->posRot.pos.y + (unkActor->unk_4C * unkActor->scale.y)) - targetCtx->naviRefPos.y; @@ -527,26 +485,25 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl targetCtx->naviRefPos.x += temp2 * temp1; targetCtx->naviRefPos.y += temp3 * temp1; targetCtx->naviRefPos.z += temp4 * temp1; - } - else + } else { func_8002BF60(targetCtx, unkActor, actorType, globalCtx); - - if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) - { - func_8002BE04(globalCtx, &actorArg->posRot2.pos, &sp50, &sp4C); - if (((sp50.z <= 0.0f) || (1.0f <= fabsf(sp50.x * sp4C))) || (1.0f <= fabsf(sp50.y * sp4C))) - actorArg = NULL; } - if (actorArg != NULL) - { - if (actorArg != targetCtx->targetedActor) - { + if ((actorArg != NULL) && (targetCtx->unk_4B == 0)) { + func_8002BE04(globalCtx, &actorArg->posRot2.pos, &sp50, &sp4C); + if (((sp50.z <= 0.0f) || (1.0f <= fabsf(sp50.x * sp4C))) || (1.0f <= fabsf(sp50.y * sp4C))) { + actorArg = NULL; + } + } + + if (actorArg != NULL) { + if (actorArg != targetCtx->targetedActor) { func_8002BE98(targetCtx, actorArg->type, globalCtx); targetCtx->targetedActor = actorArg; - if (actorArg->id == ACTOR_EN_BOOM) + if (actorArg->id == ACTOR_EN_BOOM) { targetCtx->unk_48 = 0; + } lockOnSfxId = ((actorArg->flags & 5) == 5) ? NA_SE_SY_LOCK_ON : NA_SE_SY_LOCK_ON_HUMAN; func_80078884(lockOnSfxId); @@ -556,21 +513,17 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl targetCtx->targetCenterPos.y = actorArg->posRot.pos.y - (actorArg->shape.unk_08 * actorArg->scale.y); targetCtx->targetCenterPos.z = actorArg->posRot.pos.z; - if (targetCtx->unk_4B == 0) - { + if (targetCtx->unk_4B == 0) { temp5 = (500.0f - targetCtx->unk_44) * 3.0f; temp6 = (temp5 < 30.0f) ? 30.0f : ((100.0f < temp5) ? 100.0f : temp5); - if (Math_ApproxF(&targetCtx->unk_44, 80.0f, temp6) != 0) + if (Math_ApproxF(&targetCtx->unk_44, 80.0f, temp6) != 0) { targetCtx->unk_4B++; - } - else - { + } + } else { targetCtx->unk_4B = (targetCtx->unk_4B + 3) | 0x80; targetCtx->unk_44 = 120.0f; } - } - else - { + } else { targetCtx->targetedActor = NULL; Math_ApproxF(&targetCtx->unk_44, 500.0f, 80.0f); } @@ -579,166 +532,155 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl /** * Tests if current scene switch flag is set. */ -s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag) -{ - if (flag < 0x20) +s32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag) { + if (flag < 0x20) { return globalCtx->actorCtx.flags.swch & (1 << flag); - else + } else { return globalCtx->actorCtx.flags.tempSwch & (1 << flag); + } } /** * Sets current scene switch flag. */ -void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag) -{ - if (flag < 0x20) +void Flags_SetSwitch(GlobalContext* globalCtx, s32 flag) { + if (flag < 0x20) { globalCtx->actorCtx.flags.swch |= (1 << flag); - else + } else { globalCtx->actorCtx.flags.tempSwch |= (1 << flag); + } } /** * Unsets current scene switch flag. */ -void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag) -{ - if (flag < 0x20) +void Flags_UnsetSwitch(GlobalContext* globalCtx, s32 flag) { + if (flag < 0x20) { globalCtx->actorCtx.flags.swch &= ~(1 << flag); - else + } else { globalCtx->actorCtx.flags.tempSwch &= ~(1 << flag); + } } /** * Tests if current scene unknown flag is set. */ -s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag) -{ - if (flag < 0x20) +s32 Flags_GetUnknown(GlobalContext* globalCtx, s32 flag) { + if (flag < 0x20) { return globalCtx->actorCtx.flags.unk0 & (1 << flag); - else + } else { return globalCtx->actorCtx.flags.unk1 & (1 << flag); + } } /** * Sets current scene unknown flag. */ -void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag) -{ - if (flag < 0x20) +void Flags_SetUnknown(GlobalContext* globalCtx, s32 flag) { + if (flag < 0x20) { globalCtx->actorCtx.flags.unk0 |= (1 << flag); - else + } else { globalCtx->actorCtx.flags.unk1 |= (1 << flag); + } } /** * Unsets current scene unknown flag. */ -void Flags_UnsetUnknown(GlobalContext* globalCtx, s32 flag) -{ - if (flag < 0x20) +void Flags_UnsetUnknown(GlobalContext* globalCtx, s32 flag) { + if (flag < 0x20) { globalCtx->actorCtx.flags.unk0 &= ~(1 << flag); - else + } else { globalCtx->actorCtx.flags.unk1 &= ~(1 << flag); + } } /** * Tests if current scene chest flag is set. */ -s32 Flags_GetTreasure(GlobalContext* globalCtx, s32 flag) -{ +s32 Flags_GetTreasure(GlobalContext* globalCtx, s32 flag) { return globalCtx->actorCtx.flags.chest & (1 << flag); } /** * Sets current scene chest flag. */ -void Flags_SetTreasure(GlobalContext* globalCtx, s32 flag) -{ +void Flags_SetTreasure(GlobalContext* globalCtx, s32 flag) { globalCtx->actorCtx.flags.chest |= (1 << flag); } /** * Tests if current scene clear flag is set. */ -s32 Flags_GetClear(GlobalContext* globalCtx, s32 flag) -{ +s32 Flags_GetClear(GlobalContext* globalCtx, s32 flag) { return globalCtx->actorCtx.flags.clear & (1 << flag); } /** * Sets current scene clear flag. */ -void Flags_SetClear(GlobalContext* globalCtx, s32 flag) -{ +void Flags_SetClear(GlobalContext* globalCtx, s32 flag) { globalCtx->actorCtx.flags.clear |= (1 << flag); } /** * Unsets current scene clear flag. */ -void Flags_UnsetClear(GlobalContext* globalCtx, s32 flag) -{ +void Flags_UnsetClear(GlobalContext* globalCtx, s32 flag) { globalCtx->actorCtx.flags.clear &= ~(1 << flag); } /** * Tests if current scene temp clear flag is set. */ -s32 Flags_GetTempClear(GlobalContext* globalCtx, s32 flag) -{ +s32 Flags_GetTempClear(GlobalContext* globalCtx, s32 flag) { return globalCtx->actorCtx.flags.tempClear & (1 << flag); } /** * Sets current scene temp clear flag. */ -void Flags_SetTempClear(GlobalContext* globalCtx, s32 flag) -{ +void Flags_SetTempClear(GlobalContext* globalCtx, s32 flag) { globalCtx->actorCtx.flags.tempClear |= 1 << flag; } /** * Unsets current scene temp clear flag. */ -void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag) -{ +void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag) { globalCtx->actorCtx.flags.tempClear &= ~(1 << flag); } /** * Tests if current scene collectible flag is set. */ -s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag) -{ - if (flag < 0x20) +s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag) { + if (flag < 0x20) { return globalCtx->actorCtx.flags.collect & (1 << flag); - else + } else { return globalCtx->actorCtx.flags.tempCollect & (1 << flag); + } } /** * Sets current scene collectible flag. */ -void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag) -{ - if (flag != 0) - { - if (flag < 0x20) +void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag) { + if (flag != 0) { + if (flag < 0x20) { globalCtx->actorCtx.flags.collect |= 1 << flag; - else + } else { globalCtx->actorCtx.flags.tempCollect |= 1 << flag; + } } } -void func_8002CDE4(GlobalContext* globalCtx, TitleCardContext* titleCtx) -{ +void func_8002CDE4(GlobalContext* globalCtx, TitleCardContext* titleCtx) { titleCtx->delayA = titleCtx->delayB = titleCtx->unk_E = titleCtx->unk_C = 0; } -void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, - s16 arg3, s16 arg4, u8 arg5, u8 arg6) -{ +void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, s16 arg3, s16 arg4, + u8 arg5, u8 arg6) { titleCtx->texture = texture; titleCtx->unk_4 = arg3; titleCtx->unk_6 = arg4; @@ -748,14 +690,14 @@ void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx titleCtx->delayB = 0; } -void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, - s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7) -{ +void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, s32 arg3, s32 arg4, + s32 arg5, s32 arg6, s32 arg7) { Scene* loadedScene = globalCtx->loadedScene; u32 size = loadedScene->titleVromEnd - loadedScene->titleVromStart; - if ((size != 0) && (size <= 0x3000)) + if ((size != 0) && (size <= 0x3000)) { DmaMgr_SendRequest1(texture, loadedScene->titleVromStart, size, "../z_actor.c", 2765); + } titleCtx->texture = texture; titleCtx->unk_4 = arg3; @@ -766,17 +708,12 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt titleCtx->delayB = arg7; } -void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) -{ - if (DECR(titleCtx->delayB) == 0) - { - if (DECR(titleCtx->delayA) == 0) - { +void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { + if (DECR(titleCtx->delayB) == 0) { + if (DECR(titleCtx->delayA) == 0) { Math_ApproxS(&titleCtx->unk_C, 0, 30); Math_ApproxS(&titleCtx->unk_E, 0, 70); - } - else - { + } else { Math_ApproxS(&titleCtx->unk_C, 255, 10); Math_ApproxS(&titleCtx->unk_E, 255, 20); } @@ -785,8 +722,7 @@ void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) #ifdef NON_MATCHING // major ordering and stack usage differences -void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) -{ +void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { s32 spCC; s32 spC8; s32 unk1; @@ -799,8 +735,7 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) Gfx* gfxArr[4]; s32 sp38; - if (titleCtx->unk_C != 0) - { + if (titleCtx->unk_C != 0) { spCC = titleCtx->unk_8; spC8 = titleCtx->unk_9; spC0 = (titleCtx->unk_4 * 4) - (spCC * 2); @@ -819,41 +754,25 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) gfxCtx->overlay.p = func_80093808(gfxCtx->overlay.p); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - (u8)titleCtx->unk_E, (u8)titleCtx->unk_E, - (u8)titleCtx->unk_E, (u8)titleCtx->unk_C); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, (u8)titleCtx->unk_E, (u8)titleCtx->unk_E, (u8)titleCtx->unk_E, + (u8)titleCtx->unk_C); - gDPLoadTextureBlock(gfxCtx->overlay.p++, - titleCtx->texture + spB0, - G_IM_FMT_IA, - G_IM_SIZ_8b, - spCC, spC8, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gfxCtx->overlay.p++, titleCtx->texture + spB0, G_IM_FMT_IA, G_IM_SIZ_8b, spCC, spC8, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB8, - ((sp38 * 2) + spC0) - 4, spB8 - 1, G_TX_RENDERTILE, - 0, 0, 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB8, ((sp38 * 2) + spC0) - 4, spB8 - 1, G_TX_RENDERTILE, 0, 0, + 1024, 1024); spC8 = titleCtx->unk_9 - spC8; - if (spC8 > 0) - { - gDPLoadTextureBlock(gfxCtx->overlay.p++, - titleCtx->texture + spB0 + 0x1000, - G_IM_FMT_IA, - G_IM_SIZ_8b, - spCC, spC8, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, + if (spC8 > 0) { + gDPLoadTextureBlock(gfxCtx->overlay.p++, titleCtx->texture + spB0 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, spCC, + spC8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB4, - ((sp38 * 2) + spC0) - 4, spB4 - 1, G_TX_RENDERTILE, - 0, 0, 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB4, ((sp38 * 2) + spC0) - 4, spB4 - 1, G_TX_RENDERTILE, 0, + 0, 1024, 1024); } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 2880); @@ -863,11 +782,8 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/TitleCard_Draw.s") #endif -s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) -{ - if ((globalCtx->actorCtx.titleCtx.delayB != 0) || - (globalCtx->actorCtx.titleCtx.unk_C != 0)) - { +s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) { + if ((globalCtx->actorCtx.titleCtx.delayB != 0) || (globalCtx->actorCtx.titleCtx.unk_C != 0)) { titleCtx->delayA = 0; titleCtx->delayB = 0; return 0; @@ -876,20 +792,17 @@ s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) return 1; } -void Actor_Kill(Actor* actor) -{ +void Actor_Kill(Actor* actor) { actor->draw = NULL; actor->update = NULL; actor->flags &= ~0x1; } -void Actor_InitPosRot(Actor* actor) -{ +void Actor_InitPosRot(Actor* actor) { actor->posRot = actor->initPosRot; } -void Actor_SetHeight(Actor* actor, f32 offset) -{ +void Actor_SetHeight(Actor* actor, f32 offset) { actor->posRot2.pos.x = actor->posRot.pos.x; actor->posRot2.pos.y = actor->posRot.pos.y + offset; actor->posRot2.pos.z = actor->posRot.pos.z; @@ -899,30 +812,25 @@ void Actor_SetHeight(Actor* actor, f32 offset) actor->posRot2.rot.z = actor->posRot.rot.z; } -void func_8002D5F4(Actor* actor) -{ +void func_8002D5F4(Actor* actor) { actor->posRot.rot = actor->shape.rot; } -void func_8002D610(Actor* actor) -{ +void func_8002D610(Actor* actor) { actor->shape.rot = actor->posRot.rot; } -void Actor_SetScale(Actor* actor, f32 scale) -{ +void Actor_SetScale(Actor* actor, f32 scale) { actor->scale.z = scale; actor->scale.y = scale; actor->scale.x = scale; } -void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor) -{ +void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor) { gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[actor->objBankIndex].segment); } -void Actor_Init(Actor* actor, GlobalContext* globalCtx) -{ +void Actor_Init(Actor* actor, GlobalContext* globalCtx) { Actor_InitPosRot(actor); func_8002D610(actor); Actor_SetHeight(actor, 0.0f); @@ -938,26 +846,21 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) func_80061E48(&actor->sub_98); actor->floorPolySource = 0x32; ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f); - if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) - { + if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { Actor_SetObjectDependency(globalCtx, actor); actor->init(actor, globalCtx); actor->init = NULL; } } -void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) -{ +void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) { ActorOverlay* overlayEntry; char* name; - if (actor->destroy != NULL) - { + if (actor->destroy != NULL) { actor->destroy(actor, globalCtx); actor->destroy = NULL; - } - else - { + } else { overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -966,52 +869,46 @@ void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) } } -void func_8002D7EC(Actor* actor) -{ +void func_8002D7EC(Actor* actor) { f32 speedRate = R_UPDATE_RATE * 0.5f; actor->posRot.pos.x += (actor->velocity.x * speedRate) + actor->sub_98.displacement.x; actor->posRot.pos.y += (actor->velocity.y * speedRate) + actor->sub_98.displacement.y; actor->posRot.pos.z += (actor->velocity.z * speedRate) + actor->sub_98.displacement.z; } -void func_8002D868(Actor* actor) -{ +void func_8002D868(Actor* actor) { actor->velocity.x = Math_Sins(actor->posRot.rot.y) * actor->speedXZ; actor->velocity.z = Math_Coss(actor->posRot.rot.y) * actor->speedXZ; actor->velocity.y += actor->gravity; - if (actor->velocity.y < actor->minVelocityY) + if (actor->velocity.y < actor->minVelocityY) { actor->velocity.y = actor->minVelocityY; + } } -void Actor_MoveForward(Actor* actor) -{ +void Actor_MoveForward(Actor* actor) { func_8002D868(actor); func_8002D7EC(actor); } -void func_8002D908(Actor* actor) -{ +void func_8002D908(Actor* actor) { f32 sp24 = Math_Coss(actor->posRot.rot.x) * actor->speedXZ; actor->velocity.x = Math_Sins(actor->posRot.rot.y) * sp24; actor->velocity.y = Math_Sins(actor->posRot.rot.x) * actor->speedXZ; actor->velocity.z = Math_Coss(actor->posRot.rot.y) * sp24; } -void func_8002D97C(Actor* actor) -{ +void func_8002D97C(Actor* actor) { func_8002D908(actor); func_8002D7EC(actor); } -void func_8002D9A4(Actor* actor, f32 arg1) -{ +void func_8002D9A4(Actor* actor, f32 arg1) { actor->speedXZ = Math_Coss(actor->posRot.rot.x) * arg1; actor->velocity.y = -Math_Sins(actor->posRot.rot.x) * arg1; } -void func_8002D9F8(Actor* actor, UNK_PTR arg1) -{ +void func_8002D9F8(Actor* actor, UNK_PTR arg1) { Vec3f sp1C; func_800A54FC(arg1, &sp1C, actor->shape.rot.y, actor); actor->posRot.pos.x += sp1C.x * actor->scale.x; @@ -1019,58 +916,47 @@ void func_8002D9F8(Actor* actor, UNK_PTR arg1) actor->posRot.pos.z += sp1C.z * actor->scale.z; } -s16 func_8002DA78(Actor* actorA, Actor* actorB) -{ +s16 func_8002DA78(Actor* actorA, Actor* actorB) { return Math_Vec3f_Yaw(&actorA->posRot.pos, &actorB->posRot.pos); } -s16 func_8002DA9C(Actor* actorA, Actor* actorB) -{ +s16 func_8002DA9C(Actor* actorA, Actor* actorB) { return Math_Vec3f_Yaw(&actorA->posRot2.pos, &actorB->posRot2.pos); } -s16 func_8002DAC0(Actor* actor, Vec3f* arg1) -{ +s16 func_8002DAC0(Actor* actor, Vec3f* arg1) { return Math_Vec3f_Yaw(&actor->posRot.pos, arg1); } -s16 func_8002DAE0(Actor* actorA, Actor* actorB) -{ +s16 func_8002DAE0(Actor* actorA, Actor* actorB) { return Math_Vec3f_Pitch(&actorA->posRot.pos, &actorB->posRot.pos); } -s16 func_8002DB04(Actor* actorA, Actor* actorB) -{ +s16 func_8002DB04(Actor* actorA, Actor* actorB) { return Math_Vec3f_Pitch(&actorA->posRot2.pos, &actorB->posRot2.pos); } -s16 func_8002DB28(Actor* actor, Vec3f* arg1) -{ +s16 func_8002DB28(Actor* actor, Vec3f* arg1) { return Math_Vec3f_Pitch(&actor->posRot.pos, arg1); } -f32 func_8002DB48(Actor* actorA, Actor* actorB) -{ +f32 func_8002DB48(Actor* actorA, Actor* actorB) { return Math_Vec3f_DistXYZ(&actorA->posRot.pos, &actorB->posRot.pos); } -f32 func_8002DB6C(Actor* actor, Vec3f* arg1) -{ +f32 func_8002DB6C(Actor* actor, Vec3f* arg1) { return Math_Vec3f_DistXYZ(&actor->posRot.pos, arg1); } -f32 func_8002DB8C(Actor* actorA, Actor* actorB) -{ +f32 func_8002DB8C(Actor* actorA, Actor* actorB) { return Math_Vec3f_DistXZ(&actorA->posRot.pos, &actorB->posRot.pos); } -f32 func_8002DBB0(Actor* actor, Vec3f* arg1) -{ +f32 func_8002DBB0(Actor* actor, Vec3f* arg1) { return Math_Vec3f_DistXZ(&actor->posRot.pos, arg1); } -void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) -{ +void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) { f32 cosRot2Y; f32 sinRot2Y; f32 deltaX; @@ -1086,72 +972,64 @@ void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2) result->y = arg2->y - actor->posRot.pos.y; } -f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) -{ +f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) { return actorB->posRot.pos.y - actorA->posRot.pos.y; } -f32 func_8002DC84(Player* player) -{ +f32 func_8002DC84(Player* player) { f32 offset = (player->stateFlags1 & 0x800000) ? 32.0f : 0.0f; - if (LINK_IS_ADULT) + if (LINK_IS_ADULT) { return offset + 68.0f; - else + } else { return offset + 44.0f; + } } -f32 func_8002DCE4(Player* player) -{ - if (player->stateFlags1 & 0x800000) +f32 func_8002DCE4(Player* player) { + if (player->stateFlags1 & 0x800000) { return 8.0f; - else if (player->stateFlags1 & 0x8000000) + } else if (player->stateFlags1 & 0x8000000) { return (R_RUN_SPEED_LIMIT / 100.0f) * 0.6f; - else + } else { return R_RUN_SPEED_LIMIT / 100.0f; + } } -s32 func_8002DD6C(Player* player) -{ +s32 func_8002DD6C(Player* player) { return player->stateFlags1 & 0x8; } -s32 func_8002DD78(Player* player) -{ +s32 func_8002DD78(Player* player) { return func_8002DD6C(player) && player->unk_834; } -s32 func_8002DDA8(GlobalContext* globalCtx) -{ +s32 func_8002DDA8(GlobalContext* globalCtx) { Player* player = PLAYER; return (player->stateFlags1 & 0x800) || func_8002DD78(player); } -s32 func_8002DDE4(GlobalContext* globalCtx) -{ +s32 func_8002DDE4(GlobalContext* globalCtx) { Player* player = PLAYER; return player->stateFlags2 & 0x8; } -s32 func_8002DDF4(GlobalContext* globalCtx) -{ +s32 func_8002DDF4(GlobalContext* globalCtx) { Player* player = PLAYER; return player->stateFlags2 & 0x1000; } -typedef struct -{ - /* 0x000 */ Actor actor; - /* 0x14C */ char unk_14C[0xB4]; - /* 0x200 */ Actor* unk_200; - /* 0x204 */ f32 unk_204; - /* 0x208 */ f32 unk_208; - /* 0x20C */ f32 unk_20C; - /* 0x210 */ s16 unk_210; +typedef struct { + /* 0x000 */ Actor actor; + /* 0x14C */ char unk_14C[0xB4]; + /* 0x200 */ Actor* unk_200; + /* 0x204 */ f32 unk_204; + /* 0x208 */ f32 unk_208; + /* 0x20C */ f32 unk_20C; + /* 0x210 */ s16 unk_210; } ActorArmsHook; -void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) -{ +void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { ActorArmsHook* hookActor; hookActor = (ActorArmsHook*)Actor_Find(&globalCtx->actorCtx, 0x0066, ACTORTYPE_ITEMACTION); @@ -1163,31 +1041,27 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) actorA->flags &= ~0x2000; } -void func_8002DE74(GlobalContext* globalCtx, Player* player) -{ - if ((globalCtx->roomCtx.curRoom.unk_03 != 4) && func_800C0CB8(globalCtx)) +void func_8002DE74(GlobalContext* globalCtx, Player* player) { + if ((globalCtx->roomCtx.curRoom.unk_03 != 4) && func_800C0CB8(globalCtx)) { func_8005A77C(func_800C04A4(globalCtx, 0), 6); + } } -void func_8002DECC(GlobalContext* globalCtx, Player* player, Actor* actor) -{ +void func_8002DECC(GlobalContext* globalCtx, Player* player, Actor* actor) { player->rideActor = actor; player->stateFlags1 |= 0x800000; actor->attachedB = &player->actor; } -s32 func_8002DEEC(Player* player) -{ +s32 func_8002DEEC(Player* player) { return (player->stateFlags1 & 0x20000080) || player->action; } -void func_8002DF18(GlobalContext* globalCtx, ActorContext* actorCtx) -{ +void func_8002DF18(GlobalContext* globalCtx, ActorContext* actorCtx) { func_8006DC68(globalCtx, actorCtx); } -u32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 newAction) -{ +u32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 newAction) { Player* player = PLAYER; player->action = newAction; player->unk_448 = actor; @@ -1196,8 +1070,7 @@ u32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 newAction) return 1; } -s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 arg2) -{ +s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 arg2) { Player* player = PLAYER; func_8002DF38(globalCtx, actor, arg2); player->unk_46A = 1; @@ -1205,96 +1078,91 @@ s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 arg2) return 1; } -void func_8002DF90(DynaPolyActor* dynaActor) -{ +void func_8002DF90(DynaPolyActor* dynaActor) { dynaActor->unk_154 = 0.0f; dynaActor->unk_150 = 0.0f; } -void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2) -{ +void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2) { dynaActor->unk_150 += arg1; dynaActor->unk_158 = arg2; } -s32 func_8002DFC8(Actor* actor, s16 arg1, GlobalContext* globalCtx) -{ +s32 func_8002DFC8(Actor* actor, s16 arg1, GlobalContext* globalCtx) { Player* player = PLAYER; s16 var = (s16)(actor->rotTowardsLinkY + 0x8000) - player->actor.shape.rot.y; - if (ABS(var) < arg1) + if (ABS(var) < arg1) { return 1; + } return 0; } -s32 func_8002E020(Actor* actorA, Actor* actorB, s16 arg2) -{ +s32 func_8002E020(Actor* actorA, Actor* actorB, s16 arg2) { s16 var = (s16)(func_8002DA78(actorA, actorB) + 0x8000) - actorB->shape.rot.y; - if (ABS(var) < arg2) + if (ABS(var) < arg2) { return 1; + } return 0; } -s32 func_8002E084(Actor* actor, s16 arg1) -{ +s32 func_8002E084(Actor* actor, s16 arg1) { s16 var = actor->rotTowardsLinkY - actor->shape.rot.y; - if (ABS(var) < arg1) + if (ABS(var) < arg1) { return 1; + } return 0; } -s32 func_8002E0D0(Actor* actorA, Actor* actorB, s16 arg2) -{ +s32 func_8002E0D0(Actor* actorA, Actor* actorB, s16 arg2) { s16 var = func_8002DA78(actorA, actorB) - actorA->shape.rot.y; - if (ABS(var) < arg2) + if (ABS(var) < arg2) { return 1; + } return 0; } -s32 func_8002E12C(Actor* actor, f32 arg1, s16 arg2) -{ +s32 func_8002E12C(Actor* actor, f32 arg1, s16 arg2) { s16 var = actor->rotTowardsLinkY - actor->shape.rot.y; - if (ABS(var) < arg2) - { + if (ABS(var) < arg2) { f32 xyzDistanceFromLink = sqrtf(SQ(actor->xzDistanceFromLink) + SQ(actor->yDistanceFromLink)); - if (xyzDistanceFromLink < arg1) + if (xyzDistanceFromLink < arg1) { return 1; + } } return 0; } -s32 func_8002E1A8(Actor* actorA, Actor* actorB, f32 arg2, s16 arg3) -{ - if (func_8002DB48(actorA, actorB) < arg2) - { +s32 func_8002E1A8(Actor* actorA, Actor* actorB, f32 arg2, s16 arg3) { + if (func_8002DB48(actorA, actorB) < arg2) { s16 var = func_8002DA78(actorA, actorB) - actorA->shape.rot.y; - if (ABS(var) < arg3) + if (ABS(var) < arg3) { return 1; + } } return 0; } -s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) -{ - if ((actor->bgCheckFlags & 0x1) && (arg1 < -11.0f)) - { +s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) { + if ((actor->bgCheckFlags & 0x1) && (arg1 < -11.0f)) { actor->bgCheckFlags &= ~0x1; actor->bgCheckFlags |= 0x4; - if ((actor->velocity.y < 0.0f) && (arg2 & 0x10)) + if ((actor->velocity.y < 0.0f) && (arg2 & 0x10)) { actor->velocity.y = 0.0f; + } return 0; } @@ -1305,8 +1173,7 @@ s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) UNK_TYPE D_8015BBA0; u32 D_8015BBA4; -s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) -{ +s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) { f32 sp34; u32 sp30; @@ -1315,25 +1182,22 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) actor->unk_80 = func_8003CA0C(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &sp30, actor, arg2); actor->bgCheckFlags &= ~0x0086; - if (actor->unk_80 <= -32000.0f) + if (actor->unk_80 <= -32000.0f) { return func_8002E234(actor, -32000.0f, arg3); + } sp34 = actor->unk_80 - actor->posRot.pos.y; actor->floorPolySource = sp30; - if (sp34 >= 0.0f) - { + if (sp34 >= 0.0f) { actor->bgCheckFlags |= 0x80; - if (actor->bgCheckFlags & 0x10) - { - if (sp30 != D_8015BBA4) - { - if (sp34 > 15.0f) + if (actor->bgCheckFlags & 0x10) { + if (sp30 != D_8015BBA4) { + if (sp34 > 15.0f) { actor->bgCheckFlags |= 0x100; - } - else - { + } + } else { actor->posRot.pos.x = actor->pos4.x; actor->posRot.pos.z = actor->pos4.z; } @@ -1341,23 +1205,22 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) actor->posRot.pos.y = actor->unk_80; - if (actor->velocity.y <= 0.0f) - { - if (!(actor->bgCheckFlags & 0x1)) + if (actor->velocity.y <= 0.0f) { + if (!(actor->bgCheckFlags & 0x1)) { actor->bgCheckFlags |= 0x2; - else if ((arg3 & 0x8) && (actor->gravity < 0.0f)) + } else if ((arg3 & 0x8) && (actor->gravity < 0.0f)) { actor->velocity.y = -4.0f; - else + } else { actor->velocity.y = 0.0f; + } actor->bgCheckFlags |= 0x1; func_80043334(&globalCtx->colCtx, actor, actor->floorPolySource); } - } - else - { - if ((actor->bgCheckFlags & 0x1) && (sp34 >= -11.0f)) + } else { + if ((actor->bgCheckFlags & 0x1) && (sp34 >= -11.0f)) { func_80043334(&globalCtx->colCtx, actor, actor->floorPolySource); + } return func_8002E234(actor, sp34, arg3); } @@ -1365,8 +1228,7 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) return 1; } -void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f32 arg4, s32 arg5) -{ +void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f32 arg4, s32 arg5) { f32 sp74; s32 pad; Vec3f sp64; @@ -1379,58 +1241,50 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f sp74 = actor->posRot.pos.y - actor->pos4.y; - if ((actor->floorPolySource != 0x32) && (actor->bgCheckFlags & 1)) + if ((actor->floorPolySource != 0x32) && (actor->bgCheckFlags & 1)) { func_800433A4(&globalCtx->colCtx, actor->floorPolySource, actor); + } - if (arg5 & 1) - { - if ((!(arg5 & 0x80) && func_8003D52C(&globalCtx->colCtx, &sp64, &actor->posRot.pos, - &actor->pos4, arg3, &actor->wallPoly, &sp60, actor, arg2)) || - ((arg5 & 0x80) && func_8003D594(&globalCtx->colCtx, &sp64, &actor->posRot.pos, - &actor->pos4, arg3, &actor->wallPoly, &sp60, actor, arg2))) - { + if (arg5 & 1) { + if ((!(arg5 & 0x80) && func_8003D52C(&globalCtx->colCtx, &sp64, &actor->posRot.pos, &actor->pos4, arg3, + &actor->wallPoly, &sp60, actor, arg2)) || + ((arg5 & 0x80) && func_8003D594(&globalCtx->colCtx, &sp64, &actor->posRot.pos, &actor->pos4, arg3, + &actor->wallPoly, &sp60, actor, arg2))) { sp5C = actor->wallPoly; Math_Vec3f_Copy(&actor->posRot.pos, &sp64); actor->unk_7E = atan2s(sp5C->norm.z, sp5C->norm.x); actor->bgCheckFlags |= 8; actor->wallPolySource = sp60; - } - else + } else { actor->bgCheckFlags &= ~8; + } } sp64.x = actor->posRot.pos.x; sp64.z = actor->posRot.pos.z; - if (arg5 & 2) - { + if (arg5 & 2) { sp64.y = actor->pos4.y + 10.0f; - if (func_8003D7A0(&globalCtx->colCtx, &sp58, &sp64, (arg4 + sp74) - 10.0f, &D_8015BBA0, &D_8015BBA4, actor)) - { + if (func_8003D7A0(&globalCtx->colCtx, &sp58, &sp64, (arg4 + sp74) - 10.0f, &D_8015BBA0, &D_8015BBA4, actor)) { actor->bgCheckFlags |= 0x10; actor->posRot.pos.y = (sp58 + sp74) - 10.0f; - } - else + } else { actor->bgCheckFlags &= ~0x10; + } } - if (arg5 & 4) - { + if (arg5 & 4) { sp64.y = actor->pos4.y; func_8002E2AC(globalCtx, actor, &sp64, arg5); sp50 = actor->posRot.pos.y; - if (func_8004213C(globalCtx, &globalCtx->colCtx, actor->posRot.pos.x, actor->posRot.pos.z, &sp50, &sp54)) - { + if (func_8004213C(globalCtx, &globalCtx->colCtx, actor->posRot.pos.x, actor->posRot.pos.z, &sp50, &sp54)) { actor->unk_84 = sp50 - actor->posRot.pos.y; - if (actor->unk_84 < 0.0f) + if (actor->unk_84 < 0.0f) { actor->bgCheckFlags &= ~0x60; - else - { - if (!(actor->bgCheckFlags & 0x20)) - { + } else { + if (!(actor->bgCheckFlags & 0x20)) { actor->bgCheckFlags |= 0x40; - if (!(arg5 & 0x40)) - { + if (!(arg5 & 0x40)) { sp44.x = actor->posRot.pos.x; sp44.y = sp50; sp44.z = actor->posRot.pos.z; @@ -1441,9 +1295,7 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f } actor->bgCheckFlags |= 0x20; } - } - else - { + } else { actor->bgCheckFlags &= ~0x60; actor->unk_84 = -32000.0f; } @@ -1452,8 +1304,7 @@ void func_8002E4B4(GlobalContext* globalCtx, Actor* actor, f32 arg2, f32 arg3, f s32 D_8015BBA8[16]; -Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx, Gfx* gfx, Hilite** hilite) -{ +Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx, Gfx* gfx, Hilite** hilite) { Gfx* lookAt; f32 correctedEyeX; @@ -1463,20 +1314,15 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* *hilite = Graph_Alloc(gfxCtx, sizeof(Hilite)); - if (HREG(80) == 6) + if (HREG(80) == 6) { osSyncPrintf("z_actor.c 3529 eye=[%f(%f) %f %f] object=[%f %f %f] light_direction=[%f %f %f]\n", - (f64)correctedEyeX, (f64)eye->x, (f64)eye->y, (f64)eye->z, - (f64)object->x, (f64)object->y, (f64) object->z, - (f64)lightDir->x, (f64)lightDir->y, (f64)lightDir->z); + (f64)correctedEyeX, (f64)eye->x, (f64)eye->y, (f64)eye->z, (f64)object->x, (f64)object->y, + (f64)object->z, (f64)lightDir->x, (f64)lightDir->y, (f64)lightDir->z); + } func_800ABE74(correctedEyeX, eye->y, eye->z); - func_80103A70(&D_8015BBA8, lookAt, *hilite, - correctedEyeX, eye->y, eye->z, - object->x, object->y, object->z, - 0.0f, 1.0f, 0.0f, - lightDir->x, lightDir->y, lightDir->z, - lightDir->x, lightDir->y, lightDir->z, - 0x10, 0x10); + func_80103A70(&D_8015BBA8, lookAt, *hilite, correctedEyeX, eye->y, eye->z, object->x, object->y, object->z, 0.0f, + 1.0f, 0.0f, lightDir->x, lightDir->y, lightDir->z, lightDir->x, lightDir->y, lightDir->z, 0x10, 0x10); gSPLookAt(gfx++, lookAt); gDPSetHilite1Tile(gfx++, 1, *hilite, 0x10, 0x10); @@ -1484,8 +1330,7 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* return gfx; } -Hilite* func_8002EABC(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) -{ +Hilite* func_8002EABC(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) { Hilite* hilite; Gfx* gfxArr[5]; @@ -1496,8 +1341,7 @@ Hilite* func_8002EABC(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContex return hilite; } -Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) -{ +Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) { Hilite* hilite; Gfx* gfxArr[5]; @@ -1508,8 +1352,7 @@ Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContex return hilite; } -void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) -{ +void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) { Hilite* hilite; Vec3f lightDir; Gfx* displayListHead; @@ -1521,14 +1364,14 @@ void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) lightDir.y = globalCtx->unk_10A4F; lightDir.z = globalCtx->unk_10A50; - if (HREG(80) == 6) - osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", - (f64)globalCtx->view.eye.x, (f64)globalCtx->view.eye.y, (f64)globalCtx->view.eye.z); + if (HREG(80) == 6) { + osSyncPrintf("z_actor.c 3637 game_play->view.eye=[%f(%f) %f %f]\n", (f64)globalCtx->view.eye.x, + (f64)globalCtx->view.eye.y, (f64)globalCtx->view.eye.z); + } hilite = func_8002EABC(&actor->posRot.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); - if (flag != 0) - { + if (flag != 0) { displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; @@ -1543,8 +1386,7 @@ void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) } } -void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) -{ +void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) { Hilite* hilite; Vec3f lightDir; Gfx* displayListHead; @@ -1558,8 +1400,7 @@ void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) hilite = func_8002EB44(&actor->posRot.pos, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); - if (flag != 0) - { + if (flag != 0) { displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; @@ -1574,22 +1415,19 @@ void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) } } -PosRot* func_8002EEE4(PosRot* arg0, Actor* actor) -{ +PosRot* func_8002EEE4(PosRot* arg0, Actor* actor) { *arg0 = actor->posRot2; return arg0; } -PosRot* func_8002EF14(PosRot* arg0, Actor* actor) -{ +PosRot* func_8002EF14(PosRot* arg0, Actor* actor) { *arg0 = actor->posRot; return arg0; } -PosRot* func_8002EF44(PosRot* arg0, Actor* actor) -{ +PosRot* func_8002EF44(PosRot* arg0, Actor* actor) { PosRot sp1C; Math_Vec3f_Copy(&sp1C.pos, &actor->posRot.pos); @@ -1601,16 +1439,14 @@ PosRot* func_8002EF44(PosRot* arg0, Actor* actor) #ifdef NON_MATCHING // single regalloc difference -f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) -{ +f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { s16 var; s16 abs_var; var = (s16)(actor->rotTowardsLinkY - 0x8000) - arg2; abs_var = ABS(var); - if (player->unk_664 != NULL) - { + if (player->unk_664 != NULL) { if ((abs_var > 0x4000) || (actor->flags & 0x8000000)) return FLT_MAX; else @@ -1627,48 +1463,38 @@ extern f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2); #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_8002EFC0.s") #endif -typedef struct -{ +typedef struct { f32 unk_0, unk_4; } struct_80115FF8; // size = 0x8 -struct_80115FF8 D_80115FF8[] = -{ - { 4900.0f, 0.5f }, - { 28900.0f, 0.6666667f }, - { 78400.0f, 0.05f }, - { 122500.0f, 0.6666667f }, - { 490000.0f, 0.6666667f }, - { 1000000.0f, 0.6666667f }, - { 10000.0f, 0.94905096f }, - { 19600.0f, 0.85714287f }, - { 57600.0f, 0.41666666f }, - { 78400.0f, 0.001f }, +struct_80115FF8 D_80115FF8[] = { + { 4900.0f, 0.5f }, { 28900.0f, 0.6666667f }, { 78400.0f, 0.05f }, { 122500.0f, 0.6666667f }, + { 490000.0f, 0.6666667f }, { 1000000.0f, 0.6666667f }, { 10000.0f, 0.94905096f }, { 19600.0f, 0.85714287f }, + { 57600.0f, 0.41666666f }, { 78400.0f, 0.001f }, }; -u32 func_8002F090(Actor* actor, f32 arg1) -{ +u32 func_8002F090(Actor* actor, f32 arg1) { return arg1 < D_80115FF8[actor->unk_1F].unk_0; } -s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) -{ +s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { s16 var; s16 abs_var; f32 dist; - if ((actor->update == NULL) || !(actor->flags & 1)) + if ((actor->update == NULL) || !(actor->flags & 1)) { return 1; + } - if (!flag) - { + if (!flag) { var = (s16)(actor->rotTowardsLinkY - 0x8000) - player->actor.shape.rot.y; abs_var = ABS(var); - if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) + if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) { dist = FLT_MAX; - else + } else { dist = actor->waterSurfaceDist; + } return !func_8002F090(actor, D_80115FF8[actor->unk_1F].unk_4 * dist); } @@ -1676,10 +1502,8 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) return 0; } -u32 func_8002F194(Actor* actor, GlobalContext* globalCtx) -{ - if (actor->flags & 0x100) - { +u32 func_8002F194(Actor* actor, GlobalContext* globalCtx) { + if (actor->flags & 0x100) { actor->flags &= ~0x100; return 1; } @@ -1687,18 +1511,16 @@ u32 func_8002F194(Actor* actor, GlobalContext* globalCtx) return 0; } -s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u32 arg4) -{ +s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u32 arg4) { Player* player = PLAYER; // This is convoluted but it seems like it must be a single if statement to match - if ((player->actor.flags & 0x100) || - ((arg4 != 0) && func_8008E988(globalCtx)) || + if ((player->actor.flags & 0x100) || ((arg4 != 0) && func_8008E988(globalCtx)) || ((actor->unk_10C == 0) && - ((arg3 < fabsf(actor->yDistanceFromLink)) || - (player->unk_698 < actor->xzDistanceFromLink) || - (arg2 < actor->xzDistanceFromLink)))) + ((arg3 < fabsf(actor->yDistanceFromLink)) || (player->unk_698 < actor->xzDistanceFromLink) || + (arg2 < actor->xzDistanceFromLink)))) { return 0; + } player->unk_694 = actor; player->unk_698 = actor->xzDistanceFromLink; @@ -1707,38 +1529,33 @@ s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u3 return 1; } -s32 func_8002F298(Actor* actor, GlobalContext* globalCtx, f32 arg2, u32 arg3) -{ +s32 func_8002F298(Actor* actor, GlobalContext* globalCtx, f32 arg2, u32 arg3) { return func_8002F1C4(actor, globalCtx, arg2, arg2, arg3); } -s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2) -{ +s32 func_8002F2CC(Actor* actor, GlobalContext* globalCtx, f32 arg2) { return func_8002F298(actor, globalCtx, arg2, 0); } -s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx) -{ +s32 func_8002F2F4(Actor* actor, GlobalContext* globalCtx) { f32 var1 = 50.0f + actor->sub_98.unk_10; return func_8002F2CC(actor, globalCtx, var1); } -u32 func_8002F334(Actor* actor, GlobalContext* globalCtx) -{ - if (func_8010BDBC(&globalCtx->msgCtx) == 2) +u32 func_8002F334(Actor* actor, GlobalContext* globalCtx) { + if (func_8010BDBC(&globalCtx->msgCtx) == 2) { return 1; - else + } else { return 0; + } } -s8 func_8002F368(GlobalContext* globalCtx) -{ +s8 func_8002F368(GlobalContext* globalCtx) { Player* player = PLAYER; return player->exchangeItemId; } -void func_8002F374(GlobalContext* globalCtx, Actor* actor, s16* arg2, s16* arg3) -{ +void func_8002F374(GlobalContext* globalCtx, Actor* actor, s16* arg2, s16* arg3) { Vec3f sp1C; f32 sp18; @@ -1747,31 +1564,26 @@ void func_8002F374(GlobalContext* globalCtx, Actor* actor, s16* arg2, s16* arg3) *arg3 = sp1C.y * sp18 * -120.0f + 120.0f; } -u32 func_8002F410(Actor* actor, GlobalContext* globalCtx) -{ - if (actor->attachedA != NULL) +u32 func_8002F410(Actor* actor, GlobalContext* globalCtx) { + if (actor->attachedA != NULL) { return 1; - else + } else { return 0; + } } -s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) -{ +s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) { Player* player = PLAYER; s16 var; s32 abs_var; - if (!(player->stateFlags1 & 0x3C7080) && func_8008F29C(player) < 0) - { + if (!(player->stateFlags1 & 0x3C7080) && func_8008F29C(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->unk_694)) && (getItemId > 0) && (getItemId < 0x7E)) || - (!(player->stateFlags1 & 0x20000800))) - { - if ((actor->xzDistanceFromLink < xzRange) && (fabsf(actor->yDistanceFromLink) < yRange)) - { + (!(player->stateFlags1 & 0x20000800))) { + if ((actor->xzDistanceFromLink < xzRange) && (fabsf(actor->yDistanceFromLink) < yRange)) { var = actor->rotTowardsLinkY - player->actor.shape.rot.y; abs_var = ABS(var); - if ((getItemId != 0) || (player->getItemDirection < abs_var)) - { + if ((getItemId != 0) || (player->getItemDirection < abs_var)) { player->getItemId = getItemId; player->interactRangeActor = actor; player->getItemDirection = abs_var; @@ -1784,30 +1596,26 @@ s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzR return 0; } -void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId) -{ +void func_8002F554(Actor* actor, GlobalContext* globalCtx, s32 getItemId) { func_8002F434(actor, globalCtx, getItemId, 50.0f, 10.0f); } -void func_8002F580(Actor* actor, GlobalContext* globalCtx) -{ +void func_8002F580(Actor* actor, GlobalContext* globalCtx) { func_8002F554(actor, globalCtx, 0); } -u32 func_8002F5A0(Actor* actor, GlobalContext* globalCtx) -{ - if (actor->attachedA == NULL) +u32 func_8002F5A0(Actor* actor, GlobalContext* globalCtx) { + if (actor->attachedA == NULL) { return 1; - else + } else { return 0; + } } -void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) -{ +void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { Actor* actorAttachedA = actorA->attachedA; - if (actorAttachedA->id == ACTOR_PLAYER) - { + if (actorAttachedA->id == ACTOR_PLAYER) { Player* player = (Player*)actorAttachedA; player->heldActor = actorB; player->interactRangeActor = actorB; @@ -1818,28 +1626,26 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) actorA->attachedA = NULL; } -void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) -{ +void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) { Player* player = PLAYER; - if (actor->waterSurfaceDist < player->unk_6A4) + if (actor->waterSurfaceDist < player->unk_6A4) { player->unk_6A4 = actor->waterSurfaceDist; + } } -u32 func_8002F618(GlobalContext* globalCtx, Actor* actor) -{ - if (actor->attachedB != NULL) +u32 func_8002F618(GlobalContext* globalCtx, Actor* actor) { + if (actor->attachedB != NULL) { return 1; - else + } else { return 0; + } } -u32 func_8002F63C(GlobalContext* globalCtx, Actor* actor, s32 arg2) -{ +u32 func_8002F63C(GlobalContext* globalCtx, Actor* actor, s32 arg2) { Player* player = PLAYER; - if (!(player->stateFlags1 & 0x003C7880)) - { + if (!(player->stateFlags1 & 0x003C7880)) { player->rideActor = actor; player->unk_43C = arg2; return 1; @@ -1848,16 +1654,15 @@ u32 func_8002F63C(GlobalContext* globalCtx, Actor* actor, s32 arg2) return 0; } -u32 func_8002F674(GlobalContext* globalCtx, Actor* actor) -{ - if (actor->attachedB == NULL) +u32 func_8002F674(GlobalContext* globalCtx, Actor* actor) { + if (actor->attachedB == NULL) { return 1; - else + } else { return 0; + } } -void func_8002F698(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) -{ +void func_8002F698(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { Player* player = PLAYER; player->unk_8A0 = arg6; player->unk_8A1 = arg5; @@ -1866,97 +1671,84 @@ void func_8002F698(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 a player->unk_8A8 = arg4; } -void func_8002F6D4(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4, u32 arg5) -{ +void func_8002F6D4(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { func_8002F698(globalCtx, arg1, arg2, arg3, arg4, 2, arg5); } -void func_8002F71C(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4) -{ +void func_8002F71C(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4) { func_8002F6D4(globalCtx, arg1, arg2, arg3, arg4, 0); } -void func_8002F758(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4, u32 arg5) -{ +void func_8002F758(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { func_8002F698(globalCtx, arg1, arg2, arg3, arg4, 1, arg5); } -void func_8002F7A0(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4) -{ +void func_8002F7A0(GlobalContext* globalCtx, u32 arg1, f32 arg2, s16 arg3, f32 arg4) { func_8002F758(globalCtx, arg1, arg2, arg3, arg4, 0); } -void func_8002F7DC(Actor* actor, u16 sfxId) -{ +void func_8002F7DC(Actor* actor, u16 sfxId) { Audio_PlaySoundGeneral(sfxId, &actor->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } -void Audio_PlayActorSound2(Actor* actor, u16 sfxId) -{ +void Audio_PlayActorSound2(Actor* actor, u16 sfxId) { func_80078914(&actor->unk_E4, sfxId); } -void func_8002F850(GlobalContext* globalCtx, Actor* actor) -{ +void func_8002F850(GlobalContext* globalCtx, Actor* actor) { s32 sfxId; - if (actor->bgCheckFlags & 0x20) - { - if (actor->unk_84 < 20.0f) + if (actor->bgCheckFlags & 0x20) { + if (actor->unk_84 < 20.0f) { sfxId = NA_SE_PL_WALK_WATER0; - else + } else { sfxId = NA_SE_PL_WALK_WATER1; - } - else + } + } else { sfxId = func_80041F34(&globalCtx->colCtx, actor->floorPoly, actor->floorPolySource, actor); + } func_80078914(&actor->unk_E4, NA_SE_EV_BOMB_BOUND); func_80078914(&actor->unk_E4, sfxId + 0x800); } -void func_8002F8F0(Actor* actor, u16 sfxId) -{ +void func_8002F8F0(Actor* actor, u16 sfxId) { actor->soundEffect = sfxId; actor->flags |= 0x80000; actor->flags &= ~0x10300000; } -void func_8002F91C(Actor* actor, u16 sfxId) -{ +void func_8002F91C(Actor* actor, u16 sfxId) { actor->soundEffect = sfxId; actor->flags |= 0x100000; actor->flags &= ~0x10280000; } -void func_8002F948(Actor* actor, u16 sfxId) -{ +void func_8002F948(Actor* actor, u16 sfxId) { actor->soundEffect = sfxId; actor->flags |= 0x200000; actor->flags &= ~0x10180000; } -void func_8002F974(Actor* actor, u16 sfxId) -{ +void func_8002F974(Actor* actor, u16 sfxId) { actor->flags &= ~0x10380000; actor->soundEffect = sfxId; } -void func_8002F994(Actor* actor, s32 sfxId) -{ +void func_8002F994(Actor* actor, s32 sfxId) { actor->flags |= 0x10000000; actor->flags &= ~0x00380000; - if (sfxId < NA_SE_PL_LAND_GRASS) + if (sfxId < NA_SE_PL_LAND_GRASS) { actor->soundEffect = NA_SE_PL_WALK_DIRT; - else if (sfxId < NA_SE_PL_DIVE_BUBBLE) + } else if (sfxId < NA_SE_PL_DIVE_BUBBLE) { actor->soundEffect = NA_SE_PL_WALK_CONCRETE; - else + } else { actor->soundEffect = NA_SE_PL_WALK_SAND; + } } -s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, UNK_TYPE arg2, UNK_TYPE arg3, UNK_TYPE arg4) -{ - if (func_80041D4C(&globalCtx->colCtx, arg2, arg3) == 8) - { +s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, UNK_TYPE arg2, UNK_TYPE arg3, UNK_TYPE arg4) { + if (func_80041D4C(&globalCtx->colCtx, arg2, arg3) == 8) { globalCtx->unk_11D30[0] = 1; func_8005DFAC(globalCtx, 0, arg4); Audio_PlayActorSound2(actor, NA_SE_IT_WALL_HIT_BUYO); @@ -1972,12 +1764,10 @@ z_Light* D_8015BC10; s32 D_8015BC14; f32 D_8015BC18; -void func_8002FA60(GlobalContext* globalCtx) -{ +void func_8002FA60(GlobalContext* globalCtx) { Vec3f lightPos; - if (gSaveContext.fw.set) - { + if (gSaveContext.fw.set) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0x28; gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = gSaveContext.fw.pos_x; gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = gSaveContext.fw.pos_y; @@ -1988,9 +1778,7 @@ void func_8002FA60(GlobalContext* globalCtx) gSaveContext.respawn[RESPAWN_MODE_TOP].room_index = gSaveContext.fw.room_index; gSaveContext.respawn[RESPAWN_MODE_TOP].temp_swch_flags = gSaveContext.fw.temp_swch_flags; gSaveContext.respawn[RESPAWN_MODE_TOP].temp_collect_flags = gSaveContext.fw.temp_collect_flags; - } - else - { + } else { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = 0.0f; gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = 0.0f; @@ -2015,8 +1803,7 @@ Color_RGB8 D_80116064 = { 0x64, 0xC8, 0x00 }; #ifdef NON_MATCHING // this function still needs a lot of work -void func_8002FBAC(GlobalContext* globalCtx) -{ +void func_8002FBAC(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[6]; Vec3f lightPos; @@ -2042,8 +1829,7 @@ void func_8002FBAC(GlobalContext* globalCtx) func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 5308); - if (gSaveContext.respawn[RESPAWN_MODE_TOP].data != 0) - { + if (gSaveContext.respawn[RESPAWN_MODE_TOP].data != 0) { if (LINK_IS_ADULT) spD8 = 80.0f; else @@ -2054,39 +1840,34 @@ void func_8002FBAC(GlobalContext* globalCtx) temp_a3 = gSaveContext.respawn[RESPAWN_MODE_TOP].data - 0x28; - if (temp_a3 < 0) - { + if (temp_a3 < 0) { gSaveContext.respawn[RESPAWN_MODE_TOP].data++; spD4 = ABS(gSaveContext.respawn[RESPAWN_MODE_TOP].data) * 0.025f; D_8015BC14 = 60; D_8015BC18 = 1.0f; - } - else if (D_8015BC14 != 0) - { + } else if (D_8015BC14 != 0) { D_8015BC14--; - } - else if (D_8015BC18 > 0.0f) - { + } else if (D_8015BC18 > 0.0f) { spC0 = D_8015BC18; temp_ret = Math_Vec3f_DistXYZAndStoreDiff(&gSaveContext.respawn[RESPAWN_MODE_DOWN].pos, - &gSaveContext.respawn[RESPAWN_MODE_TOP].pos, - &spB4); + &gSaveContext.respawn[RESPAWN_MODE_TOP].pos, &spB4); - if (temp_ret < 20.0f) - { + if (temp_ret < 20.0f) { D_8015BC18 = 0.0f; - Math_Vec3f_Copy(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, &gSaveContext.respawn[RESPAWN_MODE_DOWN].pos); - } - else - { + Math_Vec3f_Copy(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, + &gSaveContext.respawn[RESPAWN_MODE_DOWN].pos); + } else { sp9C = (1.0f / D_8015BC18) * temp_ret; phi_f14 = 20.0f / sp9C; phi_f14 = (phi_f14 < 0.05f) ? 0.05f : phi_f14; Math_ApproxF(&D_8015BC18, 0.0f, phi_f14); temp_f2 = ((D_8015BC18 / spC0) * temp_ret) / temp_ret; - gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x + (spB4.x * temp_f2); - gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.y + (spB4.y * temp_f2); - gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z = gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.z + (spB4.z * temp_f2); + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x = + gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.x + (spB4.x * temp_f2); + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y = + gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.y + (spB4.y * temp_f2); + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z = + gSaveContext.respawn[RESPAWN_MODE_DOWN].pos.z + (spB4.z * temp_f2); temp_f12 = sp9C * 0.5f; temp_f14 = temp_ret - temp_f12; spD8 += sqrtf((temp_f12 * temp_f12) - (temp_f14 * temp_f14)) * 0.2f; @@ -2099,21 +1880,17 @@ void func_8002FBAC(GlobalContext* globalCtx) func_80028BB0(globalCtx, &spA4, &D_80116048, &D_80116054, &D_80116060, &D_80116064, 1000, 0x10); - if (D_8015BC18 == 0.0f) - { + if (D_8015BC18 == 0.0f) { gSaveContext.respawn[RESPAWN_MODE_TOP] = gSaveContext.respawn[RESPAWN_MODE_DOWN]; gSaveContext.respawn[RESPAWN_MODE_TOP].player_params = 0x06FF; gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0x28; } gSaveContext.respawn[RESPAWN_MODE_TOP].pos = gSaveContext.respawn[RESPAWN_MODE_TOP].pos; - } - else if (temp_a3 > 0) - { + } else if (temp_a3 > 0) { temp_f12 = temp_a3 * 0.1f; - if (temp_f12 < 1.0f) - { + if (temp_f12 < 1.0f) { sp7C.x = globalCtx->view.eye.x; sp7C.y = globalCtx->view.eye.y - spD8; sp7C.z = globalCtx->view.eye.z; @@ -2129,14 +1906,11 @@ void func_8002FBAC(GlobalContext* globalCtx) spD0 = 0xFF - (((temp_a3 * 0x10) - temp_a3) * 2); - if (spD0 < 0) - { + if (spD0 < 0) { gSaveContext.fw.set = 0; gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; spD0 = 0; - } - else - { + } else { gSaveContext.respawn[RESPAWN_MODE_TOP].data++; } @@ -2145,33 +1919,33 @@ void func_8002FBAC(GlobalContext* globalCtx) if ((globalCtx->csCtx.state == 0) && (gSaveContext.respawn[RESPAWN_MODE_TOP].entrance_index == gSaveContext.entrance_index) && - (globalCtx->roomCtx.curRoom.num == gSaveContext.respawn[RESPAWN_MODE_TOP].room_index)) - { + (globalCtx->roomCtx.curRoom.num == gSaveContext.respawn[RESPAWN_MODE_TOP].room_index)) { gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 0x19); Matrix_Translate(gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + spD8, - gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z, - MTXMODE_NEW); + gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z, MTXMODE_NEW); Matrix_Scale(0.025f * spD4, 0.025f * spD4, 0.025f * spD4, MTXMODE_APPLY); Matrix_Mult(&globalCtx->mf_11D60, MTXMODE_APPLY); Matrix_Push(); gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0xFF, 0xFF, 0xC8, spD0); + gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0xFF, 0xFF, 0xC8, spD0); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x64, 0xC8, 0x00, 0xFF); phi_f10 = (globalCtx->gameplayFrames * 1500) & 0xFFFF; Matrix_RotateZ((phi_f10 * M_PI) / 32768.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5458), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5458), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, &D_04010130); Matrix_Pull(); phi_f6 = ~((globalCtx->gameplayFrames * 1200) & 0xFFFF); Matrix_RotateZ((phi_f6 * M_PI) / 32768.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5463), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5463), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, &D_04010130); } @@ -2179,7 +1953,8 @@ void func_8002FBAC(GlobalContext* globalCtx) lightPos.y = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + spD8; lightPos.z = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z; - Lights_InitType0PositionalLight(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, 500.0f * spD4); + Lights_InitType0PositionalLight(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, + 500.0f * spD4); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 5474); } @@ -2188,22 +1963,18 @@ void func_8002FBAC(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_8002FBAC.s") #endif -void func_80030488(GlobalContext* globalCtx) -{ +void func_80030488(GlobalContext* globalCtx) { Lights_Remove(globalCtx, &globalCtx->lightCtx, D_8015BC10); } -void func_800304B0(GlobalContext* globalCtx) -{ - if (globalCtx->actorCtx.unk_03 != 0) - { +void func_800304B0(GlobalContext* globalCtx) { + if (globalCtx->actorCtx.unk_03 != 0) { globalCtx->actorCtx.unk_03 = 0; func_800876C8(globalCtx); } } -void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry) -{ +void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry) { ActorOverlay* overlayEntry; SaveSceneFlags* saveSceneFlags; s32 i; @@ -2217,8 +1988,7 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* Matrix_MtxFCopy(&globalCtx->mf_11D60, &gMtxFClear); overlayEntry = &gActorOverlayTable[0]; - for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) - { + for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) { overlayEntry->loadedRamAddr = NULL; overlayEntry->nbLoaded = 0; overlayEntry++; @@ -2238,24 +2008,12 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* func_8002FA60(globalCtx); } -u32 D_80116068[] = -{ - 0x100000C0, - 0x100000C0, - 0x00000000, - 0x100004C0, - 0x00000080, - 0x300000C0, - 0x10000080, - 0x00000000, - 0x300000C0, - 0x100004C0, - 0x00000000, - 0x100000C0, +u32 D_80116068[] = { + 0x100000C0, 0x100000C0, 0x00000000, 0x100004C0, 0x00000080, 0x300000C0, + 0x10000080, 0x00000000, 0x300000C0, 0x100004C0, 0x00000000, 0x100000C0, }; -void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) -{ +void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { Actor* refActor; Actor* actor; Player* player; @@ -2268,91 +2026,79 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) player = PLAYER; - if (0) - { + if (0) { // This assert is optimized out but it exists due to its presence in rodata - if (gMaxProfile != ACTOR_DLF_MAX) + if (gMaxProfile != ACTOR_DLF_MAX) { __assert("MaxProfile == ACTOR_DLF_MAX", "../z_actor.c", UNK_LINE); + } } sp74 = NULL; unkFlag = 0; - if (globalCtx->nbSetupActors != 0) - { + if (globalCtx->nbSetupActors != 0) { actorEntry = &globalCtx->setupActorList[0]; - for (i = 0; i < globalCtx->nbSetupActors; i++) + for (i = 0; i < globalCtx->nbSetupActors; i++) { Actor_SpawnEntry(&globalCtx->actorCtx, actorEntry++, globalCtx); + } globalCtx->nbSetupActors = 0; } - if (actorCtx->unk_02 != 0) + if (actorCtx->unk_02 != 0) { actorCtx->unk_02--; + } - if (KREG(0) == -100) - { + if (KREG(0) == -100) { refActor = &PLAYER->actor; KREG(0) = 0; - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, - refActor->posRot.pos.x, refActor->posRot.pos.y + 100.0f, refActor->posRot.pos.z, - 0, 0, 0, 1); + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, refActor->posRot.pos.x, + refActor->posRot.pos.y + 100.0f, refActor->posRot.pos.z, 0, 0, 0, 1); } sp80 = &D_80116068[0]; - if (player->stateFlags2 & 0x8000000) + if (player->stateFlags2 & 0x8000000) { unkFlag = 0x2000000; + } - if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x600)) + if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x600)) { sp74 = player->unk_694; + } - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++, sp80++) - { + for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++, sp80++) { unkCondition = (*sp80 & player->stateFlags1); actor = actorCtx->actorList[i].first; - while (actor != NULL) - { - if (actor->posRot.pos.y < -25000.0f) + while (actor != NULL) { + if (actor->posRot.pos.y < -25000.0f) { actor->posRot.pos.y = -25000.0f; + } actor->soundEffect = 0; - if (actor->init != NULL) - { - if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) - { + if (actor->init != NULL) { + if (Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { Actor_SetObjectDependency(globalCtx, actor); actor->init(actor, globalCtx); actor->init = NULL; } actor = actor->next; - } - else if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) - { + } else if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); actor = actor->next; - } - else if ((unkFlag && !(actor->flags & unkFlag)) || - (!unkFlag && unkCondition && - (sp74 != actor) && (actor != player->unk_68C) && - (actor != player->heldActor) && (&player->actor != actor->attachedA))) - { + } else if ((unkFlag && !(actor->flags & unkFlag)) || + (!unkFlag && unkCondition && (sp74 != actor) && (actor != player->unk_68C) && + (actor != player->heldActor) && (&player->actor != actor->attachedA))) { func_80061E8C(&actor->sub_98); actor = actor->next; - } - else if (actor->update == NULL) - { - if (!actor->activelyDrawn) + } else if (actor->update == NULL) { + if (!actor->activelyDrawn) { actor = Actor_Delete(&globalCtx->actorCtx, actor, globalCtx); - else - { + } else { Actor_Destroy(actor, globalCtx); actor = actor->next; } - } - else - { + } else { Math_Vec3f_Copy(&actor->pos4, &actor->posRot.pos); actor->xzDistanceFromLink = func_8002DB8C(actor, &player->actor); actor->yDistanceFromLink = Actor_HeightDiff(actor, &player->actor); @@ -2361,19 +2107,21 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) actor->rotTowardsLinkY = func_8002DA78(actor, &player->actor); actor->flags &= ~0x1000000; - if ((DECR(actor->freeze) == 0) && (actor->flags & 0x50)) - { - if (actor == player->unk_664) + if ((DECR(actor->freeze) == 0) && (actor->flags & 0x50)) { + if (actor == player->unk_664) { actor->unk_10C = 1; - else + } else { actor->unk_10C = 0; + } - if ((actor->unk_10D != 0) && (player->unk_664 == NULL)) + if ((actor->unk_10D != 0) && (player->unk_664 == NULL)) { actor->unk_10D = 0; + } Actor_SetObjectDependency(globalCtx, actor); - if (actor->unk_114 != 0) + if (actor->unk_114 != 0) { actor->unk_114--; + } actor->update(actor, globalCtx); func_8003F8EC(globalCtx, &globalCtx->colCtx.dyna, actor); } @@ -2384,23 +2132,21 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) } } - if (i == ACTORTYPE_BG) + if (i == ACTORTYPE_BG) { func_8003F984(globalCtx, &globalCtx->colCtx.dyna); + } } actor = player->unk_664; - if ((actor != NULL) && (actor->update == NULL)) - { + if ((actor != NULL) && (actor->update == NULL)) { actor = NULL; func_8008EDF0(player); } - if ((actor == NULL) || (player->unk_66C < 5)) - { + if ((actor == NULL) || (player->unk_66C < 5)) { actor = NULL; - if (actorCtx->targetCtx.unk_4B != 0) - { + if (actorCtx->targetCtx.unk_4B != 0) { actorCtx->targetCtx.unk_4B = 0; func_80078884(NA_SE_SY_LOCK_OFF); } @@ -2411,13 +2157,11 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) func_8003FB64(globalCtx, &globalCtx->colCtx.dyna); } -void Actor_FaultPrint(Actor* actor, char* command) -{ +void Actor_FaultPrint(Actor* actor, char* command) { ActorOverlay* overlayEntry; char* name; - if ((actor == NULL) || (actor->overlayEntry == NULL)) - { + if ((actor == NULL) || (actor->overlayEntry == NULL)) { FaultDrawer_SetCursor(48, 24); FaultDrawer_Printf("ACTOR NAME is NULL"); } @@ -2428,16 +2172,16 @@ void Actor_FaultPrint(Actor* actor, char* command) // Translates to: "ACTOR NAME(%08x:%s)" osSyncPrintf("アクターの名前(%08x:%s)\n", actor, name); - if (command != NULL) + if (command != NULL) { // Translates to: "COMMAND:%s" osSyncPrintf("コメント:%s\n", command); + } FaultDrawer_SetCursor(48, 24); FaultDrawer_Printf("ACTOR NAME %08x:%s", actor, name); } -void Actor_Draw(GlobalContext* globalCtx, Actor* actor) -{ +void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { FaultClient faultClient; LightMapper* lightMapper; GraphicsContext* gfxCtx; @@ -2455,20 +2199,14 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) func_8007A474(lightMapper, globalCtx->lightCtx.lightsHead, (actor->flags & 0x400000) ? NULL : &actor->posRot.pos); func_80079EFC(lightMapper, globalCtx->state.gfxCtx); - if (actor->flags & 0x1000) - { + if (actor->flags & 0x1000) { camera = &globalCtx->cameraCtx.activeCameras[0]; func_800D1694(actor->posRot.pos.x + camera->unk_80.x, - actor->posRot.pos.y + (f32)((actor->shape.unk_08 * actor->scale.y) + camera->unk_80.y), - actor->posRot.pos.z + camera->unk_80.z, - &actor->shape.rot); - } - else - { - func_800D1694(actor->posRot.pos.x, - actor->posRot.pos.y + (actor->shape.unk_08 * actor->scale.y), - actor->posRot.pos.z, - &actor->shape.rot); + actor->posRot.pos.y + (f32)((actor->shape.unk_08 * actor->scale.y) + camera->unk_80.y), + actor->posRot.pos.z + camera->unk_80.z, &actor->shape.rot); + } else { + func_800D1694(actor->posRot.pos.x, actor->posRot.pos.y + (actor->shape.unk_08 * actor->scale.y), + actor->posRot.pos.z, &actor->shape.rot); } Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY); @@ -2477,70 +2215,64 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); gSPSegment(gfxCtx->polyXlu.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); - if (actor->unk_114 != 0) - { + if (actor->unk_114 != 0) { // Must be inline data to match Color_RGBA8 sp2C = { 0x00, 0x00, 0x00, 0xFF }; - if (actor->unk_112 & 0x8000) + if (actor->unk_112 & 0x8000) { sp2C.r = sp2C.g = sp2C.b = ((actor->unk_112 & 0x1F00) >> 5) | 7; - else if (actor->unk_112 & 0x4000) + } else if (actor->unk_112 & 0x4000) { sp2C.r = ((actor->unk_112 & 0x1F00) >> 5) | 7; - else + } else { sp2C.b = ((actor->unk_112 & 0x1F00) >> 5) | 7; + } - if (actor->unk_112 & 0x2000) + if (actor->unk_112 & 0x2000) { func_80026860(globalCtx, &sp2C, actor->unk_114, actor->unk_112 & 0xFF); - else + } else { func_80026400(globalCtx, &sp2C, actor->unk_114, actor->unk_112 & 0xFF); + } } actor->draw(actor, globalCtx); - if (actor->unk_114 != 0) - { - if (actor->unk_112 & 0x2000) + if (actor->unk_114 != 0) { + if (actor->unk_112 & 0x2000) { func_80026A6C(globalCtx); - else + } else { func_80026608(globalCtx); + } } - if (actor->shape.shadowDrawFunc != NULL) + if (actor->shape.shadowDrawFunc != NULL) { actor->shape.shadowDrawFunc(actor, lightMapper, globalCtx); + } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 6119); Fault_RemoveClient(&faultClient); } -void func_80030ED8(Actor* actor) -{ - if (actor->flags & 0x80000) +void func_80030ED8(Actor* actor) { + if (actor->flags & 0x80000) { Audio_PlaySoundGeneral(actor->soundEffect, &actor->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - else if (actor->flags & 0x100000) + } else if (actor->flags & 0x100000) { func_80078884(actor->soundEffect); - else if (actor->flags & 0x200000) + } else if (actor->flags & 0x200000) { func_800788CC(actor->soundEffect); - else if (actor->flags & 0x10000000) + } else if (actor->flags & 0x10000000) { func_800F4C58(&D_801333D4, 0x2021, (s8)(actor->soundEffect - 1)); - else + } else { func_80078914(&actor->unk_E4, actor->soundEffect); + } } -void func_80030FA8(GraphicsContext* gfxCtx) -{ +void func_80030FA8(GraphicsContext* gfxCtx) { Gfx* gfxArr[5]; func_800C6AC4(gfxArr, gfxCtx, "../z_actor.c", 6161); - gDPLoadTextureBlock(gfxCtx->polyXlu.p++, - &D_0401E370, - G_IM_FMT_I, - G_IM_SIZ_8b, - 64, 64, - 0, - G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, - 6, 6, - G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gfxCtx->polyXlu.p++, &D_0401E370, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_MIRROR | G_TX_CLAMP, + G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD); gDPSetTileSize(gfxCtx->polyXlu.p++, G_TX_RENDERTILE, 384, 224, 892, 732); gSPTextureRectangle(gfxCtx->polyXlu.p++, 0, 0, 1280, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597); @@ -2549,8 +2281,7 @@ void func_80030FA8(GraphicsContext* gfxCtx) func_800C6B54(gfxArr, gfxCtx, "../z_actor.c", 6183); } -void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invisibleActors) -{ +void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invisibleActors) { Actor** invisibleActor; GraphicsContext* gfxCtx; s32 i; @@ -2565,26 +2296,21 @@ void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invi gDPPipeSync(gfxCtx->polyXlu.p++); - if (globalCtx->roomCtx.curRoom.showInvisActors == 0) - { + if (globalCtx->roomCtx.curRoom.showInvisActors == 0) { gDPSetOtherMode(gfxCtx->polyXlu.p++, - G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | - G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | G_RM_CLD_SURF | G_RM_CLD_SURF2); gDPSetCombineMode(gfxCtx->polyXlu.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0xFF, 0x00, 0x00, 0xFF); - } - else - { + } else { gDPSetOtherMode(gfxCtx->polyXlu.p++, - G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | - G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | - IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) | - GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)); - gDPSetCombineLERP(gfxCtx->polyXlu.p++, - PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, + G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) | + GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)); + gDPSetCombineLERP(gfxCtx->polyXlu.p++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0xFF, 0x4A, 0x4A, 0x4A, 0x4A); } @@ -2597,8 +2323,7 @@ void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invi gDma1p(gfxCtx->polyOpa.p++, G_NOOP, "魔法のメガネ 見えないActor表示 START", nbInvisibleActors, 2); invisibleActor = &invisibleActors[0]; - for (i = 0; i < nbInvisibleActors; i++) - { + for (i = 0; i < nbInvisibleActors; i++) { // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY" gDma1p(gfxCtx->polyOpa.p++, G_NOOP, "魔法のメガネ 見えないActor表示", i, 2); Actor_Draw(globalCtx, *(invisibleActor++)); @@ -2607,16 +2332,15 @@ void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invi // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY END" gDma1p(gfxCtx->polyOpa.p++, G_NOOP, "魔法のメガネ 見えないActor表示 END", nbInvisibleActors, 2); - if (globalCtx->roomCtx.curRoom.showInvisActors != 0) - { + if (globalCtx->roomCtx.curRoom.showInvisActors != 0) { // Translates to: "BLUE SPECTACLES (EXTERIOR)" gDma1p(gfxCtx->polyOpa.p++, G_NOOP, "青い眼鏡(外側)", 0, 2); gDPPipeSync(gfxCtx->polyXlu.p++); gDPSetOtherMode(gfxCtx->polyXlu.p++, - G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | - G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2); gDPSetCombineMode(gfxCtx->polyXlu.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0xFF, 0x00, 0x00, 0xFF); @@ -2633,30 +2357,26 @@ void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invi func_800C6B54(gfxArr, gfxCtx, "../z_actor.c", 6284); } -s32 func_800314B0(GlobalContext* globalCtx, Actor* actor) -{ +s32 func_800314B0(GlobalContext* globalCtx, Actor* actor) { return func_800314D4(globalCtx, actor, &actor->unk_E4, actor->unk_F0); } -s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3) -{ +s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3) { f32 var; - if ((arg2->z > -actor->unk_F8) && (arg2->z < (actor->unk_F4 + actor->unk_F8))) - { + if ((arg2->z > -actor->unk_F8) && (arg2->z < (actor->unk_F4 + actor->unk_F8))) { var = (arg3 < 1.0f) ? 1.0f : 1.0f / arg3; - if ((((fabsf(arg2->x) - actor->unk_F8) * var) < 1.0f) && - (((arg2->y + actor->unk_FC) * var) > -1.0f) && - (((arg2->y - actor->unk_F8) * var) < 1.0f)) + if ((((fabsf(arg2->x) - actor->unk_F8) * var) < 1.0f) && (((arg2->y + actor->unk_FC) * var) > -1.0f) && + (((arg2->y - actor->unk_F8) * var) < 1.0f)) { return 1; + } } return 0; } -void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) -{ +void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { s32 invisibleActorCounter; Actor* invisibleActors[INVISIBLE_ACTOR_MAX]; ActorListEntry* actorListEntry; @@ -2667,18 +2387,16 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) ActorOverlay* overlayEntry; char* actorName; - gfxCtx = globalCtx->state.gfxCtx; + gfxCtx = globalCtx->state.gfxCtx; invisibleActorCounter = 0; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 6336); actorListEntry = &actorCtx->actorList[0]; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++, actorListEntry++) - { + for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++, actorListEntry++) { actor = actorListEntry->first; - while (actor != NULL) - { + while (actor != NULL) { overlayEntry = actor->overlayEntry; actorName = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -2687,55 +2405,38 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) HREG(66) = i; - if ((HREG(64) != 1) || - ((HREG(65) != -1) && (HREG(65) != HREG(66))) || - (HREG(68) == 0)) - { + if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) { func_800A6E10(&globalCtx->mf_11D60, &actor->posRot.pos, &actor->unk_E4, &actor->unk_F0); } - if ((HREG(64) != 1) || - ((HREG(65) != -1) && (HREG(65) != HREG(66))) || - (HREG(69) == 0)) - { - if (actor->soundEffect != 0) + if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) { + if (actor->soundEffect != 0) { func_80030ED8(actor); + } } - if ((HREG(64) != 1) || - ((HREG(65) != -1) && (HREG(65) != HREG(66))) || - (HREG(70) == 0)) - { - if (func_800314B0(globalCtx, actor)) + if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) { + if (func_800314B0(globalCtx, actor)) { actor->flags |= 0x40; - else + } else { actor->flags &= ~0x40; + } } actor->activelyDrawn = 0; - if ((HREG(64) != 1) || - ((HREG(65) != -1) && (HREG(65) != HREG(66))) || - (HREG(71) == 0)) - { - if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & 0x60)) - { + if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { + if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & 0x60)) { if ((actor->flags & 0x80) && - ((globalCtx->roomCtx.curRoom.showInvisActors == 0) || - (globalCtx->actorCtx.unk_03 != 0) || - (actor->room != globalCtx->roomCtx.curRoom.num))) - { - if (invisibleActorCounter >= INVISIBLE_ACTOR_MAX) + ((globalCtx->roomCtx.curRoom.showInvisActors == 0) || (globalCtx->actorCtx.unk_03 != 0) || + (actor->room != globalCtx->roomCtx.curRoom.num))) { + if (invisibleActorCounter >= INVISIBLE_ACTOR_MAX) { __assert("invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464); + } invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; - } - else - { - if ((HREG(64) != 1) || - ((HREG(65) != -1) && (HREG(65) != HREG(66))) || - (HREG(72) == 0)) - { + } else { + if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) { Actor_Draw(globalCtx, actor); actor->activelyDrawn = 1; } @@ -2747,48 +2448,50 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) } } - if ((HREG(64) != 1) || (HREG(73) != 0)) + if ((HREG(64) != 1) || (HREG(73) != 0)) { func_80026E74(globalCtx->state.gfxCtx); + } - if ((HREG(64) != 1) || (HREG(74) != 0)) + if ((HREG(64) != 1) || (HREG(74) != 0)) { func_80027BDC(globalCtx); + } - if ((HREG(64) != 1) || (HREG(72) != 0)) - { - if (globalCtx->actorCtx.unk_03 != 0) - { + if ((HREG(64) != 1) || (HREG(72) != 0)) { + if (globalCtx->actorCtx.unk_03 != 0) { func_8003115C(globalCtx, invisibleActorCounter, invisibleActors); - if ((globalCtx->csCtx.state != 0) || func_8008E988(globalCtx)) + if ((globalCtx->csCtx.state != 0) || func_8008E988(globalCtx)) { func_800304B0(globalCtx); + } } } func_8002FBAC(globalCtx); - if (IREG(32) == 0) + if (IREG(32) == 0) { func_8007ABBC(globalCtx); + } - if ((HREG(64) != 1) || (HREG(75) != 0)) + if ((HREG(64) != 1) || (HREG(75) != 0)) { TitleCard_Draw(globalCtx, &actorCtx->titleCtx); + } - if ((HREG(64) != 1) || (HREG(76) != 0)) + if ((HREG(64) != 1) || (HREG(76) != 0)) { func_8005D62C(globalCtx, &globalCtx->sub_11E60); + } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 6563); } -void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) -{ +void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) - { + for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) { actor = actorCtx->actorList[i].first; - while (actor != NULL) - { - if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) + while (actor != NULL) { + if (!Object_IsLoaded(&globalCtx->objectCtx, actor->objBankIndex)) { Actor_Kill(actor); + } actor = actor->next; } } @@ -2796,47 +2499,38 @@ void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) u8 sEnemyActorTypes[] = { ACTORTYPE_ENEMY, ACTORTYPE_BOSS }; -void Actor_FreezeAllEnemies(GlobalContext* globalCtx, ActorContext* actorCtx, s32 freezeValue) -{ +void Actor_FreezeAllEnemies(GlobalContext* globalCtx, ActorContext* actorCtx, s32 freezeValue) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(sEnemyActorTypes); i++) - { + for (i = 0; i < ARRAY_COUNT(sEnemyActorTypes); i++) { actor = actorCtx->actorList[sEnemyActorTypes[i]].first; - while (actor != NULL) - { + while (actor != NULL) { actor->freeze = freezeValue; actor = actor->next; } } } -void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) -{ +void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) - { + for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) { actor = actorCtx->actorList[i].first; - while (actor != NULL) - { - if ((actor->room >= 0) && - (actor->room != globalCtx->roomCtx.curRoom.num) && - (actor->room != globalCtx->roomCtx.prevRoom.num)) - { - if (!actor->activelyDrawn) + while (actor != NULL) { + if ((actor->room >= 0) && (actor->room != globalCtx->roomCtx.curRoom.num) && + (actor->room != globalCtx->roomCtx.prevRoom.num)) { + if (!actor->activelyDrawn) { actor = Actor_Delete(actorCtx, actor, globalCtx); - else - { + } else { Actor_Kill(actor); Actor_Destroy(actor, globalCtx); actor = actor->next; } - } - else + } else { actor = actor->next; + } } } @@ -2846,27 +2540,24 @@ void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx) globalCtx->msgCtx.unk_E3F4 = 0; } -void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) -{ +void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) { Actor* actor; s32 i; - for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) - { + for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) { actor = actorCtx->actorList[i].first; - while (actor != NULL) - { + while (actor != NULL) { Actor_Delete(actorCtx, actor, globalCtx); actor = actorCtx->actorList[i].first; } } - if (HREG(20) != 0) + if (HREG(20) != 0) { // Translates to: "ABSOLUTE MAGIC FIELD DEALLOCATION" osSyncPrintf("絶対魔法領域解放\n"); + } - if (actorCtx->absoluteSpace != NULL) - { + if (actorCtx->absoluteSpace != NULL) { ZeldaArena_FreeDebug(actorCtx->absoluteSpace, "../z_actor.c", 6731); actorCtx->absoluteSpace = NULL; } @@ -2880,8 +2571,7 @@ void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) * Adds a given actor instance at the front of the actor list of the specified type. * Also sets the actor instance as being of that type. */ -void Actor_AddToTypeList(ActorContext* actorCtx, Actor* actorToAdd, u8 actorType) -{ +void Actor_AddToTypeList(ActorContext* actorCtx, Actor* actorToAdd, u8 actorType) { Actor* prevFirstActor; actorToAdd->type = actorType; @@ -2890,8 +2580,9 @@ void Actor_AddToTypeList(ActorContext* actorCtx, Actor* actorToAdd, u8 actorType actorCtx->actorList[actorType].length++; prevFirstActor = actorCtx->actorList[actorType].first; - if (prevFirstActor != NULL) + if (prevFirstActor != NULL) { prevFirstActor->prev = actorToAdd; + } actorCtx->actorList[actorType].first = actorToAdd; actorToAdd->next = prevFirstActor; @@ -2901,81 +2592,75 @@ void Actor_AddToTypeList(ActorContext* actorCtx, Actor* actorToAdd, u8 actorType * Removes a given actor instance from its actor list. * Also sets the temp clear flag of the current room if the actor removed was the last enemy loaded. */ -Actor* Actor_RemoveFromTypeList(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actorToRemove) -{ +Actor* Actor_RemoveFromTypeList(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actorToRemove) { Actor* newFirstActor; actorCtx->total--; actorCtx->actorList[actorToRemove->type].length--; - if (actorToRemove->prev != NULL) + if (actorToRemove->prev != NULL) { actorToRemove->prev->next = actorToRemove->next; - else + } else { actorCtx->actorList[actorToRemove->type].first = actorToRemove->next; + } newFirstActor = actorToRemove->next; - if (newFirstActor != NULL) + if (newFirstActor != NULL) { newFirstActor->prev = actorToRemove->prev; + } actorToRemove->next = NULL; actorToRemove->prev = NULL; - if ((actorToRemove->room == globalCtx->roomCtx.curRoom.num) && - (actorToRemove->type == ACTORTYPE_ENEMY) && - (actorCtx->actorList[ACTORTYPE_ENEMY].length == 0)) - { + if ((actorToRemove->room == globalCtx->roomCtx.curRoom.num) && (actorToRemove->type == ACTORTYPE_ENEMY) && + (actorCtx->actorList[ACTORTYPE_ENEMY].length == 0)) { Flags_SetTempClear(globalCtx, globalCtx->roomCtx.curRoom.num); } return newFirstActor; } -void Actor_FreeOverlay(ActorOverlay* actorOverlay) -{ +void Actor_FreeOverlay(ActorOverlay* actorOverlay) { osSyncPrintf(VT_FGCOL(CYAN)); - if (actorOverlay->nbLoaded == 0) - { - if (HREG(20) != 0) + if (actorOverlay->nbLoaded == 0) { + if (HREG(20) != 0) { // Translates to: "ACTOR CLIENT IS NOW 0" osSyncPrintf("アクタークライアントが0になりました\n"); + } - if (actorOverlay->loadedRamAddr != NULL) - { - if (actorOverlay->allocType & ALLOCTYPE_PERMANENT) - { - if (HREG(20) != 0) + if (actorOverlay->loadedRamAddr != NULL) { + if (actorOverlay->allocType & ALLOCTYPE_PERMANENT) { + if (HREG(20) != 0) { // Translates to: "OVERLAY WILL NOT BE DEALLOCATED" osSyncPrintf("オーバーレイ解放しません\n"); - } - else if (actorOverlay->allocType & ALLOCTYPE_ABSOLUTE) - { - if (HREG(20) != 0) + } + } else if (actorOverlay->allocType & ALLOCTYPE_ABSOLUTE) { + if (HREG(20) != 0) { // Translates to: "ABSOLUTE MAGIC FIELD RESERVED, SO DEALLOCATION WILL NOT OCCUR" osSyncPrintf("絶対魔法領域確保なので解放しません\n"); + } actorOverlay->loadedRamAddr = NULL; - } - else - { - if (HREG(20) != 0) + } else { + if (HREG(20) != 0) { // Translates to: "OVERLAY DEALLOCATED" osSyncPrintf("オーバーレイ解放します\n"); + } ZeldaArena_FreeDebug(actorOverlay->loadedRamAddr, "../z_actor.c", 6834); actorOverlay->loadedRamAddr = NULL; } } - } - else if (HREG(20) != 0) + } else if (HREG(20) != 0) { // Translates to: "%d OF ACTOR CLIENT REMAINS" osSyncPrintf("アクタークライアントはあと %d 残っています\n", actorOverlay->nbLoaded); + } osSyncPrintf(VT_RST); } -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, - f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) -{ +Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, + s16 rotX, s16 rotY, s16 rotZ, s16 params) { s32 pad; Actor* actor; ActorInit* actorInit; @@ -2987,132 +2672,126 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId overlayEntry = &gActorOverlayTable[actorId]; - if (actorId >= ACTOR_DLF_MAX) + if (actorId >= ACTOR_DLF_MAX) { __assert("profile < ACTOR_DLF_MAX", "../z_actor.c", 6883); + } name = overlayEntry->name != NULL ? overlayEntry->name : ""; overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart; - if (HREG(20) != 0) + if (HREG(20) != 0) { // Translates to: "ACTOR CLASS ADDITION [%d:%s]" osSyncPrintf("アクタークラス追加 [%d:%s]\n", actorId, name); + } - if (actorCtx->total > ACTOR_NUMBER_MAX) - { + if (actorCtx->total > ACTOR_NUMBER_MAX) { // Translates to: "Actor SET NUMBER EXCEEDED" osSyncPrintf(VT_COL(YELLOW, BLACK) "Actorセット数オーバー\n" VT_RST); return NULL; } - if (overlayEntry->vramStart == 0) - { - if (HREG(20) != 0) + if (overlayEntry->vramStart == 0) { + if (HREG(20) != 0) { // Translates to: "NOT AN OVERLAY" osSyncPrintf("オーバーレイではありません\n"); + } actorInit = overlayEntry->initInfo; - } - else - { - if (overlayEntry->loadedRamAddr != NULL) - { - if (HREG(20) != 0) + } else { + if (overlayEntry->loadedRamAddr != NULL) { + if (HREG(20) != 0) { // Translates to: "ALREADY LOADED" osSyncPrintf("既にロードされています\n"); - } - else - { - if (overlayEntry->allocType & ALLOCTYPE_ABSOLUTE) - { - if (overlaySize > AM_FIELD_SIZE) + } + } else { + if (overlayEntry->allocType & ALLOCTYPE_ABSOLUTE) { + if (overlaySize > AM_FIELD_SIZE) { __assert("actor_segsize <= AM_FIELD_SIZE", "../z_actor.c", 6934); + } - if (actorCtx->absoluteSpace == NULL) - { + if (actorCtx->absoluteSpace == NULL) { // Translates to: "AMF: ABSOLUTE MAGIC FIELD" actorCtx->absoluteSpace = ZeldaArena_MallocRDebug(AM_FIELD_SIZE, "AMF:絶対魔法領域", 0); - if (HREG(20) != 0) + if (HREG(20) != 0) { // Translates to: "ABSOLUTE MAGIC FIELD RESERVATION - %d BYTES RESERVED" osSyncPrintf("絶対魔法領域確保 %d バイト確保\n", AM_FIELD_SIZE); + } } overlayEntry->loadedRamAddr = actorCtx->absoluteSpace; - } - else if (overlayEntry->allocType & ALLOCTYPE_PERMANENT) + } else if (overlayEntry->allocType & ALLOCTYPE_PERMANENT) { overlayEntry->loadedRamAddr = ZeldaArena_MallocRDebug(overlaySize, name, 0); - else + } else { overlayEntry->loadedRamAddr = ZeldaArena_MallocDebug(overlaySize, name, 0); + } - if (overlayEntry->loadedRamAddr == NULL) - { + if (overlayEntry->loadedRamAddr == NULL) { // Translates to: "CANNOT RESERVE ACTOR PROGRAM MEMORY" osSyncPrintf(VT_COL(RED, WHITE) "Actorプログラムメモリが確保できません\n" VT_RST); return NULL; } - Overlay_Load(overlayEntry->vromStart, overlayEntry->vromEnd, - overlayEntry->vramStart, overlayEntry->vramEnd, - overlayEntry->loadedRamAddr); + Overlay_Load(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart, overlayEntry->vramEnd, + overlayEntry->loadedRamAddr); osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("OVL(a):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", - overlayEntry->vramStart, overlayEntry->vramEnd, - overlayEntry->loadedRamAddr, + osSyncPrintf("OVL(a):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", overlayEntry->vramStart, + overlayEntry->vramEnd, overlayEntry->loadedRamAddr, (u32)overlayEntry->loadedRamAddr + (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart, - (u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr, - name); + (u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr, name); osSyncPrintf(VT_RST); overlayEntry->nbLoaded = 0; } - actorInit = (ActorInit*)((u32)(overlayEntry->initInfo != NULL ? - (ActorInit*)((u32)overlayEntry->initInfo - (s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr)) : - NULL)); + actorInit = + (ActorInit*)((u32)(overlayEntry->initInfo != NULL + ? (ActorInit*)((u32)overlayEntry->initInfo - (s32)((u32)overlayEntry->vramStart - + (u32)overlayEntry->loadedRamAddr)) + : NULL)); } objBankIndex = Object_GetIndex(&globalCtx->objectCtx, actorInit->objectId); if ((objBankIndex < 0) || - ((actorInit->type == ACTORTYPE_ENEMY) && (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)))) - { + ((actorInit->type == ACTORTYPE_ENEMY) && (Flags_GetClear(globalCtx, globalCtx->roomCtx.curRoom.num)))) { // Translates to: "NO DATA BANK!! (profilep->bank=%d)" - osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, objBankIndex, actorInit->objectId); + osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST, + objBankIndex, actorInit->objectId); Actor_FreeOverlay(overlayEntry); return NULL; } actor = ZeldaArena_MallocDebug(actorInit->instanceSize, name, 1); - if (actor == NULL) - { + if (actor == NULL) { // Translates to: "ACTOR CLASS CANNOT BE RESERVED! %s " - osSyncPrintf(VT_COL(RED, WHITE) "Actorクラス確保できません! %s <サイズ=%dバイト>\n", VT_RST, name, actorInit->instanceSize); + osSyncPrintf(VT_COL(RED, WHITE) "Actorクラス確保できません! %s <サイズ=%dバイト>\n", VT_RST, name, + actorInit->instanceSize); Actor_FreeOverlay(overlayEntry); return NULL; } - if (overlayEntry->nbLoaded >= 255) + if (overlayEntry->nbLoaded >= 255) { __assert("actor_dlftbl->clients < 255", "../z_actor.c", 7031); + } overlayEntry->nbLoaded++; - if (HREG(20) != 0) + if (HREG(20) != 0) { // Translates to: "ACTOR CLIENT No. %d" osSyncPrintf("アクタークライアントは %d 個目です\n", overlayEntry->nbLoaded); + } Lib_MemSet(actor, actorInit->instanceSize, 0); actor->overlayEntry = overlayEntry; actor->id = actorInit->id; actor->flags = actorInit->flags; - if (actorInit->id == ACTOR_EN_PART) - { + if (actorInit->id == ACTOR_EN_PART) { actor->objBankIndex = rotZ; rotZ = 0; - } - else - { + } else { actor->objBankIndex = objBankIndex; } @@ -3138,26 +2817,24 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId return actor; } -Actor* Actor_SpawnAttached(ActorContext* actorCtx, Actor* attachedTo, GlobalContext* globalCtx, s16 actorId, - f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) -{ - Actor* spawnedActor = Actor_Spawn(actorCtx, globalCtx, actorId, - posX, posY, posZ, - rotX, rotY, rotZ, params); - if (spawnedActor == NULL) +Actor* Actor_SpawnAttached(ActorContext* actorCtx, Actor* attachedTo, GlobalContext* globalCtx, s16 actorId, f32 posX, + f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params) { + Actor* spawnedActor = Actor_Spawn(actorCtx, globalCtx, actorId, posX, posY, posZ, rotX, rotY, rotZ, params); + if (spawnedActor == NULL) { return NULL; + } attachedTo->attachedB = spawnedActor; spawnedActor->attachedA = attachedTo; - if (spawnedActor->room >= 0) + if (spawnedActor->room >= 0) { spawnedActor->room = attachedTo->room; + } return spawnedActor; } -void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx) -{ +void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx) { TransitionActorEntry* transitionActor; u8 nbTransitionActors; s32 i; @@ -3165,20 +2842,16 @@ void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCt transitionActor = globalCtx->transitionActorList; nbTransitionActors = globalCtx->nbTransitionActors; - for (i = 0; i < nbTransitionActors; i++) - { - if (transitionActor->id >= 0) - { + for (i = 0; i < nbTransitionActors; i++) { + if (transitionActor->id >= 0) { if (((transitionActor->frontRoom >= 0) && ((transitionActor->frontRoom == globalCtx->roomCtx.curRoom.num) || (transitionActor->frontRoom == globalCtx->roomCtx.prevRoom.num))) || ((transitionActor->backRoom >= 0) && ((transitionActor->backRoom == globalCtx->roomCtx.curRoom.num) || - (transitionActor->backRoom == globalCtx->roomCtx.prevRoom.num)))) - { - Actor_Spawn(actorCtx, globalCtx, (s16)(transitionActor->id & 0x1FFF), - transitionActor->pos.x, transitionActor->pos.y, transitionActor->pos.z, - 0, transitionActor->rotY, 0, + (transitionActor->backRoom == globalCtx->roomCtx.prevRoom.num)))) { + Actor_Spawn(actorCtx, globalCtx, (s16)(transitionActor->id & 0x1FFF), transitionActor->pos.x, + transitionActor->pos.y, transitionActor->pos.z, 0, transitionActor->rotY, 0, (i << 0xA) + transitionActor->params); transitionActor->id = -transitionActor->id; @@ -3189,16 +2862,12 @@ void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCt } } -Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx) -{ - return Actor_Spawn(actorCtx, globalCtx, actorEntry->id, - actorEntry->pos.x, actorEntry->pos.y, actorEntry->pos.z, - actorEntry->rot.x, actorEntry->rot.y, actorEntry->rot.z, - actorEntry->params); +Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx) { + return Actor_Spawn(actorCtx, globalCtx, actorEntry->id, actorEntry->pos.x, actorEntry->pos.y, actorEntry->pos.z, + actorEntry->rot.x, actorEntry->rot.y, actorEntry->rot.z, actorEntry->params); } -Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx) -{ +Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx) { char* name; Player* player; Actor* newFirstActor; @@ -3209,24 +2878,27 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; - if (HREG(20) != 0) + if (HREG(20) != 0) { // Translates to: "ACTOR CLASS DELETED [%s]" osSyncPrintf("アクタークラス削除 [%s]\n", name); + } - if ((player != NULL) && (actor == player->unk_664)) - { + if ((player != NULL) && (actor == player->unk_664)) { func_8008EDF0(player); func_8005A444(func_800C04A4(globalCtx, func_800C030C(globalCtx)), 0); } - if (actor == actorCtx->targetCtx.arrowPointedActor) + if (actor == actorCtx->targetCtx.arrowPointedActor) { actorCtx->targetCtx.arrowPointedActor = NULL; + } - if (actor == actorCtx->targetCtx.unk_8C) + if (actor == actorCtx->targetCtx.unk_8C) { actorCtx->targetCtx.unk_8C = NULL; + } - if (actor == actorCtx->targetCtx.unk_90) + if (actor == actorCtx->targetCtx.unk_90) { actorCtx->targetCtx.unk_90 = NULL; + } func_800F89E8(&actor->unk_E4); Actor_Destroy(actor, globalCtx); @@ -3235,19 +2907,19 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC ZeldaArena_FreeDebug(actor, "../z_actor.c", 7242); - if (overlayEntry->vramStart == 0) - { - if (HREG(20) != 0) + if (overlayEntry->vramStart == 0) { + if (HREG(20) != 0) { // Translates to: "NOT AN OVERLAY" osSyncPrintf("オーバーレイではありません\n"); - } - else - { - if (overlayEntry->loadedRamAddr == NULL) + } + } else { + if (overlayEntry->loadedRamAddr == NULL) { __assert("actor_dlftbl->allocp != NULL", "../z_actor.c", 7251); + } - if (overlayEntry->nbLoaded <= 0) + if (overlayEntry->nbLoaded <= 0) { __assert("actor_dlftbl->clients > 0", "../z_actor.c", 7252); + } overlayEntry->nbLoaded--; Actor_FreeOverlay(overlayEntry); @@ -3256,8 +2928,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC return newFirstActor; } -s32 func_80032880(GlobalContext* globalCtx, Actor* actor) -{ +s32 func_80032880(GlobalContext* globalCtx, Actor* actor) { s16 sp1E; s16 sp1C; @@ -3273,49 +2944,37 @@ f32 D_8015BBF4; s32 D_8015BBF8; s16 D_8015BBFC; -void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* player, u32 actorType) -{ +void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* player, u32 actorType) { f32 var; Actor* actor; Actor* sp84; - CollisionPoly *sp80; + CollisionPoly* sp80; UNK_TYPE sp7C; Vec3f sp70; actor = actorCtx->actorList[actorType].first; sp84 = player->unk_664; - while (actor != NULL) - { - if ((actor->update != NULL) && ((Player*)actor != player) && ((actor->flags & 1) == 1)) - { - if ((actorType == ACTORTYPE_ENEMY) && ((actor->flags & 5) == 5) && - (actor->waterSurfaceDist < 250000.0f) && (actor->waterSurfaceDist < D_8015BBF4)) - { - actorCtx->targetCtx.unk_90 = actor; - D_8015BBF4 = actor->waterSurfaceDist; + while (actor != NULL) { + if ((actor->update != NULL) && ((Player*)actor != player) && ((actor->flags & 1) == 1)) { + if ((actorType == ACTORTYPE_ENEMY) && ((actor->flags & 5) == 5) && (actor->waterSurfaceDist < 250000.0f) && + (actor->waterSurfaceDist < D_8015BBF4)) { + actorCtx->targetCtx.unk_90 = actor; + D_8015BBF4 = actor->waterSurfaceDist; } - if (actor != sp84) - { + if (actor != sp84) { var = func_8002EFC0(actor, player, D_8015BBFC); - if ((var < D_8015BBF0) && - func_8002F090(actor, var) && - func_80032880(globalCtx, actor) && - (!func_8003DD6C(&globalCtx->colCtx, &player->actor.posRot2.pos, - &actor->posRot2.pos, &sp70, &sp80, 1, 1, 1, 1, &sp7C) || - func_80042048(&globalCtx->colCtx, sp80, sp7C))) - { - if (actor->unk_10D != 0) - { - if (actor->unk_10D < D_8015BBF8) - { + if ((var < D_8015BBF0) && func_8002F090(actor, var) && func_80032880(globalCtx, actor) && + (!func_8003DD6C(&globalCtx->colCtx, &player->actor.posRot2.pos, &actor->posRot2.pos, &sp70, &sp80, + 1, 1, 1, 1, &sp7C) || + func_80042048(&globalCtx->colCtx, sp80, sp7C))) { + if (actor->unk_10D != 0) { + if (actor->unk_10D < D_8015BBF8) { D_8015BBEC = actor; D_8015BBF8 = actor->unk_10D; } - } - else - { + } else { D_8015BBE8 = actor; D_8015BBF0 = var; } @@ -3327,24 +2986,12 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla } } -u8 D_801160A0[] = -{ - ACTORTYPE_BOSS, - ACTORTYPE_ENEMY, - ACTORTYPE_BG, - ACTORTYPE_EXPLOSIVES, - ACTORTYPE_NPC, - ACTORTYPE_ITEMACTION, - ACTORTYPE_CHEST, - ACTORTYPE_SWITCH, - ACTORTYPE_PROP, - ACTORTYPE_MISC, - ACTORTYPE_DOOR, - ACTORTYPE_SWITCH, +u8 D_801160A0[] = { + ACTORTYPE_BOSS, ACTORTYPE_ENEMY, ACTORTYPE_BG, ACTORTYPE_EXPLOSIVES, ACTORTYPE_NPC, ACTORTYPE_ITEMACTION, + ACTORTYPE_CHEST, ACTORTYPE_SWITCH, ACTORTYPE_PROP, ACTORTYPE_MISC, ACTORTYPE_DOOR, ACTORTYPE_SWITCH, }; -Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player) -{ +Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player) { s32 i; u8* entry; @@ -3352,33 +2999,30 @@ Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** a D_8015BBF0 = D_8015BBF4 = FLT_MAX; D_8015BBF8 = 0x7FFFFFFF; - if (!func_8008E988(globalCtx)) - { + if (!func_8008E988(globalCtx)) { entry = &D_801160A0[0]; actorCtx->targetCtx.unk_90 = NULL; D_8015BBFC = player->actor.shape.rot.y; - for (i = 0; i < 3; i++) - { + for (i = 0; i < 3; i++) { func_800328D4(globalCtx, actorCtx, player, *entry); entry++; } - if (D_8015BBE8 == NULL) - { - for (i; i < ARRAY_COUNT(D_801160A0); i++) - { + if (D_8015BBE8 == NULL) { + for (i; i < ARRAY_COUNT(D_801160A0); i++) { func_800328D4(globalCtx, actorCtx, player, *entry); entry++; } } } - if (D_8015BBE8 == 0) + if (D_8015BBE8 == 0) { *actorPtr = D_8015BBEC; - else + } else { *actorPtr = D_8015BBE8; + } return *actorPtr; } @@ -3386,84 +3030,77 @@ Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** a /** * Finds the first actor instance of a specified id and type if there is one. */ -Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorType) -{ +Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorType) { Actor* actor = actorCtx->actorList[actorType].first; - while (actor != NULL) - { - if (actorId == actor->id) + while (actor != NULL) { + if (actorId == actor->id) { return actor; + } actor = actor->next; } return NULL; } -void func_80032C7C(GlobalContext* globalCtx, Actor* actor) -{ +void func_80032C7C(GlobalContext* globalCtx, Actor* actor) { globalCtx->actorCtx.unk_00 = 5; Audio_PlaySoundAtPosition(globalCtx, &actor->posRot.pos, 0x14, NA_SE_EN_LAST_DAMAGE); } -s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) -{ - if (DECR(arg0[1]) == 0) +s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { + if (DECR(arg0[1]) == 0) { arg0[1] = Math_Rand_S16Offset(arg1, arg2); + } - if ((arg0[1] - arg3) > 0) + if ((arg0[1] - arg3) > 0) { arg0[0] = 0; - else if (((arg0[1] - arg3) > -2) || (arg0[1] < 2)) + } else if (((arg0[1] - arg3) > -2) || (arg0[1] < 2)) { arg0[0] = 1; - else + } else { arg0[0] = 2; - - return arg0[0]; -} - -s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) -{ - if (DECR(arg0[1]) == 0) - { - arg0[1] = Math_Rand_S16Offset(arg1, arg2); - arg0[0]++; - - if ((arg0[0] % 3) == 0) - arg0[0] = (s32)(Math_Rand_ZeroOne() * arg3) * 3; } return arg0[0]; } -typedef struct -{ +s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) { + if (DECR(arg0[1]) == 0) { + arg0[1] = Math_Rand_S16Offset(arg1, arg2); + arg0[0]++; + + if ((arg0[0] % 3) == 0) { + arg0[0] = (s32)(Math_Rand_ZeroOne() * arg3) * 3; + } + } + + return arg0[0]; +} + +typedef struct { /* 0x00 */ MtxF* unk_00; /* 0x04 */ s16* unk_04; - /* 0x08 */ s16 unk_08; + /* 0x08 */ s16 unk_08; /* 0x0A */ char unk_0A[0x02]; /* 0x0C */ s32* unk_0C; - /* 0x10 */ s32 unk_10; - /* 0x14 */ s32 unk_14; + /* 0x10 */ s32 unk_10; + /* 0x14 */ s32 unk_14; } struct_80032E24; -void func_80032E24(struct_80032E24* arg0, s32 arg1, GlobalContext* globalCtx) -{ +void func_80032E24(struct_80032E24* arg0, s32 arg1, GlobalContext* globalCtx) { u32 sp28; u32 sp24; u32 sp20; sp28 = (arg1 * sizeof(*arg0->unk_00)) + sizeof(*arg0->unk_00); arg0->unk_00 = ZeldaArena_MallocDebug(sp28, "../z_actor.c", 7540); - if (arg0->unk_00 != NULL) - { + if (arg0->unk_00 != NULL) { sp24 = (arg1 * sizeof(*arg0->unk_0C)) + sizeof(*arg0->unk_0C); arg0->unk_0C = ZeldaArena_MallocDebug(sp24, "../z_actor.c", 7543); - if (arg0->unk_0C != NULL) - { + if (arg0->unk_0C != NULL) { sp20 = (arg1 * sizeof(*arg0->unk_04)) + sizeof(*arg0->unk_04); arg0->unk_04 = ZeldaArena_MallocDebug(sp20, "../z_actor.c", 7546); - if (arg0->unk_04 != NULL) - { + if (arg0->unk_04 != NULL) { Lib_MemSet(arg0->unk_00, sp28, 0); Lib_MemSet(arg0->unk_0C, sp24, 0); Lib_MemSet(arg0->unk_04, sp20, 0); @@ -3473,35 +3110,35 @@ void func_80032E24(struct_80032E24* arg0, s32 arg1, GlobalContext* globalCtx) } } - if (arg0->unk_00 != NULL) + if (arg0->unk_00 != NULL) { ZeldaArena_FreeDebug(arg0->unk_00, "../z_actor.c", 7558); + } - if (arg0->unk_0C != NULL) + if (arg0->unk_0C != NULL) { ZeldaArena_FreeDebug(arg0->unk_0C, "../z_actor.c", 7561); + } - if (arg0->unk_04 != NULL) + if (arg0->unk_04 != NULL) { ZeldaArena_FreeDebug(arg0->unk_04, "../z_actor.c", 7564); + } } -void func_80032F54(struct_80032E24* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, s32* arg5, s16 arg6) -{ +void func_80032F54(struct_80032E24* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4, s32* arg5, s16 arg6) { GlobalContext* globalCtx = func_80026B00(); - if ((globalCtx->actorCtx.unk_00 == 0) && (arg0->unk_10 > 0)) - { - if ((arg1 >= arg2) && (arg3 >= arg1) && (*arg5 != 0)) - { + if ((globalCtx->actorCtx.unk_00 == 0) && (arg0->unk_10 > 0)) { + if ((arg1 >= arg2) && (arg3 >= arg1) && (*arg5 != 0)) { arg0->unk_0C[arg0->unk_10] = *arg5; Matrix_Get(&arg0->unk_00[arg0->unk_10]); arg0->unk_04[arg0->unk_10] = arg6; arg0->unk_10++; } - if (arg1 != arg0->unk_14) + if (arg1 != arg0->unk_14) { arg0->unk_08++; + } - if (arg0->unk_08 >= arg4) - { + if (arg0->unk_08 >= arg4) { arg0->unk_08 = arg0->unk_10 - 1; arg0->unk_10 = -1; } @@ -3510,45 +3147,41 @@ void func_80032F54(struct_80032E24* arg0, s32 arg1, s32 arg2, s32 arg3, u32 arg4 arg0->unk_14 = arg1; } -typedef struct -{ - /* 0x000 */ Actor actor; - /* 0x14C */ u8 unk_14C; - /* 0x14E */ s16 unk_14E; - /* 0x150 */ s32 unk_150; - /* 0x154 */ f32 unk_154; - /* 0x158 */ f32 unk_158; +typedef struct { + /* 0x000 */ Actor actor; + /* 0x14C */ u8 unk_14C; + /* 0x14E */ s16 unk_14E; + /* 0x150 */ s32 unk_150; + /* 0x154 */ f32 unk_154; + /* 0x158 */ f32 unk_158; } ActorEnPart; -s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, s16 params) -{ +s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, s16 params) { ActorEnPart* spawnedEnPart; MtxF* mtx; s16 objBankIndex; - if (arg1->unk_10 != -1) + if (arg1->unk_10 != -1) { return 0; + } - while (arg1->unk_08 > 0) - { + while (arg1->unk_08 > 0) { Matrix_Put(&arg1->unk_00[arg1->unk_08]); Matrix_Scale(1.0f / actor->scale.x, 1.0f / actor->scale.y, 1.0f / actor->scale.z, MTXMODE_APPLY); Matrix_Get(&arg1->unk_00[arg1->unk_08]); - if (1) // Necessary to match - { - if (arg1->unk_04[arg1->unk_08] >= 0) + if (1) { // Necessary to match + if (arg1->unk_04[arg1->unk_08] >= 0) { objBankIndex = arg1->unk_04[arg1->unk_08]; - else + } else { objBankIndex = actor->objBankIndex; + } } mtx = &arg1->unk_00[arg1->unk_08]; spawnedEnPart = (ActorEnPart*)Actor_SpawnAttached(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, - mtx->wx, mtx->wy, mtx->wz, - 0, 0, objBankIndex, params); - if (spawnedEnPart != NULL) - { + mtx->wx, mtx->wy, mtx->wz, 0, 0, objBankIndex, params); + if (spawnedEnPart != NULL) { func_800D20CC(&arg1->unk_00[arg1->unk_08], &spawnedEnPart->actor.shape.rot, 0); spawnedEnPart->unk_150 = arg1->unk_0C[arg1->unk_08]; spawnedEnPart->actor.scale = actor->scale; @@ -3565,8 +3198,8 @@ s32 func_8003305C(Actor* actor, struct_80032E24* arg1, GlobalContext* globalCtx, return 1; } -void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, s32 arg4, f32 arg5, s16 arg6, s16 arg7, u8 arg8) -{ +void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, s32 arg4, f32 arg5, s16 arg6, + s16 arg7, u8 arg8) { Vec3f sp9C; Vec3f sp90 = { 0.0f, 0.0f, 0.0f }; Vec3f sp84 = { 0.0f, 0.3f, 0.0f }; @@ -3577,26 +3210,25 @@ void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3 sp9C.y = actor->unk_80; sp84.y += (Math_Rand_ZeroOne() - 0.5f) * 0.2f; - for (i = arg4; i >= 0; i--) - { + for (i = arg4; i >= 0; i--) { sp9C.x = (func_800CA720(var) * arg3) + arg2->x; sp9C.z = (func_800CA774(var) * arg3) + arg2->z; sp84.x = (Math_Rand_ZeroOne() - 0.5f) * arg5; sp84.z = (Math_Rand_ZeroOne() - 0.5f) * arg5; - if (arg6 == 0) + if (arg6 == 0) { func_8002857C(globalCtx, &sp9C, &sp90, &sp84); - else if (arg8 != 0) + } else if (arg8 != 0) { func_800286CC(globalCtx, &sp9C, &sp90, &sp84, arg6, arg7); - else + } else { func_8002865C(globalCtx, &sp9C, &sp90, &sp84, arg6, arg7); + } var += 6.28f / (arg4 + 1.0f); } } -void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s16 arg4, s16 arg5, u8 arg6) -{ +void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s16 arg4, s16 arg5, u8 arg6) { Vec3f sp94; Vec3f sp88 = { 0.0f, 0.0f, 0.0f }; Vec3f sp7C = { 0.0f, 0.3f, 0.0f }; @@ -3604,8 +3236,7 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s1 u32 var2; s32 i; - for (i = arg3; i >= 0; i--) - { + for (i = arg3; i >= 0; i--) { sp94.x = arg1->x + ((Math_Rand_ZeroOne() - 0.5f) * arg2); sp94.y = arg1->y + ((Math_Rand_ZeroOne() - 0.5f) * arg2); sp94.z = arg1->z + ((Math_Rand_ZeroOne() - 0.5f) * arg2); @@ -3613,17 +3244,16 @@ void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s1 var = (s16)((Math_Rand_ZeroOne() * arg4) * 0.2f) + arg4; var2 = arg6; - if (var2 != 0) + if (var2 != 0) { func_800286CC(globalCtx, &sp94, &sp88, &sp7C, var, arg5); - else + } else { func_8002865C(globalCtx, &sp94, &sp88, &sp7C, var, arg5); + } } } -Actor* func_80033640(GlobalContext* globalCtx, Collider* collider) -{ - if ((collider->collideFlags & 0x2) && (collider->ac->type == ACTORTYPE_EXPLOSIVES)) - { +Actor* func_80033640(GlobalContext* globalCtx, Collider* collider) { + if ((collider->collideFlags & 0x2) && (collider->ac->type == ACTORTYPE_EXPLOSIVES)) { collider->collideFlags &= ~0x2; return collider->ac; } @@ -3631,22 +3261,18 @@ Actor* func_80033640(GlobalContext* globalCtx, Collider* collider) return NULL; } -Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) -{ +Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) { Actor* actor = globalCtx->actorCtx.actorList[ACTORTYPE_EXPLOSIVES].first; - while (actor != NULL) - { - if ((actor == explosiveActor) || (actor->params != 1)) - { + while (actor != NULL) { + if ((actor == explosiveActor) || (actor->params != 1)) { actor = actor->next; - } - else - { - if (func_8002DB48(explosiveActor, actor) <= (actor->shape.rot.z * 10) + 80.0f) + } else { + if (func_8002DB48(explosiveActor, actor) <= (actor->shape.rot.z * 10) + 80.0f) { return actor; - else + } else { actor = actor->next; + } } } @@ -3657,21 +3283,18 @@ Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor) * Dynamically changes the type of a given actor instance. * This is done by moving it to the corresponding type list and setting its type variable accordingly. */ -void Actor_ChangeType(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorType) -{ +void Actor_ChangeType(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorType) { Actor_RemoveFromTypeList(globalCtx, actorCtx, actor); Actor_AddToTypeList(actorCtx, actor, actorType); } -typedef struct -{ - /* 0x000 */ Actor actor; - /* 0x14C */ char unk_14C[0xC4]; - /* 0x210 */ s16 unk_210; +typedef struct { + /* 0x000 */ Actor actor; + /* 0x14C */ char unk_14C[0xC4]; + /* 0x210 */ s16 unk_210; } Actor_80033780; -Actor_80033780* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg2) -{ +Actor_80033780* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg2) { Actor_80033780* itemActor; Vec3f spA8; f32 deltaX; @@ -3682,19 +3305,15 @@ Actor_80033780* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg Actor* actor; actor = globalCtx->actorCtx.actorList[ACTORTYPE_ITEMACTION].first; - while (actor != NULL) - { - if (((actor->id != ACTOR_ARMS_HOOK) && (actor->id != ACTOR_EN_ARROW)) || (actor == refActor)) + while (actor != NULL) { + if (((actor->id != ACTOR_ARMS_HOOK) && (actor->id != ACTOR_EN_ARROW)) || (actor == refActor)) { actor = actor->next; - else - { + } else { itemActor = (Actor_80033780*)actor; - if ((arg2 < Math_Vec3f_DistXYZ(&refActor->posRot.pos, &itemActor->actor.posRot.pos)) || (itemActor->unk_210 == 0)) - { + if ((arg2 < Math_Vec3f_DistXYZ(&refActor->posRot.pos, &itemActor->actor.posRot.pos)) || + (itemActor->unk_210 == 0)) { actor = actor->next; - } - else - { + } else { deltaX = Math_Sins(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f); deltaY = itemActor->actor.velocity.y + (itemActor->actor.gravity * 10.0f); deltaZ = Math_Coss(itemActor->actor.posRot.rot.y) * (itemActor->actor.speedXZ * 10.0f); @@ -3703,11 +3322,12 @@ Actor_80033780* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg spA8.y = itemActor->actor.posRot.pos.y + deltaY; spA8.z = itemActor->actor.posRot.pos.z + deltaZ; - if (func_80062ECC(refActor->sub_98.unk_10, refActor->sub_98.unk_12, 0.0f, - &refActor->posRot.pos, &itemActor->actor.posRot.pos, &spA8, &sp90, &sp84)) + if (func_80062ECC(refActor->sub_98.unk_10, refActor->sub_98.unk_12, 0.0f, &refActor->posRot.pos, + &itemActor->actor.posRot.pos, &spA8, &sp90, &sp84)) { return itemActor; - else + } else { actor = actor->next; + } } } } @@ -3718,12 +3338,10 @@ Actor_80033780* func_80033780(GlobalContext* globalCtx, Actor* refActor, f32 arg /** * Sets the actor's text id with a dynamic prefix based on the current scene. */ -void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTextId) -{ +void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTextId) { s16 prefix; - switch (globalCtx->sceneNum) - { + switch (globalCtx->sceneNum) { case SCENE_YDAN: case SCENE_YDAN_BOSS: case SCENE_MORIBOSSROOM: @@ -3797,8 +3415,7 @@ void Actor_SetTextWithPrefix(GlobalContext* globalCtx, Actor* actor, s16 baseTex actor->textId = prefix | baseTextId; } -s16 func_800339B8(Actor* actor, GlobalContext* globalCtx, f32 arg2, s16 arg3) -{ +s16 func_800339B8(Actor* actor, GlobalContext* globalCtx, f32 arg2, s16 arg3) { s16 ret; s16 sp44; f32 sp40; @@ -3820,36 +3437,32 @@ s16 func_800339B8(Actor* actor, GlobalContext* globalCtx, f32 arg2, s16 arg3) return ret; } -s32 func_80033A84(GlobalContext* globalCtx, Actor* actor) -{ +s32 func_80033A84(GlobalContext* globalCtx, Actor* actor) { Player* player = PLAYER; - if ((player->stateFlags1 & 0x10) && (actor->unk_10C != 0)) + if ((player->stateFlags1 & 0x10) && (actor->unk_10C != 0)) { return 1; - else + } else { return 0; + } } -s32 func_80033AB8(GlobalContext* globalCtx, Actor* actor) -{ +s32 func_80033AB8(GlobalContext* globalCtx, Actor* actor) { Player* player = PLAYER; - if ((player->stateFlags1 & 0x10) && (actor->unk_10C == 0)) + if ((player->stateFlags1 & 0x10) && (actor->unk_10C == 0)) { return 1; - else + } else { return 0; + } } -f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) -{ +f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) { f32 ret = 0.0f; - if (arg4 <= Math_Vec3f_DistXYZ(arg0, arg1)) - { + if (arg4 <= Math_Vec3f_DistXYZ(arg0, arg1)) { ret = Math_SmoothScaleMaxMinF(&arg1->x, arg0->x, arg2, arg3, 0.0f); ret += Math_SmoothScaleMaxMinF(&arg1->y, arg0->y, arg2, arg3, 0.0f); ret += Math_SmoothScaleMaxMinF(&arg1->z, arg0->z, arg2, arg3, 0.0f); - } - else if (arg5 < Math_Vec3f_DistXYZ(arg0, arg1)) - { + } else if (arg5 < Math_Vec3f_DistXYZ(arg0, arg1)) { ret = Math_SmoothScaleMaxMinF(&arg1->x, arg0->x, arg2, arg3, 0.0f); ret += Math_SmoothScaleMaxMinF(&arg1->y, arg0->y, arg2, arg3, 0.0f); ret += Math_SmoothScaleMaxMinF(&arg1->z, arg0->z, arg2, arg3, 0.0f); @@ -3858,8 +3471,7 @@ f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 ar return ret; } -void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) -{ +void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) { MtxF sp60; f32 var; Vec3f sp50; @@ -3869,7 +3481,7 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8120); - if (0) ; // Necessary to match + if (0) {} // Necessary to match gfxCtx->polyOpa.p = func_80093774(gfxCtx->polyOpa.p, 0x2C); @@ -3881,60 +3493,55 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) var = func_8003C8EC(globalCtx, &globalCtx->colCtx, &sp4C, &sp50); - if (sp4C != NULL) - { + if (sp4C != NULL) { func_80038A28(sp4C, arg0->x, var, arg0->z, &sp60); Matrix_Put(&sp60); - } - else + } else { Matrix_Translate(arg0->x, arg0->y, arg0->z, MTXMODE_NEW); + } Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8149), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8149), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, &D_04049210); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8155); } -void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2) -{ +void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2) { s16 var = func_80092F88(&globalCtx->cameraCtx.activeCameras[0], 3); func_80092DAC(var, 20000); func_80092E70(var, arg1, 0, 0, 0); func_80092DF0(var, arg2); } -void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) -{ +void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { s16 var = func_80092F88(&globalCtx->cameraCtx.activeCameras[0], 3); func_80092DAC(var, arg3); func_80092E70(var, arg1, 0, 0, 0); func_80092DF0(var, arg2); } -void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3) -{ - if (arg2 >= 5) +void func_80033E88(Actor* actor, GlobalContext* globalCtx, s16 arg2, s16 arg3) { + if (arg2 >= 5) { func_800AA000(actor->waterSurfaceDist, 0xFF, 0x14, 0x96); - else + } else { func_800AA000(actor->waterSurfaceDist, 0xB4, 0x14, 0x64); + } func_80033DB8(globalCtx, arg2, arg3); } -f32 Math_Rand_ZeroFloat(f32 f) -{ +f32 Math_Rand_ZeroFloat(f32 f) { return Math_Rand_ZeroOne() * f; } -f32 Math_Rand_CenteredFloat(f32 f) -{ +f32 Math_Rand_CenteredFloat(f32 f) { return (Math_Rand_ZeroOne() - 0.5f) * f; } -typedef struct -{ +typedef struct { /* 0x00 */ f32 unk_00; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; @@ -3944,15 +3551,13 @@ typedef struct /* 0x18 */ u32 unk_18; } struct_801160DC; // size = 0x1C -struct_801160DC D_801160DC[3] = -{ - { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, 0x050011F0, 0x05001100 }, - { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, 0x06001530, 0x06001400 }, - { 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, 0x050011F0, 0x05001100 }, +struct_801160DC D_801160DC[3] = { + { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, 0x050011F0, 0x05001100 }, + { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, 0x06001530, 0x06001400 }, + { 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, 0x050011F0, 0x05001100 }, }; -void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) -{ +void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) { struct_801160DC* entry; s32 i; MtxF spB0; @@ -3975,22 +3580,24 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) temp1 = sinf(entry->unk_00 - var) * -(10 - arg1) * 0.1f * entry->unk_04; temp2 = cosf(entry->unk_00 - var) * (10 - arg1) * 0.1f * entry->unk_04; - for (i = 0; i < 4; i++) - { + for (i = 0; i < 4; i++) { Matrix_Put(&spB0); Matrix_RotateZ(var, MTXMODE_APPLY); Matrix_Translate(temp1, temp2, 0.0f, MTXMODE_APPLY); - if (entry->unk_0C != 1.0f) + if (entry->unk_0C != 1.0f) { Matrix_Scale(entry->unk_0C, entry->unk_0C, entry->unk_0C, MTXMODE_APPLY); + } - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8299), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8299), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, entry->unk_14); - if (i % 2) + if (i % 2) { temp3 = entry->unk_00 + entry->unk_00; - else + } else { temp3 = M_PI - (entry->unk_00 + entry->unk_00); + } var += temp3; } @@ -3998,28 +3605,27 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) Matrix_Put(&spB0); Matrix_Scale(arg1 * 0.1f, arg1 * 0.1f, arg1 * 0.1f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8314), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8314), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, entry->unk_18); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8319); } -void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1) -{ +void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1) { func_80062D60(globalCtx, arg1); } -void func_8003426C(Actor* actor, s16 arg1, s16 arg2, s16 arg3, s16 arg4) -{ - if ((arg1 == 0x8000) && !(arg2 & 0x8000)) +void func_8003426C(Actor* actor, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { + if ((arg1 == 0x8000) && !(arg2 & 0x8000)) { Audio_PlayActorSound2(actor, NA_SE_EN_LIGHT_ARROW_HIT); + } actor->unk_112 = arg1 | arg3 | ((arg2 & 0xF8) << 5) | arg4; actor->unk_114 = arg4; } -Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) -{ +Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) { Vec3f lightDir; lightDir.x = globalCtx->unk_10A4E; @@ -4029,8 +3635,7 @@ Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx) return func_8002EABC(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); } -Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx) -{ +Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx) { Vec3f lightDir; lightDir.x = globalCtx->unk_10A4E; @@ -4040,91 +3645,87 @@ Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx) return func_8002EB44(object, &globalCtx->view.eye, &lightDir, globalCtx->state.gfxCtx); } -s32 func_800343CC(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 arg3, u16 (*unkFunc1)(GlobalContext*, Actor*), s16 (*unkFunc2)(GlobalContext*, Actor*)) -{ +s32 func_800343CC(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 arg3, u16 (*unkFunc1)(GlobalContext*, Actor*), + s16 (*unkFunc2)(GlobalContext*, Actor*)) { s16 sp26; s16 sp24; - if (func_8002F194(actor, globalCtx)) - { + if (func_8002F194(actor, globalCtx)) { *arg2 = 1; return 1; } - if (*arg2 != 0) - { + if (*arg2 != 0) { *arg2 = unkFunc2(globalCtx, actor); return 0; } func_8002F374(globalCtx, actor, &sp26, &sp24); - if ((sp26 < 0) || (sp26 > 0x140) || (sp24 < 0) || (sp24 > 0xF0)) + if ((sp26 < 0) || (sp26 > 0x140) || (sp24 < 0) || (sp24 > 0xF0)) { return 0; + } - if (!func_8002F2CC(actor, globalCtx, arg3)) + if (!func_8002F2CC(actor, globalCtx, arg3)) { return 0; + } actor->textId = unkFunc1(globalCtx, actor); return 0; } -typedef struct -{ - /* 0x00 */ s16 unk_00; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ s16 unk_06; - /* 0x08 */ s16 unk_08; - /* 0x0A */ s16 unk_0A; +typedef struct { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; + /* 0x06 */ s16 unk_06; + /* 0x08 */ s16 unk_08; + /* 0x0A */ s16 unk_0A; /* 0x0C */ char unk_0C[0x2]; - /* 0x0E */ s16 unk_0E; - /* 0x10 */ s16 unk_10; + /* 0x0E */ s16 unk_0E; + /* 0x10 */ s16 unk_10; /* 0x12 */ char unk_12[0x2]; - /* 0x14 */ f32 unk_14; + /* 0x14 */ f32 unk_14; /* 0x18 */ Vec3f unk_18; } struct_80034A14_arg1; -typedef struct -{ - /* 0x00 */ s16 unk_00; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ s16 unk_06; - /* 0x08 */ s16 unk_08; - /* 0x0A */ s16 unk_0A; - /* 0x0C */ u8 unk_0C; +typedef struct { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; + /* 0x06 */ s16 unk_06; + /* 0x08 */ s16 unk_08; + /* 0x0A */ s16 unk_0A; + /* 0x0C */ u8 unk_0C; } struct_80116130_0; // size = 0x10 -typedef struct -{ +typedef struct { /* 0x00 */ struct_80116130_0 sub_00; - /* 0x10 */ f32 unk_10; - /* 0x14 */ s16 unk_14; + /* 0x10 */ f32 unk_10; + /* 0x14 */ s16 unk_14; } struct_80116130; // size = 0x18 -struct_80116130 D_80116130[13] = -{ +struct_80116130 D_80116130[13] = { { { 0x2AA8, 0xF1C8, 0x18E2, 0x1554, 0x0000, 0x0000, 1 }, 170.0f, 0x3FFC }, { { 0x2AA8, 0xEAAC, 0x1554, 0x1554, 0xF8E4, 0x0E38, 1 }, 170.0f, 0x3FFC }, { { 0x31C4, 0xE390, 0x0E38, 0x0E38, 0xF1C8, 0x071C, 1 }, 170.0f, 0x3FFC }, { { 0x1554, 0xF1C8, 0x0000, 0x071C, 0xF8E4, 0x0000, 1 }, 170.0f, 0x3FFC }, { { 0x2AA8, 0xF8E4, 0x071C, 0x0E38, 0xD558, 0x2AA8, 1 }, 170.0f, 0x3FFC }, { { 0x0000, 0xE390, 0x2AA8, 0x3FFC, 0xF1C8, 0x0E38, 1 }, 170.0f, 0x3FFC }, - { { 0x2AA8, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, - { { 0x2AA8, 0xF1C8, 0x0000, 0x0E38, 0x0000, 0x1C70, 1 }, 0.0f, 0x0000 }, - { { 0x2AA8, 0xF1C8, 0xF1C8, 0x0000, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, - { { 0x071C, 0xF1C8, 0x0E38, 0x1C70, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, - { { 0x0E38, 0xF1C8, 0x0000, 0x1C70, 0x0000, 0x0E38, 1 }, 0.0f, 0x0000 }, - { { 0x2AA8, 0xE390, 0x1C70, 0x0E38, 0xF1C8, 0x0E38, 1 }, 0.0f, 0x0000 }, - { { 0x18E2, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, + { { 0x2AA8, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, + { { 0x2AA8, 0xF1C8, 0x0000, 0x0E38, 0x0000, 0x1C70, 1 }, 0.0f, 0x0000 }, + { { 0x2AA8, 0xF1C8, 0xF1C8, 0x0000, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, + { { 0x071C, 0xF1C8, 0x0E38, 0x1C70, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, + { { 0x0E38, 0xF1C8, 0x0000, 0x1C70, 0x0000, 0x0E38, 1 }, 0.0f, 0x0000 }, + { { 0x2AA8, 0xE390, 0x1C70, 0x0E38, 0xF1C8, 0x0E38, 1 }, 0.0f, 0x0000 }, + { { 0x18E2, 0xF1C8, 0x0E38, 0x0E38, 0x0000, 0x0000, 1 }, 0.0f, 0x0000 }, }; #ifdef NON_MATCHING // this function still needs a lot of work -void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, u8 arg8) -{ +void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, + u8 arg8) { s16 sp46; s16 sp44; s16 temp1; @@ -4166,25 +3767,24 @@ void func_800344BC(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3, #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800344BC.s") #endif -s16 func_800347E8(s16 arg0) -{ +s16 func_800347E8(s16 arg0) { return D_80116130[arg0].unk_14; } -s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, s16 arg4) -{ +s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, s16 arg4) { s32 pad; s16 var; s16 abs_var; - if (arg4 != 0) + if (arg4 != 0) { return arg4; + } - if (arg1->unk_00 != 0) + if (arg1->unk_00 != 0) { return 4; + } - if (arg2 < Math_Vec3f_DistXYZ(&actor->posRot.pos, &arg1->unk_18)) - { + if (arg2 < Math_Vec3f_DistXYZ(&actor->posRot.pos, &arg1->unk_18)) { arg1->unk_04 = 0; arg1->unk_06 = 0; return 1; @@ -4192,18 +3792,17 @@ s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, var = Math_Vec3f_Yaw(&actor->posRot.pos, &arg1->unk_18); abs_var = ABS((s16)((f32)var - actor->shape.rot.y)); - if (arg3 >= abs_var) - { + if (arg3 >= abs_var) { arg1->unk_04 = 0; arg1->unk_06 = 0; return 2; } - if (DECR(arg1->unk_04) != 0) + if (DECR(arg1->unk_04) != 0) { return arg1->unk_02; + } - switch (arg1->unk_06) - { + switch (arg1->unk_06) { case 0: case 2: arg1->unk_04 = Math_Rand_S16Offset(30, 30); @@ -4218,16 +3817,14 @@ s16 func_80034810(Actor* actor, struct_80034A14_arg1* arg1, f32 arg2, s16 arg3, return 4; } -void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3) -{ +void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3) { struct_80116130_0 sp38; arg1->unk_02 = func_80034810(actor, arg1, D_80116130[arg2].unk_10, D_80116130[arg2].unk_14, arg3); sp38 = D_80116130[arg2].sub_00; - switch (arg1->unk_02) - { + switch (arg1->unk_02) { case 1: sp38.unk_00 = 0; sp38.unk_04 = 0; @@ -4240,12 +3837,11 @@ void func_80034A14(Actor* actor, struct_80034A14_arg1* arg1, s16 arg2, s16 arg3) sp38.unk_0C = 0; } - func_800344BC(actor, arg1, sp38.unk_00, sp38.unk_04, sp38.unk_02, - sp38.unk_06, sp38.unk_0A, sp38.unk_08, sp38.unk_0C); + func_800344BC(actor, arg1, sp38.unk_00, sp38.unk_04, sp38.unk_02, sp38.unk_06, sp38.unk_0A, sp38.unk_08, + sp38.unk_0C); } -Gfx* func_80034B28(GraphicsContext* gfxCtx) -{ +Gfx* func_80034B28(GraphicsContext* gfxCtx) { Gfx* displayList; displayList = Graph_Alloc(gfxCtx, sizeof(Gfx)); @@ -4256,8 +3852,7 @@ Gfx* func_80034B28(GraphicsContext* gfxCtx) #ifdef NON_MATCHING // doesn't generate the 2 useless move instructions before returning -Gfx* func_80034B54(GraphicsContext* gfxCtx) -{ +Gfx* func_80034B54(GraphicsContext* gfxCtx) { Gfx* displayList; Gfx* displayListHead; @@ -4265,10 +3860,10 @@ Gfx* func_80034B54(GraphicsContext* gfxCtx) displayListHead = displayList; gDPSetRenderMode(displayListHead++, - AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | - GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA), - AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); + AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA), + AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)); gSPEndDisplayList(displayListHead); @@ -4278,8 +3873,8 @@ Gfx* func_80034B54(GraphicsContext* gfxCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_80034B54.s") #endif -void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, s16 alpha) -{ +void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, + s16 alpha) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -4292,14 +3887,14 @@ void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc gDPPipeSync(gfxCtx->polyOpa.p++); gSPSegment(gfxCtx->polyOpa.p++, 0x0C, func_80034B28(globalCtx->state.gfxCtx)); - gfxCtx->polyOpa.p = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, - skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyOpa.p); + gfxCtx->polyOpa.p = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, + unkFunc1, unkFunc2, actor, gfxCtx->polyOpa.p); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8860); } -void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, s16 alpha) -{ +void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, + s16 alpha) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -4311,29 +3906,26 @@ void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x00, 0x00, 0x00, alpha); gSPSegment(gfxCtx->polyXlu.p++, 0x0C, func_80034B54(globalCtx->state.gfxCtx)); - gfxCtx->polyXlu.p = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, - skelAnime->dListCount, unkFunc1, unkFunc2, actor, gfxCtx->polyXlu.p); + gfxCtx->polyXlu.p = func_800A273C(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, + unkFunc1, unkFunc2, actor, gfxCtx->polyXlu.p); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_actor.c", 8904); } -s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) -{ +s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { Player* player = PLAYER; f32 var; - if ((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) + if ((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) { var = Math_Vec3f_DistXYZ(&actor->posRot.pos, &globalCtx->view.eye) * 0.25f; - else + } else { var = Math_Vec3f_DistXYZ(&actor->posRot.pos, &player->actor.posRot.pos); + } - if (arg3 < var) - { + if (arg3 < var) { actor->flags &= ~1; Math_SmoothScaleMaxMinS(&arg2, 0, 6, 0x14, 1); - } - else - { + } else { actor->flags |= 1; Math_SmoothScaleMaxMinS(&arg2, 0xFF, 6, 0x14, 1); } @@ -4341,67 +3933,53 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) return arg2; } -void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* arg1, s32 arg2) -{ +void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* arg1, s32 arg2) { f32 frameCount; arg1 += arg2; - if (arg1->frameCount > 0.0f) + if (arg1->frameCount > 0.0f) { frameCount = arg1->frameCount; - else + } else { frameCount = SkelAnime_GetFrameCount(arg1->animation); + } - SkelAnime_ChangeAnimation(skelAnime, arg1->animation, arg1->playbackSpeed, - arg1->unk_08, frameCount, arg1->unk_10, arg1->transitionRate); + SkelAnime_ChangeAnimation(skelAnime, arg1->animation, arg1->playbackSpeed, arg1->unk_08, frameCount, arg1->unk_10, + arg1->transitionRate); } -void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) -{ +void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) { u32 frames = globalCtx->gameplayFrames; s32 i; - for (i = 0; i < arg3; i++) - { + for (i = 0; i < arg3; i++) { arg1[i] = (0x814 + 50 * i) * frames; arg2[i] = (0x940 + 50 * i) * frames; } } -void Actor_Noop(Actor* actor, GlobalContext* globalCtx) -{ - +void Actor_Noop(Actor* actor, GlobalContext* globalCtx) { } -s32 func_80035124(Actor* actor, GlobalContext* globalCtx) -{ +s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { s32 ret = 0; - switch (actor->params) - { + switch (actor->params) { case 0: - if (func_8002F410(actor, globalCtx)) - { + if (func_8002F410(actor, globalCtx)) { actor->params = 1; - } - else if (!(actor->bgCheckFlags & 1)) - { + } else if (!(actor->bgCheckFlags & 1)) { Actor_MoveForward(actor); Math_SmoothScaleMaxMinF(&actor->speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); - } - else if ((actor->bgCheckFlags & 2) && (actor->velocity.y < -4.0f)) - { + } else if ((actor->bgCheckFlags & 2) && (actor->velocity.y < -4.0f)) { ret = 1; - } - else - { + } else { actor->shape.rot.x = actor->shape.rot.z = 0; func_8002F580(actor, globalCtx); } break; case 1: - if (func_8002F5A0(actor, globalCtx)) - { + if (func_8002F5A0(actor, globalCtx)) { actor->params = 0; } break; @@ -4414,8 +3992,7 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) #include "z_cheap_proc.c" -u8 func_800353E8(GlobalContext* globalCtx) -{ +u8 func_800353E8(GlobalContext* globalCtx) { Player* player = PLAYER; return player->unk_845; } @@ -4424,30 +4001,25 @@ u8 func_800353E8(GlobalContext* globalCtx) * Finds the first actor instance of a specified id and type within a given range from an actor if there is one. * If the id provided is -1, this will look for any actor of the specified type rather than a specific id. */ -Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorType, f32 range) -{ +Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorType, f32 range) { Actor* actor = globalCtx->actorCtx.actorList[actorType].first; - while (actor != NULL) - { - if (actor == refActor || ((actorId != -1) && (actorId != actor->id))) - { + while (actor != NULL) { + if (actor == refActor || ((actorId != -1) && (actorId != actor->id))) { actor = actor->next; - } - else - { - if (func_8002DB48(refActor, actor) <= range) + } else { + if (func_8002DB48(refActor, actor) <= range) { return actor; - else + } else { actor = actor->next; + } } } return NULL; } -s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) -{ +s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) { Player* player = PLAYER; s16 var1; s16 var2; @@ -4455,15 +4027,15 @@ s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s var1 = (s16)(actor->rotTowardsLinkY + 0x8000) - player->actor.shape.rot.y; var2 = actor->rotTowardsLinkY - arg5; - if ((actor->xzDistanceFromLink <= range) && (player->swordState != 0) && - (arg4 >= ABS(var1)) && (arg3 >= ABS(var2))) + if ((actor->xzDistanceFromLink <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && + (arg3 >= ABS(var2))) { return 1; - else + } else { return 0; + } } -void func_8003555C(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) -{ +void func_8003555C(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) { Color_RGB8 color1; Color_RGB8 color2; @@ -4482,150 +4054,107 @@ Vec3f D_80116268 = { 0.0f, -1.5f, 0.0f }; Vec3f D_80116274 = { 0.0f, -0.2f, 0.0f }; // unused -Gfx D_80116280[] = -{ - gsDPSetRenderMode(AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | - CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | - GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA), - AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | - CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)), +Gfx D_80116280[] = { + gsDPSetRenderMode(AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA), + AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)), gsDPSetAlphaCompare(G_AC_THRESHOLD), gsSPEndDisplayList(), }; -void func_800355B8(GlobalContext* globalCtx, Vec3f* arg1) -{ +void func_800355B8(GlobalContext* globalCtx, Vec3f* arg1) { func_8003555C(globalCtx, arg1, &D_80116268, &D_80116274); } -u8 func_800355E4(GlobalContext* globalCtx, ColliderCylinderInit* colCylinderInit) -{ +u8 func_800355E4(GlobalContext* globalCtx, ColliderCylinderInit* colCylinderInit) { Player* player = PLAYER; - if ((colCylinderInit->inner.toucherDamage & 0x08) && (player->swordState != 0) && (player->swordAnimation == 0x16)) + if ((colCylinderInit->inner.toucherDamage & 0x08) && (player->swordState != 0) && + (player->swordAnimation == 0x16)) { return 1; - else + } else { return 0; + } } -u8 Actor_ApplyDamage(Actor* actor) -{ - if (actor->sub_98.damage >= actor->sub_98.health) +u8 Actor_ApplyDamage(Actor* actor) { + if (actor->sub_98.damage >= actor->sub_98.health) { actor->sub_98.health = 0; - else + } else { actor->sub_98.health -= actor->sub_98.damage; + } return actor->sub_98.health; } -void func_80035650(Actor* actor, ColliderBody* colBody, s32 freezeFlag) -{ - if (colBody->colliding == NULL) - { +void func_80035650(Actor* actor, ColliderBody* colBody, s32 freezeFlag) { + if (colBody->colliding == NULL) { actor->unk_116 = 0x00; - } - else if (freezeFlag && (colBody->colliding->toucher.flags & 0x10060000)) - { + } else if (freezeFlag && (colBody->colliding->toucher.flags & 0x10060000)) { actor->freeze = colBody->colliding->toucher.damage; actor->unk_116 = 0x00; - } - else if (colBody->colliding->toucher.flags & 0x0800) - { + } else if (colBody->colliding->toucher.flags & 0x0800) { actor->unk_116 = 0x01; - } - else if (colBody->colliding->toucher.flags & 0x1000) - { + } else if (colBody->colliding->toucher.flags & 0x1000) { actor->unk_116 = 0x02; - } - else if (colBody->colliding->toucher.flags & 0x4000) - { + } else if (colBody->colliding->toucher.flags & 0x4000) { actor->unk_116 = 0x04; - } - else if (colBody->colliding->toucher.flags & 0x8000) - { + } else if (colBody->colliding->toucher.flags & 0x8000) { actor->unk_116 = 0x08; - } - else if ((colBody->colliding->toucher.flags << 0xF) < 0) - { + } else if ((colBody->colliding->toucher.flags << 0xF) < 0) { actor->unk_116 = 0x10; - } - else if (colBody->colliding->toucher.flags & 0x2000) - { + } else if (colBody->colliding->toucher.flags & 0x2000) { actor->unk_116 = 0x20; - } - else if ((colBody->colliding->toucher.flags << 0xC) < 0) - { - if (freezeFlag) + } else if ((colBody->colliding->toucher.flags << 0xC) < 0) { + if (freezeFlag) { actor->freeze = colBody->colliding->toucher.damage; + } actor->unk_116 = 0x40; - } - else - { + } else { actor->unk_116 = 0x00; } } -void func_8003573C(Actor* actor, ColliderBody* colBody, s32 freezeFlag) -{ +void func_8003573C(Actor* actor, ColliderBody* colBody, s32 freezeFlag) { ColliderBody* curColBody; s32 flag; s32 i; actor->unk_116 = 0x00; - for (i = colBody->unk_18 - 1; i >= 0; i--) - { + for (i = colBody->unk_18 - 1; i >= 0; i--) { curColBody = &colBody->colBuf[i].c; - if (curColBody->colliding == NULL) - { + if (curColBody->colliding == NULL) { flag = 0x00; - } - else if (freezeFlag && (curColBody->colliding->toucher.flags & 0x10060000)) - { + } else if (freezeFlag && (curColBody->colliding->toucher.flags & 0x10060000)) { actor->freeze = curColBody->colliding->toucher.damage; flag = 0x00; - } - else if (curColBody->colliding->toucher.flags & 0x0800) - { + } else if (curColBody->colliding->toucher.flags & 0x0800) { flag = 0x01; - } - else if (curColBody->colliding->toucher.flags & 0x1000) - { + } else if (curColBody->colliding->toucher.flags & 0x1000) { flag = 0x02; - } - else if (curColBody->colliding->toucher.flags & 0x4000) - { + } else if (curColBody->colliding->toucher.flags & 0x4000) { flag = 0x04; - } - else if (curColBody->colliding->toucher.flags & 0x8000) - { + } else if (curColBody->colliding->toucher.flags & 0x8000) { flag = 0x08; - } - else if (curColBody->colliding->toucher.flags & 0x10000) - { + } else if (curColBody->colliding->toucher.flags & 0x10000) { flag = 0x10; - } - else if (curColBody->colliding->toucher.flags & 0x2000) - { + } else if (curColBody->colliding->toucher.flags & 0x2000) { flag = 0x20; - } - else if (curColBody->colliding->toucher.flags & 0x80000) - { - if (freezeFlag) + } else if (curColBody->colliding->toucher.flags & 0x80000) { + if (freezeFlag) { actor->freeze = curColBody->colliding->toucher.damage; + } flag = 0x40; - } - else - { + } else { flag = 0x00; } actor->unk_116 |= flag; } } -void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3) -{ +void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3) { f32 dx = arg1->x - arg0->x; f32 dz = arg1->z - arg0->z; f32 dy = arg3 ? (arg1->y - arg0->y) : (arg0->y - arg1->y); @@ -4637,17 +4166,14 @@ void func_80035844(Vec3f* arg0, Vec3f* arg1, s16* arg2, s32 arg3) /** * Spawns En_Part (Dissipating Flames) actor attached to the given actor. */ -ActorEnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, Vec3f* arg3, s32 arg4, - s32 unused, GlobalContext* globalCtx, s16 params, s32 arg8) -{ +ActorEnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, Vec3f* arg3, s32 arg4, s32 unused, + GlobalContext* globalCtx, s16 params, s32 arg8) { ActorEnPart* spawnedEnPart; spawnedEnPart = (ActorEnPart*)Actor_SpawnAttached(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, - spawnPos->x, spawnPos->y, spawnPos->z, - spawnRot->x, spawnRot->y, actor->objBankIndex, - params); - if (spawnedEnPart != NULL) - { + spawnPos->x, spawnPos->y, spawnPos->z, spawnRot->x, spawnRot->y, + actor->objBankIndex, params); + if (spawnedEnPart != NULL) { spawnedEnPart->actor.scale = actor->scale; spawnedEnPart->actor.speedXZ = arg3->x; spawnedEnPart->unk_150 = arg8; @@ -4661,8 +4187,7 @@ ActorEnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, Vec3f return NULL; } -void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) -{ +void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) { f32 sp44; f32 sp40; f32 sp3C; @@ -4675,8 +4200,7 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) CollisionPoly* floorPoly; s32 pad; - if (actor->floorPoly != NULL) - { + if (actor->floorPoly != NULL) { floorPoly = actor->floorPoly; sp44 = floorPoly->norm.x * (1.f / 32767); sp40 = floorPoly->norm.y * (1.f / 32767); @@ -4694,8 +4218,7 @@ void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) } } -void func_80035B18(GlobalContext* globalCtx, Actor* actor, u16 textId) -{ +void func_80035B18(GlobalContext* globalCtx, Actor* actor, u16 textId) { func_8010B720(globalCtx, textId); actor->textId = textId; } @@ -4703,496 +4226,458 @@ void func_80035B18(GlobalContext* globalCtx, Actor* actor, u16 textId) /** * Tests if event_chk_inf flag is set. */ -s32 Flags_GetEventChkInf(s32 flag) -{ +s32 Flags_GetEventChkInf(s32 flag) { return gSaveContext.event_chk_inf[flag >> 4] & (1 << (flag & 0xF)); } /** * Sets event_chk_inf flag. */ -void Flags_SetEventChkInf(s32 flag) -{ +void Flags_SetEventChkInf(s32 flag) { gSaveContext.event_chk_inf[flag >> 4] |= (1 << (flag & 0xF)); } /** * Tests if inf_table flag is set. */ -s32 Flags_GetInfTable(s32 flag) -{ +s32 Flags_GetInfTable(s32 flag) { return gSaveContext.inf_table[flag >> 4] & (1 << (flag & 0xF)); } /** * Sets inf_table flag. */ -void Flags_SetInfTable(s32 flag) -{ +void Flags_SetInfTable(s32 flag) { gSaveContext.inf_table[flag >> 4] |= (1 << (flag & 0xF)); } -u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) -{ +u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) { u16 retTextId = 0; - switch(arg1) - { + switch (arg1) { case 0: - if (Flags_GetEventChkInf(0x9)) - { - if (Flags_GetInfTable(0x5)) + if (Flags_GetEventChkInf(0x9)) { + if (Flags_GetInfTable(0x5)) { retTextId = 0x1048; - else + } else { retTextId = 0x1047; - } - else - { - if (Flags_GetEventChkInf(0x2)) - { - if (Flags_GetInfTable(0x3)) - retTextId = 0x1032; - else - retTextId = 0x1031; } - else - { - if (Flags_GetInfTable(0x0)) - { - if (Flags_GetInfTable(0x1)) - retTextId = 0x1003; - else - retTextId = 0x1002; + } else { + if (Flags_GetEventChkInf(0x2)) { + if (Flags_GetInfTable(0x3)) { + retTextId = 0x1032; + } else { + retTextId = 0x1031; } - else + } else { + if (Flags_GetInfTable(0x0)) { + if (Flags_GetInfTable(0x1)) { + retTextId = 0x1003; + } else { + retTextId = 0x1002; + } + } else { retTextId = 0x1001; + } } } break; case 1: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) - { - if (Flags_GetInfTable(0x10)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { + if (Flags_GetInfTable(0x10)) { retTextId = 0x1046; - else + } else { retTextId = 0x1045; - } - else - { - if (Flags_GetEventChkInf(0x3)) - { - if (Flags_GetInfTable(0xE)) + } + } else { + if (Flags_GetEventChkInf(0x3)) { + if (Flags_GetInfTable(0xE)) { retTextId = 0x1034; - else + } else { retTextId = 0x1033; - } - else - { - if (Flags_GetInfTable(0xC)) + } + } else { + if (Flags_GetInfTable(0xC)) { retTextId = 0x1030; - else + } else { retTextId = 0x102F; + } } } - } - else - { - if (Flags_GetEventChkInf(0x5C)) - { - if (Flags_GetInfTable(0x19)) + } else { + if (Flags_GetEventChkInf(0x5C)) { + if (Flags_GetInfTable(0x19)) { retTextId = 0x1071; - else + } else { retTextId = 0x1070; - } - else - { - if (Flags_GetEventChkInf(0xB)) - { - if (Flags_GetInfTable(0x17)) - retTextId = 0x1068; - else - retTextId = 0x1067; } - else - { - if (Flags_GetInfTable(0x15)) + } else { + if (Flags_GetEventChkInf(0xB)) { + if (Flags_GetInfTable(0x17)) { + retTextId = 0x1068; + } else { + retTextId = 0x1067; + } + } else { + if (Flags_GetInfTable(0x15)) { retTextId = 0x1061; - else + } else { retTextId = 0x1060; + } } } } break; case 2: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1042; - else + } else { retTextId = 0x1004; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1072; - else if (Flags_GetInfTable(0x41)) + } else if (Flags_GetInfTable(0x41)) { retTextId = 0x1055; - else + } else { retTextId = 0x1056; + } } break; case 3: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1043; - else - { - if (Flags_GetInfTable(0x1E)) + } else { + if (Flags_GetInfTable(0x1E)) { retTextId = 0x1006; - else + } else { retTextId = 0x1005; + } } - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1073; - else + } else { retTextId = 0x105A; + } } break; case 4: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1042; - else + } else { retTextId = 0x1007; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1072; - else if (Flags_GetInfTable(0x47)) + } else if (Flags_GetInfTable(0x47)) { retTextId = 0x105E; - else + } else { retTextId = 0x105D; + } } break; case 5: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1044; - else if (Flags_GetInfTable(0x22)) + } else if (Flags_GetInfTable(0x22)) { retTextId = 0x1009; - else + } else { retTextId = 0x1008; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1075; - else + } else { retTextId = 0x105B; + } } break; case 6: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1042; - else if (Flags_GetInfTable(0x24)) + } else if (Flags_GetInfTable(0x24)) { retTextId = 0x100B; - else + } else { retTextId = 0x100A; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1056; - else + } else { retTextId = 0x105F; + } } break; case 7: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1043; - else if (Flags_GetInfTable(0x26)) + } else if (Flags_GetInfTable(0x26)) { retTextId = 0x100D; - else + } else { retTextId = 0x100C; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1057; - else + } else { retTextId = 0x1057; + } } break; case 8: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1043; - else if (Flags_GetInfTable(0x28)) + } else if (Flags_GetInfTable(0x28)) { retTextId = 0x1019; - else + } else { retTextId = 0x100E; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1077; - else if (Flags_GetInfTable(0x51)) + } else if (Flags_GetInfTable(0x51)) { retTextId = 0x1058; - else + } else { retTextId = 0x1059; + } } break; case 9: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x1049; - else + } else { retTextId = 0x1035; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1079; - else + } else { retTextId = 0x104e; + } } break; case 10: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x104A; - else + } else { retTextId = 0x1038; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1079; - else if (Flags_GetInfTable(0x59)) + } else if (Flags_GetInfTable(0x59)) { retTextId = 0x1050; - else + } else { retTextId = 0x104F; + } } break; case 11: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x104B; - else + } else { retTextId = 0x103C; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x107b; - else + } else { retTextId = 0x1051; + } } break; case 12: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x104C; - else + } else { retTextId = 0x103D; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x107C; - else + } else { retTextId = 0x1052; + } } break; case 13: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x9)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x9)) { retTextId = 0x104D; - else + } else { retTextId = 0x103E; - } - else - { - if (Flags_GetEventChkInf(0x5C)) + } + } else { + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x106E; - else if (Flags_GetInfTable(0x61)) + } else if (Flags_GetInfTable(0x61)) { retTextId = 0x1053; - else + } else { retTextId = 0x1054; + } } break; case 15: - if (Flags_GetEventChkInf(0x5C)) + if (Flags_GetEventChkInf(0x5C)) { retTextId = 0x1078; - else if (Flags_GetInfTable(0x66)) + } else if (Flags_GetInfTable(0x66)) { retTextId = 0x1066; - else + } else { retTextId = 0x1062; + } break; case 16: - if (globalCtx->sceneNum == SCENE_SPOT15) + if (globalCtx->sceneNum == SCENE_SPOT15) { retTextId = 0x7002; - else if (Flags_GetInfTable(0x6A)) + } else if (Flags_GetInfTable(0x6A)) { retTextId = 0x7004; - else if ((gSaveContext.day_time >= 0x4000) && (gSaveContext.day_time < 0xC556)) + } else if ((gSaveContext.day_time >= 0x4000) && (gSaveContext.day_time < 0xC556)) { retTextId = 0x7002; - else + } else { retTextId = 0x7003; + } break; case 17: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) - { - if (Flags_GetInfTable(0x6c)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { + if (Flags_GetInfTable(0x6c)) { retTextId = 0x7008; - else + } else { retTextId = 0x7007; - } - else + } + } else { retTextId = 0; + } break; case 19: retTextId = 0x702D; break; case 18: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7006; - else - { - if (Flags_GetEventChkInf(0x12)) - { - if (Flags_GetInfTable(0x71)) + } else { + if (Flags_GetEventChkInf(0x12)) { + if (Flags_GetInfTable(0x71)) { retTextId = 0x7072; - else + } else { retTextId = 0x7071; - } - else + } + } else { retTextId = 0x7029; + } } break; case 20: case 21: - if (Flags_GetEventChkInf(0x42)) + if (Flags_GetEventChkInf(0x42)) { retTextId = 0x2012; - else if (Flags_GetEventChkInf(0x41)) - { - if (Flags_GetInfTable(0x76)) + } else if (Flags_GetEventChkInf(0x41)) { + if (Flags_GetInfTable(0x76)) { retTextId = 0x2011; - else + } else { retTextId = 0x2010; - } - else if (Flags_GetEventChkInf(0x40)) + } + } else if (Flags_GetEventChkInf(0x40)) { retTextId = 0x200F; - else + } else { retTextId = 0x200E; + } break; case 24: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7044; - else + } else { retTextId = 0x7015; + } break; case 25: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7045; - else - { + } else { Flags_GetInfTable(0xC2); retTextId = 0x7016; } break; case 26: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7046; - else - { + } else { Flags_GetInfTable(0xc2); retTextId = 0x7018; } break; case 27: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7047; - else if (Flags_GetEventChkInf(0x14)) + } else if (Flags_GetEventChkInf(0x14)) { retTextId = 0x701A; - else if (Flags_GetEventChkInf(0x11)) - { - if (Flags_GetInfTable(0xC6)) + } else if (Flags_GetEventChkInf(0x11)) { + if (Flags_GetInfTable(0xC6)) { retTextId = 0x701C; - else + } else { retTextId = 0x701B; - } - else + } + } else { retTextId = 0x701A; + } break; case 28: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7048; - else - { + } else { Flags_GetInfTable(0xca); retTextId = 0x701D; } break; case 29: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x7049; - else - { + } else { Flags_GetInfTable(0xcc); retTextId = 0x701F; } break; case 30: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x704A; - else - { + } else { Flags_GetInfTable(0xCE); retTextId = 0x7021; } break; case 31: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x704B; - else - { + } else { Flags_GetInfTable(0xD0); retTextId = 0x7023; } break; case 32: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x704C; - else - { + } else { Flags_GetInfTable(0xD2); retTextId = 0x7025; } break; case 33: - if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x9) && Flags_GetEventChkInf(0x25) && Flags_GetEventChkInf(0x37)) { retTextId = 0x704D; - else - { + } else { Flags_GetInfTable(0xD4); retTextId = 0x7027; } @@ -5202,213 +4687,212 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) retTextId = 0x403C; break; case 35: - if (Flags_GetInfTable(0xD8)) + if (Flags_GetInfTable(0xD8)) { retTextId = 0x5029; - else + } else { retTextId = 0x5028; + } break; case 37: retTextId = 0x5002; break; case 38: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x25)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x25)) { retTextId = 0x3027; - else if (Flags_GetEventChkInf(0x23)) + } else if (Flags_GetEventChkInf(0x23)) { retTextId = 0x3021; - else if (Flags_GetInfTable(0xE0)) + } else if (Flags_GetInfTable(0xE0)) { retTextId = 0x302A; - else + } else { retTextId = 0x3008; - } - else - { - if (Flags_GetEventChkInf(0x20)) + } + } else { + if (Flags_GetEventChkInf(0x20)) { retTextId = 0x4043; - else + } else { retTextId = 0x302A; + } } break; case 39: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x25)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x25)) { retTextId = 0x3027; - else if (Flags_GetEventChkInf(0x23)) + } else if (Flags_GetEventChkInf(0x23)) { retTextId = 0x3026; - else + } else { retTextId = 0x3009; - } - else - { - if (Flags_GetEventChkInf(0x2A)) + } + } else { + if (Flags_GetEventChkInf(0x2A)) { retTextId = 0x4043; - else + } else { retTextId = 0x302A; + } } break; case 40: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x25)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x25)) { retTextId = 0x3027; - else if (Flags_GetEventChkInf(0x23)) + } else if (Flags_GetEventChkInf(0x23)) { retTextId = 0x3026; - else if (Flags_GetInfTable(0xEB)) + } else if (Flags_GetInfTable(0xEB)) { retTextId = 0x302B; - else + } else { retTextId = 0x300A; - } - else - { - if (Flags_GetEventChkInf(0x2B)) + } + } else { + if (Flags_GetEventChkInf(0x2B)) { retTextId = 0x4043; - else + } else { retTextId = 0x302A; + } } break; case 41: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x25)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x25)) { retTextId = 0x3027; - else if (Flags_GetInfTable(0xF0)) + } else if (Flags_GetInfTable(0xF0)) { retTextId = 0x3015; - else + } else { retTextId = 0x3014; - } - else - { - if (Flags_GetEventChkInf(0x2C)) + } + } else { + if (Flags_GetEventChkInf(0x2C)) { retTextId = 0x4043; - else + } else { retTextId = 0x302A; + } } break; case 42: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x25)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x25)) { retTextId = 0x3027; - else if (Flags_GetInfTable(0xF4)) + } else if (Flags_GetInfTable(0xF4)) { retTextId = 0x3017; - else + } else { retTextId = 0x3016; - } - else - { - if (Flags_GetEventChkInf(0x2C)) + } + } else { + if (Flags_GetEventChkInf(0x2C)) { retTextId = 0x4043; - else + } else { retTextId = 0x302A; + } } break; case 43: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x25)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x25)) { retTextId = 0x3027; - else if (Flags_GetInfTable(0xF8)) + } else if (Flags_GetInfTable(0xF8)) { retTextId = 0x3019; - else + } else { retTextId = 0x3018; - } - else - { - if (Flags_GetEventChkInf(0x2D)) + } + } else { + if (Flags_GetEventChkInf(0x2D)) { retTextId = 0x4043; - else + } else { retTextId = 0x302A; + } } break; case 48: - if (Flags_GetEventChkInf(0x25)) + if (Flags_GetEventChkInf(0x25)) { retTextId = 0x3029; - else if (Flags_GetEventChkInf(0x20) && Flags_GetEventChkInf(0x21)) + } else if (Flags_GetEventChkInf(0x20) && Flags_GetEventChkInf(0x21)) { retTextId = 0x301B; - else + } else { retTextId = 0x301A; + } break; case 49: - if (Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x37)) { retTextId = 0x402D; - else if (Flags_GetEventChkInf(0x30)) + } else if (Flags_GetEventChkInf(0x30)) { retTextId = 0x4007; - else + } else { retTextId = 0x4006; + } break; case 50: - if (Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x37)) { retTextId = 0x402E; - else if (Flags_GetEventChkInf(0x30)) - { - if (Flags_GetInfTable(0x124)) + } else if (Flags_GetEventChkInf(0x30)) { + if (Flags_GetInfTable(0x124)) { retTextId = 0x4009; - else + } else { retTextId = 0x4008; - } - else + } + } else { retTextId = 0x4006; + } break; case 51: - if (Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x37)) { retTextId = 0x402D; - else if (Flags_GetEventChkInf(0x31)) - { - if (Flags_GetInfTable(0x12A)) + } else if (Flags_GetEventChkInf(0x31)) { + if (Flags_GetInfTable(0x12A)) { retTextId = 0x400B; - else + } else { retTextId = 0x402F; - } - else if (Flags_GetEventChkInf(0x30)) + } + } else if (Flags_GetEventChkInf(0x30)) { retTextId = 0x400A; - else + } else { retTextId = 0x4006; + } break; case 52: - if (Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x37)) { retTextId = 0x402E; - else if (Flags_GetEventChkInf(0x30)) + } else if (Flags_GetEventChkInf(0x30)) { retTextId = 0x400C; - else + } else { retTextId = 0x4006; + } break; case 53: - if (Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x37)) { retTextId = 0x402D; - else if (Flags_GetEventChkInf(0x33)) + } else if (Flags_GetEventChkInf(0x33)) { retTextId = 0x4010; - else if (Flags_GetEventChkInf(0x30)) + } else if (Flags_GetEventChkInf(0x30)) { retTextId = 0x400F; - else + } else { retTextId = 0x4006; + } break; case 54: - if (Flags_GetEventChkInf(0x37)) + if (Flags_GetEventChkInf(0x37)) { retTextId = 0x402E; - else if (Flags_GetEventChkInf(0x30)) + } else if (Flags_GetEventChkInf(0x30)) { retTextId = 0x4011; - else + } else { retTextId = 0x4006; + } break; case 55: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x37)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x37)) { retTextId = 0x402B; - else if (Flags_GetEventChkInf(0x31)) - { - if (Flags_GetInfTable(0x138)) + } else if (Flags_GetEventChkInf(0x31)) { + if (Flags_GetInfTable(0x138)) { retTextId = 0x401C; - else + } else { retTextId = 0x401B; - } - else + } + } else { retTextId = 0x401A; - } - else + } + } else { retTextId = 0; + } break; case 58: retTextId = 0x500F; @@ -5420,79 +4904,77 @@ u32 func_80035BFC(GlobalContext* globalCtx, s16 arg1) retTextId = 0x5012; break; case 61: - if (Flags_GetInfTable(0x166)) + if (Flags_GetInfTable(0x166)) { retTextId = 0x5001; - else + } else { retTextId = 0x5000; + } break; case 62: retTextId = 0x5012; break; case 63: - if (Flags_GetInfTable(0x16A)) + if (Flags_GetInfTable(0x16A)) { retTextId = 0x5001; - else + } else { retTextId = 0x5000; + } break; case 71: - if (Flags_GetEventChkInf(0x16)) + if (Flags_GetEventChkInf(0x16)) { retTextId = 0x2049; - else if (Flags_GetEventChkInf(0x15)) + } else if (Flags_GetEventChkInf(0x15)) { retTextId = 0x2048; - else if (Flags_GetEventChkInf(0x14)) + } else if (Flags_GetEventChkInf(0x14)) { retTextId = 0x2047; - else if (Flags_GetEventChkInf(0x12) && !Flags_GetEventChkInf(0x14)) + } else if (Flags_GetEventChkInf(0x12) && !Flags_GetEventChkInf(0x14)) { retTextId = 0x2044; - else if (Flags_GetEventChkInf(0x10)) - { - if (Flags_GetEventChkInf(0x11)) + } else if (Flags_GetEventChkInf(0x10)) { + if (Flags_GetEventChkInf(0x11)) { retTextId = 0x2043; - else + } else { retTextId = 0x2042; - } - else + } + } else { retTextId = 0x2041; + } break; case 72: - if (LINK_IS_CHILD) - { - if (Flags_GetEventChkInf(0x14)) + if (LINK_IS_CHILD) { + if (Flags_GetEventChkInf(0x14)) { retTextId = 0x2040; - else if (Flags_GetInfTable(0x94)) + } else if (Flags_GetInfTable(0x94)) { retTextId = 0x2040; - else + } else { retTextId = 0x203F; - } - else - { - if (!Flags_GetEventChkInf(0x18)) - { - if (gSaveContext.night_flag) - retTextId = 0x204E; - else if (Flags_GetInfTable(0x9A)) - retTextId = 0x2031; - else - retTextId = 0x2030; } - else + } else { + if (!Flags_GetEventChkInf(0x18)) { + if (gSaveContext.night_flag) { + retTextId = 0x204E; + } else if (Flags_GetInfTable(0x9A)) { + retTextId = 0x2031; + } else { + retTextId = 0x2030; + } + } else { retTextId = 0; + } } break; } - if (retTextId == 0) + if (retTextId == 0) { retTextId = 1; + } return retTextId; } -void func_80036E50(u16 textId, s16 arg1) -{ - switch (arg1) - { +void func_80036E50(u16 textId, s16 arg1) { + switch (arg1) { case 0: - switch (textId) - { + switch (textId) { case 0x1001: Flags_SetInfTable(0x0); return; @@ -5509,14 +4991,14 @@ void func_80036E50(u16 textId, s16 arg1) } return; case 1: - switch (textId) - { + switch (textId) { case 0x102F: Flags_SetEventChkInf(0x2); Flags_SetInfTable(0xC); return; case 0x1033: - Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); Flags_SetEventChkInf(0x4); Flags_SetInfTable(0xE); return; @@ -5536,132 +5018,160 @@ void func_80036E50(u16 textId, s16 arg1) } return; case 2: - if (textId == 0x1056) + if (textId == 0x1056) { Flags_SetInfTable(0x41); + } return; case 3: - if (textId == 0x1005) + if (textId == 0x1005) { Flags_SetInfTable(0x1E); + } return; case 4: - if (textId == 0x105D) + if (textId == 0x105D) { Flags_SetInfTable(0x47); + } return; case 5: - if (textId == 0x1008) + if (textId == 0x1008) { Flags_SetInfTable(0x22); + } return; case 6: - if (textId == 0x100A) + if (textId == 0x100A) { Flags_SetInfTable(0x24); + } return; case 7: - if (textId == 0x100C) + if (textId == 0x100C) { Flags_SetInfTable(0x26); + } return; case 8: - if (textId == 0x100E) + if (textId == 0x100E) { Flags_SetInfTable(0x28); - if (textId == 0x1059) + } + if (textId == 0x1059) { Flags_SetInfTable(0x51); + } return; case 10: - if (textId == 0x104F) + if (textId == 0x104F) { Flags_SetInfTable(0x59); + } return; case 13: - if (textId == 0x1054) + if (textId == 0x1054) { Flags_SetInfTable(0x61); + } return; case 15: - if (textId == 0x1062) + if (textId == 0x1062) { Flags_SetInfTable(0x66); + } return; case 16: - if (textId == 0x7002) + if (textId == 0x7002) { Flags_SetInfTable(0x6A); - if (textId == 0x7003) + } + if (textId == 0x7003) { Flags_SetInfTable(0x6A); + } return; case 17: - if (textId == 0x7007) + if (textId == 0x7007) { Flags_SetInfTable(0x6C); + } return; case 18: - if (textId == 0x7071) + if (textId == 0x7071) { Flags_SetInfTable(0x71); + } return; case 20: case 21: - if (textId == 0x2010) + if (textId == 0x2010) { Flags_SetInfTable(0x76); + } return; case 25: - if (textId == 0x7016) + if (textId == 0x7016) { Flags_SetInfTable(0xC2); + } return; case 26: - if (textId == 0x7018) + if (textId == 0x7018) { Flags_SetInfTable(0xC4); + } return; case 28: - if (textId == 0x701D) + if (textId == 0x701D) { Flags_SetInfTable(0xCA); + } return; case 29: - if (textId == 0x701F) + if (textId == 0x701F) { Flags_SetInfTable(0xCC); + } return; case 30: - if (textId == 0x7021) + if (textId == 0x7021) { Flags_SetInfTable(0xCE); + } return; case 31: - if (textId == 0x7023) + if (textId == 0x7023) { Flags_SetInfTable(0xD0); + } return; case 32: - if (textId == 0x7025) + if (textId == 0x7025) { Flags_SetInfTable(0xD2); + } return; case 33: - if (textId == 0x7027) + if (textId == 0x7027) { Flags_SetInfTable(0xD4); + } return; case 34: - if (textId == 0x403c) + if (textId == 0x403c) { Flags_SetInfTable(0xD6); + } return; case 35: - if (textId == 0x5028) + if (textId == 0x5028) { Flags_SetInfTable(0xD8); + } return; case 38: - if (textId == 0x3008) + if (textId == 0x3008) { Flags_SetInfTable(0xE0); + } return; case 40: - if (textId == 0x300B) + if (textId == 0x300B) { Flags_SetInfTable(0xEB); + } return; case 41: - if (textId == 0x3014) + if (textId == 0x3014) { Flags_SetInfTable(0xF0); + } return; case 42: - if (textId == 0x3016) + if (textId == 0x3016) { Flags_SetInfTable(0xF4); + } return; case 43: - if (textId == 0x3018) - { + if (textId == 0x3018) { Flags_SetEventChkInf(0x20); Flags_SetInfTable(0xF8); } return; case 48: - if (textId == 0x3020) - { + if (textId == 0x3020) { Flags_SetEventChkInf(0x22); Flags_SetInfTable(0x113); } @@ -5670,136 +5180,140 @@ void func_80036E50(u16 textId, s16 arg1) case 52: case 53: case 54: - if (textId == 0x4006) + if (textId == 0x4006) { Flags_SetEventChkInf(0x30); + } return; case 50: - if (textId == 0x4006) + if (textId == 0x4006) { Flags_SetEventChkInf(0x30); - if (textId == 0x4008) + } + if (textId == 0x4008) { Flags_SetInfTable(0x124); + } return; case 51: - if (textId == 0x4006) + if (textId == 0x4006) { Flags_SetEventChkInf(0x30); - if (textId == 0x400A) + } + if (textId == 0x400A) { Flags_SetEventChkInf(0x32); - if (textId == 0x402F) + } + if (textId == 0x402F) { Flags_SetInfTable(0x12A); + } return; case 55: - if (textId == 0x401B) - { + if (textId == 0x401B) { Flags_SetEventChkInf(0x33); Flags_SetInfTable(0x138); } return; case 61: - if (textId == 0x5000) + if (textId == 0x5000) { Flags_SetInfTable(0x166); + } return; case 63: - if (textId == 0x5013) + if (textId == 0x5013) { Flags_SetInfTable(0x16A); + } return; case 71: - if (textId == 0x2041) + if (textId == 0x2041) { Flags_SetEventChkInf(0x10); - if (textId == 0x2044) + } + if (textId == 0x2044) { Flags_SetEventChkInf(0x12); - if (textId == 0x2047) + } + if (textId == 0x2047) { Flags_SetEventChkInf(0x15); - if (textId == 0x2048) + } + if (textId == 0x2048) { Flags_SetEventChkInf(0x16); + } return; case 72: return; } } -s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) -{ +s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) { MessageContext* msgCtx = &globalCtx->msgCtx; s32 ret = 1; - switch (textId) - { + switch (textId) { case 0x1035: - if (msgCtx->choiceIndex == 0) - { - if (Flags_GetInfTable(0x2A)) + if (msgCtx->choiceIndex == 0) { + if (Flags_GetInfTable(0x2A)) { func_80035B18(globalCtx, actor, 0x1036); - else + } else { func_80035B18(globalCtx, actor, 0x1041); + } } - if (msgCtx->choiceIndex == 1) - { - if (Flags_GetInfTable(0x2B)) + if (msgCtx->choiceIndex == 1) { + if (Flags_GetInfTable(0x2B)) { func_80035B18(globalCtx, actor, 0x1037); - else + } else { func_80035B18(globalCtx, actor, 0x1041); + } } ret = 0; break; case 0x1038: - if (msgCtx->choiceIndex == 0) - { - if (Flags_GetInfTable(0x2E)) + if (msgCtx->choiceIndex == 0) { + if (Flags_GetInfTable(0x2E)) { func_80035B18(globalCtx, actor, 0x1039); - else + } else { func_80035B18(globalCtx, actor, 0x1041); + } } - if (msgCtx->choiceIndex == 1) - { - if (Flags_GetInfTable(0x2F)) + if (msgCtx->choiceIndex == 1) { + if (Flags_GetInfTable(0x2F)) { func_80035B18(globalCtx, actor, 0x103A); - else + } else { func_80035B18(globalCtx, actor, 0x1041); + } } - if (msgCtx->choiceIndex == 2) - { - if (Flags_GetInfTable(0x30)) + if (msgCtx->choiceIndex == 2) { + if (Flags_GetInfTable(0x30)) { func_80035B18(globalCtx, actor, 0x103B); - else + } else { func_80035B18(globalCtx, actor, 0x1041); + } } ret = 0; break; case 0x103E: - if (msgCtx->choiceIndex == 0) + if (msgCtx->choiceIndex == 0) { func_80035B18(globalCtx, actor, 0x103F); - if (msgCtx->choiceIndex == 1) + } + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x1040); + } ret = 0; break; case 0x1041: - if (msgCtx->unk_E2FA == 0x1035) - { - if (msgCtx->choiceIndex == 0) - { + if (msgCtx->unk_E2FA == 0x1035) { + if (msgCtx->choiceIndex == 0) { func_80035B18(globalCtx, actor, 0x1036); Flags_SetInfTable(0x2A); } - if (msgCtx->choiceIndex == 1) - { + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x1037); Flags_SetInfTable(0x2B); } } - if (msgCtx->unk_E2FA == 0x1038) - { - if (msgCtx->choiceIndex == 0) - { + if (msgCtx->unk_E2FA == 0x1038) { + if (msgCtx->choiceIndex == 0) { func_80035B18(globalCtx, actor, 0x1039); Flags_SetInfTable(0x2E); } - if (msgCtx->choiceIndex == 1) - { + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x103A); Flags_SetInfTable(0x2F); } - if (msgCtx->choiceIndex == 2) - { + if (msgCtx->choiceIndex == 2) { func_80035B18(globalCtx, actor, 0x103B); Flags_SetInfTable(0x30); } @@ -5807,81 +5321,88 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) ret = 0; break; case 0x1062: - if (msgCtx->choiceIndex == 0) + if (msgCtx->choiceIndex == 0) { func_80035B18(globalCtx, actor, 0x1063); - if (msgCtx->choiceIndex == 1) + } + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x1064); + } ret = 0; break; case 0x2030: case 0x2031: - if (msgCtx->choiceIndex == 0) - { - if (gSaveContext.rupees >= 10) - { + if (msgCtx->choiceIndex == 0) { + if (gSaveContext.rupees >= 10) { func_80035B18(globalCtx, actor, 0x2034); Rupees_ChangeBy(-10); - } - else + } else { func_80035B18(globalCtx, actor, 0x2032); + } } - if (msgCtx->choiceIndex == 1) + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x2032); + } Flags_SetInfTable(0x9A); ret = 0; break; case 0x2036: case 0x2037: - if (msgCtx->choiceIndex == 0) + if (msgCtx->choiceIndex == 0) { func_80035B18(globalCtx, actor, 0x201F); - if (msgCtx->choiceIndex == 1) + } + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x205A); + } ret = 0; break; case 0x2038: - if (msgCtx->choiceIndex == 0) + if (msgCtx->choiceIndex == 0) { break; - if (msgCtx->choiceIndex == 1) + } + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x205A); + } ret = 0; break; case 0x2034: - if (msgCtx->choiceIndex != 0) + if (msgCtx->choiceIndex != 0) { break; + } func_80035B18(globalCtx, actor, 0x2035); ret = 0; break; case 0x2043: - if (Flags_GetEventChkInf(0x12)) + if (Flags_GetEventChkInf(0x12)) { break; + } func_80035B18(globalCtx, actor, 0x2044); ret = 0; break; case 0x205A: break; case 0x300A: - if (msgCtx->choiceIndex == 0) - { - if (Flags_GetEventChkInf(0x22)) + if (msgCtx->choiceIndex == 0) { + if (Flags_GetEventChkInf(0x22)) { func_80035B18(globalCtx, actor, 0x300B); - else + } else { func_80035B18(globalCtx, actor, 0x300C); + } } - if (msgCtx->choiceIndex == 1) + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x300D); + } ret = 0; break; case 0x301B: - if (msgCtx->choiceIndex == 0) - { + if (msgCtx->choiceIndex == 0) { func_80035B18(globalCtx, actor, 0x301D); } - if (msgCtx->choiceIndex == 1) - { - if (Flags_GetInfTable(0x113)) + if (msgCtx->choiceIndex == 1) { + if (Flags_GetInfTable(0x113)) { func_80035B18(globalCtx, actor, 0x301F); - else + } else { func_80035B18(globalCtx, actor, 0x301E); + } } ret = 0; break; @@ -5890,10 +5411,12 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) ret = 0; break; case 0x400C: - if (msgCtx->choiceIndex == 0) + if (msgCtx->choiceIndex == 0) { func_80035B18(globalCtx, actor, 0x400D); - if (msgCtx->choiceIndex == 1) + } + if (msgCtx->choiceIndex == 1) { func_80035B18(globalCtx, actor, 0x400E); + } ret = 0; break; case 0x7007: @@ -5913,37 +5436,31 @@ s32 func_800374E0(GlobalContext* globalCtx, Actor* actor, u16 textId) return ret; } -u16 func_80037C30(GlobalContext* globalCtx, s16 arg1) -{ +u16 func_80037C30(GlobalContext* globalCtx, s16 arg1) { return func_80035BFC(globalCtx, arg1); } -s32 func_80037C5C(GlobalContext* globalCtx, s16 arg1, u16 textId) -{ +s32 func_80037C5C(GlobalContext* globalCtx, s16 arg1, u16 textId) { func_80036E50(textId, arg1); return 0; } -s32 func_80037C94(GlobalContext* globalCtx, Actor* actor, s32 arg2) -{ +s32 func_80037C94(GlobalContext* globalCtx, Actor* actor, s32 arg2) { return func_800374E0(globalCtx, actor, actor->textId); } -s32 func_80037CB8(GlobalContext* globalCtx, Actor* actor, s16 arg2) -{ +s32 func_80037CB8(GlobalContext* globalCtx, Actor* actor, s16 arg2) { MessageContext* msgCtx = &globalCtx->msgCtx; s32 ret = 0; - switch (func_8010BDBC(msgCtx)) - { + switch (func_8010BDBC(msgCtx)) { case 2: func_80037C5C(globalCtx, arg2, actor->textId); ret = 1; break; case 4: case 5: - if (func_80106BC8(globalCtx) && func_80037C94(globalCtx, actor, arg2)) - { + if (func_80106BC8(globalCtx) && func_80037C94(globalCtx, actor, arg2)) { Audio_PlaySoundGeneral(NA_SE_SY_CANCEL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); msgCtx->msgMode = 0x36; ret = 1; @@ -5954,58 +5471,57 @@ s32 func_80037CB8(GlobalContext* globalCtx, Actor* actor, s16 arg2) return ret; } -s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) -{ +s32 func_80037D98(GlobalContext* globalCtx, Actor* actor, s16 arg2, s32* arg3) { s16 var; s16 sp2C; s16 sp2A; s16 abs_var; - if (func_8002F194(actor, globalCtx)) - { + if (func_8002F194(actor, globalCtx)) { *arg3 = 1; return 1; } - if (*arg3 == 1) - { - if (func_80037CB8(globalCtx, actor, arg2)) + if (*arg3 == 1) { + if (func_80037CB8(globalCtx, actor, arg2)) { *arg3 = 0; + } return 0; } func_8002F374(globalCtx, actor, &sp2C, &sp2A); - if (0) ; // Necessary to match + if (0) {} // Necessary to match - if ((sp2C < 0) || (sp2C > 320) || (sp2A < 0) || (sp2A > 240)) + if ((sp2C < 0) || (sp2C > 320) || (sp2A < 0) || (sp2A > 240)) { return 0; + } var = actor->rotTowardsLinkY - actor->shape.rot.y; abs_var = ABS(var); - if (abs_var >= 0x4300) + if (abs_var >= 0x4300) { return 0; - - if ((actor->waterSurfaceDist > 25600.0f) && (actor->unk_10C == 0)) - return 0; - - if (actor->waterSurfaceDist <= 6400.0f) - { - if (func_8002F2CC(actor, globalCtx, 80.0f)) - actor->textId = func_80037C30(globalCtx, arg2); } - else - { - if (func_8002F2F4(actor, globalCtx)) + + if ((actor->waterSurfaceDist > 25600.0f) && (actor->unk_10C == 0)) { + return 0; + } + + if (actor->waterSurfaceDist <= 6400.0f) { + if (func_8002F2CC(actor, globalCtx, 80.0f)) { actor->textId = func_80037C30(globalCtx, arg2); + } + } else { + if (func_8002F2F4(actor, globalCtx)) { + actor->textId = func_80037C30(globalCtx, arg2); + } } return 0; } -s32 func_80037F30(Vec3s* arg0, Vec3s* arg1) -{ +s32 func_80037F30(Vec3s* arg0, Vec3s* arg1) { Math_SmoothScaleMaxMinS(&arg0->y, 0, 6, 6200, 100); Math_SmoothScaleMaxMinS(&arg0->x, 0, 6, 6200, 100); Math_SmoothScaleMaxMinS(&arg1->y, 0, 6, 6200, 100); @@ -6013,8 +5529,7 @@ s32 func_80037F30(Vec3s* arg0, Vec3s* arg1) return 1; } -s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) -{ +s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) { s16 sp36; s16 sp34; s16 var; @@ -6028,8 +5543,9 @@ s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) var = Math_SmoothScaleMaxMinS(&arg2->y, sp34, 6, 2000, 1); arg2->y = (arg2->y < -8000) ? -8000 : ((arg2->y > 8000) ? 8000 : arg2->y); - if (var && (ABS(arg2->y) < 8000)) + if (var && (ABS(arg2->y) < 8000)) { return 0; + } Math_SmoothScaleMaxMinS(&arg3->y, sp34 - arg2->y, 4, 2000, 1); arg3->y = (arg3->y < -12000) ? -12000 : ((arg3->y > 12000) ? 12000 : arg3->y); @@ -6037,8 +5553,7 @@ s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) return 1; } -s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, f32 arg4) -{ +s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, f32 arg4) { Player* player = PLAYER; s32 pad; Vec3f sp2C; @@ -6048,29 +5563,27 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->posRot2.pos = actor->posRot.pos; actor->posRot2.pos.y += arg4; - if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE))) - { + if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE))) { var = actor->rotTowardsLinkY - actor->shape.rot.y; abs_var = ABS(var); - if (abs_var >= 0x4300) - { + if (abs_var >= 0x4300) { func_80037F30(arg2, arg3); return 0; } } - if (((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE)) + if (((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE)) { sp2C = globalCtx->view.eye; - else + } else { sp2C = player->actor.posRot2.pos; + } func_80037FC8(actor, &sp2C, arg2, arg3); return 1; } -s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4) -{ +s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4) { Player* player = PLAYER; s32 pad; Vec3f sp24; @@ -6079,21 +5592,20 @@ s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar actor->posRot2.pos = arg4; - if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE))) - { + if (!(((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE))) { var = actor->rotTowardsLinkY - actor->shape.rot.y; abs_var = ABS(var); - if (abs_var >= 0x4300) - { + if (abs_var >= 0x4300) { func_80037F30(arg2, arg3); return 0; } } - if (((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE)) + if (((globalCtx->csCtx.state != 0) || (D_8011D394 != 0)) && (gSaveContext.entrance_index == 0x00EE)) { sp24 = globalCtx->view.eye; - else + } else { sp24 = player->actor.posRot2.pos; + } func_80037FC8(actor, &sp24, arg2, arg3); diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 2a15f876dd..29a18cf994 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -2,24 +2,19 @@ #include #include -#define ACTOR_OVERLAY(name, allocType) \ - { \ - (u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, \ - _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, \ - NULL, &name##_InitVars, #name, allocType, 0 \ +#define ACTOR_OVERLAY(name, allocType) \ + { \ + (u32) _ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \ + _ovl_##name##SegmentEnd, NULL, &name##_InitVars, #name, allocType, 0 \ } -#define ACTOR_OVERLAY_INTERNAL(name, allocType) \ - { \ - 0, 0, \ - NULL, NULL, \ - NULL, &name##_InitVars, #name, allocType, 0 \ - } +#define ACTOR_OVERLAY_INTERNAL(name, allocType) \ + { 0, 0, NULL, NULL, NULL, &name##_InitVars, #name, allocType, 0 } -#define ACTOR_OVERLAY_UNSET { 0 } +#define ACTOR_OVERLAY_UNSET \ + { 0 } -ActorOverlay gActorOverlayTable[] = -{ +ActorOverlay gActorOverlayTable[] = { ACTOR_OVERLAY_INTERNAL(Player, ALLOCTYPE_NORMAL), ACTOR_OVERLAY_UNSET, ACTOR_OVERLAY(En_Test, ALLOCTYPE_NORMAL), @@ -497,26 +492,21 @@ s32 gMaxProfile = 0; static FaultClient sFaultClient; -void ActorOverlayTable_LogPrint(void) -{ +void ActorOverlayTable_LogPrint(void) { ActorOverlay* overlayEntry; u32 i; osSyncPrintf("actor_dlftbls %u\n", gMaxProfile); osSyncPrintf("RomStart RomEnd SegStart SegEnd allocp profile segname\n"); - for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxProfile; i++, overlayEntry++) - { - osSyncPrintf("%08x %08x %08x %08x %08x %08x %s\n", - overlayEntry->vromStart, overlayEntry->vromEnd, - overlayEntry->vramStart, overlayEntry->vramEnd, - overlayEntry->loadedRamAddr, &overlayEntry->initInfo->id, - overlayEntry->name != NULL ? overlayEntry->name : "?"); + for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxProfile; i++, overlayEntry++) { + osSyncPrintf("%08x %08x %08x %08x %08x %08x %s\n", overlayEntry->vromStart, overlayEntry->vromEnd, + overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, + &overlayEntry->initInfo->id, overlayEntry->name != NULL ? overlayEntry->name : "?"); } } -void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) -{ +void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { ActorOverlay* overlayEntry; u32 overlaySize; s32 i; @@ -526,26 +516,22 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) FaultDrawer_Printf("actor_dlftbls %u\n", gMaxProfile); FaultDrawer_Printf("No. RamStart- RamEnd cn Name\n"); - for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxProfile; i++, overlayEntry++) - { + for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxProfile; i++, overlayEntry++) { overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart; - if (overlayEntry->loadedRamAddr != NULL) - { - FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", - i, overlayEntry->loadedRamAddr, (u32)overlayEntry->loadedRamAddr + overlaySize, - overlayEntry->nbLoaded, overlayEntry->name != NULL ? overlayEntry->name : ""); + if (overlayEntry->loadedRamAddr != NULL) { + FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr, + (u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->nbLoaded, + overlayEntry->name != NULL ? overlayEntry->name : ""); } } } -void ActorOverlayTable_Init(void) -{ +void ActorOverlayTable_Init(void) { gMaxProfile = ACTOR_DLF_MAX; Fault_AddClient(&sFaultClient, ActorOverlayTable_FaultPrint, NULL, NULL); } -void ActorOverlayTable_Cleanup(void) -{ +void ActorOverlayTable_Cleanup(void) { Fault_RemoveClient(&sFaultClient); gMaxProfile = 0; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index d36b154c8a..12c66c975c 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -3,47 +3,41 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038600.s") -void func_80038708(s16* puParm1, s16* puParm2, u16 uParm3) -{ - *puParm1 = *puParm2; - puParm1[1] = uParm3; +void func_80038708(s16* puParm1, s16* puParm2, u16 uParm3) { + *puParm1 = *puParm2; + puParm1[1] = uParm3; } -void func_8003871C(u16* puParm1) -{ - *puParm1 = 0xFFFF; +void func_8003871C(u16* puParm1) { + *puParm1 = 0xFFFF; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038728.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038780.s") -void func_800387FC(u32 uParm1, u32* puParm2) -{ - *puParm2 = 0; - puParm2[1] = 0; +void func_800387FC(u32 uParm1, u32* puParm2) { + *puParm2 = 0; + puParm2[1] = 0; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003880C.s") -void func_80038870(int iParm1) -{ - *(u32*)(iParm1 + 4) = 0; +void func_80038870(int iParm1) { + *(u32*)(iParm1 + 4) = 0; } -u32 func_80038878(s32 iParm1) -{ - u32 uVar1; - - uVar1 = *(u32*)(iParm1 + 4) & 0xffff; - *(int *)(iParm1 + 4) = *(u32*)(iParm1 + 4) + 1; - - if (*(int *)(iParm1 + 8) <= (int)uVar1) - { - return 0xffff; - } +u32 func_80038878(s32 iParm1) { + u32 uVar1; - return uVar1; + uVar1 = *(u32*)(iParm1 + 4) & 0xffff; + *(int*)(iParm1 + 4) = *(u32*)(iParm1 + 4) + 1; + + if (*(int*)(iParm1 + 8) <= (int)uVar1) { + return 0xffff; + } + + return uVar1; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800388A8.s") @@ -56,7 +50,6 @@ u32 func_80038878(s32 iParm1) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038A28.s") - #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038B7C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038BE0.s") @@ -175,12 +168,11 @@ u32 func_80038878(s32 iParm1) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E214.s") -void func_8003E398(u16* puParm1) -{ - *puParm1 = 0; - puParm1[1] = 0; - *(u32*)(puParm1 + 2) = 0; - *(u32*)(puParm1 + 4) = 0; +void func_8003E398(u16* puParm1) { + *puParm1 = 0; + puParm1[1] = 0; + *(u32*)(puParm1 + 2) = 0; + *(u32*)(puParm1 + 4) = 0; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E3AC.s") @@ -195,15 +187,12 @@ void func_8003E398(u16* puParm1) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E688.s") -void func_8003E6C4(u16* puParm1) -{ - *puParm1 = 0; - func_8003E688(); +void func_8003E6C4(u16* puParm1) { + *puParm1 = 0; + func_8003E688(); } - -void func_8003E6E4(u16* a0) -{ +void func_8003E6E4(u16* a0) { *a0 = 0; } @@ -211,21 +200,17 @@ void func_8003E6E4(u16* a0) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E750.s") -void func_8003E804(int iParm1) -{ - func_8003E5B4(iParm1 + 0x14, iParm1 + 0x34); +void func_8003E804(int iParm1) { + func_8003E5B4(iParm1 + 0x14, iParm1 + 0x34); } - -void func_8003E82C(u32* a0) -{ +void func_8003E82C(u32* a0) { *a0 = 0; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E834.s") -void func_8003E888(u32* a0) -{ +void func_8003E888(u32* a0) { *a0 = 0; } @@ -235,8 +220,7 @@ void func_8003E888(u32* a0) /* NON-MATCHING -void func_8003E8EC(u32 uParm1, u32* iParm2) -{ +void func_8003E8EC(u32 uParm1, u32* iParm2) { iParm2[0x06] = iParm2[0x0E]; iParm2[0x05] = iParm2[0x0D]; iParm2[0x07] = iParm2[0x0F]; @@ -246,30 +230,28 @@ void func_8003E8EC(u32 uParm1, u32* iParm2) iParm2[0x0B] = iParm2[0x13]; iParm2[0x0C] = iParm2[0x14]; - + //int i; - //for (i = 0; i < 4; i++) - //{ + //for (i = 0; i < 4; i++) { //iParm2[0x06 + (i * 2)] = iParm2[0x0E + (i * 2)]; //iParm2[0x07 + (i * 2)] = iParm2[0x0D + (i * 2)]; //} } */ -u32 func_8003E934(int iParm1) -{ - if (!((-1 < iParm1) && (iParm1 < 0x32))) - return 0; +u32 func_8003E934(int iParm1) { + if (!((-1 < iParm1) && (iParm1 < 0x32))) { + return 0; + } - return 1; + return 1; } -void func_8003E954(u32 uParm1, u8* puParm2) -{ - *puParm2 = 1; - func_8003E82C(puParm2 + 0x13f0); - func_8003E888(puParm2 + 0x13f4); - func_800387FC(uParm1, puParm2 + 0x13f8); +void func_8003E954(u32 uParm1, u8* puParm2) { + *puParm2 = 1; + func_8003E82C(puParm2 + 0x13f0); + func_8003E888(puParm2 + 0x13f4); + func_800387FC(uParm1, puParm2 + 0x13f8); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E9A0.s") @@ -323,19 +305,16 @@ void func_8003E954(u32 uParm1, u8* puParm2) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800418D0.s") #ifdef NON_MATCHING -void func_80041978(int iParm1, int iParm2) -{ - u8* puVar1; +void func_80041978(int iParm1, int iParm2) { + u8* puVar1; - puVar1 = *(u8 **)(iParm1 + 8); - if (puVar1 < puVar1 + iParm2) - { - *puVar1 = 0; - while (puVar1++ < (u8*)(*(int *)(iParm1 + 8) + iParm2)) - { - *puVar1 = 0; + puVar1 = *(u8**)(iParm1 + 8); + if (puVar1 < puVar1 + iParm2) { + *puVar1 = 0; + while (puVar1++ < (u8*)(*(int*)(iParm1 + 8) + iParm2)) { + *puVar1 = 0; + } } - } } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041978.s") @@ -343,12 +322,11 @@ void func_80041978(int iParm1, int iParm2) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800419B0.s") -u32 func_80041A28(CollisionContext *a0, u32 a1, u32 a2) -{ - u32 uVar1; - - uVar1 = func_800419B0(a0, a1, a2, 0); - return uVar1 & 0xff; +u32 func_80041A28(CollisionContext* a0, u32 a1, u32 a2) { + u32 uVar1; + + uVar1 = func_800419B0(a0, a1, a2, 0); + return uVar1 & 0xff; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041A4C.s") @@ -365,12 +343,11 @@ u32 func_80041A28(CollisionContext *a0, u32 a1, u32 a2) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041D4C.s") -u32 func_80041D94(u32 a0, u32 a1, u32 a2) -{ - u32 uVar1; - - uVar1 = func_800419B0(a0, a1, a2, 0); - return uVar1 >> 0x15 & 0x1f; +u32 func_80041D94(u32 a0, u32 a1, u32 a2) { + u32 uVar1; + + uVar1 = func_800419B0(a0, a1, a2, 0); + return uVar1 >> 0x15 & 0x1f; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041DB8.s") @@ -385,12 +362,11 @@ u32 func_80041D94(u32 a0, u32 a1, u32 a2) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041EEC.s") -u32 func_80041F10(u32 a0, u32 a1, u32 a2) -{ - u32 uVar1; - - uVar1 = func_800419B0(a0, a1, a2, 1); - return uVar1 & 0xf; +u32 func_80041F10(u32 a0, u32 a1, u32 a2) { + u32 uVar1; + + uVar1 = func_800419B0(a0, a1, a2, 1); + return uVar1 & 0xf; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041F34.s") @@ -409,29 +385,28 @@ u32 func_80041F10(u32 a0, u32 a1, u32 a2) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800420E4.s") -u32 func_80042108(u32 a0, u32 a1, u32 a2) -{ - u32 result; - s32 var1; +u32 func_80042108(u32 a0, u32 a1, u32 a2) { + u32 result; + s32 var1; - var1 = func_800419B0(a0, a1, a2, 1); + var1 = func_800419B0(a0, a1, a2, 1); - if (var1 << 4 < 0) - result = 1; - else - result = 0; + if (var1 << 4 < 0) { + result = 1; + } else { + result = 0; + } - return result; + return result; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8004213C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042244.s") -u8 func_80042538(CollisionContext *colCtx, s32 iParm2) -{ +u8 func_80042538(CollisionContext* colCtx, s32 iParm2) { u32 var1 = *(u32*)(iParm2 + 0xc); - return var1; + return var1; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042548.s") @@ -451,4 +426,3 @@ u8 func_80042538(CollisionContext *colCtx, s32 iParm2) #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042EF8.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042FC4.s") - diff --git a/src/code/z_camera.c b/src/code/z_camera.c index aba96fe446..d7b0108d54 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -2,20 +2,19 @@ #include #include -// Non-matchings functions marked with CLOSE are either a matter of regalloc or stack size and can possibly be fixed with the permutator. +// Non-matchings functions marked with CLOSE are either a matter of regalloc or stack size and can possibly be fixed +// with the permutator. -typedef struct -{ +typedef struct { Vec3f unk_00; Vec3f unk_0C; - CollisionPoly *unk_18; + CollisionPoly* unk_18; char unk_1C[0x8]; s32 unk_24; } struct_80043D18; // names for this struct's values come from a debug function, may want to rename -typedef struct -{ +typedef struct { s8 code; s8 z; u16 T; @@ -23,88 +22,77 @@ typedef struct Vec3s pos; } SplineData; // originally called SplinedatZ - // 47 lines #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800437F0.s") // had an attempt at this but didn't get very close -f32 func_8004389C(f32 a, f32 b, f32 c, f32 d) -{ - f32 temp1 = a - b; - f32 temp2; - f32 ret; - - if (fabsf(temp1) >= d) - { - temp2 = temp1 * c; - ret = b + temp2; - } - else - ret = a; +f32 func_8004389C(f32 a, f32 b, f32 c, f32 d) { + f32 temp1 = a - b; + f32 temp2; + f32 ret; - return ret; + if (fabsf(temp1) >= d) { + temp2 = temp1 * c; + ret = b + temp2; + } else { + ret = a; + } + + return ret; } -f32 func_800438DC(f32 a, f32 b, f32 c, f32 d) -{ - f32 temp1 = a - b; - f32 temp2; - f32 ret; - - if (fabsf(temp1) >= d) - { - temp2 = temp1 * c; - ret = b + temp2; - } - else - ret = b; +f32 func_800438DC(f32 a, f32 b, f32 c, f32 d) { + f32 temp1 = a - b; + f32 temp2; + f32 ret; - return ret; + if (fabsf(temp1) >= d) { + temp2 = temp1 * c; + ret = b + temp2; + } else { + ret = b; + } + + return ret; } -s16 func_8004391C(s16 a, s16 b, f32 c, s16 d) -{ - s16 temp1 = a - b; - s16 temp2; - s32 ret; - - if (ABS(temp1) >= d) - { - temp2 = temp1 * c + 0.5f; - ret = b + temp2; - } - else - ret = a; +s16 func_8004391C(s16 a, s16 b, f32 c, s16 d) { + s16 temp1 = a - b; + s16 temp2; + s32 ret; - return ret; + if (ABS(temp1) >= d) { + temp2 = temp1 * c + 0.5f; + ret = b + temp2; + } else { + ret = a; + } + + return ret; } -s16 func_800439AC(s16 a, s16 b, f32 c, s16 d) -{ - s16 temp1 = a - b; - s16 temp2; - s32 ret; - - if (ABS(temp1) >= d) - { - temp2 = temp1 * c + 0.5f; - ret = b + temp2; - } - else - ret = b; +s16 func_800439AC(s16 a, s16 b, f32 c, s16 d) { + s16 temp1 = a - b; + s16 temp2; + s32 ret; - return ret; + if (ABS(temp1) >= d) { + temp2 = temp1 * c + 0.5f; + ret = b + temp2; + } else { + ret = b; + } + + return ret; } -void func_80043A3C(Vec3f *a, Vec3f *b, f32 c, f32 d, f32 e) -{ +void func_80043A3C(Vec3f* a, Vec3f* b, f32 c, f32 d, f32 e) { b->x = func_8004389C(a->x, b->x, d, e); b->y = func_8004389C(a->y, b->y, c, e); b->z = func_8004389C(a->z, b->z, d, e); } -void func_80043ABC(Camera *camera) -{ +void func_80043ABC(Camera* camera) { camera->unk_C0.z = 100.0f; camera->unk_C0.y = OREG(7); camera->unk_C0.x = OREG(6); @@ -113,8 +101,7 @@ void func_80043ABC(Camera *camera) camera->unk_CC.z = OREG(4) * 0.01f; } -void func_80043B60(Camera *camera) -{ +void func_80043B60(Camera* camera) { camera->unk_C0.x = OREG(27); camera->unk_C0.z = OREG(27); camera->unk_C0.y = OREG(27); @@ -123,8 +110,7 @@ void func_80043B60(Camera *camera) camera->unk_CC.z = 0.001f; } -Vec3f *func_80043BC4(Vec3f *a, Vec3s *b) -{ +Vec3f* func_80043BC4(Vec3f* a, Vec3s* b) { Vec3f sp4; sp4.x = b->x; @@ -135,21 +121,19 @@ Vec3f *func_80043BC4(Vec3f *a, Vec3s *b) return a; } -Vec3f *func_80043C28(Vec3f *a, Vec3f *b, struct_80045714 *c) -{ +Vec3f* func_80043C28(Vec3f* a, Vec3f* b, struct_80045714* c) { Vec3f sp24, sp18; func_8007C25C(&sp18, c); sp24.x = b->x + sp18.x; sp24.y = b->y + sp18.y; sp24.z = b->z + sp18.z; - + *a = sp24; return a; } -Vec3f *func_80043CAC(Vec3f *a, Vec3f *b, Vec3f *c, f32 d) -{ +Vec3f* func_80043CAC(Vec3f* a, Vec3f* b, Vec3f* c, f32 d) { Vec3f sp4; sp4.x = b->x + (c->x * d); @@ -160,12 +144,11 @@ Vec3f *func_80043CAC(Vec3f *a, Vec3f *b, Vec3f *c, f32 d) return a; } -s32 func_80043D18(Camera *camera, Vec3f *b, struct_80043D18 *c) -{ - CollisionContext *colCtx; +s32 func_80043D18(Camera* camera, Vec3f* b, struct_80043D18* c) { + CollisionContext* colCtx; Vec3f sp68, sp5C, sp50; f32 temp_ret; - CollisionPoly *sp48; + CollisionPoly* sp48; s32 sp44; struct_80045714 sp3C; @@ -173,47 +156,44 @@ s32 func_80043D18(Camera *camera, Vec3f *b, struct_80043D18 *c) func_8007C490(&sp3C, b, &c->unk_00); sp3C.unk_00 += 8.0f; func_80043C28(&sp5C, b, &sp3C); - - if (func_8003DD6C(colCtx, b, &sp5C, &sp68, &c->unk_18, 1, 1, 1, -1, &c->unk_24) == 0) - { + + if (func_8003DD6C(colCtx, b, &sp5C, &sp68, &c->unk_18, 1, 1, 1, -1, &c->unk_24) == 0) { func_8007C0F8(&sp50, b, &c->unk_00); - + c->unk_0C.x = -sp50.x; c->unk_0C.y = -sp50.y; c->unk_0C.z = -sp50.z; - + sp68 = c->unk_00; sp68.y += 5.0f; temp_ret = func_8003CCA4(colCtx, &sp48, &sp44, &sp68); - - if ((c->unk_00.y - temp_ret) > 5.0f) - { + + if ((c->unk_00.y - temp_ret) > 5.0f) { c->unk_00.x += c->unk_0C.x; c->unk_00.y += c->unk_0C.y; c->unk_00.z += c->unk_0C.z; return 0; } - + c->unk_18 = sp48; sp68.y = temp_ret + 1.0f; c->unk_24 = sp44; } - + c->unk_0C.x = c->unk_18->norm.x * (1.f / 32767); c->unk_0C.y = c->unk_18->norm.y * (1.f / 32767); c->unk_0C.z = c->unk_18->norm.z * (1.f / 32767); c->unk_00.x = c->unk_0C.x + sp68.x; c->unk_00.y = c->unk_0C.y + sp68.y; c->unk_00.z = c->unk_0C.z + sp68.z; - + return sp44 + 1; } -void func_80043F34(Camera *camera, Vec3f *b, Vec3f *c) -{ +void func_80043F34(Camera* camera, Vec3f* b, Vec3f* c) { struct_80043D18 sp20; Vec3s unused; - + sp20.unk_00 = *c; func_80043D18(camera, b, &sp20); *c = sp20.unk_00; @@ -222,11 +202,10 @@ void func_80043F34(Camera *camera, Vec3f *b, Vec3f *c) // 242 lines #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80043F94.s") -void func_80044340(Camera *camera, Vec3f *b, Vec3f *c) -{ +void func_80044340(Camera* camera, Vec3f* b, Vec3f* c) { struct_80043D18 sp20; Vec3s unused; - + sp20.unk_00 = *c; func_80043F94(camera, b, &sp20); *c = sp20.unk_00; @@ -236,17 +215,15 @@ f32 func_80038B7C(); #ifdef NON_MATCHING // ordering -s32 func_800443A0(Camera *camera, Vec3f *b, Vec3f *c) -{ +s32 func_800443A0(Camera* camera, Vec3f* b, Vec3f* c) { s32 sp4C; Vec3f sp40; s32 sp3C; s32 sp38; - CollisionPoly *sp34; - + CollisionPoly* sp34; + sp34 = NULL; // this is moved to the top when it should be done in the middle of the function args being loaded - if (func_8003DD6C(&camera->globalCtx->colCtx, b, c, &sp40, &sp34, 1, 1, 1, 0, &sp38) != 0) - { + if (func_8003DD6C(&camera->globalCtx->colCtx, b, c, &sp40, &sp34, 1, 1, 1, 0, &sp38) != 0) { if (func_80038B7C(sp34, b) < 0.0f) return 1; } @@ -256,21 +233,17 @@ s32 func_800443A0(Camera *camera, Vec3f *b, Vec3f *c) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800443A0.s") #endif -f32 func_8003C940(CollisionContext *, CollisionPoly **, s32 *, Vec3f *); -f32 func_80044434(Camera *camera, Vec3f *b, Vec3f *c, s32 *d) -{ +f32 func_8003C940(CollisionContext*, CollisionPoly**, s32*, Vec3f*); +f32 func_80044434(Camera* camera, Vec3f* b, Vec3f* c, s32* d) { s32 sp2C; // unused - CollisionPoly *sp28; + CollisionPoly* sp28; f32 temp_ret = func_8003C940(&camera->globalCtx->colCtx, &sp28, d, c); - - if (temp_ret == -32000.0f) - { + + if (temp_ret == -32000.0f) { b->x = 0.0f; b->z = 0.0f; b->y = 1.0f; - } - else - { + } else { b->x = sp28->norm.x * (1.f / 32767); b->y = sp28->norm.y * (1.f / 32767); b->z = sp28->norm.z * (1.f / 32767); @@ -279,32 +252,28 @@ f32 func_80044434(Camera *camera, Vec3f *b, Vec3f *c, s32 *d) return temp_ret; } -void func_80044510(Camera *camera, Vec3f *b) -{ +void func_80044510(Camera* camera, Vec3f* b) { Vec3f sp2C, sp20; s32 sp1C; sp2C = *b; sp2C.y += 80.0f; - + func_80044434(camera, &sp20, &sp2C, &sp1C); } // 125 lines (loop) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80044568.s") -s16 func_80044740(Camera *camera, s32 b) -{ +s16 func_80044740(Camera* camera, s32 b) { return func_80041A4C(&camera->globalCtx->colCtx, b, 50); } -void func_8004476C(Camera *camera) -{ +void func_8004476C(Camera* camera) { func_80041C10(&camera->globalCtx->colCtx, camera->unk_148, 50); } -s32 func_8004479C(Camera *camera, s32 *b, Vec3f *c) -{ +s32 func_8004479C(Camera* camera, s32* b, Vec3f* c) { s32 temp_ret; PosRot sp20; s32 ret; @@ -312,77 +281,74 @@ s32 func_8004479C(Camera *camera, s32 *b, Vec3f *c) func_8002EF44(&sp20, &camera->player->actor); temp_ret = func_80041A28(&camera->globalCtx->colCtx, c, *b); - if (func_80041A4C(&camera->globalCtx->colCtx, temp_ret, *b) == 0) + if (func_80041A4C(&camera->globalCtx->colCtx, temp_ret, *b) == 0) { ret = -1; - else + } else { ret = temp_ret; + } return ret; } -s32 func_8004481C(Camera *camera, s16 *arg1) -{ - CollisionPoly *sp44; +s32 func_8004481C(Camera* camera, s16* arg1) { + CollisionPoly* sp44; s32 sp40; // unused s32 sp3C; PosRot sp28; func_8002EF44(&sp28, &camera->player->actor); sp28.pos.y += func_8002DC84(camera->player); - if (func_8003C940(&camera->globalCtx->colCtx, &sp44, &sp3C, &sp28.pos) == -32000.0f) - { + if (func_8003C940(&camera->globalCtx->colCtx, &sp44, &sp3C, &sp28.pos) == -32000.0f) { return 0; } *arg1 = func_80041B80(&camera->globalCtx->colCtx, sp44, sp3C); return func_80041C98(&camera->globalCtx->colCtx, sp44, sp3C); } -s32 func_800448CC(Camera *camera, f32 *b) -{ +s32 func_800448CC(Camera* camera, f32* b) { PosRot sp34; s32 sp30; s32 temp_ret; func_8002EF44(&sp34, &camera->player->actor); *b = sp34.pos.y; - - if (func_8004213C(camera->globalCtx, &camera->globalCtx->colCtx, sp34.pos.x, sp34.pos.z, b, &sp30) == 0) - { + + if (func_8004213C(camera->globalCtx, &camera->globalCtx->colCtx, sp34.pos.x, sp34.pos.z, b, &sp30) == 0) { *b = -32000.0f; return -1; } - if (!(camera->player->stateFlags1 & 0x8000000)) - { + if (!(camera->player->stateFlags1 & 0x8000000)) { *b = -32000.0f; return -1; } - + temp_ret = func_80042538(&camera->globalCtx->colCtx, sp30); - if ((temp_ret <= 0) || (func_80042548(&camera->globalCtx->colCtx, sp30) <= 0)) + if ((temp_ret <= 0) || (func_80042548(&camera->globalCtx->colCtx, sp30) <= 0)) { return -2; - + } + return temp_ret; } -f32 func_800449AC(Camera *camera, Vec3f *b, s32 *arg2) -{ +f32 func_800449AC(Camera* camera, Vec3f* b, s32* arg2) { PosRot sp2C; f32 sp28; s32 sp24; func_8002EF44(&sp2C, &camera->player->actor); sp28 = sp2C.pos.y; - - if (func_8004213C(camera->globalCtx, &camera->globalCtx->colCtx, b->x, b->z, &sp28, &sp24) == 0) + + if (func_8004213C(camera->globalCtx, &camera->globalCtx->colCtx, b->x, b->z, &sp28, &sp24) == 0) { return -32000.f; - if (sp28 < b->y) + } + if (sp28 < b->y) { return -32000.f; + } *arg2 = func_8004259C(&camera->globalCtx->colCtx, sp24); return sp28; } -s16 func_80044A74(Vec3f *a, Vec3f *b) -{ +s16 func_80044A74(Vec3f* a, Vec3f* b) { return Math_atan2f(b->x - a->x, b->z - a->z) * (180 / M_PI) * (32767.5f / 180) + 0.5f; } @@ -392,17 +358,17 @@ s16 func_80044A74(Vec3f *a, Vec3f *b) // 143 lines (extremely confusing) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80044E68.s") -f32 func_800450A4(Camera *camera, f32 b) -{ +f32 func_800450A4(Camera* camera, f32 b) { f32 ret; - - if (camera->unk_100 < (OREG(41) * 0.01f)) + + if (camera->unk_100 < (OREG(41) * 0.01f)) { ret = OREG(41) * 0.01f; - else if (b <= camera->unk_100) + } else if (b <= camera->unk_100) { ret = b; - else + } else { ret = OREG(42) * 0.01f * camera->unk_100; - + } + return ret; } @@ -415,17 +381,15 @@ f32 func_800450A4(Camera *camera, f32 b) // 76 lines (unknown types) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80045350.s") -void *func_8004545C(Vec3f *a, s32 b, s32 c, struct_80043D18 *d, struct_80043D18 *e) -{ +void* func_8004545C(Vec3f* a, s32 b, s32 c, struct_80043D18* d, struct_80043D18* e) { Vec3f sp24; - if (func_800427B4(d->unk_18, e->unk_18, b, c, &sp24) == 0) - { + if (func_800427B4(d->unk_18, e->unk_18, b, c, &sp24) == 0) { osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: corner check no cross point %x %x\n" VT_RST, d, e); *a = d->unk_00; return a; } - + *a = sp24; return a; } @@ -435,8 +399,7 @@ void *func_8004545C(Vec3f *a, s32 b, s32 c, struct_80043D18 *d, struct_80043D18 #ifdef NON_MATCHING // CLOSE: stack is 4 bytes too big -f32 func_80045714(Vec3f *a, s16 b, s16 c, f32 arg3) -{ +f32 func_80045714(Vec3f* a, s16 b, s16 c, f32 arg3) { struct_80045714 sp1C; f32 sp18; @@ -446,128 +409,124 @@ f32 func_80045714(Vec3f *a, s16 b, s16 c, f32 arg3) return Math_Coss(b - c) * (sp18 * arg3); } #else -f32 func_80045714(Vec3f *a, s16 b, s16 c, f32 arg3); +f32 func_80045714(Vec3f* a, s16 b, s16 c, f32 arg3); #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80045714.s") #endif f32 func_8007C0A8(f32, f32); -s32 func_800457A8(Camera *camera, struct_80045714 *b, f32 c, s16 d) -{ +s32 func_800457A8(Camera* camera, struct_80045714* b, f32 c, s16 d) { f32 unused; Vec3f sp50; Vec3f sp44; s32 unused2; - PosRot *sp2C; + PosRot* sp2C; f32 temp_ret; - + temp_ret = func_8002DC84(camera->player); sp50.x = 0.f; sp50.z = 0.f; sp50.y = temp_ret + c; - + sp2C = &camera->unk_94; - if (d != 0) - { + if (d != 0) { sp50.y -= func_8007C0A8(func_80045714(&camera->unk_108, sp2C->rot.y, b->unk_06, OREG(9)), temp_ret); } func_80043A3C(&sp50, &camera->unk_E4, camera->unk_CC.y, camera->unk_CC.x, 0.1f); - + sp44.x = sp2C->pos.x + camera->unk_E4.x; sp44.y = sp2C->pos.y + camera->unk_E4.y; sp44.z = sp2C->pos.z + camera->unk_E4.z; func_80043A3C(&sp44, &camera->unk_50, camera->unk_100, camera->unk_100, 0.2f); - + return 1; } -f32 func_8007C028(Vec3f *, Vec3f *); +f32 func_8007C028(Vec3f*, Vec3f*); #ifdef NON_MATCHING // CLOSE: regalloc -s32 func_800458D4(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 e) -{ +s32 func_800458D4(Camera* camera, struct_80045714* b, f32 c, f32* d, s16 e) { f32 phi_f2; Vec3f sp60; Vec3f sp54; f32 temp_ret; - PosRot *temp_s1; + PosRot* temp_s1; f32 sp48; s32 pad[2]; sp60.y = func_8002DC84(camera->player) + c; sp60.x = 0.0f; sp60.z = 0.0f; - + temp_s1 = &camera->unk_94; if (e != 0) sp60.y -= func_80045714(&camera->unk_108, temp_s1->rot.y, b->unk_06, OREG(9)); - + sp48 = temp_s1->pos.y - *d; temp_ret = Math_atan2f(sp48, func_8007C028(&camera->unk_50, &camera->unk_5C)); // f2 and f14 are swapped - + if (OREG(32) * (M_PI / 180) < temp_ret) phi_f2 = 1.0f - sinf(temp_ret - OREG(32) * (M_PI / 180)); else if (OREG(33) * (M_PI / 180) > temp_ret) phi_f2 = 1.0f - sinf(OREG(33) * (M_PI / 180) - temp_ret); else phi_f2 = 1.0f; - + sp60.y -= sp48 * phi_f2; func_80043A3C(&sp60, &camera->unk_E4, OREG(29) * 0.01f, OREG(30) * 0.01f, 0.1f); - + sp54.x = temp_s1->pos.x + camera->unk_E4.x; sp54.y = temp_s1->pos.y + camera->unk_E4.y; sp54.z = temp_s1->pos.z + camera->unk_E4.z; func_80043A3C(&sp54, &camera->unk_50, camera->unk_100, camera->unk_100, 0.2f); - + return 1; } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800458D4.s") #endif -s32 func_80045B08(Camera *camera, struct_80045714 *b, f32 c, s16 d) -{ +s32 func_80045B08(Camera* camera, struct_80045714* b, f32 c, s16 d) { f32 phi_f2; Vec3f sp48; Vec3f sp3C; f32 sp38; // unused f32 temp_ret; - PosRot *temp_s1; + PosRot* temp_s1; sp48.y = func_8002DC84(camera->player) + c; sp48.x = 0.0f; sp48.z = 0.0f; - - temp_ret = Math_Sins((s32) d); + + temp_ret = Math_Sins((s32)d); temp_s1 = &camera->unk_94; - - if (temp_ret < 0.0f) + + if (temp_ret < 0.0f) { phi_f2 = Math_Coss(temp_s1->rot.y - b->unk_06); - else + } else { phi_f2 = -Math_Coss(temp_s1->rot.y - b->unk_06); - + } + sp48.y -= temp_ret * phi_f2 * OREG(9); func_80043A3C(&sp48, &camera->unk_E4, camera->unk_CC.y, camera->unk_CC.x, 0.1f); - + sp3C.x = temp_s1->pos.x + camera->unk_E4.x; sp3C.y = temp_s1->pos.y + camera->unk_E4.y; sp3C.z = temp_s1->pos.z + camera->unk_E4.z; func_80043A3C(&sp3C, &camera->unk_50, camera->unk_100, camera->unk_100, 0.2f); - + return 1; } #ifdef NON_MATCHING // someone who's not me can have fun with this function -s32 func_80045C74(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 arg4) -{ +s32 func_80045C74(Camera* camera, struct_80045714* b, f32 c, f32* d, s16 arg4) { Vec3f sp70; Vec3f sp64; f32 sp54; - PosRot *sp3C; + PosRot* sp3C; f32 temp; f32 temp_f2; f32 temp_ret_3; @@ -577,72 +536,61 @@ s32 func_80045C74(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 arg4) sp70.y = func_8002DC84(camera->player) + c; sp70.x = 0.0f; sp70.z = 0.0f; - - if (PREG(76) != 0) - { - if (arg4 != 0) - { + + if (PREG(76) != 0) { + if (arg4 != 0) { sp70.y -= func_80045714(&camera->unk_108, sp3C->rot.y, b->unk_06, OREG(9)); } } - + sp3C = &camera->unk_94; - - if ((sp3C->pos.y == camera->unk_104) || (camera->player->actor.gravity > -0.1f) || (camera->player->stateFlags1 & 0x200000)) - { + + if ((sp3C->pos.y == camera->unk_104) || (camera->player->actor.gravity > -0.1f) || + (camera->player->stateFlags1 & 0x200000)) { *d = func_8004389C(sp3C->pos.y, *d, OREG(43) * 0.01f, 0.1f); sp70.y -= sp3C->pos.y - *d; func_80043A3C(&sp70, &camera->unk_E4, camera->unk_CC.y, camera->unk_CC.x, 0.1f); - } - else - { + } else { temp = sp3C->pos.y - *d; - if (PREG(75) == 0) - { + if (PREG(75) == 0) { sp54 = func_8007C028(&camera->unk_50, &camera->unk_5C); Math_atan2f(temp, sp54); temp_f2 = Math_tanf(camera->unk_FC * 0.4f * (M_PI / 180)) * sp54; - - if (temp > temp_f2) - { + + if (temp > temp_f2) { *d += temp - temp_f2; phi_f20 = temp_f2; - } - else - { + } else { phi_f20 = temp; - if (temp < -temp_f2) - { + if (temp < -temp_f2) { *d += temp + temp_f2; phi_f20 = -temp_f2; } } sp70.y -= phi_f20; - } - else - { + } else { temp_ret_3 = Math_atan2f(temp, func_8007C028(&camera->unk_50, &camera->unk_5C)); - + if (OREG(32) * (M_PI / 180) < temp_ret_3) phi_f16 = 1.0f - sinf(temp_ret_3 - OREG(32) * (M_PI / 180)); else if (temp_ret_3 < OREG(33) * (M_PI / 180)) phi_f16 = 1.0f - sinf(OREG(33) * (M_PI / 180) - temp_ret_3); else phi_f16 = 1.0f; - + sp70.y -= temp * phi_f16; } - + func_80043A3C(&sp70, &camera->unk_E4, OREG(29) * 0.01f, OREG(30) * 0.01f, 0.1f); camera->unk_CC.y = OREG(29) * 0.01f; camera->unk_CC.x = OREG(30) * 0.01f; } - + sp64.x = sp3C->pos.x + camera->unk_E4.x; sp64.y = sp3C->pos.y + camera->unk_E4.y; sp64.z = sp3C->pos.z + camera->unk_E4.z; func_80043A3C(&sp64, &camera->unk_50, camera->unk_100, camera->unk_100, 0.2f); - + return 1; } #else @@ -652,141 +600,123 @@ s32 func_80045C74(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 arg4) // 421 lines #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800460A8.s") -s32 func_800466F8(Camera *camera, struct_80045714 *b, f32 c, f32 *d, s16 e) -{ +s32 func_800466F8(Camera* camera, struct_80045714* b, f32 c, f32* d, s16 e) { s32 phi_v0; Vec3f sp60; Vec3f sp54; f32 sp50; // unused f32 sp4C; // unused f32 sp48; // I doubt this is a Vec3f - Player *sp44; + Player* sp44; PosRot sp30; sp48 = func_8002DC84(camera->player); sp44 = camera->player; func_8002EF44(&sp30, sp44->rideActor); - - if ((*(s32 *)((s32)(sp44->rideActor) + 0x1F0) & 4) != 0) // actors aren't this big, is rideActor a different type? + + if ((*(s32*)((s32)(sp44->rideActor) + 0x1F0) & 4) != 0) { // actors aren't this big, is rideActor a different type? phi_v0 = 1; - else + } else { phi_v0 = 0; - - if (phi_v0 != 0) - { + } + + if (phi_v0 != 0) { sp30.pos.y -= 49.f; *d = func_8004389C(sp30.pos.y, *d, 0.1f, 0.2f); camera->unk_100 = func_8004389C(0.4f, camera->unk_100, 0.2f, 0.02f); - } - else - { + } else { *d = func_8004389C(sp30.pos.y, *d, 0.5f, 0.2f); } - + sp60.x = 0.0f; sp60.z = 0.0f; sp60.y = sp48 + c; - - if (e != 0) + + if (e != 0) { sp60.y -= func_80045714(&camera->unk_108, camera->unk_94.rot.y, b->unk_06, OREG(9)); - + } + func_80043A3C(&sp60, &camera->unk_E4, camera->unk_CC.y, camera->unk_CC.x, 0.1f); - + sp54.x = camera->unk_E4.x + sp30.pos.x; sp54.y = camera->unk_E4.y + sp30.pos.y; sp54.z = camera->unk_E4.z + sp30.pos.z; func_80043A3C(&sp54, &camera->unk_50, camera->unk_100, camera->unk_100, 0.2f); - + return 1; } -void func_800468CC(Camera *camera, f32 b, f32 c, f32 d) -{ +void func_800468CC(Camera* camera, f32 b, f32 c, f32 d) { f32 sp1C; f32 phi_f12; - if (b < c) - { + if (b < c) { sp1C = c; phi_f12 = OREG(6); - } - else if (d < b) - { + } else if (d < b) { sp1C = d; phi_f12 = OREG(6); - } - else - { + } else { sp1C = b; phi_f12 = 1.0f; } - + camera->unk_C0.x = func_8004389C(phi_f12, camera->unk_C0.x, OREG(25) * 0.01f, 0.1f); func_8004389C(sp1C, camera->unk_DC, 1.f / camera->unk_C0.x, 0.2f); } -void func_800469C0(Camera *camera, f32 b, f32 c, f32 d, s16 e) -{ +void func_800469C0(Camera* camera, f32 b, f32 c, f32 d, s16 e) { f32 sp1C; f32 phi_f12; - if (b < c) - { + if (b < c) { sp1C = c; - - if (e != 0) + + if (e != 0) { phi_f12 = OREG(6) * 0.5f; - else + } else { phi_f12 = OREG(6); - } - else if (d < b) - { + } + } else if (d < b) { sp1C = d; - - if (e != 0) + + if (e != 0) { phi_f12 = OREG(6) * 0.5f; - else + } else { phi_f12 = OREG(6); - } - else - { + } + } else { sp1C = b; - - if (e != 0) + + if (e != 0) { phi_f12 = OREG(6); - else + } else { phi_f12 = 1.0f; + } } - + camera->unk_C0.x = func_8004389C(phi_f12, camera->unk_C0.x, OREG(25) * 0.01f, 0.1f); func_8004389C(sp1C, camera->unk_DC, 1.f / camera->unk_C0.x, 0.2f); } #ifdef NON_MATCHING // lots of regalloc and stack issues, but that's it -void func_80046B44(Camera *camera, s16 b, s16 c, s16 d) -{ +void func_80046B44(Camera* camera, s16 b, s16 c, s16 d) { s16 sp1C; s16 phi_v1; s16 phi_v0; f32 phi_a2; phi_v1 = ABS(b); - if (d > 0) - { + if (d > 0) { phi_v0 = Math_Coss(d) * d; - } - else - { + } else { phi_v0 = d; } sp1C = c - phi_v0; - if (ABS(sp1C) < phi_v1) - { + if (ABS(sp1C) < phi_v1) { phi_a2 = (1.0f / camera->unk_C0.y) * 3.0f; - } - else - { + } else { phi_a2 = (1.0f / camera->unk_C0.y) * func_800437F0(0.8f, 1.0f - phi_v0 * (1.0f / OREG(5))); } func_8004391C(sp1C, b, phi_a2, 0xa); @@ -797,33 +727,28 @@ void func_80046B44(Camera *camera, s16 b, s16 c, s16 d) #ifdef NON_MATCHING // stack, regalloc, tiny bit of ordering -s16 func_80046CB4(Camera *camera, s16 b, s16 c, f32 d, f32 e) -{ +s16 func_80046CB4(Camera* camera, s16 b, s16 c, f32 d, f32 e) { f32 sp34; s16 sp1C; f32 temp_ret; f32 phi_f14; - s16 temp; + s16 temp; - if (camera->unk_D8 > 0.001f) - { - temp = b - 0x7fff; // this is probably some kind of cast that I'm too stupid to know + if (camera->unk_D8 > 0.001f) { + temp = b - 0x7fff; // this is probably some kind of cast that I'm too stupid to know sp1C = c - temp; phi_f14 = (s16)(sp1C - 0x7fff) * 0.00003051851f; - } - else - { - temp = b - 0x7fff; + } else { + temp = b - 0x7fff; sp1C = c - temp; phi_f14 = OREG(48) * 0.01f; } temp_ret = func_800437F0(d, phi_f14); sp34 = ((1.0f - temp_ret) * e) + temp_ret; - if (sp34 < 0.0f) - { + if (sp34 < 0.0f) { sp34 = 0.0f; } - // ordering stuff here + // ordering stuff here return (s16)((sp1C * sp34) * (1.0f / camera->unk_C0.z) * func_800437F0(0.5f, camera->unk_E0)) + b; } #else @@ -833,8 +758,7 @@ s16 func_80046CB4(Camera *camera, s16 b, s16 c, f32 d, f32 e) // 364 lines #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80046E20.s") -s32 func_80047394(Camera *camera) -{ +s32 func_80047394(Camera* camera) { return 1; } @@ -847,13 +771,11 @@ s32 func_80047394(Camera *camera) // Very long function (1,444 lines), 1 jtbl #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80052E0C.s") -void Camera_DebugPrintSplineArray(char* name, s16 length, SplineData splines[]) -{ +void Camera_DebugPrintSplineArray(char* name, s16 length, SplineData splines[]) { s32 i; - + osSyncPrintf("static SplinedatZ %s[] = {\n", name); - for (i = 0; i < length; i++) - { + for (i = 0; i < length; i++) { osSyncPrintf(" /* key frame %2d */ {\n", i); osSyncPrintf(" /* code */ %d,\n", splines[i].code); osSyncPrintf(" /* z */ %d,\n", splines[i].z); @@ -865,8 +787,7 @@ void Camera_DebugPrintSplineArray(char* name, s16 length, SplineData splines[]) osSyncPrintf("};\n\n"); } -void Camera_Vec3fCopy(Vec3f *src, Vec3f *dst) -{ +void Camera_Vec3fCopy(Vec3f* src, Vec3f* dst) { dst->x = src->x; dst->y = src->y; dst->z = src->z; @@ -878,19 +799,14 @@ void Camera_Vec3fCopy(Vec3f *src, Vec3f *dst) // 225 lines #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_80057C6C.s") -s32 func_8005AD40(Camera *camera, s32 a, s16 b, f32 c, s16 d, s16 e, s16 f); +s32 func_8005AD40(Camera* camera, s32 a, s16 b, f32 c, s16 d, s16 e, s16 f); -void func_80057FC4(Camera *camera) -{ - if (camera != &camera->globalCtx->cameraCtx.activeCameras[0]) - { +void func_80057FC4(Camera* camera) { + if (camera != &camera->globalCtx->cameraCtx.activeCameras[0]) { camera->unk_154 = camera->unk_142 = 33; camera->unk_14C &= ~0x4; - } - else if (camera->globalCtx->roomCtx.curRoom.mesh->polygon.type != 1) - { - switch (camera->globalCtx->roomCtx.curRoom.unk_03) - { + } else if (camera->globalCtx->roomCtx.curRoom.mesh->polygon.type != 1) { + switch (camera->globalCtx->roomCtx.curRoom.unk_03) { case 1: func_8005AD40(camera, 0, -99, 0, 0, 18, 10); camera->unk_154 = camera->unk_142 = 3; @@ -907,17 +823,14 @@ void func_80057FC4(Camera *camera) camera->unk_14C |= 4; break; } - } - else - { + } else { osSyncPrintf("camera: room type: prerender\n"); camera->unk_154 = camera->unk_142 = 33; camera->unk_14C &= ~0x4; } } -void Camera_Stub80058140(Camera *camera) -{ +void Camera_Stub80058140(Camera* camera) { } // 135 lines (has lwl/lwr) @@ -932,13 +845,13 @@ void Camera_Stub80058140(Camera *camera) // 296 lines #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800588B4.s") -s32 func_80058CF8(Camera *camera) -{ +s32 func_80058CF8(Camera* camera) { camera->unk_152 &= ~1; - - if (camera->globalCtx->roomCtx.curRoom.unk_02 == 3) + + if (camera->globalCtx->roomCtx.curRoom.unk_02 == 3) { camera->unk_152 |= 1; - + } + return 1; } @@ -951,49 +864,47 @@ s32 func_80058CF8(Camera *camera) // Long function, 866 lines (lots of debug symbols) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800591EC.s") -void func_80059EC8(Camera *camera) -{ - Camera *sp24 = camera->globalCtx->cameraCtx.activeCameraPtrs[0]; - Player *player = (Player *)camera->globalCtx->actorCtx.actorList[2].first; - - if (camera->unk_160 == 0) - { +void func_80059EC8(Camera* camera) { + Camera* sp24 = camera->globalCtx->cameraCtx.activeCameraPtrs[0]; + Player* player = (Player*)camera->globalCtx->actorCtx.actorList[2].first; + + if (camera->unk_160 == 0) { func_800C0314(camera->globalCtx, camera->unk_162, 7); - - if ((camera->unk_162 == 0) && (camera->unk_168 != 0)) - { + + if ((camera->unk_162 == 0) && (camera->unk_168 != 0)) { player->actor.freeze = 0; player->stateFlags1 &= ~0x20000000; - - if (player->action != 0) - { + + if (player->action != 0) { func_8002DF54(camera->globalCtx, &player->actor, 7); osSyncPrintf("camera: player demo end!!\n"); } - + sp24->unk_14C |= 8; } - if (camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_14E]->unk_162 == camera->unk_164) + if (camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_14E]->unk_162 == camera->unk_164) { camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_14E]->unk_162 = camera->unk_162; - - if (camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_162]->unk_14E == camera->unk_164) - camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_162]->unk_14E = camera->unk_14E; + } - if (camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_162]->unk_164 == 0) + if (camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_162]->unk_14E == camera->unk_164) { + camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_162]->unk_14E = camera->unk_14E; + } + + if (camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_162]->unk_164 == 0) { camera->globalCtx->cameraCtx.activeCameraPtrs[camera->unk_162]->unk_15E = 0; - + } + camera->unk_162 = 0; camera->unk_14E = camera->unk_162; camera->unk_160 = -1; camera->globalCtx->unk_10B05 = 0; - + func_800C0384(camera->globalCtx, camera->unk_164); } } -s32 func_8005A02C(Camera *camera) -{ +s32 func_8005A02C(Camera* camera) { camera->unk_14C |= 0xC; camera->unk_14C &= ~(0x1000 | 0x8); return 1; @@ -1002,8 +913,7 @@ s32 func_8005A02C(Camera *camera) // 275 lines (has 2 jtbls) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_8005A04C.s") -void func_8005A444(Camera *camera, s16 b) -{ +void func_8005A444(Camera* camera, s16 b) { func_8005A04C(camera, b, 0); } @@ -1013,8 +923,7 @@ void func_8005A444(Camera *camera, s16 b) // 154 lines (unknown arrays) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_8005A548.s") -s32 func_8005A77C(Camera *camera, s16 b) -{ +s32 func_8005A77C(Camera* camera, s16 b) { return func_8005A548(camera, b, 0); } @@ -1036,95 +945,83 @@ s32 func_8005A77C(Camera *camera, s16 b) // 118 lines (has 1 jtbl) #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_8005AA90.s") -s32 func_8005AC48(Camera *camera, s16 b) -{ +s32 func_8005AC48(Camera* camera, s16 b) { camera->unk_14C = b; return 1; } -s32 func_8005AC60(Camera *camera) -{ +s32 func_8005AC60(Camera* camera) { camera->unk_15E = 0; return 1; } -s32 func_8005AC6C(Camera *camera, s32 b, s32 c, Player *d, s16 e) -{ +s32 func_8005AC6C(Camera* camera, s32 b, s32 c, Player* d, s16 e) { PosRot sp24; camera->unk_124 = b; camera->unk_128 = c; camera->unk_12C = e; - - if (camera->unk_12C != 0) - { + + if (camera->unk_12C != 0) { camera->player = d; func_8002EF44(&sp24, &d->actor); camera->unk_94 = sp24; - + camera->unk_156 = -1; camera->unk_D8 = 0.0f; camera->unk_E0 = 0.0f; } - + return 1; } -s16 func_8005ACFC(Camera *camera, s16 b) -{ +s16 func_8005ACFC(Camera* camera, s16 b) { camera->unk_14C |= b; return camera->unk_14C; } -s16 func_8005AD1C(Camera *camera, s16 b) -{ +s16 func_8005AD1C(Camera* camera, s16 b) { camera->unk_14C &= ~b; return camera->unk_14C; } -s32 func_8005AD40(Camera *camera, s32 a, s16 b, f32 c, s16 d, s16 e, s16 f) -{ - if ((camera->unk_142 == 43) || (camera->unk_142 == 29)) +s32 func_8005AD40(Camera* camera, s32 a, s16 b, f32 c, s16 d, s16 e, s16 f) { + if ((camera->unk_142 == 43) || (camera->unk_142 == 29)) { return 0; - + } + camera->unk_00 = a; camera->unk_06 = d; camera->unk_08 = e; camera->unk_0A = f; camera->unk_04 = b; - - if (b == -99) - { + + if (b == -99) { func_80045128(camera, camera->unk_144); return -99; } - - if (b == -1) - { + + if (b == -1) { func_8005A77C(camera, 29); osSyncPrintf(".... change default door camera (set %d)\n", 29); - } - else - { + } else { s32 ret = func_80044740(camera, b); camera->unk_14A |= 0x40; - - if (func_8005A77C(camera, ret) >= 0) - { + + if (func_8005A77C(camera, ret) >= 0) { camera->unk_148 = b; camera->unk_14A |= 4; } - + // this is likely important for labelling unk_148 and unk_142 osSyncPrintf("....change door camera ID %d (set %d)\n", camera->unk_148, camera->unk_142); } - + func_80045128(camera, camera->unk_144); return -1; } -s32 func_8005AE64(Camera *camera, Camera *otherCamera) -{ +s32 func_8005AE64(Camera* camera, Camera* otherCamera) { s32 unused; Vec3f sp30; @@ -1133,7 +1030,7 @@ s32 func_8005AE64(Camera *camera, Camera *otherCamera) camera->unk_E4.z = 0.0f; camera->unk_100 = 0.1f; camera->unk_50 = otherCamera->unk_50; - + sp30 = otherCamera->unk_5C; camera->unk_74 = sp30; camera->unk_5C = sp30; @@ -1142,9 +1039,8 @@ s32 func_8005AE64(Camera *camera, Camera *otherCamera) camera->unk_FC = otherCamera->unk_FC; camera->unk_15A = otherCamera->unk_15A; func_80043B60(camera); - - if (camera->player != NULL) - { + + if (camera->player != NULL) { func_8002EF14(&camera->unk_94, &camera->player->actor); camera->unk_E4.x = camera->unk_50.x - camera->unk_94.pos.x; camera->unk_E4.y = camera->unk_50.y - camera->unk_94.pos.y; @@ -1156,39 +1052,40 @@ s32 func_8005AE64(Camera *camera, Camera *otherCamera) return 1; } -s32 func_8005AFA8() -{ +s32 func_8005AFA8() { return D_8011D394; } -Vec3f *func_8005AFB4(Vec3f *dst, Camera *camera) -{ +Vec3f* func_8005AFB4(Vec3f* dst, Camera* camera) { *dst = camera->unk_80; return dst; } -void Camera_SetCameraData(Camera *camera, s16 b, s32 c, s32 d, s16 e, s16 f) // Unused -{ - if (b & 0x1) +// Unused +void Camera_SetCameraData(Camera* camera, s16 b, s32 c, s32 d, s16 e, s16 f) { + if (b & 0x1) { camera->unk_124 = c; - - if (b & 0x2) + } + + if (b & 0x2) { camera->unk_128 = d; - - if (b & 0x4) + } + + if (b & 0x4) { camera->unk_12C = e; - - if (b & 0x8) + } + + if (b & 0x8) { camera->unk_12E = f; - - if (b & 0x10) + } + + if (b & 0x10) { osSyncPrintf(VT_COL(RED, WHITE) "camera: setCameraData: last argument not alive!\n" VT_RST, b); + } } -s32 func_8005B044() -{ - if (QREG(0) == 0) - { +s32 func_8005B044() { + if (QREG(0) == 0) { QREG(2) = 1; QREG(10) = -1; QREG(11) = 100; @@ -1217,25 +1114,22 @@ s32 func_8005B044() QREG(57) = 30; QREG(58) = 0; } - + QREG(65) = 50; return 1; } -s32 func_8005B198() -{ +s32 func_8005B198() { return D_8011D3AC; } -s16 func_8005B1A4(Camera *camera) -{ +s16 func_8005B1A4(Camera* camera) { camera->unk_14C |= 0x8; - - if ((camera->unk_164 == 0) && (camera->globalCtx->cameraCtx.unk_5C0 != 0)) - { + + if ((camera->unk_164 == 0) && (camera->globalCtx->cameraCtx.unk_5C0 != 0)) { camera->globalCtx->cameraCtx.activeCameraPtrs[camera->globalCtx->cameraCtx.unk_5C0]->unk_14C |= 0x8; return camera->globalCtx->cameraCtx.unk_5C0; } - + return camera->unk_164; } diff --git a/src/code/z_cheap_proc.c b/src/code/z_cheap_proc.c index 48fd9b32a6..4b9abb220f 100644 --- a/src/code/z_cheap_proc.c +++ b/src/code/z_cheap_proc.c @@ -1,29 +1,29 @@ #include #include -void Draw_DListOpa(GlobalContext* globalCtx, u32 dlist) -{ +void Draw_DListOpa(GlobalContext* globalCtx, u32 dlist) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 214); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 216), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 216), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dlist); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 219); } -void Draw_DListXlu(GlobalContext* globalCtx, u32 dlist) -{ +void Draw_DListXlu(GlobalContext* globalCtx, u32 dlist) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 228); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 230), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 230), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, dlist); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 233); diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 116059b18c..b8a70550db 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -7,15 +7,13 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B65C.s") -s32 func_8005B6A0(GlobalContext* globalCtx, Collider* collision) -{ +s32 func_8005B6A0(GlobalContext* globalCtx, Collider* collision) { return 1; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B6B0.s") -s32 func_8005B6EC(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src) -{ +s32 func_8005B6EC(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src) { collision->actor = actor; collision->unk_14 = src->unk_00; collision->colliderFlags = src->colliderFlags; @@ -26,8 +24,7 @@ s32 func_8005B6EC(GlobalContext* globalCtx, Collider* collision, Actor* actor, C return 1; } -s32 func_8005B72C(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src) -{ +s32 func_8005B72C(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src) { collision->actor = actor; collision->unk_14 = src->unk_00; collision->colliderFlags = src->colliderFlags; @@ -38,20 +35,17 @@ s32 func_8005B72C(GlobalContext* globalCtx, Collider* collision, Actor* actor, C return 1; } -void func_8005B76C(GlobalContext* globalCtx, Collider* collision) -{ +void func_8005B76C(GlobalContext* globalCtx, Collider* collision) { collision->at = NULL; collision->colliderFlags &= ~0x6; } -void func_8005B784(GlobalContext* globalCtx, Collider* collision) -{ +void func_8005B784(GlobalContext* globalCtx, Collider* collision) { collision->ac = NULL; collision->collideFlags &= ~0x82; } -void func_8005B79C(GlobalContext* globalCtx, Collider* collision) -{ +void func_8005B79C(GlobalContext* globalCtx, Collider* collision) { collision->ot = NULL; collision->maskA &= ~0x2; collision->maskB &= ~0x1; @@ -59,22 +53,18 @@ void func_8005B79C(GlobalContext* globalCtx, Collider* collision) #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B7C0.s") -s32 func_8005B7E4(GlobalContext* globalCtx, ColliderTouch* touch) -{ +s32 func_8005B7E4(GlobalContext* globalCtx, ColliderTouch* touch) { return 1; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B7F4.s") -void func_8005B818(GlobalContext* globalCtx, ColliderBody* body) -{ - +void func_8005B818(GlobalContext* globalCtx, ColliderBody* body) { } #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B824.s") -s32 func_8005B850(GlobalContext* globalCtx, ColliderBump* bump) -{ +s32 func_8005B850(GlobalContext* globalCtx, ColliderBump* bump) { return 1; } @@ -82,15 +72,13 @@ s32 func_8005B850(GlobalContext* globalCtx, ColliderBump* bump) #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B884.s") -s32 func_8005B904(GlobalContext* globalCtx, ColliderBody* body) -{ +s32 func_8005B904(GlobalContext* globalCtx, ColliderBody* body) { func_8005B7E4(globalCtx, &body->toucher); func_8005B850(globalCtx, &body->bumper); return 1; } -s32 func_8005B93C(GlobalContext* globalCtx, ColliderBody* body, ColliderBodyInfoInner* bodyInfoInner) -{ +s32 func_8005B93C(GlobalContext* globalCtx, ColliderBody* body, ColliderBodyInfoInner* bodyInfoInner) { body->flags = bodyInfoInner->bodyFlags; func_8005B7F4(globalCtx, &body->toucher, &bodyInfoInner->toucherMask); func_8005B860(globalCtx, &body->bumper, &bodyInfoInner->bumperMask); @@ -100,8 +88,7 @@ s32 func_8005B93C(GlobalContext* globalCtx, ColliderBody* body, ColliderBodyInfo return 1; } -void func_8005B9B0(GlobalContext* globalCtx, ColliderBody* body) -{ +void func_8005B9B0(GlobalContext* globalCtx, ColliderBody* body) { body->unk_18 = 0; body->unk_20 = 0; body->toucherFlags &= ~0x2; @@ -109,8 +96,7 @@ void func_8005B9B0(GlobalContext* globalCtx, ColliderBody* body) func_8005B818(globalCtx, body); } -void func_8005B9E8(GlobalContext* globalCtx, ColliderBody* body) -{ +void func_8005B9E8(GlobalContext* globalCtx, ColliderBody* body) { body->bumper.unk_0A = 0; body->bumperFlags &= ~0x2; body->bumperFlags &= ~0x80; @@ -120,15 +106,13 @@ void func_8005B9E8(GlobalContext* globalCtx, ColliderBody* body) body->bumper.unk_06 = body->bumper.unk_0A; } -void func_8005BA1C(GlobalContext* globalCtx, ColliderBody* body) -{ +void func_8005BA1C(GlobalContext* globalCtx, ColliderBody* body) { body->flags2 &= ~0x2; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BA30.s") -s32 func_8005BA74(UNK_TYPE arg0, UNK_TYPE arg1) -{ +s32 func_8005BA74(UNK_TYPE arg0, UNK_TYPE arg1) { return 1; } @@ -158,73 +142,64 @@ s32 func_8005BA74(UNK_TYPE arg0, UNK_TYPE arg1) #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C2BC.s") -s32 func_8005C318(GlobalContext* globalCtx, ColliderDimensions* dim) -{ +s32 func_8005C318(GlobalContext* globalCtx, ColliderDimensions* dim) { return 1; } -s32 func_8005C328(GlobalContext* globalCtx, ColliderDimensions* dest, ColliderDimensions* src) -{ +s32 func_8005C328(GlobalContext* globalCtx, ColliderDimensions* dest, ColliderDimensions* src) { *dest = *src; return 1; } -s32 ActorCollider_AllocCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 ActorCollider_AllocCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B65C(globalCtx, &collision->base); func_8005B884(globalCtx, &collision->body); func_8005C2BC(globalCtx, &collision->dim); return 1; } -s32 ActorCollider_FreeCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 ActorCollider_FreeCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B6A0(globalCtx, &collision->base); func_8005B904(globalCtx, &collision->body); func_8005C318(globalCtx, &collision->dim); return 1; } -s32 func_8005C3F4(GlobalContext* globalCtx, ColliderCylinderMain* collision, ColliderCylinderInit* src) -{ +s32 func_8005C3F4(GlobalContext* globalCtx, ColliderCylinderMain* collision, ColliderCylinderInit* src) { func_8005B6B0(globalCtx, &collision->base, &src->body); func_8005B93C(globalCtx, &collision->body, &src->inner); func_8005C328(globalCtx, &collision->dim, &src->dim); return 1; } -s32 func_8005C450(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) -{ +s32 func_8005C450(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) { func_8005B6EC(globalCtx, &collision->base, actor, &src->body); func_8005B93C(globalCtx, &collision->body, &src->inner); func_8005C328(globalCtx, &collision->dim, &src->dim); return 1; } -s32 ActorCollider_InitCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) -{ +s32 ActorCollider_InitCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, + ColliderCylinderInit* src) { func_8005B72C(globalCtx, &collision->base, actor, &src->body); func_8005B93C(globalCtx, &collision->body, &src->inner); func_8005C328(globalCtx, &collision->dim, &src->dim); return 1; } -s32 func_8005C508(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005C508(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B76C(globalCtx, &collision->base); func_8005B9B0(globalCtx, &collision->body); return 1; } -s32 func_8005C540(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005C540(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B784(globalCtx, &collision->base); func_8005B9E8(globalCtx, &collision->body); return 1; } -s32 func_8005C578(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005C578(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B79C(globalCtx, &collision->base); func_8005BA1C(globalCtx, &collision->body); return 1; @@ -232,8 +207,7 @@ s32 func_8005C578(GlobalContext* globalCtx, ColliderCylinderMain* collision) #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C5B0.s") -s32 func_8005C5F8(UNK_TYPE arg0, UNK_TYPE arg1) -{ +s32 func_8005C5F8(UNK_TYPE arg0, UNK_TYPE arg1) { return 1; } @@ -269,55 +243,48 @@ s32 func_8005CEB4(GlobalContext* globalCtx, ColliderDimensions* dim) { #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CF90.s") -s32 func_8005D018(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005D018(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B65C(globalCtx, &collision->base); func_8005B884(globalCtx, &collision->body); func_8005CE6C(globalCtx, &collision->dim); return 1; } -s32 func_8005D060(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005D060(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B6A0(globalCtx, &collision->base); func_8005B904(globalCtx, &collision->body); func_8005CEB4(globalCtx, &collision->dim); return 1; } -s32 func_8005D0A8(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) -{ +s32 func_8005D0A8(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) { func_8005B6EC(globalCtx, &collision->base, actor, &src->body); func_8005B93C(globalCtx, &collision->body, &src->inner); func_8005CF90(globalCtx, &collision->dim, &src->dim); return 1; } -s32 func_8005D104(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) -{ +s32 func_8005D104(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src) { func_8005B72C(globalCtx, &collision->base, actor, &src->body); func_8005B93C(globalCtx, &collision->body, &src->inner); func_8005CF90(globalCtx, &collision->dim, &src->dim); return 1; } -s32 func_8005D160(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005D160(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B76C(globalCtx, &collision->base); func_8005B9B0(globalCtx, &collision->body); func_8005CEC4(globalCtx, &collision->dim); return 1; } -s32 func_8005D1A8(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005D1A8(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B784(globalCtx, &collision->base); func_8005B9E8(globalCtx, &collision->body); return 1; } -s32 func_8005D1E0(GlobalContext* globalCtx, ColliderCylinderMain* collision) -{ +s32 func_8005D1E0(GlobalContext* globalCtx, ColliderCylinderMain* collision) { func_8005B79C(globalCtx, &collision->base); func_8005BA1C(globalCtx, &collision->body); return 1; @@ -331,9 +298,7 @@ s32 func_8005D1E0(GlobalContext* globalCtx, ColliderCylinderMain* collision) #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D3BC.s") -void func_8005D400(UNK_TYPE arg0, UNK_TYPE arg1) -{ - +void func_8005D400(UNK_TYPE arg0, UNK_TYPE arg1) { } #pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D40C.s") diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 0625a2b542..cb57394771 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -1,8 +1,7 @@ #include #include -void SaveContext_Init(void) -{ +void SaveContext_Init(void) { bzero(&gSaveContext, sizeof(gSaveContext)); D_8015FA88 = 0; D_8015FA8C = 0; @@ -18,4 +17,3 @@ void SaveContext_Init(void) gSaveContext.transition_type = 0xFF; gSaveContext.unk_13EE = 50; } - diff --git a/src/code/z_construct.c b/src/code/z_construct.c index 5555ed40f2..59c6e11a4f 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,15 +1,13 @@ -#include +#include #include -void func_80110990(GlobalContext* globalCtx) -{ +void func_80110990(GlobalContext* globalCtx) { func_80080F44(globalCtx); } #ifdef NON_MATCHING // regalloc, stack usage and minor ordering differences -void func_801109B0(GlobalContext* globalCtx) -{ +void func_801109B0(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s32 parameterStart; s32 parameterSize; @@ -32,9 +30,9 @@ void func_801109B0(GlobalContext* globalCtx) interfaceCtx->unk_228 = XREG(95); interfaceCtx->minimapAlpha = 0; interfaceCtx->unk_260 = 0; - interfaceCtx->unk_244 = interfaceCtx->aAlpha = interfaceCtx->bAlpha = - interfaceCtx->cLeftAlpha = interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha = - interfaceCtx->healthAlpha = interfaceCtx->startAlpha = interfaceCtx->magicAlpha = 0; + interfaceCtx->unk_244 = interfaceCtx->aAlpha = interfaceCtx->bAlpha = interfaceCtx->cLeftAlpha = + interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha = interfaceCtx->healthAlpha = interfaceCtx->startAlpha = + interfaceCtx->magicAlpha = 0; parameterStart = _parameter_staticSegmentRomStart; parameterSize = _parameter_staticSegmentRomEnd - parameterStart; @@ -48,7 +46,7 @@ void func_801109B0(GlobalContext* globalCtx) if (interfaceCtx->parameterSegment == NULL) __assert("parameter->parameterSegment != NULL", "../z_construct.c", 161); - + DmaMgr_SendRequest1(interfaceCtx->parameterSegment, parameterStart, parameterSize, "../z_construct.c", 162); interfaceCtx->do_actionSegment = Game_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166); @@ -69,7 +67,8 @@ void func_801109B0(GlobalContext* globalCtx) else do_actionOffset = 0x5700; - DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, do_actionStart + do_actionOffset, 0x300, "../z_construct.c", 174); + DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, do_actionStart + do_actionOffset, 0x300, "../z_construct.c", + 174); if (gSaveContext.language == 0) do_actionOffset = 0x480; @@ -78,7 +77,8 @@ void func_801109B0(GlobalContext* globalCtx) else do_actionOffset = 0x5B80; - DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300), do_actionStart + do_actionOffset, 0x180, "../z_construct.c", 178); + DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300), do_actionStart + do_actionOffset, 0x180, + "../z_construct.c", 178); interfaceCtx->icon_itemSegment = Game_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190); @@ -89,45 +89,42 @@ void func_801109B0(GlobalContext* globalCtx) if (interfaceCtx->icon_itemSegment == NULL) __assert("parameter->icon_itemSegment != NULL", "../z_construct.c", 193); - osSyncPrintf("Register_Item[%x, %x, %x, %x]\n", - gSaveContext.equips.button_items[0], gSaveContext.equips.button_items[1], - gSaveContext.equips.button_items[2], gSaveContext.equips.button_items[3]); + osSyncPrintf("Register_Item[%x, %x, %x, %x]\n", gSaveContext.equips.button_items[0], + gSaveContext.equips.button_items[1], gSaveContext.equips.button_items[2], + gSaveContext.equips.button_items[3]); if (gSaveContext.equips.button_items[0] < 0xF0) DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment, - _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[0] * 0x80, - 0x1000, "../z_construct.c", 198); + _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[0] * 0x80, 0x1000, + "../z_construct.c", 198); else if (gSaveContext.equips.button_items[0] != 0xFF) DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment, - _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[0] * 0x80, - 0x1000, "../z_construct.c", 203); + _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[0] * 0x80, 0x1000, + "../z_construct.c", 203); if (gSaveContext.equips.button_items[1] < 0xF0) DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x1000), - _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[1] * 0x80, - 0x1000, "../z_construct.c", 209); + _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[1] * 0x80, 0x1000, + "../z_construct.c", 209); if (gSaveContext.equips.button_items[2] < 0xF0) DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x2000), - _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[2] * 0x80, - 0x1000, "../z_construct.c", 214); + _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[2] * 0x80, 0x1000, + "../z_construct.c", 214); if (gSaveContext.equips.button_items[3] < 0xF0) DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x3000), - _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[3] * 0x80, - 0x1000, "../z_construct.c", 219); + _icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[3] * 0x80, 0x1000, + "../z_construct.c", 219); osSyncPrintf("EVENT=%d\n", gSaveContext.timer_1_state); - if ((gSaveContext.timer_1_state == 4) || (gSaveContext.timer_1_state == 8) || - (gSaveContext.timer_2_state == 4) || (gSaveContext.timer_2_state == 10)) - { + if ((gSaveContext.timer_1_state == 4) || (gSaveContext.timer_1_state == 8) || (gSaveContext.timer_2_state == 4) || + (gSaveContext.timer_2_state == 10)) { osSyncPrintf("restart_flag=%d\n", gSaveContext.respawn_flag); - if ((gSaveContext.respawn_flag == -1) || (gSaveContext.respawn_flag == 1)) - { - if (gSaveContext.timer_1_state == 4) - { + if ((gSaveContext.respawn_flag == -1) || (gSaveContext.respawn_flag == 1)) { + if (gSaveContext.timer_1_state == 4) { gSaveContext.timer_1_state = 1; gSaveContext.timer_x[0] = 140; gSaveContext.timer_y[0] = 80; @@ -147,8 +144,7 @@ void func_801109B0(GlobalContext* globalCtx) gSaveContext.timer_y[temp] = 46; } - if ((gSaveContext.timer_1_state >= 11) && (gSaveContext.timer_1_state < 16)) - { + if ((gSaveContext.timer_1_state >= 11) && (gSaveContext.timer_1_state < 16)) { gSaveContext.timer_1_state = 0; // Translates to: "Timer Stop!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf("タイマー停止!!!!!!!!!!!!!!!!!!!!! = %d\n", gSaveContext.timer_1_state); @@ -179,8 +175,7 @@ void func_801109B0(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_construct/func_801109B0.s") #endif -void func_80110F68(GlobalContext* globalCtx) -{ +void func_80110F68(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; s32 pad; @@ -202,16 +197,16 @@ void func_80110F68(GlobalContext* globalCtx) // Translates to: "Textbox game_alloc=%x" osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200); - if (msgCtx->textboxSegment == NULL) + if (msgCtx->textboxSegment == NULL) { __assert("message->fukidashiSegment != NULL", "../z_construct.c", 352); + } func_8006EF10(&globalCtx->msgCtx.unk_128); YREG(31) = 0; } -void func_80111070(void) -{ +void func_80111070(void) { YREG(8) = 0xA; YREG(14) = 0; YREG(15) = 0; @@ -526,8 +521,7 @@ void func_80111070(void) WREG(94) = 3; WREG(95) = 6; - if (gSaveContext.game_mode == 0) - { + if (gSaveContext.game_mode == 0) { VREG(0) = 0x34; VREG(1) = 0x24; VREG(2) = 0xD6; @@ -618,7 +612,6 @@ void func_80111070(void) VREG(92) = -0x3F; } -void func_80112098(GlobalContext* globalCtx) -{ +void func_80112098(GlobalContext* globalCtx) { func_80111070(); } diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 451443a6bc..e0c1c4f9f8 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -5,73 +5,43 @@ #include #include -typedef struct -{ +typedef struct { u8 x; u8 y; u8 colorId; char text[0x15]; } PrintTextBuffer; -typedef struct -{ +typedef struct { u16 push; u16 held; } InputCombo; -GameInfo* gGameInfo; -int D_8015FA94; //no known symbols +GameInfo* gGameInfo; +int D_8015FA94; // no known symbols PrintTextBuffer D_8015FA98[0x16]; -s16 D_8011E0B0 = 0; //PrintTextBuffer index +s16 D_8011E0B0 = 0; // PrintTextBuffer index Color_RGBA8 printTextColors[] = { - { 0xFF, 0xFF, 0x20, 0xC0 }, - { 0xFF, 0x96, 0x80, 0xC0 }, - { 0x80, 0x60, 0x00, 0x40 }, - { 0xC0, 0x80, 0x10, 0x80 }, - { 0xFF, 0xC0, 0x20, 0x80 }, - { 0xE6, 0xE6, 0xDC, 0x40 }, - { 0x80, 0x96, 0xFF, 0x80 }, - { 0x80, 0xFF, 0x20, 0x80 }, + { 0xFF, 0xFF, 0x20, 0xC0 }, { 0xFF, 0x96, 0x80, 0xC0 }, { 0x80, 0x60, 0x00, 0x40 }, { 0xC0, 0x80, 0x10, 0x80 }, + { 0xFF, 0xC0, 0x20, 0x80 }, { 0xE6, 0xE6, 0xDC, 0x40 }, { 0x80, 0x96, 0xFF, 0x80 }, { 0x80, 0xFF, 0x20, 0x80 }, }; InputCombo inputCombos[REG_GROUPS] = { - { L_TRIG, U_CBUTTONS }, - { L_TRIG, L_CBUTTONS }, - { L_TRIG, D_CBUTTONS }, - { L_TRIG, A_BUTTON }, - { R_TRIG, D_CBUTTONS }, - { L_TRIG, R_CBUTTONS }, - { L_TRIG, R_TRIG }, - { L_TRIG, L_JPAD }, - { L_TRIG, R_JPAD }, - { L_TRIG, U_JPAD }, - { L_TRIG, B_BUTTON }, - { L_TRIG, Z_TRIG }, - { L_TRIG, D_JPAD }, - { R_TRIG, A_BUTTON }, - { R_TRIG, B_BUTTON }, - { R_TRIG, Z_TRIG }, - { R_TRIG, L_TRIG }, - { R_TRIG, U_CBUTTONS }, - { R_TRIG, R_CBUTTONS }, - { R_TRIG, L_JPAD }, - { R_TRIG, L_CBUTTONS }, - { R_TRIG, START_BUTTON }, - { L_TRIG, START_BUTTON }, - { R_TRIG, R_JPAD }, - { R_TRIG, U_JPAD }, - { START_BUTTON, R_TRIG }, - { START_BUTTON, A_BUTTON }, - { START_BUTTON, B_BUTTON }, + { L_TRIG, U_CBUTTONS }, { L_TRIG, L_CBUTTONS }, { L_TRIG, D_CBUTTONS }, { L_TRIG, A_BUTTON }, + { R_TRIG, D_CBUTTONS }, { L_TRIG, R_CBUTTONS }, { L_TRIG, R_TRIG }, { L_TRIG, L_JPAD }, + { L_TRIG, R_JPAD }, { L_TRIG, U_JPAD }, { L_TRIG, B_BUTTON }, { L_TRIG, Z_TRIG }, + { L_TRIG, D_JPAD }, { R_TRIG, A_BUTTON }, { R_TRIG, B_BUTTON }, { R_TRIG, Z_TRIG }, + { R_TRIG, L_TRIG }, { R_TRIG, U_CBUTTONS }, { R_TRIG, R_CBUTTONS }, { R_TRIG, L_JPAD }, + { R_TRIG, L_CBUTTONS }, { R_TRIG, START_BUTTON }, { L_TRIG, START_BUTTON }, { R_TRIG, R_JPAD }, + { R_TRIG, U_JPAD }, { START_BUTTON, R_TRIG }, { START_BUTTON, A_BUTTON }, { START_BUTTON, B_BUTTON }, { START_BUTTON, R_CBUTTONS }, }; char regChar[] = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb"; -//initialize GameInfo -void func_800636C0() -{ +// initialize GameInfo +void func_800636C0() { s32 i; gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 260); @@ -80,26 +50,22 @@ void func_800636C0() gGameInfo->regCur = 0; gGameInfo->dpadLast = 0; gGameInfo->repeat = 0; - for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) - { + for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) { gGameInfo->data[i] = 0; } } -//Called when free movement is active. -//8011D394 to enable camera debugger -void func_8006375C(s32 arg0, s32 arg1, float* d_80855320) -{ - +// Called when free movement is active. +// 8011D394 to enable camera debugger +void func_8006375C(s32 arg0, s32 arg1, float* d_80855320) { } -#ifdef NON_MATCHING //regalloc -//Copy Camera Debugger Text -void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) -{ +#ifdef NON_MATCHING // regalloc +// Copy Camera Debugger Text +void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) { PrintTextBuffer* buf; char* bufText; - s16 i; //v1 + s16 i; // v1 buf = &D_8015FA98[D_8011E0B0]; if (D_8011E0B0 < 0x16) { @@ -112,9 +78,11 @@ void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) bufText = buf->text + 1; if (*buf->text = *text++) { - do if (i++ > 0x14) { - break; - } while (*bufText++ = *text++); + do + if (i++ > 0x14) { + break; + } + while (*bufText++ = *text++); } *bufText = '\0'; @@ -124,34 +92,31 @@ void func_8006376C(u8 x, u8 y, u8 colorId, const char* text) #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006376C.s") -#endif +#endif -//Draw Text -void func_80063828(GfxPrint* gfxPrint) -{ +// Draw Text +void func_80063828(GfxPrint* gfxPrint) { s32 i; Color_RGBA8* color; PrintTextBuffer* buffer; char* text; i = 0; - if (D_8011E0B0 > 0) - { - do - { + if (D_8011E0B0 > 0) { + do { buffer = &D_8015FA98[i]; text = buffer->text; color = &printTextColors[buffer->colorId]; GfxPrint_SetColor(gfxPrint, color->r, color->g, color->b, color->a); GfxPrint_SetPos(gfxPrint, buffer->x, buffer->y); - GfxPrint_Printf(gfxPrint, "%s", text); + GfxPrint_Printf(gfxPrint, "%s", text); i += 1; } while (i < D_8011E0B0); } } -//Edit REG +// Edit REG void func_8006390C(Input* input) { s32 dpad; @@ -162,18 +127,14 @@ void func_8006390C(Input* input) { regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE; dpad = input->raw.pad & 0xF00; - if (!~(input->raw.pad | ~L_TRIG) || - !~(input->raw.pad | ~R_TRIG) || - !~(input->raw.pad | ~START_BUTTON)) { + if (!~(input->raw.pad | ~L_TRIG) || !~(input->raw.pad | ~R_TRIG) || !~(input->raw.pad | ~START_BUTTON)) { input_combo = inputCombos; - for (i = 0; i < REG_GROUPS; i++) - { - if (~(~input_combo->push | input->raw.pad) || - ~(~input_combo->held | input->padPressed)) { + for (i = 0; i < REG_GROUPS; i++) { + if (~(~input_combo->push | input->raw.pad) || ~(~input_combo->held | input->padPressed)) { input_combo++; - } - else + } else { break; + } } if (i < REG_GROUPS) { @@ -184,10 +145,8 @@ void func_8006390C(Input* input) { gGameInfo->regGroup = i; gGameInfo->regPage = 0; } - } - else { - switch (gGameInfo->regPage - 1) - { + } else { + switch (gGameInfo->regPage - 1) { case 0: case 1: case 2: @@ -195,80 +154,73 @@ void func_8006390C(Input* input) { case 4: case 5: - if (dpad == gGameInfo->dpadLast) { - gGameInfo->repeat--; - if (gGameInfo->repeat < 0) { - gGameInfo->repeat = 1; + if (dpad == gGameInfo->dpadLast) { + gGameInfo->repeat--; + if (gGameInfo->repeat < 0) { + gGameInfo->repeat = 1; + } else { + dpad ^= gGameInfo->dpadLast; + } + } else { + gGameInfo->repeat = 0x10; + gGameInfo->dpadLast = dpad; } - else { - dpad ^= gGameInfo->dpadLast; - } - } - else { - gGameInfo->repeat = 0x10; - gGameInfo->dpadLast = dpad; - } - increment = - (dpad & R_JPAD) ? ( - !~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? 1000 : - !~(input->raw.pad | ~A_BUTTON) ? 100 : - !~(input->raw.pad | ~B_BUTTON) ? 10 : 1) : - (dpad & L_JPAD) ? ( - !~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) ? -1000 : - !~(input->raw.pad | ~A_BUTTON) ? -100 : - !~(input->raw.pad | ~B_BUTTON) ? -10 : -1) : - 0; + increment = (dpad & R_JPAD) + ? (!~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) + ? 1000 + : !~(input->raw.pad | ~A_BUTTON) ? 100 : !~(input->raw.pad | ~B_BUTTON) ? 10 : 1) + : (dpad & L_JPAD) ? (!~(input->raw.pad | ~(A_BUTTON | B_BUTTON)) + ? -1000 + : !~(input->raw.pad | ~A_BUTTON) + ? -100 + : !~(input->raw.pad | ~B_BUTTON) ? -10 : -1) + : 0; - gGameInfo->data[gGameInfo->regCur + regGroup] += increment; - if (dpad & U_JPAD) { - gGameInfo->regCur--; - if (gGameInfo->regCur < 0) { - gGameInfo->regCur = REG_PER_PAGE - 1; + gGameInfo->data[gGameInfo->regCur + regGroup] += increment; + if (dpad & U_JPAD) { + gGameInfo->regCur--; + if (gGameInfo->regCur < 0) { + gGameInfo->regCur = REG_PER_PAGE - 1; + } + } else if (dpad & D_JPAD) { + gGameInfo->regCur++; + if (gGameInfo->regCur >= REG_PER_PAGE) { + gGameInfo->regCur = 0; + } } - } - else if (dpad & D_JPAD) { - gGameInfo->regCur++; - if (gGameInfo->regCur >= REG_PER_PAGE) { - gGameInfo->regCur = 0; + if (iREG(0)) { + iREG(0) = 0; + func_800AA000(0, iREG(1), iREG(2), iREG(3)); } - } - if (iREG(0)) { - iREG(0) = 0; - func_800AA000(0, iREG(1), iREG(2), iREG(3)); - } } } } -//Draw Memory Viewer -void func_80063C04(GfxPrint* gfxPrint) -{ +// Draw Memory Viewer +void func_80063C04(GfxPrint* gfxPrint) { s32 i; s32 page; s32 regGroup; - s32 test; //removing affects stack + s32 test; // removing affects stack char name[3]; page = (gGameInfo->regPage * REG_PER_PAGE) - REG_PER_PAGE; regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE; - //set up register name string + // set up register name string name[0] = 'R'; - name[1] = regChar[gGameInfo->regGroup]; //r_group type char + name[1] = regChar[gGameInfo->regGroup]; // r_group type char name[2] = '\0'; GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); - for (i = 0; i != REG_PER_PAGE; i++) - { - if (i == gGameInfo->regCur) - { + for (i = 0; i != REG_PER_PAGE; i++) { + if (i == gGameInfo->regCur) { GfxPrint_SetColor(gfxPrint, 0, 0xff, 0xff, 0xff); } GfxPrint_SetPos(gfxPrint, 3, i + 5); GfxPrint_Printf(gfxPrint, "%s%02d%6d", &name, page + i, gGameInfo->data[i + regGroup]); - if (i == gGameInfo->regCur) - { + if (i == gGameInfo->regCur) { GfxPrint_SetColor(gfxPrint, 0, 0x80, 0x80, 0x80); } } @@ -281,7 +233,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) { void* unk2[6]; GfxPrint gfxPrint; void* unk[2]; - Gfx* dlFrame[4]; //stores state of GfxCtx next ptrs + Gfx* dlFrame[4]; // stores state of GfxCtx next ptrs func_800C6AC4(&dlFrame, gfxCtx, "../z_debug.c", 628); GfxPrint_Ctor(&gfxPrint); @@ -303,7 +255,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) { gSPEndDisplayList(sp7C++); func_800C6C28(sp78, sp7C); gfxCtx->polyOpa.p = sp7C; - if (0); + if (0) {} func_800C6B54(&dlFrame, gfxCtx, "../z_debug.c", 664); GfxPrint_Dtor(&gfxPrint); } diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index e961e9c742..e27afafeb7 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -1,25 +1,22 @@ #include #include -typedef struct -{ +typedef struct { /* 0x00 */ s16 drawType; // indicates which draw function to use when displaying the object - /* 0x04 */ u32 drawArg; // segment address (display list or texture) passed to the draw funciton when called -} DebugDispObjectInfo; // size = 0x8 + /* 0x04 */ u32 drawArg; // segment address (display list or texture) passed to the draw funciton when called +} DebugDispObjectInfo; // size = 0x8 typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, u32, GlobalContext*); static void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, GlobalContext* globalCtx); static void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, u32 dlist, GlobalContext* globalCtx); -static DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] = -{ +static DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] = { DebugDisplay_DrawSpriteI8, DebugDisplay_DrawPolygon, }; -static DebugDispObjectInfo sDebugObjectInfoTable[] = -{ +static DebugDispObjectInfo sDebugObjectInfoTable[] = { { 0, 0x040035F0 }, // Circle { 0, 0x040038F0 }, // Cross { 0, 0x040036F0 }, // Ball @@ -32,15 +29,13 @@ static Lights1 sDebugObjectLights = gdSPDefLights1(0x80, 0x80, 0x80, 0xFF, 0xFF, static DebugDispObject* sDebugObjectListHead; -void DebugDisplay_Init(void) -{ +void DebugDisplay_Init(void) { sDebugObjectListHead = NULL; } -DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, - f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, - s16 type, GraphicsContext* gfxCtx) -{ +DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, + f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, + GraphicsContext* gfxCtx) { DebugDispObject* prevHead = sDebugObjectListHead; sDebugObjectListHead = Graph_Alloc(gfxCtx, sizeof(DebugDispObject)); @@ -64,21 +59,18 @@ DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, return sDebugObjectListHead; } -void DebugDisplay_DrawObjects(GlobalContext* globalCtx) -{ +void DebugDisplay_DrawObjects(GlobalContext* globalCtx) { DebugDispObject* dispObj = sDebugObjectListHead; DebugDispObjectInfo* objInfo; - while (dispObj != NULL) - { + while (dispObj != NULL) { objInfo = &sDebugObjectInfoTable[dispObj->type]; sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, globalCtx); dispObj = dispObj->next; } } -static void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, GlobalContext* globalCtx) -{ +static void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -93,24 +85,17 @@ static void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, Glo Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY); Matrix_RotateXYZ(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY); - gDPLoadTextureBlock(gfxCtx->polyXlu.p++, - texture, - G_IM_FMT_I, - G_IM_SIZ_8b, - 16, 16, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gfxCtx->polyXlu.p++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 189), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 189), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, &D_04004298); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_debug_display.c", 192); } -static void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, u32 dlist, GlobalContext* globalCtx) -{ +static void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, u32 dlist, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -124,7 +109,8 @@ static void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, u32 dlist, Global func_800D1694(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, dlist); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_debug_display.c", 231); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index c24ab06ade..bbc125e269 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -13,70 +13,34 @@ void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx); void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx); void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx); -CutsceneStateHandler sCsStateHandlers1[] = -{ - func_80064720, - func_80064760, - func_80064720, - func_80068D84, - func_80064720, +CutsceneStateHandler sCsStateHandlers1[] = { + func_80064720, func_80064760, func_80064720, func_80068D84, func_80064720, }; -CutsceneStateHandler sCsStateHandlers2[] = -{ - func_80064720, - func_800647C0, - func_80068C3C, - func_80068DC0, - func_80068C3C, +CutsceneStateHandler sCsStateHandlers2[] = { + func_80064720, func_800647C0, func_80068C3C, func_80068DC0, func_80068C3C, }; u8 sTitleCsState = 0; // TODO: use symbols for these cutscene locations once scenes and rooms are in C -EntranceCutscene sEntranceCutsceneTable[] = -{ - { 0x0185, 2, 0xA0, 0x02013AA0 }, - { 0x013D, 2, 0xA1, 0x02007EA0 }, - { 0x00DB, 2, 0xA3, 0x0200A540 }, - { 0x0108, 2, 0xA4, 0x02003D70 }, - { 0x0138, 1, 0xA5, 0x02003F40 }, - { 0x014D, 2, 0xA6, 0x02008400 }, - { 0x0053, 2, 0xA7, 0x0200CE00 }, - { 0x0000, 2, 0xA8, 0x0200B650 }, - { 0x028A, 0, 0x18, 0x0200F9E0 }, - { 0x0292, 0, 0x18, 0x0200FF00 }, - { 0x028E, 0, 0x18, 0x02010550 }, - { 0x0476, 0, 0x18, 0x02010B30 }, - { 0x050F, 1, 0xA9, 0x0200BB80 }, - { 0x0102, 2, 0xB1, 0x02007A30 }, - { 0x0117, 2, 0xB2, 0x020031E0 }, - { 0x0129, 2, 0xB3, 0x02006490 }, - { 0x0157, 2, 0xB4, 0x02005BD0 }, - { 0x0028, 2, 0xB5, 0x02015600 }, - { 0x00E4, 2, 0xB6, 0x020070C0 }, - { 0x0225, 2, 0xB7, 0x02004A80 }, - { 0x0123, 2, 0xB8, 0x02007990 }, - { 0x0147, 2, 0xB9, 0x020076D0 }, - { 0x0138, 0, 0xBA, 0x02004280 }, - { 0x0574, 2, 0x5A, 0x020028E0 }, - { 0x0538, 2, 0xBB, 0x0201E790 }, - { 0x053C, 2, 0xBC, 0x0201EF70 }, - { 0x0540, 2, 0xBD, 0x02021380 }, - { 0x0544, 2, 0xBE, 0x0201E3E0 }, - { 0x0548, 2, 0xBF, 0x0201DF90 }, - { 0x054C, 2, 0xAD, 0x0201EB40 }, - { 0x008D, 0, 0xC0, 0x02002BB0 }, - { 0x03B4, 0, 0xC7, 0x020055C0 }, - { 0x0246, 2, 0xB9, 0x020076D0 }, +EntranceCutscene sEntranceCutsceneTable[] = { + { 0x0185, 2, 0xA0, 0x02013AA0 }, { 0x013D, 2, 0xA1, 0x02007EA0 }, { 0x00DB, 2, 0xA3, 0x0200A540 }, + { 0x0108, 2, 0xA4, 0x02003D70 }, { 0x0138, 1, 0xA5, 0x02003F40 }, { 0x014D, 2, 0xA6, 0x02008400 }, + { 0x0053, 2, 0xA7, 0x0200CE00 }, { 0x0000, 2, 0xA8, 0x0200B650 }, { 0x028A, 0, 0x18, 0x0200F9E0 }, + { 0x0292, 0, 0x18, 0x0200FF00 }, { 0x028E, 0, 0x18, 0x02010550 }, { 0x0476, 0, 0x18, 0x02010B30 }, + { 0x050F, 1, 0xA9, 0x0200BB80 }, { 0x0102, 2, 0xB1, 0x02007A30 }, { 0x0117, 2, 0xB2, 0x020031E0 }, + { 0x0129, 2, 0xB3, 0x02006490 }, { 0x0157, 2, 0xB4, 0x02005BD0 }, { 0x0028, 2, 0xB5, 0x02015600 }, + { 0x00E4, 2, 0xB6, 0x020070C0 }, { 0x0225, 2, 0xB7, 0x02004A80 }, { 0x0123, 2, 0xB8, 0x02007990 }, + { 0x0147, 2, 0xB9, 0x020076D0 }, { 0x0138, 0, 0xBA, 0x02004280 }, { 0x0574, 2, 0x5A, 0x020028E0 }, + { 0x0538, 2, 0xBB, 0x0201E790 }, { 0x053C, 2, 0xBC, 0x0201EF70 }, { 0x0540, 2, 0xBD, 0x02021380 }, + { 0x0544, 2, 0xBE, 0x0201E3E0 }, { 0x0548, 2, 0xBF, 0x0201DF90 }, { 0x054C, 2, 0xAD, 0x0201EB40 }, + { 0x008D, 0, 0xC0, 0x02002BB0 }, { 0x03B4, 0, 0xC7, 0x020055C0 }, { 0x0246, 2, 0xB9, 0x020076D0 }, { 0x05E8, 2, 0xC6, 0x0200C9D0 }, }; // Unused, seems to be an early list of dungeon entrance cutscene locations -u32 D_8011E304[] = -{ - 0x0200B650, 0x02015600, 0x02014F80, 0x02003F80, 0x02000330, 0x0201DA50 -}; +u32 D_8011E304[] = { 0x0200B650, 0x02015600, 0x02014F80, 0x02003F80, 0x02000330, 0x0201DA50 }; u16 D_8015FCC0; u16 D_8015FCC2; @@ -84,14 +48,13 @@ u16 D_8015FCC4; s16 D_8015FCC6; u8 D_8015FCC8; s16 D_8015FCCA; -u16 D_8015FCCC; // only written to, never read +u16 D_8015FCCC; // only written to, never read s8 D_8015FCD0[20]; // unreferenced -u8 D_8015FCE4; // only written to, never read +u8 D_8015FCE4; // only written to, never read void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx); -void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneContext* csCtx) -{ +void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneContext* csCtx) { u8 pad[0x1C]; GfxPrint printer; u8 pad2[8]; @@ -110,47 +73,42 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte GfxPrint_Dtor(&printer); } -void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx) { csCtx->state = CS_STATE_IDLE; csCtx->unk_0C = 0.0f; } -void func_80064520(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_80064520(GlobalContext* globalCtx, CutsceneContext* csCtx) { csCtx->state = CS_STATE_SKIPPABLE_INIT; csCtx->linkAction = NULL; } -void func_80064534(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ - if (csCtx->state != CS_STATE_UNSKIPPABLE_EXEC) +void func_80064534(GlobalContext* globalCtx, CutsceneContext* csCtx) { + if (csCtx->state != CS_STATE_UNSKIPPABLE_EXEC) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; + } } -void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ - if (gSaveContext.cutscene_index < 0xFFF0) +void func_80064558(GlobalContext* globalCtx, CutsceneContext* csCtx) { + if (gSaveContext.cutscene_index < 0xFFF0) { sCsStateHandlers1[csCtx->state](globalCtx, csCtx); + } } #ifdef NON_MATCHING // minor ordering and regalloc differences -void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) { CutsceneStateHandler handler; if (!~(globalCtx->state.input[0].padPressed | -0x201) && (csCtx->state == CS_STATE_IDLE) && - (gSaveContext.scene_setup_index >= 4)) - { + (gSaveContext.scene_setup_index >= 4)) { D_8015FCC8 = 0; gSaveContext.cutscene_index = 0xFFFD; gSaveContext.cutscene_trigger = 1; } if (!~(globalCtx->state.input[0].padPressed | -0x801) && (csCtx->state == CS_STATE_IDLE) && - (gSaveContext.scene_setup_index >= 4) && (D_8011D394 == 0)) - { + (gSaveContext.scene_setup_index >= 4) && (D_8011D394 == 0)) { D_8015FCC8 = 1; gSaveContext.cutscene_index = 0xFFFD; gSaveContext.cutscene_trigger = 1; @@ -159,16 +117,14 @@ void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) if ((gSaveContext.cutscene_trigger != 0) && (globalCtx->sceneLoadFlag == 0x14)) gSaveContext.cutscene_trigger = 0; - if ((gSaveContext.cutscene_trigger != 0) && (csCtx->state == CS_STATE_IDLE)) - { + if ((gSaveContext.cutscene_trigger != 0) && (csCtx->state == CS_STATE_IDLE)) { // Translates to: "CUTSCENE START REQUEST ANNOUNCEMENT!" osSyncPrintf("\nデモ開始要求 発令!"); gSaveContext.cutscene_index = 0xFFFD; gSaveContext.cutscene_trigger = 1; } - if (gSaveContext.cutscene_index >= 0xFFF0) - { + if (gSaveContext.cutscene_index >= 0xFFF0) { func_80068ECC(globalCtx, csCtx); handler = sCsStateHandlers2[csCtx->state]; handler(globalCtx, csCtx); @@ -178,36 +134,29 @@ void func_800645A0(GlobalContext* globalCtx, CutsceneContext* csCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/func_800645A0.s") #endif -void func_80064720(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ - +void func_80064720(GlobalContext* globalCtx, CutsceneContext* csCtx) { } -u32 func_8006472C(GlobalContext* globalCtx, CutsceneContext* csCtx, f32 target) -{ +u32 func_8006472C(GlobalContext* globalCtx, CutsceneContext* csCtx, f32 target) { return Math_ApproxF(&csCtx->unk_0C, target, 0.1f); } -void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) { Interface_ChangeAlpha(1); func_800B3840(0x20); - if (func_8006472C(globalCtx, csCtx, 1.0f)) - { + if (func_8006472C(globalCtx, csCtx, 1.0f)) { func_800F68BC(1); csCtx->state++; } } -void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) { func_80068C3C(globalCtx, csCtx); Interface_ChangeAlpha(1); func_800B3840(0x20); - if (func_8006472C(globalCtx, csCtx, 1.0f)) - { + if (func_8006472C(globalCtx, csCtx, 1.0f)) { func_800F68BC(1); csCtx->state++; } @@ -216,16 +165,14 @@ void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) // Command 3: Misc. Actions #ifdef NON_MATCHING // regalloc and minor ordering differences -void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) -{ +void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { Player* player = PLAYER; f32 temp; u8 sp3F; sp3F = 0; - if ((csCtx->frames < cmd->startFrame) || - (csCtx->frames >= cmd->endFrame) && (cmd->endFrame != cmd->startFrame)) + if ((csCtx->frames < cmd->startFrame) || (csCtx->frames >= cmd->endFrame) && (cmd->endFrame != cmd->startFrame)) return; temp = func_8006F93C(cmd->endFrame - 1, cmd->startFrame, csCtx->frames); @@ -233,27 +180,23 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* if (csCtx->frames == cmd->startFrame) sp3F = 1; - switch (cmd->base) - { + switch (cmd->base) { case 1: - if (sp3F != 0) - { + if (sp3F != 0) { func_800F6D58(0xE, 4, 0x3F); func_800F6D58(0xE, 1, 1); globalCtx->unk_10B12[0] = 0x14; } break; case 2: - if (sp3F != 0) - { + if (sp3F != 0) { func_800F6D58(0xF, 0, 0); func_800753C4(globalCtx, 3); D_8015FD70 = 1; } break; case 3: - if (sp3F != 0) - { + if (sp3F != 0) { func_8006C3D0(globalCtx, 0); if (gSaveContext.entrance_index == 0x0053) func_8006C3D0(globalCtx, 2); @@ -264,8 +207,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* globalCtx->unk_10AC4 += 0x23; break; case 7: - if (sp3F != 0) - { + if (sp3F != 0) { globalCtx->unk_10A3D = 1; globalCtx->gloomySky = 1; globalCtx->unk_10A3C = 0; @@ -295,8 +237,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* globalCtx->unk_11D30[0] = 0; break; case 12: - if (sp3F != 0) - { + if (sp3F != 0) { if (csCtx->state != CS_STATE_UNSKIPPABLE_EXEC) csCtx->state = CS_STATE_UNSKIPPABLE_INIT; } @@ -313,12 +254,11 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* break; case 15: if (sp3F != 0) - TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, player->unk_1B0, - 0xA0, 0x78, 0x90, 0x18, 0x14); + TitleCard_InitPlaceName(globalCtx, &globalCtx->actorCtx.titleCtx, player->unk_1B0, 0xA0, 0x78, 0x90, + 0x18, 0x14); break; case 16: - if (sp3F != 0) - { + if (sp3F != 0) { D_8015FCCA = func_80092F88(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 6); func_80092DAC(D_8015FCCA, 0x7FFF); func_80092E70(D_8015FCCA, 4, 0, 1000, 0); @@ -334,8 +274,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* globalCtx->gloomySkyEvent = 2; if (gSaveContext.day_time < 0x4AAB) gSaveContext.day_time += 30; - if (globalCtx->unk_10B12[1] == 0) - { + if (globalCtx->unk_10B12[1] == 0) { D_8011FB30 = 0; func_800F6D58(14, 1, 0); } @@ -370,8 +309,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* gSaveContext.day_time = 0xCAAA; break; case 26: - if ((gSaveContext.day_time < 0x3000) || (gSaveContext.day_time >= 0x4555)) - { + if ((gSaveContext.day_time < 0x3000) || (gSaveContext.day_time >= 0x4555)) { if ((gSaveContext.day_time >= 0x4555) && (gSaveContext.day_time < 0xAAAB)) globalCtx->unk_10AE3 = 1; else if ((gSaveContext.day_time >= 0xAAAB) && (gSaveContext.day_time < 0xC556)) @@ -381,19 +319,14 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } break; case 27: - if (globalCtx->state.frames & 8) - { - if (globalCtx->unk_10AB0[0] < 40) - { + if (globalCtx->state.frames & 8) { + if (globalCtx->unk_10AB0[0] < 40) { globalCtx->unk_10AB0[0] += 2; globalCtx->unk_10AB0[4] -= 3; globalCtx->unk_10AB0[5] -= 3; } - } - else - { - if (globalCtx->unk_10AB0[0] > 2) - { + } else { + if (globalCtx->unk_10AB0[0] > 2) { globalCtx->unk_10AB0[0] -= 2; globalCtx->unk_10AB0[4] += 3; globalCtx->unk_10AB0[5] += 3; @@ -437,62 +370,57 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* #endif // Command 4: Set Environment Lighting -void Cutscene_Command_SetLighting(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdEnvLighting* cmd) -{ - if (csCtx->frames == cmd->startFrame) - { +void Cutscene_Command_SetLighting(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdEnvLighting* cmd) { + if (csCtx->frames == cmd->startFrame) { globalCtx->unk_10AE3 = cmd->setting - 1; globalCtx->unk_10AFC = 1.0f; } } // Command 0x56: Play Background Music -void Cutscene_Command_PlayBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) -{ - if (csCtx->frames == cmd->startFrame) +void Cutscene_Command_PlayBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { + if (csCtx->frames == cmd->startFrame) { func_800F595C(cmd->sequence - 1); + } } // Command 0x57: Stop Background Music -void Cutscene_Command_StopBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) -{ - if (csCtx->frames == cmd->startFrame) +void Cutscene_Command_StopBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicChange* cmd) { + if (csCtx->frames == cmd->startFrame) { func_800F59E8(cmd->sequence - 1); + } } // Command 0x7C: Fade Background Music over duration -void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicFade* cmd) -{ +void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdMusicFade* cmd) { u8 var1; - if ((csCtx->frames == cmd->startFrame) && (csCtx->frames < cmd->endFrame)) - { + if ((csCtx->frames == cmd->startFrame) && (csCtx->frames < cmd->endFrame)) { var1 = cmd->endFrame - cmd->startFrame; - if (cmd->type == 3) + if (cmd->type == 3) { Audio_SetBGM(var1 << 0x10 | 0x110000FF); - else + } else { Audio_SetBGM(var1 << 0x10 | 0x100000FF); + } } } // Command 9: ? -void Cutscene_Command_09(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdUnknown9* cmd) -{ - if (csCtx->frames == cmd->startFrame) +void Cutscene_Command_09(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdUnknown9* cmd) { + if (csCtx->frames == cmd->startFrame) { func_800AA000(0.0f, cmd->unk_06, cmd->unk_07, cmd->unk_08); + } } // Command 0x8C: Set Time of Day & Environment Time #ifdef NON_MATCHING // regalloc differences -void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTime* cmd) -{ +void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTime* cmd) { s16 temp1; s16 temp2; - if (csCtx->frames == cmd->startFrame) - { + if (csCtx->frames == cmd->startFrame) { temp1 = (cmd->hour * 60.0f) / 0.021972656f; temp2 = (cmd->minute + 1) / 0.021972656f; gSaveContext.environment_time = gSaveContext.day_time = temp1 + temp2; @@ -503,25 +431,22 @@ void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTim #endif // Command 0x3E8: Code Execution (& Terminates Cutscene?) -void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) -{ +void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { Player* player = PLAYER; s32 temp = 0; - if ((gSaveContext.game_mode != 0) && (gSaveContext.game_mode != 3) && - (globalCtx->sceneNum != SCENE_SPOT00) && (csCtx->frames > 20) && - (!~(globalCtx->state.input[0].padPressed | 0xFFFF7FFF) || - !~(globalCtx->state.input[0].padPressed | -0x4001) || + if ((gSaveContext.game_mode != 0) && (gSaveContext.game_mode != 3) && (globalCtx->sceneNum != SCENE_SPOT00) && + (csCtx->frames > 20) && + (!~(globalCtx->state.input[0].padPressed | 0xFFFF7FFF) || !~(globalCtx->state.input[0].padPressed | -0x4001) || !~(globalCtx->state.input[0].padPressed | -0x1001)) && - (gSaveContext.file_num != 0xFEDC) && (globalCtx->sceneLoadFlag == 0)) - { + (gSaveContext.file_num != 0xFEDC) && (globalCtx->sceneLoadFlag == 0)) { Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); temp = 1; } if ((csCtx->frames == cmd->startFrame) || (temp != 0) || - ((csCtx->frames > 20) && (!~(globalCtx->state.input[0].padPressed | -0x1001)) && (gSaveContext.file_num != 0xFEDC))) - { + ((csCtx->frames > 20) && (!~(globalCtx->state.input[0].padPressed | -0x1001)) && + (gSaveContext.file_num != 0xFEDC))) { csCtx->state = CS_STATE_UNSKIPPABLE_EXEC; func_800F68BC(0); gSaveContext.unk_1410 = 1; @@ -529,13 +454,13 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt // Translates to: "FUTURE FORK DESIGNATION=No. [%d]" osSyncPrintf("\n分岐先指定!!=[%d]番", cmd->base); - if ((gSaveContext.game_mode != 0) && (csCtx->frames != cmd->startFrame)) + if ((gSaveContext.game_mode != 0) && (csCtx->frames != cmd->startFrame)) { gSaveContext.unk_13E7 = 1; + } gSaveContext.cutscene_index = 0; - switch (cmd->base) - { + switch (cmd->base) { case 1: globalCtx->nextEntranceIndex = 0x00A0; gSaveContext.cutscene_index = 0xFFF1; @@ -581,22 +506,19 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt case 8: gSaveContext.fw.set = 0; gSaveContext.respawn[RESPAWN_MODE_TOP].data = 0; - if (!(gSaveContext.event_chk_inf[4] & 0x20)) - { + if (!(gSaveContext.event_chk_inf[4] & 0x20)) { gSaveContext.event_chk_inf[4] |= 0x20; globalCtx->nextEntranceIndex = 0x00A0; globalCtx->sceneLoadFlag = 0x14; gSaveContext.cutscene_index = 0xFFF3; globalCtx->fadeOutTransition = 0xB; - } - else - { - if (gSaveContext.scene_setup_index < 4) - { - if (LINK_IS_CHILD) + } else { + if (gSaveContext.scene_setup_index < 4) { + if (LINK_IS_CHILD) { globalCtx->linkAgeOnLoad = 0; - else + } else { globalCtx->linkAgeOnLoad = 1; + } } globalCtx->nextEntranceIndex = 0x02CA; globalCtx->sceneLoadFlag = 0x14; @@ -1037,19 +959,14 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt globalCtx->fadeOutTransition = 3; break; case 95: - if ((gSaveContext.event_chk_inf[4] & 0x100) && - (gSaveContext.event_chk_inf[4] & 0x200) && - (gSaveContext.event_chk_inf[4] & 0x400)) - { + if ((gSaveContext.event_chk_inf[4] & 0x100) && (gSaveContext.event_chk_inf[4] & 0x200) && + (gSaveContext.event_chk_inf[4] & 0x400)) { globalCtx->nextEntranceIndex = 0x0053; globalCtx->sceneLoadFlag = 0x14; gSaveContext.cutscene_index = 0xFFF3; globalCtx->fadeOutTransition = 2; - } - else - { - switch (gSaveContext.scene_setup_index) - { + } else { + switch (gSaveContext.scene_setup_index) { case 8: globalCtx->nextEntranceIndex = 0x00FC; globalCtx->sceneLoadFlag = 0x14; @@ -1070,15 +987,12 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt } break; case 96: - if (gBitFlags[4] & gSaveContext.quest_items) - { + if (gBitFlags[4] & gSaveContext.quest_items) { globalCtx->nextEntranceIndex = 0x006B; globalCtx->sceneLoadFlag = 0x14; gSaveContext.cutscene_index = 0xFFF1; globalCtx->fadeOutTransition = 5; - } - else - { + } else { gSaveContext.event_chk_inf[12] |= 0x100; globalCtx->nextEntranceIndex = 0x0610; globalCtx->sceneLoadFlag = 0x14; @@ -1087,15 +1001,12 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt } break; case 97: - if (gBitFlags[3] & gSaveContext.quest_items) - { + if (gBitFlags[3] & gSaveContext.quest_items) { globalCtx->nextEntranceIndex = 0x006B; globalCtx->sceneLoadFlag = 0x14; gSaveContext.cutscene_index = 0xFFF1; globalCtx->fadeOutTransition = 5; - } - else - { + } else { globalCtx->nextEntranceIndex = 0x0580; globalCtx->sceneLoadFlag = 0x14; globalCtx->fadeOutTransition = 3; @@ -1138,8 +1049,7 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt globalCtx->fadeOutTransition = 2; break; case 104: - switch (sTitleCsState) - { + switch (sTitleCsState) { case 0: globalCtx->nextEntranceIndex = 0x008D; globalCtx->sceneLoadFlag = 0x14; @@ -1206,16 +1116,13 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt break; case 113: if (Flags_GetEventChkInf(0xBB) && Flags_GetEventChkInf(0xBC) && Flags_GetEventChkInf(0xBD) && - Flags_GetEventChkInf(0xBE) && Flags_GetEventChkInf(0xBF) && Flags_GetEventChkInf(0xAD)) - { + Flags_GetEventChkInf(0xBE) && Flags_GetEventChkInf(0xBF) && Flags_GetEventChkInf(0xAD)) { globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(&D_0201DA50); globalCtx->csCtx.frames = 0; gSaveContext.cutscene_trigger = 1; gSaveContext.cutscene_index = 0xFFFF; csCtx->state = CS_STATE_UNSKIPPABLE_INIT; - } - else - { + } else { gSaveContext.cutscene_index = 0xFFFF; csCtx->state = CS_STATE_UNSKIPPABLE_INIT; } @@ -1232,14 +1139,11 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt gSaveContext.transition_type = 2; break; case 116: - if (gSaveContext.event_chk_inf[12] & 0x100) - { + if (gSaveContext.event_chk_inf[12] & 0x100) { globalCtx->nextEntranceIndex = 0x0580; globalCtx->sceneLoadFlag = 0x14; globalCtx->fadeOutTransition = 3; - } - else - { + } else { globalCtx->nextEntranceIndex = 0x0610; globalCtx->sceneLoadFlag = 0x14; globalCtx->fadeOutTransition = 3; @@ -1273,67 +1177,68 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt } // Command 0x2D: Transition Effects -void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) -{ +void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { f32 temp; - if ((csCtx->frames >= cmd->startFrame) && (csCtx->frames <= cmd->endFrame)) - { + if ((csCtx->frames >= cmd->startFrame) && (csCtx->frames <= cmd->endFrame)) { globalCtx->unk_10B05 = 1; temp = func_8006F93C(cmd->endFrame, cmd->startFrame, csCtx->frames); - switch (cmd->base) - { + switch (cmd->base) { case 1: case 5: globalCtx->unk_10B06[0] = 0xA0; globalCtx->unk_10B06[1] = 0xA0; globalCtx->unk_10B06[2] = 0xA0; - if (cmd->base == 1) - { + if (cmd->base == 1) { globalCtx->unk_10B06[3] = 255.0f * temp; - if ((temp == 0.0f) && (gSaveContext.entrance_index == 0x006B)) - Audio_PlaySoundGeneral(NA_SE_SY_WHITE_OUT_S, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - else if ((temp == 0.0f) && - ((gSaveContext.entrance_index == 0x0053) || - (gSaveContext.entrance_index == 0x0138) || - (gSaveContext.entrance_index == 0x0371))) - Audio_PlaySoundGeneral(NA_SE_EV_WHITE_OUT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - else if ((temp == 0.0f) && (globalCtx->sceneNum == SCENE_GANONTIKA)) + if ((temp == 0.0f) && (gSaveContext.entrance_index == 0x006B)) { + Audio_PlaySoundGeneral(NA_SE_SY_WHITE_OUT_S, &D_801333D4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } else if ((temp == 0.0f) && + ((gSaveContext.entrance_index == 0x0053) || (gSaveContext.entrance_index == 0x0138) || + (gSaveContext.entrance_index == 0x0371))) { + Audio_PlaySoundGeneral(NA_SE_EV_WHITE_OUT, &D_801333D4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } else if ((temp == 0.0f) && (globalCtx->sceneNum == SCENE_GANONTIKA)) { func_800788CC(NA_SE_EV_WHITE_OUT); - } - else + } + } else { globalCtx->unk_10B06[3] = (1.0f - temp) * 255.0f; + } break; case 2: case 6: globalCtx->unk_10B06[0] = 0; globalCtx->unk_10B06[1] = 0; globalCtx->unk_10B06[2] = 0xFF; - if (cmd->base == 2) + if (cmd->base == 2) { globalCtx->unk_10B06[3] = 255.0f * temp; - else + } else { globalCtx->unk_10B06[3] = (1.0f - temp) * 255.0f; + } break; case 3: case 7: globalCtx->unk_10B06[0] = 0xFF; globalCtx->unk_10B06[1] = 0; globalCtx->unk_10B06[2] = 0; - if (cmd->base == 3) + if (cmd->base == 3) { globalCtx->unk_10B06[3] = (1.0f - temp) * 255.0f; - else + } else { globalCtx->unk_10B06[3] = 255.0f * temp; + } break; case 4: case 8: globalCtx->unk_10B06[0] = 0; globalCtx->unk_10B06[1] = 0xFF; globalCtx->unk_10B06[2] = 0; - if (cmd->base == 4) + if (cmd->base == 4) { globalCtx->unk_10B06[3] = (1.0f - temp) * 255.0f; - else + } else { globalCtx->unk_10B06[3] = 255.0f * temp; + } break; case 9: gSaveContext.unk_1410 = 1; @@ -1343,10 +1248,11 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs globalCtx->unk_10B06[0] = 0; globalCtx->unk_10B06[1] = 0; globalCtx->unk_10B06[2] = 0; - if (cmd->base == 10) + if (cmd->base == 10) { globalCtx->unk_10B06[3] = (1.0f - temp) * 255.0f; - else + } else { globalCtx->unk_10B06[3] = 255.0f * temp; + } break; case 12: gSaveContext.unk_1410 = 255.0f - (155.0f * temp); @@ -1362,8 +1268,7 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs } // Command 0x1 & 0x5: Camera Positions -s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) -{ +s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = 1; CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; @@ -1372,15 +1277,12 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* size = 8; if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && - ((csCtx->unk_18 < cmdBase->startFrame) || (csCtx->unk_18 >= 0xF000))) - { + ((csCtx->unk_18 < cmdBase->startFrame) || (csCtx->unk_18 >= 0xF000))) { csCtx->unk_1B = 1; csCtx->cameraPosition = (CutsceneCameraPoint*)cmd; - if (csCtx->unk_1A != 0) - { + if (csCtx->unk_1A != 0) { csCtx->unk_18 = cmdBase->startFrame; - if (D_8015FCC8 != 0) - { + if (D_8015FCC8 != 0) { func_800C0874(globalCtx, csCtx->unk_16, 0x25); func_800C0314(globalCtx, D_8015FCC6, 1); func_800C0314(globalCtx, csCtx->unk_16, 7); @@ -1391,10 +1293,10 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* } } - while (shouldContinue) - { - if (((CutsceneCameraPoint*)cmd)->continueFlag == -1) - shouldContinue = 0; + while (shouldContinue) { + if (((CutsceneCameraPoint*)cmd)->continueFlag == -1) { + shouldContinue = 0; + } cmd += 0x10; size += 0x10; } @@ -1403,8 +1305,7 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* } // Command 0x2 & 0x6: Camera Focus Points -s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) -{ +s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = 1; CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; @@ -1413,15 +1314,12 @@ s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCt size = 8; if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && - ((D_8015FCC0 < cmdBase->startFrame) || (D_8015FCC0 >= 0xF000))) - { + ((D_8015FCC0 < cmdBase->startFrame) || (D_8015FCC0 >= 0xF000))) { csCtx->unk_1A = 1; csCtx->cameraFocus = (CutsceneCameraPoint*)cmd; - if (csCtx->unk_1B != 0) - { + if (csCtx->unk_1B != 0) { D_8015FCC0 = cmdBase->startFrame; - if (D_8015FCC8 != 0) - { + if (D_8015FCC8 != 0) { func_800C0874(globalCtx, csCtx->unk_16, 0x25); func_800C0314(globalCtx, D_8015FCC6, 1); func_800C0314(globalCtx, csCtx->unk_16, 7); @@ -1432,10 +1330,10 @@ s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCt } } - while (shouldContinue) - { - if (((CutsceneCameraPoint*)cmd)->continueFlag == -1) - shouldContinue = 0; + while (shouldContinue) { + if (((CutsceneCameraPoint*)cmd)->continueFlag == -1) { + shouldContinue = 0; + } cmd += 0x10; size += 0x10; } @@ -1444,8 +1342,7 @@ s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCt } // Command 0x7: ? (Related to camera positons) -s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) -{ +s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) { CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; Vec3f sp3C; @@ -1457,15 +1354,12 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm size = 8; if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && - ((D_8015FCC2 < cmdBase->startFrame) || (D_8015FCC2 >= 0xF000))) - { + ((D_8015FCC2 < cmdBase->startFrame) || (D_8015FCC2 >= 0xF000))) { csCtx->unk_1B = 1; csCtx->cameraPosition = (CutsceneCameraPoint*)cmd; - if (csCtx->unk_1A != 0) - { + if (csCtx->unk_1A != 0) { D_8015FCC2 = cmdBase->startFrame; - if (D_8015FCC8 != 0) - { + if (D_8015FCC8 != 0) { sp2C = func_800C04A4(globalCtx, csCtx->unk_16); sp2C->player = NULL; func_800C0314(globalCtx, 0, 1); @@ -1491,8 +1385,7 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm } // Command 0x8: ? (Related to camera focus points) -s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) -{ +s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 unused) { CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; Vec3f sp3C; @@ -1504,15 +1397,12 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm size = 8; if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && - ((D_8015FCC4 < cmdBase->startFrame) || (D_8015FCC4 >= 0xF000))) - { + ((D_8015FCC4 < cmdBase->startFrame) || (D_8015FCC4 >= 0xF000))) { csCtx->unk_1A = 1; csCtx->cameraFocus = (CutsceneCameraPoint*)cmd; - if (csCtx->unk_1B != 0) - { + if (csCtx->unk_1B != 0) { D_8015FCC4 = cmdBase->startFrame; - if (D_8015FCC8 != 0) - { + if (D_8015FCC8 != 0) { sp2C = func_800C04A4(globalCtx, csCtx->unk_16); sp2C->player = NULL; func_800C0314(globalCtx, 0, 1); @@ -1536,81 +1426,70 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm } // Command 0x13: Textbox -void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdTextbox* cmd) -{ +void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdTextbox* cmd) { u8 dialogState; s16 originalCsFrames; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) - { - if (cmd->type != 2) - { - if (D_8011E1C0 != cmd->base) - { + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { + if (cmd->type != 2) { + if (D_8011E1C0 != cmd->base) { D_8011E1C0 = cmd->base; - if ((cmd->type == 3) && (gBitFlags[20] & gSaveContext.quest_items)) + if ((cmd->type == 3) && (gBitFlags[20] & gSaveContext.quest_items)) { func_8010B680(globalCtx, cmd->textId1, 0); - else if ((cmd->type == 4) && (gBitFlags[19] & gSaveContext.quest_items)) + } else if ((cmd->type == 4) && (gBitFlags[19] & gSaveContext.quest_items)) { func_8010B680(globalCtx, cmd->textId1, 0); - else + } else { func_8010B680(globalCtx, cmd->base, 0); + } return; } - } - else - { - if (D_8011E1C4 != cmd->base) - { + } else { + if (D_8011E1C4 != cmd->base) { D_8011E1C4 = cmd->base; func_8010BD58(globalCtx, cmd->base); return; } } - if (csCtx->frames >= cmd->endFrame) - { + if (csCtx->frames >= cmd->endFrame) { originalCsFrames = csCtx->frames; dialogState = func_8010BDBC(&globalCtx->msgCtx); - if ((dialogState != 2) && (dialogState != 0) && (dialogState != 7) && (dialogState != 8)) - { + if ((dialogState != 2) && (dialogState != 0) && (dialogState != 7) && (dialogState != 8)) { csCtx->frames--; - if ((dialogState == 4) && (func_80106BC8(globalCtx) != 0)) - { - if (globalCtx->msgCtx.choiceIndex == 0) - { - if (cmd->textId1 != 0xFFFF) + if ((dialogState == 4) && (func_80106BC8(globalCtx) != 0)) { + if (globalCtx->msgCtx.choiceIndex == 0) { + if (cmd->textId1 != 0xFFFF) { func_8010B720(globalCtx, cmd->textId1); - else + } else { csCtx->frames++; - } - else - { - if (cmd->textId2 != 0xFFFF) + } + } else { + if (cmd->textId2 != 0xFFFF) { func_8010B720(globalCtx, cmd->textId2); - else + } else { csCtx->frames++; + } } } - if (dialogState == 9) - { - if (cmd->textId1 != 0xFFFF) + if (dialogState == 9) { + if (cmd->textId1 != 0xFFFF) { func_8010B720(globalCtx, cmd->textId1); - else + } else { csCtx->frames++; + } } - if (dialogState == 5) - { - if (func_80106BC8(globalCtx) != 0) + if (dialogState == 5) { + if (func_80106BC8(globalCtx) != 0) { func_8010BD58(globalCtx, cmd->base); + } } } - if (csCtx->frames == originalCsFrames) - { + if (csCtx->frames == originalCsFrames) { Interface_ChangeAlpha(1); D_8011E1C0 = 0; D_8011E1C4 = 0; @@ -1619,8 +1498,7 @@ void Cutscene_Command_Textbox(GlobalContext* globalCtx, CutsceneContext* csCtx, } } -void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cutscenePtr) -{ +void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cutscenePtr) { s16 i; s32 totalEntries; s32 cmdType; @@ -1634,33 +1512,29 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, MemCopy(&cutsceneEndFrame, cutscenePtr, 4); cutscenePtr += 4; - if ((cutsceneEndFrame < csCtx->frames) && (csCtx->state != CS_STATE_UNSKIPPABLE_EXEC)) - { + if ((cutsceneEndFrame < csCtx->frames) && (csCtx->state != CS_STATE_UNSKIPPABLE_EXEC)) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; return; } - if (!~(globalCtx->state.input[0].padPressed | -0x101)) - { + if (!~(globalCtx->state.input[0].padPressed | -0x101)) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; return; } - for (i = 0; i < totalEntries; i++) - { + for (i = 0; i < totalEntries; i++) { MemCopy(&cmdType, cutscenePtr, 4); cutscenePtr += 4; - if (cmdType == -1) + if (cmdType == -1) { return; + } - switch (cmdType) - { + switch (cmdType) { case CS_CMD_MISC: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { func_80064824(globalCtx, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } @@ -1668,8 +1542,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_SET_LIGHTING: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { Cutscene_Command_SetLighting(globalCtx, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } @@ -1677,8 +1550,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_PLAYBGM: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { Cutscene_Command_PlayBGM(globalCtx, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } @@ -1686,8 +1558,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_STOPBGM: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { Cutscene_Command_StopBGM(globalCtx, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } @@ -1695,8 +1566,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_FADEBGM: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { Cutscene_Command_FadeBGM(globalCtx, csCtx, (void*)cutscenePtr); cutscenePtr += 0x30; } @@ -1704,8 +1574,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_09: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { Cutscene_Command_09(globalCtx, csCtx, (void*)cutscenePtr); cutscenePtr += 0xC; } @@ -1713,8 +1582,7 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_SETTIME: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { func_80065134(globalCtx, csCtx, (void*)cutscenePtr); cutscenePtr += 0xC; } @@ -1722,11 +1590,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_SET_ACTOR_ACTION_0: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->linkAction = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1750,11 +1618,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 144: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[0] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1778,11 +1646,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 141: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[1] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1802,11 +1670,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 132: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[2] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1825,11 +1693,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 133: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[3] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1844,11 +1712,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 135: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[4] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1861,11 +1729,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 136: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[5] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1879,11 +1747,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 137: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[6] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1896,33 +1764,33 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case 142: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[7] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; case 62: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[8] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; case CS_CMD_SET_ACTOR_ACTION_10: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) + if ((cmd->startFrame < csCtx->frames) && (csCtx->frames <= cmd->endFrame)) { csCtx->actorActions[9] = (void*)cutscenePtr; + } cutscenePtr += 0x30; } break; @@ -1952,11 +1820,11 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, case CS_CMD_TEXTBOX: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) - { + for (j = 0; j < cmdEntries; j++) { cmd = (CsCmdBase*)cutscenePtr; - if (cmd->base != 0xFFFF) + if (cmd->base != 0xFFFF) { Cutscene_Command_Textbox(globalCtx, csCtx, (void*)cutscenePtr); + } cutscenePtr += 0xC; } break; @@ -1968,28 +1836,26 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, default: MemCopy(&cmdEntries, cutscenePtr, 4); cutscenePtr += 4; - for (j = 0; j < cmdEntries; j++) + for (j = 0; j < cmdEntries; j++) { cutscenePtr += 0x30; + } break; } } } -void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) { Gfx* displayList; Gfx* prevDisplayList; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (0) ; // Necessary to match + if (0) {} // Necessary to match - if (gSaveContext.cutscene_index >= 0xFFF0) - { - if (0) ; // Also necessary to match + if (gSaveContext.cutscene_index >= 0xFFF0) { + if (0) {} // Also necessary to match - if (BREG(0) != 0) - { + if (BREG(0) != 0) { gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_demo.c", 4101); @@ -2005,42 +1871,38 @@ void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) } csCtx->frames++; - if (dREG(95) != 0) + if (dREG(95) != 0) { Cutscene_ProcessCommands(globalCtx, csCtx, D_8012D1F0); - else + } else { Cutscene_ProcessCommands(globalCtx, csCtx, globalCtx->csCtx.segment); + } } } -void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ - if (func_8006472C(globalCtx, csCtx, 0.0f)) - { +void func_80068D84(GlobalContext* globalCtx, CutsceneContext* csCtx) { + if (func_8006472C(globalCtx, csCtx, 0.0f)) { func_800F68BC(0); csCtx->state = CS_STATE_IDLE; } } -void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { s16 i; - if (func_8006472C(globalCtx, csCtx, 0.0f)) - { + if (func_8006472C(globalCtx, csCtx, 0.0f)) { csCtx->linkAction = NULL; - for (i = 0; i < 10; i++) + for (i = 0; i < 10; i++) { csCtx->actorActions[i] = NULL; + } // Translates to: "RIGHT HERE, HUH" osSyncPrintf("\n\n\n\n\nやっぱりここかいな"); gSaveContext.cutscene_index = 0; gSaveContext.game_mode = 0; - if (D_8015FCC8 != 0) - { - switch (gSaveContext.entrance_index) - { + if (D_8015FCC8 != 0) { + switch (gSaveContext.entrance_index) { case 0x028A: case 0x028E: case 0x0292: @@ -2058,15 +1920,14 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) } } -void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) -{ +void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { u8 i; - if ((gSaveContext.cutscene_trigger != 0) && (csCtx->state == CS_STATE_IDLE) && !func_8008E988(globalCtx)) + if ((gSaveContext.cutscene_trigger != 0) && (csCtx->state == CS_STATE_IDLE) && !func_8008E988(globalCtx)) { gSaveContext.cutscene_index = 0xFFFD; + } - if ((gSaveContext.cutscene_index >= 0xFFF0) && (csCtx->state == CS_STATE_IDLE)) - { + if ((gSaveContext.cutscene_index >= 0xFFF0) && (csCtx->state == CS_STATE_IDLE)) { func_8006C438(globalCtx, 0); D_8011E1C0 = 0; @@ -2074,13 +1935,13 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) csCtx->unk_12 = 0; csCtx->linkAction = NULL; - for (i = 0; i < 10; i++) + for (i = 0; i < 10; i++) { csCtx->actorActions[i] = NULL; + } csCtx->state++; - if (csCtx->state == CS_STATE_SKIPPABLE_INIT) - { + if (csCtx->state == CS_STATE_SKIPPABLE_INIT) { func_800F68BC(1); csCtx->frames = 0xFFFF; @@ -2092,11 +1953,11 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) csCtx->unk_1B = 0; D_8015FCC6 = globalCtx->cameraCtx.unk_5C0; - if (D_8015FCC8 != 0) + if (D_8015FCC8 != 0) { csCtx->unk_14_all = func_800C0230(globalCtx); + } - if (gSaveContext.cutscene_trigger == 0) - { + if (gSaveContext.cutscene_trigger == 0) { Interface_ChangeAlpha(1); func_800B3840(0x20); func_800B38A4(0x20); @@ -2110,41 +1971,39 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) } } -void func_80069048(GlobalContext* globalCtx) -{ +void func_80069048(GlobalContext* globalCtx) { s16 i; D_8015FCCC = 0; - for (i = 0; i < 20; i++) ; // Empty Loop + for (i = 0; i < 20; i++) { + ; // Empty Loop + } D_8015FCE4 = 0; } -void func_8006907C(GlobalContext* globalCtx) -{ - if (D_8015FCCC != 0) +void func_8006907C(GlobalContext* globalCtx) { + if (D_8015FCCC != 0) { D_8015FCCC = 0; + } } -void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) -{ +void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) { EntranceCutscene* entranceCutscene; u8 requiredAge; s16 i; - for (i = 0; i < ARRAY_COUNT(sEntranceCutsceneTable); i++) - { + for (i = 0; i < ARRAY_COUNT(sEntranceCutsceneTable); i++) { entranceCutscene = &sEntranceCutsceneTable[i]; requiredAge = entranceCutscene->ageRestriction; - if (requiredAge == 2) + if (requiredAge == 2) { requiredAge = gSaveContext.link_age; + } if ((gSaveContext.entrance_index == entranceCutscene->entrance) && (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == 0x18)) && - (gSaveContext.cutscene_index < 0xFFF0) && - ((u8)gSaveContext.link_age == requiredAge) && - (gSaveContext.respawn_flag <= 0)) - { + (gSaveContext.cutscene_index < 0xFFF0) && ((u8)gSaveContext.link_age == requiredAge) && + (gSaveContext.respawn_flag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); Cutscene_SetSegment(globalCtx, entranceCutscene->segAddr); gSaveContext.cutscene_trigger = 2; @@ -2156,42 +2015,31 @@ void Cutscene_HandleEntranceTriggers(GlobalContext* globalCtx) #ifdef NON_MATCHING // regalloc differences -void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) -{ +void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) { osSyncPrintf("\ngame_info.mode=[%d] restart_flag", gSaveContext.respawn_flag); - if ((gSaveContext.game_mode == 0) && (gSaveContext.respawn_flag <= 0) && (gSaveContext.cutscene_index < 0xFFF0)) - { - if ((gSaveContext.entrance_index == 0x01E1) && !Flags_GetEventChkInf(0xAC)) - { + if ((gSaveContext.game_mode == 0) && (gSaveContext.respawn_flag <= 0) && (gSaveContext.cutscene_index < 0xFFF0)) { + if ((gSaveContext.entrance_index == 0x01E1) && !Flags_GetEventChkInf(0xAC)) { Flags_SetEventChkInf(0xAC); gSaveContext.entrance_index = 0x0123; gSaveContext.cutscene_index = 0xFFF0; - } - else if ((gSaveContext.entrance_index == 0x00DB) && LINK_IS_ADULT && - (gSaveContext.event_chk_inf[4] & 0x0100) && (gSaveContext.event_chk_inf[4] & 0x0200) && - (gSaveContext.event_chk_inf[4] & 0x0400) && !Flags_GetEventChkInf(0xAA)) - { + } else if ((gSaveContext.entrance_index == 0x00DB) && LINK_IS_ADULT && + (gSaveContext.event_chk_inf[4] & 0x0100) && (gSaveContext.event_chk_inf[4] & 0x0200) && + (gSaveContext.event_chk_inf[4] & 0x0400) && !Flags_GetEventChkInf(0xAA)) { Flags_SetEventChkInf(0xAA); gSaveContext.cutscene_index = 0xFFF0; - } - else if ((gSaveContext.entrance_index == 0x05E0) && !Flags_GetEventChkInf(0xC1)) - { + } else if ((gSaveContext.entrance_index == 0x05E0) && !Flags_GetEventChkInf(0xC1)) { Flags_SetEventChkInf(0xC1); Item_Give(globalCtx, ITEM_OCARINA_FAIRY); gSaveContext.entrance_index = 0x011E; gSaveContext.cutscene_index = 0xFFF0; - } - else if ((gBitFlags[3] & gSaveContext.quest_items) && (gBitFlags[4] & gSaveContext.quest_items) && - LINK_IS_ADULT && !Flags_GetEventChkInf(0xC4) && - (gEntranceTable[gSaveContext.entrance_index].scene == 67)) - { + } else if ((gBitFlags[3] & gSaveContext.quest_items) && (gBitFlags[4] & gSaveContext.quest_items) && + LINK_IS_ADULT && !Flags_GetEventChkInf(0xC4) && + (gEntranceTable[gSaveContext.entrance_index].scene == 67)) { Flags_SetEventChkInf(0xC4); gSaveContext.entrance_index = 0x0053; gSaveContext.cutscene_index = 0xFFF8; - } - else if (!Flags_GetEventChkInf(0xC7) && (gEntranceTable[gSaveContext.entrance_index].scene == 79)) - { + } else if (!Flags_GetEventChkInf(0xC7) && (gEntranceTable[gSaveContext.entrance_index].scene == 79)) { Flags_SetEventChkInf(0xC7); gSaveContext.entrance_index = 0x0517; gSaveContext.cutscene_index = 0xFFF0; @@ -2202,10 +2050,10 @@ void Cutscene_HandleConditionalTriggers(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_demo/Cutscene_HandleConditionalTriggers.s") #endif -void Cutscene_SetSegment(GlobalContext* globalCtx, u32 segment) -{ - if (SEGMENT_NUMBER(segment) != 0) +void Cutscene_SetSegment(GlobalContext* globalCtx, u32 segment) { + if (SEGMENT_NUMBER(segment) != 0) { globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(segment); - else + } else { globalCtx->csCtx.segment = (void*)segment; + } } diff --git a/src/code/z_draw.c b/src/code/z_draw.c index 9bc4bbd7a8..383ed1b4d8 100644 --- a/src/code/z_draw.c +++ b/src/code/z_draw.c @@ -29,15 +29,13 @@ static void func_8006B54C(GlobalContext* globalCtx, s16 drawId); static void func_8006B6E4(GlobalContext* globalCtx, s16 drawId); static void func_8006B870(GlobalContext* globalCtx, s16 drawId); -typedef struct -{ - /* 0x00 */ void (*drawFunc)(GlobalContext*, s16); - /* 0x04 */ u32 dlists[8]; +typedef struct { + /* 0x00 */ void (*drawFunc)(GlobalContext*, s16); + /* 0x04 */ u32 dlists[8]; } DrawItemTableEntry; // size = 0x24 // TODO: use symbols for these dlists once objects are in C -static DrawItemTableEntry sDrawItemTable[] = -{ +static DrawItemTableEntry sDrawItemTable[] = { { func_8006AAA8, { 0x06000670, 0x06000750 } }, { func_8006A9CC, { 0x06000800 } }, { func_8006ABEC, { 0x06000A80, 0x06000AE0 } }, @@ -71,8 +69,10 @@ static DrawItemTableEntry sDrawItemTable[] = { func_8006A9CC, { 0x06000EE0 } }, { func_8006A9CC, { 0x060009A0 } }, { func_8006A9CC, { 0x06000B70 } }, - { func_8006B870, { 0x06001850, 0x06001750, 0x06001790, 0x060019A0, 0x060017B0, 0x06001A28, 0x060017D0, 0x06001AD8 } }, - { func_8006B870, { 0x06001850, 0x06001770, 0x060017F0, 0x060019A0, 0x06001810, 0x06001A28, 0x06001830, 0x06001AD8 } }, + { func_8006B870, + { 0x06001850, 0x06001750, 0x06001790, 0x060019A0, 0x060017B0, 0x06001A28, 0x060017D0, 0x06001AD8 } }, + { func_8006B870, + { 0x06001850, 0x06001770, 0x060017F0, 0x060019A0, 0x06001810, 0x06001A28, 0x06001830, 0x06001AD8 } }, { func_8006A9CC, { 0x06000F60 } }, { func_8006A9CC, { 0x06000340 } }, { func_8006A9CC, { 0x06000B90 } }, @@ -161,88 +161,90 @@ static DrawItemTableEntry sDrawItemTable[] = * Draw "Get Item" Model * Calls the corresponding draw function for the given draw ID */ -void func_800694A0(GlobalContext* globalCtx, s16 drawId) -{ +void func_800694A0(GlobalContext* globalCtx, s16 drawId) { sDrawItemTable[drawId].drawFunc(globalCtx, drawId); } // All remaining functions in this file are draw functions referenced in the table and called by the function above -static void func_800694E4(GlobalContext* globalCtx, s16 drawId) -{ +static void func_800694E4(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 556); func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 560), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 560), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 565); } -static void func_800695C0(GlobalContext* globalCtx, s16 drawId) -{ +static void func_800695C0(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 572); gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 5); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 576), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 576), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 581); } -static void func_8006969C(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006969C(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 588); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 592), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 592), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 16, 32, - 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 8), 16, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), + 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), + 1 * -(globalCtx->state.frames * 8), 16, 32)); Matrix_Push(); Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY); func_800D1FD4(&globalCtx->mf_11DA0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); Matrix_Pull(); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 621); } -static void func_80069880(GlobalContext* globalCtx, s16 drawId) -{ +static void func_80069880(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 628); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 632), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 632), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 641), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 641), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 16, 32, - 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 16, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), + 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), + 1 * -(globalCtx->state.frames * 6), 16, 32)); Matrix_Push(); func_800D1FD4(&globalCtx->mf_11DA0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); Matrix_Pull(); @@ -250,35 +252,36 @@ static void func_80069880(GlobalContext* globalCtx, s16 drawId) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 663); } -static void func_80069AC8(GlobalContext* globalCtx, s16 drawId) -{ +static void func_80069AC8(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 670); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 674), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 674), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 683), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 683), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 32, 32, - 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), + 0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1), + 1 * -(globalCtx->state.frames * 6), 32, 32)); Matrix_Push(); func_800D1FD4(&globalCtx->mf_11DA0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); Matrix_Pull(); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 704); } -static void func_80069CF0(GlobalContext* globalCtx, s16 drawId) -{ +static void func_80069CF0(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -286,77 +289,80 @@ static void func_80069CF0(GlobalContext* globalCtx, s16 drawId) func_80093D18(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0 * (globalCtx->state.frames * 0) % 256, 1 * (globalCtx->state.frames * 2) % 256, 64, 64, - 1, 0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 723), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0) % 256, + 1 * (globalCtx->state.frames * 2) % 256, 64, 64, 1, + 0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32, + 32)); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 723), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 730), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 730), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 735); } -static void func_80069EB0(GlobalContext* globalCtx, s16 drawId) -{ +static void func_80069EB0(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 742); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 746), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 746), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0 * (globalCtx->state.frames * 0), 1 * -(globalCtx->state.frames * 5), 32, 32, - 1, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 32, 64)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 760), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), + 1 * -(globalCtx->state.frames * 5), 32, 32, 1, 0 * (globalCtx->state.frames * 0), + 0 * (globalCtx->state.frames * 0), 32, 64)); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 760), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 765); } -static void func_8006A060(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A060(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 772); func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 776), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 776), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 783); } -static void func_8006A158(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A158(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 811); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 815), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 815), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 5); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 822), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 822), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 827); } -static void func_8006A2A0(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A2A0(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -364,25 +370,26 @@ static void func_8006A2A0(GlobalContext* globalCtx, s16 drawId) func_80093D18(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, -1 * (globalCtx->state.frames * 1), 1 * (globalCtx->state.frames * 1), 32, 32, - 1, -1 * (globalCtx->state.frames * 1), 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 845), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, -1 * (globalCtx->state.frames * 1), + 1 * (globalCtx->state.frames * 1), 32, 32, 1, -1 * (globalCtx->state.frames * 1), + 1 * (globalCtx->state.frames * 1), 32, 32)); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 845), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 855), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 855), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[5]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 861); } -static void func_8006A4B0(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A4B0(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -390,17 +397,17 @@ static void func_8006A4B0(GlobalContext* globalCtx, s16 drawId) func_80093D18(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 1 * (globalCtx->state.frames * 1), 0 * (globalCtx->state.frames * 1), 32, 32, - 1, 0 * (globalCtx->state.frames * 1), 0 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 878), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 1), + 0 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 1), + 0 * (globalCtx->state.frames * 1), 32, 32)); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 878), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 883); } -static void func_8006A5F0(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A5F0(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -408,17 +415,17 @@ static void func_8006A5F0(GlobalContext* globalCtx, s16 drawId) func_80093D18(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 1 * (globalCtx->state.frames * 6), 1 * (globalCtx->state.frames * 6), 32, 32, - 1, 1 * (globalCtx->state.frames * 6), 1 * (globalCtx->state.frames * 6), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 901), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6), + 1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6), + 1 * (globalCtx->state.frames * 6), 32, 32)); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 901), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 906); } -static void func_8006A73C(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A73C(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -426,17 +433,17 @@ static void func_8006A73C(GlobalContext* globalCtx, s16 drawId) func_80093D84(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 3), 32, 32, - 1, 0 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 924), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 1), + 1 * -(globalCtx->state.frames * 3), 32, 32, 1, 0 * (globalCtx->state.frames * 1), + 1 * -(globalCtx->state.frames * 2), 32, 32)); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 924), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 929); } -static void func_8006A88C(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A88C(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -444,100 +451,103 @@ static void func_8006A88C(GlobalContext* globalCtx, s16 drawId) func_80093D84(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0 * (globalCtx->state.frames * 0), 1 * (globalCtx->state.frames * 1), 32, 32, - 1, 0 * (globalCtx->state.frames * 0), 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 947), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), + 1 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 0), + 1 * (globalCtx->state.frames * 1), 32, 32)); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 947), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 952); } -static void func_8006A9CC(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006A9CC(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 959); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 963), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 963), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 968); } -static void func_8006AAA8(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006AAA8(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 975); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 979), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 979), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 986), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 986), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 991); } -static void func_8006ABEC(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006ABEC(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 998); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1002), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1002), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1008); } -static void func_8006ACE4(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006ACE4(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1015); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1019), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1019), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1027), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1027), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1032); } -static void func_8006AE40(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006AE40(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1039); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1043), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1043), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1050), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1050), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1056); } -static void func_8006AF9C(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006AF9C(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -545,10 +555,11 @@ static void func_8006AF9C(GlobalContext* globalCtx, s16 drawId) func_80093D84(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 1 * (globalCtx->state.frames * 2), 1 * -(globalCtx->state.frames * 6), 32, 32, - 1, 1 * (globalCtx->state.frames * 1), -1 * (globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1074), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), + 1 * -(globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 1), + -1 * (globalCtx->state.frames * 2), 32, 32)); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1074), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); @@ -556,15 +567,15 @@ static void func_8006AF9C(GlobalContext* globalCtx, s16 drawId) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1081); } -static void func_8006B124(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006B124(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1088); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1092), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1092), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); @@ -573,28 +584,28 @@ static void func_8006B124(GlobalContext* globalCtx, s16 drawId) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1100); } -static void func_8006B24C(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006B24C(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1108); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1112), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1112), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1120), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1120), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1126); } -static void func_8006B3C0(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006B3C0(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -603,20 +614,21 @@ static void func_8006B3C0(GlobalContext* globalCtx, s16 drawId) Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1140), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1140), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1148), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1148), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1154); } -static void func_8006B54C(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006B54C(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -624,10 +636,11 @@ static void func_8006B54C(GlobalContext* globalCtx, s16 drawId) func_80093D84(globalCtx->state.gfxCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 1 * (globalCtx->state.frames * 2), -1 * (globalCtx->state.frames * 2), 64, 64, - 1, 1 * (globalCtx->state.frames * 4), 1 * -(globalCtx->state.frames * 4), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1173), G_MTX_MODELVIEW | G_MTX_LOAD); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), + -1 * (globalCtx->state.frames * 2), 64, 64, 1, 1 * (globalCtx->state.frames * 4), + 1 * -(globalCtx->state.frames * 4), 32, 32)); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1173), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); @@ -636,20 +649,21 @@ static void func_8006B54C(GlobalContext* globalCtx, s16 drawId) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1181); } -static void func_8006B6E4(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006B6E4(GlobalContext* globalCtx, s16 drawId) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1188); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1192), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1192), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1200), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1200), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]); @@ -657,8 +671,7 @@ static void func_8006B6E4(GlobalContext* globalCtx, s16 drawId) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1207); } -static void func_8006B870(GlobalContext* globalCtx, s16 drawId) -{ +static void func_8006B870(GlobalContext* globalCtx, s16 drawId) { u32 pad; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -666,7 +679,8 @@ static void func_8006B870(GlobalContext* globalCtx, s16 drawId) func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1214); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1218), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1218), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index eb7b016dc6..56fbb6b3e5 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -9,8 +9,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_80020A50.s") -void func_80020F60(u32 unused, GraphicsContext* gfxCtx) -{ +void func_80020F60(u32 unused, GraphicsContext* gfxCtx) { Gfx* gfxArr[5]; func_800C6AC4(gfxArr, gfxCtx, D_80135180, 809); @@ -29,4 +28,3 @@ void func_80020F60(u32 unused, GraphicsContext* gfxCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800224F4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_80022A10.s") - diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index fd85f4abb7..d3f2591f82 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -8,4 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/func_8002389C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/func_800245BC.s") - diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index f24a7f3ab6..5f7c2a65f5 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -3,12 +3,9 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/func_80024B00.s") -void func_80024F0C(UNK_TYPE arg0) -{ - +void func_80024F0C(UNK_TYPE arg0) { } #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/func_80024F14.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/func_80025000.s") - diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index c3228d70b1..f203e81e4e 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -12,4 +12,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026860.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026A6C.s") - diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 833994f810..34b264bf42 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -7,8 +7,7 @@ void Effect_SS_Delete(LoadedParticleEntry* particle); #pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_800272B0.s") -void Effect_SS_Clear(GlobalContext* globalCtx) -{ +void Effect_SS_Clear(GlobalContext* globalCtx) { u32 i; LoadedParticleEntry* iter; ParticleOverlay* iter2; @@ -18,35 +17,36 @@ void Effect_SS_Clear(GlobalContext* globalCtx) EffectSS2Info.searchIndex = 0; EffectSS2Info.size = 0; - for (iter = EffectSS2Info.data_table; iter < EffectSS2Info.data_table + EffectSS2Info.size; iter++) + for (iter = EffectSS2Info.data_table; iter < EffectSS2Info.data_table + EffectSS2Info.size; iter++) { Effect_SS_Delete(iter); + } // Free memory from loaded particle overlays iter2 = &sParticleOverlayTable[0]; - for (i = 0; i < ARRAY_COUNT(sParticleOverlayTable); i++) - { + for (i = 0; i < ARRAY_COUNT(sParticleOverlayTable); i++) { addr = iter2->loadedRamAddr; - if (addr != NULL) + if (addr != NULL) { ZeldaArena_FreeDebug(addr, D_801357DC, 337); + } (iter2++)->loadedRamAddr = NULL; } } -void Effect_SS_Delete(LoadedParticleEntry* particle) -{ - if (particle->flags & 2) +void Effect_SS_Delete(LoadedParticleEntry* particle) { + if (particle->flags & 2) { func_800F89E8(particle); + } - if (particle->flags & 4) + if (particle->flags & 4) { func_800F89E8(&particle->unk_2C); + } Effect_SS_ResetEntry(particle); } -void Effect_SS_ResetEntry(LoadedParticleEntry* particle) -{ +void Effect_SS_ResetEntry(LoadedParticleEntry* particle) { u32 i; particle->type = 0x25; @@ -70,8 +70,9 @@ void Effect_SS_ResetEntry(LoadedParticleEntry* particle) particle->unk_38 = 0; particle->unk_3C = 0; - for (i = 0; i != 13; i++) + for (i = 0; i != 13; i++) { particle->unk_40[i] = 0; + } } #pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_800275D0.s") @@ -80,12 +81,10 @@ void Effect_SS_ResetEntry(LoadedParticleEntry* particle) #pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_80027798.s") -void Effect_SS_UpdateParticle(GlobalContext* globalCtx, s32 index) -{ +void Effect_SS_UpdateParticle(GlobalContext* globalCtx, s32 index) { LoadedParticleEntry* particle = &EffectSS2Info.data_table[index]; - if (particle->update != NULL) - { + if (particle->update != NULL) { particle->velocity.x += particle->acceleration.x; particle->velocity.y += particle->acceleration.y; particle->velocity.z += particle->acceleration.z; @@ -98,47 +97,43 @@ void Effect_SS_UpdateParticle(GlobalContext* globalCtx, s32 index) } } -void Effect_SS_UpdateAllParticles(GlobalContext* globalCtx) -{ +void Effect_SS_UpdateAllParticles(GlobalContext* globalCtx) { s32 i; - for (i = 0; i < EffectSS2Info.size; i++) - { - if (EffectSS2Info.data_table[i].life > -1) - { + for (i = 0; i < EffectSS2Info.size; i++) { + if (EffectSS2Info.data_table[i].life > -1) { EffectSS2Info.data_table[i].life--; - if (EffectSS2Info.data_table[i].life < 0) + if (EffectSS2Info.data_table[i].life < 0) { Effect_SS_Delete(&EffectSS2Info.data_table[i]); + } } - if (EffectSS2Info.data_table[i].life > -1) + if (EffectSS2Info.data_table[i].life > -1) { Effect_SS_UpdateParticle(globalCtx, i); + } } } -void Effect_SS_DrawParticle(GlobalContext* globalCtx, s32 index) -{ +void Effect_SS_DrawParticle(GlobalContext* globalCtx, s32 index) { LoadedParticleEntry* particle = &EffectSS2Info.data_table[index]; - if (particle->draw != NULL) + if (particle->draw != NULL) { particle->draw(globalCtx, index, particle); + } } #pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_80027BDC.s") -s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2) -{ - s16 ret = !arg2 ? arg1 : (arg0 + (s32) ((f32) (arg1 - arg0) / arg2)); +s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2) { + s16 ret = !arg2 ? arg1 : (arg0 + (s32)((f32)(arg1 - arg0) / arg2)); return ret; } -s16 func_80027E34(s16 a0, s16 a1, f32 a2) -{ +s16 func_80027E34(s16 a0, s16 a1, f32 a2) { return (a1 - a0) * a2 + a0; } -u8 func_80027E84(u8 a0, u8 a1, f32 a2) -{ +u8 func_80027E84(u8 a0, u8 a1, f32 a2) { return a2 * ((f32)a1 - (f32)a0) + a0; } diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index a385667eed..847e25e2fa 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -164,4 +164,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A9F4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002AA44.s") - diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 02bc0a16e8..ea67ceb05a 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -1,8 +1,7 @@ #include #include -typedef enum -{ +typedef enum { /* 0x00 */ A_OBJ_BLOCK_SMALL, /* 0x01 */ A_OBJ_BLOCK_LARGE, /* 0x02 */ A_OBJ_BLOCK_HUGE, @@ -17,23 +16,22 @@ typedef enum /* 0x0B */ A_OBJ_KNOB } AObjType; -typedef struct -{ +typedef struct { /* 0x000 */ Actor actor; - /* 0x14C */ u32 dynaPolyId; - /* 0x150 */ f32 unk_150; - /* 0x154 */ f32 unk_154; - /* 0x158 */ s16 unk_158; - /* 0x15C */ u32 unk_15C; - /* 0x160 */ u8 unk_160; + /* 0x14C */ u32 dynaPolyId; + /* 0x150 */ f32 unk_150; + /* 0x154 */ f32 unk_154; + /* 0x158 */ s16 unk_158; + /* 0x15C */ u32 unk_15C; + /* 0x160 */ u8 unk_160; /* 0x164 */ ActorFunc updateFunc; - /* 0x168 */ s32 unk_168; - /* 0x16C */ s16 textId; - /* 0x16E */ s16 unk_16E; - /* 0x170 */ s16 unk_170; - /* 0x172 */ s16 unk_172; - /* 0x174 */ s16 unk_174; - /* 0x178 */ f32 unk_178; + /* 0x168 */ s32 unk_168; + /* 0x16C */ s16 textId; + /* 0x16E */ s16 unk_16E; + /* 0x170 */ s16 unk_170; + /* 0x172 */ s16 unk_172; + /* 0x174 */ s16 unk_174; + /* 0x178 */ f32 unk_178; /* 0x17C */ ColliderCylinderMain cylinderCollider; } ActorEnAObj; // size = 0x1C8 @@ -54,15 +52,13 @@ extern ColliderCylinderInit D_80115440; extern u32 D_8011546C[]; extern u32 D_80115484[]; -void En_A_Obj_SetNewUpdate(ActorEnAObj* this, ActorFunc newUpdateFunc) -{ +void En_A_Obj_SetNewUpdate(ActorEnAObj* this, ActorFunc newUpdateFunc) { this->updateFunc = newUpdateFunc; } #ifdef NON_MATCHING // minor ordering and regalloc differences -void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) -{ +void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) { u32 sp34; s16 type; s16 initialParams; @@ -77,8 +73,7 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) this->textId = (initialParams >> 8) & 0xFF; this->actor.params = type; - switch (type & 0xFFFF) - { + switch (type & 0xFFFF) { case A_OBJ_BLOCK_SMALL: Actor_SetScale(&this->actor, 0.025f); break; @@ -112,8 +107,7 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) params = this->actor.params; this->actor.posRot2.pos = this->actor.posRot.pos; - switch (params) - { + switch (params) { case A_OBJ_BLOCK_LARGE: case A_OBJ_BLOCK_HUGE: this->dynaPolyId = 1; @@ -159,12 +153,11 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) func_8001D234(this, params); break; } - + if (this->actor.params < 5) this->actor.sub_98.mass = 0xFF; - if (this->dynaPolyId != -1) - { + if (this->dynaPolyId != -1) { DynaPolyInfo_Alloc(D_8011546C[this->dynaPolyId], &sp34); this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp34); } @@ -173,51 +166,44 @@ void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_en_a_keep/En_A_Obj_Init.s") #endif -void En_A_Obj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx) -{ +void En_A_Obj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx) { ColliderCylinderMain* cylinderCollider = &this->cylinderCollider; DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); - switch (this->actor.params) - { + switch (this->actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: ActorCollider_FreeCylinder(globalCtx, cylinderCollider); } } -void func_8001D204(ActorEnAObj* this, GlobalContext* globalCtx) -{ - if (func_8002F334(&this->actor, globalCtx)) +void func_8001D204(ActorEnAObj* this, GlobalContext* globalCtx) { + if (func_8002F334(&this->actor, globalCtx)) { func_8001D234(this, this->actor.params); + } } -void func_8001D234(ActorEnAObj* this, s16 params) -{ +void func_8001D234(ActorEnAObj* this, s16 params) { En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D25C); } -void func_8001D25C(ActorEnAObj* this, GlobalContext* globalCtx) -{ +void func_8001D25C(ActorEnAObj* this, GlobalContext* globalCtx) { s16 var; - if (this->actor.textId != 0) - { + if (this->actor.textId != 0) { var = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; - if ((ABS(var) < 0x2800) || - ((this->actor.params == 0xA) && (ABS(var) > 0x5800))) - { - if (func_8002F194(&this->actor, globalCtx)) + if ((ABS(var) < 0x2800) || ((this->actor.params == 0xA) && (ABS(var) > 0x5800))) { + if (func_8002F194(&this->actor, globalCtx)) { En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D204); - else + } else { func_8002F2F4(&this->actor, globalCtx); + } } } } -void func_8001D310(ActorEnAObj* this, s16 params) -{ +void func_8001D310(ActorEnAObj* this, s16 params) { this->unk_16E = 0; this->unk_168 = 10; this->actor.posRot.rot.y = 0; @@ -225,41 +211,34 @@ void func_8001D310(ActorEnAObj* this, s16 params) En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D360); } -void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx) -{ - if (this->unk_16E == 0) - { - if (this->unk_160 != 0) - { +void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx) { + if (this->unk_16E == 0) { + if (this->unk_160 != 0) { this->unk_16E++; this->unk_170 = 20; - if ((s16)(this->actor.rotTowardsLinkY + 0x4000) < 0) + if ((s16)(this->actor.rotTowardsLinkY + 0x4000) < 0) { this->unk_174 = -1000; - else + } else { this->unk_174 = 1000; + } - if (this->actor.rotTowardsLinkY < 0) + if (this->actor.rotTowardsLinkY < 0) { this->unk_172 = -this->unk_174; - else + } else { this->unk_172 = this->unk_174; + } } - } - else - { - if (this->unk_168 != 0) - { + } else { + if (this->unk_168 != 0) { this->unk_168--; - } - else - { + } else { this->actor.shape.rot.y += this->unk_172; this->actor.shape.rot.x += this->unk_174; this->unk_170--; this->actor.gravity = -1.0f; - if (this->unk_170 == 0) - { + if (this->unk_170 == 0) { this->actor.posRot.pos = this->actor.initPosRot.pos; this->unk_16E = 0; this->unk_168 = 10; @@ -271,82 +250,74 @@ void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx) } } -void func_8001D480(ActorEnAObj* this, s16 params) -{ +void func_8001D480(ActorEnAObj* this, s16 params) { En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D4A8); } -void func_8001D4A8(ActorEnAObj* this, GlobalContext* globalCtx) -{ +void func_8001D4A8(ActorEnAObj* this, GlobalContext* globalCtx) { Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f); this->actor.shape.rot.x = this->actor.shape.rot.x + (this->actor.posRot.rot.x >> 1); this->actor.shape.rot.z = this->actor.shape.rot.z + (this->actor.posRot.rot.z >> 1); - if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 0x8)) - { - if (1) // Necessary to match + if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 0x8)) { + if (1) { // Necessary to match this->actor.posRot.rot.y = ((this->actor.unk_7E - this->actor.posRot.rot.y) + this->actor.unk_7E) - 0x8000; + } this->actor.bgCheckFlags &= ~0x8; } - if (this->actor.bgCheckFlags & 0x2) - { - if (this->actor.velocity.y < -8.0f) - { + if (this->actor.bgCheckFlags & 0x2) { + if (this->actor.velocity.y < -8.0f) { this->actor.velocity.y *= -0.6f; this->actor.speedXZ *= 0.6f; this->actor.bgCheckFlags &= ~0x3; - } - else + } else { Actor_Kill(&this->actor); + } } } -void func_8001D5C8(ActorEnAObj* this, s16 params) -{ +void func_8001D5C8(ActorEnAObj* this, s16 params) { this->actor.unk_FC = 1200.0f; this->actor.unk_F8 = 720.0f; En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D608); } -void func_8001D608(ActorEnAObj* this, GlobalContext* globalCtx) -{ +void func_8001D608(ActorEnAObj* this, GlobalContext* globalCtx) { this->actor.speedXZ += this->unk_150; this->actor.posRot.rot.y = this->unk_158; - this->actor.speedXZ = (this->actor.speedXZ < -2.5f) ? -2.5f : - ((this->actor.speedXZ > 2.5f) ? 2.5f : - this->actor.speedXZ); + this->actor.speedXZ = + (this->actor.speedXZ < -2.5f) ? -2.5f : ((this->actor.speedXZ > 2.5f) ? 2.5f : this->actor.speedXZ); Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); - if (this->actor.speedXZ != 0.0f) + if (this->actor.speedXZ != 0.0f) { Audio_PlayActorSound2(&this->actor, 0x200A); + } this->unk_154 = 0.0f; this->unk_150 = 0.0f; } -void En_A_Obj_Update(ActorEnAObj* this, GlobalContext* globalCtx) -{ +void En_A_Obj_Update(ActorEnAObj* this, GlobalContext* globalCtx) { ColliderCylinderMain* cylinderCollider; this->updateFunc(this, globalCtx); Actor_MoveForward(&this->actor); - if (this->actor.gravity != 0.0f) - { - if (this->actor.params != A_OBJ_KNOB) + if (this->actor.gravity != 0.0f) { + if (this->actor.params != A_OBJ_KNOB) { func_8002E4B4(globalCtx, &this->actor, 5.0f, 40.0f, 0.0f, 0x1D); - else + } else { func_8002E4B4(globalCtx, &this->actor, 5.0f, 20.0f, 0.0f, 0x1D); + } } this->actor.posRot2.pos = this->actor.posRot.pos; this->actor.posRot2.pos.y += this->unk_178; - switch (this->actor.params) - { + switch (this->actor.params) { case A_OBJ_SIGNPOST_OBLONG: case A_OBJ_SIGNPOST_ARROW: cylinderCollider = &this->cylinderCollider; @@ -355,8 +326,7 @@ void En_A_Obj_Update(ActorEnAObj* this, GlobalContext* globalCtx) } } -void En_A_Obj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) -{ +void En_A_Obj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) { s32 type = this->actor.params; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -365,13 +335,16 @@ void En_A_Obj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) func_80093D18(globalCtx->state.gfxCtx); - if (type > A_OBJ_KNOB) + if (type > A_OBJ_KNOB) { type = A_OBJ_KNOB; + } - if (this->actor.params == A_OBJ_KNOB) + if (this->actor.params == A_OBJ_KNOB) { gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 1, 0x3C, 0x3C, 0x3C, 0x32); + } - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 712), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 712), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, D_80115484[type]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_a_keep.c", 715); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 3ce4c4b753..1945c75ff3 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -1,8 +1,7 @@ #include #include -typedef enum -{ +typedef enum { /* 0x00 */ DROP_RUPEE_GREEN, /* 0x01 */ DROP_RUPEE_BLUE, /* 0x02 */ DROP_RUPEE_RED, @@ -31,8 +30,7 @@ typedef enum /* 0x19 */ DROP_BOMBS_SPECIAL } DropType; -typedef struct -{ +typedef struct { /* 0x000 */ Actor actor; /* 0x14C */ ActorFunc updateFunc; /* 0x150 */ s16 collectibleFlag; @@ -65,15 +63,13 @@ extern u8 D_80115664[]; // Internal Actor Functions -void En_Item00_SetNewUpdate(ActorEnItem00* this, ActorFunc newUpdateFunc) -{ +void En_Item00_SetNewUpdate(ActorEnItem00* this, ActorFunc newUpdateFunc) { this->updateFunc = newUpdateFunc; } #ifdef NON_MATCHING // Very close to matching, just a single ordering issue -void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) { s32 pad1; s32 pad2; f32 sp34; @@ -91,8 +87,7 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) this->actor.params = this->actor.params & 0x00FF; - if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) - { + if (Flags_GetCollectible(globalCtx, this->collectibleFlag)) { Actor_Kill(&this->actor); return; } @@ -103,8 +98,7 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) this->unk_158 = 1; - switch (this->actor.params) - { + switch (this->actor.params) { case DROP_RUPEE_GREEN: case DROP_RUPEE_BLUE: case DROP_RUPEE_RED: @@ -216,8 +210,7 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) this->unk_152 = 0; // MISMATCH: minor ordering issues here - if (!spawnParam8000) - { + if (!spawnParam8000) { En_Item00_SetNewUpdate(this, (ActorFunc)func_8001DFC8); this->unk_15A = -1; return; @@ -230,8 +223,7 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; - switch (this->actor.params) - { + switch (this->actor.params) { case DROP_RUPEE_GREEN: Item_Give(globalCtx, ITEM_RUPEE_GREEN); break; @@ -307,147 +299,131 @@ void En_Item00_Init(ActorEnItem00* this, GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_en_item00/En_Item00_Init.s") #endif -void En_Item00_Destroy(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void En_Item00_Destroy(ActorEnItem00* this, GlobalContext* globalCtx) { ColliderCylinderMain* cylinderCollider = &this->cylinderCollider; ActorCollider_FreeCylinder(globalCtx, cylinderCollider); } -void func_8001DFC8(ActorEnItem00* this, GlobalContext* globalCtx) -{ - if ((this->actor.params <= DROP_RUPEE_RED) || - ((this->actor.params == DROP_HEART) && (this->unk_15A < 0)) || - (this->actor.params == DROP_HEART_PIECE)) - { +void func_8001DFC8(ActorEnItem00* this, GlobalContext* globalCtx) { + if ((this->actor.params <= DROP_RUPEE_RED) || ((this->actor.params == DROP_HEART) && (this->unk_15A < 0)) || + (this->actor.params == DROP_HEART_PIECE)) { this->actor.shape.rot.y += 960; - } - else - { - if ((this->actor.params >= DROP_SHIELD_DEKU) && (this->actor.params != DROP_BOMBS_SPECIAL)) - { - if (this->unk_15A == -1) - { - if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000, 1500)) + } else { + if ((this->actor.params >= DROP_SHIELD_DEKU) && (this->actor.params != DROP_BOMBS_SPECIAL)) { + if (this->unk_15A == -1) { + if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000, + 1500)) { this->unk_15A = -2; - } - else - { - if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, -this->actor.posRot.rot.x - 0x4000, 2, 3000, 1500)) + } + } else { + if (!Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, -this->actor.posRot.rot.x - 0x4000, 2, 3000, + 1500)) { this->unk_15A = -1; + } } Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.x, 0, 2, 2500, 500); } } - if (this->actor.params == DROP_HEART_PIECE) + if (this->actor.params == DROP_HEART_PIECE) { this->actor.shape.unk_08 = Math_Sins(this->actor.shape.rot.y) * 150.0f + 850.0f; + } Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); - if (this->unk_154 == 0) - if ((this->actor.params != DROP_SMALL_KEY) && - (this->actor.params != DROP_HEART_PIECE) && - (this->actor.params != DROP_HEART_CONTAINER)) - { + if (this->unk_154 == 0) { + if ((this->actor.params != DROP_SMALL_KEY) && (this->actor.params != DROP_HEART_PIECE) && + (this->actor.params != DROP_HEART_CONTAINER)) { this->unk_154 = -1; } + } - if (this->unk_15A == 0) - if ((this->actor.params != DROP_SMALL_KEY) && - (this->actor.params != DROP_HEART_PIECE) && - (this->actor.params != DROP_HEART_CONTAINER)) - { + if (this->unk_15A == 0) { + if ((this->actor.params != DROP_SMALL_KEY) && (this->actor.params != DROP_HEART_PIECE) && + (this->actor.params != DROP_HEART_CONTAINER)) { Actor_Kill(&this->actor); } + } - if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 0x0001)) + if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 0x0001)) { En_Item00_SetNewUpdate(this, (ActorFunc)func_8001E1C8); + } } -void func_8001E1C8(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void func_8001E1C8(ActorEnItem00* this, GlobalContext* globalCtx) { f32 originalVelocity; Vec3f pos; - if (this->actor.params <= DROP_RUPEE_RED) + if (this->actor.params <= DROP_RUPEE_RED) { this->actor.shape.rot.y += 960; + } - if (globalCtx->gameplayFrames & 1) - { + if (globalCtx->gameplayFrames & 1) { pos.x = this->actor.posRot.pos.x + Math_Rand_CenteredFloat(10.0f); pos.y = this->actor.posRot.pos.y + Math_Rand_CenteredFloat(10.0f); pos.z = this->actor.posRot.pos.z + Math_Rand_CenteredFloat(10.0f); func_80028B74(globalCtx, &pos, &D_80115518, &D_80115524, &D_80115510, &D_80115514); } - if (this->actor.bgCheckFlags & 0x0003) - { + if (this->actor.bgCheckFlags & 0x0003) { originalVelocity = this->actor.velocity.y; - if (originalVelocity > -2.0f) - { + if (originalVelocity > -2.0f) { En_Item00_SetNewUpdate(this, (ActorFunc)func_8001DFC8); this->actor.velocity.y = 0.0f; - } - else - { + } else { this->actor.velocity.y = originalVelocity * -0.8f; this->actor.bgCheckFlags = this->actor.bgCheckFlags & 0xFFFE; } } } -void func_8001E304(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void func_8001E304(ActorEnItem00* this, GlobalContext* globalCtx) { s32 pad; Vec3f pos; s32 var1; this->unk_15A++; - if (this->actor.params == DROP_HEART) - { - if (this->actor.velocity.y < 0.0f) - { + if (this->actor.params == DROP_HEART) { + if (this->actor.velocity.y < 0.0f) { this->actor.speedXZ = 0.0f; this->actor.gravity = -0.4f; - if (this->actor.velocity.y < -1.5f) + if (this->actor.velocity.y < -1.5f) { this->actor.velocity.y = -1.5f; - this->actor.initPosRot.rot.z += (s16) ((this->actor.velocity.y + 3.0f) * 1000.0f); - this->actor.posRot.pos.x += Math_Coss(this->actor.rotTowardsLinkY) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); - this->actor.posRot.pos.z += Math_Sins(this->actor.rotTowardsLinkY) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); + } + this->actor.initPosRot.rot.z += (s16)((this->actor.velocity.y + 3.0f) * 1000.0f); + this->actor.posRot.pos.x += + Math_Coss(this->actor.rotTowardsLinkY) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); + this->actor.posRot.pos.z += + Math_Sins(this->actor.rotTowardsLinkY) * (-3.0f * Math_Coss(this->actor.initPosRot.rot.z)); } } - if (this->actor.params <= DROP_RUPEE_RED) - { + if (this->actor.params <= DROP_RUPEE_RED) { this->actor.shape.rot.y += 960; - } - else if ((this->actor.params >= DROP_SHIELD_DEKU) && (this->actor.params != DROP_BOMBS_SPECIAL)) - { + } else if ((this->actor.params >= DROP_SHIELD_DEKU) && (this->actor.params != DROP_BOMBS_SPECIAL)) { this->actor.posRot.rot.x -= 700; this->actor.shape.rot.y += 400; this->actor.shape.rot.x = this->actor.posRot.rot.x - 0x4000; } - if (this->actor.velocity.y <= 2.0f) - { + if (this->actor.velocity.y <= 2.0f) { var1 = (u16)this->actor.shape.rot.z + 10000; - if (var1 < 65535) + if (var1 < 65535) { this->actor.shape.rot.z += 10000; - else + } else { this->actor.shape.rot.z = -1; + } } - if (!(globalCtx->gameplayFrames & 1)) - { + if (!(globalCtx->gameplayFrames & 1)) { pos.x = this->actor.posRot.pos.x + (Math_Rand_ZeroOne() - 0.5f) * 10.0f; pos.y = this->actor.posRot.pos.y + (Math_Rand_ZeroOne() - 0.5f) * 10.0f; pos.z = this->actor.posRot.pos.z + (Math_Rand_ZeroOne() - 0.5f) * 10.0f; func_80028B74(globalCtx, &pos, &D_80115518, &D_80115524, &D_80115510, &D_80115514); } - if (this->actor.bgCheckFlags & 0x0003) - { + if (this->actor.bgCheckFlags & 0x0003) { En_Item00_SetNewUpdate(this, (ActorFunc)func_8001DFC8); this->actor.shape.rot.z = 0; this->actor.velocity.y = 0.0f; @@ -455,40 +431,36 @@ void func_8001E304(ActorEnItem00* this, GlobalContext* globalCtx) } } -void func_8001E5C8(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void func_8001E5C8(ActorEnItem00* this, GlobalContext* globalCtx) { Player* player = PLAYER; - if (this->unk_152 != 0) - { - if (!func_8002F410(&this->actor, globalCtx)) - { + if (this->unk_152 != 0) { + if (!func_8002F410(&this->actor, globalCtx)) { func_8002F434(&this->actor, globalCtx, this->unk_152, 50.0f, 80.0f); this->unk_15A++; - } - else - { + } else { this->unk_152 = 0; } } - if (this->unk_15A == 0) - { + if (this->unk_15A == 0) { Actor_Kill(&this->actor); return; } this->actor.posRot.pos = player->actor.posRot.pos; - if (this->actor.params <= DROP_RUPEE_RED) + if (this->actor.params <= DROP_RUPEE_RED) { this->actor.shape.rot.y += 960; - else if (this->actor.params == DROP_HEART) + } else if (this->actor.params == DROP_HEART) { this->actor.shape.rot.y = 0; + } this->actor.posRot.pos.y += 40.0f + Math_Sins(this->unk_15A * 15000) * (this->unk_15A * 0.3f); - if LINK_IS_ADULT - this->actor.posRot.pos.y += 20.0f; + if + LINK_IS_ADULT + this->actor.posRot.pos.y += 20.0f; } extern s32 D_80157D90; @@ -497,8 +469,7 @@ extern s16 D_80157D94; #ifdef NON_MATCHING // Almost matching, just a few minor ordering issues -void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) { s32 pad1; s32 pad2; s32 sp3C; @@ -521,44 +492,34 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; - if (this->actor.gravity) - { - if (this->actor.bgCheckFlags & 0x0003) - { + if (this->actor.gravity) { + if (this->actor.bgCheckFlags & 0x0003) { // Separate symbols seem to be used here for 0x80157D90 since the loads and stores are completely separate - if (D_80157D90 != globalCtx->gameplayFrames) - { + if (D_80157D90 != globalCtx->gameplayFrames) { D_80157D90_ = globalCtx->gameplayFrames; D_80157D94 = 0; - for (i = 0; i < 50; i++) - { - if (globalCtx->colCtx.dyna.flags[i] & 1) - { + for (i = 0; i < 50; i++) { + if (globalCtx->colCtx.dyna.flags[i] & 1) { dynaActor = globalCtx->colCtx.dyna.actorMeshArr[i].actor; if ((dynaActor != NULL) && (dynaActor->update != NULL) && ((dynaActor->posRot.pos.x != dynaActor->pos4.x) || (dynaActor->posRot.pos.y != dynaActor->pos4.y) || - (dynaActor->posRot.pos.z != dynaActor->pos4.z))) - { + (dynaActor->posRot.pos.z != dynaActor->pos4.z))) { D_80157D94++; break; } } } } - } - else - { + } else { sp3A = 1; Actor_MoveForward(&this->actor); } - if (sp3A || D_80157D94) - { + if (sp3A || D_80157D94) { func_8002E4B4(globalCtx, &this->actor, 10.0f, 15.0f, 15.0f, 0x1D); - if (this->actor.unk_80 <= -10000.0f) - { + if (this->actor.unk_80 <= -10000.0f) { Actor_Kill(&this->actor); return; } @@ -569,8 +530,7 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->cylinderCollider); if ((this->actor.params == DROP_SHIELD_DEKU) || (this->actor.params == DROP_SHIELD_HYLIAN) || - (this->actor.params == DROP_TUNIC_ZORA) || (this->actor.params == DROP_TUNIC_GORON)) - { + (this->actor.params == DROP_TUNIC_ZORA) || (this->actor.params == DROP_TUNIC_GORON)) { f32 newUnkBC = Math_Coss(this->actor.shape.rot.x) * 37.0f; this->actor.shape.unk_08 = newUnkBC; if (newUnkBC >= 0.0f) @@ -583,8 +543,7 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) return; // MISMATCH: The first function argument is loaded too early here - if (!((this->actor.xzDistanceFromLink <= 30.0f) && - (this->actor.yDistanceFromLink >= -50.0f) && + if (!((this->actor.xzDistanceFromLink <= 30.0f) && (this->actor.yDistanceFromLink >= -50.0f) && (this->actor.yDistanceFromLink <= 50.0f))) if (!func_8002F410(&this->actor, globalCtx)) return; @@ -592,8 +551,7 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) if (globalCtx->unk_10A20 != 0) return; - switch (this->actor.params) - { + switch (this->actor.params) { case DROP_RUPEE_GREEN: Item_Give(globalCtx, ITEM_RUPEE_GREEN); break; @@ -675,8 +633,7 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) if ((sp3C != 0) && !func_8002F410(&this->actor, globalCtx)) func_8002F554(&this->actor, globalCtx, sp3C); - switch (this->actor.params) - { + switch (this->actor.params) { case DROP_HEART_PIECE: case DROP_HEART_CONTAINER: case DROP_SMALL_KEY: @@ -684,29 +641,22 @@ void En_Item00_Update(ActorEnItem00* this, GlobalContext* globalCtx) case DROP_SHIELD_HYLIAN: case DROP_TUNIC_ZORA: case DROP_TUNIC_GORON: - if (func_8002F410(&this->actor, globalCtx)) - { + if (func_8002F410(&this->actor, globalCtx)) { Flags_SetCollectible(globalCtx, this->collectibleFlag); Actor_Kill(&this->actor); } return; } - if ((this->actor.params <= DROP_RUPEE_RED) || (this->actor.params == DROP_RUPEE_ORANGE)) - { + if ((this->actor.params <= DROP_RUPEE_RED) || (this->actor.params == DROP_RUPEE_ORANGE)) { Audio_PlaySoundGeneral(NA_SE_SY_GET_RUPY, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } - else if (sp3C != 0) - { - if (func_8002F410(&this->actor, globalCtx)) - { + } else if (sp3C != 0) { + if (func_8002F410(&this->actor, globalCtx)) { Flags_SetCollectible(globalCtx, this->collectibleFlag); Actor_Kill(&this->actor); } return; - } - else - { + } else { Audio_PlaySoundGeneral(NA_SE_SY_GET_ITEM, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -734,15 +684,12 @@ void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx); void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx); void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx); -void En_Item00_Draw(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void En_Item00_Draw(ActorEnItem00* this, GlobalContext* globalCtx) { s32 pad; f32 unkFloat; - if (!(this->unk_156 & this->unk_158)) - { - switch (this->actor.params) - { + if (!(this->unk_156 & this->unk_158)) { + switch (this->actor.params) { case DROP_RUPEE_GREEN: case DROP_RUPEE_BLUE: case DROP_RUPEE_RED: @@ -757,20 +704,15 @@ void En_Item00_Draw(ActorEnItem00* this, GlobalContext* globalCtx) func_8001F1F4(this, globalCtx); break; case DROP_HEART: - if (this->unk_15A < 0) - { - if (this->unk_15A == -1) - { + if (this->unk_15A < 0) { + if (this->unk_15A == -1) { s8 bankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GI_HEART); - if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) - { + if (Object_IsLoaded(&globalCtx->objectCtx, bankIndex)) { this->actor.objBankIndex = bankIndex; Actor_SetObjectDependency(globalCtx, &this->actor); this->unk_15A = -2; } - } - else - { + } else { unkFloat = 16.0f; Matrix_Scale(unkFloat, unkFloat, unkFloat, MTXMODE_APPLY); func_800694A0(globalCtx, 0x08); @@ -813,8 +755,7 @@ void En_Item00_Draw(ActorEnItem00* this, GlobalContext* globalCtx) /** * Draw Function used for Rupee types of En_Item00. */ -void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 iconNb; Gfx* gfxArr[5]; @@ -824,15 +765,16 @@ void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx) func_80093D18(globalCtx->state.gfxCtx); func_8002EBCC(&this->actor, globalCtx, 0); - if (1) // Necessary to match - { - if (this->actor.params <= DROP_RUPEE_RED) + if (1) { // Necessary to match + if (this->actor.params <= DROP_RUPEE_RED) { iconNb = this->actor.params; - else + } else { iconNb = this->actor.params - 0x10; + } } - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80115530[iconNb])); @@ -844,8 +786,7 @@ void func_8001EF30(ActorEnItem00* this, GlobalContext* globalCtx) /** * Draw Function used for most collectible types of En_Item00 (ammo, bombs, sticks, nuts, magic...). */ -void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx) { s32 iconNb; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -856,16 +797,18 @@ void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx) gfxCtx->polyOpa.p = func_800BC8A0(globalCtx, gfxCtx->polyOpa.p); - if (this->actor.params == DROP_BOMBS_SPECIAL) + if (this->actor.params == DROP_BOMBS_SPECIAL) { iconNb = 1; - else if (this->actor.params >= DROP_ARROWS_SMALL) + } else if (this->actor.params >= DROP_ARROWS_SMALL) { iconNb -= 3; + } gfxCtx->polyOpa.p = func_800946E4(gfxCtx->polyOpa.p); gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80115544[iconNb])); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, &D_0403F070); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_item00.c", 1611); @@ -874,8 +817,7 @@ void func_8001F080(ActorEnItem00* this, GlobalContext* globalCtx) /** * Draw Function used for the Heart Container type of En_Item00. */ -void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -883,12 +825,14 @@ void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx) func_80093D18(globalCtx->state.gfxCtx); func_8002EBCC(&this->actor, globalCtx, 0); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1634), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1634), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, &D_0403BBA0); func_80093D84(globalCtx->state.gfxCtx); func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1644), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1644), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, &D_0403BCD8); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_item00.c", 1647); @@ -897,8 +841,7 @@ void func_8001F1F4(ActorEnItem00* this, GlobalContext* globalCtx) /** * Draw Function used for the Piece of Heart type of En_Item00. */ -void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx) -{ +void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -906,7 +849,8 @@ void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx) func_80093D84(globalCtx->state.gfxCtx); func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1670), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1670), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyXlu.p++, &D_0403B030); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_item00.c", 1673); @@ -916,38 +860,39 @@ void func_8001F334(ActorEnItem00* this, GlobalContext* globalCtx) * Converts a given drop type ID based on link's current age, health and owned items. * Returns a new drop type ID or -1 to cancel the drop. */ -s16 func_8001F404(s16 dropId) -{ - if (LINK_IS_ADULT) - { - if (dropId == DROP_SEEDS) +s16 func_8001F404(s16 dropId) { + if (LINK_IS_ADULT) { + if (dropId == DROP_SEEDS) { dropId = DROP_ARROWS_SMALL; - else if (dropId == DROP_STICK) + } else if (dropId == DROP_STICK) { dropId = DROP_RUPEE_GREEN; - } - else - { - if (dropId == DROP_ARROWS_SMALL || dropId == DROP_ARROWS_MEDIUM || dropId == DROP_ARROWS_LARGE) + } + } else { + if (dropId == DROP_ARROWS_SMALL || dropId == DROP_ARROWS_MEDIUM || dropId == DROP_ARROWS_LARGE) { dropId = DROP_SEEDS; + } } // This is convoluted but it seems like it must be a single condition to match + // clang-format off if (((dropId == DROP_BOMBS_A || dropId == DROP_BOMBS_SPECIAL || dropId == DROP_BOMBS_B) && INV_CONTENT(ITEM_BOMB) == ITEM_NONE) || ((dropId == DROP_ARROWS_SMALL || dropId == DROP_ARROWS_MEDIUM || dropId == DROP_ARROWS_LARGE) && INV_CONTENT(ITEM_BOW) == ITEM_NONE) || ((dropId == DROP_MAGIC_LARGE || dropId == DROP_MAGIC_SMALL) && gSaveContext.magic_level == 0) || - ((dropId == DROP_SEEDS) && INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE)) + ((dropId == DROP_SEEDS) && INV_CONTENT(ITEM_SLINGSHOT) == ITEM_NONE)) { return -1; + } + // clang-format on - if (dropId == DROP_HEART && gSaveContext.health_capacity == gSaveContext.health) + if (dropId == DROP_HEART && gSaveContext.health_capacity == gSaveContext.health) { return DROP_RUPEE_GREEN; + } return dropId; } // External functions used by other actors to drop collectibles, which usually results in spawning an En_Item00 actor. -Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) -{ +Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { s32 pad[2]; ActorEnItem00* spawnedActor = NULL; s16 param4000 = params & 0x4000; @@ -956,26 +901,21 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 param params = params & 0x3FFF; - if (((params & 0x00FF) == DROP_FLEXIBLE) && !param4000) - { + if (((params & 0x00FF) == DROP_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to ActorEnItem00 here since this is a different actor (En_Elf) - spawnedActor = (ActorEnItem00*) Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, - spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, - 0, 0, 0, 0x0002); + spawnedActor = (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, + spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 0x0002); func_8002A9F4(globalCtx, spawnPos, 0x28E7, 1, 1, 0x28); - } - else - { - if (!param8000) + } else { + if (!param8000) { params = func_8001F404(params & 0x00FF); + } - if (params != -1) - { - spawnedActor = (ActorEnItem00*) Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, - spawnPos->x, spawnPos->y, spawnPos->z, - 0, 0, 0, params | param8000 | param3F00); - if ((spawnedActor != NULL) && !param8000) - { + if (params != -1) { + spawnedActor = + (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, + spawnPos->z, 0, 0, 0, params | param8000 | param3F00); + if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = !param4000 ? 8.0f : -2.0f; spawnedActor->actor.speedXZ = 2.0f; spawnedActor->actor.gravity = -0.9f; @@ -985,8 +925,7 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 param spawnedActor->unk_15A = 220; if ((spawnedActor->actor.params != DROP_SMALL_KEY) && (spawnedActor->actor.params != DROP_HEART_PIECE) && - (spawnedActor->actor.params != DROP_HEART_CONTAINER)) - { + (spawnedActor->actor.params != DROP_HEART_CONTAINER)) { spawnedActor->actor.room = -1; } spawnedActor->actor.flags |= 0x0010; @@ -994,11 +933,10 @@ Actor* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 param } } - return (Actor*) spawnedActor; + return (Actor*)spawnedActor; } -Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) -{ +Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 params) { ActorEnItem00* spawnedActor = NULL; s32 pad; s16 param4000 = params & 0x4000; @@ -1007,24 +945,18 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 para params = params & 0x3FFF; - if (((params & 0x00FF) == DROP_FLEXIBLE) && !param4000) - { + if (((params & 0x00FF) == DROP_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to ActorEnItem00 here since this is a different actor (En_Elf) - spawnedActor = (ActorEnItem00*) Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, - spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, - 0, 0, 0, 0x0002); + spawnedActor = (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, + spawnPos->y + 40.0f, spawnPos->z, 0, 0, 0, 0x0002); func_8002A9F4(globalCtx, spawnPos, 0x28E7, 1, 1, 0x28); - } - else - { + } else { params = func_8001F404(params & 0x00FF); - if (params != -1) - { - spawnedActor = (ActorEnItem00*) Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, - spawnPos->x, spawnPos->y, spawnPos->z, - 0, 0, 0, params | param8000 | param3F00); - if ((spawnedActor != NULL) && !param8000) - { + if (params != -1) { + spawnedActor = + (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, spawnPos->x, spawnPos->y, + spawnPos->z, 0, 0, 0, params | param8000 | param3F00); + if ((spawnedActor != NULL) && !param8000) { spawnedActor->actor.velocity.y = 0.0f; spawnedActor->actor.speedXZ = 0.0f; spawnedActor->actor.gravity = param4000 ? 0.0f : -0.9f; @@ -1034,11 +966,10 @@ Actor* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 para } } - return (Actor*) spawnedActor; + return (Actor*)spawnedActor; } -void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) -{ +void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3f* spawnPos, s16 params) { s32 pad; ActorEnItem00* spawnedActor; s16 dropQuantity; @@ -1050,133 +981,93 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 param8000 = params & 0x8000; params = params & 0x7FFF; - if (fromActor != NULL) - { - if (fromActor->unk_116) - { - if (fromActor->unk_116 & 0x01) - { + if (fromActor != NULL) { + if (fromActor->unk_116) { + if (fromActor->unk_116 & 0x01) { params = 1 * 0x10; dropTableIndex = 0xB; - } - else if (fromActor->unk_116 & 0x02) - { + } else if (fromActor->unk_116 & 0x02) { params = 1 * 0x10; dropTableIndex = 0x6; - } - else if (fromActor->unk_116 & 0x04) - { + } else if (fromActor->unk_116 & 0x04) { params = 6 * 0x10; dropTableIndex = 0x9; - } - else if (fromActor->unk_116 & 0x08) - { + } else if (fromActor->unk_116 & 0x08) { params = 3 * 0x10; dropTableIndex = 0xB; - } - else if (fromActor->unk_116 & 0x10) - { + } else if (fromActor->unk_116 & 0x10) { params = 6 * 0x10; dropTableIndex = 0xC; - } - else if (fromActor->unk_116 & 0x20) - { + } else if (fromActor->unk_116 & 0x20) { params = 0 * 0x10; dropTableIndex = 0x0; - } - else if (fromActor->unk_116 & 0x40) - { + } else if (fromActor->unk_116 & 0x40) { params = 0 * 0x10; dropTableIndex = 0x1; } } - if (fromActor->unk_116 & 0x20) + if (fromActor->unk_116 & 0x20) { dropId = DROP_RUPEE_PURPLE; - else + } else { dropId = D_80115574[params + dropTableIndex]; - } - else + } + } else { dropId = D_80115574[params + dropTableIndex]; + } - if (dropId == DROP_FLEXIBLE) - { - if (gSaveContext.health <= 0x10) // 1 heart or less - { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, - spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, - 0, 0, 0, 0x0002); + if (dropId == DROP_FLEXIBLE) { + if (gSaveContext.health <= 0x10) { // 1 heart or less + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x, spawnPos->y + 40.0f, spawnPos->z, 0, + 0, 0, 0x0002); func_8002A9F4(globalCtx, spawnPos, 0x28E7, 1, 1, 0x28); return; - } - else if (gSaveContext.health <= 0x30) // 3 hearts or less - { + } else if (gSaveContext.health <= 0x30) { // 3 hearts or less params = 0xB * 0x10; dropTableIndex = 0x0; dropId = DROP_HEART; - } - else if (gSaveContext.health <= 0x50) // 5 hearts or less - { + } else if (gSaveContext.health <= 0x50) { // 5 hearts or less params = 0xA * 0x10; dropTableIndex = 0x0; dropId = DROP_HEART; - } - else if ((gSaveContext.magic_level != 0) && (gSaveContext.magic == 0)) // Empty magic meter - { + } else if ((gSaveContext.magic_level != 0) && (gSaveContext.magic == 0)) { // Empty magic meter params = 0xA * 0x10; dropTableIndex = 0x0; dropId = DROP_MAGIC_LARGE; - } - else if ((gSaveContext.magic_level != 0) && (gSaveContext.magic <= (gSaveContext.magic_level >> 1))) // Half magic or less - { + } else if ((gSaveContext.magic_level != 0) && + (gSaveContext.magic <= (gSaveContext.magic_level >> 1))) { // Half magic or less params = 0xA * 0x10; dropTableIndex = 0x0; dropId = DROP_MAGIC_SMALL; - } - else if (LINK_IS_CHILD && (AMMO(ITEM_SLINGSHOT) < 6)) // Child and less then 6 deku seeds - { + } else if (LINK_IS_CHILD && (AMMO(ITEM_SLINGSHOT) < 6)) { // Child and less then 6 deku seeds params = 0xA * 0x10; dropTableIndex = 0x0; dropId = DROP_SEEDS; - } - else if (LINK_IS_ADULT && (AMMO(ITEM_BOW) < 6)) // Adult and less than 6 arrows - { + } else if (LINK_IS_ADULT && (AMMO(ITEM_BOW) < 6)) { // Adult and less than 6 arrows params = 0xA * 0x10; dropTableIndex = 0x0; dropId = DROP_ARROWS_MEDIUM; - } - else if (AMMO(ITEM_BOMB) < 6) // Less than 6 bombs - { + } else if (AMMO(ITEM_BOMB) < 6) { // Less than 6 bombs params = 0xD * 0x10; dropTableIndex = 0x0; dropId = DROP_BOMBS_A; - } - else if (gSaveContext.rupees < 11) // Less than 11 Rupees - { + } else if (gSaveContext.rupees < 11) { // Less than 11 Rupees params = 0xA * 0x10; dropTableIndex = 0x0; dropId = DROP_RUPEE_RED; - } - else - { + } else { return; } } - if (dropId != 0xFF) - { + if (dropId != 0xFF) { dropQuantity = D_80115664[params + dropTableIndex]; - while (dropQuantity > 0) - { - if (!param8000) - { + while (dropQuantity > 0) { + if (!param8000) { dropId = func_8001F404(dropId); - if (dropId != 0xFF) - { - spawnedActor = (ActorEnItem00*) Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, - spawnPos->x, spawnPos->y, spawnPos->z, - 0, 0, 0, dropId); - if ((spawnedActor != NULL) && (dropId != 0xFF)) - { + if (dropId != 0xFF) { + spawnedActor = (ActorEnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, + spawnPos->x, spawnPos->y, spawnPos->z, 0, 0, 0, dropId); + if ((spawnedActor != NULL) && (dropId != 0xFF)) { spawnedActor->actor.velocity.y = 8.0f; spawnedActor->actor.speedXZ = 2.0f; spawnedActor->actor.gravity = -0.9f; @@ -1186,16 +1077,13 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3 spawnedActor->actor.flags |= 0x0010; if ((spawnedActor->actor.params != DROP_SMALL_KEY) && (spawnedActor->actor.params != DROP_HEART_PIECE) && - (spawnedActor->actor.params != DROP_HEART_CONTAINER)) - { + (spawnedActor->actor.params != DROP_HEART_CONTAINER)) { spawnedActor->actor.room = -1; } spawnedActor->unk_15A = 220; } } - } - else - { + } else { Item_DropCollectible(globalCtx, spawnPos, params | 0x8000); } dropQuantity--; diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index 8035620363..e2b6f3cefc 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -18,4 +18,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B23E8.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B23F0.s") - diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index bb9c5e8cde..8feea0af9f 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -14,4 +14,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006CBAC.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006CF6C.s") - diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 69a0e6f3a8..13f6382f52 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -2,22 +2,20 @@ #include #include -s32 func_8006CFC0(s32 scene) -{ +s32 func_8006CFC0(s32 scene) { s32 validScenes[] = { SCENE_SPOT00, SCENE_SPOT06, SCENE_SPOT09, SCENE_SPOT12, SCENE_SPOT20 }; s32 i; - for (i = 0; i < ARRAY_COUNT(validScenes); i++) - { - if (scene == validScenes[i]) + for (i = 0; i < ARRAY_COUNT(validScenes); i++) { + if (scene == validScenes[i]) { return 1; + } } return 0; } -void func_8006D074(GlobalContext* globalCtx) -{ +void func_8006D074(GlobalContext* globalCtx) { gSaveContext.horse_data.scene = SCENE_SPOT00; gSaveContext.horse_data.pos.x = -1840; gSaveContext.horse_data.pos.y = 72; @@ -25,10 +23,8 @@ void func_8006D074(GlobalContext* globalCtx) gSaveContext.horse_data.angle = -27353; } -void func_8006D0AC(GlobalContext* globalCtx) -{ - if (gSaveContext.horse_data.scene == SCENE_SPOT06) - { +void func_8006D0AC(GlobalContext* globalCtx) { + if (gSaveContext.horse_data.scene == SCENE_SPOT06) { gSaveContext.horse_data.scene = SCENE_SPOT06; gSaveContext.horse_data.pos.x = -2065; gSaveContext.horse_data.pos.y = -863; @@ -37,147 +33,126 @@ void func_8006D0AC(GlobalContext* globalCtx) } } -typedef struct -{ - /* 0x00 */ s16 scene; +typedef struct { + /* 0x00 */ s16 scene; /* 0x02 */ Vec3s pos; - /* 0x08 */ s16 angle; - /* 0x0A */ s16 type; + /* 0x08 */ s16 angle; + /* 0x0A */ s16 type; } HorseSpawn; -void func_8006D0EC(GlobalContext* globalCtx, Player* player) -{ +void func_8006D0EC(GlobalContext* globalCtx, Player* player) { s32 i; - HorseSpawn horseSpawns[] = - { - { 81, 0xFE34, 0x0064, 0x19F0, 0, 2 }, - { 87, 0xF877, 0xFBFF, 0x0300, 0, 2 }, - { 90, 0x0A06, 0xFEFD, 0x02FF, 0, 2 }, - { 93, 0xFEB8, 0x000A, 0x03B9, 0, 2 }, + HorseSpawn horseSpawns[] = { + { 81, 0xFE34, 0x0064, 0x19F0, 0, 2 }, { 87, 0xF877, 0xFBFF, 0x0300, 0, 2 }, + { 90, 0x0A06, 0xFEFD, 0x02FF, 0, 2 }, { 93, 0xFEB8, 0x000A, 0x03B9, 0, 2 }, { 99, 0x03A0, 0x0000, 0xF718, 0, 2 }, }; - if ((AREG(6) != 0) && (Flags_GetEventChkInf(0x18) || (DREG(1) != 0))) - { - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - player->actor.posRot.pos.x, player->actor.posRot.pos.y, player->actor.posRot.pos.z, - player->actor.shape.rot.x, player->actor.shape.rot.y, player->actor.shape.rot.z, 9); - if (player->rideActor == NULL) + if ((AREG(6) != 0) && (Flags_GetEventChkInf(0x18) || (DREG(1) != 0))) { + player->rideActor = + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.posRot.pos.x, + player->actor.posRot.pos.y, player->actor.posRot.pos.z, player->actor.shape.rot.x, + player->actor.shape.rot.y, player->actor.shape.rot.z, 9); + if (player->rideActor == NULL) { __assert("player->ride.actor != NULL", "../z_horse.c", 343); + } func_8002DECC(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); gSaveContext.horse_data.scene = globalCtx->sceneNum; - if (globalCtx->sceneNum == SCENE_SPOT12) + if (globalCtx->sceneNum == SCENE_SPOT12) { player->rideActor->room = -1; - } - else if ((globalCtx->sceneNum == SCENE_SPOT12) && (gSaveContext.minigame_state == 3)) - { + } + } else if ((globalCtx->sceneNum == SCENE_SPOT12) && (gSaveContext.minigame_state == 3)) { Actor* horseActor; gSaveContext.minigame_state = 0; - horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - 3586.0f, 1413.0f, -402.0f, - 0, 0x4000, 0, 1); + horseActor = + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1); horseActor->room = -1; - } - else if ((gSaveContext.entrance_index == 1230) && (gSaveContext.event_chk_inf[1] & 0x100)) - { + } else if ((gSaveContext.entrance_index == 1230) && (gSaveContext.event_chk_inf[1] & 0x100)) { Actor* horseActor; - horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - -25.0f, 0.0f, -1600.0f, - 0, -0x4000, 0, 1); - if (horseActor == NULL) + horseActor = + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1); + if (horseActor == NULL) { __assert("horse_actor != NULL", "../z_horse.c", 389); - } - else if ((globalCtx->sceneNum == gSaveContext.horse_data.scene) && (Flags_GetEventChkInf(0x18) != 0 || DREG(1) != 0)) - { - // Translates to: "SET BY EXISTENCE OF HORSE %d %d %d" - osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horse_data.scene, Flags_GetEventChkInf(0x18), DREG(1)); - - if (func_8006CFC0(gSaveContext.horse_data.scene)) - { - Actor* horseActor; - horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - gSaveContext.horse_data.pos.x, gSaveContext.horse_data.pos.y, gSaveContext.horse_data.pos.z, - 0, gSaveContext.horse_data.angle, 0, 1); - if (horseActor == NULL) - __assert("horse_actor != NULL", "../z_horse.c", 414); - - if (globalCtx->sceneNum == SCENE_SPOT12) - horseActor->room = -1; } - else - { + } else if ((globalCtx->sceneNum == gSaveContext.horse_data.scene) && + (Flags_GetEventChkInf(0x18) != 0 || DREG(1) != 0)) { + // Translates to: "SET BY EXISTENCE OF HORSE %d %d %d" + osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horse_data.scene, Flags_GetEventChkInf(0x18), + DREG(1)); + + if (func_8006CFC0(gSaveContext.horse_data.scene)) { + Actor* horseActor; + horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, gSaveContext.horse_data.pos.x, + gSaveContext.horse_data.pos.y, gSaveContext.horse_data.pos.z, 0, + gSaveContext.horse_data.angle, 0, 1); + if (horseActor == NULL) { + __assert("horse_actor != NULL", "../z_horse.c", 414); + } + + if (globalCtx->sceneNum == SCENE_SPOT12) { + horseActor->room = -1; + } + } else { osSyncPrintf(VT_COL(RED, WHITE)); // Translates to: "Horse_SetNormal():%d SET SPOT IS NO GOOD." osSyncPrintf("Horse_SetNormal():%d セットスポットまずいです。\n", gSaveContext.horse_data.scene); osSyncPrintf(VT_RST); func_8006D074(globalCtx); } - } - else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) - { + } else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) { Actor* horseActor; - horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - 0.0f, 0.0f, -500.0f, - 0, 0, 0, 1); - if (horseActor == 0) + horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1); + if (horseActor == 0) { __assert("horse_actor != NULL", "../z_horse.c", 443); - } - else if (Flags_GetEventChkInf(0x18) || (DREG(1) != 0)) - { - for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) - { + } + } else if (Flags_GetEventChkInf(0x18) || (DREG(1) != 0)) { + for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) { HorseSpawn* horseSpawn = &horseSpawns[i]; - if (horseSpawn->scene == globalCtx->sceneNum) - { + if (horseSpawn->scene == globalCtx->sceneNum) { Actor* horseActor; - horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - horseSpawn->pos.x, horseSpawn->pos.y, horseSpawn->pos.z, - 0, horseSpawn->angle, 0, horseSpawn->type); - if (horseActor == NULL) + horseActor = + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y, + horseSpawn->pos.z, 0, horseSpawn->angle, 0, horseSpawn->type); + if (horseActor == NULL) { __assert("horse_actor != NULL", "../z_horse.c", 466); + } - if (globalCtx->sceneNum == SCENE_SPOT12) + if (globalCtx->sceneNum == SCENE_SPOT12) { horseActor->room = -1; + } break; } } - } - else if (!Flags_GetEventChkInf(0x18)) - { - if ((DREG(1) == 0) && (globalCtx->sceneNum == SCENE_SOUKO) &&(gSaveContext.night_flag != 0)) - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - 0.0f, 0.0f, -60.0f, - 0, 0x7360, 0, 1); + } else if (!Flags_GetEventChkInf(0x18)) { + if ((DREG(1) == 0) && (globalCtx->sceneNum == SCENE_SOUKO) && (gSaveContext.night_flag != 0)) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1); + } } } -typedef struct -{ - /* 0x00 */ s16 scene; - /* 0x04 */ s32 cutsceneIndex; +typedef struct { + /* 0x00 */ s16 scene; + /* 0x04 */ s32 cutsceneIndex; /* 0x08 */ Vec3s pos; - /* 0x0E */ s16 angle; - /* 0x10 */ s16 type; + /* 0x0E */ s16 angle; + /* 0x10 */ s16 type; } struct_8011F9B8; #ifdef NON_MATCHING // regalloc differences -void func_8006D684(GlobalContext* globalCtx, Player* player) -{ +void func_8006D684(GlobalContext* globalCtx, Player* player) { s32 pad; s32 i; Vec3s spawnPos; if ((gSaveContext.entrance_index == 0x028A || gSaveContext.entrance_index == 0x028E || gSaveContext.entrance_index == 0x0292 || gSaveContext.entrance_index == 0x0476) && - (gSaveContext.respawn_flag == 0)) - { - Vec3s spawnPositions[] = - { + (gSaveContext.respawn_flag == 0)) { + Vec3s spawnPositions[] = { { 0xF46F, 0x0139, 0x1E14 }, { 0xF894, 0x0139, 0x1B67 }, { 0xF035, 0x0139, 0x1B15 }, @@ -193,22 +168,18 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) else spawnPos = spawnPositions[3]; - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - spawnPos.x, spawnPos.y, spawnPos.z, - 0, player->actor.posRot.rot.y, 0, 7); + player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, + spawnPos.z, 0, player->actor.posRot.rot.y, 0, 7); if (player->rideActor == NULL) __assert("player->ride.actor != NULL", "../z_horse.c", 561); func_8002DECC(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); gSaveContext.horse_data.scene = globalCtx->sceneNum; - } - else if ((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.event_inf[0] & 0xF) == 6) && - (Flags_GetEventChkInf(0x18) == 0) && (DREG(1) == 0)) - { - player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - 894.0f, 0.0f, -2084.0f, - 0, -0x7FFF, 0, 5); + } else if ((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.event_inf[0] & 0xF) == 6) && + (Flags_GetEventChkInf(0x18) == 0) && (DREG(1) == 0)) { + player->rideActor = + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5); if (player->rideActor == NULL) __assert("player->ride.actor != NULL", "../z_horse.c", 582); @@ -218,45 +189,33 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) if (globalCtx->sceneNum == SCENE_SPOT12) player->rideActor->room = -1; - } - else - { - static struct_8011F9B8 D_8011F9B8[] = - { - { 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 }, - { 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 }, - { 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 }, - { 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 }, - { 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 }, - { 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 }, - { 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, - { 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, + } else { + static struct_8011F9B8 D_8011F9B8[] = { + { 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 }, { 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 }, + { 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 }, { 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 }, + { 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 }, { 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 }, + { 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, { 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, }; - for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) - { - if ((globalCtx->sceneNum == D_8011F9B8[i].scene) && (gSaveContext.cutscene_index == D_8011F9B8[i].cutsceneIndex)) - { - if (D_8011F9B8[i].type == 7) - { - if ((globalCtx->sceneNum == 99) && (gSaveContext.cutscene_index == 0xFFF1)) - { + for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) { + if ((globalCtx->sceneNum == D_8011F9B8[i].scene) && + (gSaveContext.cutscene_index == D_8011F9B8[i].cutsceneIndex)) { + if (D_8011F9B8[i].type == 7) { + if ((globalCtx->sceneNum == 99) && (gSaveContext.cutscene_index == 0xFFF1)) { D_8011F9B8[i].pos.x = player->actor.posRot.pos.x; D_8011F9B8[i].pos.y = player->actor.posRot.pos.y; D_8011F9B8[i].pos.z = player->actor.posRot.pos.z; } player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, - 0, player->actor.posRot.rot.y, 0, D_8011F9B8[i].type); + D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, + player->actor.posRot.rot.y, 0, D_8011F9B8[i].type); if (player->rideActor == NULL) __assert("player->ride.actor != NULL", "../z_horse.c", 628); func_8002DECC(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); - } - else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) - { + } else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) { Vec3f sp54; s32 temp; s32 pad2; @@ -266,8 +225,8 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) temp = 0x8000; player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, - 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp); + D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, + D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp); if (player->rideActor == NULL) __assert("player->ride.actor != NULL", "../z_horse.c", 667); @@ -285,12 +244,10 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) sp54.z = player->actor.posRot.pos.z; func_800C04D8(globalCtx, globalCtx->cameraCtx.unk_5C0, &player->actor.posRot, &sp54); - } - else - { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, - D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, - 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type); + } else { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, + D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, + D_8011F9B8[i].type); } break; } @@ -298,33 +255,24 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) } } #else -Vec3s D_8011F9A0[] = -{ +Vec3s D_8011F9A0[] = { { 0xF46F, 0x0139, 0x1E14 }, { 0xF894, 0x0139, 0x1B67 }, { 0xF035, 0x0139, 0x1B15 }, { 0xF6F7, 0x0139, 0x1766 }, }; -struct_8011F9B8 D_8011F9B8[] = -{ - { 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 }, - { 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 }, - { 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 }, - { 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 }, - { 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 }, - { 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 }, - { 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, - { 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, +struct_8011F9B8 D_8011F9B8[] = { + { 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 }, { 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 }, + { 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 }, { 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 }, + { 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 }, { 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 }, + { 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, { 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, }; #pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_8006D684.s") #endif -void func_8006DC68(GlobalContext* globalCtx, Player* player) -{ - if (LINK_IS_ADULT) - { - if (!func_8006CFC0(gSaveContext.horse_data.scene)) - { +void func_8006DC68(GlobalContext* globalCtx, Player* player) { + if (LINK_IS_ADULT) { + if (!func_8006CFC0(gSaveContext.horse_data.scene)) { osSyncPrintf(VT_COL(RED, WHITE)); // Translates to: "Horse_Set_Check():%d SET SPOT IS NO GOOD." osSyncPrintf("Horse_Set_Check():%d セットスポットまずいです。\n", gSaveContext.horse_data.scene); @@ -332,35 +280,31 @@ void func_8006DC68(GlobalContext* globalCtx, Player* player) func_8006D074(globalCtx); } - if (func_8006CFC0(globalCtx->sceneNum)) - { + if (func_8006CFC0(globalCtx->sceneNum)) { if ((gSaveContext.scene_setup_index > 3) || ((gSaveContext.entrance_index == 0x028A || gSaveContext.entrance_index == 0x028E || gSaveContext.entrance_index == 0x0292 || gSaveContext.entrance_index == 0x0476) && (gSaveContext.respawn_flag == 0)) || ((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.event_inf[0] & 0xF) == 6) && - !Flags_GetEventChkInf(0x18) && (DREG(1) == 0))) - { + !Flags_GetEventChkInf(0x18) && (DREG(1) == 0))) { func_8006D684(globalCtx, player); - } - else - { + } else { func_8006D0EC(globalCtx, player); } } } } -void func_8006DD9C(Actor* actor, Vec3f* arg1, s16 arg2) -{ +void func_8006DD9C(Actor* actor, Vec3f* arg1, s16 arg2) { s16 x = Math_Vec3f_Yaw(&actor->posRot.pos, arg1) - actor->posRot.rot.y; - if (x > arg2) + if (x > arg2) { actor->posRot.rot.y += arg2; - else if (x < -arg2) + } else if (x < -arg2) { actor->posRot.rot.y -= arg2; - else + } else { actor->posRot.rot.y += x; + } actor->shape.rot.y = actor->posRot.rot.y; } diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 93fe90b27f..5031ad8232 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -10,4 +10,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E0EC.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E418.s") - diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index ad5761ec71..519639a151 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,15 +1,13 @@ #include #include -#define KALEIDO_OVERLAY(name) \ - { \ - NULL, (u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, \ - _ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, \ - 0, #name, \ +#define KALEIDO_OVERLAY(name) \ + { \ + NULL, (u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \ + _ovl_##name##SegmentEnd, 0, #name, \ } -KaleidoManagerOvl gKaleidoMgrOverlayTable[] = -{ +KaleidoManagerOvl gKaleidoMgrOverlayTable[] = { KALEIDO_OVERLAY(kaleido_scope), KALEIDO_OVERLAY(player_actor), }; @@ -18,22 +16,21 @@ void* sKaleidoAreaPtr = NULL; KaleidoManagerOvl* gKaleidoMgrCurOvl = NULL; u32 D_8012D1E0 = 0; -void KaleidoManager_LoadOvl(KaleidoManagerOvl* ovl) -{ +void KaleidoManager_LoadOvl(KaleidoManagerOvl* ovl) { LogUtils_CheckNullPointer("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 99); ovl->loadedRamAddr = sKaleidoAreaPtr; Overlay_Load(ovl->vromStart, ovl->vromEnd, ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr); osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("OVL(k):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr, ((u32)ovl->loadedRamAddr + ovl->vramEnd) - (u32)ovl->vramStart, (u32)ovl->vramStart - (u32)ovl->loadedRamAddr, ovl->name); + osSyncPrintf("OVL(k):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr, + ((u32)ovl->loadedRamAddr + ovl->vramEnd) - (u32)ovl->vramStart, + (u32)ovl->vramStart - (u32)ovl->loadedRamAddr, ovl->name); osSyncPrintf(VT_RST); ovl->off = (u32)ovl->loadedRamAddr - (u32)ovl->vramStart; gKaleidoMgrCurOvl = ovl; } -void KaleidoManager_ClearOvl(KaleidoManagerOvl* ovl) -{ - if (ovl->loadedRamAddr) - { +void KaleidoManager_ClearOvl(KaleidoManagerOvl* ovl) { + if (ovl->loadedRamAddr) { ovl->off = 0; bzero(ovl->loadedRamAddr, ovl->vramEnd - (u32)ovl->vramStart); ovl->loadedRamAddr = NULL; @@ -41,18 +38,17 @@ void KaleidoManager_ClearOvl(KaleidoManagerOvl* ovl) } } -void KaleidoManager_Init(GlobalContext* globalCtx) -{ +void KaleidoManager_Init(GlobalContext* globalCtx) { s32 largestOvl; s32 vramSize; u32 idx; largestOvl = 0; - for (idx = 0; idx < ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++) - { + for (idx = 0; idx < ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++) { vramSize = gKaleidoMgrOverlayTable[idx].vramEnd - (u32)gKaleidoMgrOverlayTable[idx].vramStart; - if (largestOvl < vramSize) + if (largestOvl < vramSize) { largestOvl = vramSize; + } } osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestOvl); @@ -64,46 +60,41 @@ void KaleidoManager_Init(GlobalContext* globalCtx) osSyncPrintf(VT_RST); gKaleidoMgrCurOvl = 0; } -void KaleidoManager_Destroy() -{ - if (gKaleidoMgrCurOvl) - { +void KaleidoManager_Destroy() { + if (gKaleidoMgrCurOvl) { KaleidoManager_ClearOvl(gKaleidoMgrCurOvl); gKaleidoMgrCurOvl = NULL; } sKaleidoAreaPtr = NULL; } -//NOTE: this function looks messed up and probably doesn't work like how the devs wanted it to work -void* KaleidoManager_GetRamAddr(void* vram) -{ +// NOTE: this function looks messed up and probably doesn't work like how the devs wanted it to work +void* KaleidoManager_GetRamAddr(void* vram) { KaleidoManagerOvl* iter; KaleidoManagerOvl* ovl; u32 idx; iter = gKaleidoMgrCurOvl; ovl = iter; - if (!ovl) - { + if (!ovl) { iter = &gKaleidoMgrOverlayTable[0]; - for (idx = 0; idx != ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++) - { - if ((u32)vram >= (u32)iter->vramStart && (u32)iter->vramEnd >= (u32)vram) - { + for (idx = 0; idx != ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++) { + if ((u32)vram >= (u32)iter->vramStart && (u32)iter->vramEnd >= (u32)vram) { KaleidoManager_LoadOvl(iter); ovl = iter; goto KaleidoManager_GetRamAddr_end; } - //BUG: devs probably forgot iter++ here + // BUG: devs probably forgot iter++ here } - - osSyncPrintf("異常\n"); //Abnormal + + osSyncPrintf("異常\n"); // Abnormal return NULL; } KaleidoManager_GetRamAddr_end: - if (!ovl || (u32)vram < (u32)ovl->vramStart || (u32)vram >= (u32)ovl->vramEnd) + if (!ovl || (u32)vram < (u32)ovl->vramStart || (u32)vram >= (u32)ovl->vramEnd) { return NULL; + } return (void*)((u32)vram + ovl->off); } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 7932415dfb..a722beff94 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -7,34 +7,30 @@ float D_80161398; u32 D_8016139C; void* D_801613A0; -extern void func_80826CB4(GlobalContext*); //KaleidoScope_Update -extern void func_808262B8(GlobalContext*); //KaleidoScope_Draw +extern void func_80826CB4(GlobalContext*); // KaleidoScope_Update +extern void func_808262B8(GlobalContext*); // KaleidoScope_Draw -void KaleidoScopeCall_LoadPlayer() -{ - if ((u32)gKaleidoMgrCurOvl != (u32)&gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]) - { - if (gKaleidoMgrCurOvl) - { +void KaleidoScopeCall_LoadPlayer() { + if ((u32)gKaleidoMgrCurOvl != (u32)&gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]) { + if (gKaleidoMgrCurOvl) { osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("カレイド領域 強制排除\n"); //Kaleido area forced exclusion + osSyncPrintf("カレイド領域 強制排除\n"); // Kaleido area forced exclusion osSyncPrintf(VT_RST); KaleidoManager_ClearOvl(gKaleidoMgrCurOvl); } osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("プレイヤーアクター搬入\n"); //Player actor import + osSyncPrintf("プレイヤーアクター搬入\n"); // Player actor import osSyncPrintf(VT_RST); KaleidoManager_LoadOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]); } } -void KaleidoScopeCall_Init(GlobalContext* globalCtx) -{ - //Kaleidoscope replacement construct +void KaleidoScopeCall_Init(GlobalContext* globalCtx) { + // Kaleidoscope replacement construct osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n"); sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(func_80826CB4); sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(func_808262B8); - //Note : the line numbers suggests there was a macro (see logutils.c) + // Note : the line numbers suggests there was a macro (see logutils.c) LogUtils_LogThreadId("../z_kaleido_scope_call.c", 98); osSyncPrintf("kaleido_scope_move = %08x\n", func_80826CB4); LogUtils_LogThreadId("../z_kaleido_scope_call.c", 99); @@ -46,28 +42,23 @@ void KaleidoScopeCall_Init(GlobalContext* globalCtx) func_8006ECF4(globalCtx); } -void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) -{ - //Kaleidoscope replacement +void KaleidoScopeCall_Destroy(GlobalContext* globalCtx) { + // Kaleidoscope replacement osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n"); func_8006EE48(globalCtx); } -//regalloc +// regalloc #ifdef NON_MATCHING -void KaleidoScopeCall_Update(GlobalContext* globalCtx) -{ +void KaleidoScopeCall_Update(GlobalContext* globalCtx) { u32 pad; PauseContext* pauseCtx; - + pauseCtx = &globalCtx->pauseCtx; - if (pauseCtx->state != 0 || pauseCtx->flag != 0) - { - if (pauseCtx->state == 1) - { - if (func_800B38FC() == 0) - { + if (pauseCtx->state != 0 || pauseCtx->flag != 0) { + if (pauseCtx->state == 1) { + if (func_800B38FC() == 0) { HREG(80) = 7; HREG(82) = 3; R_PAUSE_MENU_MODE = 1; @@ -75,45 +66,35 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) pauseCtx->unk_1EC = 0; pauseCtx->state++; } - } - else if (pauseCtx->state == 8) - { + } else if (pauseCtx->state == 8) { HREG(80) = 7; HREG(82) = 3; R_PAUSE_MENU_MODE = 1; pauseCtx->unk_1E4 = 0; pauseCtx->unk_1EC = 0; pauseCtx->state++; - } - else if (pauseCtx->state == 2 || pauseCtx->state == 9) - { + } else if (pauseCtx->state == 2 || pauseCtx->state == 9) { osSyncPrintf("R_PAUSE_MENU_MODE=%d\n", R_PAUSE_MENU_MODE); if (R_PAUSE_MENU_MODE >= 3) pauseCtx->state++; - } - else if (pauseCtx->state != 0) - { - if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] != gKaleidoMgrCurOvl) - { - if (gKaleidoMgrCurOvl) - { + } else if (pauseCtx->state != 0) { + if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] != gKaleidoMgrCurOvl) { + if (gKaleidoMgrCurOvl) { osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("カレイド領域 プレイヤー 強制排除\n"); //Kaleid Zone Player Forced Elimination + osSyncPrintf("カレイド領域 プレイヤー 強制排除\n"); // Kaleid Zone Player Forced Elimination osSyncPrintf(VT_RST); KaleidoManager_ClearOvl(gKaleidoMgrCurOvl); } osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("カレイド領域 カレイドスコープ搬入\n"); //Kaleid area Kaleidoscope loading + osSyncPrintf("カレイド領域 カレイドスコープ搬入\n"); // Kaleid area Kaleidoscope loading osSyncPrintf(VT_RST); KaleidoManager_LoadOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]); } - if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] == gKaleidoMgrCurOvl) - { + if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] == gKaleidoMgrCurOvl) { sKaleidoScopeUpdateFunc(globalCtx); - if (globalCtx->pauseCtx.state == 0 && globalCtx->pauseCtx.flag == 0) - { + if (globalCtx->pauseCtx.state == 0 && globalCtx->pauseCtx.flag == 0) { osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); //Kaleid area Kaleidoscope emission + osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); // Kaleid area Kaleidoscope emission osSyncPrintf(VT_RST); KaleidoManager_ClearOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]); KaleidoScopeCall_LoadPlayer(); @@ -126,18 +107,16 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_kaleido_scope_call/KaleidoScopeCall_Update.s") #endif -void KaleidoScopeCall_Draw(GlobalContext* globalCtx) -{ - KaleidoManagerOvl *kaleidoScopeOvl; +void KaleidoScopeCall_Draw(GlobalContext* globalCtx) { + KaleidoManagerOvl* kaleidoScopeOvl; - if (R_PAUSE_MENU_MODE >= 3) - { - if ((globalCtx->pauseCtx.state >= 4 && globalCtx->pauseCtx.state < 8) || (globalCtx->pauseCtx.state >= 11 && globalCtx->pauseCtx.state < 19)) - { + if (R_PAUSE_MENU_MODE >= 3) { + if ((globalCtx->pauseCtx.state >= 4 && globalCtx->pauseCtx.state < 8) || + (globalCtx->pauseCtx.state >= 11 && globalCtx->pauseCtx.state < 19)) { kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - if (gKaleidoMgrCurOvl == kaleidoScopeOvl) + if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeDrawFunc(globalCtx); + } } } - } diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index fb58245bd1..fc2c0b1e8f 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -6,4 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EEBC.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EF10.s") - diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 94f8bf6dc7..7caa221e5d 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -31,8 +31,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80073A5C.s") -f32 func_800746DC() -{ +f32 func_800746DC() { return Math_Rand_ZeroOne() - 0.5f; } @@ -70,23 +69,19 @@ f32 func_800746DC() #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800773A8.s") -s32 func_800775CC() -{ +s32 func_800775CC() { return gSaveContext.unk_18; } -void func_800775D8() -{ +void func_800775D8() { gSaveContext.unk_18 = 0; } -s32 func_800775E4() -{ +s32 func_800775E4() { return gSaveContext.unk_14; } -void func_800775F0(u16 arg0) -{ +void func_800775F0(u16 arg0) { gSaveContext.unk_140E = arg0; } @@ -97,4 +92,3 @@ void func_800775F0(u16 arg0) #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80077684.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800776E4.s") - diff --git a/src/code/z_lib.c b/src/code/z_lib.c index a7411c53de..c76e400c8f 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -1,109 +1,94 @@ #include #include -void Lib_MemSet(u8* dest, size_t size, u8 val) -{ +void Lib_MemSet(u8* dest, size_t size, u8 val) { u32 i = 0; // TODO: Convert this to while/for if possible - if (i == size) return; + if (i == size) { + return; + } do { *dest++ = val; i++; } while (i != size); } -f32 Math_Coss(s16 angle) -{ +f32 Math_Coss(s16 angle) { return coss(angle) * (1.0f / 32767); } -f32 Math_Sins(s16 angle) -{ +f32 Math_Sins(s16 angle) { return sins(angle) * (1.0f / 32767); } -s32 Math_ApproxUpdateScaledS(s16* pValue, s16 target, s16 step) -{ +s32 Math_ApproxUpdateScaledS(s16* pValue, s16 target, s16 step) { f32 updateScale; - if (step != 0) - { + if (step != 0) { updateScale = R_UPDATE_RATE * 0.5f; - if ((s16)(*pValue - target) > 0) + if ((s16)(*pValue - target) > 0) { step = -step; + } *pValue += (s16)(step * updateScale); - if (((s16)(*pValue - target) * step) >= 0) - { + if (((s16)(*pValue - target) * step) >= 0) { *pValue = target; return 1; } - } - else if (target == *pValue) - { + } else if (target == *pValue) { return 1; } return 0; } -s32 Math_ApproxS(s16* pValue, s16 target, s16 step) -{ - if (step != 0) - { - if (target < *pValue) +s32 Math_ApproxS(s16* pValue, s16 target, s16 step) { + if (step != 0) { + if (target < *pValue) { step = -step; + } *pValue += step; - if (((*pValue - target) * step) >= 0) - { + if (((*pValue - target) * step) >= 0) { *pValue = target; return 1; } - } - else if (target == *pValue) - { + } else if (target == *pValue) { return 1; } return 0; } -s32 Math_ApproxF(f32* pValue, f32 target, f32 step) -{ - if (step != 0.0f) - { - if (target < *pValue) +s32 Math_ApproxF(f32* pValue, f32 target, f32 step) { + if (step != 0.0f) { + if (target < *pValue) { step = -step; + } *pValue += step; - if (((*pValue - target) * step) >= 0) - { + if (((*pValue - target) * step) >= 0) { *pValue = target; return 1; } - } - else if (target == *pValue) - { + } else if (target == *pValue) { return 1; } return 0; } -s32 func_80077A90(s16* pValue, s16 target, s16 step) -{ +s32 func_80077A90(s16* pValue, s16 target, s16 step) { s16 orig = *pValue; *pValue += step; - if (((s16)(*pValue - target) * (s16)(orig - target)) <= 0) - { + if (((s16)(*pValue - target) * (s16)(orig - target)) <= 0) { *pValue = target; return 1; } @@ -111,14 +96,12 @@ s32 func_80077A90(s16* pValue, s16 target, s16 step) return 0; } -s32 func_80077AF8(s16* pValue, s16 target, s16 step) -{ +s32 func_80077AF8(s16* pValue, s16 target, s16 step) { s16 orig = *pValue; *pValue += step; - if (((*pValue - target) * ((s16)orig - target)) <= 0) - { + if (((*pValue - target) * ((s16)orig - target)) <= 0) { *pValue = target; return 1; } @@ -126,50 +109,41 @@ s32 func_80077AF8(s16* pValue, s16 target, s16 step) return 0; } -s32 func_80077B58(s16* pValue, s16 target, s16 step) -{ +s32 func_80077B58(s16* pValue, s16 target, s16 step) { s32 phi_v0 = target - *pValue; - if (phi_v0 < 0) + if (phi_v0 < 0) { step = -step; + } - if (phi_v0 >= 0x8000) - { + if (phi_v0 >= 0x8000) { step = -step; phi_v0 = 0xFFFF0001 - -phi_v0; - } - else if (phi_v0 <= -0x8000) - { + } else if (phi_v0 <= -0x8000) { phi_v0 += 0xFFFF; step = -step; } - if (step != 0) - { + if (step != 0) { *pValue += step; - if ((phi_v0 * step) <= 0) - { + if ((phi_v0 * step) <= 0) { *pValue = target; return 1; } - } - else if (target == *pValue) - { + } else if (target == *pValue) { return 1; } return 0; } -s32 func_80077C1C(f32* pValue, f32 target, f32 step) -{ +s32 func_80077C1C(f32* pValue, f32 target, f32 step) { f32 orig = *pValue; *pValue += step; - if (((*pValue - target) * (orig - target)) <= 0) - { + if (((*pValue - target) * (orig - target)) <= 0) { *pValue = target; return 1; } @@ -177,40 +151,34 @@ s32 func_80077C1C(f32* pValue, f32 target, f32 step) return 0; } -s32 func_80077C6C(f32* pValue, f32 target, f32 incrStep, f32 decrStep) -{ +s32 func_80077C6C(f32* pValue, f32 target, f32 incrStep, f32 decrStep) { f32 step = (target >= *pValue) ? incrStep : decrStep; - if (step != 0.0f) - { - if (target < *pValue) + if (step != 0.0f) { + if (target < *pValue) { step = -step; + } *pValue += step; - if (((*pValue - target) * step) >= 0) - { + if (((*pValue - target) * step) >= 0) { *pValue = target; return 1; } - } - else if (target == *pValue) - { + } else if (target == *pValue) { return 1; } return 0; } -typedef struct -{ +typedef struct { /* 0x00 */ char unk_00[0x14]; - /* 0x14 */ s8 unk_14; - /* 0x14 */ s8 unk_15; + /* 0x14 */ s8 unk_14; + /* 0x14 */ s8 unk_15; } struct_80077D10; -void func_80077D10(f32* arg0, s16* arg1, struct_80077D10* arg2) -{ +void func_80077D10(f32* arg0, s16* arg1, struct_80077D10* arg2) { f32 var1 = arg2->unk_14; f32 var2 = arg2->unk_15; @@ -220,60 +188,51 @@ void func_80077D10(f32* arg0, s16* arg1, struct_80077D10* arg2) *arg1 = atan2s(var2, -var1); } -s16 Math_Rand_S16Offset(s16 base, s16 range) -{ +s16 Math_Rand_S16Offset(s16 base, s16 range) { return (s16)(Math_Rand_ZeroOne() * range) + base; } -s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range) -{ +s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range) { return (s16)(Math_Rand_ZeroOne() * range) * stride + base; } -void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src) -{ +void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src) { dest->x = src->x; dest->y = src->y; dest->z = src->z; } -void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src) -{ +void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src) { dest->x = src->x; dest->y = src->y; dest->z = src->z; } -void Math_Vec3f_Sum(Vec3f* a, Vec3f* b, Vec3f* dest) -{ +void Math_Vec3f_Sum(Vec3f* a, Vec3f* b, Vec3f* dest) { dest->x = a->x + b->x; dest->y = a->y + b->y; dest->z = a->z + b->z; } -void Math_Vec3f_Diff(Vec3f* a, Vec3f* b, Vec3f* dest) -{ +void Math_Vec3f_Diff(Vec3f* a, Vec3f* b, Vec3f* dest) { dest->x = a->x - b->x; dest->y = a->y - b->y; dest->z = a->z - b->z; } -void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* a, Vec3s* b) -{ +void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* a, Vec3s* b) { dest->x = a->x - b->x; dest->y = a->y - b->y; dest->z = a->z - b->z; } -void Math_Vec3f_Scale(Vec3f* vec, f32 scaleF) -{ +void Math_Vec3f_Scale(Vec3f* vec, f32 scaleF) { vec->x *= scaleF; vec->y *= scaleF; vec->z *= scaleF; } -f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b) -{ +f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b) { f32 dx = b->x - a->x; f32 dy = b->y - a->y; f32 dz = b->z - a->z; @@ -281,8 +240,7 @@ f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b) return sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); } -f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest) -{ +f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest) { dest->x = b->x - a->x; dest->y = b->y - a->y; dest->z = b->z - a->z; @@ -290,29 +248,25 @@ f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest) return sqrtf(SQ(dest->x) + SQ(dest->y) + SQ(dest->z)); } -f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b) -{ +f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b) { f32 dx = b->x - a->x; f32 dz = b->z - a->z; return sqrtf(SQ(dx) + SQ(dz)); } -f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) -{ +f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) { return b->y - a->y; } -s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b) -{ +s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b) { f32 dx = b->x - a->x; f32 dz = b->z - a->z; return atan2s(dz, dx); } -s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b) -{ +s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b) { return atan2s(Math_Vec3f_DistXZ(a, b), a->y - b->y); } @@ -328,69 +282,51 @@ void IChain_Apply_Vec3f(u8* ptr, InitChainEntry* ichain); void IChain_Apply_Vec3fdiv1000(u8* ptr, InitChainEntry* ichain); void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain); -void (*sInitChainHandlers[])(u8* ptr, InitChainEntry* ichain) = -{ - IChain_Apply_u8, - IChain_Apply_s8, - IChain_Apply_u16, - IChain_Apply_s16, - IChain_Apply_u32, - IChain_Apply_s32, - IChain_Apply_f32, - IChain_Apply_f32div1000, - IChain_Apply_Vec3f, - IChain_Apply_Vec3fdiv1000, - IChain_Apply_Vec3s, +void (*sInitChainHandlers[])(u8* ptr, InitChainEntry* ichain) = { + IChain_Apply_u8, IChain_Apply_s8, IChain_Apply_u16, IChain_Apply_s16, + IChain_Apply_u32, IChain_Apply_s32, IChain_Apply_f32, IChain_Apply_f32div1000, + IChain_Apply_Vec3f, IChain_Apply_Vec3fdiv1000, IChain_Apply_Vec3s, }; -void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain) -{ - do sInitChainHandlers[ichain->type]((u8*)actor, ichain); - while ((ichain++)->cont); +void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain) { + do { + sInitChainHandlers[ichain->type]((u8*)actor, ichain); + } while ((ichain++)->cont); } -void IChain_Apply_u8(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_u8(u8* ptr, InitChainEntry* ichain) { *(u8*)(ptr + ichain->offset) = ichain->value; } -void IChain_Apply_s8(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_s8(u8* ptr, InitChainEntry* ichain) { *(s8*)(ptr + ichain->offset) = ichain->value; } -void IChain_Apply_u16(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_u16(u8* ptr, InitChainEntry* ichain) { *(u16*)(ptr + ichain->offset) = ichain->value; } -void IChain_Apply_s16(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_s16(u8* ptr, InitChainEntry* ichain) { *(s16*)(ptr + ichain->offset) = ichain->value; } -void IChain_Apply_u32(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_u32(u8* ptr, InitChainEntry* ichain) { *(u32*)(ptr + ichain->offset) = ichain->value; } -void IChain_Apply_s32(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_s32(u8* ptr, InitChainEntry* ichain) { *(s32*)(ptr + ichain->offset) = ichain->value; } -void IChain_Apply_f32(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_f32(u8* ptr, InitChainEntry* ichain) { *(f32*)(ptr + ichain->offset) = ichain->value; } -void IChain_Apply_f32div1000(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_f32div1000(u8* ptr, InitChainEntry* ichain) { *(f32*)(ptr + ichain->offset) = ichain->value / 1000.0f; } -void IChain_Apply_Vec3f(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_Vec3f(u8* ptr, InitChainEntry* ichain) { Vec3f* vec; f32 val; @@ -402,8 +338,7 @@ void IChain_Apply_Vec3f(u8* ptr, InitChainEntry* ichain) vec->x = val; } -void IChain_Apply_Vec3fdiv1000(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_Vec3fdiv1000(u8* ptr, InitChainEntry* ichain) { Vec3f* vec; f32 val; @@ -416,8 +351,7 @@ void IChain_Apply_Vec3fdiv1000(u8* ptr, InitChainEntry* ichain) vec->x = val; } -void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain) -{ +void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain) { Vec3s* vec; s16 val; @@ -429,40 +363,37 @@ void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain) vec->x = val; } -f32 Math_SmoothScaleMaxMinF(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) -{ +f32 Math_SmoothScaleMaxMinF(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) { f32 var; - if (*pValue != target) - { + if (*pValue != target) { var = (target - *pValue) * scale; - if ((var >= minStep) || (var <= -minStep)) - { - if (var > maxStep) + if ((var >= minStep) || (var <= -minStep)) { + if (var > maxStep) { var = maxStep; + } - if (var < -maxStep) + if (var < -maxStep) { var = -maxStep; + } *pValue += var; - } - else - { - if (var < minStep) - { + } else { + if (var < minStep) { *pValue += minStep; var = minStep; - if (target < *pValue) + if (target < *pValue) { *pValue = target; + } } - if (var > -minStep) - { + if (var > -minStep) { *pValue += -minStep; - if (*pValue < target) + if (*pValue < target) { *pValue = target; + } } } } @@ -470,128 +401,123 @@ f32 Math_SmoothScaleMaxMinF(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 return fabsf(target - *pValue); } -void Math_SmoothScaleMaxF(f32* pValue, f32 target, f32 scale, f32 maxStep) -{ +void Math_SmoothScaleMaxF(f32* pValue, f32 target, f32 scale, f32 maxStep) { f32 step; - if (*pValue != target) - { + if (*pValue != target) { step = (target - *pValue) * scale; - if (step > maxStep) + if (step > maxStep) { step = maxStep; - else if (step < -maxStep) + } else if (step < -maxStep) { step = -maxStep; + } *pValue += step; } } -void Math_SmoothDownscaleMaxF(f32* pValue, f32 scale, f32 maxStep) -{ +void Math_SmoothDownscaleMaxF(f32* pValue, f32 scale, f32 maxStep) { f32 step; step = *pValue * scale; - if (step > maxStep) + if (step > maxStep) { step = maxStep; - else if (step < -maxStep) + } else if (step < -maxStep) { step = -maxStep; + } *pValue -= step; } -f32 func_800784D8(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) -{ +f32 func_800784D8(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep) { f32 step; f32 baseStep; step = 0.0f; baseStep = target - *pValue; - if (*pValue != target) - { - if (baseStep > 180.0f) + if (*pValue != target) { + if (baseStep > 180.0f) { baseStep = -(360.0f - baseStep); - else if (baseStep < -180.0f) + } else if (baseStep < -180.0f) { baseStep = 360.0f + baseStep; + } step = baseStep * scale; - if ((step >= minStep) || (step <= -minStep)) - { - if (step > maxStep) + if ((step >= minStep) || (step <= -minStep)) { + if (step > maxStep) { step = maxStep; + } - if (step < -maxStep) + if (step < -maxStep) { step = -maxStep; + } *pValue += step; - } - else - { - if (step < minStep) - { + } else { + if (step < minStep) { step = minStep; *pValue += step; - if (*pValue > target) + if (*pValue > target) { *pValue = target; + } } - if (step > -minStep) - { + if (step > -minStep) { step = -minStep; *pValue += step; - if (*pValue < target) + if (*pValue < target) { *pValue = target; + } } } } - if (*pValue >= 360.0f) + if (*pValue >= 360.0f) { *pValue -= 360.0f; + } - if (*pValue < 0.0f) + if (*pValue < 0.0f) { *pValue += 360.0f; + } return step; } -s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep, s16 minStep) -{ +s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep, s16 minStep) { s16 step = 0; s16 diff = (target - *pValue); s32 baseStep = diff / invScale; - if (*pValue != target) - { + if (*pValue != target) { step = baseStep; - if ((step > minStep) || (step < -minStep)) - { - if (step > maxStep) + if ((step > minStep) || (step < -minStep)) { + if (step > maxStep) { step = maxStep; + } - if (step < -maxStep) + if (step < -maxStep) { step = -maxStep; + } *pValue += step; - } - else - { - if (diff >= 0) - { + } else { + if (diff >= 0) { *pValue += minStep; - if ((s16)(target - *pValue) <= 0) + if ((s16)(target - *pValue) <= 0) { *pValue = target; - } - else - { + } + } else { *pValue -= minStep; - if ((s16)(target - *pValue) >= 0) + if ((s16)(target - *pValue) >= 0) { *pValue = target; + } } } } @@ -599,39 +525,35 @@ s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep, return diff; } -void Math_SmoothScaleMaxS(s16* pValue, s16 target, s16 invScale, s16 maxStep) -{ +void Math_SmoothScaleMaxS(s16* pValue, s16 target, s16 invScale, s16 maxStep) { s16 step = target - *pValue; step /= invScale; - if (step > maxStep) + if (step > maxStep) { *pValue += maxStep; - else if (step < -maxStep) + } else if (step < -maxStep) { *pValue -= maxStep; - else + } else { *pValue += step; + } } -void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src) -{ +void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src) { dst->r = src->r; dst->g = src->g; dst->b = src->b; dst->a = src->a; } -void func_80078884(u16 sfxId) -{ +void func_80078884(u16 sfxId) { Audio_PlaySoundGeneral(sfxId, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } -void func_800788CC(u16 sfxId) -{ +void func_800788CC(u16 sfxId) { Audio_PlaySoundGeneral(sfxId, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } -void func_80078914(Vec3f* arg0, u16 sfxId) -{ +void func_80078914(Vec3f* arg0, u16 sfxId) { Audio_PlaySoundGeneral(sfxId, arg0, 4, &D_801333E0, &D_801333E0, &D_801333E8); } diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index f67235c4a4..b69ac8b344 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -17,8 +17,7 @@ s16 D_8015FDC8[3]; s16 D_8015FDD0[6]; s16 D_8015FDE0[6]; -void Health_InitData(GlobalContext* globalCtx) -{ +void Health_InitData(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; interfaceCtx->unk_228 = 0x140; @@ -50,28 +49,22 @@ void Health_InitData(GlobalContext* globalCtx) #ifdef NON_MATCHING // this function still needs some work -void Health_UpdateData(GlobalContext* globalCtx) -{ +void Health_UpdateData(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; f32 temp_f0 = interfaceCtx->unk_1FE * 0.1f; s16 temp1, temp2, temp3; - if (0) ; + if (0) {} - if (interfaceCtx->unk_200 != 0) - { + if (interfaceCtx->unk_200 != 0) { interfaceCtx->unk_1FE--; - if (interfaceCtx->unk_1FE <= 0) - { + if (interfaceCtx->unk_1FE <= 0) { interfaceCtx->unk_1FE = 0; interfaceCtx->unk_200 = 0; } - } - else - { + } else { interfaceCtx->unk_1FE++; - if (interfaceCtx->unk_1FE >= 10) - { + if (interfaceCtx->unk_1FE >= 10) { interfaceCtx->unk_1FE = 10; interfaceCtx->unk_200 = 1; } @@ -153,21 +146,18 @@ void Health_UpdateData(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_lifemeter/Health_UpdateData.s") #endif -s32 func_80078E18(GlobalContext* globalCtx) -{ +s32 func_80078E18(GlobalContext* globalCtx) { gSaveContext.health = globalCtx->interfaceCtx.unk_226; return 1; } -s32 func_80078E34(GlobalContext* globalCtx) -{ +s32 func_80078E34(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; interfaceCtx->unk_228 = 0x140; interfaceCtx->unk_226 += 0x10; - if (interfaceCtx->unk_226 >= gSaveContext.health) - { + if (interfaceCtx->unk_226 >= gSaveContext.health) { interfaceCtx->unk_226 = gSaveContext.health; return 1; } @@ -175,21 +165,16 @@ s32 func_80078E34(GlobalContext* globalCtx) return 0; } -s32 func_80078E84(GlobalContext* globalCtx) -{ +s32 func_80078E84(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - if (interfaceCtx->unk_228 != 0) - { + if (interfaceCtx->unk_228 != 0) { interfaceCtx->unk_228--; - } - else - { + } else { interfaceCtx->unk_228 = 0x140; interfaceCtx->unk_226 -= 0x10; - if (interfaceCtx->unk_226 <= 0) - { + if (interfaceCtx->unk_226 <= 0) { interfaceCtx->unk_226 = 0; globalCtx->unk_11D58(globalCtx, -(gSaveContext.health + 1)); return 1; @@ -199,8 +184,7 @@ s32 func_80078E84(GlobalContext* globalCtx) return 0; } -void Interface_DrawHealth(GlobalContext* globalCtx) -{ +void Interface_DrawHealth(GlobalContext* globalCtx) { s32 pad[5]; u8* heartBgImg; u32 curColorSet; @@ -226,184 +210,127 @@ void Interface_DrawHealth(GlobalContext* globalCtx) func_800C6AC4(gfxArr, gfxCtx, "../z_lifemeter.c", 353); - if (!(gSaveContext.health % 0x10)) + if (!(gSaveContext.health % 0x10)) { fullHeartCount--; + } curColorSet = -1; offsetY = 0.0f; offsetX = 0.0f; - for (i = 0; i < totalHeartCount; i++) - { - if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) - { - if (i < fullHeartCount) - { - if (curColorSet != 0) - { + for (i = 0; i < totalHeartCount; i++) { + if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) { + if (i < fullHeartCount) { + if (curColorSet != 0) { curColorSet = 0; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], + gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], interfaceCtx->unk_21A[4], 0xFF); } - } - else if (i == fullHeartCount) - { - if (curColorSet != 1) - { + } else if (i == fullHeartCount) { + if (curColorSet != 1) { curColorSet = 1; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - interfaceCtx->unk_202[0], interfaceCtx->unk_202[1], + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_202[0], interfaceCtx->unk_202[1], interfaceCtx->unk_202[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - interfaceCtx->unk_208[0], interfaceCtx->unk_208[1], + gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_208[0], interfaceCtx->unk_208[1], interfaceCtx->unk_208[2], 0xFF); } - } - else if (i > fullHeartCount) - { - if (curColorSet != 2) - { + } else if (i > fullHeartCount) { + if (curColorSet != 2) { curColorSet = 2; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], + gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], interfaceCtx->unk_21A[4], 0xFF); } - } - else - { - if (curColorSet != 3) - { + } else { + if (curColorSet != 3) { curColorSet = 3; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - interfaceCtx->unk_20E[1], interfaceCtx->unk_20E[3], + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[1], interfaceCtx->unk_20E[3], interfaceCtx->unk_20E[5], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - interfaceCtx->unk_21A[1], interfaceCtx->unk_21A[3], + gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_21A[1], interfaceCtx->unk_21A[3], interfaceCtx->unk_21A[5], 0xFF); } } - if (i < fullHeartCount) + if (i < fullHeartCount) { heartBgImg = D_02000400; - else if (i == fullHeartCount) + } else if (i == fullHeartCount) { heartBgImg = D_8011FFB0[curHeartFraction]; - else + } else { heartBgImg = D_02000000; - } - else - { - if (i < fullHeartCount) - { - if (curColorSet != 4) - { + } + } else { + if (i < fullHeartCount) { + if (curColorSet != 4) { curColorSet = 4; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - D_8015FDD0[0], D_8015FDD0[1], - D_8015FDD0[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - D_8015FDE0[0], D_8015FDE0[1], - D_8015FDE0[2], 0xFF); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], + interfaceCtx->healthAlpha); + gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); } - } - else if (i == fullHeartCount) - { - if (curColorSet != 5) - { + } else if (i == fullHeartCount) { + if (curColorSet != 5) { curColorSet = 5; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - D_8015FDC0[0], D_8015FDC0[1], - D_8015FDC0[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - D_8015FDC8[0], D_8015FDC8[1], - D_8015FDC8[2], 0xFF); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDC0[0], D_8015FDC0[1], D_8015FDC0[2], + interfaceCtx->healthAlpha); + gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDC8[0], D_8015FDC8[1], D_8015FDC8[2], 0xFF); } - } - else if (i > fullHeartCount) - { - if (curColorSet != 6) - { + } else if (i > fullHeartCount) { + if (curColorSet != 6) { curColorSet = 6; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - D_8015FDD0[0], D_8015FDD0[1], - D_8015FDD0[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - D_8015FDE0[0], D_8015FDE0[1], - D_8015FDE0[2], 0xFF); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], + interfaceCtx->healthAlpha); + gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); } - } - else - { - if (curColorSet != 7) - { + } else { + if (curColorSet != 7) { curColorSet = 7; gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - D_8015FDD0[3], D_8015FDD0[4], - D_8015FDD0[5], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, - D_8015FDE0[3], D_8015FDE0[4], - D_8015FDE0[5], 0xFF); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDD0[3], D_8015FDD0[4], D_8015FDD0[5], + interfaceCtx->healthAlpha); + gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDE0[3], D_8015FDE0[4], D_8015FDE0[5], 0xFF); } } - if (i < fullHeartCount) + if (i < fullHeartCount) { heartBgImg = D_02000900; - else if (i == fullHeartCount) + } else if (i == fullHeartCount) { heartBgImg = D_8011FFF0[curHeartFraction]; - else + } else { heartBgImg = D_02000500; + } } - if (curBgImgLoaded != heartBgImg) - { + if (curBgImgLoaded != heartBgImg) { curBgImgLoaded = heartBgImg; - gDPLoadTextureBlock(gfxCtx->overlay.p++, - heartBgImg, - G_IM_FMT_IA, - G_IM_SIZ_8b, - 16, 16, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, + gDPLoadTextureBlock(gfxCtx->overlay.p++, heartBgImg, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); } - if (i != fullHeartCount) - { - if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) - { - if (curCombineModeSet != 1) - { + if (i != fullHeartCount) { + if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) { + if (curCombineModeSet != 1) { curCombineModeSet = 1; func_80094520(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0); } - } - else - { - if (curCombineModeSet != 3) - { + } else { + if (curCombineModeSet != 3) { curCombineModeSet = 3; func_80094520(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, - ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, - ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, + PRIMITIVE, 0, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); } } @@ -414,40 +341,28 @@ void Interface_DrawHealth(GlobalContext* globalCtx) temp4 *= 1024.0f; temp1 = 8.0f; temp1 *= 0.68f; - gSPTextureRectangle(gfxCtx->overlay.p++, - (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4), - (s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4), - G_TX_RENDERTILE, - 0, 0, + gSPTextureRectangle(gfxCtx->overlay.p++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4), + (s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4), G_TX_RENDERTILE, 0, 0, (s32)temp4, (s32)temp4); - } - else - { - if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) - { - if (curCombineModeSet != 2) - { + } else { + if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) { + if (curCombineModeSet != 2) { curCombineModeSet = 2; func_80094A14(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0); } - } - else - { - if (curCombineModeSet != 4) - { + } else { + if (curCombineModeSet != 4) { curCombineModeSet = 4; func_80094A14(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, - ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, - ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, + PRIMITIVE, 0, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); } } - if (1) - { + if (1) { Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); func_800D2CEC(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), -130.0f + offsetX, 94.5f - offsetY, 0.0f); @@ -458,8 +373,7 @@ void Interface_DrawHealth(GlobalContext* globalCtx) } offsetX += 10.0f; - if (i == 9) - { + if (i == 9) { offsetY += 10.0f; offsetX = 0.0f; } @@ -470,50 +384,44 @@ void Interface_DrawHealth(GlobalContext* globalCtx) u32 Health_IsCritical(void); -void Health_HandleCriticalAlarm(GlobalContext* globalCtx) -{ +void Health_HandleCriticalAlarm(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - if (interfaceCtx->unk_22C != 0) - { + if (interfaceCtx->unk_22C != 0) { interfaceCtx->unk_22A--; - if (interfaceCtx->unk_22A <= 0) - { + if (interfaceCtx->unk_22A <= 0) { interfaceCtx->unk_22A = 0; interfaceCtx->unk_22C = 0; - if (!func_8008E988(globalCtx) && (globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.flag == 0) && Health_IsCritical() && !func_800BFC84(globalCtx)) - { + if (!func_8008E988(globalCtx) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && + Health_IsCritical() && !func_800BFC84(globalCtx)) { func_80078884(NA_SE_SY_HITPOINT_ALARM); } } - } - else - { + } else { interfaceCtx->unk_22A++; - if (interfaceCtx->unk_22A >= 10) - { + if (interfaceCtx->unk_22A >= 10) { interfaceCtx->unk_22A = 10; interfaceCtx->unk_22C = 1; } } } -u32 Health_IsCritical(void) -{ +u32 Health_IsCritical(void) { s32 var; - if (gSaveContext.health_capacity <= 0x50) + if (gSaveContext.health_capacity <= 0x50) { var = 0x10; - else if (gSaveContext.health_capacity <= 0xA0) + } else if (gSaveContext.health_capacity <= 0xA0) { var = 0x18; - else if (gSaveContext.health_capacity <= 0xF0) + } else if (gSaveContext.health_capacity <= 0xF0) { var = 0x20; - else + } else { var = 0x2C; + } - if ((var >= gSaveContext.health) && (gSaveContext.health > 0)) + if ((var >= gSaveContext.health) && (gSaveContext.health > 0)) { return 1; - else + } else { return 0; + } } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index af6dbad510..46e61fa250 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -3,8 +3,8 @@ extern LightsList sLightsList; -void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius, u32 type) -{ +void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, + s16 radius, u32 type) { info->type = type; info->params.posX = posX; info->params.posY = posY; @@ -12,26 +12,24 @@ void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s Lights_SetPositionalLightColorAndRadius(info, red, green, blue, radius); } -void Lights_InitType0PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius) -{ +void Lights_InitType0PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, + s16 radius) { Lights_InitPositionalLight(info, posX, posY, posZ, red, green, blue, radius, 0); } -void Lights_InitType2PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius) -{ +void Lights_InitType2PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, + s16 radius) { Lights_InitPositionalLight(info, posX, posY, posZ, red, green, blue, radius, 2); } -void Lights_SetPositionalLightColorAndRadius(LightInfoPositional* info, u8 red, u8 green, u8 blue, s16 radius) -{ +void Lights_SetPositionalLightColorAndRadius(LightInfoPositional* info, u8 red, u8 green, u8 blue, s16 radius) { info->params.red = red; info->params.green = green; info->params.blue = blue; info->params.radius = radius; } -void Lights_InitDirectional(LightInfoDirectional* info, s8 dirX, s8 dirY, s8 dirZ, u8 red, u8 green, u8 blue) -{ +void Lights_InitDirectional(LightInfoDirectional* info, s8 dirX, s8 dirY, s8 dirZ, u8 red, u8 green, u8 blue) { info->type = 1; info->params.dirX = dirX; info->params.dirY = dirY; @@ -41,8 +39,7 @@ void Lights_InitDirectional(LightInfoDirectional* info, s8 dirX, s8 dirY, s8 dir info->params.blue = blue; } -void Lights_MapperInit(LightMapper* mapper, u8 red, u8 green, u8 blue) -{ +void Lights_MapperInit(LightMapper* mapper, u8 red, u8 green, u8 blue) { mapper->ambient.l.col[0] = red; mapper->ambient.l.colc[0] = red; mapper->ambient.l.col[1] = green; @@ -54,22 +51,20 @@ void Lights_MapperInit(LightMapper* mapper, u8 red, u8 green, u8 blue) #pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_80079EFC.s") -Light* Lights_MapperGetNextFreeSlot(LightMapper* mapper) -{ - if (6 < mapper->numLights) +Light* Lights_MapperGetNextFreeSlot(LightMapper* mapper) { + if (6 < mapper->numLights) { return NULL; + } return &mapper->lights[mapper->numLights++]; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A084.s") -void func_8007A40C(LightMapper* mapper, LightInfoDirectionalParams* params, GlobalContext* globalCtx) -{ +void func_8007A40C(LightMapper* mapper, LightInfoDirectionalParams* params, GlobalContext* globalCtx) { Light* light = Lights_MapperGetNextFreeSlot(mapper); - if (light != NULL) - { + if (light != NULL) { light->l.col[0] = light->l.colc[0] = params->red; light->l.col[1] = light->l.colc[1] = params->green; light->l.col[2] = light->l.colc[2] = params->blue; @@ -81,25 +76,21 @@ void func_8007A40C(LightMapper* mapper, LightInfoDirectionalParams* params, Glob #pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A474.s") -z_Light* Lights_FindFreeSlot() -{ +z_Light* Lights_FindFreeSlot() { z_Light* ret; - if (0x1F < sLightsList.numOccupied) + if (0x1F < sLightsList.numOccupied) { return NULL; + } ret = &sLightsList.lights[sLightsList.nextFree]; - while (ret->info != NULL) - { + while (ret->info != NULL) { sLightsList.nextFree++; - if (sLightsList.nextFree < 0x20) - { + if (sLightsList.nextFree < 0x20) { ret++; - } - else - { + } else { sLightsList.nextFree = 0; ret = &sLightsList.lights[0]; } @@ -112,36 +103,32 @@ z_Light* Lights_FindFreeSlot() #ifdef NON_MATCHING // single ordering difference -void Lights_Free(z_Light* light) -{ - if (light != NULL) - { +void Lights_Free(z_Light* light) { + if (light != NULL) { sLightsList.numOccupied--; light->info = NULL; - sLightsList.nextFree = (light - sLightsList.lights) / sizeof(z_Light); //! @bug Due to pointer arithmetic, the division is unnecessary + sLightsList.nextFree = (light - sLightsList.lights) / + sizeof(z_Light); //! @bug Due to pointer arithmetic, the division is unnecessary } } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/Lights_Free.s") #endif -void func_8007A614(GlobalContext* globalCtx, LightingContext* lightCtx) -{ +void func_8007A614(GlobalContext* globalCtx, LightingContext* lightCtx) { Lights_ClearHead(globalCtx, lightCtx); Lights_SetAmbientColor(lightCtx, 0x50, 0x50, 0x50); func_8007A698(lightCtx, 0, 0, 0, 0x3e4, 0x3200); bzero(&sLightsList, sizeof(sLightsList)); } -void Lights_SetAmbientColor(LightingContext* lightCtx, u8 red, u8 green, u8 blue) -{ +void Lights_SetAmbientColor(LightingContext* lightCtx, u8 red, u8 green, u8 blue) { lightCtx->ambientRed = red; lightCtx->ambientGreen = green; lightCtx->ambientBlue = blue; } -void func_8007A698(LightingContext* lightCtx, u8 arg1, u8 arg2, u8 arg3, s16 arg4, s16 arg5) -{ +void func_8007A698(LightingContext* lightCtx, u8 arg1, u8 arg2, u8 arg3, s16 arg4, s16 arg5) { lightCtx->unk_07 = arg1; lightCtx->unk_08 = arg2; lightCtx->unk_09 = arg3; @@ -149,38 +136,33 @@ void func_8007A698(LightingContext* lightCtx, u8 arg1, u8 arg2, u8 arg3, s16 arg lightCtx->unk_0C = arg5; } -LightMapper* Lights_CreateMapper(LightingContext* lightCtx, GraphicsContext* gfxCtx) -{ +LightMapper* Lights_CreateMapper(LightingContext* lightCtx, GraphicsContext* gfxCtx) { return func_8007A960(gfxCtx, lightCtx->ambientRed, lightCtx->ambientGreen, lightCtx->ambientBlue); } -void Lights_ClearHead(GlobalContext* globalCtx, LightingContext* lightCtx) -{ +void Lights_ClearHead(GlobalContext* globalCtx, LightingContext* lightCtx) { lightCtx->lightsHead = NULL; } -void Lights_RemoveAll(GlobalContext* globalCtx, LightingContext* lightCtx) -{ - while (lightCtx->lightsHead != NULL) - { +void Lights_RemoveAll(GlobalContext* globalCtx, LightingContext* lightCtx) { + while (lightCtx->lightsHead != NULL) { Lights_Remove(globalCtx, lightCtx, lightCtx->lightsHead); lightCtx->lightsHead = lightCtx->lightsHead->next; } } -z_Light* Lights_Insert(GlobalContext* globalCtx, LightingContext* lightCtx, LightInfo* info) -{ +z_Light* Lights_Insert(GlobalContext* globalCtx, LightingContext* lightCtx, LightInfo* info) { z_Light* light; light = Lights_FindFreeSlot(); - if (light != NULL) - { + if (light != NULL) { light->info = info; light->prev = NULL; light->next = lightCtx->lightsHead; - if (lightCtx->lightsHead != NULL) + if (lightCtx->lightsHead != NULL) { lightCtx->lightsHead->prev = light; + } lightCtx->lightsHead = light; } @@ -188,17 +170,17 @@ z_Light* Lights_Insert(GlobalContext* globalCtx, LightingContext* lightCtx, Ligh return light; } -void Lights_Remove(GlobalContext* globalCtx, LightingContext* lightCtx, z_Light* light) -{ - if (light != NULL) - { - if (light->prev != NULL) +void Lights_Remove(GlobalContext* globalCtx, LightingContext* lightCtx, z_Light* light) { + if (light != NULL) { + if (light->prev != NULL) { light->prev->next = light->next; - else + } else { lightCtx->lightsHead = light->next; + } - if (light->next != NULL) + if (light->next != NULL) { light->next->prev = light->prev; + } Lights_Free(light); } @@ -211,4 +193,3 @@ void Lights_Remove(GlobalContext* globalCtx, LightingContext* lightCtx, z_Light* #pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A9B4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007ABBC.s") - diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index 10a328c492..fd82cca8fa 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -1,131 +1,112 @@ #include -#define LOG_SEVERITY_NOLOG 0 -#define LOG_SEVERITY_ERROR 2 -#define LOG_SEVERITY_VERBOSE 3 +#define LOG_SEVERITY_NOLOG 0 +#define LOG_SEVERITY_ERROR 2 +#define LOG_SEVERITY_VERBOSE 3 s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR; Arena sZeldaArena; -void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) -{ - if (!ptr) - { - if (gZeldaArenaLogSeverity >= LOG_SEVERITY_ERROR) - { +void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { + if (!ptr) { + if (gZeldaArenaLogSeverity >= LOG_SEVERITY_ERROR) { //"%s: %u bytes %s failed\n" osSyncPrintf("%s: %u バイトの%sに失敗しました\n", name, size, action); - __osDisplayArena(&sZeldaArena); + __osDisplayArena(&sZeldaArena); return; } - } - else if (gZeldaArenaLogSeverity >= LOG_SEVERITY_VERBOSE) - { + } else if (gZeldaArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { //"%s: %u bytes %s succeeded\n" osSyncPrintf("%s: %u バイトの%sに成功しました\n", name, size, action); } } -void* ZeldaArena_Malloc(u32 size) -{ +void* ZeldaArena_Malloc(u32 size) { void* ptr; ptr = __osMalloc(&sZeldaArena, size); - ZeldaArena_CheckPointer(ptr, size, "zelda_malloc", "確保"); //Secure + ZeldaArena_CheckPointer(ptr, size, "zelda_malloc", "確保"); // Secure return ptr; } -void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line) -{ +void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line) { void* ptr; ptr = __osMallocDebug(&sZeldaArena, size, file, line); - ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_DEBUG", "確保"); //Secure + ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_DEBUG", "確保"); // Secure return ptr; } -void* ZeldaArena_MallocR(u32 size) -{ +void* ZeldaArena_MallocR(u32 size) { void* ptr; ptr = __osMallocR(&sZeldaArena, size); - ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r", "確保"); //Secure + ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r", "確保"); // Secure return ptr; } -void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line) -{ +void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line) { void* ptr; ptr = __osMallocRDebug(&sZeldaArena, size, file, line); - ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r_DEBUG", "確保"); //Secure + ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r_DEBUG", "確保"); // Secure return ptr; } -void* ZeldaArena_Realloc(void* ptr, u32 newSize) -{ +void* ZeldaArena_Realloc(void* ptr, u32 newSize) { ptr = __osRealloc(&sZeldaArena, ptr, newSize); ZeldaArena_CheckPointer(ptr, newSize, "zelda_realloc", "再確保"); // Re-securing return ptr; } -void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) -{ +void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) { ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line); ZeldaArena_CheckPointer(ptr, newSize, "zelda_realloc_DEBUG", "再確保"); // Re-securing return ptr; } -void ZeldaArena_Free(void* ptr) -{ +void ZeldaArena_Free(void* ptr) { __osFree(&sZeldaArena, ptr); } -void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line) -{ +void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line) { __osFreeDebug(&sZeldaArena, ptr, file, line); } -void* ZeldaArena_Calloc(u32 num, u32 size) -{ +void* ZeldaArena_Calloc(u32 num, u32 size) { void* ret; u32 n; - - n = num*size; + + n = num * size; ret = __osMalloc(&sZeldaArena, n); - if (ret) + if (ret) { bzero(ret, n); + } ZeldaArena_CheckPointer(ret, n, "zelda_calloc", "確保"); return ret; } -void ZeldaArena_Display() -{ - //Zelda heap display +void ZeldaArena_Display() { + // Zelda heap display osSyncPrintf("ゼルダヒープ表示\n"); __osDisplayArena(&sZeldaArena); } -void ZeldaArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) -{ +void ZeldaArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) { ArenaImpl_GetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc); } -void ZeldaArena_Check() -{ +void ZeldaArena_Check() { __osCheckArena(&sZeldaArena); } -void ZeldaArena_Init(void* start, u32 size) -{ +void ZeldaArena_Init(void* start, u32 size) { gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; __osMallocInit(&sZeldaArena, start, size); } -void ZeldaArena_Cleanup() -{ +void ZeldaArena_Cleanup() { gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG; __osMallocCleanup(&sZeldaArena); } -u8 ZeldaArena_IsInitalized() -{ +u8 ZeldaArena_IsInitalized() { return __osMallocIsInitalized(&sZeldaArena); } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 7498ffe7fe..b740bba3cb 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -22,4 +22,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_80082248.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_8008226C.s") - diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index bd1187cf8b..2c93435917 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -2,8 +2,7 @@ #include #include -typedef struct -{ +typedef struct { /* 0x00 */ void* texture; /* 0x04 */ u32 imageFormat; /* 0x08 */ u32 imageSize; @@ -15,76 +14,69 @@ typedef struct /* 0x20 */ u32 dtdy; } MapMarkInfo; // size = 0x24 -typedef struct -{ +typedef struct { /* 0x00 */ void* loadedRamAddr; // original name: "allocp" - /* 0x04 */ u32 vromStart; - /* 0x08 */ u32 vromEnd; - /* 0x0C */ u32 vramStart; - /* 0x10 */ u32 vramEnd; - /* 0x14 */ u32 vramTable; + /* 0x04 */ u32 vromStart; + /* 0x08 */ u32 vromEnd; + /* 0x0C */ u32 vramStart; + /* 0x10 */ u32 vramEnd; + /* 0x14 */ u32 vramTable; } MapMarkDataOverlay; // size = 0x18 -static u32 sBaseImageSizes[] = { 0, 1, 2, 3 }; +static u32 sBaseImageSizes[] = { 0, 1, 2, 3 }; static u32 sLoadBlockImageSizes[] = { 2, 2, 2, 3 }; -static u32 sIncrImageSizes[] = { 3, 1, 0, 0 }; -static u32 sShiftImageSizes[] = { 2, 1, 0, 0 }; -static u32 sBytesImageSizes[] = { 0, 1, 2, 4 }; +static u32 sIncrImageSizes[] = { 3, 1, 0, 0 }; +static u32 sShiftImageSizes[] = { 2, 1, 0, 0 }; +static u32 sBytesImageSizes[] = { 0, 1, 2, 4 }; static u32 sLineBytesImageSizes[] = { 0, 1, 2, 2 }; -#define G_IM_SIZ_MARK sBaseImageSizes[markInfo->imageSize] -#define G_IM_SIZ_MARK_LOAD_BLOCK sLoadBlockImageSizes[markInfo->imageSize] -#define G_IM_SIZ_MARK_INCR sIncrImageSizes[markInfo->imageSize] -#define G_IM_SIZ_MARK_SHIFT sShiftImageSizes[markInfo->imageSize] -#define G_IM_SIZ_MARK_BYTES sBytesImageSizes[markInfo->imageSize] -#define G_IM_SIZ_MARK_LINE_BYTES sLineBytesImageSizes[markInfo->imageSize] +#define G_IM_SIZ_MARK sBaseImageSizes[markInfo->imageSize] +#define G_IM_SIZ_MARK_LOAD_BLOCK sLoadBlockImageSizes[markInfo->imageSize] +#define G_IM_SIZ_MARK_INCR sIncrImageSizes[markInfo->imageSize] +#define G_IM_SIZ_MARK_SHIFT sShiftImageSizes[markInfo->imageSize] +#define G_IM_SIZ_MARK_BYTES sBytesImageSizes[markInfo->imageSize] +#define G_IM_SIZ_MARK_LINE_BYTES sLineBytesImageSizes[markInfo->imageSize] -static MapMarkInfo sMapMarkInfoTable[] = -{ +static MapMarkInfo sMapMarkInfoTable[] = { { D_02002580, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 32, 32, 1024, 1024 }, // Chest Icon - { D_02002900, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 32, 32, 1024, 1024 }, // Boss Skull Icon + { D_02002900, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 32, 32, 1024, 1024 }, // Boss Skull Icon }; -static MapMarkDataOverlay sMapMarkDataOvl = -{ +static MapMarkDataOverlay sMapMarkDataOvl = { NULL, (u32)_ovl_map_mark_dataSegmentRomStart, (u32)_ovl_map_mark_dataSegmentRomEnd, (u32)_ovl_map_mark_dataSegmentStart, (u32)_ovl_map_mark_dataSegmentEnd, - (u32)gMapMarkDataTable + (u32)gMapMarkDataTable, }; static MapMarksData** sLoadedMarkDataTable; extern u8** D_8015FFD0; -void MapMark_Init(GlobalContext* globalCtx) -{ +void MapMark_Init(GlobalContext* globalCtx) { MapMarkDataOverlay* overlay = &sMapMarkDataOvl; u32 overlaySize = overlay->vramEnd - overlay->vramStart; overlay->loadedRamAddr = Game_Alloc(&globalCtx->state, overlaySize, "../z_map_mark.c", 235); LogUtils_CheckNullPointer("dlftbl->allocp", overlay->loadedRamAddr, "../z_map_mark.c", 236); - Overlay_Load(overlay->vromStart, overlay->vromEnd, - overlay->vramStart, overlay->vramEnd, - overlay->loadedRamAddr); + Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr); sLoadedMarkDataTable = gMapMarkDataTable; - sLoadedMarkDataTable = (void*)(s32)((overlay->vramTable != 0) ? - (void*)(overlay->vramTable - (s32)(overlay->vramStart - (s32)overlay->loadedRamAddr)) : - NULL); + sLoadedMarkDataTable = + (void*)(s32)((overlay->vramTable != 0) + ? (void*)(overlay->vramTable - (s32)(overlay->vramStart - (s32)overlay->loadedRamAddr)) + : NULL); } -void MapMark_ClearPointers(GlobalContext* globalCtx) -{ +void MapMark_ClearPointers(GlobalContext* globalCtx) { sMapMarkDataOvl.loadedRamAddr = NULL; sLoadedMarkDataTable = NULL; } -void MapMark_Draw(GlobalContext* globalCtx) -{ +void MapMark_Draw(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx; MapMarkData* mapMarkData; MapMarkPoint* markPoint; @@ -99,11 +91,10 @@ void MapMark_Draw(GlobalContext* globalCtx) dungeonId = gSaveContext.dungeon_index; interfaceCtx = &globalCtx->interfaceCtx; - if ((D_8015FFD0 != NULL) && (globalCtx->interfaceCtx.roomNum >= D_8015FFD0[7][dungeonId])) - { + if ((D_8015FFD0 != NULL) && (globalCtx->interfaceCtx.roomNum >= D_8015FFD0[7][dungeonId])) { // Translates to: "ROOM NUMBER EXCEEDED, YIKES %d/%d MapMarkDraw PROCESSING INTERRUPTED" - osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n", VT_RST, - globalCtx->interfaceCtx.roomNum, D_8015FFD0[7][dungeonId]); + osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n", + VT_RST, globalCtx->interfaceCtx.roomNum, D_8015FFD0[7][dungeonId]); return; } @@ -112,10 +103,10 @@ void MapMark_Draw(GlobalContext* globalCtx) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_map_mark.c", 303); - while (1) - { - if (mapMarkData->markType == -1) + while (1) { + if (mapMarkData->markType == -1) { break; + } gDPPipeSync(gfxCtx->overlay.p++); gDPSetTextureLUT(gfxCtx->overlay.p++, G_TT_NONE); @@ -123,31 +114,20 @@ void MapMark_Draw(GlobalContext* globalCtx) gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, interfaceCtx->minimapAlpha); markPoint = &mapMarkData->points[0]; - for (i = 0; i < mapMarkData->count; i++) - { - if ((mapMarkData->markType != 0) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) - { + for (i = 0; i < mapMarkData->count; i++) { + if ((mapMarkData->markType != 0) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) { markInfo = &sMapMarkInfoTable[mapMarkData->markType]; gDPPipeSync(gfxCtx->overlay.p++); - gDPLoadTextureBlock(gfxCtx->overlay.p++, - markInfo->texture, - markInfo->imageFormat, - G_IM_SIZ_MARK, - markInfo->textureWidth, markInfo->textureHeight, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gfxCtx->overlay.p++, markInfo->texture, markInfo->imageFormat, G_IM_SIZ_MARK, + markInfo->textureWidth, markInfo->textureHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); rectLeft = (GREG(94) + markPoint->x + 204) << 2; rectTop = (GREG(95) + markPoint->y + 140) << 2; - gSPTextureRectangle(gfxCtx->overlay.p++, - rectLeft, rectTop, - markInfo->rectWidth + rectLeft, rectTop + markInfo->rectHeight, - G_TX_RENDERTILE, - 0, 0, - markInfo->dsdx, markInfo->dtdy); + gSPTextureRectangle(gfxCtx->overlay.p++, rectLeft, rectTop, markInfo->rectWidth + rectLeft, + rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, markInfo->dsdx, + markInfo->dtdy); } markPoint++; } @@ -157,10 +137,8 @@ void MapMark_Draw(GlobalContext* globalCtx) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_map_mark.c", 339); } -void MapMark_DrawConditionally(GlobalContext* globalCtx) -{ - switch (globalCtx->sceneNum) - { +void MapMark_DrawConditionally(GlobalContext* globalCtx) { + switch (globalCtx->sceneNum) { case SCENE_YDAN: case SCENE_DDAN: case SCENE_BDAN: diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index cb490341f7..970f8bc243 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -82,4 +82,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80110460.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801104C8.s") - diff --git a/src/code/z_moji.c b/src/code/z_moji.c index 754e8a1b64..05a7a282c8 100644 --- a/src/code/z_moji.c +++ b/src/code/z_moji.c @@ -11,107 +11,96 @@ s32 D_80120124 = 0; UNK_TYPE D_8015FFC0; UNK_TYPE D_8015FFC4; -void func_8007B910(u32 red, u32 green, u32 blue, u32 alpha) -{ +void func_8007B910(u32 red, u32 green, u32 blue, u32 alpha) { sFontColorRed = red; sFontColorGreen = green; sFontColorBlue = blue; sFontColorAlpha = alpha; } -void func_8007B934(s32 arg0, s32 arg1) -{ - if (arg0 > 39) +void func_8007B934(s32 arg0, s32 arg1) { + if (arg0 > 39) { D_80120120 = 39 * 8; - else if (arg0 < 0) + } else if (arg0 < 0) { D_80120120 = 0; - else + } else { D_80120120 = arg0 * 8; + } - if (arg1 > 29) + if (arg1 > 29) { D_80120124 = 29 * 8; - else if (arg1 < 0) + } else if (arg1 < 0) { D_80120124 = 0; - else + } else { D_80120124 = arg1 * 8; + } } -void func_8007B9A4(GraphicsContext* gfxCtx, u8 arg1) -{ +void func_8007B9A4(GraphicsContext* gfxCtx, u8 arg1) { Gfx* gfxArr[7]; func_800C6AC4(gfxArr, gfxCtx, "../z_moji.c", 86); - if ((u32)gLetterTLUT & 0xF) + if ((u32)gLetterTLUT & 0xF) { osSyncPrintf("moji_tlut --> %X\n", gLetterTLUT); + } - if (D_8015FFC0 != (arg1 & 3)) - { + if (D_8015FFC0 != (arg1 & 3)) { gDPLoadTLUT(gfxCtx->polyOpa.p++, 16, 256, &gLetterTLUT[arg1 & 3]); D_8015FFC0 = arg1 & 3; } - gSPTextureRectangle(gfxCtx->polyOpa.p++, - D_80120120 << 2, D_80120124 << 2, - (D_80120120 + 8) << 2, (D_80120124 + 8) << 2, - G_TX_RENDERTILE, - (u16)(arg1 & 4) * 64, (u16)(arg1 >> 3) * 256, - 1024, 1024); + gSPTextureRectangle(gfxCtx->polyOpa.p++, D_80120120 << 2, D_80120124 << 2, (D_80120120 + 8) << 2, + (D_80120124 + 8) << 2, G_TX_RENDERTILE, (u16)(arg1 & 4) * 64, (u16)(arg1 >> 3) * 256, 1024, + 1024); func_800C6B54(gfxArr, gfxCtx, "../z_moji.c", 123); } -void func_8007BBA8(GraphicsContext* gfxCtx, u8* arg1) -{ +void func_8007BBA8(GraphicsContext* gfxCtx, u8* arg1) { s32 i; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, gfxCtx, "../z_moji.c", 137); - if ((u32)gFontFF & 0xF) + if ((u32)gFontFF & 0xF) { osSyncPrintf("font_ff --> %X\n", gFontFF); + } gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, - sFontColorRed, sFontColorGreen, - sFontColorBlue, sFontColorAlpha); + gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, sFontColorRed, sFontColorGreen, sFontColorBlue, sFontColorAlpha); gDPSetTextureImage(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, 1, (s32)gFontFF); - gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, - 0, 0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync(gfxCtx->polyOpa.p++); gDPLoadBlock(gfxCtx->polyOpa.p++, G_TX_LOADTILE, 0, 0, 511, 2048); gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_4b, - 1, 0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPSetTileSize(gfxCtx->polyOpa.p++, G_TX_RENDERTILE, 0, 0, 60, 508); D_8015FFC0 = -1; - for (i = 0; arg1[i] != 0; i++) - { - switch (arg1[i]) - { + for (i = 0; arg1[i] != 0; i++) { + switch (arg1[i]) { case 9: D_80120120 = (((D_80120120 / 8) / 8) + 1) * 8 * 8; - if (D_80120120 >= 320) - { + if (D_80120120 >= 320) { D_80120120 = 0; D_80120124 += 8; - if (D_80120124 >= 240) + if (D_80120124 >= 240) { D_80120124 = 0; + } } break; case 10: case 13: D_80120120 = 0; D_80120124 += 8; - if (D_80120124 >= 240) + if (D_80120124 >= 240) { D_80120124 = 0; + } break; default: func_8007B9A4(gfxCtx, arg1[i]); diff --git a/src/code/z_msgevent.c b/src/code/z_msgevent.c index 3282d0342f..8995189f7f 100644 --- a/src/code/z_msgevent.c +++ b/src/code/z_msgevent.c @@ -2,8 +2,7 @@ #include #include -void MsgEvent_SendNullTask() -{ +void MsgEvent_SendNullTask() { u32 pad[4]; OSScTask task; OSMesgQueue queue; diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 639d878691..faf7ca6b7d 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -1,8 +1,7 @@ #include #include -typedef struct -{ +typedef struct { /* 0x00 */ u32 unk_00; /* 0x04 */ u32 unk_04; /* 0x08 */ s16 unk_08; @@ -13,29 +12,26 @@ typedef struct #pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C704.s") -void func_8007C76C(f32* pfParm1, s16 *puParm2) -{ - puParm2[0] = pfParm1[0]; - puParm2[1] = pfParm1[1]; - puParm2[2] = pfParm1[2]; +void func_8007C76C(f32* pfParm1, s16* puParm2) { + puParm2[0] = pfParm1[0]; + puParm2[1] = pfParm1[1]; + puParm2[2] = pfParm1[2]; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C7A8.s") -void func_8007C7F8(u32 uParm1, u32 uParm2) -{ - u8 auStack4[4]; - u8 auStack8[4]; - - func_8003C940(uParm1, auStack4, auStack8, uParm2); +void func_8007C7F8(u32 uParm1, u32 uParm2) { + u8 auStack4[4]; + u8 auStack8[4]; + + func_8003C940(uParm1, auStack4, auStack8, uParm2); } -void func_8007C820(struct_8007C820* puParm1, s16 uParm2, s16 uParm3, u32 uParm4, u32 param_5) -{ - puParm1->unk_00 = uParm4; - puParm1->unk_04 = param_5; - puParm1->unk_08 = uParm2; - puParm1->unk_0A = uParm3; +void func_8007C820(struct_8007C820* puParm1, s16 uParm2, s16 uParm3, u32 uParm4, u32 param_5) { + puParm1->unk_00 = uParm4; + puParm1->unk_04 = param_5; + puParm1->unk_08 = uParm2; + puParm1->unk_0A = uParm3; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C850.s") @@ -52,18 +48,15 @@ void func_8007C820(struct_8007C820* puParm1, s16 uParm2, s16 uParm3, u32 uParm4, #pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_800806BC.s") -void func_8008070C() -{ +void func_8008070C() { D_80120130 = 0; } -void func_80080718() -{ +void func_80080718() { D_80120130 = 1; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_80080728.s") -void func_80080788(UNK_TYPE arg0, UNK_TYPE arg1) -{ +void func_80080788(UNK_TYPE arg0, UNK_TYPE arg1) { } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 5b9a3abf9f..91c70d6095 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2,117 +2,115 @@ #include #include -typedef struct -{ +typedef struct { /* 0x00 */ u8 scene; /* 0x01 */ u8 flags1; /* 0x02 */ u8 flags2; /* 0x03 */ u8 flags3; } RestrictionFlags; -RestrictionFlags sRestrictionFlags[] = -{ - { SCENE_SPOT00, 0x00, 0x00, 0x10 }, - { SCENE_SPOT01, 0x00, 0x00, 0x10 }, - { SCENE_SPOT02, 0x00, 0x00, 0x10 }, - { SCENE_SPOT03, 0x00, 0x00, 0x10 }, - { SCENE_SPOT04, 0x00, 0x00, 0x10 }, - { SCENE_SPOT05, 0x00, 0x00, 0x10 }, - { SCENE_SPOT06, 0x00, 0x00, 0x10 }, - { SCENE_SPOT07, 0x00, 0x00, 0x10 }, - { SCENE_SPOT08, 0x00, 0x00, 0x10 }, - { SCENE_SPOT09, 0x00, 0x00, 0x10 }, - { SCENE_SPOT10, 0x00, 0x00, 0x10 }, - { SCENE_SPOT11, 0x00, 0x00, 0x10 }, - { SCENE_SPOT12, 0x00, 0x00, 0x10 }, - { SCENE_SPOT13, 0x00, 0x00, 0x10 }, - { SCENE_SPOT15, 0x00, 0x00, 0x10 }, - { SCENE_GANON_TOU, 0x00, 0x00, 0x10 }, - { SCENE_SPOT16, 0x00, 0x00, 0x10 }, - { SCENE_SPOT17, 0x00, 0x00, 0x10 }, - { SCENE_SPOT18, 0x00, 0x00, 0x10 }, - { SCENE_SPOT20, 0x00, 0x00, 0x10 }, - { SCENE_TOKINOMA, 0x00, 0x10, 0x15 }, - { SCENE_KENJYANOMA, 0xA2, 0xAA, 0xAA }, - { SCENE_SYATEKIJYOU, 0x11, 0x55, 0x55 }, - { SCENE_HAIRAL_NIWA, 0x11, 0x55, 0x55 }, - { SCENE_HAIRAL_NIWA_N, 0x11, 0x55, 0x55 }, - { SCENE_HAKAANA, 0x00, 0x00, 0xD0 }, - { SCENE_HAKAANA2, 0x00, 0x00, 0xD0 }, - { SCENE_HAKAANA_OUKE, 0x00, 0x00, 0xD0 }, - { SCENE_DAIYOUSEI_IZUMI, 0x00, 0x00, 0x10 }, - { SCENE_YOUSEI_IZUMI_TATE, 0x00, 0x00, 0xD0 }, - { SCENE_YOUSEI_IZUMI_YOKO, 0x00, 0x00, 0x10 }, - { SCENE_GANON_FINAL, 0x00, 0x05, 0x50 }, - { SCENE_NAKANIWA, 0x00, 0x05, 0x54 }, - { SCENE_TURIBORI, 0x11, 0x55, 0x55 }, - { SCENE_BOWLING, 0x11, 0x55, 0x55 }, - { SCENE_SOUKO, 0x00, 0x10, 0x15 }, - { SCENE_MIHARIGOYA, 0x00, 0x10, 0x14 }, - { SCENE_MAHOUYA, 0x10, 0x15, 0x55 }, - { SCENE_TAKARAYA, 0x10, 0x15, 0x55 }, - { SCENE_KINSUTA, 0x00, 0x10, 0x15 }, - { SCENE_ENTRA, 0x00, 0x10, 0x15 }, - { SCENE_ENTRA_N, 0x00, 0x10, 0x15 }, - { SCENE_ENRUI, 0x00, 0x10, 0xD5 }, - { SCENE_MARKET_DAY, 0x00, 0x10, 0x15 }, - { SCENE_MARKET_NIGHT, 0x00, 0x10, 0x15 }, - { SCENE_MARKET_RUINS, 0x00, 0x10, 0xD5 }, - { SCENE_MARKET_ALLEY, 0x00, 0x10, 0x15 }, - { SCENE_MARKET_ALLEY_N, 0x00, 0x10, 0x15 }, - { SCENE_SHRINE, 0x00, 0x10, 0x15 }, - { SCENE_SHRINE_N, 0x00, 0x10, 0x15 }, - { SCENE_SHRINE_R, 0x00, 0x10, 0xD5 }, - { SCENE_LINK_HOME, 0x10, 0x10, 0x15 }, - { SCENE_KAKARIKO, 0x10, 0x10, 0x15 }, - { SCENE_KAKARIKO3, 0x10, 0x10, 0x15 }, - { SCENE_KOKIRI_HOME, 0x10, 0x10, 0x15 }, - { SCENE_KOKIRI_HOME3, 0x10, 0x10, 0x15 }, - { SCENE_KOKIRI_HOME4, 0x10, 0x10, 0x15 }, - { SCENE_KOKIRI_HOME5, 0x10, 0x10, 0x15 }, - { SCENE_MALON_STABLE, 0x10, 0x10, 0x15 }, - { SCENE_HUT, 0x10, 0x10, 0x15 }, - { SCENE_IMPA, 0x10, 0x10, 0x15 }, - { SCENE_LABO, 0x10, 0x10, 0x15 }, - { SCENE_HYLIA_LABO, 0x00, 0x10, 0x15 }, - { SCENE_TENT, 0x10, 0x10, 0x15 }, - { SCENE_SHOP1, 0x10, 0x10, 0x15 }, - { SCENE_KOKIRI_SHOP, 0x10, 0x10, 0x15 }, - { SCENE_GOLON, 0x10, 0x10, 0x15 }, - { SCENE_ZOORA, 0x10, 0x10, 0x15 }, - { SCENE_DRAG, 0x10, 0x10, 0x15 }, - { SCENE_ALLEY_SHOP, 0x10, 0x10, 0x15 }, - { SCENE_NIGHT_SHOP, 0x10, 0x10, 0x15 }, - { SCENE_FACE_SHOP, 0x10, 0x10, 0x15 }, - { SCENE_MEN, 0x00, 0x03, 0x10 }, - { SCENE_YDAN, 0x00, 0x00, 0x00 }, - { SCENE_YDAN_BOSS, 0x00, 0x45, 0x50 }, - { SCENE_DDAN, 0x00, 0x00, 0x00 }, - { SCENE_DDAN_BOSS, 0x00, 0x45, 0x50 }, - { SCENE_BDAN, 0x00, 0x00, 0x00 }, - { SCENE_BDAN_BOSS, 0x00, 0x45, 0x50 }, - { SCENE_BMORI1, 0x00, 0x00, 0x00 }, - { SCENE_MORIBOSSROOM, 0x00, 0x45, 0x50 }, - { SCENE_HAKADANCH, 0x00, 0x00, 0x00 }, - { SCENE_HAKADAN, 0x00, 0x00, 0x00 }, - { SCENE_HAKADAN_BS, 0x00, 0x45, 0x50 }, - { SCENE_HIDAN, 0x00, 0x00, 0x00 }, - { SCENE_FIRE_BS, 0x00, 0x45, 0x50 }, - { SCENE_MIZUSIN, 0x00, 0x00, 0x00 }, - { SCENE_MIZUSIN_BS, 0x00, 0x45, 0x50 }, - { SCENE_JYASINZOU, 0x00, 0x00, 0x00 }, - { SCENE_JYASINBOSS, 0x00, 0x45, 0x50 }, - { SCENE_GANON, 0x00, 0x00, 0x00 }, - { SCENE_GANON_BOSS, 0x00, 0x45, 0x50 }, - { SCENE_ICE_DOUKUTO, 0x00, 0x00, 0xC0 }, - { SCENE_HAKASITARELAY, 0x00, 0x03, 0x14 }, - { SCENE_GANONTIKA, 0x00, 0x03, 0x10 }, - { SCENE_GANON_DEMO, 0x00, 0x45, 0x50 }, - { SCENE_GANON_SONOGO, 0x00, 0x05, 0x50 }, - { SCENE_GANONTIKA_SONOGO, 0x00, 0x05, 0x50 }, - { SCENE_GERUDOWAY, 0x00, 0x00, 0x10 }, - { SCENE_KAKUSIANA, 0x00, 0x00, 0xD0 }, - { 0xFF, 0x00, 0x00, 0x00 }, +RestrictionFlags sRestrictionFlags[] = { + { SCENE_SPOT00, 0x00, 0x00, 0x10 }, + { SCENE_SPOT01, 0x00, 0x00, 0x10 }, + { SCENE_SPOT02, 0x00, 0x00, 0x10 }, + { SCENE_SPOT03, 0x00, 0x00, 0x10 }, + { SCENE_SPOT04, 0x00, 0x00, 0x10 }, + { SCENE_SPOT05, 0x00, 0x00, 0x10 }, + { SCENE_SPOT06, 0x00, 0x00, 0x10 }, + { SCENE_SPOT07, 0x00, 0x00, 0x10 }, + { SCENE_SPOT08, 0x00, 0x00, 0x10 }, + { SCENE_SPOT09, 0x00, 0x00, 0x10 }, + { SCENE_SPOT10, 0x00, 0x00, 0x10 }, + { SCENE_SPOT11, 0x00, 0x00, 0x10 }, + { SCENE_SPOT12, 0x00, 0x00, 0x10 }, + { SCENE_SPOT13, 0x00, 0x00, 0x10 }, + { SCENE_SPOT15, 0x00, 0x00, 0x10 }, + { SCENE_GANON_TOU, 0x00, 0x00, 0x10 }, + { SCENE_SPOT16, 0x00, 0x00, 0x10 }, + { SCENE_SPOT17, 0x00, 0x00, 0x10 }, + { SCENE_SPOT18, 0x00, 0x00, 0x10 }, + { SCENE_SPOT20, 0x00, 0x00, 0x10 }, + { SCENE_TOKINOMA, 0x00, 0x10, 0x15 }, + { SCENE_KENJYANOMA, 0xA2, 0xAA, 0xAA }, + { SCENE_SYATEKIJYOU, 0x11, 0x55, 0x55 }, + { SCENE_HAIRAL_NIWA, 0x11, 0x55, 0x55 }, + { SCENE_HAIRAL_NIWA_N, 0x11, 0x55, 0x55 }, + { SCENE_HAKAANA, 0x00, 0x00, 0xD0 }, + { SCENE_HAKAANA2, 0x00, 0x00, 0xD0 }, + { SCENE_HAKAANA_OUKE, 0x00, 0x00, 0xD0 }, + { SCENE_DAIYOUSEI_IZUMI, 0x00, 0x00, 0x10 }, + { SCENE_YOUSEI_IZUMI_TATE, 0x00, 0x00, 0xD0 }, + { SCENE_YOUSEI_IZUMI_YOKO, 0x00, 0x00, 0x10 }, + { SCENE_GANON_FINAL, 0x00, 0x05, 0x50 }, + { SCENE_NAKANIWA, 0x00, 0x05, 0x54 }, + { SCENE_TURIBORI, 0x11, 0x55, 0x55 }, + { SCENE_BOWLING, 0x11, 0x55, 0x55 }, + { SCENE_SOUKO, 0x00, 0x10, 0x15 }, + { SCENE_MIHARIGOYA, 0x00, 0x10, 0x14 }, + { SCENE_MAHOUYA, 0x10, 0x15, 0x55 }, + { SCENE_TAKARAYA, 0x10, 0x15, 0x55 }, + { SCENE_KINSUTA, 0x00, 0x10, 0x15 }, + { SCENE_ENTRA, 0x00, 0x10, 0x15 }, + { SCENE_ENTRA_N, 0x00, 0x10, 0x15 }, + { SCENE_ENRUI, 0x00, 0x10, 0xD5 }, + { SCENE_MARKET_DAY, 0x00, 0x10, 0x15 }, + { SCENE_MARKET_NIGHT, 0x00, 0x10, 0x15 }, + { SCENE_MARKET_RUINS, 0x00, 0x10, 0xD5 }, + { SCENE_MARKET_ALLEY, 0x00, 0x10, 0x15 }, + { SCENE_MARKET_ALLEY_N, 0x00, 0x10, 0x15 }, + { SCENE_SHRINE, 0x00, 0x10, 0x15 }, + { SCENE_SHRINE_N, 0x00, 0x10, 0x15 }, + { SCENE_SHRINE_R, 0x00, 0x10, 0xD5 }, + { SCENE_LINK_HOME, 0x10, 0x10, 0x15 }, + { SCENE_KAKARIKO, 0x10, 0x10, 0x15 }, + { SCENE_KAKARIKO3, 0x10, 0x10, 0x15 }, + { SCENE_KOKIRI_HOME, 0x10, 0x10, 0x15 }, + { SCENE_KOKIRI_HOME3, 0x10, 0x10, 0x15 }, + { SCENE_KOKIRI_HOME4, 0x10, 0x10, 0x15 }, + { SCENE_KOKIRI_HOME5, 0x10, 0x10, 0x15 }, + { SCENE_MALON_STABLE, 0x10, 0x10, 0x15 }, + { SCENE_HUT, 0x10, 0x10, 0x15 }, + { SCENE_IMPA, 0x10, 0x10, 0x15 }, + { SCENE_LABO, 0x10, 0x10, 0x15 }, + { SCENE_HYLIA_LABO, 0x00, 0x10, 0x15 }, + { SCENE_TENT, 0x10, 0x10, 0x15 }, + { SCENE_SHOP1, 0x10, 0x10, 0x15 }, + { SCENE_KOKIRI_SHOP, 0x10, 0x10, 0x15 }, + { SCENE_GOLON, 0x10, 0x10, 0x15 }, + { SCENE_ZOORA, 0x10, 0x10, 0x15 }, + { SCENE_DRAG, 0x10, 0x10, 0x15 }, + { SCENE_ALLEY_SHOP, 0x10, 0x10, 0x15 }, + { SCENE_NIGHT_SHOP, 0x10, 0x10, 0x15 }, + { SCENE_FACE_SHOP, 0x10, 0x10, 0x15 }, + { SCENE_MEN, 0x00, 0x03, 0x10 }, + { SCENE_YDAN, 0x00, 0x00, 0x00 }, + { SCENE_YDAN_BOSS, 0x00, 0x45, 0x50 }, + { SCENE_DDAN, 0x00, 0x00, 0x00 }, + { SCENE_DDAN_BOSS, 0x00, 0x45, 0x50 }, + { SCENE_BDAN, 0x00, 0x00, 0x00 }, + { SCENE_BDAN_BOSS, 0x00, 0x45, 0x50 }, + { SCENE_BMORI1, 0x00, 0x00, 0x00 }, + { SCENE_MORIBOSSROOM, 0x00, 0x45, 0x50 }, + { SCENE_HAKADANCH, 0x00, 0x00, 0x00 }, + { SCENE_HAKADAN, 0x00, 0x00, 0x00 }, + { SCENE_HAKADAN_BS, 0x00, 0x45, 0x50 }, + { SCENE_HIDAN, 0x00, 0x00, 0x00 }, + { SCENE_FIRE_BS, 0x00, 0x45, 0x50 }, + { SCENE_MIZUSIN, 0x00, 0x00, 0x00 }, + { SCENE_MIZUSIN_BS, 0x00, 0x45, 0x50 }, + { SCENE_JYASINZOU, 0x00, 0x00, 0x00 }, + { SCENE_JYASINBOSS, 0x00, 0x45, 0x50 }, + { SCENE_GANON, 0x00, 0x00, 0x00 }, + { SCENE_GANON_BOSS, 0x00, 0x45, 0x50 }, + { SCENE_ICE_DOUKUTO, 0x00, 0x00, 0xC0 }, + { SCENE_HAKASITARELAY, 0x00, 0x03, 0x14 }, + { SCENE_GANONTIKA, 0x00, 0x03, 0x10 }, + { SCENE_GANON_DEMO, 0x00, 0x45, 0x50 }, + { SCENE_GANON_SONOGO, 0x00, 0x05, 0x50 }, + { SCENE_GANONTIKA_SONOGO, 0x00, 0x05, 0x50 }, + { SCENE_GERUDOWAY, 0x00, 0x00, 0x10 }, + { SCENE_KAKUSIANA, 0x00, 0x00, 0xD0 }, + { 0xFF, 0x00, 0x00, 0x00 }, }; s16 sHBAScoreTier = 0; @@ -128,249 +126,264 @@ s16 sMagicBorderR = 0xFF; s16 sMagicBorderG = 0xFF; s16 sMagicBorderB = 0xFF; -s16 sExtraItemBases[] = -{ - ITEM_STICK, ITEM_STICK, ITEM_NUT, ITEM_NUT, ITEM_BOMB, ITEM_BOMB, - ITEM_BOMB, ITEM_BOMB, ITEM_BOW, ITEM_BOW, ITEM_BOW, ITEM_SEEDS, - ITEM_BOMBCHU, ITEM_BOMBCHU, ITEM_STICK, ITEM_STICK, ITEM_NUT, ITEM_NUT, +s16 sExtraItemBases[] = { + ITEM_STICK, ITEM_STICK, ITEM_NUT, ITEM_NUT, ITEM_BOMB, ITEM_BOMB, ITEM_BOMB, ITEM_BOMB, ITEM_BOW, + ITEM_BOW, ITEM_BOW, ITEM_SEEDS, ITEM_BOMBCHU, ITEM_BOMBCHU, ITEM_STICK, ITEM_STICK, ITEM_NUT, ITEM_NUT, }; s16 D_80125A58 = 0; s16 D_80125A5C = 0; -Gfx sSetupDL_80125A60[] = -{ +Gfx sSetupDL_80125A60[] = { gsDPPipeSync(), - gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | - G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_SHADING_SMOOTH | G_LOD), - gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | - G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_1PRIMITIVE, + gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | + G_TEXTURE_GEN_LINEAR | G_SHADING_SMOOTH | G_LOD), + gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_1PRIMITIVE, G_AC_NONE | G_ZS_PIXEL | G_RM_CLD_SURF | G_RM_CLD_SURF2), gsDPSetCombineLERP(0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE, 0, 0, 0, PRIMITIVE), gsSPEndDisplayList(), }; // original name: "alpha_change" -void Interface_ChangeAlpha(u16 alphaType) -{ - if (alphaType != gSaveContext.unk_13EA) - { +void Interface_ChangeAlpha(u16 alphaType) { + if (alphaType != gSaveContext.unk_13EA) { osSyncPrintf("ALPHAーTYPE=%d LAST_TIME_TYPE=%d\n", alphaType, gSaveContext.unk_13EE); gSaveContext.unk_13EA = gSaveContext.unk_13E8 = alphaType; gSaveContext.unk_13EC = 1; } } -void func_80082644(GlobalContext* globalCtx, s16 alpha) -{ +void func_80082644(GlobalContext* globalCtx, s16 alpha) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - if (gSaveContext.button_status[0] == BTN_DISABLED) - { - if (interfaceCtx->bAlpha != 0x46) + if (gSaveContext.button_status[0] == BTN_DISABLED) { + if (interfaceCtx->bAlpha != 0x46) { interfaceCtx->bAlpha = 0x46; - } - else - { - if (interfaceCtx->bAlpha != 0xFF) + } + } else { + if (interfaceCtx->bAlpha != 0xFF) { interfaceCtx->bAlpha = alpha; + } } - if (gSaveContext.button_status[1] == BTN_DISABLED) - { - if (interfaceCtx->cLeftAlpha != 0x46) + if (gSaveContext.button_status[1] == BTN_DISABLED) { + if (interfaceCtx->cLeftAlpha != 0x46) { interfaceCtx->cLeftAlpha = 0x46; - } - else - { - if (interfaceCtx->cLeftAlpha != 0xFF) + } + } else { + if (interfaceCtx->cLeftAlpha != 0xFF) { interfaceCtx->cLeftAlpha = alpha; + } } - if (gSaveContext.button_status[2] == BTN_DISABLED) - { - if (interfaceCtx->cDownAlpha != 0x46) + if (gSaveContext.button_status[2] == BTN_DISABLED) { + if (interfaceCtx->cDownAlpha != 0x46) { interfaceCtx->cDownAlpha = 0x46; - } - else - { - if (interfaceCtx->cDownAlpha != 0xFF) + } + } else { + if (interfaceCtx->cDownAlpha != 0xFF) { interfaceCtx->cDownAlpha = alpha; + } } - if (gSaveContext.button_status[3] == BTN_DISABLED) - { - if (interfaceCtx->cRightAlpha != 0x46) + if (gSaveContext.button_status[3] == BTN_DISABLED) { + if (interfaceCtx->cRightAlpha != 0x46) { interfaceCtx->cRightAlpha = 0x46; - } - else - { - if (interfaceCtx->cRightAlpha != 0xFF) + } + } else { + if (interfaceCtx->cRightAlpha != 0xFF) { interfaceCtx->cRightAlpha = alpha; + } } - if (gSaveContext.button_status[4] == BTN_DISABLED) - { - if (interfaceCtx->aAlpha != 0x46) + if (gSaveContext.button_status[4] == BTN_DISABLED) { + if (interfaceCtx->aAlpha != 0x46) { interfaceCtx->aAlpha = 0x46; - } - else - { - if (interfaceCtx->aAlpha != 0xFF) + } + } else { + if (interfaceCtx->aAlpha != 0xFF) { interfaceCtx->aAlpha = alpha; + } } } -void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) -{ +void func_8008277C(GlobalContext* globalCtx, s16 maxAlpha, s16 alpha) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - if (gSaveContext.unk_13E7 != 0) - { + if (gSaveContext.unk_13E7 != 0) { func_80082644(globalCtx, alpha); return; } - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { interfaceCtx->bAlpha = maxAlpha; + } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { interfaceCtx->cLeftAlpha = maxAlpha; + } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { interfaceCtx->cDownAlpha = maxAlpha; + } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { interfaceCtx->cRightAlpha = maxAlpha; + } } -void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) -{ +void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 alpha; alpha = 0xFF - maxAlpha; - switch (gSaveContext.unk_13E8) - { + switch (gSaveContext.unk_13E8) { case 1: case 2: case 8: osSyncPrintf("a_alpha=%d, c_alpha=%d → ", interfaceCtx->aAlpha, interfaceCtx->cLeftAlpha); - if (gSaveContext.unk_13E8 == 8) - { - if (interfaceCtx->bAlpha != 0xFF) + if (gSaveContext.unk_13E8 == 8) { + if (interfaceCtx->bAlpha != 0xFF) { interfaceCtx->bAlpha = alpha; - } - else - { - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) + } + } else { + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { interfaceCtx->bAlpha = maxAlpha; + } } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { interfaceCtx->cLeftAlpha = maxAlpha; + } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { interfaceCtx->cDownAlpha = maxAlpha; + } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { interfaceCtx->cRightAlpha = maxAlpha; + } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { interfaceCtx->healthAlpha = maxAlpha; + } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; + } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } osSyncPrintf("a_alpha=%d, c_alpha=%d\n", interfaceCtx->aAlpha, interfaceCtx->cLeftAlpha); break; case 3: - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } func_8008277C(globalCtx, maxAlpha, alpha); - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; + } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } - if (interfaceCtx->healthAlpha != 0xFF) + if (interfaceCtx->healthAlpha != 0xFF) { interfaceCtx->healthAlpha = alpha; + } break; case 4: - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { interfaceCtx->bAlpha = maxAlpha; + } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { interfaceCtx->cLeftAlpha = maxAlpha; + } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { interfaceCtx->cDownAlpha = maxAlpha; + } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { interfaceCtx->cRightAlpha = maxAlpha; + } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { interfaceCtx->healthAlpha = maxAlpha; + } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; + } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } - if (interfaceCtx->aAlpha != 0xFF) + if (interfaceCtx->aAlpha != 0xFF) { interfaceCtx->aAlpha = alpha; + } break; case 5: func_8008277C(globalCtx, maxAlpha, alpha); - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } - if (interfaceCtx->aAlpha != 0xFF) + if (interfaceCtx->aAlpha != 0xFF) { interfaceCtx->aAlpha = alpha; + } - if (interfaceCtx->healthAlpha != 0xFF) + if (interfaceCtx->healthAlpha != 0xFF) { interfaceCtx->healthAlpha = alpha; + } - if (interfaceCtx->magicAlpha != 0xFF) + if (interfaceCtx->magicAlpha != 0xFF) { interfaceCtx->magicAlpha = alpha; + } break; case 6: func_8008277C(globalCtx, maxAlpha, alpha); - if (interfaceCtx->aAlpha != 0xFF) + if (interfaceCtx->aAlpha != 0xFF) { interfaceCtx->aAlpha = alpha; + } - if (interfaceCtx->healthAlpha != 0xFF) + if (interfaceCtx->healthAlpha != 0xFF) { interfaceCtx->healthAlpha = alpha; + } - if (interfaceCtx->magicAlpha != 0xFF) + if (interfaceCtx->magicAlpha != 0xFF) { interfaceCtx->magicAlpha = alpha; + } - switch (globalCtx->sceneNum) - { + switch (globalCtx->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -391,158 +404,199 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) case SCENE_SPOT18: case SCENE_SPOT20: case SCENE_GANON_TOU: - if (interfaceCtx->minimapAlpha < 0xAA) + if (interfaceCtx->minimapAlpha < 0xAA) { interfaceCtx->minimapAlpha = alpha; - else + } else { interfaceCtx->minimapAlpha = 0xAA; + } break; default: - if (interfaceCtx->minimapAlpha != 0xFF) + if (interfaceCtx->minimapAlpha != 0xFF) { interfaceCtx->minimapAlpha = alpha; + } break; } break; case 7: - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } func_80082644(globalCtx, alpha); - if (interfaceCtx->healthAlpha != 0xFF) + if (interfaceCtx->healthAlpha != 0xFF) { interfaceCtx->healthAlpha = alpha; + } - if (interfaceCtx->magicAlpha != 0xFF) + if (interfaceCtx->magicAlpha != 0xFF) { interfaceCtx->magicAlpha = alpha; + } break; case 9: - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { interfaceCtx->bAlpha = maxAlpha; + } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { interfaceCtx->cLeftAlpha = maxAlpha; + } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { interfaceCtx->cDownAlpha = maxAlpha; + } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { interfaceCtx->cRightAlpha = maxAlpha; + } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } - if (interfaceCtx->healthAlpha != 0xFF) + if (interfaceCtx->healthAlpha != 0xFF) { interfaceCtx->healthAlpha = alpha; + } - if (interfaceCtx->magicAlpha != 0xFF) + if (interfaceCtx->magicAlpha != 0xFF) { interfaceCtx->magicAlpha = alpha; + } break; case 10: - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { interfaceCtx->cLeftAlpha = maxAlpha; + } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { interfaceCtx->cDownAlpha = maxAlpha; + } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { interfaceCtx->cRightAlpha = maxAlpha; + } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { interfaceCtx->healthAlpha = maxAlpha; + } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; + } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } - if (interfaceCtx->bAlpha != 0xFF) + if (interfaceCtx->bAlpha != 0xFF) { interfaceCtx->bAlpha = alpha; + } break; case 11: - if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) + if ((interfaceCtx->bAlpha != 0) && (interfaceCtx->bAlpha > maxAlpha)) { interfaceCtx->bAlpha = maxAlpha; + } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { interfaceCtx->cLeftAlpha = maxAlpha; + } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { interfaceCtx->cDownAlpha = maxAlpha; + } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { interfaceCtx->cRightAlpha = maxAlpha; + } - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } - if ((interfaceCtx->magicAlpha!= 0) && (interfaceCtx->magicAlpha > maxAlpha)) + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; + } - if (interfaceCtx->healthAlpha != 0xFF) + if (interfaceCtx->healthAlpha != 0xFF) { interfaceCtx->healthAlpha = alpha; + } break; case 12: - if (interfaceCtx->aAlpha != 0xFF) + if (interfaceCtx->aAlpha != 0xFF) { interfaceCtx->aAlpha = alpha; + } - if (interfaceCtx->bAlpha != 0xFF) + if (interfaceCtx->bAlpha != 0xFF) { interfaceCtx->bAlpha = alpha; + } - if (interfaceCtx->minimapAlpha != 0xFF) + if (interfaceCtx->minimapAlpha != 0xFF) { interfaceCtx->minimapAlpha = alpha; + } - if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) + if ((interfaceCtx->cLeftAlpha != 0) && (interfaceCtx->cLeftAlpha > maxAlpha)) { interfaceCtx->cLeftAlpha = maxAlpha; + } - if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) + if ((interfaceCtx->cDownAlpha != 0) && (interfaceCtx->cDownAlpha > maxAlpha)) { interfaceCtx->cDownAlpha = maxAlpha; + } - if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) + if ((interfaceCtx->cRightAlpha != 0) && (interfaceCtx->cRightAlpha > maxAlpha)) { interfaceCtx->cRightAlpha = maxAlpha; + } - if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) + if ((interfaceCtx->magicAlpha != 0) && (interfaceCtx->magicAlpha > maxAlpha)) { interfaceCtx->magicAlpha = maxAlpha; + } - if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) + if ((interfaceCtx->healthAlpha != 0) && (interfaceCtx->healthAlpha > maxAlpha)) { interfaceCtx->healthAlpha = maxAlpha; + } break; case 13: func_8008277C(globalCtx, maxAlpha, alpha); - if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) + if ((interfaceCtx->minimapAlpha != 0) && (interfaceCtx->minimapAlpha > maxAlpha)) { interfaceCtx->minimapAlpha = maxAlpha; + } - if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) + if ((interfaceCtx->aAlpha != 0) && (interfaceCtx->aAlpha > maxAlpha)) { interfaceCtx->aAlpha = maxAlpha; + } - if (interfaceCtx->healthAlpha != 0xFF) + if (interfaceCtx->healthAlpha != 0xFF) { interfaceCtx->healthAlpha = alpha; + } - if (interfaceCtx->magicAlpha != 0xFF) + if (interfaceCtx->magicAlpha != 0xFF) { interfaceCtx->magicAlpha = alpha; + } break; } - if ((globalCtx->roomCtx.curRoom.unk_03 == 1) && (interfaceCtx->minimapAlpha >= 0xFF)) + if ((globalCtx->roomCtx.curRoom.unk_03 == 1) && (interfaceCtx->minimapAlpha >= 0xFF)) { interfaceCtx->minimapAlpha = 0xFF; + } } -void func_80083108(GlobalContext* globalCtx) -{ +void func_80083108(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; Player* player = PLAYER; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; @@ -552,86 +606,72 @@ void func_80083108(GlobalContext* globalCtx) sp28 = 0; if ((gSaveContext.cutscene_index < 0xFFF0) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutscene_index == 0xFFF0))) - { + ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.cutscene_index == 0xFFF0))) { gSaveContext.unk_13E7 = 0; if ((player->stateFlags1 & 0x00800000) || (globalCtx->unk_11E5C >= 2) || - ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) - { - if (gSaveContext.equips.button_items[0] != ITEM_NONE) - { + ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { + if (gSaveContext.equips.button_items[0] != ITEM_NONE) { gSaveContext.unk_13E7 = 1; - if (gSaveContext.button_status[0] == BTN_DISABLED) - { - gSaveContext.button_status[0] = gSaveContext.button_status[1] = - gSaveContext.button_status[2] = gSaveContext.button_status[3] = BTN_ENABLED; + if (gSaveContext.button_status[0] == BTN_DISABLED) { + gSaveContext.button_status[0] = gSaveContext.button_status[1] = gSaveContext.button_status[2] = + gSaveContext.button_status[3] = BTN_ENABLED; } if ((gSaveContext.equips.button_items[0] != ITEM_SLINGSHOT) && (gSaveContext.equips.button_items[0] != ITEM_BOW) && (gSaveContext.equips.button_items[0] != ITEM_BOMBCHU) && - (gSaveContext.equips.button_items[0] != ITEM_NONE)) - { + (gSaveContext.equips.button_items[0] != ITEM_NONE)) { gSaveContext.button_status[0] = gSaveContext.equips.button_items[0]; - if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) - { + if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { gSaveContext.equips.button_items[0] = ITEM_BOMBCHU; Interface_LoadItemIcon1(globalCtx, 0); - } - else - { + } else { gSaveContext.equips.button_items[0] = ITEM_BOW; - if (globalCtx->unk_11E5C >= 2) - { - if (LINK_AGE_IN_YEARS == YEARS_CHILD) + if (globalCtx->unk_11E5C >= 2) { + if (LINK_AGE_IN_YEARS == YEARS_CHILD) { gSaveContext.equips.button_items[0] = ITEM_SLINGSHOT; + } Interface_LoadItemIcon1(globalCtx, 0); - } - else - { - if (gSaveContext.items[SLOT_BOW] == ITEM_NONE) + } else { + if (gSaveContext.items[SLOT_BOW] == ITEM_NONE) { gSaveContext.equips.button_items[0] = ITEM_NONE; - else + } else { Interface_LoadItemIcon1(globalCtx, 0); + } } } - gSaveContext.button_status[1] = gSaveContext.button_status[2] = gSaveContext.button_status[3] = BTN_DISABLED; + gSaveContext.button_status[1] = gSaveContext.button_status[2] = gSaveContext.button_status[3] = + BTN_DISABLED; Interface_ChangeAlpha(6); } - if (globalCtx->unk_1241B != 0) + if (globalCtx->unk_1241B != 0) { Interface_ChangeAlpha(1); - else if (gSaveContext.minigame_state == 1) + } else if (gSaveContext.minigame_state == 1) { Interface_ChangeAlpha(8); - else if (globalCtx->unk_11E5C >= 2) + } else if (globalCtx->unk_11E5C >= 2) { Interface_ChangeAlpha(8); - else if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) + } else if ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { Interface_ChangeAlpha(8); - else if (player->stateFlags1 & 0x00800000) + } else if (player->stateFlags1 & 0x00800000) { Interface_ChangeAlpha(12); - } - else - { - if (player->stateFlags1 & 0x00800000) + } + } else { + if (player->stateFlags1 & 0x00800000) { Interface_ChangeAlpha(12); + } } - } - else if (globalCtx->sceneNum == SCENE_KENJYANOMA) - { + } else if (globalCtx->sceneNum == SCENE_KENJYANOMA) { Interface_ChangeAlpha(1); - } - else if (globalCtx->sceneNum == SCENE_TURIBORI) - { + } else if (globalCtx->sceneNum == SCENE_TURIBORI) { gSaveContext.unk_13E7 = 2; - if (globalCtx->interfaceCtx.unk_260 != 0) - { - if (gSaveContext.equips.button_items[0] != ITEM_FISHING_POLE) - { + if (globalCtx->interfaceCtx.unk_260 != 0) { + if (gSaveContext.equips.button_items[0] != ITEM_FISHING_POLE) { gSaveContext.button_status[0] = gSaveContext.equips.button_items[0]; gSaveContext.equips.button_items[0] = ITEM_FISHING_POLE; gSaveContext.unk_13EA = 0; @@ -639,78 +679,69 @@ void func_80083108(GlobalContext* globalCtx) Interface_ChangeAlpha(12); } - if (gSaveContext.unk_13EA != 12) + if (gSaveContext.unk_13EA != 12) { Interface_ChangeAlpha(12); - } - else if (gSaveContext.equips.button_items[0] == ITEM_FISHING_POLE) - { + } + } else if (gSaveContext.equips.button_items[0] == ITEM_FISHING_POLE) { gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; gSaveContext.unk_13EA = 0; - if (gSaveContext.equips.button_items[0] != ITEM_NONE) + if (gSaveContext.equips.button_items[0] != ITEM_NONE) { Interface_LoadItemIcon1(globalCtx, 0); + } - gSaveContext.button_status[0] = gSaveContext.button_status[1] = - gSaveContext.button_status[2] = gSaveContext.button_status[3] = BTN_DISABLED; + gSaveContext.button_status[0] = gSaveContext.button_status[1] = gSaveContext.button_status[2] = + gSaveContext.button_status[3] = BTN_DISABLED; Interface_ChangeAlpha(50); - } - else - { - if (gSaveContext.button_status[0] == BTN_ENABLED) + } else { + if (gSaveContext.button_status[0] == BTN_ENABLED) { gSaveContext.unk_13EA = 0; + } - gSaveContext.button_status[0] = gSaveContext.button_status[1] = - gSaveContext.button_status[2] = gSaveContext.button_status[3] = BTN_DISABLED; + gSaveContext.button_status[0] = gSaveContext.button_status[1] = gSaveContext.button_status[2] = + gSaveContext.button_status[3] = BTN_DISABLED; Interface_ChangeAlpha(50); } - } - else if (msgCtx->msgMode == 0) - { - if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) - { - if (gSaveContext.button_status[0] != BTN_DISABLED) + } else if (msgCtx->msgMode == 0) { + if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) { + if (gSaveContext.button_status[0] != BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[0] = BTN_DISABLED; - for (i = 1; i < 4; i++) - { - if (func_8008F2F8(globalCtx) == 2) - { + for (i = 1; i < 4; i++) { + if (func_8008F2F8(globalCtx) == 2) { if ((gSaveContext.equips.button_items[i] != ITEM_HOOKSHOT) && - (gSaveContext.equips.button_items[i] != ITEM_LONGSHOT)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] != ITEM_LONGSHOT)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; - } - else - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + } else { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } - } - else - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + } else { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; } } - if (sp28) + if (sp28) { gSaveContext.unk_13EA = 0; + } Interface_ChangeAlpha(50); - } - else if ((player->stateFlags1 & 0x00200000) || (player->stateFlags2 & 0x00040000)) - { - if (gSaveContext.button_status[0] != BTN_DISABLED) - { + } else if ((player->stateFlags1 & 0x00200000) || (player->stateFlags2 & 0x00040000)) { + if (gSaveContext.button_status[0] != BTN_DISABLED) { gSaveContext.button_status[0] = BTN_DISABLED; gSaveContext.button_status[1] = BTN_DISABLED; gSaveContext.button_status[2] = BTN_DISABLED; @@ -718,341 +749,278 @@ void func_80083108(GlobalContext* globalCtx) gSaveContext.unk_13EA = 0; Interface_ChangeAlpha(50); } - } - else if ((gSaveContext.event_inf[0] & 0xF) == 1) - { - if (player->stateFlags1 & 0x00800000) - { + } else if ((gSaveContext.event_inf[0] & 0xF) == 1) { + if (player->stateFlags1 & 0x00800000) { if ((gSaveContext.equips.button_items[0] != ITEM_NONE) && - (gSaveContext.equips.button_items[0] != ITEM_BOW)) - { - if (gSaveContext.items[SLOT_BOW] == ITEM_NONE) - { + (gSaveContext.equips.button_items[0] != ITEM_BOW)) { + if (gSaveContext.items[SLOT_BOW] == ITEM_NONE) { gSaveContext.equips.button_items[0] = ITEM_NONE; - } - else - { + } else { gSaveContext.equips.button_items[0] = ITEM_BOW; sp28 = 1; } } + } else { + do { + sp28 = 1; + + if ((gSaveContext.equips.button_items[0] == ITEM_NONE) || + (gSaveContext.equips.button_items[0] == ITEM_BOW)) { + + if ((gSaveContext.equips.button_items[0] != ITEM_SWORD_KOKIRI) && + (gSaveContext.equips.button_items[0] != ITEM_SWORD_MASTER) && + (gSaveContext.equips.button_items[0] != ITEM_SWORD_BGS) && + (gSaveContext.equips.button_items[0] != ITEM_SWORD_KNIFE)) { + gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; + } else { + gSaveContext.button_status[0] = gSaveContext.equips.button_items[0]; + } + } + } while (0); // Necessary to match } - else do - { - sp28 = 1; - if ((gSaveContext.equips.button_items[0] == ITEM_NONE) || - (gSaveContext.equips.button_items[0] == ITEM_BOW)) - { - - if ((gSaveContext.equips.button_items[0] != ITEM_SWORD_KOKIRI) && - (gSaveContext.equips.button_items[0] != ITEM_SWORD_MASTER) && - (gSaveContext.equips.button_items[0] != ITEM_SWORD_BGS) && - (gSaveContext.equips.button_items[0] != ITEM_SWORD_KNIFE)) - { - gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; - } - else - { - gSaveContext.button_status[0] = gSaveContext.equips.button_items[0]; - } - } - } while (0); // Necessary to match - - if (sp28) - { + if (sp28) { Interface_LoadItemIcon1(globalCtx, 0); sp28 = 0; } - for (i = 1; i < 4; i++) - { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] != ITEM_OCARINA_FAIRY) && - (gSaveContext.equips.button_items[i] != ITEM_OCARINA_TIME)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] != ITEM_OCARINA_TIME)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; - } - else - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + } else { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } - if (sp28) + if (sp28) { gSaveContext.unk_13EA = 0; + } Interface_ChangeAlpha(50); - } - else - { - if (interfaceCtx->restrictions.bButton == 0) - { + } else { + if (interfaceCtx->restrictions.bButton == 0) { if ((gSaveContext.equips.button_items[0] == ITEM_SLINGSHOT) || (gSaveContext.equips.button_items[0] == ITEM_BOW) || (gSaveContext.equips.button_items[0] == ITEM_BOMBCHU) || - (gSaveContext.equips.button_items[0] == ITEM_NONE)) - { - if ((gSaveContext.equips.button_items[0] != ITEM_NONE) || (gSaveContext.inf_table[29] == 0)) - { + (gSaveContext.equips.button_items[0] == ITEM_NONE)) { + if ((gSaveContext.equips.button_items[0] != ITEM_NONE) || (gSaveContext.inf_table[29] == 0)) { gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; sp28 = 1; - if (gSaveContext.equips.button_items[0] != ITEM_NONE) + if (gSaveContext.equips.button_items[0] != ITEM_NONE) { Interface_LoadItemIcon1(globalCtx, 0); + } } - } - else if ((gSaveContext.button_status[0] & 0xFF) == BTN_DISABLED) - { + } else if ((gSaveContext.button_status[0] & 0xFF) == BTN_DISABLED) { sp28 = 1; if (((gSaveContext.button_status[0] & 0xFF) == BTN_DISABLED) || - ((gSaveContext.button_status[0] & 0xFF) == BTN_ENABLED)) - { + ((gSaveContext.button_status[0] & 0xFF) == BTN_ENABLED)) { gSaveContext.button_status[0] = BTN_ENABLED; - } - else - { + } else { gSaveContext.equips.button_items[0] = gSaveContext.button_status[0] & 0xFF; } } - } - else if (interfaceCtx->restrictions.bButton == 1) - { + } else if (interfaceCtx->restrictions.bButton == 1) { if ((gSaveContext.equips.button_items[0] == ITEM_SLINGSHOT) || (gSaveContext.equips.button_items[0] == ITEM_BOW) || (gSaveContext.equips.button_items[0] == ITEM_BOMBCHU) || - (gSaveContext.equips.button_items[0] == ITEM_NONE)) - { - if ((gSaveContext.equips.button_items[0] != ITEM_NONE) || (gSaveContext.inf_table[29] == 0)) - { + (gSaveContext.equips.button_items[0] == ITEM_NONE)) { + if ((gSaveContext.equips.button_items[0] != ITEM_NONE) || (gSaveContext.inf_table[29] == 0)) { gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; sp28 = 1; - if (gSaveContext.equips.button_items[0] != ITEM_NONE) + if (gSaveContext.equips.button_items[0] != ITEM_NONE) { Interface_LoadItemIcon1(globalCtx, 0); + } } - } - else - { - if (gSaveContext.button_status[0] == BTN_ENABLED) + } else { + if (gSaveContext.button_status[0] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[0] = BTN_DISABLED; } } - if (interfaceCtx->restrictions.bottles != 0) - { - for (i = 1; i < 4; i++) - { + if (interfaceCtx->restrictions.bottles != 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] >= ITEM_BOTTLE) && - (gSaveContext.equips.button_items[i] <= ITEM_POE)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] <= ITEM_POE)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; } } - } - else if (interfaceCtx->restrictions.bottles == 0) - { - for (i = 1; i < 4; i++) - { + } else if (interfaceCtx->restrictions.bottles == 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] >= ITEM_BOTTLE) && - (gSaveContext.equips.button_items[i] <= ITEM_POE)) - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + (gSaveContext.equips.button_items[i] <= ITEM_POE)) { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } } - if (interfaceCtx->restrictions.tradeItems != 0) - { - for (i = 1; i < 4; i++) - { + if (interfaceCtx->restrictions.tradeItems != 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] >= ITEM_WEIRD_EGG) && - (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; } } - } - else if (interfaceCtx->restrictions.tradeItems == 0) - { - for (i = 1; i < 4; i++) - { + } else if (interfaceCtx->restrictions.tradeItems == 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] >= ITEM_WEIRD_EGG) && - (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK)) - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK)) { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } } - if (interfaceCtx->restrictions.hookshot != 0) - { - for (i = 1; i < 4; i++) - { + if (interfaceCtx->restrictions.hookshot != 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] == ITEM_HOOKSHOT) || - (gSaveContext.equips.button_items[i] == ITEM_LONGSHOT)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] == ITEM_LONGSHOT)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; } } - } - else if (interfaceCtx->restrictions.hookshot == 0) - { - for (i = 1; i < 4; i++) - { + } else if (interfaceCtx->restrictions.hookshot == 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] == ITEM_HOOKSHOT) || - (gSaveContext.equips.button_items[i] == ITEM_LONGSHOT)) - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + (gSaveContext.equips.button_items[i] == ITEM_LONGSHOT)) { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } } - if (interfaceCtx->restrictions.ocarina != 0) - { - for (i = 1; i < 4; i++) - { + if (interfaceCtx->restrictions.ocarina != 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] == ITEM_OCARINA_FAIRY) || - (gSaveContext.equips.button_items[i] == ITEM_OCARINA_TIME)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] == ITEM_OCARINA_TIME)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; } } - } - else if (interfaceCtx->restrictions.ocarina == 0) - { - for (i = 1; i < 4; i++) - { + } else if (interfaceCtx->restrictions.ocarina == 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] == ITEM_OCARINA_FAIRY) || - (gSaveContext.equips.button_items[i] == ITEM_OCARINA_TIME)) - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + (gSaveContext.equips.button_items[i] == ITEM_OCARINA_TIME)) { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } } - if (interfaceCtx->restrictions.farores != 0) - { - for (i = 1; i < 4; i++) - { - if (gSaveContext.equips.button_items[i] == ITEM_FARORES_WIND) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + if (interfaceCtx->restrictions.farores != 0) { + for (i = 1; i < 4; i++) { + if (gSaveContext.equips.button_items[i] == ITEM_FARORES_WIND) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; osSyncPrintf("***(i=%d)*** ", i); } } - } - else if (interfaceCtx->restrictions.farores == 0) - { - for (i = 1; i < 4; i++) - { - if (gSaveContext.equips.button_items[i] == ITEM_FARORES_WIND) - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + } else if (interfaceCtx->restrictions.farores == 0) { + for (i = 1; i < 4; i++) { + if (gSaveContext.equips.button_items[i] == ITEM_FARORES_WIND) { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } } - if (interfaceCtx->restrictions.dinsNayrus != 0) - { - for (i = 1; i < 4; i++) - { + if (interfaceCtx->restrictions.dinsNayrus != 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] == ITEM_DINS_FIRE) || - (gSaveContext.equips.button_items[i] == ITEM_NAYRUS_LOVE)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] == ITEM_NAYRUS_LOVE)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; } } - } - else if (interfaceCtx->restrictions.dinsNayrus == 0) - { - for (i = 1; i < 4; i++) - { + } else if (interfaceCtx->restrictions.dinsNayrus == 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] == ITEM_DINS_FIRE) || - (gSaveContext.equips.button_items[i] == ITEM_NAYRUS_LOVE)) - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + (gSaveContext.equips.button_items[i] == ITEM_NAYRUS_LOVE)) { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } } - if (interfaceCtx->restrictions.all != 0) - { - for (i = 1; i < 4; i++) - { + if (interfaceCtx->restrictions.all != 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] != ITEM_OCARINA_FAIRY) && (gSaveContext.equips.button_items[i] != ITEM_OCARINA_TIME) && !((gSaveContext.equips.button_items[i] >= ITEM_BOTTLE) && (gSaveContext.equips.button_items[i] <= ITEM_POE)) && !((gSaveContext.equips.button_items[i] >= ITEM_WEIRD_EGG) && - (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) - { + (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) { if ((globalCtx->sceneNum != SCENE_TAKARAYA) || - (gSaveContext.equips.button_items[i] != ITEM_LENS)) - { - if (gSaveContext.button_status[i] == BTN_ENABLED) + (gSaveContext.equips.button_items[i] != ITEM_LENS)) { + if (gSaveContext.button_status[i] == BTN_ENABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_DISABLED; - } - else - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + } else { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } } } - } - else if (interfaceCtx->restrictions.all == 0) - { - for (i = 1; i < 4; i++) - { + } else if (interfaceCtx->restrictions.all == 0) { + for (i = 1; i < 4; i++) { if ((gSaveContext.equips.button_items[i] != ITEM_DINS_FIRE) && (gSaveContext.equips.button_items[i] != ITEM_HOOKSHOT) && (gSaveContext.equips.button_items[i] != ITEM_LONGSHOT) && @@ -1063,10 +1031,10 @@ void func_80083108(GlobalContext* globalCtx) !((gSaveContext.equips.button_items[i] >= ITEM_BOTTLE) && (gSaveContext.equips.button_items[i] <= ITEM_POE)) && !((gSaveContext.equips.button_items[i] >= ITEM_WEIRD_EGG) && - (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) - { - if (gSaveContext.button_status[i] == BTN_DISABLED) + (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) { + if (gSaveContext.button_status[i] == BTN_DISABLED) { sp28 = 1; + } gSaveContext.button_status[i] = BTN_ENABLED; } @@ -1076,44 +1044,39 @@ void func_80083108(GlobalContext* globalCtx) } } - if (sp28) - { + if (sp28) { gSaveContext.unk_13EA = 0; - if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_1241B == 0)) - { + if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_1241B == 0)) { Interface_ChangeAlpha(50); osSyncPrintf("???????? alpha_change( 50 ); ?????\n"); - } - else - { + } else { osSyncPrintf("game_play->fade_direction || game_play->fbdemo_wipe_modem"); } } } -void Interface_SetSceneRestrictions(GlobalContext* globalCtx) -{ +void Interface_SetSceneRestrictions(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 i; u8 currentScene; + // clang-format off interfaceCtx->restrictions.hGauge = interfaceCtx->restrictions.bButton = interfaceCtx->restrictions.aButton = interfaceCtx->restrictions.bottles = - interfaceCtx->restrictions.tradeItems = interfaceCtx->restrictions.hookshot = + interfaceCtx->restrictions.tradeItems = interfaceCtx->restrictions.hookshot = interfaceCtx->restrictions.ocarina = interfaceCtx->restrictions.warpSongs = interfaceCtx->restrictions.sunsSong = interfaceCtx->restrictions.farores = interfaceCtx->restrictions.dinsNayrus = interfaceCtx->restrictions.all = 0; + // clang-format on i = 0; // Translates to: "Data settings related to button display scene_data_ID=%d\n" osSyncPrintf("ボタン表示関係データ設定 scene_data_ID=%d\n", globalCtx->sceneNum); - do - { + do { currentScene = (u8)globalCtx->sceneNum; - if (sRestrictionFlags[i].scene == currentScene) - { + if (sRestrictionFlags[i].scene == currentScene) { interfaceCtx->restrictions.hGauge = (sRestrictionFlags[i].flags1 & 0xC0) >> 6; interfaceCtx->restrictions.bButton = (sRestrictionFlags[i].flags1 & 0x30) >> 4; interfaceCtx->restrictions.aButton = (sRestrictionFlags[i].flags1 & 0x0C) >> 2; @@ -1128,104 +1091,74 @@ void Interface_SetSceneRestrictions(GlobalContext* globalCtx) interfaceCtx->restrictions.all = (sRestrictionFlags[i].flags3 & 0x03) >> 0; osSyncPrintf(VT_FGCOL(YELLOW)); - osSyncPrintf("parameter->button_status = %x,%x,%x\n", - sRestrictionFlags[i].flags1, sRestrictionFlags[i].flags2, sRestrictionFlags[i].flags3); - osSyncPrintf("h_gage=%d, b_button=%d, a_button=%d, c_bottle=%d\n", - interfaceCtx->restrictions.hGauge, interfaceCtx->restrictions.bButton, - interfaceCtx->restrictions.aButton, interfaceCtx->restrictions.bottles); - osSyncPrintf("c_warasibe=%d, c_hook=%d, c_ocarina=%d, c_warp=%d\n", - interfaceCtx->restrictions.tradeItems, interfaceCtx->restrictions.hookshot, - interfaceCtx->restrictions.ocarina, interfaceCtx->restrictions.warpSongs); - osSyncPrintf("c_sunmoon=%d, m_wind=%d, m_magic=%d, another=%d\n", - interfaceCtx->restrictions.sunsSong, interfaceCtx->restrictions.farores, - interfaceCtx->restrictions.dinsNayrus, interfaceCtx->restrictions.all); + osSyncPrintf("parameter->button_status = %x,%x,%x\n", sRestrictionFlags[i].flags1, + sRestrictionFlags[i].flags2, sRestrictionFlags[i].flags3); + osSyncPrintf("h_gage=%d, b_button=%d, a_button=%d, c_bottle=%d\n", interfaceCtx->restrictions.hGauge, + interfaceCtx->restrictions.bButton, interfaceCtx->restrictions.aButton, + interfaceCtx->restrictions.bottles); + osSyncPrintf("c_warasibe=%d, c_hook=%d, c_ocarina=%d, c_warp=%d\n", interfaceCtx->restrictions.tradeItems, + interfaceCtx->restrictions.hookshot, interfaceCtx->restrictions.ocarina, + interfaceCtx->restrictions.warpSongs); + osSyncPrintf("c_sunmoon=%d, m_wind=%d, m_magic=%d, another=%d\n", interfaceCtx->restrictions.sunsSong, + interfaceCtx->restrictions.farores, interfaceCtx->restrictions.dinsNayrus, + interfaceCtx->restrictions.all); osSyncPrintf(VT_RST); return; } i++; - } - while (sRestrictionFlags[i].scene != 0xFF); + } while (sRestrictionFlags[i].scene != 0xFF); } -Gfx* Draw_TextureIA8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, - s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) -{ - gDPLoadTextureBlock(displayListHead++, - texture, - G_IM_FMT_IA, - G_IM_SIZ_8b, - textureWidth, textureHeight, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); +Gfx* Draw_TextureIA8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, + s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { + gDPLoadTextureBlock(displayListHead++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, textureWidth, textureHeight, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); - gSPTextureRectangle(displayListHead++, - rectLeft * 4, rectTop * 4, - (rectLeft + rectWidth) * 4, (rectTop + rectHeight) * 4, - G_TX_RENDERTILE, - 0, 0, - dsdx, dtdy); + gSPTextureRectangle(displayListHead++, rectLeft * 4, rectTop * 4, (rectLeft + rectWidth) * 4, + (rectTop + rectHeight) * 4, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); return displayListHead; } -Gfx* Draw_TextureI8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, - s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) -{ - gDPLoadTextureBlock(displayListHead++, - texture, - G_IM_FMT_I, - G_IM_SIZ_8b, - textureWidth, textureHeight, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); +Gfx* Draw_TextureI8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, + s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { + gDPLoadTextureBlock(displayListHead++, texture, G_IM_FMT_I, G_IM_SIZ_8b, textureWidth, textureHeight, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); - gSPTextureRectangle(displayListHead++, - rectLeft * 4, rectTop * 4, - (rectLeft + rectWidth) * 4, (rectTop + rectHeight) * 4, - G_TX_RENDERTILE, - 0, 0, - dsdx, dtdy); + gSPTextureRectangle(displayListHead++, rectLeft * 4, rectTop * 4, (rectLeft + rectWidth) * 4, + (rectTop + rectHeight) * 4, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); return displayListHead; } #ifdef NON_MATCHING // regalloc differences -void Inventory_SwapAgeEquipment(void) -{ +void Inventory_SwapAgeEquipment(void) { s16 i; u16 temp; - if (LINK_AGE_IN_YEARS == YEARS_CHILD) - { - for (i = 0; i < 4; i++) - { + if (LINK_AGE_IN_YEARS == YEARS_CHILD) { + for (i = 0; i < 4; i++) { if (i != 0) gSaveContext.child_equips.button_items[i] = gSaveContext.equips.button_items[i]; else gSaveContext.child_equips.button_items[i] = ITEM_SWORD_KOKIRI; if (i != 0) - gSaveContext.child_equips.c_button_slots[i-1] = gSaveContext.equips.c_button_slots[i-1]; + gSaveContext.child_equips.c_button_slots[i - 1] = gSaveContext.equips.c_button_slots[i - 1]; } gSaveContext.child_equips.equipment = gSaveContext.equips.equipment; - if (gSaveContext.adult_equips.button_items[0] == ITEM_NONE) - { + if (gSaveContext.adult_equips.button_items[0] == ITEM_NONE) { gSaveContext.equips.button_items[0] = ITEM_SWORD_MASTER; - if (gSaveContext.items[SLOT_NUT] != ITEM_NONE) - { + if (gSaveContext.items[SLOT_NUT] != ITEM_NONE) { gSaveContext.equips.button_items[1] = ITEM_NUT; gSaveContext.equips.c_button_slots[0] = SLOT_NUT; - } - else - { + } else { gSaveContext.equips.c_button_slots[0] = SLOT_NONE; gSaveContext.equips.button_items[1] = ITEM_NONE; } @@ -1235,57 +1168,47 @@ void Inventory_SwapAgeEquipment(void) gSaveContext.equips.c_button_slots[2] = SLOT_OCARINA; gSaveContext.equips.equipment = 0x1122; gSaveContext.equips.button_items[3] = gSaveContext.items[SLOT_OCARINA]; - } - else - { - for (i = 0; i < 4; i++) - { + } else { + for (i = 0; i < 4; i++) { gSaveContext.equips.button_items[i] = gSaveContext.adult_equips.button_items[i]; if (i != 0) - gSaveContext.equips.c_button_slots[i-1] = gSaveContext.adult_equips.c_button_slots[i-1]; + gSaveContext.equips.c_button_slots[i - 1] = gSaveContext.adult_equips.c_button_slots[i - 1]; if (((gSaveContext.equips.button_items[i] >= ITEM_BOTTLE) && (gSaveContext.equips.button_items[i] <= ITEM_POE)) || ((gSaveContext.equips.button_items[i] >= ITEM_WEIRD_EGG) && - (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) - { - osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.c_button_slots[i-1]); - gSaveContext.equips.button_items[i] = gSaveContext.items[gSaveContext.equips.c_button_slots[i-1]]; + (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) { + osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.c_button_slots[i - 1]); + gSaveContext.equips.button_items[i] = gSaveContext.items[gSaveContext.equips.c_button_slots[i - 1]]; } } gSaveContext.equips.equipment = gSaveContext.adult_equips.equipment; } - } - else - { - for (i = 0; i < 4; i++) - { + } else { + for (i = 0; i < 4; i++) { gSaveContext.adult_equips.button_items[i] = gSaveContext.equips.button_items[i]; if (i != 0) - gSaveContext.adult_equips.c_button_slots[i-1] = gSaveContext.equips.c_button_slots[i-1]; + gSaveContext.adult_equips.c_button_slots[i - 1] = gSaveContext.equips.c_button_slots[i - 1]; } gSaveContext.adult_equips.equipment = gSaveContext.equips.equipment; - if (gSaveContext.child_equips.button_items[0] != ITEM_NONE) - { - for (i = 0; i < 4; i++) - { + if (gSaveContext.child_equips.button_items[0] != ITEM_NONE) { + for (i = 0; i < 4; i++) { gSaveContext.equips.button_items[i] = gSaveContext.child_equips.button_items[i]; if (i != 0) - gSaveContext.equips.c_button_slots[i-1] = gSaveContext.child_equips.c_button_slots[i-1]; + gSaveContext.equips.c_button_slots[i - 1] = gSaveContext.child_equips.c_button_slots[i - 1]; if (((gSaveContext.equips.button_items[i] >= ITEM_BOTTLE) && (gSaveContext.equips.button_items[i] <= ITEM_POE)) || ((gSaveContext.equips.button_items[i] >= ITEM_WEIRD_EGG) && - (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) - { - osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.c_button_slots[i-1]); - gSaveContext.equips.button_items[i] = gSaveContext.items[gSaveContext.equips.c_button_slots[i-1]]; + (gSaveContext.equips.button_items[i] <= ITEM_CLAIM_CHECK))) { + osSyncPrintf("Register_Item_Pt(%d)=%d\n", i, gSaveContext.equips.c_button_slots[i - 1]); + gSaveContext.equips.button_items[i] = gSaveContext.items[gSaveContext.equips.c_button_slots[i - 1]]; } } @@ -1296,8 +1219,7 @@ void Inventory_SwapAgeEquipment(void) } temp = gEquipMasks[EQUIP_SHIELD] & gSaveContext.equips.equipment; - if (temp != 0) - { + if (temp != 0) { temp >>= gEquipShifts[EQUIP_SHIELD]; if (!(gBitFlags[temp + 3] & gSaveContext.equipment)) gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_SHIELD]; @@ -1307,8 +1229,7 @@ void Inventory_SwapAgeEquipment(void) #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Inventory_SwapAgeEquipment.s") #endif -void Interface_InitHorsebackArchery(GlobalContext* globalCtx) -{ +void Interface_InitHorsebackArchery(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; gSaveContext.minigame_state = 1; @@ -1317,21 +1238,20 @@ void Interface_InitHorsebackArchery(GlobalContext* globalCtx) interfaceCtx->hbaAmmo = 20; } -void func_800849EC(GlobalContext* globalCtx) -{ +void func_800849EC(GlobalContext* globalCtx) { gSaveContext.equipment |= gBitFlags[2] << gEquipShifts[0]; gSaveContext.equipment ^= 8 << gEquipShifts[0]; - if (gBitFlags[3] & gSaveContext.equipment) + if (gBitFlags[3] & gSaveContext.equipment) { gSaveContext.equips.button_items[0] = ITEM_SWORD_KNIFE; - else + } else { gSaveContext.equips.button_items[0] = ITEM_SWORD_BGS; + } Interface_LoadItemIcon1(globalCtx, 0); } -void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) -{ +void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); @@ -1341,8 +1261,7 @@ void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } -void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) -{ +void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); @@ -1352,42 +1271,33 @@ void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); } -void func_80084BF4(GlobalContext* globalCtx, u16 flag) -{ - if (flag) - { +void func_80084BF4(GlobalContext* globalCtx, u16 flag) { + if (flag) { if ((gSaveContext.equips.button_items[0] == ITEM_SLINGSHOT) || (gSaveContext.equips.button_items[0] == ITEM_BOW) || (gSaveContext.equips.button_items[0] == ITEM_BOMBCHU) || (gSaveContext.equips.button_items[0] == ITEM_FISHING_POLE) || - (gSaveContext.button_status[0] == BTN_DISABLED)) - { + (gSaveContext.button_status[0] == BTN_DISABLED)) { if ((gSaveContext.equips.button_items[0] == ITEM_SLINGSHOT) || (gSaveContext.equips.button_items[0] == ITEM_BOW) || (gSaveContext.equips.button_items[0] == ITEM_BOMBCHU) || - (gSaveContext.equips.button_items[0] == ITEM_FISHING_POLE)) - { + (gSaveContext.equips.button_items[0] == ITEM_FISHING_POLE)) { gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; Interface_LoadItemIcon1(globalCtx, 0); } - } - else if (gSaveContext.equips.button_items[0] == ITEM_NONE) - { - if ((gSaveContext.equips.button_items[0] != ITEM_NONE) || (gSaveContext.inf_table[29] == 0)) - { + } else if (gSaveContext.equips.button_items[0] == ITEM_NONE) { + if ((gSaveContext.equips.button_items[0] != ITEM_NONE) || (gSaveContext.inf_table[29] == 0)) { gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; Interface_LoadItemIcon1(globalCtx, 0); } } - gSaveContext.button_status[0] = gSaveContext.button_status[1] = - gSaveContext.button_status[2] = gSaveContext.button_status[3] = BTN_ENABLED; + gSaveContext.button_status[0] = gSaveContext.button_status[1] = gSaveContext.button_status[2] = + gSaveContext.button_status[3] = BTN_ENABLED; Interface_ChangeAlpha(7); - } - else - { - gSaveContext.button_status[0] = gSaveContext.button_status[1] = - gSaveContext.button_status[2] = gSaveContext.button_status[3] = BTN_ENABLED; + } else { + gSaveContext.button_status[0] = gSaveContext.button_status[1] = gSaveContext.button_status[2] = + gSaveContext.button_status[3] = BTN_ENABLED; func_80083108(globalCtx); } } @@ -1396,8 +1306,7 @@ s16 sAmmoRefillCounts[] = { 5, 10, 20, 30, 5, 10, 30, 0, 5, 20, 1, 5, 20, 50, 20 #ifdef NON_MATCHING // regalloc, minor ordering and stack usage differences -u8 Item_Give(GlobalContext* globalCtx, u8 item) -{ +u8 Item_Give(GlobalContext* globalCtx, u8 item) { s16 i; s16 slot; s16 oldItem; @@ -1413,8 +1322,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) osSyncPrintf("item_get_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.items[slot]); osSyncPrintf(VT_RST); - if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) - { + if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) { gSaveContext.quest_items |= gBitFlags[item - ITEM_MEDALLION_FOREST]; osSyncPrintf(VT_FGCOL(YELLOW)); @@ -1426,23 +1334,19 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) func_8006D0AC(globalCtx); return ITEM_NONE; - } - else if ((item >= ITEM_SONG_MINUET) && (item <= ITEM_SONG_STORMS)) - { + } else if ((item >= ITEM_SONG_MINUET) && (item <= ITEM_SONG_STORMS)) { gSaveContext.quest_items |= gBitFlags[item - ITEM_SONG_MINUET + 6]; osSyncPrintf(VT_FGCOL(YELLOW)); // Translates to: "Musical scores = %x" osSyncPrintf("楽譜 = %x\n", gSaveContext.quest_items); // Translates to: "Musical scores = %x (%x) (%x)" - osSyncPrintf("楽譜 = %x (%x) (%x)\n", gSaveContext.quest_items, - gBitFlags[item - ITEM_SONG_MINUET + 6], gBitFlags[item - ITEM_SONG_MINUET]); + osSyncPrintf("楽譜 = %x (%x) (%x)\n", gSaveContext.quest_items, gBitFlags[item - ITEM_SONG_MINUET + 6], + gBitFlags[item - ITEM_SONG_MINUET]); osSyncPrintf(VT_RST); return ITEM_NONE; - } - else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_ZORA_SAPPHIRE)) - { + } else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_ZORA_SAPPHIRE)) { gSaveContext.quest_items |= gBitFlags[item - ITEM_KOKIRI_EMERALD + 18]; osSyncPrintf(VT_FGCOL(YELLOW)); @@ -1451,9 +1355,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) osSyncPrintf(VT_RST); return ITEM_NONE; - } - else if ((item == ITEM_STONE_OF_AGONY) || (item == ITEM_GERUDO_CARD)) - { + } else if ((item == ITEM_STONE_OF_AGONY) || (item == ITEM_GERUDO_CARD)) { gSaveContext.quest_items |= gBitFlags[item - ITEM_STONE_OF_AGONY + 21]; osSyncPrintf(VT_FGCOL(YELLOW)); @@ -1462,9 +1364,7 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) osSyncPrintf(VT_RST); return ITEM_NONE; - } - else if (item == ITEM_SKULL_TOKEN) - { + } else if (item == ITEM_SKULL_TOKEN) { gSaveContext.quest_items |= gBitFlags[item - ITEM_SKULL_TOKEN + 23]; gSaveContext.gs_tokens++; @@ -1474,27 +1374,20 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) osSyncPrintf(VT_RST); return ITEM_NONE; - } - else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) - { + } else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) { gSaveContext.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]; - if (item == ITEM_SWORD_BGS) - { + if (item == ITEM_SWORD_BGS) { gSaveContext.bgs_hits_left = 8; - if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) - { + if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) { gSaveContext.equipment ^= 8 << gEquipShifts[EQUIP_SWORD]; - if (gSaveContext.equips.button_items[0] == ITEM_SWORD_KNIFE) - { + if (gSaveContext.equips.button_items[0] == ITEM_SWORD_KNIFE) { gSaveContext.equips.button_items[0] = ITEM_SWORD_BGS; Interface_LoadItemIcon1(globalCtx, 0); } } - } - else if (item == ITEM_SWORD_MASTER) - { + } else if (item == ITEM_SWORD_MASTER) { gSaveContext.equips.button_items[0] = ITEM_SWORD_MASTER; gSaveContext.equips.equipment &= 0xFFF0; gSaveContext.equips.equipment |= 0x0002; @@ -1502,251 +1395,168 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) } return ITEM_NONE; - } - else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) - { + } else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) { gSaveContext.equipment |= (gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]); return ITEM_NONE; - } - else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) - { + } else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) { gSaveContext.equipment |= (gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]); return ITEM_NONE; - } - else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) - { + } else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) { gSaveContext.equipment |= (gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]); return ITEM_NONE; - } - else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) - { + } else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) { gSaveContext.dungeon_items[gSaveContext.dungeon_index] |= gBitFlags[item - ITEM_KEY_BOSS]; return ITEM_NONE; - } - else if (item == ITEM_KEY_SMALL) - { - if (gSaveContext.dungeon_keys[gSaveContext.dungeon_index] < 0) - { + } else if (item == ITEM_KEY_SMALL) { + if (gSaveContext.dungeon_keys[gSaveContext.dungeon_index] < 0) { gSaveContext.dungeon_keys[gSaveContext.dungeon_index] = 1; return ITEM_NONE; - } - else - { + } else { gSaveContext.dungeon_keys[gSaveContext.dungeon_index]++; return ITEM_NONE; } - } - else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) - { - if (CUR_UPG_VALUE(UPG_QUIVER) == 0) - { + } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { + if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { Inventory_ChangeUpgrade(UPG_QUIVER, 1); INV_CONTENT(ITEM_BOW) = ITEM_BOW; AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 1); return ITEM_NONE; - } - else - { + } else { AMMO(ITEM_BOW)++; if (AMMO(ITEM_BOW) > CUR_CAPACITY(UPG_QUIVER)) AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER); } - } - else if (item == ITEM_QUIVER_40) - { + } else if (item == ITEM_QUIVER_40) { Inventory_ChangeUpgrade(UPG_QUIVER, 2); AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 2); return ITEM_NONE; - } - else if (item == ITEM_QUIVER_50) - { + } else if (item == ITEM_QUIVER_50) { Inventory_ChangeUpgrade(UPG_QUIVER, 3); AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 3); return ITEM_NONE; - } - else if (item == ITEM_BULLET_BAG_40) - { + } else if (item == ITEM_BULLET_BAG_40) { Inventory_ChangeUpgrade(UPG_BULLET_BAG, 2); AMMO(ITEM_SLINGSHOT) = CAPACITY(UPG_BULLET_BAG, 2); return ITEM_NONE; - } - else if (item == ITEM_BULLET_BAG_50) - { + } else if (item == ITEM_BULLET_BAG_50) { Inventory_ChangeUpgrade(UPG_BULLET_BAG, 3); AMMO(ITEM_SLINGSHOT) = CAPACITY(UPG_BULLET_BAG, 3); return ITEM_NONE; - } - else if (item == ITEM_BOMB_BAG_20) - { - if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) - { + } else if (item == ITEM_BOMB_BAG_20) { + if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { Inventory_ChangeUpgrade(UPG_BOMB_BAG, 1); INV_CONTENT(ITEM_BOMB) = ITEM_BOMB; AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 1); return ITEM_NONE; - } - else - { + } else { AMMO(ITEM_BOMB)++; if (AMMO(ITEM_BOMB) > CUR_CAPACITY(UPG_BOMB_BAG)) AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); } - } - else if (item == ITEM_BOMB_BAG_30) - { + } else if (item == ITEM_BOMB_BAG_30) { Inventory_ChangeUpgrade(UPG_BOMB_BAG, 2); AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 2); return ITEM_NONE; - } - else if (item == ITEM_BOMB_BAG_40) - { + } else if (item == ITEM_BOMB_BAG_40) { Inventory_ChangeUpgrade(UPG_BOMB_BAG, 3); AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 3); return ITEM_NONE; - } - else if (item == ITEM_BRACELET) - { + } else if (item == ITEM_BRACELET) { Inventory_ChangeUpgrade(UPG_STRENGTH, 1); return ITEM_NONE; - } - else if (item == ITEM_GAUNTLETS_SILVER) - { + } else if (item == ITEM_GAUNTLETS_SILVER) { Inventory_ChangeUpgrade(UPG_STRENGTH, 2); return ITEM_NONE; - } - else if (item == ITEM_GAUNTLETS_GOLD) - { + } else if (item == ITEM_GAUNTLETS_GOLD) { Inventory_ChangeUpgrade(UPG_STRENGTH, 3); return ITEM_NONE; - } - else if (item == ITEM_SCALE_SILVER) - { + } else if (item == ITEM_SCALE_SILVER) { Inventory_ChangeUpgrade(UPG_SCALE, 1); return ITEM_NONE; - } - else if (item == ITEM_SCALE_GOLDEN) - { + } else if (item == ITEM_SCALE_GOLDEN) { Inventory_ChangeUpgrade(UPG_SCALE, 2); return ITEM_NONE; - } - else if (item == ITEM_WALLET_ADULT) - { + } else if (item == ITEM_WALLET_ADULT) { Inventory_ChangeUpgrade(UPG_WALLET, 1); return ITEM_NONE; - } - else if (item == ITEM_WALLET_GIANT) - { + } else if (item == ITEM_WALLET_GIANT) { Inventory_ChangeUpgrade(UPG_WALLET, 2); return ITEM_NONE; - } - else if (item == ITEM_STICK_UPGRADE_20) - { + } else if (item == ITEM_STICK_UPGRADE_20) { if (gSaveContext.items[slot] == ITEM_NONE) INV_CONTENT(ITEM_STICK) = ITEM_STICK; Inventory_ChangeUpgrade(UPG_STICKS, 2); AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 2); return ITEM_NONE; - } - else if (item == ITEM_STICK_UPGRADE_30) - { + } else if (item == ITEM_STICK_UPGRADE_30) { if (gSaveContext.items[slot] == ITEM_NONE) INV_CONTENT(ITEM_STICK) = ITEM_STICK; Inventory_ChangeUpgrade(UPG_STICKS, 3); AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 3); return ITEM_NONE; - } - else if (item == ITEM_NUT_UPGRADE_30) - { + } else if (item == ITEM_NUT_UPGRADE_30) { if (gSaveContext.items[slot] == ITEM_NONE) INV_CONTENT(ITEM_NUT) = ITEM_NUT; Inventory_ChangeUpgrade(UPG_NUTS, 2); AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 2); return ITEM_NONE; - } - else if (item == ITEM_NUT_UPGRADE_40) - { + } else if (item == ITEM_NUT_UPGRADE_40) { if (gSaveContext.items[slot] == ITEM_NONE) INV_CONTENT(ITEM_NUT) = ITEM_NUT; Inventory_ChangeUpgrade(UPG_NUTS, 3); AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 3); return ITEM_NONE; - } - else if (item == ITEM_LONGSHOT) - { + } else if (item == ITEM_LONGSHOT) { INV_CONTENT(item) = item; - for (i = 1; i < 4; i++) - { - if (gSaveContext.equips.button_items[i] == ITEM_HOOKSHOT) - { + for (i = 1; i < 4; i++) { + if (gSaveContext.equips.button_items[i] == ITEM_HOOKSHOT) { gSaveContext.equips.button_items[i] = ITEM_LONGSHOT; Interface_LoadItemIcon1(globalCtx, i); } } return ITEM_NONE; - } - else if (item == ITEM_STICK) - { - if (gSaveContext.items[slot] == ITEM_NONE) - { + } else if (item == ITEM_STICK) { + if (gSaveContext.items[slot] == ITEM_NONE) { Inventory_ChangeUpgrade(UPG_STICKS, 1); AMMO(ITEM_STICK) = 1; - } - else - { + } else { AMMO(ITEM_STICK)++; if (AMMO(ITEM_STICK) > CUR_CAPACITY(UPG_STICKS)) AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); } - } - else if ((item == ITEM_STICKS_5) || (item == ITEM_STICKS_10)) - { - if (gSaveContext.items[slot] == ITEM_NONE) - { + } else if ((item == ITEM_STICKS_5) || (item == ITEM_STICKS_10)) { + if (gSaveContext.items[slot] == ITEM_NONE) { Inventory_ChangeUpgrade(UPG_STICKS, 1); AMMO(ITEM_STICK) = sAmmoRefillCounts[item - ITEM_STICKS_5]; - } - else - { + } else { AMMO(ITEM_STICK) += sAmmoRefillCounts[item - ITEM_STICKS_5]; if (AMMO(ITEM_STICK) > CUR_CAPACITY(UPG_STICKS)) AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); } item = ITEM_STICK; - } - else if (item == ITEM_NUT) - { - if (gSaveContext.items[slot] == ITEM_NONE) - { + } else if (item == ITEM_NUT) { + if (gSaveContext.items[slot] == ITEM_NONE) { Inventory_ChangeUpgrade(UPG_NUTS, 1); AMMO(ITEM_NUT) = ITEM_NUT; - } - else - { + } else { AMMO(ITEM_NUT)++; if (AMMO(ITEM_NUT) > CUR_CAPACITY(UPG_NUTS)) AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); } - } - else if ((item == ITEM_NUTS_5) || (item == ITEM_NUTS_10)) - { - if (gSaveContext.items[slot] == ITEM_NONE) - { + } else if ((item == ITEM_NUTS_5) || (item == ITEM_NUTS_10)) { + if (gSaveContext.items[slot] == ITEM_NONE) { Inventory_ChangeUpgrade(UPG_NUTS, 1); AMMO(ITEM_NUT) += sAmmoRefillCounts[item - ITEM_NUTS_5]; // Translates to: "Deku Nuts %d(%d)=%d BS_count=%d" - osSyncPrintf("デクの実 %d(%d)=%d BS_count=%d\n", - item, ITEM_NUTS_5, item - ITEM_NUTS_5, sAmmoRefillCounts[item - ITEM_NUTS_5]); - } - else - { + osSyncPrintf("デクの実 %d(%d)=%d BS_count=%d\n", item, ITEM_NUTS_5, item - ITEM_NUTS_5, + sAmmoRefillCounts[item - ITEM_NUTS_5]); + } else { AMMO(ITEM_NUT) += sAmmoRefillCounts[item - ITEM_NUTS_5]; if (AMMO(ITEM_NUT) > CUR_CAPACITY(UPG_NUTS)) AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); } item = ITEM_NUT; - } - else if (item == ITEM_BOMB) - { + } else if (item == ITEM_BOMB) { // Translates to: "Bomb Bomb Bomb Bomb Bomb Bomb Bomb" osSyncPrintf(" 爆弾 爆弾 爆弾 爆弾 爆弾 爆弾 爆弾 \n"); bombCount = AMMO(ITEM_BOMB) + 1; @@ -1754,49 +1564,35 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) if (bombCount > CUR_CAPACITY(UPG_BOMB_BAG)) AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); return ITEM_NONE; - } - else if ((item >= ITEM_BOMBS_5) && (item <= ITEM_BOMBS_30)) - { + } else if ((item >= ITEM_BOMBS_5) && (item <= ITEM_BOMBS_30)) { bombCount = AMMO(ITEM_BOMB) + sAmmoRefillCounts[item - ITEM_BOMBS_5]; AMMO(ITEM_BOMB) = bombCount; if (bombCount > CUR_CAPACITY(UPG_BOMB_BAG)) AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); return ITEM_NONE; - } - else if (item == ITEM_BOMBCHU) - { - if (gSaveContext.items[slot] == ITEM_NONE) - { + } else if (item == ITEM_BOMBCHU) { + if (gSaveContext.items[slot] == ITEM_NONE) { INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; AMMO(ITEM_BOMBCHU) = 10; return ITEM_NONE; - } - else - { + } else { AMMO(ITEM_BOMBCHU) += 10; if (AMMO(ITEM_BOMBCHU) > 50) AMMO(ITEM_BOMBCHU) = 50; return ITEM_NONE; } - } - else if ((item == ITEM_BOMBCHUS_5) || (item == ITEM_BOMBCHUS_20)) - { - if (gSaveContext.items[slot] == ITEM_NONE) - { + } else if ((item == ITEM_BOMBCHUS_5) || (item == ITEM_BOMBCHUS_20)) { + if (gSaveContext.items[slot] == ITEM_NONE) { INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; AMMO(ITEM_BOMBCHU) += sAmmoRefillCounts[item - ITEM_BOMBCHUS_5 + 8]; return ITEM_NONE; - } - else - { + } else { AMMO(ITEM_BOMBCHU) += sAmmoRefillCounts[item - ITEM_BOMBCHUS_5 + 8]; if (AMMO(ITEM_BOMBCHU) > 50) AMMO(ITEM_BOMBCHU) = 50; return ITEM_NONE; } - } - else if ((item >= ITEM_ARROWS_SMALL) && (item <= ITEM_ARROWS_LARGE)) - { + } else if ((item >= ITEM_ARROWS_SMALL) && (item <= ITEM_ARROWS_LARGE)) { AMMO(ITEM_BOW) += sAmmoRefillCounts[item - ITEM_ARROWS_SMALL + 4]; if ((AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) || (AMMO(ITEM_BOW) < 0)) @@ -1805,178 +1601,128 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) osSyncPrintf("%d本 Item_MaxGet=%d\n", AMMO(ITEM_BOW), CUR_CAPACITY(UPG_QUIVER)); return ITEM_BOW; - } - else if (item == ITEM_SLINGSHOT) - { + } else if (item == ITEM_SLINGSHOT) { Inventory_ChangeUpgrade(UPG_BULLET_BAG, 1); INV_CONTENT(ITEM_SLINGSHOT) = ITEM_SLINGSHOT; AMMO(ITEM_SLINGSHOT) = 30; return ITEM_NONE; - } - else if (item == ITEM_SEEDS) - { + } else if (item == ITEM_SEEDS) { AMMO(ITEM_SLINGSHOT) += 5; if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG); - if (!(gSaveContext.item_get_inf[1] & 8)) - { + if (!(gSaveContext.item_get_inf[1] & 8)) { gSaveContext.item_get_inf[1] |= 8; return ITEM_NONE; } return ITEM_SEEDS; - } - else if (item == ITEM_SEEDS_30) - { + } else if (item == ITEM_SEEDS_30) { AMMO(ITEM_SLINGSHOT) += 30; if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG); - if (!(gSaveContext.item_get_inf[1] & 8)) - { + if (!(gSaveContext.item_get_inf[1] & 8)) { gSaveContext.item_get_inf[1] |= 8; return ITEM_NONE; } return ITEM_SEEDS; - } - else if (item == ITEM_OCARINA_FAIRY) - { + } else if (item == ITEM_OCARINA_FAIRY) { INV_CONTENT(ITEM_OCARINA_FAIRY) = ITEM_OCARINA_FAIRY; return ITEM_NONE; - } - else if (item == ITEM_OCARINA_TIME) - { + } else if (item == ITEM_OCARINA_TIME) { INV_CONTENT(ITEM_OCARINA_TIME) = ITEM_OCARINA_TIME; - for (i = 1; i < 4; i++) - { - if (gSaveContext.equips.button_items[i] == ITEM_OCARINA_FAIRY) - { + for (i = 1; i < 4; i++) { + if (gSaveContext.equips.button_items[i] == ITEM_OCARINA_FAIRY) { gSaveContext.equips.button_items[i] = ITEM_OCARINA_TIME; Interface_LoadItemIcon1(globalCtx, i); } } return ITEM_NONE; - } - else if (item == ITEM_BEAN) - { - if (gSaveContext.items[slot] == ITEM_NONE) - { + } else if (item == ITEM_BEAN) { + if (gSaveContext.items[slot] == ITEM_NONE) { INV_CONTENT(item) = item; AMMO(ITEM_BEAN) = 1; BEANS_BOUGHT = 1; - } - else - { + } else { AMMO(ITEM_BEAN)++; BEANS_BOUGHT++; } return ITEM_NONE; - } - else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) - { + } else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) { gSaveContext.quest_items += 0x10000000; return ITEM_NONE; - } - else if (item == ITEM_HEART_CONTAINER) - { + } else if (item == ITEM_HEART_CONTAINER) { gSaveContext.health_capacity += 0x10; gSaveContext.health += 0x10; return ITEM_NONE; - } - else if (item == ITEM_HEART) - { + } else if (item == ITEM_HEART) { // Translates to: "Recovery Heart" osSyncPrintf("回復ハート回復ハート回復ハート\n"); Health_ChangeBy(globalCtx, 0x10); return item; - } - else if (item == ITEM_MAGIC_SMALL) - { + } else if (item == ITEM_MAGIC_SMALL) { if (gSaveContext.unk_13F0 != 10) func_80087680(globalCtx); func_80087708(globalCtx, 12, 5); - if (!(gSaveContext.inf_table[25] & 0x100)) - { + if (!(gSaveContext.inf_table[25] & 0x100)) { gSaveContext.inf_table[25] |= 0x100; return ITEM_NONE; } return item; - } - else if (item == ITEM_MAGIC_LARGE) - { + } else if (item == ITEM_MAGIC_LARGE) { if (gSaveContext.unk_13F0 != 10) func_80087680(globalCtx); func_80087708(globalCtx, 24, 5); - if (!(gSaveContext.inf_table[25] & 0x100)) - { + if (!(gSaveContext.inf_table[25] & 0x100)) { gSaveContext.inf_table[25] |= 0x100; return ITEM_NONE; } return item; - } - else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_INVALID_8)) - { + } else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_INVALID_8)) { Rupees_ChangeBy(sAmmoRefillCounts[item - ITEM_RUPEE_GREEN + 10]); return ITEM_NONE; - } - else if (item == ITEM_BOTTLE) - { - for (i = 0; i < 4; i++) - { - if (gSaveContext.items[SLOT(item) + i] == ITEM_NONE) - { + } else if (item == ITEM_BOTTLE) { + for (i = 0; i < 4; i++) { + if (gSaveContext.items[SLOT(item) + i] == ITEM_NONE) { gSaveContext.items[SLOT(item) + i] = item; return ITEM_NONE; } } - } - else if (((item >= ITEM_POTION_RED) && (item <= ITEM_POE)) || (item == ITEM_MILK)) - { + } else if (((item >= ITEM_POTION_RED) && (item <= ITEM_POE)) || (item == ITEM_MILK)) { bottleSlot = SLOT(item); - if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_LETTER_RUTO)) - { - if (item == ITEM_MILK) - { + if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_LETTER_RUTO)) { + if (item == ITEM_MILK) { item = ITEM_MILK_BOTTLE; bottleSlot = SLOT(item); } - for (i = 0; i < 4; i++) - { - if (gSaveContext.items[bottleSlot + i] == ITEM_BOTTLE) - { + for (i = 0; i < 4; i++) { + if (gSaveContext.items[bottleSlot + i] == ITEM_BOTTLE) { // Translates to: "Item_Pt(1)=%d Item_Pt(2)=%d Item_Pt(3)=%d Empty Bottle=%d Content=%d" osSyncPrintf("Item_Pt(1)=%d Item_Pt(2)=%d Item_Pt(3)=%d 空瓶=%d 中味=%d\n", - gSaveContext.equips.c_button_slots[0], - gSaveContext.equips.c_button_slots[1], - gSaveContext.equips.c_button_slots[2], - bottleSlot + i, item); + gSaveContext.equips.c_button_slots[0], gSaveContext.equips.c_button_slots[1], + gSaveContext.equips.c_button_slots[2], bottleSlot + i, item); - if ((bottleSlot + i) == gSaveContext.equips.c_button_slots[0]) - { + if ((bottleSlot + i) == gSaveContext.equips.c_button_slots[0]) { gSaveContext.equips.button_items[1] = item; Interface_LoadItemIcon2(globalCtx, 1); gSaveContext.button_status[1] = BTN_ENABLED; - } - else if ((bottleSlot + i) == gSaveContext.equips.c_button_slots[1]) - { + } else if ((bottleSlot + i) == gSaveContext.equips.c_button_slots[1]) { gSaveContext.equips.button_items[2] = item; Interface_LoadItemIcon2(globalCtx, 2); gSaveContext.button_status[2] = BTN_ENABLED; - } - else if ((bottleSlot + i) == gSaveContext.equips.c_button_slots[2]) - { + } else if ((bottleSlot + i) == gSaveContext.equips.c_button_slots[2]) { gSaveContext.equips.button_items[3] = item; Interface_LoadItemIcon1(globalCtx, 3); gSaveContext.button_status[3] = BTN_ENABLED; @@ -1986,40 +1732,28 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) return ITEM_NONE; } } - } - else - { - for (i = 0; i < 4; i++) - { - if (gSaveContext.items[bottleSlot + i] == ITEM_NONE) - { + } else { + for (i = 0; i < 4; i++) { + if (gSaveContext.items[bottleSlot + i] == ITEM_NONE) { gSaveContext.items[bottleSlot + i] = item; return ITEM_NONE; } } } - } - else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) - { + } else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) { if (item == ITEM_SAW) gSaveContext.item_get_inf[1] |= 0x8000; prevTradeItem = INV_CONTENT(item); INV_CONTENT(item) = item; - if (prevTradeItem != ITEM_NONE) - { - for (i = 1; i < 4; i++) - { - if (prevTradeItem == gSaveContext.equips.button_items[i]) - { - if (item != ITEM_SOLD_OUT) - { + if (prevTradeItem != ITEM_NONE) { + for (i = 1; i < 4; i++) { + if (prevTradeItem == gSaveContext.equips.button_items[i]) { + if (item != ITEM_SOLD_OUT) { gSaveContext.equips.button_items[i] = item; Interface_LoadItemIcon1(globalCtx, i); - } - else - { + } else { gSaveContext.equips.button_items[i] = ITEM_NONE; } return ITEM_NONE; @@ -2040,222 +1774,166 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Item_Give.s") #endif -u8 Item_CheckObtainability(u8 item) -{ +u8 Item_CheckObtainability(u8 item) { s16 i; s16 slot; s32 bottleSlot; slot = SLOT(item); - if (item >= ITEM_STICKS_5) + if (item >= ITEM_STICKS_5) { slot = SLOT(sExtraItemBases[item - ITEM_STICKS_5]); + } osSyncPrintf(VT_FGCOL(GREEN)); osSyncPrintf("item_get_non_setting=%d pt=%d z=%x\n", item, slot, gSaveContext.items[slot]); osSyncPrintf(VT_RST); - if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) - { + if ((item >= ITEM_MEDALLION_FOREST) && (item <= ITEM_MEDALLION_LIGHT)) { return ITEM_NONE; - } - else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_SKULL_TOKEN)) - { + } else if ((item >= ITEM_KOKIRI_EMERALD) && (item <= ITEM_SKULL_TOKEN)) { return ITEM_NONE; - } - else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) - { - if (item == ITEM_SWORD_BGS) + } else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) { + if (item == ITEM_SWORD_BGS) { return ITEM_NONE; - else if ((gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]) & gSaveContext.equipment) + } else if ((gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]) & gSaveContext.equipment) { return item; - else + } else { return ITEM_NONE; - } - else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) - { - if ((gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) & gSaveContext.equipment) + } + } else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) { + if ((gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) & gSaveContext.equipment) { return item; - else + } else { return ITEM_NONE; - } - else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) - { - if ((gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]) & gSaveContext.equipment) + } + } else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) { + if ((gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]) & gSaveContext.equipment) { return item; - else + } else { return ITEM_NONE; - } - else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) - { - if ((gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) & gSaveContext.equipment) + } + } else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) { + if ((gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) & gSaveContext.equipment) { return item; - else + } else { return ITEM_NONE; - } - else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) - { + } + } else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) { return ITEM_NONE; - } - else if (item == ITEM_KEY_SMALL) - { + } else if (item == ITEM_KEY_SMALL) { return ITEM_NONE; - } - else if ((item >= ITEM_SLINGSHOT) && (item <= ITEM_BOMBCHU)) - { + } else if ((item >= ITEM_SLINGSHOT) && (item <= ITEM_BOMBCHU)) { return ITEM_NONE; - } - else if ((item == ITEM_BOMBCHUS_5) || (item == ITEM_BOMBCHUS_20)) - { + } else if ((item == ITEM_BOMBCHUS_5) || (item == ITEM_BOMBCHUS_20)) { return ITEM_NONE; - } - else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) - { - if (CUR_UPG_VALUE(UPG_QUIVER) == 0) + } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { + if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { return ITEM_NONE; - else + } else { return 0; - } - else if ((item == ITEM_QUIVER_40) || (item == ITEM_QUIVER_50)) - { + } + } else if ((item == ITEM_QUIVER_40) || (item == ITEM_QUIVER_50)) { return ITEM_NONE; - } - else if ((item == ITEM_BULLET_BAG_40) || (item == ITEM_BULLET_BAG_50)) - { + } else if ((item == ITEM_BULLET_BAG_40) || (item == ITEM_BULLET_BAG_50)) { return ITEM_NONE; - } - else if ((item == ITEM_BOMB_BAG_20) || (item == ITEM_BOMB)) - { - if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) + } else if ((item == ITEM_BOMB_BAG_20) || (item == ITEM_BOMB)) { + if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { return ITEM_NONE; - else + } else { return 0; - } - else if ((item >= ITEM_STICK_UPGRADE_20) && (item <= ITEM_NUT_UPGRADE_40)) - { + } + } else if ((item >= ITEM_STICK_UPGRADE_20) && (item <= ITEM_NUT_UPGRADE_40)) { return ITEM_NONE; - } - else if ((item >= ITEM_BOMB_BAG_30) && (item <= ITEM_WALLET_GIANT)) - { + } else if ((item >= ITEM_BOMB_BAG_30) && (item <= ITEM_WALLET_GIANT)) { return ITEM_NONE; - } - else if (item == ITEM_LONGSHOT) - { + } else if (item == ITEM_LONGSHOT) { return ITEM_NONE; - } - else if ((item == ITEM_SEEDS) || (item == ITEM_SEEDS_30)) - { - if (!(gSaveContext.item_get_inf[1] & 0x8)) + } else if ((item == ITEM_SEEDS) || (item == ITEM_SEEDS_30)) { + if (!(gSaveContext.item_get_inf[1] & 0x8)) { return ITEM_NONE; - else + } else { return ITEM_SEEDS; - } - else if (item == ITEM_BEAN) - { + } + } else if (item == ITEM_BEAN) { return ITEM_NONE; - } - else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) - { + } else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) { return ITEM_NONE; - } - else if (item == ITEM_HEART_CONTAINER) - { + } else if (item == ITEM_HEART_CONTAINER) { return ITEM_NONE; - } - else if (item == ITEM_HEART) - { + } else if (item == ITEM_HEART) { return ITEM_HEART; - } - else if ((item == ITEM_MAGIC_SMALL) || (item == ITEM_MAGIC_LARGE)) - { + } else if ((item == ITEM_MAGIC_SMALL) || (item == ITEM_MAGIC_LARGE)) { // Translates to: "Magic Pot Get_Inf_Table( 25, 0x0100)=%d" osSyncPrintf("魔法の壷 Get_Inf_Table( 25, 0x0100)=%d\n", gSaveContext.inf_table[25] & 0x100); - if (!(gSaveContext.inf_table[25] & 0x100)) + if (!(gSaveContext.inf_table[25] & 0x100)) { return ITEM_NONE; - else + } else { return item; - } - else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_INVALID_8)) - { + } + } else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_INVALID_8)) { return ITEM_NONE; - } - else if (item == ITEM_BOTTLE) - { + } else if (item == ITEM_BOTTLE) { return ITEM_NONE; - } - else if (((item >= ITEM_POTION_RED) && (item <= ITEM_POE)) || (item == ITEM_MILK)) - { + } else if (((item >= ITEM_POTION_RED) && (item <= ITEM_POE)) || (item == ITEM_MILK)) { bottleSlot = SLOT(item); - if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_LETTER_RUTO)) - { - if (item == ITEM_MILK) - { + if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_LETTER_RUTO)) { + if (item == ITEM_MILK) { item = ITEM_MILK_BOTTLE; bottleSlot = SLOT(item); } - for (i = 0; i < 4; i++) - { - if (gSaveContext.items[bottleSlot + i] == ITEM_BOTTLE) + for (i = 0; i < 4; i++) { + if (gSaveContext.items[bottleSlot + i] == ITEM_BOTTLE) { return ITEM_NONE; + } + } + } else { + for (i = 0; i < 4; i++) { + if (gSaveContext.items[bottleSlot + i] == ITEM_NONE) { + return ITEM_NONE; + } } } - else - { - for (i = 0; i < 4; i++) - { - if (gSaveContext.items[bottleSlot + i] == ITEM_NONE) - return ITEM_NONE; - } - } - } - else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) - { + } else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) { return ITEM_NONE; } return gSaveContext.items[slot]; } -void Inventory_DeleteItem(u16 item, u16 invSlot) -{ +void Inventory_DeleteItem(u16 item, u16 invSlot) { s16 i; - if (item == ITEM_BEAN) + if (item == ITEM_BEAN) { BEANS_BOUGHT = 0; // Beans bought + } gSaveContext.items[invSlot] = ITEM_NONE; osSyncPrintf("\nItem_Register(%d)\n", invSlot, gSaveContext.items[invSlot]); - for (i = 1; i < 4; i++) - { - if (gSaveContext.equips.button_items[i] == item) - { + for (i = 1; i < 4; i++) { + if (gSaveContext.equips.button_items[i] == item) { gSaveContext.equips.button_items[i] = ITEM_NONE; - gSaveContext.equips.c_button_slots[i-1] = SLOT_NONE; + gSaveContext.equips.c_button_slots[i - 1] = SLOT_NONE; } } } #ifdef NON_MATCHING // regalloc differences -s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) -{ +s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) { s16 i; s16 j; - for (i = 0; i < ARRAY_COUNT(gSaveContext.items); i++) - { - if (gSaveContext.items[i] == oldItem) - { + for (i = 0; i < ARRAY_COUNT(gSaveContext.items); i++) { + if (gSaveContext.items[i] == oldItem) { gSaveContext.items[i] = newItem; // Translates to: "Item Purge (%d)" osSyncPrintf("アイテム消去(%d)", i); - for (j = 1; j < 4; j++) - { - if (gSaveContext.equips.button_items[j] == oldItem) - { + for (j = 1; j < 4; j++) { + if (gSaveContext.equips.button_items[j] == oldItem) { gSaveContext.equips.button_items[j] = newItem; Interface_LoadItemIcon1(globalCtx, j); break; @@ -2271,54 +1949,54 @@ s32 Inventory_ReplaceItem(GlobalContext* globalCtx, u16 oldItem, u16 newItem) #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Inventory_ReplaceItem.s") #endif -s32 Inventory_HasEmptyBottle(void) -{ +s32 Inventory_HasEmptyBottle(void) { u8* items = gSaveContext.items; - if (items[SLOT_BOTTLE_1] == ITEM_BOTTLE) + if (items[SLOT_BOTTLE_1] == ITEM_BOTTLE) { return 1; - else if (items[SLOT_BOTTLE_2] == ITEM_BOTTLE) + } else if (items[SLOT_BOTTLE_2] == ITEM_BOTTLE) { return 1; - else if (items[SLOT_BOTTLE_3] == ITEM_BOTTLE) + } else if (items[SLOT_BOTTLE_3] == ITEM_BOTTLE) { return 1; - else if (items[SLOT_BOTTLE_4] == ITEM_BOTTLE) + } else if (items[SLOT_BOTTLE_4] == ITEM_BOTTLE) { return 1; - else + } else { return 0; + } } -s32 Inventory_HasSpecificBottle(u8 bottleItem) -{ +s32 Inventory_HasSpecificBottle(u8 bottleItem) { u8* items = gSaveContext.items; - if (items[SLOT_BOTTLE_1] == bottleItem) + if (items[SLOT_BOTTLE_1] == bottleItem) { return 1; - else if (items[SLOT_BOTTLE_2] == bottleItem) + } else if (items[SLOT_BOTTLE_2] == bottleItem) { return 1; - else if (items[SLOT_BOTTLE_3] == bottleItem) + } else if (items[SLOT_BOTTLE_3] == bottleItem) { return 1; - else if (items[SLOT_BOTTLE_4] == bottleItem) + } else if (items[SLOT_BOTTLE_4] == bottleItem) { return 1; - else + } else { return 0; + } } #ifdef NON_MATCHING // save context pointer isn't reused after Interface_LoadItemIcon1 when it should be -void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton) -{ - osSyncPrintf("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", - item, cButton, gSaveContext.equips.c_button_slots[cButton-1], - gSaveContext.items[gSaveContext.equips.c_button_slots[cButton-1]]); +void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton) { + osSyncPrintf("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", item, cButton, + gSaveContext.equips.c_button_slots[cButton - 1], + gSaveContext.items[gSaveContext.equips.c_button_slots[cButton - 1]]); // Special case to only empty half of a Lon Lon Milk Bottle - if ((gSaveContext.items[gSaveContext.equips.c_button_slots[cButton-1]] == ITEM_MILK_BOTTLE) && (item == ITEM_BOTTLE)) + if ((gSaveContext.items[gSaveContext.equips.c_button_slots[cButton - 1]] == ITEM_MILK_BOTTLE) && + (item == ITEM_BOTTLE)) item = ITEM_MILK_HALF; - gSaveContext.items[gSaveContext.equips.c_button_slots[cButton-1]] = item; + gSaveContext.items[gSaveContext.equips.c_button_slots[cButton - 1]] = item; gSaveContext.equips.button_items[cButton] = item; - if (1) ; // Improves codegen but may not be necessary + if (1) {} // Improves codegen but may not be necessary Interface_LoadItemIcon1(globalCtx, cButton); @@ -2331,25 +2009,20 @@ void Inventory_UpdateBottleItem(GlobalContext* globalCtx, u8 item, u8 cButton) #ifdef NON_MATCHING // mostly regalloc, minor ordering, and stack usage differences -s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) -{ +s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) { s32 bottleSlot; s16 i; s16 j; bottleSlot = SLOT(ITEM_FAIRY); - for (i = 0; i < 4; i++) - { - if (gSaveContext.items[bottleSlot + i] == ITEM_FAIRY) - { - for (j = 1; j < 4; j++) - { - if (gSaveContext.equips.button_items[j] == ITEM_FAIRY) - { + for (i = 0; i < 4; i++) { + if (gSaveContext.items[bottleSlot + i] == ITEM_FAIRY) { + for (j = 1; j < 4; j++) { + if (gSaveContext.equips.button_items[j] == ITEM_FAIRY) { gSaveContext.equips.button_items[j] = ITEM_BOTTLE; Interface_LoadItemIcon1(globalCtx, j); - bottleSlot = gSaveContext.equips.c_button_slots[j-1]; + bottleSlot = gSaveContext.equips.c_button_slots[j - 1]; break; } } @@ -2366,12 +2039,10 @@ s32 Inventory_ConsumeFairy(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Inventory_ConsumeFairy.s") #endif -void func_80086D5C(s32* buf, u16 size) -{ +void func_80086D5C(s32* buf, u16 size) { u16 i; - for (i = 0; i < size; i++) - { + for (i = 0; i < size; i++) { buf[i] = 0; } } @@ -2380,8 +2051,7 @@ u32 sDoActionTextures[] = { 0x07000000, 0x07000180 }; #ifdef NON_MATCHING // 0x80000000 is reused in the 2 *_TO_VIRTUAL macros when it shouldn't -void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 arg2) -{ +void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 arg2) { if (action >= 0x1D) action = 0x0A; @@ -2391,16 +2061,13 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 a if (gSaveContext.language == 2) action += 0x1D; - if ((action != 0x0A) && (action != 0x27) && (action != 0x44)) - { + if ((action != 0x0A) && (action != 0x27) && (action != 0x44)) { osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, (u32)interfaceCtx->do_actionSegment + (arg2 * 0x180), - (u32)_do_action_staticSegmentRomStart + (action * 0x180), - 0x180, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2145); + (u32)_do_action_staticSegmentRomStart + (action * 0x180), 0x180, 0, + &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2145); osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); - } - else - { + } else { gSegments[7] = PHYSICAL_TO_VIRTUAL(interfaceCtx->do_actionSegment); func_80086D5C(SEGMENTED_TO_VIRTUAL(sDoActionTextures[arg2]), 0x180 / 4); } @@ -2410,78 +2077,73 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 a #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_LoadActionLabel.s") #endif -void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) -{ +void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; PauseContext* pauseCtx = &globalCtx->pauseCtx; - if (interfaceCtx->unk_1F0 != action) - { + if (interfaceCtx->unk_1F0 != action) { interfaceCtx->unk_1F0 = action; interfaceCtx->unk_1EC = 1; interfaceCtx->unk_1F4 = 0.0f; Interface_LoadActionLabel(interfaceCtx, action, 1); - if (pauseCtx->state != 0) + if (pauseCtx->state != 0) { interfaceCtx->unk_1EC = 3; + } } } -void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) -{ +void Interface_SetNaviCall(GlobalContext* globalCtx, u16 naviCallState) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - if (((naviCallState == 0x1D) || (naviCallState == 0x1E)) && - !interfaceCtx->naviCalling && - (globalCtx->csCtx.state == 0)) - { + if (((naviCallState == 0x1D) || (naviCallState == 0x1E)) && !interfaceCtx->naviCalling && + (globalCtx->csCtx.state == 0)) { // clang-format off // NOLINTNEXTLINE if (naviCallState == 0x1E) Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); // clang-format on - if (naviCallState == 0x1D) + if (naviCallState == 0x1D) { func_800F4524(&D_801333D4, NA_SE_VO_NA_HELLO_2, 32); + } interfaceCtx->naviCalling = 1; sCUpInvisible = 0; sCUpTimer = 10; - } - else if ((naviCallState == 0x1F) && - interfaceCtx->naviCalling) - { + } else if ((naviCallState == 0x1F) && interfaceCtx->naviCalling) { interfaceCtx->naviCalling = 0; } } -void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) -{ +void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - if (gSaveContext.language != 0) + if (gSaveContext.language != 0) { action += 0x1D; + } - if (gSaveContext.language == 2) + if (gSaveContext.language == 2) { action += 0x1D; + } interfaceCtx->unk_1FC = action; osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK); DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, (u32)interfaceCtx->do_actionSegment + 0x180, - (u32)_do_action_staticSegmentRomStart + (action * 0x180), - 0x180, 0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2228); + (u32)_do_action_staticSegmentRomStart + (action * 0x180), 0x180, 0, &interfaceCtx->loadQueue, + NULL, "../z_parameter.c", 2228); osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK); interfaceCtx->unk_1FA = 1; } -s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) -{ +s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) { u16 heartCount; u16 healthLevel; // Translates to: "***** Fluctuation=%d (now=%d, max=%d) ***" - osSyncPrintf("***** 増減=%d (now=%d, max=%d) ***", healthChange, gSaveContext.health, gSaveContext.health_capacity); + osSyncPrintf("***** 増減=%d (now=%d, max=%d) ***", healthChange, gSaveContext.health, + gSaveContext.health_capacity); // clang-format off // NOLINTNEXTLINE @@ -2496,107 +2158,95 @@ s32 Health_ChangeBy(GlobalContext* globalCtx, s16 healthChange) gSaveContext.health += healthChange; - if (gSaveContext.health > gSaveContext.health_capacity) + if (gSaveContext.health > gSaveContext.health_capacity) { gSaveContext.health = gSaveContext.health_capacity; + } heartCount = gSaveContext.health % 0x10; healthLevel = heartCount; - if (heartCount != 0) - { - if (heartCount > 10) + if (heartCount != 0) { + if (heartCount > 10) { healthLevel = 3; - else if (heartCount > 5) + } else if (heartCount > 5) { healthLevel = 2; - else + } else { healthLevel = 1; + } } // Translates to: "Life=%d *** %d ******" osSyncPrintf(" ライフ=%d *** %d ******\n", gSaveContext.health, healthLevel); - if (gSaveContext.health <= 0) - { + if (gSaveContext.health <= 0) { gSaveContext.health = 0; return 0; - } - else - { + } else { return 1; } } -void Health_GiveHearts(s16 hearts) -{ +void Health_GiveHearts(s16 hearts) { gSaveContext.health_capacity += hearts * 0x10; } -void Rupees_ChangeBy(s16 rupeeChange) -{ +void Rupees_ChangeBy(s16 rupeeChange) { gSaveContext.rupee_accumulator += rupeeChange; } -void Inventory_ChangeAmmo(s16 item, s16 ammoChange) -{ +void Inventory_ChangeAmmo(s16 item, s16 ammoChange) { // Translates to: "Item = (%d) Amount = (%d + %d)" osSyncPrintf("アイテム = (%d) 数 = (%d + %d) ", item, AMMO(item), ammoChange); - if (item == ITEM_STICK) - { + if (item == ITEM_STICK) { AMMO(ITEM_STICK) += ammoChange; - if (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) + if (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) { AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); - else if (AMMO(ITEM_STICK) < 0) + } else if (AMMO(ITEM_STICK) < 0) { AMMO(ITEM_STICK) = 0; - } - else if (item == ITEM_NUT) - { + } + } else if (item == ITEM_NUT) { AMMO(ITEM_NUT) += ammoChange; - if (AMMO(ITEM_NUT) >= CUR_CAPACITY(UPG_NUTS)) + if (AMMO(ITEM_NUT) >= CUR_CAPACITY(UPG_NUTS)) { AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); - else if (AMMO(ITEM_NUT) < 0) + } else if (AMMO(ITEM_NUT) < 0) { AMMO(ITEM_NUT) = 0; - } - else if (item == ITEM_BOMBCHU) - { + } + } else if (item == ITEM_BOMBCHU) { AMMO(ITEM_BOMBCHU) += ammoChange; - if (AMMO(ITEM_BOMBCHU) >= 50) + if (AMMO(ITEM_BOMBCHU) >= 50) { AMMO(ITEM_BOMBCHU) = 50; - else if (AMMO(ITEM_BOMBCHU) < 0) + } else if (AMMO(ITEM_BOMBCHU) < 0) { AMMO(ITEM_BOMBCHU) = 0; - } - else if (item == ITEM_BOW) - { + } + } else if (item == ITEM_BOW) { AMMO(ITEM_BOW) += ammoChange; - if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) + if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER); - else if (AMMO(ITEM_BOW) < 0) + } else if (AMMO(ITEM_BOW) < 0) { AMMO(ITEM_BOW) = 0; - } - else if ((item == ITEM_SLINGSHOT) || (item == ITEM_SEEDS)) - { + } + } else if ((item == ITEM_SLINGSHOT) || (item == ITEM_SEEDS)) { AMMO(ITEM_SLINGSHOT) += ammoChange; - if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) + if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) { AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG); - else if (AMMO(ITEM_SLINGSHOT) < 0) + } else if (AMMO(ITEM_SLINGSHOT) < 0) { AMMO(ITEM_SLINGSHOT) = 0; - } - else if (item == ITEM_BOMB) - { + } + } else if (item == ITEM_BOMB) { AMMO(ITEM_BOMB) += ammoChange; - if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) + if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); - else if (AMMO(ITEM_BOMB) < 0) + } else if (AMMO(ITEM_BOMB) < 0) { AMMO(ITEM_BOMB) = 0; - } - else if (item == ITEM_BEAN) - { + } + } else if (item == ITEM_BEAN) { AMMO(ITEM_BEAN) += ammoChange; } @@ -2604,109 +2254,96 @@ void Inventory_ChangeAmmo(s16 item, s16 ammoChange) osSyncPrintf("合計 = (%d)\n", AMMO(item)); } -void func_80087680(GlobalContext* globalCtx) -{ - if (gSaveContext.magic_acquired) - { +void func_80087680(GlobalContext* globalCtx) { + if (gSaveContext.magic_acquired) { gSaveContext.unk_13F2 = gSaveContext.unk_13F0; gSaveContext.unk_13F6 = (gSaveContext.double_magic * 0x30) + 0x30; gSaveContext.unk_13F0 = 9; } } -void func_800876C8(GlobalContext* globalCtx) -{ - if ((gSaveContext.unk_13F0 != 8) && (gSaveContext.unk_13F0 != 9)) - { - if (gSaveContext.unk_13F0 == 10) +void func_800876C8(GlobalContext* globalCtx) { + if ((gSaveContext.unk_13F0 != 8) && (gSaveContext.unk_13F0 != 9)) { + if (gSaveContext.unk_13F0 == 10) { gSaveContext.unk_13F2 = gSaveContext.unk_13F0; + } gSaveContext.unk_13F0 = 5; } } -s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) -{ - if (!gSaveContext.magic_acquired) - return 0; - - if ((arg2 != 5) && (gSaveContext.magic - arg1) < 0) - { - if (gSaveContext.unk_13F4 != 0) - Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); +s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { + if (!gSaveContext.magic_acquired) { return 0; } - switch (arg2) - { + if ((arg2 != 5) && (gSaveContext.magic - arg1) < 0) { + if (gSaveContext.unk_13F4 != 0) { + Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + } + return 0; + } + + switch (arg2) { case 0: case 2: - if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) - { - if (gSaveContext.unk_13F0 == 7) + if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { + if (gSaveContext.unk_13F0 == 7) { globalCtx->actorCtx.unk_03 = 0; + } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 1; return 1; - } - else - { + } else { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); return 0; } case 1: - if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) - { - if (gSaveContext.unk_13F0 == 7) + if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { + if (gSaveContext.unk_13F0 == 7) { globalCtx->actorCtx.unk_03 = 0; + } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 6; return 1; - } - else - { + } else { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); return 0; } case 3: - if (gSaveContext.unk_13F0 == 0) - { - if (gSaveContext.magic != 0) - { + if (gSaveContext.unk_13F0 == 0) { + if (gSaveContext.magic != 0) { globalCtx->interfaceCtx.unk_230 = 80; gSaveContext.unk_13F0 = 7; return 1; + } else { + return 0; } - else - return 0; - } - else - { - if (gSaveContext.unk_13F0 == 7) + } else { + if (gSaveContext.unk_13F0 == 7) { return 1; - else + } else { return 0; + } } case 4: - if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) - { - if (gSaveContext.unk_13F0 == 7) + if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { + if (gSaveContext.unk_13F0 == 7) { globalCtx->actorCtx.unk_03 = 0; + } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 4; return 1; - } - else - { + } else { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); return 0; } case 5: - if (gSaveContext.unk_13F4 >= gSaveContext.magic) - { + if (gSaveContext.unk_13F4 >= gSaveContext.magic) { gSaveContext.unk_13F8 = gSaveContext.magic + arg1; - if (gSaveContext.unk_13F8 >= gSaveContext.unk_13F4) + if (gSaveContext.unk_13F8 >= gSaveContext.unk_13F4) { gSaveContext.unk_13F8 = gSaveContext.unk_13F4; + } gSaveContext.unk_13F0 = 10; return 1; @@ -2719,10 +2356,8 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) #ifdef NON_MATCHING // this function still needs some work -void Interface_UpdateMagicBar(GlobalContext* globalCtx) -{ - static s16 sMagicBorderColors[][3] = - { +void Interface_UpdateMagicBar(GlobalContext* globalCtx) { + static s16 sMagicBorderColors[][3] = { { 0xFF, 0xFF, 0xFF }, { 0x96, 0x96, 0x96 }, { 0xFF, 0xFF, 0x96 }, @@ -2734,27 +2369,20 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) s16* color; s16 maxMagic; - switch (gSaveContext.unk_13F0) - { + switch (gSaveContext.unk_13F0) { case 8: maxMagic = gSaveContext.magic_level * 0x30; - if (gSaveContext.unk_13F4 != maxMagic) - { - if (gSaveContext.unk_13F4 < maxMagic) - { + if (gSaveContext.unk_13F4 != maxMagic) { + if (gSaveContext.unk_13F4 < maxMagic) { gSaveContext.unk_13F4 += 8; if (gSaveContext.unk_13F4 > maxMagic) gSaveContext.unk_13F4 = maxMagic; - } - else - { + } else { gSaveContext.unk_13F4 -= 8; if (gSaveContext.unk_13F4 <= maxMagic) gSaveContext.unk_13F4 = maxMagic; } - } - else - { + } else { gSaveContext.unk_13F0 = 9; } break; @@ -2766,8 +2394,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) // Translates to: "Storage MAGIC_NOW=%d (%d)" osSyncPrintf("蓄電 MAGIC_NOW=%d (%d)\n", gSaveContext.magic, gSaveContext.unk_13F6); - if (gSaveContext.magic >= gSaveContext.unk_13F6) - { + if (gSaveContext.magic >= gSaveContext.unk_13F6) { gSaveContext.magic = gSaveContext.unk_13F6; gSaveContext.unk_13F0 = gSaveContext.unk_13F2; gSaveContext.unk_13F2 = 0; @@ -2779,16 +2406,13 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) break; case 2: gSaveContext.magic -= 2; - if (gSaveContext.magic <= 0) - { + if (gSaveContext.magic <= 0) { gSaveContext.magic = 0; gSaveContext.unk_13F0 = 3; sMagicBorderB = 0xFF; sMagicBorderG = 0xFF; sMagicBorderR = 0xFF; - } - else if (gSaveContext.magic == gSaveContext.unk_13F8) - { + } else if (gSaveContext.magic == gSaveContext.unk_13F8) { gSaveContext.unk_13F0 = 3; sMagicBorderB = 0xFF; sMagicBorderG = 0xFF; @@ -2815,8 +2439,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) sMagicBorderB += ABS(sMagicBorderB - color[2]) / sMagicBorderRatio; sMagicBorderRatio--; - if (sMagicBorderRatio == 0) - { + if (sMagicBorderRatio == 0) { sMagicBorderR = color[0]; sMagicBorderG = color[1]; sMagicBorderB = color[2]; @@ -2833,32 +2456,24 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) gSaveContext.unk_13F0 = 0; break; case 7: - if ((globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.flag == 0) && - (globalCtx->msgCtx.msgMode == 0) && - (globalCtx->unk_10A20 == 0) && - (globalCtx->sceneLoadFlag == 0) && - (globalCtx->unk_1241B == 0) && - (func_800BFC84(globalCtx) == 0)) - { - if ((gSaveContext.magic == 0) || - ((func_8008F2F8(globalCtx) >= 2) && - (func_8008F2F8(globalCtx) < 5)) || + if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && + (globalCtx->msgCtx.msgMode == 0) && (globalCtx->unk_10A20 == 0) && (globalCtx->sceneLoadFlag == 0) && + (globalCtx->unk_1241B == 0) && (func_800BFC84(globalCtx) == 0)) { + if ((gSaveContext.magic == 0) || ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) || ((gSaveContext.equips.button_items[1] != ITEM_LENS) && (gSaveContext.equips.button_items[2] != ITEM_LENS) && (gSaveContext.equips.button_items[3] != ITEM_LENS)) || - (globalCtx->actorCtx.unk_03 == 0)) - { + (globalCtx->actorCtx.unk_03 == 0)) { globalCtx->actorCtx.unk_03 = 0; - Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); gSaveContext.unk_13F0 = 0; sMagicBorderR = sMagicBorderG = sMagicBorderB = 0xFF; break; } globalCtx->interfaceCtx.unk_230--; - if (globalCtx->interfaceCtx.unk_230 == 0) - { + if (globalCtx->interfaceCtx.unk_230 == 0) { gSaveContext.magic--; globalCtx->interfaceCtx.unk_230 = 80; } @@ -2882,8 +2497,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) sMagicBorderB += ABS(sMagicBorderB - color[2]) / sMagicBorderRatio; sMagicBorderRatio--; - if (sMagicBorderRatio == 0) - { + if (sMagicBorderRatio == 0) { sMagicBorderR = color[0]; sMagicBorderG = color[1]; sMagicBorderB = color[2]; @@ -2896,8 +2510,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) case 10: gSaveContext.magic += 4; Audio_PlaySoundGeneral(0x401F, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - if (gSaveContext.magic >= gSaveContext.unk_13F8) - { + if (gSaveContext.magic >= gSaveContext.unk_13F8) { gSaveContext.magic = gSaveContext.unk_13F8; gSaveContext.unk_13F0 = gSaveContext.unk_13F2; gSaveContext.unk_13F2 = 0; @@ -2909,8 +2522,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) } } #else -s16 sMagicBorderColors[][3] = -{ +s16 sMagicBorderColors[][3] = { { 0xFF, 0xFF, 0xFF }, { 0x96, 0x96, 0x96 }, { 0xFF, 0xFF, 0x96 }, @@ -2923,8 +2535,7 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx); #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_UpdateMagicBar.s") #endif -void Interface_DrawMagicBar(GlobalContext* globalCtx) -{ +void Interface_DrawMagicBar(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 magicBarY; GraphicsContext* gfxCtx; @@ -2933,180 +2544,131 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_parameter.c", 2650); - if (gSaveContext.magic_level != 0) - { - if (gSaveContext.health_capacity > 0xA0) + if (gSaveContext.magic_level != 0) { + if (gSaveContext.health_capacity > 0xA0) { magicBarY = R_MAGIC_BAR_LARGE_Y; - else + } else { magicBarY = R_MAGIC_BAR_SMALL_Y; + } func_80094520(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, interfaceCtx->magicAlpha); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, + interfaceCtx->magicAlpha); gDPSetEnvColor(gfxCtx->overlay.p++, 0x64, 0x32, 0x32, 0xFF); - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - D_020038C0, - 8, 16, - R_MAGIC_BAR_X, magicBarY, - 8, 16, - 1024, 1024); + gfxCtx->overlay.p = + Draw_TextureIA8(gfxCtx->overlay.p, D_020038C0, 8, 16, R_MAGIC_BAR_X, magicBarY, 8, 16, 1024, 1024); - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - D_02003940, - 24, 16, - R_MAGIC_BAR_X + 8, magicBarY, - gSaveContext.unk_13F4, 16, - 1024, 1024); + gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, D_02003940, 24, 16, R_MAGIC_BAR_X + 8, magicBarY, + gSaveContext.unk_13F4, 16, 1024, 1024); gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_020038C0); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, - 0, 0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_MIRROR | G_TX_WRAP, 3, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_MIRROR | G_TX_WRAP, 3, G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 63, 2048); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, - 1, 0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_MIRROR | G_TX_WRAP, 3, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_MIRROR | G_TX_WRAP, 3, G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 28, 60); - gSPTextureRectangle(gfxCtx->overlay.p++, - ((R_MAGIC_BAR_X + gSaveContext.unk_13F4) + 8) << 2, magicBarY << 2, - ((R_MAGIC_BAR_X + gSaveContext.unk_13F4) + 16) << 2, (magicBarY + 16) << 2, - G_TX_RENDERTILE, - 256, 0, - 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, ((R_MAGIC_BAR_X + gSaveContext.unk_13F4) + 8) << 2, magicBarY << 2, + ((R_MAGIC_BAR_X + gSaveContext.unk_13F4) + 16) << 2, (magicBarY + 16) << 2, G_TX_RENDERTILE, + 256, 0, 1024, 1024); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE, + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, 0xFF); - if (gSaveContext.unk_13F0 == 4) - { + if (gSaveContext.unk_13F0 == 4) { // Yellow part of the bar being used when casting a spell gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFA, 0xFA, 0x00, interfaceCtx->magicAlpha); - gDPLoadMultiBlock_4b(gfxCtx->overlay.p++, - D_02003AC0, - 0, - G_TX_RENDERTILE, - G_IM_FMT_I, - 16, 16, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, + gDPLoadMultiBlock_4b(gfxCtx->overlay.p++, D_02003AC0, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, - (R_MAGIC_FILL_X + gSaveContext.magic) << 2, (magicBarY + 10) << 2, - G_TX_RENDERTILE, - 0, 0, - 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, + (R_MAGIC_FILL_X + gSaveContext.magic) << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, + 0, 1024, 1024); // Fill the rest of the bar with the normal magic color gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, - (R_MAGIC_FILL_X + gSaveContext.unk_13F8) << 2, (magicBarY + 10) << 2, - G_TX_RENDERTILE, - 0, 0, - 1024, 1024); - } - else - { + gSPTextureRectangle(gfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, + (R_MAGIC_FILL_X + gSaveContext.unk_13F8) << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, + 0, 0, 1024, 1024); + } else { // Fill the whole bar with the normal magic color - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha); - gDPLoadMultiBlock_4b(gfxCtx->overlay.p++, - D_02003AC0, - 0, - G_TX_RENDERTILE, - G_IM_FMT_I, - 16, 16, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, + gDPLoadMultiBlock_4b(gfxCtx->overlay.p++, D_02003AC0, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, - (R_MAGIC_FILL_X + gSaveContext.magic) << 2, (magicBarY + 10) << 2, - G_TX_RENDERTILE, - 0, 0, - 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, + (R_MAGIC_FILL_X + gSaveContext.magic) << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, + 0, 1024, 1024); } } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_parameter.c", 2731); } -void func_80088AA0(s16 arg0) -{ +void func_80088AA0(s16 arg0) { gSaveContext.timer_x[1] = 140; gSaveContext.timer_y[1] = 80; D_80125A5C = 0; gSaveContext.timer_2_value = arg0; - if (arg0 != 0) + if (arg0 != 0) { gSaveContext.timer_2_state = 1; - else + } else { gSaveContext.timer_2_state = 7; -} - -void func_80088AF0(GlobalContext* globalCtx) -{ - if (gSaveContext.timer_2_state != 0) - { - if (gSaveContext.event_inf[1] & 1) - gSaveContext.timer_2_value = 239; - else - gSaveContext.timer_2_value = 1; } } -void func_80088B34(s16 arg0) -{ +void func_80088AF0(GlobalContext* globalCtx) { + if (gSaveContext.timer_2_state != 0) { + if (gSaveContext.event_inf[1] & 1) { + gSaveContext.timer_2_value = 239; + } else { + gSaveContext.timer_2_value = 1; + } + } +} + +void func_80088B34(s16 arg0) { gSaveContext.timer_x[0] = 140; gSaveContext.timer_y[0] = 80; D_80125A5C = 0; gSaveContext.timer_1_value = arg0; - if (arg0 != 0) + if (arg0 != 0) { gSaveContext.timer_1_state = 5; - else + } else { gSaveContext.timer_1_state = 11; + } } -void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) -{ +void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) { Gfx* gfxArr[5]; func_800C6AC4(gfxArr, gfxCtx, "../z_parameter.c", 2820); gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, texture); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, - 0, 0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, - 3, 0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); gSP1Quadrangle(gfxCtx->overlay.p++, 0, 2, 3, 1, 0); @@ -3120,8 +2682,7 @@ s16 sStartButtonLeftPos[] = { 132, 130, 130 }; #ifdef NON_MATCHING // regalloc and ordering differences -void Interface_DrawItemButtons(GlobalContext* globalCtx) -{ +void Interface_DrawItemButtons(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; Player* player = PLAYER; f32 temp; @@ -3138,169 +2699,117 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) // B Button Color & Texture // Also loads the Item Button Texture reused by other buttons afterwards gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), - R_B_BTN_COLOR(2), interfaceCtx->bAlpha); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, + TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2), + interfaceCtx->bAlpha); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, 0xFF); - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - &D_02000A00[0], - 32, 32, - R_ITEM_BTN_X(0), R_ITEM_BTN_Y(0), - R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_WIDTH(0), - R_ITEM_BTN_DD(0) * 2, R_ITEM_BTN_DD(0) * 2); + gfxCtx->overlay.p = + Draw_TextureIA8(gfxCtx->overlay.p, &D_02000A00[0], 32, 32, R_ITEM_BTN_X(0), R_ITEM_BTN_Y(0), + R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) * 2, R_ITEM_BTN_DD(0) * 2); // C-Left Button Color & Texture gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), - R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_ITEM_BTN_X(1) << 2, - R_ITEM_BTN_Y(1) << 2, - (R_ITEM_BTN_X(1) + R_ITEM_BTN_WIDTH(1)) << 2, - (R_ITEM_BTN_Y(1) + R_ITEM_BTN_WIDTH(1)) << 2, - G_TX_RENDERTILE, - 0, 0, - R_ITEM_BTN_DD(1) * 2, - R_ITEM_BTN_DD(1) * 2); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + interfaceCtx->cLeftAlpha); + gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_BTN_X(1) << 2, R_ITEM_BTN_Y(1) << 2, + (R_ITEM_BTN_X(1) + R_ITEM_BTN_WIDTH(1)) << 2, (R_ITEM_BTN_Y(1) + R_ITEM_BTN_WIDTH(1)) << 2, + G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(1) * 2, R_ITEM_BTN_DD(1) * 2); // C-Down Button Color & Texture - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), - R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_ITEM_BTN_X(2) << 2, - R_ITEM_BTN_Y(2) << 2, - (R_ITEM_BTN_X(2) + R_ITEM_BTN_WIDTH(2)) << 2, - (R_ITEM_BTN_Y(2) + R_ITEM_BTN_WIDTH(2)) << 2, - G_TX_RENDERTILE, - 0, 0, - R_ITEM_BTN_DD(2) * 2, - R_ITEM_BTN_DD(2) * 2); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + interfaceCtx->cDownAlpha); + gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_BTN_X(2) << 2, R_ITEM_BTN_Y(2) << 2, + (R_ITEM_BTN_X(2) + R_ITEM_BTN_WIDTH(2)) << 2, (R_ITEM_BTN_Y(2) + R_ITEM_BTN_WIDTH(2)) << 2, + G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(2) * 2, R_ITEM_BTN_DD(2) * 2); // C-Right Button Color & Texture - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), - R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_ITEM_BTN_X(3) << 2, - R_ITEM_BTN_Y(3) << 2, - (R_ITEM_BTN_X(3) + R_ITEM_BTN_WIDTH(3)) << 2, - (R_ITEM_BTN_Y(3) + R_ITEM_BTN_WIDTH(3)) << 2, - G_TX_RENDERTILE, - 0, 0, - R_ITEM_BTN_DD(3) * 2, - R_ITEM_BTN_DD(3) * 2); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + interfaceCtx->cRightAlpha); + gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_BTN_X(3) << 2, R_ITEM_BTN_Y(3) << 2, + (R_ITEM_BTN_X(3) + R_ITEM_BTN_WIDTH(3)) << 2, (R_ITEM_BTN_Y(3) + R_ITEM_BTN_WIDTH(3)) << 2, + G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) * 2, R_ITEM_BTN_DD(3) * 2); - if ((globalCtx->pauseCtx.state < 8) || (globalCtx->pauseCtx.state >= 18)) - { - if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) - { + if ((globalCtx->pauseCtx.state < 8) || (globalCtx->pauseCtx.state >= 18)) { + if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) { // Start Button Texture, Color & Label gDPPipeSync(gfxCtx->overlay.p++); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0x78, 0x78, 0x78, interfaceCtx->startAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, - sStartButtonLeftPos[gSaveContext.language] << 2, 156, - (sStartButtonLeftPos[gSaveContext.language] + 22) << 2, 68, - G_TX_RENDERTILE, - 0, 0, - 1462, 1462); + gSPTextureRectangle(gfxCtx->overlay.p++, sStartButtonLeftPos[gSaveContext.language] << 2, 156, + (sStartButtonLeftPos[gSaveContext.language] + 22) << 2, 68, G_TX_RENDERTILE, 0, 0, 1462, + 1462); gDPPipeSync(gfxCtx->overlay.p++); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->startAlpha); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, 0x00); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (u32)interfaceCtx->do_actionSegment + 0x300); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, - 0, 0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, + (u32)interfaceCtx->do_actionSegment + 0x300); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, - 3, 0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 48, 16); temp = R_START_LABEL_DD(gSaveContext.language) / 100.0f; - gSPTextureRectangle(gfxCtx->overlay.p++, - R_START_LABEL_X(gSaveContext.language) << 2, + gSPTextureRectangle(gfxCtx->overlay.p++, R_START_LABEL_X(gSaveContext.language) << 2, R_START_LABEL_Y(gSaveContext.language) << 2, (R_START_LABEL_X(gSaveContext.language) + (s16)(16 / temp)) << 2, - (R_START_LABEL_Y(gSaveContext.language) + (s16)(48 / temp)) << 2, - G_TX_RENDERTILE, - 0, 0, - (s16)(1024 / temp), - (s16)(1024 / temp)); + (R_START_LABEL_Y(gSaveContext.language) + (s16)(48 / temp)) << 2, G_TX_RENDERTILE, 0, 0, + (s16)(1024 / temp), (s16)(1024 / temp)); } } - if (interfaceCtx->naviCalling && (globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.flag == 0) && (globalCtx->csCtx.state == 0)) - { - if (!sCUpInvisible) - { + if (interfaceCtx->naviCalling && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && + (globalCtx->csCtx.state == 0)) { + if (!sCUpInvisible) { // C-Up Button Texture, Color & Label (Navi Text) gDPPipeSync(gfxCtx->overlay.p++); if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) cUpAlpha = 0; - else if ((player->stateFlags2 & 0x00200000) || (func_8008F2F8(globalCtx) == 4) || (player->stateFlags2 & 0x00040000)) + else if ((player->stateFlags2 & 0x00200000) || (func_8008F2F8(globalCtx) == 4) || + (player->stateFlags2 & 0x00040000)) cUpAlpha = 0x46; else cUpAlpha = interfaceCtx->healthAlpha; - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), - R_C_BTN_COLOR(2), cUpAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_C_UP_BTN_X << 2, R_C_UP_BTN_Y << 2, - (R_C_UP_BTN_X + 16) << 2, (R_C_UP_BTN_Y + 16) << 2, - G_TX_RENDERTILE, - 0, 0, - 2048, 2048); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), cUpAlpha); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, + PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); + gSPTextureRectangle(gfxCtx->overlay.p++, R_C_UP_BTN_X << 2, R_C_UP_BTN_Y << 2, (R_C_UP_BTN_X + 16) << 2, + (R_C_UP_BTN_Y + 16) << 2, G_TX_RENDERTILE, 0, 0, 2048, 2048); gDPPipeSync(gfxCtx->overlay.p++); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, cUpAlpha); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, 0x00); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, sCUpLabelTextures[gSaveContext.language]); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, - 0, 0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, + sCUpLabelTextures[gSaveContext.language]); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 63, 1024); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, - 2, 0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 2, 0, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 28); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, - (R_C_UP_ICON_X + 8) << 2, (R_C_UP_ICON_Y + 32) << 2, - G_TX_RENDERTILE, - 0, 0, - 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, (R_C_UP_ICON_X + 8) << 2, + (R_C_UP_ICON_Y + 32) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); } sCUpTimer--; - if (sCUpTimer == 0) - { + if (sCUpTimer == 0) { sCUpTimer = 10; sCUpInvisible ^= 1; } @@ -3309,29 +2818,21 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) gDPPipeSync(gfxCtx->overlay.p++); // Empty C Button Arrows - for (i = 1; i < 4; i++) - { - if (gSaveContext.equips.button_items[i] > 0xF0) - { + for (i = 1; i < 4; i++) { + if (gSaveContext.equips.button_items[i] > 0xF0) { if (i == 1) - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), - R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + interfaceCtx->cLeftAlpha); else if (i == 2) - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), - R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + interfaceCtx->cDownAlpha); else - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), - R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + interfaceCtx->cRightAlpha); - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - &D_02000A00[i + 1], - 0x20, 0x20, - R_ITEM_BTN_X(i), R_ITEM_BTN_Y(i), - R_ITEM_BTN_WIDTH(i), R_ITEM_BTN_WIDTH(i), - R_ITEM_BTN_DD(i) * 2, R_ITEM_BTN_DD(i) * 2); + gfxCtx->overlay.p = + Draw_TextureIA8(gfxCtx->overlay.p, &D_02000A00[i + 1], 0x20, 0x20, R_ITEM_BTN_X(i), R_ITEM_BTN_Y(i), + R_ITEM_BTN_WIDTH(i), R_ITEM_BTN_WIDTH(i), R_ITEM_BTN_DD(i) * 2, R_ITEM_BTN_DD(i) * 2); } } @@ -3342,39 +2843,25 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx); #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_DrawItemButtons.s") #endif -void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) -{ +void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) { GraphicsContext* gfxCtx; Gfx* gfxArr[4]; gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_parameter.c", 3079); - gDPLoadTextureBlock(gfxCtx->overlay.p++, - texture, - G_IM_FMT_RGBA, - G_IM_SIZ_32b, - 32, 32, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gfxCtx->overlay.p++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_ITEM_ICON_X(button) << 2, - R_ITEM_ICON_Y(button) << 2, + gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_ICON_X(button) << 2, R_ITEM_ICON_Y(button) << 2, (R_ITEM_ICON_X(button) + R_ITEM_ICON_WIDTH(button)) << 2, - (R_ITEM_ICON_Y(button) + R_ITEM_ICON_WIDTH(button)) << 2, - G_TX_RENDERTILE, - 0, 0, - R_ITEM_ICON_DD(button) * 2, - R_ITEM_ICON_DD(button) * 2); + (R_ITEM_ICON_Y(button) + R_ITEM_ICON_WIDTH(button)) << 2, G_TX_RENDERTILE, 0, 0, + R_ITEM_ICON_DD(button) * 2, R_ITEM_ICON_DD(button) * 2); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_parameter.c", 3094); } -void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) -{ +void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { s16 item; s16 ammo; GraphicsContext* gfxCtx; @@ -3386,70 +2873,56 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) item = gSaveContext.equips.button_items[button]; - if ((item == ITEM_STICK) || (item == ITEM_NUT) || - (item == ITEM_BOMB) || (item == ITEM_BOW) || - ((item >= ITEM_BOW_ARROW_FIRE) && (item <= ITEM_BOW_ARROW_LIGHT)) || - (item == ITEM_SLINGSHOT) || (item == ITEM_BOMBCHU) || (item == ITEM_BEAN)) - { - if ((item >= ITEM_BOW_ARROW_FIRE) && (item <= ITEM_BOW_ARROW_LIGHT)) + if ((item == ITEM_STICK) || (item == ITEM_NUT) || (item == ITEM_BOMB) || (item == ITEM_BOW) || + ((item >= ITEM_BOW_ARROW_FIRE) && (item <= ITEM_BOW_ARROW_LIGHT)) || (item == ITEM_SLINGSHOT) || + (item == ITEM_BOMBCHU) || (item == ITEM_BEAN)) { + if ((item >= ITEM_BOW_ARROW_FIRE) && (item <= ITEM_BOW_ARROW_LIGHT)) { item = ITEM_BOW; + } ammo = AMMO(item); gDPPipeSync(gfxCtx->overlay.p++); - if ((button == 0) && (gSaveContext.minigame_state == 1)) - { + if ((button == 0) && (gSaveContext.minigame_state == 1)) { ammo = globalCtx->interfaceCtx.hbaAmmo; - } - else if ((button == 0) && (globalCtx->unk_11E5C >= 2)) - { + } else if ((button == 0) && (globalCtx->unk_11E5C >= 2)) { ammo = globalCtx->unk_11E5C - 1; - } - else if ((button == 0) && (globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) - { + } else if ((button == 0) && (globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38)) { ammo = globalCtx->bombchuBowlingAmmo; - if (ammo < 0) + if (ammo < 0) { ammo = 0; - } - else if (((item == ITEM_BOW) && (AMMO(item) == CUR_CAPACITY(UPG_QUIVER))) || - ((item == ITEM_BOMB) && (AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG))) || - ((item == ITEM_SLINGSHOT) && (AMMO(item) == CUR_CAPACITY(UPG_BULLET_BAG))) || - ((item == ITEM_STICK) && (AMMO(item) == CUR_CAPACITY(UPG_STICKS))) || - ((item == ITEM_NUT) && (AMMO(item) == CUR_CAPACITY(UPG_NUTS))) || - ((item == ITEM_BOMBCHU) && (ammo == 50)) || - ((item == ITEM_BEAN) && (ammo == 15))) - { + } + } else if (((item == ITEM_BOW) && (AMMO(item) == CUR_CAPACITY(UPG_QUIVER))) || + ((item == ITEM_BOMB) && (AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((item == ITEM_SLINGSHOT) && (AMMO(item) == CUR_CAPACITY(UPG_BULLET_BAG))) || + ((item == ITEM_STICK) && (AMMO(item) == CUR_CAPACITY(UPG_STICKS))) || + ((item == ITEM_NUT) && (AMMO(item) == CUR_CAPACITY(UPG_NUTS))) || + ((item == ITEM_BOMBCHU) && (ammo == 50)) || ((item == ITEM_BEAN) && (ammo == 15))) { gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0x78, 0xFF, 0x00, alpha); } - if (ammo == 0) + if (ammo == 0) { gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0x64, 0x64, 0x64, alpha); + } - for (i = 0; ammo >= 10; i++) + for (i = 0; ammo >= 10; i++) { ammo -= 10; + } - if (i != 0) - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - &D_020035C0[i], - 8, 8, - R_ITEM_AMMO_X(button), R_ITEM_AMMO_Y(button), - 8, 8, - 1024, 1024); + if (i != 0) { + gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, &D_020035C0[i], 8, 8, R_ITEM_AMMO_X(button), + R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024); + } - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - &D_020035C0[ammo], - 8, 8, - R_ITEM_AMMO_X(button) + 6, R_ITEM_AMMO_Y(button), - 8, 8, - 1024, 1024); + gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, &D_020035C0[ammo], 8, 8, R_ITEM_AMMO_X(button) + 6, + R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024); } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_parameter.c", 3158); } -void Interface_DrawActionButton(GlobalContext* globalCtx) -{ +void Interface_DrawActionButton(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3461,33 +2934,28 @@ void Interface_DrawActionButton(GlobalContext* globalCtx) Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); - if (1) ; // Necessary to match + if (1) {} // Necessary to match - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3177), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3177), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(gfxCtx->overlay.p++, interfaceCtx->vtx_128, 4, 0); - gDPLoadTextureBlock(gfxCtx->overlay.p++, - &D_02000A00[0], - G_IM_FMT_IA, - G_IM_SIZ_8b, - 32, 32, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(gfxCtx->overlay.p++, &D_02000A00[0], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); gSP1Quadrangle(gfxCtx->overlay.p++, 0, 2, 3, 1, 0); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_parameter.c", 3187); } -void Interface_InitVertices(GlobalContext* globalCtx) -{ +void Interface_InitVertices(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 i; interfaceCtx->vtx_128 = Graph_Alloc(globalCtx->state.gfxCtx, 8 * sizeof(Vtx)); + // clang-format off interfaceCtx->vtx_128[0].v.ob[0] = interfaceCtx->vtx_128[2].v.ob[0] = -14; interfaceCtx->vtx_128[1].v.ob[0] = @@ -3508,8 +2976,7 @@ void Interface_InitVertices(GlobalContext* globalCtx) interfaceCtx->vtx_128[6].v.ob[1] = interfaceCtx->vtx_128[7].v.ob[1] = interfaceCtx->vtx_128[4].v.ob[1] - XREG(28); - for (i = 0; i < 8; i += 4) - { + for (i = 0; i < 8; i += 4) { interfaceCtx->vtx_128[i].v.ob[2] = interfaceCtx->vtx_128[i+1].v.ob[2] = interfaceCtx->vtx_128[i+2].v.ob[2] = interfaceCtx->vtx_128[i+3].v.ob[2] = 0; @@ -3561,10 +3028,10 @@ void Interface_InitVertices(GlobalContext* globalCtx) interfaceCtx->vtx_12C[2].v.cn[2] = interfaceCtx->vtx_12C[3].v.cn[2] = interfaceCtx->vtx_12C[0].v.cn[3] = interfaceCtx->vtx_12C[1].v.cn[3] = interfaceCtx->vtx_12C[2].v.cn[3] = interfaceCtx->vtx_12C[3].v.cn[3] = 0xFF; + // clang-format on } -void func_8008A8B8(GlobalContext* globalCtx, s32 arg1, s32 arg2, s32 arg3, s32 arg4) -{ +void func_8008A8B8(GlobalContext* globalCtx, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; Vec3f sp40; Vec3f sp34; @@ -3585,8 +3052,7 @@ void func_8008A8B8(GlobalContext* globalCtx, s32 arg1, s32 arg2, s32 arg3, s32 a func_800AB560(&interfaceCtx->view); } -void func_8008A994(InterfaceContext* interfaceCtx) -{ +void func_8008A994(InterfaceContext* interfaceCtx) { s32 sp18[4]; // clang-format off @@ -3606,13 +3072,8 @@ s16 sTimerDigitLeftPos[] = { 16, 25, 34, 42, 51 }; s16 sDigitWidth[] = { 9, 9, 8, 9, 9 }; // unused, most likely colors -s16 D_80125B1C[][3] = -{ - { 0x00, 0x96, 0x00 }, - { 0x64, 0xFF, 0x00 }, - { 0xFF, 0xFF, 0xFF }, - { 0x00, 0x00, 0x00 }, - { 0xFF, 0xFF, 0xFF }, +s16 D_80125B1C[][3] = { + { 0x00, 0x96, 0x00 }, { 0x64, 0xFF, 0x00 }, { 0xFF, 0xFF, 0xFF }, { 0x00, 0x00, 0x00 }, { 0xFF, 0xFF, 0xFF }, }; s16 sRupeeDigitsFirst[] = { 1, 0, 0 }; @@ -3620,14 +3081,13 @@ s16 sRupeeDigitsCount[] = { 2, 3, 3 }; s16 sSpoilingItemEntrances[] = { 0x01AD, 0x0153, 0x0153 }; -u16 D_80125B54 = 0xC220; // unused -u16 D_80125B58 = 0xC20C; // unused +u16 D_80125B54 = 0xC220; // unused +u16 D_80125B58 = 0xC20C; // unused s16 D_80125B5C[] = { 91, 91 }; // unused #ifdef NON_MATCHING // mostly regalloc, minor ordering and stack usage differences -void Interface_Draw(GlobalContext* globalCtx) -{ +void Interface_Draw(GlobalContext* globalCtx) { static s16 D_8015FFE0; static s16 D_8015FFE2; static s16 D_8015FFE4; @@ -3655,8 +3115,7 @@ void Interface_Draw(GlobalContext* globalCtx) gSPSegment(gfxCtx->overlay.p++, 0x08, interfaceCtx->icon_itemSegment); gSPSegment(gfxCtx->overlay.p++, 0x0B, interfaceCtx->mapSegment); - if (pauseCtx->flag == 0) - { + if (pauseCtx->flag == 0) { Interface_InitVertices(globalCtx); func_8008A994(interfaceCtx); Interface_DrawHealth(globalCtx); @@ -3666,15 +3125,9 @@ void Interface_Draw(GlobalContext* globalCtx) // Rupee Icon gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xC8, 0xFF, 0x64, interfaceCtx->magicAlpha); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x50, 0x00, 0xFF); - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - D_02001F00, - 16, 16, - 26, 206, - 16, 16, - 1024, 1024); + gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, D_02001F00, 16, 16, 26, 206, 16, 16, 1024, 1024); - switch (globalCtx->sceneNum) - { + switch (globalCtx->sceneNum) { case SCENE_BMORI1: case SCENE_HIDAN: case SCENE_MIZUSIN: @@ -3689,53 +3142,38 @@ void Interface_Draw(GlobalContext* globalCtx) case SCENE_GANON_SONOGO: case SCENE_GANONTIKA_SONOGO: case SCENE_TAKARAYA: - if (gSaveContext.dungeon_keys[gSaveContext.dungeon_index] >= 0) - { + if (gSaveContext.dungeon_keys[gSaveContext.dungeon_index] >= 0) { // Small Key Icon gDPPipeSync(gfxCtx->overlay.p++); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xC8, 0xE6, 0xFF, interfaceCtx->magicAlpha); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x14, 0xFF); - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - D_02001E00, - 16, 16, - 26, 190, - 16, 16, - 1024, 1024); + gfxCtx->overlay.p = + Draw_TextureIA8(gfxCtx->overlay.p, D_02001E00, 16, 16, 26, 190, 16, 16, 1024, 1024); // Small Key Counter gDPPipeSync(gfxCtx->overlay.p++); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->magicAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, + PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); interfaceCtx->counterDigits[2] = 0; interfaceCtx->counterDigits[3] = gSaveContext.dungeon_keys[gSaveContext.dungeon_index]; - while (interfaceCtx->counterDigits[3] >= 10) - { + while (interfaceCtx->counterDigits[3] >= 10) { interfaceCtx->counterDigits[2]++; interfaceCtx->counterDigits[3] -= 10; } phi_s2 = 42; - if (interfaceCtx->counterDigits[2] != 0) - { - gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, - &D_02003040[interfaceCtx->counterDigits[2]], - 8, 16, - phi_s2, 190, - 8, 16, - 1024, 1024); + if (interfaceCtx->counterDigits[2] != 0) { + gfxCtx->overlay.p = + Draw_TextureI8(gfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[2]], 8, 16, + phi_s2, 190, 8, 16, 1024, 1024); phi_s2 = 50; } - gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, - &D_02003040[interfaceCtx->counterDigits[3]], - 8, 16, - phi_s2, 190, - 8, 16, - 1024, 1024); + gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[3]], + 8, 16, phi_s2, 190, 8, 16, 1024, 1024); } phi_s2 = 42; @@ -3757,9 +3195,8 @@ void Interface_Draw(GlobalContext* globalCtx) else gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0x64, 0x64, 0x64, interfaceCtx->magicAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, + 0, PRIMITIVE, 0); interfaceCtx->counterDigits[0] = interfaceCtx->counterDigits[1] = 0; interfaceCtx->counterDigits[2] = gSaveContext.rupees; @@ -3767,14 +3204,12 @@ void Interface_Draw(GlobalContext* globalCtx) if ((interfaceCtx->counterDigits[2] >= 10000) || (interfaceCtx->counterDigits[2] < 0)) interfaceCtx->counterDigits[2] &= 0xDDD; - while (interfaceCtx->counterDigits[2] >= 100) - { + while (interfaceCtx->counterDigits[2] >= 100) { interfaceCtx->counterDigits[2] -= 100; interfaceCtx->counterDigits[0]++; } - while (interfaceCtx->counterDigits[2] >= 10) - { + while (interfaceCtx->counterDigits[2] >= 10) { interfaceCtx->counterDigits[2] -= 10; interfaceCtx->counterDigits[1]++; } @@ -3782,14 +3217,9 @@ void Interface_Draw(GlobalContext* globalCtx) phi_s0 = sRupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)]; phi_s1 = sRupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)]; - for (phi_s3 = 0; phi_s3 < phi_s1; phi_s3++, phi_s0++, phi_s2 += 8) - { - gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, - &D_02003040[interfaceCtx->counterDigits[phi_s0]], - 8, 16, - phi_s2, 206, - 8, 16, - 1024, 1024); + for (phi_s3 = 0; phi_s3 < phi_s1; phi_s3++, phi_s0++, phi_s2 += 8) { + gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[phi_s0]], 8, + 16, phi_s2, 206, 8, 16, 1024, 1024); } Interface_DrawMagicBar(globalCtx); @@ -3804,138 +3234,113 @@ void Interface_Draw(GlobalContext* globalCtx) gDPPipeSync(gfxCtx->overlay.p++); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->bAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, + 0, TEXEL0, 0, PRIMITIVE, 0); - if (interfaceCtx->unk_1FA == 0) - { + if (interfaceCtx->unk_1FA == 0) { // B Button Icon & possibly Ammo Count - if (gSaveContext.equips.button_items[0] != ITEM_NONE) - { + if (gSaveContext.equips.button_items[0] != ITEM_NONE) { Interface_DrawItemIconTexture(globalCtx, (void*)(u32)interfaceCtx->icon_itemSegment, 0); if ((player->stateFlags1 & 0x00800000) || (globalCtx->unk_11E5C >= 2) || - ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) - { + ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0); Interface_DrawAmmoCount(globalCtx, 0, interfaceCtx->bAlpha); } } - } - else - { + } else { // B Button Do Action Label gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->bAlpha); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (u32)interfaceCtx->do_actionSegment + 0x180); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, - 0, 0x0000, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, + (u32)interfaceCtx->do_actionSegment + 0x180); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, - 3, 0x0000, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0x0000, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); R_B_LABEL_DD = 1024.0f / (WREG(37 + gSaveContext.language) / 100.0f); - gSPTextureRectangle(gfxCtx->overlay.p++, - R_B_LABEL_X(gSaveContext.language) << 2, R_B_LABEL_Y(gSaveContext.language) << 2, - (R_B_LABEL_X(gSaveContext.language) + 48) << 2, R_B_LABEL_Y(gSaveContext.language) << 2, - G_TX_RENDERTILE, - 0, 0, - R_B_LABEL_DD, R_B_LABEL_DD); + gSPTextureRectangle(gfxCtx->overlay.p++, R_B_LABEL_X(gSaveContext.language) << 2, + R_B_LABEL_Y(gSaveContext.language) << 2, (R_B_LABEL_X(gSaveContext.language) + 48) << 2, + R_B_LABEL_Y(gSaveContext.language) << 2, G_TX_RENDERTILE, 0, 0, R_B_LABEL_DD, + R_B_LABEL_DD); } gDPPipeSync(gfxCtx->overlay.p++); // C-Left Button Icon & Ammo Count - if (gSaveContext.equips.button_items[1] < 0xF0) - { + if (gSaveContext.equips.button_items[1] < 0xF0) { gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->cLeftAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, + PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x1000), 1); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawAmmoCount(globalCtx, 1, interfaceCtx->cLeftAlpha); } gDPPipeSync(gfxCtx->overlay.p++); // C-Down Button Icon & Ammo Count - if (gSaveContext.equips.button_items[2] < 0xF0) - { + if (gSaveContext.equips.button_items[2] < 0xF0) { gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->cDownAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, + PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x2000), 2); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawAmmoCount(globalCtx, 2, interfaceCtx->cDownAlpha); } gDPPipeSync(gfxCtx->overlay.p++); // C-Right Button Icon & Ammo Count - if (gSaveContext.equips.button_items[3] < 0xF0) - { + if (gSaveContext.equips.button_items[3] < 0xF0) { gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->cRightAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, + PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x3000), 3); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawAmmoCount(globalCtx, 3, interfaceCtx->cRightAlpha); } // A Button func_80094A14(globalCtx->state.gfxCtx); - func_8008A8B8(globalCtx, - R_A_BTN_Y, R_A_BTN_Y + 45, - R_A_BTN_X, R_A_BTN_X + 45); + func_8008A8B8(globalCtx, R_A_BTN_Y, R_A_BTN_Y + 45, R_A_BTN_X, R_A_BTN_X + 45); gSPClearGeometryMode(gfxCtx->overlay.p++, G_CULL_BOTH); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), - R_A_BTN_COLOR(2), interfaceCtx->aAlpha); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, + 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), + interfaceCtx->aAlpha); Interface_DrawActionButton(globalCtx); gDPPipeSync(gfxCtx->overlay.p++); - func_8008A8B8(globalCtx, - R_A_ICON_Y, R_A_ICON_Y + 45, - R_A_ICON_X, R_A_ICON_X + 45); + func_8008A8B8(globalCtx, R_A_ICON_Y, R_A_ICON_Y + 45, R_A_ICON_X, R_A_ICON_X + 45); gSPSetGeometryMode(gfxCtx->overlay.p++, G_CULL_BACK); - gDPSetCombineLERP(gfxCtx->overlay.p++, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->aAlpha); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, 0x00); Matrix_Translate(0.0f, 0.0f, WREG(46 + gSaveContext.language) / 10.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3701), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3701), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(gfxCtx->overlay.p++, &interfaceCtx->vtx_128[4], 4, 0); if ((interfaceCtx->unk_1EC < 2) || (interfaceCtx->unk_1EC == 3)) @@ -3947,71 +3352,66 @@ void Interface_Draw(GlobalContext* globalCtx) func_8008A994(interfaceCtx); - if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 3)) - { + if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 3)) { // Inventory Equip Effects gSPSegment(gfxCtx->overlay.p++, 0x08, pauseCtx->unk_128); func_80094A14(globalCtx->state.gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, + PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); gSPMatrix(gfxCtx->overlay.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); pauseCtx->vtx_168[16].v.ob[0] = pauseCtx->vtx_168[18].v.ob[0] = pauseCtx->unk_254 / 10; - pauseCtx->vtx_168[17].v.ob[0] = pauseCtx->vtx_168[19].v.ob[0] = pauseCtx->vtx_168[16].v.ob[0] + WREG(90) / 10; + pauseCtx->vtx_168[17].v.ob[0] = pauseCtx->vtx_168[19].v.ob[0] = + pauseCtx->vtx_168[16].v.ob[0] + WREG(90) / 10; pauseCtx->vtx_168[16].v.ob[1] = pauseCtx->vtx_168[17].v.ob[1] = pauseCtx->unk_256 / 10; - pauseCtx->vtx_168[18].v.ob[1] = pauseCtx->vtx_168[19].v.ob[1] = pauseCtx->vtx_168[16].v.ob[1] - WREG(90) / 10; + pauseCtx->vtx_168[18].v.ob[1] = pauseCtx->vtx_168[19].v.ob[1] = + pauseCtx->vtx_168[16].v.ob[1] - WREG(90) / 10; - if (pauseCtx->unk_24E < 0xBF) - { + if (pauseCtx->unk_24E < 0xBF) { // Normal Equip (icon goes from the inventory slot to the C button when equipping it) gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, pauseCtx->unk_258); gSPVertex(gfxCtx->overlay.p++, &pauseCtx->vtx_168[16], 4, 0); gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, gItemIcons[pauseCtx->unk_24E]); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, - 0, 0x0000, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0x0000, G_TX_LOADTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 1023, 128); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, - 8, 0x0000, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 8, 0x0000, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 124); - } - else - { + } else { // Magic Arrow Equip Effect phi_s3_2 = pauseCtx->unk_24E - 0xBF; - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, - sMagicArrowEffectsR[phi_s3_2], sMagicArrowEffectsG[phi_s3_2], + gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, sMagicArrowEffectsR[phi_s3_2], sMagicArrowEffectsG[phi_s3_2], sMagicArrowEffectsB[phi_s3_2], pauseCtx->unk_258); - if ((pauseCtx->unk_258 > 0) && (pauseCtx->unk_258 < 0xFF)) - { + if ((pauseCtx->unk_258 > 0) && (pauseCtx->unk_258 < 0xFF)) { phi_s3_2 = (pauseCtx->unk_258 / 8) / 2; - pauseCtx->vtx_168[16].v.ob[0] = pauseCtx->vtx_168[18].v.ob[0] = pauseCtx->vtx_168[16].v.ob[0] - phi_s3_2; - pauseCtx->vtx_168[17].v.ob[0] = pauseCtx->vtx_168[19].v.ob[0] = pauseCtx->vtx_168[16].v.ob[0] + phi_s3_2 * 2 + 32; - pauseCtx->vtx_168[16].v.ob[1] = pauseCtx->vtx_168[17].v.ob[1] = pauseCtx->vtx_168[16].v.ob[1] + phi_s3_2; - pauseCtx->vtx_168[18].v.ob[1] = pauseCtx->vtx_168[19].v.ob[1] = pauseCtx->vtx_168[16].v.ob[1] - phi_s3_2 * 2 - 32; + pauseCtx->vtx_168[16].v.ob[0] = pauseCtx->vtx_168[18].v.ob[0] = + pauseCtx->vtx_168[16].v.ob[0] - phi_s3_2; + pauseCtx->vtx_168[17].v.ob[0] = pauseCtx->vtx_168[19].v.ob[0] = + pauseCtx->vtx_168[16].v.ob[0] + phi_s3_2 * 2 + 32; + pauseCtx->vtx_168[16].v.ob[1] = pauseCtx->vtx_168[17].v.ob[1] = + pauseCtx->vtx_168[16].v.ob[1] + phi_s3_2; + pauseCtx->vtx_168[18].v.ob[1] = pauseCtx->vtx_168[19].v.ob[1] = + pauseCtx->vtx_168[16].v.ob[1] - phi_s3_2 * 2 - 32; } gSPVertex(gfxCtx->overlay.p++, &pauseCtx->vtx_168[16], 4, 0); gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_080895C0); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, - 0, 0x0000, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 511, 512); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, - 4, 0x0000, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0x0000, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 124); } @@ -4020,108 +3420,82 @@ void Interface_Draw(GlobalContext* globalCtx) func_80094520(globalCtx->state.gfxCtx); - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0)) - { - if (gSaveContext.minigame_state != 1) - { + if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0)) { + if (gSaveContext.minigame_state != 1) { // Carrots rendering if the action corresponds to riding a horse - if (interfaceCtx->unk_1EE == 8) - { + if (interfaceCtx->unk_1EE == 8) { // Load Carrot Icon gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, &D_02002100); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, - 0, 0x0000, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0x0000, G_TX_LOADTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 255, 256); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, - 4, 0x0000, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 4, 0x0000, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 60, 60); // Draw 6 carrots phi_s1 = ZREG(14); - for (phi_s3 = 1; phi_s3 < 7; phi_s3++) - { + for (phi_s3 = 1; phi_s3 < 7; phi_s3++) { // Carrot Color (based on availability) if ((interfaceCtx->unk_23A == 0) || (interfaceCtx->unk_23A < phi_s3)) gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0x00, 0x96, 0xFF, interfaceCtx->aAlpha); else gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->aAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, - phi_s1 << 2, ZREG(15) << 2, - (phi_s1 + 16) << 2, (ZREG(15) + 16) << 2, - G_TX_RENDERTILE, - 0, 0, - 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, phi_s1 << 2, ZREG(15) << 2, (phi_s1 + 16) << 2, + (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); phi_s1 += 16; } } - } - else - { + } else { // Score for the Horseback Archery gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->bAlpha); // Target Icon gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, D_02002600); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, - 0, 0x0000, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPLoadSync(gfxCtx->overlay.p++); gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 383, 342); gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, - 6, 0x0000, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); + gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 6, 0x0000, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOLOD); gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 92, 60); - gSPTextureRectangle(gfxCtx->overlay.p++, - (WREG(32) + 28) << 2, ZREG(15) << 2, - (WREG(32) + 52) << 2, (ZREG(15) + 16) << 2, - G_TX_RENDERTILE, - 0, 0, - 1024, 1024); + gSPTextureRectangle(gfxCtx->overlay.p++, (WREG(32) + 28) << 2, ZREG(15) << 2, (WREG(32) + 52) << 2, + (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); // Score Counter gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, + TEXEL0, 0, PRIMITIVE, 0); phi_s0 = 0; phi_s1 = WREG(32) + 6 * 9; - for (phi_s3 = 0; phi_s3 < 4; phi_s3++) - { - if (sHBAScoreDigits[phi_s3] != 0 || (phi_s0 != 0) || (phi_s3 >= 3)) - { - gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, - &D_02003040[sHBAScoreDigits[phi_s3]], - 8, 16, - phi_s1, ZREG(15) - 2, - sDigitWidth[0], VREG(42), - VREG(43) * 2, VREG(43) * 2); + for (phi_s3 = 0; phi_s3 < 4; phi_s3++) { + if (sHBAScoreDigits[phi_s3] != 0 || (phi_s0 != 0) || (phi_s3 >= 3)) { + gfxCtx->overlay.p = + Draw_TextureI8(gfxCtx->overlay.p, &D_02003040[sHBAScoreDigits[phi_s3]], 8, 16, phi_s1, + ZREG(15) - 2, sDigitWidth[0], VREG(42), VREG(43) * 2, VREG(43) * 2); phi_s1 += 9; phi_s0++; } } gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, TEXEL0, 0, + PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); } } - if ((gSaveContext.timer_2_state == 5) && (func_8010BDBC(&globalCtx->msgCtx) == 5)) - { + if ((gSaveContext.timer_2_state == 5) && (func_8010BDBC(&globalCtx->msgCtx) == 5)) { // Trade quest timer reached 0 gSaveContext.cutscene_index = 0; globalCtx->sceneLoadFlag = 0x14; @@ -4132,8 +3506,7 @@ void Interface_Draw(GlobalContext* globalCtx) if ((gSaveContext.equips.button_items[0] != ITEM_SWORD_KOKIRI) && (gSaveContext.equips.button_items[0] != ITEM_SWORD_MASTER) && (gSaveContext.equips.button_items[0] != ITEM_SWORD_BGS) && - (gSaveContext.equips.button_items[0] != ITEM_SWORD_KNIFE)) - { + (gSaveContext.equips.button_items[0] != ITEM_SWORD_KNIFE)) { if (gSaveContext.button_status[0] != BTN_ENABLED) gSaveContext.equips.button_items[0] = gSaveContext.button_status[0]; else @@ -4141,19 +3514,15 @@ void Interface_Draw(GlobalContext* globalCtx) } // Revert any spoiling trade quest items - for (phi_s3 = 0; phi_s3 < ARRAY_COUNT(gSpoilingItems); phi_s3++) - { - if (INV_CONTENT(ITEM_POCKET_EGG) == gSpoilingItems[phi_s3]) - { + for (phi_s3 = 0; phi_s3 < ARRAY_COUNT(gSpoilingItems); phi_s3++) { + if (INV_CONTENT(ITEM_POCKET_EGG) == gSpoilingItems[phi_s3]) { gSaveContext.event_inf[0] &= 0x7F80; osSyncPrintf("EVENT_INF=%x\n", gSaveContext.event_inf[0]); globalCtx->nextEntranceIndex = sSpoilingItemEntrances[phi_s3]; INV_CONTENT(gSpoilingItemReverts[phi_s3]) = gSpoilingItemReverts[phi_s3]; - for (phi_s0 = 1; phi_s0 < 4; phi_s0++) - { - if (gSaveContext.equips.button_items[phi_s0] == gSpoilingItems[phi_s3]) - { + for (phi_s0 = 1; phi_s0 < 4; phi_s0++) { + if (gSaveContext.equips.button_items[phi_s0] == gSpoilingItems[phi_s3]) { gSaveContext.equips.button_items[phi_s0] = gSpoilingItemReverts[phi_s3]; Interface_LoadItemIcon1(globalCtx, phi_s0); } @@ -4162,21 +3531,13 @@ void Interface_Draw(GlobalContext* globalCtx) } } - if ((globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.flag == 0) && - (globalCtx->unk_10A20 == 0) && - (msgCtx->msgMode == 0) && - !(player->stateFlags2 & 0x01000000) && - (globalCtx->sceneLoadFlag == 0) && - (globalCtx->unk_1241B == 0) && - (func_800BFC84(globalCtx) == 0) && - (gSaveContext.minigame_state != 1) && + if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (globalCtx->unk_10A20 == 0) && + (msgCtx->msgMode == 0) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && + (globalCtx->unk_1241B == 0) && (func_800BFC84(globalCtx) == 0) && (gSaveContext.minigame_state != 1) && (globalCtx->unk_11E5C < 2) && - !((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) - { + !((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { sp274 = 0; - switch (gSaveContext.timer_1_state) - { + switch (gSaveContext.timer_1_state) { case 1: gSaveContext.timer_1_state = 2; gSaveContext.timer_1_value = gSaveContext.health >> 1; @@ -4184,8 +3545,7 @@ void Interface_Draw(GlobalContext* globalCtx) break; case 2: D_8015FFE2--; - if (D_8015FFE2 == 0) - { + if (D_8015FFE2 == 0) { gSaveContext.timer_1_state = 3; D_8015FFE2 = 20; } @@ -4201,8 +3561,7 @@ void Interface_Draw(GlobalContext* globalCtx) case 6: case 12: D_8015FFE2--; - if (D_8015FFE2 == 0) - { + if (D_8015FFE2 == 0) { D_8015FFE2 = 20; if (gSaveContext.timer_1_state == 6) gSaveContext.timer_1_state = 7; @@ -4222,8 +3581,7 @@ void Interface_Draw(GlobalContext* globalCtx) gSaveContext.timer_y[0] -= phi_s3; D_8015FFE2--; - if (D_8015FFE2 == 0) - { + if (D_8015FFE2 == 0) { gSaveContext.timer_x[0] = 26; D_8015FFE2 = 20; @@ -4239,47 +3597,39 @@ void Interface_Draw(GlobalContext* globalCtx) } case 4: case 8: - if ((gSaveContext.timer_1_state == 4) || (gSaveContext.timer_1_state == 8)) - { + if ((gSaveContext.timer_1_state == 4) || (gSaveContext.timer_1_state == 8)) { if (gSaveContext.health_capacity > 0xA0) gSaveContext.timer_y[0] = 54; else gSaveContext.timer_y[0] = 46; } - if ((gSaveContext.timer_1_state >= 3) && (msgCtx->unk_E300 == 0)) - { + if ((gSaveContext.timer_1_state >= 3) && (msgCtx->unk_E300 == 0)) { D_8015FFE0--; - if (D_8015FFE0 == 0) - { + if (D_8015FFE0 == 0) { if (gSaveContext.timer_1_value != 0) gSaveContext.timer_1_value--; D_8015FFE0 = 20; - if (gSaveContext.timer_1_value == 0) - { + if (gSaveContext.timer_1_value == 0) { gSaveContext.timer_1_state = 10; - if (D_80125A5C != 0) - { + if (D_80125A5C != 0) { gSaveContext.health = 0; globalCtx->unk_11D58(globalCtx, -(gSaveContext.health + 2)); } D_80125A5C = 0; - } - else if (gSaveContext.timer_1_value > 60) - { + } else if (gSaveContext.timer_1_value > 60) { if (sTimerDigits[4] == 1) - Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_WOMAN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } - else if (gSaveContext.timer_1_value >= 11) - { + Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_WOMAN, &D_801333D4, 4, &D_801333E0, + &D_801333E0, &D_801333E8); + } else if (gSaveContext.timer_1_value >= 11) { if (sTimerDigits[4] & 1) - Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } - else - { - Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_E, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, &D_801333E0, + &D_801333E0, &D_801333E8); + } else { + Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_E, &D_801333D4, 4, &D_801333E0, + &D_801333E0, &D_801333E8); } } } @@ -4295,8 +3645,7 @@ void Interface_Draw(GlobalContext* globalCtx) gSaveContext.timer_y[0] -= phi_s3; D_8015FFE2--; - if (D_8015FFE2 == 0) - { + if (D_8015FFE2 == 0) { gSaveContext.timer_x[0] = 26; D_8015FFE2 = 20; @@ -4308,37 +3657,31 @@ void Interface_Draw(GlobalContext* globalCtx) gSaveContext.timer_1_state = 14; } case 14: - if (gSaveContext.timer_1_state == 14) - { + if (gSaveContext.timer_1_state == 14) { if (gSaveContext.health_capacity > 0xA0) gSaveContext.timer_y[0] = 54; else gSaveContext.timer_y[0] = 46; } - if (gSaveContext.timer_1_state >= 3) - { + if (gSaveContext.timer_1_state >= 3) { D_8015FFE0--; - if (D_8015FFE0 == 0) - { + if (D_8015FFE0 == 0) { gSaveContext.timer_1_value++; D_8015FFE0 = 20; - if (gSaveContext.timer_1_value == 3599) - { + if (gSaveContext.timer_1_value == 3599) { gSaveContext.timer_1_state = 15; D_8015FFE2 = 40; - } - else - { - Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + } else { + Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, &D_801333E0, + &D_801333E0, &D_801333E8); } } } break; case 10: - if (gSaveContext.timer_2_state != 0) - { + if (gSaveContext.timer_2_state != 0) { gSaveContext.timer_x[1] = 140; gSaveContext.timer_y[1] = 80; D_8015FFE4 = D_8015FFE6 = 20; @@ -4349,9 +3692,7 @@ void Interface_Draw(GlobalContext* globalCtx) gSaveContext.timer_2_state = 8; gSaveContext.timer_1_state = 0; - } - else - { + } else { gSaveContext.timer_1_state = 0; } break; @@ -4359,8 +3700,7 @@ void Interface_Draw(GlobalContext* globalCtx) break; default: sp274 = 1; - switch (gSaveContext.timer_2_state) - { + switch (gSaveContext.timer_2_state) { case 1: case 7: gSaveContext.timer_x[1] = 140; @@ -4374,8 +3714,7 @@ void Interface_Draw(GlobalContext* globalCtx) case 2: case 8: D_8015FFE6--; - if (D_8015FFE6 == 0) - { + if (D_8015FFE6 == 0) { D_8015FFE6 = 20; if (gSaveContext.timer_2_state == 2) gSaveContext.timer_2_state = 3; @@ -4398,8 +3737,7 @@ void Interface_Draw(GlobalContext* globalCtx) gSaveContext.timer_y[1] -= phi_s3; D_8015FFE6--; - if (D_8015FFE6 == 0) - { + if (D_8015FFE6 == 0) { gSaveContext.timer_x[1] = 26; D_8015FFE6 = 20; @@ -4415,70 +3753,54 @@ void Interface_Draw(GlobalContext* globalCtx) } case 4: case 10: - if ((gSaveContext.timer_2_state == 4) || (gSaveContext.timer_2_state == 10)) - { + if ((gSaveContext.timer_2_state == 4) || (gSaveContext.timer_2_state == 10)) { if (gSaveContext.health_capacity > 0xA0) gSaveContext.timer_y[1] = 54; else gSaveContext.timer_y[1] = 46; } - if (gSaveContext.timer_2_state >= 3) - { + if (gSaveContext.timer_2_state >= 3) { D_8015FFE4--; - if (D_8015FFE4 == 0) - { + if (D_8015FFE4 == 0) { D_8015FFE4 = 20; - if (gSaveContext.timer_2_state == 4) - { + if (gSaveContext.timer_2_state == 4) { gSaveContext.timer_2_value--; osSyncPrintf("TOTAL_EVENT_TM=%d\n", gSaveContext.timer_2_value); - if (gSaveContext.timer_2_value <= 0) - { + if (gSaveContext.timer_2_value <= 0) { if (!Flags_GetSwitch(globalCtx, 0x37) || ((globalCtx->sceneNum != SCENE_GANON_DEMO) && (globalCtx->sceneNum != SCENE_GANON_FINAL) && (globalCtx->sceneNum != SCENE_GANON_SONOGO) && - (globalCtx->sceneNum != SCENE_GANONTIKA_SONOGO))) - { + (globalCtx->sceneNum != SCENE_GANONTIKA_SONOGO))) { gSaveContext.timer_2_state = 5; gSaveContext.cutscene_index = 0; D_8015FFE6 = 40; func_8010B680(globalCtx, 0x71B0, 0); func_8002DF54(globalCtx, 0, 8); - } - else - { + } else { gSaveContext.timer_2_state = 6; D_8015FFE6 = 40; } - } - else - { - if (gSaveContext.timer_2_value > 60) - { + } else { + if (gSaveContext.timer_2_value > 60) { if (sTimerDigits[4] == 1) - Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_WOMAN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } - else if (gSaveContext.timer_2_value > 10) - { + Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_WOMAN, &D_801333D4, 4, + &D_801333E0, &D_801333E0, &D_801333E8); + } else if (gSaveContext.timer_2_value > 10) { if (sTimerDigits[4] & 1) - Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } - else - { - Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_E, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, + &D_801333E0, &D_801333E0, &D_801333E8); + } else { + Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_E, &D_801333D4, 4, + &D_801333E0, &D_801333E0, &D_801333E8); } } - } - else - { + } else { gSaveContext.timer_2_value++; - if (gSaveContext.event_inf[1] & 1) - { - if (gSaveContext.timer_2_value == 240) - { + if (gSaveContext.event_inf[1] & 1) { + if (gSaveContext.timer_2_value == 240) { func_8010B680(globalCtx, 0x6083, 0); gSaveContext.timer_2_state = 0; gSaveContext.event_inf[1] &= ~1; @@ -4486,9 +3808,9 @@ void Interface_Draw(GlobalContext* globalCtx) } } - if ((gSaveContext.timer_2_value % 60) == 0) - { - Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + if ((gSaveContext.timer_2_value % 60) == 0) { + Audio_PlaySoundGeneral(NA_SE_SY_WARNING_COUNT_N, &D_801333D4, 4, &D_801333E0, + &D_801333E0, &D_801333E8); } } } @@ -4498,12 +3820,11 @@ void Interface_Draw(GlobalContext* globalCtx) if (D_8015FFE6 == 0) gSaveContext.timer_2_state = 0; break; - } + } } if (((gSaveContext.timer_1_state != 0) && (gSaveContext.timer_1_state != 10)) || - (gSaveContext.timer_2_state != 0)) - { + (gSaveContext.timer_2_state != 0)) { sTimerDigits[0] = sTimerDigits[1] = sTimerDigits[3] = 0; sTimerDigits[2] = 10; // digit 10 is used as ':' (colon) @@ -4512,19 +3833,16 @@ void Interface_Draw(GlobalContext* globalCtx) else sTimerDigits[4] = gSaveContext.timer_2_value; - while (sTimerDigits[4] >= 60) - { + while (sTimerDigits[4] >= 60) { sTimerDigits[1]++; - if (sTimerDigits[1] >= 10) - { + if (sTimerDigits[1] >= 10) { sTimerDigits[1] -= 10; sTimerDigits[0]++; } sTimerDigits[4] -= 60; } - while (sTimerDigits[4] >= 10) - { + while (sTimerDigits[4] >= 10) { sTimerDigits[4] -= 10; sTimerDigits[3]++; } @@ -4533,43 +3851,30 @@ void Interface_Draw(GlobalContext* globalCtx) gDPPipeSync(gfxCtx->overlay.p++); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF); gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, 0x00); - gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, - D_02002000, - 16, 16, - gSaveContext.timer_x[sp274], - gSaveContext.timer_y[sp274] + 2, - 16, 16, - 1024, 1024); + gfxCtx->overlay.p = Draw_TextureIA8(gfxCtx->overlay.p, D_02002000, 16, 16, gSaveContext.timer_x[sp274], + gSaveContext.timer_y[sp274] + 2, 16, 16, 1024, 1024); // Timer Counter gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, - 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, + TEXEL0, 0, PRIMITIVE, 0); - if (gSaveContext.timer_1_state != 0) - { + if (gSaveContext.timer_1_state != 0) { if ((gSaveContext.timer_1_value < 10) && (gSaveContext.timer_1_state < 11)) gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0x32, 0x00, 0xFF); else gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF); - } - else - { + } else { if ((gSaveContext.timer_2_value < 10) && (gSaveContext.timer_2_state < 6)) gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0x32, 0x00, 0xFF); else gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0x00, 0xFF); } - for (phi_s3 = 0; phi_s3 < 5; phi_s3++) - { - gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, - &D_02003040[sTimerDigits[phi_s3]], - 8, 16, + for (phi_s3 = 0; phi_s3 < 5; phi_s3++) { + gfxCtx->overlay.p = Draw_TextureI8(gfxCtx->overlay.p, &D_02003040[sTimerDigits[phi_s3]], 8, 16, gSaveContext.timer_x[sp274] + sTimerDigitLeftPos[phi_s3], - gSaveContext.timer_y[sp274], - sDigitWidth[phi_s3], VREG(42), + gSaveContext.timer_y[sp274], sDigitWidth[phi_s3], VREG(42), VREG(43) * 2, VREG(43) * 2); } } @@ -4579,8 +3884,7 @@ void Interface_Draw(GlobalContext* globalCtx) if (pauseCtx->flag == 3) func_8002AAB0(globalCtx); - if (interfaceCtx->unk_244 != 0) - { + if (interfaceCtx->unk_244 != 0) { gDPPipeSync(gfxCtx->overlay.p++); gSPDisplayList(gfxCtx->overlay.p++, sSetupDL_80125A60); gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0x00, 0x00, 0x00, interfaceCtx->unk_244); @@ -4600,52 +3904,40 @@ s16 sTimerDigits[5]; #ifdef NON_MATCHING // regalloc and minor ordering differences -void Interface_Update(GlobalContext* globalCtx) -{ +void Interface_Update(GlobalContext* globalCtx) { static u8 D_80125B60 = 0; static s16 D_80125B64 = 0; MessageContext* msgCtx = &globalCtx->msgCtx; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; Player* player = PLAYER; - s16 alpha; // sp+0x3A + s16 alpha; // sp+0x3A s16 alpha1; // sp+0x38 u16 action; Input* input = &globalCtx->state.input[2]; - if (!~(input->padPressed | -0x201)) - { + if (!~(input->padPressed | -0x201)) { gSaveContext.language = 0; osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language); - } - else if (!~(input->padPressed | -0x801)) - { + } else if (!~(input->padPressed | -0x801)) { gSaveContext.language = 1; osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language); - } - else if (!~(input->padPressed | -0x101)) - { + } else if (!~(input->padPressed | -0x101)) { gSaveContext.language = 2; osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language); } - if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0)) - { + if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0)) { if ((gSaveContext.minigame_state == 1) || (gSaveContext.scene_setup_index < 4) || - ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.scene_setup_index == 4))) - { - if ((msgCtx->msgMode == 0) || - ((msgCtx->msgMode != 0) && (globalCtx->sceneNum == SCENE_BOWLING))) - { - if (globalCtx->unk_10A20 == 0) - { + ((globalCtx->sceneNum == SCENE_SPOT20) && (gSaveContext.scene_setup_index == 4))) { + if ((msgCtx->msgMode == 0) || ((msgCtx->msgMode != 0) && (globalCtx->sceneNum == SCENE_BOWLING))) { + if (globalCtx->unk_10A20 == 0) { func_80083108(globalCtx); } } } } - switch (gSaveContext.unk_13E8) - { + switch (gSaveContext.unk_13E8) { case 1: case 2: case 3: @@ -4687,8 +3979,7 @@ void Interface_Update(GlobalContext* globalCtx) if (interfaceCtx->magicAlpha != 0xFF) interfaceCtx->magicAlpha = alpha1; - switch (globalCtx->sceneNum) - { + switch (globalCtx->sceneNum) { case SCENE_SPOT00: case SCENE_SPOT01: case SCENE_SPOT02: @@ -4735,8 +4026,7 @@ void Interface_Update(GlobalContext* globalCtx) func_8008226C(globalCtx); - if (gSaveContext.health_accumulator != 0) - { + if (gSaveContext.health_accumulator != 0) { gSaveContext.health_accumulator -= 4; gSaveContext.health += 4; @@ -4745,10 +4035,10 @@ void Interface_Update(GlobalContext* globalCtx) osSyncPrintf("now_life=%d max_life=%d\n", gSaveContext.health, gSaveContext.health_capacity); - if (gSaveContext.health >= gSaveContext.health_capacity) - { + if (gSaveContext.health >= gSaveContext.health_capacity) { gSaveContext.health = gSaveContext.health_capacity; - osSyncPrintf("S_Private.now_life=%d S_Private.max_life=%d\n", gSaveContext.health, gSaveContext.health_capacity); + osSyncPrintf("S_Private.now_life=%d S_Private.max_life=%d\n", gSaveContext.health, + gSaveContext.health_capacity); gSaveContext.health_accumulator = 0; } } @@ -4756,57 +4046,36 @@ void Interface_Update(GlobalContext* globalCtx) Health_HandleCriticalAlarm(globalCtx); D_80125A58 = func_8008F2F8(globalCtx); - if (D_80125A58 == 1) - { - if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 2) - { + if (D_80125A58 == 1) { + if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 2) { D_80125A58 = 0; } - } - else if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) - { - if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 3) - { + } else if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) { + if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 3) { D_80125A58 = 0; } } Health_UpdateData(globalCtx); - if ((gSaveContext.timer_1_state >= 3) && - (globalCtx->pauseCtx.state == 0) && - (globalCtx->pauseCtx.flag == 0) && - (msgCtx->msgMode == 0) && - !(player->stateFlags2 & 0x01000000) && - (globalCtx->sceneLoadFlag == 0) && - (globalCtx->unk_1241B == 0) && - (func_800BFC84(globalCtx) == 0)) - { + if ((gSaveContext.timer_1_state >= 3) && (globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && + (msgCtx->msgMode == 0) && !(player->stateFlags2 & 0x01000000) && (globalCtx->sceneLoadFlag == 0) && + (globalCtx->unk_1241B == 0) && (func_800BFC84(globalCtx) == 0)) {} - } - - if (gSaveContext.rupee_accumulator != 0) - { - if (gSaveContext.rupee_accumulator > 0) - { - if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) - { + if (gSaveContext.rupee_accumulator != 0) { + if (gSaveContext.rupee_accumulator > 0) { + if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) { gSaveContext.rupee_accumulator--; gSaveContext.rupees++; Audio_PlaySoundGeneral(NA_SE_SY_RUPY_COUNT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } - else - { + } else { // Translates to: "Rupee Amount MAX = %d" osSyncPrintf("ルピー数MAX = %d\n", CUR_CAPACITY(UPG_WALLET)); gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET); gSaveContext.rupee_accumulator = 0; } - } - else if (gSaveContext.rupees != 0) - { - if (gSaveContext.rupee_accumulator <= -50) - { + } else if (gSaveContext.rupees != 0) { + if (gSaveContext.rupee_accumulator <= -50) { gSaveContext.rupee_accumulator += 10; gSaveContext.rupees -= 10; @@ -4814,34 +4083,27 @@ void Interface_Update(GlobalContext* globalCtx) gSaveContext.rupees = 0; Audio_PlaySoundGeneral(NA_SE_SY_RUPY_COUNT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } - else - { + } else { gSaveContext.rupee_accumulator++; gSaveContext.rupees--; Audio_PlaySoundGeneral(NA_SE_SY_RUPY_COUNT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } - } - else - { + } else { gSaveContext.rupee_accumulator = 0; } } - switch (interfaceCtx->unk_1EC) - { + switch (interfaceCtx->unk_1EC) { case 1: interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); - if (interfaceCtx->unk_1F4 >= 15700.0f) - { + if (interfaceCtx->unk_1F4 >= 15700.0f) { interfaceCtx->unk_1F4 = -15700.0f; interfaceCtx->unk_1EC = 2; } break; case 2: interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); - if (interfaceCtx->unk_1F4 >= 0.0f) - { + if (interfaceCtx->unk_1F4 >= 0.0f) { interfaceCtx->unk_1F4 = 0.0f; interfaceCtx->unk_1EC = 0; interfaceCtx->unk_1EE = interfaceCtx->unk_1F0; @@ -4853,16 +4115,14 @@ void Interface_Update(GlobalContext* globalCtx) break; case 3: interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); - if (interfaceCtx->unk_1F4 >= 15700.0f) - { + if (interfaceCtx->unk_1F4 >= 15700.0f) { interfaceCtx->unk_1F4 = -15700.0f; interfaceCtx->unk_1EC = 2; } break; case 4: interfaceCtx->unk_1F4 = interfaceCtx->unk_1F4 + (31400.0f / WREG(5)); - if (interfaceCtx->unk_1F4 >= 0.0f) - { + if (interfaceCtx->unk_1F4 >= 0.0f) { interfaceCtx->unk_1F4 = 0.0f; interfaceCtx->unk_1EC = 0; interfaceCtx->unk_1EE = interfaceCtx->unk_1F0; @@ -4878,10 +4138,8 @@ void Interface_Update(GlobalContext* globalCtx) if ((globalCtx->pauseCtx.state == 0) && (globalCtx->pauseCtx.flag == 0) && (msgCtx->msgMode == 0) && (globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_10A20 == 0) && (globalCtx->unk_1241B == 0) && - ((globalCtx->csCtx.state == 0) || (func_8008E988(globalCtx) == 0))) - { - if ((gSaveContext.magic_acquired != 0) && (gSaveContext.magic_level == 0)) - { + ((globalCtx->csCtx.state == 0) || (func_8008E988(globalCtx) == 0))) { + if ((gSaveContext.magic_acquired != 0) && (gSaveContext.magic_level == 0)) { gSaveContext.magic_level = gSaveContext.double_magic + 1; gSaveContext.unk_13F0 = 8; osSyncPrintf(VT_FGCOL(YELLOW)); @@ -4897,38 +4155,27 @@ void Interface_Update(GlobalContext* globalCtx) Interface_UpdateMagicBar(globalCtx); } - if (gSaveContext.timer_1_state == 0) - { - if (((D_80125A58 == 1) || (D_80125A58 == 2) || (D_80125A58 == 4)) && - ((gSaveContext.health >> 1) != 0)) - { + if (gSaveContext.timer_1_state == 0) { + if (((D_80125A58 == 1) || (D_80125A58 == 2) || (D_80125A58 == 4)) && ((gSaveContext.health >> 1) != 0)) { gSaveContext.timer_1_state = 1; gSaveContext.timer_x[0] = 140; gSaveContext.timer_y[0] = 80; D_80125A5C = 1; } - } - else - { - if (((D_80125A58 == 0) || (D_80125A58 == 3)) && - (gSaveContext.timer_1_state < 5)) - { + } else { + if (((D_80125A58 == 0) || (D_80125A58 == 3)) && (gSaveContext.timer_1_state < 5)) { gSaveContext.timer_1_state = 0; } } - if (gSaveContext.minigame_state == 1) - { + if (gSaveContext.minigame_state == 1) { gSaveContext.minigame_score += interfaceCtx->unk_23C; interfaceCtx->unk_23C = 0; - if (sHBAScoreTier == 0) - { + if (sHBAScoreTier == 0) { if (gSaveContext.minigame_score >= 1000) sHBAScoreTier++; - } - else if (sHBAScoreTier == 1) - { + } else if (sHBAScoreTier == 1) { if (gSaveContext.minigame_score >= 1500) sHBAScoreTier++; } @@ -4938,34 +4185,28 @@ void Interface_Update(GlobalContext* globalCtx) sHBAScoreDigits[2] = 0; sHBAScoreDigits[3] = gSaveContext.minigame_score; - while (sHBAScoreDigits[3] >= 1000) - { + while (sHBAScoreDigits[3] >= 1000) { sHBAScoreDigits[0]++; sHBAScoreDigits[3] -= 1000; } - while (sHBAScoreDigits[3] >= 100) - { + while (sHBAScoreDigits[3] >= 100) { sHBAScoreDigits[1]++; sHBAScoreDigits[3] -= 100; } - while (sHBAScoreDigits[3] >= 10) - { + while (sHBAScoreDigits[3] >= 10) { sHBAScoreDigits[2]++; sHBAScoreDigits[3] -= 10; } } - if (gSaveContext.unk_1422 != 0) - { + if (gSaveContext.unk_1422 != 0) { if ((msgCtx->unk_E3F0 != 0x31) && (gSaveContext.unk_1422 == 1)) globalCtx->msgCtx.unk_E3EE = 4; - if (globalCtx->unk_10A26 != 0) - { - if (gSaveContext.unk_1422 != 2) - { + if (globalCtx->unk_10A26 != 0) { + if (gSaveContext.unk_1422 != 2) { D_80125B60 = 0; if ((gSaveContext.day_time >= 0x4555) && (gSaveContext.day_time <= 0xC001)) D_80125B60 = 1; @@ -4973,39 +4214,29 @@ void Interface_Update(GlobalContext* globalCtx) gSaveContext.unk_1422 = 2; D_80125B64 = D_8011FB40; D_8011FB40 = 400; - } - else if ((D_80125B60 == 0) && (gSaveContext.day_time >= 0x4555) && (gSaveContext.day_time <= 0xC001)) - { + } else if ((D_80125B60 == 0) && (gSaveContext.day_time >= 0x4555) && (gSaveContext.day_time <= 0xC001)) { + gSaveContext.unk_1422 = 0; + D_8011FB40 = D_80125B64; + globalCtx->msgCtx.unk_E3EE = 4; + } else if (gSaveContext.day_time > 0xC001) { gSaveContext.unk_1422 = 0; D_8011FB40 = D_80125B64; globalCtx->msgCtx.unk_E3EE = 4; } - else if (gSaveContext.day_time > 0xC001) - { - gSaveContext.unk_1422 = 0; - D_8011FB40 = D_80125B64; - globalCtx->msgCtx.unk_E3EE = 4; - } - } - else if ((globalCtx->roomCtx.curRoom.unk_03 != 1) && (interfaceCtx->restrictions.sunsSong != 3)) - { - if ((gSaveContext.day_time >= 0x4555) && (gSaveContext.day_time < 0xC001)) - { + } else if ((globalCtx->roomCtx.curRoom.unk_03 != 1) && (interfaceCtx->restrictions.sunsSong != 3)) { + if ((gSaveContext.day_time >= 0x4555) && (gSaveContext.day_time < 0xC001)) { gSaveContext.next_day_time = 0; globalCtx->fadeOutTransition = 4; gSaveContext.transition_type = 2; globalCtx->unk_11DE9 = 1; - } - else - { + } else { gSaveContext.next_day_time = 0x8001; globalCtx->fadeOutTransition = 5; gSaveContext.transition_type = 3; globalCtx->unk_11DE9 = 1; } - if (globalCtx->sceneNum == SCENE_SPOT13) - { + if (globalCtx->sceneNum == SCENE_SPOT13) { globalCtx->fadeOutTransition = 0xE; gSaveContext.transition_type = 0xE; } @@ -5017,9 +4248,7 @@ void Interface_Update(GlobalContext* globalCtx) func_800F6964(30); gSaveContext.seq_index = 0xFF; gSaveContext.night_sfx = 0xFF; - } - else - { + } else { gSaveContext.unk_1422 = 3; } } diff --git a/src/code/z_play.c b/src/code/z_play.c index 96378ada9f..8494f9b99b 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,39 +1,33 @@ #include #include -void func_800BC450(GlobalContext* globalCtx) -{ - func_8005A7A8(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], - globalCtx->unk_1242B - 1, globalCtx); +void func_800BC450(GlobalContext* globalCtx) { + func_8005A7A8(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], globalCtx->unk_1242B - 1, + globalCtx); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BC490.s") -s32 func_800BC56C(GlobalContext* globalCtx, s16 arg1) -{ +s32 func_800BC56C(GlobalContext* globalCtx, s16 arg1) { return arg1 == globalCtx->unk_1242B; } -void func_800BC590(GlobalContext* globalCtx) -{ +void func_800BC590(GlobalContext* globalCtx) { osSyncPrintf("Game_play_shop_pr_vr_switch_set()\n"); - if (YREG(15) == 0x10) - { + if (YREG(15) == 0x10) { globalCtx->unk_1242B = 2; } } #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BC5E0.s") -void func_800BC88C(GlobalContext* globalCtx) -{ +void func_800BC88C(GlobalContext* globalCtx) { globalCtx->unk_123F0 = -1; } -Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* a1) -{ - func_80093708(a1, globalCtx->lightCtx.unk_07, globalCtx->lightCtx.unk_08, - globalCtx->lightCtx.unk_09, 0, globalCtx->lightCtx.unk_0A, 1000); +Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* a1) { + func_80093708(a1, globalCtx->lightCtx.unk_07, globalCtx->lightCtx.unk_08, globalCtx->lightCtx.unk_09, 0, + globalCtx->lightCtx.unk_0A, 1000); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BC8EC.s") @@ -48,8 +42,7 @@ Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* a1) #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BFAE4.s") -s32 func_800BFC84(GlobalContext* globalCtx) -{ +s32 func_800BFC84(GlobalContext* globalCtx) { return globalCtx->csCtx.state != 0 || func_8008E988(globalCtx) != 0; } @@ -59,8 +52,7 @@ s32 func_800BFC84(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BFEC4.s") -void func_800BFF0C(GlobalContext* globalCtx, s32 a1) -{ +void func_800BFF0C(GlobalContext* globalCtx, s32 a1) { globalCtx->curSpawn = a1; globalCtx->linkActorEntry = NULL; globalCtx->unk_11DFC = NULL; @@ -85,8 +77,7 @@ void func_800BFF0C(GlobalContext* globalCtx, s32 a1) #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0230.s") -s16 func_800C030C(GlobalContext* globalCtx) -{ +s16 func_800C030C(GlobalContext* globalCtx) { return globalCtx->cameraCtx.unk_5C0; } @@ -120,8 +111,7 @@ s16 func_800C030C(GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0AF4.s") -void func_800C0B60(GlobalContext* globalCtx) -{ +void func_800C0B60(GlobalContext* globalCtx) { gSaveContext.respawn[RESPAWN_MODE_DOWN].temp_swch_flags = globalCtx->actorCtx.flags.tempSwch; gSaveContext.respawn[RESPAWN_MODE_DOWN].temp_collect_flags = globalCtx->actorCtx.flags.tempCollect; gSaveContext.respawn_flag = 1; @@ -130,48 +120,35 @@ void func_800C0B60(GlobalContext* globalCtx) globalCtx->fadeOutTransition = 2; } -void func_800C0BB4(GlobalContext* globalCtx) -{ +void func_800C0BB4(GlobalContext* globalCtx) { gSaveContext.respawn_flag = -1; globalCtx->sceneLoadFlag = 0x14; - if (globalCtx->sceneNum == SCENE_GANON_SONOGO || - globalCtx->sceneNum == SCENE_GANON_FINAL || - globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO || - globalCtx->sceneNum == SCENE_GANON_DEMO) - { + if (globalCtx->sceneNum == SCENE_GANON_SONOGO || globalCtx->sceneNum == SCENE_GANON_FINAL || + globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO || globalCtx->sceneNum == SCENE_GANON_DEMO) { globalCtx->nextEntranceIndex = 0x043F; Item_Give(globalCtx, ITEM_SWORD_MASTER); - } - else if (gSaveContext.entrance_index == 0x028A || - gSaveContext.entrance_index == 0x028E || - gSaveContext.entrance_index == 0x0292 || - gSaveContext.entrance_index == 0x0476) - { + } else if (gSaveContext.entrance_index == 0x028A || gSaveContext.entrance_index == 0x028E || + gSaveContext.entrance_index == 0x0292 || gSaveContext.entrance_index == 0x0476) { globalCtx->nextEntranceIndex = 0x01F9; - } - else - { + } else { globalCtx->nextEntranceIndex = gSaveContext.entrance_index; } globalCtx->fadeOutTransition = 2; } -void func_800C0C88(GlobalContext* globalCtx) -{ +void func_800C0C88(GlobalContext* globalCtx) { func_800C0AF4(globalCtx, 0, 0xDFF); func_800C0BB4(globalCtx); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0CB8.s") -s32 func_800C0D28(GlobalContext* globalCtx) -{ +s32 func_800C0D28(GlobalContext* globalCtx) { return globalCtx->unk_7B8 != 0; } #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0D34.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0DB4.s") - diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 3adf3bc21a..cf525ff24c 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -15,8 +15,7 @@ void PlayerCall_Destroy(Player* player, GlobalContext* globalCtx); void PlayerCall_Update(Player* player, GlobalContext* globalCtx); void PlayerCall_Draw(Player* player, GlobalContext* globalCtx); -const ActorInit Player_InitVars = -{ +const ActorInit Player_InitVars = { ACTOR_PLAYER, ACTORTYPE_PLAYER, 0, @@ -29,35 +28,30 @@ const ActorInit Player_InitVars = (ActorFunc)PlayerCall_Draw, }; -void PlayerCall_InitFuncPtrs() -{ +void PlayerCall_InitFuncPtrs() { sPlayerCallInitFunc = KaleidoManager_GetRamAddr(func_80846CD8); sPlayerCallDestroyFunc = KaleidoManager_GetRamAddr(func_8084AB54); sPlayerCallUpdateFunc = KaleidoManager_GetRamAddr(func_80849EA8); sPlayerCallDrawFunc = KaleidoManager_GetRamAddr(func_8084A5C4); } -void PlayerCall_Init(Player* player, GlobalContext* globalCtx) -{ +void PlayerCall_Init(Player* player, GlobalContext* globalCtx) { KaleidoScopeCall_LoadPlayer(); PlayerCall_InitFuncPtrs(); sPlayerCallInitFunc(player, globalCtx); } -void PlayerCall_Destroy(Player* player, GlobalContext* globalCtx) -{ +void PlayerCall_Destroy(Player* player, GlobalContext* globalCtx) { KaleidoScopeCall_LoadPlayer(); sPlayerCallDestroyFunc(player, globalCtx); } -void PlayerCall_Update(Player* player, GlobalContext* globalCtx) -{ +void PlayerCall_Update(Player* player, GlobalContext* globalCtx) { KaleidoScopeCall_LoadPlayer(); sPlayerCallUpdateFunc(player, globalCtx); } -void PlayerCall_Draw(Player* player, GlobalContext* globalCtx) -{ +void PlayerCall_Draw(Player* player, GlobalContext* globalCtx) { KaleidoScopeCall_LoadPlayer(); sPlayerCallDrawFunc(player, globalCtx); } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 06d2741ff5..4ddb530fe8 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -3,33 +3,22 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008E750.s") -UNK_TYPE func_8008E8DC(GlobalContext* globalCtx, Player* player) -{ - return ( - player->stateFlags1 & 0x20000080 || - player->action || - globalCtx->sceneLoadFlag == 0x14 || - player->stateFlags1 & 1 || - player->unk_692 & 0x80 || - gSaveContext.unk_13F0 && - func_8008F0D8(player, player->unk_154) >= 0 - ); - +UNK_TYPE func_8008E8DC(GlobalContext* globalCtx, Player* player) { + return (player->stateFlags1 & 0x20000080 || player->action || globalCtx->sceneLoadFlag == 0x14 || + player->stateFlags1 & 1 || player->unk_692 & 0x80 || + gSaveContext.unk_13F0 && func_8008F0D8(player, player->unk_154) >= 0); } -UNK_TYPE func_8008E988(GlobalContext* globalCtx) -{ +UNK_TYPE func_8008E988(GlobalContext* globalCtx) { Player* player = PLAYER; return func_8008E8DC(globalCtx, player) || player->unk_6AD == 4; } -UNK_TYPE func_8008E9C4(Player* player) -{ +UNK_TYPE func_8008E9C4(Player* player) { return player->stateFlags1 & 0x10; } -UNK_TYPE func_8008E9D0(Player* player) -{ +UNK_TYPE func_8008E9D0(Player* player) { return LINK_IS_CHILD && player->currentShield == 2; } @@ -41,8 +30,7 @@ UNK_TYPE func_8008E9D0(Player* player) #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EC04.s") -void func_8008EC70(Player* player) -{ +void func_8008EC70(Player* player) { player->unk_154 = player->unk_151; func_8008EC04(player, func_8008E9F8(player, player->unk_151)); player->unk_6AD = 0; @@ -50,19 +38,16 @@ void func_8008EC70(Player* player) #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008ECAC.s") -void func_8008ED9C(GlobalContext* globalCtx, Player* player, UNK_TYPE item, UNK_TYPE arg2) -{ +void func_8008ED9C(GlobalContext* globalCtx, Player* player, UNK_TYPE item, UNK_TYPE arg2) { Inventory_UpdateBottleItem(globalCtx, item, player->unk_150); - if (item != ITEM_BOTTLE) - { + if (item != ITEM_BOTTLE) { player->unk_152 = item; player->unk_151 = arg2; } player->unk_154 = arg2; } -void func_8008EDF0(Player* player) -{ +void func_8008EDF0(Player* player) { player->unk_664 = NULL; player->stateFlags2 &= ~0x2000; } @@ -71,8 +56,7 @@ void func_8008EDF0(Player* player) #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EEAC.s") -UNK_TYPE func_8008EF44(GlobalContext* globalCtx, UNK_TYPE arg1) -{ +UNK_TYPE func_8008EF44(GlobalContext* globalCtx, UNK_TYPE arg1) { globalCtx->unk_11E5C = (arg1 + 1); return 1; } @@ -81,69 +65,56 @@ UNK_TYPE func_8008EF44(GlobalContext* globalCtx, UNK_TYPE arg1) #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F034.s") -u8 func_8008F080(GlobalContext* globalCtx) -{ +u8 func_8008F080(GlobalContext* globalCtx) { Player* player = PLAYER; return player->currentMask; } -void func_8008F08C(GlobalContext* globalCtx) -{ +void func_8008F08C(GlobalContext* globalCtx) { Player* player = PLAYER; player->currentMask = 0; } -UNK_TYPE func_8008F098(GlobalContext* globalCtx) -{ +UNK_TYPE func_8008F098(GlobalContext* globalCtx) { Player* player = PLAYER; return player->currentShield == 3; } -UNK_TYPE func_8008F0AC(GlobalContext* globalCtx) -{ +UNK_TYPE func_8008F0AC(GlobalContext* globalCtx) { Player* player = PLAYER; return player->unk_15D == 0xa && player->currentShield == 3; } -s32 func_8008F0D8(Player* player, UNK_TYPE arg1) -{ +s32 func_8008F0D8(Player* player, UNK_TYPE arg1) { s32 temp_v0 = arg1 - 0x15; - if (temp_v0 >= 0 && temp_v0 < 6) - { + if (temp_v0 >= 0 && temp_v0 < 6) { return temp_v0; } return -1; } -UNK_TYPE func_8008F104(Player* player) -{ +UNK_TYPE func_8008F104(Player* player) { return player->unk_151 == 0x10 || player->unk_151 == 0x11; } -UNK_TYPE func_8008F128(Player* player) -{ +UNK_TYPE func_8008F128(Player* player) { return func_8008F104(player) && player->heldActor == NULL; } -s32 func_8008F158(UNK_TYPE arg0) -{ +s32 func_8008F158(UNK_TYPE arg0) { s32 temp_v0 = arg0 - 2; - if (temp_v0 > 0 && temp_v0 < 6) - { + if (temp_v0 > 0 && temp_v0 < 6) { return temp_v0; } return 0; } -void func_8008F180(Player* player) -{ +void func_8008F180(Player* player) { func_8008F158(player->unk_151); } -UNK_TYPE func_8008F1A0(Player* player) -{ - if (player->unk_151 >= 5 && player->unk_151 < 8) - { +UNK_TYPE func_8008F1A0(Player* player) { + if (player->unk_151 >= 5 && player->unk_151 < 8) { return 1; } return 0; @@ -151,33 +122,27 @@ UNK_TYPE func_8008F1A0(Player* player) #pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F1CC.s") -s32 func_8008F224(Player* player, UNK_TYPE arg1) -{ +s32 func_8008F224(Player* player, UNK_TYPE arg1) { s32 temp_v0 = arg1 - 0x1E; - if (temp_v0 >= 0 && temp_v0 < 0xD) - { + if (temp_v0 >= 0 && temp_v0 < 0xD) { return temp_v0; } return -1; } -void func_8008F250(Player* player) -{ +void func_8008F250(Player* player) { func_8008F224(player, player->unk_151); } -s32 func_8008F270(Player* player, UNK_TYPE arg1) -{ +s32 func_8008F270(Player* player, UNK_TYPE arg1) { s32 temp_v0 = arg1 - 0x12; - if (temp_v0 >= 0 && temp_v0 < 2) - { + if (temp_v0 >= 0 && temp_v0 < 2) { return temp_v0; } return -1; } -s32 func_8008F29C(Player* player) -{ +s32 func_8008F29C(Player* player) { return func_8008F270(player, player->unk_151); } diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c index 1ea8137044..26482f38ea 100644 --- a/src/code/z_prenmi.c +++ b/src/code/z_prenmi.c @@ -2,23 +2,20 @@ #include #include -void func_80092320(PreNMIContext* prenmiCtx) -{ +void func_80092320(PreNMIContext* prenmiCtx) { prenmiCtx->state.running = false; prenmiCtx->state.init = NULL; prenmiCtx->state.size = 0; } -void PreNMI_Update(PreNMIContext* prenmiCtx) -{ +void PreNMI_Update(PreNMIContext* prenmiCtx) { osSyncPrintf(VT_COL(YELLOW, BLACK) "prenmi_move\n" VT_RST); // Strings existing only in rodata ("../z_prenmi.c"); ("(int)volume = %d\n"); - if (prenmiCtx->timer == 0) - { + if (prenmiCtx->timer == 0) { ViConfig_UpdateVi(1); func_80092320(prenmiCtx); return; @@ -27,8 +24,7 @@ void PreNMI_Update(PreNMIContext* prenmiCtx) prenmiCtx->timer--; } -void PreNMI_Draw(PreNMIContext* prenmiCtx) -{ +void PreNMI_Draw(PreNMIContext* prenmiCtx) { GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -45,21 +41,17 @@ void PreNMI_Draw(PreNMIContext* prenmiCtx) func_800C6B54(gfxArr, gfxCtx, "../z_prenmi.c", 112); } -void PreNMI_Main(PreNMIContext* prenmiCtx) -{ +void PreNMI_Main(PreNMIContext* prenmiCtx) { PreNMI_Update(prenmiCtx); PreNMI_Draw(prenmiCtx); prenmiCtx->state.unk_A0 = 1; } -void PreNMI_Destroy(PreNMIContext* prenmiCtx) -{ - +void PreNMI_Destroy(PreNMIContext* prenmiCtx) { } -void PreNMI_Init(PreNMIContext* prenmiCtx) -{ +void PreNMI_Init(PreNMIContext* prenmiCtx) { prenmiCtx->state.main = PreNMI_Main; prenmiCtx->state.destroy = PreNMI_Destroy; prenmiCtx->timer = 30; diff --git a/src/code/z_prenmi_buff.c b/src/code/z_prenmi_buff.c index 5616e3b798..9c5924bc98 100644 --- a/src/code/z_prenmi_buff.c +++ b/src/code/z_prenmi_buff.c @@ -1,20 +1,15 @@ #include #include -#define COLD_RESET 0 -#define NMI 1 +#define COLD_RESET 0 +#define NMI 1 - -void PreNmiBuff_Init(PreNmiBuff* this) -{ +void PreNmiBuff_Init(PreNmiBuff* this) { this->resetting = false; - if (osResetType == COLD_RESET) - { + if (osResetType == COLD_RESET) { this->resetCount = 0; this->duration = 0; - } - else - { + } else { this->resetCount++; this->duration += this->resetTime; } @@ -22,14 +17,11 @@ void PreNmiBuff_Init(PreNmiBuff* this) this->resetTime = 0; } - -void PreNmiBuff_SetReset(PreNmiBuff* this) -{ +void PreNmiBuff_SetReset(PreNmiBuff* this) { this->resetting = true; this->resetTime = osGetTime(); } -u32 PreNmiBuff_IsResetting(PreNmiBuff* this) -{ +u32 PreNmiBuff_IsResetting(PreNmiBuff* this) { return this->resetting; } diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 27d7503152..4aa711e00d 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -133,29 +133,25 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094E54.s") -Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y) -{ +Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y) { return Draw_TexScroll(gfxCtx, x, y, 0, 0); } -Gfx* Draw_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height) -{ +Gfx* Draw_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height) { Gfx* displayList = Graph_Alloc(gfxCtx, 3 * sizeof(Gfx)); x %= 2048; y %= 2048; gDPTileSync(displayList); - gDPSetTileSize(displayList+1, 0, x, y, - (x+((width-1)<<2)), (y+((height-1)<<2))); - gSPEndDisplayList(displayList+2); + gDPSetTileSize(displayList + 1, 0, x, y, (x + ((width - 1) << 2)), (y + ((height - 1) << 2))); + gSPEndDisplayList(displayList + 2); return displayList; } -Gfx* Draw_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, - s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2) -{ +Gfx* Draw_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, + u32 y2, s32 width2, s32 height2) { Gfx* displayList = Graph_Alloc(gfxCtx, 5 * sizeof(Gfx)); x1 %= 2048; @@ -164,20 +160,16 @@ Gfx* Draw_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 w y2 %= 2048; gDPTileSync(displayList); - gDPSetTileSize(displayList+1, tile1, x1, y1, - (x1+((width1-1)<<2)), (y1+((height1-1)<<2))); - gDPTileSync(displayList+2); - gDPSetTileSize(displayList+3, tile2, x2, y2, - (x2+((width2-1)<<2)), (y2+((height2-1)<<2))); - gSPEndDisplayList(displayList+4); + gDPSetTileSize(displayList + 1, tile1, x1, y1, (x1 + ((width1 - 1) << 2)), (y1 + ((height1 - 1) << 2))); + gDPTileSync(displayList + 2); + gDPSetTileSize(displayList + 3, tile2, x2, y2, (x2 + ((width2 - 1) << 2)), (y2 + ((height2 - 1) << 2))); + gSPEndDisplayList(displayList + 4); return displayList; } -Gfx* Draw_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, - s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2, - s32 red, s32 green, s32 blue, s32 alpha) -{ +Gfx* Draw_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, + u32 x2, u32 y2, s32 width2, s32 height2, s32 red, s32 green, s32 blue, s32 alpha) { Gfx* displayList = Graph_Alloc(gfxCtx, 6 * sizeof(Gfx)); x1 %= 2048; @@ -186,13 +178,11 @@ Gfx* Draw_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y y2 %= 2048; gDPTileSync(displayList); - gDPSetTileSize(displayList+1, tile1, x1, y1, - (x1+((width1-1)<<2)), (y1+((height1-1)<<2))); - gDPTileSync(displayList+2); - gDPSetTileSize(displayList+3, tile2, x2, y2, - (x2+((width2-1)<<2)), (y2+((height2-1)<<2))); - gDPSetEnvColor(displayList+4, red, green, blue, alpha); - gSPEndDisplayList(displayList+5); + gDPSetTileSize(displayList + 1, tile1, x1, y1, (x1 + ((width1 - 1) << 2)), (y1 + ((height1 - 1) << 2))); + gDPTileSync(displayList + 2); + gDPSetTileSize(displayList + 3, tile2, x2, y2, (x2 + ((width2 - 1) << 2)), (y2 + ((height2 - 1) << 2))); + gDPSetEnvColor(displayList + 4, red, green, blue, alpha); + gSPEndDisplayList(displayList + 5); return displayList; } @@ -202,4 +192,3 @@ Gfx* Draw_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y #pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80095248.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80095974.s") - diff --git a/src/code/z_room.c b/src/code/z_room.c index 79c0d2bf6e..f9973bfeaf 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -9,14 +9,13 @@ void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags); Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f }; // unused -Gfx D_801270B0[] = -{ +Gfx D_801270B0[] = { gsDPPipeSync(), gsSPClearGeometryMode(G_ZBUFFER | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD), gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF), gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE), - gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | - G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_PERSP | G_CYC_FILL | G_PM_NPRIMITIVE, + gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_PERSP | G_CYC_FILL | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2), gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH), gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, 320, 240), @@ -24,21 +23,17 @@ Gfx D_801270B0[] = gsSPEndDisplayList(), }; -void (*sRoomDrawHandlers[])(GlobalContext* globalCtx, Room* room, u32 flags) = -{ +void (*sRoomDrawHandlers[])(GlobalContext* globalCtx, Room* room, u32 flags) = { func_80095AB4, func_80096F6C, func_80095D04, }; -void func_80095AA0(GlobalContext* globalCtx, Room* room, UNK_TYPE arg2, UNK_TYPE arg3) -{ - +void func_80095AA0(GlobalContext* globalCtx, Room* room, UNK_TYPE arg2, UNK_TYPE arg3) { } // Room Draw Polygon Type 0 -void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) -{ +void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) { s32 i; PolygonType0* polygon0; PolygonDlist* polygonDlist; @@ -48,16 +43,14 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 193); - if (flags & 1) - { + if (flags & 1) { func_800342EC(&D_801270A0, globalCtx); gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); func_80093C80(globalCtx); gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } - if (flags & 2) - { + if (flags & 2) { func_8003435C(&D_801270A0, globalCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); @@ -66,13 +59,14 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) polygon0 = &room->mesh->polygon0; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon0->start); - for (i = 0; i < polygon0->num; i++) - { - if ((flags & 1) && (polygonDlist->opa != NULL)) + for (i = 0; i < polygon0->num; i++) { + if ((flags & 1) && (polygonDlist->opa != NULL)) { gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa); + } - if ((flags & 2) && (polygonDlist->xlu != NULL)) + if ((flags & 2) && (polygonDlist->xlu != NULL)) { gSPDisplayList(gfxCtx->polyXlu.p++, polygonDlist->xlu); + } polygonDlist++; } @@ -82,10 +76,9 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) #define SHAPE_SORT_MAX 64 -typedef struct struct_80095D04 -{ +typedef struct struct_80095D04 { /* 0x00 */ PolygonDlist2* unk_00; - /* 0x04 */ f32 unk_04; + /* 0x04 */ f32 unk_04; /* 0x08 */ struct struct_80095D04* unk_08; /* 0x0C */ struct struct_80095D04* unk_0C; } struct_80095D04; // size = 0x10 @@ -93,8 +86,7 @@ typedef struct struct_80095D04 // Room Draw Polygon Type 2 #ifdef NON_MATCHING // this function still needs some work -void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) -{ +void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { PolygonType2* polygon2; PolygonDlist2* polygonDlist; struct_80095D04 spB8[SHAPE_SORT_MAX]; @@ -120,16 +112,14 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(sp5C, globalCtx->state.gfxCtx, "../z_room.c", 287); - if (flags & 1) - { + if (flags & 1) { func_800342EC(&D_801270A0, globalCtx); gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); func_80093C80(globalCtx); gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } - if (flags & 2) - { + if (flags & 2) { func_8003435C(&D_801270A0, globalCtx); gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); @@ -143,46 +133,36 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) __assert("polygon2->num <= SHAPE_SORT_MAX", "../z_room.c", 317); sp78 = polygonDlist; - for (sp9C = 0; sp9C < polygon2->num; sp9C++) - { + for (sp9C = 0; sp9C < polygon2->num; sp9C++) { sp90.x = polygonDlist->pos.x; sp90.y = polygonDlist->pos.y; sp90.z = polygonDlist->pos.z; func_800A6E10(&globalCtx->mf_11D60, &sp90, &sp84, &sp80); temp_f0 = polygonDlist->unk_06; - if (-temp_f0 < sp84.z) - { + if (-temp_f0 < sp84.z) { temp_f2 = sp84.z - temp_f0; - if (temp_f2 < globalCtx->lightCtx.unk_0C) - { + if (temp_f2 < globalCtx->lightCtx.unk_0C) { spA4->unk_00 = polygonDlist; spA4->unk_04 = temp_f2; phi_v0 = spB4; - if (spB4 == 0) - { + if (spB4 == 0) { spB0 = spA4; spB4 = spA4; spA4->unk_0C = NULL; spA4->unk_08 = NULL; - } - else - { - do - { + } else { + do { if (spA4->unk_04 < phi_v0->unk_04) break; phi_v0 = phi_v0->unk_0C; } while (phi_v0 != NULL); - if (phi_v0 == NULL) - { + if (phi_v0 == NULL) { spA4->unk_08 = spB0; spA4->unk_0C = NULL; spB0->unk_0C = spA4; spB0 = spA4; - } - else - { + } else { phi_a0 = phi_v0->unk_08; spA4->unk_08 = phi_a0; if (phi_a0 == NULL) @@ -190,7 +170,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) else phi_a0->unk_0C = spA4; phi_v0->unk_08 = spA4; - spA4->unk_0C = (void *) phi_v0; + spA4->unk_0C = (void*)phi_v0; } } spA4 = spA4++; @@ -202,32 +182,25 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) iREG(87) = polygon2->num; sp9C = 1; - while (spB4 != NULL) - { + while (spB4 != NULL) { phi_s0 = spB4->unk_00; - if (iREG(86) != 0) - { + if (iREG(86) != 0) { phi_v1 = 0; - while (phi_v1 < polygon2->num) - { + while (phi_v1 < polygon2->num) { if (phi_s0 == sp78) break; phi_v1++; sp78++; } - if (((iREG(86) == 1) && (iREG(89) > sp9C)) || - ((iREG(86) == 2) && (iREG(89) == sp9C))) - { + if (((iREG(86) == 1) && (iREG(89) > sp9C)) || ((iREG(86) == 2) && (iREG(89) == sp9C))) { if ((flags & 1) && (phi_s0->opa != NULL)) gSPDisplayList(gfxCtx->polyOpa.p++, phi_s0->opa); if ((flags & 2) && (phi_s0->xlu != NULL)) gSPDisplayList(gfxCtx->polyXlu.p++, phi_s0->xlu); } - } - else - { + } else { if ((flags & 1) && (phi_s0->opa != NULL)) gSPDisplayList(gfxCtx->polyOpa.p++, phi_s0->opa); @@ -251,14 +224,12 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) #ifdef NON_MATCHING // long multiplication by 64 doesn't quite match -s32 func_80096238(void* data) -{ +s32 func_80096238(void* data) { OSTime timeBefore; OSTime timeAfter; OSTime time; - if (*(u32*)data == JPEG_MARKER) - { + if (*(u32*)data == JPEG_MARKER) { // Translates to: "EXPANDING JPEG DATA" osSyncPrintf("JPEGデータを展開します\n"); // Translates to: "JPEG DATA ADDRESS %08x" @@ -267,8 +238,7 @@ s32 func_80096238(void* data) osSyncPrintf("ワークバッファアドレス(Zバッファ)%08x\n", gZBuffer); timeBefore = osGetTime(); - if (!func_8006E418(data, gZBuffer, gGfxSPTaskOutputBuffer, sizeof(gGfxSPTaskOutputBuffer))) - { + if (!func_8006E418(data, gZBuffer, gGfxSPTaskOutputBuffer, sizeof(gGfxSPTaskOutputBuffer))) { timeAfter = osGetTime(); time = ((timeAfter - timeBefore) * 64) / 3000; @@ -280,9 +250,7 @@ s32 func_80096238(void* data) osSyncPrintf("元のバッファのサイズが150キロバイト無いと暴走するでしょう。\n"); bcopy(gZBuffer, data, sizeof(gZBuffer)); - } - else - { + } else { // Translates to: "FAILURE! WHY IS IT 〜" osSyncPrintf("失敗!なんで〜\n"); } @@ -296,8 +264,8 @@ s32 func_80096238(void* data) #ifdef NON_MATCHING // pointer arithmetic doesn't quite match -void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, u16 tlutCount, f32 frameX, f32 frameY) -{ +void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, + u16 tlutCount, f32 frameX, f32 frameY) { Gfx* displayListHead; uObjBg* bg; @@ -305,7 +273,7 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh func_80096238(SEGMENTED_TO_VIRTUAL(source)); displayListHead++; - gSPBranchList(displayListHead, displayListHead+5); + gSPBranchList(displayListHead, displayListHead + 5); bg = (void*)displayListHead; bg->b.imageX = 0; bg->b.imageW = width * 4; @@ -320,45 +288,36 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh bg->b.imagePal = 0; bg->b.imageFlip = 0; - if (fmt == G_IM_FMT_CI) - { - displayListHead = (void*)(bg+1); + if (fmt == G_IM_FMT_CI) { + displayListHead = (void*)(bg + 1); gDPLoadTLUT(displayListHead++, tlutCount, 256, tlut); - } - else - { - displayListHead = (void*)(bg+1); + } else { + displayListHead = (void*)(bg + 1); gDPPipeSync(displayListHead++); } - if ((fmt == G_IM_FMT_RGBA) && (SREG(26) == 0)) - { + if ((fmt == G_IM_FMT_RGBA) && (SREG(26) == 0)) { bg->b.frameW = width * 4; bg->b.frameH = height * 4; func_80104B00(bg); gDPSetOtherMode(displayListHead++, - mode0 | G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | - G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE, + mode0 | G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | + G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); gSPBgRectCopy(displayListHead++, bg); - } - else - { + } else { bg->s.frameW = width * 4; bg->s.frameH = height * 4; bg->s.scaleW = 1024; bg->s.scaleH = 1024; bg->s.imageYorig = bg->b.imageY; gDPSetOtherMode(displayListHead++, - mode0 | G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | - G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_THRESHOLD | G_ZS_PIXEL | AA_EN | - CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL | - GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA) | - GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA)); - gDPSetCombineLERP(displayListHead++, - 0, 0, 0, TEXEL0, 0, 0, 0, 1, - 0, 0, 0, TEXEL0, 0, 0, 0, 1); + mode0 | G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | + G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_THRESHOLD | G_ZS_PIXEL | AA_EN | CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL | + GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA) | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA)); + gDPSetCombineLERP(displayListHead++, 0, 0, 0, TEXEL0, 0, 0, 0, 1, 0, 0, 0, TEXEL0, 0, 0, 0, 1); gSPObjRenderMode(displayListHead++, 0x0C); // unknown object render mode? gSPBgRect1Cyc(displayListHead++, bg); } @@ -367,13 +326,13 @@ void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 heigh *displayList = displayListHead; } #else -void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, u16 tlutCount, f32 frameX, f32 frameY); +void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, + u16 tlutCount, f32 frameX, f32 frameY); #pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8009638C.s") #endif // Room Draw Polygon Type 1 - Single Format -void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) -{ +void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { Camera* camera; Gfx* spA8; PolygonType1* polygon1; @@ -396,33 +355,27 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) sp94 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2); sp90 = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4); - if (sp94 || sp98) - { + if (sp94 || sp98) { gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); - if (sp94) - { + if (sp94) { func_80093D18(globalCtx->state.gfxCtx); gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa); } - if (sp98) - { + if (sp98) { // gSPLoadUcodeL(gfxCtx->polyOpa.p++, rspS2DEX)? gSPLoadUcodeEx(gfxCtx->polyOpa.p++, D_00113070, D_001579A0, 0x800); - if (1) - { + if (1) { Vec3f sp60; spA8 = gfxCtx->polyOpa.p; func_8005AFB4(&sp60, camera); - func_8009638C(&spA8, polygon1->single.source, polygon1->single.tlut, - polygon1->single.width, polygon1->single.height, - polygon1->single.fmt, polygon1->single.siz, + func_8009638C(&spA8, polygon1->single.source, polygon1->single.tlut, polygon1->single.width, + polygon1->single.height, polygon1->single.fmt, polygon1->single.siz, polygon1->single.mode0, polygon1->single.tlutCount, - (sp60.x + sp60.z) * 1.2f + sp60.y * 0.6f, - sp60.y * 2.4f + (sp60.x + sp60.z) * 0.3f); + (sp60.x + sp60.z) * 1.2f + sp60.y * 0.6f, sp60.y * 2.4f + (sp60.x + sp60.z) * 0.3f); gfxCtx->polyOpa.p = spA8; } @@ -431,8 +384,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) } } - if (sp90) - { + if (sp90) { gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); @@ -442,16 +394,14 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 691); } -typedef struct -{ +typedef struct { char unk_00[0x0E]; - s16 unk_0E; + s16 unk_0E; } struct_80041C10_ret; extern struct_80041C10_ret* func_80041C10(CollisionContext*, s32, s32); -BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) -{ +BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { Camera* camera; s32 camId; s16 camId2; @@ -462,17 +412,18 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) camera = globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]; camId = camera->unk_148; camId2 = func_80041C10(&globalCtx->colCtx, camId, 50)->unk_0E; - if (camId2 >= 0) + if (camId2 >= 0) { camId = camId2; + } player = PLAYER; player->actor.params = (player->actor.params & 0xFF00) | camId; bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list); - for (i = 0; i < polygon1->multi.count; i++) - { - if (bgImage->id == camId) + for (i = 0; i < polygon1->multi.count; i++) { + if (bgImage->id == camId) { return bgImage; + } bgImage++; } @@ -486,8 +437,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) // Room Draw Polygon Type 1 - Multi Format #ifdef NON_MATCHING // regalloc differences -void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) -{ +void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { Camera* camera; Gfx* spA8; BgImage* bgImage; @@ -512,33 +462,26 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) sp90 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2); sp8C = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4); - if (sp90 || sp94) - { + if (sp90 || sp94) { gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); - if (sp90) - { + if (sp90) { func_80093D18(globalCtx->state.gfxCtx); gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa); } - if (sp94) - { + if (sp94) { // gSPLoadUcodeL(gfxCtx->polyOpa.p++, rspS2DEX)? gSPLoadUcodeEx(gfxCtx->polyOpa.p++, D_00113070, D_001579A0, 0x800); - if (1) - { + if (1) { Vec3f sp5C; spA8 = gfxCtx->polyOpa.p; func_8005AFB4(&sp5C, camera); - func_8009638C(&spA8, bgImage->source, bgImage->tlut, - bgImage->width, bgImage->height, - bgImage->fmt, bgImage->siz, - bgImage->mode0, bgImage->tlutCount, - (sp5C.x + sp5C.z) * 1.2f + sp5C.y * 0.6f, - sp5C.y * 2.4f + (sp5C.x + sp5C.z) * 0.3f); + func_8009638C(&spA8, bgImage->source, bgImage->tlut, bgImage->width, bgImage->height, bgImage->fmt, + bgImage->siz, bgImage->mode0, bgImage->tlutCount, + (sp5C.x + sp5C.z) * 1.2f + sp5C.y * 0.6f, sp5C.y * 2.4f + (sp5C.x + sp5C.z) * 0.3f); gfxCtx->polyOpa.p = spA8; } @@ -547,8 +490,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) } } - if (sp8C) - { + if (sp8C) { gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); @@ -562,28 +504,26 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) #endif // Room Draw Polygon Type 1 -void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) -{ +void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags) { PolygonType1* polygon1 = &room->mesh->polygon1; - if (polygon1->format == 1) + if (polygon1->format == 1) { func_80096680(globalCtx, room, flags); - else if (polygon1->format == 2) + } else if (polygon1->format == 2) { func_80096B6C(globalCtx, room, flags); - else + } else { LogUtils_HungupThread("../z_room.c", 841); + } } -void func_80096FD4(GlobalContext* globalCtx, Room* room) -{ +void func_80096FD4(GlobalContext* globalCtx, Room* room) { room->num = -1; room->segment = NULL; } #ifdef NON_MATCHING // regalloc differences -u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) -{ +u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { RomFile* roomList; TransitionActorEntry* transitionActor; s32 i, j; @@ -598,30 +538,27 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) maxRoomSize = 0; roomList = globalCtx->roomList; - for (i = 0; i < globalCtx->nbRooms; i++) - { + for (i = 0; i < globalCtx->nbRooms; i++) { roomSize = roomList[i].vromEnd - roomList[i].vromStart; osSyncPrintf("ROOM%d size=%d\n", i, roomSize); if (maxRoomSize < roomSize) maxRoomSize = roomSize; } - if (globalCtx->nbTransitionActors != 0) - { + if (globalCtx->nbTransitionActors != 0) { j = 0; roomList = globalCtx->roomList; transitionActor = &globalCtx->transitionActorList[0]; LogUtils_LogThreadId("../z_room.c", 912); osSyncPrintf("game_play->room_rom_address.num = %d\n", globalCtx->nbRooms); - for (j = 0; j < globalCtx->nbTransitionActors; j++) - { + for (j = 0; j < globalCtx->nbTransitionActors; j++) { frontRoom = transitionActor->frontRoom; backRoom = transitionActor->backRoom; frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart; backRoomSize = (backRoom < 0) ? 0 : roomList[backRoom].vromEnd - roomList[backRoom].vromStart; cumulRoomSize = (frontRoom != backRoom) ? frontRoomSize + backRoomSize : frontRoomSize; - osSyncPrintf("DOOR%d=<%d> ROOM1=<%d, %d> ROOM2=<%d, %d>\n", - j, cumulRoomSize, frontRoom, frontRoomSize, backRoom, backRoomSize); + osSyncPrintf("DOOR%d=<%d> ROOM1=<%d, %d> ROOM2=<%d, %d>\n", j, cumulRoomSize, frontRoom, frontRoomSize, + backRoom, backRoomSize); if (maxRoomSize < cumulRoomSize) maxRoomSize = cumulRoomSize; transitionActor++; @@ -642,7 +579,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) roomCtx->status = 0; if (gSaveContext.respawn_flag > 0) - nextRoomNum = gSaveContext.respawn[gSaveContext.respawn_flag-1].room_index; + nextRoomNum = gSaveContext.respawn[gSaveContext.respawn_flag - 1].room_index; else nextRoomNum = globalCtx->setupEntranceList[globalCtx->curSpawn].room; func_8009728C(globalCtx, roomCtx, nextRoomNum); @@ -653,30 +590,29 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) #pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_80096FE8.s") #endif -s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) -{ +s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { u32 size; - if (0) ; // Necessary to match + if (0) {} // Necessary to match - if (roomCtx->status == 0) - { + if (roomCtx->status == 0) { roomCtx->prevRoom = roomCtx->curRoom; roomCtx->curRoom.num = roomNum; roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - if (roomNum >= globalCtx->nbRooms) + if (roomNum >= globalCtx->nbRooms) { __assert("read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); + } size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart; roomCtx->unk_34 = (void*)ALIGN16((s32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); - if (0) ; // Also necessary to match + if (0) {} // Also necessary to match osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); - DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, - 0, &roomCtx->loadQueue, NULL, "../z_room.c", 1036); + DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0, + &roomCtx->loadQueue, NULL, "../z_room.c", 1036); roomCtx->unk_30 ^= 1; return 1; @@ -685,12 +621,9 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) return 0; } -s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) -{ - if (roomCtx->status == 1) - { - if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) - { +s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { + if (roomCtx->status == 1) { + if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { roomCtx->status = 0; roomCtx->curRoom.segment = roomCtx->unk_34; gSegments[3] = PHYSICAL_TO_VIRTUAL2(roomCtx->unk_34); @@ -708,25 +641,24 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) return 1; } -void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) -{ - if (room->segment != NULL) - { +void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) { + if (room->segment != NULL) { gSegments[3] = PHYSICAL_TO_VIRTUAL(room->segment); - if (room->mesh->polygon.type >= ARRAY_COUNTU(sRoomDrawHandlers)) + if (room->mesh->polygon.type >= ARRAY_COUNTU(sRoomDrawHandlers)) { __assert("this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125); + } sRoomDrawHandlers[room->mesh->polygon.type](globalCtx, room, flags); } } -void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx) -{ +void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx) { roomCtx->prevRoom.num = -1; roomCtx->prevRoom.segment = NULL; func_80031B14(globalCtx, &globalCtx->actorCtx); Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); func_80080E04(globalCtx, roomCtx->curRoom.num); - if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20))) + if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20))) { func_800807A0(globalCtx); + } func_800F66C0(globalCtx->roomCtx.curRoom.echo); } diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 9aaf1db51f..cbd9347010 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -2,10 +2,8 @@ #include #include -void Sample_Calc(SampleContext* this) -{ - if (!~(this->state.input[0].padPressed | ~START_BUTTON)) - { +void Sample_Calc(SampleContext* this) { + if (!~(this->state.input[0].padPressed | ~START_BUTTON)) { SET_NEXT_GAMESTATE(&this->state, func_800BCA64, GlobalContext); this->state.running = false; } @@ -13,8 +11,7 @@ void Sample_Calc(SampleContext* this) // very close from matching, the only difference is the place of "mtx" in the stack #ifdef NON_MATCHING -void Sample_Draw(SampleContext* this) -{ +void Sample_Draw(SampleContext* this) { u32 pad; GraphicsContext* gfxCtx = this->state.gfxCtx; View* view = &this->view; @@ -49,19 +46,15 @@ void Sample_Draw(SampleContext* this) #pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/Sample_Draw.s") #endif -void Sample_Update(SampleContext* this) -{ +void Sample_Update(SampleContext* this) { Sample_Draw(this); Sample_Calc(this); } -void Sample_Destroy(SampleContext* this) -{ - +void Sample_Destroy(SampleContext* this) { } -void Sample_SetupView(SampleContext* this) -{ +void Sample_SetupView(SampleContext* this) { View* view; GraphicsContext* gfxCtx; u32 v0[4]; @@ -94,16 +87,14 @@ void Sample_SetupView(SampleContext* this) func_800AA358(view, &v1, &v2, &v3); } -void Sample_LoadTitleStatic(SampleContext* this) -{ +void Sample_LoadTitleStatic(SampleContext* this) { u32 size = _title_staticSegmentRomEnd - _title_staticSegmentRomStart; - + this->staticSegment = Game_Alloc(&this->state, size, "../z_sample.c", 163); DmaMgr_SendRequest1(this->staticSegment, _title_staticSegmentRomStart, size, "../z_sample.c", 164); } -void Sample_Init(SampleContext* this) -{ +void Sample_Init(SampleContext* this) { this->state.main = Sample_Update; this->state.destroy = Sample_Destroy; R_UPDATE_RATE = 1; diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 2bd5522961..c8c97459cb 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -4,26 +4,31 @@ RomFile sNaviMsgFiles[]; -s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) -{ +s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) { u32 size; objectCtx->status[objectCtx->num].id = objectId; size = gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart; - osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", - objectId, (f64)(size / 1024.0f), objectCtx->status[objectCtx->num].segment); + osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectId, (f64)(size / 1024.0f), + objectCtx->status[objectCtx->num].segment); - osSyncPrintf("num=%d adrs=%x end=%x\n", - objectCtx->num, (s32)objectCtx->status[objectCtx->num].segment + size, objectCtx->spaceEnd); + osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (s32)objectCtx->status[objectCtx->num].segment + size, + objectCtx->spaceEnd); - if (!((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) && (((s32)objectCtx->status[objectCtx->num].segment + size) < (s32)objectCtx->spaceEnd))) - __assert("this->num < OBJECT_EXCHANGE_BANK_MAX && (this->status[this->num].Segment + size) < this->endSegment", "../z_scene.c", 142); + if (!((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) && + (((s32)objectCtx->status[objectCtx->num].segment + size) < (s32)objectCtx->spaceEnd))) { + __assert("this->num < OBJECT_EXCHANGE_BANK_MAX && (this->status[this->num].Segment + size) < this->endSegment", + "../z_scene.c", 142); + } - DmaMgr_SendRequest1(objectCtx->status[objectCtx->num].segment, gObjectTable[objectId].vromStart, size, "../z_scene.c", 145); + DmaMgr_SendRequest1(objectCtx->status[objectCtx->num].segment, gObjectTable[objectId].vromStart, size, + "../z_scene.c", 145); - if (objectCtx->num < OBJECT_EXCHANGE_BANK_MAX - 1) - objectCtx->status[objectCtx->num + 1].segment = (void*)ALIGN16((s32)objectCtx->status[objectCtx->num].segment + size); + if (objectCtx->num < OBJECT_EXCHANGE_BANK_MAX - 1) { + objectCtx->status[objectCtx->num + 1].segment = + (void*)ALIGN16((s32)objectCtx->status[objectCtx->num].segment + size); + } objectCtx->num++; objectCtx->unk_09 = objectCtx->num; @@ -31,35 +36,33 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) return objectCtx->num - 1; } -void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) -{ +void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) { GlobalContext* globalCtx2 = globalCtx; // Needs to be a new variable to match (possibly a sub struct?) u32 spaceSize; s32 i; - if (globalCtx2->sceneNum == SCENE_SPOT00) + if (globalCtx2->sceneNum == SCENE_SPOT00) { spaceSize = 1024000; - else if (globalCtx2->sceneNum == SCENE_GANON_DEMO) - { - if (gSaveContext.scene_setup_index != 4) + } else if (globalCtx2->sceneNum == SCENE_GANON_DEMO) { + if (gSaveContext.scene_setup_index != 4) { spaceSize = 1177600; - else + } else { spaceSize = 1024000; - } - else if (globalCtx2->sceneNum == SCENE_JYASINBOSS) + } + } else if (globalCtx2->sceneNum == SCENE_JYASINBOSS) { spaceSize = 1075200; - else if (globalCtx2->sceneNum == SCENE_KENJYANOMA) + } else if (globalCtx2->sceneNum == SCENE_KENJYANOMA) { spaceSize = 1075200; - else if (globalCtx2->sceneNum == SCENE_GANON_BOSS) + } else if (globalCtx2->sceneNum == SCENE_GANON_BOSS) { spaceSize = 1075200; - else + } else { spaceSize = 1024000; + } objectCtx->num = objectCtx->unk_09 = 0; objectCtx->mainKeepIndex = objectCtx->subKeepIndex = 0; - for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) - { + for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = 0; } @@ -68,37 +71,32 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) osSyncPrintf("オブジェクト入れ替えバンク情報 %8.3fKB\n", (f64)(spaceSize / 1024.0f)); osSyncPrintf(VT_RST); - objectCtx->spaceStart = objectCtx->status[0].segment = Game_Alloc(&globalCtx->state, spaceSize, "../z_scene.c", 219); + objectCtx->spaceStart = objectCtx->status[0].segment = + Game_Alloc(&globalCtx->state, spaceSize, "../z_scene.c", 219); objectCtx->spaceEnd = (void*)((s32)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP); gSegments[4] = PHYSICAL_TO_VIRTUAL(objectCtx->status[objectCtx->mainKeepIndex].segment); } -void Object_UpdateBank(ObjectContext* objectCtx) -{ +void Object_UpdateBank(ObjectContext* objectCtx) { s32 i; ObjectStatus* status; RomFile* objectFile; u32 size; status = &objectCtx->status[0]; - for (i = 0; i < objectCtx->num; i++) - { - if (status->id < 0) - { - if (status->dmaRequest.vromAddr == 0) - { + for (i = 0; i < objectCtx->num; i++) { + if (status->id < 0) { + if (status->dmaRequest.vromAddr == 0) { osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1); objectFile = &gObjectTable[-status->id]; size = objectFile->vromEnd - objectFile->vromStart; - osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", - i, (f64)(size / 1024.0f), status->segment); - DmaMgr_SendRequest2(&status->dmaRequest, status->segment, objectFile->vromStart, size, - 0, &status->loadQueue, NULL, "../z_scene.c", 266); - } - else if (!osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK)) - { + osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", i, (f64)(size / 1024.0f), + status->segment); + DmaMgr_SendRequest2(&status->dmaRequest, status->segment, objectFile->vromStart, size, 0, + &status->loadQueue, NULL, "../z_scene.c", 266); + } else if (!osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK)) { status->id = -status->id; } } @@ -106,47 +104,43 @@ void Object_UpdateBank(ObjectContext* objectCtx) } } -s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) -{ +s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) { s32 i; - for (i = 0; i < objectCtx->num; i++) - { - if (ABS(objectCtx->status[i].id) == objectId) + for (i = 0; i < objectCtx->num; i++) { + if (ABS(objectCtx->status[i].id) == objectId) { return i; + } } return -1; } -s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex) -{ - if (objectCtx->status[bankIndex].id > 0) +s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex) { + if (objectCtx->status[bankIndex].id > 0) { return 1; - else + } else { return 0; + } } -void func_800981B8(ObjectContext* objectCtx) -{ +void func_800981B8(ObjectContext* objectCtx) { s32 i; s32 id; u32 size; - for (i = 0; i < objectCtx->num; i++) - { + for (i = 0; i < objectCtx->num; i++) { id = objectCtx->status[i].id; size = gObjectTable[id].vromEnd - gObjectTable[id].vromStart; - osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", - objectCtx->status[i].id, (f64)(size / 1024.0f), objectCtx->status[i].segment); - osSyncPrintf("num=%d adrs=%x end=%x\n", - objectCtx->num, (s32)objectCtx->status[i].segment + size, objectCtx->spaceEnd); + osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectCtx->status[i].id, (f64)(size / 1024.0f), + objectCtx->status[i].segment); + osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (s32)objectCtx->status[i].segment + size, + objectCtx->spaceEnd); DmaMgr_SendRequest1(objectCtx->status[i].segment, gObjectTable[id].vromStart, size, "../z_scene.c", 342); } } -void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) -{ +void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) { ObjectStatus* status = &objectCtx->status[bankIndex]; RomFile* objectFile = &gObjectTable[objectId]; u32 size; @@ -156,14 +150,15 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) status->dmaRequest.vromAddr = 0; size = objectFile->vromEnd - objectFile->vromStart; - osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", - bankIndex, objectId, (f64)(size / 1024.0f)); + osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", bankIndex, objectId, (f64)(size / 1024.0f)); - if (1) // Necessary to match + if (1) { // Necessary to match nextPtr = (void*)ALIGN16((s32)status->segment + size); + } - if (nextPtr >= objectCtx->spaceEnd) + if (nextPtr >= objectCtx->spaceEnd) { __assert("nextptr < this->endSegment", "../z_scene.c", 381); + } // Translates to: "OBJECT EXCHANGE FREE SIZE=%08x" osSyncPrintf("オブジェクト入れ替え空きサイズ=%08x\n", (s32)objectCtx->spaceEnd - (s32)nextPtr); @@ -171,25 +166,21 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) return nextPtr; } -s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) -{ +s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) { u32 cmdCode; - while (1) - { + while (1) { cmdCode = sceneCmd->base.code; - osSyncPrintf("*** Scene_Word = { code=%d, data1=%02x, data2=%04x } ***\n", - cmdCode, sceneCmd->base.data1, sceneCmd->base.data2); + osSyncPrintf("*** Scene_Word = { code=%d, data1=%02x, data2=%04x } ***\n", cmdCode, sceneCmd->base.data1, + sceneCmd->base.data2); - if (cmdCode == 0x14) + if (cmdCode == 0x14) { break; - - if (cmdCode <= 0x19) - { - gSceneCmdHandlers[cmdCode](globalCtx, sceneCmd); } - else - { + + if (cmdCode <= 0x19) { + gSceneCmdHandlers[cmdCode](globalCtx, sceneCmd); + } else { osSyncPrintf(VT_FGCOL(RED)); // Translates to: "code VARIABLE IS ABNORMAL" osSyncPrintf("code の値が異常です\n"); @@ -205,8 +196,7 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd) // Scene Command 0x00: Link Spawn List #ifdef NON_MATCHING // regalloc differences -void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) { ActorEntry* linkEntry = (ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->spawnList.segment) + globalCtx->setupEntranceList[globalCtx->curSpawn].spawn; s16 linkObjectId; @@ -227,21 +217,18 @@ void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd); #endif // Scene Command 0x01: Actor List -void func_800985DC(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_800985DC(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->nbSetupActors = cmd->actorList.num; globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment); } // Scene Command 0x02: Cutscene Camera List -void func_80098630(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098630(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->csCameraList.segment); } // Scene Command 0x03: Collision Header -void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) { CollisionHeader* colHeader; colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.segment); @@ -256,34 +243,30 @@ void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) } // Scene Command 0x04: Room List -void func_800987A4(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_800987A4(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->nbRooms = cmd->roomList.num; globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment); } // Scene Command 0x06: Entrance List -void func_800987F8(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_800987F8(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupEntranceList = SEGMENTED_TO_VIRTUAL(cmd->entranceList.segment); } // Scene Command 0x07: Special Files -void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) -{ - if (cmd->specialFiles.keepObjectId != 0) - { +void func_8009883C(GlobalContext* globalCtx, SceneCmd* cmd) { + if (cmd->specialFiles.keepObjectId != 0) { globalCtx->objectCtx.subKeepIndex = Object_Spawn(&globalCtx->objectCtx, cmd->specialFiles.keepObjectId); gSegments[5] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); } - if (cmd->specialFiles.naviMsgNum != 0) + if (cmd->specialFiles.naviMsgNum != 0) { globalCtx->naviMsgSegment = func_800BFE5C(globalCtx, &sNaviMsgFiles[cmd->specialFiles.naviMsgNum - 1]); + } } // Scene Command 0x08: Room Behavior -void func_80098904(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098904(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->roomCtx.curRoom.unk_03 = cmd->roomBehavior.gpFlag1; globalCtx->roomCtx.curRoom.unk_02 = cmd->roomBehavior.gpFlag2 & 0xFF; globalCtx->roomCtx.curRoom.showInvisActors = (cmd->roomBehavior.gpFlag2 >> 8) & 1; @@ -291,16 +274,14 @@ void func_80098904(GlobalContext* globalCtx, SceneCmd* cmd) } // Scene Command 0x0A: Mesh Header -void func_80098958(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098958(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->roomCtx.curRoom.mesh = SEGMENTED_TO_VIRTUAL(cmd->mesh.segment); } // Scene Command 0x0B: Object List #ifdef NON_MATCHING // this function still needs some work -void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i, j, k; s16* objectEntry; ObjectStatus* status; @@ -313,21 +294,16 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) k = 0; status = status2; i = globalCtx->objectCtx.unk_09; - while (i < globalCtx->objectCtx.num) - { - if (status->id != *objectEntry) - { + while (i < globalCtx->objectCtx.num) { + if (status->id != *objectEntry) { status3 = status2; - for (j = i; j < globalCtx->objectCtx.num; j++) - { + for (j = i; j < globalCtx->objectCtx.num; j++) { status3->id = 0; status3++; } globalCtx->objectCtx.num = i; func_80031A28(globalCtx, &globalCtx->actorCtx); - } - else - { + } else { i++; status++; k++; @@ -339,8 +315,7 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) if (cmd->objectList.num > OBJECT_EXCHANGE_BANK_MAX) __assert("scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", "../z_scene.c", 705); - while (k < cmd->objectList.num) - { + while (k < cmd->objectList.num) { nextPtr = func_800982FC(&globalCtx->objectCtx, i, *objectEntry); if (i < OBJECT_EXCHANGE_BANK_MAX - 1) globalCtx->objectCtx.status[i + 1].segment = nextPtr; @@ -357,75 +332,69 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd); #endif // Scene Command 0x0C: Light List -void func_80098B74(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098B74(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i; LightInfo* lightInfo; lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.segment); - for (i = 0; i < cmd->lightList.num; i++) - { + for (i = 0; i < cmd->lightList.num; i++) { Lights_Insert(globalCtx, &globalCtx->lightCtx, lightInfo); lightInfo++; } } // Scene Command 0x0D: Path List -void func_80098C24(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098C24(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupPathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.segment); } // Scene Command 0x0E: Transition Actor List -void func_80098C68(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098C68(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->nbTransitionActors = cmd->transiActorList.num; globalCtx->transitionActorList = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); } -void func_80098CBC(GlobalContext* globalCtx, u8* nbTransitionActors) -{ +void func_80098CBC(GlobalContext* globalCtx, u8* nbTransitionActors) { *nbTransitionActors = 0; } // Scene Command 0x0F: Light Setting List -void func_80098CC8(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098CC8(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->nbLightSettings = cmd->lightSettingList.num; globalCtx->lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment); } // Scene Command 0x11: Skybox Settings -void func_80098D1C(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098D1C(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->skyboxId = cmd->skyboxSettings.skyboxId; globalCtx->gloomySky = globalCtx->unk_10A3C = cmd->skyboxSettings.unk_05; globalCtx->unk_10A42 = cmd->skyboxSettings.unk_06; } // Scene Command 0x12: Skybox Disables -void func_80098D5C(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098D5C(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->skyDisabled = cmd->skyboxDisables.unk_04; globalCtx->sunMoonDisabled = cmd->skyboxDisables.unk_05; } // Scene Command 0x10: Time Settings -void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) { u32 dayTime; - if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) + if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) { gSaveContext.environment_time = gSaveContext.day_time = ((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / 0.021972656f; + } - if (cmd->timeSettings.unk_06 != 0xFF) + if (cmd->timeSettings.unk_06 != 0xFF) { globalCtx->unk_10A26 = cmd->timeSettings.unk_06; - else + } else { globalCtx->unk_10A26 = 0; + } - if (gSaveContext.unk_1422 == 0) + if (gSaveContext.unk_1422 == 0) { D_8011FB40 = globalCtx->unk_10A26; + } dayTime = gSaveContext.day_time; globalCtx->unk_10A28 = -(Math_Sins(dayTime - 0x8000) * 120.0f) * 25.0f; @@ -435,23 +404,22 @@ void func_80098D80(GlobalContext* globalCtx, SceneCmd* cmd) globalCtx->unk_10A30 = (Math_Coss(dayTime - 0x8000) * 20.0f) * 25.0f; if (((globalCtx->unk_10A26 == 0) && (gSaveContext.cutscene_index < 0xFFF0)) || - (gSaveContext.entrance_index == 0x0604)) - { + (gSaveContext.entrance_index == 0x0604)) { gSaveContext.environment_time = gSaveContext.day_time; - if ((gSaveContext.environment_time >= 0x2AAC) && (gSaveContext.environment_time < 0x4555)) + if ((gSaveContext.environment_time >= 0x2AAC) && (gSaveContext.environment_time < 0x4555)) { gSaveContext.environment_time = 0x3556; - else if ((gSaveContext.environment_time >= 0x4555) && (gSaveContext.environment_time < 0x5556)) + } else if ((gSaveContext.environment_time >= 0x4555) && (gSaveContext.environment_time < 0x5556)) { gSaveContext.environment_time = 0x5556; - else if ((gSaveContext.environment_time >= 0xAAAB) && (gSaveContext.environment_time < 0xB556)) + } else if ((gSaveContext.environment_time >= 0xAAAB) && (gSaveContext.environment_time < 0xB556)) { gSaveContext.environment_time = 0xB556; - else if ((gSaveContext.environment_time >= 0xC001) && (gSaveContext.environment_time < 0xCAAC)) + } else if ((gSaveContext.environment_time >= 0xC001) && (gSaveContext.environment_time < 0xCAAC)) { gSaveContext.environment_time = 0xCAAC; + } } } // Scene Command 0x05: Wind Settings -void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) { s8 temp1 = cmd->windSettings.unk_04; s8 temp2 = cmd->windSettings.unk_05; s8 temp3 = cmd->windSettings.unk_06; @@ -463,38 +431,33 @@ void func_80099090(GlobalContext* globalCtx, SceneCmd* cmd) } // Scene Command 0x13: Exit List -void func_800990F0(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_800990F0(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupExitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.segment); } // Scene Command 0x09: Undefined -void func_80099134(GlobalContext* globalCtx, SceneCmd* cmd) -{ - +void func_80099134(GlobalContext* globalCtx, SceneCmd* cmd) { } // Scene Command 0x15: Sound Settings -void func_80099140(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_80099140(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->soundCtx.musicSeq = cmd->soundSettings.musicSeq; globalCtx->soundCtx.nighttimeSFX = cmd->soundSettings.nighttimeSFX; - if (gSaveContext.seq_index == 0xFF) + if (gSaveContext.seq_index == 0xFF) { Audio_SetBGM(cmd->soundSettings.bgmId | 0xF0000000); + } } // Scene Command 0x16: Echo Setting -void func_8009918C(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_8009918C(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->roomCtx.curRoom.echo = cmd->echoSettings.echo; } // Scene Command 0x18: Alternate Headers #ifdef NON_MATCHING // minor ordering and regalloc differences -void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) { SceneCmd** altHeaders; SceneCmd* altHeader; @@ -502,31 +465,25 @@ void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd) osSyncPrintf("\n[ZU]sceneset time =[%X]", gSaveContext.cutscene_index); osSyncPrintf("\n[ZU]sceneset counter=[%X]", gSaveContext.scene_setup_index); - if (gSaveContext.scene_setup_index != 0) - { + if (gSaveContext.scene_setup_index != 0) { altHeaders = SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment); altHeader = altHeaders[gSaveContext.scene_setup_index - 1]; - if (altHeader != NULL) - { + if (altHeader != NULL) { Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); (cmd + 1)->base.code = 0x14; - } - else - { + } else { // Translates to: "COUGHH! THERE IS NO SPECIFIED DATAAAAA!" osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!"); - if (gSaveContext.scene_setup_index == 3) - { + if (gSaveContext.scene_setup_index == 3) { altHeaders = SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment); altHeader = altHeaders[gSaveContext.scene_setup_index - 2]; // Translates to: "USING ADULT DAY DATA THERE!" osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!"); - if (altHeader != NULL) - { + if (altHeader != NULL) { Scene_ExecuteCommands(globalCtx, SEGMENTED_TO_VIRTUAL(altHeader)); (cmd + 1)->base.code = 0x14; } @@ -540,73 +497,47 @@ void func_800991A0(GlobalContext* globalCtx, SceneCmd* cmd); #endif // Scene Command 0x17: Cutscene Data -void func_8009934C(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_8009934C(GlobalContext* globalCtx, SceneCmd* cmd) { osSyncPrintf("\ngame_play->demo_play.data=[%x]", globalCtx->csCtx.segment); globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.segment); } // Scene Command 0x19: Misc. Settings (Camera & World Map Area) -void func_800993C0(GlobalContext* globalCtx, SceneCmd* cmd) -{ +void func_800993C0(GlobalContext* globalCtx, SceneCmd* cmd) { YREG(15) = cmd->miscSettings.cameraMovement; gSaveContext.world_map_area = cmd->miscSettings.area; - if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) - { - if (LINK_AGE_IN_YEARS == YEARS_ADULT) - { + if ((globalCtx->sceneNum == SCENE_SHOP1) || (globalCtx->sceneNum == SCENE_SYATEKIJYOU)) { + if (LINK_AGE_IN_YEARS == YEARS_ADULT) { gSaveContext.world_map_area = 1; } } if (((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_GANON_TOU)) || - ((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) - { - if (gSaveContext.cutscene_index < 0xFFF0) - { + ((globalCtx->sceneNum >= SCENE_ENTRA) && (globalCtx->sceneNum <= SCENE_SHRINE_R))) { + if (gSaveContext.cutscene_index < 0xFFF0) { gSaveContext.world_map_area_data |= gBitFlags[gSaveContext.world_map_area]; - osSyncPrintf("000 area_arrival=%x (%d)\n", gSaveContext.world_map_area_data, gSaveContext.world_map_area); + osSyncPrintf("000 area_arrival=%x (%d)\n", gSaveContext.world_map_area_data, + gSaveContext.world_map_area); } } } -void (*gSceneCmdHandlers[])(GlobalContext*, SceneCmd*) = -{ - func_80098508, - func_800985DC, - func_80098630, - func_80098674, - func_800987A4, - func_80099090, - func_800987F8, - func_8009883C, - func_80098904, - func_80099134, - func_80098958, - func_8009899C, - func_80098B74, - func_80098C24, - func_80098C68, - func_80098CC8, - func_80098D80, - func_80098D1C, - func_80098D5C, - func_800990F0, - NULL, - func_80099140, - func_8009918C, - func_8009934C, - func_800991A0, - func_800993C0, +void (*gSceneCmdHandlers[])(GlobalContext*, SceneCmd*) = { + func_80098508, func_800985DC, func_80098630, func_80098674, func_800987A4, func_80099090, func_800987F8, + func_8009883C, func_80098904, func_80099134, func_80098958, func_8009899C, func_80098B74, func_80098C24, + func_80098C68, func_80098CC8, func_80098D80, func_80098D1C, func_80098D5C, func_800990F0, NULL, + func_80099140, func_8009918C, func_8009934C, func_800991A0, func_800993C0, }; -#define ROM_FILE(name) { (u32)_##name##SegmentRomStart, (u32)_##name##SegmentRomEnd } -#define ROM_FILE_EMPTY(name) { (u32)_##name##SegmentRomStart, (u32)_##name##SegmentRomStart } -#define ROM_FILE_UNSET { 0 } +#define ROM_FILE(name) \ + { (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd } +#define ROM_FILE_EMPTY(name) \ + { (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomStart } +#define ROM_FILE_UNSET \ + { 0 } -RomFile sNaviMsgFiles[] = -{ +RomFile sNaviMsgFiles[] = { ROM_FILE(elf_message_field), ROM_FILE(elf_message_ydan), ROM_FILE_UNSET, @@ -616,8 +547,7 @@ s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD }; u32 gObjectTableSize = 402; -RomFile gObjectTable[] = -{ +RomFile gObjectTable[] = { ROM_FILE_UNSET, ROM_FILE(gameplay_keep), ROM_FILE(gameplay_field_keep), diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 54d69eb8c5..86d79168f9 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1,1582 +1,538 @@ #include #include -EntranceInfo gEntranceTable[] = -{ - { 0x00, 0x00, 0, 1, 0x02, 0x02 }, - { 0x00, 0x00, 0, 1, 0x02, 0x02 }, - { 0x00, 0x00, 0, 1, 0x02, 0x02 }, - { 0x00, 0x00, 0, 1, 0x02, 0x02 }, - { 0x01, 0x00, 0, 1, 0x02, 0x02 }, - { 0x01, 0x00, 0, 1, 0x02, 0x02 }, - { 0x01, 0x00, 0, 1, 0x02, 0x02 }, - { 0x01, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x14, 0x00, 1, 1, 0x02, 0x02 }, - { 0x14, 0x00, 1, 1, 0x02, 0x02 }, - { 0x14, 0x00, 1, 1, 0x02, 0x02 }, - { 0x14, 0x00, 1, 1, 0x02, 0x02 }, - { 0x05, 0x00, 0, 1, 0x02, 0x02 }, - { 0x05, 0x00, 0, 1, 0x02, 0x02 }, - { 0x05, 0x00, 0, 1, 0x02, 0x02 }, - { 0x05, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x68, 0x00, 0, 1, 0x02, 0x02 }, - { 0x68, 0x00, 0, 1, 0x02, 0x02 }, - { 0x68, 0x00, 0, 1, 0x02, 0x02 }, - { 0x68, 0x00, 0, 1, 0x02, 0x02 }, - { 0x69, 0x00, 0, 1, 0x02, 0x02 }, - { 0x69, 0x00, 0, 1, 0x02, 0x02 }, - { 0x69, 0x00, 0, 1, 0x02, 0x02 }, - { 0x69, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x02, 0x00, 0, 1, 0x02, 0x02 }, - { 0x02, 0x00, 0, 1, 0x02, 0x02 }, - { 0x02, 0x00, 0, 1, 0x02, 0x02 }, - { 0x02, 0x00, 0, 1, 0x02, 0x02 }, - { 0x02, 0x00, 0, 1, 0x02, 0x02 }, - { 0x41, 0x00, 0, 1, 0x02, 0x26 }, - { 0x41, 0x00, 0, 1, 0x02, 0x26 }, - { 0x41, 0x00, 0, 1, 0x02, 0x26 }, - { 0x41, 0x00, 0, 1, 0x02, 0x26 }, - { 0x41, 0x00, 0, 1, 0x02, 0x02 }, - { 0x41, 0x00, 0, 1, 0x02, 0x02 }, - { 0x1B, 0x00, 1, 1, 0x03, 0x03 }, - { 0x1C, 0x00, 1, 1, 0x02, 0x02 }, - { 0x1D, 0x00, 1, 1, 0x03, 0x03 }, - { 0x1D, 0x00, 1, 1, 0x02, 0x02 }, - { 0x07, 0x00, 0, 1, 0x02, 0x02 }, - { 0x07, 0x00, 0, 1, 0x02, 0x02 }, - { 0x07, 0x00, 0, 1, 0x02, 0x02 }, - { 0x07, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x04, 0x20 }, - { 0x42, 0x00, 0, 1, 0x04, 0x20 }, - { 0x42, 0x00, 0, 1, 0x04, 0x20 }, - { 0x42, 0x00, 0, 1, 0x04, 0x20 }, - { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, - { 0x38, 0x00, 0, 1, 0x04, 0x20 }, - { 0x38, 0x00, 0, 1, 0x04, 0x20 }, - { 0x38, 0x00, 0, 1, 0x04, 0x20 }, - { 0x38, 0x00, 0, 1, 0x04, 0x20 }, - { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x40, 0x00, 0, 1, 0x02, 0x26 }, - { 0x40, 0x00, 0, 1, 0x02, 0x26 }, - { 0x40, 0x00, 0, 1, 0x02, 0x26 }, - { 0x40, 0x00, 0, 1, 0x02, 0x26 }, - { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x0B, 0x0B }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x43, 0x00, 0, 1, 0x02, 0x02 }, - { 0x10, 0x00, 0, 1, 0x04, 0x20 }, - { 0x10, 0x00, 0, 1, 0x04, 0x20 }, - { 0x10, 0x00, 0, 1, 0x04, 0x20 }, - { 0x10, 0x00, 0, 1, 0x04, 0x20 }, - { 0x1E, 0x03, 1, 1, 0x03, 0x03 }, - { 0x1F, 0x03, 1, 1, 0x02, 0x02 }, - { 0x1E, 0x03, 1, 1, 0x02, 0x02 }, - { 0x1F, 0x03, 1, 1, 0x02, 0x02 }, - { 0x44, 0x00, 0, 1, 0x07, 0x07 }, - { 0x44, 0x00, 0, 1, 0x07, 0x07 }, - { 0x44, 0x00, 0, 1, 0x07, 0x07 }, - { 0x44, 0x00, 0, 1, 0x07, 0x07 }, - { 0x44, 0x00, 0, 1, 0x0D, 0x02 }, - { 0x44, 0x00, 0, 1, 0x0D, 0x02 }, - { 0x44, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, - { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, - { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, - { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, - { 0x45, 0x00, 0, 1, 0x22, 0x04 }, - { 0x46, 0x00, 0, 1, 0x22, 0x04 }, - { 0x45, 0x00, 0, 1, 0x22, 0x04 }, - { 0x46, 0x00, 0, 1, 0x22, 0x04 }, - { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x06, 0x00, 0, 1, 0x02, 0x02 }, - { 0x06, 0x00, 0, 1, 0x02, 0x02 }, - { 0x06, 0x00, 0, 1, 0x02, 0x02 }, - { 0x06, 0x00, 0, 1, 0x02, 0x02 }, - { 0x06, 0x00, 0, 1, 0x02, 0x02 }, - { 0x06, 0x00, 0, 1, 0x02, 0x02 }, - { 0x09, 0x00, 0, 1, 0x02, 0x02 }, - { 0x09, 0x00, 0, 1, 0x02, 0x02 }, - { 0x09, 0x00, 0, 1, 0x02, 0x02 }, - { 0x09, 0x00, 0, 1, 0x02, 0x02 }, - { 0x09, 0x00, 0, 1, 0x02, 0x02 }, - { 0x17, 0x00, 1, 1, 0x02, 0x02 }, - { 0x17, 0x00, 1, 1, 0x02, 0x02 }, - { 0x17, 0x00, 1, 1, 0x02, 0x02 }, - { 0x17, 0x00, 1, 1, 0x02, 0x02 }, - { 0x17, 0x00, 0, 1, 0x02, 0x02 }, - { 0x17, 0x00, 0, 1, 0x02, 0x02 }, - { 0x17, 0x00, 0, 1, 0x02, 0x02 }, - { 0x65, 0x00, 0, 1, 0x02, 0x02 }, - { 0x65, 0x00, 0, 1, 0x02, 0x02 }, - { 0x65, 0x00, 0, 1, 0x02, 0x02 }, - { 0x65, 0x00, 0, 1, 0x02, 0x02 }, - { 0x08, 0x00, 0, 1, 0x04, 0x04 }, - { 0x08, 0x00, 0, 1, 0x04, 0x04 }, - { 0x08, 0x00, 0, 1, 0x04, 0x04 }, - { 0x08, 0x00, 0, 1, 0x04, 0x04 }, - { 0x27, 0x00, 0, 1, 0x04, 0x04 }, - { 0x27, 0x00, 0, 1, 0x04, 0x04 }, - { 0x27, 0x00, 0, 1, 0x04, 0x04 }, - { 0x27, 0x00, 0, 1, 0x04, 0x04 }, - { 0x47, 0x00, 0, 1, 0x03, 0x03 }, - { 0x47, 0x00, 0, 1, 0x03, 0x03 }, - { 0x47, 0x00, 0, 1, 0x03, 0x03 }, - { 0x47, 0x00, 0, 1, 0x03, 0x03 }, - { 0x47, 0x00, 0, 1, 0x0A, 0x0A }, - { 0x47, 0x00, 0, 1, 0x02, 0x0A }, - { 0x47, 0x00, 1, 1, 0x0A, 0x0A }, - { 0x47, 0x00, 0, 1, 0x0B, 0x0B }, - { 0x47, 0x00, 0, 1, 0x03, 0x03 }, - { 0x47, 0x00, 0, 1, 0x02, 0x02 }, - { 0x47, 0x00, 0, 1, 0x02, 0x02 }, - { 0x47, 0x00, 0, 1, 0x03, 0x03 }, - { 0x47, 0x00, 0, 1, 0x03, 0x03 }, - { 0x1E, 0x00, 1, 1, 0x03, 0x03 }, - { 0x1F, 0x00, 1, 1, 0x02, 0x02 }, - { 0x1E, 0x00, 1, 1, 0x02, 0x02 }, - { 0x1F, 0x00, 1, 1, 0x02, 0x02 }, - { 0x20, 0x00, 1, 1, 0x03, 0x03 }, - { 0x21, 0x00, 1, 1, 0x02, 0x02 }, - { 0x22, 0x00, 1, 1, 0x02, 0x02 }, - { 0x22, 0x00, 1, 1, 0x02, 0x02 }, - { 0x20, 0x00, 0, 1, 0x08, 0x08 }, - { 0x67, 0x00, 0, 1, 0x02, 0x02 }, - { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, - { 0x34, 0x00, 0, 1, 0x04, 0x04 }, - { 0x34, 0x00, 0, 1, 0x04, 0x04 }, - { 0x34, 0x00, 0, 1, 0x04, 0x04 }, - { 0x34, 0x00, 0, 1, 0x04, 0x04 }, - { 0x34, 0x00, 0, 1, 0x04, 0x02 }, - { 0x34, 0x00, 0, 1, 0x10, 0x10 }, - { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, - { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, - { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, - { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, - { 0x01, 0x01, 1, 0, 0x02, 0x02 }, - { 0x01, 0x01, 1, 0, 0x02, 0x02 }, - { 0x01, 0x01, 1, 0, 0x02, 0x02 }, - { 0x01, 0x01, 1, 0, 0x02, 0x02 }, - { 0x26, 0x00, 0, 1, 0x04, 0x04 }, - { 0x26, 0x00, 0, 1, 0x04, 0x04 }, - { 0x26, 0x00, 0, 1, 0x04, 0x04 }, - { 0x26, 0x00, 0, 1, 0x04, 0x04 }, - { 0x51, 0x00, 0, 1, 0x03, 0x03 }, - { 0x51, 0x00, 0, 1, 0x02, 0x02 }, - { 0x51, 0x00, 0, 1, 0x03, 0x03 }, - { 0x51, 0x00, 0, 1, 0x02, 0x02 }, - { 0x51, 0x00, 0, 1, 0x04, 0x02 }, - { 0x51, 0x00, 0, 1, 0x21, 0x21 }, - { 0x51, 0x00, 0, 1, 0x21, 0x21 }, - { 0x51, 0x00, 0, 1, 0x23, 0x23 }, - { 0x51, 0x00, 0, 1, 0x03, 0x03 }, - { 0x51, 0x00, 1, 1, 0x02, 0x02 }, - { 0x51, 0x00, 0, 1, 0x23, 0x23 }, - { 0x51, 0x00, 0, 1, 0x03, 0x03 }, - { 0x51, 0x00, 0, 1, 0x29, 0x29 }, - { 0x51, 0x00, 1, 1, 0x03, 0x03 }, - { 0x52, 0x00, 0, 1, 0x03, 0x03 }, - { 0x52, 0x00, 0, 1, 0x02, 0x02 }, - { 0x52, 0x00, 0, 1, 0x03, 0x03 }, - { 0x52, 0x00, 0, 1, 0x02, 0x02 }, - { 0x52, 0x00, 0, 1, 0x26, 0x26 }, - { 0x52, 0x00, 0, 1, 0x21, 0x21 }, - { 0x52, 0x00, 1, 1, 0x21, 0x21 }, - { 0x52, 0x00, 0, 1, 0x21, 0x21 }, - { 0x52, 0x00, 1, 1, 0x02, 0x02 }, - { 0x53, 0x00, 0, 1, 0x03, 0x03 }, - { 0x53, 0x00, 0, 1, 0x02, 0x02 }, - { 0x53, 0x00, 0, 1, 0x03, 0x03 }, - { 0x53, 0x00, 0, 1, 0x02, 0x02 }, - { 0x53, 0x00, 0, 1, 0x04, 0x02 }, - { 0x53, 0x00, 1, 1, 0x02, 0x02 }, - { 0x54, 0x00, 1, 1, 0x03, 0x03 }, - { 0x54, 0x00, 1, 1, 0x02, 0x02 }, - { 0x54, 0x00, 1, 1, 0x03, 0x03 }, - { 0x54, 0x00, 1, 1, 0x02, 0x02 }, - { 0x55, 0x00, 0, 1, 0x03, 0x03 }, - { 0x55, 0x00, 0, 1, 0x02, 0x02 }, - { 0x55, 0x00, 0, 1, 0x03, 0x03 }, - { 0x55, 0x00, 0, 1, 0x02, 0x02 }, - { 0x55, 0x00, 1, 1, 0x0A, 0x0A }, - { 0x55, 0x00, 0, 1, 0x0A, 0x0A }, - { 0x55, 0x00, 1, 1, 0x0A, 0x0A }, - { 0x55, 0x00, 0, 1, 0x0D, 0x0A }, - { 0x55, 0x00, 0, 1, 0x0A, 0x0A }, - { 0x55, 0x00, 0, 1, 0x0A, 0x0A }, - { 0x55, 0x00, 1, 1, 0x02, 0x02 }, - { 0x55, 0x00, 1, 1, 0x02, 0x02 }, - { 0x55, 0x00, 1, 1, 0x02, 0x02 }, - { 0x55, 0x00, 1, 1, 0x02, 0x02 }, - { 0x56, 0x00, 1, 1, 0x02, 0x02 }, - { 0x56, 0x00, 1, 1, 0x02, 0x02 }, - { 0x56, 0x00, 1, 1, 0x02, 0x02 }, - { 0x56, 0x00, 1, 1, 0x02, 0x02 }, - { 0x56, 0x00, 0, 1, 0x03, 0x03 }, - { 0x56, 0x00, 0, 1, 0x00, 0x00 }, - { 0x57, 0x00, 1, 1, 0x03, 0x03 }, - { 0x57, 0x00, 1, 1, 0x02, 0x02 }, - { 0x57, 0x00, 1, 1, 0x03, 0x03 }, - { 0x57, 0x00, 1, 1, 0x02, 0x02 }, - { 0x57, 0x00, 0, 1, 0x03, 0x03 }, - { 0x57, 0x00, 1, 1, 0x02, 0x02 }, - { 0x58, 0x00, 0, 1, 0x02, 0x02 }, - { 0x58, 0x00, 0, 1, 0x02, 0x02 }, - { 0x58, 0x00, 0, 1, 0x02, 0x02 }, - { 0x58, 0x00, 0, 1, 0x02, 0x02 }, - { 0x58, 0x00, 1, 1, 0x02, 0x02 }, - { 0x58, 0x00, 1, 1, 0x02, 0x02 }, - { 0x59, 0x00, 0, 1, 0x03, 0x03 }, - { 0x59, 0x00, 0, 1, 0x02, 0x02 }, - { 0x59, 0x00, 0, 1, 0x03, 0x03 }, - { 0x59, 0x00, 0, 1, 0x02, 0x02 }, - { 0x59, 0x00, 0, 1, 0x0D, 0x00 }, - { 0x59, 0x00, 0, 1, 0x02, 0x02 }, - { 0x59, 0x00, 1, 1, 0x02, 0x02 }, - { 0x59, 0x00, 0, 1, 0x02, 0x02 }, - { 0x59, 0x00, 1, 1, 0x02, 0x02 }, - { 0x5A, 0x00, 0, 1, 0x03, 0x03 }, - { 0x5A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x5A, 0x00, 0, 1, 0x03, 0x03 }, - { 0x5A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x5A, 0x00, 1, 1, 0x0C, 0x0A }, - { 0x5A, 0x00, 1, 1, 0x0A, 0x0A }, - { 0x5A, 0x00, 1, 1, 0x02, 0x02 }, - { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, - { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, - { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, - { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, - { 0x5C, 0x00, 1, 1, 0x02, 0x02 }, - { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, - { 0x5D, 0x00, 1, 1, 0x03, 0x03 }, - { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, - { 0x5D, 0x00, 1, 1, 0x03, 0x03 }, - { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, - { 0x5D, 0x00, 1, 1, 0x21, 0x21 }, - { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, - { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, - { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, - { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, - { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, - { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, - { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, - { 0x5F, 0x00, 0, 1, 0x03, 0x03 }, - { 0x5F, 0x00, 0, 1, 0x02, 0x02 }, - { 0x64, 0x00, 0, 1, 0x02, 0x02 }, - { 0x64, 0x00, 0, 1, 0x02, 0x02 }, - { 0x64, 0x00, 0, 1, 0x04, 0x02 }, - { 0x60, 0x00, 0, 1, 0x03, 0x03 }, - { 0x60, 0x00, 0, 1, 0x02, 0x02 }, - { 0x60, 0x00, 0, 1, 0x03, 0x03 }, - { 0x60, 0x00, 0, 1, 0x02, 0x02 }, - { 0x60, 0x00, 1, 1, 0x0A, 0x0A }, - { 0x60, 0x00, 0, 1, 0x03, 0x03 }, - { 0x60, 0x00, 0, 1, 0x02, 0x02 }, - { 0x60, 0x00, 1, 1, 0x02, 0x02 }, - { 0x60, 0x00, 1, 1, 0x03, 0x03 }, - { 0x60, 0x00, 1, 1, 0x03, 0x03 }, - { 0x61, 0x00, 0, 1, 0x02, 0x02 }, - { 0x61, 0x00, 0, 1, 0x02, 0x02 }, - { 0x61, 0x00, 0, 1, 0x02, 0x02 }, - { 0x61, 0x00, 0, 1, 0x02, 0x02 }, - { 0x61, 0x00, 0, 1, 0x03, 0x03 }, - { 0x61, 0x00, 0, 1, 0x02, 0x02 }, - { 0x62, 0x00, 0, 1, 0x02, 0x02 }, - { 0x62, 0x00, 0, 1, 0x02, 0x02 }, - { 0x62, 0x00, 0, 1, 0x02, 0x02 }, - { 0x62, 0x00, 0, 1, 0x02, 0x02 }, - { 0x62, 0x00, 0, 1, 0x02, 0x02 }, - { 0x62, 0x00, 1, 1, 0x02, 0x02 }, - { 0x58, 0x03, 0, 1, 0x00, 0x00 }, - { 0x58, 0x03, 0, 1, 0x00, 0x00 }, - { 0x58, 0x03, 0, 1, 0x00, 0x00 }, - { 0x58, 0x03, 0, 1, 0x00, 0x00 }, - { 0x63, 0x00, 0, 1, 0x03, 0x03 }, - { 0x63, 0x00, 0, 1, 0x02, 0x02 }, - { 0x63, 0x00, 0, 1, 0x03, 0x03 }, - { 0x63, 0x00, 0, 1, 0x02, 0x02 }, - { 0x63, 0x00, 0, 1, 0x20, 0x20 }, - { 0x63, 0x00, 0, 1, 0x2A, 0x2A }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x63, 0x00, 1, 1, 0x02, 0x02 }, - { 0x04, 0x00, 0, 1, 0x02, 0x02 }, - { 0x04, 0x00, 0, 1, 0x02, 0x02 }, - { 0x04, 0x00, 0, 1, 0x02, 0x02 }, - { 0x04, 0x00, 0, 1, 0x02, 0x02 }, - { 0x03, 0x00, 0, 1, 0x02, 0x02 }, - { 0x03, 0x00, 0, 1, 0x02, 0x02 }, - { 0x03, 0x00, 0, 1, 0x02, 0x02 }, - { 0x03, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x01, 0, 1, 0x04, 0x20 }, - { 0x42, 0x01, 0, 1, 0x04, 0x20 }, - { 0x42, 0x01, 0, 1, 0x04, 0x20 }, - { 0x42, 0x01, 0, 1, 0x04, 0x20 }, - { 0x23, 0x00, 0, 1, 0x03, 0x03 }, - { 0x24, 0x00, 0, 1, 0x02, 0x02 }, - { 0x25, 0x00, 0, 1, 0x02, 0x02 }, - { 0x25, 0x00, 0, 1, 0x02, 0x02 }, - { 0x04, 0x01, 1, 1, 0x02, 0x02 }, - { 0x04, 0x01, 1, 1, 0x02, 0x02 }, - { 0x04, 0x01, 1, 1, 0x02, 0x02 }, - { 0x04, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, - { 0x51, 0x01, 0, 1, 0x03, 0x03 }, - { 0x51, 0x01, 0, 1, 0x02, 0x02 }, - { 0x51, 0x01, 0, 1, 0x03, 0x03 }, - { 0x51, 0x01, 0, 1, 0x02, 0x02 }, - { 0x51, 0x02, 1, 1, 0x03, 0x03 }, - { 0x51, 0x02, 1, 1, 0x02, 0x02 }, - { 0x51, 0x02, 1, 1, 0x03, 0x03 }, - { 0x51, 0x02, 1, 1, 0x02, 0x02 }, - { 0x51, 0x03, 0, 1, 0x02, 0x02 }, - { 0x51, 0x03, 0, 1, 0x02, 0x02 }, - { 0x51, 0x03, 0, 1, 0x02, 0x02 }, - { 0x51, 0x03, 0, 1, 0x02, 0x02 }, - { 0x51, 0x04, 1, 1, 0x03, 0x03 }, - { 0x51, 0x04, 1, 1, 0x02, 0x02 }, - { 0x51, 0x04, 1, 1, 0x03, 0x03 }, - { 0x51, 0x04, 1, 1, 0x02, 0x02 }, - { 0x51, 0x05, 0, 1, 0x03, 0x03 }, - { 0x51, 0x05, 0, 1, 0x02, 0x02 }, - { 0x51, 0x05, 0, 1, 0x03, 0x03 }, - { 0x51, 0x05, 0, 1, 0x02, 0x02 }, - { 0x52, 0x01, 0, 1, 0x03, 0x03 }, - { 0x52, 0x01, 0, 1, 0x02, 0x02 }, - { 0x52, 0x01, 0, 1, 0x03, 0x03 }, - { 0x52, 0x01, 0, 1, 0x02, 0x02 }, - { 0x52, 0x02, 0, 1, 0x03, 0x03 }, - { 0x52, 0x02, 0, 1, 0x02, 0x02 }, - { 0x52, 0x02, 0, 1, 0x03, 0x03 }, - { 0x52, 0x02, 0, 1, 0x02, 0x02 }, - { 0x54, 0x01, 1, 1, 0x03, 0x03 }, - { 0x54, 0x01, 1, 1, 0x03, 0x03 }, - { 0x54, 0x01, 1, 1, 0x03, 0x03 }, - { 0x54, 0x01, 1, 1, 0x03, 0x03 }, - { 0x54, 0x02, 0, 1, 0x03, 0x03 }, - { 0x54, 0x02, 0, 1, 0x02, 0x02 }, - { 0x54, 0x02, 0, 1, 0x03, 0x03 }, - { 0x54, 0x02, 0, 1, 0x02, 0x02 }, - { 0x58, 0x01, 0, 1, 0x02, 0x02 }, - { 0x58, 0x01, 0, 1, 0x02, 0x02 }, - { 0x58, 0x01, 0, 1, 0x02, 0x02 }, - { 0x58, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5A, 0x01, 0, 1, 0x03, 0x03 }, - { 0x5A, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5A, 0x01, 0, 1, 0x03, 0x03 }, - { 0x5A, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, - { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, - { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, - { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, - { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, - { 0x60, 0x01, 0, 1, 0x03, 0x03 }, - { 0x60, 0x01, 0, 1, 0x02, 0x02 }, - { 0x60, 0x01, 0, 1, 0x03, 0x03 }, - { 0x60, 0x01, 0, 1, 0x02, 0x02 }, - { 0x60, 0x02, 0, 1, 0x03, 0x03 }, - { 0x60, 0x02, 0, 1, 0x02, 0x02 }, - { 0x60, 0x02, 0, 1, 0x03, 0x03 }, - { 0x60, 0x02, 0, 1, 0x02, 0x02 }, - { 0x62, 0x01, 0, 1, 0x02, 0x02 }, - { 0x62, 0x01, 0, 1, 0x02, 0x02 }, - { 0x62, 0x01, 0, 1, 0x02, 0x02 }, - { 0x62, 0x01, 0, 1, 0x02, 0x02 }, - { 0x38, 0x01, 0, 1, 0x04, 0x20 }, - { 0x38, 0x01, 0, 1, 0x04, 0x20 }, - { 0x38, 0x01, 0, 1, 0x04, 0x20 }, - { 0x38, 0x01, 0, 1, 0x04, 0x20 }, - { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, - { 0x20, 0x08, 0, 1, 0x04, 0x02 }, - { 0x21, 0x08, 0, 1, 0x04, 0x02 }, - { 0x22, 0x08, 0, 1, 0x04, 0x02 }, - { 0x22, 0x08, 0, 1, 0x04, 0x02 }, - { 0x20, 0x09, 0, 1, 0x04, 0x02 }, - { 0x21, 0x09, 0, 1, 0x04, 0x02 }, - { 0x22, 0x09, 0, 1, 0x04, 0x02 }, - { 0x22, 0x09, 0, 1, 0x04, 0x02 }, - { 0x20, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x21, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x22, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x22, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x54, 0x03, 1, 1, 0x03, 0x03 }, - { 0x54, 0x03, 1, 1, 0x02, 0x02 }, - { 0x54, 0x03, 1, 1, 0x03, 0x03 }, - { 0x54, 0x03, 1, 1, 0x02, 0x02 }, - { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x5C, 0x01, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x01, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x02, 0, 0, 0x03, 0x03 }, - { 0x5C, 0x02, 0, 0, 0x02, 0x02 }, - { 0x5C, 0x02, 0, 0, 0x03, 0x03 }, - { 0x5C, 0x02, 0, 0, 0x02, 0x02 }, - { 0x5C, 0x03, 0, 0, 0x03, 0x03 }, - { 0x5C, 0x03, 0, 0, 0x02, 0x02 }, - { 0x5C, 0x03, 0, 0, 0x03, 0x03 }, - { 0x5C, 0x03, 0, 0, 0x02, 0x02 }, - { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x05, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x05, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, - { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, - { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, - { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, - { 0x51, 0x06, 0, 1, 0x03, 0x03 }, - { 0x51, 0x06, 0, 1, 0x02, 0x02 }, - { 0x51, 0x06, 0, 1, 0x03, 0x03 }, - { 0x51, 0x06, 0, 1, 0x02, 0x02 }, - { 0x51, 0x07, 0, 1, 0x03, 0x03 }, - { 0x51, 0x07, 0, 1, 0x02, 0x02 }, - { 0x51, 0x07, 0, 1, 0x03, 0x03 }, - { 0x51, 0x07, 0, 1, 0x02, 0x02 }, - { 0x52, 0x03, 0, 1, 0x04, 0x02 }, - { 0x52, 0x03, 0, 1, 0x04, 0x02 }, - { 0x52, 0x03, 0, 1, 0x04, 0x02 }, - { 0x52, 0x03, 0, 1, 0x04, 0x02 }, - { 0x53, 0x01, 0, 1, 0x02, 0x02 }, - { 0x53, 0x01, 0, 1, 0x02, 0x02 }, - { 0x53, 0x01, 0, 1, 0x02, 0x02 }, - { 0x53, 0x01, 0, 1, 0x02, 0x02 }, - { 0x55, 0x01, 0, 1, 0x03, 0x03 }, - { 0x55, 0x01, 0, 1, 0x02, 0x02 }, - { 0x55, 0x01, 0, 1, 0x03, 0x03 }, - { 0x55, 0x01, 0, 1, 0x02, 0x02 }, - { 0x55, 0x02, 0, 1, 0x02, 0x02 }, - { 0x55, 0x02, 0, 1, 0x02, 0x02 }, - { 0x55, 0x02, 0, 1, 0x02, 0x02 }, - { 0x55, 0x02, 0, 1, 0x02, 0x02 }, - { 0x55, 0x03, 0, 1, 0x04, 0x04 }, - { 0x55, 0x03, 0, 1, 0x04, 0x04 }, - { 0x55, 0x03, 0, 1, 0x04, 0x04 }, - { 0x55, 0x03, 0, 1, 0x04, 0x04 }, - { 0x56, 0x01, 0, 1, 0x12, 0x12 }, - { 0x56, 0x01, 0, 1, 0x02, 0x02 }, - { 0x56, 0x01, 0, 1, 0x12, 0x12 }, - { 0x56, 0x01, 0, 1, 0x02, 0x02 }, - { 0x57, 0x01, 0, 1, 0x03, 0x03 }, - { 0x57, 0x01, 0, 1, 0x02, 0x02 }, - { 0x57, 0x01, 0, 1, 0x03, 0x03 }, - { 0x57, 0x01, 0, 1, 0x02, 0x02 }, - { 0x57, 0x02, 0, 1, 0x13, 0x13 }, - { 0x57, 0x02, 0, 1, 0x02, 0x02 }, - { 0x57, 0x02, 0, 1, 0x13, 0x13 }, - { 0x57, 0x02, 0, 1, 0x02, 0x02 }, - { 0x59, 0x01, 0, 1, 0x02, 0x02 }, - { 0x59, 0x01, 0, 1, 0x02, 0x02 }, - { 0x59, 0x01, 0, 1, 0x02, 0x02 }, - { 0x59, 0x01, 0, 1, 0x02, 0x02 }, - { 0x59, 0x02, 0, 1, 0x03, 0x03 }, - { 0x59, 0x02, 0, 1, 0x02, 0x02 }, - { 0x59, 0x02, 0, 1, 0x03, 0x03 }, - { 0x59, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5A, 0x02, 1, 1, 0x03, 0x03 }, - { 0x5A, 0x02, 1, 1, 0x02, 0x02 }, - { 0x5A, 0x02, 1, 1, 0x03, 0x03 }, - { 0x5A, 0x02, 1, 1, 0x02, 0x02 }, - { 0x5A, 0x03, 1, 1, 0x03, 0x03 }, - { 0x5A, 0x03, 1, 1, 0x02, 0x02 }, - { 0x5A, 0x03, 1, 1, 0x03, 0x03 }, - { 0x5A, 0x03, 1, 1, 0x02, 0x02 }, - { 0x5D, 0x01, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x01, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x02, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x02, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x03, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x03, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x03, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x03, 0, 1, 0x02, 0x02 }, - { 0x5F, 0x01, 0, 1, 0x03, 0x03 }, - { 0x5F, 0x01, 0, 1, 0x02, 0x02 }, - { 0x64, 0x01, 0, 1, 0x05, 0x05 }, - { 0x64, 0x01, 0, 1, 0x05, 0x05 }, - { 0x5F, 0x01, 0, 1, 0x00, 0x00 }, - { 0x60, 0x03, 0, 1, 0x03, 0x03 }, - { 0x60, 0x03, 0, 1, 0x02, 0x02 }, - { 0x60, 0x03, 0, 1, 0x03, 0x03 }, - { 0x60, 0x03, 0, 1, 0x02, 0x02 }, - { 0x61, 0x01, 0, 1, 0x02, 0x02 }, - { 0x61, 0x01, 0, 1, 0x02, 0x02 }, - { 0x61, 0x01, 0, 1, 0x02, 0x02 }, - { 0x61, 0x01, 0, 1, 0x02, 0x02 }, - { 0x61, 0x02, 0, 1, 0x02, 0x02 }, - { 0x61, 0x02, 0, 1, 0x02, 0x02 }, - { 0x61, 0x02, 0, 1, 0x02, 0x02 }, - { 0x61, 0x02, 0, 1, 0x02, 0x02 }, - { 0x03, 0x01, 1, 1, 0x02, 0x02 }, - { 0x03, 0x01, 1, 1, 0x02, 0x02 }, - { 0x03, 0x01, 1, 1, 0x02, 0x02 }, - { 0x03, 0x01, 1, 1, 0x02, 0x02 }, - { 0x00, 0x01, 1, 0, 0x02, 0x02 }, - { 0x00, 0x01, 1, 0, 0x02, 0x02 }, - { 0x00, 0x01, 1, 0, 0x02, 0x02 }, - { 0x00, 0x01, 1, 0, 0x02, 0x02 }, - { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, - { 0x20, 0x01, 0, 1, 0x03, 0x03 }, - { 0x21, 0x01, 0, 1, 0x02, 0x02 }, - { 0x22, 0x01, 0, 1, 0x02, 0x02 }, - { 0x22, 0x01, 0, 1, 0x02, 0x02 }, - { 0x20, 0x02, 0, 1, 0x03, 0x03 }, - { 0x21, 0x02, 0, 1, 0x02, 0x02 }, - { 0x22, 0x02, 0, 1, 0x02, 0x02 }, - { 0x22, 0x02, 0, 1, 0x02, 0x02 }, - { 0x20, 0x03, 1, 1, 0x03, 0x03 }, - { 0x21, 0x03, 1, 1, 0x02, 0x02 }, - { 0x22, 0x03, 1, 1, 0x02, 0x02 }, - { 0x22, 0x03, 1, 1, 0x02, 0x02 }, - { 0x55, 0x04, 0, 0, 0x04, 0x04 }, - { 0x55, 0x04, 0, 0, 0x04, 0x04 }, - { 0x55, 0x04, 0, 0, 0x04, 0x04 }, - { 0x55, 0x04, 0, 0, 0x04, 0x04 }, - { 0x55, 0x05, 0, 0, 0x04, 0x04 }, - { 0x55, 0x05, 0, 0, 0x04, 0x04 }, - { 0x55, 0x05, 0, 0, 0x04, 0x04 }, - { 0x55, 0x05, 0, 0, 0x04, 0x04 }, - { 0x1B, 0x02, 0, 0, 0x02, 0x02 }, - { 0x1C, 0x02, 0, 0, 0x02, 0x02 }, - { 0x1D, 0x02, 0, 0, 0x02, 0x02 }, - { 0x1D, 0x02, 0, 0, 0x02, 0x02 }, - { 0x34, 0x01, 0, 1, 0x04, 0x04 }, - { 0x34, 0x01, 0, 1, 0x04, 0x04 }, - { 0x34, 0x01, 0, 1, 0x04, 0x04 }, - { 0x34, 0x01, 0, 1, 0x04, 0x04 }, - { 0x1B, 0x01, 0, 1, 0x03, 0x03 }, - { 0x1C, 0x01, 0, 1, 0x02, 0x02 }, - { 0x1D, 0x01, 0, 1, 0x02, 0x02 }, - { 0x1D, 0x01, 0, 1, 0x02, 0x02 }, - { 0x51, 0x08, 1, 1, 0x03, 0x03 }, - { 0x51, 0x08, 1, 1, 0x02, 0x02 }, - { 0x51, 0x08, 1, 1, 0x03, 0x03 }, - { 0x51, 0x08, 1, 1, 0x02, 0x02 }, - { 0x51, 0x09, 0, 1, 0x03, 0x03 }, - { 0x51, 0x09, 0, 1, 0x03, 0x03 }, - { 0x51, 0x09, 0, 1, 0x03, 0x03 }, - { 0x51, 0x09, 0, 1, 0x03, 0x03 }, - { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, - { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, - { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, - { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, - { 0x55, 0x06, 0, 1, 0x02, 0x02 }, - { 0x55, 0x06, 0, 1, 0x02, 0x02 }, - { 0x55, 0x06, 0, 1, 0x02, 0x02 }, - { 0x55, 0x06, 0, 1, 0x02, 0x02 }, - { 0x51, 0x0B, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x51, 0x0B, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x51, 0x0C, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x51, 0x0C, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x51, 0x0D, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0D, 0, 1, 0x04, 0x02 }, - { 0x51, 0x0D, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0D, 0, 1, 0x04, 0x02 }, - { 0x45, 0x01, 0, 1, 0x03, 0x03 }, - { 0x46, 0x01, 0, 1, 0x02, 0x02 }, - { 0x45, 0x01, 0, 1, 0x03, 0x03 }, - { 0x46, 0x01, 0, 1, 0x02, 0x02 }, - { 0x1E, 0x01, 1, 1, 0x03, 0x03 }, - { 0x1F, 0x01, 1, 1, 0x02, 0x02 }, - { 0x1E, 0x01, 1, 1, 0x02, 0x02 }, - { 0x1F, 0x01, 1, 1, 0x02, 0x02 }, - { 0x20, 0x04, 1, 1, 0x03, 0x03 }, - { 0x21, 0x04, 1, 1, 0x02, 0x02 }, - { 0x22, 0x04, 1, 1, 0x02, 0x02 }, - { 0x22, 0x04, 1, 1, 0x02, 0x02 }, - { 0x20, 0x05, 0, 1, 0x04, 0x02 }, - { 0x21, 0x05, 0, 1, 0x04, 0x02 }, - { 0x22, 0x05, 0, 1, 0x04, 0x02 }, - { 0x22, 0x05, 0, 1, 0x04, 0x02 }, - { 0x52, 0x04, 0, 1, 0x02, 0x02 }, - { 0x52, 0x04, 0, 1, 0x02, 0x02 }, - { 0x52, 0x04, 0, 1, 0x02, 0x02 }, - { 0x52, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x04, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x04, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x04, 0, 1, 0x02, 0x02 }, - { 0x63, 0x01, 0, 0, 0x03, 0x03 }, - { 0x63, 0x01, 0, 0, 0x02, 0x02 }, - { 0x63, 0x01, 0, 0, 0x03, 0x03 }, - { 0x63, 0x01, 0, 0, 0x02, 0x02 }, - { 0x07, 0x01, 0, 1, 0x02, 0x02 }, - { 0x07, 0x01, 0, 1, 0x02, 0x02 }, - { 0x07, 0x01, 0, 1, 0x02, 0x02 }, - { 0x07, 0x01, 0, 1, 0x02, 0x02 }, - { 0x07, 0x02, 1, 1, 0x02, 0x02 }, - { 0x07, 0x02, 1, 1, 0x02, 0x02 }, - { 0x07, 0x02, 1, 1, 0x02, 0x02 }, - { 0x07, 0x02, 1, 1, 0x02, 0x02 }, - { 0x5D, 0x05, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x05, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x06, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x06, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x06, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x06, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x07, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x07, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x07, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x07, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x08, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x08, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x08, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x08, 0, 1, 0x02, 0x02 }, - { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, - { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, - { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, - { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, - { 0x44, 0x01, 0, 1, 0x02, 0x02 }, - { 0x44, 0x01, 0, 1, 0x02, 0x02 }, - { 0x44, 0x01, 0, 1, 0x02, 0x02 }, - { 0x44, 0x01, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x09, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x09, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x09, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x09, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0A, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0A, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0B, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0B, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0C, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0C, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x63, 0x02, 0, 1, 0x03, 0x03 }, - { 0x63, 0x02, 0, 1, 0x02, 0x02 }, - { 0x63, 0x02, 0, 1, 0x03, 0x03 }, - { 0x63, 0x02, 0, 1, 0x02, 0x02 }, - { 0x63, 0x03, 0, 1, 0x03, 0x03 }, - { 0x63, 0x03, 0, 1, 0x02, 0x02 }, - { 0x63, 0x03, 0, 1, 0x03, 0x03 }, - { 0x63, 0x03, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x56, 0x00, 0, 1, 0x02, 0x02 }, - { 0x47, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x42, 0x00, 0, 1, 0x02, 0x02 }, - { 0x06, 0x01, 1, 1, 0x02, 0x02 }, - { 0x06, 0x01, 1, 1, 0x02, 0x02 }, - { 0x06, 0x01, 1, 1, 0x02, 0x02 }, - { 0x06, 0x01, 1, 1, 0x02, 0x02 }, - { 0x36, 0x00, 0, 1, 0x04, 0x20 }, - { 0x36, 0x00, 0, 1, 0x04, 0x20 }, - { 0x36, 0x00, 0, 1, 0x04, 0x20 }, - { 0x36, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, - { 0x13, 0x00, 1, 1, 0x02, 0x02 }, - { 0x13, 0x00, 1, 1, 0x02, 0x02 }, - { 0x13, 0x00, 1, 1, 0x02, 0x02 }, - { 0x13, 0x00, 1, 1, 0x02, 0x02 }, - { 0x15, 0x00, 1, 1, 0x02, 0x02 }, - { 0x15, 0x00, 1, 1, 0x02, 0x02 }, - { 0x15, 0x00, 1, 1, 0x02, 0x02 }, - { 0x15, 0x00, 1, 1, 0x02, 0x02 }, - { 0x57, 0x06, 0, 1, 0x04, 0x02 }, - { 0x57, 0x06, 0, 1, 0x04, 0x02 }, - { 0x57, 0x06, 0, 1, 0x04, 0x02 }, - { 0x57, 0x06, 0, 1, 0x04, 0x02 }, - { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, - { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, - { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, - { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, - { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, - { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, - { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, - { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, - { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, - { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, - { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, - { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, - { 0x43, 0x03, 0, 1, 0x02, 0x02 }, - { 0x43, 0x03, 0, 1, 0x02, 0x02 }, - { 0x43, 0x03, 0, 1, 0x02, 0x02 }, - { 0x43, 0x03, 0, 1, 0x02, 0x02 }, - { 0x43, 0x04, 0, 1, 0x02, 0x02 }, - { 0x43, 0x04, 0, 1, 0x02, 0x02 }, - { 0x43, 0x04, 0, 1, 0x02, 0x02 }, - { 0x43, 0x04, 0, 1, 0x02, 0x02 }, - { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, - { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, - { 0x55, 0x07, 0, 0, 0x04, 0x04 }, - { 0x55, 0x07, 0, 0, 0x04, 0x04 }, - { 0x55, 0x07, 0, 0, 0x04, 0x04 }, - { 0x55, 0x07, 0, 0, 0x04, 0x04 }, - { 0x55, 0x08, 0, 0, 0x04, 0x04 }, - { 0x55, 0x08, 0, 0, 0x04, 0x04 }, - { 0x55, 0x08, 0, 0, 0x04, 0x04 }, - { 0x55, 0x08, 0, 0, 0x04, 0x04 }, - { 0x5F, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5F, 0x02, 0, 1, 0x02, 0x02 }, - { 0x64, 0x02, 0, 1, 0x02, 0x02 }, - { 0x64, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5F, 0x02, 0, 1, 0x00, 0x00 }, - { 0x52, 0x05, 0, 1, 0x04, 0x02 }, - { 0x52, 0x05, 0, 1, 0x04, 0x02 }, - { 0x52, 0x05, 0, 1, 0x04, 0x02 }, - { 0x52, 0x05, 0, 1, 0x04, 0x02 }, - { 0x52, 0x06, 0, 1, 0x04, 0x02 }, - { 0x52, 0x06, 0, 1, 0x04, 0x02 }, - { 0x52, 0x06, 0, 1, 0x04, 0x02 }, - { 0x52, 0x06, 0, 1, 0x04, 0x02 }, - { 0x52, 0x07, 0, 1, 0x04, 0x02 }, - { 0x52, 0x07, 0, 1, 0x04, 0x02 }, - { 0x52, 0x07, 0, 1, 0x04, 0x02 }, - { 0x52, 0x07, 0, 1, 0x04, 0x02 }, - { 0x52, 0x08, 0, 1, 0x04, 0x02 }, - { 0x52, 0x08, 0, 1, 0x04, 0x02 }, - { 0x52, 0x08, 0, 1, 0x04, 0x02 }, - { 0x52, 0x08, 0, 1, 0x04, 0x02 }, - { 0x53, 0x02, 0, 1, 0x04, 0x02 }, - { 0x53, 0x02, 0, 1, 0x04, 0x02 }, - { 0x53, 0x02, 0, 1, 0x04, 0x02 }, - { 0x53, 0x02, 0, 1, 0x04, 0x02 }, - { 0x53, 0x03, 0, 1, 0x03, 0x03 }, - { 0x53, 0x03, 0, 1, 0x03, 0x03 }, - { 0x53, 0x03, 0, 1, 0x03, 0x03 }, - { 0x53, 0x03, 0, 1, 0x03, 0x03 }, - { 0x53, 0x04, 0, 1, 0x03, 0x03 }, - { 0x53, 0x04, 0, 1, 0x03, 0x03 }, - { 0x53, 0x04, 0, 1, 0x03, 0x03 }, - { 0x53, 0x04, 0, 1, 0x03, 0x03 }, - { 0x53, 0x05, 0, 1, 0x03, 0x03 }, - { 0x53, 0x05, 0, 1, 0x03, 0x03 }, - { 0x53, 0x05, 0, 1, 0x03, 0x03 }, - { 0x53, 0x05, 0, 1, 0x03, 0x03 }, - { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, - { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, - { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, - { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, - { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, - { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, - { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, - { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, - { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, - { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, - { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, - { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, - { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, - { 0x63, 0x04, 0, 1, 0x04, 0x02 }, - { 0x63, 0x04, 0, 1, 0x04, 0x02 }, - { 0x63, 0x04, 0, 1, 0x04, 0x02 }, - { 0x63, 0x04, 0, 1, 0x04, 0x02 }, - { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, - { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, - { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, - { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, - { 0x30, 0x00, 0, 0, 0x04, 0x20 }, - { 0x30, 0x00, 0, 0, 0x04, 0x20 }, - { 0x30, 0x00, 0, 1, 0x04, 0x20 }, - { 0x30, 0x00, 0, 1, 0x04, 0x20 }, - { 0x31, 0x00, 0, 1, 0x04, 0x20 }, - { 0x31, 0x00, 0, 1, 0x04, 0x20 }, - { 0x31, 0x00, 0, 1, 0x04, 0x20 }, - { 0x31, 0x00, 0, 1, 0x04, 0x20 }, - { 0x1E, 0x04, 0, 1, 0x04, 0x02 }, - { 0x1F, 0x04, 0, 1, 0x04, 0x02 }, - { 0x1E, 0x04, 0, 1, 0x04, 0x02 }, - { 0x1F, 0x04, 0, 1, 0x04, 0x02 }, - { 0x32, 0x00, 0, 1, 0x02, 0x02 }, - { 0x32, 0x00, 0, 1, 0x02, 0x02 }, - { 0x32, 0x00, 0, 1, 0x02, 0x02 }, - { 0x32, 0x00, 0, 1, 0x02, 0x02 }, - { 0x59, 0x05, 0, 1, 0x03, 0x03 }, - { 0x59, 0x05, 0, 1, 0x03, 0x03 }, - { 0x59, 0x05, 0, 1, 0x03, 0x03 }, - { 0x59, 0x05, 0, 1, 0x03, 0x03 }, - { 0x35, 0x00, 0, 1, 0x04, 0x02 }, - { 0x35, 0x00, 0, 1, 0x04, 0x02 }, - { 0x35, 0x00, 0, 1, 0x04, 0x02 }, - { 0x35, 0x00, 0, 1, 0x04, 0x02 }, - { 0x37, 0x00, 0, 1, 0x04, 0x20 }, - { 0x37, 0x00, 0, 1, 0x04, 0x20 }, - { 0x37, 0x00, 0, 1, 0x04, 0x20 }, - { 0x37, 0x00, 0, 1, 0x04, 0x20 }, - { 0x39, 0x00, 0, 1, 0x04, 0x04 }, - { 0x39, 0x00, 0, 1, 0x04, 0x04 }, - { 0x39, 0x00, 0, 1, 0x04, 0x04 }, - { 0x39, 0x00, 0, 1, 0x04, 0x04 }, - { 0x5D, 0x0D, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0D, 0, 1, 0x03, 0x03 }, - { 0x5D, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x0E, 0, 1, 0x03, 0x05 }, - { 0x5D, 0x0E, 0, 1, 0x02, 0x04 }, - { 0x5D, 0x0E, 0, 1, 0x03, 0x05 }, - { 0x5D, 0x0E, 0, 1, 0x02, 0x04 }, - { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, - { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, - { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, - { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, - { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, - { 0x20, 0x06, 0, 1, 0x04, 0x02 }, - { 0x21, 0x06, 0, 1, 0x04, 0x02 }, - { 0x22, 0x06, 0, 1, 0x04, 0x02 }, - { 0x22, 0x06, 0, 1, 0x04, 0x02 }, - { 0x20, 0x07, 0, 1, 0x04, 0x02 }, - { 0x21, 0x07, 0, 1, 0x04, 0x02 }, - { 0x22, 0x07, 0, 1, 0x04, 0x02 }, - { 0x22, 0x07, 0, 1, 0x04, 0x02 }, - { 0x1E, 0x02, 0, 1, 0x04, 0x02 }, - { 0x1F, 0x02, 0, 1, 0x04, 0x02 }, - { 0x1E, 0x02, 0, 1, 0x03, 0x03 }, - { 0x1F, 0x02, 0, 1, 0x02, 0x02 }, - { 0x58, 0x02, 0, 1, 0x02, 0x02 }, - { 0x58, 0x02, 0, 1, 0x02, 0x02 }, - { 0x58, 0x02, 0, 1, 0x02, 0x02 }, - { 0x58, 0x02, 0, 1, 0x02, 0x02 }, - { 0x57, 0x03, 0, 1, 0x03, 0x03 }, - { 0x57, 0x03, 0, 1, 0x03, 0x03 }, - { 0x57, 0x03, 0, 1, 0x03, 0x03 }, - { 0x57, 0x03, 0, 1, 0x03, 0x03 }, - { 0x57, 0x04, 0, 1, 0x04, 0x02 }, - { 0x57, 0x04, 0, 1, 0x04, 0x02 }, - { 0x57, 0x04, 0, 1, 0x04, 0x02 }, - { 0x57, 0x04, 0, 1, 0x04, 0x02 }, - { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, - { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, - { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, - { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, - { 0x59, 0x03, 0, 1, 0x03, 0x03 }, - { 0x59, 0x03, 0, 1, 0x02, 0x02 }, - { 0x59, 0x03, 0, 1, 0x03, 0x03 }, - { 0x59, 0x03, 0, 1, 0x02, 0x02 }, - { 0x59, 0x04, 0, 1, 0x02, 0x02 }, - { 0x59, 0x04, 0, 1, 0x02, 0x02 }, - { 0x59, 0x04, 0, 1, 0x02, 0x02 }, - { 0x59, 0x04, 0, 1, 0x02, 0x02 }, - { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, - { 0x30, 0x01, 0, 0, 0x04, 0x20 }, - { 0x30, 0x01, 0, 0, 0x04, 0x20 }, - { 0x30, 0x01, 0, 1, 0x04, 0x20 }, - { 0x30, 0x01, 0, 1, 0x04, 0x20 }, - { 0x30, 0x02, 0, 0, 0x04, 0x20 }, - { 0x30, 0x02, 0, 0, 0x04, 0x20 }, - { 0x30, 0x02, 0, 1, 0x04, 0x20 }, - { 0x30, 0x02, 0, 1, 0x04, 0x20 }, - { 0x06, 0x02, 0, 0, 0x02, 0x02 }, - { 0x06, 0x02, 0, 0, 0x02, 0x02 }, - { 0x06, 0x02, 0, 0, 0x02, 0x02 }, - { 0x06, 0x02, 0, 0, 0x02, 0x02 }, - { 0x06, 0x03, 0, 0, 0x02, 0x02 }, - { 0x06, 0x03, 0, 0, 0x02, 0x02 }, - { 0x06, 0x03, 0, 0, 0x02, 0x02 }, - { 0x06, 0x03, 0, 0, 0x02, 0x02 }, - { 0x06, 0x04, 0, 1, 0x02, 0x02 }, - { 0x06, 0x04, 0, 1, 0x02, 0x02 }, - { 0x06, 0x04, 0, 1, 0x02, 0x02 }, - { 0x06, 0x04, 0, 1, 0x02, 0x02 }, - { 0x62, 0x02, 0, 1, 0x04, 0x02 }, - { 0x62, 0x02, 0, 1, 0x04, 0x02 }, - { 0x62, 0x02, 0, 1, 0x04, 0x02 }, - { 0x62, 0x02, 0, 1, 0x04, 0x02 }, - { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, - { 0x02, 0x01, 1, 1, 0x02, 0x02 }, - { 0x02, 0x01, 1, 1, 0x02, 0x02 }, - { 0x02, 0x01, 1, 1, 0x02, 0x02 }, - { 0x02, 0x01, 1, 1, 0x02, 0x02 }, - { 0x12, 0x00, 1, 0, 0x02, 0x02 }, - { 0x12, 0x00, 1, 0, 0x02, 0x02 }, - { 0x12, 0x00, 1, 0, 0x02, 0x02 }, - { 0x12, 0x00, 1, 0, 0x02, 0x02 }, - { 0x11, 0x00, 1, 0, 0x02, 0x02 }, - { 0x11, 0x00, 1, 0, 0x02, 0x02 }, - { 0x11, 0x00, 1, 0, 0x02, 0x02 }, - { 0x11, 0x00, 1, 0, 0x02, 0x02 }, - { 0x18, 0x00, 1, 1, 0x02, 0x02 }, - { 0x18, 0x00, 1, 1, 0x02, 0x02 }, - { 0x18, 0x00, 1, 1, 0x02, 0x02 }, - { 0x18, 0x00, 1, 1, 0x02, 0x02 }, - { 0x16, 0x00, 1, 1, 0x02, 0x02 }, - { 0x16, 0x00, 1, 1, 0x02, 0x02 }, - { 0x16, 0x00, 1, 1, 0x02, 0x02 }, - { 0x16, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, - { 0x19, 0x00, 1, 1, 0x02, 0x02 }, - { 0x19, 0x00, 1, 1, 0x02, 0x02 }, - { 0x19, 0x00, 1, 1, 0x02, 0x02 }, - { 0x19, 0x00, 1, 1, 0x02, 0x02 }, - { 0x05, 0x01, 1, 1, 0x03, 0x02 }, - { 0x05, 0x01, 1, 1, 0x02, 0x02 }, - { 0x05, 0x01, 1, 1, 0x03, 0x02 }, - { 0x05, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, - { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, - { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, - { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, - { 0x63, 0x05, 0, 1, 0x04, 0x02 }, - { 0x63, 0x05, 0, 1, 0x04, 0x02 }, - { 0x63, 0x05, 0, 1, 0x04, 0x02 }, - { 0x63, 0x05, 0, 1, 0x04, 0x02 }, - { 0x28, 0x00, 0, 1, 0x04, 0x04 }, - { 0x28, 0x00, 0, 1, 0x04, 0x04 }, - { 0x28, 0x00, 0, 1, 0x04, 0x04 }, - { 0x28, 0x00, 0, 1, 0x04, 0x04 }, - { 0x29, 0x00, 0, 1, 0x04, 0x04 }, - { 0x29, 0x00, 0, 1, 0x04, 0x04 }, - { 0x29, 0x00, 0, 1, 0x04, 0x04 }, - { 0x29, 0x00, 0, 1, 0x04, 0x04 }, - { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, - { 0x55, 0x09, 0, 0, 0x04, 0x04 }, - { 0x55, 0x09, 0, 0, 0x04, 0x04 }, - { 0x55, 0x09, 0, 0, 0x04, 0x04 }, - { 0x55, 0x09, 0, 0, 0x04, 0x04 }, - { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, - { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, - { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, - { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, - { 0x52, 0x09, 0, 1, 0x04, 0x04 }, - { 0x52, 0x09, 0, 1, 0x04, 0x04 }, - { 0x52, 0x09, 0, 1, 0x04, 0x04 }, - { 0x52, 0x09, 0, 1, 0x04, 0x04 }, - { 0x48, 0x00, 0, 1, 0x02, 0x26 }, - { 0x48, 0x00, 0, 1, 0x02, 0x26 }, - { 0x48, 0x00, 0, 1, 0x02, 0x26 }, - { 0x48, 0x00, 0, 1, 0x02, 0x26 }, - { 0x48, 0x01, 0, 1, 0x04, 0x20 }, - { 0x48, 0x01, 0, 1, 0x04, 0x20 }, - { 0x48, 0x01, 0, 1, 0x04, 0x20 }, - { 0x48, 0x01, 0, 1, 0x04, 0x20 }, - { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x60, 0x04, 0, 1, 0x02, 0x02 }, - { 0x60, 0x04, 0, 1, 0x02, 0x02 }, - { 0x60, 0x04, 0, 1, 0x02, 0x02 }, - { 0x60, 0x04, 0, 1, 0x02, 0x02 }, - { 0x49, 0x00, 0, 1, 0x02, 0x20 }, - { 0x49, 0x00, 0, 1, 0x02, 0x20 }, - { 0x49, 0x00, 0, 1, 0x02, 0x20 }, - { 0x49, 0x00, 0, 1, 0x02, 0x20 }, - { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, - { 0x23, 0x01, 0, 1, 0x04, 0x02 }, - { 0x24, 0x01, 0, 1, 0x04, 0x02 }, - { 0x25, 0x01, 0, 1, 0x04, 0x02 }, - { 0x25, 0x01, 0, 1, 0x04, 0x02 }, - { 0x51, 0x0F, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0F, 0, 1, 0x04, 0x02 }, - { 0x51, 0x0F, 0, 1, 0x05, 0x05 }, - { 0x51, 0x0F, 0, 1, 0x04, 0x02 }, - { 0x60, 0x05, 0, 1, 0x04, 0x02 }, - { 0x60, 0x05, 0, 1, 0x04, 0x02 }, - { 0x60, 0x05, 0, 1, 0x04, 0x02 }, - { 0x60, 0x05, 0, 1, 0x04, 0x02 }, - { 0x5F, 0x04, 0, 1, 0x03, 0x03 }, - { 0x5F, 0x04, 0, 1, 0x02, 0x02 }, - { 0x64, 0x04, 0, 1, 0x02, 0x02 }, - { 0x64, 0x04, 0, 1, 0x02, 0x02 }, - { 0x61, 0x03, 0, 1, 0x02, 0x02 }, - { 0x61, 0x03, 0, 1, 0x02, 0x02 }, - { 0x61, 0x03, 0, 1, 0x02, 0x02 }, - { 0x61, 0x03, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, - { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, - { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, - { 0x63, 0x06, 0, 0, 0x02, 0x26 }, - { 0x63, 0x06, 0, 0, 0x02, 0x26 }, - { 0x63, 0x06, 0, 0, 0x02, 0x26 }, - { 0x63, 0x06, 0, 0, 0x02, 0x26 }, - { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, - { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, - { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, - { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, - { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, - { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, - { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, - { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, - { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, - { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, - { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, - { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, - { 0x57, 0x05, 0, 1, 0x02, 0x02 }, - { 0x57, 0x05, 0, 1, 0x02, 0x02 }, - { 0x57, 0x05, 0, 1, 0x02, 0x02 }, - { 0x57, 0x05, 0, 1, 0x02, 0x02 }, - { 0x07, 0x03, 0, 1, 0x02, 0x02 }, - { 0x07, 0x03, 0, 1, 0x02, 0x02 }, - { 0x07, 0x03, 0, 1, 0x02, 0x02 }, - { 0x07, 0x03, 0, 1, 0x02, 0x02 }, - { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, - { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, - { 0x61, 0x04, 0, 1, 0x02, 0x02 }, - { 0x61, 0x04, 0, 1, 0x02, 0x02 }, - { 0x61, 0x04, 0, 1, 0x02, 0x02 }, - { 0x61, 0x04, 0, 1, 0x02, 0x02 }, - { 0x5F, 0x03, 0, 1, 0x03, 0x03 }, - { 0x5F, 0x03, 0, 1, 0x02, 0x02 }, - { 0x64, 0x03, 0, 1, 0x02, 0x02 }, - { 0x64, 0x03, 0, 1, 0x02, 0x02 }, - { 0x5F, 0x03, 0, 1, 0x00, 0x00 }, - { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x48, 0x02, 1, 1, 0x04, 0x20 }, - { 0x48, 0x02, 1, 1, 0x04, 0x20 }, - { 0x48, 0x02, 1, 1, 0x04, 0x20 }, - { 0x48, 0x02, 1, 1, 0x04, 0x20 }, - { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, - { 0x53, 0x06, 0, 1, 0x03, 0x03 }, - { 0x53, 0x06, 0, 1, 0x03, 0x03 }, - { 0x53, 0x06, 0, 1, 0x03, 0x03 }, - { 0x53, 0x06, 0, 1, 0x03, 0x03 }, - { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, - { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, - { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, - { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, - { 0x52, 0x0D, 0, 1, 0x03, 0x03 }, - { 0x52, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x52, 0x0D, 0, 1, 0x03, 0x03 }, - { 0x52, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, - { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, - { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, - { 0x66, 0x00, 0, 1, 0x02, 0x02 }, - { 0x66, 0x00, 0, 1, 0x02, 0x02 }, - { 0x66, 0x00, 0, 1, 0x02, 0x02 }, - { 0x66, 0x00, 0, 1, 0x02, 0x02 }, - { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, - { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, - { 0x32, 0x01, 0, 1, 0x02, 0x02 }, - { 0x32, 0x01, 0, 1, 0x02, 0x02 }, - { 0x32, 0x01, 0, 1, 0x02, 0x02 }, - { 0x32, 0x01, 0, 1, 0x02, 0x02 }, - { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x33, 0x00, 0, 1, 0x04, 0x20 }, - { 0x33, 0x00, 0, 1, 0x04, 0x20 }, - { 0x33, 0x00, 0, 1, 0x04, 0x20 }, - { 0x33, 0x00, 0, 1, 0x04, 0x20 }, - { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, - { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, - { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, - { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, - { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, - { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, - { 0x50, 0x00, 0, 1, 0x04, 0x20 }, - { 0x50, 0x00, 0, 1, 0x04, 0x20 }, - { 0x50, 0x00, 0, 1, 0x04, 0x20 }, - { 0x50, 0x00, 0, 1, 0x04, 0x20 }, - { 0x52, 0x0E, 0, 1, 0x03, 0x03 }, - { 0x52, 0x0E, 0, 1, 0x02, 0x02 }, - { 0x52, 0x0E, 0, 1, 0x03, 0x03 }, - { 0x52, 0x0E, 0, 1, 0x02, 0x02 }, - { 0x63, 0x08, 0, 0, 0x20, 0x20 }, - { 0x63, 0x08, 0, 0, 0x20, 0x20 }, - { 0x63, 0x08, 0, 0, 0x20, 0x20 }, - { 0x63, 0x08, 0, 0, 0x20, 0x20 }, - { 0x63, 0x09, 0, 0, 0x02, 0x02 }, - { 0x63, 0x09, 0, 0, 0x02, 0x02 }, - { 0x63, 0x09, 0, 0, 0x02, 0x02 }, - { 0x63, 0x09, 0, 0, 0x02, 0x02 }, - { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, - { 0x61, 0x05, 0, 1, 0x02, 0x02 }, - { 0x61, 0x05, 0, 1, 0x02, 0x02 }, - { 0x61, 0x05, 0, 1, 0x02, 0x02 }, - { 0x61, 0x05, 0, 1, 0x02, 0x02 }, - { 0x53, 0x07, 0, 1, 0x03, 0x03 }, - { 0x53, 0x07, 0, 1, 0x03, 0x03 }, - { 0x53, 0x07, 0, 1, 0x03, 0x03 }, - { 0x53, 0x07, 0, 1, 0x03, 0x03 }, - { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, - { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x41, 0x01, 0, 1, 0x02, 0x02 }, - { 0x41, 0x01, 0, 1, 0x02, 0x02 }, - { 0x41, 0x01, 0, 1, 0x02, 0x02 }, - { 0x41, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, - { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, - { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, - { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, - { 0x5C, 0x07, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x07, 0, 1, 0x02, 0x02 }, - { 0x5C, 0x07, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x07, 0, 1, 0x02, 0x02 }, - { 0x53, 0x08, 0, 1, 0x03, 0x03 }, - { 0x53, 0x08, 0, 1, 0x03, 0x03 }, - { 0x53, 0x08, 0, 1, 0x03, 0x03 }, - { 0x53, 0x08, 0, 1, 0x03, 0x03 }, - { 0x03, 0x02, 0, 1, 0x02, 0x02 }, - { 0x03, 0x02, 0, 1, 0x02, 0x02 }, - { 0x03, 0x02, 0, 1, 0x02, 0x02 }, - { 0x03, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, - { 0x43, 0x05, 0, 1, 0x02, 0x02 }, - { 0x43, 0x05, 0, 1, 0x02, 0x02 }, - { 0x43, 0x05, 0, 1, 0x02, 0x02 }, - { 0x43, 0x05, 0, 1, 0x02, 0x02 }, - { 0x43, 0x06, 0, 1, 0x02, 0x02 }, - { 0x43, 0x06, 0, 1, 0x02, 0x02 }, - { 0x43, 0x06, 0, 1, 0x02, 0x02 }, - { 0x43, 0x06, 0, 1, 0x02, 0x02 }, - { 0x51, 0x11, 0, 1, 0x03, 0x03 }, - { 0x51, 0x11, 0, 1, 0x02, 0x02 }, - { 0x51, 0x11, 0, 1, 0x03, 0x03 }, - { 0x51, 0x11, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, - { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, - { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, - { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, - { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, - { 0x37, 0x01, 0, 1, 0x04, 0x20 }, - { 0x37, 0x01, 0, 1, 0x04, 0x20 }, - { 0x37, 0x01, 0, 1, 0x04, 0x20 }, - { 0x37, 0x01, 0, 1, 0x04, 0x20 }, - { 0x08, 0x01, 0, 1, 0x04, 0x04 }, - { 0x08, 0x01, 0, 1, 0x04, 0x04 }, - { 0x08, 0x01, 0, 1, 0x04, 0x04 }, - { 0x08, 0x01, 0, 1, 0x04, 0x04 }, - { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, - { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, - { 0x09, 0x01, 0, 1, 0x02, 0x02 }, - { 0x09, 0x01, 0, 1, 0x02, 0x02 }, - { 0x09, 0x01, 0, 1, 0x02, 0x02 }, - { 0x09, 0x01, 0, 1, 0x02, 0x02 }, - { 0x52, 0x0F, 0, 1, 0x03, 0x03 }, - { 0x52, 0x0F, 0, 1, 0x02, 0x02 }, - { 0x52, 0x0F, 0, 1, 0x03, 0x03 }, - { 0x52, 0x0F, 0, 1, 0x02, 0x02 }, - { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, - { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, - { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, - { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, - { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, - { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, - { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, - { 0x17, 0x02, 1, 1, 0x02, 0x02 }, - { 0x17, 0x02, 1, 1, 0x02, 0x02 }, - { 0x17, 0x02, 1, 1, 0x02, 0x02 }, - { 0x17, 0x02, 1, 1, 0x02, 0x02 }, - { 0x4A, 0x01, 0, 0, 0x03, 0x03 }, - { 0x4A, 0x01, 0, 0, 0x02, 0x02 }, - { 0x4A, 0x01, 0, 0, 0x03, 0x03 }, - { 0x4A, 0x01, 0, 0, 0x02, 0x02 }, - { 0x43, 0x07, 0, 1, 0x02, 0x02 }, - { 0x43, 0x07, 0, 1, 0x02, 0x02 }, - { 0x43, 0x07, 0, 1, 0x02, 0x02 }, - { 0x43, 0x07, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, - { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, - { 0x56, 0x02, 0, 1, 0x12, 0x12 }, - { 0x56, 0x02, 0, 1, 0x02, 0x02 }, - { 0x56, 0x02, 0, 1, 0x12, 0x12 }, - { 0x56, 0x02, 0, 1, 0x02, 0x02 }, - { 0x57, 0x08, 0, 1, 0x02, 0x02 }, - { 0x57, 0x08, 0, 1, 0x02, 0x02 }, - { 0x57, 0x08, 0, 1, 0x02, 0x02 }, - { 0x57, 0x08, 0, 1, 0x02, 0x02 }, - { 0x56, 0x03, 0, 1, 0x03, 0x03 }, - { 0x56, 0x03, 0, 1, 0x03, 0x03 }, - { 0x56, 0x03, 0, 1, 0x03, 0x03 }, - { 0x56, 0x03, 0, 1, 0x03, 0x03 }, - { 0x57, 0x09, 0, 1, 0x03, 0x03 }, - { 0x57, 0x09, 0, 1, 0x03, 0x03 }, - { 0x57, 0x09, 0, 1, 0x03, 0x03 }, - { 0x57, 0x09, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, - { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, +EntranceInfo gEntranceTable[] = { + { 0x00, 0x00, 0, 1, 0x02, 0x02 }, { 0x00, 0x00, 0, 1, 0x02, 0x02 }, { 0x00, 0x00, 0, 1, 0x02, 0x02 }, + { 0x00, 0x00, 0, 1, 0x02, 0x02 }, { 0x01, 0x00, 0, 1, 0x02, 0x02 }, { 0x01, 0x00, 0, 1, 0x02, 0x02 }, + { 0x01, 0x00, 0, 1, 0x02, 0x02 }, { 0x01, 0x00, 0, 1, 0x02, 0x02 }, { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, + { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, { 0x0B, 0x00, 0, 1, 0x02, 0x02 }, + { 0x14, 0x00, 1, 1, 0x02, 0x02 }, { 0x14, 0x00, 1, 1, 0x02, 0x02 }, { 0x14, 0x00, 1, 1, 0x02, 0x02 }, + { 0x14, 0x00, 1, 1, 0x02, 0x02 }, { 0x05, 0x00, 0, 1, 0x02, 0x02 }, { 0x05, 0x00, 0, 1, 0x02, 0x02 }, + { 0x05, 0x00, 0, 1, 0x02, 0x02 }, { 0x05, 0x00, 0, 1, 0x02, 0x02 }, { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, + { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, { 0x6E, 0x00, 0, 1, 0x02, 0x02 }, + { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, + { 0x6C, 0x00, 0, 1, 0x02, 0x02 }, { 0x68, 0x00, 0, 1, 0x02, 0x02 }, { 0x68, 0x00, 0, 1, 0x02, 0x02 }, + { 0x68, 0x00, 0, 1, 0x02, 0x02 }, { 0x68, 0x00, 0, 1, 0x02, 0x02 }, { 0x69, 0x00, 0, 1, 0x02, 0x02 }, + { 0x69, 0x00, 0, 1, 0x02, 0x02 }, { 0x69, 0x00, 0, 1, 0x02, 0x02 }, { 0x69, 0x00, 0, 1, 0x02, 0x02 }, + { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, + { 0x6D, 0x00, 0, 1, 0x02, 0x02 }, { 0x02, 0x00, 0, 1, 0x02, 0x02 }, { 0x02, 0x00, 0, 1, 0x02, 0x02 }, + { 0x02, 0x00, 0, 1, 0x02, 0x02 }, { 0x02, 0x00, 0, 1, 0x02, 0x02 }, { 0x02, 0x00, 0, 1, 0x02, 0x02 }, + { 0x41, 0x00, 0, 1, 0x02, 0x26 }, { 0x41, 0x00, 0, 1, 0x02, 0x26 }, { 0x41, 0x00, 0, 1, 0x02, 0x26 }, + { 0x41, 0x00, 0, 1, 0x02, 0x26 }, { 0x41, 0x00, 0, 1, 0x02, 0x02 }, { 0x41, 0x00, 0, 1, 0x02, 0x02 }, + { 0x1B, 0x00, 1, 1, 0x03, 0x03 }, { 0x1C, 0x00, 1, 1, 0x02, 0x02 }, { 0x1D, 0x00, 1, 1, 0x03, 0x03 }, + { 0x1D, 0x00, 1, 1, 0x02, 0x02 }, { 0x07, 0x00, 0, 1, 0x02, 0x02 }, { 0x07, 0x00, 0, 1, 0x02, 0x02 }, + { 0x07, 0x00, 0, 1, 0x02, 0x02 }, { 0x07, 0x00, 0, 1, 0x02, 0x02 }, { 0x42, 0x00, 0, 1, 0x04, 0x20 }, + { 0x42, 0x00, 0, 1, 0x04, 0x20 }, { 0x42, 0x00, 0, 1, 0x04, 0x20 }, { 0x42, 0x00, 0, 1, 0x04, 0x20 }, + { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x00, 0, 1, 0x02, 0x02 }, { 0x38, 0x00, 0, 1, 0x04, 0x20 }, { 0x38, 0x00, 0, 1, 0x04, 0x20 }, + { 0x38, 0x00, 0, 1, 0x04, 0x20 }, { 0x38, 0x00, 0, 1, 0x04, 0x20 }, { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, + { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, { 0x6A, 0x00, 0, 1, 0x02, 0x02 }, + { 0x40, 0x00, 0, 1, 0x02, 0x26 }, { 0x40, 0x00, 0, 1, 0x02, 0x26 }, { 0x40, 0x00, 0, 1, 0x02, 0x26 }, + { 0x40, 0x00, 0, 1, 0x02, 0x26 }, { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, + { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, { 0x4C, 0x00, 0, 1, 0x04, 0x20 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, + { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, + { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, + { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, + { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x0B, 0x0B }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, + { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, { 0x43, 0x00, 0, 1, 0x02, 0x02 }, + { 0x10, 0x00, 0, 1, 0x04, 0x20 }, { 0x10, 0x00, 0, 1, 0x04, 0x20 }, { 0x10, 0x00, 0, 1, 0x04, 0x20 }, + { 0x10, 0x00, 0, 1, 0x04, 0x20 }, { 0x1E, 0x03, 1, 1, 0x03, 0x03 }, { 0x1F, 0x03, 1, 1, 0x02, 0x02 }, + { 0x1E, 0x03, 1, 1, 0x02, 0x02 }, { 0x1F, 0x03, 1, 1, 0x02, 0x02 }, { 0x44, 0x00, 0, 1, 0x07, 0x07 }, + { 0x44, 0x00, 0, 1, 0x07, 0x07 }, { 0x44, 0x00, 0, 1, 0x07, 0x07 }, { 0x44, 0x00, 0, 1, 0x07, 0x07 }, + { 0x44, 0x00, 0, 1, 0x0D, 0x02 }, { 0x44, 0x00, 0, 1, 0x0D, 0x02 }, { 0x44, 0x00, 0, 1, 0x03, 0x03 }, + { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, + { 0x4E, 0x00, 0, 1, 0x04, 0x20 }, { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, + { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, { 0x6B, 0x00, 0, 1, 0x22, 0x22 }, { 0x45, 0x00, 0, 1, 0x22, 0x04 }, + { 0x46, 0x00, 0, 1, 0x22, 0x04 }, { 0x45, 0x00, 0, 1, 0x22, 0x04 }, { 0x46, 0x00, 0, 1, 0x22, 0x04 }, + { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, + { 0x4D, 0x00, 0, 1, 0x02, 0x02 }, { 0x06, 0x00, 0, 1, 0x02, 0x02 }, { 0x06, 0x00, 0, 1, 0x02, 0x02 }, + { 0x06, 0x00, 0, 1, 0x02, 0x02 }, { 0x06, 0x00, 0, 1, 0x02, 0x02 }, { 0x06, 0x00, 0, 1, 0x02, 0x02 }, + { 0x06, 0x00, 0, 1, 0x02, 0x02 }, { 0x09, 0x00, 0, 1, 0x02, 0x02 }, { 0x09, 0x00, 0, 1, 0x02, 0x02 }, + { 0x09, 0x00, 0, 1, 0x02, 0x02 }, { 0x09, 0x00, 0, 1, 0x02, 0x02 }, { 0x09, 0x00, 0, 1, 0x02, 0x02 }, + { 0x17, 0x00, 1, 1, 0x02, 0x02 }, { 0x17, 0x00, 1, 1, 0x02, 0x02 }, { 0x17, 0x00, 1, 1, 0x02, 0x02 }, + { 0x17, 0x00, 1, 1, 0x02, 0x02 }, { 0x17, 0x00, 0, 1, 0x02, 0x02 }, { 0x17, 0x00, 0, 1, 0x02, 0x02 }, + { 0x17, 0x00, 0, 1, 0x02, 0x02 }, { 0x65, 0x00, 0, 1, 0x02, 0x02 }, { 0x65, 0x00, 0, 1, 0x02, 0x02 }, + { 0x65, 0x00, 0, 1, 0x02, 0x02 }, { 0x65, 0x00, 0, 1, 0x02, 0x02 }, { 0x08, 0x00, 0, 1, 0x04, 0x04 }, + { 0x08, 0x00, 0, 1, 0x04, 0x04 }, { 0x08, 0x00, 0, 1, 0x04, 0x04 }, { 0x08, 0x00, 0, 1, 0x04, 0x04 }, + { 0x27, 0x00, 0, 1, 0x04, 0x04 }, { 0x27, 0x00, 0, 1, 0x04, 0x04 }, { 0x27, 0x00, 0, 1, 0x04, 0x04 }, + { 0x27, 0x00, 0, 1, 0x04, 0x04 }, { 0x47, 0x00, 0, 1, 0x03, 0x03 }, { 0x47, 0x00, 0, 1, 0x03, 0x03 }, + { 0x47, 0x00, 0, 1, 0x03, 0x03 }, { 0x47, 0x00, 0, 1, 0x03, 0x03 }, { 0x47, 0x00, 0, 1, 0x0A, 0x0A }, + { 0x47, 0x00, 0, 1, 0x02, 0x0A }, { 0x47, 0x00, 1, 1, 0x0A, 0x0A }, { 0x47, 0x00, 0, 1, 0x0B, 0x0B }, + { 0x47, 0x00, 0, 1, 0x03, 0x03 }, { 0x47, 0x00, 0, 1, 0x02, 0x02 }, { 0x47, 0x00, 0, 1, 0x02, 0x02 }, + { 0x47, 0x00, 0, 1, 0x03, 0x03 }, { 0x47, 0x00, 0, 1, 0x03, 0x03 }, { 0x1E, 0x00, 1, 1, 0x03, 0x03 }, + { 0x1F, 0x00, 1, 1, 0x02, 0x02 }, { 0x1E, 0x00, 1, 1, 0x02, 0x02 }, { 0x1F, 0x00, 1, 1, 0x02, 0x02 }, + { 0x20, 0x00, 1, 1, 0x03, 0x03 }, { 0x21, 0x00, 1, 1, 0x02, 0x02 }, { 0x22, 0x00, 1, 1, 0x02, 0x02 }, + { 0x22, 0x00, 1, 1, 0x02, 0x02 }, { 0x20, 0x00, 0, 1, 0x08, 0x08 }, { 0x67, 0x00, 0, 1, 0x02, 0x02 }, + { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, + { 0x2C, 0x00, 0, 1, 0x04, 0x20 }, { 0x34, 0x00, 0, 1, 0x04, 0x04 }, { 0x34, 0x00, 0, 1, 0x04, 0x04 }, + { 0x34, 0x00, 0, 1, 0x04, 0x04 }, { 0x34, 0x00, 0, 1, 0x04, 0x04 }, { 0x34, 0x00, 0, 1, 0x04, 0x02 }, + { 0x34, 0x00, 0, 1, 0x10, 0x10 }, { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, + { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, { 0x2D, 0x00, 0, 1, 0x04, 0x04 }, { 0x01, 0x01, 1, 0, 0x02, 0x02 }, + { 0x01, 0x01, 1, 0, 0x02, 0x02 }, { 0x01, 0x01, 1, 0, 0x02, 0x02 }, { 0x01, 0x01, 1, 0, 0x02, 0x02 }, + { 0x26, 0x00, 0, 1, 0x04, 0x04 }, { 0x26, 0x00, 0, 1, 0x04, 0x04 }, { 0x26, 0x00, 0, 1, 0x04, 0x04 }, + { 0x26, 0x00, 0, 1, 0x04, 0x04 }, { 0x51, 0x00, 0, 1, 0x03, 0x03 }, { 0x51, 0x00, 0, 1, 0x02, 0x02 }, + { 0x51, 0x00, 0, 1, 0x03, 0x03 }, { 0x51, 0x00, 0, 1, 0x02, 0x02 }, { 0x51, 0x00, 0, 1, 0x04, 0x02 }, + { 0x51, 0x00, 0, 1, 0x21, 0x21 }, { 0x51, 0x00, 0, 1, 0x21, 0x21 }, { 0x51, 0x00, 0, 1, 0x23, 0x23 }, + { 0x51, 0x00, 0, 1, 0x03, 0x03 }, { 0x51, 0x00, 1, 1, 0x02, 0x02 }, { 0x51, 0x00, 0, 1, 0x23, 0x23 }, + { 0x51, 0x00, 0, 1, 0x03, 0x03 }, { 0x51, 0x00, 0, 1, 0x29, 0x29 }, { 0x51, 0x00, 1, 1, 0x03, 0x03 }, + { 0x52, 0x00, 0, 1, 0x03, 0x03 }, { 0x52, 0x00, 0, 1, 0x02, 0x02 }, { 0x52, 0x00, 0, 1, 0x03, 0x03 }, + { 0x52, 0x00, 0, 1, 0x02, 0x02 }, { 0x52, 0x00, 0, 1, 0x26, 0x26 }, { 0x52, 0x00, 0, 1, 0x21, 0x21 }, + { 0x52, 0x00, 1, 1, 0x21, 0x21 }, { 0x52, 0x00, 0, 1, 0x21, 0x21 }, { 0x52, 0x00, 1, 1, 0x02, 0x02 }, + { 0x53, 0x00, 0, 1, 0x03, 0x03 }, { 0x53, 0x00, 0, 1, 0x02, 0x02 }, { 0x53, 0x00, 0, 1, 0x03, 0x03 }, + { 0x53, 0x00, 0, 1, 0x02, 0x02 }, { 0x53, 0x00, 0, 1, 0x04, 0x02 }, { 0x53, 0x00, 1, 1, 0x02, 0x02 }, + { 0x54, 0x00, 1, 1, 0x03, 0x03 }, { 0x54, 0x00, 1, 1, 0x02, 0x02 }, { 0x54, 0x00, 1, 1, 0x03, 0x03 }, + { 0x54, 0x00, 1, 1, 0x02, 0x02 }, { 0x55, 0x00, 0, 1, 0x03, 0x03 }, { 0x55, 0x00, 0, 1, 0x02, 0x02 }, + { 0x55, 0x00, 0, 1, 0x03, 0x03 }, { 0x55, 0x00, 0, 1, 0x02, 0x02 }, { 0x55, 0x00, 1, 1, 0x0A, 0x0A }, + { 0x55, 0x00, 0, 1, 0x0A, 0x0A }, { 0x55, 0x00, 1, 1, 0x0A, 0x0A }, { 0x55, 0x00, 0, 1, 0x0D, 0x0A }, + { 0x55, 0x00, 0, 1, 0x0A, 0x0A }, { 0x55, 0x00, 0, 1, 0x0A, 0x0A }, { 0x55, 0x00, 1, 1, 0x02, 0x02 }, + { 0x55, 0x00, 1, 1, 0x02, 0x02 }, { 0x55, 0x00, 1, 1, 0x02, 0x02 }, { 0x55, 0x00, 1, 1, 0x02, 0x02 }, + { 0x56, 0x00, 1, 1, 0x02, 0x02 }, { 0x56, 0x00, 1, 1, 0x02, 0x02 }, { 0x56, 0x00, 1, 1, 0x02, 0x02 }, + { 0x56, 0x00, 1, 1, 0x02, 0x02 }, { 0x56, 0x00, 0, 1, 0x03, 0x03 }, { 0x56, 0x00, 0, 1, 0x00, 0x00 }, + { 0x57, 0x00, 1, 1, 0x03, 0x03 }, { 0x57, 0x00, 1, 1, 0x02, 0x02 }, { 0x57, 0x00, 1, 1, 0x03, 0x03 }, + { 0x57, 0x00, 1, 1, 0x02, 0x02 }, { 0x57, 0x00, 0, 1, 0x03, 0x03 }, { 0x57, 0x00, 1, 1, 0x02, 0x02 }, + { 0x58, 0x00, 0, 1, 0x02, 0x02 }, { 0x58, 0x00, 0, 1, 0x02, 0x02 }, { 0x58, 0x00, 0, 1, 0x02, 0x02 }, + { 0x58, 0x00, 0, 1, 0x02, 0x02 }, { 0x58, 0x00, 1, 1, 0x02, 0x02 }, { 0x58, 0x00, 1, 1, 0x02, 0x02 }, + { 0x59, 0x00, 0, 1, 0x03, 0x03 }, { 0x59, 0x00, 0, 1, 0x02, 0x02 }, { 0x59, 0x00, 0, 1, 0x03, 0x03 }, + { 0x59, 0x00, 0, 1, 0x02, 0x02 }, { 0x59, 0x00, 0, 1, 0x0D, 0x00 }, { 0x59, 0x00, 0, 1, 0x02, 0x02 }, + { 0x59, 0x00, 1, 1, 0x02, 0x02 }, { 0x59, 0x00, 0, 1, 0x02, 0x02 }, { 0x59, 0x00, 1, 1, 0x02, 0x02 }, + { 0x5A, 0x00, 0, 1, 0x03, 0x03 }, { 0x5A, 0x00, 0, 1, 0x02, 0x02 }, { 0x5A, 0x00, 0, 1, 0x03, 0x03 }, + { 0x5A, 0x00, 0, 1, 0x02, 0x02 }, { 0x5A, 0x00, 1, 1, 0x0C, 0x0A }, { 0x5A, 0x00, 1, 1, 0x0A, 0x0A }, + { 0x5A, 0x00, 1, 1, 0x02, 0x02 }, { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, + { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, { 0x5B, 0x00, 0, 1, 0x02, 0x02 }, + { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, + { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, { 0x5C, 0x00, 1, 1, 0x02, 0x02 }, { 0x5C, 0x00, 1, 1, 0x0F, 0x0F }, + { 0x5D, 0x00, 1, 1, 0x03, 0x03 }, { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, { 0x5D, 0x00, 1, 1, 0x03, 0x03 }, + { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, { 0x5D, 0x00, 1, 1, 0x21, 0x21 }, { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, + { 0x5D, 0x00, 1, 1, 0x02, 0x02 }, { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, + { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, { 0x5E, 0x00, 1, 1, 0x0E, 0x0E }, { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, { 0x0E, 0x01, 1, 1, 0x02, 0x02 }, + { 0x5F, 0x00, 0, 1, 0x03, 0x03 }, { 0x5F, 0x00, 0, 1, 0x02, 0x02 }, { 0x64, 0x00, 0, 1, 0x02, 0x02 }, + { 0x64, 0x00, 0, 1, 0x02, 0x02 }, { 0x64, 0x00, 0, 1, 0x04, 0x02 }, { 0x60, 0x00, 0, 1, 0x03, 0x03 }, + { 0x60, 0x00, 0, 1, 0x02, 0x02 }, { 0x60, 0x00, 0, 1, 0x03, 0x03 }, { 0x60, 0x00, 0, 1, 0x02, 0x02 }, + { 0x60, 0x00, 1, 1, 0x0A, 0x0A }, { 0x60, 0x00, 0, 1, 0x03, 0x03 }, { 0x60, 0x00, 0, 1, 0x02, 0x02 }, + { 0x60, 0x00, 1, 1, 0x02, 0x02 }, { 0x60, 0x00, 1, 1, 0x03, 0x03 }, { 0x60, 0x00, 1, 1, 0x03, 0x03 }, + { 0x61, 0x00, 0, 1, 0x02, 0x02 }, { 0x61, 0x00, 0, 1, 0x02, 0x02 }, { 0x61, 0x00, 0, 1, 0x02, 0x02 }, + { 0x61, 0x00, 0, 1, 0x02, 0x02 }, { 0x61, 0x00, 0, 1, 0x03, 0x03 }, { 0x61, 0x00, 0, 1, 0x02, 0x02 }, + { 0x62, 0x00, 0, 1, 0x02, 0x02 }, { 0x62, 0x00, 0, 1, 0x02, 0x02 }, { 0x62, 0x00, 0, 1, 0x02, 0x02 }, + { 0x62, 0x00, 0, 1, 0x02, 0x02 }, { 0x62, 0x00, 0, 1, 0x02, 0x02 }, { 0x62, 0x00, 1, 1, 0x02, 0x02 }, + { 0x58, 0x03, 0, 1, 0x00, 0x00 }, { 0x58, 0x03, 0, 1, 0x00, 0x00 }, { 0x58, 0x03, 0, 1, 0x00, 0x00 }, + { 0x58, 0x03, 0, 1, 0x00, 0x00 }, { 0x63, 0x00, 0, 1, 0x03, 0x03 }, { 0x63, 0x00, 0, 1, 0x02, 0x02 }, + { 0x63, 0x00, 0, 1, 0x03, 0x03 }, { 0x63, 0x00, 0, 1, 0x02, 0x02 }, { 0x63, 0x00, 0, 1, 0x20, 0x20 }, + { 0x63, 0x00, 0, 1, 0x2A, 0x2A }, { 0x63, 0x00, 1, 1, 0x02, 0x02 }, { 0x63, 0x00, 1, 1, 0x02, 0x02 }, + { 0x63, 0x00, 1, 1, 0x02, 0x02 }, { 0x63, 0x00, 1, 1, 0x02, 0x02 }, { 0x63, 0x00, 1, 1, 0x02, 0x02 }, + { 0x63, 0x00, 1, 1, 0x02, 0x02 }, { 0x63, 0x00, 1, 1, 0x02, 0x02 }, { 0x63, 0x00, 1, 1, 0x02, 0x02 }, + { 0x04, 0x00, 0, 1, 0x02, 0x02 }, { 0x04, 0x00, 0, 1, 0x02, 0x02 }, { 0x04, 0x00, 0, 1, 0x02, 0x02 }, + { 0x04, 0x00, 0, 1, 0x02, 0x02 }, { 0x03, 0x00, 0, 1, 0x02, 0x02 }, { 0x03, 0x00, 0, 1, 0x02, 0x02 }, + { 0x03, 0x00, 0, 1, 0x02, 0x02 }, { 0x03, 0x00, 0, 1, 0x02, 0x02 }, { 0x42, 0x01, 0, 1, 0x04, 0x20 }, + { 0x42, 0x01, 0, 1, 0x04, 0x20 }, { 0x42, 0x01, 0, 1, 0x04, 0x20 }, { 0x42, 0x01, 0, 1, 0x04, 0x20 }, + { 0x23, 0x00, 0, 1, 0x03, 0x03 }, { 0x24, 0x00, 0, 1, 0x02, 0x02 }, { 0x25, 0x00, 0, 1, 0x02, 0x02 }, + { 0x25, 0x00, 0, 1, 0x02, 0x02 }, { 0x04, 0x01, 1, 1, 0x02, 0x02 }, { 0x04, 0x01, 1, 1, 0x02, 0x02 }, + { 0x04, 0x01, 1, 1, 0x02, 0x02 }, { 0x04, 0x01, 1, 1, 0x02, 0x02 }, { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, { 0x0E, 0x00, 1, 1, 0x02, 0x02 }, + { 0x51, 0x01, 0, 1, 0x03, 0x03 }, { 0x51, 0x01, 0, 1, 0x02, 0x02 }, { 0x51, 0x01, 0, 1, 0x03, 0x03 }, + { 0x51, 0x01, 0, 1, 0x02, 0x02 }, { 0x51, 0x02, 1, 1, 0x03, 0x03 }, { 0x51, 0x02, 1, 1, 0x02, 0x02 }, + { 0x51, 0x02, 1, 1, 0x03, 0x03 }, { 0x51, 0x02, 1, 1, 0x02, 0x02 }, { 0x51, 0x03, 0, 1, 0x02, 0x02 }, + { 0x51, 0x03, 0, 1, 0x02, 0x02 }, { 0x51, 0x03, 0, 1, 0x02, 0x02 }, { 0x51, 0x03, 0, 1, 0x02, 0x02 }, + { 0x51, 0x04, 1, 1, 0x03, 0x03 }, { 0x51, 0x04, 1, 1, 0x02, 0x02 }, { 0x51, 0x04, 1, 1, 0x03, 0x03 }, + { 0x51, 0x04, 1, 1, 0x02, 0x02 }, { 0x51, 0x05, 0, 1, 0x03, 0x03 }, { 0x51, 0x05, 0, 1, 0x02, 0x02 }, + { 0x51, 0x05, 0, 1, 0x03, 0x03 }, { 0x51, 0x05, 0, 1, 0x02, 0x02 }, { 0x52, 0x01, 0, 1, 0x03, 0x03 }, + { 0x52, 0x01, 0, 1, 0x02, 0x02 }, { 0x52, 0x01, 0, 1, 0x03, 0x03 }, { 0x52, 0x01, 0, 1, 0x02, 0x02 }, + { 0x52, 0x02, 0, 1, 0x03, 0x03 }, { 0x52, 0x02, 0, 1, 0x02, 0x02 }, { 0x52, 0x02, 0, 1, 0x03, 0x03 }, + { 0x52, 0x02, 0, 1, 0x02, 0x02 }, { 0x54, 0x01, 1, 1, 0x03, 0x03 }, { 0x54, 0x01, 1, 1, 0x03, 0x03 }, + { 0x54, 0x01, 1, 1, 0x03, 0x03 }, { 0x54, 0x01, 1, 1, 0x03, 0x03 }, { 0x54, 0x02, 0, 1, 0x03, 0x03 }, + { 0x54, 0x02, 0, 1, 0x02, 0x02 }, { 0x54, 0x02, 0, 1, 0x03, 0x03 }, { 0x54, 0x02, 0, 1, 0x02, 0x02 }, + { 0x58, 0x01, 0, 1, 0x02, 0x02 }, { 0x58, 0x01, 0, 1, 0x02, 0x02 }, { 0x58, 0x01, 0, 1, 0x02, 0x02 }, + { 0x58, 0x01, 0, 1, 0x02, 0x02 }, { 0x5A, 0x01, 0, 1, 0x03, 0x03 }, { 0x5A, 0x01, 0, 1, 0x02, 0x02 }, + { 0x5A, 0x01, 0, 1, 0x03, 0x03 }, { 0x5A, 0x01, 0, 1, 0x02, 0x02 }, { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, + { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, { 0x5B, 0x01, 1, 1, 0x02, 0x02 }, + { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, + { 0x5B, 0x02, 0, 1, 0x02, 0x02 }, { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, + { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, { 0x5B, 0x03, 0, 1, 0x02, 0x02 }, { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, { 0x0E, 0x02, 1, 1, 0x02, 0x02 }, + { 0x60, 0x01, 0, 1, 0x03, 0x03 }, { 0x60, 0x01, 0, 1, 0x02, 0x02 }, { 0x60, 0x01, 0, 1, 0x03, 0x03 }, + { 0x60, 0x01, 0, 1, 0x02, 0x02 }, { 0x60, 0x02, 0, 1, 0x03, 0x03 }, { 0x60, 0x02, 0, 1, 0x02, 0x02 }, + { 0x60, 0x02, 0, 1, 0x03, 0x03 }, { 0x60, 0x02, 0, 1, 0x02, 0x02 }, { 0x62, 0x01, 0, 1, 0x02, 0x02 }, + { 0x62, 0x01, 0, 1, 0x02, 0x02 }, { 0x62, 0x01, 0, 1, 0x02, 0x02 }, { 0x62, 0x01, 0, 1, 0x02, 0x02 }, + { 0x38, 0x01, 0, 1, 0x04, 0x20 }, { 0x38, 0x01, 0, 1, 0x04, 0x20 }, { 0x38, 0x01, 0, 1, 0x04, 0x20 }, + { 0x38, 0x01, 0, 1, 0x04, 0x20 }, { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, { 0x1A, 0x05, 1, 1, 0x02, 0x02 }, { 0x20, 0x08, 0, 1, 0x04, 0x02 }, + { 0x21, 0x08, 0, 1, 0x04, 0x02 }, { 0x22, 0x08, 0, 1, 0x04, 0x02 }, { 0x22, 0x08, 0, 1, 0x04, 0x02 }, + { 0x20, 0x09, 0, 1, 0x04, 0x02 }, { 0x21, 0x09, 0, 1, 0x04, 0x02 }, { 0x22, 0x09, 0, 1, 0x04, 0x02 }, + { 0x22, 0x09, 0, 1, 0x04, 0x02 }, { 0x20, 0x0A, 0, 1, 0x04, 0x02 }, { 0x21, 0x0A, 0, 1, 0x04, 0x02 }, + { 0x22, 0x0A, 0, 1, 0x04, 0x02 }, { 0x22, 0x0A, 0, 1, 0x04, 0x02 }, { 0x54, 0x03, 1, 1, 0x03, 0x03 }, + { 0x54, 0x03, 1, 1, 0x02, 0x02 }, { 0x54, 0x03, 1, 1, 0x03, 0x03 }, { 0x54, 0x03, 1, 1, 0x02, 0x02 }, + { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, + { 0x54, 0x04, 0, 1, 0x2C, 0x2C }, { 0x5C, 0x01, 0, 1, 0x03, 0x03 }, { 0x5C, 0x01, 0, 1, 0x02, 0x02 }, + { 0x5C, 0x01, 0, 1, 0x03, 0x03 }, { 0x5C, 0x01, 0, 1, 0x02, 0x02 }, { 0x5C, 0x02, 0, 0, 0x03, 0x03 }, + { 0x5C, 0x02, 0, 0, 0x02, 0x02 }, { 0x5C, 0x02, 0, 0, 0x03, 0x03 }, { 0x5C, 0x02, 0, 0, 0x02, 0x02 }, + { 0x5C, 0x03, 0, 0, 0x03, 0x03 }, { 0x5C, 0x03, 0, 0, 0x02, 0x02 }, { 0x5C, 0x03, 0, 0, 0x03, 0x03 }, + { 0x5C, 0x03, 0, 0, 0x02, 0x02 }, { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, + { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, { 0x5C, 0x04, 0, 1, 0x02, 0x02 }, { 0x5C, 0x05, 0, 1, 0x03, 0x03 }, + { 0x5C, 0x05, 0, 1, 0x02, 0x02 }, { 0x5C, 0x05, 0, 1, 0x03, 0x03 }, { 0x5C, 0x05, 0, 1, 0x02, 0x02 }, + { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, + { 0x5C, 0x06, 1, 0, 0x0F, 0x0F }, { 0x51, 0x06, 0, 1, 0x03, 0x03 }, { 0x51, 0x06, 0, 1, 0x02, 0x02 }, + { 0x51, 0x06, 0, 1, 0x03, 0x03 }, { 0x51, 0x06, 0, 1, 0x02, 0x02 }, { 0x51, 0x07, 0, 1, 0x03, 0x03 }, + { 0x51, 0x07, 0, 1, 0x02, 0x02 }, { 0x51, 0x07, 0, 1, 0x03, 0x03 }, { 0x51, 0x07, 0, 1, 0x02, 0x02 }, + { 0x52, 0x03, 0, 1, 0x04, 0x02 }, { 0x52, 0x03, 0, 1, 0x04, 0x02 }, { 0x52, 0x03, 0, 1, 0x04, 0x02 }, + { 0x52, 0x03, 0, 1, 0x04, 0x02 }, { 0x53, 0x01, 0, 1, 0x02, 0x02 }, { 0x53, 0x01, 0, 1, 0x02, 0x02 }, + { 0x53, 0x01, 0, 1, 0x02, 0x02 }, { 0x53, 0x01, 0, 1, 0x02, 0x02 }, { 0x55, 0x01, 0, 1, 0x03, 0x03 }, + { 0x55, 0x01, 0, 1, 0x02, 0x02 }, { 0x55, 0x01, 0, 1, 0x03, 0x03 }, { 0x55, 0x01, 0, 1, 0x02, 0x02 }, + { 0x55, 0x02, 0, 1, 0x02, 0x02 }, { 0x55, 0x02, 0, 1, 0x02, 0x02 }, { 0x55, 0x02, 0, 1, 0x02, 0x02 }, + { 0x55, 0x02, 0, 1, 0x02, 0x02 }, { 0x55, 0x03, 0, 1, 0x04, 0x04 }, { 0x55, 0x03, 0, 1, 0x04, 0x04 }, + { 0x55, 0x03, 0, 1, 0x04, 0x04 }, { 0x55, 0x03, 0, 1, 0x04, 0x04 }, { 0x56, 0x01, 0, 1, 0x12, 0x12 }, + { 0x56, 0x01, 0, 1, 0x02, 0x02 }, { 0x56, 0x01, 0, 1, 0x12, 0x12 }, { 0x56, 0x01, 0, 1, 0x02, 0x02 }, + { 0x57, 0x01, 0, 1, 0x03, 0x03 }, { 0x57, 0x01, 0, 1, 0x02, 0x02 }, { 0x57, 0x01, 0, 1, 0x03, 0x03 }, + { 0x57, 0x01, 0, 1, 0x02, 0x02 }, { 0x57, 0x02, 0, 1, 0x13, 0x13 }, { 0x57, 0x02, 0, 1, 0x02, 0x02 }, + { 0x57, 0x02, 0, 1, 0x13, 0x13 }, { 0x57, 0x02, 0, 1, 0x02, 0x02 }, { 0x59, 0x01, 0, 1, 0x02, 0x02 }, + { 0x59, 0x01, 0, 1, 0x02, 0x02 }, { 0x59, 0x01, 0, 1, 0x02, 0x02 }, { 0x59, 0x01, 0, 1, 0x02, 0x02 }, + { 0x59, 0x02, 0, 1, 0x03, 0x03 }, { 0x59, 0x02, 0, 1, 0x02, 0x02 }, { 0x59, 0x02, 0, 1, 0x03, 0x03 }, + { 0x59, 0x02, 0, 1, 0x02, 0x02 }, { 0x5A, 0x02, 1, 1, 0x03, 0x03 }, { 0x5A, 0x02, 1, 1, 0x02, 0x02 }, + { 0x5A, 0x02, 1, 1, 0x03, 0x03 }, { 0x5A, 0x02, 1, 1, 0x02, 0x02 }, { 0x5A, 0x03, 1, 1, 0x03, 0x03 }, + { 0x5A, 0x03, 1, 1, 0x02, 0x02 }, { 0x5A, 0x03, 1, 1, 0x03, 0x03 }, { 0x5A, 0x03, 1, 1, 0x02, 0x02 }, + { 0x5D, 0x01, 0, 1, 0x03, 0x03 }, { 0x5D, 0x01, 0, 1, 0x02, 0x02 }, { 0x5D, 0x01, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x01, 0, 1, 0x02, 0x02 }, { 0x5D, 0x02, 0, 1, 0x03, 0x03 }, { 0x5D, 0x02, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x02, 0, 1, 0x03, 0x03 }, { 0x5D, 0x02, 0, 1, 0x02, 0x02 }, { 0x5D, 0x03, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x03, 0, 1, 0x02, 0x02 }, { 0x5D, 0x03, 0, 1, 0x03, 0x03 }, { 0x5D, 0x03, 0, 1, 0x02, 0x02 }, + { 0x5F, 0x01, 0, 1, 0x03, 0x03 }, { 0x5F, 0x01, 0, 1, 0x02, 0x02 }, { 0x64, 0x01, 0, 1, 0x05, 0x05 }, + { 0x64, 0x01, 0, 1, 0x05, 0x05 }, { 0x5F, 0x01, 0, 1, 0x00, 0x00 }, { 0x60, 0x03, 0, 1, 0x03, 0x03 }, + { 0x60, 0x03, 0, 1, 0x02, 0x02 }, { 0x60, 0x03, 0, 1, 0x03, 0x03 }, { 0x60, 0x03, 0, 1, 0x02, 0x02 }, + { 0x61, 0x01, 0, 1, 0x02, 0x02 }, { 0x61, 0x01, 0, 1, 0x02, 0x02 }, { 0x61, 0x01, 0, 1, 0x02, 0x02 }, + { 0x61, 0x01, 0, 1, 0x02, 0x02 }, { 0x61, 0x02, 0, 1, 0x02, 0x02 }, { 0x61, 0x02, 0, 1, 0x02, 0x02 }, + { 0x61, 0x02, 0, 1, 0x02, 0x02 }, { 0x61, 0x02, 0, 1, 0x02, 0x02 }, { 0x03, 0x01, 1, 1, 0x02, 0x02 }, + { 0x03, 0x01, 1, 1, 0x02, 0x02 }, { 0x03, 0x01, 1, 1, 0x02, 0x02 }, { 0x03, 0x01, 1, 1, 0x02, 0x02 }, + { 0x00, 0x01, 1, 0, 0x02, 0x02 }, { 0x00, 0x01, 1, 0, 0x02, 0x02 }, { 0x00, 0x01, 1, 0, 0x02, 0x02 }, + { 0x00, 0x01, 1, 0, 0x02, 0x02 }, { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, { 0x0E, 0x03, 1, 1, 0x02, 0x02 }, { 0x20, 0x01, 0, 1, 0x03, 0x03 }, + { 0x21, 0x01, 0, 1, 0x02, 0x02 }, { 0x22, 0x01, 0, 1, 0x02, 0x02 }, { 0x22, 0x01, 0, 1, 0x02, 0x02 }, + { 0x20, 0x02, 0, 1, 0x03, 0x03 }, { 0x21, 0x02, 0, 1, 0x02, 0x02 }, { 0x22, 0x02, 0, 1, 0x02, 0x02 }, + { 0x22, 0x02, 0, 1, 0x02, 0x02 }, { 0x20, 0x03, 1, 1, 0x03, 0x03 }, { 0x21, 0x03, 1, 1, 0x02, 0x02 }, + { 0x22, 0x03, 1, 1, 0x02, 0x02 }, { 0x22, 0x03, 1, 1, 0x02, 0x02 }, { 0x55, 0x04, 0, 0, 0x04, 0x04 }, + { 0x55, 0x04, 0, 0, 0x04, 0x04 }, { 0x55, 0x04, 0, 0, 0x04, 0x04 }, { 0x55, 0x04, 0, 0, 0x04, 0x04 }, + { 0x55, 0x05, 0, 0, 0x04, 0x04 }, { 0x55, 0x05, 0, 0, 0x04, 0x04 }, { 0x55, 0x05, 0, 0, 0x04, 0x04 }, + { 0x55, 0x05, 0, 0, 0x04, 0x04 }, { 0x1B, 0x02, 0, 0, 0x02, 0x02 }, { 0x1C, 0x02, 0, 0, 0x02, 0x02 }, + { 0x1D, 0x02, 0, 0, 0x02, 0x02 }, { 0x1D, 0x02, 0, 0, 0x02, 0x02 }, { 0x34, 0x01, 0, 1, 0x04, 0x04 }, + { 0x34, 0x01, 0, 1, 0x04, 0x04 }, { 0x34, 0x01, 0, 1, 0x04, 0x04 }, { 0x34, 0x01, 0, 1, 0x04, 0x04 }, + { 0x1B, 0x01, 0, 1, 0x03, 0x03 }, { 0x1C, 0x01, 0, 1, 0x02, 0x02 }, { 0x1D, 0x01, 0, 1, 0x02, 0x02 }, + { 0x1D, 0x01, 0, 1, 0x02, 0x02 }, { 0x51, 0x08, 1, 1, 0x03, 0x03 }, { 0x51, 0x08, 1, 1, 0x02, 0x02 }, + { 0x51, 0x08, 1, 1, 0x03, 0x03 }, { 0x51, 0x08, 1, 1, 0x02, 0x02 }, { 0x51, 0x09, 0, 1, 0x03, 0x03 }, + { 0x51, 0x09, 0, 1, 0x03, 0x03 }, { 0x51, 0x09, 0, 1, 0x03, 0x03 }, { 0x51, 0x09, 0, 1, 0x03, 0x03 }, + { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, + { 0x51, 0x0A, 0, 1, 0x03, 0x03 }, { 0x55, 0x06, 0, 1, 0x02, 0x02 }, { 0x55, 0x06, 0, 1, 0x02, 0x02 }, + { 0x55, 0x06, 0, 1, 0x02, 0x02 }, { 0x55, 0x06, 0, 1, 0x02, 0x02 }, { 0x51, 0x0B, 0, 1, 0x05, 0x05 }, + { 0x51, 0x0B, 0, 1, 0x04, 0x02 }, { 0x51, 0x0B, 0, 1, 0x05, 0x05 }, { 0x51, 0x0B, 0, 1, 0x04, 0x02 }, + { 0x51, 0x0C, 0, 1, 0x05, 0x05 }, { 0x51, 0x0C, 0, 1, 0x04, 0x02 }, { 0x51, 0x0C, 0, 1, 0x05, 0x05 }, + { 0x51, 0x0C, 0, 1, 0x04, 0x02 }, { 0x51, 0x0D, 0, 1, 0x05, 0x05 }, { 0x51, 0x0D, 0, 1, 0x04, 0x02 }, + { 0x51, 0x0D, 0, 1, 0x05, 0x05 }, { 0x51, 0x0D, 0, 1, 0x04, 0x02 }, { 0x45, 0x01, 0, 1, 0x03, 0x03 }, + { 0x46, 0x01, 0, 1, 0x02, 0x02 }, { 0x45, 0x01, 0, 1, 0x03, 0x03 }, { 0x46, 0x01, 0, 1, 0x02, 0x02 }, + { 0x1E, 0x01, 1, 1, 0x03, 0x03 }, { 0x1F, 0x01, 1, 1, 0x02, 0x02 }, { 0x1E, 0x01, 1, 1, 0x02, 0x02 }, + { 0x1F, 0x01, 1, 1, 0x02, 0x02 }, { 0x20, 0x04, 1, 1, 0x03, 0x03 }, { 0x21, 0x04, 1, 1, 0x02, 0x02 }, + { 0x22, 0x04, 1, 1, 0x02, 0x02 }, { 0x22, 0x04, 1, 1, 0x02, 0x02 }, { 0x20, 0x05, 0, 1, 0x04, 0x02 }, + { 0x21, 0x05, 0, 1, 0x04, 0x02 }, { 0x22, 0x05, 0, 1, 0x04, 0x02 }, { 0x22, 0x05, 0, 1, 0x04, 0x02 }, + { 0x52, 0x04, 0, 1, 0x02, 0x02 }, { 0x52, 0x04, 0, 1, 0x02, 0x02 }, { 0x52, 0x04, 0, 1, 0x02, 0x02 }, + { 0x52, 0x04, 0, 1, 0x02, 0x02 }, { 0x5D, 0x04, 0, 1, 0x03, 0x03 }, { 0x5D, 0x04, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x04, 0, 1, 0x03, 0x03 }, { 0x5D, 0x04, 0, 1, 0x02, 0x02 }, { 0x63, 0x01, 0, 0, 0x03, 0x03 }, + { 0x63, 0x01, 0, 0, 0x02, 0x02 }, { 0x63, 0x01, 0, 0, 0x03, 0x03 }, { 0x63, 0x01, 0, 0, 0x02, 0x02 }, + { 0x07, 0x01, 0, 1, 0x02, 0x02 }, { 0x07, 0x01, 0, 1, 0x02, 0x02 }, { 0x07, 0x01, 0, 1, 0x02, 0x02 }, + { 0x07, 0x01, 0, 1, 0x02, 0x02 }, { 0x07, 0x02, 1, 1, 0x02, 0x02 }, { 0x07, 0x02, 1, 1, 0x02, 0x02 }, + { 0x07, 0x02, 1, 1, 0x02, 0x02 }, { 0x07, 0x02, 1, 1, 0x02, 0x02 }, { 0x5D, 0x05, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x05, 0, 1, 0x02, 0x02 }, { 0x5D, 0x05, 0, 1, 0x03, 0x03 }, { 0x5D, 0x05, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x06, 0, 1, 0x03, 0x03 }, { 0x5D, 0x06, 0, 1, 0x02, 0x02 }, { 0x5D, 0x06, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x06, 0, 1, 0x02, 0x02 }, { 0x5D, 0x07, 0, 1, 0x03, 0x03 }, { 0x5D, 0x07, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x07, 0, 1, 0x03, 0x03 }, { 0x5D, 0x07, 0, 1, 0x02, 0x02 }, { 0x5D, 0x08, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x08, 0, 1, 0x02, 0x02 }, { 0x5D, 0x08, 0, 1, 0x03, 0x03 }, { 0x5D, 0x08, 0, 1, 0x02, 0x02 }, + { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, + { 0x43, 0x02, 0, 1, 0x0A, 0x0A }, { 0x44, 0x01, 0, 1, 0x02, 0x02 }, { 0x44, 0x01, 0, 1, 0x02, 0x02 }, + { 0x44, 0x01, 0, 1, 0x02, 0x02 }, { 0x44, 0x01, 0, 1, 0x02, 0x02 }, { 0x5D, 0x09, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x09, 0, 1, 0x02, 0x02 }, { 0x5D, 0x09, 0, 1, 0x03, 0x03 }, { 0x5D, 0x09, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x0A, 0, 1, 0x03, 0x03 }, { 0x5D, 0x0A, 0, 1, 0x02, 0x02 }, { 0x5D, 0x0A, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x0A, 0, 1, 0x02, 0x02 }, { 0x5D, 0x0B, 0, 1, 0x03, 0x03 }, { 0x5D, 0x0B, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x0B, 0, 1, 0x03, 0x03 }, { 0x5D, 0x0B, 0, 1, 0x02, 0x02 }, { 0x5D, 0x0C, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x0C, 0, 1, 0x02, 0x02 }, { 0x5D, 0x0C, 0, 1, 0x03, 0x03 }, { 0x5D, 0x0C, 0, 1, 0x02, 0x02 }, + { 0x63, 0x02, 0, 1, 0x03, 0x03 }, { 0x63, 0x02, 0, 1, 0x02, 0x02 }, { 0x63, 0x02, 0, 1, 0x03, 0x03 }, + { 0x63, 0x02, 0, 1, 0x02, 0x02 }, { 0x63, 0x03, 0, 1, 0x03, 0x03 }, { 0x63, 0x03, 0, 1, 0x02, 0x02 }, + { 0x63, 0x03, 0, 1, 0x03, 0x03 }, { 0x63, 0x03, 0, 1, 0x02, 0x02 }, { 0x42, 0x00, 0, 1, 0x02, 0x02 }, + { 0x42, 0x00, 0, 1, 0x02, 0x02 }, { 0x42, 0x00, 0, 1, 0x02, 0x02 }, { 0x42, 0x00, 0, 1, 0x02, 0x02 }, + { 0x56, 0x00, 0, 1, 0x02, 0x02 }, { 0x47, 0x00, 0, 1, 0x02, 0x02 }, { 0x42, 0x00, 0, 1, 0x02, 0x02 }, + { 0x42, 0x00, 0, 1, 0x02, 0x02 }, { 0x42, 0x00, 0, 1, 0x02, 0x02 }, { 0x42, 0x00, 0, 1, 0x02, 0x02 }, + { 0x42, 0x00, 0, 1, 0x02, 0x02 }, { 0x06, 0x01, 1, 1, 0x02, 0x02 }, { 0x06, 0x01, 1, 1, 0x02, 0x02 }, + { 0x06, 0x01, 1, 1, 0x02, 0x02 }, { 0x06, 0x01, 1, 1, 0x02, 0x02 }, { 0x36, 0x00, 0, 1, 0x04, 0x20 }, + { 0x36, 0x00, 0, 1, 0x04, 0x20 }, { 0x36, 0x00, 0, 1, 0x04, 0x20 }, { 0x36, 0x00, 0, 1, 0x04, 0x20 }, + { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, + { 0x2A, 0x00, 0, 1, 0x04, 0x20 }, { 0x13, 0x00, 1, 1, 0x02, 0x02 }, { 0x13, 0x00, 1, 1, 0x02, 0x02 }, + { 0x13, 0x00, 1, 1, 0x02, 0x02 }, { 0x13, 0x00, 1, 1, 0x02, 0x02 }, { 0x15, 0x00, 1, 1, 0x02, 0x02 }, + { 0x15, 0x00, 1, 1, 0x02, 0x02 }, { 0x15, 0x00, 1, 1, 0x02, 0x02 }, { 0x15, 0x00, 1, 1, 0x02, 0x02 }, + { 0x57, 0x06, 0, 1, 0x04, 0x02 }, { 0x57, 0x06, 0, 1, 0x04, 0x02 }, { 0x57, 0x06, 0, 1, 0x04, 0x02 }, + { 0x57, 0x06, 0, 1, 0x04, 0x02 }, { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, + { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, { 0x3A, 0x00, 0, 1, 0x02, 0x20 }, { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, + { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, { 0x51, 0x0E, 1, 1, 0x03, 0x03 }, + { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, + { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, + { 0x3B, 0x00, 0, 1, 0x02, 0x02 }, { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, + { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, { 0x3F, 0x00, 0, 1, 0x02, 0x26 }, { 0x43, 0x03, 0, 1, 0x02, 0x02 }, + { 0x43, 0x03, 0, 1, 0x02, 0x02 }, { 0x43, 0x03, 0, 1, 0x02, 0x02 }, { 0x43, 0x03, 0, 1, 0x02, 0x02 }, + { 0x43, 0x04, 0, 1, 0x02, 0x02 }, { 0x43, 0x04, 0, 1, 0x02, 0x02 }, { 0x43, 0x04, 0, 1, 0x02, 0x02 }, + { 0x43, 0x04, 0, 1, 0x02, 0x02 }, { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, + { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, { 0x58, 0x04, 0, 1, 0x2C, 0x2C }, { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, { 0x1A, 0x02, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x03, 1, 1, 0x02, 0x02 }, { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, { 0x1A, 0x04, 1, 1, 0x02, 0x02 }, { 0x55, 0x07, 0, 0, 0x04, 0x04 }, + { 0x55, 0x07, 0, 0, 0x04, 0x04 }, { 0x55, 0x07, 0, 0, 0x04, 0x04 }, { 0x55, 0x07, 0, 0, 0x04, 0x04 }, + { 0x55, 0x08, 0, 0, 0x04, 0x04 }, { 0x55, 0x08, 0, 0, 0x04, 0x04 }, { 0x55, 0x08, 0, 0, 0x04, 0x04 }, + { 0x55, 0x08, 0, 0, 0x04, 0x04 }, { 0x5F, 0x02, 0, 1, 0x02, 0x02 }, { 0x5F, 0x02, 0, 1, 0x02, 0x02 }, + { 0x64, 0x02, 0, 1, 0x02, 0x02 }, { 0x64, 0x02, 0, 1, 0x02, 0x02 }, { 0x5F, 0x02, 0, 1, 0x00, 0x00 }, + { 0x52, 0x05, 0, 1, 0x04, 0x02 }, { 0x52, 0x05, 0, 1, 0x04, 0x02 }, { 0x52, 0x05, 0, 1, 0x04, 0x02 }, + { 0x52, 0x05, 0, 1, 0x04, 0x02 }, { 0x52, 0x06, 0, 1, 0x04, 0x02 }, { 0x52, 0x06, 0, 1, 0x04, 0x02 }, + { 0x52, 0x06, 0, 1, 0x04, 0x02 }, { 0x52, 0x06, 0, 1, 0x04, 0x02 }, { 0x52, 0x07, 0, 1, 0x04, 0x02 }, + { 0x52, 0x07, 0, 1, 0x04, 0x02 }, { 0x52, 0x07, 0, 1, 0x04, 0x02 }, { 0x52, 0x07, 0, 1, 0x04, 0x02 }, + { 0x52, 0x08, 0, 1, 0x04, 0x02 }, { 0x52, 0x08, 0, 1, 0x04, 0x02 }, { 0x52, 0x08, 0, 1, 0x04, 0x02 }, + { 0x52, 0x08, 0, 1, 0x04, 0x02 }, { 0x53, 0x02, 0, 1, 0x04, 0x02 }, { 0x53, 0x02, 0, 1, 0x04, 0x02 }, + { 0x53, 0x02, 0, 1, 0x04, 0x02 }, { 0x53, 0x02, 0, 1, 0x04, 0x02 }, { 0x53, 0x03, 0, 1, 0x03, 0x03 }, + { 0x53, 0x03, 0, 1, 0x03, 0x03 }, { 0x53, 0x03, 0, 1, 0x03, 0x03 }, { 0x53, 0x03, 0, 1, 0x03, 0x03 }, + { 0x53, 0x04, 0, 1, 0x03, 0x03 }, { 0x53, 0x04, 0, 1, 0x03, 0x03 }, { 0x53, 0x04, 0, 1, 0x03, 0x03 }, + { 0x53, 0x04, 0, 1, 0x03, 0x03 }, { 0x53, 0x05, 0, 1, 0x03, 0x03 }, { 0x53, 0x05, 0, 1, 0x03, 0x03 }, + { 0x53, 0x05, 0, 1, 0x03, 0x03 }, { 0x53, 0x05, 0, 1, 0x03, 0x03 }, { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, + { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, { 0x5E, 0x01, 1, 1, 0x0E, 0x0E }, + { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, + { 0x5E, 0x02, 0, 1, 0x0E, 0x0E }, { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, + { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, { 0x3C, 0x00, 0, 1, 0x03, 0x03 }, { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, + { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, + { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, { 0x3D, 0x00, 0, 1, 0x02, 0x02 }, + { 0x63, 0x04, 0, 1, 0x04, 0x02 }, { 0x63, 0x04, 0, 1, 0x04, 0x02 }, { 0x63, 0x04, 0, 1, 0x04, 0x02 }, + { 0x63, 0x04, 0, 1, 0x04, 0x02 }, { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, + { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, { 0x2E, 0x00, 0, 1, 0x04, 0x20 }, { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, + { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, { 0x2F, 0x00, 0, 1, 0x04, 0x04 }, + { 0x30, 0x00, 0, 0, 0x04, 0x20 }, { 0x30, 0x00, 0, 0, 0x04, 0x20 }, { 0x30, 0x00, 0, 1, 0x04, 0x20 }, + { 0x30, 0x00, 0, 1, 0x04, 0x20 }, { 0x31, 0x00, 0, 1, 0x04, 0x20 }, { 0x31, 0x00, 0, 1, 0x04, 0x20 }, + { 0x31, 0x00, 0, 1, 0x04, 0x20 }, { 0x31, 0x00, 0, 1, 0x04, 0x20 }, { 0x1E, 0x04, 0, 1, 0x04, 0x02 }, + { 0x1F, 0x04, 0, 1, 0x04, 0x02 }, { 0x1E, 0x04, 0, 1, 0x04, 0x02 }, { 0x1F, 0x04, 0, 1, 0x04, 0x02 }, + { 0x32, 0x00, 0, 1, 0x02, 0x02 }, { 0x32, 0x00, 0, 1, 0x02, 0x02 }, { 0x32, 0x00, 0, 1, 0x02, 0x02 }, + { 0x32, 0x00, 0, 1, 0x02, 0x02 }, { 0x59, 0x05, 0, 1, 0x03, 0x03 }, { 0x59, 0x05, 0, 1, 0x03, 0x03 }, + { 0x59, 0x05, 0, 1, 0x03, 0x03 }, { 0x59, 0x05, 0, 1, 0x03, 0x03 }, { 0x35, 0x00, 0, 1, 0x04, 0x02 }, + { 0x35, 0x00, 0, 1, 0x04, 0x02 }, { 0x35, 0x00, 0, 1, 0x04, 0x02 }, { 0x35, 0x00, 0, 1, 0x04, 0x02 }, + { 0x37, 0x00, 0, 1, 0x04, 0x20 }, { 0x37, 0x00, 0, 1, 0x04, 0x20 }, { 0x37, 0x00, 0, 1, 0x04, 0x20 }, + { 0x37, 0x00, 0, 1, 0x04, 0x20 }, { 0x39, 0x00, 0, 1, 0x04, 0x04 }, { 0x39, 0x00, 0, 1, 0x04, 0x04 }, + { 0x39, 0x00, 0, 1, 0x04, 0x04 }, { 0x39, 0x00, 0, 1, 0x04, 0x04 }, { 0x5D, 0x0D, 0, 1, 0x03, 0x03 }, + { 0x5D, 0x0D, 0, 1, 0x02, 0x02 }, { 0x5D, 0x0D, 0, 1, 0x03, 0x03 }, { 0x5D, 0x0D, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x0E, 0, 1, 0x03, 0x05 }, { 0x5D, 0x0E, 0, 1, 0x02, 0x04 }, { 0x5D, 0x0E, 0, 1, 0x03, 0x05 }, + { 0x5D, 0x0E, 0, 1, 0x02, 0x04 }, { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, + { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, { 0x5D, 0x0F, 1, 1, 0x0F, 0x0F }, { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, { 0x5D, 0x10, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x11, 0, 1, 0x02, 0x02 }, { 0x20, 0x06, 0, 1, 0x04, 0x02 }, { 0x21, 0x06, 0, 1, 0x04, 0x02 }, + { 0x22, 0x06, 0, 1, 0x04, 0x02 }, { 0x22, 0x06, 0, 1, 0x04, 0x02 }, { 0x20, 0x07, 0, 1, 0x04, 0x02 }, + { 0x21, 0x07, 0, 1, 0x04, 0x02 }, { 0x22, 0x07, 0, 1, 0x04, 0x02 }, { 0x22, 0x07, 0, 1, 0x04, 0x02 }, + { 0x1E, 0x02, 0, 1, 0x04, 0x02 }, { 0x1F, 0x02, 0, 1, 0x04, 0x02 }, { 0x1E, 0x02, 0, 1, 0x03, 0x03 }, + { 0x1F, 0x02, 0, 1, 0x02, 0x02 }, { 0x58, 0x02, 0, 1, 0x02, 0x02 }, { 0x58, 0x02, 0, 1, 0x02, 0x02 }, + { 0x58, 0x02, 0, 1, 0x02, 0x02 }, { 0x58, 0x02, 0, 1, 0x02, 0x02 }, { 0x57, 0x03, 0, 1, 0x03, 0x03 }, + { 0x57, 0x03, 0, 1, 0x03, 0x03 }, { 0x57, 0x03, 0, 1, 0x03, 0x03 }, { 0x57, 0x03, 0, 1, 0x03, 0x03 }, + { 0x57, 0x04, 0, 1, 0x04, 0x02 }, { 0x57, 0x04, 0, 1, 0x04, 0x02 }, { 0x57, 0x04, 0, 1, 0x04, 0x02 }, + { 0x57, 0x04, 0, 1, 0x04, 0x02 }, { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, + { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, { 0x5A, 0x04, 0, 1, 0x04, 0x02 }, { 0x59, 0x03, 0, 1, 0x03, 0x03 }, + { 0x59, 0x03, 0, 1, 0x02, 0x02 }, { 0x59, 0x03, 0, 1, 0x03, 0x03 }, { 0x59, 0x03, 0, 1, 0x02, 0x02 }, + { 0x59, 0x04, 0, 1, 0x02, 0x02 }, { 0x59, 0x04, 0, 1, 0x02, 0x02 }, { 0x59, 0x04, 0, 1, 0x02, 0x02 }, + { 0x59, 0x04, 0, 1, 0x02, 0x02 }, { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, { 0x0E, 0x04, 1, 1, 0x02, 0x02 }, { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, { 0x0E, 0x05, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x06, 1, 1, 0x02, 0x02 }, { 0x30, 0x01, 0, 0, 0x04, 0x20 }, { 0x30, 0x01, 0, 0, 0x04, 0x20 }, + { 0x30, 0x01, 0, 1, 0x04, 0x20 }, { 0x30, 0x01, 0, 1, 0x04, 0x20 }, { 0x30, 0x02, 0, 0, 0x04, 0x20 }, + { 0x30, 0x02, 0, 0, 0x04, 0x20 }, { 0x30, 0x02, 0, 1, 0x04, 0x20 }, { 0x30, 0x02, 0, 1, 0x04, 0x20 }, + { 0x06, 0x02, 0, 0, 0x02, 0x02 }, { 0x06, 0x02, 0, 0, 0x02, 0x02 }, { 0x06, 0x02, 0, 0, 0x02, 0x02 }, + { 0x06, 0x02, 0, 0, 0x02, 0x02 }, { 0x06, 0x03, 0, 0, 0x02, 0x02 }, { 0x06, 0x03, 0, 0, 0x02, 0x02 }, + { 0x06, 0x03, 0, 0, 0x02, 0x02 }, { 0x06, 0x03, 0, 0, 0x02, 0x02 }, { 0x06, 0x04, 0, 1, 0x02, 0x02 }, + { 0x06, 0x04, 0, 1, 0x02, 0x02 }, { 0x06, 0x04, 0, 1, 0x02, 0x02 }, { 0x06, 0x04, 0, 1, 0x02, 0x02 }, + { 0x62, 0x02, 0, 1, 0x04, 0x02 }, { 0x62, 0x02, 0, 1, 0x04, 0x02 }, { 0x62, 0x02, 0, 1, 0x04, 0x02 }, + { 0x62, 0x02, 0, 1, 0x04, 0x02 }, { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, { 0x4A, 0x00, 0, 1, 0x02, 0x02 }, + { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, { 0x4A, 0x00, 0, 1, 0x02, 0x02 }, { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, + { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, { 0x4A, 0x00, 0, 1, 0x03, 0x03 }, { 0x02, 0x01, 1, 1, 0x02, 0x02 }, + { 0x02, 0x01, 1, 1, 0x02, 0x02 }, { 0x02, 0x01, 1, 1, 0x02, 0x02 }, { 0x02, 0x01, 1, 1, 0x02, 0x02 }, + { 0x12, 0x00, 1, 0, 0x02, 0x02 }, { 0x12, 0x00, 1, 0, 0x02, 0x02 }, { 0x12, 0x00, 1, 0, 0x02, 0x02 }, + { 0x12, 0x00, 1, 0, 0x02, 0x02 }, { 0x11, 0x00, 1, 0, 0x02, 0x02 }, { 0x11, 0x00, 1, 0, 0x02, 0x02 }, + { 0x11, 0x00, 1, 0, 0x02, 0x02 }, { 0x11, 0x00, 1, 0, 0x02, 0x02 }, { 0x18, 0x00, 1, 1, 0x02, 0x02 }, + { 0x18, 0x00, 1, 1, 0x02, 0x02 }, { 0x18, 0x00, 1, 1, 0x02, 0x02 }, { 0x18, 0x00, 1, 1, 0x02, 0x02 }, + { 0x16, 0x00, 1, 1, 0x02, 0x02 }, { 0x16, 0x00, 1, 1, 0x02, 0x02 }, { 0x16, 0x00, 1, 1, 0x02, 0x02 }, + { 0x16, 0x00, 1, 1, 0x02, 0x02 }, { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, + { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, { 0x0A, 0x00, 0, 1, 0x02, 0x02 }, { 0x19, 0x00, 1, 1, 0x02, 0x02 }, + { 0x19, 0x00, 1, 1, 0x02, 0x02 }, { 0x19, 0x00, 1, 1, 0x02, 0x02 }, { 0x19, 0x00, 1, 1, 0x02, 0x02 }, + { 0x05, 0x01, 1, 1, 0x03, 0x02 }, { 0x05, 0x01, 1, 1, 0x02, 0x02 }, { 0x05, 0x01, 1, 1, 0x03, 0x02 }, + { 0x05, 0x01, 1, 1, 0x02, 0x02 }, { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, + { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, { 0x0A, 0x01, 1, 1, 0x02, 0x02 }, { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, + { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, { 0x0A, 0x02, 0, 1, 0x02, 0x02 }, + { 0x63, 0x05, 0, 1, 0x04, 0x02 }, { 0x63, 0x05, 0, 1, 0x04, 0x02 }, { 0x63, 0x05, 0, 1, 0x04, 0x02 }, + { 0x63, 0x05, 0, 1, 0x04, 0x02 }, { 0x28, 0x00, 0, 1, 0x04, 0x04 }, { 0x28, 0x00, 0, 1, 0x04, 0x04 }, + { 0x28, 0x00, 0, 1, 0x04, 0x04 }, { 0x28, 0x00, 0, 1, 0x04, 0x04 }, { 0x29, 0x00, 0, 1, 0x04, 0x04 }, + { 0x29, 0x00, 0, 1, 0x04, 0x04 }, { 0x29, 0x00, 0, 1, 0x04, 0x04 }, { 0x29, 0x00, 0, 1, 0x04, 0x04 }, + { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, + { 0x2B, 0x00, 0, 1, 0x04, 0x20 }, { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, { 0x1A, 0x00, 1, 1, 0x02, 0x02 }, { 0x55, 0x09, 0, 0, 0x04, 0x04 }, + { 0x55, 0x09, 0, 0, 0x04, 0x04 }, { 0x55, 0x09, 0, 0, 0x04, 0x04 }, { 0x55, 0x09, 0, 0, 0x04, 0x04 }, + { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, + { 0x55, 0x0A, 0, 0, 0x04, 0x04 }, { 0x52, 0x09, 0, 1, 0x04, 0x04 }, { 0x52, 0x09, 0, 1, 0x04, 0x04 }, + { 0x52, 0x09, 0, 1, 0x04, 0x04 }, { 0x52, 0x09, 0, 1, 0x04, 0x04 }, { 0x48, 0x00, 0, 1, 0x02, 0x26 }, + { 0x48, 0x00, 0, 1, 0x02, 0x26 }, { 0x48, 0x00, 0, 1, 0x02, 0x26 }, { 0x48, 0x00, 0, 1, 0x02, 0x26 }, + { 0x48, 0x01, 0, 1, 0x04, 0x20 }, { 0x48, 0x01, 0, 1, 0x04, 0x20 }, { 0x48, 0x01, 0, 1, 0x04, 0x20 }, + { 0x48, 0x01, 0, 1, 0x04, 0x20 }, { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, + { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, { 0x55, 0x0B, 0, 1, 0x04, 0x02 }, { 0x60, 0x04, 0, 1, 0x02, 0x02 }, + { 0x60, 0x04, 0, 1, 0x02, 0x02 }, { 0x60, 0x04, 0, 1, 0x02, 0x02 }, { 0x60, 0x04, 0, 1, 0x02, 0x02 }, + { 0x49, 0x00, 0, 1, 0x02, 0x20 }, { 0x49, 0x00, 0, 1, 0x02, 0x20 }, { 0x49, 0x00, 0, 1, 0x02, 0x20 }, + { 0x49, 0x00, 0, 1, 0x02, 0x20 }, { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, + { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, { 0x52, 0x0A, 0, 1, 0x04, 0x02 }, { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x00, 0, 1, 0x04, 0x02 }, { 0x23, 0x01, 0, 1, 0x04, 0x02 }, { 0x24, 0x01, 0, 1, 0x04, 0x02 }, + { 0x25, 0x01, 0, 1, 0x04, 0x02 }, { 0x25, 0x01, 0, 1, 0x04, 0x02 }, { 0x51, 0x0F, 0, 1, 0x05, 0x05 }, + { 0x51, 0x0F, 0, 1, 0x04, 0x02 }, { 0x51, 0x0F, 0, 1, 0x05, 0x05 }, { 0x51, 0x0F, 0, 1, 0x04, 0x02 }, + { 0x60, 0x05, 0, 1, 0x04, 0x02 }, { 0x60, 0x05, 0, 1, 0x04, 0x02 }, { 0x60, 0x05, 0, 1, 0x04, 0x02 }, + { 0x60, 0x05, 0, 1, 0x04, 0x02 }, { 0x5F, 0x04, 0, 1, 0x03, 0x03 }, { 0x5F, 0x04, 0, 1, 0x02, 0x02 }, + { 0x64, 0x04, 0, 1, 0x02, 0x02 }, { 0x64, 0x04, 0, 1, 0x02, 0x02 }, { 0x61, 0x03, 0, 1, 0x02, 0x02 }, + { 0x61, 0x03, 0, 1, 0x02, 0x02 }, { 0x61, 0x03, 0, 1, 0x02, 0x02 }, { 0x61, 0x03, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x00, 0, 1, 0x02, 0x02 }, { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, { 0x0C, 0x01, 0, 1, 0x02, 0x02 }, { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, { 0x0C, 0x02, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x03, 0, 1, 0x02, 0x02 }, { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, { 0x0C, 0x04, 0, 1, 0x02, 0x02 }, { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, { 0x0C, 0x05, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x06, 0, 1, 0x02, 0x02 }, { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, { 0x0C, 0x07, 0, 1, 0x02, 0x02 }, { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, { 0x0C, 0x08, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x09, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0A, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0B, 0, 1, 0x02, 0x02 }, + { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, + { 0x0E, 0x07, 1, 1, 0x02, 0x02 }, { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, { 0x1A, 0x01, 1, 1, 0x02, 0x02 }, { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, + { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, { 0x3B, 0x01, 0, 1, 0x02, 0x02 }, + { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, + { 0x3B, 0x02, 0, 1, 0x02, 0x02 }, { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, + { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, { 0x5B, 0x04, 0, 1, 0x02, 0x02 }, { 0x63, 0x06, 0, 0, 0x02, 0x26 }, + { 0x63, 0x06, 0, 0, 0x02, 0x26 }, { 0x63, 0x06, 0, 0, 0x02, 0x26 }, { 0x63, 0x06, 0, 0, 0x02, 0x26 }, + { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, + { 0x63, 0x07, 0, 0, 0x2E, 0x2E }, { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, + { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, { 0x5B, 0x05, 0, 1, 0x02, 0x02 }, { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, + { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, { 0x5B, 0x06, 0, 1, 0x2C, 0x2C }, + { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, + { 0x5B, 0x07, 0, 1, 0x2C, 0x2C }, { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, + { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, { 0x5B, 0x08, 0, 0, 0x02, 0x02 }, { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, + { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, { 0x62, 0x03, 0, 1, 0x2C, 0x2C }, + { 0x57, 0x05, 0, 1, 0x02, 0x02 }, { 0x57, 0x05, 0, 1, 0x02, 0x02 }, { 0x57, 0x05, 0, 1, 0x02, 0x02 }, + { 0x57, 0x05, 0, 1, 0x02, 0x02 }, { 0x07, 0x03, 0, 1, 0x02, 0x02 }, { 0x07, 0x03, 0, 1, 0x02, 0x02 }, + { 0x07, 0x03, 0, 1, 0x02, 0x02 }, { 0x07, 0x03, 0, 1, 0x02, 0x02 }, { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, + { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, { 0x52, 0x0B, 0, 1, 0x04, 0x02 }, + { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, + { 0x3B, 0x03, 0, 1, 0x02, 0x02 }, { 0x61, 0x04, 0, 1, 0x02, 0x02 }, { 0x61, 0x04, 0, 1, 0x02, 0x02 }, + { 0x61, 0x04, 0, 1, 0x02, 0x02 }, { 0x61, 0x04, 0, 1, 0x02, 0x02 }, { 0x5F, 0x03, 0, 1, 0x03, 0x03 }, + { 0x5F, 0x03, 0, 1, 0x02, 0x02 }, { 0x64, 0x03, 0, 1, 0x02, 0x02 }, { 0x64, 0x03, 0, 1, 0x02, 0x02 }, + { 0x5F, 0x03, 0, 1, 0x00, 0x00 }, { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, + { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, { 0x52, 0x0C, 0, 1, 0x04, 0x02 }, { 0x48, 0x02, 1, 1, 0x04, 0x20 }, + { 0x48, 0x02, 1, 1, 0x04, 0x20 }, { 0x48, 0x02, 1, 1, 0x04, 0x20 }, { 0x48, 0x02, 1, 1, 0x04, 0x20 }, + { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, + { 0x4B, 0x00, 0, 1, 0x04, 0x20 }, { 0x53, 0x06, 0, 1, 0x03, 0x03 }, { 0x53, 0x06, 0, 1, 0x03, 0x03 }, + { 0x53, 0x06, 0, 1, 0x03, 0x03 }, { 0x53, 0x06, 0, 1, 0x03, 0x03 }, { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, + { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, { 0x51, 0x10, 0, 1, 0x0B, 0x0B }, + { 0x52, 0x0D, 0, 1, 0x03, 0x03 }, { 0x52, 0x0D, 0, 1, 0x02, 0x02 }, { 0x52, 0x0D, 0, 1, 0x03, 0x03 }, + { 0x52, 0x0D, 0, 1, 0x02, 0x02 }, { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, + { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, { 0x4F, 0x00, 0, 1, 0x03, 0x03 }, + { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x06, 1, 1, 0x02, 0x02 }, { 0x66, 0x00, 0, 1, 0x02, 0x02 }, { 0x66, 0x00, 0, 1, 0x02, 0x02 }, + { 0x66, 0x00, 0, 1, 0x02, 0x02 }, { 0x66, 0x00, 0, 1, 0x02, 0x02 }, { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, + { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, { 0x1A, 0x07, 1, 1, 0x02, 0x02 }, + { 0x32, 0x01, 0, 1, 0x02, 0x02 }, { 0x32, 0x01, 0, 1, 0x02, 0x02 }, { 0x32, 0x01, 0, 1, 0x02, 0x02 }, + { 0x32, 0x01, 0, 1, 0x02, 0x02 }, { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, + { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, { 0x2C, 0x01, 0, 1, 0x04, 0x20 }, { 0x33, 0x00, 0, 1, 0x04, 0x20 }, + { 0x33, 0x00, 0, 1, 0x04, 0x20 }, { 0x33, 0x00, 0, 1, 0x04, 0x20 }, { 0x33, 0x00, 0, 1, 0x04, 0x20 }, + { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, + { 0x0D, 0x01, 0, 0, 0x04, 0x02 }, { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, { 0x0D, 0x02, 0, 1, 0x04, 0x02 }, { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, { 0x0D, 0x03, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x04, 0, 1, 0x04, 0x02 }, { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, { 0x0D, 0x05, 0, 1, 0x04, 0x02 }, { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, { 0x0D, 0x06, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, + { 0x0D, 0x07, 0, 1, 0x04, 0x02 }, { 0x50, 0x00, 0, 1, 0x04, 0x20 }, { 0x50, 0x00, 0, 1, 0x04, 0x20 }, + { 0x50, 0x00, 0, 1, 0x04, 0x20 }, { 0x50, 0x00, 0, 1, 0x04, 0x20 }, { 0x52, 0x0E, 0, 1, 0x03, 0x03 }, + { 0x52, 0x0E, 0, 1, 0x02, 0x02 }, { 0x52, 0x0E, 0, 1, 0x03, 0x03 }, { 0x52, 0x0E, 0, 1, 0x02, 0x02 }, + { 0x63, 0x08, 0, 0, 0x20, 0x20 }, { 0x63, 0x08, 0, 0, 0x20, 0x20 }, { 0x63, 0x08, 0, 0, 0x20, 0x20 }, + { 0x63, 0x08, 0, 0, 0x20, 0x20 }, { 0x63, 0x09, 0, 0, 0x02, 0x02 }, { 0x63, 0x09, 0, 0, 0x02, 0x02 }, + { 0x63, 0x09, 0, 0, 0x02, 0x02 }, { 0x63, 0x09, 0, 0, 0x02, 0x02 }, { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, + { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, { 0x57, 0x07, 0, 1, 0x2C, 0x2C }, + { 0x61, 0x05, 0, 1, 0x02, 0x02 }, { 0x61, 0x05, 0, 1, 0x02, 0x02 }, { 0x61, 0x05, 0, 1, 0x02, 0x02 }, + { 0x61, 0x05, 0, 1, 0x02, 0x02 }, { 0x53, 0x07, 0, 1, 0x03, 0x03 }, { 0x53, 0x07, 0, 1, 0x03, 0x03 }, + { 0x53, 0x07, 0, 1, 0x03, 0x03 }, { 0x53, 0x07, 0, 1, 0x03, 0x03 }, { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, + { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, { 0x0F, 0x00, 1, 1, 0x02, 0x02 }, + { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, + { 0x0C, 0x0C, 0, 1, 0x02, 0x02 }, { 0x41, 0x01, 0, 1, 0x02, 0x02 }, { 0x41, 0x01, 0, 1, 0x02, 0x02 }, + { 0x41, 0x01, 0, 1, 0x02, 0x02 }, { 0x41, 0x01, 0, 1, 0x02, 0x02 }, { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, + { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, { 0x3D, 0x01, 0, 1, 0x04, 0x04 }, + { 0x5C, 0x07, 0, 1, 0x03, 0x03 }, { 0x5C, 0x07, 0, 1, 0x02, 0x02 }, { 0x5C, 0x07, 0, 1, 0x03, 0x03 }, + { 0x5C, 0x07, 0, 1, 0x02, 0x02 }, { 0x53, 0x08, 0, 1, 0x03, 0x03 }, { 0x53, 0x08, 0, 1, 0x03, 0x03 }, + { 0x53, 0x08, 0, 1, 0x03, 0x03 }, { 0x53, 0x08, 0, 1, 0x03, 0x03 }, { 0x03, 0x02, 0, 1, 0x02, 0x02 }, + { 0x03, 0x02, 0, 1, 0x02, 0x02 }, { 0x03, 0x02, 0, 1, 0x02, 0x02 }, { 0x03, 0x02, 0, 1, 0x02, 0x02 }, + { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, + { 0x3D, 0x02, 0, 1, 0x02, 0x02 }, { 0x43, 0x05, 0, 1, 0x02, 0x02 }, { 0x43, 0x05, 0, 1, 0x02, 0x02 }, + { 0x43, 0x05, 0, 1, 0x02, 0x02 }, { 0x43, 0x05, 0, 1, 0x02, 0x02 }, { 0x43, 0x06, 0, 1, 0x02, 0x02 }, + { 0x43, 0x06, 0, 1, 0x02, 0x02 }, { 0x43, 0x06, 0, 1, 0x02, 0x02 }, { 0x43, 0x06, 0, 1, 0x02, 0x02 }, + { 0x51, 0x11, 0, 1, 0x03, 0x03 }, { 0x51, 0x11, 0, 1, 0x02, 0x02 }, { 0x51, 0x11, 0, 1, 0x03, 0x03 }, + { 0x51, 0x11, 0, 1, 0x02, 0x02 }, { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, { 0x3E, 0x01, 0, 1, 0x02, 0x02 }, { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, { 0x3E, 0x02, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x03, 0, 1, 0x02, 0x02 }, { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, { 0x3E, 0x04, 0, 1, 0x02, 0x02 }, { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, + { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, { 0x3E, 0x05, 0, 1, 0x02, 0x03 }, + { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x06, 0, 1, 0x02, 0x02 }, { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, { 0x3E, 0x07, 0, 1, 0x02, 0x02 }, { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, { 0x3E, 0x08, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x09, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0A, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0B, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x0C, 0, 1, 0x02, 0x02 }, { 0x37, 0x01, 0, 1, 0x04, 0x20 }, { 0x37, 0x01, 0, 1, 0x04, 0x20 }, + { 0x37, 0x01, 0, 1, 0x04, 0x20 }, { 0x37, 0x01, 0, 1, 0x04, 0x20 }, { 0x08, 0x01, 0, 1, 0x04, 0x04 }, + { 0x08, 0x01, 0, 1, 0x04, 0x04 }, { 0x08, 0x01, 0, 1, 0x04, 0x04 }, { 0x08, 0x01, 0, 1, 0x04, 0x04 }, + { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, + { 0x4C, 0x01, 0, 1, 0x04, 0x20 }, { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, + { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, { 0x63, 0x0A, 0, 1, 0x04, 0x02 }, { 0x09, 0x01, 0, 1, 0x02, 0x02 }, + { 0x09, 0x01, 0, 1, 0x02, 0x02 }, { 0x09, 0x01, 0, 1, 0x02, 0x02 }, { 0x09, 0x01, 0, 1, 0x02, 0x02 }, + { 0x52, 0x0F, 0, 1, 0x03, 0x03 }, { 0x52, 0x0F, 0, 1, 0x02, 0x02 }, { 0x52, 0x0F, 0, 1, 0x03, 0x03 }, + { 0x52, 0x0F, 0, 1, 0x02, 0x02 }, { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, + { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, { 0x5B, 0x09, 0, 0, 0x02, 0x02 }, { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, + { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, { 0x4C, 0x02, 0, 1, 0x04, 0x20 }, + { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, + { 0x55, 0x0C, 0, 1, 0x04, 0x02 }, { 0x17, 0x02, 1, 1, 0x02, 0x02 }, { 0x17, 0x02, 1, 1, 0x02, 0x02 }, + { 0x17, 0x02, 1, 1, 0x02, 0x02 }, { 0x17, 0x02, 1, 1, 0x02, 0x02 }, { 0x4A, 0x01, 0, 0, 0x03, 0x03 }, + { 0x4A, 0x01, 0, 0, 0x02, 0x02 }, { 0x4A, 0x01, 0, 0, 0x03, 0x03 }, { 0x4A, 0x01, 0, 0, 0x02, 0x02 }, + { 0x43, 0x07, 0, 1, 0x02, 0x02 }, { 0x43, 0x07, 0, 1, 0x02, 0x02 }, { 0x43, 0x07, 0, 1, 0x02, 0x02 }, + { 0x43, 0x07, 0, 1, 0x02, 0x02 }, { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, + { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, { 0x5D, 0x12, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, + { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, { 0x3E, 0x0D, 0, 1, 0x02, 0x02 }, + { 0x56, 0x02, 0, 1, 0x12, 0x12 }, { 0x56, 0x02, 0, 1, 0x02, 0x02 }, { 0x56, 0x02, 0, 1, 0x12, 0x12 }, + { 0x56, 0x02, 0, 1, 0x02, 0x02 }, { 0x57, 0x08, 0, 1, 0x02, 0x02 }, { 0x57, 0x08, 0, 1, 0x02, 0x02 }, + { 0x57, 0x08, 0, 1, 0x02, 0x02 }, { 0x57, 0x08, 0, 1, 0x02, 0x02 }, { 0x56, 0x03, 0, 1, 0x03, 0x03 }, + { 0x56, 0x03, 0, 1, 0x03, 0x03 }, { 0x56, 0x03, 0, 1, 0x03, 0x03 }, { 0x56, 0x03, 0, 1, 0x03, 0x03 }, + { 0x57, 0x09, 0, 1, 0x03, 0x03 }, { 0x57, 0x09, 0, 1, 0x03, 0x03 }, { 0x57, 0x09, 0, 1, 0x03, 0x03 }, + { 0x57, 0x09, 0, 1, 0x03, 0x03 }, { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, + { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, { 0x5C, 0x08, 0, 1, 0x03, 0x03 }, }; -#define TITLED_SCENE(name, title, unk_10, config, unk_12) \ -{ \ - (u32)_##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, \ - (u32)_##title##SegmentRomStart, (u32)_##title##SegmentRomEnd, \ - unk_10, config, unk_12 \ -} +#define TITLED_SCENE(name, title, unk_10, config, unk_12) \ + { \ + (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, (u32)_##title##SegmentRomStart, \ + (u32)_##title##SegmentRomEnd, unk_10, config, unk_12 \ + } #define UNTITLED_SCENE(name, unk_10, config, unk_12) \ -{ \ - (u32)_##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, \ - 0, 0, \ - unk_10, config, unk_12 \ -} + { (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, 0, 0, unk_10, config, unk_12 } -Scene gSceneTable[] = -{ +Scene gSceneTable[] = { TITLED_SCENE(ydan_scene, g_pn_06, 1, 19, 2), TITLED_SCENE(ddan_scene, g_pn_08, 1, 20, 3), TITLED_SCENE(bdan_scene, g_pn_07, 1, 21, 4), @@ -1689,8 +645,7 @@ Scene gSceneTable[] = UNTITLED_SCENE(testroom_scene, 0, 0, 0), }; -Gfx sDefaultDisplayList[] = -{ +Gfx sDefaultDisplayList[] = { gsSPSegment(0x08, D_80127098), gsSPSegment(0x09, D_80127098), gsSPSegment(0x0A, D_80127098), @@ -1704,31 +659,28 @@ Gfx sDefaultDisplayList[] = }; // Computes next entrance index based on age and day time to set the fade out transition -void func_800994A0(GlobalContext* globalCtx) -{ +void func_800994A0(GlobalContext* globalCtx) { s16 computedEntranceIndex; - if (gSaveContext.night_flag) - { - if (LINK_IS_CHILD) + if (gSaveContext.night_flag) { + if (LINK_IS_CHILD) { computedEntranceIndex = globalCtx->nextEntranceIndex + 1; - else + } else { computedEntranceIndex = globalCtx->nextEntranceIndex + 3; - } - else - { - if (LINK_IS_CHILD) + } + } else { + if (LINK_IS_CHILD) { computedEntranceIndex = globalCtx->nextEntranceIndex; - else + } else { computedEntranceIndex = globalCtx->nextEntranceIndex + 2; + } } globalCtx->fadeOutTransition = gEntranceTable[computedEntranceIndex].fadeOutTransition; } // Scene Draw Config 0 -void func_80099550(GlobalContext* globalCtx) -{ +void func_80099550(GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; @@ -1743,8 +695,7 @@ void func_80099550(GlobalContext* globalCtx) u32 D_8012A2F8[] = { 0x0200BA18, 0x0200CA18 }; // Scene Draw Config 19 -void func_800995DC(GlobalContext* globalCtx) -{ +void func_800995DC(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -1755,9 +706,8 @@ void func_800995DC(GlobalContext* globalCtx) func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 4763); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, + 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyXlu.p++); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80); @@ -1770,8 +720,7 @@ void func_800995DC(GlobalContext* globalCtx) } // Scene Draw Config 28 -void func_80099760(GlobalContext* globalCtx) -{ +void func_80099760(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -1781,9 +730,8 @@ void func_80099760(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 2) % 256, 0, 64, 32, - 1, 0, (gameplayFrames * 2) % 128, 64, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 0, 64, 32, 1, 0, + (gameplayFrames * 2) % 128, 64, 32)); gDPPipeSync(gfxCtx->polyXlu.p++); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80); @@ -1795,8 +743,7 @@ u32 D_8012A300[] = { 0x02012378, 0x02013378 }; u32 D_8012A308[] = { 0x02011F78, 0x02014778, 0x02014378, 0x02013F78, 0x02014B78, 0x02013B78, 0x02012F78, 0x02012B78 }; // Scene Draw Config 20 -void func_80099878(GlobalContext* globalCtx) -{ +void func_80099878(GlobalContext* globalCtx) { u32 gameplayFrames; s32 pad; Gfx* displayListHead; @@ -1812,13 +759,11 @@ void func_80099878(GlobalContext* globalCtx) gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A300[gSaveContext.night_flag])); gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_8012A308[(s32)(gameplayFrames & 14) >> 1])); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 1) % 256, 0, 64, 32, - 1, 0, (gameplayFrames * 1) % 128, 64, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 0, 64, 32, 1, 0, + (gameplayFrames * 1) % 128, 64, 32)); gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 1) % 128, 32, 32, - 1, 0, (gameplayFrames * 2) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + (gameplayFrames * 2) % 128, 32, 32)); { s32 pad2[2]; } // Necessary to match stack usage @@ -1841,8 +786,7 @@ void func_80099878(GlobalContext* globalCtx) } // Scene Draw Config 30 -void func_80099BD8(GlobalContext* globalCtx) -{ +void func_80099BD8(GlobalContext* globalCtx) { f32 temp; Gfx* displayListHead; GraphicsContext* gfxCtx; @@ -1857,15 +801,13 @@ void func_80099BD8(GlobalContext* globalCtx) gSPSegment(gfxCtx->polyXlu.p++, 0x08, displayListHead); gSPSegment(gfxCtx->polyOpa.p++, 0x08, displayListHead); - gDPSetPrimColor(displayListHead++, 0, 0, - 0xFF - (u8)(185.0f * temp), 0xFF - (u8)(145.0f * temp), + gDPSetPrimColor(displayListHead++, 0, 0, 0xFF - (u8)(185.0f * temp), 0xFF - (u8)(145.0f * temp), 0xFF - (u8)(105.0f * temp), 0xFF); gSPEndDisplayList(displayListHead++); gSPSegment(gfxCtx->polyXlu.p++, 0x09, displayListHead); gSPSegment(gfxCtx->polyOpa.p++, 0x09, displayListHead); - gDPSetPrimColor(displayListHead++, 0, 0, - 0x4C + (u8)(6.0f * temp), 0x4C + (u8)(34.0f * temp), + gDPSetPrimColor(displayListHead++, 0, 0, 0x4C + (u8)(6.0f * temp), 0x4C + (u8)(34.0f * temp), 0x4C + (u8)(74.0f * temp), 0xFF); gSPEndDisplayList(displayListHead++); @@ -1877,8 +819,7 @@ void func_80099BD8(GlobalContext* globalCtx) gSPSegment(gfxCtx->polyOpa.p++, 0x0B, displayListHead); gSPSegment(gfxCtx->polyXlu.p++, 0x0B, displayListHead); - gDPSetPrimColor(displayListHead++, 0, 0, - 0x59 + (u8)(166.0f * temp), 0x59 + (u8)(166.0f * temp), + gDPSetPrimColor(displayListHead++, 0, 0, 0x59 + (u8)(166.0f * temp), 0x59 + (u8)(166.0f * temp), 0x59 + (u8)(166.0f * temp), 0xFF); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]); @@ -1886,8 +827,7 @@ void func_80099BD8(GlobalContext* globalCtx) gSPSegment(gfxCtx->polyOpa.p++, 0x0C, displayListHead); gSPSegment(gfxCtx->polyXlu.p++, 0x0C, displayListHead); - gDPSetPrimColor(displayListHead++, 0, 0, - 0xFF + (u8)(179.0f * temp), 0xFF + (u8)(179.0f * temp), + gDPSetPrimColor(displayListHead++, 0, 0, 0xFF + (u8)(179.0f * temp), 0xFF + (u8)(179.0f * temp), 0xFF + (u8)(179.0f * temp), 0xFF); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]); @@ -1901,8 +841,7 @@ void func_80099BD8(GlobalContext* globalCtx) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 5145); - if (gSaveContext.scene_setup_index == 5) - { + if (gSaveContext.scene_setup_index == 5) { D_8015FCF0 = 1; D_8015FCF8.x = -20.0f; D_8015FCF8.y = 1220.0f; @@ -1914,8 +853,7 @@ void func_80099BD8(GlobalContext* globalCtx) } // Scene Draw Config 31 -void func_8009A45C(GlobalContext* globalCtx) -{ +void func_8009A45C(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -1925,27 +863,20 @@ void func_8009A45C(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 1) % 64, 256, 16)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 0, 32, 32, - 1, 0, 127 - (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, + 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + gSPSegment( + gfxCtx->polyOpa.p++, 0x0A, + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyOpa.p++, 0x0B, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0C, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 50) % 2048, 8, 512, - 1, 0, (gameplayFrames * 60) % 2048, 8, 512)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 50) % 2048, 8, 512, 1, 0, + (gameplayFrames * 60) % 2048, 8, 512)); gSPSegment(gfxCtx->polyOpa.p++, 0x0D, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 0, 32, 64, - 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyXlu.p++); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80); @@ -1957,8 +888,7 @@ void func_8009A45C(GlobalContext* globalCtx) } // Scene Draw Config 32 -void func_8009A798(GlobalContext* globalCtx) -{ +void func_8009A798(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -1968,20 +898,17 @@ void func_8009A798(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 2) % 256, 64, 64)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 64, 64)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 256, 32, 64, - 1, 0, 0, 32, 128)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, + (gameplayFrames * 1) % 256, 32, 64, 1, 0, 0, 32, 128)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -1993,8 +920,7 @@ void func_8009A798(GlobalContext* globalCtx) } // Scene Draw Config 33 -void func_8009A9DC(GlobalContext* globalCtx) -{ +void func_8009A9DC(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2004,13 +930,11 @@ void func_8009A9DC(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64, - 1, gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, + 64, 1, gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2022,8 +946,7 @@ void func_8009A9DC(GlobalContext* globalCtx) } // Scene Draw Config 48 -void func_8009AB98(GlobalContext* globalCtx) -{ +void func_8009AB98(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2032,9 +955,7 @@ void func_8009AB98(GlobalContext* globalCtx) func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 5317); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, gameplayFrames % 64, 256, 16)); + gSPSegment(gfxCtx->polyXlu.p++, 0x08, Draw_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); gDPPipeSync(gfxCtx->polyXlu.p++); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80); @@ -2046,8 +967,7 @@ void func_8009AB98(GlobalContext* globalCtx) } // Scene Draw Config 39 -void func_8009ACA8(GlobalContext* globalCtx) -{ +void func_8009ACA8(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2057,12 +977,9 @@ void func_8009ACA8(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, gameplayFrames % 64, 256, 16)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + gSPSegment(gfxCtx->polyXlu.p++, 0x09, Draw_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2074,8 +991,7 @@ void func_8009ACA8(GlobalContext* globalCtx) } // Scene Draw Config 24 -void func_8009AE30(GlobalContext* globalCtx) -{ +void func_8009AE30(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2085,16 +1001,15 @@ void func_8009AE30(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; - if (globalCtx->sceneNum == SCENE_HAKADAN_BS) + if (globalCtx->sceneNum == SCENE_HAKADAN_BS) { gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 2) % 128, 0, 32, 32, - 1, (gameplayFrames * 2) % 128, 0, 32, 32)); - else + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, + (gameplayFrames * 2) % 128, 0, 32, 32)); + } else { gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 2) % 128, 0, 32, 32, - 1, (gameplayFrames * 2) % 128, 0, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, + (gameplayFrames * 2) % 128, 0, 32, 32)); + } gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2108,8 +1023,7 @@ void func_8009AE30(GlobalContext* globalCtx) u32 D_8012A328[] = { 0x0200BD20, 0x0200B920 }; // Scene Draw Config 40 -void func_8009AFE0(GlobalContext* globalCtx) -{ +void func_8009AFE0(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2119,8 +1033,7 @@ void func_8009AFE0(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 3) % 128, 32, 32)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); { s32 pad[2]; } // Necessary to match stack usage @@ -2132,8 +1045,7 @@ void func_8009AFE0(GlobalContext* globalCtx) u32 D_8012A330[] = { 0x02014C30, 0x02015830 }; // Scene Draw Config 23 -void func_8009B0FC(GlobalContext* globalCtx) -{ +void func_8009B0FC(GlobalContext* globalCtx) { u32 gameplayFrames; s32 spB0; s32 spAC; @@ -2143,7 +1055,7 @@ void func_8009B0FC(GlobalContext* globalCtx) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 5535); - if (1) ; // Necessary to match + if (1) {} // Necessary to match spB0 = (globalCtx->unk_11D30[1] >> 8) & 0xFF; spAC = globalCtx->unk_11D30[1] & 0xFF; @@ -2151,81 +1063,56 @@ void func_8009B0FC(GlobalContext* globalCtx) gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[gSaveContext.night_flag])); - if (spB0 == 1) + if (spB0 == 1) { gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, spAC)); - else if (spB0 < 1) + } else if (spB0 < 1) { gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 0xFF)); - else + } else { gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 0xA0)); - - if (spB0 == 2) - gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32, - 0, 0, 0, spAC)); - else if (spB0 < 2) - gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32, - 0, 0, 0, 0xFF)); - else - gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32, - 0, 0, 0, 0xA0)); - - if (spB0 != 0) - { - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32, - 0, 0, 0, 0xA0)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 3, 0, 32, 32, - 1, 0, 0, 32, 32, - 0, 0, 0, 0xB4)); } - else - { + + if (spB0 == 2) { + gSPSegment(gfxCtx->polyOpa.p++, 0x09, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + 0, 0, 0, spAC)); + } else if (spB0 < 2) { + gSPSegment(gfxCtx->polyOpa.p++, 0x09, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + 0, 0, 0, 0xFF)); + } else { + gSPSegment(gfxCtx->polyOpa.p++, 0x09, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + 0, 0, 0, 0xA0)); + } + + if (spB0 != 0) { gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 1) % 128, 0, 32, 32, - 1, 0, 0, 32, 32, - 0, 0, 0, 0xA0 + (s32)((spAC / 200.0f) * 95.0f))); + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, + 0, 0, 0, 0xA0)); gSPSegment(gfxCtx->polyOpa.p++, 0x0B, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 3, 0, 32, 32, - 1, 0, 0, 32, 32, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, + 0, 0, 0, 0xB4)); + } else { + gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, + 32, 32, 0, 0, 0, 0xA0 + (s32)((spAC / 200.0f) * 95.0f))); + gSPSegment(gfxCtx->polyOpa.p++, 0x0B, + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 0xB9 + (s32)((spAC / 200.0f) * 70.0f))); } gSPSegment(gfxCtx->polyXlu.p++, 0x0C, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, gameplayFrames * 1, 32, 32, - 1, 0, 127 - (gameplayFrames * 1), 32, 32, - 0, 0, 0, 0x80)); + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, + 0, 127 - (gameplayFrames * 1), 32, 32, 0, 0, 0, 0x80)); gSPSegment(gfxCtx->polyXlu.p++, 0x0D, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames * 4, 0, 32, 32, - 1, gameplayFrames * 4, 0, 32, 32, - 0, 0, 0, 0x80)); + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 4, 0, 32, 32, 1, + gameplayFrames * 4, 0, 32, 32, 0, 0, 0, 0x80)); { s32 pad[2]; } // Necessary to match stack usage @@ -2233,8 +1120,7 @@ void func_8009B0FC(GlobalContext* globalCtx) } // Scene Draw Config 29 -void func_8009B86C(GlobalContext* globalCtx) -{ +void func_8009B86C(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2244,9 +1130,7 @@ void func_8009B86C(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, gameplayFrames * 1, 0, 32, 32, - 1, 0, 0, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, globalCtx->unk_11D30[0]); @@ -2258,8 +1142,7 @@ void func_8009B86C(GlobalContext* globalCtx) } // Scene Draw Config 34 -void func_8009B9BC(GlobalContext* globalCtx) -{ +void func_8009B9BC(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2268,9 +1151,7 @@ void func_8009B9BC(GlobalContext* globalCtx) func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 5822); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, gameplayFrames % 64, 4, 16)); + gSPSegment(gfxCtx->polyOpa.p++, 0x08, Draw_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 4, 16)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2279,8 +1160,7 @@ void func_8009B9BC(GlobalContext* globalCtx) } // Scene Draw Config 35 -void func_8009BAA4(GlobalContext* globalCtx) -{ +void func_8009BAA4(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2290,14 +1170,13 @@ void func_8009BAA4(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - if (globalCtx->sceneNum == SCENE_HAIRAL_NIWA) + if (globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 10) % 256, 32, 64)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 10) % 256, 32, 64)); + } gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2309,14 +1188,13 @@ void func_8009BAA4(GlobalContext* globalCtx) } // Scene Draw Config 36 -void func_8009BC44(GlobalContext* globalCtx) -{ +void func_8009BC44(GlobalContext* globalCtx) { u32 gameplayFrames; s8 sp83; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (1) ; // Necessary to match + if (1) {} // Necessary to match sp83 = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; @@ -2325,21 +1203,18 @@ void func_8009BC44(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; - if (globalCtx->sceneNum == SCENE_GANON_TOU) - { + if (globalCtx->sceneNum == SCENE_GANON_TOU) { gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 1) % 256, 64, 64)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 64, 64)); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 255 - (gameplayFrames * 1) % 256, 64, 64, - 1, 0, (gameplayFrames * 1) % 256, 64, 64)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 1) % 256, 64, 64, 1, 0, + (gameplayFrames * 1) % 256, 64, 64)); } gSPSegment(gfxCtx->polyOpa.p++, 0x0B, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 255 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 1) % 128, + (gameplayFrames * 1) % 128, 32, 32, 1, (gameplayFrames * 1) % 128, + (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2357,20 +1232,17 @@ void func_8009BC44(GlobalContext* globalCtx) // Screen Shake for Ganon's Tower Collapse #ifdef NON_MATCHING // regalloc differences -void func_8009BEEC(GlobalContext* globalCtx) -{ +void func_8009BEEC(GlobalContext* globalCtx) { s32 var; - if (globalCtx->gameplayFrames % 128 == 13) - { + if (globalCtx->gameplayFrames % 128 == 13) { var = func_80092F88(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 2); func_80092DAC(var, 10000); func_80092E70(var, 4, 0, 0, 0); func_80092DF0(var, 127); } - if ((globalCtx->gameplayFrames % 64 == 0) && (Math_Rand_ZeroOne() > 0.6f)) - { + if ((globalCtx->gameplayFrames % 64 == 0) && (Math_Rand_ZeroOne() > 0.6f)) { var = func_80092F88(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 3); func_80092DAC(var, 32000.0f + (Math_Rand_ZeroOne() * 3000.0f)); func_80092E70(var, 10.0f - (Math_Rand_ZeroOne() * 9.0f), 0, 0, 0); @@ -2383,14 +1255,13 @@ void func_8009BEEC(GlobalContext* globalCtx); #endif // Scene Draw Config 38 -void func_8009C0AC(GlobalContext* globalCtx) -{ +void func_8009C0AC(GlobalContext* globalCtx) { u32 gameplayFrames; s8 sp7B; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (1) ; // Necessary to match + if (1) {} // Necessary to match sp7B = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; @@ -2399,17 +1270,14 @@ void func_8009C0AC(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 1) % 512, 64, 128, - 1, 0, 511 - (gameplayFrames * 1) % 512, 64, 128)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 512, 64, 128, 1, 0, + 511 - (gameplayFrames * 1) % 512, 64, 128)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 1) % 256, 32, 64, - 1, 0, 255 - (gameplayFrames * 1) % 256, 32, 64)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 32, 64, 1, 0, + 255 - (gameplayFrames * 1) % 256, 32, 64)); gSPSegment(gfxCtx->polyXlu.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 20) % 2048, 16, 512, - 1, 0, (gameplayFrames * 30) % 2048, 16, 512)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 20) % 2048, 16, 512, 1, 0, + (gameplayFrames * 30) % 2048, 16, 512)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2423,13 +1291,9 @@ void func_8009C0AC(GlobalContext* globalCtx) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 6004); - if (Flags_GetSwitch(globalCtx, 0x37)) - { - if ((globalCtx->sceneNum == SCENE_GANON_DEMO) || - (globalCtx->sceneNum == SCENE_GANON_FINAL) || - (globalCtx->sceneNum == SCENE_GANON_SONOGO) || - (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)) - { + if (Flags_GetSwitch(globalCtx, 0x37)) { + if ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || + (globalCtx->sceneNum == SCENE_GANON_SONOGO) || (globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO)) { func_8009BEEC(globalCtx); } } @@ -2438,13 +1302,12 @@ void func_8009C0AC(GlobalContext* globalCtx) u32 D_8012A338[] = { 0x0200FAC0, 0x0200F8C0 }; // Scene Draw Config 37 -void func_8009C3EC(GlobalContext* globalCtx) -{ +void func_8009C3EC(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (0) ; // Necessary to match + if (0) {} // Necessary to match gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 6042); @@ -2452,13 +1315,11 @@ void func_8009C3EC(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A338[gSaveContext.night_flag])); gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); { s32 pad[2]; } // Necessary to match stack usage @@ -2472,8 +1333,7 @@ void func_8009C3EC(GlobalContext* globalCtx) } // Scene Draw Config 42 -void func_8009C608(GlobalContext* globalCtx) -{ +void func_8009C608(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2483,20 +1343,16 @@ void func_8009C608(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 1) % 64, 256, 16)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 60) % 2048, 8, 512, - 1, 0, (gameplayFrames * 50) % 2048, 8, 512)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 60) % 2048, 8, 512, 1, 0, + (gameplayFrames * 50) % 2048, 8, 512)); gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - (gameplayFrames * 1) % 128, 0, 32, 32, - 1, (gameplayFrames * 1) % 128, 0, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, 0, 32, 32, 1, + (gameplayFrames * 1) % 128, 0, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0B, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256, - 1, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256, 1, 0, + 1023 - (gameplayFrames * 3) % 1024, 16, 256)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2508,8 +1364,7 @@ void func_8009C608(GlobalContext* globalCtx) } // Scene Draw Config 43 -void func_8009C8B8(GlobalContext* globalCtx) -{ +void func_8009C8B8(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2519,16 +1374,12 @@ void func_8009C8B8(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 0, 32, 32, - 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, 255 - (gameplayFrames * 10) % 256, 32, 64)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 10) % 256, 32, 64)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2540,8 +1391,7 @@ void func_8009C8B8(GlobalContext* globalCtx) } // Scene Draw Config 47 -void func_8009CAC0(GlobalContext* globalCtx) -{ +void func_8009CAC0(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2551,9 +1401,8 @@ void func_8009CAC0(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2567,13 +1416,12 @@ void func_8009CAC0(GlobalContext* globalCtx) u32 D_8012A340[] = { 0x0200F8C0, 0x020100C0 }; // Scene Draw Config 27 -void func_8009CC00(GlobalContext* globalCtx) -{ +void func_8009CC00(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (0) ; // Necessary to match + if (0) {} // Necessary to match gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 6290); @@ -2581,13 +1429,11 @@ void func_8009CC00(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A340[gSaveContext.night_flag])); gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); { s32 pad[2]; } // Necessary to match stack usage @@ -2600,10 +1446,8 @@ void func_8009CC00(GlobalContext* globalCtx) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 6320); } -Gfx* Draw_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, - s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2, - s32 red, s32 green, s32 blue, s32 alpha) -{ +Gfx* Draw_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, + u32 x2, u32 y2, s32 width2, s32 height2, s32 red, s32 green, s32 blue, s32 alpha) { Gfx* displayList = Graph_Alloc(gfxCtx, 10 * sizeof(Gfx)); x1 %= 2048; @@ -2612,20 +1456,17 @@ Gfx* Draw_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y2 %= 2048; gDPTileSync(displayList); - gDPSetTileSize(displayList+1, tile1, x1, y1, - (x1+((width1-1)<<2)), (y1+((height1-1)<<2))); - gDPTileSync(displayList+2); - gDPSetTileSize(displayList+3, tile2, x2, y2, - (x2+((width2-1)<<2)), (y2+((height2-1)<<2))); - gDPSetPrimColor(displayList+4, 0, 0, red, green, blue, alpha); - gSPEndDisplayList(displayList+5); + gDPSetTileSize(displayList + 1, tile1, x1, y1, (x1 + ((width1 - 1) << 2)), (y1 + ((height1 - 1) << 2))); + gDPTileSync(displayList + 2); + gDPSetTileSize(displayList + 3, tile2, x2, y2, (x2 + ((width2 - 1) << 2)), (y2 + ((height2 - 1) << 2))); + gDPSetPrimColor(displayList + 4, 0, 0, red, green, blue, alpha); + gSPEndDisplayList(displayList + 5); return displayList; } // Scene Draw Config 50 -void func_8009CF84(GlobalContext* globalCtx) -{ +void func_8009CF84(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2635,10 +1476,10 @@ void func_8009CF84(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScrollPrimColor(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 0xFF, 0xFF, 0xFF, globalCtx->unk_11D30[0] + 127)); + Draw_TwoTexScrollPrimColor(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, + (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, + (gameplayFrames * 1) % 128, 32, 32, 0xFF, 0xFF, 0xFF, + globalCtx->unk_11D30[0] + 127)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2650,8 +1491,7 @@ void func_8009CF84(GlobalContext* globalCtx) } // Scene Draw Config 41 -void func_8009D0E8(GlobalContext* globalCtx) -{ +void func_8009D0E8(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2661,18 +1501,14 @@ void func_8009D0E8(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 127 - (gameplayFrames * 4) % 128, 0, 32, 32)); + Draw_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 4) % 128, 0, 32, 32)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 5) % 64, 16, 16)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 5) % 64, 16, 16)); gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, 63 - (gameplayFrames * 2) % 64, 16, 16)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0B, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 127 - (gameplayFrames * 3) % 128, 32, 32, - 1, 0, 0, 32, 32)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, 63 - (gameplayFrames * 2) % 64, 16, 16)); + gSPSegment( + gfxCtx->polyXlu.p++, 0x0B, + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - (gameplayFrames * 3) % 128, 32, 32, 1, 0, 0, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2686,8 +1522,7 @@ void func_8009D0E8(GlobalContext* globalCtx) u32 D_8012A348[] = { 0x02005210, 0x02005010 }; // Scene Draw Config 44 -void func_8009D31C(GlobalContext* globalCtx) -{ +void func_8009D31C(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[4]; s32 pad[2]; @@ -2710,8 +1545,7 @@ u32 D_8012A350[] = { 0x02006550, 0x02003550 }; u32 D_8012A358[] = { 0x02002350, 0x02001350 }; // Scene Draw Config 45 -void func_8009D438(GlobalContext* globalCtx) -{ +void func_8009D438(GlobalContext* globalCtx) { s32 var; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2719,10 +1553,11 @@ void func_8009D438(GlobalContext* globalCtx) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 6560); - if (LINK_IS_ADULT) + if (LINK_IS_ADULT) { var = 1; - else + } else { var = gSaveContext.night_flag; + } gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A358[var])); gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_8012A350[var])); @@ -2737,8 +1572,7 @@ void func_8009D438(GlobalContext* globalCtx) } // Scene Draw Config 46 -void func_8009D5B4(GlobalContext* globalCtx) -{ +void func_8009D5B4(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2748,12 +1582,10 @@ void func_8009D5B4(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 3) % 128, 32, 32)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256, - 1, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256, 1, 0, + 1023 - (gameplayFrames * 6) % 1024, 16, 256)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2767,13 +1599,12 @@ void func_8009D5B4(GlobalContext* globalCtx) u32 D_8012A360[] = { 0x02014D90, 0x02014590 }; // Scene Draw Config 22 -void func_8009D758(GlobalContext* globalCtx) -{ +void func_8009D758(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (0) ; // Necessary to match + if (0) {} // Necessary to match gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 6640); @@ -2781,13 +1612,11 @@ void func_8009D758(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A360[gSaveContext.night_flag])); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); { s32 pad[2]; } // Necessary to match stack usage @@ -2803,8 +1632,7 @@ void func_8009D758(GlobalContext* globalCtx) u32 D_8012A368[] = { 0x02018920, 0x02018020 }; // Scene Draw Config 25 -void func_8009D974(GlobalContext* globalCtx) -{ +void func_8009D974(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[4]; s32 pad[2]; @@ -2818,8 +1646,7 @@ void func_8009D974(GlobalContext* globalCtx) } // Scene Draw Config 1 -void func_8009DA30(GlobalContext* globalCtx) -{ +void func_8009DA30(GlobalContext* globalCtx) { u32 gameplayFrames; Gfx* displayListHead; GraphicsContext* gfxCtx; @@ -2832,13 +1659,11 @@ void func_8009DA30(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, + 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2848,21 +1673,17 @@ void func_8009DA30(GlobalContext* globalCtx) gSPSegment(gfxCtx->polyXlu.p++, 0x0A, displayListHead); - if ((gSaveContext.day_time >= 0x4AAC) && (gSaveContext.day_time <= 0xC555)) - { + if ((gSaveContext.day_time >= 0x4AAC) && (gSaveContext.day_time <= 0xC555)) { gSPEndDisplayList(displayListHead); - } - else - { - if (gSaveContext.day_time > 0xC555) - { - if (globalCtx->unk_11D30[0] != 255) + } else { + if (gSaveContext.day_time > 0xC555) { + if (globalCtx->unk_11D30[0] != 255) { Math_ApproxS(&globalCtx->unk_11D30[0], 255, 5); - } - else if (gSaveContext.day_time >= 0x4000) - { - if (globalCtx->unk_11D30[0] != 0) + } + } else if (gSaveContext.day_time >= 0x4000) { + if (globalCtx->unk_11D30[0] != 0) { Math_ApproxS(&globalCtx->unk_11D30[0], 0, 10); + } } gDPSetPrimColor(displayListHead++, 0, 0, 0xFF, 0xFF, 0xFF, globalCtx->unk_11D30[0]); @@ -2876,8 +1697,7 @@ void func_8009DA30(GlobalContext* globalCtx) u32 D_8012A370[] = { 0x02015B50, 0x02016B50 }; // Scene Draw Config 2 -void func_8009DD5C(GlobalContext* globalCtx) -{ +void func_8009DD5C(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[4]; s32 pad[2]; @@ -2897,8 +1717,7 @@ void func_8009DD5C(GlobalContext* globalCtx) } // Scene Draw Config 3 -void func_8009DE78(GlobalContext* globalCtx) -{ +void func_8009DE78(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2908,17 +1727,14 @@ void func_8009DE78(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2930,8 +1746,7 @@ void func_8009DE78(GlobalContext* globalCtx) } // Scene Draw Config 4 -void func_8009E0B8(GlobalContext* globalCtx) -{ +void func_8009E0B8(GlobalContext* globalCtx) { u32 gameplayFrames; u8 spA3; u16 spA0; @@ -2949,13 +1764,11 @@ void func_8009E0B8(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, + 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -2963,12 +1776,13 @@ void func_8009E0B8(GlobalContext* globalCtx) gDPPipeSync(gfxCtx->polyXlu.p++); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80); - if (gSaveContext.scene_setup_index == 4) + if (gSaveContext.scene_setup_index == 4) { spA3 = 255 - (u8)globalCtx->unk_11D30[0]; - else if (gSaveContext.scene_setup_index == 6) + } else if (gSaveContext.scene_setup_index == 6) { spA0 = globalCtx->unk_11D30[0] + 500; - else if (((gSaveContext.scene_setup_index < 4) || LINK_IS_ADULT) && (gSaveContext.event_chk_inf[0] & 0x80)) + } else if (((gSaveContext.scene_setup_index < 4) || LINK_IS_ADULT) && (gSaveContext.event_chk_inf[0] & 0x80)) { spA0 = 2150; + } gSPSegment(gfxCtx->polyOpa.p++, 0x0A, displayListHead); gDPPipeSync(displayListHead++); @@ -2982,16 +1796,14 @@ void func_8009E0B8(GlobalContext* globalCtx) gSPEndDisplayList(displayListHead); gSPSegment(gfxCtx->polyOpa.p++, 0x0C, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16, - 1, 0, (s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16, 1, 0, + (s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16)); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 7044); } // Scene Draw Config 5 -void func_8009E54C(GlobalContext* globalCtx) -{ +void func_8009E54C(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -2999,21 +1811,17 @@ void func_8009E54C(GlobalContext* globalCtx) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 7058); - if ((gSaveContext.scene_setup_index > 3) || - (LINK_IS_ADULT && !(gSaveContext.event_chk_inf[6] & 0x200))) + if ((gSaveContext.scene_setup_index > 3) || (LINK_IS_ADULT && !(gSaveContext.event_chk_inf[6] & 0x200))) { globalCtx->unk_11D30[0] = 87; + } gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, gameplayFrames, gameplayFrames, 32, 32, - 1, 0, 0, 32, 32, - 0, 0, 0, globalCtx->unk_11D30[0] + 0xA8)); + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, + 32, 32, 0, 0, 0, globalCtx->unk_11D30[0] + 0xA8)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, - 0, -gameplayFrames, -gameplayFrames, 32, 32, - 1, 0, 0, 16, 64, - 0, 0, 0, globalCtx->unk_11D30[0] + 0xA8)); + Draw_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0, + 16, 64, 0, 0, 0, globalCtx->unk_11D30[0] + 0xA8)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0xFF, 0xFF, 0xFF, 0x80); @@ -3024,8 +1832,7 @@ void func_8009E54C(GlobalContext* globalCtx) u32 D_8012A378[] = { 0x02008F98, 0x02008FD8 }; // Scene Draw Config 6 -void func_8009E730(GlobalContext* globalCtx) -{ +void func_8009E730(GlobalContext* globalCtx) { u32 gameplayFrames; u32 var; GraphicsContext* gfxCtx; @@ -3036,12 +1843,11 @@ void func_8009E730(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; var = 127 - (gameplayFrames * 1) % 128; - if (LINK_IS_ADULT) + if (LINK_IS_ADULT) { var = 0; + } gSPSegment(gfxCtx->polyOpa.p++, 0x0C, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 0, 64, 32, - 1, 0, var, 64, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 64, 32, 1, 0, var, 64, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3054,8 +1860,7 @@ void func_8009E730(GlobalContext* globalCtx) } // Scene Draw Config 7 -void func_8009E8C0(GlobalContext* globalCtx) -{ +void func_8009E8C0(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3065,17 +1870,13 @@ void func_8009E8C0(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 1) % 128, 0, 32, 32, - 1, 0, 0, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 255 - (gameplayFrames * 2) % 256, 64, 64, - 1, 0, 255 - (gameplayFrames * 2) % 256, 64, 64)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 2) % 256, 64, 64, 1, 0, + 255 - (gameplayFrames * 2) % 256, 64, 64)); gSPSegment(gfxCtx->polyXlu.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 1) % 128, 32, 32, - 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3087,8 +1888,7 @@ void func_8009E8C0(GlobalContext* globalCtx) } // Scene Draw Config 8 -void func_8009EAD8(GlobalContext* globalCtx) -{ +void func_8009EAD8(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3098,29 +1898,23 @@ void func_8009EAD8(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 3) % 1024, 32, 256, - 1, 0, (gameplayFrames * 3) % 1024, 32, 256)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 3) % 1024, 32, 256, 1, 0, + (gameplayFrames * 3) % 1024, 32, 256)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 1) % 256, 64, 64, - 1, 0, (gameplayFrames * 1) % 256, 64, 64)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 64, 64, 1, 0, + (gameplayFrames * 1) % 256, 64, 64)); gSPSegment(gfxCtx->polyXlu.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 2) % 128, 32, 32, - 1, 0, (gameplayFrames * 2) % 128, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 0, 32, 32, - 1, 0, 127 - (gameplayFrames * 3) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 2) % 128, 32, 32, 1, 0, + (gameplayFrames * 2) % 128, 32, 32)); + gSPSegment( + gfxCtx->polyOpa.p++, 0x0B, + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 3) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0C, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 1) % 128, 32, 32, - 1, 0, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, + (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x0D, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, (gameplayFrames * 1) % 64, 16, 16, - 1, 0, (gameplayFrames * 1) % 64, 16, 16)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 64, 16, 16, 1, 0, + (gameplayFrames * 1) % 64, 16, 16)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3132,25 +1926,22 @@ void func_8009EAD8(GlobalContext* globalCtx) } // Scene Draw Config 9 -void func_8009EE44(GlobalContext* globalCtx) -{ +void func_8009EE44(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (0) ; // Necessary to match + if (0) {} // Necessary to match gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 7274); gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, gameplayFrames % 128, 0, 32, 16, - 1, gameplayFrames % 128, 0, 32, 16)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, 0, 32, 16, 1, gameplayFrames % 128, + 0, 32, 16)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, gameplayFrames % 128, 32, 32, + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, gameplayFrames % 128, 32, 32, 1, gameplayFrames % 128, gameplayFrames % 128, 32, 32)); gDPPipeSync(gfxCtx->polyXlu.p++); @@ -3159,10 +1950,8 @@ void func_8009EE44(GlobalContext* globalCtx) gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); - if ((globalCtx->unk_11D30[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) - { - if (globalCtx->unk_11D30[1] == 50) - { + if ((globalCtx->unk_11D30[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { + if (globalCtx->unk_11D30[1] == 50) { func_8002F7DC(&PLAYER->actor, NA_SE_EV_CHICKEN_CRY_M); globalCtx->unk_11D30[0] = 1; } @@ -3173,8 +1962,7 @@ void func_8009EE44(GlobalContext* globalCtx) } // Scene Draw Config 10 -void func_8009F074(GlobalContext* globalCtx) -{ +void func_8009F074(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3184,9 +1972,7 @@ void func_8009F074(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 0, 32, 32, - 1, 0, 127 - gameplayFrames % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - gameplayFrames % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3200,8 +1986,7 @@ void func_8009F074(GlobalContext* globalCtx) u32 D_8012A380[] = { 0x02009678, 0x0200DE78 }; // Scene Draw Config 11 -void func_8009F1B4(GlobalContext* globalCtx) -{ +void func_8009F1B4(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[4]; s32 pad[2]; @@ -3215,8 +2000,7 @@ void func_8009F1B4(GlobalContext* globalCtx) } // Scene Draw Config 12 -void func_8009F270(GlobalContext* globalCtx) -{ +void func_8009F270(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3226,13 +2010,11 @@ void func_8009F270(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, gameplayFrames % 128, 32, 32, - 1, 0, gameplayFrames % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, + gameplayFrames % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, gameplayFrames % 128, 32, 32, - 1, 0, gameplayFrames % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, + gameplayFrames % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3244,8 +2026,7 @@ void func_8009F270(GlobalContext* globalCtx) } // Scene Draw Config 13 -void func_8009F40C(GlobalContext* globalCtx) -{ +void func_8009F40C(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3255,13 +2036,11 @@ void func_8009F40C(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, + 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3273,8 +2052,7 @@ void func_8009F40C(GlobalContext* globalCtx) } // Scene Draw Config 14 -void func_8009F5D4(GlobalContext* globalCtx) -{ +void func_8009F5D4(GlobalContext* globalCtx) { Gfx* displayListHead; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3286,21 +2064,17 @@ void func_8009F5D4(GlobalContext* globalCtx) gSPSegment(gfxCtx->polyXlu.p++, 0x08, displayListHead); - if ((gSaveContext.day_time >= 0x4AAC) && (gSaveContext.day_time <= 0xC000)) - { + if ((gSaveContext.day_time >= 0x4AAC) && (gSaveContext.day_time <= 0xC000)) { gSPEndDisplayList(displayListHead); - } - else - { - if (gSaveContext.day_time > 0xC000) - { - if (globalCtx->unk_11D30[0] != 255) + } else { + if (gSaveContext.day_time > 0xC000) { + if (globalCtx->unk_11D30[0] != 255) { Math_ApproxS(&globalCtx->unk_11D30[0], 255, 5); - } - else if (gSaveContext.day_time >= 0x4000) - { - if (globalCtx->unk_11D30[0] != 0) + } + } else if (gSaveContext.day_time >= 0x4000) { + if (globalCtx->unk_11D30[0] != 0) { Math_ApproxS(&globalCtx->unk_11D30[0], 0, 10); + } } gDPSetPrimColor(displayListHead++, 0, 0, 0xFF, 0xFF, 0xFF, globalCtx->unk_11D30[0]); @@ -3318,8 +2092,7 @@ void func_8009F5D4(GlobalContext* globalCtx) } // Scene Draw Config 15 -void func_8009F7D4(GlobalContext* globalCtx) -{ +void func_8009F7D4(GlobalContext* globalCtx) { s8 sp6F; s8 sp6E; u32 gameplayFrames; @@ -3337,9 +2110,8 @@ void func_8009F7D4(GlobalContext* globalCtx) sp6E = (sp6E >> 1) + 192; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, gameplayFrames % 128, 32, 32, - 1, 0, gameplayFrames % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, + gameplayFrames % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, sp6F, sp6E, 0xFF, 0x80); @@ -3353,8 +2125,7 @@ void func_8009F7D4(GlobalContext* globalCtx) u32 D_8012A388[] = { 0x02009808, 0x02008FC8 }; // Scene Draw Config 16 -void func_8009F9D0(GlobalContext* globalCtx) -{ +void func_8009F9D0(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3364,9 +2135,8 @@ void func_8009F9D0(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 127 - gameplayFrames % 128, 32, 32, - 1, gameplayFrames % 128, 0, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, + gameplayFrames % 128, 0, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3384,8 +2154,7 @@ void func_8009F9D0(GlobalContext* globalCtx) u32 D_8012A390[] = { 0x020081E0, 0x0200FBE0 }; // Scene Draw Config 17 -void func_8009FB74(GlobalContext* globalCtx) -{ +void func_8009FB74(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[4]; s32 pad[2]; @@ -3405,8 +2174,7 @@ void func_8009FB74(GlobalContext* globalCtx) } // Scene Draw Config 18 -void func_8009FC90(GlobalContext* globalCtx) -{ +void func_8009FC90(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3416,13 +2184,12 @@ void func_8009FC90(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 127 - gameplayFrames % 128, 32, 32, - 1, 127 - gameplayFrames % 128, 0, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, + 127 - gameplayFrames % 128, 0, 32, 32)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 3) % 128, 127 - (gameplayFrames * 6) % 128, 32, 32, - 1, (gameplayFrames * 6) % 128, 127 - (gameplayFrames * 3) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, + 127 - (gameplayFrames * 6) % 128, 32, 32, 1, (gameplayFrames * 6) % 128, + 127 - (gameplayFrames * 3) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x40); @@ -3438,8 +2205,7 @@ f32 D_8012A398 = 0.0f; // Scene Draw Config 21 #ifdef NON_MATCHING // regalloc differences and single equivalent instruction difference -void func_8009FE58(GlobalContext* globalCtx) -{ +void func_8009FE58(GlobalContext* globalCtx) { static s16 D_8012A39C = 538; static s16 D_8012A3A0 = 4272; u32 gameplayFrames; @@ -3451,22 +2217,17 @@ void func_8009FE58(GlobalContext* globalCtx) func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 7712); gameplayFrames = globalCtx->gameplayFrames; - if (globalCtx->sceneNum == SCENE_BDAN) - { + if (globalCtx->sceneNum == SCENE_BDAN) { gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32, - 1, 127 - gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, + 32, 1, 127 - gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32)); gSPSegment(gfxCtx->polyOpa.p++, 0x0B, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 0, 255 - (gameplayFrames * 4) % 256, 32, 64, - 1, 0, 255 - (gameplayFrames * 4) % 256, 32, 64)); - } - else - { + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 4) % 256, 32, 64, 1, 0, + 255 - (gameplayFrames * 4) % 256, 32, 64)); + } else { gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - (127 - (gameplayFrames * 1)) % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TexScroll(globalCtx->state.gfxCtx, (127 - (gameplayFrames * 1)) % 128, + (gameplayFrames * 1) % 128, 32, 32)); } gDPPipeSync(gfxCtx->polyOpa.p++); @@ -3475,43 +2236,32 @@ void func_8009FE58(GlobalContext* globalCtx) gDPPipeSync(gfxCtx->polyXlu.p++); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0x80, 0x80); - if (func_800C0D28(globalCtx) != 1) - { + if (func_800C0D28(globalCtx) != 1) { D_8012A39C += 1820; D_8012A3A0 += 1820; temp = 0.020000001f; - func_800AA76C(&globalCtx->view, - Math_Coss(D_8012A39C) * (0.00009587531f * temp), - Math_Sins(D_8012A39C) * (0.00009587531f * temp), - Math_Sins(D_8012A3A0) * (0.00009587531f * temp)); - func_800AA78C(&globalCtx->view, - 1.0f + (Math_Sins(D_8012A3A0) * (0.79999995f * temp)), + func_800AA76C(&globalCtx->view, Math_Coss(D_8012A39C) * (0.00009587531f * temp), + Math_Sins(D_8012A39C) * (0.00009587531f * temp), Math_Sins(D_8012A3A0) * (0.00009587531f * temp)); + func_800AA78C(&globalCtx->view, 1.0f + (Math_Sins(D_8012A3A0) * (0.79999995f * temp)), 1.0f + (Math_Coss(D_8012A3A0) * (0.39999998f * temp)), 1.0f + (Math_Coss(D_8012A39C) * (1 * temp))); func_800AA7AC(&globalCtx->view, 0.95f); - switch (globalCtx->unk_11D30[0]) - { + switch (globalCtx->unk_11D30[0]) { case 0: break; case 1: - if (globalCtx->unk_11D30[1] < 1200) - { + if (globalCtx->unk_11D30[1] < 1200) { globalCtx->unk_11D30[1] += 200; - } - else - { + } else { globalCtx->unk_11D30[0]++; } break; case 2: - if (globalCtx->unk_11D30[1] > 0) - { + if (globalCtx->unk_11D30[1] > 0) { globalCtx->unk_11D30[1] -= 30; - } - else - { + } else { globalCtx->unk_11D30[1] = 0; globalCtx->unk_11D30[0] = 0; } @@ -3538,8 +2288,7 @@ void func_8009FE58(GlobalContext* globalCtx); #endif // Scene Draw Config 26 -void func_800A0334(GlobalContext* globalCtx) -{ +void func_800A0334(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3549,17 +2298,14 @@ void func_800A0334(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyXlu.p++, 0x08, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, + 128, 1, gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128)); gSPSegment(gfxCtx->polyXlu.p++, 0x09, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment(gfxCtx->polyOpa.p++, 0x0A, - Draw_TwoTexScroll(globalCtx->state.gfxCtx, - 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, - 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); + Draw_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, + 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3571,20 +2317,17 @@ void func_800A0334(GlobalContext* globalCtx) } // Scene Draw Config 52 -void func_800A055C(GlobalContext* globalCtx) -{ +void func_800A055C(GlobalContext* globalCtx) { func_8009BEEC(globalCtx); } // Scene Draw Config 51 -void func_800A057C(GlobalContext* globalCtx) -{ +void func_800A057C(GlobalContext* globalCtx) { func_8009BEEC(globalCtx); } // Scene Draw Config 49 -void func_800A059C(GlobalContext* globalCtx) -{ +void func_800A059C(GlobalContext* globalCtx) { u32 gameplayFrames; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; @@ -3594,11 +2337,9 @@ void func_800A059C(GlobalContext* globalCtx) gameplayFrames = globalCtx->gameplayFrames; gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Draw_TexScroll(globalCtx->state.gfxCtx, - 127 - (gameplayFrames * 2) % 128, 0, 32, 64)); + Draw_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 2) % 128, 0, 32, 64)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Draw_TexScroll(globalCtx->state.gfxCtx, - 0, (gameplayFrames * 2) % 512, 128, 128)); + Draw_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 128, 128)); gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0x80, 0x80, 0x80, 0x80); @@ -3609,72 +2350,23 @@ void func_800A059C(GlobalContext* globalCtx) func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 7910); } -void (*sSceneDrawHandlers[])(GlobalContext*) = -{ - func_80099550, - func_8009DA30, - func_8009DD5C, - func_8009DE78, - func_8009E0B8, - func_8009E54C, - func_8009E730, - func_8009E8C0, - func_8009EAD8, - func_8009EE44, - func_8009F074, - func_8009F1B4, - func_8009F270, - func_8009F40C, - func_8009F5D4, - func_8009F7D4, - func_8009F9D0, - func_8009FB74, - func_8009FC90, - func_800995DC, - func_80099878, - func_8009FE58, - func_8009D758, - func_8009B0FC, - func_8009AE30, - func_8009D974, - func_800A0334, - func_8009CC00, - func_80099760, - func_8009B86C, - func_80099BD8, - func_8009A45C, - func_8009A798, - func_8009A9DC, - func_8009B9BC, - func_8009BAA4, - func_8009BC44, - func_8009C3EC, - func_8009C0AC, - func_8009ACA8, - func_8009AFE0, - func_8009D0E8, - func_8009C608, - func_8009C8B8, - func_8009D31C, - func_8009D438, - func_8009D5B4, - func_8009CAC0, - func_8009AB98, - func_800A059C, - func_8009CF84, - func_800A057C, - func_800A055C, +void (*sSceneDrawHandlers[])(GlobalContext*) = { + func_80099550, func_8009DA30, func_8009DD5C, func_8009DE78, func_8009E0B8, func_8009E54C, func_8009E730, + func_8009E8C0, func_8009EAD8, func_8009EE44, func_8009F074, func_8009F1B4, func_8009F270, func_8009F40C, + func_8009F5D4, func_8009F7D4, func_8009F9D0, func_8009FB74, func_8009FC90, func_800995DC, func_80099878, + func_8009FE58, func_8009D758, func_8009B0FC, func_8009AE30, func_8009D974, func_800A0334, func_8009CC00, + func_80099760, func_8009B86C, func_80099BD8, func_8009A45C, func_8009A798, func_8009A9DC, func_8009B9BC, + func_8009BAA4, func_8009BC44, func_8009C3EC, func_8009C0AC, func_8009ACA8, func_8009AFE0, func_8009D0E8, + func_8009C608, func_8009C8B8, func_8009D31C, func_8009D438, func_8009D5B4, func_8009CAC0, func_8009AB98, + func_800A059C, func_8009CF84, func_800A057C, func_800A055C, }; -void Scene_Draw(GlobalContext* globalCtx) -{ +void Scene_Draw(GlobalContext* globalCtx) { GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - if (HREG(80) == 0x11) - { - if (HREG(95) != 0x11) - { + if (HREG(80) == 0x11) { + if (HREG(95) != 0x11) { HREG(95) = 0x11; HREG(81) = 1; HREG(82) = 1; @@ -3694,17 +2386,17 @@ void Scene_Draw(GlobalContext* globalCtx) gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 8104); - if (HREG(81) == 1) - { + if (HREG(81) == 1) { gSPDisplayList(gfxCtx->polyOpa.p++, sDefaultDisplayList); gSPDisplayList(gfxCtx->polyXlu.p++, sDefaultDisplayList); } func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_scene_table.c", 8109); - if (HREG(82) == 1) + if (HREG(82) == 1) { sSceneDrawHandlers[globalCtx->sceneConfig](globalCtx); - } - else + } + } else { sSceneDrawHandlers[globalCtx->sceneConfig](globalCtx); + } } diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 9b51b29cbb..d43e77dfee 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -174,4 +174,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A56F0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5774.s") - diff --git a/src/code/z_skin.c b/src/code/z_skin.c index 617a633c13..ca907bb17e 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -20,4 +20,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A63CC.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A6408.s") - diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index aaffdcadb9..4e4530025f 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -10,4 +10,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A698C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A6AC4.s") - diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 2c7a215fe7..27d703f301 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -40,4 +40,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7EC0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A8030.s") - diff --git a/src/code/z_sram.c b/src/code/z_sram.c index dd9578f0ee..0f2bcaa64f 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -24,4 +24,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9CD4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9D28.s") - diff --git a/src/code/z_view.c b/src/code/z_view.c index 84eb4770d2..defbbb8cfb 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -60,4 +60,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB9EC.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800ABE74.s") - diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index e15d619ac5..1fa3ba4521 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -16,4 +16,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800ACA98.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800ACAF8.s") - diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 75956af41a..239e81ce06 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -12,4 +12,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD5C0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD870.s") - diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index c468b4b299..8008c6aca7 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -12,4 +12,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800AF218.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800B0E50.s") - diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index 6af1a46ea1..4161c46157 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -6,4 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_800B10C4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_800B1744.s") - diff --git a/src/libultra_boot_O1/__osDequeueThread.c b/src/libultra_boot_O1/__osDequeueThread.c index 8c6e493f24..50b6aeeff8 100644 --- a/src/libultra_boot_O1/__osDequeueThread.c +++ b/src/libultra_boot_O1/__osDequeueThread.c @@ -1,19 +1,16 @@ #include -void __osDequeueThread(OSThread **queue, OSThread *thread) -{ - register OSThread **a2; - register OSThread *a3; +void __osDequeueThread(OSThread** queue, OSThread* thread) { + register OSThread** a2; + register OSThread* a3; a2 = queue; a3 = *a2; - while (a3 != NULL) - { - if (a3 == thread) - { + while (a3 != NULL) { + if (a3 == thread) { *a2 = thread->next; return; } a2 = &a3->next; a3 = *a2; } -} \ No newline at end of file +} diff --git a/src/libultra_boot_O1/__osGetHWIntrRoutine.c b/src/libultra_boot_O1/__osGetHWIntrRoutine.c index ae01749be1..a9b633adb4 100644 --- a/src/libultra_boot_O1/__osGetHWIntrRoutine.c +++ b/src/libultra_boot_O1/__osGetHWIntrRoutine.c @@ -1,7 +1,6 @@ #include -void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg) -{ +void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg) { *outQueue = __osHwIntTable[idx].queue; *outMsg = __osHwIntTable[idx].msg; } diff --git a/src/libultra_boot_O1/__osResetGlobalIntMask.c b/src/libultra_boot_O1/__osResetGlobalIntMask.c index b89026781f..9479289fb1 100644 --- a/src/libultra_boot_O1/__osResetGlobalIntMask.c +++ b/src/libultra_boot_O1/__osResetGlobalIntMask.c @@ -1,10 +1,9 @@ #include -void __osResetGlobalIntMask(u32 mask) -{ +void __osResetGlobalIntMask(u32 mask) { register s32 prevInt; prevInt = __osDisableInt(); __OSGlobalIntMask &= ~(mask & ~0x401); __osRestoreInt(prevInt); -} \ No newline at end of file +} diff --git a/src/libultra_boot_O1/__osSetGlobalIntMask.c b/src/libultra_boot_O1/__osSetGlobalIntMask.c index cccce7a842..15200ac55e 100644 --- a/src/libultra_boot_O1/__osSetGlobalIntMask.c +++ b/src/libultra_boot_O1/__osSetGlobalIntMask.c @@ -1,10 +1,9 @@ #include -void __osSetGlobalIntMask(u32 mask) -{ +void __osSetGlobalIntMask(u32 mask) { register s32 prevInt; prevInt = __osDisableInt(); __OSGlobalIntMask |= mask; __osRestoreInt(prevInt); -} \ No newline at end of file +} diff --git a/src/libultra_boot_O1/__osSetHWIntrRoutine.c b/src/libultra_boot_O1/__osSetHWIntrRoutine.c index a2def2038d..48f5a85dbb 100644 --- a/src/libultra_boot_O1/__osSetHWIntrRoutine.c +++ b/src/libultra_boot_O1/__osSetHWIntrRoutine.c @@ -1,7 +1,6 @@ #include -void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg) -{ +void __osSetHWIntrRoutine(s32 idx, OSMesgQueue* queue, OSMesg msg) { register int prevInt; prevInt = __osDisableInt(); diff --git a/src/libultra_boot_O1/initialize.c b/src/libultra_boot_O1/initialize.c index f3f8117c71..903a9212aa 100644 --- a/src/libultra_boot_O1/initialize.c +++ b/src/libultra_boot_O1/initialize.c @@ -1,12 +1,11 @@ #include #include -typedef struct -{ - u32 ins_00; //lui k0, 0x8000 - u32 ins_04; //addiu k0, k0, 0x39e0 - u32 ins_08; //jr k0 ; __osException - u32 ins_0C; //nop +typedef struct { + u32 ins_00; // lui k0, 0x8000 + u32 ins_04; // addiu k0, k0, 0x39e0 + u32 ins_08; // jr k0 ; __osException + u32 ins_0C; // nop } struct_exceptionPreamble; u64 osClockRate = 62500000; @@ -16,14 +15,13 @@ u32 __OSGlobalIntMask = 0x003FFF01; u32 D_800145C0; -void __createSpeedParam(void) -{ +void __createSpeedParam(void) { __Dom1SpeedParam.type = DEVICE_TYPE_INIT; __Dom1SpeedParam.latency = HW_REG(PI_BSD_DOM1_LAT_REG, u32); __Dom1SpeedParam.pulse = HW_REG(PI_BSD_DOM1_PWD_REG, u32); __Dom1SpeedParam.pageSize = HW_REG(PI_BSD_DOM1_PGS_REG, u32); __Dom1SpeedParam.relDuration = HW_REG(PI_BSD_DOM1_RLS_REG, u32); - + __Dom2SpeedParam.type = DEVICE_TYPE_INIT; __Dom2SpeedParam.latency = HW_REG(PI_BSD_DOM2_LAT_REG, u32); __Dom2SpeedParam.pulse = HW_REG(PI_BSD_DOM2_PWD_REG, u32); @@ -31,25 +29,26 @@ void __createSpeedParam(void) __Dom2SpeedParam.relDuration = HW_REG(PI_BSD_DOM2_RLS_REG, u32); } -void __osInitialize_common(void) -{ +void __osInitialize_common(void) { u32 sp2C; D_800145C0 = 1; __osSetSR(__osGetSR() | 0x20000000); __osSetFpcCsr(0x1000800); __osSetWatchLo(0x4900000); - - while (__osSiRawReadIo((void*)0x1fc007fc, &sp2C)) - ; - while (__osSiRawWriteIo((void*)0x1fc007fc, sp2C | 8)) + while (__osSiRawReadIo((void*)0x1fc007fc, &sp2C)) { ; - - *(struct_exceptionPreamble*)0x80000000 = *(struct_exceptionPreamble*)__osExceptionPreamble; //TLB miss - *(struct_exceptionPreamble*)0x80000080 = *(struct_exceptionPreamble*)__osExceptionPreamble; //XTLB miss - *(struct_exceptionPreamble*)0x80000100 = *(struct_exceptionPreamble*)__osExceptionPreamble; //cache errors - *(struct_exceptionPreamble*)0x80000180 = *(struct_exceptionPreamble*)__osExceptionPreamble; //general exceptions + } + + while (__osSiRawWriteIo((void*)0x1fc007fc, sp2C | 8)) { + ; + } + + *(struct_exceptionPreamble*)0x80000000 = *(struct_exceptionPreamble*)__osExceptionPreamble; // TLB miss + *(struct_exceptionPreamble*)0x80000080 = *(struct_exceptionPreamble*)__osExceptionPreamble; // XTLB miss + *(struct_exceptionPreamble*)0x80000100 = *(struct_exceptionPreamble*)__osExceptionPreamble; // cache errors + *(struct_exceptionPreamble*)0x80000180 = *(struct_exceptionPreamble*)__osExceptionPreamble; // general exceptions osWritebackDCache(0x80000000, 0x190); osInvalICache(0x80000000, 0x190); @@ -59,25 +58,28 @@ void __osInitialize_common(void) osClockRate = (u64)((osClockRate * 3ll) / 4ull); - if (!osResetType) + if (!osResetType) { bzero(osAppNmiBuffer, 0x40); + } - if (osTvType == 0) + if (osTvType == 0) { osViClock = VI_PAL_CLOCK; - else if (osTvType == 2) + } else if (osTvType == 2) { osViClock = VI_MPAL_CLOCK; - else + } else { osViClock = VI_NTSC_CLOCK; + } - if (__osGetCause() & 0x1000) - while (true) + if (__osGetCause() & 0x1000) { + while (true) { ; + } + } HW_REG(AI_CONTROL_REG, u32) = 1; HW_REG(AI_DACRATE_REG, u32) = 0x3fff; HW_REG(AI_BITRATE_REG, u32) = 0xf; } -void __osInitialize_autodetect() -{ +void __osInitialize_autodetect() { } diff --git a/src/libultra_boot_O1/osCreateMesgQueue.c b/src/libultra_boot_O1/osCreateMesgQueue.c index 3f5ccb4b73..3282c16ffe 100644 --- a/src/libultra_boot_O1/osCreateMesgQueue.c +++ b/src/libultra_boot_O1/osCreateMesgQueue.c @@ -1,7 +1,6 @@ #include -void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count) -{ +void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count) { mq->mtqueue = __osThreadTail; mq->fullqueue = __osThreadTail; mq->validCount = 0; diff --git a/src/libultra_boot_O1/osCreateThread.c b/src/libultra_boot_O1/osCreateThread.c index d46cf33353..d62f0c2cc6 100644 --- a/src/libultra_boot_O1/osCreateThread.c +++ b/src/libultra_boot_O1/osCreateThread.c @@ -1,13 +1,12 @@ #include OSThread* __osThreadTail[2] = { NULL, (OSThread*)-1 }; -OSThread *__osRunQueue = __osThreadTail; -OSThread *__osActiveQueue = __osThreadTail; -OSThread *__osRunningThread = NULL; +OSThread* __osRunQueue = __osThreadTail; +OSThread* __osActiveQueue = __osThreadTail; +OSThread* __osRunningThread = NULL; OSThread* __osFaultedThread = NULL; -void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri) -{ +void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri) { register u32 s0; u32 t8; diff --git a/src/libultra_boot_O1/osDestroyThread.c b/src/libultra_boot_O1/osDestroyThread.c index d5ad074d18..5fa3186647 100644 --- a/src/libultra_boot_O1/osDestroyThread.c +++ b/src/libultra_boot_O1/osDestroyThread.c @@ -1,30 +1,27 @@ #include -void osDestroyThread(OSThread *thread) -{ +void osDestroyThread(OSThread* thread) { register s32 int_disabled; - - register OSThread *s1; - register OSThread *s2; + + register OSThread* s1; + register OSThread* s2; int_disabled = __osDisableInt(); - if (thread == NULL) + if (thread == NULL) { thread = __osRunningThread; - else if (thread->state != OS_STATE_STOPPED) + } else if (thread->state != OS_STATE_STOPPED) { __osDequeueThread(thread->queue, thread); + } - if (__osActiveQueue == thread) + if (__osActiveQueue == thread) { __osActiveQueue = __osActiveQueue->tlnext; - else - { + } else { s1 = __osActiveQueue; - while (s1->priority != -1) - { + while (s1->priority != -1) { s2 = s1->tlnext; - if (s2 == thread) - { + if (s2 == thread) { s1->tlnext = thread->tlnext; break; } @@ -32,8 +29,9 @@ void osDestroyThread(OSThread *thread) } } - if (thread == __osRunningThread) + if (thread == __osRunningThread) { __osDispatchThread(); + } __osRestoreInt(int_disabled); } diff --git a/src/libultra_boot_O1/osGetMemSize.c b/src/libultra_boot_O1/osGetMemSize.c index dba9d90f72..f1f175224a 100644 --- a/src/libultra_boot_O1/osGetMemSize.c +++ b/src/libultra_boot_O1/osGetMemSize.c @@ -2,8 +2,7 @@ #define STEP 0x100000 -u32 osGetMemSize(void) -{ +u32 osGetMemSize(void) { u32* ptr; u32 size; u32 data0; @@ -11,21 +10,21 @@ u32 osGetMemSize(void) size = 0x400000; - while(size < 0x800000) - { + while (size < 0x800000) { ptr = (u32*)(0xA0000000 + size); data0 = *ptr; - data1 = ptr[STEP/4-1]; + data1 = ptr[STEP / 4 - 1]; *ptr ^= ~0; - ptr[STEP/4-1] ^= ~0; + ptr[STEP / 4 - 1] ^= ~0; - if ((*ptr != (data0 ^ ~0)) || (ptr[STEP/4-1] != (data1 ^ ~0))) + if ((*ptr != (data0 ^ ~0)) || (ptr[STEP / 4 - 1] != (data1 ^ ~0))) { return size; + } *ptr = data0; - ptr[STEP/4-1] = data1; + ptr[STEP / 4 - 1] = data1; size += STEP; } diff --git a/src/libultra_boot_O1/osGetThreadId.c b/src/libultra_boot_O1/osGetThreadId.c index 9a0ca9dce8..5c2dd5d092 100644 --- a/src/libultra_boot_O1/osGetThreadId.c +++ b/src/libultra_boot_O1/osGetThreadId.c @@ -1,9 +1,9 @@ #include -OSId osGetThreadId(OSThread* thread) -{ - if (thread == NULL) +OSId osGetThreadId(OSThread* thread) { + if (thread == NULL) { thread = __osRunningThread; + } return thread->id; } diff --git a/src/libultra_boot_O1/osGetThreadPri.c b/src/libultra_boot_O1/osGetThreadPri.c index 4d8f97f6e7..d6a7c91607 100644 --- a/src/libultra_boot_O1/osGetThreadPri.c +++ b/src/libultra_boot_O1/osGetThreadPri.c @@ -1,9 +1,9 @@ #include -OSPri osGetThreadPri(OSThread* thread) -{ - if (thread == NULL) +OSPri osGetThreadPri(OSThread* thread) { + if (thread == NULL) { thread = __osRunningThread; + } return thread->priority; } diff --git a/src/libultra_boot_O1/osGetTime.c b/src/libultra_boot_O1/osGetTime.c index a2fd07510e..9cf6e53079 100644 --- a/src/libultra_boot_O1/osGetTime.c +++ b/src/libultra_boot_O1/osGetTime.c @@ -1,7 +1,6 @@ #include -OSTime osGetTime(void) -{ +OSTime osGetTime(void) { u32 sp34; u32 sp30; u64 t1; diff --git a/src/libultra_boot_O1/osJamMesg.c b/src/libultra_boot_O1/osJamMesg.c index 47c7390a89..87c49979d2 100644 --- a/src/libultra_boot_O1/osJamMesg.c +++ b/src/libultra_boot_O1/osJamMesg.c @@ -1,6 +1,6 @@ #include -s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag) { +s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) { register s32 int_disabled; int_disabled = __osDisableInt(); while (mq->validCount >= mq->msgCount) { diff --git a/src/libultra_boot_O1/osRecvMesg.c b/src/libultra_boot_O1/osRecvMesg.c index 7f78cbd27f..f49716cd63 100644 --- a/src/libultra_boot_O1/osRecvMesg.c +++ b/src/libultra_boot_O1/osRecvMesg.c @@ -1,13 +1,10 @@ #include -s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) -{ +s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) { register s32 s0 = __osDisableInt(); - while (mq->validCount == 0) - { - if (flag == OS_MESG_NOBLOCK) - { + while (mq->validCount == 0) { + if (flag == OS_MESG_NOBLOCK) { __osRestoreInt(s0); return -1; } @@ -15,14 +12,16 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) __osEnqueueAndYield(mq); } - if (msg != NULL) + if (msg != NULL) { *msg = mq->msg[mq->first]; + } mq->first = (mq->first + 1) % mq->msgCount; mq->validCount--; - if (mq->fullqueue->next != NULL) + if (mq->fullqueue->next != NULL) { osStartThread(__osPopThread(&mq->fullqueue)); + } __osRestoreInt(s0); diff --git a/src/libultra_boot_O1/osSendMesg.c b/src/libultra_boot_O1/osSendMesg.c index 0355f08ff4..53b9147546 100644 --- a/src/libultra_boot_O1/osSendMesg.c +++ b/src/libultra_boot_O1/osSendMesg.c @@ -1,19 +1,14 @@ #include -s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag) -{ +s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag) { register u32 s0 = __osDisableInt(); register u32 index; - while (mq->validCount >= mq->msgCount) - { - if (flag == OS_MESG_BLOCK) - { + while (mq->validCount >= mq->msgCount) { + if (flag == OS_MESG_BLOCK) { __osRunningThread->state = 8; __osEnqueueAndYield(&mq->fullqueue); - } - else - { + } else { __osRestoreInt(s0); return -1; } @@ -23,8 +18,9 @@ s32 osSendMesg(OSMesgQueue* mq, OSMesg mesg, s32 flag) mq->msg[index] = mesg; mq->validCount++; - if (mq->mtqueue->next != NULL) + if (mq->mtqueue->next != NULL) { osStartThread(__osPopThread(&mq->mtqueue)); + } __osRestoreInt(s0); diff --git a/src/libultra_boot_O1/osSetEventMesg.c b/src/libultra_boot_O1/osSetEventMesg.c index a40a50a2e3..97123969de 100644 --- a/src/libultra_boot_O1/osSetEventMesg.c +++ b/src/libultra_boot_O1/osSetEventMesg.c @@ -4,23 +4,21 @@ __OSEventState __osEventStateTab[16]; u32 __osPreNMI = 0; -void osSetEventMesg(OSEvent e, OSMesgQueue *mq, OSMesg msg) -{ +void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg msg) { register u32 int_disabled; - __OSEventState *msgs; - + __OSEventState* msgs; + int_disabled = __osDisableInt(); msgs = __osEventStateTab + e; msgs->queue = mq; msgs->msg = msg; - if (e == OS_EVENT_PRENMI) - { - if (__osShutdown && !__osPreNMI) + if (e == OS_EVENT_PRENMI) { + if (__osShutdown && !__osPreNMI) { osSendMesg(mq, msg, 0); + } __osPreNMI = true; } __osRestoreInt(int_disabled); - } diff --git a/src/libultra_boot_O1/osSetThreadPri.c b/src/libultra_boot_O1/osSetThreadPri.c index 158eb3a63e..483488e507 100644 --- a/src/libultra_boot_O1/osSetThreadPri.c +++ b/src/libultra_boot_O1/osSetThreadPri.c @@ -1,22 +1,19 @@ #include -void osSetThreadPri(OSThread* thread, OSPri pri) -{ +void osSetThreadPri(OSThread* thread, OSPri pri) { register u32 s0 = __osDisableInt(); - if (thread == NULL) + if (thread == NULL) { thread = __osRunningThread; + } - if (thread->priority != pri) - { + if (thread->priority != pri) { thread->priority = pri; - if (thread != __osRunningThread && thread->state != 1) - { + if (thread != __osRunningThread && thread->state != 1) { __osDequeueThread(thread->queue, thread); __osEnqueueThread(thread->queue, thread); } - if (__osRunningThread->priority < __osRunQueue->priority) - { + if (__osRunningThread->priority < __osRunQueue->priority) { __osRunningThread->state = 2; __osEnqueueAndYield(&__osRunQueue); } diff --git a/src/libultra_boot_O1/osStartThread.c b/src/libultra_boot_O1/osStartThread.c index bbb514e3e4..f64fa902d9 100644 --- a/src/libultra_boot_O1/osStartThread.c +++ b/src/libultra_boot_O1/osStartThread.c @@ -1,38 +1,29 @@ #include -void osStartThread(OSThread* thread) -{ +void osStartThread(OSThread* thread) { register u32 s0 = __osDisableInt(); - switch (thread->state) - { - case 8: - thread->state = 2; - __osEnqueueThread(&__osRunQueue, thread); - break; - case 1: - if (thread->queue == NULL || thread->queue == &__osRunQueue) - { + switch (thread->state) { + case 8: thread->state = 2; __osEnqueueThread(&__osRunQueue, thread); - } - else - { - thread->state = 8; - __osEnqueueThread(thread->queue, thread); - __osEnqueueThread(&__osRunQueue, __osPopThread(thread->queue)); - } - break; + break; + case 1: + if (thread->queue == NULL || thread->queue == &__osRunQueue) { + thread->state = 2; + __osEnqueueThread(&__osRunQueue, thread); + } else { + thread->state = 8; + __osEnqueueThread(thread->queue, thread); + __osEnqueueThread(&__osRunQueue, __osPopThread(thread->queue)); + } + break; } - if (__osRunningThread == NULL) - { + if (__osRunningThread == NULL) { __osDispatchThread(); - } - else - { - if (__osRunningThread->priority < __osRunQueue->priority) - { + } else { + if (__osRunningThread->priority < __osRunQueue->priority) { __osRunningThread->state = 2; __osEnqueueAndYield(&__osRunQueue); } diff --git a/src/libultra_boot_O1/osStopThread.c b/src/libultra_boot_O1/osStopThread.c index 4f3ecd905b..4d5db6afde 100644 --- a/src/libultra_boot_O1/osStopThread.c +++ b/src/libultra_boot_O1/osStopThread.c @@ -1,26 +1,25 @@ #include -void osStopThread(OSThread* thread) -{ +void osStopThread(OSThread* thread) { register u32 s0 = __osDisableInt(); register u32 state; - if (thread == NULL) + if (thread == NULL) { state = 4; - else + } else { state = thread->state; + } - switch (state) - { - case 4: - __osRunningThread->state = 1; - __osEnqueueAndYield(NULL); - break; - case 2: - case 8: - thread->state = 1; - __osDequeueThread(thread->queue, thread); - break; + switch (state) { + case 4: + __osRunningThread->state = 1; + __osEnqueueAndYield(NULL); + break; + case 2: + case 8: + thread->state = 1; + __osDequeueThread(thread->queue, thread); + break; } __osRestoreInt(s0); diff --git a/src/libultra_boot_O1/osViExtendVStart.c b/src/libultra_boot_O1/osViExtendVStart.c index 3180311ad7..8a09b2ae9d 100644 --- a/src/libultra_boot_O1/osViExtendVStart.c +++ b/src/libultra_boot_O1/osViExtendVStart.c @@ -1,6 +1,5 @@ #include -void osViExtendVStart(u32 arg0) -{ +void osViExtendVStart(u32 arg0) { __additional_scanline = arg0; } diff --git a/src/libultra_boot_O1/osViModePalLan1.c b/src/libultra_boot_O1/osViModePalLan1.c index c516be9a29..47c6c915eb 100644 --- a/src/libultra_boot_O1/osViModePalLan1.c +++ b/src/libultra_boot_O1/osViModePalLan1.c @@ -1,33 +1,32 @@ #include -OSViMode osViModePalLan1 = -{ - 0x10, //type - { //comRegs - 0x311E, //ctrl - 0x140, //width - 0x4541E3A, //burst - 0x271, //vSync - 0x170C69, //hSync - 0xC6F0C6D, //leap - 0x800300, //hStart - 0x200, //xScale - 0 //vCurrent +OSViMode osViModePalLan1 = { + 0x10, // type + { + // comRegs + 0x311E, // ctrl + 0x140, // width + 0x4541E3A, // burst + 0x271, // vSync + 0x170C69, // hSync + 0xC6F0C6D, // leap + 0x800300, // hStart + 0x200, // xScale + 0 // vCurrent }, - { //fldRegs - { - 0x280, //origin - 0x400, //yScale - 0x5F0239, //vStart - 0x9026B, //vBurst - 2, //vIntr - }, - { - 0x280, //origin - 0x400, //yScale - 0x5F0239, //vStart - 0x9026B, //vBurst - 2 //vIntr - } - } + { // fldRegs + { + 0x280, // origin + 0x400, // yScale + 0x5F0239, // vStart + 0x9026B, // vBurst + 2, // vIntr + }, + { + 0x280, // origin + 0x400, // yScale + 0x5F0239, // vStart + 0x9026B, // vBurst + 2 // vIntr + } }, }; diff --git a/src/libultra_boot_O1/osVirtualToPhysical.c b/src/libultra_boot_O1/osVirtualToPhysical.c index e6d65f3a72..b7c118b4bc 100644 --- a/src/libultra_boot_O1/osVirtualToPhysical.c +++ b/src/libultra_boot_O1/osVirtualToPhysical.c @@ -1,12 +1,13 @@ #include -u32 osVirtualToPhysical(void* vaddr) -{ - if ((u32)vaddr >= 0x80000000 && (u32)vaddr < 0xA0000000) +u32 osVirtualToPhysical(void* vaddr) { + if ((u32)vaddr >= 0x80000000 && (u32)vaddr < 0xA0000000) { return (u32)vaddr & 0x1FFFFFFF; + } - if ((u32)vaddr >= 0xA0000000 && (u32)vaddr < 0xC0000000) + if ((u32)vaddr >= 0xA0000000 && (u32)vaddr < 0xC0000000) { return (u32)vaddr & 0x1FFFFFFF; + } return __osProbeTLB(vaddr); } diff --git a/src/libultra_boot_O1/osYieldThread.c b/src/libultra_boot_O1/osYieldThread.c index 7ed1597790..e289cc9731 100644 --- a/src/libultra_boot_O1/osYieldThread.c +++ b/src/libultra_boot_O1/osYieldThread.c @@ -1,7 +1,6 @@ #include -void osYieldThread() -{ +void osYieldThread() { register u32 prevInt; prevInt = __osDisableInt(); diff --git a/src/libultra_boot_O1/piacs.c b/src/libultra_boot_O1/piacs.c index ab1db132a0..e48cfbcc0b 100644 --- a/src/libultra_boot_O1/piacs.c +++ b/src/libultra_boot_O1/piacs.c @@ -5,24 +5,22 @@ u32 __osPiAccessQueueEnabled = 0; OSMesg piAccessBuf; OSMesgQueue __osPiAccessQueue; -void __osPiCreateAccessQueue(void) -{ +void __osPiCreateAccessQueue(void) { __osPiAccessQueueEnabled = 1; osCreateMesgQueue(&__osPiAccessQueue, &piAccessBuf, 1); osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK); } -void __osPiGetAccess(void) -{ +void __osPiGetAccess(void) { OSMesg mesg; - if (!__osPiAccessQueueEnabled) + if (!__osPiAccessQueueEnabled) { __osPiCreateAccessQueue(); + } osRecvMesg(&__osPiAccessQueue, &mesg, OS_MESG_BLOCK); } -void __osPiRelAccess(void) -{ +void __osPiRelAccess(void) { osSendMesg(&__osPiAccessQueue, 0, OS_MESG_NOBLOCK); } diff --git a/src/libultra_boot_O1/timerintr.c b/src/libultra_boot_O1/timerintr.c index 020dc31324..83c882a3b2 100644 --- a/src/libultra_boot_O1/timerintr.c +++ b/src/libultra_boot_O1/timerintr.c @@ -7,8 +7,7 @@ u32 __osViIntrCount; u32 __osTimerCounter; OSTimer* __osTimerList = &__osBaseTimer; -void __osTimerServicesInit() -{ +void __osTimerServicesInit() { __osCurrentTime = 0; __osBaseCounter = 0; __osViIntrCount = 0; @@ -20,9 +19,8 @@ void __osTimerServicesInit() __osTimerList->msg = NULL; } -void __osTimerInterrupt() -{ - OSTimer *sp24; +void __osTimerInterrupt() { + OSTimer* sp24; u32 sp20; u32 sp1c; if (__osTimerList->next == __osTimerList) { @@ -58,13 +56,13 @@ void __osTimerInterrupt() } } -void __osSetTimerIntr(OSTime tim) -{ +void __osSetTimerIntr(OSTime tim) { OSTime NewTime; u32 savedMask; - if (tim < 468) + if (tim < 468) { tim = 468; + } savedMask = __osDisableInt(); @@ -74,9 +72,8 @@ void __osSetTimerIntr(OSTime tim) __osRestoreInt(savedMask); } -OSTime __osInsertTimer(OSTimer *a0) -{ - OSTimer *sp34; +OSTime __osInsertTimer(OSTimer* a0) { + OSTimer* sp34; u64 sp28; s32 intDisabled; intDisabled = __osDisableInt(); diff --git a/src/libultra_boot_O2/_Ldtob.c b/src/libultra_boot_O2/_Ldtob.c index 4a72dfd337..57a49cc8cc 100644 --- a/src/libultra_boot_O2/_Ldtob.c +++ b/src/libultra_boot_O2/_Ldtob.c @@ -5,8 +5,8 @@ #define BUFF_LEN 0x20 -s16 _Ldunscale(s16 *, _Pft *); -void _Genld(_Pft *, u8, u8 *, s16, s16); +s16 _Ldunscale(s16*, _Pft*); +void _Genld(_Pft*, u8, u8*, s16, s16); const double D_800122E0[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L, 10e255L }; @@ -43,9 +43,9 @@ const double D_800122E0[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L #define _D3 3 #endif -void _Ldtob(_Pft *args, u8 type) { +void _Ldtob(_Pft* args, u8 type) { u8 buff[BUFF_LEN]; - u8 *ptr; + u8* ptr; u32 sp70; f64 val; /* maybe struct? */ @@ -159,9 +159,9 @@ void _Ldtob(_Pft *args, u8 type) { _Genld((_Pft*)args, type, ptr, nsig, exp); } -s16 _Ldunscale(s16 *pex, _Pft *px) { +s16 _Ldunscale(s16* pex, _Pft* px) { - unsigned short *ps = (unsigned short *) px; + unsigned short* ps = (unsigned short*)px; short xchar = (ps[_D0] & _DMASK) >> _DOFF; if (xchar == _DMAX) { /* NaN or INF */ *pex = 0; @@ -179,16 +179,15 @@ s16 _Ldunscale(s16 *pex, _Pft *px) { } } -void _Genld(_Pft *px, u8 code, u8 *p, s16 nsig, s16 xexp) { +void _Genld(_Pft* px, u8 code, u8* p, s16 nsig, s16 xexp) { u8 point = '.'; if (nsig <= 0) { nsig = 1, - p = (u8 *) "0"; + p = (u8*)"0"; } - if (code == 'f' - || ((code == 'g' || code == 'G') && (-4 <= xexp) && (xexp < px->prec))) { /* 'f' format */ + if (code == 'f' || ((code == 'g' || code == 'G') && (-4 <= xexp) && (xexp < px->prec))) { /* 'f' format */ ++xexp; /* change to leading digit count */ if (code != 'f') { /* fixup for 'g' */ if (!(px->flags & FLAGS_HASH) && nsig < px->prec) { @@ -257,7 +256,7 @@ void _Genld(_Pft *px, u8 code, u8 *p, s16 nsig, s16 xexp) { px->n1 += nsig; px->nz1 = px->prec - nsig; } - p = (u8 *) &px->s[px->n1]; /* put exponent */ + p = (u8*)&px->s[px->n1]; /* put exponent */ *p++ = code; if (0 <= xexp) { *p++ = '+'; @@ -273,11 +272,10 @@ void _Genld(_Pft *px, u8 code, u8 *p, s16 nsig, s16 xexp) { } *p++ = xexp / 10 + '0', xexp %= 10; *p++ = xexp + '0'; - px->n2 = p - (u8 *) &px->s[px->n1]; + px->n2 = p - (u8*)&px->s[px->n1]; } if ((px->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO) { /* pad with leading zeros */ - int n = - px->n0 + px->n1 + px->nz1 + px->n2 + px->nz2; + int n = px->n0 + px->n1 + px->nz1 + px->n2 + px->nz2; if (n < px->width) { px->nz0 = px->width - n; diff --git a/src/libultra_boot_O2/_Litob.c b/src/libultra_boot_O2/_Litob.c index 15206217c6..5b2329cd34 100644 --- a/src/libultra_boot_O2/_Litob.c +++ b/src/libultra_boot_O2/_Litob.c @@ -8,28 +8,31 @@ u8 D_8000AF70[] = "0123456789abcdef"; u8 D_8000AF84[] = "0123456789ABCDEF"; -void _Litob(_Pft *args, u8 type) { +void _Litob(_Pft* args, u8 type) { u8 buff[BUFF_LEN]; - const u8 *num_map; + const u8* num_map; s32 base; s32 buff_ind; u64 num; lldiv_t quotrem; - if (type == 'X') + if (type == 'X') { num_map = D_8000AF84; - else + } else { num_map = D_8000AF70; + } base = (type == 'o') ? 8 : ((type != 'x' && type != 'X') ? 10 : 16); buff_ind = BUFF_LEN; num = args->v.ll; - if ((type == 'd' || type == 'i') && args->v.ll < 0) + if ((type == 'd' || type == 'i') && args->v.ll < 0) { num = -num; + } - if (num != 0 || args->prec != 0) + if (num != 0 || args->prec != 0) { buff[--buff_ind] = num_map[num % base]; + } args->v.ll = num / base; @@ -43,12 +46,14 @@ void _Litob(_Pft *args, u8 type) { memcpy(args->s, buff + buff_ind, args->n1); - if (args->n1 < args->prec) + if (args->n1 < args->prec) { args->nz0 = args->prec - args->n1; + } if (args->prec < 0 && (args->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO) { buff_ind = args->width - args->n0 - args->nz0 - args->n1; - if (buff_ind > 0) + if (buff_ind > 0) { args->nz0 += buff_ind; + } } } diff --git a/src/libultra_boot_O2/_Printf.c b/src/libultra_boot_O2/_Printf.c index cbb803bbdc..a5f922d562 100644 --- a/src/libultra_boot_O2/_Printf.c +++ b/src/libultra_boot_O2/_Printf.c @@ -3,38 +3,37 @@ #include #include -#define ATOI(i, a) \ - for (i = 0; *a >= '0' && *a <= '9'; a++) \ - if (i < 999) \ +#define ATOI(i, a) \ + for (i = 0; *a >= '0' && *a <= '9'; a++) \ + if (i < 999) \ i = *a + i * 10 - '0'; -#define _PROUT(fmt, _size) \ - if (_size > 0) { \ - arg = (void*)pfn(arg, fmt, _size); \ - if (arg != 0) \ - x.nchar += _size; \ - else \ - return x.nchar; \ +#define _PROUT(fmt, _size) \ + if (_size > 0) { \ + arg = (void*)pfn(arg, fmt, _size); \ + if (arg != 0) \ + x.nchar += _size; \ + else \ + return x.nchar; \ } -#define _PAD(m, src, extracond) \ - if (extracond && m > 0) { \ - int i; \ - int j; \ - for (j = m; j > 0; j -= i) { \ - if ((u32) j > 32) \ - i = 32; \ - else \ - i = j; \ - _PROUT(src, i); \ - } \ +#define _PAD(m, src, extracond) \ + if (extracond && m > 0) { \ + int i; \ + int j; \ + for (j = m; j > 0; j -= i) { \ + if ((u32)j > 32) \ + i = 32; \ + else \ + i = j; \ + _PROUT(src, i); \ + } \ } char spaces[] = " "; char zeroes[] = "00000000000000000000000000000000"; -void _Putfld(_Pft *, va_list *, u8, u8 *); +void _Putfld(_Pft*, va_list*, u8, u8*); -s32 _Printf(char *(*pfn)(char *, const char *, size_t), char *arg, const char *fmt, va_list ap) -{ +s32 _Printf(char* (*pfn)(char*, const char*, size_t), char* arg, const char* fmt, va_list ap) { _Pft x; x.nchar = 0; while (1) { @@ -47,15 +46,15 @@ s32 _Printf(char *(*pfn)(char *, const char *, size_t), char *arg, const char *f u8 ac[0x20]; - s = (u8 *)fmt; + s = (u8*)fmt; while ((c = *s) != 0 && c != '%') { s++; } - _PROUT(fmt, s - (u8 *)fmt); + _PROUT(fmt, s - (u8*)fmt); if (c == 0) { return x.nchar; } - fmt = (char *) ++s; + fmt = (char*)++s; x.flags = 0; for (; (t = strchr(fchar, *s)) != NULL; s++) { x.flags |= fbit[t - fchar]; @@ -92,23 +91,21 @@ s32 _Printf(char *(*pfn)(char *, const char *, size_t), char *arg, const char *f s++; } _Putfld(&x, &ap, *s, ac); - x.width -= x.n0 + x.nz0 + x.n1 + x.nz1 - + x.n2 + x.nz2; + x.width -= x.n0 + x.nz0 + x.n1 + x.nz1 + x.n2 + x.nz2; _PAD(x.width, spaces, !(x.flags & FLAGS_MINUS)); - _PROUT((char *) ac, x.n0); + _PROUT((char*)ac, x.n0); _PAD(x.nz0, zeroes, 1); _PROUT(x.s, x.n1); _PAD(x.nz1, zeroes, 1); - _PROUT((char *) (&x.s[x.n1]), x.n2) + _PROUT((char*)(&x.s[x.n1]), x.n2) _PAD(x.nz2, zeroes, 1); _PAD(x.width, spaces, x.flags & FLAGS_MINUS); - fmt = (char *) s + 1; + fmt = (char*)s + 1; } } void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac) { - px->n0 = px->nz0 = px->n1 = px->nz1 = px->n2 = - px->nz2 = 0; + px->n0 = px->nz0 = px->n1 = px->nz1 = px->n2 = px->nz2 = 0; switch (code) { @@ -127,7 +124,7 @@ void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac) { } if (px->qual == 'h') { - px->v.ll = (s16) px->v.ll; + px->v.ll = (s16)px->v.ll; } if (px->v.ll < 0) { @@ -138,7 +135,7 @@ void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac) { ac[px->n0++] = ' '; } - px->s = (char *) &ac[px->n0]; + px->s = (char*)&ac[px->n0]; _Litob(px, code); break; @@ -156,9 +153,9 @@ void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac) { } if (px->qual == 'h') { - px->v.ll = (u16) px->v.ll; + px->v.ll = (u16)px->v.ll; } else if (px->qual == 0) { - px->v.ll = (u32) px->v.ll; + px->v.ll = (u32)px->v.ll; } if (px->flags & FLAGS_HASH) { @@ -168,7 +165,7 @@ void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac) { ac[px->n0++] = code; } } - px->s = (char *) &ac[px->n0]; + px->s = (char*)&ac[px->n0]; _Litob(px, code); break; @@ -189,30 +186,30 @@ void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac) { } } - px->s = (char *) &ac[px->n0]; + px->s = (char*)&ac[px->n0]; _Ldtob(px, code); break; case 'n': if (px->qual == 'h') { - *(va_arg(*pap, u16 *)) = px->nchar; + *(va_arg(*pap, u16*)) = px->nchar; } else if (px->qual == 'l') { - *va_arg(*pap, u32 *) = px->nchar; + *va_arg(*pap, u32*) = px->nchar; } else if (px->qual == 'L') { - *va_arg(*pap, u64 *) = px->nchar; + *va_arg(*pap, u64*) = px->nchar; } else { - *va_arg(*pap, u32 *) = px->nchar; + *va_arg(*pap, u32*) = px->nchar; } break; case 'p': - px->v.ll = (long) va_arg(*pap, void *); - px->s = (char *) &ac[px->n0]; + px->v.ll = (long)va_arg(*pap, void*); + px->s = (char*)&ac[px->n0]; _Litob(px, 'x'); break; case 's': - px->s = va_arg(*pap, char *); + px->s = va_arg(*pap, char*); px->n1 = strlen(px->s); if (px->prec >= 0 && px->n1 > px->prec) { px->n1 = px->prec; @@ -227,4 +224,4 @@ void _Putfld(_Pft* px, va_list* pap, u8 code, u8* ac) { ac[px->n0++] = code; break; } -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/__osDevMgrMain.c b/src/libultra_boot_O2/__osDevMgrMain.c index b3d8cd971d..9065b903c0 100644 --- a/src/libultra_boot_O2/__osDevMgrMain.c +++ b/src/libultra_boot_O2/__osDevMgrMain.c @@ -1,8 +1,7 @@ #include #include -void __osDevMgrMain(void* arg) -{ +void __osDevMgrMain(void* arg) { OSIoMesg* ioMesg; OSMesg sp70; OSMesg sp6C; @@ -16,17 +15,16 @@ void __osDevMgrMain(void* arg) arg0 = (OSMgrArgs*)arg; ioMesg = NULL; - while (true) - { + while (true) { osRecvMesg(arg0->cmdQueue, (OSMesg)&ioMesg, OS_MESG_BLOCK); - if ((ioMesg->piHandle != NULL) && (ioMesg->piHandle->type == DEVICE_TYPE_64DD) && - ((ioMesg->piHandle->transferInfo.cmdType == 0) || (ioMesg->piHandle->transferInfo.cmdType == 1))) - { + if ((ioMesg->piHandle != NULL) && (ioMesg->piHandle->type == DEVICE_TYPE_64DD) && + ((ioMesg->piHandle->transferInfo.cmdType == 0) || (ioMesg->piHandle->transferInfo.cmdType == 1))) { transfer = &ioMesg->piHandle->transferInfo; block = &transfer->block[transfer->blockNum]; transfer->sectorNum = -1; - if (transfer->transferMode != 3) + if (transfer->transferMode != 3) { block->dramAddr = (void*)((u32)block->dramAddr - block->sectorSize); + } phi_s2 = ((transfer->transferMode == 2) && (ioMesg->piHandle->transferInfo.cmdType == 0)) ? 1 : 0; @@ -34,38 +32,36 @@ void __osDevMgrMain(void* arg) __osResetGlobalIntMask(0x00100401); __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x80000000); - while (true) - { + while (true) { osRecvMesg(arg0->eventQueue, &sp70, OS_MESG_BLOCK); transfer = &ioMesg->piHandle->transferInfo; block = &transfer->block[transfer->blockNum]; - if (block->errStatus == 0x1D) - { + if (block->errStatus == 0x1D) { __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x10000000); __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow); __osEPiRawReadIo(ioMesg->piHandle, 0x05000508, &sp54); - if (sp54 & 0x02000000) + if (sp54 & 0x02000000) { __osEPiRawWriteIo(ioMesg->piHandle, 0x05000510, transfer->bmCtlShadow | 0x1000000); + } block->errStatus = 4; HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR; __osSetGlobalIntMask(0x00100C01); } osSendMesg(ioMesg->hdr.retQueue, ioMesg, OS_MESG_NOBLOCK); - if ((phi_s2 != 1) || (ioMesg->piHandle->transferInfo.block[0].errStatus != 0)) + if ((phi_s2 != 1) || (ioMesg->piHandle->transferInfo.block[0].errStatus != 0)) { break; + } phi_s2 = 0; } osSendMesg(arg0->acccessQueue, 0, OS_MESG_NOBLOCK); - if (ioMesg->piHandle->transferInfo.blockNum == 1) + if (ioMesg->piHandle->transferInfo.blockNum == 1) { osYieldThread(); - } - else - { - switch (ioMesg->hdr.type) - { + } + } else { + switch (ioMesg->hdr.type) { case 11: osRecvMesg(arg0->acccessQueue, &sp6C, OS_MESG_BLOCK); phi_s0 = arg0->piDmaCallback(OS_READ, ioMesg->devAddr, ioMesg->dramAddr, ioMesg->size); @@ -76,11 +72,13 @@ void __osDevMgrMain(void* arg) break; case 15: osRecvMesg(arg0->acccessQueue, &sp6C, OS_MESG_BLOCK); - phi_s0 = arg0->epiDmaCallback(ioMesg->piHandle, OS_READ, ioMesg->devAddr, ioMesg->dramAddr, ioMesg->size); + phi_s0 = arg0->epiDmaCallback(ioMesg->piHandle, OS_READ, ioMesg->devAddr, ioMesg->dramAddr, + ioMesg->size); break; case 16: osRecvMesg(arg0->acccessQueue, &sp6C, OS_MESG_BLOCK); - phi_s0 = arg0->epiDmaCallback(ioMesg->piHandle, OS_WRITE, ioMesg->devAddr, ioMesg->dramAddr, ioMesg->size); + phi_s0 = arg0->epiDmaCallback(ioMesg->piHandle, OS_WRITE, ioMesg->devAddr, ioMesg->dramAddr, + ioMesg->size); break; case 10: osSendMesg(ioMesg->hdr.retQueue, ioMesg, OS_MESG_NOBLOCK); @@ -91,8 +89,7 @@ void __osDevMgrMain(void* arg) break; } - if (phi_s0 == 0) - { + if (phi_s0 == 0) { osRecvMesg(arg0->eventQueue, &sp70, OS_MESG_BLOCK); osSendMesg(ioMesg->hdr.retQueue, ioMesg, OS_MESG_NOBLOCK); osSendMesg(arg0->acccessQueue, NULL, OS_MESG_NOBLOCK); diff --git a/src/libultra_boot_O2/__osEPiRawReadIo.c b/src/libultra_boot_O2/__osEPiRawReadIo.c index d448810157..b1e9b88d00 100644 --- a/src/libultra_boot_O2/__osEPiRawReadIo.c +++ b/src/libultra_boot_O2/__osEPiRawReadIo.c @@ -1,45 +1,49 @@ #include #include -s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data) -{ +s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data) { s32 status; OSPiHandle* curHandle; - while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) + while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) { ; + } - if (__osCurrentHandle[handle->domain]->type != handle->type) - { + if (__osCurrentHandle[handle->domain]->type != handle->type) { curHandle = __osCurrentHandle[handle->domain]; - if (handle->domain == 0) - { - if (curHandle->latency != handle->latency) + if (handle->domain == 0) { + if (curHandle->latency != handle->latency) { HW_REG(PI_BSD_DOM1_LAT_REG, u32) = handle->latency; + } - if (curHandle->pageSize != handle->pageSize) + if (curHandle->pageSize != handle->pageSize) { HW_REG(PI_BSD_DOM1_PGS_REG, u32) = handle->pageSize; + } - if (curHandle->relDuration != handle->relDuration) + if (curHandle->relDuration != handle->relDuration) { HW_REG(PI_BSD_DOM1_RLS_REG, u32) = handle->relDuration; + } - if (curHandle->pulse != handle->pulse) + if (curHandle->pulse != handle->pulse) { HW_REG(PI_BSD_DOM1_PWD_REG, u32) = handle->pulse; - } - else - { - if (curHandle->latency != handle->latency) + } + } else { + if (curHandle->latency != handle->latency) { HW_REG(PI_BSD_DOM2_LAT_REG, u32) = handle->latency; + } - if (curHandle->pageSize != handle->pageSize) + if (curHandle->pageSize != handle->pageSize) { HW_REG(PI_BSD_DOM2_PGS_REG, u32) = handle->pageSize; + } - if (curHandle->relDuration != handle->relDuration) + if (curHandle->relDuration != handle->relDuration) { HW_REG(PI_BSD_DOM2_RLS_REG, u32) = handle->relDuration; + } - if (curHandle->pulse != handle->pulse) + if (curHandle->pulse != handle->pulse) { HW_REG(PI_BSD_DOM2_PWD_REG, u32) = handle->pulse; + } } curHandle->type = handle->type; diff --git a/src/libultra_boot_O2/__osEPiRawStartDma.c b/src/libultra_boot_O2/__osEPiRawStartDma.c index dcd5f44d9b..cc28a6ca9d 100644 --- a/src/libultra_boot_O2/__osEPiRawStartDma.c +++ b/src/libultra_boot_O2/__osEPiRawStartDma.c @@ -1,45 +1,49 @@ #include #include -s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size) -{ +s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size) { s32 status; OSPiHandle* curHandle; - while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) + while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) { ; + } - if (__osCurrentHandle[handle->domain]->type != handle->type) - { + if (__osCurrentHandle[handle->domain]->type != handle->type) { curHandle = __osCurrentHandle[handle->domain]; - if (handle->domain == 0) - { - if (curHandle->latency != handle->latency) + if (handle->domain == 0) { + if (curHandle->latency != handle->latency) { HW_REG(PI_BSD_DOM1_LAT_REG, u32) = handle->latency; + } - if (curHandle->pageSize != handle->pageSize) + if (curHandle->pageSize != handle->pageSize) { HW_REG(PI_BSD_DOM1_PGS_REG, u32) = handle->pageSize; + } - if (curHandle->relDuration != handle->relDuration) + if (curHandle->relDuration != handle->relDuration) { HW_REG(PI_BSD_DOM1_RLS_REG, u32) = handle->relDuration; + } - if (curHandle->pulse != handle->pulse) + if (curHandle->pulse != handle->pulse) { HW_REG(PI_BSD_DOM1_PWD_REG, u32) = handle->pulse; - } - else - { - if (curHandle->latency != handle->latency) + } + } else { + if (curHandle->latency != handle->latency) { HW_REG(PI_BSD_DOM2_LAT_REG, u32) = handle->latency; + } - if (curHandle->pageSize != handle->pageSize) + if (curHandle->pageSize != handle->pageSize) { HW_REG(PI_BSD_DOM2_PGS_REG, u32) = handle->pageSize; + } - if (curHandle->relDuration != handle->relDuration) + if (curHandle->relDuration != handle->relDuration) { HW_REG(PI_BSD_DOM2_RLS_REG, u32) = handle->relDuration; + } - if (curHandle->pulse != handle->pulse) + if (curHandle->pulse != handle->pulse) { HW_REG(PI_BSD_DOM2_PWD_REG, u32) = handle->pulse; + } } curHandle->type = handle->type; @@ -52,17 +56,16 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dr HW_REG(PI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(dramAddr); HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1fffffff); - switch (direction) - { - case OS_READ: - HW_REG(PI_WR_LEN_REG, u32) = size - 1; - break; - case OS_WRITE: - HW_REG(PI_RD_LEN_REG, u32) = size - 1; - break; - default: - return -1; - break; + switch (direction) { + case OS_READ: + HW_REG(PI_WR_LEN_REG, u32) = size - 1; + break; + case OS_WRITE: + HW_REG(PI_RD_LEN_REG, u32) = size - 1; + break; + default: + return -1; + break; } return 0; diff --git a/src/libultra_boot_O2/__osEPiRawWriteIo.c b/src/libultra_boot_O2/__osEPiRawWriteIo.c index 517c7397aa..08d817bfa3 100644 --- a/src/libultra_boot_O2/__osEPiRawWriteIo.c +++ b/src/libultra_boot_O2/__osEPiRawWriteIo.c @@ -1,45 +1,49 @@ #include #include -s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) -{ +s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) { s32 status; OSPiHandle* curHandle; - while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) + while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) { ; + } - if (__osCurrentHandle[handle->domain]->type != handle->type) - { + if (__osCurrentHandle[handle->domain]->type != handle->type) { curHandle = __osCurrentHandle[handle->domain]; - if (handle->domain == 0) - { - if (curHandle->latency != handle->latency) + if (handle->domain == 0) { + if (curHandle->latency != handle->latency) { HW_REG(PI_BSD_DOM1_LAT_REG, u32) = handle->latency; + } - if (curHandle->pageSize != handle->pageSize) + if (curHandle->pageSize != handle->pageSize) { HW_REG(PI_BSD_DOM1_PGS_REG, u32) = handle->pageSize; + } - if (curHandle->relDuration != handle->relDuration) + if (curHandle->relDuration != handle->relDuration) { HW_REG(PI_BSD_DOM1_RLS_REG, u32) = handle->relDuration; + } - if (curHandle->pulse != handle->pulse) + if (curHandle->pulse != handle->pulse) { HW_REG(PI_BSD_DOM1_PWD_REG, u32) = handle->pulse; - } - else - { - if (curHandle->latency != handle->latency) + } + } else { + if (curHandle->latency != handle->latency) { HW_REG(PI_BSD_DOM2_LAT_REG, u32) = handle->latency; + } - if (curHandle->pageSize != handle->pageSize) + if (curHandle->pageSize != handle->pageSize) { HW_REG(PI_BSD_DOM2_PGS_REG, u32) = handle->pageSize; + } - if (curHandle->relDuration != handle->relDuration) + if (curHandle->relDuration != handle->relDuration) { HW_REG(PI_BSD_DOM2_RLS_REG, u32) = handle->relDuration; + } - if (curHandle->pulse != handle->pulse) + if (curHandle->pulse != handle->pulse) { HW_REG(PI_BSD_DOM2_PWD_REG, u32) = handle->pulse; + } } curHandle->type = handle->type; diff --git a/src/libultra_boot_O2/__osPiRawStartDma.c b/src/libultra_boot_O2/__osPiRawStartDma.c index 0957a0ebcb..589a63b3ba 100644 --- a/src/libultra_boot_O2/__osPiRawStartDma.c +++ b/src/libultra_boot_O2/__osPiRawStartDma.c @@ -1,30 +1,27 @@ #include #include -s32 __osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size) -{ +s32 __osPiRawStartDma(s32 dir, u32 cart_addr, void* dram_addr, size_t size) { register int status; status = HW_REG(PI_STATUS_REG, u32); - while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) - { + while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) { status = HW_REG(PI_STATUS_REG, u32); } - HW_REG(PI_DRAM_ADDR_REG, void *) = (void *)osVirtualToPhysical(dram_addr); + HW_REG(PI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(dram_addr); - HW_REG(PI_CART_ADDR_REG, void *) = (void *)((osRomBase | cart_addr) & 0x1fffffff); + HW_REG(PI_CART_ADDR_REG, void*) = (void*)((osRomBase | cart_addr) & 0x1fffffff); - switch (dir) - { - case OS_READ: - HW_REG(PI_WR_LEN_REG, u32) = size - 1; - break; - case OS_WRITE: - HW_REG(PI_RD_LEN_REG, u32) = size - 1; - break; - default: - return -1; - break; + switch (dir) { + case OS_READ: + HW_REG(PI_WR_LEN_REG, u32) = size - 1; + break; + case OS_WRITE: + HW_REG(PI_RD_LEN_REG, u32) = size - 1; + break; + default: + return -1; + break; } return 0; -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/__osSiDeviceBusy.c b/src/libultra_boot_O2/__osSiDeviceBusy.c index 983bd071d0..8bb777745d 100644 --- a/src/libultra_boot_O2/__osSiDeviceBusy.c +++ b/src/libultra_boot_O2/__osSiDeviceBusy.c @@ -1,12 +1,12 @@ #include #include -u32 __osSiDeviceBusy() -{ +u32 __osSiDeviceBusy() { register u32 status; status = HW_REG(SI_STATUS_REG, u32); - if (status & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)) + if (status & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)) { return true; - else + } else { return false; + } } diff --git a/src/libultra_boot_O2/__osSiRawReadIo.c b/src/libultra_boot_O2/__osSiRawReadIo.c index c3bb394f03..fa26c8e2aa 100644 --- a/src/libultra_boot_O2/__osSiRawReadIo.c +++ b/src/libultra_boot_O2/__osSiRawReadIo.c @@ -1,10 +1,10 @@ #include #include -s32 __osSiRawReadIo(void *a0, u32 *a1) -{ - if (__osSiDeviceBusy()) +s32 __osSiRawReadIo(void* a0, u32* a1) { + if (__osSiDeviceBusy()) { return -1; + } *a1 = HW_REG((u32)a0, u32); return 0; -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/__osSiRawWriteIo.c b/src/libultra_boot_O2/__osSiRawWriteIo.c index c7ff8eab78..7658b5a97b 100644 --- a/src/libultra_boot_O2/__osSiRawWriteIo.c +++ b/src/libultra_boot_O2/__osSiRawWriteIo.c @@ -1,10 +1,10 @@ #include #include -s32 __osSiRawWriteIo(void *a0, u32 a1) -{ - if (__osSiDeviceBusy()) +s32 __osSiRawWriteIo(void* a0, u32 a1) { + if (__osSiDeviceBusy()) { return -1; + } HW_REG((u32)a0, u32) = a1; return 0; -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/__osViGetCurrentContext.c b/src/libultra_boot_O2/__osViGetCurrentContext.c index b629c77f73..fea88be8fd 100644 --- a/src/libultra_boot_O2/__osViGetCurrentContext.c +++ b/src/libultra_boot_O2/__osViGetCurrentContext.c @@ -1,6 +1,5 @@ #include -OSViContext* __osViGetCurrentContext() -{ +OSViContext* __osViGetCurrentContext() { return __osViCurr; } diff --git a/src/libultra_boot_O2/__osViInit.c b/src/libultra_boot_O2/__osViInit.c index a660a1de26..becce34ab9 100644 --- a/src/libultra_boot_O2/__osViInit.c +++ b/src/libultra_boot_O2/__osViInit.c @@ -1,12 +1,11 @@ #include #include -OSViContext vi[2] = {0}; +OSViContext vi[2] = { 0 }; OSViContext* __osViCurr = &vi[0]; OSViContext* __osViNext = &vi[1]; -void __osViInit() -{ +void __osViInit() { bzero(vi, sizeof(vi)); __osViCurr = &vi[0]; __osViNext = &vi[1]; @@ -15,19 +14,21 @@ void __osViInit() __osViCurr->retraceCount = 1; __osViNext->buffer = (void*)0x80000000; __osViCurr->buffer = (void*)0x80000000; - - if (osTvType == 0) + + if (osTvType == 0) { __osViNext->modep = &osViModePalLan1; - else if (osTvType == 2) + } else if (osTvType == 2) { __osViNext->modep = &osViModeMpalLan1; - else + } else { __osViNext->modep = &osViModeNtscLan1; + } __osViNext->state = 0x20; __osViNext->features = __osViNext->modep->comRegs.ctrl; - while (HW_REG(VI_CURRENT_REG, u32) > 10) + while (HW_REG(VI_CURRENT_REG, u32) > 10) { ; + } HW_REG(VI_CONTROL_REG, u32) = 0; __osViSwapContext(); diff --git a/src/libultra_boot_O2/__osViSwapContext.c b/src/libultra_boot_O2/__osViSwapContext.c index 93f8ede354..4dcc4c8703 100644 --- a/src/libultra_boot_O2/__osViSwapContext.c +++ b/src/libultra_boot_O2/__osViSwapContext.c @@ -1,10 +1,9 @@ #include #include -void __osViSwapContext() -{ - register OSViMode *s0; - register OSViContext *s1; +void __osViSwapContext() { + register OSViMode* s0; + register OSViContext* s1; u32 origin; u32 hStart; u32 vstart; diff --git a/src/libultra_boot_O2/osCartRomInit.c b/src/libultra_boot_O2/osCartRomInit.c index 5492a61f5a..eef5be9fdb 100644 --- a/src/libultra_boot_O2/osCartRomInit.c +++ b/src/libultra_boot_O2/osCartRomInit.c @@ -3,8 +3,7 @@ OSPiHandle __CartRomHandle; -OSPiHandle* osCartRomInit() -{ +OSPiHandle* osCartRomInit() { register u32 a; register s32 status; register u32 prevInt; @@ -17,8 +16,7 @@ OSPiHandle* osCartRomInit() __osPiGetAccess(); - if (!D_8000AF10) - { + if (!D_8000AF10) { __osPiRelAccess(); return &__CartRomHandle; } @@ -30,8 +28,9 @@ OSPiHandle* osCartRomInit() __CartRomHandle.speed = 0; bzero(&__CartRomHandle.transferInfo, sizeof(__OSTranxInfo)); - while (status = HW_REG(PI_STATUS_REG, u32), status & PI_STATUS_ERROR) + while (status = HW_REG(PI_STATUS_REG, u32), status & PI_STATUS_ERROR) { ; + } lastLatency = HW_REG(PI_BSD_DOM1_LAT_REG, u32); lastPageSize = HW_REG(PI_BSD_DOM1_PGS_REG, u32); diff --git a/src/libultra_boot_O2/osDriveRomInit.c b/src/libultra_boot_O2/osDriveRomInit.c index 2428161e82..4dd49a6299 100644 --- a/src/libultra_boot_O2/osDriveRomInit.c +++ b/src/libultra_boot_O2/osDriveRomInit.c @@ -3,8 +3,7 @@ OSPiHandle __DriveRomHandle; -OSPiHandle* osDriveRomInit() -{ +OSPiHandle* osDriveRomInit() { register s32 status; register u32 a; register s32 prevInt; @@ -12,8 +11,7 @@ OSPiHandle* osDriveRomInit() __osPiGetAccess(); - if (!D_8000AC70) - { + if (!D_8000AC70) { __osPiRelAccess(); return &__DriveRomHandle; } @@ -25,8 +23,9 @@ OSPiHandle* osDriveRomInit() __DriveRomHandle.speed = 0; bzero(&__DriveRomHandle.transferInfo, sizeof(__OSTranxInfo)); - while (status = HW_REG(PI_STATUS_REG, u32), status & PI_STATUS_ERROR) + while (status = HW_REG(PI_STATUS_REG, u32), status & PI_STATUS_ERROR) { ; + } HW_REG(PI_BSD_DOM1_LAT_REG, u32) = 0xff; HW_REG(PI_BSD_DOM1_PGS_REG, u32) = 0; diff --git a/src/libultra_boot_O2/osEPiReadIo.c b/src/libultra_boot_O2/osEPiReadIo.c index 9953c8529f..964330c305 100644 --- a/src/libultra_boot_O2/osEPiReadIo.c +++ b/src/libultra_boot_O2/osEPiReadIo.c @@ -1,7 +1,6 @@ #include -s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data) -{ +s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data) { register s32 ret; __osPiGetAccess(); @@ -9,4 +8,4 @@ s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data) __osPiRelAccess(); return ret; -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/osEPiStartDma.c b/src/libultra_boot_O2/osEPiStartDma.c index a2c2b8d5a7..83fc694a34 100644 --- a/src/libultra_boot_O2/osEPiStartDma.c +++ b/src/libultra_boot_O2/osEPiStartDma.c @@ -1,21 +1,23 @@ #include -s32 osEPiStartDma(OSPiHandle* handle, OSIoMesg* mb, s32 direction) -{ +s32 osEPiStartDma(OSPiHandle* handle, OSIoMesg* mb, s32 direction) { s32 ret; - if (!__osPiDevMgr.initialized) + if (!__osPiDevMgr.initialized) { return -1; + } mb->piHandle = handle; - if (direction == OS_READ) + if (direction == OS_READ) { mb->hdr.type = 0xf; - else + } else { mb->hdr.type = 0x10; + } - if (mb->hdr.pri == 1) + if (mb->hdr.pri == 1) { ret = osJamMesg(osPiGetCmdQueue(), (OSMesg)mb, 0); - else + } else { ret = osSendMesg(osPiGetCmdQueue(), (OSMesg)mb, 0); + } return ret; -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/osEPiWriteIo.c b/src/libultra_boot_O2/osEPiWriteIo.c index ef1cc385f4..5d4f61a2fc 100644 --- a/src/libultra_boot_O2/osEPiWriteIo.c +++ b/src/libultra_boot_O2/osEPiWriteIo.c @@ -1,7 +1,6 @@ #include -s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) -{ +s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) { register s32 ret; __osPiGetAccess(); diff --git a/src/libultra_boot_O2/osPiGetCmdQueue.c b/src/libultra_boot_O2/osPiGetCmdQueue.c index 159c423783..1f097a9269 100644 --- a/src/libultra_boot_O2/osPiGetCmdQueue.c +++ b/src/libultra_boot_O2/osPiGetCmdQueue.c @@ -1,9 +1,9 @@ #include -OSMesgQueue* osPiGetCmdQueue() -{ - if (!__osPiDevMgr.initialized) +OSMesgQueue* osPiGetCmdQueue() { + if (!__osPiDevMgr.initialized) { return NULL; + } return __osPiDevMgr.cmdQueue; } diff --git a/src/libultra_boot_O2/osViBlack.c b/src/libultra_boot_O2/osViBlack.c index 4a122496c2..753619b8b1 100644 --- a/src/libultra_boot_O2/osViBlack.c +++ b/src/libultra_boot_O2/osViBlack.c @@ -1,8 +1,7 @@ #include // TODO: name magic constants -void osViBlack(u8 active) -{ +void osViBlack(u8 active) { register u32 int_disabled = __osDisableInt(); if (active) { __osViNext->state |= 0x20; diff --git a/src/libultra_boot_O2/osViGetNextFramebuffer.c b/src/libultra_boot_O2/osViGetNextFramebuffer.c index 83eaa2705f..a8b642603a 100644 --- a/src/libultra_boot_O2/osViGetNextFramebuffer.c +++ b/src/libultra_boot_O2/osViGetNextFramebuffer.c @@ -1,9 +1,8 @@ #include -void* osViGetNextFramebuffer() -{ +void* osViGetNextFramebuffer() { s32 prevInt = __osDisableInt(); void* buff = __osViNext->buffer; __osRestoreInt(prevInt); return buff; -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/osViModeFpalLan1.c b/src/libultra_boot_O2/osViModeFpalLan1.c index c620ad53d9..47b36d7ad9 100644 --- a/src/libultra_boot_O2/osViModeFpalLan1.c +++ b/src/libultra_boot_O2/osViModeFpalLan1.c @@ -1,33 +1,32 @@ #include -OSViMode osViModeFpalLan1 = -{ - 0x2C, //type - { //comRegs - 0x311E, //ctrl - 0x140, //width - 0x4541E3A, //burst - 0x271, //vSync - 0x170C69, //hSync - 0xC6F0C6D, //leap - 0x800300, //hStart - 0x200, //xScale - 0 //vCurrent +OSViMode osViModeFpalLan1 = { + 0x2C, // type + { + // comRegs + 0x311E, // ctrl + 0x140, // width + 0x4541E3A, // burst + 0x271, // vSync + 0x170C69, // hSync + 0xC6F0C6D, // leap + 0x800300, // hStart + 0x200, // xScale + 0 // vCurrent }, - { //fldRegs - { - 0x280, //origin - 0x400, //yScale - 0x2F0269, //vStart - 0x9026B, //vBurst - 2, //vIntr - }, - { - 0x280, //origin - 0x400, //yScale - 0x2F0269, //vStart - 0x9026B, //vBurst - 2 //vIntr - } - } + { // fldRegs + { + 0x280, // origin + 0x400, // yScale + 0x2F0269, // vStart + 0x9026B, // vBurst + 2, // vIntr + }, + { + 0x280, // origin + 0x400, // yScale + 0x2F0269, // vStart + 0x9026B, // vBurst + 2 // vIntr + } }, }; diff --git a/src/libultra_boot_O2/osViModeMpalLan1.c b/src/libultra_boot_O2/osViModeMpalLan1.c index 805cd450b3..7557468f82 100644 --- a/src/libultra_boot_O2/osViModeMpalLan1.c +++ b/src/libultra_boot_O2/osViModeMpalLan1.c @@ -1,33 +1,34 @@ #include -OSViMode osViModeMpalLan1 = -{ - 0x1E, //type - { //comRegs - 0x311E, //ctrl - 0x140, //width - 0x4651E39, //burst - 0x20D, //vSync - 0x40C11, //hSync - 0xC190C1A, //leap - 0x6C02EC, //hStart - 0x200, //xScale - 0, //vCurrent +OSViMode osViModeMpalLan1 = { + 0x1E, // type + { + // comRegs + 0x311E, // ctrl + 0x140, // width + 0x4651E39, // burst + 0x20D, // vSync + 0x40C11, // hSync + 0xC190C1A, // leap + 0x6C02EC, // hStart + 0x200, // xScale + 0, // vCurrent }, - { //fldRegs - { //[0] - 0x280, //origin - 0x400, //yScale - 0x2501FF, //vStart - 0xE0204, //vBurst - 2, //vIntr - }, - { //[1] - 0x280, //origin - 0x400, //yScale - 0x2501FF, //vStart - 0xE0204, //vBurst - 2, //vIntr - } - } + { // fldRegs + { + // [0] + 0x280, // origin + 0x400, // yScale + 0x2501FF, // vStart + 0xE0204, // vBurst + 2, // vIntr + }, + { + // [1] + 0x280, // origin + 0x400, // yScale + 0x2501FF, // vStart + 0xE0204, // vBurst + 2, // vIntr + } }, }; diff --git a/src/libultra_boot_O2/osViModeNtscLan1.c b/src/libultra_boot_O2/osViModeNtscLan1.c index 99573758e8..1026faae8f 100644 --- a/src/libultra_boot_O2/osViModeNtscLan1.c +++ b/src/libultra_boot_O2/osViModeNtscLan1.c @@ -1,33 +1,34 @@ #include -OSViMode osViModeNtscLan1 = -{ - 2, //type - { //comRegs - 0x311E, //ctrl - 0x140, //width - 0x3E52239, //burst - 0x20D, //vSync - 0xC15, //hSync - 0xC150C15, //leap - 0x6C02EC, //hStart - 0x200, //xScale - 0, //vCurrent +OSViMode osViModeNtscLan1 = { + 2, // type + { + // comRegs + 0x311E, // ctrl + 0x140, // width + 0x3E52239, // burst + 0x20D, // vSync + 0xC15, // hSync + 0xC150C15, // leap + 0x6C02EC, // hStart + 0x200, // xScale + 0, // vCurrent }, - { //fldRegs - { //[0] - 0x280, //origin - 0x400, //yScale - 0x2501FF, //vStart - 0xE0204, //vBurst - 2, //vIntr - }, - { //[1] - 0x280, //origin - 0x400, //yScale - 0x2501FF, //vStart - 0xE0204, //vBurst - 2, //vIntr - } - } + { // fldRegs + { + // [0] + 0x280, // origin + 0x400, // yScale + 0x2501FF, // vStart + 0xE0204, // vBurst + 2, // vIntr + }, + { + // [1] + 0x280, // origin + 0x400, // yScale + 0x2501FF, // vStart + 0xE0204, // vBurst + 2, // vIntr + } }, }; diff --git a/src/libultra_boot_O2/osViSetMode.c b/src/libultra_boot_O2/osViSetMode.c index 5d29da826e..6b7a5e21a2 100644 --- a/src/libultra_boot_O2/osViSetMode.c +++ b/src/libultra_boot_O2/osViSetMode.c @@ -1,7 +1,6 @@ #include -void osViSetMode(OSViMode *mode) -{ +void osViSetMode(OSViMode* mode) { register u32 int_disabled = __osDisableInt(); __osViNext->modep = mode; __osViNext->state = 1; diff --git a/src/libultra_boot_O2/osViSetSpecialFeatures.c b/src/libultra_boot_O2/osViSetSpecialFeatures.c index 06d040a513..ab949ba317 100644 --- a/src/libultra_boot_O2/osViSetSpecialFeatures.c +++ b/src/libultra_boot_O2/osViSetSpecialFeatures.c @@ -1,7 +1,6 @@ #include -void osViSetSpecialFeatures(u32 func) -{ +void osViSetSpecialFeatures(u32 func) { register u32 int_disabled = __osDisableInt(); if (func & OS_VI_GAMMA_ON) { __osViNext->features |= OS_VI_GAMMA; diff --git a/src/libultra_boot_O2/osViSetXScale.c b/src/libultra_boot_O2/osViSetXScale.c index 128b64c991..3c3103c462 100644 --- a/src/libultra_boot_O2/osViSetXScale.c +++ b/src/libultra_boot_O2/osViSetXScale.c @@ -1,7 +1,6 @@ #include -void osViSetXScale(f32 value) -{ +void osViSetXScale(f32 value) { register u32 nomValue; register u32 saveMask; diff --git a/src/libultra_boot_O2/osViSetYScale.c b/src/libultra_boot_O2/osViSetYScale.c index bf34f28e16..91f12fed2c 100644 --- a/src/libultra_boot_O2/osViSetYScale.c +++ b/src/libultra_boot_O2/osViSetYScale.c @@ -1,7 +1,6 @@ #include -void osViSetYScale(float scale) -{ +void osViSetYScale(float scale) { register s32 prevInt; prevInt = __osDisableInt(); diff --git a/src/libultra_boot_O2/osViSwapBuffer.c b/src/libultra_boot_O2/osViSwapBuffer.c index eb6b05d31d..c671a50f00 100644 --- a/src/libultra_boot_O2/osViSwapBuffer.c +++ b/src/libultra_boot_O2/osViSwapBuffer.c @@ -1,7 +1,6 @@ #include -void osViSwapBuffer(void *vaddr) -{ +void osViSwapBuffer(void* vaddr) { u32 int_disabled = __osDisableInt(); __osViNext->buffer = vaddr; __osViNext->state |= 0x10; // TODO: figure out what this flag means diff --git a/src/libultra_boot_O2/pimgr.c b/src/libultra_boot_O2/pimgr.c index c15d7b9194..581f66f480 100644 --- a/src/libultra_boot_O2/pimgr.c +++ b/src/libultra_boot_O2/pimgr.c @@ -1,6 +1,6 @@ #include -OSMgrArgs __osPiDevMgr = {0}; +OSMgrArgs __osPiDevMgr = { 0 }; OSPiHandle __Dom1SpeedParam; OSPiHandle __Dom2SpeedParam; @@ -11,31 +11,27 @@ OSMesg piEventBuf[2]; OSThread __osThreadSave; OSPiHandle* __osPiTable = NULL; -OSPiHandle* __osCurrentHandle[] = -{ +OSPiHandle* __osCurrentHandle[] = { &__Dom1SpeedParam, &__Dom2SpeedParam, }; - -void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt) -{ +void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt) { u32 int_disabled; OSPri newPri; OSPri currentPri; - if (!__osPiDevMgr.initialized) - { + if (!__osPiDevMgr.initialized) { osCreateMesgQueue(cmdQ, cmdBuf, cmdMsgCnt); osCreateMesgQueue(&piEventQueue, piEventBuf, 1); - if (!__osPiAccessQueueEnabled) + if (!__osPiAccessQueueEnabled) { __osPiCreateAccessQueue(); + } osSetEventMesg(OS_EVENT_PI, &piEventQueue, (OSMesg)0x22222222); newPri = -1; currentPri = osGetThreadPri(NULL); - if (currentPri < pri) - { + if (currentPri < pri) { newPri = currentPri; osSetThreadPri(NULL, pri); } @@ -49,12 +45,13 @@ void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgC __osPiDevMgr.piDmaCallback = __osPiRawStartDma; __osPiDevMgr.epiDmaCallback = __osEPiRawStartDma; - osCreateThread(&piThread, 0, __osDevMgrMain, (void *)&__osPiDevMgr, piStackThread + sizeof(piStackThread), pri); + osCreateThread(&piThread, 0, __osDevMgrMain, (void*)&__osPiDevMgr, piStackThread + sizeof(piStackThread), pri); osStartThread(&piThread); __osRestoreInt(int_disabled); - if (newPri != -1) + if (newPri != -1) { osSetThreadPri(NULL, newPri); + } } } diff --git a/src/libultra_boot_O2/sprintf.c b/src/libultra_boot_O2/sprintf.c index 58510a35c2..2ff0b33e06 100644 --- a/src/libultra_boot_O2/sprintf.c +++ b/src/libultra_boot_O2/sprintf.c @@ -1,26 +1,25 @@ #include -char* proutSprintf(char* dst, const char *fmt, size_t size) -{ +char* proutSprintf(char* dst, const char* fmt, size_t size) { return (char*)memcpy(dst, fmt, size) + size; } -s32 vsprintf(char* dst, const char* fmt, va_list args) -{ +s32 vsprintf(char* dst, const char* fmt, va_list args) { s32 ret = _Printf(&proutSprintf, dst, fmt, args); - if (ret > -1) + if (ret > -1) { dst[ret] = 0; + } return ret; } -s32 sprintf(char* dst, const char* fmt, ...) -{ +s32 sprintf(char* dst, const char* fmt, ...) { s32 ret; va_list args; va_start(args, fmt); ret = _Printf(&proutSprintf, dst, fmt, args); - if (ret > -1) + if (ret > -1) { dst[ret] = 0; + } return ret; } diff --git a/src/libultra_boot_O2/string.c b/src/libultra_boot_O2/string.c index 771caf1a3d..529ba37d8f 100644 --- a/src/libultra_boot_O2/string.c +++ b/src/libultra_boot_O2/string.c @@ -1,33 +1,30 @@ #include -const u8 *strchr(const u8 *str, s32 ch) -{ +const u8* strchr(const u8* str, s32 ch) { u8 c = ch; - while (*str != c) - { - if (*str == 0) + while (*str != c) { + if (*str == 0) { return NULL; + } str++; } return str; } -size_t strlen(const u8 *str) -{ - const u8 *ptr = str; - while (*ptr) +size_t strlen(const u8* str) { + const u8* ptr = str; + while (*ptr) { ptr++; + } return ptr - str; } -void *memcpy(void *dst, const void *src, size_t size) -{ - u8 *_dst = dst; - const u8 *_src = src; - while (size > 0) - { +void* memcpy(void* dst, const void* src, size_t size) { + u8* _dst = dst; + const u8* _src = src; + while (size > 0) { *_dst++ = *_src++; size--; } return dst; -} \ No newline at end of file +} diff --git a/src/libultra_boot_O2/vimgr.c b/src/libultra_boot_O2/vimgr.c index de54494f99..d2839078ef 100644 --- a/src/libultra_boot_O2/vimgr.c +++ b/src/libultra_boot_O2/vimgr.c @@ -1,7 +1,6 @@ #include -typedef struct -{ +typedef struct { u16 unk00; u8 unk02; u32 unk04; @@ -16,18 +15,16 @@ OSMesgQueue viEventQueue; OSMesg viEventBuf[6]; viMesgStruct viRetraceMsg; viMesgStruct viCounterMsg; -OSMgrArgs __osViDevMgr = {0}; +OSMgrArgs __osViDevMgr = { 0 }; u32 __additional_scanline = 0; void viMgrMain(void*); -void osCreateViManager(OSPri pri) -{ +void osCreateViManager(OSPri pri) { u32 int_disabled; OSPri newPri; OSPri currentPri; - if (!__osViDevMgr.initialized) - { + if (!__osViDevMgr.initialized) { __osTimerServicesInit(); __additional_scanline = 0; osCreateMesgQueue(&viEventQueue, viEventBuf, 5); @@ -41,8 +38,7 @@ void osCreateViManager(OSPri pri) osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg); newPri = -1; currentPri = osGetThreadPri(NULL); - if (currentPri < pri) - { + if (currentPri < pri) { newPri = currentPri; osSetThreadPri(NULL, pri); } @@ -56,19 +52,17 @@ void osCreateViManager(OSPri pri) __osViDevMgr.piDmaCallback = NULL; __osViDevMgr.epiDmaCallback = NULL; - osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, viThreadStack+sizeof(viThreadStack), pri); + osCreateThread(&viThread, 0, &viMgrMain, &__osViDevMgr, viThreadStack + sizeof(viThreadStack), pri); __osViInit(); osStartThread(&viThread); __osRestoreInt(int_disabled); - if (newPri != -1) - { + if (newPri != -1) { osSetThreadPri(NULL, newPri); } } } -void viMgrMain(void* vargs) -{ +void viMgrMain(void* vargs) { OSMgrArgs* args; static u16 viRetrace; u32 addTime; @@ -77,49 +71,47 @@ void viMgrMain(void* vargs) temp = 0; mesg = NULL; - viRetrace = __osViGetCurrentContext()->retraceCount; - if (viRetrace == 0) + viRetrace = __osViGetCurrentContext()->retraceCount; + if (viRetrace == 0) { viRetrace = 1; + } args = (OSMgrArgs*)vargs; - while (1) - { + while (1) { osRecvMesg(args->eventQueue, (OSMesg)&mesg, OS_MESG_BLOCK); - switch (mesg->unk00) - { - case 13: - __osViSwapContext(); - viRetrace--; - if (!viRetrace) - { - OSViContext* ctx = __osViGetCurrentContext(); - if (ctx->mq) - osSendMesg(ctx->mq, ctx->msg, OS_MESG_NOBLOCK); - viRetrace = ctx->retraceCount; - } + switch (mesg->unk00) { + case 13: + __osViSwapContext(); + viRetrace--; + if (!viRetrace) { + OSViContext* ctx = __osViGetCurrentContext(); + if (ctx->mq) { + osSendMesg(ctx->mq, ctx->msg, OS_MESG_NOBLOCK); + } + viRetrace = ctx->retraceCount; + } - __osViIntrCount++; + __osViIntrCount++; - // block optimized out since temp is always 0, - // but it changes register allocation and ordering for __osCurrentTime - if (temp != 0) - { - addTime = osGetCount(); - __osCurrentTime = addTime; - temp = 0; - } + // block optimized out since temp is always 0, + // but it changes register allocation and ordering for __osCurrentTime + if (temp != 0) { + addTime = osGetCount(); + __osCurrentTime = addTime; + temp = 0; + } - addTime = __osBaseCounter; - __osBaseCounter = osGetCount(); - addTime = __osBaseCounter - addTime; - __osCurrentTime = __osCurrentTime + addTime; + addTime = __osBaseCounter; + __osBaseCounter = osGetCount(); + addTime = __osBaseCounter - addTime; + __osCurrentTime = __osCurrentTime + addTime; - break; + break; - case 14: - __osTimerInterrupt(); - break; + case 14: + __osTimerInterrupt(); + break; } } } diff --git a/src/libultra_code/__osSiCreateAccessQueue.c b/src/libultra_code/__osSiCreateAccessQueue.c index e2d0c8e337..b1ed321afc 100644 --- a/src/libultra_code/__osSiCreateAccessQueue.c +++ b/src/libultra_code/__osSiCreateAccessQueue.c @@ -7,13 +7,13 @@ OSMesg osSiMesgBuff[SIAccessQueueSize]; OSMesgQueue gOsSiMessageQueue; u32 gOsSiAccessQueueCreated = 0; -void __osSiCreateAccessQueue() { //func_80100B50 +void __osSiCreateAccessQueue() { gOsSiAccessQueueCreated = 1; osCreateMesgQueue(&gOsSiMessageQueue, &osSiMesgBuff[0], SIAccessQueueSize - 1); osSendMesg(&gOsSiMessageQueue, NULL, OS_MESG_NOBLOCK); } -void __osSiGetAccess() { //func_80100BA0 +void __osSiGetAccess() { OSMesg sp1c; if (!gOsSiAccessQueueCreated) { __osSiCreateAccessQueue(); @@ -21,6 +21,6 @@ void __osSiGetAccess() { //func_80100BA0 osRecvMesg(&gOsSiMessageQueue, &sp1c, OS_MESG_BLOCK); } -void __osSiRelAccess() { //func_80100BE4 +void __osSiRelAccess() { osSendMesg(&gOsSiMessageQueue, NULL, OS_MESG_NOBLOCK); } diff --git a/src/libultra_code/__osSiRawStartDma.c b/src/libultra_code/__osSiRawStartDma.c index 537a0fba2f..d440366575 100644 --- a/src/libultra_code/__osSiRawStartDma.c +++ b/src/libultra_code/__osSiRawStartDma.c @@ -1,21 +1,20 @@ #include "libultra_internal.h" #include -s32 __osSiRawStartDma(s32 dir, void *addr) //func_801013F0 -{ - if (HW_REG(SI_STATUS_REG, u32) & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)){ +s32 __osSiRawStartDma(s32 dir, void* addr) { + if (HW_REG(SI_STATUS_REG, u32) & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)) { return -1; } - if (dir == OS_WRITE){ + if (dir == OS_WRITE) { osWritebackDCache(addr, 0x40); } HW_REG(SI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(addr); - if (dir == OS_READ){ + if (dir == OS_READ) { HW_REG(SI_PIF_ADDR_RD64B_REG, void*) = (void*)PIF_RAM_START; - }else{ + } else { HW_REG(SI_PIF_ADDR_WR64B_REG, void*) = (void*)PIF_RAM_START; } - if (dir == OS_READ){ + if (dir == OS_READ) { osInvalDCache(addr, 0x40); } return 0; diff --git a/src/libultra_code/__osSpGetStatus.c b/src/libultra_code/__osSpGetStatus.c index 61b5053b24..cd68e408c7 100644 --- a/src/libultra_code/__osSpGetStatus.c +++ b/src/libultra_code/__osSpGetStatus.c @@ -2,7 +2,6 @@ #include #include -u32 __osSpGetStatus() -{ +u32 __osSpGetStatus() { return HW_REG(SP_STATUS_REG, u32); } diff --git a/src/libultra_code/__osSpSetStatus.c b/src/libultra_code/__osSpSetStatus.c index 3bd9c84d3c..01cf1adc1a 100644 --- a/src/libultra_code/__osSpSetStatus.c +++ b/src/libultra_code/__osSpSetStatus.c @@ -2,7 +2,6 @@ #include #include -void __osSpSetStatus(u32 a0) -{ +void __osSpSetStatus(u32 a0) { HW_REG(SP_STATUS_REG, u32) = a0; } diff --git a/src/libultra_code/code_80101B40.c.ignore b/src/libultra_code/code_80101B40.c.ignore index f0780cb743..908f84f9ef 100644 --- a/src/libultra_code/code_80101B40.c.ignore +++ b/src/libultra_code/code_80101B40.c.ignore @@ -1,8 +1,7 @@ #include #include -void func_80101B40(u32* a0) -{ +void func_80101B40(u32* a0) { a0[0] = 0x3F800000; // Float? a0[1] = 0; a0[2] = 0; diff --git a/src/libultra_code/code_80103B30.c b/src/libultra_code/code_80103B30.c index 2e17bf58d8..5137e4e26c 100644 --- a/src/libultra_code/code_80103B30.c +++ b/src/libultra_code/code_80103B30.c @@ -2,14 +2,14 @@ #include #include -u32 func_80103B30() -{ +u32 func_80103B30() { register u32 status; status = HW_REG(SP_STATUS_REG, u32); - if (status & 0x1C) + if (status & 0x1C) { return 1; + } return 0; } diff --git a/src/libultra_code/code_80104140.c b/src/libultra_code/code_80104140.c index c2ccd0c8d0..aa9fed857e 100644 --- a/src/libultra_code/code_80104140.c +++ b/src/libultra_code/code_80104140.c @@ -1,6 +1,5 @@ #include -OSThread* func_80104140() -{ +OSThread* func_80104140() { return __osActiveQueue; } diff --git a/src/libultra_code/code_801064C0.c b/src/libultra_code/code_801064C0.c index 04eafa5d8b..23b73d853e 100644 --- a/src/libultra_code/code_801064C0.c +++ b/src/libultra_code/code_801064C0.c @@ -1,7 +1,6 @@ #include #include -OSThread* __osGetCurrFaultedThread() -{ +OSThread* __osGetCurrFaultedThread() { return __osFaultedThread; } diff --git a/src/libultra_code/code_80106760.c b/src/libultra_code/code_80106760.c index e6626dfb34..e9f44fd633 100644 --- a/src/libultra_code/code_80106760.c +++ b/src/libultra_code/code_80106760.c @@ -1,8 +1,7 @@ #include #include -u32* func_80106760() -{ +u32* func_80106760() { register u32 sMask = __osDisableInt(); u32* var1; diff --git a/src/libultra_code/code_801067A0.c b/src/libultra_code/code_801067A0.c index 2257881abb..0ea5f968cd 100644 --- a/src/libultra_code/code_801067A0.c +++ b/src/libultra_code/code_801067A0.c @@ -2,14 +2,14 @@ #include #include -s32 func_801067A0(u32 a0) -{ +s32 func_801067A0(u32 a0) { register u32 spStatus; spStatus = HW_REG(SP_STATUS_REG, u32); - if (!(spStatus & SP_STATUS_HALT)) + if (!(spStatus & SP_STATUS_HALT)) { return -1; + } HW_REG(SP_PC_REG, u32) = a0; diff --git a/src/libultra_code/guPerspectiveF.c b/src/libultra_code/guPerspectiveF.c index caef68560f..503bcc25a4 100644 --- a/src/libultra_code/guPerspectiveF.c +++ b/src/libultra_code/guPerspectiveF.c @@ -1,7 +1,6 @@ #include "libultra_internal.h" -void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, - float scale) { +void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { float yscale; int row; int col; @@ -23,14 +22,14 @@ void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, fl if (near + far <= 2.0) { *perspNorm = 65535; } else { - *perspNorm = (double) (1 << 17) / (near + far); - if (*perspNorm <= 0) + *perspNorm = (double)(1 << 17) / (near + far); + if (*perspNorm <= 0) { *perspNorm = 1; + } } } } -void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near, float far, - float scale) { +void guPerspective(Mtx* m, u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { float mat[4][4]; guPerspectiveF(mat, perspNorm, fovy, aspect, near, far, scale); guMtxF2L(mat, m); diff --git a/src/libultra_code/osContInit.c b/src/libultra_code/osContInit.c index dcccfb765c..33cc136b8f 100644 --- a/src/libultra_code/osContInit.c +++ b/src/libultra_code/osContInit.c @@ -5,19 +5,19 @@ pif_data_buffer_t _osPifInternalBuff; u8 _osCont_lastPollType; -u8 _osCont_numControllers; //always 4 +u8 _osCont_numControllers; // always 4 -//Not sure if the following is a struct together with the last two variables +// Not sure if the following is a struct together with the last two variables u16 unk_80175812; u32 unk_80175814; -u8 unk_80175818[0x20]; +u8 unk_80175818[0x20]; u32 gOsContInitialized = 0; OSMesgQueue _osContMesgQueue; OSMesg _osContMesgBuff[4]; #define HALF_SECOND OS_USEC_TO_CYCLES(500000) -s32 osContInit(OSMesgQueue *mq, u8 *ctl_present_bitfield, OSContStatus *status) { //func_80100C10 +s32 osContInit(OSMesgQueue* mq, u8* ctl_present_bitfield, OSContStatus* status) { OSMesg mesg; s32 ret = 0; OSTime currentTime; @@ -47,8 +47,8 @@ s32 osContInit(OSMesgQueue *mq, u8 *ctl_present_bitfield, OSContStatus *status) return ret; } -void __osContGetInitData(u8 *ctl_present_bitfield, OSContStatus *status) { //func_80100D6C - PIF_IO_slot_t *slot_ptr; +void __osContGetInitData(u8* ctl_present_bitfield, OSContStatus* status) { + PIF_IO_slot_t* slot_ptr; PIF_IO_slot_t slot; s32 i; u8 bitfield_temp; @@ -66,11 +66,11 @@ void __osContGetInitData(u8 *ctl_present_bitfield, OSContStatus *status) { //fun *ctl_present_bitfield = bitfield_temp; } -void __osPackRequestData(u8 command) { //func_80100E18 - PIF_IO_slot_t *slot_ptr; +void __osPackRequestData(u8 command) { + PIF_IO_slot_t* slot_ptr; PIF_IO_slot_t slot; s32 i; - for(i = 0; i < 0xF; i++) { + for (i = 0; i < 0xF; i++) { _osPifInternalBuff.words[i] = 0; } _osPifInternalBuff.status_control = 1; diff --git a/src/libultra_code/osContStartReadData.c b/src/libultra_code/osContStartReadData.c index a96bc6f288..9bd0bfbd23 100644 --- a/src/libultra_code/osContStartReadData.c +++ b/src/libultra_code/osContStartReadData.c @@ -3,12 +3,10 @@ #include -s32 osContStartReadData(OSMesgQueue *mq) //func_80100EF0 -{ +s32 osContStartReadData(OSMesgQueue* mq) { s32 ret; - __osSiGetAccess(); //__osSiGetAccess - if (_osCont_lastPollType != 1) - { + __osSiGetAccess(); // __osSiGetAccess + if (_osCont_lastPollType != 1) { __osPackReadData(); __osSiRawStartDma(OS_WRITE, &_osPifInternalBuff); osRecvMesg(mq, NULL, OS_MESG_BLOCK); @@ -19,8 +17,8 @@ s32 osContStartReadData(OSMesgQueue *mq) //func_80100EF0 return ret; } -void osContGetReadData(OSContPad *pad) { //func_80100F74 - PIF_IO_slot_t *slot_ptr; +void osContGetReadData(OSContPad* pad) { + PIF_IO_slot_t* slot_ptr; PIF_IO_slot_t slot; s32 i; slot_ptr = _osPifInternalBuff.slots; @@ -35,12 +33,12 @@ void osContGetReadData(OSContPad *pad) { //func_80100F74 }; } -void __osPackReadData() { //func_80101000 - PIF_IO_slot_t *slot_ptr; +void __osPackReadData() { + PIF_IO_slot_t* slot_ptr; PIF_IO_slot_t slot; s32 i; slot_ptr = _osPifInternalBuff.slots; - for(i = 0; i < 0xF; i++) { + for (i = 0; i < 0xF; i++) { _osPifInternalBuff.words[i] = 0; } _osPifInternalBuff.status_control = 1; @@ -51,7 +49,7 @@ void __osPackReadData() { //func_80101000 slot.button = 0xFFFF; slot.rawStickX = 0xFF; slot.rawStickY = 0xFF; - for(i = 0; i < _osCont_numControllers; i++) { + for (i = 0; i < _osCont_numControllers; i++) { *slot_ptr++ = slot; } slot_ptr->hdr.slot_type = 0xFE; diff --git a/src/libultra_code/osDpGetStatus.c b/src/libultra_code/osDpGetStatus.c index 636bdd2f96..f9c87f1fb2 100644 --- a/src/libultra_code/osDpGetStatus.c +++ b/src/libultra_code/osDpGetStatus.c @@ -1,6 +1,5 @@ #include -u32 osDpGetStatus(void) -{ +u32 osDpGetStatus(void) { return DPC_STATUS_REG; } diff --git a/src/libultra_code/osDpSetStatus.c b/src/libultra_code/osDpSetStatus.c index 9a5f189a55..d57ca509e3 100644 --- a/src/libultra_code/osDpSetStatus.c +++ b/src/libultra_code/osDpSetStatus.c @@ -1,6 +1,5 @@ #include -void osDpSetStatus(u32 status) -{ +void osDpSetStatus(u32 status) { DPC_STATUS_REG = status; } diff --git a/src/libultra_code/osVibrationPack.c b/src/libultra_code/osVibrationPack.c index b00f25de80..033f04500e 100644 --- a/src/libultra_code/osVibrationPack.c +++ b/src/libultra_code/osVibrationPack.c @@ -5,25 +5,24 @@ pif_data_buffer_t osPifBuffers[4]; -//func_800CF990 in 1.0 -s32 osSetVibration(unk_controller_t *arg0, u32 vibrate) //func_80100780 -{ +// func_800CF990 in 1.0 +s32 osSetVibration(unk_controller_t* arg0, u32 vibrate) { s32 i; s32 ret; - u8 *buf; - + u8* buf; + buf = (u8*)&osPifBuffers[arg0->ctrlridx]; - if (!(arg0->unk0 & 8)){ + if (!(arg0->unk0 & 8)) { return 5; } __osSiGetAccess(); osPifBuffers[arg0->ctrlridx].status_control = 1; buf += arg0->ctrlridx; - for(i=0; i<0x20; i++){ - ((PIF_mempak_wr_t*)buf)->data[i+2] = vibrate; + for (i = 0; i < 0x20; i++) { + ((PIF_mempak_wr_t*)buf)->data[i + 2] = vibrate; } - - _osCont_lastPollType = (u8)0xfe; //last controller poll type? + + _osCont_lastPollType = (u8)0xfe; // last controller poll type? __osSiRawStartDma(OS_WRITE, &osPifBuffers[arg0->ctrlridx]); osRecvMesg(arg0->ctrlrqueue, NULL, OS_MESG_BLOCK); __osSiRawStartDma(OS_READ, &osPifBuffers[arg0->ctrlridx]); @@ -31,11 +30,11 @@ s32 osSetVibration(unk_controller_t *arg0, u32 vibrate) //func_80100780 ret = ((PIF_mempak_wr_t*)buf)->hdr.status_hi_bytes_rec_lo & 0xc0; if (!ret) { if (!vibrate) { - if (((PIF_mempak_wr_t*)buf)->data[0x22] != 0){ + if (((PIF_mempak_wr_t*)buf)->data[0x22] != 0) { ret = 4; } - }else{ - if (((PIF_mempak_wr_t*)buf)->data[0x22] != 0xeb){ + } else { + if (((PIF_mempak_wr_t*)buf)->data[0x22] != 0xeb) { ret = 4; } } @@ -44,19 +43,18 @@ s32 osSetVibration(unk_controller_t *arg0, u32 vibrate) //func_80100780 return ret; } -void osSetUpMempakWrite(s32 ctrlridx, pif_data_buffer_t* buf) //func_801009F4 -{ +void osSetUpMempakWrite(s32 ctrlridx, pif_data_buffer_t* buf) { u8* buf_ptr = (u8*)buf; PIF_mempak_wr_t mempakwr; s32 i; mempakwr.hdr.slot_type = 0xFF; mempakwr.hdr.bytes_send = 0x23; mempakwr.hdr.status_hi_bytes_rec_lo = 1; - mempakwr.hdr.command = 3; //write mempak + mempakwr.hdr.command = 3; // write mempak mempakwr.data[0] = 0xC0; - mempakwr.data[1] = (u8)(func_80106170(0x600) | 0xC000); //yes, this is correct - if(ctrlridx != 0){ - for(i=0; ictrlrqueue = ctrlrqueue; unk_controller->ctrlridx = ctrlridx; unk_controller->bytes[0x65] = (u8)0xff; unk_controller->unk0 = 0; - + ret = func_80104C80(unk_controller, 0xfe); - if (ret == 2){ + if (ret == 2) { ret = func_80104C80(unk_controller, 0x80); } - if (ret != 0){ + if (ret != 0) { return ret; } ret = func_80105F40(ctrlrqueue, ctrlridx, 0x400, &sp24); ret = ret; - if (ret == 2){ + if (ret == 2) { ret = 4; //"Controller pack communication error" } - if (ret != 0){ + if (ret != 0) { return ret; } - if (sp24.unk[0x1F] == 0xfe){ - return 0xb; //possibly controller pack? (Some other valid return value other than vibration pack) + if (sp24.unk[0x1F] == 0xfe) { + return 0xb; // possibly controller pack? (Some other valid return value other than vibration pack) } ret = func_80104C80(unk_controller, 0x80); - if (ret == 2){ + if (ret == 2) { ret = 4; //"Controller pack communication error" } - if (ret != 0){ + if (ret != 0) { return ret; } ret = func_80105F40(ctrlrqueue, ctrlridx, 0x400, &sp24); - if (ret == 2){ + if (ret == 2) { ret = 4; //"Controller pack communication error" } - if (ret != 0){ + if (ret != 0) { return ret; } - if (sp24.unk[0x1F] != 0x80){ - return 0xb; //possibly controller pack? (Some other valid return value other than vibration pack) + if (sp24.unk[0x1F] != 0x80) { + return 0xb; // possibly controller pack? (Some other valid return value other than vibration pack) } - if ((unk_controller->unk0 & 8) == 0){ + if ((unk_controller->unk0 & 8) == 0) { osSetUpMempakWrite(ctrlridx, &osPifBuffers[ctrlridx]); } unk_controller->unk0 = 8; return 0; //"Recognized vibration pack" } - diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index d81d0c84f7..bf24cb9702 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -1,6 +1,6 @@ #include "z_arms_hook.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void ArmsHook_Init(ArmsHook* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 5bf11cac9f..436e0fd78d 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -1,6 +1,6 @@ #include "z_arrow_fire.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void ArrowFire_Init(ArrowFire* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 466249a739..dcd9b8aca8 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -1,6 +1,6 @@ #include "z_arrow_ice.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void ArrowIce_Init(ArrowIce* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index cd1734d25c..255088a17c 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -1,6 +1,6 @@ #include "z_arrow_light.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void ArrowLight_Init(ArrowLight* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index f1b5366cb8..f288e6ae7e 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -1,6 +1,6 @@ #include "z_bg_bdan_objects.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgBdanObjects_Init(BgBdanObjects* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index 4a9005cac6..bd6bcb48b7 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -2,29 +2,26 @@ * File: z_bg_bdan_switch.c * Overlay: Bg_Bdan_Switch * Description: Switches (Inside Lord Jabu-Jabu) -*/ + */ #include #include // BgBdanSwitch.actor.params & 0xFF -typedef enum -{ - BLUE, - YELLOW_HEAVY, - YELLOW, - YELLOW_TALL_1, - YELLOW_TALL_2 +typedef enum { + /* 0x00 */ BLUE, + /* 0x01 */ YELLOW_HEAVY, + /* 0x02 */ YELLOW, + /* 0x03 */ YELLOW_TALL_1, + /* 0x04 */ YELLOW_TALL_2 } BgBdanSwitchType; -typedef struct -{ +typedef struct { /* 0x00 */ char unk_00[0x2E]; /* 0x2E */ s16 unk_2E; } ColliderCustomHelper; -typedef struct -{ +typedef struct { /* 0x00 */ Collider base; /* 0x18 */ char unk_18[0x4]; /* 0x1C */ ColliderCustomHelper* unk_1C; @@ -37,8 +34,7 @@ typedef struct /* 0x46 */ Vec3s position; } ColliderCustomMain; // size = 0x4C -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ u32 dynaPolyId; /* 0x0150 */ f32 unk_150; @@ -60,7 +56,7 @@ typedef struct /* 0x01DD */ char unk_1DD[0x3]; } BgBdanSwitch; // size = 0x01E0 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void BgBdanSwitch_Init(BgBdanSwitch* this, GlobalContext* globalCtx); @@ -96,8 +92,7 @@ static void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx); static void func_8086DDA8(BgBdanSwitch* this); static void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx); -const ActorInit Bg_Bdan_Switch_InitVars = -{ +const ActorInit Bg_Bdan_Switch_InitVars = { ACTOR_BG_BDAN_SWITCH, ACTORTYPE_SWITCH, ROOM, @@ -114,30 +109,20 @@ extern UNK_PTR D_06005CF8; extern UNK_PTR D_060061A0; extern UNK_PTR D_06005A20; -static u32 D_8086E0A0[] = -{ - 0x00000000, 0x00000000, 0x00000000, 0xEFC1FFFE, 0x00000000, 0x00010100, 0x00000000, 0x00780000, 0x01720064 -}; +static u32 D_8086E0A0[] = { 0x00000000, 0x00000000, 0x00000000, 0xEFC1FFFE, 0x00000000, + 0x00010100, 0x00000000, 0x00780000, 0x01720064 }; -static u32 D_8086E0C4[] = -{ - 0x0A000939, 0x20000000, 0x00000001, &D_8086E0A0 -}; +static u32 D_8086E0C4[] = { 0x0A000939, 0x20000000, 0x00000001, &D_8086E0A0 }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_F32(unk_F4, 1400, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 500, ICHAIN_CONTINUE), - ICHAIN_F32(unk_FC, 1200, ICHAIN_STOP) + ICHAIN_F32(unk_FC, 1200, ICHAIN_STOP), }; -static u32 D_8086E0E0[] = -{ - 0x00000000, 0x430C0000, 0x00000000, 0x00000000 -}; +static u32 D_8086E0E0[] = { 0x00000000, 0x430C0000, 0x00000000, 0x00000000 }; -static void func_8086D010(BgBdanSwitch* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) -{ +static void func_8086D010(BgBdanSwitch* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) { s16 pad1; u32 local_c = 0; s16 pad2; @@ -145,32 +130,26 @@ static void func_8086D010(BgBdanSwitch* this, GlobalContext* globalCtx, u32 coll DynaPolyInfo_SetActorMove(&this->actor, flag); DynaPolyInfo_Alloc(collision, &local_c); this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, local_c); - if (this->dynaPolyId == 0x32) - { - osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, this->actor.id, this->actor.params); + if (this->dynaPolyId == 0x32) { + osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_bdan_switch.c", 325, + this->actor.id, this->actor.params); } } -static void func_8086D098(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void func_8086D098(BgBdanSwitch* this, GlobalContext* globalCtx) { Actor* actor = &this->actor; func_8005BBF8(globalCtx, &this->collider, actor); func_8005C050(globalCtx, &this->collider, actor, &D_8086E0C4, &this->collider.unk_20); } -static void func_8086D0EC(BgBdanSwitch* this) -{ - if (this->unk_1CC > 0) - { +static void func_8086D0EC(BgBdanSwitch* this) { + if (this->unk_1CC > 0) { this->unk_1CC += 0x5DC; - } - else - { + } else { this->unk_1CC += 0xFA0; } - switch (this->actor.params & 0xFF) - { + switch (this->actor.params & 0xFF) { case BLUE: case YELLOW_HEAVY: case YELLOW: @@ -187,29 +166,24 @@ static void func_8086D0EC(BgBdanSwitch* this) this->actor.shape.unk_08 = 1.2f / this->unk_1D0; } -static void BgBdanSwitch_Init(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void BgBdanSwitch_Init(BgBdanSwitch* this, GlobalContext* globalCtx) { s32 pad[2]; s16 type; s32 flag; - + type = this->actor.params & 0xFF; Actor_ProcessInitChain(&this->actor, initChain); - if (type == YELLOW_TALL_1 || type == YELLOW_TALL_2) - { + if (type == YELLOW_TALL_1 || type == YELLOW_TALL_2) { this->actor.scale.z = 0.05f; this->actor.scale.x = 0.05f; - } - else - { + } else { this->actor.scale.z = 0.1f; this->actor.scale.x = 0.1f; } this->actor.scale.y = 0.0f; Actor_SetHeight(&this->actor, 10.0f); - switch (type) - { + switch (type) { case BLUE: case YELLOW_HEAVY: case YELLOW: @@ -224,37 +198,27 @@ static void BgBdanSwitch_Init(BgBdanSwitch* this, GlobalContext* globalCtx) flag = Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); - switch (type) - { + switch (type) { case BLUE: case YELLOW: - if (flag) - { + if (flag) { func_8086D730(this); - } - else - { + } else { func_8086D5C4(this); } break; case YELLOW_HEAVY: - if (flag) - { + if (flag) { func_8086DB24(this); - } - else - { + } else { func_8086D86C(this); } break; case YELLOW_TALL_1: case YELLOW_TALL_2: - if (flag) - { + if (flag) { func_8086DCCC(this); - } - else - { + } else { func_8086DB4C(this); } break; @@ -266,10 +230,8 @@ static void BgBdanSwitch_Init(BgBdanSwitch* this, GlobalContext* globalCtx) osSyncPrintf("(巨大魚ダンジョン 専用スイッチ)(arg_data 0x%04x)\n", this->actor.params); } -static void BgBdanSwitch_Destroy(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - switch(this->actor.params & 0xFF) - { +static void BgBdanSwitch_Destroy(BgBdanSwitch* this, GlobalContext* globalCtx) { + switch (this->actor.params & 0xFF) { case BLUE: case YELLOW_HEAVY: case YELLOW: @@ -281,76 +243,59 @@ static void BgBdanSwitch_Destroy(BgBdanSwitch* this, GlobalContext* globalCtx) } } -static void func_8086D4B4(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void func_8086D4B4(BgBdanSwitch* this, GlobalContext* globalCtx) { s32 pad; s32 type; - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) - { + if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { type = this->actor.params & 0xFF; Flags_SetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); - if (type == BLUE || type == YELLOW_TALL_2) - { + if (type == BLUE || type == YELLOW_TALL_2) { func_800806BC(globalCtx, &this->actor, 0x4807); - } - else - { + } else { func_800806BC(globalCtx, &this->actor, 0x4802); } } } -static void func_8086D548(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) - { +static void func_8086D548(BgBdanSwitch* this, GlobalContext* globalCtx) { + if (Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { Flags_UnsetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F); - if ((this->actor.params & 0xFF) == YELLOW_TALL_2) - { + if ((this->actor.params & 0xFF) == YELLOW_TALL_2) { func_800806BC(globalCtx, &this->actor, 0x4807); } } } -static void func_8086D5C4(BgBdanSwitch* this) -{ +static void func_8086D5C4(BgBdanSwitch* this) { this->updateFunc = &func_8086D5E0; this->unk_1C8 = 1.0f; } -static void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - switch (this->actor.params & 0xFF) - { +static void func_8086D5E0(BgBdanSwitch* this, GlobalContext* globalCtx) { + switch (this->actor.params & 0xFF) { case BLUE: - if (func_800435B4(&this->actor)) - { + if (func_800435B4(&this->actor)) { func_8086D67C(this); func_8086D4B4(this, globalCtx); } break; case YELLOW: - if (func_8004356C(&this->actor)) - { + if (func_8004356C(&this->actor)) { func_8086D67C(this); func_8086D4B4(this, globalCtx); } } } -static void func_8086D67C(BgBdanSwitch* this) -{ +static void func_8086D67C(BgBdanSwitch* this) { this->updateFunc = &func_8086D694; this->unk_1DA = 0x64; } -static void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - if ((func_8005B198() == this->actor.type) || (this->unk_1DA <= 0)) - { +static void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) { + if ((func_8005B198() == this->actor.type) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; - if (this->unk_1C8 <= 0.1f) - { + if (this->unk_1C8 <= 0.1f) { func_8086D730(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); func_800AA000(this->actor.waterSurfaceDist, 0x78, 0x14, 0xA); @@ -358,97 +303,76 @@ static void func_8086D694(BgBdanSwitch* this, GlobalContext* globalCtx) } } -static void func_8086D730(BgBdanSwitch* this) -{ +static void func_8086D730(BgBdanSwitch* this) { this->unk_1C8 = 0.1f; this->updateFunc = &func_8086D754; this->unk_1D8 = 6; } -static void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - switch (this->actor.params & 0xFF) - { +static void func_8086D754(BgBdanSwitch* this, GlobalContext* globalCtx) { + switch (this->actor.params & 0xFF) { case BLUE: - if (!func_800435B4(&this->actor)) - { - if (this->unk_1D8 <= 0) - { + if (!func_800435B4(&this->actor)) { + if (this->unk_1D8 <= 0) { func_8086D7FC(this); func_8086D548(this, globalCtx); } - } - else - { + } else { this->unk_1D8 = 6; } break; case YELLOW: - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) - { + if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { func_8086D7FC(this); } } } -static void func_8086D7FC(BgBdanSwitch* this) -{ +static void func_8086D7FC(BgBdanSwitch* this) { this->updateFunc = &func_8086D80C; } -static void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void func_8086D80C(BgBdanSwitch* this, GlobalContext* globalCtx) { this->unk_1C8 += 0.2f; - if (this->unk_1C8 >= 1.0f) - { + if (this->unk_1C8 >= 1.0f) { func_8086D5C4(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); } } -static void func_8086D86C(BgBdanSwitch* this) -{ +static void func_8086D86C(BgBdanSwitch* this) { this->updateFunc = &func_8086D888; this->unk_1C8 = 1.0f; } -static void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - if (func_8004356C(&this->actor)) - { +static void func_8086D888(BgBdanSwitch* this, GlobalContext* globalCtx) { + if (func_8004356C(&this->actor)) { func_8086D8BC(this); } } -static void func_8086D8BC(BgBdanSwitch* this) -{ +static void func_8086D8BC(BgBdanSwitch* this) { this->updateFunc = &func_8086D8CC; } -static void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void func_8086D8CC(BgBdanSwitch* this, GlobalContext* globalCtx) { this->unk_1C8 -= 0.2f; - if (this->unk_1C8 <= 0.6f) - { + if (this->unk_1C8 <= 0.6f) { func_8086D9F8(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); func_800AA000(this->actor.waterSurfaceDist, 0x78, 0x14, 0xA); } } -static void func_8086D944(BgBdanSwitch* this) -{ +static void func_8086D944(BgBdanSwitch* this) { this->updateFunc = &func_8086D95C; this->unk_1DA = 0x64; } -static void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - if ((func_8005B198() == this->actor.type) || (this->unk_1DA <= 0)) - { +static void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) { + if ((func_8005B198() == this->actor.type) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; - if (this->unk_1C8 <= 0.1f) - { + if (this->unk_1C8 <= 0.1f) { func_8086DB24(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); func_800AA000(this->actor.waterSurfaceDist, 0x78, 0x14, 0xA); @@ -456,90 +380,69 @@ static void func_8086D95C(BgBdanSwitch* this, GlobalContext* globalCtx) } } -static void func_8086D9F8(BgBdanSwitch* this) -{ +static void func_8086D9F8(BgBdanSwitch* this) { this->unk_1C8 = 0.6f; this->updateFunc = &func_8086DA1C; this->unk_1D8 = 6; } -static void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx) { Actor* heldActor = PLAYER->heldActor; - if (func_8004356C(&this->actor)) - { - if (heldActor != NULL && heldActor->id == ACTOR_EN_RU1) - { - if (this->unk_1D8 <= 0) - { + if (func_8004356C(&this->actor)) { + if (heldActor != NULL && heldActor->id == ACTOR_EN_RU1) { + if (this->unk_1D8 <= 0) { func_8086D944(this); func_8086D4B4(this, globalCtx); } - } - else - { + } else { this->unk_1D8 = 6; } - } - else - { - if (this->unk_1D8 <= 0) - { + } else { + if (this->unk_1D8 <= 0) { func_8086DAB4(this); } } } -static void func_8086DAB4(BgBdanSwitch* this) -{ +static void func_8086DAB4(BgBdanSwitch* this) { this->updateFunc = &func_8086DAC4; } -static void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void func_8086DAC4(BgBdanSwitch* this, GlobalContext* globalCtx) { this->unk_1C8 += 0.2f; - if (this->unk_1C8 >= 1.0f) - { + if (this->unk_1C8 >= 1.0f) { func_8086D86C(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); } } -static void func_8086DB24(BgBdanSwitch* this) -{ +static void func_8086DB24(BgBdanSwitch* this) { this->unk_1C8 = 0.1f; this->updateFunc = &func_8086DB40; } -static void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - +static void func_8086DB40(BgBdanSwitch* this, GlobalContext* globalCtx) { } -static void func_8086DB4C(BgBdanSwitch* this) -{ +static void func_8086DB4C(BgBdanSwitch* this) { this->updateFunc = &func_8086DB68; this->unk_1C8 = 2.0f; } -static void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - switch (this->actor.params & 0xFF) - { +static void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) { + switch (this->actor.params & 0xFF) { default: return; case YELLOW_TALL_1: - if (((this->collider.base.collideFlags & 2) != 0) && this->unk_1D8 <= 0) - { + if (((this->collider.base.collideFlags & 2) != 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); func_8086D4B4(this, globalCtx); } break; case YELLOW_TALL_2: - if (((this->collider.base.collideFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) - { + if (((this->collider.base.collideFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) { this->unk_1D8 = 0xA; func_8086DC30(this); func_8086D4B4(this, globalCtx); @@ -547,44 +450,35 @@ static void func_8086DB68(BgBdanSwitch* this, GlobalContext* globalCtx) } } -static void func_8086DC30(BgBdanSwitch* this) -{ +static void func_8086DC30(BgBdanSwitch* this) { this->updateFunc = &func_8086DC48; this->unk_1DA = 0x64; } -static void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - if ((func_8005B198() == this->actor.type) || (this->unk_1DA <= 0)) - { +static void func_8086DC48(BgBdanSwitch* this, GlobalContext* globalCtx) { + if ((func_8005B198() == this->actor.type) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.3f; - if (this->unk_1C8 <= 1.0f) - { + if (this->unk_1C8 <= 1.0f) { func_8086DCCC(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); } } } -static void func_8086DCCC(BgBdanSwitch* this) -{ +static void func_8086DCCC(BgBdanSwitch* this) { this->updateFunc = &func_8086DCE8; this->unk_1C8 = 1.0f; } -static void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - switch (this->actor.params & 0xFF) - { +static void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) { + switch (this->actor.params & 0xFF) { case YELLOW_TALL_1: - if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) - { + if (!Flags_GetSwitch(globalCtx, (this->actor.params >> 8) & 0x3F)) { func_8086DDA8(this); } break; case YELLOW_TALL_2: - if (((this->collider.base.collideFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) - { + if (((this->collider.base.collideFlags & 2) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) { this->unk_1D8 = 0xA; func_8086DDA8(this); func_8086D548(this, globalCtx); @@ -592,45 +486,38 @@ static void func_8086DCE8(BgBdanSwitch* this, GlobalContext* globalCtx) } } -static void func_8086DDA8(BgBdanSwitch* this) -{ +static void func_8086DDA8(BgBdanSwitch* this) { this->updateFunc = &func_8086DDC0; this->unk_1DA = 0x64; } -static void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - if ((((this->actor.params & 0xFF) != YELLOW_TALL_2) || (func_8005B198() == this->actor.type)) || (this->unk_1DA <= 0)) - { +static void func_8086DDC0(BgBdanSwitch* this, GlobalContext* globalCtx) { + if ((((this->actor.params & 0xFF) != YELLOW_TALL_2) || (func_8005B198() == this->actor.type)) || + (this->unk_1DA <= 0)) { this->unk_1C8 += 0.3f; - if (this->unk_1C8 >= 2.0f) - { + if (this->unk_1C8 >= 2.0f) { func_8086DB4C(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_FOOT_SWITCH); } } } -static void BgBdanSwitch_Update(BgBdanSwitch* this, GlobalContext* globalCtx) -{ +static void BgBdanSwitch_Update(BgBdanSwitch* this, GlobalContext* globalCtx) { s32 pad; s32 type; s32 pad2; - if (this->unk_1DA > 0) - { + if (this->unk_1DA > 0) { this->unk_1DA -= 1; } this->updateFunc(this, globalCtx); func_8086D0EC(this); type = this->actor.params & 0xFF; - if (type != 3 && type != 4) - { + if (type != 3 && type != 4) { this->unk_1D8 -= 1; return; } - if (!func_8008E988(globalCtx) && this->unk_1D8 > 0) - { + if (!func_8008E988(globalCtx) && this->unk_1D8 > 0) { this->unk_1D8 -= 1; } pad = this->collider.base.collideFlags; @@ -641,17 +528,15 @@ static void BgBdanSwitch_Update(BgBdanSwitch* this, GlobalContext* globalCtx) Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); } -static void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, UNK_TYPE arg2) -{ - func_800D1694(this->actor.posRot.pos.x, this->actor.posRot.pos.y + (this->actor.shape.unk_08 * this->unk_1D0), this->actor.posRot.pos.z, &this->actor.shape.rot); +static void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, UNK_TYPE arg2) { + func_800D1694(this->actor.posRot.pos.x, this->actor.posRot.pos.y + (this->actor.shape.unk_08 * this->unk_1D0), + this->actor.posRot.pos.z, &this->actor.shape.rot); Matrix_Scale(this->unk_1D4, this->unk_1D0, this->unk_1D4, MTXMODE_APPLY); Draw_DListOpa(globalCtx, arg2); } -static void BgBdanSwitch_Draw(BgBdanSwitch* this, GlobalContext* globalCtx) -{ - switch (this->actor.params & 0xFF) - { +static void BgBdanSwitch_Draw(BgBdanSwitch* this, GlobalContext* globalCtx) { + switch (this->actor.params & 0xFF) { case YELLOW_HEAVY: case YELLOW: func_8086DF58(this, globalCtx, &D_060061A0); diff --git a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c index ecd44ee0a8..6c6a8db38e 100644 --- a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c +++ b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c @@ -2,13 +2,13 @@ * File: z_bg_bom_guard.c * Overlay: Bg_Bom_Guard * Description: -*/ + */ #include "z_bg_bom_guard.h" #include -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void BgBomGuard_Init(BgBomGuard* this, GlobalContext* globalCtx); @@ -17,8 +17,7 @@ static void BgBomGuard_Update(BgBomGuard* this, GlobalContext* globalCtx); static void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx); -const ActorInit Bg_Bom_Guard_InitVars = -{ +const ActorInit Bg_Bom_Guard_InitVars = { ACTOR_BG_BOM_GUARD, ACTORTYPE_PROP, ROOM, @@ -33,13 +32,11 @@ const ActorInit Bg_Bom_Guard_InitVars = extern u32 D_06001C40; -static void BgBomGuard_SetupAction(BgBomGuard* this, ActorFunc actionFunc) -{ +static void BgBomGuard_SetupAction(BgBomGuard* this, ActorFunc actionFunc) { this->actionFunc = actionFunc; } -static void BgBomGuard_Init(BgBomGuard* this, GlobalContext* globalCtx) -{ +static void BgBomGuard_Init(BgBomGuard* this, GlobalContext* globalCtx) { s32 pad[2]; Actor* thisx = &this->dyna.actor; s32 local_c = 0; @@ -58,26 +55,20 @@ static void BgBomGuard_Init(BgBomGuard* this, GlobalContext* globalCtx) BgBomGuard_SetupAction(this, func_8086E638); } -static void BgBomGuard_Destroy(BgBomGuard* this, GlobalContext* globalCtx) -{ +static void BgBomGuard_Destroy(BgBomGuard* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) -{ +static void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) { Actor* it = globalCtx->actorCtx.actorList[ACTORTYPE_NPC].first; Actor* thisx = &this->dyna.actor; this->unk_168 = 0; - while (it != 0) - { - if (it->id == ACTOR_EN_BOM_BOWL_MAN) - { - if ((((EnBomBowlMan*)it)->unk_258 != 0) && - (fabsf(globalCtx->view.eye.x) > -20.0f) && - (fabsf(globalCtx->view.eye.y) > 110.0f)) - { + while (it != 0) { + if (it->id == ACTOR_EN_BOM_BOWL_MAN) { + if ((((EnBomBowlMan*)it)->unk_258 != 0) && (fabsf(globalCtx->view.eye.x) > -20.0f) && + (fabsf(globalCtx->view.eye.y) > 110.0f)) { this->unk_168 = 1; } break; @@ -85,17 +76,13 @@ static void func_8086E638(BgBomGuard* this, GlobalContext* globalCtx) it = it->next; } - if (this->unk_168 == 0) - { + if (this->unk_168 == 0) { thisx->posRot.pos.y = sREG(64) + -200.0f; - } - else - { + } else { thisx->posRot.pos.y = 0.0f; } } -static void BgBomGuard_Update(BgBomGuard* this, GlobalContext* globalCtx) -{ +static void BgBomGuard_Update(BgBomGuard* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c index 038390492b..a9bad98576 100644 --- a/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c @@ -1,6 +1,6 @@ #include "z_bg_bombwall.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00400000 void BgBombwall_Init(BgBombwall* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index d4f9fadce6..9a6e73a486 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -1,6 +1,6 @@ #include "z_bg_bowl_wall.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgBowlWall_Init(BgBowlWall* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index ef3776bec6..dedd2a7afb 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -1,6 +1,6 @@ #include "z_bg_breakwall.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgBreakwall_Init(BgBreakwall* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c index aa60cee7bd..b3ac8a472a 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c @@ -1,6 +1,6 @@ #include "z_bg_ddan_jd.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgDdanJd_Init(BgDdanJd* this, GlobalContext* globalCtx); @@ -36,6 +36,3 @@ const ActorInit Bg_Ddan_Jd_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ddan_Jd/BgDdanJd_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ddan_Jd/BgDdanJd_Draw.s") - - - diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index 2ce9ca13e4..1f88d27833 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -1,6 +1,6 @@ #include "z_bg_ddan_kd.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgDdanKd_Init(BgDdanKd* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 7d70a8e366..967be13888 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -1,6 +1,6 @@ #include "z_bg_dodoago.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgDodoago_Init(BgDodoago* this, GlobalContext* globalCtx); @@ -42,4 +42,3 @@ const ActorInit Bg_Dodoago_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Dodoago/BgDodoago_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Dodoago/BgDodoago_Draw.s") - diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 0f30328291..2df2523ee3 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -1,6 +1,6 @@ #include "z_bg_dy_yoseizo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000030 void BgDyYoseizo_Init(BgDyYoseizo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 4fce310049..e9a53f1d78 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -1,6 +1,6 @@ #include "z_bg_ganon_otyuka.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgGanonOtyuka_Init(BgGanonOtyuka* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c index baa83eb800..1cbe24a292 100644 --- a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c +++ b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c @@ -1,6 +1,6 @@ #include "z_bg_gate_shutter.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgGateShutter_Init(BgGateShutter* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c index cce0fe8e99..79ee9d72f1 100644 --- a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c +++ b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c @@ -1,6 +1,6 @@ #include "z_bg_gjyo_bridge.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgGjyoBridge_Init(BgGjyoBridge* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c index 8bbd6da107..82514de7e3 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Darkmeiro/z_bg_gnd_darkmeiro.c @@ -1,6 +1,6 @@ #include "z_bg_gnd_darkmeiro.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgGndDarkmeiro_Init(BgGndDarkmeiro* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c index 037e3af4e7..8db58c43d1 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c @@ -1,6 +1,6 @@ #include "z_bg_gnd_firemeiro.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgGndFiremeiro_Init(BgGndFiremeiro* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index b728ab7ba6..2075d3960e 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -1,6 +1,6 @@ #include "z_bg_gnd_iceblock.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgGndIceblock_Init(BgGndIceblock* this, GlobalContext* globalCtx); @@ -48,4 +48,3 @@ const ActorInit Bg_Gnd_Iceblock_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Iceblock/BgGndIceblock_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Gnd_Iceblock/BgGndIceblock_Draw.s") - diff --git a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index 34820a1c9a..2db03c4685 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -2,18 +2,17 @@ * File: z_bg_gnd_nisekabe.c * Overlay: ovl_Bg_Gnd_Nisekabe * Description: 2D Stone Wall -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; } ActorGndNisekabe; // size = 0x014C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void Init(ActorGndNisekabe* this, GlobalContext* globalCtx); @@ -21,8 +20,7 @@ static void Destroy(ActorGndNisekabe* this, GlobalContext* globalCtx); static void Update(ActorGndNisekabe* this, GlobalContext* globalCtx); static void Draw(ActorGndNisekabe* this, GlobalContext* globalCtx); -const ActorInit Bg_Gnd_Nisekabe_InitVars = -{ +const ActorInit Bg_Gnd_Nisekabe_InitVars = { ACTOR_BG_GND_NISEKABE, ACTORTYPE_PROP, ROOM, @@ -35,45 +33,30 @@ const ActorInit Bg_Gnd_Nisekabe_InitVars = (ActorFunc)Draw, }; -static u32 segmentAddr[] = -{ - 0x06009230, - 0x0600A390, - 0x0600B4A0 -}; +static u32 segmentAddr[] = { 0x06009230, 0x0600A390, 0x0600B4A0 }; -static void Init(ActorGndNisekabe* this, GlobalContext* globalCtx) -{ +static void Init(ActorGndNisekabe* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.1); this->actor.unk_F4 = 3000.0; } -static void Destroy(ActorGndNisekabe* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorGndNisekabe* this, GlobalContext* globalCtx) { } -static void Update(ActorGndNisekabe* this, GlobalContext* globalCtx) -{ - if (globalCtx->actorCtx.unk_03 != 0) - { +static void Update(ActorGndNisekabe* this, GlobalContext* globalCtx) { + if (globalCtx->actorCtx.unk_03 != 0) { this->actor.flags |= 0x80; - } - else - { + } else { this->actor.flags &= 0xFFFFFF7F; } } -static void Draw(ActorGndNisekabe* this, GlobalContext* globalCtx) -{ +static void Draw(ActorGndNisekabe* this, GlobalContext* globalCtx) { u32 index = this->actor.params & 0xFF; - if ((this->actor.flags & 0x80) == 0x80) - { + if ((this->actor.flags & 0x80) == 0x80) { Draw_DListXlu(globalCtx, segmentAddr[index]); - } - else - { + } else { Draw_DListOpa(globalCtx, segmentAddr[index]); } } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c index 559dd9a6f8..40238ba7d0 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Soulmeiro/z_bg_gnd_soulmeiro.c @@ -1,6 +1,6 @@ #include "z_bg_gnd_soulmeiro.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgGndSoulmeiro_Init(BgGndSoulmeiro* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 4e2eeffc71..6941e4288a 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -1,6 +1,6 @@ #include "z_bg_haka.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHaka_Init(BgHaka* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index e4022a278d..02264be14c 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -1,6 +1,6 @@ #include "z_bg_haka_gate.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHakaGate_Init(BgHakaGate* this, GlobalContext* globalCtx); @@ -52,4 +52,3 @@ const ActorInit Bg_Haka_Gate_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/func_8087C85C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Gate/BgHakaGate_Draw.s") - diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c index 16df9b3596..1dc6221a21 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c +++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c @@ -1,6 +1,6 @@ #include "z_bg_haka_huta.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgHakaHuta_Init(BgHakaHuta* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index ed1e39a4ea..2454dc22ea 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -1,6 +1,6 @@ #include "z_bg_haka_megane.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x000000B0 void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx); @@ -35,6 +35,3 @@ const ActorInit Bg_Haka_Megane_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC94.s") - - - diff --git a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c index acdf9ac6d2..53cd70fa9b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c +++ b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c @@ -1,6 +1,6 @@ #include "z_bg_haka_meganebg.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHakaMeganeBG_Init(BgHakaMeganeBG* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index da3dfbe035..7fd5c9492f 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -1,6 +1,6 @@ #include "z_bg_haka_sgami.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000011 void BgHakaSgami_Init(BgHakaSgami* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index f7e7dee7a6..2201dcb925 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -1,6 +1,6 @@ #include "z_bg_haka_ship.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgHakaShip_Init(BgHakaShip* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 7b6a2c48a1..94684d9f8f 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -1,6 +1,6 @@ #include "z_bg_haka_trap.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHakaTrap_Init(BgHakaTrap* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index a95976c7b7..c6e50f9ce2 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -1,6 +1,6 @@ #include "z_bg_haka_tubo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgHakaTubo_Init(BgHakaTubo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c b/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c index ba8bea230b..e059e992e3 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c +++ b/src/overlays/actors/ovl_Bg_Haka_Water/z_bg_haka_water.c @@ -1,6 +1,6 @@ #include "z_bg_haka_water.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgHakaWater_Init(BgHakaWater* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index 1365a45516..0b426a1c02 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -1,6 +1,6 @@ #include "z_bg_haka_zou.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgHakaZou_Init(BgHakaZou* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index a68e5de7aa..7d17f584b0 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -1,6 +1,6 @@ #include "z_bg_heavy_block.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHeavyBlock_Init(BgHeavyBlock* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index 1f173679b0..351fe7ebf7 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_curtain.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgHidanCurtain_Init(BgHidanCurtain* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index 9dc30828ba..3dc9b1725b 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_dalm.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanDalm_Init(BgHidanDalm* this, GlobalContext* globalCtx); @@ -36,6 +36,3 @@ const ActorInit Bg_Hidan_Dalm_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Dalm/func_808862D8.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Hidan_Dalm/BgHidanDalm_Draw.s") - - - diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index e2c232da8d..0b17a2d991 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_firewall.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanFirewall_Init(BgHidanFirewall* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c index 1f4b36c70c..d12f16076a 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c @@ -2,11 +2,11 @@ * File: z_bg_hidan_fslift.c * Overlay: Bg_Hidan_Fslift * Description: -*/ + */ #include "z_bg_hidan_fslift.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void BgHidanFslift_Init(BgHidanFslift* this, GlobalContext* globalCtx); @@ -21,8 +21,7 @@ static void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx); extern u32 D_0600B630; extern u32 D_0600E1E8; -const ActorInit Bg_Hidan_Fslift_InitVars = -{ +const ActorInit Bg_Hidan_Fslift_InitVars = { ACTOR_BG_HIDAN_FSLIFT, ACTORTYPE_BG, ROOM, @@ -35,37 +34,33 @@ const ActorInit Bg_Hidan_Fslift_InitVars = (ActorFunc)BgHidanFslift_Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 300, ICHAIN_CONTINUE), ICHAIN_F32(unk_FC, 350, ICHAIN_CONTINUE), - ICHAIN_F32(unk_F4, 2000, ICHAIN_STOP) + ICHAIN_F32(unk_F4, 2000, ICHAIN_STOP), }; -static void BgHidanFslift_Init(BgHidanFslift* this, GlobalContext* globalCtx) -{ +static void BgHidanFslift_Init(BgHidanFslift* this, GlobalContext* globalCtx) { s32 pad[2]; s32 local_c = 0; Actor* thisx = &this->dyna.actor; - + Actor_ProcessInitChain(thisx, initChain); DynaPolyInfo_SetActorMove(thisx, 1); DynaPolyInfo_Alloc(&D_0600E1E8, &local_c); this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); - if (Actor_SpawnAttached(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_HSBLOCK, thisx->posRot.pos.x, thisx->posRot.pos.y + 40.0f, thisx->posRot.pos.z + -28.0f, 0, 0, 0, 2) == NULL) - { + if (Actor_SpawnAttached(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_HSBLOCK, thisx->posRot.pos.x, + thisx->posRot.pos.y + 40.0f, thisx->posRot.pos.z + -28.0f, 0, 0, 0, 2) == NULL) { Actor_Kill(thisx); return; } this->actionFunc = func_80886FCC; } -static void func_80886F24(BgHidanFslift* this) -{ +static void func_80886F24(BgHidanFslift* this) { Actor* thisx = &this->dyna.actor; - if (thisx->attachedB != NULL && thisx->attachedB->update != NULL) - { + if (thisx->attachedB != NULL && thisx->attachedB->update != NULL) { thisx->attachedB->posRot.pos.x = thisx->posRot.pos.x; thisx->attachedB->posRot.pos.y = thisx->posRot.pos.y + 40.0f; thisx->attachedB->posRot.pos.z = thisx->posRot.pos.z + -28.0f; @@ -74,107 +69,82 @@ static void func_80886F24(BgHidanFslift* this) thisx->attachedB = NULL; } -static void BgHidanFslift_Destroy(BgHidanFslift* this, GlobalContext* globalCtx) -{ +static void BgHidanFslift_Destroy(BgHidanFslift* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void func_80886FB4(BgHidanFslift* this) -{ +static void func_80886FB4(BgHidanFslift* this) { this->unk_168 = 0x28; this->actionFunc = func_80886FCC; } -static void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) -{ +static void func_80886FCC(BgHidanFslift* this, GlobalContext* globalCtx) { UNK_TYPE somebool; Actor* thisx = &this->dyna.actor; DECR(this->unk_168); - if (this->unk_168 == 0) - { + if (this->unk_168 == 0) { somebool = 0; - if ((thisx->posRot.pos.y - thisx->initPosRot.pos.y) < 0.5f) - { + if ((thisx->posRot.pos.y - thisx->initPosRot.pos.y) < 0.5f) { somebool = 1; } - if (func_80043590(thisx)) - { - if (somebool) - { + if (func_80043590(thisx)) { + if (somebool) { this->actionFunc = func_808870D8; return; } } - if (!somebool) - { + if (!somebool) { this->actionFunc = func_8088706C; } } } -static void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) -{ +static void func_8088706C(BgHidanFslift* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y, 4.0f)) - { + if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y, 4.0f)) { Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); func_80886FB4(this); - } - else - { + } else { func_8002F974(thisx, 0x20b9); } func_80886F24(this); } -static void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) -{ +static void func_808870D8(BgHidanFslift* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (func_80043590(thisx)) - { - if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 790.0f, 4.0f)) - { + if (func_80043590(thisx)) { + if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 790.0f, 4.0f)) { Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); func_80886FB4(this); - } - else - { + } else { func_8002F974(thisx, 0x20b9); } - } - else - { + } else { func_80886FB4(this); } func_80886F24(this); } -static void BgHidanFslift_Update(BgHidanFslift* this, GlobalContext* globalCtx) -{ +static void BgHidanFslift_Update(BgHidanFslift* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; this->actionFunc(this, globalCtx); - if (func_8004356C(thisx)) - { - if (this->unk_16A == 0) - { + if (func_8004356C(thisx)) { + if (this->unk_16A == 0) { this->unk_16A = 3; } func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 0x30); return; } - if (func_8004356C(thisx) == 0) - { - if (this->unk_16A != 0) - { + if (func_8004356C(thisx) == 0) { + if (this->unk_16A != 0) { func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 3); } this->unk_16A = 0; } } -static void BgHidanFslift_Draw(BgHidanFslift* this, GlobalContext* globalCtx) -{ +static void BgHidanFslift_Draw(BgHidanFslift* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_0600B630); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index 49e0df5462..9cd91b63d0 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_fwbig.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgHidanFwbig_Init(BgHidanFwbig* this, GlobalContext* globalCtx); 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 3abcef7ce2..97aba0e1ea 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 @@ -1,6 +1,6 @@ #include "z_bg_hidan_hamstep.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanHamstep_Init(BgHidanHamstep* this, GlobalContext* globalCtx); 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 246db3a95c..cb4d60140d 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 @@ -1,6 +1,6 @@ #include "z_bg_hidan_hrock.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanHrock_Init(BgHidanHrock* this, GlobalContext* globalCtx); 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 cc80e92acb..48e065a68e 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 @@ -1,6 +1,6 @@ #include "z_bg_hidan_kousi.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgHidanKousi_Init(BgHidanKousi* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index 6c7a96a123..64980bbda2 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_kowarerukabe.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanKowarerukabe_Init(BgHidanKowarerukabe* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 351cd0f107..06ad32f3c5 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_rock.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanRock_Init(BgHidanRock* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index fdec662734..7922456426 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_rsekizou.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanRsekizou_Init(BgHidanRsekizou* this, GlobalContext* globalCtx); 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 ee750dba95..c2ec2c2cb8 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 @@ -1,6 +1,6 @@ #include "z_bg_hidan_sekizou.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanSekizou_Init(BgHidanSekizou* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index 7af7ccaa12..e81f25b7f0 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -1,6 +1,6 @@ #include "z_bg_hidan_sima.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgHidanSima_Init(BgHidanSima* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c index 95c8d4937d..fa1fda2c1e 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c @@ -2,13 +2,12 @@ * File: z_bg_hidan_syoku.c * Overlay: Bg_Hidan_Syoku * Description: Stone Elevator in the Fire Temple -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ u32 dynaPolyId; /* 0x0150 */ f32 unk_150; @@ -16,12 +15,12 @@ typedef struct /* 0x0158 */ u32 unk_158; /* 0x015C */ u32 unk_15C; /* 0x0160 */ u8 unk_160; - /* 0x0164 */ ActorFunc updateFunc; - /* 0x0168 */ s16 unk_168; - /* 0x016A */ s16 unk_16A; + /* 0x0164 */ ActorFunc updateFunc; + /* 0x0168 */ s16 unk_168; + /* 0x016A */ s16 unk_16A; } ActorHidanSyoku; // size = 0x016C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void Init(ActorHidanSyoku* this, GlobalContext* globalCtx); @@ -32,8 +31,7 @@ static void func_8088F62C(ActorHidanSyoku* this, GlobalContext* globalCtx); static void Update(ActorHidanSyoku* this, GlobalContext* globalCtx); static void Draw(ActorHidanSyoku* this, GlobalContext* globalCtx); -const ActorInit Bg_Hidan_Syoku_InitVars = -{ +const ActorInit Bg_Hidan_Syoku_InitVars = { ACTOR_BG_HIDAN_SYOKU, ACTORTYPE_BG, ROOM, @@ -46,16 +44,14 @@ const ActorInit Bg_Hidan_Syoku_InitVars = (ActorFunc)Draw, }; -static InitChainEntry initChain[] = -{ - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP) +static InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; extern UNK_PTR D_0600A7E0; extern UNK_PTR D_0600E568; -static void Init(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ +static void Init(ActorHidanSyoku* this, GlobalContext* globalCtx) { s32 pad[2]; u32 local_c = 0; @@ -67,104 +63,78 @@ static void Init(ActorHidanSyoku* this, GlobalContext* globalCtx) this->actor.initPosRot.pos.y += 540.0f; } -static void Destroy(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorHidanSyoku* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void func_8088F47C(ActorHidanSyoku* this) -{ +static void func_8088F47C(ActorHidanSyoku* this) { this->unk_16A = 0x3c; Audio_PlayActorSound2(&this->actor, NA_SE_EV_BLOCK_BOUND); this->updateFunc = &func_8088F62C; } -static void func_8088F4B8(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ - if (Flags_GetClear(globalCtx, this->actor.room) && func_8004356C(&this->actor)) - { +static void func_8088F4B8(ActorHidanSyoku* this, GlobalContext* globalCtx) { + if (Flags_GetClear(globalCtx, this->actor.room) && func_8004356C(&this->actor)) { this->unk_16A = 0x8c; this->updateFunc = &func_8088F514; } } -static void func_8088F514(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ - if (this->unk_16A != 0) - { +static void func_8088F514(ActorHidanSyoku* this, GlobalContext* globalCtx) { + if (this->unk_16A != 0) { this->unk_16A -= 1; } this->actor.posRot.pos.y = (cosf(this->unk_16A * (M_PI / 140)) * 540.0f) + this->actor.initPosRot.pos.y; - if (this->unk_16A == 0) - { + if (this->unk_16A == 0) { func_8088F47C(this); - } - else - { + } else { func_8002F974(&this->actor, 0x20b9); } } -static void func_8088F5A0(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ - if (this->unk_16A != 0) - { +static void func_8088F5A0(ActorHidanSyoku* this, GlobalContext* globalCtx) { + if (this->unk_16A != 0) { this->unk_16A -= 1; } this->actor.posRot.pos.y = this->actor.initPosRot.pos.y - (cosf(this->unk_16A * (M_PI / 140)) * 540.0f); - if (this->unk_16A == 0) - { + if (this->unk_16A == 0) { func_8088F47C(this); - } - else - { + } else { func_8002F974(&this->actor, 0x20b9); } } -static void func_8088F62C(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ - if (this->unk_16A != 0) - { +static void func_8088F62C(ActorHidanSyoku* this, GlobalContext* globalCtx) { + if (this->unk_16A != 0) { this->unk_16A -= 1; } - if (this->unk_16A == 0) - { + if (this->unk_16A == 0) { this->unk_16A = 0x8c; - if (this->actor.posRot.pos.y < this->actor.initPosRot.pos.y) - { + if (this->actor.posRot.pos.y < this->actor.initPosRot.pos.y) { this->updateFunc = &func_8088F514; - } - else - { + } else { this->updateFunc = &func_8088F5A0; } } } -static void Update(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ +static void Update(ActorHidanSyoku* this, GlobalContext* globalCtx) { this->updateFunc(this, globalCtx); - if (func_8004356C(&this->actor)) - { - if (this->unk_168 == 0) - { + if (func_8004356C(&this->actor)) { + if (this->unk_168 == 0) { this->unk_168 = 3; } func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 0x30); return; } - if (!func_8004356C(&this->actor)) - { - if (this->unk_168 != 0) - { + if (!func_8004356C(&this->actor)) { + if (this->unk_168 != 0) { func_8005A77C(globalCtx->cameraCtx.activeCameraPtrs[0], 3); } this->unk_168 = 0; } } -static void Draw(ActorHidanSyoku* this, GlobalContext* globalCtx) -{ +static void Draw(ActorHidanSyoku* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_0600A7E0); } diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c index 3ccd7a4fa7..6be01a595d 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c +++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c @@ -1,6 +1,6 @@ #include "z_bg_ice_objects.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgIceObjects_Init(BgIceObjects* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index 3ebc6346da..811445fa31 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -1,6 +1,6 @@ #include "z_bg_ice_shelter.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgIceShelter_Init(BgIceShelter* this, GlobalContext* globalCtx); 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 81ca533027..cd411fac64 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 @@ -1,6 +1,6 @@ #include "z_bg_ice_shutter.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgIceShutter_Init(BgIceShutter* this, GlobalContext* globalCtx); @@ -38,6 +38,3 @@ const ActorInit Bg_Ice_Shutter_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/BgIceShutter_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ice_Shutter/BgIceShutter_Draw.s") - - - diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index 99a5b9fb55..14e159c07a 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -1,6 +1,6 @@ #include "z_bg_ice_turara.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgIceTurara_Init(BgIceTurara* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 1187a276bf..d7302e07ba 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -1,6 +1,6 @@ #include "z_bg_ingate.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgIngate_Init(BgIngate* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index 303ee5fd70..ad957055a8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -1,6 +1,6 @@ #include "z_bg_jya_1flift.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgJya1flift_Init(BgJya1flift* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c index 1178ce90ea..8e5e1323d8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c +++ b/src/overlays/actors/ovl_Bg_Jya_Amishutter/z_bg_jya_amishutter.c @@ -2,20 +2,19 @@ * File: z_bg_jya_amishutter.c * Overlay: Bg_Jya_Amishutter * Description: Circular Metal Grate (Spirit Temple) -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ u32 dynaPolyId; /* 0x0150 */ char unk_150[0x14]; /* 0x0164 */ void (*updateFunc)(Actor*); } BgJyaAmishutter; // size = 0x0168 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void BgJyaAmishutter_Init(BgJyaAmishutter* this, GlobalContext* globalCtx); @@ -32,8 +31,7 @@ static void func_808934C0(BgJyaAmishutter* this); static void func_808934FC(BgJyaAmishutter* this); static void func_8089350C(BgJyaAmishutter* this); -const ActorInit Bg_Jya_Amishutter_InitVars = -{ +const ActorInit Bg_Jya_Amishutter_InitVars = { ACTOR_BG_JYA_AMISHUTTER, ACTORTYPE_BG, ROOM, @@ -46,19 +44,17 @@ const ActorInit Bg_Jya_Amishutter_InitVars = (ActorFunc)BgJyaAmishutter_Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(unk_F4, 1000, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 200, ICHAIN_CONTINUE), - ICHAIN_F32(unk_FC, 1000, ICHAIN_STOP) + ICHAIN_F32(unk_FC, 1000, ICHAIN_STOP), }; extern UNK_TYPE D_0600C4C8; extern UNK_TYPE D_0600C0A0; -static void func_808932C0(BgJyaAmishutter* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) -{ +static void func_808932C0(BgJyaAmishutter* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) { s16 pad1; u32 local_c = 0; s16 pad2; @@ -66,95 +62,74 @@ static void func_808932C0(BgJyaAmishutter* this, GlobalContext* globalCtx, u32 c DynaPolyInfo_SetActorMove(&this->actor, flag); DynaPolyInfo_Alloc(collision, &local_c); this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, local_c); - if (this->dynaPolyId == 0x32) - { - osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129, this->actor.id, this->actor.params); + if (this->dynaPolyId == 0x32) { + osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_amishutter.c", 129, + this->actor.id, this->actor.params); } } -static void BgJyaAmishutter_Init(BgJyaAmishutter* this, GlobalContext* globalCtx) -{ +static void BgJyaAmishutter_Init(BgJyaAmishutter* this, GlobalContext* globalCtx) { func_808932C0(this, globalCtx, &D_0600C4C8, 0); Actor_ProcessInitChain(&this->actor, initChain); func_808933BC(this); } -static void BgJyaAmishutter_Destroy(BgJyaAmishutter* this, GlobalContext* globalCtx) -{ +static void BgJyaAmishutter_Destroy(BgJyaAmishutter* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void func_808933BC(BgJyaAmishutter* this) -{ +static void func_808933BC(BgJyaAmishutter* this) { this->updateFunc = func_808933CC; } -static void func_808933CC(BgJyaAmishutter* this) -{ - if (this->actor.xzDistanceFromLink < 60.0f) - { - if (fabsf(this->actor.yDistanceFromLink) < 30.0f) - { +static void func_808933CC(BgJyaAmishutter* this) { + if (this->actor.xzDistanceFromLink < 60.0f) { + if (fabsf(this->actor.yDistanceFromLink) < 30.0f) { func_80893428(this); } } } -static void func_80893428(BgJyaAmishutter* this) -{ +static void func_80893428(BgJyaAmishutter* this) { this->updateFunc = func_80893438; } -static void func_80893438(BgJyaAmishutter* this) -{ - if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 100.0f, 3.0f)) - { +static void func_80893438(BgJyaAmishutter* this) { + if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 100.0f, 3.0f)) { func_808934B0(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP); - } - else - { + } else { func_8002F974(&this->actor, 0x2036); } } -static void func_808934B0(BgJyaAmishutter* this) -{ +static void func_808934B0(BgJyaAmishutter* this) { this->updateFunc = func_808934C0; } -static void func_808934C0(BgJyaAmishutter* this) -{ - if (this->actor.xzDistanceFromLink > 300.0f) - { +static void func_808934C0(BgJyaAmishutter* this) { + if (this->actor.xzDistanceFromLink > 300.0f) { func_808934FC(this); } } -static void func_808934FC(BgJyaAmishutter* this) -{ +static void func_808934FC(BgJyaAmishutter* this) { this->updateFunc = func_8089350C; } -static void func_8089350C(BgJyaAmishutter* this) -{ - if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 3.0f)) - { - func_808933BC(this); +static void func_8089350C(BgJyaAmishutter* this) { + if (Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 3.0f)) { + func_808933BC(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_METALDOOR_STOP); - } - else - { + } else { func_8002F974(&this->actor, 0x2036); } } -static void BgJyaAmishutter_Update(BgJyaAmishutter* this, GlobalContext* globalCtx) -{ +static void BgJyaAmishutter_Update(BgJyaAmishutter* this, GlobalContext* globalCtx) { this->updateFunc(this); } -static void BgJyaAmishutter_Draw(BgJyaAmishutter* this, GlobalContext* globalCtx) -{ +static void BgJyaAmishutter_Draw(BgJyaAmishutter* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_0600C0A0); } 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 abfd9bb9b9..bef3b84a78 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 @@ -1,6 +1,6 @@ #include "z_bg_jya_bigmirror.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgJyaBigmirror_Init(BgJyaBigmirror* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index 4498ddeffe..6fa60832b1 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -1,6 +1,6 @@ #include "z_bg_jya_block.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgJyaBlock_Init(BgJyaBlock* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index 8e7fbd7cc8..6e6f9c829d 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -1,6 +1,6 @@ #include "z_bg_jya_bombchuiwa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000001 void BgJyaBombchuiwa_Init(BgJyaBombchuiwa* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index bd6ecca8f8..d9b23ebbe4 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -1,6 +1,6 @@ #include "z_bg_jya_bombiwa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgJyaBombiwa_Init(BgJyaBombiwa* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 406d352a90..66e5b1278a 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -1,6 +1,6 @@ #include "z_bg_jya_cobra.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgJyaCobra_Init(BgJyaCobra* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 306886f0a8..c8ac65e238 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -1,6 +1,6 @@ #include "z_bg_jya_goroiwa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgJyaGoroiwa_Init(BgJyaGoroiwa* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index 98d5d4ff00..49b78c9694 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -1,6 +1,6 @@ #include "z_bg_jya_haheniron.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgJyaHaheniron_Init(BgJyaHaheniron* this, GlobalContext* globalCtx); 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 416a171f19..0fb2cebc0f 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 @@ -1,6 +1,6 @@ #include "z_bg_jya_ironobj.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgJyaIronobj_Init(BgJyaIronobj* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index 509c27cc71..a9894f43d2 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -2,13 +2,12 @@ * File: z_bg_jya_kanaami.c * Overlay: Bg_Jya_Kanaami * Description: Climbable Metal Grating (Fire Temple) -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ u32 dynaPolyId; /* 0x014C */ char unk_150[0x14]; @@ -17,7 +16,7 @@ typedef struct /* 0x016A */ s16 unk_16A; } BgJyaKanaami; // size = 0x016C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void BgJyaKanaami_Init(BgJyaKanaami* this, GlobalContext* globalCtx); @@ -31,8 +30,7 @@ static void func_8089993C(BgJyaKanaami* this); static void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx); static void func_80899A08(BgJyaKanaami* this); -const ActorInit Bg_Jya_Kanaami_InitVars = -{ +const ActorInit Bg_Jya_Kanaami_InitVars = { ACTOR_BG_JYA_KANAAMI, ACTORTYPE_BG, ROOM, @@ -45,19 +43,17 @@ const ActorInit Bg_Jya_Kanaami_InitVars = (ActorFunc)BgJyaKanaami_Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(unk_F4, 1000, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 700, ICHAIN_CONTINUE), - ICHAIN_F32(unk_FC, 1000, ICHAIN_STOP) + ICHAIN_F32(unk_FC, 1000, ICHAIN_STOP), }; extern u32 D_0600F000; extern u32 D_0600F208; -static void func_80899740(BgJyaKanaami* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) -{ +static void func_80899740(BgJyaKanaami* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) { s32 pad; s32 local_c = 0; s32 pad2; @@ -65,67 +61,54 @@ static void func_80899740(BgJyaKanaami* this, GlobalContext* globalCtx, u32 coll DynaPolyInfo_SetActorMove(&this->actor, flag); DynaPolyInfo_Alloc(collision, &local_c); this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, local_c); - if (this->dynaPolyId == 0x32) - { - osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145, this->actor.id, this->actor.params); + if (this->dynaPolyId == 0x32) { + osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_jya_kanaami.c", 145, + this->actor.id, this->actor.params); } } -static void BgJyaKanaami_Init(BgJyaKanaami* this, GlobalContext* globalCtx) -{ +static void BgJyaKanaami_Init(BgJyaKanaami* this, GlobalContext* globalCtx) { func_80899740(this, globalCtx, &D_0600F208, 0); Actor_ProcessInitChain(&this->actor, initChain); - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) - { + if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F)) { func_80899A08(this); - } - else - { + } else { func_80899880(this); } osSyncPrintf("(jya 金網)(arg_data 0x%04x)\n", this->actor.params); } -static void BgJyaKanaami_Destroy(BgJyaKanaami* this, GlobalContext* globalCtx) -{ +static void BgJyaKanaami_Destroy(BgJyaKanaami* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void func_80899880(BgJyaKanaami* this) -{ +static void func_80899880(BgJyaKanaami* this) { this->updateFunc = func_80899894; this->unk_16A = 0; } -static void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) -{ - if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) || this->unk_16A > 0) - { - if (this->actor.posRot.pos.x > -1000.0f && this->unk_16A == 0) - { +static void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) { + if (Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) || this->unk_16A > 0) { + if (this->actor.posRot.pos.x > -1000.0f && this->unk_16A == 0) { func_800800F8(globalCtx, 0xD7A, -0x63, &this->actor, 0); } this->unk_16A += 1; - if (this->unk_16A >= 0xA) - { + if (this->unk_16A >= 0xA) { func_8089993C(this); } } } -static void func_8089993C(BgJyaKanaami* this) -{ +static void func_8089993C(BgJyaKanaami* this) { this->updateFunc = func_80899950; this->unk_168 = 0; } -static void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) -{ +static void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { s32 pad[2]; s32 var; this->unk_168 += 0x20; - if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.x, 0x4000, this->unk_168)) - { + if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.x, 0x4000, this->unk_168)) { func_80899A08(this); Audio_PlayActorSound2(&this->actor, NA_SE_EV_TRAP_BOUND); var = func_80092F88(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 3); @@ -135,22 +118,18 @@ static void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) } } -static void func_80899A08(BgJyaKanaami* this) -{ +static void func_80899A08(BgJyaKanaami* this) { this->updateFunc = 0; this->actor.posRot.rot.x = 0x4000; } -static void BgJyaKanaami_Update(BgJyaKanaami* this, GlobalContext* globalCtx) -{ - if (this->updateFunc) - { +static void BgJyaKanaami_Update(BgJyaKanaami* this, GlobalContext* globalCtx) { + if (this->updateFunc) { this->updateFunc(this, globalCtx); } this->actor.shape.rot.x = this->actor.posRot.rot.x; } -static void BgJyaKanaami_Draw(BgJyaKanaami* this, GlobalContext* globalCtx) -{ +static void BgJyaKanaami_Draw(BgJyaKanaami* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_0600F000); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 665ea107b3..2bfb33a526 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -1,6 +1,6 @@ #include "z_bg_jya_lift.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgJyaLift_Init(BgJyaLift* this, GlobalContext* globalCtx); 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 1aa895c33a..e2285e2e8c 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 @@ -1,6 +1,6 @@ #include "z_bg_jya_megami.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgJyaMegami_Init(BgJyaMegami* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index f4077d719f..7f47776247 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -1,6 +1,6 @@ #include "z_bg_jya_zurerukabe.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgJyaZurerukabe_Init(BgJyaZurerukabe* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index 5d94b4ff3e..b8a09316d5 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -1,6 +1,6 @@ #include "z_bg_menkuri_eye.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000020 void BgMenkuriEye_Init(BgMenkuriEye* this, GlobalContext* globalCtx); @@ -30,4 +30,3 @@ const ActorInit Bg_Menkuri_Eye_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Menkuri_Eye/BgMenkuriEye_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Menkuri_Eye/BgMenkuriEye_Draw.s") - diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c index 028d0046ba..42bb7979c3 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Kaiten/z_bg_menkuri_kaiten.c @@ -2,7 +2,7 @@ * File: z_bg_menkuri_kaiten.c * Overlay: Bg_Menkuri_Kaiten * Description: Large rotating stone ring used in Gerudo Training Grounds and Forest Temple. -*/ + */ #include #include @@ -10,14 +10,13 @@ extern u32 D_060038D0; extern u32 D_060042D8; -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ u32 dynaPolyId; - /* 0x0150 */ char unk_150[0x14]; + /* 0x014C */ u32 dynaPolyId; + /* 0x0150 */ char unk_150[0x14]; } ActorMenkuriKaiten; // size = 0x0164 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 static void Init(ActorMenkuriKaiten* this, GlobalContext* globalCtx); @@ -25,8 +24,7 @@ static void Destroy(ActorMenkuriKaiten* this, GlobalContext* globalCtx); static void Update(ActorMenkuriKaiten* this, GlobalContext* globalCtx); static void Draw(ActorMenkuriKaiten* this, GlobalContext* globalCtx); -const ActorInit Bg_Menkuri_Kaiten_InitVars = -{ +const ActorInit Bg_Menkuri_Kaiten_InitVars = { ACTOR_BG_MENKURI_KAITEN, ACTORTYPE_BG, ROOM, @@ -39,13 +37,11 @@ const ActorInit Bg_Menkuri_Kaiten_InitVars = (ActorFunc)Draw, }; -static InitChainEntry initChain[] = -{ - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP) +static InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -static void Init(ActorMenkuriKaiten* this, GlobalContext* globalCtx) -{ +static void Init(ActorMenkuriKaiten* this, GlobalContext* globalCtx) { s32 pad[2]; u32 local_c = 0; @@ -55,21 +51,17 @@ static void Init(ActorMenkuriKaiten* this, GlobalContext* globalCtx) this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, local_c); } -static void Destroy(ActorMenkuriKaiten* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorMenkuriKaiten* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void Update(ActorMenkuriKaiten* this, GlobalContext* globalCtx) -{ - if (!Flags_GetSwitch(globalCtx, this->actor.params) && func_80043590(&this->actor)) - { +static void Update(ActorMenkuriKaiten* this, GlobalContext* globalCtx) { + if (!Flags_GetSwitch(globalCtx, this->actor.params) && func_80043590(&this->actor)) { func_8002F974(&this->actor, 0x2024); this->actor.shape.rot.y += 0x80; } } -static void Draw(ActorMenkuriKaiten* this, GlobalContext* globalCtx) -{ +static void Draw(ActorMenkuriKaiten* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_060038D0); } diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index e58040fc22..475dbe9ff4 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -2,17 +2,16 @@ * File: z_bg_menkuri_nisekabe.c * Overlay: ovl_Bg_Menkuri_Nisekabe * Description: False Stone Walls (Gerudo Training Grounds) -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; } BgMenkuriNisekabe; // size = 0x014C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void Init(BgMenkuriNisekabe* this, GlobalContext* globalCtx); @@ -20,8 +19,7 @@ static void Destroy(BgMenkuriNisekabe* this, GlobalContext* globalCtx); static void Update(BgMenkuriNisekabe* this, GlobalContext* globalCtx); static void Draw(BgMenkuriNisekabe* this, GlobalContext* globalCtx); -const ActorInit Bg_Menkuri_Nisekabe_InitVars = -{ +const ActorInit Bg_Menkuri_Nisekabe_InitVars = { ACTOR_BG_MENKURI_NISEKABE, ACTORTYPE_PROP, ROOM, @@ -34,44 +32,29 @@ const ActorInit Bg_Menkuri_Nisekabe_InitVars = (ActorFunc)Draw, }; -static u32 segmentAddr[] = -{ - 0x06002280, - 0x06002BC0 -}; +static u32 segmentAddr[] = { 0x06002280, 0x06002BC0 }; -static void Init(BgMenkuriNisekabe* this, GlobalContext* globalCtx) -{ +static void Init(BgMenkuriNisekabe* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.1f); } -static void Destroy(BgMenkuriNisekabe* this,GlobalContext* globalCtx) -{ - +static void Destroy(BgMenkuriNisekabe* this, GlobalContext* globalCtx) { } -static void Update(BgMenkuriNisekabe* this, GlobalContext* globalCtx) -{ - if (globalCtx->actorCtx.unk_03 != 0) - { +static void Update(BgMenkuriNisekabe* this, GlobalContext* globalCtx) { + if (globalCtx->actorCtx.unk_03 != 0) { this->actor.flags |= 0x80; - } - else - { + } else { this->actor.flags &= ~0x80; } } -static void Draw(BgMenkuriNisekabe* this, GlobalContext* globalCtx) -{ +static void Draw(BgMenkuriNisekabe* this, GlobalContext* globalCtx) { u32 index = this->actor.params & 0xFF; - if ((this->actor.flags & 0x80) == 0x80) - { + if ((this->actor.flags & 0x80) == 0x80) { Draw_DListXlu(globalCtx, segmentAddr[index]); - } - else - { + } else { Draw_DListOpa(globalCtx, segmentAddr[index]); } } 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 89fbc967b9..93ec2b84f4 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 @@ -1,6 +1,6 @@ #include "z_bg_mizu_bwall.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgMizuBwall_Init(BgMizuBwall* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c index 999a3891cc..de1a472a00 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Movebg/z_bg_mizu_movebg.c @@ -1,6 +1,6 @@ #include "z_bg_mizu_movebg.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgMizuMovebg_Init(BgMizuMovebg* this, GlobalContext* globalCtx); @@ -40,4 +40,3 @@ const ActorInit Bg_Mizu_Movebg_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/BgMizuMovebg_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mizu_Movebg/BgMizuMovebg_Draw.s") - diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c index f79aa0ab32..0b9bfbef41 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c @@ -1,6 +1,6 @@ #include "z_bg_mizu_shutter.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgMizuShutter_Init(BgMizuShutter* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c index b56662c90c..d4a4bebc28 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c @@ -2,18 +2,17 @@ * File: z_bg_mizu_uzu.c * Overlay: ovl_Bg_Mizu_Uzu * Description: Water Noise -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ActorFunc actionFunc; } BgMizuUzu; // size = 0x0168 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void BgMizuUzu_Init(BgMizuUzu* this, GlobalContext* globalCtx); @@ -21,8 +20,7 @@ static void BgMizuUzu_Destroy(BgMizuUzu* this, GlobalContext* globalCtx); static void BgMizuUzu_Update(BgMizuUzu* this, GlobalContext* globalCtx); static void BgMizuUzu_Draw(BgMizuUzu* this, GlobalContext* globalCtx); -const ActorInit Bg_Mizu_Uzu_InitVars = -{ +const ActorInit Bg_Mizu_Uzu_InitVars = { ACTOR_BG_MIZU_UZU, ACTORTYPE_PROP, ROOM, @@ -35,19 +33,17 @@ const ActorInit Bg_Mizu_Uzu_InitVars = (ActorFunc)BgMizuUzu_Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_F32(unk_F8, 1000, ICHAIN_CONTINUE), ICHAIN_F32(unk_FC, 1000, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP) + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; extern u32 D_060074EC; static void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx); -static void BgMizuUzu_Init(BgMizuUzu* this, GlobalContext* globalCtx) -{ +static void BgMizuUzu_Init(BgMizuUzu* this, GlobalContext* globalCtx) { s32 pad[2]; s32 local_c = 0; Actor* thisx = &this->dyna.actor; @@ -58,32 +54,24 @@ static void BgMizuUzu_Init(BgMizuUzu* this, GlobalContext* globalCtx) this->actionFunc = func_8089F788; } -static void BgMizuUzu_Destroy(BgMizuUzu* this, GlobalContext* globalCtx) -{ +static void BgMizuUzu_Destroy(BgMizuUzu* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx) -{ +static void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (PLAYER->currentBoots == 1) - { + if (PLAYER->currentBoots == 1) { func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); - } - else - { + } else { func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } Audio_PlayActorSound2(thisx, 0x20CD); thisx->shape.rot.y += 0x1C0; } -static void BgMizuUzu_Update(BgMizuUzu* this, GlobalContext* globalCtx) -{ +static void BgMizuUzu_Update(BgMizuUzu* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } -static void BgMizuUzu_Draw(BgMizuUzu* this, GlobalContext* globalCtx) -{ - +static void BgMizuUzu_Draw(BgMizuUzu* this, GlobalContext* globalCtx) { } 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 f7caeab759..d5a2ff8b99 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 @@ -1,6 +1,6 @@ #include "z_bg_mizu_water.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgMizuWater_Init(BgMizuWater* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index 0143568bf4..02693ebae5 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -2,11 +2,11 @@ * File: z_bg_mjin.c * Overlay: ovl_Bg_Mjin * Description: Warp Pad -*/ + */ #include "z_bg_mjin.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void BgMjin_SetupAction(BgMjin* this, ActorFunc actionFunc); @@ -17,8 +17,7 @@ static void func_808A0920(BgMjin* this, GlobalContext* globalCtx); static void BgMjin_Update(BgMjin* this, GlobalContext* globalCtx); static void BgMjin_Draw(BgMjin* this, GlobalContext* globalCtx); -const ActorInit Bg_Mjin_InitVars = -{ +const ActorInit Bg_Mjin_InitVars = { ACTOR_BG_MJIN, ACTORTYPE_BG, ROOM, @@ -36,51 +35,43 @@ extern u32 D_06000140; extern u32 D_06000330; extern u32 D_06000658; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_CONTINUE), ICHAIN_F32(unk_F4, 4000, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 400, ICHAIN_CONTINUE), - ICHAIN_F32(unk_FC, 400, ICHAIN_STOP) + ICHAIN_F32(unk_FC, 400, ICHAIN_STOP), }; -static s16 objectTbl[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME, OBJECT_MJIN_ICE, OBJECT_MJIN_SOUL, OBJECT_MJIN_WIND }; +static s16 objectTbl[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME, + OBJECT_MJIN_ICE, OBJECT_MJIN_SOUL, OBJECT_MJIN_WIND }; -static void BgMjin_SetupAction(BgMjin* this, ActorFunc actionFunc) -{ +static void BgMjin_SetupAction(BgMjin* this, ActorFunc actionFunc) { this->actionFunc = actionFunc; } -static void BgMjin_Init(BgMjin* this, GlobalContext* globalCtx) -{ +static void BgMjin_Init(BgMjin* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; s8 objBankIndex; Actor_ProcessInitChain(thisx, initChain); objBankIndex = Object_GetIndex(&globalCtx->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA)); this->objBankIndex = objBankIndex; - if (objBankIndex < 0) - { + if (objBankIndex < 0) { Actor_Kill(thisx); - } - else - { + } else { BgMjin_SetupAction(this, &func_808A0850); } } -static void BgMjin_Destroy(BgMjin* this, GlobalContext* globalCtx) -{ +static void BgMjin_Destroy(BgMjin* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void func_808A0850(BgMjin* this, GlobalContext* globalCtx) -{ +static void func_808A0850(BgMjin* this, GlobalContext* globalCtx) { u32 local_c; u32 collision; - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) - { + if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { local_c = 0; this->dyna.actor.flags &= ~0x10; this->dyna.actor.objBankIndex = this->objBankIndex; @@ -88,24 +79,21 @@ static void func_808A0850(BgMjin* this, GlobalContext* globalCtx) DynaPolyInfo_SetActorMove(&this->dyna.actor, 0); collision = this->dyna.actor.params != 0 ? &D_06000658 : &D_06000330; DynaPolyInfo_Alloc(collision, &local_c); - this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, local_c); + this->dyna.dynaPolyId = + DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, local_c); BgMjin_SetupAction(this, &func_808A0920); this->dyna.actor.draw = &BgMjin_Draw; } } -static void func_808A0920(BgMjin* this, GlobalContext* globalCtx) -{ - +static void func_808A0920(BgMjin* this, GlobalContext* globalCtx) { } -static void BgMjin_Update(BgMjin* this, GlobalContext* globalCtx) -{ +static void BgMjin_Update(BgMjin* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } -static void BgMjin_Draw(BgMjin* this, GlobalContext* globalCtx) -{ +static void BgMjin_Draw(BgMjin* this, GlobalContext* globalCtx) { s32 objBankIndex; u32 dlist; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; @@ -113,22 +101,19 @@ static void BgMjin_Draw(BgMjin* this, GlobalContext* globalCtx) s32 pad; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_bg_mjin.c", 250); - if (this->dyna.actor.params != 0) - { + if (this->dyna.actor.params != 0) { objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectTbl[this->dyna.actor.params - 1]); - if (objBankIndex >= 0) - { + if (objBankIndex >= 0) { gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objBankIndex].segment); } gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000)); dlist = &D_06000330; - } - else - { + } else { dlist = &D_06000140; } func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 285), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 285), + G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dlist); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_bg_mjin.c", 288); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 2aa818897f..52afee4d6d 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -1,6 +1,6 @@ #include "z_bg_mori_bigst.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgMoriBigst_Init(BgMoriBigst* this, GlobalContext* globalCtx); 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 5bfcd4a728..0bd8b68314 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 @@ -1,6 +1,6 @@ #include "z_bg_mori_elevator.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgMoriElevator_Init(BgMoriElevator* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index f3df1a1d31..4798138b3e 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -1,6 +1,6 @@ #include "z_bg_mori_hashigo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgMoriHashigo_Init(BgMoriHashigo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index c5e37ef0ab..d96560db67 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -1,6 +1,6 @@ #include "z_bg_mori_hashira4.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgMoriHashira4_Init(BgMoriHashira4* this, GlobalContext* globalCtx); @@ -45,4 +45,3 @@ const ActorInit Bg_Mori_Hashira4_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Hashira4/BgMoriHashira4_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Mori_Hashira4/func_808A3484.s") - diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 58b7f4c2f0..660c0b92a7 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -1,6 +1,6 @@ #include "z_bg_mori_hineri.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgMoriHineri_Init(BgMoriHineri* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index cf4c4cb668..c5fb920e52 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c @@ -1,6 +1,6 @@ #include "z_bg_mori_idomizu.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgMoriIdomizu_Init(BgMoriIdomizu* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 5bcd3a9df1..785455ce93 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -1,6 +1,6 @@ #include "z_bg_mori_kaitenkabe.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgMoriKaitenkabe_Init(BgMoriKaitenkabe* this, GlobalContext* globalCtx); 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 34fe919384..7be6743c65 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 @@ -1,6 +1,6 @@ #include "z_bg_mori_rakkatenjo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgMoriRakkatenjo_Init(BgMoriRakkatenjo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 3271de6882..729034661c 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -1,6 +1,6 @@ #include "z_bg_po_event.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgPoEvent_Init(BgPoEvent* this, GlobalContext* globalCtx); @@ -66,4 +66,3 @@ const ActorInit Bg_Po_Event_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Po_Event/BgPoEvent_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Po_Event/BgPoEvent_Draw.s") - diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index 0384263531..f9fe4197ae 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -1,6 +1,6 @@ #include "z_bg_po_syokudai.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgPoSyokudai_Init(BgPoSyokudai* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c index e870466ddf..a2fc2c41d5 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c @@ -2,11 +2,11 @@ * File: z_bg_pushbox.c * Overlay: ovl_Bg_Pushbox * Description: -*/ + */ #include "z_bg_pushbox.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void func_808A8AE0(BgPushbox* this, ActorFunc actionFunc); @@ -16,8 +16,7 @@ static void func_808A8BAC(BgPushbox* this, GlobalContext* globalCtx); static void BgPushbox_Update(BgPushbox* this, GlobalContext* globalCtx); static void BgPushbox_Draw(BgPushbox* this, GlobalContext* globalCtx); -const ActorInit Bg_Pushbox_InitVars = -{ +const ActorInit Bg_Pushbox_InitVars = { ACTOR_BG_PUSHBOX, ACTORTYPE_BG, ROOM, @@ -33,18 +32,15 @@ const ActorInit Bg_Pushbox_InitVars = extern u32 D_06000000; extern u32 D_06000350; -static InitChainEntry initChain[] = -{ - ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP) +static InitChainEntry initChain[] = { + ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -static void func_808A8AE0(BgPushbox* this, ActorFunc actionFunc) -{ +static void func_808A8AE0(BgPushbox* this, ActorFunc actionFunc) { this->actionFunc = actionFunc; } -static void BgPushbox_Init(BgPushbox* this, GlobalContext* globalCtx) -{ +static void BgPushbox_Init(BgPushbox* this, GlobalContext* globalCtx) { s32 pad[2]; u32 local_c = 0; Actor* thisx = &this->dyna.actor; @@ -57,38 +53,34 @@ static void BgPushbox_Init(BgPushbox* this, GlobalContext* globalCtx) func_808A8AE0(this, &func_808A8BAC); } -static void BgPushbox_Destroy(BgPushbox* this, GlobalContext* globalCtx) -{ +static void BgPushbox_Destroy(BgPushbox* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void func_808A8BAC(BgPushbox* this, GlobalContext* globalCtx) -{ +static void func_808A8BAC(BgPushbox* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; thisx->speedXZ += this->dyna.unk_150 * 0.2f; - thisx->speedXZ = (thisx->speedXZ < -1.0f) ? -1.0f : - ((thisx->speedXZ > 1.0f) ? 1.0f : - thisx->speedXZ); + thisx->speedXZ = (thisx->speedXZ < -1.0f) ? -1.0f : ((thisx->speedXZ > 1.0f) ? 1.0f : thisx->speedXZ); Math_ApproxF(&thisx->speedXZ, 0.0f, 0.2f); thisx->posRot.rot.y = this->dyna.unk_158; Actor_MoveForward(thisx); func_8002E4B4(globalCtx, thisx, 20.0f, 40.0f, 40.0f, 0x1D); } -static void BgPushbox_Update(BgPushbox* this, GlobalContext* globalCtx){ +static void BgPushbox_Update(BgPushbox* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); func_8002DF90(this); } -static void BgPushbox_Draw(BgPushbox* this, GlobalContext* globalCtx) -{ +static void BgPushbox_Draw(BgPushbox* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 263); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 269), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 269), + G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, &D_06000000); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 272); } diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 5a8da07ce2..5a362160f0 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -1,6 +1,6 @@ #include "z_bg_relay_objects.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgRelayObjects_Init(BgRelayObjects* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c index 80ca6b1111..ccb41bd0ce 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Break/z_bg_spot00_break.c @@ -2,20 +2,19 @@ * File: z_bg_spot00_break.c * Overlay: ovl_Bg_Spot00_Break * Description: Broken drawbridge in Hyrule Field. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ u32 dynaPolyId; - /* 0x0150 */ char unk_150[0x14]; + /* 0x014C */ u32 dynaPolyId; + /* 0x0150 */ char unk_150[0x14]; } ActorSpot00Break; // size = 0x0164 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void Init(ActorSpot00Break* this, GlobalContext* globalCtx); @@ -23,8 +22,7 @@ static void Destroy(ActorSpot00Break* this, GlobalContext* globalCtx); static void Update(ActorSpot00Break* this, GlobalContext* globalCtx); static void Draw(ActorSpot00Break* this, GlobalContext* globalCtx); -const ActorInit Bg_Spot00_Break_InitVars = -{ +const ActorInit Bg_Spot00_Break_InitVars = { ACTOR_BG_SPOT00_BREAK, ACTORTYPE_PROP, ROOM, @@ -37,62 +35,49 @@ const ActorInit Bg_Spot00_Break_InitVars = (ActorFunc)Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_F32(unk_F8, 1200, ICHAIN_CONTINUE), ICHAIN_F32(unk_FC, 1200, ICHAIN_CONTINUE), ICHAIN_F32(unk_F4, 2000, ICHAIN_CONTINUE), - ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP) + ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -extern D_06000AF0; //segmented address: 0x06000AF0 -extern D_06000908; //segmented address: 0x06000908 -extern D_06000980; //segmented address: 0x06000980 -extern D_06000440; //segmented address: 0x06000440 +extern D_06000AF0; // segmented address: 0x06000AF0 +extern D_06000908; // segmented address: 0x06000908 +extern D_06000980; // segmented address: 0x06000980 +extern D_06000440; // segmented address: 0x06000440 -static void Init(ActorSpot00Break* this, GlobalContext* globalCtx) -{ +static void Init(ActorSpot00Break* this, GlobalContext* globalCtx) { s32 pad[2]; u32 local_c = 0; Actor_ProcessInitChain(&this->actor, initChain); DynaPolyInfo_SetActorMove(&this->actor, 0); - if (this->actor.params == 1) - { + if (this->actor.params == 1) { DynaPolyInfo_Alloc(&D_06000AF0, &local_c); - } - else - { + } else { DynaPolyInfo_Alloc(&D_06000908, &local_c); } this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, local_c); - if (LINK_IS_CHILD) - { + if (LINK_IS_CHILD) { Actor_Kill(&this->actor); } } -static void Destroy(ActorSpot00Break* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorSpot00Break* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void Update(ActorSpot00Break* this, GlobalContext* globalCtx) -{ - +static void Update(ActorSpot00Break* this, GlobalContext* globalCtx) { } -static void Draw(ActorSpot00Break* this, GlobalContext* globalCtx) -{ - if (this->actor.params == 1) - { +static void Draw(ActorSpot00Break* this, GlobalContext* globalCtx) { + if (this->actor.params == 1) { Draw_DListOpa(globalCtx, &D_06000980); - } - else - { + } else { Draw_DListOpa(globalCtx, &D_06000440); } } 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 ff9f65d0dd..1d32da9c50 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 @@ -1,6 +1,6 @@ #include "z_bg_spot00_hanebasi.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgSpot00Hanebasi_Init(BgSpot00Hanebasi* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index a9cd342a23..682e091ae6 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c @@ -2,13 +2,12 @@ * File: z_bg_spot01_fusya.c * Overlay: Bg_Spot01_Fusya * Description: Windmill Sails -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ char unk_150[0x4]; @@ -17,7 +16,7 @@ typedef struct /* 0x015C */ f32 unk_15C; } BgSpot01Fusya; // size = 0x0160 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void BgSpot01Fusya_Init(BgSpot01Fusya* this, GlobalContext* globalCtx); @@ -27,8 +26,7 @@ static void BgSpot01Fusya_Draw(BgSpot01Fusya* this, GlobalContext* globalCtx); static void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx); -const ActorInit Bg_Spot01_Fusya_InitVars = -{ +const ActorInit Bg_Spot01_Fusya_InitVars = { ACTOR_BG_SPOT01_FUSYA, ACTORTYPE_BG, ROOM, @@ -41,45 +39,37 @@ const ActorInit Bg_Spot01_Fusya_InitVars = (ActorFunc)BgSpot01Fusya_Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(unk_F4, 12800, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 1300, ICHAIN_CONTINUE), - ICHAIN_F32(unk_FC, 1300, ICHAIN_STOP) + ICHAIN_F32(unk_FC, 1300, ICHAIN_STOP), }; extern u32 D_06000100; -static void BgSpot01Fusya_SetupAction(BgSpot01Fusya* this, ActorFunc actionFunc) -{ +static void BgSpot01Fusya_SetupAction(BgSpot01Fusya* this, ActorFunc actionFunc) { this->actionFunc = actionFunc; } -static void BgSpot01Fusya_Init(BgSpot01Fusya* this, GlobalContext* globalCtx) -{ +static void BgSpot01Fusya_Init(BgSpot01Fusya* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, initChain); this->unk_154 = 100.0f; this->unk_158 = 100.0f; this->unk_15C = 0.5f; - if (gSaveContext.scene_setup_index < 4) - { + if (gSaveContext.scene_setup_index < 4) { gSaveContext.event_chk_inf[6] &= 0xFFDF; } BgSpot01Fusya_SetupAction(this, func_808AAA50); } -static void BgSpot01Fusya_Destroy(BgSpot01Fusya* this, GlobalContext* globalCtx) -{ - +static void BgSpot01Fusya_Destroy(BgSpot01Fusya* this, GlobalContext* globalCtx) { } -static void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) -{ +static void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) { f32 temp; Actor* thisx = &this->actor; - if (gSaveContext.event_chk_inf[6] & 0x20) - { + if (gSaveContext.event_chk_inf[6] & 0x20) { this->unk_158 = 1800.0f; } thisx->shape.rot.z += this->unk_154; @@ -88,13 +78,11 @@ static void func_808AAA50(BgSpot01Fusya* this, GlobalContext* globalCtx) Math_SmoothScaleMaxF(&this->unk_154, this->unk_158, this->unk_15C, 100.0f); } -static void BgSpot01Fusya_Update(BgSpot01Fusya* this, GlobalContext* globalCtx) -{ +static void BgSpot01Fusya_Update(BgSpot01Fusya* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } -static void BgSpot01Fusya_Draw(BgSpot01Fusya* this, GlobalContext* globalCtx) -{ +static void BgSpot01Fusya_Draw(BgSpot01Fusya* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; 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 9e80e4d085..016173178f 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 @@ -1,6 +1,6 @@ #include "z_bg_spot01_idohashira.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgSpot01Idohashira_Init(BgSpot01Idohashira* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c index 4a7357fae8..ff77d423af 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c @@ -1,6 +1,6 @@ #include "z_bg_spot01_idomizu.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000020 void BgSpot01Idomizu_Init(BgSpot01Idomizu* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c index 7c6ef6c872..6520fe9764 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c @@ -2,18 +2,17 @@ * File: z_bg_spot01_idosoko.c * Overlay: Bg_Spot01_Idosoko * Description: Stone blocking entrance to Bottom of the Well -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ ActorFunc actionFunc; } BgSpot01Idosoko; // size = 0x0168 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void BgSpot01Idosoko_Init(BgSpot01Idosoko* this, GlobalContext* globalCtx); @@ -23,8 +22,7 @@ static void BgSpot01Idosoko_Draw(BgSpot01Idosoko* this, GlobalContext* globalCtx static void func_808ABF54(BgSpot01Idosoko* this, GlobalContext* globalCtx); -const ActorInit Bg_Spot01_Idosoko_InitVars = -{ +const ActorInit Bg_Spot01_Idosoko_InitVars = { ACTOR_BG_SPOT01_IDOSOKO, ACTORTYPE_BG, ROOM, @@ -37,20 +35,17 @@ const ActorInit Bg_Spot01_Idosoko_InitVars = (ActorFunc)BgSpot01Idosoko_Draw, }; -static InitChainEntry initChain[] = -{ - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP) +static InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; extern u32 D_06003C64; -static void BgSpot01Idosoko_SetupAction(BgSpot01Idosoko* this, ActorFunc actionFunc) -{ +static void BgSpot01Idosoko_SetupAction(BgSpot01Idosoko* this, ActorFunc actionFunc) { this->actionFunc = actionFunc; } -static void BgSpot01Idosoko_Init(BgSpot01Idosoko* this, GlobalContext* globalCtx) -{ +static void BgSpot01Idosoko_Init(BgSpot01Idosoko* this, GlobalContext* globalCtx) { s32 pad[2]; s32 local_c = 0; Actor* thisx = &this->dyna.actor; @@ -58,35 +53,27 @@ static void BgSpot01Idosoko_Init(BgSpot01Idosoko* this, GlobalContext* globalCtx Actor_ProcessInitChain(thisx, initChain); DynaPolyInfo_Alloc(&D_06003C64, &local_c); this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); - if (LINK_IS_CHILD) - { + if (LINK_IS_CHILD) { Actor_Kill(thisx); - } - else - { + } else { BgSpot01Idosoko_SetupAction(this, func_808ABF54); } } -static void BgSpot01Idosoko_Destroy(BgSpot01Idosoko* this, GlobalContext* globalCtx) -{ +static void BgSpot01Idosoko_Destroy(BgSpot01Idosoko* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void func_808ABF54(BgSpot01Idosoko* this, GlobalContext* globalCtx) -{ - +static void func_808ABF54(BgSpot01Idosoko* this, GlobalContext* globalCtx) { } -static void BgSpot01Idosoko_Update(BgSpot01Idosoko* this, GlobalContext* globalCtx) -{ +static void BgSpot01Idosoko_Update(BgSpot01Idosoko* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } extern u32 D_06003B20; -static void BgSpot01Idosoko_Draw(BgSpot01Idosoko* this, GlobalContext* globalCtx) -{ +static void BgSpot01Idosoko_Draw(BgSpot01Idosoko* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index db61823bc2..e59a1179ee 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -1,6 +1,6 @@ #include "z_bg_spot01_objects2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgSpot01Objects2_Init(BgSpot01Objects2* this, GlobalContext* globalCtx); 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 42eab0a1ef..c39d81d061 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 @@ -1,6 +1,6 @@ #include "z_bg_spot02_objects.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgSpot02Objects_Init(BgSpot02Objects* this, GlobalContext* globalCtx); 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 a0bcdaff19..5504379eb8 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 @@ -1,6 +1,6 @@ #include "z_bg_spot03_taki.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgSpot03Taki_Init(BgSpot03Taki* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c index b54b188258..62e45d39e2 100644 --- a/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c +++ b/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c @@ -1,6 +1,6 @@ #include "z_bg_spot05_soko.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot05Soko_Init(BgSpot05Soko* this, GlobalContext* globalCtx); @@ -36,6 +36,3 @@ const ActorInit Bg_Spot05_Soko_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Draw.s") - - - 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 0e7d3df219..a57f4b8d2d 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 @@ -1,6 +1,6 @@ #include "z_bg_spot06_objects.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000200 void BgSpot06Objects_Init(BgSpot06Objects* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c index 04d6b4fe8d..9ac3a245b3 100644 --- a/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot07_Taki/z_bg_spot07_taki.c @@ -1,6 +1,6 @@ #include "z_bg_spot07_taki.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgSpot07Taki_Init(BgSpot07Taki* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index 6b2ec19a86..915a39ba67 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -1,6 +1,6 @@ #include "z_bg_spot08_bakudankabe.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00400000 void BgSpot08Bakudankabe_Init(BgSpot08Bakudankabe* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index f09dff924a..5f1848ddfe 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -1,6 +1,6 @@ #include "z_bg_spot08_iceblock.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot08Iceblock_Init(BgSpot08Iceblock* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 199c382bbb..7518d97c4e 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -1,6 +1,6 @@ #include "z_bg_spot09_obj.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index ab85ada086..e15d4658f2 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c @@ -1,6 +1,6 @@ #include "z_bg_spot11_bakudankabe.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgSpot11Bakudankabe_Init(BgSpot11Bakudankabe* this, GlobalContext* globalCtx); 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 cd556b53f6..4848c81181 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 @@ -1,6 +1,6 @@ #include "z_bg_spot11_oasis.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgSpot11Oasis_Init(BgSpot11Oasis* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 479fc12d2e..87aac0132e 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -1,6 +1,6 @@ #include "z_bg_spot12_gate.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index 3297978f4f..df1dfd43d2 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -1,6 +1,6 @@ #include "z_bg_spot12_saku.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot12Saku_Init(BgSpot12Saku* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 1091061b4f..5ef865590b 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -1,6 +1,6 @@ #include "z_bg_spot15_rrbox.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot15Rrbox_Init(BgSpot15Rrbox* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c index aa3208cfe6..52a6f59441 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c @@ -2,11 +2,11 @@ * File: z_bg_spot15_saku.c * Overlay: ovl_Bg_Spot15_Saku * Description: -*/ + */ #include "z_bg_spot15_saku.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot15Saku_Init(BgSpot15Saku* this, GlobalContext* globalCtx); @@ -18,8 +18,7 @@ void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx); void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx); void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx); -const ActorInit Bg_Spot15_Saku_InitVars = -{ +const ActorInit Bg_Spot15_Saku_InitVars = { ACTOR_BG_SPOT15_SAKU, ACTORTYPE_ITEMACTION, ROOM, @@ -35,8 +34,7 @@ const ActorInit Bg_Spot15_Saku_InitVars = extern u32 D_060003C0; extern u32 D_060004D0; -void BgSpot15Saku_Init(BgSpot15Saku* this, GlobalContext* globalCtx) -{ +void BgSpot15Saku_Init(BgSpot15Saku* this, GlobalContext* globalCtx) { s32 pad[2]; Actor* thisx = &this->dyna.actor; s32 local_c = 0; @@ -50,27 +48,23 @@ void BgSpot15Saku_Init(BgSpot15Saku* this, GlobalContext* globalCtx) this->unk_170 = thisx->posRot.pos.x; this->unk_174 = thisx->posRot.pos.y; this->unk_178 = thisx->posRot.pos.z; - if ((gSaveContext.inf_table[7] & 2) != 0) - { + if ((gSaveContext.inf_table[7] & 2) != 0) { thisx->posRot.pos.z = 2659.0f; } this->actionFunc = func_808B4930; } -void BgSpot15Saku_Destroy(BgSpot15Saku* this, GlobalContext* globalCtx) -{ +void BgSpot15Saku_Destroy(BgSpot15Saku* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } #ifdef NON_MATCHING // regalloc differences -void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) -{ +void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) { void* temp = this->unk_168; void* temp2 = this->unk_16C; - if ((temp != NULL || temp2 != NULL) && !(gSaveContext.inf_table[7] & 2)) - { + if ((temp != NULL || temp2 != NULL) && !(gSaveContext.inf_table[7] & 2)) { this->unk_17C = 2; this->actionFunc = func_808B4978; } @@ -79,15 +73,12 @@ void func_808B4930(BgSpot15Saku* this, GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot15_Saku/func_808B4930.s") #endif -void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) -{ +void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (!this->unk_17C) - { + if (!this->unk_17C) { Audio_PlayActorSound2(thisx, 0x2067); thisx->posRot.pos.z -= 2.0f; - if (thisx->posRot.pos.z < 2660.0f) - { + if (thisx->posRot.pos.z < 2660.0f) { Audio_PlayActorSound2(thisx, 0x280E); this->unk_17C = 0x1E; this->actionFunc = func_808B4A04; @@ -97,10 +88,8 @@ void func_808B4978(BgSpot15Saku* this, GlobalContext* globalCtx) #ifdef NON_MATCHING // single regalloc difference -void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) -{ - if (this->unk_17C == 0) - { +void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) { + if (this->unk_17C == 0) { this->unk_168 = 0 & 0xFFFFFFFFFFFFFFFF; this->unk_16C = 0 & 0xFFFFFFFFFFFFFFFF; this->actionFunc = func_808B4930; @@ -110,14 +99,12 @@ void func_808B4A04(BgSpot15Saku* this, GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot15_Saku/func_808B4A04.s") #endif -void BgSpot15Saku_Update(BgSpot15Saku* this, GlobalContext* globalCtx) -{ +void BgSpot15Saku_Update(BgSpot15Saku* this, GlobalContext* globalCtx) { DECR(this->unk_17C); this->actionFunc(this, globalCtx); } -void BgSpot15Saku_Draw(BgSpot15Saku* this, GlobalContext* globalCtx) -{ +void BgSpot15Saku_Draw(BgSpot15Saku* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[4]; 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 d400221d14..fbf7847aaf 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 @@ -1,6 +1,6 @@ #include "z_bg_spot16_bombstone.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgSpot16Bombstone_Init(BgSpot16Bombstone* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c index 6b1159eaa0..5ec81828d5 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c @@ -1,6 +1,6 @@ #include "z_bg_spot16_doughnut.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot16Doughnut_Init(BgSpot16Doughnut* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index 233f372510..5ec76c9240 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -1,6 +1,6 @@ #include "z_bg_spot17_bakudankabe.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot17Bakudankabe_Init(BgSpot17Bakudankabe* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c index a105f6359c..bc70d2436b 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c @@ -1,6 +1,6 @@ #include "z_bg_spot17_funen.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgSpot17Funen_Init(BgSpot17Funen* this, GlobalContext* globalCtx); 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 acc207c4ab..774c115b13 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 @@ -1,6 +1,6 @@ #include "z_bg_spot18_basket.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgSpot18Basket_Init(BgSpot18Basket* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c index 2146b2b190..05cb5e107e 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.c @@ -2,17 +2,16 @@ * File: z_bg_spot18_futa.c * Overlay: ovl_Bg_Spot18_Futa * Description: The lid to a goron jar. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ u32 dynaPolyId; - /* 0x0150 */ u32 unk_150[0x5]; + /* 0x014C */ u32 dynaPolyId; + /* 0x0150 */ u32 unk_150[0x5]; } ActorSpot18Futa; // size = 0x0154 #define ROOM 0x00 @@ -23,8 +22,7 @@ static void Destroy(ActorSpot18Futa* this, GlobalContext* globalCtx); static void Update(ActorSpot18Futa* this, GlobalContext* globalCtx); static void Draw(ActorSpot18Futa* this, GlobalContext* globalCtx); -const ActorInit Bg_Spot18_Futa_InitVars = -{ +const ActorInit Bg_Spot18_Futa_InitVars = { ACTOR_BG_SPOT18_FUTA, ACTORTYPE_PROP, ROOM, @@ -37,19 +35,17 @@ const ActorInit Bg_Spot18_Futa_InitVars = (ActorFunc)Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(unk_F4, 1000, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 500, ICHAIN_CONTINUE), - ICHAIN_F32(unk_FC, 1000, ICHAIN_STOP) + ICHAIN_F32(unk_FC, 1000, ICHAIN_STOP), }; -extern u32 DL_SPOT18_FUTA; // 0x6000368 +extern u32 DL_SPOT18_FUTA; // 0x6000368 extern u32 DL_SPOT18_FUTA2; // 0x6000150 -static void Init(ActorSpot18Futa* this, GlobalContext* globalCtx) -{ +static void Init(ActorSpot18Futa* this, GlobalContext* globalCtx) { s32 pad[2]; u32 sp1C = 0; @@ -59,32 +55,25 @@ static void Init(ActorSpot18Futa* this, GlobalContext* globalCtx) Actor_ProcessInitChain(&this->actor, initChain); } -static void Destroy(ActorSpot18Futa* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorSpot18Futa* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void Update(ActorSpot18Futa* this, GlobalContext* globalCtx) -{ +static void Update(ActorSpot18Futa* this, GlobalContext* globalCtx) { s32 iVar1; - if (this->actor.attachedA == NULL) - { + if (this->actor.attachedA == NULL) { iVar1 = Math_ApproxF(&this->actor.scale.x, 0, 0.005); - if (iVar1 != 0) - { + if (iVar1 != 0) { Actor_Kill(&this->actor); - } - else - { + } else { this->actor.scale.z = this->actor.scale.x; this->actor.scale.y = this->actor.scale.x; } } } -static void Draw(ActorSpot18Futa* this, GlobalContext* globalCtx) -{ +static void Draw(ActorSpot18Futa* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &DL_SPOT18_FUTA2); } 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 4020fc96d2..4f65b2e911 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 @@ -1,6 +1,6 @@ #include "z_bg_spot18_obj.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgSpot18Obj_Init(BgSpot18Obj* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index c551a419a8..58d9ab2792 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -1,6 +1,6 @@ #include "z_bg_spot18_shutter.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgSpot18Shutter_Init(BgSpot18Shutter* this, GlobalContext* globalCtx); @@ -40,6 +40,3 @@ const ActorInit Bg_Spot18_Shutter_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Draw.s") - - - diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index 02050e74eb..0283b0a006 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -1,6 +1,6 @@ #include "z_bg_sst_floor.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgSstFloor_Init(BgSstFloor* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c index f1a3b465d3..e00e526425 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c @@ -1,6 +1,6 @@ #include "z_bg_toki_hikari.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000020 void BgTokiHikari_Init(BgTokiHikari* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index 459d1d3360..d87c2f1362 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -2,11 +2,11 @@ * File: z_bg_toki_swd.c * Overlay: ovl_Bg_Toki_Swd * Description: Master Sword (Contains Cutscenes) -*/ + */ #include "z_bg_toki_swd.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx); @@ -20,289 +20,137 @@ static void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx); extern u32 D_06001BD0; -static u32 D_808BB2F0[] = -{ - 0x00000009, 0x000001A9, 0x0000000A, 0x00000001, - 0x000C0000, 0x01000000, 0x00000000, 0x00000000, - 0x00000036, 0x00000034, 0x00000000, 0x00000036, - 0x00000034, 0x00000000, 0x00000000, 0x00000000, - 0x00000004, 0x00000001, 0x0002006E, 0x006F0000, - 0x00000000, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, - 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x000A006E, 0x006F0000, 0x00000000, 0x00000000, - 0x0000002E, 0xFFFFFFE6, 0x00000000, 0x0000002E, - 0xFFFFFFE6, 0x00000000, 0x00000000, 0x00000000, - 0x000003E8, 0x00000001, 0x000800E6, 0x00E700E7, - 0x0000002D, 0x00000001, 0x000100D2, 0x00E600E6, - 0x00000001, 0x00010000, 0x00F10000, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD9018C, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD9019D, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD901AE, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD902A8, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD90000, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD9007A, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD90064, 0x00000000, - 0x42700000, 0xFFD60048, 0xFFD90074, 0xFF000000, - 0x42700000, 0xFFD60048, 0xFFD9005F, 0x00000001, - 0x00010050, 0x01960000, 0x00000000, 0x42700000, - 0xFFFF005F, 0xFFED2F73, 0x00000000, 0x42700000, - 0xFFFF005F, 0xFFED6B2F, 0x00000000, 0x42700000, - 0xFFFF005F, 0xFFED6169, 0x00000000, 0x42700000, - 0xFFFF005F, 0xFFED0000, 0x00000000, 0x42700000, - 0xFFFF005F, 0xFFED0005, 0x00000000, 0x42700000, - 0xFFFF0081, 0xFFDE7961, 0x00000000, 0x42700000, - 0xFFFF00AD, 0xFFED742F, 0x00000000, 0x42700000, - 0xFFEF00D9, 0xFFEC2E64, 0x00000000, 0x42700000, - 0xFFE80148, 0xFFF40000, 0x00000000, 0x42700000, - 0xFFE501FD, 0xFFFE2F73, 0x00000000, 0x42700000, - 0xFFD7032D, 0x000A6B2F, 0x00000000, 0x42700000, - 0xFFC40505, 0x00266D61, 0x00000000, 0x42700000, - 0xFFC60776, 0x005B0000, 0x00000000, 0x42700000, - 0xFFCB09DE, 0x00850005, 0x00000000, 0x42700000, - 0xFFDF0D75, 0x00C17961, 0x00000000, 0x42700000, - 0x00000F78, 0x00E1742F, 0x00000000, 0x42700000, - 0x000710DD, 0x00F56565, 0x00000000, 0x42700000, - 0x000710DC, 0x00F50000, 0x00000000, 0x42700000, - 0x000710DC, 0x00F52F73, 0xFF000000, 0x42700000, - 0x000710DC, 0x00F56B2F, 0x00000002, 0x00010000, - 0x010E0000, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF72F73, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF76B2F, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF76169, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF70000, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF70005, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF77961, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF7742F, 0x0000001E, 0x42700000, 0xFFEC0055, - 0xFFF72E64, 0xFF00001E, 0x42700000, 0xFFEC0055, - 0xFFF70000, 0x00000002, 0x00010050, 0x01A90000, - 0x00000005, 0x42700000, 0xFFFF0070, 0x00072F73, - 0x00000005, 0x42700000, 0xFFFF0070, 0x00076B2F, - 0x00000005, 0x42700000, 0xFFFF0070, 0x00076169, - 0x00000005, 0x42700000, 0xFFFF0070, 0x00070000, - 0x0000000F, 0x42700000, 0xFFFF0070, 0x00070005, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00077961, - 0x00000019, 0x42700000, 0xFFFF0075, 0x0007742F, - 0x00000019, 0x42700000, 0xFFFF0075, 0x00072E64, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00070000, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00072F73, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00076B2F, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00076D61, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00070000, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00070005, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00077961, - 0x00000014, 0x42700000, 0xFFFF0075, 0x0007742F, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00076565, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00070000, - 0x00000014, 0x42700000, 0xFFFF0075, 0x00072F73, - 0xFF000014, 0x42700000, 0xFFFF0075, 0x00076B2F, - 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, +static u32 D_808BB2F0[] = { + 0x00000009, 0x000001A9, 0x0000000A, 0x00000001, 0x000C0000, 0x01000000, 0x00000000, 0x00000000, 0x00000036, + 0x00000034, 0x00000000, 0x00000036, 0x00000034, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000001, + 0x0002006E, 0x006F0000, 0x00000000, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x000A006E, 0x006F0000, 0x00000000, 0x00000000, + 0x0000002E, 0xFFFFFFE6, 0x00000000, 0x0000002E, 0xFFFFFFE6, 0x00000000, 0x00000000, 0x00000000, 0x000003E8, + 0x00000001, 0x000800E6, 0x00E700E7, 0x0000002D, 0x00000001, 0x000100D2, 0x00E600E6, 0x00000001, 0x00010000, + 0x00F10000, 0x00000000, 0x42700000, 0xFFD60048, 0xFFD9018C, 0x00000000, 0x42700000, 0xFFD60048, 0xFFD9019D, + 0x00000000, 0x42700000, 0xFFD60048, 0xFFD901AE, 0x00000000, 0x42700000, 0xFFD60048, 0xFFD902A8, 0x00000000, + 0x42700000, 0xFFD60048, 0xFFD90000, 0x00000000, 0x42700000, 0xFFD60048, 0xFFD9007A, 0x00000000, 0x42700000, + 0xFFD60048, 0xFFD90064, 0x00000000, 0x42700000, 0xFFD60048, 0xFFD90074, 0xFF000000, 0x42700000, 0xFFD60048, + 0xFFD9005F, 0x00000001, 0x00010050, 0x01960000, 0x00000000, 0x42700000, 0xFFFF005F, 0xFFED2F73, 0x00000000, + 0x42700000, 0xFFFF005F, 0xFFED6B2F, 0x00000000, 0x42700000, 0xFFFF005F, 0xFFED6169, 0x00000000, 0x42700000, + 0xFFFF005F, 0xFFED0000, 0x00000000, 0x42700000, 0xFFFF005F, 0xFFED0005, 0x00000000, 0x42700000, 0xFFFF0081, + 0xFFDE7961, 0x00000000, 0x42700000, 0xFFFF00AD, 0xFFED742F, 0x00000000, 0x42700000, 0xFFEF00D9, 0xFFEC2E64, + 0x00000000, 0x42700000, 0xFFE80148, 0xFFF40000, 0x00000000, 0x42700000, 0xFFE501FD, 0xFFFE2F73, 0x00000000, + 0x42700000, 0xFFD7032D, 0x000A6B2F, 0x00000000, 0x42700000, 0xFFC40505, 0x00266D61, 0x00000000, 0x42700000, + 0xFFC60776, 0x005B0000, 0x00000000, 0x42700000, 0xFFCB09DE, 0x00850005, 0x00000000, 0x42700000, 0xFFDF0D75, + 0x00C17961, 0x00000000, 0x42700000, 0x00000F78, 0x00E1742F, 0x00000000, 0x42700000, 0x000710DD, 0x00F56565, + 0x00000000, 0x42700000, 0x000710DC, 0x00F50000, 0x00000000, 0x42700000, 0x000710DC, 0x00F52F73, 0xFF000000, + 0x42700000, 0x000710DC, 0x00F56B2F, 0x00000002, 0x00010000, 0x010E0000, 0x0000001E, 0x42700000, 0xFFEC0055, + 0xFFF72F73, 0x0000001E, 0x42700000, 0xFFEC0055, 0xFFF76B2F, 0x0000001E, 0x42700000, 0xFFEC0055, 0xFFF76169, + 0x0000001E, 0x42700000, 0xFFEC0055, 0xFFF70000, 0x0000001E, 0x42700000, 0xFFEC0055, 0xFFF70005, 0x0000001E, + 0x42700000, 0xFFEC0055, 0xFFF77961, 0x0000001E, 0x42700000, 0xFFEC0055, 0xFFF7742F, 0x0000001E, 0x42700000, + 0xFFEC0055, 0xFFF72E64, 0xFF00001E, 0x42700000, 0xFFEC0055, 0xFFF70000, 0x00000002, 0x00010050, 0x01A90000, + 0x00000005, 0x42700000, 0xFFFF0070, 0x00072F73, 0x00000005, 0x42700000, 0xFFFF0070, 0x00076B2F, 0x00000005, + 0x42700000, 0xFFFF0070, 0x00076169, 0x00000005, 0x42700000, 0xFFFF0070, 0x00070000, 0x0000000F, 0x42700000, + 0xFFFF0070, 0x00070005, 0x00000014, 0x42700000, 0xFFFF0075, 0x00077961, 0x00000019, 0x42700000, 0xFFFF0075, + 0x0007742F, 0x00000019, 0x42700000, 0xFFFF0075, 0x00072E64, 0x00000014, 0x42700000, 0xFFFF0075, 0x00070000, + 0x00000014, 0x42700000, 0xFFFF0075, 0x00072F73, 0x00000014, 0x42700000, 0xFFFF0075, 0x00076B2F, 0x00000014, + 0x42700000, 0xFFFF0075, 0x00076D61, 0x00000014, 0x42700000, 0xFFFF0075, 0x00070000, 0x00000014, 0x42700000, + 0xFFFF0075, 0x00070005, 0x00000014, 0x42700000, 0xFFFF0075, 0x00077961, 0x00000014, 0x42700000, 0xFFFF0075, + 0x0007742F, 0x00000014, 0x42700000, 0xFFFF0075, 0x00076565, 0x00000014, 0x42700000, 0xFFFF0075, 0x00070000, + 0x00000014, 0x42700000, 0xFFFF0075, 0x00072F73, 0xFF000014, 0x42700000, 0xFFFF0075, 0x00076B2F, 0xFFFFFFFF, + 0x00000000, 0x00000000, 0x00000000, }; -static u32 D_808BB7A0[] = -{ - 0x00000009, 0x00000170, 0x00000001, 0x00010000, - 0x007E0000, 0x00000000, 0x42700000, 0xFFFF0065, - 0xFF92616D, 0x00000000, 0x42200000, 0xFFFF0065, - 0xFF926964, 0x00000000, 0x42200000, 0xFFFF0065, - 0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0065, - 0xFF920111, 0x00000000, 0x42200000, 0xFFFF0065, - 0xFF93012D, 0x00000000, 0x42200000, 0xFFFF0047, - 0xFF920033, 0x00000000, 0x42200000, 0xFFFF0048, - 0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0048, - 0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0048, - 0xFF922F68, 0xFF000000, 0x42200000, 0xFFFF0048, - 0xFF92612F, 0x00000001, 0x0001003A, 0x01530000, - 0x00000000, 0x42700001, 0xFFF7006A, 0xFFFDA1BC, - 0x00000000, 0x42700000, 0xFFF7006A, 0xFFFDA5F3, - 0x00000000, 0x42700000, 0xFFF7006A, 0xFFFDA5EB, - 0x00000000, 0x42700000, 0xFFF7006A, 0xFFFDA5A2, - 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBBAEE, - 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBC9B8, - 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCB0020, - 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBA5A4, - 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCB0020, - 0x00000000, 0x42700000, 0xFFAD0066, 0xFFD6A5E1, - 0x00000000, 0x42700000, 0xFF8C0051, 0xFFEDA5D0, - 0x00000000, 0x42700000, 0xFF8A0051, 0x00360020, - 0x00000000, 0x42700000, 0xFF96004E, 0x0074A5A6, - 0x00000000, 0x42700000, 0xFFE5004B, 0x00E2A5E5, - 0x00000000, 0x42700000, 0x00790052, 0x0138C0AE, - 0x00000000, 0x42700000, 0x0128004C, 0x0176A5E5, - 0x00000000, 0x42700000, 0x02350050, 0x01010020, - 0x00000000, 0x42700000, 0x02660050, 0xFFFFA5EB, - 0x00000000, 0x42700000, 0x02520050, 0xFF6FA5E1, - 0x00000000, 0x42700000, 0x01DB0050, 0xFE840020, - 0x00000000, 0x42700000, 0x01430050, 0xFDFFA5E1, - 0x00000000, 0x42700000, 0x00C00050, 0xFDC2A5D0, - 0x00000000, 0x42700000, 0xFFD30050, 0xFDA40020, - 0x00000000, 0x42700000, 0xFF720050, 0xFDB3A5A6, - 0x00000000, 0x42700000, 0xFF1C0050, 0xFDCEA5E5, - 0x00000000, 0x42700000, 0xFE88005D, 0xFE23C0AE, - 0x00000000, 0x42700000, 0xFDB8005F, 0xFF49A5E5, - 0x00000000, 0x42700000, 0xFD9B005F, 0xFFDE0020, - 0xFF000000, 0x42700000, 0xFDAD005F, 0x00A1A5EB, - 0x00000002, 0x00010000, 0x009B0000, 0x00000005, - 0x4221999A, 0xFFFF006F, 0x0005A1BC, 0x00000005, - 0x42200000, 0xFFFF006F, 0x0005A5F3, 0x00000005, - 0x42200000, 0xFFFF006F, 0x0005A5EB, 0x0000000F, - 0x42200000, 0xFFFF006F, 0x0005A5A2, 0x0000000F, - 0x42200000, 0xFFFF006F, 0x0005BAEE, 0x0000000F, - 0x42200000, 0xFFFF0068, 0x0008C9B8, 0x00000005, - 0x42200000, 0xFFFF0068, 0x00080020, 0x0000001E, - 0x42200000, 0xFFFF0068, 0x0008A5A4, 0x0000001E, - 0x42200000, 0xFFFF0068, 0x00080020, 0xFF00001E, - 0x42200000, 0xFFFF0068, 0x0008A5E1, 0x00000002, - 0x0001003A, 0x01700000, 0x00000005, 0x42700001, - 0x00000078, 0x000CA1BC, 0x00000005, 0x42700000, - 0x00000078, 0x000CA5F3, 0x00000005, 0x42700000, - 0x00000078, 0x000CA5EB, 0x0000000A, 0x42700000, - 0x00000078, 0x000CA5A2, 0x00000005, 0x42700000, - 0xFFFF005F, 0x000BBAEE, 0x00000005, 0x42700000, - 0xFFFF005F, 0x000BC9B8, 0x00000005, 0x42700000, - 0xFFFF005F, 0x000B0020, 0x00000005, 0x42700000, - 0xFFFF005F, 0x000BA5A4, 0x00000005, 0x42700000, - 0xFFFF005F, 0x000B0020, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008A5E1, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008A5D0, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x00080020, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008A5A6, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008A5E5, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008C0AE, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008A5E5, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x00080020, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008A5EB, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x0008A5E1, 0x0000000A, 0x42700000, - 0xFFFD005F, 0x00080020, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x0008A5E1, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x0008A5D0, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x00080020, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x0008A5A6, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x0008A5E5, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x0008C0AE, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x0008A5E5, 0x0000000F, 0x42700000, - 0xFFFD005F, 0x00080020, 0xFF00001E, 0x42700000, - 0xFFFD005F, 0x0008A5EB, 0x0000000A, 0x00000001, - 0x000C0000, 0x00B40000, 0x00000000, 0x00000000, - 0x0000001C, 0xFFFFFFF6, 0x00000000, 0xFFFFFFF2, - 0x00000009, 0x00000000, 0xBE6EEEEF, 0x00000000, - 0x00000004, 0x00000001, 0x0002005A, 0x005B0000, - 0x00000000, 0x00000000, 0xFFFFFFF2, 0x00000024, - 0x00000000, 0xFFFFFFF2, 0x00000024, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, - 0x000A005A, 0x005B0000, 0x00000000, 0x00000000, - 0xFFFFFFF8, 0xFFFFFFDD, 0x00000000, 0xFFFFFFF8, - 0xFFFFFFDD, 0x00000000, 0x00000000, 0x00000000, - 0x0000002D, 0x00000001, 0x000100BE, 0x00D200D2, - 0x000003E8, 0x00000001, 0x000800D2, 0x00D300D3, - 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, +static u32 D_808BB7A0[] = { + 0x00000009, 0x00000170, 0x00000001, 0x00010000, 0x007E0000, 0x00000000, 0x42700000, 0xFFFF0065, 0xFF92616D, + 0x00000000, 0x42200000, 0xFFFF0065, 0xFF926964, 0x00000000, 0x42200000, 0xFFFF0065, 0xFF9200FB, 0x00000000, + 0x42200000, 0xFFFF0065, 0xFF920111, 0x00000000, 0x42200000, 0xFFFF0065, 0xFF93012D, 0x00000000, 0x42200000, + 0xFFFF0047, 0xFF920033, 0x00000000, 0x42200000, 0xFFFF0048, 0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0048, + 0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0048, 0xFF922F68, 0xFF000000, 0x42200000, 0xFFFF0048, 0xFF92612F, + 0x00000001, 0x0001003A, 0x01530000, 0x00000000, 0x42700001, 0xFFF7006A, 0xFFFDA1BC, 0x00000000, 0x42700000, + 0xFFF7006A, 0xFFFDA5F3, 0x00000000, 0x42700000, 0xFFF7006A, 0xFFFDA5EB, 0x00000000, 0x42700000, 0xFFF7006A, + 0xFFFDA5A2, 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBBAEE, 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBC9B8, + 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCB0020, 0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBA5A4, 0x00000000, + 0x42700000, 0xFFBD006C, 0xFFCB0020, 0x00000000, 0x42700000, 0xFFAD0066, 0xFFD6A5E1, 0x00000000, 0x42700000, + 0xFF8C0051, 0xFFEDA5D0, 0x00000000, 0x42700000, 0xFF8A0051, 0x00360020, 0x00000000, 0x42700000, 0xFF96004E, + 0x0074A5A6, 0x00000000, 0x42700000, 0xFFE5004B, 0x00E2A5E5, 0x00000000, 0x42700000, 0x00790052, 0x0138C0AE, + 0x00000000, 0x42700000, 0x0128004C, 0x0176A5E5, 0x00000000, 0x42700000, 0x02350050, 0x01010020, 0x00000000, + 0x42700000, 0x02660050, 0xFFFFA5EB, 0x00000000, 0x42700000, 0x02520050, 0xFF6FA5E1, 0x00000000, 0x42700000, + 0x01DB0050, 0xFE840020, 0x00000000, 0x42700000, 0x01430050, 0xFDFFA5E1, 0x00000000, 0x42700000, 0x00C00050, + 0xFDC2A5D0, 0x00000000, 0x42700000, 0xFFD30050, 0xFDA40020, 0x00000000, 0x42700000, 0xFF720050, 0xFDB3A5A6, + 0x00000000, 0x42700000, 0xFF1C0050, 0xFDCEA5E5, 0x00000000, 0x42700000, 0xFE88005D, 0xFE23C0AE, 0x00000000, + 0x42700000, 0xFDB8005F, 0xFF49A5E5, 0x00000000, 0x42700000, 0xFD9B005F, 0xFFDE0020, 0xFF000000, 0x42700000, + 0xFDAD005F, 0x00A1A5EB, 0x00000002, 0x00010000, 0x009B0000, 0x00000005, 0x4221999A, 0xFFFF006F, 0x0005A1BC, + 0x00000005, 0x42200000, 0xFFFF006F, 0x0005A5F3, 0x00000005, 0x42200000, 0xFFFF006F, 0x0005A5EB, 0x0000000F, + 0x42200000, 0xFFFF006F, 0x0005A5A2, 0x0000000F, 0x42200000, 0xFFFF006F, 0x0005BAEE, 0x0000000F, 0x42200000, + 0xFFFF0068, 0x0008C9B8, 0x00000005, 0x42200000, 0xFFFF0068, 0x00080020, 0x0000001E, 0x42200000, 0xFFFF0068, + 0x0008A5A4, 0x0000001E, 0x42200000, 0xFFFF0068, 0x00080020, 0xFF00001E, 0x42200000, 0xFFFF0068, 0x0008A5E1, + 0x00000002, 0x0001003A, 0x01700000, 0x00000005, 0x42700001, 0x00000078, 0x000CA1BC, 0x00000005, 0x42700000, + 0x00000078, 0x000CA5F3, 0x00000005, 0x42700000, 0x00000078, 0x000CA5EB, 0x0000000A, 0x42700000, 0x00000078, + 0x000CA5A2, 0x00000005, 0x42700000, 0xFFFF005F, 0x000BBAEE, 0x00000005, 0x42700000, 0xFFFF005F, 0x000BC9B8, + 0x00000005, 0x42700000, 0xFFFF005F, 0x000B0020, 0x00000005, 0x42700000, 0xFFFF005F, 0x000BA5A4, 0x00000005, + 0x42700000, 0xFFFF005F, 0x000B0020, 0x0000000A, 0x42700000, 0xFFFD005F, 0x0008A5E1, 0x0000000A, 0x42700000, + 0xFFFD005F, 0x0008A5D0, 0x0000000A, 0x42700000, 0xFFFD005F, 0x00080020, 0x0000000A, 0x42700000, 0xFFFD005F, + 0x0008A5A6, 0x0000000A, 0x42700000, 0xFFFD005F, 0x0008A5E5, 0x0000000A, 0x42700000, 0xFFFD005F, 0x0008C0AE, + 0x0000000A, 0x42700000, 0xFFFD005F, 0x0008A5E5, 0x0000000A, 0x42700000, 0xFFFD005F, 0x00080020, 0x0000000A, + 0x42700000, 0xFFFD005F, 0x0008A5EB, 0x0000000A, 0x42700000, 0xFFFD005F, 0x0008A5E1, 0x0000000A, 0x42700000, + 0xFFFD005F, 0x00080020, 0x0000000F, 0x42700000, 0xFFFD005F, 0x0008A5E1, 0x0000000F, 0x42700000, 0xFFFD005F, + 0x0008A5D0, 0x0000000F, 0x42700000, 0xFFFD005F, 0x00080020, 0x0000000F, 0x42700000, 0xFFFD005F, 0x0008A5A6, + 0x0000000F, 0x42700000, 0xFFFD005F, 0x0008A5E5, 0x0000000F, 0x42700000, 0xFFFD005F, 0x0008C0AE, 0x0000000F, + 0x42700000, 0xFFFD005F, 0x0008A5E5, 0x0000000F, 0x42700000, 0xFFFD005F, 0x00080020, 0xFF00001E, 0x42700000, + 0xFFFD005F, 0x0008A5EB, 0x0000000A, 0x00000001, 0x000C0000, 0x00B40000, 0x00000000, 0x00000000, 0x0000001C, + 0xFFFFFFF6, 0x00000000, 0xFFFFFFF2, 0x00000009, 0x00000000, 0xBE6EEEEF, 0x00000000, 0x00000004, 0x00000001, + 0x0002005A, 0x005B0000, 0x00000000, 0x00000000, 0xFFFFFFF2, 0x00000024, 0x00000000, 0xFFFFFFF2, 0x00000024, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x000A005A, 0x005B0000, 0x00000000, 0x00000000, + 0xFFFFFFF8, 0xFFFFFFDD, 0x00000000, 0xFFFFFFF8, 0xFFFFFFDD, 0x00000000, 0x00000000, 0x00000000, 0x0000002D, + 0x00000001, 0x000100BE, 0x00D200D2, 0x000003E8, 0x00000001, 0x000800D2, 0x00D300D3, 0xFFFFFFFF, 0x00000000, + 0x00000000, 0x00000000, }; -static u32 D_808BBD90[] = -{ - 0x0000000B, 0x00000BB8, 0x00000021, 0x00000001, - 0x00010000, 0x0BB80000, 0x00000000, 0x00000000, - 0xFFFFFFF8, 0xFFFFFFFF, 0x00000000, 0xFFFFFFF8, - 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, - 0x0000000A, 0x00000003, 0x00050000, 0x00010000, - 0x80000000, 0x00000000, 0x00000000, 0x00000334, - 0x00000000, 0x00000000, 0x00000334, 0x00000000, - 0x00000000, 0x00000001, 0x00020001, 0x00100000, - 0x80000000, 0x00000000, 0x00000000, 0x00000334, - 0x00000000, 0x00000000, 0x000002D0, 0x00000000, - 0x00000000, 0x00000001, 0x00050010, 0x00B00000, - 0x80000000, 0x00000000, 0x00000000, 0x000002D0, - 0x00000000, 0x00000000, 0x000002D0, 0x00000000, - 0x00000000, 0x00000001, 0x0000003E, 0x00000003, - 0x00040028, 0x00467D74, 0x00000000, 0xFFFFFFFF, - 0x00000031, 0x000002CF, 0x00000001, 0x0000002F, - 0x000002AF, 0x3D888889, 0xBD888889, 0xBD888889, - 0x00040046, 0x00DC8010, 0x00000000, 0x00000001, - 0x0000002F, 0x000002AF, 0x00000000, 0x00000086, - 0x00000015, 0xBBDA740E, 0x3F147AE1, 0x3BDA740E, - 0x000200DC, 0x01108000, 0x00000000, 0x00000000, - 0x00000086, 0x00000015, 0x00000000, 0x00000065, - 0x00000002, 0x00000000, 0xBF227627, 0x00000000, - 0x00000003, 0x00000001, 0x000C0154, 0x01550000, - 0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFD, - 0xFFFFFFFF, 0x00000000, 0xFFFFFFFD, 0x00000000, - 0x00000000, 0x00000000, 0x00000013, 0x00000006, - 0xFFFF0000, 0x0032FFFF, 0xFFFFFFFF, 0x70E60032, - 0x003C0000, 0x00000000, 0xFFFF003C, 0x00FAFFFF, - 0xFFFFFFFF, 0x70E700FA, 0x01040000, 0x00000000, - 0xFFFF0104, 0x0122FFFF, 0xFFFFFFFF, 0x70E80122, - 0x01400000, 0x00000000, 0x00000001, 0x00010000, - 0x00FB0000, 0x00000000, 0x42700000, 0xFFC5000C, - 0x02B20222, 0x00000000, 0x42700000, 0xFFC5000C, - 0x02B200FA, 0x00000000, 0x42700000, 0xFFC5000C, - 0x02B20000, 0x00000000, 0x42700000, 0xFFC5000C, - 0x02B20000, 0x00000000, 0x42700000, 0xFFC5000C, - 0x02B20000, 0x00000000, 0x42700000, 0xFFE10018, - 0x02BD0000, 0x00000000, 0x42700000, 0xFFE10018, - 0x02BD0000, 0x00000000, 0x42700000, 0xFFE10018, - 0x02BD0000, 0x00000000, 0x42700000, 0xFFE10018, - 0x02BD2D70, 0x00000000, 0x42700000, 0xFFE10018, - 0x02BD0085, 0x00000000, 0x42700000, 0xFFE10018, - 0x02BD01E6, 0xFF000000, 0x42700000, 0xFFE10018, - 0x02BD0000, 0x00000001, 0x0001005A, 0x014B0000, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0222, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC00FA, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, - 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, - 0xFF000000, 0x42700000, 0xFF66005C, 0x00EC2D70, - 0x00000001, 0x000100DC, 0x01EB0000, 0x00000000, - 0x42700001, 0xFFFE007A, 0x00270222, 0x00000000, - 0x42700001, 0xFFFE007A, 0x002700FA, 0x00000000, - 0x42700001, 0xFFFE0066, 0x00270000, 0x00000000, - 0x42700001, 0xFFFE005A, 0x00270000, 0x00000000, - 0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000, - 0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000, - 0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000, - 0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000, - 0x42700001, 0xFFFE0051, 0x003E2D70, 0xFF000000, - 0x42700001, 0xFFFE0051, 0x003E0085, 0x00000002, - 0x00010000, 0x01180000, 0x0000001E, 0x42700000, - 0x002B0034, 0x02CC0222, 0x0000001E, 0x42700000, - 0x002B0034, 0x02CC00FA, 0x0000000A, 0x42700000, - 0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000, - 0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000, - 0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000, - 0x003F0056, 0x02D20000, 0x0000001E, 0x42700000, - 0x003F0056, 0x02D20000, 0x0000001E, 0x42700000, - 0x003F0056, 0x02D20000, 0x0000001E, 0x42700000, - 0x003F0056, 0x02D22D70, 0x0000001E, 0x42700000, - 0x003F0055, 0x02D10085, 0x0000001E, 0x42700000, - 0x003F0055, 0x02D101E6, 0xFF00001E, 0x42700000, - 0x003E0055, 0x02D10000, 0x00000002, 0x0001005A, - 0x01680000, 0x0000001E, 0x42700000, 0xFF970053, - 0x016E0222, 0x0000001E, 0x42700000, 0xFF980053, - 0x016C00FA, 0x0000001E, 0x42700000, 0xFFC10053, - 0x01530000, 0x0000001E, 0x42700000, 0xFFF00063, - 0x00FF0000, 0x0000001E, 0x42700000, 0xFFE2006F, - 0x00B10000, 0x0000001E, 0x42700000, 0xFFB00070, - 0x00790000, 0x0000001E, 0x42700000, 0xFFB00070, - 0x00790000, 0x0000001E, 0x42700000, 0xFFB00070, - 0x00790000, 0xFF00001E, 0x42700000, 0xFFB00070, - 0x00792D70, 0x00000002, 0x000100DC, 0x02080000, - 0x0000001E, 0x42700001, 0x00000089, 0xFFC90222, - 0x0000001E, 0x42700001, 0x00000089, 0xFFC900FA, - 0x0000001E, 0x42700001, 0x00000075, 0xFFC90000, - 0x0000001E, 0x42700001, 0x00000069, 0xFFC90000, - 0x0000001E, 0x42700001, 0x00000062, 0xFFE10000, - 0x0000001E, 0x42700001, 0x00000062, 0xFFE10000, - 0x0000001E, 0x42700001, 0x00000062, 0xFFE10000, - 0x0000001E, 0x42700001, 0x00000062, 0xFFE10000, - 0x0000001E, 0x42700001, 0x00000062, 0xFFE12D70, - 0xFF00001E, 0x42700001, 0x00000062, 0xFFE10085, - 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, +static u32 D_808BBD90[] = { + 0x0000000B, 0x00000BB8, 0x00000021, 0x00000001, 0x00010000, 0x0BB80000, 0x00000000, 0x00000000, 0xFFFFFFF8, + 0xFFFFFFFF, 0x00000000, 0xFFFFFFF8, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, 0x0000000A, 0x00000003, + 0x00050000, 0x00010000, 0x80000000, 0x00000000, 0x00000000, 0x00000334, 0x00000000, 0x00000000, 0x00000334, + 0x00000000, 0x00000000, 0x00000001, 0x00020001, 0x00100000, 0x80000000, 0x00000000, 0x00000000, 0x00000334, + 0x00000000, 0x00000000, 0x000002D0, 0x00000000, 0x00000000, 0x00000001, 0x00050010, 0x00B00000, 0x80000000, + 0x00000000, 0x00000000, 0x000002D0, 0x00000000, 0x00000000, 0x000002D0, 0x00000000, 0x00000000, 0x00000001, + 0x0000003E, 0x00000003, 0x00040028, 0x00467D74, 0x00000000, 0xFFFFFFFF, 0x00000031, 0x000002CF, 0x00000001, + 0x0000002F, 0x000002AF, 0x3D888889, 0xBD888889, 0xBD888889, 0x00040046, 0x00DC8010, 0x00000000, 0x00000001, + 0x0000002F, 0x000002AF, 0x00000000, 0x00000086, 0x00000015, 0xBBDA740E, 0x3F147AE1, 0x3BDA740E, 0x000200DC, + 0x01108000, 0x00000000, 0x00000000, 0x00000086, 0x00000015, 0x00000000, 0x00000065, 0x00000002, 0x00000000, + 0xBF227627, 0x00000000, 0x00000003, 0x00000001, 0x000C0154, 0x01550000, 0x00000000, 0xFFFFFFFF, 0x00000000, + 0xFFFFFFFD, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFD, 0x00000000, 0x00000000, 0x00000000, 0x00000013, 0x00000006, + 0xFFFF0000, 0x0032FFFF, 0xFFFFFFFF, 0x70E60032, 0x003C0000, 0x00000000, 0xFFFF003C, 0x00FAFFFF, 0xFFFFFFFF, + 0x70E700FA, 0x01040000, 0x00000000, 0xFFFF0104, 0x0122FFFF, 0xFFFFFFFF, 0x70E80122, 0x01400000, 0x00000000, + 0x00000001, 0x00010000, 0x00FB0000, 0x00000000, 0x42700000, 0xFFC5000C, 0x02B20222, 0x00000000, 0x42700000, + 0xFFC5000C, 0x02B200FA, 0x00000000, 0x42700000, 0xFFC5000C, 0x02B20000, 0x00000000, 0x42700000, 0xFFC5000C, + 0x02B20000, 0x00000000, 0x42700000, 0xFFC5000C, 0x02B20000, 0x00000000, 0x42700000, 0xFFE10018, 0x02BD0000, + 0x00000000, 0x42700000, 0xFFE10018, 0x02BD0000, 0x00000000, 0x42700000, 0xFFE10018, 0x02BD0000, 0x00000000, + 0x42700000, 0xFFE10018, 0x02BD2D70, 0x00000000, 0x42700000, 0xFFE10018, 0x02BD0085, 0x00000000, 0x42700000, + 0xFFE10018, 0x02BD01E6, 0xFF000000, 0x42700000, 0xFFE10018, 0x02BD0000, 0x00000001, 0x0001005A, 0x014B0000, + 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0222, 0x00000000, 0x42700000, 0xFF66005C, 0x00EC00FA, 0x00000000, + 0x42700000, 0xFF66005C, 0x00EC0000, 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, 0x00000000, 0x42700000, + 0xFF66005C, 0x00EC0000, 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, 0x00000000, 0x42700000, 0xFF66005C, + 0x00EC0000, 0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000, 0xFF000000, 0x42700000, 0xFF66005C, 0x00EC2D70, + 0x00000001, 0x000100DC, 0x01EB0000, 0x00000000, 0x42700001, 0xFFFE007A, 0x00270222, 0x00000000, 0x42700001, + 0xFFFE007A, 0x002700FA, 0x00000000, 0x42700001, 0xFFFE0066, 0x00270000, 0x00000000, 0x42700001, 0xFFFE005A, + 0x00270000, 0x00000000, 0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000, 0x42700001, 0xFFFE0051, 0x003E0000, + 0x00000000, 0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000, 0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000, + 0x42700001, 0xFFFE0051, 0x003E2D70, 0xFF000000, 0x42700001, 0xFFFE0051, 0x003E0085, 0x00000002, 0x00010000, + 0x01180000, 0x0000001E, 0x42700000, 0x002B0034, 0x02CC0222, 0x0000001E, 0x42700000, 0x002B0034, 0x02CC00FA, + 0x0000000A, 0x42700000, 0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000, 0x002B0034, 0x02CC0000, 0x0000000A, + 0x42700000, 0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000, 0x003F0056, 0x02D20000, 0x0000001E, 0x42700000, + 0x003F0056, 0x02D20000, 0x0000001E, 0x42700000, 0x003F0056, 0x02D20000, 0x0000001E, 0x42700000, 0x003F0056, + 0x02D22D70, 0x0000001E, 0x42700000, 0x003F0055, 0x02D10085, 0x0000001E, 0x42700000, 0x003F0055, 0x02D101E6, + 0xFF00001E, 0x42700000, 0x003E0055, 0x02D10000, 0x00000002, 0x0001005A, 0x01680000, 0x0000001E, 0x42700000, + 0xFF970053, 0x016E0222, 0x0000001E, 0x42700000, 0xFF980053, 0x016C00FA, 0x0000001E, 0x42700000, 0xFFC10053, + 0x01530000, 0x0000001E, 0x42700000, 0xFFF00063, 0x00FF0000, 0x0000001E, 0x42700000, 0xFFE2006F, 0x00B10000, + 0x0000001E, 0x42700000, 0xFFB00070, 0x00790000, 0x0000001E, 0x42700000, 0xFFB00070, 0x00790000, 0x0000001E, + 0x42700000, 0xFFB00070, 0x00790000, 0xFF00001E, 0x42700000, 0xFFB00070, 0x00792D70, 0x00000002, 0x000100DC, + 0x02080000, 0x0000001E, 0x42700001, 0x00000089, 0xFFC90222, 0x0000001E, 0x42700001, 0x00000089, 0xFFC900FA, + 0x0000001E, 0x42700001, 0x00000075, 0xFFC90000, 0x0000001E, 0x42700001, 0x00000069, 0xFFC90000, 0x0000001E, + 0x42700001, 0x00000062, 0xFFE10000, 0x0000001E, 0x42700001, 0x00000062, 0xFFE10000, 0x0000001E, 0x42700001, + 0x00000062, 0xFFE10000, 0x0000001E, 0x42700001, 0x00000062, 0xFFE10000, 0x0000001E, 0x42700001, 0x00000062, + 0xFFE12D70, 0xFF00001E, 0x42700001, 0x00000062, 0xFFE10085, 0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000, }; -const ActorInit Bg_Toki_Swd_InitVars = -{ +const ActorInit Bg_Toki_Swd_InitVars = { ACTOR_BG_TOKI_SWD, ACTORTYPE_PROP, ROOM, @@ -315,160 +163,118 @@ const ActorInit Bg_Toki_Swd_InitVars = (ActorFunc)BgTokiSwd_Draw, }; -static ColliderCylinderInit colliderInit = -{ - 0x0A, 0x00, 0x00, 0x39, - 0x12, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0xFFCFFFFF, - 0x00, 0x00, 0x00, 0x00, - 0xFFCFFFFF, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, - 0x000A, - 0x0046, - 0x0000000000000000, +static ColliderCylinderInit colliderInit = { + 0x0A, 0x00, 0x00, 0x39, 0x12, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, + 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x0001, 0x0000, 0x000A, 0x0046, 0x0000, }; -static SubActor98Init subActor98Init = -{ +static SubActor98Init subActor98Init = { 0x0A, 0x0023, 0x0064, 0xFF, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 0x19, ICHAIN_STOP), }; -static void BgTokiSwd_SetupAction(BgTokiSwd* this, ActorFunc actionFunc) -{ - this->actionFunc = actionFunc; +static void BgTokiSwd_SetupAction(BgTokiSwd* this, ActorFunc actionFunc) { + this->actionFunc = actionFunc; } -static void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx) -{ - ColliderCylinderMain* collision; - Actor* thisx = &this->actor; +static void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx) { + ColliderCylinderMain* collision; + Actor* thisx = &this->actor; - Actor_ProcessInitChain(thisx, initChain); - this->actor.shape.unk_08 = 800.0f; - BgTokiSwd_SetupAction(thisx, func_808BAF40); - collision = &this->collider; - if (LINK_IS_ADULT) - { - thisx->draw = NULL; - } + Actor_ProcessInitChain(thisx, initChain); + this->actor.shape.unk_08 = 800.0f; + BgTokiSwd_SetupAction(thisx, func_808BAF40); + collision = &this->collider; + if (LINK_IS_ADULT) { + thisx->draw = NULL; + } - if (gSaveContext.scene_setup_index == 5) - { - globalCtx->unk_11D30[0] = 0xFF; - } + if (gSaveContext.scene_setup_index == 5) { + globalCtx->unk_11D30[0] = 0xFF; + } - ActorCollider_AllocCylinder(globalCtx, collision); - ActorCollider_InitCylinder(globalCtx, collision, thisx, &colliderInit); - ActorCollider_Cylinder_Update(thisx, collision); - func_80061ED4(&thisx->sub_98, 0, &subActor98Init); + ActorCollider_AllocCylinder(globalCtx, collision); + ActorCollider_InitCylinder(globalCtx, collision, thisx, &colliderInit); + ActorCollider_Cylinder_Update(thisx, collision); + func_80061ED4(&thisx->sub_98, 0, &subActor98Init); } -static void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx) -{ - ColliderCylinderMain* collider = &this->collider; - ActorCollider_FreeCylinder(globalCtx, collider); +static void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx) { + ColliderCylinderMain* collider = &this->collider; + ActorCollider_FreeCylinder(globalCtx, collider); } -static void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) -{ - if (((gSaveContext.event_chk_inf[4] & 0x8000) == 0) && (gSaveContext.scene_setup_index < 4) && - (func_8002E12C(&this->actor, 800.0f, 0x7530) != 0) && (func_800BFC84(globalCtx) == 0)) - { - gSaveContext.event_chk_inf[4] |= 0x8000; - globalCtx->csCtx.segment = D_808BBD90; - gSaveContext.cutscene_trigger = 1; - } - if (LINK_IS_CHILD || ((gSaveContext.event_chk_inf[5] & 0x20) != 0)) - { - if (func_8002F410(&this->actor, globalCtx) != 0) - { - if (LINK_IS_CHILD) - { - Item_Give(globalCtx, ITEM_SWORD_MASTER); - globalCtx->csCtx.segment = D_808BB2F0; - } - else - { - globalCtx->csCtx.segment = D_808BB7A0; - } - Audio_SetBGM(NA_BGM_STOP); - Audio_SetBGM(NA_SE_PL_BOUND_DIRT); - gSaveContext.cutscene_trigger = 1; - this->actor.attachedA = 0; - BgTokiSwd_SetupAction(this, func_808BB0AC); - } - else - { - if (func_8002E084(&this->actor, 0x2000) != 0) - { - func_8002F580(&this->actor, globalCtx); - } - } - } - if (gSaveContext.scene_setup_index == 5) - { - if (globalCtx->unk_11D30[0] > 0) - { - globalCtx->unk_11D30[0]--; - } - else - { - globalCtx->unk_11D30[0] = 0; - } - } +static void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx) { + if (((gSaveContext.event_chk_inf[4] & 0x8000) == 0) && (gSaveContext.scene_setup_index < 4) && + (func_8002E12C(&this->actor, 800.0f, 0x7530) != 0) && (func_800BFC84(globalCtx) == 0)) { + gSaveContext.event_chk_inf[4] |= 0x8000; + globalCtx->csCtx.segment = D_808BBD90; + gSaveContext.cutscene_trigger = 1; + } + if (LINK_IS_CHILD || ((gSaveContext.event_chk_inf[5] & 0x20) != 0)) { + if (func_8002F410(&this->actor, globalCtx) != 0) { + if (LINK_IS_CHILD) { + Item_Give(globalCtx, ITEM_SWORD_MASTER); + globalCtx->csCtx.segment = D_808BB2F0; + } else { + globalCtx->csCtx.segment = D_808BB7A0; + } + Audio_SetBGM(NA_BGM_STOP); + Audio_SetBGM(NA_SE_PL_BOUND_DIRT); + gSaveContext.cutscene_trigger = 1; + this->actor.attachedA = 0; + BgTokiSwd_SetupAction(this, func_808BB0AC); + } else { + if (func_8002E084(&this->actor, 0x2000) != 0) { + func_8002F580(&this->actor, globalCtx); + } + } + } + if (gSaveContext.scene_setup_index == 5) { + if (globalCtx->unk_11D30[0] > 0) { + globalCtx->unk_11D30[0]--; + } else { + globalCtx->unk_11D30[0] = 0; + } + } } -static void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx) -{ +static void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx) { Player* player; - //if attached is set, sword has been pulled/placed from the pedestal - if (func_8002F410(&this->actor, globalCtx) != 0) - { - if (LINK_IS_CHILD) - { - Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_PUTAWAY_STN); - this->actor.draw = NULL; //sword has been pulled, dont draw sword - } - else - { - this->actor.draw = BgTokiSwd_Draw; //sword has been placed, draw the master sword + // if attached is set, sword has been pulled/placed from the pedestal + if (func_8002F410(&this->actor, globalCtx) != 0) { + if (LINK_IS_CHILD) { + Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_PUTAWAY_STN); + this->actor.draw = NULL; // sword has been pulled, dont draw sword + } else { + this->actor.draw = BgTokiSwd_Draw; // sword has been placed, draw the master sword } BgTokiSwd_SetupAction(this, func_808BB128); - } - else - { + } else { player = PLAYER; player->interactRangeActor = &this->actor; } } -static void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx) -{ - if ((func_8006C4A4(globalCtx, 1) != 0) && (globalCtx->unk_11D30[0] < 0xFF)) - { +static void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx) { + if ((func_8006C4A4(globalCtx, 1) != 0) && (globalCtx->unk_11D30[0] < 0xFF)) { globalCtx->unk_11D30[0] += 5; } } -static void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx) -{ +static void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx) { this->actionFunc(&this->actor, globalCtx); Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); } -static void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx) -{ +static void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx) { s32 pad[4]; GameState* state; GraphicsContext* gfxCtx; @@ -480,12 +286,12 @@ static void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx) func_80093D18(globalCtx->state.gfxCtx); func_8002EBCC(&this->actor, globalCtx, 0); - - gSPSegment(gfxCtx->polyOpa.p++, 0x08, Draw_TexScroll(globalCtx->state.gfxCtx, 0, - -(globalCtx->gameplayFrames % 0x80), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 742), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPSegment(gfxCtx->polyOpa.p++, 0x08, + Draw_TexScroll(globalCtx->state.gfxCtx, 0, -(globalCtx->gameplayFrames % 0x80), 32, 32)); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 742), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfxCtx->polyOpa.p++, &D_06001BD0); - + func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 776); } diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index 1234536404..29a536898b 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -1,6 +1,6 @@ #include "z_bg_treemouth.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgTreemouth_Init(BgTreemouth* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index dfeff5acb8..1a6a7350a4 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -2,20 +2,19 @@ * File: z_bg_umajump.c * Overlay: ovl_Bg_Umajump * Description: Hoppable horse fence -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ u32 dynaPolyId; - /* 0x0150 */ char unk_150[0x14]; + /* 0x014C */ u32 dynaPolyId; + /* 0x0150 */ char unk_150[0x14]; } ActorBgUmajump; // size = 0x0164 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void Init(ActorBgUmajump* this, GlobalContext* globalCtx); @@ -23,8 +22,7 @@ static void Destroy(ActorBgUmajump* this, GlobalContext* globalCtx); static void Update(ActorBgUmajump* this, GlobalContext* globalCtx); static void Draw(ActorBgUmajump* this, GlobalContext* globalCtx); -const ActorInit Bg_Umajump_InitVars = -{ +const ActorInit Bg_Umajump_InitVars = { ACTOR_BG_UMAJUMP, ACTORTYPE_PROP, ROOM, @@ -34,19 +32,17 @@ const ActorInit Bg_Umajump_InitVars = (ActorFunc)Init, (ActorFunc)Destroy, (ActorFunc)Update, - (ActorFunc)Draw + (ActorFunc)Draw, }; -extern D_06001438; //segmented address: 0x06001438 -extern D_06001220; //segmented address: 0x06001220 +extern D_06001438; // segmented address: 0x06001438 +extern D_06001220; // segmented address: 0x06001220 -static InitChainEntry initChain[] = -{ - ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP) +static InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -static void Init(ActorBgUmajump* this, GlobalContext* globalCtx) -{ +static void Init(ActorBgUmajump* this, GlobalContext* globalCtx) { s32 pad[2]; u32 sp24 = 0; @@ -55,10 +51,8 @@ static void Init(ActorBgUmajump* this, GlobalContext* globalCtx) DynaPolyInfo_Alloc(&D_06001438, &sp24); this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp24); - if (this->actor.params == 1) - { - if ((!Flags_GetEventChkInf(0x18)) && (DREG(1) == 0)) - { + if (this->actor.params == 1) { + if ((!Flags_GetEventChkInf(0x18)) && (DREG(1) == 0)) { Actor_Kill(&this->actor); return; } @@ -66,17 +60,13 @@ static void Init(ActorBgUmajump* this, GlobalContext* globalCtx) } } -static void Destroy(ActorBgUmajump* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorBgUmajump* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void Update(ActorBgUmajump* this, GlobalContext* globalCtx) -{ - +static void Update(ActorBgUmajump* this, GlobalContext* globalCtx) { } -static void Draw(ActorBgUmajump* this, GlobalContext* globalCtx) -{ +static void Draw(ActorBgUmajump* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_06001220); } diff --git a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c index 81d3a61e2b..83882c24f9 100644 --- a/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c +++ b/src/overlays/actors/ovl_Bg_Vb_Sima/z_bg_vb_sima.c @@ -1,6 +1,6 @@ #include "z_bg_vb_sima.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgVbSima_Init(BgVbSima* this, GlobalContext* globalCtx); 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 b5b2c87ce5..940a4f77dc 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 @@ -1,6 +1,6 @@ #include "z_bg_ydan_hasi.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void BgYdanHasi_Init(BgYdanHasi* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 069100d59e..ead7bdff7f 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -1,6 +1,6 @@ #include "z_bg_ydan_maruta.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgYdanMaruta_Init(BgYdanMaruta* this, GlobalContext* globalCtx); @@ -40,6 +40,3 @@ const ActorInit Bg_Ydan_Maruta_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/BgYdanMaruta_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/BgYdanMaruta_Draw.s") - - - 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 79b7234961..82beaa9285 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 @@ -1,6 +1,6 @@ #include "z_bg_ydan_sp.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void BgYdanSp_Init(BgYdanSp* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 5bc3369bb2..a4547686ca 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -1,6 +1,6 @@ #include "z_bg_zg.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void BgZg_Init(BgZg* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 68cff5fa7e..842acad26e 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -1,6 +1,6 @@ #include "z_boss_dodongo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossDodongo_Init(BossDodongo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 40e2274ca8..0aeb958584 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1,6 +1,6 @@ #include "z_boss_fd.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossFd_Init(BossFd* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index e51697fc73..8bee518ab3 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -1,6 +1,6 @@ #include "z_boss_fd2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossFd2_Init(BossFd2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index cd14e40388..ca942353d1 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -1,6 +1,6 @@ #include "z_boss_ganon.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossGanon_Init(BossGanon* this, GlobalContext* globalCtx); @@ -158,4 +158,3 @@ const ActorInit Boss_Ganon_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Ganon/func_808E3564.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Ganon/func_808E3D84.s") - diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 2b45483587..049d4d5b4a 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -1,6 +1,6 @@ #include "z_boss_ganon2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossGanon2_Init(BossGanon2* this, GlobalContext* globalCtx); @@ -132,4 +132,3 @@ const ActorInit Boss_Ganon2_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Ganon2/func_809069F8.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Ganon2/func_80906AB0.s") - 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 91f88442b4..606e3c5718 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -1,6 +1,6 @@ #include "z_boss_ganondrof.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossGanondrof_Init(BossGanondrof* this, GlobalContext* globalCtx); 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 c69737c805..dcdadea6b5 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -1,6 +1,6 @@ #include "z_boss_goma.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossGoma_Init(BossGoma* this, GlobalContext* globalCtx); 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 64465f48d0..be09d229a1 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -1,6 +1,6 @@ #include "z_boss_mo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossMo_Init(BossMo* this, GlobalContext* globalCtx); @@ -74,4 +74,3 @@ const ActorInit Boss_Mo_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Mo/func_80925480.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Mo/func_80925C18.s") - 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 82eaf37e83..8ee2afd5a8 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -1,6 +1,6 @@ #include "z_boss_sst.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000435 void BossSst_Init(BossSst* this, GlobalContext* globalCtx); @@ -306,4 +306,3 @@ const ActorInit Boss_Sst_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Sst/func_809360FC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Sst/func_8093639C.s") - 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 29925e7110..bf07fc0759 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -1,6 +1,6 @@ #include "z_boss_tw.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossTw_Init(BossTw* this, GlobalContext* globalCtx); @@ -202,4 +202,3 @@ const ActorInit Boss_Tw_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Tw/func_8094A6D8.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Tw/func_8094A740.s") - 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 1b706f0568..5f5505cea6 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -1,6 +1,6 @@ #include "z_boss_va.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void BossVa_Init(BossVa* this, GlobalContext* globalCtx); @@ -176,4 +176,3 @@ const ActorInit Boss_Va_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Va/func_8095BBD0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Boss_Va/func_8095BD24.s") - 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 a85be15722..50e875ccff 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -1,6 +1,6 @@ #include "z_demo_6k.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void Demo6K_Init(Demo6K* this, GlobalContext* globalCtx); 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 e5b0a70786..447963c889 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -1,6 +1,6 @@ #include "z_demo_du.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DemoDu_Init(DemoDu* this, GlobalContext* globalCtx); 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 755fe69418..905ce14db8 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -1,6 +1,6 @@ #include "z_demo_ec.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DemoEc_Init(DemoEc* this, GlobalContext* globalCtx); 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 656e660eef..31285eab99 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -1,6 +1,6 @@ #include "z_demo_effect.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void DemoEffect_Init(DemoEffect* this, GlobalContext* globalCtx); 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 9d5aa45d67..0faec9fb85 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -1,6 +1,6 @@ #include "z_demo_ext.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DemoExt_Init(DemoExt* this, GlobalContext* globalCtx); 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 e39a5fbcf0..9bb0c4b88a 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -2,13 +2,13 @@ * File: z_demo_geff.c * Overlay: Demo_Geff * Description: -*/ + */ #include "z_demo_geff.h" #include -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 static void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx); @@ -24,17 +24,25 @@ static void func_80978308(DemoGeff* this, GlobalContext* globalCtx); static void func_809784D4(DemoGeff* this, GlobalContext* globalCtx); static void func_80978344(DemoGeff* this, GlobalContext* globalCtx); -s16 objectIds[] = { OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, - OBJECT_GEFF, OBJECT_GEFF, }; +s16 objectIds[] = { + OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, +}; -ActorFunc scaleFuncs[] = { (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, - (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, - (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, }; -ActorFunc actionFuncs[] = { (ActorFunc)func_809783D4, (ActorFunc)func_80978308, }; -ActorFunc drawFuncs[] = { (ActorFunc)func_809784D4, (ActorFunc)func_80978344, }; +ActorFunc scaleFuncs[] = { + (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, + (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, + (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, +}; +ActorFunc actionFuncs[] = { + (ActorFunc)func_809783D4, + (ActorFunc)func_80978308, +}; +ActorFunc drawFuncs[] = { + (ActorFunc)func_809784D4, + (ActorFunc)func_80978344, +}; -const ActorInit Demo_Geff_InitVars = -{ +const ActorInit Demo_Geff_InitVars = { ACTOR_DEMO_GEFF, ACTORTYPE_BOSS, ROOM, @@ -50,7 +58,6 @@ const ActorInit Demo_Geff_InitVars = extern UNK_TYPE D_06000EA0; static void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx) { - } static void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx) { @@ -85,7 +92,7 @@ static void func_80977F80(DemoGeff* this, GlobalContext* globalCtx) { Gfx* gfxArr[5]; func_800C6AC4(gfxArr, gfxCtx, "../z_demo_geff.c", 204); - + gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objBankIndex].segment); @@ -205,7 +212,6 @@ static void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx) { } static void func_809784D4(DemoGeff* this, GlobalContext* globalCtx) { - } static void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx) { 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 6b317aae0e..7b9dff5d63 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -1,6 +1,6 @@ #include "z_demo_gj.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void DemoGj_Init(DemoGj* this, GlobalContext* globalCtx); 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 3006969e61..8ff5464e9e 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -2,13 +2,13 @@ * File: z_demo_go.c * Overlay: Demo_Go * Description: -*/ + */ #include "z_demo_go.h" #include -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DemoGo_Init(DemoGo* this, GlobalContext* globalCtx); @@ -27,27 +27,18 @@ void func_8097D130(DemoGo* this, GlobalContext* globalCtx); void func_8097D290(DemoGo* this, GlobalContext* globalCtx); void func_8097D29C(DemoGo* this, GlobalContext* globalCtx); -UNK_PTR D_8097D440[] = {0x0600CE80, 0x0600D280, 0x0600D680}; +UNK_PTR D_8097D440[] = { 0x0600CE80, 0x0600D280, 0x0600D680 }; -ActorFunc D_8097D44C[] = -{ - func_8097CFDC, - func_8097CFFC, - func_8097D01C, - func_8097D058, - func_8097D088, - func_8097D0D0, - func_8097D130 +ActorFunc D_8097D44C[] = { + func_8097CFDC, func_8097CFFC, func_8097D01C, func_8097D058, func_8097D088, func_8097D0D0, func_8097D130, }; -ActorFunc D_8097D468[] = -{ +ActorFunc D_8097D468[] = { func_8097D290, - func_8097D29C + func_8097D29C, }; -const ActorInit Demo_Go_InitVars = -{ +const ActorInit Demo_Go_InitVars = { ACTOR_DEMO_GO, ACTORTYPE_NPC, ROOM, @@ -65,11 +56,9 @@ extern UNK_TYPE D_06004930; extern UNK_TYPE D_0600E680; extern UNK_TYPE D_0600FEF0; -UNK_TYPE func_8097C870(DemoGo *this) -{ +UNK_TYPE func_8097C870(DemoGo* this) { s32 ret; - switch (this->actor.params) - { + switch (this->actor.params) { case 0: ret = 3; break; @@ -77,8 +66,7 @@ UNK_TYPE func_8097C870(DemoGo *this) ret = 4; break; default: - if (1) - { + if (1) { ret = 5; } break; @@ -86,71 +74,59 @@ UNK_TYPE func_8097C870(DemoGo *this) return ret; } -void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097C8A8(DemoGo* this, GlobalContext* globalCtx) { s32 pad[2]; Actor* thisx = &this->actor; Vec3f* sp20; Vec3f* sp1C; - if ((thisx->params == 0) || (thisx->params == 1)) - { + if ((thisx->params == 0) || (thisx->params == 1)) { func_800A6E10(&globalCtx->mf_11D60, &thisx->posRot.pos, &sp20, &sp1C); Audio_PlaySoundAtPosition(globalCtx, &sp20, 0x14, 0x28A0); } } -void DemoGo_Destroy(DemoGo* this, GlobalContext* globalCtx) -{ +void DemoGo_Destroy(DemoGo* this, GlobalContext* globalCtx) { func_800A56F0(&this->skelAnime, globalCtx); } -void func_8097C930(DemoGo* this) -{ +void func_8097C930(DemoGo* this) { s16* something = &this->unk_192; s16* other = &this->unk_190; s32 pad[3]; - if (DECR(*something) == 0) - { + if (DECR(*something) == 0) { *something = Math_Rand_S16Offset(0x3C, 0x3C); } *other = *something; - if (*other >= 3) - { + if (*other >= 3) { *other = 0; } } -void func_8097C9B8(DemoGo* this) -{ +void func_8097C9B8(DemoGo* this) { func_80078914(&this->actor.unk_E4, NA_SE_EN_DODO_M_GND); } -void func_8097C9DC(DemoGo* this) -{ +void func_8097C9DC(DemoGo* this) { s32 pad[2]; - if (func_800A56C8(&this->skelAnime, 12.0f) || func_800A56C8(&this->skelAnime, 25.0f)) - { + if (func_800A56C8(&this->skelAnime, 12.0f) || func_800A56C8(&this->skelAnime, 25.0f)) { func_80078914(&this->actor.unk_E4, NA_SE_EN_MORIBLIN_WALK); } } -void func_8097CA30(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CA30(DemoGo* this, GlobalContext* globalCtx) { func_8002E4B4(globalCtx, &this->actor, 75.0f, 30.0f, 30.0f, 5); } -void func_8097CA78(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CA78(DemoGo* this, GlobalContext* globalCtx) { s16 pad; Vec3f vec = this->actor.posRot.pos; func_80033480(globalCtx, &vec, kREG(11) + 100.0f, kREG(12) + 0xA, kREG(13) + 0x12C, kREG(14), 0); func_8097C9B8(this); } -void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx) { Actor* thisx = &this->actor; PosRot* posRot = &thisx->posRot; CutsceneContext* csCtx = &globalCtx->csCtx; @@ -160,11 +136,9 @@ void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx) Vec3f startPos; Vec3f endPos; - if (globalCtx->csCtx.state != 0) - { + if (globalCtx->csCtx.state != 0) { actorAction = csCtx->actorActions[func_8097C870(this)]; - if (actorAction != NULL) - { + if (actorAction != NULL) { temp_ret = func_8006F93C(actorAction->endFrame, actorAction->startFrame, csCtx->frames); startPos.x = actorAction->startPos.x; startPos.y = actorAction->startPos.y; @@ -180,51 +154,38 @@ void func_8097CB0C(DemoGo* this, GlobalContext* globalCtx) } } -void func_8097CC08(DemoGo* this) -{ +void func_8097CC08(DemoGo* this) { f32 something = this->unk_19C; - if (something < 8.0f) - { + if (something < 8.0f) { this->actor.speedXZ = (((kREG(15) * 0.01f) + 1.2f) * 0.125f) * something; - } - else - { + } else { this->actor.speedXZ = (kREG(15) * 0.01f) + 1.2f; } Actor_MoveForward(&this->actor); } -void func_8097CCC0(DemoGo* this) -{ +void func_8097CCC0(DemoGo* this) { Actor_MoveForward(&this->actor); } -void func_8097CCE0(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CCE0(DemoGo* this, GlobalContext* globalCtx) { CsCmdActorAction* actorAction; Actor* thisx = &this->actor; s32 rotYDelta; s32 newRotY; s32 thisRotY; - if (globalCtx->csCtx.state != 0) - { + if (globalCtx->csCtx.state != 0) { actorAction = globalCtx->csCtx.actorActions[func_8097C870(this)]; - if (actorAction != NULL) - { + if (actorAction != NULL) { thisRotY = thisx->posRot.rot.y; rotYDelta = actorAction->rot.y - thisRotY; - if ((rotYDelta > -(kREG(16) + 0x96)) && (rotYDelta < kREG(16) + 0x96)) - { + if ((rotYDelta > -(kREG(16) + 0x96)) && (rotYDelta < kREG(16) + 0x96)) { newRotY = actorAction->rot.y; - } - else if (rotYDelta > 0) - { + } else if (rotYDelta > 0) { newRotY = (thisRotY + kREG(16)) + 0x96; - } - else - { - newRotY = (thisRotY - kREG(16)) - 0x96; + } else { + newRotY = (thisRotY - kREG(16)) - 0x96; } thisx->shape.rot.y = newRotY; thisx->posRot.rot.y = newRotY; @@ -232,21 +193,17 @@ void func_8097CCE0(DemoGo* this, GlobalContext* globalCtx) } } -UNK_TYPE DemoGo_FrameUpdateMatrix(DemoGo* this) -{ +UNK_TYPE DemoGo_FrameUpdateMatrix(DemoGo* this) { return SkelAnime_FrameUpdateMatrix(&this->skelAnime); } #ifdef NON_MATCHING // return value isn't produced in the same way -s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 csCmdActorAction) -{ +s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 csCmdActorAction) { CutsceneContext* csCtx = &globalCtx->csCtx; CsCmdActorAction* actorAction = csCtx->actorActions[func_8097C870(this)]; - if (csCtx->state != 0) - { - if (actorAction != NULL && actorAction->action == csCmdActorAction) - { + if (csCtx->state != 0) { + if (actorAction != NULL && actorAction->action == csCmdActorAction) { return 1; } } @@ -256,15 +213,12 @@ s32 func_8097CDB0(DemoGo* this, GlobalContext* globalCtx, u16 csCmdActorAction) #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Go/func_8097CDB0.s") #endif -void func_8097CE10(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CE10(DemoGo* this, GlobalContext* globalCtx) { this->action = 1; } -void func_8097CE20(DemoGo* this, GlobalContext* globalCtx) -{ - if (func_8097CDB0(this, globalCtx, 2)) - { +void func_8097CE20(DemoGo* this, GlobalContext* globalCtx) { + if (func_8097CDB0(this, globalCtx, 2)) { this->action = 2; this->drawConfig = 1; func_8097CB0C(this, globalCtx); @@ -272,75 +226,62 @@ void func_8097CE20(DemoGo* this, GlobalContext* globalCtx) } } -void func_8097CE78(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CE78(DemoGo* this, GlobalContext* globalCtx) { CutsceneContext* csCtx = &globalCtx->csCtx; CsCmdActorAction* actorAction; - if (globalCtx->csCtx.state != 0) - { + if (globalCtx->csCtx.state != 0) { actorAction = csCtx->actorActions[func_8097C870(this)]; - if (actorAction != NULL && csCtx->frames >= actorAction->endFrame) - { + if (actorAction != NULL && csCtx->frames >= actorAction->endFrame) { func_8097CA78(this, globalCtx); this->action = 3; } } } -void func_8097CEEC(DemoGo* this, GlobalContext* globalCtx) -{ - if (func_8097CDB0(this, globalCtx, 3)) - { +void func_8097CEEC(DemoGo* this, GlobalContext* globalCtx) { + if (func_8097CDB0(this, globalCtx, 3)) { this->action = 4; } } -void func_8097CF20(DemoGo* this, GlobalContext* globalCtx, UNK_TYPE arg2) -{ +void func_8097CF20(DemoGo* this, GlobalContext* globalCtx, UNK_TYPE arg2) { UNK_PTR animation = &D_060029A8; - if (arg2 != 0) - { - SkelAnime_ChangeAnimation(&this->skelAnime, animation, 1.0f, 0.0f, SkelAnime_GetFrameCount(animation), 0, -8.0f); + if (arg2 != 0) { + SkelAnime_ChangeAnimation(&this->skelAnime, animation, 1.0f, 0.0f, SkelAnime_GetFrameCount(animation), 0, + -8.0f); this->action = 5; this->unk_19C = 0.0f; } } -void func_8097CF9C(DemoGo* this) -{ +void func_8097CF9C(DemoGo* this) { this->unk_19C += 1.0f; - if (this->unk_19C >= 8.0f) - { + if (this->unk_19C >= 8.0f) { this->action = 6; } } -void func_8097CFDC(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CFDC(DemoGo* this, GlobalContext* globalCtx) { func_8097CE10(this, globalCtx); } -void func_8097CFFC(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097CFFC(DemoGo* this, GlobalContext* globalCtx) { func_8097CE20(this, globalCtx); } -void func_8097D01C(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097D01C(DemoGo* this, GlobalContext* globalCtx) { func_8097CB0C(this, globalCtx); func_8097CA30(this, globalCtx); func_8097CE78(this, globalCtx); } -void func_8097D058(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097D058(DemoGo* this, GlobalContext* globalCtx) { func_8097CA30(this, globalCtx); func_8097CEEC(this, globalCtx); } -void func_8097D088(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097D088(DemoGo* this, GlobalContext* globalCtx) { UNK_TYPE something; func_8097CA30(this, globalCtx); something = DemoGo_FrameUpdateMatrix(this); @@ -348,8 +289,7 @@ void func_8097D088(DemoGo* this, GlobalContext* globalCtx) func_8097CF20(this, globalCtx, something); } -void func_8097D0D0(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097D0D0(DemoGo* this, GlobalContext* globalCtx) { func_8097CCE0(this, globalCtx); func_8097CCC0(this); func_8097CA30(this, globalCtx); @@ -358,8 +298,7 @@ void func_8097D0D0(DemoGo* this, GlobalContext* globalCtx) func_8097C9DC(this); func_8097CF9C(this); } -void func_8097D130(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097D130(DemoGo* this, GlobalContext* globalCtx) { func_8097CCE0(this, globalCtx); func_8097CC08(this); func_8097CA30(this, globalCtx); @@ -368,34 +307,28 @@ void func_8097D130(DemoGo* this, GlobalContext* globalCtx) func_8097C9DC(this); } -void DemoGo_Update(DemoGo* this, GlobalContext* globalCtx) -{ - if (this->action < 0 || this->action >= 7 || D_8097D44C[this->action] == 0) - { +void DemoGo_Update(DemoGo* this, GlobalContext* globalCtx) { + if (this->action < 0 || this->action >= 7 || D_8097D44C[this->action] == 0) { osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } D_8097D44C[this->action](this, globalCtx); } -void DemoGo_Init(DemoGo* this, GlobalContext* globalCtx) -{ +void DemoGo_Init(DemoGo* this, GlobalContext* globalCtx) { UNK_PTR animation = &D_06004930; s16 pad; - + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 30.0f); func_800A46F8(globalCtx, &this->skelAnime, &D_0600FEF0, 0, 0, 0, 0); SkelAnime_ChangeAnimation(&this->skelAnime, animation, 1.0f, 0.0f, SkelAnime_GetFrameCount(animation), 2, 0.0f); this->action = 0; } -void func_8097D290(DemoGo* this, GlobalContext* globalCtx) -{ - +void func_8097D290(DemoGo* this, GlobalContext* globalCtx) { } -void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) -{ +void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) { s32 pad; s16 temp = this->unk_190; SkelAnime* skelAnime = &this->skelAnime; @@ -410,14 +343,14 @@ void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(srcSegment8)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(srcSegment9)); - func_800A1AC8(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, NULL, NULL, &this->actor); + func_800A1AC8(globalCtx, skelAnime->limbIndex, skelAnime->actorDrawTbl, skelAnime->dListCount, NULL, NULL, + &this->actor); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_demo_go.c", 746); } void DemoGo_Draw(DemoGo* this, GlobalContext* globalCtx) { - if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == 0) - { + if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == 0) { osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } 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 20cfaea446..5dd655772d 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -1,6 +1,6 @@ #include "z_demo_gt.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void DemoGt_Init(DemoGt* this, GlobalContext* globalCtx); 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 62db83bd26..568707a99d 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -1,6 +1,6 @@ #include "z_demo_ik.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DemoIk_Init(DemoIk* this, GlobalContext* globalCtx); 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 4846b47a1b..bd79b57225 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -1,6 +1,6 @@ #include "z_demo_im.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000011 void DemoIm_Init(DemoIm* this, GlobalContext* globalCtx); 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 f8cc3054a3..ae22ebdc02 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -1,6 +1,6 @@ #include "z_demo_kankyo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void DemoKankyo_Init(DemoKankyo* this, GlobalContext* globalCtx); @@ -70,4 +70,3 @@ const ActorInit Demo_Kankyo_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kankyo/func_8098ABC0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Kankyo/func_8098B354.s") - diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index 6b1398901e..2f4b639148 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -1,6 +1,6 @@ #include "z_demo_kekkai.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void DemoKekkai_Init(DemoKekkai* this, GlobalContext* globalCtx); 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 211a6ecc51..4217d217fa 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -1,6 +1,6 @@ #include "z_demo_sa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DemoSa_Init(DemoSa* this, GlobalContext* globalCtx); 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 02f60bd706..ceccbb5be0 100644 --- a/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -1,6 +1,6 @@ #include "z_demo_shd.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void DemoShd_Init(DemoShd* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index acbb4a7e07..f0718f3181 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -1,6 +1,6 @@ #include "z_demo_tre_lgt.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DemoTreLgt_Init(DemoTreLgt* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 406a70a689..1baa96137f 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -2,11 +2,11 @@ * File: z_door_ana.c * Overlay: ovl_Door_Ana * Description: Grottos Entrances/Exits -*/ + */ #include "z_door_ana.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000000 static void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx); @@ -20,8 +20,7 @@ static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx); static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx); static void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx); -const ActorInit Door_Ana_InitVars = -{ +const ActorInit Door_Ana_InitVars = { ACTOR_DOOR_ANA, ACTORTYPE_ITEMACTION, ROOM, @@ -35,106 +34,77 @@ const ActorInit Door_Ana_InitVars = }; // initial collision data -static ColliderCylinderInit colliderInit = -{ - 0x0A, 0x00, 0x09, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, - 0x00000000, 0x00, 0x00, - 0x00, 0x00, 0x00000048, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, - 0x0032, 0x000A, 0x0000, - 0x0000, 0x0000, 0x0000, +static ColliderCylinderInit colliderInit = { + 0x0A, 0x00, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00000048, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x0032, 0x000A, 0x0000, 0x0000, 0x0000, 0x0000, }; // array of entrance table entries to grotto destinations static s16 entrances[] = { - 0x036D, 0x003F, 0x0598, 0x059C, - 0x05A0, 0x05A4, 0x05A8, 0x05AC, - 0x05B0, 0x05B4, 0x05B8, 0x05BC, - 0x05C0, 0x05C4, 0x05FC, + 0x036D, 0x003F, 0x0598, 0x059C, 0x05A0, 0x05A4, 0x05A8, 0x05AC, + 0x05B0, 0x05B4, 0x05B8, 0x05BC, 0x05C0, 0x05C4, 0x05FC, }; // display list extern Gfx* D_05001390; // sets current actionFunc to be ran on next update call -static void DoorAna_SetupAction(DoorAna* this, ActorFunc func) -{ +static void DoorAna_SetupAction(DoorAna* this, ActorFunc func) { this->actionFunc = func; } -static void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx) -{ +static void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx) { ColliderCylinderMain* collider; this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.shape.rot.z; // init block for grottos that are initially "hidden" (require explosives/hammer/song of storms to open) - if ((this->actor.params & 0x300) != 0) - { + if ((this->actor.params & 0x300) != 0) { // only allocate collider for grottos that need bombing/hammering open - if ((this->actor.params & 0x200) != 0) - { + if ((this->actor.params & 0x200) != 0) { collider = &this->collider; ActorCollider_AllocCylinder(globalCtx, collider); ActorCollider_InitCylinder(globalCtx, collider, &this->actor, &colliderInit); - } - else - { + } else { this->actor.flags |= 0x10; } Actor_SetScale(&this->actor, 0); DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Hidden); - } - else - { + } else { DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Open); } this->actor.unk_1F = 0; - } -static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx) -{ +static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx) { // free collider if it has one - if ((this->actor.params & 0x200) != 0) - { + if ((this->actor.params & 0x200) != 0) { ActorCollider_FreeCylinder(globalCtx, &this->collider); } } // update routine for grottos that are currently "hidden"/unopened -static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx) -{ +static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx) { bool openGrotto = false; - if ((this->actor.params & 0x200) == 0) - { + if ((this->actor.params & 0x200) == 0) { // opening with song of storms - if (this->actor.waterSurfaceDist < 40000.0f && func_8006C4A4(globalCtx, 5) != 0) - { + if (this->actor.waterSurfaceDist < 40000.0f && func_8006C4A4(globalCtx, 5) != 0) { openGrotto = true; this->actor.flags &= ~0x10; } - } - else - { + } else { // bombing/hammering open a grotto - if ((this->collider.base.collideFlags & 2) != 0) - { + if ((this->collider.base.collideFlags & 2) != 0) { openGrotto = true; ActorCollider_FreeCylinder(globalCtx, &this->collider); - } - else - { + } else { ActorCollider_Cylinder_Update(&this->actor, &this->collider); Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this->collider); } } // open the grotto - if (openGrotto) - { + if (openGrotto) { this->actor.params &= ~0x0300; DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Open); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -143,40 +113,31 @@ static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx) } // update routine for grottos that are open -static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx) -{ +static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx) { Player* player; s32 destinationIdx; player = PLAYER; - if (Math_ApproxF(&this->actor.scale.x, 0.01f, 0.001f) != 0) - { - if ((this->actor.unk_1F != 0) && (globalCtx->sceneLoadFlag == 0) && - (player->stateFlags1 & 0x80000000) && (player->unk_84F == 0)) - { + if (Math_ApproxF(&this->actor.scale.x, 0.01f, 0.001f) != 0) { + if ((this->actor.unk_1F != 0) && (globalCtx->sceneLoadFlag == 0) && (player->stateFlags1 & 0x80000000) && + (player->unk_84F == 0)) { destinationIdx = ((this->actor.params >> 0xC) & 7) - 1; func_800C0AF4(globalCtx, 1, 0x4FF); gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.posRot.pos.y; gSaveContext.respawn[RESPAWN_MODE_RETURN].yaw = this->actor.initPosRot.rot.y; gSaveContext.respawn[RESPAWN_MODE_RETURN].data = this->actor.params & 0xFFFF; - if (destinationIdx < 0) - { + if (destinationIdx < 0) { destinationIdx = this->actor.initPosRot.rot.z + 1; } globalCtx->nextEntranceIndex = entrances[destinationIdx]; DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Entering); - } - else - { - if (func_8008E988(globalCtx) == 0 && !(player->stateFlags1 & 0x8800000) && - this->actor.xzDistanceFromLink <= 15.0f && -50.0f <= this->actor.yDistanceFromLink && - this->actor.yDistanceFromLink <= 15.0f) - { + } else { + if (func_8008E988(globalCtx) == 0 && !(player->stateFlags1 & 0x8800000) && + this->actor.xzDistanceFromLink <= 15.0f && -50.0f <= this->actor.yDistanceFromLink && + this->actor.yDistanceFromLink <= 15.0f) { player->stateFlags1 |= 0x80000000; this->actor.unk_1F = 1; - } - else - { + } else { this->actor.unk_1F = 0; } } @@ -185,34 +146,32 @@ static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx) } // update function for after the player has triggered the grotto -static void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx) -{ +static void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx) { Player* player; - if (this->actor.yDistanceFromLink <= 0.0f && 15.0f < this->actor.xzDistanceFromLink) - { + if (this->actor.yDistanceFromLink <= 0.0f && 15.0f < this->actor.xzDistanceFromLink) { player = PLAYER; player->actor.posRot.pos.x = Math_Sins(this->actor.rotTowardsLinkY) * 15.0f + this->actor.posRot.pos.x; player->actor.posRot.pos.z = Math_Coss(this->actor.rotTowardsLinkY) * 15.0f + this->actor.posRot.pos.z; } } -static void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx) -{ +static void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); // changes the grottos facing angle based on camera angle - this->actor.shape.rot.y = func_8005A9F4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]) + 0x8000; + this->actor.shape.rot.y = + func_8005A9F4(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0]) + 0x8000; } -static void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx) -{ +static void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx** dList = &D_05001390; // required for stack placement? Gfx* gfxArr[3]; func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 440); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfxCtx->polyXlu.p++, dList); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 449); -} \ No newline at end of file +} diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index 2b5616a38e..4cd20660d4 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -1,6 +1,6 @@ #include "z_door_gerudo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void DoorGerudo_Init(DoorGerudo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index 469cbf509a..4c2e90d9f9 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -1,6 +1,6 @@ #include "z_door_killer.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DoorKiller_Init(DoorKiller* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 0b0b0cbba4..ee6a9e1204 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -1,6 +1,6 @@ #include "z_door_shutter.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void DoorShutter_Init(DoorShutter* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c index ca210be91d..7ad3af1293 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c @@ -2,50 +2,38 @@ * File: z_door_toki.c * Overlay: ovl_Door_Toki * Description: Manages collision for the Door of Time. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ u32 dynaPolyId; - /* 0x0150 */ u8 unk_150[0x18]; + /* 0x014C */ u32 dynaPolyId; + /* 0x0150 */ u8 unk_150[0x18]; } ActorDoorToki; // size = 0x0168 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void Init(ActorDoorToki* this, GlobalContext* globalCtx); static void Destroy(ActorDoorToki* this, GlobalContext* globalCtx); static void Update(ActorDoorToki* this, GlobalContext* globalCtx); -const ActorInit Door_Toki_InitVars = -{ - ACTOR_DOOR_TOKI, - ACTORTYPE_BG, - ROOM, - FLAGS, - OBJECT_TOKI_OBJECTS, - sizeof(ActorDoorToki), - (ActorFunc)Init, - (ActorFunc)Destroy, - (ActorFunc)Update, - NULL +const ActorInit Door_Toki_InitVars = { + ACTOR_DOOR_TOKI, ACTORTYPE_BG, ROOM, FLAGS, OBJECT_TOKI_OBJECTS, sizeof(ActorDoorToki), (ActorFunc)Init, + (ActorFunc)Destroy, (ActorFunc)Update, NULL, }; // This has to be defined in the linker to produce a proper lui addiu pair extern u32 DOOR_TOKI_COLLISION_DATA; -static InitChainEntry initChain[] = -{ - ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP) +static InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -static void Init(ActorDoorToki* this, GlobalContext* globalCtx) -{ +static void Init(ActorDoorToki* this, GlobalContext* globalCtx) { s32 pad[2]; u32 sp1C = 0; @@ -55,15 +43,14 @@ static void Init(ActorDoorToki* this, GlobalContext* globalCtx) this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp1C); } -static void Destroy(ActorDoorToki* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorDoorToki* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); } -static void Update(ActorDoorToki* this, GlobalContext* globalCtx) -{ - if (gSaveContext.event_chk_inf[4] & 0x800) +static void Update(ActorDoorToki* this, GlobalContext* globalCtx) { + if (gSaveContext.event_chk_inf[4] & 0x800) { func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); - else + } else { func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId); + } } 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 0a2bfdaed4..c7e7db92bc 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -1,6 +1,6 @@ #include "z_door_warp1.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void DoorWarp1_Init(DoorWarp1* this, GlobalContext* globalCtx); @@ -96,4 +96,3 @@ const ActorInit Door_Warp1_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Warp1/func_8099B5EC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Door_Warp1/DoorWarp1_Draw.s") - diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index 02a1f6f89f..6df8f4173d 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -1,6 +1,6 @@ #include "z_efc_erupc.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EfcErupc_Init(EfcErupc* this, GlobalContext* globalCtx); 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 871b3d6975..6e2ebddd03 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -1,6 +1,6 @@ #include "z_eff_dust.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EffDust_Init(EffDust* this, GlobalContext* globalCtx); 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 2304bc97f7..b16bafbb47 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -1,6 +1,6 @@ #include "z_elf_msg.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ElfMsg_Init(ElfMsg* this, GlobalContext* globalCtx); 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 93e7ec11cb..3ba001027b 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -1,6 +1,6 @@ #include "z_elf_msg2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ElfMsg2_Init(ElfMsg2* this, GlobalContext* globalCtx); 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 7c0677b5f6..ab5d63eb3a 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -1,6 +1,6 @@ #include "z_en_am.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x04000015 void EnAm_Init(EnAm* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index bf0cc6b585..6d9d1bbfb3 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -1,6 +1,6 @@ #include "z_en_ani.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnAni_Init(EnAni* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index d116d2b745..d55d4d36ea 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -1,6 +1,6 @@ #include "z_en_anubice.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnAnubice_Init(EnAnubice* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index c4ed61f64d..98aeae20ee 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -1,6 +1,6 @@ #include "z_en_anubice_fire.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnAnubiceFire_Init(EnAnubiceFire* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 9fb9bed6b6..9717d199e1 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -2,16 +2,15 @@ * File: z_en_anubice_tag.c * Overlay: ovl_En_Anubice_Tag * Description: Spawns and manages the Anubis enemy -*/ + */ #include #include #include -//temp struct until we can reference other actors outside of their file -typedef struct -{ +// temp struct until we can reference other actors outside of their file +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ char unk_14C[0x10E]; /* 0x025A */ s16 unk_25A; @@ -22,15 +21,14 @@ typedef struct /* 0x0264 */ char unk_264[0xB0]; } EnAnubice; // size = 0x0314 -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; /* 0x0150 */ EnAnubice* anubis; /* 0x0154 */ f32 triggerRange; } EnAnubiceTag; // size = 0x0158 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void EnAnubiceTag_Init(EnAnubiceTag* this, GlobalContext* globalCtx); @@ -40,8 +38,7 @@ static void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalC static void EnAnubiceTag_Update(EnAnubiceTag* this, GlobalContext* globalCtx); static void EnAnubiceTag_Draw(EnAnubiceTag* this, GlobalContext* globalCtx); -const ActorInit En_Anubice_Tag_InitVars = -{ +const ActorInit En_Anubice_Tag_InitVars = { ACTOR_EN_ANUBICE_TAG, ACTORTYPE_SWITCH, ROOM, @@ -54,103 +51,79 @@ const ActorInit En_Anubice_Tag_InitVars = (ActorFunc)EnAnubiceTag_Draw, }; -static void EnAnubiceTag_Init(EnAnubiceTag* this, GlobalContext* globalCtx) -{ +static void EnAnubiceTag_Init(EnAnubiceTag* this, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); //"Anubis control tag generated" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ アヌビス制御タグ発生 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params); - if (this->actor.params < (s16)0xFFFF) - { + if (this->actor.params < (s16)0xFFFF) { this->actor.params = 0; } - if (this->actor.params != 0) - { + if (this->actor.params != 0) { this->triggerRange = this->actor.params * 40.0f; } this->actionFunc = &EnAnubiceTag_SpawnAnubis; } -static void EnAnubiceTag_Destroy(EnAnubiceTag* this, GlobalContext* globalCtx) -{ - +static void EnAnubiceTag_Destroy(EnAnubiceTag* this, GlobalContext* globalCtx) { } -static void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) -{ - this->anubis = Actor_SpawnAttached(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANUBICE, - this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, - 0, this->actor.rotTowardsLinkY, 0, 0); +static void EnAnubiceTag_SpawnAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { + this->anubis = + Actor_SpawnAttached(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ANUBICE, this->actor.posRot.pos.x, + this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, this->actor.rotTowardsLinkY, 0, 0); - if (this->anubis != NULL) - { + if (this->anubis != NULL) { this->actionFunc = &EnAnubiceTag_ManageAnubis; } } -static void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) -{ +static void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, GlobalContext* globalCtx) { EnAnubice* anubis; Vec3f offset; - - if (this->anubis != NULL) - { + + if (this->anubis != NULL) { anubis = this->anubis; - if (anubis->actor.update == NULL) - { + if (anubis->actor.update == NULL) { return; } - } - else - { + } else { Actor_Kill(this); return; } - if (anubis->unk_25A != 0) - { + if (anubis->unk_25A != 0) { Actor_Kill(this); return; } - if (this->actor.xzDistanceFromLink < (200.0f + this->triggerRange)) - { - if (anubis->unk_260 == 0) - { - if (anubis->unk_262 == 0) - { + if (this->actor.xzDistanceFromLink < (200.0f + this->triggerRange)) { + if (anubis->unk_260 == 0) { + if (anubis->unk_262 == 0) { anubis->unk_25E = 1; offset.x = -Math_Sins(this->actor.rotTowardsLinkY) * this->actor.xzDistanceFromLink; offset.z = -Math_Coss(this->actor.rotTowardsLinkY) * this->actor.xzDistanceFromLink; - Math_SmoothScaleMaxF(&anubis->actor.posRot.pos.x, - (this->actor.posRot.pos.x + offset.x), 0.3f, 10.0f); - Math_SmoothScaleMaxF(&anubis->actor.posRot.pos.z, - (this->actor.posRot.pos.z + offset.z), 0.3f, 10.0f); + Math_SmoothScaleMaxF(&anubis->actor.posRot.pos.x, (this->actor.posRot.pos.x + offset.x), 0.3f, 10.0f); + Math_SmoothScaleMaxF(&anubis->actor.posRot.pos.z, (this->actor.posRot.pos.z + offset.z), 0.3f, 10.0f); return; } } - } - else - { - if (anubis->unk_25E != 0) - { + } else { + if (anubis->unk_25E != 0) { anubis->unk_260 = 1; } } } -static void EnAnubiceTag_Update(EnAnubiceTag* this, GlobalContext* globalCtx) -{ +static void EnAnubiceTag_Update(EnAnubiceTag* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } -static void EnAnubiceTag_Draw(EnAnubiceTag* this, GlobalContext* globalCtx) -{ - if (BREG(0) != 0) - { +static void EnAnubiceTag_Draw(EnAnubiceTag* this, GlobalContext* globalCtx) { + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, - this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, - 1.0f, 1.0f, 1.0f, 0xFF, 0, 0, 0xFF, 4, globalCtx->state.gfxCtx); + this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, 1.0f, 1.0f, + 1.0f, 0xFF, 0, 0, 0xFF, 4, globalCtx->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c index 4f39cbb0be..cc1e84bb5a 100644 --- a/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c +++ b/src/overlays/actors/ovl_En_Arow_Trap/z_en_arow_trap.c @@ -2,64 +2,48 @@ * File: z_en_arow_trap.c * Overlay: ovl_En_Arow_Trap * Description: An unused trap that reflects arrows. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ u32 unk_14C; - /* 0x0150 */ u32 attackTimer; + /* 0x014C */ u32 unk_14C; + /* 0x0150 */ u32 attackTimer; } ActorEnArowTrap; // size = 0x0154 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void Init(ActorEnArowTrap* this, GlobalContext* globalCtx); static void Destroy(ActorEnArowTrap* this, GlobalContext* globalCtx); static void Update(ActorEnArowTrap* this, GlobalContext* globalCtx); -const ActorInit En_Arow_Trap_InitVars = -{ - ACTOR_EN_AROW_TRAP, - ACTORTYPE_PROP, - ROOM, - FLAGS, - OBJECT_GAMEPLAY_KEEP, - sizeof(ActorEnArowTrap), - (ActorFunc)Init, - (ActorFunc)Destroy, - (ActorFunc)Update, - NULL +const ActorInit En_Arow_Trap_InitVars = { + ACTOR_EN_AROW_TRAP, ACTORTYPE_PROP, ROOM, FLAGS, OBJECT_GAMEPLAY_KEEP, sizeof(ActorEnArowTrap), (ActorFunc)Init, + (ActorFunc)Destroy, (ActorFunc)Update, NULL, }; -static void Init(ActorEnArowTrap* this, GlobalContext* globalCtx) -{ +static void Init(ActorEnArowTrap* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01); this->unk_14C = 0; this->attackTimer = 80; this->actor.posRot2.pos = this->actor.posRot.pos; } -static void Destroy(ActorEnArowTrap* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorEnArowTrap* this, GlobalContext* globalCtx) { } -static void Update(ActorEnArowTrap* this, GlobalContext* globalCtx) -{ - if (this->actor.xzDistanceFromLink <= 400) - { +static void Update(ActorEnArowTrap* this, GlobalContext* globalCtx) { + if (this->actor.xzDistanceFromLink <= 400) { this->attackTimer--; - if (this->attackTimer == 0) - { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, - this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, - this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, - 0xFFFFFFFF); + if (this->attackTimer == 0) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ARROW, this->actor.posRot.pos.x, + this->actor.posRot.pos.y, this->actor.posRot.pos.z, this->actor.shape.rot.x, + this->actor.shape.rot.y, this->actor.shape.rot.z, 0xFFFFFFFF); this->attackTimer = 80; } } 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 5eccf70449..858c204baf 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -1,6 +1,6 @@ #include "z_en_arrow.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnArrow_Init(EnArrow* this, GlobalContext* globalCtx); 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 d44e38cd5d..a09614155f 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 @@ -1,6 +1,6 @@ #include "z_en_attack_niw.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnAttackNiw_Init(EnAttackNiw* this, GlobalContext* globalCtx); 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 709fd4d72b..2b0d599c73 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -1,6 +1,6 @@ #include "z_en_ba.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnBa_Init(EnBa* this, GlobalContext* globalCtx); 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 1cf09e8a98..c00f0c431e 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -1,6 +1,6 @@ #include "z_en_bb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x01000015 void EnBb_Init(EnBb* this, GlobalContext* globalCtx); 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 6e8296d232..b201d8b109 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -1,6 +1,6 @@ #include "z_en_bdfire.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnBdfire_Init(EnBdfire* this, GlobalContext* globalCtx); 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 0f50335e42..d7fe07fc9f 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -1,6 +1,6 @@ #include "z_en_bigokuta.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void EnBigokuta_Init(EnBigokuta* this, GlobalContext* globalCtx); 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 89358438dd..d279338ef2 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -1,6 +1,6 @@ #include "z_en_bili.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00005005 void EnBili_Init(EnBili* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Bird/z_en_bird.c b/src/overlays/actors/ovl_En_Bird/z_en_bird.c index 4b355e81f2..93c0645966 100644 --- a/src/overlays/actors/ovl_En_Bird/z_en_bird.c +++ b/src/overlays/actors/ovl_En_Bird/z_en_bird.c @@ -2,33 +2,32 @@ * File: z_en_bird.c * Overlay: ovl_En_Bird * Description: The projectile fired by deku scrubs and octaroks. -*/ + */ #include #include -typedef struct -{ - /* 0x0000 */ Actor actor; +typedef struct { + /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ ActorFunc updateFunc; - /* 0x0194 */ u32 unk_194; - /* 0x0198 */ s32 unk_198; - /* 0x019C */ s16 unk_19C; - /* 0x019E */ char unk_19E[0x2]; - /* 0x01A0 */ f32 unk_1A0; - /* 0x01A4 */ f32 unk_1A4; - /* 0x01A8 */ f32 unk_1A8; - /* 0x01AC */ f32 unk_1AC; - /* 0x01B0 */ f32 unk_1B0; - /* 0x01B4 */ f32 unk_1B4; - /* 0x01B8 */ f32 unk_1B8; - /* 0x01BC */ f32 unk_1BC; - /* 0x01C0 */ s16 unk_1C0; - /* 0x01C2 */ char unk_1C2[0x1A]; + /* 0x0194 */ u32 unk_194; + /* 0x0198 */ s32 unk_198; + /* 0x019C */ s16 unk_19C; + /* 0x019E */ char unk_19E[0x2]; + /* 0x01A0 */ f32 unk_1A0; + /* 0x01A4 */ f32 unk_1A4; + /* 0x01A8 */ f32 unk_1A8; + /* 0x01AC */ f32 unk_1AC; + /* 0x01B0 */ f32 unk_1B0; + /* 0x01B4 */ f32 unk_1B4; + /* 0x01B8 */ f32 unk_1B8; + /* 0x01BC */ f32 unk_1BC; + /* 0x01C0 */ s16 unk_1C0; + /* 0x01C2 */ char unk_1C2[0x1A]; } EnBird; // size = 0x01C4 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnBird_Init(EnBird* this, GlobalContext* globalCtx); @@ -41,8 +40,7 @@ void EnBird_SetNewUpdate(EnBird* this, ActorFunc updateFunc); void func_809C1D60(EnBird* this, GlobalContext* globalCtx); void func_809C1CAC(EnBird* this, s16 params); -const ActorInit En_Bird_InitVars = -{ +const ActorInit En_Bird_InitVars = { ACTOR_EN_BIRD, ACTORTYPE_PROP, ROOM, @@ -55,21 +53,18 @@ const ActorInit En_Bird_InitVars = (ActorFunc)EnBird_Draw, }; -static InitChainEntry initChain[] = -{ - ICHAIN_F32(unk_4C, 5600, ICHAIN_STOP) +static InitChainEntry initChain[] = { + ICHAIN_F32(unk_4C, 5600, ICHAIN_STOP), }; extern u32 D_0600006C; extern u32 D_06002190; -void EnBird_SetNewUpdate(EnBird* this, ActorFunc newUpdateFunc) -{ +void EnBird_SetNewUpdate(EnBird* this, ActorFunc newUpdateFunc) { this->updateFunc = newUpdateFunc; } -void EnBird_Init(EnBird* this, GlobalContext* globalCtx) -{ +void EnBird_Init(EnBird* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, initChain); Actor_SetScale(&this->actor, 0.01); SkelAnime_Init(globalCtx, &this->skelAnime, &D_06002190, &D_0600006C, 0, 0, 0); @@ -88,16 +83,13 @@ void EnBird_Init(EnBird* this, GlobalContext* globalCtx) func_809C1CAC(this, this->actor.params); } -void EnBird_Destroy(EnBird* this, GlobalContext* globalCtx) -{ - +void EnBird_Destroy(EnBird* this, GlobalContext* globalCtx) { } #ifdef NON_MATCHING // D_0600006C address is reused when it shouldn't be // also minor ordering differences -void func_809C1CAC(EnBird* this, s16 params) -{ +void func_809C1CAC(EnBird* this, s16 params) { f32 frameCount = SkelAnime_GetFrameCount(&D_0600006C); f32 playbackSpeed = this->unk_19C ? 0.0f : 1.0f; this->unk_198 = Math_Rand_S16Offset(5, 0x23); @@ -108,46 +100,38 @@ void func_809C1CAC(EnBird* this, s16 params) #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Bird/func_809C1CAC.s") #endif -void func_809C1D60(EnBird* this, GlobalContext* globalCtx) -{ +void func_809C1D60(EnBird* this, GlobalContext* globalCtx) { f32 fVar2 = sinf(this->unk_1B4); this->actor.shape.unk_08 = this->actor.shape.unk_08 + fVar2 * this->unk_1A0; Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.1f, 0.5f, 0.0f); - if (this->unk_19C != 0) - { + if (this->unk_19C != 0) { this->skelAnime.animPlaybackSpeed = this->actor.speedXZ + this->actor.speedXZ; } SkelAnime_FrameUpdateMatrix(&this->skelAnime); this->unk_198 -= 1; - if (this->unk_198 <= 0) - { + if (this->unk_198 <= 0) { func_809C1E00(this, this->actor.params); } } -void func_809C1E00(EnBird* this, s16 params) -{ +void func_809C1E00(EnBird* this, s16 params) { this->unk_198 = Math_Rand_S16Offset(0x14, 0x2D); EnBird_SetNewUpdate(this, (ActorFunc)func_809C1E40); } - -void func_809C1E40(EnBird* this, GlobalContext* globalCtx) -{ +void func_809C1E40(EnBird* this, GlobalContext* globalCtx) { f32 fVar4 = sinf(this->unk_1B4); this->actor.shape.unk_08 += fVar4 * this->unk_1A0; Math_SmoothScaleMaxMinF(&this->actor.speedXZ, this->unk_1A8, 0.1f, this->unk_1AC, 0.0f); - if (this->unk_1B0 < Math_Vec3f_DistXZ(&this->actor.posRot.pos, &this->actor.initPosRot.pos) || this->unk_198 < 4) - { - func_80077B58(&this->actor.posRot.rot.y, Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos), this->unk_1C0); - } - else - { + if (this->unk_1B0 < Math_Vec3f_DistXZ(&this->actor.posRot.pos, &this->actor.initPosRot.pos) || this->unk_198 < 4) { + func_80077B58(&this->actor.posRot.rot.y, Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos), + this->unk_1C0); + } else { fVar4 = sinf(this->unk_1B4); this->actor.posRot.rot.y += (s16)(fVar4 * this->unk_1A4); } @@ -155,19 +139,16 @@ void func_809C1E40(EnBird* this, GlobalContext* globalCtx) this->actor.shape.rot.y = this->actor.posRot.rot.y; SkelAnime_FrameUpdateMatrix(&this->skelAnime); this->unk_198 -= 1; - if (this->unk_198 < 0) - { + if (this->unk_198 < 0) { func_809C1CAC(this, this->actor.params); } } -void EnBird_Update(EnBird* this, GlobalContext* globalCtx) -{ +void EnBird_Update(EnBird* this, GlobalContext* globalCtx) { this->unk_1B4 += this->unk_1B8; this->updateFunc(this, globalCtx); } -void EnBird_Draw(EnBird* this, GlobalContext* globalCtx) -{ +void EnBird_Draw(EnBird* this, GlobalContext* globalCtx) { SkelAnime_Draw(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, 0, NULL, NULL); } diff --git a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index 85d6c5d851..3d49c0686c 100644 --- a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -1,6 +1,6 @@ #include "z_en_blkobj.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnBlkobj_Init(EnBlkobj* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 1313f7d37c..9e5e8f1470 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -1,6 +1,6 @@ #include "z_en_bom.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnBom_Init(EnBom* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index e3136d3907..a1c172338a 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -1,6 +1,6 @@ #include "z_en_bom_bowl_man.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x08000039 void EnBomBowlMan_Init(EnBomBowlMan* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index f5c80248be..c10655c120 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -1,6 +1,6 @@ #include "z_en_bom_bowl_pit.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnBomBowlPit_Init(EnBomBowlPit* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 6e45fa3082..7b59910d74 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -1,6 +1,6 @@ #include "z_en_bom_chu.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnBomChu_Init(EnBomChu* this, GlobalContext* globalCtx); 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 c9b1bc035e..7171ed868e 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -1,6 +1,6 @@ #include "z_en_bombf.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000011 void EnBombf_Init(EnBombf* this, GlobalContext* globalCtx); 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 da3921c246..6bc88ee3a8 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -2,11 +2,11 @@ * File: z_en_boom.c * Overlay: ovl_En_Boom * Description: Thrown Boomerang. Actor spawns when thrown and is killed when caught. -*/ + */ #include "z_en_boom.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 static void EnBoom_SetupAction(EnBoom* this, ActorFunc* actionFunc); @@ -16,8 +16,7 @@ static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx); static void EnBoom_Update(EnBoom* this, GlobalContext* globalCtx); static void EnBoom_Draw(EnBoom* this, GlobalContext* globalCtx); -const ActorInit En_Boom_InitVars = -{ +const ActorInit En_Boom_InitVars = { ACTOR_EN_BOOM, ACTORTYPE_MISC, ROOM, @@ -27,37 +26,36 @@ const ActorInit En_Boom_InitVars = (ActorFunc)EnBoom_Init, (ActorFunc)EnBoom_Destroy, (ActorFunc)EnBoom_Update, - (ActorFunc)EnBoom_Draw + (ActorFunc)EnBoom_Draw, }; // Related to collision, should be moved somewhere else when collision_check is decompiled. // Seems to be made up of a bunch of substructs, but I didnt do too much digging. // This is probably not accurate. -typedef struct -{ - u8 unk_00; - u8 unk_01; - u8 unk_02; - u8 unk_03; - u8 unk_04; - u8 unk_05; +typedef struct { + u8 unk_00; + u8 unk_01; + u8 unk_02; + u8 unk_03; + u8 unk_04; + u8 unk_05; u16 pad_06; - u8 unk_08; - u8 pad_09; - u8 pad_0A; - u8 pad_0B; + u8 unk_08; + u8 pad_09; + u8 pad_0A; + u8 pad_0B; u32 unk_0C; - u8 unk_10; - u8 unk_11; + u8 unk_10; + u8 unk_11; u16 pad_12; u32 unk_14; - u8 unk_18; - u8 unk_19; + u8 unk_18; + u8 unk_19; u16 pad_1A; - u8 unk_1C; - u8 unk_1D; - u8 unk_1E; - u8 pad_1F; + u8 unk_1C; + u8 unk_1D; + u8 unk_1E; + u8 pad_1F; u32 unk_20; u32 unk_24; u32 unk_28; @@ -70,35 +68,30 @@ typedef struct u32 unk_44; u32 unk_48; u32 unk_4C; -} unkCollision; //size = 0x50 +} unkCollision; // size = 0x50 -static unkCollision col = -{ - 0x0A, 0x09, 0x00, 0x00, 0x08, 0x03, 0x0000, 0x02, 0x00, 0x00, 0x00, 0x00000010, - 0x00, 0x01, 0x0000, 0xFFCFFFFF, 0x00, 0x00, 0x0000, 0x05, 0x00, 0x00, 0x00, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, +static unkCollision col = { + 0x0A, 0x09, 0x00, 0x00, 0x08, 0x03, 0x0000, 0x02, 0x00, + 0x00, 0x00, 0x00000010, 0x00, 0x01, 0x0000, 0xFFCFFFFF, 0x00, 0x00, + 0x0000, 0x05, 0x00, 0x00, 0x00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_S8(unk_1F, 5, ICHAIN_CONTINUE), ICHAIN_VEC3S(shape.rot, 0, ICHAIN_STOP), }; static Vec3f mtxSrc1 = { -960.0f, 0.0f, 0.0f }; -static Vec3f mtxSrc2 = { 960.0f, 0.0f, 0.0f }; +static Vec3f mtxSrc2 = { 960.0f, 0.0f, 0.0f }; extern D_0400C808; -static void EnBoom_SetupAction(EnBoom* this, ActorFunc* actionFunc) -{ +static void EnBoom_SetupAction(EnBoom* this, ActorFunc* actionFunc) { this->actionFunc = actionFunc; } -static void EnBoom_Init(EnBoom* this, GlobalContext* globalCtx) -{ +static void EnBoom_Init(EnBoom* this, GlobalContext* globalCtx) { u32 pad; TrailEffect trail; @@ -138,14 +131,12 @@ static void EnBoom_Init(EnBoom* this, GlobalContext* globalCtx) EnBoom_SetupAction(this, &EnBoom_Fly); } -static void EnBoom_Destroy(EnBoom* this, GlobalContext* globalCtx) -{ +static void EnBoom_Destroy(EnBoom* this, GlobalContext* globalCtx) { func_8002709C(globalCtx, this->effect); func_8005D060(globalCtx, &this->collider); } -static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) -{ +static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { Actor* target; Player* player; s32 collided; @@ -165,8 +156,7 @@ static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) target = this->moveTo; // If the boomerang is moving toward a targeted actor, handle setting the proper x and y angle to fly toward it. - if (target != NULL) - { + if (target != NULL) { yawTarget = func_8002DAC0(&this->actor, &target->posRot2.pos); yawDiff = this->actor.posRot.rot.y - yawTarget; @@ -174,23 +164,21 @@ static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) pitchDiff = this->actor.posRot.rot.x - pitchTarget; distXYZScale = ((200.0f - Math_Vec3f_DistXYZ(&this->actor.posRot.pos, &target->posRot2.pos)) * 0.005f); - if (distXYZScale < 0.12f) + if (distXYZScale < 0.12f) { distXYZScale = 0.12f; - - if ((target != (Actor*)player) && ((target->update == NULL) || (ABS(yawDiff) > 0x4000))) - { + } + + if ((target != (Actor*)player) && ((target->update == NULL) || (ABS(yawDiff) > 0x4000))) { // BUG: This condition is why the boomerang will randomly fly off in a the down left direction sometimes. // If the actor targetted is not Link and the difference between the 2 y angles is greater than 0x4000, // the moveTo pointer is nulled and it flies off in a seemingly random direction. this->moveTo = NULL; - } - else - { + } else { Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yawTarget, (s16)(ABS(yawDiff) * distXYZScale)); Math_ApproxUpdateScaledS(&this->actor.posRot.rot.x, pitchTarget, (s16)(ABS(pitchDiff) * distXYZScale)); } } - + // Set xyz speed, move forward, and play the boomerang sound func_8002D9A4(&this->actor, 12.0f); Actor_MoveForward(&this->actor); @@ -199,42 +187,33 @@ static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) // If the boomerang collides with EnItem00 or a Skulltula token, set grabbed pointer to pick it up collided = (this->collider.colliderFlags & 0x2); collided = (!!(collided)); - if (collided) - { - if (((this->collider.at->id == ACTOR_EN_ITEM00) || (this->collider.at->id == ACTOR_EN_SI))) - { + if (collided) { + if (((this->collider.at->id == ACTOR_EN_ITEM00) || (this->collider.at->id == ACTOR_EN_SI))) { this->grabbed = this->collider.at; - if (this->collider.at->id == ACTOR_EN_SI) - { + if (this->collider.at->id == ACTOR_EN_SI) { this->collider.at->flags |= 0x2000; } } } - - // Decrement the return timer and check if its 0. If it is, check if Link can catch it and handle accordingly. + + // Decrement the return timer and check if its 0. If it is, check if Link can catch it and handle accordingly. // Otherwise handle grabbing and colliding. - if (DECR(this->returnTimer) == 0) - { + if (DECR(this->returnTimer) == 0) { distFromLink = Math_Vec3f_DistXYZ(&this->actor.posRot.pos, &player->actor.posRot2.pos); this->moveTo = player; - //If the boomerang is less than 40 units away from Link, he can catch it. - if (distFromLink < 40.0f) - { + // If the boomerang is less than 40 units away from Link, he can catch it. + if (distFromLink < 40.0f) { target = this->grabbed; - if (target != NULL) - { + if (target != NULL) { Math_Vec3f_Copy(&target->posRot.pos, &player->actor.posRot.pos); // If the grabbed actor is EnItem00 (HP/Key etc) set gravity and flags so it falls in front of Link. // Otherwise if its a Skulltula Token, just set flags so he collides with it to collect it. - if (target->id == ACTOR_EN_ITEM00) - { + if (target->id == ACTOR_EN_ITEM00) { target->gravity = -0.9f; target->bgCheckFlags &= ~0x03; - } - else - { + } else { target->flags &= ~0x2000; } } @@ -242,42 +221,34 @@ static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) player->stateFlags1 &= ~0x02000000; Actor_Kill(&this->actor); } - } - else - { + } else { collided = (this->collider.colliderFlags & 0x2); collided = (!!(collided)); - if (collided) - { + if (collided) { // Copy the position from the prevous frame to the boomerang to start the bounce back. Math_Vec3f_Copy(&this->actor.posRot.pos, &this->actor.pos4); - } - else - { + } else { collided = func_8003DE84(&globalCtx->colCtx, &this->actor.pos4, &this->actor.posRot.pos, &hitPoint, - &this->actor.wallPoly, 1, 1, 1, 1, &hitDynaID); + &this->actor.wallPoly, 1, 1, 1, 1, &hitDynaID); - if (collided != 0) - { + if (collided != 0) { // If the boomerang coolides with something and its is a Jabu Object actor with params equal to 0, then - // set collided to 0 so that the boomerang will go through the wall. + // set collided to 0 so that the boomerang will go through the wall. // Otherwise play a clank sound and keep collided set to bounce back. if ((func_8002F9EC(globalCtx, &this->actor, this->actor.wallPoly, hitDynaID, &hitPoint) != 0) || - ((hitDynaID != 0x32) && ((hitActor = DynaPolyInfo_GetActor(&globalCtx->colCtx, hitDynaID)) != NULL) && (hitActor->actor.id == ACTOR_BG_BDAN_OBJECTS) && (hitActor->actor.params == 0))) - { + ((hitDynaID != 0x32) && + ((hitActor = DynaPolyInfo_GetActor(&globalCtx->colCtx, hitDynaID)) != NULL) && + (hitActor->actor.id == ACTOR_BG_BDAN_OBJECTS) && (hitActor->actor.params == 0))) { collided = 0; - } - else - { + } else { func_80062D60(globalCtx, &hitPoint); - } + } } } - + // If the boomerang needs to bounce back, set x and y angle accordingly. // Set timer to 0 and set return actor to player so it goes back to Link. - if (collided != 0) - { + if (collided != 0) { this->actor.posRot.rot.x = -this->actor.posRot.rot.x; this->actor.posRot.rot.y += 0x8000; this->moveTo = player; @@ -288,32 +259,25 @@ static void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) // If the actor the boomerang is holding has a null update function, set grabbed to null. // Otherwise, copy the position from the boomerang to the actor to move it. target = this->grabbed; - if (target != NULL) - { - if (target->update == NULL) - { + if (target != NULL) { + if (target->update == NULL) { this->grabbed = NULL; - } - else - { + } else { Math_Vec3f_Copy(&target->posRot.pos, &this->actor.posRot.pos); } } } -static void EnBoom_Update(EnBoom* this, GlobalContext* globalCtx) -{ +static void EnBoom_Update(EnBoom* this, GlobalContext* globalCtx) { Player* player = PLAYER; - if (!(player->stateFlags1 & 0x20000000)) - { + if (!(player->stateFlags1 & 0x20000000)) { this->actionFunc(this, globalCtx); Actor_SetHeight(&this->actor, 0.0f); this->activeTimer = this->activeTimer + 1; } } -static void EnBoom_Draw(EnBoom* this, GlobalContext* globalCtx) -{ +static void EnBoom_Draw(EnBoom* this, GlobalContext* globalCtx) { s32 pad; Vec3f mtxDest1; Vec3f mtxDest2; @@ -328,8 +292,7 @@ static void EnBoom_Draw(EnBoom* this, GlobalContext* globalCtx) Matrix_MultVec3f(&mtxSrc1, &mtxDest1); Matrix_MultVec3f(&mtxSrc2, &mtxDest2); - if (func_80090480(globalCtx, &this->collider, &this->unk_1DC, &mtxDest1, &mtxDest2) != 0) - { + if (func_80090480(globalCtx, &this->collider, &this->unk_1DC, &mtxDest1, &mtxDest2) != 0) { func_8001FDF0(func_80026B0C(this->effect), &mtxDest1, &mtxDest2); } diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 2cd3cc8ece..a841cf8bd5 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -1,6 +1,6 @@ #include "z_en_box.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnBox_Init(EnBox* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index fe49fa8767..42afcfa753 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -1,6 +1,6 @@ #include "z_en_brob.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnBrob_Init(EnBrob* this, GlobalContext* globalCtx); 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 6587f45927..a925f6a46e 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -1,6 +1,6 @@ #include "z_en_bubble.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000001 void EnBubble_Init(EnBubble* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index 647cb10de7..c34f06f0fb 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -1,6 +1,6 @@ #include "z_en_butte.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnButte_Init(EnButte* this, GlobalContext* globalCtx); 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 66d2c3626e..1a700781a8 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -1,6 +1,6 @@ #include "z_en_bw.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnBw_Init(EnBw* this, GlobalContext* globalCtx); 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 70f6261c5f..a65c91b2ab 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -1,6 +1,6 @@ #include "z_en_bx.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnBx_Init(EnBx* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.c b/src/overlays/actors/ovl_En_Changer/z_en_changer.c index bc89faafa3..65e73fd513 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -1,6 +1,6 @@ #include "z_en_changer.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnChanger_Init(EnChanger* this, GlobalContext* globalCtx); 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 b3a31c0fd2..cf78c10fed 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 @@ -1,6 +1,6 @@ #include "z_en_clear_tag.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void EnClearTag_Init(EnClearTag* this, GlobalContext* globalCtx); @@ -44,4 +44,3 @@ const ActorInit En_Clear_Tag_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Clear_Tag/func_809D5004.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Clear_Tag/func_809D53CC.s") - diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index bd9ae92128..c9a55ffebd 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -1,6 +1,6 @@ #include "z_en_cow.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnCow_Init(EnCow* this, GlobalContext* globalCtx); 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 d00d419264..195c6a88a5 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -1,6 +1,6 @@ #include "z_en_crow.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00005005 void EnCrow_Init(EnCrow* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 003bc39406..0adb43c976 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -1,6 +1,6 @@ #include "z_en_cs.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnCs_Init(EnCs* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index eb3a8a2c57..ef886765c1 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -1,6 +1,6 @@ #include "z_en_daiku.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnDaiku_Init(EnDaiku* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 7f6effe716..a5d5cde51a 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -1,6 +1,6 @@ #include "z_en_daiku_kakariko.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnDaikuKakariko_Init(EnDaikuKakariko* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 43dd06da1f..2e46a02fe3 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1,6 +1,6 @@ #include "z_en_dekubaba.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnDekubaba_Init(EnDekubaba* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 034d881812..d547fc737c 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -1,6 +1,6 @@ #include "z_en_dekunuts.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnDekunuts_Init(EnDekunuts* this, GlobalContext* globalCtx); 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 94ed51fec5..173f96e41c 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -1,6 +1,6 @@ #include "z_en_dh.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000415 void EnDh_Init(EnDh* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 24a9e9d8e3..e3e36c0e33 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -1,6 +1,6 @@ #include "z_en_dha.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnDha_Init(EnDha* this, GlobalContext* globalCtx); 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 1162d8f9fe..cb1c8d77ac 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 @@ -1,6 +1,6 @@ #include "z_en_diving_game.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnDivingGame_Init(EnDivingGame* this, GlobalContext* globalCtx); 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 7edfcc1c93..4a6b6e71e0 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -1,6 +1,6 @@ #include "z_en_dns.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnDns_Init(EnDns* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index bcb0ea1df2..b8f150034f 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -1,6 +1,6 @@ #include "z_en_dnt_demo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnDntDemo_Init(EnDntDemo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index 52151a95c7..659df06f6b 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -1,6 +1,6 @@ #include "z_en_dnt_jiji.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnDntJiji_Init(EnDntJiji* this, GlobalContext* globalCtx); 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 c0e938e600..c784d2b49a 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 @@ -1,6 +1,6 @@ #include "z_en_dnt_nomal.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnDntNomal_Init(EnDntNomal* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index f48eed4dcb..96f2578d50 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -1,6 +1,6 @@ #include "z_en_dodojr.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnDodojr_Init(EnDodojr* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 3d90f3eda5..1bf9689dc7 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -1,6 +1,6 @@ #include "z_en_dodongo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnDodongo_Init(EnDodongo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 67393b61e4..c9e1d06c25 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -1,6 +1,6 @@ #include "z_en_dog.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void EnDog_Init(EnDog* this, GlobalContext* globalCtx); @@ -15,8 +15,7 @@ static void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx); static void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx); static void EnDog_Wait(EnDog* this, GlobalContext* globalCtx); -const ActorInit En_Dog_InitVars = -{ +const ActorInit En_Dog_InitVars = { ACTOR_EN_DOG, ACTORTYPE_NPC, ROOM, @@ -29,68 +28,48 @@ const ActorInit En_Dog_InitVars = (ActorFunc)EnDog_Draw, }; -static ColliderCylinderInit cylinderInit = -{ - 0x06, 0x00, 0x09, 0x39, - 0x10, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00000000, - 0x00, 0x00, 0x00, 0x00, - 0xFFCFFFFF, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x01, 0x00, +static ColliderCylinderInit cylinderInit = { + 0x06, 0x00, 0x09, 0x39, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00000000, + 0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, - 0x0010, - 0x0014, - 0x0000, - 0x0000, 0x0000, 0x0000, + 0x0010, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, }; // There are multiple versions of sub98 init structs // Keeping these local until z_collision_check is decompiled -typedef struct -{ +typedef struct { /* 0x00 */ u8 health; /* 0x02 */ s16 unk_10; /* 0x04 */ s16 unk_12; /* 0x06 */ u16 unk_14; /* 0x08 */ u8 mass; -}sub98Init; +} sub98Init; -static sub98Init sub98Data = -{ - 0x00, //health - 0x0000, //unk_10 - 0x0000, //unk_12 - 0x0000, //unk_14 - 0x32, //mass +static sub98Init sub98Data = { + 0x00, // health + 0x0000, // unk_10 + 0x0000, // unk_12 + 0x0000, // unk_14 + 0x32, // mass }; -static struct_80034EC0_Entry animations[]= -{ - {0x06001368, 1.0f, 0.0f, -1.0f, 0x00, 0.0f}, - {0x06001368, 1.0f, 0.0f, -1.0f, 0x00, -6.0f}, - {0x06000D78, 1.0f, 0.0f, -1.0f, 0x00, -6.0f}, - {0x06000278, 1.0f, 0.0f, -1.0f, 0x00, -6.0f}, - {0x06001150, 1.0f, 0.0f, 4.0f, 0x02, -6.0f}, - {0x06001150, 1.0f, 5.0f, 25.0f,0x04, -6.0f}, - {0x06000928, 1.0f, 0.0f, 6.0f, 0x02, -6.0f}, - {0x06000C28, 1.0f, 0.0f, -1.0f, 0x00, -6.0f}, +static struct_80034EC0_Entry animations[] = { + { 0x06001368, 1.0f, 0.0f, -1.0f, 0x00, 0.0f }, { 0x06001368, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, + { 0x06000D78, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, { 0x06000278, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, + { 0x06001150, 1.0f, 0.0f, 4.0f, 0x02, -6.0f }, { 0x06001150, 1.0f, 5.0f, 25.0f, 0x04, -6.0f }, + { 0x06000928, 1.0f, 0.0f, 6.0f, 0x02, -6.0f }, { 0x06000C28, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, }; // Bandaid fix for a lw vs lh issue in EnDog_FollowPath. Roman will look at it later. -typedef union -{ +typedef union { /* 0x00 */ s32 entry; - struct - { + struct { s16 unk_0; s16 unk_2; }; -}s16ArrEntry; +} s16ArrEntry; -typedef enum -{ +typedef enum { /* 0x00 */ DOG_WALK, /* 0x01 */ DOG_RUN, /* 0x02 */ DOG_BARK, @@ -105,127 +84,105 @@ extern UNK_PTR D_06001368; extern UNK_PTR D_06000D78; extern UNK_PTR D_06000278; -static void EnDog_PlayWalkSFX(EnDog* this) -{ +static void EnDog_PlayWalkSFX(EnDog* this) { u32* walk = &D_06001368; - if (this->skelAnime.animCurrent == walk) - { - if ((this->skelAnime.animCurrentFrame == 1.0f) || (this->skelAnime.animCurrentFrame == 7.0f)) - { + if (this->skelAnime.animCurrent == walk) { + if ((this->skelAnime.animCurrentFrame == 1.0f) || (this->skelAnime.animCurrentFrame == 7.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHIBI_WALK); } } } -static void EnDog_PlayRunSFX(EnDog* this) -{ +static void EnDog_PlayRunSFX(EnDog* this) { u32* run = &D_06000D78; - if (this->skelAnime.animCurrent == run) - { - if ((this->skelAnime.animCurrentFrame == 2.0f) || (this->skelAnime.animCurrentFrame == 4.0f)) - { + if (this->skelAnime.animCurrent == run) { + if ((this->skelAnime.animCurrentFrame == 2.0f) || (this->skelAnime.animCurrentFrame == 4.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHIBI_WALK); } } } -static void EnDog_PlayBarkSFX(EnDog* this) -{ +static void EnDog_PlayBarkSFX(EnDog* this) { u32* bark = &D_06000278; - if (this->skelAnime.animCurrent == bark) - { - if ((this->skelAnime.animCurrentFrame == 13.0f) || (this->skelAnime.animCurrentFrame == 19.0f)) - { + if (this->skelAnime.animCurrent == bark) { + if ((this->skelAnime.animCurrentFrame == 13.0f) || (this->skelAnime.animCurrentFrame == 19.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_BARK); } } } -static s32 EnDog_PlayAnimAndSFX(EnDog* this) -{ +static s32 EnDog_PlayAnimAndSFX(EnDog* this) { s32 animation; - if (this->behavior != this->nextBehavior) - { - if (this->nextBehavior == DOG_SIT_2) - { + if (this->behavior != this->nextBehavior) { + if (this->nextBehavior == DOG_SIT_2) { this->nextBehavior = DOG_SIT; } - if (this->nextBehavior == DOG_BOW_2) - { + if (this->nextBehavior == DOG_BOW_2) { this->nextBehavior = DOG_BOW; } this->behavior = this->nextBehavior; - switch(this->behavior) - { - case DOG_WALK: - animation = 1; + switch (this->behavior) { + case DOG_WALK: + animation = 1; break; - case DOG_RUN: - animation = 2; + case DOG_RUN: + animation = 2; break; - case DOG_BARK: - animation = 3; + case DOG_BARK: + animation = 3; break; case DOG_SIT: - animation = 4; + animation = 4; break; - case DOG_BOW: - animation = 6; + case DOG_BOW: + animation = 6; break; } func_80034EC0(&this->skelAnime, &animations, animation); } - - switch(this->behavior) - { - case DOG_SIT: - if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount) != 0) - { + + switch (this->behavior) { + case DOG_SIT: + if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount) != 0) { func_80034EC0(&this->skelAnime, &animations, 5); this->behavior = this->nextBehavior = DOG_SIT_2; } break; - case DOG_BOW: - if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount) != 0) - { + case DOG_BOW: + if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount) != 0) { func_80034EC0(&this->skelAnime, &animations, 7); this->behavior = this->nextBehavior = DOG_BOW_2; } break; - case DOG_WALK: - EnDog_PlayWalkSFX(this); + case DOG_WALK: + EnDog_PlayWalkSFX(this); break; - case DOG_RUN: + case DOG_RUN: EnDog_PlayRunSFX(this); break; - case DOG_BARK: + case DOG_BARK: EnDog_PlayBarkSFX(this); - if (this){} // needed for regalloc + if (this) {} // needed for regalloc break; } return 0; } -static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) -{ - if ((this->collider.base.collideFlags & 2)) - { +static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) { + if ((this->collider.base.collideFlags & 2)) { this->collider.base.collideFlags &= ~2; return 2; } - if (globalCtx->sceneNum == SCENE_MARKET_DAY) - { + if (globalCtx->sceneNum == SCENE_MARKET_DAY) { return 0; } - if ((this->collider.base.maskB & 1)) - { + if ((this->collider.base.maskB & 1)) { this->collider.base.maskB &= ~1; - if (gSaveContext.dogParams != 0) - { + if (gSaveContext.dogParams != 0) { return 0; } gSaveContext.dogParams = (this->actor.params & 0x7FFF); @@ -235,37 +192,27 @@ static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx) return 0; } -static EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) -{ +static EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) { s32 change; - if (this->path == NULL) - { + if (this->path == NULL) { return 0; } - if (this->reverse) - { + if (this->reverse) { change = -1; - } - else - { + } else { change = 1; } - + this->waypoint += change; - if (this->reverse) - { - if (this->waypoint < 0) - { + if (this->reverse) { + if (this->waypoint < 0) { this->waypoint = this->path->count - 1; } - } - else - { - if ((this->path->count - 1) < this->waypoint) - { + } else { + if ((this->path->count - 1) < this->waypoint) { this->waypoint = 0; } } @@ -273,26 +220,21 @@ static EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx) return 1; } -static s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx) -{ +static s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx) { s16 targetYaw; f32 waypointDistSq; - + waypointDistSq = func_8008E520(&this->actor, this->path, this->waypoint, &targetYaw); Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, targetYaw, 10, 1000, 1); - if ((waypointDistSq > 0.0f) && (waypointDistSq < 1000.0f)) - { + if ((waypointDistSq > 0.0f) && (waypointDistSq < 1000.0f)) { return EnDog_UpdateWaypoint(this, globalCtx); - } - else - { + } else { return 0; } } -static void EnDog_Init(EnDog* this, GlobalContext* globalCtx) -{ +static void EnDog_Init(EnDog* this, GlobalContext* globalCtx) { SkelAnime* skelAnime; s16 followingDog; ColliderCylinderMain* collider; @@ -302,15 +244,13 @@ static void EnDog_Init(EnDog* this, GlobalContext* globalCtx) skelAnime = &this->skelAnime; func_800A46F8(globalCtx, skelAnime, &D_06007290, 0, &this->unk_1F4, &this->unk_242, 13); func_80034EC0(skelAnime, animations, 0); - - if ((this->actor.params & 0x8000) == 0) - { + + if ((this->actor.params & 0x8000) == 0) { this->actor.params = (this->actor.params & 0xF0FF) | ((((this->actor.params & 0x0F00) >> 8) + 1) << 8); } followingDog = ((gSaveContext.dogParams & 0x0F00) >> 8); - if (followingDog == ((this->actor.params & 0x0F00) >> 8) && ((this->actor.params & 0x8000) == 0)) - { + if (followingDog == ((this->actor.params & 0x0F00) >> 8) && ((this->actor.params & 0x8000) == 0)) { Actor_Kill(&this->actor); return; } @@ -323,26 +263,20 @@ static void EnDog_Init(EnDog* this, GlobalContext* globalCtx) this->actor.gravity = -1.0f; this->path = func_8008E4E0(globalCtx, (s16)((this->actor.params & 0x00F0) >> 4), 0xF); - switch (globalCtx->sceneNum) - { + switch (globalCtx->sceneNum) { case SCENE_MARKET_NIGHT: - if ((!gSaveContext.dogIsLost) && (((this->actor.params & 0x0F00) >> 8) == 1)) - { + if ((!gSaveContext.dogIsLost) && (((this->actor.params & 0x0F00) >> 8) == 1)) { Actor_Kill(&this->actor); } break; case SCENE_IMPA: // Richard's Home - if ((u32)(this->actor.params & 0x8000) == 0) - { - if (!gSaveContext.dogIsLost) - { + if ((u32)(this->actor.params & 0x8000) == 0) { + if (!gSaveContext.dogIsLost) { this->nextBehavior = DOG_SIT; this->actionFunc = EnDog_Wait; this->actor.speedXZ = 0.0f; return; - } - else - { + } else { Actor_Kill(&this->actor); return; } @@ -350,44 +284,34 @@ static void EnDog_Init(EnDog* this, GlobalContext* globalCtx) break; } - if ((u32)(this->actor.params & 0x8000) != 0) - { + if ((u32)(this->actor.params & 0x8000) != 0) { this->nextBehavior = DOG_WALK; this->actionFunc = EnDog_FollowLink; - } - else - { + } else { this->nextBehavior = DOG_SIT; this->actionFunc = EnDog_ChooseMovement; } } -static void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx) -{ - ColliderCylinderMain* collider = &this->collider; +static void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx) { + ColliderCylinderMain* collider = &this->collider; ActorCollider_FreeCylinder(globalCtx, collider); } -static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) -{ +static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) { s16ArrEntry behaviors[] = { DOG_SIT, DOG_BOW, DOG_BARK }; s16ArrEntry unused[] = { 40, 80, 20 }; f32 speed; s32 frame; - if (EnDog_CanFollow(this, globalCtx) == 1) - { + if (EnDog_CanFollow(this, globalCtx) == 1) { this->actionFunc = EnDog_FollowLink; } - if (DECR(this->behaviorTimer) != 0) - { - if (this->nextBehavior == DOG_WALK) - { + if (DECR(this->behaviorTimer) != 0) { + if (this->nextBehavior == DOG_WALK) { speed = 1.0f; - } - else - { + } else { speed = 4.0f; } Math_SmoothScaleMaxMinF(&this->actor.speedXZ, speed, 0.4f, 1.0f, 0.0f); @@ -396,19 +320,14 @@ static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) // Used to change between two text boxes for Richard's owner in the Market Day scene // depending on where he is on his path. En_Hy checks these event flags. - if (this->waypoint < 9) - { + if (this->waypoint < 9) { // Richard is close to her, text says something about his coat gSaveContext.event_inf[3] |= 1; - } - else - { + } else { // Richard is far, text says something about running fast gSaveContext.event_inf[3] &= ~1; } - } - else - { + } else { frame = globalCtx->state.frames % 3; this->nextBehavior = behaviors[frame].entry; // no clue why they're using the action id to calculate timer. possibly meant to use the unused array? @@ -417,27 +336,20 @@ static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx) } } -static void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx) -{ - if (EnDog_CanFollow(this, globalCtx) == 1) - { +static void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx) { + if (EnDog_CanFollow(this, globalCtx) == 1) { this->actionFunc = EnDog_FollowLink; } - if (DECR(this->behaviorTimer) == 0) - { + if (DECR(this->behaviorTimer) == 0) { this->behaviorTimer = Math_Rand_S16Offset(200, 100); - if (globalCtx->state.frames % 2) - { + if (globalCtx->state.frames % 2) { this->nextBehavior = DOG_WALK; - } - else - { + } else { this->nextBehavior = DOG_RUN; } - if (this->nextBehavior == DOG_RUN) - { + if (this->nextBehavior == DOG_RUN) { this->behaviorTimer /= 2; } this->actionFunc = EnDog_FollowPath; @@ -445,81 +357,63 @@ static void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx) Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.4f, 1.0f, 0.0f); } -static void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx) -{ +static void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx) { f32 speed; - if (gSaveContext.dogParams == 0) - { + if (gSaveContext.dogParams == 0) { this->nextBehavior = DOG_SIT; this->actionFunc = EnDog_Wait; this->actor.speedXZ = 0.0f; - return; + return; } - - if (this->actor.xzDistanceFromLink > 400.0f) - { - if (this->nextBehavior != DOG_SIT && this->nextBehavior != DOG_SIT_2) - { + + if (this->actor.xzDistanceFromLink > 400.0f) { + if (this->nextBehavior != DOG_SIT && this->nextBehavior != DOG_SIT_2) { this->nextBehavior = DOG_BOW; } gSaveContext.dogParams = 0; speed = 0.0f; - } - else if (this->actor.xzDistanceFromLink > 100.0f) - { + } else if (this->actor.xzDistanceFromLink > 100.0f) { this->nextBehavior = DOG_RUN; speed = 4.0f; - } - else if (this->actor.xzDistanceFromLink < 40.0f) - { - if (this->nextBehavior != DOG_BOW && this->nextBehavior != DOG_BOW_2) - { + } else if (this->actor.xzDistanceFromLink < 40.0f) { + if (this->nextBehavior != DOG_BOW && this->nextBehavior != DOG_BOW_2) { this->nextBehavior = DOG_BOW; } speed = 0.0f; - } - else - { + } else { this->nextBehavior = DOG_WALK; speed = 1.0f; } - + Math_SmoothScaleMaxF(&this->actor.speedXZ, speed, 0.6f, 1.0f); - if (!(this->actor.xzDistanceFromLink > 400.0f)) - { + if (!(this->actor.xzDistanceFromLink > 400.0f)) { Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->actor.rotTowardsLinkY, 10, 1000, 1); this->actor.shape.rot = this->actor.posRot.rot; } } -static void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx) -{ - if (this->actor.xzDistanceFromLink < 200.0f) - { +static void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx) { + if (this->actor.xzDistanceFromLink < 200.0f) { Math_SmoothScaleMaxF(&this->actor.speedXZ, 4.0f, 0.6f, 1.0f); Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, (this->actor.rotTowardsLinkY ^ 0x8000), 10, 1000, 1); - } - else - { + } else { this->actionFunc = EnDog_FaceLink; } this->actor.shape.rot = this->actor.posRot.rot; } -static void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) -{ +static void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) { s16 rotTowardLink; s16 prevRotY; f32 absAngleDiff; - + // if the dog is more than 200 units away from Link, turn to face him then wait - if (200.0f <= this->actor.xzDistanceFromLink) - { + if (200.0f <= this->actor.xzDistanceFromLink) { this->nextBehavior = DOG_WALK; - Math_SmoothScaleMaxF(&this->actor.speedXZ, 1.0f, 0.6f, 1.0f); + Math_SmoothScaleMaxF(&this->actor.speedXZ, 1.0f, 0.6f, 1.0f); rotTowardLink = this->actor.rotTowardsLinkY; prevRotY = this->actor.posRot.rot.y; @@ -528,62 +422,51 @@ static void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx) absAngleDiff = this->actor.posRot.rot.y; absAngleDiff -= prevRotY; absAngleDiff = fabsf(absAngleDiff); - if (absAngleDiff < 200.0f) - { + if (absAngleDiff < 200.0f) { this->nextBehavior = DOG_SIT; this->actionFunc = EnDog_Wait; this->actor.speedXZ = 0.0f; } - } - else - { + } else { this->nextBehavior = DOG_RUN; this->actionFunc = EnDog_RunAway; } this->actor.shape.rot = this->actor.posRot.rot; } -static void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) -{ +static void EnDog_Wait(EnDog* this, GlobalContext* globalCtx) { this->unusedAngle = (this->actor.rotTowardsLinkY - this->actor.shape.rot.y); // If another dog is following Link and he gets within 200 units of waiting dog, run away - if ((gSaveContext.dogParams != 0) && (this->actor.xzDistanceFromLink < 200.0f)) - { + if ((gSaveContext.dogParams != 0) && (this->actor.xzDistanceFromLink < 200.0f)) { this->nextBehavior = DOG_RUN; this->actionFunc = EnDog_RunAway; } } -static void EnDog_Update(EnDog* this, GlobalContext* globalCtx) -{ +static void EnDog_Update(EnDog* this, GlobalContext* globalCtx) { s32 pad1; s32 pad2; EnDog_PlayAnimAndSFX(this); SkelAnime_FrameUpdateMatrix(&this->skelAnime); - func_8002E4B4(globalCtx, &this->actor, this->collider.dim.radius, - this->collider.dim.height * 0.5f, 0.0f, 5); + func_8002E4B4(globalCtx, &this->actor, this->collider.dim.radius, this->collider.dim.height * 0.5f, 0.0f, 5); Actor_MoveForward(&this->actor); this->actionFunc(this, globalCtx); ActorCollider_Cylinder_Update(&this->actor, &this->collider); Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); } -static UNK_TYPE EnDog_Callback1(UNK_TYPE unused1, UNK_TYPE unused2, UNK_TYPE unused3, UNK_TYPE unused4) -{ +static UNK_TYPE EnDog_Callback1(UNK_TYPE unused1, UNK_TYPE unused2, UNK_TYPE unused3, UNK_TYPE unused4) { return 0; } -static void EnDog_Callback2(UNK_TYPE unused1, UNK_TYPE unused2, UNK_TYPE unused3, UNK_TYPE unused4) -{ - +static void EnDog_Callback2(UNK_TYPE unused1, UNK_TYPE unused2, UNK_TYPE unused3, UNK_TYPE unused4) { } -static void EnDog_Draw(EnDog* this, GlobalContext* globalCtx) -{ +static void EnDog_Draw(EnDog* this, GlobalContext* globalCtx) { s32 pad; - Color_RGBA8 colors[] = { {0xFF, 0xFF, 0xC8, 0x00}, {0x96, 0x64, 0x32, 0x00} }; + Color_RGBA8 colors[] = { { 0xFF, 0xFF, 0xC8, 0x00 }, { 0x96, 0x64, 0x32, 0x00 } }; GraphicsContext* gfxCtx; s32 pad2[2]; Gfx* gfxArr[2]; @@ -593,11 +476,10 @@ static void EnDog_Draw(EnDog* this, GlobalContext* globalCtx) func_80093D18(globalCtx->state.gfxCtx); gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, - colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, + gDPSetEnvColor(gfxCtx->polyOpa.p++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a); - func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, - this->skelAnime.dListCount, EnDog_Callback1, EnDog_Callback2, &this->actor); + func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, + EnDog_Callback1, EnDog_Callback2, &this->actor); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_dog.c", 994); } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 4773451998..1dcf925929 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -1,6 +1,6 @@ #include "z_en_door.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnDoor_Init(EnDoor* this, GlobalContext* globalCtx); 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 9c3506c55b..5141702415 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -1,6 +1,6 @@ #include "z_en_ds.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnDs_Init(EnDs* this, GlobalContext* globalCtx); @@ -62,6 +62,3 @@ const ActorInit En_Ds_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ds/func_809FDA7C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ds/EnDs_Draw.s") - - - 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 880e2688a4..dfe8c4fe00 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -1,6 +1,6 @@ #include "z_en_du.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000009 void EnDu_Init(EnDu* this, GlobalContext* globalCtx); 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 2e7292896b..3319b32e46 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 @@ -1,6 +1,6 @@ #include "z_en_dy_extra.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnDyExtra_Init(EnDyExtra* this, GlobalContext* globalCtx); 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 249ee02aed..b6ef202b44 100644 --- a/src/overlays/actors/ovl_En_Eg/z_en_eg.c +++ b/src/overlays/actors/ovl_En_Eg/z_en_eg.c @@ -2,17 +2,16 @@ * File: z_en_eg.c * Overlay: ovl_En_Eg * Description: Zelda's Path in Ganon Castle Escape? -*/ + */ #include #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; - /* 0x014C */ s32 funcIndex; + /* 0x014C */ s32 funcIndex; } ActorEg; // size = 0x0154 #define ROOM 0x00 @@ -26,41 +25,30 @@ static void Update(ActorEg* this, GlobalContext* globalCtx); static void Draw(ActorEg* this, GlobalContext* globalCtx); static bool hasVoidedOut = false; -static const ActorFunc funcTbl[] = { (ActorFunc)func_809FFDC8 }; +static const ActorFunc funcTbl[] = { + (ActorFunc)func_809FFDC8, +}; -const ActorInit En_Eg_InitVars = -{ - ACTOR_EN_EG, - ACTORTYPE_ITEMACTION, - ROOM, - FLAGS, - OBJECT_ZL2, - sizeof(ActorEg), - (ActorFunc)Init, - (ActorFunc)Destroy, - (ActorFunc)Update, +const ActorInit En_Eg_InitVars = { + ACTOR_EN_EG, ACTORTYPE_ITEMACTION, ROOM, + FLAGS, OBJECT_ZL2, sizeof(ActorEg), + (ActorFunc)Init, (ActorFunc)Destroy, (ActorFunc)Update, (ActorFunc)Draw, }; -static void PlayVoidOutSFX() -{ +static void PlayVoidOutSFX() { func_800788CC(NA_SE_OC_ABYSS); } -static void Destroy(ActorEg* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorEg* this, GlobalContext* globalCtx) { } -static void Init(ActorEg* this, GlobalContext* globalCtx) -{ +static void Init(ActorEg* this, GlobalContext* globalCtx) { this->funcIndex = 0; } -static void func_809FFDC8(ActorEg* this, GlobalContext* globalCtx) -{ - if (!hasVoidedOut && (gSaveContext.timer_2_value < 1) && - Flags_GetSwitch(globalCtx, 0x36) && (kREG(0) == 0)) - { +static void func_809FFDC8(ActorEg* this, GlobalContext* globalCtx) { + if (!hasVoidedOut && (gSaveContext.timer_2_value < 1) && Flags_GetSwitch(globalCtx, 0x36) && (kREG(0) == 0)) { // Void the player out func_800C0C88(globalCtx); gSaveContext.respawn_flag = -2; @@ -71,21 +59,16 @@ static void func_809FFDC8(ActorEg* this, GlobalContext* globalCtx) } } -static void Update(ActorEg* this, GlobalContext* globalCtx) -{ +static void Update(ActorEg* this, GlobalContext* globalCtx) { s32 funcIndex = this->funcIndex; - if (((funcIndex < 0) || (0 < funcIndex)) || (funcTbl[funcIndex] == NULL)) - { + if (((funcIndex < 0) || (0 < funcIndex)) || (funcTbl[funcIndex] == NULL)) { // Translates to: "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); - } - else - { + } else { funcTbl[funcIndex](this, globalCtx); } } -static void Draw(ActorEg* this, GlobalContext* globalCtx) -{ +static void Draw(ActorEg* this, GlobalContext* globalCtx) { } 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 1ec6fbca82..f6a52d1add 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -1,6 +1,6 @@ #include "z_en_eiyer.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnEiyer_Init(EnEiyer* this, GlobalContext* globalCtx); 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 8d34c6458b..e4fa180b6f 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1,6 +1,6 @@ #include "z_en_elf.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000030 void EnElf_Init(EnElf* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 3a7f1e7222..c0532da414 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -1,6 +1,6 @@ #include "z_en_encount1.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x08000010 void EnEncount1_Init(EnEncount1* this, GlobalContext* globalCtx); 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 854720464b..47a101ec5f 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -1,6 +1,6 @@ #include "z_en_encount2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnEncount2_Init(EnEncount2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 86428d40be..00bce1411e 100644 --- a/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -1,6 +1,6 @@ #include "z_en_ex_item.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnExItem_Init(EnExItem* this, GlobalContext* globalCtx); 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 03c2d7a21f..87c1502e53 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 @@ -1,6 +1,6 @@ #include "z_en_ex_ruppy.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnExRuppy_Init(EnExRuppy* this, GlobalContext* globalCtx); 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 328e1965af..2941915953 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -1,6 +1,6 @@ #include "z_en_fd.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000215 void EnFd_Init(EnFd* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 7db6b42193..5c022a685c 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -1,6 +1,6 @@ #include "z_en_fd_fire.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnFdFire_Init(EnFdFire* this, GlobalContext* globalCtx); 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 dfc7aacdb9..550c91a21c 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 @@ -1,6 +1,6 @@ #include "z_en_fhg_fire.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnFhgFire_Init(EnFhgFire* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index e0756f70b9..8e7b5e145d 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -1,6 +1,6 @@ #include "z_en_fire_rock.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnFireRock_Init(EnFireRock* this, GlobalContext* globalCtx); 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 3b3f25c8e1..f5b4f92d5a 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -1,6 +1,6 @@ #include "z_en_firefly.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00005005 void EnFirefly_Init(EnFirefly* this, GlobalContext* globalCtx); 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 50a95ed186..481805a07f 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -1,6 +1,6 @@ #include "z_en_fish.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnFish_Init(EnFish* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 347ee0b999..ab119b44ab 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -1,6 +1,6 @@ #include "z_en_floormas.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000405 void EnFloormas_Init(EnFloormas* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 39e707d548..17049a7d48 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -1,6 +1,6 @@ #include "z_en_fr.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000019 void EnFr_Init(EnFr* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 458f42e9ff..32bc8091c3 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -1,6 +1,6 @@ #include "z_en_fu.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000019 void EnFu_Init(EnFu* this, GlobalContext* globalCtx); @@ -52,4 +52,3 @@ const ActorInit En_Fu_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fu/func_80A1E26C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Fu/EnFu_Draw.s") - diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 66b4b79a2a..2049ba88c9 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -1,6 +1,6 @@ #include "z_en_fw.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000215 void EnFw_Init(EnFw* this, GlobalContext* globalCtx); 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 763f67783f..6f04d0c957 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -1,6 +1,6 @@ #include "z_en_fz.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000415 void EnFz_Init(EnFz* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index e7034f656e..275c5d16c7 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -1,6 +1,6 @@ #include "z_en_g_switch.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnGSwitch_Init(EnGSwitch* this, GlobalContext* globalCtx); 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 1f63663588..043109e436 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 @@ -1,6 +1,6 @@ #include "z_en_ganon_mant.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnGanonMant_Init(EnGanonMant* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c index c24f656ae1..e1705ecd52 100644 --- a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c +++ b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c @@ -2,18 +2,17 @@ * File: z_en_ganon_organ.c * Overlay: ovl_En_Ganon_Organ * Description: The organ that Ganondorf plays in the cutscene before the fight. Includes carpet and scenery as well. -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ char unk_14C[0x4]; } EnGanonOrgan; // size = 0x0150 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnGanonOrgan_Init(EnGanonOrgan* this, GlobalContext* globalCtx); @@ -21,8 +20,7 @@ void EnGanonOrgan_Destroy(EnGanonOrgan* this, GlobalContext* globalCtx); void EnGanonOrgan_Update(EnGanonOrgan* this, GlobalContext* globalCtx); void EnGanonOrgan_Draw(EnGanonOrgan* this, GlobalContext* globalCtx); -const ActorInit En_Ganon_Organ_InitVars = -{ +const ActorInit En_Ganon_Organ_InitVars = { ACTOR_EN_GANON_ORGAN, ACTORTYPE_BOSS, ROOM, @@ -35,46 +33,38 @@ const ActorInit En_Ganon_Organ_InitVars = (ActorFunc)EnGanonOrgan_Draw, }; -//temp local struct to represent ganondorf, remove when we can reference other overlays -typedef struct -{ +// temp local struct to represent ganondorf, remove when we can reference other overlays +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ char unk_14C[0x5CC]; /* 0x0718 */ s16 organFadeTimer; /* 0x071A */ char unk_71A[0x2]; } BossGanon; // size = 0x071C -extern D_80A2CCA8; //remove when data is decompiled -extern D_80A2EAB0; //remove when data is decompiled +extern D_80A2CCA8; // remove when data is decompiled +extern D_80A2EAB0; // remove when data is decompiled -void EnGanonOrgan_Init(EnGanonOrgan* this, GlobalContext* globalCtx) -{ +void EnGanonOrgan_Init(EnGanonOrgan* this, GlobalContext* globalCtx) { this->actor.flags &= ~1; } -void EnGanonOrgan_Destroy(EnGanonOrgan* this, GlobalContext* globalCtx) -{ - +void EnGanonOrgan_Destroy(EnGanonOrgan* this, GlobalContext* globalCtx) { } -void EnGanonOrgan_Update(EnGanonOrgan* this, GlobalContext* globalCtx) -{ +void EnGanonOrgan_Update(EnGanonOrgan* this, GlobalContext* globalCtx) { BossGanon* dorf; osSyncPrintf("ORGAN MOVE 1\n"); - if (this->actor.params == 1) - { + if (this->actor.params == 1) { dorf = (BossGanon*)this->actor.attachedA; - if (dorf->organFadeTimer == 0) - { + if (dorf->organFadeTimer == 0) { Actor_Kill(&this->actor); } } osSyncPrintf("ORGAN MOVE 2\n"); } -Gfx* EnGanonOrgan_EmptyDList(GraphicsContext* gfxCtx) -{ +Gfx* EnGanonOrgan_EmptyDList(GraphicsContext* gfxCtx) { Gfx* displayList; displayList = Graph_Alloc(gfxCtx, sizeof(Gfx)); @@ -82,24 +72,25 @@ Gfx* EnGanonOrgan_EmptyDList(GraphicsContext* gfxCtx) return displayList; } -Gfx* func_80A280BC(GraphicsContext* gfxCtx, BossGanon* dorf) -{ +Gfx* func_80A280BC(GraphicsContext* gfxCtx, BossGanon* dorf) { Gfx* displayList; Gfx* displayListHead; displayList = Graph_Alloc(gfxCtx, 4 * sizeof(Gfx)); displayListHead = displayList; gDPPipeSync(displayListHead++); - do { if (1) { } } while(0); + do { + if (1) {} + } while (0); gDPSetEnvColor(displayListHead++, 0x19, 0x14, 0x00, dorf->organFadeTimer); - gDPSetRenderMode(displayListHead++, AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | - CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); + gDPSetRenderMode(displayListHead++, + AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | G_RM_FOG_SHADE_A, + G_RM_AA_ZB_XLU_SURF2); gSPEndDisplayList(displayListHead); return displayList; } -Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) -{ +Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) { Gfx* displayList; Gfx* displayListHead; @@ -107,16 +98,18 @@ Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) displayListHead = displayList; gDPPipeSync(displayListHead++); - do { if (1) { } } while(0); + do { + if (1) {} + } while (0); gDPSetEnvColor(displayListHead++, 0x00, 0x00, 0x00, dorf->organFadeTimer); - gDPSetRenderMode(displayListHead++, AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | - CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2); + gDPSetRenderMode(displayListHead++, + AA_EN | Z_CMP | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | G_RM_FOG_SHADE_A, + G_RM_AA_ZB_XLU_SURF2); gSPEndDisplayList(displayListHead); return displayList; } -void EnGanonOrgan_Draw(EnGanonOrgan* this, GlobalContext* globalCtx) -{ +void EnGanonOrgan_Draw(EnGanonOrgan* this, GlobalContext* globalCtx) { BossGanon* dorf; u32 pad; GraphicsContext* gfxCtx; @@ -127,19 +120,16 @@ void EnGanonOrgan_Draw(EnGanonOrgan* this, GlobalContext* globalCtx) func_800C6AC4(&gfxArr, globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 205); osSyncPrintf("ORGAN DRAW 1\n"); func_80093D18(globalCtx->state.gfxCtx); - if ((this->actor.params == 1) && (dorf->organFadeTimer != 0xff)) - { + if ((this->actor.params == 1) && (dorf->organFadeTimer != 0xff)) { gSPSegment(gfxCtx->polyOpa.p++, 0x08, func_80A280BC(globalCtx->state.gfxCtx, dorf)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, func_80A28148(globalCtx->state.gfxCtx, dorf)); - } - else - { + } else { gSPSegment(gfxCtx->polyOpa.p++, 0x08, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); gSPSegment(gfxCtx->polyOpa.p++, 0x09, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); } Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 221), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfxCtx->polyOpa.p++, &D_80A2CCA8); gSPDisplayList(gfxCtx->polyOpa.p++, &D_80A2EAB0); 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 72cda6cf94..49acb4af07 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -1,6 +1,6 @@ #include "z_en_gb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnGb_Init(EnGb* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 15c97f5e49..be15155017 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -1,6 +1,6 @@ #include "z_en_ge1.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnGe1_Init(EnGe1* this, GlobalContext* globalCtx); 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 86950c46b2..ff14a9143e 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -1,6 +1,6 @@ #include "z_en_ge2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnGe2_Init(EnGe2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 740a9f535c..40b8f59baf 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -1,6 +1,6 @@ #include "z_en_ge3.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnGe3_Init(EnGe3* this, GlobalContext* globalCtx); 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 97de2d617d..b2defe4f67 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -1,6 +1,6 @@ #include "z_en_geldb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnGeldB_Init(EnGeldB* this, GlobalContext* globalCtx); 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 cde8f017b0..9f7cdc9c3f 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -1,6 +1,6 @@ #include "z_en_girla.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnGirlA_Init(EnGirlA* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 424c8c81ec..dd3350d398 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -1,6 +1,6 @@ #include "z_en_gm.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnGm_Init(EnGm* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 4ef81ccb8d..5f95e74065 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1,6 +1,6 @@ #include "z_en_go.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000039 void EnGo_Init(EnGo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index e7273e162f..1e7806536b 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1,6 +1,6 @@ #include "z_en_go2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000039 void EnGo2_Init(EnGo2* this, GlobalContext* globalCtx); 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 a7195a2257..9da1accf45 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -1,6 +1,6 @@ #include "z_en_goma.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void EnGoma_Init(EnGoma* this, GlobalContext* globalCtx); 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 5134ac716f..acf9dfaa94 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -1,6 +1,6 @@ #include "z_en_goroiwa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnGoroiwa_Init(EnGoroiwa* this, GlobalContext* globalCtx); 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 44f0b60af8..fd8eb03de3 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -1,6 +1,6 @@ #include "z_en_gs.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000009 void EnGs_Init(EnGs* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 59588610bf..8319cc856d 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -1,6 +1,6 @@ #include "z_en_guest.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnGuest_Init(EnGuest* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.c b/src/overlays/actors/ovl_En_Hata/z_en_hata.c index 8191104e12..28db90caf4 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -1,6 +1,6 @@ #include "z_en_hata.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnHata_Init(EnHata* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 5799f22868..c91f89d340 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -1,6 +1,6 @@ #include "z_en_heishi1.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnHeishi1_Init(EnHeishi1* this, GlobalContext* globalCtx); 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 a5c256692a..27320ec955 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -1,6 +1,6 @@ #include "z_en_heishi2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnHeishi2_Init(EnHeishi2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index f095edde2c..d421db8d46 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -1,6 +1,6 @@ #include "z_en_heishi3.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnHeishi3_Init(EnHeishi3* this, GlobalContext* globalCtx); 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 3a9825bc8a..732c90cee3 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -1,6 +1,6 @@ #include "z_en_heishi4.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnHeishi4_Init(EnHeishi4* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 2531f4c74a..c168d295e0 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -1,6 +1,6 @@ #include "z_en_hintnuts.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnHintnuts_Init(EnHintnuts* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 867f4f8ec4..f1082366cb 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -1,6 +1,6 @@ #include "z_en_holl.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnHoll_Init(EnHoll* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index 0e3230dc45..718c55f4a0 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -1,6 +1,6 @@ #include "z_en_honotrap.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnHonotrap_Init(EnHonotrap* this, GlobalContext* globalCtx); 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 9ff037fe2f..de015bcf25 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -1,6 +1,6 @@ #include "z_en_horse.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnHorse_Init(EnHorse* this, GlobalContext* globalCtx); 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 5516523617..6426ac04ae 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 @@ -1,6 +1,6 @@ #include "z_en_horse_game_check.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnHorseGameCheck_Init(EnHorseGameCheck* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index a6ebaa483d..e4b7f9425e 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -1,6 +1,6 @@ #include "z_en_horse_ganon.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnHorseGanon_Init(EnHorseGanon* this, GlobalContext* globalCtx); 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 1daafb990a..21ee375020 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 @@ -1,6 +1,6 @@ #include "z_en_horse_link_child.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void EnHorseLinkChild_Init(EnHorseLinkChild* this, GlobalContext* globalCtx); 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 cc9a5a4a2d..f329bb0f5c 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 @@ -1,6 +1,6 @@ #include "z_en_horse_normal.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnHorseNormal_Init(EnHorseNormal* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index 03ac2db446..8c077de883 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -1,6 +1,6 @@ #include "z_en_horse_zelda.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnHorseZelda_Init(EnHorseZelda* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index bfecaf8fd5..87f337d384 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -1,6 +1,6 @@ #include "z_en_hs.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnHs_Init(EnHs* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c index 374c3fb178..199528d6a3 100644 --- a/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c +++ b/src/overlays/actors/ovl_En_Hs2/z_en_hs2.c @@ -1,6 +1,6 @@ #include "z_en_hs2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnHs2_Init(EnHs2* this, GlobalContext* globalCtx); 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 5ee36de620..4ea8001385 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -1,6 +1,6 @@ #include "z_en_hy.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnHy_Init(EnHy* this, GlobalContext* globalCtx); 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 496feb0150..adc0fc065e 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 @@ -1,6 +1,6 @@ #include "z_en_ice_hono.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnIceHono_Init(EnIceHono* this, GlobalContext* globalCtx); 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 a06da30ed8..b1096c3b6b 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -1,6 +1,6 @@ #include "z_en_ik.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnIk_Init(EnIk* this, GlobalContext* globalCtx); @@ -164,4 +164,3 @@ const ActorInit En_Ik_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/func_80A781CC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Ik/EnIk_Init.s") - diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index bacfc6ea32..f4b2c102bb 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -1,6 +1,6 @@ #include "z_en_in.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnIn_Init(EnIn* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index e351674a17..4b2d4252f6 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -1,6 +1,6 @@ #include "z_en_insect.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnInsect_Init(EnInsect* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 0d5ce67505..a322390463 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -1,6 +1,6 @@ #include "z_en_ishi.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00800000 void EnIshi_Init(EnIshi* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_It/z_en_it.c b/src/overlays/actors/ovl_En_It/z_en_it.c index 60b2614512..e96f5b1f50 100644 --- a/src/overlays/actors/ovl_En_It/z_en_it.c +++ b/src/overlays/actors/ovl_En_It/z_en_it.c @@ -2,16 +2,15 @@ * File: z_en_it.c * Overlay: ovl_En_It * Description: Dampe's Minigame digging spot hitboxes -*/ + */ #include #include #include -typedef struct -{ - /* 0x0000 */ Actor actor; - /* 0x014C */ u32 unk_14C; +typedef struct { + /* 0x0000 */ Actor actor; + /* 0x014C */ u32 unk_14C; /* 0x0150 */ ColliderCylinderMain cylinderCollider; } ActorIt; // size = 0x019C @@ -22,53 +21,23 @@ static void Init(ActorIt* this, GlobalContext* globalCtx); static void Destroy(ActorIt* this, GlobalContext* globalCtx); static void Update(ActorIt* this, GlobalContext* globalCtx); -static ColliderCylinderInit cylinderInitData = -{ - 0x0A, 0x00, 0x00, 0x05, - 0x10, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00000000, - 0x00, 0x00, 0x00, 0x00, - 0x00000000, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, - 0x0028, - 0x000A, - 0x00000000000000000000, +static ColliderCylinderInit cylinderInitData = { + 0x0A, 0x00, 0x00, 0x05, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00, 0x00, + 0x00, 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x0001, 0x0000, 0x0028, 0x000A, 0x0000, }; -static u8 damageTblInitData[] = -{ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0xFF, - 0x00, - 0x00, - 0x00 +static u8 damageTblInitData[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, }; -const ActorInit En_It_InitVars = -{ - ACTOR_EN_IT, - ACTORTYPE_PROP, - ROOM, - FLAGS, - OBJECT_GAMEPLAY_KEEP, - sizeof(ActorIt), - (ActorFunc)Init, - (ActorFunc)Destroy, - (ActorFunc)Update, +const ActorInit En_It_InitVars = { + ACTOR_EN_IT, ACTORTYPE_PROP, ROOM, + FLAGS, OBJECT_GAMEPLAY_KEEP, sizeof(ActorIt), + (ActorFunc)Init, (ActorFunc)Destroy, (ActorFunc)Update, (ActorFunc)NULL, }; -static void Init(ActorIt* this, GlobalContext* globalCtx) -{ +static void Init(ActorIt* this, GlobalContext* globalCtx) { ActorIt* it = this; it->actor.params = 0x0D05; @@ -77,15 +46,13 @@ static void Init(ActorIt* this, GlobalContext* globalCtx) func_80061EFC(&it->actor.sub_98.damageChart, 0, &damageTblInitData); // Init Damage Chart } -static void Destroy(ActorIt* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorIt* this, GlobalContext* globalCtx) { ActorIt* it = this; ActorCollider_FreeCylinder(globalCtx, &it->cylinderCollider); } -static void Update(ActorIt* this, GlobalContext* globalCtx) -{ +static void Update(ActorIt* this, GlobalContext* globalCtx) { s32 pad; ActorIt* it = this; diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj.c b/src/overlays/actors/ovl_En_Jj/z_en_jj.c index c683a7138d..24ee963f22 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -1,6 +1,6 @@ #include "z_en_jj.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnJj_Init(EnJj* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 024b18260d..469d56004e 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -1,6 +1,6 @@ #include "z_en_js.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnJs_Init(EnJs* this, GlobalContext* globalCtx); @@ -54,6 +54,3 @@ const ActorInit En_Js_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Js/func_80A895F4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Js/EnJs_Draw.s") - - - 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 f84d6e45a9..6c2e9abf2c 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -1,6 +1,6 @@ #include "z_en_jsjutan.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnJsjutan_Init(EnJsjutan* this, GlobalContext* globalCtx); @@ -34,4 +34,3 @@ const ActorInit En_Jsjutan_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jsjutan/EnJsjutan_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Jsjutan/EnJsjutan_Draw.s") - diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index e9f9f540ca..99d3201ba7 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -1,6 +1,6 @@ #include "z_en_kakasi.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000009 void EnKakasi_Init(EnKakasi* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 4305db7488..9096748d7c 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -1,6 +1,6 @@ #include "z_en_kakasi2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x0A000031 void EnKakasi2_Init(EnKakasi2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 436e79806c..6c73d2aa8d 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -1,6 +1,6 @@ #include "z_en_kakasi3.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000009 void EnKakasi3_Init(EnKakasi3* this, GlobalContext* globalCtx); 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 315958ee33..1a7e805b5c 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -1,6 +1,6 @@ #include "z_en_kanban.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnKanban_Init(EnKanban* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index 46057f2f48..5b6e5ebb27 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -1,6 +1,6 @@ #include "z_en_karebaba.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnKarebaba_Init(EnKarebaba* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index db1f932ba6..9c4c324212 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -1,6 +1,6 @@ #include "z_en_ko.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnKo_Init(EnKo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index c39532a647..0c142c954b 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -1,6 +1,6 @@ #include "z_en_kusa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00800010 void EnKusa_Init(EnKusa* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 5e518d987f..1050aa7c32 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -1,6 +1,6 @@ #include "z_en_kz.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnKz_Init(EnKz* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 42558635ff..ac102d44a3 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -1,6 +1,6 @@ #include "z_en_light.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnLight_Init(EnLight* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c index 9b472b44d7..237a145155 100644 --- a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c +++ b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c @@ -2,11 +2,11 @@ * File: z_en_lightbox.c * Overlay: ovl_En_Lightbox * Description: -*/ + */ #include "z_en_lightbox.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx); @@ -14,8 +14,7 @@ static void EnLightbox_Destroy(EnLightbox* this, GlobalContext* globalCtx); static void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx); static void EnLightbox_Draw(EnLightbox* this, GlobalContext* globalCtx); -const ActorInit En_Lightbox_InitVars = -{ +const ActorInit En_Lightbox_InitVars = { ACTOR_EN_LIGHTBOX, ACTORTYPE_PROP, ROOM, @@ -31,13 +30,12 @@ const ActorInit En_Lightbox_InitVars = extern u32 D_06000B70; extern u32 D_06001F10; -static void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx) -{ +static void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx) { u32 local_c = 0; Actor* thisx = &this->dyna.actor; s32 pad[4]; - switch(thisx->params){ + switch (thisx->params) { case 0: Actor_SetScale(thisx, 0.025f); break; @@ -65,56 +63,41 @@ static void EnLightbox_Init(EnLightbox* this, GlobalContext* globalCtx) this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); } -static void EnLightbox_Destroy(EnLightbox* this, GlobalContext* globalCtx) -{ +static void EnLightbox_Destroy(EnLightbox* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx) -{ +static void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (this->dyna.unk_162 != 0) - { - if (func_8002F5A0(thisx, globalCtx)) - { + if (this->dyna.unk_162 != 0) { + if (func_8002F5A0(thisx, globalCtx)) { this->dyna.unk_162 = 0; } - } - else - { - if (func_8002F410(thisx, globalCtx)) - { + } else { + if (func_8002F410(thisx, globalCtx)) { this->dyna.unk_162++; - } - else - { - if (thisx->speedXZ) - { - if (thisx->bgCheckFlags & 8) - { + } else { + if (thisx->speedXZ) { + if (thisx->bgCheckFlags & 8) { thisx->posRot.rot.y = (thisx->posRot.rot.y + thisx->unk_7E) - thisx->posRot.rot.y; - Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); thisx->speedXZ *= 0.7f; thisx->bgCheckFlags &= ~0x8; } } - if ((thisx->bgCheckFlags & 1) == 0) - { + if ((thisx->bgCheckFlags & 1) == 0) { Math_ApproxF(&thisx->speedXZ, 0, IREG(57) / 100.0f); - } - else - { + } else { Math_ApproxF(&thisx->speedXZ, 0, IREG(58) / 100.0f); - if ((thisx->bgCheckFlags & 2) && (thisx->velocity.y < IREG(59) / 100.0f)) - { - Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + if ((thisx->bgCheckFlags & 2) && (thisx->velocity.y < IREG(59) / 100.0f)) { + Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->unk_E4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); thisx->velocity.y *= IREG(60) / 100.0f; thisx->bgCheckFlags &= ~0x1; - } - else - { + } else { func_8002F580(thisx, globalCtx); } } @@ -125,7 +108,6 @@ static void EnLightbox_Update(EnLightbox* this, GlobalContext* globalCtx) thisx->posRot2.pos = thisx->posRot.pos; } -static void EnLightbox_Draw(EnLightbox* this, GlobalContext* globalCtx) -{ +static void EnLightbox_Draw(EnLightbox* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_06000B70); } diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c index 55ecd36d85..5d4affcf75 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c @@ -2,86 +2,61 @@ * File: z_en_m_fire1.c * Overlay: ovl_En_M_Fire1 * Description: The attack from a Deku Nut. Spawned by ovl_En_Arrow. -*/ + */ #include #include #include -typedef struct -{ - /* 0x0000 */ Actor actor; +typedef struct { + /* 0x0000 */ Actor actor; /* 0x014C */ ColliderCylinderMain capsule; - /* 0x0198 */ f32 unk_0198; + /* 0x0198 */ f32 unk_0198; } ActorMFire; // size = 0x019C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void Init(ActorMFire* this, GlobalContext* globalCtx); static void Destroy(ActorMFire* this, GlobalContext* globalCtx); static void Update(ActorMFire* this, GlobalContext* globalCtx); -const ActorInit En_M_Fire1_InitVars = -{ - ACTOR_EN_M_FIRE1, - ACTORTYPE_MISC, - ROOM, - FLAGS, - OBJECT_GAMEPLAY_KEEP, - sizeof(ActorMFire), - (ActorFunc)Init, - (ActorFunc)Destroy, - (ActorFunc)Update, - NULL +const ActorInit En_M_Fire1_InitVars = { + ACTOR_EN_M_FIRE1, ACTORTYPE_MISC, ROOM, FLAGS, OBJECT_GAMEPLAY_KEEP, sizeof(ActorMFire), (ActorFunc)Init, + (ActorFunc)Destroy, (ActorFunc)Update, NULL, }; -static ColliderCylinderInit cylinderInitData = -{ - 0x0A, 0x09, 0x00, 0x00, - 0x08, 0x01, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, - 0x00000001, - 0x00, 0x00, 0x00, 0x00, - 0xFFCFFFFF, - 0x00, 0x00, 0x00, 0x00, - 0x19, 0x00, 0x00, 0x00, - 0x00C8, - 0x00C8, - 0x00000000000000000000, +static ColliderCylinderInit cylinderInitData = { + 0x0A, 0x09, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00000001, 0x00, 0x00, + 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, 0x19, 0x0000, 0x0000, 0x0000, 0x00C8, 0x00C8, 0x0000, }; -static void Init(ActorMFire* this, GlobalContext* globalCtx) -{ +static void Init(ActorMFire* this, GlobalContext* globalCtx) { s32 pad; ActorMFire* thisLocal; thisLocal = this; - if (this->actor.params < 0) + if (this->actor.params < 0) { Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &thisLocal->actor, ACTORTYPE_ITEMACTION); + } ActorCollider_AllocCylinder(globalCtx, &thisLocal->capsule); ActorCollider_InitCylinder(globalCtx, &thisLocal->capsule, &thisLocal->actor, &cylinderInitData); } -static void Destroy(ActorMFire* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorMFire* this, GlobalContext* globalCtx) { ColliderCylinderMain* capsule = &this->capsule; ActorCollider_FreeCylinder(globalCtx, capsule); } -static void Update(ActorMFire* this, GlobalContext* globalCtx) -{ +static void Update(ActorMFire* this, GlobalContext* globalCtx) { s32 pad; ActorMFire* thisLocal = this; - if (Math_ApproxF(&thisLocal->unk_0198, 1.0, 0.2)) - { + if (Math_ApproxF(&thisLocal->unk_0198, 1.0, 0.2)) { Actor_Kill(&this->actor); - } - else - { + } else { ActorCollider_Cylinder_Update(&thisLocal->actor, &thisLocal->capsule); Actor_CollisionCheck_SetAT(globalCtx, &globalCtx->sub_11E60, &thisLocal->capsule); } 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 c1f2603d52..6041bb2ba3 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 @@ -1,6 +1,6 @@ #include "z_en_m_thunder.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnMThunder_Init(EnMThunder* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index a29f5688ed..783150f3b7 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -1,6 +1,6 @@ #include "z_en_ma1.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000039 void EnMa1_Init(EnMa1* this, GlobalContext* globalCtx); 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 dd27fe06f1..bb821761a2 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -1,6 +1,6 @@ #include "z_en_ma2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000039 void EnMa2_Init(EnMa2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 927a914fd0..362e11453a 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -1,6 +1,6 @@ #include "z_en_ma3.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000039 void EnMa3_Init(EnMa3* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 483dcef84f..8398388e08 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -1,6 +1,6 @@ #include "z_en_mag.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnMag_Init(EnMag* this, GlobalContext* globalCtx); 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 634f63f97e..b368d395a6 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -1,6 +1,6 @@ #include "z_en_mb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnMb_Init(EnMb* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index b72b739fad..8ed5e98048 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -1,6 +1,6 @@ #include "z_en_md.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000019 void EnMd_Init(EnMd* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index da0c4c0b79..94225f36bb 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -1,6 +1,6 @@ #include "z_en_mk.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnMk_Init(EnMk* this, GlobalContext* globalCtx); 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 11dd6370a6..1491d4d2f5 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -1,6 +1,6 @@ #include "z_en_mm.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnMm_Init(EnMm* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index 50ad29a779..9404ef93c6 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -1,6 +1,6 @@ #include "z_en_mm2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnMm2_Init(EnMm2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ms/dlists.c b/src/overlays/actors/ovl_En_Ms/dlists.c index 356c05d216..d3229c2483 100644 --- a/src/overlays/actors/ovl_En_Ms/dlists.c +++ b/src/overlays/actors/ovl_En_Ms/dlists.c @@ -1,3 +1 @@ #include "dlists.h" - - diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 950bfea3d9..b8c98d0557 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -2,13 +2,12 @@ * File: z_en_ms.c * Overlay: ovl_En_Ms * Description: Magic Bean Salesman -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ UNK_PTR unkSkelAnimeStruct; @@ -20,7 +19,7 @@ typedef struct /* 0x024C */ s16 activeTimer; } EnMs; // size = 0x0250 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx); @@ -33,8 +32,7 @@ static void EnMs_TalkAfterBuy(EnMs* this, GlobalContext* globalCtx); static void EnMs_Update(EnMs* this, GlobalContext* globalCtx); static void EnMs_Draw(EnMs* this, GlobalContext* globalCtx); -const ActorInit En_Ms_InitVars = -{ +const ActorInit En_Ms_InitVars = { ACTOR_EN_MS, ACTORTYPE_NPC, ROOM, @@ -47,43 +45,31 @@ const ActorInit En_Ms_InitVars = (ActorFunc)EnMs_Draw, }; -static s32 unk_col_80AB0320[] = -{ -0x0A000939, 0x01000000, -0x00000000, 0x00000000, -0x00000000, 0xFFCFFFFF, -0x00000000, 0x00010100, -0x00160025, 0x00000000, -0x00000000 +static s32 unk_col_80AB0320[] = { + 0x0A000939, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0xFFCFFFFF, + 0x00000000, 0x00010100, 0x00160025, 0x00000000, 0x00000000, }; -static s16 prices[] = -{ - 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 +static s16 prices[] = { + 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, }; -static u16 offerTextIds[] = -{ - 0x405E, 0x405F, 0x4060, 0x4061, 0x4062, - 0x4063, 0x4064, 0x4065, 0x4066, 0x4067 +static u16 offerTextIds[] = { + 0x405E, 0x405F, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, 0x4067, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_U8(unk_1F, 2, ICHAIN_CONTINUE), - ICHAIN_F32(unk_4C, 500, ICHAIN_STOP) + ICHAIN_F32(unk_4C, 500, ICHAIN_STOP), }; extern D_060005EC; extern D_06003DC0; -static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) -{ +static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) { this->actor.textId = func_8006C360(globalCtx, 0x1B); - if (this->actor.textId == 0) - { - if (BEANS_BOUGHT >= 10) - { + if (this->actor.textId == 0) { + if (BEANS_BOUGHT >= 10) { this->actor.textId = 0x406B; return; } @@ -91,19 +77,17 @@ static void EnMs_SetOfferText(EnMs* this, GlobalContext* globalCtx) } } -static void EnMs_Init(EnMs* this, GlobalContext* globalCtx) -{ +static void EnMs_Init(EnMs* this, GlobalContext* globalCtx) { s32 pad1; s32 pad2; - if (LINK_AGE_IN_YEARS != YEARS_CHILD) - { + if (LINK_AGE_IN_YEARS != YEARS_CHILD) { Actor_Kill(&this->actor); return; } Actor_ProcessInitChain(&this->actor, initChain); - func_800A46F8(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, - &this->unkSkelAnimeStruct, &this->unk_1C6, 9); //skelanime_mtx_init + func_800A46F8(globalCtx, &this->skelAnime, &D_06003DC0, &D_060005EC, &this->unkSkelAnimeStruct, &this->unk_1C6, + 9); // skelanime_mtx_init ActorCollider_AllocCylinder(globalCtx, &this->collider); func_8005C450(globalCtx, &this->collider, this, &unk_col_80AB0320); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 35.0f); @@ -119,70 +103,57 @@ static void EnMs_Init(EnMs* this, GlobalContext* globalCtx) this->actionFunc = EnMs_Wait; } -static void EnMs_Destroy(EnMs* this, GlobalContext* globalCtx) -{ +static void EnMs_Destroy(EnMs* this, GlobalContext* globalCtx) { ColliderCylinderMain* collider = &this->collider; ActorCollider_FreeCylinder(globalCtx, collider); } -static void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) -{ +static void EnMs_Wait(EnMs* this, GlobalContext* globalCtx) { s16 unkAngle; unkAngle = this->actor.rotTowardsLinkY - this->actor.shape.rot.y; EnMs_SetOfferText(&this->actor, globalCtx); - if (func_8002F194(&this->actor, globalCtx) != 0) //if talk is initiated - { + if (func_8002F194(&this->actor, globalCtx) != 0) { // if talk is initiated this->actionFunc = &EnMs_Talk; return; } - if ((this->actor.xzDistanceFromLink < 90.0f) && (ABS(unkAngle) < 0x2000)) //talk range - { + if ((this->actor.xzDistanceFromLink < 90.0f) && (ABS(unkAngle) < 0x2000)) { // talk range func_8002F2CC(&this->actor, globalCtx, 90.0f); } } -static void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) -{ +static void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) { u8 dialogState; dialogState = func_8010BDBC(&globalCtx->msgCtx); - if (dialogState != 4) - { - if ((dialogState == 6) && (func_80106BC8(globalCtx) != 0)) //advanced final textbox - { + if (dialogState != 4) { + if ((dialogState == 6) && (func_80106BC8(globalCtx) != 0)) { // advanced final textbox this->actionFunc = &EnMs_Wait; } - } - else - { - if(func_80106BC8(globalCtx) != 0) - { - switch (globalCtx->msgCtx.choiceIndex) - { - case 0: //yes - if (gSaveContext.rupees < prices[BEANS_BOUGHT]) - { - func_8010B720(globalCtx, 0x4069); //not enough rupees text + } else { + if (func_80106BC8(globalCtx) != 0) { + switch (globalCtx->msgCtx.choiceIndex) { + case 0: // yes + if (gSaveContext.rupees < prices[BEANS_BOUGHT]) { + func_8010B720(globalCtx, 0x4069); // not enough rupees text return; } func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); this->actionFunc = &EnMs_Sell; return; - case 1: //no + case 1: // no func_8010B720(globalCtx, 0x4068); - default: return; + default: + return; } } } } -static void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) -{ - if (func_8002F410(&this->actor, globalCtx) != 0) //if attached is set - { - Rupees_ChangeBy(-prices[BEANS_BOUGHT]); //decrease ruppees +static void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) { + if (func_8002F410(&this->actor, globalCtx) != 0) { // if attached is set + Rupees_ChangeBy(-prices[BEANS_BOUGHT]); // decrease ruppees this->actor.attachedA = NULL; this->actionFunc = &EnMs_TalkAfterBuy; return; @@ -190,18 +161,15 @@ static void EnMs_Sell(EnMs* this, GlobalContext* globalCtx) func_8002F434(&this->actor, globalCtx, GI_BEAN, 90.0f, 10.0f); } -static void EnMs_TalkAfterBuy(EnMs* this, GlobalContext* globalCtx) -{ - //if dialog state is 6 and player responded to textbox - if ((func_8010BDBC(&globalCtx->msgCtx)) == 6 && (func_80106BC8(globalCtx) != 0)) - { +static void EnMs_TalkAfterBuy(EnMs* this, GlobalContext* globalCtx) { + // if dialog state is 6 and player responded to textbox + if ((func_8010BDBC(&globalCtx->msgCtx)) == 6 && (func_80106BC8(globalCtx) != 0)) { func_8010B720(globalCtx, 0x406C); this->actionFunc = &EnMs_Talk; } } -static void EnMs_Update(EnMs* this, GlobalContext* globalCtx) -{ +static void EnMs_Update(EnMs* this, GlobalContext* globalCtx) { s32 pad1; s32 pad2; @@ -212,8 +180,7 @@ static void EnMs_Update(EnMs* this, GlobalContext* globalCtx) SkelAnime_FrameUpdateMatrix(&this->skelAnime); this->actionFunc(this, globalCtx); - if (gSaveContext.entrance_index == 0x157 && gSaveContext.scene_setup_index == 8) //ride carpet if in credits - { + if (gSaveContext.entrance_index == 0x157 && gSaveContext.scene_setup_index == 8) { // ride carpet if in credits Actor_MoveForward(&this->actor); osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y); func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); @@ -222,9 +189,8 @@ static void EnMs_Update(EnMs* this, GlobalContext* globalCtx) Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider); } -void EnMs_Draw(EnMs* this, GlobalContext* globalCtx) -{ +void EnMs_Draw(EnMs* this, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); - func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, - this->skelAnime.dListCount, 0, 0, &this->actor); + func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, 0, 0, + &this->actor); } diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 003f40e92b..570f85511d 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -1,6 +1,6 @@ #include "z_en_mu.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnMu_Init(EnMu* this, GlobalContext* globalCtx); 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 9fb939c914..49b85a5c6e 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -1,6 +1,6 @@ #include "z_en_nb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnNb_Init(EnNb* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index bae1f92168..5b3ef46bbf 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -1,6 +1,6 @@ #include "z_en_niw.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00800010 void EnNiw_Init(EnNiw* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index 6c591bf4a8..5ba7d1f2ab 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -1,6 +1,6 @@ #include "z_en_niw_girl.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnNiwGirl_Init(EnNiwGirl* this, GlobalContext* globalCtx); 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 0cf4c9951c..2a240d5f0e 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 @@ -1,6 +1,6 @@ #include "z_en_niw_lady.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnNiwLady_Init(EnNiwLady* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 8145e5e581..373ea40116 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -2,7 +2,7 @@ * File: z_en_nutsball.c * Overlay: ovl_En_Nutsball * Description: The projectile fired by deku scrubs and octoroks. -*/ + */ #include "z_en_nutsball.h" @@ -16,8 +16,7 @@ static void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx); static void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx); static void EnNutsball_Draw(EnNutsball* this, GlobalContext* globalCtx); -const ActorInit En_Nutsball_InitVars = -{ +const ActorInit En_Nutsball_InitVars = { ACTOR_EN_NUTSBALL, ACTORTYPE_PROP, ROOM, @@ -30,27 +29,16 @@ const ActorInit En_Nutsball_InitVars = (ActorFunc)NULL, }; -static ColliderCylinderInit cylinderInitData = -{ - 0xa, 0x11, 0x9, 0x39, - 0x20, 0x1, { 0x0, 0x0 }, - 0x0, { 0x0, 0x0, 0x0 }, - 0xffcfffff, - 0x0, 0x8, { 0x0, 0x0} , - 0xffcfffff, - { 0x0, 0x0, 0x0, 0x0 }, - 0x11, 0x1, 0x1, 0x0, - 0xd, - 0xd, - 0x0, - { 0x0, 0x0, 0x0 } +static ColliderCylinderInit cylinderInitData = { + 0x0A, 0x11, 0x09, 0x39, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xFFCFFFFF, 0x00, 0x08, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x01, 0x01, 0x00, 0x000D, 0x000D, 0x0000, 0x0000, 0x0000, 0x0000, }; static s16 objectTbl[] = { OBJECT_DEKUNUTS, OBJECT_HINTNUTS, OBJECT_SHOPNUTS, OBJECT_DNS, OBJECT_DNK }; static u32 dListTbl[] = { 0x06002028, 0x060012F0, 0x06004008, 0x06002410, 0x06001890 }; -static void EnNutsball_Init(EnNutsball* this, GlobalContext* globalCtx) -{ +static void EnNutsball_Init(EnNutsball* this, GlobalContext* globalCtx) { s32 pad[2]; ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawFunc_Circle, 13.0f); @@ -58,22 +46,20 @@ static void EnNutsball_Init(EnNutsball* this, GlobalContext* globalCtx) ActorCollider_InitCylinder(globalCtx, &this->collider, &this->actor, &cylinderInitData); this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, objectTbl[this->actor.params]); - if (this->objBankIndex < 0) + if (this->objBankIndex < 0) { Actor_Kill(&this->actor); - else + } else { this->actionFunc = (ActorFunc)func_80ABBB34; + } } -static void EnNutsball_Destroy(EnNutsball* this, GlobalContext* globalCtx) -{ +static void EnNutsball_Destroy(EnNutsball* this, GlobalContext* globalCtx) { ColliderCylinderMain* collider = &this->collider; ActorCollider_FreeCylinder(globalCtx, collider); } -static void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) -{ - if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) - { +static void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) { + if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { this->actor.objBankIndex = this->objBankIndex; this->actor.draw = (ActorFunc)EnNutsball_Draw; this->actor.shape.rot.y = 0; @@ -83,31 +69,26 @@ static void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) } } -static void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) -{ +static void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { Player* player = PLAYER; Vec3s sp4C; Vec3f sp40; this->timer--; - if (this->timer == 0) + if (this->timer == 0) { this->actor.gravity = -1; + } this->actor.initPosRot.rot.z += 0x2AA8; - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || - (this->collider.base.colliderFlags & 2) || (this->collider.base.collideFlags & 2) || - (this->collider.base.maskA & 2)) - { + if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->collider.base.colliderFlags & 2) || + (this->collider.base.collideFlags & 2) || (this->collider.base.maskA & 2)) { // Checking if the player is using a shield that reflects projectiles // And if so, reflects the projectile on impact - if ((player->currentShield == 1) || ((player->currentShield == 2) && LINK_IS_ADULT)) - { - if ((this->collider.base.colliderFlags & 2) && - (this->collider.base.colliderFlags & 0x10) && - (this->collider.base.colliderFlags & 4)) - { + if ((player->currentShield == 1) || ((player->currentShield == 2) && LINK_IS_ADULT)) { + if ((this->collider.base.colliderFlags & 2) && (this->collider.base.colliderFlags & 0x10) && + (this->collider.base.colliderFlags & 4)) { this->collider.base.colliderFlags &= ~0x16; this->collider.base.colliderFlags |= 0x08; @@ -126,22 +107,19 @@ static void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) func_800297A4(globalCtx, &sp40, 0x40C00000, 0, 7, 3, 15, -1, 10, 0); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 20, NA_SE_EN_OCTAROCK_ROCK); Actor_Kill(&this->actor); - } - else - { - if (this->timer == -300) + } else { + if (this->timer == -300) { Actor_Kill(&this->actor); + } } } -static void EnNutsball_Update(EnNutsball* this, GlobalContext* globalCtx) -{ +static void EnNutsball_Update(EnNutsball* this, GlobalContext* globalCtx) { EnNutsball* nutsball = this; Player* player = PLAYER; s32 pad; - if (!(player->stateFlags1 & 0x300000C0) || (nutsball->actionFunc == (ActorFunc)func_80ABBB34)) - { + if (!(player->stateFlags1 & 0x300000C0) || (nutsball->actionFunc == (ActorFunc)func_80ABBB34)) { nutsball->actionFunc(nutsball, globalCtx); Actor_MoveForward(&nutsball->actor); @@ -156,8 +134,7 @@ static void EnNutsball_Update(EnNutsball* this, GlobalContext* globalCtx) } } -static void EnNutsball_Draw(EnNutsball* this, GlobalContext* globalCtx) -{ +static void EnNutsball_Draw(EnNutsball* this, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Gfx* gfxArr[5]; @@ -166,7 +143,8 @@ static void EnNutsball_Draw(EnNutsball* this, GlobalContext* globalCtx) func_80093D18(globalCtx->state.gfxCtx); Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY); Matrix_RotateZ(this->actor.initPosRot.rot.z * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 333), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 333), + G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(gfxCtx->polyOpa.p++, dListTbl[this->actor.params]); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_nutsball.c", 337); diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index e6867b4f30..e2a0b80da0 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -1,6 +1,6 @@ #include "z_en_nwc.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnNwc_Init(EnNwc* this, GlobalContext* globalCtx); 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 62ff461199..a605022c37 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -1,6 +1,6 @@ #include "z_en_ny.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnNy_Init(EnNy* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_OE2/z_en_oe2.c b/src/overlays/actors/ovl_En_OE2/z_en_oe2.c index 4d35e0a859..9d4b366928 100644 --- a/src/overlays/actors/ovl_En_OE2/z_en_oe2.c +++ b/src/overlays/actors/ovl_En_OE2/z_en_oe2.c @@ -2,20 +2,19 @@ * File: z_en_oe2.c * Overlay: ovl_En_Oe2 * Description: Blue Navi Target. Probably unused since NPC's are blue and they do not use this actor. -*/ + */ #include #include #include -typedef struct -{ - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x44]; - /* 0x0190 */ ActorFunc updateFunc; +typedef struct { + /* 0x0000 */ Actor actor; + /* 0x014C */ char unk_14C[0x44]; + /* 0x0190 */ ActorFunc updateFunc; } ActorEnOE2; // size = 0x0194 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 static void func_80ABE6A0(ActorEnOE2* this, ActorFunc func); @@ -25,46 +24,29 @@ static void func_80ABE6DC(ActorEnOE2* this, GlobalContext* globalCtx); static void Update(ActorEnOE2* this, GlobalContext* globalCtx); static void Draw(ActorEnOE2* this, GlobalContext* globalCtx); -const ActorInit En_OE2_InitVars = -{ - ACTOR_EN_OE2, - ACTORTYPE_NPC, - ROOM, - FLAGS, - OBJECT_OE2, - sizeof(ActorEnOE2), - (ActorFunc)Init, - (ActorFunc)Destroy, - (ActorFunc)Update, - (ActorFunc)Draw +const ActorInit En_OE2_InitVars = { + ACTOR_EN_OE2, ACTORTYPE_NPC, ROOM, + FLAGS, OBJECT_OE2, sizeof(ActorEnOE2), + (ActorFunc)Init, (ActorFunc)Destroy, (ActorFunc)Update, + (ActorFunc)Draw, }; -static void func_80ABE6A0(ActorEnOE2* this, ActorFunc func) -{ +static void func_80ABE6A0(ActorEnOE2* this, ActorFunc func) { this->updateFunc = func; } -static void Init(ActorEnOE2* this, GlobalContext* globalCtx) -{ +static void Init(ActorEnOE2* this, GlobalContext* globalCtx) { func_80ABE6A0(this, (ActorFunc)func_80ABE6DC); } -static void Destroy(ActorEnOE2* this, GlobalContext* globalCtx) -{ - +static void Destroy(ActorEnOE2* this, GlobalContext* globalCtx) { } -static void func_80ABE6DC(ActorEnOE2* this, GlobalContext* globalCtx) -{ - +static void func_80ABE6DC(ActorEnOE2* this, GlobalContext* globalCtx) { } -static void Update(ActorEnOE2* this, GlobalContext* globalCtx) -{ - +static void Update(ActorEnOE2* this, GlobalContext* globalCtx) { } -static void Draw(ActorEnOE2* this, GlobalContext* globalCtx) -{ - +static void Draw(ActorEnOE2* this, GlobalContext* globalCtx) { } diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 4f1a2e58d4..baf298eb1f 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -2,21 +2,20 @@ * File: z_en_okarina_effect.c * Overlay: ovl_En_Okarina_Effect * Description: Manages the storm created when playing Song of Storms -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ u16 timer; /* 0x0150 */ ActorFunc actionFunc; } EnOkarinaEffect; // size = 0x0154 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 static void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, ActorFunc* newActionFunc); @@ -26,8 +25,7 @@ static void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* g static void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx); static void EnOkarinaEffect_Update(EnOkarinaEffect* this, GlobalContext* globalCtx); -const ActorInit En_Okarina_Effect_InitVars = -{ +const ActorInit En_Okarina_Effect_InitVars = { ACTOR_EN_OKARINA_EFFECT, ACTORTYPE_ITEMACTION, ROOM, @@ -40,111 +38,88 @@ const ActorInit En_Okarina_Effect_InitVars = NULL, }; -static void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, ActorFunc* newActionFunc) -{ +static void EnOkarinaEffect_SetupAction(EnOkarinaEffect* this, ActorFunc* newActionFunc) { this->actionFunc = newActionFunc; } -static void EnOkarinaEffect_Destroy(EnOkarinaEffect* this, GlobalContext* globalCtx) -{ +static void EnOkarinaEffect_Destroy(EnOkarinaEffect* this, GlobalContext* globalCtx) { globalCtx->unk_10B16[0] = 0; - if ((D_8011FB30 != 4) && (D_8011FB30 != 5) && (globalCtx->gloomySkyEvent == 1)) - { - globalCtx->gloomySkyEvent = 2; //end gloomy sky + if ((D_8011FB30 != 4) && (D_8011FB30 != 5) && (globalCtx->gloomySkyEvent == 1)) { + globalCtx->gloomySkyEvent = 2; // end gloomy sky func_80077684(globalCtx); } - globalCtx->lightning = 2; //end lightning + globalCtx->lightning = 2; // end lightning } -static void EnOkarinaEffect_Init(EnOkarinaEffect* this, GlobalContext* globalCtx) -{ +static void EnOkarinaEffect_Init(EnOkarinaEffect* this, GlobalContext* globalCtx) { osSyncPrintf("\n\n"); //"Ocarina Storm Effect" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ オカリナあらし効果ビカビカビカ〜 ☆☆☆☆☆ \n" VT_RST); osSyncPrintf("\n\n"); - if (globalCtx->unk_10B12[1] != 0) - { - Actor_Kill(&this->actor); //kill if an instance is already spawned + if (globalCtx->unk_10B12[1] != 0) { + Actor_Kill(&this->actor); // kill if an instance is already spawned } EnOkarinaEffect_SetupAction(this, &EnOkarinaEffect_TriggerStorm); } -static void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) -{ - this->timer = 400; //20 seconds - globalCtx->unk_10B16[0] = 20; //rain intensity target - globalCtx->gloomySkyEvent = 1; //start gloomy sky - if ((D_8011FB30 != 0) || globalCtx->gloomySky != 0) - { +static void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) { + this->timer = 400; // 20 seconds + globalCtx->unk_10B16[0] = 20; // rain intensity target + globalCtx->gloomySkyEvent = 1; // start gloomy sky + if ((D_8011FB30 != 0) || globalCtx->gloomySky != 0) { globalCtx->unk_10B02 = 1; } - globalCtx->lightning = 1; //start lightning + globalCtx->lightning = 1; // start lightning func_80077624(globalCtx); EnOkarinaEffect_SetupAction(this, &EnOkarinaEffect_ManageStorm); } -static void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) -{ - func_8006C438(globalCtx, 5); //clear bean grow env flag - if (((globalCtx->pauseCtx.state == 0) && (globalCtx->unk_10A20 == 0) && - (globalCtx->msgCtx.unk_E300 == 0) && (func_800C0D28(globalCtx) == 0) - && ((globalCtx->unk_1241B == 0) || (gSaveContext.game_mode != 0))) - || (this->timer >= 250)) - { - if (globalCtx->unk_10A42 != 0 || globalCtx->unk_10A43 != 1) - { +static void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, GlobalContext* globalCtx) { + func_8006C438(globalCtx, 5); // clear bean grow env flag + if (((globalCtx->pauseCtx.state == 0) && (globalCtx->unk_10A20 == 0) && (globalCtx->msgCtx.unk_E300 == 0) && + (func_800C0D28(globalCtx) == 0) && ((globalCtx->unk_1241B == 0) || (gSaveContext.game_mode != 0))) || + (this->timer >= 250)) { + if (globalCtx->unk_10A42 != 0 || globalCtx->unk_10A43 != 1) { this->timer--; } osSyncPrintf("\nthis->timer=[%d]", this->timer); - if (this->timer == 308) - { + if (this->timer == 308) { //"Let's grow some beans" osSyncPrintf("\n\n\n豆よ のびろ 指定\n\n\n"); - func_8006C3D0(globalCtx, 5); //set bean grow env flag + func_8006C3D0(globalCtx, 5); // set bean grow env flag } } - if (D_8011FB38 != 0) - { + if (D_8011FB38 != 0) { this->timer = 0; } - if (this->timer == 0) - { + if (this->timer == 0) { globalCtx->unk_10B16[0] = 0; - if (globalCtx->csCtx.state == 0) - { + if (globalCtx->csCtx.state == 0) { func_80077684(globalCtx); - } - else - if (func_800FA0B4(0) == 1) - { + } else if (func_800FA0B4(0) == 1) { func_800F6D58(0xF, 1, 0); func_800F6D58(0xE, 1, 0); } osSyncPrintf("\n\n\nE_wether_flg=[%d]", D_8011FB30); osSyncPrintf("\nrain_evt_trg=[%d]\n\n", globalCtx->gloomySkyEvent); - if (D_8011FB30 == 0 && (globalCtx->gloomySkyEvent == 1)) - { - globalCtx->gloomySkyEvent = 2; //end gloomy sky - } - else - { + if (D_8011FB30 == 0 && (globalCtx->gloomySkyEvent == 1)) { + globalCtx->gloomySkyEvent = 2; // end gloomy sky + } else { globalCtx->gloomySkyEvent = 0; globalCtx->unk_10B02 = 0; } - globalCtx->lightning = 2; //end lightning + globalCtx->lightning = 2; // end lightning Actor_Kill(&this->actor); } } -static void EnOkarinaEffect_Update(EnOkarinaEffect* this, GlobalContext* globalCtx) -{ +static void EnOkarinaEffect_Update(EnOkarinaEffect* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); - if (BREG(0) != 0) - { + if (BREG(0) != 0) { DebugDisplay_AddObject(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, - this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, - 1.0f, 1.0f, 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, globalCtx->state.gfxCtx); + this->actor.posRot.rot.x, this->actor.posRot.rot.y, this->actor.posRot.rot.z, 1.0f, 1.0f, + 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, globalCtx->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index fbb6ea8bb5..74cafda79e 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -1,6 +1,6 @@ #include "z_en_okarina_tag.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void EnOkarinaTag_Init(EnOkarinaTag* this, GlobalContext* globalCtx); 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 9d6fb9d2b5..b7387e7b0b 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -1,6 +1,6 @@ #include "z_en_okuta.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnOkuta_Init(EnOkuta* this, GlobalContext* globalCtx); 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 0a3da67c7e..ed35c629db 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -1,6 +1,6 @@ #include "z_en_ossan.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnOssan_Init(EnOssan* this, GlobalContext* globalCtx); 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 71a387205c..50813c1b57 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -1,6 +1,6 @@ #include "z_en_owl.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnOwl_Init(EnOwl* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 3c7701a84b..36d9a0d4f3 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -1,6 +1,6 @@ #include "z_en_part.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnPart_Init(EnPart* this, GlobalContext* globalCtx); 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 0e72785315..ee711ad05b 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -1,6 +1,6 @@ #include "z_en_peehat.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x01000015 void EnPeehat_Init(EnPeehat* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index ea70957c7d..697e20b59d 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -1,6 +1,6 @@ #include "z_en_po_desert.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00001090 void EnPoDesert_Init(EnPoDesert* this, GlobalContext* globalCtx); 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 f5eb512b15..33e33057b3 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 @@ -1,6 +1,6 @@ #include "z_en_po_field.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00001035 void EnPoField_Init(EnPoField* this, GlobalContext* globalCtx); @@ -104,4 +104,3 @@ const ActorInit En_Po_Field_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Po_Field/func_80AD6BF4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Po_Field/func_80AD6C4C.s") - 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 b394185037..828fbf17b5 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 @@ -1,6 +1,6 @@ #include "z_en_po_relay.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00011019 void EnPoRelay_Init(EnPoRelay* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 6926df62b4..9298414a70 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1,6 +1,6 @@ #include "z_en_po_sisters.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00005215 void EnPoSisters_Init(EnPoSisters* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index e01235e574..f6e3162c02 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -1,6 +1,6 @@ #include "z_en_poh.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00001015 void EnPoh_Init(EnPoh* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c index d20bd1a651..ba72f83411 100644 --- a/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c +++ b/src/overlays/actors/ovl_En_Pu_box/z_en_pu_box.c @@ -2,11 +2,11 @@ * File: z_en_pu_box.c * Overlay: ovl_En_Pu_Box * Description: An unused stone cube. -*/ + */ #include "z_en_pu_box.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void EnPubox_Init(EnPubox* this, GlobalContext* globalCtx); @@ -14,8 +14,7 @@ static void EnPubox_Destroy(EnPubox* this, GlobalContext* globalCtx); static void EnPubox_Update(EnPubox* this, GlobalContext* globalCtx); static void EnPubox_Draw(EnPubox* this, GlobalContext* globalCtx); -const ActorInit En_Pu_box_InitVars = -{ +const ActorInit En_Pu_box_InitVars = { ACTOR_EN_PU_BOX, ACTORTYPE_BG, ROOM, @@ -31,13 +30,11 @@ const ActorInit En_Pu_box_InitVars = extern u32 D_06000380; extern u32 D_060006D0; -static void EnPubox_Init(EnPubox* this, GlobalContext* globalCtx) -{ +static void EnPubox_Init(EnPubox* this, GlobalContext* globalCtx) { u32 local_c = 0; Actor* thisx = &this->dyna.actor; - switch(thisx->params) - { + switch (thisx->params) { case 0: Actor_SetScale(thisx, 0.0025f); break; @@ -66,23 +63,18 @@ static void EnPubox_Init(EnPubox* this, GlobalContext* globalCtx) this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); } -static void EnPubox_Destroy(EnPubox* this, GlobalContext* globalCtx) -{ +static void EnPubox_Destroy(EnPubox* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void EnPubox_Update(EnPubox* this, GlobalContext* globalCtx) -{ +static void EnPubox_Update(EnPubox* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; thisx->speedXZ += this->dyna.unk_150; thisx->posRot.rot.y = this->dyna.unk_158; - thisx->speedXZ = (thisx->speedXZ < -2.5f) ? -2.5f : - ((thisx->speedXZ > 2.5f) ? 2.5f : - thisx->speedXZ); + thisx->speedXZ = (thisx->speedXZ < -2.5f) ? -2.5f : ((thisx->speedXZ > 2.5f) ? 2.5f : thisx->speedXZ); Math_SmoothScaleMaxMinF(&thisx->speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); - if (thisx->speedXZ != 0.0f) - { + if (thisx->speedXZ != 0.0f) { Audio_PlaySoundGeneral(0x200A, &thisx->unk_E4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } this->dyna.unk_154 = 0.0f; @@ -92,7 +84,6 @@ static void EnPubox_Update(EnPubox* this, GlobalContext* globalCtx) thisx->posRot2.pos = thisx->posRot.pos; } -static void EnPubox_Draw(EnPubox* this, GlobalContext* globalCtx) -{ +static void EnPubox_Draw(EnPubox* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_06000380); } 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 9414f012e8..beb9c70c64 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -1,6 +1,6 @@ #include "z_en_rd.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000415 void EnRd_Init(EnRd* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index bbe37addaf..34183f3154 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -1,6 +1,6 @@ #include "z_en_reeba.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x08000015 void EnReeba_Init(EnReeba* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 001f1f72d8..29d79a0eb5 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -1,6 +1,6 @@ #include "z_en_river_sound.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnRiverSound_Init(EnRiverSound* this, GlobalContext* globalCtx); 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 4de9d7ab57..9e1e1d21d8 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -1,6 +1,6 @@ #include "z_en_rl.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnRl_Init(EnRl* this, GlobalContext* globalCtx); 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 cd9cf7ea69..41d7d555f2 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -1,6 +1,6 @@ #include "z_en_rr.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000435 void EnRr_Init(EnRr* this, GlobalContext* globalCtx); 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 f9a497e0bb..c38711e087 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -1,6 +1,6 @@ #include "z_en_ru1.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x04000011 void EnRu1_Init(EnRu1* this, GlobalContext* globalCtx); 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 238d25c5d3..968fd653bf 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -1,6 +1,6 @@ #include "z_en_ru2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnRu2_Init(EnRu2* this, GlobalContext* globalCtx); 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 3ad852beab..deb14890aa 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -1,6 +1,6 @@ #include "z_en_sa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000019 void EnSa_Init(EnSa* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 1bb726ee2a..a6ee3760f9 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -1,6 +1,6 @@ #include "z_en_sb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnSb_Init(EnSb* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c index b23bf2d7bb..a765f6fb83 100644 --- a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c +++ b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c @@ -2,18 +2,17 @@ * File: z_en_scene_change.c * Overlay: ovl_En_Scene_Change * Description: Unknown (Broken Actor) -*/ + */ #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc updateFunc; } EnSceneChange; // size = 0x0150 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void EnSceneChange_Init(EnSceneChange* this, GlobalContext* globalCtx); @@ -23,8 +22,7 @@ static void EnSceneChange_Draw(EnSceneChange* this, GlobalContext* globalCtx); static void func_80AF8C70(EnSceneChange* this, ActorFunc updateFunc); static void func_80AF8CAC(EnSceneChange* this, GlobalContext* globalCtx); -const ActorInit En_Scene_Change_InitVars = -{ +const ActorInit En_Scene_Change_InitVars = { ACTOR_EN_SCENE_CHANGE, ACTORTYPE_PROP, ROOM, @@ -37,45 +35,36 @@ const ActorInit En_Scene_Change_InitVars = (ActorFunc)EnSceneChange_Draw, }; - -static void func_80AF8C70(EnSceneChange* this, ActorFunc updateFunc) -{ +static void func_80AF8C70(EnSceneChange* this, ActorFunc updateFunc) { this->updateFunc = updateFunc; } -static void EnSceneChange_Init(EnSceneChange* this, GlobalContext* globalCtx) -{ +static void EnSceneChange_Init(EnSceneChange* this, GlobalContext* globalCtx) { func_80AF8C70(this, func_80AF8CAC); } -static void EnSceneChange_Destroy(EnSceneChange* this, GlobalContext* globalCtx) -{ - +static void EnSceneChange_Destroy(EnSceneChange* this, GlobalContext* globalCtx) { } -static void func_80AF8CAC(EnSceneChange* this, GlobalContext* globalCtx) -{ - +static void func_80AF8CAC(EnSceneChange* this, GlobalContext* globalCtx) { } -static void EnSceneChange_Update(EnSceneChange* this, GlobalContext* globalCtx) -{ +static void EnSceneChange_Update(EnSceneChange* this, GlobalContext* globalCtx) { this->updateFunc(&this->actor, globalCtx); } -static void EnSceneChange_Draw(EnSceneChange* this, GlobalContext* globalCtx) -{ +static void EnSceneChange_Draw(EnSceneChange* this, GlobalContext* globalCtx) { s32 pad[0x2]; Gfx* displayList; s32 pad1[0x2]; Gfx* displayListHead; GraphicsContext* gfxCtx; Gfx* gfxArr[4]; - + displayList = Graph_Alloc(globalCtx->state.gfxCtx, 0x3C0); - + gfxCtx = globalCtx->state.gfxCtx; - + func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_en_scene_change.c", 290); displayListHead = displayList; diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/src/overlays/actors/ovl_En_Sda/z_en_sda.c index f7f94a2e17..a9ed3ec501 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -1,6 +1,6 @@ #include "z_en_sda.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnSda_Init(EnSda* this, GlobalContext* globalCtx); @@ -36,4 +36,3 @@ const ActorInit En_Sda_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sda/func_80AF95C4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sda/func_80AF9C70.s") - diff --git a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c index 4de770cbbd..8e6aaedb84 100644 --- a/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c +++ b/src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.c @@ -1,6 +1,6 @@ #include "z_en_shopnuts.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnShopnuts_Init(EnShopnuts* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index 8459c35682..5b146510e5 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -1,6 +1,6 @@ #include "z_en_si.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000201 void EnSi_Init(EnSi* this, GlobalContext* globalCtx); @@ -38,6 +38,3 @@ const ActorInit En_Si_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Draw.s") - - - 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 c4eaae0b30..83a2a7d021 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -1,6 +1,6 @@ #include "z_en_siofuki.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnSiofuki_Init(EnSiofuki* this, GlobalContext* globalCtx); 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 09d9072040..b35a770124 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -1,6 +1,6 @@ #include "z_en_skb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnSkb_Init(EnSkb* this, GlobalContext* globalCtx); 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 b1195e3f03..7934401163 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1,6 +1,6 @@ #include "z_en_skj.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000015 void EnSkj_Init(EnSkj* this, GlobalContext* globalCtx); @@ -212,4 +212,3 @@ const ActorInit En_Skj_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skj/func_80B014E4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skj/EnSkj_Draw.s") - diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index 46eb75c122..78ebde1573 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -1,6 +1,6 @@ #include "z_en_skjneedle.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000205 void EnSkjneedle_Init(EnSkjneedle* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 3c154511c1..789d6d9cde 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -1,6 +1,6 @@ #include "z_en_ssh.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void EnSsh_Init(EnSsh* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index b86d70c99a..56bfe637d8 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -1,6 +1,6 @@ #include "z_en_st.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void EnSt_Init(EnSt* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 06af7dc629..334d9231fd 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -1,6 +1,6 @@ #include "z_en_sth.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnSth_Init(EnSth* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/src/overlays/actors/ovl_En_Stream/z_en_stream.c index 39a14fc8c3..8e1f9b3534 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -1,6 +1,6 @@ #include "z_en_stream.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnStream_Init(EnStream* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 8b9423d1ad..9f4096f1bf 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -1,6 +1,6 @@ #include "z_en_sw.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnSw_Init(EnSw* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index e5ea597dbb..339586fe4c 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -1,6 +1,6 @@ #include "z_en_syateki_itm.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnSyatekiItm_Init(EnSyatekiItm* this, GlobalContext* globalCtx); 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 9cb98966dd..49ad897d8d 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 @@ -1,6 +1,6 @@ #include "z_en_syateki_man.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x08000019 void EnSyatekiMan_Init(EnSyatekiMan* this, GlobalContext* globalCtx); 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 178ca2939a..345068e9b5 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 @@ -1,6 +1,6 @@ #include "z_en_syateki_niw.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnSyatekiNiw_Init(EnSyatekiNiw* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index ff905b4f8a..1875628d10 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -1,6 +1,6 @@ #include "z_en_ta.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnTa_Init(EnTa* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c index 94055a81e1..51273cde17 100644 --- a/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c +++ b/src/overlays/actors/ovl_En_Takara_Man/z_en_takara_man.c @@ -1,6 +1,6 @@ #include "z_en_takara_man.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x08000039 void EnTakaraMan_Init(EnTakaraMan* this, GlobalContext* globalCtx); 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 2be9a331d2..a03465c1bd 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -1,6 +1,6 @@ #include "z_en_tana.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnTana_Init(EnTana* this, GlobalContext* globalCtx); 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 c9bd3b20da..bc7d141e09 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -1,6 +1,6 @@ #include "z_en_test.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnTest_Init(EnTest* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index 9869550a16..dce566fa8c 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -1,6 +1,6 @@ #include "z_en_tg.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnTg_Init(EnTg* this, GlobalContext* globalCtx); 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 afddf7c339..ba6f565b64 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -1,6 +1,6 @@ #include "z_en_tite.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnTite_Init(EnTite* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index f5ec3bc5d5..954447e626 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -2,27 +2,26 @@ #include #include "z_en_tk.h" -typedef struct -{ - /* 0x0000 */ u8 health; /* SubActorStruct98.health */ - /* 0x0002 */ s16 h_2; /* SubActorStruct98.unk_10 */ - /* 0x0004 */ s16 h_4; /* SubActorStruct98.unk_12 */ - /* 0x0006 */ s16 h_6; /* SubActorStruct98.unk_14 */ - /* 0x0008 */ u8 mass; /* SubActorStruct98.mass */ +typedef struct { + /* 0x0000 */ u8 health; /* SubActorStruct98.health */ + /* 0x0002 */ s16 h_2; /* SubActorStruct98.unk_10 */ + /* 0x0004 */ s16 h_4; /* SubActorStruct98.unk_12 */ + /* 0x0006 */ s16 h_6; /* SubActorStruct98.unk_14 */ + /* 0x0008 */ u8 mass; /* SubActorStruct98.mass */ /* 0x000A */ } EnTk_SubActorStruct98Init; #define ROOM 0x00 #define FLAGS 0x00000009 -s32 EnTk_CheckNextSpot(EnTk *this, GlobalContext *globalCtx); -void EnTk_Init(EnTk *this, GlobalContext *globalCtx); -void EnTk_Destroy(EnTk *this, GlobalContext *globalCtx); -void EnTk_Rest(EnTk *this, GlobalContext *globalCtx); -void EnTk_Walk(EnTk *this, GlobalContext *globalCtx); -void EnTk_Dig(EnTk *this, GlobalContext *globalCtx); -void EnTk_Update(EnTk *this, GlobalContext *globalCtx); -void EnTk_Draw(EnTk *this, GlobalContext *globalCtx); +s32 EnTk_CheckNextSpot(EnTk* this, GlobalContext* globalCtx); +void EnTk_Init(EnTk* this, GlobalContext* globalCtx); +void EnTk_Destroy(EnTk* this, GlobalContext* globalCtx); +void EnTk_Rest(EnTk* this, GlobalContext* globalCtx); +void EnTk_Walk(EnTk* this, GlobalContext* globalCtx); +void EnTk_Dig(EnTk* this, GlobalContext* globalCtx); +void EnTk_Update(EnTk* this, GlobalContext* globalCtx); +void EnTk_Draw(EnTk* this, GlobalContext* globalCtx); extern UNK_TYPE D_04051DB0; extern UNK_TYPE D_040521B0; @@ -43,8 +42,7 @@ extern UNK_TYPE D_0600BC90; extern UNK_TYPE D_0600BCA0; extern UNK_TYPE D_0600BE40; -const ActorInit En_Tk_InitVars = -{ +const ActorInit En_Tk_InitVars = { ACTOR_EN_TK, ACTORTYPE_NPC, ROOM, @@ -57,16 +55,12 @@ const ActorInit En_Tk_InitVars = (ActorFunc)EnTk_Draw, }; -void EnTkEff_Create(EnTk *this, Vec3f *pos, Vec3f *speed, Vec3f *accel, - u8 duration, f32 size, f32 growth) -{ +void EnTkEff_Create(EnTk* this, Vec3f* pos, Vec3f* speed, Vec3f* accel, u8 duration, f32 size, f32 growth) { s16 i; - EnTkEff *eff = this->eff; + EnTkEff* eff = this->eff; - for (i = 0; i < ARRAY_COUNT(this->eff); i++) - { - if (eff->active != 1) - { + for (i = 0; i < ARRAY_COUNT(this->eff); i++) { + if (eff->active != 1) { eff->size = size; eff->growth = growth; eff->timeTotal = eff->timeLeft = duration; @@ -80,19 +74,15 @@ void EnTkEff_Create(EnTk *this, Vec3f *pos, Vec3f *speed, Vec3f *accel, } } -void EnTkEff_Update(EnTk *this) -{ +void EnTkEff_Update(EnTk* this) { s16 i; - EnTkEff *eff; + EnTkEff* eff; eff = this->eff; - for (i = 0; i < ARRAY_COUNT(this->eff); i++) - { - if (eff->active != 0) - { + for (i = 0; i < ARRAY_COUNT(this->eff); i++) { + if (eff->active != 0) { eff->timeLeft--; - if (eff->timeLeft == 0) - { + if (eff->timeLeft == 0) { eff->active = 0; } eff->accel.x = Math_Rand_ZeroOne() * 0.4f - 0.2f; @@ -109,27 +99,18 @@ void EnTkEff_Update(EnTk *this) } } -void EnTkEff_Draw(EnTk *this, GlobalContext *globalCtx) -{ - static UNK_PTR images[] = - { - &D_040539B0, - &D_040535B0, - &D_040531B0, - &D_04052DB0, - &D_040529B0, - &D_040525B0, - &D_040521B0, - &D_04051DB0, +void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { + static UNK_PTR images[] = { + &D_040539B0, &D_040535B0, &D_040531B0, &D_04052DB0, &D_040529B0, &D_040525B0, &D_040521B0, &D_04051DB0, }; - EnTkEff *eff = this->eff; - GraphicsContext *gfxCtx; + EnTkEff* eff = this->eff; + GraphicsContext* gfxCtx; s16 gfxSetup; s16 i; s16 alpha; s16 imageIdx; - Gfx *pgdl[4]; + Gfx* pgdl[4]; /* * This assignment always occurs before a call to func_800C6AC4 which @@ -145,14 +126,15 @@ void EnTkEff_Draw(EnTk *this, GlobalContext *globalCtx) * Same code is generated without the if, * but that would make the do...while redundant so there's probably an if. */ - do { if (1) { func_80093D84(globalCtx->state.gfxCtx); } } while (0); + do { + if (1) { + func_80093D84(globalCtx->state.gfxCtx); + } + } while (0); - for (i = 0; i < ARRAY_COUNT(this->eff); i++) - { - if (eff->active != 0) - { - if (gfxSetup == 0) - { + for (i = 0; i < ARRAY_COUNT(this->eff); i++) { + if (eff->active != 0) { + if (gfxSetup == 0) { gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 0); gSPDisplayList(gfxCtx->polyXlu.p++, &D_0600BC90); gDPSetEnvColor(gfxCtx->polyXlu.p++, 0x64, 0x3C, 0x14, 0x00); @@ -166,15 +148,11 @@ void EnTkEff_Draw(EnTk *this, GlobalContext *globalCtx) Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); func_800D1FD4(&globalCtx->mf_11DA0); Matrix_Scale(eff->size, eff->size, 1.f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, - Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", - 140), + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 140), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - imageIdx = eff->timeLeft * - ((f32)ARRAY_COUNT(images) / eff->timeTotal); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, - SEGMENTED_TO_VIRTUAL(images[imageIdx])); + imageIdx = eff->timeLeft * ((f32)ARRAY_COUNT(images) / eff->timeTotal); + gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(images[imageIdx])); gSPDisplayList(gfxCtx->polyXlu.p++, &D_0600BCA0); } @@ -184,11 +162,9 @@ void EnTkEff_Draw(EnTk *this, GlobalContext *globalCtx) func_800C6B54(pgdl, globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 154); } -s32 EnTkEff_CreateDflt(EnTk *this, Vec3f *pos, u8 duration, f32 size, - f32 growth, f32 yAccelMax) -{ - Vec3f speed = {0.f, 0.f, 0.f}; - Vec3f accel = {0.f, 0.3f, 0.f}; +s32 EnTkEff_CreateDflt(EnTk* this, Vec3f* pos, u8 duration, f32 size, f32 growth, f32 yAccelMax) { + Vec3f speed = { 0.f, 0.f, 0.f }; + Vec3f accel = { 0.f, 0.3f, 0.f }; accel.y += Math_Rand_ZeroOne() * yAccelMax; @@ -199,79 +175,55 @@ s32 EnTkEff_CreateDflt(EnTk *this, Vec3f *pos, u8 duration, f32 size, /** z_en_tk_eff.c ends here probably **/ -static ColliderCylinderInit D_80B1D508 = -{ - 0x0A, 0x00, 0x00, 0x39, - 0x20, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00000000, 0x00, 0x00, - 0x00, 0x00, 0x00000000, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, - 0x001E, 0x0034, 0x0000, - 0x0000, 0x0000, 0x0000, +static ColliderCylinderInit D_80B1D508 = { + 0x0A, 0x00, 0x00, 0x39, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x001E, 0x0034, 0x0000, 0x0000, 0x0000, 0x0000, }; -static EnTk_SubActorStruct98Init D_80B1D534 = -{ - 0x00, - 0x0000, - 0x0000, - 0x0000, - 0xFF, +static EnTk_SubActorStruct98Init D_80B1D534 = { + 0x00, 0x0000, 0x0000, 0x0000, 0xFF, }; -void EnTk_RestAnim(EnTk *this, GlobalContext *globalCtx) -{ +void EnTk_RestAnim(EnTk* this, GlobalContext* globalCtx) { UNK_PTR anim = &D_06002F84; - SkelAnime_ChangeAnimation(&this->skelAnim, (u32)anim, 1.f, 0.f, - SkelAnime_GetFrameCount((u32)&D_06002F84), 0, + SkelAnime_ChangeAnimation(&this->skelAnim, (u32)anim, 1.f, 0.f, SkelAnime_GetFrameCount((u32)&D_06002F84), 0, -10.f); this->actionCountdown = Math_Rand_S16Offset(60, 60); this->actor.speedXZ = 0.f; } -void EnTk_WalkAnim(EnTk *this, GlobalContext *globalCtx) -{ +void EnTk_WalkAnim(EnTk* this, GlobalContext* globalCtx) { UNK_PTR anim = &D_06001FA8; - SkelAnime_ChangeAnimation(&this->skelAnim, (u32)anim, 1.f, 0.f, - SkelAnime_GetFrameCount((u32)&D_06002F84), 0, + SkelAnime_ChangeAnimation(&this->skelAnim, (u32)anim, 1.f, 0.f, SkelAnime_GetFrameCount((u32)&D_06002F84), 0, -10.f); this->actionCountdown = Math_Rand_S16Offset(240, 240); } -void EnTk_DigAnim(EnTk *this, GlobalContext *globalCtx) -{ +void EnTk_DigAnim(EnTk* this, GlobalContext* globalCtx) { UNK_PTR anim = &D_06001144; - SkelAnime_ChangeAnimation(&this->skelAnim, (u32)anim, 1.f, 0.f, - SkelAnime_GetFrameCount((u32)&D_06001144), 0, + SkelAnime_ChangeAnimation(&this->skelAnim, (u32)anim, 1.f, 0.f, SkelAnime_GetFrameCount((u32)&D_06001144), 0, -10.f); - if (EnTk_CheckNextSpot(this, globalCtx) >= 0) - { + if (EnTk_CheckNextSpot(this, globalCtx) >= 0) { this->validDigHere = 1; } } -void EnTk_UpdateEyes(EnTk *this) -{ - if (DECR(this->blinkCountdown) == 0) - { +void EnTk_UpdateEyes(EnTk* this) { + if (DECR(this->blinkCountdown) == 0) { this->eyeImageIdx++; - if (this->eyeImageIdx > 2) - { + if (this->eyeImageIdx > 2) { this->blinkCycles--; - if (this->blinkCycles < 0) - { + if (this->blinkCycles < 0) { this->blinkCountdown = Math_Rand_S16Offset(30, 30); this->blinkCycles = 2; - if (Math_Rand_ZeroOne() > 0.5f) - { + if (Math_Rand_ZeroOne() > 0.5f) { this->blinkCycles++; } } @@ -280,13 +232,11 @@ void EnTk_UpdateEyes(EnTk *this) } } -s32 EnTk_CheckFacingPlayer(EnTk *this) -{ +s32 EnTk_CheckFacingPlayer(EnTk* this) { s16 v0; s16 v1; - if (this->actor.waterSurfaceDist > 10000.f) - { + if (this->actor.waterSurfaceDist > 10000.f) { return 0; } @@ -295,42 +245,34 @@ s32 EnTk_CheckFacingPlayer(EnTk *this) v0 -= this->headRot; v1 = this->actor.rotTowardsLinkY - v0; - if (ABS(v1) < 0x1554) - { + if (ABS(v1) < 0x1554) { return 1; - } - else - { + } else { return 0; } } -s32 EnTk_CheckNextSpot(EnTk *this, GlobalContext *globalCtx) -{ - Actor *prop; +s32 EnTk_CheckNextSpot(EnTk* this, GlobalContext* globalCtx) { + Actor* prop; f32 dxz; f32 dy; prop = globalCtx->actorCtx.actorList[ACTORTYPE_PROP].first; - while (prop != NULL) - { - if (prop->id != ACTOR_EN_IT) - { + while (prop != NULL) { + if (prop->id != ACTOR_EN_IT) { prop = prop->next; continue; } - if (prop == this->currentSpot) - { + if (prop == this->currentSpot) { prop = prop->next; continue; } dy = prop->posRot.pos.y - this->actor.unk_80; dxz = func_8002DB8C(&this->actor, prop); - if (dxz > 40.f || dy > 10.f) - { + if (dxz > 40.f || dy > 10.f) { prop = prop->next; continue; } @@ -342,67 +284,53 @@ s32 EnTk_CheckNextSpot(EnTk *this, GlobalContext *globalCtx) return -1; } -void EnTk_CheckCurrentSpot(EnTk *this) -{ +void EnTk_CheckCurrentSpot(EnTk* this) { f32 dxz; f32 dy; - if (this->currentSpot != NULL) - { + if (this->currentSpot != NULL) { dy = this->currentSpot->posRot.pos.y - this->actor.unk_80; dxz = func_8002DB8C(&this->actor, this->currentSpot); - if (dxz > 40.f || dy > 10.f) - { + if (dxz > 40.f || dy > 10.f) { this->currentSpot = NULL; } } } -f32 EnTk_Step(EnTk *this, GlobalContext *globalCtx) -{ - f32 stepFrames[] = {36.f, 10.f}; +f32 EnTk_Step(EnTk* this, GlobalContext* globalCtx) { + f32 stepFrames[] = { 36.f, 10.f }; f32 a1_; s32 i; - if (this->skelAnim.animCurrentFrame == 0.f || - this->skelAnim.animCurrentFrame == 25.f) - { + if (this->skelAnim.animCurrentFrame == 0.f || this->skelAnim.animCurrentFrame == 25.f) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MORIBLIN_WALK); } - if (this->skelAnim.animCurrent != (u32 *)&D_06001FA8) - { + if (this->skelAnim.animCurrent != (u32*)&D_06001FA8) { return 0.f; } a1_ = this->skelAnim.animCurrentFrame; - for (i = 0; i < ARRAY_COUNT(stepFrames); i++) - { - if (a1_ < stepFrames[i] + 12.f && a1_ >= stepFrames[i]) - { + for (i = 0; i < ARRAY_COUNT(stepFrames); i++) { + if (a1_ < stepFrames[i] + 12.f && a1_ >= stepFrames[i]) { break; } } - if (i >= ARRAY_COUNT(stepFrames)) - { + if (i >= ARRAY_COUNT(stepFrames)) { return 0.f; - } - else - { + } else { a1_ = (0x8000 / 12.f) * (a1_ - stepFrames[i]); return Math_Sins(a1_) * 2.f; } } -s32 EnTk_Orient(EnTk *this, GlobalContext *globalCtx) -{ - Path *path; - Vec3s *point; +s32 EnTk_Orient(EnTk* this, GlobalContext* globalCtx) { + Path* path; + Vec3s* point; f32 dx; f32 dz; - if (this->actor.params < 0) - { + if (this->actor.params < 0) { return 1; } @@ -413,90 +341,63 @@ s32 EnTk_Orient(EnTk *this, GlobalContext *globalCtx) dx = point->x - this->actor.posRot.pos.x; dz = point->z - this->actor.posRot.pos.z; - Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, - Math_atan2f(dx, dz) * (0x8000 / M_PI), 10, 1000, 1); + Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, Math_atan2f(dx, dz) * (0x8000 / M_PI), 10, 1000, 1); this->actor.posRot.rot = this->actor.shape.rot; - if (SQ(dx) + SQ(dz) < 10.f) - { + if (SQ(dx) + SQ(dz) < 10.f) { this->currentWaypoint++; - if (this->currentWaypoint >= path->count) - { + if (this->currentWaypoint >= path->count) { this->currentWaypoint = 0; } return 0; - } - else - { + } else { return 1; } } -u16 func_80B1C54C(GlobalContext *globalCtx, Actor *a1) -{ +u16 func_80B1C54C(GlobalContext* globalCtx, Actor* a1) { u16 ret; ret = func_8006C360(globalCtx, 14); - if (ret != 0) - { + if (ret != 0) { return ret; } - if (gSaveContext.inf_table[13] & 0x0200) - { + if (gSaveContext.inf_table[13] & 0x0200) { /* "Do you want me to dig here? ..." */ return 0x5019; - } - else - { + } else { /* "Hey kid! ..." */ return 0x5018; } } -s16 func_80B1C5A0(GlobalContext *globalCtx, Actor *actor) -{ +s16 func_80B1C5A0(GlobalContext* globalCtx, Actor* actor) { s32 ret = 1; - switch (func_8010BDBC(&globalCtx->msgCtx)) - { + switch (func_8010BDBC(&globalCtx->msgCtx)) { case 0: case 1: - { break; - } case 2: - { /* "I am the boss of the carpenters ..." (wtf?) */ - if (actor->textId == 0x5028) - { + if (actor->textId == 0x5028) { gSaveContext.inf_table[13] |= 0x0100; } ret = 0; break; - } case 3: - { break; - } case 4: - { - if (func_80106BC8(globalCtx) != 0 && - (actor->textId == 0x5018 || actor->textId == 0x5019)) - { - if (globalCtx->msgCtx.choiceIndex == 1) - { + if (func_80106BC8(globalCtx) != 0 && (actor->textId == 0x5018 || actor->textId == 0x5019)) { + if (globalCtx->msgCtx.choiceIndex == 1) { /* "Thanks a lot!" */ actor->textId = 0x0084; - } - else if (gSaveContext.rupees < 10) - { + } else if (gSaveContext.rupees < 10) { /* "You don't have enough Rupees!" */ actor->textId = 0x0085; - } - else - { + } else { globalCtx->msgCtx.msgMode = 0x37; Rupees_ChangeBy(-10); gSaveContext.inf_table[13] |= 0x0200; @@ -506,115 +407,78 @@ s16 func_80B1C5A0(GlobalContext *globalCtx, Actor *actor) gSaveContext.inf_table[13] |= 0x0200; } break; - } case 5: - { - if (func_80106BC8(globalCtx) != 0 && - (actor->textId == 0x0084 || actor->textId == 0x0085)) - { + if (func_80106BC8(globalCtx) != 0 && (actor->textId == 0x0084 || actor->textId == 0x0085)) { func_80106CCC(globalCtx); ret = 0; } break; - } case 6: case 7: case 8: case 9: - { break; - } } return ret; } -s32 EnTk_ChooseReward(EnTk *this) -{ +s32 EnTk_ChooseReward(EnTk* this) { f32 luck; s32 reward; luck = Math_Rand_ZeroOne(); - if (luck < 0.4f) - { + if (luck < 0.4f) { reward = 0; - } - else if (luck < 0.7) - { + } else if (luck < 0.7) { reward = 1; - } - else if (luck < 0.9) - { + } else if (luck < 0.9) { reward = 2; - } - else - { + } else { reward = 3; } - switch (reward) - { + switch (reward) { case 0: - { - if (this->rewardCount[0] < 8) - { + if (this->rewardCount[0] < 8) { this->rewardCount[0] += 1; return reward; } break; - } case 1: - { - if (this->rewardCount[1] < 4) - { + if (this->rewardCount[1] < 4) { this->rewardCount[1] += 1; return reward; } break; - } case 2: - { - if (this->rewardCount[2] < 2) - { + if (this->rewardCount[2] < 2) { this->rewardCount[2] += 1; return reward; } break; - } case 3: - { - if (this->rewardCount[3] < 1) - { + if (this->rewardCount[3] < 1) { this->rewardCount[3] += 1; return reward; } break; - } } - if (this->rewardCount[0] < 8) - { + if (this->rewardCount[0] < 8) { this->rewardCount[0] += 1; reward = 0; - } - else if (this->rewardCount[1] < 4) - { + } else if (this->rewardCount[1] < 4) { this->rewardCount[1] += 1; reward = 1; - } - else if (this->rewardCount[2] < 2) - { + } else if (this->rewardCount[2] < 2) { this->rewardCount[2] += 1; reward = 2; - } - else if (this->rewardCount[3] < 1) - { + } else if (this->rewardCount[3] < 1) { this->rewardCount[3] += 1; reward = 3; - } - else - { + } else { reward = 0; this->rewardCount[0] = 1; this->rewardCount[1] = 0; @@ -625,15 +489,12 @@ s32 EnTk_ChooseReward(EnTk *this) return reward; } -void EnTk_DigEff(EnTk *this) -{ - Vec3f pos = {0.f, 0.f, 0.f}; - Vec3f speed = {0.f, 0.f, 0.f}; - Vec3f accel = {0.f, 0.3f, 0.f}; +void EnTk_DigEff(EnTk* this) { + Vec3f pos = { 0.f, 0.f, 0.f }; + Vec3f speed = { 0.f, 0.f, 0.f }; + Vec3f accel = { 0.f, 0.3f, 0.f }; - if (this->skelAnim.animCurrentFrame >= 32.f && - this->skelAnim.animCurrentFrame < 40.f) - { + if (this->skelAnim.animCurrentFrame >= 32.f && this->skelAnim.animCurrentFrame < 40.f) { pos.x = (Math_Rand_ZeroOne() - 0.5f) * 12.f + this->v3f_304.x; pos.y = (Math_Rand_ZeroOne() - 0.5f) * 8.f + this->v3f_304.y; pos.z = (Math_Rand_ZeroOne() - 0.5f) * 12.f + this->v3f_304.z; @@ -641,31 +502,23 @@ void EnTk_DigEff(EnTk *this) } } -void EnTk_Init(EnTk *this, GlobalContext *globalCtx) -{ - EnTk *thisAgain = this; +void EnTk_Init(EnTk* this, GlobalContext* globalCtx) { + EnTk* thisAgain = this; UNK_PTR anim = &D_06002F84; - ActorShape_Init(&thisAgain->actor.shape, 0, ActorShadow_DrawFunc_Circle, - 24.f); + ActorShape_Init(&thisAgain->actor.shape, 0, ActorShadow_DrawFunc_Circle, 24.f); - func_800A46F8(globalCtx, &thisAgain->skelAnim, (u32)&D_0600BE40, 0, - thisAgain->hz_22A, thisAgain->hz_296, 18); - SkelAnime_ChangeAnimation(&thisAgain->skelAnim, (u32)anim, 1.f, 0.f, - SkelAnime_GetFrameCount((u32)&D_06002F84), - 0, 0.f); + func_800A46F8(globalCtx, &thisAgain->skelAnim, (u32)&D_0600BE40, 0, thisAgain->hz_22A, thisAgain->hz_296, 18); + SkelAnime_ChangeAnimation(&thisAgain->skelAnim, (u32)anim, 1.f, 0.f, SkelAnime_GetFrameCount((u32)&D_06002F84), 0, + 0.f); ActorCollider_AllocCylinder(globalCtx, &thisAgain->collider); - ActorCollider_InitCylinder(globalCtx, &thisAgain->collider, - &thisAgain->actor, &D_80B1D508); + ActorCollider_InitCylinder(globalCtx, &thisAgain->collider, &thisAgain->actor, &D_80B1D508); func_80061EFC(&thisAgain->actor.sub_98, NULL, &D_80B1D534); - if (gSaveContext.day_time <= 0xC000 || - gSaveContext.day_time >= 0xE000 || - !LINK_IS_CHILD || - globalCtx->sceneNum != SCENE_SPOT02) - { + if (gSaveContext.day_time <= 0xC000 || gSaveContext.day_time >= 0xE000 || !LINK_IS_CHILD || + globalCtx->sceneNum != SCENE_SPOT02) { Actor_Kill(&thisAgain->actor); return; } @@ -679,64 +532,50 @@ void EnTk_Init(EnTk *this, GlobalContext *globalCtx) thisAgain->actionFunc = EnTk_Rest; } -void EnTk_Destroy(EnTk *this, GlobalContext *globalCtx) -{ - EnTk *thisAgain = this; +void EnTk_Destroy(EnTk* this, GlobalContext* globalCtx) { + EnTk* thisAgain = this; ActorCollider_FreeCylinder(globalCtx, &thisAgain->collider); } -void EnTk_Rest(EnTk *this, GlobalContext *globalCtx) -{ +void EnTk_Rest(EnTk* this, GlobalContext* globalCtx) { s16 v1; s16 a1_; - if (this->h_1E0 != 0) - { + if (this->h_1E0 != 0) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; v1 = this->actor.rotTowardsLinkY - v1; - if (this->h_1E0 == 2) - { + if (this->h_1E0 == 2) { EnTk_DigAnim(this, globalCtx); this->h_1E0 = 0; this->actionFunc = EnTk_Dig; return; } - func_800343CC(globalCtx, &this->actor, &this->h_1E0, - this->collider.dim.radius + 30.f, - func_80B1C54C, func_80B1C5A0); - } - else if (EnTk_CheckFacingPlayer(this) != 0) - { + func_800343CC(globalCtx, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.f, func_80B1C54C, + func_80B1C5A0); + } else if (EnTk_CheckFacingPlayer(this) != 0) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; v1 = this->actor.rotTowardsLinkY - v1; this->actionCountdown = 0; - func_800343CC(globalCtx, &this->actor, &this->h_1E0, - this->collider.dim.radius + 30.f, - func_80B1C54C, func_80B1C5A0); - } - else if (func_8002F194(&this->actor, globalCtx) != 0) - { + func_800343CC(globalCtx, &this->actor, &this->h_1E0, this->collider.dim.radius + 30.f, func_80B1C54C, + func_80B1C5A0); + } else if (func_8002F194(&this->actor, globalCtx) != 0) { v1 = this->actor.shape.rot.y; v1 -= this->h_21E; v1 = this->actor.rotTowardsLinkY - v1; this->actionCountdown = 0; this->h_1E0 = 1; - } - else if (DECR(this->actionCountdown) == 0) - { + } else if (DECR(this->actionCountdown) == 0) { EnTk_WalkAnim(this, globalCtx); this->actionFunc = EnTk_Walk; /*! @bug v1 is uninitialized past this branch */ - } - else - { + } else { v1 = 0; } @@ -744,36 +583,29 @@ void EnTk_Rest(EnTk *this, GlobalContext *globalCtx) Math_SmoothScaleMaxMinS(&this->headRot, a1_, 6, 1000, 1); } -void EnTk_Walk(EnTk *this, GlobalContext *globalCtx) -{ - if (this->h_1E0 == 2) - { +void EnTk_Walk(EnTk* this, GlobalContext* globalCtx) { + if (this->h_1E0 == 2) { EnTk_DigAnim(this, globalCtx); this->h_1E0 = 0; this->actionFunc = EnTk_Dig; - } - else - { + } else { this->actor.speedXZ = EnTk_Step(this, globalCtx); EnTk_Orient(this, globalCtx); Math_SmoothScaleMaxMinS(&this->headRot, 0, 6, 1000, 1); EnTk_CheckCurrentSpot(this); DECR(this->actionCountdown); - if (EnTk_CheckFacingPlayer(this) != 0 || this->actionCountdown == 0) - { + if (EnTk_CheckFacingPlayer(this) != 0 || this->actionCountdown == 0) { EnTk_RestAnim(this, globalCtx); this->actionFunc = EnTk_Rest; } } } -void EnTk_Dig(EnTk *this, GlobalContext *globalCtx) -{ +void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { Vec3f rewardOrigin; Vec3f rewardPos; - s32 rewardParams[] = - { + s32 rewardParams[] = { 0x0000, /* Green rupee */ 0x0001, /* Blue rupee */ 0x0002, /* Red rupee */ @@ -783,15 +615,13 @@ void EnTk_Dig(EnTk *this, GlobalContext *globalCtx) EnTk_DigEff(this); - if (this->skelAnim.animCurrentFrame == 32.f) - { + if (this->skelAnim.animCurrentFrame == 32.f) { /* What's gonna come out? */ Audio_PlayActorSound2(&this->actor, NA_SE_EV_DIG_UP); this->rewardTimer = 0; - if (this->validDigHere == 1) - { + if (this->validDigHere == 1) { rewardOrigin.x = 0.f; rewardOrigin.y = 0.f; rewardOrigin.z = -40.f; @@ -804,55 +634,41 @@ void EnTk_Dig(EnTk *this, GlobalContext *globalCtx) rewardPos.z += this->actor.posRot.pos.z; this->currentReward = EnTk_ChooseReward(this); - if (this->currentReward == 3) - { + if (this->currentReward == 3) { /* * Upgrade the purple rupee reward to the heart piece if this * is the first grand prize dig. */ - if ((gSaveContext.item_get_inf[1] & 0x1000) == 0) - { + if ((gSaveContext.item_get_inf[1] & 0x1000) == 0) { gSaveContext.item_get_inf[1] |= 0x1000; this->currentReward = 4; } } - Item_DropCollectible(globalCtx, &rewardPos, - rewardParams[this->currentReward]); + Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); } } - if (this->skelAnim.animCurrentFrame >= 32.f && this->rewardTimer == 10) - { + if (this->skelAnim.animCurrentFrame >= 32.f && this->rewardTimer == 10) { /* Play a reward sound shortly after digging */ - if (this->validDigHere == 0) - { + if (this->validDigHere == 0) { /* Bad dig spot */ Audio_PlayActorSound2(&this->actor, NA_SE_SY_ERROR); - } - else if (this->currentReward == 4) - { + } else if (this->currentReward == 4) { /* Heart piece */ - Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, - &D_801333E0, &D_801333E0, &D_801333E8); - } - else - { + Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + } else { /* Rupee */ Audio_PlayActorSound2(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); } } this->rewardTimer++; - if (func_800A56C8(&this->skelAnim, this->skelAnim.animFrameCount) != 0) - { - if (this->currentReward < 0) - { + if (func_800A56C8(&this->skelAnim, this->skelAnim.animFrameCount) != 0) { + if (this->currentReward < 0) { /* "Nope, nothing here!" */ func_8010B680(globalCtx, 0x501A, 0); - } - else - { + } else { func_80106CCC(globalCtx); } @@ -864,10 +680,9 @@ void EnTk_Dig(EnTk *this, GlobalContext *globalCtx) } } -void EnTk_Update(EnTk *this, GlobalContext *globalCtx) -{ - EnTk *thisAgain = this; - ColliderCylinderMain *collider = &thisAgain->collider; +void EnTk_Update(EnTk* this, GlobalContext* globalCtx) { + EnTk* thisAgain = this; + ColliderCylinderMain* collider = &thisAgain->collider; ActorCollider_Cylinder_Update(&thisAgain->actor, collider); Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, collider); @@ -885,10 +700,9 @@ void EnTk_Update(EnTk *this, GlobalContext *globalCtx) EnTk_UpdateEyes(thisAgain); } -void func_80B1D200(GlobalContext *globalCtx) -{ - GraphicsContext *gfxCtx; - Gfx *pgdl[4]; +void func_80B1D200(GlobalContext* globalCtx) { + GraphicsContext* gfxCtx; + Gfx* pgdl[4]; gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(pgdl, globalCtx->state.gfxCtx, "../z_en_tk.c", 1188); @@ -898,64 +712,51 @@ void func_80B1D200(GlobalContext *globalCtx) func_800C6B54(pgdl, globalCtx->state.gfxCtx, "../z_en_tk.c", 1190); } -s32 func_80B1D278(s16 a0, UNK_TYPE a1, UNK_TYPE a2, UNK_TYPE a3, Vec3s *sp10, - Actor *actor) -{ - EnTk *tk = (EnTk *)actor; +s32 func_80B1D278(s16 a0, UNK_TYPE a1, UNK_TYPE a2, UNK_TYPE a3, Vec3s* sp10, Actor* actor) { + EnTk* tk = (EnTk*)actor; - switch (a1) - { + switch (a1) { /* Limb 15 - Head */ case 15: - { tk->h_21E = sp10->y; break; - } /* Limb 16 - Jaw */ case 16: - { tk->h_21E += sp10->y; sp10->y += tk->headRot; break; - } } return 0; } -void func_80B1D2E4(GlobalContext *globalCtx, UNK_TYPE a1, UNK_TYPE a2, - UNK_TYPE a3, Actor *actor) -{ - EnTk *this = (EnTk *)actor; - Vec3f sp28 = {0.f, 0.f, 4600.f}; - Vec3f sp1C = {0.f, 0.f, 0.f}; +void func_80B1D2E4(GlobalContext* globalCtx, UNK_TYPE a1, UNK_TYPE a2, UNK_TYPE a3, Actor* actor) { + EnTk* this = (EnTk*)actor; + Vec3f sp28 = { 0.f, 0.f, 4600.f }; + Vec3f sp1C = { 0.f, 0.f, 0.f }; /* Limb 16 - Jaw */ - if (a1 == 16) - { + if (a1 == 16) { Matrix_MultVec3f(&sp1C, &this->actor.posRot2.pos); } /* Limb 14 - Neck */ - if (a1 == 14) - { + if (a1 == 14) { Matrix_MultVec3f(&sp28, &this->v3f_304); func_80B1D200(globalCtx); } } -void EnTk_Draw(EnTk *this, GlobalContext *globalCtx) -{ - static UNK_PTR eyeImages[] = - { +void EnTk_Draw(EnTk* this, GlobalContext* globalCtx) { + static UNK_PTR eyeImages[] = { &D_06003B40, &D_06004340, &D_06004B40, }; - EnTk *thisAgain = this; - GraphicsContext *gfxCtx; - Gfx *pgdl[4]; + EnTk* thisAgain = this; + GraphicsContext* gfxCtx; + Gfx* pgdl[4]; Matrix_Push(); EnTkEff_Draw(thisAgain, globalCtx); @@ -966,13 +767,10 @@ void EnTk_Draw(EnTk *this, GlobalContext *globalCtx) func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, - SEGMENTED_TO_VIRTUAL(eyeImages[thisAgain->eyeImageIdx])); + gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(eyeImages[thisAgain->eyeImageIdx])); - func_800A1AC8(globalCtx, thisAgain->skelAnim.limbIndex, - thisAgain->skelAnim.actorDrawTbl, - thisAgain->skelAnim.dListCount, func_80B1D278, func_80B1D2E4, - &thisAgain->actor); + func_800A1AC8(globalCtx, thisAgain->skelAnim.limbIndex, thisAgain->skelAnim.actorDrawTbl, + thisAgain->skelAnim.dListCount, func_80B1D278, func_80B1D2E4, &thisAgain->actor); func_800C6B54(pgdl, globalCtx->state.gfxCtx, "../z_en_tk.c", 1312); } diff --git a/src/overlays/actors/ovl_En_Torch/z_en_torch.c b/src/overlays/actors/ovl_En_Torch/z_en_torch.c index e3c3f73ae7..7c973a93cc 100644 --- a/src/overlays/actors/ovl_En_Torch/z_en_torch.c +++ b/src/overlays/actors/ovl_En_Torch/z_en_torch.c @@ -2,56 +2,37 @@ * File: z_en_torch.c * Overlay: ovl_En_Torch * Description: Spawns a chest with the appropriate contents then unloads. Used in grottos. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; } ActorEnTorch; // size = 0x014C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void Init(ActorEnTorch* this, GlobalContext* globalCtx); -const ActorInit En_Torch_InitVars = -{ - ACTOR_EN_TORCH, - ACTORTYPE_ITEMACTION, - ROOM, - FLAGS, - OBJECT_GAMEPLAY_KEEP, - sizeof(ActorEnTorch), - (ActorFunc)Init, - NULL, - NULL, - NULL +const ActorInit En_Torch_InitVars = { + ACTOR_EN_TORCH, ACTORTYPE_ITEMACTION, ROOM, FLAGS, OBJECT_GAMEPLAY_KEEP, + sizeof(ActorEnTorch), (ActorFunc)Init, NULL, NULL, NULL, }; static u8 sChestContents[] = { - GI_RUPEE_BLUE, - GI_RUPEE_RED, - GI_RUPEE_GOLD, - GI_BOMBS_20, - GI_BOMBS_1, - GI_BOMBS_1, - GI_BOMBS_1, - GI_BOMBS_1 - }; + GI_RUPEE_BLUE, GI_RUPEE_RED, GI_RUPEE_GOLD, GI_BOMBS_20, GI_BOMBS_1, GI_BOMBS_1, GI_BOMBS_1, GI_BOMBS_1, +}; -static void Init(ActorEnTorch* this, GlobalContext* globalCtx) -{ +static void Init(ActorEnTorch* this, GlobalContext* globalCtx) { s8 returnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data; /* Spawn chest with desired contents. Contents are passed to en_torch from grotto params via Save Context. */ - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, - this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, - 0, this->actor.shape.rot.y, 0, + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, this->actor.posRot.pos.x, this->actor.posRot.pos.y, + this->actor.posRot.pos.z, 0, this->actor.shape.rot.y, 0, (sChestContents[(returnData >> 0x5) & 0x7] << 0x5) | 0x5000 | (returnData & 0x1F)); Actor_Kill(&this->actor); 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 b7b44893b8..e5a3efb080 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -1,6 +1,6 @@ #include "z_en_torch2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000035 void EnTorch2_Init(EnTorch2* this, GlobalContext* globalCtx); @@ -40,4 +40,3 @@ const ActorInit En_Torch2_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/func_80B1F7D4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/EnTorch2_Draw.s") - diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index b532e71422..73be3384a9 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -1,6 +1,6 @@ #include "z_en_toryo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnToryo_Init(EnToryo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 24f149bd33..ff00b33425 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -1,6 +1,6 @@ #include "z_en_tp.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnTp_Init(EnTp* this, GlobalContext* globalCtx); 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 480ad6b869..4ebf99e331 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -1,6 +1,6 @@ #include "z_en_tr.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnTr_Init(EnTr* this, GlobalContext* globalCtx); 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 09c45fd277..648e2e186a 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -1,6 +1,6 @@ #include "z_en_trap.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnTrap_Init(EnTrap* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 26431fc665..20fa54640f 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -2,7 +2,7 @@ * File: z_en_tubo_trap.c * Overlay: ovl_En_Tubo_Trap * Description: Flying pot enemy -*/ + */ #include "z_en_tubo_trap.h" @@ -16,28 +16,16 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx); void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx); void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx); -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 -static ColliderCylinderInit cylinderInitData = -{ - 0x0A, 0x11, 0x09, 0x00, 0x20, 0x01, - 0x00, 0x00, - 0x00, - 0x00, 0x00, 0x00, - 0xFFCFFFFF, - 0x00, 0x04, - 0x00, 0x00, - 0xFFCFFFFF, - 0x00, 0x00, 0x00, 0x00, - 0x01, 0x01, 0x00, - 0x00, - 0x0009, 0x0017, 0x0000, - 0x0000, 0x0000, 0x0000 +static ColliderCylinderInit cylinderInitData = { + 0x0A, 0x11, 0x09, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xFFCFFFFF, 0x00, 0x04, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x00, 0x00, 0x0009, 0x0017, 0x0000, 0x0000, 0x0000, 0x0000, }; -const ActorInit En_Tubo_Trap_InitVars = -{ +const ActorInit En_Tubo_Trap_InitVars = { ACTOR_EN_TUBO_TRAP, ACTORTYPE_PROP, ROOM, @@ -53,8 +41,7 @@ const ActorInit En_Tubo_Trap_InitVars = extern UNK_TYPE D_05017A60; extern Gfx D_05017870[]; -void EnTuboTrap_Init(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_Init(EnTuboTrap* this, GlobalContext* globalCtx) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 2.0f); osSyncPrintf("\n\n"); @@ -65,26 +52,22 @@ void EnTuboTrap_Init(EnTuboTrap* this, GlobalContext* globalCtx) this->actionFunc = (ActorFunc)EnTuboTrap_WaitForProximity; } -void EnTuboTrap_Destroy(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_Destroy(EnTuboTrap* this, GlobalContext* globalCtx) { ColliderCylinderMain* collider = &this->collider; ActorCollider_FreeCylinder(globalCtx, collider); } -void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) { s16 params = this->actor.params; s16 param3FF = (params >> 6) & 0x3FF; - if (param3FF >= 0 && param3FF < 0x1A) - { + if (param3FF >= 0 && param3FF < 0x1A) { Item_DropCollectible(globalCtx, &this->actor.posRot, param3FF | ((params & 0x3F) << 8)); } } #ifdef NON_MATCHING // regalloc and stack usage differences, most likely the same differences as EnTuboTrap_SpawnWaterFragments -void EnTuboTrap_SpawnFragments(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_SpawnFragments(EnTuboTrap* this, GlobalContext* globalCtx) { Vec3f* actorPos; f32 rand; f32 cos; @@ -99,8 +82,7 @@ void EnTuboTrap_SpawnFragments(EnTuboTrap* this, GlobalContext* globalCtx) addr = &D_05017A60; actorPos = &this->actor.posRot.pos; - for (i = 0, var = 0; i < 15; i++, var += 20000) - { + for (i = 0, var = 0; i < 15; i++, var += 20000) { sin = Math_Sins(var); cos = Math_Coss(var); spC8.x = sin * 8.0f; @@ -135,8 +117,7 @@ void EnTuboTrap_SpawnFragments(EnTuboTrap* this, GlobalContext* globalCtx) #ifdef NON_MATCHING // regalloc and stack usage differences, most likely the same differences as EnTuboTrap_SpawnFragments -void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx) { Vec3f* actorPos; f32 rand; f32 cos; @@ -156,8 +137,7 @@ void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx) func_8002949C(globalCtx, &spC8, 0, 0, 0, 400); - for (i = 0, var = 0; i < 15; i++, var += 20000) - { + for (i = 0, var = 0; i < 15; i++, var += 20000) { sin = Math_Sins(var); cos = Math_Coss(var); spC8.x = sin * 8.0f; @@ -187,13 +167,11 @@ void EnTuboTrap_SpawnWaterFragments(EnTuboTrap* this, GlobalContext* globalCtx) #endif #ifdef NON_MATCHING -void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { s32 pad; Player* player = PLAYER; - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.unk_84 > 15.0f)) - { + if ((this->actor.bgCheckFlags & 0x20) && (this->actor.unk_84 > 15.0f)) { EnTuboTrap_SpawnWaterFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_BOMB_DROP_WATER); EnTuboTrap_DropCollectible(this, globalCtx); @@ -201,8 +179,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) return; } - if (this->collider.base.colliderFlags & 4) - { + if (this->collider.base.colliderFlags & 4) { this->collider.base.colliderFlags &= ~4; EnTuboTrap_SpawnFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); @@ -212,8 +189,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) return; } - if (this->collider.base.collideFlags & 2) - { + if (this->collider.base.collideFlags & 2) { this->collider.base.collideFlags &= ~2; EnTuboTrap_SpawnFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_EXPLOSION); @@ -223,11 +199,9 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) return; } - if (this->collider.base.colliderFlags & 2) - { + if (this->collider.base.colliderFlags & 2) { this->collider.base.colliderFlags &= ~2; - if (this->collider.base.at == &player->actor) - { + if (this->collider.base.at == &player->actor) { EnTuboTrap_SpawnFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN); Audio_PlaySoundAtPosition(globalCtx, &player->actor.posRot.pos, 40, 0x83E); @@ -237,8 +211,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) } } - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) - { + if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) { EnTuboTrap_SpawnFragments(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_POT_BROKEN); EnTuboTrap_DropCollectible(this, globalCtx); @@ -250,27 +223,25 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tubo_Trap/EnTuboTrap_HandleImpact.s") #endif -void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { Player* player = PLAYER; f32 targetHeight; - if (BREG(2) != 0) - { - osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ わて ☆☆☆☆☆ %f\n" VT_RST, this->actor.posRot.pos.y); // "You" + if (BREG(2) != 0) { + osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ わて ☆☆☆☆☆ %f\n" VT_RST, this->actor.posRot.pos.y); // "You" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ おいどん ☆☆☆☆☆ %f\n" VT_RST, player->actor.posRot.pos.y); // "Me" osSyncPrintf("\n\n"); } - if (this->actor.xzDistanceFromLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y) - { + if (this->actor.xzDistanceFromLink < 200.0f && this->actor.posRot.pos.y <= player->actor.posRot.pos.y) { Actor_ChangeType(globalCtx, &globalCtx->actorCtx, this, ACTORTYPE_ENEMY); this->actor.flags |= 1; targetHeight = 40.0f + -10.0f * gSaveContext.link_age; this->targetY = player->actor.posRot.pos.y + targetHeight; - if (this->targetY < this->actor.posRot.pos.y) + if (this->targetY < this->actor.posRot.pos.y) { this->targetY = this->actor.posRot.pos.y + targetHeight; + } this->originPos = this->actor.posRot.pos; Audio_PlayActorSound2(this, NA_SE_EV_POT_MOVE_START); @@ -278,36 +249,33 @@ void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) } } -void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) { this->actor.shape.rot.y += 5000; Math_SmoothScaleMaxF(&this->actor.posRot.pos.y, this->targetY, 0.8f, 3.0f); - if (fabsf(this->actor.posRot.pos.y - this->targetY) < 10.0f) - { + if (fabsf(this->actor.posRot.pos.y - this->targetY) < 10.0f) { this->actor.speedXZ = 10.0f; this->actor.posRot.rot.y = this->actor.rotTowardsLinkY; this->actionFunc = (ActorFunc)EnTuboTrap_Fly; } } -void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_Fly(EnTuboTrap* this, GlobalContext* globalCtx) { f32 dx = this->originPos.x - this->actor.posRot.pos.x; f32 dy = this->originPos.y - this->actor.posRot.pos.y; f32 dz = this->originPos.z - this->actor.posRot.pos.z; Audio_PlayActorSound2(&this->actor, 0x3037); - if (240.0f < sqrtf(SQ(dx) + SQ(dy) + SQ(dz))) + if (240.0f < sqrtf(SQ(dx) + SQ(dy) + SQ(dz))) { Math_SmoothScaleMaxF(&this->actor.gravity, -3.0f, 0.2f, 0.5f); + } this->actor.shape.rot.y += 5000; EnTuboTrap_HandleImpact(this, globalCtx); } -void EnTuboTrap_Update(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_Update(EnTuboTrap* this, GlobalContext* globalCtx) { EnTuboTrap* tuboTrap = this; SubGlobalContext11E60* sub_11E60 = &globalCtx->sub_11E60; @@ -320,7 +288,6 @@ void EnTuboTrap_Update(EnTuboTrap* this, GlobalContext* globalCtx) Actor_CollisionCheck_SetAT(globalCtx, sub_11E60, &tuboTrap->collider); } -void EnTuboTrap_Draw(EnTuboTrap* this, GlobalContext* globalCtx) -{ +void EnTuboTrap_Draw(EnTuboTrap* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, D_05017870); } 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 9a55707a3b..aabb4d5122 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -1,6 +1,6 @@ #include "z_en_vali.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00001015 void EnVali_Init(EnVali* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Vase/z_en_vase.c b/src/overlays/actors/ovl_En_Vase/z_en_vase.c index f5ccb7f14d..b59658505b 100644 --- a/src/overlays/actors/ovl_En_Vase/z_en_vase.c +++ b/src/overlays/actors/ovl_En_Vase/z_en_vase.c @@ -2,52 +2,41 @@ * File: z_en_vase.c * Overlay: ovl_En_Vase * Description: An unused, orange pot based on ALTTP. Lacks collision. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; } ActorEnVase; // size = 0x014C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void Init(ActorEnVase* this, GlobalContext* globalCtx); static void Destroy(ActorEnVase* this, GlobalContext* globalCtx); static void Draw(ActorEnVase* this, GlobalContext* globalCtx); -const ActorInit En_Vase_InitVars = -{ - ACTOR_EN_VASE, - ACTORTYPE_PROP, - ROOM, - FLAGS, - OBJECT_VASE, - sizeof(ActorEnVase), - (ActorFunc)Init, - (ActorFunc)Destroy, - (ActorFunc)Actor_Noop, - (ActorFunc)Draw +const ActorInit En_Vase_InitVars = { + ACTOR_EN_VASE, ACTORTYPE_PROP, ROOM, + FLAGS, OBJECT_VASE, sizeof(ActorEnVase), + (ActorFunc)Init, (ActorFunc)Destroy, (ActorFunc)Actor_Noop, + (ActorFunc)Draw, }; extern u32 DL_VASE; -static void Init(ActorEnVase* this, GlobalContext* globalCtx) -{ +static void Init(ActorEnVase* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.01f); this->actor.posRot2.pos = this->actor.posRot.pos; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 6.0f); } -static void Destroy(ActorEnVase* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorEnVase* this, GlobalContext* globalCtx) { } -static void Draw(ActorEnVase* this, GlobalContext* globalCtx) -{ +static void Draw(ActorEnVase* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &DL_VASE); } diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index c0f7c6a636..3dc05ae313 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -1,6 +1,6 @@ #include "z_en_vb_ball.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EnVbBall_Init(EnVbBall* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 961cc513e6..7f5a95a227 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -1,6 +1,6 @@ #include "z_en_viewer.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnViewer_Init(EnViewer* this, GlobalContext* globalCtx); @@ -70,4 +70,3 @@ const ActorInit En_Viewer_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Viewer/func_80B2C8AC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Viewer/func_80B2CC1C.s") - 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 63dca9ee7d..158afe4cb2 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -1,6 +1,6 @@ #include "z_en_vm.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000011 void EnVm_Init(EnVm* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index e7b284c307..c77b52a7b3 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -1,6 +1,6 @@ #include "z_en_wall_tubo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnWallTubo_Init(EnWallTubo* this, GlobalContext* globalCtx); 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 f1e89098fd..ffcb83d1b8 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -2,46 +2,45 @@ * File: z_en_wallmas * Overlay: En_Wallmas * Description: Wallmaster (Ceiling monster) -*/ + */ #include "z_en_wallmas.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 #define TIMER_SCALE 0.0062500000931322574615478515625f #define DEGREE_60_RAD 1.0471975803375244140625f #define DEGREE_15_RAD 0.261799395084381103515625f -#define DAMAGE_EFFECT_BURN 2 -#define DAMAGE_EFFECT_STUN_WHITE 4 -#define DAMAGE_EFFECT_STUN_BLUE 1 +#define DAMAGE_EFFECT_BURN 2 +#define DAMAGE_EFFECT_STUN_WHITE 4 +#define DAMAGE_EFFECT_STUN_BLUE 1 static void EnWallmas_Init(EnWallmas* this, GlobalContext* globalCtx); static void EnWallmas_Destroy(EnWallmas* this, GlobalContext* globalCtx); -static void EnWallmas_TimerInit(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_ProximityOrSwitchInit(EnWallmas *this); -static void EnWallmas_WaitToDrop(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_Drop(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_Land(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_Stand(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_JumpToCeiling(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_ReturnToCeiling(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_TakeDamage(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_DamageCoolDown(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_Die(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_TakePlayer(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_WaitForProximity(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_WaitForSwitchFlag(EnWallmas *this, GlobalContext *globalCtx); -static void EnWallmas_Stun(EnWallmas *this, GlobalContext *globalCtx); +static void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_ProximityOrSwitchInit(EnWallmas* this); +static void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_DamageCoolDown(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx); +static void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx); static void EnWallmas_Update(EnWallmas* this, GlobalContext* globalCtx); -static void EnWallmas_Walk(EnWallmas *this, GlobalContext *globalCtx); -static s32 EnWallMas_UpdatePos(GlobalContext *globalCtx, s32 arg1, s32 arg2, Actor *arg3, void *arg4, EnWallmas *arg5); -static void EnWallmas_DrawOpa(GlobalContext *globalCtx, s32 arg1, s32 arg2, s32 arg3); +static void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx); +static s32 EnWallMas_UpdatePos(GlobalContext* globalCtx, s32 arg1, s32 arg2, Actor* arg3, void* arg4, EnWallmas* arg5); +static void EnWallmas_DrawOpa(GlobalContext* globalCtx, s32 arg1, s32 arg2, s32 arg3); static void EnWallmas_Draw(EnWallmas* this, GlobalContext* globalCtx); -const ActorInit En_Wallmas_InitVars = -{ +const ActorInit En_Wallmas_InitVars = { ACTOR_EN_WALLMAS, ACTORTYPE_ENEMY, ROOM, @@ -54,167 +53,20 @@ const ActorInit En_Wallmas_InitVars = (ActorFunc)EnWallmas_Draw, }; -static ColliderCylinderInit colCylinderInit = -{ - { - 0x00, - 0x00, - 0x09, - 0x39, - 0x10, - 0x01, - { - 0x00, - 0x00, - }, - }, - { - 0x00, - { - 0x00, - 0x00, - 0x00, - }, - 0x00000000, - 0x00, - 0x00, - { - 0x00, - 0x00, - }, - 0xFFCFFFFF, - { - 0x00, - 0x00, - 0x00, - 0x00 - }, - 0x00, - 0x01, - 0x01, - 0x00, - }, - { - 0x001E, - 0x0028, - 0x0000, - { - 0x0000, - 0x0000, - 0x0000, - }, - }, +static ColliderCylinderInit colCylinderInit = { + 0x00, 0x00, 0x09, 0x39, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0xFFCFFFFF, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x001E, 0x0028, 0x0000, 0x0000, 0x0000, 0x0000, }; -static SubActor98Init subActor98Init = -{ - 0x04, - 0x001E, - 0x0028, - 0x96, -}; +static SubActor98Init subActor98Init = { 0x04, 0x001E, 0x0028, 0x96 }; -static ActorDamageChart damageChart = -{ - { - { - 0x1, 0x0, - }, - { - 0x0, 0x2, - }, - { - 0x0, 0x1, - }, - { - 0x0, 0x2, - }, - { - 0x1, 0x0, - }, - { - 0x0, 0x2, - }, - { - 0x0, 0x2, - }, - { - 0x1, 0x0, - }, - { - 0x0, 0x1, - }, - { - 0x0, 0x2, - }, - { - 0x0, 0x4, - }, - { - 0x2, 0x4, - }, - { - 0x0, 0x2, - }, - { - 0x4, 0x4, - }, - { - 0x0, 0x4, - }, - { - 0x0, 0x2, - }, - { - 0x0, 0x2, - }, - { - 0x2, 0x4, - }, - { - 0x0, 0x0, - }, - { - 0x4, 0x4, - }, - { - 0x0, 0x0, - }, - { - 0x0, 0x0, - }, - { - 0x0, 0x1, - }, - { - 0x0, 0x4, - }, - { - 0x0, 0x2, - }, - { - 0x0, 0x2, - }, - { - 0x0, 0x8, - }, - { - 0x0, 0x4, - }, - { - 0x0, 0x0, - }, - { - 0x0, 0x0, - }, - { - 0x0, 0x4, - }, - { - 0x0, 0x0, - }, - } -}; +static ActorDamageChart damageChart = { { + { 0x1, 0x0 }, { 0x0, 0x2 }, { 0x0, 0x1 }, { 0x0, 0x2 }, { 0x1, 0x0 }, { 0x0, 0x2 }, { 0x0, 0x2 }, { 0x1, 0x0 }, + { 0x0, 0x1 }, { 0x0, 0x2 }, { 0x0, 0x4 }, { 0x2, 0x4 }, { 0x0, 0x2 }, { 0x4, 0x4 }, { 0x0, 0x4 }, { 0x0, 0x2 }, + { 0x0, 0x2 }, { 0x2, 0x4 }, { 0x0, 0x0 }, { 0x4, 0x4 }, { 0x0, 0x0 }, { 0x0, 0x0 }, { 0x0, 0x1 }, { 0x0, 0x4 }, + { 0x0, 0x2 }, { 0x0, 0x2 }, { 0x0, 0x8 }, { 0x0, 0x4 }, { 0x0, 0x0 }, { 0x0, 0x0 }, { 0x0, 0x4 }, { 0x0, 0x0 }, +} }; static InitChainEntry initChain[3] = { ICHAIN_S8(naviEnemyId, 0x30, 1), @@ -222,10 +74,7 @@ static InitChainEntry initChain[3] = { ICHAIN_F32_DIV1000(gravity, 0xFA24, 0), }; -static Vec3f D_80B30D70 = -{ - 0.0f, 0.0f, 0.0f, -}; +static Vec3f D_80B30D70 = { 0.0f, 0.0f, 0.0f }; extern u32 D_06000EA4; extern u32 D_06000590; @@ -240,14 +89,12 @@ extern u32 D_0600A054; extern u32 D_06008688; extern u32 D_04049210; -static void EnWallmas_Init(EnWallmas *this, GlobalContext *globalCtx) -{ - EnWallmas *this2 = this; +static void EnWallmas_Init(EnWallmas* this, GlobalContext* globalCtx) { + EnWallmas* this2 = this; Actor_ProcessInitChain(&this->actor, initChain); ActorShape_Init(&this->actor.shape, 0, NULL, 0.5f); - func_800A46F8(globalCtx, &this->skelAnime, &D_06008FB0, - &D_06009DB0, &this->unkSkelAnimeStruct, &this->unk_22e, + func_800A46F8(globalCtx, &this->skelAnime, &D_06008FB0, &D_06009DB0, &this->unkSkelAnimeStruct, &this->unk_22e, 0x19); ActorCollider_AllocCylinder(globalCtx, &this->colCylinder); @@ -256,35 +103,27 @@ static void EnWallmas_Init(EnWallmas *this, GlobalContext *globalCtx) this2->switchFlag = (u8)(this2->actor.params >> 0x8); this->actor.params = this->actor.params & 0xFF; - if (this->actor.params == WMT_FLAG) - { - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) - { + if (this->actor.params == WMT_FLAG) { + if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { Actor_Kill(&this->actor); return; } EnWallmas_ProximityOrSwitchInit(this); - } - else if (this->actor.params == WMT_PROXIMITY) - { + } else if (this->actor.params == WMT_PROXIMITY) { EnWallmas_ProximityOrSwitchInit(this); - } - else - { + } else { EnWallmas_TimerInit(this, globalCtx); } } -static void EnWallmas_Destroy(EnWallmas *this, GlobalContext *globalCtx) -{ - ColliderCylinderMain *col = &this->colCylinder; +static void EnWallmas_Destroy(EnWallmas* this, GlobalContext* globalCtx) { + ColliderCylinderMain* col = &this->colCylinder; ActorCollider_FreeCylinder(globalCtx, col); } -static void EnWallmas_TimerInit(EnWallmas *this, GlobalContext *globalCtx) -{ - Player *player = PLAYER; +static void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { + Player* player = PLAYER; this->actor.flags &= ~1; this->actor.flags |= 0x20; @@ -296,14 +135,12 @@ static void EnWallmas_TimerInit(EnWallmas *this, GlobalContext *globalCtx) this->actionFunc = (ActorFunc)&EnWallmas_WaitToDrop; } -static void EnWallmas_DropStart(EnWallmas *this, GlobalContext *globalCtx) -{ - Player *player = PLAYER; - u32 *objSegChangeAnime = &D_0600299C; +static void EnWallmas_DropStart(EnWallmas* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + u32* objSegChangeAnime = &D_0600299C; - SkelAnime_ChangeAnimation(&this->skelAnime, objSegChangeAnime, 0.0f, - 20.0f, (f32) SkelAnime_GetFrameCount(&D_0600299C), - 2, 0.0f); + SkelAnime_ChangeAnimation(&this->skelAnime, objSegChangeAnime, 0.0f, 20.0f, + (f32)SkelAnime_GetFrameCount(&D_0600299C), 2, 0.0f); this->unk_2c4 = player->actor.posRot.pos.y; this->actor.posRot.pos.y = player->actor.posRot.pos.y + 300.0f; @@ -314,63 +151,52 @@ static void EnWallmas_DropStart(EnWallmas *this, GlobalContext *globalCtx) this->actionFunc = (ActorFunc)&EnWallmas_Drop; } -static void EnWallmas_LandStart(EnWallmas *this, GlobalContext *globalCtx) -{ - u32 *objSegFrameCount = &D_060019CC; - u32 *objSegChangeAnime = &D_060019CC; +static void EnWallmas_LandStart(EnWallmas* this, GlobalContext* globalCtx) { + u32* objSegFrameCount = &D_060019CC; + u32* objSegChangeAnime = &D_060019CC; - SkelAnime_ChangeAnimation(&this->skelAnime, objSegChangeAnime, 1.0f, - 41.0f, SkelAnime_GetFrameCount(objSegFrameCount), - 2, -3.0f); + SkelAnime_ChangeAnimation(&this->skelAnime, objSegChangeAnime, 1.0f, 41.0f, + SkelAnime_GetFrameCount(objSegFrameCount), 2, -3.0f); func_80033260(globalCtx, &this->actor, &this->actor.posRot.pos, 15.0f, 6, 20.0f, 0x12C, 0x64, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_LAND); this->actionFunc = (ActorFunc)&EnWallmas_Land; } -static void EnWallmas_StandStart(EnWallmas *this) -{ +static void EnWallmas_StandStart(EnWallmas* this) { func_800A51E8(&this->skelAnime, &D_0600A054); this->actionFunc = (ActorFunc)&EnWallmas_Stand; } -static void EnWallmas_WalkStart(EnWallmas *this) -{ +static void EnWallmas_WalkStart(EnWallmas* this) { func_800A529C(&this->skelAnime, &D_060041F4, 3.0f, &this->actor); this->actionFunc = (ActorFunc)&EnWallmas_Walk; this->actor.speedXZ = 3.0f; } -static void EnWallmas_JumpToCeilingStart(EnWallmas *this) -{ +static void EnWallmas_JumpToCeilingStart(EnWallmas* this) { func_800A51E8(&this->skelAnime, &D_06009244); this->actionFunc = (ActorFunc)&EnWallmas_JumpToCeiling; this->actor.speedXZ = 0.0f; } -static void EnWallmas_ReturnToCeilingStart(EnWallmas *this) -{ - u32 *objSegFrameCount = &D_060019CC; - u32 *objSegChangeAnime = &D_060019CC; +static void EnWallmas_ReturnToCeilingStart(EnWallmas* this) { + u32* objSegFrameCount = &D_060019CC; + u32* objSegChangeAnime = &D_060019CC; this->timer = 0; this->actor.speedXZ = 0.0f; - SkelAnime_ChangeAnimation(&this->skelAnime, objSegChangeAnime, 3.0f, - 0.0f, (f32) SkelAnime_GetFrameCount(objSegFrameCount), - 2, -3.0f); + SkelAnime_ChangeAnimation(&this->skelAnime, objSegChangeAnime, 3.0f, 0.0f, + (f32)SkelAnime_GetFrameCount(objSegFrameCount), 2, -3.0f); this->actionFunc = (ActorFunc)&EnWallmas_ReturnToCeiling; } -static void EnWallmas_TakeDamageStart(EnWallmas *this) -{ +static void EnWallmas_TakeDamageStart(EnWallmas* this) { func_800A5240(&this->skelAnime, &D_06000590, -3.0f); - if ((this->colCylinder.body.colliding->toucher.flags & 0x1F824) != 0) - { + if ((this->colCylinder.body.colliding->toucher.flags & 0x1F824) != 0) { this->actor.posRot.rot.y = this->colCylinder.base.ac->posRot.rot.y; - } - else - { + } else { this->actor.posRot.rot.y = func_8002DA78(&this->actor, this->colCylinder.base.ac) + 0x8000; } @@ -380,8 +206,7 @@ static void EnWallmas_TakeDamageStart(EnWallmas *this) this->actor.velocity.y = 10.0f; } -static void EnWallmas_DamageCoolDownStart(EnWallmas *this) -{ +static void EnWallmas_DamageCoolDownStart(EnWallmas* this) { func_800A51E8(&this->skelAnime, &D_06000EA4); this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; @@ -389,21 +214,18 @@ static void EnWallmas_DamageCoolDownStart(EnWallmas *this) this->actionFunc = (ActorFunc)&EnWallmas_DamageCoolDown; } -static void EnWallMas_DieBegin(EnWallmas *this, GlobalContext *globalCtx) -{ +static void EnWallMas_DieBegin(EnWallmas* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - func_8002A6B8(globalCtx, &this->actor.posRot.pos, &D_80B30D70, - &D_80B30D70, 0xFA, -0xA, 0xFF, 0xFF, 0xFF, 0xFF, - 0, 0, 0xFF, 1, 9, 1); + func_8002A6B8(globalCtx, &this->actor.posRot.pos, &D_80B30D70, &D_80B30D70, 0xFA, -0xA, 0xFF, 0xFF, 0xFF, 0xFF, 0, + 0, 0xFF, 1, 9, 1); Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.posRot.pos, 0xC0); this->actionFunc = (ActorFunc)&EnWallmas_Die; } -static void EnWallmas_TakePlayerBegin(EnWallmas *this, GlobalContext *globalCtx) -{ +static void EnWallmas_TakePlayerBegin(EnWallmas* this, GlobalContext* globalCtx) { func_800A5240(&this->skelAnime, &D_06009520, -5.0f); this->timer = -0x1e; this->actionFunc = (ActorFunc)&EnWallmas_TakePlayer; @@ -415,33 +237,24 @@ static void EnWallmas_TakePlayerBegin(EnWallmas *this, GlobalContext *globalCtx) func_800800F8(globalCtx, 0x251C, 0x270F, &this->actor, 0); } -static void EnWallmas_ProximityOrSwitchInit(EnWallmas *this) -{ +static void EnWallmas_ProximityOrSwitchInit(EnWallmas* this) { this->timer = 0; this->actor.draw = NULL; this->actor.flags = this->actor.flags & ~1; - if (this->actor.params == WMT_PROXIMITY) - { + if (this->actor.params == WMT_PROXIMITY) { this->actionFunc = (ActorFunc)&EnWallmas_WaitForProximity; - } - else - { + } else { this->actionFunc = (ActorFunc)&EnWallmas_WaitForSwitchFlag; } } -static void EnWallmas_StunBegin(EnWallmas *this) -{ - SkelAnime_ChangeAnimation(&this->skelAnime, &D_060019CC, 1.5f, 0, - 20.0f, 2, -3.0f); +static void EnWallmas_StunBegin(EnWallmas* this) { + SkelAnime_ChangeAnimation(&this->skelAnime, &D_060019CC, 1.5f, 0, 20.0f, 2, -3.0f); this->actor.speedXZ = 0.0f; - if (this->actor.sub_98.damageEffect == 4) - { + if (this->actor.sub_98.damageEffect == 4) { func_8003426C(&this->actor, -0x8000, 0xFF, 0, 0x50); - } - else - { + } else { func_8003426C(&this->actor, 0, 0xFF, 0, 0x50); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); } @@ -450,10 +263,9 @@ static void EnWallmas_StunBegin(EnWallmas *this) this->actionFunc = (ActorFunc)&EnWallmas_Stun; } -static void EnWallmas_WaitToDrop(EnWallmas *this, GlobalContext *globalCtx) -{ - Vec3f *playerPos; - Player *player; +static void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { + Vec3f* playerPos; + Player* player; player = PLAYER; playerPos = &player->actor.posRot.pos; @@ -461,159 +273,119 @@ static void EnWallmas_WaitToDrop(EnWallmas *this, GlobalContext *globalCtx) this->actor.unk_80 = player->actor.unk_80; this->actor.floorPoly = player->actor.floorPoly; - if (this->timer != 0) - { + if (this->timer != 0) { this->timer--; } - if (((s32)(player->stateFlags1 << 0xB) < 0) - || ((s32)(player->stateFlags1 << 4) < 0) - || ((player->actor.bgCheckFlags & 1) == 0) - || ((this->actor.params == 1) && (320.0f < Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, playerPos)))) - { + if (((s32)(player->stateFlags1 << 0xB) < 0) || ((s32)(player->stateFlags1 << 4) < 0) || + ((player->actor.bgCheckFlags & 1) == 0) || + ((this->actor.params == 1) && (320.0f < Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, playerPos)))) { func_800F8D04(NA_SE_EN_FALL_AIM); this->timer = 0x82; } - if (this->timer == 0x50) - { + if (this->timer == 0x50) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_AIM); } - if (this->timer == 0) - { + if (this->timer == 0) { EnWallmas_DropStart(this, globalCtx); } } -static void EnWallmas_Drop(EnWallmas *this, GlobalContext *globalCtx) -{ - Player *player = PLAYER; - if ((func_8008E988(globalCtx) == 0) && - (player->stateFlags2 & 0x10) == 0 && - (player->unk_A78 >= 0) && - (this->actor.xzDistanceFromLink < 30.0f) && - (this->actor.yDistanceFromLink < -5.0f) && - (-(f32)(player->unk_4DA + 0xA) < this->actor.yDistanceFromLink)) - { +static void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + if ((func_8008E988(globalCtx) == 0) && (player->stateFlags2 & 0x10) == 0 && (player->unk_A78 >= 0) && + (this->actor.xzDistanceFromLink < 30.0f) && (this->actor.yDistanceFromLink < -5.0f) && + (-(f32)(player->unk_4DA + 0xA) < this->actor.yDistanceFromLink)) { EnWallmas_TakePlayerBegin(this, globalCtx); } } -static void EnWallmas_Land(EnWallmas *this, GlobalContext *globalCtx) -{ - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { +static void EnWallmas_Land(EnWallmas* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { EnWallmas_StandStart(this); } } -static void EnWallmas_Stand(EnWallmas *this, GlobalContext *globalCtx) -{ - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { +static void EnWallmas_Stand(EnWallmas* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { EnWallmas_WalkStart(this); } Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, this->actor.rotTowardsLinkY + 0x8000, 0xB6); } -static void EnWallmas_Walk(EnWallmas *this, GlobalContext *globalCtx) -{ - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { +static void EnWallmas_Walk(EnWallmas* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { EnWallmas_JumpToCeilingStart(this); } - Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, - (s16)((s32)this->actor.rotTowardsLinkY + 0x8000), - 0xB6); + Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, (s16)((s32)this->actor.rotTowardsLinkY + 0x8000), 0xB6); - if ((func_800A56C8(&this->skelAnime, 0.0f) != 0) || - (func_800A56C8(&this->skelAnime, 12.0f) != 0) || - (func_800A56C8(&this->skelAnime, 24.0f) != 0) || - (func_800A56C8(&this->skelAnime, 36.0f) != 0)) - { + if ((func_800A56C8(&this->skelAnime, 0.0f) != 0) || (func_800A56C8(&this->skelAnime, 12.0f) != 0) || + (func_800A56C8(&this->skelAnime, 24.0f) != 0) || (func_800A56C8(&this->skelAnime, 36.0f) != 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_WALK); } } -static void EnWallmas_JumpToCeiling(EnWallmas *this, GlobalContext *globalCtx) -{ - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { +static void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { EnWallmas_ReturnToCeilingStart(this); } } -static void EnWallmas_ReturnToCeiling(EnWallmas *this, GlobalContext *globalCtx) -{ - Player *player = PLAYER; +static void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { + Player* player = PLAYER; SkelAnime_FrameUpdateMatrix(&this->skelAnime); - if (this->skelAnime.animCurrentFrame > 20.0f) - { + if (this->skelAnime.animCurrentFrame > 20.0f) { this->timer += 9; this->actor.posRot.pos.y = this->actor.posRot.pos.y + 30.0f; } - if (func_800A56C8(&this->skelAnime, 20.0f) != 0) - { + if (func_800A56C8(&this->skelAnime, 20.0f) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_UP); } - if (this->actor.yDistanceFromLink < -900.0f) - { - if (this->actor.params == WMT_FLAG) - { + if (this->actor.yDistanceFromLink < -900.0f) { + if (this->actor.params == WMT_FLAG) { Actor_Kill(&this->actor); return; } - if (this->actor.params == WMT_TIMER || Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos) < 200.0f) - { + if (this->actor.params == WMT_TIMER || + Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos) < 200.0f) { EnWallmas_TimerInit(this, globalCtx); return; - } - else - { + } else { EnWallmas_ProximityOrSwitchInit(this); } } } -static void EnWallmas_TakeDamage(EnWallmas *this, GlobalContext *globalCtx) -{ - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { - if (this->actor.sub_98.health == 0) - { +static void EnWallmas_TakeDamage(EnWallmas* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { + if (this->actor.sub_98.health == 0) { EnWallMas_DieBegin(this, globalCtx); - } - else - { + } else { EnWallmas_DamageCoolDownStart(this); } } - if (func_800A56C8(&this->skelAnime, 13.0f) != 0) - { + if (func_800A56C8(&this->skelAnime, 13.0f) != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } Math_ApproxF(&this->actor.speedXZ, 0.0f, 0.2f); } -static void EnWallmas_DamageCoolDown(EnWallmas *this, GlobalContext *globalCtx) -{ - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { +static void EnWallmas_DamageCoolDown(EnWallmas* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { EnWallmas_ReturnToCeilingStart(this); } } -static void EnWallmas_Die(EnWallmas *this, GlobalContext *globalCtx) -{ - if (Math_ApproxF(&this->actor.scale.x, 0.0f, 0.0015) != 0) - { +static void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx) { + if (Math_ApproxF(&this->actor.scale.x, 0.0f, 0.0015) != 0) { Actor_SetScale(&this->actor, 0.01f); Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.posRot.pos, 0xC0); Actor_Kill(&this->actor); @@ -622,153 +394,112 @@ static void EnWallmas_Die(EnWallmas *this, GlobalContext *globalCtx) this->actor.scale.y = this->actor.scale.x; } -static void EnWallmas_TakePlayer(EnWallmas *this, GlobalContext *globalCtx) -{ - Player *player; +static void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { + Player* player; player = PLAYER; - if (func_800A56C8(&this->skelAnime, 1.0f) != 0) - { - if (LINK_IS_CHILD) - { + if (func_800A56C8(&this->skelAnime, 1.0f) != 0) { + if (LINK_IS_CHILD) { func_8002F7DC(&this->actor, NA_SE_VO_LI_DAMAGE_S_KID); - } - else - { + } else { func_8002F7DC(&this->actor, NA_SE_VO_LI_DAMAGE_S); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_CATCH); } - if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) - { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) { player->actor.posRot.pos.x = this->actor.posRot.pos.x; player->actor.posRot.pos.z = this->actor.posRot.pos.z; - if (this->timer < 0) - { + if (this->timer < 0) { this->actor.posRot.pos.y = this->actor.posRot.pos.y + 2.0f; - } - else - { + } else { this->actor.posRot.pos.y = this->actor.posRot.pos.y + 10.0f; } - if (gSaveContext.link_age != 0) - { + if (gSaveContext.link_age != 0) { player->actor.posRot.pos.y = this->actor.posRot.pos.y - 30.0f; - } - else - { + } else { player->actor.posRot.pos.y = this->actor.posRot.pos.y - 50.0f; } - if (this->timer == -0x1E) - { - if (gSaveContext.link_age != 0) - { + if (this->timer == -0x1E) { + if (gSaveContext.link_age != 0) { func_8002F7DC(&this->actor, NA_SE_VO_LI_TAKEN_AWAY_KID); - } - else - { + } else { func_8002F7DC(&this->actor, NA_SE_VO_LI_TAKEN_AWAY); } } - if (this->timer == 0) - { + if (this->timer == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_UP); } this->timer = this->timer + 2; - } - else - { - Math_ApproxF(&this->actor.posRot.pos.y, player->actor.posRot.pos.y + (gSaveContext.link_age != 0 ? 30.0f : 50.0f) , 5.0f); + } else { + Math_ApproxF(&this->actor.posRot.pos.y, + player->actor.posRot.pos.y + (gSaveContext.link_age != 0 ? 30.0f : 50.0f), 5.0f); } Math_ApproxF(&this->actor.posRot.pos.x, player->actor.posRot.pos.x, 3.0f); Math_ApproxF(&this->actor.posRot.pos.z, player->actor.posRot.pos.z, 3.0f); - if (this->timer == 0x1E) - { + if (this->timer == 0x1E) { func_80078884(NA_SE_OC_ABYSS); func_800C0C88(globalCtx); } } -static void EnWallmas_WaitForProximity(EnWallmas *this, GlobalContext *globalCtx) -{ - Player *player = PLAYER; - if (Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos) < 200.0f) - { +static void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + if (Math_Vec3f_DistXZ(&this->actor.initPosRot.pos, &player->actor.posRot.pos) < 200.0f) { EnWallmas_TimerInit(this, globalCtx); } } -static void EnWallmas_WaitForSwitchFlag(EnWallmas *this, GlobalContext *globalCtx) -{ - if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) - { +static void EnWallmas_WaitForSwitchFlag(EnWallmas* this, GlobalContext* globalCtx) { + if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) { EnWallmas_TimerInit(this, globalCtx); this->timer = 0x51; } } -static void EnWallmas_Stun(EnWallmas *this, GlobalContext *globalCtx) -{ +static void EnWallmas_Stun(EnWallmas* this, GlobalContext* globalCtx) { SkelAnime_FrameUpdateMatrix(&this->skelAnime); - if (this->timer != 0) - { + if (this->timer != 0) { this->timer--; } - if (this->timer == 0) - { - if (this->actor.sub_98.health == 0) - { + if (this->timer == 0) { + if (this->actor.sub_98.health == 0) { EnWallMas_DieBegin(this, globalCtx); - } - else - { + } else { EnWallmas_ReturnToCeilingStart(this); } } } -static void EnWallmas_ColUpdate(EnWallmas *this, GlobalContext *globalCtx) -{ - if ((this->colCylinder.base.collideFlags & 2) != 0) - { +static void EnWallmas_ColUpdate(EnWallmas* this, GlobalContext* globalCtx) { + if ((this->colCylinder.base.collideFlags & 2) != 0) { this->colCylinder.base.collideFlags &= ~2; func_80035650(&this->actor, &this->colCylinder.body, 1); - if ((this->actor.sub_98.damageEffect != 0) || (this->actor.sub_98.damage != 0)) - { - if (Actor_ApplyDamage(&this->actor) == 0) - { + if ((this->actor.sub_98.damageEffect != 0) || (this->actor.sub_98.damage != 0)) { + if (Actor_ApplyDamage(&this->actor) == 0) { func_80032C7C(globalCtx, &this->actor); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DEAD); this->actor.flags &= ~1; - } - else - { - if (this->actor.sub_98.damage != 0) - { + } else { + if (this->actor.sub_98.damage != 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FALL_DAMAGE); } } if ((this->actor.sub_98.damageEffect == DAMAGE_EFFECT_STUN_WHITE) || - (this->actor.sub_98.damageEffect == DAMAGE_EFFECT_STUN_BLUE)) - { - if (this->actionFunc != (ActorFunc)&EnWallmas_Stun) - { + (this->actor.sub_98.damageEffect == DAMAGE_EFFECT_STUN_BLUE)) { + if (this->actionFunc != (ActorFunc)&EnWallmas_Stun) { EnWallmas_StunBegin(this); } - } - else - { - if (this->actor.sub_98.damageEffect == DAMAGE_EFFECT_BURN) - { + } else { + if (this->actor.sub_98.damageEffect == DAMAGE_EFFECT_BURN) { func_8002A65C(globalCtx, &this->actor, &this->actor.posRot.pos, 0x28, 0x28); } @@ -778,9 +509,8 @@ static void EnWallmas_ColUpdate(EnWallmas *this, GlobalContext *globalCtx) } } -static void EnWallmas_Update(EnWallmas *this, GlobalContext *globalCtx) -{ - EnWallmas *this2 = this; +static void EnWallmas_Update(EnWallmas* this, GlobalContext* globalCtx) { + EnWallmas* this2 = this; char pad[4]; EnWallmas_ColUpdate(this2, globalCtx); @@ -789,63 +519,51 @@ static void EnWallmas_Update(EnWallmas *this, GlobalContext *globalCtx) if ((this2->actionFunc == (ActorFunc)&EnWallmas_WaitToDrop) || (this2->actionFunc == (ActorFunc)&EnWallmas_WaitForProximity) || (this2->actionFunc == (ActorFunc)&EnWallmas_TakePlayer) || - (this2->actionFunc == (ActorFunc)&EnWallmas_WaitForSwitchFlag)) - { + (this2->actionFunc == (ActorFunc)&EnWallmas_WaitForSwitchFlag)) { return; } if ((this2->actionFunc != (ActorFunc)&EnWallmas_ReturnToCeiling) && - (this2->actionFunc != (ActorFunc)&EnWallmas_TakePlayer)) - { + (this2->actionFunc != (ActorFunc)&EnWallmas_TakePlayer)) { Actor_MoveForward(&this->actor); } - if (this2->actionFunc != (ActorFunc)&EnWallmas_Drop) - { + if (this2->actionFunc != (ActorFunc)&EnWallmas_Drop) { func_8002E4B4(globalCtx, &this2->actor, 20.0f, 25.0f, 0.0f, 0x1D); - } - else if (this2->actor.posRot.pos.y <= this2->unk_2c4) - { + } else if (this2->actor.posRot.pos.y <= this2->unk_2c4) { this2->actor.posRot.pos.y = this2->unk_2c4; this2->actor.velocity.y = 0.0f; EnWallmas_LandStart(this2, globalCtx); } - if ((this2->actionFunc != (ActorFunc)&EnWallmas_Die) && - (this2->actionFunc != (ActorFunc)&EnWallmas_Drop)) - { + if ((this2->actionFunc != (ActorFunc)&EnWallmas_Die) && (this2->actionFunc != (ActorFunc)&EnWallmas_Drop)) { ActorCollider_Cylinder_Update(&this2->actor, &this2->colCylinder); Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this2->colCylinder); - if ((this2->actionFunc != (ActorFunc)&EnWallmas_TakeDamage) && - (this2->actor.bgCheckFlags & 1) != 0 && - (this2->actor.freeze == 0)) - { + if ((this2->actionFunc != (ActorFunc)&EnWallmas_TakeDamage) && (this2->actor.bgCheckFlags & 1) != 0 && + (this2->actor.freeze == 0)) { Actor_CollisionCheck_SetAC(globalCtx, &globalCtx->sub_11E60, &this2->colCylinder); } } Actor_SetHeight(&this2->actor, 25.0f); - if (this->actionFunc == (ActorFunc)&EnWallmas_TakeDamage) - { + if (this->actionFunc == (ActorFunc)&EnWallmas_TakeDamage) { return; } this2->actor.shape.rot.y = this2->actor.posRot.rot.y; } -static void EnWallmas_DrawXlu(EnWallmas *this, GlobalContext *globalCtx) -{ +static void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { char pad[8]; MtxF mf; - GraphicsContext *gfxCtx; + GraphicsContext* gfxCtx; f32 xzScale; - Gfx *gfx[3]; + Gfx* gfx[3]; if ((this->actor.floorPoly == NULL) || - ((this->timer >= 0x51) && (this->actionFunc != (ActorFunc)&EnWallmas_Stun))) - { + ((this->timer >= 0x51) && (this->actionFunc != (ActorFunc)&EnWallmas_Stun))) { return; } @@ -859,13 +577,12 @@ static void EnWallmas_DrawXlu(EnWallmas *this, GlobalContext *globalCtx) func_80038A28(this->actor.floorPoly, this->actor.posRot.pos.x, this->actor.unk_80, this->actor.posRot.pos.z, &mf); Matrix_Mult(&mf, MTXMODE_NEW); - if ((this->actionFunc != (ActorFunc)EnWallmas_WaitToDrop) && (this->actionFunc != (ActorFunc)EnWallmas_ReturnToCeiling) && - (this->actionFunc != (ActorFunc)EnWallmas_TakePlayer) && (this->actionFunc != (ActorFunc)EnWallmas_WaitForSwitchFlag)) - { + if ((this->actionFunc != (ActorFunc)EnWallmas_WaitToDrop) && + (this->actionFunc != (ActorFunc)EnWallmas_ReturnToCeiling) && + (this->actionFunc != (ActorFunc)EnWallmas_TakePlayer) && + (this->actionFunc != (ActorFunc)EnWallmas_WaitForSwitchFlag)) { xzScale = this->actor.scale.x * 50.0f; - } - else - { + } else { xzScale = ((0x50 - this->timer) >= 0x51 ? 0x50 : (0x50 - this->timer)) * TIMER_SCALE; } @@ -875,29 +592,24 @@ static void EnWallmas_DrawXlu(EnWallmas *this, GlobalContext *globalCtx) func_800C6B54(gfx, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1426); } -static s32 EnWallMas_UpdatePos(GlobalContext *globalCtx, s32 arg1, s32 arg2, Actor *arg3, void *arg4, EnWallmas *arg5) -{ - if (arg1 == 1) - { - if (arg5->actionFunc != (ActorFunc)EnWallmas_TakePlayer) - { +static s32 EnWallMas_UpdatePos(GlobalContext* globalCtx, s32 arg1, s32 arg2, Actor* arg3, void* arg4, EnWallmas* arg5) { + if (arg1 == 1) { + if (arg5->actionFunc != (ActorFunc)EnWallmas_TakePlayer) { arg3->initPosRot.pos.x = arg3->initPosRot.pos.x - 1600.0f; - } - else - { - arg3->initPosRot.pos.x = arg3->initPosRot.pos.x - ((1600.0f * (arg5->skelAnime.animFrameCount - arg5->skelAnime.animCurrentFrame)) / arg5->skelAnime.animFrameCount); + } else { + arg3->initPosRot.pos.x = arg3->initPosRot.pos.x - + ((1600.0f * (arg5->skelAnime.animFrameCount - arg5->skelAnime.animCurrentFrame)) / + arg5->skelAnime.animFrameCount); } } return 0; } -static void EnWallmas_DrawOpa(GlobalContext *globalCtx, s32 arg1, s32 arg2, s32 arg3) -{ - GraphicsContext *gfxCtx; - Gfx *gfx[4]; +static void EnWallmas_DrawOpa(GlobalContext* globalCtx, s32 arg1, s32 arg2, s32 arg3) { + GraphicsContext* gfxCtx; + Gfx* gfx[4]; - if (arg1 == 2) - { + if (arg1 == 2) { gfxCtx = globalCtx->state.gfxCtx; func_800C6AC4(&gfx, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1478); @@ -915,13 +627,12 @@ static void EnWallmas_DrawOpa(GlobalContext *globalCtx, s32 arg1, s32 arg2, s32 } } -static void EnWallmas_Draw(EnWallmas *this, GlobalContext *globalCtx) -{ - if (this->actionFunc != (ActorFunc)&EnWallmas_WaitToDrop) - { +static void EnWallmas_Draw(EnWallmas* this, GlobalContext* globalCtx) { + if (this->actionFunc != (ActorFunc)&EnWallmas_WaitToDrop) { func_80093D18(globalCtx->state.gfxCtx); - func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, &EnWallMas_UpdatePos, &EnWallmas_DrawOpa, &this->actor); + func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl, this->skelAnime.dListCount, + &EnWallMas_UpdatePos, &EnWallmas_DrawOpa, &this->actor); } EnWallmas_DrawXlu(this, globalCtx); -} \ No newline at end of file +} diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index ebe2a89f64..36a6f836e4 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -1,6 +1,6 @@ #include "z_en_weather_tag.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnWeatherTag_Init(EnWeatherTag* this, GlobalContext* globalCtx); 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 c6c0100083..41b2fa0620 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -1,6 +1,6 @@ #include "z_en_weiyer.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000005 void EnWeiyer_Init(EnWeiyer* this, GlobalContext* globalCtx); 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 a4ab4557ab..935ba04d21 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -1,6 +1,6 @@ #include "z_en_wf.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnWf_Init(EnWf* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index 45a8b18a1b..207907bc0f 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -1,6 +1,6 @@ #include "z_en_wonder_item.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnWonderItem_Init(EnWonderItem* this, GlobalContext* globalCtx); @@ -43,4 +43,3 @@ const ActorInit En_Wonder_Item_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/func_80B38B78.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wonder_Item/EnWonderItem_Update.s") - diff --git a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c index b87c21866f..ccb0fed444 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk/z_en_wonder_talk.c @@ -1,6 +1,6 @@ #include "z_en_wonder_talk.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x08000009 void EnWonderTalk_Init(EnWonderTalk* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 17ce0a5b4c..c3799d112e 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -1,6 +1,6 @@ #include "z_en_wonder_talk2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x08000009 void EnWonderTalk2_Init(EnWonderTalk2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 9a28576839..1a49a412aa 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -1,6 +1,6 @@ #include "z_en_wood02.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnWood02_Init(EnWood02* this, GlobalContext* globalCtx); @@ -34,4 +34,3 @@ const ActorInit En_Wood02_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wood02/EnWood02_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Wood02/EnWood02_Draw.s") - 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 8740418da2..a6a3f4468e 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -1,6 +1,6 @@ #include "z_en_xc.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnXc_Init(EnXc* this, GlobalContext* globalCtx); @@ -498,4 +498,3 @@ const ActorInit En_Xc_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Xc/func_80B41BA4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Xc/EnXc_Draw.s") - diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index ce68e7f1ce..de8b1b2dd7 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -1,6 +1,6 @@ #include "z_en_yabusame_mark.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void EnYabusameMark_Init(EnYabusameMark* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index 769ff86d84..b00c463139 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -1,6 +1,6 @@ #include "z_en_yukabyun.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnYukabyun_Init(EnYukabyun* this, GlobalContext* globalCtx); 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 d3523a4535..d98312c4af 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -1,6 +1,6 @@ #include "z_en_zf.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000015 void EnZf_Init(EnZf* this, GlobalContext* globalCtx); @@ -134,4 +134,3 @@ const ActorInit En_Zf_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Zf/func_80B49C2C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Zf/func_80B49E4C.s") - diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 628cb6b10c..db7f3eebf1 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -1,6 +1,6 @@ #include "z_en_zl1.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnZl1_Init(EnZl1* this, GlobalContext* globalCtx); 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 9379f2c188..ab7dfb142e 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -1,6 +1,6 @@ #include "z_en_zl2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnZl2_Init(EnZl2* this, GlobalContext* globalCtx); 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 1544c010ed..3480600106 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -1,6 +1,6 @@ #include "z_en_zl3.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnZl3_Init(EnZl3* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index dac255337d..82dc4db2dd 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -1,6 +1,6 @@ #include "z_en_zl4.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000019 void EnZl4_Init(EnZl4* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 3dba87d598..bee1111979 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -1,6 +1,6 @@ #include "z_en_zo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void EnZo_Init(EnZo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index 14b5cf5b7d..4bb1134fbd 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -1,6 +1,6 @@ #include "z_en_fhg.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void EnfHG_Init(EnfHG* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_End_Title/z_end_title.c b/src/overlays/actors/ovl_End_Title/z_end_title.c index 0a60b82461..f07687b619 100644 --- a/src/overlays/actors/ovl_End_Title/z_end_title.c +++ b/src/overlays/actors/ovl_End_Title/z_end_title.c @@ -1,6 +1,6 @@ #include "z_end_title.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void EndTitle_Init(EndTitle* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 226fee15be..8835dc9199 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -1,6 +1,6 @@ #include "z_fishing.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void Fishing_Init(Fishing* this, GlobalContext* globalCtx); @@ -114,4 +114,3 @@ const ActorInit Fishing_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Fishing/func_80B7A140.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Fishing/func_80B7A278.s") - diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index 4056aa2db0..57c59ddd23 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -1,6 +1,6 @@ #include "z_item_b_heart.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ItemBHeart_Init(ItemBHeart* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index ca79c029ba..36a89bb9c1 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -1,6 +1,6 @@ #include "z_item_etcetera.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ItemEtcetera_Init(ItemEtcetera* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c index 402a0164a3..e84c5c390e 100644 --- a/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c +++ b/src/overlays/actors/ovl_Item_Inbox/z_item_inbox.c @@ -2,15 +2,14 @@ * File: z_item_inbox.c * Overlay: ovl_Item_Inbox * Description: Zelda's magic to open gates. -*/ + */ #include #include #include -typedef struct -{ - /* 0x0000 */ Actor actor; +typedef struct { + /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc updateFunc; } ActorItemInbox; // size = 0x0154 @@ -23,8 +22,7 @@ static void func_80B86020(ActorItemInbox* this, GlobalContext* globalCtx); static void Update(ActorItemInbox* this, GlobalContext* globalCtx); static void Draw(ActorItemInbox* this, GlobalContext* globalCtx); -const ActorInit Item_Inbox_InitVars = -{ +const ActorInit Item_Inbox_InitVars = { ACTOR_ITEM_INBOX, ACTORTYPE_NPC, ROOM, @@ -37,29 +35,25 @@ const ActorInit Item_Inbox_InitVars = (ActorFunc)Draw, }; -static void Init(ActorItemInbox* this, GlobalContext* globalCtx) -{ +static void Init(ActorItemInbox* this, GlobalContext* globalCtx) { this->updateFunc = (ActorFunc)func_80B86020; Actor_SetScale(&this->actor, 0.2); } -static void Destroy(ActorItemInbox* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorItemInbox* this, GlobalContext* globalCtx) { } -static void func_80B86020(ActorItemInbox* this, GlobalContext* globalCtx) -{ - if (Flags_GetTreasure(globalCtx, (this->actor.params >> 8) & 0x1F)) +static void func_80B86020(ActorItemInbox* this, GlobalContext* globalCtx) { + if (Flags_GetTreasure(globalCtx, (this->actor.params >> 8) & 0x1F)) { Actor_Kill(&this->actor); + } } -static void Update(ActorItemInbox* this, GlobalContext* globalCtx) -{ +static void Update(ActorItemInbox* this, GlobalContext* globalCtx) { this->updateFunc(this, globalCtx); } -static void Draw(ActorItemInbox* this, GlobalContext* globalCtx) -{ +static void Draw(ActorItemInbox* this, GlobalContext* globalCtx) { func_8002EBCC(&this->actor, globalCtx, 0); func_8002ED80(&this->actor, globalCtx, 0); func_800694A0(globalCtx, this->actor.params & 0xFF); diff --git a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c index 2830c7a36b..f93f75956d 100644 --- a/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c +++ b/src/overlays/actors/ovl_Item_Ocarina/z_item_ocarina.c @@ -1,6 +1,6 @@ #include "z_item_ocarina.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ItemOcarina_Init(ItemOcarina* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index 74bfbe8116..dd340a6667 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -1,6 +1,6 @@ #include "z_item_shield.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ItemShield_Init(ItemShield* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 84b049b0c8..f373cc3ce8 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -1,6 +1,6 @@ #include "z_magic_dark.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void MagicDark_Init(MagicDark* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index 782956beb3..3b8f49505c 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -1,6 +1,6 @@ #include "z_magic_fire.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void MagicFire_Init(MagicFire* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index 4ae4f7984e..e674a0e837 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -1,6 +1,6 @@ #include "z_magic_wind.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void MagicWind_Init(MagicWind* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 9d12a43bd5..d93987258d 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -1,6 +1,6 @@ #include "z_mir_ray.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000030 void MirRay_Init(MirRay* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index 76688efa1c..1911050285 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -1,6 +1,6 @@ #include "z_obj_bean.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00400000 void ObjBean_Init(ObjBean* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c index 078def3e56..06596da0f6 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -2,26 +2,24 @@ * File: z_obj_blockstop.c * Overlay: ovl_Obj_Blockstop * Description: Stops blocks and sets relevant flags when the block is in position. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; } ActorObjBlockstop; // size = 0x014C -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void Init(ActorObjBlockstop* this, GlobalContext* globalCtx); static void Destroy(ActorObjBlockstop* this, GlobalContext* globalCtx); static void Update(ActorObjBlockstop* this, GlobalContext* globalCtx); -const ActorInit Obj_Blockstop_InitVars = -{ +const ActorInit Obj_Blockstop_InitVars = { ACTOR_OBJ_BLOCKSTOP, ACTORTYPE_PROP, ROOM, @@ -31,40 +29,37 @@ const ActorInit Obj_Blockstop_InitVars = (ActorFunc)Init, (ActorFunc)Destroy, (ActorFunc)Update, - NULL + NULL, }; -static void Init(ActorObjBlockstop* this, GlobalContext* globalCtx) -{ - if (Flags_GetSwitch(globalCtx, this->actor.params)) +static void Init(ActorObjBlockstop* this, GlobalContext* globalCtx) { + if (Flags_GetSwitch(globalCtx, this->actor.params)) { Actor_Kill(&this->actor); - else + } else { this->actor.posRot.pos.y += 1; + } } -static void Destroy(ActorObjBlockstop* this, GlobalContext* globalCtx) -{ +static void Destroy(ActorObjBlockstop* this, GlobalContext* globalCtx) { } -static void Update(ActorObjBlockstop* this, GlobalContext* globalCtx) -{ +static void Update(ActorObjBlockstop* this, GlobalContext* globalCtx) { DynaPolyActor* dynaActor; s32 pad; Vec3f sp4C; u32 sp48; s32 pad2; - if (func_8003DF10(&globalCtx->colCtx, &this->actor.initPosRot.pos, &this->actor.posRot.pos, - &sp4C, &this->actor.floorPoly, 0, 0, 1, 1, &sp48, &this->actor)) - { + if (func_8003DF10(&globalCtx->colCtx, &this->actor.initPosRot.pos, &this->actor.posRot.pos, &sp4C, + &this->actor.floorPoly, 0, 0, 1, 1, &sp48, &this->actor)) { dynaActor = DynaPolyInfo_GetActor(&globalCtx->colCtx, sp48); - if ((dynaActor != NULL) && (dynaActor->actor.id == 0xFF)) - { - if (((dynaActor->actor.params & 0x000F) == 3) || ((dynaActor->actor.params & 0x000F) == 7)) + if ((dynaActor != NULL) && (dynaActor->actor.id == 0xFF)) { + if (((dynaActor->actor.params & 0x000F) == 3) || ((dynaActor->actor.params & 0x000F) == 7)) { func_80078884(NA_SE_SY_CORRECT_CHIME); - else + } else { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); + } Flags_SetSwitch(globalCtx, this->actor.params); Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c index d5cc6f8feb..54dfaf2bc5 100644 --- a/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c +++ b/src/overlays/actors/ovl_Obj_Bombiwa/z_obj_bombiwa.c @@ -2,11 +2,11 @@ * File: z_obj_bombiwa.c * Overlay: ovl_Obj_Bombiwa * Description: Round, brown, breakable boulder -*/ + */ #include "z_obj_bombiwa.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 static void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx); @@ -17,8 +17,7 @@ static void ObjBombiwa_Draw(ObjBombiwa* this, GlobalContext* globalCtx); static void ObjBombiwa_InitCollision(ObjBombiwa* this, GlobalContext* globalCtx); static void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx); -const ActorInit Obj_Bombiwa_InitVars = -{ +const ActorInit Obj_Bombiwa_InitVars = { ACTOR_OBJ_BOMBIWA, ACTORTYPE_PROP, ROOM, @@ -31,77 +30,59 @@ const ActorInit Obj_Bombiwa_InitVars = (ActorFunc)ObjBombiwa_Draw, }; -static ColliderCylinderInit colliderInit = -{ - 0x0C, 0x00, 0x0D, 0x39, - 0x20, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00000000, 0x00, 0x00, - 0x00, 0x00, 0x4FC1FFFE, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x01, 0x00, - 0x0037, 0x0046, 0x0000, - 0x0000, 0x0000, 0x0000, +static ColliderCylinderInit colliderInit = { + 0x0C, 0x00, 0x0D, 0x39, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00000000, 0x00, 0x00, 0x00, 0x00, 0x4FC1FFFE, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x00, 0x0037, 0x0046, 0x0000, 0x0000, 0x0000, 0x0000, }; -static u32 damageChart[] = -{ - 0x0000000C, 0x003CFF00, +static u32 damageChart[] = { + 0x0000000C, + 0x003CFF00, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 0x64, ICHAIN_CONTINUE), ICHAIN_F32(unk_F4, 0x7D0, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 0x15E, ICHAIN_CONTINUE), ICHAIN_F32(unk_FC, 0x3E8, ICHAIN_STOP), }; -static s16 effectScales[] = -{ +static s16 effectScales[] = { 17, 14, 10, 8, 7, 5, 3, 2, }; -extern Gfx* D_060009E0; //dlist +extern Gfx* D_060009E0; // dlist -static void ObjBombiwa_InitCollision(ObjBombiwa* this, GlobalContext* globalCtx) -{ +static void ObjBombiwa_InitCollision(ObjBombiwa* this, GlobalContext* globalCtx) { ObjBombiwa* thisLocal = this; ActorCollider_AllocCylinder(globalCtx, &thisLocal->collider); ActorCollider_InitCylinder(globalCtx, &thisLocal->collider, &thisLocal->actor, &colliderInit); ActorCollider_Cylinder_Update(&thisLocal->actor, &thisLocal->collider); } -static void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx) -{ +static void ObjBombiwa_Init(ObjBombiwa* this, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, initChain); ObjBombiwa_InitCollision(this, globalCtx); - if ((Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) != 0)) - { + if ((Flags_GetSwitch(globalCtx, this->actor.params & 0x3F) != 0)) { Actor_Kill(&this->actor); - } - else - { + } else { func_80061ED4(&this->actor.sub_98.damageChart, NULL, damageChart); - if (this->actor.shape.rot.y == 0) - { - s16 rand = (s16) Math_Rand_ZeroFloat(65536.0f); + if (this->actor.shape.rot.y == 0) { + s16 rand = (s16)Math_Rand_ZeroFloat(65536.0f); this->actor.posRot.rot.y = rand; this->actor.shape.rot.y = rand; } this->actor.shape.unk_08 = -200.0f; this->actor.posRot.pos.y = this->actor.initPosRot.pos.y + 20.0f; } - } -static void ObjBombiwa_Destroy(ObjBombiwa* this, GlobalContext* globalCtx) -{ +static void ObjBombiwa_Destroy(ObjBombiwa* this, GlobalContext* globalCtx) { ActorCollider_FreeCylinder(globalCtx, &this->collider); } -static void ObjBombiwa_Break(ObjBombiwa *this, GlobalContext *globalCtx) -{ +static void ObjBombiwa_Break(ObjBombiwa* this, GlobalContext* globalCtx) { Vec3f temp_s2; Vec3f temp_s3; Gfx** dlist; @@ -110,8 +91,7 @@ static void ObjBombiwa_Break(ObjBombiwa *this, GlobalContext *globalCtx) s32 i; dlist = &D_060009E0; - for (i = 0; i < ARRAY_COUNT(effectScales); i++) - { + for (i = 0; i < ARRAY_COUNT(effectScales); i++) { temp_s2.x = ((Math_Rand_ZeroOne() - 0.5f) * 10.0f) + this->actor.initPosRot.pos.x; temp_s2.y = ((Math_Rand_ZeroOne() * 5.0f) + this->actor.initPosRot.pos.y) + 8.0f; temp_s2.z = ((Math_Rand_ZeroOne() - 0.5f) * 10.0f) + this->actor.initPosRot.pos.z; @@ -120,34 +100,29 @@ static void ObjBombiwa_Break(ObjBombiwa *this, GlobalContext *globalCtx) temp_s3.z = (Math_Rand_ZeroOne() - 0.5f) * 15.0f; scale = effectScales[i]; u0 = (scale >= 11) ? 37 : 33; - Effect_SpawnFragment(globalCtx, &temp_s2, &temp_s3, &temp_s2, -400, u0, 10, 2, 0, scale, 1, 0, 80, -1, OBJECT_BOMBIWA, dlist); + Effect_SpawnFragment(globalCtx, &temp_s2, &temp_s3, &temp_s2, -400, u0, 10, 2, 0, scale, 1, 0, 80, -1, + OBJECT_BOMBIWA, dlist); } func_80033480(globalCtx, &this->actor.posRot.pos, 60.0f, 8, 100, 160, 1); } -static void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx) -{ +static void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx) { SubGlobalContext11E60* sub_11E60; ColliderCylinderMain* collider; - if (func_80033684(globalCtx, &this->actor) != NULL || - ((this->collider.base.collideFlags & 2) != 0 && - (this->collider.body.colliding->toucher.flags & 0x40000040) != 0)) - { + if (func_80033684(globalCtx, &this->actor) != NULL || + ((this->collider.base.collideFlags & 2) != 0 && + (this->collider.body.colliding->toucher.flags & 0x40000040) != 0)) { ObjBombiwa_Break(this, globalCtx); Flags_SetSwitch(globalCtx, this->actor.params & 0x3F); Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 80, NA_SE_EV_WALL_BROKEN); - if (((this->actor.params >> 0xF) & 1) != 0) - { + if (((this->actor.params >> 0xF) & 1) != 0) { func_80078884(NA_SE_SY_CORRECT_CHIME); } Actor_Kill(&this->actor); - } - else - { + } else { this->collider.base.collideFlags &= ~0x2; - if (this->actor.xzDistanceFromLink < 800.0f) - { + if (this->actor.xzDistanceFromLink < 800.0f) { sub_11E60 = &globalCtx->sub_11E60; collider = &this->collider; Actor_CollisionCheck_SetAC(globalCtx, sub_11E60, collider); @@ -156,7 +131,6 @@ static void ObjBombiwa_Update(ObjBombiwa* this, GlobalContext* globalCtx) } } -static void ObjBombiwa_Draw(ObjBombiwa* this, GlobalContext* globalCtx) -{ +static void ObjBombiwa_Draw(ObjBombiwa* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_060009E0); } diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 24d4a38145..17d1260608 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -1,6 +1,6 @@ #include "z_obj_comb.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjComb_Init(ObjComb* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index fc9d1f60bf..fdd4a085de 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -1,6 +1,6 @@ #include "z_obj_dekujr.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void ObjDekujr_Init(ObjDekujr* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c index cbd00953b5..32da650c2c 100644 --- a/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c +++ b/src/overlays/actors/ovl_Obj_Elevator/z_obj_elevator.c @@ -2,11 +2,11 @@ * File: z_obj_elevator.c * Overlay: Obj_Elevator * Description: Stone Dungeon Elevator -*/ + */ #include "z_obj_elevator.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 #define SIZE_PARAM 1 @@ -21,8 +21,7 @@ static void func_80B92C80(ObjElevator* this, GlobalContext* globalCtx); static void func_80B92D20(ObjElevator* this); static void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx); -const ActorInit Obj_Elevator_InitVars = -{ +const ActorInit Obj_Elevator_InitVars = { ACTOR_OBJ_ELEVATOR, ACTORTYPE_BG, ROOM, @@ -35,25 +34,22 @@ const ActorInit Obj_Elevator_InitVars = (ActorFunc)ObjElevator_Draw, }; -static InitChainEntry initChain[] = -{ +static InitChainEntry initChain[] = { ICHAIN_F32(unk_F4, 2000, ICHAIN_CONTINUE), ICHAIN_F32(unk_F8, 600, ICHAIN_CONTINUE), - ICHAIN_F32(unk_FC, 2000, ICHAIN_STOP) + ICHAIN_F32(unk_FC, 2000, ICHAIN_STOP), }; -static f32 sizes[] = {0.1f, 0.05f}; +static f32 sizes[] = { 0.1f, 0.05f }; extern u32 D_06000180; extern u32 D_06000360; -static void ObjElevator_SetupAction(ObjElevator* this, ActorFunc actionFunc) -{ +static void ObjElevator_SetupAction(ObjElevator* this, ActorFunc actionFunc) { this->actionFunc = actionFunc; } -static void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) -{ +static void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, u32 collision, DynaPolyMoveFlag flag) { s16 pad1; u32 local_c = 0; s16 pad2; @@ -62,14 +58,13 @@ static void func_80B92B08(ObjElevator* this, GlobalContext* globalCtx, u32 colli DynaPolyInfo_SetActorMove(thisx, flag); DynaPolyInfo_Alloc(collision, &local_c); this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); - if (this->dyna.dynaPolyId == 0x32) - { - osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136, thisx->id, thisx->params); + if (this->dyna.dynaPolyId == 0x32) { + osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_obj_elevator.c", 136, + thisx->id, thisx->params); } } -static void ObjElevator_Init(ObjElevator* this, GlobalContext* globalCtx) -{ +static void ObjElevator_Init(ObjElevator* this, GlobalContext* globalCtx) { f32 temp_f0; Actor* thisx = &this->dyna.actor; @@ -82,64 +77,49 @@ static void ObjElevator_Init(ObjElevator* this, GlobalContext* globalCtx) osSyncPrintf("(Dungeon Elevator)(arg_data 0x%04x)\n", thisx->params); } -static void ObjElevator_Destroy(ObjElevator* this, GlobalContext* globalCtx) -{ +static void ObjElevator_Destroy(ObjElevator* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -static void func_80B92C5C(ObjElevator* this) -{ +static void func_80B92C5C(ObjElevator* this) { ObjElevator_SetupAction(this, func_80B92C80); } -static void func_80B92C80(ObjElevator* this, GlobalContext* globalCtx) -{ +static void func_80B92C80(ObjElevator* this, GlobalContext* globalCtx) { f32 sub; Actor* thisx = &this->dyna.actor; - if ((this->dyna.unk_160 & 2) && !(this->unk_170 & 2)) - { + if ((this->dyna.unk_160 & 2) && !(this->unk_170 & 2)) { sub = thisx->posRot.pos.y - thisx->initPosRot.pos.y; - if (fabsf(sub) < 0.1f) - { + if (fabsf(sub) < 0.1f) { this->unk_168 = thisx->initPosRot.pos.y + ((thisx->params >> 0xC) & 0xF) * 80.0f; - } - else - { + } else { this->unk_168 = thisx->initPosRot.pos.y; } func_80B92D20(this); } } -static void func_80B92D20(ObjElevator* this) -{ +static void func_80B92D20(ObjElevator* this) { ObjElevator_SetupAction(this, func_80B92D44); } -static void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx) -{ +static void func_80B92D44(ObjElevator* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (fabsf(Math_SmoothScaleMaxMinF(&thisx->posRot.pos.y, this->unk_168, 1.0f, this->unk_16C, 0.0f)) < 0.001f) - { + if (fabsf(Math_SmoothScaleMaxMinF(&thisx->posRot.pos.y, this->unk_168, 1.0f, this->unk_16C, 0.0f)) < 0.001f) { Audio_PlayActorSound2(thisx, NA_SE_EV_FOOT_SWITCH); func_80B92C5C(this); - } - else - { + } else { Audio_PlayActorSound2(thisx, 0x201E); } } -static void ObjElevator_Update(ObjElevator* this, GlobalContext* globalCtx) -{ - if (this->actionFunc) - { +static void ObjElevator_Update(ObjElevator* this, GlobalContext* globalCtx) { + if (this->actionFunc) { this->actionFunc(this, globalCtx); } this->unk_170 = this->dyna.unk_160; } -static void ObjElevator_Draw(ObjElevator* this, GlobalContext* globalCtx) -{ +static void ObjElevator_Draw(ObjElevator* this, GlobalContext* globalCtx) { Draw_DListOpa(globalCtx, &D_06000180); } diff --git a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c index bcdffe4790..4f33e20f88 100644 --- a/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c +++ b/src/overlays/actors/ovl_Obj_Hamishi/z_obj_hamishi.c @@ -1,6 +1,6 @@ #include "z_obj_hamishi.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjHamishi_Init(ObjHamishi* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c index 6196c47f06..e163ac265f 100644 --- a/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c +++ b/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.c @@ -1,6 +1,6 @@ #include "z_obj_hana.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjHana_Init(ObjHana* this, GlobalContext* globalCtx); @@ -30,6 +30,3 @@ const ActorInit Obj_Hana_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Draw.s") - - - diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index 027f1d04a9..5d16e21e4e 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -1,6 +1,6 @@ #include "z_obj_hsblock.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjHsblock_Init(ObjHsblock* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 39a6eb9b74..5292dd1f4a 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -1,6 +1,6 @@ #include "z_obj_ice_poly.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ObjIcePoly_Init(ObjIcePoly* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 726033ba58..70b364a9b7 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -1,6 +1,6 @@ #include "z_obj_kibako.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x04000010 void ObjKibako_Init(ObjKibako* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c index a158b029dd..af59ebcbef 100644 --- a/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c +++ b/src/overlays/actors/ovl_Obj_Kibako2/z_obj_kibako2.c @@ -1,6 +1,6 @@ #include "z_obj_kibako2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjKibako2_Init(ObjKibako2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 22f510dc1e..8e59d162e3 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -1,6 +1,6 @@ #include "z_obj_lift.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ObjLift_Init(ObjLift* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index f4d0e31192..0f9b525dc3 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -1,6 +1,6 @@ #include "z_obj_lightswitch.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ObjLightswitch_Init(ObjLightswitch* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index f43c01bb13..65ff6f8d26 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -2,21 +2,20 @@ * File: z_obj_makekinsuta.c * Overlay: ovl_Obj_Makekinsuta * Description: Skulltula Sprouting from Bean Spot. -*/ + */ #include #include #include -typedef struct -{ +typedef struct { /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc actionFunc; /* 0x150 */ s16 unk_150; /* 0x152 */ s16 unk_152; } ObjMakekinsuta; // size = 0x0154 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void ObjMakekinsuta_Init(ObjMakekinsuta* this, GlobalContext* globalCtx); @@ -24,8 +23,7 @@ static void ObjMakekinsuta_Update(ObjMakekinsuta* this, GlobalContext* globalCtx static void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx); static void func_80B983D4(ObjMakekinsuta* this, GlobalContext* globalCtx); -const ActorInit Obj_Makekinsuta_InitVars = -{ +const ActorInit Obj_Makekinsuta_InitVars = { ACTOR_OBJ_MAKEKINSUTA, ACTORTYPE_ITEMACTION, ROOM, @@ -38,49 +36,39 @@ const ActorInit Obj_Makekinsuta_InitVars = NULL, }; -static void ObjMakekinsuta_Init(ObjMakekinsuta* this, GlobalContext* globalCtx) -{ - if ((this->actor.params & 0x6000) == 0x4000) - { +static void ObjMakekinsuta_Init(ObjMakekinsuta* this, GlobalContext* globalCtx) { + if ((this->actor.params & 0x6000) == 0x4000) { osSyncPrintf(VT_FGCOL(BLUE)); - // Translation: Gold Star Enemy(arg_data %x) + // Translation: Gold Star Enemy(arg_data %x) osSyncPrintf("金スタ発生敵(arg_data %x)\n", this->actor.params); osSyncPrintf(VT_RST); - } - else - { + } else { osSyncPrintf(VT_COL(YELLOW, BLACK)); - // Translation: Invalid Argument (arg_data %x)(%s %d) + // Translation: Invalid Argument (arg_data %x)(%s %d) osSyncPrintf("引数不正 (arg_data %x)(%s %d)\n", this->actor.params, "../z_obj_makekinsuta.c", 119); osSyncPrintf(VT_RST); } this->actionFunc = func_80B98320; } -static void func_80B98320(ObjMakekinsuta* this,GlobalContext* globalCtx) -{ - if (this->unk_152 != 0) - { - if (this->unk_150 >= 0x3C && !func_8002DEEC(PLAYER)) - { - Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, - this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, - 0, this->actor.shape.rot.y, 0, (this->actor.params | 0x8000)); - this->actionFunc = &func_80B983D4; - return; - } +static void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx) { + if (this->unk_152 != 0) { + if (this->unk_150 >= 0x3C && !func_8002DEEC(PLAYER)) { + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->actor.posRot.pos.x, + this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, this->actor.shape.rot.y, 0, + (this->actor.params | 0x8000)); + this->actionFunc = &func_80B983D4; + return; + } this->unk_150 = this->unk_150 + 1; return; } - this->unk_150 = 0; + this->unk_150 = 0; } -static void func_80B983D4(ObjMakekinsuta* this, GlobalContext* globalCtx) -{ - +static void func_80B983D4(ObjMakekinsuta* this, GlobalContext* globalCtx) { } -static void ObjMakekinsuta_Update(ObjMakekinsuta* this, GlobalContext* globalCtx) -{ +static void ObjMakekinsuta_Update(ObjMakekinsuta* this, GlobalContext* globalCtx) { this->actionFunc(&this->actor, globalCtx); } diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index ad8ed94938..52e7e68453 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -1,6 +1,6 @@ #include "z_obj_makeoshihiki.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000020 void ObjMakeoshihiki_Init(ObjMakeoshihiki* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index 47f1739a82..23541cf9df 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -1,6 +1,6 @@ #include "z_obj_mure.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjMure_Init(ObjMure* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c index a53c84c165..94e3d7ffd2 100644 --- a/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -1,6 +1,6 @@ #include "z_obj_mure2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjMure2_Init(ObjMure2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c index bc8effe0f8..a3587c1652 100644 --- a/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c +++ b/src/overlays/actors/ovl_Obj_Mure3/z_obj_mure3.c @@ -1,6 +1,6 @@ #include "z_obj_mure3.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000000 void ObjMure3_Init(ObjMure3* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 3de3e5734c..2563eb4a5a 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -1,6 +1,6 @@ #include "z_obj_oshihiki.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ObjOshihiki_Init(ObjOshihiki* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index 5b6bf5ac64..6689ab0121 100644 --- a/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -2,20 +2,19 @@ * File: z_obj_roomtimer.c * Overlay: ovl_Obj_Roomtimer * Description: -*/ + */ #include #include #include -typedef struct -{ - /* 0x0000 */ Actor actor; +typedef struct { + /* 0x0000 */ Actor actor; /* 0x014C */ ActorFunc updateFunc; - /* 0x0150 */ u32 switchFlag; + /* 0x0150 */ u32 switchFlag; } ActorRoomTimer; // size = 0x0154 -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 static void Init(ActorRoomTimer* this, GlobalContext* globalCtx); @@ -24,8 +23,7 @@ static void Update(ActorRoomTimer* this, GlobalContext* globalCtx); static void func_80B9D054(ActorRoomTimer* this, GlobalContext* globalCtx); static void func_80B9D0B0(ActorRoomTimer* this, GlobalContext* globalCtx); -const ActorInit Obj_Roomtimer_InitVars = -{ +const ActorInit Obj_Roomtimer_InitVars = { ACTOR_OBJ_ROOMTIMER, ACTORTYPE_ENEMY, ROOM, @@ -38,61 +36,54 @@ const ActorInit Obj_Roomtimer_InitVars = (ActorFunc)NULL, }; -static void Init(ActorRoomTimer* this, GlobalContext* globalCtx) -{ +static void Init(ActorRoomTimer* this, GlobalContext* globalCtx) { s16 params = this->actor.params; this->switchFlag = (params >> 10) & 0x3F; this->actor.params = params & 0x3FF; params = this->actor.params; - if (params != 0x3FF) - { - if (params > 600) + if (params != 0x3FF) { + if (params > 600) { this->actor.params = 600; - else + } else { this->actor.params = params; + } } this->updateFunc = (ActorFunc)func_80B9D054; } -static void Destroy(ActorRoomTimer* this, GlobalContext* globalCtx) -{ - if (this->actor.params != 0x3FF) - { - if (gSaveContext.timer_1_value > 0) +static void Destroy(ActorRoomTimer* this, GlobalContext* globalCtx) { + if (this->actor.params != 0x3FF) { + if (gSaveContext.timer_1_value > 0) { gSaveContext.timer_1_state = 10; + } } } -static void func_80B9D054(ActorRoomTimer* this, GlobalContext* globalCtx) -{ - if (this->actor.params != 0x3FF) +static void func_80B9D054(ActorRoomTimer* this, GlobalContext* globalCtx) { + if (this->actor.params != 0x3FF) { func_80088B34(this->actor.params); + } Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_PROP); this->updateFunc = (ActorFunc)func_80B9D0B0; } -static void func_80B9D0B0(ActorRoomTimer* this, GlobalContext* globalCtx) -{ - if (Flags_GetTempClear(globalCtx, this->actor.room)) - { - if (this->actor.params != 0x3FF) +static void func_80B9D0B0(ActorRoomTimer* this, GlobalContext* globalCtx) { + if (Flags_GetTempClear(globalCtx, this->actor.room)) { + if (this->actor.params != 0x3FF) { gSaveContext.timer_1_state = 10; + } Flags_SetClear(globalCtx, this->actor.room); Flags_SetSwitch(globalCtx, this->switchFlag); func_80078884(NA_SE_SY_CORRECT_CHIME); Actor_Kill(&this->actor); - } - else - { - if (this->actor.params != 0x3FF) - { - if (gSaveContext.timer_1_value == 0) - { + } else { + if (this->actor.params != 0x3FF) { + if (gSaveContext.timer_1_value == 0) { Audio_PlaySoundGeneral(NA_SE_OC_ABYSS, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); func_800C0B60(globalCtx); // Void Out Actor_Kill(&this->actor); @@ -101,7 +92,6 @@ static void func_80B9D0B0(ActorRoomTimer* this, GlobalContext* globalCtx) } } -static void Update(ActorRoomTimer* this, GlobalContext* globalCtx) -{ +static void Update(ActorRoomTimer* this, GlobalContext* globalCtx) { this->updateFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 3be1b0ad34..43a73f406e 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -1,6 +1,6 @@ #include "z_obj_switch.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000010 void ObjSwitch_Init(ObjSwitch* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 79c658a70a..a3255aa52b 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -1,6 +1,6 @@ #include "z_obj_syokudai.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000410 void ObjSyokudai_Init(ObjSyokudai* this, GlobalContext* globalCtx); @@ -30,4 +30,3 @@ const ActorInit Obj_Syokudai_InitVars = #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Syokudai/ObjSyokudai_Update.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Syokudai/ObjSyokudai_Draw.s") - diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index e0755c0920..30800d54d5 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -1,6 +1,6 @@ #include "z_obj_timeblock.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x0A000011 void ObjTimeblock_Init(ObjTimeblock* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 5440caeea1..ae6919493b 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -1,6 +1,6 @@ #include "z_obj_tsubo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00800010 void ObjTsubo_Init(ObjTsubo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 084a477afb..e19145bff5 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -1,6 +1,6 @@ #include "z_obj_warp2block.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x0A000011 void ObjWarp2block_Init(ObjWarp2block* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 83236cda15..96eebcf901 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -1,6 +1,6 @@ #include "z_object_kankyo.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000030 void ObjectKankyo_Init(ObjectKankyo* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index cdd7de0561..6699af88f0 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -1,6 +1,6 @@ #include "z_oceff_spot.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void OceffSpot_Init(OceffSpot* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index 10b22404ef..25609fa4d6 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -1,6 +1,6 @@ #include "z_oceff_storm.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000030 void OceffStorm_Init(OceffStorm* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index a5310aff19..ceec18a469 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -1,6 +1,6 @@ #include "z_oceff_wipe.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void OceffWipe_Init(OceffWipe* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index ce20d0406a..0f5ad2638b 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -1,6 +1,6 @@ #include "z_oceff_wipe2.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void OceffWipe2_Init(OceffWipe2* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 00e6ec8abe..ed27e7d8dd 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -1,6 +1,6 @@ #include "z_oceff_wipe3.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void OceffWipe3_Init(OceffWipe3* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index cae47b2ac6..734b53cbbd 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -1,6 +1,6 @@ #include "z_oceff_wipe4.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x02000010 void OceffWipe4_Init(OceffWipe4* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 4ab2513bd0..b51bc1ccf9 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -1,6 +1,6 @@ #include "z_shot_sun.h" -#define ROOM 0x00 +#define ROOM 0x00 #define FLAGS 0x00000009 void ShotSun_Init(ShotSun* this, GlobalContext* globalCtx); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 4f73c36e9a..ffed1b22a1 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1094,7 +1094,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_player_actor/func_808530E0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_player_actor/func_80853148.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_effect_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_effect_ss_blast.c index 0a741f327f..77c3b7629f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_effect_ss_blast.c +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_effect_ss_blast.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Blast/func_8099EF08.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Blast/func_8099F0AC.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_effect_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_effect_ss_bomb.c index 1d90bd98de..45fe73bc88 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_effect_ss_bomb.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_effect_ss_bomb.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb/func_8099F274.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb/func_8099F4D8.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_effect_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_effect_ss_bomb2.c index f7dc03af7f..b4985f3bbd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_effect_ss_bomb2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_effect_ss_bomb2.c @@ -8,7 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb2/func_8099F960.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb2/func_8099FCCC.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_effect_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_effect_ss_bubble.c index 275826cdbe..8ee11f8e53 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_effect_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_effect_ss_bubble.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bubble/func_809A01CC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bubble/func_809A0360.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_effect_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_effect_ss_d_fire.c index 5a073cf053..be8a0129cc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_effect_ss_d_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_effect_ss_d_fire.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_D_Fire/func_809A0698.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_D_Fire/func_809A090C.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_effect_ss_dead_db.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_effect_ss_dead_db.c index 7235707b13..4f75a5671a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_effect_ss_dead_db.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Db/z_effect_ss_dead_db.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Db/func_809A0BB8.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Db/func_809A0DB4.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_effect_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_effect_ss_dead_dd.c index 22c0311300..582ea22b0e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_effect_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_effect_ss_dead_dd.c @@ -6,6 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Dd/func_809A12B4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Dd/func_809A14B0.s") - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_effect_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_effect_ss_dead_ds.c index e3fd6e9a35..d4995444ae 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_effect_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_effect_ss_dead_ds.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Ds/func_809A16F4.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Ds/func_809A1A08.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_effect_ss_dead_sound.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_effect_ss_dead_sound.c index db2ecc7746..722d468899 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_effect_ss_dead_sound.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Sound/z_effect_ss_dead_sound.c @@ -4,6 +4,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Sound/func_809A1B30.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Sound/func_809A1BD8.s") - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_effect_ss_dt_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_effect_ss_dt_bubble.c index 1049a55678..45f0eb9bf3 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_effect_ss_dt_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dt_Bubble/z_effect_ss_dt_bubble.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dt_Bubble/func_809A1F04.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dt_Bubble/func_809A2180.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_effect_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_effect_ss_dust.c index 338cfd8e19..497360c137 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_effect_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_effect_ss_dust.c @@ -8,7 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dust/func_809A27F0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dust/func_809A28EC.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_effect_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_effect_ss_en_fire.c index a6476bef80..eb6d647d6d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_effect_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_effect_ss_en_fire.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_En_Fire/func_809A2D28.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_En_Fire/func_809A3060.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_effect_ss_en_ice.c b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_effect_ss_en_ice.c index 757e7d236a..b34074f312 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_effect_ss_en_ice.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Ice/z_effect_ss_en_ice.c @@ -8,7 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_En_Ice/func_809A3988.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_En_Ice/func_809A3B60.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_effect_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_effect_ss_extra.c index 2fa975eea4..d3c9b4edbf 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_effect_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_effect_ss_extra.c @@ -6,6 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Extra/func_809A3E00.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Extra/func_809A3FF8.s") - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_effect_ss_fcircle.c b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_effect_ss_fcircle.c index 5bc17afa5c..3da011570b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_effect_ss_fcircle.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fcircle/z_effect_ss_fcircle.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Fcircle/func_809A41DC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Fcircle/func_809A44E0.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_effect_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_effect_ss_fhg_flash.c index 54a2d1e595..c04ee27c9f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_effect_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_effect_ss_fhg_flash.c @@ -10,7 +10,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Fhg_Flash/func_809A4E28.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Fhg_Flash/func_809A4EC0.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_effect_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_effect_ss_fire_tail.c index 101a40861a..09ef8ed751 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_effect_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_effect_ss_fire_tail.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Fire_Tail/func_809A5858.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Fire_Tail/func_809A5D98.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_effect_ss_g_fire.c b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_effect_ss_g_fire.c index 2c1d6c4f55..943976af01 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_effect_ss_g_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Fire/z_effect_ss_g_fire.c @@ -6,6 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Fire/func_809A6010.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Fire/func_809A60B4.s") - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_effect_ss_g_magma.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_effect_ss_g_magma.c index fa5a5d09b0..6dc514c3b8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_effect_ss_g_magma.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma/z_effect_ss_g_magma.c @@ -6,6 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Magma/func_809A62A8.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Magma/func_809A6300.s") - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_effect_ss_g_magma2.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_effect_ss_g_magma2.c index fae1da5642..23d10a5ac1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_effect_ss_g_magma2.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_effect_ss_g_magma2.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Magma2/func_809A6568.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Magma2/func_809A67C0.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_effect_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_effect_ss_g_ripple.c index c8213252b6..169d45524f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_effect_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_effect_ss_g_ripple.c @@ -8,7 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Ripple/func_809A6D08.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Ripple/func_809A6D40.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_effect_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_effect_ss_g_spk.c index 63654bf9fe..50c1df035f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_effect_ss_g_spk.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_effect_ss_g_spk.c @@ -8,7 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Spk/func_809A72C0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Spk/func_809A73C8.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_effect_ss_g_splash.c b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_effect_ss_g_splash.c index 90867018c6..87496873a1 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_effect_ss_g_splash.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Splash/z_effect_ss_g_splash.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Splash/func_809A7760.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Splash/func_809A7864.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_effect_ss_hahen.c b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_effect_ss_hahen.c index 3f89cfcd1c..4dca04f290 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_effect_ss_hahen.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_effect_ss_hahen.c @@ -10,7 +10,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Hahen/func_809A7D9C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Hahen/func_809A7F84.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_effect_ss_hitmark.c b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_effect_ss_hitmark.c index d09dc3ef74..7574886edb 100644 --- a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_effect_ss_hitmark.c +++ b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_effect_ss_hitmark.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_HitMark/func_809A824C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_HitMark/func_809A8484.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_effect_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_effect_ss_ice_piece.c index af7c0472d9..91092b680f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_effect_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_effect_ss_ice_piece.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Ice_Piece/func_809A8850.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Ice_Piece/func_809A8AC0.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_effect_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_effect_ss_ice_smoke.c index a0952b1dd0..ff7c85ba14 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_effect_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_effect_ss_ice_smoke.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Ice_Smoke/func_809A8D18.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Ice_Smoke/func_809A9030.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_effect_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_effect_ss_k_fire.c index e45dd75de1..6e6749a9bf 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_effect_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_effect_ss_k_fire.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_K_Fire/func_809A9280.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_K_Fire/func_809A951C.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_effect_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_effect_ss_kakera.c index 3d53bc0fbf..1b1cd9d50d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_effect_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_effect_ss_kakera.c @@ -36,7 +36,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Kakera/func_809AA230.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Kakera/func_809AA430.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_effect_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_effect_ss_kirakira.c index 432e20cad1..553f117911 100644 --- a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_effect_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_effect_ss_kirakira.c @@ -10,7 +10,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_KiraKira/func_809AACAC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_KiraKira/func_809AAD6C.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_effect_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_effect_ss_lightning.c index 4e6ff2656c..cf29b1521e 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_effect_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_effect_ss_lightning.c @@ -8,7 +8,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Lightning/func_809AB078.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Lightning/func_809AB338.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_effect_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_effect_ss_sibuki.c index 6f401acae7..5daf2d6cb2 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_effect_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_effect_ss_sibuki.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Sibuki/func_809AB7EC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Sibuki/func_809AB9DC.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_effect_ss_sibuki2.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_effect_ss_sibuki2.c index 637b117b94..9a080975fc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_effect_ss_sibuki2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_effect_ss_sibuki2.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Sibuki2/func_809ABE0C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Sibuki2/func_809AC030.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index 7eda76d1a0..9b84df0bdf 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -4,6 +4,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/func_809AC130.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/func_809AC1AC.s") - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_effect_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_effect_ss_stick.c index 7648629ae6..1fc5e5b32f 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_effect_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_effect_ss_stick.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Stick/func_809AC42C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Stick/func_809AC604.s") - - - - diff --git a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_effect_ss_stone1.c b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_effect_ss_stone1.c index b2cdb6fa3a..04790b4279 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stone1/z_effect_ss_stone1.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stone1/z_effect_ss_stone1.c @@ -6,7 +6,3 @@ #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Stone1/func_809AC78C.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Stone1/func_809AC9C0.s") - - - - diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 98d806c01f..416b45a2e7 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -2,13 +2,12 @@ * File: z_opening.c * Overlay: ovl_opening * Description: Initializes the game into the title screen -*/ + */ #include #include -static void Opening_SetNextGameState(OpeningContext* this) -{ +static void Opening_SetNextGameState(OpeningContext* this) { gSaveContext.game_mode = 1; this->state.running = false; gSaveContext.link_age = 0; @@ -18,25 +17,19 @@ static void Opening_SetNextGameState(OpeningContext* this) SET_NEXT_GAMESTATE(&this->state, func_800BCA64, GlobalContext); } -static void func_80803C5C(OpeningContext* this) -{ - +static void func_80803C5C(OpeningContext* this) { } -static void Opening_Update(OpeningContext* this) -{ +static void Opening_Update(OpeningContext* this) { func_80095248(this->state.gfxCtx, 0, 0, 0); Opening_SetNextGameState(this); func_80803C5C(this); } -static void Opening_Destroy(OpeningContext* this) -{ - +static void Opening_Destroy(OpeningContext* this) { } -void Opening_Init(OpeningContext* this) -{ +void Opening_Init(OpeningContext* this) { R_UPDATE_RATE = 1; Matrix_Init(&this->state); func_800AA278(&this->view, this->state.gfxCtx); diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 3ff5211d94..0ed42a3925 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -2,7 +2,7 @@ * File: z_title.c * Overlay: ovl_title * Description: Displays the Nintendo Logo -*/ + */ #include #include @@ -12,8 +12,7 @@ extern Gfx D_01002720[]; extern u8 D_01001800[]; extern u8 D_01000000[]; -void Title_PrintBuildInfo(Gfx** gfxp) -{ +void Title_PrintBuildInfo(Gfx** gfxp) { Gfx* g; GfxPrint* printer; @@ -35,14 +34,13 @@ void Title_PrintBuildInfo(Gfx** gfxp) *gfxp = g; } -// Note: In other rom versions this function also updates unk_1D4, coverAlpha, addAlpha, visibleDuration to calculate the fade-in/fade-out + the duration of the n64 logo animation -void Title_Calc(TitleContext* this) -{ +// Note: In other rom versions this function also updates unk_1D4, coverAlpha, addAlpha, visibleDuration to calculate +// the fade-in/fade-out + the duration of the n64 logo animation +void Title_Calc(TitleContext* this) { this->exit = 1; } -void Title_InitView(TitleContext* this, f32 x, f32 y, f32 z) -{ +void Title_InitView(TitleContext* this, f32 x, f32 y, f32 z) { View* view; Vec3f v1; Vec3f v2; @@ -64,8 +62,7 @@ void Title_InitView(TitleContext* this, f32 x, f32 y, f32 z) func_800AAA50(view, 0xF); } -void Title_Draw(TitleContext* this) -{ +void Title_Draw(TitleContext* this) { static s16 sTitleRotY = 0; static u32 D_808009A4 = 0; static Lights1 sTitleLights = gdSPDefLights1(0x64, 0x64, 0x64, 0xFF, 0xFF, 0xFF, 0x45, 0x45, 0x45); @@ -106,40 +103,22 @@ void Title_Draw(TitleContext* this) gDPPipeSync(gfxCtx->polyOpa.p++); gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_2CYCLE); gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP); - gDPSetCombineLERP(gfxCtx->polyOpa.p++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); + gDPSetCombineLERP(gfxCtx->polyOpa.p++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, + ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 170, 255, 255, 255); gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 255, 128); - - gDPLoadMultiBlock(gfxCtx->polyOpa.p++, - &D_01001800, - 0x100, - 1, - G_IM_FMT_I, - G_IM_SIZ_8b, - 32, 32, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - 5, 5, - 2, 11); - - - for (idx = 0, y = 94; idx < 16; idx++, y += 2) - { - gDPLoadTextureBlock(gfxCtx->polyOpa.p++, - &D_01000000[0x180 * idx], - G_IM_FMT_I, - G_IM_SIZ_8b, - 192, 2, - 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->polyOpa.p++, 1, this->uls, (this->ult & 0x7F) - idx*4, 0, 0); - gSPTextureRectangle(gfxCtx->polyOpa.p++, 388, y << 2, 1156, (y+2)<<2, G_TX_RENDERTILE, 0, 0, 1024, 1024); + gDPLoadMultiBlock(gfxCtx->polyOpa.p++, &D_01001800, 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 2, 11); + + for (idx = 0, y = 94; idx < 16; idx++, y += 2) { + gDPLoadTextureBlock(gfxCtx->polyOpa.p++, &D_01000000[0x180 * idx], G_IM_FMT_I, G_IM_SIZ_8b, 192, 2, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + gDPSetTileSize(gfxCtx->polyOpa.p++, 1, this->uls, (this->ult & 0x7F) - idx * 4, 0, 0); + gSPTextureRectangle(gfxCtx->polyOpa.p++, 388, y << 2, 1156, (y + 2) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); } - - func_8007672C(this->state.gfxCtx, 0, 0, 0, (s16)this->coverAlpha, 2); @@ -148,8 +127,7 @@ void Title_Draw(TitleContext* this) func_800C6B54(&gfxArr, this->state.gfxCtx, "../z_title.c", 483); } -void Title_Update(TitleContext* this) -{ +void Title_Update(TitleContext* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; u32 pad; Gfx* gfxArr[4]; @@ -163,38 +141,33 @@ void Title_Update(TitleContext* this) func_80095248(this->state.gfxCtx, 0, 0, 0); Title_Calc(this); Title_Draw(this); - if (D_8012DBC0) - { + if (D_8012DBC0) { gfx[0] = gfxCtx->polyOpa.p; Title_PrintBuildInfo(&gfx); gfxCtx->polyOpa.p = gfx[0]; } - if (this->exit) - { + if (this->exit) { gSaveContext.seq_index = -1; gSaveContext.night_sfx = -1; gSaveContext.game_mode = 1; this->state.running = false; - this->state.init = Opening_Init; this->state.size = sizeof(OpeningContext); + SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); } func_800C6B54(&gfxArr, this->state.gfxCtx, "../z_title.c", 541); } -void Title_Destroy(TitleContext* this) -{ +void Title_Destroy(TitleContext* this) { func_800A9AD0(this, &this->sram); } -void Title_Init(TitleContext* this) -{ +void Title_Init(TitleContext* this) { u32 size = (u32)_nintendo_rogo_staticSegmentRomEnd - (u32)_nintendo_rogo_staticSegmentRomStart; u32 pad; this->staticSegment = Game_Alloc(&this->state, size, "../z_title.c", 611); osSyncPrintf("z_title.c\n"); - if (this->staticSegment == NULL) - { + if (this->staticSegment == NULL) { __assert("this->staticSegment != NULL", "../z_title.c", 614); } DmaMgr_SendRequest1(this->staticSegment, (u32)_nintendo_rogo_staticSegmentRomStart, size, "../z_title.c", 615);