Changeset 6142 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Dec 16, 2005, 7:13:57 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/environment.cc
r5994 r6142 62 62 { 63 63 this->setClassID(CL_ENVIRONMENT, "Environment"); 64 this->toList(OM_ENVIRON); 64 65 } 65 66 -
trunk/src/world_entities/npcs/npc.cc
r6054 r6142 33 33 { 34 34 this->setClassID(CL_NPC, "NPC"); 35 35 this->toList(OM_GROUP_00); 36 36 } 37 37 … … 50 50 WorldEntity* powerUp = new TurretPowerUp(); 51 51 powerUp->setAbsCoor(this->getAbsCoor()); 52 State::getWorldEntityList()->add(powerUp);52 // powerUp->toList(OM_COMMON); 53 53 } 54 54 else if ((float)rand()/RAND_MAX < .3) … … 56 56 WorldEntity* powerUp = new LaserPowerUp(); 57 57 powerUp->setAbsCoor(this->getAbsCoor()); 58 State::getWorldEntityList()->add(powerUp);58 powerUp->toList(OM_COMMON); 59 59 } 60 State::getWorldEntityList()->remove(this);60 this->toList(OM_DEAD); 61 61 this->removeNode(); 62 62 … … 68 68 { 69 69 this->setVisibiliy(false); 70 State::getWorldEntityList()->remove(this);70 this->toList(OM_DEAD); 71 71 this->removeNode(); 72 72 } -
trunk/src/world_entities/playable.cc
r5915 r6142 46 46 PRINTF(4)("PLAYABLE INIT\n"); 47 47 48 this->toList(OM_GROUP_01); 48 49 this->weaponMan = new WeaponManager(this); 49 50 -
trunk/src/world_entities/power_ups/laser_power_up.cc
r6113 r6142 80 80 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 81 81 if (entity->isA(CL_PLAYABLE)) 82 State::getWorldEntityList()->remove(this);82 this->toList(OM_DEAD); 83 83 } 84 84 -
trunk/src/world_entities/power_ups/power_up.cc
r6113 r6142 38 38 { 39 39 delete this->sphereMaterial; 40 this->toList(OM_COMMON); 40 41 } 41 42 -
trunk/src/world_entities/power_ups/turret_power_up.cc
r6113 r6142 80 80 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 81 81 if (entity->isA(CL_PLAYABLE)) 82 State::getWorldEntityList()->remove(this);82 this->toList(OM_DEAD); 83 83 } 84 84 -
trunk/src/world_entities/skybox.cc
r6022 r6142 65 65 { 66 66 this->setClassID(CL_SKYBOX, "SkyBox"); 67 67 this->toList(OM_ENVIRON_NOTICK); 68 68 this->size = 100.0; 69 69 -
trunk/src/world_entities/skysphere.cc
r5511 r6142 42 42 { 43 43 this->setClassID(CL_SKYSPHERE, "SkySphere"); 44 44 this->toList(OM_ENVIRON_NOTICK); 45 45 if (fileName == NULL) 46 46 this->initialize("pictures/sky-replace.jpg"); -
trunk/src/world_entities/terrain.cc
r6022 r6142 93 93 { 94 94 this->setClassID(CL_TERRAIN, "Terrain"); 95 this->toList(OM_ENVIRON_NOTICK); 95 96 96 97 this->objectList = 0; -
trunk/src/world_entities/test_entity.cc
r5994 r6142 33 33 { 34 34 this->setClassID(CL_TEST_ENTITY, "TestEntity"); 35 // TO SOME LIST!! 35 36 36 37 this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx"); … … 70 71 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 71 72 this->setVisibiliy(false); 72 State::getWorldEntityList()->remove(this);73 this->toList(OM_DEAD); 73 74 } 74 75 } -
trunk/src/world_entities/weapons/aim.cc
r6078 r6142 104 104 void Aim::searchTarget(float range) 105 105 { 106 tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator(); 106 //FIXME// 107 /* tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator(); 107 108 WorldEntity* entity = iterator->firstElement(); 108 109 while (likely(entity != NULL)) … … 121 122 } 122 123 123 delete iterator; 124 delete iterator;*/ 124 125 } 125 126 -
trunk/src/world_entities/weapons/bomb.cc
r5994 r6142 174 174 void Bomb::activate() 175 175 { 176 State::getWorldEntityList()->add(this);177 176 178 177 } … … 180 179 void Bomb::deactivate() 181 180 { 182 State::getWorldEntityList()->remove(this);181 this->toList(OM_DEAD); 183 182 this->lifeCycle = 0.0f; 184 183 Bomb::fastFactory->kill(this); -
trunk/src/world_entities/weapons/ground_turret.cc
r5994 r6142 89 89 { 90 90 this->left->setParent(this); 91 this->left->toList(this->getOMListNumber()); 91 92 this->left->setRelCoor(0,10,-5); 92 93 } … … 98 99 { 99 100 this->right->setParent(this); 101 this->right->toList(this->getOMListNumber()); 100 102 this->right->setRelCoor(0,10,5); 101 103 } -
trunk/src/world_entities/weapons/guided_missile.cc
r6078 r6142 85 85 void GuidedMissile::activate() 86 86 { 87 State::getWorldEntityList()->add(this);88 87 if (unlikely(GuidedMissile::trailParticles == NULL)) 89 88 { … … 129 128 this->lifeCycle = 0.0; 130 129 131 // GarbageCollector::getInstance()->collect(this); 132 State::getWorldEntityList()->remove(this); 130 this->toList(OM_DEAD); 133 131 this->removeNode(); 134 132 GuidedMissile::fastFactory->kill(this); … … 152 150 if (this->target != NULL && this->target->getParent() != PNode::getNullParent()) 153 151 { 154 printf("========%s::%s\n", target->getParent()->getClassName(), target->getParent()->getName() );155 152 velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility; 156 153 float speed = velocity.len(); -
trunk/src/world_entities/weapons/laser.cc
r6056 r6142 77 77 void Laser::activate() 78 78 { 79 State::getWorldEntityList()->add(this);80 79 if (unlikely(Laser::explosionParticles == NULL)) 81 80 { … … 98 97 this->lifeCycle = 0.0; 99 98 100 // GarbageCollector::getInstance()->collect(this); 101 State::getWorldEntityList()->remove(this); 99 this->toList(OM_NULL); 102 100 this->removeNode(); 103 101 Laser::fastFactory->kill(this); … … 134 132 this->lifeCycle = .95; //!< @todo calculate this usefully. 135 133 ParticleEngine::getInstance()->addConnection(this->emitter, Laser::explosionParticles); 136 137 134 } 138 135 -
trunk/src/world_entities/weapons/projectile.cc
r6078 r6142 22 22 #include "weapon.h" 23 23 #include "model.h" 24 25 #include "garbage_collector.h"26 24 27 25 using namespace std; -
trunk/src/world_entities/weapons/rocket.cc
r6056 r6142 82 82 void Rocket::activate() 83 83 { 84 State::getWorldEntityList()->add(this);85 84 if (unlikely(Rocket::trailParticles == NULL)) 86 85 { … … 125 124 ParticleEngine::getInstance()->breakConnections(this->emitter); 126 125 this->lifeCycle = 0.0; 126 this->toList(OM_NULL); 127 127 128 128 // GarbageCollector::getInstance()->collect(this); 129 State::getWorldEntityList()->remove(this);129 this->toList(OM_DEAD); 130 130 Rocket::fastFactory->kill(this); 131 131 } -
trunk/src/world_entities/weapons/test_bullet.cc
r5994 r6142 82 82 void TestBullet::activate() 83 83 { 84 State::getWorldEntityList()->add(this);85 84 if (unlikely(TestBullet::trailParticles == NULL)) 86 85 { … … 119 118 ParticleEngine::getInstance()->breakConnections(this->emitter); 120 119 this->lifeCycle = 0.0; 120 this->toList(OM_NULL); 121 121 122 // GarbageCollector::getInstance()->collect(this);123 State::getWorldEntityList()->remove(this);124 122 TestBullet::fastFactory->kill(this); 125 123 } -
trunk/src/world_entities/weapons/weapon.cc
r6054 r6142 192 192 { 193 193 if (likely (this->projectileFactory != NULL)) 194 return dynamic_cast<Projectile*>(this->projectileFactory->resurrect()); 194 { 195 Projectile* pj = dynamic_cast<Projectile*>(this->projectileFactory->resurrect()); 196 pj->toList((OM_LIST)(this->getOMListNumber()+1)); 197 return pj; 198 } 195 199 else 196 200 { -
trunk/src/world_entities/weapons/weapon_manager.cc
r6074 r6142 35 35 * @param number of weapon slots of the model/ship <= 8 (limitied) 36 36 */ 37 WeaponManager::WeaponManager( PNode* parent)37 WeaponManager::WeaponManager(WorldEntity* parent) 38 38 { 39 39 this->init(); … … 155 155 * a PNode. 156 156 */ 157 void WeaponManager::setParent(PNode* parent) 158 { 159 if (parent == NULL) 160 parent = PNode::getNullParent(); 157 void WeaponManager::setParent(WorldEntity* parent) 158 { 161 159 this->parent = parent; 162 160 if (this->parent != NULL) … … 247 245 this->configs[configID][slotID] = weapon; 248 246 if (this->parent != NULL) 249 weapon->setParent(parent); 247 { 248 this->parent->addChild(weapon); 249 } 250 250 PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID); 251 251 } … … 373 373 else 374 374 { 375 if (this->currentSlotConfig[i].currentWeapon != NULL) 376 this->currentSlotConfig[i].currentWeapon->toList(OM_NULL); 375 377 tickWeapon = this->currentSlotConfig[i].currentWeapon = this->currentSlotConfig[i].nextWeapon; 376 378 if (tickWeapon != NULL) … … 378 380 tickWeapon->requestAction(WA_ACTIVATE); 379 381 tickWeapon->setParent(&this->currentSlotConfig[i].position); 382 tickWeapon->toList(this->parent->getOMListNumber()); 380 383 this->currentSlotConfig[i].position.activateNode(); 381 384 } -
trunk/src/world_entities/weapons/weapon_manager.h
r6055 r6142 45 45 46 46 public: 47 WeaponManager( PNode* parent);47 WeaponManager(WorldEntity* parent); 48 48 WeaponManager(const TiXmlElement* root); 49 49 ~WeaponManager(); … … 63 63 long getSlotCapability(int slot) const { return this->currentSlotConfig[slot].capability; }; 64 64 65 void setParent( PNode* parent);65 void setParent(WorldEntity* parent); 66 66 /** @returns the Parent (carrier) of this WeaponManager */ 67 67 PNode* getParent() const { return this->parent; }; … … 93 93 94 94 private: 95 PNode*parent; //!< The parent, this WeaponManager is connected to.95 WorldEntity* parent; //!< The parent, this WeaponManager is connected to. 96 96 97 97 int slotCount; //!< number of weapon slots the ship has. -
trunk/src/world_entities/world_entity.cc
r6005 r6142 53 53 54 54 this->setVisibiliy(true); 55 56 this->objectListNumber = OM_INIT; 57 this->objectListIterator = NULL; 58 59 this->toList(OM_NULL); 55 60 } 56 61 … … 67 72 for (unsigned int i = 0; i < this->models.size(); i++) 68 73 this->setModel(NULL, i); 74 75 State::getObjectManager()->toList(this, OM_INIT); 69 76 } 70 77 … … 95 102 { 96 103 if (fileName != NULL) 97 { 104 { 98 105 // search for the special character # in the LoadParam 99 106 if (strchr(fileName, '#') != NULL) 100 107 { 101 102 103 104 105 106 107 108 109 110 111 112 108 PRINTF(4)("Found # in %s... searching for LOD's\n", fileName); 109 char* lodFile = new char[strlen(fileName)+1]; 110 strcpy(lodFile, fileName); 111 char* depth = strchr(lodFile, '#'); 112 for (unsigned int i = 0; i < 5; i++) 113 { 114 *depth = 48+(int)i; 115 printf("-------%s\n", lodFile); 116 if (ResourceManager::isInDataDir(lodFile)) 117 this->loadModel(lodFile, scaling, i); 118 } 119 return; 113 120 } 114 121 … … 174 181 } 175 182 } 183 184 /** 185 * @brief moves this entity to the List OM_List 186 * @param list the list to set this Entity to. 187 * 188 * this is the same as a call to State::getObjectManager()->toList(entity , list); 189 * directly, but with an easier interface. 190 * 191 * @todo inline this (peut etre) 192 */ 193 void WorldEntity::toList(OM_LIST list) 194 { 195 State::getObjectManager()->toList(this, list); 196 } 197 176 198 177 199 -
trunk/src/world_entities/world_entity.h
r6005 r6142 11 11 #include "model.h" 12 12 13 #include "object_manager.h" 13 14 #include "glincl.h" 14 15 #include <vector> … … 65 66 // CharacterAttributes* getCharacterAttributes(); 66 67 68 void toList(OM_LIST list); 67 69 70 /** @returns a Reference to the objectListNumber to set. */ 71 OM_LIST& getOMListNumber() { return this->objectListNumber; } 72 /** @returns a Reference to the Iterator */ 73 std::list<WorldEntity*>::iterator& getEntityIterator() { return this->objectListIterator; } 68 74 protected: 69 75 // CharacterAttributes* charAttr; //!< the character attributes of a world_entity 70 76 71 77 private: 72 std::vector<Model*> models; //!< The model that should be loaded for this entity.73 BVTree* obbTree; //!< this is the obb tree reference needed for collision detection78 std::vector<Model*> models; //!< The model that should be loaded for this entity. 79 BVTree* obbTree; //!< this is the obb tree reference needed for collision detection 74 80 75 bool bCollide; //!< If it should be considered for the collisiontest. 76 bool bVisible; //!< If it should be visible. 81 bool bCollide; //!< If it should be considered for the collisiontest. 82 bool bVisible; //!< If it should be visible. 83 84 OM_LIST objectListNumber; //!< The ObjectList from ObjectManager this Entity is in. 85 std::list<WorldEntity*>::iterator objectListIterator; //!< The iterator position of this Entity in the given list of the ObjectManager. 86 77 87 }; 78 88
Note: See TracChangeset
for help on using the changeset viewer.