Merge Taoki's 3D player improvements

This commit is contained in:
Perttu Ahola 2012-11-27 08:15:38 +02:00
commit 91937acf76
3 changed files with 2658 additions and 934 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -22,14 +22,16 @@ function player_get_animations(model)
return {
stand_START = 0,
stand_END = 79,
walk_START = 81,
walk_END = 100,
mine_START = 102,
mine_END = 111,
walk_mine_START = 113,
walk_mine_END = 132,
death_START = 134,
death_END = 153
sit_START = 81,
sit_END = 160,
lay_START = 162,
lay_END = 166,
walk_START = 168,
walk_END = 187,
mine_START = 189,
mine_END = 198,
walk_mine_START = 200,
walk_mine_END = 219
}
end
end
@ -43,10 +45,11 @@ local player_model = {}
local player_anim = {}
local player_sneak = {}
local ANIM_STAND = 1
local ANIM_WALK = 2
local ANIM_WALK_MINE = 3
local ANIM_MINE = 4
local ANIM_DEATH = 5
local ANIM_SIT = 2
local ANIM_LAY = 3
local ANIM_WALK = 4
local ANIM_WALK_MINE = 5
local ANIM_MINE = 6
-- Called when a player's appearance needs to be updated
function player_update_visuals(pl)
@ -99,10 +102,9 @@ function player_step(dtime)
-- Apply animations based on what the player is doing
if pl:get_hp() == 0 then
if player_anim[name] ~= ANIM_DEATH then
-- TODO: The death animation currently loops, we must make it play only once then stay at the last frame somehow
pl:set_animation({x=anim.death_START, y=anim.death_END}, animation_speed_mod, animation_blend)
player_anim[name] = ANIM_DEATH
if player_anim[name] ~= ANIM_LAY then
pl:set_animation({x=anim.lay_START, y=anim.lay_END}, animation_speed_mod, animation_blend)
player_anim[name] = ANIM_LAY
end
elseif walking and controls.LMB then
if player_anim[name] ~= ANIM_WALK_MINE then