From b94a00786454968a1cc309b01180292b114da4bd Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 22 Dec 2010 03:33:58 +0200 Subject: some work-in-progress --- src/player.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'src/player.h') diff --git a/src/player.h b/src/player.h index 7337eb6db..0b9f014c1 100644 --- a/src/player.h +++ b/src/player.h @@ -37,7 +37,8 @@ public: Player(); virtual ~Player(); - void move(f32 dtime, Map &map); + //void move(f32 dtime, Map &map); + virtual void move(f32 dtime, Map &map) = 0; v3f getSpeed() { @@ -94,6 +95,8 @@ public: virtual bool isLocal() const = 0; + virtual void updateLight(u8 light_at_pos) {}; + bool touching_ground; bool in_water; @@ -124,6 +127,10 @@ public: return false; } + void move(f32 dtime, Map &map) + { + } + private: }; @@ -163,8 +170,18 @@ public: void setPosition(v3f position) { + m_oldpos = m_showpos; + + if(m_pos_animation_time < 0.001 || m_pos_animation_time > 1.0) + m_pos_animation_time = m_pos_animation_time_counter; + else + m_pos_animation_time = m_pos_animation_time * 0.9 + + m_pos_animation_time_counter * 0.1; + m_pos_animation_time_counter = 0; + m_pos_animation_counter = 0; + Player::setPosition(position); - ISceneNode::setPosition(position); + //ISceneNode::setPosition(position); } virtual void setYaw(f32 yaw) @@ -180,9 +197,41 @@ public: void updateName(const char *name); + virtual void updateLight(u8 light_at_pos) + { + if(m_node == NULL) + return; + + u8 li = decode_light(light_at_pos); + video::SColor color(255,li,li,li); + + scene::IMesh *mesh = m_node->getMesh(); + + u16 mc = mesh->getMeshBufferCount(); + for(u16 j=0; jgetMeshBuffer(j); + video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices(); + u16 vc = buf->getVertexCount(); + for(u16 i=0; i m_box; + + v3f m_oldpos; + f32 m_pos_animation_counter; + f32 m_pos_animation_time; + f32 m_pos_animation_time_counter; + v3f m_showpos; }; #endif @@ -242,6 +291,8 @@ public: return true; } + void move(f32 dtime, Map &map); + void applyControl(float dtime); PlayerControl control; -- cgit v1.2.3