aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-06-23 14:06:31 +0000
committerMartin Kiewitz2010-06-23 14:06:31 +0000
commitc1d3fd670c34b751c5e7a4236c14cb72ca973548 (patch)
tree2da428f940020cbb63900249ad50f83ff9a5d11f /engines
parenteeba2812c1a950380ea3ea8766704ced11afaffd (diff)
downloadscummvm-rg350-c1d3fd670c34b751c5e7a4236c14cb72ca973548.tar.gz
scummvm-rg350-c1d3fd670c34b751c5e7a4236c14cb72ca973548.tar.bz2
scummvm-rg350-c1d3fd670c34b751c5e7a4236c14cb72ca973548.zip
SCI: global scaling implemented (hopefully, i'm not sure if it works 100% :P) thx to waltervn for telling me the vocab 994 stuff used for disassembly
svn-id: r50181
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/animate.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index f96a1646ef..9051111d2d 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -233,18 +233,29 @@ void GfxAnimate::fill(byte &old_picNotValid) {
// Process global scaling, if needed
if (listEntry->scaleSignal & kScaleSignalDoScaling) {
if (listEntry->scaleSignal & kScaleSignalGlobalScaling) {
- warning("%lx:%lx", PRINT_REG(curObject));
// Global scaling uses global var 2 and some other stuff to calculate scaleX/scaleY
int16 maxScale = readSelectorValue(_s->_segMan, curObject, SELECTOR(maxScale));
- int16 maxCelHeight = (maxScale * view->getHeight(listEntry->loopNo, listEntry->celNo)) >> 7;
- reg_t globalVar2 = _s->variables[VAR_GLOBAL][1]; // current room
+ int16 celHeight = view->getHeight(listEntry->loopNo, listEntry->celNo);
+ int16 maxCelHeight = (maxScale * celHeight) >> 7;
+ reg_t globalVar2 = _s->variables[VAR_GLOBAL][2]; // current room object
int16 vanishingY = readSelectorValue(_s->_segMan, globalVar2, SELECTOR(vanishingY));
- //warning("vanishingY %d maxScale %d", vanishingY, maxScale);
- // TODO!
+
+ int16 fixedPortY = _ports->getPort()->rect.bottom - vanishingY;
+ int16 fixedEntryY = listEntry->y - vanishingY;
+ if (!fixedEntryY)
+ fixedEntryY = 1;
+
+ if ((celHeight == 0) || (fixedPortY == 0))
+ error("global scaling panic");
+
+ listEntry->scaleY = ( maxCelHeight * fixedEntryY ) / fixedPortY;
+ listEntry->scaleY = (listEntry->scaleY * 128) / celHeight;
+
+ listEntry->scaleX = listEntry->scaleY;
// and set objects scale selectors
- //writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleX), listEntry->scaleX);
- //writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleY), listEntry->scaleY);
+ writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleX), listEntry->scaleX);
+ writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleY), listEntry->scaleY);
}
}