Changeset 10648 in orxonox.OLD for branches/vs-enhencements/src/world_entities
- Timestamp:
- May 4, 2007, 9:53:07 AM (18 years ago)
- Location:
- branches/vs-enhencements/src/world_entities
- Files:
-
- 13 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/vs-enhencements/src/world_entities/WorldEntities.am
r10645 r10648 34 34 world_entities/weapons/acid_launcher.cc \ 35 35 world_entities/weapons/rf_cannon.cc \ 36 world_entities/weapons/disruptor.cc \ 37 world_entities/weapons/nadion_laser.cc \ 36 38 \ 37 39 world_entities/projectiles/lbolt.cc \ … … 187 189 weapons/acid_launcher.h \ 188 190 weapons/rf_cannon.h \ 191 weapons/disruptor.h \ 192 weapons/nadion_laser.h \ 189 193 \ 190 194 projectiles/lbolt.h \ -
branches/vs-enhencements/src/world_entities/npcs/npc.cc
r10618 r10648 407 407 { 408 408 int slot = ws->getWeaponSlot(); 409 int side = ws->getWeaponSide(); 409 // int side = ws->getWeaponSide(); //FIXME / REMOVE: is not used 410 410 this->getWeaponManager().setSlotPosition(slot, (*it).second->getCenter()); 411 411 this->getWeaponManager().setSlotDirection(slot, ws->getRelDir()); -
branches/vs-enhencements/src/world_entities/projectiles/plasma_pulse.cc
r10646 r10648 25 25 #include "debug.h" 26 26 27 // #include "effects/wobblegrid.h"28 29 30 27 31 28 ObjectListDefinition(PlasmaPulse); … … 39 36 this->registerObject(this, PlasmaPulse::_objectList); 40 37 41 // srand(time(0)); //initialize Random Nomber Generator42 43 //this->loadModel("models/projectiles/laser.obj");44 38 45 39 this->setMinEnergy(1); 46 40 this->setHealthMax(0); 47 41 this->lifeSpan = 3.0; 48 // this->angle = 0;49 42 50 43 this->grid = new Billboard(); … … 87 80 this->lifeCycle = 0.0; 88 81 89 // this->hide();90 82 this->grid->setVisibility(false); 91 83 this->lifeCycle = 0.0; 92 84 this->toList(OM_NULL); 93 //this->toList(OM_DEAD);94 85 this->removeNode(); 95 86 … … 136 127 void PlasmaPulse::draw () const 137 128 { 138 this->grid->draw(); 129 glPushMatrix(); 130 glEnable( GL_ALPHA_TEST); 131 glAlphaFunc( GL_GEQUAL, .5); 132 this->grid->draw(); 133 glPopMatrix(); 134 139 135 } -
branches/vs-enhencements/src/world_entities/projectiles/plasma_pulse.h
r10646 r10648 33 33 static FastFactory* fastFactory; 34 34 Billboard* grid; 35 36 // WorldEntity* hitEntity; // FIXME TEMPORARY37 35 }; 38 36 -
branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc
r10644 r10648 27 27 #include "weapons/heavy_blaster.h" 28 28 #include "weapons/rf_cannon.h" 29 #include "weapons/nadion_laser.h" 30 #include "weapons/disruptor.h" 29 31 #include "weapons/swarm_launcher.h" 30 32 #include "weapons/spike_thrower.h" … … 166 168 Weapon* wpLeft1 = new RFCannon (); 167 169 wpLeft1->setName( "RFCannon"); 168 170 /* 169 171 Weapon* wpRight2 = new MediumBlaster (); 170 172 wpRight2->setName( "MediumBlaster"); 171 173 Weapon* wpLeft2 = new MediumBlaster (); 172 wpLeft2->setName( "MediumBlaster"); 173 174 wpLeft2->setName( "MediumBlaster");*/ 175 176 Weapon* wpRight2 = new NadionLaser (); 177 wpRight2->setName( "NadionLaser"); 178 Weapon* wpLeft2 = new NadionLaser (); 179 wpLeft2->setName( "NadionLaser"); 180 /* 174 181 Weapon* wpRight3 = new HeavyBlaster (1); 175 182 wpRight3->setName( "HeavyBlaster"); 176 183 Weapon* wpLeft3 = new HeavyBlaster (0); 177 wpLeft3->setName( "HeavyBlaster"); 184 wpLeft3->setName( "HeavyBlaster");*/ 185 186 Weapon* wpRight3 = new Disruptor (); 187 wpRight3->setName( "Disruptor"); 188 Weapon* wpLeft3 = new Disruptor (); 189 wpLeft3->setName( "Disruptor"); 178 190 179 191 Weapon* cannon = new SwarmLauncher(); -
branches/vs-enhencements/src/world_entities/weapons/disruptor.cc
r10645 r10648 15 15 */ 16 16 17 #include " heavy_blaster.h"17 #include "disruptor.h" 18 18 #include "world_entities/projectiles/projectile.h" 19 19 … … 29 29 #include "elements/glgui_energywidgetvertical.h" 30 30 31 CREATE_FACTORY( HeavyBlaster);32 // ObjectListDefinition( HeavyBlaster);31 CREATE_FACTORY(Disruptor); 32 // ObjectListDefinition(Disruptor); 33 33 34 34 … … 37 37 * Standard constructor 38 38 */ 39 HeavyBlaster::HeavyBlaster (int leftRight)39 Disruptor::Disruptor () 40 40 : Weapon() 41 41 { 42 // this->registerObject(this, HeavyBlaster::_objectList);43 44 this->init( leftRight);45 } 46 47 HeavyBlaster::HeavyBlaster (const TiXmlElement* root = NULL)42 // this->registerObject(this, Disruptor::_objectList); 43 44 this->init(); 45 } 46 47 Disruptor::Disruptor (const TiXmlElement* root = NULL) 48 48 : Weapon() 49 49 { 50 // this->registerObject(this, HeavyBlaster::_objectList);50 // this->registerObject(this, Disruptor::_objectList); 51 51 52 52 // TODO add leftRight to params 53 this->init( 0);53 this->init(); 54 54 if (root != NULL) 55 55 this->loadParams(root); … … 59 59 * Default destructor 60 60 */ 61 HeavyBlaster::~HeavyBlaster()61 Disruptor::~Disruptor() 62 62 { 63 63 for (int i = 0; i < this->getBarrels(); i++) … … 85 85 } 86 86 87 void HeavyBlaster::loadParams(const TiXmlElement* root)87 void Disruptor::loadParams(const TiXmlElement* root) 88 88 { 89 89 Weapon::loadParams(root); 90 90 } 91 91 92 void HeavyBlaster::init(int leftRight) 93 { 94 95 this->leftRight = leftRight; 96 //this->registerObject(this, HeavyBlaster::_objectList); 97 98 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); 99 100 this->loadModel("models/guns/frag_cannon2.obj", .4); 101 102 103 this->setStateDuration(WS_SHOOTING, 0.5); // 2 Schuss pro Sekunde 92 void Disruptor::init() 93 { 94 95 this->setScaling(.5); 96 97 this->loadModel("models/guns/disruptor.obj", this->getScaling()); 98 99 100 this->setStateDuration(WS_SHOOTING, 0.3333); // 3 Shots per Second 104 101 this->setStateDuration(WS_RELOADING, 0); 105 102 this->setStateDuration(WS_ACTIVATING, .5); … … 118 115 this->prepareProjectiles(5); 119 116 120 this->setBarrels( 3);121 this->setSegs( 2);117 this->setBarrels(1); 118 this->setSegs(1); 122 119 this->activeBarrel = 0; 123 120 … … 131 128 this->objComp[i] = new PNode* [this->getSegs()]; 132 129 this->emissionPoint[i] = new PNode; 133 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles130 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapon 134 131 this->emissionPoint[i]->setName("EmissionPoint"); 135 132 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); … … 143 140 } 144 141 145 if (this->leftRight == W_RIGHT) 146 { 147 this->emissionPoint[0]->setRelCoor(Vector(1.1, 0.14, 0.06)); 148 this->emissionPoint[1]->setRelCoor(Vector(1.1, -.06, 0.14)); 149 this->emissionPoint[2]->setRelCoor(Vector(1.1, 0.06, -.14)); 150 } 151 else { 152 this->emissionPoint[0]->setRelCoor(Vector(1.1, 0.14, -.06)); 153 this->emissionPoint[1]->setRelCoor(Vector(1.1, -.06, -.14)); 154 this->emissionPoint[2]->setRelCoor(Vector(1.1, 0.06, 0.14)); 155 } 156 157 158 for (int i = 0; i < this->getBarrels(); i++){ 159 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.05, ANIM_LINEAR, ANIM_NULL); 160 this->shootAnim[i][0]->addKeyFrame(Vector(-0.3, 0.0, 0.0), Quaternion(), 0.9, ANIM_LINEAR, ANIM_NULL); 161 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.55, ANIM_LINEAR, ANIM_NULL); 162 163 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.05, ANIM_LINEAR, ANIM_NULL); 164 this->shootAnim[i][1]->addKeyFrame(Vector(-0.4, 0.0, 0.0), Quaternion(), 1.2, ANIM_LINEAR, ANIM_NULL); 165 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.25, ANIM_LINEAR, ANIM_NULL); 166 } 142 this->emissionPoint[0]->setRelCoor(Vector(1.672, 0.0, 0.0) * this->getScaling()); 143 167 144 168 145 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); … … 180 157 181 158 182 void HeavyBlaster::fire()159 void Disruptor::fire() 183 160 { 184 161 Projectile* pj = this->getProjectile(); … … 197 174 198 175 // initiate animation 199 for (int i = 0; i < this->getSegs(); i++)200 this->shootAnim[this->activeBarrel][i]->replay();176 // for (int i = 0; i < this->getSegs(); i++) 177 // this->shootAnim[this->activeBarrel][i]->replay(); 201 178 202 179 // switch barrel 203 this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels();180 // this->activeBarrel = (this->activeBarrel + 1) % this->getBarrels(); 204 181 } 205 182 … … 207 184 * this activates the weapon 208 185 */ 209 void HeavyBlaster::activate()186 void Disruptor::activate() 210 187 { 211 188 } … … 214 191 * this deactivates the weapon 215 192 */ 216 void HeavyBlaster::deactivate()217 { 218 } 219 220 221 void HeavyBlaster::draw() const193 void Disruptor::deactivate() 194 { 195 } 196 197 198 void Disruptor::draw() const 222 199 { 223 200 glMatrixMode(GL_MODELVIEW); … … 229 206 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 230 207 231 if (this->leftRight == W_LEFT) 232 glScalef(1.0, 1.0, -1.0); 233 234 static_cast<StaticModel*>(this->getModel())->draw(6); 235 236 glPushMatrix(); 237 glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z); 238 static_cast<StaticModel*>(this->getModel())->draw(2); 208 static_cast<StaticModel*>(this->getModel())->draw(); 209 239 210 glPopMatrix(); 240 241 glPushMatrix(); 242 glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z); 243 static_cast<StaticModel*>(this->getModel())->draw(3); 244 glPopMatrix(); 245 246 glPushMatrix(); 247 glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z); 248 static_cast<StaticModel*>(this->getModel())->draw(1); 249 glPopMatrix(); 250 251 glPushMatrix(); 252 glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z); 253 static_cast<StaticModel*>(this->getModel())->draw(4); 254 glPopMatrix(); 255 256 glPushMatrix(); 257 glTranslatef (this->objComp[1][1]->getAbsCoor().x, this->objComp[1][1]->getAbsCoor().y, this->objComp[1][1]->getAbsCoor().z); 258 static_cast<StaticModel*>(this->getModel())->draw(5); 259 glPopMatrix(); 260 261 glPushMatrix(); 262 glTranslatef (this->objComp[2][1]->getAbsCoor().x, this->objComp[2][1]->getAbsCoor().y, this->objComp[2][1]->getAbsCoor().z); 263 static_cast<StaticModel*>(this->getModel())->draw(0); 264 glPopMatrix(); 265 266 glPopMatrix(); 267 } 268 269 void HeavyBlaster::tick(float dt) 211 } 212 213 void Disruptor::tick(float dt) 270 214 { 271 215 if (!Weapon::tickW(dt)) -
branches/vs-enhencements/src/world_entities/weapons/disruptor.h
r10644 r10648 1 #ifndef HEAVY_BLASTER_H2 #define HEAVY_BLASTER_H1 #ifndef DISRUPTOR_H 2 #define DISRUPTOR_H 3 3 4 4 5 5 #include "weapon.h" 6 6 7 #define W_LEFT 08 #define W_RIGHT 17 // #define W_LEFT 0 8 // #define W_RIGHT 1 9 9 10 10 /** … … 13 13 * Heavy Blaster class 14 14 */ 15 class HeavyBlaster : public Weapon15 class Disruptor : public Weapon 16 16 { 17 // ObjectListDeclaration( HeavyBlaster);17 // ObjectListDeclaration(Disruptor); 18 18 public: 19 HeavyBlaster(int leftRight);20 HeavyBlaster (const TiXmlElement* root);21 virtual ~ HeavyBlaster();19 Disruptor(); 20 Disruptor (const TiXmlElement* root); 21 virtual ~Disruptor(); 22 22 23 void init( int leftRight);23 void init(); 24 24 virtual void loadParams(const TiXmlElement* root); 25 25 … … 40 40 int activeBarrel; 41 41 42 int leftRight;42 // int leftRight; 43 43 }; 44 44 -
branches/vs-enhencements/src/world_entities/weapons/heavy_blaster.cc
r10645 r10648 131 131 this->objComp[i] = new PNode* [this->getSegs()]; 132 132 this->emissionPoint[i] = new PNode; 133 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles133 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapons 134 134 this->emissionPoint[i]->setName("EmissionPoint"); 135 135 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); -
branches/vs-enhencements/src/world_entities/weapons/laser_cannon.cc
r10415 r10648 55 55 this->registerObject(this, LaserCannon::_objectList); 56 56 57 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN);57 this->setScaling (5); 58 58 59 this->loadModel("models/guns/lasercannon.obj", 5.0f);59 this->loadModel("models/guns/lasercannon.obj", this->getScaling()); 60 60 61 61 this->setStateDuration(WS_SHOOTING, .1); … … 75 75 this->setProjectileTypeC("RailProjectile"); 76 76 this->prepareProjectiles(100); 77 this->setEmissionPoint(Vector(2.8,0,0) * 5.0);77 this->setEmissionPoint(Vector(2.8,0,0) * this->getScaling()); 78 78 } 79 79 -
branches/vs-enhencements/src/world_entities/weapons/light_blaster.cc
r10645 r10648 106 106 this->emissionPoint[i]->setName("EmissionPoint"); 107 107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 108 // this->shootAnim[i] = new Animation3D* [this->getSegs()];109 108 for(int j = 0; j < this->getSegs(); j++) 110 109 { … … 114 113 } 115 114 } 116 /*117 this->emissionPoint[0]->setRelCoor(Vector(1.19, 0.0, 0.1));118 this->emissionPoint[1]->setRelCoor(Vector(1.19, -0.07, -0.05));119 this->emissionPoint[2]->setRelCoor(Vector(1.19, 0.07, -0.05));*/120 115 121 116 this->emissionPoint[0]->setRelCoor(Vector(2.2, 0.0, 0.1)); … … 130 125 animation2->setInfinity(ANIM_INF_CONSTANT); 131 126 animation3->setInfinity(ANIM_INF_CONSTANT); 132 133 // this->setEmissionPoint(3.8, 1.2, 0);134 135 // for (int i = 0; i < this->getBarrels(); i++){136 // this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion(i * 120, Vector(1.0, 0.0, 0.0)), 0.049, ANIM_NULL, ANIM_LINEAR);137 // this->shootAnim[i][0]->addKeyFrame(Vector(), Quaternion((i+1)*120, Vector(1.0, 0.0, 0.0)), 0.001, ANIM_NULL, ANIM_LINEAR);138 // }139 127 140 128 -
branches/vs-enhencements/src/world_entities/weapons/medium_blaster.cc
r10618 r10648 69 69 void MediumBlaster::init() 70 70 { 71 this->loadModel("models/guns/blaster.obj", .33); 71 this->setScaling(.3333); 72 73 this->loadModel("models/guns/blaster.obj", this->getScaling()); 72 74 73 75 this->setStateDuration(WS_SHOOTING, 0.2); // 5 Schuss pro Sekunde … … 82 84 83 85 this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav"); 84 this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");86 // this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav"); 85 87 this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav"); 86 88 87 89 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT); 88 this->setProjectileTypeC("MBolt"); // FIXME temp project type until the blaste class exist90 this->setProjectileTypeC("MBolt"); 89 91 this->prepareProjectiles(100); 90 92 … … 95 97 96 98 this->objComp = new PNode**[this->getBarrels()]; 99 this->emissionPoint = new PNode*[this->getBarrels()]; 97 100 this->shootAnim = new Animation3D**[this->getBarrels()]; 98 101 for (int i = 0; i < this->getBarrels(); i++) 99 102 { 100 103 this->objComp[i] = new PNode* [this->getSegs()]; 104 this->emissionPoint[i] = new PNode; 105 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapon 106 this->emissionPoint[i]->setName("EmissionPoint"); 107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 101 108 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 102 109 for(int j = 0; j < this->getSegs(); j++) … … 109 116 110 117 for (int i = 0; i < this->getBarrels(); i++){ 111 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);112 this->shootAnim[i][0]->addKeyFrame(Vector(- 0.333, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);113 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);114 115 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL);116 this->shootAnim[i][1]->addKeyFrame(Vector(. 166, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL);117 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) , Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL);118 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 119 this->shootAnim[i][0]->addKeyFrame(Vector(-1.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 120 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 121 122 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 123 this->shootAnim[i][1]->addKeyFrame(Vector(.5, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 124 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0) * this->getScaling(), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 118 125 } 119 126 … … 124 131 animation3->setInfinity(ANIM_INF_CONSTANT); 125 132 126 127 this->setEmissionPoint(1.3, 0, 0); 133 this->emissionPoint[0]->setRelCoor(Vector(3.9, 0.0, 0.0) * this->getScaling()); 128 134 129 135 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); -
branches/vs-enhencements/src/world_entities/weapons/medium_blaster.h
r10516 r10648 33 33 PNode*** objComp; 34 34 Animation3D*** shootAnim; 35 PNode** emissionPoint; 35 36 36 37 int activeBarrel; -
branches/vs-enhencements/src/world_entities/weapons/nadion_laser.cc
r10644 r10648 15 15 */ 16 16 17 #include " medium_blaster.h"17 #include "nadion_laser.h" 18 18 #include "world_entities/projectiles/projectile.h" 19 19 … … 30 30 31 31 // 32 //ObjectListDefinition( MediumBlaster);33 CREATE_FACTORY( MediumBlaster);32 //ObjectListDefinition(NadionLaser); 33 CREATE_FACTORY(NadionLaser); 34 34 /** 35 35 * Standard constructor 36 36 */ 37 MediumBlaster::MediumBlaster ()37 NadionLaser::NadionLaser () 38 38 : Weapon() 39 39 { … … 41 41 } 42 42 43 MediumBlaster::MediumBlaster (const TiXmlElement* root = NULL)43 NadionLaser::NadionLaser (const TiXmlElement* root = NULL) 44 44 : Weapon() 45 45 { … … 52 52 * Default destructor 53 53 */ 54 MediumBlaster::~MediumBlaster()54 NadionLaser::~NadionLaser() 55 55 { 56 56 // model will be deleted from WorldEntity-destructor … … 62 62 } 63 63 64 void MediumBlaster::loadParams(const TiXmlElement* root)64 void NadionLaser::loadParams(const TiXmlElement* root) 65 65 { 66 66 Weapon::loadParams(root); 67 67 } 68 68 69 void MediumBlaster::init()69 void NadionLaser::init() 70 70 { 71 this-> loadModel("models/guns/blaster.obj", .33);71 this->setScaling(.45); 72 72 73 this->setStateDuration(WS_SHOOTING, 0.2); // 5 Schuss pro Sekunde 73 this->loadModel("models/guns/nadion_laser.obj", this->getScaling()); 74 75 this->setStateDuration(WS_SHOOTING, 0.1666); // 6 Schuss pro Sekunde 74 76 75 77 this->setStateDuration(WS_RELOADING, 0); … … 82 84 83 85 this->setActionSound(WA_SHOOT, "sounds/guns/laser.wav"); 84 this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav");86 // this->setActionSound(WA_ACTIVATE, "sounds/voices/lasers.wav"); 85 87 this->setActionSound(WA_RELOAD, "sounds/spawn/alien_generator.wav"); 86 88 87 89 this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT); 88 this->setProjectileTypeC("MBolt"); // FIXME temp project type until the blaste class exist90 this->setProjectileTypeC("MBolt"); // FIXME temp projectile, until nadion_laser_bolt exists. 89 91 this->prepareProjectiles(100); 90 92 91 93 92 94 this->setBarrels(1); 93 this->setSegs( 2);95 this->setSegs(1); 94 96 this->activeBarrel = 0; 95 97 96 98 this->objComp = new PNode**[this->getBarrels()]; 99 this->emissionPoint = new PNode*[this->getBarrels()]; 97 100 this->shootAnim = new Animation3D**[this->getBarrels()]; 98 101 for (int i = 0; i < this->getBarrels(); i++) 99 102 { 100 103 this->objComp[i] = new PNode* [this->getSegs()]; 104 this->emissionPoint[i] = new PNode; 105 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapon 106 this->emissionPoint[i]->setName("EmissionPoint"); 107 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 101 108 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 102 109 for(int j = 0; j < this->getSegs(); j++) … … 108 115 } 109 116 110 for (int i = 0; i < this->getBarrels(); i++){ 111 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 112 this->shootAnim[i][0]->addKeyFrame(Vector(-0.333, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 113 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 114 115 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 116 this->shootAnim[i][1]->addKeyFrame(Vector(.166, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 117 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 118 } 117 this->emissionPoint[0]->setRelCoor(Vector(1.680, 0.0, 0.0) * this->getScaling()); 119 118 120 119 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); … … 123 122 animation2->setInfinity(ANIM_INF_CONSTANT); 124 123 animation3->setInfinity(ANIM_INF_CONSTANT); 125 126 127 this->setEmissionPoint(1.3, 0, 0);128 124 129 125 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); … … 135 131 136 132 137 void MediumBlaster::fire()133 void NadionLaser::fire() 138 134 { 139 135 Projectile* pj = this->getProjectile(); … … 152 148 pj->activate(); 153 149 154 for (int i = 0; i < this->getSegs(); i++)155 this->shootAnim[this->activeBarrel][i]->replay();156 150 } 157 151 … … 160 154 * this activates the weapon 161 155 */ 162 void MediumBlaster::activate()156 void NadionLaser::activate() 163 157 { 164 158 } … … 167 161 * this deactivates the weapon 168 162 */ 169 void MediumBlaster::deactivate()163 void NadionLaser::deactivate() 170 164 { 171 165 } 172 166 173 void MediumBlaster::draw() const167 void NadionLaser::draw() const 174 168 { 175 169 glMatrixMode(GL_MODELVIEW); … … 178 172 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 179 173 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 180 static_cast<StaticModel*>(this->getModel())->draw( 0);174 static_cast<StaticModel*>(this->getModel())->draw(); 181 175 182 glPushMatrix();183 glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z);184 static_cast<StaticModel*>(this->getModel())->draw(1);185 glPopMatrix();186 187 glPushMatrix();188 glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);189 static_cast<StaticModel*>(this->getModel())->draw(2);190 glPopMatrix();191 176 192 177 glPopMatrix(); 193 178 } 194 179 195 void MediumBlaster::tick(float dt)180 void NadionLaser::tick(float dt) 196 181 { 197 182 if (!Weapon::tickW(dt)) -
branches/vs-enhencements/src/world_entities/weapons/nadion_laser.h
r10644 r10648 1 #ifndef MEDIUM_BLASTER_H2 #define MEDIUM_BLASTER_H1 #ifndef NADION_LASER_H 2 #define NADION_LASER_H 3 3 4 4 5 5 #include "weapon.h" 6 6 7 /** 8 * @author Marc Schaerer <marcscha@ee.ethz.ch> 9 * 10 * Medium Blaster class 11 */ 12 class MediumBlaster : public Weapon 7 8 class NadionLaser : public Weapon 13 9 { 14 //ObjectListDeclaration( MediumBlaster);10 //ObjectListDeclaration(NadionLaser); 15 11 public: 16 MediumBlaster();17 MediumBlaster (const TiXmlElement* root);18 virtual ~ MediumBlaster();12 NadionLaser(); 13 NadionLaser (const TiXmlElement* root); 14 virtual ~NadionLaser(); 19 15 20 16 void init(); … … 33 29 PNode*** objComp; 34 30 Animation3D*** shootAnim; 31 PNode** emissionPoint; 35 32 36 33 int activeBarrel; -
branches/vs-enhencements/src/world_entities/weapons/rf_cannon.cc
r10645 r10648 67 67 { 68 68 69 this->loadModel("models/guns/rf_cannon.obj", 0.2); 69 this->setScaling(.2); 70 71 this->loadModel("models/guns/rf_cannon.obj", this->getScaling()); 70 72 71 73 … … 102 104 } 103 105 104 this->emissionPoint[0]->setRelCoor(Vector( 1.02, 0.0, 0.15));105 this->emissionPoint[1]->setRelCoor(Vector( 1.02, 0.09, 0.0));106 this->emissionPoint[2]->setRelCoor(Vector( 1.02, 0.0, -0.15));107 this->emissionPoint[3]->setRelCoor(Vector( 1.02, -0.09, 0.0));106 this->emissionPoint[0]->setRelCoor(Vector(4.1, 0.0, 0.75) * this->getScaling()); 107 this->emissionPoint[1]->setRelCoor(Vector(4.1, 0.45, 0.0) * this->getScaling()); 108 this->emissionPoint[2]->setRelCoor(Vector(4.1, 0.0, -0.75) * this->getScaling()); 109 this->emissionPoint[3]->setRelCoor(Vector(4.1, -0.45, 0.0) * this->getScaling()); 108 110 109 111 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); -
branches/vs-enhencements/src/world_entities/weapons/weapon.cc
r10645 r10648 134 134 for(int i = 0; i < this->barrels; i++){ 135 135 this->emissionPoint[i] = new PNode; 136 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles136 this->emissionPoint[i]->setParent(this); //Parenting emissionPoint to Weapons 137 137 this->emissionPoint[i]->setName("EmissionPoint"); 138 138 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); … … 159 159 //this->setSynchronized(true); 160 160 } 161 162 /**163 * needed, if there are more than one barrel or segments164 */165 /*166 void Weapon::init2()167 {168 if (this->barrels == 1 && this->segs == 1)169 return;170 171 delete this->emissionPoint[0];172 delete this->emissionPoint;173 delete this->shootAnim[0];174 delete this->shootAnim;175 176 this->shootAnim = new Animation3D**[this->barrels];177 this->emissionPoint = new PNode*[this->barrels];178 for(int i = 0; i < this->barrels; i++){179 this->emissionPoint[i] = new PNode;180 this->emissionPoint[i]->setParent(this); //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles181 this->emissionPoint[i]->setName("EmissionPoint");182 this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);183 this->shootAnim[i] = new Animation3D* [this->segs];184 }185 }*/186 187 /**188 * deconstructor for init2189 */190 /*191 void Weapon::deconstr()192 {193 for(int i = 0; i < this->barrels; i++) {194 delete this->emissionPoint[i];195 for (int j = 0; j < this->segs; j++)196 delete this->shootAnim[i][j];197 delete this->shootAnim[i];198 }199 200 delete this->emissionPoint;201 delete this->shootAnim;202 }*/203 161 204 162 /** -
branches/vs-enhencements/src/world_entities/weapons/weapon.h
r10645 r10648 124 124 Projectile* getProjectile(); 125 125 126 inline void setScaling(float scaling) { this->scaling = scaling; }; 127 inline float getScaling() { return this->scaling; }; 126 128 127 129 // EMISSION … … 248 250 PNode* defaultTarget; //!< A target for targeting Weapons. 249 251 252 float scaling; //!< Local scaling factor. any scaling will be done through this vector. 253 250 254 //////////// 251 255 // PHASES //
Note: See TracChangeset
for help on using the changeset viewer.