aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/view.cpp
diff options
context:
space:
mode:
authorKari Salminen2008-01-03 08:41:40 +0000
committerKari Salminen2008-01-03 08:41:40 +0000
commit0ddfc0a64ea457cc65df92d8e359a900a0bfed6a (patch)
tree507730ce5344e2a92b74b0be2dcc495d65b13cda /engines/agi/view.cpp
parent967e56996a429dcbde6e70bec842c3f87df258fd (diff)
downloadscummvm-rg350-0ddfc0a64ea457cc65df92d8e359a900a0bfed6a.tar.gz
scummvm-rg350-0ddfc0a64ea457cc65df92d8e359a900a0bfed6a.tar.bz2
scummvm-rg350-0ddfc0a64ea457cc65df92d8e359a900a0bfed6a.zip
Fix for the Space Trek sprite duplication bug (#1659209). Makes commands position and position.v use coordinate clipping for Space Trek.
svn-id: r30190
Diffstat (limited to 'engines/agi/view.cpp')
-rw-r--r--engines/agi/view.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp
index 48e3ca5e3f..2eb11c9b91 100644
--- a/engines/agi/view.cpp
+++ b/engines/agi/view.cpp
@@ -254,6 +254,15 @@ void AgiEngine::setCel(VtEntry *v, int n) {
lSetCel(v, n);
/* If position isn't appropriate, update it accordingly */
+ clipViewCoordinates(v);
+}
+
+/**
+ * Restrict view table entry's position so it stays wholly inside the screen.
+ * Also take horizon into account when clipping if not set to ignore it.
+ * @param v pointer to view table entry
+ */
+void AgiEngine::clipViewCoordinates(VtEntry *v) {
if (v->xPos + v->xSize > _WIDTH) {
v->flags |= UPDATE_POS;
v->xPos = _WIDTH - v->xSize;