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;
|
GLfloat fuel_leak_rate;
|
||||||
|
|
||||||
// keys!
|
// keys!
|
||||||
|
NSDictionary *keyconfig_settings;
|
||||||
|
|
||||||
OOKeyCode key_roll_left;
|
OOKeyCode key_roll_left;
|
||||||
OOKeyCode key_roll_right;
|
OOKeyCode key_roll_right;
|
||||||
OOKeyCode key_pitch_forward;
|
OOKeyCode key_pitch_forward;
|
||||||
@ -633,6 +635,8 @@ typedef enum
|
|||||||
- (void) setForwardShieldLevel:(GLfloat)level;
|
- (void) setForwardShieldLevel:(GLfloat)level;
|
||||||
- (void) setAftShieldLevel:(GLfloat)level;
|
- (void) setAftShieldLevel:(GLfloat)level;
|
||||||
|
|
||||||
|
// return keyconfig.plist settings for scripting
|
||||||
|
- (NSDictionary *) keyConfig;
|
||||||
- (BOOL) isMouseControlOn;
|
- (BOOL) isMouseControlOn;
|
||||||
|
|
||||||
- (GLfloat) dialRoll;
|
- (GLfloat) dialRoll;
|
||||||
|
@ -1763,6 +1763,7 @@ static GLfloat sBaseMass = 0.0;
|
|||||||
DESTROY(compassTarget);
|
DESTROY(compassTarget);
|
||||||
DESTROY(hud);
|
DESTROY(hud);
|
||||||
DESTROY(commLog);
|
DESTROY(commLog);
|
||||||
|
DESTROY(keyconfig_settings);
|
||||||
|
|
||||||
DESTROY(worldScripts);
|
DESTROY(worldScripts);
|
||||||
DESTROY(worldScriptsRequiringTickle);
|
DESTROY(worldScriptsRequiringTickle);
|
||||||
@ -3310,6 +3311,12 @@ static GLfloat sBaseMass = 0.0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (NSDictionary *) keyConfig
|
||||||
|
{
|
||||||
|
return keyconfig_settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (BOOL) isMouseControlOn
|
- (BOOL) isMouseControlOn
|
||||||
{
|
{
|
||||||
return mouse_control_on;
|
return mouse_control_on;
|
||||||
|
@ -205,7 +205,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set default keys.
|
// 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_left, gvArrowKeyLeft );
|
||||||
LOAD_KEY_SETTING(key_roll_right, gvArrowKeyRight );
|
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;
|
if (key_yaw_right == key_roll_right && key_yaw_right == '.') key_yaw_right = 0;
|
||||||
|
|
||||||
// other keys are SET and cannot be varied
|
// other keys are SET and cannot be varied
|
||||||
|
[keyconfig_settings release];
|
||||||
|
keyconfig_settings = [[NSDictionary alloc] initWithDictionary:kdic];
|
||||||
|
|
||||||
// Enable polling
|
// Enable polling
|
||||||
pollControls=YES;
|
pollControls=YES;
|
||||||
|
@ -3322,7 +3322,7 @@ static BOOL IsFriendlyStationPredicate(Entity *entity, void *parameter)
|
|||||||
|
|
||||||
- (NSDictionary *) gameSettings
|
- (NSDictionary *) gameSettings
|
||||||
{
|
{
|
||||||
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:8];
|
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:9];
|
||||||
|
|
||||||
[result oo_setBool:reducedDetail forKey:@"reducedDetailGraphics"];
|
[result oo_setBool:reducedDetail forKey:@"reducedDetailGraphics"];
|
||||||
[result oo_setBool:[PLAYER isSpeechOn] forKey:@"speechOn"];
|
[result oo_setBool:[PLAYER isSpeechOn] forKey:@"speechOn"];
|
||||||
@ -3348,6 +3348,8 @@ static BOOL IsFriendlyStationPredicate(Entity *entity, void *parameter)
|
|||||||
nil];
|
nil];
|
||||||
[result setObject:gameWindow forKey:@"gameWindow"];
|
[result setObject:gameWindow forKey:@"gameWindow"];
|
||||||
|
|
||||||
|
[result setObject:[PLAYER keyConfig] forKey:@"keyConfig"];
|
||||||
|
|
||||||
return [[result copy] autorelease];
|
return [[result copy] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user