diff options
| author | Random <28494085+Random06457@users.noreply.github.com> | 2020-07-09 03:54:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-08 21:54:39 -0400 |
| commit | b4a7ac9d71e1525cbcf22ea7bc394a84036ab148 (patch) | |
| tree | bbfc70b5066d10256e2991d14e869bd6db1e4372 /src/code | |
| parent | 7f6e9d55fe7447ca70d502e1c513e40e5f0ee9a8 (diff) | |
Decompile shrink_window.c (#232)
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/db_camera.c | 14 | ||||
| -rw-r--r-- | src/code/shrink_window.c | 99 | ||||
| -rw-r--r-- | src/code/z_demo.c | 8 | ||||
| -rw-r--r-- | src/code/z_kaleido_scope_call.c | 2 | ||||
| -rw-r--r-- | src/code/z_kaleido_setup.c | 4 | ||||
| -rw-r--r-- | src/code/z_play.c | 6 | ||||
| -rw-r--r-- | src/code/z_rcp.c | 2 | ||||
| -rw-r--r-- | src/code/z_view.c | 2 |
8 files changed, 111 insertions, 26 deletions
diff --git a/src/code/db_camera.c b/src/code/db_camera.c index b1e858e63..b693051d9 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,20 +1,6 @@ #include <ultra64.h> #include <global.h> -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3840.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3898.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B38A4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B38FC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3908.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3968.s") - -#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B39B8.s") - #pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3B50.s") #pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3BD4.s") diff --git a/src/code/shrink_window.c b/src/code/shrink_window.c new file mode 100644 index 000000000..212195ce6 --- /dev/null +++ b/src/code/shrink_window.c @@ -0,0 +1,99 @@ +#include <global.h> + +s32 D_8012CED0 = 0; + +s32 sShrinkWindowVal = 0; + +s32 sShrinkWindowCurrentVal = 0; + +void ShrinkWindow_SetVal(s32 value) { + + if (HREG(80) == 0x13 && HREG(81) == 1) { + osSyncPrintf("shrink_window_setval(%d)\n", value); + } + sShrinkWindowVal = value; +} + +u32 ShrinkWindow_GetVal(void) { + return sShrinkWindowVal; +} + +void ShrinkWindow_SetCurrentVal(s32 currentVal) { + if (HREG(80) == 0x13 && HREG(81) == 1) { + osSyncPrintf("shrink_window_setnowval(%d)\n", currentVal); + } + sShrinkWindowCurrentVal = currentVal; +} + +u32 ShrinkWindow_GetCurrentVal(void) { + return sShrinkWindowCurrentVal; +} + +void ShrinkWindow_Init(void) { + if (HREG(80) == 0x13 && HREG(81) == 1) { + osSyncPrintf("shrink_window_init()\n"); + } + D_8012CED0 = 0; + sShrinkWindowVal = 0; + sShrinkWindowCurrentVal = 0; +} + +void ShrinkWindow_Destroy(void) { + if (HREG(80) == 0x13 && HREG(81) == 1) { + osSyncPrintf("shrink_window_cleanup()\n"); + } + sShrinkWindowCurrentVal = 0; +} + +void ShrinkWindow_Update(s32 updateRate) { + s32 off; + + if (updateRate == 3) { + off = 10; + } else { + off = 30 / updateRate; + } + + if (sShrinkWindowCurrentVal < sShrinkWindowVal) { + if (D_8012CED0 != 1) { + D_8012CED0 = 1; + } + + if (sShrinkWindowCurrentVal + off < sShrinkWindowVal) { + sShrinkWindowCurrentVal += off; + } else { + sShrinkWindowCurrentVal = sShrinkWindowVal; + } + } else if (sShrinkWindowVal < sShrinkWindowCurrentVal) { + if (D_8012CED0 != 2) { + D_8012CED0 = 2; + } + + if (sShrinkWindowVal < sShrinkWindowCurrentVal - off) { + sShrinkWindowCurrentVal -= off; + } else { + sShrinkWindowCurrentVal = sShrinkWindowVal; + } + } else { + D_8012CED0 = 0; + } + + if (HREG(80) == 0x13) { + if (HREG(94) != 0x13) { + HREG(94) = 0x13; + HREG(81) = 0; + HREG(82) = 0; + HREG(83) = 0; + HREG(84) = 0; + HREG(85) = 0; + HREG(86) = 0; + HREG(87) = 0; + HREG(88) = 0; + HREG(89) = 0; + } + HREG(83) = D_8012CED0; + HREG(84) = sShrinkWindowCurrentVal; + HREG(85) = sShrinkWindowVal; + HREG(86) = off; + } +} diff --git a/src/code/z_demo.c b/src/code/z_demo.c index f0bc2a333..459187611 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -137,7 +137,7 @@ u32 func_8006472C(GlobalContext* globalCtx, CutsceneContext* csCtx, f32 target) void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) { Interface_ChangeAlpha(1); - func_800B3840(0x20); + ShrinkWindow_SetVal(0x20); if (func_8006472C(globalCtx, csCtx, 1.0f)) { func_800F68BC(1); @@ -148,7 +148,7 @@ void func_80064760(GlobalContext* globalCtx, CutsceneContext* csCtx) { void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) { func_80068C3C(globalCtx, csCtx); Interface_ChangeAlpha(1); - func_800B3840(0x20); + ShrinkWindow_SetVal(0x20); if (func_8006472C(globalCtx, csCtx, 1.0f)) { func_800F68BC(1); @@ -1964,8 +1964,8 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { if (gSaveContext.cutsceneTrigger == 0) { Interface_ChangeAlpha(1); - func_800B3840(0x20); - func_800B38A4(0x20); + ShrinkWindow_SetVal(0x20); + ShrinkWindow_SetCurrentVal(0x20); csCtx->state++; } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 8ceeb6334..0baf2654b 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -54,7 +54,7 @@ void KaleidoScopeCall_Update(GlobalContext* globalCtx) { if (pauseCtx->state != 0 || pauseCtx->flag != 0) { if (pauseCtx->state == 1) { - if (func_800B38FC() == 0) { + if (ShrinkWindow_GetCurrentVal() == 0) { HREG(80) = 7; HREG(82) = 3; R_PAUSE_MENU_MODE = 1; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 3d6e5739e..4e8fcacc9 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -77,8 +77,8 @@ void KaleidoSetup_Update(GlobalContext* globalCtx) { if (pauseCtx->state == 1) { WREG(2) = -0x1860; R_UPDATE_RATE = 2; - if (func_800B3898()) { - func_800B3840(0); + if (ShrinkWindow_GetVal()) { + ShrinkWindow_SetVal(0); } func_800F64E0(1); } diff --git a/src/code/z_play.c b/src/code/z_play.c index 26b44c394..b475b0ae0 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -172,7 +172,7 @@ void Gameplay_Destroy(GlobalContext* globalCtx) { globalCtx->transitionMode = 0; } - func_800B3968(); + ShrinkWindow_Destroy(); TransitionFade_Destroy(&globalCtx->transitionFade); VisMono_Destroy(&D_80161498); @@ -360,7 +360,7 @@ void Gameplay_Init(GlobalContext* globalCtx) { globalCtx->fadeTransition = 6; } - func_800B3908(); + ShrinkWindow_Init(); TransitionFade_Init(&globalCtx->transitionFade); TransitionFade_SetType(&globalCtx->transitionFade, 3); TransitionFade_SetColor(&globalCtx->transitionFade, RGBA8(0xA0, 0xA0, 0xA0, 0xFF)); @@ -998,7 +998,7 @@ void Gameplay_Update(GlobalContext* globalCtx) { LOG_NUM("1", 1, "../z_play.c", 3777); } - func_800B39B8(R_UPDATE_RATE); + ShrinkWindow_Update(R_UPDATE_RATE); if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3783); diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 511cf8447..750d353c0 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1471,7 +1471,7 @@ void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { gDPSetDepthImage(gfxCtx->overlay.p++, gZBuffer); if ((R_PAUSE_MENU_MODE < 2) && (gTrnsnUnkState < 2)) { - ret = func_800B38FC(); + ret = ShrinkWindow_GetCurrentVal(); if (HREG(80) == 16) { if (HREG(95) != 16) { diff --git a/src/code/z_view.c b/src/code/z_view.c index 63de9688d..b0566e7a4 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -138,7 +138,7 @@ void func_800AA550(View* view) { gfxCtx = view->gfxCtx; - varY = func_800B38FC(); + varY = ShrinkWindow_GetCurrentVal(); varX = -1; // The following is optimized to varX = 0 but affects codegen |
