Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3870 in orxonox.OLD for orxonox/trunk/src/world_entities/weapon.h


Ignore:
Timestamp:
Apr 18, 2005, 3:37:42 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: reimplemented WeaponManager, made it as simple as possible. not yet all done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/weapon.h

    r3862 r3870  
    3434
    3535#define W_MAX_SLOTS 8
    36 #define W_MAX_CONFS 4
     36#define W_MAX_CONFIGS 4
    3737
    3838class Projectile;
     
    4848} weaponSoundType;
    4949
     50
    5051//! this is an identifier for the slot. there are up to 8 weapon slots -> this means there can't be more than 8 weapons at the same time
    51 typedef enum slotID {W_SLOT0=0, W_SLOT1, W_SLOT2, W_SLOT3,
    52                      W_SLOT4, W_SLOT5, W_SLOT6, W_SLOT7};
     52#define W_SLOT0 0
     53#define W_SLOT1 1
     54#define W_SLOT2 2
     55#define W_SLOT3 3
     56#define W_SLOT4 4
     57#define W_SLOT5 5
     58#define W_SLOT6 6
     59#define W_SLOT7 7
     60#define W_FREE_SLOT 99
     61
    5362
    5463//! this is an identifier for the weapon config
    55 typedef enum configID {W_CONFIG0=0, W_CONFIG1,
    56                        W_CONFIG2, W_CONFIG3};
     64#define W_CONFIG0 0
     65#define W_CONFIG1 1
     66#define W_CONFIG2 2
     67#define W_CONFIG3 3
    5768
    5869//! this is a weapon Configuration: it has up to 8 slots
    5970typedef struct weaponConfig {
    60   Weapon* slot1;                    //<! standard right side weapon
    61   Weapon* slot2;                    //<! standard left side weapon
    62   Weapon* slot3;                    //<! custom
    63   Weapon* slot4;                    //<! custom
    64   Weapon* slot5;                    //<! custom
    65   Weapon* slot6;                    //<! custom
    66   Weapon* slot7;                    //<! custom
    67   Weapon* slot8;                    //<! custom
     71  bool bUsed;                       //<! is set to true, if this configuration is
     72  Weapon* slots[8];
    6873};
    6974
     
    7479  ~WeaponManager();
    7580 
    76   void addWeapon(Weapon* weapon, slotID slot, configID config = W_CONFIG0);
    77   void addWeaponConfig(weaponConfig* config);
     81  void addWeapon(Weapon* weapon, int slotID = W_FREE_SLOT, int configID = W_CONFIG1);
    7882
    7983  void nextWeaponConf();
    8084  void prevWeaponConf();
    81   void selectConfig(configID config);
     85  void selectConfig(int configID);
    8286
    8387 private:
    8488  int nrOfConfigs;                      //<! number of configurations defined
    8589  int nrOfSlots;                        //<! number of weapon slots a ship has
    86   weaponConfig* currentConfig;          //<! the currently selected config
    87   weaponConfig* configs[4];             //<! a list of four configurations
     90  int currConfID;                    //<! the currently selected config
     91  weaponConfig configs[4];              //<! a list of four configurations
     92 
     93  int getNextFreeSlot();
    8894};
    8995
Note: See TracChangeset for help on using the changeset viewer.