aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-02-05 22:55:18 +0000
committerMax Horn2010-02-05 22:55:18 +0000
commitf86618f92be1350bf6e56573c2419e604c811548 (patch)
tree780ad7877423be3aa5d19dee510e187ba77f3477
parent25a9df8a817de652a40d2cc48411310b081b5653 (diff)
downloadscummvm-rg350-f86618f92be1350bf6e56573c2419e604c811548.tar.gz
scummvm-rg350-f86618f92be1350bf6e56573c2419e604c811548.tar.bz2
scummvm-rg350-f86618f92be1350bf6e56573c2419e604c811548.zip
SCI: Add a 'SELECTOR' macro
svn-id: r47918
-rw-r--r--engines/sci/console.cpp6
-rw-r--r--engines/sci/engine/kernel32.cpp22
-rw-r--r--engines/sci/engine/kevent.cpp50
-rw-r--r--engines/sci/engine/kgraphics.cpp64
-rw-r--r--engines/sci/engine/klists.cpp10
-rw-r--r--engines/sci/engine/kmovement.cpp124
-rw-r--r--engines/sci/engine/kparse.cpp14
-rw-r--r--engines/sci/engine/kpathing.cpp28
-rw-r--r--engines/sci/engine/kstring.cpp2
-rw-r--r--engines/sci/engine/selector.h13
-rw-r--r--engines/sci/engine/state.cpp6
-rw-r--r--engines/sci/graphics/animate.cpp72
-rw-r--r--engines/sci/graphics/compare.cpp69
-rw-r--r--engines/sci/graphics/controls.cpp18
-rw-r--r--engines/sci/graphics/coordadjuster.cpp16
-rw-r--r--engines/sci/graphics/frameout.cpp52
-rw-r--r--engines/sci/graphics/menu.cpp8
-rw-r--r--engines/sci/sound/audio.cpp8
-rw-r--r--engines/sci/sound/soundcmd.cpp210
19 files changed, 402 insertions, 390 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 19022e8b64..c26c6285b2 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -1519,9 +1519,9 @@ bool Console::cmdToggleSound(int argc, const char **argv) {
SegManager *segMan = _engine->_gamestate->_segMan; // for PUT_SEL32V
_engine->_gamestate->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
_engine->_gamestate->_sound.sfx_remove_song(handle);
- PUT_SEL32V(segMan, id, signal, SIGNAL_OFFSET);
- PUT_SEL32V(segMan, id, nodePtr, 0);
- PUT_SEL32V(segMan, id, handle, 0);
+ PUT_SEL32V(segMan, id, SELECTOR(signal), SIGNAL_OFFSET);
+ PUT_SEL32V(segMan, id, SELECTOR(nodePtr), 0);
+ PUT_SEL32V(segMan, id, SELECTOR(handle), 0);
}
#else
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);
diff --git a/engines/sci/graphics/animate.cpp b/engines/sci/graphics/animate.cpp
index abf386d934..b42a794399 100644
--- a/engines/sci/graphics/animate.cpp
+++ b/engines/sci/graphics/animate.cpp
@@ -92,7 +92,7 @@ bool GfxAnimate::invoke(List *list, int argc, reg_t *argv) {
}
}
- signal = GET_SEL32V(_s->_segMan, curObject, signal);
+ signal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(signal));
if (!(signal & kSignalFrozen)) {
// Call .doit method of that object
invoke_selector(_s, curObject, _s->_kernel->_selectorCache.doit, kContinueOnInvalidSelector, argc, argv, 0);
@@ -153,21 +153,21 @@ void GfxAnimate::makeSortedList(List *list) {
listEntry->object = curObject;
// Get data from current object
- listEntry->viewId = GET_SEL32V(_s->_segMan, curObject, view);
- listEntry->loopNo = GET_SEL32V(_s->_segMan, curObject, loop);
- listEntry->celNo = GET_SEL32V(_s->_segMan, curObject, cel);
- listEntry->paletteNo = GET_SEL32V(_s->_segMan, curObject, palette);
- listEntry->x = GET_SEL32V(_s->_segMan, curObject, x);
- listEntry->y = GET_SEL32V(_s->_segMan, curObject, y);
- listEntry->z = GET_SEL32V(_s->_segMan, curObject, z);
- listEntry->priority = GET_SEL32V(_s->_segMan, curObject, priority);
- listEntry->signal = GET_SEL32V(_s->_segMan, curObject, signal);
+ listEntry->viewId = GET_SEL32V(_s->_segMan, curObject, SELECTOR(view));
+ listEntry->loopNo = GET_SEL32V(_s->_segMan, curObject, SELECTOR(loop));
+ listEntry->celNo = GET_SEL32V(_s->_segMan, curObject, SELECTOR(cel));
+ listEntry->paletteNo = GET_SEL32V(_s->_segMan, curObject, SELECTOR(palette));
+ listEntry->x = GET_SEL32V(_s->_segMan, curObject, SELECTOR(x));
+ listEntry->y = GET_SEL32V(_s->_segMan, curObject, SELECTOR(y));
+ listEntry->z = GET_SEL32V(_s->_segMan, curObject, SELECTOR(z));
+ listEntry->priority = GET_SEL32V(_s->_segMan, curObject, SELECTOR(priority));
+ listEntry->signal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(signal));
if (getSciVersion() >= SCI_VERSION_1_1) {
// Cel scaling
- listEntry->scaleSignal = GET_SEL32V(_s->_segMan, curObject, scaleSignal);
+ listEntry->scaleSignal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(scaleSignal));
if (listEntry->scaleSignal & kScaleSignalDoScaling) {
- listEntry->scaleX = GET_SEL32V(_s->_segMan, curObject, scaleX);
- listEntry->scaleY = GET_SEL32V(_s->_segMan, curObject, scaleY);
+ listEntry->scaleX = GET_SEL32V(_s->_segMan, curObject, SELECTOR(scaleX));
+ listEntry->scaleY = GET_SEL32V(_s->_segMan, curObject, SELECTOR(scaleY));
} else {
listEntry->scaleX = 128;
listEntry->scaleY = 128;
@@ -219,11 +219,11 @@ void GfxAnimate::fill(byte &old_picNotValid) {
// adjust loop and cel, if any of those is invalid
if (listEntry->loopNo >= view->getLoopCount()) {
listEntry->loopNo = 0;
- PUT_SEL32V(_s->_segMan, curObject, loop, listEntry->loopNo);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(loop), listEntry->loopNo);
}
if (listEntry->celNo >= view->getCelCount(listEntry->loopNo)) {
listEntry->celNo = 0;
- PUT_SEL32V(_s->_segMan, curObject, cel, listEntry->celNo);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(cel), listEntry->celNo);
}
// Create rect according to coordinates and given cel
@@ -232,17 +232,17 @@ void GfxAnimate::fill(byte &old_picNotValid) {
} else {
view->getCelRect(listEntry->loopNo, listEntry->celNo, listEntry->x, listEntry->y, listEntry->z, &listEntry->celRect);
}
- PUT_SEL32V(_s->_segMan, curObject, nsLeft, listEntry->celRect.left);
- PUT_SEL32V(_s->_segMan, curObject, nsTop, listEntry->celRect.top);
- PUT_SEL32V(_s->_segMan, curObject, nsRight, listEntry->celRect.right);
- PUT_SEL32V(_s->_segMan, curObject, nsBottom, listEntry->celRect.bottom);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsLeft), listEntry->celRect.left);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsTop), listEntry->celRect.top);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsRight), listEntry->celRect.right);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(nsBottom), listEntry->celRect.bottom);
signal = listEntry->signal;
// Calculate current priority according to y-coordinate
if (!(signal & kSignalFixedPriority)) {
listEntry->priority = _ports->kernelCoordinateToPriority(listEntry->y);
- PUT_SEL32V(_s->_segMan, curObject, priority, listEntry->priority);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(priority), listEntry->priority);
}
if (signal & kSignalNoUpdate) {
@@ -282,14 +282,14 @@ void GfxAnimate::update() {
if (signal & kSignalNoUpdate) {
if (!(signal & kSignalRemoveView)) {
- bitsHandle = GET_SEL32(_s->_segMan, curObject, underBits);
+ bitsHandle = GET_SEL32(_s->_segMan, curObject, SELECTOR(underBits));
if (_screen->_picNotValid != 1) {
_paint16->bitsRestore(bitsHandle);
listEntry->showBitsFlag = true;
} else {
_paint16->bitsFree(bitsHandle);
}
- PUT_SEL32V(_s->_segMan, curObject, underBits, 0);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(underBits), 0);
}
signal &= 0xFFFF ^ kSignalForceUpdate;
signal &= signal & kSignalViewUpdated ? 0xFFFF ^ (kSignalViewUpdated | kSignalNoUpdate) : 0xFFFF;
@@ -339,7 +339,7 @@ void GfxAnimate::update() {
bitsHandle = _paint16->bitsSave(listEntry->celRect, SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY);
else
bitsHandle = _paint16->bitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL);
- PUT_SEL32(_s->_segMan, curObject, underBits, bitsHandle);
+ PUT_SEL32(_s->_segMan, curObject, SELECTOR(underBits), bitsHandle);
}
listEntry->signal = signal;
}
@@ -387,7 +387,7 @@ void GfxAnimate::drawCels() {
if (!(signal & (kSignalNoUpdate | kSignalHidden | kSignalAlwaysUpdate))) {
// Save background
bitsHandle = _paint16->bitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL);
- PUT_SEL32(_s->_segMan, curObject, underBits, bitsHandle);
+ PUT_SEL32(_s->_segMan, curObject, SELECTOR(underBits), bitsHandle);
// draw corresponding cel
_paint16->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, listEntry->scaleX, listEntry->scaleY);
@@ -423,10 +423,10 @@ void GfxAnimate::updateScreen(byte oldPicNotValid) {
if (listEntry->showBitsFlag || !(signal & (kSignalRemoveView | kSignalNoUpdate) ||
(!(signal & kSignalRemoveView) && (signal & kSignalNoUpdate) && oldPicNotValid))) {
- lsRect.left = GET_SEL32V(_s->_segMan, curObject, lsLeft);
- lsRect.top = GET_SEL32V(_s->_segMan, curObject, lsTop);
- lsRect.right = GET_SEL32V(_s->_segMan, curObject, lsRight);
- lsRect.bottom = GET_SEL32V(_s->_segMan, curObject, lsBottom);
+ lsRect.left = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsLeft));
+ lsRect.top = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsTop));
+ lsRect.right = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsRight));
+ lsRect.bottom = GET_SEL32V(_s->_segMan, curObject, SELECTOR(lsBottom));
workerRect = lsRect;
workerRect.clip(listEntry->celRect);
@@ -438,10 +438,10 @@ void GfxAnimate::updateScreen(byte oldPicNotValid) {
_paint16->bitsShow(lsRect);
workerRect = listEntry->celRect;
}
- PUT_SEL32V(_s->_segMan, curObject, lsLeft, workerRect.left);
- PUT_SEL32V(_s->_segMan, curObject, lsTop, workerRect.top);
- PUT_SEL32V(_s->_segMan, curObject, lsRight, workerRect.right);
- PUT_SEL32V(_s->_segMan, curObject, lsBottom, workerRect.bottom);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsLeft), workerRect.left);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsTop), workerRect.top);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsRight), workerRect.right);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(lsBottom), workerRect.bottom);
_paint16->bitsShow(workerRect);
if (signal & kSignalHidden) {
@@ -472,7 +472,7 @@ void GfxAnimate::restoreAndDelete(int argc, reg_t *argv) {
signal = listEntry->signal;
// Finally update signal
- PUT_SEL32V(_s->_segMan, curObject, signal, signal);
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(signal), signal);
listIterator++;
}
@@ -481,11 +481,11 @@ void GfxAnimate::restoreAndDelete(int argc, reg_t *argv) {
listEntry = *listIterator;
curObject = listEntry->object;
// We read out signal here again, this is not by accident but to ensure that we got an up-to-date signal
- signal = GET_SEL32V(_s->_segMan, curObject, signal);
+ signal = GET_SEL32V(_s->_segMan, curObject, SELECTOR(signal));
if ((signal & (kSignalNoUpdate | kSignalRemoveView)) == 0) {
- _paint16->bitsRestore(GET_SEL32(_s->_segMan, curObject, underBits));
- PUT_SEL32V(_s->_segMan, curObject, underBits, 0);
+ _paint16->bitsRestore(GET_SEL32(_s->_segMan, curObject, SELECTOR(underBits)));
+ PUT_SEL32V(_s->_segMan, curObject, SELECTOR(underBits), 0);
}
if (signal & kSignalDisposeMe) {
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index 82a5d04c44..f3d7e4b6cc 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -86,14 +86,17 @@ bool GfxCompare::canBeHereCheckRectList(reg_t checkObject, Common::Rect checkRec
while (curNode) {
curObject = curNode->value;
if (curObject != checkObject) {
- signal = GET_SEL32V(_segMan, curObject, signal);
+ signal = GET_SEL32V(_segMan, curObject, SELECTOR(signal));
if ((signal & (kSignalIgnoreActor | kSignalRemoveView | kSignalNoUpdate)) == 0) {
- curRect.left = GET_SEL32V(_segMan, curObject, brLeft);
- curRect.top = GET_SEL32V(_segMan, curObject, brTop);
- curRect.right = GET_SEL32V(_segMan, curObject, brRight);
- curRect.bottom = GET_SEL32V(_segMan, curObject, brBottom);
+ curRect.left = GET_SEL32V(_segMan, curObject, SELECTOR(brLeft));
+ curRect.top = GET_SEL32V(_segMan, curObject, SELECTOR(brTop));
+ curRect.right = GET_SEL32V(_segMan, curObject, SELECTOR(brRight));
+ curRect.bottom = GET_SEL32V(_segMan, curObject, SELECTOR(brBottom));
// Check if curRect is within checkRect
- if (curRect.right > checkRect.left && curRect.left < checkRect.right && curRect.bottom > checkRect.top && curRect.top < checkRect.bottom) {
+ if (curRect.right > checkRect.left &&
+ curRect.left < checkRect.right &&
+ curRect.bottom > checkRect.top &&
+ curRect.top < checkRect.bottom) {
return false;
}
}
@@ -114,14 +117,14 @@ uint16 GfxCompare::kernelOnControl(byte screenMask, Common::Rect rect) {
void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
GfxView *view = NULL;
Common::Rect celRect(0, 0);
- GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, view);
- int16 loopNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, loop));
- int16 celNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, cel));
- int16 x = (int16)GET_SEL32V(_segMan, objectReference, x);
- int16 y = (int16)GET_SEL32V(_segMan, objectReference, y);
+ GuiResourceId viewId = (GuiResourceId)GET_SEL32V(_segMan, objectReference, SELECTOR(view));
+ int16 loopNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, SELECTOR(loop)));
+ int16 celNo = sign_extend_byte((int16)GET_SEL32V(_segMan, objectReference, SELECTOR(cel)));
+ int16 x = (int16)GET_SEL32V(_segMan, objectReference, SELECTOR(x));
+ int16 y = (int16)GET_SEL32V(_segMan, objectReference, SELECTOR(y));
int16 z = 0;
if (_kernel->_selectorCache.z > -1)
- z = (int16)GET_SEL32V(_segMan, objectReference, z);
+ z = (int16)GET_SEL32V(_segMan, objectReference, SELECTOR(z));
// now get cel rectangle
view = _cache->getView(viewId);
@@ -129,10 +132,10 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
// TODO: sometimes loop is negative. Check what it means
if (lookup_selector(_segMan, objectReference, _kernel->_selectorCache.nsTop, NULL, NULL) == kSelectorVariable) {
- PUT_SEL32V(_segMan, objectReference, nsLeft, celRect.left);
- PUT_SEL32V(_segMan, objectReference, nsRight, celRect.right);
- PUT_SEL32V(_segMan, objectReference, nsTop, celRect.top);
- PUT_SEL32V(_segMan, objectReference, nsBottom, celRect.bottom);
+ PUT_SEL32V(_segMan, objectReference, SELECTOR(nsLeft), celRect.left);
+ PUT_SEL32V(_segMan, objectReference, SELECTOR(nsRight), celRect.right);
+ PUT_SEL32V(_segMan, objectReference, SELECTOR(nsTop), celRect.top);
+ PUT_SEL32V(_segMan, objectReference, SELECTOR(nsBottom), celRect.bottom);
}
}
@@ -142,15 +145,15 @@ bool GfxCompare::kernelCanBeHere(reg_t curObject, reg_t listReference) {
uint16 signal, controlMask;
bool result;
- checkRect.left = GET_SEL32V(_segMan, curObject, brLeft);
- checkRect.top = GET_SEL32V(_segMan, curObject, brTop);
- checkRect.right = GET_SEL32V(_segMan, curObject, brRight);
- checkRect.bottom = GET_SEL32V(_segMan, curObject, brBottom);
+ checkRect.left = GET_SEL32V(_segMan, curObject, SELECTOR(brLeft));
+ checkRect.top = GET_SEL32V(_segMan, curObject, SELECTOR(brTop));
+ checkRect.right = GET_SEL32V(_segMan, curObject, SELECTOR(brRight));
+ checkRect.bottom = GET_SEL32V(_segMan, curObject, SELECTOR(brBottom));
adjustedRect = _coordAdjuster->onControl(checkRect);
- signal = GET_SEL32V(_segMan, curObject, signal);
- controlMask = GET_SEL32V(_segMan, curObject, illegalBits);
+ signal = GET_SEL32V(_segMan, curObject, SELECTOR(signal));
+ controlMask = GET_SEL32V(_segMan, curObject, SELECTOR(illegalBits));
result = (isOnControl(SCI_SCREEN_MASK_CONTROL, adjustedRect) & controlMask) ? false : true;
if ((result) && (signal & (kSignalIgnoreActor | kSignalRemoveView)) == 0) {
List *list = _segMan->lookupList(listReference);
@@ -174,13 +177,13 @@ bool GfxCompare::kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo,
void GfxCompare::kernelBaseSetter(reg_t object) {
if (lookup_selector(_segMan, object, _kernel->_selectorCache.brLeft, NULL, NULL) == kSelectorVariable) {
- int16 x = GET_SEL32V(_segMan, object, x);
- int16 y = GET_SEL32V(_segMan, object, y);
- int16 z = (_kernel->_selectorCache.z > -1) ? GET_SEL32V(_segMan, object, z) : 0;
- int16 yStep = GET_SEL32V(_segMan, object, yStep);
- GuiResourceId viewId = GET_SEL32V(_segMan, object, view);
- int16 loopNo = GET_SEL32V(_segMan, object, loop);
- int16 celNo = GET_SEL32V(_segMan, object, cel);
+ int16 x = GET_SEL32V(_segMan, object, SELECTOR(x));
+ int16 y = GET_SEL32V(_segMan, object, SELECTOR(y));
+ int16 z = (_kernel->_selectorCache.z > -1) ? GET_SEL32V(_segMan, object, SELECTOR(z)) : 0;
+ int16 yStep = GET_SEL32V(_segMan, object, SELECTOR(yStep));
+ GuiResourceId viewId = GET_SEL32V(_segMan, object, SELECTOR(view));
+ int16 loopNo = GET_SEL32V(_segMan, object, SELECTOR(loop));
+ int16 celNo = GET_SEL32V(_segMan, object, SELECTOR(cel));
GfxView *tmpView = _cache->getView(viewId);
Common::Rect celRect;
@@ -189,10 +192,10 @@ void GfxCompare::kernelBaseSetter(reg_t object) {
celRect.bottom = y + 1;
celRect.top = celRect.bottom - yStep;
- PUT_SEL32V(_segMan, object, brLeft, celRect.left);
- PUT_SEL32V(_segMan, object, brRight, celRect.right);
- PUT_SEL32V(_segMan, object, brTop, celRect.top);
- PUT_SEL32V(_segMan, object, brBottom, celRect.bottom);
+ PUT_SEL32V(_segMan, object, SELECTOR(brLeft), celRect.left);
+ PUT_SEL32V(_segMan, object, SELECTOR(brRight), celRect.right);
+ PUT_SEL32V(_segMan, object, SELECTOR(brTop), celRect.top);
+ PUT_SEL32V(_segMan, object, SELECTOR(brBottom), celRect.bottom);
}
}
diff --git a/engines/sci/graphics/controls.cpp b/engines/sci/graphics/controls.cpp
index 7bfe050db9..5572d04ec5 100644
--- a/engines/sci/graphics/controls.cpp
+++ b/engines/sci/graphics/controls.cpp
@@ -142,9 +142,9 @@ void GfxControls::texteditSetBlinkTime() {
}
void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
- uint16 cursorPos = GET_SEL32V(_segMan, controlObject, cursor);
- uint16 maxChars = GET_SEL32V(_segMan, controlObject, max);
- reg_t textReference = GET_SEL32(_segMan, controlObject, text);
+ uint16 cursorPos = GET_SEL32V(_segMan, controlObject, SELECTOR(cursor));
+ uint16 maxChars = GET_SEL32V(_segMan, controlObject, SELECTOR(max));
+ reg_t textReference = GET_SEL32(_segMan, controlObject, SELECTOR(text));
Common::String text;
uint16 textSize, eventType, eventKey;
bool textChanged = false;
@@ -156,14 +156,14 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
if (!eventObject.isNull()) {
textSize = text.size();
- eventType = GET_SEL32V(_segMan, eventObject, type);
+ eventType = GET_SEL32V(_segMan, eventObject, SELECTOR(type));
switch (eventType) {
case SCI_EVENT_MOUSE_PRESS:
// TODO: Implement mouse support for cursor change
break;
case SCI_EVENT_KEYBOARD:
- eventKey = GET_SEL32V(_segMan, eventObject, message);
+ eventKey = GET_SEL32V(_segMan, eventObject, SELECTOR(message));
switch (eventKey) {
case SCI_KEY_BACKSPACE:
if (cursorPos > 0) {
@@ -207,9 +207,9 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
if (textChanged) {
GuiResourceId oldFontId = _text16->GetFontId();
- GuiResourceId fontId = GET_SEL32V(_segMan, controlObject, font);
- rect = Common::Rect(GET_SEL32V(_segMan, controlObject, nsLeft), GET_SEL32V(_segMan, controlObject, nsTop),
- GET_SEL32V(_segMan, controlObject, nsRight), GET_SEL32V(_segMan, controlObject, nsBottom));
+ GuiResourceId fontId = GET_SEL32V(_segMan, controlObject, SELECTOR(font));
+ rect = Common::Rect(GET_SEL32V(_segMan, controlObject, SELECTOR(nsLeft)), GET_SEL32V(_segMan, controlObject, SELECTOR(nsTop)),
+ GET_SEL32V(_segMan, controlObject, SELECTOR(nsRight)), GET_SEL32V(_segMan, controlObject, SELECTOR(nsBottom)));
texteditCursorErase();
_paint16->eraseRect(rect);
_text16->Box(text.c_str(), 0, rect, SCI_TEXT16_ALIGNMENT_LEFT, fontId);
@@ -228,7 +228,7 @@ void GfxControls::kernelTexteditChange(reg_t controlObject, reg_t eventObject) {
}
}
- PUT_SEL32V(_segMan, controlObject, cursor, cursorPos);
+ PUT_SEL32V(_segMan, controlObject, SELECTOR(cursor), cursorPos);
}
int GfxControls::getPicNotValid() {
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp
index 3c9e30c8c8..48f6d0161c 100644
--- a/engines/sci/graphics/coordadjuster.cpp
+++ b/engines/sci/graphics/coordadjuster.cpp
@@ -87,18 +87,18 @@ GfxCoordAdjuster32::~GfxCoordAdjuster32() {
}
void GfxCoordAdjuster32::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) {
- //int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY);
- //int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX);
+ //int16 resY = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resY));
+ //int16 resX = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resX));
//*x = ( *x * _screen->getWidth()) / resX;
//*y = ( *y * _screen->getHeight()) / resY;
- x -= GET_SEL32V(_segMan, planeObject, left);
- y -= GET_SEL32V(_segMan, planeObject, top);
+ x -= GET_SEL32V(_segMan, planeObject, SELECTOR(left));
+ y -= GET_SEL32V(_segMan, planeObject, SELECTOR(top));
}
void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) {
- //int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY);
- //int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX);
- x += GET_SEL32V(_segMan, planeObject, left);
- y += GET_SEL32V(_segMan, planeObject, top);
+ //int16 resY = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resY));
+ //int16 resX = GET_SEL32V(_s->_segMan, planeObj, SELECTOR(resX));
+ x += GET_SEL32V(_segMan, planeObject, SELECTOR(left));
+ y += GET_SEL32V(_segMan, planeObject, SELECTOR(top));
//*x = ( *x * resX) / _screen->getWidth();
//*y = ( *y * resY) / _screen->getHeight();
}
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index b00776fda9..f8f44ca1c4 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -52,7 +52,7 @@ GfxFrameout::~GfxFrameout() {
void GfxFrameout::kernelAddPlane(reg_t object) {
_planes.push_back(object);
- int16 planePri = GET_SEL32V(_segMan, object, priority) & 0xFFFF;
+ int16 planePri = GET_SEL32V(_segMan, object, SELECTOR(priority)) & 0xFFFF;
if (planePri > _highPlanePri)
_highPlanePri = planePri;
}
@@ -72,7 +72,7 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
_highPlanePri = 0;
for (uint32 planeNr = 0; planeNr < _planes.size(); planeNr++) {
- int16 planePri = GET_SEL32V(_segMan, _planes[planeNr], priority) & 0xFFFF;
+ int16 planePri = GET_SEL32V(_segMan, _planes[planeNr], SELECTOR(priority)) & 0xFFFF;
if (planePri > _highPlanePri)
_highPlanePri = planePri;
}
@@ -124,29 +124,29 @@ void GfxFrameout::kernelFrameout() {
for (uint32 planeNr = 0; planeNr < _planes.size(); planeNr++) {
planeObject = _planes[planeNr];
- planePriority = GET_SEL32V(_segMan, planeObject, priority);
+ planePriority = GET_SEL32V(_segMan, planeObject, SELECTOR(priority));
if (planePriority == -1) // Plane currently not meant to be shown
continue;
- planeRect.top = GET_SEL32V(_segMan, planeObject, top);
- planeRect.left = GET_SEL32V(_segMan, planeObject, left);
- planeRect.bottom = GET_SEL32V(_segMan, planeObject, bottom);
- planeRect.right = GET_SEL32V(_segMan, planeObject, right);
- planeResY = GET_SEL32V(_segMan, planeObject, resY);
- planeResX = GET_SEL32V(_segMan, planeObject, resX);
+ planeRect.top = GET_SEL32V(_segMan, planeObject, SELECTOR(top));
+ planeRect.left = GET_SEL32V(_segMan, planeObject, SELECTOR(left));
+ planeRect.bottom = GET_SEL32V(_segMan, planeObject, SELECTOR(bottom));
+ planeRect.right = GET_SEL32V(_segMan, planeObject, SELECTOR(right));
+ planeResY = GET_SEL32V(_segMan, planeObject, SELECTOR(resY));
+ planeResX = GET_SEL32V(_segMan, planeObject, SELECTOR(resX));
planeRect.top = (planeRect.top * _screen->getHeight()) / planeResY;
planeRect.left = (planeRect.left * _screen->getWidth()) / planeResX;
planeRect.bottom = (planeRect.bottom * _screen->getHeight()) / planeResY;
planeRect.right = (planeRect.right * _screen->getWidth()) / planeResX;
- planeBack = GET_SEL32V(_segMan, planeObject, back);
+ planeBack = GET_SEL32V(_segMan, planeObject, SELECTOR(back));
if (planeBack) {
_paint32->fillRect(planeRect, planeBack);
}
- planePictureNr = GET_SEL32V(_segMan, planeObject, picture);
+ planePictureNr = GET_SEL32V(_segMan, planeObject, SELECTOR(picture));
if ((planePictureNr != 0xFFFF) && (planePictureNr != 0xFFFE)) {
planePicture = new GfxPicture(_resMan, 0, _screen, _palette, planePictureNr, false);
planePictureCels = planePicture->getSci32celCount();
@@ -157,19 +157,19 @@ void GfxFrameout::kernelFrameout() {
itemEntry = itemData;
for (uint32 itemNr = 0; itemNr < _screenItems.size(); itemNr++) {
itemObject = _screenItems[itemNr];
- itemPlane = GET_SEL32(_segMan, itemObject, plane);
+ itemPlane = GET_SEL32(_segMan, itemObject, SELECTOR(plane));
if (planeObject == itemPlane) {
// Found an item on current plane
- itemEntry->viewId = GET_SEL32V(_segMan, itemObject, view);
- itemEntry->loopNo = GET_SEL32V(_segMan, itemObject, loop);
- itemEntry->celNo = GET_SEL32V(_segMan, itemObject, cel);
- itemEntry->x = GET_SEL32V(_segMan, itemObject, x);
- itemEntry->y = GET_SEL32V(_segMan, itemObject, y);
- itemEntry->z = GET_SEL32V(_segMan, itemObject, z);
- itemEntry->priority = GET_SEL32V(_segMan, itemObject, priority);
- itemEntry->signal = GET_SEL32V(_segMan, itemObject, signal);
- itemEntry->scaleX = GET_SEL32V(_segMan, itemObject, scaleX);
- itemEntry->scaleY = GET_SEL32V(_segMan, itemObject, scaleY);
+ itemEntry->viewId = GET_SEL32V(_segMan, itemObject, SELECTOR(view));
+ itemEntry->loopNo = GET_SEL32V(_segMan, itemObject, SELECTOR(loop));
+ itemEntry->celNo = GET_SEL32V(_segMan, itemObject, SELECTOR(cel));
+ itemEntry->x = GET_SEL32V(_segMan, itemObject, SELECTOR(x));
+ itemEntry->y = GET_SEL32V(_segMan, itemObject, SELECTOR(y));
+ itemEntry->z = GET_SEL32V(_segMan, itemObject, SELECTOR(z));
+ itemEntry->priority = GET_SEL32V(_segMan, itemObject, SELECTOR(priority));
+ itemEntry->signal = GET_SEL32V(_segMan, itemObject, SELECTOR(signal));
+ itemEntry->scaleX = GET_SEL32V(_segMan, itemObject, SELECTOR(scaleX));
+ itemEntry->scaleY = GET_SEL32V(_segMan, itemObject, SELECTOR(scaleY));
itemEntry->object = itemObject;
itemEntry->y = ((itemEntry->y * _screen->getHeight()) / planeResY);
@@ -235,11 +235,11 @@ void GfxFrameout::kernelFrameout() {
// TODO: rewrite this the "SCI2" way (i.e. implement the text buffer to draw inside kCreateTextBitmap)
Kernel *kernel = ((SciEngine *)g_engine)->getKernel();
if (lookup_selector(_segMan, itemEntry->object, kernel->_selectorCache.text, NULL, NULL) == kSelectorVariable) {
- Common::String text = _segMan->getString(GET_SEL32(_segMan, itemEntry->object, text));
- int16 fontRes = GET_SEL32V(_segMan, itemEntry->object, font);
+ Common::String text = _segMan->getString(GET_SEL32(_segMan, itemEntry->object, SELECTOR(text)));
+ int16 fontRes = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(font));
GfxFont *font = new GfxFont(_resMan, _screen, fontRes);
- bool dimmed = GET_SEL32V(_segMan, itemEntry->object, dimmed);
- uint16 foreColor = GET_SEL32V(_segMan, itemEntry->object, fore);
+ bool dimmed = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(dimmed));
+ uint16 foreColor = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(fore));
uint16 curX = itemEntry->x;
uint16 curY = itemEntry->y;
for (uint32 i = 0; i < text.size(); i++) {
diff --git a/engines/sci/graphics/menu.cpp b/engines/sci/graphics/menu.cpp
index ead575fc80..b5f4335b59 100644
--- a/engines/sci/graphics/menu.cpp
+++ b/engines/sci/graphics/menu.cpp
@@ -352,7 +352,7 @@ void GfxMenu::calculateTextWidth() {
}
reg_t GfxMenu::kernelSelect(reg_t eventObject) {
- int16 eventType = GET_SEL32V(_segMan, eventObject, type);
+ int16 eventType = GET_SEL32V(_segMan, eventObject, SELECTOR(type));
int16 keyPress, keyModifier;
Common::Point mousePosition;
GuiMenuItemList::iterator itemIterator = _itemList.begin();
@@ -364,8 +364,8 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject) {
switch (eventType) {
case SCI_EVENT_KEYBOARD:
- keyPress = GET_SEL32V(_segMan, eventObject, message);
- keyModifier = GET_SEL32V(_segMan, eventObject, modifiers);
+ keyPress = GET_SEL32V(_segMan, eventObject, SELECTOR(message));
+ keyModifier = GET_SEL32V(_segMan, eventObject, SELECTOR(modifiers));
switch (keyPress) {
case 0:
break;
@@ -434,7 +434,7 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject) {
_ports->setPort(_oldPort);
if ((itemEntry) || (forceClaimed))
- PUT_SEL32(_segMan, eventObject, claimed, make_reg(0, 1));
+ PUT_SEL32(_segMan, eventObject, SELECTOR(claimed), make_reg(0, 1));
if (itemEntry)
return make_reg(0, (itemEntry->menuId << 8) | (itemEntry->id));
return NULL_REG;
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index eecab76f5d..336aa04aef 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -267,11 +267,11 @@ void AudioPlayer::setSoundSync(ResourceId id, reg_t syncObjAddr, SegManager *seg
_syncOffset = 0;
if (_syncResource) {
- PUT_SEL32V(segMan, syncObjAddr, syncCue, 0);
+ PUT_SEL32V(segMan, syncObjAddr, SELECTOR(syncCue), 0);
} else {
warning("setSoundSync: failed to find resource %s", id.toString().c_str());
// Notify the scripts to stop sound sync
- PUT_SEL32V(segMan, syncObjAddr, syncCue, SIGNAL_OFFSET);
+ PUT_SEL32V(segMan, syncObjAddr, SELECTOR(syncCue), SIGNAL_OFFSET);
}
}
@@ -287,8 +287,8 @@ void AudioPlayer::doSoundSync(reg_t syncObjAddr, SegManager *segMan) {
_syncOffset += 2;
}
- PUT_SEL32V(segMan, syncObjAddr, syncTime, syncTime);
- PUT_SEL32V(segMan, syncObjAddr, syncCue, syncCue);
+ PUT_SEL32V(segMan, syncObjAddr, SELECTOR(syncTime), syncTime);
+ PUT_SEL32V(segMan, syncObjAddr, SELECTOR(syncCue), syncCue);
}
}
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index a0f0a06ec8..318adf01c9 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -49,9 +49,9 @@ namespace Sci {
#ifdef USE_OLD_MUSIC_FUNCTIONS
static void script_set_priority(ResourceManager *resMan, SegManager *segMan, SfxState *state, reg_t obj, int priority) {
- int song_nr = GET_SEL32V(segMan, obj, number);
+ int song_nr = GET_SEL32V(segMan, obj, SELECTOR(number));
Resource *song = resMan->findResource(ResourceId(kResourceTypeSound, song_nr), 0);
- int flags = GET_SEL32V(segMan, obj, flags);
+ int flags = GET_SEL32V(segMan, obj, SELECTOR(flags));
if (priority == -1) {
if (song->data[0] == 0xf0)
@@ -63,7 +63,7 @@ static void script_set_priority(ResourceManager *resMan, SegManager *segMan, Sfx
} else flags |= SCI1_SOUND_FLAG_SCRIPTED_PRI;
state->sfx_song_renice(FROBNICATE_HANDLE(obj), priority);
- PUT_SEL32V(segMan, obj, flags, flags);
+ PUT_SEL32V(segMan, obj, SELECTOR(flags), flags);
}
SongIterator *build_iterator(ResourceManager *resMan, int song_nr, SongIteratorType type, songit_id_t id) {
@@ -97,27 +97,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)",
PRINT_REG(obj), cue);
- /* PUT_SEL32V(segMan, obj, loops, GET_SEL32V(segMan, obj, loop) - 1);*/
- PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET);
+ /* PUT_SEL32V(segMan, obj, SELECTOR(loops), GET_SEL32V(segMan, obj, SELECTOR(loop));; - 1);*/
+ PUT_SEL32V(segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
break;
case SI_RELATIVE_CUE:
debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received relative cue %d",
PRINT_REG(obj), cue);
- PUT_SEL32V(segMan, obj, signal, cue + 0x7f);
+ PUT_SEL32V(segMan, obj, SELECTOR(signal), cue + 0x7f);
break;
case SI_ABSOLUTE_CUE:
debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x received absolute cue %d",
PRINT_REG(obj), cue);
- PUT_SEL32V(segMan, obj, signal, cue);
+ PUT_SEL32V(segMan, obj, SELECTOR(signal), cue);
break;
case SI_FINISHED:
debugC(2, kDebugLevelSound, "[process-sound] Song %04x:%04x finished",
PRINT_REG(obj));
- PUT_SEL32V(segMan, obj, signal, SIGNAL_OFFSET);
- PUT_SEL32V(segMan, obj, state, kSoundStopped);
+ PUT_SEL32V(segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
+ PUT_SEL32V(segMan, obj, SELECTOR(state), kSoundStopped);
break;
default:
@@ -252,7 +252,7 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
if (!obj.segment)
return;
- int number = GET_SEL32V(_segMan, obj, number);
+ int number = GET_SEL32V(_segMan, obj, SELECTOR(number));
#ifdef USE_OLD_MUSIC_FUNCTIONS
@@ -266,7 +266,7 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
SongIteratorType type = (_soundVersion <= SCI_VERSION_0_LATE) ? SCI_SONG_ITERATOR_TYPE_SCI0 : SCI_SONG_ITERATOR_TYPE_SCI1;
if (_soundVersion <= SCI_VERSION_0_LATE) {
- if (GET_SEL32V(_segMan, obj, nodePtr)) {
+ if (GET_SEL32V(_segMan, obj, SELECTOR(nodePtr));) {
_state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
_state->sfx_remove_song(handle);
}
@@ -280,11 +280,11 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
// Notify the engine
if (_soundVersion <= SCI_VERSION_0_LATE)
- PUT_SEL32V(_segMan, obj, state, kSoundInitialized);
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), kSoundInitialized);
else
- PUT_SEL32(_segMan, obj, nodePtr, obj);
+ PUT_SEL32(_segMan, obj, SELECTOR(nodePtr), obj);
- PUT_SEL32(_segMan, obj, handle, obj);
+ PUT_SEL32(_segMan, obj, SELECTOR(handle), obj);
#else
@@ -301,10 +301,10 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
newSound->soundRes = 0;
newSound->soundObj = obj;
- newSound->loop = GET_SEL32V(_segMan, obj, loop);
- newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF;
+ newSound->loop = GET_SEL32V(_segMan, obj, SELECTOR(loop));
+ newSound->prio = GET_SEL32V(_segMan, obj, SELECTOR(pri)) & 0xFF;
if (_soundVersion >= SCI_VERSION_1_LATE)
- newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, MUSIC_VOLUME_MAX);
+ newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, SELECTOR(vol)), 0, MUSIC_VOLUME_MAX);
// In SCI1.1 games, sound effects are started from here. If we can find
// a relevant audio resource, play it, otherwise switch to synthesized
@@ -326,11 +326,11 @@ void SoundCommandParser::cmdInitSound(reg_t obj, int16 value) {
if (newSound->soundRes || newSound->pStreamAud) {
// Notify the engine
if (_soundVersion <= SCI_VERSION_0_LATE)
- PUT_SEL32V(_segMan, obj, state, kSoundInitialized);
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), kSoundInitialized);
else
- PUT_SEL32(_segMan, obj, nodePtr, obj);
+ PUT_SEL32(_segMan, obj, SELECTOR(nodePtr), obj);
- PUT_SEL32(_segMan, obj, handle, obj);
+ PUT_SEL32(_segMan, obj, SELECTOR(handle), obj);
}
#endif
@@ -345,30 +345,30 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
if (_soundVersion <= SCI_VERSION_0_LATE) {
_state->sfx_song_set_status(handle, SOUND_STATUS_PLAYING);
- _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, loop));
- PUT_SEL32V(_segMan, obj, state, kSoundPlaying);
+ _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, SELECTOR(loop)););
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), kSoundPlaying);
} else if (_soundVersion == SCI_VERSION_1_EARLY) {
_state->sfx_song_set_status(handle, SOUND_STATUS_PLAYING);
- _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, loop));
- _state->sfx_song_renice(handle, GET_SEL32V(_segMan, obj, pri));
+ _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, SELECTOR(loop)););
+ _state->sfx_song_renice(handle, GET_SEL32V(_segMan, obj, SELECTOR(pri)););
RESTORE_BEHAVIOR rb = (RESTORE_BEHAVIOR) value; /* Too lazy to look up a default value for this */
_state->_songlib.setSongRestoreBehavior(handle, rb);
- PUT_SEL32V(_segMan, obj, signal, 0);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), 0);
} else if (_soundVersion == SCI_VERSION_1_LATE) {
- int looping = GET_SEL32V(_segMan, obj, loop);
- //int vol = GET_SEL32V(_segMan, obj, vol);
- int pri = GET_SEL32V(_segMan, obj, pri);
+ int looping = GET_SEL32V(_segMan, obj, SELECTOR(loop));
+ //int vol = GET_SEL32V(_segMan, obj, SELECTOR(vol));
+ int pri = GET_SEL32V(_segMan, obj, SELECTOR(pri));
int sampleLen = 0;
Song *song = _state->_songlib.findSong(handle);
- int songNumber = GET_SEL32V(_segMan, obj, number);
+ int songNumber = GET_SEL32V(_segMan, obj, SELECTOR(number));
- if (GET_SEL32V(_segMan, obj, nodePtr) && (song && songNumber != song->_resourceNum)) {
+ if (GET_SEL32V(_segMan, obj, SELECTOR(nodePtr)); && (song && songNumber != song->_resourceNum)) {
_state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
_state->sfx_remove_song(handle);
- PUT_SEL32(_segMan, obj, nodePtr, NULL_REG);
+ PUT_SEL32(_segMan, obj, SELECTOR(nodePtr), NULL_REG);
}
- if (!GET_SEL32V(_segMan, obj, nodePtr) && obj.segment) {
+ if (!GET_SEL32V(_segMan, obj, SELECTOR(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
@@ -386,7 +386,7 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
warning("Could not open song number %d", songNumber);
// Send a "stop handle" event so that the engine won't wait forever here
_state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
return;
}
debugC(2, kDebugLevelSound, "Initializing song number %d", songNumber);
@@ -394,15 +394,15 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
handle), 0, handle, songNumber);
}
- PUT_SEL32(_segMan, obj, nodePtr, obj);
- PUT_SEL32(_segMan, obj, handle, obj);
+ PUT_SEL32(_segMan, obj, SELECTOR(nodePtr), obj);
+ PUT_SEL32(_segMan, obj, SELECTOR(handle), obj);
}
if (obj.segment) {
_state->sfx_song_set_status(handle, SOUND_STATUS_PLAYING);
_state->sfx_song_set_loops(handle, looping);
_state->sfx_song_renice(handle, pri);
- PUT_SEL32V(_segMan, obj, signal, 0);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), 0);
}
}
@@ -414,7 +414,7 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
return;
}
- int number = obj.segment ? GET_SEL32V(_segMan, obj, number) : -1;
+ int number = obj.segment ? GET_SEL32V(_segMan, obj, SELECTOR(number)) : -1;
if (musicSlot->resnum != number) { // another sound loaded into struct
cmdDisposeSound(obj, value);
@@ -422,25 +422,25 @@ void SoundCommandParser::cmdPlaySound(reg_t obj, int16 value) {
// Find slot again :)
musicSlot = _music->getSlot(obj);
}
- int16 loop = GET_SEL32V(_segMan, obj, loop);
+ int16 loop = GET_SEL32V(_segMan, obj, SELECTOR(loop));
debugC(2, kDebugLevelSound, "cmdPlaySound: resource number %d, loop %d", number, loop);
- PUT_SEL32(_segMan, obj, handle, obj);
+ PUT_SEL32(_segMan, obj, SELECTOR(handle), obj);
if (_soundVersion >= SCI_VERSION_1_EARLY) {
- PUT_SEL32(_segMan, obj, nodePtr, obj);
- PUT_SEL32V(_segMan, obj, min, 0);
- PUT_SEL32V(_segMan, obj, sec, 0);
- PUT_SEL32V(_segMan, obj, frame, 0);
- PUT_SEL32V(_segMan, obj, signal, 0);
+ PUT_SEL32(_segMan, obj, SELECTOR(nodePtr), obj);
+ PUT_SEL32V(_segMan, obj, SELECTOR(min), 0);
+ PUT_SEL32V(_segMan, obj, SELECTOR(sec), 0);
+ PUT_SEL32V(_segMan, obj, SELECTOR(frame), 0);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), 0);
} else {
- PUT_SEL32V(_segMan, obj, state, kSoundPlaying);
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), kSoundPlaying);
}
- musicSlot->loop = GET_SEL32V(_segMan, obj, loop);
- musicSlot->prio = GET_SEL32V(_segMan, obj, priority);
+ musicSlot->loop = GET_SEL32V(_segMan, obj, SELECTOR(loop));
+ musicSlot->prio = GET_SEL32V(_segMan, obj, SELECTOR(priority));
if (_soundVersion >= SCI_VERSION_1_LATE)
- musicSlot->volume = GET_SEL32V(_segMan, obj, vol);
+ musicSlot->volume = GET_SEL32V(_segMan, obj, SELECTOR(vol));
_music->soundPlay(musicSlot);
#endif
@@ -457,7 +457,7 @@ void SoundCommandParser::changeSoundStatus(reg_t obj, int newStatus) {
if (obj.segment) {
_state->sfx_song_set_status(handle, newStatus);
if (_soundVersion <= SCI_VERSION_0_LATE)
- PUT_SEL32V(_segMan, obj, state, newStatus);
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), newStatus);
}
}
#endif
@@ -474,7 +474,7 @@ void SoundCommandParser::cmdDisposeSound(reg_t obj, int16 value) {
_state->sfx_remove_song(handle);
if (_soundVersion <= SCI_VERSION_0_LATE)
- PUT_SEL32V(_segMan, obj, handle, 0x0000);
+ PUT_SEL32V(_segMan, obj, SELECTOR(handle), 0x0000);
}
#else
@@ -488,11 +488,11 @@ void SoundCommandParser::cmdDisposeSound(reg_t obj, int16 value) {
cmdStopSound(obj, value);
_music->soundKill(musicSlot);
- PUT_SEL32V(_segMan, obj, handle, 0);
+ PUT_SEL32V(_segMan, obj, SELECTOR(handle), 0);
if (_soundVersion >= SCI_VERSION_1_EARLY)
- PUT_SEL32(_segMan, obj, nodePtr, NULL_REG);
+ PUT_SEL32(_segMan, obj, SELECTOR(nodePtr), NULL_REG);
else
- PUT_SEL32V(_segMan, obj, state, kSoundStopped);
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), kSoundStopped);
#endif
}
@@ -504,7 +504,7 @@ void SoundCommandParser::cmdStopSound(reg_t obj, int16 value) {
changeSoundStatus(obj, SOUND_STATUS_STOPPED);
if (_soundVersion >= SCI_VERSION_1_EARLY)
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
#else
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
@@ -513,10 +513,10 @@ void SoundCommandParser::cmdStopSound(reg_t obj, int16 value) {
}
if (_soundVersion <= SCI_VERSION_0_LATE) {
- PUT_SEL32V(_segMan, obj, state, kSoundStopped);
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), kSoundStopped);
} else {
- PUT_SEL32V(_segMan, obj, handle, 0);
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(handle), 0);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
}
musicSlot->dataInc = 0;
@@ -553,7 +553,7 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) {
if (_soundVersion <= SCI_VERSION_0_LATE) {
// Always pause the sound in SCI0 games. It's resumed in cmdResumeSound()
- PUT_SEL32V(_segMan, musicSlot->soundObj, state, kSoundPaused);
+ PUT_SEL32V(_segMan, musicSlot->soundObj, SELECTOR(state), kSoundPaused);
_music->soundPause(musicSlot);
} else {
_music->soundToggle(musicSlot, value);
@@ -578,7 +578,7 @@ void SoundCommandParser::cmdResumeSound(reg_t obj, int16 value) {
return;
}
- PUT_SEL32V(_segMan, musicSlot->soundObj, state, kSoundPlaying);
+ PUT_SEL32V(_segMan, musicSlot->soundObj, SELECTOR(state), kSoundPlaying);
_music->soundResume(musicSlot);
#endif
}
@@ -623,8 +623,8 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) {
** than fading it! */
_state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
if (_soundVersion <= SCI_VERSION_0_LATE)
- PUT_SEL32V(_segMan, obj, state, SOUND_STATUS_STOPPED);
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(state), SOUND_STATUS_STOPPED);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
} else {
fade_params_t fade;
fade.final_volume = _argv[2].toUint16();
@@ -639,11 +639,11 @@ void SoundCommandParser::cmdFadeSound(reg_t obj, int16 value) {
/* FIXME: The next couple of lines actually STOP the handle, rather
** than fading it! */
if (_argv[5].toUint16()) {
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
_state->sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
} else {
// FIXME: Support fade-and-continue. For now, send signal right away.
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
}
}
#else
@@ -696,8 +696,8 @@ void SoundCommandParser::cmdUpdateSound(reg_t obj, int16 value) {
#ifdef USE_OLD_MUSIC_FUNCTIONS
SongHandle handle = FROBNICATE_HANDLE(obj);
if (_soundVersion <= SCI_VERSION_0_LATE && obj.segment) {
- _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, loop));
- script_set_priority(_resMan, _segMan, _state, obj, GET_SEL32V(_segMan, obj, pri));
+ _state->sfx_song_set_loops(handle, GET_SEL32V(_segMan, obj, SELECTOR(loop)););
+ script_set_priority(_resMan, _segMan, _state, obj, GET_SEL32V(_segMan, obj, SELECTOR(pri)););
}
#else
MusicEntry *musicSlot = _music->getSlot(obj);
@@ -706,11 +706,11 @@ void SoundCommandParser::cmdUpdateSound(reg_t obj, int16 value) {
return;
}
- musicSlot->loop = GET_SEL32V(_segMan, obj, loop);
- int16 objVol = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, 255);
+ musicSlot->loop = GET_SEL32V(_segMan, obj, SELECTOR(loop));
+ int16 objVol = CLIP<int>(GET_SEL32V(_segMan, obj, SELECTOR(vol)), 0, 255);
if (objVol != musicSlot->volume)
_music->soundSetVolume(musicSlot, objVol);
- uint32 objPrio = GET_SEL32V(_segMan, obj, pri);
+ uint32 objPrio = GET_SEL32V(_segMan, obj, SELECTOR(pri));
if (objPrio != musicSlot->prio)
_music->soundSetPriority(musicSlot, objPrio);
@@ -737,7 +737,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
debugC(2, kDebugLevelSound, "--- [CUE] %04x:%04x Absolute Cue: %d",
PRINT_REG(obj), signal);
debugC(2, kDebugLevelSound, "abs-signal %04X", signal);
- PUT_SEL32V(_segMan, obj, signal, signal);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), signal);
break;
case SI_RELATIVE_CUE:
@@ -747,17 +747,17 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
/* FIXME to match commented-out semantics
* below, with proper storage of dataInc and
* signal in the iterator code. */
- PUT_SEL32V(_segMan, obj, dataInc, signal);
+ PUT_SEL32V(_segMan, obj, SELECTOR(dataInc), signal);
debugC(2, kDebugLevelSound, "rel-signal %04X", signal);
if (_soundVersion == SCI_VERSION_1_EARLY)
- PUT_SEL32V(_segMan, obj, signal, signal);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), signal);
else
- PUT_SEL32V(_segMan, obj, signal, signal + 127);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), signal + 127);
break;
case SI_FINISHED:
debugC(2, kDebugLevelSound, "--- [FINISHED] %04x:%04x", PRINT_REG(obj));
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
break;
case SI_LOOP:
@@ -766,30 +766,30 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
//switch (signal) {
//case 0x00:
- // if (dataInc!=GET_SEL32V(segMan, obj, dataInc)) {
- // PUT_SEL32V(segMan, obj, dataInc, dataInc);
- // PUT_SEL32V(segMan, obj, signal, dataInc+0x7f);
+ // if (dataInc!=GET_SEL32V(segMan, obj, SELECTOR(dataInc));) {
+ // PUT_SEL32V(segMan, obj, SELECTOR(dataInc), dataInc);
+ // PUT_SEL32V(segMan, obj, SELECTOR(signal), dataInc+0x7f);
// } else {
- // PUT_SEL32V(segMan, obj, signal, signal);
+ // PUT_SEL32V(segMan, obj, SELECTOR(signal), signal);
// }
// break;
//case 0xFF: // May be unnecessary
// s->_sound.sfx_song_set_status(handle, SOUND_STATUS_STOPPED);
// break;
//default :
- // if (dataInc!=GET_SEL32V(segMan, obj, dataInc)) {
- // PUT_SEL32V(segMan, obj, dataInc, dataInc);
- // PUT_SEL32V(segMan, obj, signal, dataInc + 0x7f);
+ // if (dataInc!=GET_SEL32V(segMan, obj, SELECTOR(dataInc));) {
+ // PUT_SEL32V(segMan, obj, SELECTOR(dataInc), dataInc);
+ // PUT_SEL32V(segMan, obj, SELECTOR(signal), dataInc + 0x7f);
// } else {
- // PUT_SEL32V(segMan, obj, signal, signal);
+ // PUT_SEL32V(segMan, obj, SELECTOR(signal), signal);
// }
// break;
//}
if (_soundVersion == SCI_VERSION_1_EARLY) {
- PUT_SEL32V(_segMan, obj, min, min);
- PUT_SEL32V(_segMan, obj, sec, sec);
- PUT_SEL32V(_segMan, obj, frame, frame);
+ PUT_SEL32V(_segMan, obj, SELECTOR(min), min);
+ PUT_SEL32V(_segMan, obj, SELECTOR(sec), sec);
+ PUT_SEL32V(_segMan, obj, SELECTOR(frame), frame);
}
#else
MusicEntry *musicSlot = _music->getSlot(obj);
@@ -823,14 +823,14 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
} else {
// Update MIDI slots
if (musicSlot->signal == 0) {
- if (musicSlot->dataInc != GET_SEL32V(_segMan, obj, dataInc)) {
+ if (musicSlot->dataInc != GET_SEL32V(_segMan, obj, SELECTOR(dataInc))) {
if (_kernel->_selectorCache.dataInc > -1)
- PUT_SEL32V(_segMan, obj, dataInc, musicSlot->dataInc);
- PUT_SEL32V(_segMan, obj, signal, musicSlot->dataInc + 127);
+ PUT_SEL32V(_segMan, obj, SELECTOR(dataInc), musicSlot->dataInc);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), musicSlot->dataInc + 127);
}
} else {
// Sync the signal of the sound object
- PUT_SEL32V(_segMan, obj, signal, musicSlot->signal);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), musicSlot->signal);
// We need to do this especially because state selector needs to get updated
if (musicSlot->signal == SIGNAL_OFFSET)
cmdStopSound(obj, 0);
@@ -842,7 +842,7 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
if (_soundVersion <= SCI_VERSION_0_LATE) {
cmdStopSound(obj, 0);
} else {
- PUT_SEL32V(_segMan, obj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(signal), SIGNAL_OFFSET);
if (musicSlot->stopAfterFading)
cmdStopSound(obj, 0);
}
@@ -850,14 +850,14 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) {
// Sync loop selector for SCI0
if (_soundVersion <= SCI_VERSION_0_LATE)
- PUT_SEL32V(_segMan, obj, loop, musicSlot->loop);
+ PUT_SEL32V(_segMan, obj, SELECTOR(loop), musicSlot->loop);
musicSlot->signal = 0;
if (_soundVersion >= SCI_VERSION_1_EARLY) {
- PUT_SEL32V(_segMan, obj, min, musicSlot->ticker / 3600);
- PUT_SEL32V(_segMan, obj, sec, musicSlot->ticker % 3600 / 60);
- PUT_SEL32V(_segMan, obj, frame, musicSlot->ticker);
+ PUT_SEL32V(_segMan, obj, SELECTOR(min), musicSlot->ticker / 3600);
+ PUT_SEL32V(_segMan, obj, SELECTOR(sec), musicSlot->ticker % 3600 / 60);
+ PUT_SEL32V(_segMan, obj, SELECTOR(frame), musicSlot->ticker);
}
#endif
@@ -906,10 +906,10 @@ void SoundCommandParser::cmdStopAllSounds(reg_t obj, int16 value) {
const MusicList::iterator end = _music->getPlayListEnd();
for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) {
if (_soundVersion <= SCI_VERSION_0_LATE) {
- PUT_SEL32V(_segMan, (*i)->soundObj, state, kSoundStopped);
+ PUT_SEL32V(_segMan, (*i)->soundObj, SELECTOR(state), kSoundStopped);
} else {
- PUT_SEL32V(_segMan, obj, handle, 0);
- PUT_SEL32V(_segMan, (*i)->soundObj, signal, SIGNAL_OFFSET);
+ PUT_SEL32V(_segMan, obj, SELECTOR(handle), 0);
+ PUT_SEL32V(_segMan, (*i)->soundObj, SELECTOR(signal), SIGNAL_OFFSET);
}
(*i)->dataInc = 0;
@@ -940,7 +940,7 @@ void SoundCommandParser::cmdSetSoundVolume(reg_t obj, int16 value) {
if (musicSlot->volume != value) {
musicSlot->volume = value;
_music->soundSetVolume(musicSlot, value);
- PUT_SEL32V(_segMan, obj, vol, value);
+ PUT_SEL32V(_segMan, obj, SELECTOR(vol), value);
}
#endif
}
@@ -967,12 +967,12 @@ void SoundCommandParser::cmdSetSoundPriority(reg_t obj, int16 value) {
warning("cmdSetSoundPriority: Attempt to unset song priority when there is no built-in value");
//pSnd->prio=0;field_15B=0
- PUT_SEL32V(_segMan, obj, flags, GET_SEL32V(_segMan, obj, flags) & 0xFD);
+ PUT_SEL32V(_segMan, obj, SELECTOR(flags), GET_SEL32V(_segMan, obj, SELECTOR(flags)) & 0xFD);
} else {
// Scripted priority
//pSnd->field_15B=1;
- PUT_SEL32V(_segMan, obj, flags, GET_SEL32V(_segMan, obj, flags) | 2);
+ PUT_SEL32V(_segMan, obj, SELECTOR(flags), GET_SEL32V(_segMan, obj, SELECTOR(flags)) | 2);
//DoSOund(0xF,hobj,w)
}
#endif
@@ -983,7 +983,7 @@ void SoundCommandParser::cmdSetSoundLoop(reg_t obj, int16 value) {
return;
#ifdef USE_OLD_MUSIC_FUNCTIONS
- if (!GET_SEL32(_segMan, obj, nodePtr).isNull()) {
+ if (!GET_SEL32(_segMan, obj, SELECTOR(nodePtr));.isNull()) {
SongHandle handle = FROBNICATE_HANDLE(obj);
_state->sfx_song_set_loops(handle, value);
}
@@ -1008,7 +1008,7 @@ void SoundCommandParser::cmdSetSoundLoop(reg_t obj, int16 value) {
musicSlot->loop = 1; // actually plays the music once
}
- PUT_SEL32V(_segMan, obj, loop, musicSlot->loop);
+ PUT_SEL32V(_segMan, obj, SELECTOR(loop), musicSlot->loop);
#endif
}
@@ -1061,11 +1061,11 @@ void SoundCommandParser::reconstructPlayList(int savegame_version) {
}
if ((*i)->status == kSoundPlaying) {
if (savegame_version < 14) {
- (*i)->dataInc = GET_SEL32V(_segMan, (*i)->soundObj, dataInc);
- (*i)->signal = GET_SEL32V(_segMan, (*i)->soundObj, signal);
+ (*i)->dataInc = GET_SEL32V(_segMan, (*i)->soundObj, SELECTOR(dataInc));
+ (*i)->signal = GET_SEL32V(_segMan, (*i)->soundObj, SELECTOR(signal));
if (_soundVersion >= SCI_VERSION_1_LATE)
- (*i)->volume = GET_SEL32V(_segMan, (*i)->soundObj, vol);
+ (*i)->volume = GET_SEL32V(_segMan, (*i)->soundObj, SELECTOR(vol));
}
cmdPlaySound((*i)->soundObj, 0);
@@ -1101,7 +1101,7 @@ void SoundCommandParser::startNewSound(int number) {
MusicEntry *song = *_music->getPlayListStart();
reg_t soundObj = song->soundObj;
cmdDisposeSound(soundObj, 0);
- PUT_SEL32V(_segMan, soundObj, number, number);
+ PUT_SEL32V(_segMan, soundObj, SELECTOR(number), number);
cmdInitSound(soundObj, 0);
cmdPlaySound(soundObj, 0);
#endif