[Scummvm-git-logs] scummvm master -> b69483c4f8968467e2e30a895a7f10d2b089d70e

fracturehill noreply at scummvm.org
Thu Jul 13 15:15:46 UTC 2023


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

Summary:
5cb1c716cc NANCY: Update list_actionrecords console command
88d8864871 NANCY: Don't expect color end tag in text
9d9374bc85 NANCY: Fix non-looping overlays
16ed90c477 NANCY: Fix textbox color edge case
b69483c4f8 NANCY: Fix Telephone data reading


Commit: 5cb1c716ccd610b6b4eed2e499fe5f9ca1f2e280
    https://github.com/scummvm/scummvm/commit/5cb1c716ccd610b6b4eed2e499fe5f9ca1f2e280
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-07-13T18:13:56+03:00

Commit Message:
NANCY: Update list_actionrecords console command

Added missing dependency types to the list_actionrecords
console command, and made sure it respects the recursive
nature of dependencies in nancy3 and above. Fixed a crash
due to the event flag numbering being changed in nancy3.
Fixed a typo in the function name.

Changed paths:
    engines/nancy/console.cpp
    engines/nancy/console.h


diff --git a/engines/nancy/console.cpp b/engines/nancy/console.cpp
index 5e846292a45..268bd37e4c5 100644
--- a/engines/nancy/console.cpp
+++ b/engines/nancy/console.cpp
@@ -52,7 +52,7 @@ NancyConsole::NancyConsole() : GUI::Debugger() {
 	registerCmd("play_audio", WRAP_METHOD(NancyConsole, Cmd_playAudio));
 	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("list_actionrecords", WRAP_METHOD(NancyConsole, Cmd_listActionRecords));
 	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));
@@ -430,7 +430,102 @@ bool NancyConsole::Cmd_sceneID(int argc, const char **argv) {
 	return true;
 }
 
-bool NancyConsole::Cmd_listAcionRecords(int argc, const char **argv) {
+void NancyConsole::recurseDependencies(const Nancy::Action::DependencyRecord &record) {
+	using namespace Nancy::Action;
+
+	for (const DependencyRecord &dep : record.children) {
+		debugPrintf("\n\t\t");
+		switch (dep.type) {
+		case DependencyType::kNone :
+			debugPrintf("kNone");
+			break;
+		case DependencyType::kInventory :
+			debugPrintf("kInventory, item %u, %s, %s",
+				dep.label,
+				g_nancy->_inventoryData->itemDescriptions[dep.label].name.c_str(),
+				dep.condition == g_nancy->_true ? "true" : "false");
+			break;
+		case DependencyType::kEvent :
+			debugPrintf("kEvent, flag %u, %s, %s",
+				dep.label,
+				g_nancy->getStaticData().eventFlagNames[dep.label > 1000 ? dep.label - 1000 : dep.label].c_str(),
+				dep.condition == g_nancy->_true ? "true" : "false");
+			break;
+		case DependencyType::kLogic :
+			debugPrintf("kLogic, flag %u, %s",
+				dep.label,
+				dep.condition == g_nancy->_true ? "used" : "not used");
+			break;
+		case DependencyType::kElapsedGameTime :
+			debugPrintf("kElapsedGameTime, %i hours, %i minutes, %i seconds, %i milliseconds",
+				dep.hours,
+				dep.minutes,
+				dep.seconds,
+				dep.milliseconds);
+			break;
+		case DependencyType::kElapsedSceneTime :
+			debugPrintf("kElapsedSceneTime, %i hours, %i minutes, %i seconds, %i milliseconds",
+				dep.hours,
+				dep.minutes,
+				dep.seconds,
+				dep.milliseconds);
+			break;
+		case DependencyType::kElapsedPlayerTime :
+			debugPrintf("kPlayerTime, %i hours, %i minutes, %i seconds, %i milliseconds",
+				dep.hours,
+				dep.minutes,
+				dep.seconds,
+				dep.milliseconds);
+			break;
+		case DependencyType::kSceneCount :
+			debugPrintf("kSceneCount, scene ID %i, hit count %s %i",
+				dep.hours,
+				dep.milliseconds == 1 ? ">" : dep.milliseconds == 2 ? "<" : "==",
+				dep.seconds);
+			break;
+		case DependencyType::kElapsedPlayerDay :
+			debugPrintf("kElapsedPlayerDay");
+			break;
+		case DependencyType::kCursorType :
+			debugPrintf("kCursorType, item %u, %s, %s",
+				dep.label,
+				g_nancy->_inventoryData->itemDescriptions[dep.label].name.c_str(),
+				dep.condition == ActionManager::kCursInvHolding ? "kCursInvHolding" : "kCursInvNotHolding");
+			break;
+		case DependencyType::kPlayerTOD :
+			debugPrintf("kPlayerTOD, %s",
+				dep.label == 0 ? "kPlayerDay" : dep.label == 1 ? "kPLayerNight" : "kPLayerDuskDawn");
+			break;
+		case DependencyType::kTimerLessThanDependencyTime :
+			debugPrintf("kTimerLessThanDependencyTime");
+			break;
+		case DependencyType::kTimerGreaterThanDependencyTime :
+			debugPrintf("kTimerGreaterThanDependencyTime");
+			break;
+		case DependencyType::kDifficultyLevel :
+			debugPrintf("kDifficultyLevel, level %i", dep.condition);
+			break;
+		case DependencyType::kClosedCaptioning :
+			debugPrintf("kClosedCaptioning, %s", dep.condition == 2 ? "true" : "false");
+			break;
+		case DependencyType::kSound :
+			debugPrintf("kSound, channel %i", dep.condition);
+			break;
+		case DependencyType::kOpenParenthesis :
+			debugPrintf("((((((((\n");
+			recurseDependencies(dep);
+			debugPrintf("\n))))))))");
+			break;
+		default:
+			debugPrintf("unknown type %u", (uint)dep.type);
+			break;
+		}
+
+		debugPrintf("\n\t\t\torFlag == %s", dep.orFlag == true ? "true" : "false");
+	}
+}
+
+bool NancyConsole::Cmd_listActionRecords(int argc, const char **argv) {
 	using namespace Nancy::Action;
 
 	if (g_nancy->_gameFlow.curState != NancyState::kScene) {
@@ -452,85 +547,7 @@ bool NancyConsole::Cmd_listAcionRecords(int argc, const char **argv) {
 		if (rec->_dependencies.children.size()) {
 			debugPrintf("\n\tDependencies:");
 
-			for (DependencyRecord &dep : rec->_dependencies.children) {
-				debugPrintf("\n\t\t");
-				switch (dep.type) {
-				case DependencyType::kNone :
-					debugPrintf("kNone");
-					break;
-				case DependencyType::kInventory :
-					debugPrintf("kInventory, item %u, %s, %s",
-						dep.label,
-						g_nancy->_inventoryData->itemDescriptions[dep.label].name.c_str(),
-						dep.condition == g_nancy->_true ? "true" : "false");
-					break;
-				case DependencyType::kEvent :
-					debugPrintf("kEvent, flag %u, %s, %s",
-						dep.label,
-						g_nancy->getStaticData().eventFlagNames[dep.label].c_str(),
-						dep.condition == g_nancy->_true ? "true" : "false");
-					break;
-				case DependencyType::kLogic :
-					debugPrintf("kLogic, flag %u, %s",
-						dep.label,
-						dep.condition == g_nancy->_true ? "used" : "not used");
-					break;
-				case DependencyType::kElapsedGameTime :
-					debugPrintf("kElapsedGameTime, %i hours, %i minutes, %i seconds, %i milliseconds",
-						dep.hours,
-						dep.minutes,
-						dep.seconds,
-						dep.milliseconds);
-					break;
-				case DependencyType::kElapsedSceneTime :
-					debugPrintf("kElapsedSceneTime, %i hours, %i minutes, %i seconds, %i milliseconds",
-						dep.hours,
-						dep.minutes,
-						dep.seconds,
-						dep.milliseconds);
-					break;
-				case DependencyType::kElapsedPlayerTime :
-					debugPrintf("kPlayerTime, %i hours, %i minutes, %i seconds, %i milliseconds",
-						dep.hours,
-						dep.minutes,
-						dep.seconds,
-						dep.milliseconds);
-					break;
-				case DependencyType::kSceneCount :
-					debugPrintf("kSceneCount, scene ID %i, hit count %s %i",
-						dep.hours,
-						dep.milliseconds == 1 ? ">" : dep.milliseconds == 2 ? "<" : "==",
-						dep.seconds);
-					break;
-				case DependencyType::kElapsedPlayerDay :
-					debugPrintf("kElapsedPlayerDay");
-					break;
-				case DependencyType::kCursorType :
-					debugPrintf("kCursorType, item %u, %s, %s",
-						dep.label,
-						g_nancy->_inventoryData->itemDescriptions[dep.label].name.c_str(),
-						dep.condition == ActionManager::kCursInvHolding ? "kCursInvHolding" : "kCursInvNotHolding");
-					break;
-				case DependencyType::kPlayerTOD :
-					debugPrintf("kPlayerTOD, %s",
-						dep.label == 0 ? "kPlayerDay" : dep.label == 1 ? "kPLayerNight" : "kPLayerDuskDawn");
-					break;
-				case DependencyType::kTimerLessThanDependencyTime :
-					debugPrintf("kTimerLessThanDependencyTime");
-					break;
-				case DependencyType::kTimerGreaterThanDependencyTime :
-					debugPrintf("kTimerGreaterThanDependencyTime");
-					break;
-				case DependencyType::kDifficultyLevel :
-					debugPrintf("kDifficultyLevel, level %i", dep.condition);
-					break;
-				default:
-					debugPrintf("unknown type %u", (uint)dep.type);
-					break;
-				}
-
-				debugPrintf("\n\t\t\torFlag == %s", dep.orFlag == true ? "true" : "false");
-			}
+			recurseDependencies(rec->_dependencies);
 		}
 
 		debugPrintf("\n\n");
diff --git a/engines/nancy/console.h b/engines/nancy/console.h
index 3265600a596..e8e93fd7d4e 100644
--- a/engines/nancy/console.h
+++ b/engines/nancy/console.h
@@ -26,6 +26,10 @@
 
 namespace Nancy {
 
+namespace Action {
+struct DependencyRecord;
+}
+
 class NancyEngine;
 
 class NancyConsole : public GUI::Debugger {
@@ -49,7 +53,7 @@ private:
 	bool Cmd_playAudio(int argc, const char **argv);
 	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_listActionRecords(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);
@@ -60,6 +64,8 @@ private:
 	bool Cmd_getDifficulty(int argc, const char **argv);
 	bool Cmd_setDifficulty(int argc, const char **argv);
 
+	void recurseDependencies(const Nancy::Action::DependencyRecord &record);
+
 	Common::String _videoFile;
 	Common::String _imageFile;
 	Common::String _paletteFile;


Commit: 88d886487196b441d54d38fb5f478684c493d935
    https://github.com/scummvm/scummvm/commit/88d886487196b441d54d38fb5f478684c493d935
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-07-13T18:13:57+03:00

Commit Message:
NANCY: Don't expect color end tag in text

Fixed a crash that resulted from the expectation that
a color begin token is always matched with a color end token
inside textbox text.

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


diff --git a/engines/nancy/ui/textbox.cpp b/engines/nancy/ui/textbox.cpp
index eec7d1e6560..bba75adf1bb 100644
--- a/engines/nancy/ui/textbox.cpp
+++ b/engines/nancy/ui/textbox.cpp
@@ -206,7 +206,13 @@ void Textbox::drawTextbox() {
 			colorTokens.push(newLinePos);
 
 			newLinePos = currentLine.find(_colorEndToken);
-			currentLine.erase(newLinePos, ARRAYSIZE(_colorEndToken) - 1);
+
+			if (newLinePos != Common::String::npos) {
+				currentLine.erase(newLinePos, ARRAYSIZE(_colorEndToken) - 1);
+			} else {
+				// If we find no color end token we assume the whole line needs to be colored
+				newLinePos = currentLine.size();
+			}
 			colorTokens.push(newLinePos);
 		}
 


Commit: 9d9374bc853d4505ac60bc87031ec1cd46b4fd5b
    https://github.com/scummvm/scummvm/commit/9d9374bc853d4505ac60bc87031ec1cd46b4fd5b
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-07-13T18:13:57+03:00

Commit Message:
NANCY: Fix non-looping overlays

Fixed an edge case where a non-looping overlay would
still loop if the sound file is longer than the animation.
This fixes the chandelier dangling animations in nancy3.

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


diff --git a/engines/nancy/action/overlay.cpp b/engines/nancy/action/overlay.cpp
index 8ad03b00306..c9993338a8c 100644
--- a/engines/nancy/action/overlay.cpp
+++ b/engines/nancy/action/overlay.cpp
@@ -61,11 +61,11 @@ void Overlay::readData(Common::SeekableReadStream &stream) {
 	ser.syncAsUint16LE(_firstFrame);
 	ser.syncAsUint16LE(_loopFirstFrame);
 	ser.syncAsUint16LE(_loopLastFrame);
-	uint16 frameTime = stream.readUint16LE();
+	uint16 framesPerSec = stream.readUint16LE();
 	
 	// Avoid divide by 0
-	if (frameTime) {
-		_frameTime = Common::Rational(1000, frameTime).toInt();
+	if (framesPerSec) {
+		_frameTime = Common::Rational(1000, framesPerSec).toInt();
 	}
 	
 	ser.syncAsUint16LE(_z, kGameTypeNancy1, kGameTypeNancy1);
@@ -149,11 +149,21 @@ void Overlay::execute() {
 				uint16 nextFrame = _currentFrame;
 
 				if (_playDirection == kPlayOverlayReverse) {
-					--nextFrame;
-					nextFrame = nextFrame < _loopFirstFrame ? _loopLastFrame : nextFrame;
+					if (nextFrame - 1 < _loopFirstFrame) {
+						if (_loop == kPlayOverlayLoop) {
+							nextFrame = _loopLastFrame;
+						}
+					} else {
+						--nextFrame;
+					}
 				} else {
-					++nextFrame;
-					nextFrame = nextFrame > _loopLastFrame ? _loopFirstFrame : nextFrame;
+					if (nextFrame + 1 > _loopLastFrame) {
+						if (_loop == kPlayOverlayLoop) {
+							nextFrame = _loopFirstFrame;
+						}
+					} else {
+						++nextFrame;
+					}
 				}
 
 				setFrame(nextFrame);


Commit: 16ed90c47719ca483a8ead92090fcd31ec56bd48
    https://github.com/scummvm/scummvm/commit/16ed90c47719ca483a8ead92090fcd31ec56bd48
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-07-13T18:13:57+03:00

Commit Message:
NANCY: Fix textbox color edge case

Fixed an edge case where color wouldn't get toggled
correctly in the textbox drawing function. This fixes the
lose game dialogue when unhooking the chandelier
in nancy3.

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


diff --git a/engines/nancy/ui/textbox.cpp b/engines/nancy/ui/textbox.cpp
index bba75adf1bb..e5f83a7caef 100644
--- a/engines/nancy/ui/textbox.cpp
+++ b/engines/nancy/ui/textbox.cpp
@@ -253,7 +253,7 @@ void Textbox::drawTextbox() {
 				if (colorTokens.size()) {
 					// Text contains color part
 
-					if (totalCharsDrawn == colorTokens.front()) {
+					if (totalCharsDrawn >= colorTokens.front()) {
 						// Token is at begginning of (what's left of) the current line
 						isColor = !isColor;
 						colorTokens.pop();


Commit: b69483c4f8968467e2e30a895a7f10d2b089d70e
    https://github.com/scummvm/scummvm/commit/b69483c4f8968467e2e30a895a7f10d2b089d70e
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-07-13T18:13:57+03:00

Commit Message:
NANCY: Fix Telephone data reading

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


diff --git a/engines/nancy/action/telephone.cpp b/engines/nancy/action/telephone.cpp
index 9b269f2b728..1e63f72696d 100644
--- a/engines/nancy/action/telephone.cpp
+++ b/engines/nancy/action/telephone.cpp
@@ -47,22 +47,12 @@ void Telephone::init() {
 void Telephone::readData(Common::SeekableReadStream &stream) {
 	readFilename(stream, _imageName);
 
-	_srcRects.reserve(12);
-	for (uint i = 0; i < 12; ++i) {
-		_srcRects.push_back(Common::Rect());
-		readRect(stream, _srcRects.back());
-	}
+	readRectArray(stream, _srcRects, 12);
+	readRectArray(stream, _destRects, 12);
 
-	_destRects.reserve(12);
+	_screenPosition = _destRects[0];
 	for (uint i = 0; i < 12; ++i) {
-		_destRects.push_back(Common::Rect());
-		readRect(stream, _destRects.back());
-
-		if (i == 0) {
-			_screenPosition = _destRects.back();
-		} else {
-			_screenPosition.extend(_destRects.back());
-		}
+		_screenPosition.extend(_destRects[i]);
 	}
 
 	_genericDialogueSound.readNormal(stream);
@@ -72,12 +62,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 	_dialAgainSound.readNormal(stream);
 	_hangUpSound.readNormal(stream);
 
-	_buttonSoundNames.reserve(12);
-	for (uint i = 0; i < 12; ++i) {
-		Common::String buttonSoundName;
-		readFilename(stream, buttonSoundName);
-		_buttonSoundNames.push_back(buttonSoundName);
-	}
+	readFilenameArray(stream, _buttonSoundNames, 12);
 
 	char textBuf[200];
 	stream.read(textBuf, 200);
@@ -87,19 +72,20 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 	textBuf[199] = '\0';
 	_dialAgainString = textBuf;
 	_reloadScene.readData(stream);
+	stream.skip(1);
 	_exitScene.readData(stream);
+	stream.skip(1);
 	readRect(stream, _exitHotspot);
 
 	uint numCalls = stream.readUint16LE();
 
-	_calls.reserve(numCalls);
+	_calls.resize(numCalls);
 	for (uint i = 0; i < numCalls; ++i) {
-		_calls.push_back(PhoneCall());
-		PhoneCall &call = _calls.back();
+		PhoneCall &call = _calls[i];
 
-		call.phoneNumber.reserve(11);
+		call.phoneNumber.resize(11);
 		for (uint j = 0; j < 11; ++j) {
-			call.phoneNumber.push_back(stream.readByte());
+			call.phoneNumber[j] = stream.readByte();
 		}
 
 		readFilename(stream, call.soundName);
@@ -107,6 +93,7 @@ void Telephone::readData(Common::SeekableReadStream &stream) {
 		textBuf[199] = '\0';
 		call.text = textBuf;
 		call.sceneChange.readData(stream);
+		stream.skip(1);
 	}
 }
 




More information about the Scummvm-git-logs mailing list