From 811b2d6ad2215a00e9f80546d1a55319f0264205 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 15 May 2022 16:38:31 +0200 Subject: [PATCH] Fix misc 12 (#1222) * (light) `src` to `src/code/code_8006C510.c` * `setup + entrance` -> `entrance + setup` * Decimal for `gdSPDefLights1` args (colors, unit vector) * Run formatter * `firstDone` bool -> `materialFlag` * `ENTR_MAX`: 0x613 -> 0x614 * revert `materialFlag` to bool++ for now --- include/z64scene.h | 2 +- src/code/code_8006C3A0.c | 2 +- src/code/code_800FC620.c | 20 ++++++-------------- src/code/z_debug_display.c | 2 +- src/code/z_kankyo.c | 6 +++--- src/code/z_play.c | 2 +- src/overlays/gamestates/ovl_title/z_title.c | 2 +- 7 files changed, 14 insertions(+), 22 deletions(-) diff --git a/include/z64scene.h b/include/z64scene.h index 68183ad32b..dabe3bd85b 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -321,7 +321,7 @@ typedef enum { typedef enum { #include "tables/entrance_table.h" - /* 0x613 */ ENTR_MAX + /* 0x614 */ ENTR_MAX } EntranceIndex; #define ENTR_LOAD_OPENING -1 diff --git a/src/code/code_8006C3A0.c b/src/code/code_8006C3A0.c index 341a445956..928b13443c 100644 --- a/src/code/code_8006C3A0.c +++ b/src/code/code_8006C3A0.c @@ -3,7 +3,7 @@ void Flags_UnsetAllEnv(GlobalContext* globalCtx) { u8 i; - for (i = 0; i < 20; i++) { + for (i = 0; i < ARRAY_COUNT(globalCtx->envFlags); i++) { globalCtx->envFlags[i] = 0; } } diff --git a/src/code/code_800FC620.c b/src/code/code_800FC620.c index d268af5acc..74d64f717d 100644 --- a/src/code/code_800FC620.c +++ b/src/code/code_800FC620.c @@ -29,20 +29,19 @@ s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void* vRamStart, void* vRamEnd, voi u32 ovlOffset; u32 size; + size = vRomEnd - vRomStart; + end = (u32)allocatedVRamAddr + size; + if (gOverlayLogSeverity >= 3) { // "Start loading dynamic link function" osSyncPrintf("\nダイナミックリンクファンクションのロードを開始します\n"); } 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); + osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedVRamAddr, end); } - size = vRomEnd - vRomStart; - end = (u32)allocatedVRamAddr + size; DmaMgr_SendRequest0((u32)allocatedVRamAddr, vRomStart, size); ovlOffset = ((s32*)end)[-1]; @@ -101,7 +100,7 @@ void* func_800FC800(u32 size) { return __osMallocDebug(&gSystemArena, size, sNew, 0); } -// possible some kind of delete() function +// possibly some kind of delete() function void func_800FC83C(void* ptr) { if (ptr != NULL) { __osFree(&gSystemArena, ptr); @@ -144,25 +143,18 @@ void* func_800FC948(void* blk, u32 nBlk, u32 blkSize, arg3_800FC948 arg3) { void func_800FCA18(void* blk, u32 nBlk, u32 blkSize, arg3_800FCA18 arg3, s32 arg4) { u32 pos; u32 end; - s32 masked_arg2; if (blk == 0) { return; } if (arg3 != 0) { end = (u32)blk; - masked_arg2 = (s32)(blkSize & ~0); pos = (u32)end + (nBlk * blkSize); - if (masked_arg2) {} - while (pos > end) { - pos -= masked_arg2; + pos -= (s32)(blkSize & ~0); arg3((void*)pos, 2); - if (1) {} } - - if (!masked_arg2) {} } if (arg4 != 0) { diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index efa25dc893..c405d58df1 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -21,7 +21,7 @@ static DebugDispObjectInfo sDebugObjectInfoTable[] = { { 0, gDebugCursorTex }, { 1, gDebugArrowDL }, { 1, gDebugCameraDL }, }; -static Lights1 sDebugObjectLights = gdSPDefLights1(0x80, 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0x49, 0x49, 0x49); +static Lights1 sDebugObjectLights = gdSPDefLights1(128, 128, 128, 255, 255, 255, 73, 73, 73); static DebugDispObject* sDebugObjectListHead; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 105eac2847..5229081391 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1638,14 +1638,14 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext* // draw droplet rings on the ground if (player->actor.world.pos.y < view->eye.y) { - u8 firstDone = false; + u8 materialFlag = false; for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) { - if (!firstDone) { + if (!materialFlag) { func_80093D84(gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 120); - firstDone++; + materialFlag++; } Matrix_Translate(func_800746DC() * 280.0f + x280, player->actor.world.pos.y + 2.0f, diff --git a/src/code/z_play.c b/src/code/z_play.c index 9f283fee76..7aa115f1fc 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -298,7 +298,7 @@ void Gameplay_Init(GameState* thisx) { Gameplay_SpawnScene( globalCtx, gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].scene, - gEntranceTable[((void)0, gSaveContext.sceneSetupIndex) + ((void)0, gSaveContext.entranceIndex)].spawn); + gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].spawn); osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneSetupIndex); // When entering Gerudo Valley in the right setup, trigger the GC emulator to play the ending movie. diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index eac084d326..e8f6347748 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -56,7 +56,7 @@ void Title_SetupView(TitleContext* this, f32 x, f32 y, f32 z) { void Title_Draw(TitleContext* this) { static s16 sTitleRotY = 0; - static Lights1 sTitleLights = gdSPDefLights1(0x64, 0x64, 0x64, 0xFF, 0xFF, 0xFF, 0x45, 0x45, 0x45); + static Lights1 sTitleLights = gdSPDefLights1(100, 100, 100, 255, 255, 255, 69, 69, 69); u16 y; u16 idx;