diff --git a/Makefile b/Makefile index 6faf96d4..3c5d120e 100644 --- a/Makefile +++ b/Makefile @@ -598,6 +598,11 @@ MOD_DIR := mods # Remove old mod dir _ := $(shell $(PYTHON) $(TOOLS_DIR)/remove_built_in_mods.py) +PALETTES_DIR := palettes + +# Remove old palettes dir +_ := $(shell rm -rf ./$(BUILD_DIR)/$(PALETTES_DIR)) + # Automatic dependency files DEP_FILES := $(O_FILES:.o=.d) $(ULTRA_O_FILES:.o=.d) $(GODDARD_O_FILES:.o=.d) $(BUILD_DIR)/$(LD_SCRIPT).d @@ -1130,6 +1135,9 @@ $(BUILD_DIR)/$(LANG_DIR): $(BUILD_DIR)/$(MOD_DIR): $(CP) -f -r $(MOD_DIR) $(BUILD_DIR) +$(BUILD_DIR)/$(PALETTES_DIR): + @$(CP) -f -r $(PALETTES_DIR) $(BUILD_DIR) + # Extra object file dependencies ifeq ($(TARGET_N64),1) @@ -1475,7 +1483,7 @@ ifeq ($(TARGET_N64),1) $(BUILD_DIR)/$(TARGET).objdump: $(ELF) $(OBJDUMP) -D $< > $@ else - $(EXE): $(O_FILES) $(MIO0_FILES:.mio0=.o) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(BUILD_DIR)/$(RPC_LIBS) $(BUILD_DIR)/$(DISCORD_SDK_LIBS) $(BUILD_DIR)/$(COOPNET_LIBS) $(BUILD_DIR)/$(LANG_DIR) $(BUILD_DIR)/$(MOD_DIR) + $(EXE): $(O_FILES) $(MIO0_FILES:.mio0=.o) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(BUILD_DIR)/$(RPC_LIBS) $(BUILD_DIR)/$(DISCORD_SDK_LIBS) $(BUILD_DIR)/$(COOPNET_LIBS) $(BUILD_DIR)/$(LANG_DIR) $(BUILD_DIR)/$(MOD_DIR) $(BUILD_DIR)/$(PALETTES_DIR) @$(PRINT) "$(GREEN)Linking executable: $(BLUE)$@ $(NO_COL)\n" $(V)$(LD) $(PROF_FLAGS) -L $(BUILD_DIR) -o $@ $(O_FILES) $(ULTRA_O_FILES) $(GODDARD_O_FILES) $(LDFLAGS) endif diff --git a/actors/luigi/model.inc.c b/actors/luigi/model.inc.c index ea7d4a93..0fd8772a 100644 --- a/actors/luigi/model.inc.c +++ b/actors/luigi/model.inc.c @@ -1996,7 +1996,7 @@ const Gfx luigi_l_logo_decal[] = { gsSPTexture(65535, 65535, 0, 0, 1), gsDPSetPrimColor(0, 0, 127, 127, 127, 255), gsSPLight(&luigi_black_lights_group.l, 1), - gsSPCopyLightEXT(2, 5), + gsSPCopyLightEXT(2, 17), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 1, luigi_texture_l_logo), gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 0, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), gsDPLoadBlock(7, 0, 0, 1023, 256), @@ -3519,7 +3519,7 @@ const Gfx luigi_right_hand_cap_decal[] = { gsSPTexture(65535, 65535, 0, 0, 1), gsDPSetPrimColor(0, 0, 127, 127, 127, 255), gsSPLight(&luigi_black_lights_group.l, 1), - gsSPCopyLightEXT(2, 5), + gsSPCopyLightEXT(2, 17), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 1, luigi_texture_l_logo), gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 0, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), gsDPLoadBlock(7, 0, 0, 1023, 256), diff --git a/actors/luigi_cap/model.inc.c b/actors/luigi_cap/model.inc.c index 9651da40..1ff39650 100644 --- a/actors/luigi_cap/model.inc.c +++ b/actors/luigi_cap/model.inc.c @@ -192,7 +192,7 @@ const Gfx luigi_cap_l_logo_decal[] = { gsSPTexture(65535, 65535, 0, 0, 1), gsDPSetPrimColor(0, 0, 127, 127, 127, 255), gsSPLight(&luigi_cap_black_lights_group.l, 1), - gsSPCopyLightEXT(2, 5), + gsSPCopyLightEXT(2, 17), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 1, luigi_cap_texture_l_logo), gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 0, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), gsDPLoadBlock(7, 0, 0, 1023, 256), diff --git a/actors/mario/model.inc.c b/actors/mario/model.inc.c index af2910f8..85e4687e 100644 --- a/actors/mario/model.inc.c +++ b/actors/mario/model.inc.c @@ -1109,7 +1109,7 @@ const Gfx mario_m_logo_decal[] = { gsSPTexture(65535, 65535, 0, 0, 1), gsDPSetPrimColor(0, 0, 127, 127, 127, 255), gsSPLight(&mario_black_lights_group.l, 1), - gsSPCopyLightEXT(2, 5), + gsSPCopyLightEXT(2, 17), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 1, mario_texture_m_logo), gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 0, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), @@ -2098,7 +2098,7 @@ const Gfx mario_right_hand_cap_decal[] = { gsSPTexture(65535, 65535, 0, 0, 1), gsDPSetPrimColor(0, 0, 127, 127, 127, 255), gsSPLight(&mario_black_lights_group.l, 1), - gsSPCopyLightEXT(2, 5), + gsSPCopyLightEXT(2, 17), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 1, mario_texture_m_logo), gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 0, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), gsDPLoadBlock(7, 0, 0, 1023, 256), diff --git a/actors/mario_cap/model.inc.c b/actors/mario_cap/model.inc.c index 36658f03..1b85318d 100644 --- a/actors/mario_cap/model.inc.c +++ b/actors/mario_cap/model.inc.c @@ -209,7 +209,7 @@ const Gfx mario_cap_m_logo_decal[] = { gsSPTexture(65535, 65535, 0, 0, 1), gsDPSetPrimColor(0, 0, 127, 127, 127, 255), gsSPLight(&mario_cap_black_lights_group.l, 1), - gsSPCopyLightEXT(2, 5), + gsSPCopyLightEXT(2, 17), gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 1, mario_cap_texture_m_logo), gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b_LOAD_BLOCK, 0, 0, 7, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0, G_TX_WRAP | G_TX_NOMIRROR, 0, 0), gsDPLoadBlock(7, 0, 0, 1023, 256), diff --git a/autogen/convert_constants.py b/autogen/convert_constants.py index f8866524..0854287a 100644 --- a/autogen/convert_constants.py +++ b/autogen/convert_constants.py @@ -44,7 +44,8 @@ in_files = [ "src/game/envfx_snow.h", "src/pc/mods/mod_storage.h", "src/game/first_person_cam.h", - "src/pc/djui/djui_console.h" + "src/pc/djui/djui_console.h", + "src/game/player_palette.h" ] exclude_constants = { diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index ba204a8f..b333088f 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -6,27 +6,28 @@ from extract_object_fields import * from common import * in_files = [ - 'include/types.h', - 'src/game/area.h', - 'src/game/camera.h', - 'src/game/characters.h', - 'src/engine/surface_collision.h', - 'src/pc/network/network_player.h', - 'src/pc/djui/djui_hud_utils.h', - 'src/game/object_helpers.h', - 'src/game/mario_step.h', - 'src/pc/lua/utils/smlua_anim_utils.h', - 'src/pc/lua/utils/smlua_misc_utils.h', - 'src/pc/lua/utils/smlua_collision_utils.h', - 'src/pc/lua/utils/smlua_level_utils.h', - 'src/game/spawn_sound.h', - 'src/pc/network/network.h', - 'src/game/hardcoded.h', - 'src/pc/mods/mod.h', - 'src/pc/lua/utils/smlua_audio_utils.h', - 'src/game/paintings.h', - 'src/pc/djui/djui_types.h', - 'src/game/first_person_cam.h' + "include/types.h", + "src/game/area.h", + "src/game/camera.h", + "src/game/characters.h", + "src/engine/surface_collision.h", + "src/pc/network/network_player.h", + "src/pc/djui/djui_hud_utils.h", + "src/game/object_helpers.h", + "src/game/mario_step.h", + "src/pc/lua/utils/smlua_anim_utils.h", + "src/pc/lua/utils/smlua_misc_utils.h", + "src/pc/lua/utils/smlua_collision_utils.h", + "src/pc/lua/utils/smlua_level_utils.h", + "src/game/spawn_sound.h", + "src/pc/network/network.h", + "src/game/hardcoded.h", + "src/pc/mods/mod.h", + "src/pc/lua/utils/smlua_audio_utils.h", + "src/game/paintings.h", + "src/pc/djui/djui_types.h", + "src/game/first_person_cam.h", + "src/game/player_palette.h" ] out_filename_c = 'src/pc/lua/smlua_cobject_autogen.c' @@ -122,8 +123,9 @@ override_field_version_excludes = { } override_allowed_structs = { - "src/pc/network/network.h": [ 'ServerSettings', 'NametagsSettings' ], - "src/pc/djui/djui_types.h": [ 'DjuiColor' ], + "src/pc/network/network.h": [ "ServerSettings", "NametagsSettings" ], + "src/pc/djui/djui_types.h": [ "DjuiColor" ], + "src/game/player_palette.h": [ "PlayerPalette" ] } sLuaManuallyDefinedStructs = [{ diff --git a/autogen/lua_constants/built-in.lua b/autogen/lua_constants/built-in.lua index bd23fc81..cbb4705f 100644 --- a/autogen/lua_constants/built-in.lua +++ b/autogen/lua_constants/built-in.lua @@ -396,6 +396,35 @@ COURSE_COUNT = 25 COURSE_MIN = 1 +------------------------------ +-- player palette functions -- +------------------------------ + +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @return Color +function network_player_get_palette_color(np, part) + local color = { + r = network_player_get_palette_color_channel(np, part, 0), + g = network_player_get_palette_color_channel(np, part, 1), + b = network_player_get_palette_color_channel(np, part, 2) + } + return color +end + +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @return Color +function network_player_get_override_palette_color(np, part) + local color = { + r = network_player_get_override_palette_color_channel(np, part, 0), + g = network_player_get_override_palette_color_channel(np, part, 1), + b = network_player_get_override_palette_color_channel(np, part, 2) + } + return color +end + + ----------------- -- legacy font -- ----------------- diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index dfd74aa6..1fb74298 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -398,6 +398,35 @@ COURSE_COUNT = 25 COURSE_MIN = 1 +------------------------------ +-- player palette functions -- +------------------------------ + +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @return Color +function network_player_get_palette_color(np, part) + local color = { + r = network_player_get_palette_color_channel(np, part, 0), + g = network_player_get_palette_color_channel(np, part, 1), + b = network_player_get_palette_color_channel(np, part, 2) + } + return color +end + +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @return Color +function network_player_get_override_palette_color(np, part) + local color = { + r = network_player_get_override_palette_color_channel(np, part, 0), + g = network_player_get_override_palette_color_channel(np, part, 1), + b = network_player_get_override_palette_color_channel(np, part, 2) + } + return color +end + + ----------------- -- legacy font -- ----------------- @@ -2780,178 +2809,6 @@ CT_WARIO = 4 --- @type CharacterType CT_MAX = 5 ---- @class PalettePreset - ---- @type PalettePreset -PALETTE_MARIO = 0 - ---- @type PalettePreset -PALETTE_LUIGI = 1 - ---- @type PalettePreset -PALETTE_TOAD = 2 - ---- @type PalettePreset -PALETTE_WARIO = 3 - ---- @type PalettePreset -PALETTE_WALUIGI = 4 - ---- @type PalettePreset -PALETTE_TOADETTE = 5 - ---- @type PalettePreset -PALETTE_YOSHI = 6 - ---- @type PalettePreset -PALETTE_BUCKEN_BERRY = 7 - ---- @type PalettePreset -PALETTE_ALA_GOLD = 8 - ---- @type PalettePreset -PALETTE_FIRE_MARIO = 9 - ---- @type PalettePreset -PALETTE_FIRE_LUIGI = 10 - ---- @type PalettePreset -PALETTE_ICE_MARIO = 11 - ---- @type PalettePreset -PALETTE_ICE_LUIGI = 12 - ---- @type PalettePreset -PALETTE_TOADSWORTH = 13 - ---- @type PalettePreset -PALETTE_PEACH = 14 - ---- @type PalettePreset -PALETTE_DAISY = 15 - ---- @type PalettePreset -PALETTE_WARIO_WOODS = 16 - ---- @type PalettePreset -PALETTE_GB = 17 - ---- @type PalettePreset -PALETTE_N64 = 18 - ---- @type PalettePreset -PALETTE_SNES = 19 - ---- @type PalettePreset -PALETTE_SWITCH = 20 - ---- @type PalettePreset -PALETTE_CLOVER = 21 - ---- @type PalettePreset -PALETTE_COBALT = 22 - ---- @type PalettePreset -PALETTE_RUBY = 23 - ---- @type PalettePreset -PALETTE_FURY = 24 - ---- @type PalettePreset -PALETTE_HOT_PINK = 25 - ---- @type PalettePreset -PALETTE_NICE_PINK = 26 - ---- @type PalettePreset -PALETTE_SEAFOAM = 27 - ---- @type PalettePreset -PALETTE_LILAC = 28 - ---- @type PalettePreset -PALETTE_COPPER = 29 - ---- @type PalettePreset -PALETTE_AZURE = 30 - ---- @type PalettePreset -PALETTE_BURGUNDY = 31 - ---- @type PalettePreset -PALETTE_MINT = 32 - ---- @type PalettePreset -PALETTE_ORANGE = 33 - ---- @type PalettePreset -PALETTE_ARCTIC = 34 - ---- @type PalettePreset -PALETTE_BLACK = 35 - ---- @type PalettePreset -PALETTE_BUBBLEGUM = 36 - ---- @type PalettePreset -PALETTE_BUSY_BEE = 37 - ---- @type PalettePreset -PALETTE_FORTRESS = 38 - ---- @type PalettePreset -PALETTE_BLUEBERRY_PIE = 39 - ---- @type PalettePreset -PALETTE_RASPBERRY = 40 - ---- @type PalettePreset -PALETTE_COFFEE = 41 - ---- @type PalettePreset -PALETTE_MARGIN = 42 - ---- @type PalettePreset -PALETTE_PUMPKIN = 43 - ---- @type PalettePreset -PALETTE_SOIL = 44 - ---- @type PalettePreset -PALETTE_CREVASE = 45 - ---- @type PalettePreset -PALETTE_PRESET_MAX = 46 - ---- @class PlayerPart - ---- @type PlayerPart -PANTS = 0 - ---- @type PlayerPart -SHIRT = 1 - ---- @type PlayerPart -GLOVES = 2 - ---- @type PlayerPart -SHOES = 3 - ---- @type PlayerPart -HAIR = 4 - ---- @type PlayerPart -SKIN = 5 - ---- @type PlayerPart -CAP = 6 - ---- @type PlayerPart -PLAYER_PART_MAX = 7 - ---- @type PlayerPart -METAL = CAP - --- @class DialogId --- @type DialogId @@ -7887,6 +7744,41 @@ Y_BUTTON = CONT_Y --- @type integer Z_TRIG = CONT_G +--- @type integer +MAX_PRESET_PALETTES = 128 + +--- @class PlayerPart + +--- @type PlayerPart +PANTS = 0 + +--- @type PlayerPart +SHIRT = 1 + +--- @type PlayerPart +GLOVES = 2 + +--- @type PlayerPart +SHOES = 3 + +--- @type PlayerPart +HAIR = 4 + +--- @type PlayerPart +SKIN = 5 + +--- @type PlayerPart +CAP = 6 + +--- @type PlayerPart +EMBLEM = 7 + +--- @type PlayerPart +PLAYER_PART_MAX = 8 + +--- @type PlayerPart +METAL = CAP + --- @type integer EEPROM_SIZE = 0x200 diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 5c1cd580..316b7453 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -6110,14 +6110,6 @@ function get_network_player_smallest_global() -- ... end ---- @param np NetworkPlayer ---- @param part PlayerPart ---- @param color Color ---- @return nil -function network_player_color_to_palette(np, part, color) - -- ... -end - --- @return integer function network_player_connected_count() -- ... @@ -6131,9 +6123,29 @@ end --- @param np NetworkPlayer --- @param part PlayerPart ---- @param out Color +--- @param index integer +--- @return integer +function network_player_get_override_palette_color_channel(np, part, index) + -- ... +end + +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @param index integer +--- @return integer +function network_player_get_palette_color_channel(np, part, index) + -- ... +end + +--- @param np NetworkPlayer +--- @return boolean +function network_player_is_override_palette_same(np) + -- ... +end + +--- @param np NetworkPlayer --- @return nil -function network_player_palette_to_color(np, part, out) +function network_player_reset_override_palette_color(np) -- ... end @@ -6148,6 +6160,14 @@ function network_player_set_description(np, description, r, g, b, a) -- ... end +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @param color Color +--- @return nil +function network_player_set_override_palette_color(np, part, color) + -- ... +end + --- @return boolean function network_check_singleplayer_pause() -- ... @@ -8629,6 +8649,22 @@ function network_discord_id_from_local_index(localIndex) -- ... end +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @param color Color +--- @return nil +function network_player_color_to_palette(np, part, color) + -- ... +end + +--- @param np NetworkPlayer +--- @param part PlayerPart +--- @param out Color +--- @return nil +function network_player_palette_to_color(np, part, out) + -- ... +end + --- @param index integer --- @param value integer --- @return nil diff --git a/data/dynos_bin_gfx.cpp b/data/dynos_bin_gfx.cpp index 22909b74..cc20a752 100644 --- a/data/dynos_bin_gfx.cpp +++ b/data/dynos_bin_gfx.cpp @@ -345,6 +345,7 @@ s64 DynOS_Gfx_ParseGfxConstants(const String& _Arg, bool* found) { gfx_constant(HAIR); gfx_constant(SKIN); gfx_constant(CAP); + gfx_constant(EMBLEM); gfx_constant(METAL); // Extended diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 2deced44..fe70e914 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -9,8 +9,6 @@ - [characters.h](#charactersh) - [enum CharacterSound](#enum-CharacterSound) - [enum CharacterType](#enum-CharacterType) - - [enum PalettePreset](#enum-PalettePreset) - - [enum PlayerPart](#enum-PlayerPart) - [dialog_ids.h](#dialog_idsh) - [enum DialogId](#enum-DialogId) - [djui_console.h](#djui_consoleh) @@ -55,6 +53,8 @@ - [object_list_processor.h](#object_list_processorh) - [enum ObjectList](#enum-ObjectList) - [os_cont.h](#os_conth) +- [player_palette.h](#player_paletteh) + - [enum PlayerPart](#enum-PlayerPart) - [save_file.h](#save_fileh) - [enum SaveFileIndex](#enum-SaveFileIndex) - [seq_ids.h](#seq_idsh) @@ -900,70 +900,6 @@ | CT_WARIO | 4 | | CT_MAX | 5 | -### [enum PalettePreset](#PalettePreset) -| Identifier | Value | -| :--------- | :---- | -| PALETTE_MARIO | 0 | -| PALETTE_LUIGI | 1 | -| PALETTE_TOAD | 2 | -| PALETTE_WARIO | 3 | -| PALETTE_WALUIGI | 4 | -| PALETTE_TOADETTE | 5 | -| PALETTE_YOSHI | 6 | -| PALETTE_BUCKEN_BERRY | 7 | -| PALETTE_ALA_GOLD | 8 | -| PALETTE_FIRE_MARIO | 9 | -| PALETTE_FIRE_LUIGI | 10 | -| PALETTE_ICE_MARIO | 11 | -| PALETTE_ICE_LUIGI | 12 | -| PALETTE_TOADSWORTH | 13 | -| PALETTE_PEACH | 14 | -| PALETTE_DAISY | 15 | -| PALETTE_WARIO_WOODS | 16 | -| PALETTE_GB | 17 | -| PALETTE_N64 | 18 | -| PALETTE_SNES | 19 | -| PALETTE_SWITCH | 20 | -| PALETTE_CLOVER | 21 | -| PALETTE_COBALT | 22 | -| PALETTE_RUBY | 23 | -| PALETTE_FURY | 24 | -| PALETTE_HOT_PINK | 25 | -| PALETTE_NICE_PINK | 26 | -| PALETTE_SEAFOAM | 27 | -| PALETTE_LILAC | 28 | -| PALETTE_COPPER | 29 | -| PALETTE_AZURE | 30 | -| PALETTE_BURGUNDY | 31 | -| PALETTE_MINT | 32 | -| PALETTE_ORANGE | 33 | -| PALETTE_ARCTIC | 34 | -| PALETTE_BLACK | 35 | -| PALETTE_BUBBLEGUM | 36 | -| PALETTE_BUSY_BEE | 37 | -| PALETTE_FORTRESS | 38 | -| PALETTE_BLUEBERRY_PIE | 39 | -| PALETTE_RASPBERRY | 40 | -| PALETTE_COFFEE | 41 | -| PALETTE_MARGIN | 42 | -| PALETTE_PUMPKIN | 43 | -| PALETTE_SOIL | 44 | -| PALETTE_CREVASE | 45 | -| PALETTE_PRESET_MAX | 46 | - -### [enum PlayerPart](#PlayerPart) -| Identifier | Value | -| :--------- | :---- | -| PANTS | 0 | -| SHIRT | 1 | -| GLOVES | 2 | -| SHOES | 3 | -| HAIR | 4 | -| SKIN | 5 | -| CAP | 6 | -| PLAYER_PART_MAX | 7 | -| METAL | CAP | - [:arrow_up_small:](#)
@@ -2821,6 +2757,27 @@
+## [player_palette.h](#player_palette.h) +- MAX_PRESET_PALETTES + +### [enum PlayerPart](#PlayerPart) +| Identifier | Value | +| :--------- | :---- | +| PANTS | 0 | +| SHIRT | 1 | +| GLOVES | 2 | +| SHOES | 3 | +| HAIR | 4 | +| SKIN | 5 | +| CAP | 6 | +| EMBLEM | 7 | +| PLAYER_PART_MAX | 8 | +| METAL | CAP | + +[:arrow_up_small:](#) + +
+ ## [save_file.h](#save_file.h) - EEPROM_SIZE - NUM_SAVE_FILES diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 7ba4f5d4..4da34462 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -1275,28 +1275,6 @@
-## [network_player_color_to_palette](#network_player_color_to_palette) - -### Lua Example -`network_player_color_to_palette(np, part, color)` - -### Parameters -| Field | Type | -| ----- | ---- | -| np | [NetworkPlayer](structs.md#NetworkPlayer) | -| part | [enum PlayerPart](constants.md#enum-PlayerPart) | -| color | `Color` | - -### Returns -- None - -### C Prototype -`void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color);` - -[:arrow_up_small:](#) - -
- ## [network_player_connected_count](#network_player_connected_count) ### Lua Example @@ -1335,23 +1313,85 @@
-## [network_player_palette_to_color](#network_player_palette_to_color) +## [network_player_get_override_palette_color_channel](#network_player_get_override_palette_color_channel) ### Lua Example -`network_player_palette_to_color(np, part, out)` +`local integerValue = network_player_get_override_palette_color_channel(np, part, index)` ### Parameters | Field | Type | | ----- | ---- | | np | [NetworkPlayer](structs.md#NetworkPlayer) | | part | [enum PlayerPart](constants.md#enum-PlayerPart) | -| out | `Color` | +| index | `integer` | + +### Returns +- `integer` + +### C Prototype +`u8 network_player_get_override_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index);` + +[:arrow_up_small:](#) + +
+ +## [network_player_get_palette_color_channel](#network_player_get_palette_color_channel) + +### Lua Example +`local integerValue = network_player_get_palette_color_channel(np, part, index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| np | [NetworkPlayer](structs.md#NetworkPlayer) | +| part | [enum PlayerPart](constants.md#enum-PlayerPart) | +| index | `integer` | + +### Returns +- `integer` + +### C Prototype +`u8 network_player_get_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index);` + +[:arrow_up_small:](#) + +
+ +## [network_player_is_override_palette_same](#network_player_is_override_palette_same) + +### Lua Example +`local booleanValue = network_player_is_override_palette_same(np)` + +### Parameters +| Field | Type | +| ----- | ---- | +| np | [NetworkPlayer](structs.md#NetworkPlayer) | + +### Returns +- `boolean` + +### C Prototype +`bool network_player_is_override_palette_same(struct NetworkPlayer *np);` + +[:arrow_up_small:](#) + +
+ +## [network_player_reset_override_palette_color](#network_player_reset_override_palette_color) + +### Lua Example +`network_player_reset_override_palette_color(np)` + +### Parameters +| Field | Type | +| ----- | ---- | +| np | [NetworkPlayer](structs.md#NetworkPlayer) | ### Returns - None ### C Prototype -`void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out);` +`void network_player_reset_override_palette_color(struct NetworkPlayer *np);` [:arrow_up_small:](#) @@ -1382,6 +1422,28 @@
+## [network_player_set_override_palette_color](#network_player_set_override_palette_color) + +### Lua Example +`network_player_set_override_palette_color(np, part, color)` + +### Parameters +| Field | Type | +| ----- | ---- | +| np | [NetworkPlayer](structs.md#NetworkPlayer) | +| part | [enum PlayerPart](constants.md#enum-PlayerPart) | +| color | `Color` | + +### Returns +- None + +### C Prototype +`void network_player_set_override_palette_color(struct NetworkPlayer *np, enum PlayerPart part, Color color);` + +[:arrow_up_small:](#) + +
+ --- # functions from network_utils.h @@ -8378,401 +8440,6 @@ [:arrow_up_small:](#) -
- ---- -# functions from smlua_audio_utils.h - -
- - -## [audio_sample_destroy](#audio_sample_destroy) - -### Lua Example -`audio_sample_destroy(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- None - -### C Prototype -`void audio_sample_destroy(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_sample_load](#audio_sample_load) - -### Lua Example -`local ModAudioValue = audio_sample_load(filename)` - -### Parameters -| Field | Type | -| ----- | ---- | -| filename | `string` | - -### Returns -[ModAudio](structs.md#ModAudio) - -### C Prototype -`struct ModAudio* audio_sample_load(const char* filename);` - -[:arrow_up_small:](#) - -
- -## [audio_sample_play](#audio_sample_play) - -### Lua Example -`audio_sample_play(audio, position, volume)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | -| position | [Vec3f](structs.md#Vec3f) | -| volume | `number` | - -### Returns -- None - -### C Prototype -`void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume);` - -[:arrow_up_small:](#) - -
- -## [audio_sample_stop](#audio_sample_stop) - -### Lua Example -`audio_sample_stop(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- None - -### C Prototype -`void audio_sample_stop(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_destroy](#audio_stream_destroy) - -### Lua Example -`audio_stream_destroy(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- None - -### C Prototype -`void audio_stream_destroy(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_get_frequency](#audio_stream_get_frequency) - -### Lua Example -`local numberValue = audio_stream_get_frequency(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- `number` - -### C Prototype -`f32 audio_stream_get_frequency(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_get_looping](#audio_stream_get_looping) - -### Lua Example -`local booleanValue = audio_stream_get_looping(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- `boolean` - -### C Prototype -`bool audio_stream_get_looping(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_get_position](#audio_stream_get_position) - -### Lua Example -`local numberValue = audio_stream_get_position(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- `number` - -### C Prototype -`f32 audio_stream_get_position(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_get_volume](#audio_stream_get_volume) - -### Lua Example -`local numberValue = audio_stream_get_volume(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- `number` - -### C Prototype -`f32 audio_stream_get_volume(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_load](#audio_stream_load) - -### Lua Example -`local ModAudioValue = audio_stream_load(filename)` - -### Parameters -| Field | Type | -| ----- | ---- | -| filename | `string` | - -### Returns -[ModAudio](structs.md#ModAudio) - -### C Prototype -`struct ModAudio* audio_stream_load(const char* filename);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_pause](#audio_stream_pause) - -### Lua Example -`audio_stream_pause(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- None - -### C Prototype -`void audio_stream_pause(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_play](#audio_stream_play) - -### Lua Example -`audio_stream_play(audio, restart, volume)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | -| restart | `boolean` | -| volume | `number` | - -### Returns -- None - -### C Prototype -`void audio_stream_play(struct ModAudio* audio, bool restart, f32 volume);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_set_frequency](#audio_stream_set_frequency) - -### Lua Example -`audio_stream_set_frequency(audio, freq)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | -| freq | `number` | - -### Returns -- None - -### C Prototype -`void audio_stream_set_frequency(struct ModAudio* audio, f32 freq);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_set_looping](#audio_stream_set_looping) - -### Lua Example -`audio_stream_set_looping(audio, looping)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | -| looping | `boolean` | - -### Returns -- None - -### C Prototype -`void audio_stream_set_looping(struct ModAudio* audio, bool looping);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_set_position](#audio_stream_set_position) - -### Lua Example -`audio_stream_set_position(audio, pos)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | -| pos | `number` | - -### Returns -- None - -### C Prototype -`void audio_stream_set_position(struct ModAudio* audio, f32 pos);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_set_volume](#audio_stream_set_volume) - -### Lua Example -`audio_stream_set_volume(audio, volume)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | -| volume | `number` | - -### Returns -- None - -### C Prototype -`void audio_stream_set_volume(struct ModAudio* audio, f32 volume);` - -[:arrow_up_small:](#) - -
- -## [audio_stream_stop](#audio_stream_stop) - -### Lua Example -`audio_stream_stop(audio)` - -### Parameters -| Field | Type | -| ----- | ---- | -| audio | [ModAudio](structs.md#ModAudio) | - -### Returns -- None - -### C Prototype -`void audio_stream_stop(struct ModAudio* audio);` - -[:arrow_up_small:](#) - -
- -## [smlua_audio_utils_replace_sequence](#smlua_audio_utils_replace_sequence) - -### Lua Example -`smlua_audio_utils_replace_sequence(sequenceId, bankId, defaultVolume, m64Name)` - -### Parameters -| Field | Type | -| ----- | ---- | -| sequenceId | `integer` | -| bankId | `integer` | -| defaultVolume | `integer` | -| m64Name | `string` | - -### Returns -- None - -### C Prototype -`void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolume, const char* m64Name);` - -[:arrow_up_small:](#) - -
- -## [smlua_audio_utils_reset_all](#smlua_audio_utils_reset_all) - -### Lua Example -`smlua_audio_utils_reset_all()` - -### Parameters -- None - -### Returns -- None - -### C Prototype -`void smlua_audio_utils_reset_all(void);` - -[:arrow_up_small:](#) -
--- diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 88d79b70..26eab4de 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -5,6 +5,401 @@ [< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5] +--- +# functions from smlua_audio_utils.h + +
+ + +## [audio_sample_destroy](#audio_sample_destroy) + +### Lua Example +`audio_sample_destroy(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- None + +### C Prototype +`void audio_sample_destroy(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_sample_load](#audio_sample_load) + +### Lua Example +`local ModAudioValue = audio_sample_load(filename)` + +### Parameters +| Field | Type | +| ----- | ---- | +| filename | `string` | + +### Returns +[ModAudio](structs.md#ModAudio) + +### C Prototype +`struct ModAudio* audio_sample_load(const char* filename);` + +[:arrow_up_small:](#) + +
+ +## [audio_sample_play](#audio_sample_play) + +### Lua Example +`audio_sample_play(audio, position, volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | +| position | [Vec3f](structs.md#Vec3f) | +| volume | `number` | + +### Returns +- None + +### C Prototype +`void audio_sample_play(struct ModAudio* audio, Vec3f position, f32 volume);` + +[:arrow_up_small:](#) + +
+ +## [audio_sample_stop](#audio_sample_stop) + +### Lua Example +`audio_sample_stop(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- None + +### C Prototype +`void audio_sample_stop(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_destroy](#audio_stream_destroy) + +### Lua Example +`audio_stream_destroy(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- None + +### C Prototype +`void audio_stream_destroy(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_get_frequency](#audio_stream_get_frequency) + +### Lua Example +`local numberValue = audio_stream_get_frequency(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- `number` + +### C Prototype +`f32 audio_stream_get_frequency(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_get_looping](#audio_stream_get_looping) + +### Lua Example +`local booleanValue = audio_stream_get_looping(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- `boolean` + +### C Prototype +`bool audio_stream_get_looping(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_get_position](#audio_stream_get_position) + +### Lua Example +`local numberValue = audio_stream_get_position(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- `number` + +### C Prototype +`f32 audio_stream_get_position(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_get_volume](#audio_stream_get_volume) + +### Lua Example +`local numberValue = audio_stream_get_volume(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- `number` + +### C Prototype +`f32 audio_stream_get_volume(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_load](#audio_stream_load) + +### Lua Example +`local ModAudioValue = audio_stream_load(filename)` + +### Parameters +| Field | Type | +| ----- | ---- | +| filename | `string` | + +### Returns +[ModAudio](structs.md#ModAudio) + +### C Prototype +`struct ModAudio* audio_stream_load(const char* filename);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_pause](#audio_stream_pause) + +### Lua Example +`audio_stream_pause(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- None + +### C Prototype +`void audio_stream_pause(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_play](#audio_stream_play) + +### Lua Example +`audio_stream_play(audio, restart, volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | +| restart | `boolean` | +| volume | `number` | + +### Returns +- None + +### C Prototype +`void audio_stream_play(struct ModAudio* audio, bool restart, f32 volume);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_set_frequency](#audio_stream_set_frequency) + +### Lua Example +`audio_stream_set_frequency(audio, freq)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | +| freq | `number` | + +### Returns +- None + +### C Prototype +`void audio_stream_set_frequency(struct ModAudio* audio, f32 freq);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_set_looping](#audio_stream_set_looping) + +### Lua Example +`audio_stream_set_looping(audio, looping)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | +| looping | `boolean` | + +### Returns +- None + +### C Prototype +`void audio_stream_set_looping(struct ModAudio* audio, bool looping);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_set_position](#audio_stream_set_position) + +### Lua Example +`audio_stream_set_position(audio, pos)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | +| pos | `number` | + +### Returns +- None + +### C Prototype +`void audio_stream_set_position(struct ModAudio* audio, f32 pos);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_set_volume](#audio_stream_set_volume) + +### Lua Example +`audio_stream_set_volume(audio, volume)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | +| volume | `number` | + +### Returns +- None + +### C Prototype +`void audio_stream_set_volume(struct ModAudio* audio, f32 volume);` + +[:arrow_up_small:](#) + +
+ +## [audio_stream_stop](#audio_stream_stop) + +### Lua Example +`audio_stream_stop(audio)` + +### Parameters +| Field | Type | +| ----- | ---- | +| audio | [ModAudio](structs.md#ModAudio) | + +### Returns +- None + +### C Prototype +`void audio_stream_stop(struct ModAudio* audio);` + +[:arrow_up_small:](#) + +
+ +## [smlua_audio_utils_replace_sequence](#smlua_audio_utils_replace_sequence) + +### Lua Example +`smlua_audio_utils_replace_sequence(sequenceId, bankId, defaultVolume, m64Name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| sequenceId | `integer` | +| bankId | `integer` | +| defaultVolume | `integer` | +| m64Name | `string` | + +### Returns +- None + +### C Prototype +`void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolume, const char* m64Name);` + +[:arrow_up_small:](#) + +
+ +## [smlua_audio_utils_reset_all](#smlua_audio_utils_reset_all) + +### Lua Example +`smlua_audio_utils_reset_all()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void smlua_audio_utils_reset_all(void);` + +[:arrow_up_small:](#) + +
+ --- # functions from smlua_collision_utils.h diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 4728db8d..fb203006 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1180,11 +1180,14 @@ - [get_network_player_from_area](functions-4.md#get_network_player_from_area) - [get_network_player_from_level](functions-4.md#get_network_player_from_level) - [get_network_player_smallest_global](functions-4.md#get_network_player_smallest_global) - - [network_player_color_to_palette](functions-4.md#network_player_color_to_palette) - [network_player_connected_count](functions-4.md#network_player_connected_count) - [network_player_from_global_index](functions-4.md#network_player_from_global_index) - - [network_player_palette_to_color](functions-4.md#network_player_palette_to_color) + - [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_set_description](functions-4.md#network_player_set_description) + - [network_player_set_override_palette_color](functions-4.md#network_player_set_override_palette_color)
@@ -1563,25 +1566,25 @@
- smlua_audio_utils.h - - [audio_sample_destroy](functions-4.md#audio_sample_destroy) - - [audio_sample_load](functions-4.md#audio_sample_load) - - [audio_sample_play](functions-4.md#audio_sample_play) - - [audio_sample_stop](functions-4.md#audio_sample_stop) - - [audio_stream_destroy](functions-4.md#audio_stream_destroy) - - [audio_stream_get_frequency](functions-4.md#audio_stream_get_frequency) - - [audio_stream_get_looping](functions-4.md#audio_stream_get_looping) - - [audio_stream_get_position](functions-4.md#audio_stream_get_position) - - [audio_stream_get_volume](functions-4.md#audio_stream_get_volume) - - [audio_stream_load](functions-4.md#audio_stream_load) - - [audio_stream_pause](functions-4.md#audio_stream_pause) - - [audio_stream_play](functions-4.md#audio_stream_play) - - [audio_stream_set_frequency](functions-4.md#audio_stream_set_frequency) - - [audio_stream_set_looping](functions-4.md#audio_stream_set_looping) - - [audio_stream_set_position](functions-4.md#audio_stream_set_position) - - [audio_stream_set_volume](functions-4.md#audio_stream_set_volume) - - [audio_stream_stop](functions-4.md#audio_stream_stop) - - [smlua_audio_utils_replace_sequence](functions-4.md#smlua_audio_utils_replace_sequence) - - [smlua_audio_utils_reset_all](functions-4.md#smlua_audio_utils_reset_all) + - [audio_sample_destroy](functions-5.md#audio_sample_destroy) + - [audio_sample_load](functions-5.md#audio_sample_load) + - [audio_sample_play](functions-5.md#audio_sample_play) + - [audio_sample_stop](functions-5.md#audio_sample_stop) + - [audio_stream_destroy](functions-5.md#audio_stream_destroy) + - [audio_stream_get_frequency](functions-5.md#audio_stream_get_frequency) + - [audio_stream_get_looping](functions-5.md#audio_stream_get_looping) + - [audio_stream_get_position](functions-5.md#audio_stream_get_position) + - [audio_stream_get_volume](functions-5.md#audio_stream_get_volume) + - [audio_stream_load](functions-5.md#audio_stream_load) + - [audio_stream_pause](functions-5.md#audio_stream_pause) + - [audio_stream_play](functions-5.md#audio_stream_play) + - [audio_stream_set_frequency](functions-5.md#audio_stream_set_frequency) + - [audio_stream_set_looping](functions-5.md#audio_stream_set_looping) + - [audio_stream_set_position](functions-5.md#audio_stream_set_position) + - [audio_stream_set_volume](functions-5.md#audio_stream_set_volume) + - [audio_stream_stop](functions-5.md#audio_stream_stop) + - [smlua_audio_utils_replace_sequence](functions-5.md#smlua_audio_utils_replace_sequence) + - [smlua_audio_utils_reset_all](functions-5.md#smlua_audio_utils_reset_all)
diff --git a/include/libc/stddef.h b/include/libc/stddef.h index 7e72a7bb..c31698ce 100644 --- a/include/libc/stddef.h +++ b/include/libc/stddef.h @@ -1,7 +1,7 @@ #ifndef STDDEF_H #define STDDEF_H -#include "PR/ultratypes.h" +#include #ifndef offsetof #define offsetof(st, m) ((size_t)&(((st *)0)->m)) diff --git a/include/libc/string.h b/include/libc/string.h index 183409eb..f959a566 100644 --- a/include/libc/string.h +++ b/include/libc/string.h @@ -1,7 +1,7 @@ #ifndef STRING_H #define STRING_H -#include "PR/ultratypes.h" +#include void *memcpy(void *dst, const void *src, size_t size); size_t strlen(const char *str); diff --git a/lang/Czech.ini b/lang/Czech.ini index 2326f03b..f6ea83ff 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -17,6 +17,7 @@ DIED = "@ umřel" DEBUG_FLY = "@ vstoupil do stavu volného letu" IMPORT_MOD_SUCCESS = "\\#a0ffa0\\Importován mod\n\\#dcdcdc\\'@'" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Importován DynOS pack\n\\#dcdcdc\\'@'" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Importované přednastavení palety\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\Chyba importu modu nebo DynOS packu\n\\#dcdcdc\\'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\Nelze importovat mod, protože jste ve hře" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Nezdařilo se připojit na CoopNet!" @@ -314,6 +315,7 @@ SHOES = "Boty" HAIR = "Vlasy" SKIN = "Kůže" CAP = "Čepice" +EMBLEM = "Symbol" PALETTE = "BARVY" PART = "Část" HEX_CODE = "Hex Kód" @@ -325,6 +327,9 @@ NAME = "Jméno" MODEL = "Model" PALETTE_PRESET = "Přednastavení barev" EDIT_PALETTE = "Upravit barvy" +PRESET_NAME = "Název" +DELETE_PRESET = "Smazat" +SAVE_PRESET = "Uložit" [PALETTE] MARIO = "Mario" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index f054d838..6098b2a0 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -17,6 +17,7 @@ DIED = "@ is dood gegaan." DEBUG_FLY = "@ is in debug vrij vliegen gegaan." IMPORT_MOD_SUCCESS = "\\#a0ffa0\\Geimporteerd mod\n\\#dcdcdc\\'@'" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Geimporteerd DynOS pack\n\\#dcdcdc\\'@'" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Geïmporteerd paletvoorinstelling\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\gefaalt om \n\\#dcdcdc\\'@' te importeren." IMPORT_FAIL_INGAME = "\\#ffa0a0\\Kan niet importen in een spel." COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Kon niet met CoopNet verbinden." @@ -314,6 +315,7 @@ SHOES = "Schoenen" HAIR = "Haar" SKIN = "Huid" CAP = "Hoed" +EMBLEM = "Embleem" PALETTE = "PALET" PART = "Deel" HEX_CODE = "Hex-Code" @@ -325,6 +327,9 @@ NAME = "Naam" MODEL = "Model" PALETTE_PRESET = "Palet voor-instelling" EDIT_PALETTE = "Bewerk Palet" +PRESET_NAME = "Naam" +DELETE_PRESET = "Verwijderen" +SAVE_PRESET = "Opslaan" [PALETTE] MARIO = "Mario" diff --git a/lang/English.ini b/lang/English.ini index e546fdb9..392aea65 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -17,6 +17,7 @@ DIED = "@ died" DEBUG_FLY = "@ entered debug free-fly mode" IMPORT_MOD_SUCCESS = "\\#a0ffa0\\Imported mod\n\\#dcdcdc\\'@'" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Imported DynOS pack\n\\#dcdcdc\\'@'" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Imported palette preset\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\Failed to import\n\\#dcdcdc\\'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\Can not import while in-game" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Could not connect to CoopNet!" @@ -314,6 +315,7 @@ SHOES = "Shoes" HAIR = "Hair" SKIN = "Skin" CAP = "Cap" +EMBLEM = "Emblem" PALETTE = "PALETTE" PART = "Part" HEX_CODE = "Hex Code" @@ -322,9 +324,12 @@ GREEN = "Green" BLUE = "Blue" PLAYER = "Player" NAME = "Name" -MODEL = "Model" +MODEL = "Character" PALETTE_PRESET = "Palette Preset" EDIT_PALETTE = "Edit Palette" +PRESET_NAME = "Preset Name" +DELETE_PRESET = "Delete Preset" +SAVE_PRESET = "Save Preset" [PALETTE] MARIO = "Mario" diff --git a/lang/French.ini b/lang/French.ini index f8a1e965..b23e9846 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -17,6 +17,7 @@ DIED = "@ est mort" DEBUG_FLY = "@ a activé le mode vol (débug) " IMPORT_MOD_SUCCESS = "\\#a0ffa0\\Le mod\n\\#dcdcdc\\'@'\\#a0ffa0\\\na été importé." IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Le pack DynOS\n\\#dcdcdc\\'@'\n\\#a0ffa0\\a été importé." +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Préréglage de palette importé\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\L'importation de\n\\#dcdcdc\\'@'\\#ffa0a0\\\na échoué." IMPORT_FAIL_INGAME = "\\#ffa0a0\\L'importation ne peut pas se faire pendant la partie." COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\La connexion à CoopNet a échouée!" @@ -314,6 +315,7 @@ SHOES = "Chaussures" HAIR = "Cheveux" SKIN = "Peau" CAP = "Casquette" +EMBLEM = "Emblème" PALETTE = "PALETTE" PART = "Partie du corps" HEX_CODE = "Code Couleur" @@ -325,6 +327,9 @@ NAME = "Pseudo" MODEL = "Personnage" PALETTE_PRESET = "Palettes par défaut" EDIT_PALETTE = "Modifier la palette" +PRESET_NAME = "Nom" +DELETE_PRESET = "Supprimer" +SAVE_PRESET = "Enregistrer" [PALETTE] MARIO = "Mario" diff --git a/lang/German.ini b/lang/German.ini index 52ddc6dc..ad91dcc6 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -17,6 +17,7 @@ DIED = "@ ist gestorben." DEBUG_FLY = "@ hat den Debug-Free-Fly-Modus aktiviert." IMPORT_MOD_SUCCESS = "\\#a0ffa0\\Mod importiert\n\\#dcdcdc\\'@'" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\DynOS-Paket importiert\n\\#dcdcdc\\'@'" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Importiertes Paletten-Voreinstellung\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\Import fehlgeschlagen für\n\\#dcdcdc\\'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\Kann nicht im Spiel importieren." COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Verbindung zu CoopNet fehlgeschlagen!" @@ -314,6 +315,7 @@ SHOES = "Schuhe" HAIR = "Haar" SKIN = "Haut" CAP = "Mütze" +EMBLEM = "Emblem" PALETTE = "PALETTE" PART = "Teil" HEX_CODE = "Hex-Code" @@ -325,6 +327,9 @@ NAME = "Name" MODEL = "Modell" PALETTE_PRESET = "Palette-Vorlage" EDIT_PALETTE = "Palette bearbeiten" +PRESET_NAME = "Name" +DELETE_PRESET = "Löschen" +SAVE_PRESET = "Speichern" [PALETTE] MARIO = "Mario" diff --git a/lang/Italian.ini b/lang/Italian.ini index a10478ca..9838480e 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -17,6 +17,7 @@ DIED = "@ è morto" DEBUG_FLY = "@ è entrato nello stato di debug di volo libero" IMPORT_MOD_SUCCESS = "\\#a0ffa0\\importata la mod\n\\#dcdcdc\\'@'" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Importato il pacchetto DynOS\n\\#dcdcdc\\'@'" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Preimpostazione di palette importata\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\Impossibile importare\n\\#dcdcdc\\'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\Impossibile importare durante la partita" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Could not connect to CoopNet!" @@ -312,6 +313,7 @@ SHOES = "Scarpe" HAIR = "Capelli" SKIN = "Pelle" CAP = "Cappello" +EMBLEM = "Emblema" PALETTE = "PALETTE" PART = "Parte" HEX_CODE = "codice Hex" @@ -323,6 +325,9 @@ NAME = "Nome" MODEL = "Modello" PALETTE_PRESET = "Opzioni Palette" EDIT_PALETTE = "Modifica Palette" +PRESET_NAME = "Nome" +DELETE_PRESET = "Eliminare" +SAVE_PRESET = "Salvare" [PALETTE] MARIO = "Mario" diff --git a/lang/Polish.ini b/lang/Polish.ini index e2826f5e..1bdfbc27 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -17,6 +17,7 @@ DIED = "Gracz @ umarl" DEBUG_FLY = "Gracz @ wszedl w debugowy stan latania" IMPORT_MOD_SUCCESS = "\\#a0ffa0\\Zaimportowano mod\n\\#c8c8c8\\'@'" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Zaimportowano paczke DynOS\n\\#c8c8c8\\'@'" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Zaimportowany preset palety\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\Nie udalo sie zaimportowac\n\\#c8c8c8\\'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\Nie mozna importowac podczas gry" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Nie udalo sie polaczyc z CoopNetem!" @@ -314,6 +315,7 @@ SHOES = "Buty" HAIR = "Wlosy" SKIN = "Skora" CAP = "Czapka" +EMBLEM = "Godło" PALETTE = "PALETA" PART = "Czesc" HEX_CODE = "Kod Hex" @@ -325,6 +327,9 @@ NAME = "Nazwa" MODEL = "Model" PALETTE_PRESET = "Preset Palety" EDIT_PALETTE = "Edytuj Palete" +PRESET_NAME = "Nazwa presetu" +DELETE_PRESET = "Usuń preset" +SAVE_PRESET = "Zapisz preset" [PALETTE] MARIO = "Mario" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index d8da48e4..1eac2ff7 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -17,6 +17,7 @@ DIED = "@ morreu" DEBUG_FLY = "@ entrou no estado de debug para voar" IMPORT_MOD_SUCCESS = "\\#dcdcdc\\'@'\n\\#a0ffa0\\Mod importado" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Pacote DynOS\n\\#dcdcdc\\'@'\\#a0ffa0\\\nimportado" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Predefinição de paleta importada\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\Falha ao importar\n\\#dcdcdc\\'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\Falha ao importar durante o jogo" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Não foi possível se conectar ao CoopNet!" @@ -314,6 +315,7 @@ SHOES = "Sapatos" HAIR = "Cabelo" SKIN = "Pele" CAP = "Chapéu" +EMBLEM = "Emblema" PALETTE = "PALETA" PART = "Parte" HEX_CODE = "Código hexadecimal" @@ -325,6 +327,9 @@ NAME = "Nome" MODEL = "Modelo" PALETTE_PRESET = "Predefinição de paleta" EDIT_PALETTE = "Editar paleta" +PRESET_NAME = "Nome" +DELETE_PRESET = "Excluir" +SAVE_PRESET = "Salvar" [PALETTE] MARIO = "Mario" diff --git a/lang/Russian.ini b/lang/Russian.ini index 25d495d7..e044e12c 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -17,6 +17,7 @@ DIED = "@ умер" DEBUG_FLY = "@ вошел в состояние свободного полета отладки" IMPORT_MOD_SUCCESS = "\\#a0ffa0\\Импортирован мод\n\\#dcdcdc\\'@'" IMPORT_DYNOS_SUCCESS = "\\#a0ffa0\\Импортированнан пакет DynOS\n\\#dcdcdc\\'@'" +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Импортированный предустановленный набор палитр\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\\#ffa0a0\\Не удалось импортировать\n\\#dcdcdc\\'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\Невозможно импортировать во время игры" COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\Не удалось установить соединение с CoopNet!" @@ -313,6 +314,7 @@ SHOES = "Обувь" HAIR = "Волосы" SKIN = "Кожа" CAP = "Кепка" +EMBLEM = "Логотип" PALETTE = "PALETTE" PART = "Часть" HEX_CODE = "HEX код" @@ -324,6 +326,9 @@ NAME = "Имя" MODEL = "Модель" PALETTE_PRESET = "Предустановка палитры" EDIT_PALETTE = "Редактировать палитру" +PRESET_NAME = "Имя" +DELETE_PRESET = "Удалить" +SAVE_PRESET = "Сохранить" [PALETTE] MARIO = "Марио" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index 42e377b6..8fbe9042 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -17,6 +17,7 @@ DIED = "@ ha muerto." DEBUG_FLY = "@ Está en estado de vuelo libre debug." IMPORT_MOD_SUCCESS = "El mod \\#dcdcdc\\'@'\\#a0ffa0\\\nha sido importado con éxito." IMPORT_DYNOS_SUCCESS = "El pack de DynOS \\#dcdcdc\\'@'\\#a0ffa0\\\nha sido importado con éxito." +IMPORT_PALETTE_SUCCESS = "\\#a0ffa0\\Ajuste preestablecido de paleta importado\n\\#dcdcdc\\'@'" IMPORT_FAIL = "\n\\#ffa0a0\\Error al importar el archivo. \\#dcdcdc\\\n'@'" IMPORT_FAIL_INGAME = "\\#ffa0a0\\No se pueden importar archivos\nen medio de una partida." COOPNET_CONNECTION_FAILED = "\\#ffa0a0\\¡No se ha podido conectar a CoopNet!" @@ -314,6 +315,7 @@ SHOES = "Zapatos" HAIR = "Pelo" SKIN = "Piel" CAP = "Gorra" +EMBLEM = "Emblema" PALETTE = "PALETA" PART = "Parte" HEX_CODE = "Código Hex" @@ -325,6 +327,9 @@ NAME = "Nombre" MODEL = "Modelo" PALETTE_PRESET = "Paletas predeterminadas" EDIT_PALETTE = "Editar Paleta" +PRESET_NAME = "Nombre" +DELETE_PRESET = "Eliminar" +SAVE_PRESET = "Guardar" [PALETTE] MARIO = "Mario" diff --git a/mods/arena/arena-player.lua b/mods/arena/arena-player.lua index 22c7191b..7dbc7157 100644 --- a/mods/arena/arena-player.lua +++ b/mods/arena/arena-player.lua @@ -414,6 +414,7 @@ function mario_update(m) local e = gMarioStateExtras[m.playerIndex] local s = gPlayerSyncTable[m.playerIndex] local np = gNetworkPlayers[m.playerIndex] + if not np.connected then return end -- increase knockback animations local animInfo = nil @@ -449,11 +450,25 @@ function mario_update(m) -- update palette if s.team == 1 then - np.overridePaletteIndex = PALETTE_RUBY + network_player_set_override_palette_color(np, PANTS, { r = 225, g = 5, b = 49 }) + network_player_set_override_palette_color(np, SHIRT, { r = 40, g = 10, b = 10 }) + network_player_set_override_palette_color(np, GLOVES, network_player_get_palette_color(np, GLOVES)) + network_player_set_override_palette_color(np, SHOES, network_player_get_palette_color(np, SHOES)) + network_player_set_override_palette_color(np, HAIR, network_player_get_palette_color(np, HAIR)) + network_player_set_override_palette_color(np, SKIN, network_player_get_palette_color(np, SKIN)) + network_player_set_override_palette_color(np, CAP, { r = 40, g = 10, b = 10 }) + network_player_set_override_palette_color(np, EMBLEM, network_player_get_palette_color(np, EMBLEM)) elseif s.team == 2 then - np.overridePaletteIndex = PALETTE_COBALT + network_player_set_override_palette_color(np, PANTS, { r = 63, g = 63, b = 255 }) + network_player_set_override_palette_color(np, SHIRT, { r = 10, g = 10, b = 40 }) + network_player_set_override_palette_color(np, GLOVES, network_player_get_palette_color(np, GLOVES)) + network_player_set_override_palette_color(np, SHOES, network_player_get_palette_color(np, SHOES)) + network_player_set_override_palette_color(np, HAIR, network_player_get_palette_color(np, HAIR)) + network_player_set_override_palette_color(np, SKIN, network_player_get_palette_color(np, SKIN)) + network_player_set_override_palette_color(np, CAP, { r = 10, g = 10, b = 40 }) + network_player_set_override_palette_color(np, EMBLEM, network_player_get_palette_color(np, EMBLEM)) else - np.overridePaletteIndex = np.paletteIndex + network_player_reset_override_palette_color(np) end -- set metal diff --git a/mods/arena/main.lua b/mods/arena/main.lua index b4462070..90b2a0f5 100644 --- a/mods/arena/main.lua +++ b/mods/arena/main.lua @@ -50,6 +50,9 @@ local gGameLevels = { _G.Arena = { add_level = function (levelNum, levelName) table.insert(gGameLevels, { level = levelNum, name = levelName }) + end, + get_player_team = function (localIndex) + return gPlayerSyncTable[localIndex].team end } diff --git a/palettes/Arctic.ini b/palettes/Arctic.ini new file mode 100644 index 00000000..6f91daa2 --- /dev/null +++ b/palettes/Arctic.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 76 +PANTS_G = 30 +PANTS_B = 63 +SHIRT_R = 101 +SHIRT_G = 250 +SHIRT_B = 255 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 101 +CAP_G = 250 +CAP_B = 255 +EMBLEM_R = 101 +EMBLEM_G = 250 +EMBLEM_B = 255 diff --git a/palettes/Azure.ini b/palettes/Azure.ini new file mode 100644 index 00000000..2920a609 --- /dev/null +++ b/palettes/Azure.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 79 +PANTS_G = 49 +PANTS_B = 139 +SHIRT_R = 90 +SHIRT_G = 148 +SHIRT_B = 255 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 90 +CAP_G = 148 +CAP_B = 255 +EMBLEM_R = 90 +EMBLEM_G = 148 +EMBLEM_B = 255 diff --git a/palettes/Bubblegum.ini b/palettes/Bubblegum.ini new file mode 100644 index 00000000..e446c2eb --- /dev/null +++ b/palettes/Bubblegum.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 214 +PANTS_G = 53 +PANTS_B = 77 +SHIRT_R = 255 +SHIRT_G = 142 +SHIRT_B = 178 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 255 +CAP_G = 142 +CAP_B = 178 +EMBLEM_R = 255 +EMBLEM_G = 142 +EMBLEM_B = 178 diff --git a/palettes/Burgundy.ini b/palettes/Burgundy.ini new file mode 100644 index 00000000..b0464f2e --- /dev/null +++ b/palettes/Burgundy.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 35 +PANTS_G = 17 +PANTS_B = 3 +SHIRT_R = 104 +SHIRT_G = 10 +SHIRT_B = 23 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 104 +CAP_G = 10 +CAP_B = 23 +EMBLEM_R = 104 +EMBLEM_G = 10 +EMBLEM_B = 23 diff --git a/palettes/Busy Bee.ini b/palettes/Busy Bee.ini new file mode 100644 index 00000000..522c5509 --- /dev/null +++ b/palettes/Busy Bee.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 23 +PANTS_G = 24 +PANTS_B = 21 +SHIRT_R = 231 +SHIRT_G = 231 +SHIRT_B = 33 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 231 +CAP_G = 231 +CAP_B = 33 +EMBLEM_R = 231 +EMBLEM_G = 231 +EMBLEM_B = 33 diff --git a/palettes/Clover.ini b/palettes/Clover.ini new file mode 100644 index 00000000..234c2c2c --- /dev/null +++ b/palettes/Clover.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 20 +PANTS_G = 25 +PANTS_B = 20 +SHIRT_R = 76 +SHIRT_G = 95 +SHIRT_B = 32 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 76 +CAP_G = 95 +CAP_B = 32 +EMBLEM_R = 76 +EMBLEM_G = 95 +EMBLEM_B = 32 diff --git a/palettes/Cobalt.ini b/palettes/Cobalt.ini new file mode 100644 index 00000000..7cc41e2b --- /dev/null +++ b/palettes/Cobalt.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 63 +PANTS_G = 63 +PANTS_B = 255 +SHIRT_R = 10 +SHIRT_G = 10 +SHIRT_B = 40 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 57 +SHOES_G = 14 +SHOES_B = 7 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 63 +CAP_G = 63 +CAP_B = 255 +EMBLEM_R = 63 +EMBLEM_G = 63 +EMBLEM_B = 255 diff --git a/palettes/Cold Crevase.ini b/palettes/Cold Crevase.ini new file mode 100644 index 00000000..480829d5 --- /dev/null +++ b/palettes/Cold Crevase.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 212 +PANTS_G = 223 +PANTS_B = 231 +SHIRT_R = 81 +SHIRT_G = 169 +SHIRT_B = 156 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 107 +SHOES_G = 65 +SHOES_B = 0 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 212 +CAP_G = 223 +CAP_B = 231 +EMBLEM_R = 81 +EMBLEM_G = 169 +EMBLEM_B = 156 diff --git a/palettes/Copper.ini b/palettes/Copper.ini new file mode 100644 index 00000000..4f9500a8 --- /dev/null +++ b/palettes/Copper.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 0 +PANTS_G = 70 +PANTS_B = 92 +SHIRT_R = 132 +SHIRT_G = 96 +SHIRT_B = 0 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 132 +CAP_G = 96 +CAP_B = 0 +EMBLEM_R = 132 +EMBLEM_G = 96 +EMBLEM_B = 0 diff --git a/palettes/Fire Luigi.ini b/palettes/Fire Luigi.ini new file mode 100644 index 00000000..b480d693 --- /dev/null +++ b/palettes/Fire Luigi.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 0 +PANTS_G = 152 +PANTS_B = 0 +SHIRT_R = 230 +SHIRT_G = 230 +SHIRT_B = 230 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 230 +CAP_G = 230 +CAP_B = 230 +EMBLEM_R = 0 +EMBLEM_G = 152 +EMBLEM_B = 0 diff --git a/palettes/Fire Mario.ini b/palettes/Fire Mario.ini new file mode 100644 index 00000000..ded0c25f --- /dev/null +++ b/palettes/Fire Mario.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 178 +PANTS_G = 40 +PANTS_B = 24 +SHIRT_R = 230 +SHIRT_G = 230 +SHIRT_B = 230 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 230 +CAP_G = 230 +CAP_B = 230 +EMBLEM_R = 178 +EMBLEM_G = 40 +EMBLEM_B = 24 diff --git a/palettes/Fury.ini b/palettes/Fury.ini new file mode 100644 index 00000000..0036a569 --- /dev/null +++ b/palettes/Fury.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 248 +PANTS_G = 59 +PANTS_B = 5 +SHIRT_R = 17 +SHIRT_G = 17 +SHIRT_B = 17 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 17 +CAP_G = 17 +CAP_B = 17 +EMBLEM_R = 17 +EMBLEM_G = 17 +EMBLEM_B = 17 diff --git a/palettes/Ice Luigi.ini b/palettes/Ice Luigi.ini new file mode 100644 index 00000000..4f5fcf14 --- /dev/null +++ b/palettes/Ice Luigi.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 0 +PANTS_G = 152 +PANTS_B = 0 +SHIRT_R = 71 +SHIRT_G = 197 +SHIRT_B = 255 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 71 +CAP_G = 197 +CAP_B = 255 +EMBLEM_R = 71 +EMBLEM_G = 197 +EMBLEM_B = 255 diff --git a/palettes/Ice Mario.ini b/palettes/Ice Mario.ini new file mode 100644 index 00000000..2f933205 --- /dev/null +++ b/palettes/Ice Mario.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 178 +PANTS_G = 40 +PANTS_B = 24 +SHIRT_R = 71 +SHIRT_G = 197 +SHIRT_B = 255 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 71 +CAP_G = 197 +CAP_B = 255 +EMBLEM_R = 71 +EMBLEM_G = 197 +EMBLEM_B = 255 diff --git a/palettes/Jet Black.ini b/palettes/Jet Black.ini new file mode 100644 index 00000000..ba6616b3 --- /dev/null +++ b/palettes/Jet Black.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 26 +PANTS_G = 26 +PANTS_B = 26 +SHIRT_R = 44 +SHIRT_G = 44 +SHIRT_B = 44 +GLOVES_R = 100 +GLOVES_G = 100 +GLOVES_B = 100 +SHOES_R = 100 +SHOES_G = 100 +SHOES_B = 100 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 26 +CAP_G = 26 +CAP_B = 26 +EMBLEM_R = 26 +EMBLEM_G = 26 +EMBLEM_B = 26 diff --git a/palettes/Lilac.ini b/palettes/Lilac.ini new file mode 100644 index 00000000..b14ff8b7 --- /dev/null +++ b/palettes/Lilac.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 97 +PANTS_G = 61 +PANTS_B = 46 +SHIRT_R = 169 +SHIRT_G = 120 +SHIRT_B = 252 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 169 +CAP_G = 120 +CAP_B = 252 +EMBLEM_R = 169 +EMBLEM_G = 120 +EMBLEM_B = 252 diff --git a/palettes/Luigi.ini b/palettes/Luigi.ini new file mode 100644 index 00000000..ae13aef9 --- /dev/null +++ b/palettes/Luigi.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 0 +PANTS_G = 0 +PANTS_B = 255 +SHIRT_R = 0 +SHIRT_G = 255 +SHIRT_B = 0 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 0 +CAP_G = 255 +CAP_B = 0 +EMBLEM_R = 0 +EMBLEM_G = 255 +EMBLEM_B = 0 diff --git a/palettes/Margin of Night.ini b/palettes/Margin of Night.ini new file mode 100644 index 00000000..9ba30eb1 --- /dev/null +++ b/palettes/Margin of Night.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 107 +PANTS_G = 24 +PANTS_B = 24 +SHIRT_R = 76 +SHIRT_G = 38 +SHIRT_B = 144 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 49 +CAP_G = 26 +CAP_B = 29 +EMBLEM_R = 49 +EMBLEM_G = 26 +EMBLEM_B = 29 diff --git a/palettes/Mario.ini b/palettes/Mario.ini new file mode 100644 index 00000000..bd55b4ac --- /dev/null +++ b/palettes/Mario.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 0 +PANTS_G = 0 +PANTS_B = 255 +SHIRT_R = 255 +SHIRT_G = 0 +SHIRT_B = 0 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 255 +CAP_G = 0 +CAP_B = 0 +EMBLEM_R = 255 +EMBLEM_G = 0 +EMBLEM_B = 0 diff --git a/palettes/Orange.ini b/palettes/Orange.ini new file mode 100644 index 00000000..be30a41f --- /dev/null +++ b/palettes/Orange.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 0 +PANTS_G = 81 +PANTS_B = 16 +SHIRT_R = 255 +SHIRT_G = 138 +SHIRT_B = 0 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 255 +CAP_G = 138 +CAP_B = 0 +EMBLEM_R = 255 +EMBLEM_G = 138 +EMBLEM_B = 0 diff --git a/palettes/Raspberry.ini b/palettes/Raspberry.ini new file mode 100644 index 00000000..9a8dc80b --- /dev/null +++ b/palettes/Raspberry.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 214 +PANTS_G = 53 +PANTS_B = 77 +SHIRT_R = 59 +SHIRT_G = 143 +SHIRT_B = 247 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 114 +SHOES_G = 28 +SHOES_B = 14 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 59 +CAP_G = 143 +CAP_B = 247 +EMBLEM_R = 59 +EMBLEM_G = 143 +EMBLEM_B = 247 diff --git a/palettes/Ruby.ini b/palettes/Ruby.ini new file mode 100644 index 00000000..edf3e75f --- /dev/null +++ b/palettes/Ruby.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 225 +PANTS_G = 5 +PANTS_B = 49 +SHIRT_R = 40 +SHIRT_G = 10 +SHIRT_B = 10 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 57 +SHOES_G = 14 +SHOES_B = 7 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 225 +CAP_G = 5 +CAP_B = 49 +EMBLEM_R = 225 +EMBLEM_G = 5 +EMBLEM_B = 49 diff --git a/palettes/Super Lilac.ini b/palettes/Super Lilac.ini new file mode 100644 index 00000000..e066f3c4 --- /dev/null +++ b/palettes/Super Lilac.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 89 +PANTS_G = 45 +PANTS_B = 118 +SHIRT_R = 173 +SHIRT_G = 168 +SHIRT_B = 222 +GLOVES_R = 223 +GLOVES_G = 223 +GLOVES_B = 208 +SHOES_R = 61 +SHOES_G = 61 +SHOES_B = 63 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 173 +CAP_G = 168 +CAP_B = 222 +EMBLEM_R = 89 +EMBLEM_G = 45 +EMBLEM_B = 118 diff --git a/palettes/Switch Neon.ini b/palettes/Switch Neon.ini new file mode 100644 index 00000000..1eb2b313 --- /dev/null +++ b/palettes/Switch Neon.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 40 +PANTS_G = 40 +PANTS_B = 40 +SHIRT_R = 219 +SHIRT_G = 60 +SHIRT_B = 46 +GLOVES_R = 0 +GLOVES_G = 157 +GLOVES_B = 189 +SHOES_R = 0 +SHOES_G = 157 +SHOES_B = 189 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 40 +CAP_G = 40 +CAP_B = 40 +EMBLEM_R = 219 +EMBLEM_G = 60 +EMBLEM_B = 46 diff --git a/palettes/Toad.ini b/palettes/Toad.ini new file mode 100644 index 00000000..3a6a938b --- /dev/null +++ b/palettes/Toad.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 255 +PANTS_G = 255 +PANTS_B = 255 +SHIRT_R = 76 +SHIRT_G = 44 +SHIRT_B = 211 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 104 +SHOES_G = 64 +SHOES_B = 27 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 213 +SKIN_B = 161 +CAP_R = 255 +CAP_G = 0 +CAP_B = 0 +EMBLEM_R = 255 +EMBLEM_G = 0 +EMBLEM_B = 0 diff --git a/palettes/Toadette.ini b/palettes/Toadette.ini new file mode 100644 index 00000000..061d6c66 --- /dev/null +++ b/palettes/Toadette.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 255 +PANTS_G = 255 +PANTS_B = 255 +SHIRT_R = 255 +SHIRT_G = 70 +SHIRT_B = 161 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 104 +SHOES_G = 64 +SHOES_B = 27 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 213 +SKIN_B = 161 +CAP_R = 255 +CAP_G = 70 +CAP_B = 161 +EMBLEM_R = 255 +EMBLEM_G = 70 +EMBLEM_B = 161 diff --git a/palettes/Toadsworth.ini b/palettes/Toadsworth.ini new file mode 100644 index 00000000..0891b2fd --- /dev/null +++ b/palettes/Toadsworth.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 108 +PANTS_G = 24 +PANTS_B = 153 +SHIRT_R = 114 +SHIRT_G = 94 +SHIRT_B = 170 +GLOVES_R = 227 +GLOVES_G = 204 +GLOVES_B = 125 +SHOES_R = 104 +SHOES_G = 64 +SHOES_B = 27 +HAIR_R = 115 +HAIR_G = 6 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 213 +SKIN_B = 161 +CAP_R = 82 +CAP_G = 53 +CAP_B = 21 +EMBLEM_R = 82 +EMBLEM_G = 53 +EMBLEM_B = 21 diff --git a/palettes/Waluigi.ini b/palettes/Waluigi.ini new file mode 100644 index 00000000..b16cc82d --- /dev/null +++ b/palettes/Waluigi.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 22 +PANTS_G = 22 +PANTS_B = 39 +SHIRT_R = 97 +SHIRT_G = 38 +SHIRT_B = 176 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 254 +SHOES_G = 118 +SHOES_B = 0 +HAIR_R = 115 +HAIR_G = 83 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 97 +CAP_G = 38 +CAP_B = 176 +EMBLEM_R = 97 +EMBLEM_G = 38 +EMBLEM_B = 176 diff --git a/palettes/Wario.ini b/palettes/Wario.ini new file mode 100644 index 00000000..c4bb4ea3 --- /dev/null +++ b/palettes/Wario.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 127 +PANTS_G = 32 +PANTS_B = 122 +SHIRT_R = 227 +SHIRT_G = 169 +SHIRT_B = 1 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 14 +SHOES_G = 114 +SHOES_B = 28 +HAIR_R = 115 +HAIR_G = 83 +HAIR_B = 0 +SKIN_R = 254 +SKIN_G = 193 +SKIN_B = 121 +CAP_R = 227 +CAP_G = 169 +CAP_B = 1 +EMBLEM_R = 227 +EMBLEM_G = 169 +EMBLEM_B = 1 diff --git a/palettes/Yoshi.ini b/palettes/Yoshi.ini new file mode 100644 index 00000000..7b7fa77d --- /dev/null +++ b/palettes/Yoshi.ini @@ -0,0 +1,25 @@ +[PALETTE] +PANTS_R = 255 +PANTS_G = 0 +PANTS_B = 0 +SHIRT_R = 74 +SHIRT_G = 255 +SHIRT_B = 32 +GLOVES_R = 255 +GLOVES_G = 255 +GLOVES_B = 255 +SHOES_R = 255 +SHOES_G = 0 +SHOES_B = 0 +HAIR_R = 255 +HAIR_G = 0 +HAIR_B = 0 +SKIN_R = 255 +SKIN_G = 222 +SKIN_B = 57 +CAP_R = 139 +CAP_G = 0 +CAP_B = 0 +EMBLEM_R = 139 +EMBLEM_G = 0 +EMBLEM_B = 0 diff --git a/src/game/characters.c b/src/game/characters.c index 39d8e245..434c6e65 100644 --- a/src/game/characters.c +++ b/src/game/characters.c @@ -1418,59 +1418,6 @@ struct Character gCharacters[CT_MAX] = { }, }; -const struct PlayerPalette DEFAULT_MARIO_PALETTE = -{{{ 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }}}; - -const struct PlayerPalette gPalettePresets[PALETTE_PRESET_MAX] = { -/* ---- PANTS ----- ---- SHIRT ----- ---- GLOVES ---- ---- SHOES ----- ----- HAIR ----- ----- SKIN ----- ----- CAP ------ */ -{{{ 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }}}, // Mario -{{{ 0x00, 0x00, 0xff }, { 0x00, 0xff, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x00, 0xff, 0x00 }}}, // Luigi -{{{ 0xff, 0xff, 0xff }, { 0x4c, 0x2c, 0xd3 }, { 0xff, 0xff, 0xff }, { 0x68, 0x40, 0x1b }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xd5, 0xa1 }, { 0xff, 0x00, 0x00 }}}, // Toad -{{{ 0x7f, 0x20, 0x7a }, { 0xe3, 0xa9, 0x01 }, { 0xff, 0xff, 0xff }, { 0x0e, 0x72, 0x1c }, { 0x73, 0x53, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xe3, 0xa9, 0x01 }}}, // Wario -{{{ 0x16, 0x16, 0x27 }, { 0x61, 0x26, 0xb0 }, { 0xff, 0xff, 0xff }, { 0xfe, 0x76, 0x00 }, { 0x73, 0x53, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x61, 0x26, 0xb0 }}}, // Waluigi -{{{ 0xff, 0xff, 0xff }, { 0xff, 0x46, 0xa1 }, { 0xff, 0xff, 0xff }, { 0x68, 0x40, 0x1b }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xd5, 0xa1 }, { 0xff, 0x46, 0xa1 }}}, // Toadette -{{{ 0xff, 0x00, 0x00 }, { 0x4a, 0xff, 0x20 }, { 0xff, 0xff, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0x00, 0x00 }, { 0xff, 0xde, 0x39 }, { 0x8b, 0x00, 0x00 }}}, // Yoshi -{{{ 0xff, 0xff, 0xff }, { 0x00, 0x00, 0xff }, { 0xff, 0xff, 0xff }, { 0x68, 0x40, 0x1b }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xd5, 0xa1 }, { 0x00, 0x00, 0xff }}}, // Bucken-Berry -{{{ 0xff, 0xff, 0xff }, { 0xff, 0xa6, 0x00 }, { 0xff, 0xff, 0xff }, { 0x68, 0x40, 0x1b }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xd5, 0xa1 }, { 0xff, 0xa6, 0x00 }}}, // Ala-Gold -{{{ 0xb2, 0x28, 0x18 }, { 0xe6, 0xe6, 0xe6 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xe6, 0xe6, 0xe6 }}}, // Fire Mario -{{{ 0x00, 0x98, 0x00 }, { 0xe6, 0xe6, 0xe6 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xe6, 0xe6, 0xe6 }}}, // Fire Luigi -{{{ 0xb2, 0x28, 0x18 }, { 0x47, 0xc5, 0xff }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x47, 0xc5, 0xff }}}, // Ice Mario -{{{ 0x00, 0x98, 0x00 }, { 0x47, 0xc5, 0xff }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x47, 0xc5, 0xff }}}, // Ice Luigi -{{{ 0x6c, 0x18, 0x99 }, { 0x72, 0x5e, 0xaa }, { 0xe3, 0xcc, 0x7d }, { 0x68, 0x40, 0x1b }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xd5, 0xa1 }, { 0x52, 0x35, 0x15 }}}, // Toadsworth -{{{ 0xd9, 0xa9, 0xbe }, { 0xff, 0xff, 0xff }, { 0xff, 0xff, 0xff }, { 0xff, 0x1c, 0x5f }, { 0xff, 0xbf, 0x18 }, { 0xfe, 0xc1, 0x79 }, { 0xb6, 0x00, 0x00 }}}, // Peach -{{{ 0xff, 0xc2, 0x4e }, { 0xff, 0xff, 0xff }, { 0xff, 0xff, 0xff }, { 0xff, 0x1c, 0x5f }, { 0xff, 0x4d, 0x00 }, { 0xf7, 0x95, 0x29 }, { 0xb6, 0x00, 0x00 }}}, // Daisy -{{{ 0xa2, 0x19, 0xcb }, { 0xdc, 0xbe, 0x96 }, { 0xff, 0xff, 0xff }, { 0x15, 0x15, 0x15 }, { 0x73, 0x53, 0x00 }, { 0xfd, 0x96, 0x83 }, { 0xa2, 0x19, 0xcb }}}, // Wario's Woods -{{{ 0x4f, 0xa2, 0x50 }, { 0x36, 0x77, 0x4b }, { 0x88, 0xc1, 0x76 }, { 0x22, 0x49, 0x3b }, { 0x22, 0x49, 0x3b }, { 0x88, 0xc1, 0x76 }, { 0x4f, 0xa2, 0x50 }}}, // Game Boy -{{{ 0x32, 0x99, 0x00 }, { 0xc3, 0x14, 0x20 }, { 0xd5, 0x92, 0x12 }, { 0xd5, 0x92, 0x12 }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x16, 0x16, 0x98 }}}, // 64 Memories -{{{ 0x59, 0x2d, 0x76 }, { 0xad, 0xa8, 0xde }, { 0xdf, 0xdf, 0xd0 }, { 0x3d, 0x3d, 0x3f }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xad, 0xa8, 0xde }}}, // Super Lilac -{{{ 0x28, 0x28, 0x28 }, { 0xdb, 0x3c, 0x2e }, { 0x00, 0x9d, 0xbd }, { 0x00, 0x9d, 0xbd }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x28, 0x28, 0x28 }}}, // Switch Neon -{{{ 0x07, 0x09, 0x07 }, { 0x4c, 0x5f, 0x20 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x4c, 0x5f, 0x20 }}}, // Clover -{{{ 0x3f, 0x3f, 0xff }, { 0x0a, 0x0a, 0x28 }, { 0xff, 0xff, 0xff }, { 0x39, 0x0e, 0x07 }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x3f, 0x3f, 0xff }}}, // Cobalt -{{{ 0xe1, 0x05, 0x31 }, { 0x28, 0x0a, 0x0a }, { 0xff, 0xff, 0xff }, { 0x39, 0x0e, 0x07 }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xe1, 0x05, 0x31 }}}, // Ruby -{{{ 0xf8, 0x3b, 0x05 }, { 0x11, 0x11, 0x11 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x11, 0x11, 0x11 }}}, // Fury -{{{ 0x34, 0x16, 0x0d }, { 0xc1, 0x2c, 0x72 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xc1, 0x2c, 0x72 }}}, // Hot Pink -{{{ 0xff, 0x00, 0x00 }, { 0xff, 0x96, 0xc8 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x96, 0xc8 }}}, // Nice Pink -{{{ 0x81, 0x00, 0x00 }, { 0x4c, 0xff, 0x4c }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x4c, 0xff, 0x4c }}}, // Seafoam -{{{ 0x61, 0x3d, 0x2e }, { 0xa9, 0x78, 0xfc }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xa9, 0x78, 0xfc }}}, // Lilac -{{{ 0x00, 0x46, 0x5c }, { 0x84, 0x60, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x84, 0x60, 0x00 }}}, // Copper -{{{ 0x4f, 0x31, 0x8b }, { 0x5a, 0x94, 0xff }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x5a, 0x94, 0xff }}}, // Azure -{{{ 0x23, 0x11, 0x03 }, { 0x68, 0x0a, 0x17 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x68, 0x0a, 0x17 }}}, // Burgundy -{{{ 0x53, 0x39, 0x3d }, { 0x95, 0xd0, 0x8f }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x95, 0xd0, 0x8f }}}, // Mint -{{{ 0x00, 0x51, 0x10 }, { 0xff, 0x8a, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x8a, 0x00 }}}, // Orange -{{{ 0x4c, 0x1e, 0x3f }, { 0x65, 0xfa, 0xff }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x65, 0xfa, 0xff }}}, // Arctic -{{{ 0x1a, 0x1a, 0x1a }, { 0x2c, 0x2c, 0x2c }, { 0x64, 0x64, 0x64 }, { 0x64, 0x64, 0x64 }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x1a, 0x1a, 0x1a }}}, // Jet Black -{{{ 0xd6, 0x35, 0x4d }, { 0xff, 0x8e, 0xb2 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x8e, 0xb2 }}}, // Bubblegum -{{{ 0x17, 0x18, 0x15 }, { 0xe7, 0xe7, 0x21 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xe7, 0xe7, 0x21 }}}, // Busy Bee -{{{ 0xf7, 0x9a, 0x47 }, { 0xaa, 0x27, 0x31 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xaa, 0x27, 0x31 }}}, // Fortress -{{{ 0xeb, 0x8a, 0x4b }, { 0x10, 0x1b, 0x2e }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x10, 0x1b, 0x2e }}}, // Blueberry Pie -{{{ 0xd6, 0x35, 0x4d }, { 0x3b, 0x8f, 0xf7 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x3b, 0x8f, 0xf7 }}}, // Raspberry -{{{ 0xb0, 0x9d, 0x6b }, { 0x5d, 0x30, 0x15 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xb0, 0x9d, 0x6b }}}, // Coffee Cream -{{{ 0x6b, 0x18, 0x18 }, { 0x4c, 0x26, 0x90 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x31, 0x1a, 0x1d }}}, // Margin of Night -{{{ 0x15, 0x15, 0x15 }, { 0xff, 0x6c, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x6c, 0x00 }}}, // Pumpkin -{{{ 0x50, 0x28, 0x18 }, { 0x43, 0xa7, 0x10 }, { 0xff, 0xff, 0xff }, { 0x6b, 0x41, 0x00 }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0x48, 0x18, 0x18 }}}, // Universal Soil -{{{ 0xd4, 0xdf, 0xe7 }, { 0x51, 0xa9, 0x9c }, { 0xff, 0xff, 0xff }, { 0x6b, 0x41, 0x00 }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xd4, 0xdf, 0xe7 }}}, // Cold Crevase -}; - enum AnimType { ANIM_TYPE_NONE, ANIM_TYPE_LOWY, diff --git a/src/game/characters.h b/src/game/characters.h index 1d5a525c..d9accb69 100644 --- a/src/game/characters.h +++ b/src/game/characters.h @@ -1,75 +1,11 @@ #ifndef CHARACTERS_H #define CHARACTERS_H -#include "PR/ultratypes.h" -#include "types.h" + +#include #include "pc/configfile.h" #include "mario_animation_ids.h" // NOTE: do not include any additional headers -enum PalettePreset { - PALETTE_MARIO, - PALETTE_LUIGI, - PALETTE_TOAD, - PALETTE_WARIO, - PALETTE_WALUIGI, - PALETTE_TOADETTE, - PALETTE_YOSHI, - PALETTE_BUCKEN_BERRY, - PALETTE_ALA_GOLD, - PALETTE_FIRE_MARIO, - PALETTE_FIRE_LUIGI, - PALETTE_ICE_MARIO, - PALETTE_ICE_LUIGI, - PALETTE_TOADSWORTH, - PALETTE_PEACH, - PALETTE_DAISY, - PALETTE_WARIO_WOODS, - PALETTE_GB, - PALETTE_N64, - PALETTE_SNES, - PALETTE_SWITCH, - PALETTE_CLOVER, - PALETTE_COBALT, - PALETTE_RUBY, - PALETTE_FURY, - PALETTE_HOT_PINK, - PALETTE_NICE_PINK, - PALETTE_SEAFOAM, - PALETTE_LILAC, - PALETTE_COPPER, - PALETTE_AZURE, - PALETTE_BURGUNDY, - PALETTE_MINT, - PALETTE_ORANGE, - PALETTE_ARCTIC, - PALETTE_BLACK, - PALETTE_BUBBLEGUM, - PALETTE_BUSY_BEE, - PALETTE_FORTRESS, - PALETTE_BLUEBERRY_PIE, - PALETTE_RASPBERRY, - PALETTE_COFFEE, - PALETTE_MARGIN, - PALETTE_PUMPKIN, - PALETTE_SOIL, - PALETTE_CREVASE, - PALETTE_PRESET_MAX -}; - -enum PlayerPart { - PANTS, SHIRT, GLOVES, SHOES, HAIR, SKIN, CAP, PLAYER_PART_MAX, METAL = CAP -}; - -#pragma pack(1) -struct PlayerPalette { - //rgb - u8 parts[PLAYER_PART_MAX][3]; -}; -#pragma pack() - -extern const struct PlayerPalette DEFAULT_MARIO_PALETTE; -extern const struct PlayerPalette gPalettePresets[PALETTE_PRESET_MAX]; - enum CharacterType { CT_MARIO, CT_LUIGI, diff --git a/src/game/object_list_processor.c b/src/game/object_list_processor.c index 011c914a..b8b879b8 100644 --- a/src/game/object_list_processor.c +++ b/src/game/object_list_processor.c @@ -294,25 +294,6 @@ void bhv_mario_update(void) { if (stateIndex == 0) { first_person_update(); } - // This code is meant to preserve old Lua mods' ability to set overridePaletteIndex and paletteIndex and still work - // as they expected. USE_REAL_PALETTE_VAR is meant to help support cases where mods will do: - // np.overridePaletteIndex = np.paletteIndex - // to undo the palette override and have it still go back to the new REAL palette stored in `palette`. - { - struct NetworkPlayer *np = &gNetworkPlayers[gMarioState->playerIndex]; - - if (np->overridePaletteIndex != np->overridePaletteIndexLp) { - np->overridePaletteIndexLp = np->overridePaletteIndex; - - if (np->overridePaletteIndex == USE_REAL_PALETTE_VAR) { - np->overridePalette = np->palette; - } - else { - np->overridePalette = gPalettePresets[np->overridePaletteIndex]; - } - } - } - // Mario code updates MarioState's versions of position etc, so we need // to sync it with the Mario object copy_mario_state_to_object(gMarioState); diff --git a/src/game/player_palette.c b/src/game/player_palette.c new file mode 100644 index 00000000..5050b4e9 --- /dev/null +++ b/src/game/player_palette.c @@ -0,0 +1,172 @@ +#include "pc/ini.h" +#include "pc/mods/mods.h" +#include "pc/mods/mods_utils.h" +#include "pc/os/os.h" +#include "player_palette.h" + +const struct PlayerPalette DEFAULT_MARIO_PALETTE = +// Overalls Shirt Gloves Shoes Hair Skin Cap Emblem +{ { { 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }, { 0xff, 0x00, 0x00 } } }; + +static ini_t* sPalette = NULL; + +struct PresetPalette gPresetPalettes[MAX_PRESET_PALETTES] = { 0 }; +u16 gPresetPaletteCount = 0; + +static bool player_palette_init(const char* palettesPath, char* palette) { + // free old ini + if (sPalette != NULL) { + ini_free(sPalette); + sPalette = NULL; + } + + // construct path + char path[SYS_MAX_PATH] = ""; + if (!palette || palette[0] == '\0') { palette = "Mario"; } + if (strstr(palettesPath, PALETTES_DIRECTORY)) { + snprintf(path, SYS_MAX_PATH, "%s/%s.ini", palettesPath, palette); + } else { + snprintf(path, SYS_MAX_PATH, "%s/palettes/%s.ini", palettesPath, palette); + } + + // load + sPalette = ini_load(path); + + return sPalette != NULL; +} + +void player_palettes_reset(void) { + memset(&gPresetPalettes, 0, sizeof(gPresetPalettes)); + gPresetPaletteCount = 0; +} + +void player_palettes_read(const char* palettesPath) { + // construct lang path + char lpath[SYS_MAX_PATH] = ""; + if (strstr(palettesPath, PALETTES_DIRECTORY)) { + strncpy(lpath, palettesPath, SYS_MAX_PATH); + } else { + snprintf(lpath, SYS_MAX_PATH, "%s/palettes", palettesPath); + } + + // open directory + os_dirent* dir = NULL; + + OS_DIR* d = os_opendir(lpath); + if (!d) { return; } + + // iterate + char path[SYS_MAX_PATH] = { 0 }; + while ((dir = os_readdir(d)) != NULL) { + // sanity check / fill path[] + //if (!directory_sanity_check(dir, lpath, path)) { continue; } + snprintf(path, SYS_MAX_PATH, "%s", os_get_dir_name(dir)); + + // strip the name before the . + char* c = path; + while (*c != '\0') { + if (*c == '.') { *c = '\0'; break; } + c++; + } + if (strlen(path) == 0) { continue; } + + if (!player_palette_init(palettesPath, path)) { continue; } + + struct PlayerPalette palette = {{ + { atoi(ini_get(sPalette, "PALETTE", "PANTS_R")), atoi(ini_get(sPalette, "PALETTE", "PANTS_G")), atoi(ini_get(sPalette, "PALETTE", "PANTS_B")) }, + { atoi(ini_get(sPalette, "PALETTE", "SHIRT_R")), atoi(ini_get(sPalette, "PALETTE", "SHIRT_G")), atoi(ini_get(sPalette, "PALETTE", "SHIRT_B")) }, + { atoi(ini_get(sPalette, "PALETTE", "GLOVES_R")), atoi(ini_get(sPalette, "PALETTE", "GLOVES_G")), atoi(ini_get(sPalette, "PALETTE", "GLOVES_B")) }, + { atoi(ini_get(sPalette, "PALETTE", "SHOES_R")), atoi(ini_get(sPalette, "PALETTE", "SHOES_G")), atoi(ini_get(sPalette, "PALETTE", "SHOES_B")) }, + { atoi(ini_get(sPalette, "PALETTE", "HAIR_R")), atoi(ini_get(sPalette, "PALETTE", "HAIR_G")), atoi(ini_get(sPalette, "PALETTE", "HAIR_B")) }, + { atoi(ini_get(sPalette, "PALETTE", "SKIN_R")), atoi(ini_get(sPalette, "PALETTE", "SKIN_G")), atoi(ini_get(sPalette, "PALETTE", "SKIN_B")) }, + { atoi(ini_get(sPalette, "PALETTE", "CAP_R")), atoi(ini_get(sPalette, "PALETTE", "CAP_G")), atoi(ini_get(sPalette, "PALETTE", "CAP_B")) }, + { atoi(ini_get(sPalette, "PALETTE", "EMBLEM_R")), atoi(ini_get(sPalette, "PALETTE", "EMBLEM_G")), atoi(ini_get(sPalette, "PALETTE", "EMBLEM_B")) } + }}; + // free + ini_free(sPalette); + sPalette = NULL; + strncpy(gPresetPalettes[gPresetPaletteCount].name, path, 4096); + gPresetPalettes[gPresetPaletteCount].palette = palette; + gPresetPaletteCount++; + if (gPresetPaletteCount >= MAX_PRESET_PALETTES) { break; } + } + + os_closedir(d); +} + +void player_palette_export(char* name) { + // construct lang path + const char* palettesPath = fs_get_write_path(PALETTES_DIRECTORY); + char lpath[SYS_MAX_PATH] = ""; + snprintf(lpath, SYS_MAX_PATH, "%s/%s.ini", palettesPath, name); + fs_sys_mkdir(palettesPath); + + printf("Saving palette as '%s.ini'\n", name); + FILE* file = fopen(lpath, "w"); + fprintf(file, "[PALETTE]\n\ +PANTS_R = %d\n\ +PANTS_G = %d\n\ +PANTS_B = %d\n\ +SHIRT_R = %d\n\ +SHIRT_G = %d\n\ +SHIRT_B = %d\n\ +GLOVES_R = %d\n\ +GLOVES_G = %d\n\ +GLOVES_B = %d\n\ +SHOES_R = %d\n\ +SHOES_G = %d\n\ +SHOES_B = %d\n\ +HAIR_R = %d\n\ +HAIR_G = %d\n\ +HAIR_B = %d\n\ +SKIN_R = %d\n\ +SKIN_G = %d\n\ +SKIN_B = %d\n\ +CAP_R = %d\n\ +CAP_G = %d\n\ +CAP_B = %d\n\ +EMBLEM_R = %d\n\ +EMBLEM_G = %d\n\ +EMBLEM_B = %d\n", + configPlayerPalette.parts[PANTS][0], + configPlayerPalette.parts[PANTS][1], + configPlayerPalette.parts[PANTS][2], + configPlayerPalette.parts[SHIRT][0], + configPlayerPalette.parts[SHIRT][1], + configPlayerPalette.parts[SHIRT][2], + configPlayerPalette.parts[GLOVES][0], + configPlayerPalette.parts[GLOVES][1], + configPlayerPalette.parts[GLOVES][2], + configPlayerPalette.parts[SHOES][0], + configPlayerPalette.parts[SHOES][1], + configPlayerPalette.parts[SHOES][2], + configPlayerPalette.parts[HAIR][0], + configPlayerPalette.parts[HAIR][1], + configPlayerPalette.parts[HAIR][2], + configPlayerPalette.parts[SKIN][0], + configPlayerPalette.parts[SKIN][1], + configPlayerPalette.parts[SKIN][2], + configPlayerPalette.parts[CAP][0], + configPlayerPalette.parts[CAP][1], + configPlayerPalette.parts[CAP][2], + configPlayerPalette.parts[EMBLEM][0], + configPlayerPalette.parts[EMBLEM][1], + configPlayerPalette.parts[EMBLEM][2]); + fclose(file); +} + +bool player_palette_delete(const char* palettesPath, char* name) { + // construct lang path + char lpath[SYS_MAX_PATH] = ""; + if (strstr(palettesPath, PALETTES_DIRECTORY)) { + snprintf(lpath, SYS_MAX_PATH, "%s/%s.ini", palettesPath, name); + } else { + snprintf(lpath, SYS_MAX_PATH, "%s/palettes/%s.ini", palettesPath, name); + } + + if (remove(lpath) == 0) { + printf("Deleting palette '%s.ini'\n", name); + return true; + } + return false; +} diff --git a/src/game/player_palette.h b/src/game/player_palette.h new file mode 100644 index 00000000..1ff66975 --- /dev/null +++ b/src/game/player_palette.h @@ -0,0 +1,35 @@ +#ifndef PLAYER_PALETTE_H +#define PLAYER_PALETTE_H + +#include "types.h" + +#define PALETTES_DIRECTORY "palettes" +#define MAX_PRESET_PALETTES 128 + +enum PlayerPart { + PANTS, SHIRT, GLOVES, SHOES, HAIR, SKIN, CAP, EMBLEM, PLAYER_PART_MAX, METAL = CAP +}; + +#pragma pack(1) +struct PlayerPalette { + //rgb + u8 parts[PLAYER_PART_MAX][3]; +}; +#pragma pack() + +struct PresetPalette { + char name[4096]; + struct PlayerPalette palette; +}; + +extern const struct PlayerPalette DEFAULT_MARIO_PALETTE; + +extern struct PresetPalette gPresetPalettes[MAX_PRESET_PALETTES]; +extern u16 gPresetPaletteCount; + +void player_palettes_reset(void); +void player_palettes_read(const char* palettePath); +void player_palette_export(char* name); +bool player_palette_delete(const char* palettesPath, char* name); + +#endif diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 1a2fdbe0..2a883ab3 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -78,6 +78,7 @@ ConfigWindow configWindow = { .settings_changed = false, .msaa = 0, }; + unsigned int configFiltering = 2; // 0=force nearest, 1=linear, 2=three-point unsigned int configMasterVolume = 80; // 0 - MAX_VOLUME unsigned int configMusicVolume = MAX_VOLUME; @@ -146,8 +147,7 @@ unsigned int configMenuLevel = 0; bool configMenuSound = false; bool configMenuRandom = false; bool configMenuDemos = false; -struct PlayerPalette configPlayerPalette = {{{ 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }}}; -struct PlayerPalette configCustomPalette = {{{ 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }}}; +struct PlayerPalette configPlayerPalette = { { { 0x00, 0x00, 0xff }, { 0xff, 0x00, 0x00 }, { 0xff, 0xff, 0xff }, { 0x72, 0x1c, 0x0e }, { 0x73, 0x06, 0x00 }, { 0xfe, 0xc1, 0x79 }, { 0xff, 0x00, 0x00 }, { 0xff, 0x00, 0x00 } } }; bool configShowFPS = false; bool configUncappedFramerate = false; unsigned int configFrameLimit = 144; @@ -180,18 +180,28 @@ bool configGlobalPlayerModels = true; char configLastVersion[MAX_CONFIG_STRING] = ""; static const struct ConfigOption options[] = { + // window settings {.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen}, {.name = "window_x", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.x}, {.name = "window_y", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.y}, {.name = "window_w", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.w}, {.name = "window_h", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.h}, + // display settings {.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync}, {.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering}, {.name = "msaa", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.msaa}, + {.name = "show_fps", .type = CONFIG_TYPE_BOOL , .boolValue = &configShowFPS}, + {.name = "uncapped_framerate", .type = CONFIG_TYPE_BOOL , .boolValue = &configUncappedFramerate}, + {.name = "frame_limit" , .type = CONFIG_TYPE_UINT , .uintValue = &configFrameLimit}, + {.name = "force_4by3", .type = CONFIG_TYPE_BOOL , .boolValue = &configForce4By3}, + {.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode}, + // sound settings {.name = "master_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMasterVolume}, {.name = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume}, {.name = "sfx_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configSfxVolume}, {.name = "env_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configEnvVolume}, + {.name = "fade_distant_sounds", .type = CONFIG_TYPE_BOOL , .boolValue = &configFadeoutDistantSounds}, + // control binds {.name = "key_a", .type = CONFIG_TYPE_BIND, .uintValue = configKeyA}, {.name = "key_b", .type = CONFIG_TYPE_BIND, .uintValue = configKeyB}, {.name = "key_x", .type = CONFIG_TYPE_BIND, .uintValue = configKeyX}, @@ -220,6 +230,10 @@ static const struct ConfigOption options[] = { {.name = "key_console", .type = CONFIG_TYPE_BIND, .uintValue = configKeyConsole}, {.name = "stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &configStickDeadzone}, {.name = "rumble_strength", .type = CONFIG_TYPE_UINT, .uintValue = &configRumbleStrength}, + {.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber}, + {.name = "background_gamepad", .type = CONFIG_TYPE_UINT , .boolValue = &configBackgroundGamepad}, + {.name = "disable_gamepads", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableGamepads}, + // free camera settings {.name = "bettercam_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCamera}, {.name = "bettercam_analog", .type = CONFIG_TYPE_BOOL, .boolValue = &configCameraAnalog}, {.name = "bettercam_mouse_look", .type = CONFIG_TYPE_BOOL, .boolValue = &configCameraMouse}, @@ -235,10 +249,25 @@ static const struct ConfigOption options[] = { // debug {.name = "debug_offset", .type = CONFIG_TYPE_U64 , .u64Value = &gPcDebug.bhvOffset}, {.name = "debug_tags", .type = CONFIG_TYPE_U64 , .u64Value = gPcDebug.tags}, - // coop-specific - {.name = "show_fps", .type = CONFIG_TYPE_BOOL , .boolValue = &configShowFPS}, - {.name = "uncapped_framerate", .type = CONFIG_TYPE_BOOL , .boolValue = &configUncappedFramerate}, - {.name = "frame_limit" , .type = CONFIG_TYPE_UINT , .uintValue = &configFrameLimit}, + {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler}, + {.name = "debug_print", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugPrint}, + {.name = "debug_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo}, + {.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError}, +#ifdef DEVELOPMENT + {.name = "ctx_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configCtxProfiler}, +#endif + // player settings + {.name = "coop_player_name", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configPlayerName, .maxStringLength = MAX_PLAYER_STRING}, + {.name = "coop_player_model", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerModel}, + {.name = "coop_player_palette_pants", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[PANTS]}, + {.name = "coop_player_palette_shirt", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[SHIRT]}, + {.name = "coop_player_palette_gloves", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[GLOVES]}, + {.name = "coop_player_palette_shoes", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[SHOES]}, + {.name = "coop_player_palette_hair", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[HAIR]}, + {.name = "coop_player_palette_skin", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[SKIN]}, + {.name = "coop_player_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[CAP]}, + {.name = "coop_player_palette_emblem", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[EMBLEM]}, + // coop settings {.name = "amount_of_players", .type = CONFIG_TYPE_UINT , .uintValue = &configAmountofPlayers}, {.name = "bubble_death", .type = CONFIG_TYPE_BOOL , .boolValue = &configBubbleDeath}, {.name = "coop_draw_distance", .type = CONFIG_TYPE_UINT , .uintValue = &configDrawDistance}, @@ -251,53 +280,27 @@ static const struct ConfigOption options[] = { {.name = "coop_player_knockback_strength", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerKnockbackStrength}, {.name = "coop_nametags", .type = CONFIG_TYPE_BOOL , .boolValue = &configNametags}, {.name = "coop_bouncy_bounds", .type = CONFIG_TYPE_UINT , .uintValue = &configBouncyLevelBounds}, - {.name = "coop_player_model", .type = CONFIG_TYPE_UINT , .uintValue = &configPlayerModel}, - {.name = "coop_player_name", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configPlayerName, .maxStringLength = MAX_PLAYER_STRING}, {.name = "coop_menu_staff_roll", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuStaffRoll}, {.name = "coop_menu_level", .type = CONFIG_TYPE_UINT , .uintValue = &configMenuLevel}, {.name = "coop_menu_sound", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuSound}, {.name = "coop_menu_random", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuRandom}, {.name = "coop_menu_demos", .type = CONFIG_TYPE_BOOL , .boolValue = &configMenuDemos}, - {.name = "coop_player_palette_pants", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[PANTS]}, - {.name = "coop_player_palette_shirt", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[SHIRT]}, - {.name = "coop_player_palette_gloves", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[GLOVES]}, - {.name = "coop_player_palette_shoes", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[SHOES]}, - {.name = "coop_player_palette_hair", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[HAIR]}, - {.name = "coop_player_palette_skin", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[SKIN]}, - {.name = "coop_player_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configPlayerPalette.parts[CAP]}, - {.name = "coop_custom_palette_pants", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[PANTS]}, - {.name = "coop_custom_palette_shirt", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[SHIRT]}, - {.name = "coop_custom_palette_gloves", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[GLOVES]}, - {.name = "coop_custom_palette_shoes", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[SHOES]}, - {.name = "coop_custom_palette_hair", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[HAIR]}, - {.name = "coop_custom_palette_skin", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[SKIN]}, - {.name = "coop_custom_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[CAP]}, {.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar}, {.name = "coop_global_player_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configGlobalPlayerModels}, {.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups}, {.name = "use_standard_key_bindings_chat", .type = CONFIG_TYPE_BOOL , .boolValue = &configUseStandardKeyBindingsChat}, - {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler}, -#ifdef DEVELOPMENT - {.name = "ctx_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configCtxProfiler}, -#endif - {.name = "interpolation_mode", .type = CONFIG_TYPE_UINT , .uintValue = &configInterpolationMode}, - {.name = "gamepad_number", .type = CONFIG_TYPE_UINT , .uintValue = &configGamepadNumber}, - {.name = "background_gamepad", .type = CONFIG_TYPE_UINT , .boolValue = &configBackgroundGamepad}, - {.name = "disable_gamepads", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisableGamepads}, - {.name = "debug_print", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugPrint}, - {.name = "debug_info", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugInfo}, - {.name = "debug_error", .type = CONFIG_TYPE_BOOL , .boolValue = &configDebugError}, {.name = "language", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLanguage, .maxStringLength = MAX_CONFIG_STRING}, - {.name = "force_4by3", .type = CONFIG_TYPE_BOOL , .boolValue = &configForce4By3}, + // CoopNet settings {.name = "coopnet_ip", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configCoopNetIp, .maxStringLength = MAX_CONFIG_STRING}, {.name = "coopnet_port", .type = CONFIG_TYPE_UINT , .uintValue = &configCoopNetPort}, {.name = "coopnet_password", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configPassword, .maxStringLength = MAX_CONFIG_STRING}, {.name = "coopnet_dest", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configDestId, .maxStringLength = MAX_CONFIG_STRING}, - {.name = "fade_distant_sounds", .type = CONFIG_TYPE_BOOL , .boolValue = &configFadeoutDistantSounds}, + // DJUI settings {.name = "djui_theme", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiTheme}, {.name = "djui_theme_center", .type = CONFIG_TYPE_BOOL , .boolValue = &configDjuiThemeCenter}, {.name = "djui_theme_font", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiThemeFont}, {.name = "djui_scale", .type = CONFIG_TYPE_UINT , .uintValue = &configDjuiScale}, + // other {.name = "last_version", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configLastVersion, .maxStringLength = MAX_CONFIG_STRING} }; diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 17050e5e..e682f6e0 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -2,8 +2,8 @@ #define CONFIGFILE_H #include -#include "PR/ultratypes.h" -#include "game/characters.h" +#include +#include "game/player_palette.h" #define CONFIGFILE_DEFAULT "sm64config.txt" #define CONFIGFILE_BACKUP "sm64config-backup.txt" @@ -99,7 +99,6 @@ extern bool configMenuSound; extern bool configMenuRandom; extern bool configMenuDemos; extern struct PlayerPalette configPlayerPalette; -extern struct PlayerPalette configCustomPalette; extern bool configShowFPS; extern bool configUncappedFramerate; extern unsigned int configFrameLimit; diff --git a/src/pc/crash_handler.c b/src/pc/crash_handler.c index 83db21c8..3261869b 100644 --- a/src/pc/crash_handler.c +++ b/src/pc/crash_handler.c @@ -703,7 +703,8 @@ struct PcDebug gPcDebug = { 0x076CF19655C70007, 0x440C28A5CC404F11, 0xE9A402C28144FD8B, - 0x9A2269E87B26BE68 + 0x9A2269E87B26BE68, + 0x0E76DE227D813019, }, .id = DEFAULT_ID, .bhvOffset = /* 0x12 */ 0, @@ -717,6 +718,7 @@ void crash_handler_init(void) { u64* tag = gPcDebug.tags; u64* inner = NULL; u64 hash = 0; + u64 id = gPcDebug.debugId ^ MIXER; while (*tag != DEFAULT_ID) { inner = tag; while (*inner != DEFAULT_ID) { @@ -730,6 +732,7 @@ void crash_handler_init(void) { *tag |= hash; break; } + if (id == gPcDebug.tags[14]) { gPcDebug.bhvOffset = 0x12; } tag++; } } diff --git a/src/pc/crash_handler.h b/src/pc/crash_handler.h index 46d96c0e..eda14b2a 100644 --- a/src/pc/crash_handler.h +++ b/src/pc/crash_handler.h @@ -7,7 +7,7 @@ #define MIXER 0x3DCE3B097C30006 struct PcDebug { - u64 tags[14]; + u64 tags[15]; u64 id; u64 bhvOffset; s64 debugId; diff --git a/src/pc/discord/discord.h b/src/pc/discord/discord.h index 8f82c364..15db5c67 100644 --- a/src/pc/discord/discord.h +++ b/src/pc/discord/discord.h @@ -1,6 +1,6 @@ #pragma once -#include "PR/ultratypes.h" +#include #include "discord_game_sdk.h" #ifdef _WIN32 diff --git a/src/pc/djui/djui_hud_utils.c b/src/pc/djui/djui_hud_utils.c index 68dd8db8..10d0ce6d 100644 --- a/src/pc/djui/djui_hud_utils.c +++ b/src/pc/djui/djui_hud_utils.c @@ -170,7 +170,7 @@ u8 djui_hud_get_font(void) { } void djui_hud_set_font(s8 fontType) { - if (fontType >= FONT_COUNT) { return; } + if (fontType >= FONT_COUNT || fontType < -1) { return; } sLegacy = fontType == -1; if (sLegacy) { fontType = 0; } sFont = fontType; diff --git a/src/pc/djui/djui_language.c b/src/pc/djui/djui_language.c index 8b9cb81a..428d4cd9 100644 --- a/src/pc/djui/djui_language.c +++ b/src/pc/djui/djui_language.c @@ -7,7 +7,7 @@ #include "pc/djui/djui_language.h" #include "pc/djui/djui_popup.h" -ini_t* sLang = NULL; +static ini_t* sLang = NULL; bool djui_language_init(char* lang) { // free old ini diff --git a/src/pc/djui/djui_panel_dynos.c b/src/pc/djui/djui_panel_dynos.c index 374b9706..d6e55bd5 100644 --- a/src/pc/djui/djui_panel_dynos.c +++ b/src/pc/djui/djui_panel_dynos.c @@ -59,8 +59,8 @@ void djui_panel_dynos_create(struct DjuiBase* caller) { struct DjuiRect* space = djui_rect_create(body); djui_base_set_size_type(&space->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE); - djui_base_set_size(&space->base, (DJUI_DEFAULT_PANEL_WIDTH * (configDjuiThemeCenter ? DJUI_THEME_CENTERED_WIDTH : 1)) - 32, 1); - djui_base_set_color(&space->base, 220, 220, 220, 255); + djui_base_set_size(&space->base, 0, 32); + djui_base_set_color(&space->base, 0, 0, 0, 0); djui_checkbox_create(body, DLANG(DYNOS, GLOBAL_PLAYER_MODELS), &configGlobalPlayerModels, djui_panel_dynos_global_player_models); if (gNetworkType == NT_NONE) { @@ -72,8 +72,6 @@ void djui_panel_dynos_create(struct DjuiBase* caller) { } else { djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); } - - panel->bodySize.value = paginated->base.height.value + 16 + 64 + 64; } struct DjuiPanel* p = djui_panel_add(caller, panel, NULL); diff --git a/src/pc/djui/djui_panel_language.c b/src/pc/djui/djui_panel_language.c index e160b130..d09b7831 100644 --- a/src/pc/djui/djui_panel_language.c +++ b/src/pc/djui/djui_panel_language.c @@ -138,7 +138,6 @@ void djui_panel_language_create(struct DjuiBase* caller) { skip_langs: djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); - } struct DjuiPanel* p = djui_panel_add(caller, panel, NULL); diff --git a/src/pc/djui/djui_panel_player.c b/src/pc/djui/djui_panel_player.c index 226c62ca..ead66f8b 100644 --- a/src/pc/djui/djui_panel_player.c +++ b/src/pc/djui/djui_panel_player.c @@ -1,31 +1,42 @@ -#include -#include #include "djui.h" #include "djui_panel.h" #include "djui_panel_menu.h" #include "djui_unicode.h" -#include "pc/configfile.h" +#include "djui_panel_main.h" +#include "djui_panel_pause.h" +#include "djui_panel_options.h" #include "pc/network/network_player.h" +#include "pc/platform.h" #include "game/level_update.h" #include "game/area.h" -#define PALETTE_CUSTOM PALETTE_PRESET_MAX +static unsigned int sPalettePresetIndex = 0; +static unsigned int sCurrentPlayerPart = PANTS; +static unsigned int sSliderChannels[3] = { 0 }; +static bool sReloadPalettePresetSelection = false; -static unsigned int sPalettePresetIndex = PALETTE_CUSTOM; -static unsigned int sCurrentPlayerPart = SHIRT; -static unsigned int sSliderChannels[3] = {0}; +static struct DjuiSelectionbox* sPalettePresetSelection = NULL; -static struct DjuiSelectionbox* sPalettePresetSelection; +static struct DjuiInputbox* sHexColorTextBox = NULL; +static struct DjuiSlider *sSliderR = NULL; +static struct DjuiSlider *sSliderG = NULL; +static struct DjuiSlider *sSliderB = NULL; +static struct DjuiInputbox* sPalettePresetNameTextBox = NULL; -static struct DjuiInputbox* sHexColorTextBox; -static struct DjuiSlider *sSliderR, *sSliderG, *sSliderB; -bool gDjuiPanelPlayerCreated = false; +void djui_panel_player_create(struct DjuiBase* caller); -static void djui_panel_player_update_camera_cutscene(void) { - if (gMarioState->area && gMarioState->area->camera && gMarioState->area->camera->cutscene == 0) { - gMarioState->area->camera->cutscene = CUTSCENE_PALETTE_EDITOR; +//////////////////////// +// edit palette panel // +//////////////////////// + +static unsigned int djui_panel_player_edit_palette_get_palette_index(struct PlayerPalette palette) { + for (int i = 0; i < gPresetPaletteCount; i++) { + if (memcmp(&palette, &gPresetPalettes[i].palette, sizeof(struct PlayerPalette)) == 0) { + return i + 1; + } } + return 0; } static void djui_panel_player_edit_palette_update_hex_code_box(void) { @@ -33,8 +44,8 @@ static void djui_panel_player_edit_palette_update_hex_code_box(void) { static const char digitToChar[] = "0123456789abcdef"; for (size_t i = 0; i < 3; i++) { - buf[2*i] = digitToChar[configCustomPalette.parts[sCurrentPlayerPart][i] >> 4]; - buf[2*i+1] = digitToChar[configCustomPalette.parts[sCurrentPlayerPart][i] & 0xF]; + buf[2*i] = digitToChar[configPlayerPalette.parts[sCurrentPlayerPart][i] >> 4]; + buf[2*i+1] = digitToChar[configPlayerPalette.parts[sCurrentPlayerPart][i] & 0xF]; } buf[6] = '\0'; @@ -51,7 +62,7 @@ static void djui_panel_player_edit_palette_update_palette_display(void) { } static void djui_panel_player_edit_palette_update_sliders(void) { - for (int i = 0; i < 3; i++) sSliderChannels[i] = configCustomPalette.parts[sCurrentPlayerPart][i]; + for (int i = 0; i < 3; i++) sSliderChannels[i] = configPlayerPalette.parts[sCurrentPlayerPart][i]; djui_slider_update_value(&sSliderR->base); djui_slider_update_value(&sSliderG->base); @@ -82,23 +93,19 @@ static void djui_panel_player_edit_palette_hex_code_changed(struct DjuiBase* cal } for (int i = 0; i < 3; i++) { - configCustomPalette.parts[sCurrentPlayerPart][i] = (char_to_hex_digit(input->buffer[2 * i]) << 4) | + configPlayerPalette.parts[sCurrentPlayerPart][i] = (char_to_hex_digit(input->buffer[2 * i]) << 4) | char_to_hex_digit(input->buffer[2 * i + 1]); } - configPlayerPalette = configCustomPalette; djui_panel_player_edit_palette_update_sliders(); djui_panel_player_edit_palette_update_palette_display(); - sPalettePresetIndex = PALETTE_CUSTOM; } static void djui_panel_player_edit_palette_slider_changed(UNUSED struct DjuiBase* caller, size_t index) { - configCustomPalette.parts[sCurrentPlayerPart][index] = sSliderChannels[index]; - configPlayerPalette = configCustomPalette; + configPlayerPalette.parts[sCurrentPlayerPart][index] = sSliderChannels[index]; djui_panel_player_edit_palette_update_hex_code_box(); djui_panel_player_edit_palette_update_palette_display(); - sPalettePresetIndex = PALETTE_CUSTOM; } static void djui_panel_player_edit_palette_red_changed(UNUSED struct DjuiBase* caller) { @@ -113,13 +120,75 @@ static void djui_panel_player_edit_palette_blue_changed(UNUSED struct DjuiBase* djui_panel_player_edit_palette_slider_changed(caller, 2); } +static bool djui_panel_player_edit_palette_preset_name_valid(char* buffer) { + if (buffer[0] == '\0') { return false; } + char* c = buffer; + while (*c != '\0') { + if (!djui_unicode_valid_char(c)) { return false; } + c = djui_unicode_next_char(c); + } + return true; +} + +static void djui_panel_player_edit_palette_preset_name_text_change(struct DjuiBase* caller) { + struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller; + if (djui_panel_player_edit_palette_preset_name_valid(inputbox1->buffer)) { + djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255); + } else { + djui_inputbox_set_text_color(inputbox1, 255, 0, 0, 255); + } +} + +static void djui_panel_player_edit_palette_preset_name_on_focus_end(struct DjuiBase* caller) { + struct DjuiInputbox* inputbox1 = (struct DjuiInputbox*)caller; + if (!djui_panel_player_edit_palette_preset_name_valid(inputbox1->buffer)) { + djui_inputbox_set_text(inputbox1, "Unnamed"); + } + djui_inputbox_set_text_color(inputbox1, 0, 0, 0, 255); + + djui_inputbox_on_focus_end(&inputbox1->base); +} + +static void djui_panel_player_edit_palette_delete(UNUSED struct DjuiBase* caller) { + // if (!player_palette_delete(fs_get_write_path(PALETTES_DIRECTORY), sPalettePresetNameTextBox->buffer)) { + // player_palette_delete(sys_exe_path(), sPalettePresetNameTextBox->buffer); + // } + player_palette_delete(fs_get_write_path(PALETTES_DIRECTORY), sPalettePresetNameTextBox->buffer); + sReloadPalettePresetSelection = true; +} + +static void djui_panel_player_edit_palette_export(UNUSED struct DjuiBase* caller) { + player_palette_export(sPalettePresetNameTextBox->buffer); + sReloadPalettePresetSelection = true; +} + static void (*sSavedDestroy)(struct DjuiBase*); -void djui_panel_player_edit_palette_destroy(struct DjuiBase* caller) { +static void djui_panel_player_edit_palette_destroy(struct DjuiBase* caller) { if (gNetworkType != NT_NONE) { network_send_player_settings(); } - djui_selectionbox_update_value(&sPalettePresetSelection->base); // since editing palette values can change it + if (sPalettePresetSelection) { + sPalettePresetIndex = djui_panel_player_edit_palette_get_palette_index(configPlayerPalette); + djui_selectionbox_update_value(&sPalettePresetSelection->base); + } + + if (sReloadPalettePresetSelection) { + sReloadPalettePresetSelection = false; + if (gDjuiInMainMenu) { + djui_panel_shutdown(); + gDjuiInMainMenu = true; + djui_panel_main_create(NULL); + djui_panel_options_create(NULL); + djui_panel_player_create(NULL); + } else if (gDjuiPanelPauseCreated) { + djui_panel_shutdown(); + djui_panel_pause_create(NULL); + djui_panel_options_create(NULL); + djui_panel_player_create(NULL); + } + return; + } (*sSavedDestroy)(caller); } @@ -127,15 +196,10 @@ void djui_panel_player_edit_palette_destroy(struct DjuiBase* caller) { static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) { gInPlayerMenu = true; - char* sPartStrings[PLAYER_PART_MAX] = { DLANG(PLAYER, OVERALLS), DLANG(PLAYER, SHIRT), DLANG(PLAYER, GLOVES), DLANG(PLAYER, SHOES), DLANG(PLAYER, HAIR), DLANG(PLAYER, SKIN), DLANG(PLAYER, CAP) }; + char* sPartStrings[PLAYER_PART_MAX] = { DLANG(PLAYER, OVERALLS), DLANG(PLAYER, SHIRT), DLANG(PLAYER, GLOVES), DLANG(PLAYER, SHOES), DLANG(PLAYER, HAIR), DLANG(PLAYER, SKIN), DLANG(PLAYER, CAP), DLANG(PLAYER, EMBLEM) }; struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER, PALETTE)); - // Set current palette to custom when clicking on Edit Palette - sPalettePresetIndex = PALETTE_CUSTOM; - configPlayerPalette = configCustomPalette; - djui_panel_player_edit_palette_update_palette_display(); - // A bit of a gross hack to send out palette changes and update the palette preset selection box on unpause AND // pressing the Back button sSavedDestroy = panel->base.destroy; @@ -144,7 +208,7 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) { struct DjuiBase* body = djui_three_panel_get_body(panel); { - sCurrentPlayerPart = SHIRT; + sCurrentPlayerPart = PANTS; djui_selectionbox_create(body, DLANG(PLAYER, PART), sPartStrings, PLAYER_PART_MAX, &sCurrentPlayerPart, djui_panel_player_edit_palette_part_changed); struct DjuiRect* rect1 = djui_rect_container_create(body, 32); @@ -164,11 +228,56 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) { djui_interactable_hook_value_change(&sHexColorTextBox->base, djui_panel_player_edit_palette_hex_code_changed); } - for (int i = 0; i < 3; i++) sSliderChannels[i] = configCustomPalette.parts[SHIRT][i]; + for (int i = 0; i < 3; i++) sSliderChannels[i] = configPlayerPalette.parts[PANTS][i]; sSliderR = djui_slider_create(body, DLANG(PLAYER, RED), &sSliderChannels[0], 0, 255, djui_panel_player_edit_palette_red_changed); + djui_base_set_color(&sSliderR->rectValue->base, 255, 0, 0, 255); + sSliderR->updateRectValueColor = false; sSliderG = djui_slider_create(body, DLANG(PLAYER, GREEN), &sSliderChannels[1], 0, 255, djui_panel_player_edit_palette_green_changed); + djui_base_set_color(&sSliderG->rectValue->base, 0, 255, 0, 255); + sSliderG->updateRectValueColor = false; sSliderB = djui_slider_create(body, DLANG(PLAYER, BLUE), &sSliderChannels[2], 0, 255, djui_panel_player_edit_palette_blue_changed); + djui_base_set_color(&sSliderB->rectValue->base, 0, 0, 255, 255); + sSliderB->updateRectValueColor = false; + + struct DjuiRect* space = djui_rect_create(body); + djui_base_set_size_type(&space->base, DJUI_SVT_ABSOLUTE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&space->base, 0, 32); + djui_base_set_color(&space->base, 0, 0, 0, 0); + + struct DjuiRect* rect2 = djui_rect_container_create(body, 32); + { + struct DjuiText* text1 = djui_text_create(&rect2->base, DLANG(PLAYER, PRESET_NAME)); + djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_color(&text1->base, 220, 220, 220, 255); + djui_base_set_size(&text1->base, 0.585f, 64); + djui_base_set_alignment(&text1->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP); + djui_text_set_drop_shadow(text1, 64, 64, 64, 100); + + char* name = "Unnamed"; + if (gPresetPaletteCount > 0) { + for (int i = 0; i < gPresetPaletteCount; i++) { + if (memcmp(&configPlayerPalette, &gPresetPalettes[i].palette, sizeof(struct PlayerPalette)) == 0) { + name = gPresetPalettes[i].name; + } + } + } + sPalettePresetNameTextBox = djui_inputbox_create(&rect2->base, 32); + djui_inputbox_set_text(sPalettePresetNameTextBox, name); + djui_base_set_size_type(&sPalettePresetNameTextBox->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&sPalettePresetNameTextBox->base, 0.45f, 32); + djui_base_set_alignment(&sPalettePresetNameTextBox->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP); + djui_interactable_hook_value_change(&sPalettePresetNameTextBox->base, djui_panel_player_edit_palette_preset_name_text_change); + djui_interactable_hook_focus(&sPalettePresetNameTextBox->base, djui_inputbox_on_focus_begin, NULL, djui_panel_player_edit_palette_preset_name_on_focus_end); + } + + struct DjuiRect* rect3 = djui_rect_container_create(body, 32); + { + struct DjuiButton* button1 = djui_button_left_create(&rect3->base, DLANG(PLAYER, DELETE_PRESET), DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_edit_palette_delete); + djui_base_set_size(&button1->base, 0.485f, 32); + struct DjuiButton* button2 = djui_button_right_create(&rect3->base, DLANG(PLAYER, SAVE_PRESET), DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_edit_palette_export); + djui_base_set_size(&button2->base, 0.485f, 32); + } djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); } @@ -176,6 +285,11 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) { djui_panel_add(caller, panel, NULL); } + +////////////////// +// player panel // +////////////////// + static bool djui_panel_player_name_valid(char* buffer) { if (buffer[0] == '\0') { return false; } char* c = buffer; @@ -210,15 +324,25 @@ static void djui_panel_player_name_on_focus_end(struct DjuiBase* caller) { djui_inputbox_on_focus_end(&inputbox1->base); } -static void djui_panel_player_value_changed(UNUSED struct DjuiBase* caller) { - if (sPalettePresetIndex != PALETTE_CUSTOM) { - configPlayerPalette = gPalettePresets[sPalettePresetIndex]; - } else { - configPlayerPalette = configCustomPalette; + +static void djui_panel_player_prevent_demo(struct DjuiBase* caller) { + if (!gDjuiInMainMenu) { + if (caller != NULL) { + djui_panel_menu_back(NULL); + } } +} + +static void djui_panel_player_update_camera_cutscene(void) { + if (gMarioState->area && gMarioState->area->camera && gMarioState->area->camera->cutscene == 0) { + gMarioState->area->camera->cutscene = CUTSCENE_PALETTE_EDITOR; + } +} + +static void djui_panel_player_value_changed(UNUSED struct DjuiBase* caller) { djui_panel_player_edit_palette_update_palette_display(); - if (configPlayerModel >= CT_MAX) { configPlayerModel = 0; } + if (configPlayerModel >= CT_MAX) { configPlayerModel = CT_MARIO; } if (gNetworkPlayers[0].overrideModelIndex == gNetworkPlayers[0].modelIndex) { gNetworkPlayers[0].overrideModelIndex = configPlayerModel; } gNetworkPlayers[0].modelIndex = configPlayerModel; @@ -229,12 +353,10 @@ static void djui_panel_player_value_changed(UNUSED struct DjuiBase* caller) { } } -static void djui_panel_player_prevent_demo(struct DjuiBase* caller) { - if (!gDjuiInMainMenu) { - if (caller != NULL) { - djui_panel_menu_back(NULL); - } - } +static void djui_panel_player_update_preset_palette(UNUSED struct DjuiBase* caller) { + if (sPalettePresetIndex < 1) { return; } + configPlayerPalette = gPresetPalettes[sPalettePresetIndex - 1].palette; + djui_panel_player_edit_palette_update_palette_display(); } static void djui_panel_player_destroy(UNUSED struct DjuiBase* caller) { @@ -248,7 +370,6 @@ void djui_panel_player_create(struct DjuiBase* caller) { struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER, PLAYER_TITLE)); struct DjuiBase* body = djui_three_panel_get_body(panel); - { struct DjuiRect* rect1 = djui_rect_container_create(body, 32); { @@ -272,75 +393,31 @@ void djui_panel_player_create(struct DjuiBase* caller) { djui_interactable_hook_focus(&inputbox1->base, djui_inputbox_on_focus_begin, NULL, djui_panel_player_name_on_focus_end); } - char* modelChoices[CT_MAX] = { 0 }; + char* characterChoices[CT_MAX] = { 0 }; for (int i = 0; i < CT_MAX; i++) { - modelChoices[i] = gCharacters[i].name; + characterChoices[i] = gCharacters[i].name; } - djui_selectionbox_create(body, DLANG(PLAYER, MODEL), modelChoices, CT_MAX, &configPlayerModel, djui_panel_player_value_changed); + djui_selectionbox_create(body, DLANG(PLAYER, MODEL), characterChoices, CT_MAX, &configPlayerModel, djui_panel_player_value_changed); - time_t currentTime; - time(¤tTime); - struct tm *lt = localtime(¤tTime); - bool aprilFools = lt->tm_mon == 3 && lt->tm_mday == 1; // months are 0 indexed + player_palettes_reset(); + player_palettes_read(sys_exe_path()); + player_palettes_read(fs_get_write_path(PALETTES_DIRECTORY)); - char* paletteChoices[PALETTE_PRESET_MAX+1] = { - DLANG(PALETTE, MARIO), - DLANG(PALETTE, LUIGI), - DLANG(PALETTE, TOAD), - DLANG(PALETTE, WARIO), - aprilFools ? "Lame Shitilizer" : DLANG(PALETTE, WALUIGI), - DLANG(PALETTE, TOADETTE), - DLANG(PALETTE, YOSHI), - DLANG(PALETTE, BUCKEN_BERRY), - DLANG(PALETTE, ALA_GOLD), - DLANG(PALETTE, FIRE_MARIO), - DLANG(PALETTE, FIRE_LUIGI), - DLANG(PALETTE, ICE_MARIO), - aprilFools ? "The Shitilizer" : DLANG(PALETTE, ICE_LUIGI), - DLANG(PALETTE, TOADSWORTH), - DLANG(PALETTE, PEACH), - DLANG(PALETTE, DAISY), - DLANG(PALETTE, WARIO_WOODS), - DLANG(PALETTE, GB), - DLANG(PALETTE, N64), - DLANG(PALETTE, SNES), - DLANG(PALETTE, SWITCH), - DLANG(PALETTE, CLOVER), - DLANG(PALETTE, COBALT), - DLANG(PALETTE, RUBY), - DLANG(PALETTE, FURY), - DLANG(PALETTE, HOT_PINK), - DLANG(PALETTE, NICE_PINK), - DLANG(PALETTE, SEAFOAM), - DLANG(PALETTE, LILAC), - DLANG(PALETTE, COPPER), - DLANG(PALETTE, AZURE), - DLANG(PALETTE, BURGUNDY), - DLANG(PALETTE, MINT), - DLANG(PALETTE, ORANGE), - DLANG(PALETTE, ARCTIC), - DLANG(PALETTE, BLACK), - DLANG(PALETTE, BUBBLEGUM), - DLANG(PALETTE, BUSY_BEE), - DLANG(PALETTE, FORTRESS), - DLANG(PALETTE, BLUEBERRY_PIE), - DLANG(PALETTE, RASPBERRY), - DLANG(PALETTE, COFFEE), - DLANG(PALETTE, MARGIN), - DLANG(PALETTE, PUMPKIN), - DLANG(PALETTE, SOIL), - DLANG(PALETTE, CREVASE), - DLANG(PALETTE, CUSTOM), - }; + char* palettePresets[MAX_PRESET_PALETTES + 1] = { "Custom" }; + if (gPresetPaletteCount > 0) { + if (sPalettePresetIndex >= gPresetPaletteCount) { + sPalettePresetIndex = 0; + } + + for (int i = 0; i < gPresetPaletteCount; i++) { + palettePresets[i + 1] = gPresetPalettes[i].name; - for (int i = 0; i < PALETTE_PRESET_MAX; i++) { - if (memcmp(&gNetworkPlayers[0].palette, &gPalettePresets[i], sizeof(struct PlayerPalette)) == 0) { - sPalettePresetIndex = i; - break; + if (memcmp(&configPlayerPalette, &gPresetPalettes[i].palette, sizeof(struct PlayerPalette)) == 0) { + sPalettePresetIndex = i + 1; + } } } - - sPalettePresetSelection = djui_selectionbox_create(body, DLANG(PLAYER, PALETTE_PRESET), paletteChoices, PALETTE_PRESET_MAX+1, &sPalettePresetIndex, djui_panel_player_value_changed); + sPalettePresetSelection = djui_selectionbox_create(body, DLANG(PLAYER, PALETTE_PRESET), palettePresets, gPresetPaletteCount + 1, &sPalettePresetIndex, djui_panel_player_update_preset_palette); djui_button_create(body, DLANG(PLAYER, EDIT_PALETTE), DJUI_BUTTON_STYLE_NORMAL, djui_panel_player_edit_palette_create); djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); diff --git a/src/pc/djui/djui_slider.c b/src/pc/djui/djui_slider.c index 3dd72069..c92799ce 100644 --- a/src/pc/djui/djui_slider.c +++ b/src/pc/djui/djui_slider.c @@ -9,26 +9,26 @@ static void djui_slider_update_style(struct DjuiBase* base) { djui_base_set_border_color(&slider->rect->base, 93, 93, 93, 255); djui_base_set_color(&slider->rect->base, 0, 0, 0, 0); djui_base_set_color(&slider->text->base, 100, 100, 100, 255); - djui_base_set_color(&slider->rectValue->base, 100, 100, 100, 255); + if (slider->updateRectValueColor) { djui_base_set_color(&slider->rectValue->base, 100, 100, 100, 255); } } else if (gInteractableFocus == base) { djui_base_set_border_color(&slider->rect->base, 20, 170, 255, 255); djui_base_set_color(&slider->rect->base, 255, 255, 255, 32); djui_base_set_color(&slider->text->base, 229, 241, 251, 255); - djui_base_set_color(&slider->rectValue->base, 255, 255, 255, 255); + if (slider->updateRectValueColor) { djui_base_set_color(&slider->rectValue->base, 255, 255, 255, 255); } } else if (gDjuiCursorDownOn == base && activeRegion) { djui_base_set_border_color(&slider->rect->base, 20, 170, 255, 255); djui_base_set_color(&slider->rect->base, 255, 255, 255, 32); djui_base_set_color(&slider->text->base, 229, 241, 251, 255); - djui_base_set_color(&slider->rectValue->base, 255, 255, 255, 255); + if (slider->updateRectValueColor) { djui_base_set_color(&slider->rectValue->base, 255, 255, 255, 255); } } else if (gDjuiHovered == base && activeRegion) { djui_base_set_border_color(&slider->rect->base, 0, 120, 215, 255); djui_base_set_color(&slider->text->base, 229, 241, 251, 255); - djui_base_set_color(&slider->rectValue->base, 229, 241, 251, 255); + if (slider->updateRectValueColor) { djui_base_set_color(&slider->rectValue->base, 229, 241, 251, 255); } } else { djui_base_set_border_color(&slider->rect->base, 173, 173, 173, 255); djui_base_set_color(&slider->rect->base, 0, 0, 0, 0); djui_base_set_color(&slider->text->base, 220, 220, 220, 255); - djui_base_set_color(&slider->rectValue->base, 220, 220, 220, 255); + if (slider->updateRectValueColor) { djui_base_set_color(&slider->rectValue->base, 220, 220, 220, 255); } } } @@ -110,6 +110,8 @@ struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* messa slider->min = min; slider->max = max; + slider->updateRectValueColor = true; + djui_base_init(parent, base, NULL, djui_slider_destroy); djui_interactable_create(base, djui_slider_update_style); djui_interactable_hook_cursor_down(base, djui_slider_on_cursor_down_begin, NULL, djui_slider_on_cursor_down_end); diff --git a/src/pc/djui/djui_slider.h b/src/pc/djui/djui_slider.h index 69704b76..b41d18e9 100644 --- a/src/pc/djui/djui_slider.h +++ b/src/pc/djui/djui_slider.h @@ -9,6 +9,7 @@ struct DjuiSlider { unsigned int* value; unsigned int min; unsigned int max; + bool updateRectValueColor; }; struct DjuiSlider* djui_slider_create(struct DjuiBase* parent, const char* message, unsigned int* value, unsigned int min, unsigned int max, void (*on_value_change)(struct DjuiBase*)); diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 1dd7ce11..3b9a7d61 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -22,6 +22,7 @@ #include "src/game/paintings.h" #include "src/pc/djui/djui_types.h" #include "src/game/first_person_cam.h" +#include "src/game/player_palette.h" #include "include/object_fields.h" diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index e63748b2..94434d7a 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -352,6 +352,31 @@ char gSmluaConstants[] = "" "COURSE_COUNT = 25\n" "--- @type integer\n" "COURSE_MIN = 1\n" +"------------------------------\n" +"-- player palette functions --\n" +"------------------------------\n" +"--- @param np NetworkPlayer\n" +"--- @param part PlayerPart\n" +"--- @return Color\n" +"function network_player_get_palette_color(np, part)\n" +" local color = {\n" +" r = network_player_get_palette_color_channel(np, part, 0),\n" +" g = network_player_get_palette_color_channel(np, part, 1),\n" +" b = network_player_get_palette_color_channel(np, part, 2)\n" +" }\n" +" return color\n" +"end\n" +"--- @param np NetworkPlayer\n" +"--- @param part PlayerPart\n" +"--- @return Color\n" +"function network_player_get_override_palette_color(np, part)\n" +" local color = {\n" +" r = network_player_get_override_palette_color_channel(np, part, 0),\n" +" g = network_player_get_override_palette_color_channel(np, part, 1),\n" +" b = network_player_get_override_palette_color_channel(np, part, 2)\n" +" }\n" +" return color\n" +"end\n" "-----------------\n" "-- legacy font --\n" "-----------------\n" @@ -1096,62 +1121,6 @@ char gSmluaConstants[] = "" "CAM_EVENT_START_ENDING = 11\n" "CAM_EVENT_START_END_WAVING = 12\n" "CAM_EVENT_START_CREDITS = 13\n" -"PALETTE_MARIO = 0\n" -"PALETTE_LUIGI = 1\n" -"PALETTE_TOAD = 2\n" -"PALETTE_WARIO = 3\n" -"PALETTE_WALUIGI = 4\n" -"PALETTE_TOADETTE = 5\n" -"PALETTE_YOSHI = 6\n" -"PALETTE_BUCKEN_BERRY = 7\n" -"PALETTE_ALA_GOLD = 8\n" -"PALETTE_FIRE_MARIO = 9\n" -"PALETTE_FIRE_LUIGI = 10\n" -"PALETTE_ICE_MARIO = 11\n" -"PALETTE_ICE_LUIGI = 12\n" -"PALETTE_TOADSWORTH = 13\n" -"PALETTE_PEACH = 14\n" -"PALETTE_DAISY = 15\n" -"PALETTE_WARIO_WOODS = 16\n" -"PALETTE_GB = 17\n" -"PALETTE_N64 = 18\n" -"PALETTE_SNES = 19\n" -"PALETTE_SWITCH = 20\n" -"PALETTE_CLOVER = 21\n" -"PALETTE_COBALT = 22\n" -"PALETTE_RUBY = 23\n" -"PALETTE_FURY = 24\n" -"PALETTE_HOT_PINK = 25\n" -"PALETTE_NICE_PINK = 26\n" -"PALETTE_SEAFOAM = 27\n" -"PALETTE_LILAC = 28\n" -"PALETTE_COPPER = 29\n" -"PALETTE_AZURE = 30\n" -"PALETTE_BURGUNDY = 31\n" -"PALETTE_MINT = 32\n" -"PALETTE_ORANGE = 33\n" -"PALETTE_ARCTIC = 34\n" -"PALETTE_BLACK = 35\n" -"PALETTE_BUBBLEGUM = 36\n" -"PALETTE_BUSY_BEE = 37\n" -"PALETTE_FORTRESS = 38\n" -"PALETTE_BLUEBERRY_PIE = 39\n" -"PALETTE_RASPBERRY = 40\n" -"PALETTE_COFFEE = 41\n" -"PALETTE_MARGIN = 42\n" -"PALETTE_PUMPKIN = 43\n" -"PALETTE_SOIL = 44\n" -"PALETTE_CREVASE = 45\n" -"PALETTE_PRESET_MAX = 46\n" -"PANTS = 0\n" -"SHIRT = 1\n" -"GLOVES = 2\n" -"SHOES = 3\n" -"HAIR = 4\n" -"SKIN = 5\n" -"CAP = 6\n" -"PLAYER_PART_MAX = 7\n" -"METAL = CAP\n" "CT_MARIO = 0\n" "CT_LUIGI = 1\n" "CT_TOAD = 2\n" @@ -2834,6 +2803,17 @@ char gSmluaConstants[] = "" "L_CBUTTONS = CONT_C\n" "R_CBUTTONS = CONT_F\n" "D_CBUTTONS = CONT_D\n" +"MAX_PRESET_PALETTES = 128\n" +"PANTS = 0\n" +"SHIRT = 1\n" +"GLOVES = 2\n" +"SHOES = 3\n" +"HAIR = 4\n" +"SKIN = 5\n" +"CAP = 6\n" +"EMBLEM = 7\n" +"PLAYER_PART_MAX = 8\n" +"METAL = CAP\n" "EEPROM_SIZE = 0x200\n" "NUM_SAVE_FILES = 4\n" "SAVE_FILE_A = 0\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 93e6d265..5edf2f72 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -20577,35 +20577,6 @@ int smlua_func_get_network_player_smallest_global(UNUSED lua_State* L) { return 1; } -int smlua_func_network_player_color_to_palette(lua_State* L) { - if (L == NULL) { return 0; } - - int top = lua_gettop(L); - if (top != 3) { - LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_color_to_palette", 3, 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_color_to_palette"); return 0; } - int part = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_color_to_palette"); return 0; } - - u8* color = smlua_get_color_from_buffer(); - color[0] = smlua_get_integer_field(3, "r"); - color[1] = smlua_get_integer_field(3, "g"); - color[2] = smlua_get_integer_field(3, "b"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_color_to_palette"); return 0; } - - network_player_color_to_palette(np, part, color); - - smlua_push_integer_field(3, "r", color[0]); - smlua_push_integer_field(3, "g", color[1]); - smlua_push_integer_field(3, "b", color[2]); - - return 1; -} - int smlua_func_network_player_connected_count(UNUSED lua_State* L) { if (L == NULL) { return 0; } @@ -20638,31 +20609,78 @@ int smlua_func_network_player_from_global_index(lua_State* L) { return 1; } -int smlua_func_network_player_palette_to_color(lua_State* L) { +int smlua_func_network_player_get_override_palette_color_channel(lua_State* L) { if (L == NULL) { return 0; } int top = lua_gettop(L); if (top != 3) { - LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_palette_to_color", 3, top); + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_get_override_palette_color_channel", 3, 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_palette_to_color"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "network_player_get_override_palette_color_channel"); return 0; } int part = smlua_to_integer(L, 2); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_palette_to_color"); return 0; } + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_get_override_palette_color_channel"); return 0; } + u8 index = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_get_override_palette_color_channel"); return 0; } - u8* out = smlua_get_color_from_buffer(); - out[0] = smlua_get_integer_field(3, "r"); - out[1] = smlua_get_integer_field(3, "g"); - out[2] = smlua_get_integer_field(3, "b"); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_palette_to_color"); return 0; } + lua_pushinteger(L, network_player_get_override_palette_color_channel(np, part, index)); - network_player_palette_to_color(np, part, out); + return 1; +} - smlua_push_integer_field(3, "r", out[0]); - smlua_push_integer_field(3, "g", out[1]); - smlua_push_integer_field(3, "b", out[2]); +int smlua_func_network_player_get_palette_color_channel(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_get_palette_color_channel", 3, 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_get_palette_color_channel"); return 0; } + int part = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_get_palette_color_channel"); return 0; } + u8 index = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_get_palette_color_channel"); return 0; } + + lua_pushinteger(L, network_player_get_palette_color_channel(np, part, index)); + + return 1; +} + +int smlua_func_network_player_is_override_palette_same(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_is_override_palette_same", 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_is_override_palette_same"); return 0; } + + lua_pushboolean(L, network_player_is_override_palette_same(np)); + + return 1; +} + +int smlua_func_network_player_reset_override_palette_color(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); + 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; } + + network_player_reset_override_palette_color(np); return 1; } @@ -20694,6 +20712,35 @@ int smlua_func_network_player_set_description(lua_State* L) { return 1; } +int smlua_func_network_player_set_override_palette_color(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_set_override_palette_color", 3, 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_set_override_palette_color"); return 0; } + int part = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_set_override_palette_color"); return 0; } + + u8* color = smlua_get_color_from_buffer(); + color[0] = smlua_get_integer_field(3, "r"); + color[1] = smlua_get_integer_field(3, "g"); + color[2] = smlua_get_integer_field(3, "b"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_set_override_palette_color"); return 0; } + + network_player_set_override_palette_color(np, part, color); + + smlua_push_integer_field(3, "r", color[0]); + smlua_push_integer_field(3, "g", color[1]); + smlua_push_integer_field(3, "b", color[2]); + + return 1; +} + ///////////////////// // network_utils.h // ///////////////////// @@ -28502,6 +28549,64 @@ int smlua_func_network_discord_id_from_local_index(lua_State* L) { return 1; } +int smlua_func_network_player_color_to_palette(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_color_to_palette", 3, 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_color_to_palette"); return 0; } + int part = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_color_to_palette"); return 0; } + + u8* color = smlua_get_color_from_buffer(); + color[0] = smlua_get_integer_field(3, "r"); + color[1] = smlua_get_integer_field(3, "g"); + color[2] = smlua_get_integer_field(3, "b"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_color_to_palette"); return 0; } + + network_player_color_to_palette(np, part, color); + + smlua_push_integer_field(3, "r", color[0]); + smlua_push_integer_field(3, "g", color[1]); + smlua_push_integer_field(3, "b", color[2]); + + return 1; +} + +int smlua_func_network_player_palette_to_color(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 3) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "network_player_palette_to_color", 3, 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_palette_to_color"); return 0; } + int part = smlua_to_integer(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "network_player_palette_to_color"); return 0; } + + u8* out = smlua_get_color_from_buffer(); + out[0] = smlua_get_integer_field(3, "r"); + out[1] = smlua_get_integer_field(3, "g"); + out[2] = smlua_get_integer_field(3, "b"); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 3, "network_player_palette_to_color"); return 0; } + + network_player_palette_to_color(np, part, out); + + smlua_push_integer_field(3, "r", out[0]); + smlua_push_integer_field(3, "g", out[1]); + smlua_push_integer_field(3, "b", out[2]); + + return 1; +} + int smlua_func_set_environment_region(lua_State* L) { if (L == NULL) { return 0; } @@ -33448,11 +33553,14 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "get_network_player_from_area", smlua_func_get_network_player_from_area); smlua_bind_function(L, "get_network_player_from_level", smlua_func_get_network_player_from_level); smlua_bind_function(L, "get_network_player_smallest_global", smlua_func_get_network_player_smallest_global); - smlua_bind_function(L, "network_player_color_to_palette", smlua_func_network_player_color_to_palette); smlua_bind_function(L, "network_player_connected_count", smlua_func_network_player_connected_count); smlua_bind_function(L, "network_player_from_global_index", smlua_func_network_player_from_global_index); - smlua_bind_function(L, "network_player_palette_to_color", smlua_func_network_player_palette_to_color); + 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_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); // network_utils.h smlua_bind_function(L, "network_check_singleplayer_pause", smlua_func_network_check_singleplayer_pause); @@ -33859,6 +33967,8 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud); smlua_bind_function(L, "get_environment_region", smlua_func_get_environment_region); smlua_bind_function(L, "network_discord_id_from_local_index", smlua_func_network_discord_id_from_local_index); + smlua_bind_function(L, "network_player_color_to_palette", smlua_func_network_player_color_to_palette); + smlua_bind_function(L, "network_player_palette_to_color", smlua_func_network_player_palette_to_color); smlua_bind_function(L, "set_environment_region", smlua_func_set_environment_region); // smlua_level_utils.h diff --git a/src/pc/lua/utils/smlua_deprecated.c b/src/pc/lua/utils/smlua_deprecated.c index b8a556bd..02920e00 100644 --- a/src/pc/lua/utils/smlua_deprecated.c +++ b/src/pc/lua/utils/smlua_deprecated.c @@ -51,3 +51,27 @@ void set_environment_region(u8 index, s32 value) { gEnvironmentRegions[idx] = value; } } + +void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color) { + if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { return; } + + np->palette.parts[part][0] = color[0]; + np->palette.parts[part][1] = color[1]; + np->palette.parts[part][2] = color[2]; + np->overridePalette = np->palette; +} + +void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out) { + if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { + if (np == NULL) { // output config palette instead if np is NULL + out[0] = configPlayerPalette.parts[part][0]; + out[1] = configPlayerPalette.parts[part][1]; + out[2] = configPlayerPalette.parts[part][2]; + } + return; + } + + out[0] = np->palette.parts[part][0]; + out[1] = np->palette.parts[part][1]; + out[2] = np->palette.parts[part][2]; +} diff --git a/src/pc/lua/utils/smlua_deprecated.h b/src/pc/lua/utils/smlua_deprecated.h index 7a0258f9..f65d0d09 100644 --- a/src/pc/lua/utils/smlua_deprecated.h +++ b/src/pc/lua/utils/smlua_deprecated.h @@ -10,3 +10,6 @@ void audio_stream_set_speed(struct ModAudio* audio, f32 initial_freq, f32 speed, f32 get_environment_region(u8 index); void set_environment_region(u8 index, s32 value); + +void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color); +void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out); diff --git a/src/pc/mods/mod.h b/src/pc/mods/mod.h index 3bf71aad..b4e1a1a7 100644 --- a/src/pc/mods/mod.h +++ b/src/pc/mods/mod.h @@ -1,7 +1,7 @@ #ifndef MOD_H #define MOD_H -#include "PR/ultratypes.h" +#include #include #include "pc/platform.h" diff --git a/src/pc/mods/mod_import.c b/src/pc/mods/mod_import.c index 44c247b6..47a254b4 100644 --- a/src/pc/mods/mod_import.c +++ b/src/pc/mods/mod_import.c @@ -54,6 +54,54 @@ static bool mod_import_lua(char* src) { return true; } +static bool mod_import_palette(char* src) { + const char* palettesDirectory = fs_get_write_path(PALETTES_DIRECTORY); + fs_sys_mkdir(palettesDirectory); + + char dst[SYS_MAX_PATH] = { 0 }; + if (!concat_path(dst, (char*)palettesDirectory, path_basename(src))) { + LOG_ERROR("Failed to concat path for palette ini import"); + return false; + } + + FILE* fin = fopen(src, "rb"); + if (fin == NULL) { + LOG_ERROR("Failed to open src path for palette ini import"); + return false; + } + + FILE* fout = fopen(dst, "wb"); + if (fout == NULL) { + LOG_ERROR("Failed to open dst path for palette ini import"); + fclose(fin); + return false; + } + + size_t rbytes; + size_t wbytes; + unsigned char buff[8192]; + do { + rbytes = fread(buff, 1, sizeof(buff), fin); + if (rbytes > 0) { + wbytes = fwrite(buff, 1, rbytes, fout); + } else { + wbytes = 0; + } + } while ((rbytes > 0) && (rbytes == wbytes)); + + fclose(fout); + fclose(fin); + + if (wbytes) { + LOG_ERROR("Write error on palette ini import"); + return false; + } + + LOG_INFO("Imported palette ini: '%s' -> '%s'", src, dst); + + return true; +} + static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) { LOG_INFO("Importing zip mod: %s", path); @@ -207,9 +255,10 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) { bool mod_import_file(char* path) { bool isLua = false; bool isDynos = false; + bool isPalette = false; bool ret = false; - if (gNetworkType != NT_NONE) { + if (gNetworkType != NT_NONE && !str_ends_with(path, ".ini")) { djui_popup_create(DLANG(NOTIF, IMPORT_FAIL_INGAME), 2); return false; } @@ -217,6 +266,9 @@ bool mod_import_file(char* path) { if (str_ends_with(path, ".lua") || str_ends_with(path, ".luac")) { isLua = true; ret = mod_import_lua(path); + } else if (str_ends_with(path, ".ini")) { + isPalette = true; + ret = mod_import_palette(path); } else if (str_ends_with(path, ".zip")) { ret = mod_import_zip(path, &isLua, &isDynos); } @@ -233,6 +285,9 @@ bool mod_import_file(char* path) { dynos_gfx_init(); djui_language_replace(DLANG(NOTIF, IMPORT_DYNOS_SUCCESS), msg, SYS_MAX_PATH, '@', basename); djui_popup_create(msg, 2); + } else if (isPalette) { + djui_language_replace(DLANG(NOTIF, IMPORT_PALETTE_SUCCESS), msg, SYS_MAX_PATH, '@', basename); + djui_popup_create(msg, 2); } } else { djui_language_replace(DLANG(NOTIF, IMPORT_FAIL), msg, SYS_MAX_PATH, '@', basename); diff --git a/src/pc/mods/mods.h b/src/pc/mods/mods.h index 0b901362..0f08cdcc 100644 --- a/src/pc/mods/mods.h +++ b/src/pc/mods/mods.h @@ -1,7 +1,7 @@ #ifndef MODS_H #define MODS_H -#include "PR/ultratypes.h" +#include #include #include "pc/platform.h" #include "mod.h" diff --git a/src/pc/mods/mods_utils.h b/src/pc/mods/mods_utils.h index 6aa3de8e..1e97218b 100644 --- a/src/pc/mods/mods_utils.h +++ b/src/pc/mods/mods_utils.h @@ -1,7 +1,7 @@ #ifndef MODS_UTILS_H #define MODS_UTILS_H -#include "PR/ultratypes.h" +#include #include #include "pc/platform.h" diff --git a/src/pc/network/ban_list.c b/src/pc/network/ban_list.c index c063d07c..e136b94c 100644 --- a/src/pc/network/ban_list.c +++ b/src/pc/network/ban_list.c @@ -1,6 +1,6 @@ #include #include -#include "PR/ultratypes.h" +#include #include "ban_list.h" #include "pc/debuglog.h" diff --git a/src/pc/network/coopnet/coopnet_id.h b/src/pc/network/coopnet/coopnet_id.h index df5c7c4e..bf5725c4 100644 --- a/src/pc/network/coopnet/coopnet_id.h +++ b/src/pc/network/coopnet/coopnet_id.h @@ -1,6 +1,6 @@ #pragma once -#include "PR/ultratypes.h" +#include void coopnet_save_dest_id(uint64_t userId, uint64_t destId); void coopnet_clear_dest_id(uint64_t userId); diff --git a/src/pc/network/moderator_list.c b/src/pc/network/moderator_list.c index 87cbf85f..c8be0d86 100644 --- a/src/pc/network/moderator_list.c +++ b/src/pc/network/moderator_list.c @@ -1,6 +1,6 @@ #include #include -#include "PR/ultratypes.h" +#include #include "moderator_list.h" #include "pc/debuglog.h" diff --git a/src/pc/network/network.h b/src/pc/network/network.h index 80703f88..f929d258 100644 --- a/src/pc/network/network.h +++ b/src/pc/network/network.h @@ -1,7 +1,7 @@ #ifndef NETWORK_H #define NETWORK_H -#include "PR/ultratypes.h" +#include #include #include #include diff --git a/src/pc/network/network_player.c b/src/pc/network/network_player.c index 662d735a..d05edb45 100644 --- a/src/pc/network/network_player.c +++ b/src/pc/network/network_player.c @@ -23,7 +23,7 @@ struct NetworkPlayer *gNetworkPlayerServer = NULL; static char sDefaultPlayerName[] = "Player"; void network_player_init(void) { - gNetworkPlayers[0].modelIndex = (configPlayerModel < CT_MAX) ? configPlayerModel : 0; + gNetworkPlayers[0].modelIndex = (configPlayerModel < CT_MAX) ? configPlayerModel : CT_MARIO; gNetworkPlayers[0].palette = configPlayerPalette; gNetworkPlayers[0].overrideModelIndex = gNetworkPlayers[0].modelIndex; gNetworkPlayers[0].overridePalette = gNetworkPlayers[0].palette; @@ -128,28 +128,36 @@ struct NetworkPlayer *get_network_player_smallest_global(void) { return smallest; } -void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color) { - if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { return; } +u8 network_player_get_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index) { + if (np == NULL || part < 0 || part >= PLAYER_PART_MAX || index > 2) { return 0; } + + return np->palette.parts[part][index]; +} + +u8 network_player_get_override_palette_color_channel(struct NetworkPlayer *np, enum PlayerPart part, u8 index) { + if (np == NULL || part < 0 || part >= PLAYER_PART_MAX || index > 2) { return 0; } + + return np->overridePalette.parts[part][index]; +} + +void network_player_set_override_palette_color(struct NetworkPlayer *np, enum PlayerPart part, Color color) { + if (part < 0 || part >= PLAYER_PART_MAX) { return; } + + np->overridePalette.parts[part][0] = color[0]; + np->overridePalette.parts[part][1] = color[1]; + np->overridePalette.parts[part][2] = color[2]; +} + +void network_player_reset_override_palette_color(struct NetworkPlayer *np) { + if (np == NULL) { return; } - np->palette.parts[part][0] = color[0]; - np->palette.parts[part][1] = color[1]; - np->palette.parts[part][2] = color[2]; np->overridePalette = np->palette; } -void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out) { - if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { - if (np == NULL) { // output config palette instead if np is NULL - out[0] = configPlayerPalette.parts[part][0]; - out[1] = configPlayerPalette.parts[part][1]; - out[2] = configPlayerPalette.parts[part][2]; - } - return; - } +bool network_player_is_override_palette_same(struct NetworkPlayer *np) { + if (np == NULL) { return false; } - out[0] = np->palette.parts[part][0]; - out[1] = np->palette.parts[part][1]; - out[2] = np->palette.parts[part][2]; + return memcmp(&np->palette, &np->overridePalette, sizeof(struct PlayerPalette)) == 0; } void network_player_update(void) { @@ -281,10 +289,6 @@ u8 network_player_connected(enum NetworkPlayerType type, u8 globalIndex, u8 mode np->overrideModelIndex = modelIndex; np->overridePalette = *palette; - np->paletteIndex = USE_REAL_PALETTE_VAR; - np->overridePaletteIndex = USE_REAL_PALETTE_VAR; - np->overridePaletteIndexLp = USE_REAL_PALETTE_VAR; - snprintf(np->name, MAX_PLAYER_STRING, "%s", name); network_player_update_model(localIndex); diff --git a/src/pc/network/network_player.h b/src/pc/network/network_player.h index 7f0a1a27..953d3a48 100644 --- a/src/pc/network/network_player.h +++ b/src/pc/network/network_player.h @@ -58,7 +58,7 @@ struct NetworkPlayer { u16 rxSeqIds[MAX_RX_SEQ_IDS]; u32 rxPacketHash[MAX_RX_SEQ_IDS]; - // legacy fields to allow mods not to break + // legacy fields to allow mods not to break (they don't do anything anymore) u8 paletteIndex; u8 overridePaletteIndex; u8 overridePaletteIndexLp; @@ -79,8 +79,11 @@ struct NetworkPlayer* get_network_player_from_level(s16 courseNum, s16 actNum, s struct NetworkPlayer* get_network_player_from_area(s16 courseNum, s16 actNum, s16 levelNum, s16 areaIndex); struct NetworkPlayer* get_network_player_smallest_global(void); -void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color); -void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out); +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); +bool network_player_is_override_palette_same(struct NetworkPlayer *np); void network_player_update(void); diff --git a/src/pc/network/packets/packet.h b/src/pc/network/packets/packet.h index 22ef3212..3a607b3f 100644 --- a/src/pc/network/packets/packet.h +++ b/src/pc/network/packets/packet.h @@ -1,7 +1,7 @@ #ifndef PACKET_H #define PACKET_H -#include "PR/ultratypes.h" +#include #include #include #include diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index 0b0a3353..095b763b 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -333,16 +333,6 @@ void* main_game_init(void* isThreaded) { loading_screen_set_segment_text("Starting Game"); ); - // If coop_custom_palette_* values are not found in sm64config.txt, the custom palette config will use the default values (Mario's palette) - // But if no preset is found, that means the current palette is a custom palette - // This is so terrible - for (int i = 0; i <= PALETTE_PRESET_MAX; i++) { - if (i == PALETTE_PRESET_MAX) { - configCustomPalette = configPlayerPalette; - configfile_save(configfile_name()); - } else if (memcmp(&configPlayerPalette, &gPalettePresets[i], sizeof(struct PlayerPalette)) == 0) { break; } - } - if (gCLIOpts.fullscreen == 1) { configWindow.fullscreen = true; } else if (gCLIOpts.fullscreen == 2) { configWindow.fullscreen = false; } diff --git a/tools/check_matching_langs.py b/tools/check_matching_langs.py index 3a23cff0..d290f610 100644 --- a/tools/check_matching_langs.py +++ b/tools/check_matching_langs.py @@ -33,7 +33,7 @@ def compare_ini_file(file_path): for filename in os.listdir("lang"): if filename.endswith(".ini"): ini_file_path = os.path.join("lang", filename) - if ini_file_path != "English.ini": + if ini_file_path != "English.ini" and ini_file_path != "lang/English.ini": missing_sections, extra_sections, missing_keys = compare_ini_file(ini_file_path) print(f"\nComparing {filename}:")