Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-12 14:26:09 +0000
committerStijn Buys <ingar@osirion.org>2011-07-12 14:26:09 +0000
commit8c3abbb3c04c6119b8f0ceb546c3aff66703ba14 (patch)
tree975ff9f73ef7841763111a0e0dc7065e34e3cbf7
parentbbbd41ccf4e7501e93689afecab442cb7e60a5de (diff)
Removed Entity::Complex flag: collision models will be used if availble,
removed a number of irrelevant comments.
-rw-r--r--ChangeLog2
-rw-r--r--src/core/entity.cc11
-rw-r--r--src/core/entity.h2
-rw-r--r--src/core/parser.cc10
-rw-r--r--src/game/base/game.cc12
-rw-r--r--src/game/base/jumppoint.cc2
-rw-r--r--src/game/base/racetrack.cc3
-rw-r--r--src/game/base/shipmodel.cc7
-rw-r--r--src/game/base/shipmodel.h14
9 files changed, 21 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 157f8a7..57cc8d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,7 +13,7 @@
data revision 644
- corrected submodel instancing
- - removed mous control deadzone
+ - removed mouse control deadzone
- restore previous thruster setting when dropping from impulse speed
- updated universe and improved models
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 84f4de0..da94896 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -550,7 +550,7 @@ void Entity::reset()
if (model() && model()->radius()) {
const float modelscale = radius() / model()->radius();
- if (flag_is_set(Complex) && model()->collisionmodel() && model()->collisionmodel()->size()) {
+ if (model()->collisionmodel() && model()->collisionmodel()->size()) {
// complex collision is enabled and a valid collision model has been found
btCompoundShape *compoundshape = new btCompoundShape();
@@ -571,7 +571,8 @@ void Entity::reset()
meshshape->buildOptimizedBvh();
meshshape->recalcLocalAabb();
- // apply collision mesh properties to the btCollisionShape
+ // apply collision mesh properties to the btCollisionShape
+ // FIXME this goes wrong with rotated entities (see alexandria)
btTransform child_transform;
child_transform.setIdentity();
child_transform.setOrigin(to_btVector3(mesh->location() * modelscale));
@@ -681,7 +682,7 @@ void EntityDynamic::reset()
if (model() && model()->radius()) {
const float modelscale = radius() / model()->radius();
- if (flag_is_set(Complex) && model()->collisionmodel() && model()->collisionmodel()->size()) {
+ if (model()->collisionmodel() && model()->collisionmodel()->size()) {
// complex collision is enabled and a valid collision model has been found
btCompoundShape *compoundshape = new btCompoundShape();
for (model::CollisionModel::CollisionMeshes::iterator it = model()->collisionmodel()->meshes().begin();
@@ -1143,8 +1144,8 @@ void EntityControlable::reset()
if (model() && model()->radius()) {
const float modelscale = radius() / model()->radius();
- if (flag_is_set(Complex) && model()->collisionmodel() && model()->collisionmodel()->size()) {
- // complex collision is enabled and a valid collision model has been found
+ if (model()->collisionmodel() && model()->collisionmodel()->size()) {
+ // a valid collision model has been found
btCompoundShape *compoundshape = new btCompoundShape();
for (model::CollisionModel::CollisionMeshes::iterator it = model()->collisionmodel()->meshes().begin();
it != model()->collisionmodel()->meshes().end(); it++) {
diff --git a/src/core/entity.h b/src/core/entity.h
index 164f746..94cd09f 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -44,7 +44,7 @@ public:
/**
* @brief entity flags
*/
- enum Flags {NonSolid = 2, Bright = 4, Dockable = 8, ShowOnMap = 16, KeepAlive = 32, Complex = 64};
+ enum Flags {NonSolid = 2, Bright = 4, Dockable = 8, ShowOnMap = 16, KeepAlive = 32};
/// Entity type constants
enum Type {Default = 0, Dynamic = 1, Controlable = 2, Globe = 3};
diff --git a/src/core/parser.cc b/src/core/parser.cc
index b210cdd..984d403 100644
--- a/src/core/parser.cc
+++ b/src/core/parser.cc
@@ -13,6 +13,9 @@ namespace core
bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
{
+ if (!entity)
+ return false;
+
math::Vector3f v;
math::Color color;
@@ -72,13 +75,6 @@ bool Parser::got_entity_key(filesystem::IniFile &inifile, core::Entity *entity)
entity->unset_flag(Entity::ShowOnMap);
return true;
- } else if (inifile.got_key_bool("complex", blnval)) {
- if (blnval)
- entity->set_flag(Entity::Complex);
- else
- entity->unset_flag(Entity::Complex);
- return true;
-
} else if (inifile.got_key_bool("nonsolid", blnval)) {
if (blnval)
entity->set_flag(Entity::NonSolid);
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 5639e20..2d25993 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -1160,6 +1160,7 @@ bool Game::load_zone(core::Zone *zone)
jumppoint = new JumpGate();
entity = jumppoint;
jumppoint->set_zone(zone);
+ jumppoint->set_radius(0);
count ++;
} else if (zoneini.got_section("jumppoint")) {
@@ -1175,12 +1176,16 @@ bool Game::load_zone(core::Zone *zone)
racetrack->set_radius(0);
} else if (zoneini.got_section("checkpoint")) {
- checkpoint = new CheckPoint(racetrack);
- entity = checkpoint;
+
if (!racetrack) {
zoneini.unknown_error("checkpoint without racetrack");
+ entity = 0;
+ checkpoint = 0;
+ } else {
+ checkpoint = new CheckPoint(racetrack);
+ entity = checkpoint;
+ checkpoint->set_radius(0);
}
- checkpoint->set_radius(0);
} else if (zoneini.got_section("planet")) {
planet = new Planet();
@@ -1533,7 +1538,6 @@ bool Game::generate_entity_menus(core::Entity *entity)
using core::ButtonDescription;
if ((entity->moduletype() != planet_enttype) && (entity->moduletype() != station_enttype)) {
- //con_warn << "Can not generate menus for entity '" << entity->label() << "'" << std::endl;
// not dockable
return false;
}
diff --git a/src/game/base/jumppoint.cc b/src/game/base/jumppoint.cc
index 08c7e67..6542b84 100644
--- a/src/game/base/jumppoint.cc
+++ b/src/game/base/jumppoint.cc
@@ -20,6 +20,7 @@ JumpPoint::JumpPoint() : core::EntityDynamic()
// FIXME jumppoints should be harder to find
set_flag(core::Entity::ShowOnMap);
+ set_flag(core::Entity::NonSolid);
get_color().assign(0.0f, 0.8f, 0.8f, 1.0f);
get_color_second().assign(0.6f, 1.0f);
@@ -108,6 +109,7 @@ JumpGate::JumpGate() : JumpPoint()
{
entity_moduletypeid = jumpgate_enttype;
unset_flag(core::Entity::Bright);
+ unset_flag(core::Entity::NonSolid);
set_flag(core::Entity::ShowOnMap);
set_radius(0.0f);
set_state(core::Entity::NoPower);
diff --git a/src/game/base/racetrack.cc b/src/game/base/racetrack.cc
index 8d63552..5191711 100644
--- a/src/game/base/racetrack.cc
+++ b/src/game/base/racetrack.cc
@@ -28,8 +28,6 @@ CheckPoint::CheckPoint(RaceTrack *parent)
} else {
die();
}
-
- //set_flag(core::Entity::NonSolid);
}
CheckPoint::~CheckPoint()
@@ -50,7 +48,6 @@ RaceTrack::RaceTrack() : EntityDynamic()
set_state(core::Entity::NoPower);
set_flag(core::Entity::Dockable);
- //set_flag(core::Entity::NonSolid);
}
RaceTrack::~RaceTrack()
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc
index 85efcc1..ec3259d 100644
--- a/src/game/base/shipmodel.cc
+++ b/src/game/base/shipmodel.cc
@@ -92,9 +92,6 @@ bool ShipModel::init()
} else if (inifile.got_key_bool("dock", b)) {
shipmodel->set_dockable(b);
continue;
- } else if (inifile.got_key_bool("complex", b)) {
- shipmodel->set_complex_collision(b);
- continue;
} else if (inifile.got_key_float("maxspeed", f)) {
shipmodel->set_maxspeed(f * 0.01f);
continue;
@@ -215,7 +212,6 @@ ShipModel::ShipModel() : core::Info(shipmodel_infotype)
shipmodel_jumpdrive = false; // no jumpdrive capability
shipmodel_dockable = false; // not dockable
shipmodel_template = 0;
- shipmodel_complex_collision = false;
}
@@ -378,9 +374,6 @@ void ShipModel::apply(core::Entity *entity) const
if (radius())
entity->set_radius(radius());
-
- if (complex_collision())
- entity->set_flag(core::Entity::Complex);
}
void ShipModel::apply(Ship *ship) const
diff --git a/src/game/base/shipmodel.h b/src/game/base/shipmodel.h
index a576c1d..f790bcd 100644
--- a/src/game/base/shipmodel.h
+++ b/src/game/base/shipmodel.h
@@ -80,11 +80,6 @@ public:
return shipmodel_angular_damping;
}
- /// complex collision
- inline const bool complex_collision() const {
- return shipmodel_complex_collision;
- }
-
/// maximum thrust speed
inline const float maxspeed() const {
return shipmodel_maxspeed;
@@ -196,13 +191,6 @@ protected:
shipmodel_angular_damping = angular_damping;
}
- /**
- * @brief enable collision mesh
- */
- inline void set_complex_collision(const float complex_collision) {
- shipmodel_complex_collision = complex_collision;
- }
-
public:
void generate_info();
@@ -244,8 +232,6 @@ private:
bool shipmodel_jumpdrive;
bool shipmodel_dockable;
- bool shipmodel_complex_collision;
-
const Template *shipmodel_template;
/* --- static ----------------------------------------------------- */