Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
PlayerEntity(KeyMapperInternal) Category Reference

Instance Methods

(void) - resetKeyFunctions
 
(void) - updateKeyDefinition:index:
 
(void) - updateShiftKeyDefinition:index:
 
(void) - displayKeyFunctionList:skip:
 
(NSString *) - keyboardDescription:
 
(void) - displayKeyboardLayoutList:skip:
 
(BOOL) - entryIsIndexCustomEquip:
 
(BOOL) - entryIsDictCustomEquip:
 
(BOOL) - entryIsCustomEquip:
 
(NSArray *) - getCustomEquipArray:
 
(NSString *) - getCustomEquipKeyDefType:
 
(NSArray *) - keyFunctionList
 
(NSArray *) - validateAllKeys
 
(NSString *) - searchArrayForMatch:key:checkKeys:
 
(NSUInteger) - getCustomEquipIndex:
 
(BOOL) - entryIsEqualToDefault:
 
(BOOL) - compareKeyEntries:second:
 
(void) - saveKeySetting:
 
(void) - unsetKeySetting:
 
(void) - deleteKeySetting:
 
(void) - deleteAllKeySettings
 
(NSDictionary *) - loadKeySettings
 
(void) - reloadPage
 

Detailed Description

Definition at line 46 of file PlayerEntityKeyMapper.m.

Method Documentation

◆ compareKeyEntries:second:

- (BOOL) compareKeyEntries: (NSDictionary *) first
second: (NSDictionary *) second 

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1583 :(NSDictionary*)first second:(NSDictionary*)second
1584{
1585 if ([(NSString *)[first objectForKey:@"key"] integerValue] == [(NSString *)[second objectForKey:@"key"] integerValue])
1586 {
1587 if ([[first objectForKey:@"shift"] boolValue] == [[second objectForKey:@"shift"] boolValue] &&
1588 [[first objectForKey:@"mod1"] boolValue] == [[second objectForKey:@"mod1"] boolValue] &&
1589 [[first objectForKey:@"mod2"] boolValue] == [[second objectForKey:@"mod2"] boolValue])
1590 return YES;
1591 }
1592 return NO;
1593}

◆ deleteAllKeySettings

- (void) deleteAllKeySettings

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1701{
1702 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1703 [defaults removeObjectForKey:KEYCONFIG_OVERRIDES];
1704 if ([customEquipActivation count] > 0)
1705 {
1706 NSUInteger i;
1707 for (i = 0; i < [customEquipActivation count]; i++)
1708 {
1709 NSString *eq = [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY];
1711 if ([item defaultActivateKey])
1712 [[customEquipActivation objectAtIndex:i] setObject:[item defaultActivateKey] forKey:CUSTOMEQUIP_KEYACTIVATE];
1713 else
1714 [[customEquipActivation objectAtIndex:i] removeObjectForKey:CUSTOMEQUIP_KEYACTIVATE];
1715
1716 if ([item defaultModeKey])
1717 [[customEquipActivation objectAtIndex:i] setObject:[item defaultModeKey] forKey:CUSTOMEQUIP_KEYMODE];
1718 else
1719 [[customEquipActivation objectAtIndex:i] removeObjectForKey:CUSTOMEQUIP_KEYMODE];
1720 }
1721 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1722 }
1723 // reload settings
1724 [self initKeyConfigSettings];
1725}
unsigned count
#define CUSTOMEQUIP_KEYACTIVATE
#define CUSTOMEQUIP_KEYMODE
OOEquipmentType * equipmentTypeWithIdentifier:(NSString *identifier)

◆ deleteKeySetting:

- (void) deleteKeySetting: (NSString *) key

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1679 :(NSString*)key
1680{
1681 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1682 if (![self entryIsCustomEquip:key])
1683 {
1684 NSMutableDictionary *keyconf = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:KEYCONFIG_OVERRIDES]];
1685 [keyconf removeObjectForKey:key];
1686 [defaults setObject:keyconf forKey:KEYCONFIG_OVERRIDES];
1687 }
1688 else
1689 {
1690 NSString *custkey = [self getCustomEquipKeyDefType:key];
1691 [[customEquipActivation objectAtIndex:[self getCustomEquipIndex:key]] removeObjectForKey:custkey];
1692 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1693 }
1694 // reload settings
1695 [self initKeyConfigSettings];
1696}

◆ displayKeyboardLayoutList:skip:

- (void) displayKeyboardLayoutList: (GuiDisplayGen *) gui
skip: (NSUInteger) skip 

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1300 :(GuiDisplayGen *)gui skip:(NSUInteger)skip
1301{
1302 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_HEADING];
1303 [gui setArray:[NSArray arrayWithObjects:@"Keyboard layout", nil] forRow:GUI_ROW_KC_HEADING];
1304
1305 if (!kbdLayouts) kbdLayouts = [[self keyboardLayoutList] retain];
1306
1307 NSUInteger i, n_functions = [kbdLayouts count];
1308 NSInteger n_rows, start_row, previous = 0;
1309
1310 if (skip >= n_functions)
1311 skip = n_functions - 1;
1312
1313 if (n_functions < MAX_ROWS_KC_FUNCTIONS)
1314 {
1315 skip = 0;
1316 previous = 0;
1317 n_rows = MAX_ROWS_KC_FUNCTIONS;
1318 start_row = GUI_ROW_KC_FUNCSTART;
1319 }
1320 else
1321 {
1322 n_rows = MAX_ROWS_KC_FUNCTIONS - 1;
1323 start_row = GUI_ROW_KC_FUNCSTART;
1324 if (skip > 0)
1325 {
1326 n_rows -= 1;
1327 start_row += 1;
1328 if (skip > MAX_ROWS_KC_FUNCTIONS)
1329 previous = skip - (MAX_ROWS_KC_FUNCTIONS - 2);
1330 else
1331 previous = 0;
1332 }
1333 }
1334
1335 if (n_functions > 0)
1336 {
1337 if (skip > 0)
1338 {
1339 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_FUNCSTART];
1340 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:GUI_ROW_KC_FUNCSTART];
1341 [gui setKey:[NSString stringWithFormat:@"More:%ld", previous] forRow:GUI_ROW_KC_FUNCSTART];
1342 }
1343
1344 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1345 NSString *kbd = [defaults oo_stringForKey:@"keyboard-code" defaultValue:@"default"];
1346
1347 for(i = 0; i < (n_functions - skip) && (int)i < n_rows; i++)
1348 {
1349 NSDictionary *entry = [kbdLayouts objectAtIndex:i + skip];
1350 NSString *desc = [entry objectForKey:@"description"];
1351 NSString *selected = @"";
1352 if ([[entry objectForKey:@"key"] isEqualToString:kbd]) selected = @"Current";
1353 [gui setArray:[NSArray arrayWithObjects:desc, selected, nil] forRow:i + start_row];
1354 [gui setKey:[NSString stringWithFormat:@"Index:%ld", i + skip] forRow:i + start_row];
1355 }
1356 if (i < n_functions - skip)
1357 {
1358 [gui setColor:[OOColor greenColor] forRow:start_row + i];
1359 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:start_row + i];
1360 [gui setKey:[NSString stringWithFormat:@"More:%ld", n_rows + skip] forRow:start_row + i];
1361 i++;
1362 }
1363
1364 [gui setSelectableRange:NSMakeRange(GUI_ROW_KC_FUNCSTART, i + start_row - GUI_ROW_KC_FUNCSTART)];
1365 }
1366}
#define MAX_ROWS_KC_FUNCTIONS
#define GUI_ROW_KC_FUNCSTART
void setSelectableRange:(NSRange range)
void setColor:forRow:(OOColor *color,[forRow] OOGUIRow row)
void setArray:forRow:(NSArray *arr,[forRow] OOGUIRow row)
void setKey:forRow:(NSString *str,[forRow] OOGUIRow row)
OOColor * greenColor()
Definition OOColor.m:274
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque

◆ displayKeyFunctionList:skip:

- (void) displayKeyFunctionList: (GuiDisplayGen *) gui
skip: (NSUInteger) skip 

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

827 :(GuiDisplayGen *)gui skip:(NSUInteger)skip
828{
829 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_HEADING];
830 [gui setArray:[NSArray arrayWithObjects:
831 @"Function", @"Assigned to", @"Overrides", nil]
832 forRow:GUI_ROW_KC_HEADING];
833
834 NSDictionary *overrides = [self loadKeySettings];
835
836 if(!keyFunctions)
837 {
838 keyFunctions = [[self keyFunctionList] retain];
839 }
840
841 NSUInteger i, n_functions = [keyFunctions count];
842 NSInteger n_rows, start_row, previous = 0;
843 NSString *validate = nil;
844
845 if (skip >= n_functions)
846 skip = n_functions - 1;
847
848 if (n_functions < MAX_ROWS_KC_FUNCTIONS)
849 {
850 skip = 0;
851 previous = 0;
852 n_rows = MAX_ROWS_KC_FUNCTIONS;
853 start_row = GUI_ROW_KC_FUNCSTART;
854 }
855 else
856 {
857 n_rows = MAX_ROWS_KC_FUNCTIONS - 1;
858 start_row = GUI_ROW_KC_FUNCSTART;
859 if (skip > 0)
860 {
861 n_rows -= 1;
862 start_row += 1;
863 if (skip > MAX_ROWS_KC_FUNCTIONS)
864 previous = skip - (MAX_ROWS_KC_FUNCTIONS - 2);
865 else
866 previous = 0;
867 }
868 }
869
870 if (n_functions > 0)
871 {
872 if (skip > 0)
873 {
874 [gui setColor:[OOColor greenColor] forRow:GUI_ROW_KC_FUNCSTART];
875 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-back"), @" <-- ", nil] forRow:GUI_ROW_KC_FUNCSTART];
876 [gui setKey:[NSString stringWithFormat:@"More:%ld", previous] forRow:GUI_ROW_KC_FUNCSTART];
877 }
878
879 for(i = 0; i < (n_functions - skip) && (int)i < n_rows; i++)
880 {
881 NSDictionary *entry = [keyFunctions objectAtIndex:i + skip];
882 if ([entry objectForKey:KEY_KC_HEADER]) {
883 NSString *header = [entry objectForKey:KEY_KC_HEADER];
884 [gui setArray:[NSArray arrayWithObjects:header, @"", @"", nil] forRow:i + start_row];
885 [gui setColor:[OOColor cyanColor] forRow:i + start_row];
886 }
887 else
888 {
889 NSString *assignment = nil;
890 NSString *override = nil;
891 if (![self entryIsDictCustomEquip:entry])
892 {
893 // Find out what's assigned for this function currently.
894 assignment = [PLAYER keyBindingDescription2:[entry objectForKey:KEY_KC_DEFINITION]];
895 override = ([overrides objectForKey:[entry objectForKey:KEY_KC_DEFINITION]] ? @"Yes" : @""); // work out whether this assignment is overriding the setting in keyconfig2.plist
896 validate = [self validateKey:[entry objectForKey:KEY_KC_DEFINITION] checkKeys:(NSArray *)[keyconfig2_settings objectForKey:[entry objectForKey:KEY_KC_DEFINITION]]];
897 }
898 else
899 {
900 NSString *custom_keytype = [self getCustomEquipKeyDefType:[entry oo_stringForKey:KEY_KC_DEFINITION]];
901 NSUInteger idx = [self getCustomEquipIndex:[entry oo_stringForKey:KEY_KC_DEFINITION]];
902 assignment = [PLAYER getKeyBindingDescription:[[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype]];
903 OOEquipmentType *item = [OOEquipmentType equipmentTypeWithIdentifier:[[customEquipActivation objectAtIndex:idx] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]];
904 bool result = true;
905 int j, k;
906 NSArray *defArray = nil;
907 NSArray *compArray = nil;
908
909 if ([custom_keytype isEqualToString:CUSTOMEQUIP_KEYACTIVATE])
910 {
911 defArray = [item defaultActivateKey];
912 compArray = [[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype];
913 }
914 if ([custom_keytype isEqualToString:CUSTOMEQUIP_KEYMODE])
915 {
916 defArray = [item defaultModeKey];
917 compArray = [[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype];
918 }
919 for (j = 0; j < [defArray count]; j++)
920 {
921 for (k = 0; k < [compArray count]; k++)
922 {
923 if (![self compareKeyEntries:[defArray objectAtIndex:j] second:[compArray objectAtIndex:k]])
924 {
925 result = false;
926 break;
927 }
928 }
929 if (result == false) break;
930 }
931
932 override = (!result ? @"Yes" : @"");
933 validate = [self validateKey:[entry objectForKey:KEY_KC_DEFINITION] checkKeys:(NSArray *)[[customEquipActivation objectAtIndex:idx] oo_arrayForKey:custom_keytype]];
934 }
935 if (assignment == nil)
936 {
937 assignment = @" - ";
938 }
939
940 [gui setArray:[NSArray arrayWithObjects:
941 [entry objectForKey:KEY_KC_GUIDESC], assignment, override, nil]
942 forRow:i + start_row];
943 [gui setKey:[NSString stringWithFormat:@"Index:%ld", i + skip] forRow:i + start_row];
944 if (validate)
945 {
946 [gui setColor:[OOColor orangeColor] forRow:i + start_row];
947 }
948 }
949 }
950 if (i < n_functions - skip)
951 {
952 [gui setColor:[OOColor greenColor] forRow:start_row + i];
953 [gui setArray:[NSArray arrayWithObjects:DESC(@"gui-more"), @" --> ", nil] forRow:start_row + i];
954 [gui setKey:[NSString stringWithFormat:@"More:%ld", n_rows + skip] forRow:start_row + i];
955 i++;
956 }
957
958 [gui setSelectableRange:NSMakeRange(GUI_ROW_KC_SELECTKBD, (i + start_row - GUI_ROW_KC_FUNCSTART) + (GUI_ROW_KC_FUNCSTART - GUI_ROW_KC_SELECTKBD))];
959 }
960}
return nil
#define KEY_KC_HEADER
OOColor * cyanColor()
Definition OOColor.m:286
OOColor * orangeColor()
Definition OOColor.m:304
NSArray * defaultActivateKey()
NSArray * defaultModeKey()

◆ entryIsCustomEquip:

- (BOOL) entryIsCustomEquip: (NSString *) entry

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

327 :(NSString *)entry
328{
329 BOOL result = NO;
330 if ([entry hasPrefix:@"activate_"] || [entry hasPrefix:@"mode_"])
331 result = YES;
332 return result;
333}

◆ entryIsDictCustomEquip:

- (BOOL) entryIsDictCustomEquip: (NSDictionary *) dict

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

322 :(NSDictionary *)dict
323{
324 return [self entryIsCustomEquip:[dict oo_stringForKey:KEY_KC_DEFINITION]];
325}

◆ entryIsEqualToDefault:

- (BOOL) entryIsEqualToDefault: (NSString *) key

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1566 :(NSString*)key
1567{
1568 NSArray *def = (NSArray *)[kdic_check objectForKey:key];
1569 NSUInteger i;
1570
1571 if ([def count] != [key_list count]) return NO;
1572 for (i = 0; i < [key_list count]; i++)
1573 {
1574 NSDictionary *orig = (NSDictionary *)[def objectAtIndex:i];
1575 NSDictionary *entrd = (NSDictionary *)[key_list objectAtIndex:i];
1576 if (![self compareKeyEntries:orig second:entrd]) return NO;
1577 }
1578 return YES;
1579}
static NSDictionary * kdic_check
static NSMutableArray * key_list

◆ entryIsIndexCustomEquip:

- (BOOL) entryIsIndexCustomEquip: (NSUInteger) idx

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

316 :(NSUInteger)idx
317{
318 return [self entryIsCustomEquip:[[keyFunctions objectAtIndex:idx] oo_stringForKey:KEY_KC_DEFINITION]];
319}

◆ getCustomEquipArray:

- (NSArray *) getCustomEquipArray: (NSString *) key_def

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

335 :(NSString *)key_def
336{
337 NSString *eq = nil;
338 NSUInteger i;
339 NSString *key;
340 if ([key_def hasPrefix:@"activate_"])
341 {
342 eq = [key_def stringByReplacingOccurrencesOfString:@"activate_" withString:@""];
344 }
345 if ([key_def hasPrefix:@"mode_"])
346 {
347 eq = [key_def stringByReplacingOccurrencesOfString:@"mode_" withString:@""];
349 }
350 if (eq == nil) return nil;
351 for (i = 0; i < [customEquipActivation count]; i++)
352 {
353 if ([[[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY] isEqualToString:eq])
354 {
355 return [[customEquipActivation objectAtIndex:i] oo_arrayForKey:key];
356 }
357 }
358 return nil;
359}
#define CUSTOMEQUIP_EQUIPKEY

◆ getCustomEquipIndex:

- (NSUInteger) getCustomEquipIndex: (NSString *) key_def

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

362 :(NSString *)key_def
363{
364 NSString *eq = nil;
365 NSUInteger i;
366 if ([key_def hasPrefix:@"activate_"])
367 {
368 eq = [key_def stringByReplacingOccurrencesOfString:@"activate_" withString:@""];
369 }
370 if ([key_def hasPrefix:@"mode_"])
371 {
372 eq = [key_def stringByReplacingOccurrencesOfString:@"mode_" withString:@""];
373 }
374 if (eq == nil) return -1;
375 for (i = 0; i < [customEquipActivation count]; i++)
376 {
377 if ([[[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY] isEqualToString:eq])
378 {
379 return i;
380 }
381 }
382 return -1;
383}

◆ getCustomEquipKeyDefType:

- (NSString *) getCustomEquipKeyDefType: (NSString *) key_def

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

386 :(NSString *)key_def
387{
388 if ([key_def hasPrefix:@"activate_"])
389 {
391 }
392 if ([key_def hasPrefix:@"mode_"])
393 {
394 return CUSTOMEQUIP_KEYMODE;
395 }
396 return @"";
397}

◆ keyboardDescription:

- (NSString *) keyboardDescription: (NSString *) kbd

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1234 :(NSString *)kbd
1235{
1236 NSString *map = @"";
1237#if OOLITE_WINDOWS
1238 map = @"keymappings_windows.plist";
1239#endif
1240#if OOLITE_LINUX
1241 map = @"keymappings_linux.plist";
1242#endif
1243#if OOLITE_MAC_OS_X
1244 map = @"keymappings_mac.plist";
1245#endif
1246 NSDictionary *kmap = [NSDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:map inFolder:@"Config" mergeMode:MERGE_BASIC cache:NO]];
1247 NSDictionary *sect = [kmap objectForKey:kbd];
1248 return [sect objectForKey:@"description"];
1249}
NSDictionary * dictionaryFromFilesNamed:inFolder:mergeMode:cache:(NSString *fileName,[inFolder] NSString *folderName,[mergeMode] OOResourceMergeMode mergeMode,[cache] BOOL useCache)

◆ keyFunctionList

- (NSArray *) keyFunctionList

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

964{
965 NSMutableArray *funcList = [NSMutableArray array];
966
967 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-screen-access")]];
968 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_launch_ship") keyDef:@"key_launch_ship"]];
969 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_options") keyDef:@"key_gui_screen_options"]];
970 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_equipship") keyDef:@"key_gui_screen_equipship"]];
971 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_interfaces") keyDef:@"key_gui_screen_interfaces"]];
972 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_screen_status") keyDef:@"key_gui_screen_status"]];
973 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_chart_screens") keyDef:@"key_gui_chart_screens"]];
974 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_system_data") keyDef:@"key_gui_system_data"]];
975 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_market") keyDef:@"key_gui_market"]];
976
977 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-propulsion")]];
978 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_roll_left") keyDef:@"key_roll_left"]];
979 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_roll_right") keyDef:@"key_roll_right"]];
980 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_pitch_forward") keyDef:@"key_pitch_forward"]];
981 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_pitch_back") keyDef:@"key_pitch_back"]];
982 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_yaw_left") keyDef:@"key_yaw_left"]];
983 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_yaw_right") keyDef:@"key_yaw_right"]];
984
985 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_increase_speed") keyDef:@"key_increase_speed"]];
986 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_decrease_speed") keyDef:@"key_decrease_speed"]];
987 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_inject_fuel") keyDef:@"key_inject_fuel"]];
988 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_jumpdrive") keyDef:@"key_jumpdrive"]];
989 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_hyperspace") keyDef:@"key_hyperspace"]];
990 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_galactic_hyperspace") keyDef:@"key_galactic_hyperspace"]];
991
992 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-navigation")]];
993 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_next_compass_mode") keyDef:@"key_next_compass_mode"]];
994 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_prev_compass_mode") keyDef:@"key_prev_compass_mode"]];
995 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_scanner_zoom") keyDef:@"key_scanner_zoom"]];
996 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_scanner_unzoom") keyDef:@"key_scanner_unzoom"]];
997 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_forward") keyDef:@"key_view_forward"]];
998 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_aft") keyDef:@"key_view_aft"]];
999 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_port") keyDef:@"key_view_port"]];
1000 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_view_starboard") keyDef:@"key_view_starboard"]];
1001 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_ident_system") keyDef:@"key_ident_system"]];
1002
1003 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_docking_clearance_request") keyDef:@"key_docking_clearance_request"]];
1004 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_autopilot") keyDef:@"key_autopilot"]];
1005 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_autodock") keyDef:@"key_autodock"]];
1006 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_docking_music") keyDef:@"key_docking_music"]];
1007
1008 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-offensive")]];
1009 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_weapons_online_toggle") keyDef:@"key_weapons_online_toggle"]];
1010 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_fire_lasers") keyDef:@"key_fire_lasers"]];
1011 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_launch_missile") keyDef:@"key_launch_missile"]];
1012 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_target_missile") keyDef:@"key_target_missile"]];
1013 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_untarget_missile") keyDef:@"key_untarget_missile"]];
1014 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_target_incoming_missile") keyDef:@"key_target_incoming_missile"]];
1015 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_next_missile") keyDef:@"key_next_missile"]];
1016 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_next_target") keyDef:@"key_next_target"]];
1017 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_previous_target") keyDef:@"key_previous_target"]];
1018
1019 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-defensive")]];
1020 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_ecm") keyDef:@"key_ecm"]];
1021 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dump_cargo") keyDef:@"key_dump_cargo"]];
1022 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_rotate_cargo") keyDef:@"key_rotate_cargo"]];
1023 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_launch_escapepod") keyDef:@"key_launch_escapepod"]];
1024
1025 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-special-equip")]];
1026 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_cycle_next_mfd") keyDef:@"key_cycle_next_mfd"]];
1027 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_cycle_previous_mfd") keyDef:@"key_cycle_previous_mfd"]];
1028 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_switch_next_mfd") keyDef:@"key_switch_next_mfd"]];
1029 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_switch_previous_mfd") keyDef:@"key_switch_previous_mfd"]];
1030
1031 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_prime_next_equipment") keyDef:@"key_prime_next_equipment"]];
1032 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_prime_previous_equipment") keyDef:@"key_prime_previous_equipment"]];
1033 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_activate_equipment") keyDef:@"key_activate_equipment"]];
1034 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_mode_equipment") keyDef:@"key_mode_equipment"]];
1035 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_fastactivate_equipment_a") keyDef:@"key_fastactivate_equipment_a"]];
1036 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_fastactivate_equipment_b") keyDef:@"key_fastactivate_equipment_b"]];
1037
1038 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-chart-screen")]];
1039 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_advanced_nav_array_next") keyDef:@"key_advanced_nav_array_next"]];
1040 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_advanced_nav_array_previous") keyDef:@"key_advanced_nav_array_previous"]];
1041 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_home") keyDef:@"key_map_home"]];
1042 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_end") keyDef:@"key_map_end"]];
1043 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_info") keyDef:@"key_map_info"]];
1044 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_zoom_in") keyDef:@"key_map_zoom_in"]];
1045 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_zoom_out") keyDef:@"key_map_zoom_out"]];
1046 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_next_system") keyDef:@"key_map_next_system"]];
1047 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_map_previous_system") keyDef:@"key_map_previous_system"]];
1048 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_chart_highlight") keyDef:@"key_chart_highlight"]];
1049
1050 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-planet-info-screen")]];
1051 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_home") keyDef:@"key_system_home"]];
1052 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_end") keyDef:@"key_system_end"]];
1053 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_next_system") keyDef:@"key_system_next_system"]];
1054 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_system_previous_system") keyDef:@"key_system_previous_system"]];
1055
1056 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-market-screen")]];
1057 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_filter_cycle") keyDef:@"key_market_filter_cycle"]];
1058 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_sorter_cycle") keyDef:@"key_market_sorter_cycle"]];
1059 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_buy_one") keyDef:@"key_market_buy_one"]];
1060 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_sell_one") keyDef:@"key_market_sell_one"]];
1061 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_buy_max") keyDef:@"key_market_buy_max"]];
1062 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_market_sell_max") keyDef:@"key_market_sell_max"]];
1063
1064 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-misc")]];
1065 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_snapshot") keyDef:@"key_snapshot"]];
1066 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_pausebutton") keyDef:@"key_pausebutton"]];
1067 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_show_fps") keyDef:@"key_show_fps"]];
1068 //[funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_bloom_toggle") keyDef:@"key_bloom_toggle"]];
1069 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_mouse_control_roll") keyDef:@"key_mouse_control_roll"]];
1070 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_mouse_control_yaw") keyDef:@"key_mouse_control_yaw"]];
1071 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_hud_toggle") keyDef:@"key_hud_toggle"]];
1072#if OO_FOV_INFLIGHT_CONTROL_ENABLED
1073 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_inc_field_of_view") keyDef:@"key_inc_field_of_view"]];
1074 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dec_field_of_view") keyDef:@"key_dec_field_of_view"]];
1075#endif
1076 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_comms_log") keyDef:@"key_comms_log"]];
1077
1078 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-custom-view")]];
1079 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view") keyDef:@"key_custom_view"]];
1080 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_zoom_in") keyDef:@"key_custom_view_zoom_in"]];
1081 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_zoom_out") keyDef:@"key_custom_view_zoom_out"]];
1082 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_roll_left") keyDef:@"key_custom_view_roll_left"]];
1083 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_roll_right") keyDef:@"key_custom_view_roll_right"]];
1084 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_left") keyDef:@"key_custom_view_pan_left"]];
1085 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_right") keyDef:@"key_custom_view_pan_right"]];
1086 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_up") keyDef:@"key_custom_view_pan_up"]];
1087 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_pan_down") keyDef:@"key_custom_view_pan_down"]];
1088 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_left") keyDef:@"key_custom_view_rotate_left"]];
1089 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_right") keyDef:@"key_custom_view_rotate_right"]];
1090 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_up") keyDef:@"key_custom_view_rotate_up"]];
1091 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_custom_view_rotate_down") keyDef:@"key_custom_view_rotate_down"]];
1092
1093 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-oxz-manager")]];
1094 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_oxzmanager_setfilter") keyDef:@"key_oxzmanager_setfilter"]];
1095 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_oxzmanager_showinfo") keyDef:@"key_oxzmanager_showinfo"]];
1096 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_oxzmanager_extract") keyDef:@"key_oxzmanager_extract"]];
1097
1098 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-gui")]];
1099 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_left") keyDef:@"key_gui_arrow_left"]];
1100 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_right") keyDef:@"key_gui_arrow_right"]];
1101 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_up") keyDef:@"key_gui_arrow_up"]];
1102 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_arrow_down") keyDef:@"key_gui_arrow_down"]];
1103 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_page_down") keyDef:@"key_gui_page_down"]];
1104 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_page_up") keyDef:@"key_gui_page_up"]];
1105 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_gui_select") keyDef:@"key_gui_select"]];
1106
1107 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-debug")]];
1108 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dump_target_state") keyDef:@"key_dump_target_state"]];
1109 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_dump_entity_list") keyDef:@"key_dump_entity_list"]];
1110 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_full") keyDef:@"key_debug_full"]];
1111 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_collision") keyDef:@"key_debug_collision"]];
1112 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_console_connect") keyDef:@"key_debug_console_connect"]];
1113 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_bounding_boxes") keyDef:@"key_debug_bounding_boxes"]];
1114 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_shaders") keyDef:@"key_debug_shaders"]];
1115 [funcList addObject:[self makeKeyGuiDict:DESC(@"oolite-keydesc-key_debug_off") keyDef:@"key_debug_off"]];
1116
1117 if ([customEquipActivation count] > 0)
1118 {
1119 [funcList addObject:[self makeKeyGuiDictHeader:DESC(@"oolite-keydesc-header-oxp-equip")]];
1120 int i;
1121 for (i = 0; i < [customEquipActivation count]; i++)
1122 {
1123 [funcList addObject:[self makeKeyGuiDict:[NSString stringWithFormat: @"Activate '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
1124 keyDef:[NSString stringWithFormat:@"activate_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]]];
1125 [funcList addObject:[self makeKeyGuiDict:[NSString stringWithFormat: @"Mode '%@'", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPNAME]]
1126 keyDef:[NSString stringWithFormat:@"mode_%@", [[customEquipActivation objectAtIndex:i] oo_stringForKey:CUSTOMEQUIP_EQUIPKEY]]]];
1127 }
1128 }
1129 return funcList;
1130}

◆ loadKeySettings

- (NSDictionary *) loadKeySettings

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1730{
1731 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1732 return [defaults objectForKey:KEYCONFIG_OVERRIDES];
1733}

◆ reloadPage

- (void) reloadPage

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1738{
1739 // Update the GUI (this will refresh the function list).
1740 unsigned skip;
1741 if (selFunctionIdx < MAX_ROWS_KC_FUNCTIONS - 1)
1742 {
1743 skip = 0;
1744 }
1745 else
1746 {
1747 skip = ((selFunctionIdx - 1) / (MAX_ROWS_KC_FUNCTIONS - 2)) * (MAX_ROWS_KC_FUNCTIONS - 2) + 1;
1748 }
1749
1750 [self setGuiToKeyMapperScreen:skip];
1751}

◆ resetKeyFunctions

- (void) resetKeyFunctions

Extends class PlayerEntity.

Definition at line 1 of file PlayerEntityKeyMapper.m.

116{
117 [keyFunctions release];
118 keyFunctions = nil;
119}

◆ saveKeySetting:

- (void) saveKeySetting: (NSString *) key

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1597 :(NSString*)key
1598{
1599 // check for a blank entry
1600 if ([key_list count] > 1 && [[(NSDictionary*)[key_list objectAtIndex:1] objectForKey:@"key"] integerValue] == 0)
1601 {
1602 [key_list removeObjectAtIndex:1];
1603 }
1604 // make sure the primary and alternate keys are different
1605 if ([key_list count] > 1) {
1606 if ([self compareKeyEntries:[key_list objectAtIndex:0] second:[key_list objectAtIndex:1]])
1607 {
1608 [key_list removeObjectAtIndex:1];
1609 }
1610 }
1611 // see if we've set the key settings to blank - in which case, delete the override
1612 if ([[(NSDictionary*)[key_list objectAtIndex:0] objectForKey:@"key"] integerValue] == 0)
1613 {
1614 if ([key_list count] == 1 || ([key_list count] > 1 && [[(NSDictionary*)[key_list objectAtIndex:1] objectForKey:@"key"] isEqualToString:@""]))
1615 {
1616 [self deleteKeySetting:key];
1617 // reload settings
1618 [self initKeyConfigSettings];
1619 [self reloadPage];
1620 return;
1621 }
1622 }
1623
1624 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1625
1626 if (![self entryIsCustomEquip:key])
1627 {
1628 // if we've got the same settings as the default, revert to the default
1629 if ([self entryIsEqualToDefault:key])
1630 {
1631 [self deleteKeySetting:key];
1632 // reload settings
1633 [self initKeyConfigSettings];
1634 [self reloadPage];
1635 return;
1636 }
1637 NSMutableDictionary *keyconf = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:KEYCONFIG_OVERRIDES]];
1638 [keyconf setObject:key_list forKey:key];
1639 [defaults setObject:keyconf forKey:KEYCONFIG_OVERRIDES];
1640 }
1641 else
1642 {
1643 NSUInteger idx = [self getCustomEquipIndex:key];
1644 NSString *custkey = [self getCustomEquipKeyDefType:key];
1645 NSMutableDictionary *custEquip = [[customEquipActivation objectAtIndex:idx] mutableCopy];
1646 [custEquip setObject:key_list forKey:custkey];
1647 [customEquipActivation replaceObjectAtIndex:idx withObject:custEquip];
1648 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1649 }
1650 // reload settings
1651 [self initKeyConfigSettings];
1652 [self reloadPage];
1653}

◆ searchArrayForMatch:key:checkKeys:

- (NSString *) searchArrayForMatch: (NSArray *) search_list
key: (NSString *) key
checkKeys: (NSArray *) check_keys 

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1529 :(NSArray *)search_list key:(NSString *)key checkKeys:(NSArray *)check_keys
1530{
1531 NSString *search = nil;
1532 NSUInteger i, j, k;
1533 for (i = 0; i < [search_list count]; i++)
1534 {
1535 search = (NSString*)[search_list objectAtIndex:i];
1536 // only check other key settings, not the one we've been passed
1537 if (![search isEqualToString:key])
1538 {
1539 // get the array from keyconfig2_settings
1540 // we need to compare all entries to each other to look for any match, as any match would indicate a conflict
1541 NSArray *current = nil;
1542 if (![self entryIsCustomEquip:search])
1543 {
1544 current = (NSArray *)[keyconfig2_settings objectForKey:search];
1545 }
1546 else
1547 {
1548 NSUInteger idx = [self getCustomEquipIndex:search];
1549 NSString *keytype = [self getCustomEquipKeyDefType:search];
1550 current = (NSArray *)[[customEquipActivation objectAtIndex:idx] objectForKey:keytype];
1551 }
1552 for (j = 0; j < [current count]; j++)
1553 {
1554 for (k = 0; k < [check_keys count]; k++)
1555 {
1556 if ([self compareKeyEntries:[current objectAtIndex:j] second:[check_keys objectAtIndex:k]]) return search;
1557 }
1558 }
1559 }
1560 }
1561 return nil;
1562}

◆ unsetKeySetting:

- (void) unsetKeySetting: (NSString *) key

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1656 :(NSString*)key
1657{
1658 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1659 if (![self entryIsCustomEquip:key])
1660 {
1661 NSMutableDictionary *keyconf = [NSMutableDictionary dictionaryWithDictionary:[defaults objectForKey:KEYCONFIG_OVERRIDES]];
1662 NSMutableArray *empty = [[NSMutableArray alloc] init];
1663 [keyconf setObject:empty forKey:key];
1664 [defaults setObject:keyconf forKey:KEYCONFIG_OVERRIDES];
1665 [empty release];
1666 }
1667 else
1668 {
1669 NSString *custkey = [self getCustomEquipKeyDefType:key];
1670 [[customEquipActivation objectAtIndex:[self getCustomEquipIndex:key]] removeObjectForKey:custkey];
1671 [defaults setObject:customEquipActivation forKey:KEYCONFIG_CUSTOMEQUIP];
1672 }
1673 // reload settings
1674 [self initKeyConfigSettings];
1675}

◆ updateKeyDefinition:index:

- (void) updateKeyDefinition: (NSString *) keystring
index: (NSUInteger) index 

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

678 :(NSString *)keystring index:(NSUInteger)index
679{
680 NSMutableDictionary *key_def = [[NSMutableDictionary alloc] initWithDictionary:(NSDictionary *)[key_list objectAtIndex:index] copyItems:YES];
681 [key_def setObject:keystring forKey:@"key"];
682 // auto=turn on shift if the entered key was shifted
683
684 if (last_shift && [keystring length] == 1 && ![nav_keys containsObject:[selected_entry objectForKey: KEY_KC_DEFINITION]])
685 {
686 [key_def setObject:[NSNumber numberWithBool:YES] forKey:@"shift"];
687 }
688 if (!last_shift && [keystring length] == 1)
689 {
690 [key_def setObject:[NSNumber numberWithBool:NO] forKey:@"shift"];
691 }
692 last_shift = NO;
693 if (index > [key_list count] - 1)
694 {
695 [key_list insertObject:key_def atIndex:index];
696 }
697 else
698 {
699 [key_list replaceObjectAtIndex:index withObject:key_def];
700 }
701 [key_def release];
702 NSArray *new_array = [self processKeyCode:key_list];
703 [key_list release];
704 key_list = [[NSMutableArray alloc] initWithArray:new_array copyItems:YES];
705 [new_array release];
706}
#define KEY_KC_DEFINITION
static NSDictionary * selected_entry
static NSArray * nav_keys
static BOOL last_shift

◆ updateShiftKeyDefinition:index:

- (void) updateShiftKeyDefinition: (NSString *) key
index: (NSUInteger) index 

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

710 :(NSString *)key index:(NSUInteger)index
711{
712 NSMutableDictionary *key_def = [[NSMutableDictionary alloc] initWithDictionary:(NSDictionary *)[key_list objectAtIndex:index] copyItems:YES];
713 BOOL current = [[key_def objectForKey:key] boolValue];
714 BOOL keycode_changed = NO;
715 current = !current;
716 [key_def setObject:[NSNumber numberWithBool:current] forKey:key];
717 if ([key isEqualToString:@"shift"])
718 {
719 // force the key into upper or lower case, to limit invalid key combos as much as possible
720 NSString* keycode = [key_def objectForKey:@"key"];
721 NSInteger k_int = (OOKeyCode)[keycode integerValue];
722 if (k_int > 0)
723 {
724 NSString* keystring = [self keyCodeDescription:k_int];
725 NSString* newstring;
726 if ([keystring length] == 1)
727 {
728 // try switching the case. for characters that can't be switched (eg 1,2,3,etc), this should do nothing
729 if (current)
730 {
731 newstring = [keystring uppercaseString];
732 }
733 else
734 {
735 newstring = [keystring lowercaseString];
736 }
737 if (![newstring isEqualToString:keystring])
738 {
739 [key_def setObject:newstring forKey:@"key"];
740 keycode_changed = YES;
741 }
742 }
743 }
744 }
745 if (index > [key_list count] - 1)
746 {
747 [key_list insertObject:key_def atIndex:index];
748 }
749 else
750 {
751 [key_list replaceObjectAtIndex:index withObject:key_def];
752 }
753 [key_def release];
754 if (keycode_changed)
755 {
756 NSArray *new_array = [self processKeyCode:key_list];
757 [key_list release];
758 key_list = [[NSMutableArray alloc] initWithArray:new_array copyItems:YES];
759 [new_array release];
760 }
761}
uint16_t OOKeyCode
Definition OOTypes.h:186

◆ validateAllKeys

- (NSArray *) validateAllKeys

Extends class PlayerEntity.

Definition at line 44 of file PlayerEntityKeyMapper.m.

1372{
1373 NSMutableArray *failed = [[NSMutableArray alloc] init];
1374 NSString *validate = nil;
1375 NSUInteger i;
1376
1377 for (i = 0; i < [keyFunctions count]; i++)
1378 {
1379 NSDictionary *entry = [keyFunctions objectAtIndex:i];
1380 validate = [self validateKey:[entry objectForKey:KEY_KC_DEFINITION] checkKeys:(NSArray *)[keyconfig2_settings objectForKey:[entry objectForKey:KEY_KC_DEFINITION]]];
1381 if (validate)
1382 {
1383 [failed addObject:validate];
1384 }
1385 }
1386 return [failed copy];
1387}

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