Oolite 1.91.0.7677-250528-09ed63a
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
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 890 of file PlayerEntityControls.m.

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

References beginWitchspaceCountdown, and PlayerEntity::beginWitchspaceCountdown:.

Referenced by beginWitchspaceCountdown, and beginWitchspaceCountdown:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ beginWitchspaceCountdown:

- (void) beginWitchspaceCountdown: (int) spin_time

Extends class PlayerEntity.

Definition at line 855 of file PlayerEntityControls.m.

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

References beginWitchspaceCountdown, ShipEntity::doScriptEvent:withArguments:, PlayerEntity::nextHopTargetSystemID, PlayerEntity::playStandardHyperspace, and ShipEntity::setStatus:.

Here is the call graph for this function:

◆ cancelWitchspaceCountdown

- (void) cancelWitchspaceCountdown

Extends class PlayerEntity.

Definition at line 898 of file PlayerEntityControls.m.

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

References cancelWitchspaceCountdown, ShipEntity::doScriptEvent:, PlayerEntity::playHyperspaceAborted, and ShipEntity::setStatus:.

Referenced by cancelWitchspaceCountdown.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkKeyPress:

- (BOOL) checkKeyPress: (NSArray*) key_def

Extends class PlayerEntity.

Definition at line 612 of file PlayerEntityControls.m.

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

References PlayerEntity::checkKeyPress:fKey_only:ignore_ctrl:.

Here is the call graph for this function:

◆ checkKeyPress:fKey_only:

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

Extends class PlayerEntity.

Definition at line 618 of file PlayerEntityControls.m.

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

References PlayerEntity::checkKeyPress:fKey_only:ignore_ctrl:.

Here is the call graph for this function:

◆ 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 630 of file PlayerEntityControls.m.

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

References gvFunctionKey11.

◆ checkKeyPress:ignore_ctrl:

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

Extends class PlayerEntity.

Definition at line 624 of file PlayerEntityControls.m.

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

References PlayerEntity::checkKeyPress:fKey_only:ignore_ctrl:.

Here is the call graph for this function:

◆ checkNavKeyPress:

- (BOOL) checkNavKeyPress: (NSArray*) key_def

Extends class PlayerEntity.

Definition at line 599 of file PlayerEntityControls.m.

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

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Extends class PlayerEntity.

Definition at line 818 of file PlayerEntityControls.m.

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

References clearPlanetSearchString, and nil.

Referenced by clearPlanetSearchString.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFirstKeyCode:

- (int) getFirstKeyCode: (NSArray*) key_def

Extends class PlayerEntity.

Definition at line 655 of file PlayerEntityControls.m.

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

References int().

Here is the call graph for this function:

◆ handleGUIUpDownArrowKeys

- (BOOL) handleGUIUpDownArrowKeys

Extends class PlayerEntity.

Definition at line 715 of file PlayerEntityControls.m.

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

References PlayerEntity::checkKeyPress:, MyOpenGLView::clearMouse, handleGUIUpDownArrowKeys, MyOpenGLView::isDown:, KEY_REPEAT_INTERVAL, PlayerEntity::playMenuNavigationDown, PlayerEntity::playMenuNavigationNot, PlayerEntity::playMenuNavigationUp, timeLastKeyPress, UNIVERSE, and upDownKeyPressed.

Referenced by handleGUIUpDownArrowKeys.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initControls

- (void) initControls

Extends class PlayerEntity.

Definition at line 206 of file PlayerEntityControls.m.

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

References initControls, and PlayerEntity::initKeyConfigSettings.

Referenced by initControls.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initKeyConfigSettings

- (void) initKeyConfigSettings

Extends class PlayerEntity.

Definition at line 296 of file PlayerEntityControls.m.

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

References ResourceManager::dictionaryFromFilesNamed:inFolder:mergeMode:cache:, gvArrowKeyDown, gvArrowKeyLeft, gvArrowKeyRight, gvArrowKeyUp, gvEndKey, gvFunctionKey1, gvFunctionKey2, gvFunctionKey3, gvFunctionKey4, gvFunctionKey5, gvFunctionKey6, gvFunctionKey7, gvFunctionKey8, gvFunctionKey9, gvHomeKey, gvNumberPadKeyDivide, gvNumberPadKeyEnter, gvNumberPadKeyMinus, gvNumberPadKeyMultiply, gvNumberPadKeyPlus, gvPageDownKey, gvPageUpKey, initKeyConfigSettings, KEYCONFIG_CUSTOMEQUIP, LOAD_KEY_SETTING2, nil, and PlayerEntity::processKeyCode:.

Referenced by initKeyConfigSettings.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ noteSwitchToView:fromView:

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

Extends class PlayerEntity.

Definition at line 848 of file PlayerEntityControls.m.

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

References PlayerEntity::switchToThisView:fromView:andProcessWeaponFacing:justNotify:.

Here is the call graph for this function:

◆ pollControls:

- (void) pollControls: (double) delta_t

Extends class PlayerEntity.

Definition at line 662 of file PlayerEntityControls.m.

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

References kOOLogException, OOLog, PlayerEntity::pollApplicationControls, PlayerEntity::pollAutopilotControls:, PlayerEntity::pollDemoControls:, PlayerEntity::pollDockedControls:, PlayerEntity::pollFlightControls:, and PlayerEntity::pollGameOverControls:.

Here is the call graph for this function:

◆ processKeyCode:

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

Extends class PlayerEntity.

Definition at line 523 of file PlayerEntityControls.m.

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

References count, nil, and OOLogWARN.

◆ switchToMainView

- (void) switchToMainView

Extends class PlayerEntity.

Definition at line 832 of file PlayerEntityControls.m.

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

References MyOpenGLView::allowStringInput:, PlayerEntity::noteGUIDidChangeFrom:to:, PlayerEntity::setShowDemoShips:, and switchToMainView.

Referenced by switchToMainView.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ targetNewSystem:

- (void) targetNewSystem: (int) direction

Extends class PlayerEntity.

Definition at line 826 of file PlayerEntityControls.m.

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

References PlayerEntity::targetNewSystem:whileTyping:.

Here is the call graph for this function:

◆ targetNewSystem:whileTyping:

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

Extends class PlayerEntity.

Definition at line 803 of file PlayerEntityControls.m.

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

References PlayerEntity::clearPlanetSearchString, cursor_moving, and PlayerEntity::setInfoSystemID:moveChart:.

Here is the call graph for this function:

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