[Scummvm-git-logs] scummvm master -> abd510c40d60bce1a3d81d0a49d70f19f03d412a
neuromancer
noreply at scummvm.org
Thu Nov 19 11:21:44 UTC 2026
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
52e5d28470 HOLLYWOOD: RUNAWAY: started implemented the old English demo
b32b6f3442 HOLLYWOOD: RUNAWAY: added some audio to the old English demo code
78260b380c HOLLYWOOD: RUNAWAY: do some preparation work for the full game
a09a49499a HOLLYWOOD: RUNAWAY: implemented scene 2020
cce0f9edd9 HOLLYWOOD: RUNAWAY: implemented scene 2010 and 2080
1d789c6b49 HOLLYWOOD: RUNAWAY: implemented scene 2060
162de90294 HOLLYWOOD: RUNAWAY: implemented scene 5030
ca2e6dba7e HOLLYWOOD: RUNAWAY: implemented scene 4010 and 4070
834f7b6e4a HOLLYWOOD: RUNAWAY: better code to skip cutscenes
152ba94a6a HOLLYWOOD: RUNAWAY: refactored speech and walk code into proper classes
34c42402cc HOLLYWOOD: RUNAWAY: implemented navigation in 5xxx scenes
abd510c40d HOLLYWOOD: RUNAWAY: implemented another 5xxx batch
Commit: 52e5d28470de9738f8aa7ff6b161ec39cfe10ffd
https://github.com/scummvm/scummvm/commit/52e5d28470de9738f8aa7ff6b161ec39cfe10ffd
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:06+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: started implemented the old English demo
Changed paths:
A engines/hollywood/runaway/detection.h
A engines/hollywood/runaway/navigation.cpp
A engines/hollywood/runaway/navigation.h
A engines/hollywood/runaway/scene.cpp
A engines/hollywood/runaway/scene.h
A engines/hollywood/runaway/scene4030.cpp
A engines/hollywood/runaway/scene4050.cpp
A engines/hollywood/runaway/scene4060.cpp
A engines/hollywood/runaway/scene4090.cpp
A engines/hollywood/runaway/scene4100.cpp
A engines/hollywood/runaway/scene4140.cpp
A engines/hollywood/runaway/scene_data.h
engines/hollywood/detection.cpp
engines/hollywood/metaengine.cpp
engines/hollywood/module.mk
engines/hollywood/runaway/audio.cpp
engines/hollywood/runaway/audio.h
engines/hollywood/runaway/detection_tables.h
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/engine.h
engines/hollywood/runaway/font.cpp
engines/hollywood/runaway/font.h
engines/hollywood/runaway/graphics.cpp
engines/hollywood/runaway/graphics.h
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/inventory.h
engines/hollywood/runaway/menu.cpp
engines/hollywood/runaway/menu.h
engines/hollywood/runaway/scene5030.cpp
engines/hollywood/runaway/scene5030.h
engines/hollywood/runaway/strings.cpp
engines/hollywood/runaway/strings.h
engines/hollywood/runaway/ui.cpp
engines/hollywood/runaway/ui.h
diff --git a/engines/hollywood/detection.cpp b/engines/hollywood/detection.cpp
index 46ff7d7f7b1..64b6c365b05 100644
--- a/engines/hollywood/detection.cpp
+++ b/engines/hollywood/detection.cpp
@@ -25,6 +25,7 @@
#include "hollywood/debug.h"
#include "hollywood/monsters/detection.h"
+#include "hollywood/runaway/detection.h"
namespace Hollywood {
diff --git a/engines/hollywood/metaengine.cpp b/engines/hollywood/metaengine.cpp
index 39d2e90c258..881172c39ac 100644
--- a/engines/hollywood/metaengine.cpp
+++ b/engines/hollywood/metaengine.cpp
@@ -27,6 +27,7 @@
#include "hollywood/monsters/hollywood.h"
#include "hollywood/monsters/metaengine.h"
+#include "hollywood/runaway/detection.h"
#include "hollywood/runaway/engine.h"
namespace Hollywood {
@@ -52,7 +53,7 @@ protected:
Common::Error HollywoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
if (!strcmp(desc->gameId, "runaway"))
- *engine = new RunawayEngine(syst, desc->language);
+ *engine = new RunawayEngine(syst, desc->language, (desc->flags & GF_RUNAWAY_MUSEUM_DEMO) != 0);
else
*engine = new HollywoodEngine(syst, desc);
return Common::kNoError;
diff --git a/engines/hollywood/module.mk b/engines/hollywood/module.mk
index 8b8f05fa9db..b668393693b 100644
--- a/engines/hollywood/module.mk
+++ b/engines/hollywood/module.mk
@@ -146,8 +146,16 @@ MODULE_OBJS = \
runaway/intro.o \
runaway/inventory.o \
runaway/menu.o \
+ runaway/navigation.o \
runaway/presentation.o \
runaway/saveload.o \
+ runaway/scene.o \
+ runaway/scene4030.o \
+ runaway/scene4050.o \
+ runaway/scene4060.o \
+ runaway/scene4090.o \
+ runaway/scene4100.o \
+ runaway/scene4140.o \
runaway/scene5030.o \
runaway/strings.o \
runaway/ui.o \
diff --git a/engines/hollywood/runaway/audio.cpp b/engines/hollywood/runaway/audio.cpp
index 61517f47ca5..f8f26636c12 100644
--- a/engines/hollywood/runaway/audio.cpp
+++ b/engines/hollywood/runaway/audio.cpp
@@ -38,7 +38,7 @@ RunawayAudio::~RunawayAudio() {
}
uint32 RunawayAudio::play(const char *archive, uint16 cue, uint tableCount, bool pairedTables,
- byte flags, Audio::Mixer::SoundType type, Audio::SoundHandle &handle, byte volume, bool loop) {
+ byte flags, Audio::Mixer::SoundType type, Audio::SoundHandle &handle, byte volume, bool loop, uint rate) {
_mixer->stopHandle(handle);
const uint headerSize = tableCount * (pairedTables ? 8 : 4);
Common::File *file = new Common::File();
@@ -64,9 +64,6 @@ uint32 RunawayAudio::play(const char *archive, uint16 cue, uint tableCount, bool
delete file;
return 0;
}
- // The DirectSound setup at 0x4051f0 uses 16000 Hz for all three formats:
- // speech: unsigned 8-bit mono; SFX: signed 16-bit mono; music: 16-bit stereo.
- const uint rate = 16000;
Common::SeekableReadStream *stream = new Common::SeekableSubReadStream(file, start, start + size, DisposeAfterUse::YES);
Audio::SeekableAudioStream *pcm = Audio::makeRawStream(stream, rate, flags, DisposeAfterUse::YES);
if (!pcm) {
@@ -86,12 +83,13 @@ void RunawayAudio::playIntroMusic() {
// The Pendulo logo uses RESOURCE.002 cue 2 on native channel 7, which
// has the same 16 kHz stereo PCM format as the room music channels.
play("RESOURCE.002", 2, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
- Audio::Mixer::kMusicSoundType, _music, Audio::Mixer::kMaxChannelVolume, false);
+ Audio::Mixer::kMusicSoundType, _music, Audio::Mixer::kMaxChannelVolume, false, 16000);
}
uint32 RunawayAudio::playMusic(uint16 cue, bool loop) {
- return play("RESOURCE.M03", cue, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
- Audio::Mixer::kMusicSoundType, _music, 96, loop);
+ // Cabin PCM is 16 kHz; the museum uses 22.05 kHz music/speech and 11.025 kHz effects.
+ return play(_museum ? "RESOURCE.M04" : "RESOURCE.M03", cue, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
+ Audio::Mixer::kMusicSoundType, _music, 96, loop, _museum ? 22050 : 16000);
}
void RunawayAudio::setMusicVolume(byte volume) {
@@ -99,25 +97,30 @@ void RunawayAudio::setMusicVolume(byte volume) {
}
uint32 RunawayAudio::playSpeech(uint16 sample, bool global) {
+ if (_museum)
+ return sample ? play("RESOURCE.004", sample, 4000, false, Audio::FLAG_UNSIGNED,
+ Audio::Mixer::kSpeechSoundType, _speech, Audio::Mixer::kMaxChannelVolume, false, 22050) : 0;
// DATAACA3 has independent 6000-entry offset and length tables. Its global
// sample IDs include stale offsets for other chapters, so never derive a
// length by subtracting adjacent offsets as with the M/S archives.
return play(global ? "DATAACA0.000" : "DATAACA3.000", sample, 6000, true, Audio::FLAG_UNSIGNED,
- Audio::Mixer::kSpeechSoundType, _speech, Audio::Mixer::kMaxChannelVolume, false);
+ Audio::Mixer::kSpeechSoundType, _speech, Audio::Mixer::kMaxChannelVolume, false, 16000);
}
void RunawayAudio::playEffect(uint16 cue, byte volume, byte channel, bool loop) {
assert(channel < ARRAYSIZE(_effects));
- play("RESOURCE.S03", cue, 1000, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN,
- Audio::Mixer::kSFXSoundType, _effects[channel], volume, loop);
+ play(_museum ? "RESOURCE.S04" : "RESOURCE.S03", cue, 1000, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN,
+ Audio::Mixer::kSFXSoundType, _effects[channel], volume, loop, _museum ? 11025 : 16000);
}
void RunawayAudio::playFootstep(byte surface, byte variant, byte volume) {
+ if (_museum)
+ return;
assert(surface >= 1 && surface <= 7 && variant < 2);
// Native 0x407410 selects one of two mono samples per surface. These
// fourteen effects start at cue 21 in the otherwise shared music archive.
play("RESOURCE.002", 21 + (surface - 1) * 2 + variant, 100, false,
- Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN, Audio::Mixer::kSFXSoundType, _footstep, volume, false);
+ Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN, Audio::Mixer::kSFXSoundType, _footstep, volume, false, 16000);
}
void RunawayAudio::stopMusic() {
@@ -125,6 +128,8 @@ void RunawayAudio::stopMusic() {
}
void RunawayAudio::playPointer() {
+ if (_museum)
+ return;
// Native 0x405d14 / 0x407530: RESOURCE.000 chunk 150, 16 kHz,
// signed 16-bit mono. This short effect accompanies a cursor change.
Common::Array<byte> data;
@@ -143,9 +148,13 @@ void RunawayAudio::playPointer() {
}
void RunawayAudio::playMenuMusic() {
+ if (_museum) {
+ playMusic(11);
+ return;
+ }
// Options volume preview and credits use shared music cue 1, channel 7.
play("RESOURCE.002", 1, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
- Audio::Mixer::kMusicSoundType, _music, 255, true);
+ Audio::Mixer::kMusicSoundType, _music, 255, true, 16000);
}
void RunawayAudio::stopSpeech() {
diff --git a/engines/hollywood/runaway/audio.h b/engines/hollywood/runaway/audio.h
index 4f7c62cf7d8..0b79dc80051 100644
--- a/engines/hollywood/runaway/audio.h
+++ b/engines/hollywood/runaway/audio.h
@@ -30,6 +30,7 @@ class RunawayAudio {
public:
explicit RunawayAudio(Audio::Mixer *mixer) : _mixer(mixer) {}
~RunawayAudio();
+ void setMuseum(bool museum) { _museum = museum; }
void playIntroMusic();
uint32 playMusic(uint16 cue, bool loop = true);
void setMusicVolume(byte volume);
@@ -46,7 +47,8 @@ public:
private:
uint32 play(const char *archive, uint16 cue, uint tableCount, bool pairedTables,
- byte flags, Audio::Mixer::SoundType type, Audio::SoundHandle &handle, byte volume, bool loop);
+ byte flags, Audio::Mixer::SoundType type, Audio::SoundHandle &handle, byte volume, bool loop, uint rate);
+ bool _museum = false;
Audio::Mixer *_mixer;
Audio::SoundHandle _music, _speech, _effects[2], _footstep, _pointer;
};
diff --git a/engines/hollywood/runaway/detection.h b/engines/hollywood/runaway/detection.h
new file mode 100644
index 00000000000..5209592c477
--- /dev/null
+++ b/engines/hollywood/runaway/detection.h
@@ -0,0 +1,33 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HOLLYWOOD_RUNAWAY_DETECTION_H
+#define HOLLYWOOD_RUNAWAY_DETECTION_H
+
+namespace Hollywood {
+
+enum RunawayGameFlags {
+ GF_RUNAWAY_MUSEUM_DEMO = 1 << 0
+};
+
+} // End of namespace Hollywood
+
+#endif // HOLLYWOOD_RUNAWAY_DETECTION_H
diff --git a/engines/hollywood/runaway/detection_tables.h b/engines/hollywood/runaway/detection_tables.h
index 8859327b053..bd920310f29 100644
--- a/engines/hollywood/runaway/detection_tables.h
+++ b/engines/hollywood/runaway/detection_tables.h
@@ -23,6 +23,18 @@
#define HOLLYWOOD_RUNAWAY_DETECTION_TABLES_H
// Included in the shared ADGameDescription array in hollywood/detection.cpp.
+ // English museum demo (2000). Gameplay POC; movies are not supported.
+ {
+ "runaway",
+ "Museum demo",
+ AD_ENTRY3s("RESOURCE.D06", "f1048f161dca69a3be6ffad173c3db43", 10608050,
+ "RESOURCE.003", "a25c71fc759558e81aae49290b0cfdfc", 965642,
+ "RESOURCE.000", "f1690b1de499e0555498173ad7916415", 3662162),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_DEMO | ADGF_UNSTABLE | GF_RUNAWAY_MUSEUM_DEMO,
+ GUIO3(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD, GUIO_NOSPEECH)
+ },
// Spanish chapter-three demo (July 2001 build, Micromania 80).
{
"runaway",
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index 5a6359d9f7c..35e7791bac6 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -39,8 +39,9 @@
#include "hollywood/runaway/intro.h"
#include "hollywood/runaway/menu.h"
#include "hollywood/runaway/presentation.h"
-#include "hollywood/runaway/scene5030.h"
#include "hollywood/runaway/saveload.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene5030.h"
#include "hollywood/runaway/strings.h"
#include "hollywood/runaway/ui.h"
@@ -61,8 +62,8 @@ enum RunawayAction {
} // End of anonymous namespace
-RunawayEngine::RunawayEngine(OSystem *syst, Common::Language language) :
- Engine(syst), _language(language), _strings(language) {}
+RunawayEngine::RunawayEngine(OSystem *syst, Common::Language language, bool museum) :
+ Engine(syst), _language(language), _museum(museum), _strings(language) {}
RunawayEngine::~RunawayEngine() {}
@@ -110,7 +111,7 @@ bool RunawayEngine::canSaveGameStateCurrently(Common::U32String *) {
}
bool RunawayEngine::canLoadGameStateCurrently(Common::U32String *) {
- return _scene && _ui;
+ return !_museum && _scene && _ui;
}
Common::Error RunawayEngine::saveGameStream(Common::WriteStream *stream, bool) {
@@ -169,8 +170,8 @@ void RunawayEngine::initializePath(const Common::FSNode &gamePath) {
}
bool RunawayEngine::hasFeature(EngineFeature feature) const {
- return feature == kSupportsReturnToLauncher || feature == kSupportsSubtitleOptions ||
- feature == kSupportsSavingDuringRuntime || feature == kSupportsLoadingDuringRuntime;
+ return feature == kSupportsReturnToLauncher || (!_museum &&
+ (feature == kSupportsSubtitleOptions || feature == kSupportsSavingDuringRuntime || feature == kSupportsLoadingDuringRuntime));
}
void RunawayEngine::syncSoundSettings() {
@@ -235,19 +236,22 @@ Common::Error RunawayEngine::run() {
setDebugger(new GUI::Debugger());
syncSoundSettings();
RunawayMenu menu(_mixer, _strings);
- if (!menu.load())
+ if (!menu.load(_museum))
return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo menu");
- _inventory.reset(new RunawayInventory(_strings));
- _scene.reset(new RunawayScene5030(_mixer, *_inventory, _strings));
+ _inventory.reset(new RunawayInventory(_strings, _museum));
+ if (_museum)
+ _scene.reset(new RunawayMuseumScene(_mixer, *_inventory, _strings));
+ else
+ _scene.reset(new RunawayScene5030(_mixer, *_inventory, _strings));
_ui.reset(new RunawayUI(_mixer, *_inventory, _strings));
- if (!_scene->load() || !_ui->load())
- return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo room, opening movie or interface data");
+ if (!_scene->load() || !_ui->load(_museum))
+ return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo resources");
syncSoundSettings();
- if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) {
+ if (!_museum && ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) {
const Common::Error result = loadGameState(ConfMan.getInt("save_slot"));
if (result.getCode() != Common::kNoError)
return result;
- } else {
+ } else if (!_museum) {
const Common::Error result = playIntro(menu);
if (result.getCode() != Common::kNoError || shouldQuit())
return result;
@@ -258,7 +262,7 @@ Common::Error RunawayEngine::run() {
_loadedGame = false;
_scene->draw();
CursorMan.showMouse(true);
- _system->warpMouse(RunawayScene5030::kScreenWidth / 2, RunawayScene5030::kRoomTop + RunawayScene5030::kRoomHeight / 2);
+ _system->warpMouse(kRunawayScreenWidth / 2, kRunawayViewportTop + kRunawayViewportHeight / 2);
bool leftPressed = false, rightPressed = false;
while (!shouldQuit()) {
@@ -314,7 +318,7 @@ Common::Error RunawayEngine::run() {
break;
case kScrollEnd:
if (pressed && !_ui->inventoryOpen() && !_scene->busy())
- _scene->setCameraX(RunawayScene5030::kRoomWidth - RunawayScene5030::kScreenWidth);
+ _scene->setCameraX(_scene->roomWidth() - kRunawayScreenWidth);
break;
case kCancelAction:
if (pressed) {
@@ -362,10 +366,10 @@ Common::Error RunawayEngine::run() {
}
int direction = (int)rightPressed - (int)leftPressed;
mouse = _eventMan->getMousePos();
- if (!direction && mouse.y >= RunawayScene5030::kRoomTop && mouse.y < RunawayScene5030::kRoomTop + RunawayScene5030::kRoomHeight) {
+ if (!direction && mouse.y >= kRunawayViewportTop && mouse.y < kRunawayViewportTop + kRunawayViewportHeight) {
if (mouse.x < 24)
direction = -1;
- else if (mouse.x >= RunawayScene5030::kScreenWidth - 24)
+ else if (mouse.x >= kRunawayScreenWidth - 24)
direction = 1;
}
// The engine clock excludes time spent in ScummVM dialogs, keeping
@@ -384,7 +388,7 @@ Common::Error RunawayEngine::run() {
_ui->update(now, mouse, _scene->hotspotAt(mouse), _scene->busy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
_scene->draw();
Graphics::ManagedSurface &screen = _scene->screen();
- const bool subtitles = !ConfMan.hasKey("subtitles") || ConfMan.getBool("subtitles") || ConfMan.getBool("speech_mute");
+ const bool subtitles = _museum || !ConfMan.hasKey("subtitles") || ConfMan.getBool("subtitles") || ConfMan.getBool("speech_mute");
_ui->draw(screen, _scene->actionCaption(_scene->hotspotAt(mouse), _ui->verb(), _inventory->selected()),
_scene->committedCaption(), _scene->subtitle(), subtitles);
present(screen);
diff --git a/engines/hollywood/runaway/engine.h b/engines/hollywood/runaway/engine.h
index 2d9384c81da..b2dabf21b55 100644
--- a/engines/hollywood/runaway/engine.h
+++ b/engines/hollywood/runaway/engine.h
@@ -40,14 +40,14 @@ namespace Hollywood {
class RunawayMenu;
class RunawayInventory;
-class RunawayScene5030;
+class RunawayScene;
class RunawayUI;
// Runaway shares the archive and text formats with Hollywood Monsters, but
// has its own RGB565 renderer, scene state and audio formats.
class RunawayEngine : public Engine {
public:
- RunawayEngine(OSystem *syst, Common::Language language);
+ RunawayEngine(OSystem *syst, Common::Language language, bool museum);
~RunawayEngine() override;
Common::Error run() override;
@@ -71,9 +71,10 @@ private:
void applySettings(const RunawayMenu::Settings &settings, bool restoreDefaults = false);
void present(const Graphics::ManagedSurface &screen);
Common::Language _language;
+ const bool _museum;
RunawayStrings _strings;
Common::ScopedPtr<RunawayInventory> _inventory;
- Common::ScopedPtr<RunawayScene5030> _scene;
+ Common::ScopedPtr<RunawayScene> _scene;
Common::ScopedPtr<RunawayUI> _ui;
bool _inPresentation = false, _gameStarted = false, _loadedGame = false;
};
diff --git a/engines/hollywood/runaway/font.cpp b/engines/hollywood/runaway/font.cpp
index 8aaf714787b..fb644dacb7d 100644
--- a/engines/hollywood/runaway/font.cpp
+++ b/engines/hollywood/runaway/font.cpp
@@ -52,12 +52,17 @@ const byte kGlyphMap[256] = {
} // End of anonymous namespace
-bool RunawayFont::load(bool menuFont) {
+bool RunawayFont::load(bool menuFont, bool museum) {
Common::Array<byte> metrics;
- if (!readRunawayGlobalChunk(menuFont ? 148 : 125, _pixels) ||
+ if (museum) {
+ if (!readRunawayFile(Common::Path("TEMP_LET.SVG"), _pixels) ||
+ !readRunawayFile(Common::Path("TEMP_LET.VAL"), metrics) || metrics.size() != 117 * 5)
+ return false;
+ } else if (!readRunawayGlobalChunk(menuFont ? 148 : 125, _pixels) ||
!readRunawayGlobalChunk(menuFont ? 149 : 126, metrics) ||
- (metrics.size() != 119 * 5 && metrics.size() != 150 * 5 && metrics.size() != 156 * 5))
+ (metrics.size() != 119 * 5 && metrics.size() != 150 * 5 && metrics.size() != 156 * 5)) {
return false;
+ }
_glyphs.resize(metrics.size() / 5);
for (uint i = 0; i < _glyphs.size(); ++i) {
const byte *data = metrics.data() + i * 5;
@@ -71,10 +76,10 @@ bool RunawayFont::load(bool menuFont) {
return false;
}
memcpy(_glyphMap, kGlyphMap, sizeof(_glyphMap));
- _missingGlyph = _glyphs.size() == 119 ? 255 : _glyphs.size() - 1;
- // The Spanish table at 0x4631f0 uses the shared first 119 glyphs and
- // marks unsupported characters with 255, without a fallback picture.
- if (_glyphs.size() == 119) {
+ _missingGlyph = _glyphs.size() <= 119 ? 255 : _glyphs.size() - 1;
+ // Museum and Spanish tables use the first 117 and 119 glyphs respectively,
+ // marking unsupported characters with 255, without a fallback picture.
+ if (_glyphs.size() <= 119) {
for (uint i = 0; i < ARRAYSIZE(_glyphMap); ++i) {
if (_glyphMap[i] >= _glyphs.size() && _glyphMap[i] != 254)
_glyphMap[i] = _missingGlyph;
diff --git a/engines/hollywood/runaway/font.h b/engines/hollywood/runaway/font.h
index c811ac27ced..7184b3ea699 100644
--- a/engines/hollywood/runaway/font.h
+++ b/engines/hollywood/runaway/font.h
@@ -31,7 +31,7 @@ namespace Hollywood {
// RESOURCE.000 stores antialiased glyphs, including their contour masks.
class RunawayFont : public Graphics::Font {
public:
- bool load(bool menuFont = false);
+ bool load(bool menuFont = false, bool museum = false);
int getFontHeight() const override { return 28; }
int getMaxCharWidth() const override { return 28; }
int getCharWidth(uint32 chr) const override;
diff --git a/engines/hollywood/runaway/graphics.cpp b/engines/hollywood/runaway/graphics.cpp
index 5b547dc0988..9bb304e215b 100644
--- a/engines/hollywood/runaway/graphics.cpp
+++ b/engines/hollywood/runaway/graphics.cpp
@@ -40,16 +40,49 @@ static bool decodeSurface(const Common::Array<byte> &pixels, int width, int heig
return true;
}
+bool readRunawayFile(const Common::Path &path, Common::Array<byte> &data) {
+ Common::File file;
+ if (!file.open(path) || file.size() <= 0 || file.size() > 32 * 1024 * 1024)
+ return false;
+ data.resize(file.size());
+ return file.read(data.data(), data.size()) == data.size();
+}
+
bool loadRunawaySurface(uint chunk, int width, int height, Graphics::ManagedSurface &surface) {
Common::Array<byte> pixels;
return readRunawayGlobalChunk(chunk, pixels) && decodeSurface(pixels, width, height, surface);
}
+bool loadRunawaySurface(const Common::Path &path, int width, int height, Graphics::ManagedSurface &surface) {
+ Common::Array<byte> pixels;
+ return readRunawayFile(path, pixels) && decodeSurface(pixels, width, height, surface);
+}
+
bool loadRunawaySurface(ChunkArchive &archive, uint chunk, int width, int height, Graphics::ManagedSurface &surface) {
Common::Array<byte> pixels;
return archive.readVariableChunk(chunk, pixels) && decodeSurface(pixels, width, height, surface);
}
+bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array<byte> &mask, Common::Array<byte> &maps) {
+ Common::Array<byte> packed;
+ if (width <= 0 || height <= 0 || (uint64)width * height > 16 * 1024 * 1024 ||
+ !archive.readVariableChunk(1, packed) || packed.size() % 3 ||
+ !archive.readVariableChunk(2, maps) || maps.size() != 1536)
+ return false;
+ mask.resize(width * height);
+ // Each run is (byte value, uint16 length). The first four 256-byte tables
+ // map these values to walking zones, hotspots, depth and lighting.
+ uint offset = 0;
+ for (uint i = 0; i < packed.size(); i += 3) {
+ const uint length = READ_LE_UINT16(packed.data() + i + 1);
+ if (!length || length > mask.size() - offset)
+ return false;
+ memset(mask.data() + offset, packed[i], length);
+ offset += length;
+ }
+ return offset == mask.size();
+}
+
bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurface &surface, int yOffset) {
if (patch.size() < 2 || surface.format.bytesPerPixel != 2)
return false;
@@ -97,7 +130,7 @@ bool RunawayAnimation::validate(uint frames) {
const byte *run = _data.data() + cursor;
const uint x = READ_LE_UINT16(run), y = READ_LE_UINT16(run + 2), length = run[4];
cursor += 5;
- if (x + length > 1376 || y >= 600 || !length || length * 2 > _data.size() - cursor)
+ if (x + length > 32767 || y >= 32767 || !length || length * 2 > _data.size() - cursor)
return false;
cursor += length * 2;
}
@@ -150,26 +183,44 @@ bool readRunawayGlobalChunk(uint chunk, Common::Array<byte> &data) {
return file.open("RESOURCE.000") && readGlobalChunk(file, chunk, data);
}
-bool RunawayActor::load() {
+bool RunawayActor::load(Model model) {
+ if (_loadedModel == model)
+ return setFrame(3, 0);
+ _loadedModel = -1;
Common::File file;
Common::Array<byte> palette;
+ const bool museum = model != kCabin;
+ const bool interior = model == kMuseumInterior;
// Native chapter-five actor loader at 0x40b590 selects entry 44. Entry 45
// is the palette, 46..53 hold walking cels, 54..59 hold head cels, and
// entry 60 describes the six banks of 40 head cels.
_facing = _frame = _headFrame = -1;
- if (!file.open("RESOURCE.000") || !readGlobalChunk(file, 44, _descriptors) ||
- _descriptors.size() != kFacings * kFrames * 32 ||
- !readGlobalChunk(file, 45, palette) || palette.size() != 512 ||
- !readGlobalChunk(file, 60, _headDescriptors) ||
+ _museum = museum;
+ _width = museum ? (interior ? 237 : 238) : 345;
+ _height = museum ? 455 : 518;
+ _anchorX = museum ? (interior ? 120 : 119) : 168;
+ _anchorY = museum ? 403 : 434;
+ const char *suffix = interior ? "spi" : "spd";
+ if (museum) {
+ if (!readRunawayFile(Common::Path(Common::String::format("br1_%s.VAL", suffix)), _descriptors) ||
+ !readRunawayFile(Common::Path(Common::String::format("br1_%s.PAL", suffix)), palette) ||
+ !readRunawayFile(Common::Path(Common::String::format("ca1_%s.VAL", suffix)), _headDescriptors))
+ return false;
+ } else if (!file.open("RESOURCE.000") || !readGlobalChunk(file, 44, _descriptors) ||
+ !readGlobalChunk(file, 45, palette) || !readGlobalChunk(file, 60, _headDescriptors)) {
+ return false;
+ }
+ if (_descriptors.size() != kFacings * kFrames * 32 || palette.size() != 512 ||
_headDescriptors.size() != kHeadFacings * kHeadFrames * 32)
return false;
for (uint i = 0; i < 256; ++i)
_palette[i] = READ_LE_UINT16(palette.data() + i * 2);
- _pixels.resize(kWidth * kHeight);
- _opacity.resize(kWidth * kHeight);
- _shadow.resize(kWidth * kHeight);
+ _pixels.resize(_width * _height);
+ _opacity.resize(_width * _height);
+ _shadow.resize(_width * _height);
for (uint facing = 0; facing < kFacings; ++facing) {
- if (!readGlobalChunk(file, 46 + facing, _banks[facing]))
+ if (museum ? !readRunawayFile(Common::Path(Common::String::format("br1_%s%u.SPR", suffix, facing)), _banks[facing]) :
+ !readGlobalChunk(file, 46 + facing, _banks[facing]))
return false;
for (uint frame = 0; frame < kFrames; ++frame) {
if (!setFrame(facing, frame))
@@ -178,14 +229,18 @@ bool RunawayActor::load() {
}
const byte headFacings[kHeadFacings] = {0, 1, 2, 4, 5, 7};
for (uint bank = 0; bank < kHeadFacings; ++bank) {
- if (!readGlobalChunk(file, 54 + bank, _headBanks[bank]))
+ if (museum ? !readRunawayFile(Common::Path(Common::String::format("ca1_%s%u.SPR", suffix, bank)), _headBanks[bank]) :
+ !readGlobalChunk(file, 54 + bank, _headBanks[bank]))
return false;
for (uint frame = 0; frame < kHeadFrames; ++frame) {
if (!setFrame(headFacings[bank], 0, frame))
return false;
}
}
- return setFrame(3, 0);
+ if (!setFrame(3, 0))
+ return false;
+ _loadedModel = model;
+ return true;
}
bool RunawayActor::setFrame(uint facing, uint frame, int headFrame) {
@@ -200,11 +255,11 @@ bool RunawayActor::setFrame(uint facing, uint frame, int headFrame) {
const byte *descriptor = _descriptors.data() + (facing * kFrames + frame) * 32;
const Common::Array<byte> &bank = _banks[facing];
const uint end = frame + 1 < kFrames ? READ_LE_UINT32(descriptor + 32) : bank.size();
- const int left = 168 - (int)READ_LE_UINT32(descriptor + 16);
- const int top = 434 - (int)READ_LE_UINT32(descriptor + 20);
+ const int left = _anchorX - (int)READ_LE_UINT32(descriptor + 16);
+ const int top = _anchorY - (int)READ_LE_UINT32(descriptor + 20);
const uint width = READ_LE_UINT32(descriptor + 24), height = READ_LE_UINT32(descriptor + 28);
- if (left < 0 || top < 0 || width > kWidth || height > kHeight ||
- left + width > kWidth || top + height > kHeight)
+ if (left < 0 || top < 0 || width > _width || height > _height ||
+ left + width > _width || top + height > _height)
return false;
_bounds = Common::Rect(left, top, left + width, top + height);
memset(_pixels.data(), 0, _pixels.size());
@@ -222,8 +277,11 @@ bool RunawayActor::setFrame(uint facing, uint frame, int headFrame) {
const Common::Array<byte> &headBank = _headBanks[headFacing];
const byte *head = _headDescriptors.data() + (headFacing * kHeadFrames + headFrame) * 32;
const uint headEnd = headFrame + 1 < kHeadFrames ? READ_LE_UINT32(head + 32) : headBank.size();
- memset(_pixels.data(), 0, kWidth * kHeadHeight);
- memset(_opacity.data(), 0, kWidth * kHeadHeight);
+ const uint clearHeight = _museum ? kHeadHeight - head[8] : kHeadHeight;
+ if (clearHeight > kHeadHeight)
+ return false;
+ memset(_pixels.data(), 0, _width * clearHeight);
+ memset(_opacity.data(), 0, _width * clearHeight);
if (!decodeFrame(headBank, head, headEnd, true))
return false;
}
@@ -253,16 +311,16 @@ bool RunawayActor::decodeFrame(const Common::Array<byte> &bank, const byte *desc
const bool literal = plane == 0 || run[4] != 0;
const uint length = READ_LE_UINT16(run + header - 2);
cursor += header;
- if (!length || x + length > kWidth || y >= (head ? kHeadHeight : kHeight) ||
+ if (!length || x + length > _width || y >= (head ? kHeadHeight : _height) ||
(literal && length > end - cursor))
return false;
if (head)
_bounds.extend(Common::Rect(x, y, x + length, y + 1));
if (literal) {
- memcpy(destination + y * kWidth + x, bank.data() + cursor, length);
+ memcpy(destination + y * _width + x, bank.data() + cursor, length);
cursor += length;
} else {
- memset(destination + y * kWidth + x, 255, length);
+ memset(destination + y * _width + x, 255, length);
}
}
}
@@ -287,16 +345,6 @@ float RunawayActor::perspectiveHeight(Common::Point position) {
void RunawayActor::draw(Graphics::ManagedSurface &surface, Common::Point position, int cameraX,
int roomTop, const Common::Array<byte> &mask, const Common::Array<byte> &maps, bool sunlit, bool antialias) const {
- // Actor coordinates are anchored at (168,434) in a nominal 455-pixel-high image.
- const int scale = CLIP<int>((int)(perspectiveHeight(position) * 256 / 455), 64, 256);
- const int originX = position.x - cameraX - 168 * scale / 256;
- const int originY = position.y + roomTop - 434 * scale / 256;
- const int x0 = MAX(0, originX + _bounds.left * scale / 256);
- const int y0 = MAX(roomTop, originY + _bounds.top * scale / 256);
- const int x1 = MIN<int>(surface.w, originX + _bounds.right * scale / 256);
- const int y1 = MIN<int>(roomTop + 600, originY + _bounds.bottom * scale / 256);
- if (x0 >= x1 || y0 >= y1)
- return;
// Scene lighting and occlusion come from the same pixel lookup as hotspots.
const byte light = MIN<byte>(5, maps[768 + mask[position.y * 1376 + position.x]]);
byte lights[6][3] = { {100,100,100}, {55,50,45}, {55,50,45},
@@ -306,31 +354,57 @@ void RunawayActor::draw(Graphics::ManagedSurface &surface, Common::Point positio
memcpy(lights[1], windowLight[0], sizeof(windowLight[0]));
memcpy(lights[2], windowLight[1], sizeof(windowLight[1]));
}
+ RenderParams params;
+ params.position = position;
+ params.camera = Common::Point(cameraX, kRunawayViewportTop - roomTop);
+ params.roomWidth = 1376;
+ params.height = perspectiveHeight(position);
+ params.antialias = antialias;
+ memcpy(params.light, lights[light], sizeof(params.light));
+ draw(surface, params, mask, maps);
+}
+
+void RunawayActor::draw(Graphics::ManagedSurface &surface, const RenderParams ¶ms,
+ const Common::Array<byte> &mask, const Common::Array<byte> &maps) const {
+ if (params.roomWidth <= 0 || mask.size() % params.roomWidth || maps.size() != 1536)
+ return;
+ const int roomHeight = mask.size() / params.roomWidth;
+ const int scale = CLIP<int>((int)(params.height * 256 / 455), 64, 256);
+ const int roomTop = kRunawayViewportTop - params.camera.y;
+ const int originX = params.position.x - params.camera.x - _anchorX * scale / 256;
+ const int originY = params.position.y + roomTop - _anchorY * scale / 256;
+ Common::Rect bounds(originX + _bounds.left * scale / 256, originY + _bounds.top * scale / 256,
+ originX + _bounds.right * scale / 256, originY + _bounds.bottom * scale / 256);
+ bounds.clip(Common::Rect(0, kRunawayViewportTop, surface.w, MIN<int>(surface.h, kRunawayViewportTop + kRunawayViewportHeight)));
+ bounds.clip(Common::Rect(-params.camera.x, roomTop, params.roomWidth - params.camera.x, roomTop + roomHeight));
+ if (bounds.isEmpty())
+ return;
uint16 palette[256];
for (uint i = 0; i < 256; ++i) {
const uint16 c = _palette[i];
- palette[i] = (((c >> 11) * lights[light][0] / 100) << 11) |
- ((((c >> 5) & 63) * lights[light][1] / 100) << 5) | ((c & 31) * lights[light][2] / 100);
+ palette[i] = (((c >> 11) * params.light[0] / 100) << 11) |
+ ((((c >> 5) & 63) * params.light[1] / 100) << 5) | ((c & 31) * params.light[2] / 100);
}
- for (int y = y0; y < y1; ++y) {
- uint16 *out = (uint16 *)surface.getBasePtr(x0, y);
+ for (int y = bounds.top; y < bounds.bottom; ++y) {
+ uint16 *out = (uint16 *)surface.getBasePtr(bounds.left, y);
const int sourceY = (y - originY) * 256 / scale;
- for (int x = x0; x < x1; ++x, ++out) {
- if (maps[512 + mask[(y - roomTop) * 1376 + x + cameraX]])
+ for (int x = bounds.left; x < bounds.right; ++x, ++out) {
+ const byte depth = maps[512 + mask[(y - roomTop) * params.roomWidth + x + params.camera.x]];
+ if (depth && (depth >= ARRAYSIZE(params.depthY) || params.position.y <= params.depthY[depth]))
continue;
const int sourceX = (x - originX) * 256 / scale;
- const int source = sourceY * kWidth + sourceX;
+ const int source = sourceY * _width + sourceX;
uint color = palette[_pixels[source]], opacity = _opacity[source], shadow = _shadow[source];
- if (antialias && scale < 256) {
+ if (params.antialias && scale < 256) {
// Native 0x426040 averages color, opacity and shadow over
// each source footprint; 0x426de0 takes a single sample.
- const int endX = MIN<int>(kWidth, (x - originX + 1) * 256 / scale);
- const int endY = MIN<int>(kHeight, (y - originY + 1) * 256 / scale);
+ const int endX = MIN<int>(_width, (x - originX + 1) * 256 / scale);
+ const int endY = MIN<int>(_height, (y - originY + 1) * 256 / scale);
uint r = 0, g = 0, b = 0;
opacity = shadow = 0;
for (int sy = sourceY; sy < endY; ++sy) {
for (int sx = sourceX; sx < endX; ++sx) {
- const uint sample = sy * kWidth + sx;
+ const uint sample = sy * _width + sx;
const uint16 c = _opacity[sample] ? palette[_pixels[sample]] : 0;
r += c >> 11;
g += (c >> 5) & 63;
diff --git a/engines/hollywood/runaway/graphics.h b/engines/hollywood/runaway/graphics.h
index d5b9811bd1f..325b61237fa 100644
--- a/engines/hollywood/runaway/graphics.h
+++ b/engines/hollywood/runaway/graphics.h
@@ -23,6 +23,7 @@
#define HOLLYWOOD_RUNAWAY_GRAPHICS_H
#include "common/array.h"
+#include "common/path.h"
#include "common/rect.h"
#include "graphics/managed_surface.h"
@@ -30,10 +31,13 @@ namespace Hollywood {
class ChunkArchive;
-// RESOURCE.000 has a ten-byte header followed by two 500-entry tables.
+bool readRunawayFile(const Common::Path &path, Common::Array<byte> &data);
+// The cabin demos' RESOURCE.000 has a ten-byte header and two 500-entry tables.
bool readRunawayGlobalChunk(uint chunk, Common::Array<byte> &data);
bool loadRunawaySurface(uint chunk, int width, int height, Graphics::ManagedSurface &surface);
+bool loadRunawaySurface(const Common::Path &path, int width, int height, Graphics::ManagedSurface &surface);
bool loadRunawaySurface(ChunkArchive &archive, uint chunk, int width, int height, Graphics::ManagedSurface &surface);
+bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array<byte> &mask, Common::Array<byte> &maps);
bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurface &surface, int yOffset = 0);
enum {
@@ -62,16 +66,32 @@ private:
// shadow planes. This differs from the room animation spans.
class RunawayActor {
public:
- bool load();
+ enum Model { kCabin, kMuseumInterior, kMuseumHall };
+
+ struct RenderParams {
+ Common::Point position, camera;
+ int roomWidth = 0;
+ float height = 455;
+ // A depth layer hides the actor until his feet pass its Y threshold.
+ int16 depthY[7] = {0, 32767, 32767, 32767, 32767, 32767, 32767};
+ byte light[3] = {100, 100, 100};
+ bool antialias = true;
+ };
+ bool load(Model model = kCabin);
bool setFrame(uint facing, uint frame, int headFrame = -1);
static float perspectiveHeight(Common::Point position);
void draw(Graphics::ManagedSurface &surface, Common::Point position, int cameraX,
int roomTop, const Common::Array<byte> &mask, const Common::Array<byte> &maps,
bool sunlit = false, bool antialias = true) const;
+ void draw(Graphics::ManagedSurface &surface, const RenderParams ¶ms,
+ const Common::Array<byte> &mask, const Common::Array<byte> &maps) const;
private:
- enum { kWidth = 345, kHeight = 518, kHeadHeight = 148, kFacings = 8, kFrames = 19,
+ enum { kHeadHeight = 148, kFacings = 8, kFrames = 19,
kHeadFacings = 6, kHeadFrames = 40 };
+ uint _width = 345, _height = 518;
+ int _anchorX = 168, _anchorY = 434;
+ bool _museum = false;
bool decodeFrame(const Common::Array<byte> &bank, const byte *descriptor, uint end, bool head);
Common::Array<byte> _descriptors, _headDescriptors;
Common::Array<byte> _banks[kFacings];
@@ -79,6 +99,7 @@ private:
Common::Array<byte> _pixels, _opacity, _shadow;
uint16 _palette[256];
Common::Rect _bounds;
+ int _loadedModel = -1;
int _facing = -1;
int _frame = -1;
int _headFrame = -1;
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index 6675523b969..9d15f0d2db7 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -27,6 +27,13 @@
namespace Hollywood {
namespace {
+const char *const kMuseumItemNames[] = {
+ "", "Wallet", "Car keys", "Condom", "Piece of amber", "Tape recorder", "Battery",
+ "Crucifix", "Strange Mayan object", "Colorless varnish", "Talcum powder", "Mayan mask",
+ "Ruby", "Willy's business card", "Bowl with coffee beans", "Cup of coffee",
+ "Pair of books", "Strange key", "Ladle", "Package of coffee"
+};
+
const byte kItemCursors[] = {
0, 41, 43, 45, 47, 49, 51, 55, 57, 59, 61, 63, 65, 67, 69,
75, 79, 81, 83, 85, 87, 91, 93, 95, 103, 105, 111
@@ -65,7 +72,7 @@ bool RunawayInventory::contains(byte item) const {
}
bool RunawayInventory::add(byte item) {
- if (!item || item > kItemCount || contains(item))
+ if (!item || item > kItemCount || (_museum && item >= ARRAYSIZE(kMuseumItemNames)) || contains(item))
return false;
_items.push_back(item);
_newItem = item;
@@ -86,28 +93,41 @@ void RunawayInventory::remove(byte item) {
}
Common::U32String RunawayInventory::name(byte item) const {
+ if (_museum)
+ return item < ARRAYSIZE(kMuseumItemNames) ? Common::U32String(kMuseumItemNames[item]) : Common::U32String();
if (item == 1 && _clothState)
return _strings.text(_clothState == 1 ? RunawayStrings::kWetCloth : RunawayStrings::kDirtyCloth);
return _strings.itemName(item);
}
uint RunawayInventory::icon(byte item) const {
+ if (_museum)
+ return item;
if (item == 1 && _clothState)
return _clothState == 1 ? 34 : 35;
return item == 15 ? 29 : item;
}
uint RunawayInventory::cursor(byte item) const {
+ if (_museum)
+ return item && item < ARRAYSIZE(kMuseumItemNames) ? 11 + item * 2 : 0;
if (item == 1 && _clothState)
return _clothState == 1 ? 107 : 109;
return item <= kItemCount ? kItemCursors[item] : 0;
}
RunawayInventory::Reply RunawayInventory::examine(byte item) const {
+ if (_museum) {
+ if (!item || item >= ARRAYSIZE(kMuseumItemNames))
+ return Reply();
+ return Reply(item < 5 ? 49 + item : 95 + item, item == 7 ? 1 : 0);
+ }
return Reply(item && item <= kItemCount ? kExamineCues[item] : 1, item == 1 ? _clothState : 0);
}
RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
+ if (_museum)
+ return Reply();
if (!contains(first) || !contains(second) || first == second)
return Reply();
if (first > second)
diff --git a/engines/hollywood/runaway/inventory.h b/engines/hollywood/runaway/inventory.h
index 7fa5df5d4fd..69ae94c1938 100644
--- a/engines/hollywood/runaway/inventory.h
+++ b/engines/hollywood/runaway/inventory.h
@@ -40,7 +40,7 @@ public:
byte variation;
Reply(uint16 c = 1, byte v = 0) : cue(c), variation(v) {}
};
- explicit RunawayInventory(const RunawayStrings &strings) : _strings(strings) {}
+ explicit RunawayInventory(const RunawayStrings &strings, bool museum = false) : _strings(strings), _museum(museum) {}
bool contains(byte item) const;
bool add(byte item);
void remove(byte item);
@@ -61,6 +61,7 @@ public:
private:
const RunawayStrings &_strings;
+ const bool _museum;
Common::Array<byte> _items;
byte _selected = 0, _newItem = 0, _clothState = 0;
};
diff --git a/engines/hollywood/runaway/menu.cpp b/engines/hollywood/runaway/menu.cpp
index 57e6e85d341..5b1425e131d 100644
--- a/engines/hollywood/runaway/menu.cpp
+++ b/engines/hollywood/runaway/menu.cpp
@@ -54,11 +54,20 @@ bool RunawayMenu::Settings::operator==(const Settings &other) const {
RunawayMenu::~RunawayMenu() { close(); }
-bool RunawayMenu::load() {
+bool RunawayMenu::load(bool museum) {
+ _museum = museum;
+ _audio.setMuseum(museum);
Graphics::ManagedSurface cursors;
Common::Array<byte> animation;
- if (!_font.load(true) || !_captionFont.load() ||
- !loadRunawaySurface(132, 1024, 600, _background) ||
+ if (!_font.load(true, museum) || !_captionFont.load(false, museum))
+ return false;
+ if (museum) {
+ if (!loadRunawaySurface(Common::Path("panopc2.fnd"), 1024, 600, _background) ||
+ !loadRunawaySurface(Common::Path("jugar_der.fnd"), 700, 74, _returnButton) ||
+ !loadRunawaySurface(Common::Path("Mosca.spf"), 48, 48, _logo) ||
+ !loadRunawaySurface(Common::Path("raton10.spf"), 904, 360, cursors))
+ return false;
+ } else if (!loadRunawaySurface(132, 1024, 600, _background) ||
!loadRunawaySurface(130, 700, 74, _returnButton) ||
!loadRunawaySurface(118, 48, 48, _logo) || !loadRunawaySurface(114, 904, 540, cursors) ||
!readRunawayGlobalChunk(155, animation) || !_volumeDial.load(animation, 103))
@@ -166,9 +175,9 @@ RunawayMenu::Control RunawayMenu::controlAt(Common::Point mouse) const {
const Control controls[] = {kLoad, kSave, kDelete, kPlay, kExit};
for (uint i = 0; i < ARRAYSIZE(labels); ++i) {
if (labelRect(labels[i], 183, 334 + i * 42).contains(mouse))
- return (i == 0 && !_canLoad) || (i == 1 && !_canSave) ? kNoControl : controls[i];
+ return (i == 0 && !_canLoad) || (i == 1 && !_canSave) || (i == 2 && _museum) ? kNoControl : controls[i];
}
- for (uint i = 0; i < 5; ++i) {
+ for (uint i = 0; i < (_museum ? 3U : 5U); ++i) {
const int y = 161 + i * 42;
if (Common::Rect(716, y, 846, y + 28).contains(mouse))
return (Control)(kMusicOn + i * 2);
@@ -178,7 +187,7 @@ RunawayMenu::Control RunawayMenu::controlAt(Common::Point mouse) const {
const int dx = mouse.x - 525, dy = mouse.y - 516;
if (dx * dx + dy * dy <= 52 * 52 || labelRect(RunawayStrings::kVolume, 525, 582).contains(mouse))
return kVolume;
- if (labelRect(RunawayStrings::kCredits, 525, 392).contains(mouse))
+ if (!_museum && labelRect(RunawayStrings::kCredits, 525, 392).contains(mouse))
return kShowCredits;
if (labelRect(RunawayStrings::kSaveSettings, 802, 404).contains(mouse))
return kStoreSettings;
@@ -383,7 +392,7 @@ RunawayMenu::Command RunawayMenu::key(uint32 ascii) {
return kBrowseLoad;
else if (ascii == _strings.text(RunawayStrings::kSave)[0] && _canSave)
return kBrowseSave;
- else if (ascii == _strings.text(RunawayStrings::kDeleteKey)[0])
+ else if (!_museum && ascii == _strings.text(RunawayStrings::kDeleteKey)[0])
return kBrowseDelete;
}
return kNone;
@@ -539,7 +548,7 @@ void RunawayMenu::draw(Graphics::ManagedSurface &screen) {
screen.copyRectToSurface(_thumbnail, 85, 169, Common::Rect(204, 120));
drawLabel(screen, RunawayStrings::kLoad, 183, 334, _page == kOptions && _canLoad, kLoad);
drawLabel(screen, RunawayStrings::kSave, 183, 376, _page == kOptions && _canSave, kSave);
- drawLabel(screen, RunawayStrings::kDelete, 183, 418, _page == kOptions, kDelete);
+ drawLabel(screen, RunawayStrings::kDelete, 183, 418, _page == kOptions && !_museum, kDelete);
drawLabel(screen, RunawayStrings::kPlay, 183, 460, _page == kOptions, kPlay);
drawLabel(screen, RunawayStrings::kQuit, 183, 502, _page == kOptions, kExit);
if (_page == kSaves || _page == kName) {
@@ -548,13 +557,20 @@ void RunawayMenu::draw(Graphics::ManagedSurface &screen) {
drawToggle(screen, RunawayStrings::kMusic, 161, _settings.music, kMusicOn, kMusicOff);
drawToggle(screen, RunawayStrings::kAntialias, 203, _settings.antialias, kAntialiasOn, kAntialiasOff);
drawToggle(screen, RunawayStrings::kScrolling, 245, _settings.fastScrolling, kScrollFast, kScrollSlow);
- drawToggle(screen, RunawayStrings::kPointerSound, 287, _settings.pointerSound, kPointerOn, kPointerOff);
- drawToggle(screen, RunawayStrings::kSubtitles, 329, _settings.subtitles, kSubtitlesOn, kSubtitlesOff);
- drawLabel(screen, RunawayStrings::kCredits, 525, 392, true, kShowCredits);
+ if (!_museum) {
+ drawToggle(screen, RunawayStrings::kPointerSound, 287, _settings.pointerSound, kPointerOn, kPointerOff);
+ drawToggle(screen, RunawayStrings::kSubtitles, 329, _settings.subtitles, kSubtitlesOn, kSubtitlesOff);
+ }
+ drawLabel(screen, RunawayStrings::kCredits, 525, 392, !_museum, kShowCredits);
drawLabel(screen, RunawayStrings::kSaveSettings, 802, 404, true, kStoreSettings);
drawLabel(screen, RunawayStrings::kDefaultSettings, 802, 446, true, kDefaults);
- _volumeDial.draw(screen, _dragging == kVolume ? 102 : 101, 0, kRunawayViewportTop);
- _volumeDial.draw(screen, (_settings.volume * 100 + 128) / 256, 0, kRunawayViewportTop);
+ if (_museum) {
+ const Common::String volume = Common::String::format("%d%%", (_settings.volume * 100 + 128) / 256);
+ _font.drawString(screen.surfacePtr(), volume, 473, 502, 104, kNormal, Graphics::kTextAlignCenter);
+ } else {
+ _volumeDial.draw(screen, _dragging == kVolume ? 102 : 101, 0, kRunawayViewportTop);
+ _volumeDial.draw(screen, (_settings.volume * 100 + 128) / 256, 0, kRunawayViewportTop);
+ }
drawLabel(screen, RunawayStrings::kVolume, 525, 582, true, kVolume);
drawLabel(screen, RunawayStrings::kBrightness, 802, 582, false);
}
diff --git a/engines/hollywood/runaway/menu.h b/engines/hollywood/runaway/menu.h
index 64f31df0f56..528ce5b0b4b 100644
--- a/engines/hollywood/runaway/menu.h
+++ b/engines/hollywood/runaway/menu.h
@@ -45,7 +45,7 @@ public:
RunawayMenu(Audio::Mixer *mixer, const RunawayStrings &strings) : _strings(strings), _audio(mixer) {}
~RunawayMenu();
- bool load();
+ bool load(bool museum = false);
void open(const Graphics::ManagedSurface &screen, const Settings &settings, bool canSave = false, bool canLoad = true);
void close();
Command update(Common::Point mouse);
@@ -89,6 +89,7 @@ private:
const RunawayStrings &_strings;
RunawayAudio _audio;
+ bool _museum = false;
RunawayFont _font, _captionFont;
Graphics::ManagedSurface _background, _returnButton, _logo, _cursor, _thumbnail;
RunawayAnimation _volumeDial;
diff --git a/engines/hollywood/runaway/navigation.cpp b/engines/hollywood/runaway/navigation.cpp
new file mode 100644
index 00000000000..273da35b469
--- /dev/null
+++ b/engines/hollywood/runaway/navigation.cpp
@@ -0,0 +1,95 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/debug.h"
+#include "common/util.h"
+#include "hollywood/debug.h"
+#include "hollywood/runaway/navigation.h"
+
+namespace Hollywood {
+
+bool RunawayWalkMap::walkable(int x, int y) const {
+ return x >= 0 && x < _width && y >= 0 && y < _height && _maps[_mask[y * _width + x]] != 0;
+}
+
+bool RunawayWalkMap::clearPath(Common::Point start, Common::Point end) const {
+ const int count = MAX(ABS(end.x - start.x), ABS(end.y - start.y));
+ for (int i = 0; i <= count; ++i) {
+ const int x = start.x + (end.x - start.x) * i / MAX(1, count);
+ const int y = start.y + (end.y - start.y) * i / MAX(1, count);
+ if (!walkable(x, y))
+ return false;
+ }
+ return true;
+}
+
+void RunawayWalkMap::findPath(Common::Point position, Common::Point target, Common::Array<Common::Point> &path) const {
+ path.clear();
+ if (position.x < 0 || position.x >= _width || position.y < 0 || position.y >= _height ||
+ _mask.size() != (uint)(_width * _height) || _maps.size() < 256)
+ return;
+ // Search only the connected floor. Using pixel resolution preserves the
+ // one-pixel-wide approach to the plug, which a coarse navigation grid loses.
+ Common::Array<int32> parent;
+ Common::Array<int> queue;
+ parent.resize(_mask.size());
+ for (uint i = 0; i < parent.size(); ++i)
+ parent[i] = -1;
+ const int start = position.y * _width + position.x;
+ parent[start] = start;
+ queue.push_back(start);
+ int closest = start, bestDistance = 0x7fffffff;
+ const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
+ const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
+ for (uint head = 0; head < queue.size(); ++head) {
+ const int pixel = queue[head], x = pixel % _width, y = pixel / _width;
+ const int distance = (x - target.x) * (x - target.x) + (y - target.y) * (y - target.y);
+ if (distance < bestDistance) {
+ closest = pixel;
+ bestDistance = distance;
+ if (!distance)
+ break;
+ }
+ for (uint direction = 0; direction < 8; ++direction) {
+ const int nx = x + dx[direction], ny = y + dy[direction], next = ny * _width + nx;
+ if (walkable(nx, ny) && parent[next] == -1) {
+ parent[next] = pixel;
+ queue.push_back(next);
+ }
+ }
+ }
+ Common::Array<Common::Point> reverse;
+ for (int pixel = closest; pixel != start; pixel = parent[pixel])
+ reverse.push_back(Common::Point(pixel % _width, pixel / _width));
+ Common::Point previous = position;
+ for (int i = (int)reverse.size() - 1; i >= 0;) {
+ int next = i;
+ while (next > 0 && clearPath(previous, reverse[next - 1]))
+ --next;
+ previous = reverse[next];
+ path.push_back(previous);
+ i = next - 1;
+ }
+ debugC(1, kDebugScene, "Runaway: walk to %d,%d, reachable %d,%d, %u waypoints",
+ target.x, target.y, closest % _width, closest / _width, path.size());
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/navigation.h b/engines/hollywood/runaway/navigation.h
new file mode 100644
index 00000000000..0d0f892ee6a
--- /dev/null
+++ b/engines/hollywood/runaway/navigation.h
@@ -0,0 +1,45 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HOLLYWOOD_RUNAWAY_NAVIGATION_H
+#define HOLLYWOOD_RUNAWAY_NAVIGATION_H
+
+#include "common/array.h"
+#include "common/rect.h"
+
+namespace Hollywood {
+
+class RunawayWalkMap {
+public:
+ RunawayWalkMap(int width, int height, const Common::Array<byte> &mask, const Common::Array<byte> &maps) :
+ _width(width), _height(height), _mask(mask), _maps(maps) {}
+ void findPath(Common::Point start, Common::Point target, Common::Array<Common::Point> &path) const;
+
+private:
+ bool walkable(int x, int y) const;
+ bool clearPath(Common::Point start, Common::Point end) const;
+ int _width, _height;
+ const Common::Array<byte> &_mask, &_maps;
+};
+
+} // End of namespace Hollywood
+
+#endif // HOLLYWOOD_RUNAWAY_NAVIGATION_H
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
new file mode 100644
index 00000000000..98b1ecab7af
--- /dev/null
+++ b/engines/hollywood/runaway/scene.cpp
@@ -0,0 +1,529 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/config-manager.h"
+#include "common/endian.h"
+#include "common/str-enc.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "hollywood/runaway/navigation.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+#include "hollywood/runaway/strings.h"
+
+#include <math.h>
+
+namespace Hollywood {
+
+namespace {
+
+const MuseumRoom *const kRooms[] = {
+ &kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140
+};
+
+const MuseumResponse kGlobalResponses[] = {
+ {0, 3, 2, 0},
+ {0, 4, 3, 0},
+ {0, 5, 4, 0},
+ {0, 6, 5, 0},
+ {0, 8, 7, 0},
+ {0, 9, 8, 0},
+ {0, 10, 9, 0},
+ {0, 11, 10, 0},
+ {0, 13, 12, 0},
+ {0, 14, 13, 0},
+ {0, 16, 15, 0},
+ {0, 17, 1, 2},
+ {0, 18, 16, 0},
+ {0, 20, 11, 0},
+ {0, 22, 19, 0},
+ {0, 23, 19, 1},
+ {0, 29, 23, 0},
+ {0, 30, 24, 0},
+};
+
+const MuseumRoom *findRoom(int number) {
+ for (uint i = 0; i < ARRAYSIZE(kRooms); ++i) {
+ if (kRooms[i]->number == number)
+ return kRooms[i];
+ }
+ return nullptr;
+}
+
+} // End of anonymous namespace
+
+RunawayMuseumScene::RunawayMuseumScene(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings) :
+ _audio(mixer), _inventory(inventory), _strings(strings) {
+ _audio.setMuseum(true);
+}
+
+bool RunawayMuseumScene::load() {
+ const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ _screen.create(kRunawayScreenWidth, kRunawayScreenHeight, format);
+ // The museum intro ends in the restoration laboratory.
+ const MuseumRoom *room = &kRunawayScene4050;
+ if (ConfMan.hasKey("boot_param")) {
+ const MuseumRoom *requested = findRoom(ConfMan.getInt("boot_param"));
+ if (requested)
+ room = requested;
+ }
+ return enterRoom(room->number, room->entry, 3);
+}
+
+void RunawayMuseumScene::start(uint32 now) {
+ _now = _lastUpdate = now;
+ const byte initialItems[] = {1, 2, 3, 4, 7};
+ for (uint i = 0; i < ARRAYSIZE(initialItems); ++i)
+ _inventory.add(initialItems[i]);
+ _inventory.takeNewItem();
+ _audio.playMusic(4);
+}
+
+bool RunawayMuseumScene::enterRoom(uint16 number, Common::Point position, byte facing) {
+ const MuseumRoom *room = findRoom(number);
+ if (!room || position.x < 0 || position.x >= room->width || position.y < 0 || position.y >= room->height)
+ return false;
+ const Common::Path path(Common::String::format("RESOURCE.D%02u", number / 10 - 400));
+ if (!_archive.open(path, 40) ||
+ !loadRunawayMask(_archive, room->width, room->height, _mask, _originalMaps) ||
+ !_text.load("RESOURCE.003", "Runaway museum", number / 10, 0, 0x1135) ||
+ !_actor.load(number == kMuseumHall ? RunawayActor::kMuseumHall : RunawayActor::kMuseumInterior))
+ return false;
+ _room = number;
+ _position = position;
+ _x = position.x;
+ _y = position.y;
+ _facing = facing;
+ _path.clear();
+ _pathIndex = _walkElapsed = 0;
+ _pendingHotspot = _pendingItem = 0;
+ _pendingAction = 0;
+ _lines.clear();
+ _lineIndex = 0;
+ _subtitle.clear();
+ _caption.clear();
+ _ambient = RunawayAnimation();
+ _overlay = RunawayAnimation();
+ for (uint i = 0; i < ARRAYSIZE(_foreground); ++i)
+ _foreground[i].clear();
+ for (uint i = 0; i < ARRAYSIZE(_keyPatches); ++i)
+ _keyPatches[i].clear();
+ bool loaded = true;
+ switch (number) {
+ case kMuseumOffice:
+ loaded = loadScene4030();
+ break;
+ case kMuseumLaboratory:
+ loaded = loadScene4050();
+ break;
+ case kMuseumHall:
+ loaded = loadScene4060();
+ break;
+ case kMuseumKeypad:
+ loaded = loadScene4140();
+ break;
+ default:
+ break;
+ }
+ if (!loaded || !rebuildBackground())
+ return false;
+ _keyCount = _pressedKey = 0;
+ updateMaps();
+ updateCamera();
+ return _actor.setFrame(_facing, 0);
+}
+
+bool RunawayMuseumScene::loadForeground(uint layer, uint chunk) {
+ assert(layer < ARRAYSIZE(_foreground));
+ const MuseumRoom *room = findRoom(_room);
+ // Foreground masks restore (x, y, length) spans from the current background.
+ Common::Array<byte> spans;
+ if (!_archive.readVariableChunk(chunk, spans) || spans.size() < 2 ||
+ spans.size() != 2U + READ_LE_UINT16(spans.data()) * 6U)
+ return false;
+ for (uint offset = 2; offset < spans.size(); offset += 6) {
+ const uint x = READ_LE_UINT16(spans.data() + offset);
+ const uint y = READ_LE_UINT16(spans.data() + offset + 2);
+ const uint width = READ_LE_UINT16(spans.data() + offset + 4);
+ if (!width || x + width > room->width || y >= room->height)
+ return false;
+ _foreground[layer].push_back(Common::Rect(x, y, x + width, y + 1));
+ }
+ return true;
+}
+
+bool RunawayMuseumScene::applyPatch(uint chunk) {
+ Common::Array<byte> data;
+ return _archive.readVariableChunk(chunk, data) && applyRunawayPatch(data, _background);
+}
+
+bool RunawayMuseumScene::rebuildBackground() {
+ const MuseumRoom *room = findRoom(_room);
+ if (!loadRunawaySurface(_archive, 0, room->width, room->height, _background))
+ return false;
+ switch (_room) {
+ case kMuseumOffice:
+ return applyBackground4030();
+ case kMuseumLaboratory:
+ return applyBackground4050();
+ default:
+ return true;
+ }
+}
+
+void RunawayMuseumScene::updateMaps() {
+ _maps = _originalMaps;
+ switch (_room) {
+ case kMuseumOffice:
+ updateMaps4030();
+ break;
+ case kMuseumLaboratory:
+ updateMaps4050();
+ break;
+ case kMuseumHall:
+ updateMaps4060();
+ break;
+ default:
+ break;
+ }
+}
+
+const MuseumHotspot *RunawayMuseumScene::hotspot(byte id) const {
+ const MuseumRoom *room = findRoom(_room);
+ return room && id && id < room->hotspotCount ? &room->hotspots[id] : nullptr;
+}
+
+byte RunawayMuseumScene::hotspotAt(Common::Point mouse) const {
+ if (mouse.x < 0 || mouse.x >= kRunawayScreenWidth || mouse.y < kRunawayViewportTop ||
+ mouse.y >= kRunawayViewportTop + kRunawayViewportHeight)
+ return 0;
+ const int x = mouse.x + _camera.x, y = mouse.y - kRunawayViewportTop + _camera.y;
+ if (x < 0 || x >= _background.w || y < 0 || y >= _background.h)
+ return 0;
+ const byte id = _maps[256 + _mask[y * _background.w + x]];
+ return (_room == kMuseumKeypad && id <= 12) || hotspot(id) ? id : 0;
+}
+
+Common::U32String RunawayMuseumScene::hotspotName(byte id) const {
+ const MuseumHotspot *spot = hotspot(id);
+ if (!spot)
+ return Common::U32String();
+ return _room == kMuseumOffice ? hotspotName4030(id) : Common::U32String(spot->name);
+}
+
+Common::U32String RunawayMuseumScene::actionCaption(byte id, RunawayVerb verb, byte item) const {
+ if (_room == kMuseumKeypad)
+ return Common::U32String();
+ const Common::U32String name = hotspotName(id);
+ if (item)
+ return _strings.text(RunawayStrings::kUse) + _inventory.name(item) +
+ (id ? _strings.text(RunawayStrings::kWith) + name : Common::U32String());
+ if (!id)
+ return Common::U32String();
+ return _strings.text(verb == kVerbLook ? RunawayStrings::kLook : RunawayStrings::kUse) + name;
+}
+
+void RunawayMuseumScene::walkTo(Common::Point target) {
+ RunawayWalkMap(_background.w, _background.h, _mask, _maps).findPath(_position, target, _path);
+ _pathIndex = _walkElapsed = 0;
+ if (_path.empty())
+ arrive();
+}
+
+void RunawayMuseumScene::arrive() {
+ const byte id = _pendingHotspot;
+ _pendingHotspot = 0;
+ if (id) {
+ _facing = hotspot(id)->facing;
+ if (_pendingItem)
+ useItem(_pendingItem, id);
+ else
+ execute(_pendingAction);
+ }
+ if (!speaking())
+ _caption.clear();
+}
+
+void RunawayMuseumScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
+ if (busy())
+ return;
+ const byte id = hotspotAt(mouse);
+ if (_room == kMuseumKeypad) {
+ clickScene4140(id);
+ return;
+ }
+ _caption = actionCaption(id, verb, item);
+ const MuseumHotspot *spot = hotspot(id);
+ _pendingItem = item;
+ if (spot) {
+ const uint index = verb == kVerbLook && !item ? 0 : 1;
+ _pendingHotspot = id;
+ _pendingAction = spot->action[index];
+ if (spot->approach[index] || item)
+ walkTo(Common::Point(spot->x, spot->y));
+ else {
+ _path.clear();
+ _pathIndex = 0;
+ arrive();
+ }
+ } else {
+ walkTo(Common::Point(mouse.x + _camera.x, mouse.y - kRunawayViewportTop + _camera.y));
+ }
+}
+
+void RunawayMuseumScene::queueLine(const Common::U32String &line) {
+ if (line.empty())
+ return;
+ _lines.push_back(line);
+ if (!speaking())
+ showLine();
+}
+
+void RunawayMuseumScene::showLine() {
+ _subtitle = _lines[_lineIndex];
+ _subtitleUntil = _now + MAX<uint>(3000, _subtitle.size() * 55);
+}
+
+void RunawayMuseumScene::say(uint16 cue, byte variation, bool global) {
+ SceneSpeechCue speech;
+ if (global)
+ _text.getStaticSpeechCue(cue, variation, speech.textRecordId, speech.continuationCount, speech.voiceSampleId);
+ else
+ speech = _text.stageCue(cue, variation);
+ if (!speech.valid())
+ return;
+ for (uint i = 0; i < MAX<uint>(1, speech.continuationCount); ++i)
+ queueLine(Common::U32String(_text.largeTextRecord(speech.textRecordId + i), Common::kDos850));
+}
+
+void RunawayMuseumScene::sayInventory(const RunawayInventory::Reply &reply) {
+ _path.clear();
+ _pathIndex = 0;
+ _pendingHotspot = 0;
+ _caption.clear();
+ say(reply.cue, reply.variation, true);
+}
+
+void RunawayMuseumScene::skipSpeech() {
+ if (!speaking())
+ return;
+ if (++_lineIndex < _lines.size()) {
+ showLine();
+ } else {
+ _lines.clear();
+ _lineIndex = 0;
+ _subtitle.clear();
+ _caption.clear();
+ }
+}
+
+void RunawayMuseumScene::useItem(byte item, byte id) {
+ const MuseumRoom *room = findRoom(_room);
+ for (uint i = 0; i < room->itemActionCount; ++i) {
+ const MuseumItemAction &action = room->itemActions[i];
+ if (action.hotspot == id && (!action.item || action.item == item)) {
+ execute(action.action);
+ return;
+ }
+ }
+ say(1, 0, true);
+}
+
+void RunawayMuseumScene::execute(uint16 action) {
+ ActionResult result = kUnhandled;
+ switch (_room) {
+ case kMuseumOffice:
+ result = execute4030(action);
+ break;
+ case kMuseumLaboratory:
+ result = execute4050(action);
+ break;
+ case kMuseumHall:
+ result = execute4060(action);
+ break;
+ default:
+ break;
+ }
+ if (result == kBackgroundChanged) {
+ if (!rebuildBackground())
+ error("Cannot update museum room %u", _room);
+ updateMaps();
+ }
+ if (result != kUnhandled)
+ return;
+
+ const MuseumRoom *room = findRoom(_room);
+ for (uint i = 0; i < room->exitCount; ++i) {
+ const MuseumExit &exit = room->exits[i];
+ if (exit.action != action)
+ continue;
+ const Common::Point entry(exit.x, exit.y);
+ if (exit.destination == _room) {
+ changeFloor(exit.upperFloor, entry);
+ } else {
+ _upperFloor = exit.upperFloor;
+ if (!enterRoom(exit.destination, entry, 3))
+ error("Cannot load museum room %u", exit.destination);
+ }
+ return;
+ }
+ for (uint i = 0; i < room->responseCount; ++i) {
+ const MuseumResponse &response = room->responses[i];
+ if (response.action == action) {
+ say(response.cue, response.variation);
+ return;
+ }
+ }
+ for (uint i = 0; i < ARRAYSIZE(kGlobalResponses); ++i) {
+ const MuseumResponse &response = kGlobalResponses[i];
+ if (response.action == action) {
+ say(response.cue, response.variation, true);
+ return;
+ }
+ }
+ warning("Runaway museum: room %u action %u is not implemented yet", _room, action);
+}
+
+void RunawayMuseumScene::setCameraX(int x) {
+ _camera.x = CLIP<int>(x, 0, MAX<int>(0, _background.w - kRunawayScreenWidth));
+}
+
+void RunawayMuseumScene::updateCamera() {
+ setCameraX(_position.x - kRunawayScreenWidth / 2);
+ _camera.y = _room == kMuseumHall && _upperFloor ? 0 :
+ CLIP<int>(_position.y - 400, _room == kMuseumHall ? 200 : 0, _background.h - kRunawayViewportHeight);
+}
+
+float RunawayMuseumScene::actorHeight() const {
+ switch (_room) {
+ case kMuseumOffice:
+ return actorHeight4030();
+ case kMuseumLaboratory:
+ return actorHeight4050();
+ case kMuseumHall:
+ return actorHeight4060();
+ case kMuseumExhibition:
+ return actorHeight4090();
+ case kMuseumSecurity:
+ return actorHeight4100();
+ default:
+ return 455;
+ }
+}
+
+void RunawayMuseumScene::update(uint32 now, int scrollDirection, bool inventoryOpen) {
+ _now = now;
+ const uint elapsed = MIN<uint>(100, now - _lastUpdate);
+ _lastUpdate = now;
+ if (speaking() && (int32)(now - _subtitleUntil) >= 0)
+ skipSpeech();
+ if (inventoryOpen || _room == kMuseumKeypad)
+ return;
+ if (_pathIndex < _path.size() && !speaking()) {
+ float travel = elapsed * 0.18f * actorHeight() / 455;
+ while (travel > 0 && _pathIndex < _path.size()) {
+ const Common::Point target = _path[_pathIndex];
+ const float dx = target.x - _x, dy = target.y - _y;
+ const float distance = sqrtf(dx * dx + dy * dy);
+ if (distance > 0) {
+ if (ABS(dx) > ABS(dy) * 2)
+ _facing = dx > 0 ? 2 : 6;
+ else if (ABS(dy) > ABS(dx) * 2)
+ _facing = dy > 0 ? 4 : 0;
+ else
+ _facing = dy > 0 ? (dx > 0 ? 3 : 5) : (dx > 0 ? 1 : 7);
+ }
+ if (distance <= travel) {
+ _x = target.x;
+ _y = target.y;
+ travel -= distance;
+ ++_pathIndex;
+ } else {
+ _x += dx * travel / distance;
+ _y += dy * travel / distance;
+ travel = 0;
+ }
+ }
+ _position = Common::Point((int)(_x + 0.5f), (int)(_y + 0.5f));
+ _walkElapsed += elapsed;
+ if (_pathIndex == _path.size())
+ arrive();
+ }
+ const bool walking = _pathIndex < _path.size();
+ _actor.setFrame(_facing, walking ? 1 + (_walkElapsed / 60) % 12 : 0);
+ if (scrollDirection)
+ setCameraX(_camera.x + scrollDirection * MAX<int>(1, elapsed / (_fastScrolling ? 2 : 4)));
+ else if (walking)
+ setCameraX(_camera.x + CLIP<int>(_position.x - kRunawayScreenWidth / 2 - _camera.x,
+ -MIN<int>(_fastScrolling ? 8 : 4, elapsed), MIN<int>(_fastScrolling ? 8 : 4, elapsed)));
+ if (_room == kMuseumHall && !_upperFloor)
+ _camera.y = CLIP<int>(_position.y - 400, 200, 600);
+}
+
+void RunawayMuseumScene::draw() {
+ _screen.clear();
+ _screen.copyRectToSurface(_background, 0, kRunawayViewportTop,
+ Common::Rect(_camera.x, _camera.y, _camera.x + kRunawayScreenWidth, _camera.y + kRunawayViewportHeight));
+ Graphics::ManagedSurface viewport(_screen, Common::Rect(0, kRunawayViewportTop, kRunawayScreenWidth, kRunawayViewportTop + kRunawayViewportHeight));
+ if (_room == kMuseumKeypad) {
+ drawScene4140(viewport);
+ return;
+ }
+ _ambient.draw(viewport, 0, _camera.x, -_camera.y);
+ _overlay.draw(viewport, 0, _camera.x, -_camera.y);
+ RunawayActor::RenderParams params;
+ memset(params.depthY, 0, sizeof(params.depthY));
+ switch (_room) {
+ case kMuseumHall:
+ setupDepth4060(params);
+ break;
+ case kMuseumExhibition:
+ setupDepth4090(params);
+ break;
+ case kMuseumSecurity:
+ setupDepth4100(params);
+ break;
+ default:
+ break;
+ }
+ params.position = _position;
+ params.camera = _camera;
+ params.roomWidth = _background.w;
+ params.height = actorHeight();
+ params.antialias = _antialias;
+ const byte light = MIN<byte>(9, _maps[768 + _mask[_position.y * _background.w + _position.x]]);
+ memcpy(params.light, findRoom(_room)->light[light], sizeof(params.light));
+ _actor.draw(_screen, params, _mask, _maps);
+ if (_room == kMuseumOffice)
+ drawForeground4030(viewport);
+ else if (_room == kMuseumLaboratory)
+ drawForeground4050(viewport);
+}
+
+void RunawayMuseumScene::drawForeground(Graphics::ManagedSurface &viewport, uint layer) {
+ assert(layer < ARRAYSIZE(_foreground));
+ for (uint span = 0; span < _foreground[layer].size(); ++span) {
+ const Common::Rect &rect = _foreground[layer][span];
+ viewport.blitFrom(_background, rect, Common::Point(rect.left - _camera.x, rect.top - _camera.y));
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
new file mode 100644
index 00000000000..49d8a5c8692
--- /dev/null
+++ b/engines/hollywood/runaway/scene.h
@@ -0,0 +1,174 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HOLLYWOOD_RUNAWAY_SCENE_H
+#define HOLLYWOOD_RUNAWAY_SCENE_H
+
+#include "hollywood/resource.h"
+#include "hollywood/runaway/audio.h"
+#include "hollywood/runaway/graphics.h"
+#include "hollywood/runaway/inventory.h"
+#include "hollywood/scene_text_store.h"
+
+namespace Hollywood {
+
+class RunawayScene {
+public:
+ virtual ~RunawayScene() {}
+ virtual bool load() = 0;
+ virtual void start(uint32 now) = 0;
+ virtual void click(Common::Point mouse, RunawayVerb verb, byte item) = 0;
+ virtual void update(uint32 now, int scrollDirection, bool inventoryOpen) = 0;
+ virtual void draw() = 0;
+ virtual void setCameraX(int x) = 0;
+ virtual int roomWidth() const = 0;
+ virtual Graphics::ManagedSurface &screen() = 0;
+ virtual byte hotspotAt(Common::Point mouse) const = 0;
+ virtual Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const = 0;
+ virtual const Common::U32String &committedCaption() const = 0;
+ virtual const Common::U32String &subtitle() const = 0;
+ virtual bool busy() const = 0;
+ virtual bool speaking() const = 0;
+ virtual byte speechFrame() const { return 0; }
+ virtual void skipSpeech() = 0;
+ virtual bool playingVideo() const { return false; }
+ virtual bool inventoryPresentation() const { return false; }
+ virtual void skipVideo() {}
+ virtual void sayInventory(const RunawayInventory::Reply &reply) = 0;
+ virtual bool escaped() const { return false; }
+ virtual bool canSave() const { return false; }
+ virtual void captureState(RunawaySaveState &state) const {}
+ virtual bool restoreState(const RunawaySaveState &state, uint32 now) { return false; }
+ virtual void setOptions(bool antialias, bool fastScrolling) = 0;
+};
+
+class RunawayStrings;
+struct MuseumHotspot;
+
+// Shared player for the museum demo's numbered scenes.
+class RunawayMuseumScene : public RunawayScene {
+public:
+ RunawayMuseumScene(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings);
+ bool load() override;
+ void start(uint32 now) override;
+ void click(Common::Point mouse, RunawayVerb verb, byte item) override;
+ void update(uint32 now, int scrollDirection, bool inventoryOpen) override;
+ void draw() override;
+ void setCameraX(int x) override;
+ int roomWidth() const override { return _background.w; }
+ Graphics::ManagedSurface &screen() override { return _screen; }
+ byte hotspotAt(Common::Point mouse) const override;
+ Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
+ const Common::U32String &committedCaption() const override { return _caption; }
+ const Common::U32String &subtitle() const override { return _subtitle; }
+ bool busy() const override { return _pendingHotspot != 0 || speaking(); }
+ bool speaking() const override { return !_subtitle.empty(); }
+ void skipSpeech() override;
+ void sayInventory(const RunawayInventory::Reply &reply) override;
+ void setOptions(bool antialias, bool fastScrolling) override { _antialias = antialias; _fastScrolling = fastScrolling; }
+
+private:
+ enum ObjectState { kUnexamined, kIdentified, kTaken };
+ enum ActionResult { kUnhandled, kHandled, kBackgroundChanged };
+
+ bool enterRoom(uint16 room, Common::Point position, byte facing);
+ bool loadForeground(uint layer, uint chunk);
+ void drawForeground(Graphics::ManagedSurface &viewport, uint layer);
+ bool rebuildBackground();
+ bool applyPatch(uint chunk);
+ void updateMaps();
+ void walkTo(Common::Point target);
+ void arrive();
+ void execute(uint16 action);
+ void useItem(byte item, byte hotspot);
+ void say(uint16 cue, byte variation = 0, bool global = false);
+ void queueLine(const Common::U32String &line);
+ void showLine();
+ void changeFloor(bool upper, Common::Point position);
+ void updateCamera();
+ float actorHeight() const;
+ const MuseumHotspot *hotspot(byte id) const;
+ Common::U32String hotspotName(byte id) const;
+
+ byte walkZone() const { return _originalMaps[_mask[_position.y * _background.w + _position.x]]; }
+
+ bool loadScene4030();
+ bool applyBackground4030();
+ void updateMaps4030();
+ Common::U32String hotspotName4030(byte id) const;
+ ActionResult execute4030(uint16 action);
+ float actorHeight4030() const;
+ void drawForeground4030(Graphics::ManagedSurface &viewport);
+
+ bool loadScene4050();
+ bool applyBackground4050();
+ void updateMaps4050();
+ ActionResult execute4050(uint16 action);
+ float actorHeight4050() const;
+ void drawForeground4050(Graphics::ManagedSurface &viewport);
+
+ bool loadScene4060();
+ void updateMaps4060();
+ ActionResult execute4060(uint16 action);
+ float actorHeight4060() const;
+ void setupDepth4060(RunawayActor::RenderParams ¶ms) const;
+
+ float actorHeight4090() const;
+ void setupDepth4090(RunawayActor::RenderParams ¶ms) const;
+
+ float actorHeight4100() const;
+ void setupDepth4100(RunawayActor::RenderParams ¶ms) const;
+
+ bool loadScene4140();
+ void clickScene4140(byte id);
+ void drawScene4140(Graphics::ManagedSurface &viewport);
+
+ RunawayAudio _audio;
+ RunawayInventory &_inventory;
+ const RunawayStrings &_strings;
+ ChunkArchive _archive;
+ SceneTextStore _text;
+ RunawayActor _actor;
+ RunawayAnimation _ambient, _overlay, _safe;
+ Graphics::ManagedSurface _background, _screen;
+ Common::Array<byte> _mask, _originalMaps, _maps;
+ Common::Array<Common::Rect> _foreground[5];
+ Common::Array<byte> _keyPatches[25];
+ Common::Array<Common::Point> _path;
+ Common::Array<Common::U32String> _lines;
+ Common::U32String _subtitle, _caption;
+ Common::Point _position, _camera;
+ uint _pathIndex = 0, _lineIndex = 0;
+ uint16 _room = 0, _pendingAction = 0;
+ byte _facing = 3, _pendingHotspot = 0, _pendingItem = 0;
+ float _x = 0, _y = 0;
+ uint32 _now = 0, _lastUpdate = 0, _walkElapsed = 0, _subtitleUntil = 0;
+ bool _upperFloor = true, _antialias = true, _fastScrolling = true;
+ ObjectState _books = kUnexamined, _recorder = kUnexamined;
+ bool _moneyIdentified = false, _safeOpen = false;
+ bool _varnishTaken = false, _talcTaken = false, _coffeeTaken = false;
+ byte _keyCount = 0, _pressedKey = 0;
+ uint32 _keyUntil = 0;
+};
+
+} // End of namespace Hollywood
+
+#endif // HOLLYWOOD_RUNAWAY_SCENE_H
diff --git a/engines/hollywood/runaway/scene4030.cpp b/engines/hollywood/runaway/scene4030.cpp
new file mode 100644
index 00000000000..6cd0b6fddfc
--- /dev/null
+++ b/engines/hollywood/runaway/scene4030.cpp
@@ -0,0 +1,185 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const MuseumHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Door", 1165, 594, 2, {322, 301}, {0, 0}},
+ {"Pair of books", 355, 595, 1, {302, 303}, {0, 1}},
+ {"Crack", 355, 595, 1, {304, 305}, {1, 0}},
+ {"Money", 550, 647, 7, {306, 307}, {0, 0}},
+ {"Papers", 550, 647, 7, {308, 319}, {1, 0}},
+ {"Device", 550, 647, 7, {309, 310}, {1, 1}},
+ {"Shelves", 815, 508, 1, {311, 312}, {0, 0}},
+ {"Secret safe", 550, 647, 7, {313, 314}, {0, 0}},
+ {"Shelves", 104, 536, 7, {315, 316}, {0, 0}},
+ {"Window", 369, 499, 7, {317, 318}, {1, 0}},
+};
+
+const MuseumResponse kResponses[] = {
+ {kMuseumOffice, 305, 4, 0},
+ {kMuseumOffice, 306, 5, 0},
+ {kMuseumOffice, 307, 6, 0},
+ {kMuseumOffice, 311, 11, 0},
+ {kMuseumOffice, 312, 12, 0},
+ {kMuseumOffice, 313, 13, 0},
+ {kMuseumOffice, 314, 14, 0},
+ {kMuseumOffice, 315, 15, 0},
+ {kMuseumOffice, 316, 16, 0},
+ {kMuseumOffice, 317, 17, 0},
+ {kMuseumOffice, 318, 18, 0},
+ {kMuseumOffice, 319, 8, 0},
+ {kMuseumOffice, 320, 19, 0},
+ {kMuseumOffice, 322, 22, 0},
+};
+
+const MuseumItemAction kItemActions[] = {
+ {kMuseumOffice, 17, 3, 321},
+ {kMuseumOffice, 0, 3, 320},
+};
+
+const MuseumExit kExits[] = {
+ {kMuseumOffice, 301, kMuseumHall, 607, 323, true},
+};
+
+} // End of anonymous namespace
+
+const MuseumRoom kRunawayScene4030 = {
+ kMuseumOffice, 1200, 670, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {50, 50, 50}, {80, 80, 60}},
+ Common::Point(934, 563),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ kExits, ARRAYSIZE(kExits)
+};
+
+void RunawayMuseumScene::updateMaps4030() {
+ for (uint i = 0; i < 256; ++i) {
+ byte &id = _maps[256 + i];
+ if (_books != kTaken && (id == 2 || id == 3))
+ id = 2;
+ else if (_books == kTaken && id == 2)
+ id = 0;
+ if (!_safeOpen && (id == 4 || id == 5 || id == 6 || id == 8))
+ id = 0;
+ else if (_safeOpen && id == 8)
+ id = 0;
+ if (_recorder == kTaken && id == 6)
+ id = 4;
+ }
+}
+
+Common::U32String RunawayMuseumScene::hotspotName4030(byte id) const {
+ if (id == 2 && _books != kUnexamined)
+ return _inventory.name(16);
+ if (id == 5)
+ return _moneyIdentified ? Common::U32String("Money") : Common::U32String("Papers");
+ if (id == 6)
+ return _recorder != kUnexamined ? _inventory.name(5) : Common::U32String("Device");
+ return Common::U32String(hotspot(id)->name);
+}
+
+RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4030(uint16 action) {
+ if (action == 301 && _safeOpen) {
+ say(21);
+ return kHandled;
+ }
+ switch (action) {
+ case 302: // Examine the books.
+ say(_books != kUnexamined ? 111 : 1, 0, _books != kUnexamined);
+ _books = MAX(_books, kIdentified);
+ return kHandled;
+ case 303: // Take the books, revealing the crack.
+ _books = kTaken;
+ _inventory.add(16);
+ say(2);
+ say(2, 1);
+ say(2, 2);
+ return kBackgroundChanged;
+ case 304:
+ say(3, _safeOpen);
+ return kHandled;
+ case 308:
+ say(7, _moneyIdentified);
+ _moneyIdentified = true;
+ return kHandled;
+ case 309:
+ say(9, _recorder != kUnexamined);
+ _recorder = MAX(_recorder, kIdentified);
+ return kHandled;
+ case 310: // Take the recorder.
+ _recorder = kTaken;
+ _inventory.add(5);
+ say(10);
+ say(10, 1);
+ return kBackgroundChanged;
+ case 321: // Toggle the safe with the strange key.
+ _safeOpen = !_safeOpen;
+ _inventory.select(0);
+ if (_safeOpen) {
+ say(20);
+ say(20, 1);
+ }
+ return kBackgroundChanged;
+ default:
+ break;
+ }
+ return kUnhandled;
+}
+
+float RunawayMuseumScene::actorHeight4030() const {
+ const int x = _position.x, y = _position.y;
+ return x < 459 ? y * 0.369863f + 208.301376f : y * 0.516304f + 110.625f;
+}
+
+bool RunawayMuseumScene::loadScene4030() {
+ return loadForeground(0, 4) && loadForeground(1, 5) && loadForeground(2, 6) &&
+ loadForeground(3, 7) && loadForeground(4, 12);
+}
+
+bool RunawayMuseumScene::applyBackground4030() {
+ if (_books == kTaken && !applyPatch(8))
+ return false;
+ if (!_safe.load(_archive, _recorder == kTaken ? 15 : 14, 13))
+ return false;
+ _safe.draw(_background, _safeOpen ? 12 : 0, 0, 0);
+ return true;
+}
+
+void RunawayMuseumScene::drawForeground4030(Graphics::ManagedSurface &viewport) {
+ const byte zone = walkZone();
+ if (zone == 3)
+ drawForeground(viewport, 0);
+ if (zone == 4 && _books == kUnexamined)
+ drawForeground(viewport, 1);
+ if (zone == 5)
+ drawForeground(viewport, 2);
+ drawForeground(viewport, 3);
+ if (zone == 4 && _books != kUnexamined)
+ drawForeground(viewport, 4);
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4050.cpp b/engines/hollywood/runaway/scene4050.cpp
new file mode 100644
index 00000000000..0892ceb8712
--- /dev/null
+++ b/engines/hollywood/runaway/scene4050.cpp
@@ -0,0 +1,177 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const MuseumHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Door", 227, 503, 7, {301, 339}, {0, 1}},
+ {"Shelves", 311, 493, 7, {302, 303}, {0, 0}},
+ {"Susan", 382, 529, 1, {304, 305}, {0, 1}},
+ {"Electric lathe", 395, 529, 1, {306, 307}, {0, 0}},
+ {"Microscope", 460, 543, 1, {308, 309}, {0, 0}},
+ {"Water dispenser", 637, 570, 1, {310, 311}, {0, 0}},
+ {"Wastepaper basket", 703, 575, 1, {312, 313}, {1, 0}},
+ {"Tank", 844, 505, 1, {314, 315}, {0, 0}},
+ {"Machine", 884, 580, 1, {316, 317}, {0, 0}},
+ {"Laser", 992, 556, 1, {318, 319}, {0, 0}},
+ {"Shelves", 1327, 521, 1, {320, 321}, {0, 0}},
+ {"Briefcase", 1277, 514, 7, {322, 323}, {1, 1}},
+ {"Skeleton", 1211, 510, 7, {324, 325}, {0, 0}},
+ {"Strange brush", 824, 531, 7, {337, 338}, {1, 1}},
+};
+
+const MuseumResponse kResponses[] = {
+ {kMuseumLaboratory, 301, 1, 0},
+ {kMuseumLaboratory, 306, 6, 0},
+ {kMuseumLaboratory, 307, 7, 0},
+ {kMuseumLaboratory, 308, 8, 0},
+ {kMuseumLaboratory, 309, 9, 0},
+ {kMuseumLaboratory, 310, 10, 0},
+ {kMuseumLaboratory, 311, 11, 0},
+ {kMuseumLaboratory, 314, 12, 0},
+ {kMuseumLaboratory, 316, 13, 0},
+ {kMuseumLaboratory, 319, 15, 0},
+ {kMuseumLaboratory, 320, 16, 0},
+ {kMuseumLaboratory, 321, 17, 0},
+ {kMuseumLaboratory, 322, 18, 0},
+ {kMuseumLaboratory, 324, 20, 0},
+ {kMuseumLaboratory, 325, 21, 0},
+ {kMuseumLaboratory, 326, 22, 2},
+ {kMuseumLaboratory, 332, 27, 0},
+ {kMuseumLaboratory, 334, 29, 0},
+ {kMuseumLaboratory, 337, 31, 0},
+};
+
+const MuseumItemAction kItemActions[] = {
+ {kMuseumLaboratory, 7, 2, 326},
+ {kMuseumLaboratory, 0, 2, 15},
+ {kMuseumLaboratory, 5, 3, 328},
+ {kMuseumLaboratory, 7, 3, 327},
+ {kMuseumLaboratory, 8, 3, 329},
+ {kMuseumLaboratory, 11, 3, 330},
+ {kMuseumLaboratory, 12, 3, 330},
+ {kMuseumLaboratory, 15, 3, 331},
+ {kMuseumLaboratory, 0, 3, 30},
+ {kMuseumLaboratory, 14, 4, 333},
+ {kMuseumLaboratory, 0, 4, 332},
+ {kMuseumLaboratory, 0, 5, 334},
+ {kMuseumLaboratory, 0, 7, 19},
+ {kMuseumLaboratory, 12, 10, 336},
+ {kMuseumLaboratory, 0, 10, 335},
+ {kMuseumLaboratory, 0, 11, 15},
+};
+
+const MuseumExit kExits[] = {
+ {kMuseumLaboratory, 339, kMuseumHall, 873, 311, true},
+};
+
+} // End of anonymous namespace
+
+const MuseumRoom kRunawayScene4050 = {
+ kMuseumLaboratory, 1552, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {60, 60, 70}, {70, 70, 80}, {60, 60, 70}},
+ Common::Point(382, 529),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ kExits, ARRAYSIZE(kExits)
+};
+
+void RunawayMuseumScene::updateMaps4050() {
+ for (uint i = 0; i < 256; ++i) {
+ byte &id = _maps[256 + i];
+ if (id == 4 || id == 15 || id == 19 || (_talcTaken && id == 14))
+ id = 0;
+ else if (id == 16)
+ id = 13;
+ else if (id == 17)
+ id = 10;
+ else if (id == 18)
+ id = 3;
+ }
+}
+
+RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4050(uint16 action) {
+ switch (action) {
+ case 323: // Take the varnish from the briefcase.
+ if (_varnishTaken) {
+ say(19, 2);
+ return kHandled;
+ }
+ _varnishTaken = true;
+ _inventory.add(9);
+ say(19);
+ say(19, 1);
+ return kHandled;
+ case 338: // Take the talcum powder.
+ _talcTaken = true;
+ _inventory.add(10);
+ say(31);
+ return kBackgroundChanged;
+ default:
+ break;
+ }
+ return kUnhandled;
+}
+
+float RunawayMuseumScene::actorHeight4050() const {
+ const int x = _position.x, y = _position.y;
+ const byte zone = walkZone();
+ if (zone == 4)
+ return y * 1.3125f - 341.0625f;
+ if (zone == 3)
+ return x * 0.089147285f + 291.697662f + y - 578;
+ if (zone == 5)
+ return 291.697662f + 992 * 0.089147285f - (583 - y) * 0.5882353f - 1;
+ if (x < 396)
+ return 327;
+ if (x < 913)
+ return x * 0.089147285f + 291.697662f;
+ if (x < 1174)
+ return x * 0.09578544f + 285.643677f;
+ return MIN(y, 587) * 0.8181818f - 82.272728f;
+}
+
+bool RunawayMuseumScene::loadScene4050() {
+ return _ambient.load(_archive, 8, 75) && _overlay.load(_archive, 22, 1) &&
+ loadForeground(0, 4) && loadForeground(1, 5) && loadForeground(2, 6) && loadForeground(3, 7);
+}
+
+bool RunawayMuseumScene::applyBackground4050() {
+ return !_talcTaken || applyPatch(11);
+}
+
+void RunawayMuseumScene::drawForeground4050(Graphics::ManagedSurface &viewport) {
+ if (_position.x > 1200)
+ drawForeground(viewport, 0);
+ if (_position.x > 789 && _position.x < 846 && _position.y < 541)
+ drawForeground(viewport, 1);
+ if (_position.x < 430)
+ drawForeground(viewport, 2);
+ if (_position.y < 501)
+ drawForeground(viewport, 3);
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4060.cpp b/engines/hollywood/runaway/scene4060.cpp
new file mode 100644
index 00000000000..b9578b9ebb0
--- /dev/null
+++ b/engines/hollywood/runaway/scene4060.cpp
@@ -0,0 +1,194 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const MuseumHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Stairs", -25, 319, 7, {301, 302}, {0, 1}},
+ {"Coffee machines", 218, 379, 7, {321, 322}, {1, 1}},
+ {"Clive's office door", 607, 323, 7, {311, 312}, {0, 1}},
+ {"Fire extinguisher", 696, 319, 7, {332, 333}, {0, 0}},
+ {"Wastepaper basket", 696, 319, 7, {313, 314}, {1, 1}},
+ {"Door to the restoration laboratory", 873, 311, 7, {315, 316}, {0, 1}},
+ {"Security door", 1118, 309, 7, {317, 318}, {1, 1}},
+ {"Panel", 1153, 297, 7, {319, 320}, {0, 1}},
+ {"Stairs", 1220, 280, 7, {301, 303}, {0, 1}},
+ {"Telephone", 1473, 312, 7, {324, 325}, {0, 1}},
+ {"Display case", 1596, 351, 1, {326, 327}, {0, 0}},
+ {"Stairs", 140, 504, 7, {304, 305}, {0, 1}},
+ {"Stairs", 1085, 411, 7, {304, 306}, {0, 1}},
+ {"Maintenance worker", 921, 813, 7, {307, 308}, {0, 1}},
+ {"Mayan exhibition", 1588, 506, 7, {309, 310}, {0, 1}},
+ {"Plaque", 711, 797, 7, {328, 329}, {1, 0}},
+ {"Plaque", 1060, 730, 7, {330, 331}, {1, 0}},
+};
+
+const MuseumResponse kResponses[] = {
+ {kMuseumHall, 301, 1, 0},
+ {kMuseumHall, 304, 2, 0},
+ {kMuseumHall, 309, 4, 0},
+ {kMuseumHall, 311, 5, 0},
+ {kMuseumHall, 314, 7, 0},
+ {kMuseumHall, 315, 8, 0},
+ {kMuseumHall, 317, 9, 0},
+ {kMuseumHall, 318, 13, 0},
+ {kMuseumHall, 319, 10, 0},
+ {kMuseumHall, 321, 11, 0},
+ {kMuseumHall, 323, 13, 0},
+ {kMuseumHall, 324, 14, 0},
+ {kMuseumHall, 326, 16, 0},
+ {kMuseumHall, 327, 17, 0},
+ {kMuseumHall, 328, 18, 0},
+ {kMuseumHall, 329, 19, 0},
+ {kMuseumHall, 330, 20, 0},
+ {kMuseumHall, 331, 19, 0},
+ {kMuseumHall, 332, 21, 0},
+ {kMuseumHall, 333, 22, 0},
+ {kMuseumHall, 336, 25, 0},
+ {kMuseumHall, 339, 29, 0},
+ {kMuseumHall, 340, 30, 0},
+ {kMuseumHall, 341, 31, 0},
+ {kMuseumHall, 343, 34, 0},
+ {kMuseumHall, 344, 35, 0},
+};
+
+const MuseumItemAction kItemActions[] = {
+ {kMuseumHall, 19, 2, 346},
+ {kMuseumHall, 0, 5, 19},
+ {kMuseumHall, 9, 8, 337},
+ {kMuseumHall, 10, 8, 338},
+ {kMuseumHall, 1, 14, 11},
+ {kMuseumHall, 2, 14, 11},
+ {kMuseumHall, 3, 14, 11},
+ {kMuseumHall, 4, 14, 11},
+ {kMuseumHall, 5, 14, 334},
+ {kMuseumHall, 6, 14, 335},
+ {kMuseumHall, 7, 14, 336},
+ {kMuseumHall, 8, 14, 11},
+ {kMuseumHall, 9, 14, 11},
+ {kMuseumHall, 10, 14, 11},
+ {kMuseumHall, 11, 14, 339},
+ {kMuseumHall, 12, 14, 340},
+ {kMuseumHall, 13, 14, 341},
+ {kMuseumHall, 14, 14, 342},
+ {kMuseumHall, 15, 14, 343},
+ {kMuseumHall, 16, 14, 11},
+ {kMuseumHall, 17, 14, 344},
+ {kMuseumHall, 18, 14, 11},
+ {kMuseumHall, 19, 14, 345},
+};
+
+const MuseumExit kExits[] = {
+ {kMuseumHall, 302, kMuseumHall, 533, 848, false},
+ {kMuseumHall, 303, kMuseumHall, 1169, 643, false},
+ {kMuseumHall, 305, kMuseumHall, 69, 372, true},
+ {kMuseumHall, 306, kMuseumHall, 1290, 300, true},
+ {kMuseumHall, 310, kMuseumExhibition, 881, 392, false},
+ {kMuseumHall, 312, kMuseumOffice, 934, 563, true},
+ {kMuseumHall, 316, kMuseumLaboratory, 382, 529, true},
+ {kMuseumHall, 320, kMuseumKeypad, 0, 0, true},
+};
+
+} // End of anonymous namespace
+
+const MuseumRoom kRunawayScene4060 = {
+ kMuseumHall, 1760, 1200, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {40, 40, 40}, {30, 30, 30}, {60, 60, 60}, {30, 30, 30}, {70, 70, 70}, {20, 20, 25}, {50, 50, 50}, {60, 60, 70}, {70, 70, 80}},
+ Common::Point(873, 311),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ kExits, ARRAYSIZE(kExits)
+};
+
+void RunawayMuseumScene::updateMaps4060() {
+ for (uint i = 0; i < 256; ++i) {
+ byte &id = _maps[256 + i];
+ // Both floors share the image and mask, but have separate walk zones and hotspots.
+ const byte zone = _maps[i];
+ if (_upperFloor ? zone < 5 || zone > 6 : zone > 4)
+ _maps[i] = 0;
+ if (_upperFloor ? id > 11 : id < 12)
+ id = 0;
+ }
+}
+
+void RunawayMuseumScene::changeFloor(bool upper, Common::Point position) {
+ _upperFloor = upper;
+ _position = position;
+ _x = position.x;
+ _y = position.y;
+ _facing = 3;
+ updateMaps();
+ updateCamera();
+}
+
+RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4060(uint16 action) {
+ if (action != 313)
+ return kUnhandled;
+ if (_coffeeTaken) {
+ say(7);
+ return kHandled;
+ }
+ _coffeeTaken = true;
+ _inventory.add(19);
+ say(6);
+ say(6, 1);
+ return kHandled;
+}
+
+float RunawayMuseumScene::actorHeight4060() const {
+ const int x = _position.x, y = _position.y;
+ const byte zone = walkZone();
+ if (_upperFloor) {
+ if (x < 69)
+ return x * 1.289855f + 140;
+ if (x < 1120)
+ return x * -0.04883463f + 241.64595f;
+ if (x < 1474)
+ return x * -0.01977401f + 209.127121f;
+ return x * 0.3125f - 280.3125f;
+ }
+ if (zone == 7 || zone == 8)
+ return y * 0.4370861f - 140.649f;
+ if (zone == 12 || zone == 13)
+ return y * 0.29007635f - 33.519085f;
+ return (y * 0.4347826f - 118.695656f + x * -0.08982036f + 258.263458f) / 2;
+}
+
+void RunawayMuseumScene::setupDepth4060(RunawayActor::RenderParams ¶ms) const {
+ const byte zone = walkZone();
+ params.depthY[1] = 1199;
+ params.depthY[2] = zone == 1 ? 1199 : 0;
+ params.depthY[3] = zone == 13 || zone == 15 || zone == 16 || zone == 17 ? 1199 : 0;
+ params.depthY[4] = zone == 19 || zone == 8 || zone == 7 ? 1199 : 0;
+ params.depthY[5] = zone == 17 || zone == 18 ? 1199 : 0;
+}
+
+bool RunawayMuseumScene::loadScene4060() {
+ return _ambient.load(_archive, 8, 22);
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4090.cpp b/engines/hollywood/runaway/scene4090.cpp
new file mode 100644
index 00000000000..cf4ba3eca5c
--- /dev/null
+++ b/engines/hollywood/runaway/scene4090.cpp
@@ -0,0 +1,85 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const MuseumHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Exhibition hall", 1100, 204, 1, {302, 301}, {0, 3}},
+ {"Statue", 826, 442, 3, {303, 304}, {1, 0}},
+ {"Statue", 572, 420, 1, {305, 306}, {1, 0}},
+ {"Mayan objects", 572, 420, 1, {307, 308}, {1, 1}},
+ {"Mayan arch", 316, 382, 7, {309, 310}, {0, 0}},
+ {"Mayan arch", 532, 238, 0, {311, 312}, {0, 0}},
+ {"Mayan object", 280, 491, 7, {313, 314}, {1, 0}},
+ {"Mayan object", 302, 426, 7, {315, 316}, {1, 0}},
+ {"Mayan object", 316, 382, 7, {317, 318}, {1, 0}},
+};
+
+const MuseumResponse kResponses[] = {
+ {kMuseumExhibition, 302, 1, 0},
+ {kMuseumExhibition, 303, 2, 0},
+ {kMuseumExhibition, 304, 3, 0},
+ {kMuseumExhibition, 305, 4, 0},
+ {kMuseumExhibition, 306, 3, 0},
+ {kMuseumExhibition, 307, 5, 0},
+ {kMuseumExhibition, 309, 7, 0},
+ {kMuseumExhibition, 310, 8, 0},
+ {kMuseumExhibition, 311, 9, 0},
+ {kMuseumExhibition, 312, 8, 0},
+ {kMuseumExhibition, 313, 10, 0},
+ {kMuseumExhibition, 314, 11, 0},
+ {kMuseumExhibition, 315, 12, 0},
+ {kMuseumExhibition, 316, 11, 0},
+ {kMuseumExhibition, 317, 13, 0},
+ {kMuseumExhibition, 318, 11, 0},
+};
+
+const MuseumExit kExits[] = {
+ {kMuseumExhibition, 301, kMuseumHall, 1400, 600, false},
+};
+
+} // End of anonymous namespace
+
+const MuseumRoom kRunawayScene4090 = {
+ kMuseumExhibition, 1124, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {70, 70, 90}, {60, 60, 80}, {50, 50, 70}},
+ Common::Point(881, 392),
+ kResponses, ARRAYSIZE(kResponses),
+ nullptr, 0,
+ kExits, ARRAYSIZE(kExits)
+};
+
+float RunawayMuseumScene::actorHeight4090() const {
+ const int y = _position.y;
+ return MIN(y, 390) * 0.2f + 122;
+}
+
+void RunawayMuseumScene::setupDepth4090(RunawayActor::RenderParams ¶ms) const {
+ params.depthY[1] = 599;
+ params.depthY[2] = 374;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4100.cpp b/engines/hollywood/runaway/scene4100.cpp
new file mode 100644
index 00000000000..4a90bc871e0
--- /dev/null
+++ b/engines/hollywood/runaway/scene4100.cpp
@@ -0,0 +1,102 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const MuseumHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Door", 141, 468, 7, {301, 302}, {0, 1}},
+ {"First aid kit", 196, 451, 1, {303, 304}, {0, 0}},
+ {"Glass display case", 310, 457, 1, {305, 306}, {1, 1}},
+ {"Button", 204, 448, 1, {307, 308}, {1, 1}},
+ {"Mayan mask", 310, 457, 1, {309, 310}, {1, 1}},
+ {"Scanner", 912, 435, 0, {311, 312}, {0, 0}},
+ {"Tank", 1352, 431, 1, {315, 316}, {0, 0}},
+ {"Golden object", 111, 446, 1, {313, 314}, {1, 1}},
+ {"Device", 539, 439, 1, {317, 318}, {0, 0}},
+ {"Ladel", 1329, 409, 1, {328, 329}, {0, 1}},
+};
+
+const MuseumResponse kResponses[] = {
+ {kMuseumSecurity, 301, 1, 0},
+ {kMuseumSecurity, 303, 2, 0},
+ {kMuseumSecurity, 304, 3, 0},
+ {kMuseumSecurity, 307, 6, 0},
+ {kMuseumSecurity, 312, 11, 0},
+ {kMuseumSecurity, 316, 15, 0},
+ {kMuseumSecurity, 318, 17, 0},
+ {kMuseumSecurity, 319, 18, 0},
+ {kMuseumSecurity, 322, 21, 0},
+ {kMuseumSecurity, 323, 11, 0},
+ {kMuseumSecurity, 324, 22, 0},
+ {kMuseumSecurity, 326, 24, 0},
+ {kMuseumSecurity, 327, 25, 0},
+ {kMuseumSecurity, 328, 26, 0},
+};
+
+const MuseumItemAction kItemActions[] = {
+ {kMuseumSecurity, 5, 3, 321},
+ {kMuseumSecurity, 11, 3, 320},
+ {kMuseumSecurity, 0, 3, 319},
+ {kMuseumSecurity, 5, 4, 321},
+ {kMuseumSecurity, 7, 6, 323},
+ {kMuseumSecurity, 0, 6, 322},
+ {kMuseumSecurity, 6, 7, 330},
+ {kMuseumSecurity, 18, 7, 325},
+ {kMuseumSecurity, 0, 7, 324},
+ {kMuseumSecurity, 7, 9, 327},
+ {kMuseumSecurity, 0, 9, 326},
+};
+
+const MuseumExit kExits[] = {
+ {kMuseumSecurity, 302, kMuseumHall, 1118, 309, true}
+};
+
+} // End of anonymous namespace
+
+const MuseumRoom kRunawayScene4100 = {
+ kMuseumSecurity, 1536, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {40, 40, 60}, {30, 30, 50}, {20, 20, 40}},
+ Common::Point(141, 468),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ kExits, ARRAYSIZE(kExits)
+};
+
+float RunawayMuseumScene::actorHeight4100() const {
+ const int x = _position.x, y = _position.y;
+ if (x > 1260)
+ return MIN(y, 545) * 1.2807018f - 242.982452f;
+ if (x > 645)
+ return MIN(y, 545) * 0.73333335f + 55.333332f;
+ return MIN(y, 545) * 0.9381443f - 56.288658f;
+}
+
+void RunawayMuseumScene::setupDepth4100(RunawayActor::RenderParams ¶ms) const {
+ params.depthY[1] = 599;
+ params.depthY[2] = 477;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4140.cpp b/engines/hollywood/runaway/scene4140.cpp
new file mode 100644
index 00000000000..b392cae4078
--- /dev/null
+++ b/engines/hollywood/runaway/scene4140.cpp
@@ -0,0 +1,74 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+
+const MuseumRoom kRunawayScene4140 = {
+ kMuseumKeypad, 1024, 600, nullptr, 0, {},
+ Common::Point(382, 529),
+ nullptr, 0,
+ nullptr, 0,
+ nullptr, 0
+};
+
+void RunawayMuseumScene::clickScene4140(byte id) {
+ _pressedKey = id;
+ _keyUntil = _now + 180;
+ if (!id) {
+ if (!enterRoom(kMuseumHall, Common::Point(1153, 297), 7))
+ error("Cannot return to the museum hall");
+ } else if (id == 10) {
+ _keyCount = 0;
+ } else if (id == 12) {
+ _keyCount = 0;
+ warning("Runaway museum: the fingerprint puzzle is not implemented yet");
+ } else if (_keyCount < 4) {
+ ++_keyCount;
+ _audio.playEffect(id == 11 ? 11 : 11 + id);
+ } else {
+ say(4);
+ }
+}
+
+void RunawayMuseumScene::drawScene4140(Graphics::ManagedSurface &viewport) {
+ bool valid = applyRunawayPatch(_keyPatches[15], viewport);
+ for (uint i = 0; valid && i < _keyCount; ++i)
+ valid = applyRunawayPatch(_keyPatches[21 + i], viewport);
+ if (valid && _pressedKey && (int32)(_now - _keyUntil) < 0)
+ valid = applyRunawayPatch(_keyPatches[2 + _pressedKey], viewport);
+ if (!valid)
+ error("Invalid museum keypad image");
+}
+
+bool RunawayMuseumScene::loadScene4140() {
+ for (uint i = 3; i < ARRAYSIZE(_keyPatches); ++i) {
+ if (!_archive.readVariableChunk(i, _keyPatches[i]))
+ return false;
+ }
+ return true;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5030.cpp b/engines/hollywood/runaway/scene5030.cpp
index 88bb1b98464..b1f5eef093c 100644
--- a/engines/hollywood/runaway/scene5030.cpp
+++ b/engines/hollywood/runaway/scene5030.cpp
@@ -25,6 +25,7 @@
#include "common/util.h"
#include "hollywood/debug.h"
+#include "hollywood/runaway/navigation.h"
#include "hollywood/runaway/scene5030.h"
#include "hollywood/runaway/saveload.h"
#include "hollywood/runaway/strings.h"
@@ -66,28 +67,13 @@ const SceneHotspot kHotspots[] = {
bool RunawayScene5030::load() {
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
- Common::Array<byte> packedMask;
if (!_archive.open(Common::Path("RESOURCE.E03"), 50) ||
- !_archive.readVariableChunk(1, packedMask) ||
- !_archive.readVariableChunk(2, _maps) || _maps.size() != 1536 ||
+ !loadRunawayMask(_archive, kRoomWidth, kRoomHeight, _mask, _maps) ||
!_text.load("RESOURCE.003", "Runaway shack", 503, 0, 0x1135))
return false;
_background.create(kRoomWidth, kRoomHeight, format);
_screen.create(kScreenWidth, kScreenHeight, format);
- // 0x42b380 expands (byte value, uint16 length) runs into one room pixel
- // lookup. Tables 0..3 map those values to walking, hotspots, depth, lighting.
- _mask.resize(kRoomWidth * kRoomHeight);
- uint offset = 0;
- if (packedMask.size() % 3)
- return false;
- for (uint i = 0; i < packedMask.size(); i += 3) {
- const uint length = READ_LE_UINT16(packedMask.data() + i + 1);
- if (!length || length > _mask.size() - offset)
- return false;
- memset(_mask.data() + offset, packedMask[i], length);
- offset += length;
- }
- if (offset != _mask.size() || !_actor.load() ||
+ if (!_actor.load() ||
!_intro.load(_archive, 47, 20) || !_climb.load(_archive, 42, 18) ||
!_hatch.load(_archive, 14, 2) || !loadRoomGraphics() ||
!_video.load("DATAVE03.001"))
@@ -301,69 +287,10 @@ byte RunawayScene5030::hotspotAt(Common::Point mouse) const {
return id < ARRAYSIZE(kHotspots) && !_pickedUp[id] ? id : 0;
}
-bool RunawayScene5030::walkable(int x, int y) const {
- return x >= 0 && x < kRoomWidth && y >= 0 && y < kRoomHeight && _maps[_mask[y * kRoomWidth + x]] != 0;
-}
-
-bool RunawayScene5030::clearPath(Common::Point start, Common::Point end) const {
- const int count = MAX(ABS(end.x - start.x), ABS(end.y - start.y));
- for (int i = 0; i <= count; ++i) {
- const int x = start.x + (end.x - start.x) * i / MAX(1, count);
- const int y = start.y + (end.y - start.y) * i / MAX(1, count);
- if (!walkable(x, y))
- return false;
- }
- return true;
-}
-
void RunawayScene5030::walkTo(Common::Point target) {
- _path.clear();
+ RunawayWalkMap(kRoomWidth, kRoomHeight, _mask, _maps).findPath(_position, target, _path);
_pathIndex = 0;
- // Search only the connected floor. Using pixel resolution preserves the
- // one-pixel-wide approach to the plug, which a coarse navigation grid loses.
- Common::Array<int32> parent;
- Common::Array<int> queue;
- parent.resize(_mask.size());
- for (uint i = 0; i < parent.size(); ++i)
- parent[i] = -1;
- const int start = _position.y * kRoomWidth + _position.x;
- parent[start] = start;
- queue.push_back(start);
- int closest = start, bestDistance = 0x7fffffff;
- const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
- const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
- for (uint head = 0; head < queue.size(); ++head) {
- const int pixel = queue[head], x = pixel % kRoomWidth, y = pixel / kRoomWidth;
- const int distance = (x - target.x) * (x - target.x) + (y - target.y) * (y - target.y);
- if (distance < bestDistance) {
- closest = pixel;
- bestDistance = distance;
- if (!distance)
- break;
- }
- for (uint direction = 0; direction < 8; ++direction) {
- const int nx = x + dx[direction], ny = y + dy[direction], next = ny * kRoomWidth + nx;
- if (walkable(nx, ny) && parent[next] == -1) {
- parent[next] = pixel;
- queue.push_back(next);
- }
- }
- }
- Common::Array<Common::Point> reverse;
- for (int pixel = closest; pixel != start; pixel = parent[pixel])
- reverse.push_back(Common::Point(pixel % kRoomWidth, pixel / kRoomWidth));
- Common::Point previous = _position;
- for (int i = (int)reverse.size() - 1; i >= 0;) {
- int next = i;
- while (next > 0 && clearPath(previous, reverse[next - 1]))
- --next;
- previous = reverse[next];
- _path.push_back(previous);
- i = next - 1;
- }
_walkElapsed = _lastFootstep = 0;
- debugC(1, kDebugScene, "Runaway demo: walk to %d,%d, reachable %d,%d, %u waypoints",
- target.x, target.y, closest % kRoomWidth, closest / kRoomWidth, _path.size());
if (_path.empty())
arrive();
}
diff --git a/engines/hollywood/runaway/scene5030.h b/engines/hollywood/runaway/scene5030.h
index d2391519d0e..b908f6fe080 100644
--- a/engines/hollywood/runaway/scene5030.h
+++ b/engines/hollywood/runaway/scene5030.h
@@ -30,6 +30,7 @@
#include "hollywood/runaway/graphics.h"
#include "hollywood/runaway/inventory.h"
#include "hollywood/runaway/presentation.h"
+#include "hollywood/runaway/scene.h"
#include "hollywood/runaway/video.h"
#include "hollywood/scene_text_store.h"
@@ -37,7 +38,7 @@ namespace Hollywood {
// The demo starts in the shack. This scene owns its room resources, actor,
// interactions and audio; RunawayEngine owns the backend and event loop.
-class RunawayScene5030 {
+class RunawayScene5030 : public RunawayScene {
public:
enum {
kScreenWidth = kRunawayScreenWidth, kScreenHeight = kRunawayScreenHeight,
@@ -46,31 +47,32 @@ public:
RunawayScene5030(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings) :
_audio(mixer), _inventory(inventory), _strings(strings), _interrogation(mixer), _random("runawayShack"), _actor() {}
- bool load();
- void start(uint32 now);
- void click(Common::Point mouse, RunawayVerb verb, byte item);
- void update(uint32 now, int scrollDirection, bool inventoryOpen);
- void draw();
- void setCameraX(int x);
- Graphics::ManagedSurface &screen() { return _screen; }
- byte hotspotAt(Common::Point mouse) const;
- Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const;
- const Common::U32String &committedCaption() const { return _committedCaption; }
- const Common::U32String &subtitle() const { return _action == kPeekConversation ? _interrogation.subtitle() : _subtitle; }
- bool busy() const { return _action != kNone; }
- bool speaking() const { return _action == kPeekConversation ? _interrogation.speaking() : _speechRow != 0; }
- byte speechFrame() const { return _lipSync.frame(_now); }
- void skipSpeech();
- bool playingVideo() const { return _action == kIntroVideo || _action == kCleanWindowVideo; }
- bool inventoryPresentation() const { return _action == kIntroInventory; }
- void skipVideo();
+ bool load() override;
+ void start(uint32 now) override;
+ void click(Common::Point mouse, RunawayVerb verb, byte item) override;
+ void update(uint32 now, int scrollDirection, bool inventoryOpen) override;
+ void draw() override;
+ void setCameraX(int x) override;
+ int roomWidth() const override { return kRoomWidth; }
+ Graphics::ManagedSurface &screen() override { return _screen; }
+ byte hotspotAt(Common::Point mouse) const override;
+ Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
+ const Common::U32String &committedCaption() const override { return _committedCaption; }
+ const Common::U32String &subtitle() const override { return _action == kPeekConversation ? _interrogation.subtitle() : _subtitle; }
+ bool busy() const override { return _action != kNone; }
+ bool speaking() const override { return _action == kPeekConversation ? _interrogation.speaking() : _speechRow != 0; }
+ byte speechFrame() const override { return _lipSync.frame(_now); }
+ void skipSpeech() override;
+ bool playingVideo() const override { return _action == kIntroVideo || _action == kCleanWindowVideo; }
+ bool inventoryPresentation() const override { return _action == kIntroInventory; }
+ void skipVideo() override;
void cancelWalk();
- void sayInventory(const RunawayInventory::Reply &reply);
- bool escaped() const { return _escaped; }
- bool canSave() const { return !busy() && !speaking() && !_escaped && _pathIndex == _path.size(); }
- void captureState(RunawaySaveState &state) const;
- bool restoreState(const RunawaySaveState &state, uint32 now);
- void setOptions(bool antialias, bool fastScrolling) { _antialias = antialias; _fastScrolling = fastScrolling; }
+ void sayInventory(const RunawayInventory::Reply &reply) override;
+ bool escaped() const override { return _escaped; }
+ bool canSave() const override { return !busy() && !speaking() && !_escaped && _pathIndex == _path.size(); }
+ void captureState(RunawaySaveState &state) const override;
+ bool restoreState(const RunawaySaveState &state, uint32 now) override;
+ void setOptions(bool antialias, bool fastScrolling) override { _antialias = antialias; _fastScrolling = fastScrolling; }
private:
enum Action {
@@ -87,8 +89,6 @@ private:
enum IceState { kFrozen, kMelted, kDrained };
enum HatchState { kHidden, kLocked, kUnlocked, kOpen };
bool loadRoomGraphics();
- bool walkable(int x, int y) const;
- bool clearPath(Common::Point start, Common::Point end) const;
void walkTo(Common::Point target);
void arrive();
void say(uint16 row);
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
new file mode 100644
index 00000000000..e8a65b2c153
--- /dev/null
+++ b/engines/hollywood/runaway/scene_data.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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HOLLYWOOD_RUNAWAY_SCENE_DATA_H
+#define HOLLYWOOD_RUNAWAY_SCENE_DATA_H
+
+#include "common/rect.h"
+
+namespace Hollywood {
+
+enum MuseumRoomId {
+ kMuseumOffice = 4030,
+ kMuseumLaboratory = 4050,
+ kMuseumHall = 4060,
+ kMuseumExhibition = 4090,
+ kMuseumSecurity = 4100,
+ kMuseumKeypad = 4140
+};
+
+struct MuseumHotspot {
+ const char *name;
+ int16 x, y;
+ byte facing;
+ uint16 action[2]; // Look, use; IDs from the original room's action table.
+ byte approach[2];
+};
+
+struct MuseumItemAction {
+ uint16 room;
+ byte item, hotspot;
+ uint16 action;
+};
+
+struct MuseumResponse {
+ uint16 room, action, cue;
+ byte variation;
+};
+
+struct MuseumExit {
+ uint16 room, action, destination;
+ int16 x, y;
+ bool upperFloor;
+};
+
+struct MuseumRoom {
+ uint16 number, width, height;
+ const MuseumHotspot *hotspots;
+ uint hotspotCount;
+ byte light[10][3];
+ Common::Point entry;
+ const MuseumResponse *responses;
+ uint responseCount;
+ const MuseumItemAction *itemActions;
+ uint itemActionCount;
+ const MuseumExit *exits;
+ uint exitCount;
+};
+
+extern const MuseumRoom kRunawayScene4030;
+extern const MuseumRoom kRunawayScene4050;
+extern const MuseumRoom kRunawayScene4060;
+extern const MuseumRoom kRunawayScene4090;
+extern const MuseumRoom kRunawayScene4100;
+extern const MuseumRoom kRunawayScene4140;
+
+} // End of namespace Hollywood
+
+#endif // HOLLYWOOD_RUNAWAY_SCENE_DATA_H
diff --git a/engines/hollywood/runaway/strings.cpp b/engines/hollywood/runaway/strings.cpp
index 5aa8d784750..90b0a3b5d8b 100644
--- a/engines/hollywood/runaway/strings.cpp
+++ b/engines/hollywood/runaway/strings.cpp
@@ -25,63 +25,63 @@
namespace Hollywood {
namespace {
-// Original German, French and Spanish interface labels, plus localized
+// German, French, Spanish and English interface labels, plus localized
// messages for ScummVM saves and settings. All strings are UTF-8.
-const char *const kText[RunawayStrings::kTextCount][3] = {
- {"BETRACHTE ", "REGARDER ", "MIRAR "},
- {"NIMM ", "PRENDRE ", "COGER "},
- {"BENUTZE ", "UTILISER ", "USAR "},
- {"VERSTAUE ", "DEPOSER ", "DEJAR "},
- {" MIT ", " AVEC ", " CON "},
- {"INVENTAR", "INVENTAIRE", "INVENTARIO"},
- {"WEITERSPIELEN", "CONTINUER LA PARTIE", "CONTINUAR JUEGO"},
- {"\303\226FFNE ", "OUVRIR ", "ABRIR "},
- {"SCHLIESSE ", "FERMER ", "CERRAR "},
- {"VERSCHIEBE ", "DEPLACER ", "MOVER "},
- {"SIEH AUS DEM ", "REGARDER A TRAVERS ", "MIRAR A TRAV\303\211S DE LA "},
- {"BENUTZE DAS ", "APPELER AVEC ", "LLAMAR POR "},
- {"NIMM ETWAS AUS DEM ", "PRENDRE QUELQUE CHOSE DANS ", "COGER ALGO DE LA "},
- {"ZIEHE DEN STECKER DER K\303\234HLTRUHE HERAUS", "DEBRANCHER CONGELATEUR", "DESENCHUFAR CONGELADOR"},
- {"HEMD", "CHEMISE", "CAMISA"},
- {"PUTZLAPPEN", "PEAU DE CHAMOIS HUMIDE", "GAMUZA HUMEDECIDA"},
- {"SCHMUTZLAPPEN", "PEAU DE CHAMOIS SALE", "GAMUZA MUGRIENTA"},
- {"OPTIONEN", "OPTIONS", "OPCIONES"},
- {"LADEN", "CHARGER", "CARGAR"},
- {"SICHERN", "SAUVEGARDER", "SALVAR"},
- {"L\303\226SCHEN", "EFFACER", "BORRAR"},
- {"WEITERSPIELEN", "JOUER", "JUGAR"},
- {"VERLASSEN", "QUITTER", "SALIR"},
- {"MUSIK", "Musique", "M\303\272sica"},
- {"ANTI-ALIASING", "Antialiasing des sprites", "Antidentado Sprite"},
- {"SCROLLING", "Mode de d\303\251filement", "M\303\251todo Scroll"},
- {"MAUSZEIGERKLICKEN", "Bruitage des ic\303\264nes", "Sonido puntero rat\303\263n"},
- {"UNTERTITEL", "Sous-titres", "Subt\303\255tulos"},
- {"EIN", "OUI", "ON"},
- {"AUS", "NON", "OFF"},
- {"SCHNELL", "RAPIDE", "R\303\201PIDO"},
- {"LANGSAM", "FLUIDE", "LENTO"},
- {"LAUTST\303\204RKE", "Volume", "Volumen"},
- {"HELLIGKEIT", "Luminosit\303\251", "Brillo"},
- {"MITWIRKENDE", "G\303\251n\303\251rique", "Cr\303\251ditos"},
- {"EINSTELLUNGEN SICHERN", "Sauvegarder la configuration", "Salvar Configuraci\303\263n"},
- {"VORGABEEINSTELLUNGEN", "Configuration par d\303\251faut", "Configuraci\303\263n Inicial"},
- {"SIND SIE SICHER?", "CONFIRMER ?", "\302\277EST\303\201S SEGURO?"},
- {"JA", "OUI", "S\303\215"},
- {"NEIN", "NON", "NO"},
- {"V", "Q", "L"},
- {"STEIGE DURCH DIE FALLT\303\234R HINAB", "SORTIR PAR LA TRAPPE", "SALIR POR LA TRAMPILLA"},
- {"NAME DES SPIELSTANDES EINGEBEN:", "NOM DE LA SAUVEGARDE :", "INTRODUCE EL NOMBRE DE LA PARTIDA:"},
- {"KEINE SPIELST\303\204NDE VORHANDEN", "AUCUNE SAUVEGARDE", "NO HAY PARTIDAS SALVADAS"},
- {"NEUER SPIELSTAND", "NOUVELLE SAUVEGARDE", "NUEVA PARTIDA SALVADA"},
- {"SPIELSTAND GESICHERT", "PARTIE SAUVEGARDEE", "PARTIDA SALVADA"},
- {"AKTUELLE EINSTELLUNGEN GESICHERT", "CONFIGURATION SAUVEGARDEE", "CONFIGURACI\303\223N SALVADA"},
- {"VORGEGEBENE EINSTELLUNGEN WIEDERHERGESTELLT", "CONFIGURATION PAR DEFAUT RESTAUREE", "CONFIGURACI\303\223N INICIAL RESTAURADA"},
- {"SPIELSTAND KONNTE NICHT GESICHERT WERDEN", "IMPOSSIBLE DE SAUVEGARDER LA PARTIE", "NO SE HA PODIDO SALVAR LA PARTIDA"},
- {"SPIELSTAND KONNTE NICHT GELADEN WERDEN", "IMPOSSIBLE DE CHARGER LA PARTIE", "NO SE HA PODIDO CARGAR LA PARTIDA"},
- {"SPIELSTAND KONNTE NICHT GEL\303\226SCHT WERDEN", "IMPOSSIBLE D'EFFACER LA SAUVEGARDE", "NO SE HA PODIDO BORRAR LA PARTIDA"},
- {"KEIN FREIER SPEICHERPLATZ", "AUCUN EMPLACEMENT LIBRE", "NO QUEDAN ESPACIOS LIBRES"},
- {"H", "E", "B"},
- {"MITWIRKENDE KONNTEN NICHT GELADEN WERDEN", "IMPOSSIBLE DE CHARGER LE GENERIQUE", "NO SE HAN PODIDO CARGAR LOS CR\303\211DITOS"}
+const char *const kText[RunawayStrings::kTextCount][4] = {
+ {"BETRACHTE ", "REGARDER ", "MIRAR ", "LOOK AT "},
+ {"NIMM ", "PRENDRE ", "COGER ", "TAKE "},
+ {"BENUTZE ", "UTILISER ", "USAR ", "USE "},
+ {"VERSTAUE ", "DEPOSER ", "DEJAR ", "PUT AWAY "},
+ {" MIT ", " AVEC ", " CON ", " WITH "},
+ {"INVENTAR", "INVENTAIRE", "INVENTARIO", "INVENTORY"},
+ {"WEITERSPIELEN", "CONTINUER LA PARTIE", "CONTINUAR JUEGO", "RESUME GAME"},
+ {"\303\226FFNE ", "OUVRIR ", "ABRIR ", "OPEN "},
+ {"SCHLIESSE ", "FERMER ", "CERRAR ", "CLOSE "},
+ {"VERSCHIEBE ", "DEPLACER ", "MOVER ", "MOVE "},
+ {"SIEH AUS DEM ", "REGARDER A TRAVERS ", "MIRAR A TRAV\303\211S DE LA ", "LOOK THROUGH "},
+ {"BENUTZE DAS ", "APPELER AVEC ", "LLAMAR POR ", "USE "},
+ {"NIMM ETWAS AUS DEM ", "PRENDRE QUELQUE CHOSE DANS ", "COGER ALGO DE LA ", "TAKE FROM "},
+ {"ZIEHE DEN STECKER DER K\303\234HLTRUHE HERAUS", "DEBRANCHER CONGELATEUR", "DESENCHUFAR CONGELADOR", "UNPLUG COOLER"},
+ {"HEMD", "CHEMISE", "CAMISA", "SHIRT"},
+ {"PUTZLAPPEN", "PEAU DE CHAMOIS HUMIDE", "GAMUZA HUMEDECIDA", "WET CLOTH"},
+ {"SCHMUTZLAPPEN", "PEAU DE CHAMOIS SALE", "GAMUZA MUGRIENTA", "DIRTY CLOTH"},
+ {"OPTIONEN", "OPTIONS", "OPCIONES", "OPTIONS"},
+ {"LADEN", "CHARGER", "CARGAR", "LOAD"},
+ {"SICHERN", "SAUVEGARDER", "SALVAR", "SAVE"},
+ {"L\303\226SCHEN", "EFFACER", "BORRAR", "DELETE"},
+ {"WEITERSPIELEN", "JOUER", "JUGAR", "PLAY"},
+ {"VERLASSEN", "QUITTER", "SALIR", "QUIT"},
+ {"MUSIK", "Musique", "M\303\272sica", "Music"},
+ {"ANTI-ALIASING", "Antialiasing des sprites", "Antidentado Sprite", "Antialiasing"},
+ {"SCROLLING", "Mode de d\303\251filement", "M\303\251todo Scroll", "Scrolling"},
+ {"MAUSZEIGERKLICKEN", "Bruitage des ic\303\264nes", "Sonido puntero rat\303\263n", "Pointer sound"},
+ {"UNTERTITEL", "Sous-titres", "Subt\303\255tulos", "Subtitles"},
+ {"EIN", "OUI", "ON", "ON"},
+ {"AUS", "NON", "OFF", "OFF"},
+ {"SCHNELL", "RAPIDE", "R\303\201PIDO", "FAST"},
+ {"LANGSAM", "FLUIDE", "LENTO", "SLOW"},
+ {"LAUTST\303\204RKE", "Volume", "Volumen", "Volume"},
+ {"HELLIGKEIT", "Luminosit\303\251", "Brillo", "Brightness"},
+ {"MITWIRKENDE", "G\303\251n\303\251rique", "Cr\303\251ditos", "Credits"},
+ {"EINSTELLUNGEN SICHERN", "Sauvegarder la configuration", "Salvar Configuraci\303\263n", "Save settings"},
+ {"VORGABEEINSTELLUNGEN", "Configuration par d\303\251faut", "Configuraci\303\263n Inicial", "Default settings"},
+ {"SIND SIE SICHER?", "CONFIRMER ?", "\302\277EST\303\201S SEGURO?", "ARE YOU SURE?"},
+ {"JA", "OUI", "S\303\215", "YES"},
+ {"NEIN", "NON", "NO", "NO"},
+ {"V", "Q", "L", "Q"},
+ {"STEIGE DURCH DIE FALLT\303\234R HINAB", "SORTIR PAR LA TRAPPE", "SALIR POR LA TRAMPILLA", "LEAVE THROUGH THE HATCH"},
+ {"NAME DES SPIELSTANDES EINGEBEN:", "NOM DE LA SAUVEGARDE :", "INTRODUCE EL NOMBRE DE LA PARTIDA:", "ENTER A NAME FOR THIS SAVE:"},
+ {"KEINE SPIELST\303\204NDE VORHANDEN", "AUCUNE SAUVEGARDE", "NO HAY PARTIDAS SALVADAS", "NO SAVED GAMES"},
+ {"NEUER SPIELSTAND", "NOUVELLE SAUVEGARDE", "NUEVA PARTIDA SALVADA", "NEW SAVE"},
+ {"SPIELSTAND GESICHERT", "PARTIE SAUVEGARDEE", "PARTIDA SALVADA", "GAME SAVED"},
+ {"AKTUELLE EINSTELLUNGEN GESICHERT", "CONFIGURATION SAUVEGARDEE", "CONFIGURACI\303\223N SALVADA", "SETTINGS SAVED"},
+ {"VORGEGEBENE EINSTELLUNGEN WIEDERHERGESTELLT", "CONFIGURATION PAR DEFAUT RESTAUREE", "CONFIGURACI\303\223N INICIAL RESTAURADA", "DEFAULT SETTINGS RESTORED"},
+ {"SPIELSTAND KONNTE NICHT GESICHERT WERDEN", "IMPOSSIBLE DE SAUVEGARDER LA PARTIE", "NO SE HA PODIDO SALVAR LA PARTIDA", "COULD NOT SAVE THE GAME"},
+ {"SPIELSTAND KONNTE NICHT GELADEN WERDEN", "IMPOSSIBLE DE CHARGER LA PARTIE", "NO SE HA PODIDO CARGAR LA PARTIDA", "COULD NOT LOAD THE GAME"},
+ {"SPIELSTAND KONNTE NICHT GEL\303\226SCHT WERDEN", "IMPOSSIBLE D'EFFACER LA SAUVEGARDE", "NO SE HA PODIDO BORRAR LA PARTIDA", "COULD NOT DELETE THE SAVE"},
+ {"KEIN FREIER SPEICHERPLATZ", "AUCUN EMPLACEMENT LIBRE", "NO QUEDAN ESPACIOS LIBRES", "NO FREE SAVE SLOTS"},
+ {"H", "E", "B", "D"},
+ {"MITWIRKENDE KONNTEN NICHT GELADEN WERDEN", "IMPOSSIBLE DE CHARGER LE GENERIQUE", "NO SE HAN PODIDO CARGAR LOS CR\303\211DITOS", "COULD NOT LOAD THE CREDITS"}
};
const char *const kItemNames[][3] = {
@@ -145,11 +145,11 @@ Common::U32String RunawayStrings::text(TextId id) const {
}
Common::U32String RunawayStrings::itemName(byte item) const {
- return Common::U32String(item < ARRAYSIZE(kItemNames) ? kItemNames[item][_languageIndex] : "");
+ return Common::U32String(_languageIndex < 3 && item < ARRAYSIZE(kItemNames) ? kItemNames[item][_languageIndex] : "");
}
Common::U32String RunawayStrings::shackHotspotName(byte hotspot) const {
- return Common::U32String(hotspot < ARRAYSIZE(kShackHotspotNames) ? kShackHotspotNames[hotspot][_languageIndex] : "");
+ return Common::U32String(_languageIndex < 3 && hotspot < ARRAYSIZE(kShackHotspotNames) ? kShackHotspotNames[hotspot][_languageIndex] : "");
}
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/strings.h b/engines/hollywood/runaway/strings.h
index ada03f57aba..5c879915f81 100644
--- a/engines/hollywood/runaway/strings.h
+++ b/engines/hollywood/runaway/strings.h
@@ -43,7 +43,7 @@ public:
kSaveFailed, kLoadFailed, kDeleteFailed, kNoFreeSlots, kDeleteKey, kCreditsFailed, kTextCount
};
explicit RunawayStrings(Common::Language language) :
- _languageIndex(language == Common::FR_FRA ? 1 : language == Common::ES_ESP ? 2 : 0) {}
+ _languageIndex(language == Common::FR_FRA ? 1 : language == Common::ES_ESP ? 2 : language == Common::EN_ANY ? 3 : 0) {}
Common::U32String text(TextId id) const;
Common::U32String itemName(byte item) const;
Common::U32String shackHotspotName(byte hotspot) const;
diff --git a/engines/hollywood/runaway/ui.cpp b/engines/hollywood/runaway/ui.cpp
index b1f399daf05..c842088c56a 100644
--- a/engines/hollywood/runaway/ui.cpp
+++ b/engines/hollywood/runaway/ui.cpp
@@ -31,6 +31,7 @@ namespace {
const Graphics::PixelFormat kUIFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
const uint kCursorWidth = 60;
const uint kButtonX = 312;
+const byte kMuseumPickupFrames[] = {0, 30, 31, 32, 31, 30, 31, 32, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 3};
void shadeBevelPixel(Graphics::ManagedSurface &screen, int x, int y, int amount) {
uint16 *pixel = (uint16 *)screen.getBasePtr(x, y);
@@ -55,9 +56,25 @@ RunawayUI::~RunawayUI() {
CursorMan.popCursor();
}
-bool RunawayUI::load() {
+bool RunawayUI::load(bool museum) {
+ _museum = museum;
+ _audio.setMuseum(museum);
Common::Array<byte> animation;
- if (!_font.load() || !loadRunawaySurface(114, 904, 540, _cursors) ||
+ if (!_font.load(false, museum))
+ return false;
+ if (museum) {
+ if (!loadRunawaySurface(Common::Path("raton10.spf"), 904, 360, _cursors) ||
+ !loadRunawaySurface(Common::Path("Mosca.spf"), 48, 48, _demoLogo) ||
+ !loadRunawaySurface(Common::Path("RESOURCE.OBD"), 80, 2079, _icons) ||
+ !loadRunawaySurface(Common::Path("bolsa3.fnd"), 700, 74, _inventoryButton) ||
+ !loadRunawaySurface(Common::Path("jugar_izq.fnd"), 700, 74, _returnButton) ||
+ !loadRunawaySurface(Common::Path("opcion2.fnd"), 700, 74, _optionsButton) ||
+ !loadRunawaySurface(Common::Path("invent7.fnd"), 1024, 600, _inventoryBackground) ||
+ !loadRunawaySurface(Common::Path("inv_obt.fnd"), 768, 576, _inventoryTexture) ||
+ !readRunawayFile(Common::Path("ovalo1.tct"), animation) || !_portrait.load(animation, 33) ||
+ !readRunawayFile(Common::Path("ov1golpe.tct"), animation) || !_idlePortrait.load(animation, 15))
+ return false;
+ } else if (!loadRunawaySurface(114, 904, 540, _cursors) ||
!loadRunawaySurface(118, 48, 48, _demoLogo) || !loadRunawaySurface(121, 80, 42 * 80, _icons) ||
!loadRunawaySurface(127, 700, 74, _inventoryButton) || !loadRunawaySurface(129, 700, 74, _returnButton) ||
!loadRunawaySurface(128, 700, 74, _optionsButton) ||
@@ -189,7 +206,8 @@ void RunawayUI::update(uint32 now, Common::Point mouse, byte roomHotspot, bool b
_audio.playEffect(1);
_pickupSoundPlayed = true;
}
- if (_pickupItem && now - _pickupStarted >= 18 * 60) {
+ const uint pickupFrames = _museum ? ARRAYSIZE(kMuseumPickupFrames) : 18;
+ if (_pickupItem && now - _pickupStarted >= pickupFrames * 60) {
_pickupItem = 0;
if (_returnAfterPickup && !_speaking)
setInventoryOpen(false);
@@ -238,7 +256,7 @@ void RunawayUI::update(uint32 now, Common::Point mouse, byte roomHotspot, bool b
}
if (!busy() && !_speaking && !_idleStarted && now - _lastInteraction >= 30000)
_idleStarted = now;
- if (_idleStarted && now - _idleStarted >= 32 * 60) {
+ if (_idleStarted && now - _idleStarted >= _idlePortrait.frameCount() * 60) {
_idleStarted = 0;
_lastInteraction = now;
}
@@ -307,13 +325,13 @@ void RunawayUI::updateCursor() {
if (waiting)
return;
const byte item = _inventory.selected();
- uint tile = _verb;
+ uint tile = _museum ? (_verb == kVerbWalk ? 0 : _verb == kVerbLook ? 6 : 7) : (uint)_verb;
uint shade = 0;
if (item) {
tile = _inventory.cursor(item) + (_hovered != 0);
} else {
const uint phase = (_now - _verbStarted) / 20;
- if (phase < 10) {
+ if (!_museum && phase < 10) {
// Four cels collapse the old verb to a ball; four expand the new one.
tile = !phase ? (uint)_previousVerb : phase < 5 ? _previousVerb * 4 + 8 + phase :
phase == 5 ? 8 : _verb * 4 + 18 - phase;
@@ -325,11 +343,13 @@ void RunawayUI::updateCursor() {
const int key = tile * 10 + shade;
if (key == _cursorKey)
return;
+ const uint sx = (tile % 15) * 60;
+ const uint sy = (tile / 15) * 60;
+ if (sx + 60 > (uint)_cursors.w || sy + 60 > (uint)_cursors.h)
+ return;
_cursorKey = key;
const uint16 transparent = *(const uint16 *)_cursors.getPixels();
_cursor.fillRect(Common::Rect(0, 0, 60, 60), transparent);
- const uint sx = (tile % 15) * 60;
- const uint sy = (tile / 15) * 60;
for (uint y = 0; y < 60; ++y) {
const uint16 *src = (const uint16 *)_cursors.getBasePtr(sx, sy + y);
uint16 *dst = (uint16 *)_cursor.getBasePtr(0, y);
@@ -379,13 +399,19 @@ void RunawayUI::drawInventory(Graphics::ManagedSurface &screen) {
screen.fillRect(rect, 0);
} else {
const uint y = (_inventory.icon(item) - 1) * 80;
- screen.copyRectToSurface(_icons, rect.left, rect.top, Common::Rect(0, y, 80, y + 80));
+ if (y + 80 <= (uint)_icons.h)
+ screen.copyRectToSurface(_icons, rect.left, rect.top, Common::Rect(0, y, 80, y + 80));
}
}
if (_pickupItem) {
- _portrait.draw(screen, 64 + MIN<uint>(17, (_now - _pickupStarted) / 60), 0, kRunawayViewportTop);
+ if (_museum) {
+ const uint frame = MIN<uint>(ARRAYSIZE(kMuseumPickupFrames) - 1, (_now - _pickupStarted) / 60);
+ _portrait.draw(screen, kMuseumPickupFrames[frame], 0, kRunawayViewportTop);
+ } else {
+ _portrait.draw(screen, 64 + MIN<uint>(17, (_now - _pickupStarted) / 60), 0, kRunawayViewportTop);
+ }
} else if (_idleStarted) {
- _idlePortrait.draw(screen, MIN<uint>(31, (_now - _idleStarted) / 60), 0, kRunawayViewportTop);
+ _idlePortrait.draw(screen, MIN<uint>(_idlePortrait.frameCount() - 1, (_now - _idleStarted) / 60), 0, kRunawayViewportTop);
} else {
const uint frame = _speaking ? _mouth : (int32)(_blinkUntil - _now) > 0 ? 6 : 0;
_portrait.draw(screen, frame, 0, kRunawayViewportTop);
diff --git a/engines/hollywood/runaway/ui.h b/engines/hollywood/runaway/ui.h
index 4c9dea32109..a0b1caed16a 100644
--- a/engines/hollywood/runaway/ui.h
+++ b/engines/hollywood/runaway/ui.h
@@ -42,7 +42,7 @@ public:
RunawayUI(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings) :
_audio(mixer), _inventory(inventory), _strings(strings), _random("runaway-ui") {}
~RunawayUI();
- bool load();
+ bool load(bool museum = false);
void update(uint32 now, Common::Point mouse, byte roomHotspot, bool blocked, bool speaking,
bool inventoryPresentation = false, byte speechFrame = 0);
Command click(bool right);
@@ -73,6 +73,7 @@ private:
RunawayAudio _audio;
RunawayInventory &_inventory;
const RunawayStrings &_strings;
+ bool _museum = false;
Common::RandomSource _random;
RunawayFont _font;
Graphics::ManagedSurface _cursors, _demoLogo, _cursor, _inventoryButton, _returnButton, _optionsButton;
Commit: b32b6f3442665b1be982f9081973b00103b1afdc
https://github.com/scummvm/scummvm/commit/b32b6f3442665b1be982f9081973b00103b1afdc
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:06+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: added some audio to the old English demo code
Changed paths:
engines/hollywood/runaway/audio.cpp
engines/hollywood/runaway/audio.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene4030.cpp
engines/hollywood/runaway/scene4050.cpp
engines/hollywood/runaway/scene4060.cpp
engines/hollywood/runaway/scene4090.cpp
engines/hollywood/runaway/scene4100.cpp
engines/hollywood/runaway/scene4140.cpp
engines/hollywood/runaway/scene_data.h
engines/hollywood/runaway/ui.cpp
diff --git a/engines/hollywood/runaway/audio.cpp b/engines/hollywood/runaway/audio.cpp
index f8f26636c12..3dd72ebcca5 100644
--- a/engines/hollywood/runaway/audio.cpp
+++ b/engines/hollywood/runaway/audio.cpp
@@ -109,7 +109,11 @@ uint32 RunawayAudio::playSpeech(uint16 sample, bool global) {
void RunawayAudio::playEffect(uint16 cue, byte volume, byte channel, bool loop) {
assert(channel < ARRAYSIZE(_effects));
- play(_museum ? "RESOURCE.S04" : "RESOURCE.S03", cue, 1000, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN,
+ // Museum effects use unsigned 8-bit PCM (native 0x43ae40).
+ byte flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
+ if (_museum)
+ flags = Audio::FLAG_UNSIGNED;
+ play(_museum ? "RESOURCE.S04" : "RESOURCE.S03", cue, 1000, false, flags,
Audio::Mixer::kSFXSoundType, _effects[channel], volume, loop, _museum ? 11025 : 16000);
}
@@ -176,4 +180,9 @@ bool RunawayAudio::speechPlaying() const {
return _mixer->isSoundHandleActive(_speech);
}
+bool RunawayAudio::effectPlaying(byte channel) const {
+ assert(channel < ARRAYSIZE(_effects));
+ return _mixer->isSoundHandleActive(_effects[channel]);
+}
+
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/audio.h b/engines/hollywood/runaway/audio.h
index 0b79dc80051..2dacbd0db1d 100644
--- a/engines/hollywood/runaway/audio.h
+++ b/engines/hollywood/runaway/audio.h
@@ -44,6 +44,7 @@ public:
void stopEffect();
bool musicPlaying() const;
bool speechPlaying() const;
+ bool effectPlaying(byte channel = 0) const;
private:
uint32 play(const char *archive, uint16 cue, uint tableCount, bool pairedTables,
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index 98b1ecab7af..e0c3ac5cbdc 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -94,7 +94,8 @@ void RunawayMuseumScene::start(uint32 now) {
for (uint i = 0; i < ARRAYSIZE(initialItems); ++i)
_inventory.add(initialItems[i]);
_inventory.takeNewItem();
- _audio.playMusic(4);
+ // The original demo loops M04 cue 11 throughout gameplay (0x4175c0).
+ _audio.playMusic(11);
}
bool RunawayMuseumScene::enterRoom(uint16 number, Common::Point position, byte facing) {
@@ -375,6 +376,9 @@ void RunawayMuseumScene::execute(uint16 action) {
const MuseumExit &exit = room->exits[i];
if (exit.action != action)
continue;
+ _pendingDoorClose = exit.door;
+ if (exit.door)
+ _audio.playEffect(3);
const Common::Point entry(exit.x, exit.y);
if (exit.destination == _room) {
changeFloor(exit.upperFloor, entry);
@@ -433,6 +437,11 @@ void RunawayMuseumScene::update(uint32 now, int scrollDirection, bool inventoryO
_now = now;
const uint elapsed = MIN<uint>(100, now - _lastUpdate);
_lastUpdate = now;
+ // Door entry routines wait for the opening sound before playing the closing sound.
+ if (_pendingDoorClose && !_audio.effectPlaying()) {
+ _pendingDoorClose = false;
+ _audio.playEffect(4);
+ }
if (speaking() && (int32)(now - _subtitleUntil) >= 0)
skipSpeech();
if (inventoryOpen || _room == kMuseumKeypad)
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index 49d8a5c8692..ab11001013f 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -79,7 +79,7 @@ public:
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _caption; }
const Common::U32String &subtitle() const override { return _subtitle; }
- bool busy() const override { return _pendingHotspot != 0 || speaking(); }
+ bool busy() const override { return _pendingHotspot != 0 || _pendingDoorClose || speaking(); }
bool speaking() const override { return !_subtitle.empty(); }
void skipSpeech() override;
void sayInventory(const RunawayInventory::Reply &reply) override;
@@ -162,6 +162,7 @@ private:
float _x = 0, _y = 0;
uint32 _now = 0, _lastUpdate = 0, _walkElapsed = 0, _subtitleUntil = 0;
bool _upperFloor = true, _antialias = true, _fastScrolling = true;
+ bool _pendingDoorClose = false;
ObjectState _books = kUnexamined, _recorder = kUnexamined;
bool _moneyIdentified = false, _safeOpen = false;
bool _varnishTaken = false, _talcTaken = false, _coffeeTaken = false;
diff --git a/engines/hollywood/runaway/scene4030.cpp b/engines/hollywood/runaway/scene4030.cpp
index 6cd0b6fddfc..4f71cecdad1 100644
--- a/engines/hollywood/runaway/scene4030.cpp
+++ b/engines/hollywood/runaway/scene4030.cpp
@@ -63,7 +63,7 @@ const MuseumItemAction kItemActions[] = {
};
const MuseumExit kExits[] = {
- {kMuseumOffice, 301, kMuseumHall, 607, 323, true},
+ {kMuseumOffice, 301, kMuseumHall, 607, 323, true, true},
};
} // End of anonymous namespace
diff --git a/engines/hollywood/runaway/scene4050.cpp b/engines/hollywood/runaway/scene4050.cpp
index 0892ceb8712..bc2953b37d5 100644
--- a/engines/hollywood/runaway/scene4050.cpp
+++ b/engines/hollywood/runaway/scene4050.cpp
@@ -86,7 +86,7 @@ const MuseumItemAction kItemActions[] = {
};
const MuseumExit kExits[] = {
- {kMuseumLaboratory, 339, kMuseumHall, 873, 311, true},
+ {kMuseumLaboratory, 339, kMuseumHall, 873, 311, true, true},
};
} // End of anonymous namespace
diff --git a/engines/hollywood/runaway/scene4060.cpp b/engines/hollywood/runaway/scene4060.cpp
index b9578b9ebb0..530581d0b04 100644
--- a/engines/hollywood/runaway/scene4060.cpp
+++ b/engines/hollywood/runaway/scene4060.cpp
@@ -103,14 +103,14 @@ const MuseumItemAction kItemActions[] = {
};
const MuseumExit kExits[] = {
- {kMuseumHall, 302, kMuseumHall, 533, 848, false},
- {kMuseumHall, 303, kMuseumHall, 1169, 643, false},
- {kMuseumHall, 305, kMuseumHall, 69, 372, true},
- {kMuseumHall, 306, kMuseumHall, 1290, 300, true},
- {kMuseumHall, 310, kMuseumExhibition, 881, 392, false},
- {kMuseumHall, 312, kMuseumOffice, 934, 563, true},
- {kMuseumHall, 316, kMuseumLaboratory, 382, 529, true},
- {kMuseumHall, 320, kMuseumKeypad, 0, 0, true},
+ {kMuseumHall, 302, kMuseumHall, 533, 848, false, false},
+ {kMuseumHall, 303, kMuseumHall, 1169, 643, false, false},
+ {kMuseumHall, 305, kMuseumHall, 69, 372, true, false},
+ {kMuseumHall, 306, kMuseumHall, 1290, 300, true, false},
+ {kMuseumHall, 310, kMuseumExhibition, 881, 392, false, false},
+ {kMuseumHall, 312, kMuseumOffice, 934, 563, true, true},
+ {kMuseumHall, 316, kMuseumLaboratory, 382, 529, true, true},
+ {kMuseumHall, 320, kMuseumKeypad, 0, 0, true, false},
};
} // End of anonymous namespace
diff --git a/engines/hollywood/runaway/scene4090.cpp b/engines/hollywood/runaway/scene4090.cpp
index cf4ba3eca5c..4f2544f8e41 100644
--- a/engines/hollywood/runaway/scene4090.cpp
+++ b/engines/hollywood/runaway/scene4090.cpp
@@ -59,7 +59,7 @@ const MuseumResponse kResponses[] = {
};
const MuseumExit kExits[] = {
- {kMuseumExhibition, 301, kMuseumHall, 1400, 600, false},
+ {kMuseumExhibition, 301, kMuseumHall, 1400, 600, false, false},
};
} // End of anonymous namespace
diff --git a/engines/hollywood/runaway/scene4100.cpp b/engines/hollywood/runaway/scene4100.cpp
index 4a90bc871e0..08d4422b0ef 100644
--- a/engines/hollywood/runaway/scene4100.cpp
+++ b/engines/hollywood/runaway/scene4100.cpp
@@ -72,7 +72,7 @@ const MuseumItemAction kItemActions[] = {
};
const MuseumExit kExits[] = {
- {kMuseumSecurity, 302, kMuseumHall, 1118, 309, true}
+ {kMuseumSecurity, 302, kMuseumHall, 1118, 309, true, false}
};
} // End of anonymous namespace
diff --git a/engines/hollywood/runaway/scene4140.cpp b/engines/hollywood/runaway/scene4140.cpp
index b392cae4078..376298e97ab 100644
--- a/engines/hollywood/runaway/scene4140.cpp
+++ b/engines/hollywood/runaway/scene4140.cpp
@@ -45,11 +45,12 @@ void RunawayMuseumScene::clickScene4140(byte id) {
} else if (id == 12) {
_keyCount = 0;
warning("Runaway museum: the fingerprint puzzle is not implemented yet");
- } else if (_keyCount < 4) {
- ++_keyCount;
- _audio.playEffect(id == 11 ? 11 : 11 + id);
} else {
- say(4);
+ _audio.playEffect(id == 11 ? 11 : 11 + id);
+ if (_keyCount < 4)
+ ++_keyCount;
+ else
+ say(4);
}
}
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
index e8a65b2c153..ad0771a61ea 100644
--- a/engines/hollywood/runaway/scene_data.h
+++ b/engines/hollywood/runaway/scene_data.h
@@ -58,6 +58,7 @@ struct MuseumExit {
uint16 room, action, destination;
int16 x, y;
bool upperFloor;
+ bool door;
};
struct MuseumRoom {
diff --git a/engines/hollywood/runaway/ui.cpp b/engines/hollywood/runaway/ui.cpp
index c842088c56a..87c0fe0268a 100644
--- a/engines/hollywood/runaway/ui.cpp
+++ b/engines/hollywood/runaway/ui.cpp
@@ -200,9 +200,10 @@ void RunawayUI::update(uint32 now, Common::Point mouse, byte roomHotspot, bool b
_pickupStarted = now;
_pickupSoundPlayed = false;
}
- // Native 0x40d390 plays S03 cue 1 when the twelfth pickup frame
- // reveals the item in its inventory slot.
- if (_pickupItem && !_pickupSoundPlayed && now - _pickupStarted >= 12 * 60) {
+ // Cue 1 accompanies the item reveal: frame 15 in the museum (0x427020),
+ // frame 12 in the cabin (0x40d390).
+ const uint revealFrame = _museum ? 15 : 12;
+ if (_pickupItem && !_pickupSoundPlayed && now - _pickupStarted >= revealFrame * 60) {
_audio.playEffect(1);
_pickupSoundPlayed = true;
}
@@ -395,7 +396,7 @@ void RunawayUI::drawInventory(Graphics::ManagedSurface &screen) {
shadeBevelPixel(screen, rect.left + 83 - edge, rect.top - 4 + pixel, 2);
}
}
- if (item == _inventory.selected() || (item == _pickupItem && _now - _pickupStarted < 12 * 60)) {
+ if (item == _inventory.selected() || (item == _pickupItem && !_pickupSoundPlayed)) {
screen.fillRect(rect, 0);
} else {
const uint y = (_inventory.icon(item) - 1) * 80;
Commit: 78260b380cc2ef61a8ffd98100b4a3fe1acaf12e
https://github.com/scummvm/scummvm/commit/78260b380cc2ef61a8ffd98100b4a3fe1acaf12e
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: do some preparation work for the full game
Changed paths:
engines/hollywood/metaengine.cpp
engines/hollywood/runaway/animation.cpp
engines/hollywood/runaway/animation.h
engines/hollywood/runaway/audio.cpp
engines/hollywood/runaway/audio.h
engines/hollywood/runaway/detection.h
engines/hollywood/runaway/detection_tables.h
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/engine.h
engines/hollywood/runaway/font.cpp
engines/hollywood/runaway/graphics.cpp
engines/hollywood/runaway/graphics.h
engines/hollywood/runaway/menu.cpp
engines/hollywood/runaway/menu.h
engines/hollywood/runaway/saveload.cpp
engines/hollywood/runaway/saveload.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene4140.cpp
engines/hollywood/runaway/scene5030.cpp
engines/hollywood/runaway/scene5030.h
engines/hollywood/runaway/scene_data.h
engines/hollywood/runaway/ui.cpp
engines/hollywood/runaway/ui.h
diff --git a/engines/hollywood/metaengine.cpp b/engines/hollywood/metaengine.cpp
index 881172c39ac..5e1cc115c3a 100644
--- a/engines/hollywood/metaengine.cpp
+++ b/engines/hollywood/metaengine.cpp
@@ -52,9 +52,11 @@ protected:
};
Common::Error HollywoodMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- if (!strcmp(desc->gameId, "runaway"))
- *engine = new RunawayEngine(syst, desc->language, (desc->flags & GF_RUNAWAY_MUSEUM_DEMO) != 0);
- else
+ if (!strcmp(desc->gameId, "runaway")) {
+ const RunawayGameType game = (desc->flags & GF_RUNAWAY_MUSEUM_DEMO) ? kRunawayMuseumDemo :
+ (desc->flags & ADGF_DEMO) ? kRunawayCabinDemo : kRunawayFullGame;
+ *engine = new RunawayEngine(syst, desc->language, game);
+ } else
*engine = new HollywoodEngine(syst, desc);
return Common::kNoError;
}
diff --git a/engines/hollywood/runaway/animation.cpp b/engines/hollywood/runaway/animation.cpp
index d2225e9dc75..0aadf52112b 100644
--- a/engines/hollywood/runaway/animation.cpp
+++ b/engines/hollywood/runaway/animation.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/file.h"
#include "common/util.h"
#include "hollywood/runaway/animation.h"
@@ -76,9 +77,34 @@ byte speechMouth(uint32 c, uint32 next, byte previous) {
} // End of anonymous namespace
-void RunawayLipSync::start(const Common::U32String &text, uint32 now, uint32 duration, Common::RandomSource &random) {
+bool RunawayLipSync::loadRecording(uint16 sample) {
+ const uint headerSize = 6000 * 6;
+ Common::File file;
+ if (sample >= 6000 || !file.open("RESOURCE.004") || file.size() < headerSize || !file.seek(sample * 6))
+ return false;
+ const uint32 offset = file.readUint32LE();
+ const uint16 size = file.readUint16LE();
+ if (file.err() || !size || size > 400 || offset < headerSize || offset > file.size() ||
+ size > file.size() - offset || !file.seek(offset))
+ return false;
+ _frames.resize(size);
+ if (file.read(_frames.data(), size) != size)
+ return false;
+ for (uint i = 0; i < size; ++i) {
+ if (_frames[i] > 5)
+ return false;
+ }
+ return true;
+}
+
+void RunawayLipSync::start(const Common::U32String &text, uint32 now, uint32 duration, Common::RandomSource &random, uint16 sample) {
_started = now;
_duration = duration ? duration : text.size() * 80;
+ if (sample && duration && loadRecording(sample)) {
+ // Retail 0x413650 advances recorded mouth shapes every five 10 ms ticks.
+ _frameDuration = 50;
+ return;
+ }
_frames.resize(text.size());
if (_frames.empty())
return;
diff --git a/engines/hollywood/runaway/animation.h b/engines/hollywood/runaway/animation.h
index fe455676c09..c4047a72333 100644
--- a/engines/hollywood/runaway/animation.h
+++ b/engines/hollywood/runaway/animation.h
@@ -32,12 +32,14 @@ namespace Hollywood {
// text-derived mouth shapes (0..5), with a closed-eye set at 6..11.
class RunawayLipSync {
public:
- void start(const Common::U32String &text, uint32 now, uint32 duration, Common::RandomSource &random);
+ // Pass the voice sample ID for retail recordings; zero keeps demo text-derived animation.
+ void start(const Common::U32String &text, uint32 now, uint32 duration, Common::RandomSource &random, uint16 sample = 0);
void stop() { _frames.clear(); }
byte frame(uint32 now) const;
uint frameDuration() const { return _frameDuration; }
private:
+ bool loadRecording(uint16 sample);
Common::Array<byte> _frames;
uint32 _started = 0, _duration = 0, _frameDuration = 80;
};
diff --git a/engines/hollywood/runaway/audio.cpp b/engines/hollywood/runaway/audio.cpp
index 3dd72ebcca5..2489ef918e0 100644
--- a/engines/hollywood/runaway/audio.cpp
+++ b/engines/hollywood/runaway/audio.cpp
@@ -37,13 +37,23 @@ RunawayAudio::~RunawayAudio() {
stopEffect();
}
+void RunawayAudio::setChapter(byte chapter) {
+ assert(chapter >= 1 && chapter <= 6);
+ if (_chapter == chapter)
+ return;
+ stopMusic();
+ stopSpeech();
+ stopEffect();
+ _chapter = chapter;
+}
+
uint32 RunawayAudio::play(const char *archive, uint16 cue, uint tableCount, bool pairedTables,
byte flags, Audio::Mixer::SoundType type, Audio::SoundHandle &handle, byte volume, bool loop, uint rate) {
_mixer->stopHandle(handle);
const uint headerSize = tableCount * (pairedTables ? 8 : 4);
Common::File *file = new Common::File();
if (cue >= tableCount - (pairedTables ? 0 : 1) || !file->open(archive) || file->size() < headerSize) {
- warning("Runaway demo: cannot read %s cue %u", archive, cue);
+ warning("Runaway: cannot read %s cue %u", archive, cue);
delete file;
return 0;
}
@@ -60,7 +70,7 @@ uint32 RunawayAudio::play(const char *archive, uint16 cue, uint tableCount, bool
const uint frameSize = ((flags & Audio::FLAG_16BITS) ? 2 : 1) * ((flags & Audio::FLAG_STEREO) ? 2 : 1);
if (file->err() || start < headerSize || !size || start > file->size() ||
size > file->size() - start || size % frameSize) {
- warning("Runaway demo: invalid %s cue %u range", archive, cue);
+ warning("Runaway: invalid %s cue %u range", archive, cue);
delete file;
return 0;
}
@@ -87,8 +97,9 @@ void RunawayAudio::playIntroMusic() {
}
uint32 RunawayAudio::playMusic(uint16 cue, bool loop) {
- // Cabin PCM is 16 kHz; the museum uses 22.05 kHz music/speech and 11.025 kHz effects.
- return play(_museum ? "RESOURCE.M04" : "RESOURCE.M03", cue, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
+ // Retail/cabin PCM is 16 kHz; the old museum demo uses 22.05 kHz music.
+ const Common::String archive = Common::String::format("RESOURCE.M%02u", _museum ? 4 : _chapter);
+ return play(archive.c_str(), cue, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
Audio::Mixer::kMusicSoundType, _music, 96, loop, _museum ? 22050 : 16000);
}
@@ -100,10 +111,11 @@ uint32 RunawayAudio::playSpeech(uint16 sample, bool global) {
if (_museum)
return sample ? play("RESOURCE.004", sample, 4000, false, Audio::FLAG_UNSIGNED,
Audio::Mixer::kSpeechSoundType, _speech, Audio::Mixer::kMaxChannelVolume, false, 22050) : 0;
- // DATAACA3 has independent 6000-entry offset and length tables. Its global
+ // DATAACA archives have independent 6000-entry offset and length tables. Their global
// sample IDs include stale offsets for other chapters, so never derive a
// length by subtracting adjacent offsets as with the M/S archives.
- return play(global ? "DATAACA0.000" : "DATAACA3.000", sample, 6000, true, Audio::FLAG_UNSIGNED,
+ const Common::String archive = Common::String::format("DATAACA%u.000", global ? 0 : _chapter);
+ return play(archive.c_str(), sample, 6000, true, Audio::FLAG_UNSIGNED,
Audio::Mixer::kSpeechSoundType, _speech, Audio::Mixer::kMaxChannelVolume, false, 16000);
}
@@ -113,7 +125,8 @@ void RunawayAudio::playEffect(uint16 cue, byte volume, byte channel, bool loop)
byte flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
if (_museum)
flags = Audio::FLAG_UNSIGNED;
- play(_museum ? "RESOURCE.S04" : "RESOURCE.S03", cue, 1000, false, flags,
+ const Common::String archive = Common::String::format("RESOURCE.S%02u", _museum ? 4 : _chapter);
+ play(archive.c_str(), cue, 1000, false, flags,
Audio::Mixer::kSFXSoundType, _effects[channel], volume, loop, _museum ? 11025 : 16000);
}
diff --git a/engines/hollywood/runaway/audio.h b/engines/hollywood/runaway/audio.h
index 2dacbd0db1d..8c562c35141 100644
--- a/engines/hollywood/runaway/audio.h
+++ b/engines/hollywood/runaway/audio.h
@@ -31,6 +31,7 @@ public:
explicit RunawayAudio(Audio::Mixer *mixer) : _mixer(mixer) {}
~RunawayAudio();
void setMuseum(bool museum) { _museum = museum; }
+ void setChapter(byte chapter);
void playIntroMusic();
uint32 playMusic(uint16 cue, bool loop = true);
void setMusicVolume(byte volume);
@@ -50,6 +51,7 @@ private:
uint32 play(const char *archive, uint16 cue, uint tableCount, bool pairedTables,
byte flags, Audio::Mixer::SoundType type, Audio::SoundHandle &handle, byte volume, bool loop, uint rate);
bool _museum = false;
+ byte _chapter = 3;
Audio::Mixer *_mixer;
Audio::SoundHandle _music, _speech, _effects[2], _footstep, _pointer;
};
diff --git a/engines/hollywood/runaway/detection.h b/engines/hollywood/runaway/detection.h
index 5209592c477..7a239469c86 100644
--- a/engines/hollywood/runaway/detection.h
+++ b/engines/hollywood/runaway/detection.h
@@ -28,6 +28,12 @@ enum RunawayGameFlags {
GF_RUNAWAY_MUSEUM_DEMO = 1 << 0
};
+enum RunawayGameType {
+ kRunawayCabinDemo,
+ kRunawayMuseumDemo,
+ kRunawayFullGame
+};
+
} // End of namespace Hollywood
#endif // HOLLYWOOD_RUNAWAY_DETECTION_H
diff --git a/engines/hollywood/runaway/detection_tables.h b/engines/hollywood/runaway/detection_tables.h
index bd920310f29..38a141f9289 100644
--- a/engines/hollywood/runaway/detection_tables.h
+++ b/engines/hollywood/runaway/detection_tables.h
@@ -23,6 +23,18 @@
#define HOLLYWOOD_RUNAWAY_DETECTION_TABLES_H
// Included in the shared ADGameDescription array in hollywood/detection.cpp.
+ // English retail release. Resource support; chapter scripts are not yet implemented.
+ {
+ "runaway",
+ nullptr,
+ AD_ENTRY3s("RESOURCE.000", "f23900dd41f74bfaf71578b66821e228", 110312868,
+ "RESOURCE.003", "8aa07584175fc9d28c1aff5fa5f93a5f", 7340291,
+ "RESOURCE.B02", "088b730c4be3dfb4ac7c38e1fc215ef7", 8161628),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO2(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD)
+ },
// English museum demo (2000). Gameplay POC; movies are not supported.
{
"runaway",
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index 35e7791bac6..bd4ae69bced 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -41,6 +41,7 @@
#include "hollywood/runaway/presentation.h"
#include "hollywood/runaway/saveload.h"
#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
#include "hollywood/runaway/scene5030.h"
#include "hollywood/runaway/strings.h"
#include "hollywood/runaway/ui.h"
@@ -62,8 +63,13 @@ enum RunawayAction {
} // End of anonymous namespace
-RunawayEngine::RunawayEngine(OSystem *syst, Common::Language language, bool museum) :
- Engine(syst), _language(language), _museum(museum), _strings(language) {}
+RunawayEngine::RunawayEngine(OSystem *syst, Common::Language language, RunawayGameType game) :
+ Engine(syst), _language(language), _game(game), _museum(game == kRunawayMuseumDemo), _strings(language), _audio(_mixer) {
+ _state.game = game;
+ _state.scene = _museum ? 4050 : game == kRunawayFullGame ? 2020 : 5030;
+ _audio.setMuseum(_museum);
+ _audio.setChapter(_state.chapter());
+}
RunawayEngine::~RunawayEngine() {}
@@ -107,18 +113,19 @@ void RunawayEngine::present(const Graphics::ManagedSurface &screen) {
}
bool RunawayEngine::canSaveGameStateCurrently(Common::U32String *) {
- return _gameStarted && !_inPresentation && _scene && _ui && _scene->canSave() && !_ui->busy();
+ return _gameStarted && !_inPresentation && !_pendingDoorClose && _scene && _ui && _scene->canSave() && !_ui->busy();
}
bool RunawayEngine::canLoadGameStateCurrently(Common::U32String *) {
- return !_museum && _scene && _ui;
+ return _scene && _ui;
}
Common::Error RunawayEngine::saveGameStream(Common::WriteStream *stream, bool) {
if (!canSaveGameStateCurrently())
return Common::kWritingFailed;
- RunawaySaveState state;
+ RunawaySaveState state = _state;
_scene->captureState(state);
+ _inventory->captureState(state);
_ui->captureState(state);
state.playTime = getTotalPlayTime();
return state.write(*stream) ? Common::kNoError : Common::kWritingFailed;
@@ -128,22 +135,78 @@ Common::Error RunawayEngine::loadGameStream(Common::SeekableReadStream *stream)
if (!canLoadGameStateCurrently())
return Common::kReadingFailed;
RunawaySaveState state;
- if (!state.read(*stream))
+ if (!state.read(*stream) || state.game != _game)
return Common::Error(Common::kReadingFailed, "Invalid or unsupported Runaway save");
// Build and validate replacement resources before touching the live scene.
// Failed reads leave the current puzzle, inventory, audio and UI intact.
- Common::ScopedPtr<RunawayScene5030> scene(new RunawayScene5030(_mixer, *_inventory, _strings));
- if (!scene->load() || !scene->restoreState(state, state.playTime))
+ Common::ScopedPtr<RunawayScene> scene(createScene(state.scene));
+ if (!scene || !scene->load(state.scene) || !scene->restoreState(state, state.playTime))
+ return Common::kReadingFailed;
+ if (state.chapter() != _state.chapter() && !_ui->loadChapter(state.chapter()))
return Common::kReadingFailed;
+ _audio.stopMusic();
+ _audio.stopSpeech();
+ _audio.stopEffect();
+ _audio.setChapter(state.chapter());
_scene.reset(scene.release());
+ _state = state;
+ _inventory->restoreState(state);
_ui->restoreState(state, state.playTime);
setTotalPlayTime(state.playTime);
+ _pendingDoorClose = false;
_loadedGame = _gameStarted = true;
syncSoundSettings();
+ _scene->resume();
_scene->draw();
return Common::kNoError;
}
+RunawayScene *RunawayEngine::createScene(uint16 entryScene) {
+ if (_game == kRunawayMuseumDemo && findRunawayMuseumRoom(entryScene))
+ return new RunawayMuseumScene(_audio, *_inventory, _strings);
+ if (_game == kRunawayCabinDemo && entryScene == 5030)
+ return new RunawayScene5030(_mixer, _audio, *_inventory, _strings);
+ // Retail scene scripts have their own entry substates. Sharing an archive
+ // with a demo does not make its puzzle initialization interchangeable.
+ return nullptr;
+}
+
+bool RunawayEngine::sceneBusy() const {
+ return _pendingDoorClose || _scene->busy();
+}
+
+Common::Error RunawayEngine::changeScene() {
+ const RunawayScene::Transition transition = _scene->transition();
+ RunawaySaveState state = _state;
+ _scene->captureState(state);
+ _inventory->captureState(state);
+ state.scene = transition.scene;
+ state.x = transition.position.x;
+ state.y = transition.position.y;
+ state.facing = transition.facing;
+ state.camera = state.cameraY = 0;
+ Common::ScopedPtr<RunawayScene> scene(createScene(state.scene));
+ if (!scene)
+ return Common::Error(Common::kUnsupportedGameidError,
+ Common::String::format("Runaway scene %u is not implemented", state.scene));
+ if (!scene->load(state.scene) || !scene->restoreState(state, getTotalPlayTime(), true))
+ return Common::Error(Common::kReadingFailed,
+ Common::String::format("Cannot load Runaway scene %u", state.scene));
+ if (state.chapter() != _state.chapter() && !_ui->loadChapter(state.chapter()))
+ return Common::Error(Common::kReadingFailed, "Cannot load Runaway chapter graphics");
+ _audio.stopSpeech();
+ _audio.stopEffect();
+ _audio.setChapter(state.chapter());
+ _state = state;
+ _scene.reset(scene.release());
+ syncSoundSettings();
+ _scene->resume();
+ _pendingDoorClose = transition.door;
+ if (transition.door)
+ _audio.playEffect(3);
+ return Common::kNoError;
+}
+
bool RunawayEngine::copySaveThumbnail(Graphics::Surface &thumbnail) const {
if (!_scene)
return false;
@@ -170,8 +233,8 @@ void RunawayEngine::initializePath(const Common::FSNode &gamePath) {
}
bool RunawayEngine::hasFeature(EngineFeature feature) const {
- return feature == kSupportsReturnToLauncher || (!_museum &&
- (feature == kSupportsSubtitleOptions || feature == kSupportsSavingDuringRuntime || feature == kSupportsLoadingDuringRuntime));
+ return feature == kSupportsReturnToLauncher || (feature == kSupportsSubtitleOptions && !_museum) ||
+ (_game != kRunawayFullGame && (feature == kSupportsSavingDuringRuntime || feature == kSupportsLoadingDuringRuntime));
}
void RunawayEngine::syncSoundSettings() {
@@ -229,6 +292,13 @@ Common::Error RunawayEngine::playIntro(RunawayMenu &menu) {
}
Common::Error RunawayEngine::run() {
+ _inventory.reset(new RunawayInventory(_strings, _museum));
+ if (_museum && ConfMan.hasKey("boot_param") && findRunawayMuseumRoom(ConfMan.getInt("boot_param")))
+ _state.scene = ConfMan.getInt("boot_param");
+ _scene.reset(createScene(_state.scene));
+ if (!_scene)
+ return Common::Error(Common::kUnsupportedGameidError,
+ Common::String::format("Runaway scene %u is not implemented yet", _state.scene));
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
initGraphics(kRunawayScreenWidth, kRunawayScreenHeight, &format);
if (_system->getScreenFormat() != format)
@@ -236,22 +306,17 @@ Common::Error RunawayEngine::run() {
setDebugger(new GUI::Debugger());
syncSoundSettings();
RunawayMenu menu(_mixer, _strings);
- if (!menu.load(_museum))
+ if (!menu.load(_game))
return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo menu");
- _inventory.reset(new RunawayInventory(_strings, _museum));
- if (_museum)
- _scene.reset(new RunawayMuseumScene(_mixer, *_inventory, _strings));
- else
- _scene.reset(new RunawayScene5030(_mixer, *_inventory, _strings));
_ui.reset(new RunawayUI(_mixer, *_inventory, _strings));
- if (!_scene->load() || !_ui->load(_museum))
+ if (!_scene->load(_state.scene) || !_ui->load(_game, _state.chapter()))
return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo resources");
syncSoundSettings();
- if (!_museum && ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) {
+ if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) {
const Common::Error result = loadGameState(ConfMan.getInt("save_slot"));
if (result.getCode() != Common::kNoError)
return result;
- } else if (!_museum) {
+ } else if (_game == kRunawayCabinDemo) {
const Common::Error result = playIntro(menu);
if (result.getCode() != Common::kNoError || shouldQuit())
return result;
@@ -267,15 +332,20 @@ Common::Error RunawayEngine::run() {
bool leftPressed = false, rightPressed = false;
while (!shouldQuit()) {
const uint32 now = getTotalPlayTime();
+ // Museum doors close once the opening sound finishes, across the room change.
+ if (_pendingDoorClose && !_audio.effectPlaying()) {
+ _pendingDoorClose = false;
+ _audio.playEffect(4);
+ }
Common::Point mouse = _eventMan->getMousePos();
- _ui->update(now, mouse, _scene->hotspotAt(mouse), _scene->busy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
+ _ui->update(now, mouse, _scene->hotspotAt(mouse), sceneBusy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
bool openMenu = false;
Common::Event event;
while (!openMenu && _eventMan->pollEvent(event)) {
if (_loadedGame)
break;
if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_RBUTTONDOWN) {
- _ui->update(now, event.mouse, _scene->hotspotAt(event.mouse), _scene->busy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
+ _ui->update(now, event.mouse, _scene->hotspotAt(event.mouse), sceneBusy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
const RunawayUI::Command command = _ui->click(event.type == Common::EVENT_RBUTTONDOWN);
switch (command.type) {
case RunawayUI::Command::kOpenMenu:
@@ -300,7 +370,7 @@ Common::Error RunawayEngine::run() {
}
} else if (event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START || event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_END) {
mouse = _eventMan->getMousePos();
- _ui->update(now, mouse, _scene->hotspotAt(mouse), _scene->busy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
+ _ui->update(now, mouse, _scene->hotspotAt(mouse), sceneBusy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
const bool pressed = event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START;
switch (event.customType) {
case kPauseMenu:
@@ -313,11 +383,11 @@ Common::Error RunawayEngine::run() {
rightPressed = pressed;
break;
case kScrollStart:
- if (pressed && !_ui->inventoryOpen() && !_scene->busy())
+ if (pressed && !_ui->inventoryOpen() && !sceneBusy())
_scene->setCameraX(0);
break;
case kScrollEnd:
- if (pressed && !_ui->inventoryOpen() && !_scene->busy())
+ if (pressed && !_ui->inventoryOpen() && !sceneBusy())
_scene->setCameraX(_scene->roomWidth() - kRunawayScreenWidth);
break;
case kCancelAction:
@@ -374,7 +444,14 @@ Common::Error RunawayEngine::run() {
}
// The engine clock excludes time spent in ScummVM dialogs, keeping
// animation frames and subtitle deadlines in sync with paused audio.
- _scene->update(now, _ui->inventoryOpen() || _scene->busy() ? 0 : direction, _ui->inventoryOpen());
+ _scene->update(now, _ui->inventoryOpen() || sceneBusy() ? 0 : direction, _ui->inventoryOpen());
+ if (_scene->transition().scene) {
+ const Common::Error result = changeScene();
+ if (result.getCode() != Common::kNoError)
+ return result;
+ leftPressed = rightPressed = false;
+ continue;
+ }
// The extended French demo's later rooms are not implemented yet;
// all three releases currently finish at the shared shack escape.
if (_scene->escaped()) {
@@ -385,7 +462,7 @@ Common::Error RunawayEngine::run() {
leftPressed = rightPressed = false;
continue;
}
- _ui->update(now, mouse, _scene->hotspotAt(mouse), _scene->busy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
+ _ui->update(now, mouse, _scene->hotspotAt(mouse), sceneBusy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
_scene->draw();
Graphics::ManagedSurface &screen = _scene->screen();
const bool subtitles = _museum || !ConfMan.hasKey("subtitles") || ConfMan.getBool("subtitles") || ConfMan.getBool("speech_mute");
diff --git a/engines/hollywood/runaway/engine.h b/engines/hollywood/runaway/engine.h
index b2dabf21b55..e2aa337b931 100644
--- a/engines/hollywood/runaway/engine.h
+++ b/engines/hollywood/runaway/engine.h
@@ -26,7 +26,9 @@
#include "common/language.h"
#include "common/ptr.h"
#include "engines/engine.h"
+#include "hollywood/runaway/audio.h"
#include "hollywood/runaway/menu.h"
+#include "hollywood/runaway/saveload.h"
namespace Common {
class Keymap;
@@ -47,7 +49,7 @@ class RunawayUI;
// has its own RGB565 renderer, scene state and audio formats.
class RunawayEngine : public Engine {
public:
- RunawayEngine(OSystem *syst, Common::Language language, bool museum);
+ RunawayEngine(OSystem *syst, Common::Language language, RunawayGameType game);
~RunawayEngine() override;
Common::Error run() override;
@@ -64,6 +66,9 @@ public:
static void registerDefaultSettings();
private:
+ RunawayScene *createScene(uint16 entryScene);
+ Common::Error changeScene();
+ bool sceneBusy() const;
Common::Error playIntro(RunawayMenu &menu);
Common::Error playEnding(RunawayMenu &menu);
void pauseMenu(RunawayMenu &menu, Graphics::ManagedSurface &screen);
@@ -71,12 +76,16 @@ private:
void applySettings(const RunawayMenu::Settings &settings, bool restoreDefaults = false);
void present(const Graphics::ManagedSurface &screen);
Common::Language _language;
+ const RunawayGameType _game;
const bool _museum;
RunawayStrings _strings;
+ RunawayAudio _audio;
+ RunawaySaveState _state;
Common::ScopedPtr<RunawayInventory> _inventory;
Common::ScopedPtr<RunawayScene> _scene;
Common::ScopedPtr<RunawayUI> _ui;
bool _inPresentation = false, _gameStarted = false, _loadedGame = false;
+ bool _pendingDoorClose = false;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/font.cpp b/engines/hollywood/runaway/font.cpp
index fb644dacb7d..6b4a8756957 100644
--- a/engines/hollywood/runaway/font.cpp
+++ b/engines/hollywood/runaway/font.cpp
@@ -60,7 +60,7 @@ bool RunawayFont::load(bool menuFont, bool museum) {
return false;
} else if (!readRunawayGlobalChunk(menuFont ? 148 : 125, _pixels) ||
!readRunawayGlobalChunk(menuFont ? 149 : 126, metrics) ||
- (metrics.size() != 119 * 5 && metrics.size() != 150 * 5 && metrics.size() != 156 * 5)) {
+ (metrics.size() != 119 * 5 && metrics.size() != 150 * 5 && metrics.size() != 156 * 5 && metrics.size() != 161 * 5)) {
return false;
}
_glyphs.resize(metrics.size() / 5);
@@ -77,6 +77,14 @@ bool RunawayFont::load(bool menuFont, bool museum) {
}
memcpy(_glyphMap, kGlyphMap, sizeof(_glyphMap));
_missingGlyph = _glyphs.size() <= 119 ? 255 : _glyphs.size() - 1;
+ // English retail's table at 0x5a51f0 retains the DOS character mapping,
+ // moving only the missing-character box to the end of its larger font.
+ if (_glyphs.size() == 161) {
+ for (uint i = 0; i < ARRAYSIZE(_glyphMap); ++i) {
+ if (_glyphMap[i] == 149)
+ _glyphMap[i] = 160;
+ }
+ }
// Museum and Spanish tables use the first 117 and 119 glyphs respectively,
// marking unsupported characters with 255, without a fallback picture.
if (_glyphs.size() <= 119) {
diff --git a/engines/hollywood/runaway/graphics.cpp b/engines/hollywood/runaway/graphics.cpp
index 9bb304e215b..6fc2495086e 100644
--- a/engines/hollywood/runaway/graphics.cpp
+++ b/engines/hollywood/runaway/graphics.cpp
@@ -165,13 +165,23 @@ void RunawayAnimation::draw(Graphics::ManagedSurface &surface, uint frame, int c
}
static bool readGlobalChunk(Common::File &file, uint chunk, Common::Array<byte> &data) {
- if (chunk >= 500 || file.size() < 4010 || !file.seek(10 + chunk * 4))
+ if (chunk >= 500 || file.size() < 4010 || !file.seek(10))
+ return false;
+ // The first offset points immediately past both tables, even when the
+ // first chunk is empty. Do not mistake retail configuration bytes for offsets.
+ uint prefix = 10;
+ if (file.readUint32LE() != 4010) {
+ prefix = 20;
+ if (!file.seek(prefix) || file.readUint32LE() != 4020)
+ return false;
+ }
+ if (!file.seek(prefix + chunk * 4))
return false;
const uint32 offset = file.readUint32LE();
- if (!file.seek(10 + 500 * 4 + chunk * 4))
+ if (!file.seek(prefix + 500 * 4 + chunk * 4))
return false;
const uint32 size = file.readUint32LE();
- if (!size || size > 16 * 1024 * 1024 || offset < 4010 || offset > file.size() || size > file.size() - offset ||
+ if (file.err() || !size || size > 16 * 1024 * 1024 || offset < prefix + 4000 || offset > file.size() || size > file.size() - offset ||
!file.seek(offset))
return false;
data.resize(size);
@@ -183,17 +193,35 @@ bool readRunawayGlobalChunk(uint chunk, Common::Array<byte> &data) {
return file.open("RESOURCE.000") && readGlobalChunk(file, chunk, data);
}
+bool RunawayActor::loadChapter(byte chapter, bool alternate) {
+ if (chapter < 1 || chapter > 6)
+ return false;
+ if (chapter <= 2)
+ return load(alternate ? kChapters12Alternate : kChapters12);
+ if (chapter == 3)
+ return load(alternate ? kCabinAlternate : kCabin);
+ return load(alternate ? kChapters456Alternate : kChapters456);
+}
+
bool RunawayActor::load(Model model) {
if (_loadedModel == model)
return setFrame(3, 0);
_loadedModel = -1;
Common::File file;
Common::Array<byte> palette;
- const bool museum = model != kCabin;
+ const bool museum = model == kMuseumInterior || model == kMuseumHall;
const bool interior = model == kMuseumInterior;
- // Native chapter-five actor loader at 0x40b590 selects entry 44. Entry 45
- // is the palette, 46..53 hold walking cels, 54..59 hold head cels, and
- // entry 60 describes the six banks of 40 head cels.
+ // Each bank contains descriptors, palette, eight walking banks, six
+ // head banks and head descriptors (retail loader 0x40eac0).
+ uint base = 44;
+ switch (model) {
+ case kChapters12: base = 10; break;
+ case kChapters12Alternate: base = 27; break;
+ case kCabinAlternate: base = 61; break;
+ case kChapters456: base = 78; break;
+ case kChapters456Alternate: base = 95; break;
+ default: break;
+ }
_facing = _frame = _headFrame = -1;
_museum = museum;
_width = museum ? (interior ? 237 : 238) : 345;
@@ -206,8 +234,8 @@ bool RunawayActor::load(Model model) {
!readRunawayFile(Common::Path(Common::String::format("br1_%s.PAL", suffix)), palette) ||
!readRunawayFile(Common::Path(Common::String::format("ca1_%s.VAL", suffix)), _headDescriptors))
return false;
- } else if (!file.open("RESOURCE.000") || !readGlobalChunk(file, 44, _descriptors) ||
- !readGlobalChunk(file, 45, palette) || !readGlobalChunk(file, 60, _headDescriptors)) {
+ } else if (!file.open("RESOURCE.000") || !readGlobalChunk(file, base, _descriptors) ||
+ !readGlobalChunk(file, base + 1, palette) || !readGlobalChunk(file, base + 16, _headDescriptors)) {
return false;
}
if (_descriptors.size() != kFacings * kFrames * 32 || palette.size() != 512 ||
@@ -220,7 +248,7 @@ bool RunawayActor::load(Model model) {
_shadow.resize(_width * _height);
for (uint facing = 0; facing < kFacings; ++facing) {
if (museum ? !readRunawayFile(Common::Path(Common::String::format("br1_%s%u.SPR", suffix, facing)), _banks[facing]) :
- !readGlobalChunk(file, 46 + facing, _banks[facing]))
+ !readGlobalChunk(file, base + 2 + facing, _banks[facing]))
return false;
for (uint frame = 0; frame < kFrames; ++frame) {
if (!setFrame(facing, frame))
@@ -230,7 +258,7 @@ bool RunawayActor::load(Model model) {
const byte headFacings[kHeadFacings] = {0, 1, 2, 4, 5, 7};
for (uint bank = 0; bank < kHeadFacings; ++bank) {
if (museum ? !readRunawayFile(Common::Path(Common::String::format("ca1_%s%u.SPR", suffix, bank)), _headBanks[bank]) :
- !readGlobalChunk(file, 54 + bank, _headBanks[bank]))
+ !readGlobalChunk(file, base + 10 + bank, _headBanks[bank]))
return false;
for (uint frame = 0; frame < kHeadFrames; ++frame) {
if (!setFrame(headFacings[bank], 0, frame))
diff --git a/engines/hollywood/runaway/graphics.h b/engines/hollywood/runaway/graphics.h
index 325b61237fa..61c55c4cbf1 100644
--- a/engines/hollywood/runaway/graphics.h
+++ b/engines/hollywood/runaway/graphics.h
@@ -32,7 +32,8 @@ namespace Hollywood {
class ChunkArchive;
bool readRunawayFile(const Common::Path &path, Common::Array<byte> &data);
-// The cabin demos' RESOURCE.000 has a ten-byte header and two 500-entry tables.
+// RESOURCE.000 has a ten-byte (demo) or twenty-byte (retail) prefix,
+// followed by two 500-entry tables.
bool readRunawayGlobalChunk(uint chunk, Common::Array<byte> &data);
bool loadRunawaySurface(uint chunk, int width, int height, Graphics::ManagedSurface &surface);
bool loadRunawaySurface(const Common::Path &path, int width, int height, Graphics::ManagedSurface &surface);
@@ -66,7 +67,10 @@ private:
// shadow planes. This differs from the room animation spans.
class RunawayActor {
public:
- enum Model { kCabin, kMuseumInterior, kMuseumHall };
+ enum Model {
+ kCabin, kMuseumInterior, kMuseumHall,
+ kChapters12, kChapters12Alternate, kCabinAlternate, kChapters456, kChapters456Alternate
+ };
struct RenderParams {
Common::Point position, camera;
@@ -78,6 +82,7 @@ public:
bool antialias = true;
};
bool load(Model model = kCabin);
+ bool loadChapter(byte chapter, bool alternate);
bool setFrame(uint facing, uint frame, int headFrame = -1);
static float perspectiveHeight(Common::Point position);
void draw(Graphics::ManagedSurface &surface, Common::Point position, int cameraX,
diff --git a/engines/hollywood/runaway/menu.cpp b/engines/hollywood/runaway/menu.cpp
index 5b1425e131d..02cca6e9517 100644
--- a/engines/hollywood/runaway/menu.cpp
+++ b/engines/hollywood/runaway/menu.cpp
@@ -54,7 +54,8 @@ bool RunawayMenu::Settings::operator==(const Settings &other) const {
RunawayMenu::~RunawayMenu() { close(); }
-bool RunawayMenu::load(bool museum) {
+bool RunawayMenu::load(RunawayGameType game) {
+ const bool museum = game == kRunawayMuseumDemo;
_museum = museum;
_audio.setMuseum(museum);
Graphics::ManagedSurface cursors;
@@ -69,7 +70,8 @@ bool RunawayMenu::load(bool museum) {
return false;
} else if (!loadRunawaySurface(132, 1024, 600, _background) ||
!loadRunawaySurface(130, 700, 74, _returnButton) ||
- !loadRunawaySurface(118, 48, 48, _logo) || !loadRunawaySurface(114, 904, 540, cursors) ||
+ (game != kRunawayFullGame && !loadRunawaySurface(118, 48, 48, _logo)) ||
+ !loadRunawaySurface(game == kRunawayFullGame ? 112 : 114, 904, 540, cursors) ||
!readRunawayGlobalChunk(155, animation) || !_volumeDial.load(animation, 103))
return false;
_cursor.create(60, 60, kMenuFormat);
@@ -595,7 +597,8 @@ void RunawayMenu::draw(Graphics::ManagedSurface &screen) {
}
_captionFont.drawString(screen.surfacePtr(), caption, 0, 684, 1024, kNormal, Graphics::kTextAlignCenter);
}
- screen.copyRectToSurface(_logo, 976, 720, Common::Rect(48, 48));
+ if (_logo.w)
+ screen.copyRectToSurface(_logo, 976, 720, Common::Rect(48, 48));
}
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/menu.h b/engines/hollywood/runaway/menu.h
index 528ce5b0b4b..5769c553549 100644
--- a/engines/hollywood/runaway/menu.h
+++ b/engines/hollywood/runaway/menu.h
@@ -24,6 +24,7 @@
#include "common/keyboard.h"
#include "engines/savestate.h"
+#include "hollywood/runaway/detection.h"
#include "hollywood/runaway/font.h"
#include "hollywood/runaway/graphics.h"
#include "hollywood/runaway/presentation.h"
@@ -45,7 +46,7 @@ public:
RunawayMenu(Audio::Mixer *mixer, const RunawayStrings &strings) : _strings(strings), _audio(mixer) {}
~RunawayMenu();
- bool load(bool museum = false);
+ bool load(RunawayGameType game);
void open(const Graphics::ManagedSurface &screen, const Settings &settings, bool canSave = false, bool canLoad = true);
void close();
Command update(Common::Point mouse);
diff --git a/engines/hollywood/runaway/saveload.cpp b/engines/hollywood/runaway/saveload.cpp
index 1d1167fc483..19228fd87ac 100644
--- a/engines/hollywood/runaway/saveload.cpp
+++ b/engines/hollywood/runaway/saveload.cpp
@@ -20,6 +20,7 @@
*/
#include "hollywood/runaway/saveload.h"
+#include "hollywood/runaway/scene_data.h"
namespace Hollywood {
@@ -47,14 +48,49 @@ void RunawaySaveState::sync(Common::Serializer &s) {
s.syncAsByte(verb);
s.syncAsUint32LE(randomSeed);
s.syncAsUint32LE(playTime);
+ s.syncAsByte(game, 2);
+ s.syncAsUint16LE(cameraY, 2);
+ s.syncAsByte(upperFloor, 2);
+ s.syncAsByte(books, 2);
+ s.syncAsByte(recorder, 2);
+ s.syncAsByte(moneyIdentified, 2);
+ s.syncAsByte(safeOpen, 2);
+ s.syncAsByte(varnishTaken, 2);
+ s.syncAsByte(talcTaken, 2);
+ s.syncAsByte(coffeeTaken, 2);
+ s.syncAsByte(keyCount, 2);
+}
+
+byte RunawaySaveState::chapter() const {
+ switch (scene / 1000) {
+ case 1: case 2: return 1;
+ case 4: return 2;
+ case 5: return 3;
+ case 6: return 4;
+ case 7: return 5;
+ case 8: case 9: return 6;
+ default: return 0;
+ }
}
bool RunawaySaveState::valid() const {
- if (scene != 5030 || x >= 1376 || y >= 600 || camera > 352 || facing >= 8 ||
+ if (game > kRunawayFullGame || !chapter() || x >= 32768 || y >= 32768 ||
+ camera >= 32768 || cameraY >= 32768 || facing >= 8 ||
lidOpen > 1 || unplugged > 1 || windowClean > 1 || coolerMoved > 1 ||
coolerInspected > 1 || peeked > 1 || ice > 2 || hatch > 3 ||
itemCount > sizeof(items) || selected > sizeof(items) || cloth > 2 || inventoryOpen > 1 || verb > 2)
return false;
+ if (game == kRunawayCabinDemo && (scene != 5030 || x >= 1376 || y >= 600 || camera > 352 || cameraY))
+ return false;
+ if (upperFloor > 1 || books > 2 || recorder > 2 || moneyIdentified > 1 || safeOpen > 1 ||
+ varnishTaken > 1 || talcTaken > 1 || coffeeTaken > 1 || keyCount > 4)
+ return false;
+ if (game == kRunawayMuseumDemo) {
+ const MuseumRoom *room = findRunawayMuseumRoom(scene);
+ if (!room || x >= room->width || y >= room->height || camera > room->width - 1024 ||
+ cameraY > room->height - 600)
+ return false;
+ }
if ((coolerMoved && ice != 2) || ((hatch != 0) != (coolerMoved != 0)))
return false;
for (uint i = 0; i < sizeof(pickedUp); ++i) {
@@ -63,7 +99,8 @@ bool RunawaySaveState::valid() const {
}
bool owned[27] = {};
for (uint i = 0; i < itemCount; ++i) {
- if (!items[i] || items[i] >= sizeof(owned) || owned[items[i]])
+ if (!items[i] || items[i] >= sizeof(owned) || owned[items[i]] ||
+ (game == kRunawayMuseumDemo && items[i] > 19))
return false;
owned[items[i]] = true;
}
@@ -71,9 +108,14 @@ bool RunawaySaveState::valid() const {
}
bool RunawaySaveState::read(Common::SeekableReadStream &stream) {
- if (stream.readUint32BE() != MKTAG('R', 'U', 'N', 'A') || stream.readUint16LE() != 1)
+ *this = RunawaySaveState();
+ if (stream.readUint32BE() != MKTAG('R', 'U', 'N', 'A'))
+ return false;
+ const uint16 version = stream.readUint16LE();
+ if (version < 1 || version > 2)
return false;
Common::Serializer s(&stream, nullptr);
+ s.setVersion(version);
sync(s);
return !s.err() && !stream.eos() && valid();
}
@@ -82,8 +124,9 @@ bool RunawaySaveState::write(Common::WriteStream &stream) {
if (!valid())
return false;
stream.writeUint32BE(MKTAG('R', 'U', 'N', 'A'));
- stream.writeUint16LE(1);
+ stream.writeUint16LE(2);
Common::Serializer s(nullptr, &stream);
+ s.setVersion(2);
sync(s);
return !s.err();
}
diff --git a/engines/hollywood/runaway/saveload.h b/engines/hollywood/runaway/saveload.h
index 7762f06dbee..7176fb071c8 100644
--- a/engines/hollywood/runaway/saveload.h
+++ b/engines/hollywood/runaway/saveload.h
@@ -23,11 +23,12 @@
#define HOLLYWOOD_RUNAWAY_SAVELOAD_H
#include "common/serializer.h"
+#include "hollywood/runaway/detection.h"
namespace Hollywood {
-// Saves are made between actions. Resource data, pointers and transient
-// speech/animation clocks are rebuilt when the persistent state is restored.
+// Persistent state survives scene changes. Saves are made between actions;
+// resources, pointers and animation clocks are rebuilt when restoring it.
struct RunawaySaveState {
uint16 scene = 5030, x = 623, y = 447, camera = 111;
byte facing = 3, lidOpen = 0, unplugged = 0, windowClean = 0;
@@ -36,7 +37,12 @@ struct RunawaySaveState {
byte itemCount = 0, items[26] = {}, selected = 0, cloth = 0;
byte inventoryOpen = 0, verb = 0;
uint32 randomSeed = 0, playTime = 0;
+ byte game = kRunawayCabinDemo;
+ uint16 cameraY = 0;
+ byte upperFloor = 1, books = 0, recorder = 0, moneyIdentified = 0, safeOpen = 0;
+ byte varnishTaken = 0, talcTaken = 0, coffeeTaken = 0, keyCount = 0;
+ byte chapter() const;
bool valid() const;
bool read(Common::SeekableReadStream &stream);
bool write(Common::WriteStream &stream);
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index e0c3ac5cbdc..7befa4a42ab 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -19,12 +19,12 @@
*
*/
-#include "common/config-manager.h"
#include "common/endian.h"
#include "common/str-enc.h"
#include "common/textconsole.h"
#include "common/util.h"
#include "hollywood/runaway/navigation.h"
+#include "hollywood/runaway/saveload.h"
#include "hollywood/runaway/scene.h"
#include "hollywood/runaway/scene_data.h"
#include "hollywood/runaway/strings.h"
@@ -70,21 +70,20 @@ const MuseumRoom *findRoom(int number) {
} // End of anonymous namespace
-RunawayMuseumScene::RunawayMuseumScene(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings) :
- _audio(mixer), _inventory(inventory), _strings(strings) {
- _audio.setMuseum(true);
+const MuseumRoom *findRunawayMuseumRoom(uint16 number) {
+ return findRoom(number);
}
-bool RunawayMuseumScene::load() {
+RunawayMuseumScene::RunawayMuseumScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings) :
+ _audio(audio), _inventory(inventory), _strings(strings) {}
+
+bool RunawayMuseumScene::load(uint16 entryScene) {
+ const MuseumRoom *room = findRoom(entryScene);
+ if (!room)
+ return false;
+ _entryScene = entryScene;
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
_screen.create(kRunawayScreenWidth, kRunawayScreenHeight, format);
- // The museum intro ends in the restoration laboratory.
- const MuseumRoom *room = &kRunawayScene4050;
- if (ConfMan.hasKey("boot_param")) {
- const MuseumRoom *requested = findRoom(ConfMan.getInt("boot_param"));
- if (requested)
- room = requested;
- }
return enterRoom(room->number, room->entry, 3);
}
@@ -94,8 +93,58 @@ void RunawayMuseumScene::start(uint32 now) {
for (uint i = 0; i < ARRAYSIZE(initialItems); ++i)
_inventory.add(initialItems[i]);
_inventory.takeNewItem();
+ resume();
+}
+
+void RunawayMuseumScene::resume() {
// The original demo loops M04 cue 11 throughout gameplay (0x4175c0).
- _audio.playMusic(11);
+ if (!_audio.musicPlaying())
+ _audio.playMusic(11);
+}
+
+void RunawayMuseumScene::captureState(RunawaySaveState &state) const {
+ state.scene = _entryScene;
+ state.x = _position.x;
+ state.y = _position.y;
+ state.camera = _camera.x;
+ state.cameraY = _camera.y;
+ state.facing = _facing;
+ state.upperFloor = _upperFloor;
+ state.books = _books;
+ state.recorder = _recorder;
+ state.moneyIdentified = _moneyIdentified;
+ state.safeOpen = _safeOpen;
+ state.varnishTaken = _varnishTaken;
+ state.talcTaken = _talcTaken;
+ state.coffeeTaken = _coffeeTaken;
+ state.keyCount = _keyCount;
+}
+
+bool RunawayMuseumScene::restoreState(const RunawaySaveState &state, uint32 now, bool entering) {
+ if (!state.valid() || state.game != kRunawayMuseumDemo || state.scene != _entryScene)
+ return false;
+ _upperFloor = state.upperFloor;
+ _books = (ObjectState)state.books;
+ _recorder = (ObjectState)state.recorder;
+ _moneyIdentified = state.moneyIdentified;
+ _safeOpen = state.safeOpen;
+ _varnishTaken = state.varnishTaken;
+ _talcTaken = state.talcTaken;
+ _coffeeTaken = state.coffeeTaken;
+ if (!rebuildBackground() || !_actor.setFrame(state.facing, 0))
+ return false;
+ updateMaps();
+ _position = Common::Point(state.x, state.y);
+ _x = state.x;
+ _y = state.y;
+ _facing = state.facing;
+ _keyCount = entering ? 0 : state.keyCount;
+ _now = _lastUpdate = now;
+ if (entering)
+ updateCamera();
+ else
+ _camera = Common::Point(state.camera, state.cameraY);
+ return true;
}
bool RunawayMuseumScene::enterRoom(uint16 number, Common::Point position, byte facing) {
@@ -376,16 +425,14 @@ void RunawayMuseumScene::execute(uint16 action) {
const MuseumExit &exit = room->exits[i];
if (exit.action != action)
continue;
- _pendingDoorClose = exit.door;
- if (exit.door)
- _audio.playEffect(3);
const Common::Point entry(exit.x, exit.y);
if (exit.destination == _room) {
changeFloor(exit.upperFloor, entry);
} else {
_upperFloor = exit.upperFloor;
- if (!enterRoom(exit.destination, entry, 3))
- error("Cannot load museum room %u", exit.destination);
+ _transition.scene = exit.destination;
+ _transition.position = entry;
+ _transition.door = exit.door;
}
return;
}
@@ -437,11 +484,8 @@ void RunawayMuseumScene::update(uint32 now, int scrollDirection, bool inventoryO
_now = now;
const uint elapsed = MIN<uint>(100, now - _lastUpdate);
_lastUpdate = now;
- // Door entry routines wait for the opening sound before playing the closing sound.
- if (_pendingDoorClose && !_audio.effectPlaying()) {
- _pendingDoorClose = false;
- _audio.playEffect(4);
- }
+ if (_pressedKey && (int32)(now - _keyUntil) >= 0)
+ _pressedKey = 0;
if (speaking() && (int32)(now - _subtitleUntil) >= 0)
skipSpeech();
if (inventoryOpen || _room == kMuseumKeypad)
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index ab11001013f..7bea5cf0d1d 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -32,9 +32,17 @@ namespace Hollywood {
class RunawayScene {
public:
+ struct Transition {
+ uint16 scene = 0; // Preserve entry substates, e.g. 2020..2023, until dispatch.
+ Common::Point position;
+ byte facing = 3;
+ bool door = false;
+ };
virtual ~RunawayScene() {}
- virtual bool load() = 0;
+ virtual bool load(uint16 entryScene) = 0;
virtual void start(uint32 now) = 0;
+ virtual void resume() = 0;
+ const Transition &transition() const { return _transition; }
virtual void click(Common::Point mouse, RunawayVerb verb, byte item) = 0;
virtual void update(uint32 now, int scrollDirection, bool inventoryOpen) = 0;
virtual void draw() = 0;
@@ -56,8 +64,13 @@ public:
virtual bool escaped() const { return false; }
virtual bool canSave() const { return false; }
virtual void captureState(RunawaySaveState &state) const {}
- virtual bool restoreState(const RunawaySaveState &state, uint32 now) { return false; }
+ // Prepare a replacement scene without changing shared inventory or audio.
+ virtual bool restoreState(const RunawaySaveState &state, uint32 now, bool entering = false) { return false; }
virtual void setOptions(bool antialias, bool fastScrolling) = 0;
+
+protected:
+ uint16 _entryScene = 0;
+ Transition _transition;
};
class RunawayStrings;
@@ -66,9 +79,10 @@ struct MuseumHotspot;
// Shared player for the museum demo's numbered scenes.
class RunawayMuseumScene : public RunawayScene {
public:
- RunawayMuseumScene(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings);
- bool load() override;
+ RunawayMuseumScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings);
+ bool load(uint16 entryScene) override;
void start(uint32 now) override;
+ void resume() override;
void click(Common::Point mouse, RunawayVerb verb, byte item) override;
void update(uint32 now, int scrollDirection, bool inventoryOpen) override;
void draw() override;
@@ -79,10 +93,13 @@ public:
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _caption; }
const Common::U32String &subtitle() const override { return _subtitle; }
- bool busy() const override { return _pendingHotspot != 0 || _pendingDoorClose || speaking(); }
+ bool busy() const override { return _pendingHotspot != 0 || _transition.scene || speaking(); }
bool speaking() const override { return !_subtitle.empty(); }
void skipSpeech() override;
void sayInventory(const RunawayInventory::Reply &reply) override;
+ bool canSave() const override { return !busy() && _pathIndex == _path.size() && !_pressedKey; }
+ void captureState(RunawaySaveState &state) const override;
+ bool restoreState(const RunawaySaveState &state, uint32 now, bool entering = false) override;
void setOptions(bool antialias, bool fastScrolling) override { _antialias = antialias; _fastScrolling = fastScrolling; }
private:
@@ -141,7 +158,7 @@ private:
void clickScene4140(byte id);
void drawScene4140(Graphics::ManagedSurface &viewport);
- RunawayAudio _audio;
+ RunawayAudio &_audio;
RunawayInventory &_inventory;
const RunawayStrings &_strings;
ChunkArchive _archive;
@@ -162,7 +179,6 @@ private:
float _x = 0, _y = 0;
uint32 _now = 0, _lastUpdate = 0, _walkElapsed = 0, _subtitleUntil = 0;
bool _upperFloor = true, _antialias = true, _fastScrolling = true;
- bool _pendingDoorClose = false;
ObjectState _books = kUnexamined, _recorder = kUnexamined;
bool _moneyIdentified = false, _safeOpen = false;
bool _varnishTaken = false, _talcTaken = false, _coffeeTaken = false;
diff --git a/engines/hollywood/runaway/scene4140.cpp b/engines/hollywood/runaway/scene4140.cpp
index 376298e97ab..0348fb6d011 100644
--- a/engines/hollywood/runaway/scene4140.cpp
+++ b/engines/hollywood/runaway/scene4140.cpp
@@ -38,8 +38,9 @@ void RunawayMuseumScene::clickScene4140(byte id) {
_pressedKey = id;
_keyUntil = _now + 180;
if (!id) {
- if (!enterRoom(kMuseumHall, Common::Point(1153, 297), 7))
- error("Cannot return to the museum hall");
+ _transition.scene = kMuseumHall;
+ _transition.position = Common::Point(1153, 297);
+ _transition.facing = 7;
} else if (id == 10) {
_keyCount = 0;
} else if (id == 12) {
diff --git a/engines/hollywood/runaway/scene5030.cpp b/engines/hollywood/runaway/scene5030.cpp
index b1f5eef093c..351a775628a 100644
--- a/engines/hollywood/runaway/scene5030.cpp
+++ b/engines/hollywood/runaway/scene5030.cpp
@@ -65,7 +65,10 @@ const SceneHotspot kHotspots[] = {
} // End of anonymous namespace
-bool RunawayScene5030::load() {
+bool RunawayScene5030::load(uint16 entryScene) {
+ if (entryScene != 5030)
+ return false;
+ _entryScene = entryScene;
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
if (!_archive.open(Common::Path("RESOURCE.E03"), 50) ||
!loadRunawayMask(_archive, kRoomWidth, kRoomHeight, _mask, _maps) ||
@@ -152,11 +155,17 @@ bool RunawayScene5030::loadRoomGraphics() {
void RunawayScene5030::start(uint32 now) {
_now = _lastUpdate = now;
- _audio.playMusic(11);
+ resume();
startAction(kIntroVideo);
}
+void RunawayScene5030::resume() {
+ if (!_audio.musicPlaying())
+ _audio.playMusic(11);
+}
+
void RunawayScene5030::captureState(RunawaySaveState &state) const {
+ state.scene = _entryScene;
state.x = _position.x;
state.y = _position.y;
state.camera = _cameraX;
@@ -174,11 +183,10 @@ void RunawayScene5030::captureState(RunawaySaveState &state) const {
state.examined[i] = _examined[i];
}
state.randomSeed = _random.getSeed();
- _inventory.captureState(state);
}
-bool RunawayScene5030::restoreState(const RunawaySaveState &state, uint32 now) {
- if (!state.valid())
+bool RunawayScene5030::restoreState(const RunawaySaveState &state, uint32 now, bool entering) {
+ if (!state.valid() || state.game != kRunawayCabinDemo || state.scene != _entryScene)
return false;
_lidOpen = state.lidOpen;
_unplugged = state.unplugged;
@@ -194,11 +202,8 @@ bool RunawayScene5030::restoreState(const RunawaySaveState &state, uint32 now) {
}
if (!loadRoomGraphics())
return false;
- stopSpeech();
- _audio.stopEffect();
_interrogation.stop();
_video.close();
- _inventory.restoreState(state);
_random.setSeed(state.randomSeed);
_now = _lastUpdate = _actionStarted = now;
_walkElapsed = _lastFootstep = _step = 0;
@@ -210,11 +215,9 @@ bool RunawayScene5030::restoreState(const RunawaySaveState &state, uint32 now) {
_committedCaption.clear();
_escaped = false;
setPosition(Common::Point(state.x, state.y), state.facing);
- setCameraX(state.camera);
+ setCameraX(entering ? state.x - kScreenWidth / 2 : state.camera);
_idleHead.reset(now);
- _actor.setFrame(_facing, 0, 0);
- _audio.playMusic(11);
- return true;
+ return _actor.setFrame(_facing, 0, 0);
}
void RunawayScene5030::setCameraX(int x) {
diff --git a/engines/hollywood/runaway/scene5030.h b/engines/hollywood/runaway/scene5030.h
index b908f6fe080..d1450c92a88 100644
--- a/engines/hollywood/runaway/scene5030.h
+++ b/engines/hollywood/runaway/scene5030.h
@@ -45,10 +45,11 @@ public:
kRoomWidth = 1376, kRoomHeight = kRunawayViewportHeight, kRoomTop = kRunawayViewportTop
};
- RunawayScene5030(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings) :
- _audio(mixer), _inventory(inventory), _strings(strings), _interrogation(mixer), _random("runawayShack"), _actor() {}
- bool load() override;
+ RunawayScene5030(Audio::Mixer *mixer, RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings) :
+ _audio(audio), _inventory(inventory), _strings(strings), _interrogation(mixer), _random("runawayShack"), _actor() {}
+ bool load(uint16 entryScene) override;
void start(uint32 now) override;
+ void resume() override;
void click(Common::Point mouse, RunawayVerb verb, byte item) override;
void update(uint32 now, int scrollDirection, bool inventoryOpen) override;
void draw() override;
@@ -71,7 +72,7 @@ public:
bool escaped() const override { return _escaped; }
bool canSave() const override { return !busy() && !speaking() && !_escaped && _pathIndex == _path.size(); }
void captureState(RunawaySaveState &state) const override;
- bool restoreState(const RunawaySaveState &state, uint32 now) override;
+ bool restoreState(const RunawaySaveState &state, uint32 now, bool entering = false) override;
void setOptions(bool antialias, bool fastScrolling) override { _antialias = antialias; _fastScrolling = fastScrolling; }
private:
@@ -117,7 +118,7 @@ private:
Common::Array<byte> _mask, _maps, _unplugPatch, _openLidPatch, _closedLidPatch;
Common::Array<byte> _pickupPatches[5];
Common::Array<uint16> _voiceSamples, _cueEnds;
- RunawayAudio _audio;
+ RunawayAudio &_audio;
RunawayInventory &_inventory;
const RunawayStrings &_strings;
RunawayInterrogation _interrogation;
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
index ad0771a61ea..2b7c8b8334d 100644
--- a/engines/hollywood/runaway/scene_data.h
+++ b/engines/hollywood/runaway/scene_data.h
@@ -82,6 +82,8 @@ extern const MuseumRoom kRunawayScene4090;
extern const MuseumRoom kRunawayScene4100;
extern const MuseumRoom kRunawayScene4140;
+const MuseumRoom *findRunawayMuseumRoom(uint16 number);
+
} // End of namespace Hollywood
#endif // HOLLYWOOD_RUNAWAY_SCENE_DATA_H
diff --git a/engines/hollywood/runaway/ui.cpp b/engines/hollywood/runaway/ui.cpp
index 87c0fe0268a..67edb2fcb76 100644
--- a/engines/hollywood/runaway/ui.cpp
+++ b/engines/hollywood/runaway/ui.cpp
@@ -56,7 +56,8 @@ RunawayUI::~RunawayUI() {
CursorMan.popCursor();
}
-bool RunawayUI::load(bool museum) {
+bool RunawayUI::load(RunawayGameType game, byte chapter) {
+ const bool museum = game == kRunawayMuseumDemo;
_museum = museum;
_audio.setMuseum(museum);
Common::Array<byte> animation;
@@ -74,13 +75,11 @@ bool RunawayUI::load(bool museum) {
!readRunawayFile(Common::Path("ovalo1.tct"), animation) || !_portrait.load(animation, 33) ||
!readRunawayFile(Common::Path("ov1golpe.tct"), animation) || !_idlePortrait.load(animation, 15))
return false;
- } else if (!loadRunawaySurface(114, 904, 540, _cursors) ||
- !loadRunawaySurface(118, 48, 48, _demoLogo) || !loadRunawaySurface(121, 80, 42 * 80, _icons) ||
+ } else if (!loadChapter(chapter) ||
+ (game != kRunawayFullGame && !loadRunawaySurface(118, 48, 48, _demoLogo)) ||
!loadRunawaySurface(127, 700, 74, _inventoryButton) || !loadRunawaySurface(129, 700, 74, _returnButton) ||
!loadRunawaySurface(128, 700, 74, _optionsButton) ||
- !loadRunawaySurface(131, 1024, 600, _inventoryBackground) || !loadRunawaySurface(133, 768, 576, _inventoryTexture) ||
- !readRunawayGlobalChunk(137, animation) || !_portrait.load(animation, 104) ||
- !readRunawayGlobalChunk(141, animation) || !_idlePortrait.load(animation, 32))
+ !loadRunawaySurface(131, 1024, 600, _inventoryBackground) || !loadRunawaySurface(133, 768, 576, _inventoryTexture))
return false;
_cursor.create(kCursorWidth, kCursorWidth, kUIFormat);
const uint16 key = *(const uint16 *)_cursors.getPixels();
@@ -90,6 +89,30 @@ bool RunawayUI::load(bool museum) {
return true;
}
+bool RunawayUI::loadChapter(byte chapter) {
+ if (_museum || chapter < 1 || chapter > 6)
+ return false;
+ // Native 0x410440 selects one icon strip per chapter; 0x40eea0 selects
+ // four portrait sets, with the last shared by chapters four through six.
+ static const uint16 iconHeights[] = {1840, 2079, 3360, 3760, 1360, 1920};
+ const uint portraitChunk = 135 + MIN<uint>(chapter - 1, 3);
+ Common::Array<byte> animation;
+ Graphics::ManagedSurface cursors, icons;
+ RunawayAnimation portrait, idlePortrait;
+ if (!loadRunawaySurface(111 + chapter, 904, chapter < 5 ? 540 : 480, cursors) ||
+ !loadRunawaySurface(118 + chapter, 80, iconHeights[chapter - 1], icons) ||
+ !readRunawayGlobalChunk(portraitChunk, animation) || !portrait.load(animation, 104) ||
+ !readRunawayGlobalChunk(portraitChunk + 4, animation) || !idlePortrait.load(animation, 32))
+ return false;
+ _cursors = Common::move(cursors);
+ _icons = Common::move(icons);
+ _portrait = Common::move(portrait);
+ _idlePortrait = Common::move(idlePortrait);
+ _audio.setChapter(chapter);
+ _cursorKey = -1;
+ return true;
+}
+
Common::Rect RunawayUI::itemRect(uint slot) const {
// Original layout table at 0x464508: the grid grows symmetrically within
// the 768-pixel inventory texture, with 80-pixel icons on a 96-pixel pitch.
@@ -448,7 +471,8 @@ void RunawayUI::draw(Graphics::ManagedSurface &screen, const Common::U32String &
_font.drawString(screen.surfacePtr(), caption, 20, 684, 984, color, Graphics::kTextAlignCenter);
}
// Native 0x4020b0 copies the demo logo to the bottom-right corner.
- screen.copyRectToSurface(_demoLogo, 976, 720, Common::Rect(0, 0, 48, 48));
+ if (_demoLogo.w)
+ screen.copyRectToSurface(_demoLogo, 976, 720, Common::Rect(0, 0, 48, 48));
}
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/ui.h b/engines/hollywood/runaway/ui.h
index a0b1caed16a..690b09237bb 100644
--- a/engines/hollywood/runaway/ui.h
+++ b/engines/hollywood/runaway/ui.h
@@ -24,6 +24,7 @@
#include "common/random.h"
#include "hollywood/runaway/audio.h"
+#include "hollywood/runaway/detection.h"
#include "hollywood/runaway/font.h"
#include "hollywood/runaway/graphics.h"
#include "hollywood/runaway/inventory.h"
@@ -42,7 +43,8 @@ public:
RunawayUI(Audio::Mixer *mixer, RunawayInventory &inventory, const RunawayStrings &strings) :
_audio(mixer), _inventory(inventory), _strings(strings), _random("runaway-ui") {}
~RunawayUI();
- bool load(bool museum = false);
+ bool load(RunawayGameType game, byte chapter);
+ bool loadChapter(byte chapter);
void update(uint32 now, Common::Point mouse, byte roomHotspot, bool blocked, bool speaking,
bool inventoryPresentation = false, byte speechFrame = 0);
Command click(bool right);
Commit: a09a49499ad7c811a3bd099f309505e99588e9c3
https://github.com/scummvm/scummvm/commit/a09a49499ad7c811a3bd099f309505e99588e9c3
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: implemented scene 2020
Changed paths:
A engines/hollywood/runaway/scene2020.cpp
engines/hollywood/module.mk
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/inventory.h
engines/hollywood/runaway/saveload.cpp
engines/hollywood/runaway/saveload.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene4030.cpp
engines/hollywood/runaway/scene4050.cpp
engines/hollywood/runaway/scene4060.cpp
engines/hollywood/runaway/scene4090.cpp
engines/hollywood/runaway/scene4100.cpp
engines/hollywood/runaway/scene4140.cpp
engines/hollywood/runaway/scene_data.h
diff --git a/engines/hollywood/module.mk b/engines/hollywood/module.mk
index b668393693b..dee8cb92cc4 100644
--- a/engines/hollywood/module.mk
+++ b/engines/hollywood/module.mk
@@ -150,6 +150,7 @@ MODULE_OBJS = \
runaway/presentation.o \
runaway/saveload.o \
runaway/scene.o \
+ runaway/scene2020.o \
runaway/scene4030.o \
runaway/scene4050.o \
runaway/scene4060.o \
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index bd4ae69bced..599a057bbdc 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -162,8 +162,9 @@ Common::Error RunawayEngine::loadGameStream(Common::SeekableReadStream *stream)
}
RunawayScene *RunawayEngine::createScene(uint16 entryScene) {
- if (_game == kRunawayMuseumDemo && findRunawayMuseumRoom(entryScene))
- return new RunawayMuseumScene(_audio, *_inventory, _strings);
+ if (findRunawayRoom(entryScene) && ((_museum && entryScene >= 4000) ||
+ (_game == kRunawayFullGame && entryScene == kHospitalBedroom)))
+ return new RunawayRoomScene(_audio, *_inventory, _strings, _game);
if (_game == kRunawayCabinDemo && entryScene == 5030)
return new RunawayScene5030(_mixer, _audio, *_inventory, _strings);
// Retail scene scripts have their own entry substates. Sharing an archive
@@ -234,7 +235,7 @@ void RunawayEngine::initializePath(const Common::FSNode &gamePath) {
bool RunawayEngine::hasFeature(EngineFeature feature) const {
return feature == kSupportsReturnToLauncher || (feature == kSupportsSubtitleOptions && !_museum) ||
- (_game != kRunawayFullGame && (feature == kSupportsSavingDuringRuntime || feature == kSupportsLoadingDuringRuntime));
+ feature == kSupportsSavingDuringRuntime || feature == kSupportsLoadingDuringRuntime;
}
void RunawayEngine::syncSoundSettings() {
@@ -292,8 +293,9 @@ Common::Error RunawayEngine::playIntro(RunawayMenu &menu) {
}
Common::Error RunawayEngine::run() {
- _inventory.reset(new RunawayInventory(_strings, _museum));
- if (_museum && ConfMan.hasKey("boot_param") && findRunawayMuseumRoom(ConfMan.getInt("boot_param")))
+ _inventory.reset(new RunawayInventory(_strings, _game));
+ if (_museum && ConfMan.hasKey("boot_param") && ConfMan.getInt("boot_param") >= 4000 &&
+ findRunawayRoom(ConfMan.getInt("boot_param")))
_state.scene = ConfMan.getInt("boot_param");
_scene.reset(createScene(_state.scene));
if (!_scene)
@@ -307,10 +309,10 @@ Common::Error RunawayEngine::run() {
syncSoundSettings();
RunawayMenu menu(_mixer, _strings);
if (!menu.load(_game))
- return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo menu");
+ return Common::Error(Common::kReadingFailed, "Cannot load the Runaway menu");
_ui.reset(new RunawayUI(_mixer, *_inventory, _strings));
if (!_scene->load(_state.scene) || !_ui->load(_game, _state.chapter()))
- return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo resources");
+ return Common::Error(Common::kReadingFailed, "Cannot load the Runaway resources");
syncSoundSettings();
if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) {
const Common::Error result = loadGameState(ConfMan.getInt("save_slot"));
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index 9d15f0d2db7..4041a89e434 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -34,6 +34,12 @@ const char *const kMuseumItemNames[] = {
"Pair of books", "Strange key", "Ladle", "Package of coffee"
};
+const char *const kHospitalItemNames[] = {
+ "", "Wallet", "Car keys", "Order form", "Piece of amber", "Gina's bag", "Gina's medical chart",
+ "Sheet", "Package of pills", "Matchbox", "Wig", "Marker pen", "Bottle of alcohol", "Glass",
+ "Pillows", "Syringe", "Blank medical chart", "Head", "Flammable spray can", "Vademecum"
+};
+
const byte kItemCursors[] = {
0, 41, 43, 45, 47, 49, 51, 55, 57, 59, 61, 63, 65, 67, 69,
75, 79, 81, 83, 85, 87, 91, 93, 95, 103, 105, 111
@@ -72,7 +78,7 @@ bool RunawayInventory::contains(byte item) const {
}
bool RunawayInventory::add(byte item) {
- if (!item || item > kItemCount || (_museum && item >= ARRAYSIZE(kMuseumItemNames)) || contains(item))
+ if (!item || item > kItemCount || (_game != kRunawayCabinDemo && item > 19) || contains(item))
return false;
_items.push_back(item);
_newItem = item;
@@ -93,15 +99,17 @@ void RunawayInventory::remove(byte item) {
}
Common::U32String RunawayInventory::name(byte item) const {
- if (_museum)
+ if (_game == kRunawayMuseumDemo)
return item < ARRAYSIZE(kMuseumItemNames) ? Common::U32String(kMuseumItemNames[item]) : Common::U32String();
+ if (_game == kRunawayFullGame)
+ return item < ARRAYSIZE(kHospitalItemNames) ? Common::U32String(kHospitalItemNames[item]) : Common::U32String();
if (item == 1 && _clothState)
return _strings.text(_clothState == 1 ? RunawayStrings::kWetCloth : RunawayStrings::kDirtyCloth);
return _strings.itemName(item);
}
uint RunawayInventory::icon(byte item) const {
- if (_museum)
+ if (_game != kRunawayCabinDemo)
return item;
if (item == 1 && _clothState)
return _clothState == 1 ? 34 : 35;
@@ -109,24 +117,28 @@ uint RunawayInventory::icon(byte item) const {
}
uint RunawayInventory::cursor(byte item) const {
- if (_museum)
+ if (_game == kRunawayMuseumDemo)
return item && item < ARRAYSIZE(kMuseumItemNames) ? 11 + item * 2 : 0;
+ if (_game == kRunawayFullGame)
+ return item && item <= 19 ? (item == 16 ? 81 : 39 + item * 2 - (item > 16 ? 2 : 0)) : 0;
if (item == 1 && _clothState)
return _clothState == 1 ? 107 : 109;
return item <= kItemCount ? kItemCursors[item] : 0;
}
RunawayInventory::Reply RunawayInventory::examine(byte item) const {
- if (_museum) {
+ if (_game == kRunawayMuseumDemo) {
if (!item || item >= ARRAYSIZE(kMuseumItemNames))
return Reply();
return Reply(item < 5 ? 49 + item : 95 + item, item == 7 ? 1 : 0);
}
+ if (_game == kRunawayFullGame)
+ return Reply(item && item <= 19 ? (item == 3 ? 74 : 49 + item) : 1);
return Reply(item && item <= kItemCount ? kExamineCues[item] : 1, item == 1 ? _clothState : 0);
}
RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
- if (_museum)
+ if (_game != kRunawayCabinDemo)
return Reply();
if (!contains(first) || !contains(second) || first == second)
return Reply();
diff --git a/engines/hollywood/runaway/inventory.h b/engines/hollywood/runaway/inventory.h
index 69ae94c1938..2506475fa11 100644
--- a/engines/hollywood/runaway/inventory.h
+++ b/engines/hollywood/runaway/inventory.h
@@ -24,6 +24,7 @@
#include "common/array.h"
#include "common/ustr.h"
+#include "hollywood/runaway/detection.h"
namespace Hollywood {
@@ -40,7 +41,7 @@ public:
byte variation;
Reply(uint16 c = 1, byte v = 0) : cue(c), variation(v) {}
};
- explicit RunawayInventory(const RunawayStrings &strings, bool museum = false) : _strings(strings), _museum(museum) {}
+ RunawayInventory(const RunawayStrings &strings, RunawayGameType game) : _strings(strings), _game(game) {}
bool contains(byte item) const;
bool add(byte item);
void remove(byte item);
@@ -61,7 +62,7 @@ public:
private:
const RunawayStrings &_strings;
- const bool _museum;
+ const RunawayGameType _game;
Common::Array<byte> _items;
byte _selected = 0, _newItem = 0, _clothState = 0;
};
diff --git a/engines/hollywood/runaway/saveload.cpp b/engines/hollywood/runaway/saveload.cpp
index 19228fd87ac..a2cfabf9622 100644
--- a/engines/hollywood/runaway/saveload.cpp
+++ b/engines/hollywood/runaway/saveload.cpp
@@ -59,6 +59,11 @@ void RunawaySaveState::sync(Common::Serializer &s) {
s.syncAsByte(talcTaken, 2);
s.syncAsByte(coffeeTaken, 2);
s.syncAsByte(keyCount, 2);
+ s.syncAsByte(hospital.glassTaken, 3);
+ s.syncAsByte(hospital.pillsTaken, 3);
+ s.syncAsByte(hospital.sheetTaken, 3);
+ s.syncAsByte(hospital.bagTaken, 3);
+ s.syncAsByte(hospital.exitMapRead, 3);
}
byte RunawaySaveState::chapter() const {
@@ -86,11 +91,17 @@ bool RunawaySaveState::valid() const {
varnishTaken > 1 || talcTaken > 1 || coffeeTaken > 1 || keyCount > 4)
return false;
if (game == kRunawayMuseumDemo) {
- const MuseumRoom *room = findRunawayMuseumRoom(scene);
- if (!room || x >= room->width || y >= room->height || camera > room->width - 1024 ||
+ const RunawayRoom *room = findRunawayRoom(scene);
+ if (!room || scene < 4000 || x >= room->width || y >= room->height || camera > room->width - 1024 ||
cameraY > room->height - 600)
return false;
}
+ if (hospital.glassTaken > 1 || hospital.pillsTaken > 1 || hospital.sheetTaken > 1 ||
+ hospital.bagTaken > 1 || hospital.exitMapRead > 1)
+ return false;
+ if (game == kRunawayFullGame && (scene != kHospitalBedroom || x >= 1520 || y >= 600 ||
+ camera < 156 || camera > 496 || cameraY))
+ return false;
if ((coolerMoved && ice != 2) || ((hatch != 0) != (coolerMoved != 0)))
return false;
for (uint i = 0; i < sizeof(pickedUp); ++i) {
@@ -100,7 +111,7 @@ bool RunawaySaveState::valid() const {
bool owned[27] = {};
for (uint i = 0; i < itemCount; ++i) {
if (!items[i] || items[i] >= sizeof(owned) || owned[items[i]] ||
- (game == kRunawayMuseumDemo && items[i] > 19))
+ (game != kRunawayCabinDemo && items[i] > 19))
return false;
owned[items[i]] = true;
}
@@ -112,7 +123,7 @@ bool RunawaySaveState::read(Common::SeekableReadStream &stream) {
if (stream.readUint32BE() != MKTAG('R', 'U', 'N', 'A'))
return false;
const uint16 version = stream.readUint16LE();
- if (version < 1 || version > 2)
+ if (version < 1 || version > 3)
return false;
Common::Serializer s(&stream, nullptr);
s.setVersion(version);
@@ -124,9 +135,9 @@ bool RunawaySaveState::write(Common::WriteStream &stream) {
if (!valid())
return false;
stream.writeUint32BE(MKTAG('R', 'U', 'N', 'A'));
- stream.writeUint16LE(2);
+ stream.writeUint16LE(3);
Common::Serializer s(nullptr, &stream);
- s.setVersion(2);
+ s.setVersion(3);
sync(s);
return !s.err();
}
diff --git a/engines/hollywood/runaway/saveload.h b/engines/hollywood/runaway/saveload.h
index 7176fb071c8..992d3a8344f 100644
--- a/engines/hollywood/runaway/saveload.h
+++ b/engines/hollywood/runaway/saveload.h
@@ -30,6 +30,10 @@ namespace Hollywood {
// Persistent state survives scene changes. Saves are made between actions;
// resources, pointers and animation clocks are rebuilt when restoring it.
struct RunawaySaveState {
+ struct Hospital {
+ byte glassTaken = 0, pillsTaken = 0, sheetTaken = 0, bagTaken = 0, exitMapRead = 0;
+ } hospital;
+
uint16 scene = 5030, x = 623, y = 447, camera = 111;
byte facing = 3, lidOpen = 0, unplugged = 0, windowClean = 0;
byte coolerMoved = 0, coolerInspected = 0, peeked = 0, ice = 0, hatch = 0;
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index 7befa4a42ab..582028b481e 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -35,11 +35,12 @@ namespace Hollywood {
namespace {
-const MuseumRoom *const kRooms[] = {
+const RunawayRoom *const kRooms[] = {
+ &kRunawayScene2020,
&kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140
};
-const MuseumResponse kGlobalResponses[] = {
+const RunawayResponse kGlobalResponses[] = {
{0, 3, 2, 0},
{0, 4, 3, 0},
{0, 5, 4, 0},
@@ -60,7 +61,7 @@ const MuseumResponse kGlobalResponses[] = {
{0, 30, 24, 0},
};
-const MuseumRoom *findRoom(int number) {
+const RunawayRoom *findRoom(int number) {
for (uint i = 0; i < ARRAYSIZE(kRooms); ++i) {
if (kRooms[i]->number == number)
return kRooms[i];
@@ -70,25 +71,31 @@ const MuseumRoom *findRoom(int number) {
} // End of anonymous namespace
-const MuseumRoom *findRunawayMuseumRoom(uint16 number) {
+const RunawayRoom *findRunawayRoom(uint16 number) {
return findRoom(number);
}
-RunawayMuseumScene::RunawayMuseumScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings) :
- _audio(audio), _inventory(inventory), _strings(strings) {}
+RunawayRoomScene::RunawayRoomScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings, RunawayGameType game) :
+ _audio(audio), _inventory(inventory), _strings(strings), _game(game), _random("runaway") {}
-bool RunawayMuseumScene::load(uint16 entryScene) {
- const MuseumRoom *room = findRoom(entryScene);
+bool RunawayRoomScene::load(uint16 entryScene) {
+ const RunawayRoom *room = findRoom(entryScene);
if (!room)
return false;
_entryScene = entryScene;
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
_screen.create(kRunawayScreenWidth, kRunawayScreenHeight, format);
- return enterRoom(room->number, room->entry, 3);
+ return enterRoom(room->number, room->entry, room->number == kHospitalBedroom ? 7 : 3);
}
-void RunawayMuseumScene::start(uint32 now) {
+void RunawayRoomScene::start(uint32 now) {
_now = _lastUpdate = now;
+ _idleHead.reset(now);
+ if (_room == kHospitalBedroom) {
+ start2020();
+ resume();
+ return;
+ }
const byte initialItems[] = {1, 2, 3, 4, 7};
for (uint i = 0; i < ARRAYSIZE(initialItems); ++i)
_inventory.add(initialItems[i]);
@@ -96,13 +103,18 @@ void RunawayMuseumScene::start(uint32 now) {
resume();
}
-void RunawayMuseumScene::resume() {
+void RunawayRoomScene::resume() {
+ if (_room == kHospitalBedroom) {
+ _audio.playMusic(11, false);
+ _audio.playEffect(30, 3, 1, true);
+ return;
+ }
// The original demo loops M04 cue 11 throughout gameplay (0x4175c0).
if (!_audio.musicPlaying())
_audio.playMusic(11);
}
-void RunawayMuseumScene::captureState(RunawaySaveState &state) const {
+void RunawayRoomScene::captureState(RunawaySaveState &state) const {
state.scene = _entryScene;
state.x = _position.x;
state.y = _position.y;
@@ -118,11 +130,14 @@ void RunawayMuseumScene::captureState(RunawaySaveState &state) const {
state.talcTaken = _talcTaken;
state.coffeeTaken = _coffeeTaken;
state.keyCount = _keyCount;
+ state.hospital = _hospital;
+ state.randomSeed = _random.getSeed();
}
-bool RunawayMuseumScene::restoreState(const RunawaySaveState &state, uint32 now, bool entering) {
- if (!state.valid() || state.game != kRunawayMuseumDemo || state.scene != _entryScene)
+bool RunawayRoomScene::restoreState(const RunawaySaveState &state, uint32 now, bool entering) {
+ if (!state.valid() || state.game != _game || state.scene != _entryScene)
return false;
+ _hospital = state.hospital;
_upperFloor = state.upperFloor;
_books = (ObjectState)state.books;
_recorder = (ObjectState)state.recorder;
@@ -140,6 +155,8 @@ bool RunawayMuseumScene::restoreState(const RunawaySaveState &state, uint32 now,
_facing = state.facing;
_keyCount = entering ? 0 : state.keyCount;
_now = _lastUpdate = now;
+ _random.setSeed(state.randomSeed);
+ _idleHead.reset(now);
if (entering)
updateCamera();
else
@@ -147,14 +164,17 @@ bool RunawayMuseumScene::restoreState(const RunawaySaveState &state, uint32 now,
return true;
}
-bool RunawayMuseumScene::enterRoom(uint16 number, Common::Point position, byte facing) {
- const MuseumRoom *room = findRoom(number);
+bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte facing) {
+ const RunawayRoom *room = findRoom(number);
if (!room || position.x < 0 || position.x >= room->width || position.y < 0 || position.y >= room->height)
return false;
- const Common::Path path(Common::String::format("RESOURCE.D%02u", number / 10 - 400));
+ const Common::Path path(_game == kRunawayFullGame ? "RESOURCE.B02" :
+ Common::String::format("RESOURCE.D%02u", number / 10 - 400));
if (!_archive.open(path, 40) ||
!loadRunawayMask(_archive, room->width, room->height, _mask, _originalMaps) ||
- !_text.load("RESOURCE.003", "Runaway museum", number / 10, 0, 0x1135) ||
+ !_text.load("RESOURCE.003", "Runaway room", number / 10, 0, 0x1135))
+ return false;
+ if (_game == kRunawayFullGame ? !_actor.loadChapter(1, true) :
!_actor.load(number == kMuseumHall ? RunawayActor::kMuseumHall : RunawayActor::kMuseumInterior))
return false;
_room = number;
@@ -178,6 +198,9 @@ bool RunawayMuseumScene::enterRoom(uint16 number, Common::Point position, byte f
_keyPatches[i].clear();
bool loaded = true;
switch (number) {
+ case kHospitalBedroom:
+ loaded = loadScene2020();
+ break;
case kMuseumOffice:
loaded = loadScene4030();
break;
@@ -201,35 +224,40 @@ bool RunawayMuseumScene::enterRoom(uint16 number, Common::Point position, byte f
return _actor.setFrame(_facing, 0);
}
-bool RunawayMuseumScene::loadForeground(uint layer, uint chunk) {
+bool RunawayRoomScene::loadForeground(uint layer, uint chunk, bool pixels) {
assert(layer < ARRAYSIZE(_foreground));
- const MuseumRoom *room = findRoom(_room);
+ const RunawayRoom *room = findRoom(_room);
// Foreground masks restore (x, y, length) spans from the current background.
Common::Array<byte> spans;
- if (!_archive.readVariableChunk(chunk, spans) || spans.size() < 2 ||
- spans.size() != 2U + READ_LE_UINT16(spans.data()) * 6U)
+ if (!_archive.readVariableChunk(chunk, spans) || spans.size() < 2)
return false;
- for (uint offset = 2; offset < spans.size(); offset += 6) {
+ uint offset = 2;
+ for (uint i = 0; i < READ_LE_UINT16(spans.data()); ++i) {
+ if (offset + 6 > spans.size())
+ return false;
const uint x = READ_LE_UINT16(spans.data() + offset);
const uint y = READ_LE_UINT16(spans.data() + offset + 2);
const uint width = READ_LE_UINT16(spans.data() + offset + 4);
if (!width || x + width > room->width || y >= room->height)
return false;
_foreground[layer].push_back(Common::Rect(x, y, x + width, y + 1));
+ offset += 6 + (pixels ? width * 2 : 0);
}
- return true;
+ return offset == spans.size();
}
-bool RunawayMuseumScene::applyPatch(uint chunk) {
+bool RunawayRoomScene::applyPatch(uint chunk) {
Common::Array<byte> data;
return _archive.readVariableChunk(chunk, data) && applyRunawayPatch(data, _background);
}
-bool RunawayMuseumScene::rebuildBackground() {
- const MuseumRoom *room = findRoom(_room);
+bool RunawayRoomScene::rebuildBackground() {
+ const RunawayRoom *room = findRoom(_room);
if (!loadRunawaySurface(_archive, 0, room->width, room->height, _background))
return false;
switch (_room) {
+ case kHospitalBedroom:
+ return applyBackground2020();
case kMuseumOffice:
return applyBackground4030();
case kMuseumLaboratory:
@@ -239,9 +267,12 @@ bool RunawayMuseumScene::rebuildBackground() {
}
}
-void RunawayMuseumScene::updateMaps() {
+void RunawayRoomScene::updateMaps() {
_maps = _originalMaps;
switch (_room) {
+ case kHospitalBedroom:
+ updateMaps2020();
+ break;
case kMuseumOffice:
updateMaps4030();
break;
@@ -256,12 +287,12 @@ void RunawayMuseumScene::updateMaps() {
}
}
-const MuseumHotspot *RunawayMuseumScene::hotspot(byte id) const {
- const MuseumRoom *room = findRoom(_room);
+const RunawayHotspot *RunawayRoomScene::hotspot(byte id) const {
+ const RunawayRoom *room = findRoom(_room);
return room && id && id < room->hotspotCount ? &room->hotspots[id] : nullptr;
}
-byte RunawayMuseumScene::hotspotAt(Common::Point mouse) const {
+byte RunawayRoomScene::hotspotAt(Common::Point mouse) const {
if (mouse.x < 0 || mouse.x >= kRunawayScreenWidth || mouse.y < kRunawayViewportTop ||
mouse.y >= kRunawayViewportTop + kRunawayViewportHeight)
return 0;
@@ -272,14 +303,14 @@ byte RunawayMuseumScene::hotspotAt(Common::Point mouse) const {
return (_room == kMuseumKeypad && id <= 12) || hotspot(id) ? id : 0;
}
-Common::U32String RunawayMuseumScene::hotspotName(byte id) const {
- const MuseumHotspot *spot = hotspot(id);
+Common::U32String RunawayRoomScene::hotspotName(byte id) const {
+ const RunawayHotspot *spot = hotspot(id);
if (!spot)
return Common::U32String();
return _room == kMuseumOffice ? hotspotName4030(id) : Common::U32String(spot->name);
}
-Common::U32String RunawayMuseumScene::actionCaption(byte id, RunawayVerb verb, byte item) const {
+Common::U32String RunawayRoomScene::actionCaption(byte id, RunawayVerb verb, byte item) const {
if (_room == kMuseumKeypad)
return Common::U32String();
const Common::U32String name = hotspotName(id);
@@ -291,14 +322,14 @@ Common::U32String RunawayMuseumScene::actionCaption(byte id, RunawayVerb verb, b
return _strings.text(verb == kVerbLook ? RunawayStrings::kLook : RunawayStrings::kUse) + name;
}
-void RunawayMuseumScene::walkTo(Common::Point target) {
+void RunawayRoomScene::walkTo(Common::Point target) {
RunawayWalkMap(_background.w, _background.h, _mask, _maps).findPath(_position, target, _path);
- _pathIndex = _walkElapsed = 0;
+ _pathIndex = _walkElapsed = _lastFootstep = 0;
if (_path.empty())
arrive();
}
-void RunawayMuseumScene::arrive() {
+void RunawayRoomScene::arrive() {
const byte id = _pendingHotspot;
_pendingHotspot = 0;
if (id) {
@@ -312,7 +343,7 @@ void RunawayMuseumScene::arrive() {
_caption.clear();
}
-void RunawayMuseumScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
+void RunawayRoomScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
if (busy())
return;
const byte id = hotspotAt(mouse);
@@ -321,7 +352,7 @@ void RunawayMuseumScene::click(Common::Point mouse, RunawayVerb verb, byte item)
return;
}
_caption = actionCaption(id, verb, item);
- const MuseumHotspot *spot = hotspot(id);
+ const RunawayHotspot *spot = hotspot(id);
_pendingItem = item;
if (spot) {
const uint index = verb == kVerbLook && !item ? 0 : 1;
@@ -339,20 +370,18 @@ void RunawayMuseumScene::click(Common::Point mouse, RunawayVerb verb, byte item)
}
}
-void RunawayMuseumScene::queueLine(const Common::U32String &line) {
- if (line.empty())
- return;
- _lines.push_back(line);
- if (!speaking())
- showLine();
-}
-
-void RunawayMuseumScene::showLine() {
- _subtitle = _lines[_lineIndex];
- _subtitleUntil = _now + MAX<uint>(3000, _subtitle.size() * 55);
+void RunawayRoomScene::showLine() {
+ const SpeechLine &line = _lines[_lineIndex];
+ _subtitle = line.text;
+ const uint32 duration = line.sample ? _audio.playSpeech(line.sample, line.global) : 0;
+ _subtitleUntil = _now + (duration ? MAX<uint>(1000, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
+ if (_game == kRunawayFullGame) {
+ _idleHead.reset(_now);
+ _lipSync.start(_subtitle, _now, duration, _random, line.sample);
+ }
}
-void RunawayMuseumScene::say(uint16 cue, byte variation, bool global) {
+void RunawayRoomScene::say(uint16 cue, byte variation, bool global) {
SceneSpeechCue speech;
if (global)
_text.getStaticSpeechCue(cue, variation, speech.textRecordId, speech.continuationCount, speech.voiceSampleId);
@@ -360,21 +389,33 @@ void RunawayMuseumScene::say(uint16 cue, byte variation, bool global) {
speech = _text.stageCue(cue, variation);
if (!speech.valid())
return;
- for (uint i = 0; i < MAX<uint>(1, speech.continuationCount); ++i)
- queueLine(Common::U32String(_text.largeTextRecord(speech.textRecordId + i), Common::kDos850));
+ for (uint i = 0; i < MAX<uint>(1, speech.continuationCount); ++i) {
+ SpeechLine line;
+ line.text = Common::U32String(_text.largeTextRecord(speech.textRecordId + i), Common::kDos850);
+ line.sample = _game == kRunawayFullGame && speech.voiceSampleId ? speech.voiceSampleId + i : 0;
+ line.global = global;
+ if (!line.text.empty())
+ _lines.push_back(line);
+ }
+ if (!speaking() && _lineIndex < _lines.size())
+ showLine();
}
-void RunawayMuseumScene::sayInventory(const RunawayInventory::Reply &reply) {
+void RunawayRoomScene::sayInventory(const RunawayInventory::Reply &reply) {
_path.clear();
_pathIndex = 0;
_pendingHotspot = 0;
_caption.clear();
+ if (_room == kHospitalBedroom && sayInventory2020(reply))
+ return;
say(reply.cue, reply.variation, true);
}
-void RunawayMuseumScene::skipSpeech() {
+void RunawayRoomScene::skipSpeech() {
if (!speaking())
return;
+ _audio.stopSpeech();
+ _lipSync.stop();
if (++_lineIndex < _lines.size()) {
showLine();
} else {
@@ -385,10 +426,10 @@ void RunawayMuseumScene::skipSpeech() {
}
}
-void RunawayMuseumScene::useItem(byte item, byte id) {
- const MuseumRoom *room = findRoom(_room);
+void RunawayRoomScene::useItem(byte item, byte id) {
+ const RunawayRoom *room = findRoom(_room);
for (uint i = 0; i < room->itemActionCount; ++i) {
- const MuseumItemAction &action = room->itemActions[i];
+ const RunawayItemAction &action = room->itemActions[i];
if (action.hotspot == id && (!action.item || action.item == item)) {
execute(action.action);
return;
@@ -397,9 +438,12 @@ void RunawayMuseumScene::useItem(byte item, byte id) {
say(1, 0, true);
}
-void RunawayMuseumScene::execute(uint16 action) {
+void RunawayRoomScene::execute(uint16 action) {
ActionResult result = kUnhandled;
switch (_room) {
+ case kHospitalBedroom:
+ result = execute2020(action);
+ break;
case kMuseumOffice:
result = execute4030(action);
break;
@@ -414,15 +458,15 @@ void RunawayMuseumScene::execute(uint16 action) {
}
if (result == kBackgroundChanged) {
if (!rebuildBackground())
- error("Cannot update museum room %u", _room);
+ error("Cannot update Runaway room %u", _room);
updateMaps();
}
if (result != kUnhandled)
return;
- const MuseumRoom *room = findRoom(_room);
+ const RunawayRoom *room = findRoom(_room);
for (uint i = 0; i < room->exitCount; ++i) {
- const MuseumExit &exit = room->exits[i];
+ const RunawayExit &exit = room->exits[i];
if (exit.action != action)
continue;
const Common::Point entry(exit.x, exit.y);
@@ -437,34 +481,36 @@ void RunawayMuseumScene::execute(uint16 action) {
return;
}
for (uint i = 0; i < room->responseCount; ++i) {
- const MuseumResponse &response = room->responses[i];
+ const RunawayResponse &response = room->responses[i];
if (response.action == action) {
say(response.cue, response.variation);
return;
}
}
for (uint i = 0; i < ARRAYSIZE(kGlobalResponses); ++i) {
- const MuseumResponse &response = kGlobalResponses[i];
+ const RunawayResponse &response = kGlobalResponses[i];
if (response.action == action) {
say(response.cue, response.variation, true);
return;
}
}
- warning("Runaway museum: room %u action %u is not implemented yet", _room, action);
+ warning("Runaway: room %u action %u is not implemented yet", _room, action);
}
-void RunawayMuseumScene::setCameraX(int x) {
- _camera.x = CLIP<int>(x, 0, MAX<int>(0, _background.w - kRunawayScreenWidth));
+void RunawayRoomScene::setCameraX(int x) {
+ _camera.x = CLIP<int>(x, _room == kHospitalBedroom ? 156 : 0, MAX<int>(0, _background.w - kRunawayScreenWidth));
}
-void RunawayMuseumScene::updateCamera() {
+void RunawayRoomScene::updateCamera() {
setCameraX(_position.x - kRunawayScreenWidth / 2);
_camera.y = _room == kMuseumHall && _upperFloor ? 0 :
CLIP<int>(_position.y - 400, _room == kMuseumHall ? 200 : 0, _background.h - kRunawayViewportHeight);
}
-float RunawayMuseumScene::actorHeight() const {
+float RunawayRoomScene::actorHeight() const {
switch (_room) {
+ case kHospitalBedroom:
+ return actorHeight2020();
case kMuseumOffice:
return actorHeight4030();
case kMuseumLaboratory:
@@ -480,7 +526,7 @@ float RunawayMuseumScene::actorHeight() const {
}
}
-void RunawayMuseumScene::update(uint32 now, int scrollDirection, bool inventoryOpen) {
+void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpen) {
_now = now;
const uint elapsed = MIN<uint>(100, now - _lastUpdate);
_lastUpdate = now;
@@ -488,6 +534,8 @@ void RunawayMuseumScene::update(uint32 now, int scrollDirection, bool inventoryO
_pressedKey = 0;
if (speaking() && (int32)(now - _subtitleUntil) >= 0)
skipSpeech();
+ if (_room == kHospitalBedroom)
+ update2020();
if (inventoryOpen || _room == kMuseumKeypad)
return;
if (_pathIndex < _path.size() && !speaking()) {
@@ -517,11 +565,25 @@ void RunawayMuseumScene::update(uint32 now, int scrollDirection, bool inventoryO
}
_position = Common::Point((int)(_x + 0.5f), (int)(_y + 0.5f));
_walkElapsed += elapsed;
+ if (_game == kRunawayFullGame && (!_lastFootstep || _walkElapsed - _lastFootstep >= 360)) {
+ const byte surface = _maps[1280 + _mask[_position.y * _background.w + _position.x]];
+ const byte volume = CLIP<int>((int)(actorHeight() * 255 / 455), 0, 255);
+ if (surface >= 1 && surface <= 7)
+ _audio.playFootstep(surface, _random.getRandomBit(), volume);
+ _lastFootstep = _walkElapsed;
+ }
if (_pathIndex == _path.size())
arrive();
}
const bool walking = _pathIndex < _path.size();
- _actor.setFrame(_facing, walking ? 1 + (_walkElapsed / 60) % 12 : 0);
+ int headFrame = -1;
+ if (_game == kRunawayFullGame) {
+ const bool idle = !walking && !busy();
+ _idleHead.update(now, idle, _lipSync.frameDuration(), _random);
+ if (!walking)
+ headFrame = speaking() ? speechFrame() : idle ? _idleHead.frame() : -1;
+ }
+ _actor.setFrame(_facing, walking ? 1 + (_walkElapsed / 60) % 12 : 0, headFrame);
if (scrollDirection)
setCameraX(_camera.x + scrollDirection * MAX<int>(1, elapsed / (_fastScrolling ? 2 : 4)));
else if (walking)
@@ -531,7 +593,7 @@ void RunawayMuseumScene::update(uint32 now, int scrollDirection, bool inventoryO
_camera.y = CLIP<int>(_position.y - 400, 200, 600);
}
-void RunawayMuseumScene::draw() {
+void RunawayRoomScene::draw() {
_screen.clear();
_screen.copyRectToSurface(_background, 0, kRunawayViewportTop,
Common::Rect(_camera.x, _camera.y, _camera.x + kRunawayScreenWidth, _camera.y + kRunawayViewportHeight));
@@ -540,8 +602,12 @@ void RunawayMuseumScene::draw() {
drawScene4140(viewport);
return;
}
- _ambient.draw(viewport, 0, _camera.x, -_camera.y);
- _overlay.draw(viewport, 0, _camera.x, -_camera.y);
+ if (_room == kHospitalBedroom) {
+ drawScene2020(viewport, false);
+ } else {
+ _ambient.draw(viewport, 0, _camera.x, -_camera.y);
+ _overlay.draw(viewport, 0, _camera.x, -_camera.y);
+ }
RunawayActor::RenderParams params;
memset(params.depthY, 0, sizeof(params.depthY));
switch (_room) {
@@ -565,13 +631,15 @@ void RunawayMuseumScene::draw() {
const byte light = MIN<byte>(9, _maps[768 + _mask[_position.y * _background.w + _position.x]]);
memcpy(params.light, findRoom(_room)->light[light], sizeof(params.light));
_actor.draw(_screen, params, _mask, _maps);
- if (_room == kMuseumOffice)
+ if (_room == kHospitalBedroom)
+ drawScene2020(viewport, true);
+ else if (_room == kMuseumOffice)
drawForeground4030(viewport);
else if (_room == kMuseumLaboratory)
drawForeground4050(viewport);
}
-void RunawayMuseumScene::drawForeground(Graphics::ManagedSurface &viewport, uint layer) {
+void RunawayRoomScene::drawForeground(Graphics::ManagedSurface &viewport, uint layer) {
assert(layer < ARRAYSIZE(_foreground));
for (uint span = 0; span < _foreground[layer].size(); ++span) {
const Common::Rect &rect = _foreground[layer][span];
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index 7bea5cf0d1d..ac60d8a5cd5 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -23,9 +23,11 @@
#define HOLLYWOOD_RUNAWAY_SCENE_H
#include "hollywood/resource.h"
+#include "hollywood/runaway/animation.h"
#include "hollywood/runaway/audio.h"
#include "hollywood/runaway/graphics.h"
#include "hollywood/runaway/inventory.h"
+#include "hollywood/runaway/saveload.h"
#include "hollywood/scene_text_store.h"
namespace Hollywood {
@@ -74,12 +76,12 @@ protected:
};
class RunawayStrings;
-struct MuseumHotspot;
+struct RunawayHotspot;
-// Shared player for the museum demo's numbered scenes.
-class RunawayMuseumScene : public RunawayScene {
+// Shared walking, rendering and interaction for the numbered rooms.
+class RunawayRoomScene : public RunawayScene {
public:
- RunawayMuseumScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings);
+ RunawayRoomScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings, RunawayGameType game);
bool load(uint16 entryScene) override;
void start(uint32 now) override;
void resume() override;
@@ -93,8 +95,9 @@ public:
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _caption; }
const Common::U32String &subtitle() const override { return _subtitle; }
- bool busy() const override { return _pendingHotspot != 0 || _transition.scene || speaking(); }
+ bool busy() const override { return _pendingHotspot != 0 || _transition.scene || _hospitalEntryStep || speaking(); }
bool speaking() const override { return !_subtitle.empty(); }
+ byte speechFrame() const override { return _lipSync.frame(_now); }
void skipSpeech() override;
void sayInventory(const RunawayInventory::Reply &reply) override;
bool canSave() const override { return !busy() && _pathIndex == _path.size() && !_pressedKey; }
@@ -107,7 +110,7 @@ private:
enum ActionResult { kUnhandled, kHandled, kBackgroundChanged };
bool enterRoom(uint16 room, Common::Point position, byte facing);
- bool loadForeground(uint layer, uint chunk);
+ bool loadForeground(uint layer, uint chunk, bool pixels = false);
void drawForeground(Graphics::ManagedSurface &viewport, uint layer);
bool rebuildBackground();
bool applyPatch(uint chunk);
@@ -117,16 +120,25 @@ private:
void execute(uint16 action);
void useItem(byte item, byte hotspot);
void say(uint16 cue, byte variation = 0, bool global = false);
- void queueLine(const Common::U32String &line);
void showLine();
void changeFloor(bool upper, Common::Point position);
void updateCamera();
float actorHeight() const;
- const MuseumHotspot *hotspot(byte id) const;
+ const RunawayHotspot *hotspot(byte id) const;
Common::U32String hotspotName(byte id) const;
byte walkZone() const { return _originalMaps[_mask[_position.y * _background.w + _position.x]]; }
+ bool loadScene2020();
+ bool applyBackground2020();
+ void start2020();
+ void update2020();
+ void updateMaps2020();
+ bool sayInventory2020(const RunawayInventory::Reply &reply);
+ ActionResult execute2020(uint16 action);
+ float actorHeight2020() const;
+ void drawScene2020(Graphics::ManagedSurface &viewport, bool foreground);
+
bool loadScene4030();
bool applyBackground4030();
void updateMaps4030();
@@ -161,6 +173,10 @@ private:
RunawayAudio &_audio;
RunawayInventory &_inventory;
const RunawayStrings &_strings;
+ const RunawayGameType _game;
+ Common::RandomSource _random;
+ RunawayLipSync _lipSync;
+ RunawayIdleHead _idleHead;
ChunkArchive _archive;
SceneTextStore _text;
RunawayActor _actor;
@@ -170,7 +186,12 @@ private:
Common::Array<Common::Rect> _foreground[5];
Common::Array<byte> _keyPatches[25];
Common::Array<Common::Point> _path;
- Common::Array<Common::U32String> _lines;
+ struct SpeechLine {
+ Common::U32String text;
+ uint16 sample;
+ bool global;
+ };
+ Common::Array<SpeechLine> _lines;
Common::U32String _subtitle, _caption;
Common::Point _position, _camera;
uint _pathIndex = 0, _lineIndex = 0;
@@ -184,6 +205,12 @@ private:
bool _varnishTaken = false, _talcTaken = false, _coffeeTaken = false;
byte _keyCount = 0, _pressedKey = 0;
uint32 _keyUntil = 0;
+ uint32 _lastFootstep = 0;
+ RunawaySaveState::Hospital _hospital;
+ Common::Array<byte> _monitorPatches[2];
+ byte _hospitalEntryStep = 0, _ambientFrame = 0, _musicCue = 11;
+ int _ambientDirection = 1;
+ uint32 _ambientTick = 0, _nextMusic = 0;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene2020.cpp b/engines/hollywood/runaway/scene2020.cpp
new file mode 100644
index 00000000000..2ae6a132229
--- /dev/null
+++ b/engines/hollywood/runaway/scene2020.cpp
@@ -0,0 +1,293 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+// RESOURCE.B02; approach points and action IDs from the retail room at 0x444aa0.
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Bathroom door", 1265, 546, 1, {301, 346}, {0, 1}},
+ {"Gina", 1075, 534, 7, {302, 303}, {0, 0}},
+ {"Glass", 846, 453, 1, {304, 305}, {1, 1}},
+ {"Package of pills", 858, 453, 1, {306, 307}, {1, 1}},
+ {"Sheet", 622, 457, 7, {308, 309}, {0, 1}},
+ {"Locker", 417, 444, 7, {310, 311}, {0, 0}},
+ {"Gina's bag", 417, 444, 7, {312, 313}, {0, 1}},
+ {"Window", 265, 456, 7, {314, 332}, {1, 1}},
+ {"Gina's medical chart", 690, 540, 1, {315, 316}, {1, 1}},
+ {"Chart", 453, 455, 1, {317, 318}, {1, 1}},
+ {"Fake patient", 687, 448, 7, {319, 320}, {0, 1}},
+ {"Fire sprinkler", 459, 473, 7, {321, 322}, {0, 0}},
+ {"Buzzer", 846, 453, 7, {323, 324}, {0, 0}},
+ {"Buzzer", 712, 445, 3, {323, 324}, {0, 0}},
+ {"Radiator", 265, 456, 7, {325, 326}, {0, 0}},
+ {"Poster", 713, 533, 1, {327, 328}, {0, 0}},
+ {"Poster", 454, 455, 1, {329, 328}, {0, 0}},
+ {"Emergency exit map", 1265, 546, 1, {330, 331}, {1, 0}},
+ {"Bed", 404, 456, 1, {344, 345}, {0, 0}},
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Hallway door", 40, 599, 5, {351, 352}, {1, 0}},
+};
+
+const RunawayResponse kResponses[] = {
+ {kHospitalBedroom, 301, 1, 0},
+ {kHospitalBedroom, 304, 4, 0},
+ {kHospitalBedroom, 306, 5, 0},
+ {kHospitalBedroom, 308, 6, 0},
+ {kHospitalBedroom, 310, 7, 0},
+ {kHospitalBedroom, 311, 8, 0},
+ {kHospitalBedroom, 312, 9, 0},
+ {kHospitalBedroom, 314, 10, 0},
+ {kHospitalBedroom, 315, 11, 0},
+ {kHospitalBedroom, 316, 12, 0},
+ {kHospitalBedroom, 317, 13, 0},
+ {kHospitalBedroom, 318, 14, 0},
+ {kHospitalBedroom, 319, 15, 0},
+ {kHospitalBedroom, 320, 16, 0},
+ {kHospitalBedroom, 321, 17, 0},
+ {kHospitalBedroom, 322, 18, 0},
+ {kHospitalBedroom, 323, 19, 0},
+ {kHospitalBedroom, 324, 20, 0},
+ {kHospitalBedroom, 325, 21, 0},
+ {kHospitalBedroom, 326, 22, 0},
+ {kHospitalBedroom, 327, 23, 0},
+ {kHospitalBedroom, 328, 24, 0},
+ {kHospitalBedroom, 329, 25, 0},
+ {kHospitalBedroom, 331, 27, 0},
+ {kHospitalBedroom, 333, 29, 0},
+ {kHospitalBedroom, 343, 37, 1},
+ {kHospitalBedroom, 344, 39, 0},
+ {kHospitalBedroom, 345, 40, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {kHospitalBedroom, 5, 6, 333}, // Bag in the locker.
+ {kHospitalBedroom, 9, 12, 343}, // Matches at the sprinkler.
+ {kHospitalBedroom, 13, 2, 349}, // Water for Gina.
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene2020 = {
+ kHospitalBedroom, 1520, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {60, 60, 80}, {80, 80, 100}},
+ Common::Point(1075, 534),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+bool RunawayRoomScene::loadScene2020() {
+ return loadForeground(0, 12) && loadForeground(1, 14) && loadForeground(2, 11, true) &&
+ _ambient.load(_archive, 22, 19) && _overlay.load(_archive, 17, 1) &&
+ _archive.readVariableChunk(20, _monitorPatches[0]) && _archive.readVariableChunk(21, _monitorPatches[1]);
+}
+
+void RunawayRoomScene::start2020() {
+ for (byte item = 1; item <= 4; ++item)
+ _inventory.add(item);
+ _inventory.takeNewItem();
+ _facing = 7;
+ _hospitalEntryStep = 1;
+ say(0);
+}
+
+bool RunawayRoomScene::applyBackground2020() {
+ if ((_hospital.glassTaken && !applyPatch(8)) || (_hospital.pillsTaken && !applyPatch(9)) ||
+ (_hospital.sheetTaken && !applyPatch(7)) || (_hospital.bagTaken && !applyPatch(6)))
+ return false;
+ return applyPatch(11) && applyRunawayPatch(_monitorPatches[1], _background) &&
+ applyRunawayPatch(_monitorPatches[0], _background);
+}
+
+void RunawayRoomScene::updateMaps2020() {
+ for (uint i = 0; i < 256; ++i) {
+ // Zones 5/6 are reserved for scripted movement, not normal walking.
+ if (_maps[i] > 4)
+ _maps[i] = 0;
+ byte &id = _maps[256 + i];
+ if ((_hospital.glassTaken && id == 3) || (_hospital.pillsTaken && id == 4) ||
+ (_hospital.bagTaken && id == 7) || id == 11)
+ id = 0;
+ else if (id == 5 || id == 21)
+ id = _hospital.sheetTaken ? 19 : 5;
+ else if (id == 20)
+ id = 19;
+ }
+}
+
+bool RunawayRoomScene::sayInventory2020(const RunawayInventory::Reply &reply) {
+ if (reply.cue != 54)
+ return false;
+ // Searching Gina's bag reveals the matches on the first examination.
+ say(54, 1, true);
+ if (_inventory.contains(9)) {
+ say(54, _random.getRandomBit() ? 3 : 5, true);
+ } else {
+ _inventory.add(9);
+ say(54, 2, true);
+ }
+ return true;
+}
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
+ switch (action) {
+ case 302:
+ say(2, _random.getRandomNumber(2));
+ return kHandled;
+ case 303:
+ say(3, _random.getRandomBit());
+ return kHandled;
+ case 305:
+ _hospital.glassTaken = 1;
+ _inventory.add(13);
+ _facing = 4;
+ say(62, 0, true);
+ return kBackgroundChanged;
+ case 307:
+ _hospital.pillsTaken = 1;
+ _inventory.add(8);
+ _facing = 4;
+ say(57, 0, true);
+ return kBackgroundChanged;
+ case 309:
+ _hospital.sheetTaken = 1;
+ _inventory.add(7);
+ _facing = 4;
+ say(18, _random.getRandomNumber(2), true);
+ return kBackgroundChanged;
+ case 313:
+ _hospital.bagTaken = 1;
+ _inventory.add(5);
+ _facing = 6;
+ say(9, 1);
+ return kBackgroundChanged;
+ case 330:
+ if (!_hospital.exitMapRead)
+ say(26);
+ say(26, 1);
+ _hospital.exitMapRead = 1;
+ return kHandled;
+ case 332:
+ if (!_hospital.exitMapRead) {
+ say(28);
+ return kHandled;
+ }
+ // The ledge (2060) and bathroom (2080) have separate scene scripts.
+ warning("Runaway: hospital ledge scene 2060 is not implemented yet");
+ return kHandled;
+ case 346:
+ warning("Runaway: hospital bathroom scene 2080 is not implemented yet");
+ return kHandled;
+ case 349:
+ say(4, 0, true);
+ return kHandled;
+ case 351:
+ warning("Runaway: hospital hallway sequence is not implemented yet");
+ return kHandled;
+ case 352:
+ say(42, _random.getRandomBit());
+ return kHandled;
+ default:
+ return kUnhandled;
+ }
+}
+
+float RunawayRoomScene::actorHeight2020() const {
+ // The original switches perspective planes at x = 864 (0x443be0).
+ return _position.x < 864 ? _position.y * 1.26388884f - 302.069458f :
+ _position.y * 0.44444445f + 188.777771f;
+}
+
+void RunawayRoomScene::update2020() {
+ if (_hospitalEntryStep && !speaking() && _pathIndex == _path.size()) {
+ switch (_hospitalEntryStep++) {
+ case 1:
+ _facing = 4;
+ say(0, 1);
+ break;
+ case 2:
+ walkTo(Common::Point(1075, 599));
+ break;
+ case 3:
+ say(0, 2);
+ break;
+ case 4:
+ _facing = 3;
+ say(0, 3);
+ break;
+ default:
+ _hospitalEntryStep = 0;
+ break;
+ }
+ }
+ if (_now - _ambientTick >= 80) {
+ _ambientTick = _now;
+ if ((_ambientFrame > 0 && _ambientFrame < 18) || !_random.getRandomNumber(49)) {
+ _ambientFrame += _ambientDirection;
+ if (_ambientFrame == 18 || _ambientFrame == 0)
+ _ambientDirection = -_ambientDirection;
+ }
+ }
+ // The bedside indicator alternates after 17 and 9 animation ticks.
+ applyRunawayPatch(_monitorPatches[(_now / 80) % 26 >= 17], _background);
+ if (!_audio.musicPlaying()) {
+ if (!_nextMusic) {
+ static const uint16 delays[] = {0, 240, 120, 60};
+ _nextMusic = _now + delays[_random.getRandomNumber(3)] * 250;
+ }
+ if ((int32)(_now - _nextMusic) >= 0) {
+ byte cue;
+ do {
+ cue = 12 + _random.getRandomNumber(3);
+ } while (cue == _musicCue);
+ _musicCue = cue;
+ _audio.playMusic(cue, false);
+ _nextMusic = 0;
+ }
+ }
+}
+
+void RunawayRoomScene::drawScene2020(Graphics::ManagedSurface &viewport, bool foreground) {
+ // Gina and the near bed occlude Brian only when he is behind them.
+ if (foreground == (_position.y < 503)) {
+ _ambient.draw(viewport, _ambientFrame, _camera.x, 0);
+ drawForeground(viewport, 2);
+ _overlay.draw(viewport, 0, _camera.x, 0);
+ }
+ if (foreground) {
+ if (_position.x < 600 && _position.y < 434)
+ drawForeground(viewport, 1);
+ if (_position.x > 1000)
+ drawForeground(viewport, 0);
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4030.cpp b/engines/hollywood/runaway/scene4030.cpp
index 4f71cecdad1..555fb5a460c 100644
--- a/engines/hollywood/runaway/scene4030.cpp
+++ b/engines/hollywood/runaway/scene4030.cpp
@@ -26,7 +26,7 @@
namespace Hollywood {
namespace {
-const MuseumHotspot kHotspots[] = {
+const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Door", 1165, 594, 2, {322, 301}, {0, 0}},
{"Pair of books", 355, 595, 1, {302, 303}, {0, 1}},
@@ -40,7 +40,7 @@ const MuseumHotspot kHotspots[] = {
{"Window", 369, 499, 7, {317, 318}, {1, 0}},
};
-const MuseumResponse kResponses[] = {
+const RunawayResponse kResponses[] = {
{kMuseumOffice, 305, 4, 0},
{kMuseumOffice, 306, 5, 0},
{kMuseumOffice, 307, 6, 0},
@@ -57,18 +57,18 @@ const MuseumResponse kResponses[] = {
{kMuseumOffice, 322, 22, 0},
};
-const MuseumItemAction kItemActions[] = {
+const RunawayItemAction kItemActions[] = {
{kMuseumOffice, 17, 3, 321},
{kMuseumOffice, 0, 3, 320},
};
-const MuseumExit kExits[] = {
+const RunawayExit kExits[] = {
{kMuseumOffice, 301, kMuseumHall, 607, 323, true, true},
};
} // End of anonymous namespace
-const MuseumRoom kRunawayScene4030 = {
+const RunawayRoom kRunawayScene4030 = {
kMuseumOffice, 1200, 670, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {50, 50, 50}, {80, 80, 60}},
Common::Point(934, 563),
kResponses, ARRAYSIZE(kResponses),
@@ -76,7 +76,7 @@ const MuseumRoom kRunawayScene4030 = {
kExits, ARRAYSIZE(kExits)
};
-void RunawayMuseumScene::updateMaps4030() {
+void RunawayRoomScene::updateMaps4030() {
for (uint i = 0; i < 256; ++i) {
byte &id = _maps[256 + i];
if (_books != kTaken && (id == 2 || id == 3))
@@ -92,7 +92,7 @@ void RunawayMuseumScene::updateMaps4030() {
}
}
-Common::U32String RunawayMuseumScene::hotspotName4030(byte id) const {
+Common::U32String RunawayRoomScene::hotspotName4030(byte id) const {
if (id == 2 && _books != kUnexamined)
return _inventory.name(16);
if (id == 5)
@@ -102,7 +102,7 @@ Common::U32String RunawayMuseumScene::hotspotName4030(byte id) const {
return Common::U32String(hotspot(id)->name);
}
-RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4030(uint16 action) {
+RunawayRoomScene::ActionResult RunawayRoomScene::execute4030(uint16 action) {
if (action == 301 && _safeOpen) {
say(21);
return kHandled;
@@ -150,17 +150,17 @@ RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4030(uint16 action)
return kUnhandled;
}
-float RunawayMuseumScene::actorHeight4030() const {
+float RunawayRoomScene::actorHeight4030() const {
const int x = _position.x, y = _position.y;
return x < 459 ? y * 0.369863f + 208.301376f : y * 0.516304f + 110.625f;
}
-bool RunawayMuseumScene::loadScene4030() {
+bool RunawayRoomScene::loadScene4030() {
return loadForeground(0, 4) && loadForeground(1, 5) && loadForeground(2, 6) &&
loadForeground(3, 7) && loadForeground(4, 12);
}
-bool RunawayMuseumScene::applyBackground4030() {
+bool RunawayRoomScene::applyBackground4030() {
if (_books == kTaken && !applyPatch(8))
return false;
if (!_safe.load(_archive, _recorder == kTaken ? 15 : 14, 13))
@@ -169,7 +169,7 @@ bool RunawayMuseumScene::applyBackground4030() {
return true;
}
-void RunawayMuseumScene::drawForeground4030(Graphics::ManagedSurface &viewport) {
+void RunawayRoomScene::drawForeground4030(Graphics::ManagedSurface &viewport) {
const byte zone = walkZone();
if (zone == 3)
drawForeground(viewport, 0);
diff --git a/engines/hollywood/runaway/scene4050.cpp b/engines/hollywood/runaway/scene4050.cpp
index bc2953b37d5..64daef3144f 100644
--- a/engines/hollywood/runaway/scene4050.cpp
+++ b/engines/hollywood/runaway/scene4050.cpp
@@ -26,7 +26,7 @@
namespace Hollywood {
namespace {
-const MuseumHotspot kHotspots[] = {
+const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Door", 227, 503, 7, {301, 339}, {0, 1}},
{"Shelves", 311, 493, 7, {302, 303}, {0, 0}},
@@ -44,7 +44,7 @@ const MuseumHotspot kHotspots[] = {
{"Strange brush", 824, 531, 7, {337, 338}, {1, 1}},
};
-const MuseumResponse kResponses[] = {
+const RunawayResponse kResponses[] = {
{kMuseumLaboratory, 301, 1, 0},
{kMuseumLaboratory, 306, 6, 0},
{kMuseumLaboratory, 307, 7, 0},
@@ -66,7 +66,7 @@ const MuseumResponse kResponses[] = {
{kMuseumLaboratory, 337, 31, 0},
};
-const MuseumItemAction kItemActions[] = {
+const RunawayItemAction kItemActions[] = {
{kMuseumLaboratory, 7, 2, 326},
{kMuseumLaboratory, 0, 2, 15},
{kMuseumLaboratory, 5, 3, 328},
@@ -85,13 +85,13 @@ const MuseumItemAction kItemActions[] = {
{kMuseumLaboratory, 0, 11, 15},
};
-const MuseumExit kExits[] = {
+const RunawayExit kExits[] = {
{kMuseumLaboratory, 339, kMuseumHall, 873, 311, true, true},
};
} // End of anonymous namespace
-const MuseumRoom kRunawayScene4050 = {
+const RunawayRoom kRunawayScene4050 = {
kMuseumLaboratory, 1552, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {60, 60, 70}, {70, 70, 80}, {60, 60, 70}},
Common::Point(382, 529),
kResponses, ARRAYSIZE(kResponses),
@@ -99,7 +99,7 @@ const MuseumRoom kRunawayScene4050 = {
kExits, ARRAYSIZE(kExits)
};
-void RunawayMuseumScene::updateMaps4050() {
+void RunawayRoomScene::updateMaps4050() {
for (uint i = 0; i < 256; ++i) {
byte &id = _maps[256 + i];
if (id == 4 || id == 15 || id == 19 || (_talcTaken && id == 14))
@@ -113,7 +113,7 @@ void RunawayMuseumScene::updateMaps4050() {
}
}
-RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4050(uint16 action) {
+RunawayRoomScene::ActionResult RunawayRoomScene::execute4050(uint16 action) {
switch (action) {
case 323: // Take the varnish from the briefcase.
if (_varnishTaken) {
@@ -136,7 +136,7 @@ RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4050(uint16 action)
return kUnhandled;
}
-float RunawayMuseumScene::actorHeight4050() const {
+float RunawayRoomScene::actorHeight4050() const {
const int x = _position.x, y = _position.y;
const byte zone = walkZone();
if (zone == 4)
@@ -154,16 +154,16 @@ float RunawayMuseumScene::actorHeight4050() const {
return MIN(y, 587) * 0.8181818f - 82.272728f;
}
-bool RunawayMuseumScene::loadScene4050() {
+bool RunawayRoomScene::loadScene4050() {
return _ambient.load(_archive, 8, 75) && _overlay.load(_archive, 22, 1) &&
loadForeground(0, 4) && loadForeground(1, 5) && loadForeground(2, 6) && loadForeground(3, 7);
}
-bool RunawayMuseumScene::applyBackground4050() {
+bool RunawayRoomScene::applyBackground4050() {
return !_talcTaken || applyPatch(11);
}
-void RunawayMuseumScene::drawForeground4050(Graphics::ManagedSurface &viewport) {
+void RunawayRoomScene::drawForeground4050(Graphics::ManagedSurface &viewport) {
if (_position.x > 1200)
drawForeground(viewport, 0);
if (_position.x > 789 && _position.x < 846 && _position.y < 541)
diff --git a/engines/hollywood/runaway/scene4060.cpp b/engines/hollywood/runaway/scene4060.cpp
index 530581d0b04..29ccf98a42c 100644
--- a/engines/hollywood/runaway/scene4060.cpp
+++ b/engines/hollywood/runaway/scene4060.cpp
@@ -26,7 +26,7 @@
namespace Hollywood {
namespace {
-const MuseumHotspot kHotspots[] = {
+const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Stairs", -25, 319, 7, {301, 302}, {0, 1}},
{"Coffee machines", 218, 379, 7, {321, 322}, {1, 1}},
@@ -47,7 +47,7 @@ const MuseumHotspot kHotspots[] = {
{"Plaque", 1060, 730, 7, {330, 331}, {1, 0}},
};
-const MuseumResponse kResponses[] = {
+const RunawayResponse kResponses[] = {
{kMuseumHall, 301, 1, 0},
{kMuseumHall, 304, 2, 0},
{kMuseumHall, 309, 4, 0},
@@ -76,7 +76,7 @@ const MuseumResponse kResponses[] = {
{kMuseumHall, 344, 35, 0},
};
-const MuseumItemAction kItemActions[] = {
+const RunawayItemAction kItemActions[] = {
{kMuseumHall, 19, 2, 346},
{kMuseumHall, 0, 5, 19},
{kMuseumHall, 9, 8, 337},
@@ -102,7 +102,7 @@ const MuseumItemAction kItemActions[] = {
{kMuseumHall, 19, 14, 345},
};
-const MuseumExit kExits[] = {
+const RunawayExit kExits[] = {
{kMuseumHall, 302, kMuseumHall, 533, 848, false, false},
{kMuseumHall, 303, kMuseumHall, 1169, 643, false, false},
{kMuseumHall, 305, kMuseumHall, 69, 372, true, false},
@@ -115,7 +115,7 @@ const MuseumExit kExits[] = {
} // End of anonymous namespace
-const MuseumRoom kRunawayScene4060 = {
+const RunawayRoom kRunawayScene4060 = {
kMuseumHall, 1760, 1200, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {40, 40, 40}, {30, 30, 30}, {60, 60, 60}, {30, 30, 30}, {70, 70, 70}, {20, 20, 25}, {50, 50, 50}, {60, 60, 70}, {70, 70, 80}},
Common::Point(873, 311),
kResponses, ARRAYSIZE(kResponses),
@@ -123,7 +123,7 @@ const MuseumRoom kRunawayScene4060 = {
kExits, ARRAYSIZE(kExits)
};
-void RunawayMuseumScene::updateMaps4060() {
+void RunawayRoomScene::updateMaps4060() {
for (uint i = 0; i < 256; ++i) {
byte &id = _maps[256 + i];
// Both floors share the image and mask, but have separate walk zones and hotspots.
@@ -135,7 +135,7 @@ void RunawayMuseumScene::updateMaps4060() {
}
}
-void RunawayMuseumScene::changeFloor(bool upper, Common::Point position) {
+void RunawayRoomScene::changeFloor(bool upper, Common::Point position) {
_upperFloor = upper;
_position = position;
_x = position.x;
@@ -145,7 +145,7 @@ void RunawayMuseumScene::changeFloor(bool upper, Common::Point position) {
updateCamera();
}
-RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4060(uint16 action) {
+RunawayRoomScene::ActionResult RunawayRoomScene::execute4060(uint16 action) {
if (action != 313)
return kUnhandled;
if (_coffeeTaken) {
@@ -159,7 +159,7 @@ RunawayMuseumScene::ActionResult RunawayMuseumScene::execute4060(uint16 action)
return kHandled;
}
-float RunawayMuseumScene::actorHeight4060() const {
+float RunawayRoomScene::actorHeight4060() const {
const int x = _position.x, y = _position.y;
const byte zone = walkZone();
if (_upperFloor) {
@@ -178,7 +178,7 @@ float RunawayMuseumScene::actorHeight4060() const {
return (y * 0.4347826f - 118.695656f + x * -0.08982036f + 258.263458f) / 2;
}
-void RunawayMuseumScene::setupDepth4060(RunawayActor::RenderParams ¶ms) const {
+void RunawayRoomScene::setupDepth4060(RunawayActor::RenderParams ¶ms) const {
const byte zone = walkZone();
params.depthY[1] = 1199;
params.depthY[2] = zone == 1 ? 1199 : 0;
@@ -187,7 +187,7 @@ void RunawayMuseumScene::setupDepth4060(RunawayActor::RenderParams ¶ms) cons
params.depthY[5] = zone == 17 || zone == 18 ? 1199 : 0;
}
-bool RunawayMuseumScene::loadScene4060() {
+bool RunawayRoomScene::loadScene4060() {
return _ambient.load(_archive, 8, 22);
}
diff --git a/engines/hollywood/runaway/scene4090.cpp b/engines/hollywood/runaway/scene4090.cpp
index 4f2544f8e41..39856634cd4 100644
--- a/engines/hollywood/runaway/scene4090.cpp
+++ b/engines/hollywood/runaway/scene4090.cpp
@@ -26,7 +26,7 @@
namespace Hollywood {
namespace {
-const MuseumHotspot kHotspots[] = {
+const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Exhibition hall", 1100, 204, 1, {302, 301}, {0, 3}},
{"Statue", 826, 442, 3, {303, 304}, {1, 0}},
@@ -39,7 +39,7 @@ const MuseumHotspot kHotspots[] = {
{"Mayan object", 316, 382, 7, {317, 318}, {1, 0}},
};
-const MuseumResponse kResponses[] = {
+const RunawayResponse kResponses[] = {
{kMuseumExhibition, 302, 1, 0},
{kMuseumExhibition, 303, 2, 0},
{kMuseumExhibition, 304, 3, 0},
@@ -58,13 +58,13 @@ const MuseumResponse kResponses[] = {
{kMuseumExhibition, 318, 11, 0},
};
-const MuseumExit kExits[] = {
+const RunawayExit kExits[] = {
{kMuseumExhibition, 301, kMuseumHall, 1400, 600, false, false},
};
} // End of anonymous namespace
-const MuseumRoom kRunawayScene4090 = {
+const RunawayRoom kRunawayScene4090 = {
kMuseumExhibition, 1124, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {70, 70, 90}, {60, 60, 80}, {50, 50, 70}},
Common::Point(881, 392),
kResponses, ARRAYSIZE(kResponses),
@@ -72,12 +72,12 @@ const MuseumRoom kRunawayScene4090 = {
kExits, ARRAYSIZE(kExits)
};
-float RunawayMuseumScene::actorHeight4090() const {
+float RunawayRoomScene::actorHeight4090() const {
const int y = _position.y;
return MIN(y, 390) * 0.2f + 122;
}
-void RunawayMuseumScene::setupDepth4090(RunawayActor::RenderParams ¶ms) const {
+void RunawayRoomScene::setupDepth4090(RunawayActor::RenderParams ¶ms) const {
params.depthY[1] = 599;
params.depthY[2] = 374;
}
diff --git a/engines/hollywood/runaway/scene4100.cpp b/engines/hollywood/runaway/scene4100.cpp
index 08d4422b0ef..cd7bafcea8d 100644
--- a/engines/hollywood/runaway/scene4100.cpp
+++ b/engines/hollywood/runaway/scene4100.cpp
@@ -26,7 +26,7 @@
namespace Hollywood {
namespace {
-const MuseumHotspot kHotspots[] = {
+const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Door", 141, 468, 7, {301, 302}, {0, 1}},
{"First aid kit", 196, 451, 1, {303, 304}, {0, 0}},
@@ -40,7 +40,7 @@ const MuseumHotspot kHotspots[] = {
{"Ladel", 1329, 409, 1, {328, 329}, {0, 1}},
};
-const MuseumResponse kResponses[] = {
+const RunawayResponse kResponses[] = {
{kMuseumSecurity, 301, 1, 0},
{kMuseumSecurity, 303, 2, 0},
{kMuseumSecurity, 304, 3, 0},
@@ -57,7 +57,7 @@ const MuseumResponse kResponses[] = {
{kMuseumSecurity, 328, 26, 0},
};
-const MuseumItemAction kItemActions[] = {
+const RunawayItemAction kItemActions[] = {
{kMuseumSecurity, 5, 3, 321},
{kMuseumSecurity, 11, 3, 320},
{kMuseumSecurity, 0, 3, 319},
@@ -71,13 +71,13 @@ const MuseumItemAction kItemActions[] = {
{kMuseumSecurity, 0, 9, 326},
};
-const MuseumExit kExits[] = {
+const RunawayExit kExits[] = {
{kMuseumSecurity, 302, kMuseumHall, 1118, 309, true, false}
};
} // End of anonymous namespace
-const MuseumRoom kRunawayScene4100 = {
+const RunawayRoom kRunawayScene4100 = {
kMuseumSecurity, 1536, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {40, 40, 60}, {30, 30, 50}, {20, 20, 40}},
Common::Point(141, 468),
kResponses, ARRAYSIZE(kResponses),
@@ -85,7 +85,7 @@ const MuseumRoom kRunawayScene4100 = {
kExits, ARRAYSIZE(kExits)
};
-float RunawayMuseumScene::actorHeight4100() const {
+float RunawayRoomScene::actorHeight4100() const {
const int x = _position.x, y = _position.y;
if (x > 1260)
return MIN(y, 545) * 1.2807018f - 242.982452f;
@@ -94,7 +94,7 @@ float RunawayMuseumScene::actorHeight4100() const {
return MIN(y, 545) * 0.9381443f - 56.288658f;
}
-void RunawayMuseumScene::setupDepth4100(RunawayActor::RenderParams ¶ms) const {
+void RunawayRoomScene::setupDepth4100(RunawayActor::RenderParams ¶ms) const {
params.depthY[1] = 599;
params.depthY[2] = 477;
}
diff --git a/engines/hollywood/runaway/scene4140.cpp b/engines/hollywood/runaway/scene4140.cpp
index 0348fb6d011..d6603bfc522 100644
--- a/engines/hollywood/runaway/scene4140.cpp
+++ b/engines/hollywood/runaway/scene4140.cpp
@@ -26,7 +26,7 @@
namespace Hollywood {
-const MuseumRoom kRunawayScene4140 = {
+const RunawayRoom kRunawayScene4140 = {
kMuseumKeypad, 1024, 600, nullptr, 0, {},
Common::Point(382, 529),
nullptr, 0,
@@ -34,7 +34,7 @@ const MuseumRoom kRunawayScene4140 = {
nullptr, 0
};
-void RunawayMuseumScene::clickScene4140(byte id) {
+void RunawayRoomScene::clickScene4140(byte id) {
_pressedKey = id;
_keyUntil = _now + 180;
if (!id) {
@@ -55,7 +55,7 @@ void RunawayMuseumScene::clickScene4140(byte id) {
}
}
-void RunawayMuseumScene::drawScene4140(Graphics::ManagedSurface &viewport) {
+void RunawayRoomScene::drawScene4140(Graphics::ManagedSurface &viewport) {
bool valid = applyRunawayPatch(_keyPatches[15], viewport);
for (uint i = 0; valid && i < _keyCount; ++i)
valid = applyRunawayPatch(_keyPatches[21 + i], viewport);
@@ -65,7 +65,7 @@ void RunawayMuseumScene::drawScene4140(Graphics::ManagedSurface &viewport) {
error("Invalid museum keypad image");
}
-bool RunawayMuseumScene::loadScene4140() {
+bool RunawayRoomScene::loadScene4140() {
for (uint i = 3; i < ARRAYSIZE(_keyPatches); ++i) {
if (!_archive.readVariableChunk(i, _keyPatches[i]))
return false;
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
index 2b7c8b8334d..cdb1d82f993 100644
--- a/engines/hollywood/runaway/scene_data.h
+++ b/engines/hollywood/runaway/scene_data.h
@@ -26,7 +26,8 @@
namespace Hollywood {
-enum MuseumRoomId {
+enum RunawayRoomId {
+ kHospitalBedroom = 2020,
kMuseumOffice = 4030,
kMuseumLaboratory = 4050,
kMuseumHall = 4060,
@@ -35,7 +36,7 @@ enum MuseumRoomId {
kMuseumKeypad = 4140
};
-struct MuseumHotspot {
+struct RunawayHotspot {
const char *name;
int16 x, y;
byte facing;
@@ -43,46 +44,47 @@ struct MuseumHotspot {
byte approach[2];
};
-struct MuseumItemAction {
+struct RunawayItemAction {
uint16 room;
byte item, hotspot;
uint16 action;
};
-struct MuseumResponse {
+struct RunawayResponse {
uint16 room, action, cue;
byte variation;
};
-struct MuseumExit {
+struct RunawayExit {
uint16 room, action, destination;
int16 x, y;
bool upperFloor;
bool door;
};
-struct MuseumRoom {
+struct RunawayRoom {
uint16 number, width, height;
- const MuseumHotspot *hotspots;
+ const RunawayHotspot *hotspots;
uint hotspotCount;
byte light[10][3];
Common::Point entry;
- const MuseumResponse *responses;
+ const RunawayResponse *responses;
uint responseCount;
- const MuseumItemAction *itemActions;
+ const RunawayItemAction *itemActions;
uint itemActionCount;
- const MuseumExit *exits;
+ const RunawayExit *exits;
uint exitCount;
};
-extern const MuseumRoom kRunawayScene4030;
-extern const MuseumRoom kRunawayScene4050;
-extern const MuseumRoom kRunawayScene4060;
-extern const MuseumRoom kRunawayScene4090;
-extern const MuseumRoom kRunawayScene4100;
-extern const MuseumRoom kRunawayScene4140;
+extern const RunawayRoom kRunawayScene2020;
+extern const RunawayRoom kRunawayScene4030;
+extern const RunawayRoom kRunawayScene4050;
+extern const RunawayRoom kRunawayScene4060;
+extern const RunawayRoom kRunawayScene4090;
+extern const RunawayRoom kRunawayScene4100;
+extern const RunawayRoom kRunawayScene4140;
-const MuseumRoom *findRunawayMuseumRoom(uint16 number);
+const RunawayRoom *findRunawayRoom(uint16 number);
} // End of namespace Hollywood
Commit: cce0f9edd93992caf363bb9cc413e41ca92adba9
https://github.com/scummvm/scummvm/commit/cce0f9edd93992caf363bb9cc413e41ca92adba9
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: implemented scene 2010 and 2080
Changed paths:
A engines/hollywood/runaway/scene2010.cpp
A engines/hollywood/runaway/scene2010.h
A engines/hollywood/runaway/scene2080.cpp
engines/hollywood/module.mk
engines/hollywood/runaway/audio.cpp
engines/hollywood/runaway/audio.h
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/graphics.cpp
engines/hollywood/runaway/graphics.h
engines/hollywood/runaway/intro.cpp
engines/hollywood/runaway/intro.h
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/inventory.h
engines/hollywood/runaway/presentation.cpp
engines/hollywood/runaway/presentation.h
engines/hollywood/runaway/saveload.cpp
engines/hollywood/runaway/saveload.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene2020.cpp
engines/hollywood/runaway/scene_data.h
engines/hollywood/runaway/ui.cpp
engines/hollywood/runaway/ui.h
engines/hollywood/runaway/video.cpp
engines/hollywood/runaway/video.h
diff --git a/engines/hollywood/module.mk b/engines/hollywood/module.mk
index dee8cb92cc4..d5c0d381e2e 100644
--- a/engines/hollywood/module.mk
+++ b/engines/hollywood/module.mk
@@ -150,7 +150,9 @@ MODULE_OBJS = \
runaway/presentation.o \
runaway/saveload.o \
runaway/scene.o \
+ runaway/scene2010.o \
runaway/scene2020.o \
+ runaway/scene2080.o \
runaway/scene4030.o \
runaway/scene4050.o \
runaway/scene4060.o \
diff --git a/engines/hollywood/runaway/audio.cpp b/engines/hollywood/runaway/audio.cpp
index 2489ef918e0..17eaca452b2 100644
--- a/engines/hollywood/runaway/audio.cpp
+++ b/engines/hollywood/runaway/audio.cpp
@@ -89,10 +89,11 @@ uint32 RunawayAudio::play(const char *archive, uint16 cue, uint tableCount, bool
return duration;
}
-void RunawayAudio::playIntroMusic() {
+void RunawayAudio::playIntroMusic(uint16 cue) {
// The Pendulo logo uses RESOURCE.002 cue 2 on native channel 7, which
// has the same 16 kHz stereo PCM format as the room music channels.
- play("RESOURCE.002", 2, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
+ // Cue 4 accompanies the retail narrator's montage.
+ play("RESOURCE.002", cue, 100, false, Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_STEREO,
Audio::Mixer::kMusicSoundType, _music, Audio::Mixer::kMaxChannelVolume, false, 16000);
}
diff --git a/engines/hollywood/runaway/audio.h b/engines/hollywood/runaway/audio.h
index 8c562c35141..66720687e6b 100644
--- a/engines/hollywood/runaway/audio.h
+++ b/engines/hollywood/runaway/audio.h
@@ -32,7 +32,7 @@ public:
~RunawayAudio();
void setMuseum(bool museum) { _museum = museum; }
void setChapter(byte chapter);
- void playIntroMusic();
+ void playIntroMusic(uint16 cue = 2);
uint32 playMusic(uint16 cue, bool loop = true);
void setMusicVolume(byte volume);
uint32 playSpeech(uint16 sample, bool global = false);
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index 599a057bbdc..7066e99edaa 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -163,7 +163,7 @@ Common::Error RunawayEngine::loadGameStream(Common::SeekableReadStream *stream)
RunawayScene *RunawayEngine::createScene(uint16 entryScene) {
if (findRunawayRoom(entryScene) && ((_museum && entryScene >= 4000) ||
- (_game == kRunawayFullGame && entryScene == kHospitalBedroom)))
+ (_game == kRunawayFullGame && (entryScene == 2020 || entryScene == 2021 || entryScene == 2080))))
return new RunawayRoomScene(_audio, *_inventory, _strings, _game);
if (_game == kRunawayCabinDemo && entryScene == 5030)
return new RunawayScene5030(_mixer, _audio, *_inventory, _strings);
@@ -185,7 +185,8 @@ Common::Error RunawayEngine::changeScene() {
state.x = transition.position.x;
state.y = transition.position.y;
state.facing = transition.facing;
- state.camera = state.cameraY = 0;
+ state.camera = state.scene == 2021 ? 156 : 0;
+ state.cameraY = 0;
Common::ScopedPtr<RunawayScene> scene(createScene(state.scene));
if (!scene)
return Common::Error(Common::kUnsupportedGameidError,
@@ -254,8 +255,10 @@ Common::Error RunawayEngine::playIntro(RunawayMenu &menu) {
_inPresentation = true;
_loadedGame = false;
RunawayIntro intro(_mixer);
- if (!intro.load())
- return Common::Error(Common::kReadingFailed, "Cannot load the Runaway demo logo or story card");
+ if (!intro.load(_game == kRunawayFullGame)) {
+ _inPresentation = false;
+ return Common::Error(Common::kReadingFailed, "Cannot load the Runaway opening resources");
+ }
const bool cursorWasVisible = CursorMan.showMouse(false);
intro.start(getTotalPlayTime());
intro.draw();
@@ -283,12 +286,16 @@ Common::Error RunawayEngine::playIntro(RunawayMenu &menu) {
if (skip)
intro.skip(now);
intro.draw();
+ if (!ConfMan.hasKey("subtitles") || ConfMan.getBool("subtitles") || ConfMan.getBool("speech_mute"))
+ _ui->drawSubtitle(intro.screen(), intro.subtitle());
const Graphics::ManagedSurface &screen = intro.screen();
present(screen);
_system->delayMillis(10);
}
CursorMan.showMouse(cursorWasVisible);
_inPresentation = false;
+ if (intro.failed())
+ return Common::Error(Common::kReadingFailed, "Cannot play the Runaway opening sequence");
return Common::kNoError;
}
@@ -318,7 +325,7 @@ Common::Error RunawayEngine::run() {
const Common::Error result = loadGameState(ConfMan.getInt("save_slot"));
if (result.getCode() != Common::kNoError)
return result;
- } else if (_game == kRunawayCabinDemo) {
+ } else if (_game == kRunawayCabinDemo || _game == kRunawayFullGame) {
const Common::Error result = playIntro(menu);
if (result.getCode() != Common::kNoError || shouldQuit())
return result;
diff --git a/engines/hollywood/runaway/graphics.cpp b/engines/hollywood/runaway/graphics.cpp
index 6fc2495086e..dbe495a03e9 100644
--- a/engines/hollywood/runaway/graphics.cpp
+++ b/engines/hollywood/runaway/graphics.cpp
@@ -83,7 +83,7 @@ bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array
return offset == mask.size();
}
-bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurface &surface, int yOffset) {
+bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurface &surface, int yOffset, int xOffset) {
if (patch.size() < 2 || surface.format.bytesPerPixel != 2)
return false;
uint cursor = 2;
@@ -94,11 +94,15 @@ bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurfac
const int y = READ_LE_UINT16(patch.data() + cursor + 2) + yOffset;
const uint length = READ_LE_UINT16(patch.data() + cursor + 4);
cursor += 6;
- if (!length || x + length > (uint)surface.w || y < 0 || y >= surface.h || length * 2 > patch.size() - cursor)
+ if (!length || x + length > 32767 || length * 2 > patch.size() - cursor)
return false;
- uint16 *out = (uint16 *)surface.getBasePtr(x, y);
- for (uint pixel = 0; pixel < length; ++pixel)
- out[pixel] = READ_LE_UINT16(patch.data() + cursor + pixel * 2);
+ const int left = (int)x + xOffset;
+ const int first = MAX(0, -left), last = MIN<int>(length, surface.w - left);
+ if (y >= 0 && y < surface.h && first < last) {
+ uint16 *out = (uint16 *)surface.getBasePtr(left + first, y);
+ for (int pixel = first; pixel < last; ++pixel)
+ *out++ = READ_LE_UINT16(patch.data() + cursor + pixel * 2);
+ }
cursor += length * 2;
}
return cursor == patch.size();
diff --git a/engines/hollywood/runaway/graphics.h b/engines/hollywood/runaway/graphics.h
index 61c55c4cbf1..330e9e3b154 100644
--- a/engines/hollywood/runaway/graphics.h
+++ b/engines/hollywood/runaway/graphics.h
@@ -39,7 +39,7 @@ bool loadRunawaySurface(uint chunk, int width, int height, Graphics::ManagedSurf
bool loadRunawaySurface(const Common::Path &path, int width, int height, Graphics::ManagedSurface &surface);
bool loadRunawaySurface(ChunkArchive &archive, uint chunk, int width, int height, Graphics::ManagedSurface &surface);
bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array<byte> &mask, Common::Array<byte> &maps);
-bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurface &surface, int yOffset = 0);
+bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurface &surface, int yOffset = 0, int xOffset = 0);
enum {
kRunawayScreenWidth = 1024,
diff --git a/engines/hollywood/runaway/intro.cpp b/engines/hollywood/runaway/intro.cpp
index c6255afb81e..42e14d89b0a 100644
--- a/engines/hollywood/runaway/intro.cpp
+++ b/engines/hollywood/runaway/intro.cpp
@@ -26,6 +26,7 @@
#include "hollywood/debug.h"
#include "hollywood/resource.h"
#include "hollywood/runaway/intro.h"
+#include "hollywood/runaway/presentation.h"
namespace Hollywood {
namespace {
@@ -49,7 +50,8 @@ const uint kStoryHoldDuration = 40000;
} // End of anonymous namespace
-bool RunawayIntro::load() {
+bool RunawayIntro::load(bool fullGame) {
+ _fullGame = fullGame;
ChunkArchive archive;
if (!archive.open(Common::Path("RESOURCE.A02")))
return false;
@@ -57,6 +59,10 @@ bool RunawayIntro::load() {
if (!_logo[i].load(archive, i, kLogoFrameCounts[i]))
return false;
}
+ const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ _screen.create(kRunawayScreenWidth, kRunawayScreenHeight, format);
+ if (_fullGame)
+ return _opening.load();
// 0x444390 displays X01 chunk 0 before entering scene 5030. The card
// already contains the localized story text and the Runaway title.
@@ -65,9 +71,7 @@ bool RunawayIntro::load() {
archive.chunkSize(0) != kRunawayScreenWidth * kRunawayViewportHeight * 2 ||
!archive.readVariableChunk(0, pixels))
return false;
- const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
_story.create(kRunawayScreenWidth, kRunawayViewportHeight, format);
- _screen.create(kRunawayScreenWidth, kRunawayScreenHeight, format);
for (int y = 0; y < _story.h; ++y) {
uint16 *out = (uint16 *)_story.getBasePtr(0, y);
for (int x = 0; x < _story.w; ++x)
@@ -86,6 +90,12 @@ void RunawayIntro::start(uint32 now) {
void RunawayIntro::startStory(uint32 now) {
_audio.stopMusic();
+ if (_fullGame) {
+ _phase = kOpening;
+ _brightness = 255;
+ _opening.start(now);
+ return;
+ }
_phase = kStoryFadeIn;
_phaseStarted = now;
_brightness = 0;
@@ -98,6 +108,8 @@ void RunawayIntro::skip(uint32 now) {
_phase = kStoryFadeOut;
_phaseStarted = now;
_storyFadeDuration = kStorySkipFadeDuration;
+ } else if (_phase == kOpening) {
+ _opening.skip(now);
}
// The original clears pending input after the card's fade-in. Ignoring
// input during its fades also keeps one press from skipping both stages.
@@ -153,6 +165,11 @@ void RunawayIntro::update(uint32 now) {
}
_brightness = 255 * (_storyFadeDuration - elapsed) / _storyFadeDuration;
return;
+ case kOpening:
+ _opening.update(now);
+ if (_opening.finished())
+ _phase = kFinished;
+ return;
case kFinished:
_brightness = 0;
return;
@@ -161,6 +178,10 @@ void RunawayIntro::update(uint32 now) {
}
void RunawayIntro::draw() {
+ if (_phase == kOpening) {
+ _opening.draw(_screen);
+ return;
+ }
_screen.fillRect(Common::Rect(_screen.w, _screen.h), 0);
if (!_brightness)
return;
@@ -176,14 +197,7 @@ void RunawayIntro::draw() {
return;
// Apply the original gamma fades to the RGB565 viewport without changing
// backend gamma or affecting ScummVM's own dialogs.
- for (int y = kRunawayViewportTop; y < kRunawayViewportTop + kRunawayViewportHeight; ++y) {
- uint16 *out = (uint16 *)_screen.getBasePtr(0, y);
- for (int x = 0; x < _screen.w; ++x) {
- const uint16 color = out[x];
- out[x] = (((color >> 11) * _brightness / 255) << 11) |
- ((((color >> 5) & 63) * _brightness / 255) << 5) | ((color & 31) * _brightness / 255);
- }
- }
+ dimRunawayViewport(_screen, _brightness, 255);
}
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/intro.h b/engines/hollywood/runaway/intro.h
index 047142ec463..dffd7493601 100644
--- a/engines/hollywood/runaway/intro.h
+++ b/engines/hollywood/runaway/intro.h
@@ -24,27 +24,32 @@
#include "hollywood/runaway/audio.h"
#include "hollywood/runaway/graphics.h"
+#include "hollywood/runaway/scene2010.h"
namespace Hollywood {
-// The demo's startup sequence: animated Pendulo logo, then the story card.
+// Animated Pendulo logo, then the demo story card or retail opening.
// The engine supplies its pause-aware clock and handles input/presentation.
class RunawayIntro {
public:
- explicit RunawayIntro(Audio::Mixer *mixer) : _audio(mixer) {}
- bool load();
+ explicit RunawayIntro(Audio::Mixer *mixer) : _audio(mixer), _opening(_audio) {}
+ bool load(bool fullGame = false);
void start(uint32 now);
void skip(uint32 now);
void update(uint32 now);
void draw();
bool finished() const { return _phase == kFinished; }
+ bool failed() const { return _opening.failed(); }
+ const Common::U32String &subtitle() const { return _opening.subtitle(); }
Graphics::ManagedSurface &screen() { return _screen; }
private:
- enum Phase { kLogo, kLogoAudio, kStoryFadeIn, kStory, kStoryFadeOut, kFinished };
+ enum Phase { kLogo, kLogoAudio, kStoryFadeIn, kStory, kStoryFadeOut, kOpening, kFinished };
void startStory(uint32 now);
RunawayAudio _audio;
+ RunawayOpening _opening;
+ bool _fullGame = false;
RunawayAnimation _logo[3];
Graphics::ManagedSurface _story, _screen;
Phase _phase = kFinished;
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index 4041a89e434..dbea7ce1115 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -57,6 +57,7 @@ void RunawayInventory::captureState(RunawaySaveState &state) const {
state.items[i] = itemAt(i);
state.selected = _selected;
state.cloth = _clothState;
+ state.water = _water;
}
void RunawayInventory::restoreState(const RunawaySaveState &state) {
@@ -66,6 +67,7 @@ void RunawayInventory::restoreState(const RunawaySaveState &state) {
_items.push_back(state.items[i]);
_selected = state.selected;
_clothState = state.cloth;
+ _water = state.water;
_newItem = 0;
}
@@ -99,6 +101,8 @@ void RunawayInventory::remove(byte item) {
}
Common::U32String RunawayInventory::name(byte item) const {
+ if (_game == kRunawayFullGame && item == 13 && _water == 1)
+ return Common::U32String("Glass with water");
if (_game == kRunawayMuseumDemo)
return item < ARRAYSIZE(kMuseumItemNames) ? Common::U32String(kMuseumItemNames[item]) : Common::U32String();
if (_game == kRunawayFullGame)
@@ -109,6 +113,8 @@ Common::U32String RunawayInventory::name(byte item) const {
}
uint RunawayInventory::icon(byte item) const {
+ if (_game == kRunawayFullGame && item == 13 && _water == 1)
+ return 23;
if (_game != kRunawayCabinDemo)
return item;
if (item == 1 && _clothState)
@@ -117,6 +123,8 @@ uint RunawayInventory::icon(byte item) const {
}
uint RunawayInventory::cursor(byte item) const {
+ if (_game == kRunawayFullGame && item == 13 && _water == 1)
+ return 85;
if (_game == kRunawayMuseumDemo)
return item && item < ARRAYSIZE(kMuseumItemNames) ? 11 + item * 2 : 0;
if (_game == kRunawayFullGame)
@@ -127,6 +135,8 @@ uint RunawayInventory::cursor(byte item) const {
}
RunawayInventory::Reply RunawayInventory::examine(byte item) const {
+ if (_game == kRunawayFullGame && item == 13)
+ return Reply(62, _water == 1 ? 1 : 0);
if (_game == kRunawayMuseumDemo) {
if (!item || item >= ARRAYSIZE(kMuseumItemNames))
return Reply();
diff --git a/engines/hollywood/runaway/inventory.h b/engines/hollywood/runaway/inventory.h
index 2506475fa11..a0887c60443 100644
--- a/engines/hollywood/runaway/inventory.h
+++ b/engines/hollywood/runaway/inventory.h
@@ -57,6 +57,8 @@ public:
Reply combine(byte first, byte second);
byte clothState() const { return _clothState; }
void soilCloth() { _clothState = 2; }
+ byte water() const { return _water; }
+ void setWater(byte water) { _water = water; }
void captureState(RunawaySaveState &state) const;
void restoreState(const RunawaySaveState &state);
@@ -65,6 +67,7 @@ private:
const RunawayGameType _game;
Common::Array<byte> _items;
byte _selected = 0, _newItem = 0, _clothState = 0;
+ byte _water = 0;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/presentation.cpp b/engines/hollywood/runaway/presentation.cpp
index 28edf5a9df0..3feed696fd5 100644
--- a/engines/hollywood/runaway/presentation.cpp
+++ b/engines/hollywood/runaway/presentation.cpp
@@ -31,13 +31,15 @@ namespace Hollywood {
static const uint kInterrogationSpeakerActor[] = {1, 2, 0};
static const uint kInterrogationMouthBase[] = {67, 40, 20};
-static void dimViewport(Graphics::ManagedSurface &screen, uint brightness) {
+void dimRunawayViewport(Graphics::ManagedSurface &screen, uint brightness, uint maximum) {
+ if (brightness >= maximum)
+ return;
for (int y = kRunawayViewportTop; y < kRunawayViewportTop + kRunawayViewportHeight; ++y) {
uint16 *pixels = (uint16 *)screen.getBasePtr(0, y);
for (int x = 0; x < screen.w; ++x) {
const uint16 p = pixels[x];
- pixels[x] = (((p >> 11) * brightness / 1000) << 11) |
- ((((p >> 5) & 63) * brightness / 1000) << 5) | ((p & 31) * brightness / 1000);
+ pixels[x] = (((p >> 11) * brightness / maximum) << 11) |
+ ((((p >> 5) & 63) * brightness / maximum) << 5) | ((p & 31) * brightness / maximum);
}
}
}
@@ -80,14 +82,14 @@ void RunawayCredits::draw(Graphics::ManagedSurface &screen) const {
}
}
if (elapsed > scrollTime + 4000)
- dimViewport(screen, 1000 - MIN<uint>(1000, (elapsed - scrollTime - 4000) * 2));
+ dimRunawayViewport(screen, 1000 - MIN<uint>(1000, (elapsed - scrollTime - 4000) * 2));
} else {
screen.blitFrom(_card, Common::Point(0, kRunawayViewportTop));
const uint cardElapsed = elapsed - scrollTime - 4500;
if (cardElapsed < 500)
- dimViewport(screen, cardElapsed * 2);
+ dimRunawayViewport(screen, cardElapsed * 2);
else if (cardElapsed > 60500)
- dimViewport(screen, 1000 - MIN<uint>(1000, (cardElapsed - 60500) * 2));
+ dimRunawayViewport(screen, 1000 - MIN<uint>(1000, (cardElapsed - 60500) * 2));
}
}
@@ -378,7 +380,7 @@ void RunawayEnding::draw(Graphics::ManagedSurface &screen) const {
}
_layers[3].draw(screen, _frames[3], 0, kRunawayViewportTop);
_layers[6].draw(screen, _frames[6], 0, kRunawayViewportTop);
- dimViewport(screen, elapsed < 10000 ? 1000 : (12000 - MIN<uint>(12000, elapsed)) / 2);
+ dimRunawayViewport(screen, elapsed < 10000 ? 1000 : (12000 - MIN<uint>(12000, elapsed)) / 2);
} else if (_stage == kSlideshow || _stage == kCard) {
screen.blitFrom(_stage == kSlideshow ? _slide : _card, Common::Point(0, kRunawayViewportTop));
// The later demos blink different parts of their localized artwork
@@ -392,7 +394,7 @@ void RunawayEnding::draw(Graphics::ManagedSurface &screen) const {
}
const uint brightness = _fadeDuration ?
1000 * (_fadeDuration - MIN<uint>(_fadeDuration, _now - _fadeStarted)) / _fadeDuration : MIN<uint>(1000, elapsed * 2);
- dimViewport(screen, brightness);
+ dimRunawayViewport(screen, brightness);
}
if (_stage == kOutside || _stage == kSlideshow)
screen.blitFrom(_demoLogo, Common::Point(976, 720));
diff --git a/engines/hollywood/runaway/presentation.h b/engines/hollywood/runaway/presentation.h
index 2f81eb6e952..f06eba9f3e2 100644
--- a/engines/hollywood/runaway/presentation.h
+++ b/engines/hollywood/runaway/presentation.h
@@ -32,6 +32,8 @@
namespace Hollywood {
+void dimRunawayViewport(Graphics::ManagedSurface &screen, uint brightness, uint maximum = 1000);
+
class RunawayCredits {
public:
bool load();
diff --git a/engines/hollywood/runaway/saveload.cpp b/engines/hollywood/runaway/saveload.cpp
index a2cfabf9622..f9b9a923e2b 100644
--- a/engines/hollywood/runaway/saveload.cpp
+++ b/engines/hollywood/runaway/saveload.cpp
@@ -64,6 +64,9 @@ void RunawaySaveState::sync(Common::Serializer &s) {
s.syncAsByte(hospital.sheetTaken, 3);
s.syncAsByte(hospital.bagTaken, 3);
s.syncAsByte(hospital.exitMapRead, 3);
+ s.syncAsByte(hospital.markerTaken, 4);
+ s.syncAsByte(hospital.alcohol, 4);
+ s.syncAsByte(water, 4);
}
byte RunawaySaveState::chapter() const {
@@ -97,11 +100,15 @@ bool RunawaySaveState::valid() const {
return false;
}
if (hospital.glassTaken > 1 || hospital.pillsTaken > 1 || hospital.sheetTaken > 1 ||
- hospital.bagTaken > 1 || hospital.exitMapRead > 1)
- return false;
- if (game == kRunawayFullGame && (scene != kHospitalBedroom || x >= 1520 || y >= 600 ||
- camera < 156 || camera > 496 || cameraY))
+ hospital.bagTaken > 1 || hospital.exitMapRead > 1 || hospital.markerTaken > 1 || hospital.alcohol > 2 || water > 2)
return false;
+ if (game == kRunawayFullGame) {
+ const RunawayRoom *room = findRunawayRoom(scene);
+ if (!room || (room->number != kHospitalBedroom && room->number != kHospitalBathroom) ||
+ x >= room->width || y >= room->height || cameraY ||
+ camera < (room->number == kHospitalBedroom ? 156 : 0) || camera > room->width - 1024)
+ return false;
+ }
if ((coolerMoved && ice != 2) || ((hatch != 0) != (coolerMoved != 0)))
return false;
for (uint i = 0; i < sizeof(pickedUp); ++i) {
@@ -123,7 +130,7 @@ bool RunawaySaveState::read(Common::SeekableReadStream &stream) {
if (stream.readUint32BE() != MKTAG('R', 'U', 'N', 'A'))
return false;
const uint16 version = stream.readUint16LE();
- if (version < 1 || version > 3)
+ if (version < 1 || version > 4)
return false;
Common::Serializer s(&stream, nullptr);
s.setVersion(version);
@@ -135,9 +142,9 @@ bool RunawaySaveState::write(Common::WriteStream &stream) {
if (!valid())
return false;
stream.writeUint32BE(MKTAG('R', 'U', 'N', 'A'));
- stream.writeUint16LE(3);
+ stream.writeUint16LE(4);
Common::Serializer s(nullptr, &stream);
- s.setVersion(3);
+ s.setVersion(4);
sync(s);
return !s.err();
}
diff --git a/engines/hollywood/runaway/saveload.h b/engines/hollywood/runaway/saveload.h
index 992d3a8344f..0fda8b060a2 100644
--- a/engines/hollywood/runaway/saveload.h
+++ b/engines/hollywood/runaway/saveload.h
@@ -32,6 +32,7 @@ namespace Hollywood {
struct RunawaySaveState {
struct Hospital {
byte glassTaken = 0, pillsTaken = 0, sheetTaken = 0, bagTaken = 0, exitMapRead = 0;
+ byte markerTaken = 0, alcohol = 0;
} hospital;
uint16 scene = 5030, x = 623, y = 447, camera = 111;
@@ -45,6 +46,7 @@ struct RunawaySaveState {
uint16 cameraY = 0;
byte upperFloor = 1, books = 0, recorder = 0, moneyIdentified = 0, safeOpen = 0;
byte varnishTaken = 0, talcTaken = 0, coffeeTaken = 0, keyCount = 0;
+ byte water = 0;
byte chapter() const;
bool valid() const;
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index 582028b481e..b8fb3ba6572 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -36,7 +36,7 @@ namespace Hollywood {
namespace {
const RunawayRoom *const kRooms[] = {
- &kRunawayScene2020,
+ &kRunawayScene2020, &kRunawayScene2080,
&kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140
};
@@ -62,6 +62,8 @@ const RunawayResponse kGlobalResponses[] = {
};
const RunawayRoom *findRoom(int number) {
+ if (number == 2021)
+ number = kHospitalBedroom;
for (uint i = 0; i < ARRAYSIZE(kRooms); ++i) {
if (kRooms[i]->number == number)
return kRooms[i];
@@ -104,9 +106,21 @@ void RunawayRoomScene::start(uint32 now) {
}
void RunawayRoomScene::resume() {
- if (_room == kHospitalBedroom) {
- _audio.playMusic(11, false);
- _audio.playEffect(30, 3, 1, true);
+ if (_game == kRunawayFullGame) {
+ if (!_audio.musicPlaying())
+ _audio.playMusic(11, false);
+ if (_room == kHospitalBedroom)
+ _audio.playEffect(30, 3, 1, true);
+ if (_entering) {
+ _audio.playEffect(48);
+ if (_room == kHospitalBathroom) {
+ walkTo(Common::Point(227, 546), 1, true);
+ } else if (_inventory.water() == 1) {
+ // The cracked glass has drained by the time Brian returns.
+ _inventory.setWater(2);
+ }
+ _entering = false;
+ }
return;
}
// The original demo loops M04 cue 11 throughout gameplay (0x4175c0).
@@ -138,6 +152,7 @@ bool RunawayRoomScene::restoreState(const RunawaySaveState &state, uint32 now, b
if (!state.valid() || state.game != _game || state.scene != _entryScene)
return false;
_hospital = state.hospital;
+ _entering = entering;
_upperFloor = state.upperFloor;
_books = (ObjectState)state.books;
_recorder = (ObjectState)state.recorder;
@@ -168,8 +183,7 @@ bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte fac
const RunawayRoom *room = findRoom(number);
if (!room || position.x < 0 || position.x >= room->width || position.y < 0 || position.y >= room->height)
return false;
- const Common::Path path(_game == kRunawayFullGame ? "RESOURCE.B02" :
- Common::String::format("RESOURCE.D%02u", number / 10 - 400));
+ const Common::Path path(Common::String::format("RESOURCE.%c%02u", 'A' + number / 1000 - 1, (number % 1000) / 10));
if (!_archive.open(path, 40) ||
!loadRunawayMask(_archive, room->width, room->height, _mask, _originalMaps) ||
!_text.load("RESOURCE.003", "Runaway room", number / 10, 0, 0x1135))
@@ -201,6 +215,9 @@ bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte fac
case kHospitalBedroom:
loaded = loadScene2020();
break;
+ case kHospitalBathroom:
+ loaded = loadScene2080();
+ break;
case kMuseumOffice:
loaded = loadScene4030();
break;
@@ -258,6 +275,8 @@ bool RunawayRoomScene::rebuildBackground() {
switch (_room) {
case kHospitalBedroom:
return applyBackground2020();
+ case kHospitalBathroom:
+ return applyBackground2080();
case kMuseumOffice:
return applyBackground4030();
case kMuseumLaboratory:
@@ -273,6 +292,9 @@ void RunawayRoomScene::updateMaps() {
case kHospitalBedroom:
updateMaps2020();
break;
+ case kHospitalBathroom:
+ updateMaps2080();
+ break;
case kMuseumOffice:
updateMaps4030();
break;
@@ -307,6 +329,8 @@ Common::U32String RunawayRoomScene::hotspotName(byte id) const {
const RunawayHotspot *spot = hotspot(id);
if (!spot)
return Common::U32String();
+ if (_room == kHospitalBathroom && id == 4 && _hospital.alcohol == 2)
+ return Common::U32String("Bottle of alcohol");
return _room == kMuseumOffice ? hotspotName4030(id) : Common::U32String(spot->name);
}
@@ -322,14 +346,24 @@ Common::U32String RunawayRoomScene::actionCaption(byte id, RunawayVerb verb, byt
return _strings.text(verb == kVerbLook ? RunawayStrings::kLook : RunawayStrings::kUse) + name;
}
-void RunawayRoomScene::walkTo(Common::Point target) {
- RunawayWalkMap(_background.w, _background.h, _mask, _maps).findPath(_position, target, _path);
+void RunawayRoomScene::walkTo(Common::Point target, byte facing, bool scripted) {
+ if (scripted) {
+ _path.clear();
+ _path.push_back(target);
+ } else {
+ RunawayWalkMap(_background.w, _background.h, _mask, _maps).findPath(_position, target, _path);
+ }
+ _arrivalFacing = facing;
_pathIndex = _walkElapsed = _lastFootstep = 0;
if (_path.empty())
arrive();
}
void RunawayRoomScene::arrive() {
+ if (_arrivalFacing != 0xff) {
+ _facing = _arrivalFacing;
+ _arrivalFacing = 0xff;
+ }
const byte id = _pendingHotspot;
_pendingHotspot = 0;
if (id) {
@@ -358,7 +392,21 @@ void RunawayRoomScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
const uint index = verb == kVerbLook && !item ? 0 : 1;
_pendingHotspot = id;
_pendingAction = spot->action[index];
- if (spot->approach[index] || item)
+ bool approach = spot->approach[index] != 0;
+ if (_room == kHospitalBathroom && id == 4 && !index && _hospital.alcohol == 2)
+ approach = false;
+ if (item) {
+ approach = _game != kRunawayFullGame;
+ const RunawayRoom *room = findRoom(_room);
+ for (uint i = 0; i < room->itemActionCount; ++i) {
+ const RunawayItemAction &action = room->itemActions[i];
+ if (action.hotspot == id && (!action.item || action.item == item)) {
+ approach = action.approach;
+ break;
+ }
+ }
+ }
+ if (approach)
walkTo(Common::Point(spot->x, spot->y));
else {
_path.clear();
@@ -406,7 +454,7 @@ void RunawayRoomScene::sayInventory(const RunawayInventory::Reply &reply) {
_pathIndex = 0;
_pendingHotspot = 0;
_caption.clear();
- if (_room == kHospitalBedroom && sayInventory2020(reply))
+ if (_game == kRunawayFullGame && sayHospitalInventory(reply))
return;
say(reply.cue, reply.variation, true);
}
@@ -444,6 +492,9 @@ void RunawayRoomScene::execute(uint16 action) {
case kHospitalBedroom:
result = execute2020(action);
break;
+ case kHospitalBathroom:
+ result = execute2080(action);
+ break;
case kMuseumOffice:
result = execute4030(action);
break;
@@ -511,6 +562,8 @@ float RunawayRoomScene::actorHeight() const {
switch (_room) {
case kHospitalBedroom:
return actorHeight2020();
+ case kHospitalBathroom:
+ return _position.y * 0.266272187f + 295.502960f;
case kMuseumOffice:
return actorHeight4030();
case kMuseumLaboratory:
@@ -536,6 +589,15 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
skipSpeech();
if (_room == kHospitalBedroom)
update2020();
+ else if (_room == kHospitalBathroom)
+ update2080();
+ if (_game == kRunawayFullGame) {
+ updateHospitalAudio();
+ if (_hospitalExit.scene && !_audio.effectPlaying()) {
+ _transition = _hospitalExit;
+ return;
+ }
+ }
if (inventoryOpen || _room == kMuseumKeypad)
return;
if (_pathIndex < _path.size() && !speaking()) {
@@ -604,6 +666,8 @@ void RunawayRoomScene::draw() {
}
if (_room == kHospitalBedroom) {
drawScene2020(viewport, false);
+ } else if (_room == kHospitalBathroom) {
+ drawScene2080(viewport, false);
} else {
_ambient.draw(viewport, 0, _camera.x, -_camera.y);
_overlay.draw(viewport, 0, _camera.x, -_camera.y);
@@ -630,9 +694,12 @@ void RunawayRoomScene::draw() {
params.antialias = _antialias;
const byte light = MIN<byte>(9, _maps[768 + _mask[_position.y * _background.w + _position.x]]);
memcpy(params.light, findRoom(_room)->light[light], sizeof(params.light));
- _actor.draw(_screen, params, _mask, _maps);
+ if (_room != kHospitalBathroom || (_roomAction != 302 && _roomAction != 307))
+ _actor.draw(_screen, params, _mask, _maps);
if (_room == kHospitalBedroom)
drawScene2020(viewport, true);
+ else if (_room == kHospitalBathroom)
+ drawScene2080(viewport, true);
else if (_room == kMuseumOffice)
drawForeground4030(viewport);
else if (_room == kMuseumLaboratory)
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index ac60d8a5cd5..aa5913db8d6 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -95,7 +95,7 @@ public:
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _caption; }
const Common::U32String &subtitle() const override { return _subtitle; }
- bool busy() const override { return _pendingHotspot != 0 || _transition.scene || _hospitalEntryStep || speaking(); }
+ bool busy() const override { return _pendingHotspot != 0 || _transition.scene || _hospitalExit.scene || _arrivalFacing != 0xff || _hospitalEntryStep || _roomAction || speaking(); }
bool speaking() const override { return !_subtitle.empty(); }
byte speechFrame() const override { return _lipSync.frame(_now); }
void skipSpeech() override;
@@ -115,7 +115,7 @@ private:
bool rebuildBackground();
bool applyPatch(uint chunk);
void updateMaps();
- void walkTo(Common::Point target);
+ void walkTo(Common::Point target, byte facing = 0xff, bool scripted = false);
void arrive();
void execute(uint16 action);
void useItem(byte item, byte hotspot);
@@ -123,6 +123,8 @@ private:
void showLine();
void changeFloor(bool upper, Common::Point position);
void updateCamera();
+ void leaveHospitalRoom(uint16 scene, Common::Point position, byte facing);
+ void updateHospitalAudio();
float actorHeight() const;
const RunawayHotspot *hotspot(byte id) const;
Common::U32String hotspotName(byte id) const;
@@ -134,10 +136,16 @@ private:
void start2020();
void update2020();
void updateMaps2020();
- bool sayInventory2020(const RunawayInventory::Reply &reply);
+ bool sayHospitalInventory(const RunawayInventory::Reply &reply);
ActionResult execute2020(uint16 action);
float actorHeight2020() const;
void drawScene2020(Graphics::ManagedSurface &viewport, bool foreground);
+ bool loadScene2080();
+ bool applyBackground2080();
+ void updateMaps2080();
+ void update2080();
+ ActionResult execute2080(uint16 action);
+ void drawScene2080(Graphics::ManagedSurface &viewport, bool foreground);
bool loadScene4030();
bool applyBackground4030();
@@ -181,6 +189,7 @@ private:
SceneTextStore _text;
RunawayActor _actor;
RunawayAnimation _ambient, _overlay, _safe;
+ RunawayAnimation _actionAnimation;
Graphics::ManagedSurface _background, _screen;
Common::Array<byte> _mask, _originalMaps, _maps;
Common::Array<Common::Rect> _foreground[5];
@@ -197,6 +206,7 @@ private:
uint _pathIndex = 0, _lineIndex = 0;
uint16 _room = 0, _pendingAction = 0;
byte _facing = 3, _pendingHotspot = 0, _pendingItem = 0;
+ byte _arrivalFacing = 0xff;
float _x = 0, _y = 0;
uint32 _now = 0, _lastUpdate = 0, _walkElapsed = 0, _subtitleUntil = 0;
bool _upperFloor = true, _antialias = true, _fastScrolling = true;
@@ -211,6 +221,12 @@ private:
byte _hospitalEntryStep = 0, _ambientFrame = 0, _musicCue = 11;
int _ambientDirection = 1;
uint32 _ambientTick = 0, _nextMusic = 0;
+ bool _entering = false;
+ uint16 _roomAction = 0;
+ byte _actionStage = 0;
+ uint _actionStep = 0;
+ uint32 _actionStarted = 0;
+ Transition _hospitalExit;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene2010.cpp b/engines/hollywood/runaway/scene2010.cpp
new file mode 100644
index 00000000000..f1e96ccd659
--- /dev/null
+++ b/engines/hollywood/runaway/scene2010.cpp
@@ -0,0 +1,480 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/textconsole.h"
+#include "common/str-enc.h"
+#include "common/util.h"
+#include "hollywood/resource.h"
+#include "hollywood/runaway/presentation.h"
+#include "hollywood/runaway/scene2010.h"
+
+namespace Hollywood {
+namespace {
+
+// Use the surface blitter's alpha support for the original picture dissolves.
+// A 32-bit RGB source leaves 0xffffffff available as a transparent key without
+// losing white pixels from the RGB565 artwork.
+const Graphics::PixelFormat kPictureFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
+
+} // End of anonymous namespace
+
+bool RunawayOpening::load() {
+ ChunkArchive archive;
+ if (!archive.open(Common::Path("RESOURCE.A00")) ||
+ !loadRunawaySurface(archive, 6, 1024, 600, _narratorBackground) ||
+ !archive.readVariableChunk(7, _chapterTitle) ||
+ !_text.loadStage("RESOURCE.003", "Runaway narrator", 100))
+ return false;
+ const uint narratorFrames[] = {178, 35, 7, 35, 35, 35};
+ for (uint i = 0; i < ARRAYSIZE(_narrator); ++i) {
+ if (!_narrator[i].load(archive, i, narratorFrames[i]))
+ return false;
+ }
+
+ if (!archive.open(Common::Path("RESOURCE.B01")) ||
+ !loadRunawaySurface(archive, 0, 1592, 600, _city) ||
+ !_cityActor.load(archive, 1, 213))
+ return false;
+ for (uint i = 0; i < ARRAYSIZE(_parallax); ++i) {
+ if (!archive.readVariableChunk(i + 2, _parallax[i]))
+ return false;
+ }
+ const uint titleChunks[] = {5, 8, 9, 6};
+ for (uint i = 0; i < ARRAYSIZE(_titles); ++i) {
+ if (!_titles[i].load(archive, titleChunks[i], 75))
+ return false;
+ }
+ // B01 chunk 7 is the 400x39 title at room coordinates (879, 548).
+ Graphics::ManagedSurface scratch(400, 39, _city.format);
+ Common::Array<byte> patch;
+ if (!archive.readVariableChunk(7, patch) || !applyRunawayPatch(patch, scratch, -548, -879))
+ return false;
+ _cityTitle.convertFrom(scratch, kPictureFormat);
+ for (uint i = 0; i < ARRAYSIZE(_pictures) - 1; ++i) {
+ if (!loadRunawaySurface(archive, i + 10, 282, 188, scratch))
+ return false;
+ _pictures[i].convertFrom(scratch, kPictureFormat);
+ }
+ _pictures[16].create(282, 188, kPictureFormat);
+ for (uint i = 0; i < ARRAYSIZE(_credits); ++i) {
+ if (!_credits[i].load(archive, i + 26, 12))
+ return false;
+ }
+ if (!archive.open(Common::Path("DATAVB08.002")))
+ return false;
+ _portrait.create(512, 300, _city.format);
+ for (uint i = 0; i < ARRAYSIZE(_heads); ++i) {
+ if (!archive.readVariableChunk(i * 2, _portraits[i]) ||
+ !_heads[i].load(archive, i * 2 + 1, 12))
+ return false;
+ }
+ return true;
+}
+
+void RunawayOpening::start(uint32 now) {
+ _audio.setChapter(1);
+ enter(kSitDown, now);
+}
+
+void RunawayOpening::enter(Step step, uint32 now) {
+ _step = step;
+ _now = _started = now;
+ _events = 0;
+ _row = 0;
+ _subtitle.clear();
+ _lipSync.stop();
+ _audio.stopSpeech();
+ switch (step) {
+ case kSitDown: _firstFrame = 0; _lastFrame = 20; _headBank = 0; break;
+ case kLeanForward: _firstFrame = 161; _lastFrame = 177; _headBank = 0; break;
+ case kLeanBack: _firstFrame = 177; _lastFrame = 161; _headBank = 0; break;
+ case kTurnToScreen: _firstFrame = 128; _lastFrame = 160; _headBank = 0; break;
+ case kTurnBack: _firstFrame = 160; _lastFrame = 128; _headBank = 0; break;
+ case kIntroduction: _bodyFrame = 20; _headBank = 1; speak(0, 0); break;
+ case kQuestion: _bodyFrame = 177; _headBank = 5; speak(0, 1); break;
+ case kBackground: _bodyFrame = 20; _headBank = 1; speak(0, 2); break;
+ case kJourney: _bodyFrame = 160; _headBank = 4; speak(0, 3); break;
+ case kLastNarration: _bodyFrame = 20; _headBank = 1; speak(0, 9); break;
+ case kMontage:
+ startMovie("DATAVA02.001", 0, 700);
+ _audio.playIntroMusic(4);
+ break;
+ case kCity:
+ _video.close();
+ _narrating = false;
+ _failed = !_text.loadStage("RESOURCE.003", "Runaway opening", 201);
+ _audio.playMusic(32);
+ _audio.setMusicVolume(204);
+ break;
+ case kAccident:
+ startMovie("DATAVB04.001", 0, 250);
+ _audio.playEffect(27);
+ break;
+ case kAccidentTitle:
+ _audio.playEffect(28, 255, 1);
+ break;
+ case kAccidentEnd:
+ startMovie(nullptr, 261, 312);
+ break;
+ case kCityExit:
+ _audio.stopEffect();
+ _video.close();
+ break;
+ case kFilm:
+ startMovie("DATAVB08.001", 0, 2565);
+ if (!_themeStarted) {
+ _audio.playMusic(17, false);
+ _audio.setMusicVolume(255);
+ _themeStarted = true;
+ }
+ break;
+ case kStayAway: speak(1, 2); break;
+ case kApproach: startMovie(nullptr, 2578, 2626); break;
+ case kUnconscious: speak(1, 3); break;
+ case kTurn: startMovie(nullptr, 2638, 2653); break;
+ case kHospital: speak(1, 4); break;
+ case kHitman: speak(1, 5); break;
+ case kReply: speak(1, 6); break;
+ case kFilmEnd:
+ startMovie(nullptr, 2668, 2927);
+ _audio.playEffect(42);
+ break;
+ case kChapter:
+ _video.close();
+ _audio.stopMusic();
+ _audio.stopEffect();
+ _narrating = true;
+ _failed = !_text.loadStage("RESOURCE.003", "Runaway narrator", 100);
+ _bodyFrame = 20;
+ _headBank = 1;
+ speak(1, 0);
+ break;
+ case kFinished:
+ _video.close();
+ _audio.stopMusic();
+ _audio.stopEffect();
+ break;
+ default:
+ break;
+ }
+ _frame = _firstFrame;
+ if (!_headBank && _narrating)
+ _bodyFrame = _firstFrame;
+}
+
+void RunawayOpening::advance() {
+ enter((Step)(_step + 1), _now);
+}
+
+void RunawayOpening::speak(uint16 cue, byte variation) {
+ const SceneSpeechCue speech = _text.stageCue(cue, variation);
+ const uint count = MAX<uint>(1, speech.continuationCount);
+ if (!speech.valid() || speech.textRecordId < 500 ||
+ speech.textRecordId - 500 + count > _text._stageLargeRows.size() / 321 ||
+ !speech.voiceSampleId || speech.voiceSampleId + count > 6000) {
+ warning("Runaway: invalid opening speech cue %u/%u", cue, variation);
+ _failed = true;
+ return;
+ }
+ _row = speech.textRecordId;
+ _lastRow = _row + count - 1;
+ _sample = speech.voiceSampleId;
+ showLine();
+}
+
+void RunawayOpening::showLine() {
+ _subtitle = Common::U32String(_text.largeTextRecord(_row), Common::kDos850);
+ // The framing narration belongs to DATAACA0, independently of chapter.
+ const uint32 duration = _audio.playSpeech(_sample, _narrating);
+ _lipSync.start(_subtitle, _now, duration, _random, _sample);
+ _deadline = _now + (duration ? MAX<uint>(1000, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
+}
+
+void RunawayOpening::nextLine() {
+ _audio.stopSpeech();
+ _lipSync.stop();
+ if (_row < _lastRow) {
+ ++_row;
+ ++_sample;
+ showLine();
+ } else {
+ _row = 0;
+ _subtitle.clear();
+ }
+}
+
+void RunawayOpening::startMovie(const char *name, uint first, uint last) {
+ if ((name && !_video.load(name)) || last >= _video.frameCount() || !_video.decodeToFrame(first)) {
+ warning("Runaway: cannot load opening movie segment %u..%u", first, last);
+ _failed = true;
+ return;
+ }
+ _firstFrame = first;
+ _lastFrame = last;
+}
+
+bool RunawayOpening::updateMovie() {
+ _frame = MIN(_lastFrame, _firstFrame + _video.frameAtTime(_now - _started));
+ if (!_video.decodeToFrame(_frame)) {
+ _failed = true;
+ return false;
+ }
+ return _frame == _lastFrame;
+}
+
+void RunawayOpening::update(uint32 now) {
+ _now = now;
+ if (finished())
+ return;
+ if (speaking() && !_audio.speechPlaying() && (int32)(now - _deadline) >= 0)
+ nextLine();
+ const uint elapsed = now - _started;
+ switch (_step) {
+ case kSitDown:
+ case kLeanForward:
+ case kLeanBack:
+ case kTurnToScreen:
+ case kTurnBack: {
+ const uint distance = ABS((int)_lastFrame - (int)_firstFrame);
+ const uint offset = MIN(distance, elapsed / 80);
+ _bodyFrame = _lastFrame >= _firstFrame ? _firstFrame + offset : _firstFrame - offset;
+ if (elapsed >= (distance + 1) * 80)
+ advance();
+ break;
+ }
+ case kMontage: {
+ const bool ended = updateMovie();
+ const uint cues[] = {73, 215, 357, 499, 642};
+ if (_events < ARRAYSIZE(cues) && _frame >= cues[_events] && !speaking()) {
+ speak(0, 4 + _events);
+ ++_events;
+ }
+ if (ended && !speaking() && _events == ARRAYSIZE(cues)) {
+ _video.close();
+ advance();
+ }
+ break;
+ }
+ case kCity:
+ if (elapsed >= 11700)
+ advance();
+ break;
+ case kCityExit:
+ if (elapsed >= 3780)
+ advance();
+ break;
+ case kTitle:
+ case kAccidentTitle: {
+ const uint fadeTime = 74 * (_step == kTitle ? 40 : 20);
+ if (_step == kAccidentTitle) {
+ if (!(_events & 1) && elapsed >= fadeTime * 2 + 500) {
+ _audio.playMusic(17, false);
+ _audio.setMusicVolume(255);
+ _themeStarted = true;
+ _events |= 1;
+ }
+ if (!(_events & 2) && elapsed >= fadeTime * 2 + 2000) {
+ _audio.playEffect(29);
+ _events |= 2;
+ }
+ }
+ if (elapsed >= fadeTime * 2 + 2000 + 1480)
+ advance();
+ break;
+ }
+ case kAccident:
+ if (updateMovie()) {
+ if (!_events) {
+ _deadline = now + 2000;
+ _events = 1;
+ }
+ if (!_audio.effectPlaying() || (int32)(now - _deadline) >= 0)
+ advance();
+ }
+ break;
+ case kAccidentEnd:
+ case kApproach:
+ case kTurn:
+ if (updateMovie())
+ advance();
+ break;
+ case kFilm: {
+ const bool ended = updateMovie();
+ // Original frame callbacks (0x576d40), independent of rendering rate.
+ if (!(_events & 1) && _frame >= 2251) {
+ _audio.playMusic(30);
+ _audio.setMusicVolume(179);
+ _audio.playEffect(41);
+ _events |= 1;
+ }
+ if (!(_events & 2) && _frame >= 2282) {
+ speak(1, 0);
+ _events |= 2;
+ }
+ if (!(_events & 4) && _frame >= 2541) {
+ speak(1, 1);
+ _events |= 4;
+ }
+ if (ended && !speaking())
+ advance();
+ break;
+ }
+ case kFilmEnd:
+ if (updateMovie()) {
+ advance();
+ } else if (!_events && _frame >= 2734) {
+ _audio.playEffect(43, 230);
+ _events = 1;
+ }
+ break;
+ case kLastNarration:
+ case kChapter:
+ if (!speaking()) {
+ if (!_events) {
+ _deadline = now + 500;
+ _events = 1;
+ }
+ if ((int32)(now - _deadline) >= 0)
+ advance();
+ }
+ break;
+ default:
+ if (!speaking())
+ advance();
+ break;
+ }
+}
+
+void RunawayOpening::skip(uint32 now) {
+ _now = now;
+ if (speaking()) {
+ nextLine();
+ } else if (_step == kMontage) {
+ _video.close();
+ enter(kTurnBack, now);
+ } else if (_step >= kCity && _step < kFilm) {
+ _audio.stopEffect();
+ enter(kFilm, now);
+ } else if (_step >= kFilm && _step < kChapter) {
+ enter(kChapter, now);
+ } else if (!finished()) {
+ advance();
+ }
+}
+
+void RunawayOpening::drawNarrator(Graphics::ManagedSurface &screen) {
+ screen.blitFrom(_narratorBackground, Common::Point(0, kRunawayViewportTop));
+ _narrator[0].draw(screen, _bodyFrame, 0, kRunawayViewportTop);
+ if (_headBank)
+ _narrator[_headBank].draw(screen, _lipSync.frame(_now) % 6, 0, kRunawayViewportTop);
+ if (_step == kMontage)
+ _video.draw(screen, Common::Rect(256, 232, 656, 466));
+ if (_step == kChapter)
+ applyRunawayPatch(_chapterTitle, screen, kRunawayViewportTop);
+}
+
+void RunawayOpening::drawCity(Graphics::ManagedSurface &screen) {
+ Graphics::ManagedSurface viewport(screen, Common::Rect(0, kRunawayViewportTop, 1024, kRunawayViewportTop + 600));
+ const uint elapsed = _now - _started;
+ const int camera = _step == kCity ? 568 - MIN<uint>(240, elapsed > 6900 ? (elapsed - 6900) / 20 : 0) :
+ 328 - MIN<uint>(328, elapsed / 10);
+ viewport.blitFrom(_city, Common::Rect(camera, 0, camera + 1024, 600), Common::Point(0, 0));
+ const uint frame = _step == kCity ? 0 : MIN<uint>(212, 48 + elapsed / 80);
+ _cityActor.draw(viewport, frame, camera, 0);
+ // Native parallax offsets are applied in the room buffer before the
+ // viewport is cropped, so its camera displacement also applies here.
+ applyRunawayPatch(_parallax[1], viewport, 200, 100 - camera * 2);
+ applyRunawayPatch(_parallax[2], viewport, 0, 1100 - camera * 2);
+ applyRunawayPatch(_parallax[0], viewport, 0, (620 - camera) * 4 - camera);
+ if (_step == kCity && elapsed >= 500 && elapsed < 6900) {
+ const uint tick = (elapsed - 500) / 80;
+ const uint level = tick < 20 ? tick * 5 : tick < 60 ? 100 : (80 - tick) * 5;
+ viewport.transBlitFrom(_cityTitle, Common::Point(879 - camera, 548),
+ 0xffffffff, false, level * 255 / 100);
+ }
+}
+
+void RunawayOpening::drawTitles(Graphics::ManagedSurface &screen) {
+ const uint elapsed = _now - _started;
+ const uint delay = _step == kTitle ? 40 : 20;
+ const uint fadeTime = 74 * delay;
+ uint first = MIN<uint>(74, elapsed / delay);
+ uint second = elapsed > fadeTime + 500 ? MIN<uint>(74, (elapsed - fadeTime - 500) / delay) : 0;
+ if (elapsed >= fadeTime * 2 + 2000)
+ first = second = 74 - MIN<uint>(74, (elapsed - fadeTime * 2 - 2000) / 20);
+ const uint bank = _step == kTitle ? 0 : 2;
+ _titles[bank].draw(screen, first, 0, kRunawayViewportTop);
+ _titles[bank + 1].draw(screen, second, 0, kRunawayViewportTop);
+}
+
+void RunawayOpening::drawFilm(Graphics::ManagedSurface &screen) {
+ const Common::Rect viewport(0, kRunawayViewportTop, 1024, kRunawayViewportTop + 600);
+ _video.draw(screen, viewport);
+ if (_step == kFilm && _frame >= 344 && _frame < 2250) {
+ // The original wipes away the right half for the opening credits,
+ // then restores the full movie before the accident.
+ const uint edge = _frame < 408 ? 1024 - (_frame - 343) * 8 :
+ _frame < 2186 ? 512 : MIN<uint>(1024, 512 + (_frame - 2185) * 8);
+ screen.fillRect(Common::Rect(edge, viewport.top, 1024, viewport.bottom), 0);
+ if (_frame >= 420) {
+ const uint elapsed = _frame - 420;
+ const uint credit = elapsed / 147, tick = elapsed % 147;
+ if (credit < ARRAYSIZE(_credits) && tick < 112)
+ _credits[credit].draw(screen, tick < 12 ? tick : tick < 100 ? 11 : 111 - tick, 0, kRunawayViewportTop);
+ const uint picture = elapsed / 108;
+ const uint alpha = MIN<uint>(255, (elapsed % 108 + 2) * 255 / 20);
+ const Common::Point position(627, 140);
+ if (picture && picture <= ARRAYSIZE(_pictures))
+ screen.blitFrom(_pictures[picture - 1], position);
+ if (picture < ARRAYSIZE(_pictures))
+ screen.transBlitFrom(_pictures[picture], position, 0xffffffff, false, alpha);
+ }
+ }
+ if (_step == kStayAway || _step == kUnconscious || (_step >= kHospital && _step <= kReply)) {
+ const uint portrait = _step == kStayAway ? 0 : _step == kUnconscious ? 1 : 2;
+ applyRunawayPatch(_portraits[portrait], _portrait);
+ // The other hitman speaks off screen; the visible man only blinks.
+ const uint mouth = _step == kHitman ? ((_now - _started) % 2400 < 160 ? 6 : 0) : _lipSync.frame(_now);
+ _heads[portrait].draw(_portrait, mouth, 0, 0);
+ screen.blitFrom(_portrait, Common::Rect(512, 300), viewport);
+ }
+}
+
+void RunawayOpening::draw(Graphics::ManagedSurface &screen) {
+ screen.clear();
+ if (_step <= kLastNarration || _step == kChapter)
+ drawNarrator(screen);
+ else if (_step == kCity || _step == kCityExit)
+ drawCity(screen);
+ else if (_step == kTitle || _step == kAccidentTitle)
+ drawTitles(screen);
+ else if (_step < kFinished)
+ drawFilm(screen);
+ const uint elapsed = _now - _started;
+ if ((_step == kSitDown || _step == kCity || _step == kChapter) && elapsed < 500)
+ dimRunawayViewport(screen, elapsed * 2);
+ else if ((_step == kLastNarration || _step == kChapter) && _events)
+ dimRunawayViewport(screen, MIN<uint>(500, _deadline - _now) * 2);
+ else if (_step == kCityExit && elapsed > 3280)
+ dimRunawayViewport(screen, (3780 - MIN<uint>(3780, elapsed)) * 2);
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene2010.h b/engines/hollywood/runaway/scene2010.h
new file mode 100644
index 00000000000..0569528e3a6
--- /dev/null
+++ b/engines/hollywood/runaway/scene2010.h
@@ -0,0 +1,90 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HOLLYWOOD_RUNAWAY_SCENE2010_H
+#define HOLLYWOOD_RUNAWAY_SCENE2010_H
+
+#include "common/random.h"
+#include "hollywood/runaway/animation.h"
+#include "hollywood/runaway/audio.h"
+#include "hollywood/runaway/graphics.h"
+#include "hollywood/runaway/video.h"
+#include "hollywood/scene_text_store.h"
+
+namespace Hollywood {
+
+// The retail opening (2010), followed by chapter one's narration (2000).
+// All timing comes from the engine's pause-aware clock.
+class RunawayOpening {
+public:
+ explicit RunawayOpening(RunawayAudio &audio) : _audio(audio), _random("runawayOpening") {}
+ bool load();
+ void start(uint32 now);
+ void update(uint32 now);
+ void skip(uint32 now);
+ void draw(Graphics::ManagedSurface &screen);
+ bool finished() const { return _step == kFinished || _failed; }
+ bool failed() const { return _failed; }
+ const Common::U32String &subtitle() const { return _subtitle; }
+
+private:
+ enum Step {
+ kSitDown, kIntroduction, kLeanForward, kQuestion, kLeanBack, kBackground,
+ kTurnToScreen, kJourney, kMontage, kTurnBack, kLastNarration,
+ kCity, kTitle, kAccident, kAccidentTitle, kAccidentEnd, kCityExit,
+ kFilm, kStayAway, kApproach, kUnconscious, kTurn, kHospital,
+ kHitman, kReply, kFilmEnd, kChapter, kFinished
+ };
+ void enter(Step step, uint32 now);
+ void advance();
+ void speak(uint16 cue, byte variation);
+ void nextLine();
+ void showLine();
+ void startMovie(const char *name, uint first, uint last);
+ bool updateMovie();
+ void drawNarrator(Graphics::ManagedSurface &screen);
+ void drawCity(Graphics::ManagedSurface &screen);
+ void drawFilm(Graphics::ManagedSurface &screen);
+ void drawTitles(Graphics::ManagedSurface &screen);
+ bool speaking() const { return _row != 0; }
+
+ RunawayAudio &_audio;
+ Common::RandomSource _random;
+ SceneTextStore _text;
+ RunawayLipSync _lipSync;
+ RunawayVideo _video;
+ Graphics::ManagedSurface _narratorBackground, _city, _cityTitle;
+ Graphics::ManagedSurface _portrait;
+ Graphics::ManagedSurface _pictures[17]; // Sixteen pictures, then a dissolve to black.
+ RunawayAnimation _narrator[6], _cityActor, _titles[4], _credits[12], _heads[3];
+ Common::Array<byte> _parallax[3], _chapterTitle, _portraits[3];
+ Step _step = kFinished;
+ uint32 _now = 0, _started = 0, _deadline = 0;
+ uint _frame = 0, _firstFrame = 0, _lastFrame = 0, _events = 0;
+ uint _bodyFrame = 20, _headBank = 1;
+ uint16 _row = 0, _lastRow = 0, _sample = 0;
+ bool _narrating = true, _themeStarted = false, _failed = false;
+ Common::U32String _subtitle;
+};
+
+} // End of namespace Hollywood
+
+#endif // HOLLYWOOD_RUNAWAY_SCENE2010_H
diff --git a/engines/hollywood/runaway/scene2020.cpp b/engines/hollywood/runaway/scene2020.cpp
index 2ae6a132229..8f56a31504c 100644
--- a/engines/hollywood/runaway/scene2020.cpp
+++ b/engines/hollywood/runaway/scene2020.cpp
@@ -143,7 +143,7 @@ void RunawayRoomScene::updateMaps2020() {
}
}
-bool RunawayRoomScene::sayInventory2020(const RunawayInventory::Reply &reply) {
+bool RunawayRoomScene::sayHospitalInventory(const RunawayInventory::Reply &reply) {
if (reply.cue != 54)
return false;
// Searching Gina's bag reveals the matches on the first examination.
@@ -204,7 +204,7 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
warning("Runaway: hospital ledge scene 2060 is not implemented yet");
return kHandled;
case 346:
- warning("Runaway: hospital bathroom scene 2080 is not implemented yet");
+ leaveHospitalRoom(kHospitalBathroom, Common::Point(0, 596), 1);
return kHandled;
case 349:
say(4, 0, true);
@@ -258,6 +258,16 @@ void RunawayRoomScene::update2020() {
}
// The bedside indicator alternates after 17 and 9 animation ticks.
applyRunawayPatch(_monitorPatches[(_now / 80) % 26 >= 17], _background);
+}
+
+void RunawayRoomScene::leaveHospitalRoom(uint16 scene, Common::Point position, byte facing) {
+ _hospitalExit.scene = scene;
+ _hospitalExit.position = position;
+ _hospitalExit.facing = facing;
+ _audio.playEffect(47);
+}
+
+void RunawayRoomScene::updateHospitalAudio() {
if (!_audio.musicPlaying()) {
if (!_nextMusic) {
static const uint16 delays[] = {0, 240, 120, 60};
diff --git a/engines/hollywood/runaway/scene2080.cpp b/engines/hollywood/runaway/scene2080.cpp
new file mode 100644
index 00000000000..5357a672753
--- /dev/null
+++ b/engines/hollywood/runaway/scene2080.cpp
@@ -0,0 +1,214 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+// RESOURCE.B08; interaction points and actions from native 0x44a430.
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Wastebasket", 526, 441, 1, {301, 302}, {0, 1}},
+ {"Faucet", 587, 471, 1, {309, 310}, {0, 0}},
+ {"Door", 50, 586, 5, {308, 303}, {0, 2}},
+ {"Bottle", 577, 466, 1, {305, 306}, {1, 1}},
+ {"Sign", 442, 377, 0, {311, 312}, {0, 0}},
+ {"Pipe", 490, 372, 0, {313, 314}, {0, 0}},
+ {"Shower nozzle", 442, 377, 0, {315, 316}, {0, 0}},
+ {"Medicine cabinet", 595, 423, 0, {317, 318}, {0, 0}},
+ {"Toilet bowl", 295, 327, 0, {319, 320}, {0, 0}}
+};
+
+const RunawayResponse kResponses[] = {
+ {kHospitalBathroom, 301, 1, 0},
+ {kHospitalBathroom, 308, 2, 0},
+ {kHospitalBathroom, 309, 5, 0},
+ {kHospitalBathroom, 310, 5, 1},
+ {kHospitalBathroom, 312, 7, 0},
+ {kHospitalBathroom, 313, 8, 0},
+ {kHospitalBathroom, 314, 9, 0},
+ {kHospitalBathroom, 315, 10, 0},
+ {kHospitalBathroom, 316, 11, 0},
+ {kHospitalBathroom, 317, 12, 0},
+ {kHospitalBathroom, 318, 13, 0},
+ {kHospitalBathroom, 319, 14, 0},
+ {kHospitalBathroom, 321, 16, 0}
+};
+
+const RunawayItemAction kItemActions[] = {
+ {kHospitalBathroom, 13, 2, 307},
+ {kHospitalBathroom, 0, 7, 321, false}
+};
+
+// The faucet animation opens with a held frame, then returns from frame 22.
+const byte kFillGlassFrames[] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 22, 21, 20, 19, 18, 17, 16, 15, 14,
+ 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene2080 = {
+ kHospitalBathroom, 1024, 600, kHotspots, ARRAYSIZE(kHotspots),
+ {{100, 100, 100}, {90, 90, 100}, {70, 70, 80}}, Common::Point(227, 546),
+ kResponses, ARRAYSIZE(kResponses), kItemActions, ARRAYSIZE(kItemActions), nullptr, 0
+};
+
+bool RunawayRoomScene::loadScene2080() {
+ return _ambient.load(_archive, 6, 43) && loadForeground(0, 7) && loadForeground(1, 8);
+}
+
+bool RunawayRoomScene::applyBackground2080() {
+ return _hospital.alcohol != 1 || applyPatch(5);
+}
+
+void RunawayRoomScene::updateMaps2080() {
+ if (_hospital.alcohol == 1) {
+ for (uint i = 0; i < 256; ++i) {
+ if (_maps[256 + i] == 4)
+ _maps[256 + i] = 0;
+ }
+ }
+}
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute2080(uint16 action) {
+ switch (action) {
+ case 302:
+ _roomAction = action;
+ _actionStage = 0;
+ _actionStarted = _now;
+ _actionStep = 0;
+ return kHandled;
+ case 303:
+ case 304:
+ leaveHospitalRoom(2021, Common::Point(1265, 546), 5);
+ return kHandled;
+ case 305:
+ say(3, _hospital.alcohol == 2 ? 1 : 0);
+ _hospital.alcohol = 2;
+ return kHandled;
+ case 306:
+ _hospital.alcohol = 1;
+ _inventory.add(12);
+ _facing = 3;
+ say(18, _random.getRandomNumber(2), true);
+ return kBackgroundChanged;
+ case 307:
+ if (_inventory.water() == 1) {
+ say(4, 1);
+ return kHandled;
+ }
+ if (!_actionAnimation.load(_archive, 4, 38))
+ error("Cannot load Runaway bathroom faucet animation");
+ _roomAction = action;
+ _actionStarted = _now;
+ _actionStep = 0;
+ return kHandled;
+ case 311:
+ case 320:
+ say(action == 311 ? 6 : 15);
+ _roomAction = action;
+ return kHandled;
+ default:
+ return kUnhandled;
+ }
+}
+
+void RunawayRoomScene::update2080() {
+ if (_roomAction == 302) {
+ if (_actionStage == 1) {
+ if (speaking())
+ return;
+ _actionStage = 2;
+ _actionStarted = _now;
+ _actionStep = 0;
+ }
+ const uint previous = _actionStep;
+ _actionStep = (_now - _actionStarted) / 80;
+ if (!_actionStage) {
+ if (previous < 12 && _actionStep >= 12)
+ _audio.playEffect(31);
+ if (_actionStep >= 19) {
+ _actionStage = 1;
+ _actionStep = 19;
+ say(1, _hospital.markerTaken ? 2 : 3);
+ }
+ } else if (_actionStage == 2) {
+ if (_hospital.markerTaken && previous < 2 && _actionStep >= 2)
+ _audio.playEffect(30, 204);
+ const uint duration = _hospital.markerTaken ? 19 : 12;
+ if (_actionStep >= duration) {
+ _roomAction = 0;
+ if (!_hospital.markerTaken) {
+ _hospital.markerTaken = 1;
+ _inventory.add(11);
+ say(1, 1);
+ }
+ }
+ }
+ } else if (_roomAction == 307) {
+ const uint previous = _actionStep;
+ _actionStep = (_now - _actionStarted) / 80;
+ if (previous < 20 && _actionStep >= 20)
+ _audio.playEffect(38, 204);
+ if (_actionStep >= ARRAYSIZE(kFillGlassFrames)) {
+ _roomAction = 0;
+ _inventory.setWater(1);
+ _inventory.remove(13);
+ _inventory.add(13);
+ _facing = 3;
+ say(4);
+ }
+ } else if ((_roomAction == 311 || _roomAction == 320) && !speaking()) {
+ _facing = 4;
+ say(_roomAction == 311 ? 6 : 15, 1);
+ _roomAction = 0;
+ }
+}
+
+void RunawayRoomScene::drawScene2080(Graphics::ManagedSurface &viewport, bool foreground) {
+ if (!foreground) {
+ if (_roomAction == 302) {
+ uint frame = MIN<uint>(19, _actionStep);
+ if (_actionStage == 1)
+ frame = 19 + speechFrame();
+ else if (_actionStage == 2)
+ frame = _hospital.markerTaken ? 19 - MIN<uint>(18, _actionStep) : _actionStep ? 30 + _actionStep : 19;
+ _ambient.draw(viewport, frame, 0, 0);
+ } else {
+ _ambient.draw(viewport, 42, 0, 0);
+ if (_roomAction == 307)
+ _actionAnimation.draw(viewport, kFillGlassFrames[MIN<uint>(_actionStep, ARRAYSIZE(kFillGlassFrames) - 1)], 0, 0);
+ }
+ } else if (_roomAction != 302 && _roomAction != 307) {
+ if (_position.x < 300)
+ drawForeground(viewport, 1);
+ else if (_position.x > 350)
+ drawForeground(viewport, 0);
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
index cdb1d82f993..f2c73e7eb50 100644
--- a/engines/hollywood/runaway/scene_data.h
+++ b/engines/hollywood/runaway/scene_data.h
@@ -28,6 +28,7 @@ namespace Hollywood {
enum RunawayRoomId {
kHospitalBedroom = 2020,
+ kHospitalBathroom = 2080,
kMuseumOffice = 4030,
kMuseumLaboratory = 4050,
kMuseumHall = 4060,
@@ -45,9 +46,12 @@ struct RunawayHotspot {
};
struct RunawayItemAction {
+ constexpr RunawayItemAction(uint16 roomId, byte itemId, byte hotspotId, uint16 actionId, bool walk = true) :
+ room(roomId), item(itemId), hotspot(hotspotId), action(actionId), approach(walk) {}
uint16 room;
byte item, hotspot;
uint16 action;
+ bool approach;
};
struct RunawayResponse {
@@ -77,6 +81,7 @@ struct RunawayRoom {
};
extern const RunawayRoom kRunawayScene2020;
+extern const RunawayRoom kRunawayScene2080;
extern const RunawayRoom kRunawayScene4030;
extern const RunawayRoom kRunawayScene4050;
extern const RunawayRoom kRunawayScene4060;
diff --git a/engines/hollywood/runaway/ui.cpp b/engines/hollywood/runaway/ui.cpp
index 67edb2fcb76..49fb5648914 100644
--- a/engines/hollywood/runaway/ui.cpp
+++ b/engines/hollywood/runaway/ui.cpp
@@ -442,6 +442,14 @@ void RunawayUI::drawInventory(Graphics::ManagedSurface &screen) {
}
}
+void RunawayUI::drawSubtitle(Graphics::ManagedSurface &screen, const Common::U32String &text) const {
+ Common::Array<Common::U32String> lines;
+ _font.wordWrapText(text, 984, lines);
+ for (uint i = 0; i < MIN<uint>(3, lines.size()); ++i)
+ _font.drawString(screen.surfacePtr(), lines[i], 20, 684 + i * 28, 984,
+ kUIFormat.RGBToColor(255, 223, 206), Graphics::kTextAlignCenter);
+}
+
void RunawayUI::draw(Graphics::ManagedSurface &screen, const Common::U32String &roomCaption,
const Common::U32String &committedCaption, const Common::U32String &subtitle, bool showSubtitles) {
if (_inventoryOpen)
@@ -450,13 +458,8 @@ void RunawayUI::draw(Graphics::ManagedSurface &screen, const Common::U32String &
screen.copyRectToSurface(button, kButtonX, 0, Common::Rect(_buttonFrame * 100, 0, (_buttonFrame + 1) * 100, 74));
screen.copyRectToSurface(_optionsButton, 612, 0, Common::Rect(_optionsFrame * 100, 0, (_optionsFrame + 1) * 100, 74));
if (_speaking) {
- if (showSubtitles) {
- Common::Array<Common::U32String> lines;
- _font.wordWrapText(subtitle, 984, lines);
- for (uint i = 0; i < MIN<uint>(3, lines.size()); ++i)
- _font.drawString(screen.surfacePtr(), lines[i], 20, 684 + i * 28, 984,
- kUIFormat.RGBToColor(255, 223, 206), Graphics::kTextAlignCenter);
- }
+ if (showSubtitles)
+ drawSubtitle(screen, subtitle);
} else {
Common::U32String caption;
uint16 color = kUIFormat.RGBToColor(189, 166, 148);
diff --git a/engines/hollywood/runaway/ui.h b/engines/hollywood/runaway/ui.h
index 690b09237bb..990ae3db4e0 100644
--- a/engines/hollywood/runaway/ui.h
+++ b/engines/hollywood/runaway/ui.h
@@ -57,6 +57,7 @@ public:
void captureState(RunawaySaveState &state) const;
void restoreState(const RunawaySaveState &state, uint32 now);
void setPointerSound(bool enabled) { _pointerSound = enabled; }
+ void drawSubtitle(Graphics::ManagedSurface &screen, const Common::U32String &text) const;
void draw(Graphics::ManagedSurface &screen, const Common::U32String &roomCaption,
const Common::U32String &committedCaption, const Common::U32String &subtitle, bool showSubtitles);
diff --git a/engines/hollywood/runaway/video.cpp b/engines/hollywood/runaway/video.cpp
index ec48ecbedc0..b1fa9cf27dd 100644
--- a/engines/hollywood/runaway/video.cpp
+++ b/engines/hollywood/runaway/video.cpp
@@ -80,6 +80,12 @@ void RunawayVideo::close() {
_data.clear();
}
+uint RunawayVideo::frameAtTime(uint32 milliseconds) const {
+ const Audio::Timestamp duration = _decoder.getDuration();
+ const uint frames = duration.totalNumberOfFrames();
+ return frames ? (uint64)milliseconds * frameCount() * duration.framerate() / (1000ULL * frames) : 0;
+}
+
bool RunawayVideo::decodeToFrame(uint frame) {
if (frame >= _decoder.getFrameCount())
return false;
diff --git a/engines/hollywood/runaway/video.h b/engines/hollywood/runaway/video.h
index 7fda962a1ef..e70896773ab 100644
--- a/engines/hollywood/runaway/video.h
+++ b/engines/hollywood/runaway/video.h
@@ -36,6 +36,7 @@ public:
void close();
bool decodeToFrame(uint frame);
uint frameCount() const { return _decoder.getFrameCount(); }
+ uint frameAtTime(uint32 milliseconds) const;
void draw(Graphics::ManagedSurface &surface, const Common::Rect &destination) const;
private:
Commit: 1d789c6b4902cee140b39fd925dadc6c50240553
https://github.com/scummvm/scummvm/commit/1d789c6b4902cee140b39fd925dadc6c50240553
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: implemented scene 2060
Changed paths:
A engines/hollywood/runaway/scene2060.cpp
A engines/hollywood/runaway/sequence.cpp
A engines/hollywood/runaway/sequence.h
engines/hollywood/module.mk
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/inventory.h
engines/hollywood/runaway/saveload.cpp
engines/hollywood/runaway/saveload.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene2020.cpp
engines/hollywood/runaway/scene2080.cpp
engines/hollywood/runaway/scene_data.h
engines/hollywood/runaway/video.cpp
engines/hollywood/runaway/video.h
diff --git a/engines/hollywood/module.mk b/engines/hollywood/module.mk
index d5c0d381e2e..126d3220046 100644
--- a/engines/hollywood/module.mk
+++ b/engines/hollywood/module.mk
@@ -152,6 +152,7 @@ MODULE_OBJS = \
runaway/scene.o \
runaway/scene2010.o \
runaway/scene2020.o \
+ runaway/scene2060.o \
runaway/scene2080.o \
runaway/scene4030.o \
runaway/scene4050.o \
@@ -160,6 +161,7 @@ MODULE_OBJS = \
runaway/scene4100.o \
runaway/scene4140.o \
runaway/scene5030.o \
+ runaway/sequence.o \
runaway/strings.o \
runaway/ui.o \
runaway/video.o
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index 7066e99edaa..43ad2527613 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -163,7 +163,7 @@ Common::Error RunawayEngine::loadGameStream(Common::SeekableReadStream *stream)
RunawayScene *RunawayEngine::createScene(uint16 entryScene) {
if (findRunawayRoom(entryScene) && ((_museum && entryScene >= 4000) ||
- (_game == kRunawayFullGame && (entryScene == 2020 || entryScene == 2021 || entryScene == 2080))))
+ (_game == kRunawayFullGame && entryScene / 1000 == 2)))
return new RunawayRoomScene(_audio, *_inventory, _strings, _game);
if (_game == kRunawayCabinDemo && entryScene == 5030)
return new RunawayScene5030(_mixer, _audio, *_inventory, _strings);
@@ -185,7 +185,7 @@ Common::Error RunawayEngine::changeScene() {
state.x = transition.position.x;
state.y = transition.position.y;
state.facing = transition.facing;
- state.camera = state.scene == 2021 ? 156 : 0;
+ state.camera = state.scene >= 2020 && state.scene <= 2023 ? 156 : 0;
state.cameraY = 0;
Common::ScopedPtr<RunawayScene> scene(createScene(state.scene));
if (!scene)
@@ -461,9 +461,12 @@ Common::Error RunawayEngine::run() {
leftPressed = rightPressed = false;
continue;
}
- // The extended French demo's later rooms are not implemented yet;
- // all three releases currently finish at the shared shack escape.
if (_scene->escaped()) {
+ // Retail currently ends after the hospital chapter.
+ if (_game == kRunawayFullGame)
+ return Common::kNoError;
+ // The extended French demo's later rooms are not implemented yet;
+ // all three releases currently finish at the shared shack escape.
const Common::Error result = playEnding(menu);
if (!_loadedGame || result.getCode() != Common::kNoError || shouldQuit())
return result;
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index dbea7ce1115..953328adff9 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -58,6 +58,10 @@ void RunawayInventory::captureState(RunawaySaveState &state) const {
state.selected = _selected;
state.cloth = _clothState;
state.water = _water;
+ state.markerInk = _markerInk;
+ state.syringeFilled = _syringeFilled;
+ state.chartWritten = _chartWritten;
+ state.headWig = _headWig;
}
void RunawayInventory::restoreState(const RunawaySaveState &state) {
@@ -68,6 +72,10 @@ void RunawayInventory::restoreState(const RunawaySaveState &state) {
_selected = state.selected;
_clothState = state.cloth;
_water = state.water;
+ _markerInk = state.markerInk;
+ _syringeFilled = state.syringeFilled;
+ _chartWritten = state.chartWritten;
+ _headWig = state.headWig;
_newItem = 0;
}
@@ -101,6 +109,16 @@ void RunawayInventory::remove(byte item) {
}
Common::U32String RunawayInventory::name(byte item) const {
+ if (_game == kRunawayFullGame) {
+ if (item == 11 && _markerInk == 1)
+ return Common::U32String("Dry marker pen");
+ if (item == 15 && _syringeFilled)
+ return Common::U32String("Syringe with alcohol");
+ if (item == 16 && _chartWritten)
+ return Common::U32String("Fake medical chart");
+ if (item == 17 && _headWig)
+ return Common::U32String("Head with wig");
+ }
if (_game == kRunawayFullGame && item == 13 && _water == 1)
return Common::U32String("Glass with water");
if (_game == kRunawayMuseumDemo)
@@ -113,6 +131,14 @@ Common::U32String RunawayInventory::name(byte item) const {
}
uint RunawayInventory::icon(byte item) const {
+ if (_game == kRunawayFullGame) {
+ if (item == 15 && _syringeFilled)
+ return 20;
+ if (item == 16 && _chartWritten)
+ return 22;
+ if (item == 17 && _headWig)
+ return 21;
+ }
if (_game == kRunawayFullGame && item == 13 && _water == 1)
return 23;
if (_game != kRunawayCabinDemo)
@@ -123,6 +149,14 @@ uint RunawayInventory::icon(byte item) const {
}
uint RunawayInventory::cursor(byte item) const {
+ if (_game == kRunawayFullGame) {
+ if (item == 15 && _syringeFilled)
+ return 77;
+ if (item == 16 && _chartWritten)
+ return 83;
+ if (item == 17 && _headWig)
+ return 79;
+ }
if (_game == kRunawayFullGame && item == 13 && _water == 1)
return 85;
if (_game == kRunawayMuseumDemo)
@@ -135,6 +169,16 @@ uint RunawayInventory::cursor(byte item) const {
}
RunawayInventory::Reply RunawayInventory::examine(byte item) const {
+ if (_game == kRunawayFullGame) {
+ if (item == 11)
+ return Reply(60, _markerInk >= 2 ? 2 : _markerInk);
+ if (item == 15)
+ return Reply(64, _syringeFilled);
+ if (item == 16)
+ return Reply(65, _chartWritten);
+ if (item == 17)
+ return Reply(66, _headWig);
+ }
if (_game == kRunawayFullGame && item == 13)
return Reply(62, _water == 1 ? 1 : 0);
if (_game == kRunawayMuseumDemo) {
@@ -148,12 +192,54 @@ RunawayInventory::Reply RunawayInventory::examine(byte item) const {
}
RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
- if (_game != kRunawayCabinDemo)
- return Reply();
if (!contains(first) || !contains(second) || first == second)
return Reply();
if (first > second)
SWAP(first, second);
+ if (_game == kRunawayFullGame) {
+ if (first == 10 && second == 17) {
+ _headWig = 1;
+ remove(10);
+ return Reply(71);
+ }
+ if (first == 11 && second == 16) {
+ if (_markerInk < 2) {
+ const byte previous = _markerInk;
+ _markerInk = 1;
+ return Reply(72, previous);
+ }
+ if (_chartWritten)
+ return Reply(72, 3);
+ _chartWritten = 1;
+ _markerInk = 3;
+ return Reply(72, 2);
+ }
+ if (first == 12 && second == 15) {
+ const byte previous = _syringeFilled;
+ _syringeFilled = 1;
+ return Reply(69, previous);
+ }
+ if (first == 11 && second == 15) {
+ if (!_syringeFilled)
+ return Reply(73);
+ if (_markerInk >= 2)
+ return Reply(73, 2);
+ _markerInk = 2;
+ _syringeFilled = 0;
+ return Reply(73, 1);
+ }
+ if (first == 11 && second == 12)
+ return Reply(70);
+ if (first == 12 && second == 13)
+ return Reply(70, 2);
+ if (first == 13 && second == 15)
+ return Reply(70, 1);
+ if (first == 6 && second == 11)
+ return Reply(72, 4);
+ return Reply();
+ }
+ if (_game != kRunawayCabinDemo)
+ return Reply();
// The combinations available among the shack's items, from 0x4158c0
// and 0x415bd0. A failed combination leaves both items in place.
if (first == 1 && second == 3) {
diff --git a/engines/hollywood/runaway/inventory.h b/engines/hollywood/runaway/inventory.h
index a0887c60443..e17dd655b85 100644
--- a/engines/hollywood/runaway/inventory.h
+++ b/engines/hollywood/runaway/inventory.h
@@ -59,6 +59,8 @@ public:
void soilCloth() { _clothState = 2; }
byte water() const { return _water; }
void setWater(byte water) { _water = water; }
+ bool chartWritten() const { return _chartWritten; }
+ bool headWig() const { return _headWig; }
void captureState(RunawaySaveState &state) const;
void restoreState(const RunawaySaveState &state);
@@ -68,6 +70,7 @@ private:
Common::Array<byte> _items;
byte _selected = 0, _newItem = 0, _clothState = 0;
byte _water = 0;
+ byte _markerInk = 0, _syringeFilled = 0, _chartWritten = 0, _headWig = 0;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/saveload.cpp b/engines/hollywood/runaway/saveload.cpp
index f9b9a923e2b..9df529907dc 100644
--- a/engines/hollywood/runaway/saveload.cpp
+++ b/engines/hollywood/runaway/saveload.cpp
@@ -67,6 +67,23 @@ void RunawaySaveState::sync(Common::Serializer &s) {
s.syncAsByte(hospital.markerTaken, 4);
s.syncAsByte(hospital.alcohol, 4);
s.syncAsByte(water, 4);
+ s.syncAsByte(hospital.window, 5);
+ s.syncAsByte(hospital.chartReplaced, 5);
+ s.syncAsByte(hospital.chartMoved, 5);
+ s.syncAsByte(hospital.decoy, 5);
+ s.syncAsByte(hospital.attacked, 5);
+ s.syncAsByte(hospital.medicineRead, 5);
+ s.syncAsByte(hospital.storeroomVisited, 5);
+ s.syncAsByte(hospital.syringesSeen, 5);
+ s.syncAsByte(hospital.sprayTaken, 5);
+ s.syncAsByte(hospital.book, 5);
+ s.syncAsByte(hospital.blankChart, 5);
+ s.syncAsByte(hospital.headTaken, 5);
+ s.syncAsByte(hospital.pillowsTaken, 5);
+ s.syncAsByte(markerInk, 5);
+ s.syncAsByte(syringeFilled, 5);
+ s.syncAsByte(chartWritten, 5);
+ s.syncAsByte(headWig, 5);
}
byte RunawaySaveState::chapter() const {
@@ -102,9 +119,15 @@ bool RunawaySaveState::valid() const {
if (hospital.glassTaken > 1 || hospital.pillsTaken > 1 || hospital.sheetTaken > 1 ||
hospital.bagTaken > 1 || hospital.exitMapRead > 1 || hospital.markerTaken > 1 || hospital.alcohol > 2 || water > 2)
return false;
+ if (hospital.window > 2 || hospital.chartReplaced > 1 || hospital.chartMoved > 1 ||
+ hospital.decoy > 1 || hospital.attacked > 1 || hospital.medicineRead > 1 ||
+ hospital.storeroomVisited > 1 || hospital.syringesSeen > 1 || hospital.sprayTaken > 1 ||
+ hospital.book > 2 || hospital.blankChart > 2 || hospital.headTaken > 1 || hospital.pillowsTaken > 1 ||
+ markerInk > 3 || syringeFilled > 1 || chartWritten > 1 || headWig > 1)
+ return false;
if (game == kRunawayFullGame) {
const RunawayRoom *room = findRunawayRoom(scene);
- if (!room || (room->number != kHospitalBedroom && room->number != kHospitalBathroom) ||
+ if (!room || (room->number != kHospitalBedroom && room->number != kHospitalStoreroom && room->number != kHospitalBathroom) ||
x >= room->width || y >= room->height || cameraY ||
camera < (room->number == kHospitalBedroom ? 156 : 0) || camera > room->width - 1024)
return false;
@@ -130,7 +153,7 @@ bool RunawaySaveState::read(Common::SeekableReadStream &stream) {
if (stream.readUint32BE() != MKTAG('R', 'U', 'N', 'A'))
return false;
const uint16 version = stream.readUint16LE();
- if (version < 1 || version > 4)
+ if (version < 1 || version > 5)
return false;
Common::Serializer s(&stream, nullptr);
s.setVersion(version);
@@ -142,9 +165,9 @@ bool RunawaySaveState::write(Common::WriteStream &stream) {
if (!valid())
return false;
stream.writeUint32BE(MKTAG('R', 'U', 'N', 'A'));
- stream.writeUint16LE(4);
+ stream.writeUint16LE(5);
Common::Serializer s(nullptr, &stream);
- s.setVersion(4);
+ s.setVersion(5);
sync(s);
return !s.err();
}
diff --git a/engines/hollywood/runaway/saveload.h b/engines/hollywood/runaway/saveload.h
index 0fda8b060a2..3a9024dd5d3 100644
--- a/engines/hollywood/runaway/saveload.h
+++ b/engines/hollywood/runaway/saveload.h
@@ -33,6 +33,8 @@ struct RunawaySaveState {
struct Hospital {
byte glassTaken = 0, pillsTaken = 0, sheetTaken = 0, bagTaken = 0, exitMapRead = 0;
byte markerTaken = 0, alcohol = 0;
+ byte window = 0, chartReplaced = 0, chartMoved = 0, decoy = 0, attacked = 0, medicineRead = 0;
+ byte storeroomVisited = 0, syringesSeen = 0, sprayTaken = 0, book = 0, blankChart = 0, headTaken = 0, pillowsTaken = 0;
} hospital;
uint16 scene = 5030, x = 623, y = 447, camera = 111;
@@ -47,6 +49,7 @@ struct RunawaySaveState {
byte upperFloor = 1, books = 0, recorder = 0, moneyIdentified = 0, safeOpen = 0;
byte varnishTaken = 0, talcTaken = 0, coffeeTaken = 0, keyCount = 0;
byte water = 0;
+ byte markerInk = 0, syringeFilled = 0, chartWritten = 0, headWig = 0;
byte chapter() const;
bool valid() const;
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index b8fb3ba6572..6146d0dc08f 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -36,7 +36,7 @@ namespace Hollywood {
namespace {
const RunawayRoom *const kRooms[] = {
- &kRunawayScene2020, &kRunawayScene2080,
+ &kRunawayScene2020, &kRunawayScene2060, &kRunawayScene2080,
&kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140
};
@@ -62,7 +62,7 @@ const RunawayResponse kGlobalResponses[] = {
};
const RunawayRoom *findRoom(int number) {
- if (number == 2021)
+ if (number >= 2021 && number <= 2023)
number = kHospitalBedroom;
for (uint i = 0; i < ARRAYSIZE(kRooms); ++i) {
if (kRooms[i]->number == number)
@@ -78,7 +78,7 @@ const RunawayRoom *findRunawayRoom(uint16 number) {
}
RunawayRoomScene::RunawayRoomScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings, RunawayGameType game) :
- _audio(audio), _inventory(inventory), _strings(strings), _game(game), _random("runaway") {}
+ _audio(audio), _sequence(audio), _inventory(inventory), _strings(strings), _game(game), _random("runaway") {}
bool RunawayRoomScene::load(uint16 entryScene) {
const RunawayRoom *room = findRoom(entryScene);
@@ -107,17 +107,27 @@ void RunawayRoomScene::start(uint32 now) {
void RunawayRoomScene::resume() {
if (_game == kRunawayFullGame) {
+ if (_sequence.active())
+ return;
if (!_audio.musicPlaying())
_audio.playMusic(11, false);
if (_room == kHospitalBedroom)
_audio.playEffect(30, 3, 1, true);
if (_entering) {
- _audio.playEffect(48);
if (_room == kHospitalBathroom) {
+ _audio.playEffect(48);
walkTo(Common::Point(227, 546), 1, true);
- } else if (_inventory.water() == 1) {
- // The cracked glass has drained by the time Brian returns.
- _inventory.setWater(2);
+ } else {
+ if (_inventory.water() == 1)
+ _inventory.setWater(2);
+ if (_room == kHospitalStoreroom || _entryScene == 2022) {
+ static const byte frames[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
+ beginHospitalAnimation(_entryScene, _room == kHospitalStoreroom ? 10 : 23, 13, frames, ARRAYSIZE(frames));
+ } else if (_entryScene == 2023) {
+ startHospitalFilm(kAmbushFilm);
+ } else {
+ _audio.playEffect(48);
+ }
}
_entering = false;
}
@@ -275,6 +285,8 @@ bool RunawayRoomScene::rebuildBackground() {
switch (_room) {
case kHospitalBedroom:
return applyBackground2020();
+ case kHospitalStoreroom:
+ return applyBackground2060();
case kHospitalBathroom:
return applyBackground2080();
case kMuseumOffice:
@@ -292,6 +304,9 @@ void RunawayRoomScene::updateMaps() {
case kHospitalBedroom:
updateMaps2020();
break;
+ case kHospitalStoreroom:
+ updateMaps2060();
+ break;
case kHospitalBathroom:
updateMaps2080();
break;
@@ -331,6 +346,20 @@ Common::U32String RunawayRoomScene::hotspotName(byte id) const {
return Common::U32String();
if (_room == kHospitalBathroom && id == 4 && _hospital.alcohol == 2)
return Common::U32String("Bottle of alcohol");
+ if (_room == kHospitalBedroom) {
+ if (id == 9 && _hospital.chartReplaced)
+ return Common::U32String("Fake medical chart");
+ if (id == 10 && _hospital.chartMoved)
+ return Common::U32String("Gina's medical chart");
+ }
+ if (_room == kHospitalStoreroom) {
+ if (id == 3 && _hospital.syringesSeen)
+ return Common::U32String("Box of syringes");
+ if (id == 5 && _hospital.book)
+ return Common::U32String("Vademecum");
+ if (id == 6 && _hospital.blankChart)
+ return Common::U32String("Medical chart");
+ }
return _room == kMuseumOffice ? hotspotName4030(id) : Common::U32String(spot->name);
}
@@ -460,6 +489,10 @@ void RunawayRoomScene::sayInventory(const RunawayInventory::Reply &reply) {
}
void RunawayRoomScene::skipSpeech() {
+ if (_sequence.active()) {
+ _sequence.skip();
+ return;
+ }
if (!speaking())
return;
_audio.stopSpeech();
@@ -492,6 +525,9 @@ void RunawayRoomScene::execute(uint16 action) {
case kHospitalBedroom:
result = execute2020(action);
break;
+ case kHospitalStoreroom:
+ result = execute2060(action);
+ break;
case kHospitalBathroom:
result = execute2080(action);
break;
@@ -562,6 +598,8 @@ float RunawayRoomScene::actorHeight() const {
switch (_room) {
case kHospitalBedroom:
return actorHeight2020();
+ case kHospitalStoreroom:
+ return _position.y * 3.55555558f - 1550.33337f;
case kHospitalBathroom:
return _position.y * 0.266272187f + 295.502960f;
case kMuseumOffice:
@@ -583,6 +621,12 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
_now = now;
const uint elapsed = MIN<uint>(100, now - _lastUpdate);
_lastUpdate = now;
+ if (_sequence.active()) {
+ _sequence.update(now);
+ if (!_sequence.active())
+ finishHospitalFilm();
+ return;
+ }
if (_pressedKey && (int32)(now - _keyUntil) >= 0)
_pressedKey = 0;
if (speaking() && (int32)(now - _subtitleUntil) >= 0)
@@ -592,6 +636,10 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
else if (_room == kHospitalBathroom)
update2080();
if (_game == kRunawayFullGame) {
+ if (_room != kHospitalBathroom)
+ updateHospitalAnimation();
+ if (_sequence.active() || _transition.scene)
+ return;
updateHospitalAudio();
if (_hospitalExit.scene && !_audio.effectPlaying()) {
_transition = _hospitalExit;
@@ -656,6 +704,10 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
}
void RunawayRoomScene::draw() {
+ if (_sequence.active()) {
+ _sequence.draw(_screen);
+ return;
+ }
_screen.clear();
_screen.copyRectToSurface(_background, 0, kRunawayViewportTop,
Common::Rect(_camera.x, _camera.y, _camera.x + kRunawayScreenWidth, _camera.y + kRunawayViewportHeight));
@@ -694,8 +746,11 @@ void RunawayRoomScene::draw() {
params.antialias = _antialias;
const byte light = MIN<byte>(9, _maps[768 + _mask[_position.y * _background.w + _position.x]]);
memcpy(params.light, findRoom(_room)->light[light], sizeof(params.light));
- if (_room != kHospitalBathroom || (_roomAction != 302 && _roomAction != 307))
+ const bool roomAnimation = !_actionFrames.empty() && _roomAction && !speaking() && _pathIndex == _path.size();
+ if (!roomAnimation && (_room != kHospitalBathroom || (_roomAction != 302 && _roomAction != 307)))
_actor.draw(_screen, params, _mask, _maps);
+ if (roomAnimation)
+ _actionAnimation.draw(viewport, _actionFrames[MIN<uint>(_actionStep, _actionFrames.size() - 1)], _camera.x, -_camera.y);
if (_room == kHospitalBedroom)
drawScene2020(viewport, true);
else if (_room == kHospitalBathroom)
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index aa5913db8d6..23811a06535 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -28,6 +28,7 @@
#include "hollywood/runaway/graphics.h"
#include "hollywood/runaway/inventory.h"
#include "hollywood/runaway/saveload.h"
+#include "hollywood/runaway/sequence.h"
#include "hollywood/scene_text_store.h"
namespace Hollywood {
@@ -94,10 +95,13 @@ public:
byte hotspotAt(Common::Point mouse) const override;
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _caption; }
- const Common::U32String &subtitle() const override { return _subtitle; }
- bool busy() const override { return _pendingHotspot != 0 || _transition.scene || _hospitalExit.scene || _arrivalFacing != 0xff || _hospitalEntryStep || _roomAction || speaking(); }
- bool speaking() const override { return !_subtitle.empty(); }
- byte speechFrame() const override { return _lipSync.frame(_now); }
+ const Common::U32String &subtitle() const override { return _sequence.active() ? _sequence.subtitle() : _subtitle; }
+ bool busy() const override { return _sequence.active() || _pendingHotspot != 0 || _transition.scene || _hospitalExit.scene || _arrivalFacing != 0xff || _hospitalEntryStep || _roomAction || speaking(); }
+ bool speaking() const override { return !subtitle().empty(); }
+ byte speechFrame() const override { return _sequence.active() ? _sequence.speechFrame() : _lipSync.frame(_now); }
+ bool playingVideo() const override { return _sequence.active(); }
+ void skipVideo() override { _sequence.skip(); }
+ bool escaped() const override { return _chapterComplete; }
void skipSpeech() override;
void sayInventory(const RunawayInventory::Reply &reply) override;
bool canSave() const override { return !busy() && _pathIndex == _path.size() && !_pressedKey; }
@@ -125,6 +129,12 @@ private:
void updateCamera();
void leaveHospitalRoom(uint16 scene, Common::Point position, byte facing);
void updateHospitalAudio();
+ enum HospitalFilm { kGinaStoryFilm, kLedgeFilm, kDecoyFilm, kAmbushFilm, kEscapeFilm };
+ void startHospitalFilm(HospitalFilm film);
+ void finishHospitalFilm();
+ void beginHospitalAnimation(uint16 action, uint chunk, uint frames, const byte *order = nullptr, uint count = 0);
+ void updateHospitalAnimation();
+ void finishHospitalAnimation(uint16 action);
float actorHeight() const;
const RunawayHotspot *hotspot(byte id) const;
Common::U32String hotspotName(byte id) const;
@@ -140,6 +150,9 @@ private:
ActionResult execute2020(uint16 action);
float actorHeight2020() const;
void drawScene2020(Graphics::ManagedSurface &viewport, bool foreground);
+ bool applyBackground2060();
+ void updateMaps2060();
+ ActionResult execute2060(uint16 action);
bool loadScene2080();
bool applyBackground2080();
void updateMaps2080();
@@ -179,6 +192,7 @@ private:
void drawScene4140(Graphics::ManagedSurface &viewport);
RunawayAudio &_audio;
+ RunawaySequence _sequence;
RunawayInventory &_inventory;
const RunawayStrings &_strings;
const RunawayGameType _game;
@@ -190,6 +204,7 @@ private:
RunawayActor _actor;
RunawayAnimation _ambient, _overlay, _safe;
RunawayAnimation _actionAnimation;
+ Common::Array<byte> _actionFrames;
Graphics::ManagedSurface _background, _screen;
Common::Array<byte> _mask, _originalMaps, _maps;
Common::Array<Common::Rect> _foreground[5];
@@ -227,6 +242,8 @@ private:
uint _actionStep = 0;
uint32 _actionStarted = 0;
Transition _hospitalExit;
+ HospitalFilm _hospitalFilm = kGinaStoryFilm;
+ bool _chapterComplete = false;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene2020.cpp b/engines/hollywood/runaway/scene2020.cpp
index 8f56a31504c..780f49ae905 100644
--- a/engines/hollywood/runaway/scene2020.cpp
+++ b/engines/hollywood/runaway/scene2020.cpp
@@ -19,8 +19,6 @@
*
*/
-#include "common/util.h"
-
#include "common/textconsole.h"
#include "common/util.h"
#include "hollywood/runaway/scene.h"
@@ -51,10 +49,6 @@ const RunawayHotspot kHotspots[] = {
{"Poster", 454, 455, 1, {329, 328}, {0, 0}},
{"Emergency exit map", 1265, 546, 1, {330, 331}, {1, 0}},
{"Bed", 404, 456, 1, {344, 345}, {0, 0}},
- {"", 0, 0, 0, {0, 0}, {0, 0}},
- {"", 0, 0, 0, {0, 0}, {0, 0}},
- {"", 0, 0, 0, {0, 0}, {0, 0}},
- {"Hallway door", 40, 599, 5, {351, 352}, {1, 0}},
};
const RunawayResponse kResponses[] = {
@@ -65,17 +59,10 @@ const RunawayResponse kResponses[] = {
{kHospitalBedroom, 310, 7, 0},
{kHospitalBedroom, 311, 8, 0},
{kHospitalBedroom, 312, 9, 0},
- {kHospitalBedroom, 314, 10, 0},
- {kHospitalBedroom, 315, 11, 0},
- {kHospitalBedroom, 316, 12, 0},
- {kHospitalBedroom, 317, 13, 0},
- {kHospitalBedroom, 318, 14, 0},
- {kHospitalBedroom, 319, 15, 0},
{kHospitalBedroom, 320, 16, 0},
{kHospitalBedroom, 321, 17, 0},
{kHospitalBedroom, 322, 18, 0},
{kHospitalBedroom, 323, 19, 0},
- {kHospitalBedroom, 324, 20, 0},
{kHospitalBedroom, 325, 21, 0},
{kHospitalBedroom, 326, 22, 0},
{kHospitalBedroom, 327, 23, 0},
@@ -83,15 +70,231 @@ const RunawayResponse kResponses[] = {
{kHospitalBedroom, 329, 25, 0},
{kHospitalBedroom, 331, 27, 0},
{kHospitalBedroom, 333, 29, 0},
- {kHospitalBedroom, 343, 37, 1},
{kHospitalBedroom, 344, 39, 0},
{kHospitalBedroom, 345, 40, 0},
};
const RunawayItemAction kItemActions[] = {
- {kHospitalBedroom, 5, 6, 333}, // Bag in the locker.
+ {kHospitalBedroom, 5, 6, 333, false},
+ {kHospitalBedroom, 6, 9, 334, false},
+ {kHospitalBedroom, 6, 10, 335},
{kHospitalBedroom, 9, 12, 343}, // Matches at the sprinkler.
+ {kHospitalBedroom, 10, 2, 336, false},
{kHospitalBedroom, 13, 2, 349}, // Water for Gina.
+ {kHospitalBedroom, 14, 19, 341, false},
+ {kHospitalBedroom, 15, 2, 337, false},
+ {kHospitalBedroom, 16, 9, 339},
+ {kHospitalBedroom, 16, 10, 338, false},
+ {kHospitalBedroom, 17, 19, 340},
+ {kHospitalBedroom, 18, 12, 342},
+};
+
+// Retail chapter-one film scripts, from 0x43c450..0x4403cb.
+const RunawaySequence::Command kGinaStory[] = {
+ {RunawaySequence::kOpen, 9},
+ {RunawaySequence::kMusic, 11, 255, 0},
+ {RunawaySequence::kPlay, 0, 28},
+ {RunawaySequence::kTalk, 83, 0, 1, 0},
+ {RunawaySequence::kTalk, 83, 1, 3, 0},
+ {RunawaySequence::kTalk, 83, 2, 1, 0},
+ {RunawaySequence::kTalk, 83, 3, 3, 0},
+ {RunawaySequence::kTalk, 83, 4, 1, 0},
+ {RunawaySequence::kTalk, 83, 5, 5, 0},
+ {RunawaySequence::kSpeech, 83, 6, 0},
+ {RunawaySequence::kPlay, 65, 105, RunawaySequence::kIdleDuringSpeech},
+ {RunawaySequence::kMusic, 29, 255, 0},
+ {RunawaySequence::kPlay, 106, 214},
+ {RunawaySequence::kEffect, 25, 102, 1, 1},
+ {RunawaySequence::kTalk, 83, 7, 7, 0},
+ {RunawaySequence::kPlay, 222, 254},
+ {RunawaySequence::kMusic, 25, 255, 1},
+ {RunawaySequence::kTalk, 83, 8, 9, 0},
+ {RunawaySequence::kTalk, 83, 9, 11, 0},
+ {RunawaySequence::kTalk, 83, 10, 9, 0},
+ {RunawaySequence::kTalk, 83, 11, 11, 0},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kPlay, 1608, 1632},
+ {RunawaySequence::kSpeech, 83, 12, 0},
+ {RunawaySequence::kPlay, 1633, 1687, RunawaySequence::kIdleDuringSpeech},
+ {RunawaySequence::kTalk, 83, 13, 5, 0},
+ {RunawaySequence::kMusic, 26, 255, 0},
+ {RunawaySequence::kTalk, 83, 14, 5, 1},
+ {RunawaySequence::kTalk, 83, 15, 5, 0},
+ {RunawaySequence::kSpeech, 83, 16, 0},
+ {RunawaySequence::kPlay, 1632, 1687, RunawaySequence::kIdleDuringSpeech},
+ {RunawaySequence::kMusic, 27, 255, 1},
+ {RunawaySequence::kPlay, 1688, 1713},
+ {RunawaySequence::kTalk, 83, 17, 15, 0},
+ {RunawaySequence::kPlay, 302, 324},
+ {RunawaySequence::kTalk, 83, 18, 13, 0},
+ {RunawaySequence::kEffect, 22, 255, 0, 0},
+ {RunawaySequence::kPlay, 336, 350},
+ {RunawaySequence::kSpeech, 83, 19, 22},
+ {RunawaySequence::kPlay, 351, 990},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kTalk, 83, 23, 15, 0},
+ {RunawaySequence::kPlay, 1003, 1025},
+ {RunawaySequence::kTalk, 83, 24, 17, 0},
+ {RunawaySequence::kPlay, 1038, 1117},
+ {RunawaySequence::kTalk, 83, 25, 19, 0},
+ {RunawaySequence::kEffect, 23, 255, 0, 0},
+ {RunawaySequence::kPlay, 1129, 1146},
+ {RunawaySequence::kSpeech, 83, 26, 0},
+ {RunawaySequence::kPlay, 1147, 1208},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kTalk, 83, 27, 21, 0},
+ {RunawaySequence::kTalk, 83, 28, 23, 0},
+ {RunawaySequence::kEffect, 24, 255, 0, 0},
+ {RunawaySequence::kPlay, 1232, 1270},
+ {RunawaySequence::kSpeech, 83, 29, 0},
+ {RunawaySequence::kPlay, 1271, 1300},
+ {RunawaySequence::kSpeech, 83, 30, 0},
+ {RunawaySequence::kMusic, 24, 255, 1},
+ {RunawaySequence::kPlay, 1301, 1360},
+ {RunawaySequence::kSpeech, 83, 31, 0},
+ {RunawaySequence::kPlay, 1361, 1560},
+ {RunawaySequence::kMusic, 11, 255, 0},
+ {RunawaySequence::kSpeech, 83, 32, 0},
+ {RunawaySequence::kPlay, 1561, 1590},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kTalk, 83, 33, 25, 0},
+ {RunawaySequence::kTalk, 83, 34, 27, 0},
+ {RunawaySequence::kEnd},
+};
+
+const RunawaySequence::Command kLedgeCrossing[] = {
+ {RunawaySequence::kOpen, 1},
+ {RunawaySequence::kMusic, 28, 255, 1},
+ {RunawaySequence::kEffect, 19, 255, 0, 0},
+ {RunawaySequence::kPlay, 0, 151},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kEffect, 21, 255, 1, 1},
+ {RunawaySequence::kTalk, 70, 0, 1, 0},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kEffect, 20, 255, 0, 0},
+ {RunawaySequence::kPlay, 163, 315},
+ {RunawaySequence::kMusic, 11, 255, 0},
+ {RunawaySequence::kEnd},
+};
+
+const RunawaySequence::Command kBuildDecoy[] = {
+ {RunawaySequence::kOpen, 3},
+ {RunawaySequence::kEffect, 26, 255, 0, 0},
+ {RunawaySequence::kPlay, 0, 75},
+ {RunawaySequence::kEnd},
+};
+
+const RunawaySequence::Command kHospitalAmbush[] = {
+ {RunawaySequence::kOpen, 5},
+ {RunawaySequence::kMusic, 21, 255, 0},
+ {RunawaySequence::kEffect, 11, 255, 0, 0},
+ {RunawaySequence::kPlay, 0, 204},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kTalk, 81, 0, 0, 0},
+ {RunawaySequence::kPlay, 204, 310},
+ {RunawaySequence::kEffect, 12, 255, 0, 0},
+ {RunawaySequence::kPlay, 311, 318},
+ {RunawaySequence::kDelay, 2000},
+ {RunawaySequence::kPlay, 318, 388},
+ {RunawaySequence::kTalk, 81, 1, 0, 0},
+ {RunawaySequence::kMusic, 22, 255, 0},
+ {RunawaySequence::kPlay, 388, 412},
+ {RunawaySequence::kEffect, 13, 255, 0, 0},
+ {RunawaySequence::kPlay, 413, 496},
+ {RunawaySequence::kSpeech, 81, 2, 0},
+ {RunawaySequence::kPlay, 497, 531},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kEffect, 15, 255, 0, 0},
+ {RunawaySequence::kWaitEffect, 3000},
+ {RunawaySequence::kEffect, 14, 255, 0, 0},
+ {RunawaySequence::kDelay, 1000},
+ {RunawaySequence::kSpeech, 81, 3, 0},
+ {RunawaySequence::kPlay, 531, 590},
+ {RunawaySequence::kSpeech, 81, 4, 0},
+ {RunawaySequence::kPlay, 591, 679},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kMusic, 11, 255, 0},
+ {RunawaySequence::kEnd},
+};
+
+const RunawaySequence::Command kHospitalEscape[] = {
+ {RunawaySequence::kOpen, 6},
+ {RunawaySequence::kMusic, 23, 255, 0},
+ {RunawaySequence::kEffect, 39, 204, 0, 0},
+ {RunawaySequence::kPlay, 0, 118},
+ {RunawaySequence::kSpeech, 82, 0, 0},
+ {RunawaySequence::kPlay, 119, 160},
+ {RunawaySequence::kSpeech, 82, 1, 0},
+ {RunawaySequence::kPlay, 161, 210},
+ {RunawaySequence::kSpeech, 82, 2, 0},
+ {RunawaySequence::kPlay, 211, 248},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kMusic, 24, 255, 1},
+ {RunawaySequence::kSpeech, 82, 3, 5},
+ {RunawaySequence::kPlay, 249, 649, RunawaySequence::kLoopDuringSpeech},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kEffect, 40, 255, 0, 0},
+ {RunawaySequence::kPlay, 650, 950},
+ {RunawaySequence::kOpen, 2},
+ {RunawaySequence::kMusic, 18, 255, 1},
+ {RunawaySequence::kEffect, 30, 3, 1, 1},
+ {RunawaySequence::kEffect, 16, 255, 0, 0},
+ {RunawaySequence::kPlay, 0, 100},
+ {RunawaySequence::kSpeech, 80, 0, 0},
+ {RunawaySequence::kSpeech, 80, 2, 0},
+ {RunawaySequence::kPlay, 101, 400},
+ {RunawaySequence::kEffect, 18, 51, 0, 0},
+ {RunawaySequence::kPlay, 401, 719, RunawaySequence::kUntilSpeechEnds},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kPlay, 875, 932},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kTalk, 80, 3, 1, 0},
+ {RunawaySequence::kPlay, 820, 863},
+ {RunawaySequence::kTalk, 80, 4, 3, 0},
+ {RunawaySequence::kTalk, 80, 5, 1, 0},
+ {RunawaySequence::kTalk, 80, 6, 3, 0},
+ {RunawaySequence::kTalk, 80, 7, 1, 0},
+ {RunawaySequence::kEffect, 30, 3, 1, 1},
+ {RunawaySequence::kSpeech, 80, 8, 11},
+ {RunawaySequence::kPlay, 200, 719, RunawaySequence::kLoopDuringSpeech},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kTalk, 80, 12, 3, 0},
+ {RunawaySequence::kTalk, 80, 13, 3, 1},
+ {RunawaySequence::kEffect, 30, 3, 1, 1},
+ {RunawaySequence::kEffect, 17, 255, 0, 0},
+ {RunawaySequence::kSpeech, 80, 14, 0},
+ {RunawaySequence::kPlay, 720, 819},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kStopEffects},
+ {RunawaySequence::kOpen, 7},
+ {RunawaySequence::kMusic, 31, 255, 1},
+ {RunawaySequence::kPlay, 0, 36},
+ {RunawaySequence::kTalk, 84, 1, 0, 0},
+ {RunawaySequence::kTalk, 84, 2, 0, 0},
+ {RunawaySequence::kTalk, 84, 3, 0, 0},
+ {RunawaySequence::kTalk, 84, 4, 0, 0},
+ {RunawaySequence::kTalk, 84, 5, 0, 0},
+ {RunawaySequence::kTalk, 84, 6, 0, 0},
+ {RunawaySequence::kTalk, 84, 7, 0, 0},
+ {RunawaySequence::kEffect, 44, 153, 0, 0},
+ {RunawaySequence::kPlay, 37, 40},
+ {RunawaySequence::kSpeech, 84, 8, 0},
+ {RunawaySequence::kPlay, 41, 236},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kTalk, 84, 9, 1, 0},
+ {RunawaySequence::kTalk, 84, 10, 3, 0},
+ {RunawaySequence::kTalk, 84, 11, 5, 0},
+ {RunawaySequence::kTalk, 84, 12, 3, 0},
+ {RunawaySequence::kTalk, 84, 13, 5, 0},
+ {RunawaySequence::kTalk, 84, 14, 3, 0},
+ {RunawaySequence::kTalk, 84, 15, 3, 1},
+ {RunawaySequence::kTalk, 84, 16, 5, 0},
+ {RunawaySequence::kPlay, 272, 284},
+ {RunawaySequence::kSpeech, 84, 17, 0},
+ {RunawaySequence::kPlay, 285, 371},
+ {RunawaySequence::kWaitSpeech},
+ {RunawaySequence::kDelay, 1000},
+ {RunawaySequence::kEnd},
};
} // End of anonymous namespace
@@ -106,6 +309,7 @@ const RunawayRoom kRunawayScene2020 = {
bool RunawayRoomScene::loadScene2020() {
return loadForeground(0, 12) && loadForeground(1, 14) && loadForeground(2, 11, true) &&
+ loadForeground(3, 15) && _safe.load(_archive, 5, 1) &&
_ambient.load(_archive, 22, 19) && _overlay.load(_archive, 17, 1) &&
_archive.readVariableChunk(20, _monitorPatches[0]) && _archive.readVariableChunk(21, _monitorPatches[1]);
}
@@ -115,15 +319,14 @@ void RunawayRoomScene::start2020() {
_inventory.add(item);
_inventory.takeNewItem();
_facing = 7;
- _hospitalEntryStep = 1;
- say(0);
+ startHospitalFilm(kGinaStoryFilm);
}
bool RunawayRoomScene::applyBackground2020() {
if ((_hospital.glassTaken && !applyPatch(8)) || (_hospital.pillsTaken && !applyPatch(9)) ||
(_hospital.sheetTaken && !applyPatch(7)) || (_hospital.bagTaken && !applyPatch(6)))
return false;
- return applyPatch(11) && applyRunawayPatch(_monitorPatches[1], _background) &&
+ return (!_hospital.decoy || applyPatch(13)) && applyPatch(11) && applyRunawayPatch(_monitorPatches[1], _background) &&
applyRunawayPatch(_monitorPatches[0], _background);
}
@@ -134,8 +337,10 @@ void RunawayRoomScene::updateMaps2020() {
_maps[i] = 0;
byte &id = _maps[256 + i];
if ((_hospital.glassTaken && id == 3) || (_hospital.pillsTaken && id == 4) ||
- (_hospital.bagTaken && id == 7) || id == 11)
+ (_hospital.bagTaken && id == 7) || (id == 11 && !_hospital.decoy))
id = 0;
+ else if (_hospital.decoy && (id == 20 || id == 21))
+ id = 11;
else if (id == 5 || id == 21)
id = _hospital.sheetTaken ? 19 : 5;
else if (id == 20)
@@ -144,11 +349,31 @@ void RunawayRoomScene::updateMaps2020() {
}
bool RunawayRoomScene::sayHospitalInventory(const RunawayInventory::Reply &reply) {
+ if (reply.cue == 68) {
+ if (!_hospital.attacked) {
+ say(68, 0, true);
+ } else if (!_inventory.contains(8)) {
+ say(68, 1, true);
+ } else {
+ say(68, 2, true);
+ say(68, 3, true);
+ _hospital.medicineRead = 1;
+ }
+ _audio.playEffect(35, 179);
+ return true;
+ }
+ if ((reply.cue == 69 && reply.variation == 0) || (reply.cue == 73 && reply.variation == 1) ||
+ (reply.cue == 72 && reply.variation == 2)) {
+ _audio.playEffect(reply.cue == 69 ? 36 : reply.cue == 73 ? 37 : 34, 179);
+ }
if (reply.cue != 54)
return false;
// Searching Gina's bag reveals the matches on the first examination.
say(54, 1, true);
- if (_inventory.contains(9)) {
+ if (_inventory.contains(9) && _inventory.contains(17) && !_inventory.headWig() && !_inventory.contains(10)) {
+ _inventory.add(10);
+ say(54, 4, true);
+ } else if (_inventory.contains(9)) {
say(54, _random.getRandomBit() ? 3 : 5, true);
} else {
_inventory.add(9);
@@ -160,10 +385,10 @@ bool RunawayRoomScene::sayHospitalInventory(const RunawayInventory::Reply &reply
RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
switch (action) {
case 302:
- say(2, _random.getRandomNumber(2));
+ say(2, _random.getRandomNumber(2) + (_hospital.attacked ? 3 : 0));
return kHandled;
case 303:
- say(3, _random.getRandomBit());
+ say(3, _random.getRandomBit() + (_hospital.attacked ? 2 : 0));
return kHandled;
case 305:
_hospital.glassTaken = 1;
@@ -192,7 +417,7 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
case 330:
if (!_hospital.exitMapRead)
say(26);
- say(26, 1);
+ say(26, _hospital.window ? 2 : 1);
_hospital.exitMapRead = 1;
return kHandled;
case 332:
@@ -200,20 +425,104 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
say(28);
return kHandled;
}
- // The ledge (2060) and bathroom (2080) have separate scene scripts.
- warning("Runaway: hospital ledge scene 2060 is not implemented yet");
+ if (!_hospital.window)
+ say(28, 1);
+ _hospital.window = MIN<int>(2, _hospital.window + 1);
+ beginHospitalAnimation(action, 4, 42);
+ return kHandled;
+ case 314:
+ say(10, _hospital.window >= 2);
+ return kHandled;
+ case 315:
+ case 316:
+ say(action == 315 ? 11 : 12, _hospital.chartReplaced);
+ return kHandled;
+ case 317:
+ case 318:
+ say(action == 317 ? 13 : 14, _hospital.chartMoved);
+ return kHandled;
+ case 319:
+ say(15, _hospital.attacked);
+ return kHandled;
+ case 324:
+ say(20, _hospital.attacked);
+ return kHandled;
+ case 334:
+ say(30);
+ return kHandled;
+ case 335:
+ if (!_hospital.decoy) {
+ say(31);
+ return kHandled;
+ }
+ beginHospitalAnimation(action, 16, 29);
+ return kHandled;
+ case 336:
+ say(32);
+ return kHandled;
+ case 337:
+ if (_hospital.attacked)
+ say(33);
+ else
+ say(4, 0, true);
+ return kHandled;
+ case 338:
+ if (_inventory.chartWritten())
+ say(4, 0, true);
+ else
+ say(34);
+ return kHandled;
+ case 339: {
+ if (!_inventory.chartWritten()) {
+ say(34);
+ return kHandled;
+ }
+ beginHospitalAnimation(action, 19, 35);
+ _actionFrames.push_back(33);
+ for (int frame = 32; frame >= 0; --frame)
+ _actionFrames.push_back(frame);
+ return kHandled;
+ }
+ case 340:
+ case 341:
+ if (!_inventory.contains(17))
+ say(36, 5);
+ else if (!_inventory.headWig())
+ say(36, action == 340 ? 2 : 6);
+ else if (!_inventory.contains(14))
+ say(36);
+ else if (!_inventory.contains(7))
+ say(36, 1);
+ else {
+ say(36, 3);
+ _roomAction = 340;
+ _actionStage = 0;
+ }
+ return kHandled;
+ case 342:
+ if (!_hospital.attacked || !_hospital.medicineRead) {
+ if (_inventory.contains(9))
+ say(37, 1);
+ else
+ say(1, 2, true);
+ } else if (!_inventory.contains(9)) {
+ say(37);
+ } else {
+ say(37, 2);
+ _roomAction = action;
+ }
+ return kHandled;
+ case 343:
+ say(_hospital.attacked && _hospital.medicineRead ? 38 : 37, _hospital.attacked && _hospital.medicineRead ? 0 : 1);
return kHandled;
case 346:
leaveHospitalRoom(kHospitalBathroom, Common::Point(0, 596), 1);
return kHandled;
case 349:
- say(4, 0, true);
- return kHandled;
- case 351:
- warning("Runaway: hospital hallway sequence is not implemented yet");
- return kHandled;
- case 352:
- say(42, _random.getRandomBit());
+ if (_hospital.attacked)
+ say(41, _inventory.water() != 0);
+ else
+ say(4, 0, true);
return kHandled;
default:
return kUnhandled;
@@ -242,12 +551,34 @@ void RunawayRoomScene::update2020() {
case 4:
_facing = 3;
say(0, 3);
+ _hospitalEntryStep = 0;
+ break;
+ case 5:
+ _facing = 4;
+ say(81, 6);
+ _hospitalEntryStep = 0;
+ break;
+ case 6:
+ say(36, 4);
+ _hospitalEntryStep = 0;
break;
default:
_hospitalEntryStep = 0;
break;
}
}
+ if (!speaking() && _pathIndex == _path.size()) {
+ if (_roomAction == 340) {
+ if (!_actionStage) {
+ walkTo(Common::Point(531, 416), 3, true);
+ _actionStage = 1;
+ } else {
+ startHospitalFilm(kDecoyFilm);
+ }
+ } else if (_roomAction == 342) {
+ startHospitalFilm(kEscapeFilm);
+ }
+ }
if (_now - _ambientTick >= 80) {
_ambientTick = _now;
if ((_ambientFrame > 0 && _ambientFrame < 18) || !_random.getRandomNumber(49)) {
@@ -260,6 +591,136 @@ void RunawayRoomScene::update2020() {
applyRunawayPatch(_monitorPatches[(_now / 80) % 26 >= 17], _background);
}
+void RunawayRoomScene::startHospitalFilm(HospitalFilm film) {
+ const RunawaySequence::Command *commands = nullptr;
+ switch (film) {
+ case kGinaStoryFilm: commands = kGinaStory; break;
+ case kLedgeFilm: commands = kLedgeCrossing; break;
+ case kDecoyFilm: commands = kBuildDecoy; break;
+ case kAmbushFilm: commands = kHospitalAmbush; break;
+ case kEscapeFilm: commands = kHospitalEscape; break;
+ }
+ _hospitalFilm = film;
+ _roomAction = 0;
+ _actionFrames.clear();
+ _caption.clear();
+ _sequence.start(commands, _text, _now);
+}
+
+void RunawayRoomScene::finishHospitalFilm() {
+ switch (_hospitalFilm) {
+ case kGinaStoryFilm:
+ _hospitalEntryStep = 1;
+ say(0);
+ break;
+ case kLedgeFilm:
+ _transition.scene = kHospitalStoreroom;
+ _transition.position = Common::Point(419, 546);
+ _transition.facing = 3;
+ break;
+ case kDecoyFilm:
+ _hospital.decoy = 1;
+ _inventory.remove(7);
+ _inventory.remove(14);
+ _inventory.remove(17);
+ if (!rebuildBackground())
+ error("Cannot build Runaway hospital decoy");
+ updateMaps();
+ walkTo(Common::Point(404, 456), 1, true);
+ _hospitalEntryStep = 6;
+ break;
+ case kAmbushFilm:
+ _hospitalEntryStep = 5;
+ say(81, 5);
+ break;
+ case kEscapeFilm:
+ _chapterComplete = true;
+ _audio.stopMusic();
+ return;
+ }
+ _audio.playMusic(11, false);
+ if (_room == kHospitalBedroom)
+ _audio.playEffect(30, 3, 1, true);
+}
+
+void RunawayRoomScene::beginHospitalAnimation(uint16 action, uint chunk, uint frames, const byte *order, uint count) {
+ if (!_actionAnimation.load(_archive, chunk, frames))
+ error("Cannot load Runaway room %u animation %u", _room, chunk);
+ _actionFrames.clear();
+ for (uint i = 0; i < (order ? count : frames); ++i)
+ _actionFrames.push_back(order ? order[i] : i);
+ _roomAction = action;
+ _actionStage = 0;
+ _actionStep = 0;
+ _actionStarted = _now;
+}
+
+void RunawayRoomScene::updateHospitalAnimation() {
+ if (!_roomAction || _actionFrames.empty())
+ return;
+ if (speaking() || _pathIndex < _path.size()) {
+ _actionStarted = _now;
+ return;
+ }
+ while (_now - _actionStarted >= 80) {
+ _actionStarted += 80;
+ if (++_actionStep == _actionFrames.size()) {
+ const uint16 action = _roomAction;
+ _roomAction = 0;
+ _actionFrames.clear();
+ finishHospitalAnimation(action);
+ return;
+ }
+ if ((_roomAction == 335 && _actionStep == 15) || (_roomAction == 339 && _actionStep == 47))
+ _audio.playEffect(46);
+ if (_roomAction == 339 && _actionStep == 16)
+ _audio.playEffect(45);
+ if (_roomAction == 339 && _actionStep == 1 && !applyPatch(18))
+ error("Cannot clear Runaway hospital chart");
+ if ((_roomAction == 332 && (_actionStep == 21 || _actionStep == 35 || _actionStep == 41)) ||
+ (_room == kHospitalStoreroom && _roomAction == 302 && (_actionStep == 23 || _actionStep == 36)))
+ _audio.playFootstep(1, _random.getRandomBit());
+ }
+}
+
+void RunawayRoomScene::finishHospitalAnimation(uint16 action) {
+ switch (action) {
+ case 332:
+ startHospitalFilm(kLedgeFilm);
+ return;
+ case 302:
+ _transition.scene = 2022;
+ _transition.position = Common::Point(265, 456);
+ _transition.facing = 3;
+ return;
+ case kHospitalStoreroom:
+ if (!_hospital.storeroomVisited)
+ say(0);
+ _hospital.storeroomVisited = 1;
+ _facing = 3;
+ return;
+ case 2022:
+ _facing = 3;
+ return;
+ case 335:
+ _hospital.chartMoved = 1;
+ _inventory.remove(6);
+ say(31, 1);
+ break;
+ case 339:
+ _hospital.chartReplaced = 1;
+ _inventory.remove(16);
+ _inventory.add(6);
+ say(35);
+ break;
+ default:
+ return;
+ }
+ if (!rebuildBackground())
+ error("Cannot update Runaway hospital chart");
+ updateMaps();
+}
+
void RunawayRoomScene::leaveHospitalRoom(uint16 scene, Common::Point position, byte facing) {
_hospitalExit.scene = scene;
_hospitalExit.position = position;
@@ -286,15 +747,18 @@ void RunawayRoomScene::updateHospitalAudio() {
}
void RunawayRoomScene::drawScene2020(Graphics::ManagedSurface &viewport, bool foreground) {
+ if (!foreground && _hospital.chartMoved)
+ _safe.draw(viewport, 0, _camera.x, 0);
// Gina and the near bed occlude Brian only when he is behind them.
if (foreground == (_position.y < 503)) {
_ambient.draw(viewport, _ambientFrame, _camera.x, 0);
drawForeground(viewport, 2);
- _overlay.draw(viewport, 0, _camera.x, 0);
+ if (_roomAction != 339 || !_actionStep)
+ _overlay.draw(viewport, 0, _camera.x, 0);
}
if (foreground) {
if (_position.x < 600 && _position.y < 434)
- drawForeground(viewport, 1);
+ drawForeground(viewport, _hospital.decoy ? 3 : 1);
if (_position.x > 1000)
drawForeground(viewport, 0);
}
diff --git a/engines/hollywood/runaway/scene2060.cpp b/engines/hollywood/runaway/scene2060.cpp
new file mode 100644
index 00000000000..4e3d34d79d9
--- /dev/null
+++ b/engines/hollywood/runaway/scene2060.cpp
@@ -0,0 +1,167 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+// RESOURCE.B06; the storeroom reached across the ledge (native 0x4478e0).
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Window", 419, 546, 7, {301, 302}, {1, 1}},
+ {"Radiator", 419, 546, 7, {304, 305}, {0, 0}},
+ {"Box", 347, 563, 7, {306, 307}, {1, 1}},
+ {"Spray can", 347, 563, 7, {308, 309}, {0, 1}},
+ {"Book", 587, 564, 7, {310, 311}, {1, 1}},
+ {"Piece of paper", 627, 564, 7, {312, 313}, {1, 1}},
+ {"Human body", 627, 564, 1, {314, 315}, {0, 1}},
+ {"File cabinet", 627, 564, 7, {316, 8}, {0, 0}},
+ {"File cabinet", 627, 564, 1, {317, 8}, {0, 0}},
+ {"Bottles", 627, 564, 1, {318, 319}, {0, 0}},
+ {"Box", 627, 564, 7, {320, 321}, {0, 0}},
+ {"Boxes of medicine", 627, 564, 5, {322, 323}, {0, 0}},
+ {"Serum stand", 627, 564, 3, {324, 5}, {0, 0}},
+ {"Serum bag", 627, 564, 3, {325, 326}, {0, 0}},
+ {"Pillows", 347, 563, 5, {327, 328}, {0, 1}}
+};
+
+const RunawayResponse kResponses[] = {
+ {kHospitalStoreroom, 301, 1, 0},
+ {kHospitalStoreroom, 304, 2, 0},
+ {kHospitalStoreroom, 305, 2, 1},
+ {kHospitalStoreroom, 308, 4, 0},
+ {kHospitalStoreroom, 316, 8, 0},
+ {kHospitalStoreroom, 317, 9, 0},
+ {kHospitalStoreroom, 318, 10, 0},
+ {kHospitalStoreroom, 319, 10, 1},
+ {kHospitalStoreroom, 320, 11, 0},
+ {kHospitalStoreroom, 321, 11, 1},
+ {kHospitalStoreroom, 322, 12, 0},
+ {kHospitalStoreroom, 323, 12, 1},
+ {kHospitalStoreroom, 324, 13, 0},
+ {kHospitalStoreroom, 325, 14, 0},
+ {kHospitalStoreroom, 326, 14, 1},
+ {kHospitalStoreroom, 327, 15, 0}
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene2060 = {
+ kHospitalStoreroom, 1024, 600, kHotspots, ARRAYSIZE(kHotspots),
+ {{100, 100, 100}, {40, 40, 60}, {60, 60, 80}}, Common::Point(419, 546),
+ kResponses, ARRAYSIZE(kResponses), nullptr, 0, nullptr, 0
+};
+
+bool RunawayRoomScene::applyBackground2060() {
+ return (!_hospital.headTaken || applyPatch(5)) && (_hospital.blankChart != 2 || applyPatch(6)) &&
+ (!_hospital.sprayTaken || applyPatch(7)) && (_hospital.book != 2 || applyPatch(8)) &&
+ (!_hospital.pillowsTaken || applyPatch(9));
+}
+
+void RunawayRoomScene::updateMaps2060() {
+ for (uint i = 0; i < 256; ++i) {
+ byte &id = _maps[256 + i];
+ if ((_hospital.sprayTaken && id == 4) || (_hospital.pillowsTaken && id == 15) ||
+ (_hospital.headTaken && id == 16))
+ id = 0;
+ else if (id == 5 && _hospital.book == 2)
+ id = 11;
+ else if (id == 6 && _hospital.blankChart == 2)
+ id = 8;
+ else if (id == 16)
+ id = 7;
+ }
+}
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute2060(uint16 action) {
+ switch (action) {
+ case 302:
+ beginHospitalAnimation(action, 4, 44);
+ return kHandled;
+ case 303:
+ _transition.scene = 2022;
+ _transition.position = Common::Point(265, 456);
+ _transition.facing = 3;
+ return kHandled;
+ case 306:
+ say(3, _hospital.syringesSeen);
+ _hospital.syringesSeen = 1;
+ return kHandled;
+ case 307:
+ if (_inventory.contains(15)) {
+ say(3, 3);
+ } else {
+ say(3, 2);
+ _inventory.add(15);
+ say(64, 0, true);
+ }
+ return kHandled;
+ case 309:
+ _hospital.sprayTaken = 1;
+ _inventory.add(18);
+ say(18, _random.getRandomNumber(2), true);
+ return kBackgroundChanged;
+ case 310:
+ say(5, _hospital.book != 0);
+ _hospital.book = 1;
+ return kHandled;
+ case 311:
+ _hospital.book = 2;
+ _inventory.add(19);
+ say(18, _random.getRandomNumber(2), true);
+ return kBackgroundChanged;
+ case 312:
+ say(6, _hospital.blankChart != 0);
+ _hospital.blankChart = 1;
+ return kHandled;
+ case 313:
+ _hospital.blankChart = 2;
+ _inventory.add(16);
+ say(65, 0, true);
+ return kBackgroundChanged;
+ case 314:
+ say(7, _hospital.headTaken ? 2 : _random.getRandomBit());
+ return kHandled;
+ case 315:
+ if (_hospital.headTaken) {
+ say(7, 4);
+ return kHandled;
+ }
+ say(7, 3);
+ _hospital.headTaken = 1;
+ _inventory.add(17);
+ say(66, 0, true);
+ return kBackgroundChanged;
+ case 328:
+ say(15, 1);
+ _hospital.pillowsTaken = 1;
+ _inventory.add(14);
+ say(63, 0, true);
+ return kBackgroundChanged;
+ default:
+ return kUnhandled;
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene2080.cpp b/engines/hollywood/runaway/scene2080.cpp
index 5357a672753..4ffa7f76cd5 100644
--- a/engines/hollywood/runaway/scene2080.cpp
+++ b/engines/hollywood/runaway/scene2080.cpp
@@ -45,11 +45,9 @@ const RunawayResponse kResponses[] = {
{kHospitalBathroom, 308, 2, 0},
{kHospitalBathroom, 309, 5, 0},
{kHospitalBathroom, 310, 5, 1},
- {kHospitalBathroom, 312, 7, 0},
{kHospitalBathroom, 313, 8, 0},
{kHospitalBathroom, 314, 9, 0},
{kHospitalBathroom, 315, 10, 0},
- {kHospitalBathroom, 316, 11, 0},
{kHospitalBathroom, 317, 12, 0},
{kHospitalBathroom, 318, 13, 0},
{kHospitalBathroom, 319, 14, 0},
@@ -96,6 +94,10 @@ void RunawayRoomScene::updateMaps2080() {
RunawayRoomScene::ActionResult RunawayRoomScene::execute2080(uint16 action) {
switch (action) {
+ case 312:
+ case 316:
+ say(action == 312 ? 7 : 11, _hospital.medicineRead);
+ return kHandled;
case 302:
_roomAction = action;
_actionStage = 0;
@@ -138,6 +140,13 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2080(uint16 action) {
}
void RunawayRoomScene::update2080() {
+ if (!_hospital.attacked && _hospital.chartMoved && _hospital.decoy && _pathIndex == _path.size()) {
+ _hospital.attacked = 1;
+ _transition.scene = 2023;
+ _transition.position = Common::Point(1075, 534);
+ _transition.facing = 7;
+ return;
+ }
if (_roomAction == 302) {
if (_actionStage == 1) {
if (speaking())
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
index f2c73e7eb50..3fee4e10507 100644
--- a/engines/hollywood/runaway/scene_data.h
+++ b/engines/hollywood/runaway/scene_data.h
@@ -28,6 +28,7 @@ namespace Hollywood {
enum RunawayRoomId {
kHospitalBedroom = 2020,
+ kHospitalStoreroom = 2060,
kHospitalBathroom = 2080,
kMuseumOffice = 4030,
kMuseumLaboratory = 4050,
@@ -81,6 +82,7 @@ struct RunawayRoom {
};
extern const RunawayRoom kRunawayScene2020;
+extern const RunawayRoom kRunawayScene2060;
extern const RunawayRoom kRunawayScene2080;
extern const RunawayRoom kRunawayScene4030;
extern const RunawayRoom kRunawayScene4050;
diff --git a/engines/hollywood/runaway/sequence.cpp b/engines/hollywood/runaway/sequence.cpp
new file mode 100644
index 00000000000..3b4531f12bb
--- /dev/null
+++ b/engines/hollywood/runaway/sequence.cpp
@@ -0,0 +1,224 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "common/str-enc.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "hollywood/runaway/sequence.h"
+
+namespace Hollywood {
+
+void RunawaySequence::start(const Command *commands, const SceneTextStore &text, uint32 now) {
+ _text = &text;
+ _audio.stopSpeech();
+ _audio.stopEffect();
+ _lines.clear();
+ _line = 0;
+ _subtitle.clear();
+ _commands = commands;
+ _index = 0;
+ _entered = _showPortrait = false;
+ _now = _started = now;
+ update(now);
+}
+
+void RunawaySequence::advance() {
+ ++_index;
+ _entered = false;
+ _started = _now;
+}
+
+void RunawaySequence::speak(uint cue, uint variation, uint lastVariation) {
+ for (uint v = variation; v <= MAX(variation, lastVariation); ++v) {
+ const SceneSpeechCue speech = _text->stageCue(cue, v);
+ if (!speech.valid() || speech.textRecordId == 0xffff)
+ continue;
+ for (uint i = 0; i < MAX<uint>(1, speech.continuationCount); ++i) {
+ Line line;
+ line.text = Common::U32String(_text->largeTextRecord(speech.textRecordId + i), Common::kDos850);
+ line.sample = speech.voiceSampleId ? speech.voiceSampleId + i : 0;
+ if (!line.text.empty())
+ _lines.push_back(line);
+ }
+ }
+ if (_subtitle.empty())
+ nextLine();
+}
+
+void RunawaySequence::nextLine() {
+ _audio.stopSpeech();
+ _subtitle.clear();
+ _lipSync.stop();
+ if (_line >= _lines.size()) {
+ _line = 0;
+ _lines.clear();
+ return;
+ }
+ const Line &line = _lines[_line++];
+ _subtitle = line.text;
+ const uint duration = line.sample ? _audio.playSpeech(line.sample) : 0;
+ _deadline = _now + (duration ? duration + 150 : MAX<uint>(3000, _subtitle.size() * 55));
+ _lipSync.start(_subtitle, _now, duration, _random, line.sample);
+}
+
+bool RunawaySequence::loadPortrait(uint chunk) {
+ if (!_portraits.open(Common::Path(Common::String::format("DATAVB%02u.002", _movie)), 40))
+ return false;
+ Common::Array<byte> patch;
+ _portrait.create(512, 300, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+ _talking.create(512, 300, _portrait.format);
+ return _portraits.readVariableChunk(chunk, patch) && applyRunawayPatch(patch, _portrait) &&
+ _mouth.load(_portraits, chunk + 1, 12);
+}
+
+void RunawaySequence::update(uint32 now) {
+ _now = now;
+ if (!_subtitle.empty() && (int32)(now - _deadline) >= 0)
+ nextLine();
+ while (active()) {
+ const Command &command = _commands[_index];
+ if (!_entered) {
+ _entered = true;
+ switch (command.operation) {
+ case kOpen: {
+ const Common::String name = Common::String::format("DATAVB%02u.001", command.a);
+ if (!_video.load(name.c_str()))
+ error("Cannot load Runaway film %s", name.c_str());
+ _movie = command.a;
+ _showPortrait = false;
+ break;
+ }
+ case kPlay:
+ _showPortrait = false;
+ _repeatAt = 0;
+ if (!_video.seekToFrame(command.a))
+ error("Cannot seek to Runaway film frame %u", command.a);
+ break;
+ case kTalk:
+ _showPortrait = command.c != 0;
+ _silentPortrait = command.d != 0;
+ if (_showPortrait && !loadPortrait(command.c - 1))
+ error("Cannot load Runaway film portrait %u", command.c - 1);
+ speak(command.a, command.b);
+ break;
+ case kSpeech:
+ speak(command.a, command.b, command.c);
+ break;
+ case kMusic:
+ _audio.playMusic(command.a, command.c != 0);
+ _audio.setMusicVolume(command.b);
+ break;
+ case kEffect:
+ _audio.playEffect(command.a, command.b, command.c, command.d != 0);
+ break;
+ case kStopEffects:
+ _audio.stopEffect();
+ break;
+ default:
+ break;
+ }
+ }
+ switch (command.operation) {
+ case kPlay: {
+ const uint elapsedFrames = _video.frameAtTime(now - _started);
+ const uint count = command.b - command.a + 1;
+ const uint frame = command.a + (command.c == kLoopDuringSpeech ? elapsedFrames % count : MIN(elapsedFrames, count - 1));
+ if (!_video.decodeToFrame(frame))
+ error("Cannot decode Runaway film frame %u", frame);
+ if (command.c == kUntilSpeechEnds) {
+ if (elapsedFrames < count && !_subtitle.empty())
+ return;
+ break;
+ }
+ if (command.c == kIdleDuringSpeech && elapsedFrames >= count && !_subtitle.empty()) {
+ if (!_repeatAt)
+ _repeatAt = now + 80;
+ if ((int32)(now - _repeatAt) >= 0) {
+ // The native player occasionally repeats Gina's idle shot.
+ _repeatAt = now + 80;
+ if (!_random.getRandomNumber(24))
+ _started = now;
+ }
+ }
+ if ((command.c != kLoopDuringSpeech && elapsedFrames < count) || (command.c != kOnce && !_subtitle.empty()))
+ return;
+ break;
+ }
+ case kTalk:
+ case kWaitSpeech:
+ if (!_subtitle.empty())
+ return;
+ break;
+ case kDelay:
+ if (now - _started < command.a)
+ return;
+ break;
+ case kWaitEffect:
+ if (_audio.effectPlaying() && now - _started < command.a)
+ return;
+ break;
+ case kEnd:
+ _video.close();
+ _audio.stopSpeech();
+ _audio.stopEffect();
+ _lipSync.stop();
+ _lines.clear();
+ _subtitle.clear();
+ _commands = nullptr;
+ return;
+ default:
+ break;
+ }
+ advance();
+ }
+}
+
+void RunawaySequence::skip() {
+ if (!active())
+ return;
+ if (!_subtitle.empty()) {
+ nextLine();
+ return;
+ }
+ const Command &command = _commands[_index];
+ if (command.operation == kPlay) {
+ if (!_video.seekToFrame(command.b))
+ error("Cannot decode Runaway film frame %u", command.b);
+ advance();
+ } else if (command.operation == kDelay || command.operation == kWaitEffect) {
+ advance();
+ }
+}
+
+void RunawaySequence::draw(Graphics::ManagedSurface &screen) {
+ screen.clear();
+ const Common::Rect viewport(0, kRunawayViewportTop, kRunawayScreenWidth, kRunawayViewportTop + kRunawayViewportHeight);
+ if (_showPortrait) {
+ _talking.blitFrom(_portrait);
+ _mouth.draw(_talking, _silentPortrait ? 0 : speechFrame(), 0, 0);
+ screen.blitFrom(_talking, Common::Rect(512, 300), viewport);
+ } else {
+ _video.draw(screen, viewport);
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/sequence.h b/engines/hollywood/runaway/sequence.h
new file mode 100644
index 00000000000..d4e11a5dc43
--- /dev/null
+++ b/engines/hollywood/runaway/sequence.h
@@ -0,0 +1,100 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HOLLYWOOD_RUNAWAY_SEQUENCE_H
+#define HOLLYWOOD_RUNAWAY_SEQUENCE_H
+
+#include "common/random.h"
+#include "hollywood/resource.h"
+#include "hollywood/runaway/animation.h"
+#include "hollywood/runaway/audio.h"
+#include "hollywood/runaway/graphics.h"
+#include "hollywood/runaway/video.h"
+#include "hollywood/scene_text_store.h"
+
+namespace Hollywood {
+
+// Retail films interleave AVI ranges, separately stored talking portraits,
+// and speech/effects. The scene supplies the original sequence of cues.
+class RunawaySequence {
+public:
+ enum Operation {
+ kOpen, // Movie number.
+ kPlay, // First/last frame, Playback mode.
+ kTalk, // Cue, variation, portrait chunk + 1 (0 = movie still), offscreen speaker.
+ kSpeech, // Cue, first/last variation; continues alongside the movie.
+ kWaitSpeech,
+ kMusic, // Cue, volume, loop.
+ kEffect, // Cue, volume, channel, loop.
+ kWaitEffect, // Maximum wait in milliseconds (channel 0).
+ kStopEffects,
+ kDelay, // Milliseconds.
+ kEnd
+ };
+ enum Playback { kOnce, kLoopDuringSpeech, kIdleDuringSpeech, kUntilSpeechEnds };
+ struct Command {
+ constexpr Command(Operation op, uint16 first = 0, uint16 second = 0, byte third = 0, byte fourth = 0) :
+ operation(op), a(first), b(second), c(third), d(fourth) {}
+ Operation operation;
+ uint16 a, b;
+ byte c, d;
+ };
+ explicit RunawaySequence(RunawayAudio &audio) : _audio(audio), _random("runawaySequence") {}
+ void start(const Command *commands, const SceneTextStore &text, uint32 now);
+ void update(uint32 now);
+ void skip();
+ void draw(Graphics::ManagedSurface &screen);
+ bool active() const { return _commands != nullptr; }
+ const Common::U32String &subtitle() const { return _subtitle; }
+ byte speechFrame() const { return _lipSync.frame(_now); }
+
+private:
+ void advance();
+ void speak(uint cue, uint variation, uint lastVariation = 0);
+ void nextLine();
+ bool loadPortrait(uint chunk);
+
+ RunawayAudio &_audio;
+ Common::RandomSource _random;
+ RunawayLipSync _lipSync;
+ RunawayVideo _video;
+ ChunkArchive _portraits;
+ RunawayAnimation _mouth;
+ Graphics::ManagedSurface _portrait, _talking;
+ const SceneTextStore *_text = nullptr;
+ const Command *_commands = nullptr;
+ uint _index = 0;
+ uint _movie = 0;
+ uint32 _now = 0, _started = 0, _deadline = 0;
+ uint32 _repeatAt = 0;
+ bool _entered = false, _showPortrait = false, _silentPortrait = false;
+ struct Line {
+ Common::U32String text;
+ uint16 sample;
+ };
+ Common::Array<Line> _lines;
+ uint _line = 0;
+ Common::U32String _subtitle;
+};
+
+} // End of namespace Hollywood
+
+#endif // HOLLYWOOD_RUNAWAY_SEQUENCE_H
diff --git a/engines/hollywood/runaway/video.cpp b/engines/hollywood/runaway/video.cpp
index b1fa9cf27dd..42662060f5e 100644
--- a/engines/hollywood/runaway/video.cpp
+++ b/engines/hollywood/runaway/video.cpp
@@ -86,9 +86,22 @@ uint RunawayVideo::frameAtTime(uint32 milliseconds) const {
return frames ? (uint64)milliseconds * frameCount() * duration.framerate() / (1000ULL * frames) : 0;
}
+bool RunawayVideo::seekToFrame(uint frame) {
+ if (frame >= _decoder.getFrameCount())
+ return false;
+ if (_decoder.getCurFrame() != (int)frame) {
+ _frame = nullptr;
+ if (!_decoder.seekToFrame(frame))
+ return false;
+ }
+ return decodeToFrame(frame);
+}
+
bool RunawayVideo::decodeToFrame(uint frame) {
if (frame >= _decoder.getFrameCount())
return false;
+ if (_decoder.getCurFrame() > (int)frame)
+ return seekToFrame(frame);
while (_decoder.getCurFrame() < (int)frame && !_decoder.endOfVideo()) {
const Graphics::Surface *decoded = _decoder.decodeNextFrame();
if (decoded)
diff --git a/engines/hollywood/runaway/video.h b/engines/hollywood/runaway/video.h
index e70896773ab..2e72e507bd1 100644
--- a/engines/hollywood/runaway/video.h
+++ b/engines/hollywood/runaway/video.h
@@ -35,6 +35,7 @@ public:
bool load(const char *name);
void close();
bool decodeToFrame(uint frame);
+ bool seekToFrame(uint frame);
uint frameCount() const { return _decoder.getFrameCount(); }
uint frameAtTime(uint32 milliseconds) const;
void draw(Graphics::ManagedSurface &surface, const Common::Rect &destination) const;
Commit: 162de90294288ac280dd566e2a60ff5cf7d92bc9
https://github.com/scummvm/scummvm/commit/162de90294288ac280dd566e2a60ff5cf7d92bc9
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: implemented scene 5030
Changed paths:
engines/hollywood/runaway/detection_tables.h
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/inventory.h
engines/hollywood/runaway/saveload.cpp
engines/hollywood/runaway/scene5030.cpp
engines/hollywood/runaway/scene5030.h
engines/hollywood/runaway/strings.cpp
diff --git a/engines/hollywood/runaway/detection_tables.h b/engines/hollywood/runaway/detection_tables.h
index 38a141f9289..baee81dca37 100644
--- a/engines/hollywood/runaway/detection_tables.h
+++ b/engines/hollywood/runaway/detection_tables.h
@@ -23,7 +23,7 @@
#define HOLLYWOOD_RUNAWAY_DETECTION_TABLES_H
// Included in the shared ADGameDescription array in hollywood/detection.cpp.
- // English retail release. Resource support; chapter scripts are not yet implemented.
+ // English retail release. Hospital chapter and chapter-three shack.
{
"runaway",
nullptr,
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index 43ad2527613..3b5fa37565e 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -165,8 +165,8 @@ RunawayScene *RunawayEngine::createScene(uint16 entryScene) {
if (findRunawayRoom(entryScene) && ((_museum && entryScene >= 4000) ||
(_game == kRunawayFullGame && entryScene / 1000 == 2)))
return new RunawayRoomScene(_audio, *_inventory, _strings, _game);
- if (_game == kRunawayCabinDemo && entryScene == 5030)
- return new RunawayScene5030(_mixer, _audio, *_inventory, _strings);
+ if ((_game == kRunawayCabinDemo || _game == kRunawayFullGame) && entryScene == 5030)
+ return new RunawayScene5030(_mixer, _audio, *_inventory, _strings, _game);
// Retail scene scripts have their own entry substates. Sharing an archive
// with a demo does not make its puzzle initialization interchangeable.
return nullptr;
@@ -200,6 +200,7 @@ Common::Error RunawayEngine::changeScene() {
_audio.stopEffect();
_audio.setChapter(state.chapter());
_state = state;
+ _inventory->setChapter(state.chapter());
_scene.reset(scene.release());
syncSoundSettings();
_scene->resume();
@@ -304,6 +305,10 @@ Common::Error RunawayEngine::run() {
if (_museum && ConfMan.hasKey("boot_param") && ConfMan.getInt("boot_param") >= 4000 &&
findRunawayRoom(ConfMan.getInt("boot_param")))
_state.scene = ConfMan.getInt("boot_param");
+ if (_game == kRunawayFullGame && ConfMan.hasKey("boot_param") && ConfMan.getInt("boot_param") == 5030)
+ _state.scene = 5030;
+ _inventory->setChapter(_state.chapter());
+ _audio.setChapter(_state.chapter());
_scene.reset(createScene(_state.scene));
if (!_scene)
return Common::Error(Common::kUnsupportedGameidError,
@@ -325,7 +330,7 @@ Common::Error RunawayEngine::run() {
const Common::Error result = loadGameState(ConfMan.getInt("save_slot"));
if (result.getCode() != Common::kNoError)
return result;
- } else if (_game == kRunawayCabinDemo || _game == kRunawayFullGame) {
+ } else if (_game == kRunawayCabinDemo || (_game == kRunawayFullGame && _state.chapter() == 1)) {
const Common::Error result = playIntro(menu);
if (result.getCode() != Common::kNoError || shouldQuit())
return result;
@@ -462,7 +467,7 @@ Common::Error RunawayEngine::run() {
continue;
}
if (_scene->escaped()) {
- // Retail currently ends after the hospital chapter.
+ // Retail currently ends after the hospital or the chapter-three shack.
if (_game == kRunawayFullGame)
return Common::kNoError;
// The extended French demo's later rooms are not implemented yet;
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index 953328adff9..ca5dfcdf13a 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -66,6 +66,7 @@ void RunawayInventory::captureState(RunawaySaveState &state) const {
void RunawayInventory::restoreState(const RunawaySaveState &state) {
assert(state.valid());
+ _chapter = state.chapter();
_items.clear();
for (uint i = 0; i < state.itemCount; ++i)
_items.push_back(state.items[i]);
@@ -88,7 +89,7 @@ bool RunawayInventory::contains(byte item) const {
}
bool RunawayInventory::add(byte item) {
- if (!item || item > kItemCount || (_game != kRunawayCabinDemo && item > 19) || contains(item))
+ if (!item || item > kItemCount || (_chapter != 3 && item > 19) || contains(item))
return false;
_items.push_back(item);
_newItem = item;
@@ -109,7 +110,7 @@ void RunawayInventory::remove(byte item) {
}
Common::U32String RunawayInventory::name(byte item) const {
- if (_game == kRunawayFullGame) {
+ if (_chapter == 1) {
if (item == 11 && _markerInk == 1)
return Common::U32String("Dry marker pen");
if (item == 15 && _syringeFilled)
@@ -119,11 +120,11 @@ Common::U32String RunawayInventory::name(byte item) const {
if (item == 17 && _headWig)
return Common::U32String("Head with wig");
}
- if (_game == kRunawayFullGame && item == 13 && _water == 1)
+ if (_chapter == 1 && item == 13 && _water == 1)
return Common::U32String("Glass with water");
- if (_game == kRunawayMuseumDemo)
+ if (_chapter == 2)
return item < ARRAYSIZE(kMuseumItemNames) ? Common::U32String(kMuseumItemNames[item]) : Common::U32String();
- if (_game == kRunawayFullGame)
+ if (_chapter == 1)
return item < ARRAYSIZE(kHospitalItemNames) ? Common::U32String(kHospitalItemNames[item]) : Common::U32String();
if (item == 1 && _clothState)
return _strings.text(_clothState == 1 ? RunawayStrings::kWetCloth : RunawayStrings::kDirtyCloth);
@@ -131,7 +132,7 @@ Common::U32String RunawayInventory::name(byte item) const {
}
uint RunawayInventory::icon(byte item) const {
- if (_game == kRunawayFullGame) {
+ if (_chapter == 1) {
if (item == 15 && _syringeFilled)
return 20;
if (item == 16 && _chartWritten)
@@ -139,9 +140,9 @@ uint RunawayInventory::icon(byte item) const {
if (item == 17 && _headWig)
return 21;
}
- if (_game == kRunawayFullGame && item == 13 && _water == 1)
+ if (_chapter == 1 && item == 13 && _water == 1)
return 23;
- if (_game != kRunawayCabinDemo)
+ if (_chapter != 3)
return item;
if (item == 1 && _clothState)
return _clothState == 1 ? 34 : 35;
@@ -149,7 +150,7 @@ uint RunawayInventory::icon(byte item) const {
}
uint RunawayInventory::cursor(byte item) const {
- if (_game == kRunawayFullGame) {
+ if (_chapter == 1) {
if (item == 15 && _syringeFilled)
return 77;
if (item == 16 && _chartWritten)
@@ -157,11 +158,11 @@ uint RunawayInventory::cursor(byte item) const {
if (item == 17 && _headWig)
return 79;
}
- if (_game == kRunawayFullGame && item == 13 && _water == 1)
+ if (_chapter == 1 && item == 13 && _water == 1)
return 85;
- if (_game == kRunawayMuseumDemo)
+ if (_chapter == 2)
return item && item < ARRAYSIZE(kMuseumItemNames) ? 11 + item * 2 : 0;
- if (_game == kRunawayFullGame)
+ if (_chapter == 1)
return item && item <= 19 ? (item == 16 ? 81 : 39 + item * 2 - (item > 16 ? 2 : 0)) : 0;
if (item == 1 && _clothState)
return _clothState == 1 ? 107 : 109;
@@ -169,7 +170,7 @@ uint RunawayInventory::cursor(byte item) const {
}
RunawayInventory::Reply RunawayInventory::examine(byte item) const {
- if (_game == kRunawayFullGame) {
+ if (_chapter == 1) {
if (item == 11)
return Reply(60, _markerInk >= 2 ? 2 : _markerInk);
if (item == 15)
@@ -179,14 +180,14 @@ RunawayInventory::Reply RunawayInventory::examine(byte item) const {
if (item == 17)
return Reply(66, _headWig);
}
- if (_game == kRunawayFullGame && item == 13)
+ if (_chapter == 1 && item == 13)
return Reply(62, _water == 1 ? 1 : 0);
- if (_game == kRunawayMuseumDemo) {
+ if (_chapter == 2) {
if (!item || item >= ARRAYSIZE(kMuseumItemNames))
return Reply();
return Reply(item < 5 ? 49 + item : 95 + item, item == 7 ? 1 : 0);
}
- if (_game == kRunawayFullGame)
+ if (_chapter == 1)
return Reply(item && item <= 19 ? (item == 3 ? 74 : 49 + item) : 1);
return Reply(item && item <= kItemCount ? kExamineCues[item] : 1, item == 1 ? _clothState : 0);
}
@@ -196,7 +197,7 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
return Reply();
if (first > second)
SWAP(first, second);
- if (_game == kRunawayFullGame) {
+ if (_chapter == 1) {
if (first == 10 && second == 17) {
_headWig = 1;
remove(10);
@@ -238,7 +239,7 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
return Reply(72, 4);
return Reply();
}
- if (_game != kRunawayCabinDemo)
+ if (_chapter != 3)
return Reply();
// The combinations available among the shack's items, from 0x4158c0
// and 0x415bd0. A failed combination leaves both items in place.
diff --git a/engines/hollywood/runaway/inventory.h b/engines/hollywood/runaway/inventory.h
index e17dd655b85..7cb199f2056 100644
--- a/engines/hollywood/runaway/inventory.h
+++ b/engines/hollywood/runaway/inventory.h
@@ -41,7 +41,9 @@ public:
byte variation;
Reply(uint16 c = 1, byte v = 0) : cue(c), variation(v) {}
};
- RunawayInventory(const RunawayStrings &strings, RunawayGameType game) : _strings(strings), _game(game) {}
+ RunawayInventory(const RunawayStrings &strings, RunawayGameType game) :
+ _strings(strings), _chapter(game == kRunawayFullGame ? 1 : game == kRunawayMuseumDemo ? 2 : 3) {}
+ void setChapter(byte chapter) { _chapter = chapter; }
bool contains(byte item) const;
bool add(byte item);
void remove(byte item);
@@ -66,7 +68,7 @@ public:
private:
const RunawayStrings &_strings;
- const RunawayGameType _game;
+ byte _chapter;
Common::Array<byte> _items;
byte _selected = 0, _newItem = 0, _clothState = 0;
byte _water = 0;
diff --git a/engines/hollywood/runaway/saveload.cpp b/engines/hollywood/runaway/saveload.cpp
index 9df529907dc..a28a537a577 100644
--- a/engines/hollywood/runaway/saveload.cpp
+++ b/engines/hollywood/runaway/saveload.cpp
@@ -105,7 +105,8 @@ bool RunawaySaveState::valid() const {
coolerInspected > 1 || peeked > 1 || ice > 2 || hatch > 3 ||
itemCount > sizeof(items) || selected > sizeof(items) || cloth > 2 || inventoryOpen > 1 || verb > 2)
return false;
- if (game == kRunawayCabinDemo && (scene != 5030 || x >= 1376 || y >= 600 || camera > 352 || cameraY))
+ if ((game == kRunawayCabinDemo || (game == kRunawayFullGame && chapter() == 3)) &&
+ (scene != 5030 || x >= 1376 || y >= 600 || camera > 352 || cameraY))
return false;
if (upperFloor > 1 || books > 2 || recorder > 2 || moneyIdentified > 1 || safeOpen > 1 ||
varnishTaken > 1 || talcTaken > 1 || coffeeTaken > 1 || keyCount > 4)
@@ -125,7 +126,7 @@ bool RunawaySaveState::valid() const {
hospital.book > 2 || hospital.blankChart > 2 || hospital.headTaken > 1 || hospital.pillowsTaken > 1 ||
markerInk > 3 || syringeFilled > 1 || chartWritten > 1 || headWig > 1)
return false;
- if (game == kRunawayFullGame) {
+ if (game == kRunawayFullGame && chapter() != 3) {
const RunawayRoom *room = findRunawayRoom(scene);
if (!room || (room->number != kHospitalBedroom && room->number != kHospitalStoreroom && room->number != kHospitalBathroom) ||
x >= room->width || y >= room->height || cameraY ||
@@ -141,7 +142,7 @@ bool RunawaySaveState::valid() const {
bool owned[27] = {};
for (uint i = 0; i < itemCount; ++i) {
if (!items[i] || items[i] >= sizeof(owned) || owned[items[i]] ||
- (game != kRunawayCabinDemo && items[i] > 19))
+ (chapter() != 3 && items[i] > 19))
return false;
owned[items[i]] = true;
}
diff --git a/engines/hollywood/runaway/scene5030.cpp b/engines/hollywood/runaway/scene5030.cpp
index 351a775628a..09a9268b78a 100644
--- a/engines/hollywood/runaway/scene5030.cpp
+++ b/engines/hollywood/runaway/scene5030.cpp
@@ -186,7 +186,7 @@ void RunawayScene5030::captureState(RunawaySaveState &state) const {
}
bool RunawayScene5030::restoreState(const RunawaySaveState &state, uint32 now, bool entering) {
- if (!state.valid() || state.game != kRunawayCabinDemo || state.scene != _entryScene)
+ if (!state.valid() || state.game != _game || state.scene != _entryScene)
return false;
_lidOpen = state.lidOpen;
_unplugged = state.unplugged;
@@ -314,7 +314,7 @@ void RunawayScene5030::showSpeechRow() {
const uint32 duration = sample ? _audio.playSpeech(sample, _globalSpeech) : 0;
_subtitleUntil = _now + (duration ? MAX<uint>(1000, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
_idleHead.reset(_now);
- _lipSync.start(_subtitle, _now, duration, _random);
+ _lipSync.start(_subtitle, _now, duration, _random, _game == kRunawayFullGame ? sample : 0);
debugC(1, kDebugScene, "Runaway demo: dialogue row %u, voice %u, ends at row %u",
_speechRow, sample, _speechEnd);
}
diff --git a/engines/hollywood/runaway/scene5030.h b/engines/hollywood/runaway/scene5030.h
index d1450c92a88..3e3d2332c23 100644
--- a/engines/hollywood/runaway/scene5030.h
+++ b/engines/hollywood/runaway/scene5030.h
@@ -36,7 +36,7 @@
namespace Hollywood {
-// The demo starts in the shack. This scene owns its room resources, actor,
+// The demos and retail chapter three share the shack, its room resources, actor,
// interactions and audio; RunawayEngine owns the backend and event loop.
class RunawayScene5030 : public RunawayScene {
public:
@@ -45,8 +45,9 @@ public:
kRoomWidth = 1376, kRoomHeight = kRunawayViewportHeight, kRoomTop = kRunawayViewportTop
};
- RunawayScene5030(Audio::Mixer *mixer, RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings) :
- _audio(audio), _inventory(inventory), _strings(strings), _interrogation(mixer), _random("runawayShack"), _actor() {}
+ RunawayScene5030(Audio::Mixer *mixer, RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings,
+ RunawayGameType game = kRunawayCabinDemo) :
+ _audio(audio), _inventory(inventory), _strings(strings), _game(game), _interrogation(mixer), _random("runawayShack"), _actor() {}
bool load(uint16 entryScene) override;
void start(uint32 now) override;
void resume() override;
@@ -121,6 +122,7 @@ private:
RunawayAudio &_audio;
RunawayInventory &_inventory;
const RunawayStrings &_strings;
+ const RunawayGameType _game;
RunawayInterrogation _interrogation;
Common::RandomSource _random;
bool _peeked = false;
diff --git a/engines/hollywood/runaway/strings.cpp b/engines/hollywood/runaway/strings.cpp
index 90b0a3b5d8b..0bf16231773 100644
--- a/engines/hollywood/runaway/strings.cpp
+++ b/engines/hollywood/runaway/strings.cpp
@@ -43,8 +43,8 @@ const char *const kText[RunawayStrings::kTextCount][4] = {
{"NIMM ETWAS AUS DEM ", "PRENDRE QUELQUE CHOSE DANS ", "COGER ALGO DE LA ", "TAKE FROM "},
{"ZIEHE DEN STECKER DER K\303\234HLTRUHE HERAUS", "DEBRANCHER CONGELATEUR", "DESENCHUFAR CONGELADOR", "UNPLUG COOLER"},
{"HEMD", "CHEMISE", "CAMISA", "SHIRT"},
- {"PUTZLAPPEN", "PEAU DE CHAMOIS HUMIDE", "GAMUZA HUMEDECIDA", "WET CLOTH"},
- {"SCHMUTZLAPPEN", "PEAU DE CHAMOIS SALE", "GAMUZA MUGRIENTA", "DIRTY CLOTH"},
+ {"PUTZLAPPEN", "PEAU DE CHAMOIS HUMIDE", "GAMUZA HUMEDECIDA", "WET CHAMOIS"},
+ {"SCHMUTZLAPPEN", "PEAU DE CHAMOIS SALE", "GAMUZA MUGRIENTA", "FILTHY CHAMOIS"},
{"OPTIONEN", "OPTIONS", "OPCIONES", "OPTIONS"},
{"LADEN", "CHARGER", "CARGAR", "LOAD"},
{"SICHERN", "SAUVEGARDER", "SALVAR", "SAVE"},
@@ -84,57 +84,57 @@ const char *const kText[RunawayStrings::kTextCount][4] = {
{"MITWIRKENDE KONNTEN NICHT GELADEN WERDEN", "IMPOSSIBLE DE CHARGER LE GENERIQUE", "NO SE HAN PODIDO CARGAR LOS CR\303\211DITOS", "COULD NOT LOAD THE CREDITS"}
};
-const char *const kItemNames[][3] = {
- {"", "", ""},
- {"LEDERLAPPEN", "PEAU DE CHAMOIS", "GAMUZA"},
- {"BRECHSTANGE", "PIED DE BICHE", "PALANCA"},
- {"SPR\303\234HREINIGER", "PRODUIT NETTOYANT", "BOTE DE LIMPIEZA"},
- {"PACKUNG BUTTER", "TABLETTE DE BEURRE", "PAQUETE DE MANTEQUILLA"},
- {"SPRENGAUSR\303\234STUNG", "DYNAMITE ET DETONATEUR", "EQUIPO DE DINAMITERO"},
- {"HELM AUS DEM ZWEITEN WELTKRIEG", "CASQUE DE LA SECONDE GUERRE MONDIALE", "CASCO DE LA SEGUNDA GUERRA MUNDIAL"},
- {"SCHRAUBE", "VIS", "TORNILLO"},
- {"GARDEROBENKNAUF", "PORTE-MANTEAUX", "POMO DEL PERCHERO"},
- {"TABLETTE", "PILLULE", "PASTILLA"},
- {"LIPPENSTIFT", "ROUGE A LEVRES", "PINTALABIOS"},
- {"HAUFEN LIPPENSTIFTE", "STOCK DE ROUGE A LEVRES", "MONT\303\223N DE PINTALABIOS"},
- {"SONNEN\303\226L", "HUILE SOLAIRE", "ACEITE BRONCEADOR"},
- {"WALKIE-TALKIE", "TALKIE-WALKIE", "WALKIE TALKIE"},
- {"MUNITIONSSTREIFEN", "BANDE DE MUNITIONS", "RISTRA DE BALAS"},
- {"BASKETBALL", "BALLON DE BASKET", "BAL\303\223N DE BALONCESTO"},
- {"SATTLERNADEL UND FADEN", "FIL A COUDRE ET AIGUILLE", "AGUJA Y ROLLO DE HILO DE ZAPATERO"},
- {"BEHELFS-BOHRER", "TOURNEVIS ARTISANAL", "SACACORCHOS IMPROVISADO"},
- {"SACK GESCH\303\204LTER ERDN\303\234SSE", "SAC DE CACAHOUETES ENTIERES", "SAQUITO DE CACAHUETES PELADOS"},
- {"GLAS ERDNUSSBUTTER", "POT DE BEURRE DE CACAHOUETES", "TARRO DE MANTEQUILLA DE CACAHUETE"},
- {"SONNENBRILLE", "LUNETTES DE SOLEIL", "GAFAS DE SOL"},
- {"FUSSRASTE", "REPOSE-PIED DE MOTO", "ESTRIBO DE LA MOTO"},
- {"HANDSTAUBSAUGER", "ASPIRATEUR A MAIN", "ASPIRADORA DE MANO"},
- {"PLAN", "PLAN GENIAL", "PLAN"},
- {"BLASEBALG", "SOUFFLET", "FUELLE"},
- {"EIMER", "SEAU", "CUBO"},
- {"SCHL\303\234SSEL", "CLE DU REFRIGERATEUR", "LLAVE"}
+const char *const kItemNames[][4] = {
+ {"", "", "", ""},
+ {"LEDERLAPPEN", "PEAU DE CHAMOIS", "GAMUZA", "CHAMOIS"},
+ {"BRECHSTANGE", "PIED DE BICHE", "PALANCA", "CROWBAR"},
+ {"SPR\303\234HREINIGER", "PRODUIT NETTOYANT", "BOTE DE LIMPIEZA", "BOTTLE OF CLEANSER"},
+ {"PACKUNG BUTTER", "TABLETTE DE BEURRE", "PAQUETE DE MANTEQUILLA", "TUB OF BUTTER"},
+ {"SPRENGAUSR\303\234STUNG", "DYNAMITE ET DETONATEUR", "EQUIPO DE DINAMITERO", "DYNAMITE AND DETONATION EQUIPMENT"},
+ {"HELM AUS DEM ZWEITEN WELTKRIEG", "CASQUE DE LA SECONDE GUERRE MONDIALE", "CASCO DE LA SEGUNDA GUERRA MUNDIAL", "WORLD WAR II HELMET"},
+ {"SCHRAUBE", "VIS", "TORNILLO", "SCREW"},
+ {"GARDEROBENKNAUF", "PORTE-MANTEAUX", "POMO DEL PERCHERO", "COAT RACK PEG"},
+ {"TABLETTE", "PILLULE", "PASTILLA", "PILL"},
+ {"LIPPENSTIFT", "ROUGE A LEVRES", "PINTALABIOS", "LIPSTICK"},
+ {"HAUFEN LIPPENSTIFTE", "STOCK DE ROUGE A LEVRES", "MONT\303\223N DE PINTALABIOS", "PILE OF LIPSTICK"},
+ {"SONNEN\303\226L", "HUILE SOLAIRE", "ACEITE BRONCEADOR", "TANNING OIL"},
+ {"WALKIE-TALKIE", "TALKIE-WALKIE", "WALKIE TALKIE", "WALKIE-TALKIE"},
+ {"MUNITIONSSTREIFEN", "BANDE DE MUNITIONS", "RISTRA DE BALAS", "BULLET BELT"},
+ {"BASKETBALL", "BALLON DE BASKET", "BAL\303\223N DE BALONCESTO", "BASKETBALL"},
+ {"SATTLERNADEL UND FADEN", "FIL A COUDRE ET AIGUILLE", "AGUJA Y ROLLO DE HILO DE ZAPATERO", "NEEDLE AND THREAD"},
+ {"BEHELFS-BOHRER", "TOURNEVIS ARTISANAL", "SACACORCHOS IMPROVISADO", "MAKESHIFT CORKSCREW"},
+ {"SACK GESCH\303\204LTER ERDN\303\234SSE", "SAC DE CACAHOUETES ENTIERES", "SAQUITO DE CACAHUETES PELADOS", "PACKAGE OF SHELLED PEANUTS"},
+ {"GLAS ERDNUSSBUTTER", "POT DE BEURRE DE CACAHOUETES", "TARRO DE MANTEQUILLA DE CACAHUETE", "JAR OF PEANUT BUTTER"},
+ {"SONNENBRILLE", "LUNETTES DE SOLEIL", "GAFAS DE SOL", "SUNGLASSES"},
+ {"FUSSRASTE", "REPOSE-PIED DE MOTO", "ESTRIBO DE LA MOTO", "MOTORCYCLE FOOT REST"},
+ {"HANDSTAUBSAUGER", "ASPIRATEUR A MAIN", "ASPIRADORA DE MANO", "HANDHELD VACUUM CLEANER"},
+ {"PLAN", "PLAN GENIAL", "PLAN", "PLAN"},
+ {"BLASEBALG", "SOUFFLET", "FUELLE", "BELLOWS"},
+ {"EIMER", "SEAU", "CUBO", "BUCKET"},
+ {"SCHL\303\234SSEL", "CLE DU REFRIGERATEUR", "LLAVE", "REFRIGERATOR KEY"}
};
-const char *const kShackHotspotNames[][3] = {
- {"", "", ""},
- {"T\303\234R", "PORTE", "PUERTA"},
- {"SPALT", "ORIFICE", "RENDIJA"},
- {"FENSTER", "FENETRE", "VENTANA"},
- {"FENSTER", "PETITE FENETRE", "VENTANA PEQUE\303\221A"},
- {"HOLZST\303\234CK", "MORCEAU DE BOIS ROND", "TROZO REDONDO DE MADERA"},
- {"FALLT\303\234R", "TRAPPE", "TRAMPILLA"},
- {"STOFFFETZEN", "TISSU DECHIRE", "TELA HECHA JIRONES"},
- {"K\303\234HLTRUHE", "CONGELATEUR", "CONGELADOR"},
- {"FETZEN", "CHIFFON", "TRAPO"},
- {"STECKER", "PRISE ELECTRIQUE", "ENCHUFE"},
- {"ABFLUSS", "TUYAU DE VIDANGE DU CONGELATEUR", "DESAG\303\234E DEL CONGELADOR"},
- {"TELEFON", "TELEPHONE", "TEL\303\211FONO"},
- {"REGAL", "ETAGERES", "ESTANTER\303\215A"},
- {"BRECHSTANGE", "PIED-DE-BICHE", "PALANCA"},
- {"BRILLENRESTE", "LUNETTES CASSEES", "GAFAS ROTAS"},
- {"BLASEBALG", "SOUFFLET", "FUELLE"},
- {"DOSE", "BOUTEILLE", "BOTE"},
- {"K\303\234HLTRUHENDECKEL", "COUVERCLE DU CONGELATEUR", "TAPA DEL CONGELADOR"},
- {"ABFLUSS", "TUYAU DE VIDANGE DU CONGELATEUR", "DESAG\303\234E DEL CONGELADOR"}
+const char *const kShackHotspotNames[][4] = {
+ {"", "", "", ""},
+ {"T\303\234R", "PORTE", "PUERTA", "DOOR"},
+ {"SPALT", "ORIFICE", "RENDIJA", "CRACK"},
+ {"FENSTER", "FENETRE", "VENTANA", "WINDOW"},
+ {"FENSTER", "PETITE FENETRE", "VENTANA PEQUE\303\221A", "SMALL WINDOW"},
+ {"HOLZST\303\234CK", "MORCEAU DE BOIS ROND", "TROZO REDONDO DE MADERA", "ROUND PIECE OF WOOD"},
+ {"FALLT\303\234R", "TRAPPE", "TRAMPILLA", "TRAP DOOR"},
+ {"STOFFFETZEN", "TISSU DECHIRE", "TELA HECHA JIRONES", "FABRIC TORN TO SHREDS"},
+ {"K\303\234HLTRUHE", "CONGELATEUR", "CONGELADOR", "FREEZER"},
+ {"FETZEN", "CHIFFON", "TRAPO", "RAG"},
+ {"STECKER", "PRISE ELECTRIQUE", "ENCHUFE", "ELECTRIC PLUG"},
+ {"ABFLUSS", "TUYAU DE VIDANGE DU CONGELATEUR", "DESAG\303\234E DEL CONGELADOR", "FREEZER DRAIN"},
+ {"TELEFON", "TELEPHONE", "TEL\303\211FONO", "TELEPHONE"},
+ {"REGAL", "ETAGERES", "ESTANTER\303\215A", "SHELVES"},
+ {"BRECHSTANGE", "PIED-DE-BICHE", "PALANCA", "CROWBAR"},
+ {"BRILLENRESTE", "LUNETTES CASSEES", "GAFAS ROTAS", "BROKEN GLASSES"},
+ {"BLASEBALG", "SOUFFLET", "FUELLE", "BELLOWS"},
+ {"DOSE", "BOUTEILLE", "BOTE", "CAN"},
+ {"K\303\234HLTRUHENDECKEL", "COUVERCLE DU CONGELATEUR", "TAPA DEL CONGELADOR", "FREEZER LID"},
+ {"ABFLUSS", "TUYAU DE VIDANGE DU CONGELATEUR", "DESAG\303\234E DEL CONGELADOR", "FREEZER DRAIN"}
};
} // End of anonymous namespace
@@ -145,11 +145,11 @@ Common::U32String RunawayStrings::text(TextId id) const {
}
Common::U32String RunawayStrings::itemName(byte item) const {
- return Common::U32String(_languageIndex < 3 && item < ARRAYSIZE(kItemNames) ? kItemNames[item][_languageIndex] : "");
+ return Common::U32String(item < ARRAYSIZE(kItemNames) ? kItemNames[item][_languageIndex] : "");
}
Common::U32String RunawayStrings::shackHotspotName(byte hotspot) const {
- return Common::U32String(_languageIndex < 3 && hotspot < ARRAYSIZE(kShackHotspotNames) ? kShackHotspotNames[hotspot][_languageIndex] : "");
+ return Common::U32String(hotspot < ARRAYSIZE(kShackHotspotNames) ? kShackHotspotNames[hotspot][_languageIndex] : "");
}
} // End of namespace Hollywood
Commit: ca2e6dba7eba6ca4596a4cbe2b3e003ace609872
https://github.com/scummvm/scummvm/commit/ca2e6dba7eba6ca4596a4cbe2b3e003ace609872
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: implemented scene 4010 and 4070
Changed paths:
A engines/hollywood/runaway/scene4010.cpp
A engines/hollywood/runaway/scene4070.cpp
engines/hollywood/configure.engine
engines/hollywood/module.mk
engines/hollywood/runaway/detection_tables.h
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/engine.h
engines/hollywood/runaway/intro.cpp
engines/hollywood/runaway/intro.h
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/inventory.h
engines/hollywood/runaway/saveload.cpp
engines/hollywood/runaway/saveload.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene2010.cpp
engines/hollywood/runaway/scene2010.h
engines/hollywood/runaway/scene2020.cpp
engines/hollywood/runaway/scene2060.cpp
engines/hollywood/runaway/scene4030.cpp
engines/hollywood/runaway/scene4050.cpp
engines/hollywood/runaway/scene4060.cpp
engines/hollywood/runaway/scene4090.cpp
engines/hollywood/runaway/scene4100.cpp
engines/hollywood/runaway/scene4140.cpp
engines/hollywood/runaway/scene_data.h
engines/hollywood/runaway/sequence.cpp
engines/hollywood/runaway/sequence.h
engines/hollywood/runaway/ui.cpp
engines/hollywood/runaway/ui.h
engines/hollywood/runaway/video.cpp
engines/hollywood/runaway/video.h
diff --git a/engines/hollywood/configure.engine b/engines/hollywood/configure.engine
index db33b94f169..5e3725e0249 100644
--- a/engines/hollywood/configure.engine
+++ b/engines/hollywood/configure.engine
@@ -1,3 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
-add_engine hollywood "Hollywood Monsters & Runaway" yes "" "" "16bit highres" "msmpeg4"
+add_engine hollywood "Hollywood Monsters & Runaway" yes "" "" "16bit highres" "msmpeg4 bink"
diff --git a/engines/hollywood/module.mk b/engines/hollywood/module.mk
index 126d3220046..905e5291d7b 100644
--- a/engines/hollywood/module.mk
+++ b/engines/hollywood/module.mk
@@ -154,9 +154,11 @@ MODULE_OBJS = \
runaway/scene2020.o \
runaway/scene2060.o \
runaway/scene2080.o \
+ runaway/scene4010.o \
runaway/scene4030.o \
runaway/scene4050.o \
runaway/scene4060.o \
+ runaway/scene4070.o \
runaway/scene4090.o \
runaway/scene4100.o \
runaway/scene4140.o \
diff --git a/engines/hollywood/runaway/detection_tables.h b/engines/hollywood/runaway/detection_tables.h
index baee81dca37..a1b1298004b 100644
--- a/engines/hollywood/runaway/detection_tables.h
+++ b/engines/hollywood/runaway/detection_tables.h
@@ -23,7 +23,7 @@
#define HOLLYWOOD_RUNAWAY_DETECTION_TABLES_H
// Included in the shared ADGameDescription array in hollywood/detection.cpp.
- // English retail release. Hospital chapter and chapter-three shack.
+ // English retail release. Hospital, museum and chapter-three shack.
{
"runaway",
nullptr,
@@ -35,6 +35,18 @@
ADGF_UNSTABLE,
GUIO2(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD)
},
+ // English GOG release, with Bink movies.
+ {
+ "runaway",
+ "GOG",
+ AD_ENTRY3s("RESOURCE.000", "22f373594fc346cf2d739b454ca5c789", 110716101,
+ "RESOURCE.003", "8aa07584175fc9d28c1aff5fa5f93a5f", 7340291,
+ "RESOURCE.B02", "486eace90c76d8772d751a879466cc39", 8352653),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO2(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD)
+ },
// English museum demo (2000). Gameplay POC; movies are not supported.
{
"runaway",
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index 3b5fa37565e..a569cf99f5d 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -163,7 +163,7 @@ Common::Error RunawayEngine::loadGameStream(Common::SeekableReadStream *stream)
RunawayScene *RunawayEngine::createScene(uint16 entryScene) {
if (findRunawayRoom(entryScene) && ((_museum && entryScene >= 4000) ||
- (_game == kRunawayFullGame && entryScene / 1000 == 2)))
+ (_game == kRunawayFullGame && (entryScene / 1000 == 2 || entryScene / 1000 == 4))))
return new RunawayRoomScene(_audio, *_inventory, _strings, _game);
if ((_game == kRunawayCabinDemo || _game == kRunawayFullGame) && entryScene == 5030)
return new RunawayScene5030(_mixer, _audio, *_inventory, _strings, _game);
@@ -252,11 +252,11 @@ void RunawayEngine::syncSoundSettings() {
_ui->setPointerSound(settings.pointerSound);
}
-Common::Error RunawayEngine::playIntro(RunawayMenu &menu) {
+Common::Error RunawayEngine::playIntro(RunawayMenu &menu, byte chapter) {
_inPresentation = true;
_loadedGame = false;
RunawayIntro intro(_mixer);
- if (!intro.load(_game == kRunawayFullGame)) {
+ if (!intro.load(_game == kRunawayFullGame, chapter)) {
_inPresentation = false;
return Common::Error(Common::kReadingFailed, "Cannot load the Runaway opening resources");
}
@@ -300,13 +300,42 @@ Common::Error RunawayEngine::playIntro(RunawayMenu &menu) {
return Common::kNoError;
}
+Common::Error RunawayEngine::startChapter(RunawayMenu &menu, byte chapter) {
+ const uint16 entry = chapter == 2 ? 4010 : 5030;
+ Common::ScopedPtr<RunawayScene> scene(createScene(entry));
+ if (!scene || !scene->load(entry) || !_ui->loadChapter(chapter))
+ return Common::Error(Common::kReadingFailed, "Cannot load Runaway chapter resources");
+ _audio.stopSpeech();
+ _audio.stopEffect();
+ _audio.stopMusic();
+ _audio.setChapter(chapter);
+ _state = RunawaySaveState();
+ _state.game = _game;
+ _state.scene = entry;
+ _inventory->startChapter(chapter);
+ _ui->restoreState(_state, getTotalPlayTime());
+ _scene.reset(scene.release());
+ _pendingDoorClose = false;
+ syncSoundSettings();
+ const Common::Error result = playIntro(menu, chapter);
+ if (result.getCode() == Common::kNoError && !_loadedGame && !shouldQuit())
+ _scene->start(getTotalPlayTime());
+ _loadedGame = false;
+ return result;
+}
+
Common::Error RunawayEngine::run() {
_inventory.reset(new RunawayInventory(_strings, _game));
if (_museum && ConfMan.hasKey("boot_param") && ConfMan.getInt("boot_param") >= 4000 &&
findRunawayRoom(ConfMan.getInt("boot_param")))
_state.scene = ConfMan.getInt("boot_param");
- if (_game == kRunawayFullGame && ConfMan.hasKey("boot_param") && ConfMan.getInt("boot_param") == 5030)
- _state.scene = 5030;
+ if (_game == kRunawayFullGame && ConfMan.hasKey("boot_param")) {
+ const int scene = ConfMan.getInt("boot_param");
+ if (scene == 4000)
+ _state.scene = 4010;
+ else if (scene == 5030 || findRunawayRoom(scene))
+ _state.scene = scene;
+ }
_inventory->setChapter(_state.chapter());
_audio.setChapter(_state.chapter());
_scene.reset(createScene(_state.scene));
@@ -334,6 +363,10 @@ Common::Error RunawayEngine::run() {
const Common::Error result = playIntro(menu);
if (result.getCode() != Common::kNoError || shouldQuit())
return result;
+ } else if (_game == kRunawayFullGame && _state.scene == 4010) {
+ const Common::Error result = playIntro(menu, 2);
+ if (result.getCode() != Common::kNoError || shouldQuit())
+ return result;
}
if (!_loadedGame)
_scene->start(getTotalPlayTime());
@@ -352,6 +385,7 @@ Common::Error RunawayEngine::run() {
_audio.playEffect(4);
}
Common::Point mouse = _eventMan->getMousePos();
+ _ui->setDialogueChoices(_scene->dialogueChoices());
_ui->update(now, mouse, _scene->hotspotAt(mouse), sceneBusy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
bool openMenu = false;
Common::Event event;
@@ -365,6 +399,9 @@ Common::Error RunawayEngine::run() {
case RunawayUI::Command::kOpenMenu:
openMenu = true;
break;
+ case RunawayUI::Command::kChooseDialogue:
+ _scene->chooseDialogue(command.target);
+ break;
case RunawayUI::Command::kRoom:
_scene->click(command.mouse, command.verb, command.item);
break;
@@ -384,6 +421,7 @@ Common::Error RunawayEngine::run() {
}
} else if (event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START || event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_END) {
mouse = _eventMan->getMousePos();
+ _ui->setDialogueChoices(_scene->dialogueChoices());
_ui->update(now, mouse, _scene->hotspotAt(mouse), sceneBusy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
const bool pressed = event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_START;
switch (event.customType) {
@@ -467,9 +505,15 @@ Common::Error RunawayEngine::run() {
continue;
}
if (_scene->escaped()) {
- // Retail currently ends after the hospital or the chapter-three shack.
- if (_game == kRunawayFullGame)
- return Common::kNoError;
+ if (_game == kRunawayFullGame) {
+ if (_state.chapter() >= 3)
+ return Common::kNoError;
+ const Common::Error result = startChapter(menu, _state.chapter() + 1);
+ if (result.getCode() != Common::kNoError || shouldQuit())
+ return result;
+ leftPressed = rightPressed = false;
+ continue;
+ }
// The extended French demo's later rooms are not implemented yet;
// all three releases currently finish at the shared shack escape.
const Common::Error result = playEnding(menu);
@@ -479,6 +523,7 @@ Common::Error RunawayEngine::run() {
leftPressed = rightPressed = false;
continue;
}
+ _ui->setDialogueChoices(_scene->dialogueChoices());
_ui->update(now, mouse, _scene->hotspotAt(mouse), sceneBusy(), _scene->speaking(), _scene->inventoryPresentation(), _scene->speechFrame());
_scene->draw();
Graphics::ManagedSurface &screen = _scene->screen();
diff --git a/engines/hollywood/runaway/engine.h b/engines/hollywood/runaway/engine.h
index e2aa337b931..06f9a12a9ff 100644
--- a/engines/hollywood/runaway/engine.h
+++ b/engines/hollywood/runaway/engine.h
@@ -69,7 +69,8 @@ private:
RunawayScene *createScene(uint16 entryScene);
Common::Error changeScene();
bool sceneBusy() const;
- Common::Error playIntro(RunawayMenu &menu);
+ Common::Error playIntro(RunawayMenu &menu, byte chapter = 0);
+ Common::Error startChapter(RunawayMenu &menu, byte chapter);
Common::Error playEnding(RunawayMenu &menu);
void pauseMenu(RunawayMenu &menu, Graphics::ManagedSurface &screen);
RunawayMenu::Settings readSettings() const;
diff --git a/engines/hollywood/runaway/intro.cpp b/engines/hollywood/runaway/intro.cpp
index 42e14d89b0a..00d3b88748e 100644
--- a/engines/hollywood/runaway/intro.cpp
+++ b/engines/hollywood/runaway/intro.cpp
@@ -50,8 +50,13 @@ const uint kStoryHoldDuration = 40000;
} // End of anonymous namespace
-bool RunawayIntro::load(bool fullGame) {
+bool RunawayIntro::load(bool fullGame, byte chapter) {
_fullGame = fullGame;
+ _chapter = chapter;
+ const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ _screen.create(kRunawayScreenWidth, kRunawayScreenHeight, format);
+ if (chapter)
+ return _opening.load(chapter);
ChunkArchive archive;
if (!archive.open(Common::Path("RESOURCE.A02")))
return false;
@@ -59,8 +64,6 @@ bool RunawayIntro::load(bool fullGame) {
if (!_logo[i].load(archive, i, kLogoFrameCounts[i]))
return false;
}
- const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
- _screen.create(kRunawayScreenWidth, kRunawayScreenHeight, format);
if (_fullGame)
return _opening.load();
@@ -82,6 +85,10 @@ bool RunawayIntro::load(bool fullGame) {
}
void RunawayIntro::start(uint32 now) {
+ if (_chapter) {
+ startStory(now);
+ return;
+ }
_phase = kLogo;
_phaseStarted = now;
_audio.playIntroMusic();
diff --git a/engines/hollywood/runaway/intro.h b/engines/hollywood/runaway/intro.h
index dffd7493601..8f84518ecdd 100644
--- a/engines/hollywood/runaway/intro.h
+++ b/engines/hollywood/runaway/intro.h
@@ -33,7 +33,7 @@ namespace Hollywood {
class RunawayIntro {
public:
explicit RunawayIntro(Audio::Mixer *mixer) : _audio(mixer), _opening(_audio) {}
- bool load(bool fullGame = false);
+ bool load(bool fullGame = false, byte chapter = 0);
void start(uint32 now);
void skip(uint32 now);
void update(uint32 now);
@@ -50,6 +50,7 @@ private:
RunawayAudio _audio;
RunawayOpening _opening;
bool _fullGame = false;
+ byte _chapter = 0;
RunawayAnimation _logo[3];
Graphics::ManagedSurface _story, _screen;
Phase _phase = kFinished;
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index ca5dfcdf13a..131186a2dc6 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -62,6 +62,7 @@ void RunawayInventory::captureState(RunawaySaveState &state) const {
state.syringeFilled = _syringeFilled;
state.chartWritten = _chartWritten;
state.headWig = _headWig;
+ state.museumItems = _museum;
}
void RunawayInventory::restoreState(const RunawaySaveState &state) {
@@ -77,6 +78,20 @@ void RunawayInventory::restoreState(const RunawaySaveState &state) {
_syringeFilled = state.syringeFilled;
_chartWritten = state.chartWritten;
_headWig = state.headWig;
+ _museum = state.museumItems;
+ _newItem = 0;
+}
+
+void RunawayInventory::startChapter(byte chapter) {
+ _chapter = chapter;
+ _items.clear();
+ _selected = _newItem = 0;
+ if (chapter == 2) {
+ _museum = RunawaySaveState::MuseumItems();
+ const byte initial[] = {1, 2, 3, 4, 7};
+ for (uint i = 0; i < ARRAYSIZE(initial); ++i)
+ add(initial[i]);
+ }
_newItem = 0;
}
@@ -122,6 +137,16 @@ Common::U32String RunawayInventory::name(byte item) const {
}
if (_chapter == 1 && item == 13 && _water == 1)
return Common::U32String("Glass with water");
+ if (_chapter == 2) {
+ if (item == 6 && _museum.frozenBattery)
+ return Common::U32String("Frozen battery");
+ if (item == 11 && _museum.rubyRemoved)
+ return Common::U32String("Mayan mask without ruby");
+ if (item == 14 && _museum.coffee)
+ return Common::U32String(_museum.coffee == 1 ? "Bowl with ground coffee" : "Empty bowl");
+ if (item == 18 && _museum.batteryInLadle)
+ return Common::U32String("Ladle with battery");
+ }
if (_chapter == 2)
return item < ARRAYSIZE(kMuseumItemNames) ? Common::U32String(kMuseumItemNames[item]) : Common::U32String();
if (_chapter == 1)
@@ -132,6 +157,14 @@ Common::U32String RunawayInventory::name(byte item) const {
}
uint RunawayInventory::icon(byte item) const {
+ if (_chapter == 2) {
+ if (item == 7 && _museum.restoredCrucifix) return 24;
+ if (item == 14 && _museum.coffee) return 20 + _museum.coffee;
+ if (item == 6 && _museum.frozenBattery) return 25;
+ if (item == 11 && _museum.rubyRemoved) return 20;
+ if (item == 18 && _museum.batteryInLadle) return 23;
+ if (item == 19 && _museum.packageFilled) return 26;
+ }
if (_chapter == 1) {
if (item == 15 && _syringeFilled)
return 20;
@@ -161,7 +194,7 @@ uint RunawayInventory::cursor(byte item) const {
if (_chapter == 1 && item == 13 && _water == 1)
return 85;
if (_chapter == 2)
- return item && item < ARRAYSIZE(kMuseumItemNames) ? 11 + item * 2 : 0;
+ return item && item < ARRAYSIZE(kMuseumItemNames) ? (_museumDemo ? 11 + item * 2 : 39 + icon(item) * 2) : 0;
if (_chapter == 1)
return item && item <= 19 ? (item == 16 ? 81 : 39 + item * 2 - (item > 16 ? 2 : 0)) : 0;
if (item == 1 && _clothState)
@@ -185,7 +218,18 @@ RunawayInventory::Reply RunawayInventory::examine(byte item) const {
if (_chapter == 2) {
if (!item || item >= ARRAYSIZE(kMuseumItemNames))
return Reply();
- return Reply(item < 5 ? 49 + item : 95 + item, item == 7 ? 1 : 0);
+ byte variation = 0;
+ switch (item) {
+ case 5: variation = _museum.voiceRecorded; break;
+ case 6: variation = _museum.frozenBattery; break;
+ case 7: variation = _museum.restoredCrucifix; break;
+ case 8: case 11: variation = _museum.rubyRemoved; break;
+ case 14: variation = _museum.coffee; break;
+ case 18: variation = _museum.batteryInLadle; break;
+ case 19: variation = _museum.packageFilled; break;
+ default: break;
+ }
+ return Reply(item < 5 ? 49 + item : 95 + item, variation);
}
if (_chapter == 1)
return Reply(item && item <= 19 ? (item == 3 ? 74 : 49 + item) : 1);
@@ -239,6 +283,42 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
return Reply(72, 4);
return Reply();
}
+ if (_chapter == 2) {
+ if (first == 5 && second == 6) {
+ if (!_museum.frozenBattery)
+ return Reply(115);
+ _museum.recorderBattery = 3;
+ remove(6);
+ return Reply(115, 1);
+ }
+ if (first == 6 && second == 18) {
+ if (_museum.frozenBattery)
+ return Reply(116, 2);
+ _museum.batteryInLadle = 1;
+ remove(6);
+ return Reply(116);
+ }
+ if (first == 8 && second == 11) {
+ if (_museum.rubyRemoved)
+ return Reply(117, 2);
+ _museum.rubyRemoved = 1;
+ add(12);
+ return Reply(117);
+ }
+ if (first == 11 && second == 12)
+ return Reply(120);
+ if (first == 14 && second == 19) {
+ if (_museum.coffee != 1)
+ return Reply(_museum.coffee ? 1 : 121);
+ _museum.coffee = 2;
+ _museum.packageFilled = 1;
+ return Reply(121, 1);
+ }
+ if (first == 9 || second == 9) return Reply(118);
+ if (first == 10 || second == 10) return Reply(119);
+ if (first == 15 || second == 15) return Reply(122);
+ return Reply();
+ }
if (_chapter != 3)
return Reply();
// The combinations available among the shack's items, from 0x4158c0
diff --git a/engines/hollywood/runaway/inventory.h b/engines/hollywood/runaway/inventory.h
index 7cb199f2056..8dcaf5737c6 100644
--- a/engines/hollywood/runaway/inventory.h
+++ b/engines/hollywood/runaway/inventory.h
@@ -25,6 +25,7 @@
#include "common/array.h"
#include "common/ustr.h"
#include "hollywood/runaway/detection.h"
+#include "hollywood/runaway/saveload.h"
namespace Hollywood {
@@ -42,8 +43,10 @@ public:
Reply(uint16 c = 1, byte v = 0) : cue(c), variation(v) {}
};
RunawayInventory(const RunawayStrings &strings, RunawayGameType game) :
- _strings(strings), _chapter(game == kRunawayFullGame ? 1 : game == kRunawayMuseumDemo ? 2 : 3) {}
+ _strings(strings), _museumDemo(game == kRunawayMuseumDemo), _chapter(game == kRunawayFullGame ? 1 : game == kRunawayMuseumDemo ? 2 : 3) {}
void setChapter(byte chapter) { _chapter = chapter; }
+ void startChapter(byte chapter);
+ RunawaySaveState::MuseumItems &museum() { return _museum; }
bool contains(byte item) const;
bool add(byte item);
void remove(byte item);
@@ -68,7 +71,9 @@ public:
private:
const RunawayStrings &_strings;
+ const bool _museumDemo;
byte _chapter;
+ RunawaySaveState::MuseumItems _museum;
Common::Array<byte> _items;
byte _selected = 0, _newItem = 0, _clothState = 0;
byte _water = 0;
diff --git a/engines/hollywood/runaway/saveload.cpp b/engines/hollywood/runaway/saveload.cpp
index a28a537a577..60afc4cd7ae 100644
--- a/engines/hollywood/runaway/saveload.cpp
+++ b/engines/hollywood/runaway/saveload.cpp
@@ -84,6 +84,56 @@ void RunawaySaveState::sync(Common::Serializer &s) {
s.syncAsByte(syringeFilled, 5);
s.syncAsByte(chartWritten, 5);
s.syncAsByte(headWig, 5);
+ s.syncAsByte(museum.susan, 6);
+ s.syncAsByte(museum.restoration, 6);
+ s.syncAsByte(museum.laserUpgraded, 6);
+ s.syncAsByte(museum.laserSeen, 6);
+ s.syncAsByte(museum.shelvesSeen, 6);
+ s.syncAsByte(museum.susanMet, 6);
+ s.syncAsByte(museum.labVisited, 6);
+ s.syncAsByte(museum.shelfBooksSeen, 6);
+ s.syncAsByte(museum.safeUsed, 6);
+ s.syncAsByte(museum.willyMet, 6);
+ s.syncAsByte(museum.batteryRequested, 6);
+ s.syncAsByte(museum.coffeeMachine, 6);
+ s.syncAsByte(museum.coffeeSeen, 6);
+ s.syncAsByte(museum.basketSeen, 6);
+ s.syncAsByte(museum.needsPackage, 6);
+ s.syncAsByte(museum.needsGroundCoffee, 6);
+ s.syncAsByte(museum.willyInLab, 6);
+ s.syncAsByte(museum.keypad, 6);
+ s.syncAsByte(museum.sawCode, 6);
+ s.syncAsByte(museum.phoneUsed, 6);
+ s.syncAsByte(museum.voiceLockSeen, 6);
+ s.syncAsByte(museum.chamberOpen, 6);
+ s.syncAsByte(museum.maskTaken, 6);
+ s.syncAsByte(museum.keyTaken, 6);
+ s.syncAsByte(museum.ladleTaken, 6);
+ s.syncAsByte(museum.cabinetSeen, 6);
+ s.syncAsByte(museum.scannerSeen, 6);
+ s.syncAsByte(museum.nitrogenSeen, 6);
+ s.syncAsByte(museum.microscopeSeen, 6);
+ s.syncAsByte(museum.talcSeen, 6);
+ s.syncAsByte(museum.varnishSeen, 6);
+ s.syncAsByte(museum.mayanObjectsSeen, 6);
+ s.syncAsByte(museum.coffeeBeansTaken, 6);
+ s.syncAsByte(museum.buttonSeen, 6);
+ s.syncAsByte(museum.ownVoiceTried, 6);
+ s.syncAsByte(museum.analysisDoorSeen, 6);
+ s.syncAsByte(museum.leftLabOnce, 6);
+ s.syncAsByte(museum.keySeen, 6);
+ s.syncBytes(museum.exhibitSeen, sizeof(museum.exhibitSeen), 6);
+ s.syncAsUint16LE(museum.keypadDigits, 6);
+ s.syncAsUint32LE(museum.chamberTime, 6);
+ s.syncAsByte(museumItems.businessCardExamined, 6);
+ s.syncAsByte(museumItems.restoredCrucifix, 6);
+ s.syncAsByte(museumItems.voiceRecorded, 6);
+ s.syncAsByte(museumItems.coffee, 6);
+ s.syncAsByte(museumItems.frozenBattery, 6);
+ s.syncAsByte(museumItems.rubyRemoved, 6);
+ s.syncAsByte(museumItems.recorderBattery, 6);
+ s.syncAsByte(museumItems.batteryInLadle, 6);
+ s.syncAsByte(museumItems.packageFilled, 6);
}
byte RunawaySaveState::chapter() const {
@@ -111,7 +161,7 @@ bool RunawaySaveState::valid() const {
if (upperFloor > 1 || books > 2 || recorder > 2 || moneyIdentified > 1 || safeOpen > 1 ||
varnishTaken > 1 || talcTaken > 1 || coffeeTaken > 1 || keyCount > 4)
return false;
- if (game == kRunawayMuseumDemo) {
+ if (game == kRunawayMuseumDemo || (game == kRunawayFullGame && chapter() == 2)) {
const RunawayRoom *room = findRunawayRoom(scene);
if (!room || scene < 4000 || x >= room->width || y >= room->height || camera > room->width - 1024 ||
cameraY > room->height - 600)
@@ -126,13 +176,31 @@ bool RunawaySaveState::valid() const {
hospital.book > 2 || hospital.blankChart > 2 || hospital.headTaken > 1 || hospital.pillowsTaken > 1 ||
markerInk > 3 || syringeFilled > 1 || chartWritten > 1 || headWig > 1)
return false;
- if (game == kRunawayFullGame && chapter() != 3) {
+ if (game == kRunawayFullGame && chapter() == 1) {
const RunawayRoom *room = findRunawayRoom(scene);
if (!room || (room->number != kHospitalBedroom && room->number != kHospitalStoreroom && room->number != kHospitalBathroom) ||
x >= room->width || y >= room->height || cameraY ||
camera < (room->number == kHospitalBedroom ? 156 : 0) || camera > room->width - 1024)
return false;
}
+ if (museum.susan > 3 || museum.restoration > 2 || museum.laserUpgraded > 1 ||
+ museum.laserSeen > 1 || museum.shelvesSeen > 1 || museum.susanMet > 1 ||
+ museum.labVisited > 1 || museum.shelfBooksSeen > 1 || museum.safeUsed > 1 ||
+ museum.willyMet > 2 || museum.batteryRequested > 1 || museum.coffeeMachine > 2 ||
+ museum.coffeeSeen > 1 || museum.basketSeen > 1 || museum.needsPackage > 1 ||
+ museum.needsGroundCoffee > 1 || museum.willyInLab > 2 || museum.keypad > 4 ||
+ museum.sawCode > 2 || museum.phoneUsed > 1 || museum.voiceLockSeen > 1 ||
+ museum.chamberOpen > 1 || museum.maskTaken > 1 || museum.keyTaken > 1 ||
+ museum.ladleTaken > 1 || museum.cabinetSeen > 1 || museum.scannerSeen > 1 ||
+ museum.nitrogenSeen > 1 || museum.microscopeSeen > 1 || museum.talcSeen > 1 ||
+ museum.varnishSeen > 1 || museum.mayanObjectsSeen > 1 || museum.coffeeBeansTaken > 1 ||
+ museum.buttonSeen > 1 || museum.ownVoiceTried > 1 || museum.analysisDoorSeen > 1 || museum.leftLabOnce > 1 || museum.keySeen > 1 ||
+ museum.exhibitSeen[0] > 1 || museum.exhibitSeen[1] > 1 || museum.exhibitSeen[2] > 1 ||
+ museum.keypadDigits > 9999 || museum.chamberTime > 30000 || museumItems.businessCardExamined > 1 ||
+ museumItems.restoredCrucifix > 1 || museumItems.voiceRecorded > 1 || museumItems.coffee > 2 ||
+ museumItems.frozenBattery > 1 || museumItems.rubyRemoved > 1 || museumItems.recorderBattery > 4 ||
+ museumItems.batteryInLadle > 1 || museumItems.packageFilled > 1)
+ return false;
if ((coolerMoved && ice != 2) || ((hatch != 0) != (coolerMoved != 0)))
return false;
for (uint i = 0; i < sizeof(pickedUp); ++i) {
@@ -154,7 +222,7 @@ bool RunawaySaveState::read(Common::SeekableReadStream &stream) {
if (stream.readUint32BE() != MKTAG('R', 'U', 'N', 'A'))
return false;
const uint16 version = stream.readUint16LE();
- if (version < 1 || version > 5)
+ if (version < 1 || version > 6)
return false;
Common::Serializer s(&stream, nullptr);
s.setVersion(version);
@@ -166,9 +234,9 @@ bool RunawaySaveState::write(Common::WriteStream &stream) {
if (!valid())
return false;
stream.writeUint32BE(MKTAG('R', 'U', 'N', 'A'));
- stream.writeUint16LE(5);
+ stream.writeUint16LE(6);
Common::Serializer s(nullptr, &stream);
- s.setVersion(5);
+ s.setVersion(6);
sync(s);
return !s.err();
}
diff --git a/engines/hollywood/runaway/saveload.h b/engines/hollywood/runaway/saveload.h
index 3a9024dd5d3..934332644a3 100644
--- a/engines/hollywood/runaway/saveload.h
+++ b/engines/hollywood/runaway/saveload.h
@@ -37,6 +37,27 @@ struct RunawaySaveState {
byte storeroomVisited = 0, syringesSeen = 0, sprayTaken = 0, book = 0, blankChart = 0, headTaken = 0, pillowsTaken = 0;
} hospital;
+ struct Museum {
+ byte susan = 0, restoration = 0, laserUpgraded = 0, laserSeen = 0, shelvesSeen = 0;
+ byte susanMet = 0, labVisited = 0, shelfBooksSeen = 0, safeUsed = 0;
+ byte willyMet = 0, batteryRequested = 0, coffeeMachine = 0, coffeeSeen = 0;
+ byte basketSeen = 0, needsPackage = 0, needsGroundCoffee = 0, willyInLab = 0;
+ byte keypad = 0, sawCode = 0, phoneUsed = 0, voiceLockSeen = 0;
+ byte chamberOpen = 0, maskTaken = 0, keyTaken = 0, ladleTaken = 0;
+ byte cabinetSeen = 0, scannerSeen = 0, nitrogenSeen = 0, microscopeSeen = 0;
+ byte talcSeen = 0, varnishSeen = 0, mayanObjectsSeen = 0, coffeeBeansTaken = 0;
+ byte buttonSeen = 0, ownVoiceTried = 0, analysisDoorSeen = 0, leftLabOnce = 0, keySeen = 0;
+ byte exhibitSeen[3] = {};
+ uint16 keypadDigits = 0;
+ uint32 chamberTime = 0;
+ } museum;
+
+ struct MuseumItems {
+ byte businessCardExamined = 0;
+ byte restoredCrucifix = 0, voiceRecorded = 0, coffee = 0, frozenBattery = 0;
+ byte rubyRemoved = 0, recorderBattery = 0, batteryInLadle = 0, packageFilled = 0;
+ } museumItems;
+
uint16 scene = 5030, x = 623, y = 447, camera = 111;
byte facing = 3, lidOpen = 0, unplugged = 0, windowClean = 0;
byte coolerMoved = 0, coolerInspected = 0, peeked = 0, ice = 0, hatch = 0;
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index 6146d0dc08f..1afec638602 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -37,7 +37,7 @@ namespace {
const RunawayRoom *const kRooms[] = {
&kRunawayScene2020, &kRunawayScene2060, &kRunawayScene2080,
- &kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140
+ &kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4070, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140
};
const RunawayResponse kGlobalResponses[] = {
@@ -64,6 +64,14 @@ const RunawayResponse kGlobalResponses[] = {
const RunawayRoom *findRoom(int number) {
if (number >= 2021 && number <= 2023)
number = kHospitalBedroom;
+ if (number == 4010 || (number >= 4061 && number <= 4065))
+ number = kMuseumHall;
+ else if (number >= 4071 && number <= 4072)
+ number = kMuseumWilly;
+ else if (number == 4101)
+ number = kMuseumSecurity;
+ else if (number >= 4141 && number <= 4142)
+ number = kMuseumKeypad;
for (uint i = 0; i < ARRAYSIZE(kRooms); ++i) {
if (kRooms[i]->number == number)
return kRooms[i];
@@ -98,6 +106,10 @@ void RunawayRoomScene::start(uint32 now) {
resume();
return;
}
+ if (museumChapter()) {
+ startMuseum();
+ return;
+ }
const byte initialItems[] = {1, 2, 3, 4, 7};
for (uint i = 0; i < ARRAYSIZE(initialItems); ++i)
_inventory.add(initialItems[i]);
@@ -106,6 +118,10 @@ void RunawayRoomScene::start(uint32 now) {
}
void RunawayRoomScene::resume() {
+ if (museumChapter()) {
+ resumeMuseum();
+ return;
+ }
if (_game == kRunawayFullGame) {
if (_sequence.active())
return;
@@ -122,7 +138,7 @@ void RunawayRoomScene::resume() {
_inventory.setWater(2);
if (_room == kHospitalStoreroom || _entryScene == 2022) {
static const byte frames[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
- beginHospitalAnimation(_entryScene, _room == kHospitalStoreroom ? 10 : 23, 13, frames, ARRAYSIZE(frames));
+ beginRoomAnimation(_entryScene, _room == kHospitalStoreroom ? 10 : 23, 13, frames, ARRAYSIZE(frames));
} else if (_entryScene == 2023) {
startHospitalFilm(kAmbushFilm);
} else {
@@ -155,6 +171,7 @@ void RunawayRoomScene::captureState(RunawaySaveState &state) const {
state.coffeeTaken = _coffeeTaken;
state.keyCount = _keyCount;
state.hospital = _hospital;
+ state.museum = _museum;
state.randomSeed = _random.getSeed();
}
@@ -162,6 +179,7 @@ bool RunawayRoomScene::restoreState(const RunawaySaveState &state, uint32 now, b
if (!state.valid() || state.game != _game || state.scene != _entryScene)
return false;
_hospital = state.hospital;
+ _museum = state.museum;
_entering = entering;
_upperFloor = state.upperFloor;
_books = (ObjectState)state.books;
@@ -196,9 +214,9 @@ bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte fac
const Common::Path path(Common::String::format("RESOURCE.%c%02u", 'A' + number / 1000 - 1, (number % 1000) / 10));
if (!_archive.open(path, 40) ||
!loadRunawayMask(_archive, room->width, room->height, _mask, _originalMaps) ||
- !_text.load("RESOURCE.003", "Runaway room", number / 10, 0, 0x1135))
+ !_text.load("RESOURCE.003", "Runaway room", number == kMuseumWilly ? 406 : number / 10, 0, 0x1135))
return false;
- if (_game == kRunawayFullGame ? !_actor.loadChapter(1, true) :
+ if (_game == kRunawayFullGame ? !_actor.loadChapter(number < 4000 ? 1 : 2, number != kMuseumHall) :
!_actor.load(number == kMuseumHall ? RunawayActor::kMuseumHall : RunawayActor::kMuseumInterior))
return false;
_room = number;
@@ -237,6 +255,12 @@ bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte fac
case kMuseumHall:
loaded = loadScene4060();
break;
+ case kMuseumWilly:
+ loaded = loadScene4070();
+ break;
+ case kMuseumSecurity:
+ loaded = loadScene4100();
+ break;
case kMuseumKeypad:
loaded = loadScene4140();
break;
@@ -293,6 +317,10 @@ bool RunawayRoomScene::rebuildBackground() {
return applyBackground4030();
case kMuseumLaboratory:
return applyBackground4050();
+ case kMuseumExhibition:
+ return applyBackground4090();
+ case kMuseumSecurity:
+ return applyBackground4100();
default:
return true;
}
@@ -319,6 +347,9 @@ void RunawayRoomScene::updateMaps() {
case kMuseumHall:
updateMaps4060();
break;
+ case kMuseumSecurity:
+ updateMaps4100();
+ break;
default:
break;
}
@@ -397,6 +428,8 @@ void RunawayRoomScene::arrive() {
_pendingHotspot = 0;
if (id) {
_facing = hotspot(id)->facing;
+ if (museumChapter() && _room == kMuseumLaboratory && id == 3 && _museum.susan == 1)
+ _facing = 1;
if (_pendingItem)
useItem(_pendingItem, id);
else
@@ -435,8 +468,14 @@ void RunawayRoomScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
}
}
}
- if (approach)
- walkTo(Common::Point(spot->x, spot->y));
+ if (approach) {
+ Common::Point position(spot->x, spot->y);
+ if (museumChapter() && _room == kMuseumLaboratory && id == 3 && _museum.susan == 1)
+ position = Common::Point(912, 584);
+ if (museumChapter() && _room == kMuseumSecurity && item == 5 && (id == 3 || id == 4))
+ position = Common::Point(204, 448);
+ walkTo(position);
+ }
else {
_path.clear();
_pathIndex = 0;
@@ -458,7 +497,7 @@ void RunawayRoomScene::showLine() {
}
}
-void RunawayRoomScene::say(uint16 cue, byte variation, bool global) {
+void RunawayRoomScene::say(uint16 cue, byte variation, bool global, byte speaker) {
SceneSpeechCue speech;
if (global)
_text.getStaticSpeechCue(cue, variation, speech.textRecordId, speech.continuationCount, speech.voiceSampleId);
@@ -471,6 +510,7 @@ void RunawayRoomScene::say(uint16 cue, byte variation, bool global) {
line.text = Common::U32String(_text.largeTextRecord(speech.textRecordId + i), Common::kDos850);
line.sample = _game == kRunawayFullGame && speech.voiceSampleId ? speech.voiceSampleId + i : 0;
line.global = global;
+ line.speaker = speaker;
if (!line.text.empty())
_lines.push_back(line);
}
@@ -483,7 +523,7 @@ void RunawayRoomScene::sayInventory(const RunawayInventory::Reply &reply) {
_pathIndex = 0;
_pendingHotspot = 0;
_caption.clear();
- if (_game == kRunawayFullGame && sayHospitalInventory(reply))
+ if (_game == kRunawayFullGame && (museumChapter() ? sayMuseumInventory(reply) : sayHospitalInventory(reply)))
return;
say(reply.cue, reply.variation, true);
}
@@ -540,6 +580,12 @@ void RunawayRoomScene::execute(uint16 action) {
case kMuseumHall:
result = execute4060(action);
break;
+ case kMuseumExhibition:
+ result = execute4090(action);
+ break;
+ case kMuseumSecurity:
+ result = execute4100(action);
+ break;
default:
break;
}
@@ -550,6 +596,10 @@ void RunawayRoomScene::execute(uint16 action) {
}
if (result != kUnhandled)
return;
+ if (action == 15 || action == 19) {
+ say(action == 15 ? 14 : 17, _random.getRandomNumber(action == 15 ? 2 : 1), true);
+ return;
+ }
const RunawayRoom *room = findRoom(_room);
for (uint i = 0; i < room->exitCount; ++i) {
@@ -623,8 +673,12 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
_lastUpdate = now;
if (_sequence.active()) {
_sequence.update(now);
- if (!_sequence.active())
- finishHospitalFilm();
+ if (!_sequence.active()) {
+ if (museumChapter())
+ finishMuseumFilm();
+ else
+ finishHospitalFilm();
+ }
return;
}
if (_pressedKey && (int32)(now - _keyUntil) >= 0)
@@ -635,9 +689,13 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
update2020();
else if (_room == kHospitalBathroom)
update2080();
- if (_game == kRunawayFullGame) {
+ if (museumChapter()) {
+ updateMuseum(elapsed, inventoryOpen);
+ if (_sequence.active() || _transition.scene)
+ return;
+ } else if (_game == kRunawayFullGame) {
if (_room != kHospitalBathroom)
- updateHospitalAnimation();
+ updateRoomAnimation();
if (_sequence.active() || _transition.scene)
return;
updateHospitalAudio();
@@ -646,6 +704,10 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
return;
}
}
+ if (_room == kMuseumWilly) {
+ _actor.setFrame(_facing, 0, speaking() && !speaker() ? speechFrame() : -1);
+ return;
+ }
if (inventoryOpen || _room == kMuseumKeypad)
return;
if (_pathIndex < _path.size() && !speaking()) {
@@ -691,7 +753,7 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
const bool idle = !walking && !busy();
_idleHead.update(now, idle, _lipSync.frameDuration(), _random);
if (!walking)
- headFrame = speaking() ? speechFrame() : idle ? _idleHead.frame() : -1;
+ headFrame = speaking() && !speaker() ? speechFrame() : idle ? _idleHead.frame() : -1;
}
_actor.setFrame(_facing, walking ? 1 + (_walkElapsed / 60) % 12 : 0, headFrame);
if (scrollDirection)
@@ -699,7 +761,7 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
else if (walking)
setCameraX(_camera.x + CLIP<int>(_position.x - kRunawayScreenWidth / 2 - _camera.x,
-MIN<int>(_fastScrolling ? 8 : 4, elapsed), MIN<int>(_fastScrolling ? 8 : 4, elapsed)));
- if (_room == kMuseumHall && !_upperFloor)
+ if (_room == kMuseumHall && !_upperFloor && (!_roomAction || _roomAction < 461 || _roomAction > 466))
_camera.y = CLIP<int>(_position.y - 400, 200, 600);
}
@@ -716,12 +778,19 @@ void RunawayRoomScene::draw() {
drawScene4140(viewport);
return;
}
- if (_room == kHospitalBedroom) {
+ if (_room == kMuseumWilly) {
+ drawScene4070(viewport);
+ } else if (_room == kHospitalBedroom) {
drawScene2020(viewport, false);
} else if (_room == kHospitalBathroom) {
drawScene2080(viewport, false);
+ } else if (_room == kMuseumSecurity && museumChapter()) {
+ drawScene4100(viewport);
} else {
- _ambient.draw(viewport, 0, _camera.x, -_camera.y);
+ const bool movingSusan = museumChapter() && _room == kMuseumLaboratory && drawingRoomAnimation() &&
+ (_roomAction == 450 || _roomAction == 451 || _roomAction == 452 || _roomAction == 331 || _roomAction == 454);
+ if (!movingSusan && (!museumChapter() || _room != kMuseumHall || !_museum.willyInLab))
+ _ambient.draw(viewport, museumChapter() ? _ambientFrame : 0, _camera.x, -_camera.y);
_overlay.draw(viewport, 0, _camera.x, -_camera.y);
}
RunawayActor::RenderParams params;
@@ -746,11 +815,14 @@ void RunawayRoomScene::draw() {
params.antialias = _antialias;
const byte light = MIN<byte>(9, _maps[768 + _mask[_position.y * _background.w + _position.x]]);
memcpy(params.light, findRoom(_room)->light[light], sizeof(params.light));
- const bool roomAnimation = !_actionFrames.empty() && _roomAction && !speaking() && _pathIndex == _path.size();
- if (!roomAnimation && (_room != kHospitalBathroom || (_roomAction != 302 && _roomAction != 307)))
+ const bool roomAnimation = drawingRoomAnimation();
+ if ((!roomAnimation || !_actionHidesActor) && (_room != kHospitalBathroom || (_roomAction != 302 && _roomAction != 307)))
_actor.draw(_screen, params, _mask, _maps);
- if (roomAnimation)
+ if (roomAnimation) {
_actionAnimation.draw(viewport, _actionFrames[MIN<uint>(_actionStep, _actionFrames.size() - 1)], _camera.x, -_camera.y);
+ if (!_secondaryFrames.empty())
+ _secondaryAnimation.draw(viewport, _secondaryFrames[MIN<uint>(_actionStep, _secondaryFrames.size() - 1)], _camera.x, -_camera.y);
+ }
if (_room == kHospitalBedroom)
drawScene2020(viewport, true);
else if (_room == kHospitalBathroom)
@@ -769,4 +841,76 @@ void RunawayRoomScene::drawForeground(Graphics::ManagedSurface &viewport, uint l
}
}
+void RunawayRoomScene::beginRoomAnimation(uint16 action, uint chunk, uint frames, const byte *order, uint count, bool hideActor) {
+ if (!_actionAnimation.load(_archive, chunk, frames))
+ error("Cannot load Runaway room %u animation %u", _room, chunk);
+ _actionFrames.clear();
+ _secondaryFrames.clear();
+ _actionHoldSpeech = false;
+ for (uint i = 0; i < (order ? count : frames); ++i)
+ _actionFrames.push_back(order ? order[i] : i);
+ _roomAction = action;
+ _actionHidesActor = hideActor;
+ _actionStage = 0;
+ _actionStep = 0;
+ _actionStarted = _now;
+}
+
+void RunawayRoomScene::beginRoomAnimationRange(uint16 action, uint chunk, uint frames, uint first, uint last, bool hideActor) {
+ Common::Array<byte> order;
+ assert(first < frames && last < frames && frames <= 256);
+ for (int frame = first;; frame += first <= last ? 1 : -1) {
+ order.push_back(frame);
+ if (frame == (int)last)
+ break;
+ }
+ beginRoomAnimation(action, chunk, frames, order.data(), order.size(), hideActor);
+}
+
+void RunawayRoomScene::holdRoomAnimation(uint16 action, uint chunk, uint frames, uint frame, bool hideActor) {
+ beginRoomAnimationRange(action, chunk, frames, frame, frame, hideActor);
+ _actionHoldSpeech = true;
+}
+
+void RunawayRoomScene::setRoomAnimationOverlay(uint chunk, uint frames, const byte *order, uint count) {
+ if (!_secondaryAnimation.load(_archive, chunk, frames))
+ error("Cannot load Runaway room %u overlay %u", _room, chunk);
+ _secondaryFrames.assign(order, order + count);
+}
+
+void RunawayRoomScene::updateRoomAnimation() {
+ if (!_roomAction || _actionFrames.empty())
+ return;
+ if (speaking() || _pathIndex < _path.size()) {
+ _actionStarted = _now;
+ return;
+ }
+ while (_now - _actionStarted >= 80) {
+ _actionStarted += 80;
+ if (++_actionStep == _actionFrames.size()) {
+ const uint16 action = _roomAction;
+ _roomAction = 0;
+ _actionFrames.clear();
+ if (museumChapter())
+ finishMuseumAnimation(action);
+ else
+ finishHospitalAnimation(action);
+ return;
+ }
+ if (museumChapter()) {
+ museumAnimationFrame();
+ continue;
+ }
+ if ((_roomAction == 335 && _actionStep == 15) || (_roomAction == 339 && _actionStep == 47))
+ _audio.playEffect(46);
+ if (_roomAction == 339 && _actionStep == 16)
+ _audio.playEffect(45);
+ if (_roomAction == 339 && _actionStep == 1 && !applyPatch(18))
+ error("Cannot clear Runaway hospital chart");
+ if ((_roomAction == 332 && (_actionStep == 21 || _actionStep == 35 || _actionStep == 41)) ||
+ (_room == kHospitalStoreroom && _roomAction == 302 && (_actionStep == 23 || _actionStep == 36)))
+ _audio.playFootstep(1, _random.getRandomBit());
+ }
+}
+
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index 23811a06535..947d9b78934 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -60,6 +60,8 @@ public:
virtual bool speaking() const = 0;
virtual byte speechFrame() const { return 0; }
virtual void skipSpeech() = 0;
+ virtual const Common::Array<Common::U32String> &dialogueChoices() const { return _noChoices; }
+ virtual void chooseDialogue(uint choice) {}
virtual bool playingVideo() const { return false; }
virtual bool inventoryPresentation() const { return false; }
virtual void skipVideo() {}
@@ -72,6 +74,7 @@ public:
virtual void setOptions(bool antialias, bool fastScrolling) = 0;
protected:
+ Common::Array<Common::U32String> _noChoices;
uint16 _entryScene = 0;
Transition _transition;
};
@@ -96,7 +99,7 @@ public:
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _caption; }
const Common::U32String &subtitle() const override { return _sequence.active() ? _sequence.subtitle() : _subtitle; }
- bool busy() const override { return _sequence.active() || _pendingHotspot != 0 || _transition.scene || _hospitalExit.scene || _arrivalFacing != 0xff || _hospitalEntryStep || _roomAction || speaking(); }
+ bool busy() const override { return _sequence.active() || _pendingHotspot != 0 || _transition.scene || _hospitalExit.scene || _arrivalFacing != 0xff || _hospitalEntryStep || _roomAction || _conversation || speaking(); }
bool speaking() const override { return !subtitle().empty(); }
byte speechFrame() const override { return _sequence.active() ? _sequence.speechFrame() : _lipSync.frame(_now); }
bool playingVideo() const override { return _sequence.active(); }
@@ -104,6 +107,8 @@ public:
bool escaped() const override { return _chapterComplete; }
void skipSpeech() override;
void sayInventory(const RunawayInventory::Reply &reply) override;
+ const Common::Array<Common::U32String> &dialogueChoices() const override { return _choices; }
+ void chooseDialogue(uint choice) override;
bool canSave() const override { return !busy() && _pathIndex == _path.size() && !_pressedKey; }
void captureState(RunawaySaveState &state) const override;
bool restoreState(const RunawaySaveState &state, uint32 now, bool entering = false) override;
@@ -123,7 +128,7 @@ private:
void arrive();
void execute(uint16 action);
void useItem(byte item, byte hotspot);
- void say(uint16 cue, byte variation = 0, bool global = false);
+ void say(uint16 cue, byte variation = 0, bool global = false, byte speaker = 0);
void showLine();
void changeFloor(bool upper, Common::Point position);
void updateCamera();
@@ -132,8 +137,13 @@ private:
enum HospitalFilm { kGinaStoryFilm, kLedgeFilm, kDecoyFilm, kAmbushFilm, kEscapeFilm };
void startHospitalFilm(HospitalFilm film);
void finishHospitalFilm();
- void beginHospitalAnimation(uint16 action, uint chunk, uint frames, const byte *order = nullptr, uint count = 0);
- void updateHospitalAnimation();
+ void adaptGogFilm(const RunawaySequence::Command *commands);
+ void beginRoomAnimation(uint16 action, uint chunk, uint frames, const byte *order = nullptr, uint count = 0, bool hideActor = true);
+ void beginRoomAnimationRange(uint16 action, uint chunk, uint frames, uint first, uint last, bool hideActor = true);
+ void holdRoomAnimation(uint16 action, uint chunk, uint frames, uint frame, bool hideActor = true);
+ void setRoomAnimationOverlay(uint chunk, uint frames, const byte *order, uint count);
+ bool drawingRoomAnimation() const { return _roomAction && !_actionFrames.empty() && (_actionHoldSpeech || !speaking()) && _pathIndex == _path.size(); }
+ void updateRoomAnimation();
void finishHospitalAnimation(uint16 action);
float actorHeight() const;
const RunawayHotspot *hotspot(byte id) const;
@@ -160,6 +170,30 @@ private:
ActionResult execute2080(uint16 action);
void drawScene2080(Graphics::ManagedSurface &viewport, bool foreground);
+ bool museumChapter() const { return _game == kRunawayFullGame && _room / 1000 == 4; }
+ void startMuseum();
+ void resumeMuseum();
+ void updateMuseum(uint elapsed, bool inventoryOpen);
+ void finishMuseumAnimation(uint16 action);
+ void museumAnimationFrame();
+ void finish4050(uint16 action);
+ void finish4060(uint16 action);
+ void finish4070(uint16 action);
+ void finish4100(uint16 action);
+ bool sayMuseumInventory(const RunawayInventory::Reply &reply);
+ void deferMuseumAction(uint16 action);
+ void refreshMuseum();
+ void leaveMuseumRoom(uint16 scene, Common::Point position, byte facing = 3, bool door = false);
+ enum MuseumFilm { kArrivalFilm, kCliveFilm, kDrillingFilm, kLaserFilm, kRubyFilm,
+ kMobstersFilm, kPhoneFilm, kScannerFilm, kBetrayalFilm, kMuseumExitFilm };
+ void startMuseumFilm(MuseumFilm film);
+ void finishMuseumFilm();
+ void startConversation(byte character);
+ void updateConversation();
+ void buildDialogueChoices();
+ void finishConversation();
+ byte speaker() const { return speaking() && _lineIndex < _lines.size() ? _lines[_lineIndex].speaker : 0; }
+
bool loadScene4030();
bool applyBackground4030();
void updateMaps4030();
@@ -181,12 +215,24 @@ private:
float actorHeight4060() const;
void setupDepth4060(RunawayActor::RenderParams ¶ms) const;
+ bool loadScene4070();
+ void start4070();
+ void drawScene4070(Graphics::ManagedSurface &viewport);
+ ActionResult execute4090(uint16 action);
+ bool applyBackground4090();
float actorHeight4090() const;
void setupDepth4090(RunawayActor::RenderParams ¶ms) const;
+ bool loadScene4100();
+ bool applyBackground4100();
+ void updateMaps4100();
+ ActionResult execute4100(uint16 action);
+ void drawScene4100(Graphics::ManagedSurface &viewport);
+ void closeMuseumChamber();
float actorHeight4100() const;
void setupDepth4100(RunawayActor::RenderParams ¶ms) const;
+ void start4140();
bool loadScene4140();
void clickScene4140(byte id);
void drawScene4140(Graphics::ManagedSurface &viewport);
@@ -203,8 +249,8 @@ private:
SceneTextStore _text;
RunawayActor _actor;
RunawayAnimation _ambient, _overlay, _safe;
- RunawayAnimation _actionAnimation;
- Common::Array<byte> _actionFrames;
+ RunawayAnimation _actionAnimation, _secondaryAnimation;
+ Common::Array<byte> _actionFrames, _secondaryFrames;
Graphics::ManagedSurface _background, _screen;
Common::Array<byte> _mask, _originalMaps, _maps;
Common::Array<Common::Rect> _foreground[5];
@@ -214,6 +260,7 @@ private:
Common::U32String text;
uint16 sample;
bool global;
+ byte speaker;
};
Common::Array<SpeechLine> _lines;
Common::U32String _subtitle, _caption;
@@ -228,16 +275,37 @@ private:
ObjectState _books = kUnexamined, _recorder = kUnexamined;
bool _moneyIdentified = false, _safeOpen = false;
bool _varnishTaken = false, _talcTaken = false, _coffeeTaken = false;
- byte _keyCount = 0, _pressedKey = 0;
+ byte _keyCount = 0, _pressedKey = 0, _keyResult = 0;
uint32 _keyUntil = 0;
uint32 _lastFootstep = 0;
RunawaySaveState::Hospital _hospital;
+ RunawaySaveState::Museum _museum;
+ RunawayAnimation _npc, _npcMouth, _machine;
+ RunawayAnimation _computer, _rejectionLight;
+ uint32 _nextLaser = 0;
+ byte _willyPose = 54, _computerFrame = 48;
+ bool _cliveVisible = false, _computerReject = false;
+ uint16 _machinePosition[2] = {0, 0};
+ MuseumFilm _museumFilm = kArrivalFilm;
+ SceneTextStore _filmText;
+ Common::Array<RunawaySequence::Command> _filmCommands;
+ struct DialogueChoice {
+ byte enabled, node, transition, player, response, disable, selectable;
+ };
+ DialogueChoice _dialogue[21][8] = {};
+ Common::Array<Common::U32String> _choices;
+ Common::Array<byte> _choiceIndices;
+ byte _conversation = 0, _dialogueDepth = 0, _dialogueNode = 0, _dialogueIntro = 0;
+ bool _dialogueEnding = false;
+ uint16 _afterConversation = 0;
Common::Array<byte> _monitorPatches[2];
byte _hospitalEntryStep = 0, _ambientFrame = 0, _musicCue = 11;
int _ambientDirection = 1;
uint32 _ambientTick = 0, _nextMusic = 0;
bool _entering = false;
uint16 _roomAction = 0;
+ bool _actionHidesActor = true;
+ bool _actionHoldSpeech = false;
byte _actionStage = 0;
uint _actionStep = 0;
uint32 _actionStarted = 0;
diff --git a/engines/hollywood/runaway/scene2010.cpp b/engines/hollywood/runaway/scene2010.cpp
index f1e96ccd659..f1c3b08c20f 100644
--- a/engines/hollywood/runaway/scene2010.cpp
+++ b/engines/hollywood/runaway/scene2010.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/file.h"
#include "common/textconsole.h"
#include "common/str-enc.h"
#include "common/util.h"
@@ -36,11 +37,13 @@ const Graphics::PixelFormat kPictureFormat(4, 8, 8, 8, 0, 16, 8, 0, 0);
} // End of anonymous namespace
-bool RunawayOpening::load() {
+bool RunawayOpening::load(byte chapter) {
+ _chapterOnly = chapter != 0;
+ _chapter = chapter ? chapter : 1;
ChunkArchive archive;
if (!archive.open(Common::Path("RESOURCE.A00")) ||
!loadRunawaySurface(archive, 6, 1024, 600, _narratorBackground) ||
- !archive.readVariableChunk(7, _chapterTitle) ||
+ !archive.readVariableChunk(6 + _chapter, _chapterTitle) ||
!_text.loadStage("RESOURCE.003", "Runaway narrator", 100))
return false;
const uint narratorFrames[] = {178, 35, 7, 35, 35, 35};
@@ -48,6 +51,8 @@ bool RunawayOpening::load() {
if (!_narrator[i].load(archive, i, narratorFrames[i]))
return false;
}
+ if (_chapterOnly)
+ return true;
if (!archive.open(Common::Path("RESOURCE.B01")) ||
!loadRunawaySurface(archive, 0, 1592, 600, _city) ||
@@ -78,20 +83,12 @@ bool RunawayOpening::load() {
if (!_credits[i].load(archive, i + 26, 12))
return false;
}
- if (!archive.open(Common::Path("DATAVB08.002")))
- return false;
- _portrait.create(512, 300, _city.format);
- for (uint i = 0; i < ARRAYSIZE(_heads); ++i) {
- if (!archive.readVariableChunk(i * 2, _portraits[i]) ||
- !_heads[i].load(archive, i * 2 + 1, 12))
- return false;
- }
- return true;
+ return _portraits.load('B', 8);
}
void RunawayOpening::start(uint32 now) {
- _audio.setChapter(1);
- enter(kSitDown, now);
+ _audio.setChapter(_chapter);
+ enter(_chapterOnly ? kChapter : kSitDown, now);
}
void RunawayOpening::enter(Step step, uint32 now) {
@@ -146,11 +143,19 @@ void RunawayOpening::enter(Step step, uint32 now) {
_themeStarted = true;
}
break;
- case kStayAway: speak(1, 2); break;
+ case kStayAway:
+ if (Common::File::exists("DATAVC00.000"))
+ _failed = !_video.seekToFrame(2566);
+ speak(1, 2);
+ break;
case kApproach: startMovie(nullptr, 2578, 2626); break;
case kUnconscious: speak(1, 3); break;
case kTurn: startMovie(nullptr, 2638, 2653); break;
- case kHospital: speak(1, 4); break;
+ case kHospital:
+ if (Common::File::exists("DATAVC00.000"))
+ _failed = !_video.seekToFrame(2655);
+ speak(1, 4);
+ break;
case kHitman: speak(1, 5); break;
case kReply: speak(1, 6); break;
case kFilmEnd:
@@ -163,9 +168,24 @@ void RunawayOpening::enter(Step step, uint32 now) {
_audio.stopEffect();
_narrating = true;
_failed = !_text.loadStage("RESOURCE.003", "Runaway narrator", 100);
- _bodyFrame = 20;
- _headBank = 1;
- speak(1, 0);
+ _bodyFrame = _chapter == 2 && _chapterVariation ? 160 : _chapter == 3 && !_chapterVariation ? 177 :
+ _chapter == 3 && _chapterVariation == 2 ? 50 : 20;
+ _headBank = _chapter == 2 && _chapterVariation ? 4 : _chapter == 3 && !_chapterVariation ? 5 :
+ _chapter == 3 && _chapterVariation == 2 ? 2 : 1;
+ speak(_chapter, _chapterVariation);
+ break;
+ case kChapterGesture:
+ _headBank = 0;
+ if (_chapter == 2) {
+ _firstFrame = 128;
+ _lastFrame = 160;
+ } else if (_chapterVariation == 1) {
+ _firstFrame = 177;
+ _lastFrame = 161;
+ } else {
+ _firstFrame = _chapterVariation == 2 ? 21 : 51;
+ _lastFrame = _chapterVariation == 2 ? 50 : 75;
+ }
break;
case kFinished:
_video.close();
@@ -181,7 +201,17 @@ void RunawayOpening::enter(Step step, uint32 now) {
}
void RunawayOpening::advance() {
- enter((Step)(_step + 1), _now);
+ if (_step == kChapter) {
+ const uint variations = _chapter == 2 ? 2 : _chapter == 3 ? 5 : 1;
+ if (++_chapterVariation < variations)
+ enter(_chapterVariation < 4 ? kChapterGesture : kChapter, _now);
+ else
+ enter(kFinished, _now);
+ } else if (_step == kChapterGesture) {
+ enter(kChapter, _now);
+ } else {
+ enter((Step)(_step + 1), _now);
+ }
}
void RunawayOpening::speak(uint16 cue, byte variation) {
@@ -260,6 +290,14 @@ void RunawayOpening::update(uint32 now) {
advance();
break;
}
+ case kChapterGesture: {
+ const uint distance = ABS((int)_lastFrame - (int)_firstFrame);
+ const uint offset = MIN(distance, elapsed / 80);
+ _bodyFrame = _lastFrame >= _firstFrame ? _firstFrame + offset : _firstFrame - offset;
+ if (elapsed >= (distance + 1) * 80)
+ advance();
+ break;
+ }
case kMontage: {
const bool ended = updateMovie();
const uint cues[] = {73, 215, 357, 499, 642};
@@ -387,7 +425,7 @@ void RunawayOpening::drawNarrator(Graphics::ManagedSurface &screen) {
_narrator[_headBank].draw(screen, _lipSync.frame(_now) % 6, 0, kRunawayViewportTop);
if (_step == kMontage)
_video.draw(screen, Common::Rect(256, 232, 656, 466));
- if (_step == kChapter)
+ if (_step == kChapter || _step == kChapterGesture)
applyRunawayPatch(_chapterTitle, screen, kRunawayViewportTop);
}
@@ -450,17 +488,16 @@ void RunawayOpening::drawFilm(Graphics::ManagedSurface &screen) {
}
if (_step == kStayAway || _step == kUnconscious || (_step >= kHospital && _step <= kReply)) {
const uint portrait = _step == kStayAway ? 0 : _step == kUnconscious ? 1 : 2;
- applyRunawayPatch(_portraits[portrait], _portrait);
// The other hitman speaks off screen; the visible man only blinks.
const uint mouth = _step == kHitman ? ((_now - _started) % 2400 < 160 ? 6 : 0) : _lipSync.frame(_now);
- _heads[portrait].draw(_portrait, mouth, 0, 0);
- screen.blitFrom(_portrait, Common::Rect(512, 300), viewport);
+ if (!_portraits.draw(screen, viewport, portrait, mouth))
+ _failed = true;
}
}
void RunawayOpening::draw(Graphics::ManagedSurface &screen) {
screen.clear();
- if (_step <= kLastNarration || _step == kChapter)
+ if (_step <= kLastNarration || _step == kChapter || _step == kChapterGesture)
drawNarrator(screen);
else if (_step == kCity || _step == kCityExit)
drawCity(screen);
@@ -469,9 +506,9 @@ void RunawayOpening::draw(Graphics::ManagedSurface &screen) {
else if (_step < kFinished)
drawFilm(screen);
const uint elapsed = _now - _started;
- if ((_step == kSitDown || _step == kCity || _step == kChapter) && elapsed < 500)
+ if ((_step == kSitDown || _step == kCity || (_step == kChapter && !_chapterVariation)) && elapsed < 500)
dimRunawayViewport(screen, elapsed * 2);
- else if ((_step == kLastNarration || _step == kChapter) && _events)
+ else if ((_step == kLastNarration || (_step == kChapter && _chapterVariation + 1 == (_chapter == 2 ? 2 : _chapter == 3 ? 5 : 1))) && _events)
dimRunawayViewport(screen, MIN<uint>(500, _deadline - _now) * 2);
else if (_step == kCityExit && elapsed > 3280)
dimRunawayViewport(screen, (3780 - MIN<uint>(3780, elapsed)) * 2);
diff --git a/engines/hollywood/runaway/scene2010.h b/engines/hollywood/runaway/scene2010.h
index 0569528e3a6..d230064588b 100644
--- a/engines/hollywood/runaway/scene2010.h
+++ b/engines/hollywood/runaway/scene2010.h
@@ -31,12 +31,12 @@
namespace Hollywood {
-// The retail opening (2010), followed by chapter one's narration (2000).
+// The retail opening (2010) and the interchapter narration.
// All timing comes from the engine's pause-aware clock.
class RunawayOpening {
public:
explicit RunawayOpening(RunawayAudio &audio) : _audio(audio), _random("runawayOpening") {}
- bool load();
+ bool load(byte chapter = 0);
void start(uint32 now);
void update(uint32 now);
void skip(uint32 now);
@@ -51,7 +51,7 @@ private:
kTurnToScreen, kJourney, kMontage, kTurnBack, kLastNarration,
kCity, kTitle, kAccident, kAccidentTitle, kAccidentEnd, kCityExit,
kFilm, kStayAway, kApproach, kUnconscious, kTurn, kHospital,
- kHitman, kReply, kFilmEnd, kChapter, kFinished
+ kHitman, kReply, kFilmEnd, kChapter, kChapterGesture, kFinished
};
void enter(Step step, uint32 now);
void advance();
@@ -72,14 +72,16 @@ private:
RunawayLipSync _lipSync;
RunawayVideo _video;
Graphics::ManagedSurface _narratorBackground, _city, _cityTitle;
- Graphics::ManagedSurface _portrait;
+ RunawayFilmPortrait _portraits;
Graphics::ManagedSurface _pictures[17]; // Sixteen pictures, then a dissolve to black.
- RunawayAnimation _narrator[6], _cityActor, _titles[4], _credits[12], _heads[3];
- Common::Array<byte> _parallax[3], _chapterTitle, _portraits[3];
+ RunawayAnimation _narrator[6], _cityActor, _titles[4], _credits[12];
+ Common::Array<byte> _parallax[3], _chapterTitle;
Step _step = kFinished;
uint32 _now = 0, _started = 0, _deadline = 0;
uint _frame = 0, _firstFrame = 0, _lastFrame = 0, _events = 0;
uint _bodyFrame = 20, _headBank = 1;
+ byte _chapter = 1, _chapterVariation = 0;
+ bool _chapterOnly = false;
uint16 _row = 0, _lastRow = 0, _sample = 0;
bool _narrating = true, _themeStarted = false, _failed = false;
Common::U32String _subtitle;
diff --git a/engines/hollywood/runaway/scene2020.cpp b/engines/hollywood/runaway/scene2020.cpp
index 780f49ae905..f271607fcfb 100644
--- a/engines/hollywood/runaway/scene2020.cpp
+++ b/engines/hollywood/runaway/scene2020.cpp
@@ -20,6 +20,7 @@
*/
#include "common/textconsole.h"
+#include "common/file.h"
#include "common/util.h"
#include "hollywood/runaway/scene.h"
#include "hollywood/runaway/scene_data.h"
@@ -428,7 +429,7 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
if (!_hospital.window)
say(28, 1);
_hospital.window = MIN<int>(2, _hospital.window + 1);
- beginHospitalAnimation(action, 4, 42);
+ beginRoomAnimation(action, 4, 42);
return kHandled;
case 314:
say(10, _hospital.window >= 2);
@@ -455,7 +456,7 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
say(31);
return kHandled;
}
- beginHospitalAnimation(action, 16, 29);
+ beginRoomAnimation(action, 16, 29);
return kHandled;
case 336:
say(32);
@@ -477,7 +478,7 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2020(uint16 action) {
say(34);
return kHandled;
}
- beginHospitalAnimation(action, 19, 35);
+ beginRoomAnimation(action, 19, 35);
_actionFrames.push_back(33);
for (int frame = 32; frame >= 0; --frame)
_actionFrames.push_back(frame);
@@ -591,6 +592,74 @@ void RunawayRoomScene::update2020() {
applyRunawayPatch(_monitorPatches[(_now / 80) % 26 >= 17], _background);
}
+void RunawayRoomScene::adaptGogFilm(const RunawaySequence::Command *commands) {
+ typedef RunawaySequence S;
+ _filmCommands.clear();
+ uint movie = 0, part = 1;
+ for (uint i = 0; commands[i].operation != S::kEnd; ++i) {
+ S::Command command = commands[i];
+ if (command.operation == S::kOpen) {
+ movie = command.a;
+ part = 1;
+ }
+ if (movie == 2 && command.operation == S::kPlay) {
+ if (command.a >= 820)
+ continue; // These CD shots are separate stills in the GOG edition.
+ uint targetPart = command.a >= 720 ? 4 : command.a >= 200 ? 3 : 1;
+ if (command.a == 101) {
+ _filmCommands.push_back(S::Command(S::kPlay, 101, 199));
+ targetPart = 3;
+ command.a = 200;
+ }
+ if (part != targetPart) {
+ _filmCommands.push_back(S::Command(S::kOpen, movie, targetPart));
+ part = targetPart;
+ }
+ const uint offset = part == 4 ? 720 : part == 3 ? 200 : 0;
+ command.a -= offset;
+ command.b -= offset;
+ } else if (movie == 2 && command.operation == S::kTalk && command.c) {
+ _filmCommands.push_back(S::Command(S::kStill, command.c == 1 ? 0 : 1, 1));
+ command.c = command.c == 1 ? 3 : 1;
+ } else if (movie == 7 && command.operation == S::kTalk && command.b >= 9) {
+ static const uint16 stills[] = {236, 237, 238, 239, 240, 241, 241, 242};
+ _filmCommands.push_back(S::Command(S::kStill, stills[command.b - 9]));
+ } else if (movie == 9 && command.operation == S::kPlay) {
+ uint targetPart = 1;
+ if (command.a == 1608) {
+ targetPart = 2; command.a = 0; command.b = 23;
+ } else if (command.a == 1632 || command.a == 1633) {
+ targetPart = 3; command.a = 0; command.b = 54;
+ } else if (command.a == 1688) {
+ targetPart = 4; command.a = 0; command.b = 24;
+ } else if (command.a == 65) {
+ command.a = 66;
+ } else if (command.a == 106) {
+ command.b = 215;
+ } else if (command.a >= 222 && command.a <= 1147) {
+ ++command.a;
+ ++command.b;
+ }
+ if (part != targetPart) {
+ _filmCommands.push_back(S::Command(S::kOpen, movie, targetPart));
+ part = targetPart;
+ }
+ } else if (movie == 9 && command.operation == S::kTalk) {
+ static const uint16 stills[] = {
+ 29, 42, 43, 44, 45, 53, 0, 216, 255, 257, 258, 259, 0, 260, 260, 260,
+ 0, 302, 325, 0, 0, 0, 0, 991, 1026, 1118, 0, 1209, 1222, 0, 0, 0, 0, 1591, 1598
+ };
+ if (part != 1) {
+ _filmCommands.push_back(S::Command(S::kOpen, movie));
+ part = 1;
+ }
+ _filmCommands.push_back(S::Command(S::kStill, stills[command.b]));
+ }
+ _filmCommands.push_back(command);
+ }
+ _filmCommands.push_back(S::Command(S::kEnd));
+}
+
void RunawayRoomScene::startHospitalFilm(HospitalFilm film) {
const RunawaySequence::Command *commands = nullptr;
switch (film) {
@@ -604,6 +673,10 @@ void RunawayRoomScene::startHospitalFilm(HospitalFilm film) {
_roomAction = 0;
_actionFrames.clear();
_caption.clear();
+ if (Common::File::exists("DATAVC00.000")) {
+ adaptGogFilm(commands);
+ commands = _filmCommands.data();
+ }
_sequence.start(commands, _text, _now);
}
@@ -643,46 +716,6 @@ void RunawayRoomScene::finishHospitalFilm() {
_audio.playEffect(30, 3, 1, true);
}
-void RunawayRoomScene::beginHospitalAnimation(uint16 action, uint chunk, uint frames, const byte *order, uint count) {
- if (!_actionAnimation.load(_archive, chunk, frames))
- error("Cannot load Runaway room %u animation %u", _room, chunk);
- _actionFrames.clear();
- for (uint i = 0; i < (order ? count : frames); ++i)
- _actionFrames.push_back(order ? order[i] : i);
- _roomAction = action;
- _actionStage = 0;
- _actionStep = 0;
- _actionStarted = _now;
-}
-
-void RunawayRoomScene::updateHospitalAnimation() {
- if (!_roomAction || _actionFrames.empty())
- return;
- if (speaking() || _pathIndex < _path.size()) {
- _actionStarted = _now;
- return;
- }
- while (_now - _actionStarted >= 80) {
- _actionStarted += 80;
- if (++_actionStep == _actionFrames.size()) {
- const uint16 action = _roomAction;
- _roomAction = 0;
- _actionFrames.clear();
- finishHospitalAnimation(action);
- return;
- }
- if ((_roomAction == 335 && _actionStep == 15) || (_roomAction == 339 && _actionStep == 47))
- _audio.playEffect(46);
- if (_roomAction == 339 && _actionStep == 16)
- _audio.playEffect(45);
- if (_roomAction == 339 && _actionStep == 1 && !applyPatch(18))
- error("Cannot clear Runaway hospital chart");
- if ((_roomAction == 332 && (_actionStep == 21 || _actionStep == 35 || _actionStep == 41)) ||
- (_room == kHospitalStoreroom && _roomAction == 302 && (_actionStep == 23 || _actionStep == 36)))
- _audio.playFootstep(1, _random.getRandomBit());
- }
-}
-
void RunawayRoomScene::finishHospitalAnimation(uint16 action) {
switch (action) {
case 332:
diff --git a/engines/hollywood/runaway/scene2060.cpp b/engines/hollywood/runaway/scene2060.cpp
index 4e3d34d79d9..1168dc0ced1 100644
--- a/engines/hollywood/runaway/scene2060.cpp
+++ b/engines/hollywood/runaway/scene2060.cpp
@@ -97,7 +97,7 @@ void RunawayRoomScene::updateMaps2060() {
RunawayRoomScene::ActionResult RunawayRoomScene::execute2060(uint16 action) {
switch (action) {
case 302:
- beginHospitalAnimation(action, 4, 44);
+ beginRoomAnimation(action, 4, 44);
return kHandled;
case 303:
_transition.scene = 2022;
diff --git a/engines/hollywood/runaway/scene4010.cpp b/engines/hollywood/runaway/scene4010.cpp
new file mode 100644
index 00000000000..19d84990e2a
--- /dev/null
+++ b/engines/hollywood/runaway/scene4010.cpp
@@ -0,0 +1,373 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+#include "common/textconsole.h"
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+
+void RunawayRoomScene::startMuseum() {
+ _inventory.startChapter(2);
+ _entering = true;
+ resumeMuseum();
+}
+
+void RunawayRoomScene::resumeMuseum() {
+ if (_sequence.active())
+ return;
+ if (_entering || !_audio.musicPlaying())
+ _audio.playMusic(_room == kMuseumSecurity ? 11 : _room == kMuseumLaboratory ? 13 : 12, false);
+ _nextLaser = _now + 25000 + _random.getRandomNumber(5000);
+ if (!_entering)
+ return;
+ _entering = false;
+ if (_entryScene == 4010) {
+ startMuseumFilm(kArrivalFilm);
+ } else if (_room == kMuseumWilly) {
+ start4070();
+ } else if (_room == kMuseumKeypad) {
+ start4140();
+ } else if (_room == kMuseumLaboratory) {
+ if (_museum.susan == 2) {
+ _museum.susan = 3;
+ _inventory.museum().restoredCrucifix = 1;
+ say(32);
+ say(32, 1);
+ deferMuseumAction(405);
+ refreshMuseum();
+ } else if (!_museum.susanMet) {
+ _museum.susanMet = 1;
+ for (uint i = 0; i < 3; ++i) {
+ say(80, i);
+ say(90, i, false, 1);
+ }
+ }
+ } else if (_room == kMuseumSecurity) {
+ if (_inventory.museum().restoredCrucifix) {
+ walkTo(Common::Point(906, 470), 0, true);
+ deferMuseumAction(409);
+ } else {
+ beginRoomAnimationRange(412, 21, 13, 12, 0, false);
+ _audio.playEffect(32);
+ }
+ } else if (_room == kMuseumHall) {
+ if (_entryScene != 4063 && _entryScene != 4064) {
+ _museum.willyInLab = 0;
+ updateMaps();
+ } else if (_entryScene == 4064 && _museum.willyInLab) {
+ changeFloor(false, Common::Point(921, 813));
+ if (_museum.willyInLab == 1) {
+ walkTo(Common::Point(1029, 842), 7, true);
+ say(38, 1);
+ deferMuseumAction(460);
+ } else {
+ say(36, 3);
+ deferMuseumAction(462);
+ }
+ }
+ if (_entryScene == 4063) {
+ if (_museum.keypad == 1)
+ say(26, 2);
+ else if (_museum.keypad == 4)
+ leaveMuseumRoom(4100, Common::Point(141, 468), 3);
+ }
+ }
+}
+
+void RunawayRoomScene::deferMuseumAction(uint16 action) {
+ _roomAction = action;
+ _actionFrames.clear();
+ _actionStage = 0;
+}
+
+void RunawayRoomScene::refreshMuseum() {
+ if (!rebuildBackground())
+ error("Cannot update Runaway museum room %u", _room);
+ updateMaps();
+}
+
+void RunawayRoomScene::leaveMuseumRoom(uint16 scene, Common::Point position, byte facing, bool door) {
+ if (_room == kMuseumSecurity) {
+ _museum.chamberOpen = 0;
+ _museum.chamberTime = 0;
+ }
+ _transition.scene = scene;
+ _transition.position = position;
+ _transition.facing = facing;
+ _transition.door = door;
+}
+
+void RunawayRoomScene::updateMuseum(uint elapsed, bool inventoryOpen) {
+ if (_room == kMuseumSecurity && _now - _ambientTick >= 80) {
+ _ambientTick = _now;
+ _computerFrame = speaker() && !_cliveVisible ? _random.getRandomNumber(48) : 48;
+ for (uint i = 0; i < 2; ++i) {
+ if (_museum.chamberOpen)
+ _machinePosition[i] = MIN<uint>(i ? 405 : 512, _machinePosition[i] + 1);
+ else if (_machinePosition[i] > 5)
+ --_machinePosition[i];
+ else if (!_random.getRandomNumber(_machinePosition[i] ? 9 : 49))
+ _machinePosition[i] = _machinePosition[i] ? 0 : i ? 5 : 4;
+ }
+ }
+ if (_room == kMuseumLaboratory) {
+ if (speaker())
+ _ambientFrame = (_museum.susan == 1 ? 52 : 45) + speechFrame();
+ else if (_museum.susan == 3)
+ _ambientFrame = 1;
+ else if (_museum.susan == 1)
+ _ambientFrame = 79;
+ else
+ _ambientFrame = (_now / 80) % 26;
+ if (!_museum.susan && !busy() && !inventoryOpen && _position.x < 530 && (int32)(_now - _nextLaser) >= 0) {
+ beginRoomAnimation(450, 23, 95, nullptr, 0, false);
+ _nextLaser = _now + 25000 + _random.getRandomNumber(5000);
+ }
+ } else if (_room == kMuseumHall) {
+ _ambientFrame = (_now / 80) % 22;
+ } else if (_room == kMuseumSecurity && _museum.chamberTime) {
+ _museum.chamberTime -= MIN<uint>(elapsed, _museum.chamberTime);
+ if (!_museum.chamberTime && !_roomAction)
+ closeMuseumChamber();
+ }
+ if (_room == kMuseumSecurity && _museum.chamberOpen && !_museum.chamberTime && !_roomAction)
+ closeMuseumChamber();
+ updateRoomAnimation();
+ if (_sequence.active() || _transition.scene)
+ return;
+ updateConversation();
+ if (_roomAction && _actionFrames.empty() && !speaking() && !_conversation && _pathIndex == _path.size()) {
+ const uint16 action = _roomAction;
+ _roomAction = 0;
+ finishMuseumAnimation(action);
+ }
+}
+
+void RunawayRoomScene::museumAnimationFrame() {
+ if (_room == kMuseumOffice && _roomAction == 321) {
+ if (_actionStep == 21)
+ _audio.playEffect(36);
+ if (_actionStep == 27)
+ _audio.playEffect(_safeOpen ? 39 : 38, 77);
+ } else if (_room == kMuseumLaboratory) {
+ if ((_roomAction == 328 || _roomAction == 428) && (_actionStep == 4 || _actionStep == 2))
+ _audio.playEffect(37, 204);
+ } else if (_room == kMuseumHall && _roomAction == 461) {
+ if (_actionStep == 156)
+ _audio.playEffect(29);
+ } else if (_room == kMuseumSecurity) {
+ if ((_roomAction == 308 || _roomAction == 340) && _actionStep == 12)
+ _audio.playEffect(34, 230);
+ if ((_roomAction == 342 && _actionStep == 15) || (_roomAction == 344 && _actionStep == 4))
+ _audio.playEffect(37, 204);
+ if (_roomAction == 325) {
+ if (_actionStep == 12)
+ _audio.playEffect(42);
+ else if (_actionStep == 20)
+ _audio.playEffect(41, 255, 1);
+ else if (_actionStep == 105)
+ _audio.playEffect(43);
+ }
+ if (_roomAction == 410 && _actionStep == 35)
+ _audio.playEffect(55);
+ }
+}
+
+bool RunawayRoomScene::sayMuseumInventory(const RunawayInventory::Reply &reply) {
+ if (reply.cue == 108)
+ _inventory.museum().businessCardExamined = 1;
+ say(reply.cue, reply.cue == 112 ? _museum.safeUsed : reply.variation, true);
+ if ((reply.cue == 116 && !reply.variation) || (reply.cue == 117 && !reply.variation))
+ say(reply.cue, 1, true);
+ if (reply.cue == 121 && reply.variation == 1)
+ say(121, 2, true);
+ return true;
+}
+
+void RunawayRoomScene::finishMuseumAnimation(uint16 action) {
+ switch (_room) {
+ case kMuseumOffice:
+ if (action == 321) {
+ _safeOpen = !_safeOpen;
+ if (_safeOpen && !_museum.safeUsed) {
+ _museum.safeUsed = 1;
+ say(20, 1);
+ }
+ refreshMuseum();
+ }
+ break;
+ case kMuseumLaboratory: finish4050(action); break;
+ case kMuseumHall: finish4060(action); break;
+ case kMuseumWilly: finish4070(action); break;
+ case kMuseumSecurity: finish4100(action); break;
+ case kMuseumKeypad:
+ if (action == 414)
+ leaveMuseumRoom(4063, Common::Point(1153, 297), 7);
+ break;
+ default: break;
+ }
+}
+
+void RunawayRoomScene::startMuseumFilm(MuseumFilm film) {
+ typedef RunawaySequence S;
+ const bool gog = Common::File::exists("DATAVC00.000");
+ _museumFilm = film;
+ _filmCommands.clear();
+ const uint stage = film == kArrivalFilm || film == kCliveFilm ? 401 : _room == kMuseumWilly ? 406 : _room / 10;
+ if (!_filmText.load("RESOURCE.003", "Runaway museum film", stage, 0, 0x1135))
+ error("Cannot load Runaway museum film text");
+ switch (film) {
+ case kArrivalFilm:
+ _filmCommands = {{S::kMusic, 17, 255}, {S::kOpen, 5}, {S::kEffect, 52, 255},
+ {S::kPlay, 0, 889}, {S::kStill, (uint16)(gog ? 900 : 889)}, {S::kTalk, 30, 0, 1}, {S::kDelay, 1000},
+ {S::kTalk, 30, 1, 1}, {S::kPlay, (uint16)(gog ? 912 : 919), (uint16)(gog ? 919 : 930)},
+ {S::kTalk, 30, 2, 3}, {S::kDelay, 2000}, {S::kTalk, 30, 3, 3}, {S::kDelay, 3000}, {S::kTalk, 30, 4, 3}};
+ break;
+ case kCliveFilm:
+ _filmCommands = {{S::kOpen, 1}, {S::kPlay, 57, 107}, {S::kTalk, 1, 0, (byte)(gog ? 5 : 1)},
+ {S::kPlay, 0, 25}, {S::kTalk, 3, 0, (byte)(gog ? 1 : 5)}, {S::kPlay, 37, 44}, {S::kTalk, 2, 0, (byte)(gog ? 3 : 9)}};
+ {
+ static const byte cues[] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 17};
+ static const byte cdPortraits[] = {3, 7, 1, 9, 3, 5, 3, 5, 9, 7, 1, 5, 1, 11, 5, 9};
+ static const byte gogPortraits[] = {9, 7, 5, 3, 9, 1, 9, 1, 3, 7, 5, 1, 5, 11, 1, 3};
+ static const byte stills[] = {5, 3, 159, 1, 5, 0, 5, 0, 44, 3, 2, 0, 2, 4, 0, 44};
+ for (uint i = 0; i < ARRAYSIZE(cues); ++i) {
+ if (i == 2)
+ _filmCommands.push_back(S::Command(S::kPlay, 119, 159));
+ else if (i == 8 || i == 15)
+ _filmCommands.push_back(S::Command(S::kPlay, 37, 44));
+ else if (gog)
+ _filmCommands.push_back(S::Command(S::kStill, stills[i], 1));
+ _filmCommands.push_back(S::Command(S::kTalk, cues[i], i == 15 ? 1 : 0, gog ? gogPortraits[i] : cdPortraits[i]));
+ }
+ }
+ break;
+ case kDrillingFilm:
+ _filmCommands = {{S::kOpen, 2}, {S::kEffect, 49, 204}, {S::kPlay, 0, 135}};
+ break;
+ case kLaserFilm:
+ _filmCommands = {{S::kOpen, 3}, {S::kMusic, 22, 255}, {S::kEffect, 50, 204}, {S::kPlay, 0, 175}, {S::kMusic, 13, 255}};
+ break;
+ case kRubyFilm:
+ _filmCommands = {{S::kOpen, 4}, {S::kEffect, 51, 230}, {S::kPlay, 0, 75}};
+ break;
+ case kMobstersFilm:
+ _filmCommands = {{S::kOpen, 7}, {S::kMusic, 21, 255, 1}, {S::kEffect, 13, 255}, {S::kPlay, 0, 213},
+ {S::kTalk, 93, 0, 1}, {S::kTalk, 94, 0, 1, 1}, {S::kTalk, 93, 1, 1},
+ {S::kPlay, (uint16)(gog ? 214 : 225), (uint16)(gog ? 226 : 237)}, {S::kTalk, 94, 1, 3}};
+ if (gog)
+ _filmCommands.push_back(S::Command(S::kStill, 227));
+ _filmCommands.push_back(S::Command(S::kTalk, 93, 2, (uint16)(gog ? 1 : 5)));
+ if (gog)
+ _filmCommands.push_back(S::Command(S::kStill, 228));
+ _filmCommands.push_back(S::Command(S::kTalk, 94, 2, 3));
+ _filmCommands.push_back(S::Command(S::kMusic, 13, 255));
+ break;
+ case kPhoneFilm:
+ _filmCommands = {{S::kOpen, 8}, {S::kEffect, 57, 153, 1, 1}, {S::kPlay, 0, 31}, {S::kTalk, 91, 0, 1}};
+ for (uint i = _museum.phoneUsed ? 7 : 0; i < (_museum.phoneUsed ? 9U : 6U); ++i) {
+ _filmCommands.push_back(S::Command(S::kTalk, 82, i, 1, 1));
+ _filmCommands.push_back(S::Command(S::kTalk, 92, i, 1));
+ }
+ _filmCommands.push_back(S::Command(S::kTalk, 82, 6, 1, 1));
+ _filmCommands.push_back(S::Command(S::kTalk, 92, 6, 1));
+ _filmCommands.push_back(S::Command(S::kPlay, (uint16)(gog ? 32 : 43), (uint16)(gog ? 62 : 72)));
+ break;
+ case kScannerFilm:
+ _filmCommands = {{S::kOpen, 6}, {S::kMusic, 19, 255}, {S::kEffect, 53, 255}, {S::kPlay, 0, 386}, {S::kMusic, 11, 255}};
+ break;
+ case kBetrayalFilm:
+ _filmCommands = {{S::kOpen, 9}, {S::kMusic, 20, 255}, {S::kPlay, 0, 9}, {S::kEffect, 11, 255},
+ {S::kSpeech, 92, 4, 4}, {S::kPlay, 10, 78}, {S::kWaitSpeech}, {S::kTalk, 92, 2, 1},
+ {S::kPlay, (uint16)(gog ? 79 : 90), (uint16)(gog ? 86 : 90)}, {S::kSpeech, 92, 3, 3},
+ {S::kPlay, (uint16)(gog ? 87 : 91), (uint16)(gog ? 121 : 134)}, {S::kEffect, 12, 255},
+ {S::kPlay, (uint16)(gog ? 122 : 135), (uint16)(gog ? 124 : 135)}, {S::kWaitSpeech}, {S::kWaitEffect, 5000}};
+ break;
+ case kMuseumExitFilm:
+ _filmCommands = {{S::kOpen, 10}, {S::kEffect, 57, 153, 1, 1}, {S::kPlay, 0, 12},
+ {S::kTalk, 60, 0, 1}, {S::kMusic, 18, 255}, {S::kEffect, 54, 255},
+ {S::kSpeech, 60, 1, 1}, {S::kPlay, (uint16)(gog ? 13 : 24), (uint16)(gog ? 130 : 141)}, {S::kWaitSpeech}};
+ break;
+ }
+ _filmCommands.push_back(S::Command(S::kEnd));
+ if (film == kPhoneFilm)
+ draw();
+ _sequence.start(_filmCommands.data(), _filmText, _now, 'D');
+ if (film == kPhoneFilm)
+ _sequence.setBackground(_screen, Common::Rect(116, kRunawayViewportTop + 320, 396, kRunawayViewportTop + 600));
+}
+
+void RunawayRoomScene::finishMuseumFilm() {
+ switch (_museumFilm) {
+ case kArrivalFilm:
+ startMuseumFilm(kCliveFilm);
+ return;
+ case kCliveFilm:
+ _entryScene = 4060;
+ changeFloor(true, Common::Point(607, 323));
+ _audio.playMusic(12, false);
+ break;
+ case kDrillingFilm:
+ _museum.laserSeen = 1;
+ beginRoomAnimation(451, 24, 101, nullptr, 0, false);
+ break;
+ case kRubyFilm:
+ beginRoomAnimationRange(456, 19, 13, 4, 0);
+ break;
+ case kLaserFilm:
+ _museum.susan = 1;
+ _museum.laserUpgraded = 1;
+ say(30, 2);
+ say(33, 1, false, 1);
+ refreshMuseum();
+ break;
+ case kMobstersFilm:
+ _museum.susan = 2;
+ _museum.restoration = 2;
+ leaveMuseumRoom(4061, Common::Point(873, 311), 3, true);
+ break;
+ case kPhoneFilm:
+ _museum.phoneUsed = 1;
+ _museum.willyInLab = 1;
+ _museum.sawCode = 2;
+ if (_museum.keypad == 1)
+ _museum.keypad = 2;
+ beginRoomAnimationRange(460, 13, 27, 26, 0);
+ break;
+ case kScannerFilm:
+ if (!applyPatch(28))
+ error("Cannot update Runaway scanner");
+ walkTo(Common::Point(915, 547), 4, true);
+ deferMuseumAction(413);
+ break;
+ case kBetrayalFilm:
+ _chapterComplete = true;
+ break;
+ case kMuseumExitFilm:
+ leaveMuseumRoom(4100, Common::Point(141, 468));
+ break;
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4030.cpp b/engines/hollywood/runaway/scene4030.cpp
index 555fb5a460c..fd186eeffe0 100644
--- a/engines/hollywood/runaway/scene4030.cpp
+++ b/engines/hollywood/runaway/scene4030.cpp
@@ -120,7 +120,7 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute4030(uint16 action) {
say(2, 2);
return kBackgroundChanged;
case 304:
- say(3, _safeOpen);
+ say(3, museumChapter() ? _museum.safeUsed : _safeOpen);
return kHandled;
case 308:
say(7, _moneyIdentified);
@@ -136,7 +136,25 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute4030(uint16 action) {
say(10);
say(10, 1);
return kBackgroundChanged;
+ case 311:
+ say(11, _museum.shelfBooksSeen);
+ _museum.shelfBooksSeen = 1;
+ return kHandled;
case 321: // Toggle the safe with the strange key.
+ if (museumChapter()) {
+ byte brian[52], safe[52];
+ for (uint i = 0; i < ARRAYSIZE(brian); ++i) {
+ brian[i] = i <= 26 ? (i ? i - 1 : 0) : 51 - i;
+ const uint frame = MIN<uint>(12, i > 27 ? i - 27 : 0);
+ safe[i] = _safeOpen ? 12 - frame : frame;
+ }
+ if (!_safeOpen && !_museum.safeUsed)
+ say(20);
+ beginRoomAnimation(321, 16, 26, brian, ARRAYSIZE(brian));
+ setRoomAnimationOverlay(_recorder == kTaken ? 15 : 14, 13, safe, ARRAYSIZE(safe));
+ _inventory.select(0);
+ return kHandled;
+ }
_safeOpen = !_safeOpen;
_inventory.select(0);
if (_safeOpen) {
diff --git a/engines/hollywood/runaway/scene4050.cpp b/engines/hollywood/runaway/scene4050.cpp
index 64daef3144f..ce006be4474 100644
--- a/engines/hollywood/runaway/scene4050.cpp
+++ b/engines/hollywood/runaway/scene4050.cpp
@@ -26,6 +26,24 @@
namespace Hollywood {
namespace {
+const byte kRecordSusan[] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25, 26,
+ 27, 28, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,
+ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
+};
+
+const byte kGrindCoffee[] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 26, 27, 28, 29, 30, 31, 32, 33, 34, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 26, 27, 28, 29, 30, 31, 32, 33, 34, 26, 27, 28, 29, 30, 31, 32, 33,
+ 34, 26, 27, 28, 29, 30, 31, 32, 33, 34, 26, 27, 28, 29, 30, 31, 32, 33, 34, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 26, 27, 28, 29, 30, 31, 32, 33, 34, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13,
+ 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
+};
+
const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Door", 227, 503, 7, {301, 339}, {0, 1}},
@@ -102,18 +120,144 @@ const RunawayRoom kRunawayScene4050 = {
void RunawayRoomScene::updateMaps4050() {
for (uint i = 0; i < 256; ++i) {
byte &id = _maps[256 + i];
- if (id == 4 || id == 15 || id == 19 || (_talcTaken && id == 14))
+ if (_talcTaken && id == 14)
id = 0;
- else if (id == 16)
- id = 13;
- else if (id == 17)
- id = 10;
- else if (id == 18)
- id = 3;
+ if (museumChapter() && _museum.susan == 1) {
+ if (id == 15 || id == 16 || id == 17)
+ id = 3;
+ else if (id == 3 || id == 18 || id == 19)
+ id = 0;
+ } else {
+ if (id == 15 || (id == 4 && (!museumChapter() || !_museum.susan)) || (id == 19 && (!museumChapter() || !_museum.susan)))
+ id = 0;
+ else if (id == 16)
+ id = 13;
+ else if (id == 17)
+ id = 10;
+ else if (id == 18 || id == 19)
+ id = 3;
+ else if (id == 3 && museumChapter() && _museum.susan >= 2)
+ id = 0;
+ }
}
}
RunawayRoomScene::ActionResult RunawayRoomScene::execute4050(uint16 action) {
+ if (museumChapter()) {
+ switch (action) {
+ case 302:
+ say(2, !_museum.restoration ? 0 : _museum.restoration == 2 ? 3 : _museum.susan ? 2 : 1);
+ _museum.shelvesSeen = 1;
+ return kHandled;
+ case 303:
+ say(3, _museum.restoration == 1);
+ return kHandled;
+ case 304:
+ say(4, _museum.susan == 3 ? 2 : _museum.susan == 1 ? 1 : _museum.restoration && _museum.leftLabOnce ? 3 : 0);
+ return kHandled;
+ case 305:
+ if (_museum.susan == 3)
+ say(5);
+ else if (_museum.susan == 1) {
+ say(5, 1 + _random.getRandomNumber(3));
+ say(5, 5 + _random.getRandomNumber(2), false, 1);
+ } else {
+ startConversation(1);
+ }
+ return kHandled;
+ case 312:
+ say(19, 1, true);
+ return kHandled;
+ case 313:
+ say(4, 0, true);
+ return kHandled;
+ case 315:
+ say(7, 0, true);
+ return kHandled;
+ case 317: case 335:
+ say(14, _random.getRandomNumber(2), true);
+ return kHandled;
+ case 318:
+ say(14, _museum.laserUpgraded ? 2 : _museum.laserSeen ? 1 : 0);
+ return kHandled;
+ case 322:
+ say(18, _museum.varnishSeen);
+ _museum.varnishSeen = 1;
+ return kHandled;
+ case 326:
+ if (_inventory.museum().restoredCrucifix) {
+ say(22, 2);
+ } else {
+ if (!_museum.shelvesSeen)
+ say(2);
+ say(22);
+ beginRoomAnimation(326, 17, 43);
+ }
+ return kHandled;
+ case 327:
+ say(_museum.susan == 3 ? 5 : _inventory.museum().restoredCrucifix ? 22 : 23,
+ _inventory.museum().restoredCrucifix ? 2 : 0);
+ return kHandled;
+ case 328:
+ if (!_museum.voiceLockSeen)
+ say(1, 0, true);
+ else if (_museum.susan == 3)
+ say(5);
+ else if (_inventory.contains(6) || _inventory.museum().batteryInLadle)
+ say(24, 3);
+ else if (_inventory.museum().voiceRecorded)
+ say(24, 2);
+ else {
+ beginRoomAnimation(328, 21, 56, kRecordSusan, 27);
+ }
+ return kHandled;
+ case 329: case 330:
+ say(_museum.susan == 3 ? 5 : 25);
+ return kHandled;
+ case 331:
+ if (_museum.susan != 1)
+ say(1, 0, true);
+ else {
+ say(26);
+ byte brian[25], susan[25];
+ for (uint i = 0; i < ARRAYSIZE(brian); ++i) {
+ brian[i] = i ? i - 1 : 0;
+ susan[i] = i < 11 ? 102 + (i ? i - 1 : 0) : i < 20 ? 112 : 93 + i;
+ }
+ beginRoomAnimation(331, 20, 24, brian, ARRAYSIZE(brian));
+ setRoomAnimationOverlay(15, 170, susan, ARRAYSIZE(susan));
+ }
+ return kHandled;
+ case 333:
+ if (_inventory.museum().coffee == 2)
+ say(1, 2, true);
+ else if (_inventory.museum().coffee || !_museum.needsGroundCoffee)
+ say(1, 0, true);
+ else {
+ say(28);
+ beginRoomAnimation(333, 18, 35, kGrindCoffee, ARRAYSIZE(kGrindCoffee));
+ }
+ return kHandled;
+ case 336:
+ if (!_museum.laserSeen)
+ say(1, 0, true);
+ else {
+ say(30);
+ beginRoomAnimation(336, 19, 13);
+ }
+ return kHandled;
+ case 337:
+ say(31, _museum.talcSeen);
+ _museum.talcSeen = 1;
+ return kHandled;
+ case 339:
+ _museum.leftLabOnce = 1;
+ leaveMuseumRoom(4061, Common::Point(873, 311), 3, true);
+ return kHandled;
+ default: break;
+ }
+ }
+
switch (action) {
case 323: // Take the varnish from the briefcase.
if (_varnishTaken) {
@@ -136,6 +280,76 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute4050(uint16 action) {
return kUnhandled;
}
+void RunawayRoomScene::finish4050(uint16 action) {
+ switch (action) {
+ case 326:
+ _inventory.remove(7);
+ _inventory.add(8);
+ _museum.restoration = 1;
+ say(22, 1);
+ break;
+ case 328:
+ say(24);
+ holdRoomAnimation(428, 21, 56, 29);
+ break;
+ case 428:
+ beginRoomAnimation(438, 21, 56, kRecordSusan + 27, 8);
+ break;
+ case 438:
+ say(24, 1, false, 1);
+ holdRoomAnimation(448, 21, 56, 29);
+ break;
+ case 448:
+ beginRoomAnimation(458, 21, 56, kRecordSusan + 35, 29);
+ break;
+ case 458:
+ _inventory.museum().voiceRecorded = 1;
+ break;
+ case 331:
+ _inventory.remove(15);
+ _audio.playEffect(48, 204);
+ beginRoomAnimationRange(454, 15, 170, 117, 143, false);
+ return;
+ case 454:
+ say(26, 1);
+ say(26, 2, false, 1);
+ deferMuseumAction(453);
+ break;
+ case 333:
+ _inventory.museum().coffee = 1;
+ say(28, 1);
+ break;
+ case 336:
+ startMuseumFilm(kRubyFilm);
+ return;
+ case 405:
+ _inventory.add(7);
+ say(32, 2);
+ say(32, 3);
+ break;
+ case 456:
+ _inventory.remove(12);
+ say(30, 1);
+ walkTo(Common::Point(464, 544), 3, true);
+ beginRoomAnimation(452, 23, 95, nullptr, 0, false);
+ return;
+ case 450:
+ startMuseumFilm(kDrillingFilm);
+ return;
+ case 451:
+ _nextLaser = _now + 25000 + _random.getRandomNumber(5000);
+ break;
+ case 452:
+ startMuseumFilm(kLaserFilm);
+ return;
+ case 453:
+ startMuseumFilm(kMobstersFilm);
+ return;
+ default: return;
+ }
+ refreshMuseum();
+}
+
float RunawayRoomScene::actorHeight4050() const {
const int x = _position.x, y = _position.y;
const byte zone = walkZone();
@@ -160,7 +374,17 @@ bool RunawayRoomScene::loadScene4050() {
}
bool RunawayRoomScene::applyBackground4050() {
- return !_talcTaken || applyPatch(11);
+ if (_talcTaken && !applyPatch(11))
+ return false;
+ if (!museumChapter())
+ return true;
+ if (_museum.restoration && !applyPatch(_museum.restoration == 1 ? 9 : 10))
+ return false;
+ if (!_ambient.load(_archive, _museum.susan == 1 ? 15 : _museum.susan == 3 ? 16 : 8,
+ _museum.susan == 1 ? 170 : _museum.susan == 3 ? 2 : 75))
+ return false;
+ _ambientFrame = _museum.susan == 1 ? 79 : _museum.susan == 3 ? 1 : 0;
+ return true;
}
void RunawayRoomScene::drawForeground4050(Graphics::ManagedSurface &viewport) {
diff --git a/engines/hollywood/runaway/scene4060.cpp b/engines/hollywood/runaway/scene4060.cpp
index 29ccf98a42c..bfc9948efc4 100644
--- a/engines/hollywood/runaway/scene4060.cpp
+++ b/engines/hollywood/runaway/scene4060.cpp
@@ -26,6 +26,15 @@
namespace Hollywood {
namespace {
+const byte kCoffeeCupFrames[] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48,
+};
+
const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Stairs", -25, 319, 7, {301, 302}, {0, 1}},
@@ -130,6 +139,8 @@ void RunawayRoomScene::updateMaps4060() {
const byte zone = _maps[i];
if (_upperFloor ? zone < 5 || zone > 6 : zone > 4)
_maps[i] = 0;
+ if (museumChapter() && _museum.willyInLab && id == 14)
+ id = 0;
if (_upperFloor ? id > 11 : id < 12)
id = 0;
}
@@ -146,6 +157,132 @@ void RunawayRoomScene::changeFloor(bool upper, Common::Point position) {
}
RunawayRoomScene::ActionResult RunawayRoomScene::execute4060(uint16 action) {
+ if (museumChapter()) {
+ switch (action) {
+ case 307:
+ say(3, _museum.willyMet != 0);
+ return kHandled;
+ case 308:
+ leaveMuseumRoom(4070, Common::Point(548, 580), 7);
+ return kHandled;
+ case 313:
+ if (!_museum.basketSeen) {
+ say(6);
+ say(6, 1);
+ _museum.basketSeen = 1;
+ } else {
+ say(_coffeeTaken ? 7 : 6, _coffeeTaken ? 0 : 2);
+ }
+ return kHandled;
+ case 314:
+ if (!_museum.basketSeen || _coffeeTaken)
+ say(7);
+ else if (!_museum.needsPackage)
+ say(7, 1);
+ else {
+ _coffeeTaken = true;
+ say(7, 2);
+ _inventory.add(19);
+ say(114, 0, true);
+ }
+ return kHandled;
+ case 317:
+ say(9, _museum.analysisDoorSeen);
+ _museum.analysisDoorSeen = 1;
+ return kHandled;
+ case 318:
+ if (_museum.keypad != 4)
+ say(13);
+ else if (_inventory.museum().restoredCrucifix)
+ startMuseumFilm(kMuseumExitFilm);
+ else
+ leaveMuseumRoom(4100, Common::Point(141, 468));
+ return kHandled;
+ case 320:
+ if (_museum.willyInLab == 1)
+ say(15, 5);
+ else
+ leaveMuseumRoom(4140, Common::Point(382, 529));
+ return kHandled;
+ case 321:
+ if (!_museum.coffeeMachine && !_museum.coffeeSeen)
+ say(11, 1);
+ say(11, _museum.coffeeMachine ? 2 : 0);
+ _museum.coffeeSeen = 1;
+ return kHandled;
+ case 322:
+ if (_museum.coffeeMachine != 1)
+ say(12, _museum.coffeeMachine ? 3 : 0);
+ else {
+ say(12, 1);
+ beginRoomAnimation(322, 9, 49, kCoffeeCupFrames, ARRAYSIZE(kCoffeeCupFrames));
+ }
+ return kHandled;
+ case 325:
+ if (!_inventory.contains(13))
+ say(15);
+ else if (_museum.willyInLab == 1)
+ say(15, 7);
+ else if (_museum.keypad > 1)
+ say(15, 6);
+ else if (_museum.phoneUsed && !_museum.keypad)
+ say(15, 3);
+ else {
+ say(15, _museum.phoneUsed ? 2 : 1);
+ beginRoomAnimation(325, 13, 27);
+ }
+ return kHandled;
+ case 334:
+ say(23, _inventory.museum().voiceRecorded);
+ return kHandled;
+ case 335:
+ say(24, _inventory.museum().frozenBattery);
+ return kHandled;
+ case 337:
+ if (_museum.willyInLab == 1)
+ say(28);
+ else if (!_museum.sawCode)
+ say(26);
+ else if (_museum.keypad)
+ say(26, 3);
+ else {
+ say(26, 1);
+ deferMuseumAction(337);
+ }
+ return kHandled;
+ case 338:
+ if (_museum.willyInLab == 1)
+ say(28);
+ else if (!_museum.sawCode)
+ say(26);
+ else if (_museum.keypad < 2)
+ say(27, _museum.keypad);
+ else if (_museum.keypad > 2)
+ say(26, 3);
+ else {
+ say(27, 2);
+ deferMuseumAction(338);
+ }
+ return kHandled;
+ case 342:
+ if (_inventory.museum().coffee == 2)
+ say(32, 2);
+ else
+ leaveMuseumRoom(4072, Common::Point(548, 580), 7);
+ return kHandled;
+ case 345:
+ if (!_inventory.museum().packageFilled)
+ say(36);
+ else
+ leaveMuseumRoom(4071, Common::Point(548, 580), 7);
+ return kHandled;
+ case 346:
+ say(37, _inventory.museum().packageFilled);
+ return kHandled;
+ default: return kUnhandled;
+ }
+ }
+
if (action != 313)
return kUnhandled;
if (_coffeeTaken) {
@@ -159,6 +296,65 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute4060(uint16 action) {
return kHandled;
}
+void RunawayRoomScene::finish4060(uint16 action) {
+ switch (action) {
+ case 460:
+ _camera.y = 0;
+ beginRoomAnimationRange(461, 16, 216, 0, 178, false);
+ break;
+ case 461: {
+ beginRoomAnimationRange(464, 4, 13, 0, 12, false);
+ const byte willy[] = {178};
+ setRoomAnimationOverlay(16, 216, willy, ARRAYSIZE(willy));
+ _audio.playEffect(32, 204);
+ break;
+ }
+ case 464: {
+ beginRoomAnimationRange(465, 16, 216, 179, 215, false);
+ const byte door[] = {12};
+ setRoomAnimationOverlay(4, 13, door, ARRAYSIZE(door));
+ break;
+ }
+ case 465:
+ beginRoomAnimationRange(466, 4, 13, 12, 0, false);
+ _audio.playEffect(32, 204);
+ break;
+ case 466:
+ updateCamera();
+ say(_museum.sawCode == 1 ? 38 : 15, _museum.sawCode == 1 ? 2 : 5);
+ updateMaps();
+ break;
+ case 462:
+ say(36, 4);
+ walkTo(Common::Point(140, 504), 7, true);
+ _camera = Common::Point(0, 0);
+ beginRoomAnimationRange(463, 16, 216, 0, 150, false);
+ break;
+ case 463:
+ _museum.willyInLab = 0;
+ changeFloor(true, Common::Point(218, 379));
+ _facing = 7;
+ say(36, 5);
+ break;
+ case 322:
+ _museum.coffeeMachine = 2;
+ _inventory.add(15);
+ say(12, 2);
+ break;
+ case 325:
+ startMuseumFilm(kPhoneFilm);
+ break;
+ case 337:
+ _museum.keypad = 1;
+ leaveMuseumRoom(4141, Common::Point(382, 529));
+ break;
+ case 338:
+ _museum.keypad = 3;
+ leaveMuseumRoom(4142, Common::Point(382, 529));
+ break;
+ }
+}
+
float RunawayRoomScene::actorHeight4060() const {
const int x = _position.x, y = _position.y;
const byte zone = walkZone();
diff --git a/engines/hollywood/runaway/scene4070.cpp b/engines/hollywood/runaway/scene4070.cpp
new file mode 100644
index 00000000000..c6054c2bb20
--- /dev/null
+++ b/engines/hollywood/runaway/scene4070.cpp
@@ -0,0 +1,297 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "common/str-enc.h"
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+
+const RunawayRoom kRunawayScene4070 = {
+ kMuseumWilly, 1024, 600, nullptr, 0, {{100, 100, 100}}, Common::Point(548, 580),
+ nullptr, 0, nullptr, 0, nullptr, 0
+};
+
+bool RunawayRoomScene::loadScene4070() {
+ return _npc.load(_archive, 4, 188);
+}
+
+void RunawayRoomScene::drawScene4070(Graphics::ManagedSurface &viewport) {
+ if (!drawingRoomAnimation() || (_actionHidesActor && _secondaryFrames.empty()))
+ _npc.draw(viewport, _willyPose + (speaker() ? speechFrame() : 0), 0, 0);
+}
+
+void RunawayRoomScene::start4070() {
+ _facing = 7;
+ _audio.playEffect(57, 102, 1, true);
+ if (_entryScene == 4071) {
+ say(32);
+ say(33, 3, false, 1);
+ deferMuseumAction(417);
+ } else if (_entryScene == 4072) {
+ say(32);
+ if (_inventory.museum().coffee == 0) {
+ say(33, 0, false, 1);
+ _museum.needsGroundCoffee = 1;
+ } else {
+ say(33, 1, false, 1);
+ say(32, 1);
+ say(33, 2, false, 1);
+ _museum.needsPackage = 1;
+ }
+ deferMuseumAction(409);
+ } else {
+ startConversation(2);
+ }
+}
+
+void RunawayRoomScene::finish4070(uint16 action) {
+ switch (action) {
+ case 417:
+ beginRoomAnimationRange(427, 5, 53, 19, 33);
+ break;
+ case 427: {
+ byte willy[31], brian[31];
+ for (uint i = 0; i < ARRAYSIZE(willy); ++i) {
+ willy[i] = !i || i == 30 ? 54 : 158 + i;
+ brian[i] = i < 10 ? 33 : i < 19 ? 24 + i : 18;
+ }
+ beginRoomAnimation(407, 5, 53, brian, ARRAYSIZE(brian));
+ setRoomAnimationOverlay(4, 188, willy, ARRAYSIZE(willy));
+ break;
+ }
+ case 407:
+ _inventory.remove(19);
+ say(33, 4, false, 1);
+ if (_museum.batteryRequested) {
+ say(33, 5, false, 1);
+ say(36, 1);
+ say(33, 6, false, 1);
+ }
+ say(33, 7, false, 1);
+ _museum.coffeeMachine = 1;
+ _museum.willyInLab = 2;
+ deferMuseumAction(448);
+ break;
+ case 408: {
+ byte frames[32];
+ frames[0] = 54;
+ for (uint i = 1; i < ARRAYSIZE(frames); ++i)
+ frames[i] = 74 + i;
+ _audio.playEffect(15);
+ beginRoomAnimation(418, 4, 188, frames, ARRAYSIZE(frames), false);
+ break;
+ }
+ case 418:
+ _willyPose = 105;
+ for (uint i = 0; i < 6; ++i)
+ say(91, i, false, 1);
+ deferMuseumAction(428);
+ break;
+ case 428: {
+ byte frames[32];
+ for (uint i = 0; i < ARRAYSIZE(frames) - 1; ++i)
+ frames[i] = 105 - i;
+ frames[31] = 54;
+ beginRoomAnimation(438, 4, 188, frames, ARRAYSIZE(frames), false);
+ break;
+ }
+ case 438:
+ _willyPose = 54;
+ say(91, 6, false, 1);
+ say(81);
+ _museum.willyMet = 2;
+ _museum.willyInLab = 1;
+ _museum.sawCode = 1;
+ deferMuseumAction(448);
+ break;
+ case 448:
+ beginRoomAnimation(409, 6, 72, nullptr, 0, false);
+ break;
+ case 409:
+ _upperFloor = false;
+ leaveMuseumRoom(4064, Common::Point(921, 813), 7);
+ break;
+ }
+}
+
+void RunawayRoomScene::startConversation(byte character) {
+ _conversation = character;
+ _dialogueDepth = _dialogueNode = _dialogueIntro = 0;
+ _dialogueEnding = false;
+ _choices.clear();
+ memset(_dialogue, 0, sizeof(_dialogue));
+ // Eight choices per node, with the original forward/back transitions.
+ static const DialogueChoice susan[][8] = {
+ {{1,0,3,3,3,1,255}, {1,0,1,4,4,1,255}, {1,1,1,5,5,1,255}, {1,0,3,6,6,1,255}, {1,0,0,7,7,1,0}},
+ {{1,0,3,8,8,2,0}, {1,0,3,9,9,2,0}, {1,0,3,10,10,2,0}},
+ {{1,1,3,11,11,2,0}, {1,1,3,12,12,2,0}, {1,1,3,13,13,2,0}},
+ {{1,0,2,14,14,1,255}}
+ };
+ static const DialogueChoice willy[][8] = {
+ {{0,0,1,6,5,1,255}, {0,1,1,7,6,5,255}, {0,2,1,8,7,1,255}, {0,0,3,9,8,1,255},
+ {0,0,3,10,9,1,255}, {0,3,1,11,10,1,255}, {1,0,0,12,11,0,0}},
+ {{1,0,3,13,12,10,255}, {1,0,3,14,13,10,255}, {1,0,3,15,14,10,255}, {1,0,2,16,15,0,0}},
+ {{1,0,3,17,16,1,255}, {1,0,1,18,17,1,255}, {1,0,2,19,18,0,0}},
+ {{1,0,3,20,19,1,255}, {1,0,3,21,20,1,255}, {1,0,2,22,21,0,0}},
+ {{1,0,3,23,22,2,0}, {1,0,3,24,23,2,0}},
+ {{1,1,2,25,24,1,255}}
+ };
+ if (character == 1) {
+ memcpy(_dialogue[0], susan[0], sizeof(susan[0]));
+ memcpy(_dialogue[10], susan[1], sizeof(susan[1]));
+ memcpy(_dialogue[11], susan[2], sizeof(susan[2]));
+ memcpy(_dialogue[20], susan[3], sizeof(susan[3]));
+ say(80, 15);
+ say(90, 15, false, 1);
+ } else if (character == 2) {
+ memcpy(_dialogue[0], willy[0], sizeof(willy[0]));
+ for (uint i = 1; i <= 4; ++i)
+ memcpy(_dialogue[9 + i], willy[i], sizeof(willy[i]));
+ memcpy(_dialogue[20], willy[5], sizeof(willy[5]));
+ _dialogue[0][1].enabled = _inventory.museum().voiceRecorded && _inventory.contains(6) && !_inventory.museum().frozenBattery;
+ _dialogue[0][2].enabled = _museum.coffeeSeen && !_museum.coffeeMachine;
+ _dialogue[0][5].enabled = _museum.willyMet == 2 && !_museum.labVisited;
+ const uint count = 1 + _dialogue[0][1].enabled + _dialogue[0][2].enabled + _dialogue[0][5].enabled;
+ _dialogue[0][0].enabled = count <= 4;
+ _dialogue[0][3].enabled = count <= 3;
+ _dialogue[0][4].enabled = count <= 2;
+ if (!_museum.willyMet) {
+ _museum.willyMet = 1;
+ for (uint i = 0; i < 4; ++i) {
+ say(80, i);
+ say(90, i, false, 1);
+ }
+ _dialogueIntro = 1;
+ } else {
+ say(80, 5);
+ say(90, 4, false, 1);
+ }
+ } else {
+ for (uint i = 0; i < 5; ++i)
+ _dialogue[0][i] = {1, 0, 0, (byte)i, 1, 0, 0};
+ _dialogue[0][3].enabled = _inventory.museum().businessCardExamined;
+ _museum.voiceLockSeen = 1;
+ say(90, 0, false, 1);
+ }
+}
+
+void RunawayRoomScene::buildDialogueChoices() {
+ _choices.clear();
+ _choiceIndices.clear();
+ const uint page = _dialogueDepth * 10 + _dialogueNode;
+ if (page >= ARRAYSIZE(_dialogue)) {
+ finishConversation();
+ return;
+ }
+ for (uint i = 0; i < 8; ++i) {
+ if (!_dialogue[page][i].enabled)
+ continue;
+ const SceneSpeechCue cue = _text.stageCue(80, _dialogue[page][i].player);
+ const Common::U32String text(_text.largeTextRecord(cue.textRecordId), Common::kDos850);
+ if (!text.empty()) {
+ _choices.push_back(text);
+ _choiceIndices.push_back(i);
+ }
+ }
+ if (_choices.empty()) {
+ if (_dialogueDepth) {
+ --_dialogueDepth;
+ _dialogueNode = 0;
+ buildDialogueChoices();
+ } else {
+ finishConversation();
+ }
+ }
+}
+
+void RunawayRoomScene::chooseDialogue(uint choice) {
+ if (choice >= _choiceIndices.size() || speaking())
+ return;
+ const byte index = _choiceIndices[choice];
+ const uint page = _dialogueDepth * 10 + _dialogueNode;
+ DialogueChoice &entry = _dialogue[page][index];
+ _choices.clear();
+ _choiceIndices.clear();
+ say(80, entry.player);
+ if (_conversation == 2 && _museum.willyMet == 1) {
+ _dialogueEnding = true;
+ _afterConversation = 408;
+ return;
+ }
+ if (entry.response != 255)
+ say(90, entry.response, false, 1);
+ if (_conversation == 3)
+ _computerReject = true;
+ if (entry.disable)
+ entry.enabled = 0;
+ if (_conversation == 2 && entry.disable == 5)
+ _museum.batteryRequested = 1;
+ if (_conversation == 2 && entry.disable == 10) {
+ _dialogue[10][3].player = 22;
+ _dialogue[10][3].response = 21;
+ }
+ switch (entry.transition) {
+ case 0: _dialogueEnding = true; break;
+ case 1: ++_dialogueDepth; _dialogueNode = entry.node; break;
+ case 2: _dialogueDepth -= MIN<byte>(_dialogueDepth, 1); _dialogueNode = entry.node; break;
+ case 4: _dialogueDepth -= MIN<byte>(_dialogueDepth, 2); _dialogueNode = entry.node; break;
+ default: break;
+ }
+}
+
+void RunawayRoomScene::updateConversation() {
+ if (!_conversation || _roomAction || speaking() || !_choices.empty())
+ return;
+ if (_dialogueIntro) {
+ _dialogueIntro = 0;
+ _inventory.add(13);
+ _inventory.museum().businessCardExamined = 1;
+ say(50);
+ say(80, 4);
+ return;
+ }
+ if (_dialogueEnding)
+ finishConversation();
+ else
+ buildDialogueChoices();
+}
+
+void RunawayRoomScene::finishConversation() {
+ const byte character = _conversation;
+ _conversation = 0;
+ _choices.clear();
+ _choiceIndices.clear();
+ if (_afterConversation) {
+ deferMuseumAction(_afterConversation);
+ _afterConversation = 0;
+ } else if (character == 2) {
+ deferMuseumAction(409);
+ } else if (character == 3) {
+ _computerReject = false;
+ say(7, _museum.ownVoiceTried);
+ _museum.ownVoiceTried = 1;
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene4090.cpp b/engines/hollywood/runaway/scene4090.cpp
index 39856634cd4..e09118d2ac7 100644
--- a/engines/hollywood/runaway/scene4090.cpp
+++ b/engines/hollywood/runaway/scene4090.cpp
@@ -72,6 +72,38 @@ const RunawayRoom kRunawayScene4090 = {
kExits, ARRAYSIZE(kExits)
};
+bool RunawayRoomScene::applyBackground4090() {
+ return !museumChapter() || !_museum.coffeeBeansTaken || applyPatch(4);
+}
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute4090(uint16 action) {
+ if (!museumChapter())
+ return kUnhandled;
+ switch (action) {
+ case 307: case 308:
+ if (_museum.coffeeBeansTaken) {
+ say(action == 307 ? 5 : 6, action == 307 ? 2 : 3);
+ } else if (_museum.susan == 1 && _museum.coffeeSeen) {
+ say(6, 1);
+ _inventory.add(14);
+ _museum.coffeeBeansTaken = 1;
+ say(6, 2);
+ return kBackgroundChanged;
+ } else {
+ say(action == 307 ? 5 : 6, action == 307 ? _museum.mayanObjectsSeen : 0);
+ _museum.mayanObjectsSeen = 1;
+ }
+ return kHandled;
+ case 313: case 315: case 317: {
+ const uint object = (action - 313) / 2;
+ say(object == 0 ? 10 : object == 1 ? 12 : 13, _museum.exhibitSeen[object]);
+ _museum.exhibitSeen[object] = 1;
+ return kHandled;
+ }
+ default: return kUnhandled;
+ }
+}
+
float RunawayRoomScene::actorHeight4090() const {
const int y = _position.y;
return MIN(y, 390) * 0.2f + 122;
diff --git a/engines/hollywood/runaway/scene4100.cpp b/engines/hollywood/runaway/scene4100.cpp
index cd7bafcea8d..afd21201855 100644
--- a/engines/hollywood/runaway/scene4100.cpp
+++ b/engines/hollywood/runaway/scene4100.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/textconsole.h"
#include "common/util.h"
#include "hollywood/runaway/scene.h"
#include "hollywood/runaway/scene_data.h"
@@ -26,6 +27,19 @@
namespace Hollywood {
namespace {
+const byte kPressButtonFrames[] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+
+const byte kFreezeBatteryFrames[] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+ 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17,
+ 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
+};
+
const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Door", 141, 468, 7, {301, 302}, {0, 1}},
@@ -33,11 +47,11 @@ const RunawayHotspot kHotspots[] = {
{"Glass display case", 310, 457, 1, {305, 306}, {1, 1}},
{"Button", 204, 448, 1, {307, 308}, {1, 1}},
{"Mayan mask", 310, 457, 1, {309, 310}, {1, 1}},
- {"Scanner", 912, 435, 0, {311, 312}, {0, 0}},
+ {"Scanner", 906, 470, 0, {311, 312}, {0, 0}},
{"Tank", 1352, 431, 1, {315, 316}, {0, 0}},
{"Golden object", 111, 446, 1, {313, 314}, {1, 1}},
{"Device", 539, 439, 1, {317, 318}, {0, 0}},
- {"Ladel", 1329, 409, 1, {328, 329}, {0, 1}},
+ {"Ladle", 1329, 409, 1, {328, 329}, {0, 1}},
};
const RunawayResponse kResponses[] = {
@@ -85,6 +99,291 @@ const RunawayRoom kRunawayScene4100 = {
kExits, ARRAYSIZE(kExits)
};
+bool RunawayRoomScene::loadScene4100() {
+ return !museumChapter() || (_ambient.load(_archive, 4, 121) && _overlay.load(_archive, 5, 121) &&
+ _npc.load(_archive, 12, 42) && _machine.load(_archive, 20, 45) &&
+ _computer.load(_archive, 9, 49) && _rejectionLight.load(_archive, 11, 7));
+}
+
+bool RunawayRoomScene::applyBackground4100() {
+ if (!museumChapter())
+ return true;
+ if (!applyPatch((_museum.chamberOpen ? 15 : 13) + (_museum.maskTaken ? 1 : 0)))
+ return false;
+ if (_museum.keyTaken && !applyPatch(6))
+ return false;
+ if (_museum.ladleTaken && !applyPatch(8))
+ return false;
+ return true;
+}
+
+void RunawayRoomScene::updateMaps4100() {
+ if (!museumChapter())
+ return;
+ for (uint i = 0; i < 256; ++i) {
+ byte &id = _maps[256 + i];
+ if (id == 4 && (!_museum.buttonSeen || _museum.chamberOpen))
+ id = 3;
+ else if (id == 5 && (!_museum.cabinetSeen || _museum.maskTaken))
+ id = 3;
+ else if ((id == 8 && _museum.keyTaken) || (id == 10 && _museum.ladleTaken))
+ id = 0;
+ if (_maps[i] == 4 || _maps[i] == 5)
+ _maps[i] = 0;
+ }
+}
+
+void RunawayRoomScene::drawScene4100(Graphics::ManagedSurface &viewport) {
+ const uint tick = (_now / 80 + 46) % 217;
+ const uint frame = tick <= 106 ? 14 + tick : 216 - tick;
+ _ambient.draw(viewport, frame, _camera.x, 0);
+ _overlay.draw(viewport, frame, _camera.x, 0);
+ static const byte durations[][45] = {
+ {3, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12,
+ 13, 13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23},
+ {3, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,
+ 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16}
+ };
+ for (uint machine = 0; machine < 2; ++machine) {
+ uint position = _machinePosition[machine], index = 0;
+ const uint count = machine ? 45 : 42;
+ while (index + 1 < count && position >= durations[machine][index])
+ position -= durations[machine][index++];
+ (machine ? _machine : _npc).draw(viewport, index, _camera.x, 0);
+ }
+ if (_cliveVisible)
+ _npcMouth.draw(viewport, 17 + (speaker() ? speechFrame() : 0), _camera.x, 0);
+ _computer.draw(viewport, _computerFrame, _camera.x, 0);
+ if (_computerReject)
+ _rejectionLight.draw(viewport, 6, _camera.x, 0);
+}
+
+void RunawayRoomScene::closeMuseumChamber() {
+ _museum.chamberTime = 0;
+ beginRoomAnimationRange(430, _museum.maskTaken ? 33 : 32, 36, 35, 0, false);
+ _audio.playEffect(33, 191);
+}
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute4100(uint16 action) {
+ if (!museumChapter())
+ return kUnhandled;
+ switch (action) {
+ case 302:
+ leaveMuseumRoom(4062, Common::Point(1118, 309), 3);
+ return kHandled;
+ case 305:
+ say(4, !_museum.cabinetSeen ? 0 : _museum.maskTaken ? 2 : 1);
+ _museum.cabinetSeen = 1;
+ return kBackgroundChanged;
+ case 306:
+ say(5, _museum.buttonSeen);
+ _museum.buttonSeen = 1;
+ return kBackgroundChanged;
+ case 308:
+ beginRoomAnimation(308, 29, 12, kPressButtonFrames, ARRAYSIZE(kPressButtonFrames));
+ return kHandled;
+ case 309:
+ say(8, _museum.chamberOpen != 0);
+ return kHandled;
+ case 310:
+ if (!_museum.chamberOpen)
+ say(9);
+ else {
+ say(9, 1);
+ _museum.maskTaken = 1;
+ _inventory.add(11);
+ say(9, 2);
+ deferMuseumAction(432);
+ }
+ return kBackgroundChanged;
+ case 311:
+ say(10, _museum.scannerSeen);
+ _museum.scannerSeen = 1;
+ return kHandled;
+ case 313:
+ say(12, _museum.keySeen);
+ _museum.keySeen = 1;
+ return kHandled;
+ case 314:
+ if (!_museum.keySeen)
+ say(12);
+ _museum.keySeen = _museum.keyTaken = 1;
+ _inventory.add(17);
+ say(13);
+ say(13, 1);
+ say(13, 2);
+ return kBackgroundChanged;
+ case 315:
+ say(14, _museum.nitrogenSeen);
+ _museum.nitrogenSeen = 1;
+ return kHandled;
+ case 317:
+ say(16, _museum.microscopeSeen);
+ _museum.microscopeSeen = 1;
+ return kHandled;
+ case 320:
+ say(19, _museum.chamberOpen != 0);
+ return kHandled;
+ case 321:
+ if (!_museum.voiceLockSeen)
+ say(2, 0, true);
+ else if (!_inventory.museum().voiceRecorded)
+ say(20);
+ else if (_museum.chamberOpen)
+ say(1, 2, true);
+ else if (_inventory.museum().recorderBattery == 1 || _inventory.museum().recorderBattery == 2)
+ say(20, _inventory.museum().recorderBattery == 1 ? 2 : 1);
+ else {
+ const byte battery = _inventory.museum().recorderBattery;
+ say(20, battery == 0 ? 3 : battery == 3 ? 7 : 9);
+ walkTo(Common::Point(204, 448), 1, true);
+ beginRoomAnimation(340, 29, 12, kPressButtonFrames, ARRAYSIZE(kPressButtonFrames));
+ }
+ return kHandled;
+ case 325:
+ if (!_inventory.museum().batteryInLadle)
+ say(23);
+ else {
+ say(23, 1);
+ beginRoomAnimation(325, 23, 69, kFreezeBatteryFrames, ARRAYSIZE(kFreezeBatteryFrames));
+ byte tank[ARRAYSIZE(kFreezeBatteryFrames)];
+ for (uint i = 0; i < ARRAYSIZE(tank); ++i)
+ tank[i] = MIN<uint>(44, i > 17 ? i - 17 : 0);
+ setRoomAnimationOverlay(25, 45, tank, ARRAYSIZE(tank));
+ }
+ return kHandled;
+ case 329:
+ _museum.ladleTaken = 1;
+ _inventory.add(18);
+ say(113, 0, true);
+ return kBackgroundChanged;
+ case 330:
+ say(27, _inventory.museum().frozenBattery);
+ return kHandled;
+ default: return kUnhandled;
+ }
+}
+
+void RunawayRoomScene::finish4100(uint16 action) {
+ switch (action) {
+ case 340:
+ say(90, 0, false, 1);
+ deferMuseumAction(341);
+ break;
+ case 341:
+ beginRoomAnimationRange(342, 27, 21, 0, 20);
+ break;
+ case 342:
+ say(91, _inventory.museum().recorderBattery ? 1 : 0, false, 2);
+ holdRoomAnimation(343, 27, 21, 20);
+ break;
+ case 343:
+ beginRoomAnimationRange(344, 27, 21, 20, 0);
+ break;
+ case 344:
+ _computerReject = !_inventory.museum().recorderBattery;
+ say(90, _computerReject ? 1 : 2, false, 1);
+ deferMuseumAction(321);
+ break;
+ case 321:
+ _computerReject = false;
+ if (!_inventory.museum().recorderBattery) {
+ say(20, 4);
+ say(20, 5);
+ _inventory.museum().recorderBattery = 2;
+ _inventory.add(6);
+ say(20, 6);
+ } else {
+ beginRoomAnimation(345, 10, 7, nullptr, 0, false);
+ }
+ break;
+ case 345:
+ beginRoomAnimation(431, _museum.maskTaken ? 33 : 32, 36, nullptr, 0, false);
+ _audio.playEffect(33, 191);
+ break;
+ case 325:
+ _inventory.museum().batteryInLadle = 0;
+ _inventory.museum().frozenBattery = 1;
+ _inventory.add(6);
+ say(23, 2);
+ say(23, 3);
+ break;
+ case 308:
+ startConversation(3);
+ break;
+ case 409:
+ say(28, 1);
+ beginRoomAnimation(410, 26, 46);
+ break;
+ case 410:
+ startMuseumFilm(kScannerFilm);
+ break;
+ case 411:
+ startMuseumFilm(kBetrayalFilm);
+ break;
+ case 412:
+ if (!_museum.labVisited) {
+ _museum.labVisited = 1;
+ say(0);
+ }
+ break;
+ case 413:
+ say(28);
+ deferMuseumAction(414);
+ break;
+ case 414:
+ beginRoomAnimationRange(415, 24, 28, 0, 4);
+ break;
+ case 415: {
+ _camera.x = 0;
+ beginRoomAnimationRange(416, 22, 60, 0, 16);
+ const byte brian[] = {4};
+ setRoomAnimationOverlay(24, 28, brian, ARRAYSIZE(brian));
+ break;
+ }
+ case 416:
+ if (!_npcMouth.load(_archive, 22, 60))
+ error("Cannot load Runaway Clive animation");
+ _cliveVisible = true;
+ say(92, 0, false, 1);
+ holdRoomAnimation(417, 24, 28, 4);
+ break;
+ case 417:
+ beginRoomAnimationRange(418, 24, 28, 5, 9);
+ break;
+ case 418:
+ say(92, 1, false, 1);
+ holdRoomAnimation(419, 24, 28, 9);
+ break;
+ case 419: {
+ _cliveVisible = false;
+ beginRoomAnimationRange(420, 22, 60, 44, 59);
+ const byte brian[] = {9};
+ setRoomAnimationOverlay(24, 28, brian, ARRAYSIZE(brian));
+ break;
+ }
+ case 420:
+ beginRoomAnimationRange(411, 24, 28, 10, 27);
+ break;
+ case 432:
+ closeMuseumChamber();
+ break;
+ case 430:
+ _museum.chamberOpen = 0;
+ _museum.chamberTime = 0;
+ refreshMuseum();
+ break;
+ case 431:
+ if (_inventory.museum().recorderBattery == 3)
+ say(20, 8);
+ _inventory.museum().recorderBattery = 4;
+ _museum.buttonSeen = _museum.chamberOpen = 1;
+ _museum.chamberTime = 30000;
+ refreshMuseum();
+ break;
+ }
+}
+
float RunawayRoomScene::actorHeight4100() const {
const int x = _position.x, y = _position.y;
if (x > 1260)
diff --git a/engines/hollywood/runaway/scene4140.cpp b/engines/hollywood/runaway/scene4140.cpp
index d6603bfc522..65271ec85b0 100644
--- a/engines/hollywood/runaway/scene4140.cpp
+++ b/engines/hollywood/runaway/scene4140.cpp
@@ -34,33 +34,68 @@ const RunawayRoom kRunawayScene4140 = {
nullptr, 0
};
+void RunawayRoomScene::start4140() {
+ _museum.keypadDigits = 0;
+ _keyCount = 0;
+ if (_entryScene == 4141) {
+ say(2);
+ deferMuseumAction(414);
+ } else if (_entryScene == 4142) {
+ say(3);
+ say(3, 1);
+ } else if (_museum.keypad == 1 || _museum.keypad == 2) {
+ say(1);
+ deferMuseumAction(414);
+ } else if (_museum.keypad >= 3) {
+ say(3, _museum.keypad == 4 ? 4 : 2);
+ }
+}
+
void RunawayRoomScene::clickScene4140(byte id) {
_pressedKey = id;
_keyUntil = _now + 180;
+ _keyResult = 0;
if (!id) {
- _transition.scene = kMuseumHall;
- _transition.position = Common::Point(1153, 297);
- _transition.facing = 7;
+ leaveMuseumRoom(4063, Common::Point(1153, 297), 7);
} else if (id == 10) {
+ _audio.playEffect(museumChapter() ? 30 : 10);
_keyCount = 0;
+ _museum.keypadDigits = 0;
} else if (id == 12) {
+ if (_keyCount == 4 && _museum.keypad >= 3 && _museum.keypadDigits == 8137) {
+ _keyResult = 2;
+ _museum.keypad = 4;
+ _audio.playEffect(31);
+ say(3, 3);
+ deferMuseumAction(414);
+ } else {
+ _keyResult = 1;
+ if (museumChapter())
+ _audio.playEffect(28);
+ }
+ _keyUntil = _now + 500;
_keyCount = 0;
- warning("Runaway museum: the fingerprint puzzle is not implemented yet");
+ _museum.keypadDigits = 0;
} else {
- _audio.playEffect(id == 11 ? 11 : 11 + id);
- if (_keyCount < 4)
+ const byte digit = id == 11 ? 0 : id;
+ _audio.playEffect(museumChapter() ? 18 + digit : id == 11 ? 11 : 11 + id);
+ if (_keyCount < 4) {
++_keyCount;
- else
+ _museum.keypadDigits = _museum.keypadDigits * 10 + digit;
+ } else {
say(4);
+ }
}
}
void RunawayRoomScene::drawScene4140(Graphics::ManagedSurface &viewport) {
- bool valid = applyRunawayPatch(_keyPatches[15], viewport);
+ bool valid = applyRunawayPatch(_keyPatches[_museum.keypad >= 3 ? 17 : _museum.keypad ? 16 : 15], viewport);
for (uint i = 0; valid && i < _keyCount; ++i)
valid = applyRunawayPatch(_keyPatches[21 + i], viewport);
if (valid && _pressedKey && (int32)(_now - _keyUntil) < 0)
valid = applyRunawayPatch(_keyPatches[2 + _pressedKey], viewport);
+ if (valid && _keyResult && (int32)(_now - _keyUntil) < 0)
+ valid = applyRunawayPatch(_keyPatches[18 + _keyResult], viewport);
if (!valid)
error("Invalid museum keypad image");
}
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
index 3fee4e10507..f04e5eb3a3c 100644
--- a/engines/hollywood/runaway/scene_data.h
+++ b/engines/hollywood/runaway/scene_data.h
@@ -33,6 +33,7 @@ enum RunawayRoomId {
kMuseumOffice = 4030,
kMuseumLaboratory = 4050,
kMuseumHall = 4060,
+ kMuseumWilly = 4070,
kMuseumExhibition = 4090,
kMuseumSecurity = 4100,
kMuseumKeypad = 4140
@@ -87,6 +88,7 @@ extern const RunawayRoom kRunawayScene2080;
extern const RunawayRoom kRunawayScene4030;
extern const RunawayRoom kRunawayScene4050;
extern const RunawayRoom kRunawayScene4060;
+extern const RunawayRoom kRunawayScene4070;
extern const RunawayRoom kRunawayScene4090;
extern const RunawayRoom kRunawayScene4100;
extern const RunawayRoom kRunawayScene4140;
diff --git a/engines/hollywood/runaway/sequence.cpp b/engines/hollywood/runaway/sequence.cpp
index 3b4531f12bb..b6c291f59c7 100644
--- a/engines/hollywood/runaway/sequence.cpp
+++ b/engines/hollywood/runaway/sequence.cpp
@@ -27,7 +27,10 @@
namespace Hollywood {
-void RunawaySequence::start(const Command *commands, const SceneTextStore &text, uint32 now) {
+void RunawaySequence::start(const Command *commands, const SceneTextStore &text, uint32 now, char chapter) {
+ _background.free();
+ _destination = Common::Rect(0, kRunawayViewportTop, kRunawayScreenWidth, kRunawayViewportTop + kRunawayViewportHeight);
+ _chapter = chapter;
_text = &text;
_audio.stopSpeech();
_audio.stopEffect();
@@ -41,6 +44,11 @@ void RunawaySequence::start(const Command *commands, const SceneTextStore &text,
update(now);
}
+void RunawaySequence::setBackground(const Graphics::ManagedSurface &background, const Common::Rect &destination) {
+ _background.copyFrom(background);
+ _destination = destination;
+}
+
void RunawaySequence::advance() {
++_index;
_entered = false;
@@ -80,16 +88,6 @@ void RunawaySequence::nextLine() {
_lipSync.start(_subtitle, _now, duration, _random, line.sample);
}
-bool RunawaySequence::loadPortrait(uint chunk) {
- if (!_portraits.open(Common::Path(Common::String::format("DATAVB%02u.002", _movie)), 40))
- return false;
- Common::Array<byte> patch;
- _portrait.create(512, 300, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
- _talking.create(512, 300, _portrait.format);
- return _portraits.readVariableChunk(chunk, patch) && applyRunawayPatch(patch, _portrait) &&
- _mouth.load(_portraits, chunk + 1, 12);
-}
-
void RunawaySequence::update(uint32 now) {
_now = now;
if (!_subtitle.empty() && (int32)(now - _deadline) >= 0)
@@ -100,23 +98,35 @@ void RunawaySequence::update(uint32 now) {
_entered = true;
switch (command.operation) {
case kOpen: {
- const Common::String name = Common::String::format("DATAVB%02u.001", command.a);
+ const Common::String name = Common::String::format("DATAV%c%02u.%03u", _chapter, command.a, command.b ? command.b : 1);
if (!_video.load(name.c_str()))
error("Cannot load Runaway film %s", name.c_str());
_movie = command.a;
+ _stills.close();
+ _useStill = false;
_showPortrait = false;
break;
}
case kPlay:
+ _useStill = false;
_showPortrait = false;
_repeatAt = 0;
if (!_video.seekToFrame(command.a))
error("Cannot seek to Runaway film frame %u", command.a);
break;
+ case kStill:
+ _showPortrait = false;
+ _useStill = command.b != 0;
+ if (_useStill && !_stills.frameCount() && !_stills.load(Common::String::format("DATAV%c%02u.002", _chapter, _movie).c_str()))
+ error("Cannot load Runaway film stills");
+ if (!(_useStill ? _stills : _video).seekToFrame(command.a))
+ error("Cannot load Runaway film still %u", command.a);
+ break;
case kTalk:
_showPortrait = command.c != 0;
_silentPortrait = command.d != 0;
- if (_showPortrait && !loadPortrait(command.c - 1))
+ _portrait = (command.c - 1) / 2;
+ if (_showPortrait && !_portraits.load(_chapter, _movie))
error("Cannot load Runaway film portrait %u", command.c - 1);
speak(command.a, command.b);
break;
@@ -178,6 +188,7 @@ void RunawaySequence::update(uint32 now) {
break;
case kEnd:
_video.close();
+ _stills.close();
_audio.stopSpeech();
_audio.stopEffect();
_lipSync.stop();
@@ -211,13 +222,13 @@ void RunawaySequence::skip() {
void RunawaySequence::draw(Graphics::ManagedSurface &screen) {
screen.clear();
- const Common::Rect viewport(0, kRunawayViewportTop, kRunawayScreenWidth, kRunawayViewportTop + kRunawayViewportHeight);
+ const Common::Rect &viewport = _destination;
+ if (_background.w)
+ screen.blitFrom(_background);
+ (_useStill ? _stills : _video).draw(screen, viewport);
if (_showPortrait) {
- _talking.blitFrom(_portrait);
- _mouth.draw(_talking, _silentPortrait ? 0 : speechFrame(), 0, 0);
- screen.blitFrom(_talking, Common::Rect(512, 300), viewport);
- } else {
- _video.draw(screen, viewport);
+ if (!_portraits.draw(screen, viewport, _portrait, _silentPortrait ? 0 : speechFrame()))
+ error("Cannot draw Runaway film portrait %u", _portrait);
}
}
diff --git a/engines/hollywood/runaway/sequence.h b/engines/hollywood/runaway/sequence.h
index d4e11a5dc43..944e9929f3b 100644
--- a/engines/hollywood/runaway/sequence.h
+++ b/engines/hollywood/runaway/sequence.h
@@ -32,13 +32,14 @@
namespace Hollywood {
-// Retail films interleave AVI ranges, separately stored talking portraits,
+// Retail films interleave movie ranges, separately stored talking portraits,
// and speech/effects. The scene supplies the original sequence of cues.
class RunawaySequence {
public:
enum Operation {
- kOpen, // Movie number.
+ kOpen, // Movie number; optional file suffix (defaults to .001).
kPlay, // First/last frame, Playback mode.
+ kStill, // Frame; second argument selects the separate GOG stills movie.
kTalk, // Cue, variation, portrait chunk + 1 (0 = movie still), offscreen speaker.
kSpeech, // Cue, first/last variation; continues alongside the movie.
kWaitSpeech,
@@ -58,7 +59,8 @@ public:
byte c, d;
};
explicit RunawaySequence(RunawayAudio &audio) : _audio(audio), _random("runawaySequence") {}
- void start(const Command *commands, const SceneTextStore &text, uint32 now);
+ void start(const Command *commands, const SceneTextStore &text, uint32 now, char chapter = 'B');
+ void setBackground(const Graphics::ManagedSurface &background, const Common::Rect &destination);
void update(uint32 now);
void skip();
void draw(Graphics::ManagedSurface &screen);
@@ -70,15 +72,17 @@ private:
void advance();
void speak(uint cue, uint variation, uint lastVariation = 0);
void nextLine();
- bool loadPortrait(uint chunk);
RunawayAudio &_audio;
Common::RandomSource _random;
RunawayLipSync _lipSync;
- RunawayVideo _video;
- ChunkArchive _portraits;
- RunawayAnimation _mouth;
- Graphics::ManagedSurface _portrait, _talking;
+ RunawayVideo _video, _stills;
+ bool _useStill = false;
+ RunawayFilmPortrait _portraits;
+ Graphics::ManagedSurface _background;
+ Common::Rect _destination;
+ uint _portrait = 0;
+ char _chapter = 'B';
const SceneTextStore *_text = nullptr;
const Command *_commands = nullptr;
uint _index = 0;
diff --git a/engines/hollywood/runaway/ui.cpp b/engines/hollywood/runaway/ui.cpp
index 49fb5648914..cab708247f9 100644
--- a/engines/hollywood/runaway/ui.cpp
+++ b/engines/hollywood/runaway/ui.cpp
@@ -300,6 +300,18 @@ RunawayUI::Command RunawayUI::click(bool right) {
command.type = Command::kSkipSpeech;
return command;
}
+ if (!_choices.empty()) {
+ if (!right) {
+ for (uint i = 0; i < _choiceRects.size(); ++i) {
+ if (_choiceRects[i].contains(_mouse)) {
+ command.type = Command::kChooseDialogue;
+ command.target = i;
+ break;
+ }
+ }
+ }
+ return command;
+ }
if (_blocked || busy())
return command;
if (right) {
@@ -342,13 +354,13 @@ RunawayUI::Command RunawayUI::click(bool right) {
}
void RunawayUI::updateCursor() {
- const bool waiting = _blocked || _speaking || busy();
+ const bool waiting = (_blocked && _choices.empty()) || _speaking || busy();
// Native 0x411990 hides the cursor during actions and dialogue.
// RESOURCE.000 chunk 118 is the corner logo, not a busy cursor.
CursorMan.showMouse(!waiting);
if (waiting)
return;
- const byte item = _inventory.selected();
+ const byte item = _choices.empty() ? _inventory.selected() : 0;
uint tile = _museum ? (_verb == kVerbWalk ? 0 : _verb == kVerbLook ? 6 : 7) : (uint)_verb;
uint shade = 0;
if (item) {
@@ -423,8 +435,9 @@ void RunawayUI::drawInventory(Graphics::ManagedSurface &screen) {
screen.fillRect(rect, 0);
} else {
const uint y = (_inventory.icon(item) - 1) * 80;
- if (y + 80 <= (uint)_icons.h)
- screen.copyRectToSurface(_icons, rect.left, rect.top, Common::Rect(0, y, 80, y + 80));
+ // The museum strip ends with a 79-pixel-high icon.
+ if (y < (uint)_icons.h)
+ screen.copyRectToSurface(_icons, rect.left, rect.top, Common::Rect(0, y, 80, MIN<uint>(y + 80, _icons.h)));
}
}
if (_pickupItem) {
@@ -442,6 +455,22 @@ void RunawayUI::drawInventory(Graphics::ManagedSurface &screen) {
}
}
+void RunawayUI::setDialogueChoices(const Common::Array<Common::U32String> &choices) {
+ _choices.clear();
+ _choiceRects.clear();
+ int height = 0;
+ for (uint i = 0; i < choices.size(); ++i) {
+ Common::Array<Common::U32String> lines;
+ _font.wordWrapText(choices[i], 968, lines);
+ const uint lineHeight = MAX<uint>(1, lines.size()) * 28 + 8;
+ _choiceRects.push_back(Common::Rect(20, height, 1004, height + lineHeight));
+ height += lineHeight;
+ _choices.push_back(lines);
+ }
+ for (uint i = 0; i < _choiceRects.size(); ++i)
+ _choiceRects[i].translate(0, kRunawayScreenHeight - 12 - height);
+}
+
void RunawayUI::drawSubtitle(Graphics::ManagedSurface &screen, const Common::U32String &text) const {
Common::Array<Common::U32String> lines;
_font.wordWrapText(text, 984, lines);
@@ -473,6 +502,15 @@ void RunawayUI::draw(Graphics::ManagedSurface &screen, const Common::U32String &
}
_font.drawString(screen.surfacePtr(), caption, 20, 684, 984, color, Graphics::kTextAlignCenter);
}
+ if (!_choices.empty() && !_speaking) {
+ screen.fillRect(Common::Rect(0, _choiceRects[0].top - 8, kRunawayScreenWidth, kRunawayScreenHeight), 0);
+ for (uint i = 0; i < _choices.size(); ++i) {
+ const uint16 color = _choiceRects[i].contains(_mouse) ?
+ kUIFormat.RGBToColor(255, 223, 206) : kUIFormat.RGBToColor(189, 166, 148);
+ for (uint j = 0; j < _choices[i].size(); ++j)
+ _font.drawString(screen.surfacePtr(), _choices[i][j], 28, _choiceRects[i].top + j * 28, 968, color);
+ }
+ }
// Native 0x4020b0 copies the demo logo to the bottom-right corner.
if (_demoLogo.w)
screen.copyRectToSurface(_demoLogo, 976, 720, Common::Rect(0, 0, 48, 48));
diff --git a/engines/hollywood/runaway/ui.h b/engines/hollywood/runaway/ui.h
index 990ae3db4e0..db143fb8277 100644
--- a/engines/hollywood/runaway/ui.h
+++ b/engines/hollywood/runaway/ui.h
@@ -34,7 +34,7 @@ namespace Hollywood {
class RunawayUI {
public:
struct Command {
- enum Type { kNone, kRoom, kExamineItem, kCombine, kSkipSpeech, kOpenMenu };
+ enum Type { kNone, kRoom, kExamineItem, kCombine, kSkipSpeech, kOpenMenu, kChooseDialogue };
Type type = kNone;
RunawayVerb verb = kVerbWalk;
Common::Point mouse;
@@ -47,6 +47,7 @@ public:
bool loadChapter(byte chapter);
void update(uint32 now, Common::Point mouse, byte roomHotspot, bool blocked, bool speaking,
bool inventoryPresentation = false, byte speechFrame = 0);
+ void setDialogueChoices(const Common::Array<Common::U32String> &choices);
Command click(bool right);
void toggleInventory();
bool cancel();
@@ -83,6 +84,8 @@ private:
Graphics::ManagedSurface _inventoryBackground, _inventoryTexture, _icons;
RunawayAnimation _portrait, _idlePortrait;
Common::Point _mouse;
+ Common::Array<Common::Array<Common::U32String> > _choices;
+ Common::Array<Common::Rect> _choiceRects;
RunawayVerb _verb = kVerbWalk, _previousVerb = kVerbWalk;
byte _hovered = 0, _buttonFrame = 0, _optionsFrame = 0, _pickupItem = 0;
bool _inventoryOpen = false, _enteredInventory = false, _returnAfterPickup = false;
diff --git a/engines/hollywood/runaway/video.cpp b/engines/hollywood/runaway/video.cpp
index 42662060f5e..6b548816c73 100644
--- a/engines/hollywood/runaway/video.cpp
+++ b/engines/hollywood/runaway/video.cpp
@@ -24,9 +24,61 @@
#include "common/memstream.h"
#include "common/textconsole.h"
#include "hollywood/runaway/video.h"
+#include "video/avi_decoder.h"
+#include "video/bink_decoder.h"
namespace Hollywood {
+namespace {
+
+struct FilmOverlay {
+ char chapter;
+ byte movie, portrait, first, count;
+ int16 left, top, right, bottom;
+};
+
+// Crop only the animated face; the GOG movies retain the surrounding still.
+const FilmOverlay kFilmOverlays[] = {
+ {'B', 1, 0, 0, 12, 536, 222, 614, 300},
+ {'B', 2, 0, 0, 12, 526, 260, 657, 411},
+ {'B', 2, 1, 12, 12, 681, 121, 788, 282},
+ {'B', 7, 0, 0, 12, 406, 46, 531, 177},
+ {'B', 7, 1, 12, 12, 270, 46, 751, 599},
+ {'B', 7, 2, 24, 12, 280, 26, 655, 599},
+ {'B', 8, 0, 0, 12, 587, 74, 648, 162},
+ {'B', 8, 1, 12, 12, 258, 318, 314, 374},
+ {'B', 8, 2, 24, 12, 402, 28, 532, 230},
+ {'B', 9, 0, 0, 12, 554, 309, 687, 456},
+ {'B', 9, 1, 12, 12, 747, 55, 887, 219},
+ {'B', 9, 2, 24, 12, 317, 144, 726, 598},
+ {'B', 9, 3, 36, 6, 1, 1, 230, 248},
+ {'B', 9, 4, 42, 12, 312, 163, 438, 319},
+ {'B', 9, 5, 54, 12, 256, 144, 708, 600},
+ {'B', 9, 6, 66, 12, 80, 76, 172, 170},
+ {'B', 9, 7, 78, 12, 174, 24, 564, 592},
+ {'B', 9, 8, 90, 12, 364, 8, 904, 562},
+ {'B', 9, 9, 102, 12, 280, 36, 402, 184},
+ {'B', 9, 10, 114, 12, 464, 12, 580, 164},
+ {'B', 9, 11, 126, 12, 226, 16, 338, 158},
+ {'B', 9, 12, 138, 6, 531, 323, 641, 454},
+ {'B', 9, 13, 144, 12, 881, 0, 1024, 161},
+ {'D', 1, 0, 0, 12, 554, 6, 632, 134},
+ {'D', 1, 1, 12, 12, 302, 184, 362, 284},
+ {'D', 1, 2, 24, 12, 339, 112, 408, 197},
+ {'D', 1, 3, 36, 12, 360, 178, 570, 530},
+ {'D', 1, 4, 48, 12, 395, 148, 706, 557},
+ {'D', 1, 5, 60, 12, 318, 118, 581, 485},
+ {'D', 5, 0, 0, 12, 190, 444, 458, 600},
+ {'D', 5, 1, 12, 12, 170, 442, 476, 600},
+ {'D', 7, 0, 0, 12, 360, 104, 548, 400},
+ {'D', 7, 1, 12, 12, 278, 268, 468, 428},
+ {'D', 8, 0, 0, 6, 79, 67, 176, 170},
+ {'D', 10, 0, 0, 6, 180, 46, 698, 600},
+ {'D', 9, 0, 0, 12, 474, 36, 578, 234},
+};
+
+} // End of anonymous namespace
+
bool RunawayVideo::load(const char *name) {
close();
Common::File file;
@@ -38,36 +90,75 @@ bool RunawayVideo::load(const char *name) {
_data.resize((uint)fileSize);
if (file.read(_data.data(), _data.size()) != _data.size())
return false;
- if (READ_BE_UINT32(_data.data()) != MKTAG('R', 'I', 'F', 'F')) {
- // The native player (0x41ac70) temporarily rewrites the first 1024
- // bytes using DATAVC00.001. Restore them only in our memory copy.
- // Match the stored prefix: the Spanish codebook uses different indices.
+ const uint32 tag = READ_BE_UINT32(_data.data());
+ if (tag != MKTAG('R', 'I', 'F', 'F') && (tag >> 8) != MKTAG(0, 'B', 'I', 'K')) {
Common::File codebook;
- if (!codebook.open("DATAVC00.001"))
- return false;
byte entry[2048];
bool found = false;
- while (codebook.read(entry, sizeof(entry)) == sizeof(entry)) {
- if (memcmp(entry + 1024, _data.data(), 1024))
- continue;
- for (uint i = 0; i < 1024; ++i)
- _data[i] = entry[i] - entry[1024 + i];
- found = true;
- break;
+ if (codebook.open("DATAVC00.000")) {
+ // GOG stores named Bink headers, XOR chained with the previous byte.
+ const byte key = codebook.readUint32LE();
+ const uint count = codebook.readUint32LE();
+ if (count > 256 || codebook.size() != 8 + count * (15 + sizeof(entry)))
+ return false;
+ for (uint i = 0; i < count; ++i) {
+ byte encodedName[15];
+ codebook.seek(8 + i * sizeof(encodedName));
+ if (codebook.read(encodedName, sizeof(encodedName)) != sizeof(encodedName))
+ return false;
+ char decodedName[16] = {};
+ byte previous = key;
+ for (uint j = 0; j < sizeof(encodedName); ++j) {
+ decodedName[j] = encodedName[j] ^ previous;
+ previous = encodedName[j];
+ }
+ if (!Common::String(decodedName).equalsIgnoreCase(name))
+ continue;
+ codebook.seek(8 + count * 15 + i * sizeof(entry));
+ if (codebook.read(entry, sizeof(entry)) != sizeof(entry) || memcmp(entry + 1024, _data.data(), 1024))
+ return false;
+ previous = key;
+ for (uint j = 0; j < 1024; ++j) {
+ _data[j] = entry[j] ^ previous;
+ previous = entry[j];
+ }
+ found = true;
+ break;
+ }
+ } else if (codebook.open("DATAVC00.001")) {
+ // CD releases store AVI headers as sums of the original and replacement.
+ while (codebook.read(entry, sizeof(entry)) == sizeof(entry)) {
+ if (memcmp(entry + 1024, _data.data(), 1024))
+ continue;
+ for (uint i = 0; i < 1024; ++i)
+ _data[i] = entry[i] - entry[1024 + i];
+ found = true;
+ break;
+ }
}
if (!found)
return false;
}
- if (READ_BE_UINT32(_data.data()) != MKTAG('R', 'I', 'F', 'F') ||
- READ_BE_UINT32(_data.data() + 8) != MKTAG('A', 'V', 'I', ' '))
+ if ((READ_BE_UINT32(_data.data()) >> 8) == MKTAG(0, 'B', 'I', 'K')) {
+#ifdef USE_BINK
+ _decoder.reset(new Video::BinkDecoder());
+#else
+ warning("Runaway: this release requires Bink video support");
return false;
- if (!_decoder.loadStream(new Common::MemoryReadStream(_data.data(), _data.size())) ||
- _decoder.getAudioTrackCount() || !_decoder.getFrameCount()) {
+#endif
+ } else if (READ_BE_UINT32(_data.data()) == MKTAG('R', 'I', 'F', 'F') &&
+ READ_BE_UINT32(_data.data() + 8) == MKTAG('A', 'V', 'I', ' ')) {
+ _decoder.reset(new Video::AVIDecoder());
+ } else {
+ return false;
+ }
+ if (!_decoder->loadStream(new Common::MemoryReadStream(_data.data(), _data.size())) ||
+ _decoder->getAudioTrackCount() || !_decoder->getFrameCount()) {
close();
return false;
}
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
- if (!_decoder.setOutputPixelFormat(format) || !decodeToFrame(0)) {
+ if (!_decoder->setOutputPixelFormat(format) || !decodeToFrame(0)) {
close();
return false;
}
@@ -75,43 +166,45 @@ bool RunawayVideo::load(const char *name) {
}
void RunawayVideo::close() {
- _decoder.close();
+ _decoder.reset();
_frame = nullptr;
_data.clear();
}
uint RunawayVideo::frameAtTime(uint32 milliseconds) const {
- const Audio::Timestamp duration = _decoder.getDuration();
+ if (!_decoder)
+ return 0;
+ const Audio::Timestamp duration = _decoder->getDuration();
const uint frames = duration.totalNumberOfFrames();
return frames ? (uint64)milliseconds * frameCount() * duration.framerate() / (1000ULL * frames) : 0;
}
bool RunawayVideo::seekToFrame(uint frame) {
- if (frame >= _decoder.getFrameCount())
+ if (!_decoder || frame >= _decoder->getFrameCount())
return false;
- if (_decoder.getCurFrame() != (int)frame) {
+ if (_decoder->getCurFrame() != (int)frame) {
_frame = nullptr;
- if (!_decoder.seekToFrame(frame))
+ if (!_decoder->seekToFrame(frame))
return false;
}
return decodeToFrame(frame);
}
bool RunawayVideo::decodeToFrame(uint frame) {
- if (frame >= _decoder.getFrameCount())
+ if (!_decoder || frame >= _decoder->getFrameCount())
return false;
- if (_decoder.getCurFrame() > (int)frame)
+ if (_decoder->getCurFrame() > (int)frame)
return seekToFrame(frame);
- while (_decoder.getCurFrame() < (int)frame && !_decoder.endOfVideo()) {
- const Graphics::Surface *decoded = _decoder.decodeNextFrame();
+ while (_decoder->getCurFrame() < (int)frame && !_decoder->endOfVideo()) {
+ const Graphics::Surface *decoded = _decoder->decodeNextFrame();
if (decoded)
_frame = decoded;
else {
- warning("Runaway: unable to decode video frame %d", _decoder.getCurFrame());
+ warning("Runaway: unable to decode video frame %d", _decoder->getCurFrame());
return false;
}
}
- return _frame != nullptr && _decoder.getCurFrame() == (int)frame;
+ return _frame != nullptr && _decoder->getCurFrame() == (int)frame;
}
void RunawayVideo::draw(Graphics::ManagedSurface &surface, const Common::Rect &destination) const {
@@ -119,4 +212,68 @@ void RunawayVideo::draw(Graphics::ManagedSurface &surface, const Common::Rect &d
surface.blitFrom(*_frame, Common::Rect(_frame->w, _frame->h), destination);
}
+void RunawayVideo::drawRegion(Graphics::ManagedSurface &surface, const Common::Rect &source, const Common::Rect &destination) const {
+ if (_frame && Common::Rect(_frame->w, _frame->h).contains(source))
+ surface.blitFrom(*_frame, source, destination);
+}
+
+bool RunawayFilmPortrait::load(char chapter, uint movie) {
+ if (_loaded && _chapter == chapter && _movie == movie)
+ return true;
+ _chapter = chapter;
+ _movie = movie;
+ _video.close();
+ _faces.clear();
+ _loadedPortrait = -1;
+ const Common::String name = Common::String::format("DATAV%c%02u.000", chapter, movie);
+ if (Common::File::exists(Common::Path(name)))
+ _loaded = _video.load(name.c_str());
+ else
+ _loaded = _archive.open(Common::Path(Common::String::format("DATAV%c%02u.002", chapter, movie)), 40);
+ return _loaded;
+}
+
+bool RunawayFilmPortrait::draw(Graphics::ManagedSurface &surface, const Common::Rect &destination, uint portrait, uint mouth) {
+ if (_video.frameCount()) {
+ if (_loadedPortrait != (int)portrait) {
+ const FilmOverlay *overlay = nullptr;
+ for (uint i = 0; i < ARRAYSIZE(kFilmOverlays); ++i) {
+ if (kFilmOverlays[i].chapter == _chapter && kFilmOverlays[i].movie == _movie && kFilmOverlays[i].portrait == portrait)
+ overlay = &kFilmOverlays[i];
+ }
+ if (!overlay)
+ return false;
+ _faceRect = Common::Rect(overlay->left, overlay->top, overlay->right, overlay->bottom);
+ _faces.resize(overlay->count);
+ for (uint i = 0; i < _faces.size(); ++i) {
+ if (!_video.decodeToFrame(overlay->first + i))
+ return false;
+ _faces[i].create(_faceRect.width(), _faceRect.height(), surface.format);
+ _video.drawRegion(_faces[i], _faceRect, Common::Rect(_faceRect.width(), _faceRect.height()));
+ }
+ _loadedPortrait = portrait;
+ }
+ const Common::Rect target(destination.left + _faceRect.left * destination.width() / _video.width(),
+ destination.top + _faceRect.top * destination.height() / _video.height(),
+ destination.left + _faceRect.right * destination.width() / _video.width(),
+ destination.top + _faceRect.bottom * destination.height() / _video.height());
+ surface.blitFrom(_faces[mouth % _faces.size()], Common::Rect(_faceRect.width(), _faceRect.height()), target);
+ return true;
+ }
+ if (_loadedPortrait != (int)portrait) {
+ Common::Array<byte> patch;
+ const bool phone = _chapter == 'D' && _movie == 8;
+ _portrait.create(phone ? 288 : 512, phone ? 288 : 300, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
+ _talking.create(_portrait.w, _portrait.h, _portrait.format);
+ if (!_archive.readVariableChunk(portrait * 2, patch) || !applyRunawayPatch(patch, _portrait) ||
+ !_mouth.load(_archive, portrait * 2 + 1, 12))
+ return false;
+ _loadedPortrait = portrait;
+ }
+ _talking.blitFrom(_portrait);
+ _mouth.draw(_talking, mouth, 0, 0);
+ surface.blitFrom(_talking, Common::Rect(_talking.w, _talking.h), destination);
+ return true;
+}
+
} // namespace Hollywood
diff --git a/engines/hollywood/runaway/video.h b/engines/hollywood/runaway/video.h
index 2e72e507bd1..f4b1108143b 100644
--- a/engines/hollywood/runaway/video.h
+++ b/engines/hollywood/runaway/video.h
@@ -23,12 +23,14 @@
#define HOLLYWOOD_RUNAWAY_VIDEO_H
#include "common/array.h"
-#include "graphics/managed_surface.h"
-#include "video/avi_decoder.h"
+#include "common/ptr.h"
+#include "hollywood/resource.h"
+#include "hollywood/runaway/graphics.h"
+#include "video/video_decoder.h"
namespace Hollywood {
-// Silent AVI clips are advanced by the engine clock so menu pauses also
+// Silent AVI/Bink clips are advanced by the engine clock so menu pauses also
// freeze frame callbacks and the separately stored room sound effects.
class RunawayVideo {
public:
@@ -36,16 +38,38 @@ public:
void close();
bool decodeToFrame(uint frame);
bool seekToFrame(uint frame);
- uint frameCount() const { return _decoder.getFrameCount(); }
+ uint width() const { return _frame ? _frame->w : 0; }
+ uint height() const { return _frame ? _frame->h : 0; }
+ uint frameCount() const { return _decoder ? _decoder->getFrameCount() : 0; }
uint frameAtTime(uint32 milliseconds) const;
void draw(Graphics::ManagedSurface &surface, const Common::Rect &destination) const;
+ void drawRegion(Graphics::ManagedSurface &surface, const Common::Rect &source, const Common::Rect &destination) const;
private:
Common::Array<byte> _data;
- Video::AVIDecoder _decoder;
+ Common::ScopedPtr<Video::VideoDecoder> _decoder;
const Graphics::Surface *_frame = nullptr;
};
+// The CD stores patch/mouth pairs; GOG stores the same poses as Bink frames.
+class RunawayFilmPortrait {
+public:
+ bool load(char chapter, uint movie);
+ bool draw(Graphics::ManagedSurface &surface, const Common::Rect &destination, uint portrait, uint mouth);
+
+private:
+ RunawayVideo _video;
+ ChunkArchive _archive;
+ RunawayAnimation _mouth;
+ Graphics::ManagedSurface _portrait, _talking;
+ Common::Array<Graphics::ManagedSurface> _faces;
+ Common::Rect _faceRect;
+ bool _loaded = false;
+ int _loadedPortrait = -1;
+ char _chapter = 'B';
+ uint _movie = 0;
+};
+
} // namespace Hollywood
#endif
Commit: 834f7b6e4ad9eb7b5c20e2e1997633f1242eb0ee
https://github.com/scummvm/scummvm/commit/834f7b6e4ad9eb7b5c20e2e1997633f1242eb0ee
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: better code to skip cutscenes
Changed paths:
engines/hollywood/runaway/font.cpp
engines/hollywood/runaway/sequence.cpp
engines/hollywood/runaway/sequence.h
engines/hollywood/runaway/video.cpp
diff --git a/engines/hollywood/runaway/font.cpp b/engines/hollywood/runaway/font.cpp
index 6b4a8756957..d9bac892f54 100644
--- a/engines/hollywood/runaway/font.cpp
+++ b/engines/hollywood/runaway/font.cpp
@@ -60,7 +60,8 @@ bool RunawayFont::load(bool menuFont, bool museum) {
return false;
} else if (!readRunawayGlobalChunk(menuFont ? 148 : 125, _pixels) ||
!readRunawayGlobalChunk(menuFont ? 149 : 126, metrics) ||
- (metrics.size() != 119 * 5 && metrics.size() != 150 * 5 && metrics.size() != 156 * 5 && metrics.size() != 161 * 5)) {
+ (metrics.size() != 119 * 5 && metrics.size() != 150 * 5 && metrics.size() != 156 * 5 &&
+ metrics.size() != 161 * 5 && metrics.size() != 181 * 5)) {
return false;
}
_glyphs.resize(metrics.size() / 5);
@@ -77,12 +78,12 @@ bool RunawayFont::load(bool menuFont, bool museum) {
}
memcpy(_glyphMap, kGlyphMap, sizeof(_glyphMap));
_missingGlyph = _glyphs.size() <= 119 ? 255 : _glyphs.size() - 1;
- // English retail's table at 0x5a51f0 retains the DOS character mapping,
- // moving only the missing-character box to the end of its larger font.
- if (_glyphs.size() == 161) {
+ // English CD and GOG releases retain the DOS character mapping, moving
+ // only the missing-character box to the end of their larger fonts.
+ if (_glyphs.size() == 161 || _glyphs.size() == 181) {
for (uint i = 0; i < ARRAYSIZE(_glyphMap); ++i) {
if (_glyphMap[i] == 149)
- _glyphMap[i] = 160;
+ _glyphMap[i] = _missingGlyph;
}
}
// Museum and Spanish tables use the first 117 and 119 glyphs respectively,
diff --git a/engines/hollywood/runaway/sequence.cpp b/engines/hollywood/runaway/sequence.cpp
index b6c291f59c7..2784907dec1 100644
--- a/engines/hollywood/runaway/sequence.cpp
+++ b/engines/hollywood/runaway/sequence.cpp
@@ -40,6 +40,7 @@ void RunawaySequence::start(const Command *commands, const SceneTextStore &text,
_commands = commands;
_index = 0;
_entered = _showPortrait = false;
+ _skipFilm = false;
_now = _started = now;
update(now);
}
@@ -90,10 +91,15 @@ void RunawaySequence::nextLine() {
void RunawaySequence::update(uint32 now) {
_now = now;
- if (!_subtitle.empty() && (int32)(now - _deadline) >= 0)
+ if (!_skipFilm && !_subtitle.empty() && (int32)(now - _deadline) >= 0)
nextLine();
while (active()) {
const Command &command = _commands[_index];
+ // Preserve the final music cue and normal cleanup when skipping a film.
+ if (_skipFilm && command.operation != kMusic && command.operation != kEnd) {
+ advance();
+ continue;
+ }
if (!_entered) {
_entered = true;
switch (command.operation) {
@@ -212,9 +218,9 @@ void RunawaySequence::skip() {
}
const Command &command = _commands[_index];
if (command.operation == kPlay) {
- if (!_video.seekToFrame(command.b))
- error("Cannot decode Runaway film frame %u", command.b);
- advance();
+ // Bink movies may have only one keyframe; seeking to the end decodes
+ // the entire movie synchronously, blocking input while it catches up.
+ _skipFilm = true;
} else if (command.operation == kDelay || command.operation == kWaitEffect) {
advance();
}
diff --git a/engines/hollywood/runaway/sequence.h b/engines/hollywood/runaway/sequence.h
index 944e9929f3b..d3a3352ac1a 100644
--- a/engines/hollywood/runaway/sequence.h
+++ b/engines/hollywood/runaway/sequence.h
@@ -90,6 +90,7 @@ private:
uint32 _now = 0, _started = 0, _deadline = 0;
uint32 _repeatAt = 0;
bool _entered = false, _showPortrait = false, _silentPortrait = false;
+ bool _skipFilm = false;
struct Line {
Common::U32String text;
uint16 sample;
diff --git a/engines/hollywood/runaway/video.cpp b/engines/hollywood/runaway/video.cpp
index 6b548816c73..c4a84bb9bc5 100644
--- a/engines/hollywood/runaway/video.cpp
+++ b/engines/hollywood/runaway/video.cpp
@@ -182,7 +182,10 @@ uint RunawayVideo::frameAtTime(uint32 milliseconds) const {
bool RunawayVideo::seekToFrame(uint frame) {
if (!_decoder || frame >= _decoder->getFrameCount())
return false;
- if (_decoder->getCurFrame() != (int)frame) {
+ // Keep Bink's decoded reference frames for forward seeks. The GOG movies
+ // have only an initial keyframe, so seeking would decode them from scratch.
+ if (_decoder->getCurFrame() != (int)frame &&
+ (_decoder->getCurFrame() > (int)frame || READ_BE_UINT32(_data.data()) == MKTAG('R', 'I', 'F', 'F'))) {
_frame = nullptr;
if (!_decoder->seekToFrame(frame))
return false;
Commit: 152ba94a6a95cd1b6f8416117286011e11a2628f
https://github.com/scummvm/scummvm/commit/152ba94a6a95cd1b6f8416117286011e11a2628f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: refactored speech and walk code into proper classes
Changed paths:
A engines/hollywood/runaway/speech.cpp
A engines/hollywood/runaway/speech.h
engines/hollywood/module.mk
engines/hollywood/runaway/navigation.cpp
engines/hollywood/runaway/navigation.h
engines/hollywood/runaway/presentation.cpp
engines/hollywood/runaway/presentation.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene2010.cpp
engines/hollywood/runaway/scene2010.h
engines/hollywood/runaway/scene2020.cpp
engines/hollywood/runaway/scene2080.cpp
engines/hollywood/runaway/scene4010.cpp
engines/hollywood/runaway/scene4060.cpp
engines/hollywood/runaway/scene5030.cpp
engines/hollywood/runaway/scene5030.h
engines/hollywood/runaway/sequence.cpp
engines/hollywood/runaway/sequence.h
diff --git a/engines/hollywood/module.mk b/engines/hollywood/module.mk
index 905e5291d7b..748f691db6e 100644
--- a/engines/hollywood/module.mk
+++ b/engines/hollywood/module.mk
@@ -164,6 +164,7 @@ MODULE_OBJS = \
runaway/scene4140.o \
runaway/scene5030.o \
runaway/sequence.o \
+ runaway/speech.o \
runaway/strings.o \
runaway/ui.o \
runaway/video.o
diff --git a/engines/hollywood/runaway/navigation.cpp b/engines/hollywood/runaway/navigation.cpp
index 273da35b469..ce35bf99bc7 100644
--- a/engines/hollywood/runaway/navigation.cpp
+++ b/engines/hollywood/runaway/navigation.cpp
@@ -92,4 +92,49 @@ void RunawayWalkMap::findPath(Common::Point position, Common::Point target, Comm
target.x, target.y, closest % _width, closest / _width, path.size());
}
+void RunawayWalkPath::reset(Common::Point position) {
+ clear();
+ _x = position.x;
+ _y = position.y;
+}
+
+void RunawayWalkPath::findPath(const RunawayWalkMap &map, Common::Point target) {
+ map.findPath(position(), target, _points);
+ _index = 0;
+}
+
+void RunawayWalkPath::setTarget(Common::Point target) {
+ clear();
+ _points.push_back(target);
+}
+
+bool RunawayWalkPath::advance(float travel, Common::Point &actorPosition, byte &facing) {
+ const float previousX = _x, previousY = _y;
+ while (travel > 0 && active()) {
+ const Common::Point target = _points[_index];
+ const float dx = target.x - _x, dy = target.y - _y;
+ const float distance = sqrtf(dx * dx + dy * dy);
+ if (distance > 0) {
+ if (ABS(dx) > ABS(dy) * 2)
+ facing = dx > 0 ? 2 : 6;
+ else if (ABS(dy) > ABS(dx) * 2)
+ facing = dy > 0 ? 4 : 0;
+ else
+ facing = dy > 0 ? (dx > 0 ? 3 : 5) : (dx > 0 ? 1 : 7);
+ }
+ if (distance <= travel) {
+ _x = target.x;
+ _y = target.y;
+ travel -= distance;
+ ++_index;
+ } else {
+ _x += dx * travel / distance;
+ _y += dy * travel / distance;
+ travel = 0;
+ }
+ }
+ actorPosition = position();
+ return _x != previousX || _y != previousY;
+}
+
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/navigation.h b/engines/hollywood/runaway/navigation.h
index 0d0f892ee6a..91816f81600 100644
--- a/engines/hollywood/runaway/navigation.h
+++ b/engines/hollywood/runaway/navigation.h
@@ -40,6 +40,24 @@ private:
const Common::Array<byte> &_mask, &_maps;
};
+class RunawayWalkPath {
+public:
+ explicit RunawayWalkPath(Common::Point position = Common::Point()) : _x(position.x), _y(position.y) {}
+ void reset(Common::Point position);
+ void clear() { _points.clear(); _index = 0; }
+ void findPath(const RunawayWalkMap &map, Common::Point target);
+ void setTarget(Common::Point target);
+ // Returns whether the fractional position changed, for footstep timing.
+ bool advance(float travel, Common::Point &position, byte &facing);
+ bool active() const { return _index < _points.size(); }
+
+private:
+ Common::Point position() const { return Common::Point((int)(_x + 0.5f), (int)(_y + 0.5f)); }
+ Common::Array<Common::Point> _points;
+ uint _index = 0;
+ float _x, _y;
+};
+
} // End of namespace Hollywood
#endif // HOLLYWOOD_RUNAWAY_NAVIGATION_H
diff --git a/engines/hollywood/runaway/presentation.cpp b/engines/hollywood/runaway/presentation.cpp
index 3feed696fd5..7a3fbbaa33b 100644
--- a/engines/hollywood/runaway/presentation.cpp
+++ b/engines/hollywood/runaway/presentation.cpp
@@ -127,20 +127,17 @@ void RunawayInterrogation::start(uint32 now) {
}
void RunawayInterrogation::stop() {
- _audio.stopSpeech();
+ _speech.stop();
_audio.stopEffect();
- _lipSync.stop();
- _subtitle.clear();
_row = 0;
_phrase = _phraseCount;
}
void RunawayInterrogation::nextPhrase() {
_row = 0;
- _lipSync.stop();
- _subtitle.clear();
+ _speech.reset();
if (finished()) {
- _audio.stopSpeech();
+ _speech.stop();
_audio.stopEffect();
return;
}
@@ -157,14 +154,11 @@ void RunawayInterrogation::nextPhrase() {
}
void RunawayInterrogation::showSpeechRow() {
- _subtitle = Common::U32String(_text.largeTextRecord(_row), Common::kDos850);
- const uint32 duration = _audio.playSpeech(_sample);
- _lipSync.start(_subtitle, _now, duration, _random);
+ _speech.start(Common::U32String(_text.largeTextRecord(_row), Common::kDos850), _sample, false, _now);
const uint actor = kInterrogationSpeakerActor[_speakers[_phrase]];
- _frames[actor] = kInterrogationMouthBase[actor] + _lipSync.frame(_now);
+ _frames[actor] = kInterrogationMouthBase[actor] + _speech.frame(_now);
_idle[actor] = true;
_lastTick[actor] = _now;
- _deadline = _now + (duration ? MAX<uint>(1000, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
}
void RunawayInterrogation::skipSpeech() {
@@ -172,7 +166,7 @@ void RunawayInterrogation::skipSpeech() {
return;
const uint actor = kInterrogationSpeakerActor[_speakers[_phrase]];
_frames[actor] = kInterrogationMouthBase[actor];
- _audio.stopSpeech();
+ _speech.stop();
if (_row < _lastRow) {
++_row;
++_sample;
@@ -185,7 +179,7 @@ void RunawayInterrogation::skipSpeech() {
void RunawayInterrogation::update(uint32 now) {
_now = now;
- if (speaking() && !_audio.speechPlaying() && (int32)(now - _deadline) >= 0)
+ if (speaking() && !_audio.speechPlaying() && _speech.finished(now))
skipSpeech();
if (finished())
return;
@@ -195,7 +189,7 @@ void RunawayInterrogation::update(uint32 now) {
if (i == speaker) {
// Native 0x43c5a0/0x43c700/0x43c860 share the text-driven
// mouth sequence. Gina's table maps virtual 70..81 to 67..78.
- _frames[i] = kInterrogationMouthBase[i] + _lipSync.frame(now);
+ _frames[i] = kInterrogationMouthBase[i] + _speech.frame(now);
_idle[i] = true;
_lastTick[i] = now;
continue;
diff --git a/engines/hollywood/runaway/presentation.h b/engines/hollywood/runaway/presentation.h
index f06eba9f3e2..a627434a967 100644
--- a/engines/hollywood/runaway/presentation.h
+++ b/engines/hollywood/runaway/presentation.h
@@ -25,9 +25,9 @@
#include "common/random.h"
#include "common/language.h"
#include "common/ustr.h"
-#include "hollywood/runaway/animation.h"
#include "hollywood/runaway/audio.h"
#include "hollywood/runaway/graphics.h"
+#include "hollywood/runaway/speech.h"
#include "hollywood/scene_text_store.h"
namespace Hollywood {
@@ -49,7 +49,8 @@ private:
class RunawayInterrogation {
public:
- explicit RunawayInterrogation(Audio::Mixer *mixer) : _audio(mixer), _random("runawayInterrogation") {}
+ explicit RunawayInterrogation(Audio::Mixer *mixer) :
+ _audio(mixer), _random("runawayInterrogation"), _speech(_audio, _random, RunawaySpeech::kTextLipSync) {}
bool load();
void start(uint32 now);
void update(uint32 now);
@@ -58,14 +59,14 @@ public:
void draw(Graphics::ManagedSurface &screen) const;
bool finished() const { return _phrase >= _phraseCount; }
bool speaking() const { return _row != 0; }
- const Common::U32String &subtitle() const { return _subtitle; }
+ const Common::U32String &subtitle() const { return _speech.subtitle(); }
private:
void nextPhrase();
void showSpeechRow();
RunawayAudio _audio;
Common::RandomSource _random;
- RunawayLipSync _lipSync;
+ RunawaySpeech _speech;
SceneTextStore _text;
Graphics::ManagedSurface _background;
RunawayAnimation _actors[3];
@@ -73,8 +74,7 @@ private:
bool _idle[3] = {};
byte _speakers[4] = {}, _phrase = 0, _phraseCount = 0;
uint16 _row = 0, _lastRow = 0, _sample = 0;
- uint32 _now = 0, _deadline = 0, _lastTick[3] = {};
- Common::U32String _subtitle;
+ uint32 _now = 0, _lastTick[3] = {};
};
class RunawayEnding {
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index 1afec638602..eab218fa9cf 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -29,8 +29,6 @@
#include "hollywood/runaway/scene_data.h"
#include "hollywood/runaway/strings.h"
-#include <math.h>
-
namespace Hollywood {
namespace {
@@ -86,7 +84,8 @@ const RunawayRoom *findRunawayRoom(uint16 number) {
}
RunawayRoomScene::RunawayRoomScene(RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings, RunawayGameType game) :
- _audio(audio), _sequence(audio), _inventory(inventory), _strings(strings), _game(game), _random("runaway") {}
+ _audio(audio), _sequence(audio), _inventory(inventory), _strings(strings), _game(game), _random("runaway"),
+ _speech(audio, _random, game == kRunawayFullGame ? RunawaySpeech::kRecordedLipSync : RunawaySpeech::kNoLipSync) {}
bool RunawayRoomScene::load(uint16 entryScene) {
const RunawayRoom *room = findRoom(entryScene);
@@ -193,8 +192,7 @@ bool RunawayRoomScene::restoreState(const RunawaySaveState &state, uint32 now, b
return false;
updateMaps();
_position = Common::Point(state.x, state.y);
- _x = state.x;
- _y = state.y;
+ _walkPath.reset(_position);
_facing = state.facing;
_keyCount = entering ? 0 : state.keyCount;
_now = _lastUpdate = now;
@@ -221,16 +219,14 @@ bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte fac
return false;
_room = number;
_position = position;
- _x = position.x;
- _y = position.y;
+ _walkPath.reset(position);
_facing = facing;
- _path.clear();
- _pathIndex = _walkElapsed = 0;
+ _walkElapsed = 0;
_pendingHotspot = _pendingItem = 0;
_pendingAction = 0;
_lines.clear();
_lineIndex = 0;
- _subtitle.clear();
+ _speech.reset();
_caption.clear();
_ambient = RunawayAnimation();
_overlay = RunawayAnimation();
@@ -407,15 +403,13 @@ Common::U32String RunawayRoomScene::actionCaption(byte id, RunawayVerb verb, byt
}
void RunawayRoomScene::walkTo(Common::Point target, byte facing, bool scripted) {
- if (scripted) {
- _path.clear();
- _path.push_back(target);
- } else {
- RunawayWalkMap(_background.w, _background.h, _mask, _maps).findPath(_position, target, _path);
- }
+ if (scripted)
+ _walkPath.setTarget(target);
+ else
+ _walkPath.findPath(RunawayWalkMap(_background.w, _background.h, _mask, _maps), target);
_arrivalFacing = facing;
- _pathIndex = _walkElapsed = _lastFootstep = 0;
- if (_path.empty())
+ _walkElapsed = _lastFootstep = 0;
+ if (!_walkPath.active())
arrive();
}
@@ -477,8 +471,7 @@ void RunawayRoomScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
walkTo(position);
}
else {
- _path.clear();
- _pathIndex = 0;
+ _walkPath.clear();
arrive();
}
} else {
@@ -488,13 +481,9 @@ void RunawayRoomScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
void RunawayRoomScene::showLine() {
const SpeechLine &line = _lines[_lineIndex];
- _subtitle = line.text;
- const uint32 duration = line.sample ? _audio.playSpeech(line.sample, line.global) : 0;
- _subtitleUntil = _now + (duration ? MAX<uint>(1000, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
- if (_game == kRunawayFullGame) {
+ _speech.start(line.text, line.sample, line.global, _now);
+ if (_game == kRunawayFullGame)
_idleHead.reset(_now);
- _lipSync.start(_subtitle, _now, duration, _random, line.sample);
- }
}
void RunawayRoomScene::say(uint16 cue, byte variation, bool global, byte speaker) {
@@ -519,8 +508,7 @@ void RunawayRoomScene::say(uint16 cue, byte variation, bool global, byte speaker
}
void RunawayRoomScene::sayInventory(const RunawayInventory::Reply &reply) {
- _path.clear();
- _pathIndex = 0;
+ _walkPath.clear();
_pendingHotspot = 0;
_caption.clear();
if (_game == kRunawayFullGame && (museumChapter() ? sayMuseumInventory(reply) : sayHospitalInventory(reply)))
@@ -535,14 +523,12 @@ void RunawayRoomScene::skipSpeech() {
}
if (!speaking())
return;
- _audio.stopSpeech();
- _lipSync.stop();
+ _speech.stop();
if (++_lineIndex < _lines.size()) {
showLine();
} else {
_lines.clear();
_lineIndex = 0;
- _subtitle.clear();
_caption.clear();
}
}
@@ -683,7 +669,7 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
}
if (_pressedKey && (int32)(now - _keyUntil) >= 0)
_pressedKey = 0;
- if (speaking() && (int32)(now - _subtitleUntil) >= 0)
+ if (speaking() && _speech.finished(now))
skipSpeech();
if (_room == kHospitalBedroom)
update2020();
@@ -710,32 +696,8 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
}
if (inventoryOpen || _room == kMuseumKeypad)
return;
- if (_pathIndex < _path.size() && !speaking()) {
- float travel = elapsed * 0.18f * actorHeight() / 455;
- while (travel > 0 && _pathIndex < _path.size()) {
- const Common::Point target = _path[_pathIndex];
- const float dx = target.x - _x, dy = target.y - _y;
- const float distance = sqrtf(dx * dx + dy * dy);
- if (distance > 0) {
- if (ABS(dx) > ABS(dy) * 2)
- _facing = dx > 0 ? 2 : 6;
- else if (ABS(dy) > ABS(dx) * 2)
- _facing = dy > 0 ? 4 : 0;
- else
- _facing = dy > 0 ? (dx > 0 ? 3 : 5) : (dx > 0 ? 1 : 7);
- }
- if (distance <= travel) {
- _x = target.x;
- _y = target.y;
- travel -= distance;
- ++_pathIndex;
- } else {
- _x += dx * travel / distance;
- _y += dy * travel / distance;
- travel = 0;
- }
- }
- _position = Common::Point((int)(_x + 0.5f), (int)(_y + 0.5f));
+ if (_walkPath.active() && !speaking()) {
+ _walkPath.advance(elapsed * 0.18f * actorHeight() / 455, _position, _facing);
_walkElapsed += elapsed;
if (_game == kRunawayFullGame && (!_lastFootstep || _walkElapsed - _lastFootstep >= 360)) {
const byte surface = _maps[1280 + _mask[_position.y * _background.w + _position.x]];
@@ -744,14 +706,14 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
_audio.playFootstep(surface, _random.getRandomBit(), volume);
_lastFootstep = _walkElapsed;
}
- if (_pathIndex == _path.size())
+ if (!_walkPath.active())
arrive();
}
- const bool walking = _pathIndex < _path.size();
+ const bool walking = _walkPath.active();
int headFrame = -1;
if (_game == kRunawayFullGame) {
const bool idle = !walking && !busy();
- _idleHead.update(now, idle, _lipSync.frameDuration(), _random);
+ _idleHead.update(now, idle, _speech.frameDuration(), _random);
if (!walking)
headFrame = speaking() && !speaker() ? speechFrame() : idle ? _idleHead.frame() : -1;
}
@@ -881,7 +843,7 @@ void RunawayRoomScene::setRoomAnimationOverlay(uint chunk, uint frames, const by
void RunawayRoomScene::updateRoomAnimation() {
if (!_roomAction || _actionFrames.empty())
return;
- if (speaking() || _pathIndex < _path.size()) {
+ if (speaking() || _walkPath.active()) {
_actionStarted = _now;
return;
}
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index 947d9b78934..6eea0d33086 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -27,8 +27,10 @@
#include "hollywood/runaway/audio.h"
#include "hollywood/runaway/graphics.h"
#include "hollywood/runaway/inventory.h"
+#include "hollywood/runaway/navigation.h"
#include "hollywood/runaway/saveload.h"
#include "hollywood/runaway/sequence.h"
+#include "hollywood/runaway/speech.h"
#include "hollywood/scene_text_store.h"
namespace Hollywood {
@@ -98,10 +100,10 @@ public:
byte hotspotAt(Common::Point mouse) const override;
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _caption; }
- const Common::U32String &subtitle() const override { return _sequence.active() ? _sequence.subtitle() : _subtitle; }
+ const Common::U32String &subtitle() const override { return _sequence.active() ? _sequence.subtitle() : _speech.subtitle(); }
bool busy() const override { return _sequence.active() || _pendingHotspot != 0 || _transition.scene || _hospitalExit.scene || _arrivalFacing != 0xff || _hospitalEntryStep || _roomAction || _conversation || speaking(); }
bool speaking() const override { return !subtitle().empty(); }
- byte speechFrame() const override { return _sequence.active() ? _sequence.speechFrame() : _lipSync.frame(_now); }
+ byte speechFrame() const override { return _sequence.active() ? _sequence.speechFrame() : _speech.frame(_now); }
bool playingVideo() const override { return _sequence.active(); }
void skipVideo() override { _sequence.skip(); }
bool escaped() const override { return _chapterComplete; }
@@ -109,7 +111,7 @@ public:
void sayInventory(const RunawayInventory::Reply &reply) override;
const Common::Array<Common::U32String> &dialogueChoices() const override { return _choices; }
void chooseDialogue(uint choice) override;
- bool canSave() const override { return !busy() && _pathIndex == _path.size() && !_pressedKey; }
+ bool canSave() const override { return !busy() && !_walkPath.active() && !_pressedKey; }
void captureState(RunawaySaveState &state) const override;
bool restoreState(const RunawaySaveState &state, uint32 now, bool entering = false) override;
void setOptions(bool antialias, bool fastScrolling) override { _antialias = antialias; _fastScrolling = fastScrolling; }
@@ -142,7 +144,7 @@ private:
void beginRoomAnimationRange(uint16 action, uint chunk, uint frames, uint first, uint last, bool hideActor = true);
void holdRoomAnimation(uint16 action, uint chunk, uint frames, uint frame, bool hideActor = true);
void setRoomAnimationOverlay(uint chunk, uint frames, const byte *order, uint count);
- bool drawingRoomAnimation() const { return _roomAction && !_actionFrames.empty() && (_actionHoldSpeech || !speaking()) && _pathIndex == _path.size(); }
+ bool drawingRoomAnimation() const { return _roomAction && !_actionFrames.empty() && (_actionHoldSpeech || !speaking()) && !_walkPath.active(); }
void updateRoomAnimation();
void finishHospitalAnimation(uint16 action);
float actorHeight() const;
@@ -243,7 +245,7 @@ private:
const RunawayStrings &_strings;
const RunawayGameType _game;
Common::RandomSource _random;
- RunawayLipSync _lipSync;
+ RunawaySpeech _speech;
RunawayIdleHead _idleHead;
ChunkArchive _archive;
SceneTextStore _text;
@@ -255,7 +257,7 @@ private:
Common::Array<byte> _mask, _originalMaps, _maps;
Common::Array<Common::Rect> _foreground[5];
Common::Array<byte> _keyPatches[25];
- Common::Array<Common::Point> _path;
+ RunawayWalkPath _walkPath;
struct SpeechLine {
Common::U32String text;
uint16 sample;
@@ -263,14 +265,13 @@ private:
byte speaker;
};
Common::Array<SpeechLine> _lines;
- Common::U32String _subtitle, _caption;
+ Common::U32String _caption;
Common::Point _position, _camera;
- uint _pathIndex = 0, _lineIndex = 0;
+ uint _lineIndex = 0;
uint16 _room = 0, _pendingAction = 0;
byte _facing = 3, _pendingHotspot = 0, _pendingItem = 0;
byte _arrivalFacing = 0xff;
- float _x = 0, _y = 0;
- uint32 _now = 0, _lastUpdate = 0, _walkElapsed = 0, _subtitleUntil = 0;
+ uint32 _now = 0, _lastUpdate = 0, _walkElapsed = 0;
bool _upperFloor = true, _antialias = true, _fastScrolling = true;
ObjectState _books = kUnexamined, _recorder = kUnexamined;
bool _moneyIdentified = false, _safeOpen = false;
diff --git a/engines/hollywood/runaway/scene2010.cpp b/engines/hollywood/runaway/scene2010.cpp
index f1c3b08c20f..682a462d638 100644
--- a/engines/hollywood/runaway/scene2010.cpp
+++ b/engines/hollywood/runaway/scene2010.cpp
@@ -96,9 +96,7 @@ void RunawayOpening::enter(Step step, uint32 now) {
_now = _started = now;
_events = 0;
_row = 0;
- _subtitle.clear();
- _lipSync.stop();
- _audio.stopSpeech();
+ _speech.stop();
switch (step) {
case kSitDown: _firstFrame = 0; _lastFrame = 20; _headBank = 0; break;
case kLeanForward: _firstFrame = 161; _lastFrame = 177; _headBank = 0; break;
@@ -231,23 +229,18 @@ void RunawayOpening::speak(uint16 cue, byte variation) {
}
void RunawayOpening::showLine() {
- _subtitle = Common::U32String(_text.largeTextRecord(_row), Common::kDos850);
// The framing narration belongs to DATAACA0, independently of chapter.
- const uint32 duration = _audio.playSpeech(_sample, _narrating);
- _lipSync.start(_subtitle, _now, duration, _random, _sample);
- _deadline = _now + (duration ? MAX<uint>(1000, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
+ _speech.start(Common::U32String(_text.largeTextRecord(_row), Common::kDos850), _sample, _narrating, _now);
}
void RunawayOpening::nextLine() {
- _audio.stopSpeech();
- _lipSync.stop();
+ _speech.stop();
if (_row < _lastRow) {
++_row;
++_sample;
showLine();
} else {
_row = 0;
- _subtitle.clear();
}
}
@@ -274,7 +267,7 @@ void RunawayOpening::update(uint32 now) {
_now = now;
if (finished())
return;
- if (speaking() && !_audio.speechPlaying() && (int32)(now - _deadline) >= 0)
+ if (speaking() && !_audio.speechPlaying() && _speech.finished(now))
nextLine();
const uint elapsed = now - _started;
switch (_step) {
@@ -422,7 +415,7 @@ void RunawayOpening::drawNarrator(Graphics::ManagedSurface &screen) {
screen.blitFrom(_narratorBackground, Common::Point(0, kRunawayViewportTop));
_narrator[0].draw(screen, _bodyFrame, 0, kRunawayViewportTop);
if (_headBank)
- _narrator[_headBank].draw(screen, _lipSync.frame(_now) % 6, 0, kRunawayViewportTop);
+ _narrator[_headBank].draw(screen, _speech.frame(_now) % 6, 0, kRunawayViewportTop);
if (_step == kMontage)
_video.draw(screen, Common::Rect(256, 232, 656, 466));
if (_step == kChapter || _step == kChapterGesture)
@@ -489,7 +482,7 @@ void RunawayOpening::drawFilm(Graphics::ManagedSurface &screen) {
if (_step == kStayAway || _step == kUnconscious || (_step >= kHospital && _step <= kReply)) {
const uint portrait = _step == kStayAway ? 0 : _step == kUnconscious ? 1 : 2;
// The other hitman speaks off screen; the visible man only blinks.
- const uint mouth = _step == kHitman ? ((_now - _started) % 2400 < 160 ? 6 : 0) : _lipSync.frame(_now);
+ const uint mouth = _step == kHitman ? ((_now - _started) % 2400 < 160 ? 6 : 0) : _speech.frame(_now);
if (!_portraits.draw(screen, viewport, portrait, mouth))
_failed = true;
}
diff --git a/engines/hollywood/runaway/scene2010.h b/engines/hollywood/runaway/scene2010.h
index d230064588b..2b3c0c83dfa 100644
--- a/engines/hollywood/runaway/scene2010.h
+++ b/engines/hollywood/runaway/scene2010.h
@@ -23,9 +23,9 @@
#define HOLLYWOOD_RUNAWAY_SCENE2010_H
#include "common/random.h"
-#include "hollywood/runaway/animation.h"
#include "hollywood/runaway/audio.h"
#include "hollywood/runaway/graphics.h"
+#include "hollywood/runaway/speech.h"
#include "hollywood/runaway/video.h"
#include "hollywood/scene_text_store.h"
@@ -35,7 +35,7 @@ namespace Hollywood {
// All timing comes from the engine's pause-aware clock.
class RunawayOpening {
public:
- explicit RunawayOpening(RunawayAudio &audio) : _audio(audio), _random("runawayOpening") {}
+ explicit RunawayOpening(RunawayAudio &audio) : _audio(audio), _random("runawayOpening"), _speech(audio, _random) {}
bool load(byte chapter = 0);
void start(uint32 now);
void update(uint32 now);
@@ -43,7 +43,7 @@ public:
void draw(Graphics::ManagedSurface &screen);
bool finished() const { return _step == kFinished || _failed; }
bool failed() const { return _failed; }
- const Common::U32String &subtitle() const { return _subtitle; }
+ const Common::U32String &subtitle() const { return _speech.subtitle(); }
private:
enum Step {
@@ -69,7 +69,7 @@ private:
RunawayAudio &_audio;
Common::RandomSource _random;
SceneTextStore _text;
- RunawayLipSync _lipSync;
+ RunawaySpeech _speech;
RunawayVideo _video;
Graphics::ManagedSurface _narratorBackground, _city, _cityTitle;
RunawayFilmPortrait _portraits;
@@ -84,7 +84,6 @@ private:
bool _chapterOnly = false;
uint16 _row = 0, _lastRow = 0, _sample = 0;
bool _narrating = true, _themeStarted = false, _failed = false;
- Common::U32String _subtitle;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene2020.cpp b/engines/hollywood/runaway/scene2020.cpp
index f271607fcfb..2ffd869b6f5 100644
--- a/engines/hollywood/runaway/scene2020.cpp
+++ b/engines/hollywood/runaway/scene2020.cpp
@@ -537,7 +537,7 @@ float RunawayRoomScene::actorHeight2020() const {
}
void RunawayRoomScene::update2020() {
- if (_hospitalEntryStep && !speaking() && _pathIndex == _path.size()) {
+ if (_hospitalEntryStep && !speaking() && !_walkPath.active()) {
switch (_hospitalEntryStep++) {
case 1:
_facing = 4;
@@ -568,7 +568,7 @@ void RunawayRoomScene::update2020() {
break;
}
}
- if (!speaking() && _pathIndex == _path.size()) {
+ if (!speaking() && !_walkPath.active()) {
if (_roomAction == 340) {
if (!_actionStage) {
walkTo(Common::Point(531, 416), 3, true);
diff --git a/engines/hollywood/runaway/scene2080.cpp b/engines/hollywood/runaway/scene2080.cpp
index 4ffa7f76cd5..22013e1a990 100644
--- a/engines/hollywood/runaway/scene2080.cpp
+++ b/engines/hollywood/runaway/scene2080.cpp
@@ -140,7 +140,7 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute2080(uint16 action) {
}
void RunawayRoomScene::update2080() {
- if (!_hospital.attacked && _hospital.chartMoved && _hospital.decoy && _pathIndex == _path.size()) {
+ if (!_hospital.attacked && _hospital.chartMoved && _hospital.decoy && !_walkPath.active()) {
_hospital.attacked = 1;
_transition.scene = 2023;
_transition.position = Common::Point(1075, 534);
diff --git a/engines/hollywood/runaway/scene4010.cpp b/engines/hollywood/runaway/scene4010.cpp
index 19d84990e2a..c0fe1b8610f 100644
--- a/engines/hollywood/runaway/scene4010.cpp
+++ b/engines/hollywood/runaway/scene4010.cpp
@@ -157,7 +157,7 @@ void RunawayRoomScene::updateMuseum(uint elapsed, bool inventoryOpen) {
if (_sequence.active() || _transition.scene)
return;
updateConversation();
- if (_roomAction && _actionFrames.empty() && !speaking() && !_conversation && _pathIndex == _path.size()) {
+ if (_roomAction && _actionFrames.empty() && !speaking() && !_conversation && !_walkPath.active()) {
const uint16 action = _roomAction;
_roomAction = 0;
finishMuseumAnimation(action);
diff --git a/engines/hollywood/runaway/scene4060.cpp b/engines/hollywood/runaway/scene4060.cpp
index bfc9948efc4..8ed6647e2ab 100644
--- a/engines/hollywood/runaway/scene4060.cpp
+++ b/engines/hollywood/runaway/scene4060.cpp
@@ -149,8 +149,7 @@ void RunawayRoomScene::updateMaps4060() {
void RunawayRoomScene::changeFloor(bool upper, Common::Point position) {
_upperFloor = upper;
_position = position;
- _x = position.x;
- _y = position.y;
+ _walkPath.reset(position);
_facing = 3;
updateMaps();
updateCamera();
diff --git a/engines/hollywood/runaway/scene5030.cpp b/engines/hollywood/runaway/scene5030.cpp
index 09a9268b78a..746e8985a4c 100644
--- a/engines/hollywood/runaway/scene5030.cpp
+++ b/engines/hollywood/runaway/scene5030.cpp
@@ -210,8 +210,7 @@ bool RunawayScene5030::restoreState(const RunawaySaveState &state, uint32 now, b
_action = _afterSpeech = _afterWalk = kNone;
_pendingHotspot = _pendingItem = _pickupHotspot = 0;
_pendingVerb = kVerbWalk;
- _path.clear();
- _pathIndex = 0;
+ _walkPath.clear();
_committedCaption.clear();
_escaped = false;
setPosition(Common::Point(state.x, state.y), state.facing);
@@ -291,10 +290,9 @@ byte RunawayScene5030::hotspotAt(Common::Point mouse) const {
}
void RunawayScene5030::walkTo(Common::Point target) {
- RunawayWalkMap(kRoomWidth, kRoomHeight, _mask, _maps).findPath(_position, target, _path);
- _pathIndex = 0;
+ _walkPath.findPath(RunawayWalkMap(kRoomWidth, kRoomHeight, _mask, _maps), target);
_walkElapsed = _lastFootstep = 0;
- if (_path.empty())
+ if (!_walkPath.active())
arrive();
}
@@ -309,21 +307,16 @@ void RunawayScene5030::say(uint16 row) {
}
void RunawayScene5030::showSpeechRow() {
- _subtitle = Common::U32String(_text.largeTextRecord(_speechRow), Common::kDos850);
const uint16 sample = _globalSpeech ? _speechSample : _voiceSamples[_speechRow - 500];
- const uint32 duration = sample ? _audio.playSpeech(sample, _globalSpeech) : 0;
- _subtitleUntil = _now + (duration ? MAX<uint>(1000, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
+ _speech.start(Common::U32String(_text.largeTextRecord(_speechRow), Common::kDos850), sample, _globalSpeech, _now);
_idleHead.reset(_now);
- _lipSync.start(_subtitle, _now, duration, _random, _game == kRunawayFullGame ? sample : 0);
debugC(1, kDebugScene, "Runaway demo: dialogue row %u, voice %u, ends at row %u",
_speechRow, sample, _speechEnd);
}
void RunawayScene5030::stopSpeech() {
- _audio.stopSpeech();
+ _speech.stop();
_speechRow = _speechEnd = 0;
- _lipSync.stop();
- _subtitle.clear();
}
Common::U32String RunawayScene5030::actionCaption(byte id, RunawayVerb verb, byte item) const {
@@ -395,7 +388,7 @@ void RunawayScene5030::skipSpeech() {
}
if (!_speechRow)
return;
- _audio.stopSpeech();
+ _speech.stop();
if (_speechRow < _speechEnd) {
++_speechRow;
if (_globalSpeech)
@@ -407,8 +400,7 @@ void RunawayScene5030::skipSpeech() {
}
void RunawayScene5030::cancelWalk() {
- _path.clear();
- _pathIndex = 0;
+ _walkPath.clear();
_pendingHotspot = _pendingItem = 0;
_committedCaption.clear();
}
@@ -542,11 +534,8 @@ void RunawayScene5030::walkForAction(Common::Point target, byte facing, Action n
void RunawayScene5030::setPosition(Common::Point position, byte facing) {
_position = position;
- _x = position.x;
- _y = position.y;
+ _walkPath.reset(position);
_facing = facing;
- _path.clear();
- _pathIndex = 0;
}
void RunawayScene5030::arrive() {
@@ -850,7 +839,7 @@ void RunawayScene5030::update(uint32 now, int scrollDirection, bool inventoryOpe
const uint elapsed = MIN<uint>(100, now - _lastUpdate);
const uint32 pausedTime = now - _lastUpdate;
_lastUpdate = now;
- if (_speechRow && !_audio.speechPlaying() && (int32)(now - _subtitleUntil) >= 0)
+ if (_speechRow && !_audio.speechPlaying() && _speech.finished(now))
skipSpeech();
if (inventoryOpen && !inventoryPresentation()) {
_actionStarted += pausedTime;
@@ -858,35 +847,9 @@ void RunawayScene5030::update(uint32 now, int scrollDirection, bool inventoryOpe
return;
}
updateAction();
- if ((_action == kNone || _action == kWalkingAction) && _pathIndex < _path.size()) {
+ if ((_action == kNone || _action == kWalkingAction) && _walkPath.active()) {
const uint previousWalkFrame = _walkElapsed / 60;
- const float previousX = _x, previousY = _y;
- float travel = elapsed * 0.18f;
- while (travel > 0 && _pathIndex < _path.size()) {
- const Common::Point target = _path[_pathIndex];
- const float dx = target.x - _x, dy = target.y - _y;
- const float distance = sqrtf(dx * dx + dy * dy);
- if (distance > 0) {
- if (ABS(dx) > ABS(dy) * 2)
- _facing = dx > 0 ? 2 : 6;
- else if (ABS(dy) > ABS(dx) * 2)
- _facing = dy > 0 ? 4 : 0;
- else
- _facing = dy > 0 ? (dx > 0 ? 3 : 5) : (dx > 0 ? 1 : 7);
- }
- if (distance <= travel) {
- _x = target.x;
- _y = target.y;
- travel -= distance;
- ++_pathIndex;
- } else {
- _x += dx * travel / distance;
- _y += dy * travel / distance;
- travel = 0;
- }
- }
- _position = Common::Point((int)(_x + 0.5f), (int)(_y + 0.5f));
- if (_x != previousX || _y != previousY) {
+ if (_walkPath.advance(elapsed * 0.18f, _position, _facing)) {
_walkElapsed += elapsed;
// Native walking repeats cels 1..12 at 60 ms, with contacts at
// 6 and 12. Cels 13..18 belong to stopping/turning, not the gait.
@@ -896,20 +859,20 @@ void RunawayScene5030::update(uint32 now, int scrollDirection, bool inventoryOpe
}
// The final standing cel (0) is also a contact. Suppress a
// duplicate when it immediately follows another footfall.
- if (_pathIndex == _path.size() && (!_lastFootstep || _walkElapsed - _lastFootstep > 60))
+ if (!_walkPath.active() && (!_lastFootstep || _walkElapsed - _lastFootstep > 60))
playWalkFootstep();
}
- if (_pathIndex == _path.size()) {
+ if (!_walkPath.active()) {
debugC(1, kDebugScene, "Runaway demo: arrived at %d,%d", _position.x, _position.y);
arrive();
}
}
- if (_action == kNone && !speaking() && _pathIndex == _path.size() &&
+ if (_action == kNone && !speaking() && !_walkPath.active() &&
_windowClean && _unplugged && _lidOpen && _ice == kFrozen)
walkForAction(Common::Point(900, 473), 2, kMeltIce);
- const bool walking = _pathIndex < _path.size();
+ const bool walking = _walkPath.active();
const bool idle = !walking && !_speechRow && _action == kNone;
- _idleHead.update(now, idle, _lipSync.frameDuration(), _random);
+ _idleHead.update(now, idle, _speech.frameDuration(), _random);
const int headFrame = walking ? -1 : _speechRow ? speechFrame() : idle ? _idleHead.frame() : -1;
_actor.setFrame(_facing, walking ? 1 + (_walkElapsed / 60) % 12 : 0, headFrame);
if (scrollDirection)
diff --git a/engines/hollywood/runaway/scene5030.h b/engines/hollywood/runaway/scene5030.h
index 3e3d2332c23..c97f11e0965 100644
--- a/engines/hollywood/runaway/scene5030.h
+++ b/engines/hollywood/runaway/scene5030.h
@@ -47,7 +47,9 @@ public:
RunawayScene5030(Audio::Mixer *mixer, RunawayAudio &audio, RunawayInventory &inventory, const RunawayStrings &strings,
RunawayGameType game = kRunawayCabinDemo) :
- _audio(audio), _inventory(inventory), _strings(strings), _game(game), _interrogation(mixer), _random("runawayShack"), _actor() {}
+ _audio(audio), _inventory(inventory), _strings(strings), _game(game), _interrogation(mixer), _random("runawayShack"), _actor(),
+ _speech(audio, _random, game == kRunawayFullGame ? RunawaySpeech::kRecordedLipSync : RunawaySpeech::kTextLipSync),
+ _walkPath(Common::Point(623, 447)) {}
bool load(uint16 entryScene) override;
void start(uint32 now) override;
void resume() override;
@@ -60,10 +62,10 @@ public:
byte hotspotAt(Common::Point mouse) const override;
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _committedCaption; }
- const Common::U32String &subtitle() const override { return _action == kPeekConversation ? _interrogation.subtitle() : _subtitle; }
+ const Common::U32String &subtitle() const override { return _action == kPeekConversation ? _interrogation.subtitle() : _speech.subtitle(); }
bool busy() const override { return _action != kNone; }
bool speaking() const override { return _action == kPeekConversation ? _interrogation.speaking() : _speechRow != 0; }
- byte speechFrame() const override { return _lipSync.frame(_now); }
+ byte speechFrame() const override { return _speech.frame(_now); }
void skipSpeech() override;
bool playingVideo() const override { return _action == kIntroVideo || _action == kCleanWindowVideo; }
bool inventoryPresentation() const override { return _action == kIntroInventory; }
@@ -71,7 +73,7 @@ public:
void cancelWalk();
void sayInventory(const RunawayInventory::Reply &reply) override;
bool escaped() const override { return _escaped; }
- bool canSave() const override { return !busy() && !speaking() && !_escaped && _pathIndex == _path.size(); }
+ bool canSave() const override { return !busy() && !speaking() && !_escaped && !_walkPath.active(); }
void captureState(RunawaySaveState &state) const override;
bool restoreState(const RunawaySaveState &state, uint32 now, bool entering = false) override;
void setOptions(bool antialias, bool fastScrolling) override { _antialias = antialias; _fastScrolling = fastScrolling; }
@@ -128,14 +130,12 @@ private:
bool _peeked = false;
bool _antialias = true, _fastScrolling = true;
RunawayActor _actor;
- RunawayLipSync _lipSync;
+ RunawaySpeech _speech;
RunawayIdleHead _idleHead;
RunawayAnimation _intro, _lidActor, _lid, _unplug, _climb, _actionAnimation, _water, _hatch;
RunawayVideo _video;
Common::Point _position = Common::Point(623, 447);
- Common::Array<Common::Point> _path;
- uint _pathIndex = 0;
- float _x = 623, _y = 447;
+ RunawayWalkPath _walkPath;
byte _facing = 3, _pendingHotspot = 0;
byte _pendingItem = 0;
RunawayVerb _pendingVerb = kVerbWalk;
@@ -150,12 +150,11 @@ private:
bool _pickedUp[20] = {};
bool _examined[20] = {};
bool _globalSpeech = false;
- uint32 _now = 0, _lastUpdate = 0, _actionStarted = 0, _subtitleUntil = 0;
+ uint32 _now = 0, _lastUpdate = 0, _actionStarted = 0;
uint32 _walkElapsed = 0, _lastFootstep = 0;
uint _step = 0;
uint16 _speechRow = 0, _speechEnd = 0;
uint16 _speechSample = 0;
- Common::U32String _subtitle;
Common::U32String _committedCaption;
};
diff --git a/engines/hollywood/runaway/sequence.cpp b/engines/hollywood/runaway/sequence.cpp
index 2784907dec1..da45fb1b4f7 100644
--- a/engines/hollywood/runaway/sequence.cpp
+++ b/engines/hollywood/runaway/sequence.cpp
@@ -32,11 +32,10 @@ void RunawaySequence::start(const Command *commands, const SceneTextStore &text,
_destination = Common::Rect(0, kRunawayViewportTop, kRunawayScreenWidth, kRunawayViewportTop + kRunawayViewportHeight);
_chapter = chapter;
_text = &text;
- _audio.stopSpeech();
+ _speech.stop();
_audio.stopEffect();
_lines.clear();
_line = 0;
- _subtitle.clear();
_commands = commands;
_index = 0;
_entered = _showPortrait = false;
@@ -69,29 +68,24 @@ void RunawaySequence::speak(uint cue, uint variation, uint lastVariation) {
_lines.push_back(line);
}
}
- if (_subtitle.empty())
+ if (subtitle().empty())
nextLine();
}
void RunawaySequence::nextLine() {
- _audio.stopSpeech();
- _subtitle.clear();
- _lipSync.stop();
+ _speech.stop();
if (_line >= _lines.size()) {
_line = 0;
_lines.clear();
return;
}
const Line &line = _lines[_line++];
- _subtitle = line.text;
- const uint duration = line.sample ? _audio.playSpeech(line.sample) : 0;
- _deadline = _now + (duration ? duration + 150 : MAX<uint>(3000, _subtitle.size() * 55));
- _lipSync.start(_subtitle, _now, duration, _random, line.sample);
+ _speech.start(line.text, line.sample, false, _now, 0);
}
void RunawaySequence::update(uint32 now) {
_now = now;
- if (!_skipFilm && !_subtitle.empty() && (int32)(now - _deadline) >= 0)
+ if (!_skipFilm && !subtitle().empty() && _speech.finished(now))
nextLine();
while (active()) {
const Command &command = _commands[_index];
@@ -161,11 +155,11 @@ void RunawaySequence::update(uint32 now) {
if (!_video.decodeToFrame(frame))
error("Cannot decode Runaway film frame %u", frame);
if (command.c == kUntilSpeechEnds) {
- if (elapsedFrames < count && !_subtitle.empty())
+ if (elapsedFrames < count && !subtitle().empty())
return;
break;
}
- if (command.c == kIdleDuringSpeech && elapsedFrames >= count && !_subtitle.empty()) {
+ if (command.c == kIdleDuringSpeech && elapsedFrames >= count && !subtitle().empty()) {
if (!_repeatAt)
_repeatAt = now + 80;
if ((int32)(now - _repeatAt) >= 0) {
@@ -175,13 +169,13 @@ void RunawaySequence::update(uint32 now) {
_started = now;
}
}
- if ((command.c != kLoopDuringSpeech && elapsedFrames < count) || (command.c != kOnce && !_subtitle.empty()))
+ if ((command.c != kLoopDuringSpeech && elapsedFrames < count) || (command.c != kOnce && !subtitle().empty()))
return;
break;
}
case kTalk:
case kWaitSpeech:
- if (!_subtitle.empty())
+ if (!subtitle().empty())
return;
break;
case kDelay:
@@ -195,11 +189,9 @@ void RunawaySequence::update(uint32 now) {
case kEnd:
_video.close();
_stills.close();
- _audio.stopSpeech();
+ _speech.stop();
_audio.stopEffect();
- _lipSync.stop();
_lines.clear();
- _subtitle.clear();
_commands = nullptr;
return;
default:
@@ -212,7 +204,7 @@ void RunawaySequence::update(uint32 now) {
void RunawaySequence::skip() {
if (!active())
return;
- if (!_subtitle.empty()) {
+ if (!subtitle().empty()) {
nextLine();
return;
}
diff --git a/engines/hollywood/runaway/sequence.h b/engines/hollywood/runaway/sequence.h
index d3a3352ac1a..e381c97163f 100644
--- a/engines/hollywood/runaway/sequence.h
+++ b/engines/hollywood/runaway/sequence.h
@@ -24,9 +24,9 @@
#include "common/random.h"
#include "hollywood/resource.h"
-#include "hollywood/runaway/animation.h"
#include "hollywood/runaway/audio.h"
#include "hollywood/runaway/graphics.h"
+#include "hollywood/runaway/speech.h"
#include "hollywood/runaway/video.h"
#include "hollywood/scene_text_store.h"
@@ -58,15 +58,15 @@ public:
uint16 a, b;
byte c, d;
};
- explicit RunawaySequence(RunawayAudio &audio) : _audio(audio), _random("runawaySequence") {}
+ explicit RunawaySequence(RunawayAudio &audio) : _audio(audio), _random("runawaySequence"), _speech(audio, _random) {}
void start(const Command *commands, const SceneTextStore &text, uint32 now, char chapter = 'B');
void setBackground(const Graphics::ManagedSurface &background, const Common::Rect &destination);
void update(uint32 now);
void skip();
void draw(Graphics::ManagedSurface &screen);
bool active() const { return _commands != nullptr; }
- const Common::U32String &subtitle() const { return _subtitle; }
- byte speechFrame() const { return _lipSync.frame(_now); }
+ const Common::U32String &subtitle() const { return _speech.subtitle(); }
+ byte speechFrame() const { return _speech.frame(_now); }
private:
void advance();
@@ -75,7 +75,7 @@ private:
RunawayAudio &_audio;
Common::RandomSource _random;
- RunawayLipSync _lipSync;
+ RunawaySpeech _speech;
RunawayVideo _video, _stills;
bool _useStill = false;
RunawayFilmPortrait _portraits;
@@ -87,7 +87,7 @@ private:
const Command *_commands = nullptr;
uint _index = 0;
uint _movie = 0;
- uint32 _now = 0, _started = 0, _deadline = 0;
+ uint32 _now = 0, _started = 0;
uint32 _repeatAt = 0;
bool _entered = false, _showPortrait = false, _silentPortrait = false;
bool _skipFilm = false;
@@ -97,7 +97,6 @@ private:
};
Common::Array<Line> _lines;
uint _line = 0;
- Common::U32String _subtitle;
};
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/speech.cpp b/engines/hollywood/runaway/speech.cpp
new file mode 100644
index 00000000000..52a60e46984
--- /dev/null
+++ b/engines/hollywood/runaway/speech.cpp
@@ -0,0 +1,45 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/speech.h"
+
+namespace Hollywood {
+
+void RunawaySpeech::start(const Common::U32String &text, uint16 sample, bool global, uint32 now, uint minimumDuration) {
+ _subtitle = text;
+ const uint32 duration = sample ? _audio.playSpeech(sample, global) : 0;
+ _deadline = now + (duration ? MAX<uint>(minimumDuration, duration + 150) : MAX<uint>(3000, _subtitle.size() * 55));
+ if (_mode != kNoLipSync)
+ _lipSync.start(_subtitle, now, duration, _random, _mode == kRecordedLipSync ? sample : 0);
+}
+
+void RunawaySpeech::stop() {
+ _audio.stopSpeech();
+ reset();
+}
+
+void RunawaySpeech::reset() {
+ _subtitle.clear();
+ _lipSync.stop();
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/speech.h b/engines/hollywood/runaway/speech.h
new file mode 100644
index 00000000000..c206230b889
--- /dev/null
+++ b/engines/hollywood/runaway/speech.h
@@ -0,0 +1,56 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef HOLLYWOOD_RUNAWAY_SPEECH_H
+#define HOLLYWOOD_RUNAWAY_SPEECH_H
+
+#include "hollywood/runaway/animation.h"
+#include "hollywood/runaway/audio.h"
+
+namespace Hollywood {
+
+// Playback of one line; scenes retain their cue ordering and speaker changes.
+class RunawaySpeech {
+public:
+ enum LipSync { kNoLipSync, kTextLipSync, kRecordedLipSync };
+ RunawaySpeech(RunawayAudio &audio, Common::RandomSource &random, LipSync mode = kRecordedLipSync) :
+ _audio(audio), _random(random), _mode(mode) {}
+ void start(const Common::U32String &text, uint16 sample, bool global, uint32 now, uint minimumDuration = 1000);
+ void stop();
+ // Scene preparation must not stop audio belonging to the active scene.
+ void reset();
+ bool finished(uint32 now) const { return (int32)(now - _deadline) >= 0; }
+ const Common::U32String &subtitle() const { return _subtitle; }
+ byte frame(uint32 now) const { return _lipSync.frame(now); }
+ uint frameDuration() const { return _lipSync.frameDuration(); }
+
+private:
+ RunawayAudio &_audio;
+ Common::RandomSource &_random;
+ const LipSync _mode;
+ RunawayLipSync _lipSync;
+ Common::U32String _subtitle;
+ uint32 _deadline = 0;
+};
+
+} // End of namespace Hollywood
+
+#endif // HOLLYWOOD_RUNAWAY_SPEECH_H
Commit: 34c42402cc6b8a528a285a2af9cbd898a2c0b588
https://github.com/scummvm/scummvm/commit/34c42402cc6b8a528a285a2af9cbd898a2c0b588
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: implemented navigation in 5xxx scenes
Changed paths:
A engines/hollywood/runaway/scene5010.cpp
A engines/hollywood/runaway/scene5020.cpp
A engines/hollywood/runaway/scene5050.cpp
A engines/hollywood/runaway/scene5060.cpp
A engines/hollywood/runaway/scene5070.cpp
A engines/hollywood/runaway/scene5080.cpp
A engines/hollywood/runaway/scene5100.cpp
A engines/hollywood/runaway/scene5110.cpp
A engines/hollywood/runaway/scene5160.cpp
A engines/hollywood/runaway/scene5170.cpp
engines/hollywood/module.mk
engines/hollywood/runaway/engine.cpp
engines/hollywood/runaway/graphics.cpp
engines/hollywood/runaway/graphics.h
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/inventory.h
engines/hollywood/runaway/saveload.cpp
engines/hollywood/runaway/saveload.h
engines/hollywood/runaway/scene.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene4070.cpp
engines/hollywood/runaway/scene5030.cpp
engines/hollywood/runaway/scene5030.h
engines/hollywood/runaway/scene_data.h
diff --git a/engines/hollywood/module.mk b/engines/hollywood/module.mk
index 748f691db6e..b1c4f62f8e2 100644
--- a/engines/hollywood/module.mk
+++ b/engines/hollywood/module.mk
@@ -162,7 +162,17 @@ MODULE_OBJS = \
runaway/scene4090.o \
runaway/scene4100.o \
runaway/scene4140.o \
+ runaway/scene5010.o \
+ runaway/scene5020.o \
runaway/scene5030.o \
+ runaway/scene5050.o \
+ runaway/scene5060.o \
+ runaway/scene5070.o \
+ runaway/scene5080.o \
+ runaway/scene5100.o \
+ runaway/scene5110.o \
+ runaway/scene5160.o \
+ runaway/scene5170.o \
runaway/sequence.o \
runaway/speech.o \
runaway/strings.o \
diff --git a/engines/hollywood/runaway/engine.cpp b/engines/hollywood/runaway/engine.cpp
index a569cf99f5d..8af1400a0d8 100644
--- a/engines/hollywood/runaway/engine.cpp
+++ b/engines/hollywood/runaway/engine.cpp
@@ -163,9 +163,10 @@ Common::Error RunawayEngine::loadGameStream(Common::SeekableReadStream *stream)
RunawayScene *RunawayEngine::createScene(uint16 entryScene) {
if (findRunawayRoom(entryScene) && ((_museum && entryScene >= 4000) ||
- (_game == kRunawayFullGame && (entryScene / 1000 == 2 || entryScene / 1000 == 4))))
+ (_game == kRunawayFullGame && (entryScene / 1000 == 2 || entryScene / 1000 == 4 || entryScene / 1000 == 5))))
return new RunawayRoomScene(_audio, *_inventory, _strings, _game);
- if ((_game == kRunawayCabinDemo || _game == kRunawayFullGame) && entryScene == 5030)
+ if ((_game == kRunawayCabinDemo && entryScene == 5030) ||
+ (_game == kRunawayFullGame && entryScene >= 5030 && entryScene <= 5032))
return new RunawayScene5030(_mixer, _audio, *_inventory, _strings, _game);
// Retail scene scripts have their own entry substates. Sharing an archive
// with a demo does not make its puzzle initialization interchangeable.
diff --git a/engines/hollywood/runaway/graphics.cpp b/engines/hollywood/runaway/graphics.cpp
index dbe495a03e9..0a21784315d 100644
--- a/engines/hollywood/runaway/graphics.cpp
+++ b/engines/hollywood/runaway/graphics.cpp
@@ -63,11 +63,11 @@ bool loadRunawaySurface(ChunkArchive &archive, uint chunk, int width, int height
return archive.readVariableChunk(chunk, pixels) && decodeSurface(pixels, width, height, surface);
}
-bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array<byte> &mask, Common::Array<byte> &maps) {
+bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array<byte> &mask, Common::Array<byte> &maps, uint chunk) {
Common::Array<byte> packed;
if (width <= 0 || height <= 0 || (uint64)width * height > 16 * 1024 * 1024 ||
- !archive.readVariableChunk(1, packed) || packed.size() % 3 ||
- !archive.readVariableChunk(2, maps) || maps.size() != 1536)
+ !archive.readVariableChunk(chunk, packed) || packed.size() % 3 ||
+ !archive.readVariableChunk(chunk + 1, maps) || maps.size() != 1536)
return false;
mask.resize(width * height);
// Each run is (byte value, uint16 length). The first four 256-byte tables
diff --git a/engines/hollywood/runaway/graphics.h b/engines/hollywood/runaway/graphics.h
index 330e9e3b154..da9f470c4ed 100644
--- a/engines/hollywood/runaway/graphics.h
+++ b/engines/hollywood/runaway/graphics.h
@@ -38,7 +38,7 @@ bool readRunawayGlobalChunk(uint chunk, Common::Array<byte> &data);
bool loadRunawaySurface(uint chunk, int width, int height, Graphics::ManagedSurface &surface);
bool loadRunawaySurface(const Common::Path &path, int width, int height, Graphics::ManagedSurface &surface);
bool loadRunawaySurface(ChunkArchive &archive, uint chunk, int width, int height, Graphics::ManagedSurface &surface);
-bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array<byte> &mask, Common::Array<byte> &maps);
+bool loadRunawayMask(ChunkArchive &archive, int width, int height, Common::Array<byte> &mask, Common::Array<byte> &maps, uint chunk = 1);
bool applyRunawayPatch(const Common::Array<byte> &patch, Graphics::ManagedSurface &surface, int yOffset = 0, int xOffset = 0);
enum {
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index 131186a2dc6..e4463a611bd 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -63,6 +63,7 @@ void RunawayInventory::captureState(RunawaySaveState &state) const {
state.chartWritten = _chartWritten;
state.headWig = _headWig;
state.museumItems = _museum;
+ state.desertItems = _desert;
}
void RunawayInventory::restoreState(const RunawaySaveState &state) {
@@ -79,6 +80,7 @@ void RunawayInventory::restoreState(const RunawaySaveState &state) {
_chartWritten = state.chartWritten;
_headWig = state.headWig;
_museum = state.museumItems;
+ _desert = state.desertItems;
_newItem = 0;
}
@@ -86,6 +88,10 @@ void RunawayInventory::startChapter(byte chapter) {
_chapter = chapter;
_items.clear();
_selected = _newItem = 0;
+ if (chapter == 3) {
+ _desert = RunawaySaveState::DesertItems();
+ _clothState = 0;
+ }
if (chapter == 2) {
_museum = RunawaySaveState::MuseumItems();
const byte initial[] = {1, 2, 3, 4, 7};
@@ -153,6 +159,10 @@ Common::U32String RunawayInventory::name(byte item) const {
return item < ARRAYSIZE(kHospitalItemNames) ? Common::U32String(kHospitalItemNames[item]) : Common::U32String();
if (item == 1 && _clothState)
return _strings.text(_clothState == 1 ? RunawayStrings::kWetCloth : RunawayStrings::kDirtyCloth);
+ if ((item == 10 && _desert.lipstick) || (item == 11 && _desert.lipsticks))
+ return Common::U32String(item == 10 ? "Lipstick filled with gunpowder" : "Lipsticks filled with gunpowder");
+ if (item == 25 && _desert.bucket == 1)
+ return Common::U32String("Bucket of gunpowder");
return _strings.itemName(item);
}
@@ -179,6 +189,23 @@ uint RunawayInventory::icon(byte item) const {
return item;
if (item == 1 && _clothState)
return _clothState == 1 ? 34 : 35;
+ if (item == 6) {
+ static const byte helmetIcons[] = {6, 32, 33, 36, 37};
+ return helmetIcons[_desert.helmet];
+ }
+ if (item == 14)
+ return _desert.belt ? 26 + _desert.belt : 14;
+ if (item == 15)
+ return _desert.ball == 2 ? 15 : 29 + _desert.ball;
+ if (item == 19 && _desert.helmet >= 3)
+ return 38;
+ if (item == 20 && _desert.glasses == 1)
+ return 31;
+ if (item == 23)
+ return _desert.gunReady || _desert.bombReady || _desert.helicopterReady ?
+ 38 + _desert.gunReady + _desert.bombReady + _desert.helicopterReady : 23;
+ if (item == 25 && _desert.bucket == 1)
+ return 42;
return item == 15 ? 29 : item;
}
@@ -199,6 +226,16 @@ uint RunawayInventory::cursor(byte item) const {
return item && item <= 19 ? (item == 16 ? 81 : 39 + item * 2 - (item > 16 ? 2 : 0)) : 0;
if (item == 1 && _clothState)
return _clothState == 1 ? 107 : 109;
+ if (item == 6) {
+ static const byte helmetCursors[] = {51, 53, 115, 117, 119};
+ return helmetCursors[_desert.helmet];
+ }
+ if (item == 14) return _desert.belt == 1 ? 113 : _desert.belt == 2 ? 71 : 69;
+ if (item == 15) return _desert.ball == 2 ? 73 : 75 + _desert.ball * 2;
+ if (item == 19 && _desert.helmet >= 3) return 121;
+ if (item == 20 && _desert.glasses == 1) return 89;
+ if (item == 23) return 95 + 2 * (_desert.gunReady + _desert.bombReady + _desert.helicopterReady);
+ if (item == 25 && _desert.bucket == 1) return 123;
return item <= kItemCount ? kItemCursors[item] : 0;
}
@@ -233,7 +270,19 @@ RunawayInventory::Reply RunawayInventory::examine(byte item) const {
}
if (_chapter == 1)
return Reply(item && item <= 19 ? (item == 3 ? 74 : 49 + item) : 1);
- return Reply(item && item <= kItemCount ? kExamineCues[item] : 1, item == 1 ? _clothState : 0);
+ byte variation = 0;
+ switch (item) {
+ case 1: variation = _clothState; break;
+ case 6: variation = _desert.helmet; break;
+ case 10: variation = _desert.lipstick; break;
+ case 11: variation = _desert.lipsticks; break;
+ case 14: variation = _desert.belt; break;
+ case 15: variation = _desert.ball; break;
+ case 20: variation = _desert.glasses; break;
+ case 25: variation = _desert.bucket == 1; break;
+ default: break;
+ }
+ return Reply(item && item <= kItemCount ? kExamineCues[item] : 1, variation);
}
RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
@@ -321,8 +370,7 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
}
if (_chapter != 3)
return Reply();
- // The combinations available among the shack's items, from 0x4158c0
- // and 0x415bd0. A failed combination leaves both items in place.
+ // Chapter 3's item-pair table (retail 0x46d400).
if (first == 1 && second == 3) {
const byte previous = _clothState;
if (!previous)
@@ -335,6 +383,56 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
add(17);
return Reply(183, 1);
}
+ if (first == 4 && second == 6) {
+ if (!_desert.antTrickKnown) return Reply(14);
+ _desert.helmet = 1;
+ remove(4);
+ return Reply(178);
+ }
+ if (first == 6 && second == 18) {
+ if (!_desert.antTrickKnown) return Reply(14);
+ if (!_desert.helmet) return Reply(190);
+ _desert.helmet = 2;
+ remove(18);
+ return Reply(190, 1);
+ }
+ if ((first == 10 || first == 11) && second == 25) {
+ if (_desert.bucket != 1) return Reply(17);
+ if (first == 10) {
+ if (_desert.lipstick) return Reply(184, 2);
+ _desert.lipstick = 1;
+ return Reply(184);
+ }
+ if (_desert.lipsticks) return Reply(1, 2);
+ _desert.lipsticks = 1;
+ _desert.bucket = 2;
+ remove(10);
+ return Reply(185);
+ }
+ if ((first == 10 || first == 11) && second == 14) {
+ if (!(first == 10 ? _desert.lipstick : _desert.lipsticks))
+ return Reply(first == 10 ? 186 : 187);
+ _desert.belt = first == 10 ? 1 : 2;
+ remove(first);
+ return Reply(first == 10 ? 186 : 187, 1);
+ }
+ if (first == 15 && second == 16) {
+ if (_desert.ball) return Reply(188, 2);
+ _desert.ball = 1;
+ return Reply(188);
+ }
+ if (first == 15 && second == 24) {
+ if (_desert.ball != 1) return Reply(189, _desert.ball ? 3 : 0);
+ _desert.ball = 2;
+ return Reply(189, 1);
+ }
+ if (first == 4 && second == 18) return Reply(_desert.antTrickKnown ? 177 : 14);
+ if (first == 4 && second == 19) return Reply(179);
+ if (first == 4 && second == 25) return Reply(_desert.antTrickKnown ? 180 : 14, _desert.antTrickKnown && _desert.bucket == 1);
+ if (first == 5 && second == 25) return Reply(181);
+ if (first == 6 && second == 19) return Reply(!_desert.helmet ? 23 : _desert.helmet == 3 ? 182 : 14);
+ if (first == 18 && second == 19) return Reply(191);
+ if (first == 18 && second == 25) return Reply(_desert.antTrickKnown ? (_desert.bucket == 1 ? 192 : 180) : 14);
return Reply();
}
diff --git a/engines/hollywood/runaway/inventory.h b/engines/hollywood/runaway/inventory.h
index 8dcaf5737c6..d9a8fe51ebd 100644
--- a/engines/hollywood/runaway/inventory.h
+++ b/engines/hollywood/runaway/inventory.h
@@ -47,6 +47,7 @@ public:
void setChapter(byte chapter) { _chapter = chapter; }
void startChapter(byte chapter);
RunawaySaveState::MuseumItems &museum() { return _museum; }
+ RunawaySaveState::DesertItems &desert() { return _desert; }
bool contains(byte item) const;
bool add(byte item);
void remove(byte item);
@@ -74,6 +75,7 @@ private:
const bool _museumDemo;
byte _chapter;
RunawaySaveState::MuseumItems _museum;
+ RunawaySaveState::DesertItems _desert;
Common::Array<byte> _items;
byte _selected = 0, _newItem = 0, _clothState = 0;
byte _water = 0;
diff --git a/engines/hollywood/runaway/saveload.cpp b/engines/hollywood/runaway/saveload.cpp
index 60afc4cd7ae..63cc9ab6204 100644
--- a/engines/hollywood/runaway/saveload.cpp
+++ b/engines/hollywood/runaway/saveload.cpp
@@ -134,6 +134,74 @@ void RunawaySaveState::sync(Common::Serializer &s) {
s.syncAsByte(museumItems.recorderBattery, 6);
s.syncAsByte(museumItems.batteryInLadle, 6);
s.syncAsByte(museumItems.packageFilled, 6);
+ s.syncBytes(desert.visited, sizeof(desert.visited), 7);
+ s.syncAsByte(desert.escapedCabin, 7);
+ s.syncAsByte(desert.hatchSeen, 7);
+ s.syncAsByte(desert.bucketTaken, 7);
+ s.syncAsByte(desert.helmetTaken, 7);
+ s.syncAsByte(desert.beltTaken, 7);
+ s.syncAsByte(desert.beltSeen, 7);
+ s.syncAsByte(desert.gun, 7);
+ s.syncAsByte(desert.gunSeen, 7);
+ s.syncAsByte(desert.mariolaHelped, 7);
+ s.syncAsByte(desert.ballTaken, 7);
+ s.syncAsByte(desert.tanningOil, 7);
+ s.syncAsByte(desert.lulaHelped, 7);
+ s.syncAsByte(desert.busPosterSeen, 7);
+ s.syncAsByte(desert.lulaCalled, 7);
+ s.syncAsByte(desert.lulaRefused, 7);
+ s.syncAsByte(desert.dynamitePlaced, 7);
+ s.syncAsByte(desert.oilSeen, 7);
+ s.syncAsByte(desert.antsDistracted, 7);
+ s.syncAsByte(desert.dynamite, 7);
+ s.syncAsByte(desert.shedTried, 7);
+ s.syncAsByte(desert.trainEntered, 7);
+ s.syncAsByte(desert.barrel, 7);
+ s.syncAsByte(desert.screwSeen, 7);
+ s.syncAsByte(desert.screwTaken, 7);
+ s.syncAsByte(desert.bucket, 7);
+ s.syncAsByte(desert.trainDoorOpen, 7);
+ s.syncAsByte(desert.powderNeeded, 7);
+ s.syncAsByte(desert.barnDoor, 7);
+ s.syncAsByte(desert.footrest, 7);
+ s.syncAsByte(desert.guard, 7);
+ s.syncAsByte(desert.insideBarn, 7);
+ s.syncAsByte(desert.beerSeen, 7);
+ s.syncAsByte(desert.peanutButter, 7);
+ s.syncAsByte(desert.motorcycleSeen, 7);
+ s.syncAsByte(desert.footrestSeen, 7);
+ s.syncAsByte(desert.lulaDistractedGuard, 7);
+ s.syncAsByte(desert.guardWeaknessKnown, 7);
+ s.syncAsByte(desert.busDoor, 7);
+ s.syncAsByte(desert.lipstickShelf, 7);
+ s.syncAsByte(desert.keyTaken, 7);
+ s.syncAsByte(desert.glassesTaken, 7);
+ s.syncAsByte(desert.vacuum, 7);
+ s.syncAsByte(desert.crank, 7);
+ s.syncAsByte(desert.necklacesSeen, 7);
+ s.syncAsByte(desert.ringsSeen, 7);
+ s.syncAsByte(desert.fridgeOpened, 7);
+ s.syncAsByte(desert.ventCleaned, 7);
+ s.syncAsByte(desert.ventSeen, 7);
+ s.syncAsByte(desert.needle, 7);
+ s.syncAsByte(desert.fridgeSeen, 7);
+ s.syncAsByte(desert.carlaMet, 7);
+ s.syncAsByte(desert.carlaStory, 7);
+ s.syncAsByte(desert.planKnown, 7);
+ s.syncAsUint32LE(desert.carlaTopics, 7);
+ s.syncAsUint32LE(desert.lulaTopics, 7);
+ s.syncAsByte(desertItems.antTrickKnown, 7);
+ s.syncAsByte(desertItems.helmet, 7);
+ s.syncAsByte(desertItems.lipstick, 7);
+ s.syncAsByte(desertItems.lipsticks, 7);
+ s.syncAsByte(desertItems.belt, 7);
+ s.syncAsByte(desertItems.ball, 7);
+ s.syncAsByte(desertItems.glasses, 7);
+ s.syncAsByte(desertItems.pill, 7);
+ s.syncAsByte(desertItems.bucket, 7);
+ s.syncAsByte(desertItems.gunReady, 7);
+ s.syncAsByte(desertItems.bombReady, 7);
+ s.syncAsByte(desertItems.helicopterReady, 7);
}
byte RunawaySaveState::chapter() const {
@@ -155,9 +223,14 @@ bool RunawaySaveState::valid() const {
coolerInspected > 1 || peeked > 1 || ice > 2 || hatch > 3 ||
itemCount > sizeof(items) || selected > sizeof(items) || cloth > 2 || inventoryOpen > 1 || verb > 2)
return false;
- if ((game == kRunawayCabinDemo || (game == kRunawayFullGame && chapter() == 3)) &&
- (scene != 5030 || x >= 1376 || y >= 600 || camera > 352 || cameraY))
+ if ((game == kRunawayCabinDemo || (game == kRunawayFullGame && scene >= 5030 && scene <= 5032)) &&
+ (scene < 5030 || scene > (game == kRunawayCabinDemo ? 5030 : 5032) || x >= 1376 || y >= 600 || camera > 352 || cameraY))
return false;
+ if (game == kRunawayFullGame && chapter() == 3 && (scene < 5030 || scene > 5032)) {
+ const RunawayRoom *room = findRunawayRoom(scene);
+ if (!room || x >= room->width || y >= room->height || camera > room->width - 1024 || cameraY > room->height - 600)
+ return false;
+ }
if (upperFloor > 1 || books > 2 || recorder > 2 || moneyIdentified > 1 || safeOpen > 1 ||
varnishTaken > 1 || talcTaken > 1 || coffeeTaken > 1 || keyCount > 4)
return false;
@@ -201,6 +274,28 @@ bool RunawaySaveState::valid() const {
museumItems.frozenBattery > 1 || museumItems.rubyRemoved > 1 || museumItems.recorderBattery > 4 ||
museumItems.batteryInLadle > 1 || museumItems.packageFilled > 1)
return false;
+ if (desert.escapedCabin > 1 || desert.hatchSeen > 1 || desert.bucketTaken > 1 ||
+ desert.helmetTaken > 1 || desert.beltTaken > 1 || desert.beltSeen > 1 || desert.gun > 2 || desert.gunSeen > 1 ||
+ desert.mariolaHelped > 1 || desert.ballTaken > 1 || desert.tanningOil > 2 || desert.lulaHelped > 1 ||
+ desert.busPosterSeen > 1 || desert.lulaCalled > 1 || desert.lulaRefused > 1 ||
+ desert.dynamitePlaced > 1 || desert.oilSeen > 1 || desert.antsDistracted > 1 || desert.dynamite > 2 ||
+ desert.shedTried > 1 || desert.trainEntered > 1 || desert.barrel > 2 || desert.screwSeen > 1 ||
+ desert.screwTaken > 1 || desert.bucket > 3 || desert.trainDoorOpen > 1 || desert.powderNeeded > 1 ||
+ desert.barnDoor > 2 || desert.footrest > 2 || desert.guard > 2 || desert.insideBarn > 1 || desert.beerSeen > 1 ||
+ desert.peanutButter > 2 || desert.motorcycleSeen > 1 || desert.footrestSeen > 1 ||
+ desert.lulaDistractedGuard > 1 || desert.guardWeaknessKnown > 1 ||
+ desert.busDoor > 3 || desert.lipstickShelf > 3 || desert.keyTaken > 1 || desert.glassesTaken > 1 ||
+ desert.vacuum > 2 || desert.crank > 2 || desert.necklacesSeen > 1 || desert.ringsSeen > 1 ||
+ desert.fridgeOpened > 1 || desert.ventCleaned > 1 || desert.ventSeen > 1 || desert.needle > 2 || desert.fridgeSeen > 1 ||
+ desert.carlaMet > 1 || desert.carlaStory > 1 || desert.planKnown > 1 ||
+ desertItems.antTrickKnown > 1 || desertItems.helmet > 4 || desertItems.lipstick > 1 || desertItems.lipsticks > 1 ||
+ desertItems.belt > 2 || desertItems.ball > 2 || desertItems.glasses > 2 || desertItems.pill > 1 ||
+ desertItems.bucket > 2 || desertItems.gunReady > 1 || desertItems.bombReady > 1 || desertItems.helicopterReady > 1)
+ return false;
+ for (uint i = 0; i < sizeof(desert.visited); ++i) {
+ if (desert.visited[i] > 1)
+ return false;
+ }
if ((coolerMoved && ice != 2) || ((hatch != 0) != (coolerMoved != 0)))
return false;
for (uint i = 0; i < sizeof(pickedUp); ++i) {
@@ -222,7 +317,7 @@ bool RunawaySaveState::read(Common::SeekableReadStream &stream) {
if (stream.readUint32BE() != MKTAG('R', 'U', 'N', 'A'))
return false;
const uint16 version = stream.readUint16LE();
- if (version < 1 || version > 6)
+ if (version < 1 || version > 7)
return false;
Common::Serializer s(&stream, nullptr);
s.setVersion(version);
@@ -234,9 +329,9 @@ bool RunawaySaveState::write(Common::WriteStream &stream) {
if (!valid())
return false;
stream.writeUint32BE(MKTAG('R', 'U', 'N', 'A'));
- stream.writeUint16LE(6);
+ stream.writeUint16LE(7);
Common::Serializer s(nullptr, &stream);
- s.setVersion(6);
+ s.setVersion(7);
sync(s);
return !s.err();
}
diff --git a/engines/hollywood/runaway/saveload.h b/engines/hollywood/runaway/saveload.h
index 934332644a3..ac545794a79 100644
--- a/engines/hollywood/runaway/saveload.h
+++ b/engines/hollywood/runaway/saveload.h
@@ -58,6 +58,32 @@ struct RunawaySaveState {
byte rubyRemoved = 0, recorderBattery = 0, batteryInLadle = 0, packageFilled = 0;
} museumItems;
+ struct Desert {
+ byte visited[10] = {};
+ byte escapedCabin = 0, hatchSeen = 0, bucketTaken = 0;
+ byte helmetTaken = 0, beltTaken = 0, beltSeen = 0, gun = 0, gunSeen = 0;
+ byte mariolaHelped = 0, ballTaken = 0, tanningOil = 0, lulaHelped = 0;
+ byte busPosterSeen = 0, lulaCalled = 0, lulaRefused = 0;
+ byte dynamitePlaced = 0, oilSeen = 0;
+ byte antsDistracted = 0, dynamite = 0, shedTried = 0, trainEntered = 0;
+ byte barrel = 0, screwSeen = 0, screwTaken = 0, bucket = 0, trainDoorOpen = 0, powderNeeded = 0;
+ byte barnDoor = 0, footrest = 0, guard = 0, insideBarn = 0, beerSeen = 0;
+ byte peanutButter = 0, motorcycleSeen = 0, footrestSeen = 0;
+ byte lulaDistractedGuard = 0, guardWeaknessKnown = 0;
+ byte busDoor = 0, lipstickShelf = 0, keyTaken = 0, glassesTaken = 0;
+ byte vacuum = 0, crank = 0, necklacesSeen = 0, ringsSeen = 0;
+ byte fridgeOpened = 0, ventCleaned = 0, ventSeen = 0, needle = 0, fridgeSeen = 0;
+ byte carlaMet = 0, carlaStory = 0, planKnown = 0;
+ uint32 carlaTopics = 0, lulaTopics = 0;
+ } desert;
+
+ struct DesertItems {
+ byte antTrickKnown = 0;
+ byte helmet = 0, lipstick = 0, lipsticks = 0, belt = 0, ball = 0;
+ byte glasses = 0, pill = 0, bucket = 0;
+ byte gunReady = 0, bombReady = 0, helicopterReady = 0;
+ } desertItems;
+
uint16 scene = 5030, x = 623, y = 447, camera = 111;
byte facing = 3, lidOpen = 0, unplugged = 0, windowClean = 0;
byte coolerMoved = 0, coolerInspected = 0, peeked = 0, ice = 0, hatch = 0;
diff --git a/engines/hollywood/runaway/scene.cpp b/engines/hollywood/runaway/scene.cpp
index eab218fa9cf..9d0930874bf 100644
--- a/engines/hollywood/runaway/scene.cpp
+++ b/engines/hollywood/runaway/scene.cpp
@@ -35,7 +35,9 @@ namespace {
const RunawayRoom *const kRooms[] = {
&kRunawayScene2020, &kRunawayScene2060, &kRunawayScene2080,
- &kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4070, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140
+ &kRunawayScene4030, &kRunawayScene4050, &kRunawayScene4060, &kRunawayScene4070, &kRunawayScene4090, &kRunawayScene4100, &kRunawayScene4140,
+ &kRunawayScene5010, &kRunawayScene5020, &kRunawayScene5050, &kRunawayScene5060, &kRunawayScene5070,
+ &kRunawayScene5080, &kRunawayScene5100, &kRunawayScene5110, &kRunawayScene5160, &kRunawayScene5170
};
const RunawayResponse kGlobalResponses[] = {
@@ -70,6 +72,9 @@ const RunawayRoom *findRoom(int number) {
number = kMuseumSecurity;
else if (number >= 4141 && number <= 4142)
number = kMuseumKeypad;
+ else if (number == 5021 || number == 5022 || number == 5061 || number == 5062 ||
+ number == 5081 || number == 5101 || number == 5171)
+ number -= number % 10;
for (uint i = 0; i < ARRAYSIZE(kRooms); ++i) {
if (kRooms[i]->number == number)
return kRooms[i];
@@ -100,6 +105,10 @@ bool RunawayRoomScene::load(uint16 entryScene) {
void RunawayRoomScene::start(uint32 now) {
_now = _lastUpdate = now;
_idleHead.reset(now);
+ if (desertChapter()) {
+ startDesert();
+ return;
+ }
if (_room == kHospitalBedroom) {
start2020();
resume();
@@ -117,6 +126,10 @@ void RunawayRoomScene::start(uint32 now) {
}
void RunawayRoomScene::resume() {
+ if (desertChapter()) {
+ resumeDesert();
+ return;
+ }
if (museumChapter()) {
resumeMuseum();
return;
@@ -171,6 +184,7 @@ void RunawayRoomScene::captureState(RunawaySaveState &state) const {
state.keyCount = _keyCount;
state.hospital = _hospital;
state.museum = _museum;
+ state.desert = _desert;
state.randomSeed = _random.getSeed();
}
@@ -179,6 +193,7 @@ bool RunawayRoomScene::restoreState(const RunawaySaveState &state, uint32 now, b
return false;
_hospital = state.hospital;
_museum = state.museum;
+ _desert = state.desert;
_entering = entering;
_upperFloor = state.upperFloor;
_books = (ObjectState)state.books;
@@ -214,7 +229,7 @@ bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte fac
!loadRunawayMask(_archive, room->width, room->height, _mask, _originalMaps) ||
!_text.load("RESOURCE.003", "Runaway room", number == kMuseumWilly ? 406 : number / 10, 0, 0x1135))
return false;
- if (_game == kRunawayFullGame ? !_actor.loadChapter(number < 4000 ? 1 : 2, number != kMuseumHall) :
+ if (_game == kRunawayFullGame ? !_actor.loadChapter(number < 4000 ? 1 : number < 5000 ? 2 : 3, number != kMuseumHall) :
!_actor.load(number == kMuseumHall ? RunawayActor::kMuseumHall : RunawayActor::kMuseumInterior))
return false;
_room = number;
@@ -235,6 +250,8 @@ bool RunawayRoomScene::enterRoom(uint16 number, Common::Point position, byte fac
for (uint i = 0; i < ARRAYSIZE(_keyPatches); ++i)
_keyPatches[i].clear();
bool loaded = true;
+ if (desertChapter())
+ loaded = loadDesertRoom();
switch (number) {
case kHospitalBedroom:
loaded = loadScene2020();
@@ -302,6 +319,8 @@ bool RunawayRoomScene::rebuildBackground() {
const RunawayRoom *room = findRoom(_room);
if (!loadRunawaySurface(_archive, 0, room->width, room->height, _background))
return false;
+ if (desertChapter())
+ return applyDesertBackground();
switch (_room) {
case kHospitalBedroom:
return applyBackground2020();
@@ -324,6 +343,10 @@ bool RunawayRoomScene::rebuildBackground() {
void RunawayRoomScene::updateMaps() {
_maps = _originalMaps;
+ if (desertChapter()) {
+ updateDesertMaps();
+ return;
+ }
switch (_room) {
case kHospitalBedroom:
updateMaps2020();
@@ -352,6 +375,8 @@ void RunawayRoomScene::updateMaps() {
}
const RunawayHotspot *RunawayRoomScene::hotspot(byte id) const {
+ if (desertChapter())
+ return id && id < _desertHotspots.size() ? &_desertHotspots[id] : nullptr;
const RunawayRoom *room = findRoom(_room);
return room && id && id < room->hotspotCount ? &room->hotspots[id] : nullptr;
}
@@ -368,6 +393,8 @@ byte RunawayRoomScene::hotspotAt(Common::Point mouse) const {
}
Common::U32String RunawayRoomScene::hotspotName(byte id) const {
+ if (desertChapter())
+ return desertHotspotName(id);
const RunawayHotspot *spot = hotspot(id);
if (!spot)
return Common::U32String();
@@ -475,7 +502,8 @@ void RunawayRoomScene::click(Common::Point mouse, RunawayVerb verb, byte item) {
arrive();
}
} else {
- walkTo(Common::Point(mouse.x + _camera.x, mouse.y - kRunawayViewportTop + _camera.y));
+ if (_room != 5010)
+ walkTo(Common::Point(mouse.x + _camera.x, mouse.y - kRunawayViewportTop + _camera.y));
}
}
@@ -511,7 +539,8 @@ void RunawayRoomScene::sayInventory(const RunawayInventory::Reply &reply) {
_walkPath.clear();
_pendingHotspot = 0;
_caption.clear();
- if (_game == kRunawayFullGame && (museumChapter() ? sayMuseumInventory(reply) : sayHospitalInventory(reply)))
+ if (_game == kRunawayFullGame && !desertChapter() &&
+ (museumChapter() ? sayMuseumInventory(reply) : sayHospitalInventory(reply)))
return;
say(reply.cue, reply.variation, true);
}
@@ -546,7 +575,7 @@ void RunawayRoomScene::useItem(byte item, byte id) {
}
void RunawayRoomScene::execute(uint16 action) {
- ActionResult result = kUnhandled;
+ ActionResult result = desertChapter() ? executeDesert(action) : kUnhandled;
switch (_room) {
case kHospitalBedroom:
result = execute2020(action);
@@ -631,6 +660,8 @@ void RunawayRoomScene::updateCamera() {
}
float RunawayRoomScene::actorHeight() const {
+ if (desertChapter())
+ return desertActorHeight();
switch (_room) {
case kHospitalBedroom:
return actorHeight2020();
@@ -662,7 +693,7 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
if (!_sequence.active()) {
if (museumChapter())
finishMuseumFilm();
- else
+ else if (!desertChapter())
finishHospitalFilm();
}
return;
@@ -675,7 +706,11 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
update2020();
else if (_room == kHospitalBathroom)
update2080();
- if (museumChapter()) {
+ if (desertChapter()) {
+ updateDesert(elapsed, inventoryOpen);
+ if (_sequence.active() || _transition.scene)
+ return;
+ } else if (museumChapter()) {
updateMuseum(elapsed, inventoryOpen);
if (_sequence.active() || _transition.scene)
return;
@@ -694,7 +729,7 @@ void RunawayRoomScene::update(uint32 now, int scrollDirection, bool inventoryOpe
_actor.setFrame(_facing, 0, speaking() && !speaker() ? speechFrame() : -1);
return;
}
- if (inventoryOpen || _room == kMuseumKeypad)
+ if (inventoryOpen || _room == kMuseumKeypad || _room == 5010)
return;
if (_walkPath.active() && !speaking()) {
_walkPath.advance(elapsed * 0.18f * actorHeight() / 455, _position, _facing);
@@ -736,11 +771,17 @@ void RunawayRoomScene::draw() {
_screen.copyRectToSurface(_background, 0, kRunawayViewportTop,
Common::Rect(_camera.x, _camera.y, _camera.x + kRunawayScreenWidth, _camera.y + kRunawayViewportHeight));
Graphics::ManagedSurface viewport(_screen, Common::Rect(0, kRunawayViewportTop, kRunawayScreenWidth, kRunawayViewportTop + kRunawayViewportHeight));
+ if (_room == 5010) {
+ drawDesertRoom(viewport, false);
+ return;
+ }
if (_room == kMuseumKeypad) {
drawScene4140(viewport);
return;
}
- if (_room == kMuseumWilly) {
+ if (desertChapter()) {
+ drawDesertRoom(viewport, false);
+ } else if (_room == kMuseumWilly) {
drawScene4070(viewport);
} else if (_room == kHospitalBedroom) {
drawScene2020(viewport, false);
@@ -757,6 +798,8 @@ void RunawayRoomScene::draw() {
}
RunawayActor::RenderParams params;
memset(params.depthY, 0, sizeof(params.depthY));
+ if (desertChapter())
+ setupDesertDepth(params);
switch (_room) {
case kMuseumHall:
setupDepth4060(params);
@@ -785,7 +828,9 @@ void RunawayRoomScene::draw() {
if (!_secondaryFrames.empty())
_secondaryAnimation.draw(viewport, _secondaryFrames[MIN<uint>(_actionStep, _secondaryFrames.size() - 1)], _camera.x, -_camera.y);
}
- if (_room == kHospitalBedroom)
+ if (desertChapter())
+ drawDesertRoom(viewport, true);
+ else if (_room == kHospitalBedroom)
drawScene2020(viewport, true);
else if (_room == kHospitalBathroom)
drawScene2080(viewport, true);
@@ -853,12 +898,16 @@ void RunawayRoomScene::updateRoomAnimation() {
const uint16 action = _roomAction;
_roomAction = 0;
_actionFrames.clear();
- if (museumChapter())
+ if (desertChapter())
+ finishDesertAnimation(action);
+ else if (museumChapter())
finishMuseumAnimation(action);
else
finishHospitalAnimation(action);
return;
}
+ if (desertChapter())
+ continue;
if (museumChapter()) {
museumAnimationFrame();
continue;
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index 6eea0d33086..2b2515c2673 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -29,6 +29,7 @@
#include "hollywood/runaway/inventory.h"
#include "hollywood/runaway/navigation.h"
#include "hollywood/runaway/saveload.h"
+#include "hollywood/runaway/scene_data.h"
#include "hollywood/runaway/sequence.h"
#include "hollywood/runaway/speech.h"
#include "hollywood/scene_text_store.h"
@@ -239,6 +240,32 @@ private:
void clickScene4140(byte id);
void drawScene4140(Graphics::ManagedSurface &viewport);
+ bool desertChapter() const { return _game == kRunawayFullGame && _room / 1000 == 5; }
+ void startDesert();
+ void resumeDesert();
+ void updateDesert(uint elapsed, bool inventoryOpen);
+ bool loadDesertRoom();
+ bool applyDesertBackground();
+ void updateDesertMaps();
+ void drawDesertRoom(Graphics::ManagedSurface &viewport, bool foreground);
+ void setupDesertDepth(RunawayActor::RenderParams ¶ms) const;
+ float desertActorHeight() const;
+ Common::U32String desertHotspotName(byte id) const;
+ void leaveDesertRoom(uint16 scene);
+ void deferDesertAction(uint16 action);
+ void finishDesertAnimation(uint16 action);
+ ActionResult executeDesert(uint16 action);
+ ActionResult execute5020(uint16 action);
+ ActionResult execute5050(uint16 action);
+ ActionResult execute5060(uint16 action);
+ ActionResult execute5070(uint16 action);
+ ActionResult execute5080(uint16 action);
+ ActionResult execute5100(uint16 action);
+ ActionResult execute5110(uint16 action);
+ ActionResult execute5160(uint16 action);
+ void startCarlaConversation();
+ ActionResult execute5170(uint16 action);
+
RunawayAudio &_audio;
RunawaySequence _sequence;
RunawayInventory &_inventory;
@@ -281,6 +308,9 @@ private:
uint32 _lastFootstep = 0;
RunawaySaveState::Hospital _hospital;
RunawaySaveState::Museum _museum;
+ RunawaySaveState::Desert _desert;
+ Common::Array<RunawayHotspot> _desertHotspots;
+ RunawayAnimation _desertAnimations[6];
RunawayAnimation _npc, _npcMouth, _machine;
RunawayAnimation _computer, _rejectionLight;
uint32 _nextLaser = 0;
diff --git a/engines/hollywood/runaway/scene4070.cpp b/engines/hollywood/runaway/scene4070.cpp
index c6054c2bb20..964ee2be5c4 100644
--- a/engines/hollywood/runaway/scene4070.cpp
+++ b/engines/hollywood/runaway/scene4070.cpp
@@ -247,6 +247,8 @@ void RunawayRoomScene::chooseDialogue(uint choice) {
entry.enabled = 0;
if (_conversation == 2 && entry.disable == 5)
_museum.batteryRequested = 1;
+ if (_conversation == 4 && entry.disable == 2)
+ _desert.ventSeen = 1;
if (_conversation == 2 && entry.disable == 10) {
_dialogue[10][3].player = 22;
_dialogue[10][3].response = 21;
diff --git a/engines/hollywood/runaway/scene5010.cpp b/engines/hollywood/runaway/scene5010.cpp
new file mode 100644
index 00000000000..bb79b1ad5d4
--- /dev/null
+++ b/engines/hollywood/runaway/scene5010.cpp
@@ -0,0 +1,359 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "common/textconsole.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Unvisited Area", 0, 0, 0, {1, 301}, {0, 0}},
+ {"Thugs' Cabin", 0, 0, 0, {1, 302}, {0, 0}},
+ {"Unvisited Area", 0, 0, 0, {1, 303}, {0, 0}},
+ {"Unvisited Area", 0, 0, 0, {1, 304}, {0, 0}},
+ {"Unvisited Area", 0, 0, 0, {1, 305}, {0, 0}},
+ {"Drag Queen Bus", 0, 0, 0, {1, 306}, {0, 0}},
+ {"Oil Well", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Hangar", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Airplane Graveyard", 0, 0, 0, {0, 0}, {0, 0}},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5010 = {
+ 5010, 1024, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {90, 85, 80}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(512, 500),
+ nullptr, 0,
+ nullptr, 0,
+ nullptr, 0
+};
+
+void RunawayRoomScene::startDesert() {
+ _entering = true;
+ resumeDesert();
+}
+
+void RunawayRoomScene::resumeDesert() {
+ if (!_audio.musicPlaying())
+ _audio.playMusic(_room == 5060 ? 21 : 12);
+ if (!_entering)
+ return;
+ _entering = false;
+ if (_entryScene == 5021 && !_desert.escapedCabin) {
+ _desert.escapedCabin = 1;
+ say(0);
+ leaveDesertRoom(5140);
+ return;
+ }
+ if (_entryScene == 5062) {
+ for (byte variation = 2; variation <= 11; ++variation)
+ say(0, variation, false, variation == 2 || variation == 4 || variation == 6 || variation == 11 ? 0 : 1);
+ leaveDesertRoom(5130);
+ return;
+ }
+ if (_entryScene == 5171) {
+ _position = Common::Point(636, 382);
+ _walkPath.reset(_position);
+ _facing = 4;
+ }
+ if (_entryScene == 5081) {
+ _position = Common::Point(987, 379);
+ _walkPath.reset(_position);
+ walkTo(Common::Point(1000, 451), 5, true);
+ }
+ const uint16 rooms[] = {5010, 5020, 5050, 5060, 5070, 5080, 5100, 5110, 5160, 5170};
+ for (uint i = 0; i < ARRAYSIZE(rooms); ++i) {
+ if (_room != rooms[i] || _desert.visited[i])
+ continue;
+ _desert.visited[i] = 1;
+ if (_room != 5010 && _room != 5020 && _room != 5160) {
+ say(0);
+ if (_room == 5050 || _room == 5060 || _room == 5100 || _room == 5170)
+ say(0, 1);
+ }
+ }
+}
+
+void RunawayRoomScene::leaveDesertRoom(uint16 scene) {
+ const RunawayRoom *room = findRunawayRoom(scene);
+ if (!room && (scene < 5030 || scene > 5032)) {
+ warning("Runaway: scene %u is not implemented yet", scene);
+ return;
+ }
+ _hospitalExit.scene = scene;
+ _hospitalExit.position = room ? room->entry : Common::Point(1167, 468);
+ _hospitalExit.facing = 3;
+}
+
+void RunawayRoomScene::deferDesertAction(uint16 action) {
+ _roomAction = action;
+ _actionFrames.clear();
+}
+
+void RunawayRoomScene::finishDesertAnimation(uint16 action) {
+ execute(action + 1000);
+}
+
+void RunawayRoomScene::updateDesert(uint elapsed, bool inventoryOpen) {
+ updateRoomAnimation();
+ updateConversation();
+ if (_roomAction && _actionFrames.empty() && !speaking() && !_walkPath.active()) {
+ const uint16 action = _roomAction;
+ _roomAction = 0;
+ execute(action);
+ }
+ if (_hospitalExit.scene && !speaking() && !_roomAction && !_walkPath.active())
+ _transition = _hospitalExit;
+}
+
+RunawayRoomScene::ActionResult RunawayRoomScene::executeDesert(uint16 action) {
+ switch (_room) {
+ case 5010: {
+ const uint16 destinations[] = {5070, 5020, 5100, 5050, 5080, 5060};
+ if (action >= 301 && action <= 306) {
+ leaveDesertRoom(destinations[action - 301]);
+ return kHandled;
+ }
+ break;
+ }
+ case 5020: return execute5020(action);
+ case 5050: return execute5050(action);
+ case 5060: return execute5060(action);
+ case 5070: return execute5070(action);
+ case 5080: return execute5080(action);
+ case 5100: return execute5100(action);
+ case 5110: return execute5110(action);
+ case 5160: return execute5160(action);
+ case 5170: return execute5170(action);
+ default: break;
+ }
+ return kUnhandled;
+}
+
+float RunawayRoomScene::desertActorHeight() const {
+ switch (_room) {
+ case 5020: return _position.y * -0.140845075f + 264.225342f;
+ case 5050: return _position.y * 0.128865972f + 197.809280f;
+ case 5060: return _position.y * 0.107991360f + 207.213821f;
+ case 5070: return _position.y * 1.171428561f - 226.085709f;
+ case 5080: return _position.y * 0.905172408f - 162.241379f;
+ case 5100: return _position.y * 0.668016195f + 87.591095f;
+ case 5110: return _position.y * 1.142857194f - 170.571426f;
+ case 5160: return _position.y * 1.148148179f - 90.370369f;
+ case 5170: return _position.y * 0.536585391f + 165.243896f;
+ default: return 455;
+ }
+}
+
+bool RunawayRoomScene::loadDesertRoom() {
+ const RunawayRoom *room = findRunawayRoom(_room);
+ _desertHotspots.assign(room->hotspots, room->hotspots + room->hotspotCount);
+ struct Animation {
+ uint16 room;
+ byte chunk;
+ uint16 frames;
+ };
+ static const Animation animations[] = {
+ {5010, 9, 48}, {5010, 11, 186}, {5010, 14, 307}, {5010, 10, 700}, {5010, 12, 31}, {5010, 15, 1052},
+ {5020, 7, 947}, {5020, 4, 452}, {5020, 5, 667}, {5020, 6, 47}, {5020, 8, 662},
+ {5060, 15, 543}, {5060, 16, 411}, {5060, 17, 791}, {5060, 18, 769},
+ {5070, 5, 896}, {5070, 6, 945}, {5070, 7, 953}, {5070, 8, 551}, {5070, 4, 48},
+ {5080, 18, 769}, {5080, 17, 672}, {5080, 16, 455}, {5080, 20, 631}, {5080, 19, 533}, {5080, 15, 24},
+ {5100, 4, 1}, {5100, 7, 27}, {5100, 8, 89},
+ {5110, 8, 1}, {5110, 9, 2},
+ {5160, 4, 16}, {5160, 5, 24}, {5160, 6, 24}, {5160, 7, 93},
+ {5170, 6, 25}, {5170, 5, 24}, {5170, 4, 50}, {5170, 11, 3}
+ };
+ uint slot = 0;
+ for (uint i = 0; i < ARRAYSIZE(animations); ++i) {
+ if (animations[i].room == _room && !_desertAnimations[slot++].load(_archive, animations[i].chunk, animations[i].frames))
+ return false;
+ }
+ if (_room == 5050)
+ return loadForeground(0, 4) && loadForeground(1, 5);
+ if (_room == 5060)
+ return loadForeground(0, 8) && _npc.load(_archive, 7, 201);
+ if (_room == 5080)
+ return loadForeground(0, 11) && loadForeground(1, 12) && loadForeground(2, 13) && loadForeground(3, 14);
+ return true;
+}
+
+bool RunawayRoomScene::applyDesertBackground() {
+ switch (_room) {
+ case 5010:
+ return (!_desert.visited[4] || applyPatch(3)) && (!_desert.visited[6] || applyPatch(4)) &&
+ (!_desert.visited[2] || applyPatch(5)) && (!_desert.visited[5] || applyPatch(6)) && applyPatch(7);
+ case 5020:
+ return !_desert.bucketTaken || applyPatch(9);
+ case 5050:
+ return (!_desert.helmetTaken || applyPatch(6)) && (!_desert.beltTaken || applyPatch(7)) &&
+ (!_desert.gun || applyPatch(8));
+ case 5060:
+ return _desert.tanningOil != 2 || applyPatch(9);
+ case 5080:
+ return !_desert.antsDistracted || applyPatch(_desert.dynamite == 1 ? 7 : 8);
+ case 5100:
+ return (_desert.barnDoor != 2 || applyPatch(5)) && (_desert.peanutButter != 2 || applyPatch(6));
+ case 5110:
+ return _desert.barrel != 2 || applyPatch(13);
+ case 5160:
+ return (_desert.needle != 2 || applyPatch(8)) && (!_desert.glassesTaken || applyPatch(9)) &&
+ (_desert.lipstickShelf >= 2 || applyPatch(10)) &&
+ ((_desert.busDoor != 1 && _desert.busDoor != 3) || (applyPatch(11) && applyPatch(13))) &&
+ (_desert.busDoor != 2 || applyPatch(14));
+ case 5170:
+ return (_desert.vacuum != 2 || applyPatch(7)) && (!_desert.glassesTaken || applyPatch(8)) &&
+ (_desert.lipstickShelf != 2 || applyPatch(9)) && (_desert.lipstickShelf != 3 || applyPatch(10));
+ default: return true;
+ }
+}
+
+void RunawayRoomScene::updateDesertMaps() {
+ for (uint i = 0; i < 256; ++i) {
+ byte &id = _maps[256 + i];
+ switch (_room) {
+ case 5020:
+ if (_desert.bucketTaken && id == 7) id = 0;
+ break;
+ case 5050:
+ if ((_desert.helmetTaken && id == 2) || (_desert.beltTaken && id == 3)) id = 0;
+ break;
+ case 5060:
+ if (_desert.tanningOil == 2 && id == 6) id = 0;
+ break;
+ case 5070:
+ if (id == 3 || id == 8) id = _desert.dynamitePlaced ? 3 : 0;
+ break;
+ case 5080:
+ if (_desert.antsDistracted) {
+ if (id == 12) id = _desert.dynamite == 1 ? 5 : 0;
+ else if (id == 5 && _desert.dynamite == 2) id = 3;
+ }
+ break;
+ case 5110:
+ if (id == 8) id = _desert.bucket == 1 || _desert.bucket == 2 ? 8 : 4;
+ break;
+ case 5160:
+ if (_desert.needle == 2 && id == 9) id = 0;
+ break;
+ case 5170:
+ if (id == 5 && (_desert.busDoor == 0 || _desert.busDoor == 2)) id = 1;
+ if ((_desert.glassesTaken && id == 6) || (_desert.vacuum == 2 && id == 7)) id = 0;
+ if (id == 11) id = _desert.crank == 2 && _desert.busDoor != 1 ? 4 : 10;
+ if (id == 12) id = _desert.crank == 2 && _desert.busDoor == 1 ? 4 : 2;
+ break;
+ default: break;
+ }
+ }
+}
+
+Common::U32String RunawayRoomScene::desertHotspotName(byte id) const {
+ const RunawayHotspot *spot = hotspot(id);
+ if (!spot)
+ return Common::U32String();
+ if (_room == 5010) {
+ if (id == 1 && _desert.visited[4]) return Common::U32String("Oil well");
+ if (id == 3 && _desert.visited[6]) return Common::U32String("Hangar");
+ if (id == 4 && _desert.visited[2]) return Common::U32String("Airplane graveyard");
+ if (id == 5 && _desert.visited[5]) return Common::U32String("Railway yard");
+ }
+ if (_room == 5050 && id == 3 && _desert.beltSeen) return _inventory.name(14);
+ if (_room == 5060 && id == 6 && _desert.tanningOil) return _inventory.name(12);
+ if (_room == 5100 && id == 3 && _desert.peanutButter) return _inventory.name(19);
+ if (_room == 5100 && id == 8 && _desert.footrestSeen) return _inventory.name(21);
+ if (_room == 5100 && id == 12) return Common::U32String(_desert.beerSeen ? "Beer can" : "Can");
+ if (_room == 5110 && id == 1) return Common::U32String("Door");
+ if (_room == 5110 && id == 2) return Common::U32String("Door");
+ if (_room == 5110 && id == 5 && _desert.barrel) return Common::U32String("Barrel of gunpowder");
+ if (_room == 5170 && id == 3 && _desert.lipstickShelf && _desert.lipstickShelf < 3) return _inventory.name(11);
+ if (_room == 5170 && id == 4 && _desert.crank == 2) return Common::U32String("Makeshift crank");
+ if (_room == 5170 && id == 7 && _desert.vacuum) return _inventory.name(22);
+ if (_room == 5170 && id == 8 && _desert.necklacesSeen) return Common::U32String("Necklaces");
+ if (_room == 5170 && id == 9 && _desert.ringsSeen) return Common::U32String("Rings and earrings");
+ return Common::U32String(spot->name);
+}
+
+void RunawayRoomScene::drawDesertRoom(Graphics::ManagedSurface &viewport, bool foreground) {
+ if (foreground) {
+ if (_room == 5050) {
+ if (_position.x < 314) drawForeground(viewport, 0);
+ if (_position.x > 195 && _position.y < 465) drawForeground(viewport, 1);
+ } else if (_room == 5060 && _position.x < 670) {
+ drawForeground(viewport, 0);
+ } else if (_room == 5080) {
+ drawForeground(viewport, 0);
+ drawForeground(viewport, 1);
+ if (walkZone() == 15 || walkZone() == 16) drawForeground(viewport, 2);
+ if (walkZone() == 15) drawForeground(viewport, 3);
+ }
+ return;
+ }
+ for (uint i = 0; i < ARRAYSIZE(_desertAnimations); ++i) {
+ const RunawayAnimation &animation = _desertAnimations[i];
+ if (!animation.frameCount())
+ continue;
+ uint frame = (_now / 80) % animation.frameCount();
+ if (_room == 5110) {
+ if (!i && (_desert.bucket == 0 || _desert.bucket == 3)) continue;
+ frame = i ? (_desert.trainDoorOpen != 0) : 0;
+ } else if (_room == 5170) {
+ if (i == 0) frame = _desert.busDoor == 0 || _desert.busDoor == 2 ? 24 : 0;
+ if (i == 2) frame = 49;
+ if (i == 3) frame = _desert.crank == 2 ? (_desert.busDoor == 1 ? 1 : 2) : 0;
+ } else if (_room == 5160) {
+ if (i == 3) frame = 92;
+ } else if (_room == 5100) {
+ frame = 0;
+ }
+ animation.draw(viewport, frame, _camera.x, -_camera.y);
+ }
+ if (_room == 5060)
+ _npc.draw(viewport, 200, _camera.x, -_camera.y);
+}
+
+void RunawayRoomScene::setupDesertDepth(RunawayActor::RenderParams ¶ms) const {
+ switch (_room) {
+ case 5100:
+ params.depthY[1] = 599;
+ params.depthY[2] = 303;
+ params.depthY[3] = 446;
+ params.depthY[4] = 699;
+ break;
+ case 5110:
+ params.depthY[1] = 599;
+ params.depthY[2] = 408;
+ break;
+ case 5160:
+ params.depthY[1] = 599;
+ break;
+ case 5170:
+ params.depthY[4] = 599;
+ break;
+ default:
+ break;
+ }
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5020.cpp b/engines/hollywood/runaway/scene5020.cpp
new file mode 100644
index 00000000000..42517a397d2
--- /dev/null
+++ b/engines/hollywood/runaway/scene5020.cpp
@@ -0,0 +1,112 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Path", 1123, 416, 3, {302, 301}, {0, 1}},
+ {"", 456, 405, 7, {0, 1}, {0, 0}},
+ {"Rocking Chair", 573, 400, 7, {304, 305}, {0, 0}},
+ {"Tires", 644, 397, 1, {310, 311}, {0, 0}},
+ {"Door", 456, 405, 7, {306, 307}, {0, 0}},
+ {"Trap Door", 618, 386, 0, {308, 309}, {1, 1}},
+ {"Bucket", 605, 399, 7, {312, 313}, {1, 1}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5020, 303, 1, 0},
+ {5020, 305, 4, 0},
+ {5020, 306, 5, 0},
+ {5020, 307, 6, 0},
+ {5020, 308, 7, 0},
+ {5020, 310, 9, 0},
+ {5020, 311, 10, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5020, 1, 2, 303, true},
+ {5020, 2, 2, 303, true},
+ {5020, 3, 2, 303, true},
+ {5020, 4, 2, 303, true},
+ {5020, 5, 2, 303, true},
+ {5020, 6, 2, 303, true},
+ {5020, 7, 2, 303, true},
+ {5020, 8, 2, 303, true},
+ {5020, 9, 2, 303, true},
+ {5020, 10, 2, 303, true},
+ {5020, 11, 2, 303, true},
+ {5020, 12, 2, 303, true},
+ {5020, 13, 2, 303, true},
+ {5020, 14, 2, 303, true},
+ {5020, 15, 2, 303, true},
+ {5020, 16, 2, 303, true},
+ {5020, 17, 2, 303, true},
+ {5020, 18, 2, 303, true},
+ {5020, 19, 2, 303, true},
+ {5020, 20, 2, 303, true},
+ {5020, 21, 2, 303, true},
+ {5020, 22, 2, 303, true},
+ {5020, 23, 2, 303, true},
+ {5020, 24, 2, 303, true},
+ {5020, 25, 2, 303, true},
+ {5020, 26, 2, 303, true},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5020 = {
+ 5020, 1024, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {90, 85, 80}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(953, 406),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5020(uint16 action) {
+ switch (action) {
+ case 302:
+ leaveDesertRoom(5010);
+ break;
+ case 309:
+ if (!_desert.hatchSeen) {
+ _desert.hatchSeen = 1;
+ say(8);
+ }
+ leaveDesertRoom(5031);
+ break;
+ case 313:
+ _desert.bucketTaken = 1;
+ _inventory.add(25);
+ say(12);
+ return kBackgroundChanged;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5030.cpp b/engines/hollywood/runaway/scene5030.cpp
index 746e8985a4c..ebd272e2a1a 100644
--- a/engines/hollywood/runaway/scene5030.cpp
+++ b/engines/hollywood/runaway/scene5030.cpp
@@ -66,7 +66,7 @@ const SceneHotspot kHotspots[] = {
} // End of anonymous namespace
bool RunawayScene5030::load(uint16 entryScene) {
- if (entryScene != 5030)
+ if (entryScene != 5030 && !(_game == kRunawayFullGame && entryScene >= 5031 && entryScene <= 5032))
return false;
_entryScene = entryScene;
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
@@ -156,7 +156,8 @@ bool RunawayScene5030::loadRoomGraphics() {
void RunawayScene5030::start(uint32 now) {
_now = _lastUpdate = now;
resume();
- startAction(kIntroVideo);
+ if (_entryScene == 5030)
+ startAction(kIntroVideo);
}
void RunawayScene5030::resume() {
@@ -708,7 +709,13 @@ void RunawayScene5030::finishAction() {
if (completed == kPryHatch)
sayCue(34, 1);
} else if (completed == kEscape) {
- _escaped = true;
+ if (_game == kRunawayFullGame) {
+ _transition.scene = 5021;
+ _transition.position = Common::Point(618, 386);
+ _transition.facing = 3;
+ } else {
+ _escaped = true;
+ }
_audio.stopMusic();
_audio.stopEffect();
} else if (completed == kPeekDoor) {
diff --git a/engines/hollywood/runaway/scene5030.h b/engines/hollywood/runaway/scene5030.h
index c97f11e0965..3ee25380e56 100644
--- a/engines/hollywood/runaway/scene5030.h
+++ b/engines/hollywood/runaway/scene5030.h
@@ -63,7 +63,7 @@ public:
Common::U32String actionCaption(byte hotspot, RunawayVerb verb, byte item) const override;
const Common::U32String &committedCaption() const override { return _committedCaption; }
const Common::U32String &subtitle() const override { return _action == kPeekConversation ? _interrogation.subtitle() : _speech.subtitle(); }
- bool busy() const override { return _action != kNone; }
+ bool busy() const override { return _action != kNone || _transition.scene; }
bool speaking() const override { return _action == kPeekConversation ? _interrogation.speaking() : _speechRow != 0; }
byte speechFrame() const override { return _speech.frame(_now); }
void skipSpeech() override;
diff --git a/engines/hollywood/runaway/scene5050.cpp b/engines/hollywood/runaway/scene5050.cpp
new file mode 100644
index 00000000000..df7c8a48284
--- /dev/null
+++ b/engines/hollywood/runaway/scene5050.cpp
@@ -0,0 +1,148 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Path", -100, 510, 0, {302, 301}, {0, 1}},
+ {"Helmet", 303, 534, 1, {303, 304}, {0, 1}},
+ {"?", 251, 420, 1, {305, 306}, {0, 1}},
+ {"Machine Gun", 251, 420, 1, {307, 308}, {0, 1}},
+ {"Bullet Hole", 200, 450, 1, {309, 310}, {0, 0}},
+ {"Pilot'S Seat", 200, 450, 7, {311, 312}, {0, 0}},
+ {"Gunner'S Seat", 200, 450, 1, {313, 314}, {0, 0}},
+ {"String Of Bullets", 0, 0, 0, {0, 0}, {0, 0}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5050, 302, 1, 0},
+ {5050, 309, 8, 0},
+ {5050, 310, 9, 0},
+ {5050, 311, 10, 0},
+ {5050, 313, 12, 0},
+ {5050, 314, 13, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5050, 3, 4, 319, false},
+ {5050, 4, 4, 319, false},
+ {5050, 10, 4, 316, false},
+ {5050, 11, 4, 317, false},
+ {5050, 12, 4, 315, true},
+ {5050, 14, 4, 318, true},
+ {5050, 19, 4, 319, false},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5050 = {
+ 5050, 1024, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {90, 90, 80}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(130, 461),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5050(uint16 action) {
+ RunawaySaveState::DesertItems &items = _inventory.desert();
+ switch (action) {
+ case 302:
+ leaveDesertRoom(5010);
+ break;
+ case 304:
+ _desert.helmetTaken = 1;
+ _inventory.add(6);
+ say(3);
+ return kBackgroundChanged;
+ case 305:
+ say(4, _desert.beltSeen != 0);
+ _desert.beltSeen = 1;
+ break;
+ case 306:
+ _desert.beltTaken = 1;
+ _inventory.add(14);
+ say(5);
+ return kBackgroundChanged;
+ case 307:
+ say(6, _desert.gun);
+ _desert.gunSeen = 1;
+ break;
+ case 308:
+ say(7, _desert.gun);
+ _desert.gunSeen = 1;
+ break;
+ case 315:
+ if (_desert.gun)
+ say(14, 2);
+ else if (!_desert.gunSeen)
+ say(1, 0, true);
+ else {
+ say(14);
+ beginRoomAnimation(action, 11, 46);
+ }
+ break;
+ case 1315:
+ _desert.gun = 1;
+ say(14, 1);
+ say(14, 3);
+ return kBackgroundChanged;
+ case 316:
+ say(15, items.lipstick != 0);
+ break;
+ case 317:
+ say(16, items.lipsticks != 0);
+ break;
+ case 318:
+ if (items.belt < 2)
+ say(17, items.belt);
+ else if (!_desert.gun)
+ say(17, 2);
+ else {
+ say(17, 3);
+ beginRoomAnimation(action, 12, 37);
+ }
+ break;
+ case 1318:
+ _desert.gun = 2;
+ items.gunReady = 1;
+ _inventory.remove(14);
+ say(17, 4);
+ if (items.bombReady && items.helicopterReady) {
+ say(174, 4, true);
+ leaveDesertRoom(5062);
+ }
+ return kBackgroundChanged;
+ case 319:
+ say(18, _desert.gun != 0);
+ break;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5060.cpp b/engines/hollywood/runaway/scene5060.cpp
new file mode 100644
index 00000000000..e53cec1798b
--- /dev/null
+++ b/engines/hollywood/runaway/scene5060.cpp
@@ -0,0 +1,82 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Path", 1479, 599, 0, {301, 302}, {0, 1}},
+ {"Lula", 349, 442, 7, {303, 304}, {0, 1}},
+ {"Mariola", 878, 477, 0, {305, 306}, {0, 0}},
+ {"Inside Of The Bus", 679, 448, 1, {307, 308}, {0, 1}},
+ {"Trunk", 376, 445, 1, {309, 310}, {1, 1}},
+ {"Bottle", 878, 477, 0, {311, 312}, {1, 1}},
+ {"Chair", 383, 446, 5, {313, 314}, {0, 0}},
+ {"?", 349, 442, 5, {315, 316}, {0, 0}},
+ {"Sunglasses", 878, 477, 0, {317, 318}, {0, 0}},
+ {"Tanning Oil", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Lawn Chair", 0, 0, 0, {0, 0}, {0, 0}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5060, 301, 1, 0},
+ {5060, 315, 12, 0},
+ {5060, 316, 13, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5060, 15, 2, 319, false},
+ {5060, 20, 9, 320, true},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5060 = {
+ 5060, 1380, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {100, 95, 90}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(954, 506),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5060(uint16 action) {
+ switch (action) {
+ case 302:
+ leaveDesertRoom(5010);
+ break;
+ case 308:
+ beginRoomAnimation(action, 5, 22);
+ break;
+ case 1308:
+ leaveDesertRoom(5170);
+ break;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5070.cpp b/engines/hollywood/runaway/scene5070.cpp
new file mode 100644
index 00000000000..4b10cdd4744
--- /dev/null
+++ b/engines/hollywood/runaway/scene5070.cpp
@@ -0,0 +1,136 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Path", 1472, 495, 0, {302, 301}, {0, 1}},
+ {"Mariola", 0, 0, 7, {1, 1}, {0, 0}},
+ {"Detonator", 1122, 509, 7, {305, 306}, {0, 0}},
+ {"Oil Well", 301, 264, 7, {307, 308}, {0, 0}},
+ {"Tree", 0, 0, 0, {309, 310}, {0, 0}},
+ {"Rock", 0, 0, 7, {313, 314}, {0, 0}},
+ {"Puddle Of Oil", 287, 312, 7, {315, 316}, {1, 0}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5070, 302, 1, 0},
+ {5070, 307, 4, 0},
+ {5070, 308, 5, 0},
+ {5070, 309, 6, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5070, 5, 4, 311, true},
+ {5070, 20, 7, 317, false},
+ {5070, 25, 4, 312, false},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5070 = {
+ 5070, 1372, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {100, 95, 90}, {80, 75, 70}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(1245, 495),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5070(uint16 action) {
+ RunawaySaveState::DesertItems &items = _inventory.desert();
+ switch (action) {
+ case 301:
+ leaveDesertRoom(5010);
+ break;
+ case 305:
+ say(2, _random.getRandomBit());
+ break;
+ case 306: {
+ const byte variation = _random.getRandomBit();
+ say(3, variation);
+ if (variation)
+ say(3, 2);
+ break;
+ }
+ case 310:
+ say(5, 0, true);
+ break;
+ case 311:
+ say(7);
+ beginRoomAnimation(action, 11, 40);
+ break;
+ case 1311:
+ _desert.dynamitePlaced = 1;
+ items.bombReady = 1;
+ _inventory.remove(5);
+ say(7, 1);
+ if (items.gunReady && items.helicopterReady) {
+ say(174, 4, true);
+ leaveDesertRoom(5062);
+ }
+ return kBackgroundChanged;
+ case 312:
+ if (items.bucket != 1)
+ say(17, 0, true);
+ else
+ say(8, _desert.dynamitePlaced != 0);
+ break;
+ case 313:
+ say(9, _desert.dynamitePlaced != 0);
+ break;
+ case 314:
+ say(10);
+ break;
+ case 315:
+ say(11, _desert.oilSeen != 0);
+ _desert.oilSeen = 1;
+ break;
+ case 316:
+ if (!_desert.oilSeen)
+ execute5070(315);
+ say(12);
+ break;
+ case 317:
+ if (items.glasses)
+ say(13, items.glasses + 1);
+ else {
+ say(13);
+ beginRoomAnimation(action, 9, 29);
+ }
+ break;
+ case 1317:
+ items.glasses = 1;
+ _inventory.select(0);
+ say(13, 1);
+ break;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5080.cpp b/engines/hollywood/runaway/scene5080.cpp
new file mode 100644
index 00000000000..91e5b2b4e16
--- /dev/null
+++ b/engines/hollywood/runaway/scene5080.cpp
@@ -0,0 +1,150 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Path", -100, 484, 7, {302, 301}, {0, 1}},
+ {"Wooden Box", 103, 518, 1, {303, 304}, {1, 0}},
+ {"Shed", 301, 478, 7, {305, 307}, {0, 1}},
+ {"Door", 301, 478, 7, {306, 307}, {0, 1}},
+ {"Explosives", 301, 478, 7, {308, 309}, {0, 1}},
+ {"Water Tank", 620, 357, 7, {310, 311}, {0, 0}},
+ {"Train Car", 987, 378, 1, {312, 313}, {0, 1}},
+ {"Train Car Interior", 987, 378, 1, {312, 313}, {1, 1}},
+ {"Ant-Hill", 67, 512, 0, {316, 317}, {0, 0}},
+ {"Sign", 255, 546, 7, {318, 319}, {1, 0}},
+ {"Ladder", 620, 357, 7, {320, 321}, {0, 0}},
+ {"Sawdust", 0, 0, 0, {0, 0}, {0, 0}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5080, 302, 1, 0},
+ {5080, 308, 7, 0},
+ {5080, 310, 9, 0},
+ {5080, 311, 10, 0},
+ {5080, 319, 16, 0},
+ {5080, 320, 17, 0},
+ {5080, 321, 18, 0},
+ {5080, 324, 19, 0},
+ {5080, 325, 20, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5080, 0, 6, 325, false},
+ {5080, 2, 4, 324, false},
+ {5080, 6, 3, 326, false},
+ {5080, 6, 4, 326, false},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5080 = {
+ 5080, 1432, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {100, 95, 90}, {80, 75, 70}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(128, 526),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5080(uint16 action) {
+ RunawaySaveState::DesertItems &items = _inventory.desert();
+ switch (action) {
+ case 301:
+ leaveDesertRoom(5010);
+ break;
+ case 303:
+ say(2);
+ break;
+ case 305:
+ say(4, _desert.antsDistracted);
+ break;
+ case 306:
+ say(5, _desert.shedTried);
+ break;
+ case 307:
+ if (_desert.antsDistracted) {
+ say(14, 0, true);
+ } else {
+ beginRoomAnimation(action, 25, 28);
+ }
+ break;
+ case 1307:
+ say(6, _desert.shedTried);
+ _desert.shedTried = 1;
+ break;
+ case 309:
+ _desert.dynamite = 2;
+ _inventory.add(5);
+ say(8);
+ return kBackgroundChanged;
+ case 313:
+ if (!_desert.trainEntered) {
+ say(12);
+ _desert.trainEntered = 1;
+ }
+ beginRoomAnimationRange(action, 23, 35, 0, 27);
+ break;
+ case 1313:
+ leaveDesertRoom(5110);
+ break;
+ case 316:
+ say(13, _desert.antsDistracted ? 2 : 0);
+ break;
+ case 317:
+ if (_desert.antsDistracted) {
+ say(14, 2);
+ } else {
+ say(14);
+ say(14, 1);
+ }
+ break;
+ case 326:
+ if (!items.antTrickKnown) {
+ say(3, 0, true);
+ } else if (items.helmet != 3) {
+ say(17, 0, true);
+ } else {
+ say(21);
+ walkTo(Common::Point(564, 497), 7, true);
+ beginRoomAnimation(action, 26, 38);
+ }
+ break;
+ case 1326:
+ _desert.antsDistracted = 1;
+ _desert.dynamite = 1;
+ items.helmet = 4;
+ for (byte variation = 1; variation <= 4; ++variation)
+ say(21, variation);
+ return kBackgroundChanged;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5100.cpp b/engines/hollywood/runaway/scene5100.cpp
new file mode 100644
index 00000000000..43ddc8194b4
--- /dev/null
+++ b/engines/hollywood/runaway/scene5100.cpp
@@ -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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Path", 1279, 267, 0, {301, 302}, {0, 1}},
+ {"Barn Doors", 1259, 354, 7, {303, 304}, {1, 0}},
+ {"Bottle", 0, 0, 0, {305, 306}, {1, 1}},
+ {"Window", 1279, 267, 4, {1, 302}, {0, 1}},
+ {"Motorcycle", 164, 581, 0, {307, 308}, {1, 0}},
+ {"Stud", 0, 0, 7, {309, 310}, {1, 1}},
+ {"?", 0, 0, 4, {311, 312}, {0, 0}},
+ {"Piece Of Metal", 0, 0, 7, {313, 314}, {0, 1}},
+ {"Barrel", 0, 0, 1, {315, 316}, {1, 0}},
+ {"Barrel", 0, 0, 4, {317, 318}, {0, 0}},
+ {"Helicopter", 0, 0, 7, {319, 320}, {0, 0}},
+ {"?", 253, 418, 4, {321, 322}, {0, 0}},
+ {"Bucket", 0, 0, 1, {323, 324}, {1, 0}},
+ {"", 253, 418, 4, {0, 1}, {0, 0}},
+ {"", 1053, 403, 3, {0, 1}, {0, 0}},
+ {"Beer Can", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Peanut Butter", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Foot Rest", 0, 0, 0, {0, 0}, {0, 0}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5100, 308, 16, 0},
+ {5100, 311, 18, 0},
+ {5100, 312, 19, 0},
+ {5100, 316, 22, 0},
+ {5100, 318, 24, 0},
+ {5100, 319, 25, 0},
+ {5100, 320, 26, 0},
+ {5100, 322, 8, 0},
+ {5100, 324, 28, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5100, 2, 5, 327, true},
+ {5100, 9, 6, 16, false},
+ {5100, 9, 12, 328, true},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5100 = {
+ 5100, 1880, 700, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {100, 95, 90}, {60, 55, 50}, {90, 85, 80}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(1279, 267),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5100(uint16 action) {
+ if (action != 302)
+ return kUnhandled;
+ leaveDesertRoom(5010);
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5110.cpp b/engines/hollywood/runaway/scene5110.cpp
new file mode 100644
index 00000000000..d6d75abc187
--- /dev/null
+++ b/engines/hollywood/runaway/scene5110.cpp
@@ -0,0 +1,185 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"?", 327, 441, 7, {301, 302}, {0, 1}},
+ {"?", 574, 434, 1, {303, 304}, {1, 0}},
+ {"Chain", 801, 441, 3, {305, 306}, {0, 0}},
+ {"Contraptions", 517, 374, 0, {307, 308}, {0, 0}},
+ {"Barrel", 510, 377, 0, {309, 310}, {1, 1}},
+ {"Bucket", 365, 485, 5, {311, 312}, {1, 1}},
+ {"Clock", 801, 441, 3, {313, 314}, {0, 0}},
+ {"Bucket", 510, 377, 0, {320, 321}, {0, 1}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5110, 301, 1, 0},
+ {5110, 305, 4, 0},
+ {5110, 306, 5, 0},
+ {5110, 307, 6, 0},
+ {5110, 308, 7, 0},
+ {5110, 313, 12, 0},
+ {5110, 314, 13, 0},
+ {5110, 315, 14, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5110, 2, 2, 319, true},
+ {5110, 2, 3, 318, false},
+ {5110, 2, 5, 315, false},
+ {5110, 4, 5, 324, false},
+ {5110, 6, 5, 323, false},
+ {5110, 7, 5, 316, false},
+ {5110, 17, 5, 317, true},
+ {5110, 25, 5, 322, true},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5110 = {
+ 5110, 1024, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {75, 70, 65}, {65, 60, 55}, {55, 50, 45}, {45, 40, 35}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(327, 441),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5110(uint16 action) {
+ RunawaySaveState::DesertItems &items = _inventory.desert();
+ switch (action) {
+ case 302:
+ leaveDesertRoom(5081);
+ break;
+ case 303:
+ say(2, _desert.trainDoorOpen != 0);
+ break;
+ case 309:
+ say(8, _desert.barrel);
+ if (!_desert.barrel)
+ _desert.barrel = 1;
+ break;
+ case 310:
+ if (!_desert.barrel)
+ execute5110(309);
+ say(9, _desert.barrel == 2);
+ break;
+ case 311:
+ say(10, _desert.screwSeen != 0);
+ _desert.screwSeen = 1;
+ break;
+ case 312:
+ if (_desert.screwTaken)
+ say(11, 2);
+ else {
+ if (!_desert.screwSeen)
+ execute5110(311);
+ say(11);
+ _inventory.add(7);
+ _desert.screwTaken = 1;
+ say(11, 1);
+ }
+ break;
+ case 316:
+ say(16);
+ _desert.powderNeeded = 1;
+ break;
+ case 317:
+ if (!_desert.bucket) {
+ say(17);
+ _desert.powderNeeded = 1;
+ } else if (_desert.bucket == 1) {
+ say(17, 1);
+ beginRoomAnimation(action, 12, 121);
+ } else {
+ say(17, 3);
+ }
+ break;
+ case 1317:
+ _desert.barrel = 2;
+ _desert.bucket = 2;
+ say(17, 2);
+ return kBackgroundChanged;
+ case 319:
+ if (_desert.trainDoorOpen)
+ say(18, 3);
+ else {
+ say(18);
+ beginRoomAnimation(action, 10, 49);
+ }
+ break;
+ case 1319:
+ _desert.trainDoorOpen = 1;
+ say(18, 1);
+ _inventory.add(18);
+ say(18, 2);
+ return kBackgroundChanged;
+ case 320:
+ say(19, _desert.bucket != 1);
+ break;
+ case 321:
+ if (_desert.bucket == 1)
+ say(20);
+ else {
+ _desert.bucket = 3;
+ items.bucket = 1;
+ _inventory.add(25);
+ say(20, 1);
+ return kBackgroundChanged;
+ }
+ break;
+ case 322:
+ if (!_desert.powderNeeded)
+ say(21);
+ else if (_desert.bucket)
+ say(17, 3);
+ else {
+ say(21, 1);
+ beginRoomAnimation(action, 11, 49);
+ }
+ break;
+ case 1322:
+ _desert.bucket = 1;
+ _inventory.remove(25);
+ return kBackgroundChanged;
+ case 323:
+ if (!_desert.powderNeeded)
+ say(14, 0, true);
+ else
+ say(22, items.helmet == 0);
+ break;
+ case 324:
+ say(_desert.powderNeeded ? 23 : 14, 0, !_desert.powderNeeded);
+ break;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5160.cpp b/engines/hollywood/runaway/scene5160.cpp
new file mode 100644
index 00000000000..91745b8a994
--- /dev/null
+++ b/engines/hollywood/runaway/scene5160.cpp
@@ -0,0 +1,191 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Front Of The Bus", 556, 310, 0, {301, 302}, {0, 1}},
+ {"Refrigerator", 629, 403, 1, {303, 304}, {0, 0}},
+ {"Carla", 578, 466, 5, {305, 306}, {0, 1}},
+ {"Glass", 488, 415, 5, {307, 308}, {0, 0}},
+ {"Grating", 536, 417, 0, {309, 310}, {1, 0}},
+ {"Boots", 229, 475, 7, {311, 312}, {0, 0}},
+ {"Bull", 629, 403, 1, {315, 316}, {0, 0}},
+ {"Painting", 229, 475, 7, {317, 318}, {0, 0}},
+ {"Needle And Thread", 229, 475, 7, {313, 314}, {1, 1}},
+ {"Front Of The Bus", 556, 310, 0, {301, 302}, {0, 1}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5160, 301, 1, 0},
+ {5160, 308, 6, 0},
+ {5160, 310, 8, 0},
+ {5160, 311, 9, 0},
+ {5160, 312, 10, 0},
+ {5160, 316, 14, 0},
+ {5160, 318, 16, 0},
+ {5160, 321, 19, 0},
+ {5160, 323, 21, 0},
+ {5160, 324, 22, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5160, 4, 3, 323, false},
+ {5160, 9, 3, 321, false},
+ {5160, 9, 4, 324, false},
+ {5160, 22, 5, 320, true},
+ {5160, 26, 2, 319, true},
+ {5160, 26, 3, 322, false},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5160 = {
+ 5160, 1024, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {85, 77, 85}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(519, 438),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+void RunawayRoomScene::startCarlaConversation() {
+ static const DialogueChoice choices[][8] = {
+ {{1,0,1,1,1,1,255}, {1,0,3,2,2,1,255}, {0,1,1,3,3,1,255}, {1,0,3,4,4,1,255}, {1,0,0,5,5,0,0}},
+ {{1,0,3,6,6,1,255}, {1,0,3,7,7,2,255}, {1,0,3,8,8,1,255}, {1,0,3,14,14,1,255}, {1,0,2,9,9,0,0}},
+ {{1,1,3,10,10,1,255}, {1,1,3,11,11,1,255}, {1,1,3,12,12,1,255}, {1,0,2,13,13,0,0}}
+ };
+ _conversation = 4;
+ _dialogueDepth = _dialogueNode = _dialogueIntro = 0;
+ _dialogueEnding = false;
+ _choices.clear();
+ _choiceIndices.clear();
+ memset(_dialogue, 0, sizeof(_dialogue));
+ memcpy(_dialogue[0], choices[0], sizeof(choices[0]));
+ memcpy(_dialogue[10], choices[1], sizeof(choices[1]));
+ memcpy(_dialogue[11], choices[2], sizeof(choices[2]));
+ _dialogue[0][2].enabled = _desert.fridgeSeen && !_desert.fridgeOpened;
+ _dialogue[10][1].enabled = !_desert.ventCleaned;
+ say(80);
+ say(90, 0, false, 1);
+}
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5160(uint16 action) {
+ switch (action) {
+ case 302:
+ leaveDesertRoom(5171);
+ break;
+ case 303:
+ say(2, _desert.fridgeOpened);
+ _desert.fridgeSeen = 1;
+ break;
+ case 304:
+ say(3, _inventory.contains(26));
+ break;
+ case 305:
+ say(4, _random.getRandomNumber(_desert.carlaStory ? 3 : 2));
+ break;
+ case 306:
+ startCarlaConversation();
+ break;
+ case 307:
+ say(5, _random.getRandomNumber(1));
+ break;
+ case 309:
+ say(7, !_desert.ventSeen ? 0 : _desert.ventCleaned ? 2 : 1);
+ break;
+ case 313:
+ say(11, _desert.needle != 0);
+ if (!_desert.needle)
+ _desert.needle = 1;
+ break;
+ case 314:
+ if (!_desert.needle)
+ execute5160(313);
+ say(12);
+ _inventory.add(16);
+ _desert.needle = 2;
+ say(12, 1);
+ return kBackgroundChanged;
+ case 315:
+ say(13, _random.getRandomNumber(1));
+ break;
+ case 319:
+ if (!_desert.fridgeOpened)
+ say(17);
+ beginRoomAnimationRange(action, 15, 73, 0, 54);
+ break;
+ case 1319:
+ if (!_desert.fridgeOpened) {
+ say(17, 1);
+ _inventory.add(4);
+ say(17, 2);
+ } else {
+ say(17, 4);
+ }
+ deferDesertAction(419);
+ break;
+ case 419: {
+ static const byte frames[] = {
+ 54, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
+ };
+ beginRoomAnimation(action, 15, 73, frames, ARRAYSIZE(frames));
+ break;
+ }
+ case 1419:
+ if (!_desert.fridgeOpened) {
+ _desert.fridgeOpened = 1;
+ say(17, 3);
+ }
+ break;
+ case 320:
+ if (!_desert.ventSeen)
+ say(18);
+ else if (_desert.ventCleaned)
+ say(18, 4);
+ else {
+ say(18, 1);
+ beginRoomAnimation(action, 16, 40);
+ }
+ break;
+ case 1320:
+ say(18, 2);
+ _inventory.add(9);
+ _inventory.desert().pill = 1;
+ _desert.ventCleaned = 1;
+ say(18, 3);
+ break;
+ case 322:
+ say(20, _desert.fridgeOpened);
+ break;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5170.cpp b/engines/hollywood/runaway/scene5170.cpp
new file mode 100644
index 00000000000..4d4fb81965c
--- /dev/null
+++ b/engines/hollywood/runaway/scene5170.cpp
@@ -0,0 +1,198 @@
+/* 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 3 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, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/util.h"
+#include "hollywood/runaway/scene.h"
+#include "hollywood/runaway/scene_data.h"
+
+namespace Hollywood {
+namespace {
+
+const RunawayHotspot kHotspots[] = {
+ {"", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Outside Of The Bus", 339, 512, 7, {301, 302}, {0, 0}},
+ {"Back Of The Bus", 666, 303, 0, {303, 304}, {0, 1}},
+ {"Right-Hand Shelf", 727, 436, 1, {305, 306}, {1, 1}},
+ {"Axle", 649, 499, 4, {307, 308}, {0, 1}},
+ {"Pocket", 113, 540, 5, {309, 310}, {1, 1}},
+ {"Sunglasses", 727, 436, 1, {311, 312}, {0, 1}},
+ {"Item Under Bed", 462, 448, 7, {313, 314}, {1, 1}},
+ {"Middle Shelf", 727, 436, 1, {315, 316}, {1, 0}},
+ {"Left-Hand Shelf", 727, 436, 1, {317, 318}, {1, 0}},
+ {"Back Of The Bus", 666, 303, 0, {303, 304}, {0, 1}},
+ {"Door", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Pile Of Lipstick", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Makeshift Crank", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Handle", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Necklaces", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Rings And Earrings", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Outside Of The Bus", 0, 0, 0, {0, 0}, {0, 0}},
+ {"Right-Hand Shelf", 0, 0, 0, {0, 0}, {0, 0}},
+};
+
+const RunawayResponse kResponses[] = {
+ {5170, 311, 10, 0},
+ {5170, 319, 18, 0},
+};
+
+const RunawayItemAction kItemActions[] = {
+ {5170, 10, 3, 319, false},
+ {5170, 11, 3, 319, false},
+ {5170, 21, 4, 320, true},
+ {5170, 26, 5, 15, false},
+};
+
+} // End of anonymous namespace
+
+const RunawayRoom kRunawayScene5170 = {
+ 5170, 1024, 600, kHotspots, ARRAYSIZE(kHotspots), {{100, 100, 100}, {80, 72, 80}, {80, 72, 80}, {85, 77, 85}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}, {100, 100, 100}},
+ Common::Point(339, 512),
+ kResponses, ARRAYSIZE(kResponses),
+ kItemActions, ARRAYSIZE(kItemActions),
+ nullptr, 0
+};
+
+RunawayRoomScene::ActionResult RunawayRoomScene::execute5170(uint16 action) {
+ switch (action) {
+ case 301:
+ say(1, _desert.busDoor != 0);
+ break;
+ case 302:
+ if (_desert.busDoor == 0 || _desert.busDoor == 2)
+ leaveDesertRoom(5061);
+ else
+ say(2);
+ break;
+ case 304:
+ leaveDesertRoom(5160);
+ break;
+ case 305:
+ say(4, _desert.lipstickShelf == 0 ? 0 : _desert.lipstickShelf == 3 ? 2 : 1);
+ if (!_desert.lipstickShelf)
+ _desert.lipstickShelf = 1;
+ break;
+ case 306:
+ if (_desert.lipstickShelf < 2) {
+ say(5);
+ _inventory.add(10);
+ _desert.lipstickShelf = 2;
+ say(5, 1);
+ } else if (_desert.lipstickShelf == 2) {
+ if (!_inventory.desert().lipstick) {
+ say(5, 2);
+ } else {
+ say(5, 3);
+ _inventory.add(11);
+ _desert.lipstickShelf = 3;
+ say(5, 4);
+ }
+ } else {
+ say(5, 5);
+ }
+ return kBackgroundChanged;
+ case 307:
+ say(6, _desert.crank != 0);
+ if (!_desert.crank)
+ _desert.crank = 1;
+ break;
+ case 308:
+ if (_desert.crank < 2) {
+ say(7);
+ } else {
+ beginRoomAnimation(action, 13, 29);
+ _audio.playEffect(_desert.busDoor == 1 ? 65 : 64);
+ }
+ break;
+ case 1308:
+ if (!_desert.busDoor)
+ say(7, 1);
+ _desert.busDoor = _desert.busDoor == 1 ? 2 : 1;
+ return kBackgroundChanged;
+ case 309:
+ say(8);
+ walkTo(Common::Point(339, 512), 3, true);
+ break;
+ case 310:
+ if (_desert.keyTaken) {
+ say(9, 2);
+ } else {
+ say(9);
+ _inventory.add(26);
+ _desert.keyTaken = 1;
+ if (_desert.fridgeSeen)
+ say(9, 1);
+ else
+ say(18, _random.getRandomNumber(2), true);
+ walkTo(Common::Point(340, 511), 3, true);
+ }
+ break;
+ case 312:
+ say(11);
+ _inventory.add(20);
+ _desert.glassesTaken = 1;
+ say(11, 1);
+ return kBackgroundChanged;
+ case 313:
+ say(12, _desert.vacuum != 0);
+ if (!_desert.vacuum)
+ _desert.vacuum = 1;
+ break;
+ case 314:
+ if (!_desert.vacuum)
+ say(12);
+ _inventory.add(22);
+ _desert.vacuum = 2;
+ say(13);
+ return kBackgroundChanged;
+ case 315:
+ say(14, _desert.necklacesSeen);
+ _desert.necklacesSeen = 1;
+ break;
+ case 316:
+ if (!_desert.necklacesSeen)
+ execute5170(315);
+ say(15);
+ break;
+ case 317:
+ say(16, _desert.ringsSeen);
+ _desert.ringsSeen = 1;
+ break;
+ case 318:
+ if (!_desert.ringsSeen)
+ execute5170(317);
+ say(17);
+ break;
+ case 320:
+ say(19);
+ beginRoomAnimation(action, 12, 42);
+ break;
+ case 1320:
+ _inventory.remove(21);
+ _desert.crank = 2;
+ say(19, 1);
+ return kBackgroundChanged;
+ default:
+ return kUnhandled;
+ }
+ return kHandled;
+}
+
+} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene_data.h b/engines/hollywood/runaway/scene_data.h
index f04e5eb3a3c..930b3a40fbd 100644
--- a/engines/hollywood/runaway/scene_data.h
+++ b/engines/hollywood/runaway/scene_data.h
@@ -92,6 +92,16 @@ extern const RunawayRoom kRunawayScene4070;
extern const RunawayRoom kRunawayScene4090;
extern const RunawayRoom kRunawayScene4100;
extern const RunawayRoom kRunawayScene4140;
+extern const RunawayRoom kRunawayScene5010;
+extern const RunawayRoom kRunawayScene5020;
+extern const RunawayRoom kRunawayScene5050;
+extern const RunawayRoom kRunawayScene5060;
+extern const RunawayRoom kRunawayScene5070;
+extern const RunawayRoom kRunawayScene5080;
+extern const RunawayRoom kRunawayScene5100;
+extern const RunawayRoom kRunawayScene5110;
+extern const RunawayRoom kRunawayScene5160;
+extern const RunawayRoom kRunawayScene5170;
const RunawayRoom *findRunawayRoom(uint16 number);
Commit: abd510c40d60bce1a3d81d0a49d70f19f03d412a
https://github.com/scummvm/scummvm/commit/abd510c40d60bce1a3d81d0a49d70f19f03d412a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-11-19T12:21:07+01:00
Commit Message:
HOLLYWOOD: RUNAWAY: implemented another 5xxx batch
Changed paths:
engines/hollywood/runaway/inventory.cpp
engines/hollywood/runaway/scene.h
engines/hollywood/runaway/scene5010.cpp
engines/hollywood/runaway/scene5030.cpp
engines/hollywood/runaway/scene5060.cpp
engines/hollywood/runaway/scene5100.cpp
diff --git a/engines/hollywood/runaway/inventory.cpp b/engines/hollywood/runaway/inventory.cpp
index e4463a611bd..4787c1f73e3 100644
--- a/engines/hollywood/runaway/inventory.cpp
+++ b/engines/hollywood/runaway/inventory.cpp
@@ -168,12 +168,18 @@ Common::U32String RunawayInventory::name(byte item) const {
uint RunawayInventory::icon(byte item) const {
if (_chapter == 2) {
- if (item == 7 && _museum.restoredCrucifix) return 24;
- if (item == 14 && _museum.coffee) return 20 + _museum.coffee;
- if (item == 6 && _museum.frozenBattery) return 25;
- if (item == 11 && _museum.rubyRemoved) return 20;
- if (item == 18 && _museum.batteryInLadle) return 23;
- if (item == 19 && _museum.packageFilled) return 26;
+ if (item == 7 && _museum.restoredCrucifix)
+ return 24;
+ if (item == 14 && _museum.coffee)
+ return 20 + _museum.coffee;
+ if (item == 6 && _museum.frozenBattery)
+ return 25;
+ if (item == 11 && _museum.rubyRemoved)
+ return 20;
+ if (item == 18 && _museum.batteryInLadle)
+ return 23;
+ if (item == 19 && _museum.packageFilled)
+ return 26;
}
if (_chapter == 1) {
if (item == 15 && _syringeFilled)
@@ -230,12 +236,18 @@ uint RunawayInventory::cursor(byte item) const {
static const byte helmetCursors[] = {51, 53, 115, 117, 119};
return helmetCursors[_desert.helmet];
}
- if (item == 14) return _desert.belt == 1 ? 113 : _desert.belt == 2 ? 71 : 69;
- if (item == 15) return _desert.ball == 2 ? 73 : 75 + _desert.ball * 2;
- if (item == 19 && _desert.helmet >= 3) return 121;
- if (item == 20 && _desert.glasses == 1) return 89;
- if (item == 23) return 95 + 2 * (_desert.gunReady + _desert.bombReady + _desert.helicopterReady);
- if (item == 25 && _desert.bucket == 1) return 123;
+ if (item == 14)
+ return _desert.belt == 1 ? 113 : _desert.belt == 2 ? 71 : 69;
+ if (item == 15)
+ return _desert.ball == 2 ? 73 : 75 + _desert.ball * 2;
+ if (item == 19 && _desert.helmet >= 3)
+ return 121;
+ if (item == 20 && _desert.glasses == 1)
+ return 89;
+ if (item == 23)
+ return 95 + 2 * (_desert.gunReady + _desert.bombReady + _desert.helicopterReady);
+ if (item == 25 && _desert.bucket == 1)
+ return 123;
return item <= kItemCount ? kItemCursors[item] : 0;
}
@@ -257,14 +269,30 @@ RunawayInventory::Reply RunawayInventory::examine(byte item) const {
return Reply();
byte variation = 0;
switch (item) {
- case 5: variation = _museum.voiceRecorded; break;
- case 6: variation = _museum.frozenBattery; break;
- case 7: variation = _museum.restoredCrucifix; break;
- case 8: case 11: variation = _museum.rubyRemoved; break;
- case 14: variation = _museum.coffee; break;
- case 18: variation = _museum.batteryInLadle; break;
- case 19: variation = _museum.packageFilled; break;
- default: break;
+ case 5:
+ variation = _museum.voiceRecorded;
+ break;
+ case 6:
+ variation = _museum.frozenBattery;
+ break;
+ case 7:
+ variation = _museum.restoredCrucifix;
+ break;
+ case 8:
+ case 11:
+ variation = _museum.rubyRemoved;
+ break;
+ case 14:
+ variation = _museum.coffee;
+ break;
+ case 18:
+ variation = _museum.batteryInLadle;
+ break;
+ case 19:
+ variation = _museum.packageFilled;
+ break;
+ default:
+ break;
}
return Reply(item < 5 ? 49 + item : 95 + item, variation);
}
@@ -272,15 +300,32 @@ RunawayInventory::Reply RunawayInventory::examine(byte item) const {
return Reply(item && item <= 19 ? (item == 3 ? 74 : 49 + item) : 1);
byte variation = 0;
switch (item) {
- case 1: variation = _clothState; break;
- case 6: variation = _desert.helmet; break;
- case 10: variation = _desert.lipstick; break;
- case 11: variation = _desert.lipsticks; break;
- case 14: variation = _desert.belt; break;
- case 15: variation = _desert.ball; break;
- case 20: variation = _desert.glasses; break;
- case 25: variation = _desert.bucket == 1; break;
- default: break;
+ case 1:
+ variation = _clothState;
+ break;
+ case 6:
+ variation = _desert.helmet;
+ break;
+ case 10:
+ variation = _desert.lipstick;
+ break;
+ case 11:
+ variation = _desert.lipsticks;
+ break;
+ case 14:
+ variation = _desert.belt;
+ break;
+ case 15:
+ variation = _desert.ball;
+ break;
+ case 20:
+ variation = _desert.glasses;
+ break;
+ case 25:
+ variation = _desert.bucket == 1;
+ break;
+ default:
+ break;
}
return Reply(item && item <= kItemCount ? kExamineCues[item] : 1, variation);
}
@@ -363,9 +408,12 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
_museum.packageFilled = 1;
return Reply(121, 1);
}
- if (first == 9 || second == 9) return Reply(118);
- if (first == 10 || second == 10) return Reply(119);
- if (first == 15 || second == 15) return Reply(122);
+ if (first == 9 || second == 9)
+ return Reply(118);
+ if (first == 10 || second == 10)
+ return Reply(119);
+ if (first == 15 || second == 15)
+ return Reply(122);
return Reply();
}
if (_chapter != 3)
@@ -384,26 +432,32 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
return Reply(183, 1);
}
if (first == 4 && second == 6) {
- if (!_desert.antTrickKnown) return Reply(14);
+ if (!_desert.antTrickKnown)
+ return Reply(14);
_desert.helmet = 1;
remove(4);
return Reply(178);
}
if (first == 6 && second == 18) {
- if (!_desert.antTrickKnown) return Reply(14);
- if (!_desert.helmet) return Reply(190);
+ if (!_desert.antTrickKnown)
+ return Reply(14);
+ if (!_desert.helmet)
+ return Reply(190);
_desert.helmet = 2;
remove(18);
return Reply(190, 1);
}
if ((first == 10 || first == 11) && second == 25) {
- if (_desert.bucket != 1) return Reply(17);
+ if (_desert.bucket != 1)
+ return Reply(17);
if (first == 10) {
- if (_desert.lipstick) return Reply(184, 2);
+ if (_desert.lipstick)
+ return Reply(184, 2);
_desert.lipstick = 1;
return Reply(184);
}
- if (_desert.lipsticks) return Reply(1, 2);
+ if (_desert.lipsticks)
+ return Reply(1, 2);
_desert.lipsticks = 1;
_desert.bucket = 2;
remove(10);
@@ -417,22 +471,31 @@ RunawayInventory::Reply RunawayInventory::combine(byte first, byte second) {
return Reply(first == 10 ? 186 : 187, 1);
}
if (first == 15 && second == 16) {
- if (_desert.ball) return Reply(188, 2);
+ if (_desert.ball)
+ return Reply(188, 2);
_desert.ball = 1;
return Reply(188);
}
if (first == 15 && second == 24) {
- if (_desert.ball != 1) return Reply(189, _desert.ball ? 3 : 0);
+ if (_desert.ball != 1)
+ return Reply(189, _desert.ball ? 3 : 0);
_desert.ball = 2;
return Reply(189, 1);
}
- if (first == 4 && second == 18) return Reply(_desert.antTrickKnown ? 177 : 14);
- if (first == 4 && second == 19) return Reply(179);
- if (first == 4 && second == 25) return Reply(_desert.antTrickKnown ? 180 : 14, _desert.antTrickKnown && _desert.bucket == 1);
- if (first == 5 && second == 25) return Reply(181);
- if (first == 6 && second == 19) return Reply(!_desert.helmet ? 23 : _desert.helmet == 3 ? 182 : 14);
- if (first == 18 && second == 19) return Reply(191);
- if (first == 18 && second == 25) return Reply(_desert.antTrickKnown ? (_desert.bucket == 1 ? 192 : 180) : 14);
+ if (first == 4 && second == 18)
+ return Reply(_desert.antTrickKnown ? 177 : 14);
+ if (first == 4 && second == 19)
+ return Reply(179);
+ if (first == 4 && second == 25)
+ return Reply(_desert.antTrickKnown ? 180 : 14, _desert.antTrickKnown && _desert.bucket == 1);
+ if (first == 5 && second == 25)
+ return Reply(181);
+ if (first == 6 && second == 19)
+ return Reply(!_desert.helmet ? 23 : _desert.helmet == 3 ? 182 : 14);
+ if (first == 18 && second == 19)
+ return Reply(191);
+ if (first == 18 && second == 25)
+ return Reply(_desert.antTrickKnown ? (_desert.bucket == 1 ? 192 : 180) : 14);
return Reply();
}
diff --git a/engines/hollywood/runaway/scene.h b/engines/hollywood/runaway/scene.h
index 2b2515c2673..1ae734a3256 100644
--- a/engines/hollywood/runaway/scene.h
+++ b/engines/hollywood/runaway/scene.h
@@ -248,6 +248,12 @@ private:
bool applyDesertBackground();
void updateDesertMaps();
void drawDesertRoom(Graphics::ManagedSurface &viewport, bool foreground);
+ void drawScene5060(Graphics::ManagedSurface &viewport);
+ void drawScene5100(Graphics::ManagedSurface &viewport, bool foreground);
+ void updateScene5100();
+ bool applyBackground5100();
+ void updateMaps5100();
+ void walkHangar(Common::Point target, byte facing);
void setupDesertDepth(RunawayActor::RenderParams ¶ms) const;
float desertActorHeight() const;
Common::U32String desertHotspotName(byte id) const;
diff --git a/engines/hollywood/runaway/scene5010.cpp b/engines/hollywood/runaway/scene5010.cpp
index bb79b1ad5d4..a6661b9d6d4 100644
--- a/engines/hollywood/runaway/scene5010.cpp
+++ b/engines/hollywood/runaway/scene5010.cpp
@@ -83,6 +83,8 @@ void RunawayRoomScene::resumeDesert() {
_walkPath.reset(_position);
walkTo(Common::Point(1000, 451), 5, true);
}
+ if (_entryScene == 5100)
+ walkTo(Common::Point(1053, 403), 3);
const uint16 rooms[] = {5010, 5020, 5050, 5060, 5070, 5080, 5100, 5110, 5160, 5170};
for (uint i = 0; i < ARRAYSIZE(rooms); ++i) {
if (_room != rooms[i] || _desert.visited[i])
@@ -119,6 +121,8 @@ void RunawayRoomScene::finishDesertAnimation(uint16 action) {
void RunawayRoomScene::updateDesert(uint elapsed, bool inventoryOpen) {
updateRoomAnimation();
updateConversation();
+ if (_room == 5100)
+ updateScene5100();
if (_roomAction && _actionFrames.empty() && !speaking() && !_walkPath.active()) {
const uint16 action = _roomAction;
_roomAction = 0;
@@ -138,32 +142,52 @@ RunawayRoomScene::ActionResult RunawayRoomScene::executeDesert(uint16 action) {
}
break;
}
- case 5020: return execute5020(action);
- case 5050: return execute5050(action);
- case 5060: return execute5060(action);
- case 5070: return execute5070(action);
- case 5080: return execute5080(action);
- case 5100: return execute5100(action);
- case 5110: return execute5110(action);
- case 5160: return execute5160(action);
- case 5170: return execute5170(action);
- default: break;
+ case 5020:
+ return execute5020(action);
+ case 5050:
+ return execute5050(action);
+ case 5060:
+ return execute5060(action);
+ case 5070:
+ return execute5070(action);
+ case 5080:
+ return execute5080(action);
+ case 5100:
+ return execute5100(action);
+ case 5110:
+ return execute5110(action);
+ case 5160:
+ return execute5160(action);
+ case 5170:
+ return execute5170(action);
+ default:
+ break;
}
return kUnhandled;
}
float RunawayRoomScene::desertActorHeight() const {
switch (_room) {
- case 5020: return _position.y * -0.140845075f + 264.225342f;
- case 5050: return _position.y * 0.128865972f + 197.809280f;
- case 5060: return _position.y * 0.107991360f + 207.213821f;
- case 5070: return _position.y * 1.171428561f - 226.085709f;
- case 5080: return _position.y * 0.905172408f - 162.241379f;
- case 5100: return _position.y * 0.668016195f + 87.591095f;
- case 5110: return _position.y * 1.142857194f - 170.571426f;
- case 5160: return _position.y * 1.148148179f - 90.370369f;
- case 5170: return _position.y * 0.536585391f + 165.243896f;
- default: return 455;
+ case 5020:
+ return _position.y * -0.140845075f + 264.225342f;
+ case 5050:
+ return _position.y * 0.128865972f + 197.809280f;
+ case 5060:
+ return _position.y * 0.107991360f + 207.213821f;
+ case 5070:
+ return _position.y * 1.171428561f - 226.085709f;
+ case 5080:
+ return _position.y * 0.905172408f - 162.241379f;
+ case 5100:
+ return _position.y * 0.668016195f + 87.591095f;
+ case 5110:
+ return _position.y * 1.142857194f - 170.571426f;
+ case 5160:
+ return _position.y * 1.148148179f - 90.370369f;
+ case 5170:
+ return _position.y * 0.536585391f + 165.243896f;
+ default:
+ return 455;
}
}
@@ -194,9 +218,11 @@ bool RunawayRoomScene::loadDesertRoom() {
if (_room == 5050)
return loadForeground(0, 4) && loadForeground(1, 5);
if (_room == 5060)
- return loadForeground(0, 8) && _npc.load(_archive, 7, 201);
+ return loadForeground(0, 8) && _npc.load(_archive, 7, 201) && _machine.load(_archive, 12, 195);
if (_room == 5080)
return loadForeground(0, 11) && loadForeground(1, 12) && loadForeground(2, 13) && loadForeground(3, 14);
+ if (_room == 5100)
+ return _npc.load(_archive, 9, 151) && _npcMouth.load(_archive, 12, 126);
return true;
}
@@ -215,7 +241,7 @@ bool RunawayRoomScene::applyDesertBackground() {
case 5080:
return !_desert.antsDistracted || applyPatch(_desert.dynamite == 1 ? 7 : 8);
case 5100:
- return (_desert.barnDoor != 2 || applyPatch(5)) && (_desert.peanutButter != 2 || applyPatch(6));
+ return applyBackground5100();
case 5110:
return _desert.barrel != 2 || applyPatch(13);
case 5160:
@@ -226,45 +252,63 @@ bool RunawayRoomScene::applyDesertBackground() {
case 5170:
return (_desert.vacuum != 2 || applyPatch(7)) && (!_desert.glassesTaken || applyPatch(8)) &&
(_desert.lipstickShelf != 2 || applyPatch(9)) && (_desert.lipstickShelf != 3 || applyPatch(10));
- default: return true;
+ default:
+ return true;
}
}
void RunawayRoomScene::updateDesertMaps() {
+ if (_room == 5100) {
+ updateMaps5100();
+ return;
+ }
for (uint i = 0; i < 256; ++i) {
byte &id = _maps[256 + i];
switch (_room) {
case 5020:
- if (_desert.bucketTaken && id == 7) id = 0;
+ if (_desert.bucketTaken && id == 7)
+ id = 0;
break;
case 5050:
- if ((_desert.helmetTaken && id == 2) || (_desert.beltTaken && id == 3)) id = 0;
+ if ((_desert.helmetTaken && id == 2) || (_desert.beltTaken && id == 3))
+ id = 0;
break;
case 5060:
- if (_desert.tanningOil == 2 && id == 6) id = 0;
+ if (_desert.tanningOil == 2 && id == 6)
+ id = 0;
break;
case 5070:
- if (id == 3 || id == 8) id = _desert.dynamitePlaced ? 3 : 0;
+ if (id == 3 || id == 8)
+ id = _desert.dynamitePlaced ? 3 : 0;
break;
case 5080:
if (_desert.antsDistracted) {
- if (id == 12) id = _desert.dynamite == 1 ? 5 : 0;
- else if (id == 5 && _desert.dynamite == 2) id = 3;
+ if (id == 12)
+ id = _desert.dynamite == 1 ? 5 : 0;
+ else if (id == 5 && _desert.dynamite == 2)
+ id = 3;
}
break;
case 5110:
- if (id == 8) id = _desert.bucket == 1 || _desert.bucket == 2 ? 8 : 4;
+ if (id == 8)
+ id = _desert.bucket == 1 || _desert.bucket == 2 ? 8 : 4;
break;
case 5160:
- if (_desert.needle == 2 && id == 9) id = 0;
+ if (_desert.needle == 2 && id == 9)
+ id = 0;
break;
case 5170:
- if (id == 5 && (_desert.busDoor == 0 || _desert.busDoor == 2)) id = 1;
- if ((_desert.glassesTaken && id == 6) || (_desert.vacuum == 2 && id == 7)) id = 0;
- if (id == 11) id = _desert.crank == 2 && _desert.busDoor != 1 ? 4 : 10;
- if (id == 12) id = _desert.crank == 2 && _desert.busDoor == 1 ? 4 : 2;
+ if (id == 5 && (_desert.busDoor == 0 || _desert.busDoor == 2))
+ id = 1;
+ if ((_desert.glassesTaken && id == 6) || (_desert.vacuum == 2 && id == 7))
+ id = 0;
+ if (id == 11)
+ id = _desert.crank == 2 && _desert.busDoor != 1 ? 4 : 10;
+ if (id == 12)
+ id = _desert.crank == 2 && _desert.busDoor == 1 ? 4 : 2;
+ break;
+ default:
break;
- default: break;
}
}
}
@@ -274,39 +318,66 @@ Common::U32String RunawayRoomScene::desertHotspotName(byte id) const {
if (!spot)
return Common::U32String();
if (_room == 5010) {
- if (id == 1 && _desert.visited[4]) return Common::U32String("Oil well");
- if (id == 3 && _desert.visited[6]) return Common::U32String("Hangar");
- if (id == 4 && _desert.visited[2]) return Common::U32String("Airplane graveyard");
- if (id == 5 && _desert.visited[5]) return Common::U32String("Railway yard");
+ if (id == 1 && _desert.visited[4])
+ return Common::U32String("Oil well");
+ if (id == 3 && _desert.visited[6])
+ return Common::U32String("Hangar");
+ if (id == 4 && _desert.visited[2])
+ return Common::U32String("Airplane graveyard");
+ if (id == 5 && _desert.visited[5])
+ return Common::U32String("Railway yard");
}
- if (_room == 5050 && id == 3 && _desert.beltSeen) return _inventory.name(14);
- if (_room == 5060 && id == 6 && _desert.tanningOil) return _inventory.name(12);
- if (_room == 5100 && id == 3 && _desert.peanutButter) return _inventory.name(19);
- if (_room == 5100 && id == 8 && _desert.footrestSeen) return _inventory.name(21);
- if (_room == 5100 && id == 12) return Common::U32String(_desert.beerSeen ? "Beer can" : "Can");
- if (_room == 5110 && id == 1) return Common::U32String("Door");
- if (_room == 5110 && id == 2) return Common::U32String("Door");
- if (_room == 5110 && id == 5 && _desert.barrel) return Common::U32String("Barrel of gunpowder");
- if (_room == 5170 && id == 3 && _desert.lipstickShelf && _desert.lipstickShelf < 3) return _inventory.name(11);
- if (_room == 5170 && id == 4 && _desert.crank == 2) return Common::U32String("Makeshift crank");
- if (_room == 5170 && id == 7 && _desert.vacuum) return _inventory.name(22);
- if (_room == 5170 && id == 8 && _desert.necklacesSeen) return Common::U32String("Necklaces");
- if (_room == 5170 && id == 9 && _desert.ringsSeen) return Common::U32String("Rings and earrings");
+ if (_room == 5050 && id == 3 && _desert.beltSeen)
+ return _inventory.name(14);
+ if (_room == 5060 && id == 6 && _desert.tanningOil)
+ return _inventory.name(12);
+ if (_room == 5060 && id == 7 && _desert.busPosterSeen)
+ return Common::U32String("Lawn chair");
+ if (_room == 5100 && id == 3 && _desert.peanutButter)
+ return _inventory.name(19);
+ if (_room == 5100 && id == 8 && _desert.footrestSeen)
+ return _inventory.name(21);
+ if (_room == 5100 && id == 12)
+ return Common::U32String(_desert.beerSeen ? "Beer can" : "Can");
+ if (_room == 5110 && id == 1)
+ return Common::U32String("Door");
+ if (_room == 5110 && id == 2)
+ return Common::U32String("Door");
+ if (_room == 5110 && id == 5 && _desert.barrel)
+ return Common::U32String("Barrel of gunpowder");
+ if (_room == 5170 && id == 3 && _desert.lipstickShelf && _desert.lipstickShelf < 3)
+ return _inventory.name(11);
+ if (_room == 5170 && id == 4 && _desert.crank == 2)
+ return Common::U32String("Makeshift crank");
+ if (_room == 5170 && id == 7 && _desert.vacuum)
+ return _inventory.name(22);
+ if (_room == 5170 && id == 8 && _desert.necklacesSeen)
+ return Common::U32String("Necklaces");
+ if (_room == 5170 && id == 9 && _desert.ringsSeen)
+ return Common::U32String("Rings and earrings");
return Common::U32String(spot->name);
}
void RunawayRoomScene::drawDesertRoom(Graphics::ManagedSurface &viewport, bool foreground) {
+ if (_room == 5100) {
+ drawScene5100(viewport, foreground);
+ return;
+ }
if (foreground) {
if (_room == 5050) {
- if (_position.x < 314) drawForeground(viewport, 0);
- if (_position.x > 195 && _position.y < 465) drawForeground(viewport, 1);
+ if (_position.x < 314)
+ drawForeground(viewport, 0);
+ if (_position.x > 195 && _position.y < 465)
+ drawForeground(viewport, 1);
} else if (_room == 5060 && _position.x < 670) {
drawForeground(viewport, 0);
} else if (_room == 5080) {
drawForeground(viewport, 0);
drawForeground(viewport, 1);
- if (walkZone() == 15 || walkZone() == 16) drawForeground(viewport, 2);
- if (walkZone() == 15) drawForeground(viewport, 3);
+ if (walkZone() == 15 || walkZone() == 16)
+ drawForeground(viewport, 2);
+ if (walkZone() == 15)
+ drawForeground(viewport, 3);
}
return;
}
@@ -316,21 +387,24 @@ void RunawayRoomScene::drawDesertRoom(Graphics::ManagedSurface &viewport, bool f
continue;
uint frame = (_now / 80) % animation.frameCount();
if (_room == 5110) {
- if (!i && (_desert.bucket == 0 || _desert.bucket == 3)) continue;
+ if (!i && (_desert.bucket == 0 || _desert.bucket == 3))
+ continue;
frame = i ? (_desert.trainDoorOpen != 0) : 0;
} else if (_room == 5170) {
- if (i == 0) frame = _desert.busDoor == 0 || _desert.busDoor == 2 ? 24 : 0;
- if (i == 2) frame = 49;
- if (i == 3) frame = _desert.crank == 2 ? (_desert.busDoor == 1 ? 1 : 2) : 0;
+ if (i == 0)
+ frame = _desert.busDoor == 0 || _desert.busDoor == 2 ? 24 : 0;
+ if (i == 2)
+ frame = 49;
+ if (i == 3)
+ frame = _desert.crank == 2 ? (_desert.busDoor == 1 ? 1 : 2) : 0;
} else if (_room == 5160) {
- if (i == 3) frame = 92;
- } else if (_room == 5100) {
- frame = 0;
+ if (i == 3)
+ frame = 92;
}
animation.draw(viewport, frame, _camera.x, -_camera.y);
}
if (_room == 5060)
- _npc.draw(viewport, 200, _camera.x, -_camera.y);
+ drawScene5060(viewport);
}
void RunawayRoomScene::setupDesertDepth(RunawayActor::RenderParams ¶ms) const {
diff --git a/engines/hollywood/runaway/scene5030.cpp b/engines/hollywood/runaway/scene5030.cpp
index ebd272e2a1a..4bd28a52914 100644
--- a/engines/hollywood/runaway/scene5030.cpp
+++ b/engines/hollywood/runaway/scene5030.cpp
@@ -484,29 +484,64 @@ void RunawayScene5030::examine(byte id) {
const bool examined = _examined[id];
_examined[id] = true;
switch (id) {
- case 1: sayCue(1, _peeked ? 1 : 0); break;
- case 2: startAction(kPeekDoor); break;
- case 3: sayCue(5, 0); break;
- case 4: sayCue(7, _windowClean ? 1 : 0); break;
- case 5: sayCue(9, examined ? 1 : 0); break;
- case 6: sayCue(_hatchState == kOpen ? 12 : 10, _hatchState == kUnlocked ? 1 : 0); break;
- case 7: sayCue(27, examined ? 1 : 0); break;
+ case 1:
+ sayCue(1, _peeked ? 1 : 0);
+ break;
+ case 2:
+ startAction(kPeekDoor);
+ break;
+ case 3:
+ sayCue(5, 0);
+ break;
+ case 4:
+ sayCue(7, _windowClean ? 1 : 0);
+ break;
+ case 5:
+ sayCue(9, examined ? 1 : 0);
+ break;
+ case 6:
+ sayCue(_hatchState == kOpen ? 12 : 10, _hatchState == kUnlocked ? 1 : 0);
+ break;
+ case 7:
+ sayCue(27, examined ? 1 : 0);
+ break;
case 8:
_coolerInspected |= _lidOpen;
sayCue(13, _coolerMoved ? 0 : !_lidOpen ? 1 : _ice == kDrained ? 6 :
_ice == kMelted ? 5 : _windowClean ? (_unplugged ? 5 : 4) : (_unplugged ? 3 : 2));
break;
- case 9: sayCue(15, examined ? 1 : 0); break;
- case 10: sayCue(16, 0); break;
- case 11: sayCue(18, 0); break;
- case 12: sayCue(21, 0); break;
- case 13: sayCue(23, 0); break;
- case 14: sayCue(25, 0); break;
- case 15: sayCue(40, 0); break;
- case 16: sayCue(29, 0); break;
- case 17: sayCue(30, examined ? 1 : 0); break;
- case 18: sayCue(32, _lidOpen ? 1 : 0); break;
- default: break;
+ case 9:
+ sayCue(15, examined ? 1 : 0);
+ break;
+ case 10:
+ sayCue(16, 0);
+ break;
+ case 11:
+ sayCue(18, 0);
+ break;
+ case 12:
+ sayCue(21, 0);
+ break;
+ case 13:
+ sayCue(23, 0);
+ break;
+ case 14:
+ sayCue(25, 0);
+ break;
+ case 15:
+ sayCue(40, 0);
+ break;
+ case 16:
+ sayCue(29, 0);
+ break;
+ case 17:
+ sayCue(30, examined ? 1 : 0);
+ break;
+ case 18:
+ sayCue(32, _lidOpen ? 1 : 0);
+ break;
+ default:
+ break;
}
}
@@ -605,13 +640,19 @@ void RunawayScene5030::startAction(Action action) {
stopSpeech();
uint chunk = 0, frames = 0;
switch (action) {
- case kIntroLookAround: waitForSpeech(0, 1, kIntroInventory); break;
+ case kIntroLookAround:
+ waitForSpeech(0, 1, kIntroInventory);
+ break;
case kIntroInventory:
setPosition(_position, 4);
sayCue(0, 2);
break;
- case kIntroListen: waitForSpeech(0, 3, kIntroWalkToDoor); break;
- case kIntroWalkToDoor: walkForAction(Common::Point(101, 507), 7, kIntroExamineDoor); break;
+ case kIntroListen:
+ waitForSpeech(0, 3, kIntroWalkToDoor);
+ break;
+ case kIntroWalkToDoor:
+ walkForAction(Common::Point(101, 507), 7, kIntroExamineDoor);
+ break;
case kIntroExamineDoor:
_examined[1] = true;
waitForSpeech(1, 0, kPeekDoor);
@@ -619,36 +660,92 @@ void RunawayScene5030::startAction(Action action) {
case kPickup:
_action = kNone;
switch (_pickupHotspot) {
- case 5: pickUp(5, 8, 0); break;
- case 9: pickUp(9, 1, 1); break;
- case 14: pickUp(14, 2, 2); break;
- case 16: pickUp(16, 24, 3); break;
- case 17: pickUp(17, 3, 4); break;
- default: break;
+ case 5:
+ pickUp(5, 8, 0);
+ break;
+ case 9:
+ pickUp(9, 1, 1);
+ break;
+ case 14:
+ pickUp(14, 2, 2);
+ break;
+ case 16:
+ pickUp(16, 24, 3);
+ break;
+ case 17:
+ pickUp(17, 3, 4);
+ break;
+ default:
+ break;
}
break;
- case kShirt: _action = kNone; sayCue(28, 0); break;
- case kMeltIce: waitForSpeech(20, 0, kMeltWait); break;
- case kInspectIce: walkForAction(Common::Point(1062, 473), 1, kFinishMelting); break;
- case kFinishMelting: _ice = kMelted; _action = kNone; sayCue(13, 5); break;
- case kTryMoveCooler: chunk = _windowClean ? 37 : 38; frames = 26; break;
- case kRevealHatch: waitForSpeech(14, 4, kMoveCooler); break;
- case kMoveCooler: chunk = 41; frames = 83; applyPatch(23); break;
- case kFinishMoving: walkForAction(Common::Point(1215, 542), 7, kHatchFound); break;
- case kHatchFound: _action = kNone; sayCue(14, 6); break;
+ case kShirt:
+ _action = kNone;
+ sayCue(28, 0);
+ break;
+ case kMeltIce:
+ waitForSpeech(20, 0, kMeltWait);
+ break;
+ case kInspectIce:
+ walkForAction(Common::Point(1062, 473), 1, kFinishMelting);
+ break;
+ case kFinishMelting:
+ _ice = kMelted;
+ _action = kNone;
+ sayCue(13, 5);
+ break;
+ case kTryMoveCooler:
+ chunk = _windowClean ? 37 : 38;
+ frames = 26;
+ break;
+ case kRevealHatch:
+ waitForSpeech(14, 4, kMoveCooler);
+ break;
+ case kMoveCooler:
+ chunk = 41;
+ frames = 83;
+ applyPatch(23);
+ break;
+ case kFinishMoving:
+ walkForAction(Common::Point(1215, 542), 7, kHatchFound);
+ break;
+ case kHatchFound:
+ _action = kNone;
+ sayCue(14, 6);
+ break;
case kDrainCooler:
chunk = 39;
frames = 59;
if (!_water.load(_archive, 33, 97))
error("Cannot load Runaway draining animation");
break;
- case kFinishDraining: _action = kNone; sayCue(19, 2); break;
- case kPryHatch: chunk = 32; frames = 43; break;
- case kOpenHatch: chunk = 36; frames = 47; applyPatch(24); break;
- case kEscape: chunk = 35; frames = 37; break;
- case kPeekDoor: chunk = 22; frames = 19; break;
- case kReturnFromPeek: chunk = 22; frames = 19; break;
- default: break;
+ case kFinishDraining:
+ _action = kNone;
+ sayCue(19, 2);
+ break;
+ case kPryHatch:
+ chunk = 32;
+ frames = 43;
+ break;
+ case kOpenHatch:
+ chunk = 36;
+ frames = 47;
+ applyPatch(24);
+ break;
+ case kEscape:
+ chunk = 35;
+ frames = 37;
+ break;
+ case kPeekDoor:
+ chunk = 22;
+ frames = 19;
+ break;
+ case kReturnFromPeek:
+ chunk = 22;
+ frames = 19;
+ break;
+ default:
+ break;
}
if (frames && !_actionAnimation.load(_archive, chunk, frames))
error("Cannot load Runaway action animation %u", chunk);
@@ -831,10 +928,15 @@ void RunawayScene5030::updateAction() {
if (previousStep < 25 && _step >= 25)
_audio.playEffect(17);
break;
- case kEscape: length = 37; break;
+ case kEscape:
+ length = 37;
+ break;
case kPeekDoor:
- case kReturnFromPeek: length = 20; break;
- default: break;
+ case kReturnFromPeek:
+ length = 20;
+ break;
+ default:
+ break;
}
if (length && _step >= length)
finishAction();
diff --git a/engines/hollywood/runaway/scene5060.cpp b/engines/hollywood/runaway/scene5060.cpp
index e53cec1798b..eb761f3dd72 100644
--- a/engines/hollywood/runaway/scene5060.cpp
+++ b/engines/hollywood/runaway/scene5060.cpp
@@ -26,6 +26,24 @@
namespace Hollywood {
namespace {
+const byte kMariolaTurnFrames[] = {
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
+ 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
+ 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 77, 78, 79,
+ 80, 81, 82, 83
+};
+
+const byte kMariolaRestFrames[] = {
+ 95, 96, 97, 98, 99, 100, 101, 161, 162, 163, 164, 165, 166, 167, 168, 169,
+ 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
+ 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200
+};
+
const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Path", 1479, 599, 0, {301, 302}, {0, 1}},
@@ -35,7 +53,7 @@ const RunawayHotspot kHotspots[] = {
{"Trunk", 376, 445, 1, {309, 310}, {1, 1}},
{"Bottle", 878, 477, 0, {311, 312}, {1, 1}},
{"Chair", 383, 446, 5, {313, 314}, {0, 0}},
- {"?", 349, 442, 5, {315, 316}, {0, 0}},
+ {"Radio And Cassette Player", 349, 442, 5, {315, 316}, {0, 0}},
{"Sunglasses", 878, 477, 0, {317, 318}, {0, 0}},
{"Tanning Oil", 0, 0, 0, {0, 0}, {0, 0}},
{"Lawn Chair", 0, 0, 0, {0, 0}, {0, 0}},
@@ -43,6 +61,8 @@ const RunawayHotspot kHotspots[] = {
const RunawayResponse kResponses[] = {
{5060, 301, 1, 0},
+ {5060, 309, 5, 0},
+ {5060, 314, 11, 0},
{5060, 315, 12, 0},
{5060, 316, 13, 0},
};
@@ -52,6 +72,14 @@ const RunawayItemAction kItemActions[] = {
{5060, 20, 9, 320, true},
};
+const byte kSearchTrunkFrames[] = {
+ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+};
+
} // End of anonymous namespace
const RunawayRoom kRunawayScene5060 = {
@@ -67,16 +95,194 @@ RunawayRoomScene::ActionResult RunawayRoomScene::execute5060(uint16 action) {
case 302:
leaveDesertRoom(5010);
break;
+ case 303:
+ say(2, _random.getRandomBit() * (_desert.lulaHelped ? 2 : 1));
+ break;
+ case 304:
+ if (_desert.guard == 2) {
+ say(20, 12);
+ } else if (_desert.lulaHelped) {
+ return kUnhandled;
+ } else {
+ say(20);
+ deferDesertAction(404);
+ }
+ break;
+ case 404: {
+ Common::Array<byte> frames;
+ for (uint i = 120 + (_now / 80) % 75; i < 195; ++i)
+ frames.push_back(i);
+ for (uint i = 86; i < 120; ++i) {
+ frames.push_back(i);
+ if (i == 94)
+ frames.push_back(i);
+ }
+ beginRoomAnimation(action, 12, 195, frames.data(), frames.size(), false);
+ break;
+ }
+ case 1404:
+ if (!_desert.guardWeaknessKnown) {
+ if (!_desert.visited[6]) {
+ say(20, 1);
+ say(21, 0, false, 2);
+ say(20, 2);
+ say(21, 1, false, 2);
+ } else {
+ say(20, 3);
+ say(21, 2, false, 2);
+ say(20, 4);
+ say(21, 3, false, 2);
+ say(20, 5);
+ _desert.lulaCalled = 1;
+ }
+ } else {
+ say(20, 6);
+ say(21, 4, false, 2);
+ say(20, 7);
+ if (_desert.lulaCalled || _desert.lulaRefused) {
+ say(21, 5, false, 2);
+ } else {
+ say(21, 8, false, 2);
+ say(20, 13);
+ say(21, 9, false, 2);
+ }
+ say(20, 8);
+ _desert.lulaRefused = 1;
+ }
+ deferDesertAction(414);
+ break;
+ case 414: {
+ Common::Array<byte> frames;
+ for (uint i = 95; i < 120; ++i)
+ frames.push_back(i);
+ for (uint i = 12; i < 85; ++i)
+ frames.push_back(i);
+ beginRoomAnimation(action, 12, 195, frames.data(), frames.size(), false);
+ break;
+ }
+ case 1414:
+ break;
+ case 305:
+ say(3, _desert.mariolaHelped != 0);
+ break;
+ case 306:
+ _facing = 4;
+ say(19, _random.getRandomNumber(2));
+ break;
+ case 307:
+ say(4, _desert.visited[9] != 0);
+ break;
case 308:
beginRoomAnimation(action, 5, 22);
break;
case 1308:
leaveDesertRoom(5170);
break;
+ case 310:
+ say(6, _desert.ballTaken ? 2 : 0);
+ beginRoomAnimation(action, 10, 28, kSearchTrunkFrames, _desert.ballTaken ? ARRAYSIZE(kSearchTrunkFrames) : 57);
+ break;
+ case 1310:
+ if (_desert.ballTaken) {
+ say(6, 3);
+ } else {
+ _inventory.add(15);
+ _desert.ballTaken = 1;
+ say(6, 1);
+ holdRoomAnimation(410, 10, 28, 14);
+ }
+ break;
+ case 1410:
+ beginRoomAnimation(420, 10, 28, kSearchTrunkFrames + 57, ARRAYSIZE(kSearchTrunkFrames) - 57);
+ break;
+ case 1420:
+ break;
+ case 311:
+ if (!_desert.tanningOil) {
+ say(7);
+ _desert.tanningOil = 1;
+ } else {
+ say(163, 0, true);
+ }
+ break;
+ case 312:
+ if (!_desert.tanningOil)
+ execute5060(311);
+ say(8);
+ deferDesertAction(412);
+ break;
+ case 412:
+ beginRoomAnimation(action, 7, 201, kMariolaTurnFrames, ARRAYSIZE(kMariolaTurnFrames), false);
+ break;
+ case 1412:
+ say(9, _desert.mariolaHelped != 0, false, 1);
+ if (_desert.mariolaHelped)
+ say(8, 1);
+ deferDesertAction(422);
+ break;
+ case 422:
+ beginRoomAnimation(432, 7, 201, kMariolaRestFrames, ARRAYSIZE(kMariolaRestFrames), false);
+ if (_desert.mariolaHelped) {
+ _desert.tanningOil = 2;
+ _inventory.add(12);
+ say(8, 2);
+ }
+ return kBackgroundChanged;
+ case 1432:
+ break;
+ case 313:
+ say(10, _desert.busPosterSeen != 0);
+ _desert.busPosterSeen = 1;
+ break;
+ case 317:
+ say(14, _desert.mariolaHelped != 0);
+ break;
+ case 318:
+ say(15, !_inventory.contains(20) ? 0 : _desert.mariolaHelped ? 2 : 1);
+ break;
+ case 319:
+ if (!_desert.guardWeaknessKnown)
+ say(17, 7);
+ else if (_inventory.desert().ball < 2)
+ say(17, 8);
+ else
+ return kUnhandled;
+ break;
+ case 320:
+ if (!_inventory.desert().glasses) {
+ say(16);
+ } else if (_inventory.desert().glasses == 1) {
+ say(16, 1);
+ beginRoomAnimation(action, 11, 21);
+ } else {
+ say(15, 2);
+ }
+ break;
+ case 1320:
+ _desert.mariolaHelped = 1;
+ _inventory.desert().glasses = 2;
+ say(16, 2);
+ break;
default:
return kUnhandled;
}
return kHandled;
}
+void RunawayRoomScene::drawScene5060(Graphics::ManagedSurface &viewport) {
+ if (!drawingRoomAnimation() || (_roomAction != 412 && _roomAction != 432)) {
+ uint frame = (_now / 80) % 13;
+ if (_roomAction == 422 || _roomAction == 432)
+ frame = 83 + (speaker() == 1 ? speechFrame() : 0);
+ _npc.draw(viewport, frame, _camera.x, -_camera.y);
+ }
+ static const byte mouth[] = {5, 0, 1, 2, 3, 4, 11, 6, 7, 8, 9, 10};
+ if (!drawingRoomAnimation() || (_roomAction != 404 && _roomAction != 414)) {
+ uint frame = 120 + (_now / 80) % 75;
+ if (_roomAction == 414)
+ frame = mouth[speaker() == 2 ? speechFrame() : 0];
+ _machine.draw(viewport, frame, _camera.x, -_camera.y);
+ }
+}
+
} // End of namespace Hollywood
diff --git a/engines/hollywood/runaway/scene5100.cpp b/engines/hollywood/runaway/scene5100.cpp
index 43ddc8194b4..33d94e2a139 100644
--- a/engines/hollywood/runaway/scene5100.cpp
+++ b/engines/hollywood/runaway/scene5100.cpp
@@ -19,6 +19,7 @@
*
*/
+#include "common/textconsole.h"
#include "common/util.h"
#include "hollywood/runaway/scene.h"
#include "hollywood/runaway/scene_data.h"
@@ -26,6 +27,25 @@
namespace Hollywood {
namespace {
+const byte kStudFrames[] = {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78,
+ 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
+ 61, 60, 59, 58, 57, 56, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 54, 53, 52, 99, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
+ 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132,
+ 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
+ 149, 150, 150, 150, 150, 150, 150, 150, 150, 150
+};
+
const RunawayHotspot kHotspots[] = {
{"", 0, 0, 0, {0, 0}, {0, 0}},
{"Path", 1279, 267, 0, {301, 302}, {0, 1}},
@@ -41,14 +61,15 @@ const RunawayHotspot kHotspots[] = {
{"Helicopter", 0, 0, 7, {319, 320}, {0, 0}},
{"?", 253, 418, 4, {321, 322}, {0, 0}},
{"Bucket", 0, 0, 1, {323, 324}, {1, 0}},
- {"", 253, 418, 4, {0, 1}, {0, 0}},
- {"", 1053, 403, 3, {0, 1}, {0, 0}},
+ {"Outside", 253, 418, 4, {1, 325}, {0, 0}},
+ {"Stud", 1053, 403, 3, {1, 329}, {0, 1}},
{"Beer Can", 0, 0, 0, {0, 0}, {0, 0}},
{"Peanut Butter", 0, 0, 0, {0, 0}, {0, 0}},
{"Foot Rest", 0, 0, 0, {0, 0}, {0, 0}},
};
const RunawayResponse kResponses[] = {
+ {5100, 301, 2, 0},
{5100, 308, 16, 0},
{5100, 311, 18, 0},
{5100, 312, 19, 0},
@@ -76,11 +97,244 @@ const RunawayRoom kRunawayScene5100 = {
nullptr, 0
};
+bool RunawayRoomScene::applyBackground5100() {
+ const uint mask = _desert.insideBarn ? 23 : _desert.guard == 2 ? 26 : 1;
+ return loadRunawayMask(_archive, _background.w, _background.h, _mask, _originalMaps, mask) &&
+ (_desert.barnDoor != 2 || applyPatch(5)) && (_desert.peanutButter != 2 || applyPatch(6));
+}
+
+void RunawayRoomScene::updateMaps5100() {
+ _desertHotspots.assign(kHotspots, kHotspots + ARRAYSIZE(kHotspots));
+ if (_desert.insideBarn) {
+ _desertHotspots[6].x = 253;
+ _desertHotspots[6].y = 418;
+ _desertHotspots[6].facing = 4;
+ } else if (_desert.guard == 2) {
+ static const Common::Point positions[] = {
+ {0, 0}, {1279, 267}, {1259, 354}, {271, 598}, {1279, 267},
+ {164, 581}, {656, 600}, {1326, 459}, {164, 581}, {261, 595},
+ {992, 460}, {1259, 354}, {253, 418}, {736, 444}
+ };
+ for (uint i = 1; i < ARRAYSIZE(positions); ++i) {
+ _desertHotspots[i].x = positions[i].x;
+ _desertHotspots[i].y = positions[i].y;
+ }
+ }
+ for (uint i = 0; i < 256; ++i) {
+ if (_desert.guard != 2 && _maps[i] == 3)
+ _maps[i] = 0;
+ byte &id = _maps[256 + i];
+ if ((id == 4 && _desert.guard == 2) || (id == 8 && _desert.footrest != 1))
+ id = 0;
+ if (id == 3 && _desert.peanutButter == 2)
+ id = 0;
+ if (id == 7 && _desert.peanutButter != 2)
+ id = 0;
+ }
+}
+
+void RunawayRoomScene::walkHangar(Common::Point target, byte facing) {
+ // Scripted entrances cross the floor that is blocked while the guard watches.
+ _walkPath.findPath(RunawayWalkMap(_background.w, _background.h, _mask, _originalMaps), target);
+ _arrivalFacing = facing;
+ _walkElapsed = _lastFootstep = 0;
+ if (!_walkPath.active())
+ arrive();
+}
+
RunawayRoomScene::ActionResult RunawayRoomScene::execute5100(uint16 action) {
- if (action != 302)
+ switch (action) {
+ case 302:
+ leaveDesertRoom(5010);
+ break;
+ case 303:
+ if (!_desert.barnDoor) {
+ Common::Array<byte> frames;
+ frames.push_back(1);
+ for (uint i = 1; i <= 18; ++i)
+ frames.push_back(i);
+ for (uint i = 0; i < 12; ++i)
+ frames.push_back(18);
+ for (int i = 17; i >= 1; --i)
+ frames.push_back(i);
+ say(3);
+ beginRoomAnimation(action, 11, 19, frames.data(), frames.size());
+ } else {
+ say(3, _desert.barnDoor == 1 ? 3 : 4);
+ }
+ break;
+ case 1303:
+ _desert.barnDoor = 1;
+ say(3, 1);
+ say(3, 2);
+ break;
+ case 304:
+ say(4, _desert.barnDoor);
+ if (_desert.barnDoor != 2)
+ deferDesertAction(404);
+ break;
+ case 404:
+ _desert.barnDoor = 1;
+ _desert.insideBarn = 1;
+ if (!applyBackground5100())
+ error("Cannot load Runaway hangar interior");
+ updateMaps();
+ walkHangar(Common::Point(680, 355), 0);
+ deferDesertAction(414);
+ break;
+ case 414:
+ walkHangar(Common::Point(253, 418), 4);
+ break;
+ case 305:
+ say(10, _desert.peanutButter != 0);
+ if (!_desert.peanutButter)
+ _desert.peanutButter = 1;
+ break;
+ case 306:
+ if (!_desert.peanutButter)
+ execute5100(305);
+ say(11);
+ deferDesertAction(406);
+ break;
+ case 406:
+ _inventory.add(19);
+ _desert.peanutButter = 2;
+ say(11, 1);
+ say(12, 0, false, 1);
+ deferDesertAction(416);
+ return kBackgroundChanged;
+ case 416:
+ walkTo(Common::Point(_desertHotspots[6].x, _desertHotspots[6].y), 7);
+ deferDesertAction(426);
+ break;
+ case 426:
+ say(11, 2);
+ say(12, 1, false, 1);
+ say(11, 3);
+ say(12, 2, false, 1);
+ say(11, 4);
+ say(12, 3, false, 1);
+ say(12, 4, false, 1);
+ say(11, 5);
+ _inventory.desert().antTrickKnown = 1;
+ break;
+ case 307: {
+ const byte variation = _random.getRandomBit();
+ say(15, variation);
+ if (variation)
+ _desert.motorcycleSeen = 1;
+ break;
+ }
+ case 309:
+ say(5, _desert.insideBarn ? _random.getRandomNumber(3) : 4 + _random.getRandomBit());
+ break;
+ case 310:
+ say(6, !_desert.insideBarn);
+ break;
+ case 313:
+ if (!_desert.footrestSeen) {
+ say(20);
+ _desert.footrestSeen = 1;
+ } else {
+ say(172, 0, true);
+ }
+ break;
+ case 314:
+ if (!_desert.footrestSeen)
+ execute5100(313);
+ _inventory.add(21);
+ _desert.footrest = 2;
+ say(18, 0, true);
+ return kBackgroundChanged;
+ case 315:
+ say(21, _random.getRandomBit());
+ break;
+ case 317:
+ say(23, _random.getRandomNumber(2));
+ break;
+ case 321:
+ say(7, _desert.beerSeen != 0);
+ _desert.beerSeen = 1;
+ break;
+ case 323:
+ say(27, _random.getRandomBit());
+ break;
+ case 325:
+ walkHangar(Common::Point(680, 355), 0);
+ deferDesertAction(425);
+ break;
+ case 425:
+ walkHangar(Common::Point(1348, 332), 5);
+ deferDesertAction(435);
+ break;
+ case 435:
+ _desert.insideBarn = 0;
+ return kBackgroundChanged;
+ case 327:
+ if (_desert.footrest) {
+ say(17, 2);
+ } else {
+ if (!_desert.motorcycleSeen) {
+ say(15, 1);
+ _desert.motorcycleSeen = 1;
+ }
+ say(17);
+ byte brian[99] = {}, footrest[99] = {};
+ for (uint i = 1; i < 78; ++i)
+ brian[i] = i - 1;
+ for (uint i = 78; i < 88; ++i)
+ brian[i] = 87 - i;
+ static const byte wobble[] = {1, 2, 3, 2, 1};
+ for (uint i = 0; i < ARRAYSIZE(wobble); ++i)
+ footrest[59 + i] = wobble[i];
+ for (uint i = 73; i < ARRAYSIZE(footrest); ++i)
+ footrest[i] = i - 72;
+ beginRoomAnimation(action, 14, 77, brian, ARRAYSIZE(brian));
+ setRoomAnimationOverlay(7, 27, footrest, ARRAYSIZE(footrest));
+ }
+ break;
+ case 1327:
+ _desert.footrest = 1;
+ say(17, 1);
+ return kBackgroundChanged;
+ case 328:
+ if (_desert.guard)
+ return kUnhandled;
+ say(9);
+ _desert.guardWeaknessKnown = 1;
+ break;
+ case 329:
+ say(1, _random.getRandomBit());
+ break;
+ default:
return kUnhandled;
- leaveDesertRoom(5010);
+ }
return kHandled;
}
+void RunawayRoomScene::drawScene5100(Graphics::ManagedSurface &viewport, bool foreground) {
+ if (foreground != (walkZone() == 7))
+ return;
+ const uint frame = kStudFrames[(_now / 80) % ARRAYSIZE(kStudFrames)];
+ if (_desert.guard == 2)
+ _npcMouth.draw(viewport, speaker() == 1 ? 118 + speechFrame() % 6 : 110, _camera.x, -_camera.y);
+ else if (!_desert.guard)
+ _npc.draw(viewport, speaker() == 1 ? 92 + speechFrame() % 6 : frame, _camera.x, -_camera.y);
+ if (_desert.guard == 2 || (frame >= 82 && frame <= 92))
+ _desertAnimations[0].draw(viewport, 0, _camera.x, -_camera.y);
+ if (_desert.footrest < 2 && (!drawingRoomAnimation() || _roomAction != 327))
+ _desertAnimations[1].draw(viewport, _desert.footrest ? 26 : 0, _camera.x, -_camera.y);
+}
+
+void RunawayRoomScene::updateScene5100() {
+ const uint frame = kStudFrames[(_now / 80) % ARRAYSIZE(kStudFrames)];
+ byte canHotspot = 12;
+ if (_desert.guard != 2 && (frame < 82 || frame > 92))
+ canHotspot = _desert.guard ? 0 : 14;
+ for (uint i = 0; i < 256; ++i) {
+ if (_originalMaps[256 + i] == 12)
+ _maps[256 + i] = canHotspot;
+ }
+}
+
} // End of namespace Hollywood
More information about the Scummvm-git-logs
mailing list