Ahruman's dazzling distraction attack strikes again. All beep, boop and click sounds now go through customsounds.plist. Setting the player's target through JS now works more or less as expected (locks on ident, with UI feedback, unless a missile is selected in which case current missile is locked on to the new target). Custom sound tags can now expand to other custom sound tags (with recursion checking), and final results are cached. No actual progress on the nova script I thought I was working on.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1477 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
627e5a9b57
commit
f67b87aa0d
@ -1,4 +1,60 @@
|
|||||||
{
|
{
|
||||||
|
/* Sound keys starting with @ are (by convention) only used within
|
||||||
|
customsounds.plist, not directly by the game.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Interface sounds
|
||||||
|
"[@beep]" = "beep.ogg"; // positive beep
|
||||||
|
"[@boop]" = "boop.ogg"; // negative beep
|
||||||
|
"[@click]" = "guiclick.ogg";
|
||||||
|
|
||||||
|
"[@switch-on]" = "[@beep]";
|
||||||
|
"[@switch-off]" = "[@boop]";
|
||||||
|
"[ident-on]" = "[@switch-on]"; // Turned on ident
|
||||||
|
"[ident-off]" = "[@switch-off]"; // Turned off ident
|
||||||
|
"[ident-locked-on]" = "[@beep]"; // Ident targeted ship
|
||||||
|
"[missile-locked-on]" = "[@beep]";
|
||||||
|
"[missile-armed]" = "[@beep]";
|
||||||
|
"[mine-armed]" = "[@beep]";
|
||||||
|
"[missile-safe]" = "[@boop]";
|
||||||
|
"[next-missile-selected]" = "[@click]";
|
||||||
|
"[save-overwrite-yes]" = "[@beep]"; // Player selects Overwrite on "are you sure you want to overwrite?" alert on save screen
|
||||||
|
"[save-overwrite-no]" = "[@boop]"; // Player selects Cancel on "are you sure you want to overwrite?" alert on save screen
|
||||||
|
"[buy-commodity]" = "buy.ogg";
|
||||||
|
"[buy-ship]" = "[buy-commodity]";
|
||||||
|
"[sell-commodity]" = "sell.ogg";
|
||||||
|
"[could-not-buy-any]" = "[@boop]";
|
||||||
|
"[could-not-buy-ship]" = "[could-not-buy-any]";
|
||||||
|
"[cargo-jettisoned]" = "[@beep]";
|
||||||
|
"[autopilot-on]" = "[@switch-on]";
|
||||||
|
"[autopilot-off]" = "[@switch-off]";
|
||||||
|
"[autopilot-out-of-range]" = "[@switch-off]";
|
||||||
|
"[autopilot-cannot-dock-with-target]" = "[@boop]";
|
||||||
|
"[hold-full]" = "[@boop]";
|
||||||
|
"[target-lost]" = "[@boop]";
|
||||||
|
"[no-target-in-memory]" = "[@boop]";
|
||||||
|
"[jump-mass-locked]" = "[@boop]"; // Target memory expansion could not be used
|
||||||
|
"[target-switched]" = "[@click]"; // Target memory expansion used successfully
|
||||||
|
"[cloaking-device-on]" = "[@switch-on]";
|
||||||
|
"[cloaking-device-off]" = "[@switch-off]";
|
||||||
|
"[cloaking-device-insufficent-energy]" = "[@boop]";
|
||||||
|
"[menu-navigation-up]" = "[@click]";
|
||||||
|
"[menu-navigation-down]" = "[@click]";
|
||||||
|
// "[menu-navigation-not]" = ""; // Attempt to go past end of a menu; no sound by default
|
||||||
|
"[menu-next-page]" = "[@click]";
|
||||||
|
"[menu-previous-page]" = "[@click]";
|
||||||
|
"[dismissed-report-screen]" = "[@click]";
|
||||||
|
"[dismissed-mission-screen]" = "[@click]"; // No way to differentiate between mission options
|
||||||
|
"[changed-option]" = "[@click]"; // Player made a change on options screen
|
||||||
|
|
||||||
|
// Hyperspace
|
||||||
|
"[hyperspace-countdown-begun]" = "[@beep]";
|
||||||
|
"[galactic-hyperspace-countdown-begun]" = "[@beep]";
|
||||||
|
"[hyperspace-countdown-aborted]" = "[@boop]";
|
||||||
|
"[witch-no-target]" = "[@boop]";
|
||||||
|
"[witch-no-fuel]" = "[@boop]";
|
||||||
|
"[witch-blocked-by-@]" = "[@boop]";
|
||||||
|
|
||||||
// Damage
|
// Damage
|
||||||
"[player-hit-by-weapon]" = "hit.ogg"; // Hit by weapon
|
"[player-hit-by-weapon]" = "hit.ogg"; // Hit by weapon
|
||||||
"[player-direct-hit]" = "hullbang.ogg"; // Hit by weapon while shield down ([player-hit-by-weapon] and [player-direct-hit] play at once)
|
"[player-direct-hit]" = "hullbang.ogg"; // Hit by weapon while shield down ([player-hit-by-weapon] and [player-direct-hit] play at once)
|
||||||
@ -10,19 +66,21 @@
|
|||||||
"[energy-bomb-fired]" = "bigbang.ogg";
|
"[energy-bomb-fired]" = "bigbang.ogg";
|
||||||
|
|
||||||
// Warnings
|
// Warnings
|
||||||
"[hostile-warning]" = "warning.ogg";
|
"[@warning]" = "warning.ogg"; // Not used directly by game, only by references below.
|
||||||
"[alert-condition-red]" = "warning.ogg";
|
"[hostile-warning]" = "[@warning]";
|
||||||
"[incoming-missile]" = "warning.ogg"; // Help, help, they're shooting at us
|
"[alert-condition-red]" = "[@warning]";
|
||||||
|
"[incoming-missile]" = "[@warning]"; // Help, help, they're shooting at us
|
||||||
// "[energy-low]" = ""; // Energy below 25% - may occur repeatedly
|
// "[energy-low]" = ""; // Energy below 25% - may occur repeatedly
|
||||||
"[autopilot-denied]" = "warning.ogg"; // Station refuses docking clearance
|
"[autopilot-denied]" = "[@warning]"; // Station refuses docking clearance
|
||||||
"[witchdrive-malfunction]" = "ecm.ogg"; // Misjump (3/4 witchjump malfunctions)
|
"[witchdrive-malfunction]" = "ecm.ogg"; // Misjump (3/4 witchjump malfunctions)
|
||||||
"[witchdrive-failure]" = "warning.ogg"; // Jump failed, internal damage (1/8 witchjump malfunctions; other 1/8 is fuel leak, see [fuel-leak])
|
"[witchdrive-failure]" = "[@warning]"; // Jump failed, internal damage (1/8 witchjump malfunctions; other 1/8 is fuel leak, see [fuel-leak])
|
||||||
"[fuel-leak]" = "warning.ogg";
|
"[fuel-leak]" = "[@warning]";
|
||||||
|
|
||||||
// Tunnel effects
|
// Tunnel effects
|
||||||
"[player-launch-from-station]" = "breakpattern.ogg";
|
"[@breakpattern]" = "breakpattern.ogg"; // Not used directly by game, only by references below.
|
||||||
"[player-dock-with-station]" = "breakpattern.ogg";
|
"[player-launch-from-station]" = "[@breakpattern]";
|
||||||
"[player-exit-witchspace]" = "breakpattern.ogg";
|
"[player-dock-with-station]" = "[@breakpattern]";
|
||||||
|
"[player-exit-witchspace]" = "[@breakpattern]";
|
||||||
|
|
||||||
// ECM
|
// ECM
|
||||||
"[player-fired-ecm]" = "ecm.ogg";
|
"[player-fired-ecm]" = "ecm.ogg";
|
||||||
@ -37,28 +95,16 @@
|
|||||||
"[autopilot-off]" = "";
|
"[autopilot-off]" = "";
|
||||||
"[autopilot-on]" = "";
|
"[autopilot-on]" = "";
|
||||||
"[autopilot-out-of-range]" = "";
|
"[autopilot-out-of-range]" = "";
|
||||||
"[cargo-jettisoned]" = "";
|
|
||||||
"[cloaking-device-off]" = "";
|
"[cloaking-device-off]" = "";
|
||||||
"[cloaking-device-on]" = "";
|
"[cloaking-device-on]" = "";
|
||||||
"[escape-pod-scooped]" = "";
|
"[escape-pod-scooped]" = "";
|
||||||
"[galactic-hyperspace-countdown-begun]" = "";
|
|
||||||
"[game-over]" = "";
|
"[game-over]" = "";
|
||||||
"[hold-full]" = "";
|
|
||||||
"[hyperspace-countdown-aborted]" = "";
|
"[hyperspace-countdown-aborted]" = "";
|
||||||
"[hyperspace-countdown-begun]" = "";
|
"[hyperspace-countdown-begun]" = "";
|
||||||
"[ident-locked-on]" = "";
|
|
||||||
"[ident-off]" = "";
|
|
||||||
"[ident-on]" = "";
|
|
||||||
"[incoming-missile]" = "";
|
"[incoming-missile]" = "";
|
||||||
"[jump-mass-locked]" = "";
|
|
||||||
"[mine-armed]" = "";
|
|
||||||
"[mine-launched]" = "";
|
"[mine-launched]" = "";
|
||||||
"[missile-armed]" = "";
|
|
||||||
"[missile-launched]" = "";
|
"[missile-launched]" = "";
|
||||||
"[missile-locked-on]" = "";
|
|
||||||
"[missile-safe]" = "";
|
|
||||||
"[no-target-in-memory]" = "";
|
"[no-target-in-memory]" = "";
|
||||||
"[target-lost]" = "";
|
|
||||||
"[weapon-overheat]" = "";
|
"[weapon-overheat]" = "";
|
||||||
"[witch-blocked-by-@]" = "";
|
"[witch-blocked-by-@]" = "";
|
||||||
"[witch-no-fuel]" = "";
|
"[witch-no-fuel]" = "";
|
||||||
|
@ -550,14 +550,14 @@
|
|||||||
);
|
);
|
||||||
"station-hold-position" =
|
"station-hold-position" =
|
||||||
(
|
(
|
||||||
"Please be patient - you are being held in a docking queue.",
|
"Please be patient – you are being held in a docking queue.",
|
||||||
"Docking sequence will recommence shortly. Thank you for your patience.",
|
"Docking sequence will recommence shortly. Thank you for your patience.",
|
||||||
"Traffic is heavy, please continue to hold until we can clear an approach for you.",
|
"Traffic is heavy, please continue to hold until we can clear an approach for you.",
|
||||||
"You are being queued for docking. Thank you for your patience."
|
"You are being queued for docking. Thank you for your patience."
|
||||||
);
|
);
|
||||||
"station-acknowledges-hold-position" =
|
"station-acknowledges-hold-position" =
|
||||||
(
|
(
|
||||||
"Please be patient - we are preparing to accommodate your vessel.",
|
"Please be patient – we are preparing to accommodate your vessel.",
|
||||||
"Docking sequence will recommence shortly. Thank you for waiting.",
|
"Docking sequence will recommence shortly. Thank you for waiting.",
|
||||||
"We are preparing an approach for you. Please wait.",
|
"We are preparing an approach for you. Please wait.",
|
||||||
"Preparing approach for docking. Thank you for your patience.",
|
"Preparing approach for docking. Thank you for your patience.",
|
||||||
@ -746,7 +746,7 @@
|
|||||||
"press-space-commander" = "Press Space Commander";
|
"press-space-commander" = "Press Space Commander";
|
||||||
|
|
||||||
// Intro1 screen
|
// Intro1 screen
|
||||||
"game-copyright" = "by Giles Williams and contributors © 2003-2008";
|
"game-copyright" = "by Giles Williams and contributors © 2003–2008";
|
||||||
"theme-music-credit" = "Oolite Theme Music by NoSleep © 2004";
|
"theme-music-credit" = "Oolite Theme Music by NoSleep © 2004";
|
||||||
"load-previous-commander" = "Load Previous Commander (Y/N)?";
|
"load-previous-commander" = "Load Previous Commander (Y/N)?";
|
||||||
"load-previous-commander-yes" = "y"; // Defines the key that corresponds to the yes answer to load-previous-commnader.
|
"load-previous-commander-yes" = "y"; // Defines the key that corresponds to the yes answer to load-previous-commnader.
|
||||||
@ -940,9 +940,9 @@
|
|||||||
"savescreen-commander-name-@" = "Commander name: %@";
|
"savescreen-commander-name-@" = "Commander name: %@";
|
||||||
"savescreen-commander-name" = "Commander name: ";
|
"savescreen-commander-name" = "Commander name: ";
|
||||||
"overwrite-save-commander-@" = "Save Commander %@";
|
"overwrite-save-commander-@" = "Save Commander %@";
|
||||||
"overwritescreen-commander-@-already-exists-overwrite-query" = "Commander %@ already exists - overwrite this saved game?";
|
"overwritescreen-commander-@-already-exists-overwrite-query" = "A file named %@ already exists. Do you wish to overwrite it?";
|
||||||
"overwritescreen-yes" = " YES ";
|
"overwritescreen-yes" = " Overwrite ";
|
||||||
"overwritescreen-no" = " NO ";
|
"overwritescreen-no" = " Cancel ";
|
||||||
|
|
||||||
// Mission screen
|
// Mission screen
|
||||||
"mission-information" = "Mission Information";
|
"mission-information" = "Mission Information";
|
||||||
@ -957,7 +957,7 @@
|
|||||||
"adjusting-word" = " (adjusting)";
|
"adjusting-word" = " (adjusting)";
|
||||||
"strict-play-enabled" = "Strict Play Enabled";
|
"strict-play-enabled" = "Strict Play Enabled";
|
||||||
"unrestricted-play-enabled" = "Unrestricted Play Enabled";
|
"unrestricted-play-enabled" = "Unrestricted Play Enabled";
|
||||||
"human-word" = "human"; // Important - only lower case characters here!
|
"human-word" = "human"; // Important – only lower case characters here!
|
||||||
"human-colonial-description" = "Human Colonial";
|
"human-colonial-description" = "Human Colonial";
|
||||||
"human-colonial-description-plural" = "Human Colonials";
|
"human-colonial-description-plural" = "Human Colonials";
|
||||||
"clock-format" = "%07d:%02d:%02d:%02d";
|
"clock-format" = "%07d:%02d:%02d:%02d";
|
||||||
|
@ -295,6 +295,9 @@
|
|||||||
sky.setup = no;
|
sky.setup = no;
|
||||||
|
|
||||||
|
|
||||||
|
sounds.customSounds.recursion = $error; // Circular dependency in customsounds.plist, e.g. [foo] = [bar], [bar] = [foo].
|
||||||
|
|
||||||
|
|
||||||
strings.conversion = $scriptError; // Conversion of text to values (vectors, quaternions etc)
|
strings.conversion = $scriptError; // Conversion of text to values (vectors, quaternions etc)
|
||||||
strings.conversion.vector = inherit;
|
strings.conversion.vector = inherit;
|
||||||
strings.conversion.quaternion = inherit;
|
strings.conversion.quaternion = inherit;
|
||||||
|
@ -45,6 +45,7 @@ this.missionOffers = function ()
|
|||||||
if (missionVariables.nova == "TWO_HRS_TO_ZERO")
|
if (missionVariables.nova == "TWO_HRS_TO_ZERO")
|
||||||
{
|
{
|
||||||
mission.runMissionScreen("nova_1", "solar.png", "nova_yesno");
|
mission.runMissionScreen("nova_1", "solar.png", "nova_yesno");
|
||||||
|
log("nova.missionOffers", "Setting this.novaOffer to \"NOVA_CHOICE\"");
|
||||||
this.novaOffer = "NOVA_CHOICE"; // use a temporary variable for the offering.
|
this.novaOffer = "NOVA_CHOICE"; // use a temporary variable for the offering.
|
||||||
this.novaMissionTimer.stop();
|
this.novaMissionTimer.stop();
|
||||||
}
|
}
|
||||||
@ -76,14 +77,19 @@ this.missionOffers = function ()
|
|||||||
|
|
||||||
this.choiceEvaluation = function()
|
this.choiceEvaluation = function()
|
||||||
{
|
{
|
||||||
if (!this.novaOffer) return;
|
if (!this.novaOffer)
|
||||||
|
{
|
||||||
|
log("nova.choicesEvaluation", "Exiting early because !this.novaOffer.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.novaOffer == "NOVA_CHOICE")
|
if (this.novaOffer == "NOVA_CHOICE")
|
||||||
{
|
{
|
||||||
|
log("nova.choicesEvaluation", "Evaluating this.novaOffer == \"NOVA_CHOICE\"");
|
||||||
if (mission.choice == "YES")
|
if (mission.choice == "YES")
|
||||||
{
|
{
|
||||||
|
log("nova.choicesEvaluation", "mission.choice == YES, player loaded refugees.");
|
||||||
mission.choice = null;
|
mission.choice = null;
|
||||||
this.novaOffer = null;
|
|
||||||
player.useSpecialCargo(expandDescription("[oolite-nova-refugees]"));
|
player.useSpecialCargo(expandDescription("[oolite-nova-refugees]"));
|
||||||
mission.setInstructionsKey("nova_missiondesc");
|
mission.setInstructionsKey("nova_missiondesc");
|
||||||
missionVariables.nova = "NOVA_ESCAPE_HERO";
|
missionVariables.nova = "NOVA_ESCAPE_HERO";
|
||||||
@ -94,17 +100,21 @@ this.choiceEvaluation = function()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
log("nova.choicesEvaluation", "mission.choice == " + mission.choice + ", player refused to help.");
|
||||||
// mission.choice = "NO", or null when player launched without a choice.
|
// mission.choice = "NO", or null when player launched without a choice.
|
||||||
mission.choice = null;
|
mission.choice = null;
|
||||||
this.novaOffer = null;
|
|
||||||
missionVariables.nova = "NOVA_ESCAPE_COWARD";
|
missionVariables.nova = "NOVA_ESCAPE_COWARD";
|
||||||
player.commsMessage(expandDescription("[oolite-nova-coward]"), 4.5);
|
player.commsMessage(expandDescription("[oolite-nova-coward]"), 4.5);
|
||||||
system.setSunNova(3);
|
system.setSunNova(3);
|
||||||
missionVariables.novacount = null;
|
missionVariables.novacount = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete this.novaOffer;
|
||||||
|
log("nova.choicesEvaluation", "deleted this.novaOffer, this.novaOffer is now " + this.novaOffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// general, used when player enters nova system after mission.
|
// general, used when player enters nova system after mission.
|
||||||
this.sendShipsAway = function()
|
this.sendShipsAway = function()
|
||||||
{
|
{
|
||||||
@ -157,6 +167,7 @@ this.missionScreenEnded = this.missionChoiceWasReset = function ()
|
|||||||
if (player.docked) this.missionOffers();
|
if (player.docked) this.missionOffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.shipWillExitWitchspace = function () // call this as soon as possible so other scripts can see it will go nova.
|
this.shipWillExitWitchspace = function () // call this as soon as possible so other scripts can see it will go nova.
|
||||||
{
|
{
|
||||||
if (galaxyNumber == 3)
|
if (galaxyNumber == 3)
|
||||||
|
@ -36,6 +36,15 @@ SOFTWARE.
|
|||||||
#import "OOJavaScriptEngine.h"
|
#import "OOJavaScriptEngine.h"
|
||||||
#import "OOJSScript.h"
|
#import "OOJSScript.h"
|
||||||
#import "OOJSVector.h"
|
#import "OOJSVector.h"
|
||||||
|
#import "OOJSEntity.h"
|
||||||
|
|
||||||
|
|
||||||
|
@interface Entity (OODebugInspector)
|
||||||
|
|
||||||
|
// Method added by inspector in Debug OXP under OS X only.
|
||||||
|
- (void) inspect;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
static JSObject *sConsolePrototype = NULL;
|
static JSObject *sConsolePrototype = NULL;
|
||||||
@ -48,6 +57,7 @@ static void ConsoleFinalize(JSContext *context, JSObject *this);
|
|||||||
static JSBool ConsoleConsoleMessage(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
static JSBool ConsoleConsoleMessage(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||||
static JSBool ConsoleClearConsole(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
static JSBool ConsoleClearConsole(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||||
static JSBool ConsoleScriptStack(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
static JSBool ConsoleScriptStack(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||||
|
static JSBool ConsoleInspectEntity(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult);
|
||||||
|
|
||||||
static JSBool ConsoleSettingsDeleteProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue);
|
static JSBool ConsoleSettingsDeleteProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue);
|
||||||
static JSBool ConsoleSettingsGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue);
|
static JSBool ConsoleSettingsGetProperty(JSContext *context, JSObject *this, jsval name, jsval *outValue);
|
||||||
@ -77,6 +87,7 @@ static JSFunctionSpec sConsoleMethods[] =
|
|||||||
{ "consoleMessage", ConsoleConsoleMessage, 2 },
|
{ "consoleMessage", ConsoleConsoleMessage, 2 },
|
||||||
{ "clearConsole", ConsoleClearConsole, 0 },
|
{ "clearConsole", ConsoleClearConsole, 0 },
|
||||||
{ "scriptStack", ConsoleScriptStack, 0 },
|
{ "scriptStack", ConsoleScriptStack, 0 },
|
||||||
|
{ "inspectEntity", ConsoleInspectEntity, 1 },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -320,4 +331,20 @@ static JSBool ConsoleScriptStack(JSContext *context, JSObject *this, uintN argc,
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static JSBool ConsoleInspectEntity(JSContext *context, JSObject *this, uintN argc, jsval *argv, jsval *outResult)
|
||||||
|
{
|
||||||
|
Entity *entity = nil;
|
||||||
|
|
||||||
|
if (JSValueToEntity(context, argv[0], &entity))
|
||||||
|
{
|
||||||
|
if ([entity respondsToSelector:@selector(inspect)])
|
||||||
|
{
|
||||||
|
[entity inspect];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OO_EXCLUDE_DEBUG_SUPPORT */
|
#endif /* OO_EXCLUDE_DEBUG_SUPPORT */
|
||||||
|
@ -278,20 +278,13 @@ typedef enum
|
|||||||
|
|
||||||
double ecm_start_time;
|
double ecm_start_time;
|
||||||
|
|
||||||
OOSound *beepSound;
|
|
||||||
OOSound *boopSound;
|
|
||||||
OOSound *missileSound;
|
OOSound *missileSound;
|
||||||
OOSound *buySound;
|
|
||||||
OOSound *sellSound;
|
|
||||||
OOSound *afterburner1Sound;
|
OOSound *afterburner1Sound;
|
||||||
OOSound *afterburner2Sound;
|
OOSound *afterburner2Sound;
|
||||||
OOSound *witchAbortSound;
|
OOSound *witchAbortSound;
|
||||||
OOSound *fuelScoopSound;
|
OOSound *fuelScoopSound;
|
||||||
|
|
||||||
OOSoundReferencePoint *refPoint;
|
OOSoundReferencePoint *refPoint;
|
||||||
OOSoundSource *interfaceBeepSource;
|
|
||||||
OOSoundSource *ecmSource;
|
|
||||||
OOSoundSource *breakPatternSource;
|
|
||||||
|
|
||||||
OOGUIScreenID gui_screen;
|
OOGUIScreenID gui_screen;
|
||||||
OOAlertFlags alertFlags;
|
OOAlertFlags alertFlags;
|
||||||
@ -654,8 +647,7 @@ waitingForStickCallback: 1;
|
|||||||
- (void) setScoopsActive;
|
- (void) setScoopsActive;
|
||||||
|
|
||||||
- (void) clearTargetMemory;
|
- (void) clearTargetMemory;
|
||||||
- (BOOL) selectNextTargetFromMemory;
|
- (BOOL) moveTargetMemoryBy:(int)delta;
|
||||||
- (BOOL) selectPreviousTargetFromMemory;
|
|
||||||
|
|
||||||
- (void) printIdentLockedOnForMissile:(BOOL)missile;
|
- (void) printIdentLockedOnForMissile:(BOOL)missile;
|
||||||
|
|
||||||
|
@ -1587,8 +1587,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
if (!suppressTargetLost)
|
if (!suppressTargetLost)
|
||||||
{
|
{
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[target-lost]") forCount:3.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[target-lost]") forCount:3.0];
|
||||||
if (![UNIVERSE playCustomSound:@"[target-lost]"])
|
[self playTargetLost];
|
||||||
[self boop];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1615,8 +1614,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
if ((!target_ship)||(target_ship->zero_distance > SCANNER_MAX_RANGE2))
|
if ((!target_ship)||(target_ship->zero_distance > SCANNER_MAX_RANGE2))
|
||||||
{
|
{
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[target-lost]") forCount:3.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[target-lost]") forCount:3.0];
|
||||||
if (![UNIVERSE playCustomSound:@"[target-lost]"])
|
[self playTargetLost];
|
||||||
[self boop];
|
|
||||||
[missile_entity[i] removeTarget:nil];
|
[missile_entity[i] removeTarget:nil];
|
||||||
if ((i == activeMissile)&&(!ident_engaged))
|
if ((i == activeMissile)&&(!ident_engaged))
|
||||||
{
|
{
|
||||||
@ -1627,31 +1625,12 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((missile_status == MISSILE_STATUS_ARMED)&&(ident_engaged||[missile_entity[activeMissile] isMissile])&&((status == STATUS_IN_FLIGHT)||(status == STATUS_WITCHSPACE_COUNTDOWN)))
|
if (missile_status == MISSILE_STATUS_ARMED &&
|
||||||
|
(ident_engaged || [missile_entity[activeMissile] isMissile]) &&
|
||||||
|
(status == STATUS_IN_FLIGHT || status == STATUS_WITCHSPACE_COUNTDOWN))
|
||||||
{
|
{
|
||||||
int first_target_id = [UNIVERSE getFirstEntityTargettedByPlayer:self];
|
ShipEntity *target = [UNIVERSE getFirstEntityTargettedByPlayer];
|
||||||
if (first_target_id != NO_TARGET)
|
if (target != nil) [self addTarget:target];
|
||||||
{
|
|
||||||
Entity *first_target = [UNIVERSE entityForUniversalID:first_target_id];
|
|
||||||
if ([first_target isShip])
|
|
||||||
{
|
|
||||||
[self addTarget: first_target];
|
|
||||||
missile_status = MISSILE_STATUS_TARGET_LOCKED;
|
|
||||||
if ((missile_entity[activeMissile])&&(!ident_engaged))
|
|
||||||
[missile_entity[activeMissile] addTarget:first_target];
|
|
||||||
[self printIdentLockedOnForMissile:!ident_engaged];
|
|
||||||
if (ident_engaged)
|
|
||||||
{
|
|
||||||
if (![UNIVERSE playCustomSound:@"[ident-locked-on]"])
|
|
||||||
[self beep];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (![UNIVERSE playCustomSound:@"[missile-locked-on]"])
|
|
||||||
[self beep];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1669,38 +1648,19 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
air_friction = 0.5 * [UNIVERSE airResistanceFactor];
|
air_friction = 0.5 * [UNIVERSE airResistanceFactor];
|
||||||
|
|
||||||
// cool all weapons
|
// cool all weapons
|
||||||
if (forward_weapon_temp > 0.0)
|
forward_weapon_temp = fmaxf(forward_weapon_temp - WEAPON_COOLING_FACTOR * delta_t, 0.0);
|
||||||
{
|
aft_weapon_temp = fmaxf(aft_weapon_temp - WEAPON_COOLING_FACTOR * delta_t, 0.0);
|
||||||
forward_weapon_temp -= WEAPON_COOLING_FACTOR * delta_t;
|
port_weapon_temp = fmaxf(port_weapon_temp - WEAPON_COOLING_FACTOR * delta_t, 0.0);
|
||||||
if (forward_weapon_temp < 0.0)
|
starboard_weapon_temp = fmaxf(starboard_weapon_temp - WEAPON_COOLING_FACTOR * delta_t, 0.0);
|
||||||
forward_weapon_temp = 0.0;
|
|
||||||
}
|
|
||||||
if (aft_weapon_temp > 0.0)
|
|
||||||
{
|
|
||||||
aft_weapon_temp -= WEAPON_COOLING_FACTOR * delta_t;
|
|
||||||
if (aft_weapon_temp < 0.0)
|
|
||||||
aft_weapon_temp = 0.0;
|
|
||||||
}
|
|
||||||
if (port_weapon_temp > 0.0)
|
|
||||||
{
|
|
||||||
port_weapon_temp -= WEAPON_COOLING_FACTOR * delta_t;
|
|
||||||
if (port_weapon_temp < 0.0)
|
|
||||||
port_weapon_temp = 0.0;
|
|
||||||
}
|
|
||||||
if (starboard_weapon_temp > 0.0)
|
|
||||||
{
|
|
||||||
starboard_weapon_temp -= WEAPON_COOLING_FACTOR * delta_t;
|
|
||||||
if (starboard_weapon_temp < 0.0)
|
|
||||||
starboard_weapon_temp = 0.0;
|
|
||||||
}
|
|
||||||
// copy new temp to main temp
|
|
||||||
|
|
||||||
|
// copy new temp to main temp
|
||||||
switch (currentWeaponFacing)
|
switch (currentWeaponFacing)
|
||||||
{
|
{
|
||||||
case VIEW_GUI_DISPLAY:
|
case VIEW_GUI_DISPLAY:
|
||||||
case VIEW_NONE:
|
case VIEW_NONE:
|
||||||
case VIEW_BREAK_PATTERN:
|
case VIEW_BREAK_PATTERN:
|
||||||
case VIEW_FORWARD:
|
case VIEW_FORWARD:
|
||||||
|
case VIEW_CUSTOM:
|
||||||
weapon_temp = forward_weapon_temp;
|
weapon_temp = forward_weapon_temp;
|
||||||
break;
|
break;
|
||||||
case VIEW_AFT:
|
case VIEW_AFT:
|
||||||
@ -1712,8 +1672,6 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
case VIEW_STARBOARD:
|
case VIEW_STARBOARD:
|
||||||
weapon_temp = starboard_weapon_temp;
|
weapon_temp = starboard_weapon_temp;
|
||||||
break;
|
break;
|
||||||
case VIEW_CUSTOM:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// cloaking device
|
// cloaking device
|
||||||
@ -1877,8 +1835,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
|
|
||||||
if (hyperspeed_locked)
|
if (hyperspeed_locked)
|
||||||
{
|
{
|
||||||
if (![UNIVERSE playCustomSound:@"[jump-mass-locked]"])
|
[self playJumpMassLocked];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[jump-mass-locked]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[jump-mass-locked]") forCount:4.5];
|
||||||
hyperspeed_engaged = NO;
|
hyperspeed_engaged = NO;
|
||||||
}
|
}
|
||||||
@ -2640,8 +2597,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
{
|
{
|
||||||
if ([ms isEqual:@"HOLD_FULL"])
|
if ([ms isEqual:@"HOLD_FULL"])
|
||||||
{
|
{
|
||||||
if (![UNIVERSE playCustomSound:@"[hold-full]"])
|
[self playHoldFull];
|
||||||
[self beep];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[hold-full]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[hold-full]") forCount:4.5];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3267,6 +3223,7 @@ double scoopSoundPlayTime = 0.0;
|
|||||||
if (result != CARGO_NOT_CARGO)
|
if (result != CARGO_NOT_CARGO)
|
||||||
{
|
{
|
||||||
[UNIVERSE addMessage:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[@-ejected]") ,[UNIVERSE displayNameForCommodity:result]] forCount:3.0];
|
[UNIVERSE addMessage:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[@-ejected]") ,[UNIVERSE displayNameForCommodity:result]] forCount:3.0];
|
||||||
|
[self playCargoJettisioned];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -5118,6 +5075,8 @@ static int last_outfitting_index;
|
|||||||
|
|
||||||
int item = [key intValue];
|
int item = [key intValue];
|
||||||
NSString *item_text = [gui selectedRowText];
|
NSString *item_text = [gui selectedRowText];
|
||||||
|
|
||||||
|
// FIXME: this is nuts, should be associating lines with keys in sone sensible way. --Ahruman 20080311
|
||||||
if ([item_text isEqual:FORWARD_FACING_STRING])
|
if ([item_text isEqual:FORWARD_FACING_STRING])
|
||||||
chosen_weapon_facing = WEAPON_FACING_FORWARD;
|
chosen_weapon_facing = WEAPON_FACING_FORWARD;
|
||||||
if ([item_text isEqual:AFT_FACING_STRING])
|
if ([item_text isEqual:AFT_FACING_STRING])
|
||||||
@ -5132,14 +5091,13 @@ static int last_outfitting_index;
|
|||||||
{
|
{
|
||||||
if (credits == old_credits)
|
if (credits == old_credits)
|
||||||
{
|
{
|
||||||
[[UNIVERSE gui] click];
|
[self playCantBuyBuyCommodity];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self playInterfaceBeep:kInterfaceBeep_Buy];
|
[self playBuyCommodity];
|
||||||
|
|
||||||
// wind the clock forward by 10 minutes plus 10 minutes for every 60 credits spent
|
// wind the clock forward by 10 minutes plus 10 minutes for every 60 credits spent
|
||||||
|
|
||||||
double time_adjust = (old_credits > credits) ? (old_credits - credits) : 0.0;
|
double time_adjust = (old_credits > credits) ? (old_credits - credits) : 0.0;
|
||||||
ship_clock_adjust += time_adjust + 600.0;
|
ship_clock_adjust += time_adjust + 600.0;
|
||||||
}
|
}
|
||||||
@ -5147,7 +5105,7 @@ static int last_outfitting_index;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self boop];
|
[self playCantBuyBuyCommodity];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6198,17 +6156,28 @@ OOSound* burnersound;
|
|||||||
// override shipentity addTarget to implement target_memory
|
// override shipentity addTarget to implement target_memory
|
||||||
- (void) addTarget:(Entity *) targetEntity
|
- (void) addTarget:(Entity *) targetEntity
|
||||||
{
|
{
|
||||||
|
if (status != STATUS_IN_FLIGHT && status != STATUS_WITCHSPACE_COUNTDOWN) return;
|
||||||
|
|
||||||
|
if (missile_status == MISSILE_STATUS_SAFE)
|
||||||
|
{
|
||||||
|
missile_status = MISSILE_STATUS_ARMED;
|
||||||
|
ident_engaged = YES;
|
||||||
|
}
|
||||||
[super addTarget:targetEntity];
|
[super addTarget:targetEntity];
|
||||||
|
missile_status = MISSILE_STATUS_TARGET_LOCKED;
|
||||||
|
|
||||||
if ([self hasExtraEquipment:@"EQ_TARGET_MEMORY"])
|
if ([self hasExtraEquipment:@"EQ_TARGET_MEMORY"])
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
BOOL foundSlot = NO;
|
||||||
// if targetted previously use that memory space
|
// if targetted previously use that memory space
|
||||||
for (i = 0; i < PLAYER_TARGET_MEMORY_SIZE; i++)
|
for (i = 0; i < PLAYER_TARGET_MEMORY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (primaryTarget == target_memory[i])
|
if (primaryTarget == target_memory[i])
|
||||||
{
|
{
|
||||||
target_memory_index = i;
|
target_memory_index = i;
|
||||||
return;
|
foundSlot = YES;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// find and use a blank space in memory
|
// find and use a blank space in memory
|
||||||
@ -6217,14 +6186,31 @@ OOSound* burnersound;
|
|||||||
if (target_memory[target_memory_index] == NO_TARGET)
|
if (target_memory[target_memory_index] == NO_TARGET)
|
||||||
{
|
{
|
||||||
target_memory[target_memory_index] = primaryTarget;
|
target_memory[target_memory_index] = primaryTarget;
|
||||||
return;
|
foundSlot = YES;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
target_memory_index = (target_memory_index + 1) % PLAYER_TARGET_MEMORY_SIZE;
|
target_memory_index = (target_memory_index + 1) % PLAYER_TARGET_MEMORY_SIZE;
|
||||||
}
|
}
|
||||||
|
if (!foundSlot)
|
||||||
|
{
|
||||||
// use the next memory space
|
// use the next memory space
|
||||||
target_memory_index = (target_memory_index + 1) % PLAYER_TARGET_MEMORY_SIZE;
|
target_memory_index = (target_memory_index + 1) % PLAYER_TARGET_MEMORY_SIZE;
|
||||||
target_memory[target_memory_index] = primaryTarget;
|
target_memory[target_memory_index] = primaryTarget;
|
||||||
return;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (missile_entity[activeMissile] == nil && ident_engaged) ident_engaged = YES;
|
||||||
|
|
||||||
|
if (ident_engaged)
|
||||||
|
{
|
||||||
|
[self playIdentLockedOn];
|
||||||
|
[self printIdentLockedOnForMissile:NO];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[missile_entity[activeMissile] addTarget:targetEntity];
|
||||||
|
[self playMissileLockedOn];
|
||||||
|
[self printIdentLockedOnForMissile:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6257,28 +6243,19 @@ OOSound* burnersound;
|
|||||||
[super addTarget:potential_target];
|
[super addTarget:potential_target];
|
||||||
missile_status = MISSILE_STATUS_TARGET_LOCKED;
|
missile_status = MISSILE_STATUS_TARGET_LOCKED;
|
||||||
[self printIdentLockedOnForMissile:!ident_engaged];
|
[self printIdentLockedOnForMissile:!ident_engaged];
|
||||||
|
[self playTargetSwitched];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
target_memory[target_memory_index] = NO_TARGET; // tidy up
|
target_memory[target_memory_index] = NO_TARGET; // tidy up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self playNoTargetInMemory];
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (BOOL) selectNextTargetFromMemory
|
|
||||||
{
|
|
||||||
return [self moveTargetMemoryBy:+1];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (BOOL) selectPreviousTargetFromMemory
|
|
||||||
{
|
|
||||||
return [self moveTargetMemoryBy:-1];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) printIdentLockedOnForMissile:(BOOL)missile
|
- (void) printIdentLockedOnForMissile:(BOOL)missile
|
||||||
{
|
{
|
||||||
NSString *fmt = nil;
|
NSString *fmt = nil;
|
||||||
|
@ -305,9 +305,13 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ([gui setNextRow: +1])
|
if ([gui setNextRow: +1])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuNavigationDown];
|
||||||
result = YES;
|
result = YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self playMenuNavigationNot];
|
||||||
|
}
|
||||||
timeLastKeyPress = script_time;
|
timeLastKeyPress = script_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,9 +322,13 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ([gui setNextRow: -1])
|
if ([gui setNextRow: -1])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuNavigationUp];
|
||||||
result = YES;
|
result = YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self playMenuNavigationNot];
|
||||||
|
}
|
||||||
timeLastKeyPress = script_time;
|
timeLastKeyPress = script_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -570,8 +578,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
hyperspeed_engaged = !hyperspeed_locked;
|
hyperspeed_engaged = !hyperspeed_locked;
|
||||||
if (hyperspeed_locked)
|
if (hyperspeed_locked)
|
||||||
{
|
{
|
||||||
if (![UNIVERSE playCustomSound:@"[jump-mass-locked]"])
|
[self playJumpMassLocked];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[jump-mass-locked]") forCount:1.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[jump-mass-locked]") forCount:1.5];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,7 +626,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ((!ident_engaged)&&(!next_missile_pressed)&&([self hasExtraEquipment:@"EQ_MULTI_TARGET"]))
|
if ((!ident_engaged)&&(!next_missile_pressed)&&([self hasExtraEquipment:@"EQ_MULTI_TARGET"]))
|
||||||
{
|
{
|
||||||
[[UNIVERSE gui] click];
|
[self playNextMissileSelected];
|
||||||
[self selectNextMissile];
|
[self selectNextMissile];
|
||||||
}
|
}
|
||||||
next_missile_pressed = YES;
|
next_missile_pressed = YES;
|
||||||
@ -632,13 +639,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ((!next_target_pressed)&&([self hasExtraEquipment:@"EQ_TARGET_MEMORY"]))
|
if ((!next_target_pressed)&&([self hasExtraEquipment:@"EQ_TARGET_MEMORY"]))
|
||||||
{
|
{
|
||||||
if ([self selectNextTargetFromMemory])
|
[self moveTargetMemoryBy:+1];
|
||||||
[[UNIVERSE gui] click];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (![UNIVERSE playCustomSound:@"[no-target-in-memory]"])
|
|
||||||
[self boop];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
next_target_pressed = YES;
|
next_target_pressed = YES;
|
||||||
}
|
}
|
||||||
@ -650,13 +651,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ((!previous_target_pressed)&&([self hasExtraEquipment:@"EQ_TARGET_MEMORY"]))
|
if ((!previous_target_pressed)&&([self hasExtraEquipment:@"EQ_TARGET_MEMORY"]))
|
||||||
{
|
{
|
||||||
if ([self selectPreviousTargetFromMemory])
|
[self moveTargetMemoryBy:-1];
|
||||||
[[UNIVERSE gui] click];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (![UNIVERSE playCustomSound:@"[no-target-in-memory]"])
|
|
||||||
[self boop];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
previous_target_pressed = YES;
|
previous_target_pressed = YES;
|
||||||
}
|
}
|
||||||
@ -672,8 +667,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
missile_status = MISSILE_STATUS_ARMED;
|
missile_status = MISSILE_STATUS_ARMED;
|
||||||
primaryTarget = NO_TARGET;
|
primaryTarget = NO_TARGET;
|
||||||
ident_engaged = YES;
|
ident_engaged = YES;
|
||||||
if (![UNIVERSE playCustomSound:@"[ident-on]"])
|
[self playIdentOn];
|
||||||
[self beep];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[ident-on]") forCount:2.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[ident-on]") forCount:2.0];
|
||||||
}
|
}
|
||||||
ident_pressed = YES;
|
ident_pressed = YES;
|
||||||
@ -695,8 +689,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
missile_status = MISSILE_STATUS_TARGET_LOCKED;
|
missile_status = MISSILE_STATUS_TARGET_LOCKED;
|
||||||
[missile_entity[activeMissile] addTarget:[self primaryTarget]];
|
[missile_entity[activeMissile] addTarget:[self primaryTarget]];
|
||||||
[self printIdentLockedOnForMissile:YES];
|
[self printIdentLockedOnForMissile:YES];
|
||||||
if (![UNIVERSE playCustomSound:@"[missile-locked-on]"])
|
[self playMissileLockedOn];
|
||||||
[self beep];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -707,15 +700,13 @@ static NSTimeInterval time_last_frame;
|
|||||||
if (missile_entity[activeMissile])
|
if (missile_entity[activeMissile])
|
||||||
[missile_entity[activeMissile] removeTarget:nil];
|
[missile_entity[activeMissile] removeTarget:nil];
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[missile-armed]") forCount:2.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[missile-armed]") forCount:2.0];
|
||||||
if (![UNIVERSE playCustomSound:@"[missile-armed]"])
|
[self playMissileArmed];
|
||||||
[self beep];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ([missile_entity[activeMissile] isMine])
|
if ([missile_entity[activeMissile] isMine])
|
||||||
{
|
{
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[mine-armed]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[mine-armed]") forCount:4.5];
|
||||||
if (![UNIVERSE playCustomSound:@"[mine-armed]"])
|
[self playMineArmed];
|
||||||
[self beep];
|
|
||||||
}
|
}
|
||||||
ident_engaged = NO;
|
ident_engaged = NO;
|
||||||
}
|
}
|
||||||
@ -735,8 +726,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
missile_status = MISSILE_STATUS_SAFE;
|
missile_status = MISSILE_STATUS_SAFE;
|
||||||
primaryTarget = NO_TARGET;
|
primaryTarget = NO_TARGET;
|
||||||
[self safeAllMissiles];
|
[self safeAllMissiles];
|
||||||
if (![UNIVERSE playCustomSound:@"[missile-safe]"])
|
[self playMissileSafe];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[missile-safe]") forCount:2.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[missile-safe]") forCount:2.0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -744,8 +734,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
// targetting 'back on' here
|
// targetting 'back on' here
|
||||||
primaryTarget = [missile_entity[activeMissile] primaryTargetID];
|
primaryTarget = [missile_entity[activeMissile] primaryTargetID];
|
||||||
missile_status = (primaryTarget != NO_TARGET)? MISSILE_STATUS_TARGET_LOCKED : MISSILE_STATUS_SAFE;
|
missile_status = (primaryTarget != NO_TARGET)? MISSILE_STATUS_TARGET_LOCKED : MISSILE_STATUS_SAFE;
|
||||||
if (![UNIVERSE playCustomSound:@"[ident-off]"])
|
[self playIdentOff];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[ident-off]") forCount:2.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[ident-off]") forCount:2.0];
|
||||||
}
|
}
|
||||||
ident_engaged = NO;
|
ident_engaged = NO;
|
||||||
@ -786,11 +775,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
// shoot 'd' // Dump Cargo
|
// shoot 'd' // Dump Cargo
|
||||||
if (([gameView isDown:key_dump_cargo] || joyButtonState[BUTTON_JETTISON])&&([cargo count] > 0))
|
if (([gameView isDown:key_dump_cargo] || joyButtonState[BUTTON_JETTISON])&&([cargo count] > 0))
|
||||||
{
|
{
|
||||||
if ([self dumpCargo] != CARGO_NOT_CARGO)
|
[self dumpCargo];
|
||||||
{
|
|
||||||
if (![UNIVERSE playCustomSound:@"[cargo-jettisoned]"])
|
|
||||||
[self beep];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shoot 'R' // Rotate Cargo
|
// shoot 'R' // Rotate Cargo
|
||||||
@ -816,8 +801,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
if ([self checkForAegis] != AEGIS_IN_DOCKING_RANGE)
|
if ([self checkForAegis] != AEGIS_IN_DOCKING_RANGE)
|
||||||
{
|
{
|
||||||
isOkayToUseAutopilot = NO;
|
isOkayToUseAutopilot = NO;
|
||||||
if (![UNIVERSE playCustomSound:@"[autopilot-out-of-range]"])
|
[self playAutopilotOutOfRange];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-out-of-range]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-out-of-range]") forCount:4.5];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -832,8 +816,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
velocity = kZeroVector;
|
velocity = kZeroVector;
|
||||||
status = STATUS_AUTOPILOT_ENGAGED;
|
status = STATUS_AUTOPILOT_ENGAGED;
|
||||||
[shipAI setState:@"GLOBAL"]; // reboot the AI
|
[shipAI setState:@"GLOBAL"]; // reboot the AI
|
||||||
if (![UNIVERSE playCustomSound:@"[autopilot-on]"])
|
[self playAutopilotOn];
|
||||||
[self beep];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-on]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-on]") forCount:4.5];
|
||||||
[self doScriptEvent:@"playerStartedAutoPilot"];
|
[self doScriptEvent:@"playerStartedAutoPilot"];
|
||||||
|
|
||||||
@ -868,8 +851,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
velocity = kZeroVector;
|
velocity = kZeroVector;
|
||||||
status = STATUS_AUTOPILOT_ENGAGED;
|
status = STATUS_AUTOPILOT_ENGAGED;
|
||||||
[shipAI setState:@"GLOBAL"]; // restart the AI
|
[shipAI setState:@"GLOBAL"]; // restart the AI
|
||||||
if (![UNIVERSE playCustomSound:@"[autopilot-on]"])
|
[self playAutopilotOn];
|
||||||
[self beep];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-on]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-on]") forCount:4.5];
|
||||||
[self doScriptEvent:@"playerStartedAutoPilot"];
|
[self doScriptEvent:@"playerStartedAutoPilot"];
|
||||||
|
|
||||||
@ -884,8 +866,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (![UNIVERSE playCustomSound:@"[autopilot-cannot-dock-with-target]"])
|
[self playAutopilotCannotDockWithTarget];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"Target is not capable of autopilot-docking") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"Target is not capable of autopilot-docking") forCount:4.5];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -915,7 +896,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
// there's a slight chance you'll be fined for your past offences when autodocking
|
// there's a slight chance you'll be fined for your past offences when autodocking
|
||||||
int fine_chance = ranrot_rand() & 0x03ff; // 0..1023
|
int fine_chance = ranrot_rand() & 0x03ff; // 0..1023
|
||||||
int government = 1 + [(NSNumber *)[[UNIVERSE currentSystemData] objectForKey:KEY_GOVERNMENT] intValue]; // 1..8
|
int government = 1 + [[UNIVERSE currentSystemData] intForKey:KEY_GOVERNMENT]; // 1..8
|
||||||
fine_chance /= government;
|
fine_chance /= government;
|
||||||
if (fine_chance < legalStatus)
|
if (fine_chance < legalStatus)
|
||||||
[self markForFines];
|
[self markForFines];
|
||||||
@ -930,8 +911,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (![UNIVERSE playCustomSound:@"[autopilot-out-of-range]"])
|
[self playAutopilotOutOfRange];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-out-of-range]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-out-of-range]") forCount:4.5];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -952,8 +932,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
|
|
||||||
if ((dx == 0) && (dy == 0) && equal_seeds(target_system_seed, system_seed))
|
if ((dx == 0) && (dy == 0) && equal_seeds(target_system_seed, system_seed))
|
||||||
{
|
{
|
||||||
if (![UNIVERSE playCustomSound:@"[witch-no-target]"])
|
[self playHyperspaceNoTarget];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE clearPreviousMessage];
|
[UNIVERSE clearPreviousMessage];
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-no-target]") forCount:3.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-no-target]") forCount:3.0];
|
||||||
jumpOK = NO;
|
jumpOK = NO;
|
||||||
@ -961,8 +940,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
|
|
||||||
if ((10.0 * distance > fuel)||(fuel == 0))
|
if ((10.0 * distance > fuel)||(fuel == 0))
|
||||||
{
|
{
|
||||||
if (![UNIVERSE playCustomSound:@"[witch-no-fuel]"])
|
[self playHyperspaceNoFuel];
|
||||||
[self boop];
|
|
||||||
[UNIVERSE clearPreviousMessage];
|
[UNIVERSE clearPreviousMessage];
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-no-fuel]") forCount:3.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-no-fuel]") forCount:3.0];
|
||||||
jumpOK = NO;
|
jumpOK = NO;
|
||||||
@ -971,18 +949,10 @@ static NSTimeInterval time_last_frame;
|
|||||||
if (status == STATUS_WITCHSPACE_COUNTDOWN)
|
if (status == STATUS_WITCHSPACE_COUNTDOWN)
|
||||||
{
|
{
|
||||||
// abort!
|
// abort!
|
||||||
#if 0
|
|
||||||
// FIXME: should use an OOSoundSource.
|
|
||||||
if (galactic_witchjump)
|
|
||||||
[UNIVERSE stopCustomSound:@"[galactic-hyperspace-countdown-begun]"];
|
|
||||||
else
|
|
||||||
[UNIVERSE stopCustomSound:@"[hyperspace-countdown-begun]"];
|
|
||||||
#endif
|
|
||||||
jumpOK = NO;
|
jumpOK = NO;
|
||||||
galactic_witchjump = NO;
|
galactic_witchjump = NO;
|
||||||
status = STATUS_IN_FLIGHT;
|
status = STATUS_IN_FLIGHT;
|
||||||
if (![UNIVERSE playCustomSound:@"[hyperspace-countdown-aborted]"])
|
[self playHyperspaceAborted];
|
||||||
[self boop];
|
|
||||||
// say it!
|
// say it!
|
||||||
[UNIVERSE clearPreviousMessage];
|
[UNIVERSE clearPreviousMessage];
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-user-abort]") forCount:3.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-user-abort]") forCount:3.0];
|
||||||
@ -995,8 +965,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
galactic_witchjump = NO;
|
galactic_witchjump = NO;
|
||||||
witchspaceCountdown = 15.0;
|
witchspaceCountdown = 15.0;
|
||||||
status = STATUS_WITCHSPACE_COUNTDOWN;
|
status = STATUS_WITCHSPACE_COUNTDOWN;
|
||||||
if (![UNIVERSE playCustomSound:@"[hyperspace-countdown-begun]"])
|
[self playStandardHyperspace];
|
||||||
[self beep];
|
|
||||||
// say it!
|
// say it!
|
||||||
[UNIVERSE clearPreviousMessage];
|
[UNIVERSE clearPreviousMessage];
|
||||||
[UNIVERSE addMessage:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[witch-to-@-in-f-seconds]"), [UNIVERSE getSystemName:target_system_seed], witchspaceCountdown] forCount:1.0];
|
[UNIVERSE addMessage:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[witch-to-@-in-f-seconds]"), [UNIVERSE getSystemName:target_system_seed], witchspaceCountdown] forCount:1.0];
|
||||||
@ -1019,18 +988,10 @@ static NSTimeInterval time_last_frame;
|
|||||||
if (status == STATUS_WITCHSPACE_COUNTDOWN)
|
if (status == STATUS_WITCHSPACE_COUNTDOWN)
|
||||||
{
|
{
|
||||||
// abort!
|
// abort!
|
||||||
#if 0
|
|
||||||
// FIXME: should use an OOSoundSource.
|
|
||||||
if (galactic_witchjump)
|
|
||||||
[UNIVERSE stopCustomSound:@"[galactic-hyperspace-countdown-begun]"];
|
|
||||||
else
|
|
||||||
[UNIVERSE stopCustomSound:@"[hyperspace-countdown-begun]"];
|
|
||||||
#endif
|
|
||||||
jumpOK = NO;
|
jumpOK = NO;
|
||||||
galactic_witchjump = NO;
|
galactic_witchjump = NO;
|
||||||
status = STATUS_IN_FLIGHT;
|
status = STATUS_IN_FLIGHT;
|
||||||
if (![UNIVERSE playCustomSound:@"[hyperspace-countdown-aborted]"])
|
[self playHyperspaceAborted];
|
||||||
[self boop];
|
|
||||||
// say it!
|
// say it!
|
||||||
[UNIVERSE clearPreviousMessage];
|
[UNIVERSE clearPreviousMessage];
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-user-abort]") forCount:3.0];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[witch-user-abort]") forCount:3.0];
|
||||||
@ -1043,9 +1004,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
galactic_witchjump = YES;
|
galactic_witchjump = YES;
|
||||||
witchspaceCountdown = 15.0;
|
witchspaceCountdown = 15.0;
|
||||||
status = STATUS_WITCHSPACE_COUNTDOWN;
|
status = STATUS_WITCHSPACE_COUNTDOWN;
|
||||||
if (![UNIVERSE playCustomSound:@"[galactic-hyperspace-countdown-begun]"])
|
[self playGalacticHyperspace];
|
||||||
if (![UNIVERSE playCustomSound:@"[hyperspace-countdown-begun]"])
|
|
||||||
[self beep];
|
|
||||||
// say it!
|
// say it!
|
||||||
[UNIVERSE addMessage:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[witch-galactic-in-f-seconds]"), witchspaceCountdown] forCount:1.0];
|
[UNIVERSE addMessage:[NSString stringWithFormat:ExpandDescriptionForCurrentSystem(@"[witch-galactic-in-f-seconds]"), witchspaceCountdown] forCount:1.0];
|
||||||
|
|
||||||
@ -1065,25 +1024,21 @@ static NSTimeInterval time_last_frame;
|
|||||||
if (!cloaking_device_active)
|
if (!cloaking_device_active)
|
||||||
{
|
{
|
||||||
if ([self activateCloakingDevice])
|
if ([self activateCloakingDevice])
|
||||||
|
{
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[cloak-on]") forCount:2];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[cloak-on]") forCount:2];
|
||||||
|
[self playCloakingDeviceOn];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[cloak-low-juice]") forCount:3];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[cloak-low-juice]") forCount:3];
|
||||||
|
[self playCloakingDeviceInsufficientEnergy];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self deactivateCloakingDevice];
|
[self deactivateCloakingDevice];
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[cloak-off]") forCount:2];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[cloak-off]") forCount:2];
|
||||||
}
|
[self playCloakingDeviceOff];
|
||||||
|
|
||||||
if (cloaking_device_active)
|
|
||||||
{
|
|
||||||
if (![UNIVERSE playCustomSound:@"[cloaking-device-on]"])
|
|
||||||
[self beep];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (![UNIVERSE playCustomSound:@"[cloaking-device-off]"])
|
|
||||||
[self boop];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cloak_pressed = YES;
|
cloak_pressed = YES;
|
||||||
@ -1560,7 +1515,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ([[gui keyForRow:GUI_ROW_EQUIPMENT_START] hasPrefix:@"More:"])
|
if ([[gui keyForRow:GUI_ROW_EQUIPMENT_START] hasPrefix:@"More:"])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuPagePrevious];
|
||||||
[gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
|
[gui setSelectedRow:GUI_ROW_EQUIPMENT_START];
|
||||||
[self buySelectedItem];
|
[self buySelectedItem];
|
||||||
}
|
}
|
||||||
@ -1573,7 +1528,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ([[gui keyForRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1] hasPrefix:@"More:"])
|
if ([[gui keyForRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1] hasPrefix:@"More:"])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuPageNext];
|
||||||
[gui setSelectedRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1];
|
[gui setSelectedRow:GUI_ROW_EQUIPMENT_START + GUI_MAX_ROWS_EQUIPMENT - 1];
|
||||||
[self buySelectedItem];
|
[self buySelectedItem];
|
||||||
}
|
}
|
||||||
@ -1614,9 +1569,13 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
int item = [(NSString *)[gui selectedRowKey] intValue];
|
int item = [(NSString *)[gui selectedRowKey] intValue];
|
||||||
if ([self tryBuyingCommodity:item])
|
if ([self tryBuyingCommodity:item])
|
||||||
|
{
|
||||||
[self setGuiToMarketScreen];
|
[self setGuiToMarketScreen];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
[self boop];
|
{
|
||||||
|
[self playCantBuyBuyCommodity];
|
||||||
|
}
|
||||||
wait_for_key_up = YES;
|
wait_for_key_up = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1626,9 +1585,13 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
int item = [(NSString *)[gui selectedRowKey] intValue];
|
int item = [(NSString *)[gui selectedRowKey] intValue];
|
||||||
if ([self trySellingCommodity:item])
|
if ([self trySellingCommodity:item])
|
||||||
|
{
|
||||||
[self setGuiToMarketScreen];
|
[self setGuiToMarketScreen];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
[self boop];
|
{
|
||||||
|
[self playCantBuyBuyCommodity];
|
||||||
|
}
|
||||||
wait_for_key_up = YES;
|
wait_for_key_up = YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1642,13 +1605,13 @@ static NSTimeInterval time_last_frame;
|
|||||||
if (!wait_for_key_up)
|
if (!wait_for_key_up)
|
||||||
{
|
{
|
||||||
int item = [(NSString *)[gui selectedRowKey] intValue];
|
int item = [(NSString *)[gui selectedRowKey] intValue];
|
||||||
int yours = [(NSNumber *)[(NSArray *)[shipCommodityData objectAtIndex:item] objectAtIndex:1] intValue];
|
int yours = [[shipCommodityData arrayAtIndex:item] intAtIndex:1];
|
||||||
if ((yours > 0)&&(![self marketFlooded:item])) // sell all you can
|
if ((yours > 0)&&(![self marketFlooded:item])) // sell all you can
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < yours; i++)
|
for (i = 0; i < yours; i++)
|
||||||
[self trySellingCommodity:item];
|
[self trySellingCommodity:item];
|
||||||
[self playInterfaceBeep:kInterfaceBeep_Sell];
|
[self playSellCommodity];
|
||||||
[self setGuiToMarketScreen];
|
[self setGuiToMarketScreen];
|
||||||
}
|
}
|
||||||
else // buy as much as possible
|
else // buy as much as possible
|
||||||
@ -1659,11 +1622,11 @@ static NSTimeInterval time_last_frame;
|
|||||||
[self setGuiToMarketScreen];
|
[self setGuiToMarketScreen];
|
||||||
if (amount_bought == 0)
|
if (amount_bought == 0)
|
||||||
{
|
{
|
||||||
[self boop];
|
[self playCantBuyBuyCommodity];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self playInterfaceBeep:kInterfaceBeep_Buy];
|
[self playBuyCommodity];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wait_for_key_up = YES;
|
wait_for_key_up = YES;
|
||||||
@ -1691,12 +1654,12 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ([self pickFromGuiContractsScreen])
|
if ([self pickFromGuiContractsScreen])
|
||||||
{
|
{
|
||||||
[self playInterfaceBeep:kInterfaceBeep_Buy];
|
[self playBuyCommodity];
|
||||||
[self setGuiToContractsScreen];
|
[self setGuiToContractsScreen];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self boop];
|
[self playCantBuyBuyCommodity];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectPressed = YES;
|
selectPressed = YES;
|
||||||
@ -1724,7 +1687,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if (!spacePressed)
|
if (!spacePressed)
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playDismissedReportScreen];
|
||||||
[self setGuiToStatusScreen];
|
[self setGuiToStatusScreen];
|
||||||
}
|
}
|
||||||
spacePressed = YES;
|
spacePressed = YES;
|
||||||
@ -1745,7 +1708,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ([[gui keyForRow:GUI_ROW_SHIPYARD_START] hasPrefix:@"More:"])
|
if ([[gui keyForRow:GUI_ROW_SHIPYARD_START] hasPrefix:@"More:"])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuPagePrevious];
|
||||||
[gui setSelectedRow:GUI_ROW_SHIPYARD_START];
|
[gui setSelectedRow:GUI_ROW_SHIPYARD_START];
|
||||||
[self buySelectedShip];
|
[self buySelectedShip];
|
||||||
}
|
}
|
||||||
@ -1758,7 +1721,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if ([[gui keyForRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1] hasPrefix:@"More:"])
|
if ([[gui keyForRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1] hasPrefix:@"More:"])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuPageNext];
|
||||||
[gui setSelectedRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1];
|
[gui setSelectedRow:GUI_ROW_SHIPYARD_START + MAX_ROWS_SHIPS_FOR_SALE - 1];
|
||||||
[self buySelectedShip];
|
[self buySelectedShip];
|
||||||
}
|
}
|
||||||
@ -1777,18 +1740,18 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
if (money == credits) // we just skipped to another page
|
if (money == credits) // we just skipped to another page
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playCantBuyBuyShip];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[UNIVERSE removeDemoShips];
|
[UNIVERSE removeDemoShips];
|
||||||
[self setGuiToStatusScreen];
|
[self setGuiToStatusScreen];
|
||||||
[self playInterfaceBeep: kInterfaceBeep_Buy];
|
[self playBuyShip];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self boop];
|
[self playCantBuyBuyCommodity];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
selectPressed = YES;
|
selectPressed = YES;
|
||||||
@ -1881,7 +1844,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
#endif
|
#endif
|
||||||
NSString *displayModeString = [self screenModeStringForWidth:modeWidth height:modeHeight refreshRate:modeRefresh];
|
NSString *displayModeString = [self screenModeStringForWidth:modeWidth height:modeHeight refreshRate:modeRefresh];
|
||||||
|
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
[gui setText:displayModeString forRow:GUI_ROW_GAMEOPTIONS_DISPLAY align:GUI_ALIGN_CENTER];
|
[gui setText:displayModeString forRow:GUI_ROW_GAMEOPTIONS_DISPLAY align:GUI_ALIGN_CENTER];
|
||||||
switching_resolution = YES;
|
switching_resolution = YES;
|
||||||
}
|
}
|
||||||
@ -1895,7 +1858,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||||
if ([gameView isDown:gvArrowKeyRight] != isSpeechOn)
|
if ([gameView isDown:gvArrowKeyRight] != isSpeechOn)
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
isSpeechOn = [gameView isDown:gvArrowKeyRight];
|
isSpeechOn = [gameView isDown:gvArrowKeyRight];
|
||||||
if (isSpeechOn)
|
if (isSpeechOn)
|
||||||
[gui setText:DESC(@"gameoptions-spoken-messages-yes") forRow:GUI_ROW_GAMEOPTIONS_SPEECH align:GUI_ALIGN_CENTER];
|
[gui setText:DESC(@"gameoptions-spoken-messages-yes") forRow:GUI_ROW_GAMEOPTIONS_SPEECH align:GUI_ALIGN_CENTER];
|
||||||
@ -1909,7 +1872,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
// FIXME: Music mode UI
|
// FIXME: Music mode UI
|
||||||
/*GuiDisplayGen* gui = [UNIVERSE gui];
|
/*GuiDisplayGen* gui = [UNIVERSE gui];
|
||||||
if ([gameView isDown:gvArrowKeyRight] != ootunes_on)
|
if ([gameView isDown:gvArrowKeyRight] != ootunes_on)
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
ootunes_on = [gameView isDown:gvArrowKeyRight];
|
ootunes_on = [gameView isDown:gvArrowKeyRight];
|
||||||
if (ootunes_on)
|
if (ootunes_on)
|
||||||
[gui setText:DESC(@"gameoptions-itunes-yes") forRow:GUI_ROW_GAMEOPTIONS_OOTUNES align:GUI_ALIGN_CENTER];
|
[gui setText:DESC(@"gameoptions-itunes-yes") forRow:GUI_ROW_GAMEOPTIONS_OOTUNES align:GUI_ALIGN_CENTER];
|
||||||
@ -1921,7 +1884,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||||
if ([gameView isDown:gvArrowKeyRight] != [UNIVERSE autoSave])
|
if ([gameView isDown:gvArrowKeyRight] != [UNIVERSE autoSave])
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
[UNIVERSE setAutoSave:[gameView isDown:gvArrowKeyRight]];
|
[UNIVERSE setAutoSave:[gameView isDown:gvArrowKeyRight]];
|
||||||
if ([UNIVERSE autoSave])
|
if ([UNIVERSE autoSave])
|
||||||
[gui setText:DESC(@"gameoptions-autosave-yes") forRow:GUI_ROW_GAMEOPTIONS_AUTOSAVE align:GUI_ALIGN_CENTER];
|
[gui setText:DESC(@"gameoptions-autosave-yes") forRow:GUI_ROW_GAMEOPTIONS_AUTOSAVE align:GUI_ALIGN_CENTER];
|
||||||
@ -1943,7 +1906,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
if (volume > 100) volume = 100;
|
if (volume > 100) volume = 100;
|
||||||
if (volume < 0) volume = 0;
|
if (volume < 0) volume = 0;
|
||||||
[OOSound setMasterVolume: 0.01 * volume];
|
[OOSound setMasterVolume: 0.01 * volume];
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
if (volume > 0)
|
if (volume > 0)
|
||||||
{
|
{
|
||||||
NSString* soundVolumeWordDesc = DESC(@"gameoptions-sound-volume");
|
NSString* soundVolumeWordDesc = DESC(@"gameoptions-sound-volume");
|
||||||
@ -1989,7 +1952,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
NSString* growl_priority_desc = [Groolite priorityDescription:growl_min_priority];
|
NSString* growl_priority_desc = [Groolite priorityDescription:growl_min_priority];
|
||||||
[gui setText:[NSString stringWithFormat:DESC(@"gameoptions-show-growl-messages-@"), growl_priority_desc]
|
[gui setText:[NSString stringWithFormat:DESC(@"gameoptions-show-growl-messages-@"), growl_priority_desc]
|
||||||
forRow:GUI_ROW_GAMEOPTIONS_GROWL align:GUI_ALIGN_CENTER];
|
forRow:GUI_ROW_GAMEOPTIONS_GROWL align:GUI_ALIGN_CENTER];
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
[prefs setInteger:growl_min_priority forKey:@"groolite-min-priority"];
|
[prefs setInteger:growl_min_priority forKey:@"groolite-min-priority"];
|
||||||
}
|
}
|
||||||
timeLastKeyPress = script_time;
|
timeLastKeyPress = script_time;
|
||||||
@ -2004,7 +1967,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||||
if ([gameView isDown:gvArrowKeyRight] != [UNIVERSE wireframeGraphics])
|
if ([gameView isDown:gvArrowKeyRight] != [UNIVERSE wireframeGraphics])
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
[UNIVERSE setWireframeGraphics:[gameView isDown:gvArrowKeyRight]];
|
[UNIVERSE setWireframeGraphics:[gameView isDown:gvArrowKeyRight]];
|
||||||
if ([UNIVERSE wireframeGraphics])
|
if ([UNIVERSE wireframeGraphics])
|
||||||
[gui setText:DESC(@"gameoptions-wireframe-graphics-yes") forRow:GUI_ROW_GAMEOPTIONS_WIREFRAMEGRAPHICS align:GUI_ALIGN_CENTER];
|
[gui setText:DESC(@"gameoptions-wireframe-graphics-yes") forRow:GUI_ROW_GAMEOPTIONS_WIREFRAMEGRAPHICS align:GUI_ALIGN_CENTER];
|
||||||
@ -2016,7 +1979,7 @@ static NSTimeInterval time_last_frame;
|
|||||||
{
|
{
|
||||||
GuiDisplayGen* gui = [UNIVERSE gui];
|
GuiDisplayGen* gui = [UNIVERSE gui];
|
||||||
if ([gameView isDown:gvArrowKeyRight] != [UNIVERSE reducedDetail])
|
if ([gameView isDown:gvArrowKeyRight] != [UNIVERSE reducedDetail])
|
||||||
[gui click];
|
[self playChangedOption];
|
||||||
[UNIVERSE setReducedDetail:[gameView isDown:gvArrowKeyRight]];
|
[UNIVERSE setReducedDetail:[gameView isDown:gvArrowKeyRight]];
|
||||||
if ([UNIVERSE reducedDetail])
|
if ([UNIVERSE reducedDetail])
|
||||||
[gui setText:DESC(@"gameoptions-reduced-detail-yes") forRow:GUI_ROW_GAMEOPTIONS_DETAIL align:GUI_ALIGN_CENTER];
|
[gui setText:DESC(@"gameoptions-reduced-detail-yes") forRow:GUI_ROW_GAMEOPTIONS_DETAIL align:GUI_ALIGN_CENTER];
|
||||||
@ -2536,8 +2499,7 @@ static BOOL toggling_music;
|
|||||||
autopilot_engaged = NO;
|
autopilot_engaged = NO;
|
||||||
primaryTarget = NO_TARGET;
|
primaryTarget = NO_TARGET;
|
||||||
status = STATUS_IN_FLIGHT;
|
status = STATUS_IN_FLIGHT;
|
||||||
if (![UNIVERSE playCustomSound:@"[autopilot-off]"])
|
[self playAutopilotOff];
|
||||||
[self beep];
|
|
||||||
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-off]") forCount:4.5];
|
[UNIVERSE addMessage:ExpandDescriptionForCurrentSystem(@"[autopilot-off]") forCount:4.5];
|
||||||
[self doScriptEvent:@"playerCancelledAutoPilot"];
|
[self doScriptEvent:@"playerCancelledAutoPilot"];
|
||||||
|
|
||||||
@ -2690,7 +2652,11 @@ static BOOL toggling_music;
|
|||||||
{
|
{
|
||||||
if ([gui setSelectedRow:guiSelectedRow + 1])
|
if ([gui setSelectedRow:guiSelectedRow + 1])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuNavigationDown];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self playMenuNavigationNot];
|
||||||
}
|
}
|
||||||
timeLastKeyPress = script_time;
|
timeLastKeyPress = script_time;
|
||||||
}
|
}
|
||||||
@ -2701,7 +2667,11 @@ static BOOL toggling_music;
|
|||||||
{
|
{
|
||||||
if ([gui setSelectedRow:guiSelectedRow - 1])
|
if ([gui setSelectedRow:guiSelectedRow - 1])
|
||||||
{
|
{
|
||||||
[gui click];
|
[self playMenuNavigationUp];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self playMenuNavigationNot];
|
||||||
}
|
}
|
||||||
timeLastKeyPress = script_time;
|
timeLastKeyPress = script_time;
|
||||||
}
|
}
|
||||||
@ -2718,6 +2688,7 @@ static BOOL toggling_music;
|
|||||||
[gui clearBackground];
|
[gui clearBackground];
|
||||||
[self setGuiToStatusScreen];
|
[self setGuiToStatusScreen];
|
||||||
[[OOMusicController sharedController] stopMissionMusic];
|
[[OOMusicController sharedController] stopMissionMusic];
|
||||||
|
[self playDismissedMissionScreen];
|
||||||
|
|
||||||
[self doScriptEvent:@"missionScreenEnded"];
|
[self doScriptEvent:@"missionScreenEnded"];
|
||||||
[self checkScript];
|
[self checkScript];
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#import "PlayerEntityLoadSave.h"
|
#import "PlayerEntityLoadSave.h"
|
||||||
#import "PlayerEntityContracts.h"
|
#import "PlayerEntityContracts.h"
|
||||||
#import "PlayerEntityControls.h"
|
#import "PlayerEntityControls.h"
|
||||||
|
#import "PlayerEntitySound.h"
|
||||||
|
|
||||||
#import "NSFileManagerOOExtensions.h"
|
#import "NSFileManagerOOExtensions.h"
|
||||||
#import "GameController.h"
|
#import "GameController.h"
|
||||||
@ -357,16 +358,17 @@
|
|||||||
[self nativeSavePlayer: commanderNameString];
|
[self nativeSavePlayer: commanderNameString];
|
||||||
[self setGuiToStatusScreen];
|
[self setGuiToStatusScreen];
|
||||||
|
|
||||||
[beepSound play];
|
[self playSaveOverwriteYes];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (([gameView isDown: 13] && ([gui selectedRow] == SAVE_OVERWRITE_NO_ROW))||[gameView isDown: 27]||[gameView isDown: 110]||[gameView isDown: 78])
|
if (([gameView isDown: 13] && ([gui selectedRow] == SAVE_OVERWRITE_NO_ROW))||[gameView isDown: 27]||[gameView isDown: 110]||[gameView isDown: 78])
|
||||||
{
|
{
|
||||||
// esc or NO was pressed - get out of here
|
// esc or NO was pressed - get out of here
|
||||||
|
// FIXME: should return to save screen instead.
|
||||||
pollControls=YES;
|
pollControls=YES;
|
||||||
[self setGuiToStatusScreen];
|
[self setGuiToStatusScreen];
|
||||||
|
|
||||||
[boopSound play];
|
[self playSaveOverwriteNo];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,25 +25,66 @@ MA 02110-1301, USA.
|
|||||||
#import "PlayerEntity.h"
|
#import "PlayerEntity.h"
|
||||||
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
kInterfaceBeep_Beep = 1UL,
|
|
||||||
kInterfaceBeep_Boop,
|
|
||||||
kInterfaceBeep_Buy,
|
|
||||||
kInterfaceBeep_Sell
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@interface PlayerEntity (Sound)
|
@interface PlayerEntity (Sound)
|
||||||
|
|
||||||
- (void) setUpSound;
|
- (void) setUpSound;
|
||||||
- (void) destroySound;
|
- (void) destroySound;
|
||||||
|
|
||||||
- (void) beep;
|
// Interface sounds; only one at a time
|
||||||
- (void) boop;
|
|
||||||
- (void) playInterfaceBeep:(unsigned)inInterfaceBeep;
|
|
||||||
- (BOOL) isBeeping;
|
- (BOOL) isBeeping;
|
||||||
|
- (void) playIdentOn;
|
||||||
|
- (void) playIdentOff;
|
||||||
|
- (void) playIdentLockedOn;
|
||||||
|
- (void) playMissileArmed;
|
||||||
|
- (void) playMineArmed;
|
||||||
|
- (void) playMissileSafe;
|
||||||
|
- (void) playMissileLockedOn;
|
||||||
|
- (void) playNextMissileSelected;
|
||||||
|
- (void) playBuyCommodity;
|
||||||
|
- (void) playBuyShip;
|
||||||
|
- (void) playSellCommodity;
|
||||||
|
- (void) playCantBuyBuyCommodity;
|
||||||
|
- (void) playCantBuyBuyShip;
|
||||||
|
- (void) playCargoJettisioned;
|
||||||
|
- (void) playAutopilotOn;
|
||||||
|
- (void) playAutopilotOff;
|
||||||
|
- (void) playAutopilotOutOfRange;
|
||||||
|
- (void) playAutopilotCannotDockWithTarget;
|
||||||
|
- (void) playSaveOverwriteYes;
|
||||||
|
- (void) playSaveOverwriteNo;
|
||||||
|
- (void) playHoldFull;
|
||||||
|
- (void) playJumpMassLocked;
|
||||||
|
- (void) playTargetLost;
|
||||||
|
- (void) playNoTargetInMemory;
|
||||||
|
- (void) playTargetSwitched;
|
||||||
|
- (void) playCloakingDeviceOn;
|
||||||
|
- (void) playCloakingDeviceOff;
|
||||||
|
- (void) playCloakingDeviceInsufficientEnergy;
|
||||||
|
- (void) playMenuNavigationUp;
|
||||||
|
- (void) playMenuNavigationDown;
|
||||||
|
- (void) playMenuNavigationNot;
|
||||||
|
- (void) playMenuPagePrevious;
|
||||||
|
- (void) playMenuPageNext;
|
||||||
|
- (void) playDismissedReportScreen;
|
||||||
|
- (void) playDismissedMissionScreen;
|
||||||
|
- (void) playChangedOption;
|
||||||
|
|
||||||
|
// Hyperspace alert sounds; logically hyperspace sounds, but played on the interface sound source.
|
||||||
|
- (void) playHyperspaceNoTarget;
|
||||||
|
- (void) playHyperspaceNoFuel;
|
||||||
|
- (void) playHyperspaceBlocked;
|
||||||
|
|
||||||
|
|
||||||
|
/* Hyperspace sounds; only one at a time. These get their own pool since
|
||||||
|
people might want something longer than beeps and boops (e.g. the existing
|
||||||
|
hyperspace countdown one). Hyperspace-related alert sounds are with the
|
||||||
|
normal interface sounds.
|
||||||
|
*/
|
||||||
|
- (void) playStandardHyperspace;
|
||||||
|
- (void) playGalacticHyperspace;
|
||||||
|
- (void) playHyperspaceAborted;
|
||||||
|
|
||||||
|
// ECM; only one at a time
|
||||||
- (void) playHitByECMSound;
|
- (void) playHitByECMSound;
|
||||||
- (void) playFiredECMSound;
|
- (void) playFiredECMSound;
|
||||||
|
|
||||||
|
@ -29,15 +29,6 @@ MA 02110-1301, USA.
|
|||||||
#import "OOSoundSourcePool.h"
|
#import "OOSoundSourcePool.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
If BEEP_MODE is 0, playing two identical beeps (i.e. beep twice, or boop twice) will result in
|
|
||||||
that beep being played twice in a row. If it is 1, the playing beep will be interrupted. If it
|
|
||||||
is 2, two beeps will play at once with the CA implementation (and interfaceBeepSource will be
|
|
||||||
unused).
|
|
||||||
*/
|
|
||||||
#define BEEP_MODE 1
|
|
||||||
|
|
||||||
|
|
||||||
// Sizes of sound source pools
|
// Sizes of sound source pools
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -50,6 +41,10 @@ enum
|
|||||||
static OOSoundSourcePool *sWarningSoundPool;
|
static OOSoundSourcePool *sWarningSoundPool;
|
||||||
static OOSoundSourcePool *sWeaponSoundPool;
|
static OOSoundSourcePool *sWeaponSoundPool;
|
||||||
static OOSoundSourcePool *sDamageSoundPool;
|
static OOSoundSourcePool *sDamageSoundPool;
|
||||||
|
static OOSoundSource *sHyperspaceSoundSource;
|
||||||
|
static OOSoundSource *sInterfaceBeepSource;
|
||||||
|
static OOSoundSource *sEcmSource;
|
||||||
|
static OOSoundSource *sBreakPatternSource;
|
||||||
|
|
||||||
|
|
||||||
@implementation PlayerEntity (Sound)
|
@implementation PlayerEntity (Sound)
|
||||||
@ -58,12 +53,8 @@ static OOSoundSourcePool *sDamageSoundPool;
|
|||||||
{
|
{
|
||||||
[self destroySound];
|
[self destroySound];
|
||||||
|
|
||||||
beepSound = [[ResourceManager ooSoundNamed:@"beep.ogg" inFolder:@"Sounds"] retain];
|
|
||||||
boopSound = [[ResourceManager ooSoundNamed:@"boop.ogg" inFolder:@"Sounds"] retain];
|
|
||||||
missileSound = [[ResourceManager ooSoundNamed:@"missile.ogg" inFolder:@"Sounds"] retain];
|
missileSound = [[ResourceManager ooSoundNamed:@"missile.ogg" inFolder:@"Sounds"] retain];
|
||||||
|
|
||||||
buySound = [[ResourceManager ooSoundNamed:@"buy.ogg" inFolder:@"Sounds"] retain];
|
|
||||||
sellSound = [[ResourceManager ooSoundNamed:@"sell.ogg" inFolder:@"Sounds"] retain];
|
|
||||||
afterburner1Sound = [[ResourceManager ooSoundNamed:@"afterburner1.ogg" inFolder:@"Sounds"] retain];
|
afterburner1Sound = [[ResourceManager ooSoundNamed:@"afterburner1.ogg" inFolder:@"Sounds"] retain];
|
||||||
afterburner2Sound = [[ResourceManager ooSoundNamed:@"afterburner2.ogg" inFolder:@"Sounds"] retain];
|
afterburner2Sound = [[ResourceManager ooSoundNamed:@"afterburner2.ogg" inFolder:@"Sounds"] retain];
|
||||||
|
|
||||||
@ -72,9 +63,11 @@ static OOSoundSourcePool *sDamageSoundPool;
|
|||||||
fuelScoopSound = [[ResourceManager ooSoundNamed:@"scoop.ogg" inFolder:@"Sounds"] retain];
|
fuelScoopSound = [[ResourceManager ooSoundNamed:@"scoop.ogg" inFolder:@"Sounds"] retain];
|
||||||
|
|
||||||
refPoint = [[OOSoundReferencePoint alloc] init];
|
refPoint = [[OOSoundReferencePoint alloc] init];
|
||||||
interfaceBeepSource = [[OOSoundSource alloc] init];
|
|
||||||
breakPatternSource = [[OOSoundSource alloc] init];
|
sInterfaceBeepSource = [[OOSoundSource alloc] init];
|
||||||
ecmSource = [[OOSoundSource alloc] init];
|
sBreakPatternSource = [[OOSoundSource alloc] init];
|
||||||
|
sEcmSource = [[OOSoundSource alloc] init];
|
||||||
|
sHyperspaceSoundSource = [[OOSoundSource alloc] init];
|
||||||
|
|
||||||
sWarningSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWarningPoolSize minRepeatTime:0];
|
sWarningSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWarningPoolSize minRepeatTime:0];
|
||||||
sWeaponSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWeaponPoolSize minRepeatTime:0];
|
sWeaponSoundPool = [[OOSoundSourcePool alloc] initWithCount:kWeaponPoolSize minRepeatTime:0];
|
||||||
@ -84,14 +77,9 @@ static OOSoundSourcePool *sDamageSoundPool;
|
|||||||
|
|
||||||
- (void) destroySound
|
- (void) destroySound
|
||||||
{
|
{
|
||||||
[beepSound release];
|
[missileSound release];
|
||||||
beepSound = nil;
|
missileSound = nil;
|
||||||
[boopSound release];
|
|
||||||
boopSound = nil;
|
|
||||||
[buySound release];
|
|
||||||
buySound = nil;
|
|
||||||
[sellSound release];
|
|
||||||
sellSound = nil;
|
|
||||||
[afterburner1Sound release];
|
[afterburner1Sound release];
|
||||||
afterburner1Sound = nil;
|
afterburner1Sound = nil;
|
||||||
[afterburner2Sound release];
|
[afterburner2Sound release];
|
||||||
@ -105,12 +93,15 @@ static OOSoundSourcePool *sDamageSoundPool;
|
|||||||
|
|
||||||
[refPoint release];
|
[refPoint release];
|
||||||
refPoint = nil;
|
refPoint = nil;
|
||||||
[interfaceBeepSource release];
|
|
||||||
interfaceBeepSource = nil;
|
[sInterfaceBeepSource release];
|
||||||
[ecmSource release];
|
sInterfaceBeepSource = nil;
|
||||||
ecmSource = nil;
|
[sBreakPatternSource release];
|
||||||
[breakPatternSource release];
|
sBreakPatternSource = nil;
|
||||||
breakPatternSource = nil;
|
[sEcmSource release];
|
||||||
|
sEcmSource = nil;
|
||||||
|
[sHyperspaceSoundSource release];
|
||||||
|
sHyperspaceSoundSource = nil;
|
||||||
|
|
||||||
[sWarningSoundPool release];
|
[sWarningSoundPool release];
|
||||||
sWarningSoundPool = nil;
|
sWarningSoundPool = nil;
|
||||||
@ -121,89 +112,303 @@ static OOSoundSourcePool *sDamageSoundPool;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) beep
|
- (void) playInterfaceBeep:(NSString *)beepKey
|
||||||
{
|
{
|
||||||
[self playInterfaceBeep:kInterfaceBeep_Beep];
|
[sInterfaceBeepSource playSound:[OOSound soundWithCustomSoundKey:beepKey]];
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) boop
|
|
||||||
{
|
|
||||||
[self playInterfaceBeep:kInterfaceBeep_Boop];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) playInterfaceBeep:(unsigned)inInterfaceBeep
|
|
||||||
{
|
|
||||||
OOSound *sound = nil;
|
|
||||||
|
|
||||||
switch (inInterfaceBeep)
|
|
||||||
{
|
|
||||||
case kInterfaceBeep_Beep:
|
|
||||||
sound = beepSound;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kInterfaceBeep_Boop:
|
|
||||||
sound = boopSound;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kInterfaceBeep_Buy:
|
|
||||||
sound = buySound;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kInterfaceBeep_Sell:
|
|
||||||
sound = sellSound;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
OOLog(@"sound.invalidBeep", @"Invalid beep selector: %u", inInterfaceBeep);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if BEEP_MODE == 0
|
|
||||||
[interfaceBeepSource playOrRepeatSound:sound];
|
|
||||||
#elif BEEP_MODE == 1
|
|
||||||
[interfaceBeepSource playSound:sound];
|
|
||||||
#elif BEEP_MODE == 2
|
|
||||||
[sound play];
|
|
||||||
#else
|
|
||||||
#error Unknown BEEP_MODE
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (BOOL) isBeeping
|
- (BOOL) isBeeping
|
||||||
{
|
{
|
||||||
return [interfaceBeepSource isPlaying];
|
return [sInterfaceBeepSource isPlaying];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) boop
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[general-boop]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playIdentOn
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[ident-on]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playIdentOff
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[ident-off]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playIdentLockedOn
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[ident-locked-on]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMissileArmed
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[missile-armed]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMineArmed
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[mine-armed]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMissileSafe
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[missile-safe]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMissileLockedOn
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[missile-locked-on]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playNextMissileSelected
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[next-missile-selected]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playBuyCommodity
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[buy-commodity]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playBuyShip
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[buy-ship]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playSellCommodity
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[sell-commodity]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playCantBuyBuyCommodity
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[could-not-buy-any]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playCantBuyBuyShip
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[could-not-buy-ship]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playCargoJettisioned
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[cargo-jettisoned]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playAutopilotOn
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[autopilot-on]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playAutopilotOff
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[autopilot-off]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playAutopilotOutOfRange
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[autopilot-out-of-range]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playAutopilotCannotDockWithTarget
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[autopilot-cannot-dock-with-target]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playSaveOverwriteYes
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[save-overwrite-yes]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playSaveOverwriteNo
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[save-overwrite-no]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playHoldFull
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[hold-full]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playJumpMassLocked
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[jump-mass-locked]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playTargetLost
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[target-lost]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playNoTargetInMemory
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[no-target-in-memory]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playTargetSwitched
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[target-switched]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playHyperspaceNoTarget
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[witch-no-target]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playHyperspaceNoFuel
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[witch-no-fuel]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playHyperspaceBlocked
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[witch-blocked-by-@]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playCloakingDeviceOn
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[cloaking-device-on]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playCloakingDeviceOff
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[cloaking-device-off]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMenuNavigationUp
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[menu-navigation-up]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMenuNavigationDown
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[menu-navigation-down]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMenuNavigationNot
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[menu-navigation-not]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMenuPagePrevious
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[menu-next-page]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playMenuPageNext
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[menu-previous-page]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playDismissedReportScreen
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[dismissed-report-screen]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playDismissedMissionScreen
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[dismissed-mission-screen]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playChangedOption
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[changed-option]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playCloakingDeviceInsufficientEnergy
|
||||||
|
{
|
||||||
|
[self playInterfaceBeep:@"[cloaking-device-insufficent-energy]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playStandardHyperspace
|
||||||
|
{
|
||||||
|
[sHyperspaceSoundSource playCustomSoundWithKey:@"[hyperspace-countdown-begun]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playGalacticHyperspace
|
||||||
|
{
|
||||||
|
[sHyperspaceSoundSource playCustomSoundWithKey:@"[galactic-hyperspace-countdown-begun]"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void) playHyperspaceAborted
|
||||||
|
{
|
||||||
|
[sHyperspaceSoundSource playCustomSoundWithKey:@"[hyperspace-countdown-begun]"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) playHitByECMSound
|
- (void) playHitByECMSound
|
||||||
{
|
{
|
||||||
if (![ecmSource isPlaying]) [ecmSource playCustomSoundWithKey:@"[player-hit-by-ecm]"];
|
if (![sEcmSource isPlaying]) [sEcmSource playCustomSoundWithKey:@"[player-hit-by-ecm]"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) playFiredECMSound
|
- (void) playFiredECMSound
|
||||||
{
|
{
|
||||||
if (![ecmSource isPlaying]) [ecmSource playCustomSoundWithKey:@"[player-fired-ecm]"];
|
if (![sEcmSource isPlaying]) [sEcmSource playCustomSoundWithKey:@"[player-fired-ecm]"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) playLaunchFromStation
|
- (void) playLaunchFromStation
|
||||||
{
|
{
|
||||||
[breakPatternSource playCustomSoundWithKey:@"[player-launch-from-station]"];
|
[sBreakPatternSource playCustomSoundWithKey:@"[player-launch-from-station]"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) playDockWithStation
|
- (void) playDockWithStation
|
||||||
{
|
{
|
||||||
[breakPatternSource playCustomSoundWithKey:@"[player-dock-with-station]"];
|
[sBreakPatternSource playCustomSoundWithKey:@"[player-dock-with-station]"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) playExitWitchspace
|
- (void) playExitWitchspace
|
||||||
{
|
{
|
||||||
[breakPatternSource playCustomSoundWithKey:@"[player-exit-witchspace]"];
|
[sBreakPatternSource playCustomSoundWithKey:@"[player-exit-witchspace]"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,8 +72,6 @@ typedef OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS];
|
|||||||
|
|
||||||
NSSize pixel_title_size;
|
NSSize pixel_title_size;
|
||||||
|
|
||||||
OOSound *guiclick;
|
|
||||||
|
|
||||||
OOColor *backgroundColor;
|
OOColor *backgroundColor;
|
||||||
OOColor *textColor;
|
OOColor *textColor;
|
||||||
|
|
||||||
@ -149,8 +147,6 @@ typedef OOGUITabStop OOGUITabSettings[GUI_MAX_COLUMNS];
|
|||||||
|
|
||||||
- (void) setCharacterSize:(NSSize) character_size;
|
- (void) setCharacterSize:(NSSize) character_size;
|
||||||
|
|
||||||
- (void) click;
|
|
||||||
|
|
||||||
- (void)setShowAdvancedNavArray:(BOOL)inFlag;
|
- (void)setShowAdvancedNavArray:(BOOL)inFlag;
|
||||||
|
|
||||||
- (void) setColor:(OOColor *)color forRow:(OOGUIRow)row;
|
- (void) setColor:(OOColor *)color forRow:(OOGUIRow)row;
|
||||||
|
@ -80,9 +80,7 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
|
|||||||
tabStops[i] = stops[i];
|
tabStops[i] = stops[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
title = @"Test Page";
|
title = @"";
|
||||||
|
|
||||||
guiclick = [[ResourceManager ooSoundNamed:@"guiclick.ogg" inFolder:@"Sounds"] retain];
|
|
||||||
|
|
||||||
textColor = [[OOColor yellowColor] retain];
|
textColor = [[OOColor yellowColor] retain];
|
||||||
|
|
||||||
@ -132,8 +130,6 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
|
|||||||
|
|
||||||
title = [gui_title retain];
|
title = [gui_title retain];
|
||||||
|
|
||||||
guiclick = [[ResourceManager ooSoundNamed:@"guiclick.ogg" inFolder:@"Sounds"] retain];
|
|
||||||
|
|
||||||
textColor = [[OOColor yellowColor] retain];
|
textColor = [[OOColor yellowColor] retain];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@ -328,12 +324,6 @@ OOINLINE BOOL RowInRange(OOGUIRow row, NSRange range)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) click
|
|
||||||
{
|
|
||||||
[guiclick play];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)setShowAdvancedNavArray:(BOOL)inFlag
|
- (void)setShowAdvancedNavArray:(BOOL)inFlag
|
||||||
{
|
{
|
||||||
showAdvancedNavArray = inFlag;
|
showAdvancedNavArray = inFlag;
|
||||||
|
@ -708,47 +708,51 @@ static BOOL hostiles;
|
|||||||
&&(the_sun)
|
&&(the_sun)
|
||||||
&&(the_planet)) // and be in a system
|
&&(the_planet)) // and be in a system
|
||||||
{
|
{
|
||||||
Vector relativePosition;
|
Entity *reference = nil;
|
||||||
|
|
||||||
switch ([player compassMode])
|
switch ([player compassMode])
|
||||||
{
|
{
|
||||||
case COMPASS_MODE_BASIC:
|
case COMPASS_MODE_BASIC:
|
||||||
relativePosition = the_planet->position;
|
|
||||||
if (([player checkForAegis] != AEGIS_NONE)&&(the_station))
|
if ([player checkForAegis] != AEGIS_NONE && the_station)
|
||||||
relativePosition = the_station->position;
|
{
|
||||||
|
reference = the_station;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reference = the_planet;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPASS_MODE_PLANET:
|
case COMPASS_MODE_PLANET:
|
||||||
relativePosition = the_planet->position;
|
reference = the_planet;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPASS_MODE_STATION:
|
case COMPASS_MODE_STATION:
|
||||||
relativePosition = the_station->position;
|
reference = the_station;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPASS_MODE_SUN:
|
case COMPASS_MODE_SUN:
|
||||||
relativePosition = the_sun->position;
|
reference = the_sun;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPASS_MODE_TARGET:
|
case COMPASS_MODE_TARGET:
|
||||||
if (the_target)
|
reference = the_target;
|
||||||
relativePosition = the_target->position;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[player setCompassMode:COMPASS_MODE_PLANET];
|
|
||||||
relativePosition = the_planet->position;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case COMPASS_MODE_BEACONS:
|
case COMPASS_MODE_BEACONS:
|
||||||
if (the_next_beacon)
|
reference = the_next_beacon;
|
||||||
relativePosition = the_next_beacon->position;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[player setCompassMode:COMPASS_MODE_PLANET];
|
|
||||||
relativePosition = the_planet->position;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (reference == nil)
|
||||||
|
{
|
||||||
|
[player setCompassMode:COMPASS_MODE_PLANET];
|
||||||
|
reference = the_planet;
|
||||||
|
}
|
||||||
|
|
||||||
// translate and rotate the view
|
// translate and rotate the view
|
||||||
relativePosition = OOVectorMultiplyMatrix(vector_subtract(relativePosition, position), rotMatrix);
|
Vector relativePosition = vector_subtract([reference position], position);
|
||||||
|
relativePosition = OOVectorMultiplyMatrix(relativePosition, rotMatrix);
|
||||||
relativePosition = vector_normal_or_fallback(relativePosition, kBasisZVector);
|
relativePosition = vector_normal_or_fallback(relativePosition, kBasisZVector);
|
||||||
|
|
||||||
relativePosition.x *= siz.width * 0.4;
|
relativePosition.x *= siz.width * 0.4;
|
||||||
|
@ -64,7 +64,7 @@ static NSString * const kCacheKeyCaches = @"_caches";
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
kEndianTagValue = 0x12345678UL,
|
kEndianTagValue = 0x12345678UL,
|
||||||
kFormatVersionValue = 9
|
kFormatVersionValue = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ enum
|
|||||||
- (Vector) getSafeVectorFromEntity:(Entity *) e1 toDistance:(double)dist fromPoint:(Vector) p2;
|
- (Vector) getSafeVectorFromEntity:(Entity *) e1 toDistance:(double)dist fromPoint:(Vector) p2;
|
||||||
|
|
||||||
- (OOUniversalID) getFirstEntityHitByLaserFromEntity:(ShipEntity *)srcEntity inView:(OOViewID)viewdir offset:(Vector)offset rangeFound:(GLfloat*)range_ptr;
|
- (OOUniversalID) getFirstEntityHitByLaserFromEntity:(ShipEntity *)srcEntity inView:(OOViewID)viewdir offset:(Vector)offset rangeFound:(GLfloat*)range_ptr;
|
||||||
- (OOUniversalID) getFirstEntityTargettedByPlayer:(PlayerEntity *)player;
|
- (ShipEntity *) getFirstEntityTargettedByPlayer;
|
||||||
|
|
||||||
- (NSArray *) getEntitiesWithinRange:(double)range ofEntity:(Entity *)entity;
|
- (NSArray *) getEntitiesWithinRange:(double)range ofEntity:(Entity *)entity;
|
||||||
- (unsigned) countShipsWithRole:(NSString *)role inRange:(double)range ofEntity:(Entity *)entity;
|
- (unsigned) countShipsWithRole:(NSString *)role inRange:(double)range ofEntity:(Entity *)entity;
|
||||||
|
@ -4547,20 +4547,16 @@ static BOOL MaintainLinkedLists(Universe* uni)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (OOUniversalID) getFirstEntityTargettedByPlayer:(PlayerEntity*) player
|
- (ShipEntity *)getFirstEntityTargettedByPlayer
|
||||||
{
|
{
|
||||||
if ((!player)||(!player->isPlayer))
|
PlayerEntity *player = [PlayerEntity sharedPlayer];
|
||||||
return NO_TARGET;
|
ShipEntity *hit_entity = nil;
|
||||||
|
|
||||||
ShipEntity* hit_entity = nil;
|
|
||||||
|
|
||||||
int result = NO_TARGET;
|
|
||||||
double nearest = SCANNER_MAX_RANGE - 10; // 10m shorter than range at which target is lost
|
double nearest = SCANNER_MAX_RANGE - 10; // 10m shorter than range at which target is lost
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
int ent_count = n_entities;
|
int ent_count = n_entities;
|
||||||
int ship_count = 0;
|
int ship_count = 0;
|
||||||
Entity* my_entities[ent_count];
|
Entity *my_entities[ent_count];
|
||||||
|
|
||||||
for (i = 0; i < ent_count; i++)
|
for (i = 0; i < ent_count; i++)
|
||||||
if ((sortedEntities[i]->isShip)&&(sortedEntities[i] != player))
|
if ((sortedEntities[i]->isShip)&&(sortedEntities[i] != player))
|
||||||
my_entities[ship_count++] = [sortedEntities[i] retain]; // retained
|
my_entities[ship_count++] = [sortedEntities[i] retain]; // retained
|
||||||
@ -4617,16 +4613,13 @@ static BOOL MaintainLinkedLists(Universe* uni)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check for MASC'M
|
// check for MASC'M
|
||||||
if ((hit_entity) && [hit_entity isJammingScanning] && (![player hasMilitaryScannerFilter]))
|
if ((hit_entity) && [hit_entity isJammingScanning] && ![player hasMilitaryScannerFilter])
|
||||||
hit_entity = nil;
|
hit_entity = nil;
|
||||||
|
|
||||||
if (hit_entity)
|
|
||||||
result = [hit_entity universalID];
|
|
||||||
|
|
||||||
for (i = 0; i < ship_count; i++)
|
for (i = 0; i < ship_count; i++)
|
||||||
[my_entities[i] release]; // released
|
[my_entities[i] release]; // released
|
||||||
|
|
||||||
return result;
|
return hit_entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4923,15 +4916,17 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
|
|||||||
mouseDelta = NO;
|
mouseDelta = NO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef GNUSTEP
|
#if OOLITE_SDL
|
||||||
[gameView setMouseInDeltaMode: mouseDelta];
|
[gameView setMouseInDeltaMode: mouseDelta];
|
||||||
#endif
|
#endif
|
||||||
if ((viewDirection != vd)|(viewDirection = VIEW_CUSTOM))
|
if ((viewDirection != vd)|(viewDirection = VIEW_CUSTOM))
|
||||||
{
|
{
|
||||||
viewDirection = vd;
|
viewDirection = vd;
|
||||||
if (ms)
|
if (ms)
|
||||||
|
{
|
||||||
[self addMessage:ms forCount:3];
|
[self addMessage:ms forCount:3];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4943,7 +4938,35 @@ OOINLINE BOOL EntityInRange(Vector p1, Entity *e2, float range)
|
|||||||
|
|
||||||
- (NSString *) soundNameForCustomSoundKey:(NSString *)key;
|
- (NSString *) soundNameForCustomSoundKey:(NSString *)key;
|
||||||
{
|
{
|
||||||
return [customsounds stringForKey:key];
|
NSString *result = nil;
|
||||||
|
NSMutableSet *seen = nil;
|
||||||
|
|
||||||
|
result = [[OOCacheManager sharedCache] objectForKey:key inCache:@"resolved custom sounds"];
|
||||||
|
if (result == nil)
|
||||||
|
{
|
||||||
|
// Resolve sound, allowing indirection within customsounds.plist
|
||||||
|
seen = [NSMutableSet set];
|
||||||
|
result = key;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
[seen addObject:result];
|
||||||
|
result = [customsounds objectForKey:result];
|
||||||
|
if (result == nil || ![result hasPrefix:@"["] || ![result hasSuffix:@"]"]) break;
|
||||||
|
if ([seen containsObject:result])
|
||||||
|
{
|
||||||
|
OOLog(@"sounds.customSounds.recursion", @"***** ERROR: recursion in customsounds.plist for %@ (at %@), no sound will be played.", key, result);
|
||||||
|
result = nil;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == nil) result = @"__oolite-no-sound";
|
||||||
|
|
||||||
|
[[OOCacheManager sharedCache] setObject:result forKey:key inCache:@"resolved custom sounds"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ([result isEqualToString:@"__oolite-no-sound"]) result = nil;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user