From da9715333614ebfbf3d05984529948e8a7f126d5 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 12 Mar 2022 17:00:06 -0800 Subject: [PATCH] Fixed saving/loading of DynOS model pack settings --- docs/lua/functions.md | 21 +++++++++++++++++++++ src/pc/configfile.c | 1 + src/pc/lua/smlua_functions_autogen.c | 12 ++++++++++++ 3 files changed, 34 insertions(+) diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 23dabf27..f6bedc7c 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -116,6 +116,7 @@ - [is_anim_at_end](#is_anim_at_end) - [is_anim_past_end](#is_anim_past_end) - [is_anim_past_frame](#is_anim_past_frame) + - [mario_can_bubble](#mario_can_bubble) - [mario_facing_downhill](#mario_facing_downhill) - [mario_floor_is_slippery](#mario_floor_is_slippery) - [mario_floor_is_slope](#mario_floor_is_slope) @@ -2288,6 +2289,26 @@ The `reliable` field will ensure that the packet arrives, but should be used spa
+## [mario_can_bubble](#mario_can_bubble) + +### Lua Example +`local boolValue = mario_can_bubble(m)` + +### Parameters +| Field | Type | +| ----- | ---- | +| m | [MarioState](structs.md#MarioState) | + +### Returns +- `bool` + +### C Prototype +`bool mario_can_bubble(struct MarioState* m);` + +[:arrow_up_small:](#) + +
+ ## [mario_facing_downhill](#mario_facing_downhill) ### Lua Example diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 5733a029..0edce7cc 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -252,6 +252,7 @@ static void dynos_pack_read(char** tokens, UNUSED int numTokens) { if (numTokens < 3) { return; } char fullPackName[256] = { 0 }; for (int i = 1; i < numTokens - 1; i++) { + if (i != 1) { strncat(fullPackName, " ", 255); } strncat(fullPackName, tokens[i], 255); } diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index b0a8f567..83076eda 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -975,6 +975,17 @@ int smlua_func_is_anim_past_frame(lua_State* L) { return 1; } +int smlua_func_mario_can_bubble(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + + lua_pushboolean(L, mario_can_bubble(m)); + + return 1; +} + int smlua_func_mario_facing_downhill(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } @@ -8198,6 +8209,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "is_anim_at_end", smlua_func_is_anim_at_end); smlua_bind_function(L, "is_anim_past_end", smlua_func_is_anim_past_end); smlua_bind_function(L, "is_anim_past_frame", smlua_func_is_anim_past_frame); + smlua_bind_function(L, "mario_can_bubble", smlua_func_mario_can_bubble); smlua_bind_function(L, "mario_facing_downhill", smlua_func_mario_facing_downhill); smlua_bind_function(L, "mario_floor_is_slippery", smlua_func_mario_floor_is_slippery); smlua_bind_function(L, "mario_floor_is_slope", smlua_func_mario_floor_is_slope);