From ed5adcbc59bc6a99837c0537f8461b38717728d8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 24 May 2016 10:54:01 +0200 Subject: SCUMM HE: Fix bug with parameter initialization, add more debug output --- engines/scumm/he/moonbase/ai_main.cpp | 2 ++ engines/scumm/he/moonbase/moonbase.cpp | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/scumm/he/moonbase/ai_main.cpp b/engines/scumm/he/moonbase/ai_main.cpp index 8ed3c48d84..554d2eeb06 100644 --- a/engines/scumm/he/moonbase/ai_main.cpp +++ b/engines/scumm/he/moonbase/ai_main.cpp @@ -2719,6 +2719,8 @@ int getUnitsWithinRadius(int x, int y, int radius) { assert(y >= 0); assert(radius >= 0); + debug(0, "getUnitsWithinRadius(%d, %d, %d)", x, y, radius); + int retVal = _vm->_moonbase->callScummFunction(MCP_params[F_GET_UNITS_WITHIN_RADIUS], 3, x, y, radius); return retVal; } diff --git a/engines/scumm/he/moonbase/moonbase.cpp b/engines/scumm/he/moonbase/moonbase.cpp index cc25c270e4..d7069e73d8 100644 --- a/engines/scumm/he/moonbase/moonbase.cpp +++ b/engines/scumm/he/moonbase/moonbase.cpp @@ -43,9 +43,21 @@ int Moonbase::callScummFunction(int scriptNumber, int paramCount,...) { va_start(va_params, paramCount); int args[25]; - for (int i = 0; i < paramCount; i++) + memset(args, 0, sizeof(args)); + + Common::String str; + str = Common::String::format("callScummFunction(%d, [", scriptNumber); + + for (int i = 0; i < paramCount; i++) { args[i] = va_arg(va_params, int); + str += Common::String::format("%d ", args[i]); + } + str += "])"; + + debug(0, "%s", str.c_str()); + + va_end(va_params); _vm->runScript(scriptNumber, 0, 1, args); -- cgit v1.2.3