diff --git a/src/Core/Entities/PlayerEntity.h b/src/Core/Entities/PlayerEntity.h index 439c8b99..52cbcec2 100644 --- a/src/Core/Entities/PlayerEntity.h +++ b/src/Core/Entities/PlayerEntity.h @@ -387,6 +387,8 @@ typedef enum GLfloat fuel_leak_rate; // keys! + NSDictionary *keyconfig_settings; + OOKeyCode key_roll_left; OOKeyCode key_roll_right; OOKeyCode key_pitch_forward; @@ -633,6 +635,8 @@ typedef enum - (void) setForwardShieldLevel:(GLfloat)level; - (void) setAftShieldLevel:(GLfloat)level; +// return keyconfig.plist settings for scripting +- (NSDictionary *) keyConfig; - (BOOL) isMouseControlOn; - (GLfloat) dialRoll; diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index 161dc597..2ba35143 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -1763,6 +1763,7 @@ static GLfloat sBaseMass = 0.0; DESTROY(compassTarget); DESTROY(hud); DESTROY(commLog); + DESTROY(keyconfig_settings); DESTROY(worldScripts); DESTROY(worldScriptsRequiringTickle); @@ -3310,6 +3311,12 @@ static GLfloat sBaseMass = 0.0; } +- (NSDictionary *) keyConfig +{ + return keyconfig_settings; +} + + - (BOOL) isMouseControlOn { return mouse_control_on; diff --git a/src/Core/Entities/PlayerEntityControls.m b/src/Core/Entities/PlayerEntityControls.m index 9ef39932..2d81ac75 100644 --- a/src/Core/Entities/PlayerEntityControls.m +++ b/src/Core/Entities/PlayerEntityControls.m @@ -205,7 +205,7 @@ static NSTimeInterval time_last_frame; } // set default keys. -#define LOAD_KEY_SETTING(name, default) name = [kdic oo_unsignedShortForKey:@#name defaultValue:default] +#define LOAD_KEY_SETTING(name, default) name = [kdic oo_unsignedShortForKey:@#name defaultValue:default]; [kdic setObject:[NSNumber numberWithUnsignedChar:name] forKey:@#name] LOAD_KEY_SETTING(key_roll_left, gvArrowKeyLeft ); LOAD_KEY_SETTING(key_roll_right, gvArrowKeyRight ); @@ -285,6 +285,8 @@ static NSTimeInterval time_last_frame; if (key_yaw_right == key_roll_right && key_yaw_right == '.') key_yaw_right = 0; // other keys are SET and cannot be varied + [keyconfig_settings release]; + keyconfig_settings = [[NSDictionary alloc] initWithDictionary:kdic]; // Enable polling pollControls=YES; diff --git a/src/Core/Universe.m b/src/Core/Universe.m index 2e3349b8..67e5b078 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -3322,7 +3322,7 @@ static BOOL IsFriendlyStationPredicate(Entity *entity, void *parameter) - (NSDictionary *) gameSettings { - NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:8]; + NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:9]; [result oo_setBool:reducedDetail forKey:@"reducedDetailGraphics"]; [result oo_setBool:[PLAYER isSpeechOn] forKey:@"speechOn"]; @@ -3348,6 +3348,8 @@ static BOOL IsFriendlyStationPredicate(Entity *entity, void *parameter) nil]; [result setObject:gameWindow forKey:@"gameWindow"]; + [result setObject:[PLAYER keyConfig] forKey:@"keyConfig"]; + return [[result copy] autorelease]; }