[Scummvm-cvs-logs] SF.net SVN: scummvm: [31425] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun Apr 6 16:11:43 CEST 2008
Revision: 31425
http://scummvm.svn.sourceforge.net/scummvm/?rev=31425&view=rev
Author: lordhoto
Date: 2008-04-06 07:11:43 -0700 (Sun, 06 Apr 2008)
Log Message:
-----------
Implemented opcode 33 o2_loadSoundfile.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/kyra_v2.h
scummvm/trunk/engines/kyra/script_v2.cpp
scummvm/trunk/engines/kyra/sound.cpp
scummvm/trunk/engines/kyra/sound.h
Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h 2008-04-06 13:57:28 UTC (rev 31424)
+++ scummvm/trunk/engines/kyra/kyra_v2.h 2008-04-06 14:11:43 UTC (rev 31425)
@@ -950,6 +950,7 @@
int o2_drawShape(ScriptState *script);
int o2_addItemToCurScene(ScriptState *script);
int o2_checkForItem(ScriptState *script);
+ int o2_loadSoundFile(ScriptState *script);
int o2_removeItemSlotFromInventory(ScriptState *script);
int o2_defineItem(ScriptState *script);
int o2_removeItemFromInventory(ScriptState *script);
Modified: scummvm/trunk/engines/kyra/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v2.cpp 2008-04-06 13:57:28 UTC (rev 31424)
+++ scummvm/trunk/engines/kyra/script_v2.cpp 2008-04-06 14:11:43 UTC (rev 31425)
@@ -456,6 +456,13 @@
return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1;
}
+int KyraEngine_v2::o2_loadSoundFile(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_loadSoundFile(%p) (%d)", (const void *)script, stackPos(0));
+ if (_sound->hasTrack(stackPos(0)))
+ snd_playTheme(stackPos(0));
+ return 0;
+}
+
int KyraEngine_v2::o2_removeItemSlotFromInventory(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeItemSlotFromInventory(%p) (%d)", (const void *)script, stackPos(0));
removeItemFromInventory(stackPos(0));
@@ -1839,7 +1846,7 @@
OpcodeUnImpl(),
// 0x20
Opcode(o2_checkForItem),
- OpcodeUnImpl(),
+ Opcode(o2_loadSoundFile),
Opcode(o2_removeItemSlotFromInventory),
Opcode(o2_defineItem),
// 0x24
Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp 2008-04-06 13:57:28 UTC (rev 31424)
+++ scummvm/trunk/engines/kyra/sound.cpp 2008-04-06 14:11:43 UTC (rev 31425)
@@ -489,6 +489,9 @@
void KyraEngine::snd_playTheme(int file, int track) {
debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playTheme(%d)", file);
+ if (_curMusicTheme == file)
+ return;
+
_curSfxFile = _curMusicTheme = file;
_sound->loadSoundFile(_curMusicTheme);
_sound->playTrack(track);
Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h 2008-04-06 13:57:28 UTC (rev 31424)
+++ scummvm/trunk/engines/kyra/sound.h 2008-04-06 14:11:43 UTC (rev 31425)
@@ -105,6 +105,14 @@
virtual void setSoundList(const AudioDataStruct *list) { _soundDataList = list; }
/**
+ * Checks if a given sound file is present
+ *
+ * @param track track number
+ * @return true if available, false otherwise
+ */
+ virtual bool hasTrack(uint file) { return (fileListEntry(file) != 0); }
+
+ /**
* Load a specifc sound file for use of
* playing music and sound effects.
*/
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