- Fix for view direction not being updated at the time of guiScreenChange. The JS event handler viewDirectionChanged(to, from) now handles
view screen and custom view changes. - Renamed the JS property viewID to viewDirection, as the ID suffix usually denotes integer type rather than string. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3837 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
fbc4ceb0a1
commit
0898cfc152
@ -140,7 +140,8 @@ static NSTimeInterval time_last_frame;
|
||||
- (void) pollDockedControls:(double) delta_t;
|
||||
- (void) pollDemoControls:(double) delta_t;
|
||||
- (void) handleMissionCallback;
|
||||
- (void) switchToThisView:(OOViewID) viewDirection;
|
||||
- (void) switchToThisView:(OOViewID)viewDirection;
|
||||
- (void) switchToThisView:(OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing;
|
||||
|
||||
- (void) handleAutopilotOn:(BOOL)fastDocking;
|
||||
|
||||
@ -2585,9 +2586,7 @@ static NSTimeInterval time_last_frame;
|
||||
|
||||
[self setCustomViewDataFromDictionary:[_customViews oo_dictionaryAtIndex:_customViewIndex]];
|
||||
|
||||
if ([UNIVERSE displayGUI])
|
||||
[self switchToMainView];
|
||||
[UNIVERSE setViewDirection:VIEW_CUSTOM];
|
||||
[self switchToThisView:VIEW_CUSTOM andProcessWeaponFacing:NO]; // weapon facing must not change, we just want an external view
|
||||
}
|
||||
customView_pressed = YES;
|
||||
}
|
||||
@ -3312,12 +3311,28 @@ static BOOL toggling_music;
|
||||
}
|
||||
|
||||
|
||||
- (void) switchToThisView:(OOViewID) viewDirection
|
||||
- (void) switchToThisView:(OOViewID)viewDirection
|
||||
{
|
||||
[self switchToThisView:viewDirection andProcessWeaponFacing:YES];
|
||||
}
|
||||
|
||||
|
||||
- (void) switchToThisView:(OOViewID)viewDirection andProcessWeaponFacing:(BOOL)processWeaponFacing
|
||||
{
|
||||
OOViewID oldViewDirection = [UNIVERSE viewDirection];
|
||||
if ([UNIVERSE displayGUI]) [self switchToMainView];
|
||||
[UNIVERSE setViewDirection:viewDirection];
|
||||
currentWeaponFacing = viewDirection;
|
||||
[self currentWeaponStats];
|
||||
if (processWeaponFacing)
|
||||
{
|
||||
currentWeaponFacing = viewDirection;
|
||||
[self currentWeaponStats];
|
||||
}
|
||||
if ((oldViewDirection != viewDirection || viewDirection == VIEW_CUSTOM) && ![[UNIVERSE gameController] gameIsPaused])
|
||||
{
|
||||
[self doScriptEvent:@"viewDirectionChanged"
|
||||
withArgument:ViewIDToString(viewDirection)
|
||||
andArgument:ViewIDToString(oldViewDirection)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,7 +113,7 @@ enum
|
||||
kPlayerShip_scriptedMisjump, // next jump will miss if set to true, boolean, read/write
|
||||
kPlayerShip_specialCargo, // special cargo, string, read-only
|
||||
kPlayerShip_targetSystem, // target system id, int, read-only
|
||||
kPlayerShip_viewID, // view direction ID, string, read-only
|
||||
kPlayerShip_viewDirection, // view direction identifier, string, read-only
|
||||
kPlayerShip_weaponsOnline, // weapons online status, boolean, read-only
|
||||
};
|
||||
|
||||
@ -144,7 +144,7 @@ static JSPropertySpec sPlayerShipProperties[] =
|
||||
{ "scriptedMisjump", kPlayerShip_scriptedMisjump, JSPROP_PERMANENT | JSPROP_ENUMERATE },
|
||||
{ "specialCargo", kPlayerShip_specialCargo, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "targetSystem", kPlayerShip_targetSystem, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "viewID", kPlayerShip_viewID, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "viewDirection", kPlayerShip_viewDirection, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ "weaponsOnline", kPlayerShip_weaponsOnline, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
|
||||
{ 0 }
|
||||
};
|
||||
@ -328,7 +328,7 @@ static JSBool PlayerShipGetProperty(JSContext *context, JSObject *this, jsval na
|
||||
OK = YES;
|
||||
break;
|
||||
|
||||
case kPlayerShip_viewID:
|
||||
case kPlayerShip_viewDirection:
|
||||
result = ViewIDToString([UNIVERSE viewDirection]);
|
||||
OK = YES;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user