[Scummvm-git-logs] scummvm master -> 87b375f4f12a06d1a84666e6b00864f3593a2346
fracturehill
noreply at scummvm.org
Sun Mar 5 14:31:53 UTC 2023
This automated email contains information about 14 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
383237f7d7 NANCY: Correctly read long scene change format
e696861714 NANCY: Implement ordering puzzle in The Vampire Diaries
d6a48e7d16 NANCY: Preload The Vampire Diaries-specific persistent sounds
86b1c92436 NANCY: List The Vampire Diaries files in ResourceManager::list()
4f744f44b8 NANCY: Print cif_list debug command in columns
791cfd5c82 NANCY: Fix memory leak
fa2c22ddf1 NANCY: Add console command to scan for ActionRecords
8dda3583dc NANCY: Fix secondary movie in nancy1
0de0026d9c NANCY: Don't look for FORM chunks in Nancy games
49dd99a7b1 NANCY: Modify scan_ar_type to only look inside scenes
889cee6ab0 NANCY: Remove stubs for unused action records
80260711eb NANCY: Fix memory leak
7de76175a3 NANCY: Destroy all singletons when exiting game
87b375f4f1 NANCY: Retire NancyFlag
Commit: 383237f7d78deb325ed51b814b404ad032eea0db
https://github.com/scummvm/scummvm/commit/383237f7d78deb325ed51b814b404ad032eea0db
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:22+02:00
Commit Message:
NANCY: Correctly read long scene change format
Some SceneChangeDescriptions in The Vampire Diaries use a longer
format with two extra properties, which is now read correctly.
Changed paths:
engines/nancy/action/primaryvideo.cpp
engines/nancy/action/recordtypes.cpp
engines/nancy/action/secondarymovie.cpp
engines/nancy/commontypes.cpp
engines/nancy/commontypes.h
diff --git a/engines/nancy/action/primaryvideo.cpp b/engines/nancy/action/primaryvideo.cpp
index c5756a86199..c88d3a1853b 100644
--- a/engines/nancy/action/primaryvideo.cpp
+++ b/engines/nancy/action/primaryvideo.cpp
@@ -205,8 +205,7 @@ void PlayPrimaryVideoChan0::readData(Common::SeekableReadStream &stream) {
UI::Textbox::assembleTextLine(rawText, response.text, 400);
readFilename(stream, response.soundName);
ser.skip(1);
- response.sceneChange.readData(stream);
- ser.skip(3, kGameTypeVampire, kGameTypeVampire);
+ response.sceneChange.readData(stream, ser.getVersion() == kGameTypeVampire);
ser.syncAsSint16LE(response.flagDesc.label);
ser.syncAsByte(response.flagDesc.flag);
ser.skip(0x32);
diff --git a/engines/nancy/action/recordtypes.cpp b/engines/nancy/action/recordtypes.cpp
index 31469eb5730..746ccf44918 100644
--- a/engines/nancy/action/recordtypes.cpp
+++ b/engines/nancy/action/recordtypes.cpp
@@ -579,12 +579,7 @@ void ShowInventoryItem::onPause(bool pause) {
void PlayDigiSoundAndDie::readData(Common::SeekableReadStream &stream) {
_sound.read(stream, SoundDescription::kDIGI);
- _sceneChange.readData(stream);
-
- if (g_nancy->getGameType() == kGameTypeVampire) {
- stream.skip(1);
- _sceneChange.doNotStartSound = stream.readUint16LE();
- }
+ _sceneChange.readData(stream, g_nancy->getGameType() == kGameTypeVampire);
_flagOnTrigger.label = stream.readSint16LE();
_flagOnTrigger.flag = (NancyFlag)stream.readByte();
diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index 9abe56e2800..9b01301de69 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -73,8 +73,7 @@ void PlaySecondaryMovie::readData(Common::SeekableReadStream &stream) {
_triggerFlags.readData(stream);
_sound.read(stream, SoundDescription::kNormal);
- _sceneChange.readData(stream);
- ser.skip(3, kGameTypeVampire, kGameTypeVampire); // unknown 3 sceneChange bytes
+ _sceneChange.readData(stream, ser.getVersion() == kGameTypeVampire);
uint16 numVideoDescs;
ser.syncAsUint16LE(numVideoDescs);
diff --git a/engines/nancy/commontypes.cpp b/engines/nancy/commontypes.cpp
index f7d490ca348..84daca3331c 100644
--- a/engines/nancy/commontypes.cpp
+++ b/engines/nancy/commontypes.cpp
@@ -26,10 +26,13 @@
namespace Nancy {
-void SceneChangeDescription::readData(Common::SeekableReadStream &stream) {
+void SceneChangeDescription::readData(Common::SeekableReadStream &stream, bool longFormat) {
sceneID = stream.readUint16LE();
frameID = stream.readUint16LE();
verticalOffset = stream.readUint16LE();
+ if (longFormat) {
+ stream.skip(3);
+ }
doNotStartSound = (bool)(stream.readUint16LE());
}
diff --git a/engines/nancy/commontypes.h b/engines/nancy/commontypes.h
index 486271f1e69..f972618b062 100644
--- a/engines/nancy/commontypes.h
+++ b/engines/nancy/commontypes.h
@@ -68,7 +68,7 @@ struct SceneChangeDescription {
uint16 verticalOffset = 0;
bool doNotStartSound = false;
- void readData(Common::SeekableReadStream &stream);
+ void readData(Common::SeekableReadStream &stream, bool longFormat = false);
};
// Describes a single event flag change or comparison
Commit: e6968617143f452394b1a14b574b2204af033e77
https://github.com/scummvm/scummvm/commit/e6968617143f452394b1a14b574b2204af033e77
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:22+02:00
Commit Message:
NANCY: Implement ordering puzzle in The Vampire Diaries
Made changes to the OrderingPuzzle action record to correctly
load and play the format found in The Vampire Diaries.
Changed paths:
engines/nancy/action/orderingpuzzle.cpp
diff --git a/engines/nancy/action/orderingpuzzle.cpp b/engines/nancy/action/orderingpuzzle.cpp
index 82a144b2891..132d82dfbf3 100644
--- a/engines/nancy/action/orderingpuzzle.cpp
+++ b/engines/nancy/action/orderingpuzzle.cpp
@@ -19,6 +19,8 @@
*
*/
+#include "common/serializer.h"
+
#include "engines/nancy/nancy.h"
#include "engines/nancy/graphics.h"
#include "engines/nancy/resource.h"
@@ -35,63 +37,80 @@ namespace Action {
void OrderingPuzzle::init() {
// Screen position is initialized in readData and fits exactly the bounds of all elements on screen.
- // This is a hacky way to make this particular action record work with this implementation's graphics manager
+ g_nancy->_resource->loadImage(_imageName, _image);
_drawSurface.create(_screenPosition.width(), _screenPosition.height(), g_nancy->_graphicsManager->getInputPixelFormat());
- clearAllElements();
- setTransparent(true);
-
- g_nancy->_resource->loadImage(_imageName, _image);
+ if (_image.hasPalette()) {
+ uint8 palette[256 * 3];
+ _image.grabPalette(palette, 0, 256);
+ _drawSurface.setPalette(palette, 0, 256);
+ }
+ setTransparent(true);
setVisible(false);
+ clearAllElements();
RenderObject::init();
}
void OrderingPuzzle::readData(Common::SeekableReadStream &stream) {
readFilename(stream, _imageName);
- uint16 numElements = stream.readUint16LE();
+ Common::Serializer ser(&stream, nullptr);
+ ser.setVersion(g_nancy->getGameType());
+
+ uint16 numElements;
+ if (ser.getVersion() == kGameTypeVampire) {
+ // Hardcoded in The Vampire Diaries
+ numElements = 5;
+ } else {
+ ser.syncAsUint16LE(numElements);
+ }
- _srcRects.reserve(numElements);
+ _srcRects.resize(numElements);
for (uint i = 0; i < numElements; ++i) {
- _srcRects.push_back(Common::Rect());
- readRect(stream, _srcRects.back());
+ readRect(stream, _srcRects[i]);
}
- stream.skip(16 * (15 - numElements));
+ ser.skip(16 * (15 - numElements), kGameTypeNancy1);
- _destRects.reserve(numElements);
- _drawnElements.reserve(numElements);
+ _destRects.resize(numElements);
+ _drawnElements.resize(numElements, false);
for (uint i = 0; i < numElements; ++i) {
- _destRects.push_back(Common::Rect());
- readRect(stream, _destRects.back());
+ readRect(stream, _destRects[i]);
if (i == 0) {
_screenPosition = _destRects[i];
} else {
_screenPosition.extend(_destRects[i]);
}
+ }
+
+ ser.skip(16 * (15 - numElements), kGameTypeNancy1);
- _drawnElements.push_back(false);
+ if (ser.getVersion() == kGameTypeVampire) {
+ _sequenceLength = 5;
+ } else {
+ ser.syncAsUint16LE(_sequenceLength);
}
- stream.skip(16 * (15 - numElements));
+ _correctSequence.resize(_sequenceLength);
+ for (uint i = 0; i < _sequenceLength; ++i) {
+ ser.syncAsByte(_correctSequence[i]);
+ }
- _sequenceLength = stream.readUint16LE();
+ ser.skip(15 - _sequenceLength, kGameTypeNancy1);
- _correctSequence.reserve(15);
- for (uint i = 0; i < 15; ++i) {
- _correctSequence.push_back(stream.readByte());
+ if (ser.getVersion() != kGameTypeVampire) {
+ _clickSound.read(stream, SoundDescription::kNormal);
}
- _clickSound.read(stream, SoundDescription::kNormal);
- _solveExitScene.readData(stream);
- stream.skip(2); // shouldStopRendering, useless
- _flagOnSolve.label = stream.readSint16LE();
- _flagOnSolve.flag = (NancyFlag)stream.readByte();
- _solveSoundDelay = stream.readUint16LE();
+ _solveExitScene.readData(stream, ser.getVersion() == kGameTypeVampire);
+ ser.skip(2); // shouldStopRendering, useless
+ ser.syncAsUint16LE(_flagOnSolve.label);
+ ser.syncAsByte(_flagOnSolve.flag);
+ ser.syncAsUint16LE(_solveSoundDelay);
_solveSound.read(stream, SoundDescription::kNormal);
- _exitScene.readData(stream);
+ _exitScene.readData(stream, ser.getVersion() == kGameTypeVampire);
stream.skip(2); // shouldStopRendering, useless
_flagOnExit.label = stream.readSint16LE();
_flagOnExit.flag = (NancyFlag)stream.readByte();
@@ -103,7 +122,9 @@ void OrderingPuzzle::execute() {
case kBegin:
init();
registerGraphics();
- g_nancy->_sound->loadSound(_clickSound);
+ if (g_nancy->getGameType () != kGameTypeVampire) {
+ g_nancy->_sound->loadSound(_clickSound);
+ }
g_nancy->_sound->loadSound(_solveSound);
_state = kRun;
// fall through
@@ -116,6 +137,10 @@ void OrderingPuzzle::execute() {
for (uint i = 0; i < _sequenceLength; ++i) {
if (_clickedSequence[i] != (int16)_correctSequence[i]) {
+ if (_clickedSequence.size() > (uint)_sequenceLength + ((g_nancy->getGameType() == kGameTypeVampire) ? -1 : 1)) {
+ clearAllElements();
+ }
+
return;
}
}
@@ -141,7 +166,11 @@ void OrderingPuzzle::execute() {
}
break;
case kActionTrigger:
- g_nancy->_sound->stopSound(_clickSound);
+ if (g_nancy->getGameType() == kGameTypeVampire) {
+ g_nancy->_sound->stopSound("BUOK");
+ } else {
+ g_nancy->_sound->stopSound(_clickSound);
+ }
g_nancy->_sound->stopSound(_solveSound);
if (_solveState == kNotSolved) {
@@ -175,7 +204,11 @@ void OrderingPuzzle::handleInput(NancyInput &input) {
g_nancy->_cursorManager->setCursorType(CursorManager::kHotspot);
if (input.input & NancyInput::kLeftMouseButtonUp) {
- g_nancy->_sound->playSound(_clickSound);
+ if (g_nancy->getGameType() == kGameTypeVampire) {
+ g_nancy->_sound->playSound("BUOK");
+ } else {
+ g_nancy->_sound->playSound(_clickSound);
+ }
for (uint j = 0; j < _clickedSequence.size(); ++j) {
if (_clickedSequence[j] == i && _drawnElements[i] == true) {
@@ -189,12 +222,7 @@ void OrderingPuzzle::handleInput(NancyInput &input) {
}
_clickedSequence.push_back(i);
-
- if (_clickedSequence.size() > (uint)_sequenceLength + 1) {
- clearAllElements();
- } else {
- drawElement(i);
- }
+ drawElement(i);
}
return;
}
Commit: d6a48e7d16302dd0d8dcdba894a132a968d45f60
https://github.com/scummvm/scummvm/commit/d6a48e7d16302dd0d8dcdba894a132a968d45f60
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:22+02:00
Commit Message:
NANCY: Preload The Vampire Diaries-specific persistent sounds
Changed paths:
engines/nancy/sound.cpp
diff --git a/engines/nancy/sound.cpp b/engines/nancy/sound.cpp
index 6fa924ab87f..62b272148f7 100644
--- a/engines/nancy/sound.cpp
+++ b/engines/nancy/sound.cpp
@@ -254,12 +254,7 @@ SoundManager::SoundManager() {
void SoundManager::loadCommonSounds() {
// Persistent sounds that are used across the engine. These originally get loaded inside Logo
Common::String chunkNames[] = {
- "CANT", // channel 17
- "CURT", // channel 18
- "GLOB", // channel 20
- "BULS", // channel 22
- "BUDE", // channel 23
- "BUOK", // channel 24
+ "CANT", "CURT", "GLOB", "SLID", "BULS", "BUDE", "BUOK", "TH1", "TH2",
};
Common::SeekableReadStream *chunk = nullptr;
Commit: 86b1c924360719423624b7452f0b86a88d7c459c
https://github.com/scummvm/scummvm/commit/86b1c924360719423624b7452f0b86a88d7c459c
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:22+02:00
Commit Message:
NANCY: List The Vampire Diaries files in ResourceManager::list()
The Vampire Diaries' files are not embedded in a ciftree. This change
allows the list() function to find them.
Changed paths:
engines/nancy/resource.cpp
diff --git a/engines/nancy/resource.cpp b/engines/nancy/resource.cpp
index bd2d873a4f2..1ef22ac5059 100644
--- a/engines/nancy/resource.cpp
+++ b/engines/nancy/resource.cpp
@@ -831,10 +831,24 @@ bool ResourceManager::loadImage(const Common::String &name, Graphics::ManagedSur
void ResourceManager::list(const Common::String &treeName, Common::Array<Common::String> &nameList, uint type) const {
const CifTree *cifTree = findCifTree(treeName);
- if (!cifTree)
- return;
+ if (!cifTree) {
+ Common::ArchiveMemberList list;
+ if (type == ResourceManager::kResTypeAny || type == ResourceManager::kResTypeImage) {
+ SearchMan.listMatchingMembers(list, Common::Path("*.bmp"));
+ }
+
+ if (type == ResourceManager::kResTypeAny || type == ResourceManager::kResTypeScript) {
+ SearchMan.listMatchingMembers(list, Common::Path("*.iff"));
+ }
+
+ for (auto &i : list) {
+ nameList.push_back(i.get()->getDisplayName());
+ }
+ } else {
+ cifTree->list(nameList, type);
+ }
- cifTree->list(nameList, type);
+ Common::sort(nameList.begin(), nameList.end());
}
Common::String ResourceManager::getCifDescription(const Common::String &treeName, const Common::String &name) const {
Commit: 4f744f44b8c6b57020fdfbc2773fdb38e6c68eb2
https://github.com/scummvm/scummvm/commit/4f744f44b8c6b57020fdfbc2773fdb38e6c68eb2
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:23+02:00
Commit Message:
NANCY: Print cif_list debug command in columns
Changed paths:
engines/nancy/console.cpp
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 60e2d00df14..b29a11c9d39 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -186,13 +186,8 @@ bool NancyConsole::Cmd_cifList(int argc, const char **argv) {
Common::Array<Common::String> list;
g_nancy->_resource->list((argc == 2 ? "ciftree" : argv[2]), list, atoi(argv[1]));
- for (uint i = 0; i < list.size(); i++) {
- debugPrintf("%-38s", list[i].c_str());
- if ((i % 2) == 1 && i + 1 != list.size())
- debugPrintf("\n");
- }
- debugPrintf("\n");
+ debugPrintColumns(list);
return true;
}
Commit: 791cfd5c82c02ed20233acc875b0771b88532d67
https://github.com/scummvm/scummvm/commit/791cfd5c82c02ed20233acc875b0771b88532d67
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:23+02:00
Commit Message:
NANCY: Fix memory leak
Chunks containing action record data are now correctly deleted after
being read.
Changed paths:
engines/nancy/state/scene.cpp
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index 1083bb45eb0..051e8a3eeaa 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -528,6 +528,7 @@ void Scene::load() {
}
_actionManager.addNewActionRecord(*actionRecordChunk);
+ delete actionRecordChunk;
}
_viewport.loadVideo(_sceneState.summary.videoFile,
Commit: fa2c22ddf153749cdcd0edfa0c8511cc5b5c9fe0
https://github.com/scummvm/scummvm/commit/fa2c22ddf153749cdcd0edfa0c8511cc5b5c9fe0
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:23+02:00
Commit Message:
NANCY: Add console command to scan for ActionRecords
Added the scan_ar_type console command, which scans every
available IFF for an ActionRecord of the given type.
Changed paths:
engines/nancy/console.cpp
engines/nancy/console.h
engines/nancy/resource.cpp
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index b29a11c9d39..766eccd0b8a 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -52,6 +52,7 @@ NancyConsole::NancyConsole() : GUI::Debugger() {
registerCmd("load_scene", WRAP_METHOD(NancyConsole, Cmd_loadScene));
registerCmd("scene_id", WRAP_METHOD(NancyConsole, Cmd_sceneID));
registerCmd("list_actionrecords", WRAP_METHOD(NancyConsole, Cmd_listAcionRecords));
+ registerCmd("scan_ar_type", WRAP_METHOD(NancyConsole, Cmd_scanForActionRecordType));
registerCmd("get_eventflags", WRAP_METHOD(NancyConsole, Cmd_getEventFlags));
registerCmd("set_eventflags", WRAP_METHOD(NancyConsole, Cmd_setEventFlags));
registerCmd("get_inventory", WRAP_METHOD(NancyConsole, Cmd_getInventory));
@@ -60,6 +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() {}
@@ -492,6 +494,46 @@ bool NancyConsole::Cmd_listAcionRecords(int argc, const char **argv) {
return true;
}
+bool NancyConsole::Cmd_scanForActionRecordType(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("Scans all IFFs for ActionRecords of the provided type\n");
+ debugPrintf("Usage: %s <typeID> [cal]\n", argv[0]);
+ return true;
+ }
+
+ byte typeID = atoi(argv[1]) + 10;
+
+ Common::Array<Common::String> list;
+ g_nancy->_resource->list((argc == 2 ? "ciftree" : argv[2]), list, ResourceManager::kResTypeScript);
+
+ char descBuf[0x30];
+
+ for (Common::String &cifName : list) {
+ if (cifName.compareToIgnoreCase("ciflist") == 0) {
+ continue;
+ }
+
+ IFF iff(cifName);
+ if (iff.load()) {
+ uint num = 0;
+ Common::SeekableReadStream *chunk = nullptr;
+ while (chunk = iff.getChunkStream("ACT", num), chunk != nullptr) {
+ chunk->seek(0x30);
+ if (chunk->readByte() == typeID) {
+ chunk->seek(0);
+ chunk->read(descBuf, 0x30);
+ descBuf[0x2F] = '\0';
+ debugPrintf("%s: ACT chunk %u, %s\n", cifName.c_str(), num, descBuf);
+ }
+ ++num;
+ delete chunk;
+ }
+ }
+ }
+
+ return true;
+}
+
bool NancyConsole::Cmd_getEventFlags(int argc, const char **argv) {
if (g_nancy->_gameFlow.curState != NancyState::kScene) {
debugPrintf("Not in the kScene state\n");
diff --git a/engines/nancy/console.h b/engines/nancy/console.h
index c43e88d1ea3..f697cb602ac 100644
--- a/engines/nancy/console.h
+++ b/engines/nancy/console.h
@@ -49,6 +49,7 @@ private:
bool Cmd_loadScene(int argc, const char **argv);
bool Cmd_sceneID(int argc, const char **argv);
bool Cmd_listAcionRecords(int argc, const char **argv);
+ bool Cmd_scanForActionRecordType(int argc, const char **argv);
bool Cmd_getEventFlags(int argc, const char **argv);
bool Cmd_setEventFlags(int argc, const char **argv);
bool Cmd_getInventory(int argc, const char **argv);
diff --git a/engines/nancy/resource.cpp b/engines/nancy/resource.cpp
index 1ef22ac5059..31a006c9a7f 100644
--- a/engines/nancy/resource.cpp
+++ b/engines/nancy/resource.cpp
@@ -727,7 +727,7 @@ byte *ResourceManager::loadData(const Common::String &name, uint &size) {
// Data was not found inside a cif tree or a cif file, try to open an .iff file
// This is used by The Vampire Diaries
Common::File f;
- if (f.open(name + ".iff")) {
+ if (f.open(name.hasSuffixIgnoreCase(".iff") ? name : name + ".iff")) {
size = f.size();
buf = new byte[size];
f.read(buf, size);
Commit: 8dda3583dc98ae638a0219d9706bb2c20f472789
https://github.com/scummvm/scummvm/commit/8dda3583dc98ae638a0219d9706bb2c20f472789
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:23+02:00
Commit Message:
NANCY: Fix secondary movie in nancy1
Fixed a data reading error in nancy1's secondary movies.
Changed paths:
engines/nancy/action/secondarymovie.cpp
diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index 9b01301de69..2e529df4ec0 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -56,6 +56,8 @@ void PlaySecondaryMovie::readData(Common::SeekableReadStream &stream) {
ser.skip(2, kGameTypeVampire, kGameTypeVampire); // hasBitmapOverlaySurface
ser.skip(2, kGameTypeVampire, kGameTypeVampire); // unknown, probably related to playing a sfx
+ ser.skip(6, kGameTypeNancy1);
+
ser.syncAsUint16LE(_unknown);
ser.syncAsUint16LE(_hideMouse);
ser.syncAsUint16LE(_isReverse);
Commit: 0de0026d9ca3eeb098f74541c55e7528f4240b7c
https://github.com/scummvm/scummvm/commit/0de0026d9ca3eeb098f74541c55e7528f4240b7c
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:24+02:00
Commit Message:
NANCY: Don't look for FORM chunks in Nancy games
Changed the IFF loading function to only look for the FORM string
when The Vampire Diaries is running. This prevents a chunk read error
in at least one file in nancy2.
Changed paths:
engines/nancy/iff.cpp
diff --git a/engines/nancy/iff.cpp b/engines/nancy/iff.cpp
index 939b0410fdd..fa132b83a89 100644
--- a/engines/nancy/iff.cpp
+++ b/engines/nancy/iff.cpp
@@ -74,11 +74,14 @@ bool IFF::load() {
// Scan the file for DATA chunks, completely ignoring IFF structure
// Presumably the string "DATA" is not allowed inside of chunks...
+ // The Vampire Diaries uses the standard FORM
+ uint32 dataString = g_nancy->getGameType() == kGameTypeVampire ? ID_FORM : ID_DATA;
+
uint offset = 0;
while (offset < size - 3) {
uint32 id = READ_BE_UINT32(data + offset);
- if (id == ID_DATA || id == ID_FORM) {
+ if (id == dataString) {
// Replace 'DATA' with standard 'FORM' for the parser
WRITE_BE_UINT32(data + offset, ID_FORM);
Common::MemoryReadStream stream(data + offset, size - offset);
Commit: 49dd99a7b1353af93962cfba414fe38eb6155334
https://github.com/scummvm/scummvm/commit/49dd99a7b1353af93962cfba414fe38eb6155334
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:24+02:00
Commit Message:
NANCY: Modify scan_ar_type to only look inside scenes
Changed the scan_ar_type debug command to only look inside
scene chunks, preventing errors when used with nancy2 and above.
Changed paths:
engines/nancy/console.cpp
diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 766eccd0b8a..6156b46cfa9 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -509,26 +509,34 @@ bool NancyConsole::Cmd_scanForActionRecordType(int argc, const char **argv) {
char descBuf[0x30];
for (Common::String &cifName : list) {
- if (cifName.compareToIgnoreCase("ciflist") == 0) {
- continue;
+ Common::String name = cifName;
+ if (name.hasSuffixIgnoreCase(".iff")) {
+ name = name.substr(0, name.size() - 4);
}
-
- IFF iff(cifName);
- if (iff.load()) {
- uint num = 0;
- Common::SeekableReadStream *chunk = nullptr;
- while (chunk = iff.getChunkStream("ACT", num), chunk != nullptr) {
- chunk->seek(0x30);
- if (chunk->readByte() == typeID) {
- chunk->seek(0);
- chunk->read(descBuf, 0x30);
- descBuf[0x2F] = '\0';
- debugPrintf("%s: ACT chunk %u, %s\n", cifName.c_str(), num, descBuf);
+
+ // Only check inside scenes
+ if (name.matchString("S#") ||
+ name.matchString("S##") ||
+ name.matchString("S###") ||
+ name.matchString("S####")) {
+
+ IFF iff(cifName);
+ if (iff.load()) {
+ uint num = 0;
+ Common::SeekableReadStream *chunk = nullptr;
+ while (chunk = iff.getChunkStream("ACT", num), chunk != nullptr) {
+ chunk->seek(0x30);
+ if (chunk->readByte() == typeID) {
+ chunk->seek(0);
+ chunk->read(descBuf, 0x30);
+ descBuf[0x2F] = '\0';
+ debugPrintf("%s: ACT chunk %u, %s\n", cifName.c_str(), num, descBuf);
+ }
+ ++num;
+ delete chunk;
}
- ++num;
- delete chunk;
}
- }
+ }
}
return true;
Commit: 889cee6ab0c01e3ad0829be40bf06f831dcd21d9
https://github.com/scummvm/scummvm/commit/889cee6ab0c01e3ad0829be40bf06f831dcd21d9
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:24+02:00
Commit Message:
NANCY: Remove stubs for unused action records
Removed the ActionRecord subclasses for types that seem to have
never actually been used in a game.
Changed paths:
engines/nancy/action/arfactory.cpp
engines/nancy/action/recordtypes.cpp
engines/nancy/action/recordtypes.h
diff --git a/engines/nancy/action/arfactory.cpp b/engines/nancy/action/arfactory.cpp
index 87eee81d67a..4af2aa68747 100644
--- a/engines/nancy/action/arfactory.cpp
+++ b/engines/nancy/action/arfactory.cpp
@@ -54,28 +54,8 @@ ActionRecord *ActionManager::createActionRecord(uint16 type) {
return new PaletteThisScene();
case 0x0B:
return new PaletteNextScene();
- case 0x0C:
- return new StartFrameNextScene();
- case 0x14:
- return new StartStopPlayerScrolling(); // TODO
- case 0x15:
- return new StartStopPlayerScrolling(); // TODO
case 0x1E:
return new LightningOn();
- case 0x1F:
- return new LightningOff();
- case 0x20:
- return new AmbientLightUp();
- case 0x21:
- return new AmbientLightDown();
- case 0x22:
- return new AmbientLightToTod();
- case 0x23:
- return new AmbientLightToTodOff();
- case 0x24:
- return new FlickerOn();
- case 0x25:
- return new FlickerOff();
case 0x28:
return new PlayPrimaryVideoChan0();
case 0x29:
@@ -94,18 +74,6 @@ ActionRecord *ActionManager::createActionRecord(uint16 type) {
return new MapCallHot1Fr();
case 0x34:
return new MapCallHotMultiframe();
- case 0x35:
- return new MapLocationAccess();
- case 0x36:
- return new MapLightning();
- case 0x37:
- return new MapLightningOff();
- case 0x38:
- return new MapSound();
- case 0x39:
- return new MapAviOverride();
- case 0x3A:
- return new MapAviOverrideOff();
case 0x41:
return new TextBoxWrite();
case 0x42:
@@ -155,9 +123,9 @@ ActionRecord *ActionManager::createActionRecord(uint16 type) {
case 0x70:
return new ShowInventoryItem();
case 0x8C:
- return new PlayDigiSoundAndDie(); // TODO
+ return new PlayDigiSoundAndDie();
case 0x8D:
- return new PlayDigiSoundAndDie(); // TODO
+ return new PlayDigiSoundAndDie();
case 0x8E:
return new PlaySoundPanFrameAnchorAndDie();
case 0x8F:
diff --git a/engines/nancy/action/recordtypes.cpp b/engines/nancy/action/recordtypes.cpp
index 746ccf44918..ba33af7c1ef 100644
--- a/engines/nancy/action/recordtypes.cpp
+++ b/engines/nancy/action/recordtypes.cpp
@@ -199,46 +199,10 @@ void PaletteNextScene::execute() {
_isDone = true;
}
-void StartFrameNextScene::readData(Common::SeekableReadStream &stream) {
- stream.skip(4);
-}
-
-void StartStopPlayerScrolling::readData(Common::SeekableReadStream &stream) {
- stream.skip(1);
-}
-
void LightningOn::readData(Common::SeekableReadStream &stream) {
stream.skip(0xA);
}
-void LightningOff::readData(Common::SeekableReadStream &stream) {
- stream.skip(1);
-}
-
-void AmbientLightUp::readData(Common::SeekableReadStream &stream) {
- stream.skip(0x12);
-}
-
-void AmbientLightDown::readData(Common::SeekableReadStream &stream) {
- stream.skip(0x12);
-}
-
-void AmbientLightToTod::readData(Common::SeekableReadStream &stream) {
- stream.skip(0x1C);
-}
-
-void AmbientLightToTodOff::readData(Common::SeekableReadStream &stream) {
- stream.skip(1);
-}
-
-void FlickerOn::readData(Common::SeekableReadStream &stream) {
- stream.skip(0xA);
-}
-
-void FlickerOff::readData(Common::SeekableReadStream &stream) {
- stream.skip(1);
-}
-
void MapCall::readData(Common::SeekableReadStream &stream) {
stream.skip(1);
}
@@ -299,30 +263,6 @@ void MapCallHotMultiframe::execute() {
}
}
-void MapLocationAccess::readData(Common::SeekableReadStream &stream) {
- stream.skip(4);
-}
-
-void MapLightning::readData(Common::SeekableReadStream &stream) {
- stream.skip(0xA);
-}
-
-void MapLightningOff::readData(Common::SeekableReadStream &stream) {
- stream.skip(1);
-}
-
-void MapSound::readData(Common::SeekableReadStream &stream) {
- stream.skip(0x10);
-}
-
-void MapAviOverride::readData(Common::SeekableReadStream &stream) {
- stream.skip(2);
-}
-
-void MapAviOverrideOff::readData(Common::SeekableReadStream &stream) {
- stream.skip(1);
-}
-
void TextBoxWrite::readData(Common::SeekableReadStream &stream) {
uint16 size = stream.readUint16LE();
stream.skip(size);
diff --git a/engines/nancy/action/recordtypes.h b/engines/nancy/action/recordtypes.h
index 703fed1391e..a3d33c64c1b 100644
--- a/engines/nancy/action/recordtypes.h
+++ b/engines/nancy/action/recordtypes.h
@@ -119,25 +119,6 @@ protected:
Common::String getRecordTypeName() const override { return "PaletteNextScene"; }
};
-class StartFrameNextScene : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "StartFrameNextScene"; }
-};
-
-class StartStopPlayerScrolling : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
- // TODO add a Start and Stop subclass
-
- byte _type = 0;
-
-protected:
- Common::String getRecordTypeName() const override { return "StartStopPlayerScrolling"; }
-};
-
class LightningOn : public Unimplemented {
public:
void readData(Common::SeekableReadStream &stream) override;
@@ -146,62 +127,6 @@ protected:
Common::String getRecordTypeName() const override { return "LightningOn"; }
};
-class LightningOff : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "LightningOff"; }
-};
-
-class AmbientLightUp : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "AmbientLightUp"; }
-};
-
-class AmbientLightDown : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "AmbientLightDown"; }
-};
-
-class AmbientLightToTod : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "AmbientLightToTod"; }
-};
-
-class AmbientLightToTodOff : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "AmbientLightToTodOff"; }
-};
-
-class FlickerOn : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "FlickerOn"; }
-};
-
-class FlickerOff : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "FlickerOff"; }
-};
-
class MapCall : public ActionRecord {
public:
void readData(Common::SeekableReadStream &stream) override;
@@ -235,54 +160,6 @@ protected:
Common::String getRecordTypeName() const override { return "MapCallHotMultiframe"; }
};
-class MapLocationAccess : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "MapLocationAccess"; }
-};
-
-class MapLightning : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "MapLightning"; }
-};
-
-class MapLightningOff : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "MapLightningOff"; }
-};
-
-class MapSound : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "MapSound"; }
-};
-
-class MapAviOverride : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "MapAviOverride"; }
-};
-
-class MapAviOverrideOff : public Unimplemented {
-public:
- void readData(Common::SeekableReadStream &stream) override;
-
-protected:
- Common::String getRecordTypeName() const override { return "MapAviOverrideOff"; }
-};
-
class TextBoxWrite : public Unimplemented {
public:
void readData(Common::SeekableReadStream &stream) override;
Commit: 80260711eb596032f82e0f3b17be6d48834f21f5
https://github.com/scummvm/scummvm/commit/80260711eb596032f82e0f3b17be6d48834f21f5
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:24+02:00
Commit Message:
NANCY: Fix memory leak
Fixed another instance of a chunk stream not getting deleted after use.
Changed paths:
engines/nancy/state/scene.cpp
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index 051e8a3eeaa..882c632b305 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -510,6 +510,8 @@ void Scene::load() {
_sceneState.summary.read(*sceneSummaryChunk);
+ delete sceneSummaryChunk;
+
debugC(0, kDebugScene, "Loading new scene %i: description \"%s\", frame %i, vertical scroll %i, doNotStartSound == %s",
_sceneState.nextScene.sceneID,
_sceneState.summary.description.c_str(),
Commit: 7de76175a3c0bc55471db1c2624963f9896489f2
https://github.com/scummvm/scummvm/commit/7de76175a3c0bc55471db1c2624963f9896489f2
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:25+02:00
Commit Message:
NANCY: Destroy all singletons when exiting game
Changed paths:
engines/nancy/nancy.cpp
diff --git a/engines/nancy/nancy.cpp b/engines/nancy/nancy.cpp
index c0e98b77de0..a5725cb4647 100644
--- a/engines/nancy/nancy.cpp
+++ b/engines/nancy/nancy.cpp
@@ -267,9 +267,18 @@ Common::Error NancyEngine::run() {
_system->delayMillis(16);
}
- if (State::Scene::hasInstance()) {
- NancySceneState.destroy();
- }
+ if (State::Logo::hasInstance())
+ State::Logo::instance().destroy();
+ if (State::Credits::hasInstance())
+ State::Credits::instance().destroy();
+ if (State::Map::hasInstance())
+ State::Map::instance().destroy();
+ if (State::Help::hasInstance())
+ State::Help::instance().destroy();
+ if (State::Scene::hasInstance())
+ State::Scene::instance().destroy();
+ if (State::MainMenu::hasInstance())
+ State::MainMenu::instance().destroy();
return Common::kNoError;
}
Commit: 87b375f4f12a06d1a84666e6b00864f3593a2346
https://github.com/scummvm/scummvm/commit/87b375f4f12a06d1a84666e6b00864f3593a2346
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-05T16:31:25+02:00
Commit Message:
NANCY: Retire NancyFlag
Removed the NancyFlag enum and replaced it with more specific
constants.
Changed paths:
engines/nancy/action/actionmanager.cpp
engines/nancy/action/actionmanager.h
engines/nancy/action/leverpuzzle.cpp
engines/nancy/action/leverpuzzle.h
engines/nancy/action/orderingpuzzle.cpp
engines/nancy/action/orderingpuzzle.h
engines/nancy/action/passwordpuzzle.cpp
engines/nancy/action/passwordpuzzle.h
engines/nancy/action/primaryvideo.cpp
engines/nancy/action/primaryvideo.h
engines/nancy/action/recordtypes.cpp
engines/nancy/action/recordtypes.h
engines/nancy/action/rotatinglockpuzzle.cpp
engines/nancy/action/rotatinglockpuzzle.h
engines/nancy/action/secondarymovie.cpp
engines/nancy/action/secondarymovie.h
engines/nancy/action/secondaryvideo.cpp
engines/nancy/action/secondaryvideo.h
engines/nancy/action/sliderpuzzle.cpp
engines/nancy/action/sliderpuzzle.h
engines/nancy/action/staticbitmapanim.cpp
engines/nancy/action/staticbitmapanim.h
engines/nancy/action/telephone.cpp
engines/nancy/action/telephone.h
engines/nancy/commontypes.cpp
engines/nancy/commontypes.h
engines/nancy/console.cpp
engines/nancy/state/map.cpp
engines/nancy/state/scene.cpp
engines/nancy/state/scene.h
engines/nancy/ui/inventorybox.cpp
engines/nancy/ui/inventorybox.h
engines/nancy/ui/viewport.cpp
engines/nancy/ui/viewport.h
diff --git a/engines/nancy/action/actionmanager.cpp b/engines/nancy/action/actionmanager.cpp
index 200dab318dd..29e8bbe6bd9 100644
--- a/engines/nancy/action/actionmanager.cpp
+++ b/engines/nancy/action/actionmanager.cpp
@@ -77,7 +77,7 @@ void ActionManager::handleInput(NancyInput &input) {
// Re-add the object to the inventory unless it's marked as a one-time use
if (rec->_itemRequired == heldItem && rec->_itemRequired != -1) {
- if (NancySceneState.getInventoryBox().getItemDescription(heldItem).oneTimeUse != 0) {
+ if (NancySceneState.getInventoryBox().getItemDescription(heldItem).keepItem == kInvItemKeepAlways) {
NancySceneState.getInventoryBox().addItem(heldItem);
}
@@ -166,16 +166,16 @@ void ActionManager::processActionRecords() {
break;
case DependencyType::kInventory:
switch (dep.condition) {
- case kFalse:
+ case kInvEmpty:
// Item not in possession or held
- if (NancySceneState._flags.items[dep.label] == kFalse &&
+ if (NancySceneState._flags.items[dep.label] == kInvEmpty &&
dep.label != NancySceneState._flags.heldItem) {
dep.satisfied = true;
}
break;
- case kTrue:
- if (NancySceneState._flags.items[dep.label] == kTrue ||
+ case kInvHolding:
+ if (NancySceneState._flags.items[dep.label] == kInvHolding ||
dep.label == NancySceneState._flags.heldItem) {
dep.satisfied = true;
}
@@ -187,7 +187,7 @@ void ActionManager::processActionRecords() {
break;
case DependencyType::kEventFlag:
- if (NancySceneState.getEventFlag(dep.label, (NancyFlag)dep.condition)) {
+ if (NancySceneState.getEventFlag(dep.label, dep.condition)) {
// nancy1 has code for some timer array that never gets used
// and is discarded from nancy2 onward
dep.satisfied = true;
@@ -286,15 +286,15 @@ void ActionManager::processActionRecords() {
record->_itemRequired = dep.label;
- if (dep.condition == 1) {
- record->_itemRequired += 100;
+ if (dep.condition == kCursInvNotHolding) {
+ record->_itemRequired += kCursInvNotHoldingOffset;
}
dep.satisfied = true;
break;
}
case DependencyType::kTimeOfDay:
- if (dep.label == (byte)NancySceneState._timers.timeOfDay) {
+ if (dep.label == NancySceneState._timers.timeOfDay) {
dep.satisfied = true;
}
diff --git a/engines/nancy/action/actionmanager.h b/engines/nancy/action/actionmanager.h
index f099602f241..7c7ed4d4d0e 100644
--- a/engines/nancy/action/actionmanager.h
+++ b/engines/nancy/action/actionmanager.h
@@ -49,6 +49,10 @@ class ActionManager {
friend class Nancy::NancyConsole;
public:
+ static const byte kCursInvHolding = 0;
+ static const byte kCursInvNotHolding = 1;
+ static const byte kCursInvNotHoldingOffset = 100;
+
ActionManager() {}
virtual ~ActionManager() {}
diff --git a/engines/nancy/action/leverpuzzle.cpp b/engines/nancy/action/leverpuzzle.cpp
index 563adf50b77..907223516f9 100644
--- a/engines/nancy/action/leverpuzzle.cpp
+++ b/engines/nancy/action/leverpuzzle.cpp
@@ -84,13 +84,13 @@ void LeverPuzzle::readData(Common::SeekableReadStream &stream) {
_solveExitScene.readData(stream);
stream.skip(2);
_flagOnSolve.label = stream.readSint16LE();
- _flagOnSolve.flag = (NancyFlag)stream.readByte();
+ _flagOnSolve.flag = stream.readByte();
_solveSoundDelay = stream.readUint16LE();
_solveSound.read(stream, SoundDescription::kNormal);
_exitScene.readData(stream);
stream.skip(2);
_flagOnExit.label = stream.readSint16LE();
- _flagOnExit.flag = (NancyFlag)stream.readByte();
+ _flagOnExit.flag = stream.readByte();
readRect(stream, _exitHotspot);
}
diff --git a/engines/nancy/action/leverpuzzle.h b/engines/nancy/action/leverpuzzle.h
index 666c80a8868..5c4875e904e 100644
--- a/engines/nancy/action/leverpuzzle.h
+++ b/engines/nancy/action/leverpuzzle.h
@@ -49,11 +49,11 @@ public:
SoundDescription _moveSound; // 0x100
SoundDescription _noMoveSound; // 0x122
SceneChangeDescription _solveExitScene; // 0x144
- EventFlagDescription _flagOnSolve; // 0x14E
+ FlagDescription _flagOnSolve; // 0x14E
uint16 _solveSoundDelay = 0; // 0x151
SoundDescription _solveSound; // 0x153
SceneChangeDescription _exitScene; // 0x175
- EventFlagDescription _flagOnExit; // 0x17F
+ FlagDescription _flagOnExit; // 0x17F
Common::Rect _exitHotspot; // 0x182
Common::Array<byte> _playerSequence;
diff --git a/engines/nancy/action/orderingpuzzle.cpp b/engines/nancy/action/orderingpuzzle.cpp
index 132d82dfbf3..1e0cc5a64ef 100644
--- a/engines/nancy/action/orderingpuzzle.cpp
+++ b/engines/nancy/action/orderingpuzzle.cpp
@@ -113,7 +113,7 @@ void OrderingPuzzle::readData(Common::SeekableReadStream &stream) {
_exitScene.readData(stream, ser.getVersion() == kGameTypeVampire);
stream.skip(2); // shouldStopRendering, useless
_flagOnExit.label = stream.readSint16LE();
- _flagOnExit.flag = (NancyFlag)stream.readByte();
+ _flagOnExit.flag = stream.readByte();
readRect(stream, _exitHotspot);
}
diff --git a/engines/nancy/action/orderingpuzzle.h b/engines/nancy/action/orderingpuzzle.h
index 43213ff28ed..b6ebcf107e6 100644
--- a/engines/nancy/action/orderingpuzzle.h
+++ b/engines/nancy/action/orderingpuzzle.h
@@ -49,11 +49,11 @@ public:
Common::Array<byte> _correctSequence; // 0x1EE, 15 bytes
Nancy::SoundDescription _clickSound; // 0x1FD, kNormal
SceneChangeDescription _solveExitScene; // 0x21F
- EventFlagDescription _flagOnSolve; // 0x229
+ FlagDescription _flagOnSolve; // 0x229
uint16 _solveSoundDelay = 0; // 0x22C
Nancy::SoundDescription _solveSound; // 0x22E
SceneChangeDescription _exitScene; // 0x250
- EventFlagDescription _flagOnExit; // 0x25A
+ FlagDescription _flagOnExit; // 0x25A
Common::Rect _exitHotspot; // 0x25D
SolveState _solveState = kNotSolved;
diff --git a/engines/nancy/action/passwordpuzzle.cpp b/engines/nancy/action/passwordpuzzle.cpp
index a582e465438..ba131d67048 100644
--- a/engines/nancy/action/passwordpuzzle.cpp
+++ b/engines/nancy/action/passwordpuzzle.cpp
@@ -58,17 +58,17 @@ void PasswordPuzzle::readData(Common::SeekableReadStream &stream) {
_solveExitScene.readData(stream);
stream.skip(2);
_flagOnSolve.label = stream.readSint16LE();
- _flagOnSolve.flag = (NancyFlag)stream.readByte();
+ _flagOnSolve.flag = stream.readByte();
_solveSound.read(stream, SoundDescription::kNormal);
_failExitScene.readData(stream);
stream.skip(2);
_flagOnFail.label = stream.readSint16LE();
- _flagOnFail.flag = (NancyFlag)stream.readByte();
+ _flagOnFail.flag = stream.readByte();
_failSound.read(stream, SoundDescription::kNormal);
_exitScene.readData(stream);
stream.skip(2);
_flagOnExit.label = stream.readSint16LE();
- _flagOnExit.flag = (NancyFlag)stream.readByte();
+ _flagOnExit.flag = stream.readByte();
readRect(stream, _exitHotspot);
}
diff --git a/engines/nancy/action/passwordpuzzle.h b/engines/nancy/action/passwordpuzzle.h
index 5296b0aaaeb..951893ad8d8 100644
--- a/engines/nancy/action/passwordpuzzle.h
+++ b/engines/nancy/action/passwordpuzzle.h
@@ -50,13 +50,13 @@ public:
Common::String _name; // 0x34, 20 bytes long
Common::String _password; // 0x48, 20 bytes long
SceneChangeDescription _solveExitScene; // 0x5A
- EventFlagDescription _flagOnSolve; // 0x66
+ FlagDescription _flagOnSolve; // 0x66
SoundDescription _solveSound; // 0x69
SceneChangeDescription _failExitScene; // 0x8B
- EventFlagDescription _flagOnFail; // 0x95
+ FlagDescription _flagOnFail; // 0x95
SoundDescription _failSound; // 0x98
SceneChangeDescription _exitScene; // 0xBA
- EventFlagDescription _flagOnExit; // 0xC4
+ FlagDescription _flagOnExit; // 0xC4
Common::Rect _exitHotspot; // 0xC7
Common::String _playerNameInput;
diff --git a/engines/nancy/action/primaryvideo.cpp b/engines/nancy/action/primaryvideo.cpp
index c88d3a1853b..c4ab02a1bc7 100644
--- a/engines/nancy/action/primaryvideo.cpp
+++ b/engines/nancy/action/primaryvideo.cpp
@@ -38,17 +38,17 @@ namespace Nancy {
namespace Action {
void PlayPrimaryVideoChan0::ConditionFlag::read(Common::SeekableReadStream &stream) {
- type = (ConditionType)stream.readByte();
+ type = stream.readByte();
flag.label = stream.readSint16LE();
- flag.flag = (NancyFlag)stream.readByte();
+ flag.flag = stream.readByte();
orFlag = stream.readByte();
}
bool PlayPrimaryVideoChan0::ConditionFlag::isSatisfied() const {
switch (type) {
- case ConditionFlag::kEventFlags:
+ case kFlagEvent:
return NancySceneState.getEventFlag(flag);
- case ConditionFlag::kInventory:
+ case kFlagInventory:
return NancySceneState.hasItem(flag.label) == flag.flag;
default:
return false;
@@ -57,11 +57,11 @@ bool PlayPrimaryVideoChan0::ConditionFlag::isSatisfied() const {
void PlayPrimaryVideoChan0::ConditionFlag::set() const {
switch (type) {
- case ConditionFlag::kEventFlags:
+ case kFlagEvent:
NancySceneState.setEventFlag(flag);
break;
- case ConditionFlag::kInventory:
- if (flag.flag == kTrue) {
+ case kFlagInventory:
+ if (flag.flag == kInvHolding) {
NancySceneState.addItemToInventory(flag.label);
} else {
NancySceneState.removeItemFromInventory(flag.label);
@@ -185,8 +185,8 @@ void PlayPrimaryVideoChan0::readData(Common::SeekableReadStream &stream) {
ser.skip(1);
ser.syncAsByte(_conditionalResponseCharacterID);
ser.syncAsByte(_goodbyeResponseCharacterID);
- ser.syncAsByte(_isDialogueExitScene);
- ser.syncAsByte(_doNotPop);
+ ser.syncAsByte(_defaultNextScene);
+ ser.syncAsByte(_popNextScene);
_sceneChange.readData(stream);
ser.skip(0x35, kGameTypeVampire, kGameTypeVampire);
@@ -224,9 +224,9 @@ void PlayPrimaryVideoChan0::readData(Common::SeekableReadStream &stream) {
_flagsStructs.push_back(FlagsStruct());
FlagsStruct &flagsStruct = _flagsStructs.back();
flagsStruct.conditions.read(stream);
- flagsStruct.flagToSet.type = (ConditionFlag::ConditionType)stream.readByte();
+ flagsStruct.flagToSet.type = stream.readByte();
flagsStruct.flagToSet.flag.label = stream.readSint16LE();
- flagsStruct.flagToSet.flag.flag = (NancyFlag)stream.readByte();
+ flagsStruct.flagToSet.flag.flag = stream.readByte();
}
}
@@ -310,7 +310,7 @@ void PlayPrimaryVideoChan0::execute() {
} else {
// NPC has finished talking, we have responses
for (uint i = 0; i < 30; ++i) {
- if (NancySceneState.getLogicCondition(i, kTrue)) {
+ if (NancySceneState.getLogicCondition(i, kLogUsed)) {
_pickedResponse = i;
break;
}
@@ -351,9 +351,9 @@ void PlayPrimaryVideoChan0::execute() {
} else {
// Evaluate scene branch structs here
- if (_isDialogueExitScene == kFalse) {
+ if (_defaultNextScene == kDefaultNextSceneEnabled) {
NancySceneState.changeScene(_sceneChange);
- } else if (_doNotPop == kFalse) {
+ } else if (_popNextScene == kPopNextScene) {
// Exit dialogue
NancySceneState.popScene();
}
@@ -402,7 +402,7 @@ void PlayPrimaryVideoChan0::addConditionalDialogue() {
newResponse.soundName = res.soundID;
newResponse.text = g_nancy->getStaticData().conditionalDialogueTexts[res.textID];
newResponse.sceneChange.sceneID = res.sceneID;
- newResponse.sceneChange.doNotStartSound = true;
+ newResponse.sceneChange.continueSceneSound = kContinueSceneSound;
}
}
}
@@ -447,7 +447,7 @@ void PlayPrimaryVideoChan0::addGoodbye() {
// Set an event flag if applicable
NancySceneState.setEventFlag(sceneChange.flagToSet);
- newResponse.sceneChange.doNotStartSound = true;
+ newResponse.sceneChange.continueSceneSound = kContinueSceneSound;
}
} // End of namespace Action
diff --git a/engines/nancy/action/primaryvideo.h b/engines/nancy/action/primaryvideo.h
index 99602ab015d..9e139aa42c3 100644
--- a/engines/nancy/action/primaryvideo.h
+++ b/engines/nancy/action/primaryvideo.h
@@ -37,11 +37,9 @@ namespace Action {
class PlayPrimaryVideoChan0 : public ActionRecord, public RenderObject {
struct ConditionFlag {
-enum ConditionType : byte { kNone = 0, kEventFlags = 1, kInventory = 2 };
-
- ConditionType type;
- EventFlagDescription flag;
- bool orFlag;
+ byte type;
+ FlagDescription flag;
+ byte orFlag;
void read(Common::SeekableReadStream &stream);
bool isSatisfied() const;
@@ -60,7 +58,7 @@ struct ResponseStruct {
Common::String text; // 0x06
Common::String soundName; // 0x196
SceneChangeDescription sceneChange; // 0x1A0
- EventFlagDescription flagDesc; // 0x1A8
+ FlagDescription flagDesc; // 0x1A8
};
struct FlagsStruct {
@@ -68,7 +66,13 @@ struct FlagsStruct {
ConditionFlag flagToSet;
};
-public:
+public:
+ static const byte kDefaultNextSceneEnabled = 1;
+ static const byte kDefaultNextSceneDisabled = 2;
+
+ static const byte kPopNextScene = 1;
+ static const byte kNoPopNextScene = 2;
+
PlayPrimaryVideoChan0() : RenderObject(8) {}
virtual ~PlayPrimaryVideoChan0();
@@ -94,8 +98,8 @@ public:
byte _conditionalResponseCharacterID = 0;
byte _goodbyeResponseCharacterID = 0;
- NancyFlag _isDialogueExitScene = NancyFlag::kFalse;
- NancyFlag _doNotPop = NancyFlag::kFalse;
+ byte _defaultNextScene = kDefaultNextSceneEnabled;
+ byte _popNextScene = kNoPopNextScene;
SceneChangeDescription _sceneChange;
Common::Array<ResponseStruct> _responses;
diff --git a/engines/nancy/action/recordtypes.cpp b/engines/nancy/action/recordtypes.cpp
index ba33af7c1ef..637426df91d 100644
--- a/engines/nancy/action/recordtypes.cpp
+++ b/engines/nancy/action/recordtypes.cpp
@@ -107,7 +107,7 @@ void Hot1FrSceneChange::execute() {
void HotMultiframeMultisceneChange::readData(Common::SeekableReadStream &stream) {
_onTrue.readData(stream);
_onFalse.readData(stream);
- _condType = (ConditionType)stream.readByte();
+ _condType = stream.readByte();
_conditionID = stream.readUint16LE();
_conditionPayload = stream.readByte();
uint numHotspots = stream.readUint16LE();
@@ -139,17 +139,17 @@ void HotMultiframeMultisceneChange::execute() {
case kActionTrigger: {
bool conditionMet = false;
switch (_condType) {
- case kEventFlag:
- if (NancySceneState.getEventFlag(_conditionID, (NancyFlag)_conditionPayload)) {
+ case kFlagEvent:
+ if (NancySceneState.getEventFlag(_conditionID, _conditionPayload)) {
conditionMet = true;
}
break;
- case kItem:
+ case kFlagInventory:
if (NancySceneState.hasItem(_conditionID) == _conditionPayload) {
conditionMet = true;
}
break;
- case kItemHeld:
+ case kFlagCursor:
if (NancySceneState.getHeldItem() == _conditionPayload) {
conditionMet = true;
}
@@ -277,7 +277,7 @@ void TextBoxClear::readData(Common::SeekableReadStream &stream) {
}
void BumpPlayerClock::readData(Common::SeekableReadStream &stream) {
- _relative = (NancyFlag)stream.readByte();
+ _relative = stream.readByte();
_hours = stream.readUint16LE();
_minutes = stream.readUint16LE();
}
@@ -423,7 +423,7 @@ void AddInventoryNoHS::readData(Common::SeekableReadStream &stream) {
}
void AddInventoryNoHS::execute() {
- if (NancySceneState.hasItem(_itemID) == kFalse) {
+ if (NancySceneState.hasItem(_itemID) == kInvHolding) {
NancySceneState.addItemToInventory(_itemID);
}
@@ -437,7 +437,7 @@ void RemoveInventoryNoHS::readData(Common::SeekableReadStream &stream) {
void DifficultyLevel::readData(Common::SeekableReadStream &stream) {
_difficulty = stream.readUint16LE();
_flag.label = stream.readSint16LE();
- _flag.flag = (NancyFlag)stream.readUint16LE();
+ _flag.flag = stream.readUint16LE();
}
void DifficultyLevel::execute() {
@@ -522,7 +522,7 @@ void PlayDigiSoundAndDie::readData(Common::SeekableReadStream &stream) {
_sceneChange.readData(stream, g_nancy->getGameType() == kGameTypeVampire);
_flagOnTrigger.label = stream.readSint16LE();
- _flagOnTrigger.flag = (NancyFlag)stream.readByte();
+ _flagOnTrigger.flag = stream.readByte();
stream.skip(2);
}
@@ -569,10 +569,10 @@ void PlaySoundMultiHS::readData(Common::SeekableReadStream &stream) {
if (g_nancy->getGameType() != kGameTypeVampire) {
_sceneChange.readData(stream);
_flag.label = stream.readSint16LE();
- _flag.flag = (NancyFlag)stream.readByte();
+ _flag.flag = stream.readByte();
stream.skip(2);
} else {
- _flag.label = -1;
+ _flag.label = kEvNoEvent;
_sceneChange.sceneID = 9999;
}
@@ -665,7 +665,7 @@ void HintSystem::selectHint() {
bool satisfied = true;
for (const auto &flag : hint.flagConditions) {
- if (flag.label == -1) {
+ if (flag.label == kFlagNoLabel) {
break;
}
@@ -676,7 +676,7 @@ void HintSystem::selectHint() {
}
for (const auto &inv : hint.inventoryConditions) {
- if (inv.label == -1) {
+ if (inv.label == kFlagNoLabel) {
break;
}
diff --git a/engines/nancy/action/recordtypes.h b/engines/nancy/action/recordtypes.h
index a3d33c64c1b..dc8059a277f 100644
--- a/engines/nancy/action/recordtypes.h
+++ b/engines/nancy/action/recordtypes.h
@@ -78,14 +78,12 @@ protected:
class HotMultiframeMultisceneChange : public Unimplemented {
public:
- enum ConditionType { kEventFlag = 1, kItem = 2, kItemHeld = 3 };
-
void readData(Common::SeekableReadStream &stream) override;
void execute() override;
SceneChangeDescription _onTrue;
SceneChangeDescription _onFalse;
- ConditionType _condType;
+ byte _condType;
uint16 _conditionID;
byte _conditionPayload;
Common::Array<HotspotDescription> _hotspots;
@@ -181,7 +179,7 @@ public:
void readData(Common::SeekableReadStream &stream) override;
void execute() override;
- NancyFlag _relative;
+ byte _relative;
uint16 _hours;
uint16 _minutes;
@@ -315,7 +313,7 @@ public:
void execute() override;
uint16 _difficulty = 0;
- EventFlagDescription _flag;
+ FlagDescription _flag;
protected:
Common::String getRecordTypeName() const override { return "DifficultyLevel"; }
@@ -352,7 +350,7 @@ public:
SoundDescription _sound;
SceneChangeDescription _sceneChange;
- EventFlagDescription _flagOnTrigger;
+ FlagDescription _flagOnTrigger;
protected:
Common::String getRecordTypeName() const override { return "PlayDigiSoundAndDie"; }
@@ -376,7 +374,7 @@ public:
SoundDescription _sound; // 0x0
SceneChangeDescription _sceneChange; // 0x22
- EventFlagDescription _flag; // 0x2A
+ FlagDescription _flag; // 0x2A
Common::Array<HotspotDescription> _hotspots; // 0x31
protected:
diff --git a/engines/nancy/action/rotatinglockpuzzle.cpp b/engines/nancy/action/rotatinglockpuzzle.cpp
index 08562a0a69a..ecf53176f81 100644
--- a/engines/nancy/action/rotatinglockpuzzle.cpp
+++ b/engines/nancy/action/rotatinglockpuzzle.cpp
@@ -96,13 +96,13 @@ void RotatingLockPuzzle::readData(Common::SeekableReadStream &stream) {
_solveExitScene.readData(stream);
stream.skip(2); // shouldStopRendering, useless
_flagOnSolve.label = stream.readSint16LE();
- _flagOnSolve.flag = (NancyFlag)stream.readByte();
+ _flagOnSolve.flag = stream.readByte();
_solveSoundDelay = stream.readUint16LE();
_solveSound.read(stream, SoundDescription::kNormal);
_exitScene.readData(stream);
stream.skip(2); // shouldStopRendering, useless
_flagOnExit.label = stream.readSint16LE();
- _flagOnExit.flag = (NancyFlag)stream.readByte();
+ _flagOnExit.flag = stream.readByte();
readRect(stream, _exitHotspot);
}
diff --git a/engines/nancy/action/rotatinglockpuzzle.h b/engines/nancy/action/rotatinglockpuzzle.h
index 252c3fecf40..a9841130e51 100644
--- a/engines/nancy/action/rotatinglockpuzzle.h
+++ b/engines/nancy/action/rotatinglockpuzzle.h
@@ -51,11 +51,11 @@ public:
Common::Array<byte> _correctSequence; // 0x22C
Nancy::SoundDescription _clickSound; // 0x234, kNormal
SceneChangeDescription _solveExitScene; // 0x256
- EventFlagDescription _flagOnSolve; // 0x260
+ FlagDescription _flagOnSolve; // 0x260
uint16 _solveSoundDelay = 0; // 0x263
Nancy::SoundDescription _solveSound; // 0x265
SceneChangeDescription _exitScene; // 0x287
- EventFlagDescription _flagOnExit; // 0x291
+ FlagDescription _flagOnExit; // 0x291
Common::Rect _exitHotspot; // 0x294
SolveState _solveState = kNotSolved;
diff --git a/engines/nancy/action/secondarymovie.cpp b/engines/nancy/action/secondarymovie.cpp
index 2e529df4ec0..57c375957e0 100644
--- a/engines/nancy/action/secondarymovie.cpp
+++ b/engines/nancy/action/secondarymovie.cpp
@@ -36,7 +36,7 @@ namespace Action {
PlaySecondaryMovie::~PlaySecondaryMovie() {
_decoder.close();
- if (_hideMouse == kTrue && _unknown == 5) {
+ if (_playerCursorAllowed == kNoPlayerCursorAllowed && _videoSceneChange == kMovieSceneChange) {
g_nancy->setMouseEnabled(true);
}
}
@@ -51,16 +51,16 @@ void PlaySecondaryMovie::readData(Common::SeekableReadStream &stream) {
ser.skip(0x2); // videoPlaySource
- ser.syncAsUint16LE(_isTransparent, kGameTypeVampire, kGameTypeVampire);
+ ser.syncAsUint16LE(_transparency, kGameTypeVampire, kGameTypeVampire);
ser.skip(4, kGameTypeVampire, kGameTypeVampire); // paletteStart, paletteSize
ser.skip(2, kGameTypeVampire, kGameTypeVampire); // hasBitmapOverlaySurface
ser.skip(2, kGameTypeVampire, kGameTypeVampire); // unknown, probably related to playing a sfx
ser.skip(6, kGameTypeNancy1);
- ser.syncAsUint16LE(_unknown);
- ser.syncAsUint16LE(_hideMouse);
- ser.syncAsUint16LE(_isReverse);
+ ser.syncAsUint16LE(_videoSceneChange);
+ ser.syncAsUint16LE(_playerCursorAllowed);
+ ser.syncAsUint16LE(_playDirection);
ser.syncAsUint16LE(_firstFrame);
ser.syncAsUint16LE(_lastFrame);
@@ -98,7 +98,7 @@ void PlaySecondaryMovie::init() {
GraphicsManager::loadSurfacePalette(_fullFrame, _paletteName);
}
- if (_isTransparent) {
+ if (_transparency == kPlayMovieTransparent) {
setTransparent(true);
_fullFrame.setTransparentColor(_drawSurface.getTransparentColor());
}
@@ -116,7 +116,7 @@ void PlaySecondaryMovie::updateGraphics() {
if (!_decoder.isPlaying() && _isVisible && !_isFinished) {
_decoder.start();
- if (_isReverse == kTrue) {
+ if (_playDirection == kPlayMovieReverse) {
_decoder.setRate(-_decoder.getRate());
_decoder.seekToFrame(_lastFrame);
} else {
@@ -145,8 +145,8 @@ void PlaySecondaryMovie::updateGraphics() {
}
}
- if ((_decoder.getCurFrame() == _lastFrame && _isReverse == kFalse) ||
- (_decoder.getCurFrame() == _firstFrame && _isReverse == kTrue) ||
+ if ((_decoder.getCurFrame() == _lastFrame && _playDirection == kPlayMovieForward) ||
+ (_decoder.getCurFrame() == _firstFrame && _playDirection == kPlayMovieReverse) ||
_decoder.atEnd()) {
if (!g_nancy->_sound->isSoundPlaying(_sound)) {
g_nancy->_sound->stopSound(_sound);
@@ -175,7 +175,7 @@ void PlaySecondaryMovie::execute() {
g_nancy->_sound->loadSound(_sound);
g_nancy->_sound->playSound(_sound);
- if (_hideMouse == kTrue) {
+ if (_playerCursorAllowed == kNoPlayerCursorAllowed) {
g_nancy->setMouseEnabled(false);
}
@@ -206,11 +206,11 @@ void PlaySecondaryMovie::execute() {
}
case kActionTrigger:
_triggerFlags.execute();
- if (_unknown == 5) {
+ if (_videoSceneChange == kMovieSceneChange) {
NancySceneState.changeScene(_sceneChange);
} else {
// Not changing the scene so enable the mouse now
- if (_hideMouse == kTrue) {
+ if (_playerCursorAllowed == kNoPlayerCursorAllowed) {
g_nancy->setMouseEnabled(true);
}
}
diff --git a/engines/nancy/action/secondarymovie.h b/engines/nancy/action/secondarymovie.h
index 8f65b8cb0e2..f7f5852ce05 100644
--- a/engines/nancy/action/secondarymovie.h
+++ b/engines/nancy/action/secondarymovie.h
@@ -32,9 +32,21 @@ namespace Action {
class PlaySecondaryMovie : public ActionRecord, public RenderObject {
public:
+ static const byte kPlayMoviePlain = 1;
+ static const byte kPlayMovieTransparent = 2;
+
+ 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;
+
struct FlagAtFrame {
int16 frameID;
- EventFlagDescription flagDesc;
+ FlagDescription flagDesc;
};
PlaySecondaryMovie() : RenderObject(8) {}
@@ -50,11 +62,11 @@ public:
Common::String _videoName; // 0x00
Common::String _paletteName;
//Common::String _bitmapOverlayName
- NancyFlag _isTransparent = kFalse;
+ byte _transparency = kPlayMoviePlain;
- uint16 _unknown = 0; // 0x1C
- NancyFlag _hideMouse = NancyFlag::kFalse; // 0x1E
- NancyFlag _isReverse = NancyFlag::kFalse; // 0x20, 2E
+ uint16 _videoSceneChange = kMovieNoSceneChange; // 0x1C
+ byte _playerCursorAllowed = kPlayerCursorAllowed; // 0x1E
+ byte _playDirection = kPlayMovieForward; // 0x20, 2E
uint16 _firstFrame = 0; // 0x22, 30
uint16 _lastFrame = 0; // 0x24, 32
Common::Array<FlagAtFrame> _frameFlags; // 0x26
diff --git a/engines/nancy/action/secondaryvideo.cpp b/engines/nancy/action/secondaryvideo.cpp
index 4a1d26bab83..8050c61e0d0 100644
--- a/engines/nancy/action/secondaryvideo.cpp
+++ b/engines/nancy/action/secondaryvideo.cpp
@@ -129,7 +129,7 @@ void PlaySecondaryVideo::updateGraphics() {
_drawSurface.create(_fullFrame, _videoDescs[vpFrame].srcRect);
moveTo(_videoDescs[vpFrame].destRect);
- if (_enableHotspot == kTrue) {
+ if (_videoHotspots == kVideoHotspots) {
_hotspot = _screenPosition;
_hotspot.clip(NancySceneState.getViewport().getBounds());
_hasHotspot = true;
@@ -168,7 +168,7 @@ void PlaySecondaryVideo::readData(Common::SeekableReadStream &stream) {
// _paletteSize
// hasOverlayBitmap
// ignoreHoverAnimation??
- _enableHotspot = (NancyFlag)stream.readUint16LE();
+ _videoHotspots = stream.readUint16LE();
}
_loopFirstFrame = stream.readUint16LE();
diff --git a/engines/nancy/action/secondaryvideo.h b/engines/nancy/action/secondaryvideo.h
index 80ca02ebe0c..9054f8684bf 100644
--- a/engines/nancy/action/secondaryvideo.h
+++ b/engines/nancy/action/secondaryvideo.h
@@ -34,6 +34,9 @@ namespace Action {
// different animations depending on whether the NPC is hovered by the mouse
class PlaySecondaryVideo : public ActionRecord, public RenderObject {
public:
+ static const byte kNoVideoHotspots = 1;
+ static const byte kVideoHotspots = 2;
+
enum HoverState { kNoHover, kHover, kEndHover };
PlaySecondaryVideo(uint chan) : RenderObject(8), channel(chan) {}
@@ -52,7 +55,7 @@ public:
// Common::String _bitmapOverlayFilename
// TVD only
- NancyFlag _enableHotspot = kTrue;
+ uint16 _videoHotspots = kVideoHotspots;
uint16 _loopFirstFrame = 0; // 0x1E
uint16 _loopLastFrame = 0; // 0x20
diff --git a/engines/nancy/action/sliderpuzzle.cpp b/engines/nancy/action/sliderpuzzle.cpp
index f99edf532f3..164c0a74ec6 100644
--- a/engines/nancy/action/sliderpuzzle.cpp
+++ b/engines/nancy/action/sliderpuzzle.cpp
@@ -101,12 +101,12 @@ void SliderPuzzle::readData(Common::SeekableReadStream &stream) {
_solveExitScene.readData(stream);
stream.skip(2);
_flagOnSolve.label = stream.readSint16LE();
- _flagOnSolve.flag = (NancyFlag)stream.readByte();
+ _flagOnSolve.flag = stream.readByte();
_solveSound.read(stream, SoundDescription::kNormal);
_exitScene.readData(stream);
stream.skip(2);
_flagOnExit.label = stream.readSint16LE();
- _flagOnExit.flag = (NancyFlag)stream.readByte();
+ _flagOnExit.flag = stream.readByte();
readRect(stream, _exitHotspot);
}
diff --git a/engines/nancy/action/sliderpuzzle.h b/engines/nancy/action/sliderpuzzle.h
index dde39a2ac65..b6731ef1ca6 100644
--- a/engines/nancy/action/sliderpuzzle.h
+++ b/engines/nancy/action/sliderpuzzle.h
@@ -54,10 +54,10 @@ public:
Common::Array<Common::Array<int16>> _correctTileOrder; // 0x48E, size 0x48
SoundDescription _clickSound; // 0x4D6
SceneChangeDescription _solveExitScene; // 0x4F8
- EventFlagDescription _flagOnSolve; // 0x502
+ FlagDescription _flagOnSolve; // 0x502
SoundDescription _solveSound; // 0x505
SceneChangeDescription _exitScene; // 0x527
- EventFlagDescription _flagOnExit; // 0x531
+ FlagDescription _flagOnExit; // 0x531
Common::Rect _exitHotspot; // 0x534
SolveState _solveState = kNotSolved;
diff --git a/engines/nancy/action/staticbitmapanim.cpp b/engines/nancy/action/staticbitmapanim.cpp
index 23c1e3c4ac3..f4125ddc76d 100644
--- a/engines/nancy/action/staticbitmapanim.cpp
+++ b/engines/nancy/action/staticbitmapanim.cpp
@@ -43,10 +43,10 @@ void PlayStaticBitmapAnimation::readData(Common::SeekableReadStream &stream) {
readFilename(stream, _imageName);
stream.skip(0x2);
- _isTransparent = (NancyFlag)(stream.readUint16LE());
- _doNotChangeScene = (NancyFlag)(stream.readUint16LE());
- _isReverse = (NancyFlag)(stream.readUint16LE());
- _isLooping = (NancyFlag)(stream.readUint16LE());
+ _transparency = stream.readUint16LE();
+ _animationSceneChange = stream.readUint16LE();
+ _playDirection = stream.readUint16LE();
+ _loop = stream.readUint16LE();
_firstFrame = stream.readUint16LE();
_loopFirstFrame = stream.readUint16LE();
_loopLastFrame = stream.readUint16LE();
@@ -55,10 +55,10 @@ void PlayStaticBitmapAnimation::readData(Common::SeekableReadStream &stream) {
if (_isInterruptible) {
_interruptCondition.label = stream.readSint16LE();
- _interruptCondition.flag = (NancyFlag)stream.readUint16LE();
+ _interruptCondition.flag = stream.readUint16LE();
} else {
- _interruptCondition.label = -1;
- _interruptCondition.flag = kFalse;
+ _interruptCondition.label = kEvNoEvent;
+ _interruptCondition.flag = kEvNotOccurred;
}
_sceneChange.readData(stream);
@@ -97,8 +97,8 @@ void PlayStaticBitmapAnimation::execute() {
if (_nextFrameTime <= _currentFrameTime) {
// World's worst if statement
if (NancySceneState.getEventFlag(_interruptCondition) ||
- ( (((_currentFrame == _loopLastFrame) && (_isReverse == kFalse) && (_isLooping == kFalse)) ||
- ((_currentFrame == _loopFirstFrame) && (_isReverse == kTrue) && (_isLooping == kFalse))) &&
+ ( (((_currentFrame == _loopLastFrame) && (_playDirection == kPlayAnimationForward) && (_loop == kPlayAnimationOnce)) ||
+ ((_currentFrame == _loopFirstFrame) && (_playDirection == kPlayAnimationReverse) && (_loop == kPlayAnimationOnce))) &&
!g_nancy->_sound->isSoundPlaying(_sound)) ) {
_state = kActionTrigger;
@@ -128,7 +128,7 @@ void PlayStaticBitmapAnimation::execute() {
_nextFrameTime = _currentFrameTime + _frameTime;
setFrame(_currentFrame);
- if (_isReverse == kTrue) {
+ if (_playDirection == kPlayAnimationReverse) {
--_currentFrame;
_currentFrame = _currentFrame < _loopFirstFrame ? _loopLastFrame : _currentFrame;
return;
@@ -158,7 +158,7 @@ void PlayStaticBitmapAnimation::execute() {
}
case kActionTrigger:
_triggerFlags.execute();
- if (_doNotChangeScene == kFalse) {
+ if (_animationSceneChange == kPlayAnimationSceneChange) {
NancySceneState.changeScene(_sceneChange);
finishExecution();
}
@@ -176,7 +176,7 @@ void PlayStaticBitmapAnimation::setFrame(uint frame) {
_currentFrame = frame;
_drawSurface.create(_fullSurface, _srcRects[frame]);
- setTransparent(_isTransparent == kTrue);
+ setTransparent(_transparency == kPlayAnimationPlain);
_needsRedraw = true;
}
diff --git a/engines/nancy/action/staticbitmapanim.h b/engines/nancy/action/staticbitmapanim.h
index 7b191c56a3c..41a88acaadd 100644
--- a/engines/nancy/action/staticbitmapanim.h
+++ b/engines/nancy/action/staticbitmapanim.h
@@ -35,6 +35,18 @@ namespace Action {
// action record types, whose functionality is nearly identical
class PlayStaticBitmapAnimation : public ActionRecord, public RenderObject {
public:
+ static const byte kPlayAnimationPlain = 1;
+ static const byte kPlayAnimationTransparent = 2;
+
+ static const byte kPlayAnimationSceneChange = 1;
+ static const byte kPlayAnimationNoSceneChange = 2;
+
+ static const byte kPlayAnimationOnce = 1;
+ static const byte kPlayAnimationLoop = 2;
+
+ static const byte kPlayAnimationForward = 1;
+ static const byte kPlayAnimationReverse = 2;
+
PlayStaticBitmapAnimation(bool interruptible) : RenderObject(7), _isInterruptible(interruptible) {}
virtual ~PlayStaticBitmapAnimation() { _fullSurface.free(); }
@@ -46,15 +58,15 @@ public:
Common::String _imageName;
- NancyFlag _isTransparent = NancyFlag::kFalse; // 0xC
- NancyFlag _doNotChangeScene = NancyFlag::kFalse; // 0xE
- NancyFlag _isReverse = NancyFlag::kFalse; // 0x10
- NancyFlag _isLooping = NancyFlag::kFalse; // 0x12
+ uint16 _transparency = kPlayAnimationPlain; // 0xC
+ uint16 _animationSceneChange = kPlayAnimationSceneChange; // 0xE
+ uint16 _playDirection = kPlayAnimationForward; // 0x10
+ uint16 _loop = kPlayAnimationOnce; // 0x12
uint16 _firstFrame = 0; // 0x14
uint16 _loopFirstFrame = 0; // 0x16
uint16 _loopLastFrame = 0; // 0x18
Time _frameTime;
- EventFlagDescription _interruptCondition; // 0x1E
+ FlagDescription _interruptCondition; // 0x1E
SceneChangeDescription _sceneChange;
MultiEventFlagDescription _triggerFlags; // 0x2A
diff --git a/engines/nancy/action/telephone.cpp b/engines/nancy/action/telephone.cpp
index a42142b0167..bae9184d7df 100644
--- a/engines/nancy/action/telephone.cpp
+++ b/engines/nancy/action/telephone.cpp
@@ -89,11 +89,11 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
_reloadScene.readData(stream);
stream.skip(2);
_flagOnReload.label = stream.readSint16LE();
- _flagOnReload.flag = (NancyFlag)stream.readUint16LE();
+ _flagOnReload.flag = stream.readUint16LE();
_exitScene.readData(stream);
stream.skip(2);
_flagOnExit.label = stream.readSint16LE();
- _flagOnExit.flag = (NancyFlag)stream.readUint16LE();
+ _flagOnExit.flag = stream.readUint16LE();
readRect(stream, _exitHotspot);
uint numCalls = stream.readUint16LE();
@@ -115,7 +115,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
call.sceneChange.readData(stream);
stream.skip(2);
call.flag.label = stream.readSint16LE();
- call.flag.flag = (NancyFlag)stream.readUint16LE();
+ call.flag.flag = stream.readUint16LE();
}
}
diff --git a/engines/nancy/action/telephone.h b/engines/nancy/action/telephone.h
index 2c1fb90719a..c5979e32bf7 100644
--- a/engines/nancy/action/telephone.h
+++ b/engines/nancy/action/telephone.h
@@ -37,7 +37,7 @@ public:
Common::String text; // 0x15, 0xC8 bytes
SceneChangeDescription sceneChange; // 0xDD
// shouldStopRendering
- EventFlagDescription flag; // 0xE7
+ FlagDescription flag; // 0xE7
};
enum CallState { kWaiting, kButtonPress, kRinging, kBadNumber, kCall, kHangUp };
@@ -67,9 +67,9 @@ public:
Common::String _addressBookString; // 0x2CE, 0xC8 long
Common::String _dialAgainString; // 0x396
SceneChangeDescription _reloadScene; // 0x45E
- EventFlagDescription _flagOnReload; // 0x468 ??
+ FlagDescription _flagOnReload; // 0x468 ??
SceneChangeDescription _exitScene; // 0x46C
- EventFlagDescription _flagOnExit; // 0x476
+ FlagDescription _flagOnExit; // 0x476
Common::Rect _exitHotspot; // 0x47A
// 0x48A numConvos
Common::Array<PhoneCall> _calls; // 0x48C
diff --git a/engines/nancy/commontypes.cpp b/engines/nancy/commontypes.cpp
index 84daca3331c..dd367f79c7a 100644
--- a/engines/nancy/commontypes.cpp
+++ b/engines/nancy/commontypes.cpp
@@ -33,7 +33,7 @@ void SceneChangeDescription::readData(Common::SeekableReadStream &stream, bool l
if (longFormat) {
stream.skip(3);
}
- doNotStartSound = (bool)(stream.readUint16LE());
+ continueSceneSound = stream.readUint16LE();
}
void HotspotDescription::readData(Common::SeekableReadStream &stream) {
@@ -50,7 +50,7 @@ void BitmapDescription::readData(Common::SeekableReadStream &stream) {
void MultiEventFlagDescription::readData(Common::SeekableReadStream &stream) {
for (uint i = 0; i < 10; ++i) {
descs[i].label = stream.readSint16LE();
- descs[i].flag = (NancyFlag)stream.readUint16LE();
+ descs[i].flag = stream.readUint16LE();
}
}
@@ -113,14 +113,14 @@ void ConditionalDialogue::readData(Common::SeekableReadStream &stream) {
flagConditions.resize(num);
for (uint16 i = 0; i < num; ++i) {
flagConditions[i].label = stream.readSint16LE();
- flagConditions[i].flag = (NancyFlag)stream.readByte();
+ flagConditions[i].flag = stream.readByte();
}
num = stream.readUint16LE();
inventoryConditions.resize(num);
for (uint16 i = 0; i < num; ++i) {
inventoryConditions[i].label = stream.readSint16LE();
- inventoryConditions[i].flag = (NancyFlag)stream.readByte();
+ inventoryConditions[i].flag = stream.readByte();
}
}
@@ -135,11 +135,11 @@ void GoodbyeSceneChange::readData(Common::SeekableReadStream &stream) {
flagConditions.resize(num);
for (uint16 i = 0; i < num; ++i) {
flagConditions[i].label = stream.readSint16LE();
- flagConditions[i].flag = (NancyFlag)stream.readByte();
+ flagConditions[i].flag = stream.readByte();
}
flagToSet.label = stream.readSint16LE();
- flagToSet.flag = (NancyFlag)stream.readByte();
+ flagToSet.flag = stream.readByte();
}
void Goodbye::readData(Common::SeekableReadStream &stream) {
@@ -164,14 +164,14 @@ void Hint::readData(Common::SeekableReadStream &stream) {
flagConditions.resize(num);
for (uint16 i = 0; i < num; ++i) {
flagConditions[i].label = stream.readSint16LE();
- flagConditions[i].flag = (NancyFlag)stream.readByte();
+ flagConditions[i].flag = stream.readByte();
}
num = stream.readUint16LE();
inventoryConditions.resize(num);
for (uint16 i = 0; i < num; ++i) {
inventoryConditions[i].label = stream.readSint16LE();
- inventoryConditions[i].flag = (NancyFlag)stream.readByte();
+ inventoryConditions[i].flag = stream.readByte();
}
}
diff --git a/engines/nancy/commontypes.h b/engines/nancy/commontypes.h
index f972618b062..9350f8b2895 100644
--- a/engines/nancy/commontypes.h
+++ b/engines/nancy/commontypes.h
@@ -34,7 +34,47 @@ namespace Nancy {
class NancyEngine;
-enum NancyFlag : byte { kFalse = 1, kTrue = 2 };
+// The original engine used a large amount of #defines for numerical constants,
+// which can be found listed inside the gameflow.h file shipping with many of
+// the titles (the Russian variant of nancy1 has it as a separate file, while
+// nancy2 and above embed it within the ciftree).
+//
+// Other, more specific constants are declared within their related classes,
+// so as not to litter the namespace
+
+static const int8 kFlagNoLabel = -1;
+static const int8 kEvNoEvent = -1;
+static const int8 kFrNoFrame = -1;
+
+// Event flags
+static const byte kEvNotOccurred = 1;
+static const byte kEvOccurred = 2;
+
+// Logic conditions
+static const byte kLogUsed = 1;
+static const byte kLogNotUsed = 2;
+
+// Inventory items flags
+static const byte kInvEmpty = 1;
+static const byte kInvHolding = 2;
+
+// Inventory items use types
+static const byte kInvItemUseThenLose = 0;
+static const byte kInvItemKeepAlways = 1;
+
+// Dependency types
+static const byte kFlagEvent = 1;
+static const byte kFlagInventory = 2;
+static const byte kFlagCursor = 3;
+
+// Scene sound flags
+static const byte kContinueSceneSound = 1;
+static const byte kLoadSceneSound = 0;
+
+// Clock bump types
+static const byte kAbsoluteClockBump = 1;
+static const byte kRelativeClockBump = 2;
+
enum MovementDirection : byte { kUp = 1, kDown = 2, kLeft = 4, kRight = 8, kMoveFast = 16 };
// Separate namespace to remove possible clashes
@@ -66,15 +106,15 @@ struct SceneChangeDescription {
uint16 sceneID = 0;
uint16 frameID = 0;
uint16 verticalOffset = 0;
- bool doNotStartSound = false;
+ uint16 continueSceneSound = 0;
void readData(Common::SeekableReadStream &stream, bool longFormat = false);
};
-// Describes a single event flag change or comparison
-struct EventFlagDescription {
+// Describes a single flag change or comparison
+struct FlagDescription {
int16 label;
- NancyFlag flag;
+ byte flag;
};
// Describes a hotspot
@@ -96,14 +136,14 @@ struct BitmapDescription {
// Describes 10 event flag changes to be executed when an action is triggered
struct MultiEventFlagDescription {
- EventFlagDescription descs[10];
+ FlagDescription descs[10];
void readData(Common::SeekableReadStream &stream);
void execute();
};
struct SecondaryVideoDescription {
- int16 frameID = -1;
+ int16 frameID = kFrNoFrame;
Common::Rect srcRect;
Common::Rect destRect;
// 2 unknown/empty rects
@@ -131,16 +171,16 @@ struct ConditionalDialogue {
byte textID;
uint16 sceneID;
Common::String soundID;
- Common::Array<EventFlagDescription> flagConditions;
- Common::Array<EventFlagDescription> inventoryConditions;
+ Common::Array<FlagDescription> flagConditions;
+ Common::Array<FlagDescription> inventoryConditions;
void readData(Common::SeekableReadStream &stream);
};
struct GoodbyeSceneChange {
Common::Array<uint16> sceneIDs;
- Common::Array<EventFlagDescription> flagConditions;
- EventFlagDescription flagToSet;
+ Common::Array<FlagDescription> flagConditions;
+ FlagDescription flagToSet;
void readData(Common::SeekableReadStream &stream);
};
@@ -157,8 +197,8 @@ struct Hint {
int16 hintWeight;
SceneChangeDescription sceneChange;
Common::String soundIDs[3];
- Common::Array<EventFlagDescription> flagConditions;
- Common::Array<EventFlagDescription> inventoryConditions;
+ 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 6156b46cfa9..422a609b71a 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -417,18 +417,18 @@ bool NancyConsole::Cmd_listAcionRecords(int argc, const char **argv) {
debugPrintf("kInventory, item %u, %s, %s",
dep.label,
g_nancy->getStaticData().itemNames[dep.label].c_str(),
- dep.condition == kTrue ? "kTrue" : "kFalse");
+ dep.condition == kInvHolding ? "kInvHolding" : "kInvEmpty");
break;
case DependencyType::kEventFlag :
debugPrintf("kEventFlag, flag %u, %s, %s",
dep.label,
g_nancy->getStaticData().eventFlagNames[dep.label].c_str(),
- dep.condition == kTrue ? "kTrue" : "kFalse");
+ dep.condition == kEvOccurred ? "kEvOccurred" : "kEvNotOccurred");
break;
case DependencyType::kLogicCondition :
debugPrintf("kLogicCondition, flag %u, %s",
dep.label,
- dep.condition == kTrue ? "kTrue" : "kFalse");
+ dep.condition == kLogUsed ? "kLogUsed" : "kLogNotUsed");
break;
case DependencyType::kTotalTime :
debugPrintf("kTotalTime, %i hours, %i minutes, %i seconds, %i milliseconds",
@@ -464,11 +464,11 @@ bool NancyConsole::Cmd_listAcionRecords(int argc, const char **argv) {
debugPrintf("kUseItem, item %u, %s, %s",
dep.label,
g_nancy->getStaticData().itemNames[dep.label].c_str(),
- dep.condition == kTrue ? "kTrue" : "kFalse");
+ dep.condition == ActionManager::kCursInvHolding ? "kCursInvHolding" : "kCursInvNotHolding");
break;
case DependencyType::kTimeOfDay :
debugPrintf("kTimeOfDay, %s",
- dep.label == 0 ? "day" : dep.label == 1 ? "night" : "dusk/dawn");
+ dep.label == 0 ? "kPlayerDay" : dep.label == 1 ? "kPLayerNight" : "kPLayerDuskDawn");
break;
case DependencyType::kTimerNotDone :
debugPrintf("kTimerNotDone");
@@ -557,7 +557,7 @@ bool NancyConsole::Cmd_getEventFlags(int argc, const char **argv) {
debugPrintf("\nFlag %u, %s, %s",
i,
g_nancy->getStaticData().eventFlagNames[i].c_str(),
- NancySceneState.getEventFlag(i) == true ? "kTrue" : "kFalse");
+ NancySceneState.getEventFlag(i) == true ? "kEvOccurred" : "kEvNotOccurred");
}
} else {
for (int i = 1; i < argc; ++i) {
@@ -569,7 +569,7 @@ bool NancyConsole::Cmd_getEventFlags(int argc, const char **argv) {
debugPrintf("\nFlag %u, %s, %s",
flagID,
g_nancy->getStaticData().eventFlagNames[flagID].c_str(),
- NancySceneState.getEventFlag(flagID) == true ? "kTrue" : "kFalse");
+ NancySceneState.getEventFlag(flagID) == true ? "kEvOccurred" : "kEvNotOccurred");
}
}
@@ -594,13 +594,13 @@ bool NancyConsole::Cmd_setEventFlags(int argc, const char **argv) {
}
if (Common::String(argv[i + 1]).compareTo("true") == 0) {
- NancySceneState.setEventFlag(flagID, Nancy::kTrue);
- debugPrintf("Set flag %i, %s, to kTrue\n",
+ NancySceneState.setEventFlag(flagID, kEvOccurred);
+ debugPrintf("Set flag %i, %s, to kEvOccurred\n",
flagID,
g_nancy->getStaticData().eventFlagNames[flagID].c_str());
} else if (Common::String(argv[i + 1]).compareTo("false") == 0) {
- NancySceneState.setEventFlag(flagID, Nancy::kFalse);
- debugPrintf("Set flag %i, %s, to kFalse\n",
+ NancySceneState.setEventFlag(flagID, kEvNotOccurred);
+ debugPrintf("Set flag %i, %s, to kEvNotOccurred\n",
flagID,
g_nancy->getStaticData().eventFlagNames[flagID].c_str());
} else {
@@ -627,7 +627,7 @@ bool NancyConsole::Cmd_getInventory(int argc, const char **argv) {
debugPrintf("\nItem %u, %s, %s",
i,
g_nancy->getStaticData().itemNames[i].c_str(),
- NancySceneState.hasItem(i) == NancyFlag::kTrue ? "kTrue" : "kFalse");
+ NancySceneState.hasItem(i) == kInvHolding ? "kInvHolding" : "kInvEmpty");
}
} else {
for (int i = 1; i < argc; ++i) {
@@ -639,7 +639,7 @@ bool NancyConsole::Cmd_getInventory(int argc, const char **argv) {
debugPrintf("\nItem %u, %s, %s",
flagID,
g_nancy->getStaticData().itemNames[flagID].c_str(),
- NancySceneState.hasItem(i) == NancyFlag::kTrue ? "kTrue" : "kFalse");
+ NancySceneState.hasItem(i) == kInvHolding ? "kInvHolding" : "kInvEmpty");
}
}
diff --git a/engines/nancy/state/map.cpp b/engines/nancy/state/map.cpp
index 8a2fedad238..ed80d2761ea 100644
--- a/engines/nancy/state/map.cpp
+++ b/engines/nancy/state/map.cpp
@@ -95,8 +95,8 @@ void Map::init() {
_button->init();
_button->setVisible(true);
- if (NancySceneState.getEventFlag(40, kTrue) && // Has set up sting
- NancySceneState.getEventFlag(95, kTrue)) { // Connie chickens
+ if (NancySceneState.getEventFlag(40, kEvOccurred) && // Has set up sting
+ NancySceneState.getEventFlag(95, kEvOccurred)) { // Connie chickens
_mapID = 1;
} else {
_mapID = 0;
diff --git a/engines/nancy/state/scene.cpp b/engines/nancy/state/scene.cpp
index 882c632b305..21864cf6016 100644
--- a/engines/nancy/state/scene.cpp
+++ b/engines/nancy/state/scene.cpp
@@ -72,7 +72,7 @@ void Scene::SceneSummary::read(Common::SeekableReadStream &stream) {
sound.read(stream, SoundDescription::kScene);
ser.skip(6);
- ser.syncAsUint16LE(dontWrap);
+ ser.syncAsUint16LE(panningType);
ser.syncAsUint16LE(numberOfVideoFrames);
ser.syncAsUint16LE(soundPanPerFrame);
ser.syncAsUint16LE(totalViewAngle);
@@ -130,7 +130,7 @@ void Scene::process() {
// fall through
case kStartSound:
_state = kRun;
- if (!_sceneState.doNotStartSound) {
+ if (_sceneState.continueSceneSound == kLoadSceneSound) {
g_nancy->_sound->stopAndUnloadSpecificSounds();
g_nancy->_sound->loadSound(_sceneState.summary.sound);
g_nancy->_sound->playSound(_sceneState.summary.sound);
@@ -171,7 +171,7 @@ void Scene::onStateExit() {
_gameStateRequested = NancyState::kNone;
}
-void Scene::changeScene(uint16 id, uint16 frame, uint16 verticalOffset, bool noSound) {
+void Scene::changeScene(uint16 id, uint16 frame, uint16 verticalOffset, byte continueSceneSound) {
if (id == 9999) {
return;
}
@@ -179,12 +179,12 @@ void Scene::changeScene(uint16 id, uint16 frame, uint16 verticalOffset, bool noS
_sceneState.nextScene.sceneID = id;
_sceneState.nextScene.frameID = frame;
_sceneState.nextScene.verticalOffset = verticalOffset;
- _sceneState.doNotStartSound = noSound;
+ _sceneState.continueSceneSound = continueSceneSound;
_state = kLoad;
}
void Scene::changeScene(const SceneChangeDescription &sceneDescription) {
- changeScene(sceneDescription.sceneID, sceneDescription.frameID, sceneDescription.verticalOffset, sceneDescription.doNotStartSound);
+ changeScene(sceneDescription.sceneID, sceneDescription.frameID, sceneDescription.verticalOffset, sceneDescription.continueSceneSound);
}
void Scene::pushScene() {
@@ -211,8 +211,8 @@ void Scene::unpauseSceneSpecificSounds() {
}
}
-void Scene::setPlayerTime(Time time, NancyFlag relative) {
- if (relative == kTrue) {
+void Scene::setPlayerTime(Time time, byte relative) {
+ if (relative == kRelativeClockBump) {
// Relative, add the specified time to current playerTime
_timers.playerTime += time;
} else {
@@ -224,7 +224,7 @@ void Scene::setPlayerTime(Time time, NancyFlag relative) {
}
void Scene::addItemToInventory(uint16 id) {
- _flags.items[id] = kTrue;
+ _flags.items[id] = kInvHolding;
if (_flags.heldItem == id) {
setHeldItem(-1);
}
@@ -233,7 +233,7 @@ void Scene::addItemToInventory(uint16 id) {
}
void Scene::removeItemFromInventory(uint16 id, bool pickUp) {
- _flags.items[id] = kFalse;
+ _flags.items[id] = kInvEmpty;
if (pickUp) {
setHeldItem(id);
@@ -246,37 +246,37 @@ void Scene::setHeldItem(int16 id) {
_flags.heldItem = id; g_nancy->_cursorManager->setCursorItemID(id);
}
-void Scene::setEventFlag(int16 label, NancyFlag flag) {
- if (label > -1 && (uint)label < g_nancy->getStaticData().numEventFlags) {
+void Scene::setEventFlag(int16 label, byte flag) {
+ if (label > kEvNoEvent && (uint)label < g_nancy->getStaticData().numEventFlags) {
_flags.eventFlags[label] = flag;
}
}
-void Scene::setEventFlag(EventFlagDescription eventFlag) {
+void Scene::setEventFlag(FlagDescription eventFlag) {
setEventFlag(eventFlag.label, eventFlag.flag);
}
-bool Scene::getEventFlag(int16 label, NancyFlag flag) const {
- if (label > -1 && (uint)label < g_nancy->getStaticData().numEventFlags) {
+bool Scene::getEventFlag(int16 label, byte flag) const {
+ if (label > kEvNoEvent && (uint)label < g_nancy->getStaticData().numEventFlags) {
return _flags.eventFlags[label] == flag;
} else {
return false;
}
}
-bool Scene::getEventFlag(EventFlagDescription eventFlag) const {
+bool Scene::getEventFlag(FlagDescription eventFlag) const {
return getEventFlag(eventFlag.label, eventFlag.flag);
}
-void Scene::setLogicCondition(int16 label, NancyFlag flag) {
- if (label > -1) {
+void Scene::setLogicCondition(int16 label, byte flag) {
+ if (label > kEvNoEvent) {
_flags.logicConditions[label].flag = flag;
_flags.logicConditions[label].timestamp = g_nancy->getTotalPlayTime();
}
}
-bool Scene::getLogicCondition(int16 label, NancyFlag flag) const {
- if (label > -1) {
+bool Scene::getLogicCondition(int16 label, byte flag) const {
+ if (label > kEvNoEvent) {
return _flags.logicConditions[label].flag == flag;
} else {
return false;
@@ -285,7 +285,7 @@ bool Scene::getLogicCondition(int16 label, NancyFlag flag) const {
void Scene::clearLogicConditions() {
for (auto &cond : _flags.logicConditions) {
- cond.flag = kFalse;
+ cond.flag = kLogNotUsed;
cond.timestamp = 0;
}
}
@@ -336,7 +336,7 @@ void Scene::synchronize(Common::Serializer &ser) {
ser.syncAsUint16LE(_sceneState.nextScene.sceneID);
ser.syncAsUint16LE(_sceneState.nextScene.frameID);
ser.syncAsUint16LE(_sceneState.nextScene.verticalOffset);
- _sceneState.doNotStartSound = false;
+ _sceneState.continueSceneSound = kContinueSceneSound;
load();
}
@@ -429,14 +429,14 @@ void Scene::synchronize(Common::Serializer &ser) {
}
void Scene::init() {
- _flags.eventFlags = Common::Array<NancyFlag>(g_nancy->getStaticData().numEventFlags, kFalse);
+ _flags.eventFlags.resize(g_nancy->getStaticData().numEventFlags, kEvNotOccurred);
// Does this ever get used?
for (uint i = 0; i < 2001; ++i) {
_flags.sceneHitCount[i] = 0;
}
- _flags.items = Common::Array<NancyFlag>(g_nancy->getStaticData().numItems, kFalse);
+ _flags.items.resize(g_nancy->getStaticData().numItems, kInvEmpty);
_timers.lastTotalTime = 0;
_timers.playerTime = g_nancy->_startTimeHours * 3600000;
@@ -445,7 +445,7 @@ void Scene::init() {
_timers.timerIsActive = false;
_timers.playerTimeNextMinute = 0;
_timers.pushedPlayTime = 0;
- _timers.timeOfDay = Timers::kDay;
+ _timers.timeOfDay = kPlayerDay;
changeScene(g_nancy->_firstScene);
@@ -512,12 +512,12 @@ void Scene::load() {
delete sceneSummaryChunk;
- debugC(0, kDebugScene, "Loading new scene %i: description \"%s\", frame %i, vertical scroll %i, doNotStartSound == %s",
+ debugC(0, kDebugScene, "Loading new scene %i: description \"%s\", frame %i, vertical scroll %i, %s",
_sceneState.nextScene.sceneID,
_sceneState.summary.description.c_str(),
_sceneState.nextScene.frameID,
_sceneState.nextScene.verticalOffset,
- _sceneState.doNotStartSound == true ? "true" : "false");
+ _sceneState.continueSceneSound == kContinueSceneSound ? "kContinueSceneSound" : "kLoadSceneSound");
_sceneState.currentScene = _sceneState.nextScene;
@@ -536,7 +536,7 @@ void Scene::load() {
_viewport.loadVideo(_sceneState.summary.videoFile,
_sceneState.currentScene.frameID,
_sceneState.currentScene.verticalOffset,
- _sceneState.summary.dontWrap,
+ _sceneState.summary.panningType,
_sceneState.summary.videoFormat,
_sceneState.summary.palettes.size() ? _sceneState.summary.palettes[_sceneState.currentScene.paletteID] : Common::String());
@@ -600,11 +600,11 @@ void Scene::run() {
// Set the time of day according to playerTime
if (_timers.playerTime.getHours() >= 7 && _timers.playerTime.getHours() < 18) {
- _timers.timeOfDay = Timers::kDay;
+ _timers.timeOfDay = kPlayerDay;
} else if (_timers.playerTime.getHours() >= 19 || _timers.playerTime.getHours() < 6) {
- _timers.timeOfDay = Timers::kNight;
+ _timers.timeOfDay = kPlayerNight;
} else {
- _timers.timeOfDay = Timers::kDuskDawn;
+ _timers.timeOfDay = kPlayerDuskDawn;
}
// Update the UI elements and handle input
@@ -700,7 +700,7 @@ void Scene::initStaticData() {
void Scene::clearSceneData() {
// Clear generic flags only
for (uint16 id : g_nancy->getStaticData().genericEventFlags) {
- _flags.eventFlags[id] = kFalse;
+ _flags.eventFlags[id] = kEvNotOccurred;
}
clearLogicConditions();
diff --git a/engines/nancy/state/scene.h b/engines/nancy/state/scene.h
index e999d00a0e9..75c064622c1 100644
--- a/engines/nancy/state/scene.h
+++ b/engines/nancy/state/scene.h
@@ -75,6 +75,10 @@ class Scene : public State, public Common::Singleton<Scene> {
friend class Nancy::NancyEngine;
public:
+ static const byte kPlayerDay = 0;
+ static const byte kPlayerNight = 1;
+ static const byte kPlayerDuskDawn = 2;
+
enum GameStateChange : byte {
kHelpMenu = 1 << 0,
kMainMenu = 1 << 1,
@@ -94,7 +98,7 @@ public:
Common::String audioFile;
SoundDescription sound;
//
- NancyFlag dontWrap;
+ byte panningType;
uint16 numberOfVideoFrames;
uint16 soundPanPerFrame;
uint16 totalViewAngle;
@@ -117,7 +121,7 @@ public:
void onStateEnter() override;
void onStateExit() override;
- void changeScene(uint16 id, uint16 frame, uint16 verticalOffset, bool noSound);
+ void changeScene(uint16 id, uint16 frame, uint16 verticalOffset, byte continueSceneSound);
void changeScene(const SceneChangeDescription &sceneDescription);
void pushScene();
void popScene();
@@ -125,21 +129,21 @@ public:
void pauseSceneSpecificSounds();
void unpauseSceneSpecificSounds();
- void setPlayerTime(Time time, NancyFlag relative);
+ void setPlayerTime(Time time, byte relative);
void addItemToInventory(uint16 id);
void removeItemFromInventory(uint16 id, bool pickUp = true);
int16 getHeldItem() const { return _flags.heldItem; }
void setHeldItem(int16 id);
- NancyFlag hasItem(int16 id) const { return _flags.items[id]; }
+ byte hasItem(int16 id) const { return _flags.items[id]; }
- void setEventFlag(int16 label, NancyFlag flag = kTrue);
- void setEventFlag(EventFlagDescription eventFlag);
- bool getEventFlag(int16 label, NancyFlag flag = kTrue) const;
- bool getEventFlag(EventFlagDescription eventFlag) const;
+ void setEventFlag(int16 label, byte flag = kEvOccurred);
+ void setEventFlag(FlagDescription eventFlag);
+ bool getEventFlag(int16 label, byte flag = kEvOccurred) const;
+ bool getEventFlag(FlagDescription eventFlag) const;
- void setLogicCondition(int16 label, NancyFlag flag = kTrue);
- bool getLogicCondition(int16 label, NancyFlag flag = kTrue) const;
+ void setLogicCondition(int16 label, byte flag = kLogUsed);
+ bool getLogicCondition(int16 label, byte flag = kLogUsed) const;
void clearLogicConditions();
void setDifficulty(uint difficulty) { _difficulty = difficulty; }
@@ -199,11 +203,10 @@ private:
SceneInfo pushedScene;
bool isScenePushed;
- bool doNotStartSound = false;
+ uint16 continueSceneSound = kLoadSceneSound;
};
struct Timers {
- enum TimeOfDay { kDay = 0, kNight = 1, kDuskDawn = 2 };
Time pushedPlayTime;
Time lastTotalTime;
Time sceneTime;
@@ -211,19 +214,19 @@ private:
bool timerIsActive = false;
Time playerTime; // In-game time of day, adds a minute every 5 seconds
Time playerTimeNextMinute; // Stores the next tick count until we add a minute to playerTime
- TimeOfDay timeOfDay = kDay;
+ byte timeOfDay = kPlayerDay;
};
struct PlayFlags {
struct LogicCondition {
- NancyFlag flag = NancyFlag::kFalse;
+ byte flag = kLogNotUsed;
Time timestamp;
};
LogicCondition logicConditions[30];
- Common::Array<NancyFlag> eventFlags;
+ Common::Array<byte> eventFlags;
uint16 sceneHitCount[2001];
- Common::Array<NancyFlag> items;
+ Common::Array<byte> items;
int16 heldItem = -1;
int16 primaryVideoResponsePicked = -1;
};
diff --git a/engines/nancy/ui/inventorybox.cpp b/engines/nancy/ui/inventorybox.cpp
index 2546ac4cf60..ba54bff79f4 100644
--- a/engines/nancy/ui/inventorybox.cpp
+++ b/engines/nancy/ui/inventorybox.cpp
@@ -89,7 +89,7 @@ void InventoryBox::init() {
_itemDescriptions.push_back(ItemDescription());
ItemDescription &desc = _itemDescriptions.back();
desc.name = Common::String(itemName);
- desc.oneTimeUse = stream.readUint16LE();
+ desc.keepItem = stream.readUint16LE();
readRect(stream, desc.sourceRect);
}
diff --git a/engines/nancy/ui/inventorybox.h b/engines/nancy/ui/inventorybox.h
index f4b9f0e4ac8..60f9484fc17 100644
--- a/engines/nancy/ui/inventorybox.h
+++ b/engines/nancy/ui/inventorybox.h
@@ -45,7 +45,7 @@ class InventoryBox : public RenderObject {
public:
struct ItemDescription {
Common::String name; // 0x00
- byte oneTimeUse = 0; // 0x14
+ byte keepItem = kInvItemUseThenLose; // 0x14
Common::Rect sourceRect; // 0x16
};
diff --git a/engines/nancy/ui/viewport.cpp b/engines/nancy/ui/viewport.cpp
index c3c819177dd..a93561c811c 100644
--- a/engines/nancy/ui/viewport.cpp
+++ b/engines/nancy/ui/viewport.cpp
@@ -180,7 +180,7 @@ void Viewport::handleInput(NancyInput &input) {
_movementLastFrame = direction;
}
-void Viewport::loadVideo(const Common::String &filename, uint frameNr, uint verticalScroll, NancyFlag dontWrap, uint16 format, const Common::String &palette) {
+void Viewport::loadVideo(const Common::String &filename, uint frameNr, uint verticalScroll, byte panningType, uint16 format, const Common::String &palette) {
if (_decoder.isVideoLoaded()) {
_decoder.close();
}
@@ -205,7 +205,7 @@ void Viewport::loadVideo(const Common::String &filename, uint frameNr, uint vert
_movementLastFrame = 0;
_nextMovementTime = 0;
- _dontWrap = dontWrap;
+ _panningType = panningType;
}
void Viewport::setPalette(const Common::String &paletteName) {
@@ -236,7 +236,7 @@ void Viewport::setFrame(uint frameNr) {
_needsRedraw = true;
_currentFrame = frameNr;
- if (_dontWrap == kTrue && !((_edgesMask & kLeft) && (_edgesMask & kRight))) {
+ if (_panningType == kPanLeftRight && !((_edgesMask & kLeft) && (_edgesMask & kRight))) {
if (_currentFrame == 0) {
disableEdges(kRight);
} else if (_currentFrame == getFrameCount() - 1) {
diff --git a/engines/nancy/ui/viewport.h b/engines/nancy/ui/viewport.h
index 70bc9f2dad1..b577ae20bc8 100644
--- a/engines/nancy/ui/viewport.h
+++ b/engines/nancy/ui/viewport.h
@@ -40,6 +40,10 @@ namespace UI {
class Viewport : public Nancy::RenderObject {
public:
+ static const byte kPanNone = 0;
+ static const byte kPan360 = 1;
+ static const byte kPanLeftRight = 2;
+
Viewport() :
RenderObject(6),
_movementLastFrame(0),
@@ -47,14 +51,14 @@ public:
_currentFrame(0),
_videoFormat(0),
_stickyCursorPos(-1, -1),
- _dontWrap(kFalse) {}
+ _panningType(kPanNone) {}
virtual ~Viewport() { _decoder.close(); _fullFrame.free(); }
void init() override;
void handleInput(NancyInput &input);
- void loadVideo(const Common::String &filename, uint frameNr = 0, uint verticalScroll = 0, NancyFlag dontWrap = kFalse, uint16 format = 2, const Common::String &palette = Common::String());
+ 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);
@@ -88,7 +92,7 @@ protected:
byte _movementLastFrame;
Time _nextMovementTime;
- NancyFlag _dontWrap;
+ byte _panningType;
AVFDecoder _decoder;
uint16 _currentFrame;
More information about the Scummvm-git-logs
mailing list