[Scummvm-git-logs] scummvm master -> 02598b447325391d0dad3bc92bd5e194fd91822c
csnover
csnover at users.noreply.github.com
Mon Dec 12 03:10:26 CET 2016
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5b5aaee57b SCI32: Implement List sort
02598b4473 SCI32: Add workarounds for Hoyle5 Crazy Eights
Commit: 5b5aaee57b16605d44c8b9f1f3279c2d4b097aca
https://github.com/scummvm/scummvm/commit/5b5aaee57b16605d44c8b9f1f3279c2d4b097aca
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-11T20:09:48-06:00
Commit Message:
SCI32: Implement List sort
Used by Hoyle5.
Also includes a tiny amount of cleanup in kAddAfter for
consistency with kAddBefore.
Changed paths:
engines/sci/engine/kernel.h
engines/sci/engine/kernel_tables.h
engines/sci/engine/klists.cpp
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 03c8a67..5fb1ab6 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -591,6 +591,7 @@ reg_t kListIndexOf(EngineState *s, int argc, reg_t *argv);
reg_t kListEachElementDo(EngineState *s, int argc, reg_t *argv);
reg_t kListFirstTrue(EngineState *s, int argc, reg_t *argv);
reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv);
+reg_t kListSort(EngineState *s, int argc, reg_t *argv);
reg_t kEditText(EngineState *s, int argc, reg_t *argv);
reg_t kSetScroll(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index d847cf0..1cfcd49 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -434,7 +434,7 @@ static const SciKernelMapSubEntry kList_subops[] = {
{ SIG_SINCE_SCI21, 19, MAP_CALL(ListEachElementDo), "li(.*)", NULL },
{ SIG_SINCE_SCI21, 20, MAP_CALL(ListFirstTrue), "li(.*)", NULL },
{ SIG_SINCE_SCI21, 21, MAP_CALL(ListAllTrue), "li(.*)", NULL },
- { SIG_SINCE_SCI21, 22, MAP_CALL(Sort), "ooo", NULL },
+ { SIG_SINCE_SCI21, 22, MAP_CALL(ListSort), "li(i)", NULL },
SCI_SUBOPENTRY_TERMINATOR
};
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 16ce236..de5d7f1 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -302,14 +302,14 @@ reg_t kAddToEnd(EngineState *s, int argc, reg_t *argv) {
reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) {
List *list = s->_segMan->lookupList(argv[0]);
- Node *firstnode = argv[1].isNull() ? NULL : s->_segMan->lookupNode(argv[1]);
- Node *newnode = s->_segMan->lookupNode(argv[2]);
+ Node *firstNode = s->_segMan->lookupNode(argv[1]);
+ Node *newNode = s->_segMan->lookupNode(argv[2]);
#ifdef CHECK_LISTS
checkListPointer(s->_segMan, argv[0]);
#endif
- if (!newnode) {
+ if (!newNode) {
error("New 'node' %04x:%04x is not a node", PRINT_REG(argv[2]));
return NULL_REG;
}
@@ -320,22 +320,64 @@ reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) {
}
if (argc == 4)
- newnode->key = argv[3];
+ newNode->key = argv[3];
- if (firstnode) { // We're really appending after
- reg_t oldnext = firstnode->succ;
+ if (firstNode) { // We're really appending after
+ const reg_t oldNext = firstNode->succ;
- newnode->pred = argv[1];
- firstnode->succ = argv[2];
- newnode->succ = oldnext;
+ newNode->pred = argv[1];
+ firstNode->succ = argv[2];
+ newNode->succ = oldNext;
- if (oldnext.isNull()) // Appended after last node?
+ if (oldNext.isNull()) // Appended after last node?
// Set new node as last list node
list->last = argv[2];
else
- s->_segMan->lookupNode(oldnext)->pred = argv[2];
+ s->_segMan->lookupNode(oldNext)->pred = argv[2];
- } else { // !firstnode
+ } else {
+ addToFront(s, argv[0], argv[2]); // Set as initial list node
+ }
+
+ return s->r_acc;
+}
+
+reg_t kAddBefore(EngineState *s, int argc, reg_t *argv) {
+ List *list = s->_segMan->lookupList(argv[0]);
+ Node *firstNode = s->_segMan->lookupNode(argv[1]);
+ Node *newNode = s->_segMan->lookupNode(argv[2]);
+
+#ifdef CHECK_LISTS
+ checkListPointer(s->_segMan, argv[0]);
+#endif
+
+ if (!newNode) {
+ error("New 'node' %04x:%04x is not a node", PRINT_REG(argv[2]));
+ return NULL_REG;
+ }
+
+ if (argc != 3 && argc != 4) {
+ error("kAddBefore: Haven't got 3 or 4 arguments, aborting");
+ return NULL_REG;
+ }
+
+ if (argc == 4)
+ newNode->key = argv[3];
+
+ if (firstNode) { // We're really appending before
+ const reg_t oldPred = firstNode->pred;
+
+ newNode->succ = argv[1];
+ firstNode->pred = argv[2];
+ newNode->pred = oldPred;
+
+ if (oldPred.isNull()) // Appended before first node?
+ // Set new node as first list node
+ list->first = argv[2];
+ else
+ s->_segMan->lookupNode(oldPred)->succ = argv[2];
+
+ } else {
addToFront(s, argv[0], argv[2]); // Set as initial list node
}
@@ -686,17 +728,56 @@ reg_t kListAllTrue(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+reg_t kListSort(EngineState *s, int argc, reg_t *argv) {
+ List *list = s->_segMan->lookupList(argv[0]);
+ const int16 selector = argv[1].toSint16();
+ const bool isDescending = argc > 2 ? (bool)argv[2].toUint16() : false;
+
+ reg_t firstNode = list->first;
+ for (reg_t node = firstNode; node != NULL_REG; node = s->_segMan->lookupNode(firstNode)->succ) {
+
+ reg_t a;
+ if (selector == -1) {
+ a = s->_segMan->lookupNode(node)->value;
+ } else {
+ a = readSelector(s->_segMan, s->_segMan->lookupNode(node)->value, selector);
+ }
+
+ firstNode = node;
+ for (reg_t newNode = s->_segMan->lookupNode(node)->succ; newNode != NULL_REG; newNode = s->_segMan->lookupNode(newNode)->succ) {
+ reg_t b;
+ if (selector == -1) {
+ b = s->_segMan->lookupNode(newNode)->value;
+ } else {
+ b = readSelector(s->_segMan, s->_segMan->lookupNode(newNode)->value, selector);
+ }
+
+ if ((!isDescending && b < a) || (isDescending && a < b)) {
+ firstNode = newNode;
+ a = b;
+ }
+ }
+
+ if (firstNode != node) {
+ reg_t buf[4] = { argv[0], s->_segMan->lookupNode(firstNode)->key };
+ kDeleteKey(s, 2, buf);
+
+ buf[1] = node;
+ buf[2] = firstNode;
+ buf[3] = s->_segMan->lookupNode(firstNode)->value;
+ kAddBefore(s, 4, buf);
+ }
+ }
+
+ return s->r_acc;
+}
+
reg_t kList(EngineState *s, int argc, reg_t *argv) {
if (!s)
return make_reg(0, getSciVersion());
error("not supposed to call this");
}
-reg_t kAddBefore(EngineState *s, int argc, reg_t *argv) {
- error("Unimplemented function kAddBefore called");
- return s->r_acc;
-}
-
reg_t kMoveToFront(EngineState *s, int argc, reg_t *argv) {
error("Unimplemented function kMoveToFront called");
return s->r_acc;
Commit: 02598b447325391d0dad3bc92bd5e194fd91822c
https://github.com/scummvm/scummvm/commit/02598b447325391d0dad3bc92bd5e194fd91822c
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-12-11T20:09:48-06:00
Commit Message:
SCI32: Add workarounds for Hoyle5 Crazy Eights
Changed paths:
engines/sci/engine/kernel_tables.h
engines/sci/engine/workarounds.cpp
engines/sci/engine/workarounds.h
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 1cfcd49..2db3c59 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -429,7 +429,7 @@ static const SciKernelMapSubEntry kList_subops[] = {
{ SIG_SINCE_SCI21, 14, MAP_CALL(MoveToEnd), "ln", NULL },
{ SIG_SINCE_SCI21, 15, MAP_CALL(FindKey), "l.", NULL },
{ SIG_SINCE_SCI21, 16, MAP_CALL(DeleteKey), "l.", NULL },
- { SIG_SINCE_SCI21, 17, MAP_CALL(ListAt), "li", NULL },
+ { SIG_SINCE_SCI21, 17, MAP_CALL(ListAt), "li", kListAt_workarounds },
{ SIG_SINCE_SCI21, 18, MAP_CALL(ListIndexOf) , "l[io]", NULL },
{ SIG_SINCE_SCI21, 19, MAP_CALL(ListEachElementDo), "li(.*)", NULL },
{ SIG_SINCE_SCI21, 20, MAP_CALL(ListFirstTrue), "li(.*)", NULL },
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 30f82e9..c87156b 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -280,6 +280,9 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
{ GID_HOYLE4, 500, 17, 1, "Character", "say", NULL, 504, { WORKAROUND_FAKE, 0 } }, // sometimes while playing Cribbage (e.g. when the opponent says "Last Card") - bug #5662
{ GID_HOYLE4, 800, 870, 0, "EuchreStrategy", "thinkLead", NULL, 0, { WORKAROUND_FAKE, 0 } }, // while playing Euchre, happens at least on 2nd or 3rd turn - bug #6602
{ GID_HOYLE4, -1, 937, 0, "IconBar", "dispatchEvent", NULL, 408, { WORKAROUND_FAKE, 0 } }, // pressing ENTER on scoreboard while mouse is not on OK button, may not happen all the time - bug #6603
+ { GID_HOYLE5, -1, 14, -1, NULL, "select", NULL, 1, { WORKAROUND_FAKE, 0 } }, // dragging the sliders in game settings
+ { GID_HOYLE5, -1, 64937, -1, NULL, "select", NULL, 7, { WORKAROUND_FAKE, 0 } }, // clicking the "control" and "options" buttons in the icon bar
+ { GID_HOYLE5, -1, 64937, -1, "IconBar", "handleEvent", NULL, 0, { WORKAROUND_FAKE, 0 } }, // clicking on any button in the icon bar
{ GID_ISLANDBRAIN, 100, 937, 0, "IconBar", "dispatchEvent", NULL, 58, { WORKAROUND_FAKE, 0 } }, // when using ENTER at the startup menu - bug #5241
{ GID_ISLANDBRAIN, 140, 140, 0, "piece", "init", NULL, 3, { WORKAROUND_FAKE, 1 } }, // first puzzle right at the start, some initialization variable. bnt is done on it, and it should be non-0
{ GID_ISLANDBRAIN, 200, 268, 0, "anElement", "select", NULL, 0, { WORKAROUND_FAKE, 0 } }, // elements puzzle, gets used before super TextIcon
@@ -666,6 +669,12 @@ const SciWorkaroundEntry kIsObject_workarounds[] = {
SCI_WORKAROUNDENTRY_TERMINATOR
};
+// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
+const SciWorkaroundEntry kListAt_workarounds[] = {
+ { GID_HOYLE5, 100, 64999, 0, "theHands", "at", NULL, 0, { WORKAROUND_FAKE, 0 } }, // After the first hand is dealt in Crazy Eights game in demo, an object is passed instead of a number
+ SCI_WORKAROUNDENTRY_TERMINATOR
+};
+
// gameID, room,script,lvl, object-name, method-name, local-call-signature, index, workaround
const SciWorkaroundEntry kMemory_workarounds[] = {
{ GID_LAURABOW2, -1, 999, 0, "", "export 6", NULL, 0, { WORKAROUND_FAKE, 0 } }, // during the intro, when exiting the train (room 160), talking to Mr. Augustini, etc. - bug #4944
diff --git a/engines/sci/engine/workarounds.h b/engines/sci/engine/workarounds.h
index f93226d..86b4ee2 100644
--- a/engines/sci/engine/workarounds.h
+++ b/engines/sci/engine/workarounds.h
@@ -82,6 +82,7 @@ extern const SciWorkaroundEntry kGraphFillBoxForeground_workarounds[];
extern const SciWorkaroundEntry kGraphFillBoxAny_workarounds[];
extern const SciWorkaroundEntry kGraphRedrawBox_workarounds[];
extern const SciWorkaroundEntry kIsObject_workarounds[];
+extern const SciWorkaroundEntry kListAt_workarounds[];
extern const SciWorkaroundEntry kMemory_workarounds[];
extern const SciWorkaroundEntry kMoveCursor_workarounds[];
extern const SciWorkaroundEntry kNewWindow_workarounds[];
More information about the Scummvm-git-logs
mailing list