[Scummvm-cvs-logs] scummvm master -> b5a2b55096fbe470425d08269f583c0dd6713898
dreammaster
dreammaster at scummvm.org
Wed Jun 3 03:35:43 CEST 2015
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b5a2b55096 SHERLOCK: Implement getScaleVal
Commit: b5a2b55096fbe470425d08269f583c0dd6713898
https://github.com/scummvm/scummvm/commit/b5a2b55096fbe470425d08269f583c0dd6713898
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-06-02T21:34:40-04:00
Commit Message:
SHERLOCK: Implement getScaleVal
Changed paths:
engines/sherlock/tattoo/tattoo_scene.cpp
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 6c7af32..e712e62 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;
}
More information about the Scummvm-git-logs
mailing list