[Scummvm-cvs-logs] SF.net SVN: scummvm: [26293] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Mar 24 18:14:05 CET 2007


Revision: 26293
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26293&view=rev
Author:   peres001
Date:     2007-03-24 10:14:04 -0700 (Sat, 24 Mar 2007)

Log Message:
-----------
started infrastructure for amiga demo:
- added Disk skeleton
- adapted Archive to handle different structure for archives
- moved Disk creation from engine constructor into init() [still sub-optimal]

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/archive.cpp
    scummvm/trunk/engines/parallaction/disk.cpp
    scummvm/trunk/engines/parallaction/disk.h
    scummvm/trunk/engines/parallaction/parallaction.cpp

Modified: scummvm/trunk/engines/parallaction/archive.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/archive.cpp	2007-03-24 16:36:13 UTC (rev 26292)
+++ scummvm/trunk/engines/parallaction/archive.cpp	2007-03-24 17:14:04 UTC (rev 26293)
@@ -27,6 +27,24 @@
 
 namespace Parallaction {
 
+//	this PSEUDOID is used here to tell ONE archive from the others, namely the 'fr' archive in the
+//  amiga demo of Nippon Safes. It's the only archive using different internal offsets.
+//
+#define PSEUDOID_OFS				5
+
+#define ID_SMALL_ARCHIVE			5		// marks the aforementioned 'fr' archive
+
+#define ARCHIVE_FILENAMES_OFS		0x16
+
+#define NORMAL_ARCHIVE_FILES_NUM	384
+#define SMALL_ARCHIVE_FILES_NUM		180
+
+#define NORMAL_ARCHIVE_SIZES_OFS	0x3016
+#define SMALL_ARCHIVE_SIZES_OFS		0x1696
+
+#define NORMAL_ARCHIVE_DATA_OFS		0x4000
+#define SMALL_ARCHIVE_DATA_OFS		0x1966
+
 Archive::Archive() {
 	resetArchivedFile();
 }
@@ -37,30 +55,29 @@
 	if (_archive.isOpen())
 		close();
 
-	uint32	offset = DIRECTORY_OFFSET_IN_FILE;
 	char	path[PATH_LEN];
 
 	strcpy(path, file);
 	if (!_archive.open(path))
 		error("archive '%s' not found", path);
 
-	_archive.skip(22);
-	_archive.read(_archiveDir, MAX_ARCHIVE_ENTRIES*32);
+	_archive.seek(PSEUDOID_OFS);
+	uint32 pseudoid = _archive.readByte();
 
-	uint16 i;
-	for (i = 0; i < MAX_ARCHIVE_ENTRIES; i++) {
-		_archiveOffsets[i] = offset;
+	_numFiles = (pseudoid == ID_SMALL_ARCHIVE) ? SMALL_ARCHIVE_FILES_NUM : NORMAL_ARCHIVE_FILES_NUM;
 
-		uint32 len = _archive.readUint32BE();
-//		if (len>0) printf("%i) %s - [%i bytes]\n", i, _archiveDir[i], len);
+	_archive.seek(ARCHIVE_FILENAMES_OFS);
+	_archive.read(_archiveDir, _numFiles*32);
 
-		_archiveLenghts[i] = len;
-		offset += len;
+	_archive.seek((pseudoid == ID_SMALL_ARCHIVE) ? SMALL_ARCHIVE_SIZES_OFS : NORMAL_ARCHIVE_SIZES_OFS);
+
+	uint32 dataOffset = (pseudoid == ID_SMALL_ARCHIVE) ? SMALL_ARCHIVE_DATA_OFS : NORMAL_ARCHIVE_DATA_OFS;
+	for (uint16 i = 0; i < _numFiles; i++) {
+		_archiveOffsets[i] = dataOffset;
+		_archiveLenghts[i] = _archive.readUint32BE();
+		dataOffset += _archiveLenghts[i];
 	}
 
-//	printf("%i entries found\n", i);
-//	printf("%i bytes of data\n", offset);
-
 	return;
 }
 
@@ -80,10 +97,10 @@
 	resetArchivedFile();
 
 	uint16 i = 0;
-	for ( ; i < MAX_ARCHIVE_ENTRIES; i++) {
+	for ( ; i < _numFiles; i++) {
 		if (!scumm_stricmp(_archiveDir[i], filename)) break;
 	}
-	if (i == MAX_ARCHIVE_ENTRIES) return false;
+	if (i == _numFiles) return false;
 
 	debugC(1, kDebugDisk, "file '%s' found in slot %i", filename, i);
 

Modified: scummvm/trunk/engines/parallaction/disk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk.cpp	2007-03-24 16:36:13 UTC (rev 26292)
+++ scummvm/trunk/engines/parallaction/disk.cpp	2007-03-24 17:14:04 UTC (rev 26293)
@@ -28,13 +28,19 @@
 
 namespace Parallaction {
 
-Disk::Disk(Parallaction* vm) : _vm(vm) {
 
+Disk::Disk(Parallaction *vm) : _vm(vm) {
+
 }
 
 Disk::~Disk() {
+
 }
 
+void Disk::selectArchive(const char *name) {
+	_archive.open(name);
+}
+
 void Disk::setLanguage(uint16 language) {
 
 	switch (language) {
@@ -62,10 +68,24 @@
 	return;
 }
 
+
+
+#pragma mark -
+
+
+
+DosDisk::DosDisk(Parallaction* vm) : Disk(vm) {
+
+}
+
+DosDisk::~DosDisk() {
+}
+
+
 //
 // decompress a graphics block
 //
-uint16 Disk::decompressChunk(byte *src, byte *dst, uint16 size) {
+uint16 DosDisk::decompressChunk(byte *src, byte *dst, uint16 size) {
 
 	uint16 written = 0;
 	uint16 read = 0;
@@ -101,7 +121,7 @@
 //
 // loads a cnv from an external file
 //
-void Disk::loadExternalCnv(const char *filename, Cnv *cnv) {
+void DosDisk::loadExternalCnv(const char *filename, Cnv *cnv) {
 //	printf("Gfx::loadExternalCnv(%s)...", filename);
 
 	char path[PATH_LEN];
@@ -131,7 +151,7 @@
 	return;
 }
 
-void Disk::loadExternalStaticCnv(const char *filename, StaticCnv *cnv) {
+void DosDisk::loadExternalStaticCnv(const char *filename, StaticCnv *cnv) {
 
 	char path[PATH_LEN];
 
@@ -156,7 +176,7 @@
 	return;
 }
 
-void Disk::loadCnv(const char *filename, Cnv *cnv) {
+void DosDisk::loadCnv(const char *filename, Cnv *cnv) {
 //	printf("Gfx::loadCnv(%s)\n", filename);
 
 	char path[PATH_LEN];
@@ -197,7 +217,7 @@
 	return;
 }
 
-Cnv* Disk::loadTalk(const char *name) {
+Cnv* DosDisk::loadTalk(const char *name) {
 
 	Cnv *cnv = new Cnv;
 
@@ -233,7 +253,7 @@
 	return cnv;
 }
 
-Script* Disk::loadLocation(const char *name) {
+Script* DosDisk::loadLocation(const char *name) {
 
 	char archivefile[PATH_LEN];
 
@@ -267,7 +287,7 @@
 
 }
 
-Script* Disk::loadScript(const char* name) {
+Script* DosDisk::loadScript(const char* name) {
 
 	char vC8[PATH_LEN];
 
@@ -284,7 +304,7 @@
 	return new Script(buf, true);
 }
 
-StaticCnv* Disk::loadHead(const char* name) {
+StaticCnv* DosDisk::loadHead(const char* name) {
 
 	char path[PATH_LEN];
 /*
@@ -307,13 +327,13 @@
 }
 
 
-StaticCnv* Disk::loadPointer() {
+StaticCnv* DosDisk::loadPointer() {
 	StaticCnv* cnv = new StaticCnv;
 	loadExternalStaticCnv("pointer", cnv);
 	return cnv;
 }
 
-Cnv* Disk::loadFont(const char* name) {
+Cnv* DosDisk::loadFont(const char* name) {
 	char path[PATH_LEN];
 
 	sprintf(path, "%scnv", name);
@@ -325,7 +345,7 @@
 
 // loads character's icons set
 
-Cnv* Disk::loadObjects(const char *name) {
+Cnv* DosDisk::loadObjects(const char *name) {
 
 	if (IS_MINI_CHARACTER(name)) {
 		name += 4;
@@ -340,7 +360,7 @@
 }
 
 
-StaticCnv* Disk::loadStatic(const char* name) {
+StaticCnv* DosDisk::loadStatic(const char* name) {
 
 	char path[PATH_LEN];
 
@@ -371,7 +391,7 @@
 	return cnv;
 }
 
-Cnv* Disk::loadFrames(const char* name) {
+Cnv* DosDisk::loadFrames(const char* name) {
 	Cnv* cnv = new Cnv;
 	loadCnv(name, cnv);
 	return cnv;
@@ -387,7 +407,7 @@
 //
 
 
-void Disk::unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path) {
+void DosDisk::unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path) {
 
 	// update mask, path and screen
 	for (uint16 i = 0; i < SCREEN_WIDTH; i++) {
@@ -399,7 +419,7 @@
 	return;
 }
 
-void Disk::parseDepths(Common::SeekableReadStream &stream) {
+void DosDisk::parseDepths(Common::SeekableReadStream &stream) {
 	_vm->_gfx->_bgLayers[0] = stream.readByte();
 	_vm->_gfx->_bgLayers[1] = stream.readByte();
 	_vm->_gfx->_bgLayers[2] = stream.readByte();
@@ -407,7 +427,7 @@
 }
 
 
-void Disk::parseBackground(Common::SeekableReadStream &stream) {
+void DosDisk::parseBackground(Common::SeekableReadStream &stream) {
 
 	stream.read(_vm->_gfx->_palette, PALETTE_SIZE);
 
@@ -431,7 +451,7 @@
 
 }
 
-void Disk::loadBackground(const char *filename) {
+void DosDisk::loadBackground(const char *filename) {
 //	printf("Gfx::loadBackground(%s)\n", filename);
 
 	if (!_archive.openArchivedFile(filename))
@@ -473,7 +493,7 @@
 //	mask and path are normally combined (via OR) into the background picture itself
 //	read the comment on the top of this file for more
 //
-void Disk::loadMaskAndPath(const char *name) {
+void DosDisk::loadMaskAndPath(const char *name) {
 	char path[PATH_LEN];
 	sprintf(path, "%s.msk", name);
 
@@ -494,13 +514,13 @@
 	return;
 }
 
-void Disk::loadSlide(const char *filename) {
+void DosDisk::loadSlide(const char *filename) {
 	char path[PATH_LEN];
 	sprintf(path, "%s.slide", filename);
 	loadBackground(path);
 }
 
-void Disk::loadScenery(const char *name, const char *mask) {
+void DosDisk::loadScenery(const char *name, const char *mask) {
 	char path[PATH_LEN];
 	sprintf(path, "%s.dyn", name);
 	loadBackground(path);
@@ -512,8 +532,66 @@
 
 }
 
-void Disk::selectArchive(const char *name) {
-	_archive.open(name);
+
+
+#pragma mark -
+
+
+
+AmigaDisk::AmigaDisk(Parallaction *vm) : Disk(vm) {
+
 }
 
+
+AmigaDisk::~AmigaDisk() {
+
+}
+
+Script* AmigaDisk::loadLocation(const char *name) {
+	return NULL;
+}
+
+Script* AmigaDisk::loadScript(const char* name) {
+	return NULL;
+}
+
+Cnv* AmigaDisk::loadTalk(const char *name) {
+	return NULL;
+}
+
+Cnv* AmigaDisk::loadObjects(const char *name) {
+	return NULL;
+}
+
+StaticCnv* AmigaDisk::loadPointer() {
+	return NULL;
+}
+
+StaticCnv* AmigaDisk::loadHead(const char* name) {
+	return NULL;
+}
+
+Cnv* AmigaDisk::loadFont(const char* name) {
+	return NULL;
+}
+
+StaticCnv* AmigaDisk::loadStatic(const char* name) {
+	return NULL;
+}
+
+Cnv* AmigaDisk::loadFrames(const char* name) {
+	return NULL;
+}
+
+void AmigaDisk::loadSlide(const char *filename) {
+	return;
+}
+
+void AmigaDisk::loadScenery(const char* background, const char* mask) {
+	return;
+}
+
+
+
+
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2007-03-24 16:36:13 UTC (rev 26292)
+++ scummvm/trunk/engines/parallaction/disk.h	2007-03-24 17:14:04 UTC (rev 26293)
@@ -35,8 +35,6 @@
 
 #define MAX_ARCHIVE_ENTRIES 		384
 
-#define DIRECTORY_OFFSET_IN_FILE	0x4000
-
 class Parallaction;
 class Gfx;
 class Script;
@@ -56,6 +54,8 @@
 
 	Common::File 	_archive;
 
+	uint32			_numFiles;
+
 protected:
 	void resetArchivedFile();
 
@@ -78,6 +78,35 @@
 
 class Disk {
 
+protected:
+	Archive		  _archive;
+	char		  _languageDir[3];
+	Parallaction *_vm;
+
+public:
+	Disk(Parallaction *vm);
+	virtual ~Disk();
+
+	void selectArchive(const char *name);
+	void setLanguage(uint16 language);
+
+	virtual Script* loadLocation(const char *name) = 0;
+	virtual Script* loadScript(const char* name) = 0;
+	virtual Cnv* loadTalk(const char *name) = 0;
+	virtual Cnv* loadObjects(const char *name) = 0;
+	virtual StaticCnv* loadPointer() = 0;
+	virtual StaticCnv* loadHead(const char* name) = 0;
+	virtual Cnv* loadFont(const char* name) = 0;
+	virtual StaticCnv* loadStatic(const char* name) = 0;
+	virtual Cnv* loadFrames(const char* name) = 0;
+	virtual void loadSlide(const char *filename) = 0;
+	virtual void loadScenery(const char* background, const char* mask) = 0;
+
+
+};
+
+class DosDisk : public Disk {
+
 private:
 	uint16 decompressChunk(byte *src, byte *dst, uint16 size);
 	void unpackBackgroundScanline(byte *src, byte *screen, byte *mask, byte *path);
@@ -90,19 +119,31 @@
 	void parseBackground(Common::SeekableReadStream &stream);
 
 protected:
-	Archive		  _archive;
-	char		  _languageDir[3];
-
-	Parallaction *_vm;
 	Gfx	 *_gfx;
 
 public:
-	Disk(Parallaction *vm);
-	virtual ~Disk();
+	DosDisk(Parallaction *vm);
+	virtual ~DosDisk();
 
-	void selectArchive(const char *name);
-	void setLanguage(uint16 language);
+	Script* loadLocation(const char *name);
+	Script* loadScript(const char* name);
+	Cnv* loadTalk(const char *name);
+	Cnv* loadObjects(const char *name);
+	StaticCnv* loadPointer();
+	StaticCnv* loadHead(const char* name);
+	Cnv* loadFont(const char* name);
+	StaticCnv* loadStatic(const char* name);
+	Cnv* loadFrames(const char* name);
+	void loadSlide(const char *filename);
+	void loadScenery(const char* background, const char* mask);
+};
 
+class AmigaDisk : public Disk {
+
+public:
+	AmigaDisk(Parallaction *vm);
+	virtual ~AmigaDisk();
+
 	Script* loadLocation(const char *name);
 	Script* loadScript(const char* name);
 	Cnv* loadTalk(const char *name);

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-03-24 16:36:13 UTC (rev 26292)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-03-24 17:14:04 UTC (rev 26293)
@@ -148,25 +148,9 @@
 
 	// FIXME
 	_vm = this;
-	_disk = new Disk(this);
 
-	_skipMenu = false;
 
-	_transCurrentHoverItem = 0;
-	_actionAfterWalk = false;  // actived when the character needs to move before taking an action
-	_activeItem._index = 0;
-	_activeItem._id = 0;
-	_procCurrentHoverItem = -1;
 
-	_locationScript = NULL;
-
-	_musicData1 = 0;
-	strcpy(_characterName1, "null");
-
-	_midiPlayer = 0;
-
-	_baseTime = 0;
-
 	Common::File::addDefaultDirectory( _gameDataPath );
 
 	Common::addSpecialDebugLevel(kDebugDialogue, "dialogue", "Dialogues debug level");
@@ -194,6 +178,28 @@
 		return -1;
 	}
 
+	_skipMenu = false;
+
+	_transCurrentHoverItem = 0;
+	_actionAfterWalk = false;  // actived when the character needs to move before taking an action
+	_activeItem._index = 0;
+	_activeItem._id = 0;
+	_procCurrentHoverItem = -1;
+
+	_locationScript = NULL;
+
+	_musicData1 = 0;
+	strcpy(_characterName1, "null");
+
+	_midiPlayer = 0;
+
+	_baseTime = 0;
+
+	if (getPlatform() == Common::kPlatformPC)
+		_disk = new DosDisk(this);
+	else
+		_disk = new AmigaDisk(this);
+
 	_engineFlags = 0;
 
 	strcpy(_characterName, "dough");


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list