Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/playerview.cc2
-rw-r--r--src/game/base/game.cc26
-rw-r--r--src/game/base/ship.cc19
-rw-r--r--src/game/base/ship.h24
-rw-r--r--src/game/base/shipmodel.cc10
-rw-r--r--src/game/base/shipmodel.h25
6 files changed, 73 insertions, 33 deletions
diff --git a/src/client/playerview.cc b/src/client/playerview.cc
index 90d33f7..e942924 100644
--- a/src/client/playerview.cc
+++ b/src/client/playerview.cc
@@ -50,7 +50,7 @@ PlayerView::PlayerView(ui::Widget *parent) : ui::Widget(parent)
view_homebutton = new ui::IconButton(this, "bitmaps/icons/button_home", "view main");
view_chatbutton = new ui::IconButton(this, "bitmaps/icons/button_chat", "ui_chat");
view_mapbutton = new ui::IconButton(this, "bitmaps/icons/button_map", "ui_map");
- view_inventorybutton = new ui::IconButton(this, "bitmaps/icons/button_inventory", "ui_inventory");
+ view_inventorybutton = new ui::IconButton(this, "bitmaps/icons/button_ship", "ui_inventory");
}
PlayerView::~PlayerView()
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 73fd9ad..7aa1081 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -423,11 +423,13 @@ void Game::func_specs(core::Player *player, const std::string &args)
sys::ConsoleInterface::instance()->set_rcon(true);
con_print << "Current ship specifications for " + ship->name() << std::endl;
- con_print << " mass = " << ship->shipmodel()->mass() << std::endl;
- con_print << " thrust = " << ship->thrust_force() << std::endl;
- con_print << " impulse = " << ship->impulse_force() << std::endl;
- con_print << " strafe = " << ship->strafe_force() << std::endl;
- con_print << " torque = " << ship->torque_force() << std::endl;
+ con_print << "cargo = " << ship->inventory()->capacity() << std::endl;
+ con_print << "mass = " << ship->shipmodel()->mass() << std::endl;
+ con_print << "thrust = " << ship->thrust_force() << std::endl;
+ con_print << "impulse = " << ship->impulse_force() << std::endl;
+ con_print << "strafe = " << ship->strafe_force() << std::endl;
+ con_print << "turn = " << ship->turn_force() << std::endl;
+ con_print << "roll = " << ship->roll_force() << std::endl;
// disable rcon buffering
sys::ConsoleInterface::instance()->set_rcon(false);
@@ -448,15 +450,23 @@ void Game::func_specs(core::Player *player, const std::string &args)
if (str.compare("thrust") == 0) {
ship->set_thrust_force(value);
msgstr << "Ship thrust force set to " << value;
+
} else if (str.compare("impulse") == 0) {
ship->set_impulse_force(value);
msgstr << "Ship impulse force set to " << value;
+
} else if (str.compare("strafe") == 0) {
ship->set_strafe_force(value) ;
msgstr << "Ship strafe force set to " << value;
- } else if (str.compare("torque") == 0) {
- ship->set_torque_force(value);
- msgstr << "Ship torque force set to " << value;
+
+ } else if (str.compare("turn") == 0) {
+ ship->set_turn_force(value);
+ msgstr << "Ship turn force set to " << value;
+
+ } else if (str.compare("roll") == 0) {
+ ship->set_roll_force(value);
+ msgstr << "Ship roll force set to " << value;
+
} else {
msgstr << "^WUnknown ship specification '" << str << "'";
}
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 0ac7461..641894e 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -78,7 +78,9 @@ Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable(
set_impulse_force(shipmodel->impulse_force());
set_thrust_force(shipmodel->thrust_force());
set_strafe_force(shipmodel->strafe_force());
- set_torque_force(shipmodel->torque_force());
+ set_turn_force(shipmodel->turn_force());
+ set_roll_force(shipmodel->roll_force());
+
reset();
const float linear_damp = 0.8f;
@@ -275,7 +277,8 @@ void Ship::action (btScalar seconds)
{
float maxspeed = 0;
float engine_force = 0;
- float torque_force = ship_torque_force;
+ float turn_force = ship_turn_force;
+ float roll_force = ship_roll_force;
btTransform t;
@@ -289,7 +292,8 @@ void Ship::action (btScalar seconds)
case core::Entity::Impulse:
engine_force = ship_impulse_force;
maxspeed = (Game::g_impulsespeed ? Game::g_impulsespeed->value() * 0.01f : 0.0f);
- torque_force *= .5f;
+ turn_force *= .5f;
+ roll_force *= .5f;
break;
case core::Entity::JumpInitiate:
@@ -321,7 +325,6 @@ void Ship::action (btScalar seconds)
get_axis().assign(t.getBasis());
const float torque_scale = 0.001f;
- const float roll_scale = 0.25f;
// apply strafe
body()->applyCentralImpulse(math::to_btVector3(axis().up() * current_target_vstrafe * ship_strafe_force));
@@ -335,11 +338,12 @@ void Ship::action (btScalar seconds)
}
// apply direction
- body()->applyTorqueImpulse(math::to_btVector3(axis().up() * current_target_direction * torque_force * torque_scale));
+ body()->applyTorqueImpulse(math::to_btVector3(axis().up() * current_target_direction * turn_force * torque_scale));
// apply pitch
- body()->applyTorqueImpulse(math::to_btVector3(axis().left() * -current_target_pitch * torque_force * torque_scale));
+ body()->applyTorqueImpulse(math::to_btVector3(axis().left() * -current_target_pitch * turn_force * torque_scale));
+
// apply roll
- body()->applyTorqueImpulse(math::to_btVector3(axis().forward() * -current_target_roll * torque_force * roll_scale * torque_scale));
+ body()->applyTorqueImpulse(math::to_btVector3(axis().forward() * -current_target_roll * roll_force* torque_scale));
// limit speed
entity_speed = (float) entity_body->getLinearVelocity().length();
@@ -348,6 +352,7 @@ void Ship::action (btScalar seconds)
body()->setLinearVelocity(math::to_btVector3(axis().forward() * entity_speed));
}
}
+
void Ship::frame(float seconds)
{
const float direction_reaction = 2.0f; // directional control reaction time
diff --git a/src/game/base/ship.h b/src/game/base/ship.h
index 971cb95..9da45f4 100644
--- a/src/game/base/ship.h
+++ b/src/game/base/ship.h
@@ -43,9 +43,14 @@ public:
return ship_strafe_force;
}
- /// torque force
- inline const float torque_force() const {
- return ship_torque_force;
+ /// turn force
+ inline const float turn_force() const {
+ return ship_turn_force;
+ }
+
+ /// roll force
+ inline const float roll_force() const {
+ return ship_roll_force;
}
/// physices frame
@@ -78,11 +83,15 @@ public:
ship_strafe_force = strafe;
}
- /// set torque force
- inline void set_torque_force(const float torque) {
- ship_torque_force = torque;
+ /// set turn force
+ inline void set_turn_force(const float turn) {
+ ship_turn_force = turn;
}
+ /// set roll force
+ inline void set_roll_force(const float roll) {
+ ship_roll_force = roll;
+ }
/// Initiate jump, departing from a jump point
void initiate_jump(JumpPoint *depart);
@@ -121,7 +130,8 @@ private:
float ship_impulse_force;
float ship_thrust_force;
float ship_strafe_force;
- float ship_torque_force;
+ float ship_turn_force;
+ float ship_roll_force;
};
}
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc
index cd69c5b..2b3f9d1 100644
--- a/src/game/base/shipmodel.cc
+++ b/src/game/base/shipmodel.cc
@@ -81,8 +81,11 @@ bool ShipModel::init()
} else if (shipsini.got_key_float("strafe", f)) {
shipmodel->set_strafe_force(f);
continue;
- } else if (shipsini.got_key_float("torque", f)) {
- shipmodel->set_torque_force(f);
+ } else if (shipsini.got_key_float("turn", f)) {
+ shipmodel->set_turn_force(f);
+ continue;
+ } else if (shipsini.got_key_float("roll", f)) {
+ shipmodel->set_roll_force(f);
continue;
} else if (shipsini.got_key_float("mass", f)) {
shipmodel->set_mass(f);
@@ -129,7 +132,8 @@ ShipModel::ShipModel() : core::Info(shipmodel_infotype)
shipmodel_thrust_force = 0.8f;
shipmodel_impulse_force = 4.0f;
shipmodel_strafe_force = 0.1f;
- shipmodel_torque_force = 2.5f;
+ shipmodel_turn_force = 2.5f;
+ shipmodel_roll_force = 1.0f;
shipmodel_maxcargo = 0.0f;
diff --git a/src/game/base/shipmodel.h b/src/game/base/shipmodel.h
index e90c59e..c7aa2ba 100644
--- a/src/game/base/shipmodel.h
+++ b/src/game/base/shipmodel.h
@@ -57,9 +57,14 @@ public:
return shipmodel_strafe_force;
}
- /// default torque force
- inline const float torque_force() const {
- return shipmodel_torque_force;
+ /// default turn force
+ inline const float turn_force() const {
+ return shipmodel_turn_force;
+ }
+
+ /// default turn force
+ inline const float roll_force() const {
+ return shipmodel_roll_force;
}
/// maximum thrust speed
@@ -95,11 +100,16 @@ public:
shipmodel_strafe_force = strafe;
}
- /// set torque force
- inline void set_torque_force(const float torque) {
- shipmodel_torque_force = torque;
+ /// set turn force
+ inline void set_turn_force(const float turn) {
+ shipmodel_turn_force = turn;
}
+ /// set roll force
+ inline void set_roll_force(const float roll) {
+ shipmodel_roll_force = roll;
+ }
+
/// set maximum speed
inline void set_maxspeed(const float maxspeed) {
shipmodel_maxspeed = maxspeed;
@@ -141,7 +151,8 @@ private:
float shipmodel_impulse_force;
float shipmodel_thrust_force;
float shipmodel_strafe_force;
- float shipmodel_torque_force;
+ float shipmodel_turn_force;
+ float shipmodel_roll_force;
float shipmodel_maxspeed;
float shipmodel_maxcargo;