diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index 836d72660..99968d7e9 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -71,7 +71,8 @@ override_field_types = { override_field_mutable = { "NetworkPlayer": [ "overrideModelIndex", - "overridePalette" + "overridePalette", + "overridePaletteIndex" ], "Animation": [ "values", @@ -88,6 +89,7 @@ override_field_invisible = { } override_field_deprecated = { + "NetworkPlayer": [ "paletteIndex", "overridePaletteIndex", "overridePaletteIndexLp" ] } override_field_immutable = { diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index e360b92ad..c63b42a64 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -1123,7 +1123,10 @@ --- @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 diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 74efa4543..a81a09b83 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -1245,38 +1245,41 @@ static struct LuaObjectField sNametagsSettingsFields[LUA_NAMETAGS_SETTINGS_FIELD { "showSelfTag", LVT_BOOL, offsetof(struct NametagsSettings, showSelfTag), false, LOT_NONE }, }; -#define LUA_NETWORK_PLAYER_FIELD_COUNT 28 +#define LUA_NETWORK_PLAYER_FIELD_COUNT 31 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 }, - { "currAreaIndex", LVT_S16, offsetof(struct NetworkPlayer, currAreaIndex), true, LOT_NONE }, - { "currAreaSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currAreaSyncValid), true, LOT_NONE }, - { "currCourseNum", LVT_S16, offsetof(struct NetworkPlayer, currCourseNum), true, LOT_NONE }, - { "currLevelAreaSeqId", LVT_U16, offsetof(struct NetworkPlayer, currLevelAreaSeqId), true, LOT_NONE }, - { "currLevelNum", LVT_S16, offsetof(struct NetworkPlayer, currLevelNum), true, LOT_NONE }, - { "currLevelSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currLevelSyncValid), true, LOT_NONE }, - { "currPositionValid", LVT_BOOL, offsetof(struct NetworkPlayer, currPositionValid), true, LOT_NONE }, - { "description", LVT_STRING, offsetof(struct NetworkPlayer, description), true, LOT_NONE }, - { "descriptionA", LVT_U8, offsetof(struct NetworkPlayer, descriptionA), true, LOT_NONE }, - { "descriptionB", LVT_U8, offsetof(struct NetworkPlayer, descriptionB), true, LOT_NONE }, - { "descriptionG", LVT_U8, offsetof(struct NetworkPlayer, descriptionG), true, LOT_NONE }, - { "descriptionR", LVT_U8, offsetof(struct NetworkPlayer, descriptionR), true, LOT_NONE }, - { "fadeOpacity", LVT_U8, offsetof(struct NetworkPlayer, fadeOpacity), true, LOT_NONE }, - { "globalIndex", LVT_U8, offsetof(struct NetworkPlayer, globalIndex), true, LOT_NONE }, - { "lastPingSent", LVT_F32, offsetof(struct NetworkPlayer, lastPingSent), true, LOT_NONE }, - { "lastReceived", LVT_F32, offsetof(struct NetworkPlayer, lastReceived), true, LOT_NONE }, - { "lastSent", LVT_F32, offsetof(struct NetworkPlayer, lastSent), true, LOT_NONE }, - { "localIndex", LVT_U8, offsetof(struct NetworkPlayer, localIndex), true, LOT_NONE }, - { "modelIndex", LVT_U8, offsetof(struct NetworkPlayer, modelIndex), true, LOT_NONE }, - { "name", LVT_STRING, offsetof(struct NetworkPlayer, name), true, LOT_NONE }, - { "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 }, - { "palette", LVT_COBJECT, offsetof(struct NetworkPlayer, palette), true, LOT_PLAYERPALETTE }, - { "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 - { "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE }, + { "connected", LVT_BOOL, offsetof(struct NetworkPlayer, connected), true, LOT_NONE }, + { "currActNum", LVT_S16, offsetof(struct NetworkPlayer, currActNum), true, LOT_NONE }, + { "currAreaIndex", LVT_S16, offsetof(struct NetworkPlayer, currAreaIndex), true, LOT_NONE }, + { "currAreaSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currAreaSyncValid), true, LOT_NONE }, + { "currCourseNum", LVT_S16, offsetof(struct NetworkPlayer, currCourseNum), true, LOT_NONE }, + { "currLevelAreaSeqId", LVT_U16, offsetof(struct NetworkPlayer, currLevelAreaSeqId), true, LOT_NONE }, + { "currLevelNum", LVT_S16, offsetof(struct NetworkPlayer, currLevelNum), true, LOT_NONE }, + { "currLevelSyncValid", LVT_BOOL, offsetof(struct NetworkPlayer, currLevelSyncValid), true, LOT_NONE }, + { "currPositionValid", LVT_BOOL, offsetof(struct NetworkPlayer, currPositionValid), true, LOT_NONE }, + { "description", LVT_STRING, offsetof(struct NetworkPlayer, description), true, LOT_NONE }, + { "descriptionA", LVT_U8, offsetof(struct NetworkPlayer, descriptionA), true, LOT_NONE }, + { "descriptionB", LVT_U8, offsetof(struct NetworkPlayer, descriptionB), true, LOT_NONE }, + { "descriptionG", LVT_U8, offsetof(struct NetworkPlayer, descriptionG), true, LOT_NONE }, + { "descriptionR", LVT_U8, offsetof(struct NetworkPlayer, descriptionR), true, LOT_NONE }, + { "fadeOpacity", LVT_U8, offsetof(struct NetworkPlayer, fadeOpacity), true, LOT_NONE }, + { "globalIndex", LVT_U8, offsetof(struct NetworkPlayer, globalIndex), true, LOT_NONE }, + { "lastPingSent", LVT_F32, offsetof(struct NetworkPlayer, lastPingSent), true, LOT_NONE }, + { "lastReceived", LVT_F32, offsetof(struct NetworkPlayer, lastReceived), true, LOT_NONE }, + { "lastSent", LVT_F32, offsetof(struct NetworkPlayer, lastSent), true, LOT_NONE }, + { "localIndex", LVT_U8, offsetof(struct NetworkPlayer, localIndex), true, LOT_NONE }, + { "modelIndex", LVT_U8, offsetof(struct NetworkPlayer, modelIndex), true, LOT_NONE }, + { "name", LVT_STRING, offsetof(struct NetworkPlayer, name), true, LOT_NONE }, + { "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 + { "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE }, }; #define LUA_OBJECT_FIELD_COUNT 759 diff --git a/src/pc/network/network_player.h b/src/pc/network/network_player.h index 91dce8c06..7e6425174 100644 --- a/src/pc/network/network_player.h +++ b/src/pc/network/network_player.h @@ -57,6 +57,11 @@ 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[];