Changeset 3953 in orxonox.OLD for orxonox/branches/physics/src/world_entities/weapon.h
- Timestamp:
- Apr 25, 2005, 9:29:41 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/world_entities/weapon.h
r3862 r3953 34 34 35 35 #define W_MAX_SLOTS 8 36 #define W_MAX_CONF S 436 #define W_MAX_CONFIGS 4 37 37 38 38 class Projectile; 39 39 class Weapon; 40 class Animation3D; 40 41 41 42 typedef enum { … … 48 49 } weaponSoundType; 49 50 51 50 52 //! 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 #define W_SLOT0 0 54 #define W_SLOT1 1 55 #define W_SLOT2 2 56 #define W_SLOT3 3 57 #define W_SLOT4 4 58 #define W_SLOT5 5 59 #define W_SLOT6 6 60 #define W_SLOT7 7 61 #define W_FREE_SLOT 99 62 53 63 54 64 //! this is an identifier for the weapon config 55 typedef enum configID {W_CONFIG0=0, W_CONFIG1, 56 W_CONFIG2, W_CONFIG3}; 65 #define W_CONFIG0 0 66 #define W_CONFIG1 1 67 #define W_CONFIG2 2 68 #define W_CONFIG3 3 69 70 //! a weapon can be left or right sided 71 #define W_LEFT 0 72 #define W_RIGHT 1 57 73 58 74 //! this is a weapon Configuration: it has up to 8 slots 59 75 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 76 bool bUsed; //<! is set to true, if this configuration is 77 Weapon* slots[8]; 68 78 }; 69 79 … … 74 84 ~WeaponManager(); 75 85 76 void addWeapon(Weapon* weapon, slotID slot, configID config = W_CONFIG0); 77 void addWeaponConfig(weaponConfig* config); 86 void addWeapon(Weapon* weapon, int configID = W_CONFIG0, int slotID = W_FREE_SLOT); 87 void removeWeapon(Weapon* weapon, int configID = W_CONFIG0); 88 void nextWeaponConf(); 78 89 79 void nextWeaponConf();80 void prevWeaponConf();81 void selectConfig(configID config);90 void fire(); 91 void tick(float sec); 92 void draw(); 82 93 83 94 private: 84 int nrOfConfigs; //<! number of configurations defined85 95 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 96 int currConfID; //<! the currently selected config 97 weaponConfig configs[4]; //<! a list of four configurations 98 99 int getNextFreeSlot(int configID); 88 100 }; 89 101 … … 93 105 94 106 public: 95 Weapon (PNode* parent, Vector* coordinate, Quaternion*direction);107 Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction); 96 108 virtual ~Weapon (); 97 109 … … 107 119 bool isActive(void); 108 120 109 void setWeaponIdleTime(float time);110 float getWeaponIdleTime(void);111 bool hasWeaponIdleTimeElapsed(void);112 121 122 /** 123 \brief sets a weapon idle time 124 \param idle time in ms 125 126 a weapon idle time is the time spend after a shoot until the weapon can 127 shoot again 128 */ 129 inline void setWeaponIdleTime(float time) { this->idleTime = time; } 130 /** 131 \brief gets the weapon idle time 132 \returns idle time in ms 133 134 a weapon idle time is the time spend after a shoot until the weapon can 135 shoot again 136 */ 137 inline float getWeaponIdleTime(void) const { return this->idleTime;} 138 /** 139 \brief checks if the idle time is elapsed 140 \return true if time is elapsed 141 142 a weapon idle time is the time spend after a shoot until the weapon can 143 shoot again 144 */ 145 inline bool hasWeaponIdleTimeElapsed(void) const { return (this->localTime>this->idleTime)?true:false; } 146 147 /** 148 \brief fires the weapon 149 150 this is called from the player.cc, when fire-button is been pushed 151 */ 113 152 virtual void fire(void) = 0; 114 153 virtual void hit (WorldEntity* weapon, Vector* loc); … … 121 160 protected: 122 161 tList<WorldEntity>* worldEntities; 123 float localTime; 124 float idleTime; 125 float slowDownFactor; 162 float localTime; //<! this is the local time. important for shooting attributes like frequency 163 float idleTime; //<! the time a weapon needs before it can shoot again. eg. shooting frequency or actication/deactivateion delay 164 float slowDownFactor; //<! if the shooting frequency is a linear function of time... 165 166 PNode* objectComponent1; //<! the gun is made of multiple parts, these PNodes represent their location and orientation 167 PNode* objectComponent2; 168 PNode* objectComponent3; 169 170 Animation3D* animation1; 171 Animation3D* animation2; 172 Animation3D* animation3; 173 174 Vector projectileOffset; 175 int leftRight; // this will become an enum 126 176 127 177 private: 128 bool enabled; 129 Projectile* projectile; 178 bool enabled; //<! states if the weapon is enabled or not 179 Projectile* projectile; //<! the projectile used for this weapon 130 180 //WeaponSound sound; 131 181 };
Note: See TracChangeset
for help on using the changeset viewer.