From 19d732186760bb13be49fb8d5ca4c45de0f77d86 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Tue, 12 Jul 2016 11:49:05 +0200 Subject: MACVENTURE: Fix torch drawing problem --- engines/macventure/gui.cpp | 15 +++++++-------- engines/macventure/gui.h | 3 +-- engines/macventure/macventure.cpp | 5 +++-- engines/macventure/script.cpp | 25 ++++++++++++------------- 4 files changed, 23 insertions(+), 25 deletions(-) (limited to 'engines/macventure') diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 1f07e7c7c4..b4fada64b8 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -1116,14 +1116,13 @@ bool Gui::tryCloseWindow(WindowReference winID) { return true; } -uint Gui::getObjWidth(ObjID obj) { - if (!_assets.contains(obj)) return 0; - return _assets[obj]->getWidth(); -} - -uint Gui::getObjHeight(ObjID obj) { - if (!_assets.contains(obj)) return 0; - return _assets[obj]->getHeight(); +Common::Point Gui::getObjMeasures(ObjID obj) { + if (!_assets.contains(obj)) { + _assets[obj] = new ImageAsset(obj, _graphics); + } + uint w = _assets[obj]->getWidth(); + uint h = _assets[obj]->getHeight(); + return Common::Point(w, h); } bool Gui::processEvent(Common::Event &event) { diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h index cd8c162a1d..2c4ef3fd2a 100644 --- a/engines/macventure/gui.h +++ b/engines/macventure/gui.h @@ -205,8 +205,7 @@ public: WindowReference createInventoryWindow(ObjID objRef); bool tryCloseWindow(WindowReference winID); - uint getObjWidth(ObjID obj); - uint getObjHeight(ObjID obj); + Common::Point getObjMeasures(ObjID obj); WindowReference getObjWindow(ObjID objID); WindowReference findObjWindow(ObjID objID); diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp index 28bfa65a98..211ba43971 100644 --- a/engines/macventure/macventure.cpp +++ b/engines/macventure/macventure.cpp @@ -864,8 +864,9 @@ Common::Rect MacVentureEngine::getObjBounds(ObjID objID) { pos.x += bounds.leftOffset; pos.y += bounds.topOffset; } - uint w = _gui->getObjWidth(objID); // This shouldn't go here - uint h = _gui->getObjHeight(objID); + Common::Point measures = _gui->getObjMeasures(objID); + uint w = measures.x; + uint h = measures.y; return Common::Rect(pos.x, pos.y, pos.x + w, pos.y + h); } diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp index 5e8bcd69a2..5b86c31e84 100644 --- a/engines/macventure/script.cpp +++ b/engines/macventure/script.cpp @@ -27,8 +27,8 @@ #include "macventure/world.h" #include "macventure/container.h" -namespace MacVenture { - +namespace MacVenture { + ScriptEngine::ScriptEngine(MacVentureEngine * engine, World * world) { _engine = engine; _world = world; @@ -57,13 +57,13 @@ bool ScriptEngine::runControl(ControlAction action, ObjID source, ObjID destinat return resume(true); } -bool ScriptEngine::resume(bool execAll) { +bool ScriptEngine::resume(bool execAll) { debug(2, "SCRIPT: Resume"); while (_frames.size()) { bool fail = execFrame(execAll); if (fail) return true; } - return false; + return false; } void ScriptEngine::reset() { @@ -107,7 +107,7 @@ bool ScriptEngine::execFrame(bool execAll) { } doFamily = true; } - } + } // Halted in saves if (frame->haltedInSaves) { @@ -139,7 +139,7 @@ bool ScriptEngine::execFrame(bool execAll) { } } } while (highest); - + _frames.pop_front(); return false; } @@ -167,7 +167,7 @@ bool ScriptEngine::runFunc(EngineFrame *frame) { ScriptAsset &script = frame->scripts.front(); debug(2, "SCRIPT: Executing function %d", script.getId()); EngineState *state = &frame->state; - byte op; + byte op; while (script.hasNext()) { op = script.fetch(); debug(3, "SCRIPT: I'm running operation %d", op); @@ -352,7 +352,7 @@ bool ScriptEngine::runFunc(EngineFrame *frame) { case 0xba: //cancel priority range opbaCRAN(state, frame); break; - case 0xbb: //fork + case 0xbb: //fork if (opbbFORK(state, frame)) return true; break; @@ -1012,7 +1012,6 @@ void ScriptEngine::opcaTIME(EngineState * state, EngineFrame * frame) { state->push(minutes); state->push(totalPlayTime); debug("Saved time: h[%d] m[%d] s[%d]", hours, minutes, totalPlayTime); - } void ScriptEngine::opcbDAY(EngineState * state, EngineFrame * frame) { @@ -1056,7 +1055,7 @@ void ScriptEngine::opd1GOBD(EngineState * state, EngineFrame * frame) { state->push(bounds.height()); } -void ScriptEngine::opd2GOVP(EngineState * state, EngineFrame * frame) { +void ScriptEngine::opd2GOVP(EngineState * state, EngineFrame * frame) { word b = state->pop(); word a = state->pop(); state->push(_engine->getOverlapPercent(b, a)); @@ -1168,10 +1167,10 @@ void ScriptEngine::op00NOOP(byte op) { -ScriptAsset::ScriptAsset(ObjID id, Container * container) { +ScriptAsset::ScriptAsset(ObjID id, Container * container) { _id = id; _container = container; - _ip = 0x0; + _ip = 0x0; loadInstructions(); } @@ -1206,4 +1205,4 @@ void ScriptAsset::loadInstructions() { debug(2, "SCRIPT: Load %d instructions for script %d", amount, _id); } -} // End of namespace MacVenture \ No newline at end of file +} // End of namespace MacVenture -- cgit v1.2.3