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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Oct 21 02:51:43 CEST 2006


Revision: 24396
          http://svn.sourceforge.net/scummvm/?rev=24396&view=rev
Author:   kirben
Date:     2006-10-20 17:51:32 -0700 (Fri, 20 Oct 2006)

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

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/icons.cpp
    scummvm/trunk/engines/agos/menus.cpp
    scummvm/trunk/engines/agos/script.cpp
    scummvm/trunk/engines/agos/script_pp.cpp
    scummvm/trunk/engines/agos/vga.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-20 19:44:27 UTC (rev 24395)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-21 00:51:32 UTC (rev 24396)
@@ -767,11 +767,12 @@
 	void showmessage_helper_3(uint a, uint b);
 	void showmessage_print_char(byte chr);
 
-	void set_video_mode_internal(uint16 mode, uint16 vga_res_id);
-
 	void loadZone(uint zoneNum);
 
 	void animate(uint windowNum, uint zoneNum, uint vgaSpriteId, uint x, uint y, uint palette, bool setZone = true);
+	void setImage(uint16 vga_res_id, bool setZone);
+	void setWindowImage(uint16 mode, uint16 vga_res_id);
+
 	void playSpeech(uint speech_id, uint vga_sprite_id);
 	void skipSpeech();
 

Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp	2006-10-20 19:44:27 UTC (rev 24395)
+++ scummvm/trunk/engines/agos/icons.cpp	2006-10-21 00:51:32 UTC (rev 24396)
@@ -568,7 +568,7 @@
 		ha->priority = 100;
 		ha->window = window;
 		ha->verb = 1;
-		set_video_mode_internal(6, 103);
+		setWindowImage(6, 103);
 	} else if (getGameType() == GType_ELVIRA2) {
 		ha->x = 54;
 		ha->y = 178;
@@ -579,7 +579,7 @@
 		ha->priority = 100;
 		ha->window = window;
 		ha->verb = 1;
-		set_video_mode_internal(6, 106);
+		setWindowImage(6, 106);
 	} else {
 		ha->x = 30 * 8;
 		ha->y = 170;
@@ -705,10 +705,10 @@
 		stopAnimateSimon1(128);
 	} else if (getGameType() == GType_WW) {
 		setBitFlag(22, false);
-		set_video_mode_internal(6, 103);
+		setWindowImage(6, 103);
 	} else if (getGameType() == GType_ELVIRA2) {
 		setBitFlag(21, false);
-		set_video_mode_internal(6, 106);
+		setWindowImage(6, 106);
 	}
 }
 

Modified: scummvm/trunk/engines/agos/menus.cpp
===================================================================
--- scummvm/trunk/engines/agos/menus.cpp	2006-10-20 19:44:27 UTC (rev 24395)
+++ scummvm/trunk/engines/agos/menus.cpp	2006-10-21 00:51:32 UTC (rev 24396)
@@ -161,9 +161,9 @@
 		disableBox(i);
 
 	if (getGameType() == GType_WW) {
-		set_video_mode_internal(2, 101);
+		setWindowImage(2, 101);
 	} else {
-		set_video_mode_internal(2, 102);
+		setWindowImage(2, 102);
 	}
 }
 
@@ -205,9 +205,9 @@
 
 	_variableArray[var + 4] = id - 111;
 	if (getGameType() == GType_WW) {
-		set_video_mode_internal(2, 102);
+		setWindowImage(2, 102);
 	} else {
-		set_video_mode_internal(2, 103);
+		setWindowImage(2, 103);
 	}
 }
 

Modified: scummvm/trunk/engines/agos/script.cpp
===================================================================
--- scummvm/trunk/engines/agos/script.cpp	2006-10-20 19:44:27 UTC (rev 24395)
+++ scummvm/trunk/engines/agos/script.cpp	2006-10-21 00:51:32 UTC (rev 24396)
@@ -668,7 +668,7 @@
 	if (_lockWord & 0x10)
 		error("o_picture: _lockWord & 0x10");
 
-	set_video_mode_internal(mode, vga_res);
+	setWindowImage(mode, vga_res);
 }
 
 void AGOSEngine::o_loadZone() {

Modified: scummvm/trunk/engines/agos/script_pp.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_pp.cpp	2006-10-20 19:44:27 UTC (rev 24395)
+++ scummvm/trunk/engines/agos/script_pp.cpp	2006-10-21 00:51:32 UTC (rev 24396)
@@ -104,7 +104,7 @@
 			_variableArray[i] = _variableArray2[i];
 		}
 		i = _variableArray[999] * 100 + 11;
-		set_video_mode_internal(4,i);
+		setWindowImage(4,i);
 		if (getBitFlag(110)) {
 			_gameTime += 10;
 		} else {

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-20 19:44:27 UTC (rev 24395)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-21 00:51:32 UTC (rev 24396)
@@ -408,11 +408,8 @@
 }
 
 void AGOSEngine::vc2_call() {
-	VgaPointersEntry *vpe;
-	uint16 count, num, res;
+	uint16 num;
 	byte *old_file_1, *old_file_2;
-	byte *b, *bb;
-	const byte *vcPtrOrg;
 
 	if (getGameType() == GType_ELVIRA2) {
 		num = vcReadNextWord();
@@ -423,86 +420,10 @@
 	old_file_1 = _curVgaFile1;
 	old_file_2 = _curVgaFile2;
 
-	for (;;) {
-		res = num / 100;
-		vpe = &_vgaBufferPointers[res];
+	setImage(num, false);
 
-		_curVgaFile1 = vpe->vgaFile1;
-		_curVgaFile2 = vpe->vgaFile2;
-		if (vpe->vgaFile1 != NULL)
-			break;
-		if (_zoneNumber != res)
-			_noOverWrite = _zoneNumber;
-
-		loadZone(res);
-		_noOverWrite = 0xFFFF;
-	}
-
-
-	bb = _curVgaFile1;
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		b = bb + READ_LE_UINT16(bb + 2);
-		count = READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageCount);
-		b = bb + READ_LE_UINT16(&((VgaFileHeader2_Feeble *) b)->imageTable);
-
-		while (count--) {
-			if (READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) == num)
-				break;
-			b += sizeof(ImageHeader_Feeble);
-		}
-		assert(READ_LE_UINT16(&((ImageHeader_Feeble *) b)->id) == num);
-	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-		b = bb + READ_BE_UINT16(bb + 4);
-		count = READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageCount);
-		b = bb + READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageTable);
-
-		while (count--) {
-			if (READ_BE_UINT16(&((ImageHeader_Simon *) b)->id) == num)
-				break;
-			b += sizeof(ImageHeader_Simon);
-		}
-		assert(READ_BE_UINT16(&((ImageHeader_Simon *) b)->id) == num);
-	} else {
-		b = bb + READ_BE_UINT16(bb + 10);
-		b += 20;
-
-		count = READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageCount);
-		b = bb + READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->imageTable);
-
-		while (count--) {
-			if (READ_BE_UINT16(&((ImageHeader_WW *) b)->id) == num)
-				break;
-			b += sizeof(ImageHeader_WW);
-		}
-		assert(READ_BE_UINT16(&((ImageHeader_WW *) b)->id) == num);
-	}
-
-	if (_startVgaScript) {
-		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), res, num);
-		} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon*)b)->scriptOffs), res, num);
-		} else {
-			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), res, num);
-		}
-	}
-
-	vcPtrOrg = _vcPtr;
-
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		_vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
-	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
-	} else {
-		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW *) b)->scriptOffs);
-	}
-
-	runVgaScript();
-
 	_curVgaFile1 = old_file_1;
 	_curVgaFile2 = old_file_2;
-
-	_vcPtr = vcPtrOrg;
 }
 
 void AGOSEngine::vc3_loadSprite() {
@@ -1226,10 +1147,10 @@
 		if (windowNum == 16) {
 			_copyPartialMode = 2;
 		} else {
-			set_video_mode_internal(windowNum, vga_res);
+			setWindowImage(windowNum, vga_res);
 		}
 	} else {
-		set_video_mode_internal(windowNum, vga_res);
+		setWindowImage(windowNum, vga_res);
 	}
 }
 
@@ -1874,42 +1795,38 @@
 	}
 }
 
-void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {
-	uint num, num_lines;
+void AGOSEngine::setImage(uint16 vga_res_id, bool setZone) {
+	uint zoneNum;
 	VgaPointersEntry *vpe;
 	byte *bb, *b;
-	uint16 count, updateWindow;
+	uint16 count;
 	const byte *vc_ptr_org;
 
-	_windowNum = updateWindow = mode;
-	_lockWord |= 0x20;
+	zoneNum = vga_res_id / 100;
 
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		vc27_resetSprite();
-	}
-
-	if (vga_res_id == 0) {
-		if (getGameType() == GType_SIMON1) {
-			_unkPalFlag = true;
-		} else if (getGameType() == GType_SIMON2) {
-			_useBackGround = true;
-			_restoreWindow6 = true;
-		}
-	}
-
-	_zoneNumber = num = vga_res_id / 100;
-
 	for (;;) {
-		vpe = &_vgaBufferPointers[num];
-
+		vpe = &_vgaBufferPointers[zoneNum];
 		_curVgaFile1 = vpe->vgaFile1;
 		_curVgaFile2 = vpe->vgaFile2;
-		_curSfxFile = vpe->sfxFile;
 
-		if (vpe->vgaFile1 != NULL)
-			break;
+		if (setZone) {
+			_curSfxFile = vpe->sfxFile;
+			_zoneNumber = zoneNum;
 
-		loadZone(num);
+			if (vpe->vgaFile1 != NULL)
+				break;
+
+			loadZone(zoneNum);
+		} else {
+
+			if (vpe->vgaFile1 != NULL)
+				break;
+			if (_zoneNumber != zoneNum)
+				_noOverWrite = _zoneNumber;
+
+			loadZone(zoneNum);
+			_noOverWrite = 0xFFFF;
+		}
 	}
 
 	bb = _curVgaFile1;
@@ -1955,14 +1872,48 @@
 
 	if (_startVgaScript) {
 		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), num, vga_res_id);
+			dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), zoneNum, vga_res_id);
 		} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon*)b)->scriptOffs), num, vga_res_id);
+			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon*)b)->scriptOffs), zoneNum, vga_res_id);
 		} else {
-			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), num, vga_res_id);
+			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), zoneNum, vga_res_id);
 		}
 	}
 
+	vc_ptr_org = _vcPtr;
+
+	if (getGameType() == GType_FF || getGameType() == GType_PP) {
+		_vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
+	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
+		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
+	} else {
+		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW *) b)->scriptOffs);
+	}
+
+	runVgaScript();
+	_vcPtr = vc_ptr_org;
+}
+
+void AGOSEngine::setWindowImage(uint16 mode, uint16 vga_res_id) {
+	uint num_lines;
+	uint16 updateWindow;
+
+	_windowNum = updateWindow = mode;
+	_lockWord |= 0x20;
+
+	if (getGameType() == GType_FF || getGameType() == GType_PP) {
+		vc27_resetSprite();
+	}
+
+	if (vga_res_id == 0) {
+		if (getGameType() == GType_SIMON1) {
+			_unkPalFlag = true;
+		} else if (getGameType() == GType_SIMON2) {
+			_useBackGround = true;
+			_restoreWindow6 = true;
+		}
+	}
+
 	if (getGameType() == GType_SIMON1) {
 		if (vga_res_id == 16300) {
 			clearBackFromTop(134);
@@ -1984,20 +1935,9 @@
 		}
 	}
 
-	vc_ptr_org = _vcPtr;
+	setImage(vga_res_id, true);
 
 	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		_vcPtr = _curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble *) b)->scriptOffs);
-	} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon *) b)->scriptOffs);
-	} else {
-		_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW *) b)->scriptOffs);
-	}
-
-	runVgaScript();
-	_vcPtr = vc_ptr_org;
-
-	if (getGameType() == GType_FF || getGameType() == GType_PP) {
 		fillFrontFromBack(0, 0, _screenWidth, _screenHeight);
 		fillBackGroundFromBack(_screenHeight);
 		_syncFlag2 = 1;
@@ -2010,7 +1950,7 @@
 			_syncFlag2 = 1;
 		}
 		_useBackGround = false;
-	} else {
+	} else if (getGameType() == GType_SIMON1) {
 		// Allow one section of Simon the Sorcerer 1 introduction to be displayed
 		// in lower half of screen
 		if (_subroutine == 2923 || _subroutine == 2926)
@@ -2020,9 +1960,14 @@
 
 		fillFrontFromBack(0, 0, _screenWidth, num_lines);
 		fillBackGroundFromBack(num_lines);
-
 		_syncFlag2 = 1;
 		_timer5 = 0;
+	} else {
+		num_lines = _windowNum == 4 ? 134 : 200;
+		fillFrontFromBack(0, 0, _screenWidth, num_lines);
+		fillBackGroundFromBack(num_lines);
+		_syncFlag2 = 1;
+		_timer5 = 0;
 	}
 
 	if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette != 0) {


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