diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index c0d30eab..38f4ef87 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -642,6 +642,7 @@ --- @field public yaw integer --- @class LevelValues +--- @field public bubbleOnDeathBarrierInCapStages boolean --- @field public cellHeightLimit integer --- @field public coinsRequiredForCoinStar integer --- @field public disableActs boolean diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 5fc57d03..f4ea39ee 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -948,6 +948,7 @@ | Field | Type | Access | | ----- | ---- | ------ | +| bubbleOnDeathBarrierInCapStages | `boolean` | | | cellHeightLimit | `integer` | | | coinsRequiredForCoinStar | `integer` | | | disableActs | `boolean` | | diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 01791c8a..5094d0d7 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -117,7 +117,8 @@ struct LevelValues gDefaultLevelValues = { .wingCapLookUpReq = 10, .maxLives = 100, .maxCoins = 999, - .numCoinsToLife = 50 + .numCoinsToLife = 50, + .bubbleOnDeathBarrierInCapStages = false }; struct LevelValues gLevelValues = { 0 }; diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index 8671fa31..29ff6b69 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -85,6 +85,7 @@ struct LevelValues { u16 maxLives; u16 maxCoins; u16 numCoinsToLife; + bool bubbleOnDeathBarrierInCapStages; }; extern struct LevelValues gLevelValues; diff --git a/src/game/interaction.c b/src/game/interaction.c index 54ed5336..f225d0b2 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -2372,8 +2372,10 @@ void check_death_barrier(struct MarioState *m) { case COURSE_TOTWC: // (21) Tower of the Wing Cap case COURSE_VCUTM: // (22) Vanish Cap Under the Moat case COURSE_WMOTR: // (23) Winged Mario over the Rainbow - break; - default: + if (!gLevelValues.bubbleOnDeathBarrierInCapStages){ + break; + } + default: mario_set_bubbled(m); return; } diff --git a/src/game/mario.c b/src/game/mario.c index c44c6962..f06407f0 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -446,8 +446,8 @@ void mario_set_bubbled(struct MarioState* m) { gLocalBubbleCounter = 20; - set_mario_action(m, ACT_BUBBLED, 0); - if (m->numLives != -1) { + drop_and_set_mario_action(m, ACT_BUBBLED, 0); + if (m->numLives > -1) { m->numLives--; } m->healCounter = 0; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 8879ed8e..340497e3 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -743,8 +743,9 @@ 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 45 +#define LUA_LEVEL_VALUES_FIELD_COUNT 46 static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { + { "bubbleOnDeathBarrierInCapStages", LVT_BOOL, offsetof(struct LevelValues, bubbleOnDeathBarrierInCapStages), false, LOT_NONE }, { "cellHeightLimit", LVT_S16, offsetof(struct LevelValues, cellHeightLimit), false, LOT_NONE }, { "coinsRequiredForCoinStar", LVT_S16, offsetof(struct LevelValues, coinsRequiredForCoinStar), false, LOT_NONE }, { "disableActs", LVT_BOOL, offsetof(struct LevelValues, disableActs), false, LOT_NONE },