Changeset 3755 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 8, 2005, 12:46:33 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/simple_animation.cc
r3752 r3755 128 128 anim->frames = new tList<KeyFrame>(); 129 129 anim->animMode = LOOP; 130 bRunning = false;130 anim->bRunning = false; 131 131 deltaT = 0.0; 132 132 this->animators->add(anim); … … 189 189 void SimpleAnimation::addKeyFrame(KeyFrame* frame) 190 190 { 191 printf("SimpleAnimation::addKeyFrame() - adding frame\n");192 191 if( !this->bDescriptive || this->workingAnimator == NULL) 193 192 { … … 197 196 frame->object = this->workingAnimator->object; 198 197 this->workingAnimator->frames->add(frame); 199 printf("SimpleAnimation::addKeyFrame() - addition completed\n");200 198 } 201 199 … … 322 320 while( anim->localTime > anim->currentFrame->time) 323 321 { 324 printf("SimpleAnimation::tick(...) - changing Frame\n");322 PRINTF(4)("SimpleAnimation::tick(...) - changing Frame\n"); 325 323 326 324 anim->localTime -= anim->currentFrame->time; -
orxonox/trunk/src/world_entities/player.cc
r3752 r3755 53 53 acceleration = 10.0; 54 54 //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; 58 60 } 59 61 … … 150 152 151 153 this->activeWeapon->draw(); 154 this->activeWeaponL->draw(); 152 155 } 153 156 … … 161 164 /* link tick to weapon */ 162 165 this->activeWeapon->tick(time); 166 this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE 163 167 // player controlled movement 164 168 this->move(time); … … 206 210 if( this->bFire) 207 211 { 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(); 210 216 } 211 217 if( this->bWeaponChange && this->weapons->getSize() > 1) -
orxonox/trunk/src/world_entities/player.h
r3655 r3755 48 48 tList<Weapon>* weapons;//!< a list of weapon 49 49 Weapon* activeWeapon; //!< the weapon that is currenty activated 50 Weapon* activeWeaponL; //temporary -- FIX THIS 51 50 52 World* myWorld; //!< reference to the world object 51 53 -
orxonox/trunk/src/world_entities/projectile.cc
r3708 r3755 33 33 Projectile::Projectile (Weapon* weapon) : WorldEntity() 34 34 { 35 this->model = (Model*)ResourceManager::getInstance()->load("sphere", PRIM, RP_LEVEL);36 35 this->weapon = weapon; 37 36 this->flightDirection = NULL; -
orxonox/trunk/src/world_entities/test_bullet.cc
r3710 r3755 32 32 */ 33 33 TestBullet::TestBullet (Weapon* weapon) : Projectile(weapon) 34 {} 34 { 35 this->model = (Model*)ResourceManager::getInstance()->load("models/test_projectile.obj", OBJ, RP_LEVEL); 36 } 35 37 36 38 … … 94 96 this->getAbsDir().matrix (matrix); 95 97 glMultMatrixf((float*)matrix); 98 glScalef(2.0, 2.0, 2.0); 96 99 this->model->draw(); 97 100 -
orxonox/trunk/src/world_entities/test_gun.cc
r3752 r3755 40 40 creates a new weapon 41 41 */ 42 TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction )42 TestGun::TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight) 43 43 : Weapon (parent, coordinate, direction) 44 44 { 45 45 this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN); 46 46 this->idleTime = 0.2f; 47 this->leftRight = leftRight; 47 48 48 49 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 52 53 53 54 this->animator->animatorBegin(); 54 this->animator->selectObject(this->dummy );55 this->animator->selectObject(this->dummy1); 55 56 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 } 59 69 this->animator->animatorEnd(); 60 70 … … 117 127 118 128 this->animator->animatorBegin(); 119 this->animator->selectObject(this->dummy );129 this->animator->selectObject(this->dummy1); 120 130 this->animator->start(); 121 131 this->animator->animatorEnd(); … … 167 177 { 168 178 179 /* draw gun body 1 */ 169 180 glMatrixMode(GL_MODELVIEW); 170 181 glPushMatrix(); 171 182 float matrix[4][4]; 172 183 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 181 206 glPopMatrix(); 182 183 207 208 209 /* draw gun coil 1 */ 184 210 glMatrixMode(GL_MODELVIEW); 185 211 glPushMatrix(); 186 212 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); 192 218 glMultMatrixf((float*)matrix); 193 219 this->model->draw(0); 194 220 glPopMatrix(); 195 196 } 197 221 } 222 -
orxonox/trunk/src/world_entities/test_gun.h
r3752 r3755 37 37 38 38 public: 39 TestGun (PNode* parent, Vector* coordinate, Quaternion* direction );39 TestGun (PNode* parent, Vector* coordinate, Quaternion* direction, int leftRight); 40 40 virtual ~TestGun (); 41 41 … … 53 53 private: 54 54 SimpleAnimation* animator; 55 WorldEntity* dummy; 55 WorldEntity* dummy1; 56 int leftRight; // this will become an enum 56 57 57 58 }; -
orxonox/trunk/src/world_entities/world_entity.cc
r3672 r3755 41 41 this->setClassName ("WorldEntity"); 42 42 this->bDraw = true; 43 this->model = NULL;43 //this->model = NULL; 44 44 // collisioncluster = NULL; 45 45 }
Note: See TracChangeset
for help on using the changeset viewer.