aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
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
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')
-rw-r--r--engines/zvision/scripting/script_manager.cpp2
-rw-r--r--engines/zvision/zvision.cpp35
-rw-r--r--engines/zvision/zvision.h1
3 files changed, 38 insertions, 0 deletions
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index 457b491042..a5cb81b957 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -628,6 +628,8 @@ void ScriptManager::do_changeLocation() {
_currentLocation = _nextLocation;
execScope(nodeview);
}
+
+ _engine->checkBorders();
}
void ScriptManager::serialize(Common::WriteStream *stream) {
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;
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index 549ea9bcdf..8cf9dbf107 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -195,6 +195,7 @@ public:
bool ifQuit();
+ void checkBorders();
void showDebugMsg(const Common::String &msg, int16 delay = 3000);
private: