Changeset 4949 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jul 24, 2005, 3:11:36 AM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.cc
r4929 r4949 171 171 this->nodes[i + j * this->maxIndex]->includesPoint(position); 172 172 else 173 PRINTF( 0)("Object has left terrain\n");173 PRINTF(5)("Object has left terrain\n"); 174 174 } 175 175 -
orxonox/trunk/src/world_entities/weapons/test_gun.h
r4947 r4949 1 1 /*! 2 \file weapon.h2 @file weapon.h 3 3 * a weapon that a player can use 4 4 5 5 A Player has a list of weapons, that can be choosen to shoot projectiles 6 (projectiles.{cc,h}) at en nemies. These weapons can be shooted sequentially6 (projectiles.{cc,h}) at enemies. These weapons can be shooted sequentially 7 7 or (if able) combined. Therefore you can choose the weapon mode = choose 8 8 a weapon. … … 26 26 #include "weapon.h" 27 27 28 class Projectile;29 class Vector;30 class Quaternion;31 class Animation3D;32 class TestBullet;33 34 35 28 class TestGun : public Weapon 36 29 { … … 50 43 private: 51 44 PNode* objectComponent1; //<! the gun is made of multiple parts, these PNodes represent their location and orientation 52 PNode* objectComponent2;53 PNode* objectComponent3;54 45 55 46 int leftRight; // this will become an enum -
orxonox/trunk/src/world_entities/weapons/weapon.cc
r4948 r4949 301 301 bool Weapon::deactivateW() 302 302 { 303 if (this->currentState != WS_INACTIVE)303 // if (this->currentState != WS_INACTIVE) 304 304 { 305 305 PRINTF(4)("Deactivating the Weapon %s\n", this->getName()); … … 403 403 inline void Weapon::enterState(WeaponState state) 404 404 { 405 PRINTF(3)("ENTERING STATE %s\n", stateToChar(state)); 405 406 // playing animation if availiable 406 407 if (likely(this->animation[state] != NULL)) … … 427 428 this->stateDuration -= dt; 428 429 429 if (this->isActive()) 430 { 431 if (this->stateDuration <= 0.0) 432 { 433 if (unlikely (this->currentState == WS_DEACTIVATING)) 434 { 435 this->currentState = WS_INACTIVE; 436 return; 437 } 438 else 439 this->currentState = WS_IDLE; 440 441 if (this->requestedAction != WA_NONE) 442 { 443 this->stateDuration = -dt; 444 this->execute(); 445 } 430 if (this->stateDuration <= 0.0) 431 { 432 if (unlikely (this->currentState == WS_DEACTIVATING)) 433 { 434 this->currentState = WS_INACTIVE; 435 return; 436 } 437 else 438 this->currentState = WS_IDLE; 439 440 if (this->requestedAction != WA_NONE) 441 { 442 this->stateDuration = -dt; 443 this->execute(); 446 444 } 447 445 } -
orxonox/trunk/src/world_entities/weapons/weapon.h
r4947 r4949 90 90 /** @returns true if the weapon must be drawn */ 91 91 inline bool isVisible() const { return (this->currentState != WS_INACTIVE || !this->hideInactive)?true:false; }; 92 /** @returns true if the Weapon is chargeable */ 93 inline bool isChargeable() const { return this->chargeable; }; 92 94 93 95 // FUNCTIONS TO SET THE WEAPONS PROPERTIES. -
orxonox/trunk/src/world_entities/weapons/weapon_manager.cc
r4926 r4949 40 40 } 41 41 42 WeaponManager::WeaponManager(const TiXmlElement* root) 43 { 44 this->init(); 45 this->loadParams(root); 46 } 42 47 43 48 /** … … 51 56 world will clean them up for me 52 57 */ 53 for(int i = 0; i < W _MAX_CONFIGS; ++i)58 for(int i = 0; i < WM_MAX_CONFIGS; ++i) 54 59 { 55 60 this->configs[i].bUsed = false; 56 for(int j = 0; j < W _MAX_SLOTS; ++j)61 for(int j = 0; j < WM_MAX_SLOTS; ++j) 57 62 this->configs[i].slots[j] = NULL; 58 63 } … … 69 74 this->setClassID(CL_WEAPON_MANAGER, "WeaponManager"); 70 75 71 for(int i = 0; i < W _MAX_CONFIGS; ++i)76 for(int i = 0; i < WM_MAX_CONFIGS; ++i) 72 77 { 73 78 this->configs[i].bUsed = false; 74 for(int j = 0; j < W _MAX_SLOTS; ++j)79 for(int j = 0; j < WM_MAX_SLOTS; ++j) 75 80 this->configs[i].slots[j] = NULL; 76 81 } … … 186 191 int i, lastConfID; 187 192 lastConfID = this->currConfID; 188 for(i = this->currConfID + 1; i < W _MAX_CONFIGS && !this->configs[i].bUsed; ++i);189 if( i == W _MAX_CONFIGS) this->currConfID = WM_CONFIG0;193 for(i = this->currConfID + 1; i < WM_MAX_CONFIGS && !this->configs[i].bUsed; ++i); 194 if( i == WM_MAX_CONFIGS) this->currConfID = WM_CONFIG0; 190 195 else this->currConfID = i; 191 196 192 197 193 198 Weapon *w1, *w2; 194 for(int j = 0; j < W _MAX_SLOTS; ++j)199 for(int j = 0; j < WM_MAX_SLOTS; ++j) 195 200 { 196 201 w1 = this->configs[lastConfID].slots[j]; … … 224 229 { 225 230 Weapon* firingWeapon; 226 for(int i = 0; i < W _MAX_SLOTS; ++i)231 for(int i = 0; i < WM_MAX_SLOTS; ++i) 227 232 { 228 233 firingWeapon = this->configs[this->currConfID].slots[i]; … … 241 246 { 242 247 Weapon* w; 243 for(int i = 0; i < W _MAX_SLOTS; ++i)248 for(int i = 0; i < WM_MAX_SLOTS; ++i) 244 249 { 245 250 w = this->configs[this->currConfID].slots[i]; … … 259 264 Weapon* w; 260 265 for (int j = 0; j < 4; ++j ) 261 for(int i = 0; i < W _MAX_SLOTS; ++i)266 for(int i = 0; i < WM_MAX_SLOTS; ++i) 262 267 { 263 268 w = this->configs[j].slots[i]; … … 274 279 int WeaponManager::getNextFreeSlot(int configID) 275 280 { 276 for( int i = 0; i < W _MAX_SLOTS; ++i)281 for( int i = 0; i < WM_MAX_SLOTS; ++i) 277 282 { 278 283 if( this->configs[configID].slots[i] == NULL) -
orxonox/trunk/src/world_entities/weapons/weapon_manager.h
r4930 r4949 35 35 template <class T> class tAnimation; 36 36 37 #define W_MAX_SLOTS 8 38 #define W_MAX_CONFIGS 4 37 #define WM_MAX_SLOTS 8 //!< How many slots the WeaponManager has at its max 38 #define WM_MAX_CONFIGS 4 //!< The maximum number of predefined Configurations 39 #define WM_MAX_LOADED_WEAPONS 20 //!< The 39 40 40 41 //! this is an identifier for the weapon config … … 66 67 } WM_SLOT; 67 68 69 typedef enum 70 { 71 WM_SLOTC_DIRECTIONAL = 1, 72 WM_SLOTC_TURRET = 2, 73 WM_SLOTC_ALLKINDS = 3, 74 75 WM_SLOTC_FORWARD = 4, 76 WM_SLOTC_BACKWARD = 8, 77 WM_SLOTC_LEFT = 16, 78 WM_SLOTC_RIGHT = 32, 79 WM_SLOTC_ALLDIRS = 60, 80 81 WM_SLOTC_ALL = 63, 82 } WM_SlotCapability; 83 84 typedef struct WM_Slot 85 { 86 int number; 87 bool occupied; 88 long capability; 89 90 Weapon* currentWeapon; 91 Weapon* nextWeapon; 92 }; 93 68 94 //! this is a weapon Configuration: it has up to 8 slots 69 95 typedef struct 70 96 { 71 97 bool bUsed; //!< is set to true, if this configuration is 72 Weapon* slots[ 8];98 Weapon* slots[WM_MAX_SLOTS]; 73 99 } weaponConfig; 74 100 … … 99 125 private: 100 126 Crosshair* crosshair; //!< an aim. 101 tAnimation<Crosshair>* crossHairSizeAnim; 127 tAnimation<Crosshair>* crossHairSizeAnim; //!< An animation for the crosshair (scaling) 102 128 103 int slotCount; //<! number of weapon slots a ship has 104 int currConfID; //<! the currently selected config 105 weaponConfig configs[4]; //<! a list of four configurations 129 int slotCount; //!< number of weapon slots a ship has 130 int currConfID; //!< the currently selected config 131 weaponConfig configs[4]; //!< a list of four configurations 132 133 Weapon* availiableWeapons[WM_MAX_LOADED_WEAPONS]; 106 134 };
Note: See TracChangeset
for help on using the changeset viewer.