aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/agos.cpp4
-rw-r--r--engines/agos/agos.h9
-rw-r--r--engines/agos/detection_tables.h3
-rw-r--r--engines/agos/intern.h9
-rw-r--r--engines/agos/res.cpp20
-rw-r--r--engines/agos/rooms.cpp4
-rw-r--r--engines/agos/saveload.cpp16
7 files changed, 56 insertions, 9 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index da9bccadc3..c9050bee87 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -156,6 +156,9 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_stringIdLocalMin = 0;
_stringIdLocalMax = 0;
+ _stateList = 0;
+ _numRoomStates = 0;
+
_menuBase = 0;
_roomsList = 0;
@@ -395,6 +398,7 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_findNextPtr = 0;
_agosMenu = 0;
+ _currentRoom = 0;
_superRoomNumber = 0;
_wallOn = 0;
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 83e46f9723..2ffd5c92cd 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -233,6 +233,9 @@ protected:
byte **_localStringtable;
uint _stringIdLocalMin, _stringIdLocalMax;
+ byte *_stateList;
+ uint _numRoomStates;
+
byte *_menuBase;
byte *_roomsList;
@@ -313,7 +316,7 @@ protected:
int _agosMenu;
byte _textMenu[10];
- uint _superRoomNumber;
+ uint _currentRoom, _superRoomNumber;
uint _wallOn;
uint16 _hyperLink, _newLines;
@@ -723,6 +726,8 @@ protected:
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 @@ protected:
virtual bool loadTablesIntoMem(uint subr_id);
- bool loadRoomItems(uint item);
-
virtual void moveDirn(Item *i, uint x);
};
diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h
index b858cf3d5d..ca134e5e5e 100644
--- a/engines/agos/detection_tables.h
+++ b/engines/agos/detection_tables.h
@@ -441,6 +441,7 @@ static const AGOSGameDescription gameDescriptions[] = {
{ "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 @@ static const AGOSGameDescription gameDescriptions[] = {
{ "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 @@ static const AGOSGameDescription gameDescriptions[] = {
{ "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},
diff --git a/engines/agos/intern.h b/engines/agos/intern.h
index d8273e4c43..e730400392 100644
--- a/engines/agos/intern.h
+++ b/engines/agos/intern.h
@@ -225,11 +225,12 @@ enum GameFileTypes {
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 {
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index a7da0fb8d7..6cf3e3a14c 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -213,6 +213,26 @@ void AGOSEngine::loadGamePcFile() {
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));
diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp
index 3996b33839..1f94916dff 100644
--- a/engines/agos/rooms.cpp
+++ b/engines/agos/rooms.cpp
@@ -349,7 +349,7 @@ void AGOSEngine_Elvira2::setSRExit(Item *i, int n, int d, uint16 s) {
}
// 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 @@ bool AGOSEngine_Waxworks::loadRoomItems(uint item) {
if (p == NULL)
return 0;
+ _currentRoom = item;
item -= 2;
while (*p) {
@@ -375,7 +376,6 @@ bool AGOSEngine_Waxworks::loadRoomItems(uint item) {
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);
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index bb4bf6e294..8af398c859 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -980,6 +980,14 @@ bool AGOSEngine_Elvira2::loadGame(const char *filename, bool restartMode) {
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 @@ bool AGOSEngine_Elvira2::saveGame(uint slot, const char *caption) {
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++];