[Scummvm-git-logs] scummvm master -> 5e60cbf17eef38ae71b0983690d66cc2bc4b2acb
somaen
einarjohants at gmail.com
Fri Feb 12 20:58:21 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5e60cbf17e TINSEL: Create a stub-system, and map SETSYSTEMVAR
Commit: 5e60cbf17eef38ae71b0983690d66cc2bc4b2acb
https://github.com/scummvm/scummvm/commit/5e60cbf17eef38ae71b0983690d66cc2bc4b2acb
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2021-02-12T21:58:08+01:00
Commit Message:
TINSEL: Create a stub-system, and map SETSYSTEMVAR
Changed paths:
engines/tinsel/tinlib.cpp
diff --git a/engines/tinsel/tinlib.cpp b/engines/tinsel/tinlib.cpp
index c8e969fd27..c79f69f1b0 100644
--- a/engines/tinsel/tinlib.cpp
+++ b/engines/tinsel/tinlib.cpp
@@ -4167,6 +4167,32 @@ int WhichInventory() {
}
+struct NoirMapping {
+ const char *name;
+ int libCode;
+ int numArgs;
+};
+
+NoirMapping translateNoirLibCode(int libCode, int32 *pp) {
+ // This function allows us to both log the called library functions, as well
+ // as to stub the ones we haven't yet implemented. Eventually this might
+ // get rolled up into a lookup table similar to DW1 and DW2, but for now
+ // this is convenient for debug.
+ NoirMapping mapping;
+ switch (libCode) {
+ case 153:
+ mapping = NoirMapping{"SETSYSTEMVAR", SETSYSTEMVAR, 2};
+ pp -= mapping.numArgs - 1;
+ debug(7, "%s(%d, 0x%08X)", mapping.name, pp[0], pp[1]);
+ break;
+ default:
+ error("Unmapped libCode %d", libCode);
+ }
+
+ return mapping;
+}
+
+
/**
* Subtract one less that the number of parameters from pp
* pp then points to the first parameter.
@@ -4186,7 +4212,12 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
else if (!TinselV2) libCode = DW1_CODES[operand];
else if (TinselV2Demo) libCode = DW2DEMO_CODES[operand];
else if (TinselV3) {
- error("TODO: Implement library routines for Discworld Noir");
+ NoirMapping mapping = translateNoirLibCode(operand, pp);
+ libCode = mapping.libCode;
+ if (libCode == ZZZZZZ) {
+ debug(7, "%08X CallLibraryRoutine op %d (escOn %d, myEscape %d)", pic->hCode, operand, pic->escOn, pic->myEscape);
+ return -mapping.numArgs;
+ }
}
else libCode = DW2_CODES[operand];
@@ -5190,7 +5221,7 @@ int CallLibraryRoutine(CORO_PARAM, int operand, int32 *pp, const INT_CONTEXT *pi
return -2;
case SETSYSTEMVAR:
- // DW1 only
+ // DW1 & Noir
pp -= 1; // 2 parameters
SetSystemVar(pp[0], pp[1]);
return -2;
More information about the Scummvm-git-logs
mailing list