diff --git a/engines/grim/emi/lua_v2.h b/engines/grim/emi/lua_v2.h index c38f7b38bc9..401490341d5 100644 --- a/engines/grim/emi/lua_v2.h +++ b/engines/grim/emi/lua_v2.h @@ -111,6 +111,7 @@ protected: DECLARE_LUA_OPCODE(FreeSound); DECLARE_LUA_OPCODE(PlayLoadedSound); DECLARE_LUA_OPCODE(StopSound); + DECLARE_LUA_OPCODE(PlaySound); DECLARE_LUA_OPCODE(GetSoundVolume); DECLARE_LUA_OPCODE(SetSoundVolume); DECLARE_LUA_OPCODE(PlaySoundFrom); diff --git a/engines/grim/emi/lua_v2_sound.cpp b/engines/grim/emi/lua_v2_sound.cpp index d3660d4a74b..fa05f116b49 100644 --- a/engines/grim/emi/lua_v2_sound.cpp +++ b/engines/grim/emi/lua_v2_sound.cpp @@ -246,6 +246,22 @@ void Lua_V2::StopSound() { } } +void Lua_V2::PlaySound() { + lua_Object strObj = lua_getparam(1); + //FIXME: get the second param + lua_getparam(2); + + if (!lua_isstring(strObj)) + return; + + const char *str = lua_getstring(strObj); + + AIFFTrack *track = new AIFFTrack(Audio::Mixer::kSFXSoundType); + Common::SeekableReadStream *stream = g_resourceloader->openNewStreamFile(str); + track->openSound(str, stream); + track->play(); +} + void Lua_V2::ImSetMusicVol() { // This only seems to be used in the demo. lua_Object volumeObj = lua_getparam(1);