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

athrxx athrxx at scummvm.org
Thu Jul 15 23:10:23 UTC 2021


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:
e0db30fb8f SCUMM: (SCUMM3) - add new walking code vars to save/load function
dcf5a40f03 SAGA: fix encodings of save descriptions


Commit: e0db30fb8f0b83ad9f994fb83f9f56982fc171ec
    https://github.com/scummvm/scummvm/commit/e0db30fb8f0b83ad9f994fb83f9f56982fc171ec
Author: athrxx (athrxx at scummvm.org)
Date: 2021-07-16T01:07:13+02:00

Commit Message:
SCUMM: (SCUMM3) - add new walking code vars to save/load function

(also recalculate these vars when loading old savegames)

Changed paths:
    engines/scumm/actor.cpp
    engines/scumm/saveload.cpp


diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index aaf7829757..6dc5ca1f4d 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -3744,6 +3744,28 @@ void Actor::saveLoadWithSerializer(Common::Serializer &s) {
 
 		setDirection(_facing);
 	}
+
+	if (_vm->_game.version == 3) {
+		if (s.isLoading() && s.getVersion() < VER(101)) {
+			int diffX = _walkdata.next.x - _pos.x;
+			int diffY = _walkdata.next.y - _pos.y;
+			_v3stepX = ((ABS(diffY) / (int)_speedy) >> 1) >(ABS(diffX) / (int)_speedx) ? _speedy + 1 : _speedx;
+			_v3stepThreshold = MAX(ABS(diffY) / _speedy, ABS(diffX) / _v3stepX);
+			_walkdata.deltaXFactor = (int32)_v3stepX;
+			if (diffX < 0)
+				_walkdata.deltaXFactor = -_walkdata.deltaXFactor;
+			_walkdata.deltaYFactor = (int32)_speedy;
+			if (diffY < 0)
+				_walkdata.deltaYFactor = -_walkdata.deltaYFactor;
+			_walkdata.xfrac = _walkdata.v3XAdd = diffX / _walkdata.deltaXFactor;
+			_walkdata.yfrac = _walkdata.v3YAdd = diffY / _walkdata.deltaYFactor;
+		} else {
+			s.syncAsUint16LE(_walkdata.v3XAdd, VER(101));
+			s.syncAsUint16LE(_walkdata.v3YAdd, VER(101));
+			s.syncAsUint16LE(_v3stepX, VER(101));
+			s.syncAsUint16LE(_v3stepThreshold, VER(101));
+		}
+	}
 }
 
 } // End of namespace Scumm
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 4e576e1698..4dd13977d8 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -68,7 +68,7 @@ struct SaveInfoSection {
 
 #define SaveInfoSectionSize (4+4+4 + 4+4 + 4+2)
 
-#define CURRENT_VER 100
+#define CURRENT_VER 101
 #define INFOSECTION_VERSION 2
 
 #pragma mark -


Commit: dcf5a40f038e09bb25975720a96655c37918a2e3
    https://github.com/scummvm/scummvm/commit/dcf5a40f038e09bb25975720a96655c37918a2e3
Author: athrxx (athrxx at scummvm.org)
Date: 2021-07-16T01:08:14+02:00

Commit Message:
SAGA: fix encodings of save descriptions

Changed paths:
    engines/saga/interface.cpp
    engines/saga/saveload.cpp


diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 34330bc32f..c7897fcfcb 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -1221,6 +1221,10 @@ bool Interface::processTextInput(Common::KeyState keystate) {
 	default:
 		if (((keystate.ascii <= 255) && (Common::isAlnum(keystate.ascii))) || (keystate.ascii == ' ') ||
 		    (keystate.ascii == '-') || (keystate.ascii == '_')) {
+			// This conversion actually works if the isAlnum() check is removed (which locks out all characters > 127).
+			// However, some glyphs seem to missing from the font, so it might be best to keep the limitation...
+			keystate.ascii = Common::U32String(Common::String::format("%c", keystate.ascii), Common::kISO8859_1).encode(_vm->getLanguage() == Common::JA_JPN ? Common::kWindows932 : Common::kDos850).firstChar();
+
 			if (_textInputStringLength < save_title_size - 1) {
 				ch[0] = keystate.ascii;
 				tempWidth = _vm->_font->getStringWidth(kKnownFontSmall, ch, 0, kFontNormal);
@@ -1367,25 +1371,30 @@ void Interface::setSave(PanelButton *panelButton) {
 	_savePanel.currentButton = NULL;
 	uint titleNumber;
 	char *fileName;
+
+	char desc[28];
+	Common::strlcpy(desc, Common::U32String(_textInputString, Common::kDos850).encode(Common::kUtf8).c_str(), sizeof(desc));
+
 	switch (panelButton->id) {
 		case kTextSave:
 			if (_textInputStringLength == 0) {
 				break;
 			}
+
 			if (!_vm->isSaveListFull() && (_optionSaveFileTitleNumber == 0)) {
-				if (_vm->locateSaveFile(_textInputString, titleNumber)) {
+				if (_vm->locateSaveFile(desc, titleNumber)) {
 					fileName = _vm->calcSaveFileName(_vm->getSaveFile(titleNumber)->slotNumber);
-					_vm->save(fileName, _textInputString);
+					_vm->save(fileName, desc);
 					_optionSaveFileTitleNumber = titleNumber;
 				} else {
 					fileName = _vm->calcSaveFileName(_vm->getNewSaveSlotNumber());
-					_vm->save(fileName, _textInputString);
+					_vm->save(fileName, desc);
 					_vm->fillSaveList();
 					calcOptionSaveSlider();
 				}
 			} else {
 				fileName = _vm->calcSaveFileName(_vm->getSaveFile(_optionSaveFileTitleNumber)->slotNumber);
-				_vm->save(fileName, _textInputString);
+				_vm->save(fileName, desc);
 			}
 			resetSaveReminder();
 
diff --git a/engines/saga/saveload.cpp b/engines/saga/saveload.cpp
index 904f530c33..f8898ef45b 100644
--- a/engines/saga/saveload.cpp
+++ b/engines/saga/saveload.cpp
@@ -151,7 +151,14 @@ void SagaEngine::fillSaveList() {
 					i++;
 					continue;
 				}
-				strcpy(_saveFiles[_saveFilesCount].name, _saveHeader.name);
+
+				Common::CodePage cp = Common::kDos850;
+				if (getGameId() == GID_ITE) {
+					if (getLanguage() == Common::JA_JPN)
+						cp = Common::kWindows932;
+				}
+
+				Common::strlcpy(_saveFiles[_saveFilesCount].name, Common::U32String(_saveHeader.name).encode(cp).c_str(), sizeof(SaveFileData::name));
 				_saveFiles[_saveFilesCount].slotNumber = slotNumber;
 				delete in;
 				_saveFilesCount++;




More information about the Scummvm-git-logs mailing list