From 014d1b7dcbb27b9db35a02be99338d3525e72349 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Mon, 18 Jul 2016 15:26:06 +0200 Subject: MACVENTURE: Fix sign issue --- engines/macventure/script.cpp | 16 +++++++++------- engines/macventure/world.cpp | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'engines/macventure') diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp index fdb470ca48..36aabae3ed 100644 --- a/engines/macventure/script.cpp +++ b/engines/macventure/script.cpp @@ -52,14 +52,14 @@ bool ScriptEngine::runControl(ControlAction action, ObjID source, ObjID destinat frame.haltedInFirst = false; frame.haltedInFamily = false; _frames.push_back(frame); - debug(2, "SCRIPT: Stored frame %d, action: %d src: %d dest: %d point: (%d, %d)", + debug(3, "SCRIPT: Stored frame %d, action: %d src: %d dest: %d point: (%d, %d)", _frames.size() - 1, frame.action, frame.src, frame.dest, frame.x, frame.y); return resume(true); } bool ScriptEngine::resume(bool execAll) { - debug(2, "SCRIPT: Resume"); + debug(3, "SCRIPT: Resume"); while (_frames.size()) { bool fail = execFrame(execAll); if (fail) return true; @@ -166,7 +166,6 @@ bool ScriptEngine::resumeFunc(EngineFrame * frame) { bool ScriptEngine::runFunc(EngineFrame *frame) { ScriptAsset &script = frame->scripts.front(); - debug(2, "SCRIPT: Executing function %d", script.getId()); EngineState *state = &frame->state; byte op; while (script.hasNext()) { @@ -772,24 +771,26 @@ void ScriptEngine::opa7LNOT(EngineState * state, EngineFrame * frame) { } void ScriptEngine::opa8GTU(EngineState * state, EngineFrame * frame) { - word b = state->pop(); - word a = state->pop(); + uint16 b = state->pop(); + uint16 a = state->pop(); state->push((a > b) ? 0xFFFF : 0); } void ScriptEngine::opa9LTU(EngineState * state, EngineFrame * frame) { - word b = state->pop(); - word a = state->pop(); + uint16 b = state->pop(); + uint16 a = state->pop(); state->push((a < b) ? 0xFFFF : 0); } void ScriptEngine::opaaGTS(EngineState * state, EngineFrame * frame) { + // HACK !!! May not need the neg16, since word is already a signed int!! word b = neg16(state->pop()); word a = neg16(state->pop()); state->push((a > b) ? 0xFFFF : 0); } void ScriptEngine::opabLTS(EngineState * state, EngineFrame * frame) { + // HACK !!! May not need the neg16, since word is already a signed int!! word b = neg16(state->pop()); word a = neg16(state->pop()); state->push((a < b) ? 0xFFFF : 0); @@ -924,6 +925,7 @@ bool ScriptEngine::opbcCALL(EngineState * state, EngineFrame * frame, ScriptAsse word id = state->pop(); ScriptAsset newfun = ScriptAsset(id, _scripts); ScriptAsset current = script; + debug(2, "SCRIPT: Call function: %d", id); if (loadScript(frame, id)) return true; frame->scripts.pop_front(); diff --git a/engines/macventure/world.cpp b/engines/macventure/world.cpp index cf13b78e48..ab35226aa0 100644 --- a/engines/macventure/world.cpp +++ b/engines/macventure/world.cpp @@ -41,7 +41,7 @@ World::~World() { uint32 World::getObjAttr(ObjID objID, uint32 attrID) { - uint32 res; + int res; uint32 index = _engine->getGlobalSettings().attrIndices[attrID]; // HACK, but if I try to initialize it in the else clause, it goes out of scope and segfaults Common::SeekableReadStream *objStream = _objectConstants->getItem(objID); -- cgit v1.2.3