[Scummvm-git-logs] scummvm master -> 2fd2eeed1c21047744c9d79b1283c52c009b5406

bluegr bluegr at gmail.com
Fri Feb 10 03:34:50 CET 2017


This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a331cea358 CRYO: Remove the unused ResourceManager class
c7b86856fa CRYO: Move bugs.txt to wiki
0591689bc0 CRYO: Move gameflow.txt to wiki
8eae295172 CRYO: Move readme.txt to wiki
d895d23087 CRYO: Remove leftover example engine code
fdc3baeeff CRYO: Move unrelated Common::File include out of platdefs.h
4858b3fc58 CRYO: Add ID and versioning to cryo.dat
1db02c7bd8 CRYO: Rename create_led_dat to create_cryo_dat
01e072fbbc CRYO: Add handling for the cryo.dat aux data file
6ff7ef95d7 CRYO: Use cryo.dat for all game versions
2fd2eeed1c CRYO: Add explicit sizes to some static data arrays


Commit: a331cea358414d8363634d7644a95a82ac7d4ea1
    https://github.com/scummvm/scummvm/commit/a331cea358414d8363634d7644a95a82ac7d4ea1
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:33+02:00

Commit Message:
CRYO: Remove the unused ResourceManager class

Changed paths:
  R engines/cryo/ResourceManager.cpp
  R engines/cryo/ResourceManager.h


diff --git a/engines/cryo/ResourceManager.cpp b/engines/cryo/ResourceManager.cpp
deleted file mode 100644
index 79218c5..0000000
--- a/engines/cryo/ResourceManager.cpp
+++ /dev/null
@@ -1,122 +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 "ResourceManager.h"
-
-namespace Cryo {
-
-ResourceManager::ResourceManager() {
-}
-
-ResourceManager::ResourceManager(const Common::String &datFileName) {
-	LoadDatFile(datFileName);
-}
-
-ResourceManager::~ResourceManager() {
-}
-
-bool ResourceManager::LoadDatFile(const Common::String &datFileName) {
-	if (_datFile.isOpen()) {
-		_datFile.close();
-		_files.clear();
-	}
-
-	assert(_datFile.open(datFileName));
-
-	uint16 numFiles = _datFile.readUint16LE();
-
-	for (uint16 i = 0; i < numFiles; i++) {
-		DatFileEntry entry;
-
-		_datFile.read(entry._name, sizeof(entry._name));
-		entry._size = _datFile.readUint32LE();
-		entry._offset = _datFile.readUint32LE();
-		entry._flag = _datFile.readByte();
-
-		_files.push_back(entry);
-	}
-
-	return true;
-}
-
-Common::SeekableReadStream *ResourceManager::GetFile(const Common::String &resName, unsigned int hintIndex) {
-	// First, try raw disk file so we can support modding/patching
-
-	if (Common::File::exists(resName)) {
-		debug("Loading %s from disk", resName);
-
-		Common::File *resource = new Common::File();
-		resource->open(resName);
-		return resource;
-	}
-
-	// Look inside .dat file
-
-	if (_datFile.isOpen()) {
-		for (unsigned int i = hintIndex; i < _files.size(); i++) {
-			if (!resName.compareToIgnoreCase(_files[i]._name)) {
-				debug("Loading %s from dat file", resName);
-				Common::SeekableSubReadStream *resource = new Common::SeekableSubReadStream(&_datFile, _files[i]._offset, _files[i]._offset + _files[i]._size);
-				return resource;
-			}
-		}
-	}
-
-	debug("Unable to load %s - does't exists", resName);
-	return nullptr;
-}
-
-Common::SeekableReadStream *ResourceManager::GetFile(unsigned int resIndex) {
-	if (_files.size() > resIndex) {
-		return GetFile(Common::String(_files[resIndex]._name), resIndex);
-	}
-
-	return nullptr;
-}
-
-void *ResourceManager::StreamToBuffer(Common::SeekableReadStream *stream, unsigned int *size) {
-	if (!stream)
-		return nullptr;
-
-	unsigned int readSize = stream->size();
-	byte *data = new byte[readSize + 1];
-	readSize = stream->read(data, readSize);
-
-	if (size)
-		*size = readSize;
-	return data;
-}
-
-void *ResourceManager::GetData(const Common::String &resName, unsigned int *size) {
-	Common::SeekableReadStream *resource = GetFile(resName);
-	void *data = StreamToBuffer(resource, size);
-	delete resource;
-	return data;
-}
-
-void *ResourceManager::GetData(int resIndex, unsigned int *size) {
-	Common::SeekableReadStream *resource = GetFile(resIndex);
-	void *data = StreamToBuffer(resource, size);
-	delete resource;
-	return data;
-}
-}
diff --git a/engines/cryo/ResourceManager.h b/engines/cryo/ResourceManager.h
deleted file mode 100644
index 5a587fc..0000000
--- a/engines/cryo/ResourceManager.h
+++ /dev/null
@@ -1,92 +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.
- *
- */
-
-#pragma once
-
-#include "common/array.h"
-#include "common/file.h"
-#include "common/fs.h"
-#include "common/str.h"
-#include "common/substream.h"
-#include "common/debug.h"
-
-namespace Cryo {
-
-template<typename T>
-class CryoArray {
-private:
-	byte *_data;
-	bool _ownData;
-	uint16 ElementOffset(int num) {
-		assert(_data && num < Count())
-		return (static_cast<uint16 *>_data)[num];
-	}
-public:
-	CryoArray(void *data, bool ownData) : _data(data), _ownData(ownData) {
-	}
-	~CryoArray() {
-		if (_ownData)
-			delete data;
-	}
-	uint16 Count() {
-		return ElementOffset(0) / 2;
-	}
-	const T *operator[](int index) {
-		return static_cast<T *>(_data + ElementOffset(num));
-	}
-};
-
-class ResourceManager {
-private:
-	struct DatFileEntry {
-		char _name[16];
-		unsigned int _size;
-		unsigned int _offset;
-		byte _flag;
-	};
-
-	Common::Array<DatFileEntry> _files;
-	Common::File _datFile;
-
-	static void *StreamToBuffer(Common::SeekableReadStream *stream, unsigned int *size);
-
-public:
-	ResourceManager(const Common::String &datFileName);
-	ResourceManager();
-	~ResourceManager();
-
-	bool LoadDatFile(const Common::String &datFileName);
-
-	// Load resource as a seekable stream
-	Common::SeekableReadStream *GetFile(const Common::String &resName, unsigned int hintIndex = 0);
-	Common::SeekableReadStream *GetFile(unsigned int resIndex);
-
-	// Load resource as a buffer
-	void *GetData(const Common::String &resName, unsigned int *size = nullptr);
-	void *GetData(int resIndex, unsigned int *size = nullptr);
-	void *operator[](int resIndex) {
-		return GetData(resIndex);
-	}
-
-};
-
-}


Commit: c7b86856fac3da1a22e99df8d60913117fa848ab
    https://github.com/scummvm/scummvm/commit/c7b86856fac3da1a22e99df8d60913117fa848ab
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:33+02:00

Commit Message:
CRYO: Move bugs.txt to wiki

Changed paths:
  R engines/cryo/bugs.txt


diff --git a/engines/cryo/bugs.txt b/engines/cryo/bugs.txt
deleted file mode 100644
index a69538a..0000000
--- a/engines/cryo/bugs.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-
-1. Open menu and replay last dialog, then press stop. hover over buttons - hint text will be misplaced
-2. During valley location change some junk appears in the bottom half of screen for a brief time (broken transition effect?)
-3. Transitions often show a lot of red colors (bad palette fadein/out?)
-4. After game load in some areas (White Arch) top bar and inventory not redrawn due to (DrawFlags?) initialized incorrectly
-5. Mac reload feature uses hardcoded savefile from eden.dat
-6. First time in Tau's cave, try to take knife. When Dina objects, click on her - Tau's dialog will start (maybe it's original bug?)
-7. Mouse clipping may be lost during FMV scenes
-8. Screen doubling feature probably doesn't work (not really needed, can be replaced with built-in SCUMMVM scaler)
-9. Tons of debug messages spam when hover mouse over party icons or menu buttons
-A. King's bread drawn over inventory bar
-B. PC cursor clipped too agressively
-C. PC logos and credits videos won't play because encoded in old HNM format
-D. Eye blinking works incorrectly?
-E. Bogus hitbox in upper right corner of mirror screen (under mini-map)
-F. Wrong frescoes cursor on PC
-G. Junk on a valley entrance screen on PC
-H. On PC, no sound during first Mungo's dialogue, memory corruption after that
-J. PC intro video is lagging behind of background voice


Commit: 0591689bc0000c3a3098c8f73c495e01f7a8bb4c
    https://github.com/scummvm/scummvm/commit/0591689bc0000c3a3098c8f73c495e01f7a8bb4c
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:34+02:00

Commit Message:
CRYO: Move gameflow.txt to wiki

Changed paths:
  R engines/cryo/gameflow.txt


diff --git a/engines/cryo/gameflow.txt b/engines/cryo/gameflow.txt
deleted file mode 100644
index c932fc8..0000000
--- a/engines/cryo/gameflow.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-game phases
-
-   0  -  game start
-  10  -  enter throne room
-  20  -  heard talk of eloi and father
-  30  -  in prince's room
-  40  -  met dina
-  41  -  talking to tau                               room: 202
-  50  -  tau died
-  60  -  talked to jabber
-  70  -  got a gift from jabber
-  71  -  part with dina at secret crypt
-  80  -  learned about fresques / got flute
-  81  -  convinced monk to help
-  82  -  enter throne room
-  90  -  got king's permission
-  A0  -  met chong
-  A1  -  chong joins party
-  B0  -  on valley screen after citadel build complete
-  C0  -  met ulan
-  D0  -  build citadel in uluru
-  E0  -  got gift from ulan
-  ...


Commit: 8eae295172c7c52e383f0367fa5067d69b722991
    https://github.com/scummvm/scummvm/commit/8eae295172c7c52e383f0367fa5067d69b722991
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:34+02:00

Commit Message:
CRYO: Move readme.txt to wiki

Changed paths:
  R engines/cryo/readme.txt


diff --git a/engines/cryo/readme.txt b/engines/cryo/readme.txt
deleted file mode 100644
index c0f023b..0000000
--- a/engines/cryo/readme.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-Citadel of Mo, the last remaining place where humans can be safe from army
-of vicious Tyrannosaurus led by allmighty Morkus Rex. What awaits young Adam,
-prince of Mo, who just came of age and want to travel across the world?
-Will he be able to restore long lost friendship between dinosaurus and humans?
-
-
-This is SCUMMVM reimplementation of Cryo's Lost Eden game engine. In order to
-stay as close as possible to original game and minimize number of bugs
-introduced during code reconstruction, in its current state this project is
-a straight reverse-engineered game code hooked up to SCUMMVM framework.
-Because of that, this code in no way represent the quality or coding practices
-of SCUMMVM itself. Essentially, this is how the game was originally written.
-
-There are several Lost Eden game versions known to exists.
-
-- Non-interactive PC demo version. Basically, a number of video files played
-  in a loop with FM music in background. Google for "ANCIBUR2.HNM" file to
-  find it.
-
-- Interactive PC demo version. Allows to play through whole Citadel of Mo
-  then shows "Coming Soon" banner.
-  Can be found here: http://www.ag.ru/games/lost-eden/demos/2677
-  Download is a self-extracting archive, unpack it with 7zip or similar tool.
-
-- PC version. Main version of the game. Written in assembly and partially based
-  on Dune's game code.
-  Runs in real-mode DOS environment, uses VGA 320x200 graphics and digitized
-  sounds/music. Allows to select several languages for in-game subtitles. It is
-  rumored that bootleg Russian translation also exists. Has 3 predefined slots
-  for game save/load. Uses two different video codecs for HNM files.
-
-- MAC version. Almost identical to PC version. Has slightly modified UI. Such
-  as exta spaces on the inventory bar, resized subtitles overlay and different
-  implementation of mouse cursor (which is worse than the original one). Looks
-  like screen transition effects are also changed / rearranged. Also comes with
-  updated game script.
-  This version has no limit on save game slots. Standard system file selection
-  dialogs are used instead. All screen hot-spots coordinates loaded from the
-  main resource file instead of hard-coded values used in PC version.
-
-- 3DO version. Uses completely different resource formats.
-
-- CDI version. Uses completely different resource formats.
-
-- CD32 version. Mentioned in PC demo version, but never released?
-
-
-This reimplementation project is based on MAC version, since it's much easier
-to work with than any other versions.
-
-At this moment Mac version of the game is fully playabe/completeable. List of
-currently discovered bugs can be found in bugs.txt file. None of those are
-critical or game-breaking. Only single game save/load slot is supported and
-saves are not cross-platform compatible. Also, no game restart feature work
-due to the way it's implemented.
-
-PC versions (Demo and Full) are supported as well, but have a number of more
-severe glitches.
-
-Because of limited development environment, this code is only tested on
-MSVS2013 32-bit compiler. There may be some issues with GCC/LLVM compilers
-or on 64-bit platforms. As mentioned above, this code is neither pretty or
-bug-free (aka it's a can of worms). Several original bugs, various oddities
-and problematic areas are marked with TODO comment in the source code. There
-are number of variables with non-descripitve names like byte_1234, those
-purpose is yet to be clearly understood. To make code debugging easier,
-some commands have been added in the debugger. Some parts, like image
-drawing routines, can be simplified/generalized.
-
-Because parts of this code (mainly decompression and video playback) used
-by other Cryo's games, it might be worthy to make them reusable by future
-engines.


Commit: d895d230878e09a56d564a984fb66acf2c6bb7f8
    https://github.com/scummvm/scummvm/commit/d895d230878e09a56d564a984fb66acf2c6bb7f8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:34+02:00

Commit Message:
CRYO: Remove leftover example engine code

Changed paths:
    engines/cryo/cryo.cpp


diff --git a/engines/cryo/cryo.cpp b/engines/cryo/cryo.cpp
index e517c8b..3574105 100644
--- a/engines/cryo/cryo.cpp
+++ b/engines/cryo/cryo.cpp
@@ -41,22 +41,6 @@ namespace Cryo {
 CryoEngine *g_ed = nullptr;
 
 CryoEngine::CryoEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
-	// Put your engine in a sane state, but do nothing big yet;
-	// in particular, do not load data from files; rather, if you
-	// need to do such things, do them from run().
-
-	// Do not initialize graphics here
-	// Do not initialize audio devices here
-
-	// However this is the place to specify all default directories
-//	const Common::FSNode gameDataDir(ConfMan.get("path"));
-//	SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
-
-	// Here is the right place to set up the engine specific debug channels
-	DebugMan.addDebugChannel(kCryoDebugExample, "example", "this is just an example for a engine specific debug channel");
-	DebugMan.addDebugChannel(kCryoDebugExample2, "example2", "also an example");
-
-	// Don't forget to register your random source
 	_rnd = new Common::RandomSource("cryo");
 	_debugger = nullptr;
 
@@ -71,16 +55,12 @@ CryoEngine::CryoEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engin
 }
 
 CryoEngine::~CryoEngine() {
-	debug("CryoEngine::~CryoEngine");
-
-	// Dispose your resources here
 	delete _rnd;
 	delete _game;
 	delete _video;
 	delete _screenView;
 	delete _debugger;
 
-	// Remove all of our debug levels here
 	DebugMan.clearAllDebugChannels();
 }
 
@@ -97,18 +77,6 @@ Common::Error CryoEngine::run() {
 	initGraphics(320, 200, false);
 	_screen.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
 
-	// Additional setup.
-	debug("CryoEngine::init");
-
-	// Your main even loop should be (invoked from) here.
-	debug("CryoEngine::go: Hello, World!");
-
-	// This test will show up if -d1 and --debugflags=example are specified on the commandline
-	debugC(1, kCryoDebugExample, "Example debug call");
-
-	// This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
-	debugC(3, kCryoDebugExample | kCryoDebugExample2, "Example debug call two");
-
 	_game->run();
 
 	return Common::kNoError;


Commit: fdc3baeeff72e0d2313c9015ca1e3ab187456c9e
    https://github.com/scummvm/scummvm/commit/fdc3baeeff72e0d2313c9015ca1e3ab187456c9e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:35+02:00

Commit Message:
CRYO: Move unrelated Common::File include out of platdefs.h

Changed paths:
    engines/cryo/eden.h
    engines/cryo/platdefs.h


diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h
index a470a56..b6d8f25 100644
--- a/engines/cryo/eden.h
+++ b/engines/cryo/eden.h
@@ -23,6 +23,8 @@
 #ifndef CRYO_EDEN_H
 #define CRYO_EDEN_H
 
+#include "common/file.h"
+
 #include "cryo/sound.h"
 #include "cryo/defs.h"
 
diff --git a/engines/cryo/platdefs.h b/engines/cryo/platdefs.h
index 81329fb..69f8e62 100644
--- a/engines/cryo/platdefs.h
+++ b/engines/cryo/platdefs.h
@@ -23,9 +23,6 @@
 #ifndef CRYO_PLATDEFS_H
 #define CRYO_PLATDEFS_H
 
-#if 1
-#include "common/file.h"
-
 namespace Cryo {
 
 #if 1
@@ -41,8 +38,6 @@ const int _spaceWidth = 4;
 const int _subtitlesXWidth = (320 - _subtitlesXMargin * 2);
 const int _subtitlesXCenter = _subtitlesXWidth / 2;
 
-#endif
-
 } // End of namespace Cryo
 
 #endif


Commit: 4858b3fc5836dbf2f33fe0d1452bf0cb3a9f75b2
    https://github.com/scummvm/scummvm/commit/4858b3fc5836dbf2f33fe0d1452bf0cb3a9f75b2
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:35+02:00

Commit Message:
CRYO: Add ID and versioning to cryo.dat

Changed paths:
    devtools/create_cryo/create_led_dat.cpp


diff --git a/devtools/create_cryo/create_led_dat.cpp b/devtools/create_cryo/create_led_dat.cpp
index e58ee75..794dee3 100644
--- a/devtools/create_cryo/create_led_dat.cpp
+++ b/devtools/create_cryo/create_led_dat.cpp
@@ -26,6 +26,8 @@
 #include "eden_icons.h"
 #include "eden_rooms.h"
 
+#define CRYO_DAT_VER 1	// 1 byte
+
 template <typename T>
 static void writeLE(FILE *f, T value) {
 	for (int i = 0; i < sizeof(value); i++, value >>= 8) {
@@ -84,6 +86,9 @@ static int emitData(char *outputFilename) {
 
 	printf("Generating %s...\n", outputFilename);
 
+	fwrite("CRYODATA", 8, 1, f);
+	writeLE<byte>(f, CRYO_DAT_VER);
+	
 	emitIcons(f);
 	emitRooms(f);
 


Commit: 1db02c7bd8ffee2aa0a27264669d11f83d95b491
    https://github.com/scummvm/scummvm/commit/1db02c7bd8ffee2aa0a27264669d11f83d95b491
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:36+02:00

Commit Message:
CRYO: Rename create_led_dat to create_cryo_dat

Changed paths:
  A devtools/create_cryo/create_cryo_dat.cpp
  R devtools/create_cryo/create_led_dat.cpp
    devtools/create_cryo/module.mk


diff --git a/devtools/create_cryo/create_cryo_dat.cpp b/devtools/create_cryo/create_cryo_dat.cpp
new file mode 100644
index 0000000..794dee3
--- /dev/null
+++ b/devtools/create_cryo/create_cryo_dat.cpp
@@ -0,0 +1,110 @@
+/* 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 <stdio.h>
+
+#include "eden.h"
+#include "eden_icons.h"
+#include "eden_rooms.h"
+
+#define CRYO_DAT_VER 1	// 1 byte
+
+template <typename T>
+static void writeLE(FILE *f, T value) {
+	for (int i = 0; i < sizeof(value); i++, value >>= 8) {
+		unsigned char b = value & 0xFF;
+		fwrite(&b, 1, 1, f);
+	}
+}
+
+struct _icon_t : icon_t {
+	void write(FILE *f) {
+		writeLE<int16>(f, sx);
+		writeLE<int16>(f, sy);
+		writeLE<int16>(f, ex);
+		writeLE<int16>(f, ey);
+		writeLE<uint16>(f, cursor_id);
+		writeLE<unsigned int>(f, action_id);
+		writeLE<unsigned int>(f, object_id);
+	}
+};
+
+static void emitIcons(FILE *f) {
+	_icon_t *icons = (_icon_t*)gameIcons;
+	for (int i = 0; i < kNumIcons; i++)
+		icons[i].write(f);
+}
+
+struct _room_t : room_t {
+	void write(FILE *f) {
+		writeLE<byte>(f, ff_0);
+		writeLE<byte>(f, exits[0]);
+		writeLE<byte>(f, exits[1]);
+		writeLE<byte>(f, exits[2]);
+		writeLE<byte>(f, exits[3]);
+		writeLE<byte>(f, flags);
+		writeLE<uint16>(f, bank);
+		writeLE<uint16>(f, party);
+		writeLE<byte>(f, level);
+		writeLE<byte>(f, video);
+		writeLE<byte>(f, location);
+		writeLE<byte>(f, background);
+	}
+};
+
+static void emitRooms(FILE *f) {
+	_room_t *rooms = (_room_t*)gameRooms;
+	for (int i = 0; i < kNumRooms; i++)
+		rooms[i].write(f);
+}
+
+static int emitData(char *outputFilename) {
+	FILE *f = fopen(outputFilename, "w+b");
+	if (!f) {
+		printf("ERROR: Unable to create output file %s\n", outputFilename);
+		return 1;
+	}
+
+	printf("Generating %s...\n", outputFilename);
+
+	fwrite("CRYODATA", 8, 1, f);
+	writeLE<byte>(f, CRYO_DAT_VER);
+	
+	emitIcons(f);
+	emitRooms(f);
+
+	fclose(f);
+
+	printf("Done!\n");
+
+	return 0;
+}
+
+int main(int argc, char **argv) {
+
+	if (argc > 1)
+		return emitData(argv[1]);
+	else
+		printf("Usage: %s <output.dat>\n", argv[0]);
+
+	return 0;
+}
diff --git a/devtools/create_cryo/create_led_dat.cpp b/devtools/create_cryo/create_led_dat.cpp
deleted file mode 100644
index 794dee3..0000000
--- a/devtools/create_cryo/create_led_dat.cpp
+++ /dev/null
@@ -1,110 +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 <stdio.h>
-
-#include "eden.h"
-#include "eden_icons.h"
-#include "eden_rooms.h"
-
-#define CRYO_DAT_VER 1	// 1 byte
-
-template <typename T>
-static void writeLE(FILE *f, T value) {
-	for (int i = 0; i < sizeof(value); i++, value >>= 8) {
-		unsigned char b = value & 0xFF;
-		fwrite(&b, 1, 1, f);
-	}
-}
-
-struct _icon_t : icon_t {
-	void write(FILE *f) {
-		writeLE<int16>(f, sx);
-		writeLE<int16>(f, sy);
-		writeLE<int16>(f, ex);
-		writeLE<int16>(f, ey);
-		writeLE<uint16>(f, cursor_id);
-		writeLE<unsigned int>(f, action_id);
-		writeLE<unsigned int>(f, object_id);
-	}
-};
-
-static void emitIcons(FILE *f) {
-	_icon_t *icons = (_icon_t*)gameIcons;
-	for (int i = 0; i < kNumIcons; i++)
-		icons[i].write(f);
-}
-
-struct _room_t : room_t {
-	void write(FILE *f) {
-		writeLE<byte>(f, ff_0);
-		writeLE<byte>(f, exits[0]);
-		writeLE<byte>(f, exits[1]);
-		writeLE<byte>(f, exits[2]);
-		writeLE<byte>(f, exits[3]);
-		writeLE<byte>(f, flags);
-		writeLE<uint16>(f, bank);
-		writeLE<uint16>(f, party);
-		writeLE<byte>(f, level);
-		writeLE<byte>(f, video);
-		writeLE<byte>(f, location);
-		writeLE<byte>(f, background);
-	}
-};
-
-static void emitRooms(FILE *f) {
-	_room_t *rooms = (_room_t*)gameRooms;
-	for (int i = 0; i < kNumRooms; i++)
-		rooms[i].write(f);
-}
-
-static int emitData(char *outputFilename) {
-	FILE *f = fopen(outputFilename, "w+b");
-	if (!f) {
-		printf("ERROR: Unable to create output file %s\n", outputFilename);
-		return 1;
-	}
-
-	printf("Generating %s...\n", outputFilename);
-
-	fwrite("CRYODATA", 8, 1, f);
-	writeLE<byte>(f, CRYO_DAT_VER);
-	
-	emitIcons(f);
-	emitRooms(f);
-
-	fclose(f);
-
-	printf("Done!\n");
-
-	return 0;
-}
-
-int main(int argc, char **argv) {
-
-	if (argc > 1)
-		return emitData(argv[1]);
-	else
-		printf("Usage: %s <output.dat>\n", argv[0]);
-
-	return 0;
-}
diff --git a/devtools/create_cryo/module.mk b/devtools/create_cryo/module.mk
index f8e350a..f1e8ea3 100644
--- a/devtools/create_cryo/module.mk
+++ b/devtools/create_cryo/module.mk
@@ -2,10 +2,10 @@
 MODULE := devtools/create_cryo
 
 MODULE_OBJS := \
-	create_led_dat.o
+	create_cryo_dat.o
 
 # Set the name of the executable
-TOOL_EXECUTABLE := create_led_dat
+TOOL_EXECUTABLE := create_cryo_dat
 
 # Include common rules
 include $(srcdir)/rules.mk


Commit: 01e072fbbc1baaf8aaa48aba0842bf8977510b93
    https://github.com/scummvm/scummvm/commit/01e072fbbc1baaf8aaa48aba0842bf8977510b93
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:36+02:00

Commit Message:
CRYO: Add handling for the cryo.dat aux data file

Changed paths:
    engines/cryo/eden.cpp


diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index b8e191c..4ff18bf 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -48,6 +48,8 @@
 
 namespace Cryo {
 
+#define CRYO_DAT_VER 1	// 1 byte
+
 int16 _torchTick = 0;
 int16 _glowIndex = 0;
 int16 _torchCurIndex = 0;
@@ -4733,11 +4735,23 @@ void EdenGame::loadpermfiles() {
 		// Since PC version stores hotspots and rooms info in the executable, load them from premade resource file
 		Common::File f;
 
-		if (f.open("led.dat")) {
+		if (f.open("cryo.dat")) {
 			const int kNumIcons = 136;
 			const int kNumRooms = 424;
-			if (f.size() != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room))
-				error("Mismatching aux data");
+			const int dataSize = f.size() - 8 - 1;	// CRYODATA + version
+			char headerId[9];
+			
+			f.read(headerId, 8);
+			headerId[8] = '\0';
+			if (strcmp(headerId, "CRYODATA"))
+				error("Invalid aux data file");
+
+			if (f.readByte() != CRYO_DAT_VER)
+				error("Incorrect aux data version");
+
+			if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room))
+				error("Mismatching data in aux data file");
+
 			for (int i = 0; i < kNumIcons; i++) {
 				_gameIcons[i].sx = f.readSint16LE();
 				_gameIcons[i].sy = f.readSint16LE();


Commit: 6ff7ef95d73c29051a675d03bdccd42f0a5a215b
    https://github.com/scummvm/scummvm/commit/6ff7ef95d73c29051a675d03bdccd42f0a5a215b
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:36+02:00

Commit Message:
CRYO: Use cryo.dat for all game versions

All the static data will be eventually moved into this file

Changed paths:
    engines/cryo/eden.cpp


diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index 4ff18bf..214744f 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -4729,29 +4729,30 @@ void EdenGame::convertMacToPC() {
 }
 
 void EdenGame::loadpermfiles() {
-	switch (_vm->getPlatform()) {
-	case Common::kPlatformDOS:
-	{
-		// Since PC version stores hotspots and rooms info in the executable, load them from premade resource file
-		Common::File f;
+	Common::File f;
+	const int kNumIcons = 136;
+	const int kNumRooms = 424;
 
-		if (f.open("cryo.dat")) {
-			const int kNumIcons = 136;
-			const int kNumRooms = 424;
-			const int dataSize = f.size() - 8 - 1;	// CRYODATA + version
-			char headerId[9];
-			
-			f.read(headerId, 8);
-			headerId[8] = '\0';
-			if (strcmp(headerId, "CRYODATA"))
-				error("Invalid aux data file");
+	if (f.open("cryo.dat")) {
+		const int dataSize = f.size() - 8 - 1;	// CRYODATA + version
+		char headerId[9];
 
-			if (f.readByte() != CRYO_DAT_VER)
-				error("Incorrect aux data version");
+		f.read(headerId, 8);
+		headerId[8] = '\0';
+		if (strcmp(headerId, "CRYODATA"))
+			error("Invalid aux data file");
 
-			if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room))
-				error("Mismatching data in aux data file");
+		if (f.readByte() != CRYO_DAT_VER)
+			error("Incorrect aux data version");
 
+		if (dataSize != kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room))
+			error("Mismatching data in aux data file");
+	} else
+		error("Can not load aux data");
+
+	switch (_vm->getPlatform()) {
+	case Common::kPlatformDOS:
+		// Since PC version stores hotspots and rooms info in the executable, load them from premade resource file
 			for (int i = 0; i < kNumIcons; i++) {
 				_gameIcons[i].sx = f.readSint16LE();
 				_gameIcons[i].sy = f.readSint16LE();
@@ -4774,22 +4775,25 @@ void EdenGame::loadpermfiles() {
 				_gameRooms[i]._location = f.readByte();
 				_gameRooms[i]._backgroundBankNum = f.readByte();
 			}
-
-			f.close();
-		} else
-			error("Can not load aux data");
-	}
 		break;
 	case Common::kPlatformMacintosh:
 		loadIconFile(2498, _gameIcons);
 		loadRoomFile(2497, _gameRooms);
 		loadRawFile(2486, _gameLipsync);
 		convertMacToPC();
+
+		// Skip the icons and rooms of the DOS version
+		f.skip(kNumIcons * sizeof(Icon) + kNumRooms * sizeof(Room));
 		break;
 	default:
 		error("Unsupported platform");
 	}
 
+	// Read the common static data
+	// TODO
+
+	f.close();
+
 	loadRawFile(0, _mainBankBuf);
 	loadRawFile(402, _gameFont);
 	loadRawFile(404, _gameDialogs);


Commit: 2fd2eeed1c21047744c9d79b1283c52c009b5406
    https://github.com/scummvm/scummvm/commit/2fd2eeed1c21047744c9d79b1283c52c009b5406
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2017-02-10T04:33:37+02:00

Commit Message:
CRYO: Add explicit sizes to some static data arrays

Makes it easier to move them to a data file

Changed paths:
    engines/cryo/staticdata.cpp


diff --git a/engines/cryo/staticdata.cpp b/engines/cryo/staticdata.cpp
index 1184791..ad33ce3 100644
--- a/engines/cryo/staticdata.cpp
+++ b/engines/cryo/staticdata.cpp
@@ -25,7 +25,7 @@
 
 namespace Cryo {
 
-Follower followerList[] = {
+Follower followerList[15] = {
 //            char,                 X,  sx, sy,  ex,  ey,bank,
 	{ PersonId::pidGregor,          5, 211,  9, 320, 176, 228,   0,  0 },
 	{ PersonId::pidEloi,            4, 162, 47, 223, 176, 228, 112, 78 },
@@ -44,15 +44,7 @@ Follower followerList[] = {
 	{ -1,                          -1,  -1, -1,  -1,  -1,  -1,  -1, -1 }
 };
 
-
-/*
-  Labyrinth of Mo
-
-  | | | | | | | |
-
-*/
-
-byte kLabyrinthPath[] = {
+byte kLabyrinthPath[70] = {
 // each nibble tells which direction to choose to exit the labyrinth
 	0x11, 0x11, 0x11, 0x22, 0x33, 0x55, 0x25, 0x44, 0x25, 0x11, 0x11, 0x11,
 	0x11, 0x35, 0x55, 0x45, 0x45, 0x44, 0x44, 0x34, 0x44, 0x34, 0x32, 0x52,
@@ -64,7 +56,7 @@ byte kLabyrinthPath[] = {
 
 char kDinoSpeedForCitaLevel[16] = { 1, 2, 3, 4, 4, 5, 6, 7, 8, 9 };
 
-char kTabletView[] = {          //TODO: make as struct?
+char kTabletView[12] = {          //TODO: make as struct?
 	// opposite tablet id, video id
 	Objects::obUnused10, 83,
 	Objects::obUnused10, 84,
@@ -75,7 +67,7 @@ char kTabletView[] = {          //TODO: make as struct?
 };
 
 // special character backgrounds for specific rooms
-char kPersoRoomBankTable[] = {
+char kPersoRoomBankTable[84] = {
 	// first entry is default bank, then pairs of [roomNum, bankNum], terminated by -1
 	0,  3, 33, -1,
 	21, 17, 35, -1,
@@ -102,7 +94,7 @@ char kPersoRoomBankTable[] = {
 };
 
 // area transition descriptors
-Goto gotos[] = {
+Goto gotos[130] = {
 // area, oldarea, vid, time, valleyVid
 	{  0,  1,   0,  2,  20 },
 	{  0,  1, 162,  3, 168 },
@@ -236,7 +228,7 @@ Goto gotos[] = {
 	{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
 };
 
-object_t _objects[] = {
+object_t _objects[42] = {
 	//id,fl,loc,masklow,maskhi,ct
 	{  1, 0,  3,      1,     0, 0},     // Eve's Way Stone
 	{  2, 0,  3,      2,     0, 0},     // Thau's Seashell
@@ -371,7 +363,7 @@ perso_t kPersons[] = {
 	{ 0x628, 237, PersonMask::pmEve   , PersonId::pidEve               ,                                                0, 78, 10, 0, 0,  7,  35, 0, 0 }
 };
 
-Citadel _citadelList[] = {
+Citadel _citadelList[7] = {
 	{   1, { 163, 182, 0, 0, 124, 147, 193, 0 }, {   0,   0, 0, 0,   0,   0,   0, 0 } },
 	{  48, { 285, 286, 0, 0, 287, 288, 284, 0 }, { 114, 115, 0, 0, 116, 117, 113, 0 } },
 	{  63, { 290, 291, 0, 0, 292, 293, 289, 0 }, { 119, 120, 0, 0, 121, 122, 118, 0 } },
@@ -381,7 +373,7 @@ Citadel _citadelList[] = {
 	{ 255, { 310, 311, 0, 0, 312, 313, 309, 0 }, { 139, 140, 0, 0, 141, 142, 138, 0 } }
 };
 
-prect_t _characterRects[] = {   //TODO: just an array of int16s?
+prect_t _characterRects[19] = {   // TODO: just an array of int16s?
 	{  93,  69, 223, 176},
 	{ 102,  86, 162, 126},
 	{  88, 103, 168, 163},
@@ -403,7 +395,7 @@ prect_t _characterRects[] = {   //TODO: just an array of int16s?
 	{ 188,  83, 251, 158}
 };
 
-byte _characterArray[][5] = {   //TODO: struc?
+byte _characterArray[][5] = {   // TODO: struc?
 	{  8, 15, 23, 25, 0xFF},
 	{  0,  9, 0xFF        },
 	{  0,  9, 0xFF        },





More information about the Scummvm-git-logs mailing list