Changeset 3953 in orxonox.OLD for orxonox/branches/physics/src/world_entities/player.cc
- Timestamp:
- Apr 25, 2005, 9:29:41 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/world_entities/player.cc
r3811 r3953 38 38 Player::Player() : WorldEntity() 39 39 { 40 this->weapons = new tList<Weapon>();41 this->activeWeapon = NULL;42 40 /* 43 41 this is the debug player - actualy we would have to make a new … … 46 44 */ 47 45 this->model = (Model*)ResourceManager::getInstance()->load("models/reaplow.obj", OBJ, RP_CAMPAIGN); 48 //this->model = (Model*)ResourceManager::getInstance()->load("models/weapon_packet.obj", OBJ, RP_CAMPAIGN);49 46 travelSpeed = 15.0; 50 47 velocity = new Vector(); 51 48 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 52 49 bFire = false; 50 this->bWeaponChange = false; 53 51 acceleration = 10.0; 54 52 //weapons: 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; 53 this->weaponMan = new WeaponManager(); 54 Weapon* wpRight = new TestGun(this,Vector(-2.6, 0.1, 3.0), Quaternion(), 0); 55 Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1); 56 57 this->weaponMan->addWeapon(wpRight, W_CONFIG0); 58 this->weaponMan->addWeapon(wpLeft, W_CONFIG1); 59 this->weaponMan->addWeapon(wpRight, W_CONFIG2); 60 this->weaponMan->addWeapon(wpLeft, W_CONFIG2); 61 60 62 } 61 63 … … 69 71 this only frees the memory allocated to save the list. 70 72 */ 71 delete this->weapon s;73 delete this->weaponMan; 72 74 } 73 75 … … 79 81 void Player::addWeapon(Weapon* weapon) 80 82 { 81 this->weapon s->add(weapon);83 this->weaponMan->addWeapon(weapon); 82 84 } 83 85 … … 89 91 void Player::removeWeapon(Weapon* weapon) 90 92 { 91 this->weapon s->remove(weapon);93 this->weaponMan->removeWeapon(weapon); 92 94 } 93 95 … … 151 153 glPopMatrix(); 152 154 153 this->activeWeapon->draw(); 154 this->activeWeaponL->draw(); 155 this->weaponMan->draw(); 155 156 } 156 157 … … 163 164 { 164 165 /* link tick to weapon */ 165 this->activeWeapon->tick(time); 166 this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE 166 //this->activeWeapon->tick(time); 167 //this->activeWeaponL->tick(time); //FIX FIX DELETE REMOVE 168 this->weaponMan->tick(time); 167 169 // player controlled movement 168 170 this->move(time); … … 180 182 Vector accel(0.0, 0.0, 0.0); 181 183 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 182 183 184 /* calculate the direction in which the craft is heading */ 184 185 Vector direction (1.0, 0.0, 0.0); … … 210 211 if( this->bFire) 211 212 { 212 //if(this->activeWeapon != NULL) 213 this->activeWeapon->fire(); 214 //FIX THIS FIX FIIIIIIIIIIIX 215 this->activeWeaponL->fire(); 213 this->weaponMan->fire(); 216 214 } 217 if( this->bWeaponChange && this->weapons->getSize() > 1)215 if( this->bWeaponChange) 218 216 { 219 PRINTF(1)("changing the weapon of the player: deactivate old, activate new\n"); 220 this->activeWeapon->deactivate(); 221 //this->weapons->enumerate(); FIX: strang weapon change... 222 this->activeWeapon = this->weapons->nextElement(this->activeWeapon); 223 this->activeWeapon->activate(); 217 this->weaponMan->nextWeaponConf(); 218 this->bWeaponChange = false; 224 219 } 225 220 } … … 240 235 if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp; 241 236 if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp; 242 if( !strcmp( cmd->cmd, "mode")) this->bWeaponChange = !cmd->bUp;243 } 237 if( !strcmp( cmd->cmd, "mode")) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange; 238 }
Note: See TracChangeset
for help on using the changeset viewer.