Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/example/spectator.cc')
-rw-r--r--src/game/example/spectator.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/game/example/spectator.cc b/src/game/example/spectator.cc
index 5fc7fc6..9ca9497 100644
--- a/src/game/example/spectator.cc
+++ b/src/game/example/spectator.cc
@@ -33,7 +33,7 @@ Spectator::~Spectator()
{
}
-void Spectator::frame(float elapsed)
+void Spectator::frame(const unsigned long elapsed)
{
// only update if necessary
if (!entity_speed && ! target_thrust && !target_direction && !target_pitch && !target_roll && !target_strafe && !target_afterburner)
@@ -41,9 +41,11 @@ void Spectator::frame(float elapsed)
// assign thrust value from input
entity_thrust = target_thrust;
+
+ const float seconds = (float) elapsed / 1000.0f;
// rotate according to input
- float rotation = g_spectatorrotation->value() * elapsed;
+ float rotation = g_spectatorrotation->value() * seconds;
get_axis().change_direction(target_direction * rotation);
get_axis().change_pitch(target_pitch * rotation);
get_axis().change_roll(target_roll * rotation);
@@ -54,14 +56,17 @@ void Spectator::frame(float elapsed)
// assign new location
if (entity_speed)
- get_location() += axis().forward() * entity_speed * elapsed;
+ get_location() += axis().forward() * entity_speed * seconds;
if (target_afterburner)
- get_location() += axis().forward() * maxspeed * target_afterburner * elapsed;
+ get_location() += axis().forward() * maxspeed * target_afterburner * seconds;
if (target_strafe)
- get_location() += axis().left() * maxspeed * target_strafe * elapsed;
+ get_location() += axis().left() * maxspeed * target_strafe * seconds;
+ if (target_vstrafe)
+ get_location() += axis().up() * maxspeed * target_vstrafe * seconds;
+
// set dirty flag
set_dirty();
}