mission.exitScreen r/w property (only useful to set from callback)

mission.screenID property (set from screenID property in runScreen)
Built-in interfaces set a screenID 
Update Changelog.


git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@5485 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Chris Morris 2012-11-12 15:01:07 +00:00
parent ce5eae2096
commit b8761626c0
11 changed files with 250 additions and 2 deletions

View File

@ -1,4 +1,5 @@
Changes between Oolite 1.76 and Oolite 1.77:
Gameplay:
=========
@ -6,12 +7,168 @@ General:
--------
* Enabled reverse-stepping through list of beacons shown by the Advanced
Space Compass. The default key is '|' (Shift-'\').
* Energy bomb made strict mode only.
* Ships with a bounty will often avoid the main station
* A certain classified device is now possible to repair and has had
minor changes to its behaviour.
* Improvements to sound effect handling for scoop and laser
* Several efficiency improvements for smoother gameplay
* New combat behaviour and AI, including:
More consistent missile explosion behaviour
Smarter Thargoids
Smarter use of turret weapons
Better reactions against cloaked opponents
Better reaction to deployment of Q-mines
NPCs can now use side weapons
NPC lasers now equivalent to player lasers in terms of rate of fire
and overheating.
* Gamma control for SDL builds
* System populator cleaner, and hermits now semi-persistent
* Longer visibility distance
* Criminal behaviour sanctions now equivalent for player and NPCs
* Witchspace exit speed now depends on the lead ship, and player
following NPC through a wormhole now behaves better.
* Keyboard precision mode
* Stations can now have multiple docks
* Docking Clearance Protocol now a Game Option
* Interfaces screen on docked F4 for accessing arbitrary station or
ship systems. Passenger and cargo contracts moved to this screen;
parcel contracts added.
* Can switch to custom views while paused
* Improved rendering of planetary atmosphere and sun
* New 'b' key for activation of secondary function of primable
equipment (e.g. a mode switch)
Bug fixes:
----------
* 'sendAllShipsAway' no longer tries to send ships without a hyperspace
motor away.
* Added missing new keyboard controls to the BBC keyconfig.plist
* Scoop icon fixed for ships carrying special cargo
* Docking behaviour now more reliable at low frame rates and at odd
approach angles
* Negative ship distances on HUD fixed
* Laser position display fix
* Target system memory expansion now works properly with cloaked ships
* Cargo rounding and save/load bugs fixed
* Advanced Navigation Array display bug fixed
* Being on board a witchspacing carrier now works more sensibly
* Larger witchbuoys no longer a collision risk
* Several crash bugs fixed
Expansion Pack Development:
===========================
AI:
---
* New events:
DEFENSE_TARGET_LOST
DEFENSE_TARGET_DESTROYED
CASCADE_WEAPON_DETECTED
ATTACKER_MISSED
* New commands:
addPrimaryAggressorAsDefenseTarget
addFoundTargetAsDefenseTarget
findNewDefenseTarget
clearDefenseTargets
setTargetToRandomStation
setTargetToLastStation
performLandOnPlanet
storeTarget
recallStoredTarget
performScriptedAI
performScriptedCombatAI
* Higher skill combat AIs available through 'accuracy' setting
* Full frame-by-frame control over ship AI now available from script
Config files:
-------------
* Required space in equipment.plist now works as intended
* damage_probability setting in equipment.plist
* Ship role list now automatically includes "[shipDataKey]"; roles beginning "[" forbidden.
* Shipdata weapon_facings property to set available laser mounts
* bright_fraction property for flasher subentities
* Crosshair plist files separate from HUD
* Several new descriptions.plist and missiontext.plist entries
* New effectdata.plist to define visual effects - items with a visual appearance, and perhaps a scanner and compass signal, but no physical presence. These can be used to supplement/replace break patterns, among other effects.
Scripting:
----------
* Various debug console improvements
* Additional 'b' key and mode() function for primable equipment
* "Dock" entity type, for control over docking and launching,
especially in multidock stations.
* More parameters for mission.markSystem, to allow custom markers
* Condition scripts for equipment, ships, and shipyard to replace
legacy conditions.
* Numerous additional options for mission.runScreen, and related
properties for mission objects
* "VisualEffect" entity type, for management of effects defined
through effectdata.plist
* New properties
ship.beaconCode
ship.*Weapon now editable
ship.dataKey
player.ship.price
ship.weaponFacings
player.ship.serviceLevel
ship.pitch, ship.roll, ship.yaw
ship.boundingBox
ship.autoAI
station.hasShipyard
ship.commodity
ship.commodityCount
ship.laserHeatLevel
system.breakPattern
station.breakPattern
ship.currentWeapon
ship.weaponPosition*
ship.AIFoundTarget
ship.AIPrimaryAggressor
ship.destination
ship.desiredRange
station.market
* New methods
player.replaceShip(key)
ship.setBounty
global.autoAIForRole(role)
ship.dealEnergyDamage
ship.getMaterials
ship.getShaders
player.ship.setCustomView(position,orientation)
player.ship.resetCustomView
player.ship.takeInternalDamage()
system.addVisualEffect
station.setMarketPrice(cargo,price)
station.setMarketQuantity(cargo,price)
* New events
shipHitByECM {new 'whom' argument}
shipLandedOnPlanet(planet)
playerBoughtCargo
playerSoldCargo
shipScoopedFuel
equipmentRepaired
shipBountyChanged(delta,reason)
dayChanged(day)
cascadeWeaponDetected(weapon)
shipBeingAttackedUnsuccessfully(attacker)
Miscellaneous:
--------------
* TAF changes only possible when FPS display is active
* Planettool updated
Bugfixes:
---------
* Turret declarations now work as intended
* Planetinfo overrides now cleaned up from savegames
* guiScreenWillChange fires correctly
* Timer allocation fixed
System requirements:
====================

View File

@ -426,6 +426,7 @@ this._cargoContractsDisplay = function(summary) {
mission.runScreen({titleKey: "oolite-contracts-cargo-none-available-title",
messageKey: "oolite-contracts-cargo-none-available-message",
allowInterrupt: true,
screenID: "oolite-contracts-cargo-none",
exitScreen: "GUI_SCREEN_INTERFACES"});
// no callback, just exits contracts system
return;
@ -560,6 +561,7 @@ this._cargoContractSummaryPage = function()
var missionConfig = {titleKey: "oolite-contracts-cargo-title-summary",
message: headline,
allowInterrupt: true,
screenID: "oolite-contracts-cargo-summary",
exitScreen: "GUI_SCREEN_INTERFACES",
choices: options,
initialChoicesKey: initialChoice};
@ -688,6 +690,7 @@ this._cargoContractSinglePage = function()
title: title,
message: message,
allowInterrupt: true,
screenID: "oolite-contracts-cargo-details",
exitScreen: "GUI_SCREEN_INTERFACES",
backgroundSpecial: backgroundSpecial,
choices: options,

View File

@ -354,6 +354,7 @@ this._parcelContractsDisplay = function(summary) {
mission.runScreen({titleKey: "oolite-contracts-parcels-none-available-title",
messageKey: "oolite-contracts-parcels-none-available-message",
allowInterrupt: true,
screenID: "oolite-contracts-parcels-none",
exitScreen: "GUI_SCREEN_INTERFACES"});
// no callback, just exits contracts system
return;
@ -457,6 +458,7 @@ this._parcelContractSummaryPage = function()
var missionConfig = {titleKey: "oolite-contracts-parcels-title-summary",
message: headline,
allowInterrupt: true,
screenID: "oolite-contracts-parcels-summary",
exitScreen: "GUI_SCREEN_INTERFACES",
choices: options,
initialChoicesKey: initialChoice};
@ -573,6 +575,7 @@ this._parcelContractSinglePage = function()
title: title,
message: message,
allowInterrupt: true,
screenID: "oolite-contracts-parcels-details",
exitScreen: "GUI_SCREEN_INTERFACES",
backgroundSpecial: backgroundSpecial,
choices: options,

View File

@ -366,6 +366,7 @@ this._passengerContractsDisplay = function(summary) {
mission.runScreen({titleKey: "oolite-contracts-passengers-none-available-title",
messageKey: "oolite-contracts-passengers-none-available-message",
allowInterrupt: true,
screenID: "oolite-contracts-passengers-none",
exitScreen: "GUI_SCREEN_INTERFACES"});
// no callback, just exits contracts system
return;
@ -495,6 +496,7 @@ this._passengerContractSummaryPage = function()
var missionConfig = {titleKey: "oolite-contracts-passengers-title-summary",
message: headline,
allowInterrupt: true,
screenID: "oolite-contracts-passengers-summary",
exitScreen: "GUI_SCREEN_INTERFACES",
choices: options,
initialChoicesKey: initialChoice};
@ -624,6 +626,7 @@ this._passengerContractSinglePage = function()
title: title,
message: message,
allowInterrupt: true,
screenID: "oolite-contracts-passengers-details",
exitScreen: "GUI_SCREEN_INTERFACES",
backgroundSpecial: backgroundSpecial,
choices: options,

View File

@ -285,6 +285,7 @@ typedef enum
NSDictionary *_missionBackgroundDescriptor;
OOGUIBackgroundSpecial _missionBackgroundSpecial;
NSDictionary *_equipScreenBackgroundDescriptor;
NSString *_missionScreenID;
BOOL found_equipment;
@ -836,6 +837,7 @@ typedef enum
- (OOGUIBackgroundSpecial) missionBackgroundSpecial;
- (void) setMissionBackgroundSpecial:(NSString *)special;
- (void) setMissionExitScreen:(OOGUIScreenID)screen;
- (OOGUIScreenID) missionExitScreen;
// Nasty hack to keep background textures around while on equip screens.
- (NSDictionary *) equipScreenBackgroundDescriptor;

View File

@ -9119,6 +9119,12 @@ static NSString *last_outfitting_key=nil;
}
- (OOGUIScreenID) missionExitScreen
{
return _missionExitScreen;
}
- (NSDictionary *) equipScreenBackgroundDescriptor
{
return _equipScreenBackgroundDescriptor;

View File

@ -3620,6 +3620,7 @@ static BOOL autopilot_pause;
{
if (gui_screen != GUI_SCREEN_MISSION) // did we call a new mission screen inside callback?
{
// note that this might not be the same end screen as last time...
[self setGuiToMissionEndScreen]; // if not, update status screen with callback changes, if any.
[self endMissionScreenAndNoteOpportunity]; // missionScreenEnded, plus opportunity events.
}

View File

@ -245,6 +245,9 @@ typedef enum
/*-----------------------------------------------------*/
- (void) clearMissionScreenID;
- (void) setMissionScreenID:(NSString *)msid;
- (NSString *) missionScreenID;
- (void) setGuiToMissionScreen;
- (void) setGuiToMissionScreenWithCallback:(BOOL) callback;
- (void) doMissionCallback;

View File

@ -2344,9 +2344,29 @@ static int scriptRandomSeed = -1; // ensure proper random function
}
- (void) clearMissionScreenID
{
[_missionScreenID release];
_missionScreenID = nil;
}
- (void) setMissionScreenID:(NSString *)msid
{
_missionScreenID = [msid retain];
}
- (NSString *) missionScreenID
{
return _missionScreenID;
}
- (void) endMissionScreenAndNoteOpportunity
{
_missionAllowInterrupt = NO;
[self clearMissionScreenID];
// Older scripts might intercept missionScreenEnded first, and call secondary mission screens.
if(![self doWorldEventUntilMissionScreen:OOJSID("missionScreenEnded")])
{

View File

@ -74,7 +74,7 @@ static NSString * const kCacheKeyCaches = @"caches";
enum
{
kEndianTagValue = 0x0123456789ABCDEFULL,
kFormatVersionValue = 207
kFormatVersionValue = 208
};

View File

@ -37,6 +37,7 @@ MA 02110-1301, USA.
static JSBool MissionGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value);
static JSBool MissionSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value);
static JSBool MissionMarkSystem(JSContext *context, uintN argc, jsval *vp);
static JSBool MissionUnmarkSystem(JSContext *context, uintN argc, jsval *vp);
@ -62,7 +63,7 @@ static JSClass sMissionClass =
JS_PropertyStub,
JS_PropertyStub,
MissionGetProperty,
JS_StrictPropertyStub,
MissionSetProperty,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
@ -73,6 +74,8 @@ static JSClass sMissionClass =
enum
{
kMission_markedSystems,
kMission_currentID,
kMission_exitScreen
};
@ -80,6 +83,8 @@ static JSPropertySpec sMissionProperties[] =
{
// JS name ID flags
{ "markedSystems", kMission_markedSystems, OOJS_PROP_READONLY_CB },
{ "screenID", kMission_screenID, OOJS_PROP_READONLY_CB },
{ "exitScreen", kMission_exitScreen, OOJS_PROP_READWRITE_CB },
{ 0 }
};
@ -187,6 +192,14 @@ static JSBool MissionGetProperty(JSContext *context, JSObject *this, jsid propID
result = [result allValues];
break;
case kMission_screenID:
result = [player missionScreenID];
break;
case kMission_exitScreen:
*value = OOJSValueFromGUIScreenID(context, [player missionExitScreen]);
return YES;
default:
OOJSReportBadPropertySelector(context, this, propID, sMissionProperties);
return NO;
@ -199,6 +212,34 @@ static JSBool MissionGetProperty(JSContext *context, JSObject *this, jsid propID
}
static JSBool MissionSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
{
if (!JSID_IS_INT(propID)) return YES;
OOJS_NATIVE_ENTER(context)
OOGUIScreenID exitScreen;
PlayerEntity *player = OOPlayerForScripting();
switch (JSID_TO_INT(propID))
{
case kMission_exitScreen:
exitScreen = OOGUIScreenIDFromJSValue(context, *value);
[player setMissionExitScreen:exitScreen];
return YES;
default:
OOJSReportBadPropertySelector(context, this, propID, sMissionProperties);
}
OOJSReportBadPropertyValue(context, this, propID, sMissionProperties, *value);
return NO;
OOJS_NATIVE_EXIT
}
// *** Methods ***
// markSystem(integer+)
@ -553,6 +594,15 @@ static JSBool MissionRunScreen(JSContext *context, uintN argc, jsval *vp)
[player setMissionExitScreen:GUI_SCREEN_STATUS];
}
if (JS_GetProperty(context, params, "screenID", &value) && !JSVAL_IS_VOID(value))
{
[player setMissionScreenID:OOStringFromJSValue(context, value)];
}
else
{
[player clearMissionScreenID];
}
// Start the mission screen.
sCallbackFunction = function;
[player setGuiToMissionScreenWithCallback:!JSVAL_IS_NULL(sCallbackFunction)];