diff options
| author | Stijn Buys <ingar@osirion.org> | 2011-07-12 14:26:09 +0000 | 
|---|---|---|
| committer | Stijn Buys <ingar@osirion.org> | 2011-07-12 14:26:09 +0000 | 
| commit | 8c3abbb3c04c6119b8f0ceb546c3aff66703ba14 (patch) | |
| tree | 975ff9f73ef7841763111a0e0dc7065e34e3cbf7 /src/core | |
| parent | bbbd41ccf4e7501e93689afecab442cb7e60a5de (diff) | |
Removed Entity::Complex flag: collision models will be used if availble,
removed a number of irrelevant comments.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/entity.cc | 11 | ||||
| -rw-r--r-- | src/core/entity.h | 2 | ||||
| -rw-r--r-- | src/core/parser.cc | 10 | 
3 files changed, 10 insertions, 13 deletions
| 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); | 
