From 82c6c9c4872a8fa46bf7f7886655ad1a1c5e5dac Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Thu, 4 Jun 2026 00:05:44 -0500 Subject: [PATCH 01/16] bubble a bit better - killed `gLocalBubbleCounter` and its unused buddies - just use `m->actionTimer`... - no more buggy popping when everyone dies - stay in your bubble, die in your bubble - bettered `mario_can_bubble` - C: --- src/game/mario.c | 13 ++----------- src/game/mario_actions_automatic.c | 10 ++++------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/game/mario.c b/src/game/mario.c index 3e7135352..b4f17a17f 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -47,10 +47,6 @@ #define MAX_HANG_PREVENTION 64 -u32 unused80339F10; -s8 filler80339F1C[20]; -u16 gLocalBubbleCounter = 0; - /************************************************** * ANIMATIONS * @@ -426,17 +422,14 @@ bool mario_can_bubble(struct MarioState* m) { if (m->action == ACT_BUBBLED) { return false; } if (!m->visibleToObjects) { return false; } - u8 allInBubble = TRUE; for (s32 i = 1; i < MAX_PLAYERS; i++) { if (!is_player_active(&gMarioStates[i])) { continue; } if (!gMarioStates[i].visibleToObjects) { continue; } if (gMarioStates[i].action != ACT_BUBBLED && gMarioStates[i].health >= 0x100) { - allInBubble = FALSE; - break; + return true; } } - if (allInBubble) { return false; } - return true; + return false; } void mario_set_bubbled(struct MarioState* m) { @@ -444,8 +437,6 @@ void mario_set_bubbled(struct MarioState* m) { if (m->playerIndex != 0) { return; } if (m->action == ACT_BUBBLED) { return; } - gLocalBubbleCounter = 20; - drop_and_set_mario_action(m, ACT_BUBBLED, 0); if (m->numLives > 0) { m->numLives--; diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 1a8bca341..b8b76fa1f 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -1070,14 +1070,14 @@ s32 act_bubbled(struct MarioState* m) { for (s32 i = 0; i < MAX_PLAYERS; i++) { if (!is_player_active(&gMarioStates[i])) { continue; } if (!gMarioStates[i].visibleToObjects) { continue; } - if (gMarioStates[i].action != ACT_BUBBLED && gMarioStates[i].health >= 0x100) { + if (gMarioStates[i].action != ACT_BUBBLED) { allInBubble = FALSE; break; } } if (allInBubble) { level_trigger_warp(m, WARP_OP_DEATH); - return set_mario_action(m, ACT_SOFT_BONK, 0); + return FALSE; } } @@ -1149,16 +1149,14 @@ s32 act_bubbled(struct MarioState* m) { if (m->numLives <= -1) { m->marioObj->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; level_trigger_warp(m, WARP_OP_DEATH); - return set_mario_action(m, ACT_SOFT_BONK, 0); + return FALSE; } else { m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; } } - if (gLocalBubbleCounter > 0) { gLocalBubbleCounter--; } - // pop bubble - if (m->playerIndex == 0 && distanceToPlayer < 120 && is_player_active(targetMarioState) && m->numLives != -1 && gLocalBubbleCounter == 0) { + if (m->playerIndex == 0 && distanceToPlayer < 120 && is_player_active(targetMarioState) && m->numLives != -1 && ++m->actionTimer > 20) { mario_pop_bubble(m); return TRUE; } From d07818b6f13bc1971f96c27eff2183b0c57fee5e Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Thu, 4 Jun 2026 02:48:33 -0500 Subject: [PATCH 02/16] oop add delay to bubble exit TODO: solve extra life loss --- src/game/mario.c | 1 - src/game/mario.h | 1 - src/game/mario_actions_automatic.c | 9 +++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/game/mario.c b/src/game/mario.c index b4f17a17f..ac01969fe 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -2207,7 +2207,6 @@ void init_single_mario(struct MarioState* m) { u16 playerIndex = m->playerIndex; struct SpawnInfo* spawnInfo = &gPlayerSpawnInfos[playerIndex]; - unused80339F10 = 0; m->freeze = 0; diff --git a/src/game/mario.h b/src/game/mario.h index 897178043..558baaee0 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -6,7 +6,6 @@ #include "macros.h" #include "types.h" -extern u16 gLocalBubbleCounter; struct WallCollisionData; /* |description| diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index b8b76fa1f..4ac9cb242 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -1064,7 +1064,7 @@ s32 act_bubbled(struct MarioState* m) { s32 pitchToPlayer = obj_pitch_to_object(m->marioObj, target); s32 distanceToPlayer = dist_between_objects(m->marioObj, target); - // trigger warp if all are bubbled + // trigger warp if all are bubbled long enough if (m->playerIndex == 0) { u8 allInBubble = TRUE; for (s32 i = 0; i < MAX_PLAYERS; i++) { @@ -1076,9 +1076,10 @@ s32 act_bubbled(struct MarioState* m) { } } if (allInBubble) { - level_trigger_warp(m, WARP_OP_DEATH); - return FALSE; - } + if (m->actionState++ == 60) { + level_trigger_warp(m, WARP_OP_DEATH); + } + } else { m->actionState = 0; } } // create bubble From b28a7fd7410d7e77f8bd492e3976724bee70198b Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Tue, 9 Jun 2026 03:59:54 -0500 Subject: [PATCH 03/16] Snip dead code, rename variables for Hacker parity --- autogen/lua_definitions/constants.lua | 28 ++++++----- autogen/lua_definitions/functions.lua | 4 +- docs/lua/constants.md | 17 +++++-- docs/lua/functions-3.md | 6 +-- src/game/ingame_menu.c | 4 +- src/game/level_update.c | 70 +++++++++++---------------- src/game/level_update.h | 38 ++++++--------- src/game/mario_actions_cutscene.c | 10 ++-- src/menu/star_select.c | 10 +--- src/pc/lua/smlua_constants_autogen.c | 12 +++-- src/pc/lua/smlua_functions_autogen.c | 2 +- 11 files changed, 90 insertions(+), 111 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 031d03b27..54371ceb8 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -3592,20 +3592,22 @@ WARP_OP_EXIT = 0x21 --- @type integer WARP_OP_TRIGGERS_LEVEL_SELECT = 0x10 ---- @type integer -SPECIAL_WARP_CAKE = -1 +WARP_SPECIAL_LEVEL_SELECT = -9 --- @type SpecialWarpDestinations +WARP_SPECIAL_INTRO_SPLASH_SCREEN = -8 --- @type SpecialWarpDestinations +WARP_SPECIAL_SWITCH_FILE = -7 --- @type SpecialWarpDestinations +WARP_SPECIAL_MARIO_HEAD_DIZZY = -3 --- @type SpecialWarpDestinations +WARP_SPECIAL_MARIO_HEAD_REGULAR = -2 --- @type SpecialWarpDestinations +WARP_SPECIAL_ENDING = -1 --- @type SpecialWarpDestinations +WARP_SPECIAL_NONE = 0 --- @type SpecialWarpDestinations ---- @type integer -SPECIAL_WARP_GODDARD = -2 - ---- @type integer -SPECIAL_WARP_GODDARD_GAMEOVER = -3 - ---- @type integer -SPECIAL_WARP_TITLE = -8 - ---- @type integer -SPECIAL_WARP_LEVEL_SELECT = -9 +--- @alias SpecialWarpDestinations +--- | `WARP_SPECIAL_LEVEL_SELECT` +--- | `WARP_SPECIAL_INTRO_SPLASH_SCREEN` +--- | `WARP_SPECIAL_SWITCH_FILE` +--- | `WARP_SPECIAL_MARIO_HEAD_DIZZY` +--- | `WARP_SPECIAL_MARIO_HEAD_REGULAR` +--- | `WARP_SPECIAL_ENDING` +--- | `WARP_SPECIAL_NONE` MARIO_SPAWN_NONE = 0 --- @type MarioSpawnType MARIO_SPAWN_DOOR_WARP = 1 --- @type MarioSpawnType diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 96a69fe39..b1b1ddc27 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5264,8 +5264,8 @@ function level_trigger_warp(m, warpOp) -- ... end ---- @param arg integer ---- Special warps to arg (`SPECIAL_WARP_*`) +--- @param arg SpecialWarpDestinations +--- Special warps to arg (`WARP_SPECIAL_*`) function warp_special(arg) -- ... end diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 09101617a..c5c867768 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -41,6 +41,7 @@ - [level_defines.h](#level_definesh) - [enum LevelNum](#enum-LevelNum) - [level_update.h](#level_updateh) + - [enum SpecialWarpDestinations](#enum-SpecialWarpDestinations) - [enum MarioSpawnType](#enum-MarioSpawnType) - [enum HUDDisplayFlag](#enum-HUDDisplayFlag) - [lighting_engine.h](#lighting_engineh) @@ -1605,11 +1606,17 @@ - WARP_OP_FORCE_SYNC - WARP_OP_EXIT - WARP_OP_TRIGGERS_LEVEL_SELECT -- SPECIAL_WARP_CAKE -- SPECIAL_WARP_GODDARD -- SPECIAL_WARP_GODDARD_GAMEOVER -- SPECIAL_WARP_TITLE -- SPECIAL_WARP_LEVEL_SELECT + +### [enum SpecialWarpDestinations](#SpecialWarpDestinations) +| Identifier | Value | +| :--------- | :---- | +| WARP_SPECIAL_LEVEL_SELECT | -9 | +| WARP_SPECIAL_INTRO_SPLASH_SCREEN | -8 | +| WARP_SPECIAL_SWITCH_FILE | -7 | +| WARP_SPECIAL_MARIO_HEAD_DIZZY | -3 | +| WARP_SPECIAL_MARIO_HEAD_REGULAR | -2 | +| WARP_SPECIAL_ENDING | -1 | +| WARP_SPECIAL_NONE | 0 | ### [enum MarioSpawnType](#MarioSpawnType) | Identifier | Value | diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index bfa5ffcf9..fd4c655c0 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -7101,7 +7101,7 @@ Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m` ## [warp_special](#warp_special) ### Description -Special warps to arg (`SPECIAL_WARP_*`) +Special warps to arg (`WARP_SPECIAL_*`) ### Lua Example `warp_special(arg)` @@ -7109,13 +7109,13 @@ Special warps to arg (`SPECIAL_WARP_*`) ### Parameters | Field | Type | | ----- | ---- | -| arg | `integer` | +| arg | [enum SpecialWarpDestinations](constants.md#enum-SpecialWarpDestinations) | ### Returns - None ### C Prototype -`void warp_special(s32 arg);` +`void warp_special(enum SpecialWarpDestinations arg);` [:arrow_up_small:](#) diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index ac984fad6..39c47dc26 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -3172,8 +3172,8 @@ void print_hud_course_complete_coins(s16 x, s16 y) { void play_star_fanfare_and_flash_hud(s32 arg, u8 starNum) { if (gHudDisplay.coins == gCourseCompleteCoins && (gCurrCourseStarFlags & starNum) == 0 && gHudFlash == 0) { gCurrCourseStarFlags |= starNum; // SM74 was spamming fanfare without this line - if (gFanFareDebounce <= 0) { - gFanFareDebounce = 30 * 5; + if (gFanfareDebounce <= 0) { + gFanfareDebounce = 30 * 5; play_star_fanfare(); } gHudFlash = arg; diff --git a/src/game/level_update.c b/src/game/level_update.c index 02b821633..1de4fcdee 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -57,9 +57,7 @@ #define MENU_LEVEL_MIN 0 #define MENU_LEVEL_MAX 17 -struct SavedWarpValues gReceiveWarp = { 0 }; -extern s8 sReceivedLoadedActNum; -u16 gFanFareDebounce = 0; +u16 gFanfareDebounce = 0; s16 gChangeLevel = -1; s16 gChangeLevelTransition = -1; @@ -187,11 +185,10 @@ struct CreditsEntry sCreditsSequence[] = { struct MarioState gMarioStates[MAX_PLAYERS] = { 0 }; struct HudDisplay gHudDisplay; s16 sCurrPlayMode; -u16 D_80339ECA; s16 sTransitionTimer; void (*sTransitionUpdate)(s16 *); struct WarpDest sWarpDest; -s16 D_80339EE0; +s16 sSpecialWarpDest; s16 sDelayedWarpOp; s16 sDelayedWarpTimer; s16 sSourceWarpNodeId; @@ -203,10 +200,7 @@ s8 sTimerRunning; bool gNeverEnteredCastle; struct MarioState *gMarioState = &gMarioStates[0]; -u8 unused1[4] = { 0 }; s8 sWarpCheckpointActive = FALSE; -u8 unused3[4]; -u8 unused4[2]; u32 gControlTimerStartNat = 0; u32 gControlTimerStopNat = 0; @@ -271,18 +265,16 @@ bool pressed_pause(void) { void set_play_mode(s16 playMode) { sCurrPlayMode = playMode; - D_80339ECA = 0; } -void warp_special(s32 arg) { - if (arg != 0 && arg != SPECIAL_WARP_CAKE && arg != SPECIAL_WARP_GODDARD && arg != SPECIAL_WARP_GODDARD_GAMEOVER && arg != SPECIAL_WARP_TITLE && arg != SPECIAL_WARP_LEVEL_SELECT) { - LOG_ERROR("Invalid parameter value for warp_special: Expected 0, SPECIAL_WARP_CAKE, SPECIAL_WARP_GODDARD, SPECIAL_WARP_GODDARD_GAMEOVER, SPECIAL_WARP_TITLE, or SPECIAL_WARP_LEVEL_SELECT"); +void warp_special(enum SpecialWarpDestinations arg) { + if (arg > 0 || arg < -9 || (arg < -3 && arg > -7)) { + LOG_ERROR("Invalid parameter value for warp_special: %i", arg); return; } sCurrPlayMode = PLAY_MODE_CHANGE_LEVEL; - D_80339ECA = 0; - D_80339EE0 = arg; + sSpecialWarpDest = arg; } void fade_into_special_warp(u32 arg, u32 color) { @@ -1043,12 +1035,12 @@ void initiate_delayed_warp(void) { reset_dialog_render_state(); if (gDebugLevelSelect && (sDelayedWarpOp & WARP_OP_TRIGGERS_LEVEL_SELECT)) { - warp_special(SPECIAL_WARP_LEVEL_SELECT); + warp_special(WARP_SPECIAL_LEVEL_SELECT); } else if (gCurrDemoInput != NULL) { if (sDelayedWarpOp == WARP_OP_DEMO_END) { - warp_special(SPECIAL_WARP_TITLE); + warp_special(WARP_SPECIAL_INTRO_SPLASH_SCREEN); } else { - warp_special(SPECIAL_WARP_GODDARD); + warp_special(WARP_SPECIAL_MARIO_HEAD_REGULAR); } } else { switch (sDelayedWarpOp) { @@ -1059,14 +1051,14 @@ void initiate_delayed_warp(void) { break; case WARP_OP_CREDITS_END: - warp_special(SPECIAL_WARP_CAKE); + warp_special(WARP_SPECIAL_ENDING); sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL & ~SOUND_BANKS_DISABLED_AFTER_CREDITS); break; case WARP_OP_DEMO_NEXT: if (!gDjuiInMainMenu) { - warp_special(SPECIAL_WARP_GODDARD); + warp_special(WARP_SPECIAL_MARIO_HEAD_REGULAR); } break; @@ -1093,7 +1085,7 @@ void initiate_delayed_warp(void) { if ((gCurrCreditsEntry != NULL) && (gCurrCreditsEntry->levelNum == gLevelValues.skipCreditsAt)) { lvl_skip_credits(); } else if (gCurrCreditsEntry != NULL) { - gCurrActNum = gCurrCreditsEntry->unk02 & 0x07; + gCurrActNum = gCurrCreditsEntry->actNum & 0x07; if (gCurrCreditsEntry->levelNum == LEVEL_CASTLE_GROUNDS && gDjuiInMainMenu) { gCurrCreditsEntry = &sCreditsSequence[1]; destWarpNode = WARP_NODE_CREDITS_NEXT; @@ -1337,28 +1329,20 @@ s32 play_mode_normal(void) { // If either initiate_painting_warp or initiate_delayed_warp initiated a // warp, change play mode accordingly. if (sCurrPlayMode == PLAY_MODE_NORMAL || sCurrPlayMode == PLAY_MODE_PAUSED) { - if (gCurrCreditsEntry != NULL && gCurrCreditsEntry != &sCreditsSequence[0]) { - // special case for credit warps - if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) { - set_play_mode(PLAY_MODE_CHANGE_LEVEL); - } else if (sTransitionTimer != 0) { - set_play_mode(PLAY_MODE_CHANGE_AREA); - } - } else if (!gReceiveWarp.received) { - if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) { - set_play_mode(PLAY_MODE_CHANGE_LEVEL); - } else if (sTransitionTimer != 0) { - set_play_mode(PLAY_MODE_CHANGE_AREA); - } else if (sCurrPlayMode == PLAY_MODE_NORMAL && pressed_pause()) { - lower_background_noise(1); - cancel_rumble(); - gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN; - set_play_mode(PLAY_MODE_PAUSED); - } + if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) { + set_play_mode(PLAY_MODE_CHANGE_LEVEL); + } else if (sTransitionTimer != 0) { + set_play_mode(PLAY_MODE_CHANGE_AREA); + } else if ( + (gCurrCreditsEntry == NULL || gCurrCreditsEntry == &sCreditsSequence[0]) && + (sCurrPlayMode == PLAY_MODE_NORMAL && pressed_pause())) { + lower_background_noise(1); + cancel_rumble(); + gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN; + set_play_mode(PLAY_MODE_PAUSED); } } - return 0; } @@ -1482,7 +1466,7 @@ s32 play_mode_change_level(void) { if (sWarpDest.type != WARP_TYPE_NOT_WARPING) { return sWarpDest.levelNum; } else { - return D_80339EE0; + return sSpecialWarpDest; } } @@ -1499,7 +1483,7 @@ UNUSED static s32 play_mode_unused(void) { if (sWarpDest.type != WARP_TYPE_NOT_WARPING) { return sWarpDest.levelNum; } else { - return D_80339EE0; + return sSpecialWarpDest; } } @@ -1745,7 +1729,7 @@ s32 update_level(void) { } sCancelNextActSelector = gDjuiInMainMenu; - if (gFanFareDebounce > 0) { gFanFareDebounce--; } + if (gFanfareDebounce > 0) { gFanfareDebounce--; } s32 changeLevel = 0; @@ -1793,7 +1777,7 @@ s32 init_level(void) { sDelayedWarpOp = WARP_OP_NONE; sTransitionTimer = 0; - D_80339EE0 = 0; + sSpecialWarpDest = 0; for (int i = 0; i < 8; i++) { gSpawnedStarDefault[i] = 0; diff --git a/src/game/level_update.h b/src/game/level_update.h index 704924a01..f136c1280 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -32,11 +32,15 @@ #define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10 -#define SPECIAL_WARP_CAKE -1 -#define SPECIAL_WARP_GODDARD -2 -#define SPECIAL_WARP_GODDARD_GAMEOVER -3 -#define SPECIAL_WARP_TITLE -8 -#define SPECIAL_WARP_LEVEL_SELECT -9 +enum SpecialWarpDestinations { + WARP_SPECIAL_LEVEL_SELECT = -9, + WARP_SPECIAL_INTRO_SPLASH_SCREEN = -8, + WARP_SPECIAL_SWITCH_FILE = -7, + WARP_SPECIAL_MARIO_HEAD_DIZZY = -3, + WARP_SPECIAL_MARIO_HEAD_REGULAR = -2, + WARP_SPECIAL_ENDING = -1, + WARP_SPECIAL_NONE = 0, +}; enum MarioSpawnType { MARIO_SPAWN_NONE, @@ -93,10 +97,10 @@ struct CreditsEntry { /*0x00*/ u8 levelNum; /*0x01*/ u8 areaIndex; - /*0x02*/ u8 unk02; + /*0x02*/ u8 actNum; /*0x03*/ s8 marioAngle; /*0x04*/ Vec3s marioPos; - /*0x0C*/ const char **unk0C; + /*0x0C*/ const char **string; }; extern struct CreditsEntry *gCurrCreditsEntry; @@ -105,10 +109,8 @@ extern struct MarioState gMarioStates[]; extern struct MarioState *gMarioState; extern s16 sCurrPlayMode; -extern u16 D_80339ECA; extern s16 sTransitionTimer; extern void (*sTransitionUpdate)(s16 *); -extern u8 unused3[4]; extern s16 gChangeLevel; extern s16 gChangeActNum; @@ -122,25 +124,15 @@ struct WarpDest { u32 arg; }; -struct SavedWarpValues { - u8 received; - struct WarpDest warpDest; - s8 inWarpCheckpoint; - s16 ttcSpeedSetting; - s16 D_80339EE0; - f32 paintingMarioYEntry; -}; - extern struct WarpDest sWarpDest; extern s8 sWarpCheckpointActive; -extern u16 gFanFareDebounce; +extern u16 gFanfareDebounce; -extern s16 D_80339EE0; +extern s16 sSpecialWarpDest; extern s16 sDelayedWarpOp; extern s16 sDelayedWarpTimer; extern s16 sSourceWarpNodeId; extern s32 sDelayedWarpArg; -extern u8 unused4[2]; extern s8 sTimerRunning; struct HudDisplay { @@ -194,8 +186,8 @@ void initiate_painting_warp(s16 paintingIndex); s16 level_trigger_warp(struct MarioState *m, s32 warpOp); void level_set_transition(s16 length, void (*updateFunction)(s16 *)); void set_play_mode(s16 playMode); -/* |description|Special warps to arg (`SPECIAL_WARP_*`)|descriptionEnd| */ -void warp_special(s32 arg); +/* |description|Special warps to arg (`WARP_SPECIAL_*`)|descriptionEnd| */ +void warp_special(enum SpecialWarpDestinations arg); /* |description|Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead|descriptionEnd| */ void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg); diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 89e46a1eb..2f5c267d9 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -133,11 +133,11 @@ void print_displaying_credits_entry(void) { #endif if (sDispCreditsEntry != NULL) { - currStrPtr = (char **) sDispCreditsEntry->unk0C; + currStrPtr = (char **) sDispCreditsEntry->string; titleStr = *currStrPtr++; numLines = *titleStr++ - '0'; - strY = (sDispCreditsEntry->unk02 & 0x20 ? 28 : 172) + (numLines == 1) * 16; + strY = (sDispCreditsEntry->actNum & 0x20 ? 28 : 172) + (numLines == 1) * 16; #ifndef VERSION_JP lineHeight = 16; #endif @@ -3048,8 +3048,8 @@ static s32 act_credits_cutscene(struct MarioState *m) { sEndCutsceneVp.vp.vscale[0] = 640 - width; sEndCutsceneVp.vp.vscale[1] = 480 - height; - sEndCutsceneVp.vp.vtrans[0] = (gCurrCreditsEntry->unk02 & 0x10 ? width : -width) * 56 / 100 + 640; - sEndCutsceneVp.vp.vtrans[1] = (gCurrCreditsEntry->unk02 & 0x20 ? height : -height) * 66 / 100 + 480; + sEndCutsceneVp.vp.vtrans[0] = (gCurrCreditsEntry->actNum & 0x10 ? width : -width) * 56 / 100 + 640; + sEndCutsceneVp.vp.vtrans[1] = (gCurrCreditsEntry->actNum & 0x20 ? height : -height) * 66 / 100 + 480; override_viewport_and_clip(&sEndCutsceneVp, 0, 0, 0, 0); } @@ -3069,7 +3069,7 @@ static s32 act_credits_cutscene(struct MarioState *m) { level_trigger_warp(m, WARP_OP_CREDITS_NEXT); } - m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->unk02 & 0xC0) << 8; + m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->actNum & 0xC0) << 8; } return FALSE; diff --git a/src/menu/star_select.c b/src/menu/star_select.c index f3f651e2f..9b357cf6b 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -461,9 +461,7 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused if (sActSelectorMenuTimer >= 11) { // If any of these buttons are pressed, play sound and go to course act #ifndef VERSION_EU - if ((gPlayer1Controller->buttonPressed & A_BUTTON) - || (gPlayer1Controller->buttonPressed & START_BUTTON) - || (gPlayer1Controller->buttonPressed & B_BUTTON)) { + if ((gPlayer1Controller->buttonPressed & (A_BUTTON | START_BUTTON | B_BUTTON))) { #else if ((gPlayer1Controller->buttonPressed & (A_BUTTON | START_BUTTON | B_BUTTON | Z_TRIG))) { #endif @@ -471,12 +469,6 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused } } - // apply the received act num - if (sReceivedLoadedActNum != 0) { - sLoadedActNum = sReceivedLoadedActNum; - sReceivedLoadedActNum = 0; - } - // Cancel the act selector while on the main menu if (gDjuiInMainMenu) { return 1; } diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index ef56a07df..b60161a23 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1803,11 +1803,13 @@ const char gSmluaConstants[] = "" "WARP_OP_FORCE_SYNC=0x20\n" "WARP_OP_EXIT=0x21\n" "WARP_OP_TRIGGERS_LEVEL_SELECT=0x10\n" -"SPECIAL_WARP_CAKE=-1\n" -"SPECIAL_WARP_GODDARD=-2\n" -"SPECIAL_WARP_GODDARD_GAMEOVER=-3\n" -"SPECIAL_WARP_TITLE=-8\n" -"SPECIAL_WARP_LEVEL_SELECT=-9\n" +"WARP_SPECIAL_LEVEL_SELECT=-9\n" +"WARP_SPECIAL_INTRO_SPLASH_SCREEN=-8\n" +"WARP_SPECIAL_SWITCH_FILE=-7\n" +"WARP_SPECIAL_MARIO_HEAD_DIZZY=-3\n" +"WARP_SPECIAL_MARIO_HEAD_REGULAR=-2\n" +"WARP_SPECIAL_ENDING=-1\n" +"WARP_SPECIAL_NONE=0\n" "MARIO_SPAWN_NONE=0\n" "MARIO_SPAWN_DOOR_WARP=1\n" "MARIO_SPAWN_IDLE=2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index bf7cf339a..ab17841e0 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15495,7 +15495,7 @@ int smlua_func_warp_special(lua_State* L) { return 0; } - s32 arg = smlua_to_integer(L, 1); + int arg = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "warp_special"); return 0; } warp_special(arg); From cda0fa648b89c30ef19f8a3a10faae11a55679a9 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 00:14:27 -0500 Subject: [PATCH 04/16] Fix double bubble life loss - Borrowed certain things from HackerSM64/later refreshes - lots of `enum`s! - `MenuOption` [NEW] - `TimerControl` - `WarpOperation` - `WarpFlags` [NEW] - `WarpNodes` - `WarpTypes` - names here and there NEW Level Value: `pauseExitMode` - Learn: ```c enum PauseExitMode { PAUSE_EXIT_VANILLA, // 0b00 // "EXIT COURSE" exits to castle PAUSE_EXIT_COURSE, // 0b01 // "EXIT COURSE" exits the course PAUSE_EXIT_TO_CASTLE, // 0b10 // "EXIT TO CASTLE" exits to castle PAUSE_EXIT_BOTH // 0b11 // "EXIT COURSE" and "EXIT TO CASTLE" }; ``` - Deduplicated `Painting`s - Defaults are now created/restored using Macros - Killed so many unused variables - Purged all references to the sm64ex Exit Game feature - like that's ever coming back - Getting things ready for the return of Goddard ... - oh, bubbles! - Fixed double life loss on timeout - :) --- autogen/convert_constants.py | 1 + autogen/lua_definitions/constants.lua | 237 +++++++------- autogen/lua_definitions/functions.lua | 8 +- autogen/lua_definitions/structs.lua | 1 + docs/lua/constants.md | 138 +++++--- docs/lua/functions-3.md | 12 +- docs/lua/structs.md | 1 + levels/castle_inside/painting.inc.c | 434 ++------------------------ levels/hmc/areas/1/painting.inc.c | 31 +- levels/ttm/areas/1/painting.inc.c | 31 +- src/game/area.c | 8 +- src/game/area.h | 22 +- src/game/bettercamera.inc.h | 2 +- src/game/hardcoded.c | 37 +-- src/game/hardcoded.h | 10 + src/game/ingame_menu.c | 69 ++-- src/game/interaction.c | 8 +- src/game/level_update.c | 67 ++-- src/game/level_update.h | 98 +++--- src/game/mario_actions_automatic.c | 2 +- src/game/mario_actions_cutscene.c | 30 +- src/game/paintings.h | 5 + src/menu/ingame_text.h | 3 +- src/pc/lua/smlua_cobject_autogen.c | 3 +- src/pc/lua/smlua_constants_autogen.c | 68 ++-- src/pc/lua/smlua_functions_autogen.c | 6 +- src/pc/lua/utils/smlua_misc_utils.c | 2 +- 27 files changed, 517 insertions(+), 817 deletions(-) diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index 32e3debad..fee8b75bb 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -58,6 +58,7 @@ in_files = [ "src/pc/gfx/gfx_pc.h", "src/engine/surface_load.h", "src/pc/lua/utils/smlua_audio_utils.h", + "src/game/hardcoded.h", ] exclude_constants = { diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 54371ceb8..bc1d494a1 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -618,6 +618,33 @@ WARP_TRANSITION_FADE_FROM_BOWSER = 0x12 --- @type integer WARP_TRANSITION_FADE_INTO_BOWSER = 0x13 +MENU_OPT_NONE = 0 --- @type MenuOption +MENU_OPT_1 = 1 --- @type MenuOption +MENU_OPT_2 = 2 --- @type MenuOption +MENU_OPT_3 = 3 --- @type MenuOption +MENU_OPT_DEFAULT = MENU_OPT_1 --- @type MenuOption +MENU_OPT_CONTINUE = MENU_OPT_1 --- @type MenuOption +MENU_OPT_EXIT_COURSE = MENU_OPT_2 --- @type MenuOption +MENU_OPT_CAMERA_ANGLE_R = MENU_OPT_3 --- @type MenuOption +MENU_OPT_EXIT_TO_CASTLE = MENU_OPT_3 + 1 --- @type MenuOption +MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1 --- @type MenuOption +MENU_OPT_SAVE_AND_QUIT = MENU_OPT_2 --- @type MenuOption +MENU_OPT_CONTINUE_DONT_SAVE = MENU_OPT_3 --- @type MenuOption + +--- @alias MenuOption +--- | `MENU_OPT_NONE` +--- | `MENU_OPT_1` +--- | `MENU_OPT_2` +--- | `MENU_OPT_3` +--- | `MENU_OPT_DEFAULT` +--- | `MENU_OPT_CONTINUE` +--- | `MENU_OPT_EXIT_COURSE` +--- | `MENU_OPT_CAMERA_ANGLE_R` +--- | `MENU_OPT_EXIT_TO_CASTLE` +--- | `MENU_OPT_SAVE_AND_CONTINUE` +--- | `MENU_OPT_SAVE_AND_QUIT` +--- | `MENU_OPT_CONTINUE_DONT_SAVE` + --- @type string VERSION_REGION = "US" @@ -3209,6 +3236,23 @@ GEO_CONTEXT_AREA_INIT = 4 --- @type integer GEO_CONTEXT_HELD_OBJ = 5 +PAUSE_EXIT_VANILLA = 0 --- @type PauseExitMode +PAUSE_EXIT_COURSE = 1 --- @type PauseExitMode +PAUSE_EXIT_TO_CASTLE = 2 --- @type PauseExitMode +PAUSE_EXIT_BOTH = 3 --- @type PauseExitMode + +--- @alias PauseExitMode +--- | `PAUSE_EXIT_VANILLA` +--- | `PAUSE_EXIT_COURSE` +--- | `PAUSE_EXIT_TO_CASTLE` +--- | `PAUSE_EXIT_BOTH` + +--- @type integer +STARS_NEEDED_FOR_DIALOG_COUNT = 6 + +--- @type integer +EXCLAMATION_BOX_MAX_SIZE = 99 + INTERACT_HOOT = (1 << 0) --- @type InteractionType INTERACT_GRABBABLE = (1 << 1) --- @type InteractionType INTERACT_DOOR = (1 << 2) --- @type InteractionType @@ -3526,71 +3570,55 @@ LEVEL_COUNT = 39 --- @type LevelNum --- | `LEVEL_UNKNOWN_38` --- | `LEVEL_COUNT` ---- @type integer -TIMER_CONTROL_SHOW = 0 +TIMER_CONTROL_SHOW = 0 --- @type TimerControl +TIMER_CONTROL_START = 1 --- @type TimerControl +TIMER_CONTROL_STOP = 2 --- @type TimerControl +TIMER_CONTROL_HIDE = 3 --- @type TimerControl ---- @type integer -TIMER_CONTROL_START = 1 +--- @alias TimerControl +--- | `TIMER_CONTROL_SHOW` +--- | `TIMER_CONTROL_START` +--- | `TIMER_CONTROL_STOP` +--- | `TIMER_CONTROL_HIDE` ---- @type integer -TIMER_CONTROL_STOP = 2 +WARP_OP_NONE = 0 --- @type WarpOperation +WARP_OP_LOOK_UP = 1 --- @type WarpOperation +WARP_OP_SPIN_SHRINK = 2 --- @type WarpOperation +WARP_OP_WARP_DOOR = 3 --- @type WarpOperation +WARP_OP_WARP_OBJECT = 4 --- @type WarpOperation +WARP_OP_TELEPORT = 5 --- @type WarpOperation +WARP_OP_TRIGGERS_LEVEL_SELECT = 0x10 --- @type WarpOperation +WARP_OP_STAR_EXIT = 17 --- @type WarpOperation +WARP_OP_DEATH = 18 --- @type WarpOperation +WARP_OP_WARP_FLOOR = 19 --- @type WarpOperation +WARP_OP_GAME_OVER = 20 --- @type WarpOperation +WARP_OP_CREDITS_END = 21 --- @type WarpOperation +WARP_OP_DEMO_NEXT = 22 --- @type WarpOperation +WARP_OP_CREDITS_START = 23 --- @type WarpOperation +WARP_OP_CREDITS_NEXT = 24 --- @type WarpOperation +WARP_OP_DEMO_END = 25 --- @type WarpOperation +WARP_OP_FORCE_SYNC = 26 --- @type WarpOperation +WARP_OP_EXIT = 27 --- @type WarpOperation ---- @type integer -TIMER_CONTROL_HIDE = 3 - ---- @type integer -WARP_OP_NONE = 0x00 - ---- @type integer -WARP_OP_LOOK_UP = 0x01 - ---- @type integer -WARP_OP_SPIN_SHRINK = 0x02 - ---- @type integer -WARP_OP_WARP_DOOR = 0x03 - ---- @type integer -WARP_OP_WARP_OBJECT = 0x04 - ---- @type integer -WARP_OP_TELEPORT = 0x05 - ---- @type integer -WARP_OP_STAR_EXIT = 0x11 - ---- @type integer -WARP_OP_DEATH = 0x12 - ---- @type integer -WARP_OP_WARP_FLOOR = 0x13 - ---- @type integer -WARP_OP_GAME_OVER = 0x14 - ---- @type integer -WARP_OP_CREDITS_END = 0x15 - ---- @type integer -WARP_OP_DEMO_NEXT = 0x16 - ---- @type integer -WARP_OP_CREDITS_START = 0x17 - ---- @type integer -WARP_OP_CREDITS_NEXT = 0x18 - ---- @type integer -WARP_OP_DEMO_END = 0x19 - ---- @type integer -WARP_OP_FORCE_SYNC = 0x20 - ---- @type integer -WARP_OP_EXIT = 0x21 - ---- @type integer -WARP_OP_TRIGGERS_LEVEL_SELECT = 0x10 +--- @alias WarpOperation +--- | `WARP_OP_NONE` +--- | `WARP_OP_LOOK_UP` +--- | `WARP_OP_SPIN_SHRINK` +--- | `WARP_OP_WARP_DOOR` +--- | `WARP_OP_WARP_OBJECT` +--- | `WARP_OP_TELEPORT` +--- | `WARP_OP_TRIGGERS_LEVEL_SELECT` +--- | `WARP_OP_STAR_EXIT` +--- | `WARP_OP_DEATH` +--- | `WARP_OP_WARP_FLOOR` +--- | `WARP_OP_GAME_OVER` +--- | `WARP_OP_CREDITS_END` +--- | `WARP_OP_DEMO_NEXT` +--- | `WARP_OP_CREDITS_START` +--- | `WARP_OP_CREDITS_NEXT` +--- | `WARP_OP_DEMO_END` +--- | `WARP_OP_FORCE_SYNC` +--- | `WARP_OP_EXIT` WARP_SPECIAL_LEVEL_SELECT = -9 --- @type SpecialWarpDestinations WARP_SPECIAL_INTRO_SPLASH_SCREEN = -8 --- @type SpecialWarpDestinations @@ -3609,6 +3637,19 @@ WARP_SPECIAL_NONE = 0 --- @type SpecialWarpDestinations --- | `WARP_SPECIAL_ENDING` --- | `WARP_SPECIAL_NONE` +WARP_FLAGS_NONE = (0 << 0) --- @type WarpFlags +WARP_FLAG_DOOR_PULLED = (1 << 0) --- @type WarpFlags +WARP_FLAG_DOOR_FLIP_MARIO = (1 << 1) --- @type WarpFlags +WARP_FLAG_DOOR_IS_WARP = (1 << 2) --- @type WarpFlags +WARP_FLAG_EXIT_COURSE = (1 << 3) --- @type WarpFlags + +--- @alias WarpFlags +--- | `WARP_FLAGS_NONE` +--- | `WARP_FLAG_DOOR_PULLED` +--- | `WARP_FLAG_DOOR_FLIP_MARIO` +--- | `WARP_FLAG_DOOR_IS_WARP` +--- | `WARP_FLAG_EXIT_COURSE` + MARIO_SPAWN_NONE = 0 --- @type MarioSpawnType MARIO_SPAWN_DOOR_WARP = 1 --- @type MarioSpawnType MARIO_SPAWN_IDLE = 2 --- @type MarioSpawnType @@ -3654,53 +3695,37 @@ MARIO_SPAWN_FADE_FROM_BLACK = 39 --- @type MarioSpawnType --- | `MARIO_SPAWN_UNUSED_38` --- | `MARIO_SPAWN_FADE_FROM_BLACK` ---- @type integer -MARIO_SPAWN_UNKNOWN_02 = 0x02 +WARP_NODE_MAIN_ENTRY = 0x0A --- @type WarpNodes +WARP_NODE_DEFAULT = 0xF0 --- @type WarpNodes +WARP_NODE_DEATH = 0xF1 --- @type WarpNodes +WARP_NODE_LOOK_UP = 0xF2 --- @type WarpNodes +WARP_NODE_WARP_FLOOR = 0xF3 --- @type WarpNodes +WARP_NODE_CREDITS_MIN = 0xF8 --- @type WarpNodes +WARP_NODE_CREDITS_START = 0xF8 --- @type WarpNodes +WARP_NODE_CREDITS_NEXT = 0xF9 --- @type WarpNodes +WARP_NODE_CREDITS_END = 0xFA --- @type WarpNodes ---- @type integer -MARIO_SPAWN_UNKNOWN_03 = 0x03 +--- @alias WarpNodes +--- | `WARP_NODE_MAIN_ENTRY` +--- | `WARP_NODE_DEFAULT` +--- | `WARP_NODE_DEATH` +--- | `WARP_NODE_LOOK_UP` +--- | `WARP_NODE_WARP_FLOOR` +--- | `WARP_NODE_CREDITS_MIN` +--- | `WARP_NODE_CREDITS_START` +--- | `WARP_NODE_CREDITS_NEXT` +--- | `WARP_NODE_CREDITS_END` ---- @type integer -MARIO_SPAWN_UNKNOWN_27 = 0x27 +WARP_TYPE_NOT_WARPING = 0 --- @type WarpTypes +WARP_TYPE_CHANGE_LEVEL = 1 --- @type WarpTypes +WARP_TYPE_CHANGE_AREA = 2 --- @type WarpTypes +WARP_TYPE_SAME_AREA = 3 --- @type WarpTypes ---- @type integer -WARP_NODE_F0 = 0xF0 - ---- @type integer -WARP_NODE_DEATH = 0xF1 - ---- @type integer -WARP_NODE_F2 = 0xF2 - ---- @type integer -WARP_NODE_WARP_FLOOR = 0xF3 - ---- @type integer -WARP_NODE_CREDITS_START = 0xF8 - ---- @type integer -WARP_NODE_CREDITS_NEXT = 0xF9 - ---- @type integer -WARP_NODE_CREDITS_END = 0xFA - ---- @type integer -WARP_NODE_CREDITS_MIN = 0xF8 - ---- @type integer -WARP_TYPE_NOT_WARPING = 0 - ---- @type integer -WARP_TYPE_CHANGE_LEVEL = 1 - ---- @type integer -WARP_TYPE_CHANGE_AREA = 2 - ---- @type integer -WARP_TYPE_SAME_AREA = 3 - ---- @type integer -WARP_ARG_EXIT_COURSE = -1 +--- @alias WarpTypes +--- | `WARP_TYPE_NOT_WARPING` +--- | `WARP_TYPE_CHANGE_LEVEL` +--- | `WARP_TYPE_CHANGE_AREA` +--- | `WARP_TYPE_SAME_AREA` --- @type integer PRESS_START_DEMO_TIMER = 800 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index b1b1ddc27..443b2f0a3 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5257,7 +5257,7 @@ function initiate_painting_warp(paintingIndex) end --- @param m MarioState ---- @param warpOp integer +--- @param warpOp WarpOperation --- @return integer --- Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m` function level_trigger_warp(m, warpOp) @@ -5273,9 +5273,9 @@ end --- @param destLevel integer --- @param destArea integer --- @param destWarpNode integer ---- @param arg integer ---- Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead -function initiate_warp(destLevel, destArea, destWarpNode, arg) +--- @param warpFlags integer +--- Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `warpFlags`. This function is unstable and it's generally recommended to use `warp_to_level` instead +function initiate_warp(destLevel, destArea, destWarpNode, warpFlags) -- ... end diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 5e19d87a1..187590de6 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -1030,6 +1030,7 @@ --- @field public showStarNumber integer --- @field public extendedPauseDisplay integer --- @field public pauseExitAnywhere integer +--- @field public pauseExitMode PauseExitMode --- @field public disableActs integer --- @field public bubbleOnDeathBarrierInCapStages integer --- @field public entryLevel LevelNum diff --git a/docs/lua/constants.md b/docs/lua/constants.md index c5c867768..d4f8b61ae 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -2,6 +2,7 @@ # Supported Constants - [area.h](#areah) + - [enum MenuOption](#enum-MenuOption) - [behavior_table.h](#behavior_tableh) - [enum BehaviorId](#enum-BehaviorId) - [camera.h](#camerah) @@ -32,6 +33,8 @@ - [gfx_pc.h](#gfx_pch) - [enum ShaderFlag](#enum-ShaderFlag) - [graph_node.h](#graph_nodeh) +- [hardcoded.h](#hardcodedh) + - [enum PauseExitMode](#enum-PauseExitMode) - [interaction.c](#interactionc) - [interaction.h](#interactionh) - [enum InteractionType](#enum-InteractionType) @@ -41,8 +44,13 @@ - [level_defines.h](#level_definesh) - [enum LevelNum](#enum-LevelNum) - [level_update.h](#level_updateh) + - [enum TimerControl](#enum-TimerControl) + - [enum WarpOperation](#enum-WarpOperation) - [enum SpecialWarpDestinations](#enum-SpecialWarpDestinations) + - [enum WarpFlags](#enum-WarpFlags) - [enum MarioSpawnType](#enum-MarioSpawnType) + - [enum WarpNodes](#enum-WarpNodes) + - [enum WarpTypes](#enum-WarpTypes) - [enum HUDDisplayFlag](#enum-HUDDisplayFlag) - [lighting_engine.h](#lighting_engineh) - [enum LEMode](#enum-LEMode) @@ -116,6 +124,22 @@ - WARP_TRANSITION_FADE_INTO_MARIO - WARP_TRANSITION_FADE_FROM_BOWSER - WARP_TRANSITION_FADE_INTO_BOWSER + +### [enum MenuOption](#MenuOption) +| Identifier | Value | +| :--------- | :---- | +| MENU_OPT_NONE | 0 | +| MENU_OPT_1 | 1 | +| MENU_OPT_2 | 2 | +| MENU_OPT_3 | 3 | +| MENU_OPT_DEFAULT | MENU_OPT_1 | +| MENU_OPT_CONTINUE | MENU_OPT_1 | +| MENU_OPT_EXIT_COURSE | MENU_OPT_2 | +| MENU_OPT_CAMERA_ANGLE_R | MENU_OPT_3 | +| MENU_OPT_EXIT_TO_CASTLE | MENU_OPT_3 + 1 | +| MENU_OPT_SAVE_AND_CONTINUE | MENU_OPT_1 | +| MENU_OPT_SAVE_AND_QUIT | MENU_OPT_2 | +| MENU_OPT_CONTINUE_DONT_SAVE | MENU_OPT_3 | - VERSION_REGION [:arrow_up_small:](#) @@ -1411,6 +1435,22 @@
+## [hardcoded.h](#hardcoded.h) + +### [enum PauseExitMode](#PauseExitMode) +| Identifier | Value | +| :--------- | :---- | +| PAUSE_EXIT_VANILLA | 0 | +| PAUSE_EXIT_COURSE | 1 | +| PAUSE_EXIT_TO_CASTLE | 2 | +| PAUSE_EXIT_BOTH | 3 | +- STARS_NEEDED_FOR_DIALOG_COUNT +- EXCLAMATION_BOX_MAX_SIZE + +[:arrow_up_small:](#) + +
+ ## [interaction.c](#interaction.c) [:arrow_up_small:](#) @@ -1584,28 +1624,36 @@
## [level_update.h](#level_update.h) -- TIMER_CONTROL_SHOW -- TIMER_CONTROL_START -- TIMER_CONTROL_STOP -- TIMER_CONTROL_HIDE -- WARP_OP_NONE -- WARP_OP_LOOK_UP -- WARP_OP_SPIN_SHRINK -- WARP_OP_WARP_DOOR -- WARP_OP_WARP_OBJECT -- WARP_OP_TELEPORT -- WARP_OP_STAR_EXIT -- WARP_OP_DEATH -- WARP_OP_WARP_FLOOR -- WARP_OP_GAME_OVER -- WARP_OP_CREDITS_END -- WARP_OP_DEMO_NEXT -- WARP_OP_CREDITS_START -- WARP_OP_CREDITS_NEXT -- WARP_OP_DEMO_END -- WARP_OP_FORCE_SYNC -- WARP_OP_EXIT -- WARP_OP_TRIGGERS_LEVEL_SELECT + +### [enum TimerControl](#TimerControl) +| Identifier | Value | +| :--------- | :---- | +| TIMER_CONTROL_SHOW | 0 | +| TIMER_CONTROL_START | 1 | +| TIMER_CONTROL_STOP | 2 | +| TIMER_CONTROL_HIDE | 3 | + +### [enum WarpOperation](#WarpOperation) +| Identifier | Value | +| :--------- | :---- | +| WARP_OP_NONE | 0 | +| WARP_OP_LOOK_UP | 1 | +| WARP_OP_SPIN_SHRINK | 2 | +| WARP_OP_WARP_DOOR | 3 | +| WARP_OP_WARP_OBJECT | 4 | +| WARP_OP_TELEPORT | 5 | +| WARP_OP_TRIGGERS_LEVEL_SELECT | 0x10 | +| WARP_OP_STAR_EXIT | 17 | +| WARP_OP_DEATH | 18 | +| WARP_OP_WARP_FLOOR | 19 | +| WARP_OP_GAME_OVER | 20 | +| WARP_OP_CREDITS_END | 21 | +| WARP_OP_DEMO_NEXT | 22 | +| WARP_OP_CREDITS_START | 23 | +| WARP_OP_CREDITS_NEXT | 24 | +| WARP_OP_DEMO_END | 25 | +| WARP_OP_FORCE_SYNC | 26 | +| WARP_OP_EXIT | 27 | ### [enum SpecialWarpDestinations](#SpecialWarpDestinations) | Identifier | Value | @@ -1618,6 +1666,15 @@ | WARP_SPECIAL_ENDING | -1 | | WARP_SPECIAL_NONE | 0 | +### [enum WarpFlags](#WarpFlags) +| Identifier | Value | +| :--------- | :---- | +| WARP_FLAGS_NONE | (0 << 0) | +| WARP_FLAG_DOOR_PULLED | (1 << 0) | +| WARP_FLAG_DOOR_FLIP_MARIO | (1 << 1) | +| WARP_FLAG_DOOR_IS_WARP | (1 << 2) | +| WARP_FLAG_EXIT_COURSE | (1 << 3) | + ### [enum MarioSpawnType](#MarioSpawnType) | Identifier | Value | | :--------- | :---- | @@ -1642,22 +1699,27 @@ | MARIO_SPAWN_LAUNCH_DEATH | 37 | | MARIO_SPAWN_UNUSED_38 | 38 | | MARIO_SPAWN_FADE_FROM_BLACK | 39 | -- MARIO_SPAWN_UNKNOWN_02 -- MARIO_SPAWN_UNKNOWN_03 -- MARIO_SPAWN_UNKNOWN_27 -- WARP_NODE_F0 -- WARP_NODE_DEATH -- WARP_NODE_F2 -- WARP_NODE_WARP_FLOOR -- WARP_NODE_CREDITS_START -- WARP_NODE_CREDITS_NEXT -- WARP_NODE_CREDITS_END -- WARP_NODE_CREDITS_MIN -- WARP_TYPE_NOT_WARPING -- WARP_TYPE_CHANGE_LEVEL -- WARP_TYPE_CHANGE_AREA -- WARP_TYPE_SAME_AREA -- WARP_ARG_EXIT_COURSE + +### [enum WarpNodes](#WarpNodes) +| Identifier | Value | +| :--------- | :---- | +| WARP_NODE_MAIN_ENTRY | 0x0A | +| WARP_NODE_DEFAULT | 0xF0 | +| WARP_NODE_DEATH | 0xF1 | +| WARP_NODE_LOOK_UP | 0xF2 | +| WARP_NODE_WARP_FLOOR | 0xF3 | +| WARP_NODE_CREDITS_MIN | 0xF8 | +| WARP_NODE_CREDITS_START | 0xF8 | +| WARP_NODE_CREDITS_NEXT | 0xF9 | +| WARP_NODE_CREDITS_END | 0xFA | + +### [enum WarpTypes](#WarpTypes) +| Identifier | Value | +| :--------- | :---- | +| WARP_TYPE_NOT_WARPING | 0 | +| WARP_TYPE_CHANGE_LEVEL | 1 | +| WARP_TYPE_CHANGE_AREA | 2 | +| WARP_TYPE_SAME_AREA | 3 | - PRESS_START_DEMO_TIMER - PAINTING_WARP_INDEX_START - PAINTING_WARP_INDEX_FA diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index fd4c655c0..9a2f7202f 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -7086,13 +7086,13 @@ Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m` | Field | Type | | ----- | ---- | | m | [MarioState](structs.md#MarioState) | -| warpOp | `integer` | +| warpOp | [enum WarpOperation](constants.md#enum-WarpOperation) | ### Returns - `integer` ### C Prototype -`s16 level_trigger_warp(struct MarioState *m, s32 warpOp);` +`s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp);` [:arrow_up_small:](#) @@ -7124,10 +7124,10 @@ Special warps to arg (`WARP_SPECIAL_*`) ## [initiate_warp](#initiate_warp) ### Description -Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead +Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `warpFlags`. This function is unstable and it's generally recommended to use `warp_to_level` instead ### Lua Example -`initiate_warp(destLevel, destArea, destWarpNode, arg)` +`initiate_warp(destLevel, destArea, destWarpNode, warpFlags)` ### Parameters | Field | Type | @@ -7135,13 +7135,13 @@ Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This | destLevel | `integer` | | destArea | `integer` | | destWarpNode | `integer` | -| arg | `integer` | +| warpFlags | `integer` | ### Returns - None ### C Prototype -`void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg);` +`void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags);` [:arrow_up_small:](#) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 3da14cfe2..b0b13daee 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -1526,6 +1526,7 @@ | showStarNumber | `integer` | | | extendedPauseDisplay | `integer` | | | pauseExitAnywhere | `integer` | | +| pauseExitMode | [enum PauseExitMode](constants.md#enum-PauseExitMode) | | | disableActs | `integer` | | | bubbleOnDeathBarrierInCapStages | `integer` | | | entryLevel | [enum LevelNum](constants.md#enum-LevelNum) | | diff --git a/levels/castle_inside/painting.inc.c b/levels/castle_inside/painting.inc.c index a41a3c5a2..8c5def9e5 100644 --- a/levels/castle_inside/painting.inc.c +++ b/levels/castle_inside/painting.inc.c @@ -1308,7 +1308,7 @@ static const Gfx inside_castle_seg7_painting_dl_070235B8[] = { } // 0x07023620 - 0x07023698 -struct Painting bob_painting = { +DEF_PAINTING(bob_painting, { /* id */ 0x0000, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1333,10 +1333,10 @@ struct Painting bob_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023698 - 0x07023710 -struct Painting ccm_painting = { +DEF_PAINTING(ccm_painting, { /* id */ 0x0001, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1361,10 +1361,10 @@ struct Painting ccm_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023710 - 0x07023788 -struct Painting wf_painting = { +DEF_PAINTING(wf_painting, { /* id */ 0x0002, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1389,10 +1389,10 @@ struct Painting wf_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023788 - 0x07023800 -struct Painting jrb_painting = { +DEF_PAINTING(jrb_painting, { /* id */ 0x0003, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1417,10 +1417,10 @@ struct Painting jrb_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023800 - 0x07023878 -struct Painting lll_painting = { +DEF_PAINTING(lll_painting, { /* id */ 0x0004, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1445,10 +1445,10 @@ struct Painting lll_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023878 - 0x070238F0 -struct Painting ssl_painting = { +DEF_PAINTING(ssl_painting, { /* id */ 0x0005, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1473,10 +1473,10 @@ struct Painting ssl_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}; +}); // 0x070238F0 - 0x07023968 -struct Painting hmc_painting = { +DEF_PAINTING(hmc_painting, { /* id */ 0x000E, /* Image Count */ 0x01, /* Texture Type */ PAINTING_ENV_MAP, @@ -1501,10 +1501,10 @@ struct Painting hmc_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 768.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023968 - 0x070239E0 -struct Painting ddd_painting = { +DEF_PAINTING(ddd_painting, { /* id */ 0x0007, /* Image Count */ 0x01, /* Texture Type */ PAINTING_ENV_MAP, @@ -1529,10 +1529,10 @@ struct Painting ddd_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 819.2f, /* Ripples */ { 0 }, -}; +}); // 0x070239E0 - 0x07023A58 -struct Painting wdw_painting = { +DEF_PAINTING(wdw_painting, { /* id */ 0x0008, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1557,10 +1557,10 @@ struct Painting wdw_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023A58 - 0x07023AD0 -struct Painting thi_tiny_painting = { +DEF_PAINTING(thi_tiny_painting, { /* id */ 0x0009, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1585,10 +1585,10 @@ struct Painting thi_tiny_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 393.216f, /* Ripples */ { 0 }, -}; +}); // 0x07023AD0 - 0x07023B48 -struct Painting ttm_painting = { +DEF_PAINTING(ttm_painting, { /* id */ 0x000A, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1613,10 +1613,10 @@ struct Painting ttm_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 256.0f, /* Ripples */ { 0 }, -}; +}); // 0x07023B48 - 0x07023BC0 -struct Painting ttc_painting = { +DEF_PAINTING(ttc_painting, { /* id */ 0x000B, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1641,10 +1641,10 @@ struct Painting ttc_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 409.6f, /* Ripples */ { 0 }, -}; +}); // 0x07023BC0 - 0x07023C38 -struct Painting sl_painting = { +DEF_PAINTING(sl_painting, { /* id */ 0x000C, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1669,10 +1669,10 @@ struct Painting sl_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 716.8f, /* Ripples */ { 0 }, -}; +}); // 0x07023C38 - 0x07023CB0 -struct Painting thi_huge_painting = { +DEF_PAINTING(thi_huge_painting, { /* id */ 0x000D, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1697,382 +1697,4 @@ struct Painting thi_huge_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 1638.4f, /* Ripples */ { 0 }, -}; - -struct Painting default_bob_painting = { - /* id */ 0x0000, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 90.0f, - /* Position */ -5222.4f, 409.6f, -153.6f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023050, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_070235C0, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 614.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_ccm_painting = { - /* id */ 0x0001, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 0.0f, - /* Position */ -2611.2f, -307.2f, -4352.0f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_070230B0, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_070235C8, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 614.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_wf_painting = { - /* id */ 0x0002, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 0.0f, - /* Position */ -51.2f, -204.8f, -4505.6f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023110, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_070235D0, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 614.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_jrb_painting = { - /* id */ 0x0003, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 270.0f, - /* Position */ 4300.8f, 409.6f, -537.6f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023170, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_070235D8, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 614.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_lll_painting = { - /* id */ 0x0004, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 0.0f, - /* Position */ -1689.6f, -1126.4f, -3942.4f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_070231D0, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_070235E0, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 614.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_ssl_painting = { - /* id */ 0x0005, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 180.0f, - /* Position */ -2611.2f, -1177.6f, -1075.2f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023230, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_070235E8, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 614.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_hmc_painting = { - /* id */ 0x000E, - /* Image Count */ 0x01, - /* Texture Type */ PAINTING_ENV_MAP, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 270.0f, 0.0f, - /* Position */ 2099.2f, -1484.8f, -2278.4f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 10.0f, 30.0f, - /* Ripple Decay */ 1.0f, 1.0f, 0.98f, - /* Ripple Rate */ 0.0f, 0.05f, 0.05f, - /* Ripple Dispersion */ 0.0f, 15.0f, 15.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023580, - /* Texture Maps */ inside_castle_seg7_painting_env_map_texture_maps_07023044, - /* Textures */ inside_castle_seg7_painting_textures_070235F0, - /* Texture w, h */ 32, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07022640, - /* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 768.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_ddd_painting = { - /* id */ 0x0007, - /* Image Count */ 0x01, - /* Texture Type */ PAINTING_ENV_MAP, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 270.0f, - /* Position */ 3456.0f, -1075.2f, 1587.2f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 10.0f, 30.0f, - /* Ripple Decay */ 1.0f, 1.0f, 0.98f, - /* Ripple Rate */ 0.0f, 0.05f, 0.05f, - /* Ripple Dispersion */ 0.0f, 15.0f, 15.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_070235B8, - /* Texture Maps */ inside_castle_seg7_painting_env_map_texture_maps_07023044, - /* Textures */ inside_castle_seg7_painting_textures_070235F4, - /* Texture w, h */ 32, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07022640, - /* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS, - /* Alpha */ 0xB4, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 819.2f, - /* Ripples */ { 0 }, -}; - -struct Painting default_wdw_painting = { - /* id */ 0x0008, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 0.0f, - /* Position */ -966.656f, 1305.6f, -143.36f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023290, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_070235F8, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 614.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_thi_tiny_painting = { - /* id */ 0x0009, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 180.0f, - /* Position */ -4598.7842f, 1354.752f, 3005.44f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_070232F0, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_07023600, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 393.216f, - /* Ripples */ { 0 }, -}; - -struct Painting default_ttm_painting = { - /* id */ 0x000A, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 180.0f, - /* Position */ -546.816f, 1356.8f, 3813.376f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023350, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_07023608, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 256.0f, - /* Ripples */ { 0 }, -}; - -struct Painting default_ttc_painting = { - /* id */ 0x000B, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 180.0f, - /* Position */ 0.0f, 2713.6f, 7232.5122f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_070233B0, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_07023610, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 409.6f, - /* Ripples */ { 0 }, -}; - -struct Painting default_sl_painting = { - /* id */ 0x000C, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 0.0f, - /* Position */ 3179.52f, 1408.0f, -271.36f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_07023410, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_07023618, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 716.8f, - /* Ripples */ { 0 }, -}; - -struct Painting default_thi_huge_painting = { - /* id */ 0x000D, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 0.0f, - /* Position */ -5614.5918f, 1510.4f, -3292.16f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 40.0f, 160.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.12f, 0.07f, - /* Ripple Dispersion */ 0.0f, 80.0f, 60.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ inside_castle_seg7_painting_dl_070232F0, - /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, - /* Textures */ inside_castle_seg7_painting_textures_07023600, - /* Texture w, h */ 64, 32, - /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 1638.4f, - /* Ripples */ { 0 }, -}; +}); diff --git a/levels/hmc/areas/1/painting.inc.c b/levels/hmc/areas/1/painting.inc.c index e1b1ce697..32333cae7 100644 --- a/levels/hmc/areas/1/painting.inc.c +++ b/levels/hmc/areas/1/painting.inc.c @@ -510,7 +510,7 @@ static const Gfx hmc_seg7_painting_dl_070254E0[] = { } // 0x0702551C (PaintingData) -struct Painting cotmc_painting = { +DEF_PAINTING(cotmc_painting, { /* id */ 0x000E, /* Image Count */ 0x01, /* Texture Type */ PAINTING_ENV_MAP, @@ -535,31 +535,4 @@ struct Painting cotmc_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 723.968018f, /* Ripples */ { 0 }, -}; - -struct Painting default_cotmc_painting = { - /* id */ 0x000E, - /* Image Count */ 0x01, - /* Texture Type */ PAINTING_ENV_MAP, - /* Floor Status */ 0x00, 0x00 , 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 270.0f, 0.0f, - /* Position */ 2989.055908f, -4485.120117f, 5135.359863f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 10.0f, 30.0f, - /* Ripple Decay */ 1.0f, 1.0f, 0.98f, - /* Ripple Rate */ 0.0f, 0.05f, 0.05f, - /* Ripple Dispersion */ 0.0f, 15.0f, 15.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ hmc_seg7_painting_dl_070254E0, - /* Texture Maps */ hmc_seg7_painting_texture_maps_07024CD4, - /* Textures */ hmc_seg7_painting_textures_07025518, - /* Texture w, h */ 32, 32, - /* Ripple DList */ hmc_seg7_painting_dl_070242D0, - /* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 723.968018f, - /* Ripples */ { 0 }, -}; +}); diff --git a/levels/ttm/areas/1/painting.inc.c b/levels/ttm/areas/1/painting.inc.c index 2ae5d05db..b51f85366 100644 --- a/levels/ttm/areas/1/painting.inc.c +++ b/levels/ttm/areas/1/painting.inc.c @@ -542,7 +542,7 @@ static const Gfx ttm_seg7_painting_dl_07012E98[] = { } // 0x07012F00 (PaintingData) -struct Painting ttm_slide_painting = { +DEF_PAINTING(ttm_slide_painting, { /* id */ 0x0000, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -567,31 +567,4 @@ struct Painting ttm_slide_painting = { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 460.8f, /* Ripples */ { 0 }, -}; - -struct Painting default_ttm_slide_painting = { - /* id */ 0x0000, - /* Image Count */ 0x02, - /* Texture Type */ PAINTING_IMAGE, - /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, - /* Ripple Status */ 0x00, - /* Rotation */ 0.0f, 90.0f, - /* Position */ 3072.0f, 921.6f, -819.2f, - /* curr passive entry */ - /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, - /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, - /* Ripple Rate */ 0.0f, 0.24f, 0.14f, - /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, - /* Curr Ripple Timer */ 0.0f, - /* Curr Ripple x, y */ 0.0f, 0.0f, - /* Normal DList */ ttm_seg7_painting_dl_07012E98, - /* Texture Maps */ ttm_seg7_painting_texture_maps_07012E88, - /* Textures */ ttm_seg7_painting_textures_07012EF8, - /* Texture w, h */ 64, 32, - /* Ripple DList */ ttm_seg7_painting_dl_07012430, - /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, - /* Alpha */ 0xFF, - /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ - /* Size */ 460.8f, - /* Ripples */ { 0 }, -}; +}); diff --git a/src/game/area.c b/src/game/area.c index 003ec1643..cee7a9122 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -41,7 +41,7 @@ s16 gCurrActNum; s16 gCurrActStarNum; s16 gCurrAreaIndex; s16 gSavedCourseNum; -s16 gPauseScreenMode; +s16 gMenuOptSelectIndex; s16 gSaveOptSelectIndex; struct SpawnInfo *gMarioSpawnInfo = &gPlayerSpawnInfos[0]; @@ -476,10 +476,10 @@ void render_game(void) { } gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT - BORDER_HEIGHT); - gPauseScreenMode = render_menus_and_dialogs(); + gMenuOptSelectIndex = render_menus_and_dialogs(); - if (gPauseScreenMode != 0) { - gSaveOptSelectIndex = gPauseScreenMode; + if (gMenuOptSelectIndex != 0) { + gSaveOptSelectIndex = gMenuOptSelectIndex; } if (gViewportClip != NULL) { diff --git a/src/game/area.h b/src/game/area.h index d5340fdee..ff83741ac 100644 --- a/src/game/area.h +++ b/src/game/area.h @@ -126,8 +126,26 @@ struct WarpTransition /*0x04*/ struct WarpTransitionData data; }; +enum MenuOption { + MENU_OPT_NONE, + MENU_OPT_1, + MENU_OPT_2, + MENU_OPT_3, + MENU_OPT_DEFAULT = MENU_OPT_1, + + // Course Pause Menu + MENU_OPT_CONTINUE = MENU_OPT_1, + MENU_OPT_EXIT_COURSE = MENU_OPT_2, + MENU_OPT_CAMERA_ANGLE_R = MENU_OPT_3, + MENU_OPT_EXIT_TO_CASTLE = MENU_OPT_3 + 1, + + // Save Menu + MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1, + MENU_OPT_SAVE_AND_QUIT = MENU_OPT_2, + MENU_OPT_CONTINUE_DONT_SAVE = MENU_OPT_3 +}; + extern struct SpawnInfo gPlayerSpawnInfos[]; -extern struct GraphNode *D_8033A160[]; extern struct Area gAreaData[]; extern struct WarpTransition gWarpTransition; extern s16 gCurrCourseNum; @@ -135,7 +153,7 @@ extern s16 gCurrActNum; extern s16 gCurrActStarNum; extern s16 gCurrAreaIndex; extern s16 gSavedCourseNum; -extern s16 gPauseScreenMode; +extern s16 gMenuOptSelectIndex; extern s16 gSaveOptSelectIndex; extern struct SpawnInfo *gMarioSpawnInfo; diff --git a/src/game/bettercamera.inc.h b/src/game/bettercamera.inc.h index 76651f134..82adc64eb 100644 --- a/src/game/bettercamera.inc.h +++ b/src/game/bettercamera.inc.h @@ -605,7 +605,7 @@ static void newcam_apply_values(struct Camera *c) { gMarioState->forwardVel == 0 && save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, COURSE_COUNT - 1) >= gLevelValues.wingCapLookUpReq) { - level_trigger_warp(gMarioState, 1); + level_trigger_warp(gMarioState, WARP_OP_LOOK_UP); } } diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 344a370ad..78fe167d2 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -63,6 +63,7 @@ struct LevelValues gDefaultLevelValues = { .showStarNumber = FALSE, .extendedPauseDisplay = FALSE, .pauseExitAnywhere = TRUE, + .pauseExitMode = PAUSE_EXIT_BOTH, .disableActs = FALSE, .bubbleOnDeathBarrierInCapStages = FALSE, .entryLevel = LEVEL_CASTLE_GROUNDS, @@ -352,26 +353,26 @@ AT_STARTUP void hardcoded_reset_default_values(void) { gLevelValues = gDefaultLevelValues; gBehaviorValues = gDefaultBehaviorValues; - memcpy(&cotmc_painting, &default_cotmc_painting, sizeof(struct Painting)); - memcpy(&bob_painting, &default_bob_painting, sizeof(struct Painting)); - memcpy(&ccm_painting, &default_ccm_painting, sizeof(struct Painting)); - memcpy(&wf_painting, &default_wf_painting, sizeof(struct Painting)); - memcpy(&jrb_painting, &default_jrb_painting, sizeof(struct Painting)); - memcpy(&lll_painting, &default_lll_painting, sizeof(struct Painting)); - memcpy(&ssl_painting, &default_ssl_painting, sizeof(struct Painting)); - memcpy(&hmc_painting, &default_hmc_painting, sizeof(struct Painting)); - memcpy(&ddd_painting, &default_ddd_painting, sizeof(struct Painting)); - memcpy(&wdw_painting, &default_wdw_painting, sizeof(struct Painting)); - memcpy(&thi_tiny_painting, &default_thi_tiny_painting, sizeof(struct Painting)); - memcpy(&ttm_painting, &default_ttm_painting, sizeof(struct Painting)); - memcpy(&ttc_painting, &default_ttc_painting, sizeof(struct Painting)); - memcpy(&sl_painting, &default_sl_painting, sizeof(struct Painting)); - memcpy(&thi_huge_painting, &default_thi_huge_painting, sizeof(struct Painting)); - memcpy(&ttm_slide_painting, &default_ttm_slide_painting, sizeof(struct Painting)); - memcpy(sDummyContents, sDefaultExclamationBoxContents, sizeof(struct ExclamationBoxContent) * 15); + RESTORE_PAINTING(cotmc_painting); + RESTORE_PAINTING(bob_painting); + RESTORE_PAINTING(ccm_painting); + RESTORE_PAINTING(wf_painting); + RESTORE_PAINTING(jrb_painting); + RESTORE_PAINTING(lll_painting); + RESTORE_PAINTING(ssl_painting); + RESTORE_PAINTING(hmc_painting); + RESTORE_PAINTING(ddd_painting); + RESTORE_PAINTING(wdw_painting); + RESTORE_PAINTING(thi_tiny_painting); + RESTORE_PAINTING(ttm_painting); + RESTORE_PAINTING(ttc_painting); + RESTORE_PAINTING(sl_painting); + RESTORE_PAINTING(thi_huge_painting); + RESTORE_PAINTING(ttm_slide_painting); + gPaintingValues = gDefaultPaintingValues; + memcpy(sDummyContents, sDefaultExclamationBoxContents, sizeof(struct ExclamationBoxContent) * 15); gExclamationBoxContents = sDummyContents; gExclamationBoxSize = 15; - gPaintingValues = gDefaultPaintingValues; } diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index bb597d2a0..15ab4a4e6 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -41,6 +41,15 @@ struct StarPositions { Vec3f JetstreamRingStarPos; }; +#define PAUSE_EXIT_MODE gLevelValues.pauseExitMode + +enum PauseExitMode { + PAUSE_EXIT_VANILLA, // 0b00 // "EXIT COURSE" exits to castle + PAUSE_EXIT_COURSE, // 0b01 // "EXIT COURSE" exits the course + PAUSE_EXIT_TO_CASTLE, // 0b10 // "EXIT TO CASTLE" exits to castle + PAUSE_EXIT_BOTH // 0b11 // "EXIT COURSE" and "EXIT TO CASTLE" +}; + struct LevelValues { u8 fixCollisionBugs; u8 fixCollisionBugsRoundedCorners; @@ -61,6 +70,7 @@ struct LevelValues { u8 showStarNumber; u8 extendedPauseDisplay; u8 pauseExitAnywhere; + enum PauseExitMode pauseExitMode; u8 disableActs; u8 bubbleOnDeathBarrierInCapStages; enum LevelNum entryLevel; diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index 39c47dc26..e6d23c09a 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -2524,9 +2524,6 @@ void render_pause_camera_options(s16 x, s16 y, s8 *index, s16 xIndex) { #endif void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) { - u8 TEXT_EXIT_TO_CASTLE[16] = { DIALOG_CHAR_TERMINATOR }; - convert_string_ascii_to_sm64(TEXT_EXIT_TO_CASTLE, "EXIT TO CASTLE", false); - #ifdef VERSION_EU u8 textContinue[][10] = { { TEXT_CONTINUE }, @@ -2550,29 +2547,35 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) { #else INGAME_TEXT_COPY(textContinue, TEXT_CONTINUE); INGAME_TEXT_COPY(textExitCourse, TEXT_EXIT_COURSE); + u8 textExitToCastle[] = { TEXT_EXIT_TO_CASTLE }; INGAME_TEXT_COPY(textCameraAngleR, TEXT_CAMERA_ANGLE_R); #endif - - handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 4); + u8 maxIndex = PAUSE_EXIT_MODE == PAUSE_EXIT_BOTH ? 4 : 3; + handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, maxIndex); gSPDisplayList(gDisplayListHead++, dl_ia_text_begin); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha); print_generic_string(x + 10, y - 2, textContinue); - print_generic_string(x + 10, y - 17, textExitCourse); - print_generic_string(x + 10, y - 32, TEXT_EXIT_TO_CASTLE); + if (PAUSE_EXIT_MODE != PAUSE_EXIT_TO_CASTLE) { + y -= yIndex; print_generic_string(x + 10, y - 2, textExitCourse); + } + if (PAUSE_EXIT_MODE & PAUSE_EXIT_TO_CASTLE) { + y -= yIndex; print_generic_string(x + 10, y - 2, textExitToCastle); + } - if (index[0] != 4) { - print_generic_string(x + 10, y - 47, textCameraAngleR); + if (*index != maxIndex) { + print_generic_string(x + 10, y - 17, textCameraAngleR); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); - create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((index[0] - 1) * yIndex)) - Y_VAL8, 0); + y += (maxIndex - 2) * yIndex; + create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((*index - 1) * yIndex)) - Y_VAL8, 0); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha); gSPDisplayList(gDisplayListHead++, dl_draw_triangle); gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); } else { - render_pause_camera_options(x - 42, y - 57, &gDialogCameraAngleIndex, 110); + render_pause_camera_options(x - 42, y - 27, &gDialogCameraAngleIndex, 110); } } @@ -2952,8 +2955,6 @@ s32 gCourseCompleteCoins = 0; s8 gHudFlash = 0; s16 render_pause_courses_and_castle(void) { - s16 num; - #ifdef VERSION_EU gInGameLanguage = eu_get_language(); #endif @@ -2990,13 +2991,15 @@ s16 render_pause_courses_and_castle(void) { #ifdef VERSION_EU if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) #else - if (gPlayer1Controller->buttonPressed & A_BUTTON - || gPlayer1Controller->buttonPressed & START_BUTTON) + if (gPlayer1Controller->buttonPressed & (A_BUTTON | START_BUTTON)) #endif { + u8 maxIndex = PAUSE_EXIT_MODE == PAUSE_EXIT_BOTH ? 4 : 3; bool allowExit = true; - if (gDialogLineNum == 2 || gDialogLineNum == 3) { - smlua_call_event_hooks(HOOK_ON_PAUSE_EXIT, gDialogLineNum == 3, &allowExit); + bool pauseExit = gDialogLineNum > 1 && gDialogLineNum < maxIndex; + bool usedExitToCastle = (PAUSE_EXIT_MODE & 1) ? gDialogLineNum == 3 : gDialogLineNum == 2; + if (pauseExit) { + smlua_call_event_hooks(HOOK_ON_PAUSE_EXIT, usedExitToCastle, &allowExit); } if (allowExit) { level_set_transition(0, NULL); @@ -3004,13 +3007,9 @@ s16 render_pause_courses_and_castle(void) { gDialogBoxState = DIALOG_STATE_OPENING; gMenuMode = -1; - if (gDialogLineNum == 2 || gDialogLineNum == 3) { - num = gDialogLineNum; - } else { - num = 1; - } - - return num; + if (pauseExit) { + return usedExitToCastle ? MENU_OPT_EXIT_TO_CASTLE : MENU_OPT_EXIT_COURSE; + } else { return MENU_OPT_DEFAULT; } } else { play_sound(SOUND_MENU_CAMERA_BUZZ | (0xFF << 8), gGlobalSoundSource); } @@ -3060,7 +3059,7 @@ s16 render_pause_courses_and_castle(void) { network_mod_dev_mode_reload(); } - return 0; + return MENU_OPT_NONE; } #if defined(VERSION_JP) @@ -3288,13 +3287,11 @@ void render_course_complete_lvl_info_and_hud_str(void) { #endif #if defined(VERSION_JP) || defined(VERSION_SH) #define TXT_SAVECONT_Y 2 -//#define TXT_SAVEQUIT_Y 18 -//#define TXT_SAVE_EXIT_GAME_Y 38 +//#define TXT_SAVEQUIT_Y 18 // 38 #define TXT_CONTNOSAVE_Y 18 #else #define TXT_SAVECONT_Y 0 -//#define TXT_SAVEQUIT_Y 20 -//#define TXT_SAVE_EXIT_GAME_Y 40 +//#define TXT_SAVEQUIT_Y 20 // 40 #define TXT_CONTNOSAVE_Y 20 #endif @@ -3317,13 +3314,6 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e) { TEXT_SAVE_AND_QUIT_FR }, { TEXT_SAVE_AND_QUIT_DE } }; - - u8 textSaveExitGame[][30] = { // New function to exit game - { TEXT_SAVE_EXIT_GAME }, - { TEXT_SAVE_EXIT_GAME_FR }, - { TEXT_SAVE_EXIT_GAME_DE } - }; - u8 textContinueWithoutSaveArr[][30] = { { TEXT_CONTINUE_WITHOUT_SAVING }, { TEXT_CONTINUE_WITHOUT_SAVING_FR }, @@ -3332,13 +3322,11 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e) #define textSaveAndContinue textSaveAndContinueArr[gInGameLanguage] #define textSaveAndQuit textSaveAndQuitArr[gInGameLanguage] -#define textSaveExitGame textSaveExitGame[gInGameLanguage] #define textContinueWithoutSave textContinueWithoutSaveArr[gInGameLanguage] s16 xOffset = get_str_x_pos_from_center(160, textContinueWithoutSaveArr[gInGameLanguage], 12.0f); #else INGAME_TEXT_COPY(textSaveAndContinue, TEXT_SAVE_AND_CONTINUE); //u8 textSaveAndQuit[] = { TEXT_SAVE_AND_QUIT }; - //u8 textSaveExitGame[] = { TEXT_SAVE_EXIT_GAME }; INGAME_TEXT_COPY(textContinueWithoutSave, TEXT_CONTINUE_WITHOUT_SAVING); #endif @@ -3349,7 +3337,6 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e) print_generic_string(TXT_SAVEOPTIONS_X, y + TXT_SAVECONT_Y, textSaveAndContinue); //print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_SAVEQUIT_Y, textSaveAndQuit); - //print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_SAVE_EXIT_GAME_Y, textSaveExitGame); print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_CONTNOSAVE_Y, textContinueWithoutSave); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); @@ -3414,11 +3401,11 @@ s16 render_course_complete_screen(void) { gCourseDoneMenuTimer++; - return 0; + return MENU_OPT_NONE; } s16 render_menus_and_dialogs(void) { - s16 mode = 0; + s16 mode = MENU_OPT_NONE; create_dl_ortho_matrix(); diff --git a/src/game/interaction.c b/src/game/interaction.c index a102e8c5f..c95152e37 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -815,7 +815,7 @@ u32 should_push_or_pull_door(struct MarioState *m, struct Object *o) { s16 dYaw = o->oMoveAngleYaw - atan2s(dz, dx); - return (dYaw >= -0x4000 && dYaw <= 0x4000) ? 0x00000001 : 0x00000002; + return (dYaw >= -0x4000 && dYaw <= 0x4000) ? WARP_FLAG_DOOR_PULLED : WARP_FLAG_DOOR_FLIP_MARIO; } u32 take_damage_from_interact_object(struct MarioState *m) { @@ -1152,10 +1152,10 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj } if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) { - actionArg = should_push_or_pull_door(m, o) + 0x00000004; + actionArg = should_push_or_pull_door(m, o) + WARP_FLAG_DOOR_IS_WARP; if (doorAction == 0) { - if (actionArg & 0x00000001) { + if (actionArg & WARP_FLAG_DOOR_PULLED) { doorAction = ACT_PULLING_DOOR; } else { doorAction = ACT_PUSHING_DOOR; @@ -1229,7 +1229,7 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object * u32 enterDoorAction; u32 doorSaveFileFlag; - if (actionArg & 0x00000001) { + if (actionArg & WARP_FLAG_DOOR_PULLED) { enterDoorAction = ACT_PULLING_DOOR; } else { enterDoorAction = ACT_PUSHING_DOOR; diff --git a/src/game/level_update.c b/src/game/level_update.c index 1de4fcdee..c39a0436b 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -760,13 +760,13 @@ s16 music_changed_through_warp(s16 arg) { /** * Set the current warp type and destination level/area/node. */ -void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg) { +void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags) { struct WarpDest warpDestOverride = { .levelNum = destLevel, .areaIdx = destArea, .nodeId = destWarpNode, }; - if (smlua_call_event_hooks(HOOK_BEFORE_WARP, destLevel, destArea, destWarpNode, arg, &warpDestOverride)) { + if (smlua_call_event_hooks(HOOK_BEFORE_WARP, destLevel, destArea, destWarpNode, warpFlags, &warpDestOverride)) { destLevel = warpDestOverride.levelNum; destArea = warpDestOverride.areaIdx; destWarpNode = warpDestOverride.nodeId; @@ -774,9 +774,9 @@ void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg) { if (destWarpNode >= WARP_NODE_CREDITS_MIN) { sWarpDest.type = WARP_TYPE_CHANGE_LEVEL; - } else if (arg == WARP_ARG_EXIT_COURSE) { + } else if (warpFlags == WARP_FLAG_EXIT_COURSE) { sWarpDest.type = WARP_TYPE_CHANGE_LEVEL; - arg = 0; + warpFlags = 0; } else if (destLevel != gCurrLevelNum) { sWarpDest.type = WARP_TYPE_CHANGE_LEVEL; } else if (destArea != gCurrentArea->index) { @@ -788,7 +788,7 @@ void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg) { sWarpDest.levelNum = destLevel; sWarpDest.areaIdx = destArea; sWarpDest.nodeId = destWarpNode; - sWarpDest.arg = arg; + sWarpDest.arg = warpFlags; } /** @@ -818,7 +818,7 @@ static void initiate_painting_warp_node(struct WarpNode *pWarpNode) { sWarpCheckpointActive = check_warp_checkpoint(&warpNode); } - initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, 0); + initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, WARP_FLAGS_NONE); check_if_should_set_warp_checkpoint(&warpNode); extern s16 gMenuMode; @@ -887,23 +887,23 @@ void verify_warp(struct MarioState *m, bool killMario) { * based on the warp operation and sometimes Mario's used object. * Return the time left until the delayed warp is initiated. */ -s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { +s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { // only allow for local player if (m != &gMarioStates[0]) { return 0; } - s32 val04 = TRUE; + s32 fadeMusic = TRUE; if (sDelayedWarpOp == WARP_OP_NONE) { m->invincTimer = -1; - sDelayedWarpArg = 0; + sDelayedWarpArg = WARP_FLAGS_NONE; sDelayedWarpOp = warpOp; switch (warpOp) { case WARP_OP_DEMO_NEXT: case WARP_OP_DEMO_END: sDelayedWarpTimer = 20; // Must be one line to match on -O2 - val04 = FALSE; + fadeMusic = FALSE; if (!gDjuiInMainMenu) { - sSourceWarpNodeId = WARP_NODE_F0; + sSourceWarpNodeId = WARP_NODE_DEFAULT; gSavedCourseNum = COURSE_NONE; play_transition(WARP_TRANSITION_FADE_INTO_STAR, 0x14, 0x00, 0x00, 0x00); } else { @@ -913,16 +913,16 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { case WARP_OP_CREDITS_END: sDelayedWarpTimer = 60; - sSourceWarpNodeId = WARP_NODE_F0; + sSourceWarpNodeId = WARP_NODE_DEFAULT; verify_warp(m, false); - val04 = FALSE; + fadeMusic = FALSE; gSavedCourseNum = COURSE_NONE; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x3C, 0x00, 0x00, 0x00); break; case WARP_OP_STAR_EXIT: sDelayedWarpTimer = 32; - sSourceWarpNodeId = WARP_NODE_F0; + sSourceWarpNodeId = WARP_NODE_DEFAULT; verify_warp(m, false); gSavedCourseNum = COURSE_NONE; play_transition(WARP_TRANSITION_FADE_INTO_MARIO, 0x20, 0x00, 0x00, 0x00); @@ -941,7 +941,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { case WARP_OP_EXIT: sSourceWarpNodeId = WARP_NODE_DEATH; sDelayedWarpTimer = 20; - sDelayedWarpArg = WARP_ARG_EXIT_COURSE; + sDelayedWarpArg = WARP_FLAG_EXIT_COURSE; play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00); break; @@ -954,7 +954,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { case WARP_OP_LOOK_UP: // enter totwc sDelayedWarpTimer = 30; - sSourceWarpNodeId = WARP_NODE_F2; + sSourceWarpNodeId = WARP_NODE_LOOK_UP; verify_warp(m, false); play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); #ifndef VERSION_JP @@ -975,7 +975,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { sDelayedWarpTimer = 20; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; verify_warp(m, false); - val04 = !music_changed_through_warp(sSourceWarpNodeId); + fadeMusic = !music_changed_through_warp(sSourceWarpNodeId); play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x14, 0xFF, 0xFF, 0xFF); break; @@ -985,7 +985,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { sDelayedWarpArg = m->actionArg; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; verify_warp(m, false); - val04 = !music_changed_through_warp(sSourceWarpNodeId); + fadeMusic = !music_changed_through_warp(sSourceWarpNodeId); play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00); break; @@ -994,7 +994,7 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { sDelayedWarpTimer = 20; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; verify_warp(m, false); - val04 = !music_changed_through_warp(sSourceWarpNodeId); + fadeMusic = !music_changed_through_warp(sSourceWarpNodeId); play_transition(WARP_TRANSITION_FADE_INTO_STAR, 0x14, 0x00, 0x00, 0x00); break; @@ -1012,11 +1012,11 @@ s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { sDelayedWarpTimer = 20; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x14, 0x00, 0x00, 0x00); } - val04 = FALSE; + fadeMusic = FALSE; break; } - if (val04 && gCurrDemoInput == NULL) { + if (fadeMusic && gCurrDemoInput == NULL) { fadeout_music((3 * sDelayedWarpTimer / 2) * 8 - 2); } } @@ -1072,7 +1072,7 @@ void initiate_delayed_warp(void) { gCurrActStarNum = 99; gCurrActNum = 99; initiate_warp(gCurrCreditsEntry->levelNum, gCurrCreditsEntry->areaIndex, - WARP_NODE_CREDITS_START, 0); + WARP_NODE_CREDITS_START, WARP_FLAGS_NONE); } break; @@ -1096,7 +1096,7 @@ void initiate_delayed_warp(void) { } initiate_warp(gCurrCreditsEntry->levelNum, gCurrCreditsEntry->areaIndex, - destWarpNode, 0); + destWarpNode, WARP_FLAGS_NONE); } break; @@ -1347,13 +1347,13 @@ s32 play_mode_normal(void) { } s32 play_mode_paused(void) { - if (gPauseScreenMode == 0) { + if (gMenuOptSelectIndex == MENU_OPT_NONE) { set_menu_mode(RENDER_PAUSE_SCREEN); - } else if (gPauseScreenMode == 1) { + } else if (gMenuOptSelectIndex == MENU_OPT_DEFAULT) { raise_background_noise(1); gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN; set_play_mode(PLAY_MODE_NORMAL); - } else if (gPauseScreenMode == 2) { + } else if (gMenuOptSelectIndex == MENU_OPT_EXIT_COURSE) { extern s16 gPrevMenuMode; if (gPrevMenuMode > 1) { // Course complete screen raise_background_noise(1); @@ -1362,22 +1362,17 @@ s32 play_mode_paused(void) { level_trigger_warp(&gMarioStates[0], WARP_OP_EXIT); } set_play_mode(PLAY_MODE_NORMAL); - } else if (gPauseScreenMode == 3) { + } else if (gMenuOptSelectIndex == MENU_OPT_EXIT_TO_CASTLE) { // Exit level if (gDebugLevelSelect) { - fade_into_special_warp(-9, 1); + fade_into_special_warp(WARP_SPECIAL_LEVEL_SELECT, 1); } else { - initiate_warp(gLevelValues.exitCastleLevel, gLevelValues.exitCastleArea, gLevelValues.exitCastleWarpNode, WARP_ARG_EXIT_COURSE); - fade_into_special_warp(0, 0); + initiate_warp(gLevelValues.exitCastleLevel, gLevelValues.exitCastleArea, gLevelValues.exitCastleWarpNode, WARP_FLAG_EXIT_COURSE); + fade_into_special_warp(WARP_SPECIAL_NONE, 0); gSavedCourseNum = COURSE_NONE; } set_play_mode(PLAY_MODE_CHANGE_LEVEL); - } /* else if (gPauseScreenMode == 4) { - // We should only be getting "int 4" to here - initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0); - fade_into_special_warp(0, 0); - game_exit(); - }*/ + } if (!gLevelValues.zoomOutCameraOnPause || !network_check_singleplayer_pause()) { gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN; diff --git a/src/game/level_update.h b/src/game/level_update.h index f136c1280..0315bc05c 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -7,30 +7,33 @@ #include "pc/djui/djui.h" -#define TIMER_CONTROL_SHOW 0 -#define TIMER_CONTROL_START 1 -#define TIMER_CONTROL_STOP 2 -#define TIMER_CONTROL_HIDE 3 +enum TimerControl { + TIMER_CONTROL_SHOW, + TIMER_CONTROL_START, + TIMER_CONTROL_STOP, + TIMER_CONTROL_HIDE +}; -#define WARP_OP_NONE 0x00 -#define WARP_OP_LOOK_UP 0x01 -#define WARP_OP_SPIN_SHRINK 0x02 -#define WARP_OP_WARP_DOOR 0x03 -#define WARP_OP_WARP_OBJECT 0x04 -#define WARP_OP_TELEPORT 0x05 -#define WARP_OP_STAR_EXIT 0x11 -#define WARP_OP_DEATH 0x12 -#define WARP_OP_WARP_FLOOR 0x13 -#define WARP_OP_GAME_OVER 0x14 -#define WARP_OP_CREDITS_END 0x15 -#define WARP_OP_DEMO_NEXT 0x16 -#define WARP_OP_CREDITS_START 0x17 -#define WARP_OP_CREDITS_NEXT 0x18 -#define WARP_OP_DEMO_END 0x19 -#define WARP_OP_FORCE_SYNC 0x20 -#define WARP_OP_EXIT 0x21 - -#define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10 +enum WarpOperation { + WARP_OP_NONE, + WARP_OP_LOOK_UP, + WARP_OP_SPIN_SHRINK, + WARP_OP_WARP_DOOR, + WARP_OP_WARP_OBJECT, + WARP_OP_TELEPORT, + WARP_OP_TRIGGERS_LEVEL_SELECT = 0x10, + WARP_OP_STAR_EXIT, + WARP_OP_DEATH, + WARP_OP_WARP_FLOOR, + WARP_OP_GAME_OVER, + WARP_OP_CREDITS_END, + WARP_OP_DEMO_NEXT, + WARP_OP_CREDITS_START, + WARP_OP_CREDITS_NEXT, + WARP_OP_DEMO_END, + WARP_OP_FORCE_SYNC, + WARP_OP_EXIT +}; enum SpecialWarpDestinations { WARP_SPECIAL_LEVEL_SELECT = -9, @@ -42,6 +45,14 @@ enum SpecialWarpDestinations { WARP_SPECIAL_NONE = 0, }; +enum WarpFlags { + WARP_FLAGS_NONE = (0 << 0), + WARP_FLAG_DOOR_PULLED = (1 << 0), + WARP_FLAG_DOOR_FLIP_MARIO = (1 << 1), + WARP_FLAG_DOOR_IS_WARP = (1 << 2), + WARP_FLAG_EXIT_COURSE = (1 << 3), +}; + enum MarioSpawnType { MARIO_SPAWN_NONE, MARIO_SPAWN_DOOR_WARP, @@ -66,25 +77,24 @@ enum MarioSpawnType { MARIO_SPAWN_FADE_FROM_BLACK }; -#define MARIO_SPAWN_UNKNOWN_02 0x02 -#define MARIO_SPAWN_UNKNOWN_03 0x03 -#define MARIO_SPAWN_UNKNOWN_27 0x27 +enum WarpNodes { + WARP_NODE_MAIN_ENTRY = 0x0A, + WARP_NODE_DEFAULT = 0xF0, + WARP_NODE_DEATH = 0xF1, + WARP_NODE_LOOK_UP = 0xF2, + WARP_NODE_WARP_FLOOR = 0xF3, + WARP_NODE_CREDITS_MIN = 0xF8, + WARP_NODE_CREDITS_START = 0xF8, + WARP_NODE_CREDITS_NEXT = 0xF9, + WARP_NODE_CREDITS_END = 0xFA +}; -#define WARP_NODE_F0 0xF0 -#define WARP_NODE_DEATH 0xF1 -#define WARP_NODE_F2 0xF2 -#define WARP_NODE_WARP_FLOOR 0xF3 -#define WARP_NODE_CREDITS_START 0xF8 -#define WARP_NODE_CREDITS_NEXT 0xF9 -#define WARP_NODE_CREDITS_END 0xFA -#define WARP_NODE_CREDITS_MIN 0xF8 - -#define WARP_TYPE_NOT_WARPING 0 -#define WARP_TYPE_CHANGE_LEVEL 1 -#define WARP_TYPE_CHANGE_AREA 2 -#define WARP_TYPE_SAME_AREA 3 - -#define WARP_ARG_EXIT_COURSE -1 +enum WarpTypes { + WARP_TYPE_NOT_WARPING, + WARP_TYPE_CHANGE_LEVEL, + WARP_TYPE_CHANGE_AREA, + WARP_TYPE_SAME_AREA +}; #define PRESS_START_DEMO_TIMER 800 @@ -183,13 +193,13 @@ struct WarpNode *get_painting_warp_node(void); /* |description|Initiates a painting warp of `paintingIndex`|descriptionEnd| */ void initiate_painting_warp(s16 paintingIndex); /* |description|Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m`|descriptionEnd| */ -s16 level_trigger_warp(struct MarioState *m, s32 warpOp); +s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp); void level_set_transition(s16 length, void (*updateFunction)(s16 *)); void set_play_mode(s16 playMode); /* |description|Special warps to arg (`WARP_SPECIAL_*`)|descriptionEnd| */ void warp_special(enum SpecialWarpDestinations arg); -/* |description|Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead|descriptionEnd| */ -void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg); +/* |description|Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `warpFlags`. This function is unstable and it's generally recommended to use `warp_to_level` instead|descriptionEnd| */ +void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags); s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused); s32 lvl_init_from_save_file(UNUSED s16 arg0, s16 levelNum); diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 4ac9cb242..19176e281 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -1077,7 +1077,7 @@ s32 act_bubbled(struct MarioState* m) { } if (allInBubble) { if (m->actionState++ == 60) { - level_trigger_warp(m, WARP_OP_DEATH); + level_trigger_warp(m, WARP_OP_EXIT); } } else { m->actionState = 0; } } diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 2f5c267d9..08d09273e 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -38,7 +38,7 @@ #include "pc/lua/smlua_hooks.h" // TODO: put this elsewhere -enum SaveOption { SAVE_OPT_SAVE_AND_CONTINUE = 1, /*SAVE_OPT_SAVE_AND_QUIT, SAVE_OPT_SAVE_EXIT_GAME,*/ SAVE_OPT_CONTINUE_DONT_SAVE }; +enum SaveOption { SAVE_OPT_SAVE_AND_CONTINUE = 1, /*SAVE_OPT_SAVE_AND_QUIT,*/ SAVE_OPT_CONTINUE_DONT_SAVE }; static struct Object* sIntroWarpPipeObj[MAX_PLAYERS] = { 0 }; static struct Object *sEndPeachObj; @@ -288,20 +288,16 @@ void handle_save_menu(struct MarioState *m) { // wait for the menu to show up if (is_anim_past_end(m) && gSaveOptSelectIndex != 0) { // save and continue / save and quit - if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_CONTINUE /*|| gSaveOptSelectIndex == SAVE_OPT_SAVE_EXIT_GAME || gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT*/) { + if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_CONTINUE /*|| gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT*/) { save_file_do_save(gCurrSaveFileNum - 1, FALSE); /*if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT) { - fade_into_special_warp(-2, 0); // reset game - } else if (gSaveOptSelectIndex == SAVE_OPT_SAVE_EXIT_GAME) { - //initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0); - fade_into_special_warp(0, 0); - game_exit(); + fade_into_special_warp(WARP_SPECIAL_MARIO_HEAD_REGULAR, 0); // reset game }*/ } // not quitting - //if (gSaveOptSelectIndex != SAVE_OPT_SAVE_EXIT_GAME) { + //if (gSaveOptSelectIndex != SAVE_OPT_SAVE_AND_QUIT) { disable_time_stop(); m->faceAngle[1] += 0x8000; // figure out what dialog to show, if we should @@ -976,7 +972,7 @@ s32 act_unlocking_key_door(struct MarioState *m) { m->pos[2] = m->usedObj->oPosZ + sins(m->faceAngle[1]) * 75.0f; } - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } @@ -1020,7 +1016,7 @@ s32 act_unlocking_star_door(struct MarioState *m) { if (m->usedObj != NULL) { m->faceAngle[1] = m->usedObj->oMoveAngleYaw; } - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } m->marioObj->oMarioReadingSignDPosX = m->pos[0]; @@ -1077,7 +1073,7 @@ s32 act_entering_star_door(struct MarioState *m) { // ~30 degrees / 1/12 rot if (m->usedObj != NULL) { targetAngle = m->usedObj->oMoveAngleYaw + 0x1555; } - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { targetAngle += 0x5556; // ~120 degrees / 1/3 rot (total 150d / 5/12) } @@ -1108,7 +1104,7 @@ s32 act_entering_star_door(struct MarioState *m) { m->faceAngle[1] = m->usedObj->oMoveAngleYaw; } - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } @@ -1130,7 +1126,7 @@ s32 act_entering_star_door(struct MarioState *m) { s32 act_going_through_door(struct MarioState *m) { if (!m) { return 0; } if (m->actionTimer == 0) { - if (m->actionArg & 1) { + if (m->actionArg & WARP_FLAG_DOOR_PULLED) { if (m->interactObj != NULL) { m->interactObj->oInteractStatus = 0x00010000; } @@ -1151,12 +1147,12 @@ s32 act_going_through_door(struct MarioState *m) { update_mario_pos_for_anim(m); stop_and_set_height_to_floor(m); - if (m->actionArg & 4) { + if (m->actionArg & WARP_FLAG_DOOR_IS_WARP) { if (m->actionTimer == 16) { level_trigger_warp(m, WARP_OP_WARP_DOOR); } } else if (is_anim_at_end(m)) { - if (m->actionArg & 2) { + if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { m->faceAngle[1] += 0x8000; } set_mario_action(m, ACT_IDLE, 0); @@ -1184,7 +1180,7 @@ s32 act_warp_door_spawn(struct MarioState *m) { if (m->actionState == 0) { m->actionState = 1; if (m->usedObj != NULL) { - if (m->actionArg & 1) { + if (m->actionArg & WARP_FLAG_DOOR_PULLED) { m->usedObj->oInteractStatus = 0x00040000; } else { m->usedObj->oInteractStatus = 0x00080000; @@ -1430,7 +1426,7 @@ s32 act_exit_land_save_dialog(struct MarioState *m) { } static void lose_life_after_death_exit(struct MarioState *m) { - if (sDelayedWarpArg != WARP_ARG_EXIT_COURSE) { + if (~sDelayedWarpArg & WARP_FLAG_EXIT_COURSE) { m->numLives--; } } diff --git a/src/game/paintings.h b/src/game/paintings.h index 98fe85fd8..08529ed15 100644 --- a/src/game/paintings.h +++ b/src/game/paintings.h @@ -48,6 +48,11 @@ typedef struct { signed char n[3]; /* normal */ } Vtx_Interp; +#define DEF_PAINTING(name, ...) \ +struct Painting name = __VA_ARGS__; \ +const struct Painting default_ ## name = __VA_ARGS__ + +#define RESTORE_PAINTING(name) name = default_ ## name struct Painting { s16 id; diff --git a/src/menu/ingame_text.h b/src/menu/ingame_text.h index 23bb8fd01..085ac7240 100644 --- a/src/menu/ingame_text.h +++ b/src/menu/ingame_text.h @@ -56,7 +56,7 @@ memcpy(_var, g ## _text, _text ## _LENGTH) #define TEXT_MYSCORE_LENGTH 8 #define TEXT_CONTINUE_LENGTH 9 #define TEXT_EXIT_COURSE_LENGTH 12 -#define TEXT_EXIT_GAME 0xe,0x21,0x12,0x1d,0x9e,0x10,0xa,0x16,0xe,0xff +#define TEXT_EXIT_TO_CASTLE 0xe, 0x21, 0x12, 0x1d, 0x9e, 0x1d, 0x18, 0x9e, 0xc, 0xa, 0x1c, 0x1d, 0x15, 0xe, 0xff #define TEXT_CAMERA_ANGLE_R_LENGTH 24 #define TEXT_LAKITU_MARIO_LENGTH 15 #define TEXT_LAKITU_STOP_LENGTH 14 @@ -67,7 +67,6 @@ memcpy(_var, g ## _text, _text ## _LENGTH) #define TEXT_HUD_HI_SCORE_LENGTH 9 #define TEXT_SAVE_AND_CONTINUE_LENGTH 16 #define TEXT_SAVE_AND_QUIT_LENGTH 12 -#define TEXT_SAVE_EXIT_GAME 0x1c,0xa,0x1f,0xe,0x9e,0xe5,0x9e,0xe,0x21,0x12,0x1d,0x9e,0x10,0xa,0x16,0xe,0xff #define TEXT_CONTINUE_WITHOUT_SAVING_LENGTH 21 #define TEXT_FILE_MARIO_EXCLAMATION_LENGTH 7 #define TEXT_POWER_STARS_RESTORED_LENGTH 52 diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 1fc2fe336..bd86da1cc 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -1290,7 +1290,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] = { "yaw", LVT_S16, offsetof(struct LakituState, yaw), false, LOT_NONE }, }; -#define LUA_LEVEL_VALUES_FIELD_COUNT 56 +#define LUA_LEVEL_VALUES_FIELD_COUNT 57 static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { { "bubbleOnDeathBarrierInCapStages", LVT_U8, offsetof(struct LevelValues, bubbleOnDeathBarrierInCapStages), false, LOT_NONE }, { "ceilNormalMaxY", LVT_F32, offsetof(struct LevelValues, ceilNormalMaxY), false, LOT_NONE }, @@ -1327,6 +1327,7 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { "mushroom1UpHeal", LVT_U8, offsetof(struct LevelValues, mushroom1UpHeal), false, LOT_NONE }, { "numCoinsToLife", LVT_U16, offsetof(struct LevelValues, numCoinsToLife), false, LOT_NONE }, { "pauseExitAnywhere", LVT_U8, offsetof(struct LevelValues, pauseExitAnywhere), false, LOT_NONE }, + { "pauseExitMode", LVT_S32, offsetof(struct LevelValues, pauseExitMode), false, LOT_NONE }, { "previewBlueCoins", LVT_U8, offsetof(struct LevelValues, previewBlueCoins), false, LOT_NONE }, { "pssSlideStarIndex", LVT_U8, offsetof(struct LevelValues, pssSlideStarIndex), false, LOT_NONE }, { "pssSlideStarTime", LVT_U16, offsetof(struct LevelValues, pssSlideStarTime), false, LOT_NONE }, diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index b60161a23..d6c30f955 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -524,6 +524,18 @@ const char gSmluaConstants[] = "" "WARP_TRANSITION_FADE_INTO_MARIO=0x11\n" "WARP_TRANSITION_FADE_FROM_BOWSER=0x12\n" "WARP_TRANSITION_FADE_INTO_BOWSER=0x13\n" +"MENU_OPT_NONE=0\n" +"MENU_OPT_1=1\n" +"MENU_OPT_2=2\n" +"MENU_OPT_3=3\n" +"MENU_OPT_DEFAULT=MENU_OPT_1\n" +"MENU_OPT_CONTINUE=MENU_OPT_1\n" +"MENU_OPT_EXIT_COURSE=MENU_OPT_2\n" +"MENU_OPT_CAMERA_ANGLE_R=MENU_OPT_3\n" +"MENU_OPT_EXIT_TO_CASTLE=MENU_OPT_3 + 1\n" +"MENU_OPT_SAVE_AND_CONTINUE=MENU_OPT_1\n" +"MENU_OPT_SAVE_AND_QUIT=MENU_OPT_2\n" +"MENU_OPT_CONTINUE_DONT_SAVE=MENU_OPT_3\n" "VERSION_REGION='US'\n" "id_bhv1Up=0\n" "id_bhv1upJumpOnApproach=1\n" @@ -1650,6 +1662,12 @@ const char gSmluaConstants[] = "" "GEO_CONTEXT_AREA_LOAD=3\n" "GEO_CONTEXT_AREA_INIT=4\n" "GEO_CONTEXT_HELD_OBJ=5\n" +"PAUSE_EXIT_VANILLA=0\n" +"PAUSE_EXIT_COURSE=1\n" +"PAUSE_EXIT_TO_CASTLE=2\n" +"PAUSE_EXIT_BOTH=3\n" +"STARS_NEEDED_FOR_DIALOG_COUNT=6\n" +"EXCLAMATION_BOX_MAX_SIZE=99\n" "INTERACT_UNKNOWN_08=(1 << 8)\n" "INTERACT_HOOT=(1 << 0)\n" "INTERACT_GRABBABLE=(1 << 1)\n" @@ -1785,24 +1803,24 @@ const char gSmluaConstants[] = "" "TIMER_CONTROL_START=1\n" "TIMER_CONTROL_STOP=2\n" "TIMER_CONTROL_HIDE=3\n" -"WARP_OP_NONE=0x00\n" -"WARP_OP_LOOK_UP=0x01\n" -"WARP_OP_SPIN_SHRINK=0x02\n" -"WARP_OP_WARP_DOOR=0x03\n" -"WARP_OP_WARP_OBJECT=0x04\n" -"WARP_OP_TELEPORT=0x05\n" -"WARP_OP_STAR_EXIT=0x11\n" -"WARP_OP_DEATH=0x12\n" -"WARP_OP_WARP_FLOOR=0x13\n" -"WARP_OP_GAME_OVER=0x14\n" -"WARP_OP_CREDITS_END=0x15\n" -"WARP_OP_DEMO_NEXT=0x16\n" -"WARP_OP_CREDITS_START=0x17\n" -"WARP_OP_CREDITS_NEXT=0x18\n" -"WARP_OP_DEMO_END=0x19\n" -"WARP_OP_FORCE_SYNC=0x20\n" -"WARP_OP_EXIT=0x21\n" +"WARP_OP_NONE=0\n" +"WARP_OP_LOOK_UP=1\n" +"WARP_OP_SPIN_SHRINK=2\n" +"WARP_OP_WARP_DOOR=3\n" +"WARP_OP_WARP_OBJECT=4\n" +"WARP_OP_TELEPORT=5\n" "WARP_OP_TRIGGERS_LEVEL_SELECT=0x10\n" +"WARP_OP_STAR_EXIT=17\n" +"WARP_OP_DEATH=18\n" +"WARP_OP_WARP_FLOOR=19\n" +"WARP_OP_GAME_OVER=20\n" +"WARP_OP_CREDITS_END=21\n" +"WARP_OP_DEMO_NEXT=22\n" +"WARP_OP_CREDITS_START=23\n" +"WARP_OP_CREDITS_NEXT=24\n" +"WARP_OP_DEMO_END=25\n" +"WARP_OP_FORCE_SYNC=26\n" +"WARP_OP_EXIT=27\n" "WARP_SPECIAL_LEVEL_SELECT=-9\n" "WARP_SPECIAL_INTRO_SPLASH_SCREEN=-8\n" "WARP_SPECIAL_SWITCH_FILE=-7\n" @@ -1810,6 +1828,11 @@ const char gSmluaConstants[] = "" "WARP_SPECIAL_MARIO_HEAD_REGULAR=-2\n" "WARP_SPECIAL_ENDING=-1\n" "WARP_SPECIAL_NONE=0\n" +"WARP_FLAGS_NONE=(0 << 0)\n" +"WARP_FLAG_DOOR_PULLED=(1 << 0)\n" +"WARP_FLAG_DOOR_FLIP_MARIO=(1 << 1)\n" +"WARP_FLAG_DOOR_IS_WARP=(1 << 2)\n" +"WARP_FLAG_EXIT_COURSE=(1 << 3)\n" "MARIO_SPAWN_NONE=0\n" "MARIO_SPAWN_DOOR_WARP=1\n" "MARIO_SPAWN_IDLE=2\n" @@ -1831,22 +1854,19 @@ const char gSmluaConstants[] = "" "MARIO_SPAWN_LAUNCH_DEATH=37\n" "MARIO_SPAWN_UNUSED_38=38\n" "MARIO_SPAWN_FADE_FROM_BLACK=39\n" -"MARIO_SPAWN_UNKNOWN_02=0x02\n" -"MARIO_SPAWN_UNKNOWN_03=0x03\n" -"MARIO_SPAWN_UNKNOWN_27=0x27\n" -"WARP_NODE_F0=0xF0\n" +"WARP_NODE_MAIN_ENTRY=0x0A\n" +"WARP_NODE_DEFAULT=0xF0\n" "WARP_NODE_DEATH=0xF1\n" -"WARP_NODE_F2=0xF2\n" +"WARP_NODE_LOOK_UP=0xF2\n" "WARP_NODE_WARP_FLOOR=0xF3\n" +"WARP_NODE_CREDITS_MIN=0xF8\n" "WARP_NODE_CREDITS_START=0xF8\n" "WARP_NODE_CREDITS_NEXT=0xF9\n" "WARP_NODE_CREDITS_END=0xFA\n" -"WARP_NODE_CREDITS_MIN=0xF8\n" "WARP_TYPE_NOT_WARPING=0\n" "WARP_TYPE_CHANGE_LEVEL=1\n" "WARP_TYPE_CHANGE_AREA=2\n" "WARP_TYPE_SAME_AREA=3\n" -"WARP_ARG_EXIT_COURSE=-1\n" "PRESS_START_DEMO_TIMER=800\n" "PAINTING_WARP_INDEX_START=0x00\n" "PAINTING_WARP_INDEX_FA=0x2A\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index ab17841e0..d90e32a6b 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15478,7 +15478,7 @@ int smlua_func_level_trigger_warp(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "level_trigger_warp"); return 0; } - s32 warpOp = smlua_to_integer(L, 2); + int warpOp = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "level_trigger_warp"); return 0; } lua_pushinteger(L, level_trigger_warp(m, warpOp)); @@ -15518,10 +15518,10 @@ int smlua_func_initiate_warp(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "initiate_warp"); return 0; } s16 destWarpNode = smlua_to_integer(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "initiate_warp"); return 0; } - s32 arg = smlua_to_integer(L, 4); + s32 warpFlags = smlua_to_integer(L, 4); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "initiate_warp"); return 0; } - initiate_warp(destLevel, destArea, destWarpNode, arg); + initiate_warp(destLevel, destArea, destWarpNode, warpFlags); return 1; } diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index eb4a98956..0b5060d50 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -321,7 +321,7 @@ void game_unpause(void) { level_set_transition(0, NULL); gMenuMode = -1; gDialogBoxState = 0; - gPauseScreenMode = 1; + gMenuOptSelectIndex = 1; } /// From a047e16a9b66bb5d47f3c5abfab9a0a3b4e44904 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 01:15:35 -0500 Subject: [PATCH 05/16] Allow bubbled players to stay alive --- autogen/lua_definitions/functions.lua | 3 ++- docs/lua/functions-4.md | 5 +++-- src/game/interaction.c | 2 +- src/game/level_update.c | 2 +- src/game/mario.c | 15 +++++++++------ src/game/mario.h | 2 +- src/game/mario_actions_airborne.c | 2 +- src/game/mario_actions_automatic.c | 8 +++++--- src/game/mario_actions_cutscene.c | 10 +++++----- src/game/mario_actions_submerged.c | 6 +++--- src/pc/lua/smlua_functions_autogen.c | 11 ++++++++--- src/pc/network/packets/packet_player.c | 2 +- 12 files changed, 40 insertions(+), 28 deletions(-) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 443b2f0a3..a0a7c2680 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5663,8 +5663,9 @@ function mario_can_bubble(m) end --- @param m MarioState +--- @param stayAlive? boolean --- Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives and preventing normal movement -function mario_set_bubbled(m) +function mario_set_bubbled(m, stayAlive) -- ... end diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 114faf99d..1c6409519 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -1231,18 +1231,19 @@ Checks whether Mario can become bubbled under certain game conditions (multiplay Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives and preventing normal movement ### Lua Example -`mario_set_bubbled(m)` +`mario_set_bubbled(m, stayAlive)` ### Parameters | Field | Type | | ----- | ---- | | m | [MarioState](structs.md#MarioState) | +| stayAlive | `boolean` | ### Returns - None ### C Prototype -`void mario_set_bubbled(struct MarioState* m);` +`void mario_set_bubbled(struct MarioState* m, OPTIONAL bool stayAlive);` [:arrow_up_small:](#) diff --git a/src/game/interaction.c b/src/game/interaction.c index c95152e37..e4873b44d 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -2455,7 +2455,7 @@ void check_death_barrier(struct MarioState *m) { break; } default: - mario_set_bubbled(m); + mario_set_bubbled(m, false); return; } } diff --git a/src/game/level_update.c b/src/game/level_update.c index c39a0436b..73718ded5 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -441,7 +441,7 @@ void init_mario_after_warp(void) { // enforce bubble on area change if (gServerSettings.bubbleDeath) { if (i == 0 && gMarioStates[i].numLives == -1) { - mario_set_bubbled(&gMarioStates[i]); + mario_set_bubbled(&gMarioStates[i], false); gMarioStates[i].health = 0xFF; } } diff --git a/src/game/mario.c b/src/game/mario.c index ac01969fe..56d54cfe1 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -432,17 +432,20 @@ bool mario_can_bubble(struct MarioState* m) { return false; } -void mario_set_bubbled(struct MarioState* m) { +void mario_set_bubbled(struct MarioState* m, OPTIONAL bool stayAlive) { if (!m) { return; } if (m->playerIndex != 0) { return; } if (m->action == ACT_BUBBLED) { return; } - drop_and_set_mario_action(m, ACT_BUBBLED, 0); - if (m->numLives > 0) { - m->numLives--; + drop_and_set_mario_action(m, ACT_BUBBLED, stayAlive); + if (!stayAlive) { + if (m->numLives > 0) { + m->numLives--; + } + m->healCounter = 0; + m->hurtCounter = 31; } - m->healCounter = 0; - m->hurtCounter = 31; + gCamera->cutscene = 0; m->statusForCamera->action = m->action; m->statusForCamera->cameraEvent = 0; diff --git a/src/game/mario.h b/src/game/mario.h index 558baaee0..673458e96 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -141,7 +141,7 @@ bool mario_can_bubble(struct MarioState* m); /* |description| Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives and preventing normal movement |descriptionEnd| */ -void mario_set_bubbled(struct MarioState* m); +void mario_set_bubbled(struct MarioState* m, OPTIONAL bool stayAlive); /* |description| Sets Mario's forward velocity (`m.forwardVel`) and updates `slideVelX/Z` and `m.vel` accordingly, based on `m.faceAngle.y`. diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index 04209460d..80076e95f 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -1736,7 +1736,7 @@ s32 act_lava_boost(struct MarioState *m) { if ((mario_can_bubble(m) && m->numLives > 0)) { m->health = 0xFF; - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); } diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 19176e281..a4ec07fd7 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -1032,9 +1032,11 @@ Makes Mario act like he was popped from a bubble. Useful for custom bubble poppi void mario_pop_bubble(struct MarioState* m) { if (!m) { return; } m->marioObj->activeFlags &= ~ACTIVE_FLAG_MOVE_THROUGH_GRATE; - m->hurtCounter = 0; - m->healCounter = 31; - m->health = 0x100; + if (!m->actionArg) { + m->hurtCounter = 0; + m->healCounter = 31; + m->health = 0x100; + } m->marioObj->oIntangibleTimer = 0; m->peakHeight = m->pos[1]; mario_set_forward_vel(m, 0.0f); diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 08d09273e..ba919a3a0 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -839,7 +839,7 @@ s32 common_death_handler(struct MarioState *m, s32 animation, s32 frameToDeathWa if (!allowDeath) { return animFrame; } if ((mario_can_bubble(m) && m->numLives > 0)) { - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); } @@ -912,7 +912,7 @@ s32 act_quicksand_death(struct MarioState *m) { smlua_call_event_hooks(HOOK_ON_DEATH, m, &allowDeath); if (!allowDeath) { return FALSE; } if ((mario_can_bubble(m) && m->numLives > 0)) { - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); } @@ -937,7 +937,7 @@ s32 act_eaten_by_bubba(struct MarioState *m) { if ((mario_can_bubble(m) && m->numLives > 0)) { m->health = 0xFF; - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); } @@ -1828,7 +1828,7 @@ s32 act_squished(struct MarioState *m) { if (!allowDeath) { return FALSE; } if ((mario_can_bubble(m) && m->numLives > 0)) { - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); // woosh, he's gone! @@ -1879,7 +1879,7 @@ s32 act_squished(struct MarioState *m) { if (!allowDeath) { return FALSE; } if ((mario_can_bubble(m) && m->numLives > 0)) { - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { // 0 units of health m->health = 0x00FF; diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index 1268c8173..22a63baec 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -1004,7 +1004,7 @@ static s32 act_drowning(struct MarioState *m) { if (!allowDeath) { return FALSE; } if ((mario_can_bubble(m) && m->numLives > 0)) { - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); } @@ -1039,7 +1039,7 @@ static s32 act_water_death(struct MarioState *m) { if (!allowDeath) { return FALSE; } if ((mario_can_bubble(m) && m->numLives > 0)) { - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); } @@ -1165,7 +1165,7 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) { if (!allowDeath) { reset_rumble_timers(m); return FALSE; } if ((mario_can_bubble(m) && m->numLives > 0)) { - mario_set_bubbled(m); + mario_set_bubbled(m, false); } else { level_trigger_warp(m, WARP_OP_DEATH); } diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index d90e32a6b..2cd3091a8 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -16537,15 +16537,20 @@ int smlua_func_mario_set_bubbled(lua_State* L) { if (L == NULL) { return 0; } int top = lua_gettop(L); - if (top != 1) { - LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "mario_set_bubbled", 1, top); + if (top < 1 || top > 2) { + LOG_LUA_LINE("Improper param count for '%s': Expected between %u and %u, Received %u", "mario_set_bubbled", 1, 2, top); return 0; } struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "mario_set_bubbled"); return 0; } + bool stayAlive = (bool) 0; + if (top >= 2) { + stayAlive = smlua_to_boolean(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "mario_set_bubbled"); return 0; } + } - mario_set_bubbled(m); + mario_set_bubbled(m, stayAlive); return 1; } diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c index b43be91f5..a39b6eff3 100644 --- a/src/pc/network/packets/packet_player.c +++ b/src/pc/network/packets/packet_player.c @@ -398,7 +398,7 @@ void network_receive_player(struct Packet* p) { } // inform of player death - if (oldData.action != ACT_BUBBLED && data.action == ACT_BUBBLED) { + if (oldData.action != ACT_BUBBLED && data.action == ACT_BUBBLED && !data.actionArg) { construct_player_popup(np, DLANG(NOTIF, DIED), NULL); } From 6d6093fec0381c2e289641bb21eea0cbf4281e9a Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 01:55:52 -0500 Subject: [PATCH 06/16] Fix instant re-entry Look-Up Warp "better"cam bug Alternatively, Also fix that one bug pointed out a few days ago where you can re-enter TotWC instantly after exiting, resulting in the death exit action stealing lives since the pause exit warp flag was just cleared Now, the Look-Up Warp may only be performed when in the appropriate action --- src/game/bettercamera.inc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/bettercamera.inc.h b/src/game/bettercamera.inc.h index 82adc64eb..2be712b31 100644 --- a/src/game/bettercamera.inc.h +++ b/src/game/bettercamera.inc.h @@ -600,6 +600,7 @@ static void newcam_apply_values(struct Camera *c) { // Adds support for wing mario tower if (gNewCamera.tilt < -8000 && sCurrPlayMode != PLAY_MODE_PAUSED && + gMarioState->action & ACT_FLAG_ALLOW_FIRST_PERSON && gMarioState->floor != NULL && gMarioState->floor->type == SURFACE_LOOK_UP_WARP && gMarioState->forwardVel == 0 && From 965884fb3b07b286754d5559bae0f29d6c2a9774 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 02:04:35 -0500 Subject: [PATCH 07/16] Address robot nitpicks --- autogen/lua_definitions/functions.lua | 2 +- docs/lua/functions-4.md | 2 +- src/game/hardcoded.c | 5 ++--- src/game/ingame_menu.c | 4 ++-- src/game/mario.h | 2 +- src/pc/lua/utils/smlua_misc_utils.c | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index a0a7c2680..b8e0db719 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5664,7 +5664,7 @@ end --- @param m MarioState --- @param stayAlive? boolean ---- Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives and preventing normal movement +--- Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives by default and preventing normal movement function mario_set_bubbled(m, stayAlive) -- ... end diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 1c6409519..a67e65131 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -1228,7 +1228,7 @@ Checks whether Mario can become bubbled under certain game conditions (multiplay ## [mario_set_bubbled](#mario_set_bubbled) ### Description -Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives and preventing normal movement +Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives by default and preventing normal movement ### Lua Example `mario_set_bubbled(m, stayAlive)` diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 78fe167d2..01732506d 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -371,8 +371,7 @@ AT_STARTUP void hardcoded_reset_default_values(void) { RESTORE_PAINTING(ttm_slide_painting); gPaintingValues = gDefaultPaintingValues; - memcpy(sDummyContents, sDefaultExclamationBoxContents, sizeof(struct ExclamationBoxContent) * 15); + memcpy(sDummyContents, sDefaultExclamationBoxContents, sizeof(sDefaultExclamationBoxContents)); gExclamationBoxContents = sDummyContents; - gExclamationBoxSize = 15; - + gExclamationBoxSize = sizeof(sDefaultExclamationBoxContents) / sizeof(sDefaultExclamationBoxContents[0]); } diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index e6d23c09a..d28de08dd 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -2547,9 +2547,9 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) { #else INGAME_TEXT_COPY(textContinue, TEXT_CONTINUE); INGAME_TEXT_COPY(textExitCourse, TEXT_EXIT_COURSE); - u8 textExitToCastle[] = { TEXT_EXIT_TO_CASTLE }; INGAME_TEXT_COPY(textCameraAngleR, TEXT_CAMERA_ANGLE_R); -#endif + #endif + u8 textExitToCastle[] = { TEXT_EXIT_TO_CASTLE }; u8 maxIndex = PAUSE_EXIT_MODE == PAUSE_EXIT_BOTH ? 4 : 3; handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, maxIndex); diff --git a/src/game/mario.h b/src/game/mario.h index 673458e96..f110c4474 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -139,7 +139,7 @@ Checks whether Mario can become bubbled under certain game conditions (multiplay bool mario_can_bubble(struct MarioState* m); /* |description| -Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives and preventing normal movement +Transitions Mario into a bubbled state (if available in multiplayer), decrementing lives by default and preventing normal movement |descriptionEnd| */ void mario_set_bubbled(struct MarioState* m, OPTIONAL bool stayAlive); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index 0b5060d50..f330da884 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -321,7 +321,7 @@ void game_unpause(void) { level_set_transition(0, NULL); gMenuMode = -1; gDialogBoxState = 0; - gMenuOptSelectIndex = 1; + gMenuOptSelectIndex = MENU_OPT_DEFAULT; } /// From 8fd833f34d2bd7a4388dad4c8d0a8163941e93da Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 02:16:32 -0500 Subject: [PATCH 08/16] Fix #3 (Feasible #1) --- autogen/lua_definitions/functions.lua | 2 +- docs/lua/functions-3.md | 4 ++-- src/game/level_update.c | 2 +- src/game/level_update.h | 2 +- src/pc/lua/smlua_functions_autogen.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index b8e0db719..f0b455c1c 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5230,7 +5230,7 @@ function pressed_pause() -- ... end ---- @param arg integer +--- @param arg SpecialWarpDestinations --- @param color integer --- Fades into a special warp with `arg` and using `color` function fade_into_special_warp(arg, color) diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index 9a2f7202f..edef0a319 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -6994,14 +6994,14 @@ Fades into a special warp with `arg` and using `color` ### Parameters | Field | Type | | ----- | ---- | -| arg | `integer` | +| arg | [enum SpecialWarpDestinations](constants.md#enum-SpecialWarpDestinations) | | color | `integer` | ### Returns - None ### C Prototype -`void fade_into_special_warp(u32 arg, u32 color);` +`void fade_into_special_warp(enum SpecialWarpDestinations arg, u32 color);` [:arrow_up_small:](#) diff --git a/src/game/level_update.c b/src/game/level_update.c index 73718ded5..08853b343 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -277,7 +277,7 @@ void warp_special(enum SpecialWarpDestinations arg) { sSpecialWarpDest = arg; } -void fade_into_special_warp(u32 arg, u32 color) { +void fade_into_special_warp(enum SpecialWarpDestinations arg, u32 color) { if (color != 0) { color = 0xFF; } diff --git a/src/game/level_update.h b/src/game/level_update.h index 0315bc05c..ce62bc733 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -183,7 +183,7 @@ u16 level_control_timer(s32 timerOp); /* |description|Checks if the start button has been pressed as well as some other conditions for opening the pause menu depending on if pause anywhere is enabled|descriptionEnd|*/ bool pressed_pause(void); /* |description|Fades into a special warp with `arg` and using `color`|descriptionEnd| */ -void fade_into_special_warp(u32 arg, u32 color); +void fade_into_special_warp(enum SpecialWarpDestinations arg, u32 color); void load_level_init_text(u32 arg); void warp_credits(void); /* |description|Gets an instant warp from the current area's instant warp array (0-3)|descriptionEnd| */ diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 2cd3091a8..1403695fb 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15408,7 +15408,7 @@ int smlua_func_fade_into_special_warp(lua_State* L) { return 0; } - u32 arg = smlua_to_integer(L, 1); + int arg = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fade_into_special_warp"); return 0; } u32 color = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "fade_into_special_warp"); return 0; } From 7baf8eab61bcef36f9115cdfb1cc2cf2e1050d57 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 02:18:25 -0500 Subject: [PATCH 09/16] Fix #4 (Feasible #2) the invisibility was legacy code anyway, you're not *supposed* to reach this point anymore --- src/game/mario_actions_automatic.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index a4ec07fd7..40c79ea83 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -1147,17 +1147,6 @@ s32 act_bubbled(struct MarioState* m) { // offset the player model to be in the center of the bubble bubbled_offset_visual(m); - // make invisible on -1 lives - if (m->playerIndex == 0) { - if (m->numLives <= -1) { - m->marioObj->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE; - level_trigger_warp(m, WARP_OP_DEATH); - return FALSE; - } else { - m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_INVISIBLE; - } - } - // pop bubble if (m->playerIndex == 0 && distanceToPlayer < 120 && is_player_active(targetMarioState) && m->numLives != -1 && ++m->actionTimer > 20) { mario_pop_bubble(m); From 1584352033f742f7f0888b5f5cc3341d38a4cce4 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 02:31:52 -0500 Subject: [PATCH 10/16] Fix #5 (Feasible #3) I believe All I had to do was reorder these conditions --- src/game/mario_actions_automatic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 40c79ea83..b90f2c986 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -1148,7 +1148,7 @@ s32 act_bubbled(struct MarioState* m) { bubbled_offset_visual(m); // pop bubble - if (m->playerIndex == 0 && distanceToPlayer < 120 && is_player_active(targetMarioState) && m->numLives != -1 && ++m->actionTimer > 20) { + if (m->playerIndex == 0 && ++m->actionTimer > 20 && distanceToPlayer < 120 && is_player_active(targetMarioState)) { mario_pop_bubble(m); return TRUE; } From cd857a023ef3fb510cc3705eddde0b63b3cc3cfd Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 02:33:45 -0500 Subject: [PATCH 11/16] Fix #6 (Feasible #4) Made the enums flexible --- autogen/lua_definitions/constants.lua | 24 +++++++++++------------- docs/lua/constants.md | 9 ++++----- src/game/area.h | 10 +++++----- src/game/mario_actions_cutscene.c | 5 +---- src/pc/lua/smlua_constants_autogen.c | 9 ++++----- 5 files changed, 25 insertions(+), 32 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index bc1d494a1..8386309ee 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -618,18 +618,17 @@ WARP_TRANSITION_FADE_FROM_BOWSER = 0x12 --- @type integer WARP_TRANSITION_FADE_INTO_BOWSER = 0x13 -MENU_OPT_NONE = 0 --- @type MenuOption -MENU_OPT_1 = 1 --- @type MenuOption -MENU_OPT_2 = 2 --- @type MenuOption -MENU_OPT_3 = 3 --- @type MenuOption -MENU_OPT_DEFAULT = MENU_OPT_1 --- @type MenuOption -MENU_OPT_CONTINUE = MENU_OPT_1 --- @type MenuOption -MENU_OPT_EXIT_COURSE = MENU_OPT_2 --- @type MenuOption -MENU_OPT_CAMERA_ANGLE_R = MENU_OPT_3 --- @type MenuOption -MENU_OPT_EXIT_TO_CASTLE = MENU_OPT_3 + 1 --- @type MenuOption -MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1 --- @type MenuOption -MENU_OPT_SAVE_AND_QUIT = MENU_OPT_2 --- @type MenuOption -MENU_OPT_CONTINUE_DONT_SAVE = MENU_OPT_3 --- @type MenuOption +MENU_OPT_NONE = 0 --- @type MenuOption +MENU_OPT_1 = 1 --- @type MenuOption +MENU_OPT_2 = 2 --- @type MenuOption +MENU_OPT_3 = 3 --- @type MenuOption +MENU_OPT_DEFAULT = MENU_OPT_1 --- @type MenuOption +MENU_OPT_CONTINUE = MENU_OPT_1 --- @type MenuOption +MENU_OPT_EXIT_COURSE = ((MENU_OPT_CONTINUE) + 1) --- @type MenuOption +MENU_OPT_CAMERA_ANGLE_R = ((MENU_OPT_CONTINUE) + 2) --- @type MenuOption +MENU_OPT_EXIT_TO_CASTLE = ((MENU_OPT_CONTINUE) + 3) --- @type MenuOption +MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1 --- @type MenuOption +MENU_OPT_CONTINUE_DONT_SAVE = ((MENU_OPT_SAVE_AND_CONTINUE) + 1) --- @type MenuOption --- @alias MenuOption --- | `MENU_OPT_NONE` @@ -642,7 +641,6 @@ MENU_OPT_CONTINUE_DONT_SAVE = MENU_OPT_3 --- @type MenuOption --- | `MENU_OPT_CAMERA_ANGLE_R` --- | `MENU_OPT_EXIT_TO_CASTLE` --- | `MENU_OPT_SAVE_AND_CONTINUE` ---- | `MENU_OPT_SAVE_AND_QUIT` --- | `MENU_OPT_CONTINUE_DONT_SAVE` --- @type string diff --git a/docs/lua/constants.md b/docs/lua/constants.md index d4f8b61ae..7fd2706fa 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -134,12 +134,11 @@ | MENU_OPT_3 | 3 | | MENU_OPT_DEFAULT | MENU_OPT_1 | | MENU_OPT_CONTINUE | MENU_OPT_1 | -| MENU_OPT_EXIT_COURSE | MENU_OPT_2 | -| MENU_OPT_CAMERA_ANGLE_R | MENU_OPT_3 | -| MENU_OPT_EXIT_TO_CASTLE | MENU_OPT_3 + 1 | +| MENU_OPT_EXIT_COURSE | ((MENU_OPT_CONTINUE) + 1) | +| MENU_OPT_CAMERA_ANGLE_R | ((MENU_OPT_CONTINUE) + 2) | +| MENU_OPT_EXIT_TO_CASTLE | ((MENU_OPT_CONTINUE) + 3) | | MENU_OPT_SAVE_AND_CONTINUE | MENU_OPT_1 | -| MENU_OPT_SAVE_AND_QUIT | MENU_OPT_2 | -| MENU_OPT_CONTINUE_DONT_SAVE | MENU_OPT_3 | +| MENU_OPT_CONTINUE_DONT_SAVE | ((MENU_OPT_SAVE_AND_CONTINUE) + 1) | - VERSION_REGION [:arrow_up_small:](#) diff --git a/src/game/area.h b/src/game/area.h index ff83741ac..daeac0a13 100644 --- a/src/game/area.h +++ b/src/game/area.h @@ -135,14 +135,14 @@ enum MenuOption { // Course Pause Menu MENU_OPT_CONTINUE = MENU_OPT_1, - MENU_OPT_EXIT_COURSE = MENU_OPT_2, - MENU_OPT_CAMERA_ANGLE_R = MENU_OPT_3, - MENU_OPT_EXIT_TO_CASTLE = MENU_OPT_3 + 1, + MENU_OPT_EXIT_COURSE, + MENU_OPT_CAMERA_ANGLE_R, + MENU_OPT_EXIT_TO_CASTLE, // Save Menu MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1, - MENU_OPT_SAVE_AND_QUIT = MENU_OPT_2, - MENU_OPT_CONTINUE_DONT_SAVE = MENU_OPT_3 + // MENU_OPT_SAVE_AND_QUIT, + MENU_OPT_CONTINUE_DONT_SAVE }; extern struct SpawnInfo gPlayerSpawnInfos[]; diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index ba919a3a0..33aae1544 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -37,9 +37,6 @@ #include "pc/lua/smlua.h" #include "pc/lua/smlua_hooks.h" -// TODO: put this elsewhere -enum SaveOption { SAVE_OPT_SAVE_AND_CONTINUE = 1, /*SAVE_OPT_SAVE_AND_QUIT,*/ SAVE_OPT_CONTINUE_DONT_SAVE }; - static struct Object* sIntroWarpPipeObj[MAX_PLAYERS] = { 0 }; static struct Object *sEndPeachObj; static struct Object *sEndRightToadObj; @@ -288,7 +285,7 @@ void handle_save_menu(struct MarioState *m) { // wait for the menu to show up if (is_anim_past_end(m) && gSaveOptSelectIndex != 0) { // save and continue / save and quit - if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_CONTINUE /*|| gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT*/) { + if (gSaveOptSelectIndex == MENU_OPT_SAVE_AND_CONTINUE /*|| gSaveOptSelectIndex == MENU_OPT_SAVE_AND_QUIT*/) { save_file_do_save(gCurrSaveFileNum - 1, FALSE); /*if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT) { diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index d6c30f955..98fa34964 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -530,12 +530,11 @@ const char gSmluaConstants[] = "" "MENU_OPT_3=3\n" "MENU_OPT_DEFAULT=MENU_OPT_1\n" "MENU_OPT_CONTINUE=MENU_OPT_1\n" -"MENU_OPT_EXIT_COURSE=MENU_OPT_2\n" -"MENU_OPT_CAMERA_ANGLE_R=MENU_OPT_3\n" -"MENU_OPT_EXIT_TO_CASTLE=MENU_OPT_3 + 1\n" +"MENU_OPT_EXIT_COURSE=((MENU_OPT_CONTINUE) + 1)\n" +"MENU_OPT_CAMERA_ANGLE_R=((MENU_OPT_CONTINUE) + 2)\n" +"MENU_OPT_EXIT_TO_CASTLE=((MENU_OPT_CONTINUE) + 3)\n" "MENU_OPT_SAVE_AND_CONTINUE=MENU_OPT_1\n" -"MENU_OPT_SAVE_AND_QUIT=MENU_OPT_2\n" -"MENU_OPT_CONTINUE_DONT_SAVE=MENU_OPT_3\n" +"MENU_OPT_CONTINUE_DONT_SAVE=((MENU_OPT_SAVE_AND_CONTINUE) + 1)\n" "VERSION_REGION='US'\n" "id_bhv1Up=0\n" "id_bhv1upJumpOnApproach=1\n" From 672333b73fc6a81122abcb07279f19135466fb90 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Sat, 13 Jun 2026 22:45:29 -0500 Subject: [PATCH 12/16] A few more names More names - `enum CoinTypes` - added names to a few unknown params/fields - Made `objSetupFunction` optional for spawn object functions --- autogen/lua_definitions/constants.lua | 9 +++++ autogen/lua_definitions/functions.lua | 22 ++++++------ autogen/lua_definitions/structs.lua | 2 +- data/dynos_bin_behavior.cpp | 2 +- docs/lua/constants.md | 8 +++++ docs/lua/functions-6.md | 26 +++++++-------- docs/lua/functions-7.md | 4 +-- docs/lua/structs.md | 2 +- include/object_constants.h | 7 ++++ include/object_fields.h | 8 ++--- src/game/behavior_actions.c | 16 ++++----- src/game/behaviors/coin.inc.c | 2 +- src/game/object_helpers.c | 20 +++++------ src/game/object_helpers.h | 10 ++---- src/pc/lua/smlua_cobject_autogen.c | 2 +- src/pc/lua/smlua_constants_autogen.c | 3 ++ src/pc/lua/smlua_functions_autogen.c | 48 +++++++++++++++------------ src/pc/lua/utils/smlua_obj_utils.c | 4 +-- src/pc/lua/utils/smlua_obj_utils.h | 4 +-- 19 files changed, 114 insertions(+), 85 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 8386309ee..09db5b128 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -5204,6 +5204,15 @@ BOBOMB_ACT_LAVA_DEATH = 100 --- @type integer BOBOMB_ACT_DEATH_PLANE_DEATH = 101 +COIN_TYPE_NONE = 0 --- @type CoinTypes +COIN_TYPE_YELLOW = 1 --- @type CoinTypes +COIN_TYPE_BLUE = 2 --- @type CoinTypes + +--- @alias CoinTypes +--- | `COIN_TYPE_NONE` +--- | `COIN_TYPE_YELLOW` +--- | `COIN_TYPE_BLUE` + --- @type integer HIDDEN_BLUE_COIN_ACT_INACTIVE = 0 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index f0b455c1c..d3324747c 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -9841,29 +9841,29 @@ end --- @param obj Object --- @param numCoins integer ---- @param sp30 number +--- @param baseYVel number --- @param coinBehavior Pointer_BehaviorScript --- @param posJitter integer --- @param model integer --- Spawns loot coins from an object using the specified behavior, jitter, and model -function obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model) +function obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model) -- ... end --- @param obj Object --- @param numCoins integer ---- @param sp28 number +--- @param baseYVel number --- @param posJitter integer --- Spawns blue loot coins from an object -function obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter) +function obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter) -- ... end --- @param obj Object --- @param numCoins integer ---- @param sp28 number +--- @param baseYVel number --- Spawns yellow loot coins from an object -function obj_spawn_loot_yellow_coins(obj, numCoins, sp28) +function obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel) -- ... end @@ -10251,10 +10251,10 @@ function cur_obj_set_hitbox_and_die_if_attacked(hitbox, deathSound, noLootCoins) -- ... end ---- @param sp18 number ---- @param sp1C integer +--- @param mistSize number +--- @param coinType integer --- Explodes the current object, spawns particles, and optionally spawns coins -function obj_explode_and_spawn_coins(sp18, sp1C) +function obj_explode_and_spawn_coins(mistSize, coinType) -- ... end @@ -12449,7 +12449,7 @@ end --- @param x number --- @param y number --- @param z number ---- @param objSetupFunction function +--- @param objSetupFunction? function --- @return Object --- Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation.
--- You can change the fields of the object in `objSetupFunction` @@ -12462,7 +12462,7 @@ end --- @param x number --- @param y number --- @param z number ---- @param objSetupFunction function +--- @param objSetupFunction? function --- @return Object --- Spawns a non-synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation.
--- You can change the fields of the object in `objSetupFunction` diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 187590de6..48319b0e8 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -1580,7 +1580,7 @@ --- @field public oCloudFwooshMovementRadius integer --- @field public oCoinUnkF4 integer --- @field public oCoinUnkF8 integer ---- @field public oCoinUnk110 number +--- @field public oCoinBaseYVel number --- @field public oCoinUnk1B0 integer --- @field public oCollisionParticleUnkF4 number --- @field public oControllablePlatformUnkF8 integer diff --git a/data/dynos_bin_behavior.cpp b/data/dynos_bin_behavior.cpp index f6673b413..d5452ad85 100644 --- a/data/dynos_bin_behavior.cpp +++ b/data/dynos_bin_behavior.cpp @@ -1132,7 +1132,7 @@ s64 DynOS_Bhv_ParseBehaviorScriptConstants(const String &_Arg, bool *found) { /* Coin */ bhv_constant(oCoinUnkF4); bhv_constant(oCoinUnkF8); - bhv_constant(oCoinUnk110); + bhv_constant(oCoinBaseYVel); #ifndef VERSION_JP bhv_constant(oCoinUnk1B0); #endif diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 7fd2706fa..9b6cf38f2 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -79,6 +79,7 @@ - [obj_behaviors.c](#obj_behaviorsc) - [obj_behaviors_2.h](#obj_behaviors_2h) - [object_constants.h](#object_constantsh) + - [enum CoinTypes](#enum-CoinTypes) - [object_list_processor.h](#object_list_processorh) - [enum ObjectList](#enum-ObjectList) - [os_cont.h](#os_conth) @@ -2490,6 +2491,13 @@ - BOBOMB_ACT_EXPLODE - BOBOMB_ACT_LAVA_DEATH - BOBOMB_ACT_DEATH_PLANE_DEATH + +### [enum CoinTypes](#CoinTypes) +| Identifier | Value | +| :--------- | :---- | +| COIN_TYPE_NONE | 0 | +| COIN_TYPE_YELLOW | 1 | +| COIN_TYPE_BLUE | 2 | - HIDDEN_BLUE_COIN_ACT_INACTIVE - HIDDEN_BLUE_COIN_ACT_WAITING - HIDDEN_BLUE_COIN_ACT_ACTIVE diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index af00fbdfc..57ba31a92 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -3024,14 +3024,14 @@ Sets the current object's hurtbox radius and height Spawns loot coins from an object using the specified behavior, jitter, and model ### Lua Example -`obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model)` +`obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| sp30 | `number` | +| baseYVel | `number` | | coinBehavior | `Pointer` <`BehaviorScript`> | | posJitter | `integer` | | model | `integer` | @@ -3040,7 +3040,7 @@ Spawns loot coins from an object using the specified behavior, jitter, and model - None ### C Prototype -`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);` +`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);` [:arrow_up_small:](#) @@ -3052,21 +3052,21 @@ Spawns loot coins from an object using the specified behavior, jitter, and model Spawns blue loot coins from an object ### Lua Example -`obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter)` +`obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| sp28 | `number` | +| baseYVel | `number` | | posJitter | `integer` | ### Returns - None ### C Prototype -`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter);` +`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter);` [:arrow_up_small:](#) @@ -3078,20 +3078,20 @@ Spawns blue loot coins from an object Spawns yellow loot coins from an object ### Lua Example -`obj_spawn_loot_yellow_coins(obj, numCoins, sp28)` +`obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| sp28 | `number` | +| baseYVel | `number` | ### Returns - None ### C Prototype -`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28);` +`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel);` [:arrow_up_small:](#) @@ -4459,19 +4459,19 @@ Gives the current object a hitbox and kills it if attacked, with optional loot s Explodes the current object, spawns particles, and optionally spawns coins ### Lua Example -`obj_explode_and_spawn_coins(sp18, sp1C)` +`obj_explode_and_spawn_coins(mistSize, coinType)` ### Parameters | Field | Type | | ----- | ---- | -| sp18 | `number` | -| sp1C | `integer` | +| mistSize | `number` | +| coinType | `integer` | ### Returns - None ### C Prototype -`void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C);` +`void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType);` [:arrow_up_small:](#) diff --git a/docs/lua/functions-7.md b/docs/lua/functions-7.md index 9e5b81a7a..27f24ec99 100644 --- a/docs/lua/functions-7.md +++ b/docs/lua/functions-7.md @@ -4104,7 +4104,7 @@ You can change the fields of the object in `objSetupFunction` - [Object](structs.md#Object) ### C Prototype -`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);` +`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction);` [:arrow_up_small:](#) @@ -4133,7 +4133,7 @@ You can change the fields of the object in `objSetupFunction` - [Object](structs.md#Object) ### C Prototype -`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);` +`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction);` [:arrow_up_small:](#) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index b0b13daee..4f137f25e 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -2189,7 +2189,7 @@ | oCloudFwooshMovementRadius | `integer` | | | oCoinUnkF4 | `integer` | | | oCoinUnkF8 | `integer` | | -| oCoinUnk110 | `number` | | +| oCoinBaseYVel | `number` | | | oCoinUnk1B0 | `integer` | | | oCollisionParticleUnkF4 | `number` | | | oControllablePlatformUnkF8 | `integer` | | diff --git a/include/object_constants.h b/include/object_constants.h index 720955e83..5be96cc59 100644 --- a/include/object_constants.h +++ b/include/object_constants.h @@ -146,6 +146,13 @@ #define BOBOMB_ACT_LAVA_DEATH 100 #define BOBOMB_ACT_DEATH_PLANE_DEATH 101 +/* Coin Type */ +enum CoinTypes { // coinType + COIN_TYPE_NONE, + COIN_TYPE_YELLOW, + COIN_TYPE_BLUE +}; + /* Hidden Blue Coin */ /* oAction */ #define HIDDEN_BLUE_COIN_ACT_INACTIVE 0 diff --git a/include/object_fields.h b/include/object_fields.h index fedbe1e91..57332fcc3 100644 --- a/include/object_fields.h +++ b/include/object_fields.h @@ -398,11 +398,11 @@ #define /*0x1AC*/ oCloudFwooshMovementRadius OBJECT_FIELD_S16(0x49, 0) /* Coin */ -#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C) -#define /*0x110*/ oCoinUnk110 OBJECT_FIELD_F32(0x22) +#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C) +#define /*0x110*/ oCoinBaseYVel OBJECT_FIELD_F32(0x22) #ifndef VERSION_JP -#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A) +#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A) #endif /* Collision Particle */ diff --git a/src/game/behavior_actions.c b/src/game/behavior_actions.c index 1c8303a52..0cda451b0 100644 --- a/src/game/behavior_actions.c +++ b/src/game/behavior_actions.c @@ -113,21 +113,21 @@ s16 D_8032F0CC[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046, #include "behaviors/white_puff_explode.inc.c" // not in behavior file -struct SpawnParticlesInfo D_8032F270 = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f }; +struct SpawnParticlesInfo sMistParticles = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f }; // generate_wind_puffs/dust (something like that) void spawn_mist_particles_variable(s32 count, s32 offsetY, f32 size) { - D_8032F270.sizeBase = size; - D_8032F270.sizeRange = size / 20.0; - D_8032F270.offsetY = offsetY; + sMistParticles.sizeBase = size; + sMistParticles.sizeRange = size / 20.0; + sMistParticles.offsetY = offsetY; if (count == 0) { - D_8032F270.count = 20; + sMistParticles.count = 20; } else if (count > 20) { - D_8032F270.count = count; + sMistParticles.count = count; } else { - D_8032F270.count = 4; + sMistParticles.count = 4; } - cur_obj_spawn_particles(&D_8032F270); + cur_obj_spawn_particles(&sMistParticles); } #include "behaviors/sparkle_spawn_star.inc.c" diff --git a/src/game/behaviors/coin.inc.c b/src/game/behaviors/coin.inc.c index cd78b7d19..616111abf 100644 --- a/src/game/behaviors/coin.inc.c +++ b/src/game/behaviors/coin.inc.c @@ -50,7 +50,7 @@ void bhv_temp_coin_loop(void) { void bhv_coin_init(void) { rng_position_init(o->oPosX, o->oPosY, o->oPosZ); - o->oVelY = random_float() * 10.0f + 30 + o->oCoinUnk110; + o->oVelY = random_float() * 10.0f + 30 + o->oCoinBaseYVel; o->oForwardVel = random_float() * 10.0f; o->oMoveAngleYaw = random_u16(); rng_position_finish(); diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 43a556ef7..e2d663122 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -2104,7 +2104,7 @@ void cur_obj_set_hurtbox_radius_and_height(f32 radius, f32 height) { } /* |description|Spawns loot coins from an object using the specified behavior, jitter, and model|descriptionEnd| */ -void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model) { +void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model) { if (obj == NULL) { return; } s32 i; f32 spawnHeight; @@ -2127,18 +2127,18 @@ void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const Beha if (coin == NULL) { return; } obj_translate_xz_random(coin, posJitter); coin->oPosY = spawnHeight; - coin->oCoinUnk110 = sp30; + coin->oCoinBaseYVel = baseYVel; } } /* |description|Spawns blue loot coins from an object|descriptionEnd| */ -void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter) { - obj_spawn_loot_coins(obj, numCoins, sp28, bhvBlueCoinJumping, posJitter, MODEL_BLUE_COIN); +void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter) { + obj_spawn_loot_coins(obj, numCoins, baseYVel, bhvBlueCoinJumping, posJitter, MODEL_BLUE_COIN); } /* |description|Spawns yellow loot coins from an object|descriptionEnd| */ -void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28) { - obj_spawn_loot_coins(obj, numCoins, sp28, bhvSingleCoinGetsSpawned, 0, MODEL_YELLOW_COIN); +void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel) { + obj_spawn_loot_coins(obj, numCoins, baseYVel, bhvSingleCoinGetsSpawned, 0, MODEL_YELLOW_COIN); } /* |description|Spawns a yellow coin at Mario's position and decrements the current object's loot count|descriptionEnd| */ @@ -3169,15 +3169,15 @@ s32 cur_obj_set_hitbox_and_die_if_attacked(struct ObjectHitbox *hitbox, s32 deat } /* |description|Explodes the current object, spawns particles, and optionally spawns coins|descriptionEnd| */ -void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C) { +void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType) { if (!o) { return; } - spawn_mist_particles_variable(0, 0, sp18); + spawn_mist_particles_variable(0, 0, mistSize); spawn_triangle_break_particles(30, 138, 3.0f, 4); obj_mark_for_deletion(o); - if (sp1C == 1) { + if (coinType == COIN_TYPE_YELLOW) { obj_spawn_loot_yellow_coins(o, o->oNumLootCoins, 20.0f); - } else if (sp1C == 2) { + } else if (coinType == COIN_TYPE_BLUE) { obj_spawn_loot_blue_coins(o, o->oNumLootCoins, 20.0f, 150); } } diff --git a/src/game/object_helpers.h b/src/game/object_helpers.h index 18d085648..f96c1277a 100644 --- a/src/game/object_helpers.h +++ b/src/game/object_helpers.h @@ -8,8 +8,7 @@ #include "pc/lua/utils/smlua_model_utils.h" // used for chain chomp and wiggler -struct ChainSegment -{ +struct ChainSegment { f32 posX; f32 posY; f32 posZ; @@ -26,8 +25,7 @@ struct ChainSegment #define WATER_DROPLET_FLAG_RAND_ANGLE_INCR 0x80 // Unused // Call spawn_water_droplet with this struct to spawn an object. -struct WaterDropletParams -{ +struct WaterDropletParams { s16 flags; // Droplet spawn flags, see defines above s16 model; const BehaviorScript *behavior; @@ -41,9 +39,7 @@ struct WaterDropletParams f32 randSizeScale; }; -// TODO: Field names -struct SpawnParticlesInfo -{ +struct SpawnParticlesInfo { /*0x00*/ s8 behParam; /*0x01*/ s8 count; /*0x02*/ u16 model; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index bd86da1cc..306a591aa 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -1802,7 +1802,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oCloudCenterY", LVT_F32, offsetof(struct Object, oCloudCenterY), false, LOT_NONE }, { "oCloudFwooshMovementRadius", LVT_S16, offsetof(struct Object, oCloudFwooshMovementRadius), false, LOT_NONE }, { "oCloudGrowSpeed", LVT_F32, offsetof(struct Object, oCloudGrowSpeed), false, LOT_NONE }, - { "oCoinUnk110", LVT_F32, offsetof(struct Object, oCoinUnk110), false, LOT_NONE }, + { "oCoinBaseYVel", LVT_F32, offsetof(struct Object, oCoinBaseYVel), false, LOT_NONE }, #ifndef VERSION_JP { "oCoinUnk1B0", LVT_S32, offsetof(struct Object, oCoinUnk1B0), false, LOT_NONE }, #endif diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 98fa34964..e1ebcf038 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -2505,6 +2505,9 @@ const char gSmluaConstants[] = "" "BOBOMB_ACT_EXPLODE=3\n" "BOBOMB_ACT_LAVA_DEATH=100\n" "BOBOMB_ACT_DEATH_PLANE_DEATH=101\n" +"COIN_TYPE_NONE=0\n" +"COIN_TYPE_YELLOW=1\n" +"COIN_TYPE_BLUE=2\n" "HIDDEN_BLUE_COIN_ACT_INACTIVE=0\n" "HIDDEN_BLUE_COIN_ACT_WAITING=1\n" "HIDDEN_BLUE_COIN_ACT_ACTIVE=2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 1403695fb..4e6c39f62 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -28010,7 +28010,7 @@ int smlua_func_obj_spawn_loot_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_coins"); return 0; } - f32 sp30 = smlua_to_number(L, 3); + f32 baseYVel = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_coins"); return 0; } BehaviorScript * coinBehavior = (BehaviorScript *)smlua_to_cpointer(L, 4, LVT_BEHAVIORSCRIPT_P); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_coins"); return 0; } @@ -28019,8 +28019,8 @@ int smlua_func_obj_spawn_loot_coins(lua_State* L) { s16 model = smlua_to_integer(L, 6); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_spawn_loot_coins"); return 0; } - extern void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model); - obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model); + extern void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model); + obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model); return 1; } @@ -28038,13 +28038,13 @@ int smlua_func_obj_spawn_loot_blue_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_blue_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_blue_coins"); return 0; } - f32 sp28 = smlua_to_number(L, 3); + f32 baseYVel = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_blue_coins"); return 0; } s16 posJitter = smlua_to_integer(L, 4); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_blue_coins"); return 0; } - extern void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter); - obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter); + extern void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter); + obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter); return 1; } @@ -28062,11 +28062,11 @@ int smlua_func_obj_spawn_loot_yellow_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_yellow_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_yellow_coins"); return 0; } - f32 sp28 = smlua_to_number(L, 3); + f32 baseYVel = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_yellow_coins"); return 0; } - extern void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28); - obj_spawn_loot_yellow_coins(obj, numCoins, sp28); + extern void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel); + obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel); return 1; } @@ -29162,13 +29162,13 @@ int smlua_func_obj_explode_and_spawn_coins(lua_State* L) { return 0; } - f32 sp18 = smlua_to_number(L, 1); + f32 mistSize = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_explode_and_spawn_coins"); return 0; } - s32 sp1C = smlua_to_integer(L, 2); + s32 coinType = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_explode_and_spawn_coins"); return 0; } - extern void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C); - obj_explode_and_spawn_coins(sp18, sp1C); + extern void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType); + obj_explode_and_spawn_coins(mistSize, coinType); return 1; } @@ -35019,8 +35019,8 @@ int smlua_func_spawn_sync_object(lua_State* L) { if (L == NULL) { return 0; } int top = lua_gettop(L); - if (top != 6) { - LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_sync_object", 6, top); + if (top < 5 || top > 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected between %u and %u, Received %u", "spawn_sync_object", 5, 6, top); return 0; } @@ -35034,8 +35034,11 @@ int smlua_func_spawn_sync_object(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_sync_object"); return 0; } f32 z = smlua_to_number(L, 5); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_sync_object"); return 0; } - LuaFunction objSetupFunction = smlua_to_lua_function(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_sync_object"); return 0; } + LuaFunction objSetupFunction = (LuaFunction) 0; + if (top >= 6) { + objSetupFunction = smlua_to_lua_function(L, 6); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_sync_object"); return 0; } + } smlua_push_object(L, LOT_OBJECT, spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction), NULL); @@ -35046,8 +35049,8 @@ int smlua_func_spawn_non_sync_object(lua_State* L) { if (L == NULL) { return 0; } int top = lua_gettop(L); - if (top != 6) { - LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_non_sync_object", 6, top); + if (top < 5 || top > 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected between %u and %u, Received %u", "spawn_non_sync_object", 5, 6, top); return 0; } @@ -35061,8 +35064,11 @@ int smlua_func_spawn_non_sync_object(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_non_sync_object"); return 0; } f32 z = smlua_to_number(L, 5); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_non_sync_object"); return 0; } - LuaFunction objSetupFunction = smlua_to_lua_function(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_non_sync_object"); return 0; } + LuaFunction objSetupFunction = (LuaFunction) 0; + if (top >= 6) { + objSetupFunction = smlua_to_lua_function(L, 6); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_non_sync_object"); return 0; } + } smlua_push_object(L, LOT_OBJECT, spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction), NULL); diff --git a/src/pc/lua/utils/smlua_obj_utils.c b/src/pc/lua/utils/smlua_obj_utils.c index aa71c422d..33f4353d9 100644 --- a/src/pc/lua/utils/smlua_obj_utils.c +++ b/src/pc/lua/utils/smlua_obj_utils.c @@ -76,11 +76,11 @@ static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum Mod return obj; } -struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction) { +struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction) { return spawn_object_internal(behaviorId, modelId, x, y, z, objSetupFunction, true); } -struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction) { +struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction) { return spawn_object_internal(behaviorId, modelId, x, y, z, objSetupFunction, false); } diff --git a/src/pc/lua/utils/smlua_obj_utils.h b/src/pc/lua/utils/smlua_obj_utils.h index 0bf45cdd5..1d5d61c7d 100644 --- a/src/pc/lua/utils/smlua_obj_utils.h +++ b/src/pc/lua/utils/smlua_obj_utils.h @@ -9,12 +9,12 @@ Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` |descriptionEnd| */ -struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction); +struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction); /* |description| Spawns a non-synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` |descriptionEnd| */ -struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction); +struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction); /* |description|Checks if an object has `behaviorId`|descriptionEnd| */ s32 obj_has_behavior_id(struct Object *o, enum BehaviorId behaviorId); From edb8d68f0212f72f8fafbfded843653f61a8f383 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:19:09 -0500 Subject: [PATCH 13/16] sep-painting --- levels/castle_inside/painting.inc.c | 434 ++++++++++++++++++++++++++-- levels/hmc/areas/1/painting.inc.c | 31 +- levels/ttm/areas/1/painting.inc.c | 31 +- src/game/hardcoded.c | 39 +-- src/game/paintings.h | 5 - 5 files changed, 484 insertions(+), 56 deletions(-) diff --git a/levels/castle_inside/painting.inc.c b/levels/castle_inside/painting.inc.c index 8c5def9e5..a41a3c5a2 100644 --- a/levels/castle_inside/painting.inc.c +++ b/levels/castle_inside/painting.inc.c @@ -1308,7 +1308,7 @@ static const Gfx inside_castle_seg7_painting_dl_070235B8[] = { } // 0x07023620 - 0x07023698 -DEF_PAINTING(bob_painting, { +struct Painting bob_painting = { /* id */ 0x0000, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1333,10 +1333,10 @@ DEF_PAINTING(bob_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023698 - 0x07023710 -DEF_PAINTING(ccm_painting, { +struct Painting ccm_painting = { /* id */ 0x0001, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1361,10 +1361,10 @@ DEF_PAINTING(ccm_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023710 - 0x07023788 -DEF_PAINTING(wf_painting, { +struct Painting wf_painting = { /* id */ 0x0002, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1389,10 +1389,10 @@ DEF_PAINTING(wf_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023788 - 0x07023800 -DEF_PAINTING(jrb_painting, { +struct Painting jrb_painting = { /* id */ 0x0003, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1417,10 +1417,10 @@ DEF_PAINTING(jrb_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023800 - 0x07023878 -DEF_PAINTING(lll_painting, { +struct Painting lll_painting = { /* id */ 0x0004, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1445,10 +1445,10 @@ DEF_PAINTING(lll_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023878 - 0x070238F0 -DEF_PAINTING(ssl_painting, { +struct Painting ssl_painting = { /* id */ 0x0005, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1473,10 +1473,10 @@ DEF_PAINTING(ssl_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}); +}; // 0x070238F0 - 0x07023968 -DEF_PAINTING(hmc_painting, { +struct Painting hmc_painting = { /* id */ 0x000E, /* Image Count */ 0x01, /* Texture Type */ PAINTING_ENV_MAP, @@ -1501,10 +1501,10 @@ DEF_PAINTING(hmc_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 768.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023968 - 0x070239E0 -DEF_PAINTING(ddd_painting, { +struct Painting ddd_painting = { /* id */ 0x0007, /* Image Count */ 0x01, /* Texture Type */ PAINTING_ENV_MAP, @@ -1529,10 +1529,10 @@ DEF_PAINTING(ddd_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 819.2f, /* Ripples */ { 0 }, -}); +}; // 0x070239E0 - 0x07023A58 -DEF_PAINTING(wdw_painting, { +struct Painting wdw_painting = { /* id */ 0x0008, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1557,10 +1557,10 @@ DEF_PAINTING(wdw_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 614.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023A58 - 0x07023AD0 -DEF_PAINTING(thi_tiny_painting, { +struct Painting thi_tiny_painting = { /* id */ 0x0009, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1585,10 +1585,10 @@ DEF_PAINTING(thi_tiny_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 393.216f, /* Ripples */ { 0 }, -}); +}; // 0x07023AD0 - 0x07023B48 -DEF_PAINTING(ttm_painting, { +struct Painting ttm_painting = { /* id */ 0x000A, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1613,10 +1613,10 @@ DEF_PAINTING(ttm_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 256.0f, /* Ripples */ { 0 }, -}); +}; // 0x07023B48 - 0x07023BC0 -DEF_PAINTING(ttc_painting, { +struct Painting ttc_painting = { /* id */ 0x000B, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1641,10 +1641,10 @@ DEF_PAINTING(ttc_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 409.6f, /* Ripples */ { 0 }, -}); +}; // 0x07023BC0 - 0x07023C38 -DEF_PAINTING(sl_painting, { +struct Painting sl_painting = { /* id */ 0x000C, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1669,10 +1669,10 @@ DEF_PAINTING(sl_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 716.8f, /* Ripples */ { 0 }, -}); +}; // 0x07023C38 - 0x07023CB0 -DEF_PAINTING(thi_huge_painting, { +struct Painting thi_huge_painting = { /* id */ 0x000D, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -1697,4 +1697,382 @@ DEF_PAINTING(thi_huge_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 1638.4f, /* Ripples */ { 0 }, -}); +}; + +struct Painting default_bob_painting = { + /* id */ 0x0000, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 90.0f, + /* Position */ -5222.4f, 409.6f, -153.6f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023050, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_070235C0, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 614.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_ccm_painting = { + /* id */ 0x0001, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 0.0f, + /* Position */ -2611.2f, -307.2f, -4352.0f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_070230B0, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_070235C8, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 614.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_wf_painting = { + /* id */ 0x0002, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 0.0f, + /* Position */ -51.2f, -204.8f, -4505.6f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023110, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_070235D0, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 614.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_jrb_painting = { + /* id */ 0x0003, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 270.0f, + /* Position */ 4300.8f, 409.6f, -537.6f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023170, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_070235D8, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 614.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_lll_painting = { + /* id */ 0x0004, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 0.0f, + /* Position */ -1689.6f, -1126.4f, -3942.4f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_070231D0, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_070235E0, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 614.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_ssl_painting = { + /* id */ 0x0005, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 180.0f, + /* Position */ -2611.2f, -1177.6f, -1075.2f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023230, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_070235E8, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 614.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_hmc_painting = { + /* id */ 0x000E, + /* Image Count */ 0x01, + /* Texture Type */ PAINTING_ENV_MAP, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 270.0f, 0.0f, + /* Position */ 2099.2f, -1484.8f, -2278.4f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 10.0f, 30.0f, + /* Ripple Decay */ 1.0f, 1.0f, 0.98f, + /* Ripple Rate */ 0.0f, 0.05f, 0.05f, + /* Ripple Dispersion */ 0.0f, 15.0f, 15.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023580, + /* Texture Maps */ inside_castle_seg7_painting_env_map_texture_maps_07023044, + /* Textures */ inside_castle_seg7_painting_textures_070235F0, + /* Texture w, h */ 32, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07022640, + /* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 768.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_ddd_painting = { + /* id */ 0x0007, + /* Image Count */ 0x01, + /* Texture Type */ PAINTING_ENV_MAP, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 270.0f, + /* Position */ 3456.0f, -1075.2f, 1587.2f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 10.0f, 30.0f, + /* Ripple Decay */ 1.0f, 1.0f, 0.98f, + /* Ripple Rate */ 0.0f, 0.05f, 0.05f, + /* Ripple Dispersion */ 0.0f, 15.0f, 15.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_070235B8, + /* Texture Maps */ inside_castle_seg7_painting_env_map_texture_maps_07023044, + /* Textures */ inside_castle_seg7_painting_textures_070235F4, + /* Texture w, h */ 32, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07022640, + /* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS, + /* Alpha */ 0xB4, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 819.2f, + /* Ripples */ { 0 }, +}; + +struct Painting default_wdw_painting = { + /* id */ 0x0008, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 0.0f, + /* Position */ -966.656f, 1305.6f, -143.36f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023290, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_070235F8, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 614.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_thi_tiny_painting = { + /* id */ 0x0009, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 180.0f, + /* Position */ -4598.7842f, 1354.752f, 3005.44f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_070232F0, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_07023600, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 393.216f, + /* Ripples */ { 0 }, +}; + +struct Painting default_ttm_painting = { + /* id */ 0x000A, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 180.0f, + /* Position */ -546.816f, 1356.8f, 3813.376f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023350, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_07023608, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 256.0f, + /* Ripples */ { 0 }, +}; + +struct Painting default_ttc_painting = { + /* id */ 0x000B, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 180.0f, + /* Position */ 0.0f, 2713.6f, 7232.5122f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_070233B0, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_07023610, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 409.6f, + /* Ripples */ { 0 }, +}; + +struct Painting default_sl_painting = { + /* id */ 0x000C, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 0.0f, + /* Position */ 3179.52f, 1408.0f, -271.36f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_07023410, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_07023618, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 716.8f, + /* Ripples */ { 0 }, +}; + +struct Painting default_thi_huge_painting = { + /* id */ 0x000D, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 0.0f, + /* Position */ -5614.5918f, 1510.4f, -3292.16f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 40.0f, 160.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.12f, 0.07f, + /* Ripple Dispersion */ 0.0f, 80.0f, 60.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ inside_castle_seg7_painting_dl_070232F0, + /* Texture Maps */ inside_castle_seg7_painting_texture_maps_07022518, + /* Textures */ inside_castle_seg7_painting_textures_07023600, + /* Texture w, h */ 64, 32, + /* Ripple DList */ inside_castle_seg7_painting_dl_07021AC0, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 1638.4f, + /* Ripples */ { 0 }, +}; diff --git a/levels/hmc/areas/1/painting.inc.c b/levels/hmc/areas/1/painting.inc.c index 32333cae7..e1b1ce697 100644 --- a/levels/hmc/areas/1/painting.inc.c +++ b/levels/hmc/areas/1/painting.inc.c @@ -510,7 +510,7 @@ static const Gfx hmc_seg7_painting_dl_070254E0[] = { } // 0x0702551C (PaintingData) -DEF_PAINTING(cotmc_painting, { +struct Painting cotmc_painting = { /* id */ 0x000E, /* Image Count */ 0x01, /* Texture Type */ PAINTING_ENV_MAP, @@ -535,4 +535,31 @@ DEF_PAINTING(cotmc_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 723.968018f, /* Ripples */ { 0 }, -}); +}; + +struct Painting default_cotmc_painting = { + /* id */ 0x000E, + /* Image Count */ 0x01, + /* Texture Type */ PAINTING_ENV_MAP, + /* Floor Status */ 0x00, 0x00 , 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 270.0f, 0.0f, + /* Position */ 2989.055908f, -4485.120117f, 5135.359863f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 10.0f, 30.0f, + /* Ripple Decay */ 1.0f, 1.0f, 0.98f, + /* Ripple Rate */ 0.0f, 0.05f, 0.05f, + /* Ripple Dispersion */ 0.0f, 15.0f, 15.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ hmc_seg7_painting_dl_070254E0, + /* Texture Maps */ hmc_seg7_painting_texture_maps_07024CD4, + /* Textures */ hmc_seg7_painting_textures_07025518, + /* Texture w, h */ 32, 32, + /* Ripple DList */ hmc_seg7_painting_dl_070242D0, + /* Ripple Trigger */ RIPPLE_TRIGGER_CONTINUOUS, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 723.968018f, + /* Ripples */ { 0 }, +}; diff --git a/levels/ttm/areas/1/painting.inc.c b/levels/ttm/areas/1/painting.inc.c index b51f85366..2ae5d05db 100644 --- a/levels/ttm/areas/1/painting.inc.c +++ b/levels/ttm/areas/1/painting.inc.c @@ -542,7 +542,7 @@ static const Gfx ttm_seg7_painting_dl_07012E98[] = { } // 0x07012F00 (PaintingData) -DEF_PAINTING(ttm_slide_painting, { +struct Painting ttm_slide_painting = { /* id */ 0x0000, /* Image Count */ 0x02, /* Texture Type */ PAINTING_IMAGE, @@ -567,4 +567,31 @@ DEF_PAINTING(ttm_slide_painting, { /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ /* Size */ 460.8f, /* Ripples */ { 0 }, -}); +}; + +struct Painting default_ttm_slide_painting = { + /* id */ 0x0000, + /* Image Count */ 0x02, + /* Texture Type */ PAINTING_IMAGE, + /* Floor Status */ 0x00, 0x00, 0x00 /* which of the painting's nearby special floors Mario's on */, + /* Ripple Status */ 0x00, + /* Rotation */ 0.0f, 90.0f, + /* Position */ 3072.0f, 921.6f, -819.2f, + /* curr passive entry */ + /* Ripple Magnitude */ 0.0f, 20.0f, 80.0f, + /* Ripple Decay */ 1.0f, 0.9608f, 0.9524f, + /* Ripple Rate */ 0.0f, 0.24f, 0.14f, + /* Ripple Dispersion */ 0.0f, 40.0f, 30.0f, + /* Curr Ripple Timer */ 0.0f, + /* Curr Ripple x, y */ 0.0f, 0.0f, + /* Normal DList */ ttm_seg7_painting_dl_07012E98, + /* Texture Maps */ ttm_seg7_painting_texture_maps_07012E88, + /* Textures */ ttm_seg7_painting_textures_07012EF8, + /* Texture w, h */ 64, 32, + /* Ripple DList */ ttm_seg7_painting_dl_07012430, + /* Ripple Trigger */ RIPPLE_TRIGGER_PROXIMITY, + /* Alpha */ 0xFF, + /* Mario Below */ 0x00, 0x00, 0x00, /* Whether or not Mario is below the painting */ + /* Size */ 460.8f, + /* Ripples */ { 0 }, +}; diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 01732506d..f3bd96806 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -353,25 +353,26 @@ AT_STARTUP void hardcoded_reset_default_values(void) { gLevelValues = gDefaultLevelValues; gBehaviorValues = gDefaultBehaviorValues; - RESTORE_PAINTING(cotmc_painting); - RESTORE_PAINTING(bob_painting); - RESTORE_PAINTING(ccm_painting); - RESTORE_PAINTING(wf_painting); - RESTORE_PAINTING(jrb_painting); - RESTORE_PAINTING(lll_painting); - RESTORE_PAINTING(ssl_painting); - RESTORE_PAINTING(hmc_painting); - RESTORE_PAINTING(ddd_painting); - RESTORE_PAINTING(wdw_painting); - RESTORE_PAINTING(thi_tiny_painting); - RESTORE_PAINTING(ttm_painting); - RESTORE_PAINTING(ttc_painting); - RESTORE_PAINTING(sl_painting); - RESTORE_PAINTING(thi_huge_painting); - RESTORE_PAINTING(ttm_slide_painting); - gPaintingValues = gDefaultPaintingValues; + memcpy(&cotmc_painting, &default_cotmc_painting, sizeof(struct Painting)); + memcpy(&bob_painting, &default_bob_painting, sizeof(struct Painting)); + memcpy(&ccm_painting, &default_ccm_painting, sizeof(struct Painting)); + memcpy(&wf_painting, &default_wf_painting, sizeof(struct Painting)); + memcpy(&jrb_painting, &default_jrb_painting, sizeof(struct Painting)); + memcpy(&lll_painting, &default_lll_painting, sizeof(struct Painting)); + memcpy(&ssl_painting, &default_ssl_painting, sizeof(struct Painting)); + memcpy(&hmc_painting, &default_hmc_painting, sizeof(struct Painting)); + memcpy(&ddd_painting, &default_ddd_painting, sizeof(struct Painting)); + memcpy(&wdw_painting, &default_wdw_painting, sizeof(struct Painting)); + memcpy(&thi_tiny_painting, &default_thi_tiny_painting, sizeof(struct Painting)); + memcpy(&ttm_painting, &default_ttm_painting, sizeof(struct Painting)); + memcpy(&ttc_painting, &default_ttc_painting, sizeof(struct Painting)); + memcpy(&sl_painting, &default_sl_painting, sizeof(struct Painting)); + memcpy(&thi_huge_painting, &default_thi_huge_painting, sizeof(struct Painting)); + memcpy(&ttm_slide_painting, &default_ttm_slide_painting, sizeof(struct Painting)); + memcpy(sDummyContents, sDefaultExclamationBoxContents, sizeof(struct ExclamationBoxContent) * 15); - memcpy(sDummyContents, sDefaultExclamationBoxContents, sizeof(sDefaultExclamationBoxContents)); gExclamationBoxContents = sDummyContents; - gExclamationBoxSize = sizeof(sDefaultExclamationBoxContents) / sizeof(sDefaultExclamationBoxContents[0]); + gExclamationBoxSize = 15; + + gPaintingValues = gDefaultPaintingValues; } diff --git a/src/game/paintings.h b/src/game/paintings.h index 08529ed15..98fe85fd8 100644 --- a/src/game/paintings.h +++ b/src/game/paintings.h @@ -48,11 +48,6 @@ typedef struct { signed char n[3]; /* normal */ } Vtx_Interp; -#define DEF_PAINTING(name, ...) \ -struct Painting name = __VA_ARGS__; \ -const struct Painting default_ ## name = __VA_ARGS__ - -#define RESTORE_PAINTING(name) name = default_ ## name struct Painting { s16 id; From 9f748cbe76f2c4ea9e873751e4f244e013b602f9 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Wed, 17 Jun 2026 21:54:04 -0500 Subject: [PATCH 14/16] sep-coin --- autogen/lua_definitions/constants.lua | 9 --------- autogen/lua_definitions/functions.lua | 18 +++++++++--------- autogen/lua_definitions/structs.lua | 2 +- data/dynos_bin_behavior.cpp | 2 +- docs/lua/constants.md | 8 -------- docs/lua/functions-6.md | 26 +++++++++++++------------- docs/lua/structs.md | 2 +- include/object_constants.h | 7 ------- include/object_fields.h | 8 ++++---- src/game/behaviors/coin.inc.c | 2 +- src/game/object_helpers.c | 20 ++++++++++---------- src/pc/lua/smlua_cobject_autogen.c | 2 +- src/pc/lua/smlua_constants_autogen.c | 3 --- src/pc/lua/smlua_functions_autogen.c | 26 +++++++++++++------------- 14 files changed, 54 insertions(+), 81 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 09db5b128..8386309ee 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -5204,15 +5204,6 @@ BOBOMB_ACT_LAVA_DEATH = 100 --- @type integer BOBOMB_ACT_DEATH_PLANE_DEATH = 101 -COIN_TYPE_NONE = 0 --- @type CoinTypes -COIN_TYPE_YELLOW = 1 --- @type CoinTypes -COIN_TYPE_BLUE = 2 --- @type CoinTypes - ---- @alias CoinTypes ---- | `COIN_TYPE_NONE` ---- | `COIN_TYPE_YELLOW` ---- | `COIN_TYPE_BLUE` - --- @type integer HIDDEN_BLUE_COIN_ACT_INACTIVE = 0 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index d3324747c..d4dda9bc8 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -9841,29 +9841,29 @@ end --- @param obj Object --- @param numCoins integer ---- @param baseYVel number +--- @param sp30 number --- @param coinBehavior Pointer_BehaviorScript --- @param posJitter integer --- @param model integer --- Spawns loot coins from an object using the specified behavior, jitter, and model -function obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model) +function obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model) -- ... end --- @param obj Object --- @param numCoins integer ---- @param baseYVel number +--- @param sp28 number --- @param posJitter integer --- Spawns blue loot coins from an object -function obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter) +function obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter) -- ... end --- @param obj Object --- @param numCoins integer ---- @param baseYVel number +--- @param sp28 number --- Spawns yellow loot coins from an object -function obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel) +function obj_spawn_loot_yellow_coins(obj, numCoins, sp28) -- ... end @@ -10251,10 +10251,10 @@ function cur_obj_set_hitbox_and_die_if_attacked(hitbox, deathSound, noLootCoins) -- ... end ---- @param mistSize number ---- @param coinType integer +--- @param sp18 number +--- @param sp1C integer --- Explodes the current object, spawns particles, and optionally spawns coins -function obj_explode_and_spawn_coins(mistSize, coinType) +function obj_explode_and_spawn_coins(sp18, sp1C) -- ... end diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 48319b0e8..187590de6 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -1580,7 +1580,7 @@ --- @field public oCloudFwooshMovementRadius integer --- @field public oCoinUnkF4 integer --- @field public oCoinUnkF8 integer ---- @field public oCoinBaseYVel number +--- @field public oCoinUnk110 number --- @field public oCoinUnk1B0 integer --- @field public oCollisionParticleUnkF4 number --- @field public oControllablePlatformUnkF8 integer diff --git a/data/dynos_bin_behavior.cpp b/data/dynos_bin_behavior.cpp index d5452ad85..f6673b413 100644 --- a/data/dynos_bin_behavior.cpp +++ b/data/dynos_bin_behavior.cpp @@ -1132,7 +1132,7 @@ s64 DynOS_Bhv_ParseBehaviorScriptConstants(const String &_Arg, bool *found) { /* Coin */ bhv_constant(oCoinUnkF4); bhv_constant(oCoinUnkF8); - bhv_constant(oCoinBaseYVel); + bhv_constant(oCoinUnk110); #ifndef VERSION_JP bhv_constant(oCoinUnk1B0); #endif diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 9b6cf38f2..7fd2706fa 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -79,7 +79,6 @@ - [obj_behaviors.c](#obj_behaviorsc) - [obj_behaviors_2.h](#obj_behaviors_2h) - [object_constants.h](#object_constantsh) - - [enum CoinTypes](#enum-CoinTypes) - [object_list_processor.h](#object_list_processorh) - [enum ObjectList](#enum-ObjectList) - [os_cont.h](#os_conth) @@ -2491,13 +2490,6 @@ - BOBOMB_ACT_EXPLODE - BOBOMB_ACT_LAVA_DEATH - BOBOMB_ACT_DEATH_PLANE_DEATH - -### [enum CoinTypes](#CoinTypes) -| Identifier | Value | -| :--------- | :---- | -| COIN_TYPE_NONE | 0 | -| COIN_TYPE_YELLOW | 1 | -| COIN_TYPE_BLUE | 2 | - HIDDEN_BLUE_COIN_ACT_INACTIVE - HIDDEN_BLUE_COIN_ACT_WAITING - HIDDEN_BLUE_COIN_ACT_ACTIVE diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md index 57ba31a92..af00fbdfc 100644 --- a/docs/lua/functions-6.md +++ b/docs/lua/functions-6.md @@ -3024,14 +3024,14 @@ Sets the current object's hurtbox radius and height Spawns loot coins from an object using the specified behavior, jitter, and model ### Lua Example -`obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model)` +`obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| baseYVel | `number` | +| sp30 | `number` | | coinBehavior | `Pointer` <`BehaviorScript`> | | posJitter | `integer` | | model | `integer` | @@ -3040,7 +3040,7 @@ Spawns loot coins from an object using the specified behavior, jitter, and model - None ### C Prototype -`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);` +`void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model);` [:arrow_up_small:](#) @@ -3052,21 +3052,21 @@ Spawns loot coins from an object using the specified behavior, jitter, and model Spawns blue loot coins from an object ### Lua Example -`obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter)` +`obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| baseYVel | `number` | +| sp28 | `number` | | posJitter | `integer` | ### Returns - None ### C Prototype -`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter);` +`void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter);` [:arrow_up_small:](#) @@ -3078,20 +3078,20 @@ Spawns blue loot coins from an object Spawns yellow loot coins from an object ### Lua Example -`obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel)` +`obj_spawn_loot_yellow_coins(obj, numCoins, sp28)` ### Parameters | Field | Type | | ----- | ---- | | obj | [Object](structs.md#Object) | | numCoins | `integer` | -| baseYVel | `number` | +| sp28 | `number` | ### Returns - None ### C Prototype -`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel);` +`void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28);` [:arrow_up_small:](#) @@ -4459,19 +4459,19 @@ Gives the current object a hitbox and kills it if attacked, with optional loot s Explodes the current object, spawns particles, and optionally spawns coins ### Lua Example -`obj_explode_and_spawn_coins(mistSize, coinType)` +`obj_explode_and_spawn_coins(sp18, sp1C)` ### Parameters | Field | Type | | ----- | ---- | -| mistSize | `number` | -| coinType | `integer` | +| sp18 | `number` | +| sp1C | `integer` | ### Returns - None ### C Prototype -`void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType);` +`void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C);` [:arrow_up_small:](#) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 4f137f25e..b0b13daee 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -2189,7 +2189,7 @@ | oCloudFwooshMovementRadius | `integer` | | | oCoinUnkF4 | `integer` | | | oCoinUnkF8 | `integer` | | -| oCoinBaseYVel | `number` | | +| oCoinUnk110 | `number` | | | oCoinUnk1B0 | `integer` | | | oCollisionParticleUnkF4 | `number` | | | oControllablePlatformUnkF8 | `integer` | | diff --git a/include/object_constants.h b/include/object_constants.h index 5be96cc59..720955e83 100644 --- a/include/object_constants.h +++ b/include/object_constants.h @@ -146,13 +146,6 @@ #define BOBOMB_ACT_LAVA_DEATH 100 #define BOBOMB_ACT_DEATH_PLANE_DEATH 101 -/* Coin Type */ -enum CoinTypes { // coinType - COIN_TYPE_NONE, - COIN_TYPE_YELLOW, - COIN_TYPE_BLUE -}; - /* Hidden Blue Coin */ /* oAction */ #define HIDDEN_BLUE_COIN_ACT_INACTIVE 0 diff --git a/include/object_fields.h b/include/object_fields.h index 57332fcc3..fedbe1e91 100644 --- a/include/object_fields.h +++ b/include/object_fields.h @@ -398,11 +398,11 @@ #define /*0x1AC*/ oCloudFwooshMovementRadius OBJECT_FIELD_S16(0x49, 0) /* Coin */ -#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C) -#define /*0x110*/ oCoinBaseYVel OBJECT_FIELD_F32(0x22) +#define /*0x0F4*/ oCoinUnkF4 OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oCoinUnkF8 OBJECT_FIELD_S32(0x1C) +#define /*0x110*/ oCoinUnk110 OBJECT_FIELD_F32(0x22) #ifndef VERSION_JP -#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A) +#define /*0x1B0*/ oCoinUnk1B0 OBJECT_FIELD_S32(0x4A) #endif /* Collision Particle */ diff --git a/src/game/behaviors/coin.inc.c b/src/game/behaviors/coin.inc.c index 616111abf..cd78b7d19 100644 --- a/src/game/behaviors/coin.inc.c +++ b/src/game/behaviors/coin.inc.c @@ -50,7 +50,7 @@ void bhv_temp_coin_loop(void) { void bhv_coin_init(void) { rng_position_init(o->oPosX, o->oPosY, o->oPosZ); - o->oVelY = random_float() * 10.0f + 30 + o->oCoinBaseYVel; + o->oVelY = random_float() * 10.0f + 30 + o->oCoinUnk110; o->oForwardVel = random_float() * 10.0f; o->oMoveAngleYaw = random_u16(); rng_position_finish(); diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index e2d663122..43a556ef7 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -2104,7 +2104,7 @@ void cur_obj_set_hurtbox_radius_and_height(f32 radius, f32 height) { } /* |description|Spawns loot coins from an object using the specified behavior, jitter, and model|descriptionEnd| */ -void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model) { +void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model) { if (obj == NULL) { return; } s32 i; f32 spawnHeight; @@ -2127,18 +2127,18 @@ void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const if (coin == NULL) { return; } obj_translate_xz_random(coin, posJitter); coin->oPosY = spawnHeight; - coin->oCoinBaseYVel = baseYVel; + coin->oCoinUnk110 = sp30; } } /* |description|Spawns blue loot coins from an object|descriptionEnd| */ -void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter) { - obj_spawn_loot_coins(obj, numCoins, baseYVel, bhvBlueCoinJumping, posJitter, MODEL_BLUE_COIN); +void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter) { + obj_spawn_loot_coins(obj, numCoins, sp28, bhvBlueCoinJumping, posJitter, MODEL_BLUE_COIN); } /* |description|Spawns yellow loot coins from an object|descriptionEnd| */ -void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel) { - obj_spawn_loot_coins(obj, numCoins, baseYVel, bhvSingleCoinGetsSpawned, 0, MODEL_YELLOW_COIN); +void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28) { + obj_spawn_loot_coins(obj, numCoins, sp28, bhvSingleCoinGetsSpawned, 0, MODEL_YELLOW_COIN); } /* |description|Spawns a yellow coin at Mario's position and decrements the current object's loot count|descriptionEnd| */ @@ -3169,15 +3169,15 @@ s32 cur_obj_set_hitbox_and_die_if_attacked(struct ObjectHitbox *hitbox, s32 deat } /* |description|Explodes the current object, spawns particles, and optionally spawns coins|descriptionEnd| */ -void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType) { +void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C) { if (!o) { return; } - spawn_mist_particles_variable(0, 0, mistSize); + spawn_mist_particles_variable(0, 0, sp18); spawn_triangle_break_particles(30, 138, 3.0f, 4); obj_mark_for_deletion(o); - if (coinType == COIN_TYPE_YELLOW) { + if (sp1C == 1) { obj_spawn_loot_yellow_coins(o, o->oNumLootCoins, 20.0f); - } else if (coinType == COIN_TYPE_BLUE) { + } else if (sp1C == 2) { obj_spawn_loot_blue_coins(o, o->oNumLootCoins, 20.0f, 150); } } diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 306a591aa..bd86da1cc 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -1802,7 +1802,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "oCloudCenterY", LVT_F32, offsetof(struct Object, oCloudCenterY), false, LOT_NONE }, { "oCloudFwooshMovementRadius", LVT_S16, offsetof(struct Object, oCloudFwooshMovementRadius), false, LOT_NONE }, { "oCloudGrowSpeed", LVT_F32, offsetof(struct Object, oCloudGrowSpeed), false, LOT_NONE }, - { "oCoinBaseYVel", LVT_F32, offsetof(struct Object, oCoinBaseYVel), false, LOT_NONE }, + { "oCoinUnk110", LVT_F32, offsetof(struct Object, oCoinUnk110), false, LOT_NONE }, #ifndef VERSION_JP { "oCoinUnk1B0", LVT_S32, offsetof(struct Object, oCoinUnk1B0), false, LOT_NONE }, #endif diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index e1ebcf038..98fa34964 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -2505,9 +2505,6 @@ const char gSmluaConstants[] = "" "BOBOMB_ACT_EXPLODE=3\n" "BOBOMB_ACT_LAVA_DEATH=100\n" "BOBOMB_ACT_DEATH_PLANE_DEATH=101\n" -"COIN_TYPE_NONE=0\n" -"COIN_TYPE_YELLOW=1\n" -"COIN_TYPE_BLUE=2\n" "HIDDEN_BLUE_COIN_ACT_INACTIVE=0\n" "HIDDEN_BLUE_COIN_ACT_WAITING=1\n" "HIDDEN_BLUE_COIN_ACT_ACTIVE=2\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 4e6c39f62..1b3bb0e3c 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -28010,7 +28010,7 @@ int smlua_func_obj_spawn_loot_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_coins"); return 0; } - f32 baseYVel = smlua_to_number(L, 3); + f32 sp30 = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_coins"); return 0; } BehaviorScript * coinBehavior = (BehaviorScript *)smlua_to_cpointer(L, 4, LVT_BEHAVIORSCRIPT_P); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_coins"); return 0; } @@ -28019,8 +28019,8 @@ int smlua_func_obj_spawn_loot_coins(lua_State* L) { s16 model = smlua_to_integer(L, 6); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "obj_spawn_loot_coins"); return 0; } - extern void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 baseYVel, const BehaviorScript *coinBehavior, s16 posJitter, s16 model); - obj_spawn_loot_coins(obj, numCoins, baseYVel, coinBehavior, posJitter, model); + extern void obj_spawn_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, const BehaviorScript *coinBehavior, s16 posJitter, s16 model); + obj_spawn_loot_coins(obj, numCoins, sp30, coinBehavior, posJitter, model); return 1; } @@ -28038,13 +28038,13 @@ int smlua_func_obj_spawn_loot_blue_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_blue_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_blue_coins"); return 0; } - f32 baseYVel = smlua_to_number(L, 3); + f32 sp28 = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_blue_coins"); return 0; } s16 posJitter = smlua_to_integer(L, 4); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "obj_spawn_loot_blue_coins"); return 0; } - extern void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 baseYVel, s16 posJitter); - obj_spawn_loot_blue_coins(obj, numCoins, baseYVel, posJitter); + extern void obj_spawn_loot_blue_coins(struct Object *obj, s32 numCoins, f32 sp28, s16 posJitter); + obj_spawn_loot_blue_coins(obj, numCoins, sp28, posJitter); return 1; } @@ -28062,11 +28062,11 @@ int smlua_func_obj_spawn_loot_yellow_coins(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_spawn_loot_yellow_coins"); return 0; } s32 numCoins = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_spawn_loot_yellow_coins"); return 0; } - f32 baseYVel = smlua_to_number(L, 3); + f32 sp28 = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "obj_spawn_loot_yellow_coins"); return 0; } - extern void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 baseYVel); - obj_spawn_loot_yellow_coins(obj, numCoins, baseYVel); + extern void obj_spawn_loot_yellow_coins(struct Object *obj, s32 numCoins, f32 sp28); + obj_spawn_loot_yellow_coins(obj, numCoins, sp28); return 1; } @@ -29162,13 +29162,13 @@ int smlua_func_obj_explode_and_spawn_coins(lua_State* L) { return 0; } - f32 mistSize = smlua_to_number(L, 1); + f32 sp18 = smlua_to_number(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "obj_explode_and_spawn_coins"); return 0; } - s32 coinType = smlua_to_integer(L, 2); + s32 sp1C = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "obj_explode_and_spawn_coins"); return 0; } - extern void obj_explode_and_spawn_coins(f32 mistSize, s32 coinType); - obj_explode_and_spawn_coins(mistSize, coinType); + extern void obj_explode_and_spawn_coins(f32 sp18, s32 sp1C); + obj_explode_and_spawn_coins(sp18, sp1C); return 1; } From dc9e3c8c8a2b29653d9b9e9c7b8b4a4a51557a35 Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Thu, 18 Jun 2026 20:47:18 -0500 Subject: [PATCH 15/16] sep-pauseExit --- autogen/convert_constants.py | 1 - autogen/lua_definitions/constants.lua | 259 ++++++++++++-------------- autogen/lua_definitions/functions.lua | 14 +- autogen/lua_definitions/structs.lua | 1 - docs/lua/constants.md | 154 +++++---------- docs/lua/functions-3.md | 22 +-- docs/lua/structs.md | 1 - src/game/area.c | 8 +- src/game/area.h | 22 +-- src/game/bettercamera.inc.h | 3 +- src/game/hardcoded.c | 1 - src/game/hardcoded.h | 10 - src/game/ingame_menu.c | 75 +++++--- src/game/interaction.c | 8 +- src/game/level_update.c | 139 ++++++++------ src/game/level_update.h | 136 +++++++------- src/game/mario_actions_cutscene.c | 41 ++-- src/menu/ingame_text.h | 3 +- src/menu/star_select.c | 10 +- src/pc/lua/smlua_cobject_autogen.c | 3 +- src/pc/lua/smlua_constants_autogen.c | 79 +++----- src/pc/lua/smlua_functions_autogen.c | 10 +- src/pc/lua/utils/smlua_misc_utils.c | 2 +- 23 files changed, 451 insertions(+), 551 deletions(-) diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index fee8b75bb..32e3debad 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -58,7 +58,6 @@ in_files = [ "src/pc/gfx/gfx_pc.h", "src/engine/surface_load.h", "src/pc/lua/utils/smlua_audio_utils.h", - "src/game/hardcoded.h", ] exclude_constants = { diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 8386309ee..031d03b27 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -618,31 +618,6 @@ WARP_TRANSITION_FADE_FROM_BOWSER = 0x12 --- @type integer WARP_TRANSITION_FADE_INTO_BOWSER = 0x13 -MENU_OPT_NONE = 0 --- @type MenuOption -MENU_OPT_1 = 1 --- @type MenuOption -MENU_OPT_2 = 2 --- @type MenuOption -MENU_OPT_3 = 3 --- @type MenuOption -MENU_OPT_DEFAULT = MENU_OPT_1 --- @type MenuOption -MENU_OPT_CONTINUE = MENU_OPT_1 --- @type MenuOption -MENU_OPT_EXIT_COURSE = ((MENU_OPT_CONTINUE) + 1) --- @type MenuOption -MENU_OPT_CAMERA_ANGLE_R = ((MENU_OPT_CONTINUE) + 2) --- @type MenuOption -MENU_OPT_EXIT_TO_CASTLE = ((MENU_OPT_CONTINUE) + 3) --- @type MenuOption -MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1 --- @type MenuOption -MENU_OPT_CONTINUE_DONT_SAVE = ((MENU_OPT_SAVE_AND_CONTINUE) + 1) --- @type MenuOption - ---- @alias MenuOption ---- | `MENU_OPT_NONE` ---- | `MENU_OPT_1` ---- | `MENU_OPT_2` ---- | `MENU_OPT_3` ---- | `MENU_OPT_DEFAULT` ---- | `MENU_OPT_CONTINUE` ---- | `MENU_OPT_EXIT_COURSE` ---- | `MENU_OPT_CAMERA_ANGLE_R` ---- | `MENU_OPT_EXIT_TO_CASTLE` ---- | `MENU_OPT_SAVE_AND_CONTINUE` ---- | `MENU_OPT_CONTINUE_DONT_SAVE` - --- @type string VERSION_REGION = "US" @@ -3234,23 +3209,6 @@ GEO_CONTEXT_AREA_INIT = 4 --- @type integer GEO_CONTEXT_HELD_OBJ = 5 -PAUSE_EXIT_VANILLA = 0 --- @type PauseExitMode -PAUSE_EXIT_COURSE = 1 --- @type PauseExitMode -PAUSE_EXIT_TO_CASTLE = 2 --- @type PauseExitMode -PAUSE_EXIT_BOTH = 3 --- @type PauseExitMode - ---- @alias PauseExitMode ---- | `PAUSE_EXIT_VANILLA` ---- | `PAUSE_EXIT_COURSE` ---- | `PAUSE_EXIT_TO_CASTLE` ---- | `PAUSE_EXIT_BOTH` - ---- @type integer -STARS_NEEDED_FOR_DIALOG_COUNT = 6 - ---- @type integer -EXCLAMATION_BOX_MAX_SIZE = 99 - INTERACT_HOOT = (1 << 0) --- @type InteractionType INTERACT_GRABBABLE = (1 << 1) --- @type InteractionType INTERACT_DOOR = (1 << 2) --- @type InteractionType @@ -3568,85 +3526,86 @@ LEVEL_COUNT = 39 --- @type LevelNum --- | `LEVEL_UNKNOWN_38` --- | `LEVEL_COUNT` -TIMER_CONTROL_SHOW = 0 --- @type TimerControl -TIMER_CONTROL_START = 1 --- @type TimerControl -TIMER_CONTROL_STOP = 2 --- @type TimerControl -TIMER_CONTROL_HIDE = 3 --- @type TimerControl +--- @type integer +TIMER_CONTROL_SHOW = 0 ---- @alias TimerControl ---- | `TIMER_CONTROL_SHOW` ---- | `TIMER_CONTROL_START` ---- | `TIMER_CONTROL_STOP` ---- | `TIMER_CONTROL_HIDE` +--- @type integer +TIMER_CONTROL_START = 1 -WARP_OP_NONE = 0 --- @type WarpOperation -WARP_OP_LOOK_UP = 1 --- @type WarpOperation -WARP_OP_SPIN_SHRINK = 2 --- @type WarpOperation -WARP_OP_WARP_DOOR = 3 --- @type WarpOperation -WARP_OP_WARP_OBJECT = 4 --- @type WarpOperation -WARP_OP_TELEPORT = 5 --- @type WarpOperation -WARP_OP_TRIGGERS_LEVEL_SELECT = 0x10 --- @type WarpOperation -WARP_OP_STAR_EXIT = 17 --- @type WarpOperation -WARP_OP_DEATH = 18 --- @type WarpOperation -WARP_OP_WARP_FLOOR = 19 --- @type WarpOperation -WARP_OP_GAME_OVER = 20 --- @type WarpOperation -WARP_OP_CREDITS_END = 21 --- @type WarpOperation -WARP_OP_DEMO_NEXT = 22 --- @type WarpOperation -WARP_OP_CREDITS_START = 23 --- @type WarpOperation -WARP_OP_CREDITS_NEXT = 24 --- @type WarpOperation -WARP_OP_DEMO_END = 25 --- @type WarpOperation -WARP_OP_FORCE_SYNC = 26 --- @type WarpOperation -WARP_OP_EXIT = 27 --- @type WarpOperation +--- @type integer +TIMER_CONTROL_STOP = 2 ---- @alias WarpOperation ---- | `WARP_OP_NONE` ---- | `WARP_OP_LOOK_UP` ---- | `WARP_OP_SPIN_SHRINK` ---- | `WARP_OP_WARP_DOOR` ---- | `WARP_OP_WARP_OBJECT` ---- | `WARP_OP_TELEPORT` ---- | `WARP_OP_TRIGGERS_LEVEL_SELECT` ---- | `WARP_OP_STAR_EXIT` ---- | `WARP_OP_DEATH` ---- | `WARP_OP_WARP_FLOOR` ---- | `WARP_OP_GAME_OVER` ---- | `WARP_OP_CREDITS_END` ---- | `WARP_OP_DEMO_NEXT` ---- | `WARP_OP_CREDITS_START` ---- | `WARP_OP_CREDITS_NEXT` ---- | `WARP_OP_DEMO_END` ---- | `WARP_OP_FORCE_SYNC` ---- | `WARP_OP_EXIT` +--- @type integer +TIMER_CONTROL_HIDE = 3 -WARP_SPECIAL_LEVEL_SELECT = -9 --- @type SpecialWarpDestinations -WARP_SPECIAL_INTRO_SPLASH_SCREEN = -8 --- @type SpecialWarpDestinations -WARP_SPECIAL_SWITCH_FILE = -7 --- @type SpecialWarpDestinations -WARP_SPECIAL_MARIO_HEAD_DIZZY = -3 --- @type SpecialWarpDestinations -WARP_SPECIAL_MARIO_HEAD_REGULAR = -2 --- @type SpecialWarpDestinations -WARP_SPECIAL_ENDING = -1 --- @type SpecialWarpDestinations -WARP_SPECIAL_NONE = 0 --- @type SpecialWarpDestinations +--- @type integer +WARP_OP_NONE = 0x00 ---- @alias SpecialWarpDestinations ---- | `WARP_SPECIAL_LEVEL_SELECT` ---- | `WARP_SPECIAL_INTRO_SPLASH_SCREEN` ---- | `WARP_SPECIAL_SWITCH_FILE` ---- | `WARP_SPECIAL_MARIO_HEAD_DIZZY` ---- | `WARP_SPECIAL_MARIO_HEAD_REGULAR` ---- | `WARP_SPECIAL_ENDING` ---- | `WARP_SPECIAL_NONE` +--- @type integer +WARP_OP_LOOK_UP = 0x01 -WARP_FLAGS_NONE = (0 << 0) --- @type WarpFlags -WARP_FLAG_DOOR_PULLED = (1 << 0) --- @type WarpFlags -WARP_FLAG_DOOR_FLIP_MARIO = (1 << 1) --- @type WarpFlags -WARP_FLAG_DOOR_IS_WARP = (1 << 2) --- @type WarpFlags -WARP_FLAG_EXIT_COURSE = (1 << 3) --- @type WarpFlags +--- @type integer +WARP_OP_SPIN_SHRINK = 0x02 ---- @alias WarpFlags ---- | `WARP_FLAGS_NONE` ---- | `WARP_FLAG_DOOR_PULLED` ---- | `WARP_FLAG_DOOR_FLIP_MARIO` ---- | `WARP_FLAG_DOOR_IS_WARP` ---- | `WARP_FLAG_EXIT_COURSE` +--- @type integer +WARP_OP_WARP_DOOR = 0x03 + +--- @type integer +WARP_OP_WARP_OBJECT = 0x04 + +--- @type integer +WARP_OP_TELEPORT = 0x05 + +--- @type integer +WARP_OP_STAR_EXIT = 0x11 + +--- @type integer +WARP_OP_DEATH = 0x12 + +--- @type integer +WARP_OP_WARP_FLOOR = 0x13 + +--- @type integer +WARP_OP_GAME_OVER = 0x14 + +--- @type integer +WARP_OP_CREDITS_END = 0x15 + +--- @type integer +WARP_OP_DEMO_NEXT = 0x16 + +--- @type integer +WARP_OP_CREDITS_START = 0x17 + +--- @type integer +WARP_OP_CREDITS_NEXT = 0x18 + +--- @type integer +WARP_OP_DEMO_END = 0x19 + +--- @type integer +WARP_OP_FORCE_SYNC = 0x20 + +--- @type integer +WARP_OP_EXIT = 0x21 + +--- @type integer +WARP_OP_TRIGGERS_LEVEL_SELECT = 0x10 + +--- @type integer +SPECIAL_WARP_CAKE = -1 + +--- @type integer +SPECIAL_WARP_GODDARD = -2 + +--- @type integer +SPECIAL_WARP_GODDARD_GAMEOVER = -3 + +--- @type integer +SPECIAL_WARP_TITLE = -8 + +--- @type integer +SPECIAL_WARP_LEVEL_SELECT = -9 MARIO_SPAWN_NONE = 0 --- @type MarioSpawnType MARIO_SPAWN_DOOR_WARP = 1 --- @type MarioSpawnType @@ -3693,37 +3652,53 @@ MARIO_SPAWN_FADE_FROM_BLACK = 39 --- @type MarioSpawnType --- | `MARIO_SPAWN_UNUSED_38` --- | `MARIO_SPAWN_FADE_FROM_BLACK` -WARP_NODE_MAIN_ENTRY = 0x0A --- @type WarpNodes -WARP_NODE_DEFAULT = 0xF0 --- @type WarpNodes -WARP_NODE_DEATH = 0xF1 --- @type WarpNodes -WARP_NODE_LOOK_UP = 0xF2 --- @type WarpNodes -WARP_NODE_WARP_FLOOR = 0xF3 --- @type WarpNodes -WARP_NODE_CREDITS_MIN = 0xF8 --- @type WarpNodes -WARP_NODE_CREDITS_START = 0xF8 --- @type WarpNodes -WARP_NODE_CREDITS_NEXT = 0xF9 --- @type WarpNodes -WARP_NODE_CREDITS_END = 0xFA --- @type WarpNodes +--- @type integer +MARIO_SPAWN_UNKNOWN_02 = 0x02 ---- @alias WarpNodes ---- | `WARP_NODE_MAIN_ENTRY` ---- | `WARP_NODE_DEFAULT` ---- | `WARP_NODE_DEATH` ---- | `WARP_NODE_LOOK_UP` ---- | `WARP_NODE_WARP_FLOOR` ---- | `WARP_NODE_CREDITS_MIN` ---- | `WARP_NODE_CREDITS_START` ---- | `WARP_NODE_CREDITS_NEXT` ---- | `WARP_NODE_CREDITS_END` +--- @type integer +MARIO_SPAWN_UNKNOWN_03 = 0x03 -WARP_TYPE_NOT_WARPING = 0 --- @type WarpTypes -WARP_TYPE_CHANGE_LEVEL = 1 --- @type WarpTypes -WARP_TYPE_CHANGE_AREA = 2 --- @type WarpTypes -WARP_TYPE_SAME_AREA = 3 --- @type WarpTypes +--- @type integer +MARIO_SPAWN_UNKNOWN_27 = 0x27 ---- @alias WarpTypes ---- | `WARP_TYPE_NOT_WARPING` ---- | `WARP_TYPE_CHANGE_LEVEL` ---- | `WARP_TYPE_CHANGE_AREA` ---- | `WARP_TYPE_SAME_AREA` +--- @type integer +WARP_NODE_F0 = 0xF0 + +--- @type integer +WARP_NODE_DEATH = 0xF1 + +--- @type integer +WARP_NODE_F2 = 0xF2 + +--- @type integer +WARP_NODE_WARP_FLOOR = 0xF3 + +--- @type integer +WARP_NODE_CREDITS_START = 0xF8 + +--- @type integer +WARP_NODE_CREDITS_NEXT = 0xF9 + +--- @type integer +WARP_NODE_CREDITS_END = 0xFA + +--- @type integer +WARP_NODE_CREDITS_MIN = 0xF8 + +--- @type integer +WARP_TYPE_NOT_WARPING = 0 + +--- @type integer +WARP_TYPE_CHANGE_LEVEL = 1 + +--- @type integer +WARP_TYPE_CHANGE_AREA = 2 + +--- @type integer +WARP_TYPE_SAME_AREA = 3 + +--- @type integer +WARP_ARG_EXIT_COURSE = -1 --- @type integer PRESS_START_DEMO_TIMER = 800 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index d4dda9bc8..d2b7d83d2 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -5230,7 +5230,7 @@ function pressed_pause() -- ... end ---- @param arg SpecialWarpDestinations +--- @param arg integer --- @param color integer --- Fades into a special warp with `arg` and using `color` function fade_into_special_warp(arg, color) @@ -5257,15 +5257,15 @@ function initiate_painting_warp(paintingIndex) end --- @param m MarioState ---- @param warpOp WarpOperation +--- @param warpOp integer --- @return integer --- Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m` function level_trigger_warp(m, warpOp) -- ... end ---- @param arg SpecialWarpDestinations ---- Special warps to arg (`WARP_SPECIAL_*`) +--- @param arg integer +--- Special warps to arg (`SPECIAL_WARP_*`) function warp_special(arg) -- ... end @@ -5273,9 +5273,9 @@ end --- @param destLevel integer --- @param destArea integer --- @param destWarpNode integer ---- @param warpFlags integer ---- Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `warpFlags`. This function is unstable and it's generally recommended to use `warp_to_level` instead -function initiate_warp(destLevel, destArea, destWarpNode, warpFlags) +--- @param arg integer +--- Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead +function initiate_warp(destLevel, destArea, destWarpNode, arg) -- ... end diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 187590de6..5e19d87a1 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -1030,7 +1030,6 @@ --- @field public showStarNumber integer --- @field public extendedPauseDisplay integer --- @field public pauseExitAnywhere integer ---- @field public pauseExitMode PauseExitMode --- @field public disableActs integer --- @field public bubbleOnDeathBarrierInCapStages integer --- @field public entryLevel LevelNum diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 7fd2706fa..09101617a 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -2,7 +2,6 @@ # Supported Constants - [area.h](#areah) - - [enum MenuOption](#enum-MenuOption) - [behavior_table.h](#behavior_tableh) - [enum BehaviorId](#enum-BehaviorId) - [camera.h](#camerah) @@ -33,8 +32,6 @@ - [gfx_pc.h](#gfx_pch) - [enum ShaderFlag](#enum-ShaderFlag) - [graph_node.h](#graph_nodeh) -- [hardcoded.h](#hardcodedh) - - [enum PauseExitMode](#enum-PauseExitMode) - [interaction.c](#interactionc) - [interaction.h](#interactionh) - [enum InteractionType](#enum-InteractionType) @@ -44,13 +41,7 @@ - [level_defines.h](#level_definesh) - [enum LevelNum](#enum-LevelNum) - [level_update.h](#level_updateh) - - [enum TimerControl](#enum-TimerControl) - - [enum WarpOperation](#enum-WarpOperation) - - [enum SpecialWarpDestinations](#enum-SpecialWarpDestinations) - - [enum WarpFlags](#enum-WarpFlags) - [enum MarioSpawnType](#enum-MarioSpawnType) - - [enum WarpNodes](#enum-WarpNodes) - - [enum WarpTypes](#enum-WarpTypes) - [enum HUDDisplayFlag](#enum-HUDDisplayFlag) - [lighting_engine.h](#lighting_engineh) - [enum LEMode](#enum-LEMode) @@ -124,21 +115,6 @@ - WARP_TRANSITION_FADE_INTO_MARIO - WARP_TRANSITION_FADE_FROM_BOWSER - WARP_TRANSITION_FADE_INTO_BOWSER - -### [enum MenuOption](#MenuOption) -| Identifier | Value | -| :--------- | :---- | -| MENU_OPT_NONE | 0 | -| MENU_OPT_1 | 1 | -| MENU_OPT_2 | 2 | -| MENU_OPT_3 | 3 | -| MENU_OPT_DEFAULT | MENU_OPT_1 | -| MENU_OPT_CONTINUE | MENU_OPT_1 | -| MENU_OPT_EXIT_COURSE | ((MENU_OPT_CONTINUE) + 1) | -| MENU_OPT_CAMERA_ANGLE_R | ((MENU_OPT_CONTINUE) + 2) | -| MENU_OPT_EXIT_TO_CASTLE | ((MENU_OPT_CONTINUE) + 3) | -| MENU_OPT_SAVE_AND_CONTINUE | MENU_OPT_1 | -| MENU_OPT_CONTINUE_DONT_SAVE | ((MENU_OPT_SAVE_AND_CONTINUE) + 1) | - VERSION_REGION [:arrow_up_small:](#) @@ -1434,22 +1410,6 @@
-## [hardcoded.h](#hardcoded.h) - -### [enum PauseExitMode](#PauseExitMode) -| Identifier | Value | -| :--------- | :---- | -| PAUSE_EXIT_VANILLA | 0 | -| PAUSE_EXIT_COURSE | 1 | -| PAUSE_EXIT_TO_CASTLE | 2 | -| PAUSE_EXIT_BOTH | 3 | -- STARS_NEEDED_FOR_DIALOG_COUNT -- EXCLAMATION_BOX_MAX_SIZE - -[:arrow_up_small:](#) - -
- ## [interaction.c](#interaction.c) [:arrow_up_small:](#) @@ -1623,56 +1583,33 @@
## [level_update.h](#level_update.h) - -### [enum TimerControl](#TimerControl) -| Identifier | Value | -| :--------- | :---- | -| TIMER_CONTROL_SHOW | 0 | -| TIMER_CONTROL_START | 1 | -| TIMER_CONTROL_STOP | 2 | -| TIMER_CONTROL_HIDE | 3 | - -### [enum WarpOperation](#WarpOperation) -| Identifier | Value | -| :--------- | :---- | -| WARP_OP_NONE | 0 | -| WARP_OP_LOOK_UP | 1 | -| WARP_OP_SPIN_SHRINK | 2 | -| WARP_OP_WARP_DOOR | 3 | -| WARP_OP_WARP_OBJECT | 4 | -| WARP_OP_TELEPORT | 5 | -| WARP_OP_TRIGGERS_LEVEL_SELECT | 0x10 | -| WARP_OP_STAR_EXIT | 17 | -| WARP_OP_DEATH | 18 | -| WARP_OP_WARP_FLOOR | 19 | -| WARP_OP_GAME_OVER | 20 | -| WARP_OP_CREDITS_END | 21 | -| WARP_OP_DEMO_NEXT | 22 | -| WARP_OP_CREDITS_START | 23 | -| WARP_OP_CREDITS_NEXT | 24 | -| WARP_OP_DEMO_END | 25 | -| WARP_OP_FORCE_SYNC | 26 | -| WARP_OP_EXIT | 27 | - -### [enum SpecialWarpDestinations](#SpecialWarpDestinations) -| Identifier | Value | -| :--------- | :---- | -| WARP_SPECIAL_LEVEL_SELECT | -9 | -| WARP_SPECIAL_INTRO_SPLASH_SCREEN | -8 | -| WARP_SPECIAL_SWITCH_FILE | -7 | -| WARP_SPECIAL_MARIO_HEAD_DIZZY | -3 | -| WARP_SPECIAL_MARIO_HEAD_REGULAR | -2 | -| WARP_SPECIAL_ENDING | -1 | -| WARP_SPECIAL_NONE | 0 | - -### [enum WarpFlags](#WarpFlags) -| Identifier | Value | -| :--------- | :---- | -| WARP_FLAGS_NONE | (0 << 0) | -| WARP_FLAG_DOOR_PULLED | (1 << 0) | -| WARP_FLAG_DOOR_FLIP_MARIO | (1 << 1) | -| WARP_FLAG_DOOR_IS_WARP | (1 << 2) | -| WARP_FLAG_EXIT_COURSE | (1 << 3) | +- TIMER_CONTROL_SHOW +- TIMER_CONTROL_START +- TIMER_CONTROL_STOP +- TIMER_CONTROL_HIDE +- WARP_OP_NONE +- WARP_OP_LOOK_UP +- WARP_OP_SPIN_SHRINK +- WARP_OP_WARP_DOOR +- WARP_OP_WARP_OBJECT +- WARP_OP_TELEPORT +- WARP_OP_STAR_EXIT +- WARP_OP_DEATH +- WARP_OP_WARP_FLOOR +- WARP_OP_GAME_OVER +- WARP_OP_CREDITS_END +- WARP_OP_DEMO_NEXT +- WARP_OP_CREDITS_START +- WARP_OP_CREDITS_NEXT +- WARP_OP_DEMO_END +- WARP_OP_FORCE_SYNC +- WARP_OP_EXIT +- WARP_OP_TRIGGERS_LEVEL_SELECT +- SPECIAL_WARP_CAKE +- SPECIAL_WARP_GODDARD +- SPECIAL_WARP_GODDARD_GAMEOVER +- SPECIAL_WARP_TITLE +- SPECIAL_WARP_LEVEL_SELECT ### [enum MarioSpawnType](#MarioSpawnType) | Identifier | Value | @@ -1698,27 +1635,22 @@ | MARIO_SPAWN_LAUNCH_DEATH | 37 | | MARIO_SPAWN_UNUSED_38 | 38 | | MARIO_SPAWN_FADE_FROM_BLACK | 39 | - -### [enum WarpNodes](#WarpNodes) -| Identifier | Value | -| :--------- | :---- | -| WARP_NODE_MAIN_ENTRY | 0x0A | -| WARP_NODE_DEFAULT | 0xF0 | -| WARP_NODE_DEATH | 0xF1 | -| WARP_NODE_LOOK_UP | 0xF2 | -| WARP_NODE_WARP_FLOOR | 0xF3 | -| WARP_NODE_CREDITS_MIN | 0xF8 | -| WARP_NODE_CREDITS_START | 0xF8 | -| WARP_NODE_CREDITS_NEXT | 0xF9 | -| WARP_NODE_CREDITS_END | 0xFA | - -### [enum WarpTypes](#WarpTypes) -| Identifier | Value | -| :--------- | :---- | -| WARP_TYPE_NOT_WARPING | 0 | -| WARP_TYPE_CHANGE_LEVEL | 1 | -| WARP_TYPE_CHANGE_AREA | 2 | -| WARP_TYPE_SAME_AREA | 3 | +- MARIO_SPAWN_UNKNOWN_02 +- MARIO_SPAWN_UNKNOWN_03 +- MARIO_SPAWN_UNKNOWN_27 +- WARP_NODE_F0 +- WARP_NODE_DEATH +- WARP_NODE_F2 +- WARP_NODE_WARP_FLOOR +- WARP_NODE_CREDITS_START +- WARP_NODE_CREDITS_NEXT +- WARP_NODE_CREDITS_END +- WARP_NODE_CREDITS_MIN +- WARP_TYPE_NOT_WARPING +- WARP_TYPE_CHANGE_LEVEL +- WARP_TYPE_CHANGE_AREA +- WARP_TYPE_SAME_AREA +- WARP_ARG_EXIT_COURSE - PRESS_START_DEMO_TIMER - PAINTING_WARP_INDEX_START - PAINTING_WARP_INDEX_FA diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md index edef0a319..bfa5ffcf9 100644 --- a/docs/lua/functions-3.md +++ b/docs/lua/functions-3.md @@ -6994,14 +6994,14 @@ Fades into a special warp with `arg` and using `color` ### Parameters | Field | Type | | ----- | ---- | -| arg | [enum SpecialWarpDestinations](constants.md#enum-SpecialWarpDestinations) | +| arg | `integer` | | color | `integer` | ### Returns - None ### C Prototype -`void fade_into_special_warp(enum SpecialWarpDestinations arg, u32 color);` +`void fade_into_special_warp(u32 arg, u32 color);` [:arrow_up_small:](#) @@ -7086,13 +7086,13 @@ Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m` | Field | Type | | ----- | ---- | | m | [MarioState](structs.md#MarioState) | -| warpOp | [enum WarpOperation](constants.md#enum-WarpOperation) | +| warpOp | `integer` | ### Returns - `integer` ### C Prototype -`s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp);` +`s16 level_trigger_warp(struct MarioState *m, s32 warpOp);` [:arrow_up_small:](#) @@ -7101,7 +7101,7 @@ Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m` ## [warp_special](#warp_special) ### Description -Special warps to arg (`WARP_SPECIAL_*`) +Special warps to arg (`SPECIAL_WARP_*`) ### Lua Example `warp_special(arg)` @@ -7109,13 +7109,13 @@ Special warps to arg (`WARP_SPECIAL_*`) ### Parameters | Field | Type | | ----- | ---- | -| arg | [enum SpecialWarpDestinations](constants.md#enum-SpecialWarpDestinations) | +| arg | `integer` | ### Returns - None ### C Prototype -`void warp_special(enum SpecialWarpDestinations arg);` +`void warp_special(s32 arg);` [:arrow_up_small:](#) @@ -7124,10 +7124,10 @@ Special warps to arg (`WARP_SPECIAL_*`) ## [initiate_warp](#initiate_warp) ### Description -Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `warpFlags`. This function is unstable and it's generally recommended to use `warp_to_level` instead +Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead ### Lua Example -`initiate_warp(destLevel, destArea, destWarpNode, warpFlags)` +`initiate_warp(destLevel, destArea, destWarpNode, arg)` ### Parameters | Field | Type | @@ -7135,13 +7135,13 @@ Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `warpFlags` | destLevel | `integer` | | destArea | `integer` | | destWarpNode | `integer` | -| warpFlags | `integer` | +| arg | `integer` | ### Returns - None ### C Prototype -`void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags);` +`void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg);` [:arrow_up_small:](#) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index b0b13daee..3da14cfe2 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -1526,7 +1526,6 @@ | showStarNumber | `integer` | | | extendedPauseDisplay | `integer` | | | pauseExitAnywhere | `integer` | | -| pauseExitMode | [enum PauseExitMode](constants.md#enum-PauseExitMode) | | | disableActs | `integer` | | | bubbleOnDeathBarrierInCapStages | `integer` | | | entryLevel | [enum LevelNum](constants.md#enum-LevelNum) | | diff --git a/src/game/area.c b/src/game/area.c index cee7a9122..003ec1643 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -41,7 +41,7 @@ s16 gCurrActNum; s16 gCurrActStarNum; s16 gCurrAreaIndex; s16 gSavedCourseNum; -s16 gMenuOptSelectIndex; +s16 gPauseScreenMode; s16 gSaveOptSelectIndex; struct SpawnInfo *gMarioSpawnInfo = &gPlayerSpawnInfos[0]; @@ -476,10 +476,10 @@ void render_game(void) { } gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT - BORDER_HEIGHT); - gMenuOptSelectIndex = render_menus_and_dialogs(); + gPauseScreenMode = render_menus_and_dialogs(); - if (gMenuOptSelectIndex != 0) { - gSaveOptSelectIndex = gMenuOptSelectIndex; + if (gPauseScreenMode != 0) { + gSaveOptSelectIndex = gPauseScreenMode; } if (gViewportClip != NULL) { diff --git a/src/game/area.h b/src/game/area.h index daeac0a13..d5340fdee 100644 --- a/src/game/area.h +++ b/src/game/area.h @@ -126,26 +126,8 @@ struct WarpTransition /*0x04*/ struct WarpTransitionData data; }; -enum MenuOption { - MENU_OPT_NONE, - MENU_OPT_1, - MENU_OPT_2, - MENU_OPT_3, - MENU_OPT_DEFAULT = MENU_OPT_1, - - // Course Pause Menu - MENU_OPT_CONTINUE = MENU_OPT_1, - MENU_OPT_EXIT_COURSE, - MENU_OPT_CAMERA_ANGLE_R, - MENU_OPT_EXIT_TO_CASTLE, - - // Save Menu - MENU_OPT_SAVE_AND_CONTINUE = MENU_OPT_1, - // MENU_OPT_SAVE_AND_QUIT, - MENU_OPT_CONTINUE_DONT_SAVE -}; - extern struct SpawnInfo gPlayerSpawnInfos[]; +extern struct GraphNode *D_8033A160[]; extern struct Area gAreaData[]; extern struct WarpTransition gWarpTransition; extern s16 gCurrCourseNum; @@ -153,7 +135,7 @@ extern s16 gCurrActNum; extern s16 gCurrActStarNum; extern s16 gCurrAreaIndex; extern s16 gSavedCourseNum; -extern s16 gMenuOptSelectIndex; +extern s16 gPauseScreenMode; extern s16 gSaveOptSelectIndex; extern struct SpawnInfo *gMarioSpawnInfo; diff --git a/src/game/bettercamera.inc.h b/src/game/bettercamera.inc.h index 2be712b31..76651f134 100644 --- a/src/game/bettercamera.inc.h +++ b/src/game/bettercamera.inc.h @@ -600,13 +600,12 @@ static void newcam_apply_values(struct Camera *c) { // Adds support for wing mario tower if (gNewCamera.tilt < -8000 && sCurrPlayMode != PLAY_MODE_PAUSED && - gMarioState->action & ACT_FLAG_ALLOW_FIRST_PERSON && gMarioState->floor != NULL && gMarioState->floor->type == SURFACE_LOOK_UP_WARP && gMarioState->forwardVel == 0 && save_file_get_total_star_count(gCurrSaveFileNum - 1, 0, COURSE_COUNT - 1) >= gLevelValues.wingCapLookUpReq) { - level_trigger_warp(gMarioState, WARP_OP_LOOK_UP); + level_trigger_warp(gMarioState, 1); } } diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index f3bd96806..344a370ad 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -63,7 +63,6 @@ struct LevelValues gDefaultLevelValues = { .showStarNumber = FALSE, .extendedPauseDisplay = FALSE, .pauseExitAnywhere = TRUE, - .pauseExitMode = PAUSE_EXIT_BOTH, .disableActs = FALSE, .bubbleOnDeathBarrierInCapStages = FALSE, .entryLevel = LEVEL_CASTLE_GROUNDS, diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index 15ab4a4e6..bb597d2a0 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -41,15 +41,6 @@ struct StarPositions { Vec3f JetstreamRingStarPos; }; -#define PAUSE_EXIT_MODE gLevelValues.pauseExitMode - -enum PauseExitMode { - PAUSE_EXIT_VANILLA, // 0b00 // "EXIT COURSE" exits to castle - PAUSE_EXIT_COURSE, // 0b01 // "EXIT COURSE" exits the course - PAUSE_EXIT_TO_CASTLE, // 0b10 // "EXIT TO CASTLE" exits to castle - PAUSE_EXIT_BOTH // 0b11 // "EXIT COURSE" and "EXIT TO CASTLE" -}; - struct LevelValues { u8 fixCollisionBugs; u8 fixCollisionBugsRoundedCorners; @@ -70,7 +61,6 @@ struct LevelValues { u8 showStarNumber; u8 extendedPauseDisplay; u8 pauseExitAnywhere; - enum PauseExitMode pauseExitMode; u8 disableActs; u8 bubbleOnDeathBarrierInCapStages; enum LevelNum entryLevel; diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index d28de08dd..ac984fad6 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -2524,6 +2524,9 @@ void render_pause_camera_options(s16 x, s16 y, s8 *index, s16 xIndex) { #endif void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) { + u8 TEXT_EXIT_TO_CASTLE[16] = { DIALOG_CHAR_TERMINATOR }; + convert_string_ascii_to_sm64(TEXT_EXIT_TO_CASTLE, "EXIT TO CASTLE", false); + #ifdef VERSION_EU u8 textContinue[][10] = { { TEXT_CONTINUE }, @@ -2548,34 +2551,28 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) { INGAME_TEXT_COPY(textContinue, TEXT_CONTINUE); INGAME_TEXT_COPY(textExitCourse, TEXT_EXIT_COURSE); INGAME_TEXT_COPY(textCameraAngleR, TEXT_CAMERA_ANGLE_R); - #endif - u8 textExitToCastle[] = { TEXT_EXIT_TO_CASTLE }; - u8 maxIndex = PAUSE_EXIT_MODE == PAUSE_EXIT_BOTH ? 4 : 3; - handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, maxIndex); +#endif + + handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 4); gSPDisplayList(gDisplayListHead++, dl_ia_text_begin); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha); print_generic_string(x + 10, y - 2, textContinue); - if (PAUSE_EXIT_MODE != PAUSE_EXIT_TO_CASTLE) { - y -= yIndex; print_generic_string(x + 10, y - 2, textExitCourse); - } - if (PAUSE_EXIT_MODE & PAUSE_EXIT_TO_CASTLE) { - y -= yIndex; print_generic_string(x + 10, y - 2, textExitToCastle); - } + print_generic_string(x + 10, y - 17, textExitCourse); + print_generic_string(x + 10, y - 32, TEXT_EXIT_TO_CASTLE); - if (*index != maxIndex) { - print_generic_string(x + 10, y - 17, textCameraAngleR); + if (index[0] != 4) { + print_generic_string(x + 10, y - 47, textCameraAngleR); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); - y += (maxIndex - 2) * yIndex; - create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((*index - 1) * yIndex)) - Y_VAL8, 0); + create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((index[0] - 1) * yIndex)) - Y_VAL8, 0); gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha); gSPDisplayList(gDisplayListHead++, dl_draw_triangle); gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW); } else { - render_pause_camera_options(x - 42, y - 27, &gDialogCameraAngleIndex, 110); + render_pause_camera_options(x - 42, y - 57, &gDialogCameraAngleIndex, 110); } } @@ -2955,6 +2952,8 @@ s32 gCourseCompleteCoins = 0; s8 gHudFlash = 0; s16 render_pause_courses_and_castle(void) { + s16 num; + #ifdef VERSION_EU gInGameLanguage = eu_get_language(); #endif @@ -2991,15 +2990,13 @@ s16 render_pause_courses_and_castle(void) { #ifdef VERSION_EU if (gPlayer1Controller->buttonPressed & (A_BUTTON | Z_TRIG | START_BUTTON)) #else - if (gPlayer1Controller->buttonPressed & (A_BUTTON | START_BUTTON)) + if (gPlayer1Controller->buttonPressed & A_BUTTON + || gPlayer1Controller->buttonPressed & START_BUTTON) #endif { - u8 maxIndex = PAUSE_EXIT_MODE == PAUSE_EXIT_BOTH ? 4 : 3; bool allowExit = true; - bool pauseExit = gDialogLineNum > 1 && gDialogLineNum < maxIndex; - bool usedExitToCastle = (PAUSE_EXIT_MODE & 1) ? gDialogLineNum == 3 : gDialogLineNum == 2; - if (pauseExit) { - smlua_call_event_hooks(HOOK_ON_PAUSE_EXIT, usedExitToCastle, &allowExit); + if (gDialogLineNum == 2 || gDialogLineNum == 3) { + smlua_call_event_hooks(HOOK_ON_PAUSE_EXIT, gDialogLineNum == 3, &allowExit); } if (allowExit) { level_set_transition(0, NULL); @@ -3007,9 +3004,13 @@ s16 render_pause_courses_and_castle(void) { gDialogBoxState = DIALOG_STATE_OPENING; gMenuMode = -1; - if (pauseExit) { - return usedExitToCastle ? MENU_OPT_EXIT_TO_CASTLE : MENU_OPT_EXIT_COURSE; - } else { return MENU_OPT_DEFAULT; } + if (gDialogLineNum == 2 || gDialogLineNum == 3) { + num = gDialogLineNum; + } else { + num = 1; + } + + return num; } else { play_sound(SOUND_MENU_CAMERA_BUZZ | (0xFF << 8), gGlobalSoundSource); } @@ -3059,7 +3060,7 @@ s16 render_pause_courses_and_castle(void) { network_mod_dev_mode_reload(); } - return MENU_OPT_NONE; + return 0; } #if defined(VERSION_JP) @@ -3171,8 +3172,8 @@ void print_hud_course_complete_coins(s16 x, s16 y) { void play_star_fanfare_and_flash_hud(s32 arg, u8 starNum) { if (gHudDisplay.coins == gCourseCompleteCoins && (gCurrCourseStarFlags & starNum) == 0 && gHudFlash == 0) { gCurrCourseStarFlags |= starNum; // SM74 was spamming fanfare without this line - if (gFanfareDebounce <= 0) { - gFanfareDebounce = 30 * 5; + if (gFanFareDebounce <= 0) { + gFanFareDebounce = 30 * 5; play_star_fanfare(); } gHudFlash = arg; @@ -3287,11 +3288,13 @@ void render_course_complete_lvl_info_and_hud_str(void) { #endif #if defined(VERSION_JP) || defined(VERSION_SH) #define TXT_SAVECONT_Y 2 -//#define TXT_SAVEQUIT_Y 18 // 38 +//#define TXT_SAVEQUIT_Y 18 +//#define TXT_SAVE_EXIT_GAME_Y 38 #define TXT_CONTNOSAVE_Y 18 #else #define TXT_SAVECONT_Y 0 -//#define TXT_SAVEQUIT_Y 20 // 40 +//#define TXT_SAVEQUIT_Y 20 +//#define TXT_SAVE_EXIT_GAME_Y 40 #define TXT_CONTNOSAVE_Y 20 #endif @@ -3314,6 +3317,13 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e) { TEXT_SAVE_AND_QUIT_FR }, { TEXT_SAVE_AND_QUIT_DE } }; + + u8 textSaveExitGame[][30] = { // New function to exit game + { TEXT_SAVE_EXIT_GAME }, + { TEXT_SAVE_EXIT_GAME_FR }, + { TEXT_SAVE_EXIT_GAME_DE } + }; + u8 textContinueWithoutSaveArr[][30] = { { TEXT_CONTINUE_WITHOUT_SAVING }, { TEXT_CONTINUE_WITHOUT_SAVING_FR }, @@ -3322,11 +3332,13 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e) #define textSaveAndContinue textSaveAndContinueArr[gInGameLanguage] #define textSaveAndQuit textSaveAndQuitArr[gInGameLanguage] +#define textSaveExitGame textSaveExitGame[gInGameLanguage] #define textContinueWithoutSave textContinueWithoutSaveArr[gInGameLanguage] s16 xOffset = get_str_x_pos_from_center(160, textContinueWithoutSaveArr[gInGameLanguage], 12.0f); #else INGAME_TEXT_COPY(textSaveAndContinue, TEXT_SAVE_AND_CONTINUE); //u8 textSaveAndQuit[] = { TEXT_SAVE_AND_QUIT }; + //u8 textSaveExitGame[] = { TEXT_SAVE_EXIT_GAME }; INGAME_TEXT_COPY(textContinueWithoutSave, TEXT_CONTINUE_WITHOUT_SAVING); #endif @@ -3337,6 +3349,7 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e) print_generic_string(TXT_SAVEOPTIONS_X, y + TXT_SAVECONT_Y, textSaveAndContinue); //print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_SAVEQUIT_Y, textSaveAndQuit); + //print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_SAVE_EXIT_GAME_Y, textSaveExitGame); print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_CONTNOSAVE_Y, textContinueWithoutSave); gSPDisplayList(gDisplayListHead++, dl_ia_text_end); @@ -3401,11 +3414,11 @@ s16 render_course_complete_screen(void) { gCourseDoneMenuTimer++; - return MENU_OPT_NONE; + return 0; } s16 render_menus_and_dialogs(void) { - s16 mode = MENU_OPT_NONE; + s16 mode = 0; create_dl_ortho_matrix(); diff --git a/src/game/interaction.c b/src/game/interaction.c index e4873b44d..fb6d9a2c1 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -815,7 +815,7 @@ u32 should_push_or_pull_door(struct MarioState *m, struct Object *o) { s16 dYaw = o->oMoveAngleYaw - atan2s(dz, dx); - return (dYaw >= -0x4000 && dYaw <= 0x4000) ? WARP_FLAG_DOOR_PULLED : WARP_FLAG_DOOR_FLIP_MARIO; + return (dYaw >= -0x4000 && dYaw <= 0x4000) ? 0x00000001 : 0x00000002; } u32 take_damage_from_interact_object(struct MarioState *m) { @@ -1152,10 +1152,10 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj } if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) { - actionArg = should_push_or_pull_door(m, o) + WARP_FLAG_DOOR_IS_WARP; + actionArg = should_push_or_pull_door(m, o) + 0x00000004; if (doorAction == 0) { - if (actionArg & WARP_FLAG_DOOR_PULLED) { + if (actionArg & 0x00000001) { doorAction = ACT_PULLING_DOOR; } else { doorAction = ACT_PUSHING_DOOR; @@ -1229,7 +1229,7 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object * u32 enterDoorAction; u32 doorSaveFileFlag; - if (actionArg & WARP_FLAG_DOOR_PULLED) { + if (actionArg & 0x00000001) { enterDoorAction = ACT_PULLING_DOOR; } else { enterDoorAction = ACT_PUSHING_DOOR; diff --git a/src/game/level_update.c b/src/game/level_update.c index 08853b343..cecf83cfc 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -57,7 +57,9 @@ #define MENU_LEVEL_MIN 0 #define MENU_LEVEL_MAX 17 -u16 gFanfareDebounce = 0; +struct SavedWarpValues gReceiveWarp = { 0 }; +extern s8 sReceivedLoadedActNum; +u16 gFanFareDebounce = 0; s16 gChangeLevel = -1; s16 gChangeLevelTransition = -1; @@ -185,10 +187,11 @@ struct CreditsEntry sCreditsSequence[] = { struct MarioState gMarioStates[MAX_PLAYERS] = { 0 }; struct HudDisplay gHudDisplay; s16 sCurrPlayMode; +u16 D_80339ECA; s16 sTransitionTimer; void (*sTransitionUpdate)(s16 *); struct WarpDest sWarpDest; -s16 sSpecialWarpDest; +s16 D_80339EE0; s16 sDelayedWarpOp; s16 sDelayedWarpTimer; s16 sSourceWarpNodeId; @@ -200,7 +203,10 @@ s8 sTimerRunning; bool gNeverEnteredCastle; struct MarioState *gMarioState = &gMarioStates[0]; +u8 unused1[4] = { 0 }; s8 sWarpCheckpointActive = FALSE; +u8 unused3[4]; +u8 unused4[2]; u32 gControlTimerStartNat = 0; u32 gControlTimerStopNat = 0; @@ -265,19 +271,21 @@ bool pressed_pause(void) { void set_play_mode(s16 playMode) { sCurrPlayMode = playMode; + D_80339ECA = 0; } -void warp_special(enum SpecialWarpDestinations arg) { - if (arg > 0 || arg < -9 || (arg < -3 && arg > -7)) { - LOG_ERROR("Invalid parameter value for warp_special: %i", arg); +void warp_special(s32 arg) { + if (arg != 0 && arg != SPECIAL_WARP_CAKE && arg != SPECIAL_WARP_GODDARD && arg != SPECIAL_WARP_GODDARD_GAMEOVER && arg != SPECIAL_WARP_TITLE && arg != SPECIAL_WARP_LEVEL_SELECT) { + LOG_ERROR("Invalid parameter value for warp_special: Expected 0, SPECIAL_WARP_CAKE, SPECIAL_WARP_GODDARD, SPECIAL_WARP_GODDARD_GAMEOVER, SPECIAL_WARP_TITLE, or SPECIAL_WARP_LEVEL_SELECT"); return; } sCurrPlayMode = PLAY_MODE_CHANGE_LEVEL; - sSpecialWarpDest = arg; + D_80339ECA = 0; + D_80339EE0 = arg; } -void fade_into_special_warp(enum SpecialWarpDestinations arg, u32 color) { +void fade_into_special_warp(u32 arg, u32 color) { if (color != 0) { color = 0xFF; } @@ -760,13 +768,13 @@ s16 music_changed_through_warp(s16 arg) { /** * Set the current warp type and destination level/area/node. */ -void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags) { +void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg) { struct WarpDest warpDestOverride = { .levelNum = destLevel, .areaIdx = destArea, .nodeId = destWarpNode, }; - if (smlua_call_event_hooks(HOOK_BEFORE_WARP, destLevel, destArea, destWarpNode, warpFlags, &warpDestOverride)) { + if (smlua_call_event_hooks(HOOK_BEFORE_WARP, destLevel, destArea, destWarpNode, arg, &warpDestOverride)) { destLevel = warpDestOverride.levelNum; destArea = warpDestOverride.areaIdx; destWarpNode = warpDestOverride.nodeId; @@ -774,9 +782,9 @@ void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags) if (destWarpNode >= WARP_NODE_CREDITS_MIN) { sWarpDest.type = WARP_TYPE_CHANGE_LEVEL; - } else if (warpFlags == WARP_FLAG_EXIT_COURSE) { + } else if (arg == WARP_ARG_EXIT_COURSE) { sWarpDest.type = WARP_TYPE_CHANGE_LEVEL; - warpFlags = 0; + arg = 0; } else if (destLevel != gCurrLevelNum) { sWarpDest.type = WARP_TYPE_CHANGE_LEVEL; } else if (destArea != gCurrentArea->index) { @@ -788,7 +796,7 @@ void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags) sWarpDest.levelNum = destLevel; sWarpDest.areaIdx = destArea; sWarpDest.nodeId = destWarpNode; - sWarpDest.arg = warpFlags; + sWarpDest.arg = arg; } /** @@ -818,7 +826,7 @@ static void initiate_painting_warp_node(struct WarpNode *pWarpNode) { sWarpCheckpointActive = check_warp_checkpoint(&warpNode); } - initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, WARP_FLAGS_NONE); + initiate_warp(warpNode.destLevel & 0x7F, warpNode.destArea, warpNode.destNode, 0); check_if_should_set_warp_checkpoint(&warpNode); extern s16 gMenuMode; @@ -887,23 +895,23 @@ void verify_warp(struct MarioState *m, bool killMario) { * based on the warp operation and sometimes Mario's used object. * Return the time left until the delayed warp is initiated. */ -s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { +s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { // only allow for local player if (m != &gMarioStates[0]) { return 0; } - s32 fadeMusic = TRUE; + s32 val04 = TRUE; if (sDelayedWarpOp == WARP_OP_NONE) { m->invincTimer = -1; - sDelayedWarpArg = WARP_FLAGS_NONE; + sDelayedWarpArg = 0; sDelayedWarpOp = warpOp; switch (warpOp) { case WARP_OP_DEMO_NEXT: case WARP_OP_DEMO_END: sDelayedWarpTimer = 20; // Must be one line to match on -O2 - fadeMusic = FALSE; + val04 = FALSE; if (!gDjuiInMainMenu) { - sSourceWarpNodeId = WARP_NODE_DEFAULT; + sSourceWarpNodeId = WARP_NODE_F0; gSavedCourseNum = COURSE_NONE; play_transition(WARP_TRANSITION_FADE_INTO_STAR, 0x14, 0x00, 0x00, 0x00); } else { @@ -913,16 +921,16 @@ s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { case WARP_OP_CREDITS_END: sDelayedWarpTimer = 60; - sSourceWarpNodeId = WARP_NODE_DEFAULT; + sSourceWarpNodeId = WARP_NODE_F0; verify_warp(m, false); - fadeMusic = FALSE; + val04 = FALSE; gSavedCourseNum = COURSE_NONE; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x3C, 0x00, 0x00, 0x00); break; case WARP_OP_STAR_EXIT: sDelayedWarpTimer = 32; - sSourceWarpNodeId = WARP_NODE_DEFAULT; + sSourceWarpNodeId = WARP_NODE_F0; verify_warp(m, false); gSavedCourseNum = COURSE_NONE; play_transition(WARP_TRANSITION_FADE_INTO_MARIO, 0x20, 0x00, 0x00, 0x00); @@ -941,7 +949,7 @@ s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { case WARP_OP_EXIT: sSourceWarpNodeId = WARP_NODE_DEATH; sDelayedWarpTimer = 20; - sDelayedWarpArg = WARP_FLAG_EXIT_COURSE; + sDelayedWarpArg = WARP_ARG_EXIT_COURSE; play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00); break; @@ -954,7 +962,7 @@ s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { case WARP_OP_LOOK_UP: // enter totwc sDelayedWarpTimer = 30; - sSourceWarpNodeId = WARP_NODE_LOOK_UP; + sSourceWarpNodeId = WARP_NODE_F2; verify_warp(m, false); play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x1E, 0xFF, 0xFF, 0xFF); #ifndef VERSION_JP @@ -975,7 +983,7 @@ s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { sDelayedWarpTimer = 20; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; verify_warp(m, false); - fadeMusic = !music_changed_through_warp(sSourceWarpNodeId); + val04 = !music_changed_through_warp(sSourceWarpNodeId); play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x14, 0xFF, 0xFF, 0xFF); break; @@ -985,7 +993,7 @@ s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { sDelayedWarpArg = m->actionArg; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; verify_warp(m, false); - fadeMusic = !music_changed_through_warp(sSourceWarpNodeId); + val04 = !music_changed_through_warp(sSourceWarpNodeId); play_transition(WARP_TRANSITION_FADE_INTO_CIRCLE, 0x14, 0x00, 0x00, 0x00); break; @@ -994,7 +1002,7 @@ s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { sDelayedWarpTimer = 20; sSourceWarpNodeId = (m->usedObj->oBehParams & 0x00FF0000) >> 16; verify_warp(m, false); - fadeMusic = !music_changed_through_warp(sSourceWarpNodeId); + val04 = !music_changed_through_warp(sSourceWarpNodeId); play_transition(WARP_TRANSITION_FADE_INTO_STAR, 0x14, 0x00, 0x00, 0x00); break; @@ -1012,11 +1020,11 @@ s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp) { sDelayedWarpTimer = 20; play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x14, 0x00, 0x00, 0x00); } - fadeMusic = FALSE; + val04 = FALSE; break; } - if (fadeMusic && gCurrDemoInput == NULL) { + if (val04 && gCurrDemoInput == NULL) { fadeout_music((3 * sDelayedWarpTimer / 2) * 8 - 2); } } @@ -1035,12 +1043,12 @@ void initiate_delayed_warp(void) { reset_dialog_render_state(); if (gDebugLevelSelect && (sDelayedWarpOp & WARP_OP_TRIGGERS_LEVEL_SELECT)) { - warp_special(WARP_SPECIAL_LEVEL_SELECT); + warp_special(SPECIAL_WARP_LEVEL_SELECT); } else if (gCurrDemoInput != NULL) { if (sDelayedWarpOp == WARP_OP_DEMO_END) { - warp_special(WARP_SPECIAL_INTRO_SPLASH_SCREEN); + warp_special(SPECIAL_WARP_TITLE); } else { - warp_special(WARP_SPECIAL_MARIO_HEAD_REGULAR); + warp_special(SPECIAL_WARP_GODDARD); } } else { switch (sDelayedWarpOp) { @@ -1051,14 +1059,14 @@ void initiate_delayed_warp(void) { break; case WARP_OP_CREDITS_END: - warp_special(WARP_SPECIAL_ENDING); + warp_special(SPECIAL_WARP_CAKE); sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL & ~SOUND_BANKS_DISABLED_AFTER_CREDITS); break; case WARP_OP_DEMO_NEXT: if (!gDjuiInMainMenu) { - warp_special(WARP_SPECIAL_MARIO_HEAD_REGULAR); + warp_special(SPECIAL_WARP_GODDARD); } break; @@ -1072,7 +1080,7 @@ void initiate_delayed_warp(void) { gCurrActStarNum = 99; gCurrActNum = 99; initiate_warp(gCurrCreditsEntry->levelNum, gCurrCreditsEntry->areaIndex, - WARP_NODE_CREDITS_START, WARP_FLAGS_NONE); + WARP_NODE_CREDITS_START, 0); } break; @@ -1085,7 +1093,7 @@ void initiate_delayed_warp(void) { if ((gCurrCreditsEntry != NULL) && (gCurrCreditsEntry->levelNum == gLevelValues.skipCreditsAt)) { lvl_skip_credits(); } else if (gCurrCreditsEntry != NULL) { - gCurrActNum = gCurrCreditsEntry->actNum & 0x07; + gCurrActNum = gCurrCreditsEntry->unk02 & 0x07; if (gCurrCreditsEntry->levelNum == LEVEL_CASTLE_GROUNDS && gDjuiInMainMenu) { gCurrCreditsEntry = &sCreditsSequence[1]; destWarpNode = WARP_NODE_CREDITS_NEXT; @@ -1096,7 +1104,7 @@ void initiate_delayed_warp(void) { } initiate_warp(gCurrCreditsEntry->levelNum, gCurrCreditsEntry->areaIndex, - destWarpNode, WARP_FLAGS_NONE); + destWarpNode, 0); } break; @@ -1329,31 +1337,39 @@ s32 play_mode_normal(void) { // If either initiate_painting_warp or initiate_delayed_warp initiated a // warp, change play mode accordingly. if (sCurrPlayMode == PLAY_MODE_NORMAL || sCurrPlayMode == PLAY_MODE_PAUSED) { - if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) { - set_play_mode(PLAY_MODE_CHANGE_LEVEL); - } else if (sTransitionTimer != 0) { - set_play_mode(PLAY_MODE_CHANGE_AREA); - } else if ( - (gCurrCreditsEntry == NULL || gCurrCreditsEntry == &sCreditsSequence[0]) && - (sCurrPlayMode == PLAY_MODE_NORMAL && pressed_pause())) { - lower_background_noise(1); - cancel_rumble(); - gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN; - set_play_mode(PLAY_MODE_PAUSED); + if (gCurrCreditsEntry != NULL && gCurrCreditsEntry != &sCreditsSequence[0]) { + // special case for credit warps + if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) { + set_play_mode(PLAY_MODE_CHANGE_LEVEL); + } else if (sTransitionTimer != 0) { + set_play_mode(PLAY_MODE_CHANGE_AREA); + } + } else if (!gReceiveWarp.received) { + if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) { + set_play_mode(PLAY_MODE_CHANGE_LEVEL); + } else if (sTransitionTimer != 0) { + set_play_mode(PLAY_MODE_CHANGE_AREA); + } else if (sCurrPlayMode == PLAY_MODE_NORMAL && pressed_pause()) { + lower_background_noise(1); + cancel_rumble(); + gCameraMovementFlags |= CAM_MOVE_PAUSE_SCREEN; + set_play_mode(PLAY_MODE_PAUSED); + } } } + return 0; } s32 play_mode_paused(void) { - if (gMenuOptSelectIndex == MENU_OPT_NONE) { + if (gPauseScreenMode == 0) { set_menu_mode(RENDER_PAUSE_SCREEN); - } else if (gMenuOptSelectIndex == MENU_OPT_DEFAULT) { + } else if (gPauseScreenMode == 1) { raise_background_noise(1); gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN; set_play_mode(PLAY_MODE_NORMAL); - } else if (gMenuOptSelectIndex == MENU_OPT_EXIT_COURSE) { + } else if (gPauseScreenMode == 2) { extern s16 gPrevMenuMode; if (gPrevMenuMode > 1) { // Course complete screen raise_background_noise(1); @@ -1362,17 +1378,22 @@ s32 play_mode_paused(void) { level_trigger_warp(&gMarioStates[0], WARP_OP_EXIT); } set_play_mode(PLAY_MODE_NORMAL); - } else if (gMenuOptSelectIndex == MENU_OPT_EXIT_TO_CASTLE) { + } else if (gPauseScreenMode == 3) { // Exit level if (gDebugLevelSelect) { - fade_into_special_warp(WARP_SPECIAL_LEVEL_SELECT, 1); + fade_into_special_warp(-9, 1); } else { - initiate_warp(gLevelValues.exitCastleLevel, gLevelValues.exitCastleArea, gLevelValues.exitCastleWarpNode, WARP_FLAG_EXIT_COURSE); - fade_into_special_warp(WARP_SPECIAL_NONE, 0); + initiate_warp(gLevelValues.exitCastleLevel, gLevelValues.exitCastleArea, gLevelValues.exitCastleWarpNode, WARP_ARG_EXIT_COURSE); + fade_into_special_warp(0, 0); gSavedCourseNum = COURSE_NONE; } set_play_mode(PLAY_MODE_CHANGE_LEVEL); - } + } /* else if (gPauseScreenMode == 4) { + // We should only be getting "int 4" to here + initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0); + fade_into_special_warp(0, 0); + game_exit(); + }*/ if (!gLevelValues.zoomOutCameraOnPause || !network_check_singleplayer_pause()) { gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN; @@ -1461,7 +1482,7 @@ s32 play_mode_change_level(void) { if (sWarpDest.type != WARP_TYPE_NOT_WARPING) { return sWarpDest.levelNum; } else { - return sSpecialWarpDest; + return D_80339EE0; } } @@ -1478,7 +1499,7 @@ UNUSED static s32 play_mode_unused(void) { if (sWarpDest.type != WARP_TYPE_NOT_WARPING) { return sWarpDest.levelNum; } else { - return sSpecialWarpDest; + return D_80339EE0; } } @@ -1724,7 +1745,7 @@ s32 update_level(void) { } sCancelNextActSelector = gDjuiInMainMenu; - if (gFanfareDebounce > 0) { gFanfareDebounce--; } + if (gFanFareDebounce > 0) { gFanFareDebounce--; } s32 changeLevel = 0; @@ -1772,7 +1793,7 @@ s32 init_level(void) { sDelayedWarpOp = WARP_OP_NONE; sTransitionTimer = 0; - sSpecialWarpDest = 0; + D_80339EE0 = 0; for (int i = 0; i < 8; i++) { gSpawnedStarDefault[i] = 0; diff --git a/src/game/level_update.h b/src/game/level_update.h index ce62bc733..704924a01 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -7,51 +7,36 @@ #include "pc/djui/djui.h" -enum TimerControl { - TIMER_CONTROL_SHOW, - TIMER_CONTROL_START, - TIMER_CONTROL_STOP, - TIMER_CONTROL_HIDE -}; +#define TIMER_CONTROL_SHOW 0 +#define TIMER_CONTROL_START 1 +#define TIMER_CONTROL_STOP 2 +#define TIMER_CONTROL_HIDE 3 -enum WarpOperation { - WARP_OP_NONE, - WARP_OP_LOOK_UP, - WARP_OP_SPIN_SHRINK, - WARP_OP_WARP_DOOR, - WARP_OP_WARP_OBJECT, - WARP_OP_TELEPORT, - WARP_OP_TRIGGERS_LEVEL_SELECT = 0x10, - WARP_OP_STAR_EXIT, - WARP_OP_DEATH, - WARP_OP_WARP_FLOOR, - WARP_OP_GAME_OVER, - WARP_OP_CREDITS_END, - WARP_OP_DEMO_NEXT, - WARP_OP_CREDITS_START, - WARP_OP_CREDITS_NEXT, - WARP_OP_DEMO_END, - WARP_OP_FORCE_SYNC, - WARP_OP_EXIT -}; +#define WARP_OP_NONE 0x00 +#define WARP_OP_LOOK_UP 0x01 +#define WARP_OP_SPIN_SHRINK 0x02 +#define WARP_OP_WARP_DOOR 0x03 +#define WARP_OP_WARP_OBJECT 0x04 +#define WARP_OP_TELEPORT 0x05 +#define WARP_OP_STAR_EXIT 0x11 +#define WARP_OP_DEATH 0x12 +#define WARP_OP_WARP_FLOOR 0x13 +#define WARP_OP_GAME_OVER 0x14 +#define WARP_OP_CREDITS_END 0x15 +#define WARP_OP_DEMO_NEXT 0x16 +#define WARP_OP_CREDITS_START 0x17 +#define WARP_OP_CREDITS_NEXT 0x18 +#define WARP_OP_DEMO_END 0x19 +#define WARP_OP_FORCE_SYNC 0x20 +#define WARP_OP_EXIT 0x21 -enum SpecialWarpDestinations { - WARP_SPECIAL_LEVEL_SELECT = -9, - WARP_SPECIAL_INTRO_SPLASH_SCREEN = -8, - WARP_SPECIAL_SWITCH_FILE = -7, - WARP_SPECIAL_MARIO_HEAD_DIZZY = -3, - WARP_SPECIAL_MARIO_HEAD_REGULAR = -2, - WARP_SPECIAL_ENDING = -1, - WARP_SPECIAL_NONE = 0, -}; +#define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10 -enum WarpFlags { - WARP_FLAGS_NONE = (0 << 0), - WARP_FLAG_DOOR_PULLED = (1 << 0), - WARP_FLAG_DOOR_FLIP_MARIO = (1 << 1), - WARP_FLAG_DOOR_IS_WARP = (1 << 2), - WARP_FLAG_EXIT_COURSE = (1 << 3), -}; +#define SPECIAL_WARP_CAKE -1 +#define SPECIAL_WARP_GODDARD -2 +#define SPECIAL_WARP_GODDARD_GAMEOVER -3 +#define SPECIAL_WARP_TITLE -8 +#define SPECIAL_WARP_LEVEL_SELECT -9 enum MarioSpawnType { MARIO_SPAWN_NONE, @@ -77,24 +62,25 @@ enum MarioSpawnType { MARIO_SPAWN_FADE_FROM_BLACK }; -enum WarpNodes { - WARP_NODE_MAIN_ENTRY = 0x0A, - WARP_NODE_DEFAULT = 0xF0, - WARP_NODE_DEATH = 0xF1, - WARP_NODE_LOOK_UP = 0xF2, - WARP_NODE_WARP_FLOOR = 0xF3, - WARP_NODE_CREDITS_MIN = 0xF8, - WARP_NODE_CREDITS_START = 0xF8, - WARP_NODE_CREDITS_NEXT = 0xF9, - WARP_NODE_CREDITS_END = 0xFA -}; +#define MARIO_SPAWN_UNKNOWN_02 0x02 +#define MARIO_SPAWN_UNKNOWN_03 0x03 +#define MARIO_SPAWN_UNKNOWN_27 0x27 -enum WarpTypes { - WARP_TYPE_NOT_WARPING, - WARP_TYPE_CHANGE_LEVEL, - WARP_TYPE_CHANGE_AREA, - WARP_TYPE_SAME_AREA -}; +#define WARP_NODE_F0 0xF0 +#define WARP_NODE_DEATH 0xF1 +#define WARP_NODE_F2 0xF2 +#define WARP_NODE_WARP_FLOOR 0xF3 +#define WARP_NODE_CREDITS_START 0xF8 +#define WARP_NODE_CREDITS_NEXT 0xF9 +#define WARP_NODE_CREDITS_END 0xFA +#define WARP_NODE_CREDITS_MIN 0xF8 + +#define WARP_TYPE_NOT_WARPING 0 +#define WARP_TYPE_CHANGE_LEVEL 1 +#define WARP_TYPE_CHANGE_AREA 2 +#define WARP_TYPE_SAME_AREA 3 + +#define WARP_ARG_EXIT_COURSE -1 #define PRESS_START_DEMO_TIMER 800 @@ -107,10 +93,10 @@ struct CreditsEntry { /*0x00*/ u8 levelNum; /*0x01*/ u8 areaIndex; - /*0x02*/ u8 actNum; + /*0x02*/ u8 unk02; /*0x03*/ s8 marioAngle; /*0x04*/ Vec3s marioPos; - /*0x0C*/ const char **string; + /*0x0C*/ const char **unk0C; }; extern struct CreditsEntry *gCurrCreditsEntry; @@ -119,8 +105,10 @@ extern struct MarioState gMarioStates[]; extern struct MarioState *gMarioState; extern s16 sCurrPlayMode; +extern u16 D_80339ECA; extern s16 sTransitionTimer; extern void (*sTransitionUpdate)(s16 *); +extern u8 unused3[4]; extern s16 gChangeLevel; extern s16 gChangeActNum; @@ -134,15 +122,25 @@ struct WarpDest { u32 arg; }; +struct SavedWarpValues { + u8 received; + struct WarpDest warpDest; + s8 inWarpCheckpoint; + s16 ttcSpeedSetting; + s16 D_80339EE0; + f32 paintingMarioYEntry; +}; + extern struct WarpDest sWarpDest; extern s8 sWarpCheckpointActive; -extern u16 gFanfareDebounce; +extern u16 gFanFareDebounce; -extern s16 sSpecialWarpDest; +extern s16 D_80339EE0; extern s16 sDelayedWarpOp; extern s16 sDelayedWarpTimer; extern s16 sSourceWarpNodeId; extern s32 sDelayedWarpArg; +extern u8 unused4[2]; extern s8 sTimerRunning; struct HudDisplay { @@ -183,7 +181,7 @@ u16 level_control_timer(s32 timerOp); /* |description|Checks if the start button has been pressed as well as some other conditions for opening the pause menu depending on if pause anywhere is enabled|descriptionEnd|*/ bool pressed_pause(void); /* |description|Fades into a special warp with `arg` and using `color`|descriptionEnd| */ -void fade_into_special_warp(enum SpecialWarpDestinations arg, u32 color); +void fade_into_special_warp(u32 arg, u32 color); void load_level_init_text(u32 arg); void warp_credits(void); /* |description|Gets an instant warp from the current area's instant warp array (0-3)|descriptionEnd| */ @@ -193,13 +191,13 @@ struct WarpNode *get_painting_warp_node(void); /* |description|Initiates a painting warp of `paintingIndex`|descriptionEnd| */ void initiate_painting_warp(s16 paintingIndex); /* |description|Triggers a warp (WARP_OP_*) for the level. Pass in `gMarioStates[0]` for `m`|descriptionEnd| */ -s16 level_trigger_warp(struct MarioState *m, enum WarpOperation warpOp); +s16 level_trigger_warp(struct MarioState *m, s32 warpOp); void level_set_transition(s16 length, void (*updateFunction)(s16 *)); void set_play_mode(s16 playMode); -/* |description|Special warps to arg (`WARP_SPECIAL_*`)|descriptionEnd| */ -void warp_special(enum SpecialWarpDestinations arg); -/* |description|Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `warpFlags`. This function is unstable and it's generally recommended to use `warp_to_level` instead|descriptionEnd| */ -void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 warpFlags); +/* |description|Special warps to arg (`SPECIAL_WARP_*`)|descriptionEnd| */ +void warp_special(s32 arg); +/* |description|Initiates a warp to `destLevel` in `destArea` at `destWarpNode` with `arg`. This function is unstable and it's generally recommended to use `warp_to_level` instead|descriptionEnd| */ +void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg); s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused); s32 lvl_init_from_save_file(UNUSED s16 arg0, s16 levelNum); diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 33aae1544..233d122de 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -37,6 +37,9 @@ #include "pc/lua/smlua.h" #include "pc/lua/smlua_hooks.h" +// TODO: put this elsewhere +enum SaveOption { SAVE_OPT_SAVE_AND_CONTINUE = 1, /*SAVE_OPT_SAVE_AND_QUIT, SAVE_OPT_SAVE_EXIT_GAME,*/ SAVE_OPT_CONTINUE_DONT_SAVE }; + static struct Object* sIntroWarpPipeObj[MAX_PLAYERS] = { 0 }; static struct Object *sEndPeachObj; static struct Object *sEndRightToadObj; @@ -130,11 +133,11 @@ void print_displaying_credits_entry(void) { #endif if (sDispCreditsEntry != NULL) { - currStrPtr = (char **) sDispCreditsEntry->string; + currStrPtr = (char **) sDispCreditsEntry->unk0C; titleStr = *currStrPtr++; numLines = *titleStr++ - '0'; - strY = (sDispCreditsEntry->actNum & 0x20 ? 28 : 172) + (numLines == 1) * 16; + strY = (sDispCreditsEntry->unk02 & 0x20 ? 28 : 172) + (numLines == 1) * 16; #ifndef VERSION_JP lineHeight = 16; #endif @@ -285,16 +288,20 @@ void handle_save_menu(struct MarioState *m) { // wait for the menu to show up if (is_anim_past_end(m) && gSaveOptSelectIndex != 0) { // save and continue / save and quit - if (gSaveOptSelectIndex == MENU_OPT_SAVE_AND_CONTINUE /*|| gSaveOptSelectIndex == MENU_OPT_SAVE_AND_QUIT*/) { + if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_CONTINUE /*|| gSaveOptSelectIndex == SAVE_OPT_SAVE_EXIT_GAME || gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT*/) { save_file_do_save(gCurrSaveFileNum - 1, FALSE); /*if (gSaveOptSelectIndex == SAVE_OPT_SAVE_AND_QUIT) { - fade_into_special_warp(WARP_SPECIAL_MARIO_HEAD_REGULAR, 0); // reset game + fade_into_special_warp(-2, 0); // reset game + } else if (gSaveOptSelectIndex == SAVE_OPT_SAVE_EXIT_GAME) { + //initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0); + fade_into_special_warp(0, 0); + game_exit(); }*/ } // not quitting - //if (gSaveOptSelectIndex != SAVE_OPT_SAVE_AND_QUIT) { + //if (gSaveOptSelectIndex != SAVE_OPT_SAVE_EXIT_GAME) { disable_time_stop(); m->faceAngle[1] += 0x8000; // figure out what dialog to show, if we should @@ -969,7 +976,7 @@ s32 act_unlocking_key_door(struct MarioState *m) { m->pos[2] = m->usedObj->oPosZ + sins(m->faceAngle[1]) * 75.0f; } - if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { + if (m->actionArg & 2) { m->faceAngle[1] += 0x8000; } @@ -1013,7 +1020,7 @@ s32 act_unlocking_star_door(struct MarioState *m) { if (m->usedObj != NULL) { m->faceAngle[1] = m->usedObj->oMoveAngleYaw; } - if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { + if (m->actionArg & 2) { m->faceAngle[1] += 0x8000; } m->marioObj->oMarioReadingSignDPosX = m->pos[0]; @@ -1070,7 +1077,7 @@ s32 act_entering_star_door(struct MarioState *m) { // ~30 degrees / 1/12 rot if (m->usedObj != NULL) { targetAngle = m->usedObj->oMoveAngleYaw + 0x1555; } - if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { + if (m->actionArg & 2) { targetAngle += 0x5556; // ~120 degrees / 1/3 rot (total 150d / 5/12) } @@ -1101,7 +1108,7 @@ s32 act_entering_star_door(struct MarioState *m) { m->faceAngle[1] = m->usedObj->oMoveAngleYaw; } - if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { + if (m->actionArg & 2) { m->faceAngle[1] += 0x8000; } @@ -1123,7 +1130,7 @@ s32 act_entering_star_door(struct MarioState *m) { s32 act_going_through_door(struct MarioState *m) { if (!m) { return 0; } if (m->actionTimer == 0) { - if (m->actionArg & WARP_FLAG_DOOR_PULLED) { + if (m->actionArg & 1) { if (m->interactObj != NULL) { m->interactObj->oInteractStatus = 0x00010000; } @@ -1144,12 +1151,12 @@ s32 act_going_through_door(struct MarioState *m) { update_mario_pos_for_anim(m); stop_and_set_height_to_floor(m); - if (m->actionArg & WARP_FLAG_DOOR_IS_WARP) { + if (m->actionArg & 4) { if (m->actionTimer == 16) { level_trigger_warp(m, WARP_OP_WARP_DOOR); } } else if (is_anim_at_end(m)) { - if (m->actionArg & WARP_FLAG_DOOR_FLIP_MARIO) { + if (m->actionArg & 2) { m->faceAngle[1] += 0x8000; } set_mario_action(m, ACT_IDLE, 0); @@ -1177,7 +1184,7 @@ s32 act_warp_door_spawn(struct MarioState *m) { if (m->actionState == 0) { m->actionState = 1; if (m->usedObj != NULL) { - if (m->actionArg & WARP_FLAG_DOOR_PULLED) { + if (m->actionArg & 1) { m->usedObj->oInteractStatus = 0x00040000; } else { m->usedObj->oInteractStatus = 0x00080000; @@ -1423,7 +1430,7 @@ s32 act_exit_land_save_dialog(struct MarioState *m) { } static void lose_life_after_death_exit(struct MarioState *m) { - if (~sDelayedWarpArg & WARP_FLAG_EXIT_COURSE) { + if (sDelayedWarpArg != WARP_ARG_EXIT_COURSE) { m->numLives--; } } @@ -3041,8 +3048,8 @@ static s32 act_credits_cutscene(struct MarioState *m) { sEndCutsceneVp.vp.vscale[0] = 640 - width; sEndCutsceneVp.vp.vscale[1] = 480 - height; - sEndCutsceneVp.vp.vtrans[0] = (gCurrCreditsEntry->actNum & 0x10 ? width : -width) * 56 / 100 + 640; - sEndCutsceneVp.vp.vtrans[1] = (gCurrCreditsEntry->actNum & 0x20 ? height : -height) * 66 / 100 + 480; + sEndCutsceneVp.vp.vtrans[0] = (gCurrCreditsEntry->unk02 & 0x10 ? width : -width) * 56 / 100 + 640; + sEndCutsceneVp.vp.vtrans[1] = (gCurrCreditsEntry->unk02 & 0x20 ? height : -height) * 66 / 100 + 480; override_viewport_and_clip(&sEndCutsceneVp, 0, 0, 0, 0); } @@ -3062,7 +3069,7 @@ static s32 act_credits_cutscene(struct MarioState *m) { level_trigger_warp(m, WARP_OP_CREDITS_NEXT); } - m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->actNum & 0xC0) << 8; + m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->unk02 & 0xC0) << 8; } return FALSE; diff --git a/src/menu/ingame_text.h b/src/menu/ingame_text.h index 085ac7240..23bb8fd01 100644 --- a/src/menu/ingame_text.h +++ b/src/menu/ingame_text.h @@ -56,7 +56,7 @@ memcpy(_var, g ## _text, _text ## _LENGTH) #define TEXT_MYSCORE_LENGTH 8 #define TEXT_CONTINUE_LENGTH 9 #define TEXT_EXIT_COURSE_LENGTH 12 -#define TEXT_EXIT_TO_CASTLE 0xe, 0x21, 0x12, 0x1d, 0x9e, 0x1d, 0x18, 0x9e, 0xc, 0xa, 0x1c, 0x1d, 0x15, 0xe, 0xff +#define TEXT_EXIT_GAME 0xe,0x21,0x12,0x1d,0x9e,0x10,0xa,0x16,0xe,0xff #define TEXT_CAMERA_ANGLE_R_LENGTH 24 #define TEXT_LAKITU_MARIO_LENGTH 15 #define TEXT_LAKITU_STOP_LENGTH 14 @@ -67,6 +67,7 @@ memcpy(_var, g ## _text, _text ## _LENGTH) #define TEXT_HUD_HI_SCORE_LENGTH 9 #define TEXT_SAVE_AND_CONTINUE_LENGTH 16 #define TEXT_SAVE_AND_QUIT_LENGTH 12 +#define TEXT_SAVE_EXIT_GAME 0x1c,0xa,0x1f,0xe,0x9e,0xe5,0x9e,0xe,0x21,0x12,0x1d,0x9e,0x10,0xa,0x16,0xe,0xff #define TEXT_CONTINUE_WITHOUT_SAVING_LENGTH 21 #define TEXT_FILE_MARIO_EXCLAMATION_LENGTH 7 #define TEXT_POWER_STARS_RESTORED_LENGTH 52 diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 9b357cf6b..f3f651e2f 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -461,7 +461,9 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused if (sActSelectorMenuTimer >= 11) { // If any of these buttons are pressed, play sound and go to course act #ifndef VERSION_EU - if ((gPlayer1Controller->buttonPressed & (A_BUTTON | START_BUTTON | B_BUTTON))) { + if ((gPlayer1Controller->buttonPressed & A_BUTTON) + || (gPlayer1Controller->buttonPressed & START_BUTTON) + || (gPlayer1Controller->buttonPressed & B_BUTTON)) { #else if ((gPlayer1Controller->buttonPressed & (A_BUTTON | START_BUTTON | B_BUTTON | Z_TRIG))) { #endif @@ -469,6 +471,12 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused } } + // apply the received act num + if (sReceivedLoadedActNum != 0) { + sLoadedActNum = sReceivedLoadedActNum; + sReceivedLoadedActNum = 0; + } + // Cancel the act selector while on the main menu if (gDjuiInMainMenu) { return 1; } diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index bd86da1cc..1fc2fe336 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -1290,7 +1290,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] = { "yaw", LVT_S16, offsetof(struct LakituState, yaw), false, LOT_NONE }, }; -#define LUA_LEVEL_VALUES_FIELD_COUNT 57 +#define LUA_LEVEL_VALUES_FIELD_COUNT 56 static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { { "bubbleOnDeathBarrierInCapStages", LVT_U8, offsetof(struct LevelValues, bubbleOnDeathBarrierInCapStages), false, LOT_NONE }, { "ceilNormalMaxY", LVT_F32, offsetof(struct LevelValues, ceilNormalMaxY), false, LOT_NONE }, @@ -1327,7 +1327,6 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { "mushroom1UpHeal", LVT_U8, offsetof(struct LevelValues, mushroom1UpHeal), false, LOT_NONE }, { "numCoinsToLife", LVT_U16, offsetof(struct LevelValues, numCoinsToLife), false, LOT_NONE }, { "pauseExitAnywhere", LVT_U8, offsetof(struct LevelValues, pauseExitAnywhere), false, LOT_NONE }, - { "pauseExitMode", LVT_S32, offsetof(struct LevelValues, pauseExitMode), false, LOT_NONE }, { "previewBlueCoins", LVT_U8, offsetof(struct LevelValues, previewBlueCoins), false, LOT_NONE }, { "pssSlideStarIndex", LVT_U8, offsetof(struct LevelValues, pssSlideStarIndex), false, LOT_NONE }, { "pssSlideStarTime", LVT_U16, offsetof(struct LevelValues, pssSlideStarTime), false, LOT_NONE }, diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 98fa34964..ef56a07df 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -524,17 +524,6 @@ const char gSmluaConstants[] = "" "WARP_TRANSITION_FADE_INTO_MARIO=0x11\n" "WARP_TRANSITION_FADE_FROM_BOWSER=0x12\n" "WARP_TRANSITION_FADE_INTO_BOWSER=0x13\n" -"MENU_OPT_NONE=0\n" -"MENU_OPT_1=1\n" -"MENU_OPT_2=2\n" -"MENU_OPT_3=3\n" -"MENU_OPT_DEFAULT=MENU_OPT_1\n" -"MENU_OPT_CONTINUE=MENU_OPT_1\n" -"MENU_OPT_EXIT_COURSE=((MENU_OPT_CONTINUE) + 1)\n" -"MENU_OPT_CAMERA_ANGLE_R=((MENU_OPT_CONTINUE) + 2)\n" -"MENU_OPT_EXIT_TO_CASTLE=((MENU_OPT_CONTINUE) + 3)\n" -"MENU_OPT_SAVE_AND_CONTINUE=MENU_OPT_1\n" -"MENU_OPT_CONTINUE_DONT_SAVE=((MENU_OPT_SAVE_AND_CONTINUE) + 1)\n" "VERSION_REGION='US'\n" "id_bhv1Up=0\n" "id_bhv1upJumpOnApproach=1\n" @@ -1661,12 +1650,6 @@ const char gSmluaConstants[] = "" "GEO_CONTEXT_AREA_LOAD=3\n" "GEO_CONTEXT_AREA_INIT=4\n" "GEO_CONTEXT_HELD_OBJ=5\n" -"PAUSE_EXIT_VANILLA=0\n" -"PAUSE_EXIT_COURSE=1\n" -"PAUSE_EXIT_TO_CASTLE=2\n" -"PAUSE_EXIT_BOTH=3\n" -"STARS_NEEDED_FOR_DIALOG_COUNT=6\n" -"EXCLAMATION_BOX_MAX_SIZE=99\n" "INTERACT_UNKNOWN_08=(1 << 8)\n" "INTERACT_HOOT=(1 << 0)\n" "INTERACT_GRABBABLE=(1 << 1)\n" @@ -1802,36 +1785,29 @@ const char gSmluaConstants[] = "" "TIMER_CONTROL_START=1\n" "TIMER_CONTROL_STOP=2\n" "TIMER_CONTROL_HIDE=3\n" -"WARP_OP_NONE=0\n" -"WARP_OP_LOOK_UP=1\n" -"WARP_OP_SPIN_SHRINK=2\n" -"WARP_OP_WARP_DOOR=3\n" -"WARP_OP_WARP_OBJECT=4\n" -"WARP_OP_TELEPORT=5\n" +"WARP_OP_NONE=0x00\n" +"WARP_OP_LOOK_UP=0x01\n" +"WARP_OP_SPIN_SHRINK=0x02\n" +"WARP_OP_WARP_DOOR=0x03\n" +"WARP_OP_WARP_OBJECT=0x04\n" +"WARP_OP_TELEPORT=0x05\n" +"WARP_OP_STAR_EXIT=0x11\n" +"WARP_OP_DEATH=0x12\n" +"WARP_OP_WARP_FLOOR=0x13\n" +"WARP_OP_GAME_OVER=0x14\n" +"WARP_OP_CREDITS_END=0x15\n" +"WARP_OP_DEMO_NEXT=0x16\n" +"WARP_OP_CREDITS_START=0x17\n" +"WARP_OP_CREDITS_NEXT=0x18\n" +"WARP_OP_DEMO_END=0x19\n" +"WARP_OP_FORCE_SYNC=0x20\n" +"WARP_OP_EXIT=0x21\n" "WARP_OP_TRIGGERS_LEVEL_SELECT=0x10\n" -"WARP_OP_STAR_EXIT=17\n" -"WARP_OP_DEATH=18\n" -"WARP_OP_WARP_FLOOR=19\n" -"WARP_OP_GAME_OVER=20\n" -"WARP_OP_CREDITS_END=21\n" -"WARP_OP_DEMO_NEXT=22\n" -"WARP_OP_CREDITS_START=23\n" -"WARP_OP_CREDITS_NEXT=24\n" -"WARP_OP_DEMO_END=25\n" -"WARP_OP_FORCE_SYNC=26\n" -"WARP_OP_EXIT=27\n" -"WARP_SPECIAL_LEVEL_SELECT=-9\n" -"WARP_SPECIAL_INTRO_SPLASH_SCREEN=-8\n" -"WARP_SPECIAL_SWITCH_FILE=-7\n" -"WARP_SPECIAL_MARIO_HEAD_DIZZY=-3\n" -"WARP_SPECIAL_MARIO_HEAD_REGULAR=-2\n" -"WARP_SPECIAL_ENDING=-1\n" -"WARP_SPECIAL_NONE=0\n" -"WARP_FLAGS_NONE=(0 << 0)\n" -"WARP_FLAG_DOOR_PULLED=(1 << 0)\n" -"WARP_FLAG_DOOR_FLIP_MARIO=(1 << 1)\n" -"WARP_FLAG_DOOR_IS_WARP=(1 << 2)\n" -"WARP_FLAG_EXIT_COURSE=(1 << 3)\n" +"SPECIAL_WARP_CAKE=-1\n" +"SPECIAL_WARP_GODDARD=-2\n" +"SPECIAL_WARP_GODDARD_GAMEOVER=-3\n" +"SPECIAL_WARP_TITLE=-8\n" +"SPECIAL_WARP_LEVEL_SELECT=-9\n" "MARIO_SPAWN_NONE=0\n" "MARIO_SPAWN_DOOR_WARP=1\n" "MARIO_SPAWN_IDLE=2\n" @@ -1853,19 +1829,22 @@ const char gSmluaConstants[] = "" "MARIO_SPAWN_LAUNCH_DEATH=37\n" "MARIO_SPAWN_UNUSED_38=38\n" "MARIO_SPAWN_FADE_FROM_BLACK=39\n" -"WARP_NODE_MAIN_ENTRY=0x0A\n" -"WARP_NODE_DEFAULT=0xF0\n" +"MARIO_SPAWN_UNKNOWN_02=0x02\n" +"MARIO_SPAWN_UNKNOWN_03=0x03\n" +"MARIO_SPAWN_UNKNOWN_27=0x27\n" +"WARP_NODE_F0=0xF0\n" "WARP_NODE_DEATH=0xF1\n" -"WARP_NODE_LOOK_UP=0xF2\n" +"WARP_NODE_F2=0xF2\n" "WARP_NODE_WARP_FLOOR=0xF3\n" -"WARP_NODE_CREDITS_MIN=0xF8\n" "WARP_NODE_CREDITS_START=0xF8\n" "WARP_NODE_CREDITS_NEXT=0xF9\n" "WARP_NODE_CREDITS_END=0xFA\n" +"WARP_NODE_CREDITS_MIN=0xF8\n" "WARP_TYPE_NOT_WARPING=0\n" "WARP_TYPE_CHANGE_LEVEL=1\n" "WARP_TYPE_CHANGE_AREA=2\n" "WARP_TYPE_SAME_AREA=3\n" +"WARP_ARG_EXIT_COURSE=-1\n" "PRESS_START_DEMO_TIMER=800\n" "PAINTING_WARP_INDEX_START=0x00\n" "PAINTING_WARP_INDEX_FA=0x2A\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 1b3bb0e3c..309cae358 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -15408,7 +15408,7 @@ int smlua_func_fade_into_special_warp(lua_State* L) { return 0; } - int arg = smlua_to_integer(L, 1); + u32 arg = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "fade_into_special_warp"); return 0; } u32 color = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "fade_into_special_warp"); return 0; } @@ -15478,7 +15478,7 @@ int smlua_func_level_trigger_warp(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "level_trigger_warp"); return 0; } - int warpOp = smlua_to_integer(L, 2); + s32 warpOp = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "level_trigger_warp"); return 0; } lua_pushinteger(L, level_trigger_warp(m, warpOp)); @@ -15495,7 +15495,7 @@ int smlua_func_warp_special(lua_State* L) { return 0; } - int arg = smlua_to_integer(L, 1); + s32 arg = smlua_to_integer(L, 1); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "warp_special"); return 0; } warp_special(arg); @@ -15518,10 +15518,10 @@ int smlua_func_initiate_warp(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "initiate_warp"); return 0; } s16 destWarpNode = smlua_to_integer(L, 3); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "initiate_warp"); return 0; } - s32 warpFlags = smlua_to_integer(L, 4); + s32 arg = smlua_to_integer(L, 4); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "initiate_warp"); return 0; } - initiate_warp(destLevel, destArea, destWarpNode, warpFlags); + initiate_warp(destLevel, destArea, destWarpNode, arg); return 1; } diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index f330da884..eb4a98956 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -321,7 +321,7 @@ void game_unpause(void) { level_set_transition(0, NULL); gMenuMode = -1; gDialogBoxState = 0; - gMenuOptSelectIndex = MENU_OPT_DEFAULT; + gPauseScreenMode = 1; } /// From 85da75afae152c9e0c94007d03d57603991398bc Mon Sep 17 00:00:00 2001 From: Cooliokid956 <68075390+Cooliokid956@users.noreply.github.com> Date: Thu, 18 Jun 2026 21:36:39 -0500 Subject: [PATCH 16/16] sep-spawnOptMisc --- autogen/lua_definitions/functions.lua | 4 ++-- docs/lua/functions-7.md | 4 ++-- src/game/behavior_actions.c | 16 ++++++++-------- src/game/object_helpers.h | 10 +++++++--- src/pc/lua/smlua_functions_autogen.c | 22 ++++++++-------------- src/pc/lua/utils/smlua_obj_utils.c | 4 ++-- src/pc/lua/utils/smlua_obj_utils.h | 4 ++-- 7 files changed, 31 insertions(+), 33 deletions(-) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index d2b7d83d2..c4dfa9349 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -12449,7 +12449,7 @@ end --- @param x number --- @param y number --- @param z number ---- @param objSetupFunction? function +--- @param objSetupFunction function --- @return Object --- Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation.
--- You can change the fields of the object in `objSetupFunction` @@ -12462,7 +12462,7 @@ end --- @param x number --- @param y number --- @param z number ---- @param objSetupFunction? function +--- @param objSetupFunction function --- @return Object --- Spawns a non-synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation.
--- You can change the fields of the object in `objSetupFunction` diff --git a/docs/lua/functions-7.md b/docs/lua/functions-7.md index 27f24ec99..9e5b81a7a 100644 --- a/docs/lua/functions-7.md +++ b/docs/lua/functions-7.md @@ -4104,7 +4104,7 @@ You can change the fields of the object in `objSetupFunction` - [Object](structs.md#Object) ### C Prototype -`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction);` +`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);` [:arrow_up_small:](#) @@ -4133,7 +4133,7 @@ You can change the fields of the object in `objSetupFunction` - [Object](structs.md#Object) ### C Prototype -`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction);` +`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);` [:arrow_up_small:](#) diff --git a/src/game/behavior_actions.c b/src/game/behavior_actions.c index 0cda451b0..1c8303a52 100644 --- a/src/game/behavior_actions.c +++ b/src/game/behavior_actions.c @@ -113,21 +113,21 @@ s16 D_8032F0CC[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046, #include "behaviors/white_puff_explode.inc.c" // not in behavior file -struct SpawnParticlesInfo sMistParticles = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f }; +struct SpawnParticlesInfo D_8032F270 = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f }; // generate_wind_puffs/dust (something like that) void spawn_mist_particles_variable(s32 count, s32 offsetY, f32 size) { - sMistParticles.sizeBase = size; - sMistParticles.sizeRange = size / 20.0; - sMistParticles.offsetY = offsetY; + D_8032F270.sizeBase = size; + D_8032F270.sizeRange = size / 20.0; + D_8032F270.offsetY = offsetY; if (count == 0) { - sMistParticles.count = 20; + D_8032F270.count = 20; } else if (count > 20) { - sMistParticles.count = count; + D_8032F270.count = count; } else { - sMistParticles.count = 4; + D_8032F270.count = 4; } - cur_obj_spawn_particles(&sMistParticles); + cur_obj_spawn_particles(&D_8032F270); } #include "behaviors/sparkle_spawn_star.inc.c" diff --git a/src/game/object_helpers.h b/src/game/object_helpers.h index f96c1277a..18d085648 100644 --- a/src/game/object_helpers.h +++ b/src/game/object_helpers.h @@ -8,7 +8,8 @@ #include "pc/lua/utils/smlua_model_utils.h" // used for chain chomp and wiggler -struct ChainSegment { +struct ChainSegment +{ f32 posX; f32 posY; f32 posZ; @@ -25,7 +26,8 @@ struct ChainSegment { #define WATER_DROPLET_FLAG_RAND_ANGLE_INCR 0x80 // Unused // Call spawn_water_droplet with this struct to spawn an object. -struct WaterDropletParams { +struct WaterDropletParams +{ s16 flags; // Droplet spawn flags, see defines above s16 model; const BehaviorScript *behavior; @@ -39,7 +41,9 @@ struct WaterDropletParams { f32 randSizeScale; }; -struct SpawnParticlesInfo { +// TODO: Field names +struct SpawnParticlesInfo +{ /*0x00*/ s8 behParam; /*0x01*/ s8 count; /*0x02*/ u16 model; diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 309cae358..9afc821f8 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -35019,8 +35019,8 @@ int smlua_func_spawn_sync_object(lua_State* L) { if (L == NULL) { return 0; } int top = lua_gettop(L); - if (top < 5 || top > 6) { - LOG_LUA_LINE("Improper param count for '%s': Expected between %u and %u, Received %u", "spawn_sync_object", 5, 6, top); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_sync_object", 6, top); return 0; } @@ -35034,11 +35034,8 @@ int smlua_func_spawn_sync_object(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_sync_object"); return 0; } f32 z = smlua_to_number(L, 5); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_sync_object"); return 0; } - LuaFunction objSetupFunction = (LuaFunction) 0; - if (top >= 6) { - objSetupFunction = smlua_to_lua_function(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_sync_object"); return 0; } - } + LuaFunction objSetupFunction = smlua_to_lua_function(L, 6); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_sync_object"); return 0; } smlua_push_object(L, LOT_OBJECT, spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction), NULL); @@ -35049,8 +35046,8 @@ int smlua_func_spawn_non_sync_object(lua_State* L) { if (L == NULL) { return 0; } int top = lua_gettop(L); - if (top < 5 || top > 6) { - LOG_LUA_LINE("Improper param count for '%s': Expected between %u and %u, Received %u", "spawn_non_sync_object", 5, 6, top); + if (top != 6) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "spawn_non_sync_object", 6, top); return 0; } @@ -35064,11 +35061,8 @@ int smlua_func_spawn_non_sync_object(lua_State* L) { if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 4, "spawn_non_sync_object"); return 0; } f32 z = smlua_to_number(L, 5); if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 5, "spawn_non_sync_object"); return 0; } - LuaFunction objSetupFunction = (LuaFunction) 0; - if (top >= 6) { - objSetupFunction = smlua_to_lua_function(L, 6); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_non_sync_object"); return 0; } - } + LuaFunction objSetupFunction = smlua_to_lua_function(L, 6); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 6, "spawn_non_sync_object"); return 0; } smlua_push_object(L, LOT_OBJECT, spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction), NULL); diff --git a/src/pc/lua/utils/smlua_obj_utils.c b/src/pc/lua/utils/smlua_obj_utils.c index 33f4353d9..aa71c422d 100644 --- a/src/pc/lua/utils/smlua_obj_utils.c +++ b/src/pc/lua/utils/smlua_obj_utils.c @@ -76,11 +76,11 @@ static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum Mod return obj; } -struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction) { +struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction) { return spawn_object_internal(behaviorId, modelId, x, y, z, objSetupFunction, true); } -struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction) { +struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction) { return spawn_object_internal(behaviorId, modelId, x, y, z, objSetupFunction, false); } diff --git a/src/pc/lua/utils/smlua_obj_utils.h b/src/pc/lua/utils/smlua_obj_utils.h index 1d5d61c7d..0bf45cdd5 100644 --- a/src/pc/lua/utils/smlua_obj_utils.h +++ b/src/pc/lua/utils/smlua_obj_utils.h @@ -9,12 +9,12 @@ Spawns a synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` |descriptionEnd| */ -struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction); +struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction); /* |description| Spawns a non-synchronized object at `x`, `y`, and `z` as a child object of the local Mario with his rotation. You can change the fields of the object in `objSetupFunction` |descriptionEnd| */ -struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, OPTIONAL LuaFunction objSetupFunction); +struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction); /* |description|Checks if an object has `behaviorId`|descriptionEnd| */ s32 obj_has_behavior_id(struct Object *o, enum BehaviorId behaviorId);