Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/action.h3
-rw-r--r--src/client/input.cc17
-rw-r--r--src/client/keyboard.cc4
-rw-r--r--src/client/targets.cc2
4 files changed, 23 insertions, 3 deletions
diff --git a/src/client/action.h b/src/client/action.h
index 6cb710b..00ef210 100644
--- a/src/client/action.h
+++ b/src/client/action.h
@@ -31,7 +31,8 @@ public:
Afterburner, Reverse,
Control,
CamLeft, CamRight, CamUp, CamDown,
- ZoomIn, ZoomOut,
+ ZoomIn, ZoomOut,
+ Fire
};
/// define a new action
diff --git a/src/client/input.cc b/src/client/input.cc
index 69be2ab..480ba61 100644
--- a/src/client/input.cc
+++ b/src/client/input.cc
@@ -56,6 +56,8 @@ float local_strafe = 0.0f;
float local_vstrafe = 0.0f;
float local_afterburner = 0.0f;
+int local_controlflags = core::EntityControlable::ControlFlagNone;
+
// last controlled entity
unsigned int last_control = 0;
@@ -432,6 +434,12 @@ void action_press(Key *key)
case Action::ZoomOut:
render::Camera::set_zoom(+0.1f);
break;
+
+ /* -- fire control -------------------------------- */
+
+ case Action::Fire:
+ local_controlflags = local_controlflags & core::EntityControlable::ControlFlagFire;
+ break;
}
}
@@ -529,6 +537,12 @@ void action_release(Key *key)
break;
case Action::ZoomOut:
break;
+
+ /* -- fire control -------------------------------- */
+
+ case Action::Fire:
+ local_controlflags = local_controlflags & ~core::EntityControlable::ControlFlagFire;
+ break;
}
}
@@ -683,6 +697,8 @@ void reset()
local_vstrafe = 0.0f;
local_strafe = 0.0f;
local_afterburner = 0.0f;
+
+ local_controlflags = core::EntityControlable::ControlFlagNone;
if (core::localcontrol()) {
local_thrust = core::localcontrol()->thrust();
@@ -900,6 +916,7 @@ void frame()
core::localcontrol()->set_strafe(local_strafe);
core::localcontrol()->set_vstrafe(local_vstrafe);
core::localcontrol()->set_afterburner(local_afterburner);
+ core::localcontrol()->set_control_flags(local_controlflags);
} else {
diff --git a/src/client/keyboard.cc b/src/client/keyboard.cc
index 62032b8..baef74c 100644
--- a/src/client/keyboard.cc
+++ b/src/client/keyboard.cc
@@ -61,6 +61,8 @@ Keyboard::Keyboard()
add_action("+reverse", Action::Reverse, "reverse engine");
add_action("+control", Action::Control, "enable mouse control while pressed");
+
+ add_action("+fire", Action::Fire, "fire weapons");
// ------------------ KEYS
Key *key = 0;
@@ -223,7 +225,7 @@ Keyboard::Keyboard()
// mouse button aliases
add_key("mouse1", 512 + SDL_BUTTON_LEFT, 0, "+control");
- add_key("mouse2", 512 + SDL_BUTTON_RIGHT);
+ add_key("mouse2", 512 + SDL_BUTTON_RIGHT, 0, "+fire");
add_key("mouse3", 512 + SDL_BUTTON_MIDDLE);
add_key("mouse4", 512 + SDL_BUTTON_WHEELUP, 0, "+thrustup");
diff --git a/src/client/targets.cc b/src/client/targets.cc
index bd0ea48..c3b618d 100644
--- a/src/client/targets.cc
+++ b/src/client/targets.cc
@@ -329,7 +329,7 @@ void frame()
cursor -= render::Camera::axis().left() * x;
cursor -= render::Camera::axis().up() * y;
- math::Vector3f center = render::Camera::eye() + (render::Camera::axis().forward() * (render::FRUSTUMFRONT + 0.001f));
+ //math::Vector3f center = render::Camera::eye() + (render::Camera::axis().forward() * (render::FRUSTUMFRONT + 0.001f));
for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
core::Entity *entity = (*it);