Changeset 3862 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Apr 18, 2005, 9:15:08 AM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/weapon.cc
r3810 r3862 29 29 30 30 31 32 WeaponManager::WeaponManager(int nrOfSlots) 33 { 34 this->nrOfSlots = nrOfSlots; 35 this->nrOfConfigs = 1; 36 37 for(int i = 0; i < W_MAX_CONFS; ++i) 38 this->configs[i] = NULL; 39 this->currentConfig = new weaponConfig; 40 this->configs[0] = this->currentConfig; 41 } 42 43 WeaponManager::~WeaponManager() 44 { 45 46 } 47 48 void WeaponManager::addWeapon(Weapon* weapon, slotID slot, configID config) 49 { 50 if(this->configs[config] == NULL) 51 PRINTF(0)(""); 52 // this->configs[(int)config]-> 53 } 54 55 void WeaponManager::addWeaponConfig(weaponConfig* config) 56 {} 57 58 void WeaponManager::nextWeaponConf() 59 {} 60 61 void WeaponManager::prevWeaponConf() 62 {} 63 64 65 void WeaponManager::selectConfig(configID config) 66 { 67 if( this->configs[(int)config] != NULL) 68 this->currentConfig = this->configs[(int)config]; 69 else 70 PRINTF(0)("There is no weapon config defined with the number W_CONF%i", (int)config); 71 } 72 73 74 31 75 /** 32 76 \brief standard constructor -
orxonox/trunk/src/world_entities/weapon.h
r3685 r3862 18 18 o shooting animation 19 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... 20 27 */ 21 28 … … 26 33 #include "world_entity.h" 27 34 35 #define W_MAX_SLOTS 8 36 #define W_MAX_CONFS 4 37 28 38 class Projectile; 39 class Weapon; 29 40 30 41 typedef enum { … … 37 48 } weaponSoundType; 38 49 50 //! 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}; 53 54 //! this is an identifier for the weapon config 55 typedef enum configID {W_CONFIG0=0, W_CONFIG1, 56 W_CONFIG2, W_CONFIG3}; 57 58 //! this is a weapon Configuration: it has up to 8 slots 59 typedef 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 68 }; 69 70 71 class WeaponManager { 72 public: 73 WeaponManager(int nrOfSlots = 2); 74 ~WeaponManager(); 75 76 void addWeapon(Weapon* weapon, slotID slot, configID config = W_CONFIG0); 77 void addWeaponConfig(weaponConfig* config); 78 79 void nextWeaponConf(); 80 void prevWeaponConf(); 81 void selectConfig(configID config); 82 83 private: 84 int nrOfConfigs; //<! number of configurations defined 85 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 88 }; 39 89 40 90 class Weapon : public WorldEntity
Note: See TracChangeset
for help on using the changeset viewer.