Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5440 in orxonox.OLD for trunk/src


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
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/debug.h

    r5439 r5440  
    4343//definitions
    4444#ifndef MODULAR_DEBUG
    45 #define HARD_DEBUG_LEVEL DEBUG
    46 #define SOFT_DEBUG_LEVEL verbose
     45 #define HARD_DEBUG_LEVEL DEBUG
     46 #define SOFT_DEBUG_LEVEL verbose
    4747#else /* MODULAR_DEBUG */
    48 #ifndef DEBUG_MODULE_SOFT
    49 #define SOFT_DEBUG_LEVEL verbose
    50 #else /* DEBUG_MODULE_SOFT */
    51 #define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
    52 #endif /* DEBUG_MODULE_SOFT */
    53 
    54 #ifndef DEBUG_SPECIAL_MODULE
    55 #define HARD_DEBUG_LEVEL DEBUG
    56 #else /* DEBUG_SPECIAL_MODULE */
    57 ////////////////////
    58 // DEFINE MODULES //
    59 ////////////////////
    60 // FRAMEWORK
    61 #define DEBUG_MODULE_BASE                  2
    62 #define DEBUG_MODULE_ORXONOX               2
    63 #define DEBUG_MODULE_WORLD                 2
    64 #define DEBUG_MODULE_NETWORK               2
    65 
    66 // LOADING
    67 #define DEBUG_MODULE_LOAD                  2
    68 #define DEBUG_MODULE_IMPORTER              2
    69 
    70 // ENGINES
    71 #define DEBUG_MODULE_GRAPHICS              2
    72 #define DEBUG_MODULE_EVENT                 2
    73 #define DEBUG_MODULE_PHYSICS               2
    74 #define DEBUG_MODULE_GARBAGE_COLLECTOR     2
    75 #define DEBUG_MODULE_OBJECT_MANAGER        2
    76 #define DEBUG_MODULE_ANIM                  2
    77 #define DEBUG_MODULE_COLLISON_DETECTION    2
    78 #define DEBUG_MODULE_SPATIAL_SEPARATION    2
    79 #define DEBUG_MODULE_GUI                   2
    80 
    81 // MISC
    82 #define DEBUG_MODULE_TRACK_MANAGER         2
    83 #define DEBUG_MODULE_MATH                  2
    84 
    85 #define DEBUG_MODULE_PNODE                 2
    86 #define DEBUG_MODULE_WORLD_ENTITY          2
    87 
    88 #define DEBUG_MODULE_WEAPON                2
    89 
    90 #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
    91 #endif /* DEBUG_SPECIAL_MODULE */
     48 #ifndef DEBUG_MODULE_SOFT
     49  #define SOFT_DEBUG_LEVEL verbose
     50 #else /* DEBUG_MODULE_SOFT */
     51  #define SOFT_DEBUG_LEVEL DEBUG_MODULE_SOFT
     52 #endif /* DEBUG_MODULE_SOFT */
     53
     54 #ifndef DEBUG_SPECIAL_MODULE
     55  #define HARD_DEBUG_LEVEL DEBUG
     56 #else /* DEBUG_SPECIAL_MODULE */
     57  ////////////////////
     58  // DEFINE MODULES //
     59  ////////////////////
     60  // FRAMEWORK
     61  #define DEBUG_MODULE_BASE                  2
     62  #define DEBUG_MODULE_ORXONOX               2
     63  #define DEBUG_MODULE_WORLD                 2
     64  #define DEBUG_MODULE_NETWORK               2
     65
     66  // LOADING
     67  #define DEBUG_MODULE_LOAD                  2
     68  #define DEBUG_MODULE_IMPORTER              2
     69
     70  // ENGINES
     71  #define DEBUG_MODULE_GRAPHICS              2
     72  #define DEBUG_MODULE_EVENT                 2
     73  #define DEBUG_MODULE_PHYSICS               2
     74  #define DEBUG_MODULE_GARBAGE_COLLECTOR     2
     75  #define DEBUG_MODULE_OBJECT_MANAGER        2
     76  #define DEBUG_MODULE_ANIM                  2
     77  #define DEBUG_MODULE_COLLISON_DETECTION    2
     78  #define DEBUG_MODULE_SPATIAL_SEPARATION    2
     79  #define DEBUG_MODULE_GUI                   2
     80
     81  // MISC
     82  #define DEBUG_MODULE_TRACK_MANAGER         2
     83  #define DEBUG_MODULE_MATH                  2
     84
     85  #define DEBUG_MODULE_PNODE                 2
     86  #define DEBUG_MODULE_WORLD_ENTITY          2
     87
     88  #define DEBUG_MODULE_WEAPON                2
     89
     90  #define HARD_DEBUG_LEVEL DEBUG_SPECIAL_MODULE
     91
     92 #endif /* DEBUG_SPECIAL_MODULE */
    9293#endif /* MODULAR_DEBUG */
    9394
  • 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.