[Scummvm-cvs-logs] SF.net SVN: scummvm: [26966] scummvm/trunk/engines/agos

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Sun May 27 13:32:20 CEST 2007


Revision: 26966
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26966&view=rev
Author:   Kirben
Date:     2007-05-27 04:32:19 -0700 (Sun, 27 May 2007)

Log Message:
-----------
Fix loading restart state in Waxworks for now.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/detection_tables.h
    scummvm/trunk/engines/agos/intern.h
    scummvm/trunk/engines/agos/res.cpp
    scummvm/trunk/engines/agos/rooms.cpp
    scummvm/trunk/engines/agos/saveload.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2007-05-27 11:18:33 UTC (rev 26965)
+++ scummvm/trunk/engines/agos/agos.cpp	2007-05-27 11:32:19 UTC (rev 26966)
@@ -156,6 +156,9 @@
 	_stringIdLocalMin = 0;
 	_stringIdLocalMax = 0;
 
+	_stateList = 0;
+	_numRoomStates = 0;
+
 	_menuBase = 0;
 	_roomsList = 0;
 
@@ -395,6 +398,7 @@
 	_findNextPtr = 0;
 
 	_agosMenu = 0;
+	_currentRoom = 0;
 	_superRoomNumber = 0;
 	_wallOn = 0;
 

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2007-05-27 11:18:33 UTC (rev 26965)
+++ scummvm/trunk/engines/agos/agos.h	2007-05-27 11:32:19 UTC (rev 26966)
@@ -233,6 +233,9 @@
 	byte **_localStringtable;
 	uint _stringIdLocalMin, _stringIdLocalMax;
 
+	byte *_stateList;
+	uint _numRoomStates;
+
 	byte *_menuBase;
 	byte *_roomsList;
 
@@ -313,7 +316,7 @@
 
 	int _agosMenu;
 	byte _textMenu[10];
-	uint _superRoomNumber;
+	uint _currentRoom, _superRoomNumber;
 	uint _wallOn;
 
 	uint16 _hyperLink, _newLines;
@@ -723,6 +726,8 @@
 	void mouseOff();
 	void mouseOn();
 
+	bool loadRoomItems(uint item);
+
 	virtual bool loadTablesIntoMem(uint subr_id);
 	bool loadXTablesIntoMem(uint subr_id);
 	void loadTextIntoMem(uint stringId);
@@ -1414,8 +1419,6 @@
 
 	virtual bool loadTablesIntoMem(uint subr_id);
 
-	bool loadRoomItems(uint item);
-
 	virtual void moveDirn(Item *i, uint x);
 };
 

Modified: scummvm/trunk/engines/agos/detection_tables.h
===================================================================
--- scummvm/trunk/engines/agos/detection_tables.h	2007-05-27 11:18:33 UTC (rev 26965)
+++ scummvm/trunk/engines/agos/detection_tables.h	2007-05-27 11:32:19 UTC (rev 26966)
@@ -441,6 +441,7 @@
 	{ "icon.pkd",		GAME_ICONFILE,	"4822a91c18b1b2005ac17fc617f7dcbe", -1},
 	{ "menus.dat",		GAME_MENUFILE,	"3409eeb8ca8b46fc04da99de67573f5e", -1},
 	{ "start",		GAME_RESTFILE,	"b575b336e741dde1725edd4079d5ab67", -1},
+	{ "statelst",		GAME_STATFILE,	"469e98c69f00928a8366ba415d91902d", -1},
 	{ "stripped.txt",	GAME_STRFILE,	"6faaebff2786216900061eeb978f10af", -1},
 	{ "tbllist",		GAME_TBLFILE,	"95c44bfc380770a6b6dd0dfcc69e80a0", -1},
 	{ "xtbllist",		GAME_XTBLFILE,	"6c7b3db345d46349a5226f695c03e20f", -1},
@@ -490,6 +491,7 @@
 	{ "menus.dat",		GAME_MENUFILE,	"3409eeb8ca8b46fc04da99de67573f5e", -1},
 	{ "roomslst",		GAME_RMSLFILE,	"e3758c46ab8f3c23a1ac012bd607108d", -1},
 	{ "start",		GAME_RESTFILE,	"036b647973d6884cdfc2042a3d12df83", -1},
+	{ "statelst",		GAME_STATFILE,	"469e98c69f00928a8366ba415d91902d", -1},
 	{ "stripped.txt",	GAME_STRFILE,	"f259e3e07a1cde8d0404a767d815e12c", -1},
 	{ "tbllist",		GAME_TBLFILE,	"95c44bfc380770a6b6dd0dfcc69e80a0", -1},
 	{ "xtbllist",		GAME_XTBLFILE,	"6c7b3db345d46349a5226f695c03e20f", -1},
@@ -517,6 +519,7 @@
 	{ "menus.dat",		GAME_MENUFILE,	"3409eeb8ca8b46fc04da99de67573f5e", -1},
 	{ "roomslst",		GAME_RMSLFILE,	"e3758c46ab8f3c23a1ac012bd607108d", -1},
 	{ "start",		GAME_RESTFILE,	"036b647973d6884cdfc2042a3d12df83", -1},
+	{ "statelst",		GAME_STATFILE,	"469e98c69f00928a8366ba415d91902d", -1},
 	{ "stripped.txt",	GAME_STRFILE,	"f259e3e07a1cde8d0404a767d815e12c", -1},
 	{ "tbllist",		GAME_TBLFILE,	"95c44bfc380770a6b6dd0dfcc69e80a0", -1},
 	{ "xtbllist",		GAME_XTBLFILE,	"6c7b3db345d46349a5226f695c03e20f", -1},

Modified: scummvm/trunk/engines/agos/intern.h
===================================================================
--- scummvm/trunk/engines/agos/intern.h	2007-05-27 11:18:33 UTC (rev 26965)
+++ scummvm/trunk/engines/agos/intern.h	2007-05-27 11:32:19 UTC (rev 26966)
@@ -225,11 +225,12 @@
 	GAME_MENUFILE = 1 << 3,
 	GAME_STRFILE  = 1 << 4,
 	GAME_RMSLFILE = 1 << 5,
-	GAME_TBLFILE  = 1 << 6,
-	GAME_XTBLFILE = 1 << 7,
-	GAME_RESTFILE = 1 << 8,
+	GAME_STATFILE = 1 << 6,
+	GAME_TBLFILE  = 1 << 7,
+	GAME_XTBLFILE = 1 << 8,
+	GAME_RESTFILE = 1 << 9,
 
-	GAME_GFXIDXFILE = 1 << 9
+	GAME_GFXIDXFILE = 1 << 10
 };
 
 enum GameIds {

Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp	2007-05-27 11:18:33 UTC (rev 26965)
+++ scummvm/trunk/engines/agos/res.cpp	2007-05-27 11:32:19 UTC (rev 26966)
@@ -213,6 +213,26 @@
 		in.close();
 	}
 
+	if (getFileName(GAME_STATFILE) != NULL) {
+		/* Read list of ROOM STATE resources */
+		in.open(getFileName(GAME_STATFILE));
+		if (in.isOpen() == false) {
+			error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE));
+		}
+
+		_numRoomStates = in.size() / 8;
+
+		_stateList = (byte *)malloc(_numRoomStates * 6);
+		if (_stateList == NULL)
+			error("loadGamePcFile: Out of memory for room state list");
+
+		_numRoomStates *= 3;
+
+		// TODO Load room state resources
+
+		in.close();
+	}
+
 	if (getFileName(GAME_RMSLFILE) != NULL) {
 		/* Read list of ROOM ITEMS resources */
 		in.open(getFileName(GAME_RMSLFILE));

Modified: scummvm/trunk/engines/agos/rooms.cpp
===================================================================
--- scummvm/trunk/engines/agos/rooms.cpp	2007-05-27 11:18:33 UTC (rev 26965)
+++ scummvm/trunk/engines/agos/rooms.cpp	2007-05-27 11:32:19 UTC (rev 26966)
@@ -349,7 +349,7 @@
 }
 
 // Waxworks specific
-bool AGOSEngine_Waxworks::loadRoomItems(uint item) {
+bool AGOSEngine::loadRoomItems(uint item) {
 	byte *p;
 	uint i, min_num, max_num;
 	char filename[30];
@@ -359,6 +359,7 @@
 	if (p == NULL)
 		return 0;
 
+	_currentRoom = item;
 	item -= 2;
 
 	while (*p) {
@@ -375,7 +376,6 @@
 			max_num = READ_BE_UINT16(p); p += 2;
 
 			if (item >= min_num && item <= max_num) {
-
 				in.open(filename);
 				if (in.isOpen() == false) {
 					error("loadRoomItems: Can't load rooms file '%s'", filename);

Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp	2007-05-27 11:18:33 UTC (rev 26965)
+++ scummvm/trunk/engines/agos/saveload.cpp	2007-05-27 11:32:19 UTC (rev 26966)
@@ -980,6 +980,14 @@
 		addTimeEvent(timeout, subroutine_id);
 	}
 
+	if (getGameType() == GType_WW) {
+		// TODO Load room state data
+		for (uint s = 0; s <= _numRoomStates; s++) {
+			f->readUint16BE();
+		}
+		f->readUint16BE();
+	}
+
 	item_index = 1;
 	for (num = _itemArrayInited - 1; num; num--) {
 		Item *item = _itemArrayPtr[item_index++], *parent_item;
@@ -1120,6 +1128,14 @@
 		f->writeUint16BE(te->subroutine_id);
 	}
 
+	if (getGameType() == GType_WW) {
+		// TODO Save room state data
+		for (uint s = 0; s <= _numRoomStates; s++) {
+			f->writeUint16BE(0);
+		}
+		f->writeUint16BE(_currentRoom);
+	}
+
 	item_index = 1;
 	for (num_item = _itemArrayInited - 1; num_item; num_item--) {
 		Item *item = _itemArrayPtr[item_index++];


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