Changeset 4592 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- Jun 10, 2005, 7:17:22 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/camera.h
r4490 r4592 1 /*! 1 /*! 2 2 \file camera.h 3 3 \brief Viewpoint controlling class definitions 4 */ 4 */ 5 5 6 6 #ifndef _CAMERA_H … … 16 16 17 17 //! an enumerator for different types of view 18 typedef enum ViewMode{ VIEW_NORMAL, 19 VIEW_BEHIND, 20 VIEW_FRONT, 21 VIEW_LEFT, 22 VIEW_RIGHT, 23 VIEW_TOP }; 18 typedef enum ViewMode 19 { 20 VIEW_NORMAL, 21 VIEW_BEHIND, 22 VIEW_FRONT, 23 VIEW_LEFT, 24 VIEW_RIGHT, 25 VIEW_TOP 26 }; 24 27 25 28 //! Camera … … 59 62 60 63 //! A CameraTarget is where the Camera is looking at. 61 class CameraTarget : public PNode 64 class CameraTarget : public PNode 62 65 { 63 66 friend class Camera; //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it. 64 67 65 68 private: 66 69 CameraTarget(void); 67 70 68 71 public: 69 72 virtual ~CameraTarget(void); -
orxonox/trunk/src/world_entities/player.cc
r4414 r4592 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 48 48 the player.cc for debug also 49 49 */ 50 this->setClass Name("Player");50 this->setClassID(CL_PLAYER, "Player"); 51 51 this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 52 52 travelSpeed = 15.0; … … 60 60 Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 61 61 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 62 62 63 63 this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0); 64 64 this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1); … … 84 84 \brief creates a new Player from Xml Data 85 85 \param root the xml element containing player data 86 86 87 87 \todo add more parameters to load 88 88 */ 89 89 Player::Player(const TiXmlElement* root) : WorldEntity(root), PhysicsInterface(this) 90 90 { 91 this->setClass Name("Player");91 this->setClassID(CL_PLAYER, "Player"); 92 92 this->weapons = new tList<Weapon>(); 93 93 this->activeWeapon = NULL; … … 107 107 Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 108 108 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 109 109 110 110 this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0); 111 111 this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1); … … 162 162 163 163 164 /** 164 /** 165 165 \brief Collision with another Entity has this effect 166 166 \param other the other colider … … 177 177 */ 178 178 void Player::draw () 179 { 179 { 180 180 glMatrixMode(GL_MODELVIEW); 181 181 glPushMatrix(); 182 182 float matrix[4][4]; 183 183 184 184 /* translate */ 185 glTranslatef (this->getAbsCoor ().x, 186 this->getAbsCoor ().y, 187 185 glTranslatef (this->getAbsCoor ().x, 186 this->getAbsCoor ().y, 187 this->getAbsCoor ().z); 188 188 /* rotate */ 189 189 this->getAbsDir ().matrix (matrix); 190 190 glMultMatrixf((float*)matrix); 191 191 192 192 this->model->draw(); 193 193 glPopMatrix(); … … 205 205 //printf("%p\n", this); 206 206 //this->getRelCoor().debug(); 207 207 208 208 /* link tick to weapon */ 209 209 //this->activeWeapon->tick(time); … … 236 236 accel = accel -(direction*acceleration); 237 237 if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2) 238 accel = accel - (orthDirection*acceleration); 238 accel = accel - (orthDirection*acceleration); 239 239 if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2) 240 240 accel = accel + (orthDirection*acceleration); -
orxonox/trunk/src/world_entities/test_gun.cc
r4504 r4592 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 13 13 ### File Specific 14 14 main-programmer: Patrick Boenzli 15 co-programmer: 15 co-programmer: 16 16 17 17 … … 43 43 creates a new weapon 44 44 */ 45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 46 : Weapon (parent, coordinate, direction) 45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 46 : Weapon (parent, coordinate, direction) 47 47 { 48 48 this->setClassID(CL_TEST_GUN, "TestGun"); … … 65 65 this->projectileOffset = Vector(1.0, 0.0, -0.35); 66 66 67 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 67 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 68 68 this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 69 69 this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 70 70 71 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 71 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 72 72 this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 73 73 74 74 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 75 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 75 this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 76 76 } 77 77 else if( this->leftRight == W_RIGHT) … … 80 80 81 81 this->objectComponent1->setRelCoor(Vector(0,0,0.35)); 82 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 82 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 83 83 this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 84 84 this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT); 85 85 86 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 86 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 87 87 this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 88 88 89 89 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 90 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 90 this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT); 91 91 } 92 92 93 93 this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV); 94 94 this->weaponSource = new SoundSource(this->fireSound, this); … … 103 103 \brief standard deconstructor 104 104 */ 105 TestGun::~TestGun () 105 TestGun::~TestGun () 106 106 { 107 107 // model will be deleted from WorldEntity-destructor … … 112 112 \brief this activates the weapon 113 113 114 This is needed, since there can be more than one weapon on a ship. the 115 activation can be connected with an animation. for example the weapon is 116 been armed out. 114 This is needed, since there can be more than one weapon on a ship. the 115 activation can be connected with an animation. for example the weapon is 116 been armed out. 117 117 */ 118 118 void TestGun::activate() … … 125 125 \brief this deactivates the weapon 126 126 127 This is needed, since there can be more than one weapon on a ship. the 128 activation can be connected with an animation. for example the weapon is 127 This is needed, since there can be more than one weapon on a ship. the 128 activation can be connected with an animation. for example the weapon is 129 129 been armed out. 130 130 */ … … 137 137 /** 138 138 \brief fires the weapon 139 139 140 140 this is called from the player.cc, when fire-button is been pushed 141 141 \todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent … … 149 149 } 150 150 151 Projectile* pj = dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET ));151 Projectile* pj = dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET & CL_MASK_LOWLEVEL_CLASS)); 152 152 weaponSource->play(); 153 153 … … 157 157 this->worldEntities->add(pj); 158 158 this->localTime = 0; 159 159 160 160 this->animation1->replay(); 161 161 } … … 170 170 can destroy the weapons of enemies or vice versa. 171 171 */ 172 void TestGun::hit (WorldEntity* entity, Vector* position) 172 void TestGun::hit (WorldEntity* entity, Vector* position) 173 173 {} 174 174 … … 180 180 hit, it can also be destoryed. 181 181 */ 182 void TestGun::destroy () 182 void TestGun::destroy () 183 183 {} 184 184 … … 187 187 \brief tick signal for time dependent/driven stuff 188 188 */ 189 void TestGun::tick (float time) 189 void TestGun::tick (float time) 190 190 { 191 191 this->localTime += time; … … 203 203 \brief this will draw the weapon 204 204 */ 205 void TestGun::draw () 205 void TestGun::draw () 206 206 { 207 207 /* draw gun body */ … … 209 209 glPushMatrix(); 210 210 float matrix[4][4]; 211 glTranslatef (this->getAbsCoor ().x, 212 this->getAbsCoor ().y, 213 this->getAbsCoor ().z); 211 glTranslatef (this->getAbsCoor ().x, 212 this->getAbsCoor ().y, 213 this->getAbsCoor ().z); 214 214 this->getAbsDir ().matrix (matrix); 215 215 glMultMatrixf((float*)matrix); … … 222 222 glMatrixMode(GL_MODELVIEW); 223 223 glPushMatrix(); 224 glTranslatef (this->objectComponent1->getAbsCoor ().x, 225 this->objectComponent1->getAbsCoor ().y, 226 224 glTranslatef (this->objectComponent1->getAbsCoor ().x, 225 this->objectComponent1->getAbsCoor ().y, 226 this->objectComponent1->getAbsCoor ().z); 227 227 this->objectComponent1->getAbsDir ().matrix (matrix); 228 228 glMultMatrixf((float*)matrix);
Note: See TracChangeset
for help on using the changeset viewer.