diff --git a/autogen/common.py b/autogen/common.py index 80bbc572f..2898fd67e 100644 --- a/autogen/common.py +++ b/autogen/common.py @@ -15,6 +15,10 @@ def get_path(p): return os.path.dirname(os.path.realpath(__file__)) + '/../' + p def translate_type_to_lvt(ptype): + if '[' in ptype or '{' in ptype: + return 'LOT_???' + if 'enum' in ptype: + return 'LVT_S32' if ptype in usf_types: return 'LVT_' + ptype.upper() if ptype in vec3_types: @@ -22,6 +26,8 @@ def translate_type_to_lvt(ptype): if ptype == 'float': return 'LVT_F32' if 'struct' in ptype: + if ptype.count('*') > 1: + return 'LVT_???' if '*' in ptype: return 'LVT_COBJECT_P' return 'LVT_COBJECT' @@ -30,6 +36,8 @@ def translate_type_to_lvt(ptype): def translate_type_to_lot(ptype): if '[' in ptype or '{' in ptype: return 'LOT_???' + if 'enum' in ptype: + return 'LOT_NONE' if ptype in usf_types: return 'LOT_NONE' if ptype in vec3_types: @@ -37,6 +45,8 @@ def translate_type_to_lot(ptype): if ptype == 'float': return 'LOT_NONE' if 'struct' in ptype: + if ptype.count('*') > 1: + return 'LVT_???' struct_id = ptype.split(' ')[1].replace('*', '') if struct_id in exclude_structs: return 'LOT_???' diff --git a/autogen/convert_structs.py b/autogen/convert_structs.py index 1e929b30d..35d246b6a 100644 --- a/autogen/convert_structs.py +++ b/autogen/convert_structs.py @@ -179,7 +179,7 @@ def build_struct(struct): lvt = translate_type_to_lvt(ftype) lot = translate_type_to_lot(ftype) - fimmutable = str(lvt == 'LVT_COBJECT').lower() + fimmutable = str(lvt == 'LVT_COBJECT' or lvt == 'LVT_COBJECT_P').lower() if sid in override_field_immutable: if fid in override_field_immutable[sid] or '*' in override_field_immutable[sid]: diff --git a/autogen/lua_functions/characters.h b/autogen/lua_functions/characters.h new file mode 100644 index 000000000..fccaae2d9 --- /dev/null +++ b/autogen/lua_functions/characters.h @@ -0,0 +1,6 @@ +struct Character* get_character(struct MarioState* m); +void play_character_sound(struct MarioState* m, enum CharacterSound characterSound); +void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u32 offset); +void play_character_sound_if_no_flag(struct MarioState* m, enum CharacterSound characterSound, u32 flags); +f32 get_character_anim_offset(struct MarioState* m); +void update_character_anim_offset(struct MarioState* m); diff --git a/mods/character-abilities.lua b/mods/character-abilities.lua deleted file mode 100644 index 6c46d981f..000000000 --- a/mods/character-abilities.lua +++ /dev/null @@ -1,135 +0,0 @@ - --- TODO: - --- Luigi: runs on water --- Luigi: tune swim and holding item speeds --- Luigi: low friction --- Luigi: BUG - can't jump off tree normally - --- Mario: wall kick slide all the way down wall - - -gStateExtras = {} -for i=0,(MAX_PLAYERS-1) do - gStateExtras[i] = {} - local m = gMarioStates[i] - local e = gStateExtras[i] - e.lastAction = m.action - e.animFrame = 0 - e.scuttle = 0 -end - ------------ --- luigi -- ------------ - -function luigi_before_phys_step(m) - local e = gStateExtras[m.playerIndex] - - local hScale = 1.0 - local vScale = 1.0 - - -- faster swimming - if (m.action & ACT_FLAG_SWIMMING) ~= 0 then - hScale = hScale * 1.25 - end - - -- slower holding item - if m.heldObj ~= nil then - m.vel.y = m.vel.y - 2.0 - hScale = hScale * 0.9 - if (m.action & ACT_FLAG_AIR) ~= 0 then - hScale = hScale * 0.9 - end - end - m.forwardVel = m.forwardVel * 0.99 - - m.vel.x = m.vel.x * hScale - m.vel.y = m.vel.y * vScale - m.vel.z = m.vel.z * hScale -end - -function luigi_on_set_action(m) - local e = gStateExtras[m.playerIndex] - - -- extra height to the backflip - if m.action == ACT_BACKFLIP then - m.vel.y = m.vel.y + 18 - - -- nerf wall kicks - elseif m.action == ACT_WALL_KICK_AIR and m.prevAction ~= ACT_HOLDING_POLE and m.prevAction ~= ACT_CLIMBING_POLE then - if m.vel.y > 15 then m.vel.y = 15 end - return - - -- turn dive into kick when holding jump - elseif m.action == ACT_DIVE and (m.controller.buttonDown & A_BUTTON) ~= 0 and e.scuttle > 0 then - return set_mario_action(m, ACT_JUMP_KICK, 0) - - -- extra height on jumps - elseif m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP or m.action == ACT_TRIPLE_JUMP or m.action == ACT_SPECIAL_TRIPLE_JUMP or m.action == ACT_STEEP_JUMP or m.action == ACT_SIDE_FLIP or m.action == ACT_RIDING_SHELL_JUMP then - m.vel.y = m.vel.y + 6 - - end - - e.lastAction = action -end - -function luigi_update(m) - local e = gStateExtras[m.playerIndex] - - -- air scuttle - e.scuttle = 0 - if m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP then - if (m.controller.buttonDown & A_BUTTON) ~= 0 and m.vel.y < -5 then - m.vel.y = m.vel.y + 2.5 - set_mario_animation(m, MARIO_ANIM_RUNNING_UNUSED) - set_anim_to_frame(m, e.animFrame) - e.animFrame = e.animFrame + 10 - if e.animFrame >= m.marioObj.header.gfx.animInfo.curAnim.loopEnd then - e.animFrame = e.animFrame - m.marioObj.header.gfx.animInfo.curAnim.loopEnd - end - e.scuttle = 1 - end - end - - -- backflip turns into twirl - if m.action == ACT_BACKFLIP and m.marioObj.header.gfx.animInfo.animFrame > 18 then - m.angleVel.y = 0x1800 - set_mario_action(m, ACT_TWIRLING, 1) - end -end - ----------- --- main -- ----------- -function mario_before_phys_step(m) - if (m.character == gCharacters[CT_LUIGI]) then - luigi_before_phys_step(m) - end -end - -function mario_on_set_action(m) - if (m.character == gCharacters[CT_LUIGI]) then - luigi_on_set_action(m) - end -end - -function mario_action_on_change(m) - if (m.character == gCharacters[CT_LUIGI]) then - luigi_update(m) - end -end - -function mario_update(m) - if (m.character == gCharacters[CT_LUIGI]) then - luigi_update(m) - end -end - ------------ --- hooks -- ------------ - -hook_event(HOOK_MARIO_UPDATE, mario_update) -hook_event(HOOK_ON_SET_MARIO_ACTION, mario_on_set_action) -hook_event(HOOK_BEFORE_PHYS_STEP, mario_before_phys_step) diff --git a/mods/character-movesets.lua b/mods/character-movesets.lua new file mode 100644 index 000000000..2f797dde4 --- /dev/null +++ b/mods/character-movesets.lua @@ -0,0 +1,341 @@ + +gStateExtras = {} +for i=0,(MAX_PLAYERS-1) do + gStateExtras[i] = {} + local m = gMarioStates[i] + local e = gStateExtras[i] + e.lastAction = m.action + e.animFrame = 0 + e.scuttle = 0 + e.averageForwardVel = 0 + e.boostTimer = 0 + e.rotAngle = 0 + e.lastHurtCounter = 0 +end + +gEventTable = {} + +----------- +-- luigi -- +----------- + +function luigi_before_phys_step(m) + local e = gStateExtras[m.playerIndex] + + local hScale = 1.0 + local vScale = 1.0 + + -- faster swimming + if (m.action & ACT_FLAG_SWIMMING) ~= 0 then + hScale = hScale * 1.25 + end + + -- slower holding item + if m.heldObj ~= nil then + m.vel.y = m.vel.y - 2.0 + hScale = hScale * 0.9 + if (m.action & ACT_FLAG_AIR) ~= 0 then + hScale = hScale * 0.9 + end + end + m.forwardVel = m.forwardVel * 0.99 + + m.vel.x = m.vel.x * hScale + m.vel.y = m.vel.y * vScale + m.vel.z = m.vel.z * hScale +end + +function luigi_on_set_action(m) + local e = gStateExtras[m.playerIndex] + + -- extra height to the backflip + if m.action == ACT_BACKFLIP then + m.vel.y = m.vel.y + 18 + + -- nerf wall kicks + elseif m.action == ACT_WALL_KICK_AIR and m.prevAction ~= ACT_HOLDING_POLE and m.prevAction ~= ACT_CLIMBING_POLE then + if m.vel.y > 30 then m.vel.y = 30 end + return + + -- turn dive into kick when holding jump + elseif m.action == ACT_DIVE and (m.controller.buttonDown & A_BUTTON) ~= 0 and e.scuttle > 0 then + return set_mario_action(m, ACT_JUMP_KICK, 0) + + -- extra height on jumps + elseif m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP or m.action == ACT_TRIPLE_JUMP or m.action == ACT_SPECIAL_TRIPLE_JUMP or m.action == ACT_STEEP_JUMP or m.action == ACT_SIDE_FLIP or m.action == ACT_RIDING_SHELL_JUMP then + m.vel.y = m.vel.y + 6 + + end + + e.lastAction = action +end + +function luigi_update(m) + local e = gStateExtras[m.playerIndex] + + -- air scuttle + e.scuttle = 0 + if m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP then + if (m.controller.buttonDown & A_BUTTON) ~= 0 and m.vel.y < -5 then + m.vel.y = m.vel.y + 3 + set_mario_animation(m, MARIO_ANIM_RUNNING_UNUSED) + set_anim_to_frame(m, e.animFrame) + e.animFrame = e.animFrame + 13 + if e.animFrame >= m.marioObj.header.gfx.animInfo.curAnim.loopEnd then + e.animFrame = e.animFrame - m.marioObj.header.gfx.animInfo.curAnim.loopEnd + end + e.scuttle = 1 + end + end + + -- backflip turns into twirl + if m.action == ACT_BACKFLIP and m.marioObj.header.gfx.animInfo.animFrame > 18 then + m.angleVel.y = 0x1800 + set_mario_action(m, ACT_TWIRLING, 1) + end +end + +gEventTable[CT_LUIGI] = { + before_phys_step = luigi_before_phys_step, + on_set_action = luigi_on_set_action, + update = luigi_update, +} + +----------- +-- toad -- +----------- + +function toad_before_phys_step(m) + local e = gStateExtras[m.playerIndex] + + local hScale = 1.0 + local vScale = 1.0 + + -- faster ground movement + if (m.action & ACT_FLAG_MOVING) ~= 0 then + hScale = hScale * 1.19 + end + + -- slower holding item + if m.heldObj ~= nil then + m.vel.y = m.vel.y - 2.0 + hScale = hScale * 0.9 + if (m.action & ACT_FLAG_AIR) ~= 0 then + hScale = hScale * 0.9 + end + end + + m.vel.x = m.vel.x * hScale + m.vel.y = m.vel.y * vScale + m.vel.z = m.vel.z * hScale +end + +function toad_on_set_action(m) + local e = gStateExtras[m.playerIndex] + + -- wall kick height based on how fast toad is going + if m.action == ACT_WALL_KICK_AIR and m.prevAction ~= ACT_HOLDING_POLE and m.prevAction ~= ACT_CLIMBING_POLE then + m.vel.y = m.vel.y * 0.5 + m.vel.y = m.vel.y + e.averageForwardVel * 0.7 + return + end + + -- more distance on dive and long jump + if m.action == ACT_DIVE or m.action == ACT_LONG_JUMP then + m.forwardVel = m.forwardVel * 1.35 + end + + -- less height on jumps + if m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP or m.action == ACT_TRIPLE_JUMP or m.action == ACT_SPECIAL_TRIPLE_JUMP or m.action == ACT_STEEP_JUMP or m.action == ACT_SIDE_FLIP or m.action == ACT_RIDING_SHELL_JUMP or m.action == ACT_BACKFLIP or m.action == ACT_WALL_KICK_AIR or m.action == ACT_LONG_JUMP then + m.vel.y = m.vel.y * 0.8 + end + + e.lastAction = action +end + +function toad_update(m) + local e = gStateExtras[m.playerIndex] + if e.averageForwardVel > m.forwardVel then + e.averageForwardVel = e.averageForwardVel * 0.93 + m.forwardVel * 0.07 + else + e.averageForwardVel = m.forwardVel + end + + -- faster flip during ground pound + if m.action == ACT_GROUND_POUND then + if m.actionTimer < 10 then + m.actionTimer = m.actionTimer + 1 + end + end + + -- ground pound jump + if m.action == ACT_GROUND_POUND_LAND and (m.input & INPUT_A_PRESSED) ~= 0 then + set_mario_action(m, ACT_TRIPLE_JUMP, 0) + m.vel.y = m.vel.y + 18 + m.forwardVel = m.forwardVel + 10 + end + +end + +gEventTable[CT_TOAD] = { + before_phys_step = toad_before_phys_step, + on_set_action = toad_on_set_action, + update = toad_update, +} + +----------- +-- waluigi -- +----------- + +ACT_WALL_SLIDE = (0x0BF | ACT_FLAG_AIR | ACT_FLAG_MOVING | ACT_FLAG_ALLOW_VERTICAL_WIND_ACTION) + +function act_wall_slide(m) + if (m.input & INPUT_A_PRESSED) ~= 0 then + local rc = set_mario_action(m, ACT_TRIPLE_JUMP, 0) + m.vel.y = 72.0 + + if m.forwardVel < 20.0 then + m.forwardVel = 20.0 + end + m.wallKickTimer = 0 + return rc + end + + -- attempt to stick to the wall a bit. if it's 0, sometimes you'll get kicked off of slightly sloped walls + mario_set_forward_vel(m, -1.0) + + m.particleFlags = m.particleFlags | PARTICLE_DUST + + play_sound(SOUND_MOVING_TERRAIN_SLIDE + m.terrainSoundAddend, m.marioObj.header.gfx.cameraToObject) + set_mario_animation(m, MARIO_ANIM_START_WALLKICK) + + if perform_air_step(m, 0) == AIR_STEP_LANDED then + mario_set_forward_vel(m, 0.0) + if check_fall_damage_or_get_stuck(m, ACT_HARD_BACKWARD_GROUND_KB) == 0 then + return set_mario_action(m, ACT_FREEFALL_LAND, 0) + end + end + + m.actionTimer = m.actionTimer + 1 + if m.wall == nil and m.actionTimer > 2 then + mario_set_forward_vel(m, 0.0) + return set_mario_action(m, ACT_FREEFALL, 0) + end + + -- gravity + m.vel.y = m.vel.y + 2 + + return 0 +end + +function waluigi_before_phys_step(m) + local e = gStateExtras[m.playerIndex] + + local hScale = 1.0 + local vScale = 1.0 + + -- faster ground movement + if (m.action & ACT_FLAG_MOVING) ~= 0 then + hScale = hScale * 1.085 + end + + m.vel.x = m.vel.x * hScale + m.vel.y = m.vel.y * vScale + m.vel.z = m.vel.z * hScale + + if m.action == ACT_TRIPLE_JUMP and m.prevAction == ACT_DOUBLE_JUMP and m.actionTimer < 6 then + m.particleFlags = m.particleFlags | PARTICLE_DUST + m.actionTimer = m.actionTimer + 1 + end +end + +function waluigi_on_set_action(m) + local e = gStateExtras[m.playerIndex] + + -- wall slide + if m.action == ACT_SOFT_BONK then + m.faceAngle.y = m.faceAngle.y + 0x8000 + set_mario_action(m, ACT_WALL_SLIDE, 0) + m.vel.x = 0 + m.vel.y = 0 + m.vel.z = 0 + + -- turn wall kick into flip + elseif m.action == ACT_WALL_KICK_AIR and m.prevAction ~= ACT_HOLDING_POLE and m.prevAction ~= ACT_CLIMBING_POLE then + local rc = set_mario_action(m, ACT_TRIPLE_JUMP, 0) + m.vel.y = 72.0 + + if m.forwardVel < 20.0 then + m.forwardVel = 20.0 + end + m.wallKickTimer = 0 + return rc + + -- less height on jumps + elseif m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP or m.action == ACT_TRIPLE_JUMP or m.action == ACT_SPECIAL_TRIPLE_JUMP or m.action == ACT_STEEP_JUMP or m.action == ACT_SIDE_FLIP or m.action == ACT_RIDING_SHELL_JUMP or m.action == ACT_BACKFLIP or m.action == ACT_WALL_KICK_AIR or m.action == ACT_LONG_JUMP then + m.vel.y = m.vel.y * 0.93 + end + + e.lastAction = action +end + +function waluigi_update(m) + local e = gStateExtras[m.playerIndex] + + -- increase player damage + if m.hurtCounter > e.lastHurtCounter then + m.hurtCounter = m.hurtCounter * 2 + end + e.lastHurtCounter = m.hurtCounter + + -- double jump + if m.action == ACT_DOUBLE_JUMP and m.actionTimer > 0 and (m.controller.buttonPressed & A_BUTTON) ~= 0 then + set_mario_action(m, ACT_TRIPLE_JUMP, 0) + m.vel.y = m.vel.y * 0.94 + end + if m.action == ACT_DOUBLE_JUMP then + m.actionTimer = m.actionTimer + 1 + end + +end + +gEventTable[CT_WALUIGI] = { + before_phys_step = waluigi_before_phys_step, + on_set_action = waluigi_on_set_action, + update = waluigi_update, +} + +---------- +-- main -- +---------- + +function mario_before_phys_step(m) + if gEventTable[m.character.type] == nil then + return + end + gEventTable[m.character.type].before_phys_step(m) +end + +function mario_on_set_action(m) + if gEventTable[m.character.type] == nil then + return + end + gEventTable[m.character.type].on_set_action(m) +end + +function mario_update(m) + if gEventTable[m.character.type] == nil then + return + end + gEventTable[m.character.type].update(m) +end + +----------- +-- hooks -- +----------- + +hook_event(HOOK_MARIO_UPDATE, mario_update) +hook_event(HOOK_ON_SET_MARIO_ACTION, mario_on_set_action) +hook_event(HOOK_BEFORE_PHYS_STEP, mario_before_phys_step) + +hook_mario_action(ACT_WALL_SLIDE, act_wall_slide) diff --git a/mods/extended-moveset.lua b/mods/extended-moveset.lua index be7586bb9..f387bf98e 100644 --- a/mods/extended-moveset.lua +++ b/mods/extended-moveset.lua @@ -278,41 +278,6 @@ function act_roll_air(m) return false end -function act_ground_pound_jump(m) - local e = gMarioStateExtras[m.playerIndex] - if check_kick_or_dive_in_air(m) ~= 0 then - m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y + e.rotAngle - return 1 - end - - if (m.input & INPUT_Z_PRESSED) ~= 0 then - m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y + e.rotAngle - return set_mario_action(m, ACT_GROUND_POUND, 0) - end - - if e.spinInput ~= 0 then - return set_mario_action(m, ACT_SPIN_JUMP, 1) - end - - if m.actionTimer == 0 then - e.rotAngle = 0 - elseif m.actionTimer == 1 then - play_sound(SOUND_ACTION_SPIN, m.marioObj.header.gfx.cameraToObject) - end - - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, SOUND_MARIO_YAHOO) - - common_air_action_step(m, ACT_JUMP_LAND, MARIO_ANIM_SINGLE_JUMP, - AIR_STEP_CHECK_LEDGE_GRAB | AIR_STEP_CHECK_HANG) - - e.rotAngle = e.rotAngle + (0x10000*1.0 - e.rotAngle) / 5.0 - m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y - e.rotAngle - - m.actionTimer = m.actionTimer + 1 - - return 0 -end - function update_roll(m) if m.action == ACT_DIVE_SLIDE then if (m.input & INPUT_ABOVE_SLIDE) == 0 then @@ -950,6 +915,41 @@ function act_ledge_parkour(m) return 0 end +function act_ground_pound_jump(m) + local e = gMarioStateExtras[m.playerIndex] + if check_kick_or_dive_in_air(m) ~= 0 then + m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y + e.rotAngle + return 1 + end + + if (m.input & INPUT_Z_PRESSED) ~= 0 then + m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y + e.rotAngle + return set_mario_action(m, ACT_GROUND_POUND, 0) + end + + if e.spinInput ~= 0 then + return set_mario_action(m, ACT_SPIN_JUMP, 1) + end + + if m.actionTimer == 0 then + e.rotAngle = 0 + elseif m.actionTimer == 1 then + play_sound(SOUND_ACTION_SPIN, m.marioObj.header.gfx.cameraToObject) + end + + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, SOUND_MARIO_YAHOO) + + common_air_action_step(m, ACT_JUMP_LAND, MARIO_ANIM_SINGLE_JUMP, + AIR_STEP_CHECK_LEDGE_GRAB | AIR_STEP_CHECK_HANG) + + e.rotAngle = e.rotAngle + (0x10000*1.0 - e.rotAngle) / 5.0 + m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y - e.rotAngle + + m.actionTimer = m.actionTimer + 1 + + return 0 +end + --------------------------------------------------------- function mario_on_set_action(m) diff --git a/src/game/characters.c b/src/game/characters.c index 3e528a295..e187cf511 100644 --- a/src/game/characters.c +++ b/src/game/characters.c @@ -23,6 +23,7 @@ extern ALIGNED8 const u8 texture_hud_char_waluigi_head[]; struct Character gCharacters[CT_MAX] = { [CT_MARIO] = { + .type = CT_MARIO, .name = "Mario", .hudHead = ',', .hudHeadTexture = texture_hud_char_mario_head, @@ -84,6 +85,7 @@ struct Character gCharacters[CT_MAX] = { }, [CT_LUIGI] = { + .type = CT_LUIGI, .name = "Luigi", .hudHead = '.', .hudHeadTexture = texture_hud_char_luigi_head, @@ -145,6 +147,7 @@ struct Character gCharacters[CT_MAX] = { }, [CT_TOAD] = { + .type = CT_TOAD, .name = "Toad", .hudHead = '/', .hudHeadTexture = texture_hud_char_toad_head, @@ -206,6 +209,7 @@ struct Character gCharacters[CT_MAX] = { }, [CT_WALUIGI] = { + .type = CT_WALUIGI, .name = "Waluigi", .hudHead = 'z', .hudHeadTexture = texture_hud_char_waluigi_head, diff --git a/src/game/characters.h b/src/game/characters.h index f610953f4..165b26fc0 100644 --- a/src/game/characters.h +++ b/src/game/characters.h @@ -14,6 +14,7 @@ enum CharacterType { }; struct Character { + enum CharacterType type; char* name; char hudHead; const u8* hudHeadTexture; diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index de2fa83e3..b1426174d 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -19,6 +19,7 @@ #endif #include "behavior_table.h" #include "object_helpers.h" +#include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/network/network.h" #include "pc/lua/smlua.h" @@ -2233,6 +2234,7 @@ s32 mario_execute_airborne_action(struct MarioState *m) { case ACT_RIDING_HOOT: cancel = act_riding_hoot(m); break; case ACT_TOP_OF_POLE_JUMP: cancel = act_top_of_pole_jump(m); break; case ACT_VERTICAL_WIND: cancel = act_vertical_wind(m); break; + default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true; } /* clang-format on */ } diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index fa90135e9..fe9433e26 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -20,6 +20,7 @@ #include "obj_behaviors.h" #include "level_update.h" #include "mario_step.h" +#include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/network/network.h" #include "pc/lua/smlua.h" @@ -1072,6 +1073,7 @@ s32 mario_execute_automatic_action(struct MarioState *m) { case ACT_IN_CANNON: cancel = act_in_cannon(m); break; case ACT_TORNADO_TWIRLING: cancel = act_tornado_twirling(m); break; case ACT_BUBBLED: cancel = act_bubbled(m); break; + default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true; } /* clang-format on */ } diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index d2f25455e..62d11fa95 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -30,6 +30,7 @@ #include "thread6.h" #include "obj_behaviors.h" #include "../../include/libc/stdlib.h" +#include "pc/debuglog.h" #include "pc/pc_main.h" #include "pc/configfile.h" #include "pc/network/network.h" @@ -2935,6 +2936,7 @@ s32 mario_execute_cutscene_action(struct MarioState *m) { case ACT_BUTT_STUCK_IN_GROUND: cancel = act_butt_stuck_in_ground(m); break; case ACT_FEET_STUCK_IN_GROUND: cancel = act_feet_stuck_in_ground(m); break; case ACT_PUTTING_ON_CAP: cancel = act_putting_on_cap(m); break; + default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true; } /* clang-format on */ } diff --git a/src/game/mario_actions_moving.c b/src/game/mario_actions_moving.c index 89f0f8f00..b5948ae99 100644 --- a/src/game/mario_actions_moving.c +++ b/src/game/mario_actions_moving.c @@ -12,6 +12,7 @@ #include "memory.h" #include "behavior_data.h" #include "thread6.h" +#include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/cheats.h" #include "pc/network/network.h" @@ -2039,6 +2040,7 @@ s32 mario_execute_moving_action(struct MarioState *m) { case ACT_QUICKSAND_JUMP_LAND: cancel = act_quicksand_jump_land(m); break; case ACT_HOLD_QUICKSAND_JUMP_LAND: cancel = act_hold_quicksand_jump_land(m); break; case ACT_LONG_JUMP_LAND: cancel = act_long_jump_land(m); break; + default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true; } /* clang-format on */ } diff --git a/src/game/mario_actions_object.c b/src/game/mario_actions_object.c index 38bbe77b3..b14da9b21 100644 --- a/src/game/mario_actions_object.c +++ b/src/game/mario_actions_object.c @@ -11,6 +11,7 @@ #include "engine/math_util.h" #include "thread6.h" #include "behavior_data.h" +#include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/network/network.h" #include "object_helpers.h" @@ -506,6 +507,7 @@ s32 mario_execute_object_action(struct MarioState *m) { case ACT_PICKING_UP_BOWSER: cancel = act_picking_up_bowser(m); break; case ACT_HOLDING_BOWSER: cancel = act_holding_bowser(m); break; case ACT_RELEASING_BOWSER: cancel = act_releasing_bowser(m); break; + default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true; } /* clang-format on */ } diff --git a/src/game/mario_actions_stationary.c b/src/game/mario_actions_stationary.c index 2594900a9..1a328c06b 100644 --- a/src/game/mario_actions_stationary.c +++ b/src/game/mario_actions_stationary.c @@ -17,6 +17,7 @@ #include "sound_init.h" #include "surface_terrains.h" #include "thread6.h" +#include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/network/network.h" #include "pc/lua/smlua.h" @@ -1186,6 +1187,7 @@ s32 mario_execute_stationary_action(struct MarioState *m) { case ACT_BRAKING_STOP: sp24 = act_braking_stop(m); break; case ACT_BUTT_SLIDE_STOP: sp24 = act_butt_slide_stop(m); break; case ACT_HOLD_BUTT_SLIDE_STOP: sp24 = act_hold_butt_slide_stop(m); break; + default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true; } /* clang-format on */ } diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index 0b9d540b6..6857f759b 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -16,6 +16,7 @@ #include "behavior_data.h" #include "level_table.h" #include "thread6.h" +#include "pc/debuglog.h" #include "pc/configfile.h" #include "pc/network/network.h" #include "pc/lua/smlua.h" @@ -1581,6 +1582,7 @@ s32 mario_execute_submerged_action(struct MarioState *m) { case ACT_HOLD_METAL_WATER_FALL_LAND: cancel = act_hold_metal_water_fall_land(m); break; case ACT_HOLD_METAL_WATER_JUMP: cancel = act_hold_metal_water_jump(m); break; case ACT_HOLD_METAL_WATER_JUMP_LAND: cancel = act_hold_metal_water_jump_land(m); break; + default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true; } /* clang-format on */ } diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 8612badd7..10081c513 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -40,17 +40,17 @@ static struct LuaObjectField sAnimationFields[LUA_ANIMATION_FIELD_COUNT] = { static struct LuaObjectField sGraphNodeFields[LUA_GRAPH_NODE_FIELD_COUNT] = { { "type", LVT_S16, offsetof(struct GraphNode, type), false, LOT_NONE }, { "flags", LVT_S16, offsetof(struct GraphNode, flags), false, LOT_NONE }, - { "prev", LVT_COBJECT_P, offsetof(struct GraphNode, prev), false, LOT_GRAPHNODE }, - { "next", LVT_COBJECT_P, offsetof(struct GraphNode, next), false, LOT_GRAPHNODE }, - { "parent", LVT_COBJECT_P, offsetof(struct GraphNode, parent), false, LOT_GRAPHNODE }, - { "children", LVT_COBJECT_P, offsetof(struct GraphNode, children), false, LOT_GRAPHNODE }, + { "prev", LVT_COBJECT_P, offsetof(struct GraphNode, prev), true, LOT_GRAPHNODE }, + { "next", LVT_COBJECT_P, offsetof(struct GraphNode, next), true, LOT_GRAPHNODE }, + { "parent", LVT_COBJECT_P, offsetof(struct GraphNode, parent), true, LOT_GRAPHNODE }, + { "children", LVT_COBJECT_P, offsetof(struct GraphNode, children), true, LOT_GRAPHNODE }, }; #define LUA_GRAPH_NODE_OBJECT_SUB_FIELD_COUNT 11 static struct LuaObjectField sGraphNodeObject_subFields[LUA_GRAPH_NODE_OBJECT_SUB_FIELD_COUNT] = { { "animID", LVT_S16, offsetof(struct GraphNodeObject_sub, animID), false, LOT_NONE }, { "animYTrans", LVT_S16, offsetof(struct GraphNodeObject_sub, animYTrans), false, LOT_NONE }, - { "curAnim", LVT_COBJECT_P, offsetof(struct GraphNodeObject_sub, curAnim), false, LOT_ANIMATION }, + { "curAnim", LVT_COBJECT_P, offsetof(struct GraphNodeObject_sub, curAnim), true, LOT_ANIMATION }, { "animFrame", LVT_S16, offsetof(struct GraphNodeObject_sub, animFrame), false, LOT_NONE }, { "animTimer", LVT_U16, offsetof(struct GraphNodeObject_sub, animTimer), false, LOT_NONE }, { "animFrameAccelAssist", LVT_S32, offsetof(struct GraphNodeObject_sub, animFrameAccelAssist), false, LOT_NONE }, @@ -58,13 +58,13 @@ static struct LuaObjectField sGraphNodeObject_subFields[LUA_GRAPH_NODE_OBJECT_SU { "prevAnimFrame", LVT_S16, offsetof(struct GraphNodeObject_sub, prevAnimFrame), false, LOT_NONE }, { "prevAnimID", LVT_S16, offsetof(struct GraphNodeObject_sub, prevAnimID), false, LOT_NONE }, { "prevAnimFrameTimestamp", LVT_U32, offsetof(struct GraphNodeObject_sub, prevAnimFrameTimestamp), false, LOT_NONE }, - { "prevAnimPtr", LVT_COBJECT_P, offsetof(struct GraphNodeObject_sub, prevAnimPtr), false, LOT_ANIMATION }, + { "prevAnimPtr", LVT_COBJECT_P, offsetof(struct GraphNodeObject_sub, prevAnimPtr), true, LOT_ANIMATION }, }; #define LUA_GRAPH_NODE_OBJECT_FIELD_COUNT 19 static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_COUNT] = { { "node", LVT_COBJECT, offsetof(struct GraphNodeObject, node), true, LOT_GRAPHNODE }, - { "sharedChild", LVT_COBJECT_P, offsetof(struct GraphNodeObject, sharedChild), false, LOT_GRAPHNODE }, + { "sharedChild", LVT_COBJECT_P, offsetof(struct GraphNodeObject, sharedChild), true, LOT_GRAPHNODE }, { "unk18", LVT_S8, offsetof(struct GraphNodeObject, unk18), false, LOT_NONE }, { "unk19", LVT_S8, offsetof(struct GraphNodeObject, unk19), false, LOT_NONE }, { "angle", LVT_COBJECT, offsetof(struct GraphNodeObject, angle), true, LOT_VEC3S }, @@ -78,7 +78,7 @@ static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_ { "prevScale", LVT_COBJECT, offsetof(struct GraphNodeObject, prevScale), true, LOT_VEC3F }, { "prevScaleTimestamp", LVT_U32, offsetof(struct GraphNodeObject, prevScaleTimestamp), false, LOT_NONE }, { "animInfo", LVT_COBJECT, offsetof(struct GraphNodeObject, unk38), true, LOT_GRAPHNODEOBJECT_SUB }, - { "unk4C", LVT_COBJECT_P, offsetof(struct GraphNodeObject, unk4C), false, LOT_SPAWNINFO }, + { "unk4C", LVT_COBJECT_P, offsetof(struct GraphNodeObject, unk4C), true, LOT_SPAWNINFO }, // { "throwMatrix", LVT_???, offsetof(struct GraphNodeObject, throwMatrix), false, LOT_??? }, <--- UNIMPLEMENTED // { "prevThrowMatrix", LVT_???, offsetof(struct GraphNodeObject, prevThrowMatrix), false, LOT_??? }, <--- UNIMPLEMENTED { "prevThrowMatrixTimestamp", LVT_U32, offsetof(struct GraphNodeObject, prevThrowMatrixTimestamp), false, LOT_NONE }, @@ -89,26 +89,26 @@ static struct LuaObjectField sGraphNodeObjectFields[LUA_GRAPH_NODE_OBJECT_FIELD_ #define LUA_OBJECT_NODE_FIELD_COUNT 3 static struct LuaObjectField sObjectNodeFields[LUA_OBJECT_NODE_FIELD_COUNT] = { - { "gfx", LVT_COBJECT, offsetof(struct ObjectNode, gfx), true, LOT_GRAPHNODEOBJECT }, - { "next", LVT_COBJECT_P, offsetof(struct ObjectNode, next), false, LOT_OBJECTNODE }, - { "prev", LVT_COBJECT_P, offsetof(struct ObjectNode, prev), false, LOT_OBJECTNODE }, + { "gfx", LVT_COBJECT, offsetof(struct ObjectNode, gfx), true, LOT_GRAPHNODEOBJECT }, + { "next", LVT_COBJECT_P, offsetof(struct ObjectNode, next), true, LOT_OBJECTNODE }, + { "prev", LVT_COBJECT_P, offsetof(struct ObjectNode, prev), true, LOT_OBJECTNODE }, }; -#define LUA_OBJECT_FIELD_COUNT 21 +#define LUA_OBJECT_FIELD_COUNT 22 static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "header", LVT_COBJECT, offsetof(struct Object, header), true, LOT_OBJECTNODE }, - { "parentObj", LVT_COBJECT_P, offsetof(struct Object, parentObj), false, LOT_OBJECT }, - { "prevObj", LVT_COBJECT_P, offsetof(struct Object, prevObj), false, LOT_OBJECT }, + { "parentObj", LVT_COBJECT_P, offsetof(struct Object, parentObj), true, LOT_OBJECT }, + { "prevObj", LVT_COBJECT_P, offsetof(struct Object, prevObj), true, LOT_OBJECT }, { "collidedObjInteractTypes", LVT_U32, offsetof(struct Object, collidedObjInteractTypes), false, LOT_NONE }, { "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE }, { "numCollidedObjs", LVT_S16, offsetof(struct Object, numCollidedObjs), false, LOT_NONE }, -// { "collidedObjs", LVT_COBJECT_P, offsetof(struct Object, collidedObjs), false, LOT_??? }, <--- UNIMPLEMENTED -// { "rawData", LVT_???, offsetof(struct Object, rawData), false, LOT_??? }, <--- UNIMPLEMENTED -// { "ptrData", LVT_???, offsetof(struct Object, ptrData), false, LOT_??? }, <--- UNIMPLEMENTED +// { "collidedObjs", LOT_???, offsetof(struct Object, collidedObjs), false, LOT_??? }, <--- UNIMPLEMENTED +// { "rawData", LOT_???, offsetof(struct Object, rawData), false, LOT_??? }, <--- UNIMPLEMENTED +// { "ptrData", LOT_???, offsetof(struct Object, ptrData), false, LOT_??? }, <--- UNIMPLEMENTED { "unused1", LVT_U32, offsetof(struct Object, unused1), false, LOT_NONE }, // { "curBhvCommand", LVT_???, offsetof(struct Object, curBhvCommand), false, LOT_??? }, <--- UNIMPLEMENTED { "bhvStackIndex", LVT_U32, offsetof(struct Object, bhvStackIndex), false, LOT_NONE }, -// { "bhvStack", LVT_???, offsetof(struct Object, bhvStack), false, LOT_??? }, <--- UNIMPLEMENTED +// { "bhvStack", LOT_???, offsetof(struct Object, bhvStack), false, LOT_??? }, <--- UNIMPLEMENTED { "bhvDelayTimer", LVT_S16, offsetof(struct Object, bhvDelayTimer), false, LOT_NONE }, { "respawnInfoType", LVT_S16, offsetof(struct Object, respawnInfoType), false, LOT_NONE }, { "hitboxRadius", LVT_F32, offsetof(struct Object, hitboxRadius), false, LOT_NONE }, @@ -118,12 +118,12 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "hitboxDownOffset", LVT_F32, offsetof(struct Object, hitboxDownOffset), false, LOT_NONE }, // { "behavior", LVT_???, offsetof(struct Object, behavior), false, LOT_??? }, <--- UNIMPLEMENTED { "heldByPlayerIndex", LVT_U32, offsetof(struct Object, heldByPlayerIndex), false, LOT_NONE }, - { "platform", LVT_COBJECT_P, offsetof(struct Object, platform), false, LOT_OBJECT }, + { "platform", LVT_COBJECT_P, offsetof(struct Object, platform), true, LOT_OBJECT }, // { "collisionData", LVT_???, offsetof(struct Object, collisionData), false, LOT_??? }, <--- UNIMPLEMENTED // { "transform", LVT_???, offsetof(struct Object, transform), false, LOT_??? }, <--- UNIMPLEMENTED // { "respawnInfo", LVT_???, offsetof(struct Object, respawnInfo), false, LOT_??? }, <--- UNIMPLEMENTED { "createdThroughNetwork", LVT_U8, offsetof(struct Object, createdThroughNetwork), false, LOT_NONE }, -// { "areaTimerType", LVT_???, offsetof(struct Object, areaTimerType), false, LOT_??? }, <--- UNIMPLEMENTED + { "areaTimerType", LVT_S32, offsetof(struct Object, areaTimerType), false, LOT_NONE }, { "areaTimer", LVT_U32, offsetof(struct Object, areaTimer), false, LOT_NONE }, { "areaTimerDuration", LVT_U32, offsetof(struct Object, areaTimerDuration), false, LOT_NONE }, // { "areaTimerRunOnceCallback)(void)", LVT_???, offsetof(struct Object, areaTimerRunOnceCallback)(void)), false, LOT_??? }, <--- UNIMPLEMENTED @@ -162,7 +162,7 @@ static struct LuaObjectField sSurfaceFields[LUA_SURFACE_FIELD_COUNT] = { { "vertex3", LVT_COBJECT, offsetof(struct Surface, vertex3), true, LOT_VEC3S }, { "normal", LVT_COBJECT, offsetof(struct Surface, normal), true, LOT_VEC3F }, { "originOffset", LVT_F32, offsetof(struct Surface, originOffset), false, LOT_NONE }, - { "object", LVT_COBJECT_P, offsetof(struct Surface, object), false, LOT_OBJECT }, + { "object", LVT_COBJECT_P, offsetof(struct Surface, object), true, LOT_OBJECT }, { "prevVertex1", LVT_COBJECT, offsetof(struct Surface, prevVertex1), true, LOT_VEC3S }, { "prevVertex2", LVT_COBJECT, offsetof(struct Surface, prevVertex2), true, LOT_VEC3S }, { "prevVertex3", LVT_COBJECT, offsetof(struct Surface, prevVertex3), true, LOT_VEC3S }, @@ -183,7 +183,7 @@ static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_CO { "headAngle", LVT_COBJECT, offsetof(struct MarioBodyState, headAngle), true, LOT_VEC3S }, { "heldObjLastPosition", LVT_COBJECT, offsetof(struct MarioBodyState, heldObjLastPosition), true, LOT_VEC3F }, { "torsoPos", LVT_COBJECT, offsetof(struct MarioBodyState, torsoPos), true, LOT_VEC3F }, -// { "handFootPos", LVT_???, offsetof(struct MarioBodyState, handFootPos), false, LOT_??? }, <--- UNIMPLEMENTED +// { "handFootPos", LOT_???, offsetof(struct MarioBodyState, handFootPos), false, LOT_??? }, <--- UNIMPLEMENTED }; #define LUA_OFFSET_SIZE_PAIR_FIELD_COUNT 2 @@ -194,10 +194,10 @@ static struct LuaObjectField sOffsetSizePairFields[LUA_OFFSET_SIZE_PAIR_FIELD_CO #define LUA_MARIO_ANIMATION_FIELD_COUNT 1 static struct LuaObjectField sMarioAnimationFields[LUA_MARIO_ANIMATION_FIELD_COUNT] = { -// { "animDmaTable", LVT_COBJECT_P, offsetof(struct MarioAnimation, animDmaTable), false, LOT_??? }, <--- UNIMPLEMENTED +// { "animDmaTable", LVT_COBJECT_P, offsetof(struct MarioAnimation, animDmaTable), true, LOT_??? }, <--- UNIMPLEMENTED // { "currentAnimAddr", LVT_???, offsetof(struct MarioAnimation, currentAnimAddr), false, LOT_??? }, <--- UNIMPLEMENTED - { "targetAnim", LVT_COBJECT_P, offsetof(struct MarioAnimation, targetAnim), false, LOT_ANIMATION }, -// { "padding", LVT_???, offsetof(struct MarioAnimation, padding), false, LOT_??? }, <--- UNIMPLEMENTED + { "targetAnim", LVT_COBJECT_P, offsetof(struct MarioAnimation, targetAnim), true, LOT_ANIMATION }, +// { "padding", LOT_???, offsetof(struct MarioAnimation, padding), false, LOT_??? }, <--- UNIMPLEMENTED }; #define LUA_MARIO_STATE_FIELD_COUNT 72 @@ -228,24 +228,24 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { { "forwardVel", LVT_F32, offsetof(struct MarioState, forwardVel), false, LOT_NONE }, { "slideVelX", LVT_F32, offsetof(struct MarioState, slideVelX), false, LOT_NONE }, { "slideVelZ", LVT_F32, offsetof(struct MarioState, slideVelZ), false, LOT_NONE }, - { "wall", LVT_COBJECT_P, offsetof(struct MarioState, wall), false, LOT_SURFACE }, - { "ceil", LVT_COBJECT_P, offsetof(struct MarioState, ceil), false, LOT_SURFACE }, - { "floor", LVT_COBJECT_P, offsetof(struct MarioState, floor), false, LOT_SURFACE }, + { "wall", LVT_COBJECT_P, offsetof(struct MarioState, wall), true, LOT_SURFACE }, + { "ceil", LVT_COBJECT_P, offsetof(struct MarioState, ceil), true, LOT_SURFACE }, + { "floor", LVT_COBJECT_P, offsetof(struct MarioState, floor), true, LOT_SURFACE }, { "ceilHeight", LVT_F32, offsetof(struct MarioState, ceilHeight), false, LOT_NONE }, { "floorHeight", LVT_F32, offsetof(struct MarioState, floorHeight), false, LOT_NONE }, { "floorAngle", LVT_S16, offsetof(struct MarioState, floorAngle), false, LOT_NONE }, { "waterLevel", LVT_S16, offsetof(struct MarioState, waterLevel), false, LOT_NONE }, - { "interactObj", LVT_COBJECT_P, offsetof(struct MarioState, interactObj), false, LOT_OBJECT }, - { "heldObj", LVT_COBJECT_P, offsetof(struct MarioState, heldObj), false, LOT_OBJECT }, - { "usedObj", LVT_COBJECT_P, offsetof(struct MarioState, usedObj), false, LOT_OBJECT }, - { "riddenObj", LVT_COBJECT_P, offsetof(struct MarioState, riddenObj), false, LOT_OBJECT }, - { "marioObj", LVT_COBJECT_P, offsetof(struct MarioState, marioObj), false, LOT_OBJECT }, - { "spawnInfo", LVT_COBJECT_P, offsetof(struct MarioState, spawnInfo), false, LOT_SPAWNINFO }, - { "area", LVT_COBJECT_P, offsetof(struct MarioState, area), false, LOT_AREA }, - { "statusForCamera", LVT_COBJECT_P, offsetof(struct MarioState, statusForCamera), false, LOT_PLAYERCAMERASTATE }, - { "marioBodyState", LVT_COBJECT_P, offsetof(struct MarioState, marioBodyState), false, LOT_MARIOBODYSTATE }, - { "controller", LVT_COBJECT_P, offsetof(struct MarioState, controller), false, LOT_CONTROLLER }, - { "animation", LVT_COBJECT_P, offsetof(struct MarioState, animation), false, LOT_MARIOANIMATION }, + { "interactObj", LVT_COBJECT_P, offsetof(struct MarioState, interactObj), true, LOT_OBJECT }, + { "heldObj", LVT_COBJECT_P, offsetof(struct MarioState, heldObj), true, LOT_OBJECT }, + { "usedObj", LVT_COBJECT_P, offsetof(struct MarioState, usedObj), true, LOT_OBJECT }, + { "riddenObj", LVT_COBJECT_P, offsetof(struct MarioState, riddenObj), true, LOT_OBJECT }, + { "marioObj", LVT_COBJECT_P, offsetof(struct MarioState, marioObj), true, LOT_OBJECT }, + { "spawnInfo", LVT_COBJECT_P, offsetof(struct MarioState, spawnInfo), true, LOT_SPAWNINFO }, + { "area", LVT_COBJECT_P, offsetof(struct MarioState, area), true, LOT_AREA }, + { "statusForCamera", LVT_COBJECT_P, offsetof(struct MarioState, statusForCamera), true, LOT_PLAYERCAMERASTATE }, + { "marioBodyState", LVT_COBJECT_P, offsetof(struct MarioState, marioBodyState), true, LOT_MARIOBODYSTATE }, + { "controller", LVT_COBJECT_P, offsetof(struct MarioState, controller), true, LOT_CONTROLLER }, + { "animation", LVT_COBJECT_P, offsetof(struct MarioState, animation), true, LOT_MARIOANIMATION }, { "collidedObjInteractTypes", LVT_U32, offsetof(struct MarioState, collidedObjInteractTypes), false, LOT_NONE }, { "numCoins", LVT_S16, offsetof(struct MarioState, numCoins), false, LOT_NONE }, { "numStars", LVT_S16, offsetof(struct MarioState, numStars), false, LOT_NONE }, @@ -263,15 +263,15 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { { "quicksandDepth", LVT_F32, offsetof(struct MarioState, quicksandDepth), false, LOT_NONE }, { "unkC4", LVT_F32, offsetof(struct MarioState, unkC4), false, LOT_NONE }, { "currentRoom", LVT_S16, offsetof(struct MarioState, currentRoom), false, LOT_NONE }, - { "heldByObj", LVT_COBJECT_P, offsetof(struct MarioState, heldByObj), false, LOT_OBJECT }, + { "heldByObj", LVT_COBJECT_P, offsetof(struct MarioState, heldByObj), true, LOT_OBJECT }, { "isSnoring", LVT_U8, offsetof(struct MarioState, isSnoring), false, LOT_NONE }, - { "bubbleObj", LVT_COBJECT_P, offsetof(struct MarioState, bubbleObj), false, LOT_OBJECT }, + { "bubbleObj", LVT_COBJECT_P, offsetof(struct MarioState, bubbleObj), true, LOT_OBJECT }, { "freeze", LVT_U8, offsetof(struct MarioState, freeze), false, LOT_NONE }, // { "splineKeyframe", LVT_???, offsetof(struct MarioState, splineKeyframe), false, LOT_??? }, <--- UNIMPLEMENTED { "splineKeyframeFraction", LVT_F32, offsetof(struct MarioState, splineKeyframeFraction), false, LOT_NONE }, { "splineState", LVT_S32, offsetof(struct MarioState, splineState), false, LOT_NONE }, { "nonInstantWarpPos", LVT_COBJECT, offsetof(struct MarioState, nonInstantWarpPos), true, LOT_VEC3F }, - { "character", LVT_COBJECT_P, offsetof(struct MarioState, character), false, LOT_CHARACTER }, + { "character", LVT_COBJECT_P, offsetof(struct MarioState, character), true, LOT_CHARACTER }, { "wasNetworkVisible", LVT_U8, offsetof(struct MarioState, wasNetworkVisible), false, LOT_NONE }, { "minimumBoneY", LVT_F32, offsetof(struct MarioState, minimumBoneY), false, LOT_NONE }, { "curAnimOffset", LVT_F32, offsetof(struct MarioState, curAnimOffset), false, LOT_NONE }, @@ -287,9 +287,9 @@ static struct LuaObjectField sWarpNodeFields[LUA_WARP_NODE_FIELD_COUNT] = { #define LUA_OBJECT_WARP_NODE_FIELD_COUNT 3 static struct LuaObjectField sObjectWarpNodeFields[LUA_OBJECT_WARP_NODE_FIELD_COUNT] = { - { "node", LVT_COBJECT, offsetof(struct ObjectWarpNode, node), true, LOT_WARPNODE }, - { "object", LVT_COBJECT_P, offsetof(struct ObjectWarpNode, object), false, LOT_OBJECT }, - { "next", LVT_COBJECT_P, offsetof(struct ObjectWarpNode, next), false, LOT_OBJECTWARPNODE }, + { "node", LVT_COBJECT, offsetof(struct ObjectWarpNode, node), true, LOT_WARPNODE }, + { "object", LVT_COBJECT_P, offsetof(struct ObjectWarpNode, object), true, LOT_OBJECT }, + { "next", LVT_COBJECT_P, offsetof(struct ObjectWarpNode, next), true, LOT_OBJECTWARPNODE }, }; #define LUA_INSTANT_WARP_FIELD_COUNT 3 @@ -307,8 +307,8 @@ static struct LuaObjectField sSpawnInfoFields[LUA_SPAWN_INFO_FIELD_COUNT] = { { "activeAreaIndex", LVT_S8, offsetof(struct SpawnInfo, activeAreaIndex), false, LOT_NONE }, { "behaviorArg", LVT_U32, offsetof(struct SpawnInfo, behaviorArg), false, LOT_NONE }, // { "behaviorScript", LVT_???, offsetof(struct SpawnInfo, behaviorScript), false, LOT_??? }, <--- UNIMPLEMENTED - { "unk18", LVT_COBJECT_P, offsetof(struct SpawnInfo, unk18), false, LOT_GRAPHNODE }, - { "next", LVT_COBJECT_P, offsetof(struct SpawnInfo, next), false, LOT_SPAWNINFO }, + { "unk18", LVT_COBJECT_P, offsetof(struct SpawnInfo, unk18), true, LOT_GRAPHNODE }, + { "next", LVT_COBJECT_P, offsetof(struct SpawnInfo, next), true, LOT_SPAWNINFO }, }; #define LUA_WHIRLPOOL_FIELD_COUNT 2 @@ -322,22 +322,22 @@ static struct LuaObjectField sAreaFields[LUA_AREA_FIELD_COUNT] = { { "index", LVT_S8, offsetof(struct Area, index), false, LOT_NONE }, { "flags", LVT_S8, offsetof(struct Area, flags), false, LOT_NONE }, { "terrainType", LVT_U16, offsetof(struct Area, terrainType), false, LOT_NONE }, -// { "unk04", LVT_COBJECT_P, offsetof(struct Area, unk04), false, LOT_??? }, <--- UNIMPLEMENTED +// { "unk04", LVT_COBJECT_P, offsetof(struct Area, unk04), true, LOT_??? }, <--- UNIMPLEMENTED // { "terrainData", LVT_???, offsetof(struct Area, terrainData), false, LOT_??? }, <--- UNIMPLEMENTED // { "surfaceRooms", LVT_???, offsetof(struct Area, surfaceRooms), false, LOT_??? }, <--- UNIMPLEMENTED // { "macroObjects", LVT_???, offsetof(struct Area, macroObjects), false, LOT_??? }, <--- UNIMPLEMENTED - { "warpNodes", LVT_COBJECT_P, offsetof(struct Area, warpNodes), false, LOT_OBJECTWARPNODE }, - { "paintingWarpNodes", LVT_COBJECT_P, offsetof(struct Area, paintingWarpNodes), false, LOT_WARPNODE }, - { "instantWarps", LVT_COBJECT_P, offsetof(struct Area, instantWarps), false, LOT_INSTANTWARP }, - { "objectSpawnInfos", LVT_COBJECT_P, offsetof(struct Area, objectSpawnInfos), false, LOT_SPAWNINFO }, - { "camera", LVT_COBJECT_P, offsetof(struct Area, camera), false, LOT_CAMERA }, -// { "unused28", LVT_COBJECT_P, offsetof(struct Area, unused28), false, LOT_??? }, <--- UNIMPLEMENTED -// { "whirlpools", LVT_COBJECT_P, offsetof(struct Area, whirlpools), false, LOT_??? }, <--- UNIMPLEMENTED -// { "dialog", LVT_???, offsetof(struct Area, dialog), false, LOT_??? }, <--- UNIMPLEMENTED + { "warpNodes", LVT_COBJECT_P, offsetof(struct Area, warpNodes), true, LOT_OBJECTWARPNODE }, + { "paintingWarpNodes", LVT_COBJECT_P, offsetof(struct Area, paintingWarpNodes), true, LOT_WARPNODE }, + { "instantWarps", LVT_COBJECT_P, offsetof(struct Area, instantWarps), true, LOT_INSTANTWARP }, + { "objectSpawnInfos", LVT_COBJECT_P, offsetof(struct Area, objectSpawnInfos), true, LOT_SPAWNINFO }, + { "camera", LVT_COBJECT_P, offsetof(struct Area, camera), true, LOT_CAMERA }, +// { "unused28", LVT_COBJECT_P, offsetof(struct Area, unused28), true, LOT_??? }, <--- UNIMPLEMENTED +// { "whirlpools", LOT_???, offsetof(struct Area, whirlpools), false, LOT_??? }, <--- UNIMPLEMENTED +// { "dialog", LOT_???, offsetof(struct Area, dialog), false, LOT_??? }, <--- UNIMPLEMENTED { "musicParam", LVT_U16, offsetof(struct Area, musicParam), false, LOT_NONE }, { "musicParam2", LVT_U16, offsetof(struct Area, musicParam2), false, LOT_NONE }, -// { "cachedBehaviors", LVT_???, offsetof(struct Area, cachedBehaviors), false, LOT_??? }, <--- UNIMPLEMENTED -// { "cachedPositions", LVT_???, offsetof(struct Area, cachedPositions), false, LOT_??? }, <--- UNIMPLEMENTED +// { "cachedBehaviors", LOT_???, offsetof(struct Area, cachedBehaviors), false, LOT_??? }, <--- UNIMPLEMENTED +// { "cachedPositions", LOT_???, offsetof(struct Area, cachedPositions), false, LOT_??? }, <--- UNIMPLEMENTED }; #define LUA_WARP_TRANSITION_DATA_FIELD_COUNT 10 @@ -371,7 +371,7 @@ static struct LuaObjectField sPlayerCameraStateFields[LUA_PLAYER_CAMERA_STATE_FI { "headRotation", LVT_COBJECT, offsetof(struct PlayerCameraState, headRotation), true, LOT_VEC3S }, { "unused", LVT_S16, offsetof(struct PlayerCameraState, unused), false, LOT_NONE }, { "cameraEvent", LVT_S16, offsetof(struct PlayerCameraState, cameraEvent), false, LOT_NONE }, - { "usedObj", LVT_COBJECT_P, offsetof(struct PlayerCameraState, usedObj), false, LOT_OBJECT }, + { "usedObj", LVT_COBJECT_P, offsetof(struct PlayerCameraState, usedObj), true, LOT_OBJECT }, }; #define LUA_TRANSITION_INFO_FIELD_COUNT 9 @@ -434,16 +434,16 @@ static struct LuaObjectField sCutsceneSplinePointFields[LUA_CUTSCENE_SPLINE_POIN #define LUA_PLAYER_GEOMETRY_FIELD_COUNT 13 static struct LuaObjectField sPlayerGeometryFields[LUA_PLAYER_GEOMETRY_FIELD_COUNT] = { - { "currFloor", LVT_COBJECT_P, offsetof(struct PlayerGeometry, currFloor), false, LOT_SURFACE }, + { "currFloor", LVT_COBJECT_P, offsetof(struct PlayerGeometry, currFloor), true, LOT_SURFACE }, { "currFloorHeight", LVT_F32, offsetof(struct PlayerGeometry, currFloorHeight), false, LOT_NONE }, { "currFloorType", LVT_S16, offsetof(struct PlayerGeometry, currFloorType), false, LOT_NONE }, - { "currCeil", LVT_COBJECT_P, offsetof(struct PlayerGeometry, currCeil), false, LOT_SURFACE }, + { "currCeil", LVT_COBJECT_P, offsetof(struct PlayerGeometry, currCeil), true, LOT_SURFACE }, { "currCeilType", LVT_S16, offsetof(struct PlayerGeometry, currCeilType), false, LOT_NONE }, { "currCeilHeight", LVT_F32, offsetof(struct PlayerGeometry, currCeilHeight), false, LOT_NONE }, - { "prevFloor", LVT_COBJECT_P, offsetof(struct PlayerGeometry, prevFloor), false, LOT_SURFACE }, + { "prevFloor", LVT_COBJECT_P, offsetof(struct PlayerGeometry, prevFloor), true, LOT_SURFACE }, { "prevFloorHeight", LVT_F32, offsetof(struct PlayerGeometry, prevFloorHeight), false, LOT_NONE }, { "prevFloorType", LVT_S16, offsetof(struct PlayerGeometry, prevFloorType), false, LOT_NONE }, - { "prevCeil", LVT_COBJECT_P, offsetof(struct PlayerGeometry, prevCeil), false, LOT_SURFACE }, + { "prevCeil", LVT_COBJECT_P, offsetof(struct PlayerGeometry, prevCeil), true, LOT_SURFACE }, { "prevCeilHeight", LVT_F32, offsetof(struct PlayerGeometry, prevCeilHeight), false, LOT_NONE }, { "prevCeilType", LVT_S16, offsetof(struct PlayerGeometry, prevCeilType), false, LOT_NONE }, { "waterHeight", LVT_F32, offsetof(struct PlayerGeometry, waterHeight), false, LOT_NONE }, @@ -504,9 +504,9 @@ static struct LuaObjectField sCameraFields[LUA_CAMERA_FIELD_COUNT] = { { "areaCenX", LVT_F32, offsetof(struct Camera, areaCenX), false, LOT_NONE }, { "areaCenZ", LVT_F32, offsetof(struct Camera, areaCenZ), false, LOT_NONE }, { "cutscene", LVT_U8, offsetof(struct Camera, cutscene), false, LOT_NONE }, -// { "filler31", LVT_???, offsetof(struct Camera, filler31), false, LOT_??? }, <--- UNIMPLEMENTED +// { "filler31", LOT_???, offsetof(struct Camera, filler31), false, LOT_??? }, <--- UNIMPLEMENTED { "nextYaw", LVT_S16, offsetof(struct Camera, nextYaw), false, LOT_NONE }, -// { "filler3C", LVT_???, offsetof(struct Camera, filler3C), false, LOT_??? }, <--- UNIMPLEMENTED +// { "filler3C", LOT_???, offsetof(struct Camera, filler3C), false, LOT_??? }, <--- UNIMPLEMENTED { "doorStatus", LVT_U8, offsetof(struct Camera, doorStatus), false, LOT_NONE }, { "areaCenY", LVT_F32, offsetof(struct Camera, areaCenY), false, LOT_NONE }, }; @@ -517,10 +517,10 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] = { "curPos", LVT_COBJECT, offsetof(struct LakituState, curPos), true, LOT_VEC3F }, { "goalFocus", LVT_COBJECT, offsetof(struct LakituState, goalFocus), true, LOT_VEC3F }, { "goalPos", LVT_COBJECT, offsetof(struct LakituState, goalPos), true, LOT_VEC3F }, -// { "filler30", LVT_???, offsetof(struct LakituState, filler30), false, LOT_??? }, <--- UNIMPLEMENTED +// { "filler30", LOT_???, offsetof(struct LakituState, filler30), false, LOT_??? }, <--- UNIMPLEMENTED { "mode", LVT_U8, offsetof(struct LakituState, mode), false, LOT_NONE }, { "defMode", LVT_U8, offsetof(struct LakituState, defMode), false, LOT_NONE }, -// { "filler3E", LVT_???, offsetof(struct LakituState, filler3E), false, LOT_??? }, <--- UNIMPLEMENTED +// { "filler3E", LOT_???, offsetof(struct LakituState, filler3E), false, LOT_??? }, <--- UNIMPLEMENTED { "focusDistance", LVT_F32, offsetof(struct LakituState, focusDistance), false, LOT_NONE }, { "oldPitch", LVT_S16, offsetof(struct LakituState, oldPitch), false, LOT_NONE }, { "oldYaw", LVT_S16, offsetof(struct LakituState, oldYaw), false, LOT_NONE }, @@ -531,7 +531,7 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] = { "shakePitchDecay", LVT_S16, offsetof(struct LakituState, shakePitchDecay), false, LOT_NONE }, { "unusedVec1", LVT_COBJECT, offsetof(struct LakituState, unusedVec1), true, LOT_VEC3F }, { "unusedVec2", LVT_COBJECT, offsetof(struct LakituState, unusedVec2), true, LOT_VEC3S }, -// { "filler72", LVT_???, offsetof(struct LakituState, filler72), false, LOT_??? }, <--- UNIMPLEMENTED +// { "filler72", LOT_???, offsetof(struct LakituState, filler72), false, LOT_??? }, <--- UNIMPLEMENTED { "roll", LVT_S16, offsetof(struct LakituState, roll), false, LOT_NONE }, { "yaw", LVT_S16, offsetof(struct LakituState, yaw), false, LOT_NONE }, { "nextYaw", LVT_S16, offsetof(struct LakituState, nextYaw), false, LOT_NONE }, @@ -553,8 +553,9 @@ static struct LuaObjectField sLakituStateFields[LUA_LAKITU_STATE_FIELD_COUNT] = { "skipCameraInterpolationTimestamp", LVT_U32, offsetof(struct LakituState, skipCameraInterpolationTimestamp), false, LOT_NONE }, }; -#define LUA_CHARACTER_FIELD_COUNT 54 +#define LUA_CHARACTER_FIELD_COUNT 55 static struct LuaObjectField sCharacterFields[LUA_CHARACTER_FIELD_COUNT] = { + { "type", LVT_S32, offsetof(struct Character, type), true, LOT_NONE }, // { "name", LVT_???, offsetof(struct Character, name), true, LOT_??? }, <--- UNIMPLEMENTED // { "hudHead", LVT_???, offsetof(struct Character, hudHead), true, LOT_??? }, <--- UNIMPLEMENTED // { "hudHeadTexture", LVT_???, offsetof(struct Character, hudHeadTexture), true, LOT_??? }, <--- UNIMPLEMENTED @@ -618,17 +619,17 @@ static struct LuaObjectField sCharacterFields[LUA_CHARACTER_FIELD_COUNT] = { #define LUA_WALL_COLLISION_DATA_FIELD_COUNT 4 static struct LuaObjectField sWallCollisionDataFields[LUA_WALL_COLLISION_DATA_FIELD_COUNT] = { -// { "z", LVT_???, offsetof(struct WallCollisionData, z), false, LOT_??? }, <--- UNIMPLEMENTED - { "offsetY", LVT_F32, offsetof(struct WallCollisionData, offsetY), false, LOT_NONE }, - { "radius", LVT_F32, offsetof(struct WallCollisionData, radius), false, LOT_NONE }, - { "unk14", LVT_S16, offsetof(struct WallCollisionData, unk14), false, LOT_NONE }, - { "numWalls", LVT_S16, offsetof(struct WallCollisionData, numWalls), false, LOT_NONE }, -// { "walls", LVT_COBJECT_P, offsetof(struct WallCollisionData, walls), false, LOT_??? }, <--- UNIMPLEMENTED +// { "z", LVT_???, offsetof(struct WallCollisionData, z), false, LOT_??? }, <--- UNIMPLEMENTED + { "offsetY", LVT_F32, offsetof(struct WallCollisionData, offsetY), false, LOT_NONE }, + { "radius", LVT_F32, offsetof(struct WallCollisionData, radius), false, LOT_NONE }, + { "unk14", LVT_S16, offsetof(struct WallCollisionData, unk14), false, LOT_NONE }, + { "numWalls", LVT_S16, offsetof(struct WallCollisionData, numWalls), false, LOT_NONE }, +// { "walls", LOT_???, offsetof(struct WallCollisionData, walls), false, LOT_??? }, <--- UNIMPLEMENTED }; #define LUA_FLOOR_GEOMETRY_FIELD_COUNT 4 static struct LuaObjectField sFloorGeometryFields[LUA_FLOOR_GEOMETRY_FIELD_COUNT] = { -// { "unused", LVT_???, offsetof(struct FloorGeometry, unused), false, LOT_??? }, <--- UNIMPLEMENTED +// { "unused", LOT_???, offsetof(struct FloorGeometry, unused), false, LOT_??? }, <--- UNIMPLEMENTED { "normalX", LVT_F32, offsetof(struct FloorGeometry, normalX), false, LOT_NONE }, { "normalY", LVT_F32, offsetof(struct FloorGeometry, normalY), false, LOT_NONE }, { "normalZ", LVT_F32, offsetof(struct FloorGeometry, normalZ), false, LOT_NONE }, diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index c20c246b5..8b486b526 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -56,6 +56,88 @@ int smlua_func_set_camera_shake_from_point(lua_State* L) { return 1; } + ////////////////// + // characters.h // +////////////////// + +/* +int smlua_func_get_character(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + + UNIMPLEMENTED -->(L, get_character(m)); + + return 1; +} +*/ + +int smlua_func_play_character_sound(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 2)) { return 0; } + + 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); + if (!gSmLuaConvertSuccess) { return 0; } + + play_character_sound(m, characterSound); + + return 1; +} + +int smlua_func_play_character_sound_offset(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + 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); + if (!gSmLuaConvertSuccess) { return 0; } + u32 offset = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + play_character_sound_offset(m, characterSound, offset); + + return 1; +} + +int smlua_func_play_character_sound_if_no_flag(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 3)) { return 0; } + + 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); + if (!gSmLuaConvertSuccess) { return 0; } + u32 flags = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { return 0; } + + play_character_sound_if_no_flag(m, characterSound, flags); + + return 1; +} + +int smlua_func_get_character_anim_offset(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + + lua_pushnumber(L, get_character_anim_offset(m)); + + return 1; +} + +int smlua_func_update_character_anim_offset(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 1)) { return 0; } + + struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE); + if (!gSmLuaConvertSuccess) { return 0; } + + update_character_anim_offset(m); + + return 1; +} + //////////////// // external.h // //////////////// @@ -417,6 +499,7 @@ int smlua_func_resolve_and_return_wall_collisions(lua_State* L) { } */ +/* int smlua_func_vec3f_find_ceil(lua_State* L) { if(!smlua_functions_valid_param_count(L, 3)) { return 0; } @@ -430,7 +513,7 @@ int smlua_func_vec3f_find_ceil(lua_State* L) { if (!gSmLuaConvertSuccess) { return 0; } f32 height = smlua_to_number(L, 2); if (!gSmLuaConvertSuccess) { return 0; } - struct Surface** ceil = (struct Surface**)smlua_to_cobject(L, 3, LOT_SURFACE); +// struct Surface** ceil = (struct Surface**)smlua_to_cobject(L, 3, LVT_???); <--- UNIMPLEMENTED if (!gSmLuaConvertSuccess) { return 0; } lua_pushnumber(L, vec3f_find_ceil(pos, height, ceil)); @@ -441,6 +524,7 @@ int smlua_func_vec3f_find_ceil(lua_State* L) { return 1; } +*/ int smlua_func_mario_facing_downhill(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } @@ -2942,6 +3026,7 @@ int smlua_func_find_wall_collisions(lua_State* L) { return 1; } +/* int smlua_func_find_ceil(lua_State* L) { if(!smlua_functions_valid_param_count(L, 4)) { return 0; } @@ -2951,14 +3036,16 @@ int smlua_func_find_ceil(lua_State* L) { if (!gSmLuaConvertSuccess) { return 0; } f32 posZ = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { return 0; } - struct Surface** pceil = (struct Surface**)smlua_to_cobject(L, 4, LOT_SURFACE); +// struct Surface** pceil = (struct Surface**)smlua_to_cobject(L, 4, LVT_???); <--- UNIMPLEMENTED if (!gSmLuaConvertSuccess) { return 0; } lua_pushnumber(L, find_ceil(posX, posY, posZ, pceil)); return 1; } +*/ +/* int smlua_func_find_floor_height_and_data(lua_State* L) { if(!smlua_functions_valid_param_count(L, 4)) { return 0; } @@ -2968,13 +3055,14 @@ int smlua_func_find_floor_height_and_data(lua_State* L) { if (!gSmLuaConvertSuccess) { return 0; } f32 zPos = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { return 0; } - struct FloorGeometry** floorGeo = (struct FloorGeometry**)smlua_to_cobject(L, 4, LOT_FLOORGEOMETRY); +// struct FloorGeometry** floorGeo = (struct FloorGeometry**)smlua_to_cobject(L, 4, LVT_???); <--- UNIMPLEMENTED if (!gSmLuaConvertSuccess) { return 0; } lua_pushnumber(L, find_floor_height_and_data(xPos, yPos, zPos, floorGeo)); return 1; } +*/ int smlua_func_find_floor_height(lua_State* L) { if(!smlua_functions_valid_param_count(L, 3)) { return 0; } @@ -2991,6 +3079,7 @@ int smlua_func_find_floor_height(lua_State* L) { return 1; } +/* int smlua_func_find_floor(lua_State* L) { if(!smlua_functions_valid_param_count(L, 4)) { return 0; } @@ -3000,13 +3089,14 @@ int smlua_func_find_floor(lua_State* L) { if (!gSmLuaConvertSuccess) { return 0; } f32 zPos = smlua_to_number(L, 3); if (!gSmLuaConvertSuccess) { return 0; } - struct Surface** pfloor = (struct Surface**)smlua_to_cobject(L, 4, LOT_SURFACE); +// struct Surface** pfloor = (struct Surface**)smlua_to_cobject(L, 4, LVT_???); <--- UNIMPLEMENTED if (!gSmLuaConvertSuccess) { return 0; } lua_pushnumber(L, find_floor(xPos, yPos, zPos, pfloor)); return 1; } +*/ int smlua_func_find_water_level(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } @@ -3034,6 +3124,7 @@ int smlua_func_find_poison_gas_level(lua_State* L) { return 1; } +/* int smlua_func_find_surface_on_ray(lua_State* L) { if(!smlua_functions_valid_param_count(L, 4)) { return 0; } @@ -3053,7 +3144,7 @@ int smlua_func_find_surface_on_ray(lua_State* L) { if (!gSmLuaConvertSuccess) { return 0; } dir[2] = smlua_get_number_field(2, "z"); if (!gSmLuaConvertSuccess) { return 0; } - struct Surface** hit_surface = (struct Surface**)smlua_to_cobject(L, 3, LOT_SURFACE); +// struct Surface** hit_surface = (struct Surface**)smlua_to_cobject(L, 3, LVT_???); <--- UNIMPLEMENTED if (!gSmLuaConvertSuccess) { return 0; } f32* hit_pos = smlua_get_vec3f_from_buffer(); @@ -3080,6 +3171,7 @@ int smlua_func_find_surface_on_ray(lua_State* L) { return 1; } +*/ /////////////// // thread6.c // @@ -3141,6 +3233,14 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "set_environmental_camera_shake", smlua_func_set_environmental_camera_shake); smlua_bind_function(L, "set_camera_shake_from_point", smlua_func_set_camera_shake_from_point); + // characters.h + //smlua_bind_function(L, "get_character", smlua_func_get_character); <--- UNIMPLEMENTED + smlua_bind_function(L, "play_character_sound", smlua_func_play_character_sound); + smlua_bind_function(L, "play_character_sound_offset", smlua_func_play_character_sound_offset); + smlua_bind_function(L, "play_character_sound_if_no_flag", smlua_func_play_character_sound_if_no_flag); + smlua_bind_function(L, "get_character_anim_offset", smlua_func_get_character_anim_offset); + smlua_bind_function(L, "update_character_anim_offset", smlua_func_update_character_anim_offset); + // external.h smlua_bind_function(L, "play_sound", smlua_func_play_sound); @@ -3169,7 +3269,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "mario_get_floor_class", smlua_func_mario_get_floor_class); smlua_bind_function(L, "mario_get_terrain_sound_addend", smlua_func_mario_get_terrain_sound_addend); //smlua_bind_function(L, "resolve_and_return_wall_collisions", smlua_func_resolve_and_return_wall_collisions); <--- UNIMPLEMENTED - smlua_bind_function(L, "vec3f_find_ceil", smlua_func_vec3f_find_ceil); + //smlua_bind_function(L, "vec3f_find_ceil", smlua_func_vec3f_find_ceil); <--- UNIMPLEMENTED smlua_bind_function(L, "mario_facing_downhill", smlua_func_mario_facing_downhill); smlua_bind_function(L, "mario_floor_is_slippery", smlua_func_mario_floor_is_slippery); smlua_bind_function(L, "mario_floor_is_slope", smlua_func_mario_floor_is_slope); @@ -3376,13 +3476,13 @@ void smlua_bind_functions_autogen(void) { // surface_collision.h //smlua_bind_function(L, "f32_find_wall_collision", smlua_func_f32_find_wall_collision); <--- UNIMPLEMENTED smlua_bind_function(L, "find_wall_collisions", smlua_func_find_wall_collisions); - smlua_bind_function(L, "find_ceil", smlua_func_find_ceil); - smlua_bind_function(L, "find_floor_height_and_data", smlua_func_find_floor_height_and_data); + //smlua_bind_function(L, "find_ceil", smlua_func_find_ceil); <--- UNIMPLEMENTED + //smlua_bind_function(L, "find_floor_height_and_data", smlua_func_find_floor_height_and_data); <--- UNIMPLEMENTED smlua_bind_function(L, "find_floor_height", smlua_func_find_floor_height); - smlua_bind_function(L, "find_floor", smlua_func_find_floor); + //smlua_bind_function(L, "find_floor", smlua_func_find_floor); <--- UNIMPLEMENTED smlua_bind_function(L, "find_water_level", smlua_func_find_water_level); smlua_bind_function(L, "find_poison_gas_level", smlua_func_find_poison_gas_level); - smlua_bind_function(L, "find_surface_on_ray", smlua_func_find_surface_on_ray); + //smlua_bind_function(L, "find_surface_on_ray", smlua_func_find_surface_on_ray); <--- UNIMPLEMENTED // thread6.c smlua_bind_function(L, "queue_rumble_data", smlua_func_queue_rumble_data);