Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 27, 2005, 10:56:58 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Weapons update, Now one can really assign SlotCapabilities
Debug-redesign (small)

Location:
trunk/src/world_entities
Files:
4 edited

Legend:

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

    r5435 r5440  
    136136
    137137  this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
     138  this->weaponMan->setSlotCapability(0, WTYPE_ALLDIRS & WTYPE_DIRECTIONAL);
    138139
    139140  this->weaponMan->setSlotPosition(1, Vector(-2.6, .1, 3.0));
     141  this->weaponMan->setSlotCapability(1, WTYPE_ALLDIRS & WTYPE_DIRECTIONAL);
    140142
    141143  this->weaponMan->setSlotPosition(2, Vector(-1.5, .5, -.5));
     
    329331
    330332// FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
    331 int slot = 2;
    332333void Player::ADDWEAPON()
    333334{
     
    336337  turret1->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
    337338
    338   this->weaponMan->addWeapon(turret1, 2, slot++);
     339  this->weaponMan->addWeapon(turret1, 2);
    339340
    340341  this->weaponMan->changeWeaponConfig(2);
  • trunk/src/world_entities/weapons/turret.cc

    r5414 r5440  
    9797  this->setEmissionPoint(1.684, 0.472, 0);
    9898  //this->getProjectileFactory()->prepare(100);
    99 
    100 
    10199}
    102100
     
    140138  if (target != NULL)
    141139  {
    142     pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0   /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
     140    pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(20)
     141            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    143142  }
    144143  else
     
    148147  pj->setAbsCoor(this->getEmissionPoint());
    149148  pj->setAbsDir(this->getAbsDir());
     149
    150150  State::getWorldEntityList()->add(pj);
    151151}
    152 
    153152
    154153void Turret::destroy ()
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r5435 r5440  
    220220  if (unlikely(configID >= WM_MAX_CONFIGS || slotID >= (int)this->slotCount))
    221221  {
    222     PRINTF(2)("Slot %d of config %d is not availiabe\n", slotID, configID);
     222    PRINTF(2)("Slot %d of config %d is not availiabe (max: %d)\n", slotID, configID, this->slotCount);
    223223    return;
    224224  }
     
    238238
    239239  //! @todo check if the weapon is already assigned to another config in another slot
    240 
    241240  this->configs[configID][slotID] = weapon;
    242241  if (this->parent != NULL)
     
    403402 * @param the selected weaponconfig
    404403 */
    405 int WeaponManager::getNextFreeSlot(int configID)
     404int WeaponManager::getNextFreeSlot(int configID, long capability)
    406405{
    407406  for( int i = 0; i < this->slotCount; ++i)
    408407  {
    409     if( this->configs[configID][i] == NULL)
     408    if( this->configs[configID][i] == NULL &&
     409        (this->currentSlotConfig[i].capability & capability == this->currentSlotConfig[i].capability))
    410410      return i;
    411411  }
  • trunk/src/world_entities/weapons/weapon_manager.h

    r5435 r5440  
    8787
    8888  private:
    89     int getNextFreeSlot(int configID);
     89    int getNextFreeSlot(int configID, long capability = WTYPE_ALL);
    9090
    9191  private:
Note: See TracChangeset for help on using the changeset viewer.