Fix compile errors from recent merges

This commit is contained in:
MysterD 2023-10-27 18:02:04 -07:00
parent e02a68e221
commit 27b799055c
8 changed files with 162 additions and 110 deletions

View file

@ -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)

View file

@ -1898,6 +1898,27 @@
<br />
## [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:](#)
<br />
## [get_character_anim_offset](#get_character_anim_offset)
### Lua Example
@ -8711,108 +8732,6 @@
[:arrow_up_small:](#)
<br />
---
# functions from network_utils.h
<br />
## [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:](#)
<br />
## [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:](#)
<br />
## [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:](#)
<br />
## [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:](#)
<br />
## [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:](#)
<br />
---

View file

@ -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
<br />
## [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:](#)
<br />
## [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:](#)
<br />
## [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:](#)
<br />
## [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:](#)
<br />
## [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:](#)
<br />
---
# 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:](#)

View file

@ -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 @@
<br />
- 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)
<br />

View file

@ -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

View file

@ -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,

View file

@ -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);

View file

@ -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)) {