[Scummvm-git-logs] scummvm master -> 0fa7e91ff27ada731073f846cc9712a29217b680

sev- noreply at scummvm.org
Tue Aug 27 12:52:44 UTC 2024


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:
6ce4adab04 QDENGINE: Dropped *Interface in minigame class names
0fa7e91ff2 QDENGINE: Implemented tetris.dll minigame for maski


Commit: 6ce4adab04407ca30788175e3bcca1979ef9c592
    https://github.com/scummvm/scummvm/commit/6ce4adab04407ca30788175e3bcca1979ef9c592
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-27T14:52:33+02:00

Commit Message:
QDENGINE: Dropped *Interface in minigame class names

Changed paths:
    engines/qdengine/minigames/book_all.h
    engines/qdengine/minigames/kartiny.h
    engines/qdengine/minigames/puzzle_all.h
    engines/qdengine/qdcore/qd_minigame.cpp


diff --git a/engines/qdengine/minigames/book_all.h b/engines/qdengine/minigames/book_all.h
index 98efef79221..ac9fde6c04a 100644
--- a/engines/qdengine/minigames/book_all.h
+++ b/engines/qdengine/minigames/book_all.h
@@ -173,10 +173,10 @@ const float bookBuhtaCZ[95 * 2] = {
 	 0.000f,  0.000f,  0.000f,  0.000f,  0.000f,
 };
 
-class qdBookAllMiniGameInterface : public qdMiniGameInterface {
+class qdBookAllMiniGame : public qdMiniGameInterface {
 public:
-	qdBookAllMiniGameInterface(Common::String dll, Common::Language language) : _dll(dll), _language(language) {}
-	~qdBookAllMiniGameInterface() { };
+	qdBookAllMiniGame(Common::String dll, Common::Language language) : _dll(dll), _language(language) {}
+	~qdBookAllMiniGame() { };
 
 	//! Инициализация игры.
 	bool init(const qdEngineInterface *engine_interface) {
diff --git a/engines/qdengine/minigames/kartiny.h b/engines/qdengine/minigames/kartiny.h
index d2eb1dbfb7b..aa015dfebae 100644
--- a/engines/qdengine/minigames/kartiny.h
+++ b/engines/qdengine/minigames/kartiny.h
@@ -29,10 +29,10 @@
 
 namespace QDEngine {
 
-class qdKartinyMiniGameInterface : public qdMiniGameInterface {
+class qdKartinyMiniGame : public qdMiniGameInterface {
 public:
-	qdKartinyMiniGameInterface() {}
-	~qdKartinyMiniGameInterface() {}
+	qdKartinyMiniGame() {}
+	~qdKartinyMiniGame() {}
 
 	bool init(const qdEngineInterface *engine_interface) {
 		debugC(1, kDebugMinigames, "Kartiny::init()");
diff --git a/engines/qdengine/minigames/puzzle_all.h b/engines/qdengine/minigames/puzzle_all.h
index 808d66f7b30..2fde79d3ed2 100644
--- a/engines/qdengine/minigames/puzzle_all.h
+++ b/engines/qdengine/minigames/puzzle_all.h
@@ -75,13 +75,13 @@ const int puzzle_ep13[] = {
 	357, 430, 440, 427, 526, 416, 601, 412
 };
 
-class qdPuzzleAllMiniGameInterface : public qdMiniGameInterface {
+class qdPuzzleAllMiniGame : public qdMiniGameInterface {
 public:
-	qdPuzzleAllMiniGameInterface(Common::String dll, Common::Language language) : _dll(dll), _language(language) {
+	qdPuzzleAllMiniGame(Common::String dll, Common::Language language) : _dll(dll), _language(language) {
 		for (uint i = 0; i < ARRAYSIZE(_pieces); i++)
 			_pieces[i] = nullptr;
 	}
-	~qdPuzzleAllMiniGameInterface() {};
+	~qdPuzzleAllMiniGame() {};
 
 	//! Инициализация игры.
 	bool init(const qdEngineInterface *engine_interface) {
diff --git a/engines/qdengine/qdcore/qd_minigame.cpp b/engines/qdengine/qdcore/qd_minigame.cpp
index b3473d650f4..f53fdf25995 100644
--- a/engines/qdengine/qdcore/qd_minigame.cpp
+++ b/engines/qdengine/qdcore/qd_minigame.cpp
@@ -273,13 +273,13 @@ bool qdMiniGame::load_interface() {
 		// 3mice1
 		if (_dll_name == "DLL\\Book_gusenica.dll" || _dll_name == "DLL\\Book_les.dll"
 				|| _dll_name == "DLL\\Book_buhta.dll") {
-			_interface = new qdBookAllMiniGameInterface(_dll_name, g_engine->getLanguage());
+			_interface = new qdBookAllMiniGame(_dll_name, g_engine->getLanguage());
 			return true;
 		} else if (_dll_name == "DLL\\Puzzle_ep01.dll" || _dll_name == "DLL\\Puzzle_ep02.dll"
 				|| _dll_name == "DLL\\Puzzle_ep04.dll" || _dll_name == "DLL\\Puzzle_ep05.dll"
 				|| _dll_name == "DLL\\Puzzle_ep07.dll" || _dll_name == "DLL\\Puzzle_ep08.dll"
 				|| _dll_name == "DLL\\Puzzle_ep13.dll") {
-			_interface = new qdPuzzleAllMiniGameInterface(_dll_name, g_engine->getLanguage());
+			_interface = new qdPuzzleAllMiniGame(_dll_name, g_engine->getLanguage());
 			return true;
 
 		// shveik


Commit: 0fa7e91ff27ada731073f846cc9712a29217b680
    https://github.com/scummvm/scummvm/commit/0fa7e91ff27ada731073f846cc9712a29217b680
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-27T14:52:33+02:00

Commit Message:
QDENGINE: Implemented tetris.dll minigame for maski

The minigame was tested and is completable

Changed paths:
  A engines/qdengine/minigames/tetris.h
    engines/qdengine/qdcore/qd_minigame.cpp


diff --git a/engines/qdengine/minigames/tetris.h b/engines/qdengine/minigames/tetris.h
new file mode 100644
index 00000000000..36c613fbe6a
--- /dev/null
+++ b/engines/qdengine/minigames/tetris.h
@@ -0,0 +1,194 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef QDENGINE_MINIGAMES_TETRIS_H
+#define QDENGINE_MINIGAMES_TETRIS_H
+
+#include "common/debug.h"
+
+#include "qdengine/qd_fwd.h"
+#include "qdengine/qdcore/qd_minigame_interface.h"
+
+namespace QDEngine {
+
+class qdTetrisMiniGame : public qdMiniGameInterface {
+public:
+	qdTetrisMiniGame() {
+		_flyingObjs = _hiddenObjs = nullptr;
+	}
+	~qdTetrisMiniGame() {
+		delete _flyingObjs;
+		delete _hiddenObjs;
+	}
+
+	bool init(const qdEngineInterface *engine_interface) {
+		debugC(1, kDebugMinigames, "Tetris::init()");
+
+		_engine = engine_interface;
+		_scene = engine_interface->current_scene_interface();
+		if (!_scene)
+			return false;
+
+		if (!_flyingObjs) {
+			_flyingObjs = (qdMinigameObjectInterface **)malloc(5 * sizeof(qdMinigameObjectInterface *));
+
+			for (int i = 0; i < 5; i++) {
+				Common::String name = Common::String::format("\xeb\xe5\xf2\xe8\xf2%d", i + 1); // "летит%i"
+				_flyingObjs[i] = _scene->object_interface(_scene->minigame_parameter(name.c_str()));
+			}
+		}
+
+		if (!_hiddenObjs) {
+			_hiddenObjs = (qdMinigameObjectInterface **)malloc(5 * sizeof(qdMinigameObjectInterface *));
+
+			for (int i = 0; i < 5; i++) {
+				Common::String name = Common::String::format("\xf1\xea\xf0\xfb\xf2%d", i + 1); // "скрыт%i"
+				_hiddenObjs[i] = _scene->object_interface(_scene->minigame_parameter(name.c_str()));
+			}
+		}
+
+		_lastRowObj = _scene->object_interface(_scene->minigame_parameter("last_row"));
+
+  		return true;
+	}
+
+	bool quant(float dt) {
+		debugC(3, kDebugMinigames, "Tetris::quant(%f)", dt);
+
+		for (int i = 0; i < 5; i++ ) {
+			if (_flyingObjs[i]->is_state_active("\xeb\xe5\xf2\xe8\xf2")		// "летит"
+					&& _hiddenObjs[i]->is_state_active("\xed\xe5\xf2")) {	// "нет"
+
+				mgVect2i pos = _flyingObjs[i]->screen_R();
+
+				if (pos.x <= 251) {
+					int activeColumn = getActiveColumn();
+					if (activeColumn < 12)
+						activeColumn = 12;
+					if (pos.y > 535 - 10 * activeColumn)
+						_hiddenObjs[i]->set_state("\xe4\xe0");	// "да"
+				} else {
+					if (pos.y > 535 - 10 * getActiveColumn())
+						_hiddenObjs[i]->set_state("\xe4\xe0");	// "да"
+				}
+			}
+		}
+
+		return true;
+	}
+
+	bool finit() {
+		debugC(1, kDebugMinigames, "Tetris::finit()");
+
+		if (_scene)  {
+			_engine->release_scene_interface(_scene);
+			_scene = 0;
+		}
+
+ 		return true;
+	}
+
+	bool new_game(const qdEngineInterface *engine_interface) {
+		return true;
+	}
+
+	int save_game(const qdEngineInterface *engine_interface, const qdMinigameSceneInterface *scene_interface, char *buffer, int buffer_size) {
+		return 0;
+	}
+
+	int load_game(const qdEngineInterface *engine_interface, const qdMinigameSceneInterface *scene_interface, const char *buffer, int buffer_size) {
+		return 0;
+	}
+
+	enum { INTERFACE_VERSION = 99 };
+	int version() const {
+		return INTERFACE_VERSION;
+	}
+
+private:
+    int getActiveColumn() {
+		if (_lastRowObj->is_state_active("0"))
+			return 0;
+		if (_lastRowObj->is_state_active("1"))
+			return 1;
+		if (_lastRowObj->is_state_active("2"))
+			return 2;
+		if (_lastRowObj->is_state_active("3"))
+			return 3;
+		if (_lastRowObj->is_state_active("4"))
+			return 4;
+		if (_lastRowObj->is_state_active("5"))
+			return 5;
+		if (_lastRowObj->is_state_active("6"))
+			return 6;
+		if (_lastRowObj->is_state_active("7"))
+			return 7;
+		if (_lastRowObj->is_state_active("8"))
+			return 8;
+		if (_lastRowObj->is_state_active("9"))
+			return 9;
+		if (_lastRowObj->is_state_active("10"))
+			return 10;
+		if (_lastRowObj->is_state_active("11"))
+			return 11;
+		if (_lastRowObj->is_state_active("12"))
+			return 12;
+		if (_lastRowObj->is_state_active("13"))
+			return 13;
+		if (_lastRowObj->is_state_active("14"))
+			return 14;
+		if (_lastRowObj->is_state_active("15"))
+			return 15;
+		if (_lastRowObj->is_state_active("16"))
+			return 16;
+		if (_lastRowObj->is_state_active("17"))
+			return 17;
+		if (_lastRowObj->is_state_active("18"))
+			return 18;
+		if (_lastRowObj->is_state_active("19"))
+			return 19;
+		if (_lastRowObj->is_state_active("20"))
+			return 20;
+		if (_lastRowObj->is_state_active("21"))
+			return 21;
+		if (_lastRowObj->is_state_active("22"))
+			return 22;
+		if (_lastRowObj->is_state_active("23"))
+			return 23;
+		if (_lastRowObj->is_state_active("24"))
+			return 24;
+
+		return 0;
+    }
+
+private:
+	const qdEngineInterface *_engine = nullptr;
+	qdMinigameSceneInterface *_scene = nullptr;
+
+	qdMinigameObjectInterface **_flyingObjs = nullptr;
+	qdMinigameObjectInterface **_hiddenObjs = nullptr;
+	qdMinigameObjectInterface *_lastRowObj  = nullptr;
+
+};
+
+} // namespace QDEngine
+
+#endif // QDENGINE_MINIGAMES_TETRIS_H
diff --git a/engines/qdengine/qdcore/qd_minigame.cpp b/engines/qdengine/qdcore/qd_minigame.cpp
index f53fdf25995..719f913cb84 100644
--- a/engines/qdengine/qdcore/qd_minigame.cpp
+++ b/engines/qdengine/qdcore/qd_minigame.cpp
@@ -35,6 +35,7 @@
 
 // maski
 #include "qdengine/minigames/kartiny.h"
+#include "qdengine/minigames/tetris.h"
 
 // 2mice1
 #include "qdengine/minigames/book_all.h"
@@ -268,10 +269,12 @@ bool qdMiniGame::load_interface() {
 		// maski_21_random.dll
 		// orchestra.dll
 		// scroll.dll
-		// tetris.dll
+		if (_dll_name == "DLL\\tetris.dll") {
+			_interface = new qdTetrisMiniGame();
+			return true;
 
 		// 3mice1
-		if (_dll_name == "DLL\\Book_gusenica.dll" || _dll_name == "DLL\\Book_les.dll"
+		} else if (_dll_name == "DLL\\Book_gusenica.dll" || _dll_name == "DLL\\Book_les.dll"
 				|| _dll_name == "DLL\\Book_buhta.dll") {
 			_interface = new qdBookAllMiniGame(_dll_name, g_engine->getLanguage());
 			return true;




More information about the Scummvm-git-logs mailing list