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

alxpnv a04198622 at gmail.com
Thu Sep 2 10:29:38 UTC 2021


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

Summary:
ab285832b6 ASYLUM: (Board puzzles) add support for German text


Commit: ab285832b63041921c041e6fa765ae813aa076d9
    https://github.com/scummvm/scummvm/commit/ab285832b63041921c041e6fa765ae813aa076d9
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-02T13:30:20+03:00

Commit Message:
ASYLUM: (Board puzzles) add support for German text

Changed paths:
    engines/asylum/puzzles/board.cpp
    engines/asylum/puzzles/board.h
    engines/asylum/puzzles/boardkeyhidesto.cpp
    engines/asylum/puzzles/boardsalvation.cpp
    engines/asylum/puzzles/boardyouth.cpp


diff --git a/engines/asylum/puzzles/board.cpp b/engines/asylum/puzzles/board.cpp
index cdfae3f997..6274d39f7e 100644
--- a/engines/asylum/puzzles/board.cpp
+++ b/engines/asylum/puzzles/board.cpp
@@ -20,6 +20,8 @@
 *
 */
 
+#include "common/language.h"
+
 #include "asylum/puzzles/board.h"
 
 #include "asylum/resources/worldstats.h"
@@ -34,8 +36,14 @@
 
 namespace Asylum {
 
-PuzzleBoard::PuzzleBoard(AsylumEngine *engine, const PuzzleData &data) : Puzzle(engine) {
-	_data = data;
+PuzzleBoard::PuzzleBoard(AsylumEngine *engine, const PuzzleData *data) : Puzzle(engine) {
+	const Common::Language supportedLanguages[] = {Common::EN_ANY, Common::DE_DEU, Common::FR_FRA};
+
+	int i = 0;
+	while (_vm->getLanguage() != supportedLanguages[i])
+		i++;
+
+	memcpy(&_data, &data[i], sizeof(PuzzleData));
 
 	// Init board
 	_solved = false;
diff --git a/engines/asylum/puzzles/board.h b/engines/asylum/puzzles/board.h
index d3c15ac6fa..f7c025eb56 100644
--- a/engines/asylum/puzzles/board.h
+++ b/engines/asylum/puzzles/board.h
@@ -52,14 +52,16 @@ public:
 		uint32 charMapSize;
 		CharMap charMap[10];
 		bool checkForSpace;
+		uint32 space1Pos, space2Pos;
 		char solvedText[28];
 	};
 
-	PuzzleBoard(AsylumEngine *engine, const PuzzleData &data);
+	PuzzleBoard(AsylumEngine *engine, const PuzzleData *data);
 
 	void reset();
 
 protected:
+	PuzzleData _data;
 	bool _solved;
 	Common::String _text;
 	bool _charUsed[20];
@@ -78,8 +80,6 @@ protected:
 	void checkSlots();
 
 private:
-	PuzzleData _data;
-
 	//////////////////////////////////////////////////////////////////////////
 	// Event Handling
 	//////////////////////////////////////////////////////////////////////////
diff --git a/engines/asylum/puzzles/boardkeyhidesto.cpp b/engines/asylum/puzzles/boardkeyhidesto.cpp
index 8d39459755..307e1f0c30 100644
--- a/engines/asylum/puzzles/boardkeyhidesto.cpp
+++ b/engines/asylum/puzzles/boardkeyhidesto.cpp
@@ -28,25 +28,55 @@
 
 namespace Asylum {
 
-static const PuzzleBoard::PuzzleData puzzleKeyHidesToData = {
-	56,
-	kGameFlag283,
-	503,
-	3,
-	{{5, false}, {6, false}, {7, false}},
-	10,
-	{{'I',  30,  53},
-	{'E',  212,  71},
-	{'D',   31, 103},
-	{'H',  447, 134},
-	{'S',  240, 151},
-	{'E',   95, 167},
-	{'O',  372, 182},
-	{'K',  210, 215},
-	{'Y',  440, 247},
-	{'T',  479, 262}},
-	true,
-	"K E Y   H I D E S   T O "
+static const PuzzleBoard::PuzzleData puzzleKeyHidesToData[] = {
+	// English
+	{
+		56,
+		kGameFlag283,
+		503,
+		3,
+		{{5, false}, {6, false}, {7, false}},
+		10,
+		{
+			{'I',   30,  53},
+			{'E',  212,  71},
+			{'D',   31, 103},
+			{'H',  447, 134},
+			{'S',  240, 151},
+			{'E',   95, 167},
+			{'O',  372, 182},
+			{'K',  210, 215},
+			{'Y',  440, 247},
+			{'T',  479, 262}
+		},
+		true,
+		6, 18,
+		"K E Y   H I D E S   T O "
+	},
+	// German
+	{
+		56,
+		kGameFlag283,
+		503,
+		3,
+		{{5, false}, {6, false}, {7, false}},
+		9,
+		{
+			{'U',  52,  50},
+			{'R',  28,  66},
+			{'Z', 254,  66},
+			{'E',  40,  82},
+			{'W', 209, 130},
+			{'G',  61, 146},
+			{'T',  33, 162},
+			{'I', 527, 162},
+			{'S', 233, 210},
+			{'\0',  0,   0}
+		},
+		true,
+		6, 14,
+		"W E G   I S T   Z U R "
+	}
 };
 
 PuzzleBoardKeyHidesTo::PuzzleBoardKeyHidesTo(AsylumEngine *engine) : PuzzleBoard(engine, puzzleKeyHidesToData) {
@@ -70,14 +100,14 @@ bool PuzzleBoardKeyHidesTo::mouseLeftDown(const AsylumEvent &) {
 	if (mousePos.y <= 350) {
 		int32 index = findRect();
 
-		if (index != -1 && _position < 24) {
+		if (index != -1 && _position < strlen(_data.solvedText)) {
 			_charUsed[index] = true;
 			_selectedSlot = -1;
 
-			_solvedText[_position++] = puzzleKeyHidesToData.charMap[index].character;
+			_solvedText[_position++] = _data.charMap[index].character;
 			_solvedText[_position++] = ' ';
 
-			if (_position == 6 || _position == 18) {
+			if (_position == _data.space1Pos || _position == _data.space2Pos) {
 				_solvedText[_position++] = ' ';
 				_solvedText[_position++] = ' ';
 			}
diff --git a/engines/asylum/puzzles/boardsalvation.cpp b/engines/asylum/puzzles/boardsalvation.cpp
index dd8c054e77..eef26e425b 100644
--- a/engines/asylum/puzzles/boardsalvation.cpp
+++ b/engines/asylum/puzzles/boardsalvation.cpp
@@ -32,25 +32,55 @@
 
 namespace Asylum {
 
-static const PuzzleBoard::PuzzleData puzzleSalvationData = {
-	31,
-	kGameFlag281,
-	431,
-	3,
-	{{0, false}, {1, false}, {2, false}},
-	9,
-	{{'I',  61,  53},
-	{'S',  322,  53},
-	{'A',  529,  86},
-	{'L',  256, 117},
-	{'V',  251, 151},
-	{'A',   66, 199},
-	{'T',  436, 229},
-	{'O',  172, 262},
-	{'N',  393, 296},
-	{'\0',   0,   0}},
-	false,
-	"S A L V A T I O N "
+static const PuzzleBoard::PuzzleData puzzleSalvationData[] = {
+	// English
+	{
+		31,
+		kGameFlag281,
+		431,
+		3,
+		{{0, false}, {1, false}, {2, false}},
+		9,
+		{
+			{'I',   61,  53},
+			{'S',  322,  53},
+			{'A',  529,  86},
+			{'L',  256, 117},
+			{'V',  251, 151},
+			{'A',   66, 199},
+			{'T',  436, 229},
+			{'O',  172, 262},
+			{'N',  393, 296},
+			{'\0',   0,   0}
+		},
+		false,
+		0, 0,
+		"S A L V A T I O N "
+	},
+	// German
+	{
+		31,
+		kGameFlag281,
+		431,
+		3,
+		{{0, false}, {1, false}, {2, false}},
+		8,
+		{
+			{'L',  46,  50},
+			{'O', 133,  82},
+			{'R', 356,  98},
+			{'E',  99, 130},
+			{'N', 120, 146},
+			{'G', 161, 178},
+			{'S', 289, 210},
+			{'U', 371, 226},
+			{'\0',  0,   0},
+			{'\0',  0,   0}
+		},
+		false,
+		0, 0,
+		"E R L O S U N G "
+	}
 };
 
 static const uint32 puzzleSalvationSoundResourceIndex[11] = {5, 6, 7, 10, 11, 28, 29, 30, 31, 32, 36};
@@ -76,11 +106,11 @@ bool PuzzleBoardSalvation::mouseLeftDown(const AsylumEvent &) {
 	if (mousePos.y <= 350) {
 		int32 index = findRect();
 
-		if (index != -1 && _position < 18) {
+		if (index != -1 && _position < strlen(_data.solvedText)) {
 			_charUsed[index] = true;
 			_selectedSlot = -1;
 
-			_solvedText[_position++] = puzzleSalvationData.charMap[index].character;
+			_solvedText[_position++] = _data.charMap[index].character;
 			_solvedText[_position++] = ' ';
 
 			updateScreen();
diff --git a/engines/asylum/puzzles/boardyouth.cpp b/engines/asylum/puzzles/boardyouth.cpp
index 428a7ee2c4..a312ef4ee8 100644
--- a/engines/asylum/puzzles/boardyouth.cpp
+++ b/engines/asylum/puzzles/boardyouth.cpp
@@ -28,25 +28,55 @@
 
 namespace Asylum {
 
-static const PuzzleBoard::PuzzleData puzzleYouthData = {
-	55,
-	kGameFlag282,
-	431,
-	2,
-	{{3, false}, {4, false}, {0, false}},
-	8,
-	{{'E',  64,  55},
-	{'U',   26,  69},
-	{'T',  135, 102},
-	{'O',   57, 134},
-	{'H',  417, 152},
-	{'T',  223, 181},
-	{'H',  497, 198},
-	{'Y',  435, 231},
-	{'\0',   0,   0},
-	{'\0',   0,   0}},
-	true,
-	"T H E   Y O U T H "
+static const PuzzleBoard::PuzzleData puzzleYouthData[] = {
+	// English
+	{
+		55,
+		kGameFlag282,
+		431,
+		2,
+		{{3, false}, {4, false}, {0, false}},
+		8,
+		{
+			{'E',   64,  55},
+			{'U',   26,  69},
+			{'T',  135, 102},
+			{'O',   57, 134},
+			{'H',  417, 152},
+			{'T',  223, 181},
+			{'H',  497, 198},
+			{'Y',  435, 231},
+			{'\0',   0,   0},
+			{'\0',   0,   0}
+		},
+		true,
+		6, 0,
+		"T H E   Y O U T H "
+	},
+	// German
+	{
+		55,
+		kGameFlag282,
+		503,
+		2,
+		{{3, false}, {4, false}, {0, false}},
+		9,
+		{
+			{'G',  25,  50},
+			{'E',  60,  66},
+			{'D', 471,  82},
+			{'N', 340, 114},
+			{'J', 102, 146},
+			{'U', 311, 162},
+			{'R', 261, 194},
+			{'E', 390, 210},
+			{'D', 470, 226},
+			{'\0',  0,   0}
+		},
+		true,
+		12, 0,
+		"J U G E N D   D E R "
+	}
 };
 
 PuzzleBoardYouth::PuzzleBoardYouth(AsylumEngine *engine) : PuzzleBoard(engine, puzzleYouthData) {
@@ -70,14 +100,14 @@ bool PuzzleBoardYouth::mouseLeftDown(const AsylumEvent &) {
 	if (mousePos.y <= 350) {
 		int32 index = findRect();
 
-		if (index != -1 && _position < 18) {
+		if (index != -1 && _position < strlen(_data.solvedText)) {
 			_charUsed[index] = true;
 			_selectedSlot = -1;
 
-			_solvedText[_position++] = puzzleYouthData.charMap[index].character;
+			_solvedText[_position++] = _data.charMap[index].character;
 			_solvedText[_position++] = ' ';
 
-			if (_position == 6) {
+			if (_position == _data.space1Pos) {
 				_solvedText[_position++] = ' ';
 				_solvedText[_position++] = ' ';
 			}




More information about the Scummvm-git-logs mailing list