aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-06-02 21:34:40 -0400
committerPaul Gilbert2015-06-02 21:34:40 -0400
commitb5a2b55096fbe470425d08269f583c0dd6713898 (patch)
tree43fdb4cb14d23d64a6a8f13286483d01b19b4651
parent1f9d1e9c16da9fa6484b49dc4e4b05a89387116d (diff)
downloadscummvm-rg350-b5a2b55096fbe470425d08269f583c0dd6713898.tar.gz
scummvm-rg350-b5a2b55096fbe470425d08269f583c0dd6713898.tar.bz2
scummvm-rg350-b5a2b55096fbe470425d08269f583c0dd6713898.zip
SHERLOCK: Implement getScaleVal
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 6c7af3274b..e712e6223b 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -658,7 +658,31 @@ void TattooScene::doBgAnimDrawSprites() {
}
int TattooScene::getScaleVal(const Common::Point &pt) {
- error("TODO: getScaleVal");
+ bool found = false;
+ int result = 256;
+ Common::Point pos(pt.x / FIXED_INT_MULTIPLIER, pt.y / FIXED_INT_MULTIPLIER);
+
+ for (uint idx = 0; idx < _scaleZones.size() && !found; ++idx) {
+ ScaleZone &sz = _scaleZones[idx];
+ if (sz.contains(pos)) {
+ int n = (sz._bottomNumber - sz._topNumber) * 100 / sz.height() * (pos.y - sz.top) / 100 + sz._topNumber;
+ result = 25600L / n;
+ }
+ }
+
+ // If it wasn't found, we may be off screen to the left or right, so find the scale zone
+ // that would apply to the y val passed in disregarding the x
+ if (!found) {
+ for (uint idx = 0; idx < _scaleZones.size() && !found; ++idx) {
+ ScaleZone &sz = _scaleZones[idx];
+ if (pos.y >= sz.top && pos.y < sz.bottom) {
+ int n = (sz._bottomNumber - sz._topNumber) * 100 / sz.height() * (pos.y - sz.top) / 100 + sz._topNumber;
+ result = 25600L / n;
+ }
+ }
+ }
+
+ return result;
}