Eh baswell
This commit is contained in:
parent
06a5bb67d3
commit
bc7127ef7d
@ -248,6 +248,8 @@ void Player::SetDirection(Vector3f dir) { m_direction = dir; }
|
|||||||
|
|
||||||
Vector3f Player::GetPosition() const { return Vector3f(m_position.x + CHUNK_SIZE_X * WORLD_SIZE_X / 2, m_position.y, m_position.z + CHUNK_SIZE_Z * WORLD_SIZE_Y / 2); }
|
Vector3f Player::GetPosition() const { return Vector3f(m_position.x + CHUNK_SIZE_X * WORLD_SIZE_X / 2, m_position.y, m_position.z + CHUNK_SIZE_Z * WORLD_SIZE_Y / 2); }
|
||||||
|
|
||||||
|
Vector3f Player::GetPositionAbs() const { return m_position; }
|
||||||
|
|
||||||
Vector3f Player::GetVelocity() const { return m_velocity; }
|
Vector3f Player::GetVelocity() const { return m_velocity; }
|
||||||
|
|
||||||
Vector3f Player::GetPOV() const { return Vector3f(GetPosition().x, m_POV, GetPosition().z); }
|
Vector3f Player::GetPOV() const { return Vector3f(GetPosition().x, m_POV, GetPosition().z); }
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
|
|
||||||
void SetDirection(Vector3f dir);
|
void SetDirection(Vector3f dir);
|
||||||
Vector3f GetPosition() const;
|
Vector3f GetPosition() const;
|
||||||
|
Vector3f GetPositionAbs() const;
|
||||||
Vector3f GetDirection() const;
|
Vector3f GetDirection() const;
|
||||||
Vector3f GetVelocity() const;
|
Vector3f GetVelocity() const;
|
||||||
Vector3f GetPOV() const;
|
Vector3f GetPOV() const;
|
||||||
|
@ -1248,7 +1248,7 @@ void Engine::Render(float elapsedTime) {
|
|||||||
sync_acc -= 1000;
|
sync_acc -= 1000;
|
||||||
sync.sid = id;
|
sync.sid = id;
|
||||||
sync.timestamp = tstamp;
|
sync.timestamp = tstamp;
|
||||||
sync.position = m_player.GetPosition();
|
sync.position = m_player.GetPositionAbs();
|
||||||
sync.hp = m_player.GetHP();
|
sync.hp = m_player.GetHP();
|
||||||
|
|
||||||
// TODO: Garrocher ca quelque-part.
|
// TODO: Garrocher ca quelque-part.
|
||||||
|
@ -33,48 +33,51 @@ void RemotePlayer::Init()
|
|||||||
|
|
||||||
void RemotePlayer::Feed(const netprot::Output out) {
|
void RemotePlayer::Feed(const netprot::Output out) {
|
||||||
|
|
||||||
//current.position = out.position;
|
current.position = out.position;
|
||||||
//current.direction = out.direction;
|
current.direction = out.direction;
|
||||||
//current.states = out.states;
|
current.states = out.states;
|
||||||
//current.id = out.id;
|
current.id = out.id;
|
||||||
|
|
||||||
//if (current.position != previous.position)
|
if (current.position != previous.position)
|
||||||
//{
|
{
|
||||||
// Vector3f positionDelta = current.position - previous.position;
|
Vector3f positionDelta = current.position - previous.position;
|
||||||
// m_position = current.position + positionDelta;
|
m_position = current.position + positionDelta;
|
||||||
// m_direction = current.direction;
|
m_direction = current.direction;
|
||||||
|
|
||||||
//}
|
}
|
||||||
|
|
||||||
//if(current.direction != previous.direction)
|
if(current.direction != previous.direction)
|
||||||
//{
|
{
|
||||||
// m_direction = current.direction;
|
m_direction = current.direction;
|
||||||
// current.direction = current.direction;
|
current.direction = current.direction;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//if (current.states.shooting) {
|
if (current.states.shooting) {
|
||||||
// m_animstate = Anim::SHOOTING;
|
m_animstate = Anim::SHOOTING;
|
||||||
//}
|
}
|
||||||
//else if (current.states.jumping) {
|
else if (current.states.jumping) {
|
||||||
// m_animstate = Anim::JUMPING;
|
m_animstate = Anim::JUMPING;
|
||||||
//}
|
}
|
||||||
//else if (current.states.dead) {
|
else if (current.states.dead) {
|
||||||
// m_animstate = Anim::DEAD;
|
m_animstate = Anim::DEAD;
|
||||||
//}
|
}
|
||||||
//else if(current.states.powerup){
|
else if(current.states.powerup){
|
||||||
// m_animstate = Anim::POWERUP;
|
m_animstate = Anim::POWERUP;
|
||||||
//}
|
}
|
||||||
//else if (current.states.still) {
|
else if (current.states.still) {
|
||||||
// m_animstate = Anim::STILL;
|
m_animstate = Anim::STILL;
|
||||||
//}
|
}
|
||||||
//else if (current.states.running) {
|
else if (current.states.running) {
|
||||||
// m_animstate = Anim::RUNNING;
|
m_animstate = Anim::RUNNING;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//previous.direction = current.direction;
|
previous.direction = current.direction;
|
||||||
//previous.position = current.position;
|
previous.position = current.position;
|
||||||
//previous.states = current.states;
|
previous.states = current.states;
|
||||||
//previous.id = current.id;
|
previous.id = current.id;
|
||||||
|
|
||||||
|
m_direction = current.direction;
|
||||||
|
m_position = current.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime)
|
void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user