Changeset 10654 in orxonox.OLD for branches/hud/src/world_entities
- Timestamp:
- May 12, 2007, 12:13:13 AM (18 years ago)
- Location:
- branches/hud/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/hud/src/world_entities/creatures/fps_player.cc
r10647 r10654 96 96 this->bPosBut = false; 97 97 this->bFire = false; 98 this->bFire2 = false; 99 this->changeZoom = true; 100 this->inZoomMode = false; 101 this->changingZoom = false; 98 102 99 103 this->xMouse = 0.0f; … … 117 121 registerEvent(KeyMapper::PEV_RIGHT); 118 122 registerEvent(KeyMapper::PEV_FIRE1); 123 registerEvent(KeyMapper::PEV_FIRE2); 119 124 registerEvent(KeyMapper::PEV_JUMP); 120 125 registerEvent(KeyMapper::PEV_CROUCH); … … 204 209 this->xMouse = 0.0f; 205 210 this->yMouse = 0.0f; 211 this->inZoomMode = false; 206 212 207 213 this->setHealth(80); … … 249 255 void FPSPlayer::tick (float time) 250 256 { 251 257 // Second init-step 252 258 if ( !this->initWeapon ) 253 259 { … … 271 277 } 272 278 273 274 AABB* box = this->getModelAABB(); 275 if( box != NULL) 276 { 279 } 280 // end of second init-step 281 282 // This box represents the dimension of the used model 283 AABB* box = this->getModelAABB(); 284 285 if( box != NULL) 286 { 277 287 float f = 1.0; 288 if( this->bCrouch ) 289 f = 0.3*f; 290 278 291 this->cameraNode.setRelCoor(0, box->halfLength[1] * f, 0); 279 // this->cameraNode.setRelCoor(10, box->halfLength[1] * f, 0); 280 281 float v = 0.1f; 282 this->getWeaponManager().setSlotPosition(0, Vector(-8.0, box->halfLength[1] * v, 1.1)); 283 this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * v, 0.0)); 284 } 285 } 286 292 // this->cameraNode.setRelCoor(10, box->halfLength[1] * f, 0); 293 float v = 0.1f; 294 this->getWeaponManager().setSlotPosition(0, Vector(-8.0, box->halfLength[1] * v, 1.1)); 295 this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * v, 0.0)); 296 } 297 298 /* 299 if( this->bFire2 ) 300 { 301 302 // to change Zoom on click 303 if( this->changeZoom ) 304 { 305 this->changeZoom = false; 306 if( this->inZoomMode ) 307 { 308 State::getCamera()->setViewMode(Camera::ViewFPS); 309 this->inZoomMode = false; 310 } 311 else 312 { 313 State::getCamera()->setViewMode(Camera::ViewFPSZoom); 314 this->inZoomMode = true; 315 } 316 317 } 318 319 } 320 else 321 { 322 this->changeZoom = true; 323 }*/ 324 if( this->bFire2 ) 325 { 326 if( this->changeZoom ) 327 { 328 if( !this->inZoomMode || this->changingZoom ) 329 { 330 this->inZoomMode = true; 331 this->changingZoom = true; 332 float fovy = State::getCamera()->getFovy(); 333 if( fovy > 30 ) 334 State::getCamera()->setFovy( fovy - 10*time ); 335 } 336 else 337 { 338 State::getCamera()->setViewMode(Camera::ViewFPS); 339 this->inZoomMode = false; 340 this->changeZoom = false; 341 } 342 } 343 } 344 else 345 { 346 this->changeZoom = true; 347 this->changingZoom = false; 348 } 287 349 288 350 this->getWeaponManager().tick(time); … … 322 384 xMouse *= time ; 323 385 yMouse *= time ; 324 325 heading -= xMouse/5.; 326 attitude-= yMouse/5.; 386 387 float amount; 388 389 if( this->inZoomMode ) 390 amount = 2.; 391 else 392 amount = 5.; 393 394 heading -= xMouse/amount; 395 attitude-= yMouse/amount; 327 396 328 397 … … 367 436 }*/ 368 437 369 370 velocity *= 100; 438 int speed; 439 if( this->bCrouch ) 440 speed = 50; 441 else 442 speed = 100; 443 velocity *= speed; 371 444 372 445 if( this->getModel( 0) != NULL && this->getModel(0)->isA(InteractiveModel::staticClassID())) … … 461 534 if( this->aimingSystem != NULL) 462 535 this->aimingSystem->flushList(); 536 463 537 } 464 538 … … 496 570 else if( event.type == KeyMapper::PEV_FIRE1) 497 571 this->bFire = event.bPressed; 572 else if( event.type == KeyMapper::PEV_FIRE2) 573 this->bFire2 = event.bPressed; 498 574 else if( event.type == KeyMapper::PEV_CROUCH) 499 575 this->bCrouch = event.bPressed; -
branches/hud/src/world_entities/creatures/fps_player.h
r10647 r10654 50 50 bool bPosBut; //!< position button 51 51 bool bFire; //!< fire button 52 bool bFire2; //!< alternate fire button 52 53 bool bCrouch; //!< crouch button 53 54 … … 65 66 66 67 bool initWeapon; 68 bool changeZoom; //!< zoom sight of player 69 bool inZoomMode; //!< zoomsight 70 bool changingZoom; 67 71 68 72 AimingSystem* aimingSystem; //!< aiming system of the player -
branches/hud/src/world_entities/tools/camera.cc
r10647 r10654 211 211 this->setRelCoorSoft(this->viewFrontDistance, 0, 0, 5); 212 212 this->target->setRelCoorSoft(Vector(10,0,0), 5); 213 break; 214 } 215 case Camera::ViewFPSZoom: 216 { 217 this->fovy = viewNormalFovy; 218 this->toFovy = 30; 219 this->setRelCoorSoft(2, 0, 0, 5); 220 this->target->setRelCoorSoft(Vector(10,0,0), 5); 213 221 } 214 222 } -
branches/hud/src/world_entities/tools/camera.h
r10647 r10654 35 35 ViewRight, 36 36 ViewTop, 37 ViewFPS 37 ViewFPS, 38 ViewFPSZoom 38 39 }; 39 40 public:
Note: See TracChangeset
for help on using the changeset viewer.