From fb227d62e699ebaea6e428f570bedc684873f15b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 11 May 2008 08:39:40 +0000 Subject: fix movement in local game, fix camera cockpit mode offset --- osirion.kdevelop.pcs | Bin 655486 -> 655486 bytes osirion.kdevses | 28 +++++++++++----------------- src/client/camera.cc | 4 ++-- src/core/gameinterface.cc | 2 +- src/core/gameserver.cc | 3 +-- src/game/ship.cc | 12 +++--------- 6 files changed, 18 insertions(+), 31 deletions(-) diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs index 96a6daf..aff14ba 100644 Binary files a/osirion.kdevelop.pcs and b/osirion.kdevelop.pcs differ diff --git a/osirion.kdevses b/osirion.kdevses index 20dfedd..1c4a484 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,28 +1,22 @@ - - - + + + - - + + - - + + - - + + - - + + - - - - - - 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); -- cgit v1.2.3