From c7a557d870248f02bf9b840a0ad64326158c52ef Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 22 Jun 2023 11:40:59 -0700 Subject: [PATCH] Add gLevelValues.fixCollisionBugsGroundPoundBonks --- autogen/lua_definitions/structs.lua | 1 + docs/lua/structs.md | 1 + src/game/hardcoded.c | 1 + src/game/hardcoded.h | 1 + src/game/mario_actions_airborne.c | 18 ++++--- src/pc/lua/smlua_cobject_autogen.c | 83 +++++++++++++++-------------- 6 files changed, 57 insertions(+), 48 deletions(-) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index f8ac5d02d..f73fc0c43 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -652,6 +652,7 @@ --- @field public extendedPauseDisplay integer --- @field public fixCollisionBugs integer --- @field public fixCollisionBugsFalseLedgeGrab integer +--- @field public fixCollisionBugsGroundPoundBonks integer --- @field public fixCollisionBugsRoundedCorners integer --- @field public fixVanishFloors integer --- @field public floatingStarDance integer diff --git a/docs/lua/structs.md b/docs/lua/structs.md index ff78a3e14..e8cd57996 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -958,6 +958,7 @@ | extendedPauseDisplay | `integer` | | | fixCollisionBugs | `integer` | | | fixCollisionBugsFalseLedgeGrab | `integer` | | +| fixCollisionBugsGroundPoundBonks | `integer` | | | fixCollisionBugsRoundedCorners | `integer` | | | fixVanishFloors | `integer` | | | floatingStarDance | `integer` | | diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 375b7851b..53cb24bae 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -45,6 +45,7 @@ struct LevelValues gDefaultLevelValues = { .fixCollisionBugs = 0, .fixCollisionBugsRoundedCorners = 1, .fixCollisionBugsFalseLedgeGrab = 1, + .fixCollisionBugsGroundPoundBonks = 1, .fixVanishFloors = 0, .hudCapTimer = 0, .hudRedCoinsRadar = 0, diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index 4d1f5293f..d9ee97db7 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -43,6 +43,7 @@ struct LevelValues { u8 fixCollisionBugs; u8 fixCollisionBugsRoundedCorners; u8 fixCollisionBugsFalseLedgeGrab; + u8 fixCollisionBugsGroundPoundBonks; u8 wingCapLookUpReq; u8 fixVanishFloors; u8 hudCapTimer; diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index f0e8c672a..c3e18196c 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -1009,14 +1009,18 @@ s32 act_ground_pound(struct MarioState *m) { } } if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_GROUND_POUND); } - } else if (stepResult == AIR_STEP_HIT_WALL && !gLevelValues.fixCollisionBugs) { - mario_set_forward_vel(m, -16.0f); - if (m->vel[1] > 0.0f) { - m->vel[1] = 0.0f; - } + } else if (stepResult == AIR_STEP_HIT_WALL) { + if (gLevelValues.fixCollisionBugs && gLevelValues.fixCollisionBugsGroundPoundBonks) { + // do nothing + } else { + mario_set_forward_vel(m, -16.0f); + if (m->vel[1] > 0.0f) { + m->vel[1] = 0.0f; + } - set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE); - set_mario_action(m, ACT_BACKWARD_AIR_KB, 0); + set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE); + set_mario_action(m, ACT_BACKWARD_AIR_KB, 0); + } } } diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 73a03ce5b..26aee3d0c 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -743,48 +743,49 @@ 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 40 +#define LUA_LEVEL_VALUES_FIELD_COUNT 41 static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { - { "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 }, - { "entryLevel", LVT_S32, offsetof(struct LevelValues, entryLevel), false, LOT_NONE }, - { "exitCastleArea", LVT_S16, offsetof(struct LevelValues, exitCastleArea), false, LOT_NONE }, - { "exitCastleLevel", LVT_S32, offsetof(struct LevelValues, exitCastleLevel), false, LOT_NONE }, - { "exitCastleWarpNode", LVT_U8, offsetof(struct LevelValues, exitCastleWarpNode), false, LOT_NONE }, - { "extendedPauseDisplay", LVT_U8, offsetof(struct LevelValues, extendedPauseDisplay), false, LOT_NONE }, - { "fixCollisionBugs", LVT_U8, offsetof(struct LevelValues, fixCollisionBugs), false, LOT_NONE }, - { "fixCollisionBugsFalseLedgeGrab", LVT_U8, offsetof(struct LevelValues, fixCollisionBugsFalseLedgeGrab), false, LOT_NONE }, - { "fixCollisionBugsRoundedCorners", LVT_U8, offsetof(struct LevelValues, fixCollisionBugsRoundedCorners), false, LOT_NONE }, - { "fixVanishFloors", LVT_U8, offsetof(struct LevelValues, fixVanishFloors), false, LOT_NONE }, - { "floatingStarDance", LVT_U8, offsetof(struct LevelValues, floatingStarDance), false, LOT_NONE }, - { "floorLowerLimit", LVT_S16, offsetof(struct LevelValues, floorLowerLimit), false, LOT_NONE }, - { "floorLowerLimitMisc", LVT_S16, offsetof(struct LevelValues, floorLowerLimitMisc), false, LOT_NONE }, - { "floorLowerLimitShadow", LVT_S16, offsetof(struct LevelValues, floorLowerLimitShadow), false, LOT_NONE }, - { "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 }, - { "metalCapDuration", LVT_U16, offsetof(struct LevelValues, metalCapDuration), false, LOT_NONE }, - { "metalCapDurationCotmc", LVT_U16, offsetof(struct LevelValues, metalCapDurationCotmc), false, LOT_NONE }, - { "metalCapSequence", LVT_U8, offsetof(struct LevelValues, metalCapSequence), false, LOT_NONE }, - { "mushroom1UpHeal", LVT_U8, offsetof(struct LevelValues, mushroom1UpHeal), false, LOT_NONE }, - { "pauseExitAnywhere", LVT_BOOL, offsetof(struct LevelValues, pauseExitAnywhere), 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 }, - { "respawnBlueCoinsSwitch", LVT_U8, offsetof(struct LevelValues, respawnBlueCoinsSwitch), false, LOT_NONE }, - { "showStarNumber", LVT_U8, offsetof(struct LevelValues, showStarNumber), false, LOT_NONE }, - { "skipCreditsAt", LVT_S32, offsetof(struct LevelValues, skipCreditsAt), false, LOT_NONE }, - { "starHeal", LVT_U8, offsetof(struct LevelValues, starHeal), false, LOT_NONE }, - { "starPositions", LVT_COBJECT, offsetof(struct LevelValues, starPositions), true, LOT_STARPOSITIONS }, - { "vanishCapDuration", LVT_U16, offsetof(struct LevelValues, vanishCapDuration), false, LOT_NONE }, - { "vanishCapDurationVcutm", LVT_U16, offsetof(struct LevelValues, vanishCapDurationVcutm), false, LOT_NONE }, - { "vanishCapSequence", LVT_U8, offsetof(struct LevelValues, vanishCapSequence), false, LOT_NONE }, - { "visibleSecrets", LVT_U8, offsetof(struct LevelValues, visibleSecrets), false, LOT_NONE }, - { "wingCapDuration", LVT_U16, offsetof(struct LevelValues, wingCapDuration), false, LOT_NONE }, - { "wingCapDurationTotwc", LVT_U16, offsetof(struct LevelValues, wingCapDurationTotwc), false, LOT_NONE }, - { "wingCapLookUpReq", LVT_U8, offsetof(struct LevelValues, wingCapLookUpReq), false, LOT_NONE }, - { "wingCapSequence", LVT_U8, offsetof(struct LevelValues, wingCapSequence), 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 }, + { "entryLevel", LVT_S32, offsetof(struct LevelValues, entryLevel), false, LOT_NONE }, + { "exitCastleArea", LVT_S16, offsetof(struct LevelValues, exitCastleArea), false, LOT_NONE }, + { "exitCastleLevel", LVT_S32, offsetof(struct LevelValues, exitCastleLevel), false, LOT_NONE }, + { "exitCastleWarpNode", LVT_U8, offsetof(struct LevelValues, exitCastleWarpNode), false, LOT_NONE }, + { "extendedPauseDisplay", LVT_U8, offsetof(struct LevelValues, extendedPauseDisplay), false, LOT_NONE }, + { "fixCollisionBugs", LVT_U8, offsetof(struct LevelValues, fixCollisionBugs), false, LOT_NONE }, + { "fixCollisionBugsFalseLedgeGrab", LVT_U8, offsetof(struct LevelValues, fixCollisionBugsFalseLedgeGrab), false, LOT_NONE }, + { "fixCollisionBugsGroundPoundBonks", LVT_U8, offsetof(struct LevelValues, fixCollisionBugsGroundPoundBonks), false, LOT_NONE }, + { "fixCollisionBugsRoundedCorners", LVT_U8, offsetof(struct LevelValues, fixCollisionBugsRoundedCorners), false, LOT_NONE }, + { "fixVanishFloors", LVT_U8, offsetof(struct LevelValues, fixVanishFloors), false, LOT_NONE }, + { "floatingStarDance", LVT_U8, offsetof(struct LevelValues, floatingStarDance), false, LOT_NONE }, + { "floorLowerLimit", LVT_S16, offsetof(struct LevelValues, floorLowerLimit), false, LOT_NONE }, + { "floorLowerLimitMisc", LVT_S16, offsetof(struct LevelValues, floorLowerLimitMisc), false, LOT_NONE }, + { "floorLowerLimitShadow", LVT_S16, offsetof(struct LevelValues, floorLowerLimitShadow), false, LOT_NONE }, + { "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 }, + { "metalCapDuration", LVT_U16, offsetof(struct LevelValues, metalCapDuration), false, LOT_NONE }, + { "metalCapDurationCotmc", LVT_U16, offsetof(struct LevelValues, metalCapDurationCotmc), false, LOT_NONE }, + { "metalCapSequence", LVT_U8, offsetof(struct LevelValues, metalCapSequence), false, LOT_NONE }, + { "mushroom1UpHeal", LVT_U8, offsetof(struct LevelValues, mushroom1UpHeal), false, LOT_NONE }, + { "pauseExitAnywhere", LVT_BOOL, offsetof(struct LevelValues, pauseExitAnywhere), 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 }, + { "respawnBlueCoinsSwitch", LVT_U8, offsetof(struct LevelValues, respawnBlueCoinsSwitch), false, LOT_NONE }, + { "showStarNumber", LVT_U8, offsetof(struct LevelValues, showStarNumber), false, LOT_NONE }, + { "skipCreditsAt", LVT_S32, offsetof(struct LevelValues, skipCreditsAt), false, LOT_NONE }, + { "starHeal", LVT_U8, offsetof(struct LevelValues, starHeal), false, LOT_NONE }, + { "starPositions", LVT_COBJECT, offsetof(struct LevelValues, starPositions), true, LOT_STARPOSITIONS }, + { "vanishCapDuration", LVT_U16, offsetof(struct LevelValues, vanishCapDuration), false, LOT_NONE }, + { "vanishCapDurationVcutm", LVT_U16, offsetof(struct LevelValues, vanishCapDurationVcutm), false, LOT_NONE }, + { "vanishCapSequence", LVT_U8, offsetof(struct LevelValues, vanishCapSequence), false, LOT_NONE }, + { "visibleSecrets", LVT_U8, offsetof(struct LevelValues, visibleSecrets), false, LOT_NONE }, + { "wingCapDuration", LVT_U16, offsetof(struct LevelValues, wingCapDuration), false, LOT_NONE }, + { "wingCapDurationTotwc", LVT_U16, offsetof(struct LevelValues, wingCapDurationTotwc), false, LOT_NONE }, + { "wingCapLookUpReq", LVT_U8, offsetof(struct LevelValues, wingCapLookUpReq), false, LOT_NONE }, + { "wingCapSequence", LVT_U8, offsetof(struct LevelValues, wingCapSequence), false, LOT_NONE }, }; #define LUA_LINEAR_TRANSITION_POINT_FIELD_COUNT 5