43#import "MyOpenGLView.h" 
   68#define CUSTOM_VIEW_ROTATE_SPEED    1.0 
   69#define CUSTOM_VIEW_ZOOM_SPEED      5.0 
   70#define CUSTOM_VIEW_SPEED_REDUCTION_FACTOR  0.3 
  107#if OO_RESOLUTION_OPTION 
  110#if OOLITE_SPEECH_SYNTH 
  113static BOOL             speechVoiceSelectKeyPressed;
 
  114static BOOL             speechGenderSelectKeyPressed;
 
  124static BOOL             gammaControlPressed;
 
  170@interface PlayerEntity (OOControlsPrivate)
 
  172- (void) pollFlightControls:(
double) delta_t;
 
  173- (void) pollFlightArrowKeyControls:(
double) delta_t;
 
  174- (void) pollGuiArrowKeyControls:(
double) delta_t;
 
  183- (void) pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias;
 
  186- (void) pollGameOverControls:(
double) delta_t;
 
  187- (void) pollAutopilotControls:(
double) delta_t;
 
  188- (void) pollDockedControls:(
double) delta_t;
 
  189- (void) pollDemoControls:(
double) delta_t;
 
  193- (void) switchToThisView:(
OOViewID)viewDirection;
 
  194- (void) switchToThisView:(
OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing;
 
  195- (void) switchToThisView:(
OOViewID)viewDirection fromView:(
OOViewID)oldViewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing justNotify:(BOOL)justNotify;
 
  197- (void) handleAutopilotOn:(BOOL)fastDocking;
 
  205@implementation PlayerEntity (Controls)
 
  211    keyCodeLookups = [[
NSDictionary alloc] initWithObjectsAndKeys:
 
  212        [
NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"arrowleft", 
 
  213        [
NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"leftarrow", 
 
  214        [
NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"left", 
 
  215        [
NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"arrowright", 
 
  216        [
NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"rightarrow", 
 
  217        [
NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"right", 
 
  218        [
NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"arrowup", 
 
  219        [
NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"uparrow", 
 
  220        [
NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"up", 
 
  221        [
NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"arrowdown", 
 
  222        [
NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"downarrow", 
 
  223        [
NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"down", 
 
  224        [
NSNumber numberWithUnsignedShort:gvPageUpKey], @"pageup", 
 
  225        [
NSNumber numberWithUnsignedShort:gvPageDownKey], @"pagedown", 
 
  226        [
NSNumber numberWithUnsignedShort:13], @"enter", 
 
  227        [
NSNumber numberWithUnsignedShort:13], @"return", 
 
  228        [
NSNumber numberWithUnsignedShort:27], @"escape", 
 
  229        [
NSNumber numberWithUnsignedShort:27], @"esc", 
 
  230        [
NSNumber numberWithUnsignedShort:9], @"tab", 
 
  231        [
NSNumber numberWithUnsignedShort:32], @"space", 
 
  232        [
NSNumber numberWithUnsignedShort:32], @"spc", 
 
  233        [
NSNumber numberWithUnsignedShort:gvHomeKey], @"home", 
 
  234        [
NSNumber numberWithUnsignedShort:gvEndKey], @"end", 
 
  235        [
NSNumber numberWithUnsignedShort:gvDeleteKey], @"delete", 
 
  236        [
NSNumber numberWithUnsignedShort:gvDeleteKey], @"del", 
 
  237        [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspace", 
 
  238        [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspc", 
 
  239        [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspace", 
 
  240        [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspc", 
 
  241        [
NSNumber numberWithUnsignedShort:gvInsertKey], @"insert", 
 
  242        [
NSNumber numberWithUnsignedShort:gvInsertKey], @"ins", 
 
  243        [
NSNumber numberWithUnsignedShort:gvFunctionKey1], @"f1", 
 
  244        [
NSNumber numberWithUnsignedShort:gvFunctionKey2], @"f2", 
 
  245        [
NSNumber numberWithUnsignedShort:gvFunctionKey3], @"f3", 
 
  246        [
NSNumber numberWithUnsignedShort:gvFunctionKey4], @"f4", 
 
  247        [
NSNumber numberWithUnsignedShort:gvFunctionKey5], @"f5", 
 
  248        [
NSNumber numberWithUnsignedShort:gvFunctionKey6], @"f6", 
 
  249        [
NSNumber numberWithUnsignedShort:gvFunctionKey7], @"f7", 
 
  250        [
NSNumber numberWithUnsignedShort:gvFunctionKey8], @"f8", 
 
  251        [
NSNumber numberWithUnsignedShort:gvFunctionKey9], @"f9", 
 
  252        [
NSNumber numberWithUnsignedShort:gvFunctionKey10], @"f10", 
 
  253        [
NSNumber numberWithUnsignedShort:gvFunctionKey11], @"f11", 
 
  254        [
NSNumber numberWithUnsignedShort:gvPauseKey], @"pause",
 
  255        [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"printscreen",
 
  256        [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscrn",
 
  257        [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prntscrn",
 
  258        [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscn",
 
  259        [
NSNumber numberWithUnsignedShort:gvNumberPadKey0], @"numpad0", 
 
  260        [
NSNumber numberWithUnsignedShort:gvNumberPadKey1], @"numpad1", 
 
  261        [
NSNumber numberWithUnsignedShort:gvNumberPadKey2], @"numpad2", 
 
  262        [
NSNumber numberWithUnsignedShort:gvNumberPadKey3], @"numpad3", 
 
  263        [
NSNumber numberWithUnsignedShort:gvNumberPadKey4], @"numpad4", 
 
  264        [
NSNumber numberWithUnsignedShort:gvNumberPadKey5], @"numpad5", 
 
  265        [
NSNumber numberWithUnsignedShort:gvNumberPadKey6], @"numpad6", 
 
  266        [
NSNumber numberWithUnsignedShort:gvNumberPadKey7], @"numpad7", 
 
  267        [
NSNumber numberWithUnsignedShort:gvNumberPadKey8], @"numpad8", 
 
  268        [
NSNumber numberWithUnsignedShort:gvNumberPadKey9], @"numpad9", 
 
  269        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpad/",
 
  270        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpaddivide",
 
  271        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpad*",
 
  272        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpadmultiply",
 
  273        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpad-",
 
  274        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpadminus",
 
  275        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpad+",
 
  276        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpadplus",
 
  277        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpad.",
 
  278        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpadperiod",
 
  279        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpad=",
 
  280        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpadequals",
 
  281        [
NSNumber numberWithUnsignedShort:gvNumberPadKeyEnter], @"numpadenter", nil];
 
  283    keyShiftText = [DESC(@"oolite-keyconfig-shift") retain];
 
  284    keyMod1Text = [DESC(@"oolite-keyconfig-mod1") retain];
 
  286    keyMod2Text = [DESC(@"oolite-keyconfig-mod2-mac") retain];
 
  288    keyMod2Text = [DESC(@"oolite-keyconfig-mod2-pc") retain];
 
 
  301    NSString *kbd = [
defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
 
  307    NSArray         *def_list = 
nil;
 
  309    keys = [
kdic2 allKeys];
 
  310    for (i = 0; i < [
keys count]; i++)
 
  312        key = [
keys objectAtIndex:i];
 
  313        if ([[kdic2 objectForKey:key] isKindOfClass:[NSArray 
class]])
 
  315            def_list = (NSArray*)[kdic2 objectForKey: key];
 
  324        NSArray *temp = [
defaults arrayForKey:KEYCONFIG_CUSTOMEQUIP];
 
  325        customEquipActivation = [[
NSMutableArray arrayWithArray:temp] retain];
 
  341    NSMutableArray *keyDef = 
nil;
 
  342    NSString *lookup = 
nil;
 
  344    NSDictionary *key1 = 
nil;
 
  345    NSDictionary *key2 = 
nil;
 
  348    NSDictionary *dict = [
defaults objectForKey:KEYCONFIG_OVERRIDES];
 
  350    keys = [
dict allKeys];
 
  351    for (i = 0; i < [
keys count]; i++)
 
  353        key = [
keys objectAtIndex:i];
 
  354        [
kdic2 setObject:[
dict objectForKey:key] forKey:key];
 
  359#define LOAD_KEY_SETTING2(name, default_1, shift_1, mod1_1, default_2, shift_2, mod1_2) \ 
  360    lookup = [@#name substringFromIndex:2]; \ 
  361    curr = (NSArray*)[[kdic2 objectForKey:lookup] copy]; \ 
  362    key1 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_1], @"key", [NSNumber numberWithBool:shift_1], @"shift", [NSNumber numberWithBool:mod1_1], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \ 
  363    [keyDef addObject:key1]; \ 
  366        key2 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_2], @"key", [NSNumber numberWithBool:shift_2], @"shift", [NSNumber numberWithBool:mod1_2], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \ 
  367        [keyDef addObject:key2]; \ 
  369    name = curr?:keyDef; \ 
  370    [kdic2 setObject:curr?:keyDef forKey:lookup]; \ 
  503#if OO_FOV_INFLIGHT_CONTROL_ENABLED 
  520    keyconfig2_settings = [[
NSDictionary alloc] initWithDictionary:kdic2 copyItems:YES];
 
 
  524- (NSArray*) processKeyCode:(NSArray*)key_def
 
  527    id              key = 
nil, value = 
nil;
 
  529    unsigned char   keychar;
 
  530    NSString        *keystring = 
nil;
 
  531    NSDictionary    *def = 
nil;
 
  534    for (i = 0; i < [
key_def count]; i++) 
 
  536        def = [
key_def objectAtIndex:i];
 
  537        if ([def 
count] == 0) 
continue; 
 
  538        value = [
def objectForKey:@"key"];
 
  539        iValue = [
value intValue];
 
  544        if ([def objectForKey:
@"shift"]) [
defNew setObject:[
def objectForKey:@"shift"] forKey:@"shift"]; 
else [
defNew setObject:[
NSNumber numberWithBool:NO] forKey:@"shift"];
 
  545        if ([def objectForKey:
@"mod1"]) [
defNew setObject:[
def objectForKey:@"mod1"] forKey:@"mod1"]; 
else [
defNew setObject:[
NSNumber numberWithBool:NO] forKey:@"mod1"];
 
  546        if ([def objectForKey:
@"mod2"]) [
defNew setObject:[
def objectForKey:@"mod2"] forKey:@"mod2"]; 
else [
defNew setObject:[
NSNumber numberWithBool:NO] forKey:@"mod2"];
 
  551        if ([value isKindOfClass:[NSString 
class]] && (iValue < 10))
 
  556            if ([keystring length] != 0)
 
  563                    [
defNew setObject:[
NSNumber numberWithUnsignedShort:iValue] forKey:@"key"];
 
  570            if ([keystring length] == 1 || (iValue == 0 && [keystring length] != 0))
 
  572                keychar = [
keystring characterAtIndex:0] & 0x00ff; 
 
  574            else if (iValue <= 0xFF) keychar = iValue;
 
  576                OOLogWARN(
@"testing", 
@"continue hit for key %@.", key);
 
  577                [
defNew setObject:[
def objectForKey:@"key"] forKey:@"key"];
 
  583            [
defNew setObject:[
NSNumber numberWithUnsignedShort:keychar] forKey:@"key"];
 
  589            [
defNew setObject:[
def objectForKey:@"key"] forKey:@"key"];
 
   524- (NSArray*) processKeyCode:(NSArray*)key_def {
…}
  
  600- (BOOL) checkNavKeyPress:(NSArray*)key_def
 
  604    for (i = 0; i < [
key_def count]; i++) 
 
  606        NSDictionary *def = [
key_def objectAtIndex:i];
 
  607        if ([gameView isDown:[[def objectForKey:
@"key"] intValue]]) 
return YES;
 
   600- (BOOL) checkNavKeyPress:(NSArray*)key_def {
…}
  
  613- (BOOL) checkKeyPress:(NSArray*)key_def
 
   613- (BOOL) checkKeyPress:(NSArray*)key_def {
…}
  
  619- (BOOL) checkKeyPress:(NSArray*)key_def fKey_only:(BOOL)fKey_only
 
   619- (BOOL) checkKeyPress:(NSArray*)key_def fKey_only:(BOOL)fKey_only {
…}
  
  625- (BOOL) checkKeyPress:(NSArray*)key_def ignore_ctrl:(BOOL)ignore_ctrl
 
   625- (BOOL) checkKeyPress:(NSArray*)key_def ignore_ctrl:(BOOL)ignore_ctrl {
…}
  
  631- (BOOL) checkKeyPress:(NSArray*)key_def fKey_only:(BOOL)fKey_only ignore_ctrl:(BOOL)ignore_ctrl
 
  635    for (i = 0; i < [
key_def count]; i++) 
 
  637        NSDictionary *def = [
key_def objectAtIndex:i];
 
  638        int keycode = [[
def objectForKey:@"key"] intValue];
 
  645        if (fKey_only == YES && (keycode < gvFunctionKey1 || keycode > 
gvFunctionKey11)) 
continue;
 
  646        if ([gameView isDown:keycode] 
 
  647            && ([[def objectForKey:
@"shift"] boolValue] == [gameView isShiftDown])
 
  648            && (ignore_ctrl || ([[def objectForKey:
@"mod1"] boolValue] == [gameView isCtrlDown]))
 
  649            && ([[def objectForKey:
@"mod2"] boolValue] == [gameView isOptDown])
 
   631- (BOOL) checkKeyPress:(NSArray*)key_def fKey_only:(BOOL)fKey_only ignore_ctrl:(BOOL)ignore_ctrl {
…}
  
  656- (
int) getFirstKeyCode:(NSArray*)key_def
 
  658    NSDictionary *def = [
key_def objectAtIndex:0];
 
  659    return [[
def objectForKey:@"key"] intValue];
 
   656- (
int) getFirstKeyCode:(NSArray*)key_def {
…}
  
  663- (void) pollControls:(
double)delta_t
 
  666    NSString *exceptionContext = 
@"setup";
 
  673            exceptionContext = 
@"pollApplicationControls";
 
  675            switch ([
self status])
 
  677                case STATUS_WITCHSPACE_COUNTDOWN:
 
  678                case STATUS_IN_FLIGHT:
 
  679                    exceptionContext = 
@"pollFlightControls";
 
  684                    exceptionContext = 
@"pollGameOverControls";
 
  688                case STATUS_AUTOPILOT_ENGAGED:
 
  689                    exceptionContext = 
@"pollAutopilotControls";
 
  694                    exceptionContext = 
@"pollDockedControls";
 
  698                case STATUS_START_GAME:
 
  699                    exceptionContext = 
@"pollDemoControls";
 
  709    @catch (NSException *exception)
 
  711        OOLog(
kOOLogException, 
@"***** Exception checking controls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
 
   663- (void) pollControls:(
double)delta_t {
…}
  
  730            if ([gui setNextRow: +1])
 
  736                if ([gui setFirstSelectableRow])  result = YES;
 
  750            if ([gui setNextRow: -1])
 
  756                if ([gui setLastSelectableRow])  result = YES;
 
  773            if ([gui setSelectedRow:click_row])
 
  784        if ([gui setSelectedRow:click_row])
 
 
  804- (void) targetNewSystem:(
int) direction whileTyping:(BOOL) whileTyping
 
  806    target_system_id = [[UNIVERSE gui] targetNextFoundSystem:direction];
 
  808    cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
 
  810    found_system_id = target_system_id;
 
   804- (void) targetNewSystem:(
int) direction whileTyping:(BOOL) whileTyping {
…}
  
  821    [[UNIVERSE gameView] resetTypedString];
 
  823    planetSearchString = 
nil;
 
 
  827- (void) targetNewSystem:(
int) direction
 
   827- (void) targetNewSystem:(
int) direction {
…}
  
  836    gui_screen = GUI_SCREEN_MAIN;
 
  840        [UNIVERSE removeDemoShips];
 
  843    if ([
self isMouseControlOn])  [[UNIVERSE gameView] resetMouse];
 
  844    [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
 
 
  858    if ([
self hasHyperspaceMotor]) 
 
  862            witchspaceCountdown = hyperspaceMotorSpinTime;
 
  866#ifndef OO_DUMP_PLANETINFO 
  869                witchspaceCountdown = 5;
 
  874                witchspaceCountdown = spin_time;
 
  877        [
self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
 
  880        [UNIVERSE clearPreviousMessage];
 
  881        int seconds = round(witchspaceCountdown);
 
  883        [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
 
  886        [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
 
 
  893    if ([
self hasHyperspaceMotor]) {
 
 
  901    if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN) {
 
  906    [UNIVERSE clearPreviousMessage];
 
 
  913@implementation PlayerEntity (OOControlsPrivate)
 
  917    if (!pollControls) 
return;
 
  919    NSString *exceptionContext = 
@"setup";
 
  925    BOOL onTextEntryScreen = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART) || (gui_screen == GUI_SCREEN_MISSION) || 
 
  926        (gui_screen == GUI_SCREEN_SAVE) || (gui_screen == GUI_SCREEN_OXZMANAGER || (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY));
 
  931    #if !OOLITE_MAC_OS_X || !OOLITE_64_BIT   
  932        if ([gameController inFullScreenMode])
 
  934            exceptionContext = 
@"command key controls";
 
  935            if ([gameView isCommandFDown])
 
  939                if (mouse_control_on)
 
  941                    [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
 
  942                    mouse_control_on = NO;
 
  946            if ([gameView isCommandQDown])
 
  954        if ([
self status] == STATUS_HANDLING_ERROR)
 
  956            exceptionContext = 
@"error handling mode";
 
  957            if ([gameView isDown:113]||[gameView isDown:81]||[gameView isDown:27])   
 
  963        if ([gameController isGamePaused])
 
  966            switch ([
self status])
 
  968                case STATUS_WITCHSPACE_COUNTDOWN:
 
  969                case STATUS_IN_FLIGHT:
 
  970                case STATUS_AUTOPILOT_ENGAGED:
 
  982                            [UNIVERSE clearPreviousMessage];    
 
  994        if (([
self checkKeyPress:n_key_snapshot] || joyButtonState[
BUTTON_SNAPSHOT]) &&
 
  998            exceptionContext = 
@"snapshot";
 
 1011        if (!onTextEntryScreen && [
self checkKeyPress:n_key_show_fps])   
 
 1013            exceptionContext = 
@"toggle FPS";
 
 1014            if (!
f_key_pressed)  [UNIVERSE setDisplayFPS:![UNIVERSE displayFPS]];
 
 1023        if ([
self checkKeyPress:n_key_bloom_toggle])
 
 1027                BOOL oldBloom = [UNIVERSE bloom];
 
 1028                [UNIVERSE setBloom:!oldBloom];
 
 1038        BOOL allowMouseControl;
 
 1040        allowMouseControl = YES;
 
 1043                    [[
NSUserDefaults standardUserDefaults] boolForKey:@"mouse-control-in-windowed-mode"];
 
 1046        if (allowMouseControl)
 
 1048            exceptionContext = 
@"mouse control";
 
 1049            if (!onTextEntryScreen && ([
self checkKeyPress:n_key_mouse_control_roll] || [
self checkKeyPress:n_key_mouse_control_yaw]))   
 
 1053                    mouse_control_on = !mouse_control_on;
 
 1054                    if (mouse_control_on)
 
 1056                        [UNIVERSE addMessage:DESC(@"mouse-on") forCount:3.0];
 
 1062                        if ([[NSUserDefaults standardUserDefaults] boolForKey:
@"grab-mouse-on-mouse-control"])
 
 1069                        keyboardPitchOverride = NO;
 
 1070                        keyboardYawOverride = !keyboardRollOverride;
 
 1074                        [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
 
 1093            if (mouse_control_on)
 
 1095                mouse_control_on = NO;
 
 1096                [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
 
 1109        if (([
self checkKeyPress:n_key_hud_toggle] || joyButtonState[
BUTTON_TOGGLEHUD]) && [gameController isGamePaused] && !onTextEntryScreen) 
 
 1111            exceptionContext = 
@"toggle HUD";
 
 1116                if (gui_screen == GUI_SCREEN_STATUS)
 
 1129    @catch (NSException *exception)
 
 1131        OOLog(
kOOLogException, 
@"***** Exception in pollApplicationControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
 
 
 1136- (void) pollFlightControls:(
double)delta_t
 
 1140    NSString            *exceptionContext = 
@"setup";
 
 1144        exceptionContext = 
@"joystick handling";
 
 1147        BOOL paused = [[UNIVERSE gameController] isGamePaused];
 
 1150        if (!paused && gui_screen == GUI_SCREEN_MISSION)
 
 1152            exceptionContext = 
@"mission screen";
 
 1155            NSPoint         virtualView = NSZeroPoint;
 
 1156            double          view_threshold = 0.5;
 
 1158            if ([stickHandler joystickCount])
 
 1162                    virtualView.y = 0.0;
 
 1164                    virtualView.x = 0.0;
 
 1165                if (fabs(virtualView.y) >= fabs(virtualView.x))
 
 1166                    virtualView.x = 0.0; 
 
 1168                    virtualView.y = 0.0;
 
 1171            if ([
self checkKeyPress:n_key_view_forward] || (virtualView.y < -view_threshold) || joyButtonState[
BUTTON_VIEWFORWARD])
 
 1173                view = VIEW_FORWARD;
 
 1175            if ([
self checkKeyPress:n_key_view_aft]|(virtualView.y > view_threshold)||joyButtonState[
BUTTON_VIEWAFT])
 
 1179            if ([
self checkKeyPress:n_key_view_port]||(virtualView.x < -view_threshold)||joyButtonState[
BUTTON_VIEWPORT])
 
 1183            if ([
self checkKeyPress:n_key_view_starboard]||(virtualView.x > view_threshold)||joyButtonState[
BUTTON_VIEWSTARBOARD])
 
 1185                view = VIEW_STARBOARD;
 
 1187            if (view == VIEW_NONE)
 
 1194                [[UNIVERSE gui] clearBackground];
 
 1196                if (_missionWithCallback)
 
 1206            exceptionContext = 
@"arrow keys";
 
 1218                exceptionContext = 
@"afterburner";
 
 1219                if ((joyButtonState[
BUTTON_FUELINJECT] || [
self checkKeyPress:n_key_inject_fuel]) &&
 
 1220                    [
self hasFuelInjection] &&
 
 1221                    !hyperspeed_engaged)
 
 1223                    if (fuel > 0 && !afterburner_engaged)
 
 1225                        [UNIVERSE addMessage:DESC(@"fuel-inject-on") forCount:1.5];
 
 1226                        afterburner_engaged = YES;
 
 1232                            [UNIVERSE addMessage:DESC(@"fuel-out") forCount:1.5];
 
 1234                    afterburner_engaged = (fuel > 0);
 
 1237                    afterburner_engaged = NO;
 
 1239                if ((!afterburner_engaged)&&(afterburnerSoundLooping))
 
 1242                exceptionContext = 
@"thrust";
 
 1245                float mouseWheelDeltaFactor = mouse_control_on ? fabs([gameView mouseWheelDelta]) : 1.0f;
 
 1246                if (mouseWheelDeltaFactor == 0.0f)  mouseWheelDeltaFactor = 1.0f;
 
 1248                if (([
self checkKeyPress:n_key_increase_speed] ||
 
 1250                         ((mouse_control_on)&&([gameView mouseWheelState] == 
gvMouseWheelUp) && ([
UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn])))
 
 1251                    && (flightSpeed < maxFlightSpeed) && (!afterburner_engaged))
 
 1253                    flightSpeed += speed_delta * delta_t * mouseWheelDeltaFactor;
 
 1256                if (([
self checkKeyPress:n_key_decrease_speed] ||
 
 1258                        ((mouse_control_on)&&([gameView mouseWheelState] == 
gvMouseWheelDown) && ([
UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn])))
 
 1259                    && (!afterburner_engaged))
 
 1261                    flightSpeed -= speed_delta * delta_t * mouseWheelDeltaFactor;   
 
 1263                    hyperspeed_engaged = NO;
 
 1267                if([stickHandler joystickCount] != 0 && functionForThrustAxis != 
nil)
 
 1269                    if (flightSpeed < maxFlightSpeed * reqSpeed)
 
 1271                        flightSpeed += speed_delta * delta_t;
 
 1273                    if (flightSpeed > maxFlightSpeed * reqSpeed)
 
 1275                        flightSpeed -= speed_delta * delta_t;
 
 1279                if (!afterburner_engaged && ![
self atHyperspeed] && !hyperspeed_engaged)
 
 1281                    flightSpeed = OOClamp_0_max_f(flightSpeed, maxFlightSpeed);
 
 1284                exceptionContext = 
@"hyperspeed";
 
 1290                        if (!hyperspeed_engaged)
 
 1293                            hyperspeed_engaged = !hyperspeed_locked;
 
 1294                            if (hyperspeed_locked)
 
 1297                                [UNIVERSE addMessage:DESC(@"jump-mass-locked") forCount:1.5];
 
 1302                            hyperspeed_engaged = NO;
 
 1312                exceptionContext = 
@"shoot";
 
 1314                if ((([
self checkNavKeyPress:n_key_fire_lasers])||((mouse_control_on)&&([gameView isDown:
gvMouseLeftButton]) && ([
UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn]))||joyButtonState[
BUTTON_FIRE])&&(shot_time > weapon_recharge_rate))
 
 1316                    if ([
self fireMainWeapon])
 
 1322                exceptionContext = 
@"weapons online toggle";
 
 1328                        NSString*   weaponsOnlineToggleMsg;
 
 1331                        weaponsOnlineToggleMsg = [
self weaponsOnline] ? 
DESC(
@"weapons-systems-online") : 
DESC(
@"weapons-systems-offline");
 
 1332                        if ([
self weaponsOnline])
 
 1340                        [UNIVERSE addMessage:weaponsOnlineToggleMsg forCount:2.0];
 
 1347                exceptionContext = 
@"missile fire";
 
 1360                exceptionContext = 
@"next missile";
 
 1373                exceptionContext = 
@"next target";
 
 1375                if ([
self checkKeyPress:n_key_next_target] || joyButtonState[
BUTTON_NEXTTARGET])
 
 1385                exceptionContext = 
@"previous target";
 
 1387                if ([
self checkKeyPress:n_key_previous_target] || joyButtonState[
BUTTON_PREVTARGET])
 
 1397                exceptionContext = 
@"ident R";
 
 1399                if ([
self checkKeyPress:n_key_ident_system] || joyButtonState[
BUTTON_ID])
 
 1410                exceptionContext = 
@"prime equipment";
 
 1427                            if (primedEquipment > c) primedEquipment = 0;
 
 1431                            if (primedEquipment > 0)  primedEquipment--;
 
 1432                            else  primedEquipment = c;
 
 1435                        NSString *eqKey = 
@"";
 
 1437                        if (primedEquipment == c)
 
 1442                                [UNIVERSE addMessage:DESC(@"equipment-primed-none") forCount:2.0];
 
 1444                            else [UNIVERSE addMessage:DESC(@"equipment-primed-none-available") forCount:2.0];
 
 1450                            eqKey = [[
eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0];
 
 1451                            [UNIVERSE addMessage:OOExpandKey(@"equipment-primed", equipmentName) forCount:2.0];
 
 1460                exceptionContext = 
@"activate equipment";
 
 1472                exceptionContext = 
@"mode equipment";
 
 1484                exceptionContext = 
@"fast equipment A";
 
 1485                if ([
self checkKeyPress:n_key_fastactivate_equipment_a] || joyButtonState[
BUTTON_CLOAK])
 
 1495                exceptionContext = 
@"fast equipment B";
 
 1496                if ([
self checkKeyPress:n_key_fastactivate_equipment_b] || joyButtonState[
BUTTON_ENERGYBOMB])
 
 1506                exceptionContext = 
@"custom equipment";
 
 1514                    if ([
self hasOneEquipmentItem:[item oo_stringForKey:
CUSTOMEQUIP_EQUIPKEY] includeWeapons:NO whileLoading:NO])
 
 1516                        NSArray *key_act = [
item oo_arrayForKey:CUSTOMEQUIP_KEYACTIVATE];
 
 1517                        NSArray *key_mod = [
item oo_arrayForKey:CUSTOMEQUIP_KEYMODE];
 
 1518                        NSDictionary *but_act = [
item oo_dictionaryForKey:CUSTOMEQUIP_BUTTONACTIVATE];
 
 1519                        NSDictionary *but_mod = [
item oo_dictionaryForKey:CUSTOMEQUIP_BUTTONMODE];
 
 1524                            if (![[customActivatePressed objectAtIndex:i] boolValue])
 
 1536                            if (![[customModePressed objectAtIndex:i] boolValue])
 
 1547                exceptionContext = 
@"incoming missile T";
 
 1559                exceptionContext = 
@"missile T";
 
 1561                if (([
self checkKeyPress:n_key_target_missile] || joyButtonState[
BUTTON_ARMMISSILE])&&(missile_entity[activeMissile]))
 
 1572                exceptionContext = 
@"missile U";
 
 1574                if ([
self checkKeyPress:n_key_untarget_missile] || joyButtonState[
BUTTON_UNARM])
 
 1582                        if (!ident_engaged && [
self weaponsOnline])
 
 1584                            [UNIVERSE addMessage:DESC(@"missile-safe") forCount:2.0];
 
 1589                            [UNIVERSE addMessage:DESC(@"ident-off") forCount:2.0];
 
 1598                exceptionContext = 
@"ECM";
 
 1600                if (([
self checkKeyPress:n_key_ecm] || joyButtonState[
BUTTON_ECM]) && [
self hasECM])
 
 1602                    if (!ecm_in_operation)
 
 1604                        if ([
self weaponsOnline] && [
self fireECM])
 
 1607                            [UNIVERSE addMessage:DESC(@"ecm-on") forCount:3.0];
 
 1613                exceptionContext = 
@"escape pod";
 
 1617                if (([
self checkKeyPress:n_key_launch_escapepod] || joyButtonState[
BUTTON_ESCAPE]) && [
self hasEscapePod])
 
 1619                    BOOL    goodToLaunch = [[
NSUserDefaults standardUserDefaults] boolForKey:@"escape-pod-activation-immediate"];
 
 1631                            if ([stickHandler joystickCount])
 
 1640                            if (timeNow < escapePodKeyResetTime)  goodToLaunch = YES;
 
 1649                exceptionContext = 
@"dump cargo";
 
 1651                if (([
self checkKeyPress:n_key_dump_cargo] || joyButtonState[
BUTTON_JETTISON]) && [cargo 
count] > 0)
 
 1656                exceptionContext = 
@"rotate cargo";
 
 1667                exceptionContext = 
@"autopilot C";
 
 1669                if ([
self checkKeyPress:n_key_autopilot] || joyButtonState[
BUTTON_DOCKCPU])   
 
 1680                exceptionContext = 
@"autopilot shift-C";
 
 1695                exceptionContext = 
@"docking clearance request";
 
 1711                exceptionContext = 
@"hyperspace";
 
 1713                if ( ([
self checkKeyPress:n_key_hyperspace] || joyButtonState[
BUTTON_HYPERDRIVE]) &&
 
 1714                      [
self hasHyperspaceMotor] )   
 
 1718                        if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN)
 
 1721                            if (galactic_witchjump)
 
 1723                                galactic_witchjump = NO;
 
 1724                                [UNIVERSE addMessage:DESC(@"witch-user-galactic-abort") forCount:3.0];
 
 1728                                [UNIVERSE addMessage:DESC(@"witch-user-abort") forCount:3.0];
 
 1731                        else if ([
self witchJumpChecklist:
false])
 
 1741                exceptionContext = 
@"galactic hyperspace";
 
 1743                if (([
self checkKeyPress:n_key_galactic_hyperspace] || joyButtonState[
BUTTON_GALACTICDRIVE]) &&
 
 1744                    ([
self hasEquipmentItemProviding:
@"EQ_GAL_DRIVE"]))
 
 1748                        if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN)
 
 1751                            if (galactic_witchjump)
 
 1753                                galactic_witchjump = NO;
 
 1754                                [UNIVERSE addMessage:DESC(@"witch-user-galactic-abort") forCount:3.0];
 
 1758                                [UNIVERSE addMessage:DESC(@"witch-user-abort") forCount:3.0];
 
 1763                            galactic_witchjump = YES;
 
 1766                            if(
EXPECT([
self hasHyperspaceMotor])) witchspaceCountdown = hyperspaceMotorSpinTime;
 
 1769                            [
self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
 
 1772                            [UNIVERSE addMessage:[
NSString stringWithFormat:DESC(@"witch-galactic-in-f-seconds"), witchspaceCountdown] forCount:1.0];
 
 1786#if OO_FOV_INFLIGHT_CONTROL_ENABLED 
 1790                if (([
self checkKeyPress:n_key_inc_field_of_view] || joyButtonState[BUTTON_INC_FIELD_OF_VIEW]) && (fieldOfView < 
MAX_FOV))
 
 1792                    fieldOfView *= pow(fov_delta, delta_t);
 
 1796                if (([
self checkKeyPress:n_key_dec_field_of_view] || joyButtonState[BUTTON_DEC_FIELD_OF_VIEW]) && (fieldOfView > 
MIN_FOV))
 
 1798                    fieldOfView /= pow(fov_delta, delta_t);
 
 1803                if ([stickHandler joystickCount] != 0 && functionForFovAxis != 
nil)
 
 1807                    if (fieldOfView < maxFieldOfView * reqFov)
 
 1809                        fieldOfView *= pow(fov_delta, delta_t);
 
 1812                    if (fieldOfView > maxFieldOfView * reqFov)
 
 1814                        fieldOfView /= pow(fov_delta, delta_t);
 
 1822            exceptionContext = 
@"dump target state";
 
 1823            if ([
self checkKeyPress:n_key_dump_target_state])
 
 1829                    if (target == 
nil)   target = 
self;
 
 1837            exceptionContext = 
@"pollGuiScreenControls";
 
 1844            exceptionContext = 
@"options menu";
 
 1845            if (([
self checkKeyPress:n_key_gui_screen_options]) && (gui_screen != GUI_SCREEN_OPTIONS) && ![gameView allowingStringInput])
 
 1851            #if (ALLOW_CUSTOM_VIEWS_WHILE_PAUSED) 
 1855            if (gui_screen == GUI_SCREEN_OPTIONS || gui_screen == GUI_SCREEN_GAMEOPTIONS || gui_screen == GUI_SCREEN_STICKMAPPER || 
 
 1856                gui_screen == GUI_SCREEN_STICKPROFILE || gui_screen == GUI_SCREEN_KEYBOARD || gui_screen == GUI_SCREEN_KEYBOARD_CONFIRMCLEAR ||
 
 1857                gui_screen == GUI_SCREEN_KEYBOARD_CONFIG || gui_screen == GUI_SCREEN_KEYBOARD_ENTRY || gui_screen == GUI_SCREEN_KEYBOARD_LAYOUT)
 
 1859                if ([
UNIVERSE pauseMessageVisible]) [[UNIVERSE messageGUI] leaveLastLine];
 
 1860                else [[UNIVERSE messageGUI] clear];
 
 1861                NSTimeInterval  time_this_frame = [
NSDate timeIntervalSinceReferenceDate];
 
 1874                script_time += time_delta;
 
 1878            exceptionContext = 
@"debug keys";
 
 1881            if ([
self checkKeyPress:n_key_dump_entity_list] && ![gameView allowingStringInput])
 
 1885                    [UNIVERSE debugDumpEntities];
 
 1887                    [UNIVERSE addMessage:@"Entity List dumped. Debugging OFF" forCount:3];
 
 1895            if ([
self checkKeyPress:n_key_debug_full] && ![gameView allowingStringInput])
 
 1898                [UNIVERSE addMessage:@"Full debug ON" forCount:3];
 
 1901            if ([
self checkKeyPress:n_key_debug_collision] && ![gameView allowingStringInput])
 
 1904                [UNIVERSE addMessage:@"Collision debug ON" forCount:3];
 
 1907            if ([
self checkKeyPress:n_key_debug_console_connect] && ![[
OODebugMonitor sharedDebugMonitor] usingPlugInController] && ![gameView allowingStringInput]) 
 
 1916                            [UNIVERSE addMessage:@"Connected to debug console." forCount:3];
 
 1921                        [UNIVERSE addMessage:@"Disconnected from debug console." forCount:3];
 
 1929            if ([
self checkKeyPress:n_key_debug_bounding_boxes] && ![gameView allowingStringInput])
 
 1932                [UNIVERSE addMessage:@"Bounding box debug ON" forCount:3];
 
 1935            if ([
self checkKeyPress:n_key_debug_shaders] && ![gameView allowingStringInput])
 
 1938                [UNIVERSE addMessage:@"Shader debug ON" forCount:3];
 
 1941            if (([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_arrow_right]) && gui_screen != GUI_SCREEN_GAMEOPTIONS && [
UNIVERSE displayFPS] && ![gameView allowingStringInput])
 
 1945                    float newTimeAccelerationFactor = [
self checkKeyPress:n_key_gui_arrow_left] ?
 
 1948                    [UNIVERSE setTimeAccelerationFactor:newTimeAccelerationFactor];
 
 1956            if ([
self checkKeyPress:n_key_debug_off] && ![gameView allowingStringInput])
 
 1959                [UNIVERSE addMessage:@"All debug flags OFF" forCount:3];
 
 1965        exceptionContext = 
@"pause";
 
 1967        if (([
self checkKeyPress:n_key_pausebutton] || joyButtonState[
BUTTON_PAUSE]) && gui_screen != GUI_SCREEN_LONG_RANGE_CHART && gui_screen != GUI_SCREEN_MISSION && ![gameView allowingStringInput])
 
 1979                        case GUI_SCREEN_STATUS:
 
 1982                        case GUI_SCREEN_LONG_RANGE_CHART:
 
 1985                        case GUI_SCREEN_SHORT_RANGE_CHART:
 
 1988                        case GUI_SCREEN_MANIFEST:
 
 1991                        case GUI_SCREEN_MARKET:
 
 1994                        case GUI_SCREEN_MARKETINFO:
 
 1997                        case GUI_SCREEN_SYSTEM_DATA:
 
 1999                            if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
 
 2007                    [UNIVERSE clearPreviousMessage];
 
 2008                    [UNIVERSE setViewDirection:saved_view_direction];
 
 2011                    if (
saved_gui_screen == GUI_SCREEN_SYSTEM_DATA) [UNIVERSE setMainLightPosition:_sysInfoLight];
 
 2012                    [[UNIVERSE gui] setForegroundTextureKey:@"overlay"];
 
 2013                    [[UNIVERSE gameController] setGamePaused:NO];
 
 2021                    [UNIVERSE pauseGame];   
 
 2031    @catch (NSException *exception)
 
 2033        OOLog(
kOOLogException, 
@"***** Exception in pollFlightControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
 
  1136- (void) pollFlightControls:(
double)delta_t {
…}
  
 2038- (void) pollGuiArrowKeyControls:(
double) delta_t
 
 2049    if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
 
 2053    else if (gui_screen == GUI_SCREEN_SAVE)
 
 2057    else if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry)
 
 2061    else if (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY)
 
 2068    else if (gui_screen == GUI_SCREEN_OXZMANAGER && [[
OOOXZManager sharedManager] isAcceptingTextInput])
 
 2078        if (afterburner_engaged && ![
self checkKeyPress:n_key_inject_fuel])
 
 2080            afterburner_engaged = NO;
 
 2087        case GUI_SCREEN_LONG_RANGE_CHART:
 
 2089            if ([
self status] != STATUS_WITCHSPACE_COUNTDOWN)
 
 2091                if ([[gameView typedString] length] > 0)
 
 2094                    NSPoint search_coords = [UNIVERSE findSystemCoordinatesWithPrefix:planetSearchString];
 
 2095                    if ((search_coords.x >= 0.0)&&(search_coords.y >= 0.0))
 
 2098                        if ([planetSearchString length] == 1) [[UNIVERSE gui] targetNextFoundSystem:0];
 
 2105                        found_system_id = -1;
 
 2113                        found_system_id = -1;
 
 2114                        [UNIVERSE findSystemCoordinatesWithPrefix:@""];
 
 2117                    planetSearchString = 
nil;
 
 2124        case GUI_SCREEN_SHORT_RANGE_CHART:
 
 2126            if ([
self checkKeyPress:n_key_chart_highlight])
 
 2131                    if (
mode != OOLRC_MODE_TECHLEVEL)
 
 2152                    show_info_flag = !show_info_flag;
 
 2161            if ([
self status] != STATUS_WITCHSPACE_COUNTDOWN)
 
 2163                if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"])
 
 2165                    if ([
self checkKeyPress:n_key_advanced_nav_array_next] || [
self checkKeyPress:n_key_advanced_nav_array_previous])
 
 2169                            if ([
self checkKeyPress:n_key_advanced_nav_array_previous])
 
 2209                    showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
 
 2224                        chart_focus_coordinates.x = OOClamp_0_max_f(centre.x + (maus.x * 
MAIN_GUI_PIXEL_WIDTH) / hscale, 256.0);
 
 2225                        chart_focus_coordinates.y = OOClamp_0_max_f(centre.y + (maus.y * 
MAIN_GUI_PIXEL_HEIGHT + vadjust) / vscale, 256.0);
 
 2226                        target_chart_focus = chart_focus_coordinates;
 
 2233                        target_chart_centre = chart_centre_coordinates;
 
 2236                    if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
 
 2246                        cursor_coordinates = chart_focus_coordinates;
 
 2255                if ([
self checkKeyPress:n_key_map_home])
 
 2257                    if ([gameView isOptDown])
 
 2260                        target_chart_focus = galaxy_coordinates;
 
 2265                        cursor_coordinates = galaxy_coordinates;
 
 2266                        target_chart_focus = cursor_coordinates;
 
 2267                        target_chart_centre = galaxy_coordinates;
 
 2268                        found_system_id = -1;
 
 2269                        [UNIVERSE findSystemCoordinatesWithPrefix:@""];
 
 2273                if ([
self checkKeyPress:n_key_map_end])
 
 2276                    target_chart_focus = cursor_coordinates;
 
 2278                if ([
self checkKeyPress:n_key_map_zoom_in] || [gameView mouseWheelState] == 
gvMouseWheelDown)
 
 2282                    saved_chart_zoom = target_chart_zoom;
 
 2284                if ([
self checkKeyPress:n_key_map_zoom_out] || [gameView mouseWheelState] == 
gvMouseWheelUp)
 
 2286                    if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
 
 2292                    if (target_chart_zoom < 1.0) target_chart_zoom = 1.0;
 
 2293                    saved_chart_zoom = target_chart_zoom;
 
 2295                    target_chart_focus = target_chart_centre;
 
 2301                if ([
self checkNavKeyPress:n_key_gui_arrow_left])
 
 2303                    if ((nextSystem || nextSystemOnRoute) && 
pressedArrow != 1)
 
 2308                            target_chart_focus = cursor_coordinates;
 
 2314                            target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
 
 2318                    else if (!nextSystem && !nextSystemOnRoute)
 
 2321                        cursor_coordinates.x -= cursor_speed*delta_t;
 
 2322                        if (cursor_coordinates.x < 0.0) cursor_coordinates.x = 0.0;
 
 2324                        target_chart_focus = cursor_coordinates;
 
 2330                if ([
self checkNavKeyPress:n_key_gui_arrow_right])
 
 2332                    if ((nextSystem || nextSystemOnRoute) && 
pressedArrow != 2)
 
 2337                            target_chart_focus = cursor_coordinates;
 
 2343                            target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
 
 2347                    else if (!nextSystem && !nextSystemOnRoute)
 
 2350                        cursor_coordinates.x += cursor_speed*delta_t;
 
 2351                        if (cursor_coordinates.x > 256.0) cursor_coordinates.x = 256.0;
 
 2353                        target_chart_focus = cursor_coordinates;
 
 2359                if ([
self checkNavKeyPress:n_key_gui_arrow_down])
 
 2366                    else if (!nextSystem)
 
 2369                        cursor_coordinates.y += cursor_speed*delta_t*2.0;
 
 2370                        if (cursor_coordinates.y > 256.0) cursor_coordinates.y = 256.0;
 
 2373                    target_chart_focus = cursor_coordinates;
 
 2378                if ([
self checkNavKeyPress:n_key_gui_arrow_up])
 
 2385                    else if (!nextSystem)
 
 2388                        cursor_coordinates.y -= cursor_speed*delta_t*2.0;
 
 2389                        if (cursor_coordinates.y < 0.0) cursor_coordinates.y = 0.0;
 
 2392                    target_chart_focus = cursor_coordinates;
 
 2398                    if (found_system_id == -1)
 
 2400                        target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
 
 2406                        NSPoint fpos = [[UNIVERSE systemManager] getCoordinatesForSystem:found_system_id inGalaxy:galaxy_number];
 
 2407                        if (fpos.x != cursor_coordinates.x && fpos.y != cursor_coordinates.y)
 
 2409                            target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
 
 2413                    cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
 
 2415                if (chart_focus_coordinates.x - target_chart_centre.x <= -
CHART_SCROLL_AT_X*chart_zoom)
 
 2417                    target_chart_centre.x = chart_focus_coordinates.x + 
CHART_SCROLL_AT_X*chart_zoom;
 
 2419                else if (chart_focus_coordinates.x - target_chart_centre.x >= 
CHART_SCROLL_AT_X*chart_zoom)
 
 2421                    target_chart_centre.x = chart_focus_coordinates.x - 
CHART_SCROLL_AT_X*chart_zoom;
 
 2423                if (chart_focus_coordinates.y - target_chart_centre.y <= -
CHART_SCROLL_AT_Y*chart_zoom)
 
 2425                    target_chart_centre.y = chart_focus_coordinates.y + 
CHART_SCROLL_AT_Y*chart_zoom;
 
 2427                else if (chart_focus_coordinates.y - target_chart_centre.y >= 
CHART_SCROLL_AT_Y*chart_zoom)
 
 2429                    target_chart_centre.y = chart_focus_coordinates.y - 
CHART_SCROLL_AT_Y*chart_zoom;
 
 2431                chart_centre_coordinates.x = (3.0*chart_centre_coordinates.x + target_chart_centre.x)/4.0;
 
 2432                chart_centre_coordinates.y = (3.0*chart_centre_coordinates.y + target_chart_centre.y)/4.0;
 
 2433                chart_zoom = (3.0*chart_zoom + target_chart_zoom)/4.0;
 
 2434                chart_focus_coordinates.x = (3.0*chart_focus_coordinates.x + target_chart_focus.x)/4.0;
 
 2435                chart_focus_coordinates.y = (3.0*chart_focus_coordinates.y + target_chart_focus.y)/4.0;
 
 2441        case GUI_SCREEN_SYSTEM_DATA:
 
 2442            if ([
self checkKeyPress:n_key_system_next_system])
 
 2454            if ([
self checkKeyPress:n_key_system_previous_system])
 
 2466            if ([
self checkKeyPress:n_key_system_home])
 
 2478            if ([
self checkKeyPress:n_key_system_end])
 
 2492#if OO_USE_CUSTOM_LOAD_SAVE 
 2494        case GUI_SCREEN_LOAD:
 
 2508        case GUI_SCREEN_SAVE:
 
 2513            if (gui_screen == GUI_SCREEN_SAVE)
 
 2517            else pollControls = YES;
 
 2520        case GUI_SCREEN_SAVE_OVERWRITE:
 
 2525        case GUI_SCREEN_STICKMAPPER:
 
 2529        case GUI_SCREEN_STICKPROFILE:
 
 2533        case GUI_SCREEN_GAMEOPTIONS:
 
 2537        case GUI_SCREEN_KEYBOARD:
 
 2545        case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
 
 2549        case GUI_SCREEN_KEYBOARD_CONFIG:
 
 2553        case GUI_SCREEN_KEYBOARD_ENTRY:
 
 2557        case GUI_SCREEN_KEYBOARD_LAYOUT:
 
 2561        case GUI_SCREEN_SHIPLIBRARY:
 
 2562            if ([gameView isDown:
' '])  
 
 2567            if ([
self checkKeyPress:n_key_gui_arrow_up]) 
 
 2570                    [UNIVERSE selectIntro2Previous];
 
 2572            if ([
self checkKeyPress:n_key_gui_arrow_down]) 
 
 2575                    [UNIVERSE selectIntro2Next];
 
 2579            if ([
self checkKeyPress:n_key_gui_arrow_left]) 
 
 2582                    [UNIVERSE selectIntro2PreviousCategory];
 
 2584            if ([
self checkKeyPress:n_key_gui_arrow_right]) 
 
 2587                    [UNIVERSE selectIntro2NextCategory];
 
 2592        case GUI_SCREEN_OPTIONS:
 
 2606                    @catch (NSException *exception)
 
 2608                        OOLog(
kOOLogException, 
@"\n\n***** Handling exception: %@ : %@ *****\n\n",[exception name], [exception reason]);
 
 2609                        if ([[exception name] isEqual:
@"GameNotSavedException"])    
 
 2612                            if ([controller inFullScreenMode])
 
 2631                    if (![
self loadPlayer])
 
 2642                    [UNIVERSE setUseAddOns:SCENARIO_OXP_DEFINITION_ALL fromSaveGame:NO forceReinit:YES]; 
 
 2657            if ((guiSelectedRow == 
GUI_ROW(,QUIT)) && selectKeyPress)
 
 2659                [[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on options screen"];
 
 2663            if ((guiSelectedRow == 
GUI_ROW(,GAMEOPTIONS)) && selectKeyPress)
 
 2671        case GUI_SCREEN_EQUIP_SHIP:
 
 2672            if ([
self handleGUIUpDownArrowKeys])
 
 2682                if (weaponType != 
nil)
 
 2686                    if ([[weaponType identifier] isEqualToString:
@"EQ_WEAPON_NONE"])  itemText = 
DESC(
@"no-weapon-enter-to-install");
 
 2690                        if (sameAs)  itemText = [
NSString stringWithFormat:DESC(@"weapon-installed-@"), weaponName];
 
 2691                        else  itemText = [
NSString stringWithFormat:DESC(@"weapon-@-enter-to-replace"), weaponName];
 
 2700            if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 2713            if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 2747        case GUI_SCREEN_INTERFACES:
 
 2748            if ([
self handleGUIUpDownArrowKeys])
 
 2752            if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 2765            if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 2799        case GUI_SCREEN_MARKETINFO:
 
 2803        case GUI_SCREEN_MARKET:
 
 2806            if ([
self checkKeyPress:n_key_market_filter_cycle] || [
self checkKeyPress:n_key_market_sorter_cycle])
 
 2811                    if ([
self checkKeyPress:n_key_market_filter_cycle])
 
 2844        case GUI_SCREEN_REPORT:
 
 2845            if ([gameView isDown:32])   
 
 2868        case GUI_SCREEN_STATUS:
 
 2870            if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 2885            if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 2924        case GUI_SCREEN_MANIFEST:
 
 2926            if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 2941            if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 2944                if ([[
self hud] isHidden] || [[
self hud] allowBigGui])
 
 2950                    if ([[gui keyForRow:nextRow] isEqual:
GUI_KEY_OK])
 
 2984        case GUI_SCREEN_SHIPYARD:
 
 2985            if ([
self handleGUIUpDownArrowKeys])
 
 2990            if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 3003            if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 3018            if ([
self checkKeyPress:n_key_gui_select]) 
 
 3025                    if (![key hasPrefix:
@"More:"])
 
 3030                    if ([
self buySelectedShip])
 
 3032                        if (![key hasPrefix:
@"More:"]) 
 
 3034                            [UNIVERSE removeDemoShips];
 
 3077        NSInteger kc = [
keys count];
 
 3079        NSDictionary *keydefs = 
nil;
 
 3080        NSString *key = 
nil;
 
 3082            definition = [
keys objectAtIndex:kc];
 
 3084            foreach (key, [keydefs allKeys])
 
 3086                if ([
self checkKeyPress:[keydefs objectForKey:key]]) 
 
 3093                            [[UNIVERSE gameView] clearKeys];
 
 3098                            OOLog(
@"interface.missingCallback", 
@"Unable to find callback definition for %@ using key %@", [definition name], key);
 
 3110    if (flightRoll > 0.0)
 
 3113        else    flightRoll = 0.0;
 
 3115    if (flightRoll < 0.0)
 
 3118        else    flightRoll = 0.0;
 
 3120    if (flightPitch > 0.0)
 
 3123        else    flightPitch = 0.0;
 
 3125    if (flightPitch < 0.0)
 
 3128        else    flightPitch = 0.0;
 
 3130    if (flightYaw > 0.0) 
 
 3133        else    flightYaw = 0.0; 
 
 3135    if (flightYaw < 0.0) 
 
 3138        else    flightYaw = 0.0; 
 
  2038- (void) pollGuiArrowKeyControls:(
double) delta_t {
…}
  
 3148    if (gui_screen == GUI_SCREEN_MARKET)
 
 3151        DESTROY(marketSelectedCommodity);
 
 3156        if (page_up || page_down) 
 
 3162                if ([goods 
count] > 0)
 
 3164                    NSInteger goodsIndex = [
goods indexOfObject:marketSelectedCommodity];
 
 3165                    NSInteger offset1 = 0;
 
 3166                    NSInteger offset2 = 0;
 
 3173                        if (goodsIndex - 16 <= 0) 
 
 3178                        if (offset1 == 1 && offset2 == 0 && goodsIndex < (NSInteger)[goods 
count] - 1 && goodsIndex - 15 > 0) offset2 = 1;
 
 3179                        goodsIndex -= (16 - (offset1 + offset2));
 
 3180                        if (goodsIndex < 0) goodsIndex = 0;
 
 3181                        if ([goods 
count] <= 17) goodsIndex = 0;
 
 3187                        if (offset1 == 0 && offset2 == 1 && goodsIndex > 1) offset1 = 1;
 
 3188                        if (offset2 == 1 && goodsIndex + 15 == (NSInteger)[goods 
count] - 1) offset2 = 0;
 
 3189                        goodsIndex += (16 - (offset1 + offset2));
 
 3190                        if (goodsIndex > ((NSInteger)[goods 
count] - 1) || [goods 
count] <= 17) goodsIndex = (NSInteger)[goods 
count] - 1;
 
 3192                    DESTROY(marketSelectedCommodity);
 
 3193                    marketSelectedCommodity = [[
goods oo_stringAtIndex:goodsIndex] retain];
 
 3208        BOOL            arrow_down = [
self checkKeyPress:n_key_gui_arrow_down]; 
 
 3209        if (arrow_up || arrow_down)
 
 3215                if ([goods 
count] > 0)
 
 3217                    NSInteger goodsIndex = [
goods indexOfObject:marketSelectedCommodity];
 
 3228                        goodsIndex = [
goods count]-1;
 
 3230                    else if (goodsIndex >= (NSInteger)[goods 
count])
 
 3234                    DESTROY(marketSelectedCommodity);
 
 3235                    marketSelectedCommodity = [[
goods oo_stringAtIndex:goodsIndex] retain];
 
 3250    if (([
self checkNavKeyPress:n_key_gui_arrow_right])||([
self checkNavKeyPress:n_key_gui_arrow_left])||([
self checkKeyPress:n_key_gui_select]||[gameView isDown:
gvMouseDoubleClick]))
 
 3252        if ([
self checkNavKeyPress:n_key_gui_arrow_right])   
 
 3256                if (isdocked && [
self tryBuyingCommodity:marketSelectedCommodity all:[gameView isShiftDown]])
 
 3259                    if (gui_screen == GUI_SCREEN_MARKET)
 
 3270                    if ([[gui selectedRowKey] isEqualToString:
@">>>"])
 
 3275                    else if ([[gui selectedRowKey] isEqualToString:
@"<<<"])
 
 3288        if ([
self checkNavKeyPress:n_key_gui_arrow_left])   
 
 3292                if (isdocked && [
self trySellingCommodity:marketSelectedCommodity all:[gameView isShiftDown]])
 
 3295                    if (gui_screen == GUI_SCREEN_MARKET)
 
 3306                    if ([[gui selectedRowKey] isEqualToString:
@">>>"])
 
 3311                    else if ([[gui selectedRowKey] isEqualToString:
@"<<<"])
 
 3325        if ((gui_screen == GUI_SCREEN_MARKET && [gameView isDown:
gvMouseDoubleClick]) || [
self checkKeyPress:n_key_gui_select])   
 
 3336                if ([item isEqualToString:
@">>>"])
 
 3341                else if ([item isEqualToString:
@"<<<"])
 
 3346                else if (isdocked && [gameView isShiftDown] && [
self tryBuyingCommodity:item all:YES])  
 
 3349                    if (gui_screen == GUI_SCREEN_MARKET)
 
 3358                else if (isdocked && (yours > 0) && [
self trySellingCommodity:item all:YES])    
 
 3361                    if (gui_screen == GUI_SCREEN_MARKET)
 
 3370                else if (isdocked && [
self tryBuyingCommodity:item all:YES])            
 
 3373                    if (gui_screen == GUI_SCREEN_MARKET)
 
 
 3411    if ((guiSelectedRow == 
GUI_ROW(GAME,STICKMAPPER)) && selectKeyPress)
 
 3417    if ((guiSelectedRow == 
GUI_ROW(GAME,KEYMAPPER)) && selectKeyPress)
 
 3426    if ([gameView hdrOutput])
 
 3428        if ((guiSelectedRow == 
GUI_ROW(GAME,HDRMAXBRIGHTNESS))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3432                int         direction = ([
self checkKeyPress:n_key_gui_arrow_right]) ? 1 : -1;
 
 3433                NSArray     *brightnesses = [[UNIVERSE descriptions] oo_arrayForKey: @"hdr_maxBrightness_array"];
 
 3436                if (brightnessIdx == NSNotFound)
 
 3438                    OOLogWARN(
@"hdr.maxBrightness.notFound", 
@"%@", 
@"couldn't find current max brightness setting, switching to lowest.");
 
 3442                brightnessIdx += direction;
 
 3444                if (brightnessIdx < 0)
 
 3445                    brightnessIdx = 
count - 1;
 
 3446                if (brightnessIdx >= 
count)
 
 3449                int brightnessValue = [
brightnesses oo_intAtIndex:brightnessIdx];
 
 3456                [
gameView setHDRMaxBrightness:(float)brightnessValue];
 
 3457                NSString *maxBrightnessString = 
OOExpandKey(
@"gameoptions-hdr-maxbrightness", brightnessValue);
 
 3470#if OO_RESOLUTION_OPTION 
 3472        guiSelectedRow == 
GUI_ROW(GAME,DISPLAY) &&
 
 3473        ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_arrow_left]))
 
 3476        int             direction = ([
self checkKeyPress:n_key_gui_arrow_right]) ? 1 : -1;
 
 3480        if (displayModeIndex == (NSInteger)NSNotFound)
 
 3482            OOLogWARN(
@"graphics.mode.notFound", 
@"%@", 
@"couldn't find current fullscreen setting, switching to default.");
 
 3483            displayModeIndex = 0;
 
 3486        displayModeIndex = displayModeIndex + direction;
 
 3488        if (displayModeIndex < 0)
 
 3489            displayModeIndex = 
count - 1;
 
 3490        if (displayModeIndex >= 
count)
 
 3491            displayModeIndex = 0;
 
 3493        NSDictionary    *
mode = [
modes objectAtIndex:displayModeIndex];
 
 3494        int modeWidth = [mode oo_intForKey:kOODisplayWidth];
 
 3495        int modeHeight = [mode oo_intForKey:kOODisplayHeight];
 
 3496        int modeRefresh = [mode oo_intForKey:kOODisplayRefreshRate];
 
 3512    if (
switching_resolution && ![
self checkKeyPress:n_key_gui_arrow_right] && ![
self checkKeyPress:n_key_gui_arrow_left] && !selectKeyPress)
 
 3518#if OOLITE_SPEECH_SYNTH 
 3520    if ((guiSelectedRow == 
GUI_ROW(GAME,SPEECH))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3538                NSString *message = 
nil;
 
 3542                    message = 
DESC(
@"gameoptions-spoken-messages-no");
 
 3545                    message = 
DESC(
@"gameoptions-spoken-messages-comms");
 
 3548                    message = 
DESC(
@"gameoptions-spoken-messages-yes");
 
 3555                    [UNIVERSE stopSpeaking];
 
 3556                    [UNIVERSE startSpeakingString:message];
 
 3566    if (guiSelectedRow == 
GUI_ROW(GAME,SPEECH_LANGUAGE))
 
 3568        if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_arrow_left])
 
 3573                if ([
self checkKeyPress:n_key_gui_arrow_right])
 
 3574                    voice_no = [UNIVERSE nextVoice: voice_no];
 
 3576                    voice_no = [UNIVERSE prevVoice: voice_no];
 
 3577                [UNIVERSE setVoice: voice_no withGenderM:voice_gender_m];
 
 3578                NSString *voiceName = [UNIVERSE voiceName:voice_no];
 
 3579                NSString *message = 
OOExpandKey(
@"gameoptions-voice-name", voiceName);
 
 3583                    [UNIVERSE stopSpeaking];
 
 3584                    [UNIVERSE startSpeakingString:[UNIVERSE voiceName: voice_no]];
 
 3588            speechVoiceSelectKeyPressed = YES;
 
 3591            speechVoiceSelectKeyPressed = NO;
 
 3594    if (guiSelectedRow == 
GUI_ROW(GAME,SPEECH_GENDER))
 
 3596        if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_arrow_left])
 
 3598            if (!speechGenderSelectKeyPressed)
 
 3602                if (m != voice_gender_m)
 
 3605                    [UNIVERSE setVoice:voice_no withGenderM:voice_gender_m];
 
 3606                    NSString *message = [
NSString stringWithFormat:DESC(voice_gender_m ? @"gameoptions-voice-M" : @"gameoptions-voice-F")];
 
 3610                        [UNIVERSE stopSpeaking];
 
 3611                        [UNIVERSE startSpeakingString:[UNIVERSE voiceName: voice_no]];
 
 3615            speechGenderSelectKeyPressed = YES;
 
 3618            speechGenderSelectKeyPressed = NO;
 
 3623    if ((guiSelectedRow == 
GUI_ROW(GAME,MUSIC))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3629            int                 mode = initialMode;
 
 3631            if ([
self checkKeyPress:n_key_gui_arrow_right])  
mode++;
 
 3632            if ([
self checkKeyPress:n_key_gui_arrow_left])  
mode--;
 
 3636            if ((
int)[musicController 
mode] != initialMode)
 
 3640                NSString *message = 
OOExpandKey(
@"gameoptions-music-mode", musicMode);
 
 3648    if ((guiSelectedRow == 
GUI_ROW(GAME,AUTOSAVE))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3650        if ([
self checkKeyPress:n_key_gui_arrow_right] != [
UNIVERSE autoSave])
 
 3652        [UNIVERSE setAutoSave:[
self checkKeyPress:n_key_gui_arrow_right]];
 
 3656            [UNIVERSE setAutoSaveNow:YES];
 
 3657            [
gui setText:DESC(@"gameoptions-autosave-yes")    
forRow:GUI_ROW(GAME,AUTOSAVE)  
align:GUI_ALIGN_CENTER];
 
 3661            [UNIVERSE setAutoSaveNow:NO];
 
 3662            [
gui setText:DESC(@"gameoptions-autosave-no") 
forRow:GUI_ROW(GAME,AUTOSAVE)  
align:GUI_ALIGN_CENTER];
 
 3666    if ((guiSelectedRow == 
GUI_ROW(GAME,VOLUME))
 
 3667        &&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left]))
 
 3668        &&[
OOSound respondsToSelector:
@selector(masterVolume)])
 
 3672            BOOL rightKeyDown = [
self checkKeyPress:n_key_gui_arrow_right];
 
 3673            BOOL leftKeyDown = [
self checkKeyPress:n_key_gui_arrow_left];
 
 3675            int vol = (volume / 5.0 + 0.5);
 
 3676            if (rightKeyDown) vol++;
 
 3677            if (leftKeyDown) vol--;
 
 3682            espeak_SetParameter(espeakVOLUME, vol * 5, 0);
 
 3686                NSString* soundVolumeWordDesc = 
DESC(
@"gameoptions-sound-volume");
 
 3687                NSString* v1_string = 
@"|||||||||||||||||||||||||";
 
 3688                NSString* v0_string = 
@".........................";
 
 3689                v1_string = [
v1_string substringToIndex:vol];
 
 3690                v0_string = [
v0_string substringToIndex:20 - vol];
 
 3691                [
gui setText:[
NSString stringWithFormat:@"%@%@%@ ", soundVolumeWordDesc, v1_string, v0_string]
 
 3692                      forRow:GUI_ROW(GAME,VOLUME)
 
 3693                       align:GUI_ALIGN_CENTER];
 
 3696                [
gui setText:DESC(@"gameoptions-sound-volume-mute")   
forRow:GUI_ROW(GAME,VOLUME)  
align:GUI_ALIGN_CENTER];
 
 3705    if ((guiSelectedRow == 
GUI_ROW(GAME,GAMMA))
 
 3706        &&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3708        if (!gammaControlPressed)
 
 3710            BOOL rightKeyDown = [
self checkKeyPress:n_key_gui_arrow_right];
 
 3711            BOOL leftKeyDown = [
self checkKeyPress:n_key_gui_arrow_left];
 
 3713            gamma += (((rightKeyDown && (gamma < 4.0f)) ? 0.2f : 0.0f) - ((leftKeyDown && (gamma > 0.2f)) ? 0.2f : 0.0f));
 
 3714            if (gamma > 3.95f) gamma = 4.0f;
 
 3715            if (gamma < 0.25f) gamma = 0.2f;
 
 3717            int gamma5 = gamma * 5; 
 
 3718            NSString* gammaWordDesc = 
DESC(
@"gameoptions-gamma-value");
 
 3719            NSString* v1_string = 
@"|||||||||||||||||||||||||";
 
 3720            NSString* v0_string = 
@".........................";
 
 3721            v1_string = [
v1_string substringToIndex:gamma5];
 
 3722            v0_string = [
v0_string substringToIndex:20 - gamma5];
 
 3723            [
gui setText:[
NSString stringWithFormat:@"%@%@%@ (%.1f) ", gammaWordDesc, v1_string, v0_string, gamma]    
forRow:GUI_ROW(GAME,GAMMA)  
align:GUI_ALIGN_CENTER];
 
 3725        gammaControlPressed = YES;
 
 3728        gammaControlPressed = NO;
 
 3732    if ((guiSelectedRow == 
GUI_ROW(GAME,FOV))
 
 3733        &&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3737            BOOL rightKeyDown = [
self checkKeyPress:n_key_gui_arrow_right];
 
 3738            BOOL leftKeyDown = [
self checkKeyPress:n_key_gui_arrow_left];
 
 3742                        fovStep : 0.0f) - ((leftKeyDown && (fov > 
MIN_FOV_DEG)) ? fovStep : 0.0f));
 
 3748            NSString* fovWordDesc = 
DESC(
@"gameoptions-fov-value");
 
 3749            NSString* v1_string = 
@"|||||||||||||||||||||||||";
 
 3750            NSString* v0_string = 
@".........................";
 
 3751            v1_string = [
v1_string substringToIndex:fovTicks];
 
 3752            v0_string = [
v0_string substringToIndex:20 - fovTicks];
 
 3753            [
gui setText:[
NSString stringWithFormat:@"%@%@%@ (%d%c) ", fovWordDesc, v1_string, v0_string, (int)fov, 176 ] 
forRow:GUI_ROW(GAME,FOV)  
align:GUI_ALIGN_CENTER];
 
 3764    if ((guiSelectedRow == 
GUI_ROW(GAME,COLORBLINDMODE))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3768            int colorblindMode = [UNIVERSE colorblindMode];
 
 3769            if ([
self checkKeyPress:n_key_gui_arrow_right])
 
 3771                [UNIVERSE setCurrentPostFX:[UNIVERSE nextColorblindMode:colorblindMode]];
 
 3775                [UNIVERSE setCurrentPostFX:[UNIVERSE prevColorblindMode:colorblindMode]];
 
 3777            colorblindMode = [UNIVERSE colorblindMode]; 
 
 3778            NSString *colorblindModeDesc = [[[UNIVERSE descriptions] oo_arrayForKey: @"colorblind_mode"] oo_stringAtIndex:[UNIVERSE useShaders] ? colorblindMode : 0];
 
 3779            NSString *colorblindModeMsg = 
OOExpandKey(
@"gameoptions-colorblind-mode", colorblindModeDesc);
 
 3788    if (![gameView hdrOutput])
 
 3790        if ((guiSelectedRow == 
GUI_ROW(GAME,WIREFRAMEGRAPHICS))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3792            if ([
self checkKeyPress:n_key_gui_arrow_right] != [
UNIVERSE wireframeGraphics])
 
 3794            [UNIVERSE setWireframeGraphics:[
self checkKeyPress:n_key_gui_arrow_right]];
 
 3796                [
gui setText:DESC(@"gameoptions-wireframe-graphics-yes")  
forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS)  
align:GUI_ALIGN_CENTER];
 
 3798                [
gui setText:DESC(@"gameoptions-wireframe-graphics-no")  
forRow:GUI_ROW(GAME,WIREFRAMEGRAPHICS)  
align:GUI_ALIGN_CENTER];
 
 3804        if ((guiSelectedRow == 
GUI_ROW(GAME,HDRPAPERWHITE))
 
 3805        &&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3809                BOOL rightKeyDown = [
self checkKeyPress:n_key_gui_arrow_right];
 
 3810                BOOL leftKeyDown = [
self checkKeyPress:n_key_gui_arrow_left];
 
 3811                float paperWhite = [
gameView hdrPaperWhiteBrightness];
 
 3815                [
gameView setHDRPaperWhiteBrightness:paperWhite];
 
 3817                NSString* paperWhiteWordDesc = 
DESC(
@"gameoptions-hdr-paperwhite");
 
 3818                NSString* v1_string = 
@"|||||||||||||||||||||||||";
 
 3819                NSString* v0_string = 
@".........................";
 
 3820                v1_string = [
v1_string substringToIndex:paperWhiteNorm];
 
 3821                v0_string = [
v0_string substringToIndex:20 - paperWhiteNorm];
 
 3822                [
gui setText:[
NSString stringWithFormat:@"%@%@%@ (%d) ", paperWhiteWordDesc, v1_string, v0_string, (int)paperWhite]   
forRow:GUI_ROW(GAME,HDRPAPERWHITE)  
align:GUI_ALIGN_CENTER];
 
 3832    if ((guiSelectedRow == 
GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3834        if ([
self checkKeyPress:n_key_gui_arrow_right] != [
UNIVERSE doProcedurallyTexturedPlanets])
 
 3836            [UNIVERSE setDoProcedurallyTexturedPlanets:[
self checkKeyPress:n_key_gui_arrow_right]];
 
 3840                [UNIVERSE setUpPlanet];
 
 3843        if ([
UNIVERSE doProcedurallyTexturedPlanets])
 
 3844            [
gui setText:DESC(@"gameoptions-procedurally-textured-planets-yes")  
forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS)  
align:GUI_ALIGN_CENTER];
 
 3846            [
gui setText:DESC(@"gameoptions-procedurally-textured-planets-no")  
forRow:GUI_ROW(GAME,PROCEDURALLYTEXTUREDPLANETS)  
align:GUI_ALIGN_CENTER];
 
 3850    if (guiSelectedRow == 
GUI_ROW(GAME,SHADEREFFECTS) && ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_arrow_left]))
 
 3854            int direction = ([
self checkKeyPress:n_key_gui_arrow_right]) ? 1 : -1;
 
 3879            [UNIVERSE setDetailLevel:detailLevel];
 
 3880            detailLevel = [UNIVERSE detailLevel];
 
 3882            NSString *shaderEffectsOptionsString = 
OOExpand(
@"gameoptions-detaillevel-[detailLevel]", detailLevel);
 
 3883            [
gui setText:OOExpandKey(shaderEffectsOptionsString) 
forRow:GUI_ROW(GAME,SHADEREFFECTS) 
align:GUI_ALIGN_CENTER];
 
 3898    if ((guiSelectedRow == 
GUI_ROW(GAME,DISPLAYSTYLE)) && selectKeyPress)
 
 3906    if ((guiSelectedRow == 
GUI_ROW(GAME,DOCKINGCLEARANCE))&&(([
self checkKeyPress:n_key_gui_arrow_right])||([
self checkKeyPress:n_key_gui_arrow_left])))
 
 3908        if ([
self checkKeyPress:n_key_gui_arrow_right] != [
UNIVERSE dockingClearanceProtocolActive])
 
 3910        [UNIVERSE setDockingClearanceProtocolActive:[
self checkKeyPress:n_key_gui_arrow_right]];
 
 3911        if ([
UNIVERSE dockingClearanceProtocolActive])
 
 3912            [
gui setText:DESC(@"gameoptions-docking-clearance-yes")  
forRow:GUI_ROW(GAME,DOCKINGCLEARANCE)  
align:GUI_ALIGN_CENTER];
 
 3914            [
gui setText:DESC(@"gameoptions-docking-clearance-no")  
forRow:GUI_ROW(GAME,DOCKINGCLEARANCE)  
align:GUI_ALIGN_CENTER];
 
 3917    if ((guiSelectedRow == 
GUI_ROW(GAME,BACK)) && selectKeyPress)
 
 
 3935        if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 3939        if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 3943        int from_function = 0;
 
 3944        NSArray *keyComponents = [
key componentsSeparatedByString:@":"];
 
 3945        if ([keyComponents 
count] > 1)
 
 3948            if (from_function < 0)  from_function = 0;
 
 3953                [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART];
 
 3955            if (from_function == 0)
 
 3957                [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
 
 
 3974        if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 3978        if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 3982        int from_function = 0;
 
 3983        NSArray *keyComponents = [
key componentsSeparatedByString:@":"];
 
 3984        if ([keyComponents 
count] > 1)
 
 3987            if (from_function < 0)  from_function = 0;
 
 3992                [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART];
 
 3994            if (from_function == 0)
 
 3996                [[UNIVERSE gui] setSelectedRow: GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
 
 
 4013        if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 4017        if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 4021        int from_function = 0;
 
 4022        NSArray *keyComponents = [
key componentsSeparatedByString:@":"];
 
 4023        if ([keyComponents 
count] > 1)
 
 4026            if (from_function < 0)  from_function = 0;
 
 4031                [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART];
 
 4033            if (from_function == 0)
 
 4035                [[UNIVERSE gui] setSelectedRow: GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
 
 
 4045    static Quaternion viewQuaternion;
 
 4046    static Vector viewOffset;
 
 4047    static Vector rotationCenter;
 
 4049    static Vector right;
 
 4050    static BOOL mouse_clicked = NO;
 
 4051    static NSPoint mouse_clicked_position;
 
 4052    static BOOL shift_down;
 
 4053    static BOOL caps_on = NO;
 
 4054    static NSTimeInterval last_time = 0.0;
 
 4060        if (!
customView_pressed && [_customViews 
count] != 0 && gui_screen != GUI_SCREEN_LONG_RANGE_CHART && ![gameView allowingStringInput])
 
 4062            if ([
UNIVERSE viewDirection] == VIEW_CUSTOM)    
 
 4065                _customViewIndex = (_customViewIndex + 1) % [_customViews 
count];
 
 4076    NSTimeInterval this_time = [
NSDate timeIntervalSinceReferenceDate];
 
 4077    if ([
UNIVERSE viewDirection] > VIEW_STARBOARD && [gameView isCapsLockOn])
 
 4083        if (!caps_on)  caps_on = YES;
 
 4086        if (([
self checkKeyPress:n_key_custom_view_zoom_out ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_zoom_in ignore_ctrl:YES]) || [gameView mouseWheelState] == 
gvMouseWheelDown)
 
 4090        if (([
self checkKeyPress:n_key_custom_view_zoom_in ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_zoom_out ignore_ctrl:YES]) || [gameView mouseWheelState] == 
gvMouseWheelUp)
 
 4094        if ([
self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES])
 
 4098        if ([
self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES])
 
 4102        if ([
self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES])
 
 4106        if ([
self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES])
 
 4110        if ([
self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES])
 
 4114        if ([
self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES])
 
 4118        if ([
self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES])
 
 4122        if ([
self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES])
 
 4126        if ([
self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES])
 
 4130        if ([
self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES])
 
 4136            if(!mouse_clicked || shift_down != [gameView isShiftDown])
 
 4138                mouse_clicked = YES;
 
 4139                viewQuaternion = [PLAYER customViewQuaternion];
 
 4140                viewOffset = [PLAYER customViewOffset];
 
 4141                rotationCenter = [PLAYER customViewRotationCenter];
 
 4142                up = [PLAYER customViewUpVector];
 
 4143                right = [PLAYER customViewRightVector];
 
 4148            Vector axis = vector_add(vector_multiply_scalar(up, mouse_position.x - mouse_clicked_position.x),
 
 4149                vector_multiply_scalar(right, mouse_position.y - mouse_clicked_position.y));
 
 4150            float angle = magnitude(axis);
 
 4151            axis = vector_normal(axis);
 
 4152            Quaternion newViewQuaternion = viewQuaternion;
 
 4153            if ([gameView isShiftDown])
 
 4156                [PLAYER setCustomViewQuaternion: newViewQuaternion];
 
 4157                [PLAYER setCustomViewRotationCenter: vector_subtract(viewOffset,
 
 4158                    vector_multiply_scalar([PLAYER customViewForwardVector],
 
 4159                        dot_product([PLAYER customViewForwardVector], viewOffset)))];
 
 4164                OOScalar m = magnitude(vector_subtract(viewOffset, rotationCenter));
 
 4165                [PLAYER setCustomViewQuaternion: newViewQuaternion];
 
 4166                Vector 
offset = vector_flip([
PLAYER customViewForwardVector]);
 
 4168                [PLAYER setCustomViewOffset:vector_add(offset, rotationCenter)];
 
 4185    last_time = this_time;
 
 
 4197    NSPoint         virtualView = NSZeroPoint;
 
 4198    double          view_threshold = 0.5;
 
 4200    if ([stickHandler joystickCount])
 
 4204            virtualView.y = 0.0;
 
 4206            virtualView.x = 0.0;
 
 4207        if (fabs(virtualView.y) >= fabs(virtualView.x))
 
 4208            virtualView.x = 0.0; 
 
 4210            virtualView.y = 0.0;
 
 4216    if (([
self checkKeyPress:n_key_view_forward]) || (virtualView.y < -view_threshold)||joyButtonState[
BUTTON_VIEWFORWARD] || ((([
self checkKeyPress:n_key_hyperspace] && gui_screen != GUI_SCREEN_LONG_RANGE_CHART) || joyButtonState[
BUTTON_HYPERDRIVE]) && [
UNIVERSE displayGUI]))
 
 4220    if (([
self checkKeyPress:n_key_view_aft])||(virtualView.y > view_threshold)||joyButtonState[
BUTTON_VIEWAFT])
 
 4224    if (([
self checkKeyPress:n_key_view_port])||(virtualView.x < -view_threshold)||joyButtonState[
BUTTON_VIEWPORT])
 
 4228    if (([
self checkKeyPress:n_key_view_starboard])||(virtualView.x > view_threshold)||joyButtonState[
BUTTON_VIEWSTARBOARD])
 
 4238        if (!scanner_zoom_rate)
 
 4240            if ([hud scannerZoom] < 5.0)
 
 4259        if ((!scanner_zoom_rate)&&([hud scannerZoom] > 1.0))
 
 4263    if (
EXPECT([[
self hud] isCompassActive])) 
 
 4277        if ([
self checkKeyPress:n_key_next_compass_mode] || joyButtonState[
BUTTON_COMPASSMODE]) 
 
 4295            if (![
self checkKeyPress:n_key_cycle_previous_mfd] || joyButtonState[
BUTTON_MFDCYCLEPREV]) 
 
 4314        if ([[
self hud] mfdCount] > 1)
 
 4338    if ([
self checkKeyPress:n_key_comms_log])
 
 4340        [UNIVERSE showCommsLog: 1.5];
 
 4341        [
hud refreshLastTransmitter];
 
 
 4346- (void) pollFlightArrowKeyControls:(
double)delta_t
 
 4351    NSPoint             virtualStick = NSZeroPoint;
 
 4352    double              reqYaw = 0.0;
 
 4358    if (mouse_control_on)
 
 4361        double sensitivity = 2.0;
 
 4362        virtualStick.x *= sensitivity;
 
 4363        virtualStick.y *= sensitivity;
 
 4364        reqYaw = virtualStick.x;
 
 4366    else if (numSticks > 0)
 
 4375        else if(virtualStick.x != 0)
 
 4378            keyboardRollOverride=NO;
 
 4386        else if(virtualStick.y != 0)
 
 4389            keyboardPitchOverride=NO;
 
 4398        else if(reqYaw != 0)
 
 4401            keyboardYawOverride=NO;
 
 4412    double  flightArrowKeyPrecisionFactor = [[
NSUserDefaults standardUserDefaults] oo_doubleForKey:@"flight-arrow-key-precision-factor" defaultValue:0.5];
 
 4413    if (flightArrowKeyPrecisionFactor < 0.05)  flightArrowKeyPrecisionFactor = 0.05;
 
 4414    if (flightArrowKeyPrecisionFactor > 1.0)  flightArrowKeyPrecisionFactor = 1.0; 
 
 4420        if ([
self checkNavKeyPress:n_key_roll_left] && [
self checkNavKeyPress:n_key_roll_right])
 
 4422            keyboardRollOverride = YES;
 
 4425        else if ([
self checkNavKeyPress:n_key_roll_left] && !capsLockCustomView)
 
 4427            keyboardRollOverride=YES;
 
 4428            if (flightRoll > 0.0)  flightRoll = 0.0;
 
 4429            [
self decrease_flight_roll:isCtrlDown ? flightArrowKeyPrecisionFactor*roll_dampner*roll_delta : delta_t*roll_delta];
 
 4432        else if ([
self checkNavKeyPress:n_key_roll_right] && !capsLockCustomView)
 
 4434            keyboardRollOverride=YES;
 
 4435            if (flightRoll < 0.0)  flightRoll = 0.0;
 
 4436            [
self increase_flight_roll:isCtrlDown ? flightArrowKeyPrecisionFactor*roll_dampner*roll_delta : delta_t*roll_delta];
 
 4440    if(((mouse_control_on && !
mouse_x_axis_map_to_yaw) || numSticks) && !keyboardRollOverride && !capsLockCustomView)
 
 4442        stick_roll = max_flight_roll * virtualStick.x;
 
 4443        if (flightRoll < stick_roll)
 
 4446            if (flightRoll > stick_roll)
 
 4447                flightRoll = stick_roll;
 
 4449        if (flightRoll > stick_roll)
 
 4452            if (flightRoll < stick_roll)
 
 4453                flightRoll = stick_roll;
 
 4455        rolling = (fabs(virtualStick.x) > 0.0);
 
 4459        if (flightRoll > 0.0)
 
 4462            else    flightRoll = 0.0;
 
 4464        if (flightRoll < 0.0)
 
 4467            else    flightRoll = 0.0;
 
 4473    if (!mouse_control_on)
 
 4475        if ([
self checkNavKeyPress:n_key_pitch_back] && [
self checkNavKeyPress:n_key_pitch_forward])
 
 4477            keyboardPitchOverride=YES;
 
 4480        else if ([
self checkNavKeyPress:n_key_pitch_back] && !capsLockCustomView)
 
 4482            keyboardPitchOverride=YES;
 
 4483            if (flightPitch < 0.0)  flightPitch = 0.0;
 
 4484            [
self increase_flight_pitch:isCtrlDown ? flightArrowKeyPrecisionFactor*pitch_dampner*pitch_delta : delta_t*pitch_delta];
 
 4487        else if ([
self checkNavKeyPress:n_key_pitch_forward] && !capsLockCustomView)
 
 4489            keyboardPitchOverride=YES;
 
 4490            if (flightPitch > 0.0)  flightPitch = 0.0;
 
 4491            [
self decrease_flight_pitch:isCtrlDown ? flightArrowKeyPrecisionFactor*pitch_dampner*pitch_delta : delta_t*pitch_delta];
 
 4495    if((mouse_control_on || (numSticks && !keyboardPitchOverride)) && !capsLockCustomView)
 
 4497        stick_pitch = max_flight_pitch * virtualStick.y;
 
 4498        if (flightPitch < stick_pitch)
 
 4501            if (flightPitch > stick_pitch)
 
 4502                flightPitch = stick_pitch;
 
 4504        if (flightPitch > stick_pitch)
 
 4507            if (flightPitch < stick_pitch)
 
 4508                flightPitch = stick_pitch;
 
 4510        pitching = (fabs(virtualStick.y) > 0.0);
 
 4514        if (flightPitch > 0.0)
 
 4517            else    flightPitch = 0.0;
 
 4519        if (flightPitch < 0.0)
 
 4522            else    flightPitch = 0.0;
 
 4530        if ([
self checkNavKeyPress:n_key_yaw_left] && [
self checkNavKeyPress:n_key_yaw_right])
 
 4532            keyboardYawOverride=YES;
 
 4535        else if ([
self checkNavKeyPress:n_key_yaw_left] && !capsLockCustomView)
 
 4537            keyboardYawOverride=YES;
 
 4538            if (flightYaw < 0.0)  flightYaw = 0.0;
 
 4539            [
self increase_flight_yaw:isCtrlDown ? flightArrowKeyPrecisionFactor*yaw_dampner*yaw_delta : delta_t*yaw_delta];
 
 4542        else if ([
self checkNavKeyPress:n_key_yaw_right] && !capsLockCustomView)
 
 4544            keyboardYawOverride=YES;
 
 4545            if (flightYaw > 0.0)  flightYaw = 0.0;
 
 4546            [
self decrease_flight_yaw:isCtrlDown ? flightArrowKeyPrecisionFactor*yaw_dampner*yaw_delta : delta_t*yaw_delta];
 
 4550    if(((mouse_control_on && 
mouse_x_axis_map_to_yaw) || numSticks) && !keyboardYawOverride && !capsLockCustomView)
 
 4554        stick_yaw = max_flight_yaw * (-reqYaw);
 
 4555        if (flightYaw < stick_yaw)
 
 4558            if (flightYaw > stick_yaw)
 
 4559                flightYaw = stick_yaw;
 
 4561        if (flightYaw > stick_yaw)
 
 4564            if (flightYaw < stick_yaw)
 
 4565                flightYaw = stick_yaw;
 
 4567        yawing = (fabs(reqYaw) > 0.0);
 
 4571        if (flightYaw > 0.0)
 
 4574            else    flightYaw = 0.0;
 
 4576        if (flightYaw < 0.0)
 
 4579            else    flightYaw = 0.0;
 
  4346- (void) pollFlightArrowKeyControls:(
double)delta_t {
…}
  
 4592- (void) pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias
 
 4594    if(!pollControls && fKeyAlias)  
 
 4599    BOOL            docked_okay = ([
self status] == STATUS_DOCKED);
 
 4602    if ([
self checkKeyPress:n_key_gui_screen_status fKey_only:!fKeyAlias])
 
 4607            if (gui_screen == GUI_SCREEN_STATUS)
 
 4622    if ([
self checkKeyPress:n_key_gui_chart_screens fKey_only:!fKeyAlias])
 
 4630            if (
EXPECT_NOT([
self status] == STATUS_WITCHSPACE_COUNTDOWN && gui_screen == GUI_SCREEN_SHORT_RANGE_CHART)) 
 
 4635            else if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART || (gui_screen == GUI_SCREEN_SYSTEM_DATA && showingLongRangeChart))
 
 4639                    saved_chart_zoom = target_chart_zoom;
 
 4649                    target_chart_zoom = saved_chart_zoom;
 
 4662    if ([
self checkKeyPress:n_key_gui_system_data fKey_only:!fKeyAlias])
 
 4664        if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
 
 4666            showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
 
 4672    if ([
self checkKeyPress:n_key_gui_market fKey_only:!fKeyAlias])
 
 4674        if (gui_screen != GUI_SCREEN_MARKET)
 
 4693        if (([
self checkKeyPress:n_key_gui_screen_options fKey_only:!fKeyAlias]) && (gui_screen != GUI_SCREEN_OPTIONS))
 
 4699        if ([
self checkKeyPress:n_key_gui_screen_equipship fKey_only:!fKeyAlias])
 
 4706                if ((gui_screen == GUI_SCREEN_EQUIP_SHIP) && [[
self dockedStation] hasShipyard])
 
 4733        if ([
self checkKeyPress:n_key_gui_screen_interfaces fKey_only:!fKeyAlias])
 
  4592- (void) pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias {
…}
  
 4751- (void) pollGameOverControls:(
double)delta_t
 
 4754    if ([gameView isDown:32])   
 
 4758            [UNIVERSE displayMessage:@"" forCount:1.0];
 
  4751- (void) pollGameOverControls:(
double)delta_t {
…}
  
 4772- (void) pollAutopilotControls:(
double)delta_t
 
 4775    if (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY || gui_screen == GUI_SCREEN_KEYBOARD_CONFIG || gui_screen == GUI_SCREEN_KEYBOARD_LAYOUT || gui_screen == GUI_SCREEN_KEYBOARD || gui_screen == GUI_SCREEN_KEYBOARD_CONFIRMCLEAR) 
return;
 
 4780    if (![[
UNIVERSE gameController] isGamePaused])
 
 4791        if ([
self checkKeyPress:n_key_autopilot] || joyButtonState[
BUTTON_DOCKCPU]
 
 4797                [UNIVERSE addMessage:DESC(@"autopilot-off") forCount:4.5];
 
 4824        if (([
self checkKeyPress:n_key_pausebutton] || joyButtonState[
BUTTON_PAUSE]) && gui_screen != GUI_SCREEN_SHORT_RANGE_CHART && gui_screen != GUI_SCREEN_MISSION && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY)
 
 4844        if ([
self checkKeyPress:n_key_pausebutton] || joyButtonState[
BUTTON_PAUSE])
 
  4772- (void) pollAutopilotControls:(
double)delta_t {
…}
  
 4862- (void) pollDockedControls:(
double)delta_t
 
 4867    NSString                *exceptionContext = 
@"setup";
 
 4872        exceptionContext = 
@"pause key";
 
 4873        if (([
self checkKeyPress:n_key_pausebutton] || joyButtonState[
BUTTON_PAUSE]) && (gui_screen != GUI_SCREEN_LONG_RANGE_CHART &&
 
 4874                gui_screen != GUI_SCREEN_REPORT &&
 
 4875                gui_screen != GUI_SCREEN_SAVE && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY) )
 
 4877            BOOL isMissionScreenWithTextEntry = gui_screen == GUI_SCREEN_MISSION && _missionTextEntry;
 
 4880                if ([gameController isGamePaused])
 
 4884                    if ([
UNIVERSE pauseMessageVisible])
 
 4886                        [UNIVERSE clearPreviousMessage];    
 
 4888                    [[UNIVERSE gui] setForegroundTextureKey:@"docked_overlay"];
 
 4893                    if (!isMissionScreenWithTextEntry)
 
 4896                        [[UNIVERSE messageGUI] clear];
 
 4898                        [UNIVERSE pauseGame];   
 
 4902            if (!isMissionScreenWithTextEntry)
 
 4912        if ([gameController isGamePaused]) 
return;
 
 4916            exceptionContext = 
@"undock";
 
 4917            if ([
self checkKeyPress:n_key_launch_ship])
 
 4919                if (
EXPECT((gui_screen != GUI_SCREEN_MISSION || _missionAllowInterrupt) && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY))
 
 4928        exceptionContext = 
@"GUI keys";
 
 4929        if (gui_screen == GUI_SCREEN_MISSION || gui_screen == GUI_SCREEN_KEYBOARD_ENTRY)
 
 4940    @catch (NSException *exception)
 
 4942        OOLog(
kOOLogException, 
@"***** Exception in pollDockedControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
 
  4862- (void) pollDockedControls:(
double)delta_t {
…}
  
 4950    [UNIVERSE setUpUniverseFromStation]; 
 
 
 4962- (void) pollDemoControls:(
double)delta_t
 
 4966    NSUInteger end_row = 21;
 
 4971        case GUI_SCREEN_INTRO1:
 
 4979                    if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 2+row_zero)
 
 4982                        [UNIVERSE removeDemoShips];
 
 4984                        if (![
self loadPlayer])
 
 4991                if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 1+row_zero)
 
 4996                else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 3+row_zero)
 
 5000                else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 4+row_zero)
 
 5004                else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 5+row_zero)
 
 5008                else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select]) && [gui selectedRow] == 6+row_zero)
 
 5010                    [[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on start screen"];
 
 5024        case GUI_SCREEN_GAMEOPTIONS:
 
 5028        case GUI_SCREEN_KEYBOARD:
 
 5036        case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
 
 5040        case GUI_SCREEN_KEYBOARD_CONFIG:
 
 5044        case GUI_SCREEN_KEYBOARD_ENTRY:
 
 5048        case GUI_SCREEN_KEYBOARD_LAYOUT:
 
 5052        case GUI_SCREEN_STICKMAPPER:
 
 5056        case GUI_SCREEN_STICKPROFILE:
 
 5060        case GUI_SCREEN_SHIPLIBRARY:
 
 5061            if ([gameView isDown:
' '])  
 
 5066            if ([
self checkKeyPress:n_key_gui_arrow_up])    
 
 5069                    [UNIVERSE selectIntro2Previous];
 
 5071            if ([
self checkKeyPress:n_key_gui_arrow_down])  
 
 5074                    [UNIVERSE selectIntro2Next];
 
 5078            if ([
self checkKeyPress:n_key_gui_arrow_left])  
 
 5081                    [UNIVERSE selectIntro2PreviousCategory];
 
 5083            if ([
self checkKeyPress:n_key_gui_arrow_right]) 
 
 5086                    [UNIVERSE selectIntro2NextCategory];
 
 5093        case GUI_SCREEN_NEWGAME:
 
 5094            if ([
self handleGUIUpDownArrowKeys])
 
 5101                if ([
self checkKeyPress:n_key_gui_page_up])
 
 5113                else if ([
self checkKeyPress:n_key_gui_page_down])
 
 5131                    if (![
self startScenario])
 
 5133                        [UNIVERSE removeDemoShips];
 
 5145        case GUI_SCREEN_OXZMANAGER:
 
 5148            if (
EXPECT(![oxzmanager isRestarting]))
 
 5150                if ([oxzmanager isAcceptingGUIInput])
 
 5152                    if ([oxzmanager isAcceptingTextInput])
 
 5161                    if ([
self handleGUIUpDownArrowKeys])
 
 5166                    if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up])
 
 5173                    else if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down])
 
 5186                            if ([oxzmanager isAcceptingTextInput])
 
 5202                if ([
self checkKeyPress:n_key_oxzmanager_setfilter] ||
 
 5203                    [
self checkKeyPress:n_key_oxzmanager_showinfo] ||
 
 5204                    [
self checkKeyPress:n_key_oxzmanager_extract])
 
 5209                        if ([
self checkKeyPress:n_key_oxzmanager_setfilter])
 
 5213                        else if ([
self checkKeyPress:n_key_oxzmanager_showinfo])
 
 5217                        else if ([
self checkKeyPress:n_key_oxzmanager_extract])
 
 5233        case GUI_SCREEN_MISSION:
 
 5234            if ([[
self hud] allowBigGui])
 
 5238            if (_missionTextEntry)
 
 5260            else if ([[gui keyForRow:end_row] isEqual:
@"spacebar"])
 
 5262                if ([gameView isDown:32])   
 
 5281                NSString *extraKey = 
@"";
 
 5282                if (extraMissionKeys)
 
 5284                    NSString *key = 
nil;
 
 5285                    foreach (key, [extraMissionKeys allKeys])
 
 5287                        if ([
self checkKeyPress:[extraMissionKeys oo_arrayForKey:key]]) {
 
 5290                                extraKey = [
key copy];
 
 5298                if ([
self checkKeyPress:n_key_gui_select] || [gameView isDown:
gvMouseDoubleClick] || [extraKey length] > 0)   
 
 5307                        if ([extraKey length] == 0) extraKey = 
@"enter";
 
 5327#if OO_USE_CUSTOM_LOAD_SAVE 
 5329        case GUI_SCREEN_LOAD:
 
  4962- (void) pollDemoControls:(
double)delta_t {
…}
  
 5352    if (_missionAllowInterrupt)
 
 5354        if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry) 
 
 5361        if (gui_screen != GUI_SCREEN_MISSION)
 
 5363            if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
 
 5365                [UNIVERSE removeDemoShips];
 
 
 5375    [UNIVERSE removeDemoShips];
 
 5376    [[UNIVERSE gui] clearBackground];
 
 5382    if (_missionWithCallback)
 
 5387    if ([
self status] != STATUS_DOCKED) 
 
 5394        if (gui_screen != GUI_SCREEN_MISSION) 
 
 
 5408    if ([
self status] != STATUS_DOCKED)
 
 5414    switch (_missionExitScreen)
 
 5416    case GUI_SCREEN_MANIFEST:
 
 5420    case GUI_SCREEN_EQUIP_SHIP:
 
 5424    case GUI_SCREEN_SHIPYARD:
 
 5425        if ([[
self dockedStation] hasShipyard])
 
 5429            [[UNIVERSE gui] setSelectedRow:GUI_ROW_SHIPYARD_START];
 
 5438    case GUI_SCREEN_LONG_RANGE_CHART:
 
 5441    case GUI_SCREEN_SHORT_RANGE_CHART:
 
 5444    case GUI_SCREEN_SYSTEM_DATA:
 
 5448    case GUI_SCREEN_MARKET:
 
 5452    case GUI_SCREEN_MARKETINFO:
 
 5456    case GUI_SCREEN_INTERFACES:
 
 5459    case GUI_SCREEN_STATUS:
 
 
 5472- (void) switchToThisView:(
OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing
 
  5472- (void) switchToThisView:(
OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing {
…}
  
 5478- (void) switchToThisView:(
OOViewID)viewDirection fromView:(
OOViewID)oldViewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing justNotify:(BOOL)justNotify
 
 5483        [UNIVERSE setViewDirection:viewDirection];
 
 5485    if (processWeaponFacing)
 
 5488        switch (viewDirection)
 
 5502            case VIEW_STARBOARD:
 
 5512            currentWeaponFacing = facing;
 
 5520    if ((oldViewDirection != viewDirection || viewDirection == VIEW_CUSTOM) && ![[
UNIVERSE gameController] isGamePaused])
 
  5478- (void) switchToThisView:(
OOViewID)viewDirection fromView:(
OOViewID)oldViewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing justNotify:(BOOL)justNotify {
…}
  
 5530- (void) handleAutopilotOn:(BOOL)fastDocking
 
 5532    NSString    *message = 
nil;
 
 5545    if (![target isStation])
 
 5552        for (i = 0; i < uni->
n_entities && nStations < 2; i++)
 
 5554            if (entities[i]->isStation && [entities[i] isKindOfClass:[
StationEntity class]] &&
 
 5558                target = entities[
i];
 
 5565        if ([
self withinStationAegis] && legalStatus <= 50)
 
 5567            target = [UNIVERSE station];
 
 5569        else if (nStations != 1)
 
 5579                message = 
OOExpandKey(
@"autopilot-multiple-targets");
 
 5591    if (![ts allowsAutoDocking])
 
 5594        message = 
OOExpandKey(
@"autopilot-station-does-not-allow-autodocking", stationName);
 
 5597    else if ((legalStatus > 50 && ts == [
UNIVERSE station]) || [ts isHostileTo:
self])
 
 5600        message = 
OOExpandKey((ts == [
UNIVERSE station]) ? 
@"autopilot-denied" : 
@"autopilot-target-docking-instructions-denied", stationName);
 
 5603    else if (fastDocking && [ts allowsFastDocking])
 
 5606        NSEnumerator    *subEnum = 
nil;
 
 5608        for (subEnum = [ts dockSubEntityEnumerator]; (sub = [
subEnum nextObject]); )
 
 5611            if([[sub canAcceptShipForDocking:
self] isEqualToString:
@"TOO_BIG_TO_DOCK"]) 
 
 5613                message = 
OOExpandKey((ts == [
UNIVERSE station]) ? 
@"autopilot-denied" : 
@"autopilot-target-docking-instructions-denied", stationName);
 
 5618        if (legalStatus > 0)
 
 5622            int government = 1 + [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT];    
 
 5623            if ([
UNIVERSE inInterstellarSpace])  government = 2;    
 
 5624            fine_chance /= government;
 
 5625            if (fine_chance < legalStatus)
 
 5633        [UNIVERSE forceWitchspaceEntries];
 
 5634        ship_clock_adjust += 1200.0;            
 
 5637        [UNIVERSE setViewDirection:VIEW_FORWARD];
 
 5649    if (message != 
nil) [UNIVERSE addMessage:message forCount:4.5];
 
  5530- (void) handleAutopilotOn:(BOOL)fastDocking {
…}
  
 5660    ident_engaged = YES;
 
 5661    if ([
self primaryTarget] == 
nil)
 
 5664        [UNIVERSE addMessage:OOExpandKey(@"ident-on") forCount:2.0];
 
 
 5676    if (![
self weaponsOnline])
 
 5690    if ([missile_entity[activeMissile] isMissile])
 
 5692        if ([[
self primaryTarget] isShip])
 
 5702            if ([
self primaryTarget] != 
nil)
 
 5708            [UNIVERSE addMessage:OOExpandKey(@"missile-armed", weaponName) forCount:2.0];
 
 5712    else if ([missile_entity[activeMissile] isMine])
 
 5715        [UNIVERSE addMessage:OOExpandKey(@"mine-armed", weaponName) forCount:2.0];
 
 
#define SCANNER_MAX_RANGE2
 
#define MINIMUM_GAME_TICK
 
#define MAIN_GUI_PIXEL_WIDTH
 
#define MAIN_GUI_PIXEL_HEIGHT
 
OOINLINE jsval OOJSValueFromViewID(JSContext *context, OOViewID value)
 
void OOInitDebugSupport(void)
 
OOINLINE JSContext * OOJSAcquireContext(void)
 
OOINLINE void OOJSRelinquishContext(JSContext *context)
 
#define STICK_AXISUNASSIGNED
 
@ BUTTON_DOCKINGCLEARANCE
 
@ BUTTON_TARGETINCOMINGMISSILE
 
@ BUTTON_ACTIVATEEQUIPMENT
 
@ BUTTON_WEAPONSONLINETOGGLE
 
@ BUTTON_COMPASSMODE_PREV
 
@ BUTTON_PRIMEEQUIPMENT_PREV
 
#define OOLogWARN(class, format,...)
 
#define OOLogERR(class, format,...)
 
NSString *const kOOLogException
 
#define OOLog(class, format,...)
 
NSString *const kOOLogParameterError
 
void OOLogSetDisplayMessagesInClass(NSString *inClass, BOOL inFlag)
 
BOOL OOMouseInteractionModeIsFlightMode(OOMouseInteractionMode mode)
 
void quaternion_rotate_about_axis(Quaternion *quat, Vector axis, OOScalar angle)
 
#define OOExpandKey(key,...)
 
#define OOExpand(string,...)
 
NSString * OOCommodityType
 
uint64_t OOCreditsQuantity
 
@ WEAPON_FACING_STARBOARD
 
#define MAX_ROWS_SHIPS_FOR_SALE
 
#define GUI_ROW_SHIPYARD_START
 
static BOOL speech_settings_pressed
 
static BOOL musicModeKeyPressed
 
static BOOL cycleMFD_pressed
 
static BOOL extra_gui_key_pressed
 
static BOOL selectPressed
 
static NSPoint centre_at_mouse_click
 
static BOOL shaderSelectKeyPressed
 
static BOOL prime_equipment_pressed
 
static BOOL pageUpDownKeyPressed
 
static BOOL ident_pressed
 
static BOOL switching_interface_screens
 
static BOOL chartInfoPressed
 
static BOOL dump_target_state_pressed
 
static BOOL next_target_pressed
 
static BOOL rotateCargo_pressed
 
static BOOL taking_snapshot
 
static BOOL switching_chart_screens
 
static BOOL upDownKeyPressed
 
static BOOL previous_target_pressed
 
static BOOL next_planet_info_pressed
 
static BOOL m_key_pressed
 
static NSTimeInterval time_last_frame
 
static OOWeaponFacing saved_weapon_facing
 
static BOOL mode_equipment_pressed
 
#define CUSTOM_VIEW_SPEED_REDUCTION_FACTOR
 
static BOOL fire_missile_pressed
 
static BOOL autopilot_pause
 
static BOOL safety_pressed
 
static BOOL target_incoming_missile_pressed
 
static BOOL switching_equipship_screens
 
static BOOL galhyperspace_pressed
 
static int saved_gui_screen
 
static BOOL target_info_pressed
 
static BOOL wait_for_key_up
 
static BOOL next_missile_pressed
 
static BOOL weaponsOnlineToggle_pressed
 
static BOOL home_info_pressed
 
static BOOL switching_status_screens
 
static BOOL f_key_pressed
 
static BOOL hyperspace_pressed
 
static BOOL volumeControlPressed
 
static BOOL fast_autopilot_key_pressed
 
static BOOL hdrPaperWhiteControlPressed
 
#define CUSTOM_VIEW_ZOOM_SPEED
 
static BOOL leftRightKeyPressed
 
static BOOL fastactivate_a_pressed
 
static BOOL fovControlPressed
 
static BOOL previous_planet_info_pressed
 
static BOOL switchMFD_pressed
 
static BOOL extra_key_pressed
 
static BOOL hide_hud_pressed
 
static int saved_view_direction
 
static BOOL mouse_left_down
 
static BOOL pause_pressed
 
#define LOAD_KEY_SETTING2(name, default_1, shift_1, mod1_1, default_2, shift_2, mod1_2)
 
static BOOL escapePodKey_pressed
 
static BOOL next_compass_mode_pressed
 
static BOOL activate_equipment_pressed
 
static BOOL disc_operation_in_progress
 
static BOOL oxz_manager_pressed
 
static BOOL pling_pressed
 
#define CUSTOM_VIEW_ROTATE_SPEED
 
static BOOL prev_compass_mode_pressed
 
static BOOL customView_pressed
 
static BOOL f9_key_pressed
 
static NSUInteger searchStringLength
 
static double saved_script_time
 
static BOOL colorblindModeControlPressed
 
static BOOL dump_entity_list_pressed
 
static BOOL toggling_music
 
static NSPoint mouse_click_position
 
static BOOL playing_music
 
static BOOL fastactivate_b_pressed
 
static BOOL target_missile_pressed
 
static BOOL cursor_moving
 
static BOOL mouse_x_axis_map_to_yaw
 
static BOOL autopilot_key_pressed
 
static BOOL docking_clearance_request_key_pressed
 
static BOOL switching_resolution
 
static double timeLastKeyPress
 
static BOOL hdrMaxBrightnessControlPressed
 
#define GUI_ROW_KC_FUNCSTART
 
#define GUI_ROW_FUNCSTART
 
#define CHART_SCREEN_VERTICAL_CENTRE
 
#define PORT_FACING_STRING
 
#define CHART_ZOOM_SHOW_LABELS
 
#define YAW_DAMPING_FACTOR
 
#define ROLL_DAMPING_FACTOR
 
#define MANIFEST_SCREEN_ROW_BACK
 
#define SCANNER_ZOOM_RATE_DOWN
 
#define FORWARD_FACING_STRING
 
#define AFT_FACING_STRING
 
#define KEY_REPEAT_INTERVAL
 
#define CHART_ZOOM_SPEED_FACTOR
 
#define MANIFEST_SCREEN_ROW_NEXT
 
#define GUI_ROW_INIT(GUI)
 
#define SCANNER_ZOOM_RATE_UP
 
#define GUI_ROW(GROUP, ITEM)
 
@ STATUS_EQUIPMENT_FIRST_ROW
 
@ GUI_ROW_SCENARIOS_START
 
@ STATUS_EQUIPMENT_MAX_ROWS
 
@ GUI_ROW_EQUIPMENT_START
 
@ STATUS_EQUIPMENT_BIGGUI_EXTRA_ROWS
 
@ GUI_ROW_INTERFACES_START
 
@ GUI_MAX_ROWS_INTERFACES
 
#define STARBOARD_FACING_STRING
 
#define CUSTOMEQUIP_EQUIPKEY
 
#define CHART_SCROLL_AT_Y
 
#define CHART_SCROLL_AT_X
 
@ MISSILE_STATUS_TARGET_LOCKED
 
#define KEYCONFIG_CUSTOMEQUIP
 
#define PITCH_DAMPING_FACTOR
 
#define MIN_HDR_MAXBRIGHTNESS
 
#define MIN_HDR_PAPERWHITE
 
#define MAX_HDR_MAXBRIGHTNESS
 
#define MAX_HDR_PAPERWHITE
 
#define INITIAL_SHOT_TIME
 
OOEquipmentType * OOWeaponType
 
#define DEFAULT_HYPERSPACE_SPIN_TIME
 
OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy(NSString *string) PURE_FUNC
 
#define SHIP_THRUST_FACTOR
 
#define ShipScriptEvent(context, ship, event,...)
 
#define TIME_ACCELERATION_FACTOR_MAX
 
#define TIME_ACCELERATION_FACTOR_MIN
 
void cancelWitchspaceCountdown()
 
void clearPlanetSearchString()
 
BOOL handleGUIUpDownArrowKeys()
 
void initKeyConfigSettings()
 
void beginWitchspaceCountdown()
 
void setGuiToMissionEndScreen()
 
void handleKeyboardLayoutKeys()
 
void handleGameOptionsScreenKeys()
 
void handleStickMapperScreenKeys()
 
void pollMissionInterruptControls()
 
void pollMarketScreenControls()
 
void handleKeyMapperScreenKeys()
 
void pollGuiScreenControls()
 
void handleButtonTargetMissile()
 
void handleUndockControl()
 
void handleMissionCallback()
 
void pollCustomViewControls()
 
void pollApplicationControls()
 
void setGuiToIntroFirstGo:(BOOL justCobra)
 
void setGamePaused:(BOOL value)
 
void exitAppWithContext:(NSString *context)
 
void exitFullScreenMode()
 
void setMouseInteractionModeForFlight()
 
NSUInteger indexOfCurrentDisplayMode()
 
void pauseFullScreenModeToPerform:onTarget:(SEL selector,[onTarget] id target)
 
BOOL setDisplayWidth:Height:Refresh:(unsigned int d_width,[Height] unsigned int d_height,[Refresh] unsigned int d_refresh)
 
BOOL setSelectedRow:(OOGUIRow row)
 
void setStatusPage:(NSInteger pageNum)
 
NSString * selectedRowText()
 
void setText:forRow:align:(NSString *str,[forRow] OOGUIRow row,[align] OOGUIAlignment alignment)
 
NSString * selectedRowKey()
 
NSString * keyForRow:(OOGUIRow row)
 
void setKey:forRow:(NSString *str,[forRow] OOGUIRow row)
 
void setHidden:(BOOL newValue)
 
void grabMouseInsideGameWindow:(BOOL value)
 
void clearKey:(int theKey)
 
void setFov:fromFraction:(float value,[fromFraction] BOOL fromFraction)
 
void setGammaValue:(float value)
 
NSMutableString * typedString
 
void setScreenSize:(int sizeIndex)
 
NSPoint virtualJoystickPosition
 
float fov:(BOOL inFraction)
 
void allowStringInput:(BOOL value)
 
void setStringInput:(enum StringInput value)
 
BOOL snapShot:(NSString *filename)
 
BOOL setDebugger:(id< OODebuggerInterface > debugger)
 
OODebugMonitor * sharedDebugMonitor()
 
OOEquipmentType * equipmentTypeWithIdentifier:(NSString *identifier)
 
void runCallback:(NSString *key)
 
NSDictionary * registerKeys()
 
NSDictionary * axisFunctions()
 
const BOOL * getAllButtonStates()
 
double getAxisState:(int function)
 
NSUInteger joystickCount()
 
void clearStickButtonState:(int stickButton)
 
void toggleDockingMusic()
 
OOMusicController * sharedController()
 
void setMode:(OOMusicMode mode)
 
void processOptionsNext()
 
void processTextInput:(NSString *input)
 
void processOptionsPrev()
 
OOOXZManager * sharedManager()
 
void refreshTextInput:(NSString *input)
 
void processShowInfoKey()
 
void setMasterVolume:(float fraction)
 
void setGuiToMissionEndScreen()
 
void setGuiToSystemDataScreen()
 
OOWeaponType currentWeapon()
 
void playAutopilotOutOfRange()
 
void cycleNextMultiFunctionDisplay:(NSUInteger index)
 
void pollGuiArrowKeyControls:(double delta_t)
 
void overwriteCommanderInputHandler()
 
void customViewPanRight:(OOScalar angle)
 
void playNextEquipmentSelected()
 
void setNextCompassMode()
 
void setGuiToLongRangeChartScreen()
 
void setGuiToScenarioScreen:(int page)
 
BOOL engageAutopilotToStation:(StationEntity *stationForDocking)
 
void setGuiToLoadSaveScreen()
 
void pollAutopilotControls:(double delta_t)
 
void cyclePreviousMultiFunctionDisplay:(NSUInteger index)
 
ShipEntity * launchEscapeCapsule()
 
void setGuiToChartScreenFrom:(OOGUIScreenID oldScreen)
 
void activateSelectedInterface()
 
void setGuiToMarketScreen()
 
void setGuiToGameOptionsScreen()
 
void customViewRotateDown:(OOScalar angle)
 
void playMenuPagePrevious()
 
void saveCommanderInputHandler()
 
BOOL checkKeyPress:(NSArray *key_def)
 
void setGuiToInterfacesScreen:(int skip)
 
void handleKeyboardLayoutKeys()
 
void playMenuNavigationDown()
 
void handleAutopilotOn:(BOOL fastDocking)
 
void handleGameOptionsScreenKeys()
 
void pollGuiScreenControlsWithFKeyAlias:(BOOL fKeyAlias)
 
void setPrevCompassMode()
 
void playGalacticHyperspace()
 
void pollFlightControls:(double delta_t)
 
NSString * screenModeStringForWidth:height:refreshRate:(unsigned inWidth,[height] unsigned inHeight,[refreshRate] float inRate)
 
void setGuiToStatusScreen()
 
void customViewPanUp:(OOScalar angle)
 
void customViewZoomOut:(OOScalar rate)
 
void activatePrimableEquipment:withMode:(NSUInteger index,[withMode] OOPrimedEquipmentMode mode)
 
BOOL loadPlayerFromFile:asNew:(NSString *fileToOpen,[asNew] BOOL asNew)
 
void handleStickMapperScreenKeys()
 
void setGuiToMarketInfoScreen()
 
OOLongRangeChartMode longRangeChartMode
 
void playMenuNavigationNot()
 
void setGuiToShipyardScreen:(NSUInteger skip)
 
BOOL trySellingCommodity:all:(OOCommodityType type,[all] BOOL all)
 
StationEntity * dockedStation()
 
void setShowDemoShips:(BOOL value)
 
void cancelWitchspaceCountdown()
 
void customViewRotateUp:(OOScalar angle)
 
void endMissionScreenAndNoteOpportunity()
 
void setWeaponsOnline:(BOOL newValue)
 
void targetNewSystem:(int direction)
 
void stickMapperInputHandler:view:(GuiDisplayGen *gui,[view] MyOpenGLView *gameView)
 
void setDockingClearanceStatus:(OODockingClearanceStatus newValue)
 
void targetNearestIncomingMissile()
 
void stopAfterburnerSound()
 
void beginWitchspaceCountdown:(int spin_time)
 
NSUInteger eqScriptIndexForKey:(NSString *eq_key)
 
NSArray * applyMarketFilter:onMarket:(NSArray *goods,[onMarket] OOCommodityMarket *market)
 
void pollMissionInterruptControls()
 
void clearPlanetSearchString()
 
OOCreditsQuantity priceForShipKey:(NSString *key)
 
void setGuiToKeyboardLayoutScreen:resetCurrentRow:(unsigned skip,[resetCurrentRow] BOOL resetCurrentRow)
 
void customViewRollLeft:(OOScalar angle)
 
void pollFlightArrowKeyControls:(double delta_t)
 
void showScenarioDetails()
 
void playCantBuyCommodity()
 
void setInfoSystemID:moveChart:(OOSystemID sid,[moveChart] BOOL moveChart)
 
void noteGUIWillChangeTo:(OOGUIScreenID toScreen)
 
void resetStickFunctions()
 
void customViewRotateRight:(OOScalar angle)
 
void showInformationForSelectedInterface()
 
int getFirstKeyCode:(NSArray *key_def)
 
NSString * fastEquipmentA()
 
void setGuiToDockingReportScreen()
 
void stickProfileInputHandler:view:(GuiDisplayGen *gui,[view] MyOpenGLView *gameView)
 
void setMissionChoice:keyPress:(NSString *newChoice,[keyPress] NSString *keyPress)
 
OOCommodityType dumpCargo()
 
void handleKeyMapperConfirmClearKeys:view:(GuiDisplayGen *gui,[view] MyOpenGLView *gameView)
 
NSString * commanderSelector()
 
void pollMarketScreenControls()
 
void keyMapperInputHandler:view:(GuiDisplayGen *gui,[view] MyOpenGLView *gameView)
 
void playMenuNavigationUp()
 
void previousInfoSystem()
 
void handleKeyConfigEntryKeys:view:(GuiDisplayGen *gui,[view] MyOpenGLView *gameView)
 
void showInformationForSelectedUpgradeWithFormatString:(NSString *extraString)
 
void customViewRotateLeft:(OOScalar angle)
 
void handleKeyboardLayoutEntryKeys:view:(GuiDisplayGen *gui,[view] MyOpenGLView *gameView)
 
void customViewZoomIn:(OOScalar rate)
 
void pollGameOverControls:(double delta_t)
 
void handleKeyMapperScreenKeys()
 
void handleKeyConfigKeys:view:(GuiDisplayGen *gui,[view] MyOpenGLView *gameView)
 
ShipEntity * fireMissile()
 
void targetNewSystem:whileTyping:(int direction, [whileTyping] BOOL whileTyping)
 
void setLongRangeChartMode:(OOLongRangeChartMode mode)
 
void refreshMissionScreenTextEntry()
 
void setDockedAtMainStation()
 
void playJumpMassLocked()
 
void selectPreviousMultiFunctionDisplay()
 
void startAfterburnerSound()
 
void pollGuiScreenControls()
 
void playCantSellCommodity()
 
void setGuiToShortRangeChartScreen()
 
NSString * fastEquipmentB()
 
NSPoint adjusted_chart_centre()
 
void playAutopilotCannotDockWithTarget()
 
void setGuiToStickMapperScreen:resetCurrentRow:(unsigned skip,[resetCurrentRow] BOOL resetCurrentRow)
 
void playDismissedMissionScreen()
 
void switchToThisView:fromView:andProcessWeaponFacing:justNotify:(OOViewID viewDirection,[fromView] OOViewID oldViewDirection,[andProcessWeaponFacing] BOOL processWeaponFacing,[justNotify] BOOL justNotify)
 
void currentWeaponStats()
 
void handleButtonTargetMissile()
 
void setGuiToOXZManager()
 
void performDockingRequest:(StationEntity *stationForDocking)
 
void pollDockedControls:(double delta_t)
 
void disengageAutopilot()
 
void playStandardHyperspace()
 
BOOL handleGUIUpDownArrowKeys()
 
void playLaserHit:offset:weaponIdentifier:(BOOL hit,[offset] Vector weaponOffset,[weaponIdentifier] NSString *weaponIdentifier)
 
BOOL checkKeyPress:fKey_only:ignore_ctrl:(NSArray *key_def,[fKey_only] BOOL fKey_only,[ignore_ctrl] BOOL ignore_ctrl)
 
void printIdentLockedOnForMissile:(BOOL missile)
 
void playMissileLockedOn()
 
void playDismissedReportScreen()
 
void playNextMissileSelected()
 
void switchToThisView:(OOViewID viewDirection)
 
void customViewPanDown:(OOScalar angle)
 
void noteGUIDidChangeFrom:to:(OOGUIScreenID fromScreen,[to] OOGUIScreenID toScreen)
 
void enterDock:(StationEntity *station)
 
void handleUndockControl()
 
void handleMissionCallback()
 
void pollDemoControls:(double delta_t)
 
void playHyperspaceAborted()
 
void pollCustomViewControls()
 
void setCustomViewDataFromDictionary:withScaling:(NSDictionary *viewDict,[withScaling] BOOL withScaling)
 
void playWeaponsOffline()
 
void pollApplicationControls()
 
OOSystemID nextHopTargetSystemID()
 
BOOL tryBuyingCommodity:all:(OOCommodityType type,[all] BOOL all)
 
void initKeyConfigSettings()
 
void customViewPanLeft:(OOScalar angle)
 
NSArray * applyMarketSorter:onMarket:(NSArray *goods,[onMarket] OOCommodityMarket *market)
 
void setGuiToManifestScreen()
 
void showShipyardInfoForSelection()
 
void setGuiToKeyMapperScreen:resetCurrentRow:(unsigned skip,[resetCurrentRow] BOOL resetCurrentRow)
 
void showInformationForSelectedUpgrade()
 
void selectNextMultiFunctionDisplay()
 
void setGuiToEquipShipScreen:(int skip)
 
void customViewRollRight:(OOScalar angle)
 
BOOL doWorldEventUntilMissionScreen:(jsid message)
 
OOCommodityMarket * localMarket()
 
NSArray * processKeyCode:(NSArray *key_def)
 
BOOL moveTargetMemoryBy:(NSInteger delta)
 
NSArray * currentLaserOffset()
 
void switchToThisView:andProcessWeaponFacing:(OOViewID viewDirection,[andProcessWeaponFacing] BOOL processWeaponFacing)
 
NSDictionary * dictionaryFromFilesNamed:inFolder:mergeMode:cache:(NSString *fileName,[inFolder] NSString *folderName,[mergeMode] OOResourceMergeMode mergeMode,[cache] BOOL useCache)
 
void decrease_flight_roll:(double delta)
 
void setStatus:(OOEntityStatus stat)
 
void doScriptEvent:(jsid message)
 
void decrease_flight_yaw:(double delta)
 
void doScriptEvent:withArguments:(jsid message,[withArguments] NSArray *arguments)
 
ShipEntity * shipHitByLaser()
 
void increase_flight_yaw:(double delta)
 
void doScriptEvent:withArgument:(jsid message,[withArgument] id argument)
 
void decrease_flight_pitch:(double delta)
 
void increase_flight_pitch:(double delta)
 
void increase_flight_roll:(double delta)
 
void doScriptEvent:withArgument:andArgument:(jsid message,[withArgument] id argument1,[andArgument] id argument2)
 
Entity * sortedEntities[UNIVERSE_MAX_ENTITIES+1]
 
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque