[Scummvm-git-logs] scummvm master -> 4bc0670f986555b76f3a3bcd74bc953ecd133a38

fracturehill noreply at scummvm.org
Sat Jan 6 23:44:57 UTC 2024


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

Summary:
eb5c5e72c6 NANCY: Fix PasswordPuzzle max input length
4bc0670f98 NANCY: Make sure TurningPuzzle triggers flag


Commit: eb5c5e72c6498f6fee3c4f1564187c39d1638f7e
    https://github.com/scummvm/scummvm/commit/eb5c5e72c6498f6fee3c4f1564187c39d1638f7e
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-01-07T00:44:39+01:00

Commit Message:
NANCY: Fix PasswordPuzzle max input length

This fixes the level 2 quiz in nancy6.

Changed paths:
    engines/nancy/action/puzzle/passwordpuzzle.cpp
    engines/nancy/action/puzzle/passwordpuzzle.h


diff --git a/engines/nancy/action/puzzle/passwordpuzzle.cpp b/engines/nancy/action/puzzle/passwordpuzzle.cpp
index b77360cd971..45e5917391b 100644
--- a/engines/nancy/action/puzzle/passwordpuzzle.cpp
+++ b/engines/nancy/action/puzzle/passwordpuzzle.cpp
@@ -62,8 +62,6 @@ void PasswordPuzzle::readData(Common::SeekableReadStream &stream) {
 		stream.read(buf, fieldSize);
 		buf[fieldSize - 1] = '\0';
 		_names[i] = buf;
-
-		_maxNameLength = MAX(_maxNameLength, _names[i].size());
 	}
 	s.skip((5 - numNames) * fieldSize, kGameTypeNancy4);
 
@@ -73,11 +71,11 @@ void PasswordPuzzle::readData(Common::SeekableReadStream &stream) {
 		stream.read(buf, fieldSize);
 		buf[19] = '\0';
 		_passwords[i] = buf;
-
-		_maxPasswordLength = MAX(_maxPasswordLength, _passwords[i].size());
 	}
 	s.skip((5 - numPasswords) * fieldSize, kGameTypeNancy4);
 
+	_maxStringLength = g_nancy->getGameType() < kGameTypeNancy6 ? 12 : 31;
+
 	_solveExitScene.readData(stream);
 	_solveSound.readNormal(stream);
 	_failExitScene.readData(stream);
@@ -202,11 +200,10 @@ void PasswordPuzzle::handleInput(NancyInput &input) {
 	for (uint i = 0; i < input.otherKbdInput.size(); ++i) {
 		Common::KeyState &key = input.otherKbdInput[i];
 		Common::String &activeField = _passwordFieldIsActive ? _playerPasswordInput : _playerNameInput;
-		uint &maxLength = _passwordFieldIsActive ? _maxPasswordLength : _maxNameLength;
 		if (key.keycode == Common::KEYCODE_BACKSPACE) {
 			if (activeField.size() && activeField.lastChar() == '-' ? activeField.size() > 1 : true) {
 				if (activeField.lastChar() == '-') {
-					activeField.deleteChar(activeField.size() -2);
+					activeField.deleteChar(activeField.size() - 2);
 				} else {
 					activeField.deleteLastChar();
 				}
@@ -217,13 +214,13 @@ void PasswordPuzzle::handleInput(NancyInput &input) {
 			_playerHasHitReturn = true;
 		} else if (Common::isAlnum(key.ascii) || Common::isSpace(key.ascii)) {
 			if (activeField.size() && activeField.lastChar() == '-') {
-				if (activeField.size() <= maxLength + 2) {
+				if (activeField.size() <= _maxStringLength + 1) {
 					activeField.deleteLastChar();
 					activeField += key.ascii;
 					activeField += '-';
 				}
 			} else {
-				if (activeField.size() <= maxLength + 1) {
+				if (activeField.size() <= _maxStringLength) {
 					activeField += key.ascii;
 				}
 			}
diff --git a/engines/nancy/action/puzzle/passwordpuzzle.h b/engines/nancy/action/puzzle/passwordpuzzle.h
index 17780039ee1..9eca5bd9469 100644
--- a/engines/nancy/action/puzzle/passwordpuzzle.h
+++ b/engines/nancy/action/puzzle/passwordpuzzle.h
@@ -60,8 +60,7 @@ public:
 	bool _playerHasHitReturn = false;
 	SolveState _solveState = kNotSolved;
 
-	uint _maxNameLength = 0;
-	uint _maxPasswordLength = 0;
+	uint _maxStringLength = 0;
 
 protected:
 	Common::String getRecordTypeName() const override { return "PasswordPuzzle"; }


Commit: 4bc0670f986555b76f3a3bcd74bc953ecd133a38
    https://github.com/scummvm/scummvm/commit/4bc0670f986555b76f3a3bcd74bc953ecd133a38
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-01-07T00:44:39+01:00

Commit Message:
NANCY: Make sure TurningPuzzle triggers flag

Solving a TurningPuzzle without an animation (e.g. the
crossed eyes box in nancy6) would previously not trigger
the solve flag, rendering the puzzle unsolveable. This has
now been fixed.

Changed paths:
    engines/nancy/action/puzzle/turningpuzzle.cpp


diff --git a/engines/nancy/action/puzzle/turningpuzzle.cpp b/engines/nancy/action/puzzle/turningpuzzle.cpp
index 0d6da0013ef..75b8e4e8ed9 100644
--- a/engines/nancy/action/puzzle/turningpuzzle.cpp
+++ b/engines/nancy/action/puzzle/turningpuzzle.cpp
@@ -208,7 +208,12 @@ void TurningPuzzle::execute() {
 
 		if (_currentOrder == _correctOrder) {
 			_state = kActionTrigger;
-			_solveState = _solveAnimate ? kWaitForAnimation : kWaitForSound;
+			if (_solveAnimate) {
+				_solveState = kWaitForAnimation;
+			} else {
+				_solveState = kWaitForSound;
+				NancySceneState.setEventFlag(_solveScene._flag);
+			}
 			_objectCurrentlyTurning = -1;
 			_turnFrameID = 0;
 			_nextTurnTime = g_nancy->getTotalPlayTime() + (_solveDelayBetweenTurns * 1000 / _currentOrder.size());




More information about the Scummvm-git-logs mailing list