aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2018-03-31 12:52:08 +0200
committerBastien Bouclet2018-03-31 13:36:09 +0200
commit84b2dc5cc85721570aa7aafdd9e3e96f0f04a025 (patch)
tree0326a67ec3cfda91f2419353fdd30b069d9e65c3
parent494fd3bb52e054969eb94ed72dc2d12a6e412fd1 (diff)
downloadscummvm-rg350-84b2dc5cc85721570aa7aafdd9e3e96f0f04a025.tar.gz
scummvm-rg350-84b2dc5cc85721570aa7aafdd9e3e96f0f04a025.tar.bz2
scummvm-rg350-84b2dc5cc85721570aa7aafdd9e3e96f0f04a025.zip
MOHAWK: Fix some clang-tidy warnings
-rw-r--r--engines/mohawk/bitmap.cpp8
-rw-r--r--engines/mohawk/bitmap.h22
-rw-r--r--engines/mohawk/console.h12
-rw-r--r--engines/mohawk/cursors.cpp8
-rw-r--r--engines/mohawk/cursors.h54
-rw-r--r--engines/mohawk/detection.cpp24
-rw-r--r--engines/mohawk/dialogs.cpp18
-rw-r--r--engines/mohawk/dialogs.h34
-rw-r--r--engines/mohawk/graphics.cpp4
-rw-r--r--engines/mohawk/graphics.h2
-rw-r--r--engines/mohawk/installer_archive.cpp6
-rw-r--r--engines/mohawk/installer_archive.h12
-rw-r--r--engines/mohawk/mohawk.cpp8
-rw-r--r--engines/mohawk/mohawk.h7
-rw-r--r--engines/mohawk/myst.cpp91
-rw-r--r--engines/mohawk/myst.h4
-rw-r--r--engines/mohawk/myst_areas.cpp47
-rw-r--r--engines/mohawk/myst_areas.h52
-rw-r--r--engines/mohawk/myst_graphics.h5
-rw-r--r--engines/mohawk/myst_scripts.cpp5
-rw-r--r--engines/mohawk/myst_scripts.h2
-rw-r--r--engines/mohawk/myst_sound.h2
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp8
-rw-r--r--engines/mohawk/myst_stacks/channelwood.h6
-rw-r--r--engines/mohawk/myst_stacks/credits.cpp6
-rw-r--r--engines/mohawk/myst_stacks/credits.h4
-rw-r--r--engines/mohawk/myst_stacks/demo.cpp8
-rw-r--r--engines/mohawk/myst_stacks/demo.h6
-rw-r--r--engines/mohawk/myst_stacks/dni.cpp10
-rw-r--r--engines/mohawk/myst_stacks/dni.h4
-rw-r--r--engines/mohawk/myst_stacks/intro.cpp7
-rw-r--r--engines/mohawk/myst_stacks/intro.h4
-rw-r--r--engines/mohawk/myst_stacks/makingof.cpp3
-rw-r--r--engines/mohawk/myst_stacks/makingof.h4
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp36
-rw-r--r--engines/mohawk/myst_stacks/mechanical.h6
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp41
-rw-r--r--engines/mohawk/myst_stacks/myst.h10
-rw-r--r--engines/mohawk/myst_stacks/preview.cpp11
-rw-r--r--engines/mohawk/myst_stacks/preview.h4
-rw-r--r--engines/mohawk/myst_stacks/selenitic.cpp39
-rw-r--r--engines/mohawk/myst_stacks/selenitic.h6
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp8
-rw-r--r--engines/mohawk/myst_stacks/slides.h4
-rw-r--r--engines/mohawk/myst_stacks/stoneship.cpp33
-rw-r--r--engines/mohawk/myst_stacks/stoneship.h6
-rw-r--r--engines/mohawk/resource.cpp4
-rw-r--r--engines/mohawk/resource.h12
-rw-r--r--engines/mohawk/resource_cache.cpp4
-rw-r--r--engines/mohawk/riven.h2
-rw-r--r--engines/mohawk/riven_graphics.cpp40
-rw-r--r--engines/mohawk/riven_graphics.h10
-rw-r--r--engines/mohawk/riven_inventory.h2
-rw-r--r--engines/mohawk/riven_sound.h2
-rw-r--r--engines/mohawk/riven_video.h2
-rw-r--r--engines/mohawk/sound.cpp10
-rw-r--r--engines/mohawk/sound.h5
-rw-r--r--engines/mohawk/video.cpp6
-rw-r--r--engines/mohawk/video.h2
-rw-r--r--engines/mohawk/view.cpp68
60 files changed, 494 insertions, 376 deletions
diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp
index d8c6d6aacd..205feb824f 100644
--- a/engines/mohawk/bitmap.cpp
+++ b/engines/mohawk/bitmap.cpp
@@ -70,7 +70,7 @@ MohawkBitmap::~MohawkBitmap() {
void MohawkBitmap::decodeImageData(Common::SeekableReadStream *stream) {
_data = stream;
- _header.colorTable.palette = NULL;
+ _header.colorTable.palette = nullptr;
// NOTE: Only the bottom 12 bits of width/height/bytesPerRow are
// considered valid and bytesPerRow has to be an even number.
@@ -650,7 +650,7 @@ MohawkSurface *MystBitmap::decodeImage(Common::SeekableReadStream *stream) {
error("Could not decode Myst bitmap");
const Graphics::Surface *bmpSurface = bitmapDecoder.getSurface();
- Graphics::Surface *newSurface = 0;
+ Graphics::Surface *newSurface = nullptr;
if (bmpSurface->format.bytesPerPixel == 1) {
_bitsPerPixel = 8;
@@ -662,7 +662,7 @@ MohawkSurface *MystBitmap::decodeImage(Common::SeekableReadStream *stream) {
}
// Copy the palette to one of our own
- byte *newPal = 0;
+ byte *newPal = nullptr;
if (bitmapDecoder.hasPalette()) {
const byte *palette = bitmapDecoder.getPalette();
@@ -729,7 +729,7 @@ MohawkSurface *LivingBooksBitmap_v1::decodeImage(Common::SeekableReadStream *str
leRLE8 = true;
_data = stream;
- stream = NULL;
+ stream = nullptr;
}
Graphics::Surface *surface = createSurface(_header.width, _header.height);
diff --git a/engines/mohawk/bitmap.h b/engines/mohawk/bitmap.h
index ea8664f39d..18ea72b3ee 100644
--- a/engines/mohawk/bitmap.h
+++ b/engines/mohawk/bitmap.h
@@ -148,16 +148,16 @@ private:
// Mohawk Bitmap format.
class MystBitmap : public MohawkBitmap {
public:
- MystBitmap() : MohawkBitmap() {}
- ~MystBitmap() {}
+ MystBitmap() : MohawkBitmap(), _bitsPerPixel(8) {}
+ ~MystBitmap() override {}
- MohawkSurface *decodeImage(Common::SeekableReadStream *stream);
+ MohawkSurface *decodeImage(Common::SeekableReadStream *stream) override;
protected:
- byte getBitsPerPixel() { return _bitsPerPixel; }
+ byte getBitsPerPixel() override { return _bitsPerPixel; }
private:
- uint16 _bitsPerPixel;
+ byte _bitsPerPixel;
};
#endif
@@ -165,23 +165,23 @@ private:
class LivingBooksBitmap_v1 : public MohawkBitmap {
public:
LivingBooksBitmap_v1() : MohawkBitmap() {}
- ~LivingBooksBitmap_v1() {}
+ ~LivingBooksBitmap_v1() override {}
- MohawkSurface *decodeImage(Common::SeekableReadStream *stream);
+ MohawkSurface *decodeImage(Common::SeekableReadStream *stream) override;
protected:
- byte getBitsPerPixel() { return 8; }
+ byte getBitsPerPixel() override { return 8; }
};
class DOSBitmap : public MohawkBitmap {
public:
DOSBitmap() : MohawkBitmap() {}
- ~DOSBitmap() {}
+ ~DOSBitmap() override {}
- MohawkSurface *decodeImage(Common::SeekableReadStream *stream);
+ MohawkSurface *decodeImage(Common::SeekableReadStream *stream) override;
protected:
- byte getBitsPerPixel() { return ((_header.format & 0x30) >> 4) + 1; }
+ byte getBitsPerPixel() override { return ((_header.format & 0x30) >> 4) + 1; }
private:
void expandMonochromePlane(Graphics::Surface *surface, Common::SeekableReadStream *rawStream);
diff --git a/engines/mohawk/console.h b/engines/mohawk/console.h
index 0cae87da51..7d94bf576f 100644
--- a/engines/mohawk/console.h
+++ b/engines/mohawk/console.h
@@ -35,8 +35,8 @@ class MohawkEngine_Myst;
class MystConsole : public GUI::Debugger {
public:
- MystConsole(MohawkEngine_Myst *vm);
- virtual ~MystConsole(void);
+ explicit MystConsole(MohawkEngine_Myst *vm);
+ ~MystConsole() override;
private:
MohawkEngine_Myst *_vm;
@@ -66,8 +66,8 @@ class MohawkEngine_Riven;
class RivenConsole : public GUI::Debugger {
public:
- RivenConsole(MohawkEngine_Riven *vm);
- virtual ~RivenConsole(void);
+ explicit RivenConsole(MohawkEngine_Riven *vm);
+ ~RivenConsole() override;
private:
MohawkEngine_Riven *_vm;
@@ -95,8 +95,8 @@ private:
class LivingBooksConsole : public GUI::Debugger {
public:
- LivingBooksConsole(MohawkEngine_LivingBooks *vm);
- virtual ~LivingBooksConsole(void);
+ explicit LivingBooksConsole(MohawkEngine_LivingBooks *vm);
+ ~LivingBooksConsole() override;
private:
MohawkEngine_LivingBooks *_vm;
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp
index cef24e14e5..84b1c73e04 100644
--- a/engines/mohawk/cursors.cpp
+++ b/engines/mohawk/cursors.cpp
@@ -151,7 +151,7 @@ NECursorManager::NECursorManager(const Common::String &appName) {
if (!_exe->loadFromEXE(appName)) {
// Not all have cursors anyway, so this is not a problem
delete _exe;
- _exe = 0;
+ _exe = nullptr;
}
}
@@ -183,10 +183,10 @@ MacCursorManager::MacCursorManager(const Common::String &appName) {
if (!_resFork->open(appName)) {
// Not all have cursors anyway, so this is not a problem
delete _resFork;
- _resFork = 0;
+ _resFork = nullptr;
}
} else {
- _resFork = 0;
+ _resFork = nullptr;
}
}
@@ -219,7 +219,7 @@ LivingBooksCursorManager_v2::LivingBooksCursorManager_v2() {
if (!_sysArchive->openFile("system.mhk")) {
delete _sysArchive;
- _sysArchive = 0;
+ _sysArchive = nullptr;
}
}
diff --git a/engines/mohawk/cursors.h b/engines/mohawk/cursors.h
index d0d38c9b46..ff5db5b59c 100644
--- a/engines/mohawk/cursors.h
+++ b/engines/mohawk/cursors.h
@@ -72,11 +72,11 @@ protected:
// Uses standard tCUR resources
class DefaultCursorManager : public CursorManager {
public:
- DefaultCursorManager(MohawkEngine *vm, uint32 tag = ID_TCUR) : _vm(vm), _tag(tag) {}
- ~DefaultCursorManager() {}
+ explicit DefaultCursorManager(MohawkEngine *vm, uint32 tag = ID_TCUR) : _vm(vm), _tag(tag) {}
+ ~DefaultCursorManager() override {}
- void setCursor(uint16 id);
- bool hasSource() const { return true; }
+ void setCursor(uint16 id) override;
+ bool hasSource() const override { return true; }
private:
MohawkEngine *_vm;
@@ -110,14 +110,14 @@ class MohawkEngine_Myst;
// Uses WDIB + CLRC resources
class MystCursorManager : public CursorManager {
public:
- MystCursorManager(MohawkEngine_Myst *vm);
- ~MystCursorManager();
+ explicit MystCursorManager(MohawkEngine_Myst *vm);
+ ~MystCursorManager() override;
- void showCursor();
- void hideCursor();
- void setCursor(uint16 id);
- void setDefaultCursor();
- bool hasSource() const { return true; }
+ void showCursor() override;
+ void hideCursor() override;
+ void setCursor(uint16 id) override;
+ void setDefaultCursor() override;
+ bool hasSource() const override { return true; }
private:
MohawkEngine_Myst *_vm;
@@ -128,11 +128,11 @@ private:
// The cursor manager for NE EXE's
class NECursorManager : public CursorManager {
public:
- NECursorManager(const Common::String &appName);
- ~NECursorManager();
+ explicit NECursorManager(const Common::String &appName);
+ ~NECursorManager() override;
- void setCursor(uint16 id);
- bool hasSource() const { return _exe != 0; }
+ void setCursor(uint16 id) override;
+ bool hasSource() const override { return _exe != nullptr; }
private:
Common::NEResources *_exe;
@@ -141,11 +141,11 @@ private:
// The cursor manager for Mac applications
class MacCursorManager : public CursorManager {
public:
- MacCursorManager(const Common::String &appName);
- ~MacCursorManager();
+ explicit MacCursorManager(const Common::String &appName);
+ ~MacCursorManager() override;
- void setCursor(uint16 id);
- bool hasSource() const { return _resFork != 0; }
+ void setCursor(uint16 id) override;
+ bool hasSource() const override { return _resFork != nullptr; }
private:
Common::MacResManager *_resFork;
@@ -156,11 +156,11 @@ private:
class LivingBooksCursorManager_v2 : public CursorManager {
public:
LivingBooksCursorManager_v2();
- ~LivingBooksCursorManager_v2();
+ ~LivingBooksCursorManager_v2() override;
- void setCursor(uint16 id);
- void setCursor(const Common::String &name);
- bool hasSource() const { return _sysArchive != 0; }
+ void setCursor(uint16 id) override;
+ void setCursor(const Common::String &name) override;
+ bool hasSource() const override { return _sysArchive != nullptr; }
private:
MohawkArchive *_sysArchive;
@@ -169,11 +169,11 @@ private:
// The cursor manager for PE EXE's
class PECursorManager : public CursorManager {
public:
- PECursorManager(const Common::String &appName);
- ~PECursorManager();
+ explicit PECursorManager(const Common::String &appName);
+ ~PECursorManager() override;
- void setCursor(uint16 id);
- bool hasSource() const { return !_cursors.empty(); }
+ void setCursor(uint16 id) override;
+ bool hasSource() const override { return !_cursors.empty(); }
private:
struct CursorItem {
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index 439ea152c4..82f901d9ad 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -147,7 +147,7 @@ static const PlainGameDescriptor mohawkGames[] = {
{"stellaluna", "Stellaluna"},
{"sheila", "Sheila Rae, the Brave"},
{"rugratsps", "Rugrats Print Shop" },
- {0, 0}
+ {nullptr, nullptr}
};
#include "mohawk/detection_tables.h"
@@ -159,7 +159,7 @@ static const char *directoryGlobs[] = {
"program",
"95instal",
"Rugrats Adventure Game",
- 0
+ nullptr
};
static const ADExtraGuiOptionsMap optionsList[] = {
@@ -184,25 +184,25 @@ public:
_directoryGlobs = directoryGlobs;
}
- virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
+ const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override {
return detectGameFilebased(allFiles, fslist, Mohawk::fileBased);
}
- virtual const char *getName() const {
+ const char *getName() const override {
return "Mohawk";
}
- virtual const char *getOriginalCopyright() const {
+ const char *getOriginalCopyright() const override {
return "Myst and Riven (C) Cyan Worlds\nMohawk OS (C) Ubisoft";
}
- virtual bool hasFeature(MetaEngineFeature f) const;
- virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
- virtual SaveStateList listSaves(const char *target) const;
+ bool hasFeature(MetaEngineFeature f) const override;
+ bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+ SaveStateList listSaves(const char *target) const override;
SaveStateList listSavesForPrefix(const char *prefix, const char *extension) const;
- virtual int getMaximumSaveSlot() const { return 999; }
- virtual void removeSaveState(const char *target, int slot) const;
- virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ int getMaximumSaveSlot() const override { return 999; }
+ void removeSaveState(const char *target, int slot) const override;
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
};
bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -354,7 +354,7 @@ bool MohawkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGa
}
}
- return (gd != 0);
+ return (gd != nullptr);
}
#if PLUGIN_ENABLED_DYNAMIC(MOHAWK)
diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp
index 029867f6a6..13a52f8fd6 100644
--- a/engines/mohawk/dialogs.cpp
+++ b/engines/mohawk/dialogs.cpp
@@ -180,22 +180,22 @@ void MohawkOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd,
MystOptionsDialog::MystOptionsDialog(MohawkEngine_Myst* vm) : MohawkOptionsDialog(vm), _vm(vm) {
// I18N: Option for fast scene switching
- _zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 220, 15, _("~Z~ip Mode Activated"), 0, kZipCmd);
- _transitionsCheckbox = new GUI::CheckboxWidget(this, 15, 30, 220, 15, _("~T~ransitions Enabled"), 0, kTransCmd);
+ _zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 220, 15, _("~Z~ip Mode Activated"), nullptr, kZipCmd);
+ _transitionsCheckbox = new GUI::CheckboxWidget(this, 15, 30, 220, 15, _("~T~ransitions Enabled"), nullptr, kTransCmd);
// I18N: Drop book page
- _dropPageButton = new GUI::ButtonWidget(this, 15, 60, 100, 25, _("~D~rop Page"), 0, kDropCmd);
+ _dropPageButton = new GUI::ButtonWidget(this, 15, 60, 100, 25, _("~D~rop Page"), nullptr, kDropCmd);
// Myst ME only has maps
if (_vm->getFeatures() & GF_ME)
- _showMapButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("Show ~M~ap"), 0, kMapCmd);
+ _showMapButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("Show ~M~ap"), nullptr, kMapCmd);
else
- _showMapButton = 0;
+ _showMapButton = nullptr;
// Myst demo only has a menu
if (_vm->getFeatures() & GF_DEMO)
- _returnToMenuButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("Main Men~u~"), 0, kMenuCmd);
+ _returnToMenuButton = new GUI::ButtonWidget(this, 15, 95, 100, 25, _("Main Men~u~"), nullptr, kMenuCmd);
else
- _returnToMenuButton = 0;
+ _returnToMenuButton = nullptr;
}
MystOptionsDialog::~MystOptionsDialog() {
@@ -266,8 +266,8 @@ void MystOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, ui
RivenOptionsDialog::RivenOptionsDialog(MohawkEngine_Riven* vm) :
MohawkOptionsDialog(vm),
_vm(vm) {
- _zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 220, 15, _("~Z~ip Mode Activated"), 0, kZipCmd);
- _waterEffectCheckbox = new GUI::CheckboxWidget(this, 15, 30, 220, 15, _("~W~ater Effect Enabled"), 0, kWaterCmd);
+ _zipModeCheckbox = new GUI::CheckboxWidget(this, 15, 10, 220, 15, _("~Z~ip Mode Activated"), nullptr, kZipCmd);
+ _waterEffectCheckbox = new GUI::CheckboxWidget(this, 15, 30, 220, 15, _("~W~ater Effect Enabled"), nullptr, kWaterCmd);
_transitionModeCaption = new GUI::StaticTextWidget(this, 15, 50, 90, 20, _("Transitions:"), Graphics::kTextAlignRight);
_transitionModePopUp = new GUI::PopUpWidget(this, 115, 50, 120, 20);
diff --git a/engines/mohawk/dialogs.h b/engines/mohawk/dialogs.h
index d7e822c2a9..9e892d768d 100644
--- a/engines/mohawk/dialogs.h
+++ b/engines/mohawk/dialogs.h
@@ -53,35 +53,35 @@ public:
void setInfoText(const Common::String &message);
- virtual void handleMouseDown(int x, int y, int button, int clickCount) {
+ void handleMouseDown(int x, int y, int button, int clickCount) override {
setResult(0);
close();
}
- virtual void handleKeyDown(Common::KeyState state) {
+ void handleKeyDown(Common::KeyState state) override {
setResult(state.ascii);
close();
}
- virtual void reflowLayout();
+ void reflowLayout() override;
};
class PauseDialog : public InfoDialog {
public:
PauseDialog(MohawkEngine* vm, const Common::String &message);
- virtual void handleKeyDown(Common::KeyState state);
+ void handleKeyDown(Common::KeyState state) override;
};
#if defined(ENABLE_MYST) || defined(ENABLE_RIVEN)
class MohawkOptionsDialog : public GUI::Dialog {
public:
- MohawkOptionsDialog(MohawkEngine *_vm);
- virtual ~MohawkOptionsDialog();
+ explicit MohawkOptionsDialog(MohawkEngine *_vm);
+ ~MohawkOptionsDialog() override;
- virtual void open() override;
- virtual void reflowLayout() override;
- virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+ void open() override;
+ void reflowLayout() override;
+ void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
int getLoadSlot() const { return _loadSlot; }
int getSaveSlot() const { return _saveSlot; }
@@ -112,11 +112,11 @@ class MohawkEngine_Myst;
class MystOptionsDialog : public MohawkOptionsDialog {
public:
- MystOptionsDialog(MohawkEngine_Myst *vm);
- virtual ~MystOptionsDialog();
+ explicit MystOptionsDialog(MohawkEngine_Myst *vm);
+ ~MystOptionsDialog() override;
- virtual void open() override;
- virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+ void open() override;
+ void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
private:
MohawkEngine_Myst *_vm;
@@ -137,11 +137,11 @@ class MohawkEngine_Riven;
class RivenOptionsDialog : public MohawkOptionsDialog {
public:
- RivenOptionsDialog(MohawkEngine_Riven *vm);
- virtual ~RivenOptionsDialog();
+ explicit RivenOptionsDialog(MohawkEngine_Riven *vm);
+ ~RivenOptionsDialog() override;
- virtual void open() override;
- virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
+ void open() override;
+ void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) override;
private:
MohawkEngine_Riven *_vm;
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index ea9b57ae17..fe675235c1 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -30,7 +30,7 @@
namespace Mohawk {
-MohawkSurface::MohawkSurface() : _surface(0), _palette(0) {
+MohawkSurface::MohawkSurface() : _surface(nullptr), _palette(nullptr) {
_offsetX = 0;
_offsetY = 0;
}
@@ -64,7 +64,7 @@ void MohawkSurface::convertToTrueColor() {
_surface->free();
delete _surface;
free(_palette);
- _palette = 0;
+ _palette = nullptr;
_surface = surface;
}
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index f9fdeea15f..797fc1c080 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -41,7 +41,7 @@ class MohawkBitmap;
class MohawkSurface {
public:
MohawkSurface();
- MohawkSurface(Graphics::Surface *surface, byte *palette = NULL, int offsetX = 0, int offsetY = 0);
+ explicit MohawkSurface(Graphics::Surface *surface, byte *palette = nullptr, int offsetX = 0, int offsetY = 0);
~MohawkSurface();
// getSurface() returns the surface in the current format
diff --git a/engines/mohawk/installer_archive.cpp b/engines/mohawk/installer_archive.cpp
index 0abc930683..62fc953f53 100644
--- a/engines/mohawk/installer_archive.cpp
+++ b/engines/mohawk/installer_archive.cpp
@@ -28,7 +28,7 @@
namespace Mohawk {
InstallerArchive::InstallerArchive() : Common::Archive() {
- _stream = 0;
+ _stream = nullptr;
}
InstallerArchive::~InstallerArchive() {
@@ -103,7 +103,7 @@ bool InstallerArchive::open(const Common::String &filename) {
}
void InstallerArchive::close() {
- delete _stream; _stream = 0;
+ delete _stream; _stream = nullptr;
_map.clear();
}
@@ -124,7 +124,7 @@ const Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String
Common::SeekableReadStream *InstallerArchive::createReadStreamForMember(const Common::String &name) const {
if (!_stream || !_map.contains(name))
- return 0;
+ return nullptr;
const FileEntry &entry = _map[name];
diff --git a/engines/mohawk/installer_archive.h b/engines/mohawk/installer_archive.h
index c3212d7f7c..19f6343b80 100644
--- a/engines/mohawk/installer_archive.h
+++ b/engines/mohawk/installer_archive.h
@@ -36,17 +36,17 @@ namespace Mohawk {
class InstallerArchive : public Common::Archive {
public:
InstallerArchive();
- ~InstallerArchive();
+ ~InstallerArchive() override;
bool open(const Common::String &filename);
void close();
- bool isOpen() const { return _stream != 0; }
+ bool isOpen() const { return _stream != nullptr; }
// Common::Archive API implementation
- bool hasFile(const Common::String &name) const;
- int listMembers(Common::ArchiveMemberList &list) const;
- const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
- Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
+ bool hasFile(const Common::String &name) const override;
+ int listMembers(Common::ArchiveMemberList &list) const override;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
+ Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
private:
struct FileEntry {
diff --git a/engines/mohawk/mohawk.cpp b/engines/mohawk/mohawk.cpp
index 53481af8a7..52f73dbbb1 100644
--- a/engines/mohawk/mohawk.cpp
+++ b/engines/mohawk/mohawk.cpp
@@ -41,8 +41,8 @@ MohawkEngine::MohawkEngine(OSystem *syst, const MohawkGameDescription *gamedesc)
// Setup mixer
syncSoundSettings();
- _pauseDialog = 0;
- _cursor = 0;
+ _pauseDialog = nullptr;
+ _cursor = nullptr;
}
MohawkEngine::~MohawkEngine() {
@@ -70,7 +70,6 @@ Common::SeekableReadStream *MohawkEngine::getResource(uint32 tag, uint16 id) {
return _mhk[i]->getResource(tag, id);
error("Could not find a '%s' resource with ID %04x", tag2str(tag), id);
- return NULL;
}
bool MohawkEngine::hasResource(uint32 tag, uint16 id) {
@@ -95,7 +94,6 @@ uint32 MohawkEngine::getResourceOffset(uint32 tag, uint16 id) {
return _mhk[i]->getOffset(tag, id);
error("Could not find a '%s' resource with ID %04x", tag2str(tag), id);
- return 0;
}
uint16 MohawkEngine::findResourceID(uint32 tag, const Common::String &resName) {
@@ -104,7 +102,6 @@ uint16 MohawkEngine::findResourceID(uint32 tag, const Common::String &resName) {
return _mhk[i]->findResourceID(tag, resName);
error("Could not find a '%s' resource matching name '%s'", tag2str(tag), resName.c_str());
- return 0xFFFF;
}
Common::String MohawkEngine::getResourceName(uint32 tag, uint16 id) {
@@ -114,7 +111,6 @@ Common::String MohawkEngine::getResourceName(uint32 tag, uint16 id) {
}
error("Could not find a \'%s\' resource with ID %04x", tag2str(tag), id);
- return 0;
}
} // End of namespace Mohawk
diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h
index c6781ae448..a3583a551f 100644
--- a/engines/mohawk/mohawk.h
+++ b/engines/mohawk/mohawk.h
@@ -80,23 +80,22 @@ class CursorManager;
class MohawkEngine : public ::Engine {
protected:
- virtual Common::Error run();
+ Common::Error run() override;
public:
MohawkEngine(OSystem *syst, const MohawkGameDescription *gamedesc);
- virtual ~MohawkEngine();
+ ~MohawkEngine() override;
// Detection related functions
const MohawkGameDescription *_gameDescription;
const char *getGameId() const;
uint32 getFeatures() const;
const char *getAppName() const;
- uint16 getVersion() const;
Common::Platform getPlatform() const;
uint8 getGameType() const;
Common::Language getLanguage() const;
- bool hasFeature(EngineFeature f) const;
+ bool hasFeature(EngineFeature f) const override;
CursorManager *_cursor;
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp
index 5baa89cea8..9103b03a31 100644
--- a/engines/mohawk/myst.cpp
+++ b/engines/mohawk/myst.cpp
@@ -54,7 +54,8 @@
namespace Mohawk {
-MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription *gamedesc) : MohawkEngine(syst, gamedesc) {
+MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription *gamedesc) :
+ MohawkEngine(syst, gamedesc) {
DebugMan.addDebugChannel(kDebugVariable, "Variable", "Track Variable Accesses");
DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
DebugMan.addDebugChannel(kDebugView, "View", "Track Card File (VIEW) Parsing");
@@ -69,6 +70,7 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_currentCursor = 0;
_mainCursor = kDefaultMystCursor;
_showResourceRects = false;
+ _curStack = 0;
_curCard = 0;
_hoverResource = nullptr;
@@ -82,6 +84,7 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_scriptParser = nullptr;
_gameState = nullptr;
_optionsDialog = nullptr;
+ _rnd = nullptr;
_prevStack = nullptr;
@@ -89,6 +92,12 @@ MohawkEngine_Myst::MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription
_mouseMoved = false;
_escapePressed = false;
_interactive = true;
+ _runExitScript = true;
+
+ _needsPageDrop = false;
+ _needsShowCredits = false;
+ _needsShowDemoMenu = false;
+ _needsShowMap = false;
}
MohawkEngine_Myst::~MohawkEngine_Myst() {
@@ -340,9 +349,6 @@ Common::Error MohawkEngine_Myst::run() {
_mhk.push_back(mhk);
}
- // Test Load Function...
- loadHelp(10000);
-
while (!shouldQuit()) {
doFrame();
}
@@ -724,7 +730,7 @@ void MohawkEngine_Myst::checkCurrentResource() {
}
for (uint16 i = 0; i < _resources.size(); i++) {
- if (_resources[i]->contains(mouse) && _resources[i]->type == kMystAreaHover
+ if (_resources[i]->contains(mouse) && _resources[i]->hasType(kMystAreaHover)
&& _hoverResource != _resources[i]) {
_hoverResource = static_cast<MystAreaHover *>(_resources[i]);
_hoverResource->handleMouseEnter();
@@ -955,50 +961,6 @@ void MohawkEngine_Myst::runExitScript() {
_scriptParser->runScript(script);
}
-void MohawkEngine_Myst::loadHelp(uint16 id) {
- // The original version did not have the help system
- if (!(getFeatures() & GF_ME))
- return;
-
- // TODO: Help File contains 5 cards i.e. VIEW, RLST, etc.
- // in addition to HELP resources.
- // These are Ids 9930 to 9934
- // Need to deal with loading and displaying these..
- // Current engine structure only supports display of
- // card from primary stack MHK
-
- debugC(kDebugHelp, "Loading Help System Data");
-
- Common::SeekableReadStream *helpStream = getResource(ID_HELP, id);
-
- uint16 count = helpStream->readUint16LE();
- uint16 *u0 = new uint16[count];
- Common::String helpText;
-
- debugC(kDebugHelp, "\tcount: %d", count);
-
- for (uint16 i = 0; i < count; i++) {
- u0[i] = helpStream->readUint16LE();
- debugC(kDebugHelp, "\tu0[%d]: %d", i, u0[i]);
- }
-
- // TODO: Previous values i.e. u0[0] to u0[count - 2]
- // appear to be resource ids in the help.dat file..
- if (u0[count - 1] != count)
- warning("loadHelp(): last u0 value is not equal to count");
-
- do {
- helpText += helpStream->readByte();
- } while (helpText.lastChar() != 0);
- helpText.deleteLastChar();
-
- debugC(kDebugHelp, "\thelpText: \"%s\"", helpText.c_str());
-
- delete[] u0;
-
- delete helpStream;
-}
-
void MohawkEngine_Myst::loadCursorHints() {
_cursorHints.clear();
@@ -1059,7 +1021,7 @@ void MohawkEngine_Myst::checkCursorHints() {
// Check all the cursor hints to see if we're in a hotspot that contains a hint.
for (uint16 i = 0; i < _cursorHints.size(); i++)
- if (_resources[_cursorHints[i].id] == _activeResource && _activeResource->isEnabled()) {
+ if (_activeResource && _resources[_cursorHints[i].id] == _activeResource && _activeResource->isEnabled()) {
if (_cursorHints[i].cursor == -1) {
uint16 var_value = _scriptParser->getVar(_cursorHints[i].variableHint.var);
@@ -1107,7 +1069,7 @@ void MohawkEngine_Myst::redrawResource(MystAreaImageSwitch *resource, bool updat
void MohawkEngine_Myst::redrawArea(uint16 var, bool update) {
for (uint16 i = 0; i < _resources.size(); i++)
- if (_resources[i]->type == kMystAreaImageSwitch && _resources[i]->getImageSwitchVar() == var)
+ if (_resources[i]->hasType(kMystAreaImageSwitch) && _resources[i]->getImageSwitchVar() == var)
redrawResource(static_cast<MystAreaImageSwitch *>(_resources[i]), update);
}
@@ -1120,36 +1082,34 @@ MystArea *MohawkEngine_Myst::loadResource(Common::SeekableReadStream *rlstStream
switch (type) {
case kMystAreaAction:
- resource = new MystAreaAction(this, rlstStream, parent);
+ resource = new MystAreaAction(this, type, rlstStream, parent);
break;
case kMystAreaVideo:
- resource = new MystAreaVideo(this, rlstStream, parent);
+ resource = new MystAreaVideo(this, type, rlstStream, parent);
break;
case kMystAreaActionSwitch:
- resource = new MystAreaActionSwitch(this, rlstStream, parent);
+ resource = new MystAreaActionSwitch(this, type, rlstStream, parent);
break;
case kMystAreaImageSwitch:
- resource = new MystAreaImageSwitch(this, rlstStream, parent);
+ resource = new MystAreaImageSwitch(this, type, rlstStream, parent);
break;
case kMystAreaSlider:
- resource = new MystAreaSlider(this, rlstStream, parent);
+ resource = new MystAreaSlider(this, type, rlstStream, parent);
break;
case kMystAreaDrag:
- resource = new MystAreaDrag(this, rlstStream, parent);
+ resource = new MystAreaDrag(this, type, rlstStream, parent);
break;
case kMystVideoInfo:
- resource = new MystVideoInfo(this, rlstStream, parent);
+ resource = new MystVideoInfo(this, type, rlstStream, parent);
break;
case kMystAreaHover:
- resource = new MystAreaHover(this, rlstStream, parent);
+ resource = new MystAreaHover(this, type, rlstStream, parent);
break;
default:
- resource = new MystArea(this, rlstStream, parent);
+ resource = new MystArea(this, type, rlstStream, parent);
break;
}
- resource->type = type;
-
return resource;
}
@@ -1277,9 +1237,9 @@ MystSoundBlock MohawkEngine_Myst::readSoundBlock(Common::ReadStream *stream) con
debugC(kDebugView, "\tSound: %d", soundBlock.sound);
soundBlock.soundVolume = stream->readUint16LE();
debugC(kDebugView, "\tVolume: %d", soundBlock.soundVolume);
- } else if (soundBlock.sound == kMystSoundActionContinue)
+ } else if (soundBlock.sound == kMystSoundActionContinue) {
debugC(kDebugView, "Continue current sound");
- else if (soundBlock.sound == kMystSoundActionChangeVolume) {
+ } else if (soundBlock.sound == kMystSoundActionChangeVolume) {
debugC(kDebugView, "Continue current sound, change volume");
soundBlock.soundVolume = stream->readUint16LE();
debugC(kDebugView, "\tVolume: %d", soundBlock.soundVolume);
@@ -1305,8 +1265,7 @@ MystSoundBlock MohawkEngine_Myst::readSoundBlock(Common::ReadStream *stream) con
soundBlock.soundList.push_back(sound);
}
} else {
- debugC(kDebugView, "Unknown");
- warning("Unknown sound control value '%d' in card '%d'", soundBlock.sound, _curCard);
+ error("Unknown sound control value '%d' in card '%d'", soundBlock.sound, _curCard);
}
return soundBlock;
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 3f756faee0..379110fbc4 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -176,7 +176,7 @@ protected:
public:
MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription *gamedesc);
- virtual ~MohawkEngine_Myst();
+ ~MohawkEngine_Myst() override;
Common::SeekableReadStream *getResource(uint32 tag, uint16 id) override;
Common::Array<uint16> getResourceIDList(uint32 type) const;
@@ -264,8 +264,6 @@ private:
void runInitScript();
void runExitScript();
- void loadHelp(uint16 id);
-
void loadResources();
void drawResourceRects();
void checkCurrentResource();
diff --git a/engines/mohawk/myst_areas.cpp b/engines/mohawk/myst_areas.cpp
index 7cc39e97b2..c9172ce366 100644
--- a/engines/mohawk/myst_areas.cpp
+++ b/engines/mohawk/myst_areas.cpp
@@ -32,9 +32,10 @@
namespace Mohawk {
-MystArea::MystArea(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) {
- _vm = vm;
- _parent = parent;
+MystArea::MystArea(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ _vm(vm),
+ _parent(parent),
+ _type(type) {
if (parent == nullptr) {
_flags = rlstStream->readUint16LE();
@@ -77,7 +78,7 @@ void MystArea::handleMouseUp() {
uint16 opcode;
- switch (type) {
+ switch (_type) {
case kMystAreaForward:
opcode = 6;
break;
@@ -118,7 +119,7 @@ void MystArea::setEnabled(bool enabled) {
const Common::String MystArea::describe() {
Common::String desc = Common::String::format("type: %2d rect: (%3d %3d %3d %3d)",
- type, _rect.left, _rect.top, _rect.width(), _rect.height());
+ _type, _rect.left, _rect.top, _rect.width(), _rect.height());
if (_dest != 0)
desc += Common::String::format(" dest: %4d", _dest);
@@ -137,8 +138,8 @@ void MystArea::drawBoundingRect() {
}
}
-MystAreaAction::MystAreaAction(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystArea(vm, rlstStream, parent) {
+MystAreaAction::MystAreaAction(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystArea(vm, type, rlstStream, parent) {
debugC(kDebugResource, "\tResource Type 5 Script:");
_script = vm->_scriptParser->readScript(rlstStream, kMystScriptNormal);
@@ -175,8 +176,8 @@ Common::String MystAreaVideo::convertMystVideoName(const Common::String &name) {
return temp + ".mov";
}
-MystAreaVideo::MystAreaVideo(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystAreaAction(vm, rlstStream, parent) {
+MystAreaVideo::MystAreaVideo(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystAreaAction(vm, type, rlstStream, parent) {
char c = 0;
do {
@@ -281,8 +282,8 @@ void MystAreaVideo::pauseMovie(bool pause) {
handle->pause(pause);
}
-MystAreaActionSwitch::MystAreaActionSwitch(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystArea(vm, rlstStream, parent) {
+MystAreaActionSwitch::MystAreaActionSwitch(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystArea(vm, type, rlstStream, parent) {
_actionSwitchVar = rlstStream->readUint16LE();
uint16 numSubResources = rlstStream->readUint16LE();
debugC(kDebugResource, "\tactionSwitchVar: %d", _actionSwitchVar);
@@ -335,8 +336,8 @@ void MystAreaActionSwitch::handleMouseDown() {
doSwitch(&MystArea::handleMouseDown);
}
-MystAreaImageSwitch::MystAreaImageSwitch(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystAreaActionSwitch(vm, rlstStream, parent) {
+MystAreaImageSwitch::MystAreaImageSwitch(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystAreaActionSwitch(vm, type, rlstStream, parent) {
_imageSwitchVar = rlstStream->readUint16LE();
uint16 numSubImages = rlstStream->readUint16LE();
debugC(kDebugResource, "\tvar8: %d", _imageSwitchVar);
@@ -477,8 +478,8 @@ const Common::String MystAreaImageSwitch::describe() {
// No MystResourceType9!
-MystAreaSlider::MystAreaSlider(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystAreaDrag(vm, rlstStream, parent) {
+MystAreaSlider::MystAreaSlider(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystAreaDrag(vm, type, rlstStream, parent) {
_dragSound = rlstStream->readUint16LE();
debugC(kDebugResource, "\tdrag sound : %d", _dragSound);
@@ -643,8 +644,8 @@ void MystAreaSlider::updatePosition(const Common::Point &mouse) {
_vm->_sound->playEffect(_dragSound);
}
-MystAreaDrag::MystAreaDrag(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystAreaImageSwitch(vm, rlstStream, parent) {
+MystAreaDrag::MystAreaDrag(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystAreaImageSwitch(vm, type, rlstStream, parent) {
_flagHV = rlstStream->readUint16LE();
_minH = rlstStream->readUint16LE();
_maxH = rlstStream->readUint16LE();
@@ -748,8 +749,8 @@ uint16 MystAreaDrag::getList3(uint16 index) {
return (index < _lists[2].size()) ? _lists[2][index] : 0;
}
-MystVideoInfo::MystVideoInfo(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystAreaDrag(vm, rlstStream, parent) {
+MystVideoInfo::MystVideoInfo(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystAreaDrag(vm, type, rlstStream, parent) {
_numFrames = rlstStream->readUint16LE();
_firstFrame = rlstStream->readUint16LE();
uint16 frameWidth = rlstStream->readUint16LE();
@@ -774,8 +775,8 @@ MystVideoInfo::~MystVideoInfo() {
}
void MystVideoInfo::drawFrame(uint16 frame) {
- _currentFrame = _firstFrame + frame;
- _vm->_gfx->copyImageToScreen(_currentFrame, _frameRect);
+ uint16 currentFrame = _firstFrame + frame;
+ _vm->_gfx->copyImageToScreen(currentFrame, _frameRect);
}
bool MystVideoInfo::pullLeverV() {
@@ -810,8 +811,8 @@ void MystVideoInfo::releaseLeverV() {
}
}
-MystAreaHover::MystAreaHover(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent) :
- MystArea(vm, rlstStream, parent) {
+MystAreaHover::MystAreaHover(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent) :
+ MystArea(vm, type, rlstStream, parent) {
_enterOpcode = rlstStream->readUint16LE();
_leaveOpcode = rlstStream->readUint16LE();
diff --git a/engines/mohawk/myst_areas.h b/engines/mohawk/myst_areas.h
index 32b6ca4f2f..bfd370d504 100644
--- a/engines/mohawk/myst_areas.h
+++ b/engines/mohawk/myst_areas.h
@@ -58,12 +58,13 @@ enum {
class MystArea {
public:
- MystArea(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ MystArea(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
virtual ~MystArea();
virtual const Common::String describe();
void drawBoundingRect();
+ bool hasType(ResourceType type) const { return _type == type; }
bool contains(Common::Point point) { return _rect.contains(point); }
virtual void drawDataToScreen() {}
virtual void handleCardChange() {}
@@ -83,10 +84,10 @@ public:
virtual void handleMouseDrag() {}
MystArea *_parent;
- ResourceType type;
protected:
MohawkEngine_Myst *_vm;
+ ResourceType _type;
uint16 _flags;
Common::Rect _rect;
uint16 _dest;
@@ -94,7 +95,7 @@ protected:
class MystAreaAction : public MystArea {
public:
- MystAreaAction(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ MystAreaAction(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
void handleMouseUp() override;
const Common::String describe() override;
@@ -105,7 +106,7 @@ protected:
class MystAreaVideo : public MystAreaAction {
public:
- MystAreaVideo(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ MystAreaVideo(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
VideoEntryPtr playMovie();
VideoEntryPtr getVideo();
@@ -131,14 +132,14 @@ protected:
class MystAreaActionSwitch : public MystArea {
public:
- MystAreaActionSwitch(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
- virtual ~MystAreaActionSwitch();
+ MystAreaActionSwitch(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ ~MystAreaActionSwitch() override;
- virtual void drawDataToScreen() override;
- virtual void handleCardChange() override;
+ void drawDataToScreen() override;
+ void handleCardChange() override;
- virtual void handleMouseUp() override;
- virtual void handleMouseDown() override;
+ void handleMouseUp() override;
+ void handleMouseDown() override;
MystArea *getSubResource(uint16 index) { return _subResources[index]; }
protected:
@@ -152,16 +153,16 @@ protected:
class MystAreaImageSwitch : public MystAreaActionSwitch {
public:
- MystAreaImageSwitch(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
- virtual ~MystAreaImageSwitch();
+ MystAreaImageSwitch(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ ~MystAreaImageSwitch() override;
struct SubImage {
uint16 wdib;
Common::Rect rect;
};
- virtual const Common::String describe() override;
- virtual void drawDataToScreen() override;
+ const Common::String describe() override;
+ void drawDataToScreen() override;
void drawConditionalDataToScreen(uint16 state, bool update = true);
uint16 getImageSwitchVar() override;
@@ -175,14 +176,14 @@ protected:
class MystAreaDrag : public MystAreaImageSwitch {
public:
- MystAreaDrag(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
- virtual ~MystAreaDrag();
+ MystAreaDrag(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ ~MystAreaDrag() override;
const Common::String describe() override;
- virtual void handleMouseDown() override;
- virtual void handleMouseUp() override;
- virtual void handleMouseDrag() override;
+ void handleMouseDown() override;
+ void handleMouseUp() override;
+ void handleMouseDrag() override;
uint16 getList1(uint16 index);
uint16 getList2(uint16 index);
@@ -214,8 +215,8 @@ protected:
class MystAreaSlider : public MystAreaDrag {
public:
- MystAreaSlider(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
- virtual ~MystAreaSlider();
+ MystAreaSlider(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ ~MystAreaSlider() override;
void handleMouseDown() override;
void handleMouseUp() override;
@@ -235,8 +236,8 @@ protected:
class MystVideoInfo : public MystAreaDrag {
public:
- MystVideoInfo(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
- virtual ~MystVideoInfo();
+ MystVideoInfo(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ ~MystVideoInfo() override;
void drawFrame(uint16 frame);
bool pullLeverV();
@@ -247,14 +248,11 @@ protected:
uint16 _numFrames;
uint16 _firstFrame;
Common::Rect _frameRect;
-
-private:
- uint16 _currentFrame;
};
class MystAreaHover : public MystArea {
public:
- MystAreaHover(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystArea *parent);
+ MystAreaHover(MohawkEngine_Myst *vm, ResourceType type, Common::SeekableReadStream *rlstStream, MystArea *parent);
const Common::String describe() override;
diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h
index 44669bd6dc..b8217f6cfc 100644
--- a/engines/mohawk/myst_graphics.h
+++ b/engines/mohawk/myst_graphics.h
@@ -40,8 +40,8 @@ enum RectState {
class MystGraphics : public GraphicsManager {
public:
- MystGraphics(MohawkEngine_Myst *vm);
- ~MystGraphics();
+ explicit MystGraphics(MohawkEngine_Myst *vm);
+ ~MystGraphics() override;
void copyImageSectionToScreen(uint16 image, Common::Rect src, Common::Rect dest);
void copyImageSectionToBackBuffer(uint16 image, Common::Rect src, Common::Rect dest);
@@ -51,7 +51,6 @@ public:
void runTransition(TransitionType type, Common::Rect rect, uint16 steps, uint16 delay);
void drawRect(Common::Rect rect, RectState state);
void drawLine(const Common::Point &p1, const Common::Point &p2, uint32 color);
- void enableDrawingTimeSimulation(bool enable);
void fadeToBlack();
void fadeFromBlack();
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index ba426505e1..70923e93d5 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -40,6 +40,7 @@ MystScriptEntry::MystScriptEntry() {
var = 0;
resourceId = 0;
u1 = 0;
+ opcode = 0;
}
const uint8 MystScriptParser::_stackMap[11] = {
@@ -79,8 +80,10 @@ MystScriptParser::MystScriptParser(MohawkEngine_Myst *vm) :
_invokingResource = nullptr;
_savedCardId = 0;
_savedCursorId = 0;
+ _savedMapCardId = 0;
_tempVar = 0;
_scriptNestingLevel = 0;
+ _startTime = 0;
}
MystScriptParser::~MystScriptParser() {
@@ -800,6 +803,8 @@ void MystScriptParser::showMap() {
}
void MystScriptParser::o_exitMap(uint16 var, const ArgumentsArray &args) {
+ assert(_savedMapCardId);
+
_vm->changeToCard(_savedMapCardId, kTransitionCopy);
}
diff --git a/engines/mohawk/myst_scripts.h b/engines/mohawk/myst_scripts.h
index a336f0239a..3ef8663324 100644
--- a/engines/mohawk/myst_scripts.h
+++ b/engines/mohawk/myst_scripts.h
@@ -60,7 +60,7 @@ typedef Common::SharedPtr<Common::Array<MystScriptEntry> > MystScript;
class MystScriptParser {
public:
- MystScriptParser(MohawkEngine_Myst *vm);
+ explicit MystScriptParser(MohawkEngine_Myst *vm);
virtual ~MystScriptParser();
void runScript(MystScript script, MystArea *invokingResource = nullptr);
diff --git a/engines/mohawk/myst_sound.h b/engines/mohawk/myst_sound.h
index 71df23df39..953017097d 100644
--- a/engines/mohawk/myst_sound.h
+++ b/engines/mohawk/myst_sound.h
@@ -39,7 +39,7 @@ class MohawkEngine_Myst;
class MystSound {
public:
- MystSound(MohawkEngine_Myst *vm);
+ explicit MystSound(MohawkEngine_Myst *vm);
~MystSound();
// Effect channel
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index 17df749c74..8d95be0f79 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -37,7 +37,13 @@ namespace Mohawk {
namespace MystStacks {
Channelwood::Channelwood(MohawkEngine_Myst *vm) :
- MystScriptParser(vm), _state(vm->_gameState->_channelwood) {
+ MystScriptParser(vm),
+ _state(vm->_gameState->_channelwood),
+ _valveVar(0),
+ _siriusDrawerState(0),
+ _doorOpened(0),
+ _leverPulled(false),
+ _leverAction(nullptr) {
setupOpcodes();
}
diff --git a/engines/mohawk/myst_stacks/channelwood.h b/engines/mohawk/myst_stacks/channelwood.h
index 6b8ba9dff7..3302a8e17b 100644
--- a/engines/mohawk/myst_stacks/channelwood.h
+++ b/engines/mohawk/myst_stacks/channelwood.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class Channelwood : public MystScriptParser {
public:
- Channelwood(MohawkEngine_Myst *vm);
- ~Channelwood();
+ explicit Channelwood(MohawkEngine_Myst *vm);
+ ~Channelwood() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
@@ -49,7 +49,7 @@ private:
void toggleVar(uint16 var) override;
bool setVarValue(uint16 var, uint16 value) override;
- virtual uint16 getMap() override { return 9932; }
+ uint16 getMap() override { return 9932; }
DECLARE_OPCODE(o_bridgeToggle);
DECLARE_OPCODE(o_pipeExtend);
diff --git a/engines/mohawk/myst_stacks/credits.cpp b/engines/mohawk/myst_stacks/credits.cpp
index ba49ac2201..2d3b3669c2 100644
--- a/engines/mohawk/myst_stacks/credits.cpp
+++ b/engines/mohawk/myst_stacks/credits.cpp
@@ -34,9 +34,11 @@ namespace MystStacks {
// NOTE: Credits Start Card is 10000
-Credits::Credits(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
+Credits::Credits(MohawkEngine_Myst *vm) :
+ MystScriptParser(vm),
+ _creditsRunning(false),
+ _curImage(0) {
setupOpcodes();
- _curImage = 0;
}
Credits::~Credits() {
diff --git a/engines/mohawk/myst_stacks/credits.h b/engines/mohawk/myst_stacks/credits.h
index bea5381534..966d93068a 100644
--- a/engines/mohawk/myst_stacks/credits.h
+++ b/engines/mohawk/myst_stacks/credits.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class Credits : public MystScriptParser {
public:
- Credits(MohawkEngine_Myst *vm);
- ~Credits();
+ explicit Credits(MohawkEngine_Myst *vm);
+ ~Credits() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
diff --git a/engines/mohawk/myst_stacks/demo.cpp b/engines/mohawk/myst_stacks/demo.cpp
index 7ae55686c5..d2ba70c198 100644
--- a/engines/mohawk/myst_stacks/demo.cpp
+++ b/engines/mohawk/myst_stacks/demo.cpp
@@ -30,10 +30,12 @@
namespace Mohawk {
namespace MystStacks {
-Demo::Demo(MohawkEngine_Myst *vm) : Intro(vm) {
+Demo::Demo(MohawkEngine_Myst *vm) :
+ Intro(vm),
+ _returnToMenuRunning(false),
+ _returnToMenuStep(0),
+ _returnToMenuNextTime(0) {
setupOpcodes();
-
- _returnToMenuStep = 0;
}
Demo::~Demo() {
diff --git a/engines/mohawk/myst_stacks/demo.h b/engines/mohawk/myst_stacks/demo.h
index 337ddaae98..acb224b6cf 100644
--- a/engines/mohawk/myst_stacks/demo.h
+++ b/engines/mohawk/myst_stacks/demo.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class Demo : public Intro {
public:
- Demo(MohawkEngine_Myst *vm);
- ~Demo();
+ explicit Demo(MohawkEngine_Myst *vm);
+ ~Demo() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
@@ -52,8 +52,6 @@ private:
DECLARE_OPCODE(o_returnToMenu_init);
- DECLARE_OPCODE(opcode_300);
-
bool _returnToMenuRunning;
uint16 _returnToMenuStep; // 42
uint32 _returnToMenuNextTime; // 6
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp
index ba53c70037..7c226ede40 100644
--- a/engines/mohawk/myst_stacks/dni.cpp
+++ b/engines/mohawk/myst_stacks/dni.cpp
@@ -34,9 +34,15 @@ namespace Mohawk {
namespace MystStacks {
Dni::Dni(MohawkEngine_Myst *vm) :
- MystScriptParser(vm) {
+ MystScriptParser(vm),
+ _notSeenAtrus(true),
+ _atrusRunning(false),
+ _waitForLoop(false),
+ _atrusLeft(false),
+ _atrusLeftTime(0),
+ _loopStart(0),
+ _loopEnd(0) {
setupOpcodes();
- _notSeenAtrus = true;
}
Dni::~Dni() {
diff --git a/engines/mohawk/myst_stacks/dni.h b/engines/mohawk/myst_stacks/dni.h
index 7ba49b1936..30c9329fe6 100644
--- a/engines/mohawk/myst_stacks/dni.h
+++ b/engines/mohawk/myst_stacks/dni.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class Dni : public MystScriptParser {
public:
- Dni(MohawkEngine_Myst *vm);
- ~Dni();
+ explicit Dni(MohawkEngine_Myst *vm);
+ ~Dni() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
diff --git a/engines/mohawk/myst_stacks/intro.cpp b/engines/mohawk/myst_stacks/intro.cpp
index 2b431e834a..44be90b5f4 100644
--- a/engines/mohawk/myst_stacks/intro.cpp
+++ b/engines/mohawk/myst_stacks/intro.cpp
@@ -31,7 +31,12 @@
namespace Mohawk {
namespace MystStacks {
-Intro::Intro(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
+Intro::Intro(MohawkEngine_Myst *vm) :
+ MystScriptParser(vm),
+ _introMoviesRunning(false),
+ _introStep(0),
+ _linkBookRunning(false),
+ _linkBookMovie(nullptr) {
setupOpcodes();
}
diff --git a/engines/mohawk/myst_stacks/intro.h b/engines/mohawk/myst_stacks/intro.h
index 938a30e691..ec78199802 100644
--- a/engines/mohawk/myst_stacks/intro.h
+++ b/engines/mohawk/myst_stacks/intro.h
@@ -38,8 +38,8 @@ namespace MystStacks {
class Intro : public MystScriptParser {
public:
- Intro(MohawkEngine_Myst *vm);
- ~Intro();
+ explicit Intro(MohawkEngine_Myst *vm);
+ ~Intro() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
diff --git a/engines/mohawk/myst_stacks/makingof.cpp b/engines/mohawk/myst_stacks/makingof.cpp
index 2907c53231..4e0ce516b8 100644
--- a/engines/mohawk/myst_stacks/makingof.cpp
+++ b/engines/mohawk/myst_stacks/makingof.cpp
@@ -30,7 +30,8 @@
namespace Mohawk {
namespace MystStacks {
-MakingOf::MakingOf(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
+MakingOf::MakingOf(MohawkEngine_Myst *vm) :
+ MystScriptParser(vm) {
setupOpcodes();
}
diff --git a/engines/mohawk/myst_stacks/makingof.h b/engines/mohawk/myst_stacks/makingof.h
index cdc64d2991..f65c9696c3 100644
--- a/engines/mohawk/myst_stacks/makingof.h
+++ b/engines/mohawk/myst_stacks/makingof.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class MakingOf : public MystScriptParser {
public:
- MakingOf(MohawkEngine_Myst *vm);
- ~MakingOf();
+ explicit MakingOf(MohawkEngine_Myst *vm);
+ ~MakingOf() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index bd5406a4f1..5e920f91bc 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -36,23 +36,53 @@ namespace Mohawk {
namespace MystStacks {
Mechanical::Mechanical(MohawkEngine_Myst *vm) :
- MystScriptParser(vm), _state(vm->_gameState->_mechanical) {
+ MystScriptParser(vm),
+ _state(vm->_gameState->_mechanical) {
setupOpcodes();
_elevatorGoingMiddle = false;
_elevatorPosition = 0;
+ _elevatorGoingDown = 0;
+ _elevatorRotationSpeed = 0;
+ _elevatorRotationGearPosition = 0;
+ _elevatorRotationSoundId = 0;
+ _elevatorRotationLeverMoving = false;
+ _elevatorTooLate = false;
+ _elevatorInCabin = false;
+ _elevatorTopCounter = 0;
+ _elevatorNextTime = 0;
_crystalLit = 0;
_mystStaircaseState = false;
_fortressPosition = 0;
- _fortressRotationSpeed = 0;
- _fortressSimulationSpeed = 0;
_gearsWereRunning = false;
_fortressRotationShortMovieWorkaround = false;
_fortressRotationShortMovieCount = 0;
_fortressRotationShortMovieLast = 0;
+
+ _fortressRotationRunning = false;
+ _fortressRotationSpeed = 0;
+ _fortressRotationBrake = 0;
+ _fortressRotationGears = nullptr;
+
+ _fortressSimulationRunning = false;
+ _fortressSimulationInit = false;
+ _fortressSimulationSpeed = 0;
+ _fortressSimulationBrake = 0;
+ _fortressSimulationStartSound1 = 0;
+ _fortressSimulationStartSound2 = 0;
+ _fortressSimulationHolo = nullptr;
+ _fortressSimulationStartup = nullptr;
+ _fortressSimulationHoloRate = 0;
+
+ _birdSinging = false;
+ _birdCrankStartTime = 0;
+ _birdSingEndTime = 0;
+ _bird = nullptr;
+
+ _snakeBox = nullptr;
}
Mechanical::~Mechanical() {
diff --git a/engines/mohawk/myst_stacks/mechanical.h b/engines/mohawk/myst_stacks/mechanical.h
index 46cfe687a0..52cd7e7732 100644
--- a/engines/mohawk/myst_stacks/mechanical.h
+++ b/engines/mohawk/myst_stacks/mechanical.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class Mechanical : public MystScriptParser {
public:
- Mechanical(MohawkEngine_Myst *vm);
- ~Mechanical();
+ explicit Mechanical(MohawkEngine_Myst *vm);
+ ~Mechanical() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
@@ -49,7 +49,7 @@ private:
void toggleVar(uint16 var) override;
bool setVarValue(uint16 var, uint16 value) override;
- virtual uint16 getMap() override { return 9931; }
+ uint16 getMap() override { return 9931; }
void birdSing_run();
void elevatorRotation_run();
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index dbc4ff55b8..764fb04eda 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -37,7 +37,8 @@ namespace Mohawk {
namespace MystStacks {
Myst::Myst(MohawkEngine_Myst *vm) :
- MystScriptParser(vm), _state(_vm->_gameState->_myst) {
+ MystScriptParser(vm),
+ _state(_vm->_gameState->_myst) {
setupOpcodes();
// Card ID preinitialized by the engine for use by opcode 18
@@ -45,22 +46,56 @@ Myst::Myst(MohawkEngine_Myst *vm) :
_savedCardId = 4329;
_towerRotationBlinkLabel = false;
+ _towerRotationSpeed = 0;
+ _towerRotationMapClicked = false;
+ _towerRotationOverSpot = false;
+
_libraryBookcaseChanged = false;
_dockVaultState = 0;
+
_cabinDoorOpened = 0;
_cabinHandleDown = 0;
_cabinMatchState = 2;
_cabinGaugeMovieEnabled = false;
+
+ _boilerPressureIncreasing = false;
+ _boilerPressureDecreasing = false;
+ _basementPressureIncreasing = false;
+ _basementPressureDecreasing = false;
+
_matchBurning = false;
+ _matchGoOutCnt = 0;
+ _matchGoOutTime = 0;
+
_tree = nullptr;
_treeAlcove = nullptr;
_treeStopped = false;
_treeMinPosition = 0;
+ _treeMinAccessiblePosition = 0;
+ _treeMaxAccessiblePosition = 0;
+
_imagerValidationStep = 0;
- _observatoryCurrentSlider = nullptr;
_butterfliesMoviePlayed = false;
_state.treeLastMoveTime = _vm->_system->getMillis();
_rocketPianoSound = 0;
+
+ _observatoryRunning = false;
+ _observatoryMonthChanging = false;
+ _observatoryDayChanging = false;
+ _observatoryYearChanging = false;
+ _observatoryTimeChanging = false;
+ _observatoryVisualizer = nullptr;
+ _observatoryGoButton = nullptr;
+ _observatoryCurrentSlider = nullptr;
+ _observatoryDaySlider = nullptr;
+ _observatoryMonthSlider = nullptr;
+ _observatoryYearSlider = nullptr;
+ _observatoryTimeSlider = nullptr;
+ _observatoryLastTime = 0;
+ _observatoryNotInitialized = true;
+ _observatoryIncrement = 0;
+
+ _greenBookRunning = false;
}
Myst::~Myst() {
@@ -2260,7 +2295,7 @@ void Myst::o_rocketPianoMove(uint16 var, const ArgumentsArray &args) {
if (piano.contains(mouse)) {
MystArea *resource = _vm->forceUpdateClickedResource();
- if (resource && resource->type == kMystAreaDrag) {
+ if (resource && resource->hasType(kMystAreaDrag)) {
// Press new key
key = static_cast<MystAreaDrag *>(resource);
src = key->getSubImage(1).rect;
diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h
index 210012616f..2cffb39ac3 100644
--- a/engines/mohawk/myst_stacks/myst.h
+++ b/engines/mohawk/myst_stacks/myst.h
@@ -37,11 +37,11 @@ namespace MystStacks {
class Myst : public MystScriptParser {
public:
- Myst(MohawkEngine_Myst *vm);
- ~Myst();
+ explicit Myst(MohawkEngine_Myst *vm);
+ ~Myst() override;
- virtual void disablePersistentScripts() override;
- virtual void runPersistentScripts() override;
+ void disablePersistentScripts() override;
+ void runPersistentScripts() override;
protected:
void setupOpcodes();
@@ -49,7 +49,7 @@ protected:
void toggleVar(uint16 var) override;
bool setVarValue(uint16 var, uint16 value) override;
- virtual uint16 getMap() override { return 9934; }
+ uint16 getMap() override { return 9934; }
void towerRotationMap_run();
virtual void libraryBookcaseTransform_run();
diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp
index bc0dd04360..49fef62ad6 100644
--- a/engines/mohawk/myst_stacks/preview.cpp
+++ b/engines/mohawk/myst_stacks/preview.cpp
@@ -34,9 +34,18 @@
namespace Mohawk {
namespace MystStacks {
-Preview::Preview(MohawkEngine_Myst *vm) : Myst(vm) {
+Preview::Preview(MohawkEngine_Myst *vm) :
+ Myst(vm) {
setupOpcodes();
_vm->_cursor->hideCursor();
+
+ _libraryState = 0;
+ _library = nullptr;
+
+ _speechRunning = false;
+ _speechStep = 0;
+ _currentCue = 0;
+ _speechNextTime = 0;
}
Preview::~Preview() {
diff --git a/engines/mohawk/myst_stacks/preview.h b/engines/mohawk/myst_stacks/preview.h
index 6c0fe83b42..a27fec7cd1 100644
--- a/engines/mohawk/myst_stacks/preview.h
+++ b/engines/mohawk/myst_stacks/preview.h
@@ -39,8 +39,8 @@ namespace MystStacks {
class Preview : public Myst {
public:
- Preview(MohawkEngine_Myst *vm);
- ~Preview();
+ explicit Preview(MohawkEngine_Myst *vm);
+ ~Preview() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
diff --git a/engines/mohawk/myst_stacks/selenitic.cpp b/engines/mohawk/myst_stacks/selenitic.cpp
index 0f1949f128..246315013b 100644
--- a/engines/mohawk/myst_stacks/selenitic.cpp
+++ b/engines/mohawk/myst_stacks/selenitic.cpp
@@ -36,15 +36,48 @@ namespace Mohawk {
namespace MystStacks {
Selenitic::Selenitic(MohawkEngine_Myst *vm) :
- MystScriptParser(vm), _state(vm->_gameState->_selenitic) {
+ MystScriptParser(vm),
+ _state(vm->_gameState->_selenitic) {
setupOpcodes();
+
_mazeRunnerPosition = 288;
_mazeRunnerDirection = 8;
_mazeRunnerDoorOpened = false;
+ _mazeRunnerWindow = nullptr;
+ _mazeRunnerCompass = nullptr;
+ _mazeRunnerLight = nullptr;
+ _mazeRunnerRightButton = nullptr;
+ _mazeRunnerLeftButton = nullptr;
+ _soundReceiverRunning = false;
_soundReceiverDirection = 0;
_soundReceiverStartTime = 0;
_soundReceiverNearBlinkCounter = 0;
+ _soundReceiverSigmaPressed = false;
+
+ for (uint i = 0; i < ARRAYSIZE(_soundReceiverSources); i++) {
+ _soundReceiverSources[i] = nullptr;
+ }
+
+ _soundReceiverCurrentSource = nullptr;
+ _soundReceiverPosition = nullptr;
+ _soundReceiverSpeed = 0;
+ _soundReceiverViewer = nullptr;
+ _soundReceiverRightButton = nullptr;
+ _soundReceiverLeftButton = nullptr;
+ _soundReceiverAngle1 = nullptr;
+ _soundReceiverAngle2 = nullptr;
+ _soundReceiverAngle3 = nullptr;
+ _soundReceiverAngle4 = nullptr;
+ _soundReceiverSigmaButton = nullptr;
+
+ _soundLockSoundId = 0;
+ _soundLockSlider1 = nullptr;
+ _soundLockSlider2 = nullptr;
+ _soundLockSlider3 = nullptr;
+ _soundLockSlider4 = nullptr;
+ _soundLockSlider5 = nullptr;
+ _soundLockButton = nullptr;
}
Selenitic::~Selenitic() {
@@ -1072,7 +1105,7 @@ void Selenitic::o_soundReceiver_init(uint16 var, const ArgumentsArray &args) {
void Selenitic::o_soundLock_init(uint16 var, const ArgumentsArray &args) {
for (uint i = 0; i < _vm->_resources.size(); i++) {
- if (_vm->_resources[i]->type == kMystAreaSlider) {
+ if (_vm->_resources[i]->hasType(kMystAreaSlider)) {
switch (_vm->_resources[i]->getImageSwitchVar()) {
case 20:
_soundLockSlider1 = _vm->getViewResource<MystAreaSlider>(i);
@@ -1095,7 +1128,7 @@ void Selenitic::o_soundLock_init(uint16 var, const ArgumentsArray &args) {
_soundLockSlider5->setStep(_state.soundLockSliderPositions[4]);
break;
}
- } else if (_vm->_resources[i]->type == kMystAreaImageSwitch && _vm->_resources[i]->getImageSwitchVar() == 28) {
+ } else if (_vm->_resources[i]->hasType(kMystAreaImageSwitch) && _vm->_resources[i]->getImageSwitchVar() == 28) {
_soundLockButton = _vm->getViewResource<MystAreaImageSwitch>(i);
}
}
diff --git a/engines/mohawk/myst_stacks/selenitic.h b/engines/mohawk/myst_stacks/selenitic.h
index 341886d20b..1dc1505ec2 100644
--- a/engines/mohawk/myst_stacks/selenitic.h
+++ b/engines/mohawk/myst_stacks/selenitic.h
@@ -38,8 +38,8 @@ namespace MystStacks {
class Selenitic : public MystScriptParser {
public:
- Selenitic(MohawkEngine_Myst *vm);
- ~Selenitic();
+ explicit Selenitic(MohawkEngine_Myst *vm);
+ ~Selenitic() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
@@ -50,7 +50,7 @@ private:
void toggleVar(uint16 var) override;
bool setVarValue(uint16 var, uint16 value) override;
- virtual uint16 getMap() override { return 9930; }
+ uint16 getMap() override { return 9930; }
DECLARE_OPCODE(o_mazeRunnerMove);
DECLARE_OPCODE(o_mazeRunnerSoundRepeat);
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index f8c388d7bc..25d5cf480d 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -33,9 +33,15 @@
namespace Mohawk {
namespace MystStacks {
-Slides::Slides(MohawkEngine_Myst *vm) : MystScriptParser(vm) {
+Slides::Slides(MohawkEngine_Myst *vm) :
+ MystScriptParser(vm) {
setupOpcodes();
+
_vm->_cursor->hideCursor();
+
+ _cardSwapEnabled = false;
+ _nextCardID = 0;
+ _nextCardTime = 0;
}
Slides::~Slides() {
diff --git a/engines/mohawk/myst_stacks/slides.h b/engines/mohawk/myst_stacks/slides.h
index 63fd9c823e..6970c3b3f0 100644
--- a/engines/mohawk/myst_stacks/slides.h
+++ b/engines/mohawk/myst_stacks/slides.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class Slides : public MystScriptParser {
public:
- Slides(MohawkEngine_Myst *vm);
- ~Slides();
+ explicit Slides(MohawkEngine_Myst *vm);
+ ~Slides() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
diff --git a/engines/mohawk/myst_stacks/stoneship.cpp b/engines/mohawk/myst_stacks/stoneship.cpp
index 534efe7197..046aa5f9e7 100644
--- a/engines/mohawk/myst_stacks/stoneship.cpp
+++ b/engines/mohawk/myst_stacks/stoneship.cpp
@@ -37,10 +37,14 @@ namespace Mohawk {
namespace MystStacks {
Stoneship::Stoneship(MohawkEngine_Myst *vm) :
- MystScriptParser(vm), _state(vm->_gameState->_stoneship) {
+ MystScriptParser(vm),
+ _state(vm->_gameState->_stoneship) {
setupOpcodes();
_tunnelRunning = false;
+ _tunnelNextTime = 0;
+ _tunnelAlarmSound = 0;
+ _tunnelImagesCount = 0;
_state.lightState = 0;
_state.generatorDepletionTime = 0;
@@ -61,6 +65,31 @@ Stoneship::Stoneship(MohawkEngine_Myst *vm) :
_state.generatorPowerAvailable = 2;
else
_state.generatorPowerAvailable = 0;
+
+ _batteryCharging = false;
+ _batteryDepleting = false;
+ _batteryNextTime = 0;
+ _batteryLastCharge = 0;
+ _batteryGaugeRunning = false;
+ _batteryGauge = nullptr;
+
+ _hologramTurnedOn = 0;
+ _hologramDisplay = nullptr;
+ _hologramSelection = nullptr;
+ _hologramDisplayPos = 0;
+
+ _telescopeRunning = false;
+ _telescopePosition = 0;
+ _telescopePanorama = 0;
+ _telescopeOldMouse = 0;
+ _telescopeLighthouseOff = 0;
+ _telescopeLighthouseOn = 0;
+ _telescopeLighthouseState = false;
+ _telescopeNexTime = 0;
+
+ _cloudOrbMovie = nullptr;
+ _cloudOrbSound = 0;
+ _cloudOrbStopSound = 0;
}
Stoneship::~Stoneship() {
@@ -399,7 +428,7 @@ void Stoneship::o_pumpTurnOff(uint16 var, const ArgumentsArray &args) {
for (uint i = 0; i < _vm->_resources.size(); i++) {
MystArea *resource = _vm->_resources[i];
- if (resource->type == kMystAreaImageSwitch && resource->getImageSwitchVar() == buttonVar) {
+ if (resource->hasType(kMystAreaImageSwitch) && resource->getImageSwitchVar() == buttonVar) {
static_cast<MystAreaImageSwitch *>(resource)->drawConditionalDataToScreen(0, true);
break;
}
diff --git a/engines/mohawk/myst_stacks/stoneship.h b/engines/mohawk/myst_stacks/stoneship.h
index dca7ce8fd3..64f58ec427 100644
--- a/engines/mohawk/myst_stacks/stoneship.h
+++ b/engines/mohawk/myst_stacks/stoneship.h
@@ -37,8 +37,8 @@ namespace MystStacks {
class Stoneship : public MystScriptParser {
public:
- Stoneship(MohawkEngine_Myst *vm);
- ~Stoneship();
+ explicit Stoneship(MohawkEngine_Myst *vm);
+ ~Stoneship() override;
void disablePersistentScripts() override;
void runPersistentScripts() override;
@@ -49,7 +49,7 @@ private:
void toggleVar(uint16 var) override;
bool setVarValue(uint16 var, uint16 value) override;
- virtual uint16 getMap() override { return 9933; }
+ uint16 getMap() override { return 9933; }
DECLARE_OPCODE(o_pumpTurnOff);
DECLARE_OPCODE(o_brotherDoorOpen);
diff --git a/engines/mohawk/resource.cpp b/engines/mohawk/resource.cpp
index b0ae8dd6ea..ea44ca7879 100644
--- a/engines/mohawk/resource.cpp
+++ b/engines/mohawk/resource.cpp
@@ -32,7 +32,7 @@ namespace Mohawk {
// Base Archive code
Archive::Archive() {
- _stream = 0;
+ _stream = nullptr;
}
Archive::~Archive() {
@@ -57,7 +57,7 @@ bool Archive::openFile(const Common::String &fileName) {
void Archive::close() {
_types.clear();
- delete _stream; _stream = 0;
+ delete _stream; _stream = nullptr;
}
bool Archive::hasResource(uint32 tag, uint16 id) const {
diff --git a/engines/mohawk/resource.h b/engines/mohawk/resource.h
index 12c5a139e4..ecaef44d04 100644
--- a/engines/mohawk/resource.h
+++ b/engines/mohawk/resource.h
@@ -170,25 +170,25 @@ protected:
class MohawkArchive : public Archive {
public:
MohawkArchive() : Archive() {}
- ~MohawkArchive() {}
+ ~MohawkArchive() override {}
- bool openStream(Common::SeekableReadStream *stream);
+ bool openStream(Common::SeekableReadStream *stream) override;
};
class LivingBooksArchive_v1 : public Archive {
public:
LivingBooksArchive_v1() : Archive() {}
- ~LivingBooksArchive_v1() {}
+ ~LivingBooksArchive_v1() override {}
- bool openStream(Common::SeekableReadStream *stream);
+ bool openStream(Common::SeekableReadStream *stream) override;
};
class DOSArchive_v2 : public Archive {
public:
DOSArchive_v2() : Archive() {}
- ~DOSArchive_v2() {}
+ ~DOSArchive_v2() override {}
- bool openStream(Common::SeekableReadStream *stream);
+ bool openStream(Common::SeekableReadStream *stream) override;
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/resource_cache.cpp b/engines/mohawk/resource_cache.cpp
index 0c19934278..ab1758b673 100644
--- a/engines/mohawk/resource_cache.cpp
+++ b/engines/mohawk/resource_cache.cpp
@@ -64,7 +64,7 @@ void ResourceCache::add(uint32 tag, uint16 id, Common::SeekableReadStream *data)
// Returns NULL if not found
Common::SeekableReadStream *ResourceCache::search(uint32 tag, uint16 id) {
if (!enabled)
- return NULL;
+ return nullptr;
debugC(kDebugCache, "Searching for tag 0x%04X id %d", tag, id);
@@ -79,7 +79,7 @@ Common::SeekableReadStream *ResourceCache::search(uint32 tag, uint16 id) {
}
debugC(kDebugCache, "tag 0x%04X id %d not found", tag, id);
- return NULL;
+ return nullptr;
}
} // End of namespace Mohawk
diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h
index def218dafd..6ad1208cf3 100644
--- a/engines/mohawk/riven.h
+++ b/engines/mohawk/riven.h
@@ -83,7 +83,7 @@ protected:
public:
MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc);
- virtual ~MohawkEngine_Riven();
+ ~MohawkEngine_Riven() override;
RivenVideoManager *_video;
RivenSoundManager *_sound;
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index d0a5c05636..d4ea8fc703 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -101,7 +101,7 @@ public:
_lastCopyArea = makeDirectionalInitalArea();
}
- virtual bool drawFrame(uint32 elapsed) override {
+ bool drawFrame(uint32 elapsed) override {
Common::Rect copyArea;
switch (_type) {
case kRivenTransitionWipeLeft:
@@ -162,7 +162,7 @@ public:
complete = false;
}
- virtual bool drawFrame(uint32 elapsed) override {
+ bool drawFrame(uint32 elapsed) override {
Common::Rect newArea;
switch (_type) {
case kRivenTransitionPanLeft:
@@ -264,7 +264,7 @@ public:
_timeBased = false;
}
- virtual bool drawFrame(uint32 elapsed) override {
+ bool drawFrame(uint32 elapsed) override {
assert(_effectScreen->format == _mainScreen->format);
assert(_effectScreen->format == _system->getScreenFormat());
@@ -303,7 +303,22 @@ public:
}
};
-RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : GraphicsManager(), _vm(vm) {
+RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) :
+ GraphicsManager(),
+ _vm(vm),
+ _screenUpdateNesting(0),
+ _screenUpdateRunning(false),
+ _enableCardUpdateScript(true),
+ _scheduledTransition(kRivenTransitionNone),
+ _dirtyScreen(false),
+ _creditsImage(302),
+ _creditsPos(0),
+ _transitionMode(kRivenTransitionModeFastest),
+ _transitionOffset(-1),
+ _waterEffect(nullptr),
+ _fliesEffect(nullptr),
+ _transitionFrames(0),
+ _transitionDuration(0) {
_bitmapDecoder = new MohawkBitmap();
// Restrict ourselves to a single pixel format to simplify the effects implementation
@@ -317,20 +332,6 @@ RivenGraphics::RivenGraphics(MohawkEngine_Riven* vm) : GraphicsManager(), _vm(vm
_effectScreen = new Graphics::Surface();
_effectScreen->create(608, 392, _pixelFormat);
-
- _screenUpdateNesting = 0;
- _screenUpdateRunning = false;
- _enableCardUpdateScript = true;
- _scheduledTransition = kRivenTransitionNone;
- _dirtyScreen = false;
-
- _creditsImage = 302;
- _creditsPos = 0;
-
- _transitionMode = kRivenTransitionModeFastest;
- _transitionOffset = -1;
- _waterEffect = nullptr;
- _fliesEffect = nullptr;
}
RivenGraphics::~RivenGraphics() {
@@ -339,7 +340,8 @@ RivenGraphics::~RivenGraphics() {
_mainScreen->free();
delete _mainScreen;
delete _bitmapDecoder;
- delete _fliesEffect;
+ clearFliesEffect();
+ clearWaterEffect();
}
MohawkSurface *RivenGraphics::decodeImage(uint16 id) {
diff --git a/engines/mohawk/riven_graphics.h b/engines/mohawk/riven_graphics.h
index 31ab84038c..7b831c5609 100644
--- a/engines/mohawk/riven_graphics.h
+++ b/engines/mohawk/riven_graphics.h
@@ -54,8 +54,8 @@ enum RivenTransitionMode {
class RivenGraphics : public GraphicsManager {
public:
- RivenGraphics(MohawkEngine_Riven *vm);
- ~RivenGraphics();
+ explicit RivenGraphics(MohawkEngine_Riven *vm);
+ ~RivenGraphics() override;
// Screen updates
void beginScreenUpdate();
@@ -94,11 +94,11 @@ public:
// Credits
void beginCredits();
void updateCredits();
- uint getCurCreditsImage() { return _creditsImage; }
+ uint getCurCreditsImage() const { return _creditsImage; }
protected:
- MohawkSurface *decodeImage(uint16 id);
- MohawkEngine *getVM() { return (MohawkEngine *)_vm; }
+ MohawkSurface *decodeImage(uint16 id) override;
+ MohawkEngine *getVM() override { return (MohawkEngine *)_vm; }
private:
MohawkEngine_Riven *_vm;
diff --git a/engines/mohawk/riven_inventory.h b/engines/mohawk/riven_inventory.h
index 7c75b48374..8ce5f7ebd2 100644
--- a/engines/mohawk/riven_inventory.h
+++ b/engines/mohawk/riven_inventory.h
@@ -36,7 +36,7 @@ class MohawkEngine_Riven;
*/
class RivenInventory {
public:
- RivenInventory(MohawkEngine_Riven *vm);
+ explicit RivenInventory(MohawkEngine_Riven *vm);
virtual ~RivenInventory();
/** Handle a click event in the inventory area */
diff --git a/engines/mohawk/riven_sound.h b/engines/mohawk/riven_sound.h
index ce2ddbcbe8..fd14dee151 100644
--- a/engines/mohawk/riven_sound.h
+++ b/engines/mohawk/riven_sound.h
@@ -65,7 +65,7 @@ struct SLSTRecord {
*/
class RivenSoundManager {
public:
- RivenSoundManager(MohawkEngine_Riven *vm);
+ explicit RivenSoundManager(MohawkEngine_Riven *vm);
~RivenSoundManager();
/**
diff --git a/engines/mohawk/riven_video.h b/engines/mohawk/riven_video.h
index 5b5bf30fd2..ae5a266e04 100644
--- a/engines/mohawk/riven_video.h
+++ b/engines/mohawk/riven_video.h
@@ -130,7 +130,7 @@ private:
class RivenVideoManager {
public:
- RivenVideoManager(MohawkEngine_Riven *vm);
+ explicit RivenVideoManager(MohawkEngine_Riven *vm);
~RivenVideoManager();
void updateMovies();
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 81d83fc7b9..5e0cae1492 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -181,9 +181,9 @@ Audio::RewindableAudioStream *makeMohawkWaveStream(Common::SeekableReadStream *s
}
Sound::Sound(MohawkEngine* vm) : _vm(vm) {
- _midiDriver = NULL;
- _midiParser = NULL;
- _midiData = NULL;
+ _midiDriver = nullptr;
+ _midiParser = nullptr;
+ _midiData = nullptr;
initMidi();
}
@@ -219,7 +219,7 @@ void Sound::initMidi() {
}
Audio::RewindableAudioStream *Sound::makeAudioStream(uint16 id, CueList *cueList) {
- Audio::RewindableAudioStream *audStream = NULL;
+ Audio::RewindableAudioStream *audStream = nullptr;
switch (_vm->getGameType()) {
case GType_ZOOMBINI:
@@ -261,7 +261,7 @@ Audio::SoundHandle *Sound::playSound(uint16 id, byte volume, bool loop, CueList
return &handle->handle;
}
- return NULL;
+ return nullptr;
}
void Sound::playMidi(uint16 id) {
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index 11fd004513..15bda0792e 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -102,7 +102,7 @@ class MohawkEngine;
class Sound {
public:
- Sound(MohawkEngine *vm);
+ explicit Sound(MohawkEngine *vm);
~Sound();
// Generic sound functions
@@ -126,8 +126,7 @@ private:
Common::Array<SndHandle> _handles;
SndHandle *getHandle();
- Audio::RewindableAudioStream *makeAudioStream(uint16 id, CueList *cueList = NULL);
- uint16 convertMystID(uint16 id);
+ Audio::RewindableAudioStream *makeAudioStream(uint16 id, CueList *cueList = nullptr);
};
} // End of namespace Mohawk
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index 994e219b03..ae20a59370 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -38,7 +38,7 @@
namespace Mohawk {
-VideoEntry::VideoEntry() : _video(0), _id(-1), _x(0), _y(0), _loop(false), _enabled(true) {
+VideoEntry::VideoEntry() : _video(nullptr), _id(-1), _x(0), _y(0), _loop(false), _enabled(true) {
}
VideoEntry::VideoEntry(Video::VideoDecoder *video, const Common::String &fileName) : _video(video), _fileName(fileName), _id(-1), _x(0), _y(0), _loop(false), _enabled(true) {
@@ -53,7 +53,7 @@ VideoEntry::~VideoEntry() {
void VideoEntry::close() {
delete _video;
- _video = 0;
+ _video = nullptr;
}
bool VideoEntry::endOfVideo() const {
@@ -230,7 +230,7 @@ bool VideoManager::drawNextFrame(VideoEntryPtr videoEntry) {
return false;
}
- Graphics::Surface *convertedFrame = 0;
+ Graphics::Surface *convertedFrame = nullptr;
Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat();
if (frame->format != pixelFormat) {
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index 1f8b93d467..fdc55a51ab 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -237,7 +237,7 @@ typedef Common::SharedPtr<VideoEntry> VideoEntryPtr;
class VideoManager {
public:
- VideoManager(MohawkEngine *vm);
+ explicit VideoManager(MohawkEngine *vm);
virtual ~VideoManager();
// Generic movie functions
diff --git a/engines/mohawk/view.cpp b/engines/mohawk/view.cpp
index 70d20270a5..ec73723971 100644
--- a/engines/mohawk/view.cpp
+++ b/engines/mohawk/view.cpp
@@ -63,10 +63,10 @@ void Feature::setNodeDefaults(Feature *prev, Feature *next) {
_prev = prev;
_next = next;
- _moveProc = NULL;
- _drawProc = NULL;
- _doneProc = NULL;
- _frameProc = NULL;
+ _moveProc = nullptr;
+ _drawProc = nullptr;
+ _doneProc = nullptr;
+ _frameProc = nullptr;
_data.bounds = Common::Rect();
_data.clipRect = Common::Rect();
@@ -333,7 +333,7 @@ void NewFeature::finishResetFeatureScript() {
}
View::View(MohawkEngine *vm) : _vm(vm) {
- _currentModule = NULL;
+ _currentModule = nullptr;
_backgroundId = 0xffff;
@@ -393,7 +393,7 @@ void View::setModule(Module *module) {
delete _currentModule;
}
- _currentModule = NULL;
+ _currentModule = nullptr;
if (module) {
_currentModule = module;
@@ -572,7 +572,7 @@ Feature *View::getFeaturePtr(uint16 id) {
return node;
}
- return NULL;
+ return nullptr;
}
uint16 View::getNewFeatureId() {
@@ -591,8 +591,8 @@ void View::removeFeature(Feature *feature, bool free) {
feature->_prev->_next = feature->_next;
feature->_next->_prev = feature->_prev;
- feature->_next = NULL;
- feature->_prev = NULL;
+ feature->_next = nullptr;
+ feature->_prev = nullptr;
if (free)
delete feature;
@@ -619,21 +619,21 @@ Feature *View::pointOnFeature(bool topdown, uint32 flags, Common::Point pos) {
else
curr = curr->_next;
}
- return NULL;
+ return nullptr;
}
void View::sortView() {
Feature *base = _rootNode;
Feature *next = base->_next;
- Feature *otherRoot = NULL;
- Feature *otherBase = NULL;
- Feature *objectRoot = NULL;
- Feature *objectBase = NULL;
- Feature *staticRoot = NULL;
- Feature *staticBase = NULL;
+ Feature *otherRoot = nullptr;
+ Feature *otherBase = nullptr;
+ Feature *objectRoot = nullptr;
+ Feature *objectBase = nullptr;
+ Feature *staticRoot = nullptr;
+ Feature *staticBase = nullptr;
// Remove all features.
- base->_next = NULL;
+ base->_next = nullptr;
// Iterate through all the previous features, placing them in the appropriate list.
while (next) {
@@ -645,33 +645,33 @@ void View::sortView() {
// so we insert this node directly after the current base.
base->_next = curr;
curr->_prev = base;
- curr->_next = NULL;
+ curr->_next = nullptr;
base = base->_next;
} else if (curr->_flags & kFeatureSortStatic) {
// Insert this node into the list of static objects.
if (staticBase) {
staticBase->_next = curr;
curr->_prev = staticBase;
- curr->_next = NULL;
+ curr->_next = nullptr;
staticBase = curr;
} else {
staticBase = curr;
staticRoot = curr;
- curr->_prev = NULL;
- curr->_next = NULL;
+ curr->_prev = nullptr;
+ curr->_next = nullptr;
}
} else if (curr->_flags & kFeatureObjectMask) { // This is == 1 or == 2 in old code.
// Insert this node into the list of objects.
if (objectRoot) {
objectBase->_next = curr;
curr->_prev = objectBase;
- curr->_next = NULL;
+ curr->_next = nullptr;
objectBase = curr;
} else {
objectBase = curr;
objectRoot = curr;
- curr->_prev = NULL;
- curr->_next = NULL;
+ curr->_prev = nullptr;
+ curr->_next = nullptr;
}
} else {
if (!(curr->_flags & kFeatureOldSortForeground))
@@ -681,13 +681,13 @@ void View::sortView() {
if (otherRoot) {
otherBase->_next = curr;
curr->_prev = otherBase;
- curr->_next = NULL;
+ curr->_next = nullptr;
otherBase = curr;
} else {
otherBase = curr;
otherRoot = curr;
- curr->_prev = NULL;
- curr->_next = NULL;
+ curr->_prev = nullptr;
+ curr->_next = nullptr;
}
}
}
@@ -700,7 +700,7 @@ void View::sortView() {
base->_next = prev;
prev->_prev = base;
base = base->_next;
- base->_next = NULL;
+ base->_next = nullptr;
}
// Add the other features on top..
@@ -711,12 +711,12 @@ void View::sortView() {
Feature *View::sortOneList(Feature *root) {
if (!root)
- return NULL;
+ return nullptr;
// Save the next feature and then clear the list.
Feature *curr = root->_next;
- root->_next = NULL;
- root->_prev = NULL;
+ root->_next = nullptr;
+ root->_prev = nullptr;
// Iterate over all the features.
while (curr) {
@@ -735,7 +735,7 @@ Feature *View::sortOneList(Feature *root) {
// This is the end of the list: add ourselves there.
check->_next = prev;
prev->_prev = check;
- prev->_next = NULL;
+ prev->_next = nullptr;
break;
}
} else {
@@ -779,7 +779,7 @@ Feature *View::mergeLists(Feature *root, Feature *mergeRoot) {
check = check->_next;
check->_next = prev;
prev->_prev = check;
- prev->_next = NULL;
+ prev->_next = nullptr;
continue;
}
@@ -802,7 +802,7 @@ Feature *View::mergeLists(Feature *root, Feature *mergeRoot) {
// We're at the end of the list, so we have to go here.
check->_next = prev;
prev->_prev = check;
- prev->_next = NULL;
+ prev->_next = nullptr;
base = prev;
break;
}