aboutsummaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-01-16 19:32:14 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-01-16 19:32:14 +0200
commit7068bc90af1f452359a1fcfe20fa01fc88f3d70a (patch)
tree43ecf753c1e178cfc29ce4f736d77897a340ed44 /src/player.cpp
parent69e7cd9b5b36783ec83a663789a95a3c512809c4 (diff)
downloadminetest-7068bc90af1f452359a1fcfe20fa01fc88f3d70a.tar.gz
minetest-7068bc90af1f452359a1fcfe20fa01fc88f3d70a.tar.bz2
minetest-7068bc90af1f452359a1fcfe20fa01fc88f3d70a.zip
Initial commit of mapgen v.2. Lacks configuration and saving to disk.
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/src/player.cpp b/src/player.cpp
index 37fcda991..3c06283a0 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -286,6 +286,10 @@ 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(
@@ -374,14 +378,33 @@ void LocalPlayer::applyControl(float dtime)
v3f speed = v3f(0,0,0);
+ if(HAXMODE)
+ {
+ v3f speed = getSpeed();
+ speed.Y = 0;
+ setSpeed(speed);
+ }
+
// Superspeed mode
bool superspeed = false;
if(control.superspeed)
{
- speed += move_direction;
- superspeed = true;
+ if(HAXMODE)
+ {
+ v3f speed = getSpeed();
+ speed.Y = -20*BS;
+ setSpeed(speed);
+ }
+ else
+ {
+ speed += move_direction;
+ superspeed = true;
+ }
}
+ if(HAXMODE)
+ superspeed = true;
+
if(control.up)
{
speed += move_direction;
@@ -400,7 +423,16 @@ void LocalPlayer::applyControl(float dtime)
}
if(control.jump)
{
- if(touching_ground)
+ if(HAXMODE)
+ {
+ v3f speed = getSpeed();
+ /*speed.Y += 20.*BS * dtime * 2;
+ if(speed.Y < 0)
+ speed.Y = 0;*/
+ speed.Y = 20*BS;
+ setSpeed(speed);
+ }
+ else if(touching_ground)
{
v3f speed = getSpeed();
speed.Y = 6.5*BS;
@@ -421,7 +453,10 @@ void LocalPlayer::applyControl(float dtime)
speed = speed.normalize() * walkspeed_max;
f32 inc = walk_acceleration * BS * dtime;
-
+
+ if(HAXMODE)
+ inc = walk_acceleration * BS * dtime * 10;
+
// Accelerate to target speed with maximum increment
accelerate(speed, inc);
}