From c13db6e2687a2c3da9959d3d02b0e651839b7692 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Thu, 6 Oct 2022 19:06:54 -0700 Subject: [PATCH] Cleanup PR commits outside play --- include/functions.h | 4 +-- include/regs.h | 28 +++++++++++-------- src/code/z_construct.c | 2 +- src/code/z_lights.c | 4 +-- src/code/z_message.c | 2 +- src/code/z_play.c | 2 +- .../ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c | 2 +- .../actors/ovl_En_Warp_tag/z_en_warp_tag.c | 2 +- tools/disasm/functions.txt | 4 +-- tools/namefixer.py | 2 ++ tools/sizes/code_functions.csv | 4 +-- 11 files changed, 32 insertions(+), 24 deletions(-) diff --git a/include/functions.h b/include/functions.h index 161e7dccca..cfaa334df5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1606,7 +1606,7 @@ LightNode* Lights_FindBufSlot(); void Lights_FreeNode(LightNode* light); void LightContext_Init(PlayState* play, LightContext* lightCtx); void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b); -void LightContext_SetFogProperties(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 near, s16 far); +void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 near, s16 far); Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx); void LightContext_InitList(PlayState* play, LightContext* lightCtx); void LightContext_DestroyList(PlayState* play, LightContext* lightCtx); @@ -3229,6 +3229,6 @@ u8 func_801A982C(void); void GameOver_Init(PlayState* play); void GameOver_FadeLights(PlayState* play); void GameOver_Update(PlayState* play); -void Construct_InitRegs(PlayState* play); +void Regs_InitData(PlayState* play); #endif diff --git a/include/regs.h b/include/regs.h index 6b0e04c7ad..90ccd39020 100644 --- a/include/regs.h +++ b/include/regs.h @@ -43,18 +43,31 @@ #define bREG(r) BASE_REG(28, r) /* TODO: Actually confirm these, in case of miss-match it's at least a simple list to `sed` */ -#define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT #define R_RUN_SPEED_LIMIT REG(45) + +#define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT #define R_UPDATE_RATE SREG(30) +#define R_FB_FILTER_TYPE SREG(80) +#define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + c) +#define R_FB_FILTER_A SREG(84) +#define R_FB_FILTER_ENV_COLOR(c) SREG(85 + c) +#define R_PICTOGRAPH_PHOTO_STATE SREG(89) +#define R_MOTION_BLUR_ALPHA SREG(90) +#define R_MOTION_BLUR_ENABLED SREG(91) +#define R_MOTION_BLUR_PRIORITY_ALPHA SREG(92) +#define R_MOTION_BLUR_PRIORITY_ENABLED SREG(93) #define R_PAUSE_MENU_MODE SREG(94) + #define R_PLAY_FILL_SCREEN_ON MREG(64) #define R_PLAY_FILL_SCREEN_R MREG(65) #define R_PLAY_FILL_SCREEN_G MREG(66) #define R_PLAY_FILL_SCREEN_B MREG(67) #define R_PLAY_FILL_SCREEN_ALPHA MREG(68) + #define R_PAUSE_WORLD_MAP_YAW YREG(24) #define R_PAUSE_WORLD_MAP_Y_OFFSET YREG(25) #define R_PAUSE_WORLD_MAP_DEPTH YREG(26) + #define R_MAGIC_FILL_COLOR(i) ZREG(0 + i) #define R_C_BTN_COLOR(i) ZREG(39 + i) #define R_B_BTN_COLOR(i) ZREG(43 + i) @@ -71,6 +84,7 @@ #define R_ITEM_ICON_X(i) ZREG(82 + i) #define R_ITEM_ICON_Y(i) ZREG(86 + i) #define R_ITEM_ICON_DD(i) ZREG(90 + i) + #define R_A_BTN_Y XREG(16) #define R_A_BTN_X XREG(17) #define R_A_ICON_Y XREG(19) @@ -85,6 +99,7 @@ #define R_PAUSE_OWLWARP_ALPHA XREG(87) #define R_REVERSE_FLOOR_INDEX XREG(94) #define R_MINIMAP_DISABLED XREG(95) + #define R_B_LABEL_DD WREG(0) #define R_OW_MINIMAP_X WREG(29) #define R_OW_MINIMAP_Y WREG(30) @@ -92,6 +107,7 @@ #define R_B_LABEL_Y(i) WREG(43 + i) #define R_DGN_MINIMAP_X WREG(68) #define R_DGN_MINIMAP_Y WREG(69) + #define R_MAP_INDEX VREG(11) #define R_MAP_TEX_INDEX_BASE VREG(12) #define R_MAP_TEX_INDEX VREG(13) @@ -105,16 +121,6 @@ #define R_ITEM_ICON_WIDTH(i) VREG(76 + i) #define R_ITEM_BTN_WIDTH(i) VREG(80 + i) -#define R_FB_FILTER_TYPE SREG(80) -#define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + c) -#define R_FB_FILTER_A SREG(84) -#define R_FB_FILTER_ENV_COLOR(c) SREG(85 + c) -#define R_PICTOGRAPH_PHOTO_STATE SREG(89) -#define R_MOTION_BLUR_ALPHA SREG(90) -#define R_MOTION_BLUR_ENABLED SREG(91) -#define R_MOTION_BLUR_PRIORITY_ALPHA SREG(92) -#define R_MOTION_BLUR_PRIORITY_ENABLED SREG(93) - #endif diff --git a/src/code/z_construct.c b/src/code/z_construct.c index 382292ca39..3d2621c9cb 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -1,5 +1,5 @@ #include "global.h" // Remnant from OoT -void Construct_InitRegs(PlayState* play) { +void Regs_InitData(PlayState* play) { } diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 43e769a44c..ac55894331 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -251,7 +251,7 @@ void Lights_FreeNode(LightNode* light) { void LightContext_Init(PlayState* play, LightContext* lightCtx) { LightContext_InitList(play, lightCtx); LightContext_SetAmbientColor(lightCtx, 80, 80, 80); - LightContext_SetFogProperties(lightCtx, 0, 0, 0, 996, 12800); + LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800); bzero(&sLightsBuffer, sizeof(LightsBuffer)); } @@ -261,7 +261,7 @@ void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b) { lightCtx->ambient.b = b; } -void LightContext_SetFogProperties(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 near, s16 far) { +void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 near, s16 far) { lightCtx->fogColor.r = r; lightCtx->fogColor.g = g; lightCtx->fogColor.b = b; diff --git a/src/code/z_message.c b/src/code/z_message.c index d278b46d14..b6626a4464 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -329,7 +329,7 @@ void func_80151938(PlayState* play, u16 textId) { } msgCtx->unk1203C = msgCtx->unk1203A; - if (play->pauseCtx.bombersNotebookOpen != 0) { + if (play->pauseCtx.bombersNotebookOpen) { msgCtx->unk12004 = 0x22; msgCtx->unk12006 = 0x15E; func_80149C18(play); diff --git a/src/code/z_play.c b/src/code/z_play.c index 96f7f86d5c..dc27fca2e7 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -2176,7 +2176,7 @@ void Play_Init(GameState* thisx) { func_800DFF18(&this->mainCamera, 0x7F); Sram_Alloc(&this->state, &this->sramCtx); - Construct_InitRegs(this); + Regs_InitData(this); Message_Init(this); GameOver_Init(this); SoundSource_InitAll(this); diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index cfd081609f..d897f776a9 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -328,7 +328,7 @@ void BgCraceMovebg_ClosingDoor_Close(BgCraceMovebg* this, PlayState* play) { if (Math_StepToF(&this->doorHeight, 0.0f, 1.0f)) { if (!(this->stateFlags & BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR) && !Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1)) { - play->haltAllActors = 1; + play->haltAllActors = true; Play_TriggerRespawn(&play->state); play_sound(NA_SE_OC_ABYSS); } diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index 5c0752428e..66081f3cd2 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -224,7 +224,7 @@ void EnWarpTag_RespawnPlayer(EnWarptag* this, PlayState* play) { if (new15E < 0) { new15E = 0; } - Play_SetMotionBlurAlpha(new15E * 0.04f); + Play_SetMotionBlurAlpha(new15E * (1 / 25.0f)); } } diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 46dbad98ba..10fec04c46 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1881,7 +1881,7 @@ 0x80102464:("Lights_FreeNode",), 0x801024AC:("LightContext_Init",), 0x80102518:("LightContext_SetAmbientColor",), - 0x80102544:("LightContext_SetFogProperties",), + 0x80102544:("LightContext_SetFog",), 0x80102580:("LightContext_NewLights",), 0x801025B8:("LightContext_InitList",), 0x801025C8:("LightContext_DestroyList",), @@ -4082,7 +4082,7 @@ 0x801AA610:("GameOver_Init",), 0x801AA624:("GameOver_FadeLights",), 0x801AA68C:("GameOver_Update",), - 0x801AAAA0:("Construct_InitRegs",), + 0x801AAAA0:("Regs_InitData",), 0x80800000:("ConsoleLogo_UpdateCounters",), 0x8080009C:("ConsoleLogo_RenderView",), 0x80800134:("ConsoleLogo_Draw",), diff --git a/tools/namefixer.py b/tools/namefixer.py index 4f596ecef9..9437f8e2f4 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -633,6 +633,8 @@ wordReplace = { "Entrance_CreateIndex": "Entrance_Create", "Entrance_CreateIndexFromSpawn": "Entrance_CreateFromSpawn", + "func_80102544": "LightContext_SetFog", + # Structs "ActorAnimationEntry": "AnimationInfo", "ActorAnimationEntryS": "AnimationInfoS", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 5fb24dce53..eb51e943f7 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1395,7 +1395,7 @@ asm/non_matchings/code/z_lights/Lights_FindBufSlot.s,Lights_FindBufSlot,0x801023 asm/non_matchings/code/z_lights/Lights_FreeNode.s,Lights_FreeNode,0x80102464,0x12 asm/non_matchings/code/z_lights/LightContext_Init.s,LightContext_Init,0x801024AC,0x1B asm/non_matchings/code/z_lights/LightContext_SetAmbientColor.s,LightContext_SetAmbientColor,0x80102518,0xB -asm/non_matchings/code/z_lights/LightContext_SetFogProperties.s,LightContext_SetFogProperties,0x80102544,0xF +asm/non_matchings/code/z_lights/LightContext_SetFog.s,LightContext_SetFog,0x80102544,0xF asm/non_matchings/code/z_lights/LightContext_NewLights.s,LightContext_NewLights,0x80102580,0xE asm/non_matchings/code/z_lights/LightContext_InitList.s,LightContext_InitList,0x801025B8,0x4 asm/non_matchings/code/z_lights/LightContext_DestroyList.s,LightContext_DestroyList,0x801025C8,0x17 @@ -3598,4 +3598,4 @@ asm/non_matchings/code/jpegdecoder/JpegDecoder_ReadBits.s,JpegDecoder_ReadBits,0 asm/non_matchings/code/z_game_over/GameOver_Init.s,GameOver_Init,0x801AA610,0x5 asm/non_matchings/code/z_game_over/GameOver_FadeLights.s,GameOver_FadeLights,0x801AA624,0x1A asm/non_matchings/code/z_game_over/GameOver_Update.s,GameOver_Update,0x801AA68C,0x105 -asm/non_matchings/code/z_construct/Construct_InitRegs.s,Construct_InitRegs,0x801AAAA0,0x4 +asm/non_matchings/code/z_construct/Regs_InitData.s,Regs_InitData,0x801AAAA0,0x4