diff --git a/Resources/Config/keyconfig.plist b/Resources/Config/keyconfig.plist index fbb766f3..1310aec4 100644 --- a/Resources/Config/keyconfig.plist +++ b/Resources/Config/keyconfig.plist @@ -71,6 +71,6 @@ key_previous_target 43 key_custom_view - 118 + v diff --git a/src/Core/PlayerEntity.m b/src/Core/PlayerEntity.m index 223d013f..5dedd796 100644 --- a/src/Core/PlayerEntity.m +++ b/src/Core/PlayerEntity.m @@ -74,7 +74,27 @@ static Quaternion quaternion_identity = { (GLfloat)1.0, (GLfloat)0.0, (GLfloat)0 - (void) init_keys { - NSDictionary *kdic = [ResourceManager dictionaryFromFilesNamed:@"keyconfig.plist" inFolder:@"Config" andMerge:YES]; + NSMutableDictionary *kdic = [NSMutableDictionary dictionaryWithDictionary:[ResourceManager dictionaryFromFilesNamed:@"keyconfig.plist" inFolder:@"Config" andMerge:YES]]; + // + // pre-process kdic - replace any strings with an integer representing the ASCII value of the first character + // + int i; + NSArray* keys = [kdic allKeys]; + for (i = 0; i < [keys count]; i++) + { + id key = [keys objectAtIndex:i]; + id value = [kdic objectForKey: key]; + if ([value isKindOfClass:[NSString class]]) + { + char keychar = 0; + NSString* keystring = (NSString*)value; + if ([keystring length]) + keychar = [keystring characterAtIndex: 0] & 0x00ff; // uses lower byte of unichar + [kdic setObject:[NSNumber numberWithInt:(int)keychar] forKey:key]; + } + } + // + // set default keys... // key_roll_left = gvArrowKeyLeft; key_roll_right = gvArrowKeyRight;