Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/presentation/src/world_entities/weapons/weapon_manager.cc

Last change on this file was 10759, checked in by bknecht, 18 years ago

hud updated

File size: 17.7 KB
RevLine 
[4826]1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific
12   main-programmer: Patrick Boenzli
[4832]13   co-programmer: Benjamin Grauer
[4951]14
15   2005-07-24: Benjamin Grauer: restructurate, so it can handle the new Weapons.
[10437]16   2007-01-28: Patrick Boenzli: loadable slots
[4826]17*/
18
[9869]19#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
[4826]20
21#include "weapon_manager.h"
22#include "weapon.h"
[10437]23#include "weapon_slot.h"
[4834]24#include "crosshair.h"
[4828]25
[6561]26#include "playable.h"
27
[9869]28#include "util/loading/load_param_xml.h"
[7193]29#include "util/loading/factory.h"
[6055]30
[4837]31#include "t_animation.h"
[4826]32
33
[9869]34ObjectListDefinition(WeaponManager);
[4826]35/**
[6054]36 * @brief this initializes the weaponManager for a given nnumber of weapon slots
[10698]37 * @param number of weapon slots of the model/ship <= 10 (limitied)
[4826]38 */
[6142]39WeaponManager::WeaponManager(WorldEntity* parent)
[4826]40{
[4833]41  this->init();
[8844]42  this->setParentEntity(parent);
43
44  assert (parent != NULL);
[4826]45}
46
[4949]47WeaponManager::WeaponManager(const TiXmlElement* root)
48{
49  this->init();
50  this->loadParams(root);
51}
[4826]52
[4833]53/**
[6054]54 * @brief Destroys a WeaponManager
[4833]55 */
[4826]56WeaponManager::~WeaponManager()
57{
[4834]58  // crosshair being a PNode it must not be deleted (this is because PNodes delete themselves.)
[8147]59  // rennerc: crosshair seems not to delete itselve
[9869]60  //if (Crosshair::objectList().exists(this->crosshair))
61  //  delete this->crosshair;
[4826]62}
63
[4834]64/**
[6054]65 * @brief initializes the WeaponManager
[4834]66 */
[4833]67void WeaponManager::init()
68{
[9869]69  this->registerObject(this, WeaponManager::_objectList);
[4826]70
[8844]71  this->parentNode = NULL;
72  this->parentEntity = NULL;
[4951]73
74  for (int i = 0; i < WM_MAX_CONFIGS; i++)
75    for (int j = 0; j < WM_MAX_SLOTS; j++)
76      this->configs[i][j] = NULL;
77
78  for (int i = 0; i < WM_MAX_SLOTS; i++)
[4833]79  {
[10437]80    this->currentSlotConfig[i] = new WeaponSlot();
81    this->currentSlotConfig[i]->setCapability(WTYPE_ALL);
82    this->currentSlotConfig[i]->setCurrentWeapon(NULL);
83    this->currentSlotConfig[i]->setNextWeapon(NULL);
[4992]84
85    // NAMING
86    char* tmpName;
[9406]87    if (!this->getName().empty())
[4992]88    {
[9406]89      tmpName = new char[this->getName().size() + 10];
90      sprintf(tmpName, "%s_slot%d", this->getCName(), i);
[4992]91    }
92    else
93    {
94      tmpName = new char[30];
95      sprintf(tmpName, "WeaponMan_slot%d", i);
96    }
[10437]97    this->currentSlotConfig[i]->setName(tmpName);
98    this->currentSlotConfig[i]->deactivateNode();
[5208]99    delete[] tmpName;
[4833]100  }
[4895]101
[4951]102  for (int i = 0; i < WM_MAX_LOADED_WEAPONS; i++)
103    this->availiableWeapons[i] = NULL;
[4895]104
105
[4951]106  this->currentConfigID = 0;
[10368]107  this->slotCount = WM_MAX_SLOTS;
[8315]108  //this->weaponChange;
[4895]109
[4951]110  // CROSSHAIR INITIALISATION
[4834]111  this->crosshair = new Crosshair();
[6807]112  //this->crosshair->setRelCoor(1000,0,0);
[4837]113  this->crossHairSizeAnim = new tAnimation<Crosshair>(this->crosshair, &Crosshair::setSize);
114  this->crossHairSizeAnim->setInfinity(ANIM_INF_REWIND);
115  this->crossHairSizeAnim->addKeyFrame(50, .1, ANIM_LINEAR);
116  this->crossHairSizeAnim->addKeyFrame(100, .05, ANIM_LINEAR);
117  this->crossHairSizeAnim->addKeyFrame(50, .01, ANIM_LINEAR);
[10368]118
119  this->hideCrosshair();
120
121  this->bFire = false;
[4834]122}
[4833]123
[10368]124void WeaponManager::showCrosshair()
125{
[10759]126  if (this->crosshair)
127        this->crosshair->setVisibility( true);
[10368]128}
129
130void WeaponManager::hideCrosshair()
131{
[10759]132  if (this->crosshair)
133        this->crosshair->setVisibility( false);
[10368]134}
135
136void WeaponManager::setRotationSpeed(float speed)
137{
138  this->crosshair->setRotationSpeed(speed);
139}
140
[4834]141/**
[7350]142 * @brief loads the settings of the WeaponManager
[4834]143 * @param root the XML-element to load from
144 */
145void WeaponManager::loadParams(const TiXmlElement* root)
146{
[6512]147  BaseObject::loadParams(root);
[4972]148
[10698]149  LoadParam(root, "slotCount", this, WeaponManager, setSlotCount)
[6736]150  .describe("how many slots(cannons) the WeaponManager can handle");
[4834]151
[10698]152
[5644]153  LOAD_PARAM_START_CYCLE(root, element);
[5654]154  {
155    // CHECK IF THIS WORKS....
156    LoadParamXML_CYCLE(element, "weapons", this, WeaponManager, loadWeapons)
[6736]157    .describe("loads Weapons");
[5654]158  }
[5644]159  LOAD_PARAM_END_CYCLE(element);
[10698]160
161
[4833]162}
163
[4826]164/**
[7350]165 * @brief loads a Weapon onto the WeaponManager
[4834]166 * @param root the XML-element to load the Weapons from
167 */
168void WeaponManager::loadWeapons(const TiXmlElement* root)
169{
[5644]170  LOAD_PARAM_START_CYCLE(root, element);
[4834]171
[8315]172  BaseObject* object = Factory::fabricate(element);
173  if (object != NULL)
174  {
175    Weapon* newWeapon = dynamic_cast<Weapon*>(object);
176    if (newWeapon == NULL)
177      delete object;
178  }
[5644]179  LOAD_PARAM_END_CYCLE(element);
[4834]180}
181
[4992]182/**
[7350]183 * @brief sets the Parent of the WeaponManager.
[4992]184 * @param parent the parent of the WeaponManager
185 *
186 * this is used, to identify to which ship/man/whatever this WeaponManager is connected.
187 * also all the Slots will be subconnected to this parent.
[5435]188 *
189 * The reason this function exists is that the WeaponManager is neither a WorldEntity nor
190 * a PNode.
[4992]191 */
[8844]192void WeaponManager::setParentEntity(WorldEntity* parent)
[4953]193{
[8844]194  this->parentEntity = parent;
195  if (this->parentNode == NULL)
196    this->setParentNode(parent);
197}
198
199
200void WeaponManager::setParentNode(PNode* parent)
201{
202  this->parentNode = parent;
203  assert(parent != NULL);
204
205  if (this->parentNode != NULL)
[4953]206  {
207    for (int i = 0; i < WM_MAX_SLOTS; i++)
[10437]208      this->parentNode->addChild(this->currentSlotConfig[i]);
[4953]209  }
[8844]210
[4953]211}
212
[8844]213
[4834]214/**
[7350]215 * @brief sets the number of Slots the WeaponManager has
[4926]216 * @param slotCount the number of slots
[4834]217 */
[4951]218void WeaponManager::setSlotCount(unsigned int slotCount)
[4834]219{
[4951]220  if (slotCount <= WM_MAX_SLOTS)
221    this->slotCount = slotCount;
222  else
223    this->slotCount = WM_MAX_SLOTS;
[4834]224}
225
[4972]226
227/**
[7350]228 * @brief sets the position of the Slot relative to the parent
[4972]229 * @param slot the slot to set-up
230 * @param position the position of the given slot
231 */
[6803]232void WeaponManager::setSlotPosition(int slot, const Vector& position, PNode* parent)
[4953]233{
234  if (slot < this->slotCount)
[6803]235  {
[10437]236    this->currentSlotConfig[slot]->setRelCoor(position);
[6803]237
238    if (parent != NULL)
[10437]239      this->currentSlotConfig[slot]->setParent(parent);
[6803]240  }
[4953]241}
242
[4972]243
244/**
[7350]245 * @brief sets the relative rotation of the slot to its parent
[4972]246 * @param slot the slot to set-up
247 * @param rotation the relative rotation of the given slot
248 */
[4969]249void WeaponManager::setSlotDirection(int slot, const Quaternion& rotation)
250{
251  if (slot < this->slotCount)
[10437]252    this->currentSlotConfig[slot]->setRelDir(rotation);
[4969]253}
254
255
[4834]256/**
[7350]257 * @brief adds a weapon to the selected weaponconfiguration into the selected slot
[4972]258 * @param weapon the weapon to add
259 * @param configID an identifier for the slot: number between 0..7 if not specified: slotID=next free slot
260 * @param slotID an identifier for the weapon configuration, number between 0..3
[4832]261 *
262 * if you add explicitly a weapon at config:n, slot:m, the weapon placed at this location will be
[4906]263 * replaced by the weapon specified. if you use the WM_FREE_SLOT, the manager will look for a free
[4832]264 * slot in this weaponconfiguration. if there is non, the weapon won't be added and there will be
265 * a error message.
[4826]266 */
[6561]267bool WeaponManager::addWeapon(Weapon* weapon, int configID, int slotID)
[4826]268{
[6753]269  if ( weapon == NULL )
[6737]270    return false;
[10739]271 
272  weapon->toList( this->parentEntity->getOMListNumber() );
[6679]273
[4951]274  if (unlikely(configID >= WM_MAX_CONFIGS || slotID >= (int)this->slotCount))
[4826]275  {
[6679]276    PRINTF(2)("Slot %d of config %d is not availiabe (max: %d) searching for suitable slot\n", slotID, configID, this->slotCount);
277    if (configID >= WM_MAX_CONFIGS)
278      configID = -1;
279    if (slotID >= (int)this->slotCount)
280      slotID = -1;
[4951]281  }
[6679]282  // if no ConfigID is supplied set to Current Config.
283  if (configID <= -1)
284    configID = this->currentConfigID;
285  //
286  if (configID > -1 && slotID == -1)
287  {
288    slotID = this->getNextFreeSlot(configID, weapon->getCapability());
289    if (slotID == -1)
290      configID = -1;
291  }
[4951]292
[6676]293  if (configID > 0 && slotID > 0 && this->configs[configID][slotID] != NULL)
294  {
[9406]295    PRINTF(3)("Weapon-slot %d/%d of %s already poulated, remove weapon (%s::%s) first\n", configID, slotID, this->getCName(), weapon->getClassCName(), weapon->getCName());
[6676]296    return false;
297  }
[4951]298
[6676]299  if (slotID <= -1) // WM_FREE_SLOT
[4951]300  {
[5441]301    slotID = this->getNextFreeSlot(configID, weapon->getCapability());
[4951]302    if( slotID < 0 || slotID >= this->slotCount)
[4826]303    {
[5441]304      PRINTF(1)("There is no free slot in this WeaponConfig to dock this weapon at! Aborting\n");
[6561]305      return false;
[4826]306    }
307  }
[4953]308
[10437]309  if (!(this->currentSlotConfig[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLKINDS) &&
310      this->currentSlotConfig[slotID]->getCapability() & weapon->getCapability() & WTYPE_ALLDIRS)
[5441]311  {
312    PRINTF(2)("Unable to add Weapon with wrong capatibility to Slot %d (W:%d M:%d)\n",
[10437]313              slotID, weapon->getCapability(), this->currentSlotConfig[slotID]->getCapability());
[6561]314    return false;
[5441]315  }
316
[4953]317  //! @todo check if the weapon is already assigned to another config in another slot
[6714]318  if (this->configs[configID][slotID] != NULL)
319    return false;
[6676]320
[4951]321  this->configs[configID][slotID] = weapon;
[6669]322  weapon->setAmmoContainer(this->getAmmoContainer(weapon->getProjectileType()));
[6736]323  if(configID == this->currentConfigID)
[10438]324    this->currentSlotConfig[slotID]->setNextWeapon(weapon);
[8844]325  //if (this->parent != NULL)
[6142]326  {
[8844]327    this->parentNode->addChild(weapon);
[9869]328    if (this->parentEntity->isA(Playable::staticClassID()))
[8844]329      dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
[10437]330
[6920]331    weapon->setDefaultTarget(this->crosshair);
[6142]332  }
[9869]333  PRINTF(4)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassCName(), weapon->getCName(), configID, slotID);
[6561]334  return true;
[4826]335}
336
[4834]337/**
[6931]338 * @brief increases the Energy of the WeaponContainer of type (projectileType)
339 * @param projectileType the type of weapon to increase Energy from
340 * @param ammo the ammo to increase
341 */
[9869]342float WeaponManager::increaseAmmunition(const ClassID& projectileType, float ammo)
[6931]343{
344  return this->getAmmoContainer(projectileType)->increaseEnergy(ammo);
345}
346
[6972]347/**
[10368]348 * @brief does the same as the funtion increaseAmmunition, added four your convenience
[6972]349 * @param weapon, the Weapon to read the ammo-info about.
350 * @param ammo how much ammo to add.
351 */
[10368]352float WeaponManager::increaseAmmunition(const Weapon* weapon, float ammo)
[6972]353{
354  assert (weapon != NULL);
[9869]355  return this->increaseAmmunition(weapon->getClassID(), ammo);
[6931]356
[6972]357}
[6931]358
[6972]359
[6931]360/**
[4954]361 * sets the capabilities of a Slot
362 * @param slot the slot to set the capability
[10437]363 * @param slotCapability the capability @see WeaponSlotCapability
[4954]364 */
[10698]365void WeaponManager::setSlotCapability(int slot, unsigned long slotCapability)
[4954]366{
367  if (slot > slotCount)
368    return;
[10437]369  this->currentSlotConfig[slot]->setCapability(slotCapability);
[4954]370}
371
372
373/**
[4834]374 * removes a Weapon from the WeaponManager
[4954]375 *
376 * !! The weapon must be inactive before you can delete it,    !!
377 * !! because it will still be deactivated (if it is selected) !!
[4834]378 */
[4826]379void WeaponManager::removeWeapon(Weapon* weapon, int configID)
380{
[4954]381  if (weapon == NULL)
382    return;
383  if (configID < 0)
384  {
385    for (int j = 0; j < WM_MAX_SLOTS; j++)
386    {
387      for (int i = 0; i < WM_MAX_CONFIGS; i++)
388      {
389        if (this->configs[i][j] == weapon)
390          this->configs[i][j] = NULL;
391      }
[10437]392      if (this->currentSlotConfig[j]->getCurrentWeapon() == weapon)
[4954]393      {
[10437]394        this->currentSlotConfig[j]->setNextWeapon(NULL);
[4954]395      }
396    }
397  }
[4826]398}
399
400
401/**
[4832]402 * changes to the next weapon configuration
[4826]403 */
[4954]404void WeaponManager::nextWeaponConfig()
[4826]405{
[4951]406  ++this->currentConfigID;
407  if (this->currentConfigID >= WM_MAX_CONFIGS)
408    this->currentConfigID = 0;
[4952]409  this->changeWeaponConfig(this->currentConfigID);
410}
[4826]411
[4953]412/**
413 * changes to the previous configuration
414 */
[4952]415void WeaponManager::previousWeaponConfig()
416{
417  --this->currentConfigID;
418  if (this->currentConfigID < 0)
419    this->currentConfigID = WM_MAX_CONFIGS -1;
420  this->changeWeaponConfig(this->currentConfigID);
421}
422
[4953]423/**
424 * change to a desired configuration
425 * @param weaponConfig the configuration to jump to.
426 */
[4952]427void WeaponManager::changeWeaponConfig(int weaponConfig)
428{
429  this->currentConfigID = weaponConfig;
430  PRINTF(4)("Changing weapon configuration: to %i\n", this->currentConfigID);
[10368]431
[4951]432  for (int i = 0; i < WM_MAX_SLOTS; i++)
[10438]433    this->currentSlotConfig[i]->setNextWeapon(this->configs[currentConfigID][i]);
[4826]434}
435
436
437/**
[4832]438 * triggers fire of all weapons in the current weaponconfig
[4826]439 */
[4832]440void WeaponManager::fire()
[4826]441{
442  Weapon* firingWeapon;
[4951]443  for(int i = 0; i < this->slotCount; i++)
[4826]444  {
[10368]445//     printf("%i ", i);
[10526]446    firingWeapon = this->currentSlotConfig[i]->getCurrentWeapon();
447    if( firingWeapon != NULL)
448    {
449      if( firingWeapon->getCurrentState() == WS_SHOOTING) continue;
450      firingWeapon->requestAction(WA_SHOOT);
451    }
[10368]452  }
453//   printf("\n");
454  /*
455        this->crosshair->setRotationSpeed(500);
456        this->crossHairSizeAnim->replay();
457  */
458}
459
460/**
[10539]461 * triggers release fire of all weapons in the current weaponconfig
[10368]462 */
463void WeaponManager::releaseFire()
464{
465  Weapon* firingWeapon;
466  for(int i = 0; i < this->slotCount; i++)
467  {
[10438]468    firingWeapon = this->currentSlotConfig[i]->getCurrentWeapon();
[10528]469    if( firingWeapon != NULL)
470      firingWeapon->requestAction(WA_NONE);
[4826]471  }
[10368]472
473  /*
[4837]474  this->crosshair->setRotationSpeed(500);
475  this->crossHairSizeAnim->replay();
[10368]476  */
[4826]477}
478
479/**
[4832]480 * triggers tick of all weapons in the current weaponconfig
481 * @param second passed since last tick
[4826]482 */
[4833]483void WeaponManager::tick(float dt)
[4826]484{
[4951]485  Weapon* tickWeapon;
486
487  for(int i = 0; i < this->slotCount; i++)
[4826]488  {
[10368]489
490    //NICE LITTLE DEBUG FUNCTION
[10437]491    /*   if (this->currentSlotConfig[i]->currentWeapon != NULL || this->currentSlotConfig[i]->nextWeapon != NULL)
492      printf("%p %p\n", this->currentSlotConfig[i]->currentWeapon, this->currentSlotConfig[i]->nextWeapon);*/
[4951]493
[6736]494    // current Weapon in Slot i
[10438]495    tickWeapon = this->currentSlotConfig[i]->getCurrentWeapon();
[6736]496    // On A change (current != next)
[10438]497    if (tickWeapon != this->currentSlotConfig[i]->getNextWeapon())
[4951]498    {
[6736]499      // if a Weapon is Active in slot i, deactivate it.
500      if (tickWeapon != NULL )
[4951]501      {
[6736]502        if (tickWeapon->isActive())
[4953]503        {
[6736]504          tickWeapon->requestAction(WA_DEACTIVATE);
505          continue;
[4953]506        }
[6055]507        else
[6736]508        {
509          tickWeapon->toList(OM_NULL);
[10438]510          this->currentSlotConfig[i]->setCurrentWeapon(NULL);
[6736]511        }
[4951]512      }
[6736]513      // switching to next Weapon
[10438]514      this->currentSlotConfig[i]->setCurrentWeapon(this->currentSlotConfig[i]->getNextWeapon());
515      tickWeapon = this->currentSlotConfig[i]->getCurrentWeapon();
[10437]516
[6736]517      if (tickWeapon != NULL)
518      {
[10368]519        //if (this->parent != NULL)
520        tickWeapon->toList(this->parentEntity->getOMListNumber());
[6736]521        tickWeapon->requestAction(WA_ACTIVATE);
[10437]522        this->currentSlotConfig[i]->activateNode();
523        tickWeapon->setParent(this->currentSlotConfig[i]);
[6736]524      }
525      else
[10437]526        this->currentSlotConfig[i]->deactivateNode();
[9869]527      if (this->parentEntity != NULL && this->parentEntity->isA(Playable::staticClassID()))
[8844]528        dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
[4951]529    }
[10544]530    else if (unlikely(tickWeapon != NULL && tickWeapon->getCurrentState() == WS_DEACTIVATING))
531      this->currentSlotConfig[i]->setCurrentWeapon(NULL);
[4826]532  }
533}
534
535
536/**
[4832]537 * triggers draw of all weapons in the current weaponconfig
[4826]538 */
[4951]539void WeaponManager::draw() const
[4826]540{
[8315]541  assert(false || "must not be called");
[4951]542  Weapon* drawWeapon;
543  for (int i = 0; i < this->slotCount; i++)
[4826]544  {
[10438]545    drawWeapon = this->currentSlotConfig[i]->getCurrentWeapon();
[4951]546    if( drawWeapon != NULL && drawWeapon->isVisible())
547      drawWeapon->draw();
[4826]548  }
549}
550
551
552/**
[4832]553 * private gets the next free slot in a certain weaponconfig
[6669]554 * @param the selected weaponconfig -1 if none found
[4826]555 */
[5440]556int WeaponManager::getNextFreeSlot(int configID, long capability)
[4826]557{
[6676]558  if (configID == -1)
[4826]559  {
[6676]560    for (configID = 0; configID < WM_MAX_CONFIGS; configID++)
561      for( int i = 0; i < this->slotCount; ++i)
562      {
563        if( this->configs[configID][i] == NULL &&
[10437]564            (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLKINDS) &&
565            (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLDIRS))
[6676]566          return i;
[6736]567      }
[4826]568  }
[6676]569  else
570  {
571    for( int i = 0; i < this->slotCount; ++i)
572    {
573      if( this->configs[configID][i] == NULL &&
[10437]574          (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLKINDS) &&
575          (this->currentSlotConfig[i]->getCapability() & capability & WTYPE_ALLDIRS))
[6676]576        return i;
577    }
578  }
[4826]579  return -1;
580}
581
[9869]582CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(const ClassID& projectileType)
[6669]583{
584  for (unsigned int i = 0; i < this->ammo.size(); i++)
585  {
586    if (this->ammo[i]->getProjectileType() == projectileType)
587      return this->ammo[i];
588  }
589  this->ammo.push_back(CountPointer<AmmoContainer>(new AmmoContainer(projectileType)));
590  return this->ammo.back();
591}
[4951]592
[6972]593CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(const Weapon* weapon)
594{
595  assert (weapon != NULL);
[9869]596  return (this->getAmmoContainer(weapon->getClassID()));
[6972]597}
[4951]598
[6972]599
[4953]600/**
601 * outputs some nice debug information about the WeaponManager
602 */
[4951]603void WeaponManager::debug() const
604{
605  PRINT(3)("WeaponManager Debug Information\n");
606  PRINT(3)("-------------------------------\n");
607  PRINT(3)("current Config is %d\n", this->currentConfigID);
608  for (int i = 0; i < WM_MAX_CONFIGS; i++)
609  {
610    PRINT(3)("Listing Weapons in Configuration %d\n", i);
611    for (int j = 0; j < WM_MAX_SLOTS; j++)
612    {
613      if (this->configs[i][j] != NULL)
[9406]614        PRINT(3)("Slot %d loaded a %s\n", j, this->configs[i][j]->getClassCName());
[4951]615    }
616  }
617}
[10437]618
619
620long WeaponManager::getSlotCapability(int slot) const
621{
622  return this->currentSlotConfig[slot]->getCapability();
623}
624
625const Vector& WeaponManager::getSlotPosition(int slot) const
626{
627  return this->currentSlotConfig[slot]->getRelCoor();
628}
629
630Weapon* WeaponManager::getWeapon(int slotID) const
631{
632  return (slotID >= 0 && slotID < this->slotCount)? this->currentSlotConfig[slotID]->getNextWeapon(): NULL;
633}
634
[10714]635/**
636 * processes the input
637 * @param event the Event coming as input
638 */
639// void WeaponManager::process(const Event &event)
640// {
641//   if  (event.type == EV_MOUSE_MOTION)
642//   {
643//     this->crosshair->process(event);
644// //     this->setAbsCoor2D(event.x, event.y);
645//   }
646// }
Note: See TracBrowser for help on using the repository browser.