Changeset 10704 in orxonox.OLD for branches/presentation/src/world_entities/creatures
- Timestamp:
- Jun 15, 2007, 11:12:29 AM (18 years ago)
- Location:
- branches/presentation/src/world_entities/creatures
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/creatures/fps_player.cc
r10698 r10704 63 63 { 64 64 this->setPlayer(NULL); 65 66 if( this->aimingSystem)67 delete this->aimingSystem;68 65 } 69 66 … … 126 123 registerEvent(KeyMapper::PEV_JUMP); 127 124 registerEvent(KeyMapper::PEV_CROUCH); 125 registerEvent(KeyMapper::PEV_FIRE1); 128 126 registerEvent(EV_MOUSE_MOTION); 129 130 this->aimingSystem = NULL;131 127 132 128 // weapon manager for the fps 133 129 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 134 130 135 if( State::isOnline()) 136 { 137 Weapon* wpRight = new FPSSniperRifle(0); 138 wpRight->setName("testGun Right"); 139 this->addWeapon(wpRight,1, 0); 140 wpRight->addChild(this->aimingSystem); 141 142 this->toList( OM_PLAYERS ); 143 } 144 145 this->aimingSystem = new AimingSystem(this); 146 147 131 132 133 //this->aimingSystem = new AimingSystem(this); 134 135 #if 0 148 136 this->getWeaponManager().changeWeaponConfig(1); 149 137 this->getWeaponManager().setSlotCount(2); … … 160 148 this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ALL); 161 149 this->getWeaponManager().getFixedTarget()->setRelCoor(10,0,0); 150 151 if( true /*State::isOnline()*/ ) 152 { 153 FPSSniperRifle* wpRight = new FPSSniperRifle(0); 154 wpRight->setName("testGun Right"); 155 this->addWeapon(wpRight,1, 0); 156 wpRight->toList( this->getOMListNumber() ); 157 wpRight->setParent( &this->cameraNode ); 158 wpRight->requestAction( WA_ACTIVATE ); 159 //wpRight->addChild(this->aimingSystem); 160 161 //this->toList( OM_PLAYERS ); 162 } 163 #endif 164 165 FPSSniperRifle* wpRight = new FPSSniperRifle(0); 166 wpRight->setName("testGun Right"); 167 wpRight->toList( this->getOMListNumber() ); 168 wpRight->setParent( &this->cameraNode ); 169 170 this->weaponMan.setParentEntity( this ); 171 this->weaponMan.setSlotCount(1); 172 this->weaponMan.createWeaponSlot(0, this->cameraNode.getRelCoor().x, this->cameraNode.getRelCoor().y, this->cameraNode.getRelCoor().z, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 173 this->weaponMan.addWeapon(wpRight, 0, 0); 174 this->weaponMan.changeWeaponConfig(0); 175 Playable::weaponConfigChanged(); 176 this->weaponMan.getFixedTarget()->setParent(&this->cameraNode ); 177 this->weaponMan.getFixedTarget()->setRelCoor( 100000,0,0 ); 162 178 163 179 … … 269 285 State::getCamera()->setViewMode(Camera::ViewFPS); 270 286 271 272 if( this->aimingSystem != NULL)273 {274 this->aimingSystem->toList(OM_GROUP_01);275 this->aimingSystem->setParent(&this->cameraNode);276 // this->aimingSystem->setParentMode(PNODE_ROTATE_AND_MOVE);277 this->aimingSystem->setRelDir(Quaternion(M_PI_4*-0.58f, Vector(0,0,1)));278 this->aimingSystem->setRelCoor(0, -1, -1);279 }280 287 281 288 } … … 353 360 if( this->bFire) 354 361 { 362 PRINTF(0)("FPSPLAYER FIRE %d\n", this->getOMListNumber() ); 355 363 this->getWeaponManager().fire(); 356 }357 358 359 //dealing damage360 if ( State::isOnline() && (SharedNetworkData::getInstance()->isMasterServer() /*|| SharedNetworkData::getInstance()->isProxyServerActive()*/))361 {362 this->damageTicker -= time;363 364 if ( this->damageTicker <= 0.0f && this->beFire() )365 {366 this->damageTicker = 0.25;367 368 WorldEntity * victim = aimingSystem->getNearestTarget();369 370 if ( victim )371 {372 PRINTF(0)("FIRE: hit %s\n", victim->getClassCName());373 victim->hit( 20, this );374 }375 else376 {377 PRINTF(0)("FIRE: nothing hit\n");378 }379 }380 364 } 381 365 … … 533 517 534 518 this->setOnGround(false); 535 if( this->aimingSystem != NULL)536 this->aimingSystem->flushList();537 519 538 520 } -
branches/presentation/src/world_entities/creatures/fps_player.h
r10698 r10704 11 11 12 12 13 class AimingSystem;13 class FPSSniperRifle; 14 14 15 15 … … 72 72 bool changingZoom; 73 73 74 AimingSystem* aimingSystem; //!< aiming system of the player75 76 74 float damageTicker; //!< ticker for dealing damage 75 76 FPSSniperRifle* weapon; 77 77 78 78 };
Note: See TracChangeset
for help on using the changeset viewer.