diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-01-17 02:40:53 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-01-17 02:40:53 +0200 |
commit | 3891bc43e084b9bd1c345638dfbbffa9d71658c9 (patch) | |
tree | 1a32921c26409c735c062bfc8131b0c71728fadb /src/player.cpp | |
parent | 7068bc90af1f452359a1fcfe20fa01fc88f3d70a (diff) | |
download | minetest-3891bc43e084b9bd1c345638dfbbffa9d71658c9.tar.gz minetest-3891bc43e084b9bd1c345638dfbbffa9d71658c9.tar.bz2 minetest-3891bc43e084b9bd1c345638dfbbffa9d71658c9.zip |
fine-tuning of map generator and server and stuff.
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/player.cpp b/src/player.cpp index 3c06283a0..72e44f0e0 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -46,6 +46,20 @@ Player::~Player() // Y direction is ignored void Player::accelerate(v3f target_speed, f32 max_increase) { + v3f d_wanted = target_speed - m_speed; + d_wanted.Y = 0; + f32 dl_wanted = d_wanted.getLength(); + f32 dl = dl_wanted; + if(dl > max_increase) + dl = max_increase; + + v3f d = d_wanted.normalize() * dl; + + m_speed.X += d.X; + m_speed.Z += d.Z; + //m_speed += d; + +#if 0 // old code if(m_speed.X < target_speed.X - max_increase) m_speed.X += max_increase; else if(m_speed.X > target_speed.X + max_increase) @@ -63,6 +77,7 @@ void Player::accelerate(v3f target_speed, f32 max_increase) m_speed.Z = target_speed.Z; else if(m_speed.Z > target_speed.Z) m_speed.Z = target_speed.Z; +#endif } /* @@ -209,7 +224,7 @@ void LocalPlayer::move(f32 dtime, Map &map) position += m_speed * dtime; // Skip collision detection if player is non-local - if(isLocal() == false) + if(isLocal() == false || HAXMODE) { setPosition(position); return; @@ -286,10 +301,6 @@ void LocalPlayer::move(f32 dtime, Map &map) { // Doing nothing here will block the player from // walking over map borders - - // Go over borders in debug mode - if(HAXMODE) - continue; } core::aabbox3d<f32> nodebox = Map::getNodeBox( |