Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10678 in orxonox.OLD for branches/vs-enhencements


Ignore:
Timestamp:
Jun 7, 2007, 5:59:39 PM (18 years ago)
Author:
nicolasc
Message:

xfer

Location:
branches/vs-enhencements/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/vs-enhencements/src/lib/collision_reaction/cr_defs.h

    r10013 r10678  
    2525
    2626//!< the maximal number of bounding volumes collision events per frame
    27 #define CR_MAX_COLLISION_EVENTS   3000
     27#define CR_MAX_COLLISION_EVENTS   5000
    2828
    2929
  • branches/vs-enhencements/src/lib/coord/p_node.cc

    r9869 r10678  
    143143void PNode::loadParams(const TiXmlElement* root)
    144144{
     145  if (!root)
     146    return;
     147
    145148  BaseObject::loadParams(root);
    146149
  • branches/vs-enhencements/src/world_entities/npcs/npc.cc

    r10648 r10678  
    417417  }
    418418
    419 
    420 
    421419  this->weaponMan.tick(dt);
    422420  if (this->bFire)
  • branches/vs-enhencements/src/world_entities/playable.cc

    r10618 r10678  
    9393void Playable::loadParams(const TiXmlElement* root)
    9494{
     95  if (!root)
     96    return;
    9597  WorldEntity::loadParams(root);
    9698
  • branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc

    r10675 r10678  
    165165  this->secWeaponMan.setSlotCount(6);
    166166
    167   this->weaponMan.createWeaponSlot(0, 3.270, 1.028, .155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    168   this->weaponMan.createWeaponSlot(1, 3.270, 1.028, -.155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    169   this->weaponMan.createWeaponSlot(2, 4.385, .063, .876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    170   this->weaponMan.createWeaponSlot(3, 4.385, -.063, -.876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    171   this->weaponMan.createWeaponSlot(4, 1.635, -.612, 2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    172   this->weaponMan.createWeaponSlot(5, 1.536, -.612, -2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    173   this->weaponMan.createWeaponSlot(6, 1.536, -.612, 3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    174   this->weaponMan.createWeaponSlot(7, 1.536, -.612, -3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    175 
    176 
    177   this->weaponMan.addWeaponToSlot(0, 0, "RFCannon");
    178   this->weaponMan.addWeaponToSlot(0, 1, "RFCannon");
    179   this->weaponMan.addWeaponToSlot(0, 2, "RFCannon");
    180   this->weaponMan.addWeaponToSlot(0, 3, "RFCannon");
    181   this->weaponMan.addWeaponToSlot(1, 0, "RFCannon");
    182   this->weaponMan.addWeaponToSlot(1, 1, "RFCannon");
    183   this->weaponMan.addWeaponToSlot(1, 2, "RFCannon");
    184   this->weaponMan.addWeaponToSlot(1, 3, "RFCannon");
     167//   this->weaponMan.createWeaponSlot(0, 3.270, 1.028, .155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     168//   this->weaponMan.createWeaponSlot(1, 3.270, 1.028, -.155, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     169//   this->weaponMan.createWeaponSlot(2, 4.385, .063, .876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     170//   this->weaponMan.createWeaponSlot(3, 4.385, -.063, -.876, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     171//   this->weaponMan.createWeaponSlot(4, 1.635, -.612, 2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     172//   this->weaponMan.createWeaponSlot(5, 1.536, -.612, -2.691, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     173//   this->weaponMan.createWeaponSlot(6, 1.536, -.612, 3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     174//   this->weaponMan.createWeaponSlot(7, 1.536, -.612, -3.254, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     175
     176
     177//   this->weaponMan.addWeaponToSlot(0, 0, "RFCannon");
     178//   this->weaponMan.addWeaponToSlot(0, 1, "RFCannon");
     179//   this->weaponMan.addWeaponToSlot(0, 2, "RFCannon");
     180//   this->weaponMan.addWeaponToSlot(0, 3, "RFCannon");
     181//   this->weaponMan.addWeaponToSlot(1, 0, "RFCannon");
     182//   this->weaponMan.addWeaponToSlot(1, 1, "RFCannon");
     183//   this->weaponMan.addWeaponToSlot(1, 2, "RFCannon");
     184//   this->weaponMan.addWeaponToSlot(1, 3, "RFCannon");
    185185
    186186  this->weaponMan.addWeaponToSlot(0, 4, "NadionLaser");
     
    452452{
    453453
    454 //   if( !this->bInit)
    455 //   {
    456 //     // now get slots from the mount points
    457 //     std::map<int, MountPoint*>::iterator it = this->mountPointMap.begin();
    458 //     for( ;it != this->mountPointMap.end(); it++)
    459 //     {
    460 //       WeaponSlot* ws = dynamic_cast<WeaponSlot*>((*it).second->getMount());
    461 //       if( ws != NULL && ws->isA(WeaponSlot::staticClassID()))
    462 //       {
    463 //         int slot = ws->getWeaponSlot();
    464 // //         int side = ws->getWeaponSide(); //FIXME / REMOVE: is not used// HACK needed for some weapons (left/right)
    465 //         this->getWeaponManager().setSlotPosition(slot, (*it).second->getCenter());
    466 //         this->getWeaponManager().setSlotDirection(slot, ws->getRelDir());
    467 // //         PRINTF(0)("setting slot %i\n", slot);
    468 // //         (*it).second->getCenter().debug();
    469 //       }
    470 //     }
    471 //   this->bInit = true;
    472 //   }
     454  if( !this->bInit)
     455  {
     456    // now get slots from the mount points
     457    std::map<int, MountPoint*>::iterator it = this->mountPointMap.begin();
     458    for( ;it != this->mountPointMap.end(); it++)
     459    {
     460      WeaponSlot* ws = dynamic_cast<WeaponSlot*>((*it).second->getMount());
     461      if( ws != NULL && ws->isA(WeaponSlot::staticClassID()))
     462      {
     463        int slot = ws->getWeaponSlot();
     464//         int side = ws->getWeaponSide(); //FIXME / REMOVE: is not used// HACK needed for some weapons (left/right)
     465        this->getWeaponManager().setSlotPosition(slot, (*it).second->getCenter());
     466        this->getWeaponManager().setSlotDirection(slot, ws->getRelDir());
     467//         PRINTF(0)("setting slot %i\n", slot);
     468//         (*it).second->getCenter().debug();
     469      }
     470    }
     471  this->bInit = true;
     472  }
    473473
    474474  // Playable::tick(time);
  • branches/vs-enhencements/src/world_entities/weapons/weapon_manager.cc

    r10676 r10678  
    100100  }
    101101
    102   for (int i = 0; i < WM_MAX_LOADED_WEAPONS; i++)
    103     this->availiableWeapons[i] = NULL;
     102//   for (int i = 0; i < WM_MAX_LOADED_WEAPONS; i++)
     103//     this->availiableWeapons[i] = NULL;
    104104
    105105
     
    287287  }
    288288
    289 //   if (configID > 0 && slotID > 0 && this->configs[configID][slotID] != NULL)
    290 //   {
    291 //     PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getCName(), weapon->getClassCName(), weapon->getCName());
    292 //     return false;
    293 //   }
    294 
    295 //   if (slotID <= -1) // WM_FREE_SLOT
    296 //   {
    297 //     slotID = this->getNextFreeSlot(configID, weapon->getCapability());
    298 //     if( slotID < 0 || slotID >= this->slotCount)
    299 //     {
    300 //       PRINTF(1)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
    301 //       return false;
    302 //     }
    303 //   }
    304 
    305 //   if (!(this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLKINDS) &&
    306 //       this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLDIRS)
    307 //   {
    308 //     PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n",
    309 //               slotID, weapon->getCapability(), this->slotConfigs[slotID]->getCapability());
    310 //     return false;
    311 //   }
     289  if (configID > 0 && slotID > 0 && this->slotConfigs[slotID]->getWeapon(configID) != NULL)
     290  {
     291    PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getCName(), weapon->getClassCName(), weapon->getCName());
     292    return false;
     293  }
     294
     295  if (slotID <= -1) // WM_FREE_SLOT
     296  {
     297    slotID = this->getNextFreeSlot(configID, weapon->getCapability());
     298    if( slotID < 0 || slotID >= this->slotCount)
     299    {
     300      PRINTF(1)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
     301      return false;
     302    }
     303  }
     304
     305  if (!(this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLKINDS) &&
     306      this->slotConfigs[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLDIRS)
     307  {
     308    PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n",
     309              slotID, weapon->getCapability(), this->slotConfigs[slotID]->getCapability());
     310    return false;
     311  }
    312312
    313313  //! @todo check if the weapon is already assigned to another config in another slot
     
    508508        {
    509509          tickWeapon->toList(OM_NULL);
    510           this->slotConfigs[i]->setCurrentWeapon(NULL);
     510          this->slotConfigs[i]->setCurrentWeapon(-1);
    511511        }
    512512      }
     
    530530    }
    531531    else if (unlikely(tickWeapon != NULL && tickWeapon->getCurrentState() == WS_DEACTIVATING))
    532       this->slotConfigs[i]->setCurrentWeapon(NULL);
     532      this->slotConfigs[i]->setCurrentWeapon(-1);
    533533  }
    534534}
  • branches/vs-enhencements/src/world_entities/weapons/weapon_manager.h

    r10676 r10678  
    125125//     WeaponSlot*             currentSlotConfig[WM_MAX_SLOTS];          //!< The currentConfigureation.
    126126    WeaponSlot*             slotConfigs[WM_MAX_SLOTS];
    127     Weapon*                 availiableWeapons[WM_MAX_LOADED_WEAPONS]; //!< The availiable Weapons of this WeaponSlot
     127//     Weapon*                 availiableWeapons[WM_MAX_LOADED_WEAPONS]; //!< The availiable Weapons of this WeaponSlot
    128128
    129129    bool                    weaponChange;
  • branches/vs-enhencements/src/world_entities/weapons/weapon_slot.h

    r10676 r10678  
    3232
    3333  inline Weapon* getCurrentWeapon() { return this->currentWeapon; }
    34   inline void setCurrentWeapon(int config) { this->currentWeapon = this->configs[config]; }
     34  inline void setCurrentWeapon(int config) { config == -1 ? this->currentWeapon = NULL: this->currentWeapon = this->configs[config]; }
    3535
    3636  inline Weapon* getNextWeapon() { return this->nextWeapon; }
    37   inline void setNextWeapon(int config) { if (config == -1) this->nextWeapon = NULL; else this->nextWeapon = configs[config]; }
     37  inline void setNextWeapon(int config) { config == -1 ? this->nextWeapon = NULL : this->nextWeapon = configs[config]; }
    3838
    3939  inline void setNextToCurrent() {this->currentWeapon = this->nextWeapon; };
  • branches/vs-enhencements/src/world_entities/world_entity.cc

    r10674 r10678  
    151151void WorldEntity::loadParams(const TiXmlElement* root)
    152152{
     153  if (!root)
     154    return;
    153155  // Do the PNode loading stuff
    154156  PNode::loadParams(root);
Note: See TracChangeset for help on using the changeset viewer.