Changeset 9235 in orxonox.OLD for trunk/src/world_entities/space_ships
- Timestamp:
- Jul 5, 2006, 4:39:02 PM (18 years ago)
- Location:
- trunk/src/world_entities/space_ships
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/cruizer.cc
r9061 r9235 78 78 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 79 79 80 this->loadModel("models/ships/human_cruizer.obj", 0.05);80 // this->loadModel("models/ships/human_cruizer.obj", 0.05); 81 81 82 82 } -
trunk/src/world_entities/space_ships/helicopter.cc
r8783 r9235 43 43 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 44 44 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 45 45 46 46 ); 47 47 … … 124 124 void Helicopter::init() 125 125 { 126 this->chopperBuffer = NULL; 127 126 128 this->setClassID(CL_HELICOPTER, "Helicopter"); 127 128 129 PRINTF(4)("HELICOPTER INIT\n"); 129 130 -
trunk/src/world_entities/space_ships/helicopter.h
r8783 r9235 39 39 40 40 virtual void process(const Event &event); 41 41 42 42 virtual void moveUp(bool move){bAscend = move;}; 43 43 virtual void moveDown(bool move){bDescend = move;}; … … 78 78 float airViscosity; 79 79 80 OrxSound::SoundSource soundSource;81 OrxSound::SoundBuffer* chopperBuffer;80 OrxSound::SoundSource soundSource; 81 OrxSound::SoundBuffer* chopperBuffer; 82 82 83 83 }; -
trunk/src/world_entities/space_ships/hover.cc
r8719 r9235 25 25 26 26 #include "util/loading/factory.h" 27 //#include "util/loading/resource_manager.h" 28 27 29 #include "key_mapper.h" 28 30 #include "state.h" … … 34 36 CREATE_FACTORY(Hover, CL_HOVER); 35 37 38 #include "script_class.h" 39 CREATE_SCRIPTABLE_CLASS(Hover, CL_HOVER, 40 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer)) 41 //Coordinates 42 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 43 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 44 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 45 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 46 ); 47 36 48 /** 37 49 * destructs the hover, deletes alocated memory … … 40 52 { 41 53 this->setPlayer(NULL); 54 55 //if (this->hoverBuffer != NULL) 56 // ResourceManager::getInstance()->unload(this->hoverBuffer); 42 57 } 43 58 … … 58 73 59 74 this->loadParams(doc.RootElement()); 75 76 //load sound 77 //if (this->hoverBuffer != NULL) 78 // ResourceManager::getInstance()->unload(this->hoverBuffer); 79 //this->hoverBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/engine/hover.wav", WAV); 80 60 81 } 61 82 … … 97 118 void Hover::init() 98 119 { 120 121 //this->hitEntity = NULL; 122 //this->hoverBuffer = NULL; 123 99 124 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 100 125 this->setClassID(CL_HOVER, "Hover"); … … 112 137 this->cameraLook = 0.0f; 113 138 this->rotation = 0.0f; 114 this->acceleration = 25.0f;139 this->acceleration = 15.0f; 115 140 this->airFriction = 3.0f; 116 141 … … 206 231 State::getCameraNode()->setRelCoorSoft(-10, 0,0); 207 232 State::getCameraTargetNode()->setParentSoft(&this->cameraNode); 233 234 //this->soundSource.play(this->hoverBuffer, 0.3f, true); 235 208 236 } 209 237 -
trunk/src/world_entities/space_ships/hover.h
r7346 r9235 7 7 #ifndef _HOVER_H 8 8 #define _HOVER_H 9 10 //#include "sound_buffer.h" 11 //#include "sound_source.h" 9 12 10 13 #include "playable.h" … … 68 71 float airViscosity; 69 72 70 WorldEntity* hitEntity; 73 WorldEntity* hitEntity; 74 75 //OrxSound::SoundSource soundSource; 76 //OrxSound::SoundBuffer* hoverBuffer; 71 77 }; 72 78 -
trunk/src/world_entities/space_ships/space_ship.cc
r9110 r9235 58 58 CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP, 59 59 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer)) 60 ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire)) 61 ->addMethod("loadModel", ExecutorLua2<WorldEntity,const std::string& ,float>(&WorldEntity::loadModel2)) 62 ->addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName)) 63 ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide)) 64 ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide)) 60 65 //Coordinates 61 66 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) … … 352 357 // return; 353 358 354 // spaceship controlled movement 359 // spaceship controlled movement fire(bool bF){ this->bFire = bF;} 355 360 //if (this->getOwner() == this->getHostID()) 356 361 this->calculateVelocity(time); … … 404 409 Vector accel(0.0, 0.0, 0.0); 405 410 /* 406 Vector rot(0.0, 0.0, 0.0); // wird ben ötigt für Helicopter411 Vector rot(0.0, 0.0, 0.0); // wird ben�igt fr Helicopter 407 412 */ 408 413 //float rotVal = 0.0; … … 513 518 } 514 519 515 void SpaceShip::destroy( )520 void SpaceShip::destroy( WorldEntity* killer ) 516 521 { 517 522 PRINTF(0)("spaceship destroy\n"); -
trunk/src/world_entities/space_ships/space_ship.h
r9008 r9235 37 37 virtual void leftWorld(); 38 38 39 virtual void destroy( );39 virtual void destroy(WorldEntity* killer); 40 40 virtual void respawn(); 41 41 -
trunk/src/world_entities/space_ships/spacecraft_2d.cc
r9110 r9235 35 35 #include "debug.h" 36 36 37 #include "script_class.h" 38 39 37 40 CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D); 38 41 39 /** 40 * destructs the spacecraft_2d, deletes alocated memory 41 */ 42 Spacecraft2D::~Spacecraft2D () 43 { 44 this->setPlayer(NULL); 45 delete this->toTravelHeight; 46 } 42 43 CREATE_SCRIPTABLE_CLASS(Spacecraft2D, CL_SPACECRAFT_2D, 44 addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer)) 45 //Coordinates 46 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 47 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) 48 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 49 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 50 ->addMethod("setAirFriction", ExecutorLua1<Spacecraft2D, float>(&Spacecraft2D::setAirFriction)) 51 ); 52 47 53 48 54 /** … … 76 82 this->loadParams(root); 77 83 84 85 78 86 //weapons: 79 Weapon* wpRight = new TestGun(0); 80 wpRight->setName("testGun Right"); 81 Weapon* wpLeft = new TestGun(1); 82 wpLeft->setName("testGun Left"); 83 //Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_HYPERBLASTER)); 87 Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON)); 88 wpRight->setName("Cannon_Right"); 89 Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON)); 90 wpLeft->setName("Cannon_Left"); 91 92 Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN)); 93 wpRight->setName("Turret_Left"); 94 Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN)); 95 wpLeft->setName("Turret_Right"); 84 96 85 97 // cannon->setName("BFG"); … … 87 99 this->addWeapon(wpLeft, 1, 0); 88 100 this->addWeapon(wpRight,1 ,1); 101 this->addWeapon(turretLeft, 1, 2); 102 this->addWeapon(turretRight, 1, 3); 103 89 104 //this->addWeapon(cannon, 0, 2); 90 105 91 106 this->getWeaponManager().changeWeaponConfig(1); 92 107 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 108 } 109 110 111 /** 112 * @brief destructs the spacecraft_2d, deletes alocated memory 113 */ 114 Spacecraft2D::~Spacecraft2D () 115 { 116 this->setPlayer(NULL); 117 delete this->toTravelHeight; 93 118 } 94 119 … … 109 134 this->cameraLook = 0.0f; 110 135 this->rotation = 0.0f; 111 this->acceleration = 10.0f; 112 this->airFriction = 2.0f; 113 114 115 this->setHealthMax(100); 116 this->setHealth(100); 136 this->acceleration = 20.0f; 137 this->airFriction = 0.0f; 138 139 140 this->setHealthMax(1000); 141 this->setHealth(1000); 142 this->setDamage(100.0f); 143 117 144 118 145 … … 122 149 this->travelNode = new PNode(); 123 150 151 this->loadModel("models/ships/mantawing.obj", 5.0f); 124 152 125 153 // camera - issue … … 166 194 this->getWeaponManager().setSlotCount(5); 167 195 168 this->getWeaponManager().setSlotPosition(0, Vector( -0.28, 1.186, -2.750));196 this->getWeaponManager().setSlotPosition(0, Vector(1.843, -0.335, 2.029) * 5.0); 169 197 this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 170 198 171 this->getWeaponManager().setSlotPosition(1, Vector( -0.28, 1.186, 2.750));199 this->getWeaponManager().setSlotPosition(1, Vector(1.843, -0.335, -2.029) * 5.0); 172 200 this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 173 201 174 this->getWeaponManager().setSlotPosition(2, Vector(-1.63, .809, -.003));175 this->getWeaponManager().setSlotCapability(2, WTYPE_HEAVY);176 177 202 /// TODO: THESE ARE TOO MUCH 178 this->getWeaponManager().setSlotPosition( 3, Vector(-1.63, .678, -.652));179 this->getWeaponManager().setSlotDirection( 3, Quaternion(-24/180 * M_PI, Vector(1,0,0)));180 181 this->getWeaponManager().setSlotPosition( 4, Vector(-1.63, .678, .652));182 this->getWeaponManager().setSlotDirection( 4, Quaternion(24/180 * M_PI, Vector(1,0,0)));203 this->getWeaponManager().setSlotPosition(2, Vector(-0.351, -.238, 1.406) * 5.0); 204 this->getWeaponManager().setSlotDirection(2, Quaternion(-1.7, Vector(0,1,0))); 205 206 this->getWeaponManager().setSlotPosition(3, Vector(-0.351, -.238, -1.406) * 5.0); 207 this->getWeaponManager().setSlotDirection(3, Quaternion(1.7, Vector(0,1,0))); 183 208 184 209 this->cameraNode.setRelCoor(1,5,0); … … 193 218 registerVar( new SynchronizeableFloat( &cameraLook, &cameraLook, "cameraLook", PERMISSION_OWNER ) ); 194 219 registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) ); 220 221 222 195 223 } 196 224 … … 285 313 286 314 State::getCameraNode()->setParentSoft(this->travelNode); 287 State::getCameraNode()->setRelCoorSoft(-3, 50,0);315 State::getCameraNode()->setRelCoorSoft(-3, 100,0); 288 316 State::getCameraTargetNode()->setParentSoft(this->travelNode); 289 State::getCameraTargetNode()->setRelCoorSoft( 0,0,0);317 State::getCameraTargetNode()->setRelCoorSoft(5,0,1); 290 318 291 319 … … 406 434 if (this->toTravelHeight != NULL) 407 435 { 408 this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt , 0));436 this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt * 10.0, 0)); 409 437 if (fabsf(this->travelNode->getAbsCoor().y - *this->toTravelHeight) < .1) 410 438 { … … 416 444 417 445 accel.y = 0.0; 446 418 447 Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration); 419 448 accelerationDir.y = 0.0; … … 424 453 425 454 this->velocity += (accelerationDir - damping)* dt; 455 456 if (this->getRelCoor().z > this->travelDistance.y && velocity.z > 0.0) 457 this->velocity.z = 0.0f; 458 if (this->getRelCoor().z < -this->travelDistance.y && velocity.z < 0.0) 459 this->velocity.z = 0.0f; 460 461 if (this->getRelCoor().x > this->travelDistance.x && velocity.x > 0.0) 462 this->velocity.x = 0.0f; 463 if (this->getRelCoor().x < -this->travelDistance.x && velocity.x < 0.0) 464 this->velocity.x = 0.0f; 465 466 426 467 this->shiftCoor (this->velocity * dt); 427 this->setRelDirSoft(Quaternion(0, Vector(0,0,0)), 1.0f); 468 if (accel.z == 0) 469 this->setRelDirSoft(Quaternion(0, Vector(0,0,0)), 5.0f); 470 else 471 this->setRelDirSoft(Quaternion(this->velocity.z * .004, Vector(1,0,0)), 4.5f); 428 472 } 429 473 break; … … 475 519 else if (cameraLook < -M_PI_4) 476 520 cameraLook = -M_PI_4; 477 //this->cameraNode.setRelDirSoft(this->direction,10);478 521 } 479 522 } -
trunk/src/world_entities/space_ships/spacecraft_2d.h
r9110 r9235 27 27 void setTravelDistance(const Vector2D& distance); 28 28 void setTravelDistance(float x, float y); 29 30 void setAirFriction(float friction) { this->airFriction = friction; }; 29 31 30 32
Note: See TracChangeset
for help on using the changeset viewer.