Oolite
Loading...
Searching...
No Matches
PlayerEntity(Controls) Category Reference

#include <PlayerEntityControls.h>

Instance Methods

(void) - initControls
 
(void) - initKeyConfigSettings
 
(void) - pollControls:
 
(BOOL) - handleGUIUpDownArrowKeys
 
(void) - clearPlanetSearchString
 
(void) - targetNewSystem:
 
(void) - switchToMainView
 
(void) - noteSwitchToView:fromView:
 
(void) - beginWitchspaceCountdown:
 
(void) - beginWitchspaceCountdown
 
(void) - cancelWitchspaceCountdown
 
(NSArray *) - processKeyCode:
 
(BOOL) - checkNavKeyPress:
 
(BOOL) - checkKeyPress:
 
(BOOL) - checkKeyPress:fKey_only:
 
(BOOL) - checkKeyPress:ignore_ctrl:
 
(BOOL) - checkKeyPress:fKey_only:ignore_ctrl:
 
(int- getFirstKeyCode:
 
(void) - targetNewSystem:whileTyping: [implementation]
 

Detailed Description

Definition at line 30 of file PlayerEntityControls.h.

Method Documentation

◆ beginWitchspaceCountdown

- (void) beginWitchspaceCountdown

Definition at line 164 of file PlayerEntityControls.m.

889{
890 if ([self hasHyperspaceMotor]) {
891 [self beginWitchspaceCountdown:hyperspaceMotorSpinTime];
892 }
893}

◆ beginWitchspaceCountdown:

- (void) beginWitchspaceCountdown: (int spin_time

Definition at line 164 of file PlayerEntityControls.m.

853 :(int)spin_time
854{
855 if ([self hasHyperspaceMotor])
856 {
857 if (spin_time == 0)
858 {
859 witchspaceCountdown = hyperspaceMotorSpinTime;
860 }
861 else
862 {
863#ifndef OO_DUMP_PLANETINFO
864 if (spin_time < 5)
865 {
866 witchspaceCountdown = 5;
867 }
868 else
869#endif
870 {
871 witchspaceCountdown = spin_time;
872 }
873 }
874 [self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
875 [self playStandardHyperspace];
876 // say it!
877 [UNIVERSE clearPreviousMessage];
878 int seconds = round(witchspaceCountdown);
879 NSString *destination = [UNIVERSE getSystemName:[self nextHopTargetSystemID]];
880 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
881 [self doScriptEvent:OOJSID("playerStartedJumpCountdown")
882 withArguments:[NSArray arrayWithObjects:@"standard", [NSNumber numberWithFloat:witchspaceCountdown], nil]];
883 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
884 }
885}
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

◆ cancelWitchspaceCountdown

- (void) cancelWitchspaceCountdown

Definition at line 164 of file PlayerEntityControls.m.

897{
898 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN) {
899 [self setStatus:STATUS_IN_FLIGHT];
900 [self playHyperspaceAborted];
901 }
902 // say it!
903 [UNIVERSE clearPreviousMessage];
904 [self doScriptEvent:OOJSID("playerCancelledJumpCountdown")];
905}

◆ checkKeyPress:

- (BOOL) checkKeyPress: (NSArray*)  key_def

Definition at line 164 of file PlayerEntityControls.m.

610 :(NSArray*)key_def
611{
612 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:NO];
613}

◆ checkKeyPress:fKey_only:

- (BOOL) checkKeyPress: (NSArray*)  key_def
fKey_only: (BOOL)  fKey_only 

Definition at line 164 of file PlayerEntityControls.m.

616 :(NSArray*)key_def fKey_only:(BOOL)fKey_only
617{
618 return [self checkKeyPress:key_def fKey_only:fKey_only ignore_ctrl:NO];
619}

◆ checkKeyPress:fKey_only:ignore_ctrl:

- (BOOL) checkKeyPress: (NSArray*)  key_def
fKey_only: (BOOL)  fKey_only
ignore_ctrl: (BOOL)  ignore_ctrl 

Definition at line 164 of file PlayerEntityControls.m.

628 :(NSArray*)key_def fKey_only:(BOOL)fKey_only ignore_ctrl:(BOOL)ignore_ctrl
629{
630 MyOpenGLView *gameView = [UNIVERSE gameView];
631 int i;
632 for (i = 0; i < [key_def count]; i++)
633 {
634 NSDictionary *def = [key_def objectAtIndex:i];
635 int keycode = [[def objectForKey:@"key"] intValue];
636 // skip normal keys if the fKey_only flag is set
637 // note: if the player has remapped the gui screen keys to not include function keys, they will not be able to
638 // switch screens directly (they would need to finish the task - ie press enter, or use the escape key to cancel the function)
639 // note: the logic below now means that the state of the modifiers must match the requirements for the key binding, including
640 // when all settings are off. This means, if the player presses two functions at once, one that requires a modifier and
641 // one that doesn't, the one that doesn't will not be triggered.
642 if (fKey_only == YES && (keycode < gvFunctionKey1 || keycode > gvFunctionKey11)) continue;
643 if ([gameView isDown:keycode]
644 && ([[def objectForKey:@"shift"] boolValue] == [gameView isShiftDown])
645 && (ignore_ctrl || ([[def objectForKey:@"mod1"] boolValue] == [gameView isCtrlDown]))
646 && ([[def objectForKey:@"mod2"] boolValue] == [gameView isOptDown])
647 ) return YES;
648 }
649 return NO;
650}
@ gvFunctionKey11

◆ checkKeyPress:ignore_ctrl:

- (BOOL) checkKeyPress: (NSArray*)  key_def
ignore_ctrl: (BOOL)  ignore_ctrl 

Definition at line 164 of file PlayerEntityControls.m.

622 :(NSArray*)key_def ignore_ctrl:(BOOL)ignore_ctrl
623{
624 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:ignore_ctrl];
625}

◆ checkNavKeyPress:

- (BOOL) checkNavKeyPress: (NSArray*)  key_def

Definition at line 164 of file PlayerEntityControls.m.

597 :(NSArray*)key_def
598{
599 MyOpenGLView *gameView = [UNIVERSE gameView];
600 int i;
601 for (i = 0; i < [key_def count]; i++)
602 {
603 NSDictionary *def = [key_def objectAtIndex:i];
604 if ([gameView isDown:[[def objectForKey:@"key"] intValue]]) return YES;
605 }
606 return NO;
607}

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Definition at line 164 of file PlayerEntityControls.m.

817{
818 [[UNIVERSE gameView] resetTypedString];
819 if (planetSearchString) [planetSearchString release];
820 planetSearchString = nil;
821}
return nil

◆ getFirstKeyCode:

- (int) getFirstKeyCode: (NSArray*)  key_def

Definition at line 164 of file PlayerEntityControls.m.

653 :(NSArray*)key_def
654{
655 NSDictionary *def = [key_def objectAtIndex:0];
656 return [[def objectForKey:@"key"] intValue];
657}

◆ handleGUIUpDownArrowKeys

- (BOOL) handleGUIUpDownArrowKeys

Definition at line 164 of file PlayerEntityControls.m.

714{
715 MyOpenGLView *gameView = [UNIVERSE gameView];
716 GuiDisplayGen *gui = [UNIVERSE gui];
717 BOOL result = NO;
718 BOOL arrow_up = [self checkKeyPress:n_key_gui_arrow_up];
719 BOOL arrow_down = [self checkKeyPress:n_key_gui_arrow_down];
720 BOOL mouse_click = [gameView isDown:gvMouseLeftButton];
721 BOOL mouse_dbl_click = [gameView isDown:gvMouseDoubleClick];
722
723 if (arrow_down)
724 {
725 if ((!upDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL))
726 {
727 if ([gui setNextRow: +1])
728 {
729 result = YES;
730 }
731 else
732 {
733 if ([gui setFirstSelectableRow]) result = YES;
734 }
735
736 if (result && [gui selectableRange].length > 1) [self playMenuNavigationDown];
737 else [self playMenuNavigationNot];
738
739 timeLastKeyPress = script_time;
740 }
741 }
742
743 if (arrow_up)
744 {
745 if ((!upDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL))
746 {
747 if ([gui setNextRow: -1])
748 {
749 result = YES;
750 }
751 else
752 {
753 if ([gui setLastSelectableRow]) result = YES;
754 }
755
756 if (result && [gui selectableRange].length > 1) [self playMenuNavigationUp];
757 else [self playMenuNavigationNot];
758
759 timeLastKeyPress = script_time;
760 }
761 }
762
763 if (mouse_click)
764 {
765 if (!upDownKeyPressed)
766 {
767 int click_row = 0;
768 if (UNIVERSE)
769 click_row = UNIVERSE->cursor_row;
770 if ([gui setSelectedRow:click_row])
771 {
772 result = YES;
773 }
774 }
775 }
776 if (mouse_dbl_click)
777 {
778 int click_row = 0;
779 if (UNIVERSE)
780 click_row = UNIVERSE->cursor_row;
781 if ([gui setSelectedRow:click_row])
782 {
783 result = YES;
784 }
785 else
786 {
787 // if double-clicked on an unselectable row, clear the
788 // state so it doesn't activate whatever was last
789 // selected
790 [gameView clearMouse];
791 }
792 }
793
794
795 upDownKeyPressed = (arrow_up || arrow_down || mouse_click);
796
797 return result;
798}
static BOOL upDownKeyPressed
static double timeLastKeyPress
#define KEY_REPEAT_INTERVAL
#define UNIVERSE
Definition Universe.h:842
BOOL isDown:(int key)

◆ initControls

- (void) initControls

Definition at line 164 of file PlayerEntityControls.m.

205{
206 [keyCodeLookups release];
207 // all entries in this dict must be in lowercase
208 keyCodeLookups = [[NSDictionary alloc] initWithObjectsAndKeys:
209 [NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"arrowleft",
210 [NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"leftarrow",
211 [NSNumber numberWithUnsignedShort:gvArrowKeyLeft], @"left",
212 [NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"arrowright",
213 [NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"rightarrow",
214 [NSNumber numberWithUnsignedShort:gvArrowKeyRight], @"right",
215 [NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"arrowup",
216 [NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"uparrow",
217 [NSNumber numberWithUnsignedShort:gvArrowKeyUp], @"up",
218 [NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"arrowdown",
219 [NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"downarrow",
220 [NSNumber numberWithUnsignedShort:gvArrowKeyDown], @"down",
221 [NSNumber numberWithUnsignedShort:gvPageUpKey], @"pageup",
222 [NSNumber numberWithUnsignedShort:gvPageDownKey], @"pagedown",
223 [NSNumber numberWithUnsignedShort:13], @"enter",
224 [NSNumber numberWithUnsignedShort:13], @"return",
225 [NSNumber numberWithUnsignedShort:27], @"escape",
226 [NSNumber numberWithUnsignedShort:27], @"esc",
227 [NSNumber numberWithUnsignedShort:9], @"tab",
228 [NSNumber numberWithUnsignedShort:32], @"space",
229 [NSNumber numberWithUnsignedShort:32], @"spc",
230 [NSNumber numberWithUnsignedShort:gvHomeKey], @"home",
231 [NSNumber numberWithUnsignedShort:gvEndKey], @"end",
232 [NSNumber numberWithUnsignedShort:gvDeleteKey], @"delete",
233 [NSNumber numberWithUnsignedShort:gvDeleteKey], @"del",
234 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspace",
235 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"backspc",
236 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspace",
237 [NSNumber numberWithUnsignedShort:gvBackspaceKey], @"bkspc",
238 [NSNumber numberWithUnsignedShort:gvInsertKey], @"insert",
239 [NSNumber numberWithUnsignedShort:gvInsertKey], @"ins",
240 [NSNumber numberWithUnsignedShort:gvFunctionKey1], @"f1",
241 [NSNumber numberWithUnsignedShort:gvFunctionKey2], @"f2",
242 [NSNumber numberWithUnsignedShort:gvFunctionKey3], @"f3",
243 [NSNumber numberWithUnsignedShort:gvFunctionKey4], @"f4",
244 [NSNumber numberWithUnsignedShort:gvFunctionKey5], @"f5",
245 [NSNumber numberWithUnsignedShort:gvFunctionKey6], @"f6",
246 [NSNumber numberWithUnsignedShort:gvFunctionKey7], @"f7",
247 [NSNumber numberWithUnsignedShort:gvFunctionKey8], @"f8",
248 [NSNumber numberWithUnsignedShort:gvFunctionKey9], @"f9",
249 [NSNumber numberWithUnsignedShort:gvFunctionKey10], @"f10",
250 [NSNumber numberWithUnsignedShort:gvFunctionKey11], @"f11",
251 [NSNumber numberWithUnsignedShort:gvPauseKey], @"pause",
252 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"printscreen",
253 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscrn",
254 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prntscrn",
255 [NSNumber numberWithUnsignedShort:gvPrintScreenKey], @"prtscn",
256 [NSNumber numberWithUnsignedShort:gvNumberPadKey0], @"numpad0",
257 [NSNumber numberWithUnsignedShort:gvNumberPadKey1], @"numpad1",
258 [NSNumber numberWithUnsignedShort:gvNumberPadKey2], @"numpad2",
259 [NSNumber numberWithUnsignedShort:gvNumberPadKey3], @"numpad3",
260 [NSNumber numberWithUnsignedShort:gvNumberPadKey4], @"numpad4",
261 [NSNumber numberWithUnsignedShort:gvNumberPadKey5], @"numpad5",
262 [NSNumber numberWithUnsignedShort:gvNumberPadKey6], @"numpad6",
263 [NSNumber numberWithUnsignedShort:gvNumberPadKey7], @"numpad7",
264 [NSNumber numberWithUnsignedShort:gvNumberPadKey8], @"numpad8",
265 [NSNumber numberWithUnsignedShort:gvNumberPadKey9], @"numpad9",
266 [NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpad/",
267 [NSNumber numberWithUnsignedShort:gvNumberPadKeyDivide], @"numpaddivide",
268 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpad*",
269 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMultiply], @"numpadmultiply",
270 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpad-",
271 [NSNumber numberWithUnsignedShort:gvNumberPadKeyMinus], @"numpadminus",
272 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpad+",
273 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPlus], @"numpadplus",
274 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpad.",
275 [NSNumber numberWithUnsignedShort:gvNumberPadKeyPeriod], @"numpadperiod",
276 [NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpad=",
277 [NSNumber numberWithUnsignedShort:gvNumberPadKeyEquals], @"numpadequals",
278 [NSNumber numberWithUnsignedShort:gvNumberPadKeyEnter], @"numpadenter", nil];
279
280 keyShiftText = [DESC(@"oolite-keyconfig-shift") retain];
281 keyMod1Text = [DESC(@"oolite-keyconfig-mod1") retain];
282#if OOLITE_MAC_OS_X
283 keyMod2Text = [DESC(@"oolite-keyconfig-mod2-mac") retain];
284#else
285 keyMod2Text = [DESC(@"oolite-keyconfig-mod2-pc") retain];
286#endif
287
288 [self initKeyConfigSettings];
289
290 // Enable polling
291 pollControls=YES;
292}

◆ initKeyConfigSettings

- (void) initKeyConfigSettings

Definition at line 164 of file PlayerEntityControls.m.

295{
296 NSMutableDictionary *kdicmaster = [NSMutableDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:@"keyconfig2.plist" inFolder:@"Config" mergeMode:MERGE_BASIC cache:NO]];
297 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
298 NSString *kbd = [defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
299 NSMutableDictionary *kdic2 = [NSMutableDictionary dictionaryWithDictionary:[kdicmaster objectForKey:kbd]];
300
301 unsigned i;
302 NSArray *keys = nil;
303 id key = nil;
304 NSArray *def_list = nil;
305
306 keys = [kdic2 allKeys];
307 for (i = 0; i < [keys count]; i++)
308 {
309 key = [keys objectAtIndex:i];
310 if ([[kdic2 objectForKey:key] isKindOfClass:[NSArray class]])
311 {
312 def_list = (NSArray*)[kdic2 objectForKey: key];
313 [kdic2 setObject:[self processKeyCode:def_list] forKey:key];
314 }
315 }
316
317 // load custom equipment keys/buttons
318 [customEquipActivation release];
319 if ([defaults objectForKey:KEYCONFIG_CUSTOMEQUIP])
320 {
321 NSArray *temp = [defaults arrayForKey:KEYCONFIG_CUSTOMEQUIP];
322 customEquipActivation = [[NSMutableArray arrayWithArray:temp] retain];
323 }
324 else
325 {
326 customEquipActivation = [[NSMutableArray alloc] init];
327 }
328 [customActivatePressed release];
329 [customModePressed release];
330 customActivatePressed = [[NSMutableArray alloc] init];
331 customModePressed = [[NSMutableArray alloc] init];
332 for (i = 0; i < [customEquipActivation count]; i++)
333 {
334 [customActivatePressed addObject:[NSNumber numberWithBool:NO]];
335 [customModePressed addObject:[NSNumber numberWithBool:NO]];
336 }
337
338 NSMutableArray *keyDef = nil;
339 NSString *lookup = nil;
340 NSArray *curr = nil;
341 NSDictionary *key1 = nil;
342 NSDictionary *key2 = nil;
343
344 // update with overrides from defaults file
345 NSDictionary *dict = [defaults objectForKey:KEYCONFIG_OVERRIDES];
346
347 keys = [dict allKeys];
348 for (i = 0; i < [keys count]; i++)
349 {
350 key = [keys objectAtIndex:i];
351 [kdic2 setObject:[dict objectForKey:key] forKey:key];
352 }
353
354// by default none of the standard key functions require more than 2 entries, so our macro will limit itself to 2
355// also, none of the standard key functions utilise "Alt" (mod2), so we're defaulting that setting
356#define LOAD_KEY_SETTING2(name, default_1, shift_1, mod1_1, default_2, shift_2, mod1_2) \
357 lookup = [@#name substringFromIndex:2]; \
358 curr = (NSArray*)[[kdic2 objectForKey:lookup] copy]; \
359 key1 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_1], @"key", [NSNumber numberWithBool:shift_1], @"shift", [NSNumber numberWithBool:mod1_1], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \
360 [keyDef addObject:key1]; \
361 if (default_2 > 0) \
362 { \
363 key2 = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedShort:default_2], @"key", [NSNumber numberWithBool:shift_2], @"shift", [NSNumber numberWithBool:mod1_2], @"mod1", [NSNumber numberWithBool:NO], @"mod2", nil]; \
364 [keyDef addObject:key2]; \
365 } \
366 name = curr?:keyDef; \
367 [kdic2 setObject:curr?:keyDef forKey:lookup]; \
368 [keyDef release];
369
370 LOAD_KEY_SETTING2(n_key_roll_left, gvArrowKeyLeft, NO, NO, 0, NO, NO);
371 LOAD_KEY_SETTING2(n_key_roll_right, gvArrowKeyRight, NO, NO, 0, NO, NO);
372 LOAD_KEY_SETTING2(n_key_pitch_forward, gvArrowKeyUp, NO, NO, 0, NO, NO);
373 LOAD_KEY_SETTING2(n_key_pitch_back, gvArrowKeyDown, NO, NO, 0, NO, NO);
374 LOAD_KEY_SETTING2(n_key_yaw_left, ',', NO, NO, 0, NO, NO);
375 LOAD_KEY_SETTING2(n_key_yaw_right, '.', NO, NO, 0, NO, NO);
376
377 LOAD_KEY_SETTING2(n_key_view_forward, '1', NO, NO, gvFunctionKey1, NO, NO);
378 LOAD_KEY_SETTING2(n_key_view_aft, '2', NO, NO, gvFunctionKey2, NO, NO);
379 LOAD_KEY_SETTING2(n_key_view_port, '3', NO, NO, gvFunctionKey3, NO, NO);
380 LOAD_KEY_SETTING2(n_key_view_starboard, '4', NO, NO, gvFunctionKey4, NO, NO);
381
382 LOAD_KEY_SETTING2(n_key_launch_ship, '1', NO, NO, gvFunctionKey1, NO, NO);
383 LOAD_KEY_SETTING2(n_key_gui_screen_options, '2', NO, NO, gvFunctionKey2, NO, NO);
384 LOAD_KEY_SETTING2(n_key_gui_screen_equipship, '3', NO, NO, gvFunctionKey3, NO, NO);
385 LOAD_KEY_SETTING2(n_key_gui_screen_interfaces, '4', NO, NO, gvFunctionKey4, NO, NO);
386 LOAD_KEY_SETTING2(n_key_gui_screen_status, '5', NO, NO, gvFunctionKey5, NO, NO);
387 LOAD_KEY_SETTING2(n_key_gui_chart_screens, '6', NO, NO, gvFunctionKey6, NO, NO);
388 LOAD_KEY_SETTING2(n_key_gui_system_data, '7', NO, NO, gvFunctionKey7, NO, NO);
389 LOAD_KEY_SETTING2(n_key_gui_market, '8', NO, NO, gvFunctionKey8, NO, NO);
390
391 LOAD_KEY_SETTING2(n_key_gui_arrow_left, gvArrowKeyLeft, NO, NO, 0, NO, NO);
392 LOAD_KEY_SETTING2(n_key_gui_arrow_right, gvArrowKeyRight, NO, NO, 0, NO, NO);
393 LOAD_KEY_SETTING2(n_key_gui_arrow_up, gvArrowKeyUp, NO, NO, 0, NO, NO);
394 LOAD_KEY_SETTING2(n_key_gui_arrow_down, gvArrowKeyDown, NO, NO, 0, NO, NO);
395 LOAD_KEY_SETTING2(n_key_gui_page_up, gvPageUpKey, NO, NO, 0, NO, NO);
396 LOAD_KEY_SETTING2(n_key_gui_page_down, gvPageDownKey, NO, NO, 0, NO, NO);
397 LOAD_KEY_SETTING2(n_key_gui_select, 13, NO, NO, gvNumberPadKeyEnter, NO, NO);
398
399 LOAD_KEY_SETTING2(n_key_increase_speed, 'w', NO, NO, 0, NO, NO);
400 LOAD_KEY_SETTING2(n_key_decrease_speed, 's', NO, NO, 0, NO, NO);
401 LOAD_KEY_SETTING2(n_key_inject_fuel, 'i', NO, NO, 0, NO, NO);
402
403 LOAD_KEY_SETTING2(n_key_fire_lasers, 'a', NO, NO, 0, NO, NO);
404 LOAD_KEY_SETTING2(n_key_weapons_online_toggle, '_', YES, NO, 0, NO, NO);
405 LOAD_KEY_SETTING2(n_key_launch_missile, 'm', NO, NO, 0, NO, NO);
406 LOAD_KEY_SETTING2(n_key_next_missile, 'y', NO, NO, 0, NO, NO);
407 LOAD_KEY_SETTING2(n_key_ecm, 'e', NO, NO, 0, NO, NO);
408
409 LOAD_KEY_SETTING2(n_key_prime_next_equipment, 'N', YES, NO, 0, NO, NO);
410 LOAD_KEY_SETTING2(n_key_prime_previous_equipment, 'N', YES, YES, 0, NO, NO);
411 LOAD_KEY_SETTING2(n_key_activate_equipment, 'n', NO, NO, 0, NO, NO);
412 LOAD_KEY_SETTING2(n_key_mode_equipment, 'b', NO, NO, 0, NO, NO);
413 LOAD_KEY_SETTING2(n_key_fastactivate_equipment_a, '0', NO, NO, 0, NO, NO);
414 LOAD_KEY_SETTING2(n_key_fastactivate_equipment_b, 9, NO, NO, 0, NO, NO);
415
416 LOAD_KEY_SETTING2(n_key_target_missile, 't', NO, NO, 0, NO, NO);
417 LOAD_KEY_SETTING2(n_key_untarget_missile, 'u', NO, NO, 0, NO, NO);
418 LOAD_KEY_SETTING2(n_key_target_incoming_missile, 'T', YES, NO, 0, NO, NO);
419 LOAD_KEY_SETTING2(n_key_ident_system, 'r', NO, NO, 0, NO, NO);
420
421 LOAD_KEY_SETTING2(n_key_scanner_zoom, 'z', NO, NO, 0, NO, NO);
422 LOAD_KEY_SETTING2(n_key_scanner_unzoom, 'Z', YES, NO, 0, NO, NO);
423
424 LOAD_KEY_SETTING2(n_key_launch_escapepod, 27, NO, NO, 0, NO, NO);
425
426 LOAD_KEY_SETTING2(n_key_galactic_hyperspace, 'g', NO, NO, 0, NO, NO);
427 LOAD_KEY_SETTING2(n_key_hyperspace, 'h', NO, NO, 0, NO, NO);
428 LOAD_KEY_SETTING2(n_key_jumpdrive, 'j', NO, NO, 0, NO, NO);
429
430 LOAD_KEY_SETTING2(n_key_dump_cargo, 'D', YES, NO, 0, NO, NO);
431 LOAD_KEY_SETTING2(n_key_rotate_cargo, 'R', YES, NO, 0, NO, NO);
432
433 LOAD_KEY_SETTING2(n_key_autopilot, 'c', NO, NO, 0, NO, NO);
434 LOAD_KEY_SETTING2(n_key_autodock, 'C', YES, NO, 0, NO, NO);
435 LOAD_KEY_SETTING2(n_key_docking_clearance_request, 'L', YES, NO, 0, NO, NO);
436
437 LOAD_KEY_SETTING2(n_key_snapshot, '*', YES, NO, gvNumberPadKeyMultiply, NO, NO);
438 LOAD_KEY_SETTING2(n_key_docking_music, 's', NO, NO, 0, NO, NO);
439
440 LOAD_KEY_SETTING2(n_key_advanced_nav_array_next, '^', YES, NO, 0, NO, NO);
441 LOAD_KEY_SETTING2(n_key_advanced_nav_array_previous, '^', YES, YES, 0, NO, NO);
442 LOAD_KEY_SETTING2(n_key_map_home, gvHomeKey, NO, NO, 0, NO, NO);
443 LOAD_KEY_SETTING2(n_key_map_end, gvEndKey, NO, NO, 0, NO, NO);
444 LOAD_KEY_SETTING2(n_key_map_next_system, gvArrowKeyRight, NO, NO, gvArrowKeyDown, NO, NO);
445 LOAD_KEY_SETTING2(n_key_map_previous_system, gvArrowKeyLeft, NO, NO, gvArrowKeyUp, NO, NO);
446 LOAD_KEY_SETTING2(n_key_map_zoom_in, gvPageDownKey, NO, NO, 0, NO, NO);
447 LOAD_KEY_SETTING2(n_key_map_zoom_out, gvPageUpKey, NO, NO, 0, NO, NO);
448 LOAD_KEY_SETTING2(n_key_map_info, 'i', NO, NO, 0, NO, NO);
449 LOAD_KEY_SETTING2(n_key_chart_highlight, '?', YES, NO, 0, NO, NO);
450
451 LOAD_KEY_SETTING2(n_key_system_home, gvHomeKey, NO, NO, 0, NO, NO);
452 LOAD_KEY_SETTING2(n_key_system_end, gvEndKey, NO, NO, 0, NO, NO);
453 LOAD_KEY_SETTING2(n_key_system_next_system, gvArrowKeyRight, NO, NO, gvArrowKeyDown, NO, NO);
454 LOAD_KEY_SETTING2(n_key_system_previous_system, gvArrowKeyLeft, NO, NO, gvArrowKeyUp, NO, NO);
455
456 LOAD_KEY_SETTING2(n_key_pausebutton, 'p', NO, NO, 0, NO, NO);
457 LOAD_KEY_SETTING2(n_key_show_fps, 'F', YES, NO, 0, NO, NO);
458 LOAD_KEY_SETTING2(n_key_bloom_toggle, gvFunctionKey9, YES, NO, 0, NO, NO);
459 LOAD_KEY_SETTING2(n_key_mouse_control_roll, 'M', YES, NO, 0, NO, NO);
460 LOAD_KEY_SETTING2(n_key_mouse_control_yaw, 'M', YES, YES, 0, NO, NO);
461 LOAD_KEY_SETTING2(n_key_hud_toggle, 'o', NO, NO, 0, NO, NO);
462
463 LOAD_KEY_SETTING2(n_key_comms_log, '`', YES, NO, 0, NO, NO);
464 LOAD_KEY_SETTING2(n_key_prev_compass_mode, '|', YES, NO, 0, NO, NO);
465 LOAD_KEY_SETTING2(n_key_next_compass_mode, '\\', NO, NO, 0, NO, NO);
466
467 LOAD_KEY_SETTING2(n_key_market_filter_cycle, '?', YES, NO, 0, NO, NO);
468 LOAD_KEY_SETTING2(n_key_market_sorter_cycle, '/', NO, NO, gvNumberPadKeyDivide, NO, NO);
469 LOAD_KEY_SETTING2(n_key_market_buy_one, gvArrowKeyRight, NO, NO, 0, NO, NO);
470 LOAD_KEY_SETTING2(n_key_market_sell_one, gvArrowKeyLeft, NO, NO, 0, NO, NO);
471 LOAD_KEY_SETTING2(n_key_market_buy_max, gvArrowKeyRight, YES, NO, 0, NO, NO);
472 LOAD_KEY_SETTING2(n_key_market_sell_max, gvArrowKeyLeft, YES, NO, 0, NO, NO);
473
474 LOAD_KEY_SETTING2(n_key_cycle_next_mfd, ';', NO, NO, 0, NO, NO);
475 LOAD_KEY_SETTING2(n_key_cycle_previous_mfd, ';', NO, YES, 0, NO, NO);
476 LOAD_KEY_SETTING2(n_key_switch_next_mfd, ':', YES, NO, 0, NO, NO);
477 LOAD_KEY_SETTING2(n_key_switch_previous_mfd, ':', YES, YES, 0, NO, NO);
478
479 LOAD_KEY_SETTING2(n_key_next_target, '+', YES, NO, gvNumberPadKeyPlus, NO, NO);
480 LOAD_KEY_SETTING2(n_key_previous_target, '-', NO, NO, gvNumberPadKeyMinus, NO, NO);
481
482 LOAD_KEY_SETTING2(n_key_custom_view, 'v', NO, NO, 0, NO, NO);
483 LOAD_KEY_SETTING2(n_key_custom_view_zoom_out, gvPageDownKey, NO, NO, 0, NO, NO);
484 LOAD_KEY_SETTING2(n_key_custom_view_zoom_in, gvPageUpKey, NO, NO, 0, NO, NO);
485 LOAD_KEY_SETTING2(n_key_custom_view_roll_left, gvArrowKeyLeft, NO, NO, 0, NO, NO);
486 LOAD_KEY_SETTING2(n_key_custom_view_pan_left, gvArrowKeyLeft, YES, NO, 0, NO, NO);
487 LOAD_KEY_SETTING2(n_key_custom_view_roll_right, gvArrowKeyRight, NO, NO, 0, NO, NO);
488 LOAD_KEY_SETTING2(n_key_custom_view_pan_right, gvArrowKeyRight, YES, NO, 0, NO, NO);
489 LOAD_KEY_SETTING2(n_key_custom_view_rotate_up, gvArrowKeyUp, NO, NO, 0, NO, NO);
490 LOAD_KEY_SETTING2(n_key_custom_view_pan_up, gvArrowKeyUp, YES, NO, 0, NO, NO);
491 LOAD_KEY_SETTING2(n_key_custom_view_rotate_down, gvArrowKeyDown, NO, NO, 0, NO, NO);
492 LOAD_KEY_SETTING2(n_key_custom_view_pan_down, gvArrowKeyDown, YES, NO, 0, NO, NO);
493 LOAD_KEY_SETTING2(n_key_custom_view_rotate_left, ',', NO, NO, 0, NO, NO);
494 LOAD_KEY_SETTING2(n_key_custom_view_rotate_right, '.', NO, NO, 0, NO, NO);
495
496 LOAD_KEY_SETTING2(n_key_oxzmanager_setfilter, 'f', NO, NO, 0, NO, NO);
497 LOAD_KEY_SETTING2(n_key_oxzmanager_showinfo, 'i', NO, NO, 0, NO, NO);
498 LOAD_KEY_SETTING2(n_key_oxzmanager_extract, 'x', NO, NO, 0, NO, NO);
499
500#if OO_FOV_INFLIGHT_CONTROL_ENABLED
501 LOAD_KEY_SETTING2(n_key_inc_field_of_view, 'l', NO, NO, 0, NO, NO);
502 LOAD_KEY_SETTING2(n_key_dec_field_of_view, 'k', NO, NO, 0, NO, NO);
503#endif
504
505#ifndef NDEBUG
506 LOAD_KEY_SETTING2(n_key_dump_target_state, 'H', YES, NO, 0, NO, NO);
507 LOAD_KEY_SETTING2(n_key_dump_entity_list, '0', NO, NO, 0, NO, NO);
508 LOAD_KEY_SETTING2(n_key_debug_full, 'd', NO, NO, 0, NO, NO);
509 LOAD_KEY_SETTING2(n_key_debug_collision, 'b', NO, NO, 0, NO, NO);
510 LOAD_KEY_SETTING2(n_key_debug_console_connect, 'c', NO, NO, 0, NO, NO);
511 LOAD_KEY_SETTING2(n_key_debug_bounding_boxes, 'x', NO, NO, 0, NO, NO);
512 LOAD_KEY_SETTING2(n_key_debug_shaders, 's', NO, NO, 0, NO, NO);
513 LOAD_KEY_SETTING2(n_key_debug_off, 'n', NO, NO, 0, NO, NO);
514#endif
515
516 [keyconfig2_settings release];
517 keyconfig2_settings = [[NSDictionary alloc] initWithDictionary:kdic2 copyItems:YES];
518}
@ gvNumberPadKeyDivide
@ gvNumberPadKeyMultiply
@ gvFunctionKey2
@ gvNumberPadKeyPlus
@ gvFunctionKey5
@ gvArrowKeyDown
@ gvFunctionKey9
@ gvFunctionKey4
@ gvEndKey
@ gvHomeKey
@ gvNumberPadKeyEnter
@ gvNumberPadKeyMinus
@ gvFunctionKey8
@ gvPageDownKey
@ gvFunctionKey3
@ gvArrowKeyUp
@ gvArrowKeyRight
@ gvFunctionKey6
@ gvArrowKeyLeft
@ gvFunctionKey7
@ gvPageUpKey
@ gvFunctionKey1
#define LOAD_KEY_SETTING2(name, default_1, shift_1, mod1_1, default_2, shift_2, mod1_2)
#define KEYCONFIG_CUSTOMEQUIP
NSDictionary * dictionaryFromFilesNamed:inFolder:mergeMode:cache:(NSString *fileName,[inFolder] NSString *folderName,[mergeMode] OOResourceMergeMode mergeMode,[cache] BOOL useCache)

◆ noteSwitchToView:fromView:

- (void) noteSwitchToView: (OOViewID toView
fromView: (OOViewID fromView 

Definition at line 164 of file PlayerEntityControls.m.

846 :(OOViewID)toView fromView:(OOViewID)fromView
847{
848 [self switchToThisView:toView fromView:fromView andProcessWeaponFacing:NO justNotify:YES]; // no extra processing needed!
849}
OOViewID
Definition OOTypes.h:43

◆ pollControls:

- (void) pollControls: (double)  delta_t

Definition at line 164 of file PlayerEntityControls.m.

660 :(double)delta_t
661{
662 MyOpenGLView *gameView = [UNIVERSE gameView];
663 NSString *exceptionContext = @"setup";
664
665 @try
666 {
667 if (gameView)
668 {
669 // poll the gameView keyboard things
670 exceptionContext = @"pollApplicationControls";
671 [self pollApplicationControls]; // quit command-f etc.
672 switch ([self status])
673 {
674 case STATUS_WITCHSPACE_COUNTDOWN:
675 case STATUS_IN_FLIGHT:
676 exceptionContext = @"pollFlightControls";
677 [self pollFlightControls:delta_t];
678 break;
679
680 case STATUS_DEAD:
681 exceptionContext = @"pollGameOverControls";
682 [self pollGameOverControls:delta_t];
683 break;
684
685 case STATUS_AUTOPILOT_ENGAGED:
686 exceptionContext = @"pollAutopilotControls";
687 [self pollAutopilotControls:delta_t];
688 break;
689
690 case STATUS_DOCKED:
691 exceptionContext = @"pollDockedControls";
692 [self pollDockedControls:delta_t];
693 break;
694
695 case STATUS_START_GAME:
696 exceptionContext = @"pollDemoControls";
697 [self pollDemoControls:delta_t];
698 break;
699
700 default:
701 // don't poll extra controls at any other times.
702 break;
703 }
704 }
705 }
706 @catch (NSException *exception)
707 {
708 OOLog(kOOLogException, @"***** Exception checking controls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
709 }
710}
NSString *const kOOLogException
Definition OOLogging.m:651
#define OOLog(class, format,...)
Definition OOLogging.h:88

◆ processKeyCode:

- (NSArray *) processKeyCode: (NSArray*)  key_def

Definition at line 164 of file PlayerEntityControls.m.

521 :(NSArray*)key_def
522{
523 int i;
524 id key = nil, value = nil;
525 int iValue;
526 unsigned char keychar;
527 NSString *keystring = nil;
528 NSDictionary *def = nil;
529 NSMutableArray *newList = [[NSMutableArray alloc] init];
530
531 for (i = 0; i < [key_def count]; i++)
532 {
533 def = [key_def objectAtIndex:i];
534 if ([def count] == 0) continue; // skip this if the definition is empty
535 value = [def objectForKey:@"key"];
536 iValue = [value intValue];
537
538 // we're going to fully expand all the shift/mod1/mod2 properties for all the key setting with defaults
539 // to avoid the need to check for the presence of a property during game loops
540 NSMutableDictionary *defNew = [[NSMutableDictionary alloc] init];
541 if ([def objectForKey:@"shift"]) [defNew setObject:[def objectForKey:@"shift"] forKey:@"shift"]; else [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"shift"];
542 if ([def objectForKey:@"mod1"]) [defNew setObject:[def objectForKey:@"mod1"] forKey:@"mod1"]; else [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"mod1"];
543 if ([def objectForKey:@"mod2"]) [defNew setObject:[def objectForKey:@"mod2"] forKey:@"mod2"]; else [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"mod2"];
544
545 // for '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' - we want to interpret those as strings - not numbers
546 // alphabetical characters and symbols will return an intValue of 0.
547
548 if ([value isKindOfClass:[NSString class]] && (iValue < 10))
549 {
550 keystring = value;
551
552 // check for a named lookup
553 if ([keystring length] != 0)
554 {
555 int checkVal;
556 checkVal = [[keyCodeLookups objectForKey:[keystring lowercaseString]] intValue];
557 if (checkVal > 0) {
558 iValue = checkVal;
559
560 [defNew setObject:[NSNumber numberWithUnsignedShort:iValue] forKey:@"key"];
561 [newList addObject:defNew];
562 [defNew release];
563 continue;
564 }
565 }
566
567 if ([keystring length] == 1 || (iValue == 0 && [keystring length] != 0))
568 {
569 keychar = [keystring characterAtIndex:0] & 0x00ff; // uses lower byte of unichar
570 }
571 else if (iValue <= 0xFF) keychar = iValue;
572 else {
573 OOLogWARN(@"testing", @"continue hit for key %@.", key);
574 [defNew setObject:[def objectForKey:@"key"] forKey:@"key"];
575 [newList addObject:defNew];
576 [defNew release];
577 continue;
578 }
579
580 [defNew setObject:[NSNumber numberWithUnsignedShort:keychar] forKey:@"key"];
581 [newList addObject:defNew];
582 [defNew release];
583 }
584 else
585 {
586 [defNew setObject:[def objectForKey:@"key"] forKey:@"key"];
587 [newList addObject:defNew];
588 [defNew release];
589 }
590 }
591
592 return newList;
593}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:113
unsigned count

◆ switchToMainView

- (void) switchToMainView

Definition at line 164 of file PlayerEntityControls.m.

831{
832 OOGUIScreenID oldScreen = gui_screen;
833 gui_screen = GUI_SCREEN_MAIN;
834 if (showDemoShips)
835 {
836 [self setShowDemoShips: NO];
837 [UNIVERSE removeDemoShips];
838 }
839 [(MyOpenGLView *)[UNIVERSE gameView] allowStringInput:NO];
840 if ([self isMouseControlOn]) [[UNIVERSE gameView] resetMouse];
841 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
842 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
843}
OOGUIScreenID

◆ targetNewSystem:

- (void) targetNewSystem: (int direction

Definition at line 164 of file PlayerEntityControls.m.

824 :(int) direction
825{
826 [self targetNewSystem:direction whileTyping:NO];
827}

◆ targetNewSystem:whileTyping:

- (void) targetNewSystem: (int direction
whileTyping: (BOOL)  whileTyping 
implementation

Definition at line 164 of file PlayerEntityControls.m.

801 :(int) direction whileTyping:(BOOL) whileTyping
802{
803 target_system_id = [[UNIVERSE gui] targetNextFoundSystem:direction];
804 [self setInfoSystemID: target_system_id moveChart: YES];
805 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
806
807 found_system_id = target_system_id;
808 if (!whileTyping)
809 {
810 [self clearPlanetSearchString];
811 }
812 cursor_moving = YES;
813}
static BOOL cursor_moving

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