Expose keyconfig.plist contents to script in oolite.gameSettings.keyConfig
This commit is contained in:
parent
055c480944
commit
659b572a50
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user