From d6e4c4e7c2b1e28961f1dfe2f25ef96ced60b21b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 17 Oct 2010 17:19:03 +0000 Subject: core bullet physics support, initial vstrafe support --- src/client/action.h | 1 + src/client/input.cc | 22 +++++++++++++++++++++- src/client/keyboard.cc | 16 +++++++++------- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'src/client') diff --git a/src/client/action.h b/src/client/action.h index 5d56bb9..6cb710b 100644 --- a/src/client/action.h +++ b/src/client/action.h @@ -25,6 +25,7 @@ public: Console, Left, Right, Up, Down, RollLeft, RollRight, + StrafeUp, StrafeDown, StrafeLeft, StrafeRight, ThrustUp, ThrustDown, Afterburner, Reverse, diff --git a/src/client/input.cc b/src/client/input.cc index 16ba048..d483f5d 100644 --- a/src/client/input.cc +++ b/src/client/input.cc @@ -52,6 +52,7 @@ float local_pitch = 0.0f; float local_thrust = 0.0f; float local_roll = 0.0f; float local_strafe = 0.0f; +float local_vstrafe = 0.0f; float local_afterburner = 0.0f; // last controlled entity @@ -375,7 +376,13 @@ void action_press(Key *key) case Action::StrafeRight: local_strafe = -1.0f; break; - + case Action::StrafeUp: + local_vstrafe = -1.0f; + break; + case Action::StrafeDown: + local_vstrafe = -1.0f; + break; + /* -- thruster ------------------------------------ */ case Action::ThrustUp: local_thrust += thruster_offset; @@ -456,6 +463,12 @@ void action_release(Key *key) case Action::StrafeRight: local_strafe = 0.0f; break; + case Action::StrafeUp: + local_vstrafe = 0.0f; + break; + case Action::StrafeDown: + local_vstrafe = 0.0f; + break; /* -- thruster ------------------------------------ */ case Action::ThrustUp: @@ -483,6 +496,8 @@ void action_release(Key *key) local_direction = 0.0f; local_pitch = 0.0f; local_roll = 0.0f; + local_vstrafe = 0.0f; + local_strafe = 0.0f; render::Camera::set_direction(0.0f); render::Camera::set_pitch(0.0f); @@ -660,6 +675,7 @@ void reset() local_direction = 0.0f; local_pitch = 0.0f; local_roll = 0.0f; + local_vstrafe = 0.0f; local_strafe = 0.0f; local_afterburner = 0.0f; @@ -897,6 +913,7 @@ void frame() core::localcontrol()->set_pitch(local_pitch / render::State::aspect()); core::localcontrol()->set_roll(local_roll); core::localcontrol()->set_strafe(local_strafe); + core::localcontrol()->set_vstrafe(local_vstrafe); core::localcontrol()->set_afterburner(local_afterburner); } else { @@ -904,6 +921,9 @@ void frame() local_direction = 0.0f; local_pitch = 0.0f; local_roll = 0.0f; + local_vstrafe = 0.0f; + local_strafe = 0.0f; + local_afterburner = 0.0f; render::Camera::set_direction(0.0f); render::Camera::set_pitch(0.0f); diff --git a/src/client/keyboard.cc b/src/client/keyboard.cc index e617c59..176e310 100644 --- a/src/client/keyboard.cc +++ b/src/client/keyboard.cc @@ -54,6 +54,8 @@ Keyboard::Keyboard() add_action("+strafeleft", Action::StrafeLeft, "strafe left"); add_action("+straferight", Action::StrafeRight, "strafe right"); + add_action("+strafeup", Action::StrafeUp, "strafe up"); + add_action("+strafedown", Action::StrafeDown, "strafe down"); add_action("+afterburner", Action::Afterburner, "afterburner"); add_action("+reverse", Action::Reverse, "reverse engine"); @@ -112,11 +114,11 @@ Keyboard::Keyboard() add_key("`", SDLK_BACKQUOTE, '`', "+console"); add_key("a", SDLK_a, 'a', "+strafeleft"); - add_key("b", SDLK_b, 'b'); + add_key("b", SDLK_b, 'b', "beam"); add_key("c", SDLK_c, 'c'); add_key("d", SDLK_d, 'd', "+straferight"); add_key("e", SDLK_e, 'e', "+rollright"); - add_key("f", SDLK_f, 'f'); + add_key("f", SDLK_f, 'f', "+strafedown"); add_key("g", SDLK_g, 'g'); add_key("h", SDLK_h, 'h'); add_key("i", SDLK_i, 'i'); @@ -130,7 +132,7 @@ Keyboard::Keyboard() add_key("o", SDLK_o, 'o'); add_key("p", SDLK_p, 'p'); add_key("q", SDLK_q, 'q', "+rollleft"); - add_key("r", SDLK_r, 'r'); + add_key("r", SDLK_r, 'r', "+strafeup"); add_key("s", SDLK_s, 's', "+reverse"); add_key("t", SDLK_t, 't', "ui_chatbar"); add_key("u", SDLK_u, 'u'); @@ -280,16 +282,16 @@ void Keyboard::save_binds() for (it = begin(); it != end(); it++) { Key *key = (*it).second; if (key->bind(Key::None).size()) { - ofs << "bind " << key->name() << " " << key->bind(Key::None) << std::endl; + ofs << "bind " << key->name() << " \"" << key->bind(Key::None) << '\"' << std::endl; } if (key->bind(Key::Shift).size()) { - ofs << "bind shift+" << key->name() << " " << key->bind(Key::Shift) << std::endl; + ofs << "bind shift+" << key->name() << " \"" << key->bind(Key::Shift) << '\"' << std::endl; } if (key->bind(Key::Ctrl).size()) { - ofs << "bind ctrl+" << key->name() << " " << key->bind(Key::Ctrl) << std::endl; + ofs << "bind ctrl+" << key->name() << " \"" << key->bind(Key::Ctrl) << '\"' << std::endl; } if (key->bind(Key::Alt).size()) { - ofs << "bind alt+" << key->name() << " " << key->bind(Key::Alt) << std::endl; + ofs << "bind alt+" << key->name() << " \"" << key->bind(Key::Alt) << '\"' << std::endl; } /* } else { -- cgit v1.2.3