aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTravis Howell2006-11-05 06:26:45 +0000
committerTravis Howell2006-11-05 06:26:45 +0000
commita2abbf919df8a07df872d69f75d372579bbe271a (patch)
tree24602e294fe19c816983eef2b43a9034fdf7f549 /engines
parentea9baa0347f68a3eca4953e3daf828650d4e4190 (diff)
downloadscummvm-rg350-a2abbf919df8a07df872d69f75d372579bbe271a.tar.gz
scummvm-rg350-a2abbf919df8a07df872d69f75d372579bbe271a.tar.bz2
scummvm-rg350-a2abbf919df8a07df872d69f75d372579bbe271a.zip
Add inital load/save code changes for earlier games and cleanup
svn-id: r24622
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/agos.cpp35
-rw-r--r--engines/agos/agos.h8
-rw-r--r--engines/agos/saveload.cpp384
-rw-r--r--engines/agos/script_e1.cpp10
-rw-r--r--engines/agos/script_e2.cpp10
-rw-r--r--engines/agos/script_ff.cpp2
-rw-r--r--engines/agos/script_pp.cpp2
-rw-r--r--engines/agos/script_ww.cpp2
-rw-r--r--engines/agos/vga.cpp30
-rw-r--r--engines/agos/window.cpp6
10 files changed, 368 insertions, 121 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 7db49b9ca6..ed5f2a8a38 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -84,6 +84,21 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_gameFile = 0;
+ _itemMemSize = 0;
+ _tableMemSize = 0;
+ _vgaMemSize = 0;
+
+ _musicIndexBase = 0;
+ _soundIndexBase = 0;
+ _tableIndexBase = 0;
+ _textIndexBase = 0;
+
+ _numItemStore = 0;
+ _numTextBoxes = 0;
+ _numVars = 0;
+ _numVideoOpcodes = 0;
+ _vgaBaseDelay = 0;
+
_strippedTxtMem = 0;
_textMem = 0;
_textSize = 0;
@@ -232,8 +247,6 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_printCharPixelCount = 0;
_numLettersToPrint = 0;
- _numTextBoxes = 0;
-
_clockStopped = 0;
_gameStoppedClock = 0;
_gameTime = 0;
@@ -597,7 +610,6 @@ static const uint16 initialVideoWindows_Common[20] = {
void AGOSEngine::setupGame() {
if (getGameType() == GType_PP) {
gss = PTR(puzzlepack_settings);
- _numTextBoxes = 40;
_numVideoOpcodes = 85;
#ifndef PALMOS_68K
_vgaMemSize = 7500000;
@@ -608,10 +620,11 @@ void AGOSEngine::setupGame() {
_tableMemSize = 200000;
_frameRate = 1;
_vgaBaseDelay = 5;
+ _numItemStore = 10;
+ _numTextBoxes = 40;
_numVars = 2048;
} else if (getGameType() == GType_FF) {
gss = PTR(feeblefiles_settings);
- _numTextBoxes = 40;
_numVideoOpcodes = 85;
#ifndef PALMOS_68K
_vgaMemSize = 7500000;
@@ -622,12 +635,13 @@ void AGOSEngine::setupGame() {
_tableMemSize = 200000;
_frameRate = 1;
_vgaBaseDelay = 5;
+ _numItemStore = 10;
+ _numTextBoxes = 40;
_numVars = 255;
} else if (getGameType() == GType_SIMON2) {
gss = PTR(simon2_settings);
_tableIndexBase = 1580 / 4;
_textIndexBase = 1500 / 4;
- _numTextBoxes = 20;
_numVideoOpcodes = 75;
#ifndef PALMOS_68K
_vgaMemSize = 2000000;
@@ -644,12 +658,13 @@ void AGOSEngine::setupGame() {
_soundIndexBase = 1660 / 4;
_frameRate = 1;
_vgaBaseDelay = 1;
+ _numItemStore = 10;
+ _numTextBoxes = 20;
_numVars = 255;
} else if (getGameType() == GType_SIMON1) {
gss = PTR(simon1_settings);
_tableIndexBase = 1576 / 4;
_textIndexBase = 1460 / 4;
- _numTextBoxes = 20;
_numVideoOpcodes = 64;
#ifndef PALMOS_68K
_vgaMemSize = 1000000;
@@ -662,10 +677,11 @@ void AGOSEngine::setupGame() {
_soundIndexBase = 0;
_frameRate = 1;
_vgaBaseDelay = 1;
+ _numItemStore = 10;
+ _numTextBoxes = 20;
_numVars = 255;
} else if (getGameType() == GType_WW) {
gss = PTR(simon1_settings);
- _numTextBoxes = 20;
_numVideoOpcodes = 64;
#ifndef PALMOS_68K
_vgaMemSize = 1000000;
@@ -676,10 +692,11 @@ void AGOSEngine::setupGame() {
_tableMemSize = 50000;
_frameRate = 4;
_vgaBaseDelay = 1;
+ _numItemStore = 50;
+ _numTextBoxes = 10;
_numVars = 255;
} else if (getGameType() == GType_ELVIRA2) {
gss = PTR(simon1_settings);
- _numTextBoxes = 20;
_numVideoOpcodes = 60;
#ifndef PALMOS_68K
_vgaMemSize = 1000000;
@@ -690,10 +707,10 @@ void AGOSEngine::setupGame() {
_tableMemSize = 100000;
_frameRate = 4;
_vgaBaseDelay = 1;
+ _numItemStore = 50;
_numVars = 255;
} else if (getGameType() == GType_ELVIRA1) {
gss = PTR(simon1_settings);
- _numTextBoxes = 20;
_numVideoOpcodes = 57;
#ifndef PALMOS_68K
_vgaMemSize = 1000000;
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 84c8145e6d..3f7d450719 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -197,7 +197,7 @@ protected:
uint32 *_gameOffsetsPtr;
- uint _numVars;
+ uint _numItemStore, _numVars;
uint _vgaBaseDelay;
uint _musicIndexBase;
@@ -1138,6 +1138,7 @@ public:
void oe2_moveDirn();
void oe2_doClass();
void oe2_pObj();
+ void oe2_loadGame();
void oe2_drawItem();
void oe2_doTable();
void oe2_setDoorOpen();
@@ -1379,8 +1380,11 @@ protected:
Item *getNextItemPtrStrange();
+ bool loadGame_e1(const char *filename);
+ bool saveGame_e1(const char *filename);
+
+ bool loadGame(const char *filename);
bool saveGame(uint slot, const char *caption);
- bool loadGame(uint slot);
void openTextWindow();
void tidyIconArray(uint i);
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 854ca8dd69..8f7ec7a203 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -145,7 +145,7 @@ void AGOSEngine::quickLoadOrSave() {
char *filename = genSaveName(_saveLoadSlot);
if (_saveLoadType == 2) {
Subroutine *sub;
- success = loadGame(_saveLoadSlot);
+ success = loadGame(genSaveName(_saveLoadSlot));
if (!success) {
sprintf(buf, "Failed to load game state to file:\n\n%s", filename);
} else {
@@ -369,7 +369,7 @@ restart:;
if (!saveGame(_saveLoadRowCurPos + result, buf + result * 18))
fileError(_windowArray[5], true);
} else {
- if (!loadGame(_saveLoadRowCurPos + i))
+ if (!loadGame(genSaveName(_saveLoadRowCurPos + i)))
fileError(_windowArray[5], false);
}
@@ -410,7 +410,6 @@ int AGOSEngine::userGameGetKey(bool *b, char *buf) {
} while (_lastHitArea3 == 0);
ha = _lastHitArea;
-
if (ha == NULL || ha->id < 205) {
} else if (ha->id == 205) {
return ha->id;
@@ -581,29 +580,126 @@ loop:;
undefineBox(0x7FFF);
}
-bool AGOSEngine::saveGame(uint slot, const char *caption) {
+bool AGOSEngine::loadGame_e1(const char *filename) {
+ Common::SeekableReadStream *f = NULL;
+ uint num, item_index, i;
+
+ _lockWord |= 0x100;
+
+ // Load restart state
+ Common::File *file = new Common::File();
+ file->open(filename, Common::File::kFileReadMode);
+ if (!file->isOpen()) {
+ delete file;
+ f = _saveFileMan->openForLoading(filename);
+ } else {
+ f = file;
+ }
+
+ if (f == NULL) {
+ _lockWord &= ~0x100;
+ return false;
+ }
+
+ num = f->readUint32BE();
+
+ if (f->readUint32BE() != 0xFFFFFFFF || num != _itemArrayInited - 1) {
+ delete f;
+ _lockWord &= ~0x100;
+ return false;
+ }
+
+ f->readUint32BE();
+ f->readUint32BE();
+ _noParentNotify = true;
+
+ // add all timers
+ killAllTimers();
+ for (num = f->readUint32BE(); num; num--) {
+ uint32 timeout = f->readUint32BE();
+ uint16 func_to_call = f->readUint16BE();
+ addTimeEvent(timeout, func_to_call);
+ }
+
+ item_index = 1;
+ for (num = _itemArrayInited - 1; num; num--) {
+ Item *item = _itemArrayPtr[item_index++], *parent_item;
+
+ uint16 parent = f->readUint32BE();
+ if (parent == 0xFFFF)
+ parent_item = 0;
+ else
+ parent_item = derefItem(parent);
+
+ setItemParent(item, parent_item);
+
+ item->state = f->readUint16BE();
+ item->classFlags = f->readUint16BE();
+
+ SubObject *o = (SubObject *)findChildOfType(item, 2);
+ if (o) {
+ o->objectSize = f->readUint16BE();
+ o->objectWeight = f->readUint16BE();
+ }
+
+ SubPlayer *p = (SubPlayer *)findChildOfType(item, 3);
+ if (p) {
+ p->score = f->readUint32BE();
+ p->level = f->readUint16BE();
+ p->size = f->readUint16BE();
+ p->weight = f->readUint16BE();
+ p->strength = f->readUint16BE();
+ }
+
+ SubUserFlag *u = (SubUserFlag *) findChildOfType(item, 9);
+ if (u) {
+ for (i = 0; i != 8; i++) {
+ u->userFlags[i] = f->readUint16BE();
+ }
+
+ uint16 val = f->readUint32BE();
+ if (val == 0xFFFF)
+ u->userItems[0] = 0;
+ else
+ u->userItems[0] = val;
+ }
+ }
+
+ // read the variables
+ for (i = 0; i != _numVars; i++) {
+ writeVariable(i, f->readUint16BE());
+ }
+
+ debug(0, "Pos %d Size %d\n", f->pos(), f->size());
+ if (f->ioFailed()) {
+ error("load failed");
+ }
+
+ delete f;
+
+ _noParentNotify = false;
+
+ _lockWord &= ~0x100;
+
+ return true;
+}
+
+bool AGOSEngine::saveGame_e1(const char *filename) {
Common::WriteStream *f;
- uint item_index, num_item, i, j;
+ uint item_index, num_item, i;
TimeEvent *te;
uint32 curTime = 0;
uint32 gsc = _gameStoppedClock;
_lockWord |= 0x100;
- f = _saveFileMan->openForSaving(genSaveName(slot));
+ f = _saveFileMan->openForSaving(filename);
if (f == NULL) {
- warning("saveGame: Failed to save slot %d", slot);
+ warning("saveGame: Failed to save %s", filename);
_lockWord &= ~0x100;
return false;
}
- if (getGameType() == GType_FF) {
- f->write(caption, 100);
- curTime = time(NULL);
- } else if (getGameType() != GType_PP) {
- f->write(caption, 18);
- }
-
f->writeUint32BE(_itemArrayInited - 1);
f->writeUint32BE(0xFFFFFFFF);
f->writeUint32BE(0);
@@ -614,8 +710,6 @@ bool AGOSEngine::saveGame(uint slot, const char *caption) {
i++;
f->writeUint32BE(i);
- if (getGameType() == GType_FF && _clockStopped)
- gsc += ((uint32)time(NULL) - _clockStopped);
for (te = _firstTimeStruct; te; te = te->next) {
f->writeUint32BE(te->time - curTime + gsc);
f->writeUint16BE(te->subroutine_id);
@@ -625,33 +719,39 @@ bool AGOSEngine::saveGame(uint slot, const char *caption) {
for (num_item = _itemArrayInited - 1; num_item; num_item--) {
Item *item = _itemArrayPtr[item_index++];
- f->writeUint16BE(item->parent);
- f->writeUint16BE(item->next);
+ if (item->parent == 0)
+ f->writeUint32BE(0xFFFFFFFF);
+ else
+ f->writeUint32BE(item->parent);
+
f->writeUint16BE(item->state);
f->writeUint16BE(item->classFlags);
- SubRoom *subRoom = (SubRoom *)findChildOfType(item, 1);
- if (subRoom) {
- f->writeUint16BE(subRoom->roomExitStates);
+ SubObject *o = (SubObject *)findChildOfType(item, 2);
+ if (o) {
+ f->writeUint16BE(o->objectSize);
+ f->writeUint16BE(o->objectWeight);
}
- SubObject *subObject = (SubObject *)findChildOfType(item, 2);
- if (subObject) {
- f->writeUint32BE(subObject->objectFlags);
- i = subObject->objectFlags & 1;
-
- for (j = 1; j < 16; j++) {
- if (subObject->objectFlags & (1 << j)) {
- f->writeUint16BE(subObject->objectFlagValue[i++]);
- }
- }
+ SubPlayer *p = (SubPlayer *)findChildOfType(item, 3);
+ if (p) {
+ f->writeUint32BE(p->score);
+ f->writeUint16BE(p->level);
+ f->writeUint16BE(p->size);
+ f->writeUint16BE(p->weight);
+ f->writeUint16BE(p->strength);
}
- SubUserFlag *subUserFlag = (SubUserFlag *)findChildOfType(item, 9);
- if (subUserFlag) {
- for (i = 0; i != 4; i++) {
- f->writeUint16BE(subUserFlag->userFlags[i]);
+ SubUserFlag *u = (SubUserFlag *) findChildOfType(item, 9);
+ if (u) {
+ for (i = 0; i != 8; i++) {
+ f->writeUint16BE(u->userFlags[i]);
}
+
+ if (u->userItems[0] == 0)
+ f->writeUint32BE(0xFFFFFFFF);
+ else
+ f->writeUint32BE(u->userItems[0]);
}
}
@@ -660,31 +760,6 @@ bool AGOSEngine::saveGame(uint slot, const char *caption) {
f->writeUint16BE(readVariable(i));
}
- // write the items in array 6
- for (i = 0; i != 10; i++) {
- f->writeUint16BE(itemPtrToID(_itemStore[i]));
- }
-
- if (getGameType() == GType_PP) {
- // Write the bits in array 1
- for (i = 0; i != 128; i++)
- f->writeUint16BE(_bitArray[i]);
- } else {
- // Write the bits in array 1
- for (i = 0; i != 16; i++)
- f->writeUint16BE(_bitArray[i]);
-
- // Write the bits in array 2
- for (i = 0; i != 16; i++)
- f->writeUint16BE(_bitArrayTwo[i]);
- }
-
- // Write the bits in array 3
- if (getGameType() == GType_FF) {
- for (i = 0; i != 16; i++)
- f->writeUint16BE(_bitArrayThree[i]);
- }
-
f->flush();
bool result = !f->ioFailed();
@@ -694,35 +769,32 @@ bool AGOSEngine::saveGame(uint slot, const char *caption) {
return result;
}
-bool AGOSEngine::loadGame(uint slot) {
+bool AGOSEngine::loadGame(const char *filename) {
char ident[100];
Common::SeekableReadStream *f = NULL;
uint num, item_index, i, j;
_lockWord |= 0x100;
- if (getGameType() == GType_FF && slot == 999) {
- // Load restart state
- Common::File *file = new Common::File();
- file->open(genSaveName(slot), Common::File::kFileReadMode);
- if (!file->isOpen()) {
- delete file;
- } else {
- f = file;
- }
+ // Load restart state
+ Common::File *file = new Common::File();
+ file->open(filename, Common::File::kFileReadMode);
+ if (!file->isOpen()) {
+ delete file;
+ f = _saveFileMan->openForLoading(filename);
} else {
- f = _saveFileMan->openForLoading(genSaveName(slot));
+ f = file;
}
if (f == NULL) {
- warning("loadGame: Failed to load slot %d", slot);
+ warning("loadGame: Failed to load %s", filename);
_lockWord &= ~0x100;
return false;
}
if (getGameType() == GType_FF) {
f->read(ident, 100);
- } else if (getGameType() != GType_PP) {
+ } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
f->read(ident, 18);
}
@@ -738,7 +810,6 @@ bool AGOSEngine::loadGame(uint slot) {
f->readUint32BE();
_noParentNotify = true;
-
// add all timers
killAllTimers();
for (num = f->readUint32BE(); num; num--) {
@@ -766,27 +837,35 @@ bool AGOSEngine::loadGame(uint slot) {
item->state = f->readUint16BE();
item->classFlags = f->readUint16BE();
- SubRoom *subRoom = (SubRoom *)findChildOfType(item, 1);
- if (subRoom != NULL) {
- subRoom->roomExitStates = f->readUint16BE();
+ SubRoom *r = (SubRoom *)findChildOfType(item, 1);
+ if (r) {
+ r->roomExitStates = f->readUint16BE();
+ }
+
+ SubSuperRoom *sr = (SubSuperRoom *)findChildOfType(item, 4);
+ if (sr) {
+ uint16 n = sr->roomX * sr->roomY * sr->roomZ;
+ uint16 *c = sr->roomExitStates;
+ while(n--)
+ *c++ = f->readUint16BE();
}
- SubObject *subObject = (SubObject *)findChildOfType(item, 2);
- if (subObject != NULL) {
- subObject->objectFlags = f->readUint32BE();
- i = subObject->objectFlags & 1;
+ SubObject *o = (SubObject *)findChildOfType(item, 2);
+ if (o) {
+ o->objectFlags = f->readUint32BE();
+ i = o->objectFlags & 1;
for (j = 1; j < 16; j++) {
- if (subObject->objectFlags & (1 << j)) {
- subObject->objectFlagValue[i++] = f->readUint16BE();
+ if (o->objectFlags & (1 << j)) {
+ o->objectFlagValue[i++] = f->readUint16BE();
}
}
}
- SubUserFlag *subUserFlag = (SubUserFlag *) findChildOfType(item, 9);
- if (subUserFlag) {
+ SubUserFlag *u = (SubUserFlag *) findChildOfType(item, 9);
+ if (u) {
for (i = 0; i != 4; i++) {
- subUserFlag->userFlags[i] = f->readUint16BE();
+ u->userFlags[i] = f->readUint16BE();
}
}
}
@@ -797,8 +876,8 @@ bool AGOSEngine::loadGame(uint slot) {
writeVariable(i, f->readUint16BE());
}
- // read the items in array 6
- for (i = 0; i != 10; i++) {
+ // read the items in item store
+ for (i = 0; i != _numItemStore; i++) {
_itemStore[i] = derefItem(f->readUint16BE());
}
@@ -822,6 +901,10 @@ bool AGOSEngine::loadGame(uint slot) {
_bitArrayThree[i] = f->readUint16BE();
}
+ if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
+ _superRoomNumber = f->readUint16BE();
+ }
+
if (f->ioFailed()) {
error("load failed");
}
@@ -835,4 +918,129 @@ bool AGOSEngine::loadGame(uint slot) {
return true;
}
+bool AGOSEngine::saveGame(uint slot, const char *caption) {
+ Common::WriteStream *f;
+ uint item_index, num_item, i, j;
+ TimeEvent *te;
+ uint32 curTime = 0;
+ uint32 gsc = _gameStoppedClock;
+
+ _lockWord |= 0x100;
+
+ f = _saveFileMan->openForSaving(genSaveName(slot));
+ if (f == NULL) {
+ warning("saveGame: Failed to save slot %d", slot);
+ _lockWord &= ~0x100;
+ return false;
+ }
+
+ if (getGameType() == GType_FF) {
+ f->write(caption, 100);
+ curTime = time(NULL);
+ } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
+ f->write(caption, 18);
+ }
+
+ f->writeUint32BE(_itemArrayInited - 1);
+ f->writeUint32BE(0xFFFFFFFF);
+ f->writeUint32BE(0);
+ f->writeUint32BE(0);
+
+ i = 0;
+ for (te = _firstTimeStruct; te; te = te->next)
+ i++;
+ f->writeUint32BE(i);
+
+ if (getGameType() == GType_FF && _clockStopped)
+ gsc += ((uint32)time(NULL) - _clockStopped);
+ for (te = _firstTimeStruct; te; te = te->next) {
+ f->writeUint32BE(te->time - curTime + gsc);
+ f->writeUint16BE(te->subroutine_id);
+ }
+
+ item_index = 1;
+ for (num_item = _itemArrayInited - 1; num_item; num_item--) {
+ Item *item = _itemArrayPtr[item_index++];
+
+ f->writeUint16BE(item->parent);
+ f->writeUint16BE(item->next);
+ f->writeUint16BE(item->state);
+ f->writeUint16BE(item->classFlags);
+
+ SubRoom *r = (SubRoom *)findChildOfType(item, 1);
+ if (r) {
+ f->writeUint16BE(r->roomExitStates);
+ }
+
+ SubSuperRoom *sr = (SubSuperRoom *)findChildOfType(item, 4);
+ if (sr) {
+ uint16 n = sr->roomX * sr->roomY * sr->roomZ;
+ uint16 *c = sr->roomExitStates;
+ while(n--)
+ f->writeUint16BE(*c++);
+ }
+
+ SubObject *o = (SubObject *)findChildOfType(item, 2);
+ if (o) {
+ f->writeUint32BE(o->objectFlags);
+ i = o->objectFlags & 1;
+
+ for (j = 1; j < 16; j++) {
+ if (o->objectFlags & (1 << j)) {
+ f->writeUint16BE(o->objectFlagValue[i++]);
+ }
+ }
+ }
+
+ SubUserFlag *u = (SubUserFlag *)findChildOfType(item, 9);
+ if (u) {
+ for (i = 0; i != 4; i++) {
+ f->writeUint16BE(u->userFlags[i]);
+ }
+ }
+ }
+
+ // write the variables
+ for (i = 0; i != _numVars; i++) {
+ f->writeUint16BE(readVariable(i));
+ }
+
+ // write the items in item store
+ for (i = 0; i != _numItemStore; i++) {
+ f->writeUint16BE(itemPtrToID(_itemStore[i]));
+ }
+
+ if (getGameType() == GType_PP) {
+ // Write the bits in array 1
+ for (i = 0; i != 128; i++)
+ f->writeUint16BE(_bitArray[i]);
+ } else {
+ // Write the bits in array 1
+ for (i = 0; i != 16; i++)
+ f->writeUint16BE(_bitArray[i]);
+
+ // Write the bits in array 2
+ for (i = 0; i != 16; i++)
+ f->writeUint16BE(_bitArrayTwo[i]);
+ }
+
+ // Write the bits in array 3
+ if (getGameType() == GType_FF) {
+ for (i = 0; i != 16; i++)
+ f->writeUint16BE(_bitArrayThree[i]);
+ }
+
+ if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
+ f->writeUint16BE(_superRoomNumber);
+ }
+
+ f->flush();
+ bool result = !f->ioFailed();
+
+ delete f;
+ _lockWord &= ~0x100;
+
+ return result;
+}
+
} // End of namespace AGOS
diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp
index 9acac2339f..4e95bc6555 100644
--- a/engines/agos/script_e1.cpp
+++ b/engines/agos/script_e1.cpp
@@ -467,12 +467,18 @@ void AGOSEngine::oe1_doorExit() {
void AGOSEngine::oe1_saveGame() {
// 201: save game
- debug(0, "oe1_saveGame: stub (%s)", getStringPtrByID(getNextStringID()));
+ uint16 stringId = getNextStringID();
+
+ debug(0, "oe1_saveGame: stub (%s)", getStringPtrByID(stringId));
+ saveGame_e1((const char *)getStringPtrByID(stringId));
}
void AGOSEngine::oe1_loadGame() {
// 202: load game
- debug(0, "oe1_loadGame: stub (%s)", getStringPtrByID(getNextStringID()));
+ uint16 stringId = getNextStringID();
+
+ debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
+ loadGame_e1((const char *)getStringPtrByID(stringId));
}
void AGOSEngine::oe1_clearUserItem() {
diff --git a/engines/agos/script_e2.cpp b/engines/agos/script_e2.cpp
index ee73c0f771..64df361a56 100644
--- a/engines/agos/script_e2.cpp
+++ b/engines/agos/script_e2.cpp
@@ -48,7 +48,7 @@ void AGOSEngine::setupElvira2Opcodes(OpcodeProc *op) {
op[75] = &AGOSEngine::oe1_pcName;
op[79] = &AGOSEngine::oe1_isCalled;
op[83] = &AGOSEngine::oe1_rescan;
- op[89] = &AGOSEngine::oe1_loadGame;
+ op[89] = &AGOSEngine::oe2_loadGame;
op[94] = &AGOSEngine::oe1_findMaster;
op[95] = &AGOSEngine::oe1_nextMaster;
op[98] = &AGOSEngine::oe1_animate;
@@ -127,6 +127,14 @@ void AGOSEngine::oe2_pObj() {
showMessageFormat((const char *)getStringPtrByID(subObject->objectFlagValue[0]));
}
+void AGOSEngine::oe2_loadGame() {
+ // 89: load game
+ uint16 stringId = getNextStringID();
+
+ debug(0, "oe1_loadGame: stub (%s)", (const char *)getStringPtrByID(stringId));
+ loadGame((const char *)getStringPtrByID(stringId));
+}
+
void AGOSEngine::oe2_drawItem() {
// 113: draw item
Item *i = getNextItemPtr();
diff --git a/engines/agos/script_ff.cpp b/engines/agos/script_ff.cpp
index bcfc25852f..9af80c7c19 100644
--- a/engines/agos/script_ff.cpp
+++ b/engines/agos/script_ff.cpp
@@ -216,7 +216,7 @@ void AGOSEngine::off_saveUserGame() {
void AGOSEngine::off_loadUserGame() {
// 133: load game
- loadGame(readVariable(55));
+ loadGame(genSaveName(readVariable(55)));
}
void AGOSEngine::off_listSaveGames() {
diff --git a/engines/agos/script_pp.cpp b/engines/agos/script_pp.cpp
index 10dd82af08..ef865a58ad 100644
--- a/engines/agos/script_pp.cpp
+++ b/engines/agos/script_pp.cpp
@@ -193,7 +193,7 @@ void AGOSEngine::opp_loadUserGame() {
}
// XXX
- loadGame(1);
+ loadGame(genSaveName(1));
}
void AGOSEngine::opp_saveOopsPosition() {
diff --git a/engines/agos/script_ww.cpp b/engines/agos/script_ww.cpp
index 5907163ac5..deac387041 100644
--- a/engines/agos/script_ww.cpp
+++ b/engines/agos/script_ww.cpp
@@ -51,7 +51,7 @@ void AGOSEngine::setupWaxworksOpcodes(OpcodeProc *op) {
op[70] = &AGOSEngine::oww_printLongText;
op[83] = &AGOSEngine::oe1_rescan;
op[85] = &AGOSEngine::oww_whereTo;
- op[89] = &AGOSEngine::oe1_loadGame;
+ op[89] = &AGOSEngine::oe2_loadGame;
op[94] = &AGOSEngine::oe1_findMaster;
op[95] = &AGOSEngine::oe1_nextMaster;
op[98] = &AGOSEngine::oe1_animate;
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 2da9c96e78..d895eb341b 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -210,21 +210,6 @@ bool AGOSEngine::itemIsParentOf(uint16 a, uint16 b) {
return derefItem(item_a->parent) == item_b;
}
-bool AGOSEngine::isSpriteLoaded(uint16 id, uint16 zoneNum) {
- VgaSprite *vsp = _vgaSprites;
- while (vsp->id) {
- if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
- if (vsp->id == id && vsp->zoneNum == zoneNum)
- return true;
- } else {
- if (vsp->id == id)
- return true;
- }
- vsp++;
- }
- return false;
-}
-
bool AGOSEngine::vc_maybe_skip_proc_1(uint16 a, int16 b) {
Item *item;
@@ -251,6 +236,21 @@ VgaSprite *AGOSEngine::findCurSprite() {
return vsp;
}
+bool AGOSEngine::isSpriteLoaded(uint16 id, uint16 zoneNum) {
+ VgaSprite *vsp = _vgaSprites;
+ while (vsp->id) {
+ if (getGameType() == GType_SIMON2 || getGameType() == GType_FF || getGameType() == GType_PP) {
+ if (vsp->id == id && vsp->zoneNum == zoneNum)
+ return true;
+ } else {
+ if (vsp->id == id)
+ return true;
+ }
+ vsp++;
+ }
+ return false;
+}
+
bool AGOSEngine::getBitFlag(uint bit) {
uint16 *bits = &_bitArray[bit / 16];
return (*bits & (1 << (bit & 15))) != 0;
diff --git a/engines/agos/window.cpp b/engines/agos/window.cpp
index 61921b5a94..6008973083 100644
--- a/engines/agos/window.cpp
+++ b/engines/agos/window.cpp
@@ -127,8 +127,12 @@ void AGOSEngine::colorWindow(WindowBlock *window) {
h = window->height * 8;
w = window->width * 8;
+ uint8 color = window->fill_color;
+ if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW)
+ color += dst[0] & 0xF0;
+
do {
- memset(dst, window->fill_color, w);
+ memset(dst, color, w);
dst += _dxSurfacePitch;
} while (--h);
}