aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/script
diff options
context:
space:
mode:
authorThomas Fach-Pedersen2015-02-06 15:31:43 +0100
committerEugene Sandulenko2016-09-29 22:33:37 +0200
commit74a8b530f196233b287c9775e9c80774c4811058 (patch)
tree8f18bad0598332da0c39528315dfb6866422f4f2 /engines/bladerunner/script
parentc8f5ded6d94863e3c1deb58961e543703bc934f8 (diff)
downloadscummvm-rg350-74a8b530f196233b287c9775e9c80774c4811058.tar.gz
scummvm-rg350-74a8b530f196233b287c9775e9c80774c4811058.tar.bz2
scummvm-rg350-74a8b530f196233b287c9775e9c80774c4811058.zip
BLADERUNNER: Add support for ambient sounds, game flags and variables, and use VQA z-buffer when rendering.
Diffstat (limited to 'engines/bladerunner/script')
-rw-r--r--engines/bladerunner/script/rc01.cpp131
-rw-r--r--engines/bladerunner/script/script.cpp89
-rw-r--r--engines/bladerunner/script/script.h36
3 files changed, 232 insertions, 24 deletions
diff --git a/engines/bladerunner/script/rc01.cpp b/engines/bladerunner/script/rc01.cpp
index 560eb24742..2fa577856f 100644
--- a/engines/bladerunner/script/rc01.cpp
+++ b/engines/bladerunner/script/rc01.cpp
@@ -22,35 +22,99 @@
#include "bladerunner/script/script.h"
+#include "bladerunner/ambient_sounds.h"
+#include "bladerunner/audio_player.h"
#include "bladerunner/bladerunner.h"
namespace BladeRunner {
void ScriptRC01::InitializeScene() {
- _vm->outtakePlay(28, true);
- _vm->outtakePlay(41, true);
- _vm->outtakePlay( 0, false);
-
- _vm->ISez("Blade Runner");
- _vm->ISez("");
- _vm->ISez("From the dark recesses of David Leary's imagination comes a game unlike any");
- _vm->ISez("other. Blade Runner immerses you in the underbelly of future Los Angeles. Right");
- _vm->ISez("from the start, the story pulls you in with graphic descriptions of a");
- _vm->ISez("grandmother doing the shimmy in her underwear, child molestation, brutal");
- _vm->ISez("cold-blooded slaying of innocent animals, vomiting on desks, staring at a");
- _vm->ISez("woman's ass, the list goes on. And when the game starts, the real fun begins -");
- _vm->ISez("shoot down-on-their-luck homeless people and toss them into a dumpster. Watch");
- _vm->ISez("with sadistic glee as a dog gets blown into chunky, bloody, bits by an");
- _vm->ISez("explosive, and even murder a shy little girl who loves you. If you think David");
- _vm->ISez("Leary is sick, and you like sick, this is THE game for you.");
- _vm->ISez("");
- _vm->ISez("JW: Don't forget the wasting of helpless mutated cripples in the underground.");
- _vm->ISez("It's such a beautiful thing!");
- _vm->ISez("");
- _vm->ISez("DL: Go ahead. Just keep beating that snarling pit bull...ignore the foam");
- _vm->ISez("around his jaws. There's room on the top shelf of my fridge for at least one");
- _vm->ISez("more head... - Psychotic Dave");
- _vm->ISez("");
+ if (!Game_Flag_Query(24)) {
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Looping_Sounds(1);
+ Outtake_Play(28, 1); // WSTLGO_E.VQA
+ Outtake_Play(41, 1); // BRLOGO_E.VQA
+ Outtake_Play( 0, 0); // INTRO_E.VQA
+ Outtake_Play(33, 1); // DSCENT_E.VQA
+ }
+
+ Game_Flag_Set(9); // Force flag 9 so McCoy will be in view
+ if (Game_Flag_Query(9)) {
+ Setup_Scene_Information(-171.16, 5.55, 27.28, 616);
+ } else if (Game_Flag_Query(114)) {
+ Setup_Scene_Information(-471.98, -0.30, 258.15, 616);
+ } else {
+ Setup_Scene_Information( -10.98, -0.30, 318.15, 616);
+ }
+
+ Scene_Exit_Add_2D_Exit(0, 314, 145, 340, 255, 0);
+ if (Game_Flag_Query(249))
+ Scene_Exit_Add_2D_Exit(1, 482, 226, 639, 280, 2);
+ if (Global_Variable_Query(1) > 1 && Game_Flag_Query(710))
+ Scene_Exit_Add_2D_Exit(2, 0, 0, 10, 479, 3);
+ if (!Game_Flag_Query(186))
+ Scene_2D_Region_Add(0, 0, 294, 296, 479);
+
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(0);
+ Ambient_Sounds_Add_Looping_Sound(54, 30, 0, 1); // CTRAIN1.AUD
+
+ if (!Game_Flag_Query(186)) {
+ Ambient_Sounds_Add_Sound(181, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0470R.AUD
+ Ambient_Sounds_Add_Sound(182, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0480R.AUD
+ Ambient_Sounds_Add_Sound(183, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0500R.AUD
+ Ambient_Sounds_Add_Sound(184, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0540R.AUD
+ Ambient_Sounds_Add_Sound(185, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0560R.AUD
+ Ambient_Sounds_Add_Sound(186, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0870R.AUD
+ Ambient_Sounds_Add_Sound(188, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0900R.AUD
+ Ambient_Sounds_Add_Sound(189, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0940R.AUD
+ Ambient_Sounds_Add_Sound(190, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_0960R.AUD
+ Ambient_Sounds_Add_Sound(191, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1070R.AUD
+ Ambient_Sounds_Add_Sound(192, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1080R.AUD
+ Ambient_Sounds_Add_Sound(193, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1100R.AUD
+ Ambient_Sounds_Add_Sound(194, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1140R.AUD
+ Ambient_Sounds_Add_Sound(195, 5, 70, 12, 12, -100, 100, -101, -101, 0, 0); // 67_1160R.AUD
+ }
+
+ Ambient_Sounds_Add_Looping_Sound(81, 60, 100, 1); // RCAMBR1.AUD
+ Ambient_Sounds_Add_Sound(82, 5, 30, 30, 50, -100, 100, -101, -101, 0, 0); // RCCARBY1.AUD
+ Ambient_Sounds_Add_Sound(83, 5, 30, 30, 55, -100, 100, -101, -101, 0, 0); // RCCARBY2.AUD
+ Ambient_Sounds_Add_Sound(84, 5, 30, 30, 50, -100, 100, -101, -101, 0, 0); // RCCARBY3.AUD
+ Ambient_Sounds_Add_Sound(67, 10, 50, 30, 50, -100, 100, -101, -101, 0, 0); // SPIN2A.AUD
+ Ambient_Sounds_Add_Sound(87, 20, 80, 20, 40, -100, 100, -101, -101, 0, 0); // SIREN2.AUD
+
+ if (Game_Flag_Query(186)) {
+ if (!Game_Flag_Query(9) && !Game_Flag_Query(114))
+ Scene_Loop_Start_Special(0, 5, 0);
+ if (Game_Flag_Query(249))
+ Scene_Loop_Set_Default(6);
+ else
+ Scene_Loop_Set_Default(10);
+ } else {
+ if (!Game_Flag_Query(9) && !Game_Flag_Query(114))
+ Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Set_Default(1);
+ }
+
+ I_Sez("Blade Runner");
+ I_Sez("");
+ I_Sez("From the dark recesses of David Leary's imagination comes a game unlike any");
+ I_Sez("other. Blade Runner immerses you in the underbelly of future Los Angeles. Right");
+ I_Sez("from the start, the story pulls you in with graphic descriptions of a");
+ I_Sez("grandmother doing the shimmy in her underwear, child molestation, brutal");
+ I_Sez("cold-blooded slaying of innocent animals, vomiting on desks, staring at a");
+ I_Sez("woman's ass, the list goes on. And when the game starts, the real fun begins -");
+ I_Sez("shoot down-on-their-luck homeless people and toss them into a dumpster. Watch");
+ I_Sez("with sadistic glee as a dog gets blown into chunky, bloody, bits by an");
+ I_Sez("explosive, and even murder a shy little girl who loves you. If you think David");
+ I_Sez("Leary is sick, and you like sick, this is THE game for you.");
+ I_Sez("");
+ I_Sez("JW: Don't forget the wasting of helpless mutated cripples in the underground.");
+ I_Sez("It's such a beautiful thing!");
+ I_Sez("");
+ I_Sez("DL: Go ahead. Just keep beating that snarling pit bull...ignore the foam");
+ I_Sez("around his jaws. There's room on the top shelf of my fridge for at least one");
+ I_Sez("more head... - Psychotic Dave");
+ I_Sez("");
}
void ScriptRC01::SceneLoaded() {
@@ -58,7 +122,26 @@ void ScriptRC01::SceneLoaded() {
}
void ScriptRC01::SceneFrameAdvanced(int frame) {
+ if (frame == 1)
+ Sound_Play(118, 40, 0, 0, 50); // CARDOWN3.AUD
+
+ if (frame == 61 || frame == 362)
+ Sound_Play(116, 100, 80, 80, 50); // SPINOPN4.AUD
+
+ if (frame == 108 || frame == 409)
+ Sound_Play(119, 100, 80, 80, 50); // SPINCLS1.AUD
+
+ if (frame == 183 || frame == 484)
+ Sound_Play(116, 100, 80, 80, 50); // SPINOPN4.AUD
+
+ if (frame == 228 || frame == 523)
+ Sound_Play(119, 100, 80, 80, 50); // SPINCLS1.AUD
+
+ if (frame == 243 || frame == 545)
+ Sound_Play(117, 40, 80, 80, 50); // CARUP3.AUD
+ if (frame == 315)
+ Sound_Play(118, 40, 80, 80, 50); // CARDOWN3.AUD
}
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 540d4313c7..9aca48fcf6 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -24,6 +24,13 @@
#include "bladerunner/bladerunner.h"
+#include "bladerunner/ambient_sounds.h"
+#include "bladerunner/audio_player.h"
+#include "bladerunner/gameinfo.h"
+#include "bladerunner/gameflags.h"
+#include "bladerunner/scene.h"
+#include "bladerunner/vector.h"
+
namespace BladeRunner {
bool Script::open(const Common::String &name) {
@@ -56,4 +63,86 @@ void Script::SceneFrameAdvanced(int frame) {
_inScriptCounter--;
}
+void ScriptBase::Game_Flag_Set(int flag) {
+ _vm->_gameFlags->set(flag);
+}
+
+void ScriptBase::Game_Flag_Reset(int flag) {
+ _vm->_gameFlags->reset(flag);
+}
+
+bool ScriptBase::Game_Flag_Query(int flag) {
+ return _vm->_gameFlags->query(flag);
+}
+
+int ScriptBase::Global_Variable_Set(int var, int value) {
+ return _vm->_gameVars[var] = value;
+}
+
+int ScriptBase::Global_Variable_Reset(int var) {
+ return _vm->_gameVars[var] = 0;
+}
+
+int ScriptBase::Global_Variable_Query(int var) {
+ return _vm->_gameVars[var];
+}
+
+int ScriptBase::Global_Variable_Increment(int var, int inc) {
+ return _vm->_gameVars[var] += inc;
+}
+
+int ScriptBase::Global_Variable_Decrement(int var, int dec) {
+ return _vm->_gameVars[var] -= dec;
+}
+
+void ScriptBase::Sound_Play(int id, int volume, int panFrom, int panTo, int priority) {
+ const char *name = _vm->_gameInfo->getSfxTrack(id);
+ _vm->_audioPlayer->playAud(name, volume, panFrom, panTo, priority);
+}
+
+void ScriptBase::Scene_Loop_Set_Default(int a) {
+ debug("Scene_Loop_Set_Default(%d)", a);
+}
+
+void ScriptBase::Scene_Loop_Start_Special(int a, int b, int c) {
+ debug("Scene_Loop_Start_Special(%d, %d, %d)", a, b, c);
+}
+
+void ScriptBase::Outtake_Play(int id, int noLocalization, int container) {
+ _vm->outtakePlay(id, noLocalization, container);
+}
+
+void ScriptBase::Ambient_Sounds_Add_Sound(int id, int time1, int time2, int volume1, int volume2, int pan1begin, int pan1end, int pan2begin, int pan2end, int priority, int unk) {
+ _vm->_ambientSounds->addSound(id, time1, time2, volume1, volume2, pan1begin, pan1end, pan2begin, pan2end, priority, unk);
+}
+
+void ScriptBase::Ambient_Sounds_Remove_All_Non_Looping_Sounds(int time) {
+ // _vm->_ambientSounds->removeAllNonLoopingSounds(time);
+}
+
+void ScriptBase::Ambient_Sounds_Add_Looping_Sound(int id, int volume, int pan, int fadeInTime) {
+ _vm->_ambientSounds->addLoopingSound(id, volume, pan, fadeInTime);
+}
+
+void ScriptBase::Ambient_Sounds_Remove_All_Looping_Sounds(int time) {
+ // _vm->_ambientSounds->removeAllLoopingSounds(time);
+}
+
+void ScriptBase::Setup_Scene_Information(float actorX, float actorY, float actorZ, int actorFacing) {
+ _vm->_scene->setActorStart(Vector3(actorX, actorY, actorZ), actorFacing);
+}
+
+void ScriptBase::Scene_Exit_Add_2D_Exit(int a, int b, int c, int d, int e, int f) {
+ debug("Scene_Exit_Add_2D_Exit(%d, %d, %d, %d, %d, %d)", a, b, c, d, e, f);
+}
+
+void ScriptBase::Scene_2D_Region_Add(int a, int b, int c, int d, int e) {
+ debug("Scene_2D_Region_Add(%d, %d, %d, %d, %d)", a, b, c, d, e);
+}
+
+void ScriptBase::I_Sez(const char *str) {
+ _vm->ISez(str);
+}
+
+
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h
index 83fd78dc39..e8bf1c029e 100644
--- a/engines/bladerunner/script/script.h
+++ b/engines/bladerunner/script/script.h
@@ -65,6 +65,42 @@ public:
virtual void InitializeScene() = 0;
virtual void SceneLoaded() = 0;
virtual void SceneFrameAdvanced(int frame) = 0;
+
+protected:
+
+ void Game_Flag_Set(int flag);
+ void Game_Flag_Reset(int flag);
+ bool Game_Flag_Query(int flag);
+
+ int Global_Variable_Set(int, int);
+ int Global_Variable_Reset(int);
+ int Global_Variable_Query(int);
+ int Global_Variable_Increment(int, int);
+ int Global_Variable_Decrement(int, int);
+
+ void Sound_Play(int id, int volume, int panFrom, int panTo, int priority);
+
+ void Scene_Loop_Set_Default(int);
+ void Scene_Loop_Start_Special(int, int, int);
+
+ void Outtake_Play(int id, int noLocalization = false, int container = -1);
+ void Ambient_Sounds_Add_Sound(int id, int time1, int time2, int volume1, int volume2, int pan1begin, int pan1end, int pan2begin, int pan2end, int priority, int unk);
+ // Ambient_Sounds_Remove_Sound
+ // Ambient_Sounds_Add_Speech_Sound
+ // Ambient_Sounds_Remove_Speech_Sound
+ // Ambient_Sounds_Play_Sound
+ // Ambient_Sounds_Play_Speech_Sound
+ void Ambient_Sounds_Remove_All_Non_Looping_Sounds(int time);
+ void Ambient_Sounds_Add_Looping_Sound(int id, int volume, int pan, int fadeInTime);
+ // Ambient_Sounds_Adjust_Looping_Sound
+ // Ambient_Sounds_Remove_Looping_Sound
+ void Ambient_Sounds_Remove_All_Looping_Sounds(int time);
+ void Setup_Scene_Information(float actorX, float actorY, float actorZ, int actorFacing);
+
+ void Scene_Exit_Add_2D_Exit(int, int, int, int, int, int);
+ void Scene_2D_Region_Add(int, int, int, int, int);
+
+ void I_Sez(const char *str);
};
#define DECLARE_SCRIPT(name) \