aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhitertandrek2018-03-15 22:02:52 +0200
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commit280b24965708d7db3066bad06a4115d52cfacf31 (patch)
treecb5df1df227b18f12313c5b9bb7560c8ba7fdcb8
parenta95d133e54d4c89898a5485139030423c4dee8aa (diff)
downloadscummvm-rg350-280b24965708d7db3066bad06a4115d52cfacf31.tar.gz
scummvm-rg350-280b24965708d7db3066bad06a4115d52cfacf31.tar.bz2
scummvm-rg350-280b24965708d7db3066bad06a4115d52cfacf31.zip
PINK: Initial commit
Implemented skeleton of engine, detection, broFile and started orbFile implementation.
-rw-r--r--engines/pink/configure.engine3
-rw-r--r--engines/pink/console.h41
-rw-r--r--engines/pink/detection.cpp96
-rw-r--r--engines/pink/file.cpp120
-rw-r--r--engines/pink/file.h81
-rw-r--r--engines/pink/module.mk18
-rw-r--r--engines/pink/pink.cpp103
-rw-r--r--engines/pink/pink.h84
8 files changed, 546 insertions, 0 deletions
diff --git a/engines/pink/configure.engine b/engines/pink/configure.engine
new file mode 100644
index 0000000000..80a2df6d60
--- /dev/null
+++ b/engines/pink/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine pink "Pink Panther" no "" "" ""
diff --git a/engines/pink/console.h b/engines/pink/console.h
new file mode 100644
index 0000000000..03f48821b1
--- /dev/null
+++ b/engines/pink/console.h
@@ -0,0 +1,41 @@
+/* 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 PINK_CONSOLE_H
+#define PINK_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Pink {
+
+class PinkEngine;
+
+class Console : public GUI::Debugger {
+public:
+ Console(PinkEngine *vm) {}
+
+ virtual ~Console(void) {}
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
new file mode 100644
index 0000000000..16b289b65b
--- /dev/null
+++ b/engines/pink/detection.cpp
@@ -0,0 +1,96 @@
+/* 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 <gui/EventRecorder.h>
+#include "pink.h"
+
+static const PlainGameDescriptor pinkGames[] = {
+ {"peril", "The Pink Panther: Passport to Peril"},
+ {"pokus", "The Pink Panther: Hokus Pokus Pink"},
+ {0, 0}
+};
+
+namespace Pink {
+
+static const ADGameDescription gameDescriptions[] = {
+ {
+ "peril",
+ 0,{
+ {"PPTP.ORB", NULL, NULL, -1},
+ {"PPTP.BRO", NULL, NULL, -1},
+ AD_LISTEND},
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ {
+ "peril",
+ 0,
+ AD_ENTRY1s("hpp.ORB", NULL, -1),
+ Common::RU_RUS,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+ AD_TABLE_END_MARKER
+};
+
+} // End of namespace Pink
+
+
+class PinkMetaEngine : public AdvancedMetaEngine {
+public:
+ PinkMetaEngine() : AdvancedMetaEngine(Pink::gameDescriptions, sizeof(ADGameDescription), pinkGames) {
+ _gameIds = pinkGames;
+ }
+
+ virtual const char *getName() const {
+ return "Pink Panther Engine";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Pink Panther Engine (C) Wanderlust Interactive";
+ }
+
+ //virtual bool hasFeature(MetaEngineFeature f) const;
+ //virtual int getMaximumSaveSlot() const { return 0; }
+ //virtual SaveStateList listSaves(const char *target) const;
+ //virtual void removeSaveState(const char *target, int slot) const;
+ //virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+};
+
+bool PinkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ if (desc) {
+ *engine = new Pink::PinkEngine(syst, desc);
+ }
+
+ return desc != 0;
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(PINK)
+REGISTER_PLUGIN_DYNAMIC(PINK, PLUGIN_TYPE_ENGINE, PinkMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(PINK, PLUGIN_TYPE_ENGINE, PinkMetaEngine);
+#endif
diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp
new file mode 100644
index 0000000000..5bcd8cc089
--- /dev/null
+++ b/engines/pink/file.cpp
@@ -0,0 +1,120 @@
+/* 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/str.h>
+#include "pink.h"
+
+namespace Pink {
+
+OrbFile::OrbFile()
+ : File(), _timestamp(0),
+ _tableOffset(0),
+ _tableSize(0),
+ _table(nullptr)
+{}
+
+OrbFile::~OrbFile() {
+ delete[] _table;
+}
+
+bool OrbFile::open(Common::String &name) {
+ if (!File::open(name))
+ return false;
+
+ if (readUint32BE() != 'ORB\0'){
+ close();
+ return false;
+ }
+
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
+ //output
+ if (minor || major != 2){
+ return false;
+ }
+
+ _timestamp = readUint32LE();
+ if (!_timestamp){
+ return false;
+ }
+ //convert to date
+ //output into debug
+
+ _tableOffset = readUint32LE();
+ _tableSize = readUint32LE();
+ _table = new ObjectDescription[_tableSize];
+
+ for (size_t i = 0; i < _tableSize; ++i) {
+ _table[i].deserialize(*this);
+ }
+
+ return true;
+}
+
+void OrbFile::LoadGame(PinkEngine *game) {
+
+}
+
+void OrbFile::LoadObject(void *obj, Common::String &name) {
+
+}
+
+uint32 OrbFile::getTimestamp() {
+ return _timestamp;
+}
+
+bool BroFile::open(Common::String &name, uint32 orbTimestamp) {
+ if (!File::open(name) || readUint32BE() != 'BRO\0')
+ return false;
+
+ uint16 minor = readUint16LE();
+ uint16 major = readUint16LE();
+ // do output
+
+ if (minor || major != 1){
+ return false;
+ }
+
+ uint32 _timestamp = readUint32LE();
+
+ return _timestamp == orbTimestamp;
+}
+
+void ObjectDescription::deserialize(Common::File &file) {
+ file.read(name, sizeof(name));
+ file.read(&objectsOffset, sizeof(objectsOffset));
+ file.read(&objectsCount, sizeof(objectsCount));
+ file.read(&resourcesOffset, sizeof(resourcesOffset));
+ file.read(&resourcesCount, sizeof(resourcesCount));
+}
+
+void ResourseDescription::deserialize(Common::File &file) {
+ file.read(name, sizeof(name));
+ file.read(&offset, sizeof(offset));
+ file.read(&size, sizeof(offset));
+
+ uint16 temp;
+ file.read(&temp, sizeof(temp));
+ InBro = temp ? true : false;
+}
+
+} // End of namespace Pink \ No newline at end of file
diff --git a/engines/pink/file.h b/engines/pink/file.h
new file mode 100644
index 0000000000..64e3782778
--- /dev/null
+++ b/engines/pink/file.h
@@ -0,0 +1,81 @@
+/* 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 PINK_FILE_H
+#define PINK_FILE_H
+
+#include <common/file.h>
+
+namespace Pink {
+
+struct ObjectDescription {
+ void deserialize(Common::File &file);
+
+ char name[16];
+ uint32 objectsOffset;
+ uint32 objectsCount;
+ uint32 resourcesOffset;
+ uint32 resourcesCount;
+};
+
+struct ResourseDescription {
+ void deserialize(Common::File &file);
+
+ char name[16];
+ uint32 offset;
+ uint32 size;
+ bool InBro; // in original it is short.
+ // Don't know what's better to use.(Perhaps no diffrence because of padding)
+};
+
+class PinkEngine;
+
+class OrbFile : public Common::File {
+public:
+ OrbFile();
+ virtual ~OrbFile();
+
+ virtual bool open(Common::String &name);
+
+ void LoadGame(PinkEngine *game);
+ void LoadObject(void *obj, Common::String &name);
+
+ uint32 getTimestamp();
+
+private:
+ uint32 _timestamp;
+ uint32 _tableOffset;
+ uint32 _tableSize;
+ ObjectDescription *_table;
+};
+
+class BroFile : public Common::File {
+public:
+ BroFile() = default;
+ virtual ~BroFile() = default;
+
+ virtual bool open(Common::String &name, uint32 orbId);
+};
+
+} // End of namespace Pink
+
+#endif
diff --git a/engines/pink/module.mk b/engines/pink/module.mk
new file mode 100644
index 0000000000..754c957feb
--- /dev/null
+++ b/engines/pink/module.mk
@@ -0,0 +1,18 @@
+MODULE := engines/pink
+
+MODULE_OBJS = \
+ pink.o \
+ console.o \
+ detection.o \
+ director.o \
+ sound.o \
+ file.o \
+
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_PLUMBERS), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk \ No newline at end of file
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
new file mode 100644
index 0000000000..f45afbb6e6
--- /dev/null
+++ b/engines/pink/pink.cpp
@@ -0,0 +1,103 @@
+/* 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 "pink.h"
+#include "console.h"
+#include <audio/mixer.h>
+#include <engines/util.h>
+
+namespace Pink {
+
+Pink::PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
+ : Engine(system), _rnd("pink"), _desc(*desc),
+ _bro(nullptr)
+{
+ /* TODO
+ * setup debug channels
+ *
+ */
+}
+
+Pink::PinkEngine::~PinkEngine() {
+ delete _console;
+ delete _bro;
+}
+
+Common::Error PinkEngine::init() {
+ initGraphics(640, 480);
+
+ _console = new Console(this);
+
+ if (_desc.filesDescriptions[1].fileName){
+ _bro = new BroFile();
+ }
+
+ Common::String orbName = _desc.filesDescriptions[0].fileName;
+ Common::String broName = _desc.filesDescriptions[1].fileName;
+
+ if (!_orb.open(orbName) || (_bro && !_bro->open(broName, _orb.getTimestamp()))){
+ return Common::kNoGameDataFoundError;
+ }
+
+ return Common::kNoError;
+}
+
+Common::Error Pink::PinkEngine::run() {
+ Common::Error error = init();
+ if (error.getCode() != Common::kNoError){
+ return error;
+ }
+
+ while(!shouldQuit()){
+ Common::Event event;
+ while(_eventMan->pollEvent(event)){
+ switch (event.type){
+ case Common::EVENT_QUIT:
+ case Common::EVENT_RTL:
+
+ return Common::kNoError;
+ case Common::EVENT_MOUSEMOVE:
+
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+
+ break;
+
+ // don't know why it is used in orginal
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
+ case Common::EVENT_KEYDOWN:
+ break;
+ default:
+ break;
+ }
+ }
+ //update();
+ g_system->updateScreen();
+ g_system->delayMillis(10);
+ }
+
+
+ return Common::kNoError;
+}
+
+} \ No newline at end of file
diff --git a/engines/pink/pink.h b/engines/pink/pink.h
new file mode 100644
index 0000000000..7f9d39ea6b
--- /dev/null
+++ b/engines/pink/pink.h
@@ -0,0 +1,84 @@
+/* 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 PINK_PINK_H
+#define PINK_PINK_H
+
+#include "common/random.h"
+#include "engines/engine.h"
+#include "gui/EventRecorder.h"
+#include "gui/debugger.h"
+#include "file.h"
+
+
+/*
+ * This is the namespace of the Pink engine.
+ *
+ * Status of this engine: In Development
+ *
+ * Internal name of original name: OxCart Runtime
+ *
+ * Games using this engine:
+ * - The Pink Panther: Passport to Peril
+ * - The Pink Panther: Hokus Pokus Pink
+ */
+
+namespace Pink {
+
+class Console;
+
+enum {
+ kPinkDebugGeneral = 1 << 0,
+ kPinkDebugLoading = 1 << 1,
+ kPinkDebugSound = 1 << 2
+};
+
+class PinkEngine : public Engine {
+
+public:
+ PinkEngine(OSystem *system, const ADGameDescription *desc);
+
+ ~PinkEngine();
+
+ virtual Common::Error run();
+
+private:
+ Common::Error init();
+
+ void handleEvent(Common::Event &event);
+ void update();
+
+ Console *_console;
+ Common::RandomSource _rnd;
+
+ Common::String _nextModule;
+ Common::String _nextPage;
+
+ OrbFile _orb;
+ BroFile *_bro;
+
+ const ADGameDescription _desc;
+};
+
+} // End of namespace Pink
+
+#endif \ No newline at end of file