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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sun Nov 5 07:26:58 CET 2006


Revision: 24622
          http://svn.sourceforge.net/scummvm/?rev=24622&view=rev
Author:   kirben
Date:     2006-11-04 22:26:45 -0800 (Sat, 04 Nov 2006)

Log Message:
-----------
Add inital load/save code changes for earlier games and cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/saveload.cpp
    scummvm/trunk/engines/agos/script_e1.cpp
    scummvm/trunk/engines/agos/script_e2.cpp
    scummvm/trunk/engines/agos/script_ff.cpp
    scummvm/trunk/engines/agos/script_pp.cpp
    scummvm/trunk/engines/agos/script_ww.cpp
    scummvm/trunk/engines/agos/vga.cpp
    scummvm/trunk/engines/agos/window.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -84,6 +84,21 @@
 
 	_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 @@
 	_printCharPixelCount = 0;
 	_numLettersToPrint = 0;
 
-	_numTextBoxes = 0;
-
 	_clockStopped = 0;
 	_gameStoppedClock = 0;
 	_gameTime = 0;
@@ -597,7 +610,6 @@
 void AGOSEngine::setupGame() {
 	if (getGameType() == GType_PP) {
 		gss = PTR(puzzlepack_settings);
-		_numTextBoxes = 40;
 		_numVideoOpcodes = 85;
 #ifndef PALMOS_68K
 		_vgaMemSize = 7500000;
@@ -608,10 +620,11 @@
 		_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 @@
 		_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 @@
 		_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 @@
 		_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 @@
 		_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 @@
 		_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;

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/agos.h	2006-11-05 06:26:45 UTC (rev 24622)
@@ -197,7 +197,7 @@
 
 	uint32 *_gameOffsetsPtr;
 
-	uint _numVars;
+	uint _numItemStore, _numVars;
 	uint _vgaBaseDelay;
 
 	uint _musicIndexBase;
@@ -1138,6 +1138,7 @@
 	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 @@
 
 	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);

Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/saveload.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -145,7 +145,7 @@
 	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 @@
 		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 @@
 		} while (_lastHitArea3 == 0);
 
 		ha = _lastHitArea;
-
 		if (ha == NULL || ha->id < 205) {
 		} else if (ha->id == 205) {
 			return ha->id;
@@ -581,29 +580,126 @@
 	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 @@
 		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 @@
 	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;
+		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);
+		}
 
-			for (j = 1; j < 16; j++) {
-				if (subObject->objectFlags & (1 << j)) {
-					f->writeUint16BE(subObject->objectFlagValue[i++]);
-				}
+		SubUserFlag *u = (SubUserFlag *) findChildOfType(item, 9);
+		if (u) {
+			for (i = 0; i != 8; i++) {
+				f->writeUint16BE(u->userFlags[i]);
 			}
-		}
 
-		SubUserFlag *subUserFlag = (SubUserFlag *)findChildOfType(item, 9);
-		if (subUserFlag) {
-			for (i = 0; i != 4; i++) {
-				f->writeUint16BE(subUserFlag->userFlags[i]);
-			}
+			if (u->userItems[0] == 0)
+				f->writeUint32BE(0xFFFFFFFF);
+			else
+				f->writeUint32BE(u->userItems[0]);
 		}
 	}
 
@@ -660,31 +760,6 @@
 		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 @@
 	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 @@
 	f->readUint32BE();
 	_noParentNotify = true;
 
-
 	// add all timers
 	killAllTimers();
 	for (num = f->readUint32BE(); num; num--) {
@@ -766,27 +837,35 @@
 		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();
 		}
 
-		SubObject *subObject = (SubObject *)findChildOfType(item, 2);
-		if (subObject != NULL) {
-			subObject->objectFlags = f->readUint32BE();
-			i = subObject->objectFlags & 1;
+		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 *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 @@
 		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 @@
 			_bitArrayThree[i] = f->readUint16BE();
 	}
 
+	if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
+		_superRoomNumber = f->readUint16BE();
+	}
+
 	if (f->ioFailed()) {
 		error("load failed");
 	}
@@ -835,4 +918,129 @@
 	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

Modified: scummvm/trunk/engines/agos/script_e1.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_e1.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/script_e1.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -467,12 +467,18 @@
 
 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() {

Modified: scummvm/trunk/engines/agos/script_e2.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_e2.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/script_e2.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -48,7 +48,7 @@
 	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 @@
 		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();

Modified: scummvm/trunk/engines/agos/script_ff.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_ff.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/script_ff.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -216,7 +216,7 @@
 
 void AGOSEngine::off_loadUserGame() {
 	// 133: load game
-	loadGame(readVariable(55));
+	loadGame(genSaveName(readVariable(55)));
 }
 
 void AGOSEngine::off_listSaveGames() {

Modified: scummvm/trunk/engines/agos/script_pp.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_pp.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/script_pp.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -193,7 +193,7 @@
 	}
 
 	// XXX
-	loadGame(1);
+	loadGame(genSaveName(1));
 }
 
 void AGOSEngine::opp_saveOopsPosition() {

Modified: scummvm/trunk/engines/agos/script_ww.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_ww.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/script_ww.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -51,7 +51,7 @@
 	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;

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -210,21 +210,6 @@
 	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 @@
 	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;

Modified: scummvm/trunk/engines/agos/window.cpp
===================================================================
--- scummvm/trunk/engines/agos/window.cpp	2006-11-05 06:10:41 UTC (rev 24621)
+++ scummvm/trunk/engines/agos/window.cpp	2006-11-05 06:26:45 UTC (rev 24622)
@@ -127,8 +127,12 @@
 		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);
 	}


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