Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4954 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jul 25, 2005, 2:16:23 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: doxygen-tags (and flush)

Location:
orxonox/trunk/src/world_entities
Files:
4 edited

Legend:

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

    r4953 r4954  
    104104  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
    105105  bFire = false;
    106   this->bWeaponChange = false;
    107106  acceleration = 10.0;
    108107
     
    263262    {
    264263      this->weaponMan->fire();
    265     }
    266   if( this->bWeaponChange)
    267     {
    268       this->weaponMan->nextWeaponConf();
    269       this->bWeaponChange = false;
    270264    }
    271265}
     
    287281      this->bFire = event.bPressed;
    288282  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
    289     this->weaponMan->nextWeaponConf();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
     283    this->weaponMan->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    290284  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    291285    this->weaponMan->previousWeaponConfig();
  • orxonox/trunk/src/world_entities/player.h

    r4885 r4954  
    6262    bool                  bDescend;           //!< descend button presses.
    6363    bool                  bFire;              //!< fire button pressed.
    64     bool                  bWeaponChange;      //!< weapon change button pressed
    6564
    6665    WeaponManager*        weaponMan;          //!< the weapon manager: managing a list of weapon to wepaon-slot mapping
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.cc

    r4953 r4954  
    203203
    204204/**
     205 * sets the capabilities of a Slot
     206 * @param slot the slot to set the capability
     207 * @param slotCapability the capability @see WM_SlotCapability
     208 */
     209void WeaponManager::setSlotCapability(int slot, long slotCapability)
     210{
     211  if (slot > slotCount)
     212    return;
     213  this->currentSlotConfig[slot].capability = slotCapability;
     214}
     215
     216
     217/**
    205218 * removes a Weapon from the WeaponManager
     219 *
     220 * !! The weapon must be inactive before you can delete it,    !!
     221 * !! because it will still be deactivated (if it is selected) !!
    206222 */
    207223void WeaponManager::removeWeapon(Weapon* weapon, int configID)
    208224{
    209   /* empty */
     225  if (weapon == NULL)
     226    return;
     227  if (configID < 0)
     228  {
     229    for (int j = 0; j < WM_MAX_SLOTS; j++)
     230    {
     231      for (int i = 0; i < WM_MAX_CONFIGS; i++)
     232      {
     233        if (this->configs[i][j] == weapon)
     234          this->configs[i][j] = NULL;
     235      }
     236      if (this->currentSlotConfig[j].currentWeapon == weapon)
     237      {
     238        this->currentSlotConfig[j].nextWeapon = NULL;
     239      }
     240    }
     241  }
    210242}
    211243
     
    214246 * changes to the next weapon configuration
    215247 */
    216 void WeaponManager::nextWeaponConf()
     248void WeaponManager::nextWeaponConfig()
    217249{
    218250  ++this->currentConfigID;
  • orxonox/trunk/src/world_entities/weapons/weapon_manager.h

    r4953 r4954  
    11/*!
    2     \file weapon.h
    3   *  a weapon that a player can use
    4 
    5     A Player has a list of weapons, that can be choosen to shoot projectiles
    6     (projectiles.{cc,h}) at ennemies. These weapons can be shooted sequentially
    7     or (if able) combined. Therefore you can choose the weapon mode = choose
    8     a weapon.
    9 
    10     A weapon is characterized by:
    11      o firing-rate: the initial firing rate of a weapon (1/s = Herz)
    12      o slowdown-factor: this is a factor d: exp(-d*x), d is element of all positive R. it determines how fast the firing-rate will slow down. if no slowdown: d=0, the bigger d is, the faster the weapon will slow down!
    13      o energy-consumption: this determines the energy that has to be used to produce this projectile = costs per projectile
    14 
    15     Furthermore there are some other attributes, that will help to represent a firing
    16     weapon in this world:
    17      o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented
    18      o shooting animation
    19 
    20 
    21      a player defines one or more weapon configurations. a player has got one to eight
    22      weapon slots: places where weapons can be attached to. a weapon configuration
    23      is a matching between weapons and slots.
    24      Since its clear how many weapons a player will have, there is no list of weapons:
    25      its hard coded and limited to 8 slots and 4 configs. More would be a waste of
    26      memory and time you need to customize and change to a weapon config...
     2 * @file weapon_manager.h
     3 * every big WorldEntity has the ability to carry many different Weapons.
     4 * for this to be easy there is the WeaponManager, that handels these weapons,
     5 * and changes between them.
     6 *
     7 *
     8 *
     9 * @TODO 1. WeaponManager should also handle a List of availiableWeapons.
     10 * @TODO 2. Weapons should now Types the counteract to capabilities, so we know where we can put them on the ship.
    2711 */
    2812
     
    9074    // setting up the WeaponManager with the following functions
    9175    void setSlotPosition(int slot, const Vector& position);
    92     void setSlotCapability(long slotCapability);
     76    /** @param slot the slot to get the relative position from @returns the relative position of the Carrier to the Slot */
     77    const Vector& getSlotPosition(int slot) const { return this->currentSlotConfig[slot].position.getRelCoor(); };
     78    void setSlotCapability(int slot, long slotCapability);
     79    /** @param slot the slot to get the capabilities from @returns the capabilies */
     80    long getSlotCapability(int slot) const { return this->currentSlotConfig[slot].capability; };
     81
    9382    void setParent(PNode* parent);
     83    /** @returns the Parent (carrier) of this WeaponManager */
     84    PNode* getParent() const { return this->parent; };
    9485
    9586    void addWeapon(Weapon* weapon, int configID = -1, int slotID = -1);
    9687    void removeWeapon(Weapon* weapon, int configID = -1);
    9788
    98     void nextWeaponConf();
     89    void nextWeaponConfig();
    9990    void previousWeaponConfig();
    10091    void changeWeaponConfig(int weaponConfig);
     
    113104
    114105  private:
    115     PNode*                  parent;                                  //!< The parent, this WeaponManager is connected to.
     106    PNode*                  parent;                                   //!< The parent, this WeaponManager is connected to.
    116107
    117     int                     slotCount;                               //!< number of weapon slots the ship has.
    118     int                     currentConfigID;                         //!< the currently selected config.
    119     Weapon*                 configs[WM_MAX_CONFIGS][WM_MAX_SLOTS];   //!< An array of predefined configurations and assigned weapon.
    120     WM_Slot                 currentSlotConfig[WM_MAX_SLOTS];         //!< The currentConfigureation.
     108    int                     slotCount;                                //!< number of weapon slots the ship has.
     109    int                     currentConfigID;                          //!< the currently selected config.
     110    Weapon*                 configs[WM_MAX_CONFIGS][WM_MAX_SLOTS];    //!< An array of predefined configurations and assigned weapon.
     111    WM_Slot                 currentSlotConfig[WM_MAX_SLOTS];          //!< The currentConfigureation.
    121112
    122     Weapon*                 availiableWeapons[WM_MAX_LOADED_WEAPONS];
     113    Weapon*                 availiableWeapons[WM_MAX_LOADED_WEAPONS]; //!< The availiable Weapons of this WeaponManager
    123114
    124115    bool                    weaponChange;
    125116
    126     Crosshair*              crosshair;                               //!< an aim.
    127     tAnimation<Crosshair>*  crossHairSizeAnim;                       //!< An animation for the crosshair (scaling)
     117    Crosshair*              crosshair;                                //!< an aim.
     118    tAnimation<Crosshair>*  crossHairSizeAnim;                        //!< An animation for the crosshair (scaling)
    128119};
Note: See TracChangeset for help on using the changeset viewer.