diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 0690ff2a..10a274f2 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -3579,6 +3579,13 @@ function get_character(m)
-- ...
end
+--- @param m MarioState
+--- @param characterAnim CharacterAnimID
+--- @return integer
+function get_character_anim(m, characterAnim)
+ -- ...
+end
+
--- @param m MarioState
--- @return number
function get_character_anim_offset(m)
diff --git a/docs/lua/functions-3.md b/docs/lua/functions-3.md
index ea209d23..79133f12 100644
--- a/docs/lua/functions-3.md
+++ b/docs/lua/functions-3.md
@@ -1898,6 +1898,27 @@
+## [get_character_anim](#get_character_anim)
+
+### Lua Example
+`local integerValue = get_character_anim(m, characterAnim)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| m | [MarioState](structs.md#MarioState) |
+| characterAnim | [enum CharacterAnimID](constants.md#enum-CharacterAnimID) |
+
+### Returns
+- `integer`
+
+### C Prototype
+`s32 get_character_anim(struct MarioState* m, enum CharacterAnimID characterAnim);`
+
+[:arrow_up_small:](#)
+
+
+
## [get_character_anim_offset](#get_character_anim_offset)
### Lua Example
@@ -8711,108 +8732,6 @@
[:arrow_up_small:](#)
-
-
----
-# functions from network_utils.h
-
-
-
-
-## [network_get_player_text_color_string](#network_get_player_text_color_string)
-
-### Lua Example
-`local stringValue = network_get_player_text_color_string(localIndex)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| localIndex | `integer` |
-
-### Returns
-- `string`
-
-### C Prototype
-`const char* network_get_player_text_color_string(u8 localIndex);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_global_index_from_local](#network_global_index_from_local)
-
-### Lua Example
-`local integerValue = network_global_index_from_local(localIndex)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| localIndex | `integer` |
-
-### Returns
-- `integer`
-
-### C Prototype
-`u8 network_global_index_from_local(u8 localIndex);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_is_moderator](#network_is_moderator)
-
-### Lua Example
-`local booleanValue = network_is_moderator()`
-
-### Parameters
-- None
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool network_is_moderator(void);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_is_server](#network_is_server)
-
-### Lua Example
-`local booleanValue = network_is_server()`
-
-### Parameters
-- None
-
-### Returns
-- `boolean`
-
-### C Prototype
-`bool network_is_server(void);`
-
-[:arrow_up_small:](#)
-
-
-
-## [network_local_index_from_global](#network_local_index_from_global)
-
-### Lua Example
-`local integerValue = network_local_index_from_global(globalIndex)`
-
-### Parameters
-| Field | Type |
-| ----- | ---- |
-| globalIndex | `integer` |
-
-### Returns
-- `integer`
-
-### C Prototype
-`u8 network_local_index_from_global(u8 globalIndex);`
-
-[:arrow_up_small:](#)
-
---
diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md
index 15194a50..cd38ec71 100644
--- a/docs/lua/functions-4.md
+++ b/docs/lua/functions-4.md
@@ -5,6 +5,108 @@
[< 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 network_utils.h
+
+
+
+
+## [network_get_player_text_color_string](#network_get_player_text_color_string)
+
+### Lua Example
+`local stringValue = network_get_player_text_color_string(localIndex)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| localIndex | `integer` |
+
+### Returns
+- `string`
+
+### C Prototype
+`const char* network_get_player_text_color_string(u8 localIndex);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_global_index_from_local](#network_global_index_from_local)
+
+### Lua Example
+`local integerValue = network_global_index_from_local(localIndex)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| localIndex | `integer` |
+
+### Returns
+- `integer`
+
+### C Prototype
+`u8 network_global_index_from_local(u8 localIndex);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_is_moderator](#network_is_moderator)
+
+### Lua Example
+`local booleanValue = network_is_moderator()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool network_is_moderator(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_is_server](#network_is_server)
+
+### Lua Example
+`local booleanValue = network_is_server()`
+
+### Parameters
+- None
+
+### Returns
+- `boolean`
+
+### C Prototype
+`bool network_is_server(void);`
+
+[:arrow_up_small:](#)
+
+
+
+## [network_local_index_from_global](#network_local_index_from_global)
+
+### Lua Example
+`local integerValue = network_local_index_from_global(globalIndex)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| globalIndex | `integer` |
+
+### Returns
+- `integer`
+
+### C Prototype
+`u8 network_local_index_from_global(u8 globalIndex);`
+
+[:arrow_up_small:](#)
+
+
+
---
# functions from obj_behaviors.c
@@ -7642,7 +7744,7 @@
[CustomLevelInfo](structs.md#CustomLevelInfo)
### C Prototype
-`struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName);`
+`struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName);`
[:arrow_up_small:](#)
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index adb22fc1..232cf7e5 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -702,6 +702,7 @@
- characters.h
- [get_character](functions-3.md#get_character)
+ - [get_character_anim](functions-3.md#get_character_anim)
- [get_character_anim_offset](functions-3.md#get_character_anim_offset)
- [play_character_sound](functions-3.md#play_character_sound)
- [play_character_sound_if_no_flag](functions-3.md#play_character_sound_if_no_flag)
@@ -1123,11 +1124,11 @@
- network_utils.h
- - [network_get_player_text_color_string](functions-3.md#network_get_player_text_color_string)
- - [network_global_index_from_local](functions-3.md#network_global_index_from_local)
- - [network_is_moderator](functions-3.md#network_is_moderator)
- - [network_is_server](functions-3.md#network_is_server)
- - [network_local_index_from_global](functions-3.md#network_local_index_from_global)
+ - [network_get_player_text_color_string](functions-4.md#network_get_player_text_color_string)
+ - [network_global_index_from_local](functions-4.md#network_global_index_from_local)
+ - [network_is_moderator](functions-4.md#network_is_moderator)
+ - [network_is_server](functions-4.md#network_is_server)
+ - [network_local_index_from_global](functions-4.md#network_local_index_from_global)
diff --git a/src/game/characters.h b/src/game/characters.h
index c83d1312..96f872c1 100644
--- a/src/game/characters.h
+++ b/src/game/characters.h
@@ -3,6 +3,7 @@
#include "PR/ultratypes.h"
#include "types.h"
#include "pc/configfile.h"
+#include "mario_animation_ids.h"
// NOTE: do not include any additional headers
#define PALETTE_PRESET_MAX 33
@@ -367,6 +368,7 @@ void play_character_sound_offset(struct MarioState* m, enum CharacterSound chara
void play_character_sound_if_no_flag(struct MarioState* m, enum CharacterSound characterSound, u32 flags);
f32 get_character_anim_offset(struct MarioState* m);
+s32 get_character_anim(struct MarioState* m, enum CharacterAnimID characterAnim);
void update_character_anim_offset(struct MarioState* m);
#endif // CHARACTERS_H
diff --git a/src/pc/debug_context.h b/src/pc/debug_context.h
index c6d0e26f..18990e6c 100644
--- a/src/pc/debug_context.h
+++ b/src/pc/debug_context.h
@@ -5,6 +5,7 @@
#define CTX_BEGIN(_ctx) debug_context_begin(_ctx)
#define CTX_END(_ctx) debug_context_end(_ctx)
#define CTX_WITHIN(_ctx) debug_context_within(_ctx)
+#define CTX_EXTENT(__ctx, __func) CTX_BEGIN(__ctx); __func(); CTX_END(__ctx);
enum DebugContext {
CTX_NONE,
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 60c2172c..5fcf03d1 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -11929,6 +11929,25 @@ int smlua_func_get_character(lua_State* L) {
return 1;
}
+int smlua_func_get_character_anim(lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 2) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_character_anim", 2, top);
+ return 0;
+ }
+
+ struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_character_anim"); return 0; }
+ int characterAnim = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_character_anim"); return 0; }
+
+ lua_pushinteger(L, get_character_anim(m, characterAnim));
+
+ return 1;
+}
+
int smlua_func_get_character_anim_offset(lua_State* L) {
if (L == NULL) { return 0; }
@@ -27583,7 +27602,7 @@ int smlua_func_smlua_level_util_get_info_from_short_name(lua_State* L) {
return 0;
}
- const char* shortName = smlua_to_string(L, 1);
+ char* shortName = (char*)smlua_to_cobject(L, 1, LOT_NONE);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "smlua_level_util_get_info_from_short_name"); return 0; }
smlua_push_object(L, LOT_CUSTOMLEVELINFO, smlua_level_util_get_info_from_short_name(shortName));
@@ -31601,6 +31620,7 @@ void smlua_bind_functions_autogen(void) {
// characters.h
smlua_bind_function(L, "get_character", smlua_func_get_character);
+ smlua_bind_function(L, "get_character_anim", smlua_func_get_character_anim);
smlua_bind_function(L, "get_character_anim_offset", smlua_func_get_character_anim_offset);
smlua_bind_function(L, "play_character_sound", smlua_func_play_character_sound);
smlua_bind_function(L, "play_character_sound_if_no_flag", smlua_func_play_character_sound_if_no_flag);
diff --git a/src/pc/lua/utils/smlua_level_utils.c b/src/pc/lua/utils/smlua_level_utils.c
index fcd06ab7..e1b00679 100644
--- a/src/pc/lua/utils/smlua_level_utils.c
+++ b/src/pc/lua/utils/smlua_level_utils.c
@@ -51,7 +51,7 @@ struct CustomLevelInfo* smlua_level_util_get_info(s16 levelNum) {
return NULL;
}
-struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(const char* shortName) {
+struct CustomLevelInfo* smlua_level_util_get_info_from_short_name(char* shortName) {
struct CustomLevelInfo* node = sCustomLevelHead;
while (node != NULL) {
if (!strcmp(node->shortName, shortName)) {