[Scummvm-git-logs] scummvm master -> 692bad517fad48aaae86817b2f9d73e7e309e469

bluegr bluegr at gmail.com
Fri Oct 22 23:42:58 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:
692bad517f GROOVIE: Restructure GroovieV2 game logic


Commit: 692bad517fad48aaae86817b2f9d73e7e309e469
    https://github.com/scummvm/scummvm/commit/692bad517fad48aaae86817b2f9d73e7e309e469
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-10-23T02:42:39+03:00

Commit Message:
GROOVIE: Restructure GroovieV2 game logic

- Move Groovie2 mini-game logic orchestration inside script opcode 0x42
- Move 11h mousetrap logic into a separate file
- Move music file names for MusicPlayerClan inside music.cpp
- Remove the now obsolete ClanGame and T11hGame classes

Changed paths:
  A engines/groovie/logic/mousetrap.cpp
  A engines/groovie/logic/mousetrap.h
  R engines/groovie/logic/clangame.cpp
  R engines/groovie/logic/clangame.h
  R engines/groovie/logic/t11hgame.cpp
  R engines/groovie/logic/t11hgame.h
    engines/groovie/module.mk
    engines/groovie/music.cpp
    engines/groovie/script.cpp
    engines/groovie/script.h


diff --git a/engines/groovie/logic/clangame.cpp b/engines/groovie/logic/clangame.cpp
deleted file mode 100644
index 077bec3849..0000000000
--- a/engines/groovie/logic/clangame.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 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 2
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/debug.h"
-#include "groovie/groovie.h"
-#include "groovie/logic/clangame.h"
-
-namespace Groovie {
-
-// This a list of files for background music. This list is hardcoded in the Clandestiny player.
-const char *kClanMusicFiles[] = {"mbf_arb1", "mbf_arm1", "mbf_bal1", "mbf_c2p2", "act18mus", "act15mus", "act21mus",
-										  "act05mus", "act04mus", "act23mus", "act17mus", "act03mus", "act06mus", "act19mus",
-										  "act07mus", "mbf_mne1", "act24mus", "act24mus", "act14mus", "act20mus", "act15mus",
-										  "act13mus", "act08mus", "mbf_uph1", "mbf_uph1", "act19mus", "mbf_bol1", "mbf_cbk1",
-										  "mbf_glf1", "mbf_bro1", "mbf_c1r1", "mbf_c1r1", "mbf_c1r1", "mbf_c1r1", "mbf_c2r1",
-										  "mbf_c2r1", "mbf_c2r1", "mbf_c2r1", "mbf_c3r1", "mbf_c3r1", "mbf_c3r1", "mbf_c4r1",
-										  "mbf_c4r1", "mbf_c1p2", "mbf_c3p3", "mbf_c1p3", "mbf_bro1", "mbf_c1p1", "act17mus",
-										  "mbf_c2p2", "mbf_c2p1", "act10mus", "mbf_c1p1", "mbf_mne1", "mbf_c3p3", "act17mus",
-										  "mbf_c3p2", "mbf_c3p1", "act25mus", "mbf_c4p2", "mbf_c4p1"};
-
-// Gets the filename of the background music file.
-const char *ClanGame::getClanMusicFilename(int musicId) {
-	return kClanMusicFiles[musicId];
-}
-
-ClanGame::ClanGame(byte *scriptVariables)
-	: _scriptVariables(scriptVariables) {
-}
-
-ClanGame::~ClanGame() {
-}
-
-void ClanGame::handleOp(uint8 op) {
-	switch (op) {
-	case 7:
-		debugC(1, kDebugScript, "Groovie::Script: Op42 (0x%02X): Clandestiny unknown -> NOP", op);
-		break;
-
-	case 8:
-		debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): Clandestiny Othello / Reversi", op);
-		// NOTE: Reused in UHP
-		opOthello();
-		break;
-
-	default:
-		debugC(1, kDebugScript, "Groovie::Script: Op42 (0x%02X): Clandestiny Invalid -> NOP", op);
-	}
-}
-
-void ClanGame::opOthello() {
-	// TODO
-}
-
-} // namespace Groovie
diff --git a/engines/groovie/logic/clangame.h b/engines/groovie/logic/clangame.h
deleted file mode 100644
index 478f3e7d09..0000000000
--- a/engines/groovie/logic/clangame.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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 2
-* 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, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-*/
-
-#ifndef GROOVIE_LOGIC_CLANGAME_H
-#define GROOVIE_LOGIC_CLANGAME_H
-
-#include "common/scummsys.h"
-
-namespace Groovie {
-
-class ClanGame {
-public:
-	ClanGame(byte *scriptVariables);
-	~ClanGame();
-
-	void handleOp(uint8 op);
-
-	static const char *getClanMusicFilename(int musicId);
-
-private:
-	byte *_scriptVariables;
-
-	void opOthello();
-};
-
-} // namespace Groovie
-
-#endif // GROOVIE_LOGIC_CLANGAME_H
diff --git a/engines/groovie/logic/mousetrap.cpp b/engines/groovie/logic/mousetrap.cpp
new file mode 100644
index 0000000000..b7101a85bc
--- /dev/null
+++ b/engines/groovie/logic/mousetrap.cpp
@@ -0,0 +1,85 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "groovie/groovie.h"
+#include "groovie/logic/mousetrap.h"
+
+namespace Groovie {
+
+MouseTrapGame::MouseTrapGame() : _random("MouseTrapGame") {
+}
+
+void MouseTrapGame::run(byte *scriptVariables) {
+	// TODO: Finish the logic
+	byte op = scriptVariables[2];
+
+	warning("Mousetrap subop %d", op);
+
+	// variable 24 is the mouse?
+	//scriptVariables[24] = 2;
+
+	// player wins: scriptVariables[22] = 1;
+	// stauf wins: scriptVariables[22] = 2;
+	// allows the player to click to place the mouse somewhere? scriptVariables[5] = 0;
+
+	switch (op) {
+	case 0:
+		break;
+	case 1: // init board
+		// value of 0 is V, 1 is <, 2 is ^, 3 is >
+		// variable 23 is the outside piece
+		scriptVariables[23] = _random.getRandomNumber(3);
+		// variable slot is the space number + 25, the left corner
+		// (Stauf's goal) is space 1, above that is space 2, the
+		// center is 13, and the right corner (goal) is space 25
+		for (int i = 27; i <= 49; i++) {
+			scriptVariables[i] = _random.getRandomNumber(3);
+		}
+		break;
+	case 2: // before player chooses the floor to move, set the banned move
+	{
+		int clicked = int(scriptVariables[0]) * 5 + int(scriptVariables[1]) + 1;
+		scriptVariables[clicked + 50] = 0;
+		break;
+	}
+	case 3: // after player moving floor
+		// a bunch of hardcoded conditionals to copy variables and
+		// set the banned move
+		// this probably also sets a variable to allow the player to
+		// move the mouse, and checks for win/lose
+		break;
+	case 5: // maybe player moving mouse
+		break;
+	case 6: // Stauf moving floor?
+		break;
+	case 7: // maybe Stauf moving mouse
+		break;
+	case 8: // Samantha making a move
+		break;
+
+	default:
+		warning("Unknown mousetrap op %d", op);
+		break;
+	}
+}
+
+} // End of Groovie namespace
diff --git a/engines/groovie/logic/mousetrap.h b/engines/groovie/logic/mousetrap.h
new file mode 100644
index 0000000000..7fe2a90cbc
--- /dev/null
+++ b/engines/groovie/logic/mousetrap.h
@@ -0,0 +1,60 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GROOVIE_LOGIC_MOUSETRAP_H
+#define GROOVIE_LOGIC_MOUSETRAP_H
+
+#include "common/random.h"
+#include "common/system.h"
+
+namespace Groovie {
+
+/*
+ * Mouse Trap puzzle in the Lab.
+ *
+ * Stauf's Goal is space 1, counting up as you go north east
+ * towards the north corner which is space 5 and the moveable
+ * space to the left of that is space 4.
+ * South east from Stauf's goal is the next line starting with
+ * space 6, counting up as you go north east where the moveable
+ * space to the right of the north corner is space 10
+ *
+ * Next line is 11 (unmovable) to 15 (unmoveable), this line
+ * contains the center space which is space 13
+ * Next line is 16 (moveable) to 20 (moveable)
+ * Next line is 21 (unmovable) to 25 (unmovable), with 25 being
+ * the player's goal door
+ *
+ * Space -2 is the next piece, outside of the box
+ */
+class MouseTrapGame {
+public:
+	MouseTrapGame();
+	void run(byte *scriptVariables);
+	
+private:
+	Common::RandomSource _random;
+};
+
+} // End of Groovie namespace
+
+#endif // GROOVIE_LOGIC_MOUSETRAP_H
diff --git a/engines/groovie/logic/t11hgame.cpp b/engines/groovie/logic/t11hgame.cpp
deleted file mode 100644
index ab654f613f..0000000000
--- a/engines/groovie/logic/t11hgame.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/* 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 2
-* 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, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-*/
-
-#include "groovie/logic/cake.h"
-#include "groovie/logic/t11hgame.h"
-#include "groovie/groovie.h"
-
-#include "common/archive.h"
-#include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/events.h"
-#include "common/file.h"
-#include "common/macresman.h"
-#include "common/translation.h"
-
-namespace Groovie {
-
-T11hGame::T11hGame(byte *scriptVariables)
-	: _random("GroovieT11hGame"), _scriptVariables(scriptVariables) {
-}
-
-T11hGame::~T11hGame() {
-}
-
-void T11hGame::handleOp(uint8 op) {
-	switch (op) {
-	case 1:
-		debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Connect four in the dining room. (tb.grv)", op);
-		_cake.run(_scriptVariables);
-		break;
-
-	case 2:
-		debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Beehive Puzzle in the top room (hs.grv)", op);
-		// NOTE: Reused in UHP
-		_beehive.run(_scriptVariables);
-		break;
-
-	case 3:
-		debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Make last move on modern art picture in the gallery (bs.grv)", op);
-		_gallery.run(_scriptVariables);
-		break;
-
-	case 4:
-		debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Triangle in the Chapel (tx.grv)", op);
-		opTriangle();
-		break;
-
-	case 5:
-		debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Mouse Trap in the lab (al.grv)", op);
-		// NOTE: Reused in UHP
-		opMouseTrap();
-		break;
-
-	case 6:
-		debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Pente (pt.grv)", op);
-		opPente();
-		break;
-
-	default:
-		debugC(1, kDebugScript, "Groovie::Script: Op42 (0x%02X): T11H Invalid -> NOP", op);
-	}
-}
-
-/*
- * Mouse Trap puzzle in the Lab.
- *
- * Stauf's Goal is space 1, counting up as you go north east
- * towards the north corner which is space 5 and the moveable
- * space to the left of that is space 4.
- * South east from Stauf's goal is the next line starting with
- * space 6, counting up as you go north east where the moveable
- * space to the right of the north corner is space 10
- *
- * Next line is 11 (unmovable) to 15 (unmoveable), this line
- * contains the center space which is space 13
- * Next line is 16 (moveable) to 20 (moveable)
- * Next line is 21 (unmovable) to 25 (unmovable), with 25 being
- * the player's goal door
- *
- * Space -2 is the next piece, outside of the box
- */
-void T11hGame::opMouseTrap() {
-	// TODO: Finish the logic
-	byte op = _scriptVariables[2];
-
-	warning("Mousetrap subop %d", op);
-
-	// variable 24 is the mouse?
-	//_scriptVariables[24] = 2;
-
-	// player wins: _scriptVariables[22] = 1;
-	// stauf wins: _scriptVariables[22] = 2;
-	// allows the player to click to place the mouse somewhere? _scriptVariables[5] = 0;
-
-	switch (op) {
-	case 0:
-		break;
-	case 1: // init board
-		// value of 0 is V, 1 is <, 2 is ^, 3 is >
-		// variable 23 is the outside piece
-		_scriptVariables[23] = _random.getRandomNumber(3);
-		// variable slot is the space number + 25, the left corner
-		// (Stauf's goal) is space 1, above that is space 2, the
-		// center is 13, and the right corner (goal) is space 25
-		for (int i = 27; i <= 49; i++) {
-			_scriptVariables[i] = _random.getRandomNumber(3);
-		}
-		break;
-	case 2: // before player chooses the floor to move, set the banned move
-	{
-		int clicked = int(_scriptVariables[0]) * 5 + int(_scriptVariables[1]) + 1;
-		_scriptVariables[clicked + 50] = 0;
-		break;
-	}
-	case 3: // after player moving floor
-		// a bunch of hardcoded conditionals to copy variables and
-		// set the banned move
-		// this probably also sets a variable to allow the player to
-		// move the mouse, and checks for win/lose
-		break;
-	case 5: // maybe player moving mouse
-		break;
-	case 6: // Stauf moving floor?
-		break;
-	case 7: // maybe Stauf moving mouse
-		break;
-	case 8: // Samantha making a move
-		break;
-
-	default:
-		warning("Unknown mousetrap op %d", op);
-		break;
-	}
-}
-
-void T11hGame::opPente() {
-	// FIXME: properly implement Pente game (the final puzzle)
-	// for now just auto-solve the puzzle so the player can continue
-	_scriptVariables[5] = 4;
-}
-
-void T11hGame::opTriangle() {
-	// TODO
-}
-
-} // End of Namespace Groovie
diff --git a/engines/groovie/logic/t11hgame.h b/engines/groovie/logic/t11hgame.h
deleted file mode 100644
index e1130bb8e4..0000000000
--- a/engines/groovie/logic/t11hgame.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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 2
-* 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, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-*/
-
-#ifndef GROOVIE_LOGIC_T11HGAME_H
-#define GROOVIE_LOGIC_T11HGAME_H
-
-#include "common/textconsole.h"
-#include "common/random.h"
-#include "groovie/logic/beehive.h"
-#include "groovie/logic/cake.h"
-#include "groovie/logic/gallery.h"
-
-namespace Groovie {
-
-class GroovieEngine;
-
-class T11hGame {
-public:
-#ifdef ENABLE_GROOVIE2
-	T11hGame(byte *scriptVariables);
-	~T11hGame();
-
-	void handleOp(uint8 op);
-
-private:
-	Common::RandomSource _random;
-
-	void opMouseTrap();
-	void opPente();
-	void opTriangle();
-
-	byte *_scriptVariables;
-
-	CakeGame _cake;
-	BeehiveGame _beehive;
-	GalleryGame _gallery;
-#endif
-};
-
-} // End of Groovie namespace
-
-#endif // GROOVIE_LOGIC_T11HGAME_H
diff --git a/engines/groovie/module.mk b/engines/groovie/module.mk
index 94c59f9903..0959f512a7 100644
--- a/engines/groovie/module.mk
+++ b/engines/groovie/module.mk
@@ -20,9 +20,8 @@ ifdef ENABLE_GROOVIE2
 MODULE_OBJS += \
 	logic/beehive.o \
 	logic/cake.o \
-	logic/clangame.o \
 	logic/gallery.o \
-	logic/t11hgame.o \
+	logic/mousetrap.o \
 	logic/tlcgame.o \
 	video/roq.o
 endif
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index d9e57864af..fc1ca1b9ca 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -27,7 +27,6 @@
 #include "groovie/groovie.h"
 #include "groovie/resource.h"
 #include "groovie/logic/tlcgame.h"
-#include "groovie/logic/clangame.h"
 
 #include "backends/audiocd/audiocd.h"
 #include "common/config-manager.h"
@@ -839,12 +838,21 @@ bool MusicPlayerTlc::load(uint32 fileref, bool loop) {
 	return true;
 }
 
+// This a list of files for background music. This list is hardcoded in the Clandestiny player.
+const char *kClanMusicFiles[] = {
+	"mbf_arb1", "mbf_arm1", "mbf_bal1", "mbf_c2p2", "act18mus", "act15mus", "act21mus",
+	"act05mus", "act04mus", "act23mus", "act17mus", "act03mus", "act06mus", "act19mus",
+	"act07mus", "mbf_mne1", "act24mus", "act24mus", "act14mus", "act20mus", "act15mus",
+	"act13mus", "act08mus", "mbf_uph1", "mbf_uph1", "act19mus", "mbf_bol1", "mbf_cbk1",
+	"mbf_glf1", "mbf_bro1", "mbf_c1r1", "mbf_c1r1", "mbf_c1r1", "mbf_c1r1", "mbf_c2r1",
+	"mbf_c2r1", "mbf_c2r1", "mbf_c2r1", "mbf_c3r1", "mbf_c3r1", "mbf_c3r1", "mbf_c4r1",
+	"mbf_c4r1", "mbf_c1p2", "mbf_c3p3", "mbf_c1p3", "mbf_bro1", "mbf_c1p1", "act17mus",
+	"mbf_c2p2", "mbf_c2p1", "act10mus", "mbf_c1p1", "mbf_mne1", "mbf_c3p3", "act17mus",
+	"mbf_c3p2", "mbf_c3p1", "act25mus", "mbf_c4p2", "mbf_c4p1"
+};
+
 Common::String MusicPlayerClan::getFilename(uint32 fileref) {
-#ifdef ENABLE_GROOVIE2
-	return ClanGame::getClanMusicFilename(fileref);
-#else
-	return "";
-#endif
+	return kClanMusicFiles[fileref];
 }
 
 } // End of Groovie namespace
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 7006e826c8..a1d76161b5 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -32,8 +32,7 @@
 #include "groovie/resource.h"
 #include "groovie/saveload.h"
 #include "groovie/logic/cell.h"
-#include "groovie/logic/clangame.h"
-#include "groovie/logic/t11hgame.h"
+#include "groovie/logic/logic.h"
 #include "groovie/logic/tlcgame.h"
 
 #include "gui/saveload.h"
@@ -75,7 +74,7 @@ const byte t7gMidiInitScript[] = {
 Script::Script(GroovieEngine *vm, EngineVersion version) :
 	_code(NULL), _savedCode(NULL), _stacktop(0), _debugger(NULL), _vm(vm),
 	_videoFile(NULL), _videoRef(UINT_MAX), _cellGame(NULL), _lastCursor(0xff),
-	_version(version), _random("GroovieScripts"), _tlcGame(0), _t11hGame(0) {
+	_version(version), _random("GroovieScripts"), _tlcGame(0) {
 
 	// Initialize the opcode set depending on the engine version
 	if (version == kGroovieT7G) {
@@ -119,7 +118,6 @@ Script::~Script() {
 	delete _videoFile;
 	delete _cellGame;
 	delete _tlcGame;
-	delete _t11hGame;
 }
 
 void Script::setVariable(uint16 variablenum, byte value) {
@@ -2056,8 +2054,10 @@ void Script::o2_setvideoskip() {
 	debugC(1, kDebugScript, "Groovie::Script: SetVideoSkip (0x%04X)", _videoSkipAddress);
 }
 
-// This function depends on the actual game played. So it is different for 
-// T7G, 11H, TLC, ...
+// This function depends on the actual game played. There was an initial version
+// for T7G, and then it kept being expanded in newer games (11H, Clan, UHP). This
+// means that newer games contained logic used in older ones (e.g. Clandestiny
+// and UHP include the hardcoded puzzle logic of 11H).
 void Script::o_gamelogic() {
 	uint8 param = readScript8bits();
 
@@ -2079,39 +2079,54 @@ void Script::o_gamelogic() {
 		break;
 
 #ifdef ENABLE_GROOVIE2
-	case kGroovieTLC:
-		if (!_tlcGame)
-			_tlcGame = new TlcGame(_variables);
-
-		_tlcGame->handleOp(param);
-		break;
-
 	case kGroovieT11H:
-		if (!_t11hGame)
-			_t11hGame = new T11hGame(_variables);
-
-		_t11hGame->handleOp(param);
-		break;
-
 	case kGroovieCDY:
-		if (!_clanGame)
-			_clanGame = new ClanGame(_variables);
-
-		_clanGame->handleOp(param);
+	case kGroovieUHP:
+		switch (param) {
+		case 1:
+			debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Connect four in the dining room. (tb.grv)", param);
+			_cake.run(_variables);
+			break;
+		case 2:
+			debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H/UHP Beehive Puzzle in the top room (hs.grv)", param);
+			_beehive.run(_variables);
+			break;
+		case 3:
+			debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Make last move on modern art picture in the gallery (bs.grv)", param);
+			_gallery.run(_variables);
+			break;
+		case 4:
+			debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Triangle in the Chapel (tx.grv)", param);
+			// TODO
+			break;
+		case 5:
+			debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H/UHP Mouse Trap in the lab (al.grv)", param);
+			_mouseTrap.run(_variables);
+			break;
+		case 6:
+			debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): T11H Pente - final puzzle (pt.grv)", param);
+			// TODO
+			// For now, just auto-solve the puzzle, so the player can continue
+			_variables[5] = 4;
+			break;
+		case 7:
+			debugC(1, kDebugScript, "Groovie::Script: Op42 (0x%02X): Clandestiny unknown -> NOP", param);
+			// TODO
+			break;
+		case 8:
+			debugC(1, kDebugScript, "Groovie::Script Op42 (0x%02X): Clandestiny/UHP Othello / Reversi", param);
+			// TODO
+			break;
+		default:
+			debugC(1, kDebugScript, "Groovie::Script: Op42 (0x%02X): Invalid -> NOP", param);
+		}
 		break;
 
-	case kGroovieUHP:
-		if (param != 8) {
-			if (!_t11hGame)
-				_t11hGame = new T11hGame(_variables);
-			
-			_t11hGame->handleOp(param);
-		} else {
-			if (!_clanGame)
-				_clanGame = new ClanGame(_variables);
+	case kGroovieTLC:
+		if (!_tlcGame)
+			_tlcGame = new TlcGame(_variables);
 
-			_clanGame->handleOp(param);
-		}
+		_tlcGame->handleOp(param);
 		break;
 #endif
 
diff --git a/engines/groovie/script.h b/engines/groovie/script.h
index 2d535ff46c..1e02da5013 100644
--- a/engines/groovie/script.h
+++ b/engines/groovie/script.h
@@ -24,6 +24,10 @@
 #define GROOVIE_SCRIPT_H
 
 #include "groovie/groovie.h"
+#include "groovie/logic/beehive.h"
+#include "groovie/logic/cake.h"
+#include "groovie/logic/gallery.h"
+#include "groovie/logic/mousetrap.h"
 
 #include "common/random.h"
 #include "common/rect.h"
@@ -42,8 +46,6 @@ class CellGame;
 class Debugger;
 class GroovieEngine;
 class TlcGame;
-class T11hGame;
-class ClanGame;
 
 class Script {
 	friend class Debugger;
@@ -135,8 +137,6 @@ private:
 	// Special classes depending on played game
 	CellGame *_cellGame;
 	TlcGame *_tlcGame;
-	T11hGame *_t11hGame;
-	ClanGame *_clanGame;
 
 	// Helper functions
 	uint8 getCodeByte(uint16 address);
@@ -259,6 +259,11 @@ private:
 	void o2_playsound();
 	void o2_check_sounds_overlays();
 	void o2_preview_loadgame();
+
+	CakeGame _cake;
+	BeehiveGame _beehive;
+	GalleryGame _gallery;
+	MouseTrapGame _mouseTrap;
 };
 
 } // End of Groovie namespace




More information about the Scummvm-git-logs mailing list