aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-07-14 00:11:11 +0530
committerEugene Sandulenko2019-09-03 17:17:19 +0200
commit4216aa965c6484081f4eb37081a25486fdbe0ebe (patch)
tree01afbd5d1aa0f0f845af0f8073d718205639fb68
parentff5b6d830a744b20c4a87db8e488443dd0b7c5ab (diff)
downloadscummvm-rg350-4216aa965c6484081f4eb37081a25486fdbe0ebe.tar.gz
scummvm-rg350-4216aa965c6484081f4eb37081a25486fdbe0ebe.tar.bz2
scummvm-rg350-4216aa965c6484081f4eb37081a25486fdbe0ebe.zip
HDB: Unstub Sound Lua stubs
-rw-r--r--engines/hdb/lua-script.cpp73
1 files changed, 64 insertions, 9 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index 06eb67b2e4..c703c3964a 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -1100,37 +1100,85 @@ static int killTrigger(lua_State *L) {
}
static int startMusic(lua_State *L) {
- warning("STUB: START MUSIC");
+ bool error;
+
+ double song = lua_tonumber(L, 1);
+ int s1 = (int)song;
+
+ g_hdb->_lua->checkParameters("startMusic", 1);
+
+ lua_pop(L, 1);
+ error = g_hdb->_sound->startMusic((SoundType)s1);
+
return 0;
}
static int fadeInMusic(lua_State *L) {
- warning("STUB: FADE IN MUSIC");
+ bool error;
+
+ double song = lua_tonumber(L, 1);
+ int s1 = (int)song;
+ int ramp = (int)lua_tonumber(L, 2);
+ if (!ramp)
+ ramp = 1;
+
+ g_hdb->_lua->checkParameters("fadeInMusic", 2);
+
+ lua_pop(L, 2);
+ error = g_hdb->_sound->fadeInMusic((SoundType)s1, ramp);
+
return 0;
}
static int stopMusic(lua_State *L) {
- warning("STUB: STOP MUSIC");
+ g_hdb->_sound->stopMusic();
return 0;
}
static int fadeOutMusic(lua_State *L) {
- warning("STUB: FADE OUT MUSIC");
+ int ramp = (int)lua_tonumber(L, 1);
+ if (!ramp)
+ ramp = 1;
+
+ g_hdb->_lua->checkParameters("fadeOutMusic", 1);
+
+ lua_pop(L, 1);
+ g_hdb->_sound->fadeOutMusic(ramp);
+
return 0;
}
static int registerSound(lua_State *L) {
- warning("STUB: REGISTER SOUND");
- return 0;
+ const char *name = lua_tostring(L, 1);
+
+ g_hdb->_lua->checkParameters("registerSound", 1);
+
+ lua_pop(L, 1);
+ int index = g_hdb->_sound->registerSound(name);
+ lua_pushnumber(L, index);
+
+ return 1;
}
static int playSound(lua_State *L) {
- warning("STUB: PLAY SOUND");
+ int index = (int)lua_tonumber(L, 1);
+
+ g_hdb->_lua->checkParameters("playSound", 1);
+
+ lua_pop(L, 1);
+ g_hdb->_sound->playSound(index);
+
return 0;
}
static int freeSound(lua_State *L) {
- warning("STUB: FREE SOUND");
+ int index = (int)lua_tonumber(L, 1);
+
+ g_hdb->_lua->checkParameters("freeSound", 1);
+
+ lua_pop(L, 1);
+ g_hdb->_sound->freeSound(index);
+
return 0;
}
@@ -1247,7 +1295,14 @@ static int setPointerState(lua_State *L) {
}
static int playVoice(lua_State *L) {
- warning("STUB: PLAY VOICE");
+ double index = lua_tonumber(L, 1);
+ double actor = lua_tonumber(L, 2);
+
+ g_hdb->_lua->checkParameters("playVoice", 2);
+
+ lua_pop(L, 2);
+
+ g_hdb->_sound->playVoice((int)index, (int)actor);
return 0;
}