Changeset 10064 in orxonox.OLD for branches/playability/src
- Timestamp:
- Dec 13, 2006, 3:19:40 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/mbolt.cc
r10042 r10064 24 24 25 25 #include "particles/dot_emitter.h" 26 #include "particles/box_emitter.h" 26 27 #include "particles/sprite_particles.h" 28 29 #include "space_ships/space_ship.h" 27 30 28 31 #include <cassert> … … 33 36 34 37 #include "class_id_DEPRECATED.h" 38 ObjectListDefinition(MBolt); 35 39 CREATE_FAST_FACTORY_STATIC(MBolt); 36 40 … … 40 44 MBolt::MBolt () : Projectile() 41 45 { 42 46 this->registerObject(this, MBolt::_objectList); 43 47 this->loadModel("models/projectiles/mbolt.obj",0.25); 44 48 //this->loadModel("models/projectiles/laser.obj"); … … 49 53 this->angle = 0; 50 54 51 this->emitter = new DotEmitter(40, 0, M_2_PI); 55 56 //this->emitter = new DotEmitter(1000, 0, 0); 57 this->emitter = new BoxEmitter(Vector(8,1,1)*dynamic_cast<StaticModel*>(this->getModel())->getScaleFactor(), 1000, 0, 0); 52 58 this->emitter->setParent(this); 53 this->emitter->setSpread(M_PI, M_PI); 54 this->emitter->setEmissionRate(300.0); 55 this->emitter->setEmissionVelocity(50.0); 59 this->emitter->setSpread(M_PI,M_PI); 60 this->emitter->setInheritSpeed(this->velocity.len()); 61 this->emitter->setEmissionRate(500.0); 62 this->emitter->setEmissionVelocity(this->velocity.len()); 56 63 57 64 this->mat = new Material("mBolt"); … … 59 66 this->mat->setBlendFunc(GL_SRC_ALPHA,GL_ONE); 60 67 this->mat->setDiffuse(1,1,1); 61 this->mat->setDiffuseMap("laser .png");68 this->mat->setDiffuseMap("laser_add.png"); 62 69 this->mat->setDiffuseMap("laser.png",1); 70 63 71 dynamic_cast<StaticModel*>(this->getModel())->addMaterial(this->mat); 64 72 dynamic_cast<StaticModel*>(this->getModel())->finalize(); … … 99 107 MBolt::trailParticles->setName("BoomerangProjectileTrailParticles"); 100 108 MBolt::trailParticles->setMaterialTexture("maps/radial-trans-noise.png"); 101 MBolt::trailParticles->setLifeSpan( 1, 0);102 MBolt::trailParticles->setRadius(0.0, 1);103 MBolt::trailParticles->setRadius(1.0, 1);109 MBolt::trailParticles->setLifeSpan(0.3, 0); 110 MBolt::trailParticles->setRadius(0.0, .8); 111 MBolt::trailParticles->setRadius(1.0, .2); 104 112 MBolt::trailParticles->setColor(0.0, 1,0,0,.9); 105 113 MBolt::trailParticles->setColor(0.2, .8,.2,0,.9); 106 MBolt::trailParticles->setColor(0.5, .8,.4, 0,.8);107 MBolt::trailParticles->setColor(1.0, .8,.8, 0,.7);114 MBolt::trailParticles->setColor(0.5, .8,.4,.4,.8); 115 MBolt::trailParticles->setColor(1.0, .8,.8,.8,.7); 108 116 } 109 117 if (unlikely(MBolt::explosionParticles == NULL)) … … 125 133 this->emitter->setSystem(MBolt::trailParticles); 126 134 135 this->emitter->setSpread(0); 136 this->emitter->setEmissionRate(80.0); 137 this->emitter->setEmissionVelocity(0); 127 138 this->updateNode(0); 128 this->emitter->setSpread(0);129 this->emitter->setEmissionRate(20.0);130 this->emitter->setEmissionVelocity(this->velocity.len());131 139 } 132 140 … … 152 160 this->destroy( entity ); 153 161 this->hitEntity = entity; 162 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 154 163 } 155 164 -
branches/playability/src/world_entities/projectiles/mbolt.h
r10042 r10064 18 18 class MBolt : public Projectile 19 19 { 20 //ObjectListDeclaration(MBolt);20 ObjectListDeclaration(MBolt); 21 21 public: 22 22 MBolt (); … … 41 41 42 42 float angle; 43 static const float rotationSpeed = 540;43 static const float rotationSpeed = 1080; 44 44 45 45 ParticleEmitter* emitter; -
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10039 r10064 23 23 #include "particles/dot_emitter.h" 24 24 #include "particles/sprite_particles.h" 25 #include "space_ships/space_ship.h" 25 26 26 27 #include "debug.h" … … 44 45 this->setMinEnergy(1); 45 46 this->setHealthMax(10); 46 this->lifeSpan = 2.0;47 this->lifeSpan = 4.0; 47 48 this->agility = 3.5; 48 49 this->maxVelocity = 100; … … 64 65 SwarmProjectile::~SwarmProjectile () 65 66 { 66 // delete this->emitter; 67 67 68 68 69 /* this is normaly done by World.cc by deleting the ParticleEngine */ … … 79 80 SwarmProjectile::explosionParticles = NULL; 80 81 } 81 82 delete this->emitter; 82 83 } 83 84 … … 96 97 SwarmProjectile::trailParticles->setLifeSpan(1.0, .3); 97 98 SwarmProjectile::trailParticles->setRadius(0.0, .5); 98 SwarmProjectile::trailParticles->setRadius(0.2, 4.0);99 SwarmProjectile::trailParticles->setRadius(.5, 1. 5);100 SwarmProjectile::trailParticles->setRadius(1.0, 1.5);99 SwarmProjectile::trailParticles->setRadius(0.2, 2.0); 100 SwarmProjectile::trailParticles->setRadius(.5, 1.0); 101 SwarmProjectile::trailParticles->setRadius(1.0, 0.6); 101 102 SwarmProjectile::trailParticles->setColor(0.0, 1,0,0,.7); 102 103 SwarmProjectile::trailParticles->setColor(0.2, .8,.8,0,.5); … … 145 146 this->destroy( entity ); 146 147 this->hitEntity = entity; 148 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 147 149 } 148 150 -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10043 r10064 84 84 { 85 85 this->setPlayer(NULL); 86 delete this->emitter; 86 87 } 87 88 … … 135 136 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 136 137 this->registerObject(this, SpaceShip::_objectList); 137 138 this->toList(OM_GROUP_00); 138 139 PRINTF(4)("SPACESHIP INIT\n"); 139 140 … … 207 208 electronicTH = .7 * electronicMax; // 30% of eDamage can be handled by the ship 208 209 209 /*210 this->addWeapon(wpLeft, 1, 0);211 this->addWeapon(wpRight,1 ,1);212 //this->addWeapon(cannon, 0, 6);213 214 this->getWeaponManager().changeWeaponConfig(1);215 */216 210 217 211 this->loadModel("models/ships/mantawing.obj"); … … 220 214 bForward = bBackward = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = bFire = bSecFire = false; 221 215 222 /*223 xMouse = yMouse = 0;224 yInvert = 1;225 mouseSensitivity = 0.001;226 airViscosity = 0.9;227 controlVelocityX = 25;228 controlVelocityY = 150;229 shipInertia = 1.5;230 */231 // cycle = 0.0;232 216 233 217 this->setHealthMax(shieldMax); … … 237 221 238 222 // camera - issue 239 //this->cameraNode = State::getCameraNode();240 223 this->cameraNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 241 224 this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE); 242 225 243 /* 244 this->velocity = this->getAbsDirX()*travelSpeed; 245 this->mouseDir = this->getAbsDir(); 246 this->pitchDir = this->getAbsDir(); 247 */ 248 249 250 // GLGuiButton* button = new GLGuiPushButton(); 251 // button->show(); 252 // button->setLabel("orxonox"); 253 // button->setBindNode(this); 254 // GLGuiBar* bar = new GLGuiBar(); 255 // bar->show(); 256 // bar->setValue(7.0); 257 // bar->setMaximum(10); 258 // bar->setSize2D( 20, 100); 259 // bar->setAbsCoor2D( 10, 200); 226 260 227 261 228 //add events to the eventlist … … 276 243 this->weaponMan.setSlotCount(6); 277 244 278 this->weaponMan.setSlotPosition(0, Vector(-2.6, .1, -3.0));245 this->weaponMan.setSlotPosition(0, Vector(-2.6, 0, -3.0)); 279 246 this->weaponMan.setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 280 247 281 this->weaponMan.setSlotPosition(1, Vector(-2.6, .1, 3.0));248 this->weaponMan.setSlotPosition(1, Vector(-2.6, 0, 3.0)); 282 249 this->weaponMan.setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 283 250 284 this->weaponMan.setSlotPosition(2, Vector(-1.5, .5, -.5));251 this->weaponMan.setSlotPosition(2, Vector(-1.5, 0, -.5)); 285 252 this->weaponMan.setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); 286 253 287 this->weaponMan.setSlotPosition(3, Vector(-1.5, .5, .5));254 this->weaponMan.setSlotPosition(3, Vector(-1.5, 0, .5)); 288 255 this->weaponMan.setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); 289 256 290 this->weaponMan.setSlotPosition(4, Vector(-1.5, -.5, .5));257 this->weaponMan.setSlotPosition(4, Vector(-1.5, 0, .5)); 291 258 this->weaponMan.setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0))); 292 259 293 this->weaponMan.setSlotPosition(5, Vector(-1.5, -.5, -.5));260 this->weaponMan.setSlotPosition(5, Vector(-1.5, 0, -.5)); 294 261 this->weaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 295 262 … … 314 281 this->secWeaponMan.setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 315 282 316 //317 // this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0));318 // this->getWeaponManager().setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));319 //320 // this->getWeaponManager().setSlotPosition(9, Vector(-2.5, -0.3, 2.0));321 // this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:322 283 323 284 this->weaponMan.getFixedTarget()->setParent(this); … … 335 296 this->burstEmitter->setRelCoor(-1, .5, 0); 336 297 this->burstEmitter->setName("SpaceShip_Burst_emitter"); 298 this->burstEmitter->setEmissionRate(200); 337 299 338 300 this->burstSystem = new SpriteParticles(1000); … … 340 302 this->burstSystem->setName("SpaceShip_Burst_System"); 341 303 ((SpriteParticles*)this->burstSystem)->setMaterialTexture("maps/radial-trans-noise.png"); 342 this->burstSystem->setLifeSpan( 1.0, .3);304 this->burstSystem->setLifeSpan(0.4, .3); 343 305 this->burstSystem->setRadius(0.0, 1.0); 344 306 this->burstSystem->setRadius(0.05, 1.0); 345 this->burstSystem->setRadius(.5, . 8);307 this->burstSystem->setRadius(.5, .6); 346 308 this->burstSystem->setRadius(1.0, 0); 347 309 this->burstSystem->setColor(0.0, .7,.7,1,.7); … … 350 312 this->burstSystem->setColor(1.0, .8,.8,.8,.0); 351 313 352 /* 353 registerVar( new SynchronizeableQuaternion( &mouseDir, &mouseDir, "mousedir", PERMISSION_OWNER ) ); 354 registerVar( new SynchronizeableBool( &bUp, &bUp, "bUp", PERMISSION_OWNER ) ); 355 registerVar( new SynchronizeableBool( &bDown, &bDown, "bDown", PERMISSION_OWNER ) ); 356 registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) ); 357 registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) ); 358 registerVar( new SynchronizeableBool( &bAscend, &bAscend, "bAscend", PERMISSION_OWNER ) ); 359 registerVar( new SynchronizeableBool( &bDescend, &bDescend, "bDescend", PERMISSION_OWNER ) ); 360 registerVar( new SynchronizeableBool( &bRollL, &bRollL, "bRollL", PERMISSION_OWNER ) ); 361 registerVar( new SynchronizeableBool( &bRollR, &bRollR, "bRollR", PERMISSION_OWNER ) ); 362 */ 314 this->emitter = NULL; 363 315 364 316 registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) ); … … 369 321 registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) ); 370 322 registerVar( new SynchronizeableBool( &bFire, &bFire, "bSecFire", PERMISSION_OWNER)); 371 372 323 registerVar( new SynchronizeableVector( &velocity, &velocity, "velocity", PERMISSION_MASTER_SERVER ) ); 373 324 … … 404 355 } 405 356 406 /*407 void SpaceShip::setTravelHeight(float travelHeight)408 {409 if (this->toTravelHeight == NULL)410 this->toTravelHeight = new float;411 *this->toTravelHeight = travelHeight;412 }413 */414 415 /*416 void SpaceShip::setTravelDistance(const Vector2D& distance)417 {418 this->travelDistance = distance;419 }420 421 void SpaceShip::setTravelDistance(float x, float y)422 {423 this->setTravelDistance(Vector2D(x, y));424 }425 */426 427 428 429 357 void SpaceShip::reset() 430 358 { … … 441 369 { 442 370 this->secWeaponMan.showCrosshair(); 371 this->toList( OM_GROUP_01 ); 443 372 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true); 444 373 //this->attachCamera(); … … 449 378 { 450 379 this->secWeaponMan.hideCrosshair(); 380 this->toList(OM_GROUP_00); 451 381 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false); 452 382 //this->detachCamera(); … … 466 396 */ 467 397 void SpaceShip::leftWorld () 468 {} 398 {/* 399 this->emitter->stop(); 400 delete this->emitter; 401 delete this->explosionParticles; */ 402 } 469 403 470 404 WorldEntity* ref = NULL; … … 603 537 604 538 } 605 606 /*607 void SpaceShip::calculateVelocity (float time)608 {609 Vector accel(0.0, 0.0, 0.0);610 /* calculate the direction in which the craft is heading */611 /*612 if( this->bUp )613 {614 accel += (this->getAbsDirX())*acceleration;615 616 }617 618 if( this->bDown )619 {620 accel -= (this->getAbsDirX())*0.5*acceleration;621 622 }623 624 if( this->bLeft)625 {626 this->shiftDir(Quaternion(time, Vector(0,1,0)));627 }628 if( this->bRight)629 {630 this->shiftDir(Quaternion(-time, Vector(0,1,0)));631 }632 633 634 if( this->bRollL)635 {636 mouseDir *= Quaternion(-time*2, Vector(1,0,0));637 }638 if( this->bRollR)639 {640 mouseDir *= Quaternion(time*2, Vector(1,0,0));641 642 }643 if (this->bAscend )644 {645 this->shiftDir(Quaternion(time, Vector(0,0,1)));646 }647 if (this->bDescend )648 {649 this->shiftDir(Quaternion(-time, Vector(0,0,1)));650 }651 652 velocity += accel*time*10;653 654 }655 */656 539 657 540 /** … … 689 572 { 690 573 PRINTF(0)("spaceship destroy\n"); 574 575 this->explosionParticles = new SpriteParticles(1000); 576 this->explosionParticles->setName("MBoltExplosionParticles"); 577 this->explosionParticles->setLifeSpan(.5, .3); 578 this->explosionParticles->setRadius(0.0, 10.0); 579 this->explosionParticles->setRadius(.5, 6.0); 580 this->explosionParticles->setRadius(1.0, 3.0); 581 this->explosionParticles->setColor(0.0, 1,1,0,.9); 582 this->explosionParticles->setColor(0.5, .8,.8,0,.5); 583 this->explosionParticles->setColor(1.0, .8,.8,.7,.0); 584 585 this->emitter = new DotEmitter(100000, 0, 0); 586 this->emitter->setParent(this); 587 this->emitter->setSpread(M_PI,M_PI); 588 this->emitter->setEmissionRate(50.0); 589 this->emitter->setEmissionVelocity(50.0); 590 591 this->emitter->setSystem(this->explosionParticles); 592 593 this->emitter->setSpread(50); 594 this->emitter->setEmissionRate(50.0); 595 this->emitter->setEmissionVelocity(50.0); 596 this->updateNode(0); 597 598 this->toList(OM_DEAD); 691 599 } 692 600 693 601 void SpaceShip::respawn( ) 694 602 { 695 toList( OM_ PLAYERS);603 toList( OM_GROUP_00 ); 696 604 } 697 605 698 606 699 607 void SpaceShip::damage(float pDamage, float eDamage){ 700 if( this->shieldActive) { 608 PRINTF(0)("ship hit"); 609 printf("Shit hit"); 610 if( this->shieldActive) { 701 611 if( this->shieldCur > pDamage) { 702 612 this->shieldCur = this->shieldCur - pDamage; … … 717 627 } 718 628 if( this->armorCur <= 0) { /* FIXME implement shipcrash*/ } 629 this->destroy(this); 719 630 } 720 631 -
branches/playability/src/world_entities/space_ships/space_ship.h
r10043 r10064 176 176 ParticleEmitter* burstEmitter; 177 177 ParticleSystem* burstSystem; 178 179 180 SpriteParticles* explosionParticles; 181 ParticleEmitter* emitter; 178 182 }; 179 183 -
branches/playability/src/world_entities/weapons/medium_blaster.cc
r10042 r10064 96 96 pj->setParent(PNode::getNullParent()); 97 97 98 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*1 50);98 pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*160); 99 99 100 100 pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset
for help on using the changeset viewer.