aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/selector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine/selector.cpp')
-rw-r--r--engines/sci/engine/selector.cpp56
1 files changed, 35 insertions, 21 deletions
diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp
index 320f2c0664..2bc4051a79 100644
--- a/engines/sci/engine/selector.cpp
+++ b/engines/sci/engine/selector.cpp
@@ -21,6 +21,7 @@
*/
#include "sci/sci.h"
+#include "sci/engine/features.h"
#include "sci/engine/kernel.h"
#include "sci/engine/state.h"
#include "sci/engine/selector.h"
@@ -57,11 +58,11 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(nsTop);
FIND_SELECTOR(nsLeft);
FIND_SELECTOR(nsBottom);
+ FIND_SELECTOR(nsRight);
FIND_SELECTOR(lsTop);
FIND_SELECTOR(lsLeft);
FIND_SELECTOR(lsBottom);
FIND_SELECTOR(lsRight);
- FIND_SELECTOR(nsRight);
FIND_SELECTOR(signal);
FIND_SELECTOR(illegalBits);
FIND_SELECTOR(brTop);
@@ -173,6 +174,7 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(left);
FIND_SELECTOR(bottom);
FIND_SELECTOR(right);
+ FIND_SELECTOR(seenRect);
FIND_SELECTOR(resY);
FIND_SELECTOR(resX);
FIND_SELECTOR(dimmed);
@@ -180,6 +182,7 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(back);
FIND_SELECTOR(skip);
FIND_SELECTOR(borderColor);
+ FIND_SELECTOR(width);
FIND_SELECTOR(fixPriority);
FIND_SELECTOR(mirrored);
FIND_SELECTOR(visible);
@@ -192,7 +195,12 @@ void Kernel::mapSelectors() {
FIND_SELECTOR(textLeft);
FIND_SELECTOR(textBottom);
FIND_SELECTOR(textRight);
+ FIND_SELECTOR(title);
+ FIND_SELECTOR(titleFont);
+ FIND_SELECTOR(titleFore);
+ FIND_SELECTOR(titleBack);
FIND_SELECTOR(magnifier);
+ FIND_SELECTOR(frameOut);
FIND_SELECTOR(casts);
#endif
}
@@ -207,10 +215,17 @@ reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId) {
}
#ifdef ENABLE_SCI32
-void updateInfoFlagViewVisible(Object *obj, int offset) {
- // TODO: Make this correct for all SCI versions
- // Selectors 26 through 44 are selectors for View script objects in SQ6
- if (offset >= 26 && offset <= 44 && getSciVersion() >= SCI_VERSION_2) {
+void updateInfoFlagViewVisible(Object *obj, int index) {
+ int minIndex, maxIndex;
+ if (g_sci->_features->usesAlternateSelectors()) {
+ minIndex = 24;
+ maxIndex = 43;
+ } else {
+ minIndex = 26;
+ maxIndex = 44;
+ }
+
+ if (index >= minIndex && index <= maxIndex && getSciVersion() >= SCI_VERSION_2) {
obj->setInfoSelectorFlag(kInfoFlagViewVisible);
}
}
@@ -220,20 +235,19 @@ void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t
ObjVarRef address;
if ((selectorId < 0) || (selectorId > (int)g_sci->getKernel()->getSelectorNamesSize())) {
- error("Attempt to write to invalid selector %d of"
- " object at %04x:%04x.", selectorId, PRINT_REG(object));
- return;
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("Attempt to write to invalid selector %d. Address %04x:%04x, %s", selectorId, PRINT_REG(object), origin.toString().c_str());
}
- if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable)
- error("Selector '%s' of object at %04x:%04x could not be"
- " written to", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
- else {
- *address.getPointer(segMan) = value;
+ if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable) {
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("Selector '%s' of object could not be written to. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
+ }
+
+ *address.getPointer(segMan) = value;
#ifdef ENABLE_SCI32
- updateInfoFlagViewVisible(segMan->getObject(object), selectorId);
+ updateInfoFlagViewVisible(segMan->getObject(object), address.varindex);
#endif
- }
}
void invokeSelector(EngineState *s, reg_t object, int selectorId,
@@ -249,12 +263,12 @@ void invokeSelector(EngineState *s, reg_t object, int selectorId,
slc_type = lookupSelector(s->_segMan, object, selectorId, NULL, NULL);
if (slc_type == kSelectorNone) {
- error("Selector '%s' of object at %04x:%04x could not be invoked",
- g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("invokeSelector: Selector '%s' could not be invoked. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
}
if (slc_type == kSelectorVariable) {
- error("Attempting to invoke variable selector %s of object %04x:%04x",
- g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("invokeSelector: Attempting to invoke variable selector %s. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
}
for (i = 0; i < argc; i++)
@@ -282,8 +296,8 @@ SelectorType lookupSelector(SegManager *segMan, reg_t obj_location, Selector sel
selectorId &= ~1;
if (!obj) {
- error("lookupSelector(): Attempt to send to non-object or invalid script. Address was %04x:%04x",
- PRINT_REG(obj_location));
+ const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
+ error("lookupSelector: Attempt to send to non-object or invalid script. Address %04x:%04x, %s", PRINT_REG(obj_location), origin.toString().c_str());
}
index = obj->locateVarSelector(segMan, selectorId);