diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/camera.cc | 4 | ||||
-rw-r--r-- | src/client/input.cc | 8 | ||||
-rw-r--r-- | src/client/view.cc | 23 |
3 files changed, 18 insertions, 17 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc index 8144781..808ff7e 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -179,8 +179,8 @@ void draw(float seconds) target_direction = core::localcontrol()->target_direction; pitch_target = core::localcontrol()->target_pitch; - yaw_target = - 45 * target_direction; - pitch_target = pitch_track -45 * target_pitch; + yaw_target = - 25 * target_direction; + pitch_target = pitch_track - 25 * target_pitch; } else if (mode == Free) { diff --git a/src/client/input.cc b/src/client/input.cc index 17ca724..fa23c1a 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -12,6 +12,7 @@ #include "client/camera.h" #include "client/keyboard.h" #include "client/video.h" +#include "math/functions.h" #include "render/text.h" #include "SDL/SDL.h" @@ -231,7 +232,7 @@ void frame(float seconds) break; case SDL_KEYDOWN: if (event.key.keysym.sym == '`' || event.key.keysym.sym == '~') { - last_control = 0; + //last_control = 0; console::toggle(); if (console::visible() && chat::visible()) @@ -298,8 +299,9 @@ void frame(float seconds) local_direction = mouse_direction; local_pitch = mouse_pitch; } else if (camera::mode == camera::Free) { - camera::set_direction(-mouse_direction); - camera::set_pitch(-mouse_pitch); + // squared values to smoothen camera movement + camera::set_direction( -mouse_direction * math::absf(mouse_direction)); + camera::set_pitch(-mouse_pitch * math::absf(mouse_pitch)); } } else { diff --git a/src/client/view.cc b/src/client/view.cc index 660930b..488a1cb 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -132,19 +132,18 @@ void draw_status() gl::color(1.0f, 1.0f, 1.0f, 1.0f); std::stringstream status; - int hours = (int) sys::time() / 3600; - int minutes = (int)(sys::time() - 3600*hours) / 60; - int seconds = (int)(sys::time() - 3600*hours - 60 *minutes); - status << "clock " << std::setfill('0') << std::setw(2) << hours << ":" - << std::setfill('0') << std::setw(2) << minutes << ":" - << std::setfill('0') << std::setw(2) << seconds; - - minutes = (int) floorf(core::application()->time() / 60.0f); - seconds = (int) floorf(core::application()->time() - (float) minutes* 60.0f); - - status << " time " << std::setfill('0') << std::setw(2) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds; + /* + int minutes = (int) floorf(core::application()->time() / 60.0f); + int seconds = (int) floorf(core::application()->time() - (float) minutes* 60.0f); + */ + + if (core::game()) { + int minutes = (int) floorf(core::game()->clientframetime() / 60.0f); + int seconds = (int) floorf( core::game()->clientframetime() - (float) minutes* 60.0f); - draw_text(CHARWIDTH, 4, status); + status << " time " << std::setfill('0') << std::setw(2) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds; + draw_text(CHARWIDTH, 4, status); + } // print stats if desired if (draw_stats && draw_stats->value()) { |