Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6142 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Dec 16, 2005, 7:13:57 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merge the ObjectManager to the trunk
merged with command:
svn merge -r6082:HEAD objectmanager/ ../trunk/

conflicts resolution was easy this time :)
but specially merged the world to network_world

Location:
trunk/src/world_entities
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/environment.cc

    r5994 r6142  
    6262{
    6363  this->setClassID(CL_ENVIRONMENT, "Environment");
     64  this->toList(OM_ENVIRON);
    6465}
    6566
  • trunk/src/world_entities/npcs/npc.cc

    r6054 r6142  
    3333{
    3434  this->setClassID(CL_NPC, "NPC");
    35 
     35  this->toList(OM_GROUP_00);
    3636}
    3737
     
    5050      WorldEntity* powerUp = new TurretPowerUp();
    5151      powerUp->setAbsCoor(this->getAbsCoor());
    52       State::getWorldEntityList()->add(powerUp);
     52//      powerUp->toList(OM_COMMON);
    5353    }
    5454    else if ((float)rand()/RAND_MAX < .3)
     
    5656      WorldEntity* powerUp = new LaserPowerUp();
    5757      powerUp->setAbsCoor(this->getAbsCoor());
    58       State::getWorldEntityList()->add(powerUp);
     58      powerUp->toList(OM_COMMON);
    5959    }
    60     State::getWorldEntityList()->remove(this);
     60    this->toList(OM_DEAD);
    6161    this->removeNode();
    6262
     
    6868  {
    6969    this->setVisibiliy(false);
    70     State::getWorldEntityList()->remove(this);
     70    this->toList(OM_DEAD);
    7171    this->removeNode();
    7272  }
  • trunk/src/world_entities/playable.cc

    r5915 r6142  
    4646  PRINTF(4)("PLAYABLE INIT\n");
    4747
     48  this->toList(OM_GROUP_01);
    4849  this->weaponMan = new WeaponManager(this);
    4950
  • trunk/src/world_entities/power_ups/laser_power_up.cc

    r6113 r6142  
    8080 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
    8181 if (entity->isA(CL_PLAYABLE))
    82   State::getWorldEntityList()->remove(this);
     82  this->toList(OM_DEAD);
    8383}
    8484
  • trunk/src/world_entities/power_ups/power_up.cc

    r6113 r6142  
    3838{
    3939  delete this->sphereMaterial;
     40  this->toList(OM_COMMON);
    4041}
    4142
  • trunk/src/world_entities/power_ups/turret_power_up.cc

    r6113 r6142  
    8080 // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
    8181 if (entity->isA(CL_PLAYABLE))
    82   State::getWorldEntityList()->remove(this);
     82   this->toList(OM_DEAD);
    8383}
    8484
  • trunk/src/world_entities/skybox.cc

    r6022 r6142  
    6565{
    6666  this->setClassID(CL_SKYBOX, "SkyBox");
    67 
     67  this->toList(OM_ENVIRON_NOTICK);
    6868  this->size = 100.0;
    6969
  • trunk/src/world_entities/skysphere.cc

    r5511 r6142  
    4242{
    4343  this->setClassID(CL_SKYSPHERE, "SkySphere");
    44 
     44  this->toList(OM_ENVIRON_NOTICK);
    4545  if (fileName == NULL)
    4646    this->initialize("pictures/sky-replace.jpg");
  • trunk/src/world_entities/terrain.cc

    r6022 r6142  
    9393{
    9494  this->setClassID(CL_TERRAIN, "Terrain");
     95  this->toList(OM_ENVIRON_NOTICK);
    9596
    9697  this->objectList = 0;
  • trunk/src/world_entities/test_entity.cc

    r5994 r6142  
    3333{
    3434  this->setClassID(CL_TEST_ENTITY, "TestEntity");
     35  // TO SOME LIST!!
    3536
    3637  this->md2Model = new MD2Model("models/droidika.md2", "models/droideka.pcx");
     
    7071    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
    7172  this->setVisibiliy(false);
    72   State::getWorldEntityList()->remove(this);
     73  this->toList(OM_DEAD);
    7374  }
    7475}
  • trunk/src/world_entities/weapons/aim.cc

    r6078 r6142  
    104104void Aim::searchTarget(float range)
    105105{
    106   tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator();
     106  //FIXME//
     107/*  tIterator<WorldEntity>* iterator = State::getWorldEntityList()->getIterator();
    107108  WorldEntity* entity = iterator->firstElement();
    108109  while (likely(entity != NULL))
     
    121122  }
    122123
    123   delete iterator;
     124  delete iterator;*/
    124125}
    125126
  • trunk/src/world_entities/weapons/bomb.cc

    r5994 r6142  
    174174void Bomb::activate()
    175175{
    176   State::getWorldEntityList()->add(this);
    177176
    178177}
     
    180179void Bomb::deactivate()
    181180{
    182   State::getWorldEntityList()->remove(this);
     181  this->toList(OM_DEAD);
    183182  this->lifeCycle = 0.0f;
    184183  Bomb::fastFactory->kill(this);
  • trunk/src/world_entities/weapons/ground_turret.cc

    r5994 r6142  
    8989  {
    9090    this->left->setParent(this);
     91    this->left->toList(this->getOMListNumber());
    9192    this->left->setRelCoor(0,10,-5);
    9293  }
     
    9899  {
    99100    this->right->setParent(this);
     101    this->right->toList(this->getOMListNumber());
    100102    this->right->setRelCoor(0,10,5);
    101103  }
  • trunk/src/world_entities/weapons/guided_missile.cc

    r6078 r6142  
    8585void GuidedMissile::activate()
    8686{
    87   State::getWorldEntityList()->add(this);
    8887  if (unlikely(GuidedMissile::trailParticles == NULL))
    8988  {
     
    129128  this->lifeCycle = 0.0;
    130129
    131 //  GarbageCollector::getInstance()->collect(this);
    132   State::getWorldEntityList()->remove(this);
     130  this->toList(OM_DEAD);
    133131  this->removeNode();
    134132  GuidedMissile::fastFactory->kill(this);
     
    152150  if (this->target != NULL && this->target->getParent() != PNode::getNullParent())
    153151   {
    154      printf("========%s::%s\n", target->getParent()->getClassName(), target->getParent()->getName() );
    155152     velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
    156153     float speed = velocity.len();
  • trunk/src/world_entities/weapons/laser.cc

    r6056 r6142  
    7777void Laser::activate()
    7878{
    79   State::getWorldEntityList()->add(this);
    8079  if (unlikely(Laser::explosionParticles == NULL))
    8180  {
     
    9897  this->lifeCycle = 0.0;
    9998
    100 //  GarbageCollector::getInstance()->collect(this);
    101   State::getWorldEntityList()->remove(this);
     99  this->toList(OM_NULL);
    102100  this->removeNode();
    103101  Laser::fastFactory->kill(this);
     
    134132  this->lifeCycle = .95; //!< @todo calculate this usefully.
    135133  ParticleEngine::getInstance()->addConnection(this->emitter, Laser::explosionParticles);
    136 
    137134}
    138135
  • trunk/src/world_entities/weapons/projectile.cc

    r6078 r6142  
    2222#include "weapon.h"
    2323#include "model.h"
    24 
    25 #include "garbage_collector.h"
    2624
    2725using namespace std;
  • trunk/src/world_entities/weapons/rocket.cc

    r6056 r6142  
    8282void Rocket::activate()
    8383{
    84   State::getWorldEntityList()->add(this);
    8584  if (unlikely(Rocket::trailParticles == NULL))
    8685  {
     
    125124  ParticleEngine::getInstance()->breakConnections(this->emitter);
    126125  this->lifeCycle = 0.0;
     126  this->toList(OM_NULL);
    127127
    128128//  GarbageCollector::getInstance()->collect(this);
    129   State::getWorldEntityList()->remove(this);
     129  this->toList(OM_DEAD);
    130130  Rocket::fastFactory->kill(this);
    131131}
  • trunk/src/world_entities/weapons/test_bullet.cc

    r5994 r6142  
    8282void TestBullet::activate()
    8383{
    84   State::getWorldEntityList()->add(this);
    8584  if (unlikely(TestBullet::trailParticles == NULL))
    8685  {
     
    119118  ParticleEngine::getInstance()->breakConnections(this->emitter);
    120119  this->lifeCycle = 0.0;
     120  this->toList(OM_NULL);
    121121
    122 //  GarbageCollector::getInstance()->collect(this);
    123   State::getWorldEntityList()->remove(this);
    124122  TestBullet::fastFactory->kill(this);
    125123}
  • trunk/src/world_entities/weapons/weapon.cc

    r6054 r6142  
    192192{
    193193  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  }
    195199  else
    196200  {
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r6074 r6142  
    3535 * @param number of weapon slots of the model/ship <= 8 (limitied)
    3636 */
    37 WeaponManager::WeaponManager(PNode* parent)
     37WeaponManager::WeaponManager(WorldEntity* parent)
    3838{
    3939  this->init();
     
    155155 * a PNode.
    156156 */
    157 void WeaponManager::setParent(PNode* parent)
    158 {
    159   if (parent == NULL)
    160     parent = PNode::getNullParent();
     157void WeaponManager::setParent(WorldEntity* parent)
     158{
    161159  this->parent = parent;
    162160  if (this->parent != NULL)
     
    247245  this->configs[configID][slotID] = weapon;
    248246  if (this->parent != NULL)
    249     weapon->setParent(parent);
     247  {
     248    this->parent->addChild(weapon);
     249  }
    250250  PRINTF(3)("Added a new Weapon to the WeaponManager: config %i/ slot %i\n", configID, slotID);
    251251}
     
    373373      else
    374374      {
     375        if (this->currentSlotConfig[i].currentWeapon != NULL)
     376          this->currentSlotConfig[i].currentWeapon->toList(OM_NULL);
    375377        tickWeapon = this->currentSlotConfig[i].currentWeapon = this->currentSlotConfig[i].nextWeapon;
    376378        if (tickWeapon != NULL)
     
    378380          tickWeapon->requestAction(WA_ACTIVATE);
    379381          tickWeapon->setParent(&this->currentSlotConfig[i].position);
     382          tickWeapon->toList(this->parent->getOMListNumber());
    380383          this->currentSlotConfig[i].position.activateNode();
    381384        }
  • trunk/src/world_entities/weapons/weapon_manager.h

    r6055 r6142  
    4545
    4646  public:
    47     WeaponManager(PNode* parent);
     47    WeaponManager(WorldEntity* parent);
    4848    WeaponManager(const TiXmlElement* root);
    4949    ~WeaponManager();
     
    6363    long getSlotCapability(int slot) const { return this->currentSlotConfig[slot].capability; };
    6464
    65     void setParent(PNode* parent);
     65    void setParent(WorldEntity* parent);
    6666    /** @returns the Parent (carrier) of this WeaponManager */
    6767    PNode* getParent() const { return this->parent; };
     
    9393
    9494  private:
    95     PNode*                  parent;                                   //!< The parent, this WeaponManager is connected to.
     95    WorldEntity*            parent;                                   //!< The parent, this WeaponManager is connected to.
    9696
    9797    int                     slotCount;                                //!< number of weapon slots the ship has.
  • trunk/src/world_entities/world_entity.cc

    r6005 r6142  
    5353
    5454  this->setVisibiliy(true);
     55
     56  this->objectListNumber = OM_INIT;
     57  this->objectListIterator = NULL;
     58
     59  this->toList(OM_NULL);
    5560}
    5661
     
    6772  for (unsigned int i = 0; i < this->models.size(); i++)
    6873    this->setModel(NULL, i);
     74
     75  State::getObjectManager()->toList(this, OM_INIT);
    6976}
    7077
     
    95102{
    96103  if (fileName != NULL)
    97   { 
     104  {
    98105    // search for the special character # in the LoadParam
    99106    if (strchr(fileName, '#') != NULL)
    100107      {
    101         PRINTF(4)("Found # in %s... searching for LOD's\n", fileName);
    102         char* lodFile = new char[strlen(fileName)+1];
    103         strcpy(lodFile, fileName);
    104         char* depth = strchr(lodFile, '#');
    105         for (unsigned int i = 0; i < 5; i++)
    106           {
    107             *depth = 48+(int)i;
    108             printf("-------%s\n", lodFile);
    109             if (ResourceManager::isInDataDir(lodFile))
    110               this->loadModel(lodFile, scaling, i);
    111           }
    112         return;
     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;
    113120      }
    114121
     
    174181  }
    175182}
     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 */
     193void WorldEntity::toList(OM_LIST list)
     194{
     195  State::getObjectManager()->toList(this, list);
     196}
     197
    176198
    177199
  • trunk/src/world_entities/world_entity.h

    r6005 r6142  
    1111#include "model.h"
    1212
     13#include "object_manager.h"
    1314#include "glincl.h"
    1415#include <vector>
     
    6566  //  CharacterAttributes* getCharacterAttributes();
    6667
     68  void toList(OM_LIST list);
    6769
     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; }
    6874 protected:
    6975  //  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
    7076
    7177 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 detection
     78  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
    7480
    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
    7787};
    7888
Note: See TracChangeset for help on using the changeset viewer.