From ea40688e4a20cd6d3f3d4120ad9fa82785381fbc Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 24 Aug 2024 14:18:48 +0200 Subject: [PATCH] [ntsc-1.2] Match z_kaleido_debug.c, z_lmap_mark.c (#2077) * Match z_kaleido_debug.c, z_lmap_mark.c * consistent style for n64dd callbacks calls --- include/n64dd.h | 5 ++++- src/code/code_n64dd_800AD4C0.c | 6 ++---- src/code/z_kaleido_setup.c | 12 ++++-------- src/code/z_scene_table.c | 2 +- .../misc/ovl_kaleido_scope/z_kaleido_debug.c | 5 +++++ src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c | 13 +++++++++++++ 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/include/n64dd.h b/include/n64dd.h index 85ffc02263..c57d30454d 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -1,6 +1,7 @@ #ifndef N64DD_H #define N64DD_H +#include "z64pause.h" #include "z64scene.h" struct RegEditor; @@ -22,7 +23,9 @@ struct PlayState; typedef struct n64ddStruct_80121AF0 { void (*unk_00)(n64ddStruct_800FF4B0_pointers*, struct n64ddStruct_80121AF0*); void (*unk_04)(void); - char unk_08[0x34]; + char unk_08[0x2C]; + void (*unk_34)(PauseMapMarksData**); + void (*unk_38)(PauseMapMarksData**); void (*unk_3C)(void); void (*unk_40)(void); s32 (*unk_44)(struct PlayState*); diff --git a/src/code/code_n64dd_800AD4C0.c b/src/code/code_n64dd_800AD4C0.c index 858348d2bf..091597a04a 100644 --- a/src/code/code_n64dd_800AD4C0.c +++ b/src/code/code_n64dd_800AD4C0.c @@ -68,10 +68,8 @@ n64ddStruct_80121AF0* func_800ADB30(n64ddStruct_80121AF0* arg0) { } void func_800ADB8C(void) { - if (B_80121AF0 != NULL) { - if (B_80121AF0->unk_04 != NULL) { - B_80121AF0->unk_04(); - } + if ((B_80121AF0 != NULL) && (B_80121AF0->unk_04 != NULL)) { + B_80121AF0->unk_04(); } B_80121AF0 = NULL; } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 1f4f2d2cda..9875277123 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -177,20 +177,16 @@ void KaleidoSetup_Init(PlayState* play) { View_Init(&pauseCtx->view, play->state.gfxCtx); #if PLATFORM_N64 - if (B_80121AF0 != NULL) { - if (B_80121AF0->unk_3C != NULL) { - B_80121AF0->unk_3C(); - } + if ((B_80121AF0 != NULL) && (B_80121AF0->unk_3C != NULL)) { + B_80121AF0->unk_3C(); } #endif } void KaleidoSetup_Destroy(PlayState* play) { #if PLATFORM_N64 - if (B_80121AF0 != NULL) { - if (B_80121AF0->unk_40 != NULL) { - B_80121AF0->unk_40(); - } + if ((B_80121AF0 != NULL) && (B_80121AF0->unk_40 != NULL)) { + B_80121AF0->unk_40(); } #endif } diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 0317844921..2879a3fa4e 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -196,7 +196,7 @@ SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { }; void Scene_Draw(PlayState* play) { - if (B_80121AF0 != NULL && B_80121AF0->unk_6C != NULL) { + if ((B_80121AF0 != NULL) && (B_80121AF0->unk_6C != NULL)) { B_80121AF0->unk_6C(play, sSceneDrawConfigs); return; } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index bdd17f0119..6cf75817a5 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -605,6 +605,11 @@ void KaleidoScope_DrawDebugEditor(PlayState* play) { } else if (curSection == 0x5B) { if (CHECK_BTN_ALL(input->press.button, BTN_CUP) || CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { gSaveContext.save.info.inventory.gsTokens++; +#if PLATFORM_N64 + if (gSaveContext.save.info.inventory.gsTokens >= 100) { + gSaveContext.save.info.inventory.gsTokens = 100; + } +#endif } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN) || CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { gSaveContext.save.info.inventory.gsTokens--; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 6b8b0d2f28..b285aaa52d 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -1,3 +1,6 @@ +#if PLATFORM_N64 +#include "n64dd.h" +#endif #include "z_kaleido_scope.h" #include "assets/textures/parameter_static/parameter_static.h" @@ -27,9 +30,19 @@ void PauseMapMark_Init(PlayState* play) { gBossMarkState = 0; gBossMarkScale = 1.0f; gLoadedPauseMarkDataTable = gPauseMapMarkDataTable; +#if PLATFORM_N64 + if ((B_80121AF0 != NULL) && (B_80121AF0->unk_34 != NULL)) { + B_80121AF0->unk_34(&gLoadedPauseMarkDataTable); + } +#endif } void PauseMapMark_Clear(PlayState* play) { +#if PLATFORM_N64 + if ((B_80121AF0 != NULL) && (B_80121AF0->unk_38 != NULL)) { + B_80121AF0->unk_38(&gLoadedPauseMarkDataTable); + } +#endif gLoadedPauseMarkDataTable = NULL; }