Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4592 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
Jun 10, 2005, 7:17:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: derivations work.
now the only thing to do is specify all the classes, and DO it CLEAN.

@patrick: is it ok, how i treated your ObjectManager??

Location:
orxonox/trunk/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/camera.h

    r4490 r4592  
    1 /*! 
     1/*!
    22    \file camera.h
    33    \brief Viewpoint controlling class definitions
    4 */ 
     4*/
    55
    66#ifndef _CAMERA_H
     
    1616
    1717//! 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 };
     18typedef enum ViewMode
     19{
     20  VIEW_NORMAL,
     21  VIEW_BEHIND,
     22  VIEW_FRONT,
     23  VIEW_LEFT,
     24  VIEW_RIGHT,
     25  VIEW_TOP
     26};
    2427
    2528//! Camera
     
    5962
    6063//! A CameraTarget is where the Camera is looking at.
    61 class CameraTarget : public PNode 
     64class CameraTarget : public PNode
    6265{
    6366  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
    64  
     67
    6568 private:
    6669  CameraTarget(void);
    67  
     70
    6871 public:
    6972  virtual ~CameraTarget(void);
  • orxonox/trunk/src/world_entities/player.cc

    r4414 r4592  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    4848     the player.cc for debug also
    4949  */
    50   this->setClassName("Player");
     50  this->setClassID(CL_PLAYER, "Player");
    5151  this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN);
    5252  travelSpeed = 15.0;
     
    6060  Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
    6161  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
    62  
     62
    6363  this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0);
    6464  this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1);
     
    8484   \brief creates a new Player from Xml Data
    8585   \param root the xml element containing player data
    86    
     86
    8787   \todo add more parameters to load
    8888*/
    8989Player::Player(const TiXmlElement* root) : WorldEntity(root), PhysicsInterface(this)
    9090{
    91   this->setClassName("Player");
     91  this->setClassID(CL_PLAYER, "Player");
    9292  this->weapons = new tList<Weapon>();
    9393  this->activeWeapon = NULL;
     
    107107  Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
    108108  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
    109  
     109
    110110  this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0);
    111111  this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1);
     
    162162
    163163
    164 /** 
     164/**
    165165    \brief Collision with another Entity has this effect
    166166    \param other the other colider
     
    177177*/
    178178void Player::draw ()
    179 { 
     179{
    180180  glMatrixMode(GL_MODELVIEW);
    181181  glPushMatrix();
    182182  float matrix[4][4];
    183  
     183
    184184  /* translate */
    185   glTranslatef (this->getAbsCoor ().x, 
    186                 this->getAbsCoor ().y,
    187                 this->getAbsCoor ().z);
     185  glTranslatef (this->getAbsCoor ().x,
     186                this->getAbsCoor ().y,
     187                this->getAbsCoor ().z);
    188188  /* rotate */
    189189  this->getAbsDir ().matrix (matrix);
    190190  glMultMatrixf((float*)matrix);
    191  
     191
    192192  this->model->draw();
    193193  glPopMatrix();
     
    205205  //printf("%p\n", this);
    206206  //this->getRelCoor().debug();
    207  
     207
    208208  /* link tick to weapon */
    209209  //this->activeWeapon->tick(time);
     
    236236    accel = accel -(direction*acceleration);
    237237  if( this->bLeft &&  TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
    238     accel = accel - (orthDirection*acceleration); 
     238    accel = accel - (orthDirection*acceleration);
    239239  if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
    240240    accel = accel + (orthDirection*acceleration);
  • orxonox/trunk/src/world_entities/test_gun.cc

    r4504 r4592  
    11
    22
    3 /* 
     3/*
    44   orxonox - the future of 3D-vertical-scrollers
    55
     
    1313   ### File Specific
    1414   main-programmer: Patrick Boenzli
    15    co-programmer: 
     15   co-programmer:
    1616
    1717
     
    4343   creates a new weapon
    4444*/
    45 TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight) 
    46   :  Weapon (parent, coordinate, direction) 
     45TestGun::TestGun (PNode* parent, const Vector& coordinate, const Quaternion& direction, int leftRight)
     46  :  Weapon (parent, coordinate, direction)
    4747{
    4848  this->setClassID(CL_TEST_GUN, "TestGun");
     
    6565      this->projectileOffset = Vector(1.0, 0.0, -0.35);
    6666
    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);
    6868      this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    6969      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    7070
    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);
    7272      this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    7373
    7474      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);
    7676    }
    7777  else if( this->leftRight == W_RIGHT)
     
    8080
    8181      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);
    8383      this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    8484      this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    8585
    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);
    8787      this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    8888
    8989      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);
    9191    }
    92  
     92
    9393  this->fireSound = (SoundBuffer*)ResourceManager::getInstance()->load("sound/shot1.wav", WAV);
    9494  this->weaponSource = new SoundSource(this->fireSound, this);
     
    103103   \brief standard deconstructor
    104104*/
    105 TestGun::~TestGun () 
     105TestGun::~TestGun ()
    106106{
    107107  // model will be deleted from WorldEntity-destructor
     
    112112   \brief this activates the weapon
    113113
    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.
    117117*/
    118118void TestGun::activate()
     
    125125   \brief this deactivates the weapon
    126126
    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
    129129   been armed out.
    130130*/
     
    137137/**
    138138   \brief fires the weapon
    139    
     139
    140140   this is called from the player.cc, when fire-button is been pushed
    141141   \todo: the ObjectManager deliveres Projectiles not TestBullets! this should be diffrent
     
    149149    }
    150150
    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));
    152152  weaponSource->play();
    153153
     
    157157  this->worldEntities->add(pj);
    158158  this->localTime = 0;
    159  
     159
    160160  this->animation1->replay();
    161161}
     
    170170   can destroy the weapons of enemies or vice versa.
    171171*/
    172 void TestGun::hit (WorldEntity* entity, Vector* position) 
     172void TestGun::hit (WorldEntity* entity, Vector* position)
    173173{}
    174174
     
    180180   hit, it can also be destoryed.
    181181*/
    182 void TestGun::destroy () 
     182void TestGun::destroy ()
    183183{}
    184184
     
    187187   \brief tick signal for time dependent/driven stuff
    188188*/
    189 void TestGun::tick (float time) 
     189void TestGun::tick (float time)
    190190{
    191191  this->localTime += time;
     
    203203   \brief this will draw the weapon
    204204*/
    205 void TestGun::draw () 
     205void TestGun::draw ()
    206206{
    207207  /* draw gun body */
     
    209209  glPushMatrix();
    210210  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);
    214214  this->getAbsDir ().matrix (matrix);
    215215  glMultMatrixf((float*)matrix);
     
    222222  glMatrixMode(GL_MODELVIEW);
    223223  glPushMatrix();
    224   glTranslatef (this->objectComponent1->getAbsCoor ().x, 
    225                 this->objectComponent1->getAbsCoor ().y,
    226                 this->objectComponent1->getAbsCoor ().z);
     224  glTranslatef (this->objectComponent1->getAbsCoor ().x,
     225                this->objectComponent1->getAbsCoor ().y,
     226                this->objectComponent1->getAbsCoor ().z);
    227227  this->objectComponent1->getAbsDir ().matrix (matrix);
    228228  glMultMatrixf((float*)matrix);
Note: See TracChangeset for help on using the changeset viewer.