41#import "OOConstToJSString.h"
62#import "OOJSGuiScreenKeyDefinition.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
95#ifdef OO_DEBUG_MONITOR_ENABLED
96static BOOL dump_target_state_pressed;
97static BOOL dump_entity_list_pressed;
107#if OO_RESOLUTION_OPTION
110#if OOLITE_SPEECH_SYNTH
111static BOOL speech_settings_pressed;
113static BOOL speechVoiceSelectKeyPressed;
114static BOOL speechGenderSelectKeyPressed;
125static BOOL hdrMaxBrightnessControlPressed;
126static BOOL hdrPaperWhiteControlPressed;
167@interface PlayerEntity (OOControlsPrivate)
169- (void)pollFlightControls:(
double)delta_t;
170- (void)pollFlightArrowKeyControls:(
double)delta_t;
171- (void)pollGuiArrowKeyControls:(
double)delta_t;
180- (void)pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias;
183- (void)pollGameOverControls:(
double)delta_t;
184- (void)pollAutopilotControls:(
double)delta_t;
185- (void)pollDockedControls:(
double)delta_t;
186- (void)pollDemoControls:(
double)delta_t;
190- (void)switchToThisView:(
OOViewID)viewDirection;
191- (void)switchToThisView:(
OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing;
192- (void)switchToThisView:(
OOViewID)viewDirection fromView:(
OOViewID)oldViewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing justNotify:(BOOL)justNotify;
194- (void)handleAutopilotOn:(BOOL)fastDocking;
201@implementation PlayerEntity (Controls)
207 keyCodeLookups = [[
NSDictionary alloc] initWithObjectsAndKeys:
208 [
NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"arrowleft",
209 [
NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"leftarrow",
210 [
NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"left",
211 [
NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"arrowright",
212 [
NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"rightarrow",
213 [
NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"right",
214 [
NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"arrowup",
215 [
NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"uparrow",
216 [
NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"up",
217 [
NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"arrowdown",
218 [
NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"downarrow",
219 [
NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"down",
220 [
NSNumber numberWithUnsignedShort:gvPageUpKey], @"pageup",
221 [
NSNumber numberWithUnsignedShort:gvPageDownKey], @"pagedown",
222 [
NSNumber numberWithUnsignedShort:13], @"enter",
223 [
NSNumber numberWithUnsignedShort:13], @"return",
224 [
NSNumber numberWithUnsignedShort:27], @"escape",
225 [
NSNumber numberWithUnsignedShort:27], @"esc",
226 [
NSNumber numberWithUnsignedShort:9], @"tab",
227 [
NSNumber numberWithUnsignedShort:32], @"space",
228 [
NSNumber numberWithUnsignedShort:32], @"spc",
229 [
NSNumber numberWithUnsignedShort:gvHomeKey], @"home",
230 [
NSNumber numberWithUnsignedShort:gvEndKey], @"end",
231 [
NSNumber numberWithUnsignedShort:gvDeleteKey], @"delete",
232 [
NSNumber numberWithUnsignedShort:gvDeleteKey], @"del",
233 [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspace",
234 [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspc",
235 [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspace",
236 [
NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspc",
237 [
NSNumber numberWithUnsignedShort:gvInsertKey], @"insert",
238 [
NSNumber numberWithUnsignedShort:gvInsertKey], @"ins",
239 [
NSNumber numberWithUnsignedShort:gvFunctionKey1], @"f1",
240 [
NSNumber numberWithUnsignedShort:gvFunctionKey2], @"f2",
241 [
NSNumber numberWithUnsignedShort:gvFunctionKey3], @"f3",
242 [
NSNumber numberWithUnsignedShort:gvFunctionKey4], @"f4",
243 [
NSNumber numberWithUnsignedShort:gvFunctionKey5], @"f5",
244 [
NSNumber numberWithUnsignedShort:gvFunctionKey6], @"f6",
245 [
NSNumber numberWithUnsignedShort:gvFunctionKey7], @"f7",
246 [
NSNumber numberWithUnsignedShort:gvFunctionKey8], @"f8",
247 [
NSNumber numberWithUnsignedShort:gvFunctionKey9], @"f9",
248 [
NSNumber numberWithUnsignedShort:gvFunctionKey10], @"f10",
249 [
NSNumber numberWithUnsignedShort:gvFunctionKey11], @"f11",
250 [
NSNumber numberWithUnsignedShort:gvPauseKey], @"pause",
251 [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"printscreen",
252 [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscrn",
253 [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prntscrn",
254 [
NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscn",
255 [
NSNumber numberWithUnsignedShort:gvNumberPadKey0], @"numpad0",
256 [
NSNumber numberWithUnsignedShort:gvNumberPadKey1], @"numpad1",
257 [
NSNumber numberWithUnsignedShort:gvNumberPadKey2], @"numpad2",
258 [
NSNumber numberWithUnsignedShort:gvNumberPadKey3], @"numpad3",
259 [
NSNumber numberWithUnsignedShort:gvNumberPadKey4], @"numpad4",
260 [
NSNumber numberWithUnsignedShort:gvNumberPadKey5], @"numpad5",
261 [
NSNumber numberWithUnsignedShort:gvNumberPadKey6], @"numpad6",
262 [
NSNumber numberWithUnsignedShort:gvNumberPadKey7], @"numpad7",
263 [
NSNumber numberWithUnsignedShort:gvNumberPadKey8], @"numpad8",
264 [
NSNumber numberWithUnsignedShort:gvNumberPadKey9], @"numpad9",
265 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpad/",
266 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpaddivide",
267 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpad*",
268 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpadmultiply",
269 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpad-",
270 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpadminus",
271 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpad+",
272 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpadplus",
273 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpad.",
274 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpadperiod",
275 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpad=",
276 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpadequals",
277 [
NSNumber numberWithUnsignedShort:gvNumberPadKeyEnter], @"numpadenter", nil];
279 keyShiftText = [DESC(@"oolite-keyconfig-shift") retain];
280 keyMod1Text = [DESC(@"oolite-keyconfig-mod1") retain];
281#if OOLITE_MAC_COCOA_UI
282 keyMod2Text = [DESC(@"oolite-keyconfig-mod2-mac") retain];
284 keyMod2Text = [DESC(@"oolite-keyconfig-mod2-pc") retain];
297 NSString* kbd = [
defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
303 NSArray* def_list =
nil;
305 keys = [
kdic2 allKeys];
306 for (i = 0; i < [
keys count]; i++) {
307 key = [
keys objectAtIndex:i];
308 if ([[kdic2 objectForKey:key] isKindOfClass:[NSArray
class]]) {
309 def_list = (NSArray*)[kdic2 objectForKey:key];
317 NSArray* temp = [
defaults arrayForKey:KEYCONFIG_CUSTOMEQUIP];
318 customEquipActivation = [[
NSMutableArray arrayWithArray:temp] retain];
331 NSMutableArray* keyDef =
nil;
332 NSString* lookup =
nil;
334 NSDictionary* key1 =
nil;
335 NSDictionary* key2 =
nil;
338 NSDictionary* dict = [
defaults objectForKey:KEYCONFIG_OVERRIDES];
340 keys = [
dict allKeys];
341 for (i = 0; i < [
keys count]; i++) {
342 key = [
keys objectAtIndex:i];
343 [
kdic2 setObject:[
dict objectForKey:key] forKey:key];
348#define LOAD_KEY_SETTING2(name, default_1, shift_1, mod1_1, default_2, shift_2, mod1_2) \
349 lookup = [@ #name substringFromIndex:2]; \
350 curr = (NSArray*)[[kdic2 objectForKey:lookup] copy]; \
351 key1 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_1], @"key", [NSNumber numberWithBool:shift_1], @"shift", [NSNumber numberWithBool:mod1_1], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \
352 [keyDef addObject:key1]; \
353 if (default_2 > 0) { \
354 key2 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_2], @"key", [NSNumber numberWithBool:shift_2], @"shift", [NSNumber numberWithBool:mod1_2], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \
355 [keyDef addObject:key2]; \
357 name = curr ?: keyDef; \
358 [kdic2 setObject:curr ?: keyDef forKey:lookup]; \
492#if OO_FOV_INFLIGHT_CONTROL_ENABLED
497#ifdef OO_DEBUG_MONITOR_ENABLED
509 keyconfig2_settings = [[
NSDictionary alloc] initWithDictionary:kdic2 copyItems:YES];
512- (NSArray*)processKeyCode:(NSArray*)key_def
515 id key =
nil, value =
nil;
517 unsigned char keychar;
518 NSString* keystring =
nil;
519 NSDictionary* def =
nil;
522 for (i = 0; i < [
key_def count]; i++) {
523 def = [
key_def objectAtIndex:i];
524 if ([def
count] == 0)
526 value = [
def objectForKey:@"key"];
527 iValue = [
value intValue];
532 if ([def objectForKey:
@"shift"])
533 [
defNew setObject:[
def objectForKey:@"shift"] forKey:@"shift"];
536 if ([def objectForKey:
@"mod1"])
537 [
defNew setObject:[
def objectForKey:@"mod1"] forKey:@"mod1"];
540 if ([def objectForKey:
@"mod2"])
541 [
defNew setObject:[
def objectForKey:@"mod2"] forKey:@"mod2"];
548 if ([value isKindOfClass:[NSString
class]] && (iValue < 10)) {
552 if ([keystring length] != 0) {
558 [
defNew setObject:[
NSNumber numberWithUnsignedShort:iValue] forKey:@"key"];
565 if ([keystring length] == 1 || (iValue == 0 && [keystring length] != 0)) {
566 keychar = [
keystring characterAtIndex:0] & 0x00ff;
567 }
else if (iValue <= 0xFF)
570 OOLogWARN(
@"testing",
@"continue hit for key %@.", key);
571 [
defNew setObject:[
def objectForKey:@"key"] forKey:@"key"];
577 [
defNew setObject:[
NSNumber numberWithUnsignedShort:keychar] forKey:@"key"];
581 [
defNew setObject:[
def objectForKey:@"key"] forKey:@"key"];
591- (BOOL)checkNavKeyPress:(NSArray*)key_def
595 for (i = 0; i < [
key_def count]; i++) {
596 NSDictionary* def = [
key_def objectAtIndex:i];
597 if ([gameView isDown:[[def objectForKey:
@"key"] intValue]])
603- (BOOL)checkKeyPress:(NSArray*)key_def
608- (BOOL)checkKeyPress:(NSArray*)key_def fKey_only:(BOOL)fKey_only
613- (BOOL)checkKeyPress:(NSArray*)key_def ignore_ctrl:(BOOL)ignore_ctrl
618- (BOOL)checkKeyPress:(NSArray*)key_def fKey_only:(BOOL)fKey_only ignore_ctrl:(BOOL)ignore_ctrl
622 for (i = 0; i < [
key_def count]; i++) {
623 NSDictionary* def = [
key_def objectAtIndex:i];
624 int keycode = [[
def objectForKey:@"key"] intValue];
631 if (fKey_only == YES && (keycode < gvFunctionKey1 || keycode >
gvFunctionKey11))
633 if ([gameView isDown:keycode]
634 && ([[def objectForKey:
@"shift"] boolValue] == [gameView isShiftDown])
635 && (ignore_ctrl || ([[def objectForKey:
@"mod1"] boolValue] == [gameView isCtrlDown]))
636 && ([[def objectForKey:
@"mod2"] boolValue] == [gameView isOptDown]))
642- (
int)getFirstKeyCode:(NSArray*)key_def
644 NSDictionary* def = [
key_def objectAtIndex:0];
645 return [[
def objectForKey:@"key"] intValue];
648- (void)pollControls:(
double)delta_t
651 NSString* exceptionContext =
@"setup";
656 exceptionContext =
@"pollApplicationControls";
658 switch ([
self status]) {
659 case STATUS_WITCHSPACE_COUNTDOWN:
660 case STATUS_IN_FLIGHT:
661 exceptionContext =
@"pollFlightControls";
666 exceptionContext =
@"pollGameOverControls";
670 case STATUS_AUTOPILOT_ENGAGED:
671 exceptionContext =
@"pollAutopilotControls";
676 exceptionContext =
@"pollDockedControls";
680 case STATUS_START_GAME:
681 exceptionContext =
@"pollDemoControls";
691 @catch (NSException* exception) {
692 OOLog(
kOOLogException,
@"***** Exception checking controls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
704 BOOL arrow_up = [
self checkKeyPress:n_key_gui_arrow_up] || joyButtonState[BUTTON_GUIUP];
705 BOOL arrow_down = [
self checkKeyPress:n_key_gui_arrow_down] || joyButtonState[BUTTON_GUIDOWN];
711 if ([gui setNextRow:+1]) {
714 if ([gui setFirstSelectableRow])
718 if (result && [gui selectableRange].length > 1)
729 if ([gui setNextRow:-1]) {
732 if ([gui setLastSelectableRow])
736 if (result && [gui selectableRange].length > 1)
750 if ([gui setSelectedRow:click_row]) {
755 if (mouse_dbl_click) {
759 if ([gui setSelectedRow:click_row]) {
774- (void)targetNewSystem:(
int)direction whileTyping:(BOOL)whileTyping
776 target_system_id = [[UNIVERSE gui] targetNextFoundSystem:direction];
778 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
780 found_system_id = target_system_id;
789 [[UNIVERSE gameView] resetTypedString];
790 if (planetSearchString)
792 planetSearchString =
nil;
795- (void)targetNewSystem:(
int)direction
803 gui_screen = GUI_SCREEN_MAIN;
806 [UNIVERSE removeDemoShips];
809 if ([
self isMouseControlOn])
810 [[UNIVERSE gameView] resetMouse];
811 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
822 if ([
self hasHyperspaceMotor]) {
823 if (spin_time == 0) {
824 witchspaceCountdown = hyperspaceMotorSpinTime;
826#ifndef OO_DUMP_PLANETINFO
828 witchspaceCountdown = 5;
832 witchspaceCountdown = spin_time;
835 [
self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
838 [UNIVERSE clearPreviousMessage];
839 int seconds = round(witchspaceCountdown);
841 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
844 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
850 if ([
self hasHyperspaceMotor]) {
857 if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN) {
862 [UNIVERSE clearPreviousMessage];
868@implementation PlayerEntity (OOControlsPrivate)
875 NSString* exceptionContext =
@"setup";
881 BOOL onTextEntryScreen = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART) || (gui_screen == GUI_SCREEN_MISSION) || (gui_screen == GUI_SCREEN_SAVE) || (gui_screen == GUI_SCREEN_OXZMANAGER || (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY));
885#if !OOLITE_MAC_OS_X || !OOLITE_64_BIT
886 if ([gameController inFullScreenMode]) {
887 exceptionContext =
@"command key controls";
888 if ([gameView isCommandFDown]) {
891 if (mouse_control_on) {
892 [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
893 mouse_control_on = NO;
897 if ([gameView isCommandQDown]) {
904 if ([
self status] == STATUS_HANDLING_ERROR) {
905 exceptionContext =
@"error handling mode";
906 if ([gameView isDown:113] || [gameView isDown:81] || [gameView isDown:27])
912 if ([gameController isGamePaused]) {
914 switch ([
self status]) {
915 case STATUS_WITCHSPACE_COUNTDOWN:
916 case STATUS_IN_FLIGHT:
917 case STATUS_AUTOPILOT_ENGAGED:
926 if ([
UNIVERSE pauseMessageVisible]) {
927 [UNIVERSE clearPreviousMessage];
940 exceptionContext =
@"snapshot";
950 if (!onTextEntryScreen && [
self checkKeyPress:n_key_show_fps])
952 exceptionContext =
@"toggle FPS";
954 [UNIVERSE setDisplayFPS:![UNIVERSE displayFPS]];
961 if ([
self checkKeyPress:n_key_bloom_toggle]) {
963 BOOL oldBloom = [UNIVERSE bloom];
964 [UNIVERSE setBloom:!oldBloom];
972 BOOL allowMouseControl;
974 allowMouseControl = YES;
977 [[
NSUserDefaults standardUserDefaults] boolForKey:@"mouse-control-in-windowed-mode"];
980 if (allowMouseControl) {
981 exceptionContext =
@"mouse control";
982 if (!onTextEntryScreen && ([
self checkKeyPress:n_key_mouse_control_roll] || [
self checkKeyPress:n_key_mouse_control_yaw]))
985 mouse_control_on = !mouse_control_on;
986 if (mouse_control_on) {
987 [UNIVERSE addMessage:DESC(@"mouse-on") forCount:3.0];
992 if ([[NSUserDefaults standardUserDefaults] boolForKey:
@"grab-mouse-on-mouse-control"]) {
997 keyboardPitchOverride = NO;
998 keyboardYawOverride = !keyboardRollOverride;
1000 [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
1012 if (mouse_control_on) {
1013 mouse_control_on = NO;
1014 [UNIVERSE addMessage:DESC(@"mouse-off") forCount:3.0];
1024 if (([
self checkKeyPress:n_key_hud_toggle] || joyButtonState[
BUTTON_TOGGLEHUD]) && [gameController isGamePaused] && !onTextEntryScreen)
1026 exceptionContext =
@"toggle HUD";
1030 if (gui_screen == GUI_SCREEN_STATUS) {
1040 @catch (NSException* exception) {
1041 OOLog(
kOOLogException,
@"***** Exception in pollApplicationControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
1045- (void)pollFlightControls:(
double)delta_t
1049 NSString* exceptionContext =
@"setup";
1052 exceptionContext =
@"joystick handling";
1055 BOOL paused = [[UNIVERSE gameController] isGamePaused];
1058 if (!paused && gui_screen == GUI_SCREEN_MISSION) {
1059 exceptionContext =
@"mission screen";
1062 NSPoint virtualView = NSZeroPoint;
1063 double view_threshold = 0.5;
1065 if ([stickHandler joystickCount]) {
1068 virtualView.y = 0.0;
1070 virtualView.x = 0.0;
1071 if (fabs(virtualView.y) >= fabs(virtualView.x))
1072 virtualView.x = 0.0;
1074 virtualView.y = 0.0;
1077 if ([
self checkKeyPress:n_key_view_forward] || (virtualView.y < -view_threshold) || joyButtonState[
BUTTON_VIEWFORWARD]) {
1078 view = VIEW_FORWARD;
1080 if ([
self checkKeyPress:n_key_view_aft] | (virtualView.y > view_threshold) || joyButtonState[
BUTTON_VIEWAFT]) {
1083 if ([
self checkKeyPress:n_key_view_port] || (virtualView.x < -view_threshold) || joyButtonState[
BUTTON_VIEWPORT]) {
1086 if ([
self checkKeyPress:n_key_view_starboard] || (virtualView.x > view_threshold) || joyButtonState[
BUTTON_VIEWSTARBOARD]) {
1087 view = VIEW_STARBOARD;
1089 if (view == VIEW_NONE) {
1093 [[UNIVERSE gui] clearBackground];
1095 if (_missionWithCallback) {
1101 }
else if (!paused) {
1102 exceptionContext =
@"arrow keys";
1113 exceptionContext =
@"afterburner";
1114 if ((joyButtonState[
BUTTON_FUELINJECT] || [
self checkKeyPress:n_key_inject_fuel]) &&
1115 [
self hasFuelInjection] && !hyperspeed_engaged) {
1116 if (fuel > 0 && !afterburner_engaged) {
1117 [UNIVERSE addMessage:DESC(@"fuel-inject-on") forCount:1.5];
1118 afterburner_engaged = YES;
1122 [UNIVERSE addMessage:DESC(@"fuel-out") forCount:1.5];
1124 afterburner_engaged = (fuel > 0);
1126 afterburner_engaged = NO;
1128 if ((!afterburner_engaged) && (afterburnerSoundLooping))
1131 exceptionContext =
@"thrust";
1134 float mouseWheelDeltaFactor = mouse_control_on ? fabs([gameView mouseWheelDelta]) : 1.0f;
1135 if (mouseWheelDeltaFactor == 0.0f)
1136 mouseWheelDeltaFactor = 1.0f;
1138 if (([
self checkKeyPress:n_key_increase_speed] || joyButtonState[
BUTTON_INCTHRUST] || ((mouse_control_on) && ([gameView mouseWheelState] ==
gvMouseWheelUp) && ([
UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn])))
1139 && (flightSpeed < maxFlightSpeed) && (!afterburner_engaged)) {
1140 flightSpeed += speed_delta * delta_t * mouseWheelDeltaFactor;
1143 if (([
self checkKeyPress:n_key_decrease_speed] || joyButtonState[
BUTTON_DECTHRUST] || ((mouse_control_on) && ([gameView mouseWheelState] ==
gvMouseWheelDown) && ([
UNIVERSE viewDirection] <= VIEW_STARBOARD || ![gameView isCapsLockOn])))
1144 && (!afterburner_engaged)) {
1145 flightSpeed -= speed_delta * delta_t * mouseWheelDeltaFactor;
1147 hyperspeed_engaged = NO;
1151 if ([stickHandler joystickCount] != 0 && functionForThrustAxis !=
nil) {
1152 if (flightSpeed < maxFlightSpeed * reqSpeed) {
1153 flightSpeed += speed_delta * delta_t;
1155 if (flightSpeed > maxFlightSpeed * reqSpeed) {
1156 flightSpeed -= speed_delta * delta_t;
1160 if (!afterburner_engaged && ![
self atHyperspeed] && !hyperspeed_engaged) {
1164 exceptionContext =
@"hyperspeed";
1169 if (!hyperspeed_engaged) {
1171 hyperspeed_engaged = !hyperspeed_locked;
1172 if (hyperspeed_locked) {
1174 [UNIVERSE addMessage:DESC(@"jump-mass-locked") forCount:1.5];
1177 hyperspeed_engaged = NO;
1185 exceptionContext =
@"shoot";
1187 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)) {
1188 if ([
self fireMainWeapon]) {
1193 exceptionContext =
@"weapons online toggle";
1197 NSString* weaponsOnlineToggleMsg;
1200 weaponsOnlineToggleMsg = [
self weaponsOnline] ?
DESC(
@"weapons-systems-online") :
DESC(
@"weapons-systems-offline");
1201 if ([
self weaponsOnline]) {
1206 [UNIVERSE addMessage:weaponsOnlineToggleMsg forCount:2.0];
1213 exceptionContext =
@"missile fire";
1224 exceptionContext =
@"next missile";
1235 exceptionContext =
@"next target";
1237 if ([
self checkKeyPress:n_key_next_target] || joyButtonState[
BUTTON_NEXTTARGET]) {
1245 exceptionContext =
@"previous target";
1247 if ([
self checkKeyPress:n_key_previous_target] || joyButtonState[
BUTTON_PREVTARGET]) {
1255 exceptionContext =
@"ident R";
1257 if ([
self checkKeyPress:n_key_ident_system] || joyButtonState[
BUTTON_ID]) {
1266 exceptionContext =
@"prime equipment";
1280 if (primedEquipment > c)
1281 primedEquipment = 0;
1283 if (primedEquipment > 0)
1286 primedEquipment = c;
1289 NSString* eqKey =
@"";
1291 if (primedEquipment == c) {
1294 [UNIVERSE addMessage:DESC(@"equipment-primed-none") forCount:2.0];
1296 [UNIVERSE addMessage:DESC(@"equipment-primed-none-available") forCount:2.0];
1300 eqKey = [[
eqScripts oo_arrayAtIndex:primedEquipment] oo_stringAtIndex:0];
1301 [UNIVERSE addMessage:OOExpandKey(@"equipment-primed", equipmentName) forCount:2.0];
1310 exceptionContext =
@"activate equipment";
1320 exceptionContext =
@"mode equipment";
1330 exceptionContext =
@"fast equipment A";
1331 if ([
self checkKeyPress:n_key_fastactivate_equipment_a] || joyButtonState[
BUTTON_CLOAK]) {
1339 exceptionContext =
@"fast equipment B";
1340 if ([
self checkKeyPress:n_key_fastactivate_equipment_b] || joyButtonState[
BUTTON_ENERGYBOMB]) {
1348 exceptionContext =
@"custom equipment";
1355 if ([
self hasOneEquipmentItem:[item oo_stringForKey:
CUSTOMEQUIP_EQUIPKEY] includeWeapons:NO whileLoading:NO]) {
1356 NSArray* key_act = [
item oo_arrayForKey:CUSTOMEQUIP_KEYACTIVATE];
1357 NSArray* key_mod = [
item oo_arrayForKey:CUSTOMEQUIP_KEYMODE];
1358 NSDictionary* but_act = [
item oo_dictionaryForKey:CUSTOMEQUIP_BUTTONACTIVATE];
1359 NSDictionary* but_mod = [
item oo_dictionaryForKey:CUSTOMEQUIP_BUTTONMODE];
1362 if ((key_act && [
self checkKeyPress:key_act]) || (but_act && [[
OOJoystickManager sharedStickHandler] isButtonDown:[but_act oo_intForKey:
STICK_AXBUT] stick:[but_act oo_intForKey:
STICK_NUMBER]])) {
1363 if (![[customActivatePressed objectAtIndex:i] boolValue]) {
1372 if ((key_mod && [
self checkKeyPress:key_mod]) || (but_mod && [[
OOJoystickManager sharedStickHandler] isButtonDown:[but_mod oo_intForKey:
STICK_AXBUT] stick:[but_mod oo_intForKey:
STICK_NUMBER]])) {
1373 if (![[customModePressed objectAtIndex:i] boolValue]) {
1383 exceptionContext =
@"incoming missile T";
1393 exceptionContext =
@"missile T";
1395 if (([
self checkKeyPress:n_key_target_missile] || joyButtonState[
BUTTON_ARMMISSILE]) && (missile_entity[activeMissile])) {
1404 exceptionContext =
@"missile U";
1406 if ([
self checkKeyPress:n_key_untarget_missile] || joyButtonState[
BUTTON_UNARM]) {
1409 if ([
self primaryTarget] !=
nil)
1413 if (!ident_engaged && [
self weaponsOnline]) {
1414 [UNIVERSE addMessage:DESC(@"missile-safe") forCount:2.0];
1417 [UNIVERSE addMessage:DESC(@"ident-off") forCount:2.0];
1426 exceptionContext =
@"ECM";
1428 if (([
self checkKeyPress:n_key_ecm] || joyButtonState[
BUTTON_ECM]) && [
self hasECM]) {
1429 if (!ecm_in_operation) {
1430 if ([
self weaponsOnline] && [
self fireECM]) {
1432 [UNIVERSE addMessage:DESC(@"ecm-on") forCount:3.0];
1437 exceptionContext =
@"escape pod";
1441 if (([
self checkKeyPress:n_key_launch_escapepod] || joyButtonState[
BUTTON_ESCAPE]) && [
self hasEscapePod]) {
1442 BOOL goodToLaunch = [[
NSUserDefaults standardUserDefaults] boolForKey:@"escape-pod-activation-immediate"];
1445 if (!goodToLaunch) {
1452 if ([stickHandler joystickCount]) {
1458 if (timeNow < escapePodKeyResetTime)
1467 exceptionContext =
@"dump cargo";
1469 if (([
self checkKeyPress:n_key_dump_cargo] || joyButtonState[
BUTTON_JETTISON]) && [cargo
count] > 0) {
1473 exceptionContext =
@"rotate cargo";
1482 exceptionContext =
@"autopilot C";
1484 if ([
self checkKeyPress:n_key_autopilot] || joyButtonState[
BUTTON_DOCKCPU])
1493 exceptionContext =
@"autopilot shift-C";
1505 exceptionContext =
@"docking clearance request";
1517 exceptionContext =
@"hyperspace";
1519 if (([
self checkKeyPress:n_key_hyperspace] || joyButtonState[
BUTTON_HYPERDRIVE]) &&
1520 [
self hasHyperspaceMotor])
1523 if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN) {
1525 if (galactic_witchjump) {
1526 galactic_witchjump = NO;
1527 [UNIVERSE addMessage:DESC(@"witch-user-galactic-abort") forCount:3.0];
1529 [UNIVERSE addMessage:DESC(@"witch-user-abort") forCount:3.0];
1531 }
else if ([
self witchJumpChecklist:
false]) {
1539 exceptionContext =
@"galactic hyperspace";
1541 if (([
self checkKeyPress:n_key_galactic_hyperspace] || joyButtonState[
BUTTON_GALACTICDRIVE]) && ([
self hasEquipmentItemProviding:
@"EQ_GAL_DRIVE"]))
1544 if ([
self status] == STATUS_WITCHSPACE_COUNTDOWN) {
1546 if (galactic_witchjump) {
1547 galactic_witchjump = NO;
1548 [UNIVERSE addMessage:DESC(@"witch-user-galactic-abort") forCount:3.0];
1550 [UNIVERSE addMessage:DESC(@"witch-user-abort") forCount:3.0];
1553 galactic_witchjump = YES;
1556 if (
EXPECT([
self hasHyperspaceMotor]))
1557 witchspaceCountdown = hyperspaceMotorSpinTime;
1561 [
self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
1564 [UNIVERSE addMessage:[
NSString stringWithFormat:DESC(@"witch-galactic-in-f-seconds"), witchspaceCountdown] forCount:1.0];
1576#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1579 if (([
self checkKeyPress:n_key_inc_field_of_view] || joyButtonState[BUTTON_INC_FIELD_OF_VIEW]) && (fieldOfView <
MAX_FOV)) {
1580 fieldOfView *= pow(fov_delta, delta_t);
1585 if (([
self checkKeyPress:n_key_dec_field_of_view] || joyButtonState[BUTTON_DEC_FIELD_OF_VIEW]) && (fieldOfView >
MIN_FOV)) {
1586 fieldOfView /= pow(fov_delta, delta_t);
1592 if ([stickHandler joystickCount] != 0 && functionForFovAxis !=
nil) {
1595 if (fieldOfView < maxFieldOfView * reqFov) {
1596 fieldOfView *= pow(fov_delta, delta_t);
1600 if (fieldOfView > maxFieldOfView * reqFov) {
1601 fieldOfView /= pow(fov_delta, delta_t);
1609#ifdef OO_DEBUG_MONITOR_ENABLED
1610 exceptionContext =
@"dump target state";
1611 if ([
self checkKeyPress:n_key_dump_target_state]) {
1612 if (!dump_target_state_pressed) {
1613 dump_target_state_pressed = YES;
1620 dump_target_state_pressed = NO;
1624 exceptionContext =
@"pollGuiScreenControls";
1629 exceptionContext =
@"options menu";
1630 if (([
self checkKeyPress:n_key_gui_screen_options]) && (gui_screen != GUI_SCREEN_OPTIONS) && ![gameView allowingStringInput]) {
1635#if (ALLOW_CUSTOM_VIEWS_WHILE_PAUSED)
1639 if (gui_screen == GUI_SCREEN_OPTIONS || gui_screen == GUI_SCREEN_GAMEOPTIONS || gui_screen == GUI_SCREEN_STICKMAPPER || gui_screen == GUI_SCREEN_STICKPROFILE || gui_screen == GUI_SCREEN_KEYBOARD || gui_screen == GUI_SCREEN_KEYBOARD_CONFIRMCLEAR || gui_screen == GUI_SCREEN_KEYBOARD_CONFIG || gui_screen == GUI_SCREEN_KEYBOARD_ENTRY || gui_screen == GUI_SCREEN_KEYBOARD_LAYOUT) {
1640 if ([
UNIVERSE pauseMessageVisible])
1641 [[UNIVERSE messageGUI] leaveLastLine];
1643 [[UNIVERSE messageGUI] clear];
1644 NSTimeInterval time_this_frame = [
NSDate timeIntervalSinceReferenceDate];
1654 script_time += time_delta;
1658 exceptionContext =
@"debug keys";
1659#ifdef OO_DEBUG_MONITOR_ENABLED
1661 if ([
self checkKeyPress:n_key_dump_entity_list] && ![gameView allowingStringInput])
1663 if (!dump_entity_list_pressed) {
1664 [UNIVERSE debugDumpEntities];
1666 [UNIVERSE addMessage:@"Entity List dumped. Debugging OFF" forCount:3];
1668 dump_entity_list_pressed = YES;
1670 dump_entity_list_pressed = NO;
1673 if ([
self checkKeyPress:n_key_debug_full] && ![gameView allowingStringInput])
1676 [UNIVERSE addMessage:@"Full debug ON" forCount:3];
1679 if ([
self checkKeyPress:n_key_debug_collision] && ![gameView allowingStringInput])
1682 [UNIVERSE addMessage:@"Collision debug ON" forCount:3];
1685 if ([
self checkKeyPress:n_key_debug_console_connect] && ![[
OODebugMonitor sharedDebugMonitor] usingPlugInController] && ![gameView allowingStringInput])
1692 [UNIVERSE addMessage:@"Connected to debug console." forCount:3];
1695 [UNIVERSE addMessage:@"Disconnected from debug console." forCount:3];
1702 if ([
self checkKeyPress:n_key_debug_bounding_boxes] && ![gameView allowingStringInput])
1705 [UNIVERSE addMessage:@"Bounding box debug ON" forCount:3];
1708 if ([
self checkKeyPress:n_key_debug_shaders] && ![gameView allowingStringInput])
1711 [UNIVERSE addMessage:@"Shader debug ON" forCount:3];
1714 if (([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_arrow_right]) && gui_screen != GUI_SCREEN_GAMEOPTIONS && [
UNIVERSE displayFPS] && ![gameView allowingStringInput]) {
1717 [UNIVERSE setTimeAccelerationFactor:newTimeAccelerationFactor];
1723 if ([
self checkKeyPress:n_key_debug_off] && ![gameView allowingStringInput])
1726 [UNIVERSE addMessage:@"All debug flags OFF" forCount:3];
1732 exceptionContext =
@"pause";
1734 if (([
self checkKeyPress:n_key_pausebutton] || joyButtonState[
BUTTON_PAUSE]) && gui_screen != GUI_SCREEN_LONG_RANGE_CHART && gui_screen != GUI_SCREEN_MISSION && ![gameView allowingStringInput])
1743 case GUI_SCREEN_STATUS:
1746 case GUI_SCREEN_LONG_RANGE_CHART:
1749 case GUI_SCREEN_SHORT_RANGE_CHART:
1752 case GUI_SCREEN_MANIFEST:
1755 case GUI_SCREEN_MARKET:
1758 case GUI_SCREEN_MARKETINFO:
1761 case GUI_SCREEN_SYSTEM_DATA:
1763 if (gui_screen != GUI_SCREEN_SYSTEM_DATA)
1771 [UNIVERSE clearPreviousMessage];
1772 [UNIVERSE setViewDirection:saved_view_direction];
1776 [UNIVERSE setMainLightPosition:_sysInfoLight];
1777 [[UNIVERSE gui] setForegroundTextureKey:@"overlay"];
1778 [[UNIVERSE gameController] setGamePaused:NO];
1784 [UNIVERSE pauseGame];
1792 @catch (NSException* exception) {
1793 OOLog(
kOOLogException,
@"***** Exception in pollFlightControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
1797- (void)pollGuiArrowKeyControls:(
double)delta_t
1809 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART) {
1811 }
else if (gui_screen == GUI_SCREEN_SAVE) {
1813 }
else if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry) {
1815 }
else if (gui_screen == GUI_SCREEN_KEYBOARD_ENTRY) {
1821 else if (gui_screen == GUI_SCREEN_OXZMANAGER && [[
OOOXZManager sharedManager] isAcceptingTextInput])
1830 if (afterburner_engaged && ![
self checkKeyPress:n_key_inject_fuel]) {
1831 afterburner_engaged = NO;
1835 switch (gui_screen) {
1836 case GUI_SCREEN_LONG_RANGE_CHART:
1838 if ([
self status] != STATUS_WITCHSPACE_COUNTDOWN) {
1839 if ([[gameView typedString] length] > 0) {
1841 NSPoint search_coords = [UNIVERSE findSystemCoordinatesWithPrefix:planetSearchString];
1842 if ((search_coords.x >= 0.0) && (search_coords.y >= 0.0)) {
1844 if ([planetSearchString length] == 1)
1845 [[UNIVERSE gui] targetNextFoundSystem:0];
1850 found_system_id = -1;
1856 found_system_id = -1;
1857 [UNIVERSE findSystemCoordinatesWithPrefix:@""];
1859 if (planetSearchString)
1861 planetSearchString =
nil;
1868 case GUI_SCREEN_SHORT_RANGE_CHART:
1870 if ([
self checkKeyPress:n_key_chart_highlight]) {
1873 if (
mode != OOLRC_MODE_TECHLEVEL) {
1887 show_info_flag = !show_info_flag;
1894 if ([
self status] != STATUS_WITCHSPACE_COUNTDOWN) {
1895 if ([
self hasEquipmentItemProviding:
@"EQ_ADVANCED_NAVIGATIONAL_ARRAY"]) {
1896 if ([
self checkKeyPress:n_key_advanced_nav_array_next] || [
self checkKeyPress:n_key_advanced_nav_array_previous]) {
1898 if ([
self checkKeyPress:n_key_advanced_nav_array_previous]) {
1939 showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
1954 target_chart_focus = chart_focus_coordinates;
1959 target_chart_centre = chart_centre_coordinates;
1962 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART)
1968 cursor_coordinates = chart_focus_coordinates;
1975 if ([
self checkKeyPress:n_key_map_home]) {
1976 if ([gameView isOptDown]) {
1978 target_chart_focus = galaxy_coordinates;
1981 cursor_coordinates = galaxy_coordinates;
1982 target_chart_focus = cursor_coordinates;
1983 target_chart_centre = galaxy_coordinates;
1984 found_system_id = -1;
1985 [UNIVERSE findSystemCoordinatesWithPrefix:@""];
1989 if ([
self checkKeyPress:n_key_map_end]) {
1991 target_chart_focus = cursor_coordinates;
1993 if ([
self checkKeyPress:n_key_map_zoom_in] || [gameView mouseWheelState] ==
gvMouseWheelDown) {
1997 saved_chart_zoom = target_chart_zoom;
1999 if ([
self checkKeyPress:n_key_map_zoom_out] || [gameView mouseWheelState] ==
gvMouseWheelUp) {
2000 if (gui_screen == GUI_SCREEN_LONG_RANGE_CHART) {
2005 if (target_chart_zoom < 1.0)
2006 target_chart_zoom = 1.0;
2007 saved_chart_zoom = target_chart_zoom;
2009 target_chart_focus = target_chart_centre;
2015 if ([
self checkNavKeyPress:n_key_gui_arrow_left]) {
2016 if ((nextSystem || nextSystemOnRoute) &&
pressedArrow != 1) {
2019 target_chart_focus = cursor_coordinates;
2023 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
2026 }
else if (!nextSystem && !nextSystemOnRoute) {
2028 cursor_coordinates.x -= cursor_speed * delta_t;
2029 if (cursor_coordinates.x < 0.0)
2030 cursor_coordinates.x = 0.0;
2032 target_chart_focus = cursor_coordinates;
2037 if ([
self checkNavKeyPress:n_key_gui_arrow_right]) {
2038 if ((nextSystem || nextSystemOnRoute) &&
pressedArrow != 2) {
2041 target_chart_focus = cursor_coordinates;
2045 target_chart_focus = [[UNIVERSE systemManager] getCoordinatesForSystem:info_system_id inGalaxy:galaxy_number];
2048 }
else if (!nextSystem && !nextSystemOnRoute) {
2050 cursor_coordinates.x += cursor_speed * delta_t;
2051 if (cursor_coordinates.x > 256.0)
2052 cursor_coordinates.x = 256.0;
2054 target_chart_focus = cursor_coordinates;
2059 if ([
self checkNavKeyPress:n_key_gui_arrow_down]) {
2063 }
else if (!nextSystem) {
2065 cursor_coordinates.y += cursor_speed * delta_t * 2.0;
2066 if (cursor_coordinates.y > 256.0)
2067 cursor_coordinates.y = 256.0;
2070 target_chart_focus = cursor_coordinates;
2074 if ([
self checkNavKeyPress:n_key_gui_arrow_up]) {
2078 }
else if (!nextSystem) {
2080 cursor_coordinates.y -= cursor_speed * delta_t * 2.0;
2081 if (cursor_coordinates.y < 0.0)
2082 cursor_coordinates.y = 0.0;
2085 target_chart_focus = cursor_coordinates;
2089 if (found_system_id == -1) {
2090 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
2094 NSPoint fpos = [[UNIVERSE systemManager] getCoordinatesForSystem:found_system_id inGalaxy:galaxy_number];
2095 if (fpos.x != cursor_coordinates.x && fpos.y != cursor_coordinates.y) {
2096 target_system_id = [UNIVERSE findSystemNumberAtCoords:cursor_coordinates withGalaxy:galaxy_number includingHidden:NO];
2100 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
2102 if (chart_focus_coordinates.x - target_chart_centre.x <= -
CHART_SCROLL_AT_X * chart_zoom) {
2103 target_chart_centre.x = chart_focus_coordinates.x +
CHART_SCROLL_AT_X * chart_zoom;
2104 }
else if (chart_focus_coordinates.x - target_chart_centre.x >=
CHART_SCROLL_AT_X * chart_zoom) {
2105 target_chart_centre.x = chart_focus_coordinates.x -
CHART_SCROLL_AT_X * chart_zoom;
2107 if (chart_focus_coordinates.y - target_chart_centre.y <= -
CHART_SCROLL_AT_Y * chart_zoom) {
2108 target_chart_centre.y = chart_focus_coordinates.y +
CHART_SCROLL_AT_Y * chart_zoom;
2109 }
else if (chart_focus_coordinates.y - target_chart_centre.y >=
CHART_SCROLL_AT_Y * chart_zoom) {
2110 target_chart_centre.y = chart_focus_coordinates.y -
CHART_SCROLL_AT_Y * chart_zoom;
2112 chart_centre_coordinates.x = (3.0 * chart_centre_coordinates.x + target_chart_centre.x) / 4.0;
2113 chart_centre_coordinates.y = (3.0 * chart_centre_coordinates.y + target_chart_centre.y) / 4.0;
2114 chart_zoom = (3.0 * chart_zoom + target_chart_zoom) / 4.0;
2115 chart_focus_coordinates.x = (3.0 * chart_focus_coordinates.x + target_chart_focus.x) / 4.0;
2116 chart_focus_coordinates.y = (3.0 * chart_focus_coordinates.y + target_chart_focus.y) / 4.0;
2123 case GUI_SCREEN_SYSTEM_DATA:
2124 if ([
self checkKeyPress:n_key_system_next_system]) {
2132 if ([
self checkKeyPress:n_key_system_previous_system]) {
2140 if ([
self checkKeyPress:n_key_system_home]) {
2148 if ([
self checkKeyPress:n_key_system_end]) {
2159 case GUI_SCREEN_LOAD: {
2161 if (commanderFile) {
2171 case GUI_SCREEN_SAVE:
2175 if ([
self checkKeyPress:n_key_launch_ship fKey_only:YES])
2177 if (gui_screen == GUI_SCREEN_SAVE) {
2183 case GUI_SCREEN_SAVE_OVERWRITE:
2187 case GUI_SCREEN_STICKMAPPER:
2191 case GUI_SCREEN_STICKPROFILE:
2195 case GUI_SCREEN_GAMEOPTIONS:
2199 case GUI_SCREEN_KEYBOARD:
2207 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
2211 case GUI_SCREEN_KEYBOARD_CONFIG:
2215 case GUI_SCREEN_KEYBOARD_ENTRY:
2219 case GUI_SCREEN_KEYBOARD_LAYOUT:
2223 case GUI_SCREEN_SHIPLIBRARY:
2224 if ([gameView isDown:
' '])
2229 if ([
self checkKeyPress:n_key_gui_arrow_up] || joyButtonState[
BUTTON_GUIUP])
2232 [UNIVERSE selectIntro2Previous];
2234 if ([
self checkKeyPress:n_key_gui_arrow_down] || joyButtonState[
BUTTON_GUIDOWN])
2237 [UNIVERSE selectIntro2Next];
2241 if ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT])
2244 [UNIVERSE selectIntro2PreviousCategory];
2246 if ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT])
2249 [UNIVERSE selectIntro2NextCategory];
2254 case GUI_SCREEN_OPTIONS:
2257 BOOL selectKeyPress = ([
self checkKeyPress:n_key_gui_select] || [
gameView isDown:gvMouseDoubleClick] || joyButtonState[BUTTON_GUISELECT]);
2266 @catch (NSException* exception) {
2267 OOLog(
kOOLogException,
@"\n\n***** Handling exception: %@ : %@ *****\n\n", [exception name], [exception reason]);
2268 if ([[exception name] isEqual:
@"GameNotSavedException"])
2271 if ([controller inFullScreenMode])
2286 if (![
self loadPlayer]) {
2294 [UNIVERSE setUseAddOns:SCENARIO_OXP_DEFINITION_ALL fromSaveGame:NO forceReinit:YES];
2307 if ((guiSelectedRow ==
GUI_ROW(, QUIT)) && selectKeyPress) {
2308 [[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on options screen"];
2312 if ((guiSelectedRow ==
GUI_ROW(, GAMEOPTIONS)) && selectKeyPress) {
2319 case GUI_SCREEN_EQUIP_SHIP:
2320 if ([
self handleGUIUpDownArrowKeys]) {
2325 weaponType = forward_weapon_type;
2327 weaponType = aft_weapon_type;
2329 weaponType = port_weapon_type;
2331 weaponType = starboard_weapon_type;
2333 if (weaponType !=
nil) {
2336 if ([[weaponType identifier] isEqualToString:
@"EQ_WEAPON_NONE"])
2337 itemText =
DESC(
@"no-weapon-enter-to-install");
2341 itemText = [
NSString stringWithFormat:DESC(@"weapon-installed-@"), weaponName];
2343 itemText = [
NSString stringWithFormat:DESC(@"weapon-@-enter-to-replace"), weaponName];
2351 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
2361 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
2387 case GUI_SCREEN_INTERFACES:
2388 if ([
self handleGUIUpDownArrowKeys]) {
2391 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
2401 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
2427 case GUI_SCREEN_MARKETINFO:
2431 case GUI_SCREEN_MARKET:
2434 if ([
self checkKeyPress:n_key_market_filter_cycle] || [
self checkKeyPress:n_key_market_sorter_cycle]) {
2437 if ([
self checkKeyPress:n_key_market_filter_cycle]) {
2459 case GUI_SCREEN_REPORT:
2460 if ([gameView isDown:32])
2477 case GUI_SCREEN_STATUS:
2479 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
2491 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
2522 case GUI_SCREEN_MANIFEST:
2524 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
2536 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
2538 if ([[
self hud] isHidden] || [[
self hud] allowBigGui]) {
2542 if ([[gui keyForRow:nextRow] isEqual:
GUI_KEY_OK]) {
2570 case GUI_SCREEN_SHIPYARD:
2571 if ([
self handleGUIUpDownArrowKeys]) {
2575 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
2585 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
2597 if ([
self checkKeyPress:n_key_gui_select] || joyButtonState[
BUTTON_GUISELECT])
2603 if (![key hasPrefix:
@"More:"]) {
2607 if ([
self buySelectedShip]) {
2608 if (![key hasPrefix:
@"More:"])
2610 [UNIVERSE removeDemoShips];
2645 NSInteger kc = [
keys count];
2647 NSDictionary* keydefs =
nil;
2648 NSString* key =
nil;
2650 definition = [
keys objectAtIndex:kc];
2652 foreach (key, [keydefs allKeys]) {
2653 if ([
self checkKeyPress:[keydefs objectForKey:key]]) {
2657 [[UNIVERSE gameView] clearKeys];
2660 OOLog(
@"interface.missingCallback",
@"Unable to find callback definition for %@ using key %@", [definition name], key);
2671 if (flightRoll > 0.0) {
2672 if (flightRoll > delta_t)
2677 if (flightRoll < 0.0) {
2678 if (flightRoll < -delta_t)
2683 if (flightPitch > 0.0) {
2684 if (flightPitch > delta_t)
2689 if (flightPitch < 0.0) {
2690 if (flightPitch < -delta_t)
2695 if (flightYaw > 0.0) {
2696 if (flightYaw > delta_t)
2701 if (flightYaw < 0.0) {
2702 if (flightYaw < -delta_t)
2715 if (gui_screen == GUI_SCREEN_MARKET) {
2717 DESTROY(marketSelectedCommodity);
2720 BOOL page_up = [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[BUTTON_GUIPAGEUP];
2721 BOOL page_down = [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[BUTTON_GUIPAGEDOWN];
2722 if (page_up || page_down) {
2726 if ([goods
count] > 0) {
2727 NSInteger goodsIndex = [
goods indexOfObject:marketSelectedCommodity];
2728 NSInteger offset1 = 0;
2729 NSInteger offset2 = 0;
2737 if (goodsIndex - 16 <= 0) {
2741 if (offset1 == 1 && offset2 == 0 && goodsIndex < (NSInteger)[goods
count] - 1 && goodsIndex - 15 > 0)
2743 goodsIndex -= (16 - (offset1 + offset2));
2746 if ([goods
count] <= 17)
2752 if (offset1 == 0 && offset2 == 1 && goodsIndex > 1)
2754 if (offset2 == 1 && goodsIndex + 15 == (NSInteger)[goods
count] - 1)
2756 goodsIndex += (16 - (offset1 + offset2));
2757 if (goodsIndex > ((NSInteger)[goods
count] - 1) || [goods
count] <= 17)
2758 goodsIndex = (NSInteger)[goods
count] - 1;
2760 DESTROY(marketSelectedCommodity);
2761 marketSelectedCommodity = [[
goods oo_stringAtIndex:goodsIndex] retain];
2772 BOOL arrow_up = [
self checkKeyPress:n_key_gui_arrow_up] || joyButtonState[BUTTON_GUIUP];
2773 BOOL arrow_down = [
self checkKeyPress:n_key_gui_arrow_down] || joyButtonState[BUTTON_GUIDOWN];
2774 if (arrow_up || arrow_down) {
2778 if ([goods
count] > 0) {
2779 NSInteger goodsIndex = [
goods indexOfObject:marketSelectedCommodity];
2785 if (goodsIndex < 0) {
2786 goodsIndex = [
goods count] - 1;
2787 }
else if (goodsIndex >= (NSInteger)[goods
count]) {
2790 DESTROY(marketSelectedCommodity);
2791 marketSelectedCommodity = [[
goods oo_stringAtIndex:goodsIndex] retain];
2805 if ([
self checkNavKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT])
2808 if (isdocked && [
self tryBuyingCommodity:marketSelectedCommodity all:[gameView isShiftDown]]) {
2810 if (gui_screen == GUI_SCREEN_MARKET) {
2816 if ([[gui selectedRowKey] isEqualToString:
@">>>"]) {
2819 }
else if ([[gui selectedRowKey] isEqualToString:
@"<<<"]) {
2829 if ([
self checkNavKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT])
2832 if (isdocked && [
self trySellingCommodity:marketSelectedCommodity all:[gameView isShiftDown]]) {
2834 if (gui_screen == GUI_SCREEN_MARKET) {
2840 if ([[gui selectedRowKey] isEqualToString:
@">>>"]) {
2843 }
else if ([[gui selectedRowKey] isEqualToString:
@"<<<"]) {
2862 if ([item isEqualToString:
@">>>"]) {
2865 }
else if ([item isEqualToString:
@"<<<"]) {
2868 }
else if (isdocked && [gameView isShiftDown] && [
self tryBuyingCommodity:item all:YES])
2871 if (gui_screen == GUI_SCREEN_MARKET) {
2876 }
else if (isdocked && (yours > 0) && [
self trySellingCommodity:item all:YES])
2879 if (gui_screen == GUI_SCREEN_MARKET) {
2884 }
else if (isdocked && [
self tryBuyingCommodity:item all:YES])
2887 if (gui_screen == GUI_SCREEN_MARKET) {
2892 }
else if (isdocked) {
2912 BOOL selectKeyPress = ([
self checkKeyPress:n_key_gui_select] || [
gameView isDown:gvMouseDoubleClick] || joyButtonState[BUTTON_GUISELECT]);
2916 if ((guiSelectedRow ==
GUI_ROW(GAME, STICKMAPPER)) && selectKeyPress) {
2922 if ((guiSelectedRow ==
GUI_ROW(GAME, KEYMAPPER)) && selectKeyPress) {
2930 if ([gameView hdrOutput]) {
2931 if ((guiSelectedRow ==
GUI_ROW(GAME, HDRMAXBRIGHTNESS)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
2932 if (!hdrMaxBrightnessControlPressed) {
2933 int direction = ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT]) ? 1 : -1;
2934 NSArray* brightnesses = [[UNIVERSE descriptions] oo_arrayForKey:@"hdr_maxBrightness_array"];
2937 if (brightnessIdx == NSNotFound) {
2938 OOLogWARN(
@"hdr.maxBrightness.notFound",
@"%@",
@"couldn't find current max brightness setting, switching to lowest.");
2942 brightnessIdx += direction;
2944 if (brightnessIdx < 0)
2945 brightnessIdx =
count - 1;
2946 if (brightnessIdx >=
count)
2949 int brightnessValue = [
brightnesses oo_intAtIndex:brightnessIdx];
2958 [
gameView setHDRMaxBrightness:(float)brightnessValue];
2959 NSString* maxBrightnessString =
OOExpandKey(
@"gameoptions-hdr-maxbrightness", brightnessValue);
2963 hdrMaxBrightnessControlPressed = YES;
2966 hdrMaxBrightnessControlPressed = NO;
2970#if OO_RESOLUTION_OPTION
2973 int direction = ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT]) ? 1 : -1;
2977 if (displayModeIndex == (NSInteger)NSNotFound) {
2978 OOLogWARN(
@"graphics.mode.notFound",
@"%@",
@"couldn't find current fullscreen setting, switching to default.");
2979 displayModeIndex = 0;
2982 displayModeIndex = displayModeIndex + direction;
2984 if (displayModeIndex < 0)
2985 displayModeIndex =
count - 1;
2986 if (displayModeIndex >=
count)
2987 displayModeIndex = 0;
2989 NSDictionary*
mode = [
modes objectAtIndex:displayModeIndex];
2990 int modeWidth = [mode oo_intForKey:kOODisplayWidth];
2991 int modeHeight = [mode oo_intForKey:kOODisplayHeight];
2992 int modeRefresh = [mode oo_intForKey:kOODisplayRefreshRate];
3013#if OOLITE_SPEECH_SYNTH
3015 if ((guiSelectedRow ==
GUI_ROW(GAME, SPEECH)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3016 if (!speech_settings_pressed) {
3020 speech_settings_pressed = YES;
3022 speech_settings_pressed = YES;
3026 if (speech_settings_pressed) {
3027 NSString* message =
nil;
3028 switch (isSpeechOn) {
3030 message =
DESC(
@"gameoptions-spoken-messages-no");
3033 message =
DESC(
@"gameoptions-spoken-messages-comms");
3036 message =
DESC(
@"gameoptions-spoken-messages-yes");
3042 [UNIVERSE stopSpeaking];
3043 [UNIVERSE startSpeakingString:message];
3048 speech_settings_pressed = NO;
3051 if (guiSelectedRow ==
GUI_ROW(GAME, SPEECH_LANGUAGE)) {
3052 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUILEFT]) {
3055 if ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT])
3056 voice_no = [UNIVERSE nextVoice:voice_no];
3058 voice_no = [UNIVERSE prevVoice:voice_no];
3059 [UNIVERSE setVoice:voice_no withGenderM:voice_gender_m];
3060 NSString* voiceName = [UNIVERSE voiceName:voice_no];
3061 NSString* message =
OOExpandKey(
@"gameoptions-voice-name", voiceName);
3064 [UNIVERSE stopSpeaking];
3065 [UNIVERSE startSpeakingString:[UNIVERSE voiceName:voice_no]];
3069 speechVoiceSelectKeyPressed = YES;
3071 speechVoiceSelectKeyPressed = NO;
3074 if (guiSelectedRow ==
GUI_ROW(GAME, SPEECH_GENDER)) {
3075 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUILEFT]) {
3076 if (!speechGenderSelectKeyPressed) {
3078 BOOL m = [
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT];
3079 if (m != voice_gender_m) {
3081 [UNIVERSE setVoice:voice_no withGenderM:voice_gender_m];
3082 NSString* message = [
NSString stringWithFormat:@"%@", DESC(voice_gender_m ? @"gameoptions-voice-M" : @"gameoptions-voice-F")];
3085 [UNIVERSE stopSpeaking];
3086 [UNIVERSE startSpeakingString:[UNIVERSE voiceName:voice_no]];
3090 speechGenderSelectKeyPressed = YES;
3092 speechGenderSelectKeyPressed = NO;
3097 if ((guiSelectedRow ==
GUI_ROW(GAME, MUSIC)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3101 int mode = initialMode;
3103 if ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT])
3105 if ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT])
3110 if ((
int)[musicController
mode] != initialMode) {
3113 NSString* message =
OOExpandKey(
@"gameoptions-music-mode", musicMode);
3121 if ((guiSelectedRow ==
GUI_ROW(GAME, AUTOSAVE)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3124 [UNIVERSE setAutoSave:([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT])];
3127 [UNIVERSE setAutoSaveNow:YES];
3128 [
gui setText:DESC(@"gameoptions-autosave-yes")
forRow:GUI_ROW(GAME, AUTOSAVE)
align:GUI_ALIGN_CENTER];
3130 [UNIVERSE setAutoSaveNow:NO];
3131 [
gui setText:DESC(@"gameoptions-autosave-no")
forRow:GUI_ROW(GAME, AUTOSAVE)
align:GUI_ALIGN_CENTER];
3135 if ((guiSelectedRow ==
GUI_ROW(GAME, VOLUME))
3136 && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))
3137 && [
OOSound respondsToSelector:
@selector(masterVolume)]) {
3139 BOOL rightKeyDown = ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT]);
3140 BOOL leftKeyDown = ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[BUTTON_GUILEFT]);
3142 int vol = (volume / 5.0 + 0.5);
3151 espeak_SetParameter(espeakVOLUME, vol * 5, 0);
3154 NSString* soundVolumeWordDesc =
DESC(
@"gameoptions-sound-volume");
3155 NSString* v1_string =
@"|||||||||||||||||||||||||";
3156 NSString* v0_string =
@".........................";
3157 v1_string = [
v1_string substringToIndex:vol];
3158 v0_string = [
v0_string substringToIndex:20 - vol];
3159 [
gui setText:[
NSString stringWithFormat:@"%@%@%@ ", soundVolumeWordDesc, v1_string, v0_string]
3160 forRow:GUI_ROW(GAME, VOLUME)
3161 align:GUI_ALIGN_CENTER];
3163 [
gui setText:DESC(@"gameoptions-sound-volume-mute")
forRow:GUI_ROW(GAME, VOLUME)
align:GUI_ALIGN_CENTER];
3170 if ((guiSelectedRow ==
GUI_ROW(GAME, FOV))
3171 && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3173 BOOL rightKeyDown = ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT]);
3174 BOOL leftKeyDown = ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[BUTTON_GUILEFT]);
3177 fov += (((rightKeyDown && (fov <
MAX_FOV_DEG)) ? fovStep : 0.0f) - ((leftKeyDown && (fov >
MIN_FOV_DEG)) ? fovStep : 0.0f));
3185 NSString* fovWordDesc =
DESC(
@"gameoptions-fov-value");
3186 NSString* v1_string =
@"|||||||||||||||||||||||||";
3187 NSString* v0_string =
@".........................";
3188 v1_string = [
v1_string substringToIndex:fovTicks];
3189 v0_string = [
v0_string substringToIndex:20 - fovTicks];
3190 [
gui setText:[
NSString stringWithFormat:@"%@%@%@ (%d%c) ", fovWordDesc, v1_string, v0_string, (int)fov, 176 ]
forRow:GUI_ROW(GAME, FOV)
align:GUI_ALIGN_CENTER];
3199 if ((guiSelectedRow ==
GUI_ROW(GAME, COLORBLINDMODE)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3201 int colorblindMode = [UNIVERSE colorblindMode];
3202 if ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) {
3203 [UNIVERSE setCurrentPostFX:[UNIVERSE nextColorblindMode:colorblindMode]];
3205 [UNIVERSE setCurrentPostFX:[UNIVERSE prevColorblindMode:colorblindMode]];
3207 colorblindMode = [UNIVERSE colorblindMode];
3208 NSString* colorblindModeDesc = [[[UNIVERSE descriptions] oo_arrayForKey:@"colorblind_mode"] oo_stringAtIndex:[UNIVERSE useShaders] ? colorblindMode : 0];
3209 NSString* colorblindModeMsg =
OOExpandKey(
@"gameoptions-colorblind-mode", colorblindModeDesc);
3216 if (![gameView hdrOutput]) {
3217 if ((guiSelectedRow ==
GUI_ROW(GAME, WIREFRAMEGRAPHICS)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3218 if (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) != [
UNIVERSE wireframeGraphics])
3220 [UNIVERSE setWireframeGraphics:([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT])];
3222 [
gui setText:DESC(@"gameoptions-wireframe-graphics-yes")
forRow:GUI_ROW(GAME, WIREFRAMEGRAPHICS)
align:GUI_ALIGN_CENTER];
3224 [
gui setText:DESC(@"gameoptions-wireframe-graphics-no")
forRow:GUI_ROW(GAME, WIREFRAMEGRAPHICS)
align:GUI_ALIGN_CENTER];
3229 if ((guiSelectedRow ==
GUI_ROW(GAME, HDRPAPERWHITE))
3230 && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3231 if (!hdrPaperWhiteControlPressed) {
3232 BOOL rightKeyDown = [
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT];
3233 BOOL leftKeyDown = [
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[BUTTON_GUILEFT];
3234 float paperWhite = [
gameView hdrPaperWhiteBrightness];
3240 [
gameView setHDRPaperWhiteBrightness:paperWhite];
3242 NSString* paperWhiteWordDesc =
DESC(
@"gameoptions-hdr-paperwhite");
3243 NSString* v1_string =
@"|||||||||||||||||||||||||";
3244 NSString* v0_string =
@".........................";
3245 v1_string = [
v1_string substringToIndex:paperWhiteNorm];
3246 v0_string = [
v0_string substringToIndex:20 - paperWhiteNorm];
3247 [
gui setText:[
NSString stringWithFormat:@"%@%@%@ (%d) ", paperWhiteWordDesc, v1_string, v0_string, (int)paperWhite]
forRow:GUI_ROW(GAME, HDRPAPERWHITE)
align:GUI_ALIGN_CENTER];
3249 hdrPaperWhiteControlPressed = YES;
3251 hdrPaperWhiteControlPressed = NO;
3256 if ((guiSelectedRow ==
GUI_ROW(GAME, PROCEDURALLYTEXTUREDPLANETS)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3257 if (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) != [
UNIVERSE doProcedurallyTexturedPlanets]) {
3258 [UNIVERSE setDoProcedurallyTexturedPlanets:([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT])];
3261 [UNIVERSE setUpPlanet];
3264 if ([
UNIVERSE doProcedurallyTexturedPlanets])
3265 [
gui setText:DESC(@"gameoptions-procedurally-textured-planets-yes")
forRow:GUI_ROW(GAME, PROCEDURALLYTEXTUREDPLANETS)
align:GUI_ALIGN_CENTER];
3267 [
gui setText:DESC(@"gameoptions-procedurally-textured-planets-no")
forRow:GUI_ROW(GAME, PROCEDURALLYTEXTUREDPLANETS)
align:GUI_ALIGN_CENTER];
3271 if (guiSelectedRow ==
GUI_ROW(GAME, SHADEREFFECTS) && ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUILEFT])) {
3273 int direction = ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT]) ? 1 : -1;
3297 [UNIVERSE setDetailLevel:detailLevel];
3298 detailLevel = [UNIVERSE detailLevel];
3300 NSString* shaderEffectsOptionsString =
OOExpand(
@"gameoptions-detaillevel-[detailLevel]", detailLevel);
3301 [
gui setText:OOExpandKey(shaderEffectsOptionsString)
forRow:GUI_ROW(GAME, SHADEREFFECTS)
align:GUI_ALIGN_CENTER];
3316 if ((guiSelectedRow ==
GUI_ROW(GAME, DISPLAYSTYLE)) && selectKeyPress) {
3323 if ((guiSelectedRow ==
GUI_ROW(GAME, DOCKINGCLEARANCE)) && (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) || ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT]))) {
3324 if (([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT]) != [
UNIVERSE dockingClearanceProtocolActive])
3326 [UNIVERSE setDockingClearanceProtocolActive:([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[BUTTON_GUIRIGHT])];
3327 if ([
UNIVERSE dockingClearanceProtocolActive])
3328 [
gui setText:DESC(@"gameoptions-docking-clearance-yes")
forRow:GUI_ROW(GAME, DOCKINGCLEARANCE)
align:GUI_ALIGN_CENTER];
3330 [
gui setText:DESC(@"gameoptions-docking-clearance-no")
forRow:GUI_ROW(GAME, DOCKINGCLEARANCE)
align:GUI_ALIGN_CENTER];
3333 if ((guiSelectedRow ==
GUI_ROW(GAME, BACK)) && selectKeyPress) {
3347 joyButtonState[BUTTON_GUIRIGHT] || joyButtonState[BUTTON_GUILEFT] || joyButtonState[BUTTON_GUIPAGEUP] || joyButtonState[BUTTON_GUIPAGEDOWN];
3350 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
3353 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
3356 int from_function = 0;
3357 NSArray* keyComponents = [
key componentsSeparatedByString:@":"];
3358 if ([keyComponents
count] > 1) {
3360 if (from_function < 0)
3365 [[UNIVERSE gui] setSelectedRow:GUI_ROW_KC_FUNCSTART];
3367 if (from_function == 0) {
3368 [[UNIVERSE gui] setSelectedRow:GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
3383 || joyButtonState[BUTTON_GUILEFT] || joyButtonState[BUTTON_GUIRIGHT] || joyButtonState[BUTTON_GUIPAGEUP] || joyButtonState[BUTTON_GUIPAGEDOWN];
3386 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down]) {
3389 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up]) {
3392 int from_function = 0;
3393 NSArray* keyComponents = [
key componentsSeparatedByString:@":"];
3394 if ([keyComponents
count] > 1) {
3396 if (from_function < 0)
3401 [[UNIVERSE gui] setSelectedRow:GUI_ROW_KC_FUNCSTART];
3403 if (from_function == 0) {
3404 [[UNIVERSE gui] setSelectedRow:GUI_ROW_KC_FUNCSTART + MAX_ROWS_KC_FUNCTIONS - 1];
3419 joyButtonState[BUTTON_GUIRIGHT] || joyButtonState[BUTTON_GUILEFT] || joyButtonState[BUTTON_GUIPAGEUP] || joyButtonState[BUTTON_GUIPAGEDOWN];
3422 if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
3425 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
3428 int from_function = 0;
3429 NSArray* keyComponents = [
key componentsSeparatedByString:@":"];
3430 if ([keyComponents
count] > 1) {
3432 if (from_function < 0)
3437 [[UNIVERSE gui] setSelectedRow:GUI_ROW_FUNCSTART];
3439 if (from_function == 0) {
3440 [[UNIVERSE gui] setSelectedRow:GUI_ROW_FUNCSTART + MAX_ROWS_FUNCTIONS - 1];
3445 if ([gameView isDown:
' '])
3452 static Vector viewOffset;
3453 static Vector rotationCenter;
3456 static BOOL mouse_clicked = NO;
3457 static NSPoint mouse_clicked_position;
3458 static BOOL shift_down;
3459 static BOOL caps_on = NO;
3460 static NSTimeInterval last_time = 0.0;
3465 if (!
customView_pressed && [_customViews
count] != 0 && gui_screen != GUI_SCREEN_LONG_RANGE_CHART && ![gameView allowingStringInput]) {
3466 if ([
UNIVERSE viewDirection] == VIEW_CUSTOM)
3469 _customViewIndex = (_customViewIndex + 1) % [_customViews
count];
3479 NSTimeInterval this_time = [
NSDate timeIntervalSinceReferenceDate];
3480 if ([
UNIVERSE viewDirection] > VIEW_STARBOARD && [gameView isCapsLockOn]) {
3489 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) {
3492 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) {
3495 if ([
self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES]) {
3498 if ([
self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES]) {
3501 if ([
self checkKeyPress:n_key_custom_view_roll_right ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_roll_left ignore_ctrl:YES]) {
3504 if ([
self checkKeyPress:n_key_custom_view_pan_right ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_left ignore_ctrl:YES]) {
3507 if ([
self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES]) {
3510 if ([
self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES]) {
3513 if ([
self checkKeyPress:n_key_custom_view_rotate_down ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_up ignore_ctrl:YES]) {
3516 if ([
self checkKeyPress:n_key_custom_view_pan_up ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_pan_down ignore_ctrl:YES]) {
3519 if ([
self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES]) {
3522 if ([
self checkKeyPress:n_key_custom_view_rotate_right ignore_ctrl:YES] && ![
self checkKeyPress:n_key_custom_view_rotate_left ignore_ctrl:YES]) {
3526 if (!mouse_clicked || shift_down != [gameView isShiftDown]) {
3527 mouse_clicked = YES;
3528 viewQuaternion = [PLAYER customViewQuaternion];
3529 viewOffset = [PLAYER customViewOffset];
3530 rotationCenter = [PLAYER customViewRotationCenter];
3531 up = [PLAYER customViewUpVector];
3532 right = [PLAYER customViewRightVector];
3541 Quaternion newViewQuaternion = viewQuaternion;
3542 if ([gameView isShiftDown]) {
3544 [PLAYER setCustomViewQuaternion:newViewQuaternion];
3545 [PLAYER setCustomViewRotationCenter:vector_subtract(viewOffset,
3546 vector_multiply_scalar([PLAYER customViewForwardVector],
3547 dot_product([PLAYER customViewForwardVector], viewOffset)))];
3551 [PLAYER setCustomViewQuaternion:newViewQuaternion];
3554 [PLAYER setCustomViewOffset:vector_add(offset, rotationCenter)];
3563 if ([
self isMouseControlOn])
3567 last_time = this_time;
3578 NSPoint virtualView = NSZeroPoint;
3579 double view_threshold = 0.5;
3581 if ([stickHandler joystickCount]) {
3584 virtualView.y = 0.0;
3586 virtualView.x = 0.0;
3587 if (fabs(virtualView.y) >= fabs(virtualView.x))
3588 virtualView.x = 0.0;
3590 virtualView.y = 0.0;
3596 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])) {
3599 if (([
self checkKeyPress:n_key_view_aft]) || (virtualView.y > view_threshold) || joyButtonState[
BUTTON_VIEWAFT]) {
3602 if (([
self checkKeyPress:n_key_view_port]) || (virtualView.x < -view_threshold) || joyButtonState[
BUTTON_VIEWPORT]) {
3605 if (([
self checkKeyPress:n_key_view_starboard]) || (virtualView.x > view_threshold) || joyButtonState[
BUTTON_VIEWSTARBOARD]) {
3614 if (!scanner_zoom_rate) {
3615 if ([hud scannerZoom] < 5.0) {
3630 if ((!scanner_zoom_rate) && ([hud scannerZoom] > 1.0))
3634 if (
EXPECT([[
self hud] isCompassActive]))
3646 if ([
self checkKeyPress:n_key_next_compass_mode] || joyButtonState[
BUTTON_COMPASSMODE])
3660 if (![
self checkKeyPress:n_key_cycle_previous_mfd] || joyButtonState[
BUTTON_MFDCYCLEPREV]) {
3673 if ([[
self hud] mfdCount] > 1) {
3689 if ([
self checkKeyPress:n_key_comms_log]) {
3690 [UNIVERSE showCommsLog:1.5];
3691 [
hud refreshLastTransmitter];
3695- (void)pollFlightArrowKeyControls:(
double)delta_t
3700 NSPoint virtualStick = NSZeroPoint;
3701 double reqYaw = 0.0;
3707 if (mouse_control_on) {
3709 double sensitivity = 2.0;
3710 virtualStick.x *= sensitivity;
3711 virtualStick.y *= sensitivity;
3712 reqYaw = virtualStick.x;
3713 }
else if (numSticks > 0) {
3719 }
else if (virtualStick.x != 0) {
3721 keyboardRollOverride = NO;
3727 }
else if (virtualStick.y != 0) {
3729 keyboardPitchOverride = NO;
3736 }
else if (reqYaw != 0) {
3738 keyboardYawOverride = NO;
3749 double flightArrowKeyPrecisionFactor = [[
NSUserDefaults standardUserDefaults] oo_doubleForKey:@"flight-arrow-key-precision-factor" defaultValue:0.5];
3750 if (flightArrowKeyPrecisionFactor < 0.05)
3751 flightArrowKeyPrecisionFactor = 0.05;
3752 if (flightArrowKeyPrecisionFactor > 1.0)
3753 flightArrowKeyPrecisionFactor = 1.0;
3758 if ([
self checkNavKeyPress:n_key_roll_left] && [
self checkNavKeyPress:n_key_roll_right]) {
3759 keyboardRollOverride = YES;
3761 }
else if ([
self checkNavKeyPress:n_key_roll_left] && !capsLockCustomView) {
3762 keyboardRollOverride = YES;
3763 if (flightRoll > 0.0)
3765 [
self decrease_flight_roll:isCtrlDown ? flightArrowKeyPrecisionFactor * roll_dampner * roll_delta : delta_t * roll_delta];
3767 }
else if ([
self checkNavKeyPress:n_key_roll_right] && !capsLockCustomView) {
3768 keyboardRollOverride = YES;
3769 if (flightRoll < 0.0)
3771 [
self increase_flight_roll:isCtrlDown ? flightArrowKeyPrecisionFactor * roll_dampner * roll_delta : delta_t * roll_delta];
3775 if (((mouse_control_on && !
mouse_x_axis_map_to_yaw) || numSticks) && !keyboardRollOverride && !capsLockCustomView) {
3776 stick_roll = max_flight_roll * virtualStick.x;
3777 if (flightRoll < stick_roll) {
3779 if (flightRoll > stick_roll)
3780 flightRoll = stick_roll;
3782 if (flightRoll > stick_roll) {
3784 if (flightRoll < stick_roll)
3785 flightRoll = stick_roll;
3787 rolling = (fabs(virtualStick.x) > 0.0);
3790 if (flightRoll > 0.0) {
3791 if (flightRoll > roll_dampner)
3796 if (flightRoll < 0.0) {
3797 if (flightRoll < -roll_dampner)
3806 if (!mouse_control_on) {
3807 if ([
self checkNavKeyPress:n_key_pitch_back] && [
self checkNavKeyPress:n_key_pitch_forward]) {
3808 keyboardPitchOverride = YES;
3810 }
else if ([
self checkNavKeyPress:n_key_pitch_back] && !capsLockCustomView) {
3811 keyboardPitchOverride = YES;
3812 if (flightPitch < 0.0)
3814 [
self increase_flight_pitch:isCtrlDown ? flightArrowKeyPrecisionFactor * pitch_dampner * pitch_delta : delta_t * pitch_delta];
3816 }
else if ([
self checkNavKeyPress:n_key_pitch_forward] && !capsLockCustomView) {
3817 keyboardPitchOverride = YES;
3818 if (flightPitch > 0.0)
3820 [
self decrease_flight_pitch:isCtrlDown ? flightArrowKeyPrecisionFactor * pitch_dampner * pitch_delta : delta_t * pitch_delta];
3824 if ((mouse_control_on || (numSticks && !keyboardPitchOverride)) && !capsLockCustomView) {
3825 stick_pitch = max_flight_pitch * virtualStick.y;
3826 if (flightPitch < stick_pitch) {
3828 if (flightPitch > stick_pitch)
3829 flightPitch = stick_pitch;
3831 if (flightPitch > stick_pitch) {
3833 if (flightPitch < stick_pitch)
3834 flightPitch = stick_pitch;
3836 pitching = (fabs(virtualStick.y) > 0.0);
3839 if (flightPitch > 0.0) {
3840 if (flightPitch > pitch_dampner)
3845 if (flightPitch < 0.0) {
3846 if (flightPitch < -pitch_dampner)
3856 if ([
self checkNavKeyPress:n_key_yaw_left] && [
self checkNavKeyPress:n_key_yaw_right]) {
3857 keyboardYawOverride = YES;
3859 }
else if ([
self checkNavKeyPress:n_key_yaw_left] && !capsLockCustomView) {
3860 keyboardYawOverride = YES;
3861 if (flightYaw < 0.0)
3863 [
self increase_flight_yaw:isCtrlDown ? flightArrowKeyPrecisionFactor * yaw_dampner * yaw_delta : delta_t * yaw_delta];
3865 }
else if ([
self checkNavKeyPress:n_key_yaw_right] && !capsLockCustomView) {
3866 keyboardYawOverride = YES;
3867 if (flightYaw > 0.0)
3869 [
self decrease_flight_yaw:isCtrlDown ? flightArrowKeyPrecisionFactor * yaw_dampner * yaw_delta : delta_t * yaw_delta];
3873 if (((mouse_control_on &&
mouse_x_axis_map_to_yaw) || numSticks) && !keyboardYawOverride && !capsLockCustomView) {
3876 stick_yaw = max_flight_yaw * (-reqYaw);
3877 if (flightYaw < stick_yaw) {
3879 if (flightYaw > stick_yaw)
3880 flightYaw = stick_yaw;
3882 if (flightYaw > stick_yaw) {
3884 if (flightYaw < stick_yaw)
3885 flightYaw = stick_yaw;
3887 yawing = (fabs(reqYaw) > 0.0);
3890 if (flightYaw > 0.0) {
3891 if (flightYaw > yaw_dampner)
3896 if (flightYaw < 0.0) {
3897 if (flightYaw < -yaw_dampner)
3910- (void)pollGuiScreenControlsWithFKeyAlias:(BOOL)fKeyAlias
3912 if (!pollControls && fKeyAlias)
3917 BOOL docked_okay = ([
self status] == STATUS_DOCKED);
3920 if ([
self checkKeyPress:n_key_gui_screen_status fKey_only:!fKeyAlias]) {
3923 if (gui_screen == GUI_SCREEN_STATUS) {
3934 if ([
self checkKeyPress:n_key_gui_chart_screens fKey_only:!fKeyAlias]) {
3940 if (
EXPECT_NOT([
self status] == STATUS_WITCHSPACE_COUNTDOWN && gui_screen == GUI_SCREEN_SHORT_RANGE_CHART)) {
3943 }
else if (gui_screen == GUI_SCREEN_SHORT_RANGE_CHART || (gui_screen == GUI_SCREEN_SYSTEM_DATA && showingLongRangeChart)) {
3945 saved_chart_zoom = target_chart_zoom;
3952 target_chart_zoom = saved_chart_zoom;
3963 if ([
self checkKeyPress:n_key_gui_system_data fKey_only:!fKeyAlias]) {
3964 if (gui_screen != GUI_SCREEN_SYSTEM_DATA) {
3965 showingLongRangeChart = (gui_screen == GUI_SCREEN_LONG_RANGE_CHART);
3971 if ([
self checkKeyPress:n_key_gui_market fKey_only:!fKeyAlias]) {
3972 if (gui_screen != GUI_SCREEN_MARKET) {
3986 if (([
self checkKeyPress:n_key_gui_screen_options fKey_only:!fKeyAlias]) && (gui_screen != GUI_SCREEN_OPTIONS)) {
3991 if ([
self checkKeyPress:n_key_gui_screen_equipship fKey_only:!fKeyAlias]) {
3993 if ([
self dockedStation] ==
nil)
3997 if ((gui_screen == GUI_SCREEN_EQUIP_SHIP) && [[
self dockedStation] hasShipyard]) {
4019 if ([
self checkKeyPress:n_key_gui_screen_interfaces fKey_only:!fKeyAlias]) {
4032- (void)pollGameOverControls:(
double)delta_t
4035 if ([gameView isDown:32])
4038 [UNIVERSE displayMessage:@"" forCount:1.0];
4050- (void)pollAutopilotControls:(
double)delta_t
4053 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)
4059 if (![[
UNIVERSE gameController] isGamePaused]) {
4069 if ([
self checkKeyPress:n_key_autopilot] || joyButtonState[
BUTTON_DOCKCPU]
4074 [UNIVERSE addMessage:DESC(@"autopilot-off") forCount:4.5];
4095 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) {
4110 if ([
self checkKeyPress:n_key_pausebutton] || joyButtonState[
BUTTON_PAUSE]) {
4124- (void)pollDockedControls:(
double)delta_t
4129 NSString* exceptionContext =
@"setup";
4133 exceptionContext =
@"pause key";
4134 if (([
self checkKeyPress:n_key_pausebutton] || joyButtonState[
BUTTON_PAUSE]) && (gui_screen != GUI_SCREEN_LONG_RANGE_CHART && gui_screen != GUI_SCREEN_REPORT && gui_screen != GUI_SCREEN_SAVE && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY)) {
4135 BOOL isMissionScreenWithTextEntry = gui_screen == GUI_SCREEN_MISSION && _missionTextEntry;
4137 if ([gameController isGamePaused]) {
4140 if ([
UNIVERSE pauseMessageVisible]) {
4141 [UNIVERSE clearPreviousMessage];
4143 [[UNIVERSE gui] setForegroundTextureKey:@"docked_overlay"];
4146 if (!isMissionScreenWithTextEntry) {
4148 [[UNIVERSE messageGUI] clear];
4150 [UNIVERSE pauseGame];
4154 if (!isMissionScreenWithTextEntry) {
4161 if ([gameController isGamePaused])
4165 exceptionContext =
@"undock";
4166 if ([
self checkKeyPress:n_key_launch_ship]) {
4167 if (
EXPECT((gui_screen != GUI_SCREEN_MISSION || _missionAllowInterrupt) && gui_screen != GUI_SCREEN_KEYBOARD_ENTRY)) {
4175 exceptionContext =
@"GUI keys";
4176 if (gui_screen == GUI_SCREEN_MISSION || gui_screen == GUI_SCREEN_KEYBOARD_ENTRY) {
4179 if (gui_screen != GUI_SCREEN_REPORT)
4185 @catch (NSException* exception) {
4186 OOLog(
kOOLogException,
@"***** Exception in pollDockedControls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
4193 [UNIVERSE setUpUniverseFromStation];
4194 if ([
self dockedStation] ==
nil)
4204- (void)pollDemoControls:(
double)delta_t
4208 NSUInteger end_row = 21;
4212 switch (gui_screen) {
4213 case GUI_SCREEN_INTRO1:
4221 [UNIVERSE removeDemoShips];
4223 if (![
self loadPlayer]) {
4232 }
else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select] || joyButtonState[
BUTTON_GUISELECT]) && [gui selectedRow] == 3 + row_zero) {
4234 }
else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select] || joyButtonState[
BUTTON_GUISELECT]) && [gui selectedRow] == 4 + row_zero) {
4236 }
else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select] || joyButtonState[
BUTTON_GUISELECT]) && [gui selectedRow] == 5 + row_zero) {
4238 }
else if (([gameView isDown:
gvMouseDoubleClick] || [
self checkKeyPress:n_key_gui_select] || joyButtonState[
BUTTON_GUISELECT]) && [gui selectedRow] == 6 + row_zero) {
4239 [[UNIVERSE gameController] exitAppWithContext:@"Exit Game selected on start screen"];
4251 case GUI_SCREEN_GAMEOPTIONS:
4255 case GUI_SCREEN_KEYBOARD:
4263 case GUI_SCREEN_KEYBOARD_CONFIRMCLEAR:
4267 case GUI_SCREEN_KEYBOARD_CONFIG:
4271 case GUI_SCREEN_KEYBOARD_ENTRY:
4275 case GUI_SCREEN_KEYBOARD_LAYOUT:
4279 case GUI_SCREEN_STICKMAPPER:
4283 case GUI_SCREEN_STICKPROFILE:
4287 case GUI_SCREEN_SHIPLIBRARY:
4288 if ([gameView isDown:
' '])
4293 if ([
self checkKeyPress:n_key_gui_arrow_up] || joyButtonState[
BUTTON_GUIUP])
4296 [UNIVERSE selectIntro2Previous];
4298 if ([
self checkKeyPress:n_key_gui_arrow_down] || joyButtonState[
BUTTON_GUIDOWN])
4301 [UNIVERSE selectIntro2Next];
4305 if ([
self checkKeyPress:n_key_gui_arrow_left] || joyButtonState[
BUTTON_GUILEFT])
4308 [UNIVERSE selectIntro2PreviousCategory];
4310 if ([
self checkKeyPress:n_key_gui_arrow_right] || joyButtonState[
BUTTON_GUIRIGHT])
4313 [UNIVERSE selectIntro2NextCategory];
4319 case GUI_SCREEN_NEWGAME:
4320 if ([
self handleGUIUpDownArrowKeys]) {
4325 if ([
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUIPAGEUP]) {
4333 }
else if ([
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
4347 if (![
self startScenario]) {
4348 [UNIVERSE removeDemoShips];
4359 case GUI_SCREEN_OXZMANAGER:
4362 if (
EXPECT(![oxzmanager isRestarting])) {
4363 if ([oxzmanager isAcceptingGUIInput]) {
4364 if ([oxzmanager isAcceptingTextInput]) {
4370 if ([
self handleGUIUpDownArrowKeys]) {
4374 if ([
self checkKeyPress:n_key_gui_arrow_left] || [
self checkKeyPress:n_key_gui_page_up] || joyButtonState[
BUTTON_GUILEFT] || joyButtonState[
BUTTON_GUIPAGEUP]) {
4378 }
else if ([
self checkKeyPress:n_key_gui_arrow_right] || [
self checkKeyPress:n_key_gui_page_down] || joyButtonState[
BUTTON_GUIRIGHT] || joyButtonState[
BUTTON_GUIPAGEDOWN]) {
4388 if ([oxzmanager isAcceptingTextInput]) {
4400 if ([
self checkKeyPress:n_key_oxzmanager_setfilter] ||
4401 [
self checkKeyPress:n_key_oxzmanager_showinfo] ||
4402 [
self checkKeyPress:n_key_oxzmanager_copyurl] ||
4403 [
self checkKeyPress:n_key_oxzmanager_extract]) {
4406 if ([
self checkKeyPress:n_key_oxzmanager_setfilter]) {
4408 }
else if ([
self checkKeyPress:n_key_oxzmanager_showinfo]) {
4410 }
else if ([
self checkKeyPress:n_key_oxzmanager_copyurl]) {
4412 }
else if ([
self checkKeyPress:n_key_oxzmanager_extract]) {
4422 case GUI_SCREEN_MISSION:
4423 if ([[
self hud] allowBigGui]) {
4426 if (_missionTextEntry) {
4444 }
else if ([[gui keyForRow:end_row] isEqual:
@"spacebar"]) {
4445 if ([gameView isDown:32])
4458 NSString* extraKey =
@"";
4459 if (extraMissionKeys) {
4460 NSString* key =
nil;
4461 foreach (key, [extraMissionKeys allKeys]) {
4462 if ([
self checkKeyPress:[extraMissionKeys oo_arrayForKey:key]]) {
4464 extraKey = [
key copy];
4478 if ([extraKey length] == 0)
4479 extraKey =
@"enter";
4498 case GUI_SCREEN_LOAD: {
4500 if (commanderFile) {
4517 if (_missionAllowInterrupt) {
4518 if (gui_screen == GUI_SCREEN_MISSION && _missionTextEntry) {
4523 if (gui_screen != GUI_SCREEN_MISSION) {
4524 if (gui_screen != GUI_SCREEN_SYSTEM_DATA) {
4525 [UNIVERSE removeDemoShips];
4534 [UNIVERSE removeDemoShips];
4535 [[UNIVERSE gui] clearBackground];
4539 if ([
self status] != STATUS_DOCKED)
4542 if (_missionWithCallback) {
4546 if ([
self status] != STATUS_DOCKED)
4551 if (gui_screen != GUI_SCREEN_MISSION)
4564 if ([
self status] != STATUS_DOCKED) {
4569 switch (_missionExitScreen) {
4570 case GUI_SCREEN_MANIFEST:
4574 case GUI_SCREEN_EQUIP_SHIP:
4578 case GUI_SCREEN_SHIPYARD:
4579 if ([[
self dockedStation] hasShipyard]) {
4582 [[UNIVERSE gui] setSelectedRow:GUI_ROW_SHIPYARD_START];
4589 case GUI_SCREEN_LONG_RANGE_CHART:
4592 case GUI_SCREEN_SHORT_RANGE_CHART:
4595 case GUI_SCREEN_SYSTEM_DATA:
4599 case GUI_SCREEN_MARKET:
4603 case GUI_SCREEN_MARKETINFO:
4607 case GUI_SCREEN_INTERFACES:
4610 case GUI_SCREEN_STATUS:
4621- (void)switchToThisView:(
OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing
4626- (void)switchToThisView:(
OOViewID)viewDirection fromView:(
OOViewID)oldViewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing justNotify:(BOOL)justNotify
4631 [UNIVERSE setViewDirection:viewDirection];
4633 if (processWeaponFacing) {
4635 switch (viewDirection) {
4648 case VIEW_STARBOARD:
4657 currentWeaponFacing = facing;
4663 if ((oldViewDirection != viewDirection || viewDirection == VIEW_CUSTOM) && ![[
UNIVERSE gameController] isGamePaused]) {
4671- (void)handleAutopilotOn:(BOOL)fastDocking
4673 NSString* message =
nil;
4685 if (![target isStation]) {
4691 for (i = 0; i < uni->
n_entities && nStations < 2; i++) {
4694 target = entities[
i];
4701 if ([
self withinStationAegis] && legalStatus <= 50) {
4702 target = [UNIVERSE station];
4703 }
else if (nStations != 1) {
4704 if (nStations == 0) {
4709 message =
OOExpandKey(
@"autopilot-multiple-targets");
4721 if (![ts allowsAutoDocking]) {
4723 message =
OOExpandKey(
@"autopilot-station-does-not-allow-autodocking", stationName);
4726 else if ((legalStatus > 50 && ts == [
UNIVERSE station]) || [ts isHostileTo:
self]) {
4728 message =
OOExpandKey((ts == [
UNIVERSE station]) ?
@"autopilot-denied" :
@"autopilot-target-docking-instructions-denied", stationName);
4731 else if (fastDocking && [ts allowsFastDocking]) {
4733 NSEnumerator* subEnum =
nil;
4735 for (subEnum = [ts dockSubEntityEnumerator]; (sub = [
subEnum nextObject]);) {
4737 if ([[sub canAcceptShipForDocking:
self] isEqualToString:
@"TOO_BIG_TO_DOCK"]) {
4738 message =
OOExpandKey((ts == [
UNIVERSE station]) ?
@"autopilot-denied" :
@"autopilot-target-docking-instructions-denied", stationName);
4743 if (legalStatus > 0) {
4746 int government = 1 + [[UNIVERSE currentSystemData] oo_intForKey:KEY_GOVERNMENT];
4747 if ([
UNIVERSE inInterstellarSpace])
4749 fine_chance /= government;
4750 if (fine_chance < legalStatus) {
4757 [UNIVERSE forceWitchspaceEntries];
4758 ship_clock_adjust += 1200.0;
4761 [UNIVERSE setViewDirection:VIEW_FORWARD];
4772 [UNIVERSE addMessage:message forCount:4.5];
4783 ident_engaged = YES;
4784 if ([
self primaryTarget] ==
nil) {
4786 [UNIVERSE addMessage:OOExpandKey(@"ident-on") forCount:2.0];
4795 if (![
self weaponsOnline]) {
4807 if ([missile_entity[activeMissile] isMissile]) {
4808 if ([[
self primaryTarget] isShip]) {
4815 if ([
self primaryTarget] !=
nil) {
4820 [UNIVERSE addMessage:OOExpandKey(@"missile-armed", weaponName) forCount:2.0];
4823 }
else if ([missile_entity[activeMissile] isMine]) {
4825 [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
#define MIN_HDR_MAXBRIGHTNESS
#define MIN_HDR_PAPERWHITE
#define MAX_HDR_MAXBRIGHTNESS
#define MAX_HDR_PAPERWHITE
OOINLINE jsval OOJSValueFromViewID(JSContext *context, OOViewID value)
#define OOInitDebugSupport()
OOINLINE double OOClamp_0_max_d(double value, double max) INLINE_CONST_FUNC
OOINLINE float OOClamp_0_max_f(float value, float max) INLINE_CONST_FUNC
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) NONNULL_FUNC
#define OOExpandKey(key,...)
#define OOExpand(string,...)
NSString * OOCommodityType
uint64_t OOCreditsQuantity
@ WEAPON_FACING_STARBOARD
OOINLINE Vector vector_flip(Vector v) INLINE_CONST_FUNC
OOINLINE Vector vector_add(Vector a, Vector b) INLINE_CONST_FUNC
OOINLINE Vector vector_subtract(Vector a, Vector b) INLINE_CONST_FUNC
OOINLINE OOScalar magnitude(Vector vec) INLINE_CONST_FUNC
OOINLINE void scale_vector(Vector *outVector, OOScalar factor) ALWAYS_INLINE_FUNC NONNULL_FUNC
OOINLINE Vector vector_multiply_scalar(Vector v, OOScalar s) INLINE_CONST_FUNC
OOINLINE Vector vector_normal(Vector vec) INLINE_CONST_FUNC
#define MAX_ROWS_SHIPS_FOR_SALE
#define GUI_ROW_SHIPYARD_START
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 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
#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 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
#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 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 setFov:fromFraction:(float value,[fromFraction] BOOL fromFraction)
NSMutableString * typedString
void setScreenSize:(int sizeIndex)
NSPoint virtualJoystickPosition
float fov:(BOOL inFraction)
void clearKey:(int theKey)
BOOL snapShot:(NSString *filename)
void setStringInput:(enum StringInput value)
void allowStringInput:(BOOL value)
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()
BOOL doWorldEventUntilMissionScreen:(OOJSPropID message)
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)
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 doScriptEvent:(OOJSPropID message)
void decrease_flight_roll:(double delta)
void doScriptEvent:withArguments:(OOJSPropID message,[withArguments] NSArray *arguments)
void setStatus:(OOEntityStatus stat)
void decrease_flight_yaw:(double delta)
void doScriptEvent:withArgument:andArgument:(OOJSPropID message,[withArgument] id argument1,[andArgument] id argument2)
ShipEntity * shipHitByLaser()
void doScriptEvent:withArgument:(OOJSPropID message,[withArgument] id argument)
void increase_flight_yaw:(double delta)
void decrease_flight_pitch:(double delta)
void increase_flight_pitch:(double delta)
void increase_flight_roll:(double delta)
Entity * sortedEntities[UNIVERSE_MAX_ENTITIES+1]
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque