diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index e0ef0b22..1994e114 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -174,6 +174,7 @@ --- @field public BowlingBallThiSmallSpeed number --- @field public BowlingBallTtmSpeed number --- @field public ChillBullyDeathPosY number +--- @field public CourtyardBoosRequirement integer --- @field public GrateStarRequirement integer --- @field public InfiniteRenderDistance integer --- @field public KingBobombFVel number @@ -902,6 +903,7 @@ --- @field public hudCapTimer integer --- @field public hudRedCoinsRadar integer --- @field public hudSecretsRadar integer +--- @field public infiniteStairsRequirement integer --- @field public maxCoins integer --- @field public maxLives integer --- @field public metalCapDuration integer diff --git a/docs/lua/structs.md b/docs/lua/structs.md index f70633e5..46247b89 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -307,6 +307,7 @@ | BowlingBallThiSmallSpeed | `number` | | | BowlingBallTtmSpeed | `number` | | | ChillBullyDeathPosY | `number` | | +| CourtyardBoosRequirement | `integer` | | | GrateStarRequirement | `integer` | | | InfiniteRenderDistance | `integer` | | | KingBobombFVel | `number` | | @@ -1243,6 +1244,7 @@ | hudCapTimer | `integer` | | | hudRedCoinsRadar | `integer` | | | hudSecretsRadar | `integer` | | +| infiniteStairsRequirement | `integer` | | | maxCoins | `integer` | | | maxLives | `integer` | | | metalCapDuration | `integer` | | diff --git a/src/game/behaviors/boo.inc.c b/src/game/behaviors/boo.inc.c index d0a41a08..7a7127c6 100644 --- a/src/game/behaviors/boo.inc.c +++ b/src/game/behaviors/boo.inc.c @@ -122,7 +122,7 @@ void bhv_courtyard_boo_triplet_init(void) { s32 i; struct Object *boo; - if (gHudDisplay.stars < 12) { + if (gHudDisplay.stars < gBehaviorValues.CourtyardBoosRequirement) { obj_mark_for_deletion(o); } else { for (i = 0; i < 3; i++) { @@ -848,7 +848,7 @@ static void boo_with_cage_act_3(void) { void bhv_boo_with_cage_init(void) { struct Object* cage; - if (gHudDisplay.stars < 12) { + if (gHudDisplay.stars < gBehaviorValues.CourtyardBoosRequirement) { obj_mark_for_deletion(o); } else { cage = spawn_object(o, MODEL_HAUNTED_CAGE, bhvBooCage); @@ -975,7 +975,7 @@ void bhv_boo_in_castle_loop(void) { if (o->oAction == 0) { cur_obj_hide(); - if (gHudDisplay.stars < 12) { + if (gHudDisplay.stars < gBehaviorValues.CourtyardBoosRequirement) { obj_mark_for_deletion(o); } diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index f745b730..5e71f878 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -73,6 +73,7 @@ struct LevelValues gDefaultLevelValues = { .pssSlideStarTime = 630, .pssSlideStarIndex = 1, .coinsRequiredForCoinStar = 100, + .infiniteStairsRequirement = 70, .wingCapDuration = 1800, .metalCapDuration = 600, .vanishCapDuration = 600, @@ -161,6 +162,7 @@ struct BehaviorValues gDefaultBehaviorValues = { .RespawnShellBoxes = TRUE, .MultipleCapCollection = FALSE, .InfiniteRenderDistance = TRUE, + .CourtyardBoosRequirement = 12, .starsNeededForDialog = { 1, 3, 8, 30, 50, 70 }, .dialogs = { .BobombBuddyBob1Dialog = DIALOG_004, diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index a8d5fc93..0a38a1ad 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -69,6 +69,7 @@ struct LevelValues { u16 pssSlideStarTime; u8 pssSlideStarIndex; s16 coinsRequiredForCoinStar; + s16 infiniteStairsRequirement; u16 wingCapDuration; u16 metalCapDuration; u16 vanishCapDuration; @@ -256,6 +257,7 @@ struct BehaviorValues { u8 RespawnShellBoxes; u8 MultipleCapCollection; u8 InfiniteRenderDistance; + s16 CourtyardBoosRequirement; struct StarsNeededForDialog starsNeededForDialog; struct BehaviorDialogs dialogs; struct BehaviorTrajectories trajectories; diff --git a/src/game/level_update.c b/src/game/level_update.c index 43748777..a4b56386 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -641,7 +641,7 @@ void check_instant_warp(void) { } if (gCurrLevelNum == LEVEL_CASTLE - && save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 70) { + && save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= gLevelValues.infiniteStairsRequirement) { return; } diff --git a/src/game/sound_init.c b/src/game/sound_init.c index de09a93f..50c5c913 100644 --- a/src/game/sound_init.c +++ b/src/game/sound_init.c @@ -4,6 +4,7 @@ #include "audio/external.h" #include "engine/graph_node.h" #include "engine/math_util.h" +#include "hardcoded.h" #include "level_table.h" #include "level_update.h" #include "main.h" @@ -200,8 +201,7 @@ void play_painting_eject_sound(void) { void play_infinite_stairs_music(void) { u8 shouldPlay = FALSE; - /* Infinite stairs? */ - if (gCurrLevelNum == LEVEL_CASTLE && gCurrAreaIndex == 2 && gMarioState->numStars < 70) { + if (gCurrLevelNum == LEVEL_CASTLE && gCurrAreaIndex == 2 && gMarioState->numStars < gLevelValues.infiniteStairsRequirement) { if (gMarioState->floor != NULL && gMarioState->floor->room == 6) { if (gMarioState->pos[2] < 2540.0f) { shouldPlay = TRUE; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 3b08884e..793e426a 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -210,7 +210,7 @@ static struct LuaObjectField sBehaviorTrajectoriesFields[LUA_BEHAVIOR_TRAJECTORI { "UnagiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, UnagiTrajectory), false, LOT_POINTER }, }; -#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 31 +#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 32 static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COUNT] = { { "BowlingBallBob2Speed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallBob2Speed), false, LOT_NONE }, { "BowlingBallBobSpeed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallBobSpeed), false, LOT_NONE }, @@ -218,6 +218,7 @@ static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COU { "BowlingBallThiSmallSpeed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallThiSmallSpeed), false, LOT_NONE }, { "BowlingBallTtmSpeed", LVT_F32, offsetof(struct BehaviorValues, BowlingBallTtmSpeed), false, LOT_NONE }, { "ChillBullyDeathPosY", LVT_F32, offsetof(struct BehaviorValues, ChillBullyDeathPosY), false, LOT_NONE }, + { "CourtyardBoosRequirement", LVT_S16, offsetof(struct BehaviorValues, CourtyardBoosRequirement), false, LOT_NONE }, { "GrateStarRequirement", LVT_U16, offsetof(struct BehaviorValues, GrateStarRequirement), false, LOT_NONE }, { "InfiniteRenderDistance", LVT_U8, offsetof(struct BehaviorValues, InfiniteRenderDistance), false, LOT_NONE }, { "KingBobombFVel", LVT_F32, offsetof(struct BehaviorValues, KingBobombFVel), false, LOT_NONE }, @@ -995,7 +996,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 49 +#define LUA_LEVEL_VALUES_FIELD_COUNT 50 static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { { "bubbleOnDeathBarrierInCapStages", LVT_U8, offsetof(struct LevelValues, bubbleOnDeathBarrierInCapStages), false, LOT_NONE }, { "cellHeightLimit", LVT_S16, offsetof(struct LevelValues, cellHeightLimit), false, LOT_NONE }, @@ -1019,6 +1020,7 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { "hudCapTimer", LVT_U8, offsetof(struct LevelValues, hudCapTimer), false, LOT_NONE }, { "hudRedCoinsRadar", LVT_U8, offsetof(struct LevelValues, hudRedCoinsRadar), false, LOT_NONE }, { "hudSecretsRadar", LVT_U8, offsetof(struct LevelValues, hudSecretsRadar), false, LOT_NONE }, + { "infiniteStairsRequirement", LVT_S16, offsetof(struct LevelValues, infiniteStairsRequirement), false, LOT_NONE }, { "maxCoins", LVT_U16, offsetof(struct LevelValues, maxCoins), false, LOT_NONE }, { "maxLives", LVT_U16, offsetof(struct LevelValues, maxLives), false, LOT_NONE }, { "metalCapDuration", LVT_U16, offsetof(struct LevelValues, metalCapDuration), false, LOT_NONE },