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
FlyByKeyboard Class Reference

#include <flykeyboard.h>

Inheritance diagram for FlyByKeyboard:
FlyByWire Orders::MatchVelocity Orders::MatchAngularVelocity Order FlyByJoystick

Public Member Functions

 FlyByKeyboard (unsigned int whichplayer)
 
virtual void Destroy ()
 The virutal function that unrefs all memory then calls Destruct () which takes care of unreffing this or calling delete on this. More...
 
virtual ~FlyByKeyboard ()
 
void Execute (bool)
 
void Execute ()
 The function that gets called and executes all queued suborders. More...
 
- Public Member Functions inherited from FlyByWire
 FlyByWire ()
 
 ~FlyByWire ()
 
void SwitchFlightMode ()
 
void ThrustRight (float percent)
 Turns on or off velocity resolution. More...
 
void ThrustUp (float percent)
 
void ThrustFront (float percent)
 
void DirectThrustRight (float percent)
 
void DirectThrustUp (float percent)
 
void DirectThrustFront (float percent)
 
void SheltonSlide (bool onoff)
 
void InertialFlight (bool onoff)
 
bool InertialFlight () const
 
bool InertialFlightEnable () const
 
void Stop (float percentage)
 Stops... sets desired velocity to 0. More...
 
void Right (float percentage)
 pass in the percentage of the turn they were turnin right. -age indicates left More...
 
void Up (float percentage)
 pass in the percentage of the turn they were turning up More...
 
void RollRight (float percentage)
 
void Afterburn (float percentage)
 Specifies match speed to use afterbuner and gives in higher velocity. More...
 
void MatchSpeed (const Vector &velocity)
 matches set_speed to this velocity's magnitude More...
 
void Accel (float percentage)
 negative is decel... 0 = nothing More...
 
virtual std::string getOrderDescription ()
 
- Public Member Functions inherited from Orders::MatchVelocity
 MatchVelocity (const Vector &desired, const Vector &desired_ang, const bool Local, const bool afterburner, const bool fini=true)
 
void SetDesiredVelocity (const Vector &desired, const bool Local)
 
void SetAfterburn (bool use_afterburn)
 
virtual ~MatchVelocity ()
 
- Public Member Functions inherited from Orders::MatchAngularVelocity
 MatchAngularVelocity (const Vector &desired, bool Local, bool fini=true)
 
void SetDesiredAngularVelocity (const Vector &desired, bool Local)
 
virtual ~MatchAngularVelocity ()
 
- Public Member Functions inherited from Order
virtual void ChooseTarget ()
 this function calls the destructor (needs to be overridden for python; More...
 
virtual bool PursueTarget (Unit *, bool isleader)
 
void ClearMessages ()
 clears the messasges of this order More...
 
 Order ()
 The default constructor setting everything to NULL and no dependency on order. More...
 
 Order (int type, int subtype)
 The constructor that specifies what order dependencies this order has. More...
 
OrderqueryType (unsigned int type)
 returns a pointer to the first order that may be bitwised ored with that type More...
 
OrderqueryAny (unsigned int type)
 returns a pointer to the first order that may be bitwise ored with any type More...
 
void eraseType (unsigned int type)
 Erases all orders that bitwise OR with that type. More...
 
bool AttachOrder (Unit *targets)
 Attaches a group of targets to this order (used for strategery-type games) More...
 
bool AttachOrder (QVector target)
 Attaches a navigation point to this order. More...
 
bool AttachSelfOrder (Unit *targets)
 Attaches a group (form up) to this order. More...
 
OrderEnqueueOrder (Order *ord)
 Enqueues another order that will be executed (in parallel perhaps) when next void Execute() is called. More...
 
OrderReplaceOrder (Order *ord)
 Replaces the first order of that type in the order queue. More...
 
bool Done ()
 
int getType ()
 
int getSubType ()
 
virtual void SetParent (Unit *parent1)
 Sets the parent of this Unit. Any virtual functions must call this one. More...
 
UnitGetParent () const
 
virtual void Communicate (const class CommunicationMessage &c)
 Sends a communication message from the Unit (encapulated in c) to this unit. More...
 
virtual void ProcessCommMessage (class CommunicationMessage &c)
 processes a single message...generally called by the Messages() func More...
 
virtual void ProcessCommunicationMessages (float CommRepsonseTime, bool RemoveMessageProcessed)
 responds (or does not) to certain messages in the message queue More...
 
OrderfindOrder (Order *ord)
 return pointer to order or NULL if not found More...
 
void eraseOrder (Order *ord)
 erase that order from the list More...
 
OrderEnqueueOrderFirst (Order *ord)
 enqueue order as first order More...
 
virtual olist_tgetOrderList ()
 returns the orderlist (NULL for orders that haven't got any) More...
 
virtual void AdjustRelationTo (Unit *un, float factor)
 
OrderfindOrderList ()
 searches the suborders recursively for the first order that has an orderlist More...
 
std::string createFullOrderDescription (int level=0)
 
void setActionString (std::string astring)
 
std::string getActionString ()
 
virtual float getMood ()
 

Static Public Member Functions

static void SwitchWebcam (const KBData &, KBSTATE)
 
static void SwitchSecured (const KBData &, KBSTATE)
 
static void ChangeCommStatus (const KBData &, KBSTATE)
 
static void DownFreq (const KBData &, KBSTATE)
 
static void UpFreq (const KBData &, KBSTATE)
 
static void KSwitchFlightMode (const KBData &, KBSTATE)
 
static void KThrustRight (const KBData &, KBSTATE)
 
static void KThrustLeft (const KBData &, KBSTATE)
 
static void KThrustUp (const KBData &, KBSTATE)
 
static void KThrustDown (const KBData &, KBSTATE)
 
static void KThrustFront (const KBData &, KBSTATE)
 
static void KThrustBack (const KBData &, KBSTATE)
 
static void SheltonKey (const KBData &, KBSTATE)
 
static void InertialToggleKey (const KBData &, KBSTATE)
 
static void InertialPulsorKey (const KBData &, KBSTATE)
 
static void JoyInertialXYPulsorKey (const KBData &, KBSTATE)
 
static void JoyInertialXZPulsorKey (const KBData &, KBSTATE)
 
static void JoyInertialXYToggleKey (const KBData &, KBSTATE)
 
static void JoyInertialXZToggleKey (const KBData &, KBSTATE)
 
static void JoyRollPulsorKey (const KBData &, KBSTATE)
 
static void JoyRollToggleKey (const KBData &, KBSTATE)
 
static void JoyBankPulsorKey (const KBData &, KBSTATE)
 
static void JoyBankToggleKey (const KBData &, KBSTATE)
 
static void StartKey (const KBData &, KBSTATE)
 
static void StopKey (const KBData &, KBSTATE)
 
static void UpKey (const KBData &, KBSTATE)
 
static void DownKey (const KBData &, KBSTATE)
 
static void LeftKey (const KBData &, KBSTATE)
 
static void RightKey (const KBData &, KBSTATE)
 
static void ABKey (const KBData &, KBSTATE)
 
static void AccelKey (const KBData &, KBSTATE)
 
static void DecelKey (const KBData &, KBSTATE)
 
static void RollLeftKey (const KBData &, KBSTATE)
 
static void RollRightKey (const KBData &, KBSTATE)
 
static void MatchSpeedKey (const KBData &, KBSTATE)
 
static void JumpKey (const KBData &, KBSTATE)
 
static void AutoKey (const KBData &, KBSTATE)
 
static void SwitchCombatModeKey (const KBData &, KBSTATE)
 
static void EngageSpecAuto (const KBData &, KBSTATE)
 
static void StopAutoKey (const KBData &, KBSTATE)
 
static void SetVelocityRefKey (const KBData &, KBSTATE)
 
static void SetNullVelocityRefKey (const KBData &, KBSTATE)
 

Public Attributes

int whichplayer
 
bool inauto
 

Protected Types

enum  joy_mode_enum {
  joyModeNormal =0, joyModeInertialXY =1, joyModeInertialXZ =2, joyModeRoll =4,
  joyModeBank =8
}
 

Protected Member Functions

void KeyboardUp (float val)
 
void KeyboardRight (float val)
 
void KeyboardRollRight (float val)
 
float clamp_axis (float v)
 
float reduce_axis (float v)
 

Protected Attributes

char joy_mode
 
- Protected Attributes inherited from FlyByWire
Vector DesiredShiftVelocity
 
Vector DirectThrust
 
bool sheltonslide
 If shelton slide, do not have the computer match linear. More...
 
bool controltype
 
bool inertial_flight_model
 
bool inertial_flight_enable
 
bool stolen_setspeed
 
float stolen_setspeed_value
 
- Protected Attributes inherited from Orders::MatchVelocity
Vector desired_velocity
 werld space... generally r*speed or local space More...
 
bool LocalVelocity
 Is the above in world space? More...
 
bool afterburn
 
- Protected Attributes inherited from Orders::MatchAngularVelocity
Vector desired_ang_velocity
 werld space or local space (pitch = 1 on the x axis) More...
 
bool LocalAng
 specified in Local or World coordinates More...
 
bool willfinish
 Whether this script should terminate upon reaching desired angular velocity. More...
 
- Protected Attributes inherited from Order
Unitparent
 The unit this order is attached to. More...
 
unsigned int type
 The bit code (from ORDERTYPES) that this order is (for parallel execution) More...
 
unsigned int subtype
 
bool done
 Whether or not this order is done. More...
 
UnitContainer group
 If this order applies to a group of units (as in form up with this group) More...
 
QVector targetlocation
 If this order applies to a physical location in world space. More...
 
std::vector< Order * > suborders
 The queue of suborders that will be executed in parallel according to bit code. More...
 
std::list< class
CommunicationMessage * > 
messagequeue
 a bunch of communications that have not been answered CommunicationMessages are actually containing reference to a nice Finite State Machine that can allow a player to have a reasonable conversation with an AI More...
 
std::string actionstring
 

Additional Inherited Members

- Public Types inherited from Order
enum  ORDERTYPES {
  MOVEMENT =1, FACING =2, WEAPON =4, CLOAKING =8,
  ALLTYPES =(1|2|4|8)
}
 The varieties of order types MOVEMENT,FACING, and WEAPON orders may not be mutually executed (lest one engine goes left, the other right) More...
 
enum  SUBORDERTYPES { SLOCATION =1, STARGET =2, SSELF =4 }
 

Detailed Description

Definition at line 11 of file flykeyboard.h.

Member Enumeration Documentation

Enumerator
joyModeNormal 
joyModeInertialXY 
joyModeInertialXZ 
joyModeRoll 
joyModeBank 

Definition at line 17 of file flykeyboard.h.

18  {
19  joyModeNormal =0,
22  joyModeRoll=4,
23  joyModeBank=8
24  };

Constructor & Destructor Documentation

FlyByKeyboard::FlyByKeyboard ( unsigned int  whichplayer)

Definition at line 101 of file flykeyboard.cpp.

References VegaConfig::getVariable(), inauto, joy_mode, joyModeBank, joyModeInertialXY, joyModeInertialXZ, joyModeRoll, starshipcontrolkeys, vs_config, and whichplayer.

101  : FlyByWire()
102  , axis_key( 0, 0, 0 )
103 {
104  this->last_jumped = 0;
105  this->whichplayer = whichplayer;
106  while (starshipcontrolkeys.size() <= whichplayer)
108  autopilot = NULL;
109  inauto = false;
110 
111  //Initial Joystick Mode
112  //NOTE: Perhaps it should be handled by FlyByJoystick, but it was cumbersome to do that
113  //since it handled mainly keystrokes - Any ideas?
114  static string initialJoyMode = vs_config->getVariable( "joystick", "initial_mode", "normal" );
115  joy_mode = 0;
116  if (initialJoyMode == "inertialxy")
118 
119  else if (initialJoyMode == "inertialxz")
121 
122  else if (initialJoyMode == "roll")
124 
125  else if (initialJoyMode == "bank")
127 }
FlyByKeyboard::~FlyByKeyboard ( )
virtual

Definition at line 49 of file flykeyboard_generic.cpp.

49 {}

Member Function Documentation

void FlyByKeyboard::ABKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 949 of file flykeyboard.cpp.

References StarShipControlKeyboard::ABpress, StarShipControlKeyboard::ABrelease, DOWN, FBWABS, g(), PRESS, RELEASE, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

950 {
951  if (g().dirty) g().UnDirty();
952  switch (k)
953  {
954  case UP:
955  g().ABrelease++;
956  break;
957  case DOWN:
958  g().ABpress = FBWABS( g().ABpress )+1;
959  break;
960  case PRESS:
961  g().ABpress = FBWABS( g().ABpress );
962  break;
963  case RELEASE:
964  g().ABpress = -FBWABS( g().ABpress );
965  break;
966  default:
967  break;
968  }
969 }
void FlyByKeyboard::AccelKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 1004 of file flykeyboard.cpp.

References StarShipControlKeyboard::accelpress, StarShipControlKeyboard::accelrelease, DOWN, FBWABS, g(), PRESS, RELEASE, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

1005 {
1006  if (g().dirty) g().UnDirty();
1007  switch (k)
1008  {
1009  case UP:
1010  g().accelrelease++;
1011  break;
1012  case DOWN:
1013  g().accelpress = FBWABS( g().accelpress )+1;
1014  break;
1015  case PRESS:
1016  g().accelpress = FBWABS( g().accelpress );
1017  break;
1018  case RELEASE:
1019  g().accelpress = -FBWABS( g().accelpress );
1020  break;
1021  default:
1022  break;
1023  }
1024 }
void FlyByKeyboard::AutoKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 971 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::realauto, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

972 {
973  if (g().dirty) g().UnDirty();
974  if (k == PRESS)
975  g().realauto = true;
976 }
void FlyByKeyboard::ChangeCommStatus ( const KBData ,
KBSTATE  k 
)
static

Definition at line 491 of file flykeyboard.cpp.

References StarShipControlKeyboard::commchanged, DOWN, g(), Network, PRESS, RELEASE, RESET, StarShipControlKeyboard::startcomm, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

492 {
493  if (Network != NULL)
494  if (g().dirty) g().UnDirty();
495  switch (k)
496  {
497  case DOWN:
498  case UP:
499  break;
500  case PRESS:
501  printf( "Pressed NETCOMM key !!!\n" );
502  if (g().startcomm == true)
503  g().startcomm = false;
504  else
505  g().startcomm = true;
506  g().commchanged = true;
507  break;
508  case RELEASE:
509  case RESET:
510  break;
511  }
512 }
float FlyByKeyboard::clamp_axis ( float  v)
protected

Definition at line 9 of file flykeyboard_generic.cpp.

References Unit::GetComputerData(), VegaConfig::getVariable(), Order::parent, XMLSupport::parse_int(), Unit::Computer::slide_start, v, and vs_config.

Referenced by KeyboardRight(), KeyboardRollRight(), and KeyboardUp().

10 {
11  static int axis_scale = XMLSupport::parse_int( vs_config->getVariable( "physics", "slide_start", "3" ) );
13  if (as == 0)
14  as = axis_scale;
15  if (as) {
16  v /= as;
17  if (v > 1)
18  return 1;
19  if (v < -1)
20  return -1;
21  }
22  return v;
23 }
void FlyByKeyboard::DecelKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 1025 of file flykeyboard.cpp.

References StarShipControlKeyboard::decelpress, StarShipControlKeyboard::decelrelease, DOWN, FBWABS, g(), PRESS, RELEASE, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

1026 {
1027  if (g().dirty) g().UnDirty();
1028  switch (k)
1029  {
1030  case UP:
1031  g().decelrelease++;
1032  break;
1033  case DOWN:
1034  g().decelpress = FBWABS( g().decelpress )+1;
1035  break;
1036  case PRESS:
1037  g().decelpress = FBWABS( g().decelpress );
1038  break;
1039  case RELEASE:
1040  g().decelpress = -FBWABS( g().decelpress );
1041  break;
1042  default:
1043  break;
1044  }
1045 }
void FlyByKeyboard::Destroy ( )
virtual

The virutal function that unrefs all memory then calls Destruct () which takes care of unreffing this or calling delete on this.

Reimplemented from Order.

Definition at line 42 of file flykeyboard_generic.cpp.

References Order::Destroy().

43 {
44  if (autopilot)
45  autopilot->Destroy();
47 }
void FlyByKeyboard::DownFreq ( const KBData ,
KBSTATE  k 
)
static

Definition at line 457 of file flykeyboard.cpp.

References DOWN, StarShipControlKeyboard::freq_decrease, g(), Network, PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

458 {
459  if (Network != NULL)
460  if (g().dirty) g().UnDirty();
461  switch (k)
462  {
463  case DOWN:
464  g().freq_decrease = true;
465  break;
466  case UP:
467  case PRESS:
468  case RELEASE:
469  case RESET:
470  break;
471  }
472 }
void FlyByKeyboard::DownKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 870 of file flykeyboard.cpp.

References DOWN, StarShipControlKeyboard::downpress, StarShipControlKeyboard::downrelease, FBWABS, g(), JoyStickToggleDisable(), PRESS, RELEASE, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

871 {
872  if (g().dirty) g().UnDirty();
873  switch (k)
874  {
875  case UP:
876  g().downrelease++;
877  break;
878  case DOWN:
879  g().downpress = FBWABS( g().downpress )+1;
880  break;
881  case PRESS:
882  g().downpress = FBWABS( g().downpress );
884  break;
885  case RELEASE:
886  g().downpress = -FBWABS( g().downpress );
887  break;
888  default:
889  break;
890  }
891 }
void FlyByKeyboard::EngageSpecAuto ( const KBData ,
KBSTATE  k 
)
static

Definition at line 978 of file flykeyboard.cpp.

References StarShipControlKeyboard::ASAP, g(), PRESS, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

979 {
980  if (g().dirty) g().UnDirty();
981  if (k == PRESS)
982  g().ASAP = true;
983 }
void FlyByKeyboard::Execute ( bool  resetangvelocity)

Definition at line 131 of file flykeyboard.cpp.

References _Universe, FlyByWire::Accel(), Unit::ActivateJumpDrive(), FlyByWire::Afterburn(), Cockpit::Autopilot(), Unit::autopilotactive, Orders::AutoDocking::CanDock(), Unit::DeactivateJumpDrive(), NetClient::decreaseFrequency(), Orders::MatchAngularVelocity::desired_ang_velocity, Order::Destroy(), FlyByWire::DirectThrustFront(), FlyByWire::DirectThrustRight(), FlyByWire::DirectThrustUp(), Order::done, Unit::UnitJump::drive, Order::EnqueueOrderFirst(), Order::eraseType(), Order::Execute(), FlyByWire::Execute(), FaceTarget(), Order::FACING, Unit::faction, FBWABS, Unit::GetJumpStatus(), FactionUtil::GetNeutralFaction(), Unit::getRelation(), FactionUtil::GetUpgradeFaction(), VegaConfig::getVariable(), Unit::GetVelocity(), Unit::graphicOptions, inauto, NetClient::increaseFrequency(), FlyByWire::InertialFlight(), Unit::graphic_options::InWarp, Universe::isPlayerStarship(), joy_mode, joyModeBank, joyModeInertialXY, joyModeInertialXZ, joyModeRoll, KeyboardRight(), KeyboardRollRight(), KeyboardUp(), soundContainer::loadsound(), FlyByWire::MatchSpeed(), Order::MOVEMENT, Network, Order::parent, XMLSupport::parse_bool(), XMLSupport::parse_float(), soundContainer::playsound(), Order::queryType(), Order::SetParent(), FlyByWire::SheltonSlide(), SIMULATION_ATOM, soundContainer::sound, SSCK, NetClient::startCommunication(), FlyByWire::Stop(), NetClient::stopCommunication(), Unit::SwitchCombatFlightMode(), FlyByWire::SwitchFlightMode(), NetClient::switchSecured(), NetClient::switchWebcam(), Unit::Target(), Vector, Unit::VelocityReference(), vs_config, Unit::graphic_options::WarpRamping, and whichplayer.

132 {
133 #define SSCK (starshipcontrolkeys[whichplayer])
134  if (Network != NULL && !SSCK.startcomm && SSCK.commchanged && whichplayer == 0) {
135  printf( "Stopping a NETCOMM\n" );
137  SSCK.commchanged = false;
138  }
139  if (Network != NULL && SSCK.startcomm && SSCK.commchanged && whichplayer == 0) {
140  printf( "Starting a NETCOMM\n" );
142  SSCK.commchanged = false;
143  }
144  if (Network != NULL && SSCK.freq_increase) {
145  SSCK.freq_increase = false;
147  }
148  if (Network != NULL && SSCK.freq_decrease) {
149  SSCK.freq_decrease = false;
151  }
152  if (Network != NULL && SSCK.switchwebcam) {
153  SSCK.switchwebcam = false;
155  }
156  if (Network != NULL && SSCK.switchsecured) {
157  SSCK.switchsecured = false;
159  }
160  if (SSCK.setunvel) {
161  SSCK.setunvel = false;
162  Unit *t = parent->Target();
163  int neu = FactionUtil::GetNeutralFaction();
164  int upg = FactionUtil::GetUpgradeFaction();
165  static bool allowanyreference = XMLSupport::parse_bool( vs_config->getVariable( "AI", "AllowAnySpeedReference", "false" ) );
166  static bool onlyupgraderef =
167  XMLSupport::parse_bool( vs_config->getVariable( "AI", "OnlyUpgradeSpeedReference", "false" ) );
168  if (t) {
169  if ( (t->getRelation( parent ) >= 0
170  && !onlyupgraderef) || t->faction == neu || t->faction == upg || allowanyreference )
172  }
173  }
174  if (SSCK.setnulvel) {
175  SSCK.setnulvel = false;
176  parent->VelocityReference( NULL );
177  }
178  if (SSCK.switch_combat_mode) {
179  SSCK.switch_combat_mode = false;
181  }
182  if (SSCK.ASAP) {
183  SSCK.ASAP = false;
184  if (FlyByKeyboard::inauto) {
185  this->eraseType( FACING|MOVEMENT );
186  FlyByKeyboard::inauto = false;
191  }
192  } else {
193  // Use AutoDocker if docking clearance on target, otherwise use AutoPilot
194  static bool autodock =
195  XMLSupport::parse_bool( vs_config->getVariable( "test", "autodocker", "false" ) );
196  Order *autoNavigator = NULL;
197  if (autodock)
198  {
199  Unit *station = parent->Target();
200  if (Orders::AutoDocking::CanDock(parent, station))
201  {
202  autoNavigator = new Orders::AutoDocking(station);
203  }
204  }
205  if (autoNavigator == NULL)
206  {
207  autoNavigator = new Orders::AutoLongHaul();
208  autoNavigator->SetParent( parent );
209  }
210  Order::EnqueueOrderFirst(autoNavigator);
211  FlyByKeyboard::inauto = true;
213  }
214  }
215  bool enteredautopilot = false;
216  if (SSCK.realauto) {
218  if (cp)
219  cp->Autopilot( parent->Target() );
220  enteredautopilot = true;
221  SSCK.realauto = false;
222  }
223  if (autopilot)
224  autopilot->Execute();
225  if (resetangvelocity)
226  desired_ang_velocity = Vector( 0, 0, 0 );
227  static bool initial_inertial_mode = XMLSupport::parse_bool( vs_config->getVariable( "flight", "inertial::initial", "false" ) );
228  if (SSCK.dirty) {
229  //go with what's last there: no frames since last physics frame
230  if (SSCK.uppress <= 0 && SSCK.downpress <= 0) {
231  KeyboardUp( 0 );
232  } else {
233  if (SSCK.uppress > 0)
234  KeyboardUp( 1 );
235  if (SSCK.downpress > 0)
236  KeyboardUp( -1 );
237  }
238  if (SSCK.leftpress <= 0 && SSCK.rightpress <= 0) {
239  KeyboardUp( 0 );
240  } else {
241  if (SSCK.rightpress > 0)
242  KeyboardRight( 1 );
243  if (SSCK.leftpress > 0)
244  KeyboardRight( -1 );
245  }
246  if (SSCK.rollrightpress <= 0 && SSCK.rollleftpress <= 0) {
247  KeyboardRollRight( 0 );
248  } else {
249  if (SSCK.rollrightpress > 0)
250  KeyboardRollRight( 1 );
251  if (SSCK.rollleftpress > 0)
252  KeyboardRollRight( -1 );
253  }
254  if (SSCK.ABpress >= 1)
255  Afterburn( 1 );
256  else
257  Afterburn( 0 );
258  if (SSCK.joyinertialxypress > 0)
260  if (SSCK.joyinertialxzpress > 0)
262  if (SSCK.joyrollpress > 0)
264  if (SSCK.joybankpress > 0)
266  if (SSCK.inertialflightpress > 0)
267  InertialFlight( !initial_inertial_mode );
268  if (SSCK.accelpress > 0)
269  Accel( 1 );
270  if (SSCK.decelpress > 0)
271  Accel( -1 );
272  } else {
273  if (SSCK.uppress == 0 && SSCK.downpress == 0) {
274  KeyboardUp( 0 );
275  } else {
276  if (SSCK.uppress != 0 && SSCK.downpress == 0) {
277  KeyboardUp( ( (float) FBWABS( SSCK.uppress ) )/(FBWABS( SSCK.uppress )+SSCK.uprelease) );
278  } else {
279  if (SSCK.downpress != 0 && SSCK.uppress == 0) {
280  KeyboardUp( -( (float) FBWABS( SSCK.downpress ) )/(FBWABS( SSCK.downpress )+SSCK.downrelease) );
281  } else {
282  KeyboardUp( ( (float) FBWABS( SSCK.uppress )
283  -(float) FBWABS( SSCK.downpress ) )
284  /(FBWABS( SSCK.downpress )+SSCK.downrelease+FBWABS( SSCK.uppress )+SSCK.uprelease) );
285  }
286  }
287  }
288  if (SSCK.rightpress == 0 && SSCK.leftpress == 0) {
289  KeyboardRight( 0 );
290  } else {
291  if (SSCK.rightpress != 0 && SSCK.leftpress == 0) {
292  KeyboardRight( ( (float) FBWABS( SSCK.rightpress ) )/(FBWABS( SSCK.rightpress )+SSCK.rightrelease) );
293  } else {
294  if (SSCK.leftpress != 0 && SSCK.rightpress == 0) {
295  KeyboardRight( -( (float) FBWABS( SSCK.leftpress ) )/(FBWABS( SSCK.leftpress )+SSCK.leftrelease) );
296  } else {
297  KeyboardRight( ( (float) FBWABS( SSCK.rightpress )
298  -(float) FBWABS( SSCK.leftpress ) )
299  /(FBWABS( SSCK.leftpress )+SSCK.leftrelease+FBWABS( SSCK.rightpress )+SSCK.rightrelease) );
300  }
301  }
302  }
303  if (SSCK.rollrightpress == 0 && SSCK.rollleftpress == 0) {
304  KeyboardRollRight( 0 );
305  } else {
306  if (SSCK.rollrightpress != 0 && SSCK.rollleftpress == 0) {
307  KeyboardRollRight( ( (float) FBWABS( SSCK.rollrightpress ) )
308  /(FBWABS( SSCK.rollrightpress )+SSCK.rollrightrelease) );
309  } else {
310  if (SSCK.rollleftpress != 0 && SSCK.rollrightpress == 0) {
311  KeyboardRollRight( -( (float) FBWABS( SSCK.rollleftpress ) )
312  /(FBWABS( SSCK.rollleftpress )+SSCK.rollleftrelease) );
313  } else {
314  KeyboardRollRight( ( (float) FBWABS( SSCK.rollrightpress )
315  -(float) FBWABS( SSCK.rollleftpress ) )
316  /(FBWABS( SSCK.rollleftpress )+SSCK.rollleftrelease+FBWABS( SSCK.rollrightpress )
317  +SSCK.rollrightrelease) );
318  }
319  }
320  }
321  if (SSCK.accelpress != 0)
322  Accel( ( (float) FBWABS( SSCK.accelpress ) )/(FBWABS( SSCK.accelpress )+SSCK.accelrelease) );
323  if (SSCK.decelpress != 0)
324  Accel( -( (float) FBWABS( SSCK.decelpress ) )/(FBWABS( SSCK.decelpress )+SSCK.decelrelease) );
325  if (SSCK.ABpress || SSCK.ABrelease)
326  Afterburn( (SSCK.ABpress >= 1) ? 1 : 0 );
327  if (SSCK.joyinertialxypress || SSCK.joyinertialxyrelease) {
328  if (SSCK.joyinertialxypress > 0)
330 
331  else
333  }
334  if (SSCK.joyinertialxzpress || SSCK.joyinertialxzrelease) {
335  if (SSCK.joyinertialxzpress > 0)
337 
338  else
340  }
341  if (SSCK.joyrollpress || SSCK.joyrollrelease) {
342  if (SSCK.joyrollpress > 0)
344 
345  else
346  joy_mode &= ~joyModeRoll;
347  }
348  if (SSCK.joybankpress || SSCK.joybankrelease) {
349  if (SSCK.joybankpress > 0)
351 
352  else
353  joy_mode &= ~joyModeBank;
354  }
355  if (SSCK.inertialflightpress || SSCK.inertialflightrelease) {
356  if (SSCK.inertialflightpress > 0)
357  InertialFlight( !initial_inertial_mode );
358 
359  else
360  InertialFlight( initial_inertial_mode );
361  }
362  }
363  if (SSCK.stoppress) {
364  Stop( 0 );
365  SSCK.stoppress = false;
366  }
367  if (SSCK.startpress || enteredautopilot) {
368  Stop( 1 );
369  SSCK.startpress = false;
370  }
371  if (SSCK.sheltonpress > 0)
372  SheltonSlide( true );
373  else
374  SheltonSlide( false );
375  if (SSCK.switchinertialflight) {
377  SSCK.switchinertialflight = false;
378  }
379  if (SSCK.switchjoyinertialxy) {
381  SSCK.switchjoyinertialxy = false;
382  }
383  if (SSCK.switchjoyinertialxz) {
385  SSCK.switchjoyinertialxz = false;
386  }
387  if (SSCK.switchjoyroll) {
389  SSCK.switchjoyroll = false;
390  }
391  if (SSCK.switchjoybank) {
393  SSCK.switchjoybank = false;
394  }
395  if (SSCK.switchmode)
397  if (SSCK.vertical)
398  FlyByWire::DirectThrustUp( SSCK.vertical );
399  if (SSCK.horizontal)
400  FlyByWire::DirectThrustRight( SSCK.horizontal );
401  if (SSCK.axial)
403  if (SSCK.autopilot && !autopilot) {
404  autopilot = new Orders::FaceTarget( false, 1 );
405  autopilot->SetParent( parent );
406  SSCK.autopilot = false;
407  }
408  if (SSCK.autopilot || SSCK.terminateauto) {
409  if (autopilot) {
410  autopilot->Destroy();
411  autopilot = NULL;
412  }
413  SSCK.autopilot = false;
414  SSCK.terminateauto = false;
415  }
416  if (SSCK.matchspeed) {
417  SSCK.matchspeed = false;
418  Unit *targ = parent->Target();
419  if (targ)
420  MatchSpeed( targ->GetVelocity() );
421  }
422  static unsigned int counter = 0;
423  counter++;
424  if (SSCK.jumpkey) {
425  static float jump_key_delay = XMLSupport::parse_float( vs_config->getVariable( "general", "jump_key_delay", ".125" ) );
426  if ( (counter-last_jumped) > static_cast<unsigned>(jump_key_delay/SIMULATION_ATOM) || last_jumped == 0) {
427  last_jumped = counter;
429  if (parent->GetJumpStatus().drive >= 0) {
430  static soundContainer foobar;
431  if (foobar.sound == -2) {
432  static string str = vs_config->getVariable( "cockpitaudio", "jump_engaged", "jump" );
433  foobar.loadsound( str );
434  }
435  foobar.playsound();
436  }
437  }
438  SSCK.jumpkey = false;
439  } else {
441  }
442  SSCK.dirty = true;
443 #undef SSCK
444  if ( queryType( FACING|MOVEMENT ) ) {
445  Order::Execute();
446  if (queryType( FACING|MOVEMENT ) == NULL)
447  FlyByKeyboard::inauto = false;
448  done = false;
449  } else {
451  }
452 }
void FlyByKeyboard::Execute ( )
virtual

The function that gets called and executes all queued suborders.

Reimplemented from FlyByWire.

Definition at line 90 of file flykeyboard_generic.cpp.

Referenced by FlyByJoystick::Execute().

91 {
92  FlyByKeyboard::Execute( true );
93 }
void FlyByKeyboard::InertialPulsorKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 610 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), StarShipControlKeyboard::inertialflightpress, StarShipControlKeyboard::inertialflightrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

611 {
612  if (g().dirty) g().UnDirty();
613  switch (k)
614  {
615  case UP:
616  g().inertialflightrelease = FBWABS( g().inertialflightrelease )+1;
617  break;
618  case DOWN:
619  g().inertialflightpress = FBWABS( g().inertialflightpress )+1;
620  break;
621  default:
622  break;
623  }
624 }
void FlyByKeyboard::InertialToggleKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 597 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::switchinertialflight, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

598 {
599  if (g().dirty) g().UnDirty();
600  switch (k)
601  {
602  case PRESS:
603  g().switchinertialflight = true;
604  break;
605  default:
606  break;
607  }
608 }
void FlyByKeyboard::JoyBankPulsorKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 726 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), StarShipControlKeyboard::joybankpress, StarShipControlKeyboard::joybankrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

727 {
728  if (g().dirty) g().UnDirty();
729  switch (k)
730  {
731  case UP:
732  g().joybankrelease = FBWABS( g().joybankrelease )+1;
733  break;
734  case DOWN:
735  g().joybankpress = FBWABS( g().joybankpress )+1;
736  break;
737  default:
738  break;
739  }
740 }
void FlyByKeyboard::JoyBankToggleKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 665 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::switchjoybank, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

666 {
667  if (g().dirty) g().UnDirty();
668  switch (k)
669  {
670  case PRESS:
671  g().switchjoybank = true;
672  break;
673  default:
674  break;
675  }
676 }
void FlyByKeyboard::JoyInertialXYPulsorKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 678 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), StarShipControlKeyboard::joyinertialxypress, StarShipControlKeyboard::joyinertialxyrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

679 {
680  if (g().dirty) g().UnDirty();
681  switch (k)
682  {
683  case UP:
684  g().joyinertialxyrelease = FBWABS( g().joyinertialxyrelease )+1;
685  break;
686  case DOWN:
687  g().joyinertialxypress = FBWABS( g().joyinertialxypress )+1;
688  break;
689  default:
690  break;
691  }
692 }
void FlyByKeyboard::JoyInertialXYToggleKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 626 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::switchjoyinertialxy, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

627 {
628  if (g().dirty) g().UnDirty();
629  switch (k)
630  {
631  case PRESS:
632  g().switchjoyinertialxy = true;
633  break;
634  default:
635  break;
636  }
637 }
void FlyByKeyboard::JoyInertialXZPulsorKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 694 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), StarShipControlKeyboard::joyinertialxzpress, StarShipControlKeyboard::joyinertialxzrelease, StarShipControlKeyboard::UnDirty(), and UP.

695 {
696  if (g().dirty) g().UnDirty();
697  switch (k)
698  {
699  case UP:
700  g().joyinertialxzrelease = FBWABS( g().joyinertialxzrelease )+1;
701  break;
702  case DOWN:
703  g().joyinertialxzpress = FBWABS( g().joyinertialxzpress )+1;
704  break;
705  default:
706  break;
707  }
708 }
void FlyByKeyboard::JoyInertialXZToggleKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 639 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::switchjoyinertialxz, and StarShipControlKeyboard::UnDirty().

640 {
641  if (g().dirty) g().UnDirty();
642  switch (k)
643  {
644  case PRESS:
645  g().switchjoyinertialxz = true;
646  break;
647  default:
648  break;
649  }
650 }
void FlyByKeyboard::JoyRollPulsorKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 710 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), StarShipControlKeyboard::joyrollpress, StarShipControlKeyboard::joyrollrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

711 {
712  if (g().dirty) g().UnDirty();
713  switch (k)
714  {
715  case UP:
716  g().joyrollrelease = FBWABS( g().joyrollrelease )+1;
717  break;
718  case DOWN:
719  g().joyrollpress = FBWABS( g().joyrollpress )+1;
720  break;
721  default:
722  break;
723  }
724 }
void FlyByKeyboard::JoyRollToggleKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 652 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::switchjoyroll, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

653 {
654  if (g().dirty) g().UnDirty();
655  switch (k)
656  {
657  case PRESS:
658  g().switchjoyroll = true;
659  break;
660  default:
661  break;
662  }
663 }
void FlyByKeyboard::JumpKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 742 of file flykeyboard.cpp.

References _Universe, Universe::AccessCockpit(), g(), Cockpit::GetParent(), Unit::isSubUnit(), StarShipControlKeyboard::jumpkey, PRESS, RELEASE, and UP.

Referenced by initGlobalCommandMap().

743 {
744  switch (k)
745  {
746  case PRESS:
748  break;
749  case UP:
750  case RELEASE:
751  g().jumpkey = false;
752  break;
753  default:
754  break;
755  }
756 }
void FlyByKeyboard::KeyboardRight ( float  val)
protected

Definition at line 64 of file flykeyboard_generic.cpp.

References clamp_axis(), reduce_axis(), FlyByWire::Right(), and v.

Referenced by Execute().

65 {
66  if (v == 0) {
67  axis_key.j = reduce_axis( axis_key.j );
68  } else {
69  if ( (v > 0) == (axis_key.j >= 0) )
70  axis_key.j += v;
71  else
72  axis_key.j = v;
73  }
74  Right( clamp_axis( axis_key.j ) );
75 }
void FlyByKeyboard::KeyboardRollRight ( float  val)
protected

Definition at line 77 of file flykeyboard_generic.cpp.

References clamp_axis(), reduce_axis(), FlyByWire::RollRight(), and v.

Referenced by Execute().

78 {
79  if (v == 0) {
80  axis_key.k = reduce_axis( axis_key.k );
81  } else {
82  if ( (v > 0) == (axis_key.k >= 0) )
83  axis_key.k += v;
84  else
85  axis_key.k = v;
86  }
87  RollRight( clamp_axis( axis_key.k ) );
88 }
void FlyByKeyboard::KeyboardUp ( float  val)
protected

Definition at line 51 of file flykeyboard_generic.cpp.

References clamp_axis(), reduce_axis(), FlyByWire::Up(), and v.

Referenced by Execute().

52 {
53  if (v == 0) {
54  axis_key.i = reduce_axis( axis_key.i );
55  } else {
56  if ( (v > 0) == (axis_key.i >= 0) )
57  axis_key.i += v;
58  else
59  axis_key.i = v;
60  }
61  Up( clamp_axis( axis_key.i ) );
62 }
void FlyByKeyboard::KSwitchFlightMode ( const KBData ,
KBSTATE  k 
)
static

Definition at line 915 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::switchmode, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

916 {
917  if (g().dirty) g().UnDirty();
918  switch (k)
919  {
920  case PRESS:
921  g().switchmode = true;
922  break;
923  default:
924  break;
925  }
926 }
void FlyByKeyboard::KThrustBack ( const KBData ,
KBSTATE  k 
)
static

Definition at line 854 of file flykeyboard.cpp.

References StarShipControlKeyboard::axial, DOWN, g(), PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

855 {
856  if (g().dirty) g().UnDirty();
857  switch (k)
858  {
859  case DOWN:
860  g().axial -= 1;
861  break;
862  case UP:
863  case PRESS:
864  case RELEASE:
865  case RESET:
866  break;
867  }
868 }
void FlyByKeyboard::KThrustDown ( const KBData ,
KBSTATE  k 
)
static

Definition at line 824 of file flykeyboard.cpp.

References DOWN, g(), PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), UP, and StarShipControlKeyboard::vertical.

Referenced by initGlobalCommandMap().

825 {
826  if (g().dirty) g().UnDirty();
827  switch (k)
828  {
829  case DOWN:
830  g().vertical -= 1;
831  break;
832  case UP:
833  case PRESS:
834  case RELEASE:
835  case RESET:
836  break;
837  }
838 }
void FlyByKeyboard::KThrustFront ( const KBData ,
KBSTATE  k 
)
static

Definition at line 839 of file flykeyboard.cpp.

References StarShipControlKeyboard::axial, DOWN, g(), PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

840 {
841  if (g().dirty) g().UnDirty();
842  switch (k)
843  {
844  case DOWN:
845  g().axial += 1;
846  break;
847  case UP:
848  case PRESS:
849  case RELEASE:
850  case RESET:
851  break;
852  }
853 }
void FlyByKeyboard::KThrustLeft ( const KBData ,
KBSTATE  k 
)
static

Definition at line 794 of file flykeyboard.cpp.

References DOWN, g(), StarShipControlKeyboard::horizontal, PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

795 {
796  if (g().dirty) g().UnDirty();
797  switch (k)
798  {
799  case DOWN:
800  g().horizontal += 1;
801  break;
802  case UP:
803  case PRESS:
804  case RELEASE:
805  case RESET:
806  break;
807  }
808 }
void FlyByKeyboard::KThrustRight ( const KBData ,
KBSTATE  k 
)
static

Definition at line 779 of file flykeyboard.cpp.

References DOWN, g(), StarShipControlKeyboard::horizontal, PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

780 {
781  if (g().dirty) g().UnDirty();
782  switch (k)
783  {
784  case DOWN:
785  g().horizontal -= 1;
786  break;
787  case UP:
788  case PRESS:
789  case RELEASE:
790  case RESET:
791  break;
792  }
793 }
void FlyByKeyboard::KThrustUp ( const KBData ,
KBSTATE  k 
)
static

Definition at line 809 of file flykeyboard.cpp.

References DOWN, g(), PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), UP, and StarShipControlKeyboard::vertical.

Referenced by initGlobalCommandMap().

810 {
811  if (g().dirty) g().UnDirty();
812  switch (k)
813  {
814  case DOWN:
815  g().vertical += 1;
816  break;
817  case UP:
818  case PRESS:
819  case RELEASE:
820  case RESET:
821  break;
822  }
823 }
void FlyByKeyboard::LeftKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 893 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), JoyStickToggleDisable(), StarShipControlKeyboard::leftpress, StarShipControlKeyboard::leftrelease, PRESS, RELEASE, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

894 {
895  if (g().dirty) g().UnDirty();
896  switch (k)
897  {
898  case UP:
899  g().leftrelease++;
900  break;
901  case DOWN:
902  g().leftpress = FBWABS( g().leftpress )+1;
903  break;
904  case PRESS:
905  g().leftpress = FBWABS( g().leftpress );
907  break;
908  case RELEASE:
909  g().leftpress = -FBWABS( g().leftpress );
910  break;
911  default:
912  break;
913  }
914 }
void FlyByKeyboard::MatchSpeedKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 1075 of file flykeyboard.cpp.

References g(), StarShipControlKeyboard::matchspeed, PRESS, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

1076 {
1077  if (k == PRESS) {
1078  if (g().dirty) g().UnDirty();
1079  g().matchspeed = true;
1080  }
1081 }
float FlyByKeyboard::reduce_axis ( float  v)
protected

Definition at line 25 of file flykeyboard_generic.cpp.

References Unit::GetComputerData(), VegaConfig::getVariable(), Order::parent, XMLSupport::parse_int(), Unit::Computer::slide_end, v, and vs_config.

Referenced by KeyboardRight(), KeyboardRollRight(), and KeyboardUp().

26 {
27  static int axis_scale = XMLSupport::parse_int( vs_config->getVariable( "physics", "slide_end", "2" ) );
28  int as = parent->GetComputerData().slide_end;
29  if (as == 0)
30  as = axis_scale;
31  if (as && fabs( v ) > as) {
32  if (v > 0)
33  v -= as;
34  else
35  v += as;
36  } else {
37  v = 0;
38  }
39  return v;
40 }
void FlyByKeyboard::RightKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 927 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), JoyStickToggleDisable(), PRESS, RELEASE, StarShipControlKeyboard::rightpress, StarShipControlKeyboard::rightrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

928 {
929  if (g().dirty) g().UnDirty();
930  switch (k)
931  {
932  case UP:
933  g().rightrelease++;
934  break;
935  case DOWN:
936  g().rightpress = FBWABS( g().rightpress )+1;
937  break;
938  case PRESS:
939  g().rightpress = FBWABS( g().rightpress );
941  break;
942  case RELEASE:
943  g().rightpress = -FBWABS( g().rightpress );
944  break;
945  default:
946  break;
947  }
948 }
void FlyByKeyboard::RollLeftKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 1082 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), PRESS, RELEASE, StarShipControlKeyboard::rollleftpress, StarShipControlKeyboard::rollleftrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

1083 {
1084  if (g().dirty) g().UnDirty();
1085  switch (k)
1086  {
1087  case UP:
1088  g().rollleftrelease++;
1089  break;
1090  case DOWN:
1091  g().rollleftpress = FBWABS( g().rollleftpress )+1;
1092  break;
1093  case PRESS:
1094  g().rollleftpress = FBWABS( g().rollleftpress );
1095  break;
1096  case RELEASE:
1097  g().rollleftpress = -FBWABS( g().rollleftpress );
1098  break;
1099  default:
1100  break;
1101  }
1102 }
void FlyByKeyboard::RollRightKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 1054 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), PRESS, RELEASE, StarShipControlKeyboard::rollrightpress, StarShipControlKeyboard::rollrightrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

1055 {
1056  if (g().dirty) g().UnDirty();
1057  switch (k)
1058  {
1059  case UP:
1060  g().rollrightrelease++;
1061  break;
1062  case DOWN:
1063  g().rollrightpress = FBWABS( g().rollrightpress )+1;
1064  break;
1065  case PRESS:
1066  g().rollrightpress = FBWABS( g().rollrightpress );
1067  break;
1068  case RELEASE:
1069  g().rollrightpress = -FBWABS( g().rollrightpress );
1070  break;
1071  default:
1072  break;
1073  }
1074 }
void FlyByKeyboard::SetNullVelocityRefKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 566 of file flykeyboard.cpp.

References DOWN, g(), StarShipControlKeyboard::setnulvel, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

567 {
568  if (g().dirty) g().UnDirty();
569  switch (k)
570  {
571  case UP:
572  break;
573  case DOWN:
574  g().setnulvel = true;
575  break;
576  default:
577  break;
578  }
579 }
void FlyByKeyboard::SetVelocityRefKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 552 of file flykeyboard.cpp.

References DOWN, g(), StarShipControlKeyboard::setunvel, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

553 {
554  if (g().dirty) g().UnDirty();
555  switch (k)
556  {
557  case UP:
558  break;
559  case DOWN:
560  g().setunvel = true;
561  break;
562  default:
563  break;
564  }
565 }
void FlyByKeyboard::SheltonKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 581 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), StarShipControlKeyboard::sheltonpress, StarShipControlKeyboard::sheltonrelease, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

582 {
583  if (g().dirty) g().UnDirty();
584  switch (k)
585  {
586  case UP:
587  g().sheltonrelease = FBWABS( g().sheltonrelease )+1;
588  break;
589  case DOWN:
590  g().sheltonpress = FBWABS( g().sheltonpress )+1;
591  break;
592  default:
593  break;
594  }
595 }
void FlyByKeyboard::StartKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 1047 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::startpress, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

1048 {
1049  if (g().dirty) g().UnDirty();
1050  if (k == PRESS)
1051  g().startpress = true;
1052 }
void FlyByKeyboard::StopAutoKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 991 of file flykeyboard.cpp.

References StarShipControlKeyboard::autopilot, g(), PRESS, and StarShipControlKeyboard::UnDirty().

992 {
993  if (g().dirty) g().UnDirty();
994  if (k == PRESS)
995  g().autopilot = true;
996 }
void FlyByKeyboard::StopKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 998 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::stoppress, and StarShipControlKeyboard::UnDirty().

Referenced by Orders::AutoDocking::AbortState(), and initGlobalCommandMap().

999 {
1000  if (g().dirty) g().UnDirty();
1001  if (k == PRESS)
1002  g().stoppress = true;
1003 }
void FlyByKeyboard::SwitchCombatModeKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 985 of file flykeyboard.cpp.

References g(), PRESS, StarShipControlKeyboard::switch_combat_mode, and StarShipControlKeyboard::UnDirty().

Referenced by initGlobalCommandMap().

986 {
987  if (g().dirty) g().UnDirty();
988  if (k == PRESS)
989  g().switch_combat_mode = true;
990 }
void FlyByKeyboard::SwitchSecured ( const KBData ,
KBSTATE  k 
)
static

Definition at line 533 of file flykeyboard.cpp.

References DOWN, g(), Network, PRESS, RELEASE, RESET, StarShipControlKeyboard::switchsecured, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

534 {
535  if (Network != NULL)
536  if (g().dirty) g().UnDirty();
537  switch (k)
538  {
539  case DOWN:
540  case UP:
541  break;
542  case PRESS:
543  printf( "Pressed SWITCHSECURED key !!!\n" );
544  g().switchsecured = true;
545  break;
546  case RELEASE:
547  case RESET:
548  break;
549  }
550 }
void FlyByKeyboard::SwitchWebcam ( const KBData ,
KBSTATE  k 
)
static

Definition at line 514 of file flykeyboard.cpp.

References DOWN, g(), Network, PRESS, RELEASE, RESET, StarShipControlKeyboard::switchwebcam, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

515 {
516  if (Network != NULL)
517  if (g().dirty) g().UnDirty();
518  switch (k)
519  {
520  case DOWN:
521  case UP:
522  break;
523  case PRESS:
524  printf( "Pressed SWITCHWEBCAM key !!!\n" );
525  g().switchwebcam = true;
526  break;
527  case RELEASE:
528  case RESET:
529  break;
530  }
531 }
void FlyByKeyboard::UpFreq ( const KBData ,
KBSTATE  k 
)
static

Definition at line 474 of file flykeyboard.cpp.

References DOWN, StarShipControlKeyboard::freq_increase, g(), Network, PRESS, RELEASE, RESET, StarShipControlKeyboard::UnDirty(), and UP.

Referenced by initGlobalCommandMap().

475 {
476  if (Network != NULL)
477  if (g().dirty) g().UnDirty();
478  switch (k)
479  {
480  case DOWN:
481  g().freq_increase = true;
482  break;
483  case UP:
484  case PRESS:
485  case RELEASE:
486  case RESET:
487  break;
488  }
489 }
void FlyByKeyboard::UpKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 757 of file flykeyboard.cpp.

References DOWN, FBWABS, g(), JoyStickToggleDisable(), PRESS, RELEASE, StarShipControlKeyboard::UnDirty(), UP, StarShipControlKeyboard::uppress, and StarShipControlKeyboard::uprelease.

Referenced by initGlobalCommandMap().

758 {
759  if (g().dirty) g().UnDirty();
760  switch (k)
761  {
762  case UP:
763  g().uprelease++;
764  break;
765  case DOWN:
766  g().uppress = FBWABS( g().uppress )+1;
767  break;
768  case PRESS:
769  g().uppress = FBWABS( g().uppress );
771  break;
772  case RELEASE:
773  g().uppress = -FBWABS( g().uppress );
774  break;
775  default:
776  break;
777  }
778 }

Member Data Documentation

bool FlyByKeyboard::inauto

Definition at line 76 of file flykeyboard.h.

Referenced by Execute(), and FlyByKeyboard().

char FlyByKeyboard::joy_mode
protected

Definition at line 25 of file flykeyboard.h.

Referenced by FlyByJoystick::Execute(), Execute(), and FlyByKeyboard().

int FlyByKeyboard::whichplayer

Definition at line 75 of file flykeyboard.h.

Referenced by Execute(), and FlyByKeyboard().


The documentation for this class was generated from the following files: