Changeset 10081 in orxonox.OLD for branches/playability/src/world_entities/space_ships/space_ship.cc
- Timestamp:
- Dec 16, 2006, 2:12:41 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.