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