diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-11 08:39:40 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-11 08:39:40 +0000 |
commit | fb227d62e699ebaea6e428f570bedc684873f15b (patch) | |
tree | 8a2a8e9ee4681479bcbd4828bdf7d6f76d5a1be1 | |
parent | 17e9ce54ee3972b9804174b874652ec0856efcd0 (diff) |
fix movement in local game, fix camera cockpit mode offset
-rw-r--r-- | osirion.kdevelop.pcs | bin | 655486 -> 655486 bytes | |||
-rw-r--r-- | osirion.kdevses | 28 | ||||
-rw-r--r-- | src/client/camera.cc | 4 | ||||
-rw-r--r-- | src/core/gameinterface.cc | 2 | ||||
-rw-r--r-- | src/core/gameserver.cc | 3 | ||||
-rw-r--r-- | src/game/ship.cc | 12 |
6 files changed, 18 insertions, 31 deletions
diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs Binary files differindex 96a6daf..aff14ba 100644 --- a/osirion.kdevelop.pcs +++ b/osirion.kdevelop.pcs diff --git a/osirion.kdevses b/osirion.kdevses index 20dfedd..1c4a484 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,28 +1,22 @@ <?xml version = '1.0' encoding = 'UTF-8'?> <!DOCTYPE KDevPrjSession> <KDevPrjSession> - <DocsAndViews NumberOfDocuments="7" > - <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/input.cc" > - <View0 Encoding="" Type="Source" /> + <DocsAndViews NumberOfDocuments="5" > + <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/camera.cc" > + <View0 Encoding="" line="203" Type="Source" /> </Doc0> - <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" > - <View0 Encoding="" line="59" Type="Source" /> + <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/render.cc" > + <View0 Encoding="" line="79" Type="Source" /> </Doc1> - <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameinterface.cc" > - <View0 Encoding="" Type="Source" /> + <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/draw.cc" > + <View0 Encoding="" line="517" Type="Source" /> </Doc2> - <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/math/functions.h" > - <View0 Encoding="" Type="Source" /> + <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/game/ship.cc" > + <View0 Encoding="" line="99" Type="Source" /> </Doc3> - <Doc4 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/game/ship.cc" > - <View0 Encoding="" Type="Source" /> + <Doc4 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameinterface.cc" > + <View0 Encoding="" line="162" Type="Source" /> </Doc4> - <Doc5 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/TODO" > - <View0 Encoding="" line="15" Type="Source" /> - </Doc5> - <Doc6 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/client.cc" > - <View0 Encoding="" line="0" Type="Source" /> - </Doc6> </DocsAndViews> <pluginList> <kdevdebugger> diff --git a/src/client/camera.cc b/src/client/camera.cc index c4a60b0..29310fc 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -179,7 +179,7 @@ void draw(float seconds) if (mode == Track) { if (core::localcontrol()->state() && core::localcontrol()->model()) { - target -= (core::localcontrol()->model()->maxbbox().x + 0.1f) * core::localcontrol()->state()->axis().forward(); + target -= (core::localcontrol()->model()->maxbbox().x + 0.15f) * core::localcontrol()->state()->axis().forward(); target += (core::localcontrol()->model()->maxbbox().z + 0.3f ) * core::localcontrol()->state()->axis().up(); @@ -208,7 +208,7 @@ void draw(float seconds) } else if (mode == Cockpit) { if (core::localcontrol()->state() && core::localcontrol()->model()) - target += core::localcontrol()->model()->maxbbox().x * + target += (core::localcontrol()->model()->maxbbox().x+0.05) * core::localcontrol()->state()->axis().forward(); distance = 0.0f; diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc index 5e2d428..1f4a5cd 100644 --- a/src/core/gameinterface.cc +++ b/src/core/gameinterface.cc @@ -186,7 +186,7 @@ void GameInterface::update_clientstate(float seconds) if (fabs(side) > 0.00005f) { cosangle = math::dotproduct(p, entity->state()->axis().forward()); - if (fabs(cosangle) < 0.99995f) { + if (fabs(cosangle) < 0.99995f) { angle = acos(cosangle) * 180.0f / M_PI; angle = math::sgnf(side) * angle * seconds / (core::game()->serverframetime() - core::game()->clientframetime()); diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index 3e5241e..5064ccd 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -245,6 +245,7 @@ void GameServer::frame(float seconds) return; server_time += seconds; + server_frametime += seconds; // process incoming network messages if (server_network) { @@ -263,8 +264,6 @@ void GameServer::frame(float seconds) update_clientstate(seconds); } - server_frametime += seconds; - if ((Cvar::sv_dedicated->value() || Cvar::sv_private->value())) { if (core::Cvar::sv_framerate->value()) { float f = 1.0f / core::Cvar::sv_framerate->value(); diff --git a/src/game/ship.cc b/src/game/ship.cc index 5c36205..e864aba 100644 --- a/src/game/ship.cc +++ b/src/game/ship.cc @@ -57,9 +57,7 @@ void Ship::frame(float seconds) current_target_pitch = target_pitch; } - if (fabs(seconds*current_target_pitch) < 0.00005f) { - current_target_pitch = 0.0f; - } else { + if (fabs(seconds*current_target_pitch) > 0.0f) { math::clamp(current_target_pitch, -1.0f, 1.0f); float pitch_offset = seconds * current_target_pitch; entity_axis.change_pitch(360.0f * ship_shipmodel->turnspeed() * pitch_offset); @@ -78,9 +76,7 @@ void Ship::frame(float seconds) current_target_direction = target_direction; } } - if (fabs(seconds*current_target_direction) < 0.00005f) { - current_target_direction = 0.0f; - } else { + if (fabs(seconds*current_target_direction) > 0.0f ) { math::clamp(current_target_direction, -1.0f, 1.0f); float direction_offset = seconds * current_target_direction; entity_axis.change_direction(360.0f * ship_shipmodel->turnspeed() * direction_offset); @@ -97,9 +93,7 @@ void Ship::frame(float seconds) if (current_target_roll < target_roll) current_target_roll = target_roll; } - if (fabs(current_target_roll) < 0.00005f) { - current_target_roll = 0.0f; - } else { + if (fabs(current_target_roll) > 0.0f) { math::clamp(current_target_roll, -1.0f, 1.0f); float roll_offset = seconds * current_target_roll; entity_axis.change_roll(360.0f * ship_shipmodel->turnspeed() * roll_offset); |