diff --git a/autogen/lua_constants/built-in.lua b/autogen/lua_constants/built-in.lua index ad0af270..8ede7c19 100644 --- a/autogen/lua_constants/built-in.lua +++ b/autogen/lua_constants/built-in.lua @@ -1,3 +1,5 @@ +math.randomseed(get_time()) + _CObject = { __index = function (t,k) return _get_field(t['_lot'], t['_pointer'], k, t) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index 81f0ac59..7175ec23 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -1,5 +1,7 @@ -- AUTOGENERATED FOR CODE EDITORS -- +math.randomseed(get_time()) + _CObject = { __index = function (t,k) return _get_field(t['_lot'], t['_pointer'], k, t) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 8ef6f82d..58e0d841 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -649,6 +649,7 @@ --- @field public exitCastleWarpNode integer --- @field public extendedPauseDisplay integer --- @field public fixCollisionBugs integer +--- @field public fixCollisionBugsFalseLedgeGrab 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 79ab774b..80986719 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -955,6 +955,7 @@ | exitCastleWarpNode | `integer` | | | extendedPauseDisplay | `integer` | | | fixCollisionBugs | `integer` | | +| fixCollisionBugsFalseLedgeGrab | `integer` | | | fixCollisionBugsRoundedCorners | `integer` | | | fixVanishFloors | `integer` | | | floatingStarDance | `integer` | | diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 66b77d50..a26c748f 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -44,6 +44,7 @@ extern Trajectory sThiTinyMetalBallTraj[]; struct LevelValues gDefaultLevelValues = { .fixCollisionBugs = 0, .fixCollisionBugsRoundedCorners = 1, + .fixCollisionBugsFalseLedgeGrab = 1, .fixVanishFloors = 0, .hudCapTimer = 0, .hudRedCoinsRadar = 0, diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index 75621ed5..d9b8ce92 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -42,6 +42,7 @@ struct StarPositions { struct LevelValues { u8 fixCollisionBugs; u8 fixCollisionBugsRoundedCorners; + u8 fixCollisionBugsFalseLedgeGrab; u8 wingCapLookUpReq; u8 fixVanishFloors; u8 hudCapTimer; diff --git a/src/game/level_update.c b/src/game/level_update.c index fed7b137..55a5aa5e 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -403,6 +403,7 @@ void set_mario_initial_action(struct MarioState *m, u32 spawnType, u32 actionArg void init_mario_after_warp(void) { struct ObjectWarpNode *spawnNode = area_get_warp_node(sWarpDest.nodeId); + if (spawnNode == NULL) { LOG_ERROR("Failed to find spawn node: %u", sWarpDest.nodeId); } if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = area_get_warp_node(0xFA); } if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = area_get_warp_node(0x00); } if (spawnNode == NULL || spawnNode->object == NULL) { spawnNode = area_get_any_warp_node(); } diff --git a/src/game/mario_step.c b/src/game/mario_step.c index 9990e335..be79e350 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -418,7 +418,7 @@ u32 check_ledge_grab(struct MarioState *m, struct Surface *wall, Vec3f intendedP ledgePos[2] = nextPos[2] - wall->normal.z * 60.0f; ledgePos[1] = find_floor(ledgePos[0], nextPos[1] + 160.0f, ledgePos[2], &ledgeFloor); - if (gLevelValues.fixCollisionBugs) { + if (gLevelValues.fixCollisionBugs && gLevelValues.fixCollisionBugsFalseLedgeGrab) { // fix false ledge grabs if (!ledgeFloor || ledgeFloor->normal.y < 0.90630779f) { return FALSE; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 7bfd0763..2151f244 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -741,7 +741,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 39 +#define LUA_LEVEL_VALUES_FIELD_COUNT 40 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 }, @@ -752,6 +752,7 @@ static struct LuaObjectField sLevelValuesFields[LUA_LEVEL_VALUES_FIELD_COUNT] = { "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 }, diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 78051c03..2018cab6 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1,5 +1,5 @@ char gSmluaConstants[] = "" -"math.randomseed(get_time())" +"math.randomseed(get_time())\n" "_CObject = {\n" " __index = function (t,k)\n" " return _get_field(t['_lot'], t['_pointer'], k, t)\n"