From d6ee7ec642cc6b3097c8d321a1a00630e24027d1 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 16 Feb 2008 12:22:33 +0000 Subject: initial client-to-server connection --- src/client/camera.cc | 12 ++++++------ src/client/client.cc | 2 +- src/client/console.cc | 2 +- src/client/input.cc | 12 ++++++------ src/client/video.cc | 2 +- src/client/view.cc | 8 ++++---- 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/client') diff --git a/src/client/camera.cc b/src/client/camera.cc index f274e12..d0f25f3 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -82,7 +82,7 @@ void set_mode(Mode newmode) { case Track: // switch camera to Track mode mode = Track; - yaw_target = core::localplayer.controled->direction; + yaw_target = core::localplayer.control->direction; yaw_current = yaw_target; pitch_target = pitch_track; pitch_current = pitch_target; @@ -91,7 +91,7 @@ void set_mode(Mode newmode) { case Free: // switch camera to Free mode mode = Free; - yaw_target = core::localplayer.controled->direction; + yaw_target = core::localplayer.control->direction; yaw_current = yaw_target; pitch_target = pitch_track; pitch_current = pitch_target; @@ -112,7 +112,7 @@ void set_mode(Mode newmode) { void next_mode() { - if (!core::localplayer.controled) { + if (!core::localplayer.control) { set_mode(Overview); return; } @@ -133,7 +133,7 @@ void next_mode() void draw(float elapsed) { - if (!core::localplayer.controled) { + if (!core::localplayer.control) { // switch the camera to Overview of the player is not controling anything if (mode != Overview) { set_mode(Overview); @@ -142,11 +142,11 @@ void draw(float elapsed) if (mode == Overview) set_mode(Track); - camera::target = core::localplayer.controled->location; + camera::target = core::localplayer.control->location; } if (mode == Track) { - yaw_target = core::localplayer.controled->direction; + yaw_target = core::localplayer.control->direction; } if ((mode == Free) || (mode == Track)) { diff --git a/src/client/client.cc b/src/client/client.cc index 214ba2f..407fb5a 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -83,7 +83,7 @@ void Client::init() con_print << "Initializing client..." << std::endl; // initialize core - core::sv_dedicated = core::cvar::get("sv_dedicated", "0", core::cvar::ReadOnly); + core::sv_dedicated = core::cvar::set("sv_dedicated", "0", core::cvar::ReadOnly); core::Application::init(); // initialize SDL, but do not initialize any subsystems diff --git a/src/client/console.cc b/src/client/console.cc index c59f477..c352969 100644 --- a/src/client/console.cc +++ b/src/client/console.cc @@ -168,7 +168,7 @@ void draw() draw_text(CHARWIDTH, video::height*con_height - CHARHEIGHT - 4, (*history_pos)); // draw cursor - if ((core::time() - ::floorf(core::time())) < 0.5f) { + if ((core::application()->time() - ::floorf(core::application()->time())) < 0.5f) { std::string cursor("_"); draw_text(CHARWIDTH*(input_pos+1), video::height*con_height - CHARHEIGHT - 4 , cursor); } diff --git a/src/client/input.cc b/src/client/input.cc index 17c52bb..ee16038 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -63,11 +63,11 @@ void keypressed(const SDL_keysym &keysym) break; case SDLK_KP_PLUS: // TODO set core entity params - core::localplayer.controled->target_thrust += 0.08f; + core::localplayer.control->target_thrust += 0.08f; break; case SDLK_KP_MINUS: // TODO set core entity params - core::localplayer.controled->target_thrust -= 0.1f; + core::localplayer.control->target_thrust -= 0.1f; break; case SDLK_KP4: // TODO set core entity params @@ -95,7 +95,7 @@ void frame(float seconds) switch (event.type) { case SDL_KEYUP: - if (!console::visible() && core::connected() && core::localplayer.controled) + if (!console::visible() && core::application()->connected() && core::localplayer.control) // send key events to the game world keyreleased(event.key.keysym); break; @@ -105,7 +105,7 @@ void frame(float seconds) } else if (console::visible()) { // send key events to the console console::keypressed(event.key.keysym); - } else if (core::connected() && core::localplayer.controled) { + } else if (core::application()->connected() && core::localplayer.control) { // send key events to the game world keypressed(event.key.keysym); } @@ -117,8 +117,8 @@ void frame(float seconds) } - if (!console::visible() && core::connected() && core::localplayer.controled) { - core::localplayer.controled->target_direction = math::degrees360f(core::localplayer.controled->direction+turn_offset); + if (!console::visible() && core::application()->connected() && core::localplayer.control) { + core::localplayer.control->target_direction = math::degrees360f(core::localplayer.control->direction+turn_offset); } } diff --git a/src/client/video.cc b/src/client/video.cc index 1a1f5e2..b441e67 100644 --- a/src/client/video.cc +++ b/src/client/video.cc @@ -54,7 +54,7 @@ bool init() // initialize cvars r_width = core::cvar::get("r_width", width_default); r_height = core::cvar::get("r_height", height_default); - r_fullscreen = core::cvar::get("r_fullscreen", 1); + r_fullscreen = core::cvar::get("r_fullscreen", "0"); int bpp = 0; int flags = 0; diff --git a/src/client/view.cc b/src/client/view.cc index 5c54587..0c8e26b 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -108,8 +108,8 @@ void draw_status() << std::setfill('0') << std::setw(2) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds; - minutes = (int) floorf(core::time() / 60.0f); - seconds = (int) floorf(core::time() - (float) minutes* 60.0f); + 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; status << " fps " << std::setw(4) << fps; @@ -137,7 +137,7 @@ void frame(float seconds) // Clear the color and depth buffers. gl::clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - if (core::connected()) { + if (core::application()->connected()) { // draw the game world // Change to the projection matrix and set our viewing volume. @@ -171,7 +171,7 @@ void frame(float seconds) gl::matrixmode(GL_MODELVIEW); gl::loadidentity(); - if (!core::connected()) { + if (!core::application()->connected()) { // draw the loader bitmap draw_loader(); gl::enable(GL_BLEND); // enable alpha blending -- cgit v1.2.3