Changeset 10286 in orxonox.OLD for branches/playability/src/world_entities/weapons/medium_blaster.cc
- Timestamp:
- Jan 17, 2007, 9:23:49 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/weapons/medium_blaster.cc
r10132 r10286 37 37 { 38 38 // model will be deleted from WorldEntity-destructor 39 for (int i = 0; i < this->getBarrels(); i++) 40 { 41 delete [] this->shootAnim[i]; 42 // delete [] this->objComp[i]; 43 } 44 delete [] this->shootAnim; 45 // delete [] this->objComp; 39 46 } 40 47 … … 50 57 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); 51 58 52 this->loadModel("models/guns/ plasmadriver_#.obj", 1.0);59 this->loadModel("models/guns/blaster.obj", .33); 53 60 54 61 … … 71 78 this->prepareProjectiles(100); 72 79 80 81 this->setBarrels(1); 82 this->setSegs(2); 83 this->activeBarrel = 0; 84 85 this->objComp = new PNode**[this->getBarrels()]; 86 // this->emissionPoint = new PNode*[this->getBarrels()]; 87 this->shootAnim = new Animation3D**[this->getBarrels()]; 88 for (int i = 0; i < this->getBarrels(); i++) 89 { 90 this->objComp[i] = new PNode* [this->getSegs()]; 91 // this->emissionPoint[i] = new PNode; 92 // 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 Projectiles 93 // this->emissionPoint[i]->setName("EmissionPoint"); 94 // this->emissionPoint[i]->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 95 this->shootAnim[i] = new Animation3D* [this->getSegs()]; 96 for(int j = 0; j < this->getSegs(); j++) 97 { 98 this->objComp[i][j] = new PNode; 99 this->shootAnim[i][j] = new Animation3D(this->objComp[i][j]); 100 this->shootAnim[i][j]->setInfinity(ANIM_INF_CONSTANT); 101 } 102 } 103 104 for (int i = 0; i < this->getBarrels(); i++){ 105 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 106 this->shootAnim[i][0]->addKeyFrame(Vector(-0.333, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 107 this->shootAnim[i][0]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 108 109 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.04, ANIM_LINEAR, ANIM_NULL); 110 this->shootAnim[i][1]->addKeyFrame(Vector(.166, 0.0, 0.0), Quaternion(), 0.15, ANIM_LINEAR, ANIM_NULL); 111 this->shootAnim[i][1]->addKeyFrame(Vector(0.0, 0.0, 0.0), Quaternion(), 0.01, ANIM_LINEAR, ANIM_NULL); 112 } 113 73 114 Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this); 74 115 Animation3D* animation3 = this->getAnimation(WS_DEACTIVATING, this); … … 77 118 animation3->setInfinity(ANIM_INF_CONSTANT); 78 119 79 this->setEmissionPoint(3.8, 1.2, 0); 120 121 this->setEmissionPoint(1.3, 0, 0); 80 122 81 123 animation2->addKeyFrame(Vector(0.0, -1.0, 0.0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_NULL); … … 103 145 pj->setAbsDir(this->getAbsDir()); 104 146 pj->activate(); 147 148 for (int i = 0; i < this->getSegs(); i++) 149 this->shootAnim[this->activeBarrel][i]->replay(); 105 150 } 106 151 … … 121 166 void MediumBlaster::draw() const 122 167 { 168 glMatrixMode(GL_MODELVIEW); 169 glPushMatrix(); 170 glTranslatef (this->getAbsCoor ().x, 171 this->getAbsCoor ().y, 172 this->getAbsCoor ().z); 173 174 static_cast<StaticModel*>(this->getModel())->draw(2); 175 176 glPushMatrix(); 177 glTranslatef (this->objComp[0][0]->getAbsCoor().x, this->objComp[0][0]->getAbsCoor().y, this->objComp[0][0]->getAbsCoor().z); 178 static_cast<StaticModel*>(this->getModel())->draw(1); 179 glPopMatrix(); 180 181 glPushMatrix(); 182 glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z); 183 static_cast<StaticModel*>(this->getModel())->draw(0); 184 glPopMatrix(); 185 186 glPopMatrix(); 187 188 glPopMatrix(); 123 189 }
Note: See TracChangeset
for help on using the changeset viewer.