From d4fe80d4a60a94cf9a290017e2a75153d3303c3f Mon Sep 17 00:00:00 2001
From: Agent X <44549182+Agent-11@users.noreply.github.com>
Date: Thu, 22 Feb 2024 14:51:33 -0500
Subject: [PATCH] Expose level_control_timer_running
---
autogen/convert_functions.py | 2 +-
autogen/lua_definitions/functions.lua | 5 +
docs/lua/functions-3.md | 185 +++-----------------------
docs/lua/functions-4.md | 167 +++++++++++++++++++++++
docs/lua/functions.md | 17 +--
src/pc/lua/smlua_functions_autogen.c | 16 +++
6 files changed, 216 insertions(+), 176 deletions(-)
diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index d9ab7a85..9e33b9a6 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -75,7 +75,7 @@ override_allowed_functions = {
"src/game/object_list_processor.h": [ "set_object_respawn_info_bits" ],
"src/game/mario_misc.h": [ "bhv_toad.*", "bhv_unlock_door.*" ],
"src/pc/utils/misc.h": [ "update_all_mario_stars" ],
- "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level" ],
+ "src/game/level_update.h": [ "level_trigger_warp", "get_painting_warp_node", "initiate_painting_warp", "warp_special", "lvl_set_current_level", "level_control_timer_running" ],
"src/game/area.h": [ "area_get_warp_node" ],
"src/engine/level_script.h": [ "area_create_warp_node" ],
"src/game/ingame_menu.h": [ "set_min_dialog_width", "set_dialog_override_pos", "reset_dialog_override_pos", "set_dialog_override_color", "reset_dialog_override_color" ]
diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index bccb854f..7a775769 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -4246,6 +4246,11 @@ function initiate_painting_warp(paintingIndex)
-- ...
end
+--- @return integer
+function level_control_timer_running()
+ -- ...
+end
+
--- @param m MarioState
--- @param warpOp integer
--- @return integer
diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md
index db64d0ae..07dd8c70 100644
--- a/docs/lua/functions-3.md
+++ b/docs/lua/functions-3.md
@@ -4047,6 +4047,24 @@
+## [level_control_timer_running](#level_control_timer_running)
+
+### Lua Example
+`local integerValue = level_control_timer_running()`
+
+### Parameters
+- None
+
+### Returns
+- `integer`
+
+### C Prototype
+`u8 level_control_timer_running(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [level_trigger_warp](#level_trigger_warp)
### Lua Example
@@ -8684,173 +8702,6 @@
[:arrow_up_small:](#)
-
-
----
-# functions from mod_storage.h
-
-
-
-
-## [mod_storage_clear](#mod_storage_clear)
-
-### Lua Example
-`local booleanValue = mod_storage_clear()`
-
-### Parameters
-- None
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool mod_storage_clear(void);`
-
-[:arrow_up_small:](#)
-
-
-
-## [mod_storage_load](#mod_storage_load)
-
-### Lua Example
-`local stringValue = mod_storage_load(key)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| key | `string` |
-
-### Returns
-- `string`
-
-### C Prototype
-`const char *mod_storage_load(const char* key);`
-
-[:arrow_up_small:](#)
-
-
-
-## [mod_storage_load_bool](#mod_storage_load_bool)
-
-### Lua Example
-`local booleanValue = mod_storage_load_bool(key)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| key | `string` |
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool mod_storage_load_bool(const char* key);`
-
-[:arrow_up_small:](#)
-
-
-
-## [mod_storage_load_number](#mod_storage_load_number)
-
-### Lua Example
-`local numberValue = mod_storage_load_number(key)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| key | `string` |
-
-### Returns
-- `number`
-
-### C Prototype
-`double mod_storage_load_number(const char* key);`
-
-[:arrow_up_small:](#)
-
-
-
-## [mod_storage_remove](#mod_storage_remove)
-
-### Lua Example
-`local booleanValue = mod_storage_remove(key)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| key | `string` |
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool mod_storage_remove(const char* key);`
-
-[:arrow_up_small:](#)
-
-
-
-## [mod_storage_save](#mod_storage_save)
-
-### Lua Example
-`local booleanValue = mod_storage_save(key, value)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| key | `string` |
-| value | `string` |
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool mod_storage_save(const char* key, const char* value);`
-
-[:arrow_up_small:](#)
-
-
-
-## [mod_storage_save_bool](#mod_storage_save_bool)
-
-### Lua Example
-`local booleanValue = mod_storage_save_bool(key, value)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| key | `string` |
-| value | `boolean` |
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool mod_storage_save_bool(const char* key, bool value);`
-
-[:arrow_up_small:](#)
-
-
-
-## [mod_storage_save_number](#mod_storage_save_number)
-
-### Lua Example
-`local booleanValue = mod_storage_save_number(key, value)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| key | `string` |
-| value | `number` |
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool mod_storage_save_number(const char* key, double value);`
-
-[:arrow_up_small:](#)
-
---
diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md
index 4ac3b843..c2e6fda6 100644
--- a/docs/lua/functions-4.md
+++ b/docs/lua/functions-4.md
@@ -5,6 +5,173 @@
[< prev](functions-3.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | 4 | [5](functions-5.md) | [next >](functions-5.md)]
+---
+# functions from mod_storage.h
+
+
+
+
+## [mod_storage_clear](#mod_storage_clear)
+
+### Lua Example
+`local booleanValue = mod_storage_clear()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool mod_storage_clear(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [mod_storage_load](#mod_storage_load)
+
+### Lua Example
+`local stringValue = mod_storage_load(key)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| key | `string` |
+
+### Returns
+- `string`
+
+### C Prototype
+`const char *mod_storage_load(const char* key);`
+
+[:arrow_up_small:](#)
+
+
+
+## [mod_storage_load_bool](#mod_storage_load_bool)
+
+### Lua Example
+`local booleanValue = mod_storage_load_bool(key)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| key | `string` |
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool mod_storage_load_bool(const char* key);`
+
+[:arrow_up_small:](#)
+
+
+
+## [mod_storage_load_number](#mod_storage_load_number)
+
+### Lua Example
+`local numberValue = mod_storage_load_number(key)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| key | `string` |
+
+### Returns
+- `number`
+
+### C Prototype
+`double mod_storage_load_number(const char* key);`
+
+[:arrow_up_small:](#)
+
+
+
+## [mod_storage_remove](#mod_storage_remove)
+
+### Lua Example
+`local booleanValue = mod_storage_remove(key)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| key | `string` |
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool mod_storage_remove(const char* key);`
+
+[:arrow_up_small:](#)
+
+
+
+## [mod_storage_save](#mod_storage_save)
+
+### Lua Example
+`local booleanValue = mod_storage_save(key, value)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| key | `string` |
+| value | `string` |
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool mod_storage_save(const char* key, const char* value);`
+
+[:arrow_up_small:](#)
+
+
+
+## [mod_storage_save_bool](#mod_storage_save_bool)
+
+### Lua Example
+`local booleanValue = mod_storage_save_bool(key, value)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| key | `string` |
+| value | `boolean` |
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool mod_storage_save_bool(const char* key, bool value);`
+
+[:arrow_up_small:](#)
+
+
+
+## [mod_storage_save_number](#mod_storage_save_number)
+
+### Lua Example
+`local booleanValue = mod_storage_save_number(key, value)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| key | `string` |
+| value | `number` |
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool mod_storage_save_number(const char* key, double value);`
+
+[:arrow_up_small:](#)
+
+
+
---
# functions from network_player.h
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 2f54fbc2..959a6cfc 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -860,6 +860,7 @@
- level_update.h
- [get_painting_warp_node](functions-3.md#get_painting_warp_node)
- [initiate_painting_warp](functions-3.md#initiate_painting_warp)
+ - [level_control_timer_running](functions-3.md#level_control_timer_running)
- [level_trigger_warp](functions-3.md#level_trigger_warp)
- [lvl_set_current_level](functions-3.md#lvl_set_current_level)
- [warp_special](functions-3.md#warp_special)
@@ -1130,14 +1131,14 @@
- mod_storage.h
- - [mod_storage_clear](functions-3.md#mod_storage_clear)
- - [mod_storage_load](functions-3.md#mod_storage_load)
- - [mod_storage_load_bool](functions-3.md#mod_storage_load_bool)
- - [mod_storage_load_number](functions-3.md#mod_storage_load_number)
- - [mod_storage_remove](functions-3.md#mod_storage_remove)
- - [mod_storage_save](functions-3.md#mod_storage_save)
- - [mod_storage_save_bool](functions-3.md#mod_storage_save_bool)
- - [mod_storage_save_number](functions-3.md#mod_storage_save_number)
+ - [mod_storage_clear](functions-4.md#mod_storage_clear)
+ - [mod_storage_load](functions-4.md#mod_storage_load)
+ - [mod_storage_load_bool](functions-4.md#mod_storage_load_bool)
+ - [mod_storage_load_number](functions-4.md#mod_storage_load_number)
+ - [mod_storage_remove](functions-4.md#mod_storage_remove)
+ - [mod_storage_save](functions-4.md#mod_storage_save)
+ - [mod_storage_save_bool](functions-4.md#mod_storage_save_bool)
+ - [mod_storage_save_number](functions-4.md#mod_storage_save_number)
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index fbecdeeb..d2a91fc7 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -13880,6 +13880,21 @@ int smlua_func_initiate_painting_warp(lua_State* L) {
return 1;
}
+int smlua_func_level_control_timer_running(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "level_control_timer_running", 0, top);
+ return 0;
+ }
+
+
+ lua_pushinteger(L, level_control_timer_running());
+
+ return 1;
+}
+
int smlua_func_level_trigger_warp(lua_State* L) {
if (L == NULL) { return 0; }
@@ -32279,6 +32294,7 @@ void smlua_bind_functions_autogen(void) {
// level_update.h
smlua_bind_function(L, "get_painting_warp_node", smlua_func_get_painting_warp_node);
smlua_bind_function(L, "initiate_painting_warp", smlua_func_initiate_painting_warp);
+ smlua_bind_function(L, "level_control_timer_running", smlua_func_level_control_timer_running);
smlua_bind_function(L, "level_trigger_warp", smlua_func_level_trigger_warp);
smlua_bind_function(L, "lvl_set_current_level", smlua_func_lvl_set_current_level);
smlua_bind_function(L, "warp_special", smlua_func_warp_special);