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

bluegr noreply at scummvm.org
Wed May 14 08:08:02 UTC 2025


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

Summary:
a24712f3d1 DRASCULA: Fix displaying accented characters


Commit: a24712f3d151a8fdb782442f014324633db7d456
    https://github.com/scummvm/scummvm/commit/a24712f3d151a8fdb782442f014324633db7d456
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2025-05-14T11:07:58+03:00

Commit Message:
DRASCULA: Fix displaying accented characters

Commit 59905ee that added support for the Russian fan translation
introduced a regression for other languages. The character mapping
for cyrillic characters colide with some acccented characters used
by other languages. And as it was inserted before the accented
characters in the mapping table, it took precedence.

This commit changes slightly the format of the drascula.dat file
so that the engine can identify different parts of the character
map and skip part of it depending on the game language.

Changed paths:
    devtools/create_drascula/create_drascula.cpp
    devtools/create_drascula/staticdata.h
    dists/engine-data/drascula.dat
    engines/drascula/drascula.cpp
    engines/drascula/drascula.h


diff --git a/devtools/create_drascula/create_drascula.cpp b/devtools/create_drascula/create_drascula.cpp
index 245e998b02e..17593a991d6 100644
--- a/devtools/create_drascula/create_drascula.cpp
+++ b/devtools/create_drascula/create_drascula.cpp
@@ -28,7 +28,7 @@
 #include "create_drascula.h"
 #include "staticdata.h"
 
-#define DRASCULA_DAT_VER 6	// 1 byte
+#define DRASCULA_DAT_VER 7	// 1 byte
 
 static void writeByte(FILE *fp, uint8 b) {
 	fwrite(&b, 1, 1, fp);
@@ -59,12 +59,30 @@ int main(int argc, char *argv[]) {
 
 	writeByte(outFile, DRASCULA_DAT_VER);
 
-	// Write charmap
-	writeUint16BE(outFile, ARRAYSIZE(charMap));
-	for (i = 0; i < ARRAYSIZE(charMap); i++) {
-		writeByte(outFile, charMap[i].inChar);
-		writeSint16BE(outFile, charMap[i].mappedChar);
-		writeByte(outFile, charMap[i].charType);
+	// Write charmaps
+	writeUint16BE(outFile, ARRAYSIZE(charMapLetters));
+	writeUint16BE(outFile, ARRAYSIZE(charMapSigns));
+	writeUint16BE(outFile, ARRAYSIZE(charMapCyrillic));
+	writeUint16BE(outFile, ARRAYSIZE(charMapAccented));
+	for (i = 0; i < ARRAYSIZE(charMapLetters); i++) {
+		writeByte(outFile, charMapLetters[i].inChar);
+		writeSint16BE(outFile, charMapLetters[i].mappedChar);
+		writeByte(outFile, charMapLetters[i].charType);
+	}
+	for (i = 0; i < ARRAYSIZE(charMapSigns); i++) {
+		writeByte(outFile, charMapSigns[i].inChar);
+		writeSint16BE(outFile, charMapSigns[i].mappedChar);
+		writeByte(outFile, charMapSigns[i].charType);
+	}
+	for (i = 0; i < ARRAYSIZE(charMapCyrillic); i++) {
+		writeByte(outFile, charMapCyrillic[i].inChar);
+		writeSint16BE(outFile, charMapCyrillic[i].mappedChar);
+		writeByte(outFile, charMapCyrillic[i].charType);
+	}
+	for (i = 0; i < ARRAYSIZE(charMapAccented); i++) {
+		writeByte(outFile, charMapAccented[i].inChar);
+		writeSint16BE(outFile, charMapAccented[i].mappedChar);
+		writeByte(outFile, charMapAccented[i].charType);
 	}
 
 	// Write item locations
diff --git a/devtools/create_drascula/staticdata.h b/devtools/create_drascula/staticdata.h
index 509a662131f..45dfcaa1c60 100644
--- a/devtools/create_drascula/staticdata.h
+++ b/devtools/create_drascula/staticdata.h
@@ -22,7 +22,7 @@
 #ifndef STATICDATA_H
 #define STATICDATA_H
 
-const CharInfo charMap[] = {
+const CharInfo charMapLetters[] = {
 	//               Letters
 	// ---------------------------------------
 	{    'A',   6,   0 }, {    'B',  15,   0 },
@@ -40,7 +40,9 @@ const CharInfo charMap[] = {
 	{    'W', 213,   0 }, {    'X', 222,   0 },
 	{    'Y', 231,   0 }, {    'Z', 240,   0 },
 	// ---------------------------------------
-	{ '\247', 250,   0 }, {    ' ', 250,   0 },
+	{ '\247', 250,   0 }, {    ' ', 250,   0 }
+};
+const CharInfo charMapSigns[] = {
 	//               Signs
 	// ---------------------------------------
 	{    '.',   6,   1 }, {    ',',  15,   1 },
@@ -57,7 +59,9 @@ const CharInfo charMap[] = {
 	{    '3', 204,   1 }, {    '4', 213,   1 },
 	{    '5', 222,   1 }, {    '6', 231,   1 },
 	{    '7', 240,   1 }, {    '8', 249,   1 },
-	{    '9', 258,   1 }, {    '0', 267,   1 },
+	{    '9', 258,   1 }, {    '0', 267,   1 }
+};
+const CharInfo charMapCyrillic[] = {
 	//               Cyrillic
 	// ---------------------------------------
 	{    '\xc0',   6,   0 }, {    '\xc2',  15,   0 }, // similar // 'А', 'В'
@@ -93,7 +97,9 @@ const CharInfo charMap[] = {
 	{    '\xf9', 177,   2 }, {    '\xfa', 186,   2 }, //  'щ', 'ъ'
 	{    '\xfb', 195,   2 }, {    '\xfc', 204,   2 }, //  'ы', 'ь'
 	{    '\xfd', 213,   2 }, {    '\xfe', 222,   2 }, //  'э', 'ю'
-	{    '\xff', 231,   2 }, {    '\xb8',  42,   1 }, //  'я', 'ё'
+	{    '\xff', 231,   2 }, {    '\xb8',  42,   1 }  //  'я', 'ё'
+};
+const CharInfo charMapAccented[] = {
 	//               Accented
 	// ---------------------------------------
 	{ '\240',   6,   2 }, { '\202',  15,   2 },	// A, B
diff --git a/dists/engine-data/drascula.dat b/dists/engine-data/drascula.dat
index 63f6e355f71..63ae8024f0b 100644
Binary files a/dists/engine-data/drascula.dat and b/dists/engine-data/drascula.dat differ
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index 6be1142deac..ffc46414f7c 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -972,12 +972,40 @@ bool DrasculaEngine::loadDrasculaDat() {
 		return false;
 	}
 
-	_charMapSize = in.readUint16BE();
+	uint16 charMapLettersSize = in.readUint16BE();
+	uint16 charMapSignsSize = in.readUint16BE();
+	uint16 charMapCyrillicSize = in.readUint16BE();
+	uint16 charMapAccentedSize = in.readUint16BE();
+	_charMapSize = charMapLettersSize + charMapSignsSize;
+	if (_lang == kRussian)
+		_charMapSize += charMapCyrillicSize;
+	else
+		_charMapSize += charMapAccentedSize;
 	_charMap = (CharInfo *)malloc(sizeof(CharInfo) * _charMapSize);
-	for (i = 0; i < _charMapSize; i++) {
-		_charMap[i].inChar = in.readByte();
-		_charMap[i].mappedChar = in.readSint16BE();
-		_charMap[i].charType = in.readByte();
+	int map_i = 0;
+	for (i = 0; i < charMapLettersSize + charMapSignsSize; i++, map_i++) {
+		_charMap[map_i].inChar = in.readByte();
+		_charMap[map_i].mappedChar = in.readSint16BE();
+		_charMap[map_i].charType = in.readByte();
+	}
+	if (_lang == kRussian) {
+		// load cyrillic characters
+		for (i = 0; i < charMapCyrillicSize; i++, map_i++) {
+			_charMap[map_i].inChar = in.readByte();
+			_charMap[map_i].mappedChar = in.readSint16BE();
+			_charMap[map_i].charType = in.readByte();
+		}
+		// skip accented characters
+		in.skip(4 * charMapAccentedSize);
+	} else {
+		// skeep cyrillic characters
+		in.skip(4 * charMapCyrillicSize);
+		// load accented characters
+		for (i = 0; i < charMapAccentedSize; i++, map_i++) {
+			_charMap[map_i].inChar = in.readByte();
+			_charMap[map_i].mappedChar = in.readSint16BE();
+			_charMap[map_i].charType = in.readByte();
+		}
 	}
 
 	_itemLocationsSize = in.readUint16BE();
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 0e752ece238..ebc7d15a3e1 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -54,7 +54,7 @@
  */
 namespace Drascula {
 
-#define DRASCULA_DAT_VER 6
+#define DRASCULA_DAT_VER 7
 #define DATAALIGNMENT 4
 
 enum Languages {




More information about the Scummvm-git-logs mailing list