Changeset 4955 in orxonox.OLD for orxonox/trunk/src/world_entities/weapons
- Timestamp:
- Jul 25, 2005, 3:48:55 PM (19 years ago)
- Location:
- orxonox/trunk/src/world_entities/weapons
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/weapons/crosshair.cc
r4865 r4955 165 165 gluUnProject(position2D[0], 166 166 GraphicsEngine::getInstance()->getResolutionY()-position2D[1]-1, 167 .99, 167 .99, // z 168 168 GraphicsEngine::modMat, 169 169 GraphicsEngine::projMat, … … 183 183 void Crosshair::draw() const 184 184 { 185 GraphicsEngine::storeMatrices();186 187 188 189 190 185 // glBegin(GL_TRIANGLES); 191 186 // glColor3f(1,0,0); … … 194 189 // glVertex3f(objX, objY, objZ+1); 195 190 // glEnd(); 196 197 this->debugDraw(); 198 199 GraphicsEngine::enter2DMode(); 191 glPushMatrix(); 200 192 GLdouble pos[3]; 201 193 gluProject(this->getAbsCoor().x, … … 221 213 glVertex2f(size, size); 222 214 glEnd(); 223 224 GraphicsEngine::leave2DMode(); 225 } 215 glPopMatrix(); 216 217 } -
orxonox/trunk/src/world_entities/weapons/projectile.cc
r4948 r4955 91 91 void Projectile::setVelocity(const Vector &velocity) 92 92 { 93 Vector offsetVel = this->velocity = velocity; 94 offsetVel.normalize(); 95 this->velocity += (offsetVel * 50.0); 93 //Vector offsetVel = 94 this->velocity = velocity; 95 // offsetVel.normalize(); 96 //this->velocity += (offsetVel * 50.0); 96 97 } 97 98 -
orxonox/trunk/src/world_entities/weapons/test_gun.cc
r4953 r4955 26 26 #include "model.h" 27 27 #include "test_bullet.h" 28 #include "weapon_manager.h" 28 29 29 30 #include "state.h" … … 44 45 creates a new weapon 45 46 */ 46 TestGun::TestGun (int leftRight) 47 TestGun::TestGun (WeaponManager* weaponManager, int leftRight) 48 : Weapon(weaponManager) 47 49 { 48 50 this->setClassID(CL_TEST_GUN, "TestGun"); … … 158 160 Projectile* pj = dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect()); 159 161 162 PNode* target = this->getWeaponManager()->getFixedTarget(); 163 164 if (target != NULL) 165 { 166 target->debugDraw(); 167 Vector test = ((target->getAbsCoor() - this->getAbsCoor())*5); 168 pj->setVelocity(test/20.0);//this->getVelocity()); 169 } 170 else 171 pj->setVelocity(target->getVelocity()); 172 173 160 174 pj->setAbsCoor(this->getEmissionPoint()); 161 175 pj->setAbsDir(this->getAbsDir()); 162 pj->setVelocity(this->getVelocity());163 176 State::getWorldEntityList()->add(pj); 164 177 } … … 191 204 void TestGun::draw () 192 205 { 206 this->getWeaponManager()->getFixedTarget()->debugDraw(10); 207 193 208 /* draw gun body */ 194 209 glMatrixMode(GL_MODELVIEW); -
orxonox/trunk/src/world_entities/weapons/test_gun.h
r4953 r4955 29 29 { 30 30 public: 31 TestGun ( int leftRight);31 TestGun (WeaponManager* weaponManager, int leftRight); 32 32 virtual ~TestGun (); 33 33 -
orxonox/trunk/src/world_entities/weapons/weapon.cc
r4953 r4955 39 39 * creates a new weapon 40 40 */ 41 Weapon::Weapon ( )41 Weapon::Weapon (WeaponManager* weaponManager) 42 42 { 43 43 this->init(); 44 this->setWeaponManager(weaponManager); 44 45 } 45 46 … … 88 89 this->energy = .0; 89 90 this->energyMax = 10.0; 91 92 this->setWeaponManager(NULL); 90 93 } 91 94 -
orxonox/trunk/src/world_entities/weapons/weapon.h
r4953 r4955 24 24 // FORWARD DECLARATION 25 25 class Projectile; 26 class Weapon ;26 class WeaponManager; 27 27 class Animation3D; 28 28 class TiXmlElement; … … 72 72 public: 73 73 // INITIALISATION // 74 Weapon ( );74 Weapon (WeaponManager* weaponManager = NULL); 75 75 Weapon(const TiXmlElement* root); 76 76 virtual ~Weapon (); … … 85 85 /////////////////// 86 86 87 /** @param weaponManager sets the WeaponManager for this Weapon (NULL if free))*/ 88 inline void setWeaponManager(WeaponManager* weaponManager) { this->weaponManager = weaponManager; }; 89 /** @returns the WeaponManager of this Weapon (or NULL if it is free) */ 90 inline WeaponManager* getWeaponManager() const { return this->weaponManager; }; 87 91 88 92 /** @returns true if the Weapon is Active (this is used to check if the weapon must be drawn)*/ … … 199 203 ClassID projectile; //!< the projectile used for this weapon (since they should be generated via macro and the FastFactory, only the ClassID must be known.) 200 204 FastFactory* projectileFactory; //!< A factory, that produces and handles the projectiles. 205 206 WeaponManager* weaponManager; //!< The weaponManager this weapon is connected to. if NULL it is assumed, that the weapon is freely connected to an entity without a binding WeaponManager. 201 207 }; 202 208 -
orxonox/trunk/src/world_entities/weapons/weapon_manager.h
r4954 r4955 14 14 15 15 #include "p_node.h" 16 #include "crosshair.h" 16 17 17 18 // FORWARD DECLARATION 18 19 class PNode; 19 20 class Weapon; 20 class Crosshair;21 21 template <class T> class tAnimation; 22 22 … … 87 87 void removeWeapon(Weapon* weapon, int configID = -1); 88 88 89 90 89 91 void nextWeaponConfig(); 90 92 void previousWeaponConfig(); 91 93 void changeWeaponConfig(int weaponConfig); 92 94 95 /** @returns a fixed target namely the Crosshair's 3D position */ 96 inline PNode* getFixedTarget() { return this->crosshair; } 93 97 void fire(); 94 98
Note: See TracChangeset
for help on using the changeset viewer.