diff options
author | Stijn Buys <ingar@osirion.org> | 2011-02-08 16:55:23 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-02-08 16:55:23 +0000 |
commit | 38eb51c26ab0d9dbebc974c7a21f96a429ce3098 (patch) | |
tree | 8563fdcf4de0d19ad20e660ae30b4b333825e4d4 /src/game/base | |
parent | 84dd93a63305bd3b1ff3c5c897a6f3e729bfefed (diff) |
Corrected triangle loading of collision model, added 'complex' flag to ships.ini
to enable collision models on player ships.
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/ship.cc | 4 | ||||
-rw-r--r-- | src/game/base/shipmodel.cc | 7 | ||||
-rw-r--r-- | src/game/base/shipmodel.h | 14 |
3 files changed, 24 insertions, 1 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index ef60e97..84b4e0a 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -374,8 +374,9 @@ void Ship::frame(float seconds) /* -- update state ----------------------------------------- */ // speed might be set to 0 on this update - if (entity_speed != 0.0f) + if (entity_speed != 0.0f) { set_dirty(); + } if (entity_state == core::Entity::Docked) { @@ -642,6 +643,7 @@ void Ship::frame(float seconds) */ EntityControlable::frame(seconds); + } } // namespace game diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc index 126557c..ec712ac 100644 --- a/src/game/base/shipmodel.cc +++ b/src/game/base/shipmodel.cc @@ -92,6 +92,9 @@ 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; @@ -212,6 +215,7 @@ ShipModel::ShipModel() : core::Info(shipmodel_infotype) shipmodel_jumpdrive = false; // no jumpdrive capability shipmodel_dockable = false; // not dockable shipmodel_template = 0; + shipmodel_complex_collision = false; } @@ -374,6 +378,9 @@ 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 f790bcd..a576c1d 100644 --- a/src/game/base/shipmodel.h +++ b/src/game/base/shipmodel.h @@ -80,6 +80,11 @@ 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; @@ -191,6 +196,13 @@ 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(); @@ -232,6 +244,8 @@ private: bool shipmodel_jumpdrive; bool shipmodel_dockable; + bool shipmodel_complex_collision; + const Template *shipmodel_template; /* --- static ----------------------------------------------------- */ |