From 98891b73348221334507e234f3f2c9c53f1b9ae3 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Tue, 21 Oct 2025 12:02:53 -0500 Subject: [PATCH] Fix custom Palette Idle action (#946) * Palette Idle fixes - Return to Idle only from palette editor action - disallow cap toggles if cap is missing * The Peachy review --- src/game/camera.c | 10 +++++++--- src/game/mario_actions_stationary.c | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/game/camera.c b/src/game/camera.c index e095a4d09..15de4b863 100644 --- a/src/game/camera.c +++ b/src/game/camera.c @@ -10947,10 +10947,12 @@ void cutscene_palette_editor(struct Camera *c) { return; } + bool capMissing = !(m->flags & (MARIO_CAP_ON_HEAD | MARIO_CAP_IN_HAND)); + // Press the Z bind to toggle cap static bool pressed = false; if (gInteractablePad.button & PAD_BUTTON_Z) { - if (!pressed && m->action == ACT_IDLE) { + if (!capMissing && !pressed && m->action == ACT_IDLE) { set_mario_action(m, ACT_PALETTE_EDITOR_CAP, (m->flags & MARIO_CAP_ON_HEAD) != 0); } pressed = true; @@ -10962,8 +10964,10 @@ void cutscene_palette_editor(struct Camera *c) { if (gDjuiPaletteToggle) { djui_base_set_visible( &gDjuiPaletteToggle->base, - m->action == ACT_IDLE || - m->action == ACT_PALETTE_EDITOR_CAP + ( + m->action == ACT_IDLE || + m->action == ACT_PALETTE_EDITOR_CAP + ) && !capMissing ); } diff --git a/src/game/mario_actions_stationary.c b/src/game/mario_actions_stationary.c index 05334b243..8fe099c85 100644 --- a/src/game/mario_actions_stationary.c +++ b/src/game/mario_actions_stationary.c @@ -1162,13 +1162,20 @@ s32 act_first_person(struct MarioState *m) { } s32 mario_exit_palette_editor(struct MarioState *m, struct Camera *c) { + if (!(m->flags & (MARIO_CAP_ON_HEAD | MARIO_CAP_IN_HAND))) { + return FALSE; + } + switch (c->paletteEditorCapState) { case 0: return FALSE; case 1: cutscene_put_cap_on(m); break; case 2: cutscene_take_cap_off(m); break; } c->paletteEditorCapState = 0; - return set_mario_action(m, ACT_IDLE, 0); + if (m->action == ACT_PALETTE_EDITOR_CAP) { + set_mario_action(m, ACT_IDLE, 0); + } + return TRUE; } s32 act_palette_editor_cap(struct MarioState *m) {