From c1d3fd670c34b751c5e7a4236c14cb72ca973548 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Wed, 23 Jun 2010 14:06:31 +0000 Subject: 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 --- engines/sci/graphics/animate.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'engines') 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); } } -- cgit v1.2.3