[Scummvm-git-logs] scummvm master -> 102685138a1d165833d4c80a7414977c9258fb6f

athrxx athrxx at scummvm.org
Fri Jul 9 23:10:26 UTC 2021


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:
49c62b319d SCUMM: minor walk code cleanup
61d163ac98 SCUMM: silence two MSVC warnings
68f6a17bba KYRA: fix character encoding in GMM save description
44bfd2a220 COMMON: remove Encoding leftovers
102685138a KYRA: improve handling of UTF save descriptions


Commit: 49c62b319d9bdc42d30ed4f39a0b3ed41fe0ff86
    https://github.com/scummvm/scummvm/commit/49c62b319d9bdc42d30ed4f39a0b3ed41fe0ff86
Author: athrxx (athrxx at scummvm.org)
Date: 2021-07-10T01:10:04+02:00

Commit Message:
SCUMM: minor walk code cleanup

(remove remainders of obsolete workaround for zeppelin maze - I have tested the maze, it works fine)

Changed paths:
    engines/scumm/boxes.cpp


diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp
index 0b5f5d6b3d..fcc5941b91 100644
--- a/engines/scumm/boxes.cpp
+++ b/engines/scumm/boxes.cpp
@@ -1251,26 +1251,11 @@ void Actor_v3::findPathTowardsOld(byte box1, byte box2, byte finalBox, Common::P
 	p2.x = 32000;
 	p3.x = 32000;
 
-	// next box (box2) = final box?
 	if (box2 == finalBox) {
-		// I have commented out the mask check for INDY3 which was meant as a fix for the zeppeline path finding. But it
-		// is wrong and causes issues (e. g. bug #12666 - when Indy starts walking away from the window he will be facing
-		// down instead of right; the mask check is not the cause of all the problems that particular scene had, but at
-		// least some of them). At first glance at disasm it might seem that the original would do such a check, since it
-		// actually calls getMaskFromBox() for both boxes. However, the results do not get evaluated. Looks like some
-		// leftover code...
-
-		// In Indy3, the masks (= z-level) have to match, too -- needed for the
-		// 'maze' in the zeppelin (see bug #1778).
-		//if (_vm->_game.id != GID_INDY3 || _vm->getMaskFromBox(box1) == _vm->getMaskFromBox(box2)) {
-			// Is the actor (x,y) between both gates?
-			if (compareSlope(_pos, _walkdata.dest, gateA[0]) !=
-					compareSlope(_pos, _walkdata.dest, gateB[0]) &&
-					compareSlope(_pos, _walkdata.dest, gateA[1]) !=
-					compareSlope(_pos, _walkdata.dest, gateB[1])) {
+		// Is the actor (x,y) between both gates?
+		if (compareSlope(_pos, _walkdata.dest, gateA[0]) !=	compareSlope(_pos, _walkdata.dest, gateB[0]) &&
+			compareSlope(_pos, _walkdata.dest, gateA[1]) !=	compareSlope(_pos, _walkdata.dest, gateB[1]))
 				return;
-			}
-		//}
 	}
 
 	p3 = closestPtOnLine(gateA[1], gateB[1], _pos);


Commit: 61d163ac98faefccd6a9c3f088023bdc5d591526
    https://github.com/scummvm/scummvm/commit/61d163ac98faefccd6a9c3f088023bdc5d591526
Author: athrxx (athrxx at scummvm.org)
Date: 2021-07-10T01:10:04+02:00

Commit Message:
SCUMM: silence two MSVC warnings

Changed paths:
    engines/scumm/actor.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 364a51092e..67e8e3f2a3 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -494,8 +494,12 @@ int Actor::calcMovementFactor(const Common::Point& next) {
 
 		_v3stepX = ((ABS(diffY) / (int)_speedy) >> 1) > (ABS(diffX) / (int)_speedx) ? _speedy + 1 : _speedx;
 		_v3stepThreshold = MAX(ABS(diffY) / _speedy, ABS(diffX) / _v3stepX);
-		deltaXFactor = diffX < 0 ? -_v3stepX : _v3stepX;
-		deltaYFactor = diffY < 0 ? -_speedy : _speedy;
+		deltaXFactor = (int32)_v3stepX;
+		if (diffX < 0)
+			deltaXFactor = -deltaXFactor;
+		deltaYFactor = (int32)_speedy;
+		if (diffY < 0)
+			deltaYFactor = -deltaYFactor;
 		_walkdata.xfrac = _walkdata.v3XAdd = diffX / deltaXFactor;
 		_walkdata.yfrac = _walkdata.v3YAdd = diffY / deltaYFactor;
 	} else {
@@ -609,6 +613,9 @@ int Actor::actorWalkStep() {
 		_pos.y = (tmpY / (1 << 16));
 	}
 
+	if (_number == 10)
+	debug("ACTOR: %02d, X: %02d, Y: %02d", _number, _pos.x, _pos.y);
+
 	if (ABS(_pos.x - _walkdata.cur.x) > distX) {
 		_pos.x = _walkdata.next.x;
 	}


Commit: 68f6a17bbae78981a0fc4e091fa683951422540d
    https://github.com/scummvm/scummvm/commit/68f6a17bbae78981a0fc4e091fa683951422540d
Author: athrxx (athrxx at scummvm.org)
Date: 2021-07-10T01:10:04+02:00

Commit Message:
KYRA: fix character encoding in GMM save description

(special characters would not show properly in GMM save dialog due to the way the string was converted from Common::String to Common::U32String)

Changed paths:
    engines/kyra/metaengine.cpp


diff --git a/engines/kyra/metaengine.cpp b/engines/kyra/metaengine.cpp
index f2c1686ac8..0f443abdff 100644
--- a/engines/kyra/metaengine.cpp
+++ b/engines/kyra/metaengine.cpp
@@ -162,7 +162,7 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const {
 					if (slotNum == 0 && header.gameID == Kyra::GI_KYRA3)
 						header.description = "New Game";
 
-					saveList.push_back(SaveStateDescriptor(slotNum, header.description));
+					saveList.push_back(SaveStateDescriptor(slotNum, header.description.decode(Common::kISO8859_1)));
 				}
 				delete in;
 			}


Commit: 44bfd2a22048685b4e20307a04aeb351758e37ef
    https://github.com/scummvm/scummvm/commit/44bfd2a22048685b4e20307a04aeb351758e37ef
Author: athrxx (athrxx at scummvm.org)
Date: 2021-07-10T01:10:04+02:00

Commit Message:
COMMON: remove Encoding leftovers

(class does not exist any more)

Changed paths:
    common/system.h


diff --git a/common/system.h b/common/system.h
index 02ed5cf772..80df922024 100644
--- a/common/system.h
+++ b/common/system.h
@@ -67,7 +67,6 @@ class WriteStream;
 class HardwareInputSet;
 class Keymap;
 class KeymapperDefaultBindings;
-class Encoding;
 
 typedef Array<Keymap *> KeymapArray;
 }
@@ -138,7 +137,6 @@ enum Type {
  * - Sound output
  */
 class OSystem : Common::NonCopyable {
-	friend class Common::Encoding;
 protected:
 	OSystem();
 	virtual ~OSystem();


Commit: 102685138a1d165833d4c80a7414977c9258fb6f
    https://github.com/scummvm/scummvm/commit/102685138a1d165833d4c80a7414977c9258fb6f
Author: athrxx (athrxx at scummvm.org)
Date: 2021-07-10T01:10:05+02:00

Commit Message:
KYRA: improve handling of UTF save descriptions

This tries to make sure that UTF save descriptions with special characters don't break ingame saveload dialogs.

Changed paths:
    engines/kyra/gui/gui_eob.cpp
    engines/kyra/gui/gui_lok.cpp
    engines/kyra/gui/gui_lol.cpp
    engines/kyra/gui/gui_v2.cpp
    engines/kyra/kyra_v1.h


diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index 90ee807073..59e8cb1911 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -4443,6 +4443,7 @@ void GUI_EoB::drawSaveSlotButton(int slot, int redrawBox, bool highlight) {
 	int y = _saveSlotY + slot * 17 + 20;
 	int w = 167;
 	char slotString[26];
+	memset(slotString, 0, 26);
 	Common::strlcpy(slotString, slot < _numSlotsVisible ? _saveSlotStringsTemp[slot] : _vm->_saveLoadStrings[0], _vm->gameFlags().platform == Common::kPlatformFMTowns ? 25 : 20);
 
 	if (slot >= 6) {
@@ -4589,7 +4590,17 @@ void GUI_EoB::setupSaveMenuSlots() {
 	for (int i = 0; i < _numSlotsVisible; ++i) {
 		if (_savegameOffset + i < _savegameListSize) {
 			if (_savegameList[i + _savegameOffset]) {
+				memset(_saveSlotStringsTemp[i], 0, 25);
 				Common::strlcpy(_saveSlotStringsTemp[i], _savegameList[i + _savegameOffset], 25);
+
+				if (_vm->gameFlags().platform == Common::kPlatformPC98 || _vm->gameFlags().platform == Common::kPlatformFMTowns || (_vm->gameFlags().platform == Common::kPlatformSegaCD && _vm->gameFlags().lang != Common::JA_JPN)) {
+					// Clean out special characters from GMM save dialog which might get misinterpreted as SJIS
+					for (uint ii = 0; ii < strlen(_saveSlotStringsTemp[i]); ++ii) {
+						if (_saveSlotStringsTemp[i][ii] < 32 && _saveSlotStringsTemp[i][ii] != '\r') // due to the signed char type this will also clean up everything >= 0x80
+							_saveSlotStringsTemp[i][ii] = ' ';
+					}
+				}
+
 				_saveSlotIdTemp[i] = i + _savegameOffset;
 				continue;
 			}
diff --git a/engines/kyra/gui/gui_lok.cpp b/engines/kyra/gui/gui_lok.cpp
index 680e72c75a..89c0dbea34 100644
--- a/engines/kyra/gui/gui_lok.cpp
+++ b/engines/kyra/gui/gui_lok.cpp
@@ -580,6 +580,13 @@ void GUI_LoK::setupSavegames(Menu &menu, int num) {
 			_screen->_charSpacing = 0;
 
 			Util::convertISOToDOS(_savegameNames[i]);
+			if (_vm->gameFlags().lang == Common::JA_JPN) {
+				// Clean out special characters from GMM save dialog which might get misinterpreted as SJIS
+				for (uint ii = 0; ii < strlen(_savegameNames[i]); ++ii) {
+					if (_savegameNames[i][ii] < 32) // due to the signed char type this will also clean up everything >= 0x80
+						_savegameNames[i][ii] = ' ';
+				}
+			}
 
 			menu.item[i].itemString = _savegameNames[i];
 			menu.item[i].enabled = 1;
diff --git a/engines/kyra/gui/gui_lol.cpp b/engines/kyra/gui/gui_lol.cpp
index 25ec40469b..efd6894531 100644
--- a/engines/kyra/gui/gui_lol.cpp
+++ b/engines/kyra/gui/gui_lol.cpp
@@ -2529,6 +2529,14 @@ void GUI_LoL::setupSaveMenuSlots(Menu &menu, int num) {
 				fC = _screen->getTextWidth(s);
 			}
 
+			if (_vm->gameFlags().lang == Common::JA_JPN) {
+				// Clean out special characters from GMM save dialog which might get misinterpreted as SJIS
+				for (uint ii = 0; ii < strlen(s); ++ii) {
+					if (s[ii] < 32) // due to the signed char type this will also clean up everything >= 0x80
+						s[ii] = ' ';
+				}
+			}
+
 			menu.item[i].itemString = s;
 			s += (strlen(s) + 1);
 			menu.item[i].saveSlot = _saveSlots[i + _savegameOffset - slotOffs];
diff --git a/engines/kyra/gui/gui_v2.cpp b/engines/kyra/gui/gui_v2.cpp
index b4a3578c24..3db76cf7eb 100644
--- a/engines/kyra/gui/gui_v2.cpp
+++ b/engines/kyra/gui/gui_v2.cpp
@@ -447,6 +447,14 @@ void GUI_v2::setupSavegameNames(Menu &menu, int num) {
 			Common::String s = header.description;
 			s = Util::convertISOToDOS(s);
 
+			if (_vm->gameFlags().lang == Common::JA_JPN || _vm->gameFlags().lang == Common::ZH_CNA || _vm->gameFlags().lang == Common::ZH_TWN) {
+				// Clean out special characters from GMM save dialog which might get misinterpreted as SJIS
+				for (Common::String::iterator ii = s.begin(); ii != s.end(); ++ii) {
+					if (*ii < 32) // due to the signed char type this will also clean up everything >= 0x80
+						*ii = ' ';
+				}
+			}
+
 			// Trim long GMM save descriptions to fit our save slots
 			_screen->_charSpacing = -2;
 			int fC = _screen->getTextWidth(s.c_str());
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index 591126db14..0c39e9283b 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -379,7 +379,7 @@ protected:
 	void loadGameStateCheck(int slot);
 	Common::Error loadGameState(int slot) override = 0;
 	Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override {
-		return saveGameStateIntern(slot, desc.c_str(), 0);
+		return saveGameStateIntern(slot, Common::U32String(desc).encode(Common::kISO8859_1).c_str(), 0);
 	}
 	virtual Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail) = 0;
 




More information about the Scummvm-git-logs mailing list