Changeset 8228 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Jun 8, 2006, 11:19:08 AM (18 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/space_ship.cc
r7954 r8228 305 305 } 306 306 } 307 //PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);307 PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z); 308 308 } 309 309 -
trunk/src/world_entities/spectator.cc
r8147 r8228 24 24 25 25 26 /** 27 * constructor 28 */ 29 Spectator::Spectator( const TiXmlElement * root ) 30 { 26 using namespace std; 27 28 29 /** 30 * destructs the Spectator, deletes alocated memory 31 */ 32 Spectator::~Spectator () 33 { 34 this->setPlayer(NULL); 35 } 36 37 38 /** 39 * creates a new Spectator from Xml Data 40 * @param root the xml element containing Spectator data 41 42 @todo add more parameters to load 43 */ 44 Spectator::Spectator(const TiXmlElement* root) 45 { 46 this->init(); 47 if (root != NULL) 48 this->loadParams(root); 49 50 } 51 52 53 /** 54 * initializes a Spectator 55 */ 56 void Spectator::init() 57 { 58 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 31 59 this->setClassID(CL_SPECTATOR, "Spectator"); 32 33 bool bLeft; 34 bool bRight; 35 bool bForward; 36 bool bBackward; 37 38 float xMouse; //!< mouse moved in x-Direction 39 float yMouse; //!< mouse moved in y-Direction 60 61 this->getWeaponManager().changeWeaponConfig(1); 40 62 41 63 this->bLeft = false; … … 45 67 this->xMouse = 0.0f; 46 68 this->yMouse = 0.0f; 47 69 70 this->setHealthMax(100); 71 this->setHealth(80); 72 73 this->mouseDir = this->getAbsDir(); 74 75 //add events to the eventlist 48 76 registerEvent(KeyMapper::PEV_FORWARD); 49 77 registerEvent(KeyMapper::PEV_BACKWARD); … … 52 80 registerEvent(KeyMapper::PEV_FIRE1); 53 81 registerEvent(EV_MOUSE_MOTION); 54 82 83 this->getWeaponManager().setSlotCount(0); 84 85 this->getWeaponManager().getFixedTarget()->setParent(this); 86 this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0); 87 88 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 89 90 55 91 registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) ); 56 92 registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) ); … … 60 96 } 61 97 62 /** 63 * destructor 64 */ 65 Spectator::~Spectator( ) 66 { 67 this->setPlayer(NULL); 68 } 69 70 void Spectator::setPlayDirection( const Quaternion & rot, float speed ) 71 { 72 this->mouseDir = rot; 73 this->angleY = rot.getHeading(); 74 this->angleX = rot.getAttitude(); 75 } 76 77 void Spectator::enter( ) 78 { 98 99 /** 100 * loads the Settings of a Spectator from an XML-element. 101 * @param root the XML-element to load the Spaceship's properties from 102 */ 103 void Spectator::loadParams(const TiXmlElement* root) 104 { 105 Playable::loadParams(root); 106 } 107 108 void Spectator::setPlayDirection(const Quaternion& quat, float speed) 109 { 110 this->mouseDir = quat; 111 this->angleY = quat.getHeading(); 112 this->angleX = quat.getAttitude(); 113 } 114 115 116 void Spectator::reset() 117 { 118 this->bLeft = false; 119 this->bRight = false; 120 this->bForward = false; 121 this->bBackward = false; 122 this->xMouse = 0.0f; 123 this->yMouse = 0.0f; 124 125 this->setHealth(80); 126 } 127 128 129 void Spectator::enter() 130 { 131 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false ); 79 132 this->attachCamera(); 80 133 } 81 134 82 void Spectator::leave( ) 83 { 135 void Spectator::leave() 136 { 137 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 84 138 this->detachCamera(); 85 139 } 86 140 87 /** 88 * collision handling 89 * @param entity other entity 90 * @param location 91 * @todo dont allow spectator to go through walls 92 */ 93 void Spectator::collidesWith( WorldEntity * entity, const Vector & location ) 94 { 95 } 96 97 void Spectator::tick( float time ) 141 142 /** 143 * this function is called, when two entities collide 144 * @param entity: the world entity with whom it collides 145 * 146 * Implement behaviour like damage application or other miscellaneous collision stuff in this function 147 * @todo dont let Spectator fly through walls 148 */ 149 void Spectator::collidesWith(WorldEntity* entity, const Vector& location) 150 { 151 } 152 153 154 155 /** 156 * the function called for each passing timeSnap 157 * @param time The timespan passed since last update 158 */ 159 void Spectator::tick (float time) 98 160 { 99 161 Playable::tick( time ); … … 147 209 } 148 210 149 void Spectator::process( const Event & event ) 211 /** 212 * @todo switch statement ?? 213 */ 214 void Spectator::process(const Event &event) 150 215 { 151 216 Playable::process(event); … … 165 230 } 166 231 } 232 233 234 235 -
trunk/src/world_entities/spectator.h
r8147 r8228 11 11 class Spectator : public Playable 12 12 { 13 13 14 public: 14 Spectator( const TiXmlElement* root = NULL);15 Spectator(const TiXmlElement* root = NULL); 15 16 virtual ~Spectator(); 16 17 18 virtual void loadParams(const TiXmlElement* root); 19 17 20 virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); 18 21 19 22 virtual void enter(); 20 23 virtual void leave(); 21 24 25 virtual void reset(); 26 22 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 23 28 virtual void tick(float time); 24 29 25 30 virtual void process(const Event &event); 26 31 27 32 private: 33 void init(); 34 28 35 bool bLeft; 29 36 bool bRight; … … 35 42 Quaternion mouseDir; //!< the direction where the player wants to fly 36 43 37 //Quaternion rotY;38 //Quaternion rotAxis;39 44 float angleX; 40 45 float angleY; 46 41 47 }; 42 48
Note: See TracChangeset
for help on using the changeset viewer.