From f86618f92be1350bf6e56573c2419e604c811548 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 5 Feb 2010 22:55:18 +0000 Subject: SCI: Add a 'SELECTOR' macro svn-id: r47918 --- engines/sci/graphics/animate.cpp | 72 +++++++++++++++++----------------- engines/sci/graphics/compare.cpp | 69 ++++++++++++++++---------------- engines/sci/graphics/controls.cpp | 18 ++++----- engines/sci/graphics/coordadjuster.cpp | 16 ++++---- engines/sci/graphics/frameout.cpp | 52 ++++++++++++------------ engines/sci/graphics/menu.cpp | 8 ++-- 6 files changed, 119 insertions(+), 116 deletions(-) (limited to 'engines/sci/graphics') diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp index abf386d934..b42a794399 100644 --- a/engines/sci/graphics/animate.cpp +++ b/engines/sci/graphics/animate.cpp @@ -92,7 +92,7 @@ bool GfxAnimate::invoke(List *list, int argc, reg_t *argv) { } } - signal = GET_SEL32V(_s->_segMan, curObject, signal); + signal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(signal)); if (!(signal & kSignalFrozen)) { // Call .doit method of that object invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argc, argv, 0); @@ -153,21 +153,21 @@ void GfxAnimate::makeSortedList(List *list) { listEntry->object = curObject; // Get data from current object - listEntry->viewId = GET_SEL32V(_s->_segMan, curObject, view); - listEntry->loopNo = GET_SEL32V(_s->_segMan, curObject, loop); - listEntry->celNo = GET_SEL32V(_s->_segMan, curObject, cel); - listEntry->paletteNo = GET_SEL32V(_s->_segMan, curObject, palette); - listEntry->x = GET_SEL32V(_s->_segMan, curObject, x); - listEntry->y = GET_SEL32V(_s->_segMan, curObject, y); - listEntry->z = GET_SEL32V(_s->_segMan, curObject, z); - listEntry->priority = GET_SEL32V(_s->_segMan, curObject, priority); - listEntry->signal = GET_SEL32V(_s->_segMan, curObject, signal); + listEntry->viewId = GET_SEL32V(_s->_segMan, curObject, SELECTOR(view)); + listEntry->loopNo = GET_SEL32V(_s->_segMan, curObject, SELECTOR(loop)); + listEntry->celNo = GET_SEL32V(_s->_segMan, curObject, SELECTOR(cel)); + listEntry->paletteNo = GET_SEL32V(_s->_segMan, curObject, SELECTOR(palette)); + listEntry->x = GET_SEL32V(_s->_segMan, curObject, SELECTOR(x)); + listEntry->y = GET_SEL32V(_s->_segMan, curObject, SELECTOR(y)); + listEntry->z = GET_SEL32V(_s->_segMan, curObject, SELECTOR(z)); + listEntry->priority = GET_SEL32V(_s->_segMan, curObject, SELECTOR(priority)); + listEntry->signal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(signal)); if (getSciVersion() >= SCI_VERSION_1_1) { // Cel scaling - listEntry->scaleSignal = GET_SEL32V(_s->_segMan, curObject, scaleSignal); + listEntry->scaleSignal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(scaleSignal)); if (listEntry->scaleSignal & kScaleSignalDoScaling) { - listEntry->scaleX = GET_SEL32V(_s->_segMan, curObject, scaleX); - listEntry->scaleY = GET_SEL32V(_s->_segMan, curObject, scaleY); + listEntry->scaleX = GET_SEL32V(_s->_segMan, curObject, SELECTOR(scaleX)); + listEntry->scaleY = GET_SEL32V(_s->_segMan, curObject, SELECTOR(scaleY)); } else { listEntry->scaleX = 128; listEntry->scaleY = 128; @@ -219,11 +219,11 @@ void GfxAnimate::fill(byte &old_picNotValid) { // adjust loop and cel, if any of those is invalid if (listEntry->loopNo >= view->getLoopCount()) { listEntry->loopNo = 0; - PUT_SEL32V(_s->_segMan, curObject, loop, listEntry->loopNo); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(loop), listEntry->loopNo); } if (listEntry->celNo >= view->getCelCount(listEntry->loopNo)) { listEntry->celNo = 0; - PUT_SEL32V(_s->_segMan, curObject, cel, listEntry->celNo); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(cel), listEntry->celNo); } // Create rect according to coordinates and given cel @@ -232,17 +232,17 @@ void GfxAnimate::fill(byte &old_picNotValid) { } else { view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, &listEntry->celRect); } - PUT_SEL32V(_s->_segMan, curObject, nsLeft, listEntry->celRect.left); - PUT_SEL32V(_s->_segMan, curObject, nsTop, listEntry->celRect.top); - PUT_SEL32V(_s->_segMan, curObject, nsRight, listEntry->celRect.right); - PUT_SEL32V(_s->_segMan, curObject, nsBottom, listEntry->celRect.bottom); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsLeft), listEntry->celRect.left); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsTop), listEntry->celRect.top); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsRight), listEntry->celRect.right); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsBottom), listEntry->celRect.bottom); signal = listEntry->signal; // Calculate current priority according to y-coordinate if (!(signal & kSignalFixedPriority)) { listEntry->priority = _ports->kernelCoordinateToPriority(listEntry->y); - PUT_SEL32V(_s->_segMan, curObject, priority, listEntry->priority); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(priority), listEntry->priority); } if (signal & kSignalNoUpdate) { @@ -282,14 +282,14 @@ void GfxAnimate::update() { if (signal & kSignalNoUpdate) { if (!(signal & kSignalRemoveView)) { - bitsHandle = GET_SEL32(_s->_segMan, curObject, underBits); + bitsHandle = GET_SEL32(_s->_segMan, curObject, SELECTOR(underBits)); if (_screen->_picNotValid != 1) { _paint16->bitsRestore(bitsHandle); listEntry->showBitsFlag = true; } else { _paint16->bitsFree(bitsHandle); } - PUT_SEL32V(_s->_segMan, curObject, underBits, 0); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(underBits), 0); } signal &= 0xFFFF ^ kSignalForceUpdate; signal &= signal & kSignalViewUpdated ? 0xFFFF ^ (kSignalViewUpdated | kSignalNoUpdate) : 0xFFFF; @@ -339,7 +339,7 @@ void GfxAnimate::update() { bitsHandle = _paint16->bitsSave(listEntry->celRect, SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY); else bitsHandle = _paint16->bitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL); - PUT_SEL32(_s->_segMan, curObject, underBits, bitsHandle); + PUT_SEL32(_s->_segMan, curObject, SELECTOR(underBits), bitsHandle); } listEntry->signal = signal; } @@ -387,7 +387,7 @@ void GfxAnimate::drawCels() { if (!(signal & (kSignalNoUpdate | kSignalHidden | kSignalAlwaysUpdate))) { // Save background bitsHandle = _paint16->bitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL); - PUT_SEL32(_s->_segMan, curObject, underBits, bitsHandle); + PUT_SEL32(_s->_segMan, curObject, SELECTOR(underBits), bitsHandle); // draw corresponding cel _paint16->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, listEntry->scaleX, listEntry->scaleY); @@ -423,10 +423,10 @@ void GfxAnimate::updateScreen(byte oldPicNotValid) { if (listEntry->showBitsFlag || !(signal & (kSignalRemoveView | kSignalNoUpdate) || (!(signal & kSignalRemoveView) && (signal & kSignalNoUpdate) && oldPicNotValid))) { - lsRect.left = GET_SEL32V(_s->_segMan, curObject, lsLeft); - lsRect.top = GET_SEL32V(_s->_segMan, curObject, lsTop); - lsRect.right = GET_SEL32V(_s->_segMan, curObject, lsRight); - lsRect.bottom = GET_SEL32V(_s->_segMan, curObject, lsBottom); + lsRect.left = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsLeft)); + lsRect.top = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsTop)); + lsRect.right = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsRight)); + lsRect.bottom = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsBottom)); workerRect = lsRect; workerRect.clip(listEntry->celRect); @@ -438,10 +438,10 @@ void GfxAnimate::updateScreen(byte oldPicNotValid) { _paint16->bitsShow(lsRect); workerRect = listEntry->celRect; } - PUT_SEL32V(_s->_segMan, curObject, lsLeft, workerRect.left); - PUT_SEL32V(_s->_segMan, curObject, lsTop, workerRect.top); - PUT_SEL32V(_s->_segMan, curObject, lsRight, workerRect.right); - PUT_SEL32V(_s->_segMan, curObject, lsBottom, workerRect.bottom); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsLeft), workerRect.left); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsTop), workerRect.top); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsRight), workerRect.right); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsBottom), workerRect.bottom); _paint16->bitsShow(workerRect); if (signal & kSignalHidden) { @@ -472,7 +472,7 @@ void GfxAnimate::restoreAndDelete(int argc, reg_t *argv) { signal = listEntry->signal; // Finally update signal - PUT_SEL32V(_s->_segMan, curObject, signal, signal); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(signal), signal); listIterator++; } @@ -481,11 +481,11 @@ void GfxAnimate::restoreAndDelete(int argc, reg_t *argv) { listEntry = *listIterator; curObject = listEntry->object; // We read out signal here again, this is not by accident but to ensure that we got an up-to-date signal - signal = GET_SEL32V(_s->_segMan, curObject, signal); + signal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(signal)); if ((signal & (kSignalNoUpdate | kSignalRemoveView)) == 0) { - _paint16->bitsRestore(GET_SEL32(_s->_segMan, curObject, underBits)); - PUT_SEL32V(_s->_segMan, curObject, underBits, 0); + _paint16->bitsRestore(GET_SEL32(_s->_segMan, curObject, SELECTOR(underBits))); + PUT_SEL32V(_s->_segMan, curObject, SELECTOR(underBits), 0); } if (signal & kSignalDisposeMe) { diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp index 82a5d04c44..f3d7e4b6cc 100644 --- a/engines/sci/graphics/compare.cpp +++ b/engines/sci/graphics/compare.cpp @@ -86,14 +86,17 @@ bool GfxCompare::canBeHereCheckRectList(reg_t checkObject, Common::Rect checkRec while (curNode) { curObject = curNode->value; if (curObject != checkObject) { - signal = GET_SEL32V(_segMan, curObject, signal); + signal = GET_SEL32V(_segMan, curObject, SELECTOR(signal)); if ((signal & (kSignalIgnoreActor | kSignalRemoveView | kSignalNoUpdate)) == 0) { - curRect.left = GET_SEL32V(_segMan, curObject, brLeft); - curRect.top = GET_SEL32V(_segMan, curObject, brTop); - curRect.right = GET_SEL32V(_segMan, curObject, brRight); - curRect.bottom = GET_SEL32V(_segMan, curObject, brBottom); + curRect.left = GET_SEL32V(_segMan, curObject, SELECTOR(brLeft)); + curRect.top = GET_SEL32V(_segMan, curObject, SELECTOR(brTop)); + curRect.right = GET_SEL32V(_segMan, curObject, SELECTOR(brRight)); + curRect.bottom = GET_SEL32V(_segMan, curObject, SELECTOR(brBottom)); // Check if curRect is within checkRect - if (curRect.right > checkRect.left && curRect.left < checkRect.right && curRect.bottom > checkRect.top && curRect.top < checkRect.bottom) { + if (curRect.right > checkRect.left && + curRect.left < checkRect.right && + curRect.bottom > checkRect.top && + curRect.top < checkRect.bottom) { return false; } } @@ -114,14 +117,14 @@ uint16 GfxCompare::kernelOnControl(byte screenMask, Common::Rect rect) { void GfxCompare::kernelSetNowSeen(reg_t objectReference) { GfxView *view = NULL; Common::Rect celRect(0, 0); - GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, view); - int16 loopNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, loop)); - int16 celNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, cel)); - int16 x = (int16)GET_SEL32V(_segMan, objectReference, x); - int16 y = (int16)GET_SEL32V(_segMan, objectReference, y); + GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, SELECTOR(view)); + int16 loopNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, SELECTOR(loop))); + int16 celNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, SELECTOR(cel))); + int16 x = (int16)GET_SEL32V(_segMan, objectReference, SELECTOR(x)); + int16 y = (int16)GET_SEL32V(_segMan, objectReference, SELECTOR(y)); int16 z = 0; if (_kernel->_selectorCache.z > -1) - z = (int16)GET_SEL32V(_segMan, objectReference, z); + z = (int16)GET_SEL32V(_segMan, objectReference, SELECTOR(z)); // now get cel rectangle view = _cache->getView(viewId); @@ -129,10 +132,10 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) { // TODO: sometimes loop is negative. Check what it means if (lookup_selector(_segMan, objectReference, _kernel->_selectorCache.nsTop, NULL, NULL) == kSelectorVariable) { - PUT_SEL32V(_segMan, objectReference, nsLeft, celRect.left); - PUT_SEL32V(_segMan, objectReference, nsRight, celRect.right); - PUT_SEL32V(_segMan, objectReference, nsTop, celRect.top); - PUT_SEL32V(_segMan, objectReference, nsBottom, celRect.bottom); + PUT_SEL32V(_segMan, objectReference, SELECTOR(nsLeft), celRect.left); + PUT_SEL32V(_segMan, objectReference, SELECTOR(nsRight), celRect.right); + PUT_SEL32V(_segMan, objectReference, SELECTOR(nsTop), celRect.top); + PUT_SEL32V(_segMan, objectReference, SELECTOR(nsBottom), celRect.bottom); } } @@ -142,15 +145,15 @@ bool GfxCompare::kernelCanBeHere(reg_t curObject, reg_t listReference) { uint16 signal, controlMask; bool result; - checkRect.left = GET_SEL32V(_segMan, curObject, brLeft); - checkRect.top = GET_SEL32V(_segMan, curObject, brTop); - checkRect.right = GET_SEL32V(_segMan, curObject, brRight); - checkRect.bottom = GET_SEL32V(_segMan, curObject, brBottom); + checkRect.left = GET_SEL32V(_segMan, curObject, SELECTOR(brLeft)); + checkRect.top = GET_SEL32V(_segMan, curObject, SELECTOR(brTop)); + checkRect.right = GET_SEL32V(_segMan, curObject, SELECTOR(brRight)); + checkRect.bottom = GET_SEL32V(_segMan, curObject, SELECTOR(brBottom)); adjustedRect = _coordAdjuster->onControl(checkRect); - signal = GET_SEL32V(_segMan, curObject, signal); - controlMask = GET_SEL32V(_segMan, curObject, illegalBits); + signal = GET_SEL32V(_segMan, curObject, SELECTOR(signal)); + controlMask = GET_SEL32V(_segMan, curObject, SELECTOR(illegalBits)); result = (isOnControl(SCI_SCREEN_MASK_CONTROL, adjustedRect) & controlMask) ? false : true; if ((result) && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) { List *list = _segMan->lookupList(listReference); @@ -174,13 +177,13 @@ bool GfxCompare::kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, void GfxCompare::kernelBaseSetter(reg_t object) { if (lookup_selector(_segMan, object, _kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) { - int16 x = GET_SEL32V(_segMan, object, x); - int16 y = GET_SEL32V(_segMan, object, y); - int16 z = (_kernel->_selectorCache.z > -1) ? GET_SEL32V(_segMan, object, z) : 0; - int16 yStep = GET_SEL32V(_segMan, object, yStep); - GuiResourceId viewId = GET_SEL32V(_segMan, object, view); - int16 loopNo = GET_SEL32V(_segMan, object, loop); - int16 celNo = GET_SEL32V(_segMan, object, cel); + int16 x = GET_SEL32V(_segMan, object, SELECTOR(x)); + int16 y = GET_SEL32V(_segMan, object, SELECTOR(y)); + int16 z = (_kernel->_selectorCache.z > -1) ? GET_SEL32V(_segMan, object, SELECTOR(z)) : 0; + int16 yStep = GET_SEL32V(_segMan, object, SELECTOR(yStep)); + GuiResourceId viewId = GET_SEL32V(_segMan, object, SELECTOR(view)); + int16 loopNo = GET_SEL32V(_segMan, object, SELECTOR(loop)); + int16 celNo = GET_SEL32V(_segMan, object, SELECTOR(cel)); GfxView *tmpView = _cache->getView(viewId); Common::Rect celRect; @@ -189,10 +192,10 @@ void GfxCompare::kernelBaseSetter(reg_t object) { celRect.bottom = y + 1; celRect.top = celRect.bottom - yStep; - PUT_SEL32V(_segMan, object, brLeft, celRect.left); - PUT_SEL32V(_segMan, object, brRight, celRect.right); - PUT_SEL32V(_segMan, object, brTop, celRect.top); - PUT_SEL32V(_segMan, object, brBottom, celRect.bottom); + PUT_SEL32V(_segMan, object, SELECTOR(brLeft), celRect.left); + PUT_SEL32V(_segMan, object, SELECTOR(brRight), celRect.right); + PUT_SEL32V(_segMan, object, SELECTOR(brTop), celRect.top); + PUT_SEL32V(_segMan, object, SELECTOR(brBottom), celRect.bottom); } } diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls.cpp index 7bfe050db9..5572d04ec5 100644 --- a/engines/sci/graphics/controls.cpp +++ b/engines/sci/graphics/controls.cpp @@ -142,9 +142,9 @@ void GfxControls::texteditSetBlinkTime() { } void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) { - uint16 cursorPos = GET_SEL32V(_segMan, controlObject, cursor); - uint16 maxChars = GET_SEL32V(_segMan, controlObject, max); - reg_t textReference = GET_SEL32(_segMan, controlObject, text); + uint16 cursorPos = GET_SEL32V(_segMan, controlObject, SELECTOR(cursor)); + uint16 maxChars = GET_SEL32V(_segMan, controlObject, SELECTOR(max)); + reg_t textReference = GET_SEL32(_segMan, controlObject, SELECTOR(text)); Common::String text; uint16 textSize, eventType, eventKey; bool textChanged = false; @@ -156,14 +156,14 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) { if (!eventObject.isNull()) { textSize = text.size(); - eventType = GET_SEL32V(_segMan, eventObject, type); + eventType = GET_SEL32V(_segMan, eventObject, SELECTOR(type)); switch (eventType) { case SCI_EVENT_MOUSE_PRESS: // TODO: Implement mouse support for cursor change break; case SCI_EVENT_KEYBOARD: - eventKey = GET_SEL32V(_segMan, eventObject, message); + eventKey = GET_SEL32V(_segMan, eventObject, SELECTOR(message)); switch (eventKey) { case SCI_KEY_BACKSPACE: if (cursorPos > 0) { @@ -207,9 +207,9 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) { if (textChanged) { GuiResourceId oldFontId = _text16->GetFontId(); - GuiResourceId fontId = GET_SEL32V(_segMan, controlObject, font); - rect = Common::Rect(GET_SEL32V(_segMan, controlObject, nsLeft), GET_SEL32V(_segMan, controlObject, nsTop), - GET_SEL32V(_segMan, controlObject, nsRight), GET_SEL32V(_segMan, controlObject, nsBottom)); + GuiResourceId fontId = GET_SEL32V(_segMan, controlObject, SELECTOR(font)); + rect = Common::Rect(GET_SEL32V(_segMan, controlObject, SELECTOR(nsLeft)), GET_SEL32V(_segMan, controlObject, SELECTOR(nsTop)), + GET_SEL32V(_segMan, controlObject, SELECTOR(nsRight)), GET_SEL32V(_segMan, controlObject, SELECTOR(nsBottom))); texteditCursorErase(); _paint16->eraseRect(rect); _text16->Box(text.c_str(), 0, rect, SCI_TEXT16_ALIGNMENT_LEFT, fontId); @@ -228,7 +228,7 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) { } } - PUT_SEL32V(_segMan, controlObject, cursor, cursorPos); + PUT_SEL32V(_segMan, controlObject, SELECTOR(cursor), cursorPos); } int GfxControls::getPicNotValid() { diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp index 3c9e30c8c8..48f6d0161c 100644 --- a/engines/sci/graphics/coordadjuster.cpp +++ b/engines/sci/graphics/coordadjuster.cpp @@ -87,18 +87,18 @@ GfxCoordAdjuster32::~GfxCoordAdjuster32() { } void GfxCoordAdjuster32::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) { - //int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY); - //int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX); + //int16 resY = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resY)); + //int16 resX = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resX)); //*x = ( *x * _screen->getWidth()) / resX; //*y = ( *y * _screen->getHeight()) / resY; - x -= GET_SEL32V(_segMan, planeObject, left); - y -= GET_SEL32V(_segMan, planeObject, top); + x -= GET_SEL32V(_segMan, planeObject, SELECTOR(left)); + y -= GET_SEL32V(_segMan, planeObject, SELECTOR(top)); } void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) { - //int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY); - //int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX); - x += GET_SEL32V(_segMan, planeObject, left); - y += GET_SEL32V(_segMan, planeObject, top); + //int16 resY = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resY)); + //int16 resX = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resX)); + x += GET_SEL32V(_segMan, planeObject, SELECTOR(left)); + y += GET_SEL32V(_segMan, planeObject, SELECTOR(top)); //*x = ( *x * resX) / _screen->getWidth(); //*y = ( *y * resY) / _screen->getHeight(); } diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index b00776fda9..f8f44ca1c4 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -52,7 +52,7 @@ GfxFrameout::~GfxFrameout() { void GfxFrameout::kernelAddPlane(reg_t object) { _planes.push_back(object); - int16 planePri = GET_SEL32V(_segMan, object, priority) & 0xFFFF; + int16 planePri = GET_SEL32V(_segMan, object, SELECTOR(priority)) & 0xFFFF; if (planePri > _highPlanePri) _highPlanePri = planePri; } @@ -72,7 +72,7 @@ void GfxFrameout::kernelDeletePlane(reg_t object) { _highPlanePri = 0; for (uint32 planeNr = 0; planeNr < _planes.size(); planeNr++) { - int16 planePri = GET_SEL32V(_segMan, _planes[planeNr], priority) & 0xFFFF; + int16 planePri = GET_SEL32V(_segMan, _planes[planeNr], SELECTOR(priority)) & 0xFFFF; if (planePri > _highPlanePri) _highPlanePri = planePri; } @@ -124,29 +124,29 @@ void GfxFrameout::kernelFrameout() { for (uint32 planeNr = 0; planeNr < _planes.size(); planeNr++) { planeObject = _planes[planeNr]; - planePriority = GET_SEL32V(_segMan, planeObject, priority); + planePriority = GET_SEL32V(_segMan, planeObject, SELECTOR(priority)); if (planePriority == -1) // Plane currently not meant to be shown continue; - planeRect.top = GET_SEL32V(_segMan, planeObject, top); - planeRect.left = GET_SEL32V(_segMan, planeObject, left); - planeRect.bottom = GET_SEL32V(_segMan, planeObject, bottom); - planeRect.right = GET_SEL32V(_segMan, planeObject, right); - planeResY = GET_SEL32V(_segMan, planeObject, resY); - planeResX = GET_SEL32V(_segMan, planeObject, resX); + planeRect.top = GET_SEL32V(_segMan, planeObject, SELECTOR(top)); + planeRect.left = GET_SEL32V(_segMan, planeObject, SELECTOR(left)); + planeRect.bottom = GET_SEL32V(_segMan, planeObject, SELECTOR(bottom)); + planeRect.right = GET_SEL32V(_segMan, planeObject, SELECTOR(right)); + planeResY = GET_SEL32V(_segMan, planeObject, SELECTOR(resY)); + planeResX = GET_SEL32V(_segMan, planeObject, SELECTOR(resX)); planeRect.top = (planeRect.top * _screen->getHeight()) / planeResY; planeRect.left = (planeRect.left * _screen->getWidth()) / planeResX; planeRect.bottom = (planeRect.bottom * _screen->getHeight()) / planeResY; planeRect.right = (planeRect.right * _screen->getWidth()) / planeResX; - planeBack = GET_SEL32V(_segMan, planeObject, back); + planeBack = GET_SEL32V(_segMan, planeObject, SELECTOR(back)); if (planeBack) { _paint32->fillRect(planeRect, planeBack); } - planePictureNr = GET_SEL32V(_segMan, planeObject, picture); + planePictureNr = GET_SEL32V(_segMan, planeObject, SELECTOR(picture)); if ((planePictureNr != 0xFFFF) && (planePictureNr != 0xFFFE)) { planePicture = new GfxPicture(_resMan, 0, _screen, _palette, planePictureNr, false); planePictureCels = planePicture->getSci32celCount(); @@ -157,19 +157,19 @@ void GfxFrameout::kernelFrameout() { itemEntry = itemData; for (uint32 itemNr = 0; itemNr < _screenItems.size(); itemNr++) { itemObject = _screenItems[itemNr]; - itemPlane = GET_SEL32(_segMan, itemObject, plane); + itemPlane = GET_SEL32(_segMan, itemObject, SELECTOR(plane)); if (planeObject == itemPlane) { // Found an item on current plane - itemEntry->viewId = GET_SEL32V(_segMan, itemObject, view); - itemEntry->loopNo = GET_SEL32V(_segMan, itemObject, loop); - itemEntry->celNo = GET_SEL32V(_segMan, itemObject, cel); - itemEntry->x = GET_SEL32V(_segMan, itemObject, x); - itemEntry->y = GET_SEL32V(_segMan, itemObject, y); - itemEntry->z = GET_SEL32V(_segMan, itemObject, z); - itemEntry->priority = GET_SEL32V(_segMan, itemObject, priority); - itemEntry->signal = GET_SEL32V(_segMan, itemObject, signal); - itemEntry->scaleX = GET_SEL32V(_segMan, itemObject, scaleX); - itemEntry->scaleY = GET_SEL32V(_segMan, itemObject, scaleY); + itemEntry->viewId = GET_SEL32V(_segMan, itemObject, SELECTOR(view)); + itemEntry->loopNo = GET_SEL32V(_segMan, itemObject, SELECTOR(loop)); + itemEntry->celNo = GET_SEL32V(_segMan, itemObject, SELECTOR(cel)); + itemEntry->x = GET_SEL32V(_segMan, itemObject, SELECTOR(x)); + itemEntry->y = GET_SEL32V(_segMan, itemObject, SELECTOR(y)); + itemEntry->z = GET_SEL32V(_segMan, itemObject, SELECTOR(z)); + itemEntry->priority = GET_SEL32V(_segMan, itemObject, SELECTOR(priority)); + itemEntry->signal = GET_SEL32V(_segMan, itemObject, SELECTOR(signal)); + itemEntry->scaleX = GET_SEL32V(_segMan, itemObject, SELECTOR(scaleX)); + itemEntry->scaleY = GET_SEL32V(_segMan, itemObject, SELECTOR(scaleY)); itemEntry->object = itemObject; itemEntry->y = ((itemEntry->y * _screen->getHeight()) / planeResY); @@ -235,11 +235,11 @@ void GfxFrameout::kernelFrameout() { // TODO: rewrite this the "SCI2" way (i.e. implement the text buffer to draw inside kCreateTextBitmap) Kernel *kernel = ((SciEngine *)g_engine)->getKernel(); if (lookup_selector(_segMan, itemEntry->object, kernel->_selectorCache.text, NULL, NULL) == kSelectorVariable) { - Common::String text = _segMan->getString(GET_SEL32(_segMan, itemEntry->object, text)); - int16 fontRes = GET_SEL32V(_segMan, itemEntry->object, font); + Common::String text = _segMan->getString(GET_SEL32(_segMan, itemEntry->object, SELECTOR(text))); + int16 fontRes = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(font)); GfxFont *font = new GfxFont(_resMan, _screen, fontRes); - bool dimmed = GET_SEL32V(_segMan, itemEntry->object, dimmed); - uint16 foreColor = GET_SEL32V(_segMan, itemEntry->object, fore); + bool dimmed = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(dimmed)); + uint16 foreColor = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(fore)); uint16 curX = itemEntry->x; uint16 curY = itemEntry->y; for (uint32 i = 0; i < text.size(); i++) { diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp index ead575fc80..b5f4335b59 100644 --- a/engines/sci/graphics/menu.cpp +++ b/engines/sci/graphics/menu.cpp @@ -352,7 +352,7 @@ void GfxMenu::calculateTextWidth() { } reg_t GfxMenu::kernelSelect(reg_t eventObject) { - int16 eventType = GET_SEL32V(_segMan, eventObject, type); + int16 eventType = GET_SEL32V(_segMan, eventObject, SELECTOR(type)); int16 keyPress, keyModifier; Common::Point mousePosition; GuiMenuItemList::iterator itemIterator = _itemList.begin(); @@ -364,8 +364,8 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject) { switch (eventType) { case SCI_EVENT_KEYBOARD: - keyPress = GET_SEL32V(_segMan, eventObject, message); - keyModifier = GET_SEL32V(_segMan, eventObject, modifiers); + keyPress = GET_SEL32V(_segMan, eventObject, SELECTOR(message)); + keyModifier = GET_SEL32V(_segMan, eventObject, SELECTOR(modifiers)); switch (keyPress) { case 0: break; @@ -434,7 +434,7 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject) { _ports->setPort(_oldPort); if ((itemEntry) || (forceClaimed)) - PUT_SEL32(_segMan, eventObject, claimed, make_reg(0, 1)); + PUT_SEL32(_segMan, eventObject, SELECTOR(claimed), make_reg(0, 1)); if (itemEntry) return make_reg(0, (itemEntry->menuId << 8) | (itemEntry->id)); return NULL_REG; -- cgit v1.2.3