Changeset 6810 in orxonox.OLD for trunk/src/world_entities/weapons
- Timestamp:
- Jan 28, 2006, 3:30:54 PM (19 years ago)
- Location:
- trunk/src/world_entities/weapons
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/weapons/hyperblaster.cc
r6807 r6810 12 12 13 13 ### File Specific 14 main-programmer: Patrick Boenzli14 main-programmer: Benjamin Grauer 15 15 co-programmer: 16 16 … … 21 21 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 22 22 23 #include " cannon.h"23 #include "hyperblaster.h" 24 24 25 25 #include "world_entity.h" … … 38 38 using namespace std; 39 39 40 CREATE_FACTORY( Cannon, CL_CANNON);40 CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER); 41 41 42 /** 43 * standard constructor 44 45 creates a new weapon 46 */ 47 Cannon::Cannon () 48 : Weapon() 49 { 50 this->init(); 51 } 52 53 54 Cannon::Cannon(const TiXmlElement* root) 42 Hyperblaster::Hyperblaster(const TiXmlElement* root) 55 43 { 56 44 this->init(); … … 62 50 * standard deconstructor 63 51 */ 64 Cannon::~Cannon()52 Hyperblaster::~Hyperblaster () 65 53 { 66 54 // model will be deleted from WorldEntity-destructor … … 68 56 69 57 70 void Cannon::init()58 void Hyperblaster::init() 71 59 { 72 this->setClassID(CL_ CANNON, "Cannon");60 this->setClassID(CL_HYPERBLASTER, "Hyperblaster"); 73 61 74 62 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); … … 77 65 78 66 this->setStateDuration(WS_SHOOTING, 2.0); 79 this->setStateDuration(WS_RELOADING, .1);67 this->setStateDuration(WS_RELOADING, 5.0); 80 68 this->setStateDuration(WS_ACTIVATING, .1); 81 69 this->setStateDuration(WS_DEACTIVATING, .4); 82 70 83 this->setEnergyMax(10 0);84 this->increaseEnergy(10 0);71 this->setEnergyMax(10); 72 this->increaseEnergy(10); 85 73 //this->minCharge = 2; 86 74 87 75 this->setActionSound(WA_SHOOT, "sound/explo.wav"); 88 this->setActionSound(WA_ACTIVATE, "sound/voices/ cannon.wav");76 this->setActionSound(WA_ACTIVATE, "sound/voices/hyperblaster.wav"); 89 77 90 78 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY); 91 this->setProjectileType(CL_ BOMB);92 this->prepareProjectiles( 5);79 this->setProjectileType(CL_HYPERBLAST); 80 this->prepareProjectiles(2); 93 81 94 82 // this->objectComponent1 = new PNode(); … … 109 97 // animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_NULL); 110 98 111 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 99 animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 100 animation2->addKeyFrame(Vector(1.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 112 101 animation2->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 113 102 114 103 animation3->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 115 animation3->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 104 animation3->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 105 animation2->addKeyFrame(Vector(1.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); 116 106 } 117 107 118 108 119 void Cannon::loadParams(const TiXmlElement* root)109 void Hyperblaster::loadParams(const TiXmlElement* root) 120 110 { 121 111 Weapon::loadParams(root); … … 130 120 been armed out. 131 121 */ 132 void Cannon::activate()122 void Hyperblaster::activate() 133 123 { 134 124 } … … 142 132 been armed out. 143 133 */ 144 void Cannon::deactivate()134 void Hyperblaster::deactivate() 145 135 { 146 136 } … … 153 143 @todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent 154 144 */ 155 void Cannon::fire()145 void Hyperblaster::fire() 156 146 { 157 147 Projectile* pj = this->getProjectile(); … … 174 164 * hit, it can also be destoryed. 175 165 */ 176 void Cannon::destroy ()166 void Hyperblaster::destroy () 177 167 {} 178 179 /**180 * this will draw the weapon181 */182 void Cannon::draw () const183 {184 /* draw gun body */185 glMatrixMode(GL_MODELVIEW);186 glPushMatrix();187 glTranslatef (this->getAbsCoor ().x,188 this->getAbsCoor ().y,189 this->getAbsCoor ().z);190 191 Vector tmpRot = this->getAbsDir().getSpacialAxis();192 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );193 194 this->getModel()->draw();195 glPopMatrix();196 197 /* draw objectComponent1: gun coil - animated stuff */198 /* glMatrixMode(GL_MODELVIEW);199 glPushMatrix();200 glTranslatef (this->objectComponent1->getAbsCoor ().x,201 this->objectComponent1->getAbsCoor ().y,202 this->objectComponent1->getAbsCoor ().z);203 tmpRot = this->objectComponent1->getAbsDir().getSpacialAxis();204 glRotatef (this->objectComponent1->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );205 this->model->draw(0);206 207 glPopMatrix();*/208 }209 -
trunk/src/world_entities/weapons/hyperblaster.h
r6807 r6810 1 1 /*! 2 * @file cannon.h3 * a weapon that is fix on top of the player to fire heavy weaponary.2 * @file hyperblaster.h 3 * a weapon that to fire heavy weaponary Hyperblasts. 4 4 */ 5 5 6 6 7 #ifndef _ CANNON_H8 #define _ CANNON_H7 #ifndef _HYPERBLASTER_H 8 #define _HYPERBLASTER_H 9 9 10 10 #include "weapon.h" 11 11 12 class Cannon: public Weapon12 class Hyperblaster : public Weapon 13 13 { 14 14 public: 15 Cannon (); 16 Cannon (const TiXmlElement* root); 17 virtual ~Cannon (); 15 Hyperblaster (const TiXmlElement* root = NULL); 16 virtual ~Hyperblaster (); 18 17 19 18 void init(); … … 26 25 virtual void destroy(); 27 26 28 virtual void draw() const;29 30 27 private: 31 28 // PNode* objectComponent1; //<! the gun is made of multiple parts, these PNodes represent their location and orientation 32 29 }; 33 #endif /* _ CANNON_H */30 #endif /* _HYPERBLASTER_H */
Note: See TracChangeset
for help on using the changeset viewer.