Remove legacy struct fields, fix a function name

This commit is contained in:
Agent X 2024-06-26 18:38:08 -04:00
parent f49da88ed9
commit 971ddc00cd
14 changed files with 53 additions and 73 deletions

View File

@ -71,8 +71,7 @@ override_field_types = {
override_field_mutable = {
"NetworkPlayer": [
"overrideModelIndex",
"overridePalette",
"overridePaletteIndex",
"overridePalette"
],
"Animation": [
"values",
@ -89,8 +88,6 @@ override_field_invisible = {
}
override_field_deprecated = {
"ServerSettings": [ "enableCheats" ],
"NetworkPlayer": [ "paletteIndex", "overridePaletteIndex", "overridePaletteIndexLp" ]
}
override_field_immutable = {

View File

@ -5413,7 +5413,7 @@ function network_player_is_override_palette_same(np)
end
--- @param np NetworkPlayer
function network_player_reset_override_palette_color(np)
function network_player_reset_override_palette(np)
-- ...
end

View File

@ -1123,10 +1123,7 @@
--- @field public onRxSeqId integer
--- @field public overrideModelIndex integer
--- @field public overridePalette PlayerPalette
--- @field public overridePaletteIndex integer
--- @field public overridePaletteIndexLp integer
--- @field public palette PlayerPalette
--- @field public paletteIndex integer
--- @field public ping integer
--- @field public type integer
@ -2012,7 +2009,6 @@
--- @class ServerSettings
--- @field public bouncyLevelBounds BouncyLevelBounds
--- @field public bubbleDeath integer
--- @field public enableCheats integer
--- @field public enablePlayerList integer
--- @field public enablePlayersInLevelDisplay integer
--- @field public headlessServer integer

View File

@ -1377,10 +1377,10 @@
<br />
## [network_player_reset_override_palette_color](#network_player_reset_override_palette_color)
## [network_player_reset_override_palette](#network_player_reset_override_palette)
### Lua Example
`network_player_reset_override_palette_color(np)`
`network_player_reset_override_palette(np)`
### Parameters
| Field | Type |
@ -1391,7 +1391,7 @@
- None
### C Prototype
`void network_player_reset_override_palette_color(struct NetworkPlayer *np);`
`void network_player_reset_override_palette(struct NetworkPlayer *np);`
[:arrow_up_small:](#)

View File

@ -1201,7 +1201,7 @@
- [network_player_get_override_palette_color_channel](functions-4.md#network_player_get_override_palette_color_channel)
- [network_player_get_palette_color_channel](functions-4.md#network_player_get_palette_color_channel)
- [network_player_is_override_palette_same](functions-4.md#network_player_is_override_palette_same)
- [network_player_reset_override_palette_color](functions-4.md#network_player_reset_override_palette_color)
- [network_player_reset_override_palette](functions-4.md#network_player_reset_override_palette)
- [network_player_set_description](functions-4.md#network_player_set_description)
- [network_player_set_override_palette_color](functions-4.md#network_player_set_override_palette_color)

View File

@ -1245,7 +1245,7 @@ static struct LuaObjectField sNametagsSettingsFields[LUA_NAMETAGS_SETTINGS_FIELD
{ "showSelfTag", LVT_BOOL, offsetof(struct NametagsSettings, showSelfTag), false, LOT_NONE },
};
#define LUA_NETWORK_PLAYER_FIELD_COUNT 31
#define LUA_NETWORK_PLAYER_FIELD_COUNT 28
static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT] = {
{ "connected", LVT_BOOL, offsetof(struct NetworkPlayer, connected), true, LOT_NONE },
{ "currActNum", LVT_S16, offsetof(struct NetworkPlayer, currActNum), true, LOT_NONE },
@ -1272,10 +1272,7 @@ static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT
{ "onRxSeqId", LVT_U8, offsetof(struct NetworkPlayer, onRxSeqId), true, LOT_NONE },
{ "overrideModelIndex", LVT_U8, offsetof(struct NetworkPlayer, overrideModelIndex), false, LOT_NONE },
{ "overridePalette", LVT_COBJECT, offsetof(struct NetworkPlayer, overridePalette), false, LOT_PLAYERPALETTE },
{ "overridePaletteIndex", LVT_U8, offsetof(struct NetworkPlayer, overridePaletteIndex), false, LOT_NONE },
{ "overridePaletteIndexLp", LVT_U8, offsetof(struct NetworkPlayer, overridePaletteIndexLp), true, LOT_NONE },
{ "palette", LVT_COBJECT, offsetof(struct NetworkPlayer, palette), true, LOT_PLAYERPALETTE },
{ "paletteIndex", LVT_U8, offsetof(struct NetworkPlayer, paletteIndex), true, LOT_NONE },
{ "ping", LVT_U32, offsetof(struct NetworkPlayer, ping), true, LOT_NONE },
// { "rxPacketHash", LOT_???, offsetof(struct NetworkPlayer, rxPacketHash), true, LOT_??? }, <--- UNIMPLEMENTED
// { "rxSeqIds", LOT_???, offsetof(struct NetworkPlayer, rxSeqIds), true, LOT_??? }, <--- UNIMPLEMENTED
@ -2211,11 +2208,10 @@ static struct LuaObjectField sRayIntersectionInfoFields[LUA_RAY_INTERSECTION_INF
{ "surface", LVT_COBJECT_P, offsetof(struct RayIntersectionInfo, surface), false, LOT_SURFACE },
};
#define LUA_SERVER_SETTINGS_FIELD_COUNT 13
#define LUA_SERVER_SETTINGS_FIELD_COUNT 12
static struct LuaObjectField sServerSettingsFields[LUA_SERVER_SETTINGS_FIELD_COUNT] = {
{ "bouncyLevelBounds", LVT_S32, offsetof(struct ServerSettings, bouncyLevelBounds), false, LOT_NONE },
{ "bubbleDeath", LVT_U8, offsetof(struct ServerSettings, bubbleDeath), false, LOT_NONE },
{ "enableCheats", LVT_U8, offsetof(struct ServerSettings, enableCheats), false, LOT_NONE },
{ "enablePlayerList", LVT_U8, offsetof(struct ServerSettings, enablePlayerList), false, LOT_NONE },
{ "enablePlayersInLevelDisplay", LVT_U8, offsetof(struct ServerSettings, enablePlayersInLevelDisplay), false, LOT_NONE },
{ "headlessServer", LVT_U8, offsetof(struct ServerSettings, headlessServer), false, LOT_NONE },

View File

@ -72,7 +72,7 @@ int smlua_func_atan2s(lua_State* L) {
int smlua_func_init_mario_after_warp(lua_State* L) {
if (network_player_connected_count() >= 2) {
LOG_LUA_LINE("init_mario_after_warp can only be used in single-player");
LOG_LUA_LINE("init_mario_after_warp() can only be used in singleplayer");
return 0;
}
@ -104,7 +104,7 @@ int smlua_func_initiate_warp(lua_State* L) {
int smlua_func_reset_level(lua_State* L) {
if (network_player_connected_count() >= 2) {
LOG_LUA_LINE("reset_level() can only be used in single-player");
LOG_LUA_LINE("reset_level() can only be used in singleplayer");
return 0;
}

View File

@ -20804,19 +20804,19 @@ int smlua_func_network_player_is_override_palette_same(lua_State* L) {
return 1;
}
int smlua_func_network_player_reset_override_palette_color(lua_State* L) {
int smlua_func_network_player_reset_override_palette(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 1) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_reset_override_palette_color", 1, top);
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_reset_override_palette", 1, top);
return 0;
}
struct NetworkPlayer* np = (struct NetworkPlayer*)smlua_to_cobject(L, 1, LOT_NETWORKPLAYER);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_reset_override_palette_color"); return 0; }
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_reset_override_palette"); return 0; }
network_player_reset_override_palette_color(np);
network_player_reset_override_palette(np);
return 1;
}
@ -33923,7 +33923,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "network_player_get_override_palette_color_channel", smlua_func_network_player_get_override_palette_color_channel);
smlua_bind_function(L, "network_player_get_palette_color_channel", smlua_func_network_player_get_palette_color_channel);
smlua_bind_function(L, "network_player_is_override_palette_same", smlua_func_network_player_is_override_palette_same);
smlua_bind_function(L, "network_player_reset_override_palette_color", smlua_func_network_player_reset_override_palette_color);
smlua_bind_function(L, "network_player_reset_override_palette", smlua_func_network_player_reset_override_palette);
smlua_bind_function(L, "network_player_set_description", smlua_func_network_player_set_description);
smlua_bind_function(L, "network_player_set_override_palette_color", smlua_func_network_player_set_override_palette_color);

View File

@ -141,7 +141,7 @@ int smlua_hook_event(lua_State* L) {
int ref = luaL_ref(L, LUA_REGISTRYINDEX);
if (ref == -1) {
LOG_LUA_LINE("tried to hook undefined function to '%s'", LuaHookedEventTypeName[hookType]);
LOG_LUA_LINE("Tried to hook undefined function to '%s'", LuaHookedEventTypeName[hookType]);
return 0;
}

View File

@ -44,7 +44,7 @@ static bool smlua_sync_table_unwind(int syncTableIndex, int keyIndex) {
// get key
sUnwoundLnts[sUnwoundLntsCount++] = smlua_to_lnt(L, keyIndex);
if (!gSmLuaConvertSuccess) {
LOG_LUA_LINE("attempted to unwind sync table with invalid key type");
LOG_LUA_LINE("Attempted to unwind sync table with invalid key type");
return false;
}
@ -55,7 +55,7 @@ static bool smlua_sync_table_unwind(int syncTableIndex, int keyIndex) {
while (true) {
// make sure we remain within limits
if (sUnwoundLntsCount >= MAX_UNWOUND_LNT) {
LOG_LUA_LINE("attempted to unwind sync table past its limit");
LOG_LUA_LINE("Attempted to unwind sync table past its limit");
return false;
}
@ -76,7 +76,7 @@ static bool smlua_sync_table_unwind(int syncTableIndex, int keyIndex) {
lua_pop(L, 1); // pop _name value
if (!gSmLuaConvertSuccess) {
LOG_LUA_LINE("attempted to unwind sync table with invalid parent");
LOG_LUA_LINE("Attempted to unwind sync table with invalid parent");
lua_pop(L, 1); // pop iterative _parent
return false;
}
@ -90,7 +90,7 @@ static bool smlua_sync_table_unwind(int syncTableIndex, int keyIndex) {
// validate parent type
if (parentType != LUA_TTABLE) {
if (parentType != LUA_TNIL) {
LOG_LUA_LINE("attempted to unwind sync table into an invalid parent");
LOG_LUA_LINE("Attempted to unwind sync table into an invalid parent");
return false;
}
break;
@ -106,7 +106,7 @@ static bool smlua_sync_table_unwind(int syncTableIndex, int keyIndex) {
}
if (unwoundSize >= MAX_UNWOUND_SIZE) {
LOG_LUA_LINE("attempted to unwind sync table with too long of a key/parent length");
LOG_LUA_LINE("Attempted to unwind sync table with too long of a key/parent length");
return false;
}

View File

@ -76,7 +76,6 @@ struct ServerSettings gServerSettings = {
.bouncyLevelBounds = BOUNCY_LEVEL_BOUNDS_OFF,
.playerKnockbackStrength = 25,
.skipIntro = FALSE,
.enableCheats = FALSE,
.bubbleDeath = TRUE,
.enablePlayersInLevelDisplay = TRUE,
.enablePlayerList = TRUE,
@ -124,7 +123,6 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) {
gServerSettings.playerKnockbackStrength = configPlayerKnockbackStrength;
gServerSettings.stayInLevelAfterStar = configStayInLevelAfterStar;
gServerSettings.skipIntro = gCLIOpts.skipIntro ? TRUE : configSkipIntro;
gServerSettings.enableCheats = 0;
gServerSettings.bubbleDeath = configBubbleDeath;
gServerSettings.enablePlayersInLevelDisplay = TRUE;
gServerSettings.enablePlayerList = TRUE;
@ -734,7 +732,6 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
reset_window_title();
gDjuiLuaErrorTimeout = 0;
djui_panel_shutdown();
extern bool gDjuiInMainMenu;
if (!gDjuiInMainMenu) {

View File

@ -75,7 +75,6 @@ struct ServerSettings {
u8 playerKnockbackStrength;
u8 stayInLevelAfterStar;
u8 skipIntro;
u8 enableCheats;
u8 bubbleDeath;
u8 enablePlayersInLevelDisplay;
u8 enablePlayerList;

View File

@ -148,7 +148,7 @@ void network_player_set_override_palette_color(struct NetworkPlayer *np, enum Pl
np->overridePalette.parts[part][2] = color[2];
}
void network_player_reset_override_palette_color(struct NetworkPlayer *np) {
void network_player_reset_override_palette(struct NetworkPlayer *np) {
if (np == NULL) { return; }
np->overridePalette = np->palette;

View File

@ -57,11 +57,6 @@ struct NetworkPlayer {
u16 rxSeqIds[MAX_RX_SEQ_IDS];
u32 rxPacketHash[MAX_RX_SEQ_IDS];
// legacy fields to allow mods not to fully break (they don't do anything anymore)
u8 paletteIndex;
u8 overridePaletteIndex;
u8 overridePaletteIndexLp;
};
extern struct NetworkPlayer gNetworkPlayers[];
@ -82,7 +77,7 @@ struct NetworkPlayer* get_network_player_smallest_global(void);
u8 network_player_get_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index);
u8 network_player_get_override_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index);
void network_player_set_override_palette_color(struct NetworkPlayer *np, enum PlayerPart part, Color color);
void network_player_reset_override_palette_color(struct NetworkPlayer *np);
void network_player_reset_override_palette(struct NetworkPlayer *np);
bool network_player_is_override_palette_same(struct NetworkPlayer *np);
void network_player_update(void);