aboutsummaryrefslogtreecommitdiff
path: root/engines/hugo
diff options
context:
space:
mode:
authorArnaud Boutonné2011-01-28 19:54:48 +0000
committerArnaud Boutonné2011-01-28 19:54:48 +0000
commitcfca829e46d40381142c5f024d7f3c555a34564f (patch)
tree67d8a1f7e2c08ac2be583139ec60c192d288248f /engines/hugo
parent5978d8f63d5f67ece8d275f7959d99ccc92ac171 (diff)
downloadscummvm-rg350-cfca829e46d40381142c5f024d7f3c555a34564f.tar.gz
scummvm-rg350-cfca829e46d40381142c5f024d7f3c555a34564f.tar.bz2
scummvm-rg350-cfca829e46d40381142c5f024d7f3c555a34564f.zip
HUGO: Add a function to display exit hotspots in God Mode
svn-id: r55599
Diffstat (limited to 'engines/hugo')
-rw-r--r--engines/hugo/display.cpp32
-rw-r--r--engines/hugo/display.h1
-rw-r--r--engines/hugo/hugo.cpp3
3 files changed, 33 insertions, 3 deletions
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index 8980a4570d..613371327f 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -486,7 +486,9 @@ void Screen::drawShape(int x, int y, int color1, int color2) {
}
}
}
-
+/**
+* Display rectangle (filles or empty)
+*/
void Screen::drawRectangle(bool filledFl, int16 x1, int16 y1, int16 x2, int16 y2, int color) {
assert(x1 <= x2);
assert(y1 <= y2);
@@ -496,10 +498,18 @@ void Screen::drawRectangle(bool filledFl, int16 x1, int16 y1, int16 x2, int16 y2
for (int j = x1; j < x2; j++) {
_backBuffer[320 * i + j] = color;
_frontBuffer[320 * i + j] = color;
+ _backBufferBackup[320 * i + j] = color;
}
}
} else {
- warning("STUB: drawRectangle()");
+ for (int i = y1; i < y2; i++) {
+ _frontBuffer[320 * i + x1] = color;
+ _frontBuffer[320 * i + x2] = color;
+ }
+ for (int i = x1; i < x2; i++) {
+ _frontBuffer[320 * y1 + i] = color;
+ _frontBuffer[320 * y2 + i] = color;
+ }
}
}
@@ -595,11 +605,29 @@ bool Screen::isInY(int16 y, rect_t *rect) {
return (y >= rect->y) && (y <= rect->y + rect->dy);
}
+/**
+* Check if two rectangles are over lapping
+*/
bool Screen::isOverlaping(rect_t *rectA, rect_t *rectB) {
return (isInX(rectA->x, rectB) || isInX(rectA->x + rectA->dx, rectB) || isInX(rectB->x, rectA) || isInX(rectB->x + rectB->dx, rectA)) &&
(isInY(rectA->y, rectB) || isInY(rectA->y + rectA->dy, rectB) || isInY(rectB->y, rectA) || isInY(rectB->y + rectB->dy, rectA));
}
+/**
+* Display exit hotspots in God Mode
+*/
+void Screen::drawHotspots() {
+ if (!_vm->getGameStatus().godModeFl)
+ return;
+
+ for (int i = 0; _vm->_hotspots[i].screenIndex >= 0; i++) {
+ hotspot_t *hotspot = &_vm->_hotspots[i];
+ if (hotspot->screenIndex == _vm->_hero->screenIndex)
+ drawRectangle(false, hotspot->x1, hotspot->y1, hotspot->x2, hotspot->y2, _TLIGHTRED);
+ }
+ g_system->copyRectToScreen(_frontBuffer, 320, 0, 0, 320, 200);
+}
+
Screen_v1d::Screen_v1d(HugoEngine *vm) : Screen(vm) {
}
diff --git a/engines/hugo/display.h b/engines/hugo/display.h
index 2805061a42..454005b47a 100644
--- a/engines/hugo/display.h
+++ b/engines/hugo/display.h
@@ -97,6 +97,7 @@ public:
void displayFrame(int sx, int sy, seq_t *seq, bool foreFl);
void displayList(dupdate_t update, ...);
void displayRect(int16 x, int16 y, int16 dx, int16 dy);
+ void drawHotspots();
void drawRectangle(bool filledFl, int16 x1, int16 y1, int16 x2, int16 y2, int color);
void drawShape(int x, int y, int color1, int color2);
void drawStatusText();
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 3f37bcb256..77b3dede50 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -254,6 +254,8 @@ Common::Error HugoEngine::run() {
_status.doQuitFl = false;
while (!_status.doQuitFl) {
+ _screen->drawHotspots();
+
g_system->updateScreen();
_sound->pcspkr_player();
runMachine();
@@ -287,7 +289,6 @@ Common::Error HugoEngine::run() {
}
_mouse->mouseHandler(); // Mouse activity - adds to display list
_screen->displayList(kDisplayDisplay); // Blit the display list to screen
-
_status.doQuitFl |= shouldQuit(); // update game quit flag
}
return Common::kNoError;