From 0d7b6daa9b9e37dc8862a11c934762616b710474 Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 1 Feb 2022 21:59:34 -0800 Subject: [PATCH] Fixed character sound functions --- autogen/convert_functions.py | 10 ++++-- autogen/lua_constants/constants.lua | 44 ++++++++++++++++++++++++++ docs/lua/constants.md | 46 ++++++++++++++++++++++++++++ src/pc/lua/smlua_constants_autogen.c | 43 ++++++++++++++++++++++++++ src/pc/lua/smlua_functions_autogen.c | 6 ++-- 5 files changed, 144 insertions(+), 5 deletions(-) diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py index 01776c69..1a4b6ee8 100644 --- a/autogen/convert_functions.py +++ b/autogen/convert_functions.py @@ -97,10 +97,16 @@ def normalize_type(t): t = parts[0] + ' ' + parts[1].replace(' ', '') return t +def alter_type(t): + if t.startswith('enum '): + return 'int' + return t + + ############################################################################ def build_param(param, i): - ptype = param['type'] + ptype = alter_type(param['type']) pid = param['identifier'] if ptype in param_override_build: @@ -130,7 +136,7 @@ def build_param_after(param, i): return '' def build_call(function): - ftype = function['type'] + ftype = alter_type(function['type']) fid = function['identifier'] ccall = '%s(%s)' % (fid, ', '.join([x['identifier'] for x in function['params']])) diff --git a/autogen/lua_constants/constants.lua b/autogen/lua_constants/constants.lua index 458bb884..70d15cdc 100644 --- a/autogen/lua_constants/constants.lua +++ b/autogen/lua_constants/constants.lua @@ -555,6 +555,50 @@ ACT_RELEASING_BOWSER = 0x00000392 -- sounds -- ------------ +CHAR_SOUND_YAH_WAH_HOO = 0 +CHAR_SOUND_HOOHOO = 1 +CHAR_SOUND_YAHOO = 2 +CHAR_SOUND_UH = 3 +CHAR_SOUND_HRMM = 4 +CHAR_SOUND_WAH2 = 5 +CHAR_SOUND_WHOA = 6 +CHAR_SOUND_EEUH = 7 +CHAR_SOUND_ATTACKED = 8 +CHAR_SOUND_OOOF = 9 +CHAR_SOUND_OOOF2 = 10 +CHAR_SOUND_HERE_WE_GO = 11 +CHAR_SOUND_YAWNING = 12 +CHAR_SOUND_SNORING1 = 13 +CHAR_SOUND_SNORING2 = 14 +CHAR_SOUND_WAAAOOOW = 15 +CHAR_SOUND_HAHA = 16 +CHAR_SOUND_HAHA_2 = 17 +CHAR_SOUND_UH2 = 18 +CHAR_SOUND_UH2_2 = 19 +CHAR_SOUND_ON_FIRE = 20 +CHAR_SOUND_DYING = 21 +CHAR_SOUND_PANTING_COLD = 22 +CHAR_SOUND_PANTING = 23 +CHAR_SOUND_COUGHING1 = 24 +CHAR_SOUND_COUGHING2 = 25 +CHAR_SOUND_COUGHING3 = 26 +CHAR_SOUND_PUNCH_YAH = 27 +CHAR_SOUND_PUNCH_HOO = 28 +CHAR_SOUND_MAMA_MIA = 29 +CHAR_SOUND_GROUND_POUND_WAH = 30 +CHAR_SOUND_DROWNING = 31 +CHAR_SOUND_PUNCH_WAH = 32 +CHAR_SOUND_YAHOO_WAHA_YIPPEE = 33 +CHAR_SOUND_DOH = 34 +CHAR_SOUND_GAME_OVER = 35 +CHAR_SOUND_HELLO = 36 +CHAR_SOUND_PRESS_START_TO_PLAY = 37 +CHAR_SOUND_TWIRL_BOUNCE = 38 +CHAR_SOUND_SNORING3 = 39 +CHAR_SOUND_SO_LONGA_BOWSER = 40 +CHAR_SOUND_IMA_TIRED = 41 +CHAR_SOUND_MAX = 42 + SOUNDARGS_MASK_BANK = 0xF0000000 SOUNDARGS_MASK_SOUNDID = 0x00FF0000 SOUNDARGS_MASK_PRIORITY = 0x0000FF00 diff --git a/docs/lua/constants.md b/docs/lua/constants.md index e91312b9..35cab3dc 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -699,6 +699,52 @@
## [sounds](sounds) +- CHAR_SOUND_YAH_WAH_HOO +- CHAR_SOUND_HOOHOO +- CHAR_SOUND_YAHOO +- CHAR_SOUND_UH +- CHAR_SOUND_HRMM +- CHAR_SOUND_WAH2 +- CHAR_SOUND_WHOA +- CHAR_SOUND_EEUH +- CHAR_SOUND_ATTACKED +- CHAR_SOUND_OOOF +- CHAR_SOUND_OOOF2 +- CHAR_SOUND_HERE_WE_GO +- CHAR_SOUND_YAWNING +- CHAR_SOUND_SNORING1 +- CHAR_SOUND_SNORING2 +- CHAR_SOUND_WAAAOOOW +- CHAR_SOUND_HAHA +- CHAR_SOUND_HAHA_2 +- CHAR_SOUND_UH2 +- CHAR_SOUND_UH2_2 +- CHAR_SOUND_ON_FIRE +- CHAR_SOUND_DYING +- CHAR_SOUND_PANTING_COLD +- CHAR_SOUND_PANTING +- CHAR_SOUND_COUGHING1 +- CHAR_SOUND_COUGHING2 +- CHAR_SOUND_COUGHING3 +- CHAR_SOUND_PUNCH_YAH +- CHAR_SOUND_PUNCH_HOO +- CHAR_SOUND_MAMA_MIA +- CHAR_SOUND_GROUND_POUND_WAH +- CHAR_SOUND_DROWNING +- CHAR_SOUND_PUNCH_WAH +- CHAR_SOUND_YAHOO_WAHA_YIPPEE +- CHAR_SOUND_DOH +- CHAR_SOUND_GAME_OVER +- CHAR_SOUND_HELLO +- CHAR_SOUND_PRESS_START_TO_PLAY +- CHAR_SOUND_TWIRL_BOUNCE +- CHAR_SOUND_SNORING3 +- CHAR_SOUND_SO_LONGA_BOWSER +- CHAR_SOUND_IMA_TIRED +- CHAR_SOUND_MAX + +
+ - SOUNDARGS_MASK_BANK - SOUNDARGS_MASK_SOUNDID - SOUNDARGS_MASK_PRIORITY diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index eaabc30d..5c22c4b1 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -490,6 +490,49 @@ char gSmluaConstants[] = "HOOK_UPDATE = 0\n" "ACT_PICKING_UP_BOWSER = 0x00000390\n" "ACT_HOLDING_BOWSER = 0x00000391\n" "ACT_RELEASING_BOWSER = 0x00000392\n" +"CHAR_SOUND_YAH_WAH_HOO = 0\n" +"CHAR_SOUND_HOOHOO = 1\n" +"CHAR_SOUND_YAHOO = 2\n" +"CHAR_SOUND_UH = 3\n" +"CHAR_SOUND_HRMM = 4\n" +"CHAR_SOUND_WAH2 = 5\n" +"CHAR_SOUND_WHOA = 6\n" +"CHAR_SOUND_EEUH = 7\n" +"CHAR_SOUND_ATTACKED = 8\n" +"CHAR_SOUND_OOOF = 9\n" +"CHAR_SOUND_OOOF2 = 10\n" +"CHAR_SOUND_HERE_WE_GO = 11\n" +"CHAR_SOUND_YAWNING = 12\n" +"CHAR_SOUND_SNORING1 = 13\n" +"CHAR_SOUND_SNORING2 = 14\n" +"CHAR_SOUND_WAAAOOOW = 15\n" +"CHAR_SOUND_HAHA = 16\n" +"CHAR_SOUND_HAHA_2 = 17\n" +"CHAR_SOUND_UH2 = 18\n" +"CHAR_SOUND_UH2_2 = 19\n" +"CHAR_SOUND_ON_FIRE = 20\n" +"CHAR_SOUND_DYING = 21\n" +"CHAR_SOUND_PANTING_COLD = 22\n" +"CHAR_SOUND_PANTING = 23\n" +"CHAR_SOUND_COUGHING1 = 24\n" +"CHAR_SOUND_COUGHING2 = 25\n" +"CHAR_SOUND_COUGHING3 = 26\n" +"CHAR_SOUND_PUNCH_YAH = 27\n" +"CHAR_SOUND_PUNCH_HOO = 28\n" +"CHAR_SOUND_MAMA_MIA = 29\n" +"CHAR_SOUND_GROUND_POUND_WAH = 30\n" +"CHAR_SOUND_DROWNING = 31\n" +"CHAR_SOUND_PUNCH_WAH = 32\n" +"CHAR_SOUND_YAHOO_WAHA_YIPPEE = 33\n" +"CHAR_SOUND_DOH = 34\n" +"CHAR_SOUND_GAME_OVER = 35\n" +"CHAR_SOUND_HELLO = 36\n" +"CHAR_SOUND_PRESS_START_TO_PLAY = 37\n" +"CHAR_SOUND_TWIRL_BOUNCE = 38\n" +"CHAR_SOUND_SNORING3 = 39\n" +"CHAR_SOUND_SO_LONGA_BOWSER = 40\n" +"CHAR_SOUND_IMA_TIRED = 41\n" +"CHAR_SOUND_MAX = 42\n" "SOUNDARGS_MASK_BANK = 0xF0000000\n" "SOUNDARGS_MASK_SOUNDID = 0x00FF0000\n" "SOUNDARGS_MASK_PRIORITY = 0x0000FF00\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 1093ee8f..9cdadcea 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -89,7 +89,7 @@ int smlua_func_play_character_sound(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { return 0; } - enum CharacterSound characterSound = (enum CharacterSound)smlua_to_cobject(L, 2, LOT_NONE); + int characterSound = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } play_character_sound(m, characterSound); @@ -102,7 +102,7 @@ int smlua_func_play_character_sound_if_no_flag(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { return 0; } - enum CharacterSound characterSound = (enum CharacterSound)smlua_to_cobject(L, 2, LOT_NONE); + int characterSound = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } u32 flags = smlua_to_integer(L, 3); if (!gSmLuaConvertSuccess) { return 0; } @@ -117,7 +117,7 @@ int smlua_func_play_character_sound_offset(lua_State* L) { struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); if (!gSmLuaConvertSuccess) { return 0; } - enum CharacterSound characterSound = (enum CharacterSound)smlua_to_cobject(L, 2, LOT_NONE); + int characterSound = smlua_to_integer(L, 2); if (!gSmLuaConvertSuccess) { return 0; } u32 offset = smlua_to_integer(L, 3); if (!gSmLuaConvertSuccess) { return 0; }