diff options
| -rw-r--r-- | engines/agos/agos.cpp | 20 | ||||
| -rw-r--r-- | engines/agos/agos.h | 5 | ||||
| -rw-r--r-- | engines/agos/res_ami.cpp | 14 | ||||
| -rw-r--r-- | engines/agos/sound.cpp | 5 | ||||
| -rw-r--r-- | engines/agos/string.cpp | 7 | ||||
| -rw-r--r-- | engines/agos/vga.cpp | 69 | 
6 files changed, 87 insertions, 33 deletions
| diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 0768b7e854..5eba04f895 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -1787,16 +1787,6 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {  	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 @@ void AGOSEngine::set_video_mode_internal(uint16 mode, uint16 vga_res_id) {  		_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) { diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 9f08142992..06b9bf2a70 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -459,7 +459,8 @@ protected:  	VgaPointersEntry _vgaBufferPointers[450];  	VgaSprite _vgaSprites[200]; -	VgaSleepStruct _vgaSleepStructs[60]; +	VgaSleepStruct _waitSyncTable[60]; +	VgaSleepStruct _waitEndTable[60];  	const uint16 *_pathFindArray[100]; @@ -1237,6 +1238,7 @@ protected:  	void clearWindow(uint windowNum, uint color);  	void setPaletteSlot(uint srcOffs, uint dstOffs); +	void checkWaitEndTable();  	void startOverlayAnims();  	void startAnOverlayAnim(); @@ -1275,6 +1277,7 @@ protected:  	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); diff --git a/engines/agos/res_ami.cpp b/engines/agos/res_ami.cpp index f4b9a2d949..fc6e5cf350 100644 --- a/engines/agos/res_ami.cpp +++ b/engines/agos/res_ami.cpp @@ -39,7 +39,7 @@ byte *clipoutptr;  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 uncompressplane(byte *plane, byte *outptr, uint16 length) {  }  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 @@ static void convertcompressedclip(uint16 height, uint16 width) {  	}  	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 @@ void AGOSEngine::convertAmiga(byte *srcBuf, int32 fileSize) {  	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 @@ void AGOSEngine::convertAmiga(byte *srcBuf, int32 fileSize) {  		clipnumber++;  	}  	outlength = bufoutend; -	debug(0, "convertAmiga: outlength %d",outlength); +	debug(10, "convertAmiga: outlength %d",outlength);  	byte *dstBuf = allocBlock (outlength);  	memcpy(dstBuf, bufferout, outlength); diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 987e869da2..04b932a261 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -632,7 +632,10 @@ void Sound::playRawData(byte *soundData, uint sound, uint size) {  	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 diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index 65dc578336..5eb6f1f510 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -444,11 +444,12 @@ void AGOSEngine::printScreenText(uint vgaSpriteId, uint color, const char *strin  	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; diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index 463fb08c4d..6a44c508a7 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1681,7 +1681,7 @@ void AGOSEngine::vc14_addToSpriteY() {  }  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::vc15_sync() {  }  void AGOSEngine::vc16_waitSync() { -	VgaSleepStruct *vfs = _vgaSleepStructs; +	VgaSleepStruct *vfs = _waitSyncTable;  	while (vfs->ident)  		vfs++; @@ -1715,10 +1715,33 @@ void AGOSEngine::vc16_waitSync() {  	_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::vc18_jump() {  }  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::vc24_setSpriteXY() {  }  void AGOSEngine::vc25_halt_sprite() { +	checkWaitEndTable(); +  	VgaSprite *vsp = findCurSprite();  	while (vsp->id != 0) {  		memcpy(vsp, vsp + 1, sizeof(VgaSprite)); @@ -1955,7 +1996,13 @@ void AGOSEngine::vc27_resetSprite() {  	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++; @@ -1992,7 +2039,7 @@ void AGOSEngine::vc28_playSFX() {  	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 @@ void AGOSEngine::vc28_playSFX() {  		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 @@ void AGOSEngine::vc_kill_sprite(uint file, uint sprite) {  	_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) { | 
