Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4000 in orxonox.OLD


Ignore:
Timestamp:
Apr 27, 2005, 6:56:01 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: weapon animation not realy nice but working now.. :)

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3993 r4000  
    105105    {
    106106      tmpKeyFrame = this->keyFrameList->firstElement();
    107       this->setAnimFuncMov(animFuncMov);
    108       this->setAnimFuncRot(animFuncRot);
     107      //this->setAnimFuncMov(animFuncMov);
     108      //this->setAnimFuncRot(animFuncRot);
    109109    }
    110110  else
  • orxonox/trunk/src/world_entities/player.cc

    r3980 r4000  
    5555  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
    5656 
    57   this->weaponMan->addWeapon(wpRight, W_CONFIG0);
    58   this->weaponMan->addWeapon(wpLeft, W_CONFIG1);
     57  this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0);
     58  this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1);
    5959  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
    6060  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3993 r4000  
    6161      this->projectileOffset = Vector(1.0, 0.0, -0.35);
    6262
    63       //this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
    64       //this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);
    65       //this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
    66 
    6763      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    6864      this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     
    7975      this->projectileOffset = Vector(1.0, 0.0, 0.5);
    8076
    81       //this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
    82       //this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);
    83       //this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
    84      
    8577      this->objectComponent1->setRelCoor(Vector(0,0,0.35));
    8678      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     
    8880      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
    8981
    90 
    9182      this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    9283      this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     
    9485      this->animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    9586      this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    96       //this->animation2->addKeyFrame(Vector(0, 0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
    97       //this->animation2->addKeyFrame(Vector(0, 0, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
    98       //this->animation2->addKeyFrame(Vector(0, 0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
    9987    }
    10088
     
    120108void TestGun::activate()
    121109{
    122   if( this->leftRight == W_RIGHT) printf("ACTIVATE right weapon\n");
    123   else printf("ACTIVATE left weapon\n");
    124  
    125110  this->animation2->replay();
    126111}
     
    136121void TestGun::deactivate()
    137122{
    138   printf("DEACTIVATE\n");
    139123  this->animation3->replay();
    140124}
     
    209193void TestGun::draw ()
    210194{
    211   //this->getRelCoor().debug();
    212   //this->getAbsCoor().debug();
    213   //this->objectComponent1->getRelCoor().debug();
    214   //this->objectComponent1->getAbsCoor().debug();
    215 
    216195  /* draw gun body */
    217196  glMatrixMode(GL_MODELVIEW);
  • orxonox/trunk/src/world_entities/weapon.cc

    r3993 r4000  
    112112  PRINTF(4)("Changing weapon configuration: from %i to next\n", this->currConfID);
    113113
    114   Weapon* w;
    115   for(int i = 0; i < W_MAX_SLOTS; ++i)
    116     {
    117       w = this->configs[this->currConfID].slots[i];
    118       if( w != NULL) w->deactivate();
    119     }
    120   int i;
     114  int i, lastConfID;
     115  lastConfID = this->currConfID;
    121116  for(i = this->currConfID + 1; i < W_MAX_CONFIGS && !this->configs[i].bUsed; ++i);
    122117  if( i == W_MAX_CONFIGS) this->currConfID = W_CONFIG0;
    123118  else this->currConfID = i; 
    124   PRINTF(4)("\tto %i\n", this->currConfID);
    125 
    126   for(int i = 0; i < W_MAX_SLOTS; ++i)
    127     {
    128       w = this->configs[this->currConfID].slots[i];
    129       if( w != NULL) w->activate();
     119
     120 
     121  Weapon *w1, *w2;
     122  for(int j = 0; j < W_MAX_SLOTS; ++j)
     123    {
     124      w1 = this->configs[lastConfID].slots[j];
     125      w2 = this->configs[this->currConfID].slots[j];
     126     
     127      if( w1 == w2)
     128        {
     129          printf("no need for change\n");
     130        }
     131      else
     132        {
     133        if( w1 != NULL )
     134          {
     135            w1->deactivate();
     136            printf("deactivating %i,%i\n", j,lastConfID);
     137          }
     138        if( w2 != NULL)
     139          {
     140            w2->activate();
     141            printf("activating %i,%i\n", j, this->currConfID);
     142          }
     143        }
    130144    }
    131145}
Note: See TracChangeset for help on using the changeset viewer.