diff options
author | Martin Kiewitz | 2010-01-23 11:00:24 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-23 11:00:24 +0000 |
commit | e99adedac29f148e392e70ddd5a794caaa10e7f2 (patch) | |
tree | 562c6e6c90acbf8660589ed0d87ad27dc7a52761 | |
parent | ee653e19ec37346262959617b0095437e8655212 (diff) | |
download | scummvm-rg350-e99adedac29f148e392e70ddd5a794caaa10e7f2.tar.gz scummvm-rg350-e99adedac29f148e392e70ddd5a794caaa10e7f2.tar.bz2 scummvm-rg350-e99adedac29f148e392e70ddd5a794caaa10e7f2.zip |
SCI: separate fix function for kDrawControl rects
svn-id: r47462
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 2951e7030c..266f154c13 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -185,14 +185,6 @@ reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv) { } Common::Rect kGraphCreateRect(int16 x, int16 y, int16 x1, int16 y1) { - // TODO: find out what to do when just one coordinate is wrong - if we should fix it the same way as in jones - // needs some serious work - if ((x > x1) && (y > y1)) { - // We get this in jones when challenging jones -> upper left is right, lower right is 0, 0 - // If we "fix this" we will draw a box that isnt supposed to be there and also draw the button to the wrong - // space - return Common::Rect(x, y, x, y); - } if (x > x1) SWAP(x, x1); if (y > y1) SWAP(y, y1); return Common::Rect(x, y, x1, y1); @@ -700,6 +692,14 @@ reg_t kPortrait(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } +// Original top-left must stay on kControl rects, we adjust accordingly because sierra sci actually wont draw rects that +// are upside down (example: jones, when challenging jones - one button is a duplicate and also has lower-right which is 0, 0) +Common::Rect kControlCreateRect(int16 x, int16 y, int16 x1, int16 y1) { + if (x > x1) x1 = x; + if (y > y1) y1 = y; + return Common::Rect(x, y, x1, y1); +} + void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { int16 type = GET_SEL32V(s->_segMan, controlObject, type); int16 style = GET_SEL32V(s->_segMan, controlObject, state); @@ -721,7 +721,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { const char **listEntries = NULL; bool isAlias = false; - rect = kGraphCreateRect(x, y, GET_SEL32V(s->_segMan, controlObject, nsRight), GET_SEL32V(s->_segMan, controlObject, nsBottom)); + rect = kControlCreateRect(x, y, GET_SEL32V(s->_segMan, controlObject, nsRight), GET_SEL32V(s->_segMan, controlObject, nsBottom)); if (!textReference.isNull()) text = s->_segMan->getString(textReference); |