Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3755 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Apr 8, 2005, 12:46:33 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: now got two weapons firing syncronized

Location:
orxonox/trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/simple_animation.cc

    r3752 r3755  
    128128      anim->frames = new tList<KeyFrame>();
    129129      anim->animMode = LOOP;
    130       bRunning = false;
     130      anim->bRunning = false;
    131131      deltaT = 0.0;
    132132      this->animators->add(anim);
     
    189189void SimpleAnimation::addKeyFrame(KeyFrame* frame)
    190190{
    191   printf("SimpleAnimation::addKeyFrame() - adding frame\n");
    192191  if( !this->bDescriptive || this->workingAnimator == NULL)
    193192    {
     
    197196  frame->object = this->workingAnimator->object;
    198197  this->workingAnimator->frames->add(frame);
    199   printf("SimpleAnimation::addKeyFrame() - addition completed\n");
    200198}
    201199
     
    322320          while( anim->localTime > anim->currentFrame->time)
    323321            {
    324               printf("SimpleAnimation::tick(...) - changing Frame\n");
     322              PRINTF(4)("SimpleAnimation::tick(...) - changing Frame\n");
    325323             
    326324              anim->localTime -= anim->currentFrame->time;
  • orxonox/trunk/src/world_entities/player.cc

    r3752 r3755  
    5353  acceleration = 10.0;
    5454  //weapons:
    55   Weapon* wp = new TestGun(this, new Vector(-2.6, 0.1, 3.0), new Quaternion());
    56   this->weapons->add(wp);
    57   this->activeWeapon = wp; 
     55  Weapon* wpRight = new TestGun(this, new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0);
     56  Weapon* wpLeft = new TestGun(this, new Vector(-2.6, 0.1, -3.0), new Quaternion(), 1);
     57  this->weapons->add(wpRight);
     58  this->activeWeapon = wpRight;
     59  this->activeWeaponL = wpLeft;
    5860}
    5961
     
    150152
    151153  this->activeWeapon->draw();
     154  this->activeWeaponL->draw();
    152155}
    153156
     
    161164  /* link tick to weapon */
    162165  this->activeWeapon->tick(time);
     166  this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE
    163167  // player controlled movement
    164168  this->move(time);
     
    206210  if( this->bFire)
    207211    {
    208       if(this->activeWeapon != NULL)
    209         this->activeWeapon->fire();
     212      //if(this->activeWeapon != NULL)
     213      this->activeWeapon->fire();
     214      //FIX THIS FIX FIIIIIIIIIIIX
     215      this->activeWeaponL->fire();
    210216    }
    211217  if( this->bWeaponChange && this->weapons->getSize() > 1)
  • orxonox/trunk/src/world_entities/player.h

    r3655 r3755  
    4848  tList<Weapon>* weapons;//!< a list of weapon
    4949  Weapon* activeWeapon;  //!< the weapon that is currenty activated
     50  Weapon* activeWeaponL;  //temporary -- FIX THIS
     51
    5052  World* myWorld;        //!< reference to the world object
    5153
  • orxonox/trunk/src/world_entities/projectile.cc

    r3708 r3755  
    3333Projectile::Projectile (Weapon* weapon) : WorldEntity()
    3434{
    35   this->model = (Model*)ResourceManager::getInstance()->load("sphere", PRIM, RP_LEVEL);
    3635  this->weapon = weapon;
    3736  this->flightDirection = NULL;
  • orxonox/trunk/src/world_entities/test_bullet.cc

    r3710 r3755  
    3232*/
    3333TestBullet::TestBullet (Weapon* weapon) : Projectile(weapon)
    34 {}
     34{
     35  this->model = (Model*)ResourceManager::getInstance()->load("models/test_projectile.obj", OBJ, RP_LEVEL);
     36}
    3537
    3638
     
    9496  this->getAbsDir().matrix (matrix);
    9597  glMultMatrixf((float*)matrix); 
     98  glScalef(2.0, 2.0, 2.0);
    9699  this->model->draw();
    97100
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3752 r3755  
    4040   creates a new weapon
    4141*/
    42 TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction)
     42TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight)
    4343  :  Weapon (parent, coordinate, direction)
    4444{
    4545  this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN);
    4646  this->idleTime = 0.2f;
     47  this->leftRight = leftRight;
    4748
    4849  this->animator = SimpleAnimation::getInstance();
    49   this->dummy = new WorldEntity(); /* a world entity that is not drawed: use this for the weapon */
    50   parent->addChild(this->dummy, PNODE_ALL);
    51   //this->dummy->setRelCoor(new Vector(-2.6, 0.1, 3.0));
     50  this->dummy1 = new WorldEntity(); /* a world entity that is not drawed: use this for the weapon */
     51  parent->addChild(this->dummy1, PNODE_ALL);
     52
    5253 
    5354  this->animator->animatorBegin();
    54   this->animator->selectObject(this->dummy);
     55  this->animator->selectObject(this->dummy1);
    5556  this->animator->setAnimationMode(SINGLE);
    56   this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.0, NEG_EXP);
    57   this->animator->addKeyFrame(new Vector(-3.0, 0.1, 3.0), new Quaternion(), 0.1, NEG_EXP);
    58   this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.5, NEG_EXP);
     57  if( this->leftRight == 0)
     58    {
     59      this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.0, NEG_EXP);
     60      this->animator->addKeyFrame(new Vector(-3.0, 0.1, 3.0), new Quaternion(), 0.1, NEG_EXP);
     61      this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.5, NEG_EXP);
     62    }
     63  else if( this->leftRight == 1)
     64    {
     65      this->animator->addKeyFrame(new Vector(-2.6, 0.1, -2.5), new Quaternion(), 0.0, NEG_EXP);
     66      this->animator->addKeyFrame(new Vector(-3.0, 0.1, -2.5), new Quaternion(), 0.1, NEG_EXP);
     67      this->animator->addKeyFrame(new Vector(-2.6, 0.1, -2.5), new Quaternion(), 0.5, NEG_EXP);
     68    }
    5969  this->animator->animatorEnd();
    6070 
     
    117127 
    118128  this->animator->animatorBegin();
    119   this->animator->selectObject(this->dummy);
     129  this->animator->selectObject(this->dummy1);
    120130  this->animator->start();
    121131  this->animator->animatorEnd();
     
    167177{
    168178 
     179  /* draw gun body 1 */
    169180  glMatrixMode(GL_MODELVIEW);
    170181  glPushMatrix();
    171182  float matrix[4][4];
    172183 
    173  
    174   glTranslatef (this->getAbsCoor ().x,
    175                 this->getAbsCoor ().y,
    176                 this->getAbsCoor ().z);
    177  
    178   this->getAbsDir ().matrix (matrix);
    179   glMultMatrixf((float*)matrix);
    180   this->model->draw(1);
     184  if( this->leftRight == 0)
     185    {
     186      glTranslatef (this->getAbsCoor ().x,
     187                    this->getAbsCoor ().y,
     188                    this->getAbsCoor ().z);
     189     
     190      this->getAbsDir ().matrix (matrix);
     191      glMultMatrixf((float*)matrix);
     192      this->model->draw(1);
     193    }
     194  else if( this->leftRight == 1)
     195    {
     196      glTranslatef (this->getAbsCoor ().x,
     197                    this->getAbsCoor ().y,
     198                    this->getAbsCoor ().z);
     199     
     200      this->getAbsDir ().matrix (matrix);
     201      glMultMatrixf((float*)matrix);
     202      glScalef(1.0, 1.0, -1.0);
     203      this->model->draw(1);
     204    }
     205
    181206  glPopMatrix();
    182  
    183 
     207
     208
     209  /* draw gun coil 1 */
    184210  glMatrixMode(GL_MODELVIEW);
    185211  glPushMatrix();
    186212 
    187   glTranslatef (this->dummy->getAbsCoor ().x,
    188                 this->dummy->getAbsCoor ().y,
    189                 this->dummy->getAbsCoor ().z);
    190 
    191   this->dummy->getAbsDir ().matrix (matrix);
     213  glTranslatef (this->dummy1->getAbsCoor ().x,
     214                this->dummy1->getAbsCoor ().y,
     215                this->dummy1->getAbsCoor ().z);
     216
     217  this->dummy1->getAbsDir ().matrix (matrix);
    192218  glMultMatrixf((float*)matrix);
    193219  this->model->draw(0);
    194220  glPopMatrix();
    195 
    196 }
    197 
     221}
     222
  • orxonox/trunk/src/world_entities/test_gun.h

    r3752 r3755  
    3737
    3838 public:
    39   TestGun (PNode* parent, Vector* coordinate, Quaternion* direction);
     39  TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight);
    4040  virtual ~TestGun ();
    4141
     
    5353 private:
    5454  SimpleAnimation* animator;
    55   WorldEntity* dummy;
     55  WorldEntity* dummy1;
     56  int leftRight;   // this will become an enum
    5657
    5758};
  • orxonox/trunk/src/world_entities/world_entity.cc

    r3672 r3755  
    4141  this->setClassName ("WorldEntity");
    4242  this->bDraw = true;
    43   this->model = NULL;
     43  //this->model = NULL;
    4444  //  collisioncluster = NULL;
    4545}
Note: See TracChangeset for help on using the changeset viewer.