diff options
author | Max Horn | 2010-02-05 22:55:18 +0000 |
---|---|---|
committer | Max Horn | 2010-02-05 22:55:18 +0000 |
commit | f86618f92be1350bf6e56573c2419e604c811548 (patch) | |
tree | 780ad7877423be3aa5d19dee510e187ba77f3477 /engines/sci/engine | |
parent | 25a9df8a817de652a40d2cc48411310b081b5653 (diff) | |
download | scummvm-rg350-f86618f92be1350bf6e56573c2419e604c811548.tar.gz scummvm-rg350-f86618f92be1350bf6e56573c2419e604c811548.tar.bz2 scummvm-rg350-f86618f92be1350bf6e56573c2419e604c811548.zip |
SCI: Add a 'SELECTOR' macro
svn-id: r47918
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 22 | ||||
-rw-r--r-- | engines/sci/engine/kevent.cpp | 50 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 64 | ||||
-rw-r--r-- | engines/sci/engine/klists.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 124 | ||||
-rw-r--r-- | engines/sci/engine/kparse.cpp | 14 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 28 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/selector.h | 13 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 6 |
10 files changed, 171 insertions, 162 deletions
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index 06a24caffc..4669256df4 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -499,7 +499,7 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) { if (!s->_segMan->isHeapObject(argv[1])) return argv[1]; - return GET_SEL32(s->_segMan, argv[1], data); + return GET_SEL32(s->_segMan, argv[1], SELECTOR(data)); default: error("Unknown kArray subop %d", argv[0].toUint16()); } @@ -623,7 +623,7 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) { if (!s->_segMan->isHeapObject(argv[1])) return argv[1]; - return GET_SEL32(s->_segMan, argv[1], data); + return GET_SEL32(s->_segMan, argv[1], SELECTOR(data)); case 10: // Stringlen return make_reg(0, s->_segMan->strlen(argv[1])); case 11: { // Printf @@ -688,12 +688,12 @@ reg_t kDeleteScreenItem(EngineState *s, int argc, reg_t *argv) { /* reg_t viewObj = argv[0]; - uint16 viewId = GET_SEL32V(s->_segMan, viewObj, view); - int16 loopNo = GET_SEL32V(s->_segMan, viewObj, loop); - int16 celNo = GET_SEL32V(s->_segMan, viewObj, cel); + uint16 viewId = GET_SEL32V(s->_segMan, viewObj, SELECTOR(view)); + int16 loopNo = GET_SEL32V(s->_segMan, viewObj, SELECTOR(loop)); + int16 celNo = GET_SEL32V(s->_segMan, viewObj, SELECTOR(cel)); //int16 leftPos = 0; //int16 topPos = 0; - int16 priority = GET_SEL32V(s->_segMan, viewObj, priority); + int16 priority = GET_SEL32V(s->_segMan, viewObj, SELECTOR(priority)); //int16 control = 0; */ @@ -760,10 +760,10 @@ reg_t kOnMe(EngineState *s, int argc, reg_t *argv) { Common::Rect nsRect; // Get the bounding rectangle of the object - nsRect.left = GET_SEL32V(s->_segMan, targetObject, nsLeft); - nsRect.top = GET_SEL32V(s->_segMan, targetObject, nsTop); - nsRect.right = GET_SEL32V(s->_segMan, targetObject, nsRight); - nsRect.bottom = GET_SEL32V(s->_segMan, targetObject, nsBottom); + nsRect.left = GET_SEL32V(s->_segMan, targetObject, SELECTOR(nsLeft)); + nsRect.top = GET_SEL32V(s->_segMan, targetObject, SELECTOR(nsTop)); + nsRect.right = GET_SEL32V(s->_segMan, targetObject, SELECTOR(nsRight)); + nsRect.bottom = GET_SEL32V(s->_segMan, targetObject, SELECTOR(nsBottom)); //warning("kOnMe: (%d, %d) on object %04x:%04x, parameter %d", argv[0].toUint16(), argv[1].toUint16(), PRINT_REG(argv[2]), argv[3].toUint16()); @@ -778,7 +778,7 @@ reg_t kInPolygon(EngineState *s, int argc, reg_t *argv) { reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) { // TODO: argument 0 is usually 0, and arguments 1 and 2 are usually 1 reg_t object = argv[3]; - Common::String text = s->_segMan->getString(GET_SEL32(s->_segMan, object, text)); + Common::String text = s->_segMan->getString(GET_SEL32(s->_segMan, object, SELECTOR(text))); debug("kCreateTextBitmap: %s", text.c_str()); return NULL_REG; diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 2f7a6e1068..3099c87ff4 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -53,11 +53,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_EVENT_KEYBOARD)) { - PUT_SEL32V(segMan, obj, type, SCI_EVENT_KEYBOARD); // Keyboard event - PUT_SEL32V(segMan, obj, message, g_debug_simulated_key); - PUT_SEL32V(segMan, obj, modifiers, SCI_KEYMOD_NUMLOCK); // Numlock on - PUT_SEL32V(segMan, obj, x, mousePos.x); - PUT_SEL32V(segMan, obj, y, mousePos.y); + PUT_SEL32V(segMan, obj, SELECTOR(type), SCI_EVENT_KEYBOARD); // Keyboard event + PUT_SEL32V(segMan, obj, SELECTOR(message), g_debug_simulated_key); + PUT_SEL32V(segMan, obj, SELECTOR(modifiers), SCI_KEYMOD_NUMLOCK); // Numlock on + PUT_SEL32V(segMan, obj, SELECTOR(x), mousePos.x); + PUT_SEL32V(segMan, obj, SELECTOR(y), mousePos.y); g_debug_simulated_key = 0; return make_reg(0, 1); } @@ -69,8 +69,8 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { if (s->_voc) s->_voc->parser_event = NULL_REG; // Invalidate parser event - PUT_SEL32V(segMan, obj, x, mousePos.x); - PUT_SEL32V(segMan, obj, y, mousePos.y); + PUT_SEL32V(segMan, obj, SELECTOR(x), mousePos.x); + PUT_SEL32V(segMan, obj, SELECTOR(y), mousePos.y); //s->_gui->moveCursor(s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y); @@ -80,12 +80,12 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { break; case SCI_EVENT_KEYBOARD: - PUT_SEL32V(segMan, obj, type, SCI_EVENT_KEYBOARD); // Keyboard event + PUT_SEL32V(segMan, obj, SELECTOR(type), SCI_EVENT_KEYBOARD); // Keyboard event s->r_acc = make_reg(0, 1); - PUT_SEL32V(segMan, obj, message, curEvent.character); + PUT_SEL32V(segMan, obj, SELECTOR(message), curEvent.character); // We only care about the translated character - PUT_SEL32V(segMan, obj, modifiers, curEvent.modifiers & modifier_mask); + PUT_SEL32V(segMan, obj, SELECTOR(modifiers), curEvent.modifiers & modifier_mask); break; case SCI_EVENT_MOUSE_RELEASE: @@ -110,9 +110,9 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { break; } - PUT_SEL32V(segMan, obj, type, curEvent.type); - PUT_SEL32V(segMan, obj, message, 0); - PUT_SEL32V(segMan, obj, modifiers, (curEvent.modifiers | extra_bits) & modifier_mask); + PUT_SEL32V(segMan, obj, SELECTOR(type), curEvent.type); + PUT_SEL32V(segMan, obj, SELECTOR(message), 0); + PUT_SEL32V(segMan, obj, SELECTOR(modifiers), (curEvent.modifiers | extra_bits) & modifier_mask); s->r_acc = make_reg(0, 1); } break; @@ -164,9 +164,9 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) { reg_t obj = argv[0]; SegManager *segMan = s->_segMan; - if (GET_SEL32V(segMan, obj, type) == SCI_EVENT_KEYBOARD) { // Keyboard + if (GET_SEL32V(segMan, obj, SELECTOR(type)) == SCI_EVENT_KEYBOARD) { // Keyboard int mover = -1; - switch (GET_SEL32V(segMan, obj, message)) { + switch (GET_SEL32V(segMan, obj, SELECTOR(message))) { case SCI_KEY_HOME: mover = 8; break; @@ -200,8 +200,8 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) { } if (mover >= 0) { - PUT_SEL32V(segMan, obj, type, SCI_EVENT_JOYSTICK); - PUT_SEL32V(segMan, obj, message, mover); + PUT_SEL32V(segMan, obj, SELECTOR(type), SCI_EVENT_JOYSTICK); + PUT_SEL32V(segMan, obj, SELECTOR(message), mover); return make_reg(0, 1); } else return NULL_REG; @@ -216,13 +216,13 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; if (obj.segment) { - int16 x = GET_SEL32V(segMan, obj, x); - int16 y = GET_SEL32V(segMan, obj, y); + int16 x = GET_SEL32V(segMan, obj, SELECTOR(x)); + int16 y = GET_SEL32V(segMan, obj, SELECTOR(y)); s->_gfxCoordAdjuster->kernelGlobalToLocal(x, y, planeObject); - PUT_SEL32V(segMan, obj, x, x); - PUT_SEL32V(segMan, obj, y, y); + PUT_SEL32V(segMan, obj, SELECTOR(x), x); + PUT_SEL32V(segMan, obj, SELECTOR(y), y); } return s->r_acc; @@ -235,13 +235,13 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->_segMan; if (obj.segment) { - int16 x = GET_SEL32V(segMan, obj, x); - int16 y = GET_SEL32V(segMan, obj, y); + int16 x = GET_SEL32V(segMan, obj, SELECTOR(x)); + int16 y = GET_SEL32V(segMan, obj, SELECTOR(y)); s->_gfxCoordAdjuster->kernelLocalToGlobal(x, y, planeObject); - PUT_SEL32V(segMan, obj, x, x); - PUT_SEL32V(segMan, obj, y, y); + PUT_SEL32V(segMan, obj, SELECTOR(x), x); + PUT_SEL32V(segMan, obj, SELECTOR(y), y); } return s->r_acc; diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 6358db450b..e7d1a0a52f 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -50,8 +50,8 @@ namespace Sci { void _k_dirloop(reg_t object, uint16 angle, EngineState *s, int argc, reg_t *argv) { - GuiResourceId viewId = GET_SEL32V(s->_segMan, object, view); - uint16 signal = GET_SEL32V(s->_segMan, object, signal); + GuiResourceId viewId = GET_SEL32V(s->_segMan, object, SELECTOR(view)); + uint16 signal = GET_SEL32V(s->_segMan, object, SELECTOR(signal)); int16 loopNo; int16 maxLoops; bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY); @@ -90,7 +90,7 @@ void _k_dirloop(reg_t object, uint16 angle, EngineState *s, int argc, reg_t *arg if ((loopNo > 1) && (maxLoops < 4)) return; - PUT_SEL32V(s->_segMan, object, loop, loopNo); + PUT_SEL32V(s->_segMan, object, SELECTOR(loop), loopNo); } static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) { @@ -446,7 +446,7 @@ reg_t kCelWide(EngineState *s, int argc, reg_t *argv) { reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; - GuiResourceId viewId = GET_SEL32V(s->_segMan, object, view); + GuiResourceId viewId = GET_SEL32V(s->_segMan, object, SELECTOR(view)); int16 loopCount; loopCount = s->_gfxCache->kernelViewGetLoopCount(viewId); @@ -458,8 +458,8 @@ reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) { reg_t kNumCels(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; - GuiResourceId viewId = GET_SEL32V(s->_segMan, object, view); - int16 loopNo = GET_SEL32V(s->_segMan, object, loop); + GuiResourceId viewId = GET_SEL32V(s->_segMan, object, SELECTOR(view)); + int16 loopNo = GET_SEL32V(s->_segMan, object, SELECTOR(loop)); int16 celCount; celCount = s->_gfxCache->kernelViewGetCelCount(viewId, loopNo); @@ -535,8 +535,8 @@ reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) { // WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened, // till the actual problem is found if (s->_gameId == "lsl1sci" && s->currentRoomNumber() == 300) { - int top = GET_SEL32V(s->_segMan, object, brTop); - PUT_SEL32V(s->_segMan, object, brTop, top + 2); + int top = GET_SEL32V(s->_segMan, object, SELECTOR(brTop)); + PUT_SEL32V(s->_segMan, object, SELECTOR(brTop), top + 2); } return s->r_acc; @@ -738,12 +738,12 @@ Common::Rect kControlCreateRect(int16 x, int16 y, int16 x1, int16 y1) { } void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { - int16 type = GET_SEL32V(s->_segMan, controlObject, type); - int16 style = GET_SEL32V(s->_segMan, controlObject, state); - int16 x = GET_SEL32V(s->_segMan, controlObject, nsLeft); - int16 y = GET_SEL32V(s->_segMan, controlObject, nsTop); - GuiResourceId fontId = GET_SEL32V(s->_segMan, controlObject, font); - reg_t textReference = GET_SEL32(s->_segMan, controlObject, text); + int16 type = GET_SEL32V(s->_segMan, controlObject, SELECTOR(type)); + int16 style = GET_SEL32V(s->_segMan, controlObject, SELECTOR(state)); + int16 x = GET_SEL32V(s->_segMan, controlObject, SELECTOR(nsLeft)); + int16 y = GET_SEL32V(s->_segMan, controlObject, SELECTOR(nsTop)); + GuiResourceId fontId = GET_SEL32V(s->_segMan, controlObject, SELECTOR(font)); + reg_t textReference = GET_SEL32(s->_segMan, controlObject, SELECTOR(text)); Common::String text; Common::Rect rect; TextAlignment alignment; @@ -758,7 +758,9 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { const char **listEntries = NULL; bool isAlias = false; - rect = kControlCreateRect(x, y, GET_SEL32V(s->_segMan, controlObject, nsRight), GET_SEL32V(s->_segMan, controlObject, nsBottom)); + rect = kControlCreateRect(x, y, + GET_SEL32V(s->_segMan, controlObject, SELECTOR(nsRight)), + GET_SEL32V(s->_segMan, controlObject, SELECTOR(nsBottom))); if (!textReference.isNull()) text = s->_segMan->getString(textReference); @@ -770,32 +772,32 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { return; case SCI_CONTROLS_TYPE_TEXT: - alignment = GET_SEL32V(s->_segMan, controlObject, mode); + alignment = GET_SEL32V(s->_segMan, controlObject, SELECTOR(mode)); debugC(2, kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d", PRINT_REG(controlObject), text.c_str(), x, y, alignment); s->_gfxControls->kernelDrawText(rect, controlObject, s->strSplit(text.c_str()).c_str(), fontId, alignment, style, hilite); return; case SCI_CONTROLS_TYPE_TEXTEDIT: - mode = GET_SEL32V(s->_segMan, controlObject, mode); - maxChars = GET_SEL32V(s->_segMan, controlObject, max); - cursorPos = GET_SEL32V(s->_segMan, controlObject, cursor); + mode = GET_SEL32V(s->_segMan, controlObject, SELECTOR(mode)); + maxChars = GET_SEL32V(s->_segMan, controlObject, SELECTOR(max)); + cursorPos = GET_SEL32V(s->_segMan, controlObject, SELECTOR(cursor)); debugC(2, kDebugLevelGraphics, "drawing edit control %04x:%04x (text %04x:%04x, '%s') to %d,%d", PRINT_REG(controlObject), PRINT_REG(textReference), text.c_str(), x, y); s->_gfxControls->kernelDrawTextEdit(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(s->_segMan, controlObject, view); + viewId = GET_SEL32V(s->_segMan, controlObject, SELECTOR(view)); { - int l = GET_SEL32V(s->_segMan, controlObject, loop); + int l = GET_SEL32V(s->_segMan, controlObject, SELECTOR(loop)); loopNo = (l & 0x80) ? l - 256 : l; - int c = GET_SEL32V(s->_segMan, controlObject, cel); + int c = GET_SEL32V(s->_segMan, controlObject, SELECTOR(cel)); celNo = (c & 0x80) ? c - 256 : c; // Game-specific: *ONLY* the jones EGA/VGA sierra interpreter contain code using priority selector // ALL other games use a hardcoded -1 (madness!) // We are detecting jones/talkie as "jones" as well, but the sierra interpreter of talkie doesnt have this // "hack". Hopefully it wont cause regressions (the code causes regressions if used against kq5/floppy) if (s->_gameId == "jones") - priority = GET_SEL32V(s->_segMan, controlObject, priority); + priority = GET_SEL32V(s->_segMan, controlObject, SELECTOR(priority)); else priority = -1; } @@ -808,17 +810,17 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) { if (type == SCI_CONTROLS_TYPE_LIST_ALIAS) isAlias = true; - maxChars = GET_SEL32V(s->_segMan, controlObject, x); // max chars per entry - cursorOffset = GET_SEL32V(s->_segMan, controlObject, cursor); + maxChars = GET_SEL32V(s->_segMan, controlObject, SELECTOR(x)); // max chars per entry + cursorOffset = GET_SEL32V(s->_segMan, controlObject, SELECTOR(cursor)); if (s->_kernel->_selectorCache.topString != -1) { // Games from early SCI1 onwards use topString - upperOffset = GET_SEL32V(s->_segMan, controlObject, topString); + upperOffset = GET_SEL32V(s->_segMan, controlObject, SELECTOR(topString)); } else { // Earlier games use lsTop or brTop if (lookup_selector(s->_segMan, controlObject, s->_kernel->_selectorCache.brTop, NULL, NULL) == kSelectorVariable) - upperOffset = GET_SEL32V(s->_segMan, controlObject, brTop); + upperOffset = GET_SEL32V(s->_segMan, controlObject, SELECTOR(brTop)); else - upperOffset = GET_SEL32V(s->_segMan, controlObject, lsTop); + upperOffset = GET_SEL32V(s->_segMan, controlObject, SELECTOR(lsTop)); } // Count string entries in NULL terminated string list @@ -869,8 +871,8 @@ reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) { // Disable the "Change Directory" button, as we don't allow the game engine to // change the directory where saved games are placed if (objName == "changeDirI") { - int state = GET_SEL32V(s->_segMan, controlObject, state); - PUT_SEL32V(s->_segMan, controlObject, state, (state | kControlStateDisabled) & ~kControlStateEnabled); + int state = GET_SEL32V(s->_segMan, controlObject, SELECTOR(state)); + PUT_SEL32V(s->_segMan, controlObject, SELECTOR(state), (state | kControlStateDisabled) & ~kControlStateEnabled); } _k_GenericDrawControl(s, controlObject, false); @@ -889,7 +891,7 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) { reg_t eventObject = argv[1]; if (!controlObject.isNull()) { - int16 controlType = GET_SEL32V(s->_segMan, controlObject, type); + int16 controlType = GET_SEL32V(s->_segMan, controlObject, SELECTOR(type)); switch (controlType) { case SCI_CONTROLS_TYPE_TEXTEDIT: diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index d9ebcd3286..37f60d2830 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -415,11 +415,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(segMan, source, size); + int input_size = (int16)GET_SEL32V(segMan, source, SELECTOR(size)); int i; - reg_t input_data = GET_SEL32(segMan, source, elements); - reg_t output_data = GET_SEL32(segMan, dest, elements); + reg_t input_data = GET_SEL32(segMan, source, SELECTOR(elements)); + reg_t output_data = GET_SEL32(segMan, dest, SELECTOR(elements)); List *list; Node *node; @@ -430,10 +430,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(segMan, dest, elements, output_data); + PUT_SEL32(segMan, dest, SELECTOR(elements), output_data); } - PUT_SEL32V(segMan, dest, size, input_size); + PUT_SEL32V(segMan, dest, SELECTOR(size), input_size); list = s->_segMan->lookupList(input_data); node = s->_segMan->lookupNode(list->first); diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index 6a2d468531..67fd835d67 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -157,8 +157,8 @@ reg_t kSetJump(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "SetJump for object at %04x:%04x", PRINT_REG(object)); debugC(2, kDebugLevelBresen, "xStep: %d, yStep: %d", vx, vy); - PUT_SEL32V(segMan, object, xStep, vx); - PUT_SEL32V(segMan, object, yStep, vy); + PUT_SEL32V(segMan, object, SELECTOR(xStep), vx); + PUT_SEL32V(segMan, object, SELECTOR(yStep), vy); return s->r_acc; } @@ -167,9 +167,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(segMan, mover, client); - int stepx = (int16)GET_SEL32V(segMan, client, xStep) * step_factor; - int stepy = (int16)GET_SEL32V(segMan, client, yStep) * step_factor; + reg_t client = GET_SEL32(segMan, mover, SELECTOR(client)); + int stepx = (int16)GET_SEL32V(segMan, client, SELECTOR(xStep)) * step_factor; + int stepy = (int16)GET_SEL32V(segMan, client, SELECTOR(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; @@ -190,15 +190,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(segMan, mover, b_xAxis, _K_BRESEN_AXIS_Y); - PUT_SEL32V(segMan, mover, b_incr, (deltay < 0) ? -1 : 1); + PUT_SEL32V(segMan, mover, SELECTOR(b_xAxis), _K_BRESEN_AXIS_Y); + PUT_SEL32V(segMan, mover, SELECTOR(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(segMan, mover, b_xAxis, _K_BRESEN_AXIS_X); - PUT_SEL32V(segMan, mover, b_incr, (deltax < 0) ? -1 : 1); + PUT_SEL32V(segMan, mover, SELECTOR(b_xAxis), _K_BRESEN_AXIS_X); + PUT_SEL32V(segMan, mover, SELECTOR(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); @@ -206,26 +206,26 @@ static void initialize_bresen(SegManager *segMan, int argc, reg_t *argv, reg_t m } - PUT_SEL32V(segMan, mover, dx, deltax_step); - PUT_SEL32V(segMan, mover, dy, deltay_step); + PUT_SEL32V(segMan, mover, SELECTOR(dx), deltax_step); + PUT_SEL32V(segMan, mover, SELECTOR(dy), deltay_step); debugC(2, kDebugLevelBresen, "Init bresen for mover %04x:%04x: d=(%d,%d)", PRINT_REG(mover), deltax, deltay); debugC(2, kDebugLevelBresen, " steps=%d, mv=(%d, %d), i1= %d, i2=%d", numsteps, deltax_step, deltay_step, i1, 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); + //PUT_SEL32V(segMan, mover, SELECTOR(b_movCnt), numsteps); // Needed for HQ1/Ogre? + PUT_SEL32V(segMan, mover, SELECTOR(b_di), bdi); + PUT_SEL32V(segMan, mover, SELECTOR(b_i1), i1); + PUT_SEL32V(segMan, mover, SELECTOR(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(segMan, mover, client); + reg_t client = GET_SEL32(segMan, mover, SELECTOR(client)); - 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 deltax = (int16)GET_SEL32V(segMan, mover, SELECTOR(x)) - (int16)GET_SEL32V(segMan, client, SELECTOR(x)); + int deltay = (int16)GET_SEL32V(segMan, mover, SELECTOR(y)) - (int16)GET_SEL32V(segMan, client, SELECTOR(y)); int step_factor = (argc < 1) ? argv[1].toUint16() : 1; initialize_bresen(s->_segMan, argc, argv, mover, step_factor, deltax, deltay); @@ -239,42 +239,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(segMan, mover, client); + reg_t client = GET_SEL32(segMan, mover, SELECTOR(client)); - int x = (int16)GET_SEL32V(segMan, client, x); - int y = (int16)GET_SEL32V(segMan, client, y); + int x = (int16)GET_SEL32V(segMan, client, SELECTOR(x)); + int y = (int16)GET_SEL32V(segMan, client, SELECTOR(y)); int oldx, oldy, destx, desty, dx, dy, bdi, bi1, bi2, movcnt, bdelta, axis; - uint16 signal = GET_SEL32V(segMan, client, signal); + uint16 signal = GET_SEL32V(segMan, client, SELECTOR(signal)); int completed = 0; - int max_movcnt = GET_SEL32V(segMan, client, moveSpeed); + int max_movcnt = GET_SEL32V(segMan, client, SELECTOR(moveSpeed)); if (getSciVersion() > SCI_VERSION_01) signal &= ~kSignalHitObstacle; - PUT_SEL32(segMan, client, signal, make_reg(0, signal)); // This is a NOP for SCI0 + PUT_SEL32(segMan, client, SELECTOR(signal), make_reg(0, signal)); // This is a NOP for SCI0 oldx = x; oldy = y; - 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); + destx = (int16)GET_SEL32V(segMan, mover, SELECTOR(x)); + desty = (int16)GET_SEL32V(segMan, mover, SELECTOR(y)); + dx = (int16)GET_SEL32V(segMan, mover, SELECTOR(dx)); + dy = (int16)GET_SEL32V(segMan, mover, SELECTOR(dy)); + bdi = (int16)GET_SEL32V(segMan, mover, SELECTOR(b_di)); + bi1 = (int16)GET_SEL32V(segMan, mover, SELECTOR(b_i1)); + bi2 = (int16)GET_SEL32V(segMan, mover, SELECTOR(b_i2)); + movcnt = GET_SEL32V(segMan, mover, SELECTOR(b_movCnt)); + bdelta = (int16)GET_SEL32V(segMan, mover, SELECTOR(b_incr)); + axis = (int16)GET_SEL32V(segMan, mover, SELECTOR(b_xAxis)); //printf("movecnt %d, move speed %d\n", movcnt, max_movcnt); if (s->_features->handleMoveCount()) { if (max_movcnt > movcnt) { ++movcnt; - PUT_SEL32V(segMan, mover, b_movCnt, movcnt); // Needed for HQ1/Ogre? + PUT_SEL32V(segMan, mover, SELECTOR(b_movCnt), movcnt); // Needed for HQ1/Ogre? return NULL_REG; } else { movcnt = 0; - PUT_SEL32V(segMan, mover, b_movCnt, movcnt); // Needed for HQ1/Ogre? + PUT_SEL32V(segMan, mover, SELECTOR(b_movCnt), movcnt); // Needed for HQ1/Ogre? } } @@ -287,7 +287,7 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { dy += bdelta; } - PUT_SEL32V(segMan, mover, b_di, bdi); + PUT_SEL32V(segMan, mover, SELECTOR(b_di), bdi); x += dx; y += dy; @@ -309,8 +309,8 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { debugC(2, kDebugLevelBresen, "Finished mover %04x:%04x", PRINT_REG(mover)); } - PUT_SEL32V(segMan, client, x, x); - PUT_SEL32V(segMan, client, y, y); + PUT_SEL32V(segMan, client, SELECTOR(x), x); + PUT_SEL32V(segMan, client, SELECTOR(y), y); debugC(2, kDebugLevelBresen, "New data: (x,y)=(%d,%d), di=%d", x, y, bdi); @@ -322,11 +322,11 @@ reg_t kDoBresen(EngineState *s, int argc, reg_t *argv) { } if (!s->r_acc.offset) { // Contains the return value - signal = GET_SEL32V(segMan, client, signal); + signal = GET_SEL32V(segMan, client, SELECTOR(signal)); - PUT_SEL32V(segMan, client, x, oldx); - PUT_SEL32V(segMan, client, y, oldy); - PUT_SEL32V(segMan, client, signal, (signal | kSignalHitObstacle)); + PUT_SEL32V(segMan, client, SELECTOR(x), oldx); + PUT_SEL32V(segMan, client, SELECTOR(y), oldy); + PUT_SEL32V(segMan, client, SELECTOR(signal), (signal | kSignalHitObstacle)); debugC(2, kDebugLevelBresen, "Finished mover %04x:%04x by collision", PRINT_REG(mover)); completed = 1; @@ -377,15 +377,15 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - client = GET_SEL32(segMan, avoider, client); + client = GET_SEL32(segMan, avoider, SELECTOR(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(segMan, client, looper); - mover = GET_SEL32(segMan, client, mover); + looper = GET_SEL32(segMan, client, SELECTOR(looper)); + mover = GET_SEL32(segMan, client, SELECTOR(mover)); if (!s->_segMan->isHeapObject(mover)) { if (mover.segment) { @@ -394,8 +394,8 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } - destx = GET_SEL32V(segMan, mover, x); - desty = GET_SEL32V(segMan, mover, y); + destx = GET_SEL32V(segMan, mover, SELECTOR(x)); + desty = GET_SEL32V(segMan, mover, SELECTOR(y)); debugC(2, kDebugLevelBresen, "Doing avoider %04x:%04x (dest=%d,%d)", PRINT_REG(avoider), destx, desty); @@ -404,7 +404,7 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - mover = GET_SEL32(segMan, client, mover); + mover = GET_SEL32(segMan, client, SELECTOR(mover)); if (!mover.segment) // Mover has been disposed? return s->r_acc; // Return gracefully. @@ -414,18 +414,18 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - dx = destx - GET_SEL32V(segMan, client, x); - dy = desty - GET_SEL32V(segMan, client, y); + dx = destx - GET_SEL32V(segMan, client, SELECTOR(x)); + dy = desty - GET_SEL32V(segMan, client, SELECTOR(y)); angle = getAngle(dx, dy); debugC(2, kDebugLevelBresen, "Movement (%d,%d), angle %d is %sblocked", 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(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 oldx = GET_SEL32V(segMan, client, SELECTOR(x)); + int oldy = GET_SEL32V(segMan, client, SELECTOR(y)); + int xstep = GET_SEL32V(segMan, client, SELECTOR(xStep)); + int ystep = GET_SEL32V(segMan, client, SELECTOR(yStep)); int moves; debugC(2, kDebugLevelBresen, " avoider %04x:%04x", PRINT_REG(avoider)); @@ -434,8 +434,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(segMan, client, x, oldx + move_x); - PUT_SEL32V(segMan, client, y, oldy + move_y); + PUT_SEL32V(segMan, client, SELECTOR(x), oldx + move_x); + PUT_SEL32V(segMan, client, SELECTOR(y), oldy + move_y); debugC(2, kDebugLevelBresen, "Pos (%d,%d): Trying angle %d; delta=(%d,%d)", oldx, oldy, angle, move_x, move_y); @@ -445,12 +445,12 @@ reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } - PUT_SEL32V(segMan, client, x, oldx); - PUT_SEL32V(segMan, client, y, oldy); + PUT_SEL32V(segMan, client, SELECTOR(x), oldx); + PUT_SEL32V(segMan, client, SELECTOR(y), oldy); if (s->r_acc.offset) { // We can be here debugC(2, kDebugLevelBresen, "Success"); - PUT_SEL32V(segMan, client, heading, angle); + PUT_SEL32V(segMan, client, SELECTOR(heading), angle); return make_reg(0, angle); } @@ -463,12 +463,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(segMan, client, heading); + int heading = GET_SEL32V(segMan, client, SELECTOR(heading)); if (heading == -1) return s->r_acc; // No change - PUT_SEL32V(segMan, client, heading, angle); + PUT_SEL32V(segMan, client, SELECTOR(heading), angle); s->r_acc = make_reg(0, angle); diff --git a/engines/sci/engine/kparse.cpp b/engines/sci/engine/kparse.cpp index 4423b6928e..6901274575 100644 --- a/engines/sci/engine/kparse.cpp +++ b/engines/sci/engine/kparse.cpp @@ -63,7 +63,7 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) { s->_voc->decipherSaidBlock(said_block); #endif - if (s->_voc->parser_event.isNull() || (GET_SEL32V(s->_segMan, s->_voc->parser_event, claimed))) { + if (s->_voc->parser_event.isNull() || (GET_SEL32V(s->_segMan, s->_voc->parser_event, SELECTOR(claimed)))) { return NULL_REG; } @@ -77,7 +77,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->_segMan, s->_voc->parser_event, claimed, 1); + PUT_SEL32V(s->_segMan, s->_voc->parser_event, SELECTOR(claimed), 1); } else { return NULL_REG; @@ -115,7 +115,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { if (syntax_fail) { s->r_acc = make_reg(0, 1); - PUT_SEL32V(segMan, event, claimed, 1); + PUT_SEL32V(segMan, event, SELECTOR(claimed), 1); invoke_selector(INV_SEL(s->_gameObj, syntaxFail, kStopOnInvalidSelector), 2, s->_voc->parser_base, stringpos); /* Issue warning */ @@ -124,7 +124,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { } else { s->_voc->parserIsValid = true; - PUT_SEL32V(segMan, event, claimed, 0); + PUT_SEL32V(segMan, event, SELECTOR(claimed), 0); #ifdef DEBUG_PARSER s->_voc->dumpParseTree(); @@ -134,7 +134,7 @@ reg_t kParse(EngineState *s, int argc, reg_t *argv) { } else { s->r_acc = make_reg(0, 0); - PUT_SEL32V(segMan, event, claimed, 1); + PUT_SEL32V(segMan, event, SELECTOR(claimed), 1); if (error) { s->_segMan->strcpy(s->_voc->parser_base, error); debugC(2, kDebugLevelParser, "Word unknown: %s", error); @@ -163,14 +163,14 @@ reg_t kSetSynonyms(EngineState *s, int argc, reg_t *argv) { s->_voc->clearSynonyms(); - list = s->_segMan->lookupList(GET_SEL32(segMan, object, elements)); + list = s->_segMan->lookupList(GET_SEL32(segMan, object, SELECTOR(elements))); node = s->_segMan->lookupNode(list->first); while (node) { reg_t objpos = node->value; int seg; - script = GET_SEL32V(segMan, objpos, number); + script = GET_SEL32V(segMan, objpos, SELECTOR(number)); seg = s->_segMan->getScriptSegment(script); if (seg > 0) diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 5598b966a9..2865e0fdac 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -335,15 +335,15 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in static void draw_polygon(EngineState *s, reg_t polygon, int width, int height) { SegManager *segMan = s->_segMan; - reg_t points = GET_SEL32(segMan, polygon, points); + reg_t points = GET_SEL32(segMan, polygon, SELECTOR(points)); #ifdef ENABLE_SCI32 if (segMan->isHeapObject(points)) - points = GET_SEL32(segMan, points, data); + points = GET_SEL32(segMan, points, SELECTOR(data)); #endif - int size = GET_SEL32(segMan, polygon, size).toUint16(); - int type = GET_SEL32(segMan, polygon, type).toUint16(); + int size = GET_SEL32V(segMan, polygon, SELECTOR(size)); + int type = GET_SEL32V(segMan, polygon, SELECTOR(type)); Common::Point first, prev; int i; @@ -384,15 +384,15 @@ static void draw_input(EngineState *s, reg_t poly_list, Common::Point start, Com } static void print_polygon(SegManager *segMan, reg_t polygon) { - reg_t points = GET_SEL32(segMan, polygon, points); + reg_t points = GET_SEL32(segMan, polygon, SELECTOR(points)); #ifdef ENABLE_SCI32 if (segMan->isHeapObject(points)) - points = GET_SEL32(segMan, points, data); + points = GET_SEL32(segMan, points, SELECTOR(data)); #endif - int size = GET_SEL32(segMan, polygon, size).toUint16(); - int type = GET_SEL32(segMan, polygon, type).toUint16(); + int size = GET_SEL32V(segMan, polygon, SELECTOR(size)); + int type = GET_SEL32V(segMan, polygon, SELECTOR(type)); int i; Common::Point point; @@ -1034,13 +1034,13 @@ 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(segMan, polygon, points); - int size = GET_SEL32(segMan, polygon, size).toUint16(); + reg_t points = GET_SEL32(segMan, polygon, SELECTOR(points)); + int size = GET_SEL32V(segMan, polygon, SELECTOR(size)); #ifdef ENABLE_SCI32 // SCI32 stores the actual points in the data property of points (in a new array) if (segMan->isHeapObject(points)) - points = GET_SEL32(segMan, points, data); + points = GET_SEL32(segMan, points, SELECTOR(data)); #endif if (size == 0) { @@ -1048,7 +1048,7 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) { return NULL; } - Polygon *poly = new Polygon(GET_SEL32(segMan, polygon, type).toUint16()); + Polygon *poly = new Polygon(GET_SEL32V(segMan, polygon, SELECTOR(type))); int skip = 0; @@ -1119,7 +1119,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co if (polygon) { pf_s->polygons.push_back(polygon); - count += GET_SEL32(segMan, node->value, size).toUint16(); + count += GET_SEL32V(segMan, node->value, SELECTOR(size)); } node = s->_segMan->lookupNode(node->succ); @@ -1392,7 +1392,7 @@ reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { if (argc < 7) error("[avoidpath] Not enough arguments"); - poly_list = GET_SEL32(s->_segMan, argv[4], elements); + poly_list = GET_SEL32(s->_segMan, argv[4], SELECTOR(elements)); width = argv[5].toUint16(); height = argv[6].toUint16(); if (argc > 7) diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index dad3727f32..c11e7fc28b 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -275,7 +275,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { #ifdef ENABLE_SCI32 // If the string is a string object, get to the actual string in the data selector if (s->_segMan->isObject(reg)) - reg = GET_SEL32(s->_segMan, reg, data); + reg = GET_SEL32(s->_segMan, reg, SELECTOR(data)); #endif Common::String tempsource = (reg == NULL_REG) ? "" : kernel_lookup_text(s, reg, diff --git a/engines/sci/engine/selector.h b/engines/sci/engine/selector.h index 0cc0935377..f74ec45213 100644 --- a/engines/sci/engine/selector.h +++ b/engines/sci/engine/selector.h @@ -42,16 +42,23 @@ enum SelectorInvocation { kContinueOnInvalidSelector = 1 }; + +/** + * Map a selector name to a selector id. Shortcut for accessing the selector cache. + */ +#define SELECTOR(_slc_) (((SciEngine *)g_engine)->getKernel()->_selectorCache._slc_) +//#define SELECTOR(_slc_) _slc_ + /** * 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 + * @param _slc_ the selector to refad * @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_) +#define GET_SEL32(segMan, _obj_, _slc_) read_selector(segMan, _obj_, _slc_) #define GET_SEL32V(segMan, _obj_, _slc_) (GET_SEL32(segMan, _obj_, _slc_).offset) /** @@ -63,7 +70,7 @@ enum SelectorInvocation { * 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_) +#define PUT_SEL32(segMan, _obj_, _slc_, _val_) write_selector(segMan, _obj_, _slc_, _val_) #define PUT_SEL32V(segMan, _obj_, _slc_, _val_) PUT_SEL32(segMan, _obj_, _slc_, make_reg(0, _val_)) diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 89078e6381..f557bf618b 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -149,7 +149,7 @@ kLanguage EngineState::getLanguage() { lang = K_LANG_ENGLISH; if (_kernel->_selectorCache.printLang != -1) { - lang = (kLanguage)GET_SEL32V(_segMan, _gameObj, printLang); + lang = (kLanguage)GET_SEL32V(_segMan, _gameObj, SELECTOR(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. @@ -184,7 +184,7 @@ kLanguage EngineState::getLanguage() { } // Store language in printLang selector - PUT_SEL32V(_segMan, _gameObj, printLang, lang); + PUT_SEL32V(_segMan, _gameObj, SELECTOR(printLang), lang); } } @@ -196,7 +196,7 @@ Common::String EngineState::strSplit(const char *str, const char *sep) { kLanguage subLang = K_LANG_NONE; if (_kernel->_selectorCache.subtitleLang != -1) { - subLang = (kLanguage)GET_SEL32V(_segMan, _gameObj, subtitleLang); + subLang = (kLanguage)GET_SEL32V(_segMan, _gameObj, SELECTOR(subtitleLang)); } Common::String retval = getLanguageString(str, lang); |