mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 21:45:12 +00:00
More Lua improvements
Added Lua wrapper functions for mario_actions_moving.c, mario_step.h, mario_actions_airborne.c, camera.h, mario_actions_stationary.h Extended Moveset Mod: Started porting spin jump from extended moveset Added act_ground_pound_jump, act_spin_pound, act_spin_pound_land,
This commit is contained in:
parent
f631f4d62f
commit
8aa9a95d5b
6 changed files with 2087 additions and 122 deletions
|
@ -1155,3 +1155,12 @@ MARIO_ANIM_STAR_DANCE = 205
|
|||
MARIO_ANIM_RETURN_FROM_STAR_DANCE = 206
|
||||
MARIO_ANIM_FORWARD_SPINNING_FLIP = 207
|
||||
MARIO_ANIM_TRIPLE_JUMP_FLY = 208
|
||||
|
||||
SHAKE_ATTACK = 1
|
||||
SHAKE_GROUND_POUND = 2
|
||||
SHAKE_SMALL_DAMAGE = 3
|
||||
SHAKE_MED_DAMAGE = 4
|
||||
SHAKE_LARGE_DAMAGE = 5
|
||||
SHAKE_HIT_FROM_BELOW = 8
|
||||
SHAKE_FALL_DAMAGE = 9
|
||||
SHAKE_SHOCK = 10
|
||||
|
|
|
@ -6,53 +6,49 @@ number_types = ["f32", "float"]
|
|||
cobject_types = ["struct MarioState*", "Vec3s", "Vec3f"]
|
||||
cobject_lot_types = ["LOT_MARIO_STATE", "LOT_VEC3S", "LOT_VEC3F"]
|
||||
|
||||
do_extern = False
|
||||
header_h = """
|
||||
s32 is_anim_at_end(struct MarioState *m);
|
||||
s32 is_anim_past_end(struct MarioState *m);
|
||||
s16 set_mario_animation(struct MarioState *m, s32 targetAnimID);
|
||||
s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel);
|
||||
void set_anim_to_frame(struct MarioState *m, s16 animFrame);
|
||||
s32 is_anim_past_frame(struct MarioState *m, s16 animFrame);
|
||||
s16 find_mario_anim_flags_and_translation(struct Object *o, s32 yaw, Vec3s translation);
|
||||
void update_mario_pos_for_anim(struct MarioState *m);
|
||||
s16 return_mario_anim_y_translation(struct MarioState *m);
|
||||
void play_sound_if_no_flag(struct MarioState *m, u32 soundBits, u32 flags);
|
||||
void play_mario_jump_sound(struct MarioState *m);
|
||||
void adjust_sound_for_speed(struct MarioState *m);
|
||||
void play_sound_and_spawn_particles(struct MarioState *m, u32 soundBits, u32 waveParticleType);
|
||||
void play_mario_action_sound(struct MarioState *m, u32 soundBits, u32 waveParticleType);
|
||||
void play_mario_landing_sound(struct MarioState *m, u32 soundBits);
|
||||
void play_mario_landing_sound_once(struct MarioState *m, u32 soundBits);
|
||||
void play_mario_heavy_landing_sound(struct MarioState *m, u32 soundBits);
|
||||
void play_mario_heavy_landing_sound_once(struct MarioState *m, u32 soundBits);
|
||||
void play_mario_sound(struct MarioState *m, s32 primarySoundBits, s32 scondarySoundBits);
|
||||
void mario_set_bubbled(struct MarioState* m);
|
||||
void mario_set_forward_vel(struct MarioState *m, f32 speed);
|
||||
s32 mario_get_floor_class(struct MarioState *m);
|
||||
u32 mario_get_terrain_sound_addend(struct MarioState *m);
|
||||
struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius);
|
||||
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil);
|
||||
s32 mario_facing_downhill(struct MarioState *m, s32 turnYaw);
|
||||
u32 mario_floor_is_slippery(struct MarioState *m);
|
||||
s32 mario_floor_is_slope(struct MarioState *m);
|
||||
s32 mario_floor_is_steep(struct MarioState *m);
|
||||
f32 find_floor_height_relative_polar(struct MarioState *m, s16 angleFromMario, f32 distFromMario);
|
||||
s16 find_floor_slope(struct MarioState *m, s16 yawOffset);
|
||||
void update_mario_sound_and_camera(struct MarioState *m);
|
||||
void set_steep_jump_action(struct MarioState *m);
|
||||
u32 set_mario_action(struct MarioState *m, u32 action, u32 actionArg);
|
||||
s32 set_jump_from_landing(struct MarioState *m);
|
||||
s32 set_jumping_action(struct MarioState *m, u32 action, u32 actionArg);
|
||||
s32 drop_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg);
|
||||
s32 hurt_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg, s16 hurtCounter);
|
||||
s32 check_common_action_exits(struct MarioState *m);
|
||||
s32 check_common_hold_action_exits(struct MarioState *m);
|
||||
s32 transition_submerged_to_walking(struct MarioState *m);
|
||||
s32 set_water_plunge_action(struct MarioState *m);
|
||||
s32 execute_mario_action(UNUSED struct Object *o);
|
||||
s32 force_idle_state(struct MarioState* m);
|
||||
void init_mario(void);
|
||||
void init_mario_from_save_file(void);
|
||||
s32 check_common_idle_cancels(struct MarioState *m);
|
||||
s32 check_common_hold_idle_cancels(struct MarioState *m);
|
||||
s32 act_idle(struct MarioState *m);
|
||||
void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound);
|
||||
s32 act_start_sleeping(struct MarioState *m);
|
||||
s32 act_sleeping(struct MarioState *m);
|
||||
s32 act_waking_up(struct MarioState *m);
|
||||
s32 act_shivering(struct MarioState *m);
|
||||
s32 act_coughing(struct MarioState *m);
|
||||
s32 act_standing_against_wall(struct MarioState *m);
|
||||
s32 act_in_quicksand(struct MarioState *m);
|
||||
s32 act_crouching(struct MarioState *m);
|
||||
s32 act_panting(struct MarioState *m);
|
||||
void stopping_step(struct MarioState *m, s32 animID, u32 action);
|
||||
s32 act_braking_stop(struct MarioState *m);
|
||||
s32 act_butt_slide_stop(struct MarioState *m);
|
||||
s32 act_hold_butt_slide_stop(struct MarioState *m);
|
||||
s32 act_slide_kick_slide_stop(struct MarioState *m);
|
||||
s32 act_start_crouching(struct MarioState *m);
|
||||
s32 act_stop_crouching(struct MarioState *m);
|
||||
s32 act_start_crawling(struct MarioState *m);
|
||||
s32 act_stop_crawling(struct MarioState *m);
|
||||
s32 act_shockwave_bounce(struct MarioState *m);
|
||||
s32 landing_step(struct MarioState *m, s32 arg1, u32 action);
|
||||
s32 check_common_landing_cancels(struct MarioState *m, u32 action);
|
||||
s32 act_jump_land_stop(struct MarioState *m);
|
||||
s32 act_double_jump_land_stop(struct MarioState *m);
|
||||
s32 act_side_flip_land_stop(struct MarioState *m);
|
||||
s32 act_freefall_land_stop(struct MarioState *m);
|
||||
s32 act_triple_jump_land_stop(struct MarioState *m);
|
||||
s32 act_backflip_land_stop(struct MarioState *m);
|
||||
s32 act_lava_boost_land(struct MarioState *m);
|
||||
s32 act_long_jump_land_stop(struct MarioState *m);
|
||||
s32 act_hold_jump_land_stop(struct MarioState *m);
|
||||
s32 act_hold_freefall_land_stop(struct MarioState *m);
|
||||
s32 act_air_throw_land(struct MarioState *m);
|
||||
s32 act_twirl_land(struct MarioState *m);
|
||||
s32 act_ground_pound_land(struct MarioState *m);
|
||||
s32 act_first_person(struct MarioState *m);
|
||||
s32 check_common_stationary_cancels(struct MarioState *m);
|
||||
s32 mario_execute_stationary_action(struct MarioState *m);
|
||||
"""
|
||||
|
||||
functions = []
|
||||
|
@ -91,13 +87,19 @@ def process_line(line):
|
|||
if len(params_str) == 0 or params_str == 'void':
|
||||
pass
|
||||
else:
|
||||
param_index = 0
|
||||
for param_str in params_str.split(','):
|
||||
param = {}
|
||||
param_str = param_str.strip()
|
||||
if param_str.endswith('*') or ' ' not in param_str:
|
||||
param['type'] = normalize_type(param_str)
|
||||
param['identifier'] = 'arg%d' % param_index
|
||||
else:
|
||||
match = re.search('[a-zA-Z0-9_]+$', param_str)
|
||||
param['type'] = normalize_type(param_str[0:match.span()[0]])
|
||||
param['identifier'] = match.group()
|
||||
function['params'].append(param)
|
||||
param_index += 1
|
||||
|
||||
functions.append(function)
|
||||
|
||||
|
@ -150,6 +152,9 @@ def build_function(function):
|
|||
i += 1
|
||||
s += '\n'
|
||||
|
||||
if do_extern:
|
||||
s += ' extern %s\n' % function['line']
|
||||
|
||||
s += build_return(function)
|
||||
s += ' return 1;\n}\n'
|
||||
|
||||
|
|
369
mods/test.lua
369
mods/test.lua
|
@ -19,11 +19,23 @@ ACT_WATER_GROUND_POUND_JUMP = (0x0CC | ACT_FLAG_MOVING | ACT_FLAG_SWIMMING | A
|
|||
-- initialize extra fields --
|
||||
-----------------------------
|
||||
|
||||
ANGLE_QUEUE_SIZE = 9
|
||||
SPIN_TIMER_SUCCESSFUL_INPUT = 4
|
||||
|
||||
gMarioStateExtras = {}
|
||||
for i=0,(MAX_PLAYERS-1) do
|
||||
gMarioStateExtras[i] = {}
|
||||
gMarioStateExtras[i].rotAngle = 0
|
||||
gMarioStateExtras[i].boostTimer = 0
|
||||
local e = gMarioStateExtras[i]
|
||||
e.angleDeltaQueue = {}
|
||||
for j=0,(ANGLE_QUEUE_SIZE-1) do e.angleDeltaQueue[j] = 0 end
|
||||
e.rotAngle = 0
|
||||
e.boostTimer = 0
|
||||
e.stickLastAngle = 0
|
||||
e.spinDirection = 0
|
||||
e.spinBufferTimer = 0
|
||||
e.spinInput = 0
|
||||
e.actionLastFrame = gMarioStates[i].action
|
||||
e.lastIntendedMag = 0
|
||||
end
|
||||
|
||||
---------------
|
||||
|
@ -239,6 +251,42 @@ 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
|
||||
-- TODO: 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
|
||||
-- TODO: 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
|
||||
local cx, cy, cz = get_camera_position()
|
||||
play_sound(SOUND_ACTION_SPIN, cx, cy, cz)
|
||||
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
|
||||
-- TODO: 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
|
||||
|
@ -298,12 +346,291 @@ function update_roll(m)
|
|||
end
|
||||
end
|
||||
|
||||
----------
|
||||
-- spin --
|
||||
----------
|
||||
|
||||
function mario_update_spin_input(m)
|
||||
local e = gMarioStateExtras[m.playerIndex]
|
||||
local rawAngle = atan2s(-m.controller.stickY, m.controller.stickX)
|
||||
e.spinInput = 0
|
||||
|
||||
-- prevent issues due to the frame going out of the dead zone registering the last angle as 0
|
||||
if e.lastIntendedMag > 0.5 and m.intendedMag > 0.5 then
|
||||
local angleOverFrames = 0
|
||||
local thisFrameDelta = 0
|
||||
local i = 0
|
||||
|
||||
local newDirection = e.spinDirection
|
||||
local signedOverflow = 0
|
||||
|
||||
if rawAngle < e.stickLastAngle then
|
||||
if (e.stickLastAngle - rawAngle) > 0x8000 then
|
||||
signedOverflow = 1
|
||||
end
|
||||
if signedOverflow ~= 0 then
|
||||
newDirection = 1
|
||||
else
|
||||
newDirection = -1
|
||||
end
|
||||
elseif rawAngle > e.stickLastAngle then
|
||||
if (rawAngle - e.stickLastAngle) > 0x8000 then
|
||||
signedOverflow = 1
|
||||
end
|
||||
if signedOverflow ~= 0 then
|
||||
newDirection = -1
|
||||
else
|
||||
newDirection = 1
|
||||
end
|
||||
end
|
||||
|
||||
if e.spinDirection ~= newDirection then
|
||||
for i=0,(ANGLE_QUEUE_SIZE-1) do
|
||||
e.angleDeltaQueue[i] = 0
|
||||
end
|
||||
e.spinDirection = newDirection
|
||||
else
|
||||
for i=(ANGLE_QUEUE_SIZE-1),1,-1 do
|
||||
e.angleDeltaQueue[i] = e.angleDeltaQueue[i-1]
|
||||
angleOverFrames = angleOverFrames + e.angleDeltaQueue[i]
|
||||
end
|
||||
end
|
||||
|
||||
if e.spinDirection < 0 then
|
||||
if signedOverflow ~= 0 then
|
||||
thisFrameDelta = math.floor((1.0*e.stickLastAngle + 0x10000) - rawAngle)
|
||||
else
|
||||
thisFrameDelta = e.stickLastAngle - rawAngle
|
||||
end
|
||||
elseif e.spinDirection > 0 then
|
||||
if signedOverflow ~= 0 then
|
||||
thisFrameDelta = math.floor(1.0*rawAngle + 0x10000 - e.stickLastAngle)
|
||||
else
|
||||
thisFrameDelta = rawAngle - e.stickLastAngle
|
||||
end
|
||||
end
|
||||
|
||||
e.angleDeltaQueue[0] = thisFrameDelta
|
||||
angleOverFrames = angleOverFrames + thisFrameDelta
|
||||
|
||||
if angleOverFrames >= 0xA000 then
|
||||
e.spinBufferTimer = SPIN_TIMER_SUCCESSFUL_INPUT
|
||||
end
|
||||
|
||||
|
||||
-- allow a buffer after a successful input so that you can switch directions
|
||||
if e.spinBufferTimer > 0 then
|
||||
e.spinInput = 1
|
||||
e.spinBufferTimer = e.spinBufferTimer - 1
|
||||
end
|
||||
else
|
||||
e.spinDirection = 0
|
||||
e.spinBufferTimer = 0
|
||||
end
|
||||
|
||||
e.stickLastAngle = rawAngle
|
||||
e.lastIntendedMag = m.intendedMag
|
||||
end
|
||||
|
||||
function act_spin_jump(m)
|
||||
local e = gMarioStateExtras[m.playerIndex]
|
||||
if m.actionTimer == 0 then
|
||||
-- determine clockwise/counter-clockwise spin
|
||||
if e.spinDirection < 0 then
|
||||
m.actionState = 1
|
||||
end
|
||||
elseif m.actionTimer == 1 or m.actionTimer == 4 then
|
||||
local cx, cy, cz = get_camera_position()
|
||||
play_sound(SOUND_ACTION_TWIRL, cx, cy, cz)
|
||||
end
|
||||
|
||||
local spinDirFactor = 1 -- negative for clockwise, positive for counter-clockwise
|
||||
if m.actionState == 1 then
|
||||
spinDirFactor = -1
|
||||
end
|
||||
|
||||
if (m.input & INPUT_B_PRESSED) ~= 0 then
|
||||
return set_mario_action(m, ACT_DIVE, 0)
|
||||
end
|
||||
|
||||
if (m.input & INPUT_Z_PRESSED) ~= 0 then
|
||||
local cx, cy, cz = get_camera_position()
|
||||
play_sound(SOUND_ACTION_TWIRL, cx, cy, cz)
|
||||
|
||||
m.vel.y = -50.0
|
||||
mario_set_forward_vel(m, 0.0)
|
||||
|
||||
-- choose which direction to be facing on land (practically random if no input)
|
||||
if (m.input & INPUT_NONZERO_ANALOG) ~= 0 then
|
||||
m.faceAngle.y = m.intendedYaw
|
||||
else
|
||||
m.faceAngle.y = e.rotAngle
|
||||
end
|
||||
|
||||
return set_mario_action(m, ACT_SPIN_POUND, m.actionState)
|
||||
end
|
||||
|
||||
play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, SOUND_MARIO_YAHOO)
|
||||
|
||||
common_air_action_step(m, ACT_DOUBLE_JUMP_LAND, MARIO_ANIM_TWIRL,
|
||||
AIR_STEP_CHECK_HANG)
|
||||
|
||||
e.rotAngle = e.rotAngle + 0x2867
|
||||
if (e.rotAngle > 0x10000) then e.rotAngle = e.rotAngle - 0x10000 end
|
||||
if (e.rotAngle < -0x10000) then e.rotAngle = e.rotAngle + 0x10000 end
|
||||
-- TODO: m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y + (s16) (e.rotAngle * spinDirFactor)
|
||||
|
||||
-- gravity
|
||||
m.vel.y = m.vel.y + 2
|
||||
if (m.flags & MARIO_WING_CAP) ~= 0 and m.vel.y < 0.0 and (m.input & INPUT_A_DOWN) ~= 0 then
|
||||
-- TODO: m.marioBodyState.wingFlutter = 1
|
||||
m.vel.y = m.vel.y - 0.7
|
||||
if m.vel.y < -37.5 then
|
||||
m.vel.y = m.vel.y + 1.4
|
||||
if m.vel.y > -37.5 then
|
||||
m.vel.y = -37.5
|
||||
end
|
||||
end
|
||||
else
|
||||
if m.vel.y > 0 then
|
||||
m.vel.y = m.vel.y - 4
|
||||
else
|
||||
m.vel.y = m.vel.y + 1.4
|
||||
end
|
||||
|
||||
if m.vel.y < -75.0 then
|
||||
m.vel.y = -75.5
|
||||
end
|
||||
end
|
||||
|
||||
m.actionTimer = m.actionTimer + 1
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function act_spin_pound(m)
|
||||
local e = gMarioStateExtras[m.playerIndex]
|
||||
if m.actionTimer == 0 then
|
||||
m.actionState = m.actionArg
|
||||
end
|
||||
|
||||
local spinDirFactor = 1 -- negative for clockwise, positive for counter-clockwise
|
||||
if m.actionState == 1 then spinDirFactor = -1 end
|
||||
|
||||
set_mario_animation(m, MARIO_ANIM_TWIRL)
|
||||
|
||||
if (m.input & INPUT_B_PRESSED) ~= 0 then
|
||||
mario_set_forward_vel(m, 10.0)
|
||||
m.vel.y = 35
|
||||
set_mario_action(m, ACT_DIVE, 0)
|
||||
end
|
||||
|
||||
local stepResult = perform_air_step(m, 0)
|
||||
if stepResult == AIR_STEP_LANDED then
|
||||
if should_get_stuck_in_ground(m) ~= 0 then
|
||||
local cx, cy, cz = get_camera_position()
|
||||
play_sound(SOUND_MARIO_OOOF2, cx, cy, cz)
|
||||
m.particleFlags = m.particleFlags | PARTICLE_MIST_CIRCLE
|
||||
set_mario_action(m, ACT_BUTT_STUCK_IN_GROUND, 0)
|
||||
else
|
||||
play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_HEAVY_LANDING)
|
||||
if check_fall_damage(m, ACT_HARD_BACKWARD_GROUND_KB) == 0 then
|
||||
m.particleFlags = m.particleFlags | PARTICLE_MIST_CIRCLE | PARTICLE_HORIZONTAL_STAR
|
||||
set_mario_action(m, ACT_SPIN_POUND_LAND, 0)
|
||||
end
|
||||
end
|
||||
set_camera_shake_from_hit(SHAKE_GROUND_POUND)
|
||||
elseif stepResult == AIR_STEP_HIT_WALL then
|
||||
mario_set_forward_vel(m, -16.0)
|
||||
if m.vel.y > 0.0 then
|
||||
m.vel.y = 0.0
|
||||
end
|
||||
|
||||
m.particleFlags = m.particleFlags | PARTICLE_VERTICAL_STAR
|
||||
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0)
|
||||
end
|
||||
|
||||
e.rotAngle = e.rotAngle + 0x3053
|
||||
if e.rotAngle > 0x10000 then e.rotAngle = e.rotAngle - 0x10000 end
|
||||
if e.rotAngle < -0x10000 then e.rotAngle = e.rotAngle + 0x10000 end
|
||||
-- TODO: m.marioObj.header.gfx.angle.y = m.marioObj.header.gfx.angle.y + e.rotAngle * spinDirFactor
|
||||
|
||||
m.actionTimer = m.actionTimer + 1
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function act_spin_pound_land(m)
|
||||
m.actionState = 1
|
||||
|
||||
if m.actionTimer <= 8 then
|
||||
if (m.input & INPUT_UNKNOWN_10) ~= 0 then
|
||||
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0)
|
||||
end
|
||||
|
||||
if (m.input & INPUT_OFF_FLOOR) ~= 0 then
|
||||
return set_mario_action(m, ACT_FREEFALL, 0)
|
||||
end
|
||||
|
||||
if (m.input & INPUT_ABOVE_SLIDE) ~= 0 then
|
||||
return set_mario_action(m, ACT_BUTT_SLIDE, 0)
|
||||
end
|
||||
|
||||
if (m.input & INPUT_A_PRESSED) ~= 0 then
|
||||
m.vel.y = 65.0
|
||||
return set_jumping_action(m, ACT_GROUND_POUND_JUMP, 0)
|
||||
end
|
||||
|
||||
if (m.controller.buttonPressed & R_TRIG) ~= 0 then
|
||||
mario_set_forward_vel(m, 60)
|
||||
|
||||
local cx, cy, cz = get_camera_position()
|
||||
play_sound(SOUND_ACTION_SPIN, cx, cy, cz)
|
||||
return set_mario_action(m, ACT_ROLL, 0)
|
||||
end
|
||||
|
||||
stationary_ground_step(m)
|
||||
set_mario_animation(m, MARIO_ANIM_LAND_FROM_DOUBLE_JUMP)
|
||||
else
|
||||
if (m.input & INPUT_UNKNOWN_10) ~= 0 then
|
||||
return set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0)
|
||||
end
|
||||
|
||||
if (m.input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE)) ~= 0 then
|
||||
return check_common_action_exits(m)
|
||||
end
|
||||
|
||||
stopping_step(m, MARIO_ANIM_LAND_FROM_DOUBLE_JUMP, ACT_IDLE)
|
||||
end
|
||||
|
||||
m.actionTimer = m.actionTimer + 1
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
---------------------------------------------------------
|
||||
|
||||
function update()
|
||||
function mario_action_on_change(m)
|
||||
local e = gMarioStateExtras[m.playerIndex]
|
||||
if e.spinInput ~= 0 then
|
||||
if m.action == ACT_JUMP or m.action == ACT_DOUBLE_JUMP or m.action == ACT_TRIPLE_JUMP or m.action == ACT_SIDE_FLIP or m.action == ACT_BACKFLIP or m.action == ACT_WALL_KICK_AIR then
|
||||
set_mario_action(m, ACT_SPIN_JUMP, 1)
|
||||
m.vel.y = 65.0
|
||||
m.faceAngle.y = m.intendedYaw
|
||||
end
|
||||
end
|
||||
|
||||
if m.action == ACT_GROUND_POUND_JUMP then
|
||||
m.vel.y = 65.0
|
||||
elseif m.action == ACT_WALL_SLIDE then
|
||||
m.vel.y = 0.0
|
||||
end
|
||||
end
|
||||
|
||||
function mario_update(m)
|
||||
local e = gMarioStateExtras[m.playerIndex]
|
||||
|
||||
mario_update_spin_input(m)
|
||||
update_roll(m)
|
||||
|
||||
-- dive hop
|
||||
|
@ -315,9 +642,45 @@ function mario_update(m)
|
|||
end
|
||||
end
|
||||
|
||||
-- dive out of ACT_GROUND_POUND
|
||||
if m.action == ACT_GROUND_POUND and (m.input & INPUT_B_PRESSED) ~= 0 then
|
||||
mario_set_forward_vel(m, 10.0)
|
||||
m.vel.y = 35.0
|
||||
set_mario_action(m, ACT_DIVE, 0)
|
||||
end
|
||||
|
||||
-- spin
|
||||
if e.actionLastFrame == m.action and (m.action == ACT_JUMP or m.action == ACT_WALL_KICK_AIR) and e.spinInput ~= 0 then
|
||||
set_mario_action(m, ACT_SPIN_JUMP, 1)
|
||||
e.spinInput = 0
|
||||
end
|
||||
|
||||
-- twirl pound
|
||||
if m.action == ACT_TWIRLING and (m.input & INPUT_Z_PRESSED) ~= 0 then
|
||||
set_mario_action(m, ACT_SPIN_POUND, 0)
|
||||
end
|
||||
|
||||
-- ground pound jump
|
||||
if m.action == ACT_GROUND_POUND_LAND and (m.input & INPUT_A_PRESSED) ~= 0 then
|
||||
set_mario_action(m, ACT_GROUND_POUND_JUMP, 0)
|
||||
end
|
||||
|
||||
-- action change event
|
||||
if e.actionLastFrame ~= m.action then
|
||||
mario_action_on_change(m)
|
||||
end
|
||||
e.actionLastFrame = m.action
|
||||
|
||||
end
|
||||
|
||||
function update()
|
||||
end
|
||||
|
||||
hook_event(HOOK_UPDATE, update)
|
||||
hook_event(HOOK_MARIO_UPDATE, mario_update)
|
||||
hook_mario_action(ACT_ROLL, act_roll)
|
||||
hook_mario_action(ACT_ROLL_AIR, act_roll_air)
|
||||
hook_mario_action(ACT_SPIN_JUMP, act_spin_jump)
|
||||
hook_mario_action(ACT_SPIN_POUND, act_spin_pound)
|
||||
hook_mario_action(ACT_SPIN_POUND_LAND, act_spin_pound_land)
|
||||
hook_mario_action(ACT_GROUND_POUND_JUMP, act_ground_pound_jump)
|
||||
|
|
|
@ -260,8 +260,6 @@ s32 update_sliding(struct MarioState *m, f32 stopSpeed) {
|
|||
lossFactor = m->intendedMag / 32.0f * forward * 0.02f + 0.92f;
|
||||
break;
|
||||
}
|
||||
accel = 4.0f;
|
||||
lossFactor = 0.994f;
|
||||
|
||||
oldSpeed = sqrtf(m->slideVelX * m->slideVelX + m->slideVelZ * m->slideVelZ);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,11 +7,25 @@ void smlua_bind_function(lua_State* L, const char* name, void* func) {
|
|||
lua_setglobal(L, name);
|
||||
}
|
||||
|
||||
static void smlua_logline(void) {
|
||||
lua_State* L = gLuaState;
|
||||
lua_Debug info;
|
||||
int level = 0;
|
||||
while (lua_getstack(L, level, &info)) {
|
||||
lua_getinfo(L, "nSl", &info);
|
||||
LOG_INFO(" [%d] %s:%d -- %s [%s]\n",
|
||||
level, info.short_src, info.currentline,
|
||||
(info.name ? info.name : "<unknown>"), info.what);
|
||||
++level;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
lua_Integer smlua_to_integer(lua_State* L, int index) {
|
||||
if (lua_type(L, index) != LUA_TNUMBER) {
|
||||
LOG_LUA("LUA: smlua_to_integer received improper type '%d'", lua_type(L, index));
|
||||
smlua_logline();
|
||||
gSmLuaConvertSuccess = false;
|
||||
return 0;
|
||||
}
|
||||
|
@ -23,6 +37,7 @@ lua_Integer smlua_to_integer(lua_State* L, int index) {
|
|||
lua_Number smlua_to_number(lua_State* L, int index) {
|
||||
if (lua_type(L, index) != LUA_TNUMBER) {
|
||||
LOG_LUA("LUA: smlua_to_number received improper type '%d'", lua_type(L, index));
|
||||
smlua_logline();
|
||||
gSmLuaConvertSuccess = false;
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,6 +48,7 @@ lua_Number smlua_to_number(lua_State* L, int index) {
|
|||
void* smlua_to_cobject(lua_State* L, int index, enum LuaObjectType lot) {
|
||||
if (lua_type(L, index) != LUA_TTABLE) {
|
||||
LOG_LUA("LUA: smlua_to_cobject received improper type '%d'", lua_type(L, index));
|
||||
smlua_logline();
|
||||
gSmLuaConvertSuccess = false;
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,6 +60,7 @@ void* smlua_to_cobject(lua_State* L, int index, enum LuaObjectType lot) {
|
|||
|
||||
if (lot != objLot) {
|
||||
LOG_LUA("LUA: smlua_to_cobject received improper LOT. Expected '%d', received '%d'", lot, objLot);
|
||||
smlua_logline();
|
||||
gSmLuaConvertSuccess = false;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -56,6 +73,7 @@ void* smlua_to_cobject(lua_State* L, int index, enum LuaObjectType lot) {
|
|||
|
||||
if (pointer == NULL) {
|
||||
LOG_LUA("LUA: smlua_to_cobject received null pointer.");
|
||||
smlua_logline();
|
||||
gSmLuaConvertSuccess = false;
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue