aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure
diff options
context:
space:
mode:
authorBorja Lorente2016-07-12 11:49:05 +0200
committerBorja Lorente2016-08-14 18:53:51 +0200
commit19d732186760bb13be49fb8d5ca4c45de0f77d86 (patch)
tree0fce7a60f6bb0dc9a7dd550053c09b46e263321c /engines/macventure
parenta5a094b6bdf1dd61f270e60068c42d9f62b8c447 (diff)
downloadscummvm-rg350-19d732186760bb13be49fb8d5ca4c45de0f77d86.tar.gz
scummvm-rg350-19d732186760bb13be49fb8d5ca4c45de0f77d86.tar.bz2
scummvm-rg350-19d732186760bb13be49fb8d5ca4c45de0f77d86.zip
MACVENTURE: Fix torch drawing problem
Diffstat (limited to 'engines/macventure')
-rw-r--r--engines/macventure/gui.cpp15
-rw-r--r--engines/macventure/gui.h3
-rw-r--r--engines/macventure/macventure.cpp5
-rw-r--r--engines/macventure/script.cpp25
4 files changed, 23 insertions, 25 deletions
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