diff options
author | Filippos Karapetis | 2009-09-29 14:24:07 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-09-29 14:24:07 +0000 |
commit | f9296a64459a09961bdf61fa4dbb3d3f524a4c25 (patch) | |
tree | 47e58f397493e87f18560b7891cbb23afa668eb2 /engines/sci/engine | |
parent | af4c6c5f5b642e6a53596b7a00d57e2060ba0693 (diff) | |
download | scummvm-rg350-f9296a64459a09961bdf61fa4dbb3d3f524a4c25.tar.gz scummvm-rg350-f9296a64459a09961bdf61fa4dbb3d3f524a4c25.tar.bz2 scummvm-rg350-f9296a64459a09961bdf61fa4dbb3d3f524a4c25.zip |
- Changed the unimplemented debug SCI kernel functions (InspectObj, ShowSends, ShowObjs, ShowFree, StackUsage and Profiler) to be dummy functions - we have our own debugger, and don't use these functions for debugging
- Removed the function number parameter from all kernel functions, as it's no longer needed, and removed the FAKE_FUNCT_NR hack
- Removed kUnknown() and kStub()
- Dummy/unknown kernel functions are no longer invoked, and a warning is shown instead, with the paremeters passed to them
Note: there is an evil hack used for debugging scripts in invoke_selector(), which probably no longer works now
svn-id: r44461
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 68 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 285 | ||||
-rw-r--r-- | engines/sci/engine/kevent.cpp | 10 | ||||
-rw-r--r-- | engines/sci/engine/kfile.cpp | 28 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 86 | ||||
-rw-r--r-- | engines/sci/engine/klists.cpp | 32 | ||||
-rw-r--r-- | engines/sci/engine/kmath.cpp | 22 | ||||
-rw-r--r-- | engines/sci/engine/kmenu.cpp | 12 | ||||
-rw-r--r-- | engines/sci/engine/kmisc.cpp | 42 | ||||
-rw-r--r-- | engines/sci/engine/kmovement.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kscripts.cpp | 22 | ||||
-rw-r--r-- | engines/sci/engine/ksound.cpp | 6 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 30 | ||||
-rw-r--r-- | engines/sci/engine/selector.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/vm.cpp | 19 |
16 files changed, 324 insertions, 352 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 74be751716..6ded8eb410 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -120,13 +120,13 @@ static const char *sci_default_knames[SCI_KNAMES_DEFAULT_ENTRIES_NR] = { /*0x51*/ "Platform", /*0x52*/ "SetJump", /*0x53*/ "SetDebug", - /*0x54*/ "InspectObj", - /*0x55*/ "ShowSends", - /*0x56*/ "ShowObjs", - /*0x57*/ "ShowFree", + /*0x54*/ "Dummy", // InspectObj + /*0x55*/ "Dummy", // ShowSends + /*0x56*/ "Dummy", // ShowObjs + /*0x57*/ "Dummy", // ShowFree /*0x58*/ "MemoryInfo", - /*0x59*/ "StackUsage", - /*0x5a*/ "Profiler", + /*0x59*/ "Dummy", // StackUsage + /*0x5a*/ "Dummy", // Profiler /*0x5b*/ "GetMenu", /*0x5c*/ "SetMenu", /*0x5d*/ "GetSaveFiles", @@ -182,7 +182,6 @@ struct SciKernelFunction { }; #define DEFUN(name, fun, sig) {name, fun, sig} -#define NOFUN(name) {name, NULL, NULL} SciKernelFunction kfunct_mappers[] = { /*00*/ DEFUN("Load", kLoad, "iii*"), @@ -282,13 +281,7 @@ SciKernelFunction kfunct_mappers[] = { /*55*/ DEFUN("DoAvoider", kDoAvoider, "o"), /*56*/ DEFUN("SetJump", kSetJump, "oiii"), /*57*/ DEFUN("SetDebug", kSetDebug, "i*"), - /*58*/ NOFUN("InspectObj"), - /*59*/ NOFUN("ShowSends"), - /*5a*/ NOFUN("ShowObjs"), - /*5b*/ NOFUN("ShowFree"), /*5c*/ DEFUN("MemoryInfo", kMemoryInfo, "i"), - /*5d*/ NOFUN("StackUsage"), - /*5e*/ NOFUN("Profiler"), /*5f*/ DEFUN("GetMenu", kGetMenu, "i."), /*60*/ DEFUN("SetMenu", kSetMenu, "i.*"), /*61*/ DEFUN("GetSaveFiles", kGetSaveFiles, "rrr"), @@ -310,8 +303,6 @@ SciKernelFunction kfunct_mappers[] = { /*6f*/ DEFUN("6f", kTimesCos, "ii"), /*70*/ DEFUN("Graph", kGraph, ".*"), /*71*/ DEFUN("Joystick", kJoystick, ".*"), - /*72*/ NOFUN("unknown72"), // ShiftScreen, perhaps? - /*73*/ NOFUN("unknown73"), // Experimental functions /*74*/ DEFUN("FileIO", kFileIO, "i.*"), @@ -343,28 +334,20 @@ SciKernelFunction kfunct_mappers[] = { DEFUN("Platform", kPlatform, "i*"), DEFUN("PalVary", kPalVary, "ii*"), - // Special and NOP stuff - DEFUN("Dummy", kStub, ".*"), - {NULL, kUnknown, NULL}, - - // FIXME: The stub functions below are ignored since the entry - // above ( {NULL, kUnknown, NULL} ) terminates this array effectively. - // Seems like a bug to me; maybe the line above should just be removed? - // If this is on purpose, then whoever knows the reason should replace - // this FIXME by a comment explaining it. - +#if 0 // Stub functions - DEFUN("ShiftScreen", kStub, ".*"), - DEFUN("MemorySegment", kStub, ".*"), - DEFUN("ListOps", kStub, ".*"), - DEFUN("ATan", kStub, ".*"), - DEFUN("MergePoly", kStub, ".*"), - DEFUN("AssertPalette", kStub, ".*"), - DEFUN("TextColors", kStub, ".*"), - DEFUN("TextFonts", kStub, ".*"), - DEFUN("Record", kStub, ".*"), - DEFUN("PlayBack", kStub, ".*"), - DEFUN("DbugStr", kStub, ".*"), + DEFUN("ShiftScreen", kShiftScreen, ".*"), + DEFUN("MemorySegment", kMemorySegment, ".*"), + DEFUN("ListOps", kListOps, ".*"), + DEFUN("ATan", kATan, ".*"), + DEFUN("MergePoly", kMergePoly, ".*"), + DEFUN("AssertPalette", kAssertPalette, ".*"), + DEFUN("TextColors", kTextColors, ".*"), + DEFUN("TextFonts", kTextFonts, ".*"), + DEFUN("Record", kRecord, ".*"), + DEFUN("PlayBack", kPlayBack, ".*"), + DEFUN("DbugStr", kDbugStr, ".*"), +#endif {NULL, NULL, NULL} // Terminator }; @@ -611,8 +594,14 @@ void Kernel::mapFunctions() { if (sought_name.empty()) { // No name was given -> must be an unknown opcode - warning("Flagging kernel function %x as unknown", functnr); - _kernelFuncs[functnr].fun = kUnknown; + warning("Kernel function %s[%x] unknown", sought_name.c_str(), functnr); + _kernelFuncs[functnr].isDummy = true; + continue; + } + + // Don't map dummy functions - they will never be called + if (sought_name == "Dummy") { + _kernelFuncs[functnr].isDummy = true; continue; } @@ -625,12 +614,13 @@ void Kernel::mapFunctions() { if (found == -1) { // No match but a name was given -> stub warning("Kernel function %s[%x] unmapped", sought_name.c_str(), functnr); - _kernelFuncs[functnr].fun = kStub; + _kernelFuncs[functnr].isDummy = true; } else { // A match in kfunct_mappers was found if (kfunct_mappers[found].fun) { _kernelFuncs[functnr].fun = kfunct_mappers[found].fun; _kernelFuncs[functnr].signature = kfunct_mappers[found].signature; + _kernelFuncs[functnr].isDummy = false; kernel_compile_signature(&(_kernelFuncs[functnr].signature)); ++mapped; } else { diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index 9d20a99b58..bb88fab45c 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -44,12 +44,13 @@ struct List; // from vm.h //#define DEBUG_PARSER // enable for parser debugging /* Generic description: */ -typedef reg_t KernelFunc(EngineState *s, int, int argc, reg_t *argv); +typedef reg_t KernelFunc(EngineState *s, int argc, reg_t *argv); struct KernelFuncWithSignature { KernelFunc *fun; /**< The actual function */ const char *signature; /**< KernelFunc signature */ Common::String orig_name; /**< Original name, in case we couldn't map it */ + bool isDummy; }; enum AutoDetectedFeatures { @@ -187,13 +188,8 @@ enum SelectorInvocation { */ -enum { - // FIXME: FAKE_FUNCT_NR is a hack used to substitute for an opcode number in certain places - FAKE_FUNCT_NR = -1 -}; - #define INV_SEL(_object_, _selector_, _noinvalid_) \ - s, _object_, s->_kernel->_selectorCache._selector_, _noinvalid_, FAKE_FUNCT_NR, argv, argc, __FILE__, __LINE__ + s, _object_, s->_kernel->_selectorCache._selector_, _noinvalid_, argv, argc, __FILE__, __LINE__ /* Kludge for use with invoke_selector(). Used for compatibility with compilers that can't ** handle vararg macros. */ @@ -201,7 +197,7 @@ enum { reg_t read_selector(SegManager *segMan, reg_t object, Selector selector_id, const char *fname, int line); void write_selector(SegManager *segMan, reg_t object, Selector selector_id, reg_t value, const char *fname, int line); -int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid, int kfunct, +int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid, StackPtr k_argp, int k_argc, const char *fname, int line, int argc, ...); @@ -326,146 +322,139 @@ enum { /******************** Kernel functions ********************/ // New kernel functions -reg_t kStrLen(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetFarText(EngineState *s, int, int argc, reg_t *argv); -reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv); -reg_t kStrCat(EngineState *s, int, int argc, reg_t *argv); -reg_t kStrCmp(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetSynonyms(EngineState *s, int, int argc, reg_t *argv); -reg_t kLock(EngineState *s, int, int argc, reg_t *argv); -reg_t kPalette(EngineState *s, int, int argc, reg_t *argv); -reg_t kNumCels(EngineState *s, int, int argc, reg_t *argv); -reg_t kNumLoops(EngineState *s, int, int argc, reg_t *argv); -reg_t kDrawCel(EngineState *s, int, int argc, reg_t *argv); -reg_t kCoordPri(EngineState *s, int, int argc, reg_t *argv); -reg_t kPriCoord(EngineState *s, int, int argc, reg_t *argv); -reg_t kShakeScreen(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetCursor(EngineState *s, int, int argc, reg_t *argv); -reg_t kMoveCursor(EngineState *s, int, int argc, reg_t *argv); -reg_t kShow(EngineState *s, int, int argc, reg_t *argv); -reg_t kPicNotValid(EngineState *s, int, int argc, reg_t *argv); -reg_t kOnControl(EngineState *s, int, int argc, reg_t *argv); -reg_t kDrawPic(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetPort(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetPort(EngineState *s, int, int argc, reg_t *argv); -reg_t kNewWindow(EngineState *s, int, int argc, reg_t *argv); -reg_t kDisposeWindow(EngineState *s, int, int argc, reg_t *argv); -reg_t kCelWide(EngineState *s, int, int argc, reg_t *argv); -reg_t kCelHigh(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetJump(EngineState *s, int, int argc, reg_t *argv); -reg_t kDirLoop(EngineState *s, int, int argc, reg_t *argv); -reg_t kDoAvoider(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetAngle(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetDistance(EngineState *s, int, int argc, reg_t *argv); -reg_t kRandom(EngineState *s, int, int argc, reg_t *argv); -reg_t kAbs(EngineState *s, int, int argc, reg_t *argv); -reg_t kSqrt(EngineState *s, int, int argc, reg_t *argv); -reg_t kTimesSin(EngineState *s, int, int argc, reg_t *argv); -reg_t kTimesCos(EngineState *s, int, int argc, reg_t *argv); -reg_t kCosMult(EngineState *s, int, int argc, reg_t *argv); -reg_t kSinMult(EngineState *s, int, int argc, reg_t *argv); -reg_t kTimesTan(EngineState *s, int, int argc, reg_t *argv); -reg_t kTimesCot(EngineState *s, int, int argc, reg_t *argv); -reg_t kCosDiv(EngineState *s, int, int argc, reg_t *argv); -reg_t kSinDiv(EngineState *s, int, int argc, reg_t *argv); -reg_t kValidPath(EngineState *s, int, int argc, reg_t *argv); -reg_t kFOpen(EngineState *s, int, int argc, reg_t *argv); -reg_t kFPuts(EngineState *s, int, int argc, reg_t *argv); -reg_t kFGets(EngineState *s, int, int argc, reg_t *argv); -reg_t kFClose(EngineState *s, int, int argc, reg_t *argv); -reg_t kMapKeyToDir(EngineState *s, int, int argc, reg_t *argv); -reg_t kGlobalToLocal(EngineState *s, int, int argc, reg_t *argv); -reg_t kLocalToGlobal(EngineState *s, int, int argc, reg_t *argv); -reg_t kWait(EngineState *s, int, int argc, reg_t *argv); -reg_t kRestartGame(EngineState *s, int, int argc, reg_t *argv); -reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetEvent(EngineState *s, int, int argc, reg_t *argv); -reg_t kCheckFreeSpace(EngineState *s, int, int argc, reg_t *argv); -reg_t kFlushResources(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetSaveFiles(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetDebug(EngineState *s, int, int argc, reg_t *argv); -reg_t kCheckSaveGame(EngineState *s, int, int argc, reg_t *argv); -reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv); -reg_t kRestoreGame(EngineState *s, int, int argc, reg_t *argv); -reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetTime(EngineState *s, int, int argc, reg_t *argv); -reg_t kHaveMouse(EngineState *s, int, int argc, reg_t *argv); -reg_t kJoystick(EngineState *s, int, int argc, reg_t *argv); -reg_t kGameIsRestarting(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetCWD(EngineState *s, int, int argc, reg_t *argv); -reg_t kSort(EngineState *s, int, int argc, reg_t *argv); -reg_t kStrEnd(EngineState *s, int, int argc, reg_t *argv); -reg_t kMemory(EngineState *s, int, int argc, reg_t *argv); -reg_t kAvoidPath(EngineState *s, int, int argc, reg_t *argv); -reg_t kParse(EngineState *s, int, int argc, reg_t *argv); -reg_t kSaid(EngineState *s, int, int argc, reg_t *argv); -reg_t kStrCpy(EngineState *s, int, int argc, reg_t *argv); -reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv); -reg_t kEditControl(EngineState *s, int, int argc, reg_t *argv); -reg_t kDrawControl(EngineState *s, int, int argc, reg_t *argv); -reg_t kHiliteControl(EngineState *s, int, int argc, reg_t *argv); -reg_t kClone(EngineState *s, int, int argc, reg_t *argv); -reg_t kDisposeClone(EngineState *s, int, int argc, reg_t *argv); -reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv); -reg_t kCantBeHere(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetNowSeen(EngineState *s, int, int argc, reg_t *argv); -reg_t kInitBresen(EngineState *s, int, int argc, reg_t *argv); -reg_t kDoBresen(EngineState *s, int, int argc, reg_t *argv); -reg_t kBaseSetter(EngineState *s, int, int argc, reg_t *argv); -reg_t kAddToPic(EngineState *s, int, int argc, reg_t *argv); -reg_t kAnimate(EngineState *s, int, int argc, reg_t *argv); -reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv); -reg_t kGraph(EngineState *s, int, int argc, reg_t *argv); -reg_t kFormat(EngineState *s, int, int argc, reg_t *argv); -reg_t kDoSound(EngineState *s, int, int argc, reg_t *argv); -reg_t kAddMenu(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetMenu(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetMenu(EngineState *s, int, int argc, reg_t *argv); -reg_t kDrawStatus(EngineState *s, int, int argc, reg_t *argv); -reg_t kDrawMenuBar(EngineState *s, int, int argc, reg_t *argv); -reg_t kMenuSelect(EngineState *s, int, int argc, reg_t *argv); - -reg_t kLoad(EngineState *s, int, int argc, reg_t *argv); -reg_t kUnLoad(EngineState *s, int, int argc, reg_t *argv); -reg_t kScriptID(EngineState *s, int, int argc, reg_t *argv); -reg_t kDisposeScript(EngineState *s, int, int argc, reg_t *argv); -reg_t kIsObject(EngineState *s, int, int argc, reg_t *argv); -reg_t kRespondsTo(EngineState *s, int, int argc, reg_t *argv); -reg_t kNewList(EngineState *s, int, int argc, reg_t *argv); -reg_t kDisposeList(EngineState *s, int, int argc, reg_t *argv); -reg_t kNewNode(EngineState *s, int, int argc, reg_t *argv); -reg_t kFirstNode(EngineState *s, int, int argc, reg_t *argv); -reg_t kLastNode(EngineState *s, int, int argc, reg_t *argv); -reg_t kEmptyList(EngineState *s, int, int argc, reg_t *argv); -reg_t kNextNode(EngineState *s, int, int argc, reg_t *argv); -reg_t kPrevNode(EngineState *s, int, int argc, reg_t *argv); -reg_t kNodeValue(EngineState *s, int, int argc, reg_t *argv); -reg_t kAddAfter(EngineState *s, int, int argc, reg_t *argv); -reg_t kAddToFront(EngineState *s, int, int argc, reg_t *argv); -reg_t kAddToEnd(EngineState *s, int, int argc, reg_t *argv); -reg_t kFindKey(EngineState *s, int, int argc, reg_t *argv); -reg_t kDeleteKey(EngineState *s, int, int argc, reg_t *argv); -reg_t kMemoryInfo(EngineState *s, int, int argc, reg_t *argv); -reg_t kGetSaveDir(EngineState *s, int, int argc, reg_t *argv); -reg_t kTextSize(EngineState *s, int, int argc, reg_t *argv); -reg_t kIsItSkip(EngineState *s, int, int argc, reg_t *argv); -reg_t kMessage(EngineState *s, int, int argc, reg_t *argv); -reg_t kDoAudio(EngineState *s, int, int argc, reg_t *argv); -reg_t kDoSync(EngineState *s, int, int argc, reg_t *argv); -reg_t kResCheck(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetQuitStr(EngineState *s, int, int argc, reg_t *argv); -reg_t kShowMovie(EngineState *s, int, int argc, reg_t *argv); -reg_t kSetVideoMode(EngineState *s, int, int argc, reg_t *argv); -reg_t kStrSplit(EngineState *s, int, int argc, reg_t *argv); -reg_t kPlatform(EngineState *s, int, int argc, reg_t *argv); -reg_t kPalVary(EngineState *s, int, int argc, reg_t *argv); - -// for unknown/unnamed kernel function -reg_t kUnknown(EngineState *s, int, int argc, reg_t *argv); - -// for named but unimplemented kernel functions -reg_t kStub(EngineState *s, int, int argc, reg_t *argv); - +reg_t kStrLen(EngineState *s, int argc, reg_t *argv); +reg_t kGetFarText(EngineState *s, int argc, reg_t *argv); +reg_t kReadNumber(EngineState *s, int argc, reg_t *argv); +reg_t kStrCat(EngineState *s, int argc, reg_t *argv); +reg_t kStrCmp(EngineState *s, int argc, reg_t *argv); +reg_t kSetSynonyms(EngineState *s, int argc, reg_t *argv); +reg_t kLock(EngineState *s, int argc, reg_t *argv); +reg_t kPalette(EngineState *s, int argc, reg_t *argv); +reg_t kNumCels(EngineState *s, int argc, reg_t *argv); +reg_t kNumLoops(EngineState *s, int argc, reg_t *argv); +reg_t kDrawCel(EngineState *s, int argc, reg_t *argv); +reg_t kCoordPri(EngineState *s, int argc, reg_t *argv); +reg_t kPriCoord(EngineState *s, int argc, reg_t *argv); +reg_t kShakeScreen(EngineState *s, int argc, reg_t *argv); +reg_t kSetCursor(EngineState *s, int argc, reg_t *argv); +reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv); +reg_t kShow(EngineState *s, int argc, reg_t *argv); +reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv); +reg_t kOnControl(EngineState *s, int argc, reg_t *argv); +reg_t kDrawPic(EngineState *s, int argc, reg_t *argv); +reg_t kGetPort(EngineState *s, int argc, reg_t *argv); +reg_t kSetPort(EngineState *s, int argc, reg_t *argv); +reg_t kNewWindow(EngineState *s, int argc, reg_t *argv); +reg_t kDisposeWindow(EngineState *s, int argc, reg_t *argv); +reg_t kCelWide(EngineState *s, int argc, reg_t *argv); +reg_t kCelHigh(EngineState *s, int argc, reg_t *argv); +reg_t kSetJump(EngineState *s, int argc, reg_t *argv); +reg_t kDirLoop(EngineState *s, int argc, reg_t *argv); +reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv); +reg_t kGetAngle(EngineState *s, int argc, reg_t *argv); +reg_t kGetDistance(EngineState *s, int argc, reg_t *argv); +reg_t kRandom(EngineState *s, int argc, reg_t *argv); +reg_t kAbs(EngineState *s, int argc, reg_t *argv); +reg_t kSqrt(EngineState *s, int argc, reg_t *argv); +reg_t kTimesSin(EngineState *s, int argc, reg_t *argv); +reg_t kTimesCos(EngineState *s, int argc, reg_t *argv); +reg_t kCosMult(EngineState *s, int argc, reg_t *argv); +reg_t kSinMult(EngineState *s, int argc, reg_t *argv); +reg_t kTimesTan(EngineState *s, int argc, reg_t *argv); +reg_t kTimesCot(EngineState *s, int argc, reg_t *argv); +reg_t kCosDiv(EngineState *s, int argc, reg_t *argv); +reg_t kSinDiv(EngineState *s, int argc, reg_t *argv); +reg_t kValidPath(EngineState *s, int argc, reg_t *argv); +reg_t kFOpen(EngineState *s, int argc, reg_t *argv); +reg_t kFPuts(EngineState *s, int argc, reg_t *argv); +reg_t kFGets(EngineState *s, int argc, reg_t *argv); +reg_t kFClose(EngineState *s, int argc, reg_t *argv); +reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv); +reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv); +reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv); +reg_t kWait(EngineState *s, int argc, reg_t *argv); +reg_t kRestartGame(EngineState *s, int argc, reg_t *argv); +reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv); +reg_t kGetEvent(EngineState *s, int argc, reg_t *argv); +reg_t kCheckFreeSpace(EngineState *s, int argc, reg_t *argv); +reg_t kFlushResources(EngineState *s, int argc, reg_t *argv); +reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv); +reg_t kSetDebug(EngineState *s, int argc, reg_t *argv); +reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv); +reg_t kSaveGame(EngineState *s, int argc, reg_t *argv); +reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv); +reg_t kFileIO(EngineState *s, int argc, reg_t *argv); +reg_t kGetTime(EngineState *s, int argc, reg_t *argv); +reg_t kHaveMouse(EngineState *s, int argc, reg_t *argv); +reg_t kJoystick(EngineState *s, int argc, reg_t *argv); +reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv); +reg_t kGetCWD(EngineState *s, int argc, reg_t *argv); +reg_t kSort(EngineState *s, int argc, reg_t *argv); +reg_t kStrEnd(EngineState *s, int argc, reg_t *argv); +reg_t kMemory(EngineState *s, int argc, reg_t *argv); +reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv); +reg_t kParse(EngineState *s, int argc, reg_t *argv); +reg_t kSaid(EngineState *s, int argc, reg_t *argv); +reg_t kStrCpy(EngineState *s, int argc, reg_t *argv); +reg_t kStrAt(EngineState *s, int argc, reg_t *argv); +reg_t kEditControl(EngineState *s, int argc, reg_t *argv); +reg_t kDrawControl(EngineState *s, int argc, reg_t *argv); +reg_t kHiliteControl(EngineState *s, int argc, reg_t *argv); +reg_t kClone(EngineState *s, int argc, reg_t *argv); +reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv); +reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv); +reg_t kCantBeHere(EngineState *s, int argc, reg_t *argv); +reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv); +reg_t kInitBresen(EngineState *s, int argc, reg_t *argv); +reg_t kDoBresen(EngineState *s, int argc, reg_t *argv); +reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv); +reg_t kAddToPic(EngineState *s, int argc, reg_t *argv); +reg_t kAnimate(EngineState *s, int argc, reg_t *argv); +reg_t kDisplay(EngineState *s, int argc, reg_t *argv); +reg_t kGraph(EngineState *s, int argc, reg_t *argv); +reg_t kFormat(EngineState *s, int argc, reg_t *argv); +reg_t kDoSound(EngineState *s, int argc, reg_t *argv); +reg_t kAddMenu(EngineState *s, int argc, reg_t *argv); +reg_t kSetMenu(EngineState *s, int argc, reg_t *argv); +reg_t kGetMenu(EngineState *s, int argc, reg_t *argv); +reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv); +reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv); +reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv); + +reg_t kLoad(EngineState *s, int argc, reg_t *argv); +reg_t kUnLoad(EngineState *s, int argc, reg_t *argv); +reg_t kScriptID(EngineState *s, int argc, reg_t *argv); +reg_t kDisposeScript(EngineState *s, int argc, reg_t *argv); +reg_t kIsObject(EngineState *s, int argc, reg_t *argv); +reg_t kRespondsTo(EngineState *s, int argc, reg_t *argv); +reg_t kNewList(EngineState *s, int argc, reg_t *argv); +reg_t kDisposeList(EngineState *s, int argc, reg_t *argv); +reg_t kNewNode(EngineState *s, int argc, reg_t *argv); +reg_t kFirstNode(EngineState *s, int argc, reg_t *argv); +reg_t kLastNode(EngineState *s, int argc, reg_t *argv); +reg_t kEmptyList(EngineState *s, int argc, reg_t *argv); +reg_t kNextNode(EngineState *s, int argc, reg_t *argv); +reg_t kPrevNode(EngineState *s, int argc, reg_t *argv); +reg_t kNodeValue(EngineState *s, int argc, reg_t *argv); +reg_t kAddAfter(EngineState *s, int argc, reg_t *argv); +reg_t kAddToFront(EngineState *s, int argc, reg_t *argv); +reg_t kAddToEnd(EngineState *s, int argc, reg_t *argv); +reg_t kFindKey(EngineState *s, int argc, reg_t *argv); +reg_t kDeleteKey(EngineState *s, int argc, reg_t *argv); +reg_t kMemoryInfo(EngineState *s, int argc, reg_t *argv); +reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv); +reg_t kTextSize(EngineState *s, int argc, reg_t *argv); +reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv); +reg_t kMessage(EngineState *s, int argc, reg_t *argv); +reg_t kDoAudio(EngineState *s, int argc, reg_t *argv); +reg_t kDoSync(EngineState *s, int argc, reg_t *argv); +reg_t kResCheck(EngineState *s, int argc, reg_t *argv); +reg_t kSetQuitStr(EngineState *s, int argc, reg_t *argv); +reg_t kShowMovie(EngineState *s, int argc, reg_t *argv); +reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv); +reg_t kStrSplit(EngineState *s, int argc, reg_t *argv); +reg_t kPlatform(EngineState *s, int argc, reg_t *argv); +reg_t kPalVary(EngineState *s, int argc, reg_t *argv); } // End of namespace Sci diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index bb1a3be606..d86fcdd073 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -35,7 +35,7 @@ namespace Sci { #define SCI_VARIABLE_GAME_SPEED 3 -reg_t kGetEvent(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { int mask = argv[0].toUint16(); reg_t obj = argv[1]; sci_event_t e; @@ -151,7 +151,7 @@ reg_t kGetEvent(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kMapKeyToDir(EngineState *s, int, int argc, reg_t *argv) { +reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) { reg_t obj = argv[0]; SegManager *segMan = s->segMan; @@ -201,7 +201,7 @@ reg_t kMapKeyToDir(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGlobalToLocal(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) { reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars SegManager *segMan = s->segMan; @@ -217,7 +217,7 @@ reg_t kGlobalToLocal(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kLocalToGlobal(EngineState *s, int, int argc, reg_t *argv) { +reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) { reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars SegManager *segMan = s->segMan; @@ -232,7 +232,7 @@ reg_t kLocalToGlobal(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kJoystick(EngineState *s, int, int argc, reg_t *argv) { +reg_t kJoystick(EngineState *s, int argc, reg_t *argv) { // Subfunction 12 sets/gets joystick repeat rate debug(5, "Unimplemented syscall 'Joystick()'"); return NULL_REG; diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 2244e59c12..75844f4b38 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -200,7 +200,7 @@ void file_open(EngineState *s, const char *filename, int mode) { debug(3, " -> opened file '%s' with handle %d", englishName.c_str(), handle); } -reg_t kFOpen(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFOpen(EngineState *s, int argc, reg_t *argv) { Common::String name = s->segMan->getString(argv[0]); int mode = argv[1].toUint16(); @@ -231,7 +231,7 @@ void file_close(EngineState *s, int handle) { f->close(); } -reg_t kFClose(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFClose(EngineState *s, int argc, reg_t *argv) { debug(3, "kFClose(%d)", argv[0].toUint16()); file_close(s, argv[0].toUint16()); return s->r_acc; @@ -252,7 +252,7 @@ void fwrite_wrapper(EngineState *s, int handle, const char *data, int length) { f->_out->write(data, length); } -reg_t kFPuts(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFPuts(EngineState *s, int argc, reg_t *argv) { int handle = argv[0].toUint16(); Common::String data = s->segMan->getString(argv[1]); @@ -310,7 +310,7 @@ static void fseek_wrapper(EngineState *s, int handle, int offset, int whence) { s->r_acc = make_reg(0, f->_in->seek(offset, whence)); } -reg_t kFGets(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFGets(EngineState *s, int argc, reg_t *argv) { int maxsize = argv[1].toUint16(); char *buf = new char[maxsize]; int handle = argv[2].toUint16(); @@ -324,7 +324,7 @@ reg_t kFGets(EngineState *s, int, int argc, reg_t *argv) { /** * Writes the cwd to the supplied address and returns the address in acc. */ -reg_t kGetCWD(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetCWD(EngineState *s, int argc, reg_t *argv) { // We do not let the scripts see the file system, instead pretending // we are always in the same directory. // TODO/FIXME: Is "/" a good value? Maybe "" or "." or "C:\" are better? @@ -353,7 +353,7 @@ enum { K_DEVICE_INFO_GET_SAVEFILE_NAME = 8 }; -reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDeviceInfo(EngineState *s, int argc, reg_t *argv) { int mode = argv[0].toUint16(); switch (mode) { @@ -412,7 +412,7 @@ reg_t kDeviceInfo(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGetSaveDir(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetSaveDir(EngineState *s, int argc, reg_t *argv) { #ifdef ENABLE_SCI32 // TODO: SCI32 uses a parameter here. if (argc > 0) @@ -422,7 +422,7 @@ reg_t kGetSaveDir(EngineState *s, int, int argc, reg_t *argv) { return make_reg(s->sys_strings_segment, SYS_STRING_SAVEDIR); } -reg_t kCheckFreeSpace(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCheckFreeSpace(EngineState *s, int argc, reg_t *argv) { Common::String path = s->segMan->getString(argv[0]); debug(3, "kCheckFreeSpace(%s)", path.c_str()); @@ -480,7 +480,7 @@ void listSavegames(Common::Array<SavegameDesc> &saves) { qsort(saves.begin(), saves.size(), sizeof(SavegameDesc), _savegame_index_struct_compare); } -reg_t kCheckSaveGame(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv) { Common::String game_id = s->segMan->getString(argv[0]); int savedir_nr = argv[1].toUint16(); @@ -516,7 +516,7 @@ reg_t kCheckSaveGame(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGetSaveFiles(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetSaveFiles(EngineState *s, int argc, reg_t *argv) { Common::String game_id = s->segMan->getString(argv[0]); reg_t nametarget = argv[1]; reg_t *nameoffsets = s->segMan->derefRegPtr(argv[2], 0); @@ -568,7 +568,7 @@ reg_t kGetSaveFiles(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) { Common::String game_id = s->segMan->getString(argv[0]); int savedir_nr = argv[1].toUint16(); int savedir_id; // Savegame ID, derived from savedir_nr and the savegame ID list @@ -640,7 +640,7 @@ reg_t kSaveGame(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kRestoreGame(EngineState *s, int, int argc, reg_t *argv) { +reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) { Common::String game_id = s->segMan->getString(argv[0]); int savedir_nr = argv[1].toUint16(); @@ -679,7 +679,7 @@ reg_t kRestoreGame(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kValidPath(EngineState *s, int, int argc, reg_t *argv) { +reg_t kValidPath(EngineState *s, int argc, reg_t *argv) { Common::String path = s->segMan->getString(argv[0]); // FIXME: For now, we only accept the (fake) root dir "/" as a valid path. @@ -745,7 +745,7 @@ void DirSeeker::nextFile() { -reg_t kFileIO(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFileIO(EngineState *s, int argc, reg_t *argv) { int func_nr = argv[0].toUint16(); switch (func_nr) { diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index e65f9eea5b..ecfc6e1ae8 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -282,7 +282,7 @@ static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int return retval; } -static reg_t kSetCursorSci0(EngineState *s, int, int argc, reg_t *argv) { +static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) { int16 cursor = argv[0].toSint16(); if ((argc >= 2) && (argv[1].toSint16() == 0)) @@ -299,7 +299,7 @@ static reg_t kSetCursorSci0(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -static reg_t kSetCursorSci11(EngineState *s, int, int argc, reg_t *argv) { +static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) { Common::Point *hotspot = NULL; switch (argc) { @@ -340,19 +340,19 @@ static reg_t kSetCursorSci11(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kSetCursor(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetCursor(EngineState *s, int argc, reg_t *argv) { switch (s->detectSetCursorType()) { case SCI_VERSION_0_EARLY: - return kSetCursorSci0(s, FAKE_FUNCT_NR, argc, argv); + return kSetCursorSci0(s, argc, argv); case SCI_VERSION_1_1: - return kSetCursorSci11(s, FAKE_FUNCT_NR, argc, argv); + return kSetCursorSci11(s, argc, argv); default: warning("Unknown SetCursor type"); return NULL_REG; } } -reg_t kMoveCursor(EngineState *s, int, int argc, reg_t *argv) { +reg_t kMoveCursor(EngineState *s, int argc, reg_t *argv) { Common::Point newPos; newPos = s->gfx_state->pointer_pos; @@ -377,7 +377,7 @@ reg_t kMoveCursor(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kShow(EngineState *s, int, int argc, reg_t *argv) { +reg_t kShow(EngineState *s, int argc, reg_t *argv) { int old_map = s->pic_visible_map; s->pic_visible_map = (argc > 0) ? (gfx_map_mask_t) argv[0].toUint16() : GFX_MASK_VISUAL; @@ -407,7 +407,7 @@ reg_t kShow(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kPicNotValid(EngineState *s, int, int argc, reg_t *argv) { +reg_t kPicNotValid(EngineState *s, int argc, reg_t *argv) { s->r_acc = make_reg(0, s->pic_not_valid); if (argc) s->pic_not_valid = (byte)argv[0].toUint16(); @@ -465,7 +465,7 @@ static bool activated_icon_bar = false; // FIXME: Avoid non-const global vars static int port_origin_x = 0; // FIXME: Avoid non-const global vars static int port_origin_y = 0; // FIXME: Avoid non-const global vars -reg_t kGraph(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGraph(EngineState *s, int argc, reg_t *argv) { rect_t area; GfxPort *port = s->port; int redraw_port = 0; @@ -600,7 +600,7 @@ reg_t kGraph(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kTextSize(EngineState *s, int, int argc, reg_t *argv) { +reg_t kTextSize(EngineState *s, int argc, reg_t *argv) { int width, height; Common::String text = s->segMan->getString(argv[1]); reg_t *dest = s->segMan->derefRegPtr(argv[0], 4); @@ -636,7 +636,7 @@ reg_t kTextSize(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kWait(EngineState *s, int, int argc, reg_t *argv) { +reg_t kWait(EngineState *s, int argc, reg_t *argv) { uint32 time; int sleep_time = argv[0].toUint16(); @@ -654,13 +654,13 @@ reg_t kWait(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kCoordPri(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCoordPri(EngineState *s, int argc, reg_t *argv) { int y = argv[0].toSint16(); return make_reg(0, _find_view_priority(s, y)); } -reg_t kPriCoord(EngineState *s, int, int argc, reg_t *argv) { +reg_t kPriCoord(EngineState *s, int argc, reg_t *argv) { int priority = argv[0].toSint16(); return make_reg(0, _find_priority_band(s, priority)); @@ -710,7 +710,7 @@ void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv) PUT_SEL32V(obj, loop, loop); } -reg_t kDirLoop(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDirLoop(EngineState *s, int argc, reg_t *argv) { _k_dirloop(argv[0], argv[1].toUint16(), s, argc, argv); return s->r_acc; @@ -761,7 +761,7 @@ static int collides_with(EngineState *s, Common::Rect area, reg_t other_obj, int return 0; } -reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCanBeHere(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t obj = argv[0]; reg_t cliplist_ref = (argc > 1) ? argv[1] : NULL_REG; @@ -855,15 +855,15 @@ reg_t kCanBeHere(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, retval); } // CanBeHere -reg_t kCantBeHere(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCantBeHere(EngineState *s, int argc, reg_t *argv) { // kCantBeHere does the same thing as kCanBeHere, except that // it returns the opposite result. - reg_t result = kCanBeHere(s, FAKE_FUNCT_NR, argc, argv); + reg_t result = kCanBeHere(s, argc, argv); result.offset = !result.offset; return result; } -reg_t kIsItSkip(EngineState *s, int, int argc, reg_t *argv) { +reg_t kIsItSkip(EngineState *s, int argc, reg_t *argv) { int view = argv[0].toSint16(); int loop = argv[1].toSint16(); int cel = argv[2].toSint16(); @@ -888,7 +888,7 @@ reg_t kIsItSkip(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, pxm->index_data[y * pxm->index_width + x] == pxm->color_key); } -reg_t kCelHigh(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCelHigh(EngineState *s, int argc, reg_t *argv) { int view = argv[0].toSint16(); int loop = argv[1].toSint16(); int cel = argv[2].toSint16(); @@ -903,7 +903,7 @@ reg_t kCelHigh(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, height); } -reg_t kCelWide(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCelWide(EngineState *s, int argc, reg_t *argv) { int view = argv[0].toSint16(); int loop = argv[1].toSint16(); int cel = argv[2].toSint16(); @@ -918,7 +918,7 @@ reg_t kCelWide(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, width); } -reg_t kNumLoops(EngineState *s, int, int argc, reg_t *argv) { +reg_t kNumLoops(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t obj = argv[0]; int view = GET_SEL32V(obj, view); @@ -934,7 +934,7 @@ reg_t kNumLoops(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, loops_nr); } -reg_t kNumCels(EngineState *s, int, int argc, reg_t *argv) { +reg_t kNumCels(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t obj = argv[0]; int loop = GET_SEL32V(obj, loop); @@ -948,7 +948,7 @@ reg_t kNumCels(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, cel + 1); } -reg_t kOnControl(EngineState *s, int, int argc, reg_t *argv) { +reg_t kOnControl(EngineState *s, int argc, reg_t *argv) { int arg = 0; gfx_map_mask_t map; int xstart, ystart; @@ -976,7 +976,7 @@ void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr #define K_DRAWPIC_FLAG_MIRRORED (1 << 14) -reg_t kDrawPic(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDrawPic(EngineState *s, int argc, reg_t *argv) { drawn_pic_t dp; bool add_to_pic = (argc > 2) ? !argv[2].toSint16() : false; gfx_color_t transparent = s->wm_port->_bgcolor; @@ -1126,7 +1126,7 @@ void _k_base_setter(EngineState *s, reg_t object) { PUT_SEL32V(object, brBottom, absrect.bottom); } -reg_t kBaseSetter(EngineState *s, int, int argc, reg_t *argv) { +reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; _k_base_setter(s, object); @@ -1221,7 +1221,7 @@ static void _k_set_now_seen(EngineState *s, reg_t object) { PUT_SEL32V(object, nsBottom, absrect.bottom); } -reg_t kSetNowSeen(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; _k_set_now_seen(s, object); @@ -1229,7 +1229,7 @@ reg_t kSetNowSeen(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kPalette(EngineState *s, int, int argc, reg_t *argv) { +reg_t kPalette(EngineState *s, int argc, reg_t *argv) { switch (argv[0].toUint16()) { case 1: debug(5, "STUB: kPalette() effect 1, direct palette set"); @@ -1297,7 +1297,7 @@ reg_t kPalette(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kPalVary(EngineState *s, int, int argc, reg_t *argv) { +reg_t kPalVary(EngineState *s, int argc, reg_t *argv) { warning("STUB: kPalVary()"); return NULL_REG; } @@ -1345,7 +1345,7 @@ static void disableCertainButtons(SegManager *segMan, Common::String gameName, r } } -reg_t kDrawControl(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDrawControl(EngineState *s, int argc, reg_t *argv) { reg_t obj = argv[0]; disableCertainButtons(s->segMan, s->_gameName, obj); @@ -1354,7 +1354,7 @@ reg_t kDrawControl(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kHiliteControl(EngineState *s, int, int argc, reg_t *argv) { +reg_t kHiliteControl(EngineState *s, int argc, reg_t *argv) { reg_t obj = argv[0]; _k_draw_control(s, obj, 1); @@ -1384,7 +1384,7 @@ void update_cursor_limits(int *display_offset, int *cursor, int max_displayed) { --textlen; \ } -reg_t kEditControl(EngineState *s, int, int argc, reg_t *argv) { +reg_t kEditControl(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t obj = argv[0]; reg_t event = argv[1]; @@ -2290,7 +2290,7 @@ void _k_draw_view_list(EngineState *s, GfxList *list, int flags) { } -reg_t kAddToPic(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAddToPic(EngineState *s, int argc, reg_t *argv) { GfxList *pic_views; reg_t list_ref = argv[0]; @@ -2349,11 +2349,11 @@ reg_t kAddToPic(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGetPort(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetPort(EngineState *s, int argc, reg_t *argv) { return make_reg(0, s->port->_ID); } -reg_t kSetPort(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetPort(EngineState *s, int argc, reg_t *argv) { if (activated_icon_bar && argc == 6) { port_origin_x = port_origin_y = 0; activated_icon_bar = false; @@ -2422,7 +2422,7 @@ reg_t kSetPort(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kDrawCel(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDrawCel(EngineState *s, int argc, reg_t *argv) { int view = argv[0].toSint16(); int loop = argv[1].toSint16(); int cel = argv[2].toSint16(); @@ -2444,7 +2444,7 @@ reg_t kDrawCel(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kDisposeWindow(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDisposeWindow(EngineState *s, int argc, reg_t *argv) { unsigned int goner_nr = argv[0].toSint16(); GfxPort *goner; GfxPort *pred; @@ -2483,7 +2483,7 @@ reg_t kDisposeWindow(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kNewWindow(EngineState *s, int, int argc, reg_t *argv) { +reg_t kNewWindow(EngineState *s, int argc, reg_t *argv) { GfxPort *window; int x, y, xl, yl, flags; gfx_color_t bgcolor; @@ -2984,7 +2984,7 @@ static void animate_do_animation(EngineState *s, int argc, reg_t *argv) { s->old_screen = NULL; } -reg_t kAnimate(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAnimate(EngineState *s, int argc, reg_t *argv) { // Animations are supposed to take a maximum of animation_delay milliseconds. reg_t cast_list_ref = (argc > 0) ? argv[0] : NULL_REG; int cycle = (argc > 1) ? argv[1].toUint16() : 0; @@ -3027,7 +3027,7 @@ reg_t kAnimate(EngineState *s, int, int argc, reg_t *argv) { // End of doit() recovery code if (s->pic_is_new) { // Happens if DrawPic() is executed by a dynview (yes, that happens) - return kAnimate(s, FAKE_FUNCT_NR, argc, argv); /* Tail-recurse */ + return kAnimate(s, argc, argv); /* Tail-recurse */ } debugC(2, kDebugLevelGraphics, "Handling Dynviews (..step 9 inclusive):\n"); @@ -3093,7 +3093,7 @@ reg_t kAnimate(EngineState *s, int, int argc, reg_t *argv) { #define SHAKE_DOWN 1 #define SHAKE_RIGHT 2 -reg_t kShakeScreen(EngineState *s, int, int argc, reg_t *argv) { +reg_t kShakeScreen(EngineState *s, int argc, reg_t *argv) { int shakes = (argc > 0) ? argv[0].toSint16() : 1; int directions = (argc > 1) ? argv[1].toSint16() : 1; gfx_pixmap_t *screen = gfxop_grab_pixmap(s->gfx_state, gfx_rect(0, 0, 320, 200)); @@ -3141,7 +3141,7 @@ reg_t kShakeScreen(EngineState *s, int, int argc, reg_t *argv) { #define K_DISPLAY_RESTORE_UNDER 108 #define K_DONT_UPDATE_IMMEDIATELY 121 -reg_t kDisplay(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDisplay(EngineState *s, int argc, reg_t *argv) { int argpt; reg_t textp = argv[0]; int index = (argc > 1) ? argv[1].toUint16() : 0; @@ -3468,7 +3468,7 @@ static reg_t kShowMovie_DOS(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } -reg_t kShowMovie(EngineState *s, int, int argc, reg_t *argv) { +reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { // KQ6 Windows calls this with one argument. It doesn't seem // to have a purpose... if (argc == 1) @@ -3482,7 +3482,7 @@ reg_t kShowMovie(EngineState *s, int, int argc, reg_t *argv) { return kShowMovie_DOS(s, argc, argv); } -reg_t kSetVideoMode(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv) { // This call is used for KQ6's intro. It has one parameter, which is // 1 when the intro begins, and 0 when it ends. It is suspected that // this is actually a flag to enable video planar memory access, as diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 4e0f64a543..2de0d1983d 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -132,7 +132,7 @@ int sane_listp(EngineState *s, reg_t addr) { } #endif -reg_t kNewList(EngineState *s, int, int argc, reg_t *argv) { +reg_t kNewList(EngineState *s, int argc, reg_t *argv) { reg_t listbase; List *l; l = s->segMan->allocateList(&listbase); @@ -142,7 +142,7 @@ reg_t kNewList(EngineState *s, int, int argc, reg_t *argv) { return listbase; // Return list base address } -reg_t kDisposeList(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDisposeList(EngineState *s, int argc, reg_t *argv) { List *l = lookup_list(s, argv[0]); if (!l) { @@ -185,7 +185,7 @@ reg_t _k_new_node(EngineState *s, reg_t value, reg_t key) { return nodebase; } -reg_t kNewNode(EngineState *s, int, int argc, reg_t *argv) { +reg_t kNewNode(EngineState *s, int argc, reg_t *argv) { s->r_acc = _k_new_node(s, argv[0], argv[1]); debugC(2, kDebugLevelNodes, "New nodebase at %04x:%04x\n", PRINT_REG(s->r_acc)); @@ -193,7 +193,7 @@ reg_t kNewNode(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kFirstNode(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFirstNode(EngineState *s, int argc, reg_t *argv) { if (argv[0].isNull()) return NULL_REG; List *l = lookup_list(s, argv[0]); @@ -207,7 +207,7 @@ reg_t kFirstNode(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kLastNode(EngineState *s, int, int argc, reg_t *argv) { +reg_t kLastNode(EngineState *s, int argc, reg_t *argv) { List *l = lookup_list(s, argv[0]); if (l && !sane_listp(s, argv[0])) @@ -219,7 +219,7 @@ reg_t kLastNode(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kEmptyList(EngineState *s, int, int argc, reg_t *argv) { +reg_t kEmptyList(EngineState *s, int argc, reg_t *argv) { List *l = lookup_list(s, argv[0]); if (!l || !sane_listp(s, argv[0])) @@ -276,7 +276,7 @@ void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) { l->last = nodebase; } -reg_t kNextNode(EngineState *s, int, int argc, reg_t *argv) { +reg_t kNextNode(EngineState *s, int argc, reg_t *argv) { Node *n = lookup_node(s, argv[0]); if (!sane_nodep(s, argv[0])) { error("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0])); @@ -286,7 +286,7 @@ reg_t kNextNode(EngineState *s, int, int argc, reg_t *argv) { return n->succ; } -reg_t kPrevNode(EngineState *s, int, int argc, reg_t *argv) { +reg_t kPrevNode(EngineState *s, int argc, reg_t *argv) { Node *n = lookup_node(s, argv[0]); if (!sane_nodep(s, argv[0])) error("List node at %04x:%04x is not sane anymore", PRINT_REG(argv[0])); @@ -294,7 +294,7 @@ reg_t kPrevNode(EngineState *s, int, int argc, reg_t *argv) { return n->pred; } -reg_t kNodeValue(EngineState *s, int, int argc, reg_t *argv) { +reg_t kNodeValue(EngineState *s, int argc, reg_t *argv) { Node *n = lookup_node(s, argv[0]); if (!sane_nodep(s, argv[0])) { error("List node at %04x:%04x is not sane", PRINT_REG(argv[0])); @@ -304,12 +304,12 @@ reg_t kNodeValue(EngineState *s, int, int argc, reg_t *argv) { return n->value; } -reg_t kAddToFront(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAddToFront(EngineState *s, int argc, reg_t *argv) { _k_add_to_front(s, argv[0], argv[1]); return s->r_acc; } -reg_t kAddAfter(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAddAfter(EngineState *s, int argc, reg_t *argv) { List *l = lookup_list(s, argv[0]); Node *firstnode = argv[1].isNull() ? NULL : lookup_node(s, argv[1]); Node *newnode = lookup_node(s, argv[2]); @@ -348,12 +348,12 @@ reg_t kAddAfter(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kAddToEnd(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAddToEnd(EngineState *s, int argc, reg_t *argv) { _k_add_to_end(s, argv[0], argv[1]); return s->r_acc; } -reg_t kFindKey(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFindKey(EngineState *s, int argc, reg_t *argv) { reg_t node_pos; reg_t key = argv[1]; reg_t list_pos = argv[0]; @@ -382,8 +382,8 @@ reg_t kFindKey(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kDeleteKey(EngineState *s, int, int argc, reg_t *argv) { - reg_t node_pos = kFindKey(s, FAKE_FUNCT_NR, 2, argv); +reg_t kDeleteKey(EngineState *s, int argc, reg_t *argv) { + reg_t node_pos = kFindKey(s, 2, argv); Node *n; List *l = lookup_list(s, argv[0]); @@ -424,7 +424,7 @@ int sort_temp_cmp(const void *p1, const void *p2) { return 0; } -reg_t kSort(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSort(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t source = argv[0]; reg_t dest = argv[1]; diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index f2702839ca..3ebe2483ce 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -28,18 +28,18 @@ namespace Sci { -reg_t kRandom(EngineState *s, int, int argc, reg_t *argv) { +reg_t kRandom(EngineState *s, int argc, reg_t *argv) { return make_reg(0, argv[0].toSint16() + (int)((argv[1].toSint16() + 1.0 - argv[0].toSint16()) * (rand() / (RAND_MAX + 1.0)))); } -reg_t kAbs(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAbs(EngineState *s, int argc, reg_t *argv) { // This is a hack, but so is the code in Hoyle1 that needs it. if (argv[0].segment) return make_reg(0, 0x3e8); // Yes people, this is an object return make_reg(0, abs(argv[0].toSint16())); } -reg_t kSqrt(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSqrt(EngineState *s, int argc, reg_t *argv) { return make_reg(0, (int16) sqrt((float) abs(argv[0].toSint16()))); } @@ -63,7 +63,7 @@ int get_angle(int xrel, int yrel) { } } -reg_t kGetAngle(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetAngle(EngineState *s, int argc, reg_t *argv) { // Based on behavior observed with a test program created with // SCI Studio. int x1 = argv[0].toSint16(); @@ -100,7 +100,7 @@ reg_t kGetAngle(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, angle); } -reg_t kGetDistance(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetDistance(EngineState *s, int argc, reg_t *argv) { int xdiff = (argc > 3) ? argv[3].toSint16() : 0; int ydiff = (argc > 2) ? argv[2].toSint16() : 0; int angle = (argc > 5) ? argv[5].toSint16() : 0; @@ -109,21 +109,21 @@ reg_t kGetDistance(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, (int16)sqrt((float) xrel*xrel + yrel*yrel)); } -reg_t kTimesSin(EngineState *s, int, int argc, reg_t *argv) { +reg_t kTimesSin(EngineState *s, int argc, reg_t *argv) { int angle = argv[0].toSint16(); int factor = argv[1].toSint16(); return make_reg(0, (int)(factor * sin(angle * PI / 180.0))); } -reg_t kTimesCos(EngineState *s, int, int argc, reg_t *argv) { +reg_t kTimesCos(EngineState *s, int argc, reg_t *argv) { int angle = argv[0].toSint16(); int factor = argv[1].toSint16(); return make_reg(0, (int)(factor * cos(angle * PI / 180.0))); } -reg_t kCosDiv(EngineState *s, int, int argc, reg_t *argv) { +reg_t kCosDiv(EngineState *s, int argc, reg_t *argv) { int angle = argv[0].toSint16(); int value = argv[1].toSint16(); double cosval = cos(angle * PI / 180.0); @@ -135,7 +135,7 @@ reg_t kCosDiv(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, (int16)(value / cosval)); } -reg_t kSinDiv(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSinDiv(EngineState *s, int argc, reg_t *argv) { int angle = argv[0].toSint16(); int value = argv[1].toSint16(); double sinval = sin(angle * PI / 180.0); @@ -147,7 +147,7 @@ reg_t kSinDiv(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, (int16)(value / sinval)); } -reg_t kTimesTan(EngineState *s, int, int argc, reg_t *argv) { +reg_t kTimesTan(EngineState *s, int argc, reg_t *argv) { int param = argv[0].toSint16(); int scale = (argc > 1) ? argv[1].toSint16() : 1; @@ -159,7 +159,7 @@ reg_t kTimesTan(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, (int16) - (tan(param * PI / 180.0) * scale)); } -reg_t kTimesCot(EngineState *s, int, int argc, reg_t *argv) { +reg_t kTimesCot(EngineState *s, int argc, reg_t *argv) { int param = argv[0].toSint16(); int scale = (argc > 1) ? argv[1].toSint16() : 1; diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index 5a1f32e876..18c357162c 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -33,7 +33,7 @@ namespace Sci { -reg_t kAddMenu(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAddMenu(EngineState *s, int argc, reg_t *argv) { Common::String name = s->segMan->getString(argv[0]); Common::String contents = s->segMan->getString(argv[1]); @@ -45,7 +45,7 @@ reg_t kAddMenu(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kSetMenu(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetMenu(EngineState *s, int argc, reg_t *argv) { int index = argv[0].toUint16(); int i = 2; @@ -57,14 +57,14 @@ reg_t kSetMenu(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGetMenu(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetMenu(EngineState *s, int argc, reg_t *argv) { int index = argv[0].toUint16(); return s->_menubar->getAttribute((index >> 8) - 1, (index & 0xff) - 1, argv[1].toUint16()); } -reg_t kDrawStatus(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) { reg_t text = argv[0]; int fgcolor = (argc > 1) ? argv[1].toSint16() : s->status_bar_foreground; int bgcolor = (argc > 2) ? argv[2].toSint16() : s->status_bar_background; @@ -89,7 +89,7 @@ reg_t kDrawStatus(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kDrawMenuBar(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDrawMenuBar(EngineState *s, int argc, reg_t *argv) { if (argv[0].toSint16()) sciw_set_menubar(s, s->titlebar_port, s->_menubar, -1); @@ -122,7 +122,7 @@ static int _menu_go_down(Menubar *menubar, int menu_nr, int item_nr) { gfxop_update(s->gfx_state); -reg_t kMenuSelect(EngineState *s, int, int argc, reg_t *argv) { +reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t event = argv[0]; /*int pause_sound = (argc > 1) ? argv[1].toUint16() : 1;*/ /* FIXME: Do this eventually */ diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index dca123663d..42a595cdd8 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -35,7 +35,7 @@ namespace Sci { -reg_t kRestartGame(EngineState *s, int, int argc, reg_t *argv) { +reg_t kRestartGame(EngineState *s, int argc, reg_t *argv) { s->restarting_flags |= SCI_GAME_IS_RESTARTING_NOW; s->restarting_flags &= ~SCI_GAME_WAS_RESTARTED_AT_LEAST_ONCE; // This appears to help @@ -48,7 +48,7 @@ reg_t kRestartGame(EngineState *s, int, int argc, reg_t *argv) { /* kGameIsRestarting(): ** Returns the restarting_flag in acc */ -reg_t kGameIsRestarting(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) { s->r_acc = make_reg(0, (s->restarting_flags & SCI_GAME_WAS_RESTARTED)); if (argc) { // Only happens during replay @@ -59,7 +59,7 @@ reg_t kGameIsRestarting(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kHaveMouse(EngineState *s, int, int argc, reg_t *argv) { +reg_t kHaveMouse(EngineState *s, int argc, reg_t *argv) { return make_reg(0, SIGNAL_OFFSET); } @@ -71,7 +71,7 @@ enum kMemoryInfoFunc { K_MEMORYINFO_TOTAL_HUNK = 4 // Total amount of hunk memory (SCI01) }; -reg_t kMemoryInfo(EngineState *s, int, int argc, reg_t *argv) { +reg_t kMemoryInfo(EngineState *s, int argc, reg_t *argv) { const uint16 size = 0x7fff; // Must not be 0xffff, or some memory calculations will overflow switch (argv[0].offset) { @@ -92,13 +92,13 @@ reg_t kMemoryInfo(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kFlushResources(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFlushResources(EngineState *s, int argc, reg_t *argv) { run_gc(s); debugC(2, kDebugLevelRoom, "Entering room number %d", argv[0].toUint16()); return s->r_acc; } -reg_t kSetDebug(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetDebug(EngineState *s, int argc, reg_t *argv) { printf("Debug mode activated\n"); g_debugState.seeking = kDebugSeekNothing; @@ -113,7 +113,7 @@ enum { K_NEW_GETTIME_DATE = 3 }; -reg_t kGetTime(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetTime(EngineState *s, int argc, reg_t *argv) { tm loc_time; uint32 start_time; int retval = 0; // Avoid spurious warning @@ -163,7 +163,7 @@ enum { K_MEMORY_POKE = 6 }; -reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) { +reg_t kMemory(EngineState *s, int argc, reg_t *argv) { switch (argv[0].toUint16()) { case K_MEMORY_ALLOCATE_CRITICAL : if (!s->segMan->allocDynmem(argv[1].toUint16(), "kMemory() critical", &s->r_acc)) { @@ -220,7 +220,7 @@ reg_t kMemory(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kPlatform(EngineState *s, int, int argc, reg_t *argv) { +reg_t kPlatform(EngineState *s, int argc, reg_t *argv) { if (argc == 1) { if (argv[0].toUint16() == 4) if (((SciEngine*)g_engine)->getPlatform() == Common::kPlatformWindows) @@ -238,28 +238,4 @@ reg_t kPlatform(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kUnknown(EngineState *s, int funct_nr, int argc, reg_t *argv) { - warning("Unknown kernel function 0x%02x", funct_nr); - return NULL_REG; -} - -reg_t kStub(EngineState *s, int funct_nr, int argc, reg_t *argv) { - char tmpbuf[256]; - snprintf(tmpbuf, sizeof(tmpbuf), "Unimplemented kernel function: 0x%02x (%s) (", - funct_nr, s->_kernel->getKernelName(funct_nr).c_str()); - - for (int i = 0; i < argc; i++) { - char tmpbuf2[20]; - sprintf(tmpbuf2, "%04x:%04x", PRINT_REG(argv[i])); - if (i + 1 < argc) - strcat(tmpbuf2, ", "); - strcat(tmpbuf, tmpbuf2); - } - strcat(tmpbuf, ")"); - - warning("%s", tmpbuf); - - return NULL_REG; -} - } // End of namespace Sci diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index ac4a2382ad..ad5851cd3d 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -67,7 +67,7 @@ But the solution resulting from that is a lot more complicated, so we use the ab Still, what we compute in the end is of course not a real velocity anymore, but an integer approximation, used in an iterative stepping algorithm */ -reg_t kSetJump(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetJump(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; // Input data reg_t object = argv[0]; @@ -218,7 +218,7 @@ static void initialize_bresen(SegManager *segMan, int argc, reg_t *argv, reg_t m PUT_SEL32V(mover, b_i2, bdi * 2); } -reg_t kInitBresen(EngineState *s, int, int argc, reg_t *argv) { +reg_t kInitBresen(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t mover = argv[0]; reg_t client = GET_SEL32(mover, client); @@ -284,7 +284,7 @@ static void bresenham_autodetect(EngineState *s) { } } -reg_t kDoBresen(EngineState *s, int, 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(mover, client); @@ -393,7 +393,7 @@ reg_t kDoBresen(EngineState *s, int, int argc, reg_t *argv) { extern void _k_dirloop(reg_t obj, uint16 angle, EngineState *s, int argc, reg_t *argv); extern int get_angle(int xrel, int yrel); -reg_t kDoAvoider(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDoAvoider(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t avoider = argv[0]; reg_t client, looper, mover; diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 421974701e..f6377f46b9 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -1627,7 +1627,7 @@ static reg_t output_path(PathfindingState *p, EngineState *s) { return output; } -reg_t kAvoidPath(EngineState *s, int, int argc, reg_t *argv) { +reg_t kAvoidPath(EngineState *s, int argc, reg_t *argv) { Common::Point start = Common::Point(argv[0].toSint16(), argv[1].toSint16()); #ifdef DEBUG_AVOIDPATH diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 70534016ae..ca56cd6cb1 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -33,7 +33,7 @@ namespace Sci { // Loads arbitrary resources of type 'restype' with resource numbers 'resnrs' // This implementation ignores all resource numbers except the first one. -reg_t kLoad(EngineState *s, int, int argc, reg_t *argv) { +reg_t kLoad(EngineState *s, int argc, reg_t *argv) { int restype = argv[0].toUint16(); int resnr = argv[1].toUint16(); @@ -44,7 +44,7 @@ reg_t kLoad(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, ((restype << 11) | resnr)); // Return the resource identifier as handle } -reg_t kLock(EngineState *s, int, int argc, reg_t *argv) { +reg_t kLock(EngineState *s, int argc, reg_t *argv) { int state = argc > 2 ? argv[2].toUint16() : 1; ResourceType type = (ResourceType)(argv[0].toUint16() & 0x7f); ResourceId id = ResourceId(type, argv[1].toUint16()); @@ -72,7 +72,7 @@ reg_t kLock(EngineState *s, int, int argc, reg_t *argv) { } // Unloads an arbitrary resource of type 'restype' with resource numbber 'resnr' -reg_t kUnLoad(EngineState *s, int, int argc, reg_t *argv) { +reg_t kUnLoad(EngineState *s, int argc, reg_t *argv) { int restype = argv[0].toUint16(); reg_t resnr = argv[1]; @@ -82,7 +82,7 @@ reg_t kUnLoad(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kResCheck(EngineState *s, int, int argc, reg_t *argv) { +reg_t kResCheck(EngineState *s, int argc, reg_t *argv) { Resource *res = NULL; ResourceType restype = (ResourceType)(argv[0].toUint16() & 0x7f); @@ -102,7 +102,7 @@ reg_t kResCheck(EngineState *s, int, int argc, reg_t *argv) { return make_reg(0, res != NULL); } -reg_t kClone(EngineState *s, int, int argc, reg_t *argv) { +reg_t kClone(EngineState *s, int argc, reg_t *argv) { reg_t parent_addr = argv[0]; Object *parent_obj = s->segMan->getObject(parent_addr); reg_t clone_addr; @@ -138,7 +138,7 @@ reg_t kClone(EngineState *s, int, int argc, reg_t *argv) { extern void _k_view_list_mark_free(EngineState *s, reg_t off); -reg_t kDisposeClone(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDisposeClone(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t victim_addr = argv[0]; Clone *victim_obj = s->segMan->getObject(victim_addr); @@ -176,7 +176,7 @@ reg_t kDisposeClone(EngineState *s, int, int argc, reg_t *argv) { } // Returns script dispatch address index in the supplied script -reg_t kScriptID(EngineState *s, int, int argc, reg_t *argv) { +reg_t kScriptID(EngineState *s, int argc, reg_t *argv) { int script = argv[0].toUint16(); int index = (argc > 1) ? argv[1].toUint16() : 0; @@ -205,7 +205,7 @@ reg_t kScriptID(EngineState *s, int, int argc, reg_t *argv) { return make_reg(scriptSeg, s->segMan->validateExportFunc(index, scriptSeg)); } -reg_t kDisposeScript(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDisposeScript(EngineState *s, int argc, reg_t *argv) { int script = argv[0].offset; // Work around QfG1 graveyard bug @@ -231,14 +231,14 @@ reg_t kDisposeScript(EngineState *s, int, int argc, reg_t *argv) { } } -reg_t kIsObject(EngineState *s, int, int argc, reg_t *argv) { - if (argv[0].offset == 0xffff) // Treated specially +reg_t kIsObject(EngineState *s, int argc, reg_t *argv) { + if (argv[0].offset == SIGNAL_OFFSET) // Treated specially return NULL_REG; else return make_reg(0, s->segMan->isHeapObject(argv[0])); } -reg_t kRespondsTo(EngineState *s, int, int argc, reg_t *argv) { +reg_t kRespondsTo(EngineState *s, int argc, reg_t *argv) { reg_t obj = argv[0]; int selector = argv[1].toUint16(); diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 628b8313b1..7b20a65e95 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -1002,7 +1002,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) { /** * Used for synthesized music playback */ -reg_t kDoSound(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDoSound(EngineState *s, int argc, reg_t *argv) { switch(s->detectDoSoundType()) { case SCI_VERSION_0_EARLY: return kDoSoundSci0(s, argc, argv); @@ -1019,7 +1019,7 @@ reg_t kDoSound(EngineState *s, int, int argc, reg_t *argv) { /** * Used for speech playback and digital soundtracks in CD games */ -reg_t kDoAudio(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) { Audio::Mixer *mixer = g_system->getMixer(); switch (argv[0].toUint16()) { @@ -1076,7 +1076,7 @@ reg_t kDoAudio(EngineState *s, int, int argc, reg_t *argv) { return s->r_acc; } -reg_t kDoSync(EngineState *s, int, int argc, reg_t *argv) { +reg_t kDoSync(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; switch (argv[0].toUint16()) { case kSciAudioSyncStart: { diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 3f068fd044..81cc2aa707 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -78,7 +78,7 @@ Common::String kernel_lookup_text(EngineState *s, reg_t address, int index) { /**********/ -reg_t kSaid(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSaid(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t heap_said_block = argv[0]; byte *said_block; @@ -128,7 +128,7 @@ reg_t kSaid(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kSetSynonyms(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetSynonyms(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t object = argv[0]; List *list; @@ -186,7 +186,7 @@ reg_t kSetSynonyms(EngineState *s, int, int argc, reg_t *argv) { -reg_t kParse(EngineState *s, int, int argc, reg_t *argv) { +reg_t kParse(EngineState *s, int argc, reg_t *argv) { SegManager *segMan = s->segMan; reg_t stringpos = argv[0]; Common::String string = s->segMan->getString(stringpos); @@ -256,14 +256,14 @@ reg_t kParse(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kStrEnd(EngineState *s, int, int argc, reg_t *argv) { +reg_t kStrEnd(EngineState *s, int argc, reg_t *argv) { reg_t address = argv[0]; address.offset += s->segMan->strlen(address); return address; } -reg_t kStrCat(EngineState *s, int, int argc, reg_t *argv) { +reg_t kStrCat(EngineState *s, int argc, reg_t *argv) { Common::String s1 = s->segMan->getString(argv[0]); Common::String s2 = s->segMan->getString(argv[1]); @@ -272,7 +272,7 @@ reg_t kStrCat(EngineState *s, int, int argc, reg_t *argv) { return argv[0]; } -reg_t kStrCmp(EngineState *s, int, int argc, reg_t *argv) { +reg_t kStrCmp(EngineState *s, int argc, reg_t *argv) { Common::String s1 = s->segMan->getString(argv[0]); Common::String s2 = s->segMan->getString(argv[1]); @@ -283,7 +283,7 @@ reg_t kStrCmp(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kStrCpy(EngineState *s, int, int argc, reg_t *argv) { +reg_t kStrCpy(EngineState *s, int argc, reg_t *argv) { if (argc > 2) { int length = argv[2].toSint16(); @@ -298,7 +298,7 @@ reg_t kStrCpy(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv) { +reg_t kStrAt(EngineState *s, int argc, reg_t *argv) { SegmentRef dest_r = s->segMan->dereference(argv[0]); if (!dest_r.raw) { warning("Attempt to StrAt at invalid pointer %04x:%04x", PRINT_REG(argv[0])); @@ -338,7 +338,7 @@ reg_t kStrAt(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv) { +reg_t kReadNumber(EngineState *s, int argc, reg_t *argv) { Common::String source_str = s->segMan->getString(argv[0]); const char *source = source_str.c_str(); @@ -363,7 +363,7 @@ reg_t kReadNumber(EngineState *s, int, int argc, reg_t *argv) { ** Formats the text from text.textresnr (offset index_inside_res) or heap_text_addr according to ** the supplied parameters and writes it to the targ_address. */ -reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) { +reg_t kFormat(EngineState *s, int argc, reg_t *argv) { uint16 *arguments; reg_t dest = argv[0]; char targetbuf[512]; @@ -581,12 +581,12 @@ reg_t kFormat(EngineState *s, int, int argc, reg_t *argv) { } -reg_t kStrLen(EngineState *s, int, int argc, reg_t *argv) { +reg_t kStrLen(EngineState *s, int argc, reg_t *argv) { return make_reg(0, s->segMan->strlen(argv[0])); } -reg_t kGetFarText(EngineState *s, int, int argc, reg_t *argv) { +reg_t kGetFarText(EngineState *s, int argc, reg_t *argv) { Resource *textres = s->resMan->findResource(ResourceId(kResourceTypeText, argv[0].toUint16()), 0); char *seeker; int counter = argv[1].toUint16(); @@ -625,7 +625,7 @@ enum kMessageFunc { K_MESSAGE_LASTMESSAGE }; -reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) { +reg_t kMessage(EngineState *s, int argc, reg_t *argv) { MessageTuple tuple; int func; // For earlier version of of this function (GetMessage) @@ -751,13 +751,13 @@ reg_t kMessage(EngineState *s, int, int argc, reg_t *argv) { return NULL_REG; } -reg_t kSetQuitStr(EngineState *s, int, int argc, reg_t *argv) { +reg_t kSetQuitStr(EngineState *s, int argc, reg_t *argv) { Common::String quitStr = s->segMan->getString(argv[0]); debug("Setting quit string to '%s'", quitStr.c_str()); return s->r_acc; } -reg_t kStrSplit(EngineState *s, int, int argc, reg_t *argv) { +reg_t kStrSplit(EngineState *s, int argc, reg_t *argv) { Common::String format = s->segMan->getString(argv[1]); Common::String sep_str; const char *sep = NULL; diff --git a/engines/sci/engine/selector.cpp b/engines/sci/engine/selector.cpp index 93d84dc5e1..8ab5582417 100644 --- a/engines/sci/engine/selector.cpp +++ b/engines/sci/engine/selector.cpp @@ -53,7 +53,7 @@ void write_selector(SegManager *segMan, reg_t object, Selector selector_id, reg_ *address.getPointer(segMan) = value; } -int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid, int kfunct, +int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvocation noinvalid, StackPtr k_argp, int k_argc, const char *fname, int line, int argc, ...) { va_list argp; int i; @@ -88,7 +88,7 @@ int invoke_selector(EngineState *s, reg_t object, int selector_id, SelectorInvoc ExecStack *xstack; xstack = add_exec_stack_entry(s, NULL_REG, NULL, NULL_REG, k_argc, k_argp - 1, 0, NULL_REG, s->_executionStack.size()-1, SCI_XS_CALLEE_LOCALS); - xstack->selector = -42 - kfunct; // Evil debugging hack to identify kernel function + xstack->selector = -42 + 1; // Evil debugging hack to identify kernel function xstack->type = EXEC_STACK_TYPE_KERNEL; // Now commit the actual function: diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index d5188665f6..de910e012b 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -943,7 +943,24 @@ void run_vm(EngineState *s, int restoring) { && !kernel_matches_signature(s->segMan, kfun.signature, argc, scriptState.xs->sp + 1)) { error("[VM] Invalid arguments to kernel call %x", opparams[0]); } else { - s->r_acc = kfun.fun(s, opparams[0], argc, scriptState.xs->sp + 1); + reg_t *argv = scriptState.xs->sp + 1; + + if (!kfun.isDummy) { + s->r_acc = kfun.fun(s, argc, argv); + } else { + Common::String warningMsg = "Dummy function " + kfun.orig_name + "["; + warningMsg += warningMsg.printf("0x%x", opparams[0]); + warningMsg += "] invoked - ignoring. Params: "; + warningMsg += warningMsg.printf("%d", argc); + warningMsg += " ("; + + for (int i = 0; i < argc; i++) { + warningMsg += warningMsg.printf("%04x:%04x", PRINT_REG(argv[i])); + warningMsg += (i == argc - 1 ? ")" : ", "); + } + + warning(warningMsg.c_str()); + } } // Call kernel function |