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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Oct 14 16:29:22 CEST 2006


Revision: 24315
          http://svn.sourceforge.net/scummvm/?rev=24315&view=rev
Author:   kirben
Date:     2006-10-14 07:29:14 -0700 (Sat, 14 Oct 2006)

Log Message:
-----------
Add extra video opcodes for Elvira 1 demo

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/res_ami.cpp
    scummvm/trunk/engines/agos/sound.cpp
    scummvm/trunk/engines/agos/string.cpp
    scummvm/trunk/engines/agos/vga.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-14 14:16:16 UTC (rev 24314)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-14 14:29:14 UTC (rev 24315)
@@ -1787,16 +1787,6 @@
 	runVgaScript();
 	_vcPtr = vc_ptr_org;
 
-	if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette != 0) {
-		byte *dst = getBackBuf() + 42560;
-		int size = 21440;
-
-		while (size--) {
-			*dst += 0x10;
-			dst++;
-		}
-	}
-
 	if (getGameType() == GType_FF || getGameType() == GType_PP) {
 		fillFrontFromBack(0, 0, _screenWidth, _screenHeight);
 		fillBackGroundFromBack(_screenHeight);
@@ -1825,6 +1815,16 @@
 		_timer5 = 0;
 	}
 
+	if (getGameType() == GType_ELVIRA1 && updateWindow == 3 && _bottomPalette != 0) {
+		byte *dst = getBackBuf() + 42560;
+		int size = 21440;
+
+		while (size--) {
+			*dst += 0x10;
+			dst++;
+		}
+	}
+
 	_lockWord &= ~0x20;
 
 	if (getGameType() == GType_SIMON1) {

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-14 14:16:16 UTC (rev 24314)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-14 14:29:14 UTC (rev 24315)
@@ -459,7 +459,8 @@
 
 	VgaPointersEntry _vgaBufferPointers[450];
 	VgaSprite _vgaSprites[200];
-	VgaSleepStruct _vgaSleepStructs[60];
+	VgaSleepStruct _waitSyncTable[60];
+	VgaSleepStruct _waitEndTable[60];
 
 	const uint16 *_pathFindArray[100];
 
@@ -1237,6 +1238,7 @@
 
 	void clearWindow(uint windowNum, uint color);
 	void setPaletteSlot(uint srcOffs, uint dstOffs);
+	void checkWaitEndTable();
 
 	void startOverlayAnims();
 	void startAnOverlayAnim();
@@ -1275,6 +1277,7 @@
 	byte *getScaleBuf();
 
 	void convertAmiga(byte *srcBuf, int32 fileSize);
+	bool decrunchFile(byte *src, byte *dst, uint32 size);
 	bool loadVGAFile(uint id, uint type);
 	void loadSimonVGAFile(uint id);
 

Modified: scummvm/trunk/engines/agos/res_ami.cpp
===================================================================
--- scummvm/trunk/engines/agos/res_ami.cpp	2006-10-14 14:16:16 UTC (rev 24314)
+++ scummvm/trunk/engines/agos/res_ami.cpp	2006-10-14 14:29:14 UTC (rev 24315)
@@ -39,7 +39,7 @@
 int clipnumber;
 
 static void uncompressplane(byte *plane, byte *outptr, uint16 length) {
-	debug(0, "uncompressplane: length %d", length);
+	debug(10, "uncompressplane: length %d", length);
 
 	char x;
 	byte y, z;
@@ -71,7 +71,7 @@
 }
 
 static void convertcompressedclip(uint16 height, uint16 width) {
-	debug(0, "convertcompressedclip: height %d width %d", height, width);
+	debug(10, "convertcompressedclip: height %d width %d", height, width);
 
 	byte *plane0;
 	byte *plane1;
@@ -217,12 +217,12 @@
 	}
 	if (cliplength > (height * width / 2))
 		warning("Negative compression. Clip %d. %d bytes bigger.",clipnumber,(cliplength-(height*width/2)));
-	free(uncbuffer);
-	free(uncbfrout);
+	//free(uncbuffer);
+	//free(uncbfrout);
 }
 
 static void convertclip(uint32 offset, uint16 height, uint16 width) {
-	debug(0, "convertclip: height %d width %d", height, width);
+	debug(10, "convertclip: height %d width %d", height, width);
 
 	uint32 length, i, j;
 	uint16 word1, word2, word3, word4;
@@ -264,7 +264,7 @@
 	uint16 clipwidth, clipheight;
 	byte *clipsend;
 
-	debug(0, "convertAmiga: fizeSize %d", fileSize);
+	debug(10, "convertAmiga: fizeSize %d", fileSize);
 
 	buffer = (byte *)malloc((int32)fileSize);
 	memcpy(buffer, srcBuf, fileSize);
@@ -300,7 +300,7 @@
 		clipnumber++;
 	}
 	outlength = bufoutend;
-	debug(0, "convertAmiga: outlength %d",outlength);
+	debug(10, "convertAmiga: outlength %d",outlength);
 
 	byte *dstBuf = allocBlock (outlength);
 	memcpy(dstBuf, bufferout, outlength);

Modified: scummvm/trunk/engines/agos/sound.cpp
===================================================================
--- scummvm/trunk/engines/agos/sound.cpp	2006-10-14 14:16:16 UTC (rev 24314)
+++ scummvm/trunk/engines/agos/sound.cpp	2006-10-14 14:29:14 UTC (rev 24315)
@@ -632,7 +632,10 @@
 	byte *buffer = (byte *)malloc(size);
 	memcpy(buffer, soundData, size);
 
-	_mixer->playRaw(&_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE, sound);
+	if (_vm->getPlatform() == Common::kPlatformPC)
+		_mixer->playRaw(&_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE, sound);
+	else
+		_mixer->playRaw(&_effectsHandle, buffer, size, 8000, Audio::Mixer::FLAG_AUTOFREE, sound);
 }
 
 // Feeble Files specific

Modified: scummvm/trunk/engines/agos/string.cpp
===================================================================
--- scummvm/trunk/engines/agos/string.cpp	2006-10-14 14:16:16 UTC (rev 24314)
+++ scummvm/trunk/engines/agos/string.cpp	2006-10-14 14:29:14 UTC (rev 24315)
@@ -444,11 +444,12 @@
 	if (getGameType() == GType_FF) {
 		renderString(1, color, width, height, convertedString);
 	} else {
-		color = color * 3 + 192;
-		if (getPlatform() == Common::kPlatformAmiga)
+		if (getPlatform() == Common::kPlatformAmiga) {
 			renderStringAmiga(vgaSpriteId, color, width, height, convertedString);
-		else
+		} else {
+			color = color * 3 + 192;
 			renderString(vgaSpriteId, color, width, height, convertedString);
+		}
 	}
 
 	int b = 4;

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-14 14:16:16 UTC (rev 24314)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-14 14:29:14 UTC (rev 24315)
@@ -1681,7 +1681,7 @@
 }
 
 void AGOSEngine::vc15_sync() {
-	VgaSleepStruct *vfs = _vgaSleepStructs, *vfs_tmp;
+	VgaSleepStruct *vfs = _waitSyncTable, *vfs_tmp;
 	uint16 id = vcReadNextWord();
 	while (vfs->ident != 0) {
 		if (vfs->ident == id) {
@@ -1703,7 +1703,7 @@
 }
 
 void AGOSEngine::vc16_waitSync() {
-	VgaSleepStruct *vfs = _vgaSleepStructs;
+	VgaSleepStruct *vfs = _waitSyncTable;
 	while (vfs->ident)
 		vfs++;
 
@@ -1715,10 +1715,33 @@
 	_vcPtr = (byte *)&_vc_get_out_of_code;
 }
 
+void AGOSEngine::checkWaitEndTable() {
+	VgaSleepStruct *vfs = _waitEndTable, *vfs_tmp;
+	while (vfs->ident != 0) {
+		if (vfs->ident == _vgaCurSpriteId) {
+			addVgaEvent(_vgaBaseDelay, vfs->code_ptr, vfs->sprite_id, vfs->cur_vga_file);
+			vfs_tmp = vfs;
+			do {
+				memcpy(vfs_tmp, vfs_tmp + 1, sizeof(VgaSleepStruct));
+				vfs_tmp++;
+			} while (vfs_tmp->ident != 0);
+		} else {
+			vfs++;
+		}
+	}
+}
+
 void AGOSEngine::vc17_waitEnd() {
-	// TODO
-	uint a = vcReadNextWord();
-	debug(0, "vc17_waitEnd: stub (%d)", a);
+	VgaSleepStruct *vfs = _waitEndTable;
+	while (vfs->ident)
+		vfs++;
+
+	vfs->ident = vcReadNextWord();
+	vfs->code_ptr = _vcPtr;
+	vfs->sprite_id = _vgaCurSpriteId;
+	vfs->cur_vga_file = _vgaCurZoneNum;
+
+	_vcPtr = (byte *)&_vc_get_out_of_code;
 }
 
 void AGOSEngine::vc17_setPathfinderItem() {
@@ -1737,8 +1760,24 @@
 }
 
 void AGOSEngine::vc19_loop() {
-	// TODO
-	debug(0, "vc19_loop: stub");
+	uint16 count;
+	byte *b, *bb;
+
+	bb = _curVgaFile1;
+	b = _curVgaFile1 + READ_BE_UINT16(bb + 10);
+	b += 20;
+
+	count = READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->animationCount);
+	b = bb + READ_BE_UINT16(&((VgaFileHeader2_Common *) b)->animationTable);
+
+	while (count--) {
+		if (READ_BE_UINT16(&((AnimationHeader_WW *) b)->id) == _vgaCurSpriteId)
+			break;
+		b += sizeof(AnimationHeader_WW);
+	}
+	assert(READ_BE_UINT16(&((AnimationHeader_WW *) b)->id) == _vgaCurSpriteId);
+
+	_vcPtr = _curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_WW *) b)->scriptOffs);
 }
 
 void AGOSEngine::vc20_setRepeat() {
@@ -1915,6 +1954,8 @@
 }
 
 void AGOSEngine::vc25_halt_sprite() {
+	checkWaitEndTable();
+
 	VgaSprite *vsp = findCurSprite();
 	while (vsp->id != 0) {
 		memcpy(vsp, vsp + 1, sizeof(VgaSprite));
@@ -1955,12 +1996,18 @@
 	if (bak.id != 0)
 		memcpy(_vgaSprites, &bak, sizeof(VgaSprite));
 
-	vfs = _vgaSleepStructs;
+	vfs = _waitEndTable;
 	while (vfs->ident) {
 		vfs->ident = 0;
 		vfs++;
 	}
 
+	vfs = _waitSyncTable;
+	while (vfs->ident) {
+		vfs->ident = 0;
+		vfs++;
+	}
+
 	vte = _vgaTimerList;
 	while (vte->delay) {
 		if ((getGameType() == GType_SIMON1) && vte->sprite_id == 128) {
@@ -1992,7 +2039,7 @@
 	frequency = vcReadNextWord();
 	flags = vcReadNextWord();
 
-	debug(0, "vc28_playSFX: stub (%d, %d, %d, %d)", sound, channels, frequency, flags);
+	debug(0, "vc28_playSFX: (%d, %d, %d, %d)", sound, channels, frequency, flags);
 
 	if (_curSfxFile == NULL)
 		return;
@@ -2006,7 +2053,7 @@
 		size = READ_LE_UINT16(dst);
 		offs = 4;
 	} else {
-		while (READ_BE_UINT16(dst) != sound)
+		while (READ_BE_UINT16(dst + 6) != sound)
 			dst += 12;
 
 		size = READ_BE_UINT16(dst + 2);
@@ -2564,7 +2611,7 @@
 	_vgaCurZoneNum = file;
 	_vgaCurSpriteId = sprite;
 
-	vfs = _vgaSleepStructs;
+	vfs = _waitSyncTable;
 	while (vfs->ident != 0) {
 		if (vfs->sprite_id == _vgaCurSpriteId && ((getGameType() == GType_SIMON1) || vfs->cur_vga_file == _vgaCurZoneNum)) {
 			while (vfs->ident != 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