Changeset 6799 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jan 27, 2006, 4:16:02 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/hover.cc
r6780 r6799 17 17 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY 18 18 19 #include "h elicopter.h"19 #include "hover.h" 20 20 21 21 #include "weapons/weapon_manager.h" … … 33 33 using namespace std; 34 34 35 CREATE_FACTORY(H elicopter, CL_HELICOPTER);36 37 /** 38 * creates the controlable H elicopter39 */ 40 H elicopter::Helicopter()35 CREATE_FACTORY(Hover, CL_HOVER); 36 37 /** 38 * creates the controlable Hover 39 */ 40 Hover::Hover() 41 41 { 42 42 this->init(); … … 44 44 45 45 /** 46 * destructs the h elicopter, deletes alocated memory47 */ 48 H elicopter::~Helicopter ()49 { 50 } 51 52 /** 53 * loads a H elicopter information from a specified file.54 * @param fileName the name of the File to load the h elicopter from (absolute path)55 */ 56 H elicopter::Helicopter(const char* fileName)46 * destructs the hover, deletes alocated memory 47 */ 48 Hover::~Hover () 49 { 50 } 51 52 /** 53 * loads a Hover information from a specified file. 54 * @param fileName the name of the File to load the hover from (absolute path) 55 */ 56 Hover::Hover(const char* fileName) 57 57 { 58 58 this->init(); … … 61 61 if(!doc.LoadFile()) 62 62 { 63 PRINTF(2)("Loading file %s failed for H elicopter.\n", fileName);63 PRINTF(2)("Loading file %s failed for Hover.\n", fileName); 64 64 return; 65 65 } … … 74 74 @todo add more parameters to load 75 75 */ 76 H elicopter::Helicopter(const TiXmlElement* root)76 Hover::Hover(const TiXmlElement* root) 77 77 { 78 78 this->init(); … … 101 101 102 102 /** 103 * initializes a H elicopter104 */ 105 void H elicopter::init()103 * initializes a Hover 104 */ 105 void Hover::init() 106 106 { 107 107 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 108 this->setClassID(CL_H ELICOPTER, "Helicopter");109 110 PRINTF(4)("H ELICOPTER INIT\n");111 112 this->loadModel("models/ships/h elicopter_#.obj", 1.0);108 this->setClassID(CL_HOVER, "Hover"); 109 110 PRINTF(4)("HOVER INIT\n"); 111 112 this->loadModel("models/ships/hover_#.obj", 1.0); 113 113 114 114 EventHandler::getInstance()->grabEvents(true); … … 124 124 125 125 //cycle = 0.0; 126 126 127 127 // cameraissue 128 128 this->cameraNode.setParent(this); 129 129 this->cameraNode.setParentMode(PNODE_ALL); 130 131 130 131 132 132 // rotors 133 133 this->topRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 134 134 this->tailRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 135 135 136 136 this->topRotor.setParent(this); 137 137 this->tailRotor.setParent(this); 138 138 139 139 this->topRotor.setRelCoor(Vector(-0.877,0.627,0)); 140 140 this->tailRotor.setRelCoor(Vector(-4.43,0.297,0.068)); 141 141 this->tailRotor.setAbsDir(Quaternion(M_PI_2,Vector(1,0,0))); 142 142 143 143 this->loadModel("models/ships/rotor.obj",1.0,3); 144 144 this->loadModel("models/ships/rotor.obj",0.2,4); … … 205 205 206 206 /** 207 * loads the Settings of a H elicopter from an XML-element.207 * loads the Settings of a Hover from an XML-element. 208 208 * @param root the XML-element to load the Spaceship's properties from 209 209 */ 210 void H elicopter::loadParams(const TiXmlElement* root)210 void Hover::loadParams(const TiXmlElement* root) 211 211 { 212 212 WorldEntity::loadParams(root); 213 213 } 214 214 215 void H elicopter::attachCamera()215 void Hover::attachCamera() 216 216 { 217 217 State::getCamera()->setParentSoft(this->getWeaponManager()->getFixedTarget()); … … 221 221 222 222 223 void H elicopter::enter()223 void Hover::enter() 224 224 { 225 225 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true); … … 229 229 } 230 230 231 void H elicopter::leave()231 void Hover::leave() 232 232 { 233 233 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); … … 238 238 239 239 /** 240 * effect that occurs after the H elicopter is spawned241 */ 242 void H elicopter::postSpawn ()240 * effect that occurs after the Hover is spawned 241 */ 242 void Hover::postSpawn () 243 243 { 244 244 //setCollision(new CollisionCluster(1.0, Vector(0,0,0))); … … 246 246 247 247 /** 248 * the action occuring if the h elicopter left the game249 */ 250 void H elicopter::leftWorld ()248 * the action occuring if the hover left the game 249 */ 250 void Hover::leftWorld () 251 251 {} 252 252 … … 257 257 * Implement behaviour like damage application or other miscellaneous collision stuff in this function 258 258 */ 259 void H elicopter::collidesWith(WorldEntity* entity, const Vector& location)259 void Hover::collidesWith(WorldEntity* entity, const Vector& location) 260 260 { 261 261 if (entity->isA(CL_TURRET_POWER_UP)) … … 272 272 * @param time The timespan passed since last update 273 273 */ 274 void H elicopter::tick (float time)274 void Hover::tick (float time) 275 275 { 276 276 if( xMouse != 0 || yMouse != 0) … … 281 281 else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY; 282 282 } 283 283 284 284 // rotorrotation 285 285 this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0))); 286 286 this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0))); 287 287 288 288 // spaceship controlled movement 289 289 this->calculateVelocity(time); … … 293 293 // this is the air friction (necessary for a smooth control) 294 294 if(velocity.len() != 0) velocity -= velocity*0.1; 295 295 296 296 //travelSpeed = velocity.len(); 297 297 … … 301 301 this->shiftCoor(getAbsDirY()*rotorspeed); 302 302 */ 303 303 304 304 /* 305 305 //hoover effect … … 326 326 * @param time the timeslice since the last frame 327 327 */ 328 void H elicopter::calculateVelocity (float time)328 void Hover::calculateVelocity (float time) 329 329 { 330 330 Vector accel(0.0, 0.0, 0.0); … … 338 338 //this->shiftCoor(this->getAbsDirX()); 339 339 //accel -= this->getAbsDirY(); 340 340 341 341 accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z); 342 342 if((this->getAbsDirX()).y >= -0.1) rotValZ -= time; … … 351 351 //this->shiftCoor((this->getAbsDirX())*-1); 352 352 //accel -= this->getAbsDirY(); 353 353 354 354 accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z); 355 355 rotValZ += time; … … 365 365 //accel -= this->getAbsDirY(); 366 366 //velocityDir.normalize(); 367 367 368 368 accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z); 369 369 rotValX -= time; … … 379 379 //accel += this->getAbsDirY(); 380 380 //velocityDir.normalize(); 381 381 382 382 accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z); 383 383 rotValX += time; … … 443 443 444 444 445 void H elicopter::draw() const445 void Hover::draw() const 446 446 { 447 447 WorldEntity::draw(); 448 448 449 449 glMatrixMode(GL_MODELVIEW); 450 450 glPushMatrix(); … … 478 478 * weapon manipulation by the player 479 479 */ 480 void H elicopter::weaponAction()480 void Hover::weaponAction() 481 481 { 482 482 if( this->bFire) … … 489 489 * @todo switch statement ?? 490 490 */ 491 void H elicopter::process(const Event &event)491 void Hover::process(const Event &event) 492 492 { 493 493 … … 517 517 518 518 this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))); 519 519 520 520 Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)); 521 521 522 522 523 523 if ((this->cameraNode.getAbsDirY()).y < 0.5) 524 524 { … … 538 538 #include "weapons/aiming_turret.h" 539 539 // FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG 540 void H elicopter::ADDWEAPON()540 void Hover::ADDWEAPON() 541 541 { 542 542 Weapon* turret = NULL; -
trunk/src/world_entities/space_ships/hover.h
r6780 r6799 1 1 2 2 /*! 3 * @file h elicopter.h4 * Implements the Control of a H elicopter3 * @file hover.h 4 * Implements the Control of a Hover 5 5 */ 6 6 7 #ifndef _H ELICOPTER_H8 #define _H ELICOPTER_H7 #ifndef _HOVER_H 8 #define _HOVER_H 9 9 10 10 #include "playable.h" 11 11 12 12 13 class H elicopter : public Playable13 class Hover : public Playable 14 14 { 15 15 16 16 public: 17 17 18 H elicopter();19 H elicopter(const char* fileName);20 H elicopter(const TiXmlElement* root);21 virtual ~H elicopter();18 Hover(); 19 Hover(const char* fileName); 20 Hover(const TiXmlElement* root); 21 virtual ~Hover(); 22 22 23 23 void init(); … … 63 63 int controlVelocityY; 64 64 //float cycle; //!< hovercycle 65 65 66 66 PNode topRotor; 67 67 PNode tailRotor; 68 68 69 69 PNode cameraNode; 70 70 … … 80 80 }; 81 81 82 #endif /* _H ELICOPTERS_H */82 #endif /* _HOVERS_H */ -
trunk/src/world_entities/weapons/cannon.cc
r6671 r6799 74 74 // this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN); 75 75 76 this->loadModel("models/guns/ cannon.obj");76 this->loadModel("models/guns/plasmadriver_#.obj"); 77 77 78 78 this->setStateDuration(WS_SHOOTING, 2.0);
Note: See TracChangeset
for help on using the changeset viewer.