1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-23 07:10:19 +01:00

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 { return {
stand_START = 0, stand_START = 0,
stand_END = 79, stand_END = 79,
walk_START = 81, sit_START = 81,
walk_END = 100, sit_END = 160,
mine_START = 102, lay_START = 162,
mine_END = 111, lay_END = 166,
walk_mine_START = 113, walk_START = 168,
walk_mine_END = 132, walk_END = 187,
death_START = 134, mine_START = 189,
death_END = 153 mine_END = 198,
walk_mine_START = 200,
walk_mine_END = 219
} }
end end
end end
@ -43,10 +45,11 @@ local player_model = {}
local player_anim = {} local player_anim = {}
local player_sneak = {} local player_sneak = {}
local ANIM_STAND = 1 local ANIM_STAND = 1
local ANIM_WALK = 2 local ANIM_SIT = 2
local ANIM_WALK_MINE = 3 local ANIM_LAY = 3
local ANIM_MINE = 4 local ANIM_WALK = 4
local ANIM_DEATH = 5 local ANIM_WALK_MINE = 5
local ANIM_MINE = 6
-- Called when a player's appearance needs to be updated -- Called when a player's appearance needs to be updated
function player_update_visuals(pl) function player_update_visuals(pl)
@ -99,10 +102,9 @@ function player_step(dtime)
-- Apply animations based on what the player is doing -- Apply animations based on what the player is doing
if pl:get_hp() == 0 then if pl:get_hp() == 0 then
if player_anim[name] ~= ANIM_DEATH then if player_anim[name] ~= ANIM_LAY 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.lay_START, y=anim.lay_END}, animation_speed_mod, animation_blend)
pl:set_animation({x=anim.death_START, y=anim.death_END}, animation_speed_mod, animation_blend) player_anim[name] = ANIM_LAY
player_anim[name] = ANIM_DEATH
end end
elseif walking and controls.LMB then elseif walking and controls.LMB then
if player_anim[name] ~= ANIM_WALK_MINE then if player_anim[name] ~= ANIM_WALK_MINE then