diff options
author | Martin Kiewitz | 2009-10-12 12:38:58 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-12 12:38:58 +0000 |
commit | f4f17ae51639fc28501e282cc8bd5c421e180a31 (patch) | |
tree | 5b9a4e2bb0cad006f94690c0713c7f4260b5f75e /engines/sci | |
parent | 0ab28463d6495bef1c792ec9cd605bd0ec7c65c6 (diff) | |
download | scummvm-rg350-f4f17ae51639fc28501e282cc8bd5c421e180a31.tar.gz scummvm-rg350-f4f17ae51639fc28501e282cc8bd5c421e180a31.tar.bz2 scummvm-rg350-f4f17ae51639fc28501e282cc8bd5c421e180a31.zip |
SCI: kGraph now fixes up coordinates before constructing a rect (invalid rects are given to us by castle of dr. brain right at the 2nd screen when entering left door)
svn-id: r44984
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index aa8f5b3854..f1dbb7fe6e 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -585,8 +585,14 @@ reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv) { return make_reg(0, s->_gui->picNotValid(newPicNotValid)); } +void kGraphCreateRect(int16 x, int16 y, int16 x1, int16 y1, Common::Rect *destRect) { + if (x > x1) SWAP(x, x1); + if (y > y1) SWAP(y, y1); + *destRect = Common::Rect(x, y, x1, y1); +} + reg_t kGraph(EngineState *s, int argc, reg_t *argv) { - int x = 0, y = 0, x1 = 0, y1 = 0; + int16 x = 0, y = 0, x1 = 0, y1 = 0; uint16 flags; int16 priority, control, color, colorMask; Common::Rect rect; @@ -620,7 +626,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { break; case K_GRAPH_SAVE_BOX: - rect = Common::Rect(x, y, x1, y1); + kGraphCreateRect(x, y, x1, y1, &rect); flags = (argc > 5) ? argv[5].toUint16() : 0; return s->_gui->graphSaveBox(rect, flags); break; @@ -630,12 +636,12 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { break; case K_GRAPH_FILL_BOX_BACKGROUND: - rect = Common::Rect(x, y, x1, y1); + kGraphCreateRect(x, y, x1, y1, &rect); s->_gui->graphFillBoxBackground(rect); break; case K_GRAPH_FILL_BOX_FOREGROUND: - rect = Common::Rect(x, y, x1, y1); + kGraphCreateRect(x, y, x1, y1, &rect); s->_gui->graphFillBoxForeground(rect); break; @@ -650,14 +656,14 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { break; case K_GRAPH_UPDATE_BOX: { - rect = Common::Rect(x, y, x1, y1); + kGraphCreateRect(x, y, x1, y1, &rect); s->_gui->graphUpdateBox(rect); break; } break; case K_GRAPH_REDRAW_BOX: { - rect = Common::Rect(x, y, x1, y1); + kGraphCreateRect(x, y, x1, y1, &rect); s->_gui->graphRedrawBox(rect); break; } |