[Scummvm-git-logs] scummvm master -> 3749b21f18b59957920ba97769305e16396ef611

fracturehill noreply at scummvm.org
Tue Mar 7 19:21:52 UTC 2023


This automated email contains information about 9 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
779e22f4a8 NANCY: Implement LightningOn action record type
0f28c64d6a NANCY: Silence potential nullptr dereference warning
86b7d58f16 NANCY: Fix AddInventoryNoHS
8190f09acc NANCY: Fix incorrect hotspots in textbox
1fa1de39b6 NANCY: Rename action record dependency types
fb7a903080 NANCY: Fix primary video chaining
415406bbcc NANCY: Pick correct responses in primary video
b0cd7b1524 NANCY: Make LightningOn::readData() more readable
3749b21f18 NANCY: Formatting fixes


Commit: 779e22f4a86a7d4ceb01a824afd87c7c6439a93a
    https://github.com/scummvm/scummvm/commit/779e22f4a86a7d4ceb01a824afd87c7c6439a93a
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:21+02:00

Commit Message:
NANCY: Implement LightningOn action record type

Implemented the LightningOn ActionRecord, which changes the
color palette to simulate a lightning flash at randomized intervals.

Changed paths:
  A engines/nancy/action/lightning.cpp
  A engines/nancy/action/lightning.h
    engines/nancy/action/arfactory.cpp
    engines/nancy/action/recordtypes.cpp
    engines/nancy/action/recordtypes.h
    engines/nancy/graphics.cpp
    engines/nancy/graphics.h
    engines/nancy/module.mk
    engines/nancy/renderobject.cpp
    engines/nancy/renderobject.h
    engines/nancy/ui/viewport.cpp
    engines/nancy/ui/viewport.h


diff --git a/engines/nancy/action/arfactory.cpp b/engines/nancy/action/arfactory.cpp
index 4af2aa68747..0ee115932c1 100644
--- a/engines/nancy/action/arfactory.cpp
+++ b/engines/nancy/action/arfactory.cpp
@@ -30,6 +30,7 @@
 #include "engines/nancy/action/sliderpuzzle.h"
 #include "engines/nancy/action/passwordpuzzle.h"
 #include "engines/nancy/action/leverpuzzle.h"
+#include "engines/nancy/action/lightning.h"
 
 #include "engines/nancy/state/scene.h"
 
diff --git a/engines/nancy/action/lightning.cpp b/engines/nancy/action/lightning.cpp
new file mode 100644
index 00000000000..c4729a63af2
--- /dev/null
+++ b/engines/nancy/action/lightning.cpp
@@ -0,0 +1,175 @@
+/* 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 randomnessributed with this source randomnessribution.
+ *
+ * This program is free software: you can rerandomnessribute 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 randomnessributed 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 "engines/nancy/graphics.h"
+#include "engines/nancy/sound.h"
+#include "engines/nancy/nancy.h"
+
+#include "engines/nancy/state/scene.h"
+
+#include "engines/nancy/action/lightning.h"
+
+#include "common/stream.h"
+#include "common/random.h"
+
+namespace Nancy {
+namespace Action {
+
+void editPalette(byte *colors, uint percent) {
+    float alpha = (float) percent / 100;
+
+    for (int i = 0; i < 256 * 3; ++i) {
+        uint16 origColor = colors[i];
+        colors[i] = MIN<uint16>(alpha * origColor + origColor, 255);
+    }
+}
+
+LightningOn::~LightningOn() {
+    for (byte *palette : _viewportObjOriginalPalettes) {
+        delete[] palette;
+    }
+}
+
+void LightningOn::readData(Common::SeekableReadStream &stream) {
+    int16 one = stream.readSint16LE();
+    uint16 two = stream.readUint16LE();
+    int16 three = stream.readSint16LE();
+
+    int16 baseline;
+    float randomness;
+
+    // Calculate the min & max power of the lightning
+    baseline = (three - (one * 5));
+    randomness = 0.4 * baseline;
+
+    _minRGBPercent = MAX<uint16>(0, baseline - randomness);
+    _maxRGBPercent = MIN<uint16>(three, baseline + randomness);
+
+    // Calculate the min & max delay between lightning strikes
+    baseline = 13000 - (two * 500);
+    randomness = 1.5 * baseline;
+
+    _minInterPulseDelay = MAX<int16>(500, baseline - randomness);
+    _maxInterPulseDelay = MIN<int16>(13000, baseline + randomness);
+
+    // Calculate the min & max length of the lightning strikes
+    // _minPulseLength is always 5 due to an oversight in the original code
+    _maxPulseLength = two * 10;
+
+    // Calculate the min & max delay between end of lightning and start of thunder sound
+    baseline = one * 400;
+    randomness = baseline * 0.4;
+
+    _minSoundStartDelay = MAX<int16>(250, baseline - randomness);
+    _maxSoundStartDelay = baseline + randomness; // No minimum value, probably a bug
+
+    stream.skip(0x4); // paletteStart, paletteSize
+}
+
+void LightningOn::execute() {
+    if (_state == kBegin) {
+        g_nancy->_graphicsManager->grabViewportObjects(_viewportObjs);
+
+        for (RenderObject *obj : _viewportObjs) {
+            if (!obj) {
+                continue;
+            }
+
+            _viewportObjOriginalPalettes.push_back(new byte[256 * 3]);
+            obj->grabPalette(_viewportObjOriginalPalettes.back());
+        }
+
+        _state = kRun;
+    }
+
+    switch (_lightningState) {
+    case kStartPulse:
+        _nextStateTime = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minPulseLength, _maxPulseLength);
+        handleThunder();
+        handlePulse(true);
+        _lightningState = kPulse;
+        break;
+    case kPulse:
+        if (g_nancy->getTotalPlayTime() > _nextStateTime) {
+
+            _nextStateTime = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minInterPulseDelay, _maxInterPulseDelay);
+
+            _lightningState = kThunder;
+            
+            if (!g_nancy->_sound->isSoundPlaying("TH1")) {
+                _nextSoundToPlay = 0;
+                _nextSoundTime0 = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minSoundStartDelay, _maxSoundStartDelay);
+            } else if (!g_nancy->_sound->isSoundPlaying("TH2")) {
+                _nextSoundToPlay = 1;
+                _nextSoundTime1 = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minSoundStartDelay, _maxSoundStartDelay);
+            } else {
+                _nextSoundToPlay = -1;
+            }
+
+            handlePulse(false);
+        }
+        
+        handleThunder();
+        break;
+    case kThunder:
+        if (g_nancy->getTotalPlayTime() > _nextStateTime) {
+            _lightningState = kStartPulse;
+        }
+
+        handleThunder();
+        break;
+    }
+}
+
+void LightningOn::handlePulse(bool on) {
+    for (uint i = 0; i < _viewportObjs.size(); ++i) {
+        RenderObject *obj = _viewportObjs[i];
+
+        if (!obj) {
+            continue;
+        }
+
+        if (on) {
+            byte newPalette[256 * 3];
+            obj->grabPalette(newPalette);
+            editPalette(newPalette, g_nancy->_randomSource->getRandomNumberRngSigned(_minRGBPercent, _maxRGBPercent));
+            obj->setPalette(newPalette);
+        } else {
+            obj->setPalette(_viewportObjOriginalPalettes[i]);
+        }
+        
+    }
+}
+
+void LightningOn::handleThunder() {
+    if (_nextSoundToPlay == 0) {
+        if (g_nancy->getTotalPlayTime() > _nextSoundTime0) {
+            g_nancy->_sound->playSound("TH1");
+        }
+    } else if (_nextSoundToPlay == 1) {
+        if (g_nancy->getTotalPlayTime() > _nextSoundTime1) {
+            g_nancy->_sound->playSound("TH2");
+        }
+    }
+}
+
+} // End of namespace Action
+} // End of namespace Nancy
diff --git a/engines/nancy/action/lightning.h b/engines/nancy/action/lightning.h
new file mode 100644
index 00000000000..8d63639cb06
--- /dev/null
+++ b/engines/nancy/action/lightning.h
@@ -0,0 +1,73 @@
+/* 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 NANCY_ACTION_LIGHTNING_H
+#define NANCY_ACTION_LIGHTNING_H
+
+#include "engines/nancy/action/actionrecord.h"
+
+namespace Nancy {
+namespace Action {
+
+class LightningOn : public ActionRecord {
+public:
+    enum LightningState { kStartPulse, kPulse, kThunder };
+
+    LightningOn() = default;
+    virtual ~LightningOn();
+
+	void readData(Common::SeekableReadStream &stream) override;
+    void execute() override;
+
+    void handlePulse(bool on);
+    void handleThunder();
+
+    LightningState _lightningState = kStartPulse;
+
+    int16 _minRGBPercent = 0;
+    int16 _maxRGBPercent = 0;
+
+    int16 _minInterPulseDelay = 0;
+    int16 _maxInterPulseDelay = 0;
+
+    int16 _minPulseLength = 5;
+    int16 _maxPulseLength = 0;
+
+    int16 _minSoundStartDelay = 0;
+    int16 _maxSoundStartDelay = 0;
+
+    uint32 _nextStateTime = 0;
+    uint32 _nextSoundTime0 = 0;
+    uint32 _nextSoundTime1 = 0;
+
+    int _nextSoundToPlay = 0;
+
+    Common::Array<RenderObject *> _viewportObjs;
+    Common::Array<byte *> _viewportObjOriginalPalettes;
+
+protected:
+	Common::String getRecordTypeName() const override { return "LightningOn"; }
+};
+
+} // End of namespace Action
+} // End of namespace Nancy
+
+#endif // NANCY_ACTION_LIGHTNING_H
diff --git a/engines/nancy/action/recordtypes.cpp b/engines/nancy/action/recordtypes.cpp
index 637426df91d..42e113c71f8 100644
--- a/engines/nancy/action/recordtypes.cpp
+++ b/engines/nancy/action/recordtypes.cpp
@@ -199,10 +199,6 @@ void PaletteNextScene::execute() {
 	_isDone = true;
 }
 
-void LightningOn::readData(Common::SeekableReadStream &stream) {
-	stream.skip(0xA);
-}
-
 void MapCall::readData(Common::SeekableReadStream &stream) {
 	stream.skip(1);
 }
diff --git a/engines/nancy/action/recordtypes.h b/engines/nancy/action/recordtypes.h
index dc8059a277f..262682e75cf 100644
--- a/engines/nancy/action/recordtypes.h
+++ b/engines/nancy/action/recordtypes.h
@@ -117,14 +117,6 @@ protected:
 	Common::String getRecordTypeName() const override { return "PaletteNextScene"; }
 };
 
-class LightningOn : public Unimplemented {
-public:
-	void readData(Common::SeekableReadStream &stream) override;
-
-protected:
-	Common::String getRecordTypeName() const override { return "LightningOn"; }
-};
-
 class MapCall : public ActionRecord {
 public:
 	void readData(Common::SeekableReadStream &stream) override;
diff --git a/engines/nancy/graphics.cpp b/engines/nancy/graphics.cpp
index 58c6fd1ab36..7b6480b10ea 100644
--- a/engines/nancy/graphics.cpp
+++ b/engines/nancy/graphics.cpp
@@ -27,6 +27,7 @@
 #include "engines/nancy/graphics.h"
 #include "engines/nancy/renderobject.h"
 #include "engines/nancy/resource.h"
+#include "engines/nancy/state/scene.h"
 
 namespace Nancy {
 
@@ -141,16 +142,6 @@ void GraphicsManager::redrawAll() {
 	}
 }
 
-void GraphicsManager::loadSurfacePalette(Graphics::ManagedSurface &inSurf, const Common::String paletteFilename) {
-	Common::File f;
-	if (f.open(paletteFilename + ".bmp")) {
-		Image::BitmapDecoder dec;
-		if (dec.loadStream(f)) {
-			inSurf.setPalette(dec.getPalette(), dec.getPaletteStartIndex(), MIN<uint>(256, dec.getPaletteColorCount()));
-		}
-	}
-}
-
 void GraphicsManager::loadSurfacePalette(Graphics::ManagedSurface &inSurf, const Common::String paletteFilename, uint paletteStart, uint paletteSize) {
 	Common::File f;
 	if (f.open(paletteFilename + ".bmp")) {
@@ -278,6 +269,18 @@ uint GraphicsManager::getTransColor() {
 	}
 }
 
+void GraphicsManager::grabViewportObjects(Common::Array<RenderObject *> &inArray) {
+	// Add the viewport
+	inArray.push_back(&(RenderObject &)NancySceneState.getViewport());
+
+	// Add all viewport-relative (non-UI) objects
+	for (RenderObject *obj : _objects) {
+		if (obj->isViewportRelative()) {
+			inArray.push_back(obj);
+		}
+	}
+}
+
 void GraphicsManager::loadFonts() {
 	Common::SeekableReadStream *chunk = g_nancy->getBootChunkStream("FONT");
 
diff --git a/engines/nancy/graphics.h b/engines/nancy/graphics.h
index 6ac6a1e3ef5..86c5bfb1c7b 100644
--- a/engines/nancy/graphics.h
+++ b/engines/nancy/graphics.h
@@ -52,8 +52,9 @@ public:
 	const Graphics::PixelFormat &getScreenPixelFormat();
 	uint getTransColor();
 
-	static void loadSurfacePalette(Graphics::ManagedSurface &inSurf, const Common::String paletteFilename);
-	static void loadSurfacePalette(Graphics::ManagedSurface &inSurf, const Common::String paletteFilename, uint paletteStart, uint paletteSize);
+	void grabViewportObjects(Common::Array<RenderObject *> &inArray);
+
+	static void loadSurfacePalette(Graphics::ManagedSurface &inSurf, const Common::String paletteFilename, uint paletteStart = 0, uint paletteSize = 256);
 	static void copyToManaged(const Graphics::Surface &src, Graphics::ManagedSurface &dst, bool verticalFlip = false, bool doubleSize = false);
 	static void copyToManaged(void *src, Graphics::ManagedSurface &dst, uint srcW, uint srcH, const Graphics::PixelFormat &format, bool verticalFlip = false, bool doubleSize = false);
 
diff --git a/engines/nancy/module.mk b/engines/nancy/module.mk
index 18870ea1530..dbf85866dde 100644
--- a/engines/nancy/module.mk
+++ b/engines/nancy/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS = \
   action/actionrecord.o \
   action/arfactory.o \
   action/leverpuzzle.o \
+  action/lightning.o \
   action/orderingpuzzle.o \
   action/passwordpuzzle.o \
   action/primaryvideo.o \
diff --git a/engines/nancy/renderobject.cpp b/engines/nancy/renderobject.cpp
index d0f9eb10e5c..1c63014e2bd 100644
--- a/engines/nancy/renderobject.cpp
+++ b/engines/nancy/renderobject.cpp
@@ -78,6 +78,24 @@ void RenderObject::setTransparent(bool isTransparent) {
 	}
 }
 
+void RenderObject::grabPalette(byte *colors, uint paletteStart, uint paletteSize) {
+	if (colors) {
+		_drawSurface.grabPalette(colors, paletteStart, paletteSize);
+	}
+}
+
+void RenderObject::setPalette(const Common::String &paletteName, uint paletteStart, uint paletteSize) {
+	GraphicsManager::loadSurfacePalette(_drawSurface, paletteName, paletteStart, paletteSize);
+	_needsRedraw = true;
+}
+
+void RenderObject::setPalette(const byte *colors, uint paletteStart, uint paletteSize) {
+	if (colors) {
+		_drawSurface.setPalette(colors, paletteStart, paletteSize);
+		_needsRedraw = true;
+	}
+}
+
 Common::Rect RenderObject::getScreenPosition() const {
 	if (isViewportRelative()) {
 		return NancySceneState.getViewport().convertViewportToScreen(_screenPosition);
diff --git a/engines/nancy/renderobject.h b/engines/nancy/renderobject.h
index 5bfc9c87d51..942e97a24a3 100644
--- a/engines/nancy/renderobject.h
+++ b/engines/nancy/renderobject.h
@@ -49,6 +49,11 @@ public:
 	void setVisible(bool visible);
 	void setTransparent(bool isTransparent);
 
+	// Only used by The Vampire Diaries
+	void grabPalette(byte *colors, uint paletteStart = 0, uint paletteSize = 256);
+	void setPalette(const Common::String &paletteName, uint paletteStart = 0, uint paletteSize = 256);
+	void setPalette(const byte *colors, uint paletteStart = 0, uint paletteSize = 256);
+
 	bool hasMoved() const { return _previousScreenPosition != _screenPosition; }
 	Common::Rect getScreenPosition() const;
 	Common::Rect getPreviousScreenPosition() const;
diff --git a/engines/nancy/ui/viewport.cpp b/engines/nancy/ui/viewport.cpp
index a93561c811c..5943d49220e 100644
--- a/engines/nancy/ui/viewport.cpp
+++ b/engines/nancy/ui/viewport.cpp
@@ -197,10 +197,7 @@ void Viewport::loadVideo(const Common::String &filename, uint frameNr, uint vert
 	setVerticalScroll(verticalScroll);
 
 	if (palette.size()) {
-		GraphicsManager::loadSurfacePalette(_drawSurface, palette);
-		uint8 pal[256 * 3];
-		_drawSurface.grabPalette(pal, 0, 256);
-		_fullFrame.setPalette(pal, 0, 256);
+		setPalette(palette);
 	}
 
 	_movementLastFrame = 0;
@@ -208,22 +205,6 @@ void Viewport::loadVideo(const Common::String &filename, uint frameNr, uint vert
 	_panningType = panningType;
 }
 
-void Viewport::setPalette(const Common::String &paletteName) {
-	GraphicsManager::loadSurfacePalette(_drawSurface, paletteName);
-	uint8 pal[256 * 3];
-	_drawSurface.grabPalette(pal, 0, 256);
-	_fullFrame.setPalette(pal, 0, 256);
-	_needsRedraw = true;
-}
-
-void Viewport::setPalette(const Common::String &paletteName, uint paletteStart, uint paletteSize) {
-	GraphicsManager::loadSurfacePalette(_drawSurface, paletteName, paletteStart, paletteSize);
-	uint8 pal[256 * 3];
-	_drawSurface.grabPalette(pal, 0, 256);
-	_fullFrame.setPalette(pal, 0, 256);
-	_needsRedraw = true;
-}
-
 void Viewport::setFrame(uint frameNr) {
 	assert(frameNr < _decoder.getFrameCount());
 
diff --git a/engines/nancy/ui/viewport.h b/engines/nancy/ui/viewport.h
index b577ae20bc8..feabc7ad882 100644
--- a/engines/nancy/ui/viewport.h
+++ b/engines/nancy/ui/viewport.h
@@ -59,8 +59,6 @@ public:
 	void handleInput(NancyInput &input);
 
 	void loadVideo(const Common::String &filename, uint frameNr = 0, uint verticalScroll = 0, byte panningType = kPanNone, uint16 format = 2, const Common::String &palette = Common::String());
-	void setPalette(const Common::String &paletteName);
-	void setPalette(const Common::String &paletteName, uint paletteStart, uint paletteSize);
 
 	void setFrame(uint frameNr);
 	void setNextFrame();


Commit: 0f28c64d6a0cadab093fe10d840d165a5a3a1b52
    https://github.com/scummvm/scummvm/commit/0f28c64d6a0cadab093fe10d840d165a5a3a1b52
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:21+02:00

Commit Message:
NANCY: Silence potential nullptr dereference warning

Changed paths:
    engines/nancy/video.cpp


diff --git a/engines/nancy/video.cpp b/engines/nancy/video.cpp
index f2045c79ecf..b7b13095200 100644
--- a/engines/nancy/video.cpp
+++ b/engines/nancy/video.cpp
@@ -79,6 +79,9 @@ void AVFDecoder::addFrameTime(const uint16 timeToAdd) {
 // Custom function to allow the last frame of the video to play correctly
 bool AVFDecoder::atEnd() const {
 	const AVFDecoder::AVFVideoTrack *track = ((const AVFDecoder::AVFVideoTrack *)getTrack(0));
+	if (!track) {
+		return true;
+	}
 	return !track->isReversed() && track->endOfTrack() && track->getFrameTime(track->getFrameCount()) <= getTime();
 }
 


Commit: 86b7d58f1679bd64e9f685e0a5854305d627336f
    https://github.com/scummvm/scummvm/commit/86b7d58f1679bd64e9f685e0a5854305d627336f
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:21+02:00

Commit Message:
NANCY: Fix AddInventoryNoHS

Fixed a logic error that was introduced when removing NancyFlag.

Changed paths:
    engines/nancy/action/recordtypes.cpp


diff --git a/engines/nancy/action/recordtypes.cpp b/engines/nancy/action/recordtypes.cpp
index 42e113c71f8..8a9a56984a0 100644
--- a/engines/nancy/action/recordtypes.cpp
+++ b/engines/nancy/action/recordtypes.cpp
@@ -419,7 +419,7 @@ void AddInventoryNoHS::readData(Common::SeekableReadStream &stream) {
 }
 
 void AddInventoryNoHS::execute() {
-	if (NancySceneState.hasItem(_itemID) == kInvHolding) {
+	if (NancySceneState.hasItem(_itemID) == kInvEmpty) {
 		NancySceneState.addItemToInventory(_itemID);
 	}
 


Commit: 8190f09accf5b965300b24c5f8e2fefcd0080e93
    https://github.com/scummvm/scummvm/commit/8190f09accf5b965300b24c5f8e2fefcd0080e93
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:22+02:00

Commit Message:
NANCY: Fix incorrect hotspots in textbox

Fixed a wrong calculation for the height of textbox response hotspots
which could result in incorrect dialogue choices being made.

Changed paths:
    engines/nancy/ui/textbox.cpp


diff --git a/engines/nancy/ui/textbox.cpp b/engines/nancy/ui/textbox.cpp
index 74e1093d4ba..290b211c115 100644
--- a/engines/nancy/ui/textbox.cpp
+++ b/engines/nancy/ui/textbox.cpp
@@ -228,7 +228,7 @@ void Textbox::drawTextbox() {
 			if (hasHotspot) {
 				hotspot.left = _borderWidth;
 				hotspot.top = _firstLineOffset - font->getFontHeight() + (_numLines + 1) * lineDist;
-				hotspot.setHeight((wrappedLines.size() - 1) * lineDist + _lineHeight);
+				hotspot.setHeight((wrappedLines.size() - 1) * _lineHeight + lineDist);
 				hotspot.setWidth(0);
 			}
 


Commit: 1fa1de39b68e2f02ff0c7091f4cf97de33a0d259
    https://github.com/scummvm/scummvm/commit/1fa1de39b68e2f02ff0c7091f4cf97de33a0d259
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:22+02:00

Commit Message:
NANCY: Rename action record dependency types

Renamed the dependency types for ActionRecords to match their
official ones. Also added the dependency types found in nancy3.

Changed paths:
    engines/nancy/action/actionmanager.cpp
    engines/nancy/action/actionrecord.h
    engines/nancy/console.cpp


diff --git a/engines/nancy/action/actionmanager.cpp b/engines/nancy/action/actionmanager.cpp
index 29e8bbe6bd9..5e74523b1de 100644
--- a/engines/nancy/action/actionmanager.cpp
+++ b/engines/nancy/action/actionmanager.cpp
@@ -186,7 +186,7 @@ void ActionManager::processActionRecords() {
 						}
 
 						break;
-					case DependencyType::kEventFlag:
+					case DependencyType::kEvent:
 						if (NancySceneState.getEventFlag(dep.label, dep.condition)) {
 							// nancy1 has code for some timer array that never gets used
 							// and is discarded from nancy2 onward
@@ -194,7 +194,7 @@ void ActionManager::processActionRecords() {
 						}
 
 						break;
-					case DependencyType::kLogicCondition:
+					case DependencyType::kLogic:
 						if (NancySceneState._flags.logicConditions[dep.label].flag == dep.condition) {
 							// Wait for specified time before satisfying dependency condition
 							Time elapsed = NancySceneState._timers.lastTotalTime - NancySceneState._flags.logicConditions[dep.label].timestamp;
@@ -205,30 +205,24 @@ void ActionManager::processActionRecords() {
 						}
 
 						break;
-					case DependencyType::kTotalTime:
+					case DependencyType::kElapsedGameTime:
 						if (NancySceneState._timers.lastTotalTime >= dep.timeData) {
 							dep.satisfied = true;
 						}
 
 						break;
-					case DependencyType::kSceneTime:
+					case DependencyType::kElapsedSceneTime:
 						if (NancySceneState._timers.sceneTime >= dep.timeData) {
 							dep.satisfied = true;
 						}
 
 						break;
-					case DependencyType::kPlayerTime:
+					case DependencyType::kElapsedPlayerTime:
 						// TODO almost definitely wrong, as the original engine treats player time differently
 						if (NancySceneState._timers.playerTime >= dep.timeData) {
 							dep.satisfied = true;
 						}
 
-						break;
-					case DependencyType::kUnknownType7:
-						warning("Unknown Dependency type 7");
-						break;
-					case DependencyType::kUnknownType8:
-						warning("Unknown Dependency type 8");
 						break;
 					case DependencyType::kSceneCount:
 						// This dependency type keeps its data in the time variables
@@ -255,7 +249,7 @@ void ActionManager::processActionRecords() {
 						}
 
 						break;
-					case DependencyType::kResetOnNewDay:
+					case DependencyType::kElapsedPlayerDay:
 						if (record->_days == -1) {
 							record->_days = NancySceneState._timers.playerTime.getDays();
 							dep.satisfied = true;
@@ -265,14 +259,14 @@ void ActionManager::processActionRecords() {
 						if (record->_days < NancySceneState._timers.playerTime.getDays()) {
 							record->_days = NancySceneState._timers.playerTime.getDays();
 							for (uint j = 0; j < record->_dependencies.size(); ++j) {
-								if (record->_dependencies[j].type == DependencyType::kPlayerTime) {
+								if (record->_dependencies[j].type == DependencyType::kElapsedPlayerTime) {
 									record->_dependencies[j].satisfied = false;
 								}
 							}
 						}
 
 						break;
-					case DependencyType::kUseItem: {
+					case DependencyType::kCursorType: {
 						bool hasUnsatisfiedDeps = false;
 						for (uint j = 0; j < record->_dependencies.size(); ++j) {
 							if (j != i && record->_dependencies[j].satisfied == false) {
@@ -293,19 +287,19 @@ void ActionManager::processActionRecords() {
 						dep.satisfied = true;
 						break;
 					}
-					case DependencyType::kTimeOfDay:
+					case DependencyType::kPlayerTOD:
 						if (dep.label == NancySceneState._timers.timeOfDay) {
 							dep.satisfied = true;
 						}
 
 						break;
-					case DependencyType::kTimerNotDone:
+					case DependencyType::kTimerLessThanDependencyTime:
 						if (NancySceneState._timers.timerTime <= dep.timeData) {
 							dep.satisfied = true;
 						}
 
 						break;
-					case DependencyType::kTimerDone:
+					case DependencyType::kTimerGreaterThanDependencyTime:
 						if (NancySceneState._timers.timerTime > dep.timeData) {
 							dep.satisfied = true;
 						}
@@ -318,7 +312,7 @@ void ActionManager::processActionRecords() {
 
 						break;
 					default:
-						warning("Unknown Dependency type %i", (int)dep.type);
+						warning("Unimplemented Dependency type %i", (int)dep.type);
 						break;
 					}
 				}
diff --git a/engines/nancy/action/actionrecord.h b/engines/nancy/action/actionrecord.h
index a9e75ccad34..6521db83c7b 100644
--- a/engines/nancy/action/actionrecord.h
+++ b/engines/nancy/action/actionrecord.h
@@ -39,22 +39,26 @@ struct NancyInput;
 namespace Action {
 
 enum struct DependencyType : byte {
-	kNone               = 0,
-	kInventory          = 1,
-	kEventFlag          = 2,
-	kLogicCondition     = 3,
-	kTotalTime          = 4,
-	kSceneTime          = 5,
-	kPlayerTime         = 6,
-	kUnknownType7       = 7,
-	kUnknownType8       = 8,
-	kSceneCount         = 9,
-	kResetOnNewDay      = 10,
-	kUseItem            = 11,
-	kTimeOfDay          = 12,
-	kTimerNotDone       = 13,
-	kTimerDone          = 14,
-	kDifficultyLevel    = 15
+	kNone                           = 0,
+	kInventory                      = 1,
+	kEvent                          = 2,
+	kLogic                          = 3,
+	kElapsedGameTime                = 4,
+	kElapsedSceneTime               = 5,
+	kElapsedPlayerTime              = 6,
+	kSamsSight                      = 7,    // Not implemented
+	kSamsSound                      = 8,    // Not implemented
+	kSceneCount                     = 9,
+	kElapsedPlayerDay               = 10,
+	kCursorType                     = 11,
+	kPlayerTOD                      = 12,
+	kTimerLessThanDependencyTime    = 13,
+	kTimerGreaterThanDependencyTime = 14,
+	kDifficultyLevel                = 15,
+    kClosedCaptioning               = 16,   // Not implemented
+    kSound                          = 17,   // Not implemented
+    kOpenParentheses                = 18,   // Not implemented
+    kCloseParentheses               = 19    // Not implemented
 };
 
 // Describes a condition that needs to be fulfilled before the
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 422a609b71a..40f070db6fe 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -419,32 +419,32 @@ bool NancyConsole::Cmd_listAcionRecords(int argc, const char **argv) {
 						g_nancy->getStaticData().itemNames[dep.label].c_str(),
 						dep.condition == kInvHolding ? "kInvHolding" : "kInvEmpty");
 					break;
-				case DependencyType::kEventFlag :
-					debugPrintf("kEventFlag, flag %u, %s, %s",
+				case DependencyType::kEvent :
+					debugPrintf("kEvent, flag %u, %s, %s",
 						dep.label,
 						g_nancy->getStaticData().eventFlagNames[dep.label].c_str(),
 						dep.condition == kEvOccurred ? "kEvOccurred" : "kEvNotOccurred");
 					break;
-				case DependencyType::kLogicCondition :
-					debugPrintf("kLogicCondition, flag %u, %s",
+				case DependencyType::kLogic :
+					debugPrintf("kLogic, flag %u, %s",
 						dep.label,
 						dep.condition == kLogUsed ? "kLogUsed" : "kLogNotUsed");
 					break;
-				case DependencyType::kTotalTime :
-					debugPrintf("kTotalTime, %i hours, %i minutes, %i seconds, %i milliseconds",
+				case DependencyType::kElapsedGameTime :
+					debugPrintf("kElapsedGameTime, %i hours, %i minutes, %i seconds, %i milliseconds",
 						dep.hours,
 						dep.minutes,
 						dep.seconds,
 						dep.milliseconds);
 					break;
-				case DependencyType::kSceneTime :
-					debugPrintf("kSceneTime, %i hours, %i minutes, %i seconds, %i milliseconds",
+				case DependencyType::kElapsedSceneTime :
+					debugPrintf("kElapsedSceneTime, %i hours, %i minutes, %i seconds, %i milliseconds",
 						dep.hours,
 						dep.minutes,
 						dep.seconds,
 						dep.milliseconds);
 					break;
-				case DependencyType::kPlayerTime :
+				case DependencyType::kElapsedPlayerTime :
 					debugPrintf("kPlayerTime, %i hours, %i minutes, %i seconds, %i milliseconds",
 						dep.hours,
 						dep.minutes,
@@ -457,24 +457,24 @@ bool NancyConsole::Cmd_listAcionRecords(int argc, const char **argv) {
 						dep.milliseconds == 1 ? ">" : dep.milliseconds == 2 ? "<" : "==",
 						dep.seconds);
 					break;
-				case DependencyType::kResetOnNewDay :
-					debugPrintf("kResetOnNewDay");
+				case DependencyType::kElapsedPlayerDay :
+					debugPrintf("kElapsedPlayerDay");
 					break;
-				case DependencyType::kUseItem :
-					debugPrintf("kUseItem, item %u, %s, %s",
+				case DependencyType::kCursorType :
+					debugPrintf("kCursorType, item %u, %s, %s",
 						dep.label,
 						g_nancy->getStaticData().itemNames[dep.label].c_str(),
 						dep.condition == ActionManager::kCursInvHolding ? "kCursInvHolding" : "kCursInvNotHolding");
 					break;
-				case DependencyType::kTimeOfDay :
-					debugPrintf("kTimeOfDay, %s",
+				case DependencyType::kPlayerTOD :
+					debugPrintf("kPlayerTOD, %s",
 						dep.label == 0 ? "kPlayerDay" : dep.label == 1 ? "kPLayerNight" : "kPLayerDuskDawn");
 					break;
-				case DependencyType::kTimerNotDone :
-					debugPrintf("kTimerNotDone");
+				case DependencyType::kTimerLessThanDependencyTime :
+					debugPrintf("kTimerLessThanDependencyTime");
 					break;
-				case DependencyType::kTimerDone :
-					debugPrintf("kTimerDone");
+				case DependencyType::kTimerGreaterThanDependencyTime :
+					debugPrintf("kTimerGreaterThanDependencyTime");
 					break;
 				case DependencyType::kDifficultyLevel :
 					debugPrintf("kDifficultyLevel, level %i", dep.condition);


Commit: fb7a903080eb7d7286ae61ce2d7857d94b0be36b
    https://github.com/scummvm/scummvm/commit/fb7a903080eb7d7286ae61ce2d7857d94b0be36b
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:22+02:00

Commit Message:
NANCY: Fix primary video chaining

Fixed an issue where a piece of dialogue would start playing for a split
second before getting switched out with another.

Changed paths:
    engines/nancy/action/primaryvideo.cpp


diff --git a/engines/nancy/action/primaryvideo.cpp b/engines/nancy/action/primaryvideo.cpp
index c4ab02a1bc7..ae330ac7693 100644
--- a/engines/nancy/action/primaryvideo.cpp
+++ b/engines/nancy/action/primaryvideo.cpp
@@ -233,7 +233,10 @@ void PlayPrimaryVideoChan0::readData(Common::SeekableReadStream &stream) {
 void PlayPrimaryVideoChan0::execute() {
 	PlayPrimaryVideoChan0 *activeVideo = NancySceneState.getActivePrimaryVideo();
 	if (activeVideo != this && activeVideo != nullptr) {
-		if (!activeVideo->_isDone) {
+		if (    !activeVideo->_isDone ||
+				activeVideo->_defaultNextScene == kDefaultNextSceneEnabled ||
+				activeVideo->_pickedResponse != -1  ) {
+
 			return;
 		} else {
 			// Chained videos, hide the previous one and start this


Commit: 415406bbcc263ba82b48565335f9197dc3341454
    https://github.com/scummvm/scummvm/commit/415406bbcc263ba82b48565335f9197dc3341454
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:24+02:00

Commit Message:
NANCY: Pick correct responses in primary video

Fixed an issue where the incorrect player dialogue would be chosen
when one or more of the other responses are hidden.

Changed paths:
    engines/nancy/action/primaryvideo.cpp
    engines/nancy/action/primaryvideo.h


diff --git a/engines/nancy/action/primaryvideo.cpp b/engines/nancy/action/primaryvideo.cpp
index ae330ac7693..fc5e8757e47 100644
--- a/engines/nancy/action/primaryvideo.cpp
+++ b/engines/nancy/action/primaryvideo.cpp
@@ -300,6 +300,7 @@ void PlayPrimaryVideoChan0::execute() {
 
 				if (res.conditionFlags.isSatisfied()) {
 					NancySceneState.getTextbox().addTextLine(res.text);
+                    res.isOnScreen = true;
 				}
 			}
 		}
@@ -314,7 +315,19 @@ void PlayPrimaryVideoChan0::execute() {
 				// NPC has finished talking, we have responses
 				for (uint i = 0; i < 30; ++i) {
 					if (NancySceneState.getLogicCondition(i, kLogUsed)) {
-						_pickedResponse = i;
+                        int pickedOnScreenResponse = _pickedResponse = i;
+
+                        // Adjust to account for hidden responses
+                        for (uint j = 0; j < _responses.size(); ++j) {
+                            if (!_responses[j].isOnScreen) {
+                                ++_pickedResponse;
+                            }
+
+                            if ((int)j == pickedOnScreenResponse) {
+                                break;
+                            }
+                        }
+
 						break;
 					}
 				}
@@ -350,7 +363,7 @@ void PlayPrimaryVideoChan0::execute() {
 			g_nancy->_sound->stopSound(_responseGenericSound);
 
 			if (_pickedResponse != -1) {
-				NancySceneState.changeScene(_responses[_pickedResponse].sceneChange);
+                NancySceneState.changeScene(_responses[_pickedResponse].sceneChange);
 			} else {
 				// Evaluate scene branch structs here
 
diff --git a/engines/nancy/action/primaryvideo.h b/engines/nancy/action/primaryvideo.h
index 9e139aa42c3..ad1932c72c5 100644
--- a/engines/nancy/action/primaryvideo.h
+++ b/engines/nancy/action/primaryvideo.h
@@ -59,6 +59,8 @@ struct ResponseStruct {
 	Common::String soundName; // 0x196
 	SceneChangeDescription sceneChange; // 0x1A0
 	FlagDescription flagDesc; // 0x1A8
+    
+	bool isOnScreen = false;
 };
 
 struct FlagsStruct {


Commit: b0cd7b1524b13db0754a7976d1866a68fd6cb107
    https://github.com/scummvm/scummvm/commit/b0cd7b1524b13db0754a7976d1866a68fd6cb107
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:24+02:00

Commit Message:
NANCY: Make LightningOn::readData() more readable

Changed paths:
    engines/nancy/action/lightning.cpp


diff --git a/engines/nancy/action/lightning.cpp b/engines/nancy/action/lightning.cpp
index c4729a63af2..5fde2e526f2 100644
--- a/engines/nancy/action/lightning.cpp
+++ b/engines/nancy/action/lightning.cpp
@@ -2,14 +2,14 @@
  *
  * ScummVM is the legal property of its developers, whose names
  * are too numerous to list here. Please refer to the COPYRIGHT
- * file randomnessributed with this source randomnessribution.
+ * file distributed with this source distribution.
  *
- * This program is free software: you can rerandomnessribute it and/or modify
+ * 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 randomnessributed in the hope that it will be useful,
+ * 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.
@@ -49,37 +49,37 @@ LightningOn::~LightningOn() {
 }
 
 void LightningOn::readData(Common::SeekableReadStream &stream) {
-    int16 one = stream.readSint16LE();
-    uint16 two = stream.readUint16LE();
-    int16 three = stream.readSint16LE();
+    int16 distance = stream.readSint16LE();
+    uint16 pulseTime = stream.readUint16LE();
+    int16 rgbPercent = stream.readSint16LE();
 
-    int16 baseline;
-    float randomness;
+    int16 midpoint;
+    float delta;
 
     // Calculate the min & max power of the lightning
-    baseline = (three - (one * 5));
-    randomness = 0.4 * baseline;
+    midpoint = (rgbPercent - (distance * 5));
+    delta = 0.4 * midpoint;
 
-    _minRGBPercent = MAX<uint16>(0, baseline - randomness);
-    _maxRGBPercent = MIN<uint16>(three, baseline + randomness);
+    _minRGBPercent = MAX<uint16>(0, midpoint - delta);
+    _maxRGBPercent = MIN<uint16>(rgbPercent, midpoint + delta);
 
     // Calculate the min & max delay between lightning strikes
-    baseline = 13000 - (two * 500);
-    randomness = 1.5 * baseline;
+    midpoint = 13000 - (pulseTime * 500);
+    delta = 1.5 * midpoint;
 
-    _minInterPulseDelay = MAX<int16>(500, baseline - randomness);
-    _maxInterPulseDelay = MIN<int16>(13000, baseline + randomness);
+    _minInterPulseDelay = MAX<int16>(500, midpoint - delta);
+    _maxInterPulseDelay = MIN<int16>(13000, midpoint + delta);
 
     // Calculate the min & max length of the lightning strikes
     // _minPulseLength is always 5 due to an oversight in the original code
-    _maxPulseLength = two * 10;
+    _maxPulseLength = pulseTime * 10;
 
     // Calculate the min & max delay between end of lightning and start of thunder sound
-    baseline = one * 400;
-    randomness = baseline * 0.4;
+    midpoint = distance * 400;
+    delta = midpoint * 0.4;
 
-    _minSoundStartDelay = MAX<int16>(250, baseline - randomness);
-    _maxSoundStartDelay = baseline + randomness; // No minimum value, probably a bug
+    _minSoundStartDelay = MAX<int16>(250, midpoint - delta);
+    _maxSoundStartDelay = midpoint + delta; // No minimum value, probably a bug
 
     stream.skip(0x4); // paletteStart, paletteSize
 }


Commit: 3749b21f18b59957920ba97769305e16396ef611
    https://github.com/scummvm/scummvm/commit/3749b21f18b59957920ba97769305e16396ef611
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-07T21:19:24+02:00

Commit Message:
NANCY: Formatting fixes

Changed spaces to tabs, fixed some double spaces and cleaned up
trailing whitespaces.

Changed paths:
    engines/nancy/action/actionmanager.h
    engines/nancy/action/actionrecord.h
    engines/nancy/action/lightning.cpp
    engines/nancy/action/lightning.h
    engines/nancy/action/orderingpuzzle.cpp
    engines/nancy/action/primaryvideo.cpp
    engines/nancy/action/primaryvideo.h
    engines/nancy/action/recordtypes.cpp
    engines/nancy/action/secondarymovie.h
    engines/nancy/action/staticbitmapanim.cpp
    engines/nancy/commontypes.cpp
    engines/nancy/commontypes.h
    engines/nancy/console.cpp
    engines/nancy/detection.h
    engines/nancy/font.cpp
    engines/nancy/font.h
    engines/nancy/graphics.cpp
    engines/nancy/iff.h
    engines/nancy/input.h
    engines/nancy/nancy.cpp
    engines/nancy/nancy.h
    engines/nancy/renderobject.h
    engines/nancy/resource.cpp
    engines/nancy/sound.cpp
    engines/nancy/sound.h
    engines/nancy/state/map.cpp
    engines/nancy/state/scene.cpp
    engines/nancy/time.h
    engines/nancy/ui/inventorybox.cpp
    engines/nancy/ui/ornaments.cpp
    engines/nancy/ui/ornaments.h


diff --git a/engines/nancy/action/actionmanager.h b/engines/nancy/action/actionmanager.h
index 7c7ed4d4d0e..f4307583416 100644
--- a/engines/nancy/action/actionmanager.h
+++ b/engines/nancy/action/actionmanager.h
@@ -51,7 +51,7 @@ class ActionManager {
 public:
 	static const byte kCursInvHolding			= 0;
 	static const byte kCursInvNotHolding		= 1;
-	static const byte kCursInvNotHoldingOffset 	= 100;
+	static const byte kCursInvNotHoldingOffset	= 100;
 
 	ActionManager() {}
 	virtual ~ActionManager() {}
diff --git a/engines/nancy/action/actionrecord.h b/engines/nancy/action/actionrecord.h
index 6521db83c7b..bbca62d2b87 100644
--- a/engines/nancy/action/actionrecord.h
+++ b/engines/nancy/action/actionrecord.h
@@ -39,39 +39,39 @@ struct NancyInput;
 namespace Action {
 
 enum struct DependencyType : byte {
-	kNone                           = 0,
-	kInventory                      = 1,
-	kEvent                          = 2,
-	kLogic                          = 3,
-	kElapsedGameTime                = 4,
-	kElapsedSceneTime               = 5,
-	kElapsedPlayerTime              = 6,
-	kSamsSight                      = 7,    // Not implemented
-	kSamsSound                      = 8,    // Not implemented
-	kSceneCount                     = 9,
-	kElapsedPlayerDay               = 10,
-	kCursorType                     = 11,
-	kPlayerTOD                      = 12,
-	kTimerLessThanDependencyTime    = 13,
-	kTimerGreaterThanDependencyTime = 14,
-	kDifficultyLevel                = 15,
-    kClosedCaptioning               = 16,   // Not implemented
-    kSound                          = 17,   // Not implemented
-    kOpenParentheses                = 18,   // Not implemented
-    kCloseParentheses               = 19    // Not implemented
+	kNone							= 0,
+	kInventory						= 1,
+	kEvent							= 2,
+	kLogic							= 3,
+	kElapsedGameTime				= 4,
+	kElapsedSceneTime				= 5,
+	kElapsedPlayerTime				= 6,
+	kSamsSight						= 7,	// Not implemented
+	kSamsSound						= 8,	// Not implemented
+	kSceneCount						= 9,
+	kElapsedPlayerDay				= 10,
+	kCursorType						= 11,
+	kPlayerTOD						= 12,
+	kTimerLessThanDependencyTime	= 13,
+	kTimerGreaterThanDependencyTime	= 14,
+	kDifficultyLevel				= 15,
+	kClosedCaptioning				= 16,	// Not implemented
+	kSound							= 17,	// Not implemented
+	kOpenParentheses				= 18,	// Not implemented
+	kCloseParentheses				= 19	// Not implemented
 };
 
 // Describes a condition that needs to be fulfilled before the
 // action record can be executed
 struct DependencyRecord {
-	DependencyType type;    // 0x00
-	byte label;             // 0x01
-	byte condition;         // 0x02
-	bool orFlag;            // 0x03
-	int16 hours;            // 0x04
-	int16 minutes;          // 0x06
-	int16 seconds;          // 0x08
-	int16 milliseconds;     // 0x0A
+	DependencyType type;	// 0x00
+	byte label;				// 0x01
+	byte condition;			// 0x02
+	bool orFlag;			// 0x03
+	int16 hours;			// 0x04
+	int16 minutes;			// 0x06
+	int16 seconds;			// 0x08
+	int16 milliseconds;		// 0x0A
 
 	bool satisfied;
 	Time timeData;
@@ -114,22 +114,22 @@ protected:
 	virtual Common::String getRecordTypeName() const = 0;
 
 public:
-	Common::String _description;                    // 0x00
-	byte _type;                                     // 0x30
-	ExecutionType _execType;                        // 0x31
+	Common::String _description;					// 0x00
+	byte _type;										// 0x30
+	ExecutionType _execType;						// 0x31
 	// 0x32 data
-	Common::Array<DependencyRecord> _dependencies;  // 0x36
+	Common::Array<DependencyRecord> _dependencies;	// 0x36
 	// 0x3A numDependencies
-	bool _isActive;                                 // 0x3B
+	bool _isActive;									// 0x3B
 	// 0x3C satisfiedDependencies[]
 	// 0x48 timers[]
 	// 0x78 orFlags[]
-	bool _isDone;                                   // 0x84
-	bool _hasHotspot;                               // 0x85
-	Common::Rect _hotspot;                          // 0x89
-	ExecutionState _state;                          // 0x91
-	int16 _days;                                    // 0x95
-	int8 _itemRequired;                             // 0x97
+	bool _isDone;									// 0x84
+	bool _hasHotspot;								// 0x85
+	Common::Rect _hotspot;							// 0x89
+	ExecutionState _state;							// 0x91
+	int16 _days;									// 0x95
+	int8 _itemRequired;								// 0x97
 };
 
 } // End of namespace Action
diff --git a/engines/nancy/action/lightning.cpp b/engines/nancy/action/lightning.cpp
index 5fde2e526f2..7026702ddd4 100644
--- a/engines/nancy/action/lightning.cpp
+++ b/engines/nancy/action/lightning.cpp
@@ -34,141 +34,141 @@ namespace Nancy {
 namespace Action {
 
 void editPalette(byte *colors, uint percent) {
-    float alpha = (float) percent / 100;
+	float alpha = (float) percent / 100;
 
-    for (int i = 0; i < 256 * 3; ++i) {
-        uint16 origColor = colors[i];
-        colors[i] = MIN<uint16>(alpha * origColor + origColor, 255);
-    }
+	for (int i = 0; i < 256 * 3; ++i) {
+		uint16 origColor = colors[i];
+		colors[i] = MIN<uint16>(alpha * origColor + origColor, 255);
+	}
 }
 
 LightningOn::~LightningOn() {
-    for (byte *palette : _viewportObjOriginalPalettes) {
-        delete[] palette;
-    }
+	for (byte *palette : _viewportObjOriginalPalettes) {
+		delete[] palette;
+	}
 }
 
 void LightningOn::readData(Common::SeekableReadStream &stream) {
-    int16 distance = stream.readSint16LE();
-    uint16 pulseTime = stream.readUint16LE();
-    int16 rgbPercent = stream.readSint16LE();
+	int16 distance = stream.readSint16LE();
+	uint16 pulseTime = stream.readUint16LE();
+	int16 rgbPercent = stream.readSint16LE();
 
-    int16 midpoint;
-    float delta;
+	int16 midpoint;
+	float delta;
 
-    // Calculate the min & max power of the lightning
-    midpoint = (rgbPercent - (distance * 5));
-    delta = 0.4 * midpoint;
+	// Calculate the min & max power of the lightning
+	midpoint = (rgbPercent - (distance * 5));
+	delta = 0.4 * midpoint;
 
-    _minRGBPercent = MAX<uint16>(0, midpoint - delta);
-    _maxRGBPercent = MIN<uint16>(rgbPercent, midpoint + delta);
+	_minRGBPercent = MAX<uint16>(0, midpoint - delta);
+	_maxRGBPercent = MIN<uint16>(rgbPercent, midpoint + delta);
 
-    // Calculate the min & max delay between lightning strikes
-    midpoint = 13000 - (pulseTime * 500);
-    delta = 1.5 * midpoint;
+	// Calculate the min & max delay between lightning strikes
+	midpoint = 13000 - (pulseTime * 500);
+	delta = 1.5 * midpoint;
 
-    _minInterPulseDelay = MAX<int16>(500, midpoint - delta);
-    _maxInterPulseDelay = MIN<int16>(13000, midpoint + delta);
+	_minInterPulseDelay = MAX<int16>(500, midpoint - delta);
+	_maxInterPulseDelay = MIN<int16>(13000, midpoint + delta);
 
-    // Calculate the min & max length of the lightning strikes
-    // _minPulseLength is always 5 due to an oversight in the original code
-    _maxPulseLength = pulseTime * 10;
+	// Calculate the min & max length of the lightning strikes
+	// _minPulseLength is always 5 due to an oversight in the original code
+	_maxPulseLength = pulseTime * 10;
 
-    // Calculate the min & max delay between end of lightning and start of thunder sound
-    midpoint = distance * 400;
-    delta = midpoint * 0.4;
+	// Calculate the min & max delay between end of lightning and start of thunder sound
+	midpoint = distance * 400;
+	delta = midpoint * 0.4;
 
-    _minSoundStartDelay = MAX<int16>(250, midpoint - delta);
-    _maxSoundStartDelay = midpoint + delta; // No minimum value, probably a bug
+	_minSoundStartDelay = MAX<int16>(250, midpoint - delta);
+	_maxSoundStartDelay = midpoint + delta; // No minimum value, probably a bug
 
-    stream.skip(0x4); // paletteStart, paletteSize
+	stream.skip(0x4); // paletteStart, paletteSize
 }
 
 void LightningOn::execute() {
-    if (_state == kBegin) {
-        g_nancy->_graphicsManager->grabViewportObjects(_viewportObjs);
-
-        for (RenderObject *obj : _viewportObjs) {
-            if (!obj) {
-                continue;
-            }
-
-            _viewportObjOriginalPalettes.push_back(new byte[256 * 3]);
-            obj->grabPalette(_viewportObjOriginalPalettes.back());
-        }
-
-        _state = kRun;
-    }
-
-    switch (_lightningState) {
-    case kStartPulse:
-        _nextStateTime = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minPulseLength, _maxPulseLength);
-        handleThunder();
-        handlePulse(true);
-        _lightningState = kPulse;
-        break;
-    case kPulse:
-        if (g_nancy->getTotalPlayTime() > _nextStateTime) {
-
-            _nextStateTime = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minInterPulseDelay, _maxInterPulseDelay);
-
-            _lightningState = kThunder;
-            
-            if (!g_nancy->_sound->isSoundPlaying("TH1")) {
-                _nextSoundToPlay = 0;
-                _nextSoundTime0 = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minSoundStartDelay, _maxSoundStartDelay);
-            } else if (!g_nancy->_sound->isSoundPlaying("TH2")) {
-                _nextSoundToPlay = 1;
-                _nextSoundTime1 = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minSoundStartDelay, _maxSoundStartDelay);
-            } else {
-                _nextSoundToPlay = -1;
-            }
-
-            handlePulse(false);
-        }
-        
-        handleThunder();
-        break;
-    case kThunder:
-        if (g_nancy->getTotalPlayTime() > _nextStateTime) {
-            _lightningState = kStartPulse;
-        }
-
-        handleThunder();
-        break;
-    }
+	if (_state == kBegin) {
+		g_nancy->_graphicsManager->grabViewportObjects(_viewportObjs);
+
+		for (RenderObject *obj : _viewportObjs) {
+			if (!obj) {
+				continue;
+			}
+
+			_viewportObjOriginalPalettes.push_back(new byte[256 * 3]);
+			obj->grabPalette(_viewportObjOriginalPalettes.back());
+		}
+
+		_state = kRun;
+	}
+
+	switch (_lightningState) {
+	case kStartPulse:
+		_nextStateTime = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minPulseLength, _maxPulseLength);
+		handleThunder();
+		handlePulse(true);
+		_lightningState = kPulse;
+		break;
+	case kPulse:
+		if (g_nancy->getTotalPlayTime() > _nextStateTime) {
+
+			_nextStateTime = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minInterPulseDelay, _maxInterPulseDelay);
+
+			_lightningState = kThunder;
+
+			if (!g_nancy->_sound->isSoundPlaying("TH1")) {
+				_nextSoundToPlay = 0;
+				_nextSoundTime0 = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minSoundStartDelay, _maxSoundStartDelay);
+			} else if (!g_nancy->_sound->isSoundPlaying("TH2")) {
+				_nextSoundToPlay = 1;
+				_nextSoundTime1 = g_nancy->getTotalPlayTime() + g_nancy->_randomSource->getRandomNumberRngSigned(_minSoundStartDelay, _maxSoundStartDelay);
+			} else {
+				_nextSoundToPlay = -1;
+			}
+
+			handlePulse(false);
+		}
+
+		handleThunder();
+		break;
+	case kThunder:
+		if (g_nancy->getTotalPlayTime() > _nextStateTime) {
+			_lightningState = kStartPulse;
+		}
+
+		handleThunder();
+		break;
+	}
 }
 
 void LightningOn::handlePulse(bool on) {
-    for (uint i = 0; i < _viewportObjs.size(); ++i) {
-        RenderObject *obj = _viewportObjs[i];
-
-        if (!obj) {
-            continue;
-        }
-
-        if (on) {
-            byte newPalette[256 * 3];
-            obj->grabPalette(newPalette);
-            editPalette(newPalette, g_nancy->_randomSource->getRandomNumberRngSigned(_minRGBPercent, _maxRGBPercent));
-            obj->setPalette(newPalette);
-        } else {
-            obj->setPalette(_viewportObjOriginalPalettes[i]);
-        }
-        
-    }
+	for (uint i = 0; i < _viewportObjs.size(); ++i) {
+		RenderObject *obj = _viewportObjs[i];
+
+		if (!obj) {
+			continue;
+		}
+
+		if (on) {
+			byte newPalette[256 * 3];
+			obj->grabPalette(newPalette);
+			editPalette(newPalette, g_nancy->_randomSource->getRandomNumberRngSigned(_minRGBPercent, _maxRGBPercent));
+			obj->setPalette(newPalette);
+		} else {
+			obj->setPalette(_viewportObjOriginalPalettes[i]);
+		}
+
+	}
 }
 
 void LightningOn::handleThunder() {
-    if (_nextSoundToPlay == 0) {
-        if (g_nancy->getTotalPlayTime() > _nextSoundTime0) {
-            g_nancy->_sound->playSound("TH1");
-        }
-    } else if (_nextSoundToPlay == 1) {
-        if (g_nancy->getTotalPlayTime() > _nextSoundTime1) {
-            g_nancy->_sound->playSound("TH2");
-        }
-    }
+	if (_nextSoundToPlay == 0) {
+		if (g_nancy->getTotalPlayTime() > _nextSoundTime0) {
+			g_nancy->_sound->playSound("TH1");
+		}
+	} else if (_nextSoundToPlay == 1) {
+		if (g_nancy->getTotalPlayTime() > _nextSoundTime1) {
+			g_nancy->_sound->playSound("TH2");
+		}
+	}
 }
 
 } // End of namespace Action
diff --git a/engines/nancy/action/lightning.h b/engines/nancy/action/lightning.h
index 8d63639cb06..e5869c9f3c0 100644
--- a/engines/nancy/action/lightning.h
+++ b/engines/nancy/action/lightning.h
@@ -29,39 +29,39 @@ namespace Action {
 
 class LightningOn : public ActionRecord {
 public:
-    enum LightningState { kStartPulse, kPulse, kThunder };
+	enum LightningState { kStartPulse, kPulse, kThunder };
 
-    LightningOn() = default;
-    virtual ~LightningOn();
+	LightningOn() = default;
+	virtual ~LightningOn();
 
 	void readData(Common::SeekableReadStream &stream) override;
-    void execute() override;
+	void execute() override;
 
-    void handlePulse(bool on);
-    void handleThunder();
+	void handlePulse(bool on);
+	void handleThunder();
 
-    LightningState _lightningState = kStartPulse;
+	LightningState _lightningState = kStartPulse;
 
-    int16 _minRGBPercent = 0;
-    int16 _maxRGBPercent = 0;
+	int16 _minRGBPercent = 0;
+	int16 _maxRGBPercent = 0;
 
-    int16 _minInterPulseDelay = 0;
-    int16 _maxInterPulseDelay = 0;
+	int16 _minInterPulseDelay = 0;
+	int16 _maxInterPulseDelay = 0;
 
-    int16 _minPulseLength = 5;
-    int16 _maxPulseLength = 0;
+	int16 _minPulseLength = 5;
+	int16 _maxPulseLength = 0;
 
-    int16 _minSoundStartDelay = 0;
-    int16 _maxSoundStartDelay = 0;
+	int16 _minSoundStartDelay = 0;
+	int16 _maxSoundStartDelay = 0;
 
-    uint32 _nextStateTime = 0;
-    uint32 _nextSoundTime0 = 0;
-    uint32 _nextSoundTime1 = 0;
+	uint32 _nextStateTime = 0;
+	uint32 _nextSoundTime0 = 0;
+	uint32 _nextSoundTime1 = 0;
 
-    int _nextSoundToPlay = 0;
+	int _nextSoundToPlay = 0;
 
-    Common::Array<RenderObject *> _viewportObjs;
-    Common::Array<byte *> _viewportObjOriginalPalettes;
+	Common::Array<RenderObject *> _viewportObjs;
+	Common::Array<byte *> _viewportObjOriginalPalettes;
 
 protected:
 	Common::String getRecordTypeName() const override { return "LightningOn"; }
diff --git a/engines/nancy/action/orderingpuzzle.cpp b/engines/nancy/action/orderingpuzzle.cpp
index 1e0cc5a64ef..3f61025185a 100644
--- a/engines/nancy/action/orderingpuzzle.cpp
+++ b/engines/nancy/action/orderingpuzzle.cpp
@@ -140,7 +140,7 @@ void OrderingPuzzle::execute() {
 					if (_clickedSequence.size() > (uint)_sequenceLength + ((g_nancy->getGameType() == kGameTypeVampire) ? -1 : 1)) {
 						clearAllElements();
 					}
-					
+
 					return;
 				}
 			}
diff --git a/engines/nancy/action/primaryvideo.cpp b/engines/nancy/action/primaryvideo.cpp
index fc5e8757e47..96ff392ce6a 100644
--- a/engines/nancy/action/primaryvideo.cpp
+++ b/engines/nancy/action/primaryvideo.cpp
@@ -233,9 +233,9 @@ void PlayPrimaryVideoChan0::readData(Common::SeekableReadStream &stream) {
 void PlayPrimaryVideoChan0::execute() {
 	PlayPrimaryVideoChan0 *activeVideo = NancySceneState.getActivePrimaryVideo();
 	if (activeVideo != this && activeVideo != nullptr) {
-		if (    !activeVideo->_isDone ||
+		if (	!activeVideo->_isDone ||
 				activeVideo->_defaultNextScene == kDefaultNextSceneEnabled ||
-				activeVideo->_pickedResponse != -1  ) {
+				activeVideo->_pickedResponse != -1	) {
 
 			return;
 		} else {
@@ -300,7 +300,7 @@ void PlayPrimaryVideoChan0::execute() {
 
 				if (res.conditionFlags.isSatisfied()) {
 					NancySceneState.getTextbox().addTextLine(res.text);
-                    res.isOnScreen = true;
+					res.isOnScreen = true;
 				}
 			}
 		}
@@ -315,18 +315,18 @@ void PlayPrimaryVideoChan0::execute() {
 				// NPC has finished talking, we have responses
 				for (uint i = 0; i < 30; ++i) {
 					if (NancySceneState.getLogicCondition(i, kLogUsed)) {
-                        int pickedOnScreenResponse = _pickedResponse = i;
+						int pickedOnScreenResponse = _pickedResponse = i;
 
-                        // Adjust to account for hidden responses
-                        for (uint j = 0; j < _responses.size(); ++j) {
-                            if (!_responses[j].isOnScreen) {
-                                ++_pickedResponse;
-                            }
+						// Adjust to account for hidden responses
+						for (uint j = 0; j < _responses.size(); ++j) {
+							if (!_responses[j].isOnScreen) {
+								++_pickedResponse;
+							}
 
-                            if ((int)j == pickedOnScreenResponse) {
-                                break;
-                            }
-                        }
+							if ((int)j == pickedOnScreenResponse) {
+								break;
+							}
+						}
 
 						break;
 					}
@@ -363,7 +363,7 @@ void PlayPrimaryVideoChan0::execute() {
 			g_nancy->_sound->stopSound(_responseGenericSound);
 
 			if (_pickedResponse != -1) {
-                NancySceneState.changeScene(_responses[_pickedResponse].sceneChange);
+				NancySceneState.changeScene(_responses[_pickedResponse].sceneChange);
 			} else {
 				// Evaluate scene branch structs here
 
@@ -429,7 +429,7 @@ void PlayPrimaryVideoChan0::addGoodbye() {
 	ResponseStruct &newResponse = _responses.back();
 	newResponse.soundName = res.soundID;
 	newResponse.text = g_nancy->getStaticData().goodbyeTexts[_goodbyeResponseCharacterID];
-	
+
 	// Evaluate conditions to pick from the collection of replies
 	uint sceneChangeID = 0;
 	for (uint i = 0; i < res.sceneChanges.size(); ++i) {
@@ -456,7 +456,7 @@ void PlayPrimaryVideoChan0::addGoodbye() {
 	}
 
 	const GoodbyeSceneChange &sceneChange = res.sceneChanges[sceneChangeID];
-	
+
 	// The reply from the character is picked randomly
 	newResponse.sceneChange.sceneID = sceneChange.sceneIDs[g_nancy->_randomSource->getRandomNumber(sceneChange.sceneIDs.size() - 1)];
 
diff --git a/engines/nancy/action/primaryvideo.h b/engines/nancy/action/primaryvideo.h
index ad1932c72c5..ef2110042ad 100644
--- a/engines/nancy/action/primaryvideo.h
+++ b/engines/nancy/action/primaryvideo.h
@@ -59,7 +59,7 @@ struct ResponseStruct {
 	Common::String soundName; // 0x196
 	SceneChangeDescription sceneChange; // 0x1A0
 	FlagDescription flagDesc; // 0x1A8
-    
+
 	bool isOnScreen = false;
 };
 
@@ -68,7 +68,7 @@ struct FlagsStruct {
 	ConditionFlag flagToSet;
 };
 
-public:	
+public:
 	static const byte kDefaultNextSceneEnabled	= 1;
 	static const byte kDefaultNextSceneDisabled	= 2;
 
diff --git a/engines/nancy/action/recordtypes.cpp b/engines/nancy/action/recordtypes.cpp
index 8a9a56984a0..3bd8f839442 100644
--- a/engines/nancy/action/recordtypes.cpp
+++ b/engines/nancy/action/recordtypes.cpp
@@ -111,9 +111,9 @@ void HotMultiframeMultisceneChange::readData(Common::SeekableReadStream &stream)
 	_conditionID = stream.readUint16LE();
 	_conditionPayload = stream.readByte();
 	uint numHotspots = stream.readUint16LE();
-	
+
 	_hotspots.resize(numHotspots);
-	
+
 	for (uint i = 0; i < numHotspots; ++i) {
 		_hotspots[i].readData(stream);
 	}
@@ -516,7 +516,7 @@ void ShowInventoryItem::onPause(bool pause) {
 void PlayDigiSoundAndDie::readData(Common::SeekableReadStream &stream) {
 	_sound.read(stream, SoundDescription::kDIGI);
 	_sceneChange.readData(stream, g_nancy->getGameType() == kGameTypeVampire);
-	
+
 	_flagOnTrigger.label = stream.readSint16LE();
 	_flagOnTrigger.flag = stream.readByte();
 	stream.skip(2);
diff --git a/engines/nancy/action/secondarymovie.h b/engines/nancy/action/secondarymovie.h
index f7f5852ce05..7c4cb5bded3 100644
--- a/engines/nancy/action/secondarymovie.h
+++ b/engines/nancy/action/secondarymovie.h
@@ -37,10 +37,10 @@ public:
 
 	static const byte kMovieSceneChange			= 5;
 	static const byte kMovieNoSceneChange		= 6;
-		
+
 	static const byte kPlayerCursorAllowed		= 1;
 	static const byte kNoPlayerCursorAllowed	= 2;
-		
+
 	static const byte kPlayMovieForward			= 1;
 	static const byte kPlayMovieReverse			= 2;
 
diff --git a/engines/nancy/action/staticbitmapanim.cpp b/engines/nancy/action/staticbitmapanim.cpp
index f4125ddc76d..2a1f0f4cd2a 100644
--- a/engines/nancy/action/staticbitmapanim.cpp
+++ b/engines/nancy/action/staticbitmapanim.cpp
@@ -97,9 +97,9 @@ void PlayStaticBitmapAnimation::execute() {
 		if (_nextFrameTime <= _currentFrameTime) {
 			// World's worst if statement
 			if (NancySceneState.getEventFlag(_interruptCondition) ||
-				(   (((_currentFrame == _loopLastFrame) && (_playDirection == kPlayAnimationForward) && (_loop == kPlayAnimationOnce)) ||
+				(	(((_currentFrame == _loopLastFrame) && (_playDirection == kPlayAnimationForward) && (_loop == kPlayAnimationOnce)) ||
 					((_currentFrame == _loopFirstFrame) && (_playDirection == kPlayAnimationReverse) && (_loop == kPlayAnimationOnce))) &&
-						!g_nancy->_sound->isSoundPlaying(_sound))   ) {
+						!g_nancy->_sound->isSoundPlaying(_sound))	) {
 
 				_state = kActionTrigger;
 
diff --git a/engines/nancy/commontypes.cpp b/engines/nancy/commontypes.cpp
index dd367f79c7a..88c23344c0a 100644
--- a/engines/nancy/commontypes.cpp
+++ b/engines/nancy/commontypes.cpp
@@ -159,7 +159,7 @@ void Hint::readData(Common::SeekableReadStream &stream) {
 	soundIDs[0] = stream.readString();
 	soundIDs[1] = stream.readString();
 	soundIDs[2] = stream.readString();
-	
+
 	uint16 num = stream.readUint16LE();
 	flagConditions.resize(num);
 	for (uint16 i = 0; i < num; ++i) {
diff --git a/engines/nancy/commontypes.h b/engines/nancy/commontypes.h
index 9350f8b2895..5ff51d7aefd 100644
--- a/engines/nancy/commontypes.h
+++ b/engines/nancy/commontypes.h
@@ -168,9 +168,9 @@ struct SoundDescription {
 // originally stored inside the executable
 
 struct ConditionalDialogue {
-    byte textID;
-    uint16 sceneID;
-    Common::String soundID;
+	byte textID;
+	uint16 sceneID;
+	Common::String soundID;
 	Common::Array<FlagDescription> flagConditions;
 	Common::Array<FlagDescription> inventoryConditions;
 
@@ -193,11 +193,11 @@ struct Goodbye {
 };
 
 struct Hint {
-    byte textID;
-    int16 hintWeight;
-    SceneChangeDescription sceneChange;
-    Common::String soundIDs[3];
-    Common::Array<FlagDescription> flagConditions;
+	byte textID;
+	int16 hintWeight;
+	SceneChangeDescription sceneChange;
+	Common::String soundIDs[3];
+	Common::Array<FlagDescription> flagConditions;
 	Common::Array<FlagDescription> inventoryConditions;
 
 	void readData(Common::SeekableReadStream &stream);
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 40f070db6fe..6248845f172 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -61,7 +61,7 @@ NancyConsole::NancyConsole() : GUI::Debugger() {
 	registerCmd("set_player_time", WRAP_METHOD(NancyConsole, Cmd_setPlayerTime));
 	registerCmd("get_difficulty", WRAP_METHOD(NancyConsole, Cmd_getDifficulty));
 	registerCmd("set_difficulty", WRAP_METHOD(NancyConsole, Cmd_setDifficulty));
-	
+
 }
 
 NancyConsole::~NancyConsole() {}
@@ -73,7 +73,7 @@ void NancyConsole::postEnter() {
 
 		if (dec->loadFile(_videoFile)) {
 			Graphics::ManagedSurface surf;
-			
+
 			if (_paletteFile.size()) {
 				GraphicsManager::loadSurfacePalette(surf, _paletteFile);
 			}
@@ -536,7 +536,7 @@ bool NancyConsole::Cmd_scanForActionRecordType(int argc, const char **argv) {
 					delete chunk;
 				}
 			}
-		}		
+		}
 	}
 
 	return true;
@@ -570,7 +570,7 @@ bool NancyConsole::Cmd_getEventFlags(int argc, const char **argv) {
 				flagID,
 				g_nancy->getStaticData().eventFlagNames[flagID].c_str(),
 				NancySceneState.getEventFlag(flagID) == true ? "kEvOccurred" : "kEvNotOccurred");
-			 
+
 		}
 	}
 
@@ -592,7 +592,7 @@ bool NancyConsole::Cmd_setEventFlags(int argc, const char **argv) {
 			debugPrintf("Invalid flag %s\n", argv[i]);
 			continue;
 		}
-		
+
 		if (Common::String(argv[i + 1]).compareTo("true") == 0) {
 			NancySceneState.setEventFlag(flagID, kEvOccurred);
 			debugPrintf("Set flag %i, %s, to kEvOccurred\n",
@@ -640,7 +640,7 @@ bool NancyConsole::Cmd_getInventory(int argc, const char **argv) {
 				flagID,
 				g_nancy->getStaticData().itemNames[flagID].c_str(),
 				NancySceneState.hasItem(i) == kInvHolding ? "kInvHolding" : "kInvEmpty");
-			 
+
 		}
 	}
 
@@ -667,7 +667,7 @@ bool NancyConsole::Cmd_setInventory(int argc, const char **argv) {
 			debugPrintf("Invalid item %s\n", argv[i]);
 			continue;
 		}
-		
+
 		if (Common::String(argv[i + 1]).compareTo("true") == 0) {
 			NancySceneState.addItemToInventory(itemID);
 			debugPrintf("Added item %i, %s, to inventory\n",
diff --git a/engines/nancy/detection.h b/engines/nancy/detection.h
index d4c15910e4b..6036e321a2b 100644
--- a/engines/nancy/detection.h
+++ b/engines/nancy/detection.h
@@ -44,8 +44,8 @@ struct NancyGameDescription {
 };
 
 enum NancyDebugChannels {
-	kDebugEngine    	= 1 << 0,
-	kDebugActionRecord  = 1 << 1,
+	kDebugEngine		= 1 << 0,
+	kDebugActionRecord	= 1 << 1,
 	kDebugScene			= 1 << 2
 };
 
diff --git a/engines/nancy/font.cpp b/engines/nancy/font.cpp
index b8e4da1fda7..4737185ac4b 100644
--- a/engines/nancy/font.cpp
+++ b/engines/nancy/font.cpp
@@ -104,7 +104,7 @@ void Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 col
 		for (uint curX = 0; curX < width; ++curX) {
 			switch (g_nancy->_graphicsManager->getInputPixelFormat().bytesPerPixel) {
 			case 1: {
-				byte colorID = *(const byte *)_image.getBasePtr(srcRect.left + curX, srcRect.top +  curY);
+				byte colorID = *(const byte *)_image.getBasePtr(srcRect.left + curX, srcRect.top + curY);
 
 				if (colorID != _transColor) {
 					uint8 palette[1 * 3];
@@ -115,7 +115,7 @@ void Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 col
 				break;
 			}
 			case 2: {
-				uint16 curColor = *(const uint16 *)_image.getBasePtr(srcRect.left + curX, srcRect.top +  curY);
+				uint16 curColor = *(const uint16 *)_image.getBasePtr(srcRect.left + curX, srcRect.top + curY);
 
 				if (curColor != _transColor) {
 					uint8 r, g, b;
diff --git a/engines/nancy/font.h b/engines/nancy/font.h
index 219fa730638..49a8e24c62e 100644
--- a/engines/nancy/font.h
+++ b/engines/nancy/font.h
@@ -54,33 +54,30 @@ public:
 private:
 	Common::Rect getCharacterSourceRect(char chr) const;
 
-	Common::String _description; // 0xA
-	Common::Point _colorCoordsOffset; // 0x32
-
-	uint16 _spaceWidth;              // 0x38
-
-	uint16 _uppercaseOffset;         // 0x3C
-	uint16 _lowercaseOffset;         // 0x3E
-	uint16 _digitOffset;             // 0x40
-	uint16 _periodOffset;            // 0x42
-	uint16 _commaOffset;             // 0x44
-	uint16 _equalitySignOffset;      // 0x46
-	uint16 _colonOffset;             // 0x48
-	uint16 _dashOffset;              // 0x4A
-	uint16 _questionMarkOffset;      // 0x4C
-	uint16 _exclamationMarkOffset;   // 0x4E
-	uint16 _percentOffset;           // 0x50
-	uint16 _ampersandOffset;         // 0x52
-	uint16 _asteriskOffset;          // 0x54
-	uint16 _leftBracketOffset;       // 0x56
-	uint16 _rightBracketOffset;      // 0x58
-	uint16 _plusOffset;              // 0x5A
-	uint16 _apostropheOffset;        // 0x5C
-	uint16 _semicolonOffset;         // 0x5E
-	uint16 _slashOffset;             // 0x60
-
-	Common::Array<Common::Rect> _symbolRects; // 0x62
-
+	Common::String _description;				// 0xA
+	Common::Point _colorCoordsOffset;			// 0x32
+	uint16 _spaceWidth;							// 0x38
+	uint16 _uppercaseOffset;					// 0x3C
+	uint16 _lowercaseOffset;					// 0x3E
+	uint16 _digitOffset;						// 0x40
+	uint16 _periodOffset;						// 0x42
+	uint16 _commaOffset;						// 0x44
+	uint16 _equalitySignOffset;					// 0x46
+	uint16 _colonOffset;						// 0x48
+	uint16 _dashOffset;							// 0x4A
+	uint16 _questionMarkOffset;					// 0x4C
+	uint16 _exclamationMarkOffset;				// 0x4E
+	uint16 _percentOffset;						// 0x50
+	uint16 _ampersandOffset;					// 0x52
+	uint16 _asteriskOffset;						// 0x54
+	uint16 _leftBracketOffset;					// 0x56
+	uint16 _rightBracketOffset;					// 0x58
+	uint16 _plusOffset;							// 0x5A
+	uint16 _apostropheOffset;					// 0x5C
+	uint16 _semicolonOffset;					// 0x5E
+	uint16 _slashOffset;						// 0x60
+	Common::Array<Common::Rect> _symbolRects;	// 0x62
+	
 	Graphics::ManagedSurface _image;
 
 	int _fontHeight;
diff --git a/engines/nancy/graphics.cpp b/engines/nancy/graphics.cpp
index 7b6480b10ea..0344a7171f4 100644
--- a/engines/nancy/graphics.cpp
+++ b/engines/nancy/graphics.cpp
@@ -75,7 +75,7 @@ void GraphicsManager::draw() {
 				dirtyRects.push_back(current.getPreviousScreenPosition());
 			}
 		}
-		
+
 		current._needsRedraw = false;
 		current._previousScreenPosition = current._screenPosition;
 	}
diff --git a/engines/nancy/iff.h b/engines/nancy/iff.h
index fdf11dc099a..1956cbe3407 100644
--- a/engines/nancy/iff.h
+++ b/engines/nancy/iff.h
@@ -33,8 +33,8 @@ namespace Nancy {
 
 class NancyEngine;
 
-#define ID_DATA     MKTAG('D', 'A', 'T', 'A')
-#define ID_PCAL     MKTAG('P', 'C', 'A', 'L')
+#define ID_DATA		MKTAG('D', 'A', 'T', 'A')
+#define ID_PCAL		MKTAG('P', 'C', 'A', 'L')
 
 class IFF {
 public:
diff --git a/engines/nancy/input.h b/engines/nancy/input.h
index 9f73126ef5c..3c08fd0e0a1 100644
--- a/engines/nancy/input.h
+++ b/engines/nancy/input.h
@@ -38,20 +38,20 @@ class State;
 
 struct NancyInput {
 	enum InputType : uint16 {
-		kLeftMouseButtonDown    = 1 << 0,
-		kLeftMouseButtonHeld    = 1 << 1,
-		kLeftMouseButtonUp      = 1 << 2,
-		kRightMouseButtonDown   = 1 << 3,
-		kRightMouseButtonHeld   = 1 << 4,
-		kRightMouseButtonUp     = 1 << 5,
-		kMoveUp                 = 1 << 6,
-		kMoveDown               = 1 << 7,
-		kMoveLeft               = 1 << 8,
-		kMoveRight              = 1 << 9,
-		kMoveFastModifier       = 1 << 10,
-
-		kLeftMouseButton        = kLeftMouseButtonDown | kLeftMouseButtonHeld | kLeftMouseButtonUp,
-		kRightMouseButton       = kRightMouseButtonDown | kRightMouseButtonHeld | kRightMouseButtonUp
+		kLeftMouseButtonDown	= 1 << 0,
+		kLeftMouseButtonHeld	= 1 << 1,
+		kLeftMouseButtonUp		= 1 << 2,
+		kRightMouseButtonDown	= 1 << 3,
+		kRightMouseButtonHeld	= 1 << 4,
+		kRightMouseButtonUp		= 1 << 5,
+		kMoveUp					= 1 << 6,
+		kMoveDown				= 1 << 7,
+		kMoveLeft				= 1 << 8,
+		kMoveRight				= 1 << 9,
+		kMoveFastModifier		= 1 << 10,
+
+		kLeftMouseButton		= kLeftMouseButtonDown | kLeftMouseButtonHeld | kLeftMouseButtonUp,
+		kRightMouseButton		= kRightMouseButtonDown | kRightMouseButtonHeld | kRightMouseButtonUp
 	};
 
 	Common::Point mousePos;
diff --git a/engines/nancy/nancy.cpp b/engines/nancy/nancy.cpp
index a5725cb4647..18a3604f326 100644
--- a/engines/nancy/nancy.cpp
+++ b/engines/nancy/nancy.cpp
@@ -110,7 +110,7 @@ Common::Error NancyEngine::saveGameStream(Common::WriteStream *stream, bool isAu
 	return synchronize(ser);
 }
 
-bool NancyEngine::canLoadGameStateCurrently()  {
+bool NancyEngine::canLoadGameStateCurrently() {
 	return canSaveGameStateCurrently();
 }
 
@@ -497,7 +497,7 @@ void NancyEngine::readDatFile() {
 
 	byte major = datFile->readByte();
 	byte minor = datFile->readByte();
-	if (major != _datFileMajorVersion || minor != _datFileMinorVersion) {	
+	if (major != _datFileMajorVersion || minor != _datFileMinorVersion) {
 		error("Incorrect nancy.dat version. Expected '%d.%d', found %d.%d",
 			_datFileMajorVersion, _datFileMinorVersion, major, minor);
 	}
diff --git a/engines/nancy/nancy.h b/engines/nancy/nancy.h
index 98c60321c1f..f2c869f4def 100644
--- a/engines/nancy/nancy.h
+++ b/engines/nancy/nancy.h
@@ -46,9 +46,9 @@ class Serializer;
  * every other game is untested but definitely unplayable
  *
  * Games using this engine:
- *  - The Vampire Diaries (1996)
- *  - Almost every mainline Nancy Drew game by HeR Interactive,
- * 	up to and including Nancy Drew: Sea of Darkness (2015)
+ *	- The Vampire Diaries (1996)
+ *	- Almost every mainline Nancy Drew game by HeR Interactive,
+ *		up to and including Nancy Drew: Sea of Darkness (2015)
  */
 namespace Nancy {
 
@@ -113,7 +113,7 @@ public:
 
 	// BSUM data
 	SceneChangeDescription _firstScene;
-	
+
 	uint16 _startTimeHours;
 	uint16 _startTimeMinutes;
 
diff --git a/engines/nancy/renderobject.h b/engines/nancy/renderobject.h
index 942e97a24a3..423a7971170 100644
--- a/engines/nancy/renderobject.h
+++ b/engines/nancy/renderobject.h
@@ -74,7 +74,7 @@ protected:
 
 	// Needed for proper handling of objects inside the viewport
 	virtual bool isViewportRelative() const { return false; }
-	
+
 	bool _needsRedraw;
 	bool _isVisible;
 	uint16 _z;
diff --git a/engines/nancy/resource.cpp b/engines/nancy/resource.cpp
index 31a006c9a7f..32c60e3e101 100644
--- a/engines/nancy/resource.cpp
+++ b/engines/nancy/resource.cpp
@@ -749,7 +749,7 @@ bool ResourceManager::loadImage(const Common::String &name, Graphics::Surface &s
 
 	byte *buf = getCifData(name, info);
 
-	if (!buf)  {
+	if (!buf) {
 		// Couldn't find image in a cif tree, try to open a .bmp file
 		// This is used by The Vampire Diaries
 		Common::File f;
@@ -793,7 +793,7 @@ bool ResourceManager::loadImage(const Common::String &name, Graphics::ManagedSur
 
 	byte *buf = getCifData(name, info);
 
-	if (!buf)  {
+	if (!buf) {
 		// Couldn't find image in a cif tree, try to open a .bmp file
 		// This is used by The Vampire Diaries
 		Common::File f;
diff --git a/engines/nancy/sound.cpp b/engines/nancy/sound.cpp
index 62b272148f7..3b2e3d8c752 100644
--- a/engines/nancy/sound.cpp
+++ b/engines/nancy/sound.cpp
@@ -429,7 +429,7 @@ void SoundManager::calculatePan(uint16 channelID) {
 			uint16 q1 = sceneSummary.numberOfVideoFrames / 4;
 			uint16 q2 = sceneSummary.numberOfVideoFrames / 2;
 			uint16 q3 = sceneSummary.numberOfVideoFrames * 3 / 4;
-			
+
 			float balance;
 
 			if (adjustedViewportFrame < q1) {
@@ -448,7 +448,7 @@ void SoundManager::calculatePan(uint16 channelID) {
 				balance *= 32767;
 				balance = 65535 - balance;
 			}
-			
+
 			// The original engine's algorithm is broken and results in flipped
 			// stereo; the following line fixes this bug
 			balance = 65535 - balance;
diff --git a/engines/nancy/sound.h b/engines/nancy/sound.h
index 3149a1e1d8f..9f9f3f9eca2 100644
--- a/engines/nancy/sound.h
+++ b/engines/nancy/sound.h
@@ -64,7 +64,7 @@ public:
 	void stopSound(const SoundDescription &description);
 	void stopSound(const Common::String &chunkName);
 	void stopAllSounds();
-	
+
 	void calculatePan(uint16 channelID);
 	void calculatePan(const SoundDescription &description);
 	void calculatePanForAllSounds();
diff --git a/engines/nancy/state/map.cpp b/engines/nancy/state/map.cpp
index ed80d2761ea..1ec44180e40 100644
--- a/engines/nancy/state/map.cpp
+++ b/engines/nancy/state/map.cpp
@@ -79,7 +79,7 @@ void Map::init() {
 	readRect(*chunk, closedLabelSrc);
 
 	_closedLabel._drawSurface.create(g_nancy->_graphicsManager->_object0, closedLabelSrc);
-	
+
 	Common::Rect newScreenRect;
 
 	newScreenRect.left = textboxScreenPosition.left + ((textboxScreenPosition.width() - closedLabelSrc.width()) / 2);
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index 21864cf6016..8c5621d0fef 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -610,7 +610,7 @@ void Scene::run() {
 	// Update the UI elements and handle input
 	NancyInput input = g_nancy->_input->getInput();
 	_viewport.handleInput(input);
-	
+
 	_sceneState.currentScene.verticalOffset = _viewport.getCurVerticalScroll();
 
 	if (_sceneState.currentScene.frameID != _viewport.getCurFrame()) {
@@ -689,7 +689,7 @@ void Scene::initStaticData() {
 	if (g_nancy->getGameType() == kGameTypeVampire) {
 		_viewportOrnaments = new UI::ViewportOrnaments(9);
 		_viewportOrnaments->init();
-		 
+
 		_textboxOrnaments = new UI::TextboxOrnaments(9);
 		_textboxOrnaments->init();
 	}
diff --git a/engines/nancy/time.h b/engines/nancy/time.h
index ff6a7dda261..bfd131e465a 100644
--- a/engines/nancy/time.h
+++ b/engines/nancy/time.h
@@ -34,45 +34,45 @@ public:
 	Time(const Time &t) = default;
 	~Time() = default;
 	explicit operator uint32() const { return _milliseconds; }
-	Time &operator=(const Time &t)                          { if (this != &t) _milliseconds = t._milliseconds; return *this; }
-	Time &operator=(const uint32 &t)                        { _milliseconds = t; return *this; }
-	Time &operator+=(const Time &t)                         { _milliseconds += t._milliseconds; return *this; }
-	Time &operator+=(const uint32 &t)                       { _milliseconds+=t; return *this; }
-	Time &operator-=(const Time &t)                         { _milliseconds -= t._milliseconds; return *this; }
-	Time &operator-=(const uint32 &t)                       { _milliseconds-=t; return *this; }
+	Time &operator=(const Time &t)							{ if (this != &t) _milliseconds = t._milliseconds; return *this; }
+	Time &operator=(const uint32 &t)						{ _milliseconds = t; return *this; }
+	Time &operator+=(const Time &t)						 	{ _milliseconds += t._milliseconds; return *this; }
+	Time &operator+=(const uint32 &t)						{ _milliseconds+=t; return *this; }
+	Time &operator-=(const Time &t)							{ _milliseconds -= t._milliseconds; return *this; }
+	Time &operator-=(const uint32 &t)						{ _milliseconds-=t; return *this; }
 
-	friend Time operator+(Time l, const Time &r)            { l += r; return l; }
-	friend Time operator+(Time l, const uint32 &r)          { l += r; return l; }
-	friend Time operator+(const uint32 &l, Time r)          { r += l; return r; }
-	friend Time operator-(Time l, const Time &r)            { l -= r; return l; }
-	friend Time operator-(Time l, const uint32 &r)          { l -= r; return l; }
-	friend Time operator-(const uint32 &l, Time r)          { r -= l; return r; }
+	friend Time operator+(Time l, const Time &r)			{ l += r; return l; }
+	friend Time operator+(Time l, const uint32 &r)			{ l += r; return l; }
+	friend Time operator+(const uint32 &l, Time r)			{ r += l; return r; }
+	friend Time operator-(Time l, const Time &r)			{ l -= r; return l; }
+	friend Time operator-(Time l, const uint32 &r)			{ l -= r; return l; }
+	friend Time operator-(const uint32 &l, Time r)			{ r -= l; return r; }
 
-	friend bool operator== (const Time &l, const Time &r)   { return l._milliseconds == r._milliseconds; }
-	friend bool operator== (const Time &l, const uint32 &r) { return l._milliseconds == r; }
-	friend bool operator== (const uint32 &l, const Time &r) { return l == r._milliseconds; }
-	friend bool operator!= (const Time &l, const Time &r)   { return l._milliseconds != r._milliseconds; }
-	friend bool operator!= (const Time &l, const uint32 &r) { return l._milliseconds != r; }
-	friend bool operator!= (const uint32 &l, const Time &r) { return l != r._milliseconds; }
-	friend bool operator< (const Time &l, const Time &r)    { return l._milliseconds < r._milliseconds; }
-	friend bool operator< (const Time &l, const uint32 &r)  { return l._milliseconds < r; }
-	friend bool operator< (const uint32 &l, const Time &r)  { return l < r._milliseconds; }
-	friend bool operator> (const Time &l, const Time &r)    { return r < l; }
-	friend bool operator> (const Time &l, const uint32 &r)  { return r < l; }
-	friend bool operator> (const uint32 &l, const Time &r)  { return r < l; }
-	friend bool operator<= (const Time &l, const Time &r)   { return !(l > r); }
-	friend bool operator<= (const Time &l, const uint32 &r) { return !(l > r); }
-	friend bool operator<= (const uint32 &l, const Time &r) { return !(l > r); }
-	friend bool operator>= (const Time &l, const Time &r)   { return !(l < r); }
-	friend bool operator>= (const Time &l, const uint32 &r) { return !(l < r); }
-	friend bool operator>= (const uint32 &l, const Time &r) { return !(l < r); }
+	friend bool operator== (const Time &l, const Time &r)	{ return l._milliseconds == r._milliseconds; }
+	friend bool operator== (const Time &l, const uint32 &r)	{ return l._milliseconds == r; }
+	friend bool operator== (const uint32 &l, const Time &r)	{ return l == r._milliseconds; }
+	friend bool operator!= (const Time &l, const Time &r)	{ return l._milliseconds != r._milliseconds; }
+	friend bool operator!= (const Time &l, const uint32 &r)	{ return l._milliseconds != r; }
+	friend bool operator!= (const uint32 &l, const Time &r)	{ return l != r._milliseconds; }
+	friend bool operator< (const Time &l, const Time &r)	{ return l._milliseconds < r._milliseconds; }
+	friend bool operator< (const Time &l, const uint32 &r)	{ return l._milliseconds < r; }
+	friend bool operator< (const uint32 &l, const Time &r)	{ return l < r._milliseconds; }
+	friend bool operator> (const Time &l, const Time &r)	{ return r < l; }
+	friend bool operator> (const Time &l, const uint32 &r)	{ return r < l; }
+	friend bool operator> (const uint32 &l, const Time &r)	{ return r < l; }
+	friend bool operator<= (const Time &l, const Time &r)	{ return !(l > r); }
+	friend bool operator<= (const Time &l, const uint32 &r)	{ return !(l > r); }
+	friend bool operator<= (const uint32 &l, const Time &r)	{ return !(l > r); }
+	friend bool operator>= (const Time &l, const Time &r)	{ return !(l < r); }
+	friend bool operator>= (const Time &l, const uint32 &r)	{ return !(l < r); }
+	friend bool operator>= (const uint32 &l, const Time &r)	{ return !(l < r); }
 
-	uint16 getSeconds()         { return (_milliseconds / 1000) % 60; }
-	uint16 getMinutes()         { return (_milliseconds / 60000) % 60; }
-	uint16 getTotalHours()      { return _milliseconds / 3600000; }
+	uint16 getSeconds()			{ return (_milliseconds / 1000) % 60; }
+	uint16 getMinutes()			{ return (_milliseconds / 60000) % 60; }
+	uint16 getTotalHours()		{ return _milliseconds / 3600000; }
 
-	uint16 getHours()           { return (_milliseconds / 3600000) % 24; } // Used for player time
-	uint16 getDays()            { return _milliseconds / 86400000; } // up to 49.7 days
+	uint16 getHours()			{ return (_milliseconds / 3600000) % 24; }	// Used for player time
+	uint16 getDays()			{ return _milliseconds / 86400000; }		// up to 49.7 days
 
 private:
 	uint32 _milliseconds;
diff --git a/engines/nancy/ui/inventorybox.cpp b/engines/nancy/ui/inventorybox.cpp
index ba54bff79f4..aeeaa741b70 100644
--- a/engines/nancy/ui/inventorybox.cpp
+++ b/engines/nancy/ui/inventorybox.cpp
@@ -203,7 +203,7 @@ void InventoryBox::onReorder() {
 void InventoryBox::setHotspots(uint pageNr) {
 	for (uint i = 0; i < 4; ++i) {
 		if (i + pageNr * 4 < _order.size()) {
-			_itemHotspots[i].itemID = _order[i +  pageNr * 4];
+			_itemHotspots[i].itemID = _order[i + pageNr * 4];
 		} else {
 			_itemHotspots[i].itemID = -1;
 		}
diff --git a/engines/nancy/ui/ornaments.cpp b/engines/nancy/ui/ornaments.cpp
index dc2738c5f66..7c8b51a8419 100644
--- a/engines/nancy/ui/ornaments.cpp
+++ b/engines/nancy/ui/ornaments.cpp
@@ -29,84 +29,84 @@ namespace Nancy {
 namespace UI {
 
 void ViewportOrnaments::init() {
-    Common::Rect viewportBounds;
-    Common::SeekableReadStream *viewChunk = g_nancy->getBootChunkStream("VIEW");
+	Common::Rect viewportBounds;
+	Common::SeekableReadStream *viewChunk = g_nancy->getBootChunkStream("VIEW");
 	viewChunk->seek(0);
-    readRect(*viewChunk, _screenPosition);
-    readRect(*viewChunk, viewportBounds);
-
-    Graphics::ManagedSurface &object0 = g_nancy->_graphicsManager->_object0;
-
-    _drawSurface.create(viewportBounds.width(), viewportBounds.height(), g_nancy->_graphicsManager->getInputPixelFormat());
-
-    uint8 palette[256 * 3];
-    object0.grabPalette(palette, 0, 256);
-    _drawSurface.setPalette(palette, 0, 256);
-
-    // All values for the viewport ornaments are hardcoded and not stored in a chunk
-    Common::Rect src[6] = {
-        { 0, 0, 31, 110 },
-        { 49, 0, 81, 110 },
-        { 33, 24, 45, 37 },
-        { 33, 69, 46, 82 },
-        { 33, 0, 43, 22 },
-        { 33, 39, 40, 59 }
-    };
-
-    _drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
-    setTransparent(true);
-
-    // Top left
-    _drawSurface.blitFrom(object0, src[0], Common::Point(0, 0));
-    // Top right
-    _drawSurface.blitFrom(object0, src[1], Common::Point(viewportBounds.right - src[1].width(), 0));
-    // Bottom left
-    _drawSurface.blitFrom(object0, src[2], Common::Point(0, viewportBounds.bottom - src[2].height()));
-    // Bottom right
-    _drawSurface.blitFrom(object0, src[3], Common::Point(viewportBounds.right - src[3].width(), viewportBounds.bottom - src[3].height()));
-    // Middle left
-    _drawSurface.blitFrom(object0, src[4], Common::Point(0, 204));
-    // Middle right
-    _drawSurface.blitFrom(object0, src[5], Common::Point(viewportBounds.right - src[5].width(), 205));
+	readRect(*viewChunk, _screenPosition);
+	readRect(*viewChunk, viewportBounds);
+
+	Graphics::ManagedSurface &object0 = g_nancy->_graphicsManager->_object0;
+
+	_drawSurface.create(viewportBounds.width(), viewportBounds.height(), g_nancy->_graphicsManager->getInputPixelFormat());
+
+	uint8 palette[256 * 3];
+	object0.grabPalette(palette, 0, 256);
+	_drawSurface.setPalette(palette, 0, 256);
+
+	// All values for the viewport ornaments are hardcoded and not stored in a chunk
+	Common::Rect src[6] = {
+		{ 0, 0, 31, 110 },
+		{ 49, 0, 81, 110 },
+		{ 33, 24, 45, 37 },
+		{ 33, 69, 46, 82 },
+		{ 33, 0, 43, 22 },
+		{ 33, 39, 40, 59 }
+	};
+
+	_drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
+	setTransparent(true);
+
+	// Top left
+	_drawSurface.blitFrom(object0, src[0], Common::Point(0, 0));
+	// Top right
+	_drawSurface.blitFrom(object0, src[1], Common::Point(viewportBounds.right - src[1].width(), 0));
+	// Bottom left
+	_drawSurface.blitFrom(object0, src[2], Common::Point(0, viewportBounds.bottom - src[2].height()));
+	// Bottom right
+	_drawSurface.blitFrom(object0, src[3], Common::Point(viewportBounds.right - src[3].width(), viewportBounds.bottom - src[3].height()));
+	// Middle left
+	_drawSurface.blitFrom(object0, src[4], Common::Point(0, 204));
+	// Middle right
+	_drawSurface.blitFrom(object0, src[5], Common::Point(viewportBounds.right - src[5].width(), 205));
 
 
 	RenderObject::init();
 }
 
 void TextboxOrnaments::init() {
-    _screenPosition = g_nancy->_textboxScreenPosition;
-    Common::Rect textboxBounds = _screenPosition;
-    textboxBounds.moveTo(0, 0);
+	_screenPosition = g_nancy->_textboxScreenPosition;
+	Common::Rect textboxBounds = _screenPosition;
+	textboxBounds.moveTo(0, 0);
 
-    Graphics::ManagedSurface &object0 = g_nancy->_graphicsManager->_object0;
+	Graphics::ManagedSurface &object0 = g_nancy->_graphicsManager->_object0;
 
-    _drawSurface.create(textboxBounds.width(), textboxBounds.height(), g_nancy->_graphicsManager->getInputPixelFormat());
+	_drawSurface.create(textboxBounds.width(), textboxBounds.height(), g_nancy->_graphicsManager->getInputPixelFormat());
 
-    uint8 palette[256 * 3];
-    object0.grabPalette(palette, 0, 256);
-    _drawSurface.setPalette(palette, 0, 256);
+	uint8 palette[256 * 3];
+	object0.grabPalette(palette, 0, 256);
+	_drawSurface.setPalette(palette, 0, 256);
 
-    _drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
-    setTransparent(true);
+	_drawSurface.clear(g_nancy->_graphicsManager->getTransColor());
+	setTransparent(true);
 
-    // Values for textbox ornaments are stored in the TBOX chunk
-    Common::Rect src[14];
-    Common::Rect dest[14];
+	// Values for textbox ornaments are stored in the TBOX chunk
+	Common::Rect src[14];
+	Common::Rect dest[14];
 
-    Common::SeekableReadStream *tboxChunk = g_nancy->getBootChunkStream("TBOX");
+	Common::SeekableReadStream *tboxChunk = g_nancy->getBootChunkStream("TBOX");
 	tboxChunk->seek(0x3E);
 
-    for (uint i = 0; i < 14; ++i) {
-        readRect(*tboxChunk, src[i]);
-    }
+	for (uint i = 0; i < 14; ++i) {
+		readRect(*tboxChunk, src[i]);
+	}
 
-    for (uint i = 0; i < 14; ++i) {
-        readRect(*tboxChunk, dest[i]);
-    }
+	for (uint i = 0; i < 14; ++i) {
+		readRect(*tboxChunk, dest[i]);
+	}
 
-    for (uint i = 0; i < 14; ++i) {
-        _drawSurface.blitFrom(object0, src[i], Common::Point(dest[i].left - _screenPosition.left, dest[i].top - _screenPosition.top));
-    }
+	for (uint i = 0; i < 14; ++i) {
+		_drawSurface.blitFrom(object0, src[i], Common::Point(dest[i].left - _screenPosition.left, dest[i].top - _screenPosition.top));
+	}
 
 	RenderObject::init();
 }
diff --git a/engines/nancy/ui/ornaments.h b/engines/nancy/ui/ornaments.h
index 97351070b35..225193dbf18 100644
--- a/engines/nancy/ui/ornaments.h
+++ b/engines/nancy/ui/ornaments.h
@@ -29,18 +29,18 @@ namespace UI {
 
 class ViewportOrnaments : public Nancy::RenderObject {
 public:
-    ViewportOrnaments(uint16 zOrder) : RenderObject(zOrder) {}
-    virtual ~ViewportOrnaments() {}    
+	ViewportOrnaments(uint16 zOrder) : RenderObject(zOrder) {}
+	virtual ~ViewportOrnaments() {}
 
-    void init() override;
+	void init() override;
 };
 
 class TextboxOrnaments : public Nancy::RenderObject {
 public:
-    TextboxOrnaments(uint16 zOrder) : RenderObject(zOrder) {}
-    virtual ~TextboxOrnaments() {}    
+	TextboxOrnaments(uint16 zOrder) : RenderObject(zOrder) {}
+	virtual ~TextboxOrnaments() {}
 
-    void init() override;
+	void init() override;
 };
 
 } // End of namespace Nancy




More information about the Scummvm-git-logs mailing list