Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
65bb92c
Allow mods to edit and add characters, allow mods to add palettes
EmeraldLoc Feb 18, 2026
26f83c0
Forgot to add packet character file, make active field invisible in p…
EmeraldLoc Feb 18, 2026
537f356
Readd return that was accidently removed somehow
EmeraldLoc Feb 18, 2026
3847f99
Begin writing documentation, make `character_allocate` pass name as a…
EmeraldLoc Feb 18, 2026
1530bb0
Finish up docs, and finish up character documentation
EmeraldLoc Feb 18, 2026
09fa667
Rerun autogen, add docs for preset palette functions
EmeraldLoc Feb 18, 2026
e445627
Update documentation for `get_allocated_character_from_index`
EmeraldLoc Feb 18, 2026
19d07c0
Changes related to docs, renamed `CT_MAX` to `CT_COUNT` for consisten…
EmeraldLoc Feb 18, 2026
75f00d1
Make modelIndex and overrideModelIndex a u16, increment `MAX_CHARACTE…
EmeraldLoc Feb 18, 2026
8aa3270
Fix
EmeraldLoc Feb 19, 2026
f9e4262
Update docs frfr
EmeraldLoc Feb 19, 2026
ce035c9
Increase packet limit
EmeraldLoc Feb 20, 2026
c969f8d
Remove temp logging
EmeraldLoc Feb 20, 2026
5e17b8e
Remove unecessary adjustments
EmeraldLoc Feb 27, 2026
f1df55a
Remove that
EmeraldLoc Feb 27, 2026
1a44998
Rename character select category, allow it to also check for category…
EmeraldLoc Feb 28, 2026
2aa7e76
Sync character with overrideModelIndex instead of on change in ui and…
EmeraldLoc Mar 4, 2026
f60eb78
Fix big overflow oversight
EmeraldLoc Mar 4, 2026
2e68d14
set default type allocation to index
EmeraldLoc Mar 7, 2026
a38273f
Fix formatting (oops)
EmeraldLoc Mar 23, 2026
2373467
Merge branch 'dev' into char-selector
EmeraldLoc Apr 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions autogen/convert_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"src/game/obj_behaviors.c",
"src/game/obj_behaviors_2.c",
"src/game/platform_displacement.h",
"src/game/player_palette.h",
"src/game/spawn_sound.h",
"src/game/object_list_processor.h",
"src/game/behavior_actions.h",
Expand Down Expand Up @@ -107,6 +108,7 @@
"src/audio/external.h": [ " func_" ],
"src/engine/surface_load.h": [ "load_area_terrain", "alloc_surface_pools", "clear_dynamic_surfaces", "get_area_terrain_size" ],
"src/engine/surface_collision.h": [ " debug_", "f32_find_wall_collision" ],
"src/game/characters.h": [ "reset_all_characters" ],
"src/game/mario_actions_airborne.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_automatic.c": [ "^[us]32 act_.*" ],
"src/game/mario_actions_cutscene.c": [ "^[us]32 act_.*", " geo_", "spawn_obj", "print_displaying_credits_entry" ],
Expand All @@ -126,6 +128,7 @@
"src/game/object_helpers.c": [ "spawn_obj", "^bhv_", "geo_", "abs[fi]", "^bit_shift", "_debug$", "^stub_", "_set_model", "cur_obj_set_direction_table", "cur_obj_progress_direction_table" ],
"src/game/obj_behaviors.c": [ "debug_", "geo_", "turn_obj_away_from_surface"],
"src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
"src/game/player_palette.h": [ "player_.*" ],
"src/game/spawn_sound.h": [ "exec_anim_sound_state" ],
"src/game/level_info.h": [ "_name_table", "convert_string_" ],
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
Expand Down
71 changes: 38 additions & 33 deletions autogen/convert_structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,11 @@
"Object": { "oAnimations": "ObjectAnimPointer*" },
}

override_field_mutable = {
"NetworkPlayer": [
"overrideModelIndex",
"overridePalette",
"overridePaletteIndex",
],
}

override_field_invisible = {
"Mod": [ "files", "showedScriptWarning" ],
"Camera": [ "paletteEditorCapState" ],
"Character": [ "moddedAnims", "modAudioSounds", "modIndexForAudio" ],
"PresetPalette": [ "active" ],
"MarioState": [ "visibleToEnemies" ],
"NetworkPlayer": [ "gag", "moderator", "discordId", "rxPacketHash", "rxSeqIds" ],
"GraphNode": [ "_guard1", "_guard2", "padding" ],
Expand All @@ -108,10 +102,11 @@
}

override_field_immutable = {
"MarioState": [ "playerIndex", "controller", "marioObj", "marioBodyState", "statusForCamera", "area", "dialogId" ],
"Character": [ "name", "hudHeadTexture", "anim*", "sound*" ],
"PresetPalette": [ "name" ],
"MarioState": [ "playerIndex", "controller", "marioObj", "marioBodyState", "statusForCamera", "area", "dialogId", "character" ],
"MarioAnimation": [ "animDmaTable" ],
"ObjectNode": [ "next", "prev" ],
"Character": [ "*" ],
"NetworkPlayer": [ "*" ],
"TextureInfo": [ "*" ],
"Object": ["oSyncID", "coopFlags", "oChainChompSegments", "oWigglerSegments", "oHauntedChairUnk100", "oTTCTreadmillBigSurface", "oTTCTreadmillSmallSurface", "bhvStackIndex", "respawnInfoType", "numSurfaces", "bhvStack" ],
Expand Down Expand Up @@ -147,6 +142,11 @@
"StaticObjectCollision": [ "*" ],
}

override_field_mutable = {
"NetworkPlayer": [ "overrideModelIndex", "overridePalette", "overridePaletteIndex", ],
"Character": [ "animOffsetEnabled", "animOffsetLowYPoint", "animOffsetFeet", "animOffsetHand" ]
}

override_field_version_excludes = {
"oCameraLakituUnk104": "VERSION_JP",
"oCoinUnk1B0": "VERSION_JP",
Expand All @@ -155,7 +155,7 @@
override_allowed_structs = {
"src/pc/network/network.h": [ "ServerSettings", "NametagsSettings" ],
"src/pc/djui/djui_types.h": [ "DjuiColor" ],
"src/game/player_palette.h": [ "PlayerPalette" ],
"src/game/player_palette.h": [ "PlayerPalette", "PresetPalette" ],
"src/game/ingame_menu.h" : [ "DialogEntry" ],
"include/PR/gbi.h": [ "Gfx", "Vtx" ],
}
Expand Down Expand Up @@ -388,10 +388,8 @@ def output_fuzz_struct(struct):
fid, ftype, fimmutable, lvt, lot, size = get_struct_field_info(struct, field)
if fimmutable == 'true':
continue
if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
continue

if is_field_overridden(sid, fid, override_field_invisible):
continue
if '(' in fid or '[' in fid or ']' in fid:
continue

Expand Down Expand Up @@ -470,6 +468,19 @@ def build_vec_types():

############################################################################

def is_field_overridden(sid, fid, override_dict):
if sid in override_dict:
for pattern in override_dict[sid]:
if pattern == '*':
return True
if pattern.endswith('*') and fid.startswith(pattern[:-1]):
return True
if fid == pattern:
return True
return False

############################################################################

sLuaObjectTable = []
sLotAutoGenList = []

Expand All @@ -488,13 +499,11 @@ def get_struct_field_info(struct, field):
if lvt.startswith('LVT_') and lvt.endswith('_P') and 'OBJECT' not in lvt and 'COLLISION' not in lvt and 'TRAJECTORY' not in lvt:
fimmutable = 'true'

if sid in override_field_immutable:
if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]:
fimmutable = 'true'
if is_field_overridden(sid, fid, override_field_immutable):
fimmutable = 'true'

if sid in override_field_mutable:
if fid in override_field_mutable[sid] or '*' in override_field_mutable[sid]:
fimmutable = 'false'
if is_field_overridden(sid, fid, override_field_mutable):
fimmutable = 'false'

if ftype == cobject_function_identifier:
fimmutable = 'true'
Expand Down Expand Up @@ -530,9 +539,8 @@ def build_struct(struct):
if re.search(r'\[([^\]]+)\]', ftype):
ftype = re.sub(r'\[[^\]]*\]', '', ftype).strip()

if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
continue
if is_field_overridden(sid, fid, override_field_invisible):
continue

name = sid
if sid in reversed_override_types:
Expand Down Expand Up @@ -709,13 +717,11 @@ def doc_struct_field(struct, field):
fid, ftype, fimmutable, lvt, lot, size = get_struct_field_info(struct, field)

sid = struct['identifier']
if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
return '', False
if is_field_overridden(sid, fid, override_field_invisible):
return '', False

if sid in override_field_deprecated:
if fid in override_field_deprecated[sid]:
return '', False
if is_field_overridden(sid, fid, override_field_deprecated):
return '', False

if '???' in lvt or '???' in lot:
return '', False
Expand Down Expand Up @@ -842,9 +848,8 @@ def def_struct(struct):
for field in struct['fields']:
fid, ftype, fimmutable, lvt, lot, size = get_struct_field_info(struct, field)

if sid in override_field_invisible:
if fid in override_field_invisible[sid]:
continue
if is_field_overridden(sid, fid, override_field_invisible):
continue

if '???' in lvt or '???' in lot:
continue
Expand Down
8 changes: 7 additions & 1 deletion autogen/lua_constants/deprecated.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ sqr = math.sqr
sqrf = math.sqr
clamp = math.clamp
clampf = math.clamp
hypotf = math.hypot
hypotf = math.hypot

-------------------------
-- Character functions --
-------------------------

CT_MAX = 5
62 changes: 42 additions & 20 deletions autogen/lua_definitions/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2272,20 +2272,31 @@ CAM_EVENT_START_END_WAVING = 12
--- @type integer
CAM_EVENT_START_CREDITS = 13

CT_MARIO = 0 --- @type CharacterType
CT_LUIGI = 1 --- @type CharacterType
CT_TOAD = 2 --- @type CharacterType
CT_WALUIGI = 3 --- @type CharacterType
CT_WARIO = 4 --- @type CharacterType
CT_MAX = 5 --- @type CharacterType
--- @type integer
MAX_CHARACTERS = 256

--- @type integer
MAX_CHARACTER_NAME_LEN = 128

--- @type integer
MAX_CHARACTER_AUDIOS_PER_SOUND = 8

CT_UNALLOCATED = -1 --- @type CharacterType
CT_MARIO = 0 --- @type CharacterType
CT_LUIGI = 1 --- @type CharacterType
CT_TOAD = 2 --- @type CharacterType
CT_WALUIGI = 3 --- @type CharacterType
CT_WARIO = 4 --- @type CharacterType
CT_COUNT = 5 --- @type CharacterType

--- @alias CharacterType
--- | `CT_UNALLOCATED`
--- | `CT_MARIO`
--- | `CT_LUIGI`
--- | `CT_TOAD`
--- | `CT_WALUIGI`
--- | `CT_WARIO`
--- | `CT_MAX`
--- | `CT_COUNT`

CHAR_SOUND_YAH_WAH_HOO = 0 --- @type CharacterSound
CHAR_SOUND_HOOHOO = 1 --- @type CharacterSound
Expand Down Expand Up @@ -4706,7 +4717,7 @@ SYNC_DISTANCE_ONLY_EVENTS = -2
SYNC_DISTANCE_INFINITE = 0

--- @type integer
PACKET_LENGTH = 3000
PACKET_LENGTH = 3500

NS_SOCKET = 0 --- @type NetworkSystemType
NS_COOPNET = 1 --- @type NetworkSystemType
Expand Down Expand Up @@ -6852,7 +6863,16 @@ D_CBUTTONS = CONT_D
PALETTES_DIRECTORY = "palettes"

--- @type integer
MAX_PRESET_PALETTES = 128
MAX_PALETTE_NAME = 64

--- @type integer
MAX_PRESET_PALETTES = 256

--- @type integer
MAX_NORMAL_PRESET_PALETTES = 128

--- @type integer
MAX_MODDED_PRESET_PALETTES = 128

PANTS = 0 --- @type PlayerPart
SHIRT = 1 --- @type PlayerPart
Expand Down Expand Up @@ -8721,17 +8741,18 @@ E_MODEL_TOAD_PLAYER = 367 --- @type ModelExtendedId
E_MODEL_TOADS_CAP = 368 --- @type ModelExtendedId
E_MODEL_TOADS_METAL_CAP = 369 --- @type ModelExtendedId
E_MODEL_TOADS_WING_CAP = 370 --- @type ModelExtendedId
E_MODEL_WALUIGI = 371 --- @type ModelExtendedId
E_MODEL_WALUIGIS_CAP = 372 --- @type ModelExtendedId
E_MODEL_WALUIGIS_METAL_CAP = 373 --- @type ModelExtendedId
E_MODEL_WALUIGIS_WING_CAP = 374 --- @type ModelExtendedId
E_MODEL_WALUIGIS_WINGED_METAL_CAP = 375 --- @type ModelExtendedId
E_MODEL_WARIO = 376 --- @type ModelExtendedId
E_MODEL_WARIOS_CAP = 377 --- @type ModelExtendedId
E_MODEL_WARIOS_METAL_CAP = 378 --- @type ModelExtendedId
E_MODEL_WARIOS_WING_CAP = 379 --- @type ModelExtendedId
E_MODEL_WARIOS_WINGED_METAL_CAP = 380 --- @type ModelExtendedId
E_MODEL_MAX = 381 --- @type ModelExtendedId
E_MODEL_TOADS_WINGED_METAL_CAP = 371 --- @type ModelExtendedId
E_MODEL_WALUIGI = 372 --- @type ModelExtendedId
E_MODEL_WALUIGIS_CAP = 373 --- @type ModelExtendedId
E_MODEL_WALUIGIS_METAL_CAP = 374 --- @type ModelExtendedId
E_MODEL_WALUIGIS_WING_CAP = 375 --- @type ModelExtendedId
E_MODEL_WALUIGIS_WINGED_METAL_CAP = 376 --- @type ModelExtendedId
E_MODEL_WARIO = 377 --- @type ModelExtendedId
E_MODEL_WARIOS_CAP = 378 --- @type ModelExtendedId
E_MODEL_WARIOS_METAL_CAP = 379 --- @type ModelExtendedId
E_MODEL_WARIOS_WING_CAP = 380 --- @type ModelExtendedId
E_MODEL_WARIOS_WINGED_METAL_CAP = 381 --- @type ModelExtendedId
E_MODEL_MAX = 382 --- @type ModelExtendedId

--- @alias ModelExtendedId
--- | `E_MODEL_NONE`
Expand Down Expand Up @@ -9105,6 +9126,7 @@ E_MODEL_MAX = 381 --- @type ModelExtendedId
--- | `E_MODEL_TOADS_CAP`
--- | `E_MODEL_TOADS_METAL_CAP`
--- | `E_MODEL_TOADS_WING_CAP`
--- | `E_MODEL_TOADS_WINGED_METAL_CAP`
--- | `E_MODEL_WALUIGI`
--- | `E_MODEL_WALUIGIS_CAP`
--- | `E_MODEL_WALUIGIS_METAL_CAP`
Expand Down
Loading