Changeset 10081 in orxonox.OLD for branches/playability/src/world_entities
- Timestamp:
- Dec 16, 2006, 2:12:41 AM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/Makefile.am
r9970 r10081 11 11 extendable.cc power_ups/power_up.cc power_ups/param_power_up.cc \ 12 12 power_ups/weapon_power_up.cc spawning_point.cc effects/explosion.cc effects/billboard.cc \ 13 elements/glgui_energywidget.cc13 effects/trail.cc elements/glgui_energywidget.cc 14 14 15 15 … … 18 18 weapons/weapon.h weapons/ammo_container.h projectiles/projectile.h \ 19 19 power_ups/power_up.h power_ups/param_power_up.h power_ups/weapon_power_up.h \ 20 spawning_point.h effects/explosion.h effects/billboard.h \20 spawning_point.h effects/explosion.h effects/billboard.h effects/trail.h \ 21 21 elements/glgui_energywidget.h 22 22 -
branches/playability/src/world_entities/projectiles/hbolt.cc
r10079 r10081 122 122 this->destroy( entity ); 123 123 this->hitEntity = entity; 124 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(),0);125 //this->deactivate();124 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage()); 125 this->deactivate(); 126 126 } 127 127 -
branches/playability/src/world_entities/projectiles/mbolt.cc
r10078 r10081 34 34 #include "static_model.h" 35 35 36 #include "effects/trail.h" 37 36 38 37 39 #include "class_id_DEPRECATED.h" … … 46 48 this->registerObject(this, MBolt::_objectList); 47 49 this->loadModel("models/projectiles/mbolt.obj"); 50 48 51 49 52 //this->loadModel("models/projectiles/laser.obj"); … … 72 75 dynamic_cast<StaticModel*>(this->getModel())->addMaterial(this->mat); 73 76 dynamic_cast<StaticModel*>(this->getModel())->finalize(); 77 78 79 this->trail = new Trail(6,1,.4); 80 this->trail->setParent( this); 81 this->trail->setTexture( "maps/laser.png"); 74 82 } 75 83 … … 83 91 // delete this->emitter; 84 92 85 if (MBolt::trailParticles != NULL && MBolt::objectList().size() <= 1)86 {87 if (ParticleSystem::objectList().exists(MBolt::trailParticles))88 delete MBolt::trailParticles;89 MBolt::trailParticles = NULL;90 }91 93 if (MBolt::explosionParticles != NULL && MBolt::objectList().size() <= 1) 92 94 { … … 94 96 delete MBolt::explosionParticles; 95 97 MBolt::explosionParticles = NULL; 98 PRINTF(1)("Deleting MBolt Explosion Particles\n"); 96 99 } 97 } 98 99 SpriteParticles* MBolt::trailParticles = NULL; 100 101 } 102 100 103 SpriteParticles* MBolt::explosionParticles = NULL; 101 104 102 105 void MBolt::activate() 103 106 { 104 if (unlikely(MBolt::trailParticles == NULL))105 {106 MBolt::trailParticles = new SpriteParticles(1000);107 MBolt::trailParticles->setName("BoomerangProjectileTrailParticles");108 MBolt::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");109 MBolt::trailParticles->setLifeSpan(0.3, 0);110 MBolt::trailParticles->setRadius(0.0, .8);111 MBolt::trailParticles->setRadius(1.0, .2);112 MBolt::trailParticles->setColor(0.0, 1,0,0,.9);113 MBolt::trailParticles->setColor(0.2, .8,.2,0,.9);114 MBolt::trailParticles->setColor(0.5, .8,.4,.4,.8);115 MBolt::trailParticles->setColor(1.0, .8,.8,.8,.7);116 }117 107 if (unlikely(MBolt::explosionParticles == NULL)) 118 108 { … … 128 118 } 129 119 130 this->setDamage(10); 120 this->setPhysDamage(10); 121 this->setElecDamage(0); 131 122 this->setHealth(0); 132 123 133 this->emitter->setSystem(MBolt::trailParticles);134 124 135 125 this->emitter->setSpread(0); … … 142 132 void MBolt::deactivate() 143 133 { 144 assert (MBolt::trailParticles != NULL);145 MBolt::trailParticles->removeEmitter(this->emitter);146 147 134 assert (MBolt::explosionParticles != NULL); 148 135 MBolt::explosionParticles->removeEmitter(this->emitter); … … 157 144 void MBolt::collidesWith(WorldEntity* entity, const Vector& location) 158 145 { 159 if (this->hitEntity != entity && entity->isA(CL_NPC)) 160 this->destroy( entity ); 161 this->hitEntity = entity; 162 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 146 PRINTF(0)("MBolt collides pretest\n"); 147 if( entity == NULL || dynamic_cast<SpaceShip*>(entity) == NULL) 148 return; 149 150 PRINTF(0)("MBolt collides\n"); 151 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage()); 152 entity->destroy(this); 153 this->deactivate(); 163 154 } 164 155 … … 177 168 178 169 this->angle += MBolt::rotationSpeed * dt; 170 this->trail->tick(dt); 179 171 } 180 172 … … 209 201 dynamic_cast<StaticModel*>(this->getModel())->draw(); 210 202 this->mat->unselect(); 203 glScalef(1/.75,4/.7,4/.7); 204 glTranslatef(-4,0,0); 205 this->trail->draw(); 211 206 glPopMatrix(); 212 207 glPopAttrib(); -
branches/playability/src/world_entities/projectiles/mbolt.h
r10064 r10081 15 15 class ParticleEmitter; 16 16 class FastFactory; 17 class Trail; 17 18 18 19 class MBolt : public Projectile … … 37 38 private: 38 39 static FastFactory* fastFactory; 39 static SpriteParticles* trailParticles;40 40 static SpriteParticles* explosionParticles; 41 42 Trail* trail; 41 43 42 44 float angle; -
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10080 r10081 24 24 #include "particles/sprite_particles.h" 25 25 #include "space_ships/space_ship.h" 26 #include "effects/trail.h" 26 27 27 28 #include "debug.h" … … 57 58 58 59 this->physDamage = 200; 60 61 this->trail = new Trail(2.5,4,.2); 62 this->trail->setParent( this); 63 this->trail->setTexture( "maps/laser.png"); 59 64 } 60 65 … … 66 71 { 67 72 68 69 /* this is normaly done by World.cc by deleting the ParticleEngine */70 if (SwarmProjectile::trailParticles != NULL && SwarmProjectile::objectList().size() <= 1)71 {72 if (ParticleSystem::objectList().exists(SwarmProjectile::trailParticles))73 delete SwarmProjectile::trailParticles;74 SwarmProjectile::trailParticles = NULL;75 }76 73 if (SwarmProjectile::explosionParticles != NULL && SwarmProjectile::objectList().size() <= 1) 77 74 { … … 80 77 SwarmProjectile::explosionParticles = NULL; 81 78 } 82 delete this->emitter;83 } 84 85 SpriteParticles* SwarmProjectile::trailParticles = NULL; 79 // delete this->emitter; 80 delete this->trail; 81 } 82 86 83 SpriteParticles* SwarmProjectile::explosionParticles = NULL; 87 84 … … 90 87 void SwarmProjectile::activate() 91 88 { 92 if (unlikely(SwarmProjectile::trailParticles == NULL))93 {94 SwarmProjectile::trailParticles = new SpriteParticles(2000);95 SwarmProjectile::trailParticles->setName("SwarmProjectileTrailParticles");96 SwarmProjectile::trailParticles->setMaterialTexture("maps/radial-trans-noise.png");97 SwarmProjectile::trailParticles->setLifeSpan(.3, 0);98 SwarmProjectile::trailParticles->setRadius(0.0, .7);99 SwarmProjectile::trailParticles->setRadius(0.2, 1.3);100 SwarmProjectile::trailParticles->setRadius(.5, .8);101 SwarmProjectile::trailParticles->setRadius(1.0, 0.3);102 SwarmProjectile::trailParticles->setColor(0.0, 1,0,0,.7);103 SwarmProjectile::trailParticles->setColor(0.2, .8,.8,0,.5);104 SwarmProjectile::trailParticles->setColor(0.5, .8,.8,.8,.8);105 SwarmProjectile::trailParticles->setColor(1.0, .8,.8,.8,.0);106 }107 89 if (unlikely(SwarmProjectile::explosionParticles == NULL)) 108 90 { … … 120 102 } 121 103 122 this->emitter->setSystem(SwarmProjectile::trailParticles);123 104 124 105 this->updateNode(0); … … 253 234 254 235 this->updateAngle(time); 236 237 this->trail->tick(time); 255 238 } 256 239 … … 291 274 //glScalef(2.0, 2.0, 2.0); // no double rescale 292 275 this->getModel()->draw(); 293 276 glTranslatef(-.9,0,0); 277 this->trail->draw(); 294 278 glPopMatrix(); 295 296 } 279 } -
branches/playability/src/world_entities/projectiles/swarm_projectile.h
r10080 r10081 14 14 class FastFactory; 15 15 class Aim; 16 class Trail; 16 17 17 18 class SwarmProjectile : public Projectile … … 36 37 private: 37 38 static FastFactory* fastFactory; 38 static SpriteParticles* trailParticles;39 39 static SpriteParticles* explosionParticles; 40 41 Trail* trail; 40 42 41 43 ParticleEmitter* emitter; -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10078 r10081 34 34 #include "particles/emitter_node.h" 35 35 #include "particles/sprite_particles.h" 36 #include "effects/explosion.h" 37 #include "effects/trail.h" 36 38 37 39 #include "util/loading/factory.h" … … 120 122 { 121 123 this->init(); 124 //this->setParentMode(PNODE_REPARENT_DELETE_CHILDREN); 122 125 if (root != NULL) 123 126 this->loadParams(root); … … 139 142 PRINTF(4)("SPACESHIP INIT\n"); 140 143 141 secWeaponMan.showCrosshair();142 143 144 //weapons: 144 145 /* 145 146 Weapon* wpRight1 = new LightBlaster (); 146 147 wpRight1->setName( "LightBlaster"); … … 148 149 Weapon* wpLeft1 = new LightBlaster (); 149 150 wpLeft1->setName( "LightBlaster"); 150 wpLeft1->setParent( this); 151 wpLeft1->setParent( this);*/ 151 152 152 153 Weapon* wpRight2 = new MediumBlaster (); … … 156 157 wpLeft2->setName( "MediumBlaster"); 157 158 wpLeft2->setParent( this); 158 159 /* 159 160 Weapon* wpRight3 = new HeavyBlaster (); 160 161 wpRight3->setName( "HeavyBlaster"); … … 162 163 Weapon* wpLeft3 = new HeavyBlaster (); 163 164 wpLeft3->setName( "HeavyBlaster"); 164 wpLeft3->setParent( this); 165 wpLeft3->setParent( this);*/ 165 166 166 167 Weapon* cannon = new SwarmLauncher(); … … 169 170 170 171 171 this->weaponMan.addWeapon( wpLeft1, 0, 0);172 this->weaponMan.addWeapon( wpRight1, 0, 1);172 //this->weaponMan.addWeapon( wpLeft1, 0, 0); 173 //this->weaponMan.addWeapon( wpRight1, 0, 1); 173 174 this->weaponMan.addWeapon( wpLeft2, 0, 2); 174 175 this->weaponMan.addWeapon( wpRight2, 0, 3); 175 this->weaponMan.addWeapon( wpLeft3, 0, 4);176 this->weaponMan.addWeapon( wpRight3, 0, 5);176 //this->weaponMan.addWeapon( wpLeft3, 0, 4); 177 //this->weaponMan.addWeapon( wpRight3, 0, 5); 177 178 178 179 this->secWeaponMan.addWeapon( cannon, 1, 0); … … 181 182 this->secWeaponMan.changeWeaponConfig(1); 182 183 183 wpRight1->requestAction(WA_ACTIVATE);184 wpLeft1->requestAction(WA_ACTIVATE);184 //wpRight1->requestAction(WA_ACTIVATE); 185 //wpLeft1->requestAction(WA_ACTIVATE); 185 186 wpRight2->requestAction(WA_ACTIVATE); 186 187 wpLeft2->requestAction(WA_ACTIVATE); 187 wpRight3->requestAction(WA_ACTIVATE);188 wpLeft3->requestAction(WA_ACTIVATE);188 //wpRight3->requestAction(WA_ACTIVATE); 189 //wpLeft3->requestAction(WA_ACTIVATE); 189 190 190 191 cannon->requestAction(WA_ACTIVATE); … … 301 302 dynamic_cast<Element2D*>(this->weaponMan.getFixedTarget())->setVisibility( false); 302 303 303 this->burstEmitter = new DotEmitter(800, 0.0, .01);304 this->burstEmitter->setParent(this);305 this->burstEmitter->setRelCoor(-1, .5, 0);306 this->burstEmitter->setName("SpaceShip_Burst_emitter");307 this->burstEmitter->setEmissionRate(800);308 309 this->burstSystem = new SpriteParticles(400);310 this->burstSystem->addEmitter(this->burstEmitter);311 this->burstSystem->setName("SpaceShip_Burst_System");312 ((SpriteParticles*)this->burstSystem)->setMaterialTexture("maps/radial-trans-noise.png");313 this->burstSystem->setLifeSpan(0.3, .3);314 this->burstSystem->setRadius(0.0, 1.0);315 this->burstSystem->setRadius(0.05, 1.0);316 this->burstSystem->setRadius(.5, .6);317 this->burstSystem->setRadius(1.0, 0);318 this->burstSystem->setColor(0.0, .7,.7,1,.5);319 this->burstSystem->setColor(0.2, 0,0,0.8,.7);320 this->burstSystem->setColor(0.5, .5,.5,.8,.8);321 this->burstSystem->setColor(1.0, .8,.8,.8,.0);322 304 323 305 registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) ); … … 342 324 343 325 this->setSupportedPlaymodes(Playable::Horizontal | Playable::Vertical); 326 327 328 this->trail = new Trail( 15, 10, .2); 329 this->trail->setParent( this); 330 this->trail->setTexture( "maps/engine.png"); 331 332 this->trailL = new Trail( 15, 10, .2); 333 this->trailL->setParent( this); 334 this->trailL->setTexture( "maps/engine.png"); 335 336 this->trailR = new Trail( 15, 10, .2); 337 this->trailR->setParent( this); 338 this->trailR->setTexture( "maps/engine.png"); 344 339 } 345 340 … … 376 371 { 377 372 this->secWeaponMan.showCrosshair(); 373 /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 374 { 375 if( likely( dynamic_cast<WorldEntity*>(*it) != NULL)) 376 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01); 377 }*/ 378 378 this->toList( OM_GROUP_01 ); 379 /*for(ObjectList<WorldEntity>::const_iterator it = WorldEntity::objectList().begin(); it != WorldEntity::objectList().end(); it++)380 {381 (*it)->toList( OM_GROUP_01);382 }*/383 379 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true); 384 380 //this->attachCamera(); … … 389 385 { 390 386 this->secWeaponMan.hideCrosshair(); 387 /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 388 { 389 if( likely(dynamic_cast<WorldEntity*>(*it) != NULL)) 390 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00); 391 }*/ 391 392 this->toList( OM_GROUP_00); 392 /*for(ObjectList<WorldEntity>::const_iterator it = WorldEntity::objectList().begin(); it != WorldEntity::objectList().end(); it++)393 {394 (*it)->toList( OM_GROUP_00);395 }*/396 393 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false); 397 394 //this->detachCamera(); … … 424 421 void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location) 425 422 { 423 PRINTF(0)("SPACESHIP COLLIDED WITH %s\n",entity->getCName()); 426 424 } 427 425 … … 433 431 WorldEntity::draw(); 434 432 433 glMatrixMode(GL_MODELVIEW); 434 glPushMatrix(); 435 436 float matrix[4][4]; 437 glTranslatef (this->getAbsCoor ().x-1, this->getAbsCoor ().y-.2, this->getAbsCoor ().z); 438 this->getAbsDir().matrix (matrix); 439 glMultMatrixf((float*)matrix); 440 //glScalef(2.0, 2.0, 2.0); // no double rescale 441 442 this->trail->draw(); 443 444 glTranslatef(0,0,-.5); 445 this->trailL->draw(); 446 447 glTranslatef(0,0,1); 448 this->trailR->draw(); 449 glPopMatrix(); 435 450 //this->debug(0); 436 451 } … … 512 527 this->cameraNode.setRelDirSoft(this->getAbsDir(), 30.0f); 513 528 514 this-> burstEmitter->setEmissionRate(this->cameraSpeed + (velocity.z>0)*velocity.z);515 this-> burstEmitter->setEmissionVelocity(this->cameraSpeed + (velocity.z>0)*velocity.z, travelSpeed *.1);516 529 this->trail->tick(time); 530 this->trailL->tick(time); 531 this->trailR->tick(time); 517 532 //orient the spaceship in direction of the mouse 518 533 /* … … 585 600 { 586 601 PRINTF(0)("spaceship destroy\n"); 587 602 /* 588 603 EmitterNode* node = NULL; 589 604 DotEmitter* emitter = NULL; … … 613 628 node->setVelocity( this->getParent()->getVelocity()); 614 629 node->setAbsCoor( this->getAbsCoor()); 615 node->start(); 630 node->start();*/ 631 PNode* node = new PNode(); 632 node->setAbsCoor(this->getAbsCoor()); 633 Explosion* explosion = new Explosion(); 634 explosion->explode( node, Vector(5,5,5)); 616 635 617 636 this->setAbsCoor(Vector(-10000,10000,10000)); … … 619 638 620 639 this->toList( OM_DEAD); 621 /*for(ObjectList< WorldEntity>::const_iterator it = WorldEntity::objectList().begin(); it != WorldEntity::objectList().end(); it++)640 /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 622 641 { 623 (*it)->toList( OM_DEAD); 642 if( dynamic_cast<WorldEntity*>(*it) != NULL) 643 dynamic_cast<WorldEntity*>(*it)->toList( OM_DEAD); 624 644 }*/ 625 645 PRINTF(0)("spaceship destroy == ship translated \n"); … … 628 648 void SpaceShip::respawn( ) 629 649 { 630 //this->show(); 631 //this->toList( OM_GROUP_00); 650 this->unhide(); 651 /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 652 { 653 if( dynamic_cast<WorldEntity*>(*it) != NULL) 654 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00); 655 }*/ 656 /*if( this->hasPlayer()) 657 this->toList( OM_GROUP_01); 658 else 659 this->toList( OM_GROUP_00);*/ 660 632 661 } 633 662 634 663 635 664 void SpaceShip::damage(float pDamage, float eDamage){ 636 PRINTF(0)("ship hit"); 637 printf("Shit hit"); 665 PRINTF(0)("ship hit for (%f,%f) \n",pDamage,eDamage); 666 PRINTF(0)("SHIP HIT - SHIP HIT - SHIP HIT\n"); 667 638 668 if( this->shieldActive) { 639 669 if( this->shieldCur > pDamage) { … … 643 673 this->shieldCur -=pDamage; 644 674 this->shieldActive = false; //shield collapses 645 pDamage = pDamage -this->shieldCur;675 pDamage += this->shieldCur; 646 676 if( !this->shieldActive) { 647 677 this->armorCur -= pDamage / 2; // remaining damages hits armor at half rate -
branches/playability/src/world_entities/space_ships/space_ship.h
r10078 r10081 19 19 class ParticleEmitter; 20 20 class ParticleSystem; 21 class Trail; 21 22 22 23 class SpaceShip : public Playable … … 177 178 byte oldMask; //!< used for synchronisation 178 179 179 ParticleEmitter* burstEmitter; 180 ParticleSystem* burstSystem; 180 Trail* trail; //!< Burst trail 181 Trail* trailL; //!< Burst trail 182 Trail* trailR; //!< Burst trail 183 181 184 }; 182 185
Note: See TracChangeset
for help on using the changeset viewer.