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 29 of file PlayerEntityControls.h.

Method Documentation

◆ beginWitchspaceCountdown

- (void) beginWitchspaceCountdown

Extends class PlayerEntity.

Definition at line 848 of file PlayerEntityControls.m.

849{
850 if ([self hasHyperspaceMotor]) {
851 [self beginWitchspaceCountdown:hyperspaceMotorSpinTime];
852 }
853}

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

820 :(int)spin_time
821{
822 if ([self hasHyperspaceMotor]) {
823 if (spin_time == 0) {
824 witchspaceCountdown = hyperspaceMotorSpinTime;
825 } else {
826#ifndef OO_DUMP_PLANETINFO
827 if (spin_time < 5) {
828 witchspaceCountdown = 5;
829 } else
830#endif
831 {
832 witchspaceCountdown = spin_time;
833 }
834 }
835 [self setStatus:STATUS_WITCHSPACE_COUNTDOWN];
836 [self playStandardHyperspace];
837 // say it!
838 [UNIVERSE clearPreviousMessage];
839 int seconds = round(witchspaceCountdown);
840 NSString* destination = [UNIVERSE getSystemName:[self nextHopTargetSystemID]];
841 [UNIVERSE displayCountdownMessage:OOExpandKey(@"witch-to-x-in-y-seconds", seconds, destination) forCount:1.0];
842 [self doScriptEvent:OOJSID("playerStartedJumpCountdown")
843 withArguments:[NSArray arrayWithObjects:@"standard", [NSNumber numberWithFloat:witchspaceCountdown], nil]];
844 [UNIVERSE preloadPlanetTexturesForSystem:target_system_id];
845 }
846}
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 855 of file PlayerEntityControls.m.

856{
857 if ([self status] == STATUS_WITCHSPACE_COUNTDOWN) {
858 [self setStatus:STATUS_IN_FLIGHT];
859 [self playHyperspaceAborted];
860 }
861 // say it!
862 [UNIVERSE clearPreviousMessage];
863 [self doScriptEvent:OOJSID("playerCancelledJumpCountdown")];
864}

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

603 :(NSArray*)key_def
604{
605 return [self checkKeyPress:key_def fKey_only:NO ignore_ctrl:NO];
606}

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

608 :(NSArray*)key_def fKey_only:(BOOL)fKey_only
609{
610 return [self checkKeyPress:key_def fKey_only:fKey_only ignore_ctrl:NO];
611}

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

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

References gvFunctionKey11.

◆ checkKeyPress:ignore_ctrl:

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

Extends class PlayerEntity.

Definition at line 613 of file PlayerEntityControls.m.

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

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

591 :(NSArray*)key_def
592{
593 MyOpenGLView* gameView = [UNIVERSE gameView];
594 int i;
595 for (i = 0; i < [key_def count]; i++) {
596 NSDictionary* def = [key_def objectAtIndex:i];
597 if ([gameView isDown:[[def objectForKey:@"key"] intValue]])
598 return YES;
599 }
600 return NO;
601}

◆ clearPlanetSearchString

- (void) clearPlanetSearchString

Extends class PlayerEntity.

Definition at line 787 of file PlayerEntityControls.m.

788{
789 [[UNIVERSE gameView] resetTypedString];
790 if (planetSearchString)
791 [planetSearchString release];
792 planetSearchString = nil;
793}
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 642 of file PlayerEntityControls.m.

642 :(NSArray*)key_def
643{
644 NSDictionary* def = [key_def objectAtIndex:0];
645 return [[def objectForKey:@"key"] intValue];
646}

References int().

Here is the call graph for this function:

◆ handleGUIUpDownArrowKeys

- (BOOL) handleGUIUpDownArrowKeys

Extends class PlayerEntity.

Definition at line 697 of file PlayerEntityControls.m.

698{
699 MyOpenGLView* gameView = [UNIVERSE gameView];
700 GuiDisplayGen* gui = [UNIVERSE gui];
701 const BOOL* joyButtonState = [[OOJoystickManager sharedStickHandler] getAllButtonStates];
702
703 BOOL result = NO;
704 BOOL arrow_up = [self checkKeyPress:n_key_gui_arrow_up] || joyButtonState[BUTTON_GUIUP];
705 BOOL arrow_down = [self checkKeyPress:n_key_gui_arrow_down] || joyButtonState[BUTTON_GUIDOWN];
706 BOOL mouse_click = [gameView isDown:gvMouseLeftButton];
707 BOOL mouse_dbl_click = [gameView isDown:gvMouseDoubleClick];
708
709 if (arrow_down) {
710 if ((!upDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL)) {
711 if ([gui setNextRow:+1]) {
712 result = YES;
713 } else {
714 if ([gui setFirstSelectableRow])
715 result = YES;
716 }
717
718 if (result && [gui selectableRange].length > 1)
719 [self playMenuNavigationDown];
720 else
721 [self playMenuNavigationNot];
722
723 timeLastKeyPress = script_time;
724 }
725 }
726
727 if (arrow_up) {
728 if ((!upDownKeyPressed) || (script_time > timeLastKeyPress + KEY_REPEAT_INTERVAL)) {
729 if ([gui setNextRow:-1]) {
730 result = YES;
731 } else {
732 if ([gui setLastSelectableRow])
733 result = YES;
734 }
735
736 if (result && [gui selectableRange].length > 1)
737 [self playMenuNavigationUp];
738 else
739 [self playMenuNavigationNot];
740
741 timeLastKeyPress = script_time;
742 }
743 }
744
745 if (mouse_click) {
746 if (!upDownKeyPressed) {
747 int click_row = 0;
748 if (UNIVERSE)
749 click_row = UNIVERSE->cursor_row;
750 if ([gui setSelectedRow:click_row]) {
751 result = YES;
752 }
753 }
754 }
755 if (mouse_dbl_click) {
756 int click_row = 0;
757 if (UNIVERSE)
758 click_row = UNIVERSE->cursor_row;
759 if ([gui setSelectedRow:click_row]) {
760 result = YES;
761 } else {
762 // if double-clicked on an unselectable row, clear the
763 // state so it doesn't activate whatever was last
764 // selected
765 [gameView clearMouse];
766 }
767 }
768
769 upDownKeyPressed = (arrow_up || arrow_down || mouse_click);
770
771 return result;
772}
static BOOL upDownKeyPressed
static double timeLastKeyPress
#define KEY_REPEAT_INTERVAL
#define UNIVERSE
Definition Universe.h:827
BOOL isDown:(int key)
const BOOL * getAllButtonStates()

References PlayerEntity::checkKeyPress:, MyOpenGLView::clearMouse, OOJoystickManager::getAllButtonStates, handleGUIUpDownArrowKeys, MyOpenGLView::isDown:, KEY_REPEAT_INTERVAL, PlayerEntity::playMenuNavigationDown, PlayerEntity::playMenuNavigationNot, PlayerEntity::playMenuNavigationUp, OOJoystickManager::sharedStickHandler, 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 203 of file PlayerEntityControls.m.

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

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

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

815 :(OOViewID)toView fromView:(OOViewID)fromView
816{
817 [self switchToThisView:toView fromView:fromView andProcessWeaponFacing:NO justNotify:YES]; // no extra processing needed!
818}
OOViewID
Definition OOTypes.h:39

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

648 :(double)delta_t
649{
650 MyOpenGLView* gameView = [UNIVERSE gameView];
651 NSString* exceptionContext = @"setup";
652
653 @try {
654 if (gameView) {
655 // poll the gameView keyboard things
656 exceptionContext = @"pollApplicationControls";
657 [self pollApplicationControls]; // quit command-f etc.
658 switch ([self status]) {
659 case STATUS_WITCHSPACE_COUNTDOWN:
660 case STATUS_IN_FLIGHT:
661 exceptionContext = @"pollFlightControls";
662 [self pollFlightControls:delta_t];
663 break;
664
665 case STATUS_DEAD:
666 exceptionContext = @"pollGameOverControls";
667 [self pollGameOverControls:delta_t];
668 break;
669
670 case STATUS_AUTOPILOT_ENGAGED:
671 exceptionContext = @"pollAutopilotControls";
672 [self pollAutopilotControls:delta_t];
673 break;
674
675 case STATUS_DOCKED:
676 exceptionContext = @"pollDockedControls";
677 [self pollDockedControls:delta_t];
678 break;
679
680 case STATUS_START_GAME:
681 exceptionContext = @"pollDemoControls";
682 [self pollDemoControls:delta_t];
683 break;
684
685 default:
686 // don't poll extra controls at any other times.
687 break;
688 }
689 }
690 }
691 @catch (NSException* exception) {
692 OOLog(kOOLogException, @"***** Exception checking controls [%@]: %@ : %@", exceptionContext, [exception name], [exception reason]);
693 }
694}
NSString *const kOOLogException
Definition OOLogging.m:600
#define OOLog(class, format,...)
Definition OOLogging.h:84

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

512 :(NSArray*)key_def
513{
514 int i;
515 id key = nil, value = nil;
516 int iValue;
517 unsigned char keychar;
518 NSString* keystring = nil;
519 NSDictionary* def = nil;
520 NSMutableArray* newList = [[NSMutableArray alloc] init];
521
522 for (i = 0; i < [key_def count]; i++) {
523 def = [key_def objectAtIndex:i];
524 if ([def count] == 0)
525 continue; // skip this if the definition is empty
526 value = [def objectForKey:@"key"];
527 iValue = [value intValue];
528
529 // we're going to fully expand all the shift/mod1/mod2 properties for all the key setting with defaults
530 // to avoid the need to check for the presence of a property during game loops
531 NSMutableDictionary* defNew = [[NSMutableDictionary alloc] init];
532 if ([def objectForKey:@"shift"])
533 [defNew setObject:[def objectForKey:@"shift"] forKey:@"shift"];
534 else
535 [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"shift"];
536 if ([def objectForKey:@"mod1"])
537 [defNew setObject:[def objectForKey:@"mod1"] forKey:@"mod1"];
538 else
539 [defNew setObject:[NSNumber numberWithBool:NO] forKey:@"mod1"];
540 if ([def objectForKey:@"mod2"])
541 [defNew setObject:[def objectForKey:@"mod2"] forKey:@"mod2"];
542 else
543 [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 keystring = value;
550
551 // check for a named lookup
552 if ([keystring length] != 0) {
553 int checkVal;
554 checkVal = [[keyCodeLookups objectForKey:[keystring lowercaseString]] intValue];
555 if (checkVal > 0) {
556 iValue = checkVal;
557
558 [defNew setObject:[NSNumber numberWithUnsignedShort:iValue] forKey:@"key"];
559 [newList addObject:defNew];
560 [defNew release];
561 continue;
562 }
563 }
564
565 if ([keystring length] == 1 || (iValue == 0 && [keystring length] != 0)) {
566 keychar = [keystring characterAtIndex:0] & 0x00ff; // uses lower byte of unichar
567 } else if (iValue <= 0xFF)
568 keychar = iValue;
569 else {
570 OOLogWARN(@"testing", @"continue hit for key %@.", key);
571 [defNew setObject:[def objectForKey:@"key"] forKey:@"key"];
572 [newList addObject:defNew];
573 [defNew release];
574 continue;
575 }
576
577 [defNew setObject:[NSNumber numberWithUnsignedShort:keychar] forKey:@"key"];
578 [newList addObject:defNew];
579 [defNew release];
580 } else {
581 [defNew setObject:[def objectForKey:@"key"] forKey:@"key"];
582 [newList addObject:defNew];
583 [defNew release];
584 }
585 }
586
587 return newList;
588}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:126
unsigned count

References count, nil, and OOLogWARN.

◆ switchToMainView

- (void) switchToMainView

Extends class PlayerEntity.

Definition at line 800 of file PlayerEntityControls.m.

801{
802 OOGUIScreenID oldScreen = gui_screen;
803 gui_screen = GUI_SCREEN_MAIN;
804 if (showDemoShips) {
805 [self setShowDemoShips:NO];
806 [UNIVERSE removeDemoShips];
807 }
808 [(MyOpenGLView*)[UNIVERSE gameView] allowStringInput:NO];
809 if ([self isMouseControlOn])
810 [[UNIVERSE gameView] resetMouse];
811 [UNIVERSE enterGUIViewModeWithMouseInteraction:NO];
812 [self noteGUIDidChangeFrom:oldScreen to:gui_screen];
813}
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 795 of file PlayerEntityControls.m.

795 :(int)direction
796{
797 [self targetNewSystem:direction whileTyping:NO];
798}

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

774 :(int)direction whileTyping:(BOOL)whileTyping
775{
776 target_system_id = [[UNIVERSE gui] targetNextFoundSystem:direction];
777 [self setInfoSystemID:target_system_id moveChart:YES];
778 cursor_coordinates = [[UNIVERSE systemManager] getCoordinatesForSystem:target_system_id inGalaxy:galaxy_number];
779
780 found_system_id = target_system_id;
781 if (!whileTyping) {
782 [self clearPlanetSearchString];
783 }
784 cursor_moving = YES;
785}
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: