aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gui')
-rw-r--r--engines/sci/gui/gui.cpp15
-rw-r--r--engines/sci/gui/gui_animate.cpp64
-rw-r--r--engines/sci/gui/gui_gfx.cpp48
3 files changed, 63 insertions, 64 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 5933a81b2e..96f15bab09 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -407,8 +407,7 @@ void SciGui::drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16
}
void SciGui::editControl(reg_t controlObject, reg_t eventObject) {
- SegManager *segMan = _s->_segMan;
- int16 controlType = GET_SEL32V(controlObject, type);
+ int16 controlType = GET_SEL32V(_s->_segMan, controlObject, type);
switch (controlType) {
case SCI_CONTROLS_TYPE_TEXTEDIT:
@@ -586,12 +585,12 @@ bool SciGui::canBeHere(reg_t curObject, reg_t listReference) {
uint16 signal, controlMask;
bool result;
- checkRect.left = GET_SEL32V(curObject, brLeft);
- checkRect.top = GET_SEL32V(curObject, brTop);
- checkRect.right = GET_SEL32V(curObject, brRight);
- checkRect.bottom = GET_SEL32V(curObject, brBottom);
- signal = GET_SEL32V(curObject, signal);
- controlMask = GET_SEL32V(curObject, illegalBits);
+ 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);
+ signal = GET_SEL32V(segMan, curObject, signal);
+ controlMask = GET_SEL32V(segMan, curObject, illegalBits);
result = (_gfx->onControl(SCI_SCREEN_MASK_CONTROL, checkRect) & controlMask) ? false : true;
if ((result) && (signal & (SCI_ANIMATE_SIGNAL_IGNOREACTOR | SCI_ANIMATE_SIGNAL_REMOVEVIEW)) == 0) {
List *list = _s->_segMan->lookupList(listReference);
diff --git a/engines/sci/gui/gui_animate.cpp b/engines/sci/gui/gui_animate.cpp
index fffee8bbfc..9ca3ab58ed 100644
--- a/engines/sci/gui/gui_animate.cpp
+++ b/engines/sci/gui/gui_animate.cpp
@@ -65,7 +65,7 @@ void SciGuiAnimate::invoke(List *list, int argc, reg_t *argv) {
while (curNode) {
curObject = curNode->value;
- signal = GET_SEL32V(curObject, signal);
+ signal = GET_SEL32V(segMan, curObject, signal);
if (!(signal & SCI_ANIMATE_SIGNAL_FROZEN)) {
// Call .doit method of that object
invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argv, argc, __FILE__, __LINE__, 0);
@@ -121,15 +121,15 @@ void SciGuiAnimate::makeSortedList(List *list) {
listEntry->object = curObject;
// Get data from current object
- listEntry->viewId = GET_SEL32V(curObject, view);
- listEntry->loopNo = GET_SEL32V(curObject, loop);
- listEntry->celNo = GET_SEL32V(curObject, cel);
- listEntry->paletteNo = GET_SEL32V(curObject, palette);
- listEntry->x = GET_SEL32V(curObject, x);
- listEntry->y = GET_SEL32V(curObject, y);
- listEntry->z = GET_SEL32V(curObject, z);
- listEntry->priority = GET_SEL32V(curObject, priority);
- listEntry->signal = GET_SEL32V(curObject, signal);
+ listEntry->viewId = GET_SEL32V(segMan, curObject, view);
+ listEntry->loopNo = GET_SEL32V(segMan, curObject, loop);
+ listEntry->celNo = GET_SEL32V(segMan, curObject, cel);
+ listEntry->paletteNo = GET_SEL32V(segMan, curObject, palette);
+ listEntry->x = GET_SEL32V(segMan, curObject, x);
+ listEntry->y = GET_SEL32V(segMan, curObject, y);
+ listEntry->z = GET_SEL32V(segMan, curObject, z);
+ listEntry->priority = GET_SEL32V(segMan, curObject, priority);
+ listEntry->signal = GET_SEL32V(segMan, curObject, signal);
// listEntry->celRect is filled in AnimateFill()
listEntry->showBitsFlag = false;
@@ -167,26 +167,26 @@ void SciGuiAnimate::fill(byte &old_picNotValid) {
// adjust loop and cel, if any of those is invalid
if (listEntry->loopNo >= view->getLoopCount()) {
listEntry->loopNo = 0;
- PUT_SEL32V(curObject, loop, listEntry->loopNo);
+ PUT_SEL32V(segMan, curObject, loop, listEntry->loopNo);
}
if (listEntry->celNo >= view->getCelCount(listEntry->loopNo)) {
listEntry->celNo = 0;
- PUT_SEL32V(curObject, cel, listEntry->celNo);
+ PUT_SEL32V(segMan, curObject, cel, listEntry->celNo);
}
// Create rect according to coordinates and given cel
view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, &listEntry->celRect);
- PUT_SEL32V(curObject, nsLeft, listEntry->celRect.left);
- PUT_SEL32V(curObject, nsTop, listEntry->celRect.top);
- PUT_SEL32V(curObject, nsRight, listEntry->celRect.right);
- PUT_SEL32V(curObject, nsBottom, listEntry->celRect.bottom);
+ PUT_SEL32V(segMan, curObject, nsLeft, listEntry->celRect.left);
+ PUT_SEL32V(segMan, curObject, nsTop, listEntry->celRect.top);
+ PUT_SEL32V(segMan, curObject, nsRight, listEntry->celRect.right);
+ PUT_SEL32V(segMan, curObject, nsBottom, listEntry->celRect.bottom);
signal = listEntry->signal;
// Calculate current priority according to y-coordinate
if (!(signal & SCI_ANIMATE_SIGNAL_FIXEDPRIORITY)) {
listEntry->priority = _gfx->CoordinateToPriority(listEntry->y);
- PUT_SEL32V(curObject, priority, listEntry->priority);
+ PUT_SEL32V(segMan, curObject, priority, listEntry->priority);
}
if (signal & SCI_ANIMATE_SIGNAL_NOUPDATE) {
@@ -229,14 +229,14 @@ void SciGuiAnimate::update() {
if (signal & SCI_ANIMATE_SIGNAL_NOUPDATE) {
if (!(signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW)) {
- bitsHandle = GET_SEL32(curObject, underBits);
+ bitsHandle = GET_SEL32(segMan, curObject, underBits);
if (_screen->_picNotValid != 1) {
_gfx->BitsRestore(bitsHandle);
listEntry->showBitsFlag = true;
} else {
_gfx->BitsFree(bitsHandle);
}
- PUT_SEL32V(curObject, underBits, 0);
+ PUT_SEL32V(segMan, curObject, underBits, 0);
}
signal &= 0xFFFF ^ SCI_ANIMATE_SIGNAL_FORCEUPDATE;
signal &= signal & SCI_ANIMATE_SIGNAL_VIEWUPDATED ? 0xFFFF ^ (SCI_ANIMATE_SIGNAL_VIEWUPDATED | SCI_ANIMATE_SIGNAL_NOUPDATE) : 0xFFFF;
@@ -286,7 +286,7 @@ void SciGuiAnimate::update() {
bitsHandle = _gfx->BitsSave(listEntry->celRect, SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY);
else
bitsHandle = _gfx->BitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL);
- PUT_SEL32(curObject, underBits, bitsHandle);
+ PUT_SEL32(segMan, curObject, underBits, bitsHandle);
}
listEntry->signal = signal;
}
@@ -333,7 +333,7 @@ void SciGuiAnimate::drawCels() {
if (!(signal & (SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_HIDDEN | SCI_ANIMATE_SIGNAL_ALWAYSUPDATE))) {
// Save background
bitsHandle = _gfx->BitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL);
- PUT_SEL32(curObject, underBits, bitsHandle);
+ PUT_SEL32(segMan, curObject, underBits, bitsHandle);
// draw corresponding cel
_gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo);
@@ -377,10 +377,10 @@ void SciGuiAnimate::updateScreen(byte oldPicNotValid) {
if (listEntry->showBitsFlag || !(signal & (SCI_ANIMATE_SIGNAL_REMOVEVIEW | SCI_ANIMATE_SIGNAL_NOUPDATE) ||
(!(signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW) && (signal & SCI_ANIMATE_SIGNAL_NOUPDATE) && oldPicNotValid))) {
- lsRect.left = GET_SEL32V(curObject, lsLeft);
- lsRect.top = GET_SEL32V(curObject, lsTop);
- lsRect.right = GET_SEL32V(curObject, lsRight);
- lsRect.bottom = GET_SEL32V(curObject, lsBottom);
+ lsRect.left = GET_SEL32V(segMan, curObject, lsLeft);
+ lsRect.top = GET_SEL32V(segMan, curObject, lsTop);
+ lsRect.right = GET_SEL32V(segMan, curObject, lsRight);
+ lsRect.bottom = GET_SEL32V(segMan, curObject, lsBottom);
workerRect = lsRect;
workerRect.clip(listEntry->celRect);
@@ -392,10 +392,10 @@ void SciGuiAnimate::updateScreen(byte oldPicNotValid) {
_gfx->BitsShow(lsRect);
workerRect = listEntry->celRect;
}
- PUT_SEL32V(curObject, lsLeft, workerRect.left);
- PUT_SEL32V(curObject, lsTop, workerRect.top);
- PUT_SEL32V(curObject, lsRight, workerRect.right);
- PUT_SEL32V(curObject, lsBottom, workerRect.bottom);
+ PUT_SEL32V(segMan, curObject, lsLeft, workerRect.left);
+ PUT_SEL32V(segMan, curObject, lsTop, workerRect.top);
+ PUT_SEL32V(segMan, curObject, lsRight, workerRect.right);
+ PUT_SEL32V(segMan, curObject, lsBottom, workerRect.bottom);
_gfx->BitsShow(workerRect);
if (signal & SCI_ANIMATE_SIGNAL_HIDDEN) {
@@ -424,12 +424,12 @@ void SciGuiAnimate::restoreAndDelete(int argc, reg_t *argv) {
signal = listEntry->signal;
if ((signal & (SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_REMOVEVIEW)) == 0) {
- _gfx->BitsRestore(GET_SEL32(curObject, underBits));
- PUT_SEL32V(curObject, underBits, 0);
+ _gfx->BitsRestore(GET_SEL32(segMan, curObject, underBits));
+ PUT_SEL32V(segMan, curObject, underBits, 0);
}
// Finally update signal
- PUT_SEL32V(curObject, signal, signal);
+ PUT_SEL32V(segMan, curObject, signal, signal);
if (signal & SCI_ANIMATE_SIGNAL_DISPOSEME) {
// Call .delete_ method of that object
diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp
index 83fcad241a..2a4681e18a 100644
--- a/engines/sci/gui/gui_gfx.cpp
+++ b/engines/sci/gui/gui_gfx.cpp
@@ -827,9 +827,9 @@ void SciGuiGfx::TexteditSetBlinkTime() {
void SciGuiGfx::TexteditChange(reg_t controlObject, reg_t eventObject) {
SegManager *segMan = _s->_segMan;
- uint16 cursorPos = GET_SEL32V(controlObject, cursor);
- uint16 maxChars = GET_SEL32V(controlObject, max);
- reg_t textReference = GET_SEL32(controlObject, text);
+ uint16 cursorPos = GET_SEL32V(segMan, controlObject, cursor);
+ uint16 maxChars = GET_SEL32V(segMan, controlObject, max);
+ reg_t textReference = GET_SEL32(segMan, controlObject, text);
Common::String text;
uint16 textSize, eventType, eventKey;
bool textChanged = false;
@@ -840,14 +840,14 @@ void SciGuiGfx::TexteditChange(reg_t controlObject, reg_t eventObject) {
if (!eventObject.isNull()) {
textSize = text.size();
- eventType = GET_SEL32V(eventObject, type);
+ eventType = GET_SEL32V(segMan, eventObject, type);
switch (eventType) {
case SCI_EVT_MOUSE_PRESS:
// TODO: Implement mouse support for cursor change
break;
case SCI_EVT_KEYBOARD:
- eventKey = GET_SEL32V(eventObject, message);
+ eventKey = GET_SEL32V(segMan, eventObject, message);
switch (eventKey) {
case SCI_K_BACKSPACE:
if (cursorPos > 0) {
@@ -888,10 +888,10 @@ void SciGuiGfx::TexteditChange(reg_t controlObject, reg_t eventObject) {
if (textChanged) {
GuiResourceId oldFontId = GetFontId();
- GuiResourceId fontId = GET_SEL32V(controlObject, font);
+ GuiResourceId fontId = GET_SEL32V(segMan, controlObject, font);
Common::Rect rect;
- rect = Common::Rect (GET_SEL32V(controlObject, nsLeft), GET_SEL32V(controlObject, nsTop),
- GET_SEL32V(controlObject, nsRight), GET_SEL32V(controlObject, nsBottom));
+ rect = Common::Rect(GET_SEL32V(segMan, controlObject, nsLeft), GET_SEL32V(segMan, controlObject, nsTop),
+ GET_SEL32V(segMan, controlObject, nsRight), GET_SEL32V(segMan, controlObject, nsBottom));
rect.top++;
TexteditCursorErase();
EraseRect(rect);
@@ -912,7 +912,7 @@ void SciGuiGfx::TexteditChange(reg_t controlObject, reg_t eventObject) {
}
}
- PUT_SEL32V(controlObject, cursor, cursorPos);
+ PUT_SEL32V(segMan, controlObject, cursor, cursorPos);
}
uint16 SciGuiGfx::onControl(uint16 screenMask, Common::Rect rect) {
@@ -1011,12 +1011,12 @@ bool SciGuiGfx::CanBeHereCheckRectList(reg_t checkObject, Common::Rect checkRect
while (curNode) {
curObject = curNode->value;
if (curObject != checkObject) {
- signal = GET_SEL32V(curObject, signal);
+ signal = GET_SEL32V(segMan, curObject, signal);
if ((signal & (SCI_ANIMATE_SIGNAL_IGNOREACTOR | SCI_ANIMATE_SIGNAL_REMOVEVIEW | SCI_ANIMATE_SIGNAL_NOUPDATE)) == 0) {
- curRect.left = GET_SEL32V(curObject, brLeft);
- curRect.top = GET_SEL32V(curObject, brTop);
- curRect.right = GET_SEL32V(curObject, brRight);
- curRect.bottom = GET_SEL32V(curObject, brBottom);
+ 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);
// Check if curRect is within checkRect
if (curRect.right > checkRect.left && curRect.left < checkRect.right && curRect.bottom > checkRect.top && curRect.top < checkRect.bottom) {
return false;
@@ -1033,14 +1033,14 @@ void SciGuiGfx::SetNowSeen(reg_t objectReference) {
SegManager *segMan = _s->_segMan;
SciGuiView *view = NULL;
Common::Rect celRect(0, 0);
- GuiResourceId viewId = (GuiResourceId)GET_SEL32V(objectReference, view);
- GuiViewLoopNo loopNo = sign_extend_byte((GuiViewLoopNo)GET_SEL32V(objectReference, loop));
- GuiViewCelNo celNo = sign_extend_byte((GuiViewCelNo)GET_SEL32V(objectReference, cel));
- int16 x = (int16)GET_SEL32V(objectReference, x);
- int16 y = (int16)GET_SEL32V(objectReference, y);
+ GuiResourceId viewId = (GuiResourceId)GET_SEL32V(segMan, objectReference, view);
+ GuiViewLoopNo loopNo = sign_extend_byte((GuiViewLoopNo)GET_SEL32V(segMan, objectReference, loop));
+ GuiViewCelNo celNo = sign_extend_byte((GuiViewCelNo)GET_SEL32V(segMan, objectReference, cel));
+ int16 x = (int16)GET_SEL32V(segMan, objectReference, x);
+ int16 y = (int16)GET_SEL32V(segMan, objectReference, y);
int16 z = 0;
if (_s->_kernel->_selectorCache.z > -1) {
- z = (int16)GET_SEL32V(objectReference, z);
+ z = (int16)GET_SEL32V(segMan, objectReference, z);
}
// now get cel rectangle
@@ -1049,10 +1049,10 @@ void SciGuiGfx::SetNowSeen(reg_t objectReference) {
// TODO: sometimes loop is negative. Check what it means
if (lookup_selector(_s->_segMan, objectReference, _s->_kernel->_selectorCache.nsTop, NULL, NULL) == kSelectorVariable) {
- PUT_SEL32V(objectReference, nsLeft, celRect.left);
- PUT_SEL32V(objectReference, nsRight, celRect.right);
- PUT_SEL32V(objectReference, nsTop, celRect.top);
- PUT_SEL32V(objectReference, nsBottom, celRect.bottom);
+ 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);
}
delete view;