Changeset 4963 in orxonox.OLD for orxonox/trunk/src/world_entities/weapons
- Timestamp:
- Jul 28, 2005, 2:43:15 PM (19 years ago)
- Location:
- orxonox/trunk/src/world_entities/weapons
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/weapons/turret.cc
r4962 r4963 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 12 10 13 11 ### File Specific 14 main-programmer: Patrick Boenzli12 main-programmer: Benjamin Grauer 15 13 co-programmer: 16 17 18 @todo: direction in which the projectile flights19 @todo: a target to set/hit20 14 */ 21 15 22 16 23 #include "t est_gun.h"17 #include "turret.h" 24 18 25 #include "world_entity.h" 26 #include "model.h" 19 #include "weapon_manager.h" 27 20 #include "test_bullet.h" 28 #include "weapon_manager.h"29 21 30 22 #include "state.h" … … 45 37 creates a new weapon 46 38 */ 47 T estGun::TestGun (WeaponManager* weaponManager, int leftRight)39 Turret::Turret (WeaponManager* weaponManager) 48 40 : Weapon(weaponManager) 49 41 { 50 this->setClassID(CL_T EST_GUN, "TestGun");42 this->setClassID(CL_TURRET, "Turret"); 51 43 52 this->model = (Model*)ResourceManager::getInstance()->load("models/t est_gun.obj", OBJ, RP_CAMPAIGN);44 this->model = (Model*)ResourceManager::getInstance()->load("models/turret1.obj", OBJ, RP_CAMPAIGN); 53 45 this->leftRight = leftRight; 54 46 55 this->objectComponent1 = new PNode();47 /* this->objectComponent1 = new PNode(); 56 48 Animation3D* animation1 = this->getAnimation(WS_SHOOTING, this->objectComponent1); 57 49 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); … … 91 83 animation3->addKeyFrame(Vector(.0, .0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 92 84 animation3->addKeyFrame(Vector(.0, .0, 1.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 93 } 94 /* 95 this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV); 96 this->weaponSource = new SoundSource(this->fireSound, this); 97 this->weaponSource->setRolloffFactor(.1);*/ 98 Projectile* p = new TestBullet(); 85 }*/ 99 86 100 87 // ObjectManager::getInstance()->cache(CL_TEST_BULLET, 100, p); … … 120 107 * standard deconstructor 121 108 */ 122 T estGun::~TestGun()109 Turret::~Turret () 123 110 { 124 111 // model will be deleted from WorldEntity-destructor … … 133 120 been armed out. 134 121 */ 135 void T estGun::activate()122 void Turret::activate() 136 123 { 137 124 } … … 145 132 been armed out. 146 133 */ 147 void T estGun::deactivate()134 void Turret::deactivate() 148 135 { 149 136 } … … 156 143 @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent 157 144 */ 158 void T estGun::fire()145 void Turret::fire() 159 146 { 160 147 Projectile* pj = dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect()); … … 177 164 178 165 /** 179 * is called, when the weapon gets hit (=collide with something)180 * @param from which entity it is been hit181 * @param where it is been hit182 183 this may not be used, since it would make the game relay complicated when one184 can destroy the weapons of enemies or vice versa.185 */186 void TestGun::hit (WorldEntity* entity, Vector* position)187 {}188 189 190 /**191 166 * is called, when the weapon is destroyed 192 167 … … 194 169 hit, it can also be destoryed. 195 170 */ 196 void T estGun::destroy ()171 void Turret::destroy () 197 172 {} 198 173 … … 200 175 * this will draw the weapon 201 176 */ 202 void T estGun::draw ()177 void Turret::draw () 203 178 { 204 179 this->getWeaponManager()->getFixedTarget()->debugDraw(10); … … 213 188 this->getAbsDir ().matrix (matrix); 214 189 glMultMatrixf((float*)matrix); 215 if( this->leftRight == W_RIGHT)216 glScalef(1.0, 1.0, -1.0);217 this->model->draw(1);218 glPopMatrix();219 190 220 /* draw objectComponent1: gun coil - animated stuff */ 221 glMatrixMode(GL_MODELVIEW); 222 glPushMatrix(); 223 glTranslatef (this->objectComponent1->getAbsCoor ().x, 224 this->objectComponent1->getAbsCoor ().y, 225 this->objectComponent1->getAbsCoor ().z); 226 this->objectComponent1->getAbsDir ().matrix (matrix); 227 glMultMatrixf((float*)matrix); 228 this->model->draw(0); 191 this->model->draw(); 229 192 glPopMatrix(); 230 193 } -
orxonox/trunk/src/world_entities/weapons/turret.h
r4962 r4963 1 1 /*! 2 @file weapon.h 3 * a weapon that a player can use 4 5 A Player has a list of weapons, that can be choosen to shoot projectiles 6 (projectiles.{cc,h}) at enemies. These weapons can be shooted sequentially 7 or (if able) combined. Therefore you can choose the weapon mode = choose 8 a weapon. 9 10 A weapon is characterized by: 11 o firing-rate: the initial firing rate of a weapon (1/s = Herz) 12 o slowdown-factor: this is a factor d: exp(-d*x), d is element of all positive R. it determines how fast the firing-rate will slow down. if no slowdown: d=0, the bigger d is, the faster the weapon will slow down! 13 o energy-consumption: this determines the energy that has to be used to produce this projectile = costs per projectile 14 15 Furthermore there are some other attributes, that will help to represent a firing 16 weapon in this world: 17 o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented 18 o shooting animation 19 2 * @file turret.h 20 3 */ 21 4 22 5 23 #ifndef _T EST_GUN_H24 #define _T EST_GUN_H6 #ifndef _TURRET_H 7 #define _TURRET_H 25 8 26 9 #include "weapon.h" 27 10 28 29 //! a weapon can be left or right sided 30 /** 31 * @todo this will be reset with mirror X/Y/Z 32 */ 33 #define W_LEFT 0 34 #define W_RIGHT 1 35 36 37 class TestGun : public Weapon 11 class Turret : public Weapon 38 12 { 39 13 public: 40 T estGun (WeaponManager* weaponManager, int leftRight);41 virtual ~T estGun();14 Turret (WeaponManager* weaponManager); 15 virtual ~Turret (); 42 16 43 17 virtual void activate(); … … 45 19 46 20 virtual void fire(); 47 virtual void hit (WorldEntity* weapon, Vector* loc);48 21 virtual void destroy(); 49 22 … … 55 28 int leftRight; // this will become an enum 56 29 }; 57 #endif /* _T EST_GUN_H */30 #endif /* _TURRET_H */
Note: See TracChangeset
for help on using the changeset viewer.