diff options
author | Max Horn | 2009-10-18 19:42:56 +0000 |
---|---|---|
committer | Max Horn | 2009-10-18 19:42:56 +0000 |
commit | f3ab3051d889fd03e9abaeb00a0735cd8a9a9d54 (patch) | |
tree | 25ec2312301312bb61605457516a40a282c509d8 | |
parent | 2bbf708deaf2d60c70786ec1ef2f9ea0d1f0bd4a (diff) | |
download | scummvm-rg350-f3ab3051d889fd03e9abaeb00a0735cd8a9a9d54.tar.gz scummvm-rg350-f3ab3051d889fd03e9abaeb00a0735cd8a9a9d54.tar.bz2 scummvm-rg350-f3ab3051d889fd03e9abaeb00a0735cd8a9a9d54.zip |
SCI: Make the implicit segMan param to GET_SEL32(V) and PUT_SEL32(V) explicit
svn-id: r45234
-rw-r--r-- | engines/sci/console.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 50 | ||||
-rw-r--r-- | engines/sci/engine/kevent.cpp | 50 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 66 | ||||
-rw-r--r-- | engines/sci/engine/klists.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/kmenu.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 124 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 30 | ||||
-rw-r--r-- | engines/sci/engine/ksound.cpp | 178 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 15 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 8 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 15 | ||||
-rw-r--r-- | engines/sci/gui/gui_animate.cpp | 64 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 48 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.cpp | 158 |
15 files changed, 416 insertions, 416 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 0aefbadda6..baf43f925a 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2746,14 +2746,14 @@ bool Console::cmdStopSfx(int argc, const char **argv) { } int handle = id.segment << 16 | id.offset; // frobnicate handle - SegManager *segMan = _vm->_gamestate->_segMan; // for PUT_SEL32V if (id.segment) { + SegManager *segMan = _vm->_gamestate->_segMan; // for PUT_SEL32V _vm->_gamestate->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); _vm->_gamestate->_sound.sfx_remove_song(handle); - PUT_SEL32V(id, signal, SIGNAL_OFFSET); - PUT_SEL32V(id, nodePtr, 0); - PUT_SEL32V(id, handle, 0); + PUT_SEL32V(segMan, id, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, id, nodePtr, 0); + PUT_SEL32V(segMan, id, handle, 0); } return true; diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 943e258d08..f5d003d670 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -150,33 +150,37 @@ enum SelectorInvocation { kContinueOnInvalidSelector = 1 }; -#define GET_SEL32(_o_, _slc_) read_selector(segMan, _o_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_, __FILE__, __LINE__) -#define GET_SEL32V(_o_, _slc_) (GET_SEL32(_o_, _slc_).offset) -/* Retrieves a selector from an object -** Parameters: (reg_t) object: The address of the object which the selector should be read from -** (selector_name) selector: The selector to read -** Returns : (int16/uint16/reg_t) The selector value -** This macro halts on error. 'selector' must be a selector name registered in vm.h's -** SelectorCache and mapped in script.cpp. -*/ - -#define PUT_SEL32(_o_, _slc_, _val_) write_selector(segMan, _o_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_, _val_, __FILE__, __LINE__) -#define PUT_SEL32V(_o_, _slc_, _val_) PUT_SEL32(_o_, _slc_, make_reg(0, _val_)) -/* Writes a selector value to an object -** Parameters: (reg_t) object: The address of the object which the selector should be written to -** (selector_name) selector: The selector to read -** (int16) value: The value to write -** Returns : (void) -** This macro halts on error. 'selector' must be a selector name registered in vm.h's -** SelectorCache and mapped in script.cpp. -*/ +/** + * Retrieves a selector from an object. + * @param segMan the segment mananger + * @param _obj_ the address of the object which the selector should be read from + * @param _slc_ the selector to read + * @return the selector value as a reg_t + * This macro halts on error. 'selector' must be a selector name registered in vm.h's + * SelectorCache and mapped in script.cpp. + */ +#define GET_SEL32(segMan, _obj_, _slc_) read_selector(segMan, _obj_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_, __FILE__, __LINE__) +#define GET_SEL32V(segMan, _obj_, _slc_) (GET_SEL32(segMan, _obj_, _slc_).offset) +/** + * Writes a selector value to an object. + * @param segMan the segment mananger + * @param _obj_ the address of the object which the selector should be written to + * @param _slc_ the selector to read + * @param _val_ the value to write + * This macro halts on error. 'selector' must be a selector name registered in vm.h's + * SelectorCache and mapped in script.cpp. + */ +#define PUT_SEL32(segMan, _obj_, _slc_, _val_) write_selector(segMan, _obj_, ((SciEngine*)g_engine)->getKernel()->_selectorCache._slc_, _val_, __FILE__, __LINE__) +#define PUT_SEL32V(segMan, _obj_, _slc_, _val_) PUT_SEL32(segMan, _obj_, _slc_, make_reg(0, _val_)) + +/** + * Kludge for use with invoke_selector(). Used for compatibility with compilers + * that cannot handle vararg macros. + */ #define INV_SEL(_object_, _selector_, _noinvalid_) \ s, _object_, s->_kernel->_selectorCache._selector_, _noinvalid_, argv, argc, __FILE__, __LINE__ -/* Kludge for use with invoke_selector(). Used for compatibility with compilers that can't -** handle vararg macros. -*/ reg_t read_selector(SegManager *segMan, reg_t object, Selector selector_id, const char *fname, int line); diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 64167285a7..27158fac8c 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -49,11 +49,11 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { // If there's a simkey pending, and the game wants a keyboard event, use the // simkey instead of a normal event if (g_debug_simulated_key && (mask & SCI_EVT_KEYBOARD)) { - PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event - PUT_SEL32V(obj, message, g_debug_simulated_key); - PUT_SEL32V(obj, modifiers, SCI_EVM_NUMLOCK); // Numlock on - PUT_SEL32V(obj, x, mousePos.x); - PUT_SEL32V(obj, y, mousePos.y); + PUT_SEL32V(segMan, obj, type, SCI_EVT_KEYBOARD); // Keyboard event + PUT_SEL32V(segMan, obj, message, g_debug_simulated_key); + PUT_SEL32V(segMan, obj, modifiers, SCI_EVM_NUMLOCK); // Numlock on + PUT_SEL32V(segMan, obj, x, mousePos.x); + PUT_SEL32V(segMan, obj, y, mousePos.y); g_debug_simulated_key = 0; return make_reg(0, 1); } @@ -64,8 +64,8 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { s->parser_event = NULL_REG; // Invalidate parser event - PUT_SEL32V(obj, x, mousePos.x); - PUT_SEL32V(obj, y, mousePos.y); + PUT_SEL32V(segMan, obj, x, mousePos.x); + PUT_SEL32V(segMan, obj, y, mousePos.y); //s->_gui->moveCursor(s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y); @@ -84,12 +84,12 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { g_debugState.seeking = kDebugSeekNothing; g_debugState.runningStep = 0; } else { - PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event + PUT_SEL32V(segMan, obj, type, SCI_EVT_KEYBOARD); // Keyboard event s->r_acc = make_reg(0, 1); - PUT_SEL32V(obj, message, e.character); + PUT_SEL32V(segMan, obj, message, e.character); // We only care about the translated // character - PUT_SEL32V(obj, modifiers, e.buckybits&modifier_mask); + PUT_SEL32V(segMan, obj, modifiers, e.buckybits&modifier_mask); } break; @@ -115,9 +115,9 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { break; } - PUT_SEL32V(obj, type, e.type); - PUT_SEL32V(obj, message, 0); - PUT_SEL32V(obj, modifiers, (e.buckybits | extra_bits)&modifier_mask); + PUT_SEL32V(segMan, obj, type, e.type); + PUT_SEL32V(segMan, obj, message, 0); + PUT_SEL32V(segMan, obj, modifiers, (e.buckybits | extra_bits)&modifier_mask); s->r_acc = make_reg(0, 1); } break; @@ -158,9 +158,9 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) { reg_t obj = argv[0]; SegManager *segMan = s->_segMan; - if (GET_SEL32V(obj, type) == SCI_EVT_KEYBOARD) { // Keyboard + if (GET_SEL32V(segMan, obj, type) == SCI_EVT_KEYBOARD) { // Keyboard int mover = -1; - switch (GET_SEL32V(obj, message)) { + switch (GET_SEL32V(segMan, obj, message)) { case SCI_K_HOME: mover = 8; break; @@ -194,8 +194,8 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) { } if (mover >= 0) { - PUT_SEL32V(obj, type, SCI_EVT_JOYSTICK); - PUT_SEL32V(obj, message, mover); + PUT_SEL32V(segMan, obj, type, SCI_EVT_JOYSTICK); + PUT_SEL32V(segMan, obj, message, mover); return make_reg(0, 1); } else return NULL_REG; @@ -209,13 +209,13 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; if (obj.segment) { - int16 x = GET_SEL32V(obj, x); - int16 y = GET_SEL32V(obj, y); + int16 x = GET_SEL32V(segMan, obj, x); + int16 y = GET_SEL32V(segMan, obj, y); s->_gui->globalToLocal(&x, &y); - PUT_SEL32V(obj, x, x); - PUT_SEL32V(obj, y, y); + PUT_SEL32V(segMan, obj, x, x); + PUT_SEL32V(segMan, obj, y, y); } return s->r_acc; @@ -227,13 +227,13 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; if (obj.segment) { - int16 x = GET_SEL32V(obj, x); - int16 y = GET_SEL32V(obj, y); + int16 x = GET_SEL32V(segMan, obj, x); + int16 y = GET_SEL32V(segMan, obj, y); s->_gui->localToGlobal(&x, &y); - PUT_SEL32V(obj, x, x); - PUT_SEL32V(obj, y, y); + PUT_SEL32V(segMan, obj, x, x); + PUT_SEL32V(segMan, obj, y, y); } return s->r_acc; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 25685ee448..6fa7ecabb7 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -61,8 +61,8 @@ enum { void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; - int view = GET_SEL32V(obj, view); - int signal = GET_SEL32V(obj, signal); + int view = GET_SEL32V(segMan, obj, view); + int signal = GET_SEL32V(segMan, obj, signal); int loop; int maxloops; bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY); @@ -100,7 +100,7 @@ void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv) if ((loop > 1) && (maxloops < 4)) return; - PUT_SEL32V(obj, loop, loop); + PUT_SEL32V(segMan, obj, loop, loop); } static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) { @@ -443,7 +443,7 @@ reg_t kCelWide(EngineState *s, int argc, reg_t *argv) { reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; reg_t obj = argv[0]; - int view = GET_SEL32V(obj, view); + int view = GET_SEL32V(segMan, obj, view); int loops_nr = gfxop_lookup_view_get_loops(s->gfx_state, view); if (loops_nr < 0) { @@ -459,8 +459,8 @@ reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) { reg_t kNumCels(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; reg_t obj = argv[0]; - int loop = GET_SEL32V(obj, loop); - int view = GET_SEL32V(obj, view); + int loop = GET_SEL32V(segMan, obj, loop); + int view = GET_SEL32V(segMan, obj, view); int cel = 0xffff; gfxop_check_cel(s->gfx_state, view, &loop, &cel); @@ -544,10 +544,10 @@ reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) { Common::Rect absrect = set_base(s, object); SegManager *segMan = s->_segMan; - PUT_SEL32V(object, brLeft, absrect.left); - PUT_SEL32V(object, brRight, absrect.right); - PUT_SEL32V(object, brTop, absrect.top); - PUT_SEL32V(object, brBottom, absrect.bottom); + PUT_SEL32V(segMan, object, brLeft, absrect.left); + PUT_SEL32V(segMan, object, brRight, absrect.right); + PUT_SEL32V(segMan, object, brTop, absrect.top); + PUT_SEL32V(segMan, object, brBottom, absrect.bottom); } return s->r_acc; @@ -620,12 +620,12 @@ reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { } static void disableCertainButtons(SegManager *segMan, Common::String gameName, reg_t obj) { - reg_t text_pos = GET_SEL32(obj, text); + reg_t text_pos = GET_SEL32(segMan, obj, text); Common::String text; if (!text_pos.isNull()) text = segMan->getString(text_pos); - int type = GET_SEL32V(obj, type); - int state = GET_SEL32V(obj, state); + int type = GET_SEL32V(segMan, obj, type); + int state = GET_SEL32V(segMan, obj, state); /* * WORKAROUND: The function is a "prevent the user from doing something @@ -649,25 +649,25 @@ static void disableCertainButtons(SegManager *segMan, Common::String gameName, r // NOTE: This _only_ works with the English version if (type == SCI_CONTROLS_TYPE_BUTTON && (gameName == "sq4") && getSciVersion() < SCI_VERSION_1_1 && text == " Delete ") { - PUT_SEL32V(obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled); + PUT_SEL32V(segMan, obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled); } // Disable the "Change Directory" button, as we don't allow the game engine to // change the directory where saved games are placed // NOTE: This _only_ works with the English version if (type == SCI_CONTROLS_TYPE_BUTTON && text == "Change\r\nDirectory") { - PUT_SEL32V(obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled); + PUT_SEL32V(segMan, obj, state, (state | kControlStateDisabled) & ~kControlStateEnabled); } } void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { SegManager *segMan = s->_segMan; - int16 type = GET_SEL32V(controlObject, type); - int16 style = GET_SEL32V(controlObject, state); - int16 x = GET_SEL32V(controlObject, nsLeft); - int16 y = GET_SEL32V(controlObject, nsTop); - GuiResourceId fontId = GET_SEL32V(controlObject, font); - reg_t textReference = GET_SEL32(controlObject, text); + int16 type = GET_SEL32V(segMan, controlObject, type); + int16 style = GET_SEL32V(segMan, controlObject, state); + int16 x = GET_SEL32V(segMan, controlObject, nsLeft); + int16 y = GET_SEL32V(segMan, controlObject, nsTop); + GuiResourceId fontId = GET_SEL32V(segMan, controlObject, font); + reg_t textReference = GET_SEL32(segMan, controlObject, text); Common::String text; Common::Rect rect; GuiTextAlignment alignment; @@ -681,7 +681,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { const char **listEntries = NULL; bool isAlias = false; - kGraphCreateRect(x, y, GET_SEL32V(controlObject, nsRight), GET_SEL32V(controlObject, nsBottom), &rect); + kGraphCreateRect(x, y, GET_SEL32V(segMan, controlObject, nsRight), GET_SEL32V(segMan, controlObject, nsBottom), &rect); if (!textReference.isNull()) text = segMan->getString(textReference); @@ -693,25 +693,25 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { return; case SCI_CONTROLS_TYPE_TEXT: - alignment = GET_SEL32V(controlObject, mode); + alignment = GET_SEL32V(segMan, controlObject, mode); debugC(2, kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d\n", PRINT_REG(controlObject), text.c_str(), x, y, alignment); s->_gui->drawControlText(rect, controlObject, s->strSplit(text.c_str(), NULL).c_str(), fontId, alignment, style, hilite); return; case SCI_CONTROLS_TYPE_TEXTEDIT: - mode = GET_SEL32V(controlObject, mode); - maxChars = GET_SEL32V(controlObject, max); - cursorPos = GET_SEL32V(controlObject, cursor); + mode = GET_SEL32V(segMan, controlObject, mode); + maxChars = GET_SEL32V(segMan, controlObject, max); + cursorPos = GET_SEL32V(segMan, controlObject, cursor); debugC(2, kDebugLevelGraphics, "drawing edit control %04x:%04x (text %04x:%04x, '%s') to %d,%d\n", PRINT_REG(controlObject), PRINT_REG(textReference), text.c_str(), x, y); s->_gui->drawControlTextEdit(rect, controlObject, s->strSplit(text.c_str(), NULL).c_str(), fontId, mode, style, cursorPos, maxChars, hilite); return; case SCI_CONTROLS_TYPE_ICON: - viewId = GET_SEL32V(controlObject, view); + viewId = GET_SEL32V(segMan, controlObject, view); { - int l = GET_SEL32V(controlObject, loop); + int l = GET_SEL32V(segMan, controlObject, loop); loopNo = (l & 0x80) ? l - 256 : l; - int c = GET_SEL32V(controlObject, cel); + int c = GET_SEL32V(segMan, controlObject, cel); celNo = (c & 0x80) ? c - 256 : c; } debugC(2, kDebugLevelGraphics, "drawing icon control %04x:%04x to %d,%d\n", PRINT_REG(controlObject), x, y - 1); @@ -723,18 +723,18 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { if (type == SCI_CONTROLS_TYPE_LIST_ALIAS) isAlias = true; - maxChars = GET_SEL32V(controlObject, x); // max chars per entry + maxChars = GET_SEL32V(segMan, controlObject, x); // max chars per entry // NOTE: most types of pointer dereferencing don't like odd offsets if (maxChars & 1) { warning("List control with odd maxChars %d. This is not yet implemented for all types of segments", maxChars); } - cursorOffset = GET_SEL32V(controlObject, cursor); + cursorOffset = GET_SEL32V(segMan, controlObject, cursor); if (s->_kernel->_selectorCache.topString != -1) { // Games from early SCI1 onwards use topString - upperOffset = GET_SEL32V(controlObject, topString); + upperOffset = GET_SEL32V(segMan, controlObject, topString); } else { // Earlier games use lsTop - upperOffset = GET_SEL32V(controlObject, lsTop); + upperOffset = GET_SEL32V(segMan, controlObject, lsTop); } // Count string entries in NULL terminated string list diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 17caae0e43..523f8ed3c6 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -389,11 +389,11 @@ reg_t kSort(EngineState *s, int argc, reg_t *argv) { reg_t dest = argv[1]; reg_t order_func = argv[2]; - int input_size = (int16)GET_SEL32V(source, size); + int input_size = (int16)GET_SEL32V(segMan, source, size); int i; - reg_t input_data = GET_SEL32(source, elements); - reg_t output_data = GET_SEL32(dest, elements); + reg_t input_data = GET_SEL32(segMan, source, elements); + reg_t output_data = GET_SEL32(segMan, dest, elements); List *list; Node *node; @@ -404,10 +404,10 @@ reg_t kSort(EngineState *s, int argc, reg_t *argv) { if (output_data.isNull()) { list = s->_segMan->allocateList(&output_data); list->first = list->last = NULL_REG; - PUT_SEL32(dest, elements, output_data); + PUT_SEL32(segMan, dest, elements, output_data); } - PUT_SEL32V(dest, size, input_size); + PUT_SEL32V(segMan, dest, size, input_size); list = s->_segMan->lookupList(input_data); node = s->_segMan->lookupNode(list->first); diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index 4c71796d6a..37c43096c1 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -114,9 +114,9 @@ reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) { reg_t event = argv[0]; /*int pause_sound = (argc > 1) ? argv[1].toUint16() : 1;*/ /* FIXME: Do this eventually */ bool claimed = false; - int type = GET_SEL32V(event, type); - int message = GET_SEL32V(event, message); - int modifiers = GET_SEL32V(event, modifiers); + int type = GET_SEL32V(segMan, event, type); + int message = GET_SEL32V(segMan, event, message); + int modifiers = GET_SEL32V(segMan, event, modifiers); int menu_nr = -1, item_nr = 0; MenuItem *item; int menu_mode = 0; /* Menu is active */ @@ -320,7 +320,7 @@ reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) { } if (claimed) { - PUT_SEL32(event, claimed, make_reg(0, 1)); + PUT_SEL32(segMan, event, claimed, make_reg(0, 1)); if (menu_nr > -1) { s->r_acc = make_reg(0, ((menu_nr + 1) << 8) | (item_nr + 1)); diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 50a9c45f1b..62a8bc88b0 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -155,8 +155,8 @@ reg_t kSetJump(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "SetJump for object at %04x:%04x\n", PRINT_REG(object)); debugC(2, kDebugLevelBresen, "xStep: %d, yStep: %d\n", vx, vy); - PUT_SEL32V(object, xStep, vx); - PUT_SEL32V(object, yStep, vy); + PUT_SEL32V(segMan, object, xStep, vx); + PUT_SEL32V(segMan, object, yStep, vy); return s->r_acc; } @@ -165,9 +165,9 @@ reg_t kSetJump(EngineState *s, int argc, reg_t *argv) { #define _K_BRESEN_AXIS_Y 1 static void initialize_bresen(SegManager *segMan, int argc, reg_t *argv, reg_t mover, int step_factor, int deltax, int deltay) { - reg_t client = GET_SEL32(mover, client); - int stepx = (int16)GET_SEL32V(client, xStep) * step_factor; - int stepy = (int16)GET_SEL32V(client, yStep) * step_factor; + reg_t client = GET_SEL32(segMan, mover, client); + int stepx = (int16)GET_SEL32V(segMan, client, xStep) * step_factor; + int stepy = (int16)GET_SEL32V(segMan, client, yStep) * step_factor; int numsteps_x = stepx ? (abs(deltax) + stepx - 1) / stepx : 0; int numsteps_y = stepy ? (abs(deltay) + stepy - 1) / stepy : 0; int bdi, i1; @@ -188,15 +188,15 @@ static void initialize_bresen(SegManager *segMan, int argc, reg_t *argv, reg_t m /* if (abs(deltax) > abs(deltay)) {*/ // Bresenham on y if (numsteps_y < numsteps_x) { - PUT_SEL32V(mover, b_xAxis, _K_BRESEN_AXIS_Y); - PUT_SEL32V(mover, b_incr, (deltay < 0) ? -1 : 1); + PUT_SEL32V(segMan, mover, b_xAxis, _K_BRESEN_AXIS_Y); + PUT_SEL32V(segMan, mover, b_incr, (deltay < 0) ? -1 : 1); //i1 = 2 * (abs(deltay) - abs(deltay_step * numsteps)) * abs(deltax_step); //bdi = -abs(deltax); i1 = 2 * (abs(deltay) - abs(deltay_step * (numsteps - 1))) * abs(deltax_step); bdi = -abs(deltax); } else { // Bresenham on x - PUT_SEL32V(mover, b_xAxis, _K_BRESEN_AXIS_X); - PUT_SEL32V(mover, b_incr, (deltax < 0) ? -1 : 1); + PUT_SEL32V(segMan, mover, b_xAxis, _K_BRESEN_AXIS_X); + PUT_SEL32V(segMan, mover, b_incr, (deltax < 0) ? -1 : 1); //i1= 2 * (abs(deltax) - abs(deltax_step * numsteps)) * abs(deltay_step); //bdi = -abs(deltay); i1 = 2 * (abs(deltax) - abs(deltax_step * (numsteps - 1))) * abs(deltay_step); @@ -204,26 +204,26 @@ static void initialize_bresen(SegManager *segMan, int argc, reg_t *argv, reg_t m } - PUT_SEL32V(mover, dx, deltax_step); - PUT_SEL32V(mover, dy, deltay_step); + PUT_SEL32V(segMan, mover, dx, deltax_step); + PUT_SEL32V(segMan, mover, dy, deltay_step); debugC(2, kDebugLevelBresen, "Init bresen for mover %04x:%04x: d=(%d,%d)\n", PRINT_REG(mover), deltax, deltay); debugC(2, kDebugLevelBresen, " steps=%d, mv=(%d, %d), i1= %d, i2=%d\n", numsteps, deltax_step, deltay_step, i1, bdi*2); - //PUT_SEL32V(mover, b_movCnt, numsteps); // Needed for HQ1/Ogre? - PUT_SEL32V(mover, b_di, bdi); - PUT_SEL32V(mover, b_i1, i1); - PUT_SEL32V(mover, b_i2, bdi * 2); + //PUT_SEL32V(segMan, mover, b_movCnt, numsteps); // Needed for HQ1/Ogre? + PUT_SEL32V(segMan, mover, b_di, bdi); + PUT_SEL32V(segMan, mover, b_i1, i1); + PUT_SEL32V(segMan, mover, b_i2, bdi * 2); } reg_t kInitBresen(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; reg_t mover = argv[0]; - reg_t client = GET_SEL32(mover, client); + reg_t client = GET_SEL32(segMan, mover, client); - int deltax = (int16)GET_SEL32V(mover, x) - (int16)GET_SEL32V(client, x); - int deltay = (int16)GET_SEL32V(mover, y) - (int16)GET_SEL32V(client, y); + int deltax = (int16)GET_SEL32V(segMan, mover, x) - (int16)GET_SEL32V(segMan, client, x); + int deltay = (int16)GET_SEL32V(segMan, mover, y) - (int16)GET_SEL32V(segMan, client, y); int step_factor = (argc < 1) ? argv[1].toUint16() : 1; initialize_bresen(s->_segMan, argc, argv, mover, step_factor, deltax, deltay); @@ -237,42 +237,42 @@ reg_t kInitBresen(EngineState *s, int argc, reg_t *argv) { reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; reg_t mover = argv[0]; - reg_t client = GET_SEL32(mover, client); + reg_t client = GET_SEL32(segMan, mover, client); - int x = (int16)GET_SEL32V(client, x); - int y = (int16)GET_SEL32V(client, y); + int x = (int16)GET_SEL32V(segMan, client, x); + int y = (int16)GET_SEL32V(segMan, client, y); int oldx, oldy, destx, desty, dx, dy, bdi, bi1, bi2, movcnt, bdelta, axis; - uint16 signal = GET_SEL32V(client, signal); + uint16 signal = GET_SEL32V(segMan, client, signal); int completed = 0; - int max_movcnt = GET_SEL32V(client, moveSpeed); + int max_movcnt = GET_SEL32V(segMan, client, moveSpeed); if (getSciVersion() > SCI_VERSION_01) signal &= ~_K_VIEW_SIG_FLAG_HIT_OBSTACLE; - PUT_SEL32(client, signal, make_reg(0, signal)); // This is a NOP for SCI0 + PUT_SEL32(segMan, client, signal, make_reg(0, signal)); // This is a NOP for SCI0 oldx = x; oldy = y; - destx = (int16)GET_SEL32V(mover, x); - desty = (int16)GET_SEL32V(mover, y); - dx = (int16)GET_SEL32V(mover, dx); - dy = (int16)GET_SEL32V(mover, dy); - bdi = (int16)GET_SEL32V(mover, b_di); - bi1 = (int16)GET_SEL32V(mover, b_i1); - bi2 = (int16)GET_SEL32V(mover, b_i2); - movcnt = GET_SEL32V(mover, b_movCnt); - bdelta = (int16)GET_SEL32V(mover, b_incr); - axis = (int16)GET_SEL32V(mover, b_xAxis); + destx = (int16)GET_SEL32V(segMan, mover, x); + desty = (int16)GET_SEL32V(segMan, mover, y); + dx = (int16)GET_SEL32V(segMan, mover, dx); + dy = (int16)GET_SEL32V(segMan, mover, dy); + bdi = (int16)GET_SEL32V(segMan, mover, b_di); + bi1 = (int16)GET_SEL32V(segMan, mover, b_i1); + bi2 = (int16)GET_SEL32V(segMan, mover, b_i2); + movcnt = GET_SEL32V(segMan, mover, b_movCnt); + bdelta = (int16)GET_SEL32V(segMan, mover, b_incr); + axis = (int16)GET_SEL32V(segMan, mover, b_xAxis); //printf("movecnt %d, move speed %d\n", movcnt, max_movcnt); if (s->handleMoveCount()) { if (max_movcnt > movcnt) { ++movcnt; - PUT_SEL32V(mover, b_movCnt, movcnt); // Needed for HQ1/Ogre? + PUT_SEL32V(segMan, mover, b_movCnt, movcnt); // Needed for HQ1/Ogre? return NULL_REG; } else { movcnt = 0; - PUT_SEL32V(mover, b_movCnt, movcnt); // Needed for HQ1/Ogre? + PUT_SEL32V(segMan, mover, b_movCnt, movcnt); // Needed for HQ1/Ogre? } } @@ -285,7 +285,7 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { dy += bdelta; } - PUT_SEL32V(mover, b_di, bdi); + PUT_SEL32V(segMan, mover, b_di, bdi); x += dx; y += dy; @@ -307,8 +307,8 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "Finished mover %04x:%04x\n", PRINT_REG(mover)); } - PUT_SEL32V(client, x, x); - PUT_SEL32V(client, y, y); + PUT_SEL32V(segMan, client, x, x); + PUT_SEL32V(segMan, client, y, y); debugC(2, kDebugLevelBresen, "New data: (x,y)=(%d,%d), di=%d\n", x, y, bdi); @@ -320,11 +320,11 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { } if (!s->r_acc.offset) { // Contains the return value - signal = GET_SEL32V(client, signal); + signal = GET_SEL32V(segMan, client, signal); - PUT_SEL32V(client, x, oldx); - PUT_SEL32V(client, y, oldy); - PUT_SEL32V(client, signal, (signal | _K_VIEW_SIG_FLAG_HIT_OBSTACLE)); + PUT_SEL32V(segMan, client, x, oldx); + PUT_SEL32V(segMan, client, y, oldy); + PUT_SEL32V(segMan, client, signal, (signal | _K_VIEW_SIG_FLAG_HIT_OBSTACLE)); debugC(2, kDebugLevelBresen, "Finished mover %04x:%04x by collision\n", PRINT_REG(mover)); completed = 1; @@ -356,15 +356,15 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - client = GET_SEL32(avoider, client); + client = GET_SEL32(segMan, avoider, client); if (!s->_segMan->isHeapObject(client)) { warning("DoAvoider() where client %04x:%04x is not an object", PRINT_REG(client)); return NULL_REG; } - looper = GET_SEL32(client, looper); - mover = GET_SEL32(client, mover); + looper = GET_SEL32(segMan, client, looper); + mover = GET_SEL32(segMan, client, mover); if (!s->_segMan->isHeapObject(mover)) { if (mover.segment) { @@ -373,8 +373,8 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } - destx = GET_SEL32V(mover, x); - desty = GET_SEL32V(mover, y); + destx = GET_SEL32V(segMan, mover, x); + desty = GET_SEL32V(segMan, mover, y); debugC(2, kDebugLevelBresen, "Doing avoider %04x:%04x (dest=%d,%d)\n", PRINT_REG(avoider), destx, desty); @@ -383,7 +383,7 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - mover = GET_SEL32(client, mover); + mover = GET_SEL32(segMan, client, mover); if (!mover.segment) // Mover has been disposed? return s->r_acc; // Return gracefully. @@ -393,18 +393,18 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - dx = destx - GET_SEL32V(client, x); - dy = desty - GET_SEL32V(client, y); + dx = destx - GET_SEL32V(segMan, client, x); + dy = desty - GET_SEL32V(segMan, client, y); angle = get_angle(dx, dy); debugC(2, kDebugLevelBresen, "Movement (%d,%d), angle %d is %sblocked\n", dx, dy, angle, (s->r_acc.offset) ? " " : "not "); if (s->r_acc.offset) { // isBlocked() returned non-zero int rotation = (rand() & 1) ? 45 : (360 - 45); // Clockwise/counterclockwise - int oldx = GET_SEL32V(client, x); - int oldy = GET_SEL32V(client, y); - int xstep = GET_SEL32V(client, xStep); - int ystep = GET_SEL32V(client, yStep); + int oldx = GET_SEL32V(segMan, client, x); + int oldy = GET_SEL32V(segMan, client, y); + int xstep = GET_SEL32V(segMan, client, xStep); + int ystep = GET_SEL32V(segMan, client, yStep); int moves; debugC(2, kDebugLevelBresen, " avoider %04x:%04x\n", PRINT_REG(avoider)); @@ -413,8 +413,8 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { int move_x = (int)(sin(angle * PI / 180.0) * (xstep)); int move_y = (int)(-cos(angle * PI / 180.0) * (ystep)); - PUT_SEL32V(client, x, oldx + move_x); - PUT_SEL32V(client, y, oldy + move_y); + PUT_SEL32V(segMan, client, x, oldx + move_x); + PUT_SEL32V(segMan, client, y, oldy + move_y); debugC(2, kDebugLevelBresen, "Pos (%d,%d): Trying angle %d; delta=(%d,%d)\n", oldx, oldy, angle, move_x, move_y); @@ -424,12 +424,12 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - PUT_SEL32V(client, x, oldx); - PUT_SEL32V(client, y, oldy); + PUT_SEL32V(segMan, client, x, oldx); + PUT_SEL32V(segMan, client, y, oldy); if (s->r_acc.offset) { // We can be here debugC(2, kDebugLevelBresen, "Success\n"); - PUT_SEL32V(client, heading, angle); + PUT_SEL32V(segMan, client, heading, angle); return make_reg(0, angle); } @@ -442,12 +442,12 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { warning("DoAvoider failed for avoider %04x:%04x", PRINT_REG(avoider)); } else { - int heading = GET_SEL32V(client, heading); + int heading = GET_SEL32V(segMan, client, heading); if (heading == -1) return s->r_acc; // No change - PUT_SEL32V(client, heading, angle); + PUT_SEL32V(segMan, client, heading, angle); s->r_acc = make_reg(0, angle); diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 9bca946882..569311e099 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -278,17 +278,17 @@ static Common::Point read_point(SegManager *segMan, reg_t list, int offset) { */ static bool polygons_equal(SegManager *segMan, reg_t p1, reg_t p2) { // Check for same type - if (GET_SEL32(p1, type).toUint16() != GET_SEL32(p2, type).toUint16()) + if (GET_SEL32(segMan, p1, type).toUint16() != GET_SEL32(segMan, p2, type).toUint16()) return false; - int size = GET_SEL32(p1, size).toUint16(); + int size = GET_SEL32(segMan, p1, size).toUint16(); // Check for same number of points - if (size != GET_SEL32(p2, size).toUint16()) + if (size != GET_SEL32(segMan, p2, size).toUint16()) return false; - reg_t p1_points = GET_SEL32(p1, points); - reg_t p2_points = GET_SEL32(p2, points); + reg_t p1_points = GET_SEL32(segMan, p1, points); + reg_t p2_points = GET_SEL32(segMan, p2, points); // Check for the same points for (int i = 0; i < size; i++) { @@ -346,9 +346,9 @@ static void draw_point(EngineState *s, Common::Point p, int start) { static void draw_polygon(EngineState *s, reg_t polygon) { SegManager *segMan = s->_segMan; - reg_t points = GET_SEL32(polygon, points); - int size = GET_SEL32(polygon, size).toUint16(); - int type = GET_SEL32(polygon, type).toUint16(); + reg_t points = GET_SEL32(segMan, polygon, points); + int size = GET_SEL32(segMan, polygon, size).toUint16(); + int type = GET_SEL32(segMan, polygon, type).toUint16(); Common::Point first, prev; int i; @@ -391,9 +391,9 @@ static void draw_input(EngineState *s, reg_t poly_list, Common::Point start, Com #endif // DEBUG_AVOIDPATH static void print_polygon(SegManager *segMan, reg_t polygon) { - reg_t points = GET_SEL32(polygon, points); - int size = GET_SEL32(polygon, size).toUint16(); - int type = GET_SEL32(polygon, type).toUint16(); + reg_t points = GET_SEL32(segMan, polygon, points); + int size = GET_SEL32(segMan, polygon, size).toUint16(); + int type = GET_SEL32(segMan, polygon, type).toUint16(); int i; Common::Point point; @@ -1220,15 +1220,15 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) { // Returns : (Polygon *) The converted polygon, or NULL on error SegManager *segMan = s->_segMan; int i; - reg_t points = GET_SEL32(polygon, points); - int size = GET_SEL32(polygon, size).toUint16(); + reg_t points = GET_SEL32(segMan, polygon, points); + int size = GET_SEL32(segMan, polygon, size).toUint16(); if (size == 0) { // If the polygon has no vertices, we skip it return NULL; } - Polygon *poly = new Polygon(GET_SEL32(polygon, type).toUint16()); + Polygon *poly = new Polygon(GET_SEL32(segMan, polygon, type).toUint16()); int skip = 0; @@ -1388,7 +1388,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co if (polygon) { pf_s->polygons.push_back(polygon); - count += GET_SEL32(node->value, size).toUint16(); + count += GET_SEL32(segMan, node->value, size).toUint16(); } } diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index a70cb1a2ea..b834f87b6b 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -131,9 +131,9 @@ enum AudioSyncCommands { static void script_set_priority(EngineState *s, reg_t obj, int priority) { SegManager *segMan = s->_segMan; - int song_nr = GET_SEL32V(obj, number); + int song_nr = GET_SEL32V(segMan, obj, number); Resource *song = s->resMan->findResource(ResourceId(kResourceTypeSound, song_nr), 0); - int flags = GET_SEL32V(obj, flags); + int flags = GET_SEL32V(segMan, obj, flags); if (priority == -1) { if (song->data[0] == 0xf0) @@ -145,7 +145,7 @@ static void script_set_priority(EngineState *s, reg_t obj, int priority) { } else flags |= SCI1_SOUND_FLAG_SCRIPTED_PRI; s->_sound.sfx_song_renice(FROBNICATE_HANDLE(obj), priority); - PUT_SEL32V(obj, flags, flags); + PUT_SEL32V(segMan, obj, flags, flags); } SongIterator *build_iterator(EngineState *s, int song_nr, SongIteratorType type, songit_id_t id) { @@ -183,27 +183,27 @@ void process_sound_events(EngineState *s) { /* Get all sound events, apply their case SI_LOOP: debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x looped (to %d)\n", PRINT_REG(obj), cue); - /* PUT_SEL32V(obj, loops, GET_SEL32V(obj, loop) - 1);*/ - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + /* PUT_SEL32V(segMan, obj, loops, GET_SEL32V(segMan, obj, loop) - 1);*/ + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); break; case SI_RELATIVE_CUE: debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received relative cue %d\n", PRINT_REG(obj), cue); - PUT_SEL32V(obj, signal, cue + 0x7f); + PUT_SEL32V(segMan, obj, signal, cue + 0x7f); break; case SI_ABSOLUTE_CUE: debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received absolute cue %d\n", PRINT_REG(obj), cue); - PUT_SEL32V(obj, signal, cue); + PUT_SEL32V(segMan, obj, signal, cue); break; case SI_FINISHED: debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x finished\n", PRINT_REG(obj)); - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); - PUT_SEL32V(obj, state, _K_SOUND_STATUS_STOPPED); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, state, _K_SOUND_STATUS_STOPPED); break; default: @@ -220,7 +220,7 @@ static reg_t kDoSoundSci0(EngineState *s, int argc, reg_t *argv) { uint16 command = argv[0].toUint16(); SongHandle handle = FROBNICATE_HANDLE(obj); int number = obj.segment ? - GET_SEL32V(obj, number) : + GET_SEL32V(segMan, obj, number) : -1; /* We were not going to use it anyway */ #ifdef DEBUG_SOUND @@ -285,20 +285,20 @@ static reg_t kDoSoundSci0(EngineState *s, int argc, reg_t *argv) { switch (command) { case _K_SCI0_SOUND_INIT_HANDLE: if (obj.segment) { - debugC(2, kDebugLevelSound, "Initializing song number %d\n", GET_SEL32V(obj, number)); + debugC(2, kDebugLevelSound, "Initializing song number %d\n", GET_SEL32V(segMan, obj, number)); s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI0, handle), 0, handle, number); - PUT_SEL32V(obj, state, _K_SOUND_STATUS_INITIALIZED); - PUT_SEL32(obj, handle, obj); /* ``sound handle'': we use the object address */ + PUT_SEL32V(segMan, obj, state, _K_SOUND_STATUS_INITIALIZED); + PUT_SEL32(segMan, obj, handle, obj); /* ``sound handle'': we use the object address */ } break; case _K_SCI0_SOUND_PLAY_HANDLE: if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_PLAYING); - s->_sound.sfx_song_set_loops(handle, GET_SEL32V(obj, loop)); - PUT_SEL32V(obj, state, _K_SOUND_STATUS_PLAYING); + s->_sound.sfx_song_set_loops(handle, GET_SEL32V(segMan, obj, loop)); + PUT_SEL32V(segMan, obj, state, _K_SOUND_STATUS_PLAYING); } break; @@ -309,27 +309,27 @@ static reg_t kDoSoundSci0(EngineState *s, int argc, reg_t *argv) { if (obj.segment) { s->_sound.sfx_remove_song(handle); } - PUT_SEL32V(obj, handle, 0x0000); + PUT_SEL32V(segMan, obj, handle, 0x0000); break; case _K_SCI0_SOUND_STOP_HANDLE: if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); - PUT_SEL32V(obj, state, SOUND_STATUS_STOPPED); + PUT_SEL32V(segMan, obj, state, SOUND_STATUS_STOPPED); } break; case _K_SCI0_SOUND_SUSPEND_HANDLE: if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_SUSPENDED); - PUT_SEL32V(obj, state, SOUND_STATUS_SUSPENDED); + PUT_SEL32V(segMan, obj, state, SOUND_STATUS_SUSPENDED); } break; case _K_SCI0_SOUND_RESUME_HANDLE: if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_PLAYING); - PUT_SEL32V(obj, state, SOUND_STATUS_PLAYING); + PUT_SEL32V(segMan, obj, state, SOUND_STATUS_PLAYING); } break; @@ -360,8 +360,8 @@ static reg_t kDoSoundSci0(EngineState *s, int argc, reg_t *argv) { case _K_SCI0_SOUND_UPDATE_VOL_PRI: if (obj.segment) { - s->_sound.sfx_song_set_loops(handle, GET_SEL32V(obj, loop)); - script_set_priority(s, obj, GET_SEL32V(obj, pri)); + s->_sound.sfx_song_set_loops(handle, GET_SEL32V(segMan, obj, loop)); + script_set_priority(s, obj, GET_SEL32V(segMan, obj, pri)); } break; @@ -371,8 +371,8 @@ static reg_t kDoSoundSci0(EngineState *s, int argc, reg_t *argv) { ** than fading it! */ if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); - PUT_SEL32V(obj, state, SOUND_STATUS_STOPPED); - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, state, SOUND_STATUS_STOPPED); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); } break; @@ -400,7 +400,7 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { reg_t obj = (argc > 1) ? argv[1] : NULL_REG; SongHandle handle = FROBNICATE_HANDLE(obj); int number = obj.segment ? - GET_SEL32V(obj, number) : + GET_SEL32V(segMan, obj, number) : -1; /* We were not going to use it anyway */ #ifdef DEBUG_SOUND @@ -499,9 +499,9 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { break; } case _K_SCI01_SOUND_PLAY_HANDLE : { - int looping = GET_SEL32V(obj, loop); - //int vol = GET_SEL32V(obj, vol); - int pri = GET_SEL32V(obj, pri); + int looping = GET_SEL32V(segMan, obj, loop); + //int vol = GET_SEL32V(segMan, obj, vol); + int pri = GET_SEL32V(segMan, obj, pri); RESTORE_BEHAVIOR rb = (RESTORE_BEHAVIOR) argv[2].toUint16(); /* Too lazy to look up a default value for this */ if (obj.segment) { @@ -509,22 +509,22 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { s->_sound.sfx_song_set_loops(handle, looping); s->_sound.sfx_song_renice(handle, pri); s->_sound._songlib.setSongRestoreBehavior(handle, rb); - PUT_SEL32V(obj, signal, 0); + PUT_SEL32V(segMan, obj, signal, 0); } break; } case _K_SCI01_SOUND_INIT_HANDLE : { - //int looping = GET_SEL32V(obj, loop); - //int vol = GET_SEL32V(obj, vol); - //int pri = GET_SEL32V(obj, pri); + //int looping = GET_SEL32V(segMan, obj, loop); + //int vol = GET_SEL32V(segMan, obj, vol); + //int pri = GET_SEL32V(segMan, obj, pri); if (obj.segment && (s->resMan->testResource(ResourceId(kResourceTypeSound, number)))) { debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1, handle), 0, handle, number); - PUT_SEL32(obj, nodePtr, obj); - PUT_SEL32(obj, handle, obj); + PUT_SEL32(segMan, obj, nodePtr, obj); + PUT_SEL32(segMan, obj, handle, obj); } break; } @@ -543,24 +543,24 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { int frame = 0; /* FIXME: Update the sound server state with 'vol' */ - int looping = GET_SEL32V(obj, loop); - //int vol = GET_SEL32V(obj, vol); - int pri = GET_SEL32V(obj, pri); + int looping = GET_SEL32V(segMan, obj, loop); + //int vol = GET_SEL32V(segMan, obj, vol); + int pri = GET_SEL32V(segMan, obj, pri); s->_sound.sfx_song_set_loops(handle, looping); s->_sound.sfx_song_renice(handle, pri); debugC(2, kDebugLevelSound, "[sound01-update-handle] -- CUE %04x:%04x", PRINT_REG(obj)); - PUT_SEL32V(obj, signal, signal); - PUT_SEL32V(obj, min, min); - PUT_SEL32V(obj, sec, sec); - PUT_SEL32V(obj, frame, frame); + PUT_SEL32V(segMan, obj, signal, signal); + PUT_SEL32V(segMan, obj, min, min); + PUT_SEL32V(segMan, obj, sec, sec); + PUT_SEL32V(segMan, obj, frame, frame); break; } case _K_SCI01_SOUND_STOP_HANDLE : { - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); } @@ -581,7 +581,7 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { * TODO: Figure out the exact semantics */ /* FIXME: The next couple of lines actually STOP the song right away */ - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); } @@ -605,7 +605,7 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelSound, "--- [CUE] %04x:%04x Absolute Cue: %d\n", PRINT_REG(obj), signal); - PUT_SEL32V(obj, signal, signal); + PUT_SEL32V(segMan, obj, signal, signal); break; case SI_RELATIVE_CUE: @@ -616,13 +616,13 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { /* FIXME to match commented-out semantics * below, with proper storage of dataInc and * signal in the iterator code. */ - PUT_SEL32V(obj, dataInc, signal); - PUT_SEL32V(obj, signal, signal); + PUT_SEL32V(segMan, obj, dataInc, signal); + PUT_SEL32V(segMan, obj, signal, signal); break; case SI_FINISHED: debugC(2, kDebugLevelSound, "--- [FINISHED] %04x:%04x\n", PRINT_REG(obj)); - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); break; case SI_LOOP: @@ -632,13 +632,13 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { /* switch (signal) */ /* { */ /* case 0x00: */ - /* if (dataInc!=GET_SEL32V(obj, dataInc)) */ + /* if (dataInc!=GET_SEL32V(segMan, obj, dataInc)) */ /* { */ - /* PUT_SEL32V(obj, dataInc, dataInc); */ - /* PUT_SEL32V(obj, signal, dataInc+0x7f); */ + /* PUT_SEL32V(segMan, obj, dataInc, dataInc); */ + /* PUT_SEL32V(segMan, obj, signal, dataInc+0x7f); */ /* } else */ /* { */ - /* PUT_SEL32V(obj, signal, signal); */ + /* PUT_SEL32V(segMan, obj, signal, signal); */ /* } */ /* break; */ /* case 0xFF: /\* May be unnecessary *\/ */ @@ -646,20 +646,20 @@ static reg_t kDoSoundSci1Early(EngineState *s, int argc, reg_t *argv) { /* handle, SOUND_STATUS_STOPPED); */ /* break; */ /* default : */ - /* if (dataInc!=GET_SEL32V(obj, dataInc)) */ + /* if (dataInc!=GET_SEL32V(segMan, obj, dataInc)) */ /* { */ - /* PUT_SEL32V(obj, dataInc, dataInc); */ - /* PUT_SEL32V(obj, signal, dataInc+0x7f); */ + /* PUT_SEL32V(segMan, obj, dataInc, dataInc); */ + /* PUT_SEL32V(segMan, obj, signal, dataInc+0x7f); */ /* } else */ /* { */ - /* PUT_SEL32V(obj, signal, signal); */ + /* PUT_SEL32V(segMan, obj, signal, signal); */ /* } */ /* break; */ /* } */ - PUT_SEL32V(obj, min, min); - PUT_SEL32V(obj, sec, sec); - PUT_SEL32V(obj, frame, frame); + PUT_SEL32V(segMan, obj, min, min); + PUT_SEL32V(segMan, obj, sec, sec); + PUT_SEL32V(segMan, obj, frame, frame); break; } case _K_SCI01_SOUND_MIDI_SEND : { @@ -692,7 +692,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { reg_t obj = (argc > 1) ? argv[1] : NULL_REG; SongHandle handle = FROBNICATE_HANDLE(obj); int number = obj.segment ? - GET_SEL32V(obj, number) : + GET_SEL32V(segMan, obj, number) : -1; /* We were not going to use it anyway */ #ifdef DEBUG_SOUND @@ -812,19 +812,19 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { return make_reg(0, 1); } case _K_SCI1_SOUND_PLAY_HANDLE : { - int looping = GET_SEL32V(obj, loop); - //int vol = GET_SEL32V(obj, vol); - int pri = GET_SEL32V(obj, pri); + int looping = GET_SEL32V(segMan, obj, loop); + //int vol = GET_SEL32V(segMan, obj, vol); + int pri = GET_SEL32V(segMan, obj, pri); int sampleLen = 0; Song *song = s->_sound._songlib.findSong(handle); - if (GET_SEL32V(obj, nodePtr) && (song && number != song->_resourceNum)) { + if (GET_SEL32V(segMan, obj, nodePtr) && (song && number != song->_resourceNum)) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); s->_sound.sfx_remove_song(handle); - PUT_SEL32(obj, nodePtr, NULL_REG); + PUT_SEL32(segMan, obj, nodePtr, NULL_REG); } - if (!GET_SEL32V(obj, nodePtr) && obj.segment) { + if (!GET_SEL32V(segMan, obj, nodePtr) && obj.segment) { // In SCI1.1 games, sound effects are started from here. If we can find // a relevant audio resource, play it, otherwise switch to synthesized // effects. If the resource exists, play it using map 65535 (sound @@ -842,7 +842,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { warning("Could not open song number %d", number); // Send a "stop handle" event so that the engine won't wait forever here s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); return s->r_acc; } debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); @@ -850,25 +850,25 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { handle), 0, handle, number); } - PUT_SEL32(obj, nodePtr, obj); - PUT_SEL32(obj, handle, obj); + PUT_SEL32(segMan, obj, nodePtr, obj); + PUT_SEL32(segMan, obj, handle, obj); } if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_PLAYING); s->_sound.sfx_song_set_loops(handle, looping); s->_sound.sfx_song_renice(handle, pri); - PUT_SEL32V(obj, signal, 0); + PUT_SEL32V(segMan, obj, signal, 0); } break; } case _K_SCI1_SOUND_INIT_HANDLE : { - //int looping = GET_SEL32V(obj, loop); - //int vol = GET_SEL32V(obj, vol); - //int pri = GET_SEL32V(obj, pri); + //int looping = GET_SEL32V(segMan, obj, loop); + //int vol = GET_SEL32V(segMan, obj, vol); + //int pri = GET_SEL32V(segMan, obj, pri); - if (GET_SEL32V(obj, nodePtr)) { + if (GET_SEL32V(segMan, obj, nodePtr)) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); s->_sound.sfx_remove_song(handle); } @@ -877,8 +877,8 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelSound, "Initializing song number %d\n", number); s->_sound.sfx_add_song(build_iterator(s, number, SCI_SONG_ITERATOR_TYPE_SCI1, handle), 0, handle, number); - PUT_SEL32(obj, nodePtr, obj); - PUT_SEL32(obj, handle, obj); + PUT_SEL32(segMan, obj, nodePtr, obj); + PUT_SEL32(segMan, obj, handle, obj); } break; } @@ -890,7 +890,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { break; } case _K_SCI1_SOUND_STOP_HANDLE : { - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); if (obj.segment) { s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); } @@ -914,13 +914,13 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { /* FIXME: The next couple of lines actually STOP the handle, rather ** than fading it! */ if (argv[5].toUint16()) { - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); - PUT_SEL32V(obj, nodePtr, 0); - PUT_SEL32V(obj, handle, 0); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, nodePtr, 0); + PUT_SEL32V(segMan, obj, handle, 0); s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED); } else { // FIXME: Support fade-and-continue. For now, send signal right away. - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); } } break; @@ -944,14 +944,14 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { break; } case _K_SCI1_SOUND_SET_HANDLE_LOOP : { - if (!GET_SEL32(obj, nodePtr).isNull()) { + if (!GET_SEL32(segMan, obj, nodePtr).isNull()) { uint16 looping = argv[2].toUint16(); if (looping < 65535) looping = 1; s->_sound.sfx_song_set_loops(handle, looping); - PUT_SEL32V(obj, loop, looping); + PUT_SEL32V(segMan, obj, loop, looping); } break; } @@ -973,19 +973,19 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelSound, "[CUE] %04x:%04x Absolute Cue: %d\n", PRINT_REG(obj), signal); - PUT_SEL32V(obj, signal, signal); + PUT_SEL32V(segMan, obj, signal, signal); break; case SI_RELATIVE_CUE: debugC(2, kDebugLevelSound, "[CUE] %04x:%04x Relative Cue: %d\n", PRINT_REG(obj), cue); - PUT_SEL32V(obj, dataInc, cue); - PUT_SEL32V(obj, signal, cue + 127); + PUT_SEL32V(segMan, obj, dataInc, cue); + PUT_SEL32V(segMan, obj, signal, cue + 127); break; case SI_FINISHED: - PUT_SEL32V(obj, signal, SIGNAL_OFFSET); + PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET); break; case SI_LOOP: @@ -1110,12 +1110,12 @@ reg_t kDoSync(EngineState *s, int argc, reg_t *argv) { s->_sound._syncResource = s->resMan->findResource(id, 1); if (s->_sound._syncResource) { - PUT_SEL32V(argv[1], syncCue, 0); + PUT_SEL32V(segMan, argv[1], syncCue, 0); s->_sound._syncOffset = 0; } else { warning("DoSync: failed to find resource %s", id.toString().c_str()); // Notify the scripts to stop sound sync - PUT_SEL32V(argv[1], syncCue, SIGNAL_OFFSET); + PUT_SEL32V(segMan, argv[1], syncCue, SIGNAL_OFFSET); } break; } @@ -1132,8 +1132,8 @@ reg_t kDoSync(EngineState *s, int argc, reg_t *argv) { s->_sound._syncOffset += 2; } - PUT_SEL32V(argv[1], syncTime, syncTime); - PUT_SEL32V(argv[1], syncCue, syncCue); + PUT_SEL32V(segMan, argv[1], syncTime, syncTime); + PUT_SEL32V(segMan, argv[1], syncCue, syncCue); } break; } diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index b31cd4018b..36a20bbbc7 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -79,7 +79,6 @@ Common::String kernel_lookup_text(EngineState *s, reg_t address, int index) { reg_t kSaid(EngineState *s, int argc, reg_t *argv) { - SegManager *segMan = s->_segMan; reg_t heap_said_block = argv[0]; byte *said_block; int new_lastmatch; @@ -104,7 +103,7 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) { s->_voc->decipherSaidBlock(said_block); #endif - if (s->parser_event.isNull() || (GET_SEL32V(s->parser_event, claimed))) { + if (s->parser_event.isNull() || (GET_SEL32V(s->_segMan, s->parser_event, claimed))) { return NULL_REG; } @@ -118,7 +117,7 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) { s->r_acc = make_reg(0, 1); if (new_lastmatch != SAID_PARTIAL_MATCH) - PUT_SEL32V(s->parser_event, claimed, 1); + PUT_SEL32V(s->_segMan, s->parser_event, claimed, 1); } else { return NULL_REG; @@ -137,14 +136,14 @@ reg_t kSetSynonyms(EngineState *s, int argc, reg_t *argv) { s->_voc->clearSynonyms(); - list = s->_segMan->lookupList(GET_SEL32(object, elements)); + list = s->_segMan->lookupList(GET_SEL32(segMan, object, elements)); node = s->_segMan->lookupNode(list->first); while (node) { reg_t objpos = node->value; int seg; - script = GET_SEL32V(objpos, number); + script = GET_SEL32V(segMan, objpos, number); seg = s->_segMan->getScriptSegment(script); if (seg > 0) @@ -214,7 +213,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { if (syntax_fail) { s->r_acc = make_reg(0, 1); - PUT_SEL32V(event, claimed, 1); + PUT_SEL32V(segMan, event, claimed, 1); invoke_selector(INV_SEL(s->game_obj, syntaxFail, kStopOnInvalidSelector), 2, s->parser_base, stringpos); /* Issue warning */ @@ -223,7 +222,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { } else { s->parserIsValid = true; - PUT_SEL32V(event, claimed, 0); + PUT_SEL32V(segMan, event, claimed, 0); #ifdef DEBUG_PARSER s->_voc->dumpParseTree(); @@ -233,7 +232,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { } else { s->r_acc = make_reg(0, 0); - PUT_SEL32V(event, claimed, 1); + PUT_SEL32V(segMan, event, claimed, 1); if (error) { s->_segMan->strcpy(s->parser_base, error); debugC(2, kDebugLevelParser, "Word unknown: %s\n", error); diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index e850c8b07f..dee94d6985 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -177,8 +177,7 @@ kLanguage EngineState::getLanguage() { kLanguage lang = K_LANG_ENGLISH; if (_kernel->_selectorCache.printLang != -1) { - SegManager *segMan = _segMan; - lang = (kLanguage)GET_SEL32V(this->game_obj, printLang); + lang = (kLanguage)GET_SEL32V(_segMan, this->game_obj, printLang); if ((getSciVersion() == SCI_VERSION_1_1) || (lang == K_LANG_NONE)) { // If language is set to none, we use the language from the game detector. @@ -213,7 +212,7 @@ kLanguage EngineState::getLanguage() { } // Store language in printLang selector - PUT_SEL32V(this->game_obj, printLang, lang); + PUT_SEL32V(_segMan, this->game_obj, printLang, lang); } } @@ -225,8 +224,7 @@ Common::String EngineState::strSplit(const char *str, const char *sep) { kLanguage subLang = K_LANG_NONE; if (_kernel->_selectorCache.subtitleLang != -1) { - SegManager *segMan = _segMan; - subLang = (kLanguage)GET_SEL32V(this->game_obj, subtitleLang); + subLang = (kLanguage)GET_SEL32V(_segMan, this->game_obj, subtitleLang); } Common::String retval = getLanguageString(str, lang); 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; diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index 3aed195eaf..82fc341a85 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -272,35 +272,35 @@ Common::Rect set_base(EngineState *s, reg_t object) { int xmod = 0, ymod = 0; Common::Rect retval; - x = (int16)GET_SEL32V(object, x); - original_y = y = (int16)GET_SEL32V(object, y); + x = (int16)GET_SEL32V(segMan, object, x); + original_y = y = (int16)GET_SEL32V(segMan, object, y); if (s->_kernel->_selectorCache.z > -1) - z = (int16)GET_SEL32V(object, z); + z = (int16)GET_SEL32V(segMan, object, z); else z = 0; y -= z; // Subtract z offset - ystep = (int16)GET_SEL32V(object, yStep); + ystep = (int16)GET_SEL32V(segMan, object, yStep); - view = (int16)GET_SEL32V(object, view); - int l = GET_SEL32V(object, loop); + view = (int16)GET_SEL32V(segMan, object, view); + int l = GET_SEL32V(segMan, object, loop); oldloop = loop = (l & 0x80) ? l - 256 : l; - int c = GET_SEL32V(object, cel); + int c = GET_SEL32V(segMan, object, cel); oldcel = cel = (c & 0x80) ? c - 256 : c; Common::Point offset = Common::Point(0, 0); if (loop != oldloop) { loop = 0; - PUT_SEL32V(object, loop, 0); + PUT_SEL32V(segMan, object, loop, 0); debugC(2, kDebugLevelGraphics, "Resetting loop for %04x:%04x!\n", PRINT_REG(object)); } if (cel != oldcel) { cel = 0; - PUT_SEL32V(object, cel, 0); + PUT_SEL32V(segMan, object, cel, 0); } gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset); @@ -373,26 +373,26 @@ Common::Rect get_nsrect(EngineState *s, reg_t object, byte clip) { int view, loop, cel; Common::Rect retval; - x = (int16)GET_SEL32V(object, x); - y = (int16)GET_SEL32V(object, y); + x = (int16)GET_SEL32V(segMan, object, x); + y = (int16)GET_SEL32V(segMan, object, y); if (s->_kernel->_selectorCache.z > -1) - z = (int16)GET_SEL32V(object, z); + z = (int16)GET_SEL32V(segMan, object, z); else z = 0; y -= z; // Subtract z offset - view = (int16)GET_SEL32V(object, view); - int l = (int16)GET_SEL32V(object, loop); + view = (int16)GET_SEL32V(segMan, object, view); + int l = (int16)GET_SEL32V(segMan, object, loop); loop = (l & 0x80) ? l - 256 : l; - int c = (int16)GET_SEL32V(object, cel); + int c = (int16)GET_SEL32V(segMan, object, cel); cel = (c & 0x80) ? c - 256 : c; retval = calculate_nsrect(s, x, y, view, loop, cel); if (clip) { - int priority = (int16)GET_SEL32V(object, priority); + int priority = (int16)GET_SEL32V(segMan, object, priority); return nsrect_clip(s, y, retval, priority); } @@ -405,26 +405,26 @@ Common::Rect get_nsrect32(EngineState *s, reg_t object, byte clip) { int view, loop, cel; Common::Rect retval; - x = (int16)GET_SEL32V(object, x); - y = (int16)GET_SEL32V(object, y); + x = (int16)GET_SEL32V(segMan, object, x); + y = (int16)GET_SEL32V(segMan, object, y); if (s->_kernel->_selectorCache.z > -1) - z = (int16)GET_SEL32V(object, z); + z = (int16)GET_SEL32V(segMan, object, z); else z = 0; y -= z; // Subtract z offset - view = (int16)GET_SEL32V(object, view); - int l = (int16)GET_SEL32V(object, loop); + view = (int16)GET_SEL32V(segMan, object, view); + int l = (int16)GET_SEL32V(segMan, object, loop); loop = (l & 0x80) ? l - 256 : l; - int c = (int16)GET_SEL32V(object, cel); + int c = (int16)GET_SEL32V(segMan, object, cel); cel = (c & 0x80) ? c - 256 : c; retval = calculate_nsrect(s, x, y, view, loop, cel); if (clip) { - int priority = (int16)GET_SEL32V(object, priority); + int priority = (int16)GET_SEL32V(segMan, object, priority); return nsrect_clip(s, y, retval, priority); } @@ -1046,7 +1046,7 @@ static inline int sign_extend_byte(int value) { void SciGui32::editControl(reg_t controlObject, reg_t eventObject) { SegManager *segMan = _s->_segMan; - uint16 ct_type = GET_SEL32V(controlObject, type); + uint16 ct_type = GET_SEL32V(segMan, controlObject, type); switch (ct_type) { @@ -1054,13 +1054,13 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) { break; // NOP case K_CONTROL_EDIT: - if (eventObject.segment && ((GET_SEL32V(eventObject, type)) == SCI_EVT_KEYBOARD)) { - int max_displayed = GET_SEL32V(controlObject, max); + if (eventObject.segment && ((GET_SEL32V(segMan, eventObject, type)) == SCI_EVT_KEYBOARD)) { + int max_displayed = GET_SEL32V(segMan, controlObject, max); int max = max_displayed; - int cursor = GET_SEL32V(controlObject, cursor); - int modifiers = GET_SEL32V(eventObject, modifiers); - int key = GET_SEL32V(eventObject, message); - reg_t text_pos = GET_SEL32(controlObject, text); + int cursor = GET_SEL32V(segMan, controlObject, cursor); + int modifiers = GET_SEL32V(segMan, eventObject, modifiers); + int key = GET_SEL32V(segMan, eventObject, message); + reg_t text_pos = GET_SEL32(segMan, controlObject, text); int display_offset = 0; Common::String text = _s->_segMan->getString(text_pos); @@ -1105,7 +1105,7 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) { _K_EDIT_DELETE; break; } - PUT_SEL32V(eventObject, claimed, 1); + PUT_SEL32V(segMan, eventObject, claimed, 1); } else if (modifiers & SCI_EVM_ALT) { // Ctrl has precedence over Alt switch (key) { @@ -1129,15 +1129,15 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) { break; } } - PUT_SEL32V(eventObject, claimed, 1); + PUT_SEL32V(segMan, eventObject, claimed, 1); } else if (key < 31) { - PUT_SEL32V(eventObject, claimed, 1); + PUT_SEL32V(segMan, eventObject, claimed, 1); switch (key) { case SCI_K_BACKSPACE: _K_EDIT_BACKSPACE; break; default: - PUT_SEL32V(eventObject, claimed, 0); + PUT_SEL32V(segMan, eventObject, claimed, 0); } } else if (key & 0xff00) { switch (key) { @@ -1159,7 +1159,7 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) { _K_EDIT_DELETE; break; } - PUT_SEL32V(eventObject, claimed, 1); + PUT_SEL32V(segMan, eventObject, claimed, 1); } else if ((key > 31) && (key < 128)) { int inserting = (modifiers & SCI_EVM_INSERT); @@ -1188,13 +1188,13 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) { cursor -= display_offset; - PUT_SEL32V(eventObject, claimed, 1); + PUT_SEL32V(segMan, eventObject, claimed, 1); } - PUT_SEL32V(controlObject, cursor, cursor); // Write back cursor position + PUT_SEL32V(segMan, controlObject, cursor, cursor); // Write back cursor position _s->_segMan->strcpy(text_pos, text.c_str()); // Write back string } - if (eventObject.segment) PUT_SEL32V(eventObject, claimed, 1); + if (eventObject.segment) PUT_SEL32V(segMan, eventObject, claimed, 1); _k_GenericDrawControl(_s, controlObject, false); return; @@ -1204,10 +1204,10 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) { return; case K_CONTROL_TEXT: { - int state = GET_SEL32V(controlObject, state); - PUT_SEL32V(controlObject, state, state | kControlStateDitherFramed); + int state = GET_SEL32V(segMan, controlObject, state); + PUT_SEL32V(segMan, controlObject, state, state | kControlStateDitherFramed); _k_GenericDrawControl(_s, controlObject, false); - PUT_SEL32V(controlObject, state, state); + PUT_SEL32V(segMan, controlObject, state, state); } break; @@ -1449,7 +1449,7 @@ enum { GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int argc, reg_t *argv) { SegManager *segMan = _s->_segMan; short oldloop, oldcel; - int cel, loop, view_nr = (int16)GET_SEL32V(obj, view); + int cel, loop, view_nr = (int16)GET_SEL32V(segMan, obj, view); int palette; int signal; reg_t under_bits; @@ -1461,19 +1461,19 @@ GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int ar obj = obj; - pos.x = (int16)GET_SEL32V(obj, x); - pos.y = (int16)GET_SEL32V(obj, y); + pos.x = (int16)GET_SEL32V(segMan, obj, x); + pos.y = (int16)GET_SEL32V(segMan, obj, y); pos.y++; // magic: Sierra appears to do something like this - z = (int16)GET_SEL32V(obj, z); + z = (int16)GET_SEL32V(segMan, obj, z); // !-- nsRect used to be checked here! - loop = oldloop = sign_extend_byte(GET_SEL32V(obj, loop)); - cel = oldcel = sign_extend_byte(GET_SEL32V(obj, cel)); + loop = oldloop = sign_extend_byte(GET_SEL32V(segMan, obj, loop)); + cel = oldcel = sign_extend_byte(GET_SEL32V(segMan, obj, cel)); if (_s->_kernel->_selectorCache.palette) - palette = GET_SEL32V(obj, palette); + palette = GET_SEL32V(segMan, obj, palette); else palette = 0; @@ -1486,10 +1486,10 @@ GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int ar cel = 0; if (oldloop != loop) - PUT_SEL32V(obj, loop, loop); + PUT_SEL32V(segMan, obj, loop, loop); if (oldcel != cel) { - PUT_SEL32V(obj, cel, cel); + PUT_SEL32V(segMan, obj, cel, cel); } ObjVarRef under_bitsp; @@ -1554,7 +1554,7 @@ void SciGui32::_k_make_view_list(GfxList **widget_list, List *list, int options, GfxDynView *tempWidget; if (options & _K_MAKE_VIEW_LIST_CYCLE) { - unsigned int signal = GET_SEL32V(obj, signal); + unsigned int signal = GET_SEL32V(segMan, obj, signal); if (!(signal & _K_VIEW_SIG_FLAG_FROZEN)) { @@ -1716,10 +1716,10 @@ void SciGui32::_k_set_now_seen(reg_t object) { return; } // This isn't fatal - PUT_SEL32V(object, nsLeft, absrect.left); - PUT_SEL32V(object, nsRight, absrect.right); - PUT_SEL32V(object, nsTop, absrect.top); - PUT_SEL32V(object, nsBottom, absrect.bottom); + PUT_SEL32V(segMan, object, nsLeft, absrect.left); + PUT_SEL32V(segMan, object, nsRight, absrect.right); + PUT_SEL32V(segMan, object, nsTop, absrect.top); + PUT_SEL32V(segMan, object, nsBottom, absrect.bottom); } void SciGui32::_k_prepare_view_list(GfxList *list, int options) { @@ -1736,18 +1736,18 @@ void SciGui32::_k_prepare_view_list(GfxList *list, int options) { _priority = _find_view_priority(_s, _priority - 1); if (options & _K_MAKE_VIEW_LIST_DRAW_TO_CONTROL_MAP) { // Picview - priority = (int16)GET_SEL32V(obj, priority); + priority = (int16)GET_SEL32V(segMan, obj, priority); if (priority < 0) priority = _priority; // Always for picviews } else { // Dynview if (has_nsrect && !(view->signal & _K_VIEW_SIG_FLAG_FIX_PRI_ON)) { // Calculate priority if (options & _K_MAKE_VIEW_LIST_CALC_PRIORITY) - PUT_SEL32V(obj, priority, _priority); + PUT_SEL32V(segMan, obj, priority, _priority); priority = _priority; } else // DON'T calculate the priority - priority = (int16)GET_SEL32V(obj, priority); + priority = (int16)GET_SEL32V(segMan, obj, priority); } view->_color.priority = priority; @@ -1993,17 +1993,17 @@ void SciGui32::_k_view_list_do_postdraw(GfxList *list) { if (has_nsrect) { int temp; - temp = GET_SEL32V(obj, nsLeft); - PUT_SEL32V(obj, lsLeft, temp); + temp = GET_SEL32V(segMan, obj, nsLeft); + PUT_SEL32V(segMan, obj, lsLeft, temp); - temp = GET_SEL32V(obj, nsRight); - PUT_SEL32V(obj, lsRight, temp); + temp = GET_SEL32V(segMan, obj, nsRight); + PUT_SEL32V(segMan, obj, lsRight, temp); - temp = GET_SEL32V(obj, nsTop); - PUT_SEL32V(obj, lsTop, temp); + temp = GET_SEL32V(segMan, obj, nsTop); + PUT_SEL32V(segMan, obj, lsTop, temp); - temp = GET_SEL32V(obj, nsBottom); - PUT_SEL32V(obj, lsBottom, temp); + temp = GET_SEL32V(segMan, obj, nsBottom); + PUT_SEL32V(segMan, obj, lsBottom, temp); #ifdef DEBUG_LSRECT fprintf(_stderr, "lsRected %04x:%04x\n", PRINT_REG(obj)); #endif @@ -2607,19 +2607,19 @@ void SciGui32::setNowSeen(reg_t objectReference) { static int collides_with(EngineState *s, Common::Rect area, reg_t other_obj, int use_nsrect, int view_mask) { SegManager *segMan = s->_segMan; - int other_signal = GET_SEL32V(other_obj, signal); - int other_priority = GET_SEL32V(other_obj, priority); - int y = (int16)GET_SEL32V(other_obj, y); + int other_signal = GET_SEL32V(segMan, other_obj, signal); + int other_priority = GET_SEL32V(segMan, other_obj, priority); + int y = (int16)GET_SEL32V(segMan, other_obj, y); Common::Rect other_area; if (use_nsrect) { other_area = get_nsrect(s, other_obj, 0); other_area = nsrect_clip(s, y, other_area, other_priority); } else { - other_area.left = GET_SEL32V(other_obj, brLeft); - other_area.right = GET_SEL32V(other_obj, brRight); - other_area.top = GET_SEL32V(other_obj, brTop); - other_area.bottom = GET_SEL32V(other_obj, brBottom); + other_area.left = GET_SEL32V(segMan, other_obj, brLeft); + other_area.right = GET_SEL32V(segMan, other_obj, brRight); + other_area.top = GET_SEL32V(segMan, other_obj, brTop); + other_area.bottom = GET_SEL32V(segMan, other_obj, brBottom); } if (other_area.right < 0 || other_area.bottom < 0 || area.right < 0 || area.bottom < 0) @@ -2660,19 +2660,19 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) { uint16 edgehit; uint16 illegal_bits; - abs_zone.left = (int16)GET_SEL32V(curObject, brLeft); - abs_zone.right = (int16)GET_SEL32V(curObject, brRight); - abs_zone.top = (int16)GET_SEL32V(curObject, brTop); - abs_zone.bottom = (int16)GET_SEL32V(curObject, brBottom); + abs_zone.left = (int16)GET_SEL32V(segMan, curObject, brLeft); + abs_zone.right = (int16)GET_SEL32V(segMan, curObject, brRight); + abs_zone.top = (int16)GET_SEL32V(segMan, curObject, brTop); + abs_zone.bottom = (int16)GET_SEL32V(segMan, curObject, brBottom); zone = gfx_rect(abs_zone.left + port->zone.x, abs_zone.top + port->zone.y, abs_zone.width(), abs_zone.height()); - signal = GET_SEL32V(curObject, signal); + signal = GET_SEL32V(segMan, curObject, signal); debugC(2, kDebugLevelBresen, "Checking collision: (%d,%d) to (%d,%d) ([%d..%d]x[%d..%d]), obj=%04x:%04x, sig=%04x, cliplist=%04x:%04x\n", GFX_PRINT_RECT(zone), abs_zone.left, abs_zone.right, abs_zone.top, abs_zone.bottom, PRINT_REG(curObject), signal, PRINT_REG(listReference)); - illegal_bits = GET_SEL32V(curObject, illegalBits); + illegal_bits = GET_SEL32V(segMan, curObject, illegalBits); retval = !(illegal_bits & (edgehit = gfxop_scan_bitmask(_s->gfx_state, zone, GFX_MASK_CONTROL))); |