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

kirben at users.sourceforge.net kirben at users.sourceforge.net
Sat Oct 21 03:52:25 CEST 2006


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

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

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/animation.cpp
    scummvm/trunk/engines/agos/charset.cpp
    scummvm/trunk/engines/agos/debug.cpp
    scummvm/trunk/engines/agos/draw.cpp
    scummvm/trunk/engines/agos/event.cpp
    scummvm/trunk/engines/agos/gfx.cpp
    scummvm/trunk/engines/agos/icons.cpp
    scummvm/trunk/engines/agos/input.cpp
    scummvm/trunk/engines/agos/midi.cpp
    scummvm/trunk/engines/agos/midi.h
    scummvm/trunk/engines/agos/module.mk
    scummvm/trunk/engines/agos/res.cpp
    scummvm/trunk/engines/agos/script.cpp
    scummvm/trunk/engines/agos/string.cpp
    scummvm/trunk/engines/agos/verb.cpp
    scummvm/trunk/engines/agos/vga.cpp
    scummvm/trunk/engines/agos/vga_s2.cpp
    scummvm/trunk/engines/agos/window.cpp
    scummvm/trunk/engines/agos/zones.cpp

Added Paths:
-----------
    scummvm/trunk/engines/agos/res_snd.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/agos.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -474,7 +474,7 @@
 	if (!_mixer->isReady())
 		warning("Sound initialization failed. "
 						"Features of the game that depend on sound synchronization will most likely break");
-	set_volume(ConfMan.getInt("sfx_volume"));
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
 	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
 
 	// Setup midi driver
@@ -493,11 +493,11 @@
 
 	midi.mapMT32toGM (getGameType() != GType_SIMON2 && !_native_mt32);
 
-	midi.set_driver(driver);
+	midi.setDriver(driver);
 	int ret = midi.open();
 	if (ret)
 		warning ("MIDI Player init failed: \"%s\"", midi.getErrorName (ret));
-	midi.set_volume(ConfMan.getInt("music_volume"));
+	midi.setVolume(ConfMan.getInt("music_volume"));
 
 	if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
 		midi.pause(_musicPaused ^= 1);
@@ -771,26 +771,6 @@
 	return _debugger;
 }
 
-void AGOSEngine::paletteFadeOut(byte *palPtr, uint num, uint size) {
-	byte *p = palPtr;
-
-	do {
-		if (p[0] >= size)
-			p[0] -= size;
-		else
-			p[0] = 0;
-		if (p[1] >= size)
-			p[1] -= size;
-		else
-			p[1] = 0;
-		if (p[2] >= size)
-			p[2] -= size;
-		else
-			p[2] = 0;
-		p += 4;
-	} while (--num);
-}
-
 void AGOSEngine::pause() {
 	_keyPressed = 1;
 	_pause = 1;
@@ -806,86 +786,9 @@
 	}
 	midi.pause(music_status);
 	_sound->ambientPause(ambient_status);
-
 }
 
-void AGOSEngine::playSpeech(uint speech_id, uint vgaSpriteId) {
-	if (getGameType() == GType_SIMON1) {
-		if (speech_id == 9999) {
-			if (_subtitles)
-				return;
-			if (!getBitFlag(14) && !getBitFlag(28)) {
-				setBitFlag(14, true);
-				_variableArray[100] = 15;
-				animate(4, 1, 130, 0, 0, 0);
-				waitForSync(130);
-			}
-			_skipVgaWait = true;
-		} else {
-			if (_subtitles && _scriptVar2) {
-				animate(4, 2, 204, 0, 0, 0);
-				waitForSync(204);
-				stopAnimateSimon1(204);
-			}
-			stopAnimateSimon1(vgaSpriteId + 201);
-			loadVoice(speech_id);
-			animate(4, 2, vgaSpriteId + 201, 0, 0, 0);
-		}
-	} else {
-		if (speech_id == 0xFFFF) {
-			if (_subtitles)
-				return;
-			if (!getBitFlag(14) && !getBitFlag(28)) {
-				setBitFlag(14, true);
-				_variableArray[100] = 5;
-				animate(4, 1, 30, 0, 0, 0);
-				waitForSync(130);
-			}
-			_skipVgaWait = true;
-		} else {
-			if (getGameType() == GType_SIMON2 && _subtitles && _language != Common::HB_ISR) {
-				loadVoice(speech_id);
-				return;
-			}
-
-			if (_subtitles && _scriptVar2) {
-				animate(4, 2, 5, 0, 0, 0);
-				waitForSync(205);
-				stopAnimateSimon2(2,5);
-			}
-
-			stopAnimateSimon2(2, vgaSpriteId + 2);
-			loadVoice(speech_id);
-			animate(4, 2, vgaSpriteId + 2, 0, 0, 0);
-		}
-	}
-}
-
-void AGOSEngine::skipSpeech() {
-	_sound->stopVoice();
-	if (!getBitFlag(28)) {
-		setBitFlag(14, true);
-		if (getGameType() == GType_FF) {
-			_variableArray[103] = 5;
-			animate(4, 2, 13, 0, 0, 0);
-			waitForSync(213);
-			stopAnimateSimon2(2, 1);
-		} else if (getGameType() == GType_SIMON2) {
-			_variableArray[100] = 5;
-			animate(4, 1, 30, 0, 0, 0);
-			waitForSync(130);
-			stopAnimateSimon2(2, 1);
-		} else {
-			_variableArray[100] = 15;
-			animate(4, 1, 130, 0, 0, 0);
-			waitForSync(130);
-			stopAnimateSimon1(1);
-		}
-	}
-}
-
 int AGOSEngine::go() {
-
 	loadGamePcFile();
 
 	addTimeEvent(0, 1);
@@ -943,141 +846,6 @@
 	_system->quit();
 }
 
-void AGOSEngine::loadMusic(uint music) {
-	char buf[4];
-
-	if (getPlatform() == Common::kPlatformAtariST) {
-		// TODO: Add support for music format used by Elvira 2
-	} else if (getPlatform() == Common::kPlatformAmiga) {
-		_modPlayer->stop();
-
-		char filename[15];
-		File f;
-
-		if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO)
-			sprintf(filename, "elvira2");
-		else
-			sprintf(filename, "%dtune", music);
-
-		f.open(filename);
-		if (f.isOpen() == false) {
-			error("loadMusic: Can't load module from '%s'", filename);
-		}
-
-		if (!(getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) &&
-			getFeatures() & GF_CRUNCHED) {
-			uint srcSize = f.size();
-			byte *srcBuf = (byte *)malloc(srcSize);
-			if (f.read(srcBuf, srcSize) != srcSize)
-				error("loadMusic: Read failed");
-
-			uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
-			byte *dstBuf = (byte *)malloc(dstSize);
-			decrunchFile(srcBuf, dstBuf, srcSize);
-			free(srcBuf);
-
-			Common::MemoryReadStream stream(dstBuf, dstSize);
-			_modPlayer->loadModuleStream(stream);
-		} else {
-			_modPlayer->loadModuleStream(f);
-		}
-		_modPlayer->start();
-	} else if (getGameType() == GType_SIMON2) {
-		midi.stop();
-		_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
-		_gameFile->read(buf, 4);
-		if (!memcmp(buf, "FORM", 4)) {
-			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
-			midi.loadXMIDI (_gameFile);
-		} else {
-			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
-			midi.loadMultipleSMF (_gameFile);
-		}
-
-		_lastMusicPlayed = music;
-		_nextMusicToPlay = -1;
-	} else if (getGameType() == GType_SIMON1) {
-		midi.stop();
-		midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
-
-		if (getFeatures() & GF_TALKIE) {
-			// FIXME: The very last music resource, a cymbal crash for when the
-			// two demons crash into each other, should NOT be looped like the
-			// other music tracks. In simon1dos/talkie the GMF resource includes
-			// a loop override that acomplishes this, but there seems to be nothing
-			// for this in the SMF resources.
-			if (music == 35)
-				midi.setLoop (false);
-
-			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
-			_gameFile->read(buf, 4);
-			if (!memcmp(buf, "GMF\x1", 4)) {
-				_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
-				midi.loadSMF (_gameFile, music);
-			} else {
-				_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
-				midi.loadMultipleSMF (_gameFile);
-			}
-
-		} else {
-			char filename[15];
-			File f;
-			sprintf(filename, "MOD%d.MUS", music);
-			f.open(filename);
-			if (f.isOpen() == false)
-				error("loadMusic: Can't load music from '%s'", filename);
-
-			if (getFeatures() & GF_DEMO)
-				midi.loadS1D (&f);
-			else
-				midi.loadSMF (&f, music);
-		}
-
-		midi.startTrack (0);
-	} else {
-		midi.stop();
-		midi.setLoop (true); // Must do this BEFORE loading music.
-
-		char filename[15];
-		File f;
-		sprintf(filename, "MOD%d.MUS", music);
-		f.open(filename);
-		if (f.isOpen() == false)
-			error("loadMusic: Can't load music from '%s'", filename);
-
-		midi.loadS1D (&f);
-		midi.startTrack (0);
-	}
-}
-
-void AGOSEngine::playSting(uint a) {
-	if (!midi._enable_sfx)
-		return;
-
-	char filename[15];
-
-	File mus_file;
-	uint16 mus_offset;
-
-	sprintf(filename, "STINGS%i.MUS", _soundFileId);
-	mus_file.open(filename);
-	if (!mus_file.isOpen())
-		error("playSting: Can't load sound effect from '%s'", filename);
-
-	mus_file.seek(a * 2, SEEK_SET);
-	mus_offset = mus_file.readUint16LE();
-	if (mus_file.ioFailed())
-		error("playSting: Can't read sting %d offset", a);
-
-	mus_file.seek(mus_offset, SEEK_SET);
-	midi.loadSMF(&mus_file, a, true);
-	midi.startTrack(0);
-}
-
-void AGOSEngine::set_volume(int volume) {
-	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
-}
-
 } // End of namespace AGOS
 
 #ifdef PALMOS_68K

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/agos.h	2006-10-21 01:51:59 UTC (rev 24397)
@@ -591,12 +591,6 @@
 
 	int runScript();
 
-	Item *getNextItemPtr();
-	uint getNextItemID();
-	uint getItem1ID() {return 1;}
-	Item *me();
-	Item *actor();
-
 	byte getByte();
 	int getNextWord();
 
@@ -608,13 +602,14 @@
 	void writeNextVarContents(uint16 contents);
 	void writeVariable(uint variable, uint16 contents);
 
-	void setItemParent(Item *item, Item *parent);
-
+	Item *derefItem(uint item);
+	Item *getNextItemPtr();
+	uint getNextItemID();
+	uint getItem1ID() {return 1;}
 	uint itemPtrToID(Item *id);
+	Item *me();
+	Item *actor();
 
-	Item *derefItem(uint item);
-	void setItemState(Item *item, int value);
-
 	void showMessageFormat(const char *s, ...);
 	const byte *getStringPtrByID(uint stringId);
 	const byte *getLocalStringByID(uint stringId);
@@ -623,6 +618,11 @@
 	void addTimeEvent(uint timeout, uint subroutine_id);
 	void delTimeEvent(TimeEvent *te);
 
+	Item *findInByClass(Item *i, int16 m);
+	Item *findMaster(int16 a, int16 n);
+	Item *nextMaster(Item *item, int16 a, int16 n);
+	int wordMatch(Item *item, int16 a, int16 n);
+
 	bool isRoom(Item *item);
 	bool isObject(Item *item);
 	bool isPlayer(Item *item);
@@ -631,6 +631,9 @@
 	void unlinkItem(Item *item);
 	void linkItem(Item *item, Item *parent);
 
+	void setItemParent(Item *item, Item *parent);
+	void setItemState(Item *item, int value);
+
 	void stopAnimateSimon1(uint a);
 	void stopAnimateSimon2(uint a, uint b);
 
@@ -660,6 +663,28 @@
 	TextLocation *getTextLocation(uint a);
 	void setup_cond_c_helper();
 
+	uint16 getBackExit(int n);
+	uint16 getDoorOf(Item *item, uint16 d);
+	uint16 getDoorState(Item *item, uint16 d);
+	uint16 getExitOf_e1(Item *item, uint16 d);
+	uint16 getExitOf(Item *item, uint16 d);
+	uint16 getExitState(Item *item, uint16 x, uint16 d);
+	void changeDoorState(SubRoom *r, uint16 d, uint16 n);
+	void setDoorState(Item *i, uint16 d, uint16 n);
+	void moveDirn_e1(Item *i, uint x);
+	void moveDirn_e2(Item *i, uint x);
+	void moveDirn_ww(Item *i, uint x);
+
+	int canPlace(Item *x, Item *y);
+	int contains(Item *a, Item *b);
+	int sizeContents(Item *x);
+	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);
+	void xPlace(Item *x, Item *y);
+
 	uint menuFor_e2(Item *item, uint id);
 	uint menuFor_ww(Item *item, uint id);
 	void clearMenuStrip();
@@ -764,8 +789,8 @@
 	void permitInput();
 
 	uint getFeebleFontSize(byte chr);
-	void showmessage_helper_3(uint a, uint b);
-	void showmessage_print_char(byte chr);
+	void justifyStart(uint a, uint b);
+	void justifyOutPut(byte chr);
 
 	void loadZone(uint zoneNum);
 
@@ -1051,37 +1076,6 @@
 	void o_unloadZone();
 	void o_unfreezeZones();
 
-	Item *findInByClass(Item *i, int16 m);
-	Item *findMaster(int16 a, int16 n);
-	Item *nextMaster(Item *item, int16 a, int16 n);
-	int16 levelOf(Item *item);
-	int wordMatch(Item *item, int16 a, int16 n);
-
-	uint16 getBackExit(int n);
-	uint16 getDoorOf(Item *item, uint16 d);
-	uint16 getDoorState(Item *item, uint16 d);
-	uint16 getExitOf_e1(Item *item, uint16 d);
-	uint16 getExitOf(Item *item, uint16 d);
-	uint16 getExitState(Item *item, uint16 x, uint16 d);
-	void changeDoorState(SubRoom *r, uint16 d, uint16 n);
-	void setDoorState(Item *i, uint16 d, uint16 n);
-	void moveDirn_e1(Item *i, uint x);
-	void moveDirn_e2(Item *i, uint x);
-	void moveDirn_ww(Item *i, uint x);
-
-	int contains(Item *a, Item *b);
-
-	int sizeContents(Item *x);
-	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);
-
-	int canPlace(Item *x, Item *y);
-	void xPlace(Item *x, Item *y);
-
 	// Opcodes, Elvira 1 only
 	void oe1_present();
 	void oe1_notPresent();
@@ -1277,7 +1271,7 @@
 	bool isSpriteLoaded(uint16 id, uint16 zoneNum);
 
 	void resetWindow(WindowBlock *window);
-	void delete_hitarea_by_index(uint index);
+	void freeBox(uint index);
 
 	void windowPutChar(uint a);
 
@@ -1310,16 +1304,16 @@
 	void animateSpritesDebug();
 	void animateSpritesByY();
 
-	void dx_clear_surfaces(uint num_lines);
-	void dx_update_screen_and_palette();
+	void clearSurfaces(uint num_lines);
+	void updateScreen();
 
 	void dumpVideoScript(const byte *src, bool one_opcode_only);
-	void dump_vga_file(const byte *vga);
-	void dump_vga_script(const byte *ptr, uint res, uint sprite_id);
-	void dump_vga_script_always(const byte *ptr, uint res, uint sprite_id);
-	void dump_vga_bitmaps(const byte *vga, byte *vga1, int res);
-	void dump_single_bitmap(int file, int image, const byte *offs, int w, int h, byte base);
-	void dump_bitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette, byte base);
+	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);
+	void dumpSingleBitmap(int file, int image, const byte *offs, int w, int h, byte base);
+	void dumpBitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette, byte base);
 
 	void clearBackFromTop(uint lines);
 	void fillFrontFromBack(uint x, uint y, uint w, uint h);
@@ -1343,8 +1337,8 @@
 	void openTextWindow();
 	void tidyIconArray(uint i);
 
-	void video_putchar_newline(WindowBlock *window);
-	void video_putchar_drawchar(WindowBlock *window, uint x, uint y, byte chr);
+	void windowNewLine(WindowBlock *window);
+	void windowDrawChar(WindowBlock *window, uint x, uint y, byte chr);
 
 	void loadMusic(uint music);
 	void checkTimerCallback();
@@ -1360,12 +1354,8 @@
 	void fastFadeIn();
 	void slowFadeIn();
 
-	void vc_kill_sprite(uint file, uint sprite);
+	void vcStopAnimation(uint file, uint sprite);
 
-	void set_dummy_cursor();
-
-	void set_volume(int volume);
-
 	void userGame(bool load);
 	void disableFileBoxes();
 	int userGameGetKey(bool *b, char *buf);

Modified: scummvm/trunk/engines/agos/animation.cpp
===================================================================
--- scummvm/trunk/engines/agos/animation.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/animation.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -148,7 +148,7 @@
 	} else {
 		uint8 palette[1024];
 		memset(palette, 0, sizeof(palette));
-		_vm->dx_clear_surfaces(480);
+		_vm->clearSurfaces(480);
 		_vm->_system->setPalette(palette, 0, 256);
 	}
 

Modified: scummvm/trunk/engines/agos/charset.cpp
===================================================================
--- scummvm/trunk/engines/agos/charset.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/charset.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -315,19 +315,27 @@
 		if (!_showMessageFlag) {
 			_windowArray[0] = _textWindow;
 			if (getGameType() == GType_FF || getGameType() == GType_PP)
-				showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+				justifyStart(_textWindow->textColumn, _textWindow->width);
 			else
-				showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+				justifyStart(_textWindow->textLength, _textWindow->textMaxLength);
 		}
 		_showMessageFlag = true;
 		_fcsData1[_curWindow] = 1;
 	}
 
 	for (str = buf; *str; str++)
-		showmessage_print_char(*str);
+		justifyOutPut(*str);
 }
 
-void AGOSEngine::showmessage_print_char(byte chr) {
+void AGOSEngine::justifyStart(uint a, uint b) {
+	_printCharCurPos = a;
+	_printCharMaxPos = b;
+	_printCharPixelCount = 0;
+	_numLettersToPrint = 0;
+	_newLines = 0;
+}
+
+void AGOSEngine::justifyOutPut(byte chr) {
 	if (chr == 12) {
 		_numLettersToPrint = 0;
 		_printCharCurPos = 0;
@@ -397,21 +405,13 @@
 		_textWindow = openWindow(8, 144, 24, 6, 1, 0, 15);
 }
 
-void AGOSEngine::showmessage_helper_3(uint a, uint b) {
-	_printCharCurPos = a;
-	_printCharMaxPos = b;
-	_printCharPixelCount = 0;
-	_numLettersToPrint = 0;
-	_newLines = 0;
-}
-
 void AGOSEngine::windowPutChar(WindowBlock *window, byte c, byte b) {
 	byte width = 6;
 
 	if (c == 12) {
 		clearWindow(window);
 	} else if (c == 13 || c == 10) {
-		video_putchar_newline(window);
+		windowNewLine(window);
 	} else if ((c == 1 && _language != Common::HB_ISR) || (c == 8)) {
 		if (_language == Common::HB_ISR) {
 			if (b >= 64 && b < 91)
@@ -439,15 +439,15 @@
 		}
 	} else if (c >= 32) {
 		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			video_putchar_drawchar(window, window->textColumn + window->x, window->textRow + window->y, c);
+			windowDrawChar(window, window->textColumn + window->x, window->textRow + window->y, c);
 			window->textColumn += feebleFontSize[c - 32];
 			return;
 		}
 
 		if (window->textLength == window->textMaxLength) {
-			video_putchar_newline(window);
+			windowNewLine(window);
 		} else if (window->textRow == window->height) {
-			video_putchar_newline(window);
+			windowNewLine(window);
 			window->textRow--;
 		}
 
@@ -459,10 +459,10 @@
 				window->textColumnOffset += 8;
 				window->textColumn++;
 			}
-			video_putchar_drawchar(window, (window->width + window->x - window->textColumn) * 8, window->textRow * 8 + window->y, c);
+			windowDrawChar(window, (window->width + window->x - window->textColumn) * 8, window->textRow * 8 + window->y, c);
 			window->textLength++;
 		} else {
-			video_putchar_drawchar(window, (window->textColumn + window->x) * 8, window->textRow * 8 + window->y, c);
+			windowDrawChar(window, (window->textColumn + window->x) * 8, window->textRow * 8 + window->y, c);
 
 			window->textLength++;
 			window->textColumnOffset += 6;
@@ -477,7 +477,7 @@
 	}
 }
 
-void AGOSEngine::video_putchar_newline(WindowBlock *window) {
+void AGOSEngine::windowNewLine(WindowBlock *window) {
 	if (getGameType() == GType_FF) {
 		if (_noOracleScroll == 0) {
 			if (window->height < window->textRow + 30) {
@@ -1530,7 +1530,7 @@
 	0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
-void AGOSEngine::video_putchar_drawchar(WindowBlock *window, uint x, uint y, byte chr) {
+void AGOSEngine::windowDrawChar(WindowBlock *window, uint x, uint y, byte chr) {
 	const byte *src;
 	byte color, *dst;
 	uint h, w, i;
@@ -1577,7 +1577,7 @@
 			src = video_font + (chr - 0x20) * 8;
 			break;
 		default:
-			error("video_putchar_drawchar: Unknown language %d\n", _language);
+			error("windowDrawChar: Unknown language %d\n", _language);
 		}
 	}
 

Modified: scummvm/trunk/engines/agos/debug.cpp
===================================================================
--- scummvm/trunk/engines/agos/debug.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/debug.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -272,7 +272,7 @@
 	} while (!one_opcode_only);
 }
 
-void AGOSEngine::dump_vga_file(const byte *vga) {
+void AGOSEngine::dumpVgaFile(const byte *vga) {
 	const byte *pp;
 	const byte *p;
 	int count;
@@ -284,7 +284,7 @@
 	while (--count >= 0) {
 		int id = READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->id);
 
-		dump_vga_script_always(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
+		dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const AnimationHeader_Simon *) p)->scriptOffs), id / 100, id);
 		p += sizeof(AnimationHeader_Simon);
 	}
 
@@ -296,7 +296,7 @@
 	while (--count >= 0) {
 		int id = READ_BE_UINT16(&((const ImageHeader_Simon *) p)->id);
 
-		dump_vga_script_always(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) p)->scriptOffs), id / 100, id);
+		dumpVgaScriptAlways(vga + READ_BE_UINT16(&((const ImageHeader_Simon *) p)->scriptOffs), id / 100, id);
 		p += sizeof(ImageHeader_Simon);
 	}
 }
@@ -320,7 +320,7 @@
 	0x00, 0x01, 0x00, 0x00,
 };
 
-void dump_bmp(const char *filename, int w, int h, const byte *bytes, const uint32 *palette) {
+void dumpBMP(const char *filename, int w, int h, const byte *bytes, const uint32 *palette) {
 	FILE *out = fopen(filename, "wb");
 	byte my_hdr[sizeof(bmp_hdr)];
 	int i;
@@ -355,7 +355,7 @@
 	fclose(out);
 }
 
-void AGOSEngine::dump_bitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette,
+void AGOSEngine::dumpBitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette,
 								 byte base) {
 
 	if (getGameType() != GType_FF && getGameType() != GType_PP)
@@ -391,11 +391,11 @@
 		}
 	}
 
-	dump_bmp(filename, w, h, b, (const uint32 *)palette);
+	dumpBMP(filename, w, h, b, (const uint32 *)palette);
 	free(b);
 }
 
-void AGOSEngine::dump_single_bitmap(int file, int image, const byte *offs, int w, int h, byte base) {
+void AGOSEngine::dumpSingleBitmap(int file, int image, const byte *offs, int w, int h, byte base) {
 	char buf[40];
 #if !defined(PALMOS_MODE) && !defined(__DC__) && !defined(__PSP__) && !defined(__PLAYSTATION2__)
 	struct stat statbuf;
@@ -412,10 +412,10 @@
 		return;
 #endif
 
-	dump_bitmap(buf, offs, w, h, 0, _displayPalette, base);
+	dumpBitmap(buf, offs, w, h, 0, _displayPalette, base);
 }
 
-void pal_load(byte *pal, const byte *vga1, int a, int b) {
+void palLoad(byte *pal, const byte *vga1, int a, int b) {
 	uint num = (a == 0) ? 0x20 : 0x10;
 	byte *palptr;
 	const byte *src;
@@ -434,7 +434,7 @@
 	} while (--num);
 }
 
-void AGOSEngine::dump_vga_bitmaps(const byte *vga, byte *vga1, int res) {
+void AGOSEngine::dumpVgaBitmaps(const byte *vga, byte *vga1, int res) {
 
 	int i;
 	uint32 offs;
@@ -442,10 +442,10 @@
 	byte pal[768];
 
 	memset(pal, 0, sizeof(pal));
-	pal_load(pal, vga1, 2, 0);
-	pal_load(pal, vga1, 3, 1);
-	pal_load(pal, vga1, 4, 2);
-	pal_load(pal, vga1, 5, 3);
+	palLoad(pal, vga1, 2, 0);
+	palLoad(pal, vga1, 3, 1);
+	palLoad(pal, vga1, 4, 2);
+	palLoad(pal, vga1, 5, 3);
 
 	int width, height, flags;
 
@@ -474,20 +474,20 @@
 		sprintf(buf, "dumps/Res%d_Image%d.bmp", res, i);
 #endif
 
-		dump_bitmap(buf, vga + offs, width, height, flags, pal, 0);
+		dumpBitmap(buf, vga + offs, width, height, flags, pal, 0);
 
 	}
 }
 
-void AGOSEngine::dump_vga_script_always(const byte *ptr, uint res, uint sprite_id) {
+void AGOSEngine::dumpVgaScriptAlways(const byte *ptr, uint res, uint sprite_id) {
 	printf("; address=%x, vgafile=%d  vgasprite=%d\n",
 					(unsigned int)(ptr - _vgaBufferPointers[res].vgaFile1), res, sprite_id);
 	dumpVideoScript(ptr, false);
 	printf("; end\n");
 }
 
-void AGOSEngine::dump_vga_script(const byte *ptr, uint res, uint sprite_id) {
-	dump_vga_script_always(ptr, res, sprite_id);
+void AGOSEngine::dumpVgaScript(const byte *ptr, uint res, uint sprite_id) {
+	dumpVgaScriptAlways(ptr, res, sprite_id);
 }
 
 } // End of namespace AGOS

Modified: scummvm/trunk/engines/agos/draw.cpp
===================================================================
--- scummvm/trunk/engines/agos/draw.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/draw.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -328,10 +328,10 @@
 			}
 		} while (ha++, --count);
 
-		dx_update_screen_and_palette();
+		updateScreen();
 		delay(100);
 		animateSprites();
-		dx_update_screen_and_palette();
+		updateScreen();
 		delay(100);
 	}
 
@@ -401,7 +401,7 @@
 	memset(_backBuf, 0, lines * _screenWidth);
 }
 
-void AGOSEngine::dx_clear_surfaces(uint num_lines) {
+void AGOSEngine::clearSurfaces(uint num_lines) {
 	memset(_backBuf, 0, num_lines * _screenWidth);
 
 	_system->copyRectToScreen(_backBuf, _screenWidth, 0, 0, _screenWidth, num_lines);
@@ -440,7 +440,7 @@
 	memcpy(_backGroundBuf, _backBuf, lines * _screenWidth);
 }
 
-void AGOSEngine::dx_update_screen_and_palette() {
+void AGOSEngine::updateScreen() {
 	if (_fastFadeInFlag == 0 && _paletteFlag == 1) {
 		_paletteFlag = 0;
 		if (memcmp(_displayPalette, _currentPalette, 1024)) {

Modified: scummvm/trunk/engines/agos/event.cpp
===================================================================
--- scummvm/trunk/engines/agos/event.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/event.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -528,7 +528,7 @@
 			}
 		}
 		handleMouseMoved();
-		dx_update_screen_and_palette();
+		updateScreen();
 		_updateScreen = false;
 	}
 

Modified: scummvm/trunk/engines/agos/gfx.cpp
===================================================================
--- scummvm/trunk/engines/agos/gfx.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/gfx.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -740,4 +740,24 @@
 	}
 }
 
+void AGOSEngine::paletteFadeOut(byte *palPtr, uint num, uint size) {
+	byte *p = palPtr;
+
+	do {
+		if (p[0] >= size)
+			p[0] -= size;
+		else
+			p[0] = 0;
+		if (p[1] >= size)
+			p[1] -= size;
+		else
+			p[1] = 0;
+		if (p[2] >= size)
+			p[2] -= size;
+		else
+			p[2] = 0;
+		p += 4;
+	} while (--num);
+}
+
 } // End of namespace AGOS

Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/icons.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -681,15 +681,15 @@
 	}
 
 	for (i = 0; window->iconPtr->iconArray[i].item != NULL; i++) {
-		delete_hitarea_by_index(window->iconPtr->iconArray[i].boxCode);
+		freeBox(window->iconPtr->iconArray[i].boxCode);
 	}
 
 	if (window->iconPtr->upArrow != -1) {
-		delete_hitarea_by_index(window->iconPtr->upArrow);
+		freeBox(window->iconPtr->upArrow);
 	}
 
 	if (window->iconPtr->downArrow != -1) {
-		delete_hitarea_by_index(window->iconPtr->downArrow);
+		freeBox(window->iconPtr->downArrow);
 		removeArrows(window, num);
 	}
 

Modified: scummvm/trunk/engines/agos/input.cpp
===================================================================
--- scummvm/trunk/engines/agos/input.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/input.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -371,14 +371,14 @@
 void AGOSEngine::permitInput() {
 	if (!_mortalFlag) {
 		_mortalFlag = true;
-		showmessage_print_char(0);
+		justifyOutPut(0);
 		_curWindow = 0;
 		if (_windowArray[0] != 0) {
 			_textWindow = _windowArray[0];
 			if (getGameType() == GType_FF || getGameType() == GType_PP)
-				showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+				justifyStart(_textWindow->textColumn, _textWindow->width);
 			else
-				showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+				justifyStart(_textWindow->textLength, _textWindow->textMaxLength);
 		}
 		_mortalFlag = false;
 	}
@@ -465,10 +465,10 @@
 				_speech ^= 1;
 		}
 	case '+':
-		midi.set_volume(midi.get_volume() + 16);
+		midi.setVolume(midi.getVolume() + 16);
 		break;
 	case '-':
-		midi.set_volume(midi.get_volume() - 16);
+		midi.setVolume(midi.getVolume() - 16);
 		break;
 	case 'm':
 		midi.pause(_musicPaused ^= 1);

Modified: scummvm/trunk/engines/agos/midi.cpp
===================================================================
--- scummvm/trunk/engines/agos/midi.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/midi.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -255,7 +255,7 @@
 	}
 }
 
-void MidiPlayer::set_volume(int volume) {
+void MidiPlayer::setVolume(int volume) {
 	if (volume < 0)
 		volume = 0;
 	else if (volume > 255)
@@ -277,7 +277,7 @@
 	}
 }
 
-void MidiPlayer::set_driver(MidiDriver *md) {
+void MidiPlayer::setDriver(MidiDriver *md) {
 	// Don't try to set this more than once.
 	if (_driver)
 		return;

Modified: scummvm/trunk/engines/agos/midi.h
===================================================================
--- scummvm/trunk/engines/agos/midi.h	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/midi.h	2006-10-21 01:51:59 UTC (rev 24397)
@@ -101,9 +101,9 @@
 	void stop();
 	void pause(bool b);
 
-	int  get_volume() { return _masterVolume; }
-	void set_volume(int volume);
-	void set_driver(MidiDriver *md);
+	int  getVolume() { return _masterVolume; }
+	void setVolume(int volume);
+	void setDriver(MidiDriver *md);
 
 public:
 	// MidiDriver interface implementation

Modified: scummvm/trunk/engines/agos/module.mk
===================================================================
--- scummvm/trunk/engines/agos/module.mk	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/module.mk	2006-10-21 01:51:59 UTC (rev 24397)
@@ -21,6 +21,7 @@
 	oracle.o \
 	res.o \
 	res_ami.o \
+	res_snd.o \
 	rooms.o \
 	saveload.o \
 	script.o \

Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/res.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -756,201 +756,4 @@
 	}
 }
 
-static const byte elvira1_soundTable[100] = {
-	0, 2, 0, 1, 0, 0, 0, 0, 0, 3,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 6, 4, 0, 0, 9, 0,
-	0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 8, 0, 0, 0, 0, 0, 0, 0, 0,
-	1, 1, 0, 0, 5, 0, 6, 6, 0, 0,
-	0, 5, 0, 0, 6, 0, 0, 0, 0, 8,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-};
-
-bool AGOSEngine::loadVGASoundFile(uint id, uint type) {
-	File in;
-	char filename[15];
-	byte *dst;
-	uint32 srcSize, dstSize;
-
-	if (getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformAtariST) {
-		if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) {
-			if (id == 20)
-				sprintf(filename, "D%d.out", type);
-			else if (id == 26)
-				sprintf(filename, "J%d.out", type);
-			else if (id == 27)
-				sprintf(filename, "K%d.out", type);
-			else if (id == 33)
-				sprintf(filename, "Q%d.out", type);
-			else if (id == 34)
-				sprintf(filename, "R%d.out", type);
-			else
-				sprintf(filename, "%.1d%d.out", id, type);
-		} else if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) {
-			sprintf(filename, "%.2d%d.out", id, type);
-		} else {
-			sprintf(filename, "%.3d%d.out", id, type);
-		}
-	} else {
-		if (getGameType() == GType_ELVIRA1) {
-			if (elvira1_soundTable[id] == 0)
-				return false;
-
-			sprintf(filename, "%.2d.SND", elvira1_soundTable[id]);
-		} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
-			sprintf(filename, "%.2d%d.VGA", id, type);
-		} else {
-			sprintf(filename, "%.3d%d.VGA", id, type);
-		}
-	}
-
-	in.open(filename);
-	if (in.isOpen() == false || in.size() == 0) {
-		return false;
-	}
-
-	dstSize = srcSize = in.size();
-	if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) {
-		byte *srcBuffer = (byte *)malloc(srcSize);
-		if (in.read(srcBuffer, srcSize) != srcSize)
-			error("loadVGASoundFile: Read failed");
-
-		dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
-		dst = allocBlock (dstSize);
-		decrunchFile(srcBuffer, dst, srcSize);
-		free(srcBuffer);
-	} else {
-		dst = allocBlock(dstSize);
-		if (in.read(dst, dstSize) != dstSize)
-			error("loadVGASoundFile: Read failed");
-	}
-	in.close();
-
-	return true;
-}
-
-static const char *dimpSoundList[32] = {
-	"Beep",
-	"Birth",
-	"Boiling",
-	"Burp",
-	"Cough",
-	"Die1",
-	"Die2",
-	"Fart",
-	"Inject",
-	"Killchik",
-	"Puke",
-	"Lights",
-	"Shock",
-	"Snore",
-	"Snotty",
-	"Whip",
-	"Whistle",
-	"Work1",
-	"Work2",
-	"Yawn",
-	"And0w",
-	"And0x",
-	"And0y",
-	"And0z",
-	"And10",
-	"And11",
-	"And12",
-	"And13",
-	"And14",
-	"And15",
-	"And16",
-	"And17",
-};
-
-
-void AGOSEngine::loadSound(uint sound, int pan, int vol, uint type) {
-	byte *dst;
-
-	if (getGameId() == GID_DIMP) {
-		File in;
-		char filename[15];
-
-		assert(sound >= 1 && sound <= 32);
-		sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
-
-		in.open(filename);
-		if (in.isOpen() == false)
-			error("loadSound: Can't load %s", filename);
-
-		uint32 dstSize = in.size();
-		dst = (byte *)malloc(dstSize);
-		if (in.read(dst, dstSize) != dstSize)
-			error("loadSound: Read failed");
-		in.close();
-	} else if (getFeatures() & GF_ZLIBCOMP) {
-		char filename[15];
-
-		uint32 file, offset, srcSize, dstSize;
-		if (getPlatform() == Common::kPlatformAmiga) {
-			loadOffsets((const char*)"sfxindex.dat", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
-		} else {
-			loadOffsets((const char*)"effects.wav", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
-		}
-
-		if (getPlatform() == Common::kPlatformAmiga)
-			sprintf(filename, "sfx%d.wav", file);
-		else
-			sprintf(filename, "effects.wav");
-
-		dst = (byte *)malloc(dstSize);
-		decompressData(filename, dst, offset, srcSize, dstSize);
-	} else {
-		if (!_curSfxFile)
-			error("loadSound: Can't load sound data file '%d3.VGA'", _zoneNumber);
-
-		dst = _curSfxFile + READ_LE_UINT32(_curSfxFile + sound * 4);
-	}
-
-	if (type == 3)
-		_sound->playSfx5Data(dst, sound, pan, vol);
-	else if (type == 2)
-		_sound->playAmbientData(dst, sound, pan, vol);
-	else
-		_sound->playSfxData(dst, sound, pan, vol);
-}
-
-void AGOSEngine::loadVoice(uint speechId) {
-	if (getGameType() == GType_PP && speechId == 99) {
-		_sound->stopVoice();
-		return;
-	}
-
-	if (getFeatures() & GF_ZLIBCOMP) {
-		char filename[15];
-
-		uint32 file, offset, srcSize, dstSize;
-		if (getPlatform() == Common::kPlatformAmiga) {
-			loadOffsets((const char*)"spindex.dat", speechId, file, offset, srcSize, dstSize);
-		} else {
-			loadOffsets((const char*)"speech.wav", speechId, file, offset, srcSize, dstSize);
-		}
-
-		// Voice segment doesn't exist
-		if (offset == 0xFFFFFFFF && srcSize == 0xFFFFFFFF && dstSize == 0xFFFFFFFF) {
-			debug(0, "loadVoice: speechId %d removed", speechId);
-			return;
-		}
-
-		if (getPlatform() == Common::kPlatformAmiga)
-			sprintf(filename, "sp%d.wav", file);
-		else
-			sprintf(filename, "speech.wav");
-
-		byte *dst = (byte *)malloc(dstSize);
-		decompressData(filename, dst, offset, srcSize, dstSize);
-		_sound->playVoiceData(dst, speechId);
-	} else {
-		_sound->playVoice(speechId);
-	}
-}
-
 } // End of namespace AGOS

Added: scummvm/trunk/engines/agos/res_snd.cpp
===================================================================
--- scummvm/trunk/engines/agos/res_snd.cpp	                        (rev 0)
+++ scummvm/trunk/engines/agos/res_snd.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -0,0 +1,443 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001  Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+
+#include "common/config-manager.h"
+#include "common/file.h"
+
+#include "agos/intern.h"
+#include "agos/agos.h"
+#include "agos/vga.h"
+
+#include "sound/mididrv.h"
+#include "sound/mods/protracker.h"
+
+using Common::File;
+
+namespace AGOS {
+
+void AGOSEngine::playSpeech(uint speech_id, uint vgaSpriteId) {
+	if (getGameType() == GType_SIMON1) {
+		if (speech_id == 9999) {
+			if (_subtitles)
+				return;
+			if (!getBitFlag(14) && !getBitFlag(28)) {
+				setBitFlag(14, true);
+				_variableArray[100] = 15;
+				animate(4, 1, 130, 0, 0, 0);
+				waitForSync(130);
+			}
+			_skipVgaWait = true;
+		} else {
+			if (_subtitles && _scriptVar2) {
+				animate(4, 2, 204, 0, 0, 0);
+				waitForSync(204);
+				stopAnimateSimon1(204);
+			}
+			stopAnimateSimon1(vgaSpriteId + 201);
+			loadVoice(speech_id);
+			animate(4, 2, vgaSpriteId + 201, 0, 0, 0);
+		}
+	} else {
+		if (speech_id == 0xFFFF) {
+			if (_subtitles)
+				return;
+			if (!getBitFlag(14) && !getBitFlag(28)) {
+				setBitFlag(14, true);
+				_variableArray[100] = 5;
+				animate(4, 1, 30, 0, 0, 0);
+				waitForSync(130);
+			}
+			_skipVgaWait = true;
+		} else {
+			if (getGameType() == GType_SIMON2 && _subtitles && _language != Common::HB_ISR) {
+				loadVoice(speech_id);
+				return;
+			}
+
+			if (_subtitles && _scriptVar2) {
+				animate(4, 2, 5, 0, 0, 0);
+				waitForSync(205);
+				stopAnimateSimon2(2,5);
+			}
+
+			stopAnimateSimon2(2, vgaSpriteId + 2);
+			loadVoice(speech_id);
+			animate(4, 2, vgaSpriteId + 2, 0, 0, 0);
+		}
+	}
+}
+
+void AGOSEngine::skipSpeech() {
+	_sound->stopVoice();
+	if (!getBitFlag(28)) {
+		setBitFlag(14, true);
+		if (getGameType() == GType_FF) {
+			_variableArray[103] = 5;
+			animate(4, 2, 13, 0, 0, 0);
+			waitForSync(213);
+			stopAnimateSimon2(2, 1);
+		} else if (getGameType() == GType_SIMON2) {
+			_variableArray[100] = 5;
+			animate(4, 1, 30, 0, 0, 0);
+			waitForSync(130);
+			stopAnimateSimon2(2, 1);
+		} else {
+			_variableArray[100] = 15;
+			animate(4, 1, 130, 0, 0, 0);
+			waitForSync(130);
+			stopAnimateSimon1(1);
+		}
+	}
+}
+
+void AGOSEngine::loadMusic(uint music) {
+	char buf[4];
+
+	if (getPlatform() == Common::kPlatformAtariST) {
+		// TODO: Add support for music format used by Elvira 2
+	} else if (getPlatform() == Common::kPlatformAmiga) {
+		_modPlayer->stop();
+
+		char filename[15];
+		File f;
+
+		if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO)
+			sprintf(filename, "elvira2");
+		else
+			sprintf(filename, "%dtune", music);
+
+		f.open(filename);
+		if (f.isOpen() == false) {
+			error("loadMusic: Can't load module from '%s'", filename);
+		}
+
+		if (!(getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) &&
+			getFeatures() & GF_CRUNCHED) {
+			uint srcSize = f.size();
+			byte *srcBuf = (byte *)malloc(srcSize);
+			if (f.read(srcBuf, srcSize) != srcSize)
+				error("loadMusic: Read failed");
+
+			uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
+			byte *dstBuf = (byte *)malloc(dstSize);
+			decrunchFile(srcBuf, dstBuf, srcSize);
+			free(srcBuf);
+
+			Common::MemoryReadStream stream(dstBuf, dstSize);
+			_modPlayer->loadModuleStream(stream);
+		} else {
+			_modPlayer->loadModuleStream(f);
+		}
+		_modPlayer->start();
+	} else if (getGameType() == GType_SIMON2) {
+		midi.stop();
+		_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
+		_gameFile->read(buf, 4);
+		if (!memcmp(buf, "FORM", 4)) {
+			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
+			midi.loadXMIDI (_gameFile);
+		} else {
+			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music - 1], SEEK_SET);
+			midi.loadMultipleSMF (_gameFile);
+		}
+
+		_lastMusicPlayed = music;
+		_nextMusicToPlay = -1;
+	} else if (getGameType() == GType_SIMON1) {
+		midi.stop();
+		midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
+
+		if (getFeatures() & GF_TALKIE) {
+			// FIXME: The very last music resource, a cymbal crash for when the
+			// two demons crash into each other, should NOT be looped like the
+			// other music tracks. In simon1dos/talkie the GMF resource includes
+			// a loop override that acomplishes this, but there seems to be nothing
+			// for this in the SMF resources.
+			if (music == 35)
+				midi.setLoop (false);
+
+			_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
+			_gameFile->read(buf, 4);
+			if (!memcmp(buf, "GMF\x1", 4)) {
+				_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
+				midi.loadSMF (_gameFile, music);
+			} else {
+				_gameFile->seek(_gameOffsetsPtr[_musicIndexBase + music], SEEK_SET);
+				midi.loadMultipleSMF (_gameFile);
+			}
+
+		} else {
+			char filename[15];
+			File f;
+			sprintf(filename, "MOD%d.MUS", music);
+			f.open(filename);
+			if (f.isOpen() == false)
+				error("loadMusic: Can't load music from '%s'", filename);
+
+			if (getFeatures() & GF_DEMO)
+				midi.loadS1D (&f);
+			else
+				midi.loadSMF (&f, music);
+		}
+
+		midi.startTrack (0);
+	} else {
+		midi.stop();
+		midi.setLoop (true); // Must do this BEFORE loading music.
+
+		char filename[15];
+		File f;
+		sprintf(filename, "MOD%d.MUS", music);
+		f.open(filename);
+		if (f.isOpen() == false)
+			error("loadMusic: Can't load music from '%s'", filename);
+
+		midi.loadS1D (&f);
+		midi.startTrack (0);
+	}
+}
+
+void AGOSEngine::playSting(uint a) {
+	if (!midi._enable_sfx)
+		return;
+
+	char filename[15];
+
+	File mus_file;
+	uint16 mus_offset;
+
+	sprintf(filename, "STINGS%i.MUS", _soundFileId);
+	mus_file.open(filename);
+	if (!mus_file.isOpen())
+		error("playSting: Can't load sound effect from '%s'", filename);
+
+	mus_file.seek(a * 2, SEEK_SET);
+	mus_offset = mus_file.readUint16LE();
+	if (mus_file.ioFailed())
+		error("playSting: Can't read sting %d offset", a);
+
+	mus_file.seek(mus_offset, SEEK_SET);
+	midi.loadSMF(&mus_file, a, true);
+	midi.startTrack(0);
+}
+
+static const byte elvira1_soundTable[100] = {
+	0, 2, 0, 1, 0, 0, 0, 0, 0, 3,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 6, 4, 0, 0, 9, 0,
+	0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 8, 0, 0, 0, 0, 0, 0, 0, 0,
+	1, 1, 0, 0, 5, 0, 6, 6, 0, 0,
+	0, 5, 0, 0, 6, 0, 0, 0, 0, 8,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+bool AGOSEngine::loadVGASoundFile(uint id, uint type) {
+	File in;
+	char filename[15];
+	byte *dst;
+	uint32 srcSize, dstSize;
+
+	if (getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformAtariST) {
+		if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) {
+			if (id == 20)
+				sprintf(filename, "D%d.out", type);
+			else if (id == 26)
+				sprintf(filename, "J%d.out", type);
+			else if (id == 27)
+				sprintf(filename, "K%d.out", type);
+			else if (id == 33)
+				sprintf(filename, "Q%d.out", type);
+			else if (id == 34)
+				sprintf(filename, "R%d.out", type);
+			else
+				sprintf(filename, "%.1d%d.out", id, type);
+		} else if (getGameType() == GType_ELVIRA1 || getGameType() == GType_ELVIRA2) {
+			sprintf(filename, "%.2d%d.out", id, type);
+		} else {
+			sprintf(filename, "%.3d%d.out", id, type);
+		}
+	} else {
+		if (getGameType() == GType_ELVIRA1) {
+			if (elvira1_soundTable[id] == 0)
+				return false;
+
+			sprintf(filename, "%.2d.SND", elvira1_soundTable[id]);
+		} else if (getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) {
+			sprintf(filename, "%.2d%d.VGA", id, type);
+		} else {
+			sprintf(filename, "%.3d%d.VGA", id, type);
+		}
+	}
+
+	in.open(filename);
+	if (in.isOpen() == false || in.size() == 0) {
+		return false;
+	}
+
+	dstSize = srcSize = in.size();
+	if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) {
+		byte *srcBuffer = (byte *)malloc(srcSize);
+		if (in.read(srcBuffer, srcSize) != srcSize)
+			error("loadVGASoundFile: Read failed");
+
+		dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
+		dst = allocBlock (dstSize);
+		decrunchFile(srcBuffer, dst, srcSize);
+		free(srcBuffer);
+	} else {
+		dst = allocBlock(dstSize);
+		if (in.read(dst, dstSize) != dstSize)
+			error("loadVGASoundFile: Read failed");
+	}
+	in.close();
+
+	return true;
+}
+
+static const char *dimpSoundList[32] = {
+	"Beep",
+	"Birth",
+	"Boiling",
+	"Burp",
+	"Cough",
+	"Die1",
+	"Die2",
+	"Fart",
+	"Inject",
+	"Killchik",
+	"Puke",
+	"Lights",
+	"Shock",
+	"Snore",
+	"Snotty",
+	"Whip",
+	"Whistle",
+	"Work1",
+	"Work2",
+	"Yawn",
+	"And0w",
+	"And0x",
+	"And0y",
+	"And0z",
+	"And10",
+	"And11",
+	"And12",
+	"And13",
+	"And14",
+	"And15",
+	"And16",
+	"And17",
+};
+
+
+void AGOSEngine::loadSound(uint sound, int pan, int vol, uint type) {
+	byte *dst;
+
+	if (getGameId() == GID_DIMP) {
+		File in;
+		char filename[15];
+
+		assert(sound >= 1 && sound <= 32);
+		sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
+
+		in.open(filename);
+		if (in.isOpen() == false)
+			error("loadSound: Can't load %s", filename);
+
+		uint32 dstSize = in.size();
+		dst = (byte *)malloc(dstSize);
+		if (in.read(dst, dstSize) != dstSize)
+			error("loadSound: Read failed");
+		in.close();
+	} else if (getFeatures() & GF_ZLIBCOMP) {
+		char filename[15];
+
+		uint32 file, offset, srcSize, dstSize;
+		if (getPlatform() == Common::kPlatformAmiga) {
+			loadOffsets((const char*)"sfxindex.dat", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
+		} else {
+			loadOffsets((const char*)"effects.wav", _zoneNumber * 22 + sound, file, offset, srcSize, dstSize);
+		}
+
+		if (getPlatform() == Common::kPlatformAmiga)
+			sprintf(filename, "sfx%d.wav", file);
+		else
+			sprintf(filename, "effects.wav");
+
+		dst = (byte *)malloc(dstSize);
+		decompressData(filename, dst, offset, srcSize, dstSize);
+	} else {
+		if (!_curSfxFile)
+			error("loadSound: Can't load sound data file '%d3.VGA'", _zoneNumber);
+
+		dst = _curSfxFile + READ_LE_UINT32(_curSfxFile + sound * 4);
+	}
+
+	if (type == 3)
+		_sound->playSfx5Data(dst, sound, pan, vol);
+	else if (type == 2)
+		_sound->playAmbientData(dst, sound, pan, vol);
+	else
+		_sound->playSfxData(dst, sound, pan, vol);
+}
+
+void AGOSEngine::loadVoice(uint speechId) {
+	if (getGameType() == GType_PP && speechId == 99) {
+		_sound->stopVoice();
+		return;
+	}
+
+	if (getFeatures() & GF_ZLIBCOMP) {
+		char filename[15];
+
+		uint32 file, offset, srcSize, dstSize;
+		if (getPlatform() == Common::kPlatformAmiga) {
+			loadOffsets((const char*)"spindex.dat", speechId, file, offset, srcSize, dstSize);
+		} else {
+			loadOffsets((const char*)"speech.wav", speechId, file, offset, srcSize, dstSize);
+		}
+
+		// Voice segment doesn't exist
+		if (offset == 0xFFFFFFFF && srcSize == 0xFFFFFFFF && dstSize == 0xFFFFFFFF) {
+			debug(0, "loadVoice: speechId %d removed", speechId);
+			return;
+		}
+
+		if (getPlatform() == Common::kPlatformAmiga)
+			sprintf(filename, "sp%d.wav", file);
+		else
+			sprintf(filename, "speech.wav");
+
+		byte *dst = (byte *)malloc(dstSize);
+		decompressData(filename, dst, offset, srcSize, dstSize);
+		_sound->playVoiceData(dst, speechId);
+	} else {
+		_sound->playVoice(speechId);
+	}
+}
+
+} // End of namespace AGOS


Property changes on: scummvm/trunk/engines/agos/res_snd.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/agos/script.cpp
===================================================================
--- scummvm/trunk/engines/agos/script.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/script.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -724,9 +724,9 @@
 	if (num == _curWindow) {
 		_textWindow = _windowArray[num];
 		if (getGameType() == GType_FF || getGameType() == GType_PP)
-			showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+			justifyStart(_textWindow->textColumn, _textWindow->width);
 		else
-			showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+			justifyStart(_textWindow->textLength, _textWindow->textMaxLength);
 	}
 }
 
@@ -1506,17 +1506,6 @@
 	}
 }
 
-void AGOSEngine::freezeBottom() {
-	_vgaMemBase = _vgaMemPtr;
-	_vgaFrozenBase = _vgaMemPtr;
-}
-
-void AGOSEngine::unfreezeBottom() {
-	_vgaMemPtr = _vgaRealBase;
-	_vgaMemBase = _vgaRealBase;
-	_vgaFrozenBase = _vgaRealBase;
-}
-
 void AGOSEngine::sendSync(uint a) {
 	uint16 id = to16Wrapper(a);
 	_lockWord |= 0x8000;
@@ -1552,12 +1541,4 @@
 	_lockWord &= ~0x8000;
 }
 
-int16 AGOSEngine::levelOf(Item *item) {
-	SubPlayer *p = (SubPlayer *) findChildOfType(item, 3);
-	if (p == NULL)
-		return 0;
-
-	return p->level;
-}
-
 } // End of namespace AGOS

Modified: scummvm/trunk/engines/agos/string.cpp
===================================================================
--- scummvm/trunk/engines/agos/string.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/string.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -726,11 +726,11 @@
 	_textWindow->textRow = 0;
 	_textWindow->textColumnOffset = 0;
 	_textWindow->textLength = 0;
-	showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+	justifyStart(_textWindow->textLength, _textWindow->textMaxLength);
 	waitForSync(99);
 	BoxBufferPtr = _boxBuffer;
 	while (*BoxBufferPtr)
-		showmessage_print_char(*BoxBufferPtr++);
+		justifyOutPut(*BoxBufferPtr++);
 	_boxLineCount = 0;
 	BoxBufferPtr = _boxBuffer;
 	_lineCounts[0] = 0;
@@ -844,13 +844,13 @@
 	// Clear background of first digit
 	window->textColumnOffset = offs;
 	window->text_color = 0;
-	video_putchar_drawchar(window, x * 8, y, 129);
+	windowDrawChar(window, x * 8, y, 129);
 
 	if (val != -1) {
 		// Print first digit
 		chr = val / 10 + 48;
 		window->text_color = 15;
-		video_putchar_drawchar(window, x * 8, y, chr);
+		windowDrawChar(window, x * 8, y, chr);
 	}
 
 	offs += 6;
@@ -862,13 +862,13 @@
 	// Clear background of second digit
 	window->textColumnOffset = offs;
 	window->text_color = 0;
-	video_putchar_drawchar(window, x * 8, y, 129);
+	windowDrawChar(window, x * 8, y, 129);
 
 	if (val != -1) {
 		// Print second digit
 		chr = val % 10 + 48;
 		window->text_color = 15;
-		video_putchar_drawchar(window, x * 8, y, chr);
+		windowDrawChar(window, x * 8, y, chr);
 	}
 }
 

Modified: scummvm/trunk/engines/agos/verb.cpp
===================================================================
--- scummvm/trunk/engines/agos/verb.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/verb.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -393,7 +393,7 @@
 	return NULL;
 }
 
-void AGOSEngine::delete_hitarea_by_index(uint index) {
+void AGOSEngine::freeBox(uint index) {
 	CHECK_BOUNDS(index, _hitAreas);
 	_hitAreas[index].flags = 0;
 }

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/vga.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -641,7 +641,7 @@
 		return;
 
 	if (_dumpImages)
-		dump_single_bitmap(_vgaCurZoneNum, state.image, state.depack_src, width, height,
+		dumpSingleBitmap(_vgaCurZoneNum, state.image, state.depack_src, width, height,
 											 state.palette);
 	// Check if image is compressed
 	if (getGameType() == GType_FF || getGameType() == GType_PP) {
@@ -1443,7 +1443,7 @@
 	vcSkipNextInstruction();
 }
 
-void AGOSEngine::vc_kill_sprite(uint file, uint sprite) {
+void AGOSEngine::vcStopAnimation(uint file, uint sprite) {
 	uint16 old_sprite_id, old_cur_file_id;
 	VgaSleepStruct *vfs;
 	VgaSprite *vsp;
@@ -1502,7 +1502,7 @@
 		sprite = vcReadNextWord();
 	}
 
-	vc_kill_sprite(zoneNum, sprite);
+	vcStopAnimation(zoneNum, sprite);
 }
 
 void AGOSEngine::vc61() {
@@ -1634,11 +1634,11 @@
 		// Allow one section of Simon the Sorcerer 1 introduction to be displayed
 		// in lower half of screen
 		if ((getGameType() == GType_SIMON1) && (_subroutine == 2923 || _subroutine == 2926)) {
-			dx_clear_surfaces(200);
+			clearSurfaces(200);
 		} else if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			dx_clear_surfaces(480);
+			clearSurfaces(480);
 		} else {
-			dx_clear_surfaces(_windowNum == 4 ? 134 : 200);
+			clearSurfaces(_windowNum == 4 ? 134 : 200);
 		}
 	}
 	if (getGameType() == GType_SIMON2) {
@@ -1761,7 +1761,7 @@
 		static bool dumped = false;
 		if (res == DUMP_FILE_NR && !dumped) {
 			dumped = true;
-			dump_vga_file(_curVgaFile1);
+			dumpVgaFile(_curVgaFile1);
 		}
 	}
 #endif
@@ -1771,18 +1771,18 @@
 		static bool dumped = false;
 		if (res == DUMP_BITMAPS_FILE_NR && !dumped) {
 			dumped = true;
-			dump_vga_bitmaps(_curVgaFile2, _curVgaFile1, zoneNum);
+			dumpVgaBitmaps(_curVgaFile2, _curVgaFile1, zoneNum);
 		}
 	}
 #endif
 
 	if (_startVgaScript) {
 		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble*)p)->scriptOffs), zoneNum, vgaSpriteId);
+			dumpVgaScript(_curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble*)p)->scriptOffs), zoneNum, vgaSpriteId);
 		} else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
-			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_Simon*)p)->scriptOffs), zoneNum, vgaSpriteId);
+			dumpVgaScript(_curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_Simon*)p)->scriptOffs), zoneNum, vgaSpriteId);
 		} else {
-			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_WW*)p)->scriptOffs), zoneNum, vgaSpriteId);
+			dumpVgaScript(_curVgaFile1 + READ_BE_UINT16(&((AnimationHeader_WW*)p)->scriptOffs), zoneNum, vgaSpriteId);
 		}
 	}
 
@@ -1872,11 +1872,11 @@
 
 	if (_startVgaScript) {
 		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			dump_vga_script(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), zoneNum, vga_res_id);
+			dumpVgaScript(_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), zoneNum, vga_res_id);
+			dumpVgaScript(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_Simon*)b)->scriptOffs), zoneNum, vga_res_id);
 		} else {
-			dump_vga_script(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), zoneNum, vga_res_id);
+			dumpVgaScript(_curVgaFile1 + READ_BE_UINT16(&((ImageHeader_WW*)b)->scriptOffs), zoneNum, vga_res_id);
 		}
 	}
 

Modified: scummvm/trunk/engines/agos/vga_s2.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_s2.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/vga_s2.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -81,7 +81,7 @@
 	uint16 end = vcReadNextWord() + 1;
 
 	do {
-		vc_kill_sprite(file, start);
+		vcStopAnimation(file, start);
 	} while (++start != end);
 }
 

Modified: scummvm/trunk/engines/agos/window.cpp
===================================================================
--- scummvm/trunk/engines/agos/window.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/window.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -76,13 +76,13 @@
 		return;
 
 	_curWindow = a;
-	showmessage_print_char(0);
+	justifyOutPut(0);
 	_textWindow = _windowArray[a];
 
 	if (getGameType() == GType_FF || getGameType() == GType_PP)
-		showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+		justifyStart(_textWindow->textColumn, _textWindow->width);
 	else
-		showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+		justifyStart(_textWindow->textLength, _textWindow->textMaxLength);
 }
 
 void AGOSEngine::closeWindow(uint a) {

Modified: scummvm/trunk/engines/agos/zones.cpp
===================================================================
--- scummvm/trunk/engines/agos/zones.cpp	2006-10-21 00:51:32 UTC (rev 24396)
+++ scummvm/trunk/engines/agos/zones.cpp	2006-10-21 01:51:59 UTC (rev 24397)
@@ -31,6 +31,17 @@
 
 namespace AGOS {
 
+void AGOSEngine::freezeBottom() {
+	_vgaMemBase = _vgaMemPtr;
+	_vgaFrozenBase = _vgaMemPtr;
+}
+
+void AGOSEngine::unfreezeBottom() {
+	_vgaMemPtr = _vgaRealBase;
+	_vgaMemBase = _vgaRealBase;
+	_vgaFrozenBase = _vgaRealBase;
+}
+
 void AGOSEngine::loadZone(uint zoneNum) {
 	VgaPointersEntry *vpe;
 


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