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

LubomirR lubomirr at lubomirr.eu
Wed Oct 31 19:20:56 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:
b87391338e MUTATIONOFJB: Add basic support for RABLOAD command.


Commit: b87391338e1e91aa213247420e4bfcb7e09e984d
    https://github.com/scummvm/scummvm/commit/b87391338e1e91aa213247420e4bfcb7e09e984d
Author: Ľubomír Remák (lubomirr at lubomirr.eu)
Date: 2018-10-31T19:19:41+01:00

Commit Message:
MUTATIONOFJB: Add basic support for RABLOAD command.

Also fix an issue with parsing IF command.
This commit makes the game completable (with many issues).

Changed paths:
  A engines/mutationofjb/commands/loadplayercommand.cpp
  A engines/mutationofjb/commands/loadplayercommand.h
    engines/mutationofjb/commands/conditionalcommand.cpp
    engines/mutationofjb/commands/conditionalcommand.h
    engines/mutationofjb/commands/ifcommand.cpp
    engines/mutationofjb/commands/ifitemcommand.cpp
    engines/mutationofjb/commands/ifpiggycommand.cpp
    engines/mutationofjb/commands/talkcommand.h
    engines/mutationofjb/module.mk
    engines/mutationofjb/script.cpp


diff --git a/engines/mutationofjb/commands/conditionalcommand.cpp b/engines/mutationofjb/commands/conditionalcommand.cpp
index 56cc2bf..9488dd5 100644
--- a/engines/mutationofjb/commands/conditionalcommand.cpp
+++ b/engines/mutationofjb/commands/conditionalcommand.cpp
@@ -33,12 +33,12 @@ void ConditionalCommandParser::transition(ScriptParseContext &parseContext, Comm
 	}
 
 	ConditionalCommand *const condCommand = static_cast<ConditionalCommand *>(oldCommand);
-	parseContext.addConditionalCommand(condCommand, _lastTag, _firstHash);
+	parseContext.addConditionalCommand(condCommand, _tags.pop(), _firstHash);
 	condCommand->setTrueCommand(newCommand);
 }
 
 void ConditionalCommandParser::finish(ScriptParseContext &) {
-	_lastTag = 0;
+	_tags.clear();
 }
 
 
diff --git a/engines/mutationofjb/commands/conditionalcommand.h b/engines/mutationofjb/commands/conditionalcommand.h
index ea1a66a..1ca29b6 100644
--- a/engines/mutationofjb/commands/conditionalcommand.h
+++ b/engines/mutationofjb/commands/conditionalcommand.h
@@ -25,16 +25,17 @@
 
 #include "mutationofjb/commands/command.h"
 #include "common/scummsys.h"
+#include "common/queue.h"
 
 namespace MutationOfJB {
 
 class ConditionalCommandParser : public CommandParser {
 public:
-	ConditionalCommandParser(bool firstHash = false) : _lastTag(0), _firstHash(firstHash) {}
+	ConditionalCommandParser(bool firstHash = false) : _firstHash(firstHash) {}
 	virtual void transition(ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser);
 	virtual void finish(ScriptParseContext &parseCtx) override;
 protected:
-	char _lastTag;
+	Common::Queue<char> _tags;
 private:
 	bool _firstHash;
 };
diff --git a/engines/mutationofjb/commands/ifcommand.cpp b/engines/mutationofjb/commands/ifcommand.cpp
index fb48787..f4753a4 100644
--- a/engines/mutationofjb/commands/ifcommand.cpp
+++ b/engines/mutationofjb/commands/ifcommand.cpp
@@ -69,7 +69,7 @@ bool IfCommandParser::parse(const Common::String &line, ScriptParseContext &, Co
 	const uint8 value = atoi(cstr + 9);
 	const bool negative = (line.lastChar() == '!');
 
-	_lastTag = tag;
+	_tags.push(tag);
 
 	command = new IfCommand(sceneId, objectId, value, negative);
 
diff --git a/engines/mutationofjb/commands/ifitemcommand.cpp b/engines/mutationofjb/commands/ifitemcommand.cpp
index 9695172..2b9b4d3 100644
--- a/engines/mutationofjb/commands/ifitemcommand.cpp
+++ b/engines/mutationofjb/commands/ifitemcommand.cpp
@@ -60,7 +60,7 @@ bool IfItemCommandParser::parse(const Common::String &line, ScriptParseContext &
 		item.deleteLastChar(); // Remove '!'.
 	}
 
-	_lastTag = 0;
+	_tags.push(0);
 	command = new IfItemCommand(item, negative);
 
 	return true;
diff --git a/engines/mutationofjb/commands/ifpiggycommand.cpp b/engines/mutationofjb/commands/ifpiggycommand.cpp
index 4df1deb..57d12ef 100644
--- a/engines/mutationofjb/commands/ifpiggycommand.cpp
+++ b/engines/mutationofjb/commands/ifpiggycommand.cpp
@@ -49,7 +49,7 @@ bool IfPiggyCommandParser::parse(const Common::String &line, ScriptParseContext
 		return false;
 	}
 
-	_lastTag = 0;
+	_tags.push(0);
 	command = new IfPiggyCommand();
 
 	return true;
diff --git a/engines/mutationofjb/commands/loadplayercommand.cpp b/engines/mutationofjb/commands/loadplayercommand.cpp
new file mode 100644
index 0000000..757c3fa
--- /dev/null
+++ b/engines/mutationofjb/commands/loadplayercommand.cpp
@@ -0,0 +1,66 @@
+/* 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/loadplayercommand.h"
+
+#include "mutationofjb/game.h"
+#include "mutationofjb/gamedata.h"
+#include "mutationofjb/script.h"
+
+#include "common/str.h"
+
+/** @file
+ * "RABLOAD " <apkFrameFirst> " " <apkFrameLast> " " <playerFrameFirst> " " <palIndexFirst> " " <apkFilename>
+ *
+ * Load player frames from APK file specified by apkFileName.
+ * Only frames between apkFrameFirst and apkFrameLast are loaded onto position defined by playerFrameFirst.
+ * Player's palette is loaded at index defined by palIndexFirst.
+ */
+
+namespace MutationOfJB {
+
+bool LoadPlayerCommandParser::parse(const Common::String &line, ScriptParseContext &, Command *&command) {
+	if (line.size() < 25 || !line.hasPrefix("RABLOAD ")) {
+		return false;
+	}
+
+	const uint8 apkFrameFirst = atoi(line.c_str() + 8);
+	const uint8 apkFrameLast = atoi(line.c_str() + 12);
+	const uint8 playerFrameFirst = atoi(line.c_str() + 16);
+	const uint8 palIndexFirst = atoi(line.c_str() + 20);
+	const Common::String apkFileName = line.c_str() + 24;
+
+	command = new LoadPlayerCommand(apkFrameFirst, apkFrameLast, playerFrameFirst, palIndexFirst, apkFileName);
+	return true;
+}
+
+Command::ExecuteResult LoadPlayerCommand::execute(ScriptExecutionContext &scriptExeCtx) {
+	scriptExeCtx.getGameData()._currentAPK = _apkFileName;
+
+	return Command::Finished;
+}
+
+Common::String LoadPlayerCommand::debugString() const {
+	return Common::String::format("LOADPLAYER %u %u %u %u %s", (unsigned int) _apkFrameFirst, (unsigned int) _apkFrameLast, (unsigned int) _playerFrameFirst, (unsigned int) _palIndexFirst, _apkFileName.c_str());
+}
+
+}
diff --git a/engines/mutationofjb/commands/loadplayercommand.h b/engines/mutationofjb/commands/loadplayercommand.h
new file mode 100644
index 0000000..4616e42
--- /dev/null
+++ b/engines/mutationofjb/commands/loadplayercommand.h
@@ -0,0 +1,55 @@
+/* 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_LOADPLAYERCOMMAND_H
+#define MUTATIONOFJB_LOADPLAYERCOMMAND_H
+
+#include "mutationofjb/commands/seqcommand.h"
+#include "common/scummsys.h"
+#include "mutationofjb/tasks/task.h"
+
+namespace MutationOfJB {
+
+class ConversationTask;
+
+class LoadPlayerCommandParser : public SeqCommandParser {
+public:
+	virtual bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override;
+};
+
+class LoadPlayerCommand : public SeqCommand {
+public:
+	LoadPlayerCommand(uint8 apkFrameFirst, uint8 apkFrameLast, uint8 playerFrameFirst, uint8 palIndexFirst, const Common::String &apkFileName) : _apkFrameFirst(apkFrameFirst), _apkFrameLast(apkFrameLast), _playerFrameFirst(playerFrameFirst), _palIndexFirst(palIndexFirst), _apkFileName(apkFileName) {}
+	virtual ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
+	virtual Common::String debugString() const override;
+
+private:
+	uint8 _apkFrameFirst;
+	uint8 _apkFrameLast;
+	uint8 _playerFrameFirst;
+	uint8 _palIndexFirst;
+	Common::String _apkFileName;
+};
+
+}
+
+#endif
diff --git a/engines/mutationofjb/commands/talkcommand.h b/engines/mutationofjb/commands/talkcommand.h
index 15b185c..cf01ddd 100644
--- a/engines/mutationofjb/commands/talkcommand.h
+++ b/engines/mutationofjb/commands/talkcommand.h
@@ -46,7 +46,7 @@ public:
 
 	TalkCommand(Mode mode) : _mode(mode) {}
 	virtual ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override;
-	virtual Common::String debugString() const;
+	virtual Common::String debugString() const override;
 
 private:
 	Mode _mode;
diff --git a/engines/mutationofjb/module.mk b/engines/mutationofjb/module.mk
index cc8eab1..20272d0 100644
--- a/engines/mutationofjb/module.mk
+++ b/engines/mutationofjb/module.mk
@@ -14,6 +14,7 @@ MODULE_OBJS := \
 	commands/ifitemcommand.o \
 	commands/ifpiggycommand.o \
 	commands/labelcommand.o \
+	commands/loadplayercommand.o \
 	commands/newroomcommand.o \
 	commands/removeallitemscommand.o \
 	commands/removeitemcommand.o \
diff --git a/engines/mutationofjb/script.cpp b/engines/mutationofjb/script.cpp
index 4915530..a4bbb8f 100644
--- a/engines/mutationofjb/script.cpp
+++ b/engines/mutationofjb/script.cpp
@@ -48,6 +48,7 @@
 #include "mutationofjb/commands/setcolorcommand.h"
 #include "mutationofjb/commands/specialshowcommand.h"
 #include "mutationofjb/commands/switchpartcommand.h"
+#include "mutationofjb/commands/loadplayercommand.h"
 #include "mutationofjb/game.h"
 
 namespace MutationOfJB {
@@ -79,6 +80,7 @@ static CommandParser **getParsers() {
 		new SetColorCommandParser,
 		new SpecialShowCommandParser,
 		new SwitchPartCommandParser,
+		new LoadPlayerCommandParser,
 		nullptr
 	};
 





More information about the Scummvm-git-logs mailing list