mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Arena - allow air control when launching from spring
This commit is contained in:
parent
ec876be1b5
commit
7dbe045957
3 changed files with 29 additions and 0 deletions
|
@ -15,6 +15,7 @@ for i = 0, (MAX_PLAYERS - 1) do
|
||||||
e.prevHurtCounter = 0
|
e.prevHurtCounter = 0
|
||||||
e.levelTimer = 0
|
e.levelTimer = 0
|
||||||
e.levelTimerLevel = 0
|
e.levelTimerLevel = 0
|
||||||
|
e.springing = 0
|
||||||
|
|
||||||
local s = gPlayerSyncTable[i]
|
local s = gPlayerSyncTable[i]
|
||||||
s.item = ITEM_NONE
|
s.item = ITEM_NONE
|
||||||
|
@ -318,6 +319,14 @@ function on_set_mario_action(m)
|
||||||
e.rotFrames = 0
|
e.rotFrames = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if m.playerIndex == 0 and is_player_active(m) ~= 0 then
|
||||||
|
if (m.action & ACT_FLAG_AIR) == 0 then
|
||||||
|
if e.springing == 1 then
|
||||||
|
e.springing = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if s.item == ITEM_HAMMER then
|
if s.item == ITEM_HAMMER then
|
||||||
mario_hammer_on_set_action(m)
|
mario_hammer_on_set_action(m)
|
||||||
end
|
end
|
||||||
|
@ -450,6 +459,11 @@ function mario_update(m)
|
||||||
m.marioBodyState.modelState = MODEL_STATE_METAL
|
m.marioBodyState.modelState = MODEL_STATE_METAL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- allow yaw change on springing
|
||||||
|
if e.springing == 1 then
|
||||||
|
m.faceAngle.y = m.intendedYaw - approach_s32(convert_s16(m.intendedYaw - m.faceAngle.y), 0, 0x400, 0x400)
|
||||||
|
end
|
||||||
|
|
||||||
-- update player items
|
-- update player items
|
||||||
if s.item == ITEM_HAMMER then
|
if s.item == ITEM_HAMMER then
|
||||||
mario_hammer_update(m)
|
mario_hammer_update(m)
|
||||||
|
|
|
@ -90,8 +90,11 @@ function bhv_arena_spring_launch(obj)
|
||||||
set_mario_action(m, ACT_TRIPLE_JUMP, 0)
|
set_mario_action(m, ACT_TRIPLE_JUMP, 0)
|
||||||
m.vel.y = vel.y
|
m.vel.y = vel.y
|
||||||
m.forwardVel = 0
|
m.forwardVel = 0
|
||||||
|
local e = gMarioStateExtras[0]
|
||||||
|
e.springing = 1
|
||||||
end
|
end
|
||||||
obj.oArenaSpringSprung = 15
|
obj.oArenaSpringSprung = 15
|
||||||
|
|
||||||
network_send_object(obj, false)
|
network_send_object(obj, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,18 @@ function clamp(val, min, max)
|
||||||
return val
|
return val
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function convert_s16(num)
|
||||||
|
local min = -32768
|
||||||
|
local max = 32767
|
||||||
|
while (num < min) do
|
||||||
|
num = max + (num - min)
|
||||||
|
end
|
||||||
|
while (num > max) do
|
||||||
|
num = min + (num - max)
|
||||||
|
end
|
||||||
|
return num
|
||||||
|
end
|
||||||
|
|
||||||
function mario_health_float(m)
|
function mario_health_float(m)
|
||||||
return clamp((m.health - 255) / (2176 - 255), 0, 1)
|
return clamp((m.health - 255) / (2176 - 255), 0, 1)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue