[Scummvm-git-logs] scummvm master -> 64279521775427a4c4866bbd69a8d7e15b971d02

Die4Ever noreply at scummvm.org
Sat Feb 12 21:18:37 UTC 2022


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:
ed18d6a43a GROOVIE: TLC fix initialization
6427952177 GROOVIE: TLC fix savegame name length


Commit: ed18d6a43af8f668f2393a8ff8b1504fe245e2ae
    https://github.com/scummvm/scummvm/commit/ed18d6a43af8f668f2393a8ff8b1504fe245e2ae
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2022-02-12T15:17:18-06:00

Commit Message:
GROOVIE: TLC fix initialization

Changed paths:
    engines/groovie/logic/tlcgame.cpp
    engines/groovie/script.cpp


diff --git a/engines/groovie/logic/tlcgame.cpp b/engines/groovie/logic/tlcgame.cpp
index 080961c0648..4b2ce8d05fa 100644
--- a/engines/groovie/logic/tlcgame.cpp
+++ b/engines/groovie/logic/tlcgame.cpp
@@ -63,7 +63,14 @@ const uint8 kTlcEpQuestToPlay[] = {
 TlcGame::TlcGame(byte *scriptVariables) :
 	_numRegionHeaders(0), _regionHeader(NULL), _curQuestNumAnswers(-1), _epQuestionsData(NULL),
 	_random("GroovieTlcGame"), _scriptVariables(scriptVariables),
-	_tatHeaders(NULL), _tatQuestions(NULL) {
+	_tatHeaders(NULL), _tatQuestions(NULL), _curQuestRegions(), _epScoreBin(), _tatFlags() {
+	_curAnswerIndex = 0;
+	_epEpisodeIdx = 0;
+	_epQuestionIdx = 0;
+	_epQuestionNumOfPool = -1;
+	_epQuestionsInEpisode = 0;
+	_tatEpisodes = 0;
+	_tatQuestCount = 0;
 }
 
 TlcGame::~TlcGame() {
@@ -289,6 +296,7 @@ void TlcGame::opExitPoll() {
 		break;
 	default:
 		// Unknown subcommand
+		debugC(0, kDebugLogic, "TLC:opExitPoll: Unknown subcommand=%d", _scriptVariables[0]);
 		setScriptVar(0, 0x08);
 	}
 }
@@ -709,7 +717,7 @@ void TlcGame::opFlags() {
 				_tatFlags[x][y] = 0;
 			}
 		}
-		debugC(1, kDebugLogic, "Tlc:TatFlags: Initialized fields (%d, %d)", x, y);
+		debugC(0, kDebugLogic, "Tlc:TatFlags: Initialized fields (%d, %d)", x, y);
 		break;
 
 	// Get and set flags
@@ -750,11 +758,11 @@ void TlcGame::opFlags() {
 void TlcGame::debugTatFlags(int y1, int y2) {
 	Common::String s1, s2;
 	for (int x = 0; x < 14; x++) {
-		s1 += int(_tatFlags[x][y1]);
-		s2 += int(_tatFlags[x][y2]);
+		s1 += Common::String::format("%d", _tatFlags[x][y1]);
+		s2 += Common::String::format("%d", _tatFlags[x][y2]);
 	}
 
-	debugC(5, kDebugLogic, "Tlc:TatFlags: %s  %s", s1.c_str(), s2.c_str());
+	debugC(0, kDebugLogic, "Tlc:TatFlags: %s  %s", s1.c_str(), s2.c_str());
 }
 
 
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 7394dbc372d..fb265641a59 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -456,7 +456,7 @@ void Script::readScriptString(Common::String &str) {
 			c = _variables[c - 0x61] + 0x30;
 			if (_version == kGroovieT7G) {
 				if (c >= 0x41 && c <= 0x5A) {
-					c += ' ';
+					c += 0x20;// to lower case
 				}
 			}
 			break;
@@ -470,12 +470,14 @@ void Script::readScriptString(Common::String &str) {
 		default:
 			if (_version == kGroovieT7G) {
 				if (c >= 0x41 && c <= 0x5A) {
-					c += ' ';
+					c += 0x20;// to lower case
 				}
 			}
 		}
 		// Append the current character at the end of the string
-		str += c;
+		if (c) {
+			str += c;
+		}
  	}
 
 	debugC(5, kDebugScript, "readScriptString orig: %s, ret: %s", orig.c_str(), str.c_str());


Commit: 64279521775427a4c4866bbd69a8d7e15b971d02
    https://github.com/scummvm/scummvm/commit/64279521775427a4c4866bbd69a8d7e15b971d02
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2022-02-12T15:17:24-06:00

Commit Message:
GROOVIE: TLC fix savegame name length

Changed paths:
    engines/groovie/script.cpp
    engines/groovie/script.h


diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index fb265641a59..f7e6c1dfe93 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -597,19 +597,23 @@ bool Script::canDirectSave() const {
 }
 
 void Script::directGameSave(int slot, const Common::String &desc) {
-	char name[15];
+	char name[19];
 	debugC(0, kDebugScript, "directGameSave %d %s", slot, desc.c_str());
 	if (slot < 0 || slot > MAX_SAVES - 1) {
 		return;
 	}
 	const char *saveName = desc.c_str();
-	for (int i = 0; i < 15; i++) {
+	uint name_len = _version == kGroovieTLC ? 19 : 15;
+	for (uint i = 0; i < desc.size() && i < name_len; i++) {
 		name[i] = saveName[i] - 0x30;
 	}
+	for (uint i = desc.size(); i < name_len; i++) {
+		name[i] = '\0' - 0x30;
+	}
 	savegame(slot, name);
 }
 
-void Script::savegame(uint slot, const char name[15]) {
+void Script::savegame(uint slot, const char name[19]) {
 	char newchar;
 	debugC(0, kDebugScript, "savegame %d, canDirectSave: %d", slot, canDirectSave());
 	Common::OutSaveFile *file = SaveLoad::openForSaving(ConfMan.getActiveDomainName(), slot);
@@ -629,13 +633,14 @@ void Script::savegame(uint slot, const char name[15]) {
 	}
 
 	// Saving the variables. It is endian safe because they're byte variables
-	file->write(name, 15);
-	file->write(_variables + 15, 0x400 - 15);
+	uint name_len = _version == kGroovieTLC ? 19 : 15;
+	file->write(name, name_len);
+	file->write(_variables + name_len, 0x400 - name_len);
 	delete file;
 
 	// Cache the saved name
-	char cacheName[15];
-	for (int i = 0; i < 15; i++) {
+	char cacheName[20];
+	for (uint i = 0; i < name_len; i++) {
 		newchar = name[i] + 0x30;
 		if ((newchar < 0x30 || newchar > 0x39) && (newchar < 0x41 || newchar > 0x7A) && newchar != 0x2E) {
 			cacheName[i] = '\0';
@@ -646,6 +651,7 @@ void Script::savegame(uint slot, const char name[15]) {
 			cacheName[i] = newchar;
 		}
 	}
+	cacheName[name_len] = '\0';
 	_saveNames[slot] = cacheName;
 }
 
@@ -1513,8 +1519,10 @@ void Script::o_savegame() {
 
 	debugC(0, kDebugScript, "Groovie::Script: SAVEGAME var[0x%04X] -> slot=%d", varnum, slot);
 
-	char name[15];
-	memcpy(name, _variables, 15);
+	// TLC uses 19 characters, but there's no harm in copying the extra bytes for the other games
+	// the savegame function will trim it when needed
+	char name[19];
+	memcpy(name, _variables, 19);
 	savegame(slot, name);
 }
 
diff --git a/engines/groovie/script.h b/engines/groovie/script.h
index 95a56354b92..bcbde67aa7b 100644
--- a/engines/groovie/script.h
+++ b/engines/groovie/script.h
@@ -161,7 +161,7 @@ private:
 
 	void loadgame(uint slot);
 	bool preview_loadgame(uint slot);
-	void savegame(uint slot, const char name[15]);
+	void savegame(uint slot, const char name[19]);
 	bool playvideofromref(uint32 fileref, bool loopUntilAudioDone = false);
 	bool playBackgroundSound(uint32 fileref, uint32 loops);
 	void printString(Graphics::Surface *surface, const char *str);




More information about the Scummvm-git-logs mailing list