- Timestamp:
- Jan 17, 2007, 9:23:49 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/story_entities/game_world_data.cc
r9869 r10286 232 232 State::setPlayer(this->localPlayer); 233 233 234 Playable* playable;234 // Playable* playable; 235 235 if (!Playable::objectList().empty()) 236 236 { -
branches/playability/src/world_entities/projectiles/spike.h
r10196 r10286 48 48 49 49 WorldEntity* hitEntity; // FIXME TEMPORARY 50 51 Vector velocity; 50 52 }; 51 53 -
branches/playability/src/world_entities/projectiles/spike_ball.cc
r10281 r10286 55 55 this->emitter->setEmissionVelocity(50.0); 56 56 57 // this->speed = 150;58 /*59 this->angle = 0;60 this->rotationSpeed = 130;*/61 57 this->setRotationSpeed(130); 62 58 … … 70 66 71 67 this->launcher = new Vector [this->getFragments()]; 72 73 // this->fastFactory = tFastFactory<Spike>::getFastFactory(CL_SPIKE, "Spike");74 75 /*76 this->weaponMan = new WeaponManager(dynamic_cast<WorldEntity*>(this));77 this->weaponMan->setParentEntity(this);78 this->weaponMan->setSlotCount(1);79 this->weaponMan->setSlotPosition(0, Vector(0, 0, 0));80 this->weaponMan->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);81 82 Weapon* cannon = new SpikeLauncher();83 cannon->setName( "SpikeLauncher");84 this->weaponMan->addWeapon(cannon, 0, 0);85 this->weaponMan->changeWeaponConfig(0);86 87 this->weaponMan->getWeapon(0)->increaseEnergy(50);*/88 68 } 89 69 … … 172 152 this->hitEntity = entity; 173 153 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 174 // this->deactivate();175 154 } 176 155 … … 178 157 void SpikeBall::blow() 179 158 { 159 updateFireDir(); 160 180 161 Spike* pj = NULL; 181 /* printf( "KA-" );*/182 162 for ( int i = 0; i < this->getFragments(); i++) 183 163 { 184 164 pj = new Spike(); 185 165 assert( pj ); 186 /* printf(" %i", i);*/187 166 pj->setParent(PNode::getNullParent()); 188 167 … … 191 170 pj->setParent(PNode::getNullParent()); 192 171 pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size); 193 Quaternion q;194 pj->setAbsDir( q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1)));172 // Quaternion q; 173 pj->setAbsDir(Quaternion(this->launcher[i], 0)); 195 174 196 175 pj->toList(this->getOMListNumber()); 197 176 198 /*199 pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));200 pj->setAbsDir(this->getAbsDir());*/201 177 pj->activate(); 202 178 } 203 /* printf( "BOOM\n" );*/204 179 } 205 180 … … 219 194 ca = cos (this->getAngle()); 220 195 sa = sin (this->getAngle()); 221 // final version below... easier to to cheat with the one above.222 196 223 197 m[0][0] = nx * nx * (1 - ca) + ca; … … 233 207 float x, y, z; 234 208 for (int i = 0; i < this->getFragments(); i++){ 235 // printf("%i ", i);236 209 x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z; 237 210 y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z; … … 240 213 this->launcher[i] = Vector (x, y, z); 241 214 } 242 // printf("\n");243 215 244 216 for( int i = 0; i < 3 ; i++) … … 254 226 void SpikeBall::tick (float dt) 255 227 { 256 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 257 Vector v = this->getVelocity() * dt; 228 Vector v = this->velocity * dt; 258 229 this->shiftCoor(v); 259 260 // if(this->lifeCycle > .9){261 // /* printf("time to blow: ");*/262 // // this->weaponMan->fire();263 // /* this->blow();*/264 // }265 230 266 231 if (this->tickLifeCycle(dt)){ … … 270 235 271 236 this->updateAngle( dt ); 272 // angle += rotationSpeed * dt;273 237 } 274 238 … … 289 253 { 290 254 glPushAttrib(GL_ENABLE_BIT); 291 //glDisable(GL_LIGHTING);292 293 255 glMatrixMode(GL_MODELVIEW); 294 256 glPushMatrix(); … … 305 267 306 268 glPopMatrix(); 307 308 269 glPopAttrib(); 309 270 } -
branches/playability/src/world_entities/projectiles/spike_ball.h
r10271 r10286 10 10 #include "spike.h" 11 11 #include "effects/billboard.h" 12 13 // #include "../weapons/spike_launcher.h"14 12 15 13 -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10284 r10286 204 204 205 205 curWeaponPrimary = 3; 206 curWeaponSecondary = 1;206 curWeaponSecondary = 0; 207 207 208 208 Playable::weaponConfigChanged(); … … 295 295 this->weaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 296 296 297 this->weaponMan.setSlotPosition(2, Vector( -1.5, 0, -.5));297 this->weaponMan.setSlotPosition(2, Vector(1.0, 0, -1.5)); 298 298 this->weaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); 299 299 300 this->weaponMan.setSlotPosition(3, Vector( -1.5, 0,.5));300 this->weaponMan.setSlotPosition(3, Vector(1.0, 0, 1.5)); 301 301 this->weaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); 302 302 -
branches/playability/src/world_entities/weapons/heavy_blaster.cc
r10281 r10286 235 235 236 236 glPushMatrix(); 237 glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z);238 static_cast<StaticModel*>(this->getModel())->draw(2);239 glPopMatrix(); 240 241 glPushMatrix(); 242 glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z);243 static_cast<StaticModel*>(this->getModel())->draw(0);244 glPopMatrix(); 245 246 glPushMatrix(); 247 glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z);237 glTranslatef (this->objComp[1][0]->getAbsCoor().x, this->objComp[1][0]->getAbsCoor().y, this->objComp[1][0]->getAbsCoor().z); 238 static_cast<StaticModel*>(this->getModel())->draw(2); 239 glPopMatrix(); 240 241 glPushMatrix(); 242 glTranslatef (this->objComp[2][0]->getAbsCoor().x, this->objComp[2][0]->getAbsCoor().y, this->objComp[2][0]->getAbsCoor().z); 243 static_cast<StaticModel*>(this->getModel())->draw(0); 244 glPopMatrix(); 245 246 glPushMatrix(); 247 glTranslatef (this->objComp[0][1]->getAbsCoor().x, this->objComp[0][1]->getAbsCoor().y, this->objComp[0][1]->getAbsCoor().z); 248 248 static_cast<StaticModel*>(this->getModel())->draw(4); 249 249 glPopMatrix(); 250 250 251 251 glPushMatrix(); 252 glTranslatef (this->objComp[1][1]->getAbsCoor().x, this->objComp[1][1]->getAbsCoor().y, this->objComp[1][1]->getAbsCoor().z);253 static_cast<StaticModel*>(this->getModel())->draw(5);254 glPopMatrix(); 255 256 glPushMatrix(); 257 glTranslatef (this->objComp[2][1]->getAbsCoor().x, this->objComp[2][1]->getAbsCoor().y, this->objComp[2][1]->getAbsCoor().z);258 static_cast<StaticModel*>(this->getModel())->draw(3);259 glPopMatrix(); 260 261 glPopMatrix(); 262 } 252 glTranslatef (this->objComp[1][1]->getAbsCoor().x, this->objComp[1][1]->getAbsCoor().y, this->objComp[1][1]->getAbsCoor().z); 253 static_cast<StaticModel*>(this->getModel())->draw(5); 254 glPopMatrix(); 255 256 glPushMatrix(); 257 glTranslatef (this->objComp[2][1]->getAbsCoor().x, this->objComp[2][1]->getAbsCoor().y, this->objComp[2][1]->getAbsCoor().z); 258 static_cast<StaticModel*>(this->getModel())->draw(3); 259 glPopMatrix(); 260 261 glPopMatrix(); 262 } -
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 } -
branches/playability/src/world_entities/weapons/medium_blaster.h
r9998 r10286 28 28 virtual void draw() const; 29 29 30 private: 31 PNode*** objComp; 32 Animation3D*** shootAnim; 33 34 int activeBarrel; 35 30 36 }; 31 37
Note: See TracChangeset
for help on using the changeset viewer.