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

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Sat Dec 13 04:12:56 CET 2008


Revision: 35323
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35323&view=rev
Author:   Kirben
Date:     2008-12-13 03:12:56 +0000 (Sat, 13 Dec 2008)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/contain.cpp
    scummvm/trunk/engines/agos/cursor.cpp
    scummvm/trunk/engines/agos/debug.cpp
    scummvm/trunk/engines/agos/icons.cpp
    scummvm/trunk/engines/agos/items.cpp
    scummvm/trunk/engines/agos/res.cpp
    scummvm/trunk/engines/agos/saveload.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/agos.h	2008-12-13 03:12:56 UTC (rev 35323)
@@ -572,9 +572,9 @@
 	virtual ~AGOSEngine();
 
 protected:
-	uint16 to16Wrapper(uint value);
-	uint16 readUint16Wrapper(const void *src);
-	uint32 readUint32Wrapper(const void *src);
+	virtual uint16 to16Wrapper(uint value);
+	virtual uint16 readUint16Wrapper(const void *src);
+	virtual uint32 readUint32Wrapper(const void *src);
 
 	int allocGamePcVars(Common::SeekableReadStream *in);
 	void createPlayer();
@@ -722,14 +722,14 @@
 	Item *getExitOf_e1(Item *item, uint16 d);
 	virtual void moveDirn(Item *i, uint x);
 
-	int canPlace(Item *x, Item *y);
+	virtual int canPlace(Item *x, Item *y);
 	int contains(Item *a, Item *b);
 	int sizeContents(Item *x);
-	int sizeOfRec(Item *o, int d);
+	virtual int sizeOfRec(Item *o, int d);
 	int sizeRec(Item *x, int d);
 	int weighUp(Item *x);
 	int weightRec(Item *x, int d);
-	int weightOf(Item *x);
+	virtual int weightOf(Item *x);
 	void xPlace(Item *x, Item *y);
 
 	void drawMenuStrip(uint windowNum, uint menuNum);
@@ -789,17 +789,17 @@
 	void displayBoxStars();
 	void invertBox(HitArea * ha, byte a, byte b, byte c, byte d);
 
-	void initMouse();
+	virtual void initMouse();
 	virtual void handleMouseMoved();
 	virtual void drawMousePointer();
 
 	void drawArrow(uint16 x, uint16 y, int8 dir);
 	virtual void addArrows(WindowBlock *window, uint8 num);
-	void removeArrows(WindowBlock *window, uint num);
+	virtual void removeArrows(WindowBlock *window, uint num);
 
 	virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
-	bool hasIcon(Item *item);
-	uint itemGetIconNumber(Item *item);
+	virtual bool hasIcon(Item *item);
+	virtual uint itemGetIconNumber(Item *item);
 	virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
 
 	virtual void drawIconArray(uint i, Item *item_ptr, int line, int classMask);
@@ -1171,7 +1171,7 @@
 	void displayScreen();
 
 	void dumpVideoScript(const byte *src, bool one_opcode_only);
-	void dumpVgaFile(const byte *vga);
+	virtual void dumpVgaFile(const byte *vga);
 	void dumpVgaScript(const byte *ptr, uint res, uint sprite_id);
 	void dumpVgaScriptAlways(const byte *ptr, uint res, uint sprite_id);
 	void dumpVgaBitmaps(const byte *vga, byte *vga1, int res);
@@ -1224,7 +1224,7 @@
 
 	virtual void vcStopAnimation(uint16 zone, uint16 sprite);
 
-	bool confirmOverWrite(WindowBlock *window);
+	virtual bool confirmOverWrite(WindowBlock *window);
 	int16 matchSaveGame(const char *name, uint16 max);
 	void disableFileBoxes();
 	virtual void userGame(bool load);
@@ -1381,12 +1381,18 @@
 	virtual bool loadGame(const char *filename, bool restartMode = false);
 	virtual bool saveGame(uint slot, const char *caption);
 
+	virtual void addArrows(WindowBlock *window, uint8 num);
+	virtual void removeArrows(WindowBlock *window, uint num);
+
 	virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
-
-	virtual void addArrows(WindowBlock *window, uint8 num);
+	virtual bool hasIcon(Item *item);
+	virtual uint itemGetIconNumber(Item *item);
 	virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
 
 	virtual void moveDirn(Item *i, uint x);
+	virtual int canPlace(Item *x, Item *y);
+	virtual int sizeOfRec(Item *o, int d);
+	virtual int weightOf(Item *x);
 
 	int changeExitStates(SubSuperRoom *sr, int n, int d, uint16 s);
 	uint16 getExitState(Item *item, uint16 x, uint16 d);
@@ -1394,8 +1400,11 @@
 	void setSRExit(Item *i, int n, int d, uint16 s);
 
 	virtual void listSaveGames(char *dst);
+	virtual bool confirmOverWrite(WindowBlock *window);
 	virtual void userGame(bool load);
 	virtual int userGameGetKey(bool *b, char *buf, uint maxChar);
+
+	char *genSaveName(int slot);
 };
 
 class AGOSEngine_Waxworks : public AGOSEngine_Elvira2 {
@@ -1443,11 +1452,17 @@
 	virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
 
 	virtual void addArrows(WindowBlock *window, uint8 num);
+	virtual void removeArrows(WindowBlock *window, uint num);
+
 	virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
 
 	virtual bool loadTablesIntoMem(uint16 subr_id);
 
 	virtual void moveDirn(Item *i, uint x);
+
+	virtual bool confirmOverWrite(WindowBlock *window);
+
+	char *genSaveName(int slot);
 };
 
 class AGOSEngine_Simon1 : public AGOSEngine_Waxworks {
@@ -1492,13 +1507,18 @@
 	void drawMaskedImage(VC10_state *state);
 	void draw32ColorImage(VC10_state *state);
 
+	virtual void dumpVgaFile(const byte *vga);
+
 	virtual void clearName();
 
 	virtual void drawIcon(WindowBlock *window, uint icon, uint x, uint y);
 
+	virtual void initMouse();
 	virtual void handleMouseMoved();
 
 	virtual void addArrows(WindowBlock *window, uint8 num);
+	virtual void removeArrows(WindowBlock *window, uint num);
+
 	virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
 
 	virtual void playSpeech(uint16 speech_id, uint16 vga_sprite_id);
@@ -1510,6 +1530,8 @@
 	virtual void playMusic(uint16 music, uint16 track);
 
 	virtual void vcStopAnimation(uint16 zone, uint16 sprite);
+
+	char *genSaveName(int slot);
 };
 
 class AGOSEngine_Simon2 : public AGOSEngine_Simon1 {
@@ -1552,6 +1574,8 @@
 	virtual uint setupIconHitArea(WindowBlock *window, uint num, uint x, uint y, Item *item_ptr);
 
 	virtual void playSpeech(uint16 speech_id, uint16 vga_sprite_id);
+
+	char *genSaveName(int slot);
 };
 
 class AGOSEngine_Feeble : public AGOSEngine_Simon2 {
@@ -1608,10 +1632,15 @@
 
 	const OpcodeEntryFeeble *_opcodesFeeble;
 
+	virtual uint16 to16Wrapper(uint value);
+	virtual uint16 readUint16Wrapper(const void *src);
+	virtual uint32 readUint32Wrapper(const void *src);
+
 	virtual void drawImage(VC10_state *state);
 	void scaleClip(int16 h, int16 w, int16 y, int16 x, int16 scrollY);
 
 	void drawMousePart(int image, byte x, byte y);
+	virtual void initMouse();
 	virtual void drawMousePointer();
 
 	virtual void animateSprites();
@@ -1637,6 +1666,8 @@
 
 	virtual void colorWindow(WindowBlock *window);
 
+	virtual void dumpVgaFile(const byte *vga);
+
 	virtual void doOutput(const byte *src, uint len);
 
 	virtual void printScreenText(uint vga_sprite_id, uint color, const char *string_ptr, int16 x, int16 y, int16 width);
@@ -1668,6 +1699,8 @@
 	virtual void checkNoOverWrite();
 	virtual void checkAnims(uint a);
 	virtual void checkZonePtrs();
+
+	char *genSaveName(int slot);
 };
 
 class AGOSEngine_PuzzlePack : public AGOSEngine_Feeble {
@@ -1706,12 +1739,15 @@
 
 	const OpcodeEntryPuzzlePack *_opcodesPuzzlePack;
 
+	virtual void initMouse();
 	virtual void handleMouseMoved();
 	virtual void drawMousePointer();
 
 	virtual void resetVerbs();
 
 	void loadMouseImage();
+
+	char *genSaveName(int slot);
 };
 
 } // End of namespace AGOS

Modified: scummvm/trunk/engines/agos/contain.cpp
===================================================================
--- scummvm/trunk/engines/agos/contain.cpp	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/contain.cpp	2008-12-13 03:12:56 UTC (rev 35323)
@@ -30,55 +30,60 @@
 
 namespace AGOS {
 
-int AGOSEngine::canPlace(Item *x, Item *y) {
+int AGOSEngine_Elvira2::canPlace(Item *x, Item *y) {
 	Item *z = derefItem(x->parent);
 
-	if (getGameType() == GType_ELVIRA1) {
-		SubPlayer *p = (SubPlayer *)findChildOfType(y, kPlayerType);
-		SubContainer *c = (SubContainer *)findChildOfType(y, kContainerType);
-		int cap = 0;
-		int wt;
+	SubObject *o = (SubObject *)findChildOfType(y, kObjectType);
+	int ct;
+	int cap = 0;
 
-		if ((c == NULL) && (p == NULL))
-			return 0;		/* Fits Fine */
+	if (o == NULL)
+		return 0;	/* Fits Fine */
 
-		xPlace(x, NULL);		/* Avoid disturbing figures */
-		if (c)
-			cap = sizeContents(y);
+	xPlace(x,NULL);		/* Avoid disturbing figures */
+	if (o)
+		cap = sizeContents(y);
 
-		wt = weightOf(y);
-		xPlace(x, z);
-		if (c) {
-			cap = c->volume - cap;
-			cap -= sizeOfRec(x, 0);	/* - size of item going in */
-			if (cap < 0)
-				return -1;	/* Too big to fit */
-		}
-		if (p) {
-			if (wt + weightOf(x) > p->strength * 10)
-				return -2;	/* Too heavy */
-		}
-	} else {
-		SubObject *o = (SubObject *)findChildOfType(y, kObjectType);
-		int ct;
-		int cap = 0;
+	xPlace(x, z);
+	if ((o) && (o->objectFlags & kOFVolume)) {
+		ct = getOffsetOfChild2Param(o, kOFVolume);
+		cap = o->objectFlagValue[ct] - cap;
+		cap -= sizeOfRec(x, 0);	/* - size of item going in */
+		if (cap < 0)
+			return -1;	/* Too big to fit */
+	}
 
-		if (o == NULL)
-			return 0;	/* Fits Fine */
+	return 0;
+}
 
-		xPlace(x,NULL);		/* Avoid disturbing figures */
-		if (o)
-			cap = sizeContents(y);
+int AGOSEngine::canPlace(Item *x, Item *y) {
+	Item *z = derefItem(x->parent);
 
-		xPlace(x, z);
-		if ((o) && (o->objectFlags & kOFVolume)) {
-			ct = getOffsetOfChild2Param(o, kOFVolume);
-			cap = o->objectFlagValue[ct] - cap;
-			cap -= sizeOfRec(x, 0);	/* - size of item going in */
-			if (cap < 0)
-				return -1;	/* Too big to fit */
-		}
+	SubPlayer *p = (SubPlayer *)findChildOfType(y, kPlayerType);
+	SubContainer *c = (SubContainer *)findChildOfType(y, kContainerType);
+	int cap = 0;
+	int wt;
+
+	if ((c == NULL) && (p == NULL))
+		return 0;		/* Fits Fine */
+
+	xPlace(x, NULL);		/* Avoid disturbing figures */
+	if (c)
+		cap = sizeContents(y);
+
+	wt = weightOf(y);
+	xPlace(x, z);
+	if (c) {
+		cap = c->volume - cap;
+		cap -= sizeOfRec(x, 0);	/* - size of item going in */
+		if (cap < 0)
+			return -1;	/* Too big to fit */
 	}
+	if (p) {
+		if (wt + weightOf(x) > p->strength * 10)
+			return -2;	/* Too heavy */
+	}
+
 	return 0;
 }
 
@@ -119,38 +124,43 @@
 	return n;
 }
 
+int AGOSEngine_Elvira2::sizeOfRec(Item *i, int d) {
+	SubObject *o = (SubObject *)findChildOfType(i, kObjectType);
+
+	int ct;
+	if ((o) && (o->objectFlags & kOFSoft)) {
+		if (o->objectFlags & kOFSize) {
+			ct = getOffsetOfChild2Param(o, kOFSize);
+			return o->objectFlagValue[ct] + sizeRec(i, d + 1);
+		}
+		return sizeRec(i, d + 1);
+	}
+	if ((o) && (o->objectFlags & kOFSize)) {
+		ct = getOffsetOfChild2Param(o, kOFSize);
+		return o->objectFlagValue[ct];
+	}
+
+	return 0;
+}
+
 int AGOSEngine::sizeOfRec(Item *i, int d) {
 	SubObject *o = (SubObject *)findChildOfType(i, kObjectType);
 
-	if (getGameType() == GType_ELVIRA1) {
-		SubPlayer *p = (SubPlayer *)findChildOfType(i, kPlayerType);
-		SubContainer *c = (SubContainer *)findChildOfType(i, kContainerType);
+	SubPlayer *p = (SubPlayer *)findChildOfType(i, kPlayerType);
+	SubContainer *c = (SubContainer *)findChildOfType(i, kContainerType);
 
-		if ((c) && (c->flags & 1)) {
-			if (o)
-				return (o->objectSize + sizeRec(i, d + 1));
-			if (p)
-				return (p->size + sizeRec(i, d + 1));
-			return (sizeRec(i, d + 1));
-		}
+	if ((c) && (c->flags & 1)) {
 		if (o)
-			return (o->objectWeight);
+			return (o->objectSize + sizeRec(i, d + 1));
 		if (p)
-			return (p->weight);
-	} else {
-		int ct;
-		if ((o) && (o->objectFlags & kOFSoft)) {
-			if (o->objectFlags & kOFSize) {
-				ct = getOffsetOfChild2Param(o, kOFSize);
-				return o->objectFlagValue[ct] + sizeRec(i, d + 1);
-			}
-			return sizeRec(i, d + 1);
-		}
-		if ((o) && (o->objectFlags & kOFSize)) {
-			ct = getOffsetOfChild2Param(o, kOFSize);
-			return o->objectFlagValue[ct];
-		}
+			return (p->size + sizeRec(i, d + 1));
+		return (sizeRec(i, d + 1));
 	}
+	if (o)
+		return (o->objectWeight);
+	if (p)
+		return (p->weight);
+
 	return 0;
 }
 
@@ -173,22 +183,27 @@
 	return n;
 }
 
-int AGOSEngine::weightOf(Item *x) {
+int AGOSEngine_Elvira2::weightOf(Item *x) {
 	SubObject *o = (SubObject *)findChildOfType(x, kObjectType);
 
-	if (getGameType() == GType_ELVIRA1) {
-		SubPlayer *p = (SubPlayer *)findChildOfType(x, kPlayerType);
-		if (o)
-			return o->objectWeight;
-		if (p)
-			return p->weight;
-	} else {
-		if ((o) && (o->objectFlags & kOFWeight)) {
-			int ct = getOffsetOfChild2Param(o, kOFWeight);
-			return (o->objectFlagValue[ct]);
-		}
+	if ((o) && (o->objectFlags & kOFWeight)) {
+		int ct = getOffsetOfChild2Param(o, kOFWeight);
+		return (o->objectFlagValue[ct]);
 	}
+
 	return 0;
 }
 
+int AGOSEngine::weightOf(Item *x) {
+	SubObject *o = (SubObject *)findChildOfType(x, kObjectType);
+
+	SubPlayer *p = (SubPlayer *)findChildOfType(x, kPlayerType);
+	if (o)
+		return o->objectWeight;
+	if (p)
+		return p->weight;
+
+	return 0;
+}
+
 } // End of namespace AGOS

Modified: scummvm/trunk/engines/agos/cursor.cpp
===================================================================
--- scummvm/trunk/engines/agos/cursor.cpp	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/cursor.cpp	2008-12-13 03:12:56 UTC (rev 35323)
@@ -571,45 +571,49 @@
 	_lockWord &= ~1;
 }
 
-void AGOSEngine::initMouse() {
-	if (getGameType() == GType_PP) {
-		_maxCursorWidth = 75;
-		_maxCursorHeight = 97;
-		_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
-	} else if (getGameType() == GType_FF) {
-		_maxCursorWidth = 40;
-		_maxCursorHeight = 40;
-		_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
-	} else if (getGameType() == GType_SIMON1) {
-		_maxCursorWidth = 16;
-		_maxCursorHeight = 16;
-		_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
-		memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
+void AGOSEngine_PuzzlePack::initMouse() {
+	_maxCursorWidth = 75;
+	_maxCursorHeight = 97;
+	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+}
 
-		uint8 color = 225;
-		if (getPlatform() == Common::kPlatformAmiga)
-			color = (getFeatures() & GF_32COLOR) ? 17 : 241;
+void AGOSEngine_Feeble::initMouse() {
+	_maxCursorWidth = 40;
+	_maxCursorHeight = 40;
+	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+}
 
-		const uint16 *src = _common_mouseInfo;
-		for (int i = 0; i < 16; i++) {
-			for (int j = 0; j < 16; j++) {
-				if (src[0] & (1 << (15 - (j % 16)))) {
-					if (src[1] & (1 << (15 - (j % 16)))) {
-						_mouseData[16 * i + j] = color;
-					} else {
-						_mouseData[16 * i + j] = 0;
-					}
+void AGOSEngine_Simon1::initMouse() {
+	_maxCursorWidth = 16;
+	_maxCursorHeight = 16;
+	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+	memset(_mouseData, 0xFF, _maxCursorWidth * _maxCursorHeight);
+
+	uint8 color = 225;
+	if (getPlatform() == Common::kPlatformAmiga)
+		color = (getFeatures() & GF_32COLOR) ? 17 : 241;
+
+	const uint16 *src = _common_mouseInfo;
+	for (int i = 0; i < 16; i++) {
+		for (int j = 0; j < 16; j++) {
+			if (src[0] & (1 << (15 - (j % 16)))) {
+				if (src[1] & (1 << (15 - (j % 16)))) {
+					_mouseData[16 * i + j] = color;
+				} else {
+					_mouseData[16 * i + j] = 0;
 				}
 			}
-			src += 2;
 		}
-	} else {
-		_maxCursorWidth = 16;
-		_maxCursorHeight = 16;
-		_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+		src += 2;
 	}
 }
 
+void AGOSEngine::initMouse() {
+	_maxCursorWidth = 16;
+	_maxCursorHeight = 16;
+	_mouseData = (byte *)calloc(_maxCursorWidth * _maxCursorHeight, 1);
+}
+
 void AGOSEngine_PuzzlePack::loadMouseImage() {
 	loadZone(_variableArray[500]);
 	VgaPointersEntry *vpe = &_vgaBufferPointers[_variableArray[500]];

Modified: scummvm/trunk/engines/agos/debug.cpp
===================================================================
--- scummvm/trunk/engines/agos/debug.cpp	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/debug.cpp	2008-12-13 03:12:56 UTC (rev 35323)
@@ -295,82 +295,94 @@
 	printf("; end\n");
 }
 
-void AGOSEngine::dumpVgaFile(const byte *vga) {
+void AGOSEngine_Feeble::dumpVgaFile(const byte *vga) {
 	const byte *pp;
 	const byte *p;
 	int count;
 
 	pp = vga;
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		p = pp + READ_LE_UINT16(pp + 2);
-		count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationCount);
-		p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationTable);
+	p = pp + READ_LE_UINT16(pp + 2);
+	count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationCount);
+	p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->animationTable);
 
-		while (--count >= 0) {
-			int id = READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->id);
+	while (--count >= 0) {
+		int id = READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->id);
 
-			dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->scriptOffs), id / 100, id);
-			p += sizeof(AnimationHeader_Feeble);
-		}
-	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-		p = pp + READ_BE_UINT16(pp + 4);
-		count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
-		p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
+		dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const AnimationHeader_Feeble *) p)->scriptOffs), id / 100, id);
+		p += sizeof(AnimationHeader_Feeble);
+	}
 
-		while (--count >= 0) {
-			int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
+	pp = vga;
+	p = pp + READ_LE_UINT16(pp + 2);
+	count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageCount);
+	p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageTable);
 
-			dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
-			p += sizeof(AnimationHeader_Simon);
-		}
-	} else {
-		p = pp + READ_BE_UINT16(pp + 10) + 20;
-		count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
-		p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
+	while (--count >= 0) {
+		int id = READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->id);
 
-		while (--count >= 0) {
-			int id = READ_BE_UINT16(&((const AnimationHeader_WW *) p)->id);
+		dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->scriptOffs), id / 100, id);
+		p += sizeof(ImageHeader_Feeble);
+	}
+}
 
-			dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_WW *) p)->scriptOffs), id / 100, id);
-			p += sizeof(AnimationHeader_WW);
-		}
+void AGOSEngine_Simon1::dumpVgaFile(const byte *vga) {
+	const byte *pp;
+	const byte *p;
+	int count;
+
+	pp = vga;
+	p = pp + READ_BE_UINT16(pp + 4);
+	count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
+
+	while (--count >= 0) {
+		int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
+
+		dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
+		p += sizeof(AnimationHeader_Simon);
 	}
 
 	pp = vga;
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		p = pp + READ_LE_UINT16(pp + 2);
-		count = READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageCount);
-		p = pp + READ_LE_UINT16(&((const VgaFileHeader2_Feeble *) p)->imageTable);
+	p = pp + READ_BE_UINT16(pp + 4);
+	count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
 
-		while (--count >= 0) {
-			int id = READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->id);
+	while (--count >= 0) {
+		int id = READ_BE_UINT16(&((const ImageHeader_Simon *) p)->id);
 
-			dumpVgaScriptAlways(vga + READ_LE_UINT16(&((const ImageHeader_Feeble *) p)->scriptOffs), id / 100, id);
-			p += sizeof(ImageHeader_Feeble);
-		}
-	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-		p = pp + READ_BE_UINT16(pp + 4);
-		count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
-		p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
+		dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) p)->scriptOffs), id / 100, id);
+		p += sizeof(ImageHeader_Simon);
+	}
+}
 
-		while (--count >= 0) {
-			int id = READ_BE_UINT16(&((const ImageHeader_Simon *) p)->id);
+void AGOSEngine::dumpVgaFile(const byte *vga) {
+	const byte *pp;
+	const byte *p;
+	int count;
 
-			dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) p)->scriptOffs), id / 100, id);
-			p += sizeof(ImageHeader_Simon);
-		}
-	} else {
-		p = pp + READ_BE_UINT16(pp + 10) + 20;
-		count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
-		p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
+	pp = vga;
+	p = pp + READ_BE_UINT16(pp + 10) + 20;
+	count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationCount);
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->animationTable);
 
-		while (--count >= 0) {
-			int id = READ_BE_UINT16(&((const ImageHeader_WW *) p)->id);
+	while (--count >= 0) {
+		int id = READ_BE_UINT16(&((const AnimationHeader_WW *) p)->id);
 
-			dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_WW *) p)->scriptOffs), id / 100, id);
-			p += sizeof(ImageHeader_WW);
-		}
+		dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_WW *) p)->scriptOffs), id / 100, id);
+		p += sizeof(AnimationHeader_WW);
 	}
+
+	pp = vga;
+	p = pp + READ_BE_UINT16(pp + 10) + 20;
+	count = READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageCount);
+	p = pp + READ_BE_UINT16(&((const VgaFileHeader2_Common *) p)->imageTable);
+
+	while (--count >= 0) {
+		int id = READ_BE_UINT16(&((const ImageHeader_WW *) p)->id);
+
+		dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_WW *) p)->scriptOffs), id / 100, id);
+		p += sizeof(ImageHeader_WW);
+	}
 }
 
 static const byte bmp_hdr[] = {

Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/icons.cpp	2008-12-13 03:12:56 UTC (rev 35323)
@@ -921,26 +921,32 @@
 	_system->unlockScreen();
 }
 
-void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
+void AGOSEngine_Simon1::removeArrows(WindowBlock *window, uint num) {
 	if (getGameType() == GType_SIMON1) {
 		restoreBlock(200, 320, 146, 304);
-	} else if (getGameType() == GType_WW) {
-		setBitFlag(22, false);
-		setWindowImageEx(6, 103);
-	} else if (getGameType() == GType_ELVIRA2) {
-		setBitFlag(21, false);
-		setWindowImageEx(6, 106);
-	} else if (getGameType() == GType_ELVIRA1) {
-		if (num != 2) {
-			uint y = window->height * 4 + window->y - 19;
-			uint x = window->width + window->x;
-			restoreBlock(y + 38, x + 16, y, x);
-		} else {
-			colorBlock(window, 240, 151, 16, 38);
-		}
 	}
 }
 
+void AGOSEngine_Waxworks::removeArrows(WindowBlock *window, uint num) {
+	setBitFlag(22, false);
+	setWindowImageEx(6, 103);
+}
+
+void AGOSEngine_Elvira2::removeArrows(WindowBlock *window, uint num) {
+	setBitFlag(21, false);
+	setWindowImageEx(6, 106);
+}
+
+void AGOSEngine::removeArrows(WindowBlock *window, uint num) {
+	if (num != 2) {
+		uint y = window->height * 4 + window->y - 19;
+		uint x = window->width + window->x;
+		restoreBlock(y + 38, x + 16, y, x);
+	} else {
+		colorBlock(window, 240, 151, 16, 38);
+	}
+}
+
 void AGOSEngine::removeIconArray(uint num) {
 	WindowBlock *window;
 	uint16 curWindow;

Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/items.cpp	2008-12-13 03:12:56 UTC (rev 35323)
@@ -53,30 +53,30 @@
 	_itemHeap.clear();
 }
 
+bool AGOSEngine_Elvira2::hasIcon(Item *item) {
+	SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
+	return (child && (child->objectFlags & kOFIcon) != 0);
+}
+
 bool AGOSEngine::hasIcon(Item *item) {
-	if (getGameType() == GType_ELVIRA1) {
-		return (getUserFlag(item, 7) != 0);
-	} else {
-		SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
-		return (child && (child->objectFlags & kOFIcon) != 0);
-	}
+	return (getUserFlag(item, 7) != 0);
 }
 
-uint AGOSEngine::itemGetIconNumber(Item *item) {
-	if (getGameType() == GType_ELVIRA1) {
-		return getUserFlag(item, 7);
-	} else {
-		SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
-		uint offs;
+uint AGOSEngine_Elvira2::itemGetIconNumber(Item *item) {
+	SubObject *child = (SubObject *)findChildOfType(item, kObjectType);
+	uint offs;
 
-		if (child == NULL || !(child->objectFlags & kOFIcon))
-			return 0;
+	if (child == NULL || !(child->objectFlags & kOFIcon))
+		return 0;
 
-		offs = getOffsetOfChild2Param(child, 0x10);
-		return child->objectFlagValue[offs];
-	}
+	offs = getOffsetOfChild2Param(child, 0x10);
+	return child->objectFlagValue[offs];
 }
 
+uint AGOSEngine::itemGetIconNumber(Item *item) {
+	return getUserFlag(item, 7);
+}
+
 void AGOSEngine::setItemState(Item *item, int value) {
 	item->state = value;
 }

Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/res.cpp	2008-12-13 03:12:56 UTC (rev 35323)
@@ -38,25 +38,28 @@
 
 namespace AGOS {
 
+uint16 AGOSEngine_Feeble::to16Wrapper(uint value) {
+	return TO_LE_16(value);
+}
+
 uint16 AGOSEngine::to16Wrapper(uint value) {
-	if (getGameType() == GType_FF || getGameType() == GType_PP)
-		return TO_LE_16(value);
-	else
-		return TO_BE_16(value);
+	return TO_BE_16(value);
 }
 
+uint16 AGOSEngine_Feeble::readUint16Wrapper(const void *src) {
+	return READ_LE_UINT16(src);
+}
+
 uint16 AGOSEngine::readUint16Wrapper(const void *src) {
-	if (getGameType() == GType_FF || getGameType() == GType_PP)
-		return READ_LE_UINT16(src);
-	else
-		return READ_BE_UINT16(src);
+	return READ_BE_UINT16(src);
 }
 
+uint32 AGOSEngine_Feeble::readUint32Wrapper(const void *src) {
+	return READ_LE_UINT32(src);
+}
+
 uint32 AGOSEngine::readUint32Wrapper(const void *src) {
-	if (getGameType() == GType_FF || getGameType() == GType_PP)
-		return READ_LE_UINT32(src);
-	else
-		return READ_BE_UINT32(src);
+	return READ_BE_UINT32(src);
 }
 
 void AGOSEngine::decompressData(const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize) {

Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp	2008-12-13 02:51:36 UTC (rev 35322)
+++ scummvm/trunk/engines/agos/saveload.cpp	2008-12-13 03:12:56 UTC (rev 35323)
@@ -74,35 +74,63 @@
 	return i;
 }
 
-char *AGOSEngine::genSaveName(int slot) {
+char *AGOSEngine_PuzzlePack::genSaveName(int slot) {
 	static char buf[20];
 
-	if (getGameId() == GID_DIMP) {
+	if (getGameId() == GID_DIMP)
 		sprintf(buf, "dimp.sav");
-	} else if (getGameType() == GType_PP) {
+	else
 		sprintf(buf, "swampy.sav");
-	} else if (getGameType() == GType_FF) {
-		sprintf(buf, "feeble.%.3d", slot);
-	} else if (getGameType() == GType_SIMON2) {
-		sprintf(buf, "simon2.%.3d", slot);
-	} else if (getGameType() == GType_SIMON1) {
-		sprintf(buf, "simon1.%.3d", slot);
-	} else if (getGameType() == GType_WW) {
-		if (getPlatform() == Common::kPlatformPC)
-			sprintf(buf, "waxworks-pc.%.3d", slot);
-		else
-			sprintf(buf, "waxworks.%.3d", slot);
-	} else if (getGameType() == GType_ELVIRA2) {
-		if (getPlatform() == Common::kPlatformPC)
-			sprintf(buf, "elvira2-pc.%.3d", slot);
-		else
-			sprintf(buf, "elvira2.%.3d", slot);
-	} else if (getGameType() == GType_ELVIRA1) {
-		sprintf(buf, "elvira1.%.3d", slot);
-	}
+
 	return buf;
 }
 
+char *AGOSEngine_Feeble::genSaveName(int slot) {
+	static char buf[20];
+	sprintf(buf, "feeble.%.3d", slot);
+	return buf;
+}
+
+char *AGOSEngine_Simon2::genSaveName(int slot) {
+	static char buf[20];
+	sprintf(buf, "simon2.%.3d", slot);
+	return buf;
+}
+
+char *AGOSEngine_Simon1::genSaveName(int slot) {
+	static char buf[20];
+	sprintf(buf, "simon1.%.3d", slot);
+	return buf;
+}
+
+char *AGOSEngine_Waxworks::genSaveName(int slot) {
+	static char buf[20];
+
+	if (getPlatform() == Common::kPlatformPC)
+		sprintf(buf, "waxworks-pc.%.3d", slot);
+	else
+		sprintf(buf, "waxworks.%.3d", slot);
+
+	return buf;
+}
+
+char *AGOSEngine_Elvira2::genSaveName(int slot) {
+	static char buf[20];
+
+	if (getPlatform() == Common::kPlatformPC)
+		sprintf(buf, "elvira2-pc.%.3d", slot);
+	else
+		sprintf(buf, "elvira2.%.3d", slot);
+
+	return buf;
+}
+
+char *AGOSEngine::genSaveName(int slot) {
+	static char buf[20];
+	sprintf(buf, "elvira1.%.3d", slot);
+	return buf;
+}
+
 void AGOSEngine::quickLoadOrSave() {
 	// Quick load & save is only supported complete version of Simon the Sorcerer 1/2
 	if (getGameType() == GType_PP || getGameType() == GType_FF ||
@@ -170,55 +198,59 @@
 	_saveLoadType = 0;
 }
 
-bool AGOSEngine::confirmOverWrite(WindowBlock *window) {
-	if (getGameType() == GType_WW) {
-		Subroutine *sub = getSubroutineByID(80);
-		if (sub != NULL)
-			startSubroutineEx(sub);
+bool AGOSEngine_Waxworks::confirmOverWrite(WindowBlock *window) {
+	Subroutine *sub = getSubroutineByID(80);
+	if (sub != NULL)
+		startSubroutineEx(sub);
 
-		if (_variableArray[253] == 0)
-			return true;
-	} else if (getGameType() == GType_ELVIRA2) {
-		// Original verison never confirmed
+	if (_variableArray[253] == 0)
 		return true;
-	} else if (getGameType() == GType_ELVIRA1) {
-		const char *message1, *message2, *message3;
 
-		switch (_language) {
-		case Common::FR_FRA:
-			message1 = "\rFichier d/j; existant.\r\r";
-			message2 = "  Ecrire pardessus ?\r\r";
-			message3 = "     Oui      Non";
-			break;
-		case Common::DE_DEU:
-			message1 = "\rDatei existiert bereits.\r\r";
-			message2 = "     berschreiben ?\r\r";
-			message3 = "     Ja        Nein";
-			break;
-		default:
-			message1 = "\r File already exists.\r\r";
-			message2 = "    Overwrite it ?\r\r";
-			message3 = "     Yes       No";
-			break;
-		}
+	return false;
+}
 
-		printScroll();
-		window->textColumn = 0;
-		window->textRow = 0;
-		window->textColumnOffset = 0;
-		window->textLength = 0;		// Difference
+bool AGOSEngine_Elvira2::confirmOverWrite(WindowBlock *window) {
+	// Original verison never confirmed
+	return true;
+}
 
-		for (; *message1; message1++)
-			windowPutChar(window, *message1);
-		for (; *message2; message2++)
-			windowPutChar(window, *message2);
-		for (; *message3; message3++)
-			windowPutChar(window, *message3);
+bool AGOSEngine::confirmOverWrite(WindowBlock *window) {
+	const char *message1, *message2, *message3;
 
-		if (confirmYesOrNo(120, 78) == 0x7FFF)
-			return true;
+	switch (_language) {
+	case Common::FR_FRA:
+		message1 = "\rFichier d/j; existant.\r\r";
+		message2 = "  Ecrire pardessus ?\r\r";
+		message3 = "     Oui      Non";
+		break;
+	case Common::DE_DEU:
+		message1 = "\rDatei existiert bereits.\r\r";
+		message2 = "     berschreiben ?\r\r";
+		message3 = "     Ja        Nein";
+		break;
+	default:
+		message1 = "\r File already exists.\r\r";
+		message2 = "    Overwrite it ?\r\r";
+		message3 = "     Yes       No";
+		break;
 	}
 
+	printScroll();
+	window->textColumn = 0;
+	window->textRow = 0;
+	window->textColumnOffset = 0;
+	window->textLength = 0;		// Difference
+
+	for (; *message1; message1++)
+		windowPutChar(window, *message1);
+	for (; *message2; message2++)
+		windowPutChar(window, *message2);
+	for (; *message3; message3++)
+		windowPutChar(window, *message3);
+
+	if (confirmYesOrNo(120, 78) == 0x7FFF)
+		return true;
+
 	return false;
 }
 


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