aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner
diff options
context:
space:
mode:
authorPeter Kohaut2017-09-10 20:19:02 +0200
committerPeter Kohaut2017-09-10 20:55:30 +0200
commitf79d8cc1fe852e6172519efc51c75449dfc7c8f1 (patch)
tree4e02ac28680977b4a1a8868e2f1e58b302bf93a9 /engines/bladerunner
parente0aa906804942c04db6b3febed159846b7bcfb51 (diff)
downloadscummvm-rg350-f79d8cc1fe852e6172519efc51c75449dfc7c8f1.tar.gz
scummvm-rg350-f79d8cc1fe852e6172519efc51c75449dfc7c8f1.tar.bz2
scummvm-rg350-f79d8cc1fe852e6172519efc51c75449dfc7c8f1.zip
BLADERUNNER: Added music support & added Maggie
added async walking named some of the game flags & variables renamed aesc to screen effects
Diffstat (limited to 'engines/bladerunner')
-rw-r--r--engines/bladerunner/actor.cpp53
-rw-r--r--engines/bladerunner/actor.h2
-rw-r--r--engines/bladerunner/aud_stream.cpp6
-rw-r--r--engines/bladerunner/audio_mixer.cpp60
-rw-r--r--engines/bladerunner/audio_mixer.h12
-rw-r--r--engines/bladerunner/audio_player.cpp16
-rw-r--r--engines/bladerunner/audio_player.h14
-rw-r--r--engines/bladerunner/audio_speech.cpp2
-rw-r--r--engines/bladerunner/bladerunner.cpp88
-rw-r--r--engines/bladerunner/bladerunner.h15
-rw-r--r--engines/bladerunner/module.mk8
-rw-r--r--engines/bladerunner/mouse.cpp9
-rw-r--r--engines/bladerunner/music.cpp229
-rw-r--r--engines/bladerunner/music.h86
-rw-r--r--engines/bladerunner/overlays.cpp20
-rw-r--r--engines/bladerunner/overlays.h2
-rw-r--r--engines/bladerunner/scene.cpp11
-rw-r--r--engines/bladerunner/scene.h7
-rw-r--r--engines/bladerunner/screen_effects.cpp (renamed from engines/bladerunner/aesc.cpp)12
-rw-r--r--engines/bladerunner/screen_effects.h (renamed from engines/bladerunner/aesc.h)12
-rw-r--r--engines/bladerunner/script/ai.cpp15
-rw-r--r--engines/bladerunner/script/ai.h16
-rw-r--r--engines/bladerunner/script/ai/leon.cpp8
-rw-r--r--engines/bladerunner/script/ai/maggie.cpp634
-rw-r--r--engines/bladerunner/script/ai/mccoy.cpp4
-rw-r--r--engines/bladerunner/script/ai/officer_leary.cpp2
-rw-r--r--engines/bladerunner/script/ai/runciter.cpp2
-rw-r--r--engines/bladerunner/script/scene.h10
-rw-r--r--engines/bladerunner/script/scene/bb02.cpp4
-rw-r--r--engines/bladerunner/script/scene/ct02.cpp8
-rw-r--r--engines/bladerunner/script/scene/dr04.cpp4
-rw-r--r--engines/bladerunner/script/scene/hc03.cpp4
-rw-r--r--engines/bladerunner/script/scene/hf04.cpp4
-rw-r--r--engines/bladerunner/script/scene/hf05.cpp2
-rw-r--r--engines/bladerunner/script/scene/hf06.cpp2
-rw-r--r--engines/bladerunner/script/scene/kp03.cpp8
-rw-r--r--engines/bladerunner/script/scene/ma01.cpp72
-rw-r--r--engines/bladerunner/script/scene/ma02.cpp41
-rw-r--r--engines/bladerunner/script/scene/ma04.cpp46
-rw-r--r--engines/bladerunner/script/scene/ma05.cpp10
-rw-r--r--engines/bladerunner/script/scene/ma06.cpp59
-rw-r--r--engines/bladerunner/script/scene/ma07.cpp8
-rw-r--r--engines/bladerunner/script/scene/nr08.cpp2
-rw-r--r--engines/bladerunner/script/scene/nr10.cpp2
-rw-r--r--engines/bladerunner/script/scene/nr11.cpp4
-rw-r--r--engines/bladerunner/script/scene/ps05.cpp27
-rw-r--r--engines/bladerunner/script/scene/rc01.cpp240
-rw-r--r--engines/bladerunner/script/scene/tb07.cpp2
-rw-r--r--engines/bladerunner/script/scene/ug01.cpp2
-rw-r--r--engines/bladerunner/script/scene/ug10.cpp6
-rw-r--r--engines/bladerunner/script/scene/ug13.cpp4
-rw-r--r--engines/bladerunner/script/scene/ug15.cpp2
-rw-r--r--engines/bladerunner/script/script.cpp111
-rw-r--r--engines/bladerunner/script/script.h36
-rw-r--r--engines/bladerunner/settings.cpp9
-rw-r--r--engines/bladerunner/slice_renderer.cpp8
-rw-r--r--engines/bladerunner/slice_renderer.h6
-rw-r--r--engines/bladerunner/vqa_decoder.cpp30
-rw-r--r--engines/bladerunner/vqa_decoder.h10
-rw-r--r--engines/bladerunner/vqa_player.cpp4
-rw-r--r--engines/bladerunner/vqa_player.h2
61 files changed, 1622 insertions, 512 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index c29956ca8b..3877947923 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -333,20 +333,6 @@ void Actor::movementTrackWaypointReached() {
}
}
-bool Actor::loopWalkToActor(int otherActorId, int destinationOffset, int a3, bool run, bool a5, bool *flagIsRunning) {
- return loopWalk(_vm->_actors[otherActorId]->_position, destinationOffset, a3, run, _position, 24.0f, 24.0f, a5, flagIsRunning, false);
-}
-
-bool Actor::loopWalkToItem(int itemId, int destinationOffset, int a3, bool run, bool a5, bool *flagIsRunning) {
- float x, y, z;
- int width, height;
- _vm->_items->getXYZ(itemId, &x, &y, &z);
- _vm->_items->getWidthHeight(itemId, &width, &height);
- Vector3 itemPosition(x, y, z);
-
- return loopWalk(itemPosition, destinationOffset, a3, run, _position, width, 24.0f, a5, flagIsRunning, false);
-}
-
void Actor::setAtXYZ(const Vector3 &position, int facing, bool snapFacing, bool moving, bool retired) {
_position = position;
setFacing(facing, snapFacing);
@@ -378,12 +364,19 @@ bool Actor::loopWalk(const Vector3 &destination, int destinationOffset, bool a3,
bool arrived;
_walkInfo->setup(_id, false, _position, destination, false, &arrived);
- for (;;) {
+ if (async) {
+ return false;
+ }
+ while (true) {
_vm->gameTick();
if (!_walkInfo->isWalking() && !_walkInfo->isRunning())
+ {
break;
+ }
if (!_vm->_gameIsRunning)
+ {
break;
+ }
}
return false;
} else {
@@ -481,8 +474,18 @@ bool Actor::walkTo(bool run, const Vector3 &destination, bool a3) {
return _walkInfo->setup(_id, run, _position, destination, a3, &arrived);
}
-bool Actor::loopWalkToXYZ(const Vector3 &destination, int destinationOffset, bool a3, bool run, bool a5, bool *flagIsRunning) {
- return loopWalk(destination, destinationOffset, a3, run, _position, 0.0f, 24.0f, a5, flagIsRunning, false);
+bool Actor::loopWalkToActor(int otherActorId, int destinationOffset, int a3, bool run, bool a5, bool *flagIsRunning) {
+ return loopWalk(_vm->_actors[otherActorId]->_position, destinationOffset, a3, run, _position, 24.0f, 24.0f, a5, flagIsRunning, false);
+}
+
+bool Actor::loopWalkToItem(int itemId, int destinationOffset, int a3, bool run, bool a5, bool *flagIsRunning) {
+ float x, y, z;
+ int width, height;
+ _vm->_items->getXYZ(itemId, &x, &y, &z);
+ _vm->_items->getWidthHeight(itemId, &width, &height);
+ Vector3 itemPosition(x, y, z);
+
+ return loopWalk(itemPosition, destinationOffset, a3, run, _position, width, 24.0f, a5, flagIsRunning, false);
}
bool Actor::loopWalkToSceneObject(const char *objectName, int destinationOffset, bool a3, bool run, bool a5, bool *flagIsRunning) {
@@ -536,6 +539,22 @@ bool Actor::loopWalkToWaypoint(int waypointId, int destinationOffset, int a3, bo
return loopWalk(waypointPosition, destinationOffset, a3, run, _position, 0.0f, 24.0f, a5, flagIsRunning, false);
}
+bool Actor::loopWalkToXYZ(const Vector3 &destination, int destinationOffset, bool a3, bool run, bool a5, bool *flagIsRunning) {
+ return loopWalk(destination, destinationOffset, a3, run, _position, 0.0f, 24.0f, a5, flagIsRunning, false);
+}
+
+bool Actor::asyncWalkToWaypoint(int waypointId, int destinationOffset, bool run, bool a5) {
+ bool flagIsRunning;
+ Vector3 waypointPosition;
+ _vm->_waypoints->getXYZ(waypointId, &waypointPosition.x, &waypointPosition.y, &waypointPosition.z);
+ return loopWalk(waypointPosition, destinationOffset, false, run, _position, 0.0f, 24.0f, a5, &flagIsRunning, true);
+}
+
+void Actor::asyncWalkToXYZ(const Vector3 &destination, int destinationOffset, bool run, int a6) {
+ bool flagIsRunning;
+ loopWalk(destination, destinationOffset, false, run, _position, 0.0f, 24.0f, a6, &flagIsRunning, true);
+}
+
bool Actor::tick(bool forceDraw, Common::Rect *screenRect) {
int remain = 0;
bool needsUpdate = false;
diff --git a/engines/bladerunner/actor.h b/engines/bladerunner/actor.h
index 0ff4723c9d..8c426bde68 100644
--- a/engines/bladerunner/actor.h
+++ b/engines/bladerunner/actor.h
@@ -147,6 +147,8 @@ public:
bool loopWalkToSceneObject(const char *objectName, int destinationOffset, bool a3, bool run, bool a5, bool *flagIsRunning);
bool loopWalkToWaypoint(int waypointId, int destinationOffset, int a3, bool run, bool a5, bool *flagIsRunning);
bool loopWalkToXYZ(const Vector3 &destination, int destinationOffset, bool a3, bool run, bool a5, bool *flagIsRunning);
+ bool asyncWalkToWaypoint(int waypointId, int destinationOffset, bool run, bool a5);
+ void asyncWalkToXYZ(const Vector3 &destination, int destinationOffset, bool run, int a6);
bool tick(bool forceUpdate, Common::Rect *screenRect);
bool draw(Common::Rect *screenRect);
diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp
index c74421bbd0..6e7152a848 100644
--- a/engines/bladerunner/aud_stream.cpp
+++ b/engines/bladerunner/aud_stream.cpp
@@ -55,8 +55,9 @@ void AudStream::init(byte *data) {
}
AudStream::~AudStream() {
- if (_cache)
+ if (_cache) {
_cache->decRef(_hash);
+ }
}
int AudStream::readBuffer(int16 *buffer, const int numSamples) {
@@ -117,8 +118,7 @@ bool AudStream::rewind() {
return true;
}
-int AudStream::getLength()
-{
+int AudStream::getLength() {
int bytesPerSecond = _frequency;
if (_flags & 1) { // 16 bit
bytesPerSecond *= 2;
diff --git a/engines/bladerunner/audio_mixer.cpp b/engines/bladerunner/audio_mixer.cpp
index 0bd7b04b89..d9d04e65d9 100644
--- a/engines/bladerunner/audio_mixer.cpp
+++ b/engines/bladerunner/audio_mixer.cpp
@@ -30,29 +30,30 @@
#include "common/timer.h"
namespace BladeRunner {
+
AudioMixer::AudioMixer(BladeRunnerEngine *vm):
_vm(vm)
{
- for (int i = 0; i < kAudioMixerChannels; i++) {
+ for (int i = 0; i < kChannels; i++) {
_channels[i].isPresent = false;
}
- _vm->getTimerManager()->installTimerProc(timerCallback, 25 * 1000 , this, "BladeRunnerAudioMixerTimer");
+ _vm->getTimerManager()->installTimerProc(timerCallback, (1000 / kUpdatesPerSecond) * 1000 , this, "BladeRunnerAudioMixerTimer");
}
AudioMixer::~AudioMixer() {
- for (int i = 0; i < kAudioMixerChannels; i++) {
+ for (int i = 0; i < kChannels; i++) {
stop(i, 0);
}
_vm->getTimerManager()->removeTimerProc(timerCallback);
}
-int AudioMixer::playStream(Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void (*endCallback)(int, void*), void *callbackData) {
+int AudioMixer::play(Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void (*endCallback)(int, void*), void *callbackData) {
Common::StackLock lock(_mutex);
int channel = -1;
int lowestPriority = 1000000;
int lowestPriorityChannel = -1;
- for (int i = 0; i < kAudioMixerChannels; i++) {
+ for (int i = 0; i < kUsableChannels; i++) {
if (!_channels[i].isPresent) {
channel = i;
break;
@@ -70,6 +71,32 @@ int AudioMixer::playStream(Audio::Mixer::SoundType type, Audio::RewindableAudioS
channel = lowestPriorityChannel;
}
+ return playInChannel(channel, type, stream, priority, loop, volume, pan, endCallback, callbackData);
+}
+
+int AudioMixer::playMusic(Audio::RewindableAudioStream *stream, int volume, void(*endCallback)(int, void *), void *callbackData) {
+ Common::StackLock lock(_mutex);
+
+ return playInChannel(kMusicChannel, Audio::Mixer::kMusicSoundType, stream, 100, false, volume, 0, endCallback, callbackData);
+}
+
+void AudioMixer::stop(int channel, int time) {
+ Common::StackLock lock(_mutex);
+
+ if (_channels[channel].isPresent) {
+ if (time) {
+ adjustVolume(channel, 0, time);
+ } else {
+ _channels[channel].isPresent = false;
+ _vm->_mixer->stopHandle(_channels[channel].handle);
+ if (_channels[channel].endCallback != nullptr) {
+ _channels[channel].endCallback(channel, _channels[channel].callbackData);
+ }
+ }
+ }
+}
+
+int AudioMixer::playInChannel(int channel, Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void(*endCallback)(int, void *), void *callbackData) {
_channels[channel].isPresent = true;
_channels[channel].stream = stream;
_channels[channel].priority = priority;
@@ -83,7 +110,6 @@ int AudioMixer::playStream(Audio::Mixer::SoundType type, Audio::RewindableAudioS
_channels[channel].endCallback = endCallback;
_channels[channel].callbackData = callbackData;
-
Audio::AudioStream* audioStream = stream;
if (loop) {
@@ -101,22 +127,6 @@ int AudioMixer::playStream(Audio::Mixer::SoundType type, Audio::RewindableAudioS
return channel;
}
-void AudioMixer::stop(int channel, int time) {
- Common::StackLock lock(_mutex);
-
- if (_channels[channel].isPresent) {
- if (time) {
- adjustVolume(channel, 0, time);
- } else {
- _channels[channel].isPresent = false;
- _vm->_mixer->stopHandle(_channels[channel].handle);
- if (_channels[channel].endCallback != nullptr) {
- _channels[channel].endCallback(channel, _channels[channel].callbackData);
- }
- }
- }
-}
-
bool AudioMixer::isActive(int channel) {
Common::StackLock lock(_mutex);
@@ -133,7 +143,7 @@ void AudioMixer::adjustVolume(int channel, int newVolume, int time)
if (_channels[channel].isPresent) {
_channels[channel].volumeTarget = newVolume;
- _channels[channel].volumeDelta = ((newVolume - _channels[channel].volume) / (time / 60.0f)) / 40.0f;
+ _channels[channel].volumeDelta = ((newVolume - _channels[channel].volume) / (time / 60.0f)) / (float)kUpdatesPerSecond;
}
}
@@ -144,7 +154,7 @@ void AudioMixer::adjustPan(int channel, int newPan, int time)
if (_channels[channel].isPresent) {
newPan = CLIP(newPan, -100, 100);
_channels[channel].panTarget = newPan;
- _channels[channel].panDelta = ((newPan - _channels[channel].pan) / (time / 60.0f)) / 40.0f;
+ _channels[channel].panDelta = ((newPan - _channels[channel].pan) / (time / 60.0f)) / (float)kUpdatesPerSecond;
}
}
@@ -152,7 +162,7 @@ void AudioMixer::tick()
{
Common::StackLock lock(_mutex);
- for (int i = 0; i < kAudioMixerChannels; i++) {
+ for (int i = 0; i < kChannels; i++) {
Channel *channel = &_channels[i];
if (!channel->isPresent) {
continue;
diff --git a/engines/bladerunner/audio_mixer.h b/engines/bladerunner/audio_mixer.h
index 75a0f08201..a221e681ec 100644
--- a/engines/bladerunner/audio_mixer.h
+++ b/engines/bladerunner/audio_mixer.h
@@ -33,7 +33,10 @@ namespace BladeRunner {
class BladeRunnerEngine;
class AudioMixer {
- static const int kAudioMixerChannels = 9;
+ static const int kChannels = 9;
+ static const int kUsableChannels = 8;
+ static const int kMusicChannel = 8;
+ static const int kUpdatesPerSecond = 40;
struct Channel {
bool isPresent;
@@ -53,14 +56,15 @@ class AudioMixer {
BladeRunnerEngine *_vm;
- Channel _channels[kAudioMixerChannels];
+ Channel _channels[kChannels];
Common::Mutex _mutex;
public:
AudioMixer(BladeRunnerEngine *vm);
~AudioMixer();
- int playStream(Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void(*onEndCallback)(int, void *), void *callbackData);
+ int play(Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void(*endCallback)(int, void *), void *callbackData);
+ int playMusic(Audio::RewindableAudioStream *stream, int volume, void(*endCallback)(int, void *), void *callbackData);
void stop(int channel, int delay);
void adjustVolume(int channel, int newVolume, int time);
@@ -70,6 +74,8 @@ public:
void pause(int channel, int delay);
private:
+ int playInChannel(int channel, Audio::Mixer::SoundType type, Audio::RewindableAudioStream *stream, int priority, bool loop, int volume, int pan, void(*endCallback)(int, void *), void *callbackData);
+
bool isActive(int channel);
void tick();
static void timerCallback(void *refCon);
diff --git a/engines/bladerunner/audio_player.cpp b/engines/bladerunner/audio_player.cpp
index f5ba83c4b3..1e459e9b86 100644
--- a/engines/bladerunner/audio_player.cpp
+++ b/engines/bladerunner/audio_player.cpp
@@ -130,6 +130,9 @@ AudioPlayer::AudioPlayer(BladeRunnerEngine *vm) : _vm(vm) {
for (int i = 0; i != 6; ++i) {
_tracks[i].hash = 0;
_tracks[i].priority = 0;
+ _tracks[i].isActive = false;
+ _tracks[i].channel = -1;
+ _tracks[i].stream = nullptr;
}
_sfxVolume = 65;
@@ -174,12 +177,6 @@ void AudioPlayer::adjustPan(int track, int pan, int delay) {
_vm->_audioMixer->adjustPan(_tracks[track].channel, pan, 60 * delay);
}
-//void AudioPlayer::tick() {
-// for (int i = 0; i != 6; ++i) {
-// Track *ti = &_tracks[i];
-// }
-//}
-
void AudioPlayer::remove(int channel) {
Common::StackLock lock(_mutex);
for (int i = 0; i != kTracks; ++i) {
@@ -187,7 +184,7 @@ void AudioPlayer::remove(int channel) {
_tracks[i].isActive = false;
_tracks[i].priority = 0;
_tracks[i].channel = -1;
- //_cache->decRef(_tracks[i].hash);
+ _tracks[i].stream = nullptr;
break;
}
}
@@ -257,7 +254,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
// debug("PlayStream: %s", name.c_str());
- int channel = _vm->_audioMixer->playStream(
+ int channel = _vm->_audioMixer->play(
Audio::Mixer::kPlainSoundType,
audioStream,
priority,
@@ -268,6 +265,8 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
this);
if (channel == -1) {
+ delete audioStream;
+ _cache->decRef(hash);
return -1;
}
@@ -280,6 +279,7 @@ int AudioPlayer::playAud(const Common::String &name, int volume, int panFrom, in
_tracks[track].priority = priority;
_tracks[track].hash = hash;
_tracks[track].volume = actualVolume;
+ _tracks[track].stream = audioStream;
return track;
}
diff --git a/engines/bladerunner/audio_player.h b/engines/bladerunner/audio_player.h
index c573c64840..4934b43871 100644
--- a/engines/bladerunner/audio_player.h
+++ b/engines/bladerunner/audio_player.h
@@ -26,6 +26,7 @@
#include "common/array.h"
#include "common/mutex.h"
#include "common/str.h"
+#include "audio/audiostream.h"
namespace BladeRunner {
@@ -72,12 +73,13 @@ class AudioPlayer {
static const int kTracks = 6;
struct Track {
- bool isActive;
- int channel;
- int priority;
- int32 hash;
- int volume;
- int pan;
+ bool isActive;
+ int channel;
+ int priority;
+ int32 hash;
+ int volume;
+ int pan;
+ Audio::AudioStream *stream;
Track() : isActive(false) {}
};
diff --git a/engines/bladerunner/audio_speech.cpp b/engines/bladerunner/audio_speech.cpp
index 7177cf0f9c..90fc213f2d 100644
--- a/engines/bladerunner/audio_speech.cpp
+++ b/engines/bladerunner/audio_speech.cpp
@@ -82,7 +82,7 @@ bool AudioSpeech::playSpeech(const char *name, int pan) {
// TODO: shorty mode - set rate of sound to 33khz
- _channel = _vm->_audioMixer->playStream(
+ _channel = _vm->_audioMixer->play(
Audio::Mixer::kSpeechSoundType,
audioStream,
100,
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index 121ad8128e..1d29bde75f 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -24,7 +24,6 @@
#include "bladerunner/actor.h"
#include "bladerunner/adq.h"
-#include "bladerunner/aesc.h"
#include "bladerunner/ambient_sounds.h"
#include "bladerunner/audio_mixer.h"
#include "bladerunner/audio_player.h"
@@ -42,12 +41,14 @@
#include "bladerunner/items.h"
#include "bladerunner/lights.h"
#include "bladerunner/mouse.h"
+#include "bladerunner/music.h"
#include "bladerunner/outtake.h"
#include "bladerunner/obstacles.h"
#include "bladerunner/overlays.h"
#include "bladerunner/regions.h"
#include "bladerunner/scene.h"
#include "bladerunner/scene_objects.h"
+#include "bladerunner/screen_effects.h"
#include "bladerunner/script/init.h"
#include "bladerunner/script/scene.h"
#include "bladerunner/script/ai.h"
@@ -86,7 +87,7 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst)
_sceneScript = new SceneScript(this);
_settings = new Settings(this);
_lights = new Lights(this);
- _aesc = new AESC(this, 0x8000);
+ _screenEffects = new ScreenEffects(this, 0x8000);
_combat = new Combat(this);
_adq = new ADQ(this);
_obstacles = new Obstacles(this);
@@ -126,7 +127,7 @@ BladeRunnerEngine::~BladeRunnerEngine() {
delete _obstacles;
delete _adq;
delete _combat;
- delete _aesc;
+ delete _screenEffects;
delete _lights;
delete _settings;
delete _sceneScript;
@@ -219,7 +220,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_audioPlayer = new AudioPlayer(this);
- // TODO: Audio: Music
+ _music = new Music(this);
_audioSpeech = new AudioSpeech(this);
@@ -341,7 +342,7 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
}
_sliceRenderer = new SliceRenderer(this);
- _sliceRenderer->setAESC(_aesc);
+ _sliceRenderer->setScreenEffects(_screenEffects);
_crimesDatabase = new CrimesDatabase(this, "CLUES", _gameInfo->getClueCount());
@@ -376,6 +377,7 @@ void BladeRunnerEngine::initChapterAndScene() {
_settings->setChapter(1);
_settings->setNewSetAndScene(_gameInfo->getInitialSetId(), _gameInfo->getInitialSceneId());
+// _settings->setNewSetAndScene(52, 52);
}
void BladeRunnerEngine::shutdown() {
@@ -435,29 +437,38 @@ void BladeRunnerEngine::shutdown() {
delete _textOptions;
_textOptions = nullptr;
- // TODO: Delete dialogue menu
+ delete _dialogueMenu;
+ _dialogueMenu = nullptr;
delete _ambientSounds;
+ _ambientSounds = nullptr;
delete _overlays;
_overlays = nullptr;
delete _audioSpeech;
+ _audioSpeech = nullptr;
- // TODO: Delete Audio: Music
+ delete _music;
+ _music = nullptr;
delete _audioPlayer;
+ _audioPlayer = nullptr;
delete _audioMixer;
+ _audioMixer = nullptr;
- if (isArchiveOpen("MUSIC.MIX"))
+ if (isArchiveOpen("MUSIC.MIX")) {
closeArchive("MUSIC.MIX");
+ }
- if (isArchiveOpen("SFX.MIX"))
+ if (isArchiveOpen("SFX.MIX")) {
closeArchive("SFX.MIX");
+ }
- if (isArchiveOpen("SPCHSFX.TLK"))
+ if (isArchiveOpen("SPCHSFX.TLK")) {
closeArchive("SPCHSFX.TLK");
+ }
if (_mainFont) {
_mainFont->close();
@@ -528,8 +539,9 @@ void BladeRunnerEngine::shutdown() {
_surfaceInterface.free();
_surfaceGame.free();
- if (isArchiveOpen("STARTUP.MIX"))
+ if (isArchiveOpen("STARTUP.MIX")) {
closeArchive("STARTUP.MIX");
+ }
// TODO: Delete MIXArchives here
@@ -538,8 +550,9 @@ void BladeRunnerEngine::shutdown() {
bool BladeRunnerEngine::loadSplash() {
Image img(this);
- if (!img.open("SPLASH.IMG"))
+ if (!img.open("SPLASH.IMG")) {
return false;
+ }
img.copyToSurface(&_surfaceGame);
@@ -666,7 +679,11 @@ void BladeRunnerEngine::gameTick() {
int setId = _scene->getSetId();
for (int i = 0, end = _gameInfo->getActorCount(); i != end; ++i) {
if (_actors[i]->getSetId() == setId) {
- if (i == 0 || i == 15 || i == 23) { // Currently limited to McCoy, Runciter and Officer Leroy
+ // TODO: remove this limitation
+ if (i == kActorMcCoy
+ || i == kActorRunciter
+ || i == kActorOfficerLeary
+ || i == kActorMaggie) {
Common::Rect screenRect;
if (_actors[i]->tick(backgroundChanged, &screenRect)) {
_zbuffer->mark(screenRect);
@@ -811,8 +828,8 @@ void BladeRunnerEngine::gameTick() {
#endif
#if 0
//draw aesc
- for (uint i = 0; i < _aesc->_entries.size(); i++) {
- AESC::Entry &entry = _aesc->_entries[i];
+ for (uint i = 0; i < _screenEffects->_entries.size(); i++) {
+ ScreenEffects::Entry &entry = _screenEffects->_entries[i];
int j = 0;
for (int y = 0; y < entry.height; y++) {
for (int x = 0; x < entry.width; x++) {
@@ -930,13 +947,13 @@ void BladeRunnerEngine::handleMouseAction(int x, int y, bool buttonLeft, bool bu
}
if (buttonLeft && !buttonDown) {
- Vector3 mousePosition = _mouse->getXYZ(x, y);
+ Vector3 scenePosition = _mouse->getXYZ(x, y);
int isClickable;
int isObstacle;
int isTarget;
- int sceneObjectId = _sceneObjects->findByXYZ(&isClickable, &isObstacle, &isTarget, mousePosition.x, mousePosition.y, mousePosition.z, true, false, true);
+ int sceneObjectId = _sceneObjects->findByXYZ(&isClickable, &isObstacle, &isTarget, scenePosition.x, scenePosition.y, scenePosition.z, true, false, true);
int exitIndex = _scene->_exits->getRegionAtXY(x, y);
if ((sceneObjectId < 0 || sceneObjectId > 73) && exitIndex >= 0) {
@@ -951,9 +968,7 @@ void BladeRunnerEngine::handleMouseAction(int x, int y, bool buttonLeft, bool bu
}
if (sceneObjectId == -1) {
- bool isRunning;
- _playerActor->loopWalkToXYZ(mousePosition, 0, false, false, false, &isRunning);
- debug("Clicked on nothing %f, %f, %f", mousePosition.x, mousePosition.y, mousePosition.z);
+ handleMouseClickEmpty(x, y, scenePosition);
return;
} else if (sceneObjectId >= 0 && sceneObjectId <= 73) {
handleMouseClickActor(x, y, sceneObjectId);
@@ -966,10 +981,13 @@ void BladeRunnerEngine::handleMouseAction(int x, int y, bool buttonLeft, bool bu
return;
}
}
+ if (!buttonLeft && buttonDown) {
+ // TODO: stop walking && switch combat mode
+ }
+
}
void BladeRunnerEngine::handleMouseClickExit(int x, int y, int exitIndex) {
- // clickedOnExit(exitType, x, y);
debug("clicked on exit %d %d %d", exitIndex, x, y);
_sceneScript->ClickedOnExit(exitIndex);
}
@@ -985,6 +1003,19 @@ void BladeRunnerEngine::handleMouseClick3DObject(int x, int y, int objectId, boo
_sceneScript->ClickedOn3DObject(objectName, false);
}
+void BladeRunnerEngine::handleMouseClickEmpty(int x, int y, Vector3 &mousePosition) {
+ bool sceneMouseClick = _sceneScript->MouseClick(x, y);
+
+ if (sceneMouseClick) {
+ return;
+ }
+
+
+ bool isRunning;
+ debug("Clicked on nothing %f, %f, %f", mousePosition.x, mousePosition.y, mousePosition.z);
+ _playerActor->loopWalkToXYZ(mousePosition, 0, false, false, false, &isRunning);
+}
+
void BladeRunnerEngine::handleMouseClickItem(int x, int y, int itemId) {
debug("Clicked on item %d", itemId);
_sceneScript->ClickedOnItem(itemId, false);
@@ -992,7 +1023,10 @@ void BladeRunnerEngine::handleMouseClickItem(int x, int y, int itemId) {
void BladeRunnerEngine::handleMouseClickActor(int x, int y, int actorId) {
debug("Clicked on actor %d", actorId);
- _sceneScript->ClickedOnActor(actorId);
+ bool t = _sceneScript->ClickedOnActor(actorId);
+ if (!_combat->isActive() && !t) {
+ _aiScripts->ClickedByPlayer(actorId);
+ }
}
void BladeRunnerEngine::gameWaitForActive() {
@@ -1072,14 +1106,16 @@ bool BladeRunnerEngine::isArchiveOpen(const Common::String &name) {
Common::SeekableReadStream *BladeRunnerEngine::getResourceStream(const Common::String &name) {
for (uint i = 0; i != 10; ++i) {
- if (!_archives[i].isOpen())
+ if (!_archives[i].isOpen()) {
continue;
-
- if (false)
+ }
+ if (false) {
debug("getResource: Searching archive %s for %s.", _archives[i].getName().c_str(), name.c_str());
+ }
Common::SeekableReadStream *stream = _archives[i].createReadStreamForMember(name);
- if (stream)
+ if (stream) {
return stream;
+ }
}
debug("getResource: Resource %s not found.", name.c_str());
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 066937ca38..7ed3fb4af3 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -48,9 +48,16 @@ enum AnimationModes {
kAnimationModeCombatRun = 8
};
+enum SceneLoopMode {
+ kSceneLoopModeLoseControl = 0,
+ kSceneLoopModeChangeSet = 1,
+ kSceneLoopMode2 = 2,
+ kSceneLoopModeSpinner = 3
+};
+
class Actor;
class ADQ;
-class AESC;
+class ScreenEffects;
class AIScripts;
class AmbientSounds;
class AudioMixer;
@@ -68,6 +75,7 @@ class ItemPickup;
class Items;
class Lights;
class Mouse;
+class Music;
class Obstacles;
class Overlays;
class Scene;
@@ -80,6 +88,7 @@ class SliceRenderer;
class Spinner;
class SuspectsDatabase;
class TextResource;
+class Vector3;
class View;
class Waypoints;
class ZBuffer;
@@ -94,7 +103,7 @@ public:
int _playerLosesControlCounter;
ADQ *_adq;
- AESC *_aesc;
+ ScreenEffects *_screenEffects;
AIScripts *_aiScripts;
AmbientSounds *_ambientSounds;
AudioMixer *_audioMixer;
@@ -112,6 +121,7 @@ public:
Lights *_lights;
Font *_mainFont;
Mouse *_mouse;
+ Music *_music;
Obstacles *_obstacles;
Overlays *_overlays;
Scene *_scene;
@@ -194,6 +204,7 @@ public:
void handleMouseClickItem(int x, int y, int itemId);
void handleMouseClickActor(int x, int y, int actorId);
void handleMouseClick3DObject(int x, int y, int objectId, bool isClickable, bool isTarget);
+ void handleMouseClickEmpty(int x, int y, Vector3 &mousePosition);
void gameWaitForActive();
void loopActorSpeaking();
diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk
index 711ddd3346..89419d41d0 100644
--- a/engines/bladerunner/module.mk
+++ b/engines/bladerunner/module.mk
@@ -2,7 +2,6 @@ MODULE := engines/bladerunner
MODULE_OBJS = \
adq.o \
- aesc.o \
actor.o \
actor_clues.o \
actor_combat.o \
@@ -37,22 +36,25 @@ MODULE_OBJS = \
matrix.o \
mouse.o \
movement_track.o \
+ music.o \
obstacles.o \
outtake.o \
overlays.o \
regions.o \
scene.o \
scene_objects.o \
+ screen_effects.o \
script/script.o \
script/init.o \
script/kia.o \
script/vk.o \
script/esper.o \
script/ai.o \
+ script/ai/leon.o \
+ script/ai/maggie.o \
script/ai/mccoy.o \
- script/ai/runciter.o \
script/ai/officer_leary.o \
- script/ai/leon.o \
+ script/ai/runciter.o \
script/scene.o \
script/scene/ar01.o \
script/scene/ar02.o \
diff --git a/engines/bladerunner/mouse.cpp b/engines/bladerunner/mouse.cpp
index 42d6ffef09..8293cbc59c 100644
--- a/engines/bladerunner/mouse.cpp
+++ b/engines/bladerunner/mouse.cpp
@@ -23,6 +23,7 @@
#include "bladerunner/mouse.h"
#include "bladerunner/bladerunner.h"
+#include "bladerunner/dialogue_menu.h"
#include "bladerunner/regions.h"
#include "bladerunner/scene.h"
#include "bladerunner/scene_objects.h"
@@ -255,8 +256,14 @@ void Mouse::updateCursorFrame() {
}
void Mouse::tick(int x, int y) {
- if (!_vm->playerHasControl() || isDisabled())
+ if (!_vm->playerHasControl() || isDisabled()) {
return;
+ }
+
+ if (_vm->_dialogueMenu->isVisible()) {
+ setCursor(0);
+ return;
+ }
Vector3 mousePosition = getXYZ(x, y);
int cursorId = 0;
diff --git a/engines/bladerunner/music.cpp b/engines/bladerunner/music.cpp
new file mode 100644
index 0000000000..6b7a733338
--- /dev/null
+++ b/engines/bladerunner/music.cpp
@@ -0,0 +1,229 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "bladerunner/music.h"
+
+#include "bladerunner/audio_mixer.h"
+#include "bladerunner/aud_stream.h"
+#include "bladerunner/bladerunner.h"
+
+#include "common/timer.h"
+
+namespace BladeRunner {
+
+Music::Music(BladeRunnerEngine *vm)
+ : _vm(vm) {
+ _channel = -1;
+ _volume = 65;
+ _isPlaying = false;
+ _isPaused = false;
+ _current.loop = false;
+ _isNextPresent = false;
+ _data = nullptr;
+ _stream = nullptr;
+}
+
+Music::~Music() {
+ stop(1);
+ while (isPlaying()) {
+ // wait for the mixer to finish
+ }
+
+ _vm->getTimerManager()->removeTimerProc(timerCallbackFadeOut);
+ _vm->getTimerManager()->removeTimerProc(timerCallbackNext);
+}
+
+bool Music::play(const char *trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) {
+ //Common::StackLock lock(_mutex);
+
+ if (_volume <= 0) {
+ return false;
+ }
+
+ int volumeAdjusted = volume * _volume / 100;
+ int volumeStart = volumeAdjusted;
+ if (timeFadeIn > 0) {
+ volumeStart = 1;
+ }
+
+ if (isPlaying()) {
+ if (!_current.name.equalsIgnoreCase(trackName)) {
+ _next.name = trackName;
+ _next.volume = volume;
+ _next.pan = pan;
+ _next.timeFadeIn = timeFadeIn;
+ _next.timePlay = timePlay;
+ _next.loop = loop;
+ _next.timeFadeOut = timeFadeOut;
+ if (_isNextPresent) {
+ stop(2);
+ }
+ _isNextPresent = true;
+ } else {
+ _current.loop = loop;
+ adjustVolume(volumeAdjusted, timeFadeIn);
+ adjustPan(volumeAdjusted, timeFadeIn);
+ }
+ return true;
+ }
+
+ _data = getData(trackName);
+ if (_data == nullptr) {
+ return false;
+ }
+ _stream = new AudStream(_data);
+
+ _isNextPresent = false;
+ _channel = _vm->_audioMixer->playMusic(_stream, volumeStart, mixerChannelEnded, this);
+ if (_channel < 0) {
+ delete _stream;
+ _stream = nullptr;
+ delete _data;
+ _data = nullptr;
+
+ return false;
+ }
+ if (timeFadeIn > 0) {
+ adjustVolume(volumeAdjusted, timeFadeIn);
+ }
+ _current.name = trackName;
+ if (timePlay > 0) {
+ _vm->getTimerManager()->installTimerProc(timerCallbackFadeOut, timePlay * 1000 * 1000, this, "BladeRunnerMusicFadeoutTimer");
+ } else if (timeFadeOut > 0) {
+ _vm->getTimerManager()->installTimerProc(timerCallbackFadeOut, (_stream->getLength() - timeFadeOut * 1000) * 1000, this, "BladeRunnerMusicFadeoutTimer");
+ }
+ _isPlaying = true;
+ _current.volume = volume;
+ _current.pan = pan;
+ _current.timeFadeIn = timeFadeIn;
+ _current.timePlay = timePlay;
+ _current.loop = loop;
+ _current.timeFadeOut = timeFadeOut;
+ return true;
+}
+
+void Music::stop(int delay) {
+ Common::StackLock lock(_mutex);
+
+ if (_channel < 0) {
+ return;
+ }
+
+ _current.loop = false;
+ _vm->_audioMixer->stop(_channel, 60 * delay);
+}
+
+void Music::adjust(int volume, int pan, int delay) {
+ if (volume != -1) {
+ adjustVolume(_volume * volume/ 100, delay);
+ }
+ if (pan != -101) {
+ adjustPan(pan, delay);
+ }
+}
+
+bool Music::isPlaying() {
+ return _channel >= 0 && _isPlaying;
+}
+
+void Music::setVolume(int volume) {
+ _volume = volume;
+ if (volume <= 0) {
+ stop(2);
+ } else if (isPlaying()) {
+ _vm->_audioMixer->adjustVolume(_channel, _volume * _current.volume / 100, 120);
+ }
+}
+
+void Music::adjustVolume(int volume, int delay) {
+ if (_channel >= 0) {
+ _vm->_audioMixer->adjustVolume(_channel, volume, delay);
+ }
+}
+
+void Music::adjustPan(int pan, int delay) {
+ if (_channel >= 0) {
+ _vm->_audioMixer->adjustPan(_channel, pan, delay);
+ }
+}
+
+void Music::ended() {
+ Common::StackLock lock(_mutex);
+
+ _isPlaying = false;
+ _channel = -1;
+
+ delete _data;
+ _data = nullptr;
+
+ _vm->getTimerManager()->installTimerProc(timerCallbackNext, 100 * 1000, this, "BladeRunnerMusicNextTimer");
+}
+
+void Music::fadeOut() {
+ _vm->getTimerManager()->removeTimerProc(timerCallbackFadeOut);
+ if (_channel >= 0) {
+ _vm->_audioMixer->stop(_channel, 60 * _current.timeFadeOut);
+ }
+}
+
+void Music::next() {
+ _vm->getTimerManager()->removeTimerProc(timerCallbackNext);
+
+ if (_isNextPresent) {
+ if (_isPaused) {
+ _vm->getTimerManager()->installTimerProc(timerCallbackNext, 2000 * 1000, this, "BladeRunnerMusicNextTimer");
+ } else {
+ play(_next.name.c_str(), _next.volume, _next.pan, _next.timeFadeIn, _next.timePlay, _next.loop, _next.timeFadeOut);
+ }
+ _current.loop = false;
+ } else if (_current.loop) {
+ play(_current.name.c_str(), _current.volume, _current.pan, _current.timeFadeIn, _current.timePlay, _current.loop, _current.timeFadeOut);
+ }
+}
+
+void Music::mixerChannelEnded(int channel, void *data) {
+ if (data != nullptr) {
+ ((Music *)data)->ended();
+ }
+}
+
+void Music::timerCallbackFadeOut(void *refCon) {
+ ((Music *)refCon)->fadeOut();
+}
+
+void Music::timerCallbackNext(void *refCon) {
+ ((Music *)refCon)->next();
+}
+
+byte *Music::getData(const char *name) {
+ // NOTE: This is not part original game, loading data is done in the mixer and its using buffering to limit memory usage
+ Common::SeekableReadStream *stream = _vm->getResourceStream(name);
+ if (stream == nullptr) {
+ return nullptr;
+ }
+ uint32 size = stream->size();
+ byte *data = (byte *)malloc(size);
+ stream->read(data, size);
+ return data;
+}
+
+} // End of namespace BladeRunner
diff --git a/engines/bladerunner/music.h b/engines/bladerunner/music.h
new file mode 100644
index 0000000000..3dcf969a8a
--- /dev/null
+++ b/engines/bladerunner/music.h
@@ -0,0 +1,86 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BLADERUNNER_MUSIC_H
+#define BLADERUNNER_MUSIC_H
+
+#include "common/mutex.h"
+#include "common/str.h"
+
+namespace BladeRunner {
+
+class AudStream;
+class BladeRunnerEngine;
+
+class Music {
+ struct Track {
+ Common::String name;
+ int volume;
+ int pan;
+ int timeFadeIn;
+ int timePlay;
+ int loop;
+ int timeFadeOut;
+ };
+
+ BladeRunnerEngine *_vm;
+
+ Common::Mutex _mutex;
+ int _volume;
+ int _channel;
+ int _isNextPresent;
+ int _isPlaying;
+ int _isPaused;
+ Track _current;
+ Track _next;
+ byte *_data;
+ AudStream *_stream;
+
+public:
+ Music(BladeRunnerEngine *vm);
+ ~Music();
+
+ bool play(const char *trackName, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut);
+ void stop(int delay);
+ void adjust(int volume, int pan, int delay);
+ bool isPlaying();
+
+ void setVolume(int volume);
+
+private:
+ void adjustVolume(int volume, int delay);
+ void adjustPan(int pan, int delay);
+
+ void ended();
+ void fadeOut();
+ void next();
+
+ static void mixerChannelEnded(int channel, void *data);
+ static void timerCallbackFadeOut(void *refCon);
+ static void timerCallbackNext(void *refCon);
+
+ byte *getData(const char* name);
+};
+
+} // End of namespace BladeRunner
+
+#endif
diff --git a/engines/bladerunner/overlays.cpp b/engines/bladerunner/overlays.cpp
index dddf677c53..6e94b291e5 100644
--- a/engines/bladerunner/overlays.cpp
+++ b/engines/bladerunner/overlays.cpp
@@ -56,7 +56,7 @@ Overlays::~Overlays() {
reset();
}
-int Overlays::play(const Common::String &name, int loopId, int loopForever, int a5, int a6) {
+int Overlays::play(const Common::String &name, int loopId, int loopForever, int startNow, int a6) {
int id = mix_id(name);
int index = findById(id);
if (index < 0) {
@@ -77,7 +77,7 @@ int Overlays::play(const Common::String &name, int loopId, int loopForever, int
_videos[index].vqaPlayer->setLoop(
loopId,
loopForever ? -1 : 0,
- a5 ? kLoopSetModeImmediate : kLoopSetModeEnqueue,
+ startNow ? kLoopSetModeImmediate : kLoopSetModeEnqueue,
nullptr, nullptr);
return index;
@@ -91,6 +91,14 @@ void Overlays::remove(const Common::String &name) {
}
}
+void Overlays::removeAll() {
+ for (int i = 0; i < kOverlayVideos; ++i) {
+ if (_videos[i].loaded) {
+ resetSingle(i);
+ }
+ }
+}
+
void Overlays::tick() {
for (int i = 0; i < kOverlayVideos; ++i) {
if (_videos[i].loaded) {
@@ -131,14 +139,6 @@ void Overlays::resetSingle(int i) {
_videos[i].field2 = -1;
}
-void Overlays::resetAll() {
- for (int i = 0; i < kOverlayVideos; ++i) {
- if (_videos[i].loaded) {
- resetSingle(i);
- }
- }
-}
-
void Overlays::reset() {
_videos.clear();
}
diff --git a/engines/bladerunner/overlays.h b/engines/bladerunner/overlays.h
index 9be515e036..f547253269 100644
--- a/engines/bladerunner/overlays.h
+++ b/engines/bladerunner/overlays.h
@@ -58,6 +58,7 @@ public:
int play(const Common::String &name, int a3, int a4, int a5, int a6);
void remove(const Common::String &name);
+ void removeAll();
void tick();
private:
@@ -65,7 +66,6 @@ private:
int findEmpty() const;
void resetSingle(int i);
- void resetAll();
void reset();
};
diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp
index de3d89291b..ebf8ed34ba 100644
--- a/engines/bladerunner/scene.cpp
+++ b/engines/bladerunner/scene.cpp
@@ -28,11 +28,13 @@
#include "bladerunner/chapters.h"
#include "bladerunner/gameinfo.h"
#include "bladerunner/items.h"
+#include "bladerunner/overlays.h"
+#include "bladerunner/regions.h"
#include "bladerunner/scene_objects.h"
+#include "bladerunner/screen_effects.h"
#include "bladerunner/set.h"
#include "bladerunner/settings.h"
#include "bladerunner/slice_renderer.h"
-#include "bladerunner/regions.h"
#include "bladerunner/vqa_player.h"
#include "bladerunner/script/scene.h"
#include "bladerunner/spinner.h"
@@ -84,9 +86,8 @@ bool Scene::open(int setId, int sceneId, bool isLoadingGame) {
} else {
_regions->clear();
_exits->clear();
- // TODO: Reset aesc
- // TODO: Clear regions
- // TODO: Destroy all overlays
+ _vm->_screenEffects->_entries.clear();
+ _vm->_overlays->removeAll();
_defaultLoop = 0;
_defaultLoopSet = false;
_specialLoopAtEnd = false;
@@ -210,7 +211,7 @@ int Scene::advanceFrame() {
blit(_vm->_surfaceInterface, _vm->_surfaceGame);
_vqaPlayer->updateZBuffer(_vm->_zbuffer);
_vqaPlayer->updateView(_vm->_view);
- _vqaPlayer->updateAESC(_vm->_aesc);
+ _vqaPlayer->updateScreenEffects(_vm->_screenEffects);
_vqaPlayer->updateLights(_vm->_lights);
}
if (_specialLoopMode && _specialLoopMode != kSceneLoopMode2 && _specialLoopMode != kSceneLoopModeSpinner) {
diff --git a/engines/bladerunner/scene.h b/engines/bladerunner/scene.h
index 65ad5bf431..70f648acea 100644
--- a/engines/bladerunner/scene.h
+++ b/engines/bladerunner/scene.h
@@ -33,13 +33,6 @@ class Regions;
class Set;
class VQAPlayer;
-enum SceneLoopMode {
- kSceneLoopModeLoseControl = 0,
- kSceneLoopModeChangeSet = 1,
- kSceneLoopMode2 = 2,
- kSceneLoopModeSpinner = 3
-};
-
class Scene {
BladeRunnerEngine *_vm;
diff --git a/engines/bladerunner/aesc.cpp b/engines/bladerunner/screen_effects.cpp
index d653d1df35..70c872b746 100644
--- a/engines/bladerunner/aesc.cpp
+++ b/engines/bladerunner/screen_effects.cpp
@@ -20,23 +20,23 @@
*
*/
-#include "bladerunner/aesc.h"
+#include "bladerunner/screen_effects.h"
#include "common/stream.h"
namespace BladeRunner {
-AESC::AESC(BladeRunnerEngine *vm, int size) : _vm(vm) {
+ScreenEffects::ScreenEffects(BladeRunnerEngine *vm, int size) : _vm(vm) {
_dataSize = size;
_data = new uint8[size];
_entries.reserve(8);
}
-AESC::~AESC() {
+ScreenEffects::~ScreenEffects() {
delete[] _data;
}
-void AESC::readVqa(Common::SeekableReadStream *stream) {
+void ScreenEffects::readVqa(Common::SeekableReadStream *stream) {
uint8* dataPtr = _data;
int dataSize = _dataSize;
@@ -96,7 +96,7 @@ void AESC::readVqa(Common::SeekableReadStream *stream) {
}
//TODO:
-//bool AESC::isAffectingArea(int x, int y, int width, int height, int z) {
+//bool ScreenEffects::isAffectingArea(int x, int y, int width, int height, int z) {
// int xx = x >> 1;
// int yy = y >> 1;
// if (_entries.empty()) {
@@ -120,7 +120,7 @@ void AESC::readVqa(Common::SeekableReadStream *stream) {
// return false;
//}
-void AESC::getColor(Color256 *outColor, uint16 x, uint16 y, uint16 z) {
+void ScreenEffects::getColor(Color256 *outColor, uint16 x, uint16 y, uint16 z) {
Color256 color = { 0, 0, 0 };
for (Common::Array<Entry>::iterator entry = _entries.begin(); entry != _entries.end(); entry++) {
uint16 x1 = (x / 2) - entry->x;
diff --git a/engines/bladerunner/aesc.h b/engines/bladerunner/screen_effects.h
index d3f926b190..1ffb68413f 100644
--- a/engines/bladerunner/aesc.h
+++ b/engines/bladerunner/screen_effects.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef BLADERUNNER_AESC_H
-#define BLADERUNNER_AESC_H
+#ifndef BLADERUNNER_SCREEN_EFFECTS_H
+#define BLADERUNNER_SCREEN_EFFECTS_H
#include "bladerunner/color.h"
@@ -32,9 +32,10 @@ class ReadStream;
}
namespace BladeRunner {
+
class BladeRunnerEngine;
-class AESC {
+class ScreenEffects {
public:
struct Entry
{
@@ -54,8 +55,8 @@ public:
int _dataSize;
public:
- AESC(BladeRunnerEngine *vm, int size);
- ~AESC();
+ ScreenEffects(BladeRunnerEngine *vm, int size);
+ ~ScreenEffects();
void readVqa(Common::SeekableReadStream *stream);
void getColor(Color256 *outColor, uint16 x, uint16 y, uint16 z);
@@ -63,6 +64,7 @@ public:
//TODO
//bool isAffectingArea(int x, int y, int width, int height, int unk);
};
+
} // End of namespace BladeRunner
#endif
diff --git a/engines/bladerunner/script/ai.cpp b/engines/bladerunner/script/ai.cpp
index c695886a61..ade27e417f 100644
--- a/engines/bladerunner/script/ai.cpp
+++ b/engines/bladerunner/script/ai.cpp
@@ -41,6 +41,7 @@ AIScripts::AIScripts(BladeRunnerEngine *vm, int actorsCount) : _vm(vm), _inScrip
_AIScripts[kActorRunciter] = new AIScriptRunciter(_vm);
_AIScripts[kActorOfficerLeary] = new AIScriptOfficerLeary(_vm);
_AIScripts[kActorLeon] = new AIScriptLeon(_vm);
+ _AIScripts[kActorMaggie] = new AIScriptMaggie(_vm);
}
AIScripts::~AIScripts() {
@@ -100,6 +101,20 @@ void AIScripts::ReceivedClue(int actor, int clueId, int fromActorId) {
_inScriptCounter--;
}
+void AIScripts::ClickedByPlayer(int actor) {
+ assert(actor < _actorsCount);
+
+ if(_vm->_actors[actor]->inCombat()) {
+ return;
+ }
+
+ _inScriptCounter++;
+ if (_AIScripts[actor]) {
+ _AIScripts[actor]->ClickedByPlayer();
+ }
+ _inScriptCounter--;
+}
+
void AIScripts::EnteredScene(int actor, int setId) {
assert(actor < _actorsCount);
_inScriptCounter++;
diff --git a/engines/bladerunner/script/ai.h b/engines/bladerunner/script/ai.h
index c3fec411e9..9f2caa094b 100644
--- a/engines/bladerunner/script/ai.h
+++ b/engines/bladerunner/script/ai.h
@@ -152,6 +152,21 @@ DECLARE_SCRIPT(Leon)
float sub_446700(int actorId, float x, float y, float z);
END_SCRIPT
+DECLARE_SCRIPT(Maggie)
+ int var_45F3F0_animation_state;
+ int var_45F3F4_animation_frame;
+ int var_462B30;
+ int var_462B34;
+ int var_45F3F8;
+ int var_45F3FC;
+ int var_45F400;
+ int var_45F404;
+ int var_45F408;
+
+ int sub_44B260();
+ float sub_44B200(int actorId, float x, float y, float z);
+END_SCRIPT
+
#undef DECLARE_SCRIPT
#undef END_SCRIPT
@@ -171,6 +186,7 @@ public:
void TimerExpired(int actor, int timer);
void CompletedMovementTrack(int actor);
void ReceivedClue(int actor, int clueId, int fromActorId);
+ void ClickedByPlayer(int actor);
void EnteredScene(int actor, int setId);
void OtherAgentEnteredThisScene(int actor, int otherActorId);
void OtherAgentExitedThisScene(int actor, int otherActorId);
diff --git a/engines/bladerunner/script/ai/leon.cpp b/engines/bladerunner/script/ai/leon.cpp
index 63dc3d4782..45e1c7423d 100644
--- a/engines/bladerunner/script/ai/leon.cpp
+++ b/engines/bladerunner/script/ai/leon.cpp
@@ -93,7 +93,7 @@ void AIScriptLeon::ClickedByPlayer() {
void AIScriptLeon::EnteredScene(int sceneId) {}
void AIScriptLeon::OtherAgentEnteredThisScene(int otherActorId) {
- if (otherActorId == 0 && Actor_Query_Goal_Number(kActorLeon) == 7) {
+ if (otherActorId == kActorMcCoy && Actor_Query_Goal_Number(kActorLeon) == 7) {
AI_Countdown_Timer_Reset(kActorLeon, 0);
AI_Movement_Track_Flush(kActorLeon);
AI_Movement_Track_Append(kActorLeon, 353, 0);
@@ -104,7 +104,7 @@ void AIScriptLeon::OtherAgentEnteredThisScene(int otherActorId) {
}
void AIScriptLeon::OtherAgentExitedThisScene(int otherActorId) {
- if (otherActorId == 0 && Actor_Query_Which_Set_In(kActorLeon) == 33) {
+ if (otherActorId == kActorMcCoy && Actor_Query_Which_Set_In(kActorLeon) == 33) {
AI_Movement_Track_Flush(kActorLeon);
ADQ_Flush();
Actor_Set_Goal_Number(kActorLeon, 8);
@@ -115,7 +115,7 @@ void AIScriptLeon::OtherAgentExitedThisScene(int otherActorId) {
}
void AIScriptLeon::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
- if (otherActorId == 0 && combatMode == 1 && Actor_Query_Goal_Number(kActorLeon) == 1) {
+ if (otherActorId == kActorMcCoy && combatMode == 1 && Actor_Query_Goal_Number(kActorLeon) == 1) {
Game_Flag_Set(539);
Player_Loses_Control();
Actor_Face_Actor(kActorMcCoy, kActorLeon, true);
@@ -448,7 +448,7 @@ void AIScriptLeon::FledCombat() {}
float AIScriptLeon::sub_446700(int actorId, float x, float y, float z) {
float actorX, actorY, actorZ;
Actor_Query_XYZ(actorId, &actorX, &actorY, &actorZ);
- return sqrtf((z - actorZ) * (z - actorZ) + (y - actorX) * (y - actorX) + (y - actorY) * (y - actorY));
+ return sqrtf((z - actorZ) * (z - actorZ) + (y - actorY) * (y - actorY) + (x - actorX) * (x - actorX));
}
} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/ai/maggie.cpp b/engines/bladerunner/script/ai/maggie.cpp
new file mode 100644
index 0000000000..150a2a3a0b
--- /dev/null
+++ b/engines/bladerunner/script/ai/maggie.cpp
@@ -0,0 +1,634 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "bladerunner/script/ai.h"
+#include "bladerunner/vector.h"
+
+namespace BladeRunner {
+
+void AIScriptMaggie::Initialize() {
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ var_462B30 = 0;
+ var_45F3F8 = 0;
+ var_45F3FC = 0;
+ var_45F400 = 0;
+ var_45F404 = 0;
+ var_45F408 = 0;
+ Actor_Set_Goal_Number(kActorMaggie, 0);
+}
+
+bool AIScriptMaggie::Update() {
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (Actor_Query_Which_Set_In(kActorMaggie) == 10 && Global_Variable_Query(1) == 4) {
+ Actor_Put_In_Set(kActorMaggie, 97);
+ Actor_Set_At_Waypoint(kActorMaggie, 39, 0);
+ }
+ if (goal == 414) {
+ Actor_Set_Goal_Number(kActorMaggie, 415);
+ } else if (goal == 413 && Actor_Query_Inch_Distance_From_Actor(kActorMcCoy, kActorMaggie) < 60) {
+ Actor_Set_Goal_Number(kActorMaggie, 415);
+ }
+ if (Global_Variable_Query(1) == 5) {
+ if (Actor_Query_Goal_Number(kActorMaggie) < 400) {
+ Actor_Set_Goal_Number(66, 400);
+ }
+ return true;
+ }
+ return false;
+}
+
+void AIScriptMaggie::TimerExpired(int timer) {
+ if (timer != 0) {
+ return;
+ }
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (goal == 8) {
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ if (Random_Query(0, 4)) {
+ AI_Movement_Track_Flush(kActorMaggie);
+ AI_Movement_Track_Append(kActorMaggie, sub_44B260(), 0);
+ AI_Movement_Track_Repeat(kActorMaggie);
+ } else {
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ }
+ return; //true
+ }
+ if (goal == 10) {
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ Actor_Change_Animation_Mode(kActorMaggie, 55);
+ return; //true
+ }
+ return; //false
+}
+
+void AIScriptMaggie::CompletedMovementTrack() {
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (goal == 0 || goal > 9) {
+ if (goal == 413) {
+ Actor_Set_Goal_Number(kActorMaggie, 414);
+ return; //true
+ }
+ } else {
+ if (goal == 1) {
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ return; //true
+ }
+ if (goal == 8) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(1, 5));
+ return; //true
+ }
+ if (goal == 9) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ return; //true
+ }
+ }
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ return; //true
+}
+
+void AIScriptMaggie::ReceivedClue(int clueId, int fromActorId) {
+}
+
+void AIScriptMaggie::ClickedByPlayer() {
+ if (!Game_Flag_Query(653) && Global_Variable_Query(1) == 5) {
+ if (Actor_Query_Goal_Number(kActorMaggie) == 413) {
+ Actor_Set_Targetable(kActorMaggie, true);
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Actor_Says(kActorMcCoy, 2400, 52);
+ }
+ return; // true
+ }
+ if (var_45F3F0_animation_state == 1 || var_45F3F0_animation_state == 12 || var_45F3F0_animation_state == 16) {
+ return; // false
+ }
+
+ float mccoy_x, mccoy_y, mccoy_z;
+
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Actor_Query_XYZ(kActorMcCoy, &mccoy_x, &mccoy_y, &mccoy_z);
+ float distance = sub_44B200(kActorMaggie, mccoy_x, mccoy_y, mccoy_z);
+ if (distance > 60.0f) {
+ Actor_Says(0, 2430, 18);
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ return; // true
+ }
+
+ int v6 = Random_Query(0, 4);
+ if (v6 == 1) {
+ Actor_Says(kActorMcCoy, 2440, 18);
+ }
+ if (v6 == 0) {
+ Actor_Says(kActorMcCoy, 2435, 13);
+ }
+
+ int goal = Actor_Query_Goal_Number(kActorMaggie);
+ if (goal == 8) {
+ if (Random_Query(0, 1)) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 57);
+ } else {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 56);
+ }
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(3, 9));
+ return; // true
+ }
+ if (goal == 10) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ return; // true
+ }
+ if (goal == 11) {
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ return; // true
+ }
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ return; // true
+}
+
+void AIScriptMaggie::EnteredScene(int sceneId) {
+}
+
+void AIScriptMaggie::OtherAgentEnteredThisScene(int otherActorId) {
+}
+
+void AIScriptMaggie::OtherAgentExitedThisScene(int otherActorId) {
+ if (otherActorId == kActorMcCoy && Actor_Query_Which_Set_In(kActorMaggie) == 10 && Global_Variable_Query(1) < 4) {
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Set_Goal_Number(kActorMaggie, 0);
+ }
+}
+
+void AIScriptMaggie::OtherAgentEnteredCombatMode(int otherActorId, int combatMode) {
+}
+
+void AIScriptMaggie::ShotAtAndMissed() {
+}
+
+void AIScriptMaggie::ShotAtAndHit() {
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Set_Goal_Number(kActorMaggie, 414);
+ Actor_Set_Targetable(kActorMaggie, false);
+}
+
+void AIScriptMaggie::Retired(int byActorId) {
+}
+
+int AIScriptMaggie::GetFriendlinessModifierIfGetsClue(int otherActorId, int clueId) {
+ return 0;
+}
+
+bool AIScriptMaggie::GoalChanged(int currentGoalNumber, int newGoalNumber) {
+ if (currentGoalNumber == 599) {
+ return true;
+ }
+ switch (newGoalNumber) {
+ case 11:
+ Actor_Change_Animation_Mode(kActorMaggie, 55);
+ var_45F3F0_animation_state = 9;
+ var_45F3F4_animation_frame = 0;
+ return true;
+ case 10:
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ var_45F3F0_animation_state = 6;
+ var_45F3F4_animation_frame = 0;
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(2, 9));
+ return true;
+ case 9:
+ if (Random_Query(0, 2) <= 0) {
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, false);
+ Actor_Change_Animation_Mode(kActorMaggie, 54);
+ } else {
+ AI_Movement_Track_Flush(kActorMaggie);
+ if (Actor_Query_Which_Set_In(kActorMaggie) == 10) {
+ AI_Movement_Track_Append(kActorMaggie, sub_44B260(), 486);
+ }
+ AI_Movement_Track_Repeat(kActorMaggie);
+ }
+ return true;
+ case 8:
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Countdown_Timer_Start(kActorMaggie, 0, Random_Query(3, 9));
+ return true;
+ case 7:
+ AI_Countdown_Timer_Reset(kActorMaggie, 0);
+ AI_Movement_Track_Flush(kActorMaggie);
+ Loop_Actor_Walk_To_Actor(kActorMaggie, kActorMcCoy, 30, 0, false);
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 56);
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ return true;
+ case 3:
+ Player_Loses_Control();
+ AI_Movement_Track_Flush(kActorMaggie);
+ Loop_Actor_Walk_To_Actor(kActorMaggie, kActorMcCoy, 48, 0, false);
+ Actor_Face_Actor(0, kActorMaggie, true);
+ Actor_Face_Actor(kActorMaggie, 0, false);
+ Actor_Says(kActorMcCoy, 2400, 52);
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ Player_Gains_Control();
+ return true;
+ case 1:
+ Actor_Put_In_Set(kActorMaggie, 10);
+ Actor_Set_At_Waypoint(kActorMaggie, sub_44B260(), 512);
+ AI_Movement_Track_Flush(kActorMaggie);
+ AI_Movement_Track_Append(kActorMaggie, 264, 0);
+ AI_Movement_Track_Repeat(kActorMaggie);
+ return true;
+ case 0:
+ Actor_Put_In_Set(kActorMaggie, 10);
+ Actor_Set_At_Waypoint(kActorMaggie, 265, 780);
+ return true;
+ case 415:
+ AI_Movement_Track_Flush(kActorMaggie);
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Sound_Play(494, 50, 0, 0, 100);
+ Actor_Set_Goal_Number(kActorMaggie, 599);
+ Actor_Change_Animation_Mode(kActorMaggie, 51);
+ if (Actor_Query_Inch_Distance_From_Actor(0, kActorMaggie) < 144) {
+ Player_Loses_Control();
+ Actor_Change_Animation_Mode(kActorMcCoy, 48);
+ Actor_Retired_Here(kActorMcCoy, 6, 6, 1, -1);
+ } else {
+ Delay(3000);
+ Scene_Exits_Disable();
+ Actor_Says(kActorMcCoy, 2235, 12);
+ if (Actor_Query_Is_In_Current_Set(kActorSteele)) {
+ Actor_Says(kActorSteele, 1530, 58);
+ Actor_Set_Goal_Number(kActorSteele, 431);
+ }
+ Delay(2000);
+ Actor_Says(kActorMcCoy, 2390, 13);
+ if (Actor_Query_Goal_Number(kActorSadik) == 411) {
+ Actor_Set_Goal_Number(kActorSadik, 412);
+ } else {
+ Actor_Set_Goal_Number(kActorClovis, 512);
+ }
+ }
+ break;
+ case 413:
+ if (Actor_Query_Is_In_Current_Set(kActorSteele)) {
+ Actor_Says(kActorSteele, 3270, 59);
+ }
+ AI_Movement_Track_Flush(kActorMaggie);
+ AI_Movement_Track_Append(kActorMaggie, 540, 0);
+ AI_Movement_Track_Repeat(kActorMaggie);
+ break;
+ case 412:
+ Scene_Exits_Disable();
+ Loop_Actor_Walk_To_XYZ(kActorMaggie, -734.0, 0.0, -432.0, 0, 0, false, 0);
+ Actor_Face_Actor(kActorMaggie, kActorMcCoy, true);
+ Actor_Change_Animation_Mode(kActorMaggie, 56);
+ Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
+ Actor_Says(kActorMcCoy, 2225, 3);
+ Actor_Set_Goal_Number(kActorMaggie, 413);
+ break;
+ case 411:
+ AI_Movement_Track_Flush(kActorMaggie);
+ Game_Flag_Set(461);
+ Actor_Put_In_Set(kActorMaggie, 9);
+ Actor_Set_At_XYZ(kActorMaggie, -672.0, 0.0, -428.0, 653);
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ break;
+ case 400:
+ Actor_Set_Goal_Number(kActorMaggie, 410);
+ break;
+ }
+ return false;
+}
+
+bool AIScriptMaggie::UpdateAnimation(int *animation, int *frame) {
+ int goal;
+ switch (var_45F3F0_animation_state) {
+ case 16:
+ *animation = 871;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 15:
+ *animation = 874;
+ var_45F3F4_animation_frame = Slice_Animation_Query_Number_Of_Frames(874) - 1;
+ break;
+ case 14:
+ *animation = 874;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(874) - 1) {
+ var_45F3F0_animation_state = 15;
+ var_45F3F4_animation_frame = Slice_Animation_Query_Number_Of_Frames(*animation) - 1;
+ Actor_Put_In_Set(kActorMaggie, 99);
+ Actor_Set_At_Waypoint(kActorMaggie, 41, 0);
+ }
+ break;
+ case 13:
+ *animation = 873;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(873)) {
+ var_45F3F0_animation_state = 11;
+ var_45F3F4_animation_frame = 0;
+ *animation = 875;
+ Actor_Set_Goal_Number(kActorMaggie, 414);
+ }
+ break;
+ case 12:
+ *animation = 872;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(872)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 11:
+ *animation = 875;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(875)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 10:
+ *animation = 876;
+ var_45F3F4_animation_frame--;
+ if (var_45F3F4_animation_frame > 0) {
+ break;
+ }
+ var_45F3F0_animation_state = 6;
+ var_45F3F4_animation_frame = 0;
+ *animation = 867;
+ goal = Actor_Query_Goal_Number(66);
+ if (goal == 3) {
+ var_45F3F0_animation_state = 7;
+ var_45F3F4_animation_frame = 0;
+ *animation = 868;
+ } else if (goal == 7) {
+ Actor_Set_Goal_Number(kActorMaggie, 10);
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ } else {
+ Actor_Set_Goal_Number(kActorMaggie, 10);
+ }
+ break;
+ case 9:
+ *animation = 876;
+ var_45F3F4_animation_frame = Slice_Animation_Query_Number_Of_Frames(876) - 1;
+ break;
+ case 8:
+ *animation = 876;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(876) - 1) {
+ var_45F3F0_animation_state = 9;
+ Actor_Set_Goal_Number(kActorMaggie, 11);
+ }
+ break;
+ case 7:
+ *animation = 868;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(868)) {
+ *animation = 864;
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ if (Actor_Query_Goal_Number(kActorMaggie) == 10) {
+ Actor_Set_Goal_Number(kActorMaggie, 8);
+ } else if (Actor_Query_Goal_Number(kActorMaggie) == 7) {
+ Actor_Set_Goal_Number(kActorMaggie, 12);
+ Actor_Set_Goal_Number(kActorMaggie, 7);
+ }
+ }
+ break;
+ case 6:
+ *animation = 867;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(867)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 5:
+ *animation = 866;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(866)) {
+ var_45F3F0_animation_state = 6;
+ var_45F3F4_animation_frame = 0;
+ *animation = 867;
+ if (Actor_Query_Goal_Number(kActorMaggie) == 9) {
+ Actor_Set_Goal_Number(kActorMaggie, 10);
+ }
+ }
+ break;
+ case 4:
+ *animation = 865;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(865)) {
+ var_45F3F4_animation_frame = 0;
+ var_45F3F8--;
+ if (var_45F3F8 <= 0) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ *animation = 864;
+ }
+ }
+ break;
+ case 3:
+ *animation = 870;
+ if (var_45F3F4_animation_frame == 1) {
+ Sound_Play(Random_Query(263, 264), 50, 0, 0, 50);
+ }
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(*animation)) {
+ var_45F3FC--;
+ if (var_45F3FC <= 0 ) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ *animation = 864;
+ var_45F3F0_animation_state = 0;
+ }
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 2:
+ *animation = 869;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(869)) {
+ Actor_Change_Animation_Mode(kActorMaggie, 0);
+ *animation = 864;
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 1:
+ *animation = 863;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(863)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 0:
+ *animation = 864;
+ var_45F3F4_animation_frame++;
+ if (var_45F3F4_animation_frame >= Slice_Animation_Query_Number_Of_Frames(864)) {
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ }
+ *frame = var_45F3F4_animation_frame;
+ return true;
+}
+
+bool AIScriptMaggie::ChangeAnimationMode(int mode) {
+ if (mode == 1) {
+ if (Game_Flag_Query(461)) {
+ var_45F3F0_animation_state = 12;
+ var_45F3F4_animation_frame = 0;
+ } else {
+ var_45F3F0_animation_state = 1;
+ var_45F3F4_animation_frame = 0;
+ }
+ return true;
+ }
+ if (mode == 0) {
+ if (Game_Flag_Query(461)) {
+ var_45F3F0_animation_state = 11;
+ var_45F3F4_animation_frame = 0;
+ } else {
+ switch (var_45F3F0_animation_state) {
+ case 8:
+ case 9:
+ var_45F3F0_animation_state = 10;
+ break;
+ case 6:
+ var_45F3F0_animation_state = 7;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 5:
+ var_45F3F0_animation_state = 7;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 2:
+ case 7:
+ case 10:
+ break;
+ default:
+ var_45F3F0_animation_state = 0;
+ var_45F3F4_animation_frame = 0;
+ break;
+ }
+ }
+ return true;
+ }
+
+ switch (mode) {
+ case 88:
+ var_45F3F0_animation_state = 16;
+ var_45F3F4_animation_frame = 0;
+ break;
+ case 57:
+ if (var_45F3F0_animation_state != 4) {
+ var_45F3F4_animation_frame = 0;
+ var_45F3F0_animation_state = 4;
+ }
+ var_45F3F8 = Random_Query(2, 6);
+ Sound_Play(276, 50, 0, 0, 50);
+ break;
+ case 56:
+ if (var_45F3F0_animation_state != 3) {
+ var_45F3F4_animation_frame = 0;
+ var_45F3F0_animation_state = 3;
+ }
+ var_45F3FC = Random_Query(2, 6);
+ break;
+ case 55:
+ if (var_45F3F0_animation_state == 6) {
+ var_45F3F0_animation_state = 8;
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 54:
+ if ((unsigned int)var_45F3F0_animation_state <= 9) {
+ if (var_45F3F0_animation_state) {
+ if (var_45F3F0_animation_state == 9) {
+ var_45F3F0_animation_state = 10;
+ var_45F3F4_animation_frame = 0;
+ }
+ } else {
+ var_45F3F0_animation_state = 5;
+ var_45F3F4_animation_frame = 0;
+ }
+ }
+ break;
+ case 52:
+ if (Game_Flag_Query(461)) {
+ var_45F3F0_animation_state = 13;
+ var_45F3F4_animation_frame = 0;
+ } else {
+ var_45F3F0_animation_state = 2;
+ var_45F3F4_animation_frame = 0;
+ }
+ break;
+ case 51:
+ var_45F3F0_animation_state = 14;
+ var_45F3F4_animation_frame = 0;
+ Sound_Play(272, 50, 0, 0, 50);
+ break;
+ }
+ return true;
+}
+
+void AIScriptMaggie::QueryAnimationState(int *animationState, int *animationFrame, int *a3, int *a4) {
+ *animationState = var_45F3F0_animation_state;
+ *animationFrame = var_45F3F4_animation_frame;
+ *a3 = var_462B30;
+ *a4 = var_462B34;
+}
+
+void AIScriptMaggie::SetAnimationState(int animationState, int animationFrame, int a3, int a4) {
+ var_45F3F0_animation_state = animationState;
+ var_45F3F4_animation_frame = animationFrame;
+ var_462B30 = a3;
+ var_462B34 = a4;
+}
+
+bool AIScriptMaggie::ReachedMovementTrackWaypoint(int waypointId) {
+ return true;
+}
+
+void AIScriptMaggie::FledCombat() {
+}
+
+int AIScriptMaggie::sub_44B260() {
+ int random = Random_Query(0, 3);
+ if (random == 0) {
+ return 264;
+ }
+ if (random == 1) {
+ return 265;
+ }
+ if (random == 2) {
+ return 266;
+ }
+ return 267;
+}
+
+float AIScriptMaggie::sub_44B200(int actorId, float x, float y, float z) {
+ float actorX, actorY, actorZ;
+ Actor_Query_XYZ(actorId, &actorX, &actorY, &actorZ);
+ return sqrtf((z - actorZ) * (z - actorZ) + (y - actorY) * (y - actorY) + (x - actorX) * (x - actorX));
+}
+
+} // End of namespace BladeRunner
diff --git a/engines/bladerunner/script/ai/mccoy.cpp b/engines/bladerunner/script/ai/mccoy.cpp
index bda6b093e6..fb670af304 100644
--- a/engines/bladerunner/script/ai/mccoy.cpp
+++ b/engines/bladerunner/script/ai/mccoy.cpp
@@ -431,7 +431,7 @@ bool AIScriptMcCoy::GoalChanged(int currentGoalNumber, int newGoalNumber) {
if (Game_Flag_Query(666)) {
Chapter_Enter(5, 53, 53);
} else {
- Game_Flag_Set(34);
+ Game_Flag_Set(kFlagMA06ToMA02);
Chapter_Enter(5, 10, 49);
}
return true;
@@ -1684,7 +1684,7 @@ void AIScriptMcCoy::sub_4054F0() {
if ((z < 220.0f) && (-210.0f < x) && (-70.0f > x)) {
Game_Flag_Set(682);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Actor_Set_Goal_Number(kActorMcCoy, 390);
Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
if (-200.0 < x && -62.0f > x) {
diff --git a/engines/bladerunner/script/ai/officer_leary.cpp b/engines/bladerunner/script/ai/officer_leary.cpp
index e55a9563e2..9b85a4cdf8 100644
--- a/engines/bladerunner/script/ai/officer_leary.cpp
+++ b/engines/bladerunner/script/ai/officer_leary.cpp
@@ -46,7 +46,7 @@ bool AIScriptOfficerLeary::Update() {
AI_Movement_Track_Flush(kActorOfficerLeary);
Actor_Set_Goal_Number(kActorOfficerLeary, 400);
} else if (!Game_Flag_Query(182) && Game_Flag_Query(147) == 1 && Game_Flag_Query(163) == 1 && Player_Query_Current_Scene() != 78 && Global_Variable_Query(1) < 3) {
- Game_Flag_Set(186);
+ Game_Flag_Set(kFlagRC01PoliceDone);
Actor_Set_Goal_Number(kActorOfficerLeary, 3);
} else if (Actor_Query_Goal_Number(kActorOfficerLeary) != 1 && Actor_Query_Goal_Number(kActorOfficerLeary) != 2 && Game_Flag_Query(199) == 1) {
Game_Flag_Reset(199);
diff --git a/engines/bladerunner/script/ai/runciter.cpp b/engines/bladerunner/script/ai/runciter.cpp
index d34b4a8a01..0c66876efb 100644
--- a/engines/bladerunner/script/ai/runciter.cpp
+++ b/engines/bladerunner/script/ai/runciter.cpp
@@ -37,7 +37,7 @@ void AIScriptRunciter::Initialize() {
}
bool AIScriptRunciter::Update() {
- if (Actor_Query_Goal_Number(kActorRunciter) == 0 && Game_Flag_Query(186)) {
+ if (Actor_Query_Goal_Number(kActorRunciter) == 0 && Game_Flag_Query(kFlagRC01PoliceDone)) {
Actor_Set_Goal_Number(kActorRunciter, 2);
}
if (Global_Variable_Query(1) == 4 && Actor_Query_Goal_Number(kActorRunciter) < 300) {
diff --git a/engines/bladerunner/script/scene.h b/engines/bladerunner/script/scene.h
index 0d4f574caa..b65f5f19b2 100644
--- a/engines/bladerunner/script/scene.h
+++ b/engines/bladerunner/script/scene.h
@@ -276,8 +276,8 @@ DECLARE_SCRIPT(MA04)
void sub_402F2C();
void sub_4032A0();
void sub_4034D8();
- void sub_403864();
- void sub_403DA8();
+ void turnOnTV();
+ void sleep();
END_SCRIPT
DECLARE_SCRIPT(MA05)
@@ -285,8 +285,8 @@ DECLARE_SCRIPT(MA05)
END_SCRIPT
DECLARE_SCRIPT(MA06)
- bool sub_4012C0();
- void sub_4014E4();
+ bool isElevatorOnDifferentFloor();
+ void activateElevator();
END_SCRIPT
DECLARE_SCRIPT(MA07)
@@ -410,7 +410,7 @@ END_SCRIPT
DECLARE_SCRIPT(RC01)
void sub_403850();
- void sub_4037AC();
+ void walkToCenter();
END_SCRIPT
DECLARE_SCRIPT(RC02)
diff --git a/engines/bladerunner/script/scene/bb02.cpp b/engines/bladerunner/script/scene/bb02.cpp
index 6022444d7e..d238617a33 100644
--- a/engines/bladerunner/script/scene/bb02.cpp
+++ b/engines/bladerunner/script/scene/bb02.cpp
@@ -100,12 +100,12 @@ bool SceneScriptBB02::ClickedOnExit(int exitId) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -12.0f, -415.06f, -27.0f, 0, 1, false, 0)) {
Player_Loses_Control();
if (!Game_Flag_Query(493)) {
- Scene_Loop_Start_Special(2, 0, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, true);
}
Game_Flag_Set(332);
Game_Flag_Reset(493);
Set_Enter(1, 5);
- Scene_Loop_Start_Special(1, 3, 0);
+ Scene_Loop_Start_Special(1, 3, false);
}
return true;
}
diff --git a/engines/bladerunner/script/scene/ct02.cpp b/engines/bladerunner/script/scene/ct02.cpp
index 95e1a6a832..47293d5b2a 100644
--- a/engines/bladerunner/script/scene/ct02.cpp
+++ b/engines/bladerunner/script/scene/ct02.cpp
@@ -152,7 +152,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
case 280:
@@ -165,7 +165,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
case 290:
@@ -181,7 +181,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
case 300:
@@ -192,7 +192,7 @@ void SceneScriptCT02::sub_401ACC() {
Actor_Set_Goal_Number(kActorZuben, 8);
Game_Flag_Set(293);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
}
break;
}
diff --git a/engines/bladerunner/script/scene/dr04.cpp b/engines/bladerunner/script/scene/dr04.cpp
index f11c462db6..b0e6e3bcb7 100644
--- a/engines/bladerunner/script/scene/dr04.cpp
+++ b/engines/bladerunner/script/scene/dr04.cpp
@@ -184,7 +184,7 @@ void SceneScriptDR04::SceneFrameAdvanced(int frame) {
Game_Flag_Reset(515);
Game_Flag_Reset(271);
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 6, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 6, true);
Music_Stop(4);
Actor_Set_Goal_Number(kActorMoraji, 99);
} else {
@@ -192,7 +192,7 @@ void SceneScriptDR04::SceneFrameAdvanced(int frame) {
Game_Flag_Reset(271);
Game_Flag_Set(272);
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 6, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 6, true);
Item_Remove_From_World(78);
}
switch (frame) {
diff --git a/engines/bladerunner/script/scene/hc03.cpp b/engines/bladerunner/script/scene/hc03.cpp
index 81007ce8b6..02e88bb3fa 100644
--- a/engines/bladerunner/script/scene/hc03.cpp
+++ b/engines/bladerunner/script/scene/hc03.cpp
@@ -100,7 +100,7 @@ bool SceneScriptHC03::ClickedOnItem(int itemId, bool a2) {
if (itemId == 121) {
if (a2) {
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Game_Flag_Set(403);
Item_Remove_From_World(121);
Unobstacle_Object("GPscisGate", true);
@@ -146,7 +146,7 @@ bool SceneScriptHC03::ClickedOnExit(int exitId) {
Set_Enter(75, 87);
} else {
Scene_Loop_Set_Default(6);
- Scene_Loop_Start_Special(2, 5, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 5, true);
Game_Flag_Set(388);
}
}
diff --git a/engines/bladerunner/script/scene/hf04.cpp b/engines/bladerunner/script/scene/hf04.cpp
index 7389810a6a..aaa3e8f25e 100644
--- a/engines/bladerunner/script/scene/hf04.cpp
+++ b/engines/bladerunner/script/scene/hf04.cpp
@@ -108,14 +108,14 @@ void SceneScriptHF04::SceneFrameAdvanced(int frame) {
if (Game_Flag_Query(585)) {
Game_Flag_Reset(585);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
//return true;
return;
}
if (Game_Flag_Query(586)) {
Game_Flag_Reset(586);
Scene_Loop_Set_Default(0);
- Scene_Loop_Start_Special(2, 5, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 5, true);
//return true;
return;
}
diff --git a/engines/bladerunner/script/scene/hf05.cpp b/engines/bladerunner/script/scene/hf05.cpp
index b451b76ba2..8106f71242 100644
--- a/engines/bladerunner/script/scene/hf05.cpp
+++ b/engines/bladerunner/script/scene/hf05.cpp
@@ -92,7 +92,7 @@ bool SceneScriptHF05::ClickedOn3DObject(const char *objectName, bool a2) {
Actor_Face_Heading(kActorMcCoy, 0, false);
Actor_Change_Animation_Mode(kActorMcCoy, 23);
Scene_Loop_Set_Default(5);
- Scene_Loop_Start_Special(2, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 4, true);
if (sub_4048C0()) {
if (sub_4048C0() == 3) {
Actor_Face_Heading(kActorDektora, 0, false);
diff --git a/engines/bladerunner/script/scene/hf06.cpp b/engines/bladerunner/script/scene/hf06.cpp
index 926967a2df..cd5651af0f 100644
--- a/engines/bladerunner/script/scene/hf06.cpp
+++ b/engines/bladerunner/script/scene/hf06.cpp
@@ -263,7 +263,7 @@ void SceneScriptHF06::sub_401EF4() {
Actor_Change_Animation_Mode(kActorSteele, 6);
Delay(500);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Sound_Play(562, 50, 0, 0, 50);
Game_Flag_Set(559);
Scene_Exits_Disable();
diff --git a/engines/bladerunner/script/scene/kp03.cpp b/engines/bladerunner/script/scene/kp03.cpp
index 59766c0553..4071fd6a15 100644
--- a/engines/bladerunner/script/scene/kp03.cpp
+++ b/engines/bladerunner/script/scene/kp03.cpp
@@ -69,7 +69,7 @@ bool SceneScriptKP03::ClickedOn3DObject(const char *objectName, bool a2) {
if (Object_Query_Click("BRACK MID", objectName) && !Game_Flag_Query(422)) {
if (a2) {
Scene_Loop_Set_Default(5);
- Scene_Loop_Start_Special(2, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 4, true);
Actor_Change_Animation_Mode(kActorMcCoy, 39);
Actor_Retired_Here(kActorMcCoy, 72, 18, 1, -1);
Game_Flag_Set(422);
@@ -90,7 +90,7 @@ bool SceneScriptKP03::ClickedOn3DObject(const char *objectName, bool a2) {
Game_Flag_Set(484);
Game_Flag_Reset(421);
Scene_Loop_Set_Default(7);
- Scene_Loop_Start_Special(2, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, false);
Actor_Voice_Over(1110, kActorVoiceOver);
Actor_Voice_Over(1120, kActorVoiceOver);
} else {
@@ -178,7 +178,7 @@ void SceneScriptKP03::SceneFrameAdvanced(int frame) {
}
if (v1 != -1) {
Scene_Loop_Set_Default(5);
- Scene_Loop_Start_Special(2, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 4, true);
Game_Flag_Set(422);
Game_Flag_Reset(421);
Unclickable_Object("BRACK MID");
@@ -244,7 +244,7 @@ void SceneScriptKP03::sub_401E54() {
Game_Flag_Set(484);
Game_Flag_Reset(421);
Scene_Loop_Set_Default(7);
- Scene_Loop_Start_Special(2, 7, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 7, false);
Actor_Set_Goal_Number(kActorSteele, 413);
Actor_Says(kActorMcCoy, 2195, 14);
Ambient_Sounds_Play_Sound(151, 40, -60, -60, 0);
diff --git a/engines/bladerunner/script/scene/ma01.cpp b/engines/bladerunner/script/scene/ma01.cpp
index 55fe935d74..f4963143e5 100644
--- a/engines/bladerunner/script/scene/ma01.cpp
+++ b/engines/bladerunner/script/scene/ma01.cpp
@@ -26,14 +26,14 @@ namespace BladeRunner {
void SceneScriptMA01::InitializeScene() {
Setup_Scene_Information(381.0f, 0.0f, 54.0f, 992);
- if (Game_Flag_Query(250)) {
+ if (Game_Flag_Query(kFlagMA01Locked)) {
Setup_Scene_Information(381.0f, 0.0f, 54.0f, 992);
}
- if (Game_Flag_Query(38)) {
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
Setup_Scene_Information(1446.0f, 0.0f, -725.0f, 660);
}
Scene_Exit_Add_2D_Exit(0, 328, 132, 426, 190, 0);
- if (Game_Flag_Query(250)) {
+ if (Game_Flag_Query(kFlagMA01Locked)) {
Scene_Exit_Add_2D_Exit(1, 234, 240, 398, 328, 2);
}
Ambient_Sounds_Add_Looping_Sound(101, 90, 0, 1);
@@ -44,13 +44,13 @@ void SceneScriptMA01::InitializeScene() {
Ambient_Sounds_Add_Sound(375, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(376, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
Ambient_Sounds_Add_Sound(377, 10, 70, 50, 100, 0, 0, -101, -101, 0, 0);
- if (Game_Flag_Query(38)) {
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
Scene_Loop_Set_Default(1);
- Game_Flag_Reset(38);
+ Game_Flag_Reset(kFlagMA06toMA01);
} else {
Actor_Set_Invisible(kActorMcCoy, true);
Game_Flag_Set(273);
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
Scene_Loop_Set_Default(1);
}
if (Game_Flag_Query(409)) {
@@ -95,9 +95,9 @@ bool SceneScriptMA01::ClickedOnExit(int exitId) {
Scene_Exits_Disable();
}
} else if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 1446.0f, 0.0f, -725.0f, 12, 1, false, 0)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
- Game_Flag_Set(37);
+ Game_Flag_Set(kFlagMA01toMA06);
Set_Enter(52, 52);
}
return true;
@@ -114,71 +114,71 @@ bool SceneScriptMA01::ClickedOnExit(int exitId) {
Game_Flag_Reset(177);
Game_Flag_Reset(258);
Game_Flag_Reset(178);
- int spinnerDest = Spinner_Interface_Choose_Dest(3, 0);
+ int spinnerDest = Spinner_Interface_Choose_Dest(3, false);
switch (spinnerDest) {
- case 0:
+ case kSpinnerDestinationPoliceStation:
Game_Flag_Set(178);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(251);
Set_Enter(61, 65);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 2:
+ case kSpinnerDestinationRuncitersAnimals:
Game_Flag_Set(182);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(249);
Set_Enter(69, 78);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 3:
+ case kSpinnerDestinationChinatown:
Game_Flag_Set(176);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(248);
Set_Enter(4, 13);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 5:
+ case kSpinnerDestinationTyrellBuilding:
Game_Flag_Set(261);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(307);
Set_Enter(17, 82);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 4:
+ case kSpinnerDestinationAnimoidRow:
Game_Flag_Set(180);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(252);
Set_Enter(0, 0);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 6:
+ case kSpinnerDestinationDNARow:
Game_Flag_Set(177);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(253);
Set_Enter(7, 25);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 7:
+ case kSpinnerDestinationBradburyBuilding:
Game_Flag_Set(258);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(254);
Set_Enter(20, 2);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 8:
+ case kSpinnerDestinationNightclubRow:
Game_Flag_Set(181);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(255);
Set_Enter(54, 54);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
- case 9:
+ case kSpinnerDestinationHysteriaHall:
Game_Flag_Set(257);
- Game_Flag_Reset(250);
+ Game_Flag_Reset(kFlagMA01Locked);
Game_Flag_Set(256);
Set_Enter(37, 34);
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
break;
default:
Actor_Set_Invisible(kActorMcCoy, false);
diff --git a/engines/bladerunner/script/scene/ma02.cpp b/engines/bladerunner/script/scene/ma02.cpp
index 65f88b85eb..add20cbcdf 100644
--- a/engines/bladerunner/script/scene/ma02.cpp
+++ b/engines/bladerunner/script/scene/ma02.cpp
@@ -25,7 +25,7 @@
namespace BladeRunner {
void SceneScriptMA02::InitializeScene() {
- if (Game_Flag_Query(36)) {
+ if (Game_Flag_Query(kFlagMA04ToMA02)) {
Setup_Scene_Information(-172.0f, -144.13f, 6.27f, 500);
} else {
Setup_Scene_Information(23.19f, -144.12f, 378.27f, 750);
@@ -92,7 +92,7 @@ bool SceneScriptMA02::ClickedOn3DObject(const char *objectName, bool a2) {
Actor_Voice_Over(1180, kActorVoiceOver);
Actor_Voice_Over(1190, kActorVoiceOver);
Actor_Voice_Over(1200, kActorVoiceOver);
- Actor_Clue_Acquire(kActorMcCoy, kClueCrystalsCigarette, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kClueCrystalsCigarette, true, -1);
} else {
Actor_Says(kActorMcCoy, 8526, 0);
}
@@ -102,7 +102,7 @@ bool SceneScriptMA02::ClickedOn3DObject(const char *objectName, bool a2) {
}
bool SceneScriptMA02::ClickedOnActor(int actorId) {
- if (actorId == 66 && Actor_Query_Goal_Number(kActorMaggie) == 599) {
+ if (actorId == kActorMaggie && Actor_Query_Goal_Number(kActorMaggie) == 599) {
if (!Loop_Actor_Walk_To_Actor(kActorMcCoy, kActorMaggie, 30, 1, false)) {
Actor_Face_Actor(kActorMcCoy, kActorMaggie, true);
Actor_Voice_Over(1140, kActorVoiceOver);
@@ -119,14 +119,14 @@ bool SceneScriptMA02::ClickedOnExit(int exitId) {
if (exitId == 0) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 23.19f, -144.12f, 378.27f, 0, 1, false, 0)) {
Music_Stop(10);
- Game_Flag_Set(33);
+ Game_Flag_Set(kFlagMA02toMA06);
Set_Enter(52, 52);
}
return true;
}
if (exitId == 1) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -168.0f, -144.13f, 10.27f, 0, 1, false, 0)) {
- Game_Flag_Set(35);
+ Game_Flag_Set(kFlagMA02ToMA04);
Set_Enter(50, 50);
}
return true;
@@ -145,10 +145,10 @@ void SceneScriptMA02::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo
}
void SceneScriptMA02::PlayerWalkedIn() {
- if (Game_Flag_Query(34)) {
+ if (Game_Flag_Query(kFlagMA06ToMA02)) {
sub_402044();
}
- if (Game_Flag_Query(36)) {
+ if (Game_Flag_Query(kFlagMA04ToMA02)) {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -148.12f, -144.13f, 34.27f, 0, 1, false, 0);
}
if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(655)) {
@@ -156,7 +156,7 @@ void SceneScriptMA02::PlayerWalkedIn() {
Game_Flag_Set(655);
sub_401E4C();
Loop_Actor_Walk_To_XYZ(kActorMcCoy, 23.19f, -144.12f, 378.27f, 0, 0, false, 0);
- Game_Flag_Set(33);
+ Game_Flag_Set(kFlagMA02toMA06);
Set_Enter(52, 52);
// return true;
return;
@@ -171,7 +171,7 @@ void SceneScriptMA02::PlayerWalkedIn() {
Game_Flag_Set(654);
Autosave_Game(3);
}
- if (Global_Variable_Query(1) < 4 && !Game_Flag_Query(36) && Actor_Query_Goal_Number(kActorMaggie) != 2) {
+ if (Global_Variable_Query(1) < 4 && !Game_Flag_Query(kFlagMA04ToMA02) && Actor_Query_Goal_Number(kActorMaggie) != 2) {
Actor_Set_Goal_Number(kActorMaggie, 1);
if (!Game_Flag_Query(60)) {
Game_Flag_Set(60);
@@ -187,14 +187,14 @@ void SceneScriptMA02::PlayerWalkedIn() {
}
}
}
- Game_Flag_Reset(36);
- Game_Flag_Reset(34);
+ Game_Flag_Reset(kFlagMA04ToMA02);
+ Game_Flag_Reset(kFlagMA06ToMA02);
//return false;
return;
}
void SceneScriptMA02::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
}
@@ -225,41 +225,24 @@ bool SceneScriptMA02::sub_401F7C() {
}
void SceneScriptMA02::sub_402044() {
- // int v0;
- // int v1;
- // int v3[7];
-
- // v0 = 0;
-
int i = 0;
int arr[7];
if (Global_Variable_Query(1) < 4 && Game_Flag_Query(45)) {
- // v0 = 1;
- // v3[0] = 0;
arr[i++] = 0;
}
-
- // v1 = v0 + 1;
- // v3[v0] = 1;
arr[i++] = 1;
if (Global_Variable_Query(1) >= 3) {
- // v3[v1] = 2;
- // v1 = v0 + 2;
arr[i++] = 2;
}
if (Global_Variable_Query(1) >= 2 && Global_Variable_Query(1) <= 4) {
- // v3[v1++] = 3;
arr[i++] = 3;
}
if (Game_Flag_Query(171) && Game_Flag_Query(170)) {
- // v3[v1++] = 4;
arr[i++] = 4;
}
- //if (v1 <= 0) {
if (i == 0) {
Global_Variable_Set(52, -1);
} else {
- // Global_Variable_Set(52, v3[Random_Query(0, v1 - 1)]);
Global_Variable_Set(52, arr[Random_Query(0, i - 1)]);
}
}
diff --git a/engines/bladerunner/script/scene/ma04.cpp b/engines/bladerunner/script/scene/ma04.cpp
index b0b6735d17..a7725f95e3 100644
--- a/engines/bladerunner/script/scene/ma04.cpp
+++ b/engines/bladerunner/script/scene/ma04.cpp
@@ -25,16 +25,16 @@
namespace BladeRunner {
void SceneScriptMA04::InitializeScene() {
- if (Game_Flag_Query(63)) {
+ if (Game_Flag_Query(kFlagMA05toMA04)) {
Setup_Scene_Information(-7199.0f, 953.97f, 1579.0f, 502);
if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) {
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
}
} else if (Game_Flag_Query(35)) {
Setup_Scene_Information(-7099.0f, 954.0f, 1866.0f, 502);
} else if (Game_Flag_Query(647)) {
Setup_Scene_Information(-7107.0f, 954.0f, 1742.0f, 502);
- Scene_Loop_Start_Special(0, 4, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 4, false);
} else {
Setup_Scene_Information(-7143.0f, 954.0f, 1868.0f, 733);
}
@@ -80,7 +80,7 @@ bool SceneScriptMA04::MouseClick(int x, int y) {
bool SceneScriptMA04::ClickedOn3DObject(const char *objectName, bool a2) {
if (Object_Query_Click("BED-SHEETS", objectName)) {
- sub_403DA8();
+ sleep();
return false;
}
if (Object_Query_Click("BED-TV-1", objectName) || Object_Query_Click("BED-TV-2", objectName)) {
@@ -89,7 +89,7 @@ bool SceneScriptMA04::ClickedOn3DObject(const char *objectName, bool a2) {
Unclickable_Object("BED-TV-1");
Unclickable_Object("BED-TV-2");
Sound_Play(132, 100, 0, 0, 50);
- sub_403864();
+ turnOnTV();
return false;
}
return true;
@@ -108,7 +108,7 @@ bool SceneScriptMA04::ClickedOnItem(int itemId, bool a2) {
bool SceneScriptMA04::ClickedOnExit(int exitId) {
if (exitId == 0) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7099.0f, 954.0f, 1866.0f, 0, 1, false, 0)) {
- Game_Flag_Set(36);
+ Game_Flag_Set(kFlagMA04ToMA02);
Set_Enter(10, 49);
}
return true;
@@ -121,7 +121,7 @@ bool SceneScriptMA04::ClickedOnExit(int exitId) {
Overlay_Remove("MA04OVER");
}
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 955.0f, 1675.0f, 0, 0, false, 1);
- Game_Flag_Set(62);
+ Game_Flag_Set(kFlagMA04toMA05);
if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) {
Async_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 956.17f, 1568.0f, 0, false);
}
@@ -145,7 +145,7 @@ bool SceneScriptMA04::ClickedOn2DRegion(int region) {
return false;
}
if (region == 1) {
- sub_403DA8();
+ sleep();
return true;
}
if (region == 0) {
@@ -243,7 +243,7 @@ void SceneScriptMA04::PlayerWalkedIn() {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7143.0f, 954.0f, 1868.0f, 0, 1, false, 0);
}
Game_Flag_Reset(35);
- Game_Flag_Reset(63);
+ Game_Flag_Reset(kFlagMA05toMA04);
Game_Flag_Reset(647);
if (Game_Flag_Query(61)) {
if (Global_Variable_Query(1) == 2 && !Actor_Clue_Query(kActorMcCoy, kCluePhoneCallGuzza)) {
@@ -265,9 +265,9 @@ void SceneScriptMA04::PlayerWalkedIn() {
Actor_Says(kActorGuzza, 60, 3);
Actor_Says(kActorGuzza, 70, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallGuzza, 1, kActorGuzza);
- Spinner_Set_Selectable_Destination_Flag(5, 1);
- Game_Flag_Set(186);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallGuzza, false, kActorGuzza);
+ Spinner_Set_Selectable_Destination_Flag(kSpinnerDestinationTyrellBuilding, true);
+ Game_Flag_Set(kFlagRC01PoliceDone);
if (!Game_Flag_Query(163)) {
Game_Flag_Set(163);
Item_Remove_From_World(66);
@@ -295,10 +295,10 @@ void SceneScriptMA04::PlayerWalkedIn() {
}
void SceneScriptMA04::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
if (Game_Flag_Query(678)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Outtake_Play(1, 0, -1);
Game_Flag_Reset(678);
@@ -368,7 +368,7 @@ void SceneScriptMA04::sub_4028A8() {
Actor_Says(kActorMcCoy, 2525, 15);
Actor_Says(kActorDektora, 420, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora1, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora1, true, -1);
} else {
Actor_Says_With_Pause(kActorMcCoy, 2505, 0.5f, 19);
Actor_Says(kActorDektora, 430, 3);
@@ -382,7 +382,7 @@ void SceneScriptMA04::sub_4028A8() {
Actor_Says(kActorDektora, 490, 3);
Sound_Play(123, 100, 0, 0, 50);
Actor_Says(kActorMcCoy, 2540, 15);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora2, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallDektora2, true, -1);
}
}
@@ -403,7 +403,7 @@ void SceneScriptMA04::sub_402F2C() {
if (!Game_Flag_Query(378)) {
Actor_Says(kActorLucy, 640, 3);
}
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy2, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy2, true, -1);
} else {
Actor_Says(kActorLucy, 590, 3);
Actor_Says(kActorMcCoy, 2565, 12);
@@ -416,7 +416,7 @@ void SceneScriptMA04::sub_402F2C() {
if (!Game_Flag_Query(378)) {
Actor_Says(kActorLucy, 640, 3);
}
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy1, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallLucy1, true, -1);
}
Sound_Play(123, 100, 0, 0, 50);
}
@@ -439,7 +439,7 @@ void SceneScriptMA04::sub_4032A0() {
Actor_Says(kActorSteele, 810, 3);
Actor_Says(kActorSteele, 820, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallCrystal, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallCrystal, true, -1);
}
void SceneScriptMA04::sub_4034D8() {
@@ -471,10 +471,10 @@ void SceneScriptMA04::sub_4034D8() {
Actor_Says(kActorClovis, 530, 3);
Actor_Says(kActorClovis, 540, 3);
Sound_Play(123, 100, 0, 0, 50);
- Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallClovis, 1, -1);
+ Actor_Clue_Acquire(kActorMcCoy, kCluePhoneCallClovis, true, -1);
}
-void SceneScriptMA04::sub_403864() {
+void SceneScriptMA04::turnOnTV() {
Overlay_Play("MA04OVR2", 0, 1, 0, 0);
switch (Global_Variable_Query(52)) {
case 4:
@@ -533,7 +533,7 @@ void SceneScriptMA04::sub_403864() {
}
}
-void SceneScriptMA04::sub_403DA8() {
+void SceneScriptMA04::sleep() {
if (!Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BED-SHEETS", 12, true, false)) {
Actor_Says(kActorMcCoy, 8530, 12);
Music_Stop(4);
@@ -558,7 +558,7 @@ void SceneScriptMA04::sub_403DA8() {
} else {
Set_Enter(10, 50);
}
- Scene_Loop_Start_Special(1, 3, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, false);
}
}
diff --git a/engines/bladerunner/script/scene/ma05.cpp b/engines/bladerunner/script/scene/ma05.cpp
index fabe053bd4..51ae26a7b4 100644
--- a/engines/bladerunner/script/scene/ma05.cpp
+++ b/engines/bladerunner/script/scene/ma05.cpp
@@ -47,7 +47,7 @@ void SceneScriptMA05::InitializeScene() {
Ambient_Sounds_Add_Sound(403, 3, 3, 32, 32, 100, 100, -101, -101, 0, 0);
}
if (Global_Variable_Query(1) != 2 && Global_Variable_Query(1) != 3) {
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
}
Scene_Loop_Set_Default(1);
}
@@ -78,8 +78,8 @@ bool SceneScriptMA05::ClickedOnExit(int exitId) {
if (exitId == 0) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 956.17f, 1579.0f, 0, 0, false, 0)) {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 956.17f, 1579.0f, 0, 0, false, 0);
- Game_Flag_Set(63);
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Game_Flag_Set(kFlagMA05toMA04);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Async_Actor_Walk_To_XYZ(kActorMcCoy, -7199.0f, 953.97f, 1685.0f, 0, false);
Set_Enter(50, 50);
@@ -97,7 +97,7 @@ void SceneScriptMA05::SceneFrameAdvanced(int frame) {
if (frame == 20) {
Sound_Play(102, 70, -100, 100, 50);
}
- //return true;
+ //return true;
}
void SceneScriptMA05::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bool currentSet) {
@@ -107,7 +107,7 @@ void SceneScriptMA05::PlayerWalkedIn() {
Music_Play(2, 52, 0, 2, -1, 0, 0);
if ((Random_Query(0, 4) == 1 || (Game_Flag_Query(146) == 1 && !Game_Flag_Query(61))) && Global_Variable_Query(1) == 1) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 3, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, true);
Sound_Play(69, 100, 0, 0, 50);
}
if (Game_Flag_Query(146) && !Game_Flag_Query(61)) {
diff --git a/engines/bladerunner/script/scene/ma06.cpp b/engines/bladerunner/script/scene/ma06.cpp
index 42845ecd8f..e545e291b3 100644
--- a/engines/bladerunner/script/scene/ma06.cpp
+++ b/engines/bladerunner/script/scene/ma06.cpp
@@ -28,7 +28,7 @@ void SceneScriptMA06::InitializeScene() {
Setup_Scene_Information(40.0f, 1.0f, -20.0f, 400);
Ambient_Sounds_Add_Looping_Sound(210, 50, 0, 1);
Ambient_Sounds_Add_Looping_Sound(408, 33, 0, 1);
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
Scene_Loop_Set_Default(1);
Sound_Play(209, 100, 50, 50, 100);
}
@@ -73,28 +73,29 @@ void SceneScriptMA06::PlayerWalkedIn() {
Loop_Actor_Walk_To_XYZ(kActorMcCoy, 40.0f, 1.35f, 0.0f, 0, 0, false, 0);
Actor_Face_Object(kActorMcCoy, "panel", true);
Delay(500);
- sub_4014E4();
- if (sub_4012C0()) {
+ activateElevator();
+ if (isElevatorOnDifferentFloor()) {
Sound_Play(114, 25, 0, 0, 50);
Delay(4000);
}
- Game_Flag_Reset(37);
- Game_Flag_Reset(33);
- Game_Flag_Reset(57);
- if (Game_Flag_Query(38)) {
+ Game_Flag_Reset(kFlagMA01toMA06);
+ Game_Flag_Reset(kFlagMA02toMA06);
+ Game_Flag_Reset(kFlagMA07toMA06);
+
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
Set_Enter(49, 48);
- } else if (Game_Flag_Query(34)) {
+ } else if (Game_Flag_Query(kFlagMA06ToMA02)) {
Set_Enter(10, 49);
- } else {
+ } else { // kFlagMA06ToMA07
Set_Enter(53, 53);
}
- Scene_Loop_Start_Special(1, 3, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 3, true);
Sound_Play(208, 100, 50, 50, 50);
//return true;
}
void SceneScriptMA06::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Player_Gains_Control();
}
@@ -102,34 +103,36 @@ void SceneScriptMA06::PlayerWalkedOut() {
void SceneScriptMA06::DialogueQueueFlushed(int a1) {
}
-bool SceneScriptMA06::sub_4012C0() {
- return (Game_Flag_Query(37) && !Game_Flag_Query(38)) || (Game_Flag_Query(33) && !Game_Flag_Query(34)) || (Game_Flag_Query(57) && !Game_Flag_Query(58));
+bool SceneScriptMA06::isElevatorOnDifferentFloor() {
+ return (Game_Flag_Query(kFlagMA01toMA06) && !Game_Flag_Query(kFlagMA06toMA01))
+ || (Game_Flag_Query(kFlagMA02toMA06) && !Game_Flag_Query(kFlagMA06ToMA02))
+ || (Game_Flag_Query(kFlagMA07toMA06) && !Game_Flag_Query(kFlagMA06toMA07));
}
-void SceneScriptMA06::sub_4014E4() {
- Game_Flag_Reset(38);
- Game_Flag_Reset(34);
- Game_Flag_Reset(58);
+void SceneScriptMA06::activateElevator() {
+ Game_Flag_Reset(kFlagMA06toMA01);
+ Game_Flag_Reset(kFlagMA06ToMA02);
+ Game_Flag_Reset(kFlagMA06toMA07);
while (true) {
- if (Game_Flag_Query(34)) {
+ if (Game_Flag_Query(kFlagMA06ToMA02)) {
break;
}
- if (Game_Flag_Query(38)) {
+ if (Game_Flag_Query(kFlagMA06toMA01)) {
break;
}
- if (Game_Flag_Query(58)) {
+ if (Game_Flag_Query(kFlagMA06toMA07)) {
break;
}
Actor_Says(kActorAnsweringMachine, 80, 3);
Player_Gains_Control();
- int v1 = Elevator_Activate(1);
+ int floor = Elevator_Activate(1);
Player_Loses_Control();
- Scene_Loop_Start_Special(2, 1, 1);
- if (v1 > 1) {
- Game_Flag_Set(58);
- } else if (v1 == 1) {
- if (Game_Flag_Query(250)) {
- Game_Flag_Set(38);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 1, true);
+ if (floor > 1) {
+ Game_Flag_Set(kFlagMA06toMA07);
+ } else if (floor == 1) {
+ if (Game_Flag_Query(kFlagMA01Locked)) {
+ Game_Flag_Set(kFlagMA06toMA01);
} else {
Sound_Play(412, 100, 0, 0, 50);
Delay(500);
@@ -144,7 +147,7 @@ void SceneScriptMA06::sub_4014E4() {
Delay(500);
Actor_Says(kActorMcCoy, 8527, 3);
} else {
- Game_Flag_Set(34);
+ Game_Flag_Set(kFlagMA06ToMA02);
Actor_Says(kActorAnsweringMachine, 90, 3);
}
}
diff --git a/engines/bladerunner/script/scene/ma07.cpp b/engines/bladerunner/script/scene/ma07.cpp
index 59d1593012..aa87a37721 100644
--- a/engines/bladerunner/script/scene/ma07.cpp
+++ b/engines/bladerunner/script/scene/ma07.cpp
@@ -76,9 +76,9 @@ bool SceneScriptMA07::ClickedOnExit(int exitId) {
if (Global_Variable_Query(1) == 4 && Game_Flag_Query(671)) {
Actor_Set_Goal_Number(kActorMcCoy, 400);
} else {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
- Game_Flag_Set(57);
+ Game_Flag_Set(kFlagMA07toMA06);
Set_Enter(52, 52);
}
}
@@ -86,7 +86,7 @@ bool SceneScriptMA07::ClickedOnExit(int exitId) {
}
if (exitId == 1) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -400.0f, -162.8f, 185.08f, 0, 1, false, 0)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Game_Flag_Set(672);
Game_Flag_Reset(179);
@@ -143,7 +143,7 @@ void SceneScriptMA07::PlayerWalkedIn() {
Actor_Voice_Over(1400, kActorVoiceOver);
Delay(1000);
Game_Flag_Reset(666);
- Game_Flag_Set(34);
+ Game_Flag_Set(kFlagMA06ToMA02);
Set_Enter(10, 49);
}
//return false;
diff --git a/engines/bladerunner/script/scene/nr08.cpp b/engines/bladerunner/script/scene/nr08.cpp
index 15d5be7451..70b8542173 100644
--- a/engines/bladerunner/script/scene/nr08.cpp
+++ b/engines/bladerunner/script/scene/nr08.cpp
@@ -150,7 +150,7 @@ void SceneScriptNR08::SceneFrameAdvanced(int frame) {
Game_Flag_Set(636);
Scene_Exits_Disable();
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 3, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, true);
}
if (frame == 95) {
Actor_Put_In_Set(kActorDektora, 91);
diff --git a/engines/bladerunner/script/scene/nr10.cpp b/engines/bladerunner/script/scene/nr10.cpp
index 77f3cab3f6..8c07ac47a1 100644
--- a/engines/bladerunner/script/scene/nr10.cpp
+++ b/engines/bladerunner/script/scene/nr10.cpp
@@ -71,7 +71,7 @@ bool SceneScriptNR10::ClickedOn3DObject(const char *objectName, bool a2) {
Ambient_Sounds_Remove_Looping_Sound(452, true);
Sound_Play(453, 52, 0, 0, 50);
Scene_Loop_Set_Default(0);
- Scene_Loop_Start_Special(2, 0, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, true);
Un_Combat_Target_Object("BOX18");
Scene_Exits_Enable();
return true;
diff --git a/engines/bladerunner/script/scene/nr11.cpp b/engines/bladerunner/script/scene/nr11.cpp
index c194f5a17a..8c282d3387 100644
--- a/engines/bladerunner/script/scene/nr11.cpp
+++ b/engines/bladerunner/script/scene/nr11.cpp
@@ -122,7 +122,7 @@ bool SceneScriptNR11::ClickedOn3DObject(const char *objectName, bool a2) {
}
Actor_Set_Goal_Number(kActorMcCoy, 230);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
} else if (Actor_Query_Goal_Number(kActorDektora) == 250) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 24.0f, 0.33f, 0.0f, 0, 1, false, 0)) {
Actor_Face_XYZ(kActorMcCoy, -180.0f, 0.0f, -170.0f, true);
@@ -260,7 +260,7 @@ void SceneScriptNR11::SceneFrameAdvanced(int frame) {
}
Actor_Set_Goal_Number(kActorMcCoy, 230);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Game_Flag_Reset(635);
} else {
if (frame < 61 || frame > 120) {
diff --git a/engines/bladerunner/script/scene/ps05.cpp b/engines/bladerunner/script/scene/ps05.cpp
index 656550e864..32eb5d5b46 100644
--- a/engines/bladerunner/script/scene/ps05.cpp
+++ b/engines/bladerunner/script/scene/ps05.cpp
@@ -162,31 +162,26 @@ void SceneScriptPS05::DialogueQueueFlushed(int a1) {
}
void SceneScriptPS05::sub_401B34() {
- int v0;
- int v1;
- int v3[7];
-
- v0 = 0;
+ int i = 0;
+ int arr[7];
if (Global_Variable_Query(1) < 4 && Game_Flag_Query(45)) {
- v0 = 1;
- v3[0] = 0;
+ arr[i++] = 0;
}
- v1 = v0 + 1;
- v3[v0] = 1;
+ arr[i++] = 1;
if (Global_Variable_Query(1) >= 3) {
- v3[v1] = 2;
- v1 = v0 + 2;
+ arr[i++] = 2;
}
if (Global_Variable_Query(1) >= 2 && Global_Variable_Query(1) <= 4) {
- v3[v1++] = 3;
+ arr[i++] = 3;
}
if (Game_Flag_Query(171) && Game_Flag_Query(170)) {
- v3[v1++] = 4;
+ arr[i++] = 4;
}
- if (v1 <= 0) {
+ if (i == 0) {
Global_Variable_Set(52, -1);
- } else {
- Global_Variable_Set(52, v3[Random_Query(0, v1 - 1)]);
+ }
+ else {
+ Global_Variable_Set(52, arr[Random_Query(0, i - 1)]);
}
}
diff --git a/engines/bladerunner/script/scene/rc01.cpp b/engines/bladerunner/script/scene/rc01.cpp
index 642f4c7bb0..8a5b728c86 100644
--- a/engines/bladerunner/script/scene/rc01.cpp
+++ b/engines/bladerunner/script/scene/rc01.cpp
@@ -27,11 +27,11 @@ namespace BladeRunner {
void SceneScriptRC01::InitializeScene() {
#if _DEBUG
//TODO: not part of game, remove
- //Game_Flag_Set(24); // force skip intro
+ //Game_Flag_Set(kFlagIntroPlayed); // force skip intro
#endif
- if (!Game_Flag_Query(24)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ if (!Game_Flag_Query(kFlagIntroPlayed)) {
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Outtake_Play(28, 1, -1); // WSTLGO_E.VQA
Outtake_Play(41, 1, -1); // BRLOGO_E.VQA
@@ -52,14 +52,14 @@ void SceneScriptRC01::InitializeScene() {
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)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone)) {
Scene_2D_Region_Add(0, 0, 294, 296, 479);
}
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(0);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(false);
Ambient_Sounds_Add_Looping_Sound(54, 30, 0, 1); // CTRAIN1.AUD
- if (!Game_Flag_Query(186)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone)) {
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
@@ -83,9 +83,9 @@ void SceneScriptRC01::InitializeScene() {
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(kFlagRC01PoliceDone)) {
if (!Game_Flag_Query(9) && !Game_Flag_Query(114)) {
- Scene_Loop_Start_Special(0, 5, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 5, false);
}
if (Game_Flag_Query(249)) {
Scene_Loop_Set_Default(6);
@@ -94,7 +94,7 @@ void SceneScriptRC01::InitializeScene() {
}
} else {
if (!Game_Flag_Query(9) && !Game_Flag_Query(114)) {
- Scene_Loop_Start_Special(0, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopModeLoseControl, 0, false);
}
Scene_Loop_Set_Default(1);
}
@@ -148,7 +148,7 @@ void SceneScriptRC01::SceneLoaded() {
Unclickable_Object("DOORWAY01");
Unobstacle_Object("DOORWAY01", true);
- if (Game_Flag_Query(186)) {
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
Unclickable_Object("70_1");
Unclickable_Object("70_2");
Unclickable_Object("70_3");
@@ -169,7 +169,7 @@ void SceneScriptRC01::SceneLoaded() {
Unobstacle_Object("BARICADE05", true);
}
- if (!Game_Flag_Query(186)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone)) {
Preload(13);
Preload(14);
Preload(19);
@@ -181,7 +181,7 @@ void SceneScriptRC01::SceneLoaded() {
Item_Add_To_World(66, 938, 69, -148.60f, -0.30f, 225.15f, 256, 24, 24, false, true, false, true);
}
- if (!Game_Flag_Query(24)) {
+ if (!Game_Flag_Query(kFlagIntroPlayed)) {
ADQ_Flush();
Actor_Voice_Over(1830, kActorVoiceOver);
Actor_Voice_Over(1850, kActorVoiceOver);
@@ -190,7 +190,7 @@ void SceneScriptRC01::SceneLoaded() {
I_Sez("MG: Is David Leary a self-respecting human or is he powered by rechargeable");
I_Sez("batteries?\n");
}
- Game_Flag_Set(24);
+ Game_Flag_Set(kFlagIntroPlayed);
}
}
@@ -343,7 +343,7 @@ bool SceneScriptRC01::ClickedOnItem(int itemId, bool a2) {
}
-void SceneScriptRC01::sub_4037AC() {
+void SceneScriptRC01::walkToCenter() {
Player_Loses_Control();
Game_Flag_Set(182);
Actor_Set_Immunity_To_Obstacles(kActorMcCoy, true);
@@ -378,7 +378,7 @@ bool SceneScriptRC01::ClickedOnExit(int exitId) {
}
if (exitId == 1) {
if (Game_Flag_Query(486)) {
- Spinner_Set_Selectable_Destination_Flag(6, 1);
+ Spinner_Set_Selectable_Destination_Flag(kSpinnerDestinationDNARow, true);
}
I_Sez("MG: Leaving already? The fun is just beginning!");
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -151.98f, -0.3f, 318.15f, 0, 1, false, 0)) {
@@ -400,115 +400,115 @@ bool SceneScriptRC01::ClickedOnExit(int exitId) {
Game_Flag_Reset(179);
Game_Flag_Reset(178);
int spinnerDest;
- if (Game_Flag_Query(186)) {
- spinnerDest = Spinner_Interface_Choose_Dest(8, 1);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ spinnerDest = Spinner_Interface_Choose_Dest(kSpinnerDestinationNightclubRow, true);
} else {
- spinnerDest = Spinner_Interface_Choose_Dest(3, 1);
+ spinnerDest = Spinner_Interface_Choose_Dest(kSpinnerDestinationChinatown, true);
}
- if (spinnerDest) {
- switch (spinnerDest) {
- case 1:
- Game_Flag_Set(179);
- Game_Flag_Reset(249);
- Game_Flag_Set(250);
- Set_Enter(49, 48);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 3:
- Game_Flag_Set(176);
- Game_Flag_Reset(249);
- Game_Flag_Set(248);
- Set_Enter(4, 13);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 5:
- Game_Flag_Set(261);
- Game_Flag_Reset(249);
- Game_Flag_Set(307);
- Set_Enter(17, 82);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 4:
- Game_Flag_Set(180);
- Game_Flag_Reset(249);
- Game_Flag_Set(252);
- Set_Enter(0, 0);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 6:
- Game_Flag_Set(177);
- Game_Flag_Reset(249);
- Game_Flag_Set(253);
- Set_Enter(7, 25);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 7:
- Game_Flag_Set(258);
- Game_Flag_Reset(249);
- Game_Flag_Set(254);
- Set_Enter(20, 2);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 8:
- Game_Flag_Set(181);
- Game_Flag_Reset(249);
- Game_Flag_Set(255);
- Set_Enter(54, 54);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- case 9:
- Game_Flag_Set(257);
- Game_Flag_Reset(249);
- Game_Flag_Set(256);
- Set_Enter(37, 34);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
- } else {
- Scene_Loop_Start_Special(1, 4, 1);
- }
- break;
- default:
- sub_4037AC();
- break;
- }
- } else {
+
+ switch (spinnerDest) {
+ case kSpinnerDestinationPoliceStation:
Game_Flag_Set(178);
Game_Flag_Reset(249);
Game_Flag_Set(251);
Set_Enter(61, 65);
- if (Game_Flag_Query(186)) {
- Scene_Loop_Start_Special(1, 9, 1);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationMcCoysApartment:
+ Game_Flag_Set(179);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(250);
+ Set_Enter(49, 48);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationChinatown:
+ Game_Flag_Set(176);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(248);
+ Set_Enter(4, 13);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationTyrellBuilding:
+ Game_Flag_Set(261);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(307);
+ Set_Enter(17, 82);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationAnimoidRow:
+ Game_Flag_Set(180);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(252);
+ Set_Enter(0, 0);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationDNARow:
+ Game_Flag_Set(177);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(253);
+ Set_Enter(7, 25);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationBradburyBuilding:
+ Game_Flag_Set(258);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(254);
+ Set_Enter(20, 2);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationNightclubRow:
+ Game_Flag_Set(181);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(255);
+ Set_Enter(54, 54);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
+ } else {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
+ }
+ break;
+ case kSpinnerDestinationHysteriaHall:
+ Game_Flag_Set(257);
+ Game_Flag_Reset(249);
+ Game_Flag_Set(256);
+ Set_Enter(37, 34);
+ if (Game_Flag_Query(kFlagRC01PoliceDone)) {
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 9, true);
} else {
- Scene_Loop_Start_Special(1, 4, 1);
+ Scene_Loop_Start_Special(kSceneLoopModeChangeSet, 4, true);
}
+ break;
+ default:
+ walkToCenter();
+ break;
}
}
return true;
@@ -526,7 +526,7 @@ bool SceneScriptRC01::ClickedOnExit(int exitId) {
}
void SceneScriptRC01::sub_403850() {
- if (!Game_Flag_Query(186) && !Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BARICADE03", 36, true, false)) {
+ if (!Game_Flag_Query(kFlagRC01PoliceDone) && !Loop_Actor_Walk_To_Scene_Object(kActorMcCoy, "BARICADE03", 36, true, false)) {
Actor_Set_Goal_Number(kActorOfficerLeary, 0);
Actor_Face_Object(kActorMcCoy, "BARICADE03", true);
Loop_Actor_Walk_To_Actor(kActorOfficerLeary, kActorMcCoy, 36, 1, false);
@@ -575,7 +575,7 @@ void SceneScriptRC01::ActorChangedGoal(int actorId, int newGoal, int oldGoal, bo
void SceneScriptRC01::PlayerWalkedIn() {
if (Game_Flag_Query(249) && !Game_Flag_Query(9) && !Game_Flag_Query(114)) {
- sub_4037AC();
+ walkToCenter();
}
if (Game_Flag_Query(114)) {
@@ -603,10 +603,10 @@ void SceneScriptRC01::PlayerWalkedIn() {
}
void SceneScriptRC01::PlayerWalkedOut() {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
if (!Game_Flag_Query(8) && !Game_Flag_Query(115) && Global_Variable_Query(1)) {
- Ambient_Sounds_Remove_All_Non_Looping_Sounds(1);
+ Ambient_Sounds_Remove_All_Non_Looping_Sounds(true);
Ambient_Sounds_Remove_All_Looping_Sounds(1);
Outtake_Play(31, 1, -1);
}
diff --git a/engines/bladerunner/script/scene/tb07.cpp b/engines/bladerunner/script/scene/tb07.cpp
index d296e90467..efd4fba197 100644
--- a/engines/bladerunner/script/scene/tb07.cpp
+++ b/engines/bladerunner/script/scene/tb07.cpp
@@ -254,7 +254,7 @@ void SceneScriptTB07::sub_401B0C() {
Actor_Set_At_XYZ(kActorTyrell, 68.0f, 12.0f, 288.0f, 0);
Actor_Change_Animation_Mode(kActorTyrell, 0);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, false);
Actor_Start_Speech_Sample(kActorTyrell, 0);
Loop_Actor_Walk_To_XYZ(kActorTyrell, 44.0f, 12.0f, 176.0f, 0, 0, false, 0);
Actor_Face_Actor(kActorTyrell, kActorMcCoy, true);
diff --git a/engines/bladerunner/script/scene/ug01.cpp b/engines/bladerunner/script/scene/ug01.cpp
index 96e3cf1533..91d0d63467 100644
--- a/engines/bladerunner/script/scene/ug01.cpp
+++ b/engines/bladerunner/script/scene/ug01.cpp
@@ -80,7 +80,7 @@ bool SceneScriptUG01::ClickedOn3DObject(const char *objectName, bool a2) {
if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, -9.0f, -50.13f, -148.0f, 0, 1, false, 0) && !Game_Flag_Query(324)) {
Actor_Says(kActorMcCoy, 8525, 13);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Game_Flag_Set(324);
} else {
Actor_Says(kActorMcCoy, 8525, 13);
diff --git a/engines/bladerunner/script/scene/ug10.cpp b/engines/bladerunner/script/scene/ug10.cpp
index dfb616471f..1f07c6d828 100644
--- a/engines/bladerunner/script/scene/ug10.cpp
+++ b/engines/bladerunner/script/scene/ug10.cpp
@@ -74,7 +74,7 @@ void SceneScriptUG10::SceneLoaded() {
Obstacle_Object("SLUICEGATE_LEVER", true);
if (Global_Variable_Query(1) == 4 && !Game_Flag_Query(474) && Game_Flag_Query(172) && !Game_Flag_Query(693)) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 6, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 6, true);
Game_Flag_Set(693);
//return true;
}
@@ -158,13 +158,13 @@ bool SceneScriptUG10::ClickedOn2DRegion(int region) {
} else if (!Loop_Actor_Walk_To_XYZ(kActorMcCoy, 4.98f, 0.38f, 83.15f, 0, 1, false, 0)) {
if (Game_Flag_Query(474)) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, false);
Game_Flag_Reset(474);
Obstacle_Object("BOX01 BRIDGE", true);
Player_Loses_Control();
} else {
Scene_Loop_Set_Default(4);
- Scene_Loop_Start_Special(2, 3, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, false);
Game_Flag_Set(474);
Unobstacle_Object("BOX01 BRIDGE", true);
Player_Loses_Control();
diff --git a/engines/bladerunner/script/scene/ug13.cpp b/engines/bladerunner/script/scene/ug13.cpp
index 0188782316..f380f07ace 100644
--- a/engines/bladerunner/script/scene/ug13.cpp
+++ b/engines/bladerunner/script/scene/ug13.cpp
@@ -87,13 +87,13 @@ bool SceneScriptUG13::ClickedOn3DObject(const char *objectName, bool a2) {
Actor_Face_Object(kActorMcCoy, "BOLLARD", true);
if (Game_Flag_Query(431)) {
Scene_Loop_Set_Default(1);
- Scene_Loop_Start_Special(2, 0, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 0, false);
Game_Flag_Reset(431);
Game_Flag_Set(436);
return true;
} else {
Scene_Loop_Set_Default(4);
- Scene_Loop_Start_Special(2, 3, 0);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 3, false);
Game_Flag_Set(431);
Scene_Exit_Remove(0);
return true;
diff --git a/engines/bladerunner/script/scene/ug15.cpp b/engines/bladerunner/script/scene/ug15.cpp
index b866561367..6d0ae376e5 100644
--- a/engines/bladerunner/script/scene/ug15.cpp
+++ b/engines/bladerunner/script/scene/ug15.cpp
@@ -168,7 +168,7 @@ void SceneScriptUG15::SceneFrameAdvanced(int frame) {
Game_Flag_Set(724);
Game_Flag_Set(682);
Scene_Loop_Set_Default(3);
- Scene_Loop_Start_Special(2, 2, 1);
+ Scene_Loop_Start_Special(kSceneLoopMode2, 2, true);
Actor_Set_Goal_Number(kActorMcCoy, 390);
Actor_Query_XYZ(kActorFreeSlotA, &x, &y, &z);
if (-200.0f < x && -62.0f > x) {
diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp
index 25d78e4991..aa3e23da52 100644
--- a/engines/bladerunner/script/script.cpp
+++ b/engines/bladerunner/script/script.cpp
@@ -38,6 +38,7 @@
#include "bladerunner/items.h"
#include "bladerunner/item_pickup.h"
#include "bladerunner/movement_track.h"
+#include "bladerunner/music.h"
#include "bladerunner/overlays.h"
#include "bladerunner/regions.h"
#include "bladerunner/set.h"
@@ -423,12 +424,14 @@ int ScriptBase::Actor_Query_Animation_Mode(int actorId) {
bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int distance, int a4, bool run) {
_vm->gameWaitForActive();
- if (actorId == _vm->_walkingActorId) {
+ if (_vm->_walkingActorId == actorId) {
run = true;
}
_vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToActor(otherActorId, distance, a4, run, true, &isRunning);
+
if (_vm->_playerActorIdle) {
result = true;
_vm->_playerActorIdle = false;
@@ -436,8 +439,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Actor(int actorId, int otherActorId, int dis
if (isRunning == 1) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
@@ -449,7 +452,9 @@ bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4
}
_vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToItem(itemId, a3, a4, run, true, &isRunning);
+
if (_vm->_playerActorIdle == 1) {
result = true;
_vm->_playerActorIdle = false;
@@ -457,8 +462,8 @@ bool ScriptBase::Loop_Actor_Walk_To_Item(int actorId, int itemId, int a3, int a4
if (isRunning == 1) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
@@ -470,7 +475,9 @@ bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *object
}
_vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToSceneObject(objectName, destinationOffset, a4, run, true, &isRunning);
+
if (_vm->_playerActorIdle) {
result = true;
_vm->_playerActorIdle = false;
@@ -478,52 +485,79 @@ bool ScriptBase::Loop_Actor_Walk_To_Scene_Object(int actorId, const char *object
if (isRunning == 1) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
bool ScriptBase::Loop_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int a4, bool run) {
- //TODO
- warning("Loop_Actor_Walk_To_Waypoint(%d, %d, %d, %d, %d)", actorId, waypointId, destinationOffset, a4, run);
- return false;
+ _vm->gameWaitForActive();
+
+ if (_vm->_walkingActorId == actorId) {
+ run = true;
+ }
+ _vm->_playerActorIdle = false;
+ bool isRunning;
+
+ bool result = _vm->_actors[actorId]->loopWalkToWaypoint(waypointId, destinationOffset, a4, run, true, &isRunning);
+
+ if (_vm->_playerActorIdle) {
+ result = true;
+ _vm->_playerActorIdle = false;
+ }
+ if (isRunning == 1) {
+ _vm->_walkingActorId = actorId;
+ }
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
+ return result;
}
bool ScriptBase::Loop_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, int a5, bool run, int a7) {
_vm->gameWaitForActive();
- if(_vm->_walkingActorId == actorId) {
- if(a7) {
+ if (_vm->_walkingActorId == actorId) {
+ if (a7) {
_vm->_walkingActorId = -1;
} else {
run = true;
}
}
- //TODO:
- //PlayerActorIdle = 0;
+ _vm->_playerActorIdle = false;
bool isRunning;
+
bool result = _vm->_actors[actorId]->loopWalkToXYZ(Vector3(x, y, z), destinationOffset, a5, run, true, &isRunning);
-// if (PlayerActorIdle == 1) {
-// result = 1;
-// PlayerActorIdle = 0;
-// }
- if(isRunning) {
+ if (_vm->_playerActorIdle) {
+ result = true;
+ _vm->_playerActorIdle = false;
+ }
+ if (isRunning) {
_vm->_walkingActorId = actorId;
}
- Global_Variable_Set(37, actorId);
- Global_Variable_Set(38, isRunning);
+ Global_Variable_Set(kVariableWalkLoopActor, actorId);
+ Global_Variable_Set(kVariableWalkLoopRun, isRunning);
return result;
}
void ScriptBase::Async_Actor_Walk_To_Waypoint(int actorId, int waypointId, int destinationOffset, int run) {
- //TODO
- warning("Async_Actor_Walk_To_Waypoint(%d, %d, %d, %d)", actorId, waypointId, destinationOffset, run);
+ _vm->gameWaitForActive();
+
+ if (_vm->_walkingActorId == actorId) {
+ run = true;
+ }
+
+ _vm->_actors[actorId]->asyncWalkToWaypoint(waypointId, destinationOffset, run, true);
}
void ScriptBase::Async_Actor_Walk_To_XYZ(int actorId, float x, float y, float z, int destinationOffset, bool run) {
- //TODO
- warning("Async_Actor_Walk_To_XYZ(%d, %f, %f, %f, %d, %d)", actorId, x, y, z, destinationOffset, run);
+ _vm->gameWaitForActive();
+
+ if (_vm->_walkingActorId == actorId) {
+ run = true;
+ }
+
+ _vm->_actors[actorId]->asyncWalkToXYZ(Vector3(x, y, z), destinationOffset, run, true);
}
void ScriptBase::Actor_Force_Stop_Walking(int actorId) {
@@ -796,30 +830,25 @@ void ScriptBase::Footstep_Sound_Override_Off() {
_vm->_scene->_set->resetFoodstepSoundOverride();
}
-bool ScriptBase::Music_Play(int a1, int a2, int a3, int a4, int a5, int a6, int a7) {
- //TODO
- warning("Music_Play(%d, %d, %d, %d, %d, %d, %d)", a1, a2, a3, a4, a5, a6, a7);
- return false;
+bool ScriptBase::Music_Play(int musicId, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut) {
+ const char *musicName = _vm->_gameInfo->getMusicTrack(musicId);
+ return _vm->_music->play(musicName, volume, pan, timeFadeIn, timePlay, loop, timeFadeOut);
}
-void ScriptBase::Music_Adjust(int a1, int a2, int a3) {
- //TODO
- warning("Music_Adjust(%d, %d, %d)", a1, a2, a3);
+void ScriptBase::Music_Adjust(int volume, int pan, int delay) {
+ _vm->_music->adjust(volume, pan, delay);
}
-void ScriptBase::Music_Stop(int a1) {
- //TODO
- warning("Music_Stop(%d)", a1);
+void ScriptBase::Music_Stop(int delay) {
+ _vm->_music->stop(delay);
}
bool ScriptBase::Music_Is_Playing() {
- //TODO
- warning("Music_Is_Playing()");
- return false;
+ return _vm->_music->isPlaying();
}
-void ScriptBase::Overlay_Play(const char *overlay, int a2, int a3, int a4, int a5) {
- _vm->_overlays->play(overlay, a2, a3, a4, a5);
+void ScriptBase::Overlay_Play(const char *overlay, int loopId, int loopForever, int startNow, int a5) {
+ _vm->_overlays->play(overlay, loopId, loopForever, startNow, a5);
}
void ScriptBase::Overlay_Remove(const char *overlay) {
@@ -908,7 +937,7 @@ bool ScriptBase::Dialogue_Menu_Clear_List() {
}
bool ScriptBase::Dialogue_Menu_Add_To_List(int answer) {
- _vm->_dialogueMenu->addToList(answer, 0, 5, 5, 5);
+ _vm->_dialogueMenu->addToList(answer, false, 5, 5, 5);
return false;
}
diff --git a/engines/bladerunner/script/script.h b/engines/bladerunner/script/script.h
index c282bccd1d..48bda147d6 100644
--- a/engines/bladerunner/script/script.h
+++ b/engines/bladerunner/script/script.h
@@ -429,6 +429,34 @@ enum SpinnerDestinations {
kSpinnerDestinationHysteriaHall = 9
};
+enum Flags {
+ kFlagIntroPlayed = 24,
+ kFlagMA02toMA06 = 33,
+ kFlagMA06ToMA02 = 34,
+ kFlagMA02ToMA04 = 35,
+ kFlagMA04ToMA02 = 36,
+ kFlagMA01toMA06 = 37,
+ kFlagMA06toMA01 = 38,
+ kFlagMA07toMA06 = 57,
+ kFlagMA06toMA07 = 58,
+ kFlagMA04toMA05 = 62,
+ kFlagMA05toMA04 = 63,
+ kFlagRC01PoliceDone = 186,
+ kFlagMA01Locked = 250
+};
+
+enum Variables {
+ kVariableWalkLoopActor = 37,
+ kVariableWalkLoopRun = 38
+};
+
+enum Outtakes {
+ kOuttakeIntro = 0,
+ kOuttakeWestwood = 28,
+ kOuttakeDescent = 33,
+ kOuttakeBladeRunner = 41
+};
+
class BladeRunnerEngine;
class ScriptBase {
@@ -561,11 +589,11 @@ protected:
void Footstep_Sounds_Set(int index, int value);
void Footstep_Sound_Override_On(int footstepSoundOverride);
void Footstep_Sound_Override_Off();
- bool Music_Play(int a1, int a2, int a3, int a4, int a5, int a6, int a7);
- void Music_Adjust(int a1, int a2, int a3);
- void Music_Stop(int a1);
+ bool Music_Play(int musicId, int volume, int pan, int timeFadeIn, int timePlay, int loop, int timeFadeOut);
+ void Music_Adjust(int volume, int pan, int delay);
+ void Music_Stop(int delay);
bool Music_Is_Playing();
- void Overlay_Play(const char *overlay, int a2, int a3, int a4, int a5);
+ void Overlay_Play(const char *overlay, int loopId, int loopForever, int startNow, int a5);
void Overlay_Remove(const char *overlay);
void Scene_Loop_Set_Default(int loopId);
void Scene_Loop_Start_Special(int sceneLoopMode, int loopId, bool immediately);
diff --git a/engines/bladerunner/settings.cpp b/engines/bladerunner/settings.cpp
index 81def7ea93..7db1192c89 100644
--- a/engines/bladerunner/settings.cpp
+++ b/engines/bladerunner/settings.cpp
@@ -22,8 +22,10 @@
#include "bladerunner/settings.h"
+#include "bladerunner/ambient_sounds.h"
#include "bladerunner/bladerunner.h"
#include "bladerunner/chapters.h"
+#include "bladerunner/music.h"
#include "bladerunner/scene.h"
#include "common/debug.h"
@@ -54,10 +56,9 @@ bool Settings::openNewScene() {
assert(_newScene != -1);
if (_startingGame) {
- // Stop ambient audio and music
-// ambient::removeAllNonLoopingSounds(Ambient, 1);
-// ambient::removeAllLoopingSounds(Ambient, 1);
-// music::stop(Music, 2);
+ _vm->_ambientSounds->removeAllNonLoopingSounds(true);
+ _vm->_ambientSounds->removeAllLoopingSounds(1);
+ _vm->_music->stop(2);
}
int currentSet = _vm->_scene->getSetId();
diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp
index 34c910742c..0bbd201ee0 100644
--- a/engines/bladerunner/slice_renderer.cpp
+++ b/engines/bladerunner/slice_renderer.cpp
@@ -22,9 +22,9 @@
#include "bladerunner/slice_renderer.h"
-#include "bladerunner/aesc.h"
#include "bladerunner/bladerunner.h"
#include "bladerunner/lights.h"
+#include "bladerunner/screen_effects.h"
#include "bladerunner/set_effects.h"
#include "bladerunner/slice_animations.h"
@@ -47,8 +47,8 @@ SliceRenderer::SliceRenderer(BladeRunnerEngine *vm) {
SliceRenderer::~SliceRenderer() {
}
-void SliceRenderer::setAESC(AESC *aesc) {
- _aesc = aesc;
+void SliceRenderer::setScreenEffects(ScreenEffects *screenEffects) {
+ _screenEffects = screenEffects;
}
void SliceRenderer::setView(const View &view) {
@@ -531,7 +531,7 @@ void SliceRenderer::drawSlice(int slice, bool advanced, uint16 *frameLinePtr, ui
int color555 = palette.color555[p[2]];
if (advanced) {
Color256 aescColor = { 0, 0, 0 };
- _aesc->getColor(&aescColor, vertexX, y, vertexZ);
+ _screenEffects->getColor(&aescColor, vertexX, y, vertexZ);
Color256 color = palette.color[p[2]];
color.r = ((int)(_setEffectColor.r + _lightsColor.r * color.r) >> 16) + aescColor.r;
diff --git a/engines/bladerunner/slice_renderer.h b/engines/bladerunner/slice_renderer.h
index fbdcdf3617..aeca8c6c2d 100644
--- a/engines/bladerunner/slice_renderer.h
+++ b/engines/bladerunner/slice_renderer.h
@@ -38,7 +38,7 @@ class MemoryReadStream;
namespace BladeRunner {
-class AESC;
+class ScreenEffects;
class BladeRunnerEngine;
class Lights;
class SetEffects;
@@ -52,7 +52,7 @@ class SliceRenderer {
float _facing;
float _scale;
- AESC *_aesc;
+ ScreenEffects *_screenEffects;
View _view;
Lights *_lights;
SetEffects *_setEffects;
@@ -95,7 +95,7 @@ public:
SliceRenderer(BladeRunnerEngine *vm);
~SliceRenderer();
- void setAESC(AESC *aesc);
+ void setScreenEffects(ScreenEffects *aesc);
void setView(const View &view);
void setLights(Lights *lights);
void setSetEffects(SetEffects *setEffects);
diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp
index 53751afcd6..832e95aa2b 100644
--- a/engines/bladerunner/vqa_decoder.cpp
+++ b/engines/bladerunner/vqa_decoder.cpp
@@ -22,11 +22,11 @@
#include "bladerunner/vqa_decoder.h"
-#include "bladerunner/aesc.h"
#include "bladerunner/bladerunner.h"
#include "bladerunner/decompress_lcw.h"
#include "bladerunner/decompress_lzo.h"
#include "bladerunner/lights.h"
+#include "bladerunner/screen_effects.h"
#include "bladerunner/view.h"
#include "bladerunner/zbuffer.h"
@@ -211,8 +211,8 @@ void VQADecoder::decodeView(View *view) {
_videoTrack->decodeView(view);
}
-void VQADecoder::decodeAESC(AESC *aesc) {
- _videoTrack->decodeAESC(aesc);
+void VQADecoder::decodeScreenEffects(ScreenEffects *screenEffects) {
+ _videoTrack->decodeScreenEffects(screenEffects);
}
void VQADecoder::decodeLights(Lights *lights) {
@@ -598,7 +598,7 @@ VQADecoder::VQAVideoTrack::VQAVideoTrack(VQADecoder *vqaDecoder, Graphics::Surfa
_zbufChunk = new uint8[roundup(_maxZBUFChunkSize)];
_viewData = nullptr;
- _aescData = nullptr;
+ _screenEffectsData = nullptr;
_lightsData = nullptr;
}
@@ -608,7 +608,7 @@ VQADecoder::VQAVideoTrack::~VQAVideoTrack() {
delete[] _vpointer;
delete[] _viewData;
- delete[] _aescData;
+ delete[] _screenEffectsData;
delete[] _lightsData;
}
@@ -735,27 +735,27 @@ void VQADecoder::VQAVideoTrack::decodeView(View *view) {
}
bool VQADecoder::VQAVideoTrack::readAESC(Common::SeekableReadStream *s, uint32 size) {
- if (_aescData) {
- delete[] _aescData;
+ if (_screenEffectsData) {
+ delete[] _screenEffectsData;
}
- _aescDataSize = roundup(size);
- _aescData = new uint8[_aescDataSize];
- s->read(_aescData, _aescDataSize);
+ _screenEffectsDataSize = roundup(size);
+ _screenEffectsData = new uint8[_screenEffectsDataSize];
+ s->read(_screenEffectsData, _screenEffectsDataSize);
return true;
}
-void VQADecoder::VQAVideoTrack::decodeAESC(AESC *aesc) {
- if (!aesc || !_aescData) {
+void VQADecoder::VQAVideoTrack::decodeScreenEffects(ScreenEffects *aesc) {
+ if (!aesc || !_screenEffectsData) {
return;
}
- Common::MemoryReadStream s(_aescData, _aescDataSize);
+ Common::MemoryReadStream s(_screenEffectsData, _screenEffectsDataSize);
aesc->readVqa(&s);
- delete[] _aescData;
- _aescData = nullptr;
+ delete[] _screenEffectsData;
+ _screenEffectsData = nullptr;
}
bool VQADecoder::VQAVideoTrack::readLITE(Common::SeekableReadStream *s, uint32 size) {
diff --git a/engines/bladerunner/vqa_decoder.h b/engines/bladerunner/vqa_decoder.h
index 4e070647a6..34a8ee3efc 100644
--- a/engines/bladerunner/vqa_decoder.h
+++ b/engines/bladerunner/vqa_decoder.h
@@ -35,11 +35,11 @@
#include "graphics/surface.h"
#include "video/video_decoder.h"
-#include "aesc.h"
namespace BladeRunner {
class Lights;
+class ScreenEffects;
class View;
class ZBuffer;
@@ -65,7 +65,7 @@ public:
void decodeZBuffer(ZBuffer *zbuffer);
Audio::SeekableAudioStream *decodeAudioFrame();
void decodeView(View *view);
- void decodeAESC(AESC *aesc);
+ void decodeScreenEffects(ScreenEffects *aesc);
void decodeLights(Lights *lights);
uint16 numFrames() const { return _header.numFrames; }
@@ -183,7 +183,7 @@ private:
void decodeVideoFrame(bool forceDraw);
void decodeZBuffer(ZBuffer *zbuffer);
void decodeView(View *view);
- void decodeAESC(AESC *aesc);
+ void decodeScreenEffects(ScreenEffects *aesc);
void decodeLights(Lights *lights);
bool readVQFR(Common::SeekableReadStream *s, uint32 size, uint readFlags);
@@ -231,8 +231,8 @@ private:
uint32 _viewDataSize;
uint8 *_lightsData;
uint32 _lightsDataSize;
- uint8 *_aescData;
- uint32 _aescDataSize;
+ uint8 *_screenEffectsData;
+ uint32 _screenEffectsDataSize;
void VPTRWriteBlock(uint16 *frame, unsigned int dstBlock, unsigned int srcBlock, int count, bool alpha = false);
bool decodeFrame(uint16 *frame);
diff --git a/engines/bladerunner/vqa_player.cpp b/engines/bladerunner/vqa_player.cpp
index 51766d6e28..7e820b7db2 100644
--- a/engines/bladerunner/vqa_player.cpp
+++ b/engines/bladerunner/vqa_player.cpp
@@ -155,8 +155,8 @@ void VQAPlayer::updateView(View *view) {
_decoder.decodeView(view);
}
-void VQAPlayer::updateAESC(AESC *aesc) {
- _decoder.decodeAESC(aesc);
+void VQAPlayer::updateScreenEffects(ScreenEffects *screenEffects) {
+ _decoder.decodeScreenEffects(screenEffects);
}
void VQAPlayer::updateLights(Lights *lights) {
diff --git a/engines/bladerunner/vqa_player.h b/engines/bladerunner/vqa_player.h
index 1be47bd87e..3a929ef592 100644
--- a/engines/bladerunner/vqa_player.h
+++ b/engines/bladerunner/vqa_player.h
@@ -106,7 +106,7 @@ public:
int update(bool forceDraw = false);
void updateZBuffer(ZBuffer *zbuffer);
void updateView(View *view);
- void updateAESC(AESC *aesc);
+ void updateScreenEffects(ScreenEffects *screenEffects);
void updateLights(Lights *lights);
bool setBeginAndEndFrame(int begin, int end, int repeatsCount, int loopSetMode, void(*callback)(void *, int, int), void *callbackData);