diff options
-rw-r--r-- | engines/sci/engine/selector.cpp | 1 | ||||
-rw-r--r-- | engines/sci/engine/static_selectors.cpp | 1 | ||||
-rw-r--r-- | engines/sci/engine/vm.h | 3 | ||||
-rw-r--r-- | engines/sci/graphics/animate.cpp | 20 | ||||
-rw-r--r-- | engines/sci/graphics/animate.h | 6 |
5 files changed, 21 insertions, 10 deletions
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index 08e2ba5e99..cc2adeb62b 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -157,6 +157,7 @@ void Kernel::mapSelectors() { FIND_SELECTOR(scaleSignal); FIND_SELECTOR(scaleX); FIND_SELECTOR(scaleY); + FIND_SELECTOR(maxScale); FIND_SELECTOR(iconIndex); #ifdef ENABLE_SCI32 diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp index eca18f67fb..c7ee7b854a 100644 --- a/engines/sci/engine/static_selectors.cpp +++ b/engines/sci/engine/static_selectors.cpp @@ -107,6 +107,7 @@ static const SelectorRemap sciSelectorRemap[] = { { SCI_VERSION_1_1, SCI_VERSION_1_1,"scaleSignal", 103 }, { SCI_VERSION_1_1, SCI_VERSION_1_1, "scaleX", 104 }, { SCI_VERSION_1_1, SCI_VERSION_1_1, "scaleY", 105 }, + { SCI_VERSION_1_1, SCI_VERSION_1_1, "maxScale", 106 }, { SCI_VERSION_NONE, SCI_VERSION_NONE, 0, 0 } }; diff --git a/engines/sci/engine/vm.h b/engines/sci/engine/vm.h index fa57a1151c..d4be76dd40 100644 --- a/engines/sci/engine/vm.h +++ b/engines/sci/engine/vm.h @@ -152,8 +152,9 @@ struct SelectorCache { Selector syncTime; // SCI1.1 specific selectors - Selector scaleSignal; // < Used by Animate() for cel scaling (SCI1.1+) + Selector scaleSignal; //< Used by kAnimate() for cel scaling (SCI1.1+) Selector scaleX, scaleY; ///< SCI1.1 view scaling + Selector maxScale; ///< SCI1.1 view scaling, limit for cel, when using global scaling // Used for auto detection purposes Selector overlay; ///< Used to determine if a game is using old gfx functions or not diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index 339132a76c..57879b6653 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -185,12 +185,6 @@ void GfxAnimate::makeSortedList(List *list) { listEntry->scaleX = 128; listEntry->scaleY = 128; } - // TODO - // On scaleSignal bit 1 sierra sci does some stuff with global var 2, current Port - // and some other stuff and sets scaleX/Y accordingly. It seems this functionality is needed in at - // least sq5 right when starting the game before wilco exists the room. Currently we dont get scaling - // but sierra sci does scaling there. I dont fully understand the code yet, that's why i didnt implement - // anything. } else { listEntry->scaleSignal = 0; listEntry->scaleX = 128; @@ -236,6 +230,20 @@ void GfxAnimate::fill(byte &old_picNotValid) { writeSelectorValue(_s->_segMan, curObject, SELECTOR(cel), listEntry->celNo); } + // Process global scaling, if needed + if (listEntry->scaleSignal & kScaleSignalDoScaling) { + if (listEntry->scaleSignal & kScaleSignalGlobalScaling) { + // 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; + // TODO! + + // and set objects scale selectors + //writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleX), listEntry->scaleX); + //writeSelectorValue(_s->_segMan, curObject, SELECTOR(scaleY), listEntry->scaleY); + } + } + // Create rect according to coordinates and given cel if (listEntry->scaleSignal & kScaleSignalDoScaling) { view->getCelScaledRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, listEntry->scaleX, listEntry->scaleY, &listEntry->celRect); diff --git a/engines/sci/graphics/animate.h b/engines/sci/graphics/animate.h index 324ca0d700..a7d925c6e0 100644 --- a/engines/sci/graphics/animate.h +++ b/engines/sci/graphics/animate.h @@ -51,9 +51,9 @@ enum ViewSignals { }; enum ViewScaleSignals { - kScaleSignalDoScaling = 0x0001, // enables scaling when drawing that cel (involves scaleX and scaleY) - kScaleSignalUnknown1 = 0x0002, // seems to do something with globalvar 2, sets scaleX/scaleY - kScaleSignalUnknown2 = 0x0004 // really unknown + kScaleSignalDoScaling = 0x0001, // enables scaling when drawing that cel (involves scaleX and scaleY) + kScaleSignalGlobalScaling = 0x0002, // means that global scaling shall get applied on that cel (sets scaleX/scaleY) + kScaleSignalUnknown2 = 0x0004 // really unknown }; struct AnimateEntry { |