aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/zvision.cpp
diff options
context:
space:
mode:
authorMarisa-Chan2014-11-12 15:58:35 +0600
committerMarisa-Chan2014-11-12 15:58:35 +0600
commit418b5f6dd28931ef8c7a0a05ae90dde3b36015b7 (patch)
treec7746b219ae15dc6ec2adc5afcafa3652262f697 /engines/zvision/zvision.cpp
parent1f0bf5ecf2f3eb1c65019d196f7327a0874f93bb (diff)
downloadscummvm-rg350-418b5f6dd28931ef8c7a0a05ae90dde3b36015b7.tar.gz
scummvm-rg350-418b5f6dd28931ef8c7a0a05ae90dde3b36015b7.tar.bz2
scummvm-rg350-418b5f6dd28931ef8c7a0a05ae90dde3b36015b7.zip
ZVISION: Passive borders check for tilt and panorama for changelocation
Diffstat (limited to 'engines/zvision/zvision.cpp')
-rw-r--r--engines/zvision/zvision.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index f2f713dac0..d8b0f209e3 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -410,6 +410,41 @@ void ZVision::updateRotation() {
}
}
+void ZVision::checkBorders() {
+ RenderTable::RenderState renderState = _renderManager->getRenderTable()->getRenderState();
+ if (renderState == RenderTable::PANORAMA) {
+ int16 st_pos = _scriptManager->getStateValue(StateKey_ViewPos);
+
+ int16 new_pos = st_pos;
+
+ int16 scr_width = _renderManager->getBkgSize().x;
+
+ if (scr_width)
+ new_pos %= scr_width;
+
+ if (new_pos < 0)
+ new_pos += scr_width;
+
+ if (st_pos != new_pos)
+ _renderManager->setBackgroundPosition(new_pos);
+ } else if (renderState == RenderTable::TILT) {
+ int16 st_pos = _scriptManager->getStateValue(StateKey_ViewPos);
+
+ int16 new_pos = st_pos;
+
+ int16 scr_height = _renderManager->getBkgSize().y;
+ int16 tilt_gap = _renderManager->getRenderTable()->getTiltGap();
+
+ if (new_pos >= (scr_height - tilt_gap))
+ new_pos = scr_height - tilt_gap;
+ if (new_pos <= tilt_gap)
+ new_pos = tilt_gap;
+
+ if (st_pos != new_pos)
+ _renderManager->setBackgroundPosition(new_pos);
+ }
+}
+
void ZVision::rotateTo(int16 _toPos, int16 _time) {
if (_renderManager->getRenderTable()->getRenderState() != RenderTable::PANORAMA)
return;