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

LubomirR lubomirr at lubomirr.eu
Sun Oct 28 17:46:27 CET 2018


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:
d4087d7902 MUTATIONOFJB: Allow completion of first chapter.


Commit: d4087d790222484465de8c2dd4ed1be5e178d22e
    https://github.com/scummvm/scummvm/commit/d4087d790222484465de8c2dd4ed1be5e178d22e
Author: Ľubomír Remák (lubomirr at lubomirr.eu)
Date: 2018-10-28T17:45:26+01:00

Commit Message:
MUTATIONOFJB: Allow completion of first chapter.

Implement dummy SPECIALSHOW command (skip puzzle).
Fix NEWROOM command parsing.
Fix use action on inventory items.
Fix interaction with certain doors.

Changed paths:
  A engines/mutationofjb/commands/specialshowcommand.cpp
  A engines/mutationofjb/commands/specialshowcommand.h
    engines/mutationofjb/commands/newroomcommand.cpp
    engines/mutationofjb/gamescreen.cpp
    engines/mutationofjb/module.mk
    engines/mutationofjb/script.cpp
    engines/mutationofjb/widgets/gamewidget.cpp


diff --git a/engines/mutationofjb/commands/newroomcommand.cpp b/engines/mutationofjb/commands/newroomcommand.cpp
index 0f4d214..32c5e72 100644
--- a/engines/mutationofjb/commands/newroomcommand.cpp
+++ b/engines/mutationofjb/commands/newroomcommand.cpp
@@ -27,7 +27,7 @@
 #include "common/str.h"
 
 /** @file
- * "NEWROOM " <sceneId> " " <x> " " <y> " " <frame>
+ * "NEWROOM " <sceneId> " " <x> " " <y> [ " "  <frame> ]
  *
  * NEWROOM changes the current scene. While doing that, it also executes STARTUP section for the new room.
  * However, after that, the execution goes back to the old script to finish commands after NEWROOM.
@@ -39,14 +39,16 @@
 namespace MutationOfJB {
 
 bool NewRoomCommandParser::parse(const Common::String &line, ScriptParseContext &, Command *&command) {
-	if (line.size() < 23 || !line.hasPrefix("NEWROOM")) {
+	if (line.size() < 19 || !line.hasPrefix("NEWROOM")) {
 		return false;
 	}
 
 	const uint8 sceneId = atoi(line.c_str() + 8);
 	const uint16 x = atoi(line.c_str() + 12);
 	const uint16 y = atoi(line.c_str() + 16);
-	const uint8 frame = atoi(line.c_str() + 20);
+	uint8 frame = 0;
+	if (line.size() >= 21)
+		frame = atoi(line.c_str() + 20);
 	command = new NewRoomCommand(sceneId, x, y, frame);
 	return true;
 }
diff --git a/engines/mutationofjb/commands/specialshowcommand.cpp b/engines/mutationofjb/commands/specialshowcommand.cpp
new file mode 100644
index 0000000..508641d
--- /dev/null
+++ b/engines/mutationofjb/commands/specialshowcommand.cpp
@@ -0,0 +1,78 @@
+/* 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 "mutationofjb/commands/specialshowcommand.h"
+
+#include "mutationofjb/game.h"
+#include "mutationofjb/gamedata.h"
+#include "mutationofjb/script.h"
+
+#include "common/str.h"
+
+/** @file
+ * "SPECIALSHOW " <mode>
+ *
+ * Shows special screen.
+ * The command supports multiple modes:
+ *   1 - show puzzle hint,
+ *   2 - show computer puzzle.
+ */
+
+namespace MutationOfJB {
+
+bool SpecialShowCommandParser::parse(const Common::String &line, ScriptParseContext &, Command *&command) {
+	if (line.size() < 13 || !line.hasPrefix("SPECIALSHOW ")) {
+		return false;
+	}
+
+	const int modeInt = atoi(line.c_str() + 12);
+
+	SpecialShowCommand::Mode mode = SpecialShowCommand::PUZZLE_HINT;
+
+	if (modeInt == 1) {
+		mode = SpecialShowCommand::PUZZLE_HINT;
+	} else if (modeInt == 2) {
+		mode = SpecialShowCommand::COMPUTER_PUZZLE;
+	} else {
+		warning("Invalid special show mode %d", modeInt);
+		return false;
+	}
+
+	command = new SpecialShowCommand(mode);
+	return true;
+}
+
+Command::ExecuteResult SpecialShowCommand::execute(ScriptExecutionContext &scriptExeCtx) {
+	// TODO: Show UI.
+	if (_mode == COMPUTER_PUZZLE) {
+		scriptExeCtx.getGameData().getScene(32)->getObject(2, true)->_WX = 255;
+		scriptExeCtx.getGameData().getScene(32)->getObject(1, true)->_active = 0;
+	}
+	return Command::Finished;
+}
+
+Common::String SpecialShowCommand::debugString() const {
+	const char *modes[] = {"PUZZLE_HINT", "COMPUTER_PUZZLE"};
+	return Common::String::format("SPECIALSHOW %s", modes[static_cast<int>(_mode)]);
+}
+
+}
diff --git a/engines/mutationofjb/commands/specialshowcommand.h b/engines/mutationofjb/commands/specialshowcommand.h
new file mode 100644
index 0000000..402940d
--- /dev/null
+++ b/engines/mutationofjb/commands/specialshowcommand.h
@@ -0,0 +1,53 @@
+/* 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 MUTATIONOFJB_SPECIALSHOWCOMMAND_H
+#define MUTATIONOFJB_SPECIALSHOWCOMMAND_H
+
+#include "mutationofjb/commands/seqcommand.h"
+#include "common/scummsys.h"
+
+namespace MutationOfJB {
+
+class SpecialShowCommandParser : public SeqCommandParser {
+public:
+	virtual bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override;
+};
+
+class SpecialShowCommand : public SeqCommand {
+public:
+	enum Mode {
+		PUZZLE_HINT,
+		COMPUTER_PUZZLE
+	};
+
+	SpecialShowCommand(Mode mode) : _mode(mode) {}
+	virtual ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
+	virtual Common::String debugString() const override;
+
+private:
+	Mode _mode;
+};
+
+}
+
+#endif
diff --git a/engines/mutationofjb/gamescreen.cpp b/engines/mutationofjb/gamescreen.cpp
index 739d260..d92f418 100644
--- a/engines/mutationofjb/gamescreen.cpp
+++ b/engines/mutationofjb/gamescreen.cpp
@@ -361,7 +361,7 @@ void GameScreen::onInventoryItemClicked(InventoryWidget *, int posInWidget) {
 		if (_currentPickedItem.empty()) {
 			// Inventory items ending with '[' aren't supposed to be combined (e.g. Fisher's mask).
 			if (item.lastChar() == '[')
-				_game.startActionSection(ActionInfo::Look, item);
+				_game.startActionSection(ActionInfo::Use, item);
 			else
 				_currentPickedItem = item;
 		} else {
diff --git a/engines/mutationofjb/module.mk b/engines/mutationofjb/module.mk
index 5918536..d9f536a 100644
--- a/engines/mutationofjb/module.mk
+++ b/engines/mutationofjb/module.mk
@@ -21,6 +21,7 @@ MODULE_OBJS := \
 	commands/saycommand.o \
 	commands/seqcommand.o \
 	commands/setcolorcommand.o \
+	commands/specialshowcommand.o \
 	commands/talkcommand.o \
 	commands/randomcommand.o \
 	tasks/conversationtask.o \
diff --git a/engines/mutationofjb/script.cpp b/engines/mutationofjb/script.cpp
index 85574da..d2b9602 100644
--- a/engines/mutationofjb/script.cpp
+++ b/engines/mutationofjb/script.cpp
@@ -46,6 +46,7 @@
 #include "mutationofjb/commands/talkcommand.h"
 #include "mutationofjb/commands/randomcommand.h"
 #include "mutationofjb/commands/setcolorcommand.h"
+#include "mutationofjb/commands/specialshowcommand.h"
 #include "mutationofjb/game.h"
 
 namespace MutationOfJB {
@@ -75,6 +76,7 @@ static CommandParser **getParsers() {
 		new RandomCommandParser,
 		new RandomBlockStartParser,
 		new SetColorCommandParser,
+		new SpecialShowCommandParser,
 		nullptr
 	};
 
diff --git a/engines/mutationofjb/widgets/gamewidget.cpp b/engines/mutationofjb/widgets/gamewidget.cpp
index c481869..6037367 100644
--- a/engines/mutationofjb/widgets/gamewidget.cpp
+++ b/engines/mutationofjb/widgets/gamewidget.cpp
@@ -108,11 +108,9 @@ void GameWidget::handleNormalScene(const Common::Event &event) {
 
 		bool entityHit = false;
 		if (Door *const door = scene->findDoor(x, y)) {
-			if (door->_destSceneId != 0) {
-				if (_callback)
-					_callback->onGameEntityHovered(this, door->_name);
-				entityHit = true;
-			}
+			if (_callback)
+				_callback->onGameEntityHovered(this, door->_name);
+			entityHit = true;
 		} else if (Static *const stat = scene->findStatic(x, y)) {
 			if (_callback)
 				_callback->onGameEntityHovered(this, stat->_name);





More information about the Scummvm-git-logs mailing list