Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CockpitKeys Namespace Reference

Functions

void QuitNow ()
 
void TextMessageCallback (unsigned int ch, unsigned int mod, bool release, int x, int y)
 
void TextMessageKey (const KBData &, KBSTATE newState)
 
void SkipMusicTrack (const KBData &, KBSTATE newState)
 
static void _PitchDown (KBSTATE newState, int fromCam=0, int toCam=NUM_CAM-1)
 
static void _PitchUp (KBSTATE newState, int fromCam=0, int toCam=NUM_CAM-1)
 
static void _YawLeft (KBSTATE newState, int fromCam=0, int toCam=NUM_CAM-1)
 
static void _YawRight (KBSTATE newState, int fromCam=0, int toCam=NUM_CAM-1)
 
void PitchDown (const KBData &, KBSTATE newState)
 
void PitchUp (const KBData &, KBSTATE newState)
 
void YawLeft (const KBData &, KBSTATE newState)
 
void YawRight (const KBData &, KBSTATE newState)
 
static void InitPanInside ()
 
void LookDown (const KBData &kbdata, KBSTATE newState)
 
void LookUp (const KBData &kbdata, KBSTATE newState)
 
void LookLeft (const KBData &kbdata, KBSTATE newState)
 
void LookRight (const KBData &kbdata, KBSTATE newState)
 
void Quit (const KBData &, KBSTATE newState)
 
void Inside (const KBData &, KBSTATE newState)
 
void ZoomOut (const KBData &, KBSTATE newState)
 
void ScrollUp (const KBData &, KBSTATE newState)
 
void ScrollDown (const KBData &, KBSTATE newState)
 
void ZoomIn (const KBData &, KBSTATE newState)
 
void ZoomReset (const KBData &, KBSTATE newState)
 
void InsideLeft (const KBData &, KBSTATE newState)
 
void InsideRight (const KBData &, KBSTATE newState)
 
void PanTarget (const KBData &, KBSTATE newState)
 
void ViewTarget (const KBData &, KBSTATE newState)
 
void OutsideTarget (const KBData &, KBSTATE newState)
 
void InsideBack (const KBData &, KBSTATE newState)
 
void CommModeVDU (const KBData &, KBSTATE newState)
 
void ScanningModeVDU (const KBData &, KBSTATE newState)
 
void ObjectiveModeVDU (const KBData &, KBSTATE newState)
 
void TargetModeVDU (const KBData &, KBSTATE newState)
 
void ViewModeVDU (const KBData &, KBSTATE newState)
 
void DamageModeVDU (const KBData &, KBSTATE newState)
 
void ManifestModeVDU (const KBData &, KBSTATE newState)
 
void GunModeVDU (const KBData &s, KBSTATE newState)
 
void ReverseGunModeVDU (const KBData &s, KBSTATE newState)
 
void MissileModeVDU (const KBData &s, KBSTATE newState)
 
void ReverseMissileModeVDU (const KBData &s, KBSTATE newState)
 
void SwitchLVDU (const KBData &, KBSTATE newState)
 
void SwitchRVDU (const KBData &, KBSTATE newState)
 
void SwitchMVDU (const KBData &, KBSTATE newState)
 
void SwitchULVDU (const KBData &, KBSTATE newState)
 
void SwitchURVDU (const KBData &, KBSTATE newState)
 
void SwitchUMVDU (const KBData &, KBSTATE newState)
 
void Behind (const KBData &, KBSTATE newState)
 
void Pan (const KBData &, KBSTATE newState)
 

Variables

unsigned int textmessager = 0
 
static bool waszero = false
 
static float scrolltime = 0
 

Function Documentation

static void CockpitKeys::_PitchDown ( KBSTATE  newState,
int  fromCam = 0,
int  toCam = NUM_CAM-1 
)
static

Definition at line 261 of file main_loop.cpp.

References _Slew, _Universe, Cockpit::AccessCamera(), Universe::AccessCockpit(), PhysicsSystem::ApplyBalancedLocalTorque(), vs_options::camera_pan_speed, i, Camera::myPhysics, PRESS, Camera::Q, QuitAllow, QuitNow(), Camera::R, R, RELEASE, PhysicsSystem::SetAngularVelocity(), and Vector.

Referenced by PitchDown().

262 {
263  static Vector Q;
264  static Vector R;
265  for (int i = fromCam; i <= toCam; i++) {
266  if (newState == PRESS) {
267  if (QuitAllow)
268  QuitNow();
269  Q = _Universe->AccessCockpit()->AccessCamera( i )->Q;
270  R = _Universe->AccessCockpit()->AccessCamera( i )->R;
272  R,
274  }
275  if (_Slew && newState == RELEASE)
277  }
278 }
static void CockpitKeys::_PitchUp ( KBSTATE  newState,
int  fromCam = 0,
int  toCam = NUM_CAM-1 
)
static

Definition at line 280 of file main_loop.cpp.

References _Slew, _Universe, Cockpit::AccessCamera(), Universe::AccessCockpit(), PhysicsSystem::ApplyBalancedLocalTorque(), vs_options::camera_pan_speed, i, Camera::myPhysics, PRESS, Camera::Q, Camera::R, R, RELEASE, PhysicsSystem::SetAngularVelocity(), and Vector.

Referenced by PitchUp().

281 {
282  static Vector Q;
283  static Vector R;
284  for (int i = fromCam; i <= toCam; i++) {
285  if (newState == PRESS) {
286  Q = _Universe->AccessCockpit()->AccessCamera( i )->Q;
287  R = _Universe->AccessCockpit()->AccessCamera( i )->R;
289  R,
291  }
292  if (_Slew && newState == RELEASE)
294  }
295 }
static void CockpitKeys::_YawLeft ( KBSTATE  newState,
int  fromCam = 0,
int  toCam = NUM_CAM-1 
)
static

Definition at line 297 of file main_loop.cpp.

References _Slew, _Universe, Cockpit::AccessCamera(), Universe::AccessCockpit(), PhysicsSystem::ApplyBalancedLocalTorque(), vs_options::camera_pan_speed, i, Camera::myPhysics, Camera::P, PRESS, Camera::R, R, RELEASE, PhysicsSystem::SetAngularVelocity(), and Vector.

Referenced by YawLeft().

298 {
299  static Vector P;
300  static Vector R;
301  for (int i = fromCam; i <= toCam; i++) {
302  if (newState == PRESS) {
303  P = _Universe->AccessCockpit()->AccessCamera( i )->P;
304  R = _Universe->AccessCockpit()->AccessCamera( i )->R;
306  R,
308  }
309  if (_Slew && newState == RELEASE)
311  }
312 }
static void CockpitKeys::_YawRight ( KBSTATE  newState,
int  fromCam = 0,
int  toCam = NUM_CAM-1 
)
static

Definition at line 314 of file main_loop.cpp.

References _Slew, _Universe, Cockpit::AccessCamera(), Universe::AccessCockpit(), PhysicsSystem::ApplyBalancedLocalTorque(), vs_options::camera_pan_speed, i, Camera::myPhysics, Camera::P, PRESS, Camera::R, R, RELEASE, PhysicsSystem::SetAngularVelocity(), and Vector.

Referenced by YawRight().

315 {
316  for (int i = fromCam; i <= toCam; i++) {
317  static Vector P;
318  static Vector R;
319  if (newState == PRESS) {
320  P = _Universe->AccessCockpit()->AccessCamera( i )->P;
321  R = _Universe->AccessCockpit()->AccessCamera( i )->R;
323  R,
325  }
326  if (_Slew && newState == RELEASE)
328  }
329 }
void CockpitKeys::Behind ( const KBData ,
KBSTATE  newState 
)

Definition at line 689 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_CHASE, DOWN, PitchDown(), PitchUp(), PRESS, RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by initGlobalCommandMap().

690 {
691  if (newState == PRESS || newState == DOWN) {
692  YawLeft( std::string(), RELEASE );
693  YawRight( std::string(), RELEASE );
694  PitchUp( std::string(), RELEASE );
695  PitchDown( std::string(), RELEASE );
696 
698  }
699 }
void CockpitKeys::CommModeVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 564 of file main_loop.cpp.

References vs_options::comm, VDU::COMM, soundContainer::loadsound(), soundContainer::playsound(), PRESS, soundContainer::sound, and SwitchVDUTo().

Referenced by initGlobalCommandMap().

565 {
566  if (newState == PRESS) {
567  static soundContainer sc;
568  if (sc.sound < 0)
570  sc.playsound();
572  }
573 }
void CockpitKeys::DamageModeVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 616 of file main_loop.cpp.

References VDU::DAMAGE, soundContainer::loadsound(), soundContainer::playsound(), PRESS, vs_options::repair, soundContainer::sound, and SwitchVDUTo().

Referenced by initGlobalCommandMap().

617 {
618  if (newState == PRESS) {
619  static soundContainer sc;
620  if (sc.sound < 0)
622  sc.playsound();
623 
625  }
626 }
void CockpitKeys::GunModeVDU ( const KBData s,
KBSTATE  newState 
)

Definition at line 638 of file main_loop.cpp.

References PRESS, SwitchVDUTo(), VDU::WEAPON, and FireKeyboard::WeapSelKey().

Referenced by initGlobalCommandMap().

639 {
640  if (newState == PRESS) SwitchVDUTo( VDU::WEAPON );
641  FireKeyboard::WeapSelKey( s, newState );
642 }
static void CockpitKeys::InitPanInside ( )
static

Definition at line 351 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_PANINSIDE, PitchDown(), PitchUp(), RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by LookDown(), LookLeft(), LookRight(), and LookUp().

352 {
353  YawLeft( std::string(), RELEASE );
354  YawRight( std::string(), RELEASE );
355  PitchUp( std::string(), RELEASE );
356  PitchDown( std::string(), RELEASE );
358 }
void CockpitKeys::Inside ( const KBData ,
KBSTATE  newState 
)

Definition at line 442 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), Universe::activeStarSystem(), vs_options::background, vs_options::cockpit, CP_FRONT, vs_options::disabled_cockpit_allowed, DOWN, Background::EnableBG(), findUnitInStarsystem(), StarSystem::getBackground(), Unit::getCockpit(), Cockpit::GetParent(), Cockpit::GetView(), Cockpit::Init(), Unit::name, Unit::owner, PitchDown(), PitchUp(), PRESS, RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by DoCockpitKeys(), and initGlobalCommandMap().

443 {
444  {
447  }
448  static int tmp = (game_options.cockpit ? 1 : 0);
450  YawLeft( KBData(), RELEASE );
451  YawRight( KBData(), RELEASE );
452  PitchUp( KBData(), RELEASE );
453  PitchDown( KBData(), RELEASE );
454  string cockpit = "disabled-cockpit.cpt";
455  if ( _Universe->AccessCockpit()->GetParent() )
456  cockpit = _Universe->AccessCockpit()->GetParent()->getCockpit();
457  Unit *u = NULL; //= NULL just to shut off a warning about its possibly being used uninitialized --chuck_starchaser
458  if ( (_Universe->AccessCockpit()->GetParent() != NULL)
459  && (_Universe->AccessCockpit()->GetParent()->name == "return_to_cockpit")
460  && (_Universe->AccessCockpit()->GetParent()->owner != NULL)
462  cockpit = u->getCockpit();
463  _Universe->AccessCockpit()->Init( cockpit.c_str(), ( (tmp) && _Universe->AccessCockpit()->GetParent() ) == false );
464  tmp = (tmp+1)%2;
465  }
466  if (newState == PRESS || newState == DOWN) {
468  }
469 }
void CockpitKeys::InsideBack ( const KBData ,
KBSTATE  newState 
)

Definition at line 553 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_BACK, DOWN, PitchDown(), PitchUp(), PRESS, RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by initGlobalCommandMap().

554 {
555  if (newState == PRESS || newState == DOWN) {
556  YawLeft( std::string(), RELEASE );
557  YawRight( std::string(), RELEASE );
558  PitchUp( std::string(), RELEASE );
559  PitchDown( std::string(), RELEASE );
560 
562  }
563 }
void CockpitKeys::InsideLeft ( const KBData ,
KBSTATE  newState 
)

Definition at line 507 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_LEFT, DOWN, PitchDown(), PitchUp(), PRESS, RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by initGlobalCommandMap().

508 {
509  if (newState == PRESS || newState == DOWN) {
510  YawLeft( std::string(), RELEASE );
511  YawRight( std::string(), RELEASE );
512  PitchUp( std::string(), RELEASE );
513  PitchDown( std::string(), RELEASE );
514 
516  }
517 }
void CockpitKeys::InsideRight ( const KBData ,
KBSTATE  newState 
)

Definition at line 518 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_RIGHT, DOWN, PRESS, and Cockpit::SetView().

Referenced by initGlobalCommandMap().

519 {
520  if (newState == PRESS || newState == DOWN) {
522  }
523 }
void CockpitKeys::LookDown ( const KBData kbdata,
KBSTATE  newState 
)

Definition at line 360 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), vs_options::camera_pan_speed, CP_PANINSIDE, CP_RIGHT, DOWN, Cockpit::GetView(), InitPanInside(), PitchDown(), PRESS, QuitAllow, QuitNow(), RELEASE, and Cockpit::SetInsidePanPitchSpeed().

Referenced by initGlobalCommandMap().

361 {
362  if (newState == PRESS && QuitAllow)
363  QuitNow();
364  if (newState == PRESS || newState == DOWN) {
365  if (_Universe->AccessCockpit()->GetView() <= CP_RIGHT) {
366  InitPanInside();
367  } else if (_Universe->AccessCockpit()->GetView() == CP_PANINSIDE) {
369  } else {
370  PitchDown( kbdata, newState );
371  }
372  } else if (newState == RELEASE) {
375  else
376  PitchDown( kbdata, newState );
377  }
378 }
void CockpitKeys::LookLeft ( const KBData kbdata,
KBSTATE  newState 
)

Definition at line 398 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), vs_options::camera_pan_speed, CP_PANINSIDE, CP_RIGHT, DOWN, Cockpit::GetView(), InitPanInside(), PRESS, RELEASE, Cockpit::SetInsidePanYawSpeed(), and YawLeft().

Referenced by initGlobalCommandMap().

399 {
400  if (newState == PRESS || newState == DOWN) {
401  if (_Universe->AccessCockpit()->GetView() <= CP_RIGHT) {
402  InitPanInside();
403  } else if (_Universe->AccessCockpit()->GetView() == CP_PANINSIDE) {
405  } else {
406  YawLeft( kbdata, newState );
407  }
408  } else if (newState == RELEASE) {
411  else
412  YawLeft( kbdata, newState );
413  }
414 }
void CockpitKeys::LookRight ( const KBData kbdata,
KBSTATE  newState 
)

Definition at line 416 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), vs_options::camera_pan_speed, CP_PANINSIDE, CP_RIGHT, DOWN, Cockpit::GetView(), InitPanInside(), PRESS, RELEASE, Cockpit::SetInsidePanYawSpeed(), and YawRight().

Referenced by initGlobalCommandMap().

417 {
418  if (newState == PRESS || newState == DOWN) {
419  if (_Universe->AccessCockpit()->GetView() <= CP_RIGHT) {
420  InitPanInside();
421  } else if (_Universe->AccessCockpit()->GetView() == CP_PANINSIDE) {
423  } else {
424  YawRight( kbdata, newState );
425  }
426  } else if (newState == RELEASE) {
429  else
430  YawRight( kbdata, newState );
431  }
432 }
void CockpitKeys::LookUp ( const KBData kbdata,
KBSTATE  newState 
)

Definition at line 380 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), vs_options::camera_pan_speed, CP_PANINSIDE, CP_RIGHT, DOWN, Cockpit::GetView(), InitPanInside(), PitchUp(), PRESS, RELEASE, and Cockpit::SetInsidePanPitchSpeed().

Referenced by initGlobalCommandMap().

381 {
382  if (newState == PRESS || newState == DOWN) {
383  if (_Universe->AccessCockpit()->GetView() <= CP_RIGHT) {
384  InitPanInside();
385  } else if (_Universe->AccessCockpit()->GetView() == CP_PANINSIDE) {
387  } else {
388  PitchUp( kbdata, newState );
389  }
390  } else if (newState == RELEASE) {
393  else
394  PitchUp( kbdata, newState );
395  }
396 }
void CockpitKeys::ManifestModeVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 627 of file main_loop.cpp.

References soundContainer::loadsound(), vs_options::manifest, VDU::MANIFEST, soundContainer::playsound(), PRESS, soundContainer::sound, and SwitchVDUTo().

Referenced by initGlobalCommandMap().

628 {
629  if (newState == PRESS) {
630  static soundContainer sc;
631  if (sc.sound < 0)
633  sc.playsound();
634 
636  }
637 }
void CockpitKeys::MissileModeVDU ( const KBData s,
KBSTATE  newState 
)

Definition at line 648 of file main_loop.cpp.

References FireKeyboard::MisSelKey(), PRESS, SwitchVDUTo(), and VDU::WEAPON.

Referenced by initGlobalCommandMap().

649 {
650  if (newState == PRESS) SwitchVDUTo( VDU::WEAPON );
651  FireKeyboard::MisSelKey( s, newState );
652 }
void CockpitKeys::ObjectiveModeVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 584 of file main_loop.cpp.

References soundContainer::loadsound(), vs_options::objective, VDU::OBJECTIVES, soundContainer::playsound(), PRESS, soundContainer::sound, and SwitchVDUTo().

Referenced by initGlobalCommandMap().

585 {
586  if (newState == PRESS) {
587  static soundContainer sc;
588  if (sc.sound < 0)
590  sc.playsound();
591 
593  }
594 }
void CockpitKeys::OutsideTarget ( const KBData ,
KBSTATE  newState 
)

Definition at line 541 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_TARGET, DOWN, PitchDown(), PitchUp(), PRESS, RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by initGlobalCommandMap().

542 {
543  if (newState == PRESS || newState == DOWN) {
544  YawLeft( std::string(), RELEASE );
545  YawRight( std::string(), RELEASE );
546  PitchUp( std::string(), RELEASE );
547  PitchDown( std::string(), RELEASE );
548 
550  }
551 }
void CockpitKeys::Pan ( const KBData ,
KBSTATE  newState 
)

Definition at line 700 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_PAN, DOWN, PitchDown(), PitchUp(), PRESS, RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by DoCockpitKeys(), and initGlobalCommandMap().

701 {
702  if (newState == PRESS || newState == DOWN) {
703  YawLeft( std::string(), RELEASE );
704  YawRight( std::string(), RELEASE );
705  PitchUp( std::string(), RELEASE );
706  PitchDown( std::string(), RELEASE );
707 
709  }
710 }
void CockpitKeys::PanTarget ( const KBData ,
KBSTATE  newState 
)

Definition at line 524 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_PANTARGET, DOWN, PRESS, and Cockpit::SetView().

Referenced by initGlobalCommandMap().

525 {
526  if (newState == PRESS || newState == DOWN) {
528  }
529 }
void CockpitKeys::PitchDown ( const KBData ,
KBSTATE  newState 
)
void CockpitKeys::PitchUp ( const KBData ,
KBSTATE  newState 
)

Definition at line 336 of file main_loop.cpp.

References _PitchUp().

Referenced by Behind(), GameCockpit::Draw(), initGlobalCommandMap(), InitPanInside(), Inside(), InsideBack(), InsideLeft(), LookUp(), OutsideTarget(), Pan(), and ViewTarget().

337 {
338  _PitchUp(newState);
339 }
void CockpitKeys::Quit ( const KBData ,
KBSTATE  newState 
)

Definition at line 435 of file main_loop.cpp.

References PRESS, and QuitAllow.

Referenced by initGlobalCommandMap(), and InitializeInput().

436 {
437  if (newState == PRESS) {
438  QuitAllow = !QuitAllow;
439  }
440 }
void CockpitKeys::QuitNow ( )

Definition at line 234 of file main_loop.cpp.

References _Universe, active_missions, cleanexit, forcefeedback, i, Network, VSExit(), vs_options::write_savegame_on_exit, and Universe::WriteSaveGame().

Referenced by _PitchDown(), BaseComputer::actionConfirmedQuitGame(), BaseUtil::ExitGame(), and LookDown().

235 {
236  if (!cleanexit)
237  {
238  cleanexit = true;
240  _Universe->WriteSaveGame( true ); //gotta do important stuff first
241  for (unsigned int i = 0; i < active_missions.size(); i++)
242  if (active_missions[i])
243  active_missions[i]->DirectorEnd();
244  if (forcefeedback)
245  {
246  delete forcefeedback;
247  forcefeedback = NULL;
248  }
249  VSExit( 0 );
250  }
251 }
void CockpitKeys::ReverseGunModeVDU ( const KBData s,
KBSTATE  newState 
)

Definition at line 643 of file main_loop.cpp.

References PRESS, FireKeyboard::ReverseWeapSelKey(), SwitchVDUTo(), and VDU::WEAPON.

Referenced by initGlobalCommandMap().

644 {
645  if (newState == PRESS) SwitchVDUTo( VDU::WEAPON );
646  FireKeyboard::ReverseWeapSelKey( s, newState );
647 }
void CockpitKeys::ReverseMissileModeVDU ( const KBData s,
KBSTATE  newState 
)

Definition at line 653 of file main_loop.cpp.

References PRESS, FireKeyboard::ReverseMisSelKey(), SwitchVDUTo(), and VDU::WEAPON.

Referenced by initGlobalCommandMap().

654 {
655  if (newState == PRESS) SwitchVDUTo( VDU::WEAPON );
656  FireKeyboard::ReverseMisSelKey( s, newState );
657 }
void CockpitKeys::ScanningModeVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 574 of file main_loop.cpp.

References soundContainer::loadsound(), soundContainer::playsound(), PRESS, vs_options::scanning, VDU::SCANNING, soundContainer::sound, and SwitchVDUTo().

Referenced by initGlobalCommandMap().

575 {
576  if (newState == PRESS) {
577  static soundContainer sc;
578  if (sc.sound < 0)
580  sc.playsound();
582  }
583 }
void CockpitKeys::ScrollDown ( const KBData ,
KBSTATE  newState 
)

Definition at line 486 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), DOWN, GetElapsedTime(), PRESS, and Cockpit::ScrollAllVDU().

Referenced by initGlobalCommandMap().

487 {
489  if ( newState == PRESS || (newState == DOWN && scrolltime >= .5) ) {
490  scrolltime = 0;
491  printf( "Disabling exceptions\n" );
493  }
494 }
void CockpitKeys::ScrollUp ( const KBData ,
KBSTATE  newState 
)

Definition at line 477 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), allexcept, DOWN, GetElapsedTime(), PRESS, and Cockpit::ScrollAllVDU().

Referenced by initGlobalCommandMap().

478 {
480  if ( newState == PRESS || (newState == DOWN && scrolltime >= .5) ) {
481  scrolltime = 0;
482  printf( "Enabling exceptions %d\n", allexcept );
484  }
485 }
void CockpitKeys::SkipMusicTrack ( const KBData ,
KBSTATE  newState 
)

Definition at line 253 of file main_loop.cpp.

References muzak, PRESS, and Music::Skip().

Referenced by initGlobalCommandMap().

254 {
255  if (newState == PRESS) {
256  printf( "skipping\n" );
257  muzak->Skip();
258  }
259 }
void CockpitKeys::SwitchLVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 658 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), PRESS, and Cockpit::VDUSwitch().

Referenced by initGlobalCommandMap().

659 {
660  if (newState == PRESS)
662 }
void CockpitKeys::SwitchMVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 668 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), PRESS, and Cockpit::VDUSwitch().

Referenced by initGlobalCommandMap().

669 {
670  if (newState == PRESS)
672 }
void CockpitKeys::SwitchRVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 663 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), PRESS, and Cockpit::VDUSwitch().

Referenced by initGlobalCommandMap().

664 {
665  if (newState == PRESS)
667 }
void CockpitKeys::SwitchULVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 673 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), PRESS, and Cockpit::VDUSwitch().

Referenced by initGlobalCommandMap().

674 {
675  if (newState == PRESS)
677 }
void CockpitKeys::SwitchUMVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 683 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), PRESS, and Cockpit::VDUSwitch().

Referenced by initGlobalCommandMap().

684 {
685  if (newState == PRESS)
687 }
void CockpitKeys::SwitchURVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 678 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), PRESS, and Cockpit::VDUSwitch().

Referenced by initGlobalCommandMap().

679 {
680  if (newState == PRESS)
682 }
void CockpitKeys::TargetModeVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 595 of file main_loop.cpp.

References vs_options::examine, soundContainer::loadsound(), soundContainer::playsound(), PRESS, soundContainer::sound, SwitchVDUTo(), and VDU::TARGET.

Referenced by initGlobalCommandMap().

596 {
597  if (newState == PRESS) {
598  static soundContainer sc;
599  if (sc.sound < 0)
601  sc.playsound();
602 
604  }
605 }
void CockpitKeys::TextMessageCallback ( unsigned int  ch,
unsigned int  mod,
bool  release,
int  x,
int  y 
)

Definition at line 173 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), GameCockpit::editingTextMessage, SaveGame::GetCallsign(), Cockpit::GetParent(), getUnitNameAndFgNoBase(), Network, UniverseUtil::receivedCustom(), RestoreKB(), Cockpit::savegame, shiftup(), GameCockpit::textMessage, NetClient::textMessage(), textmessager, waszero, WSK_BACKSPACE, WSK_DELETE, WSK_ESCAPE, WSK_KP_ENTER, WSK_MOD_LSHIFT, WSK_MOD_RSHIFT, and WSK_RETURN.

Referenced by TextMessageKey().

174 {
175  GameCockpit *gcp = static_cast< GameCockpit* > ( _Universe->AccessCockpit( textmessager ) );
176  gcp->editingTextMessage = true;
177  if ( ( release
178  && (waszero || ch == WSK_KP_ENTER || ch == WSK_ESCAPE) ) || ( release == false && (ch == ']' || ch == '[') ) ) {
179  waszero = false;
180  gcp->editingTextMessage = false;
181  RestoreKB();
182  }
183  if ( release || (ch == ']' || ch == '[') ) return;
184  unsigned int code =
185  ( ( WSK_MOD_LSHIFT == (mod&WSK_MOD_LSHIFT) ) || ( WSK_MOD_RSHIFT == (mod&WSK_MOD_RSHIFT) ) ) ? shiftup(
186  ch ) : ch;
187  if ( textmessager < _Universe->numPlayers() ) {
188  if (ch == WSK_BACKSPACE || ch == WSK_DELETE) {
189  gcp->textMessage = gcp->textMessage.substr( 0, gcp->textMessage.length()-1 );
190  } else if (ch == WSK_RETURN || ch == WSK_KP_ENTER) {
191  if (gcp->textMessage.length() != 0) {
192  std::string name = gcp->savegame->GetCallsign();
193  if (Network != NULL) {
194  Unit *par = gcp->GetParent();
195  if (0 && par)
196  name = getUnitNameAndFgNoBase( par );
198  } else if (gcp->textMessage[0] == '/') {
199  string cmd;
200  string args;
201  std::string::size_type space = gcp->textMessage.find( ' ' );
202  if (space) {
203  cmd = gcp->textMessage.substr( 1, space-1 );
204  args = gcp->textMessage.substr( space+1 );
205  } else {
206  cmd = gcp->textMessage.substr( 1 );
207  //Send custom message to itself.
208  }
209  UniverseUtil::receivedCustom( textmessager, true, cmd, args, string() );
210  }
211  waszero = false;
212  } else {waszero = true; } gcp->textMessage = "";
213  } else if (code != 0 && code <= 127) {
214  char newstr[2] = {(char) code, 0};
215  gcp->textMessage += newstr;
216  }
217  } else {
218  RestoreKB();
219  gcp->editingTextMessage = false;
220  }
221 }
void CockpitKeys::TextMessageKey ( const KBData ,
KBSTATE  newState 
)

Definition at line 223 of file main_loop.cpp.

References _Universe, Universe::CurrentCockpit(), VegaConfig::getVariable(), Network, XMLSupport::parse_bool(), PRESS, TextMessageCallback(), textmessager, vs_config, and winsys_set_keyboard_func().

Referenced by initGlobalCommandMap().

224 {
225  if (newState == PRESS) {
226  static bool chat_only_in_network =
227  XMLSupport::parse_bool( vs_config->getVariable( "network", "chat_only_in_network", "false" ) );
228  if ( (Network == NULL) && chat_only_in_network )
229  return;
232  }
233 }
void CockpitKeys::ViewModeVDU ( const KBData ,
KBSTATE  newState 
)

Definition at line 606 of file main_loop.cpp.

References soundContainer::loadsound(), soundContainer::playsound(), PRESS, soundContainer::sound, SwitchVDUTo(), vs_options::view, and VDU::VIEW.

Referenced by initGlobalCommandMap().

607 {
608  if (newState == PRESS) {
609  static soundContainer sc;
610  if (sc.sound < 0)
612  sc.playsound();
614  }
615 }
void CockpitKeys::ViewTarget ( const KBData ,
KBSTATE  newState 
)

Definition at line 530 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), CP_VIEWTARGET, DOWN, PitchDown(), PitchUp(), PRESS, RELEASE, Cockpit::SetView(), YawLeft(), and YawRight().

Referenced by initGlobalCommandMap().

531 {
532  if (newState == PRESS || newState == DOWN) {
533  YawLeft( std::string(), RELEASE );
534  YawRight( std::string(), RELEASE );
535  PitchUp( std::string(), RELEASE );
536  PitchDown( std::string(), RELEASE );
537 
539  }
540 }
void CockpitKeys::YawLeft ( const KBData ,
KBSTATE  newState 
)

Definition at line 341 of file main_loop.cpp.

References _YawLeft().

Referenced by Behind(), GameCockpit::Draw(), initGlobalCommandMap(), InitPanInside(), Inside(), InsideBack(), InsideLeft(), LookLeft(), OutsideTarget(), Pan(), and ViewTarget().

342 {
343  _YawLeft(newState);
344 }
void CockpitKeys::YawRight ( const KBData ,
KBSTATE  newState 
)
void CockpitKeys::ZoomIn ( const KBData ,
KBSTATE  newState 
)

Definition at line 495 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), DOWN, GetElapsedTime(), getTimeCompression(), PRESS, and Cockpit::zoomfactor.

Referenced by initGlobalCommandMap().

496 {
497  if (newState == PRESS || newState == DOWN)
499 }
void CockpitKeys::ZoomOut ( const KBData ,
KBSTATE  newState 
)

Definition at line 470 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), DOWN, GetElapsedTime(), getTimeCompression(), PRESS, and Cockpit::zoomfactor.

Referenced by initGlobalCommandMap().

471 {
472  if (newState == PRESS || newState == DOWN)
474 }
void CockpitKeys::ZoomReset ( const KBData ,
KBSTATE  newState 
)

Definition at line 501 of file main_loop.cpp.

References _Universe, Universe::AccessCockpit(), DOWN, PRESS, and Cockpit::zoomfactor.

Referenced by initGlobalCommandMap().

502 {
503  if (newState == PRESS || newState == DOWN)
505 }

Variable Documentation

float CockpitKeys::scrolltime = 0
static

Definition at line 476 of file main_loop.cpp.

unsigned int CockpitKeys::textmessager = 0

Definition at line 170 of file main_loop.cpp.

Referenced by TextMessageCallback(), and TextMessageKey().

bool CockpitKeys::waszero = false
static

Definition at line 171 of file main_loop.cpp.

Referenced by TextMessageCallback().