Oolite 1.91.0.7646-241128-10e222e
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

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

892{
893 if ([self hasHyperspaceMotor]) {
894 [self beginWitchspaceCountdown:hyperspaceMotorSpinTime];
895 }
896}

◆ beginWitchspaceCountdown:

- (void) beginWitchspaceCountdown: (int) spin_time

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ cancelWitchspaceCountdown

- (void) cancelWitchspaceCountdown

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ checkKeyPress:

- (BOOL) checkKeyPress: (NSArray*) key_def

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

613 :(NSArray*)key_def
614{
615 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:NO];
616}

◆ checkKeyPress:fKey_only:

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

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

619 :(NSArray*)key_def fKey_only:(BOOL)fKey_only
620{
621 return [self checkKeyPress:key_def fKey_only:fKey_only ignore_ctrl:NO];
622}

◆ checkKeyPress:fKey_only:ignore_ctrl:

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

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ checkKeyPress:ignore_ctrl:

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

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

625 :(NSArray*)key_def ignore_ctrl:(BOOL)ignore_ctrl
626{
627 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:ignore_ctrl];
628}

◆ checkNavKeyPress:

- (BOOL) checkNavKeyPress: (NSArray*) key_def

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

820{
821 [[UNIVERSE gameView] resetTypedString];
822 if (planetSearchString) [planetSearchString release];
823 planetSearchString = nil;
824}
return nil

◆ getFirstKeyCode:

- (int) getFirstKeyCode: (NSArray*) key_def

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ handleGUIUpDownArrowKeys

- (BOOL) handleGUIUpDownArrowKeys

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ initControls

- (void) initControls

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ initKeyConfigSettings

- (void) initKeyConfigSettings

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ pollControls:

- (void) pollControls: (double) delta_t

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ processKeyCode:

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

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ switchToMainView

- (void) switchToMainView

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

◆ targetNewSystem:

- (void) targetNewSystem: (int) direction

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

827 :(int) direction
828{
829 [self targetNewSystem:direction whileTyping:NO];
830}

◆ targetNewSystem:whileTyping:

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

Extends class PlayerEntity.

Definition at line 167 of file PlayerEntityControls.m.

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

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