aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-08-13 22:40:22 +0200
committerEugene Sandulenko2019-09-03 17:17:33 +0200
commite9970a20ddee1f7ddc92ada10cf86a99617c27b4 (patch)
tree56680fe99803831ccc614467dca8600b94088ad6
parentd399dc6f9ded81c5cb515e41c62b8658eeb1ba27 (diff)
downloadscummvm-rg350-e9970a20ddee1f7ddc92ada10cf86a99617c27b4.tar.gz
scummvm-rg350-e9970a20ddee1f7ddc92ada10cf86a99617c27b4.tar.bz2
scummvm-rg350-e9970a20ddee1f7ddc92ada10cf86a99617c27b4.zip
HDB: Implement PPC demo Lua differences for saving
-rw-r--r--engines/hdb/lua-script.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/engines/hdb/lua-script.cpp b/engines/hdb/lua-script.cpp
index 3ad3bdb3f0..c180778ac7 100644
--- a/engines/hdb/lua-script.cpp
+++ b/engines/hdb/lua-script.cpp
@@ -1370,13 +1370,31 @@ static int openFile(lua_State *L) {
return 1;
}
+static int writeto(lua_State *L) {
+ g_hdb->_lua->checkParameters("writeto", 1);
+
+ lua_pop(L, 1);
+
+ return 1;
+}
+
static int write(lua_State *L) {
Common::OutSaveFile *out = g_hdb->_currentOutSaveFile;
- const char *data = lua_tostring(L, 2);
+ const char *data;
- g_hdb->_lua->checkParameters("write", 2);
+ if (g_hdb->isDemo() && g_hdb->isPPC()) {
+ data = lua_tostring(L, 1);
- lua_pop(L, 2);
+ g_hdb->_lua->checkParameters("write", 1);
+
+ lua_pop(L, 1);
+ } else {
+ data = lua_tostring(L, 2);
+
+ g_hdb->_lua->checkParameters("write", 2);
+
+ lua_pop(L, 2);
+ }
out->write(data, strlen(data));
@@ -1722,6 +1740,7 @@ struct FuncInit {
{ "write", write, },
{ "closefile", closeFile, },
{ "dofile", dofile, },
+ { "writeto", writeto, },
{ NULL, NULL }
};