diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sludge/builtin.cpp | 32 | ||||
-rw-r--r-- | engines/sludge/functionlist.h | 338 |
2 files changed, 173 insertions, 197 deletions
diff --git a/engines/sludge/builtin.cpp b/engines/sludge/builtin.cpp index e06cea204b..0867f7cdf3 100644 --- a/engines/sludge/builtin.cpp +++ b/engines/sludge/builtin.cpp @@ -65,31 +65,6 @@ extern int numBIFNames, numUserFunc; extern Common::String *allUserFunc; extern Common::String *allBIFNames; -int paramNum[] = { -1, 0, 1, 1, -1, -1, 1, 3, 4, 1, 0, 0, 8, -1, // SAY->MOVEMOUSE - -1, 0, 0, -1, -1, 1, 1, 1, 1, 4, 1, 1, 2, 1,// FOCUS->REMOVEREGION - 2, 2, 0, 0, 2, // ANIMATE->SETSCALE - -1, 2, 1, 0, 0, 0, 1, 0, 3, // new/push/pop stack, status stuff - 2, 0, 0, 3, 1, 0, 2, // delFromStack->completeTimers - -1, -1, -1, 2, 2, 0, 3, 1, // anim, costume, pO, setC, wait, sS, substring, stringLength - 0, 1, 1, 0, 2, // dark, save, load, quit, rename - 1, 3, 3, 1, 2, 1, 1, 3, 1, 0, 0, 2, 1, // stackSize, pasteString, startMusic, defvol, vol, stopmus, stopsound, setfont, alignStatus, show x 2, pos'Status, setFloor - -1, -1, 1, 1, 2, 1, 1, 1, -1, -1, -1, 1, 1, // force, jump, peekstart, peekend, enqueue, getSavedGames, inFont, loopSound, removeChar, stopCharacter - 1, 0, 3, 3, 1, 2, 1, 2, 2, // launch, howFrozen, pastecol, litcol, checksaved, float, cancelfunc, walkspeed, delAll - 2, 3, 1, 2, 2, 0, 0, 1, 2, 3, 1, -1, // extras, mixoverlay, pastebloke, getMScreenX/Y, setSound(Default/-)Volume, looppoints, speechMode, setLightMap - -1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, // think, getCharacterDirection, is(char/region/moving), deleteGame, renameGame, hardScroll, stringWidth, speechSpeed, normalCharacter - 2, 1, 2, 1, 3, 1, 1, 2, 1, // fetchEvent, setBrightness, spin, fontSpace, burnString, captureAll, cacheSound, setSpinSpeed, transitionMode - 1, 0, 0, 1, 0, 2, 1, 1, 1, // movie(Start/Abort/Playing), updateDisplay, getSoundCache, savedata, loaddata, savemode, freeSound - 3, 0, 3, 3, 2, 1, 1, // setParallax, clearParallax, setBlankColour, setBurnColour, getPixelColour, makeFastArray, getCharacterScale - 0, 2, 0, // getLanguage, launchWith, getFramesPerSecond - 3, 2, 2, 0, 0, 1, // readThumbnail, setThumbnailSize, hasFlag, snapshot, clearSnapshot, anyFilename - 2, 1, // regGet, fatal - 4, 3, -1, 0, // chr AA, max AA, setBackgroundEffect, doBackgroundEffect - 2, // setCharacterAngleOffset - 2, 5, // setCharacterTransparency, setCharacterColourise - 1, // zoomCamera - 1, 0, 0 // playMovie, stopMovie, pauseMovie - }; - bool failSecurityCheck(const Common::String &fn) { if (fn.empty()) return true; @@ -117,6 +92,7 @@ LoadedFunction *saverFunc; typedef BuiltReturn (*builtInSludgeFunc)(int numParams, LoadedFunction *fun); struct builtInFunctionData { builtInSludgeFunc func; + int paramNum; }; #define builtIn(a) static BuiltReturn builtIn_ ## a (int numParams, LoadedFunction *fun) @@ -2574,9 +2550,9 @@ BuiltReturn callBuiltIn(int whichFunc, int numParams, LoadedFunction *fun) { } if (whichFunc < NUM_FUNCS) { - if (paramNum[whichFunc] != -1) { - if (paramNum[whichFunc] != numParams) { - Common::String buff = Common::String::format("Built in function must have %i parameter%s", paramNum[whichFunc], (paramNum[whichFunc] == 1) ? "" : "s"); + if (builtInFunctionArray[whichFunc].paramNum != -1) { + if (builtInFunctionArray[whichFunc].paramNum != numParams) { + Common::String buff = Common::String::format("Built in function must have %i parameter%s", builtInFunctionArray[whichFunc].paramNum, (builtInFunctionArray[whichFunc].paramNum == 1) ? "" : "s"); Common::String msg = buff; fatal(msg); return BR_ERROR; diff --git a/engines/sludge/functionlist.h b/engines/sludge/functionlist.h index 025f80a844..c7858a2d03 100644 --- a/engines/sludge/functionlist.h +++ b/engines/sludge/functionlist.h @@ -29,178 +29,178 @@ namespace Sludge { -#define FUNC(special,name) {builtIn_ ## name}, +#define FUNC(special,name,paramNum) {builtIn_ ## name, paramNum}, static builtInFunctionData builtInFunctionArray[] = { - FUNC(true, say) - FUNC(true, skipSpeech) - FUNC(true, statusText) - FUNC(true, pause) - FUNC(true, onLeftMouse) - FUNC(true, onRightMouse) - FUNC(true, setCursor) - FUNC(true, addOverlay) - FUNC(true, addCharacter) - FUNC(true, playSound) - FUNC(true, getMouseX) - FUNC(true, getMouseY) - FUNC(true, addScreenRegion) - FUNC(true, onMoveMouse) - FUNC(true, onFocusChange) - FUNC(true, getOverObject) - FUNC(true, blankScreen) - FUNC(true, moveCharacter) - FUNC(true, onKeyboard) - FUNC(true, getObjectX) - FUNC(true, getObjectY) - FUNC(true, random) - FUNC(true, spawnSub) - FUNC(true, blankArea) - FUNC(true, hideCharacter) - FUNC(true, showCharacter) - FUNC(true, callEvent) - FUNC(true, removeScreenRegion) - FUNC(true, animate) - FUNC(true, turnCharacter) - FUNC(true, removeAllCharacters) - FUNC(true, removeAllScreenRegions) - FUNC(true, setScale) - FUNC(true, newStack) - FUNC(true, pushToStack) - FUNC(true, popFromStack) - FUNC(true, clearStatus) - FUNC(true, addStatus) - FUNC(true, removeLastStatus) - FUNC(true, lightStatus) - FUNC(true, getStatusText) - FUNC(true, setStatusColour) - FUNC(true, deleteFromStack) - FUNC(true, freeze) - FUNC(true, unfreeze) - FUNC(true, pasteImage) - FUNC(true, copyStack) - FUNC(true, completeTimers) - FUNC(true, setCharacterDrawMode) - FUNC(true, anim) - FUNC(true, costume) - FUNC(true, pickOne) - FUNC(true, setCostume) - FUNC(true, wait) - FUNC(true, somethingSpeaking) - FUNC(true, substring) - FUNC(true, stringLength) - FUNC(true, darkBackground) - FUNC(true, saveGame) - FUNC(true, loadGame) - FUNC(true, quitGame) - FUNC(true, rename) - FUNC(true, stackSize) - FUNC(true, pasteString) - FUNC(true, startMusic) - FUNC(true, setDefaultMusicVolume) - FUNC(true, setMusicVolume) - FUNC(true, stopMusic) - FUNC(true, stopSound) - FUNC(true, setFont) - FUNC(true, alignStatus) - FUNC(true, showFloor) - FUNC(true, showBoxes) - FUNC(true, positionStatus) - FUNC(true, setFloor) - FUNC(true, forceCharacter) - FUNC(true, jumpCharacter) - FUNC(true, peekStart) - FUNC(true, peekEnd) - FUNC(true, enqueue) - FUNC(true, setZBuffer) - FUNC(true, getMatchingFiles) - FUNC(true, inFont) - FUNC(true, onLeftMouseUp) - FUNC(true, onRightMouseUp) - FUNC(true, loopSound) - FUNC(true, removeCharacter) - FUNC(true, stopCharacter) - FUNC(true, launch) - FUNC(true, howFrozen) - FUNC(true, setPasteColour) - FUNC(true, setLitStatusColour) - FUNC(true, fileExists) - FUNC(true, floatCharacter) - FUNC(true, cancelSub) - FUNC(true, setCharacterWalkSpeed) - FUNC(true, deleteAllFromStack) - FUNC(true, setCharacterExtra) - FUNC(true, mixOverlay) - FUNC(true, pasteCharacter) - FUNC(true, setSceneDimensions) - FUNC(true, aimCamera) - FUNC(true, getMouseScreenX) - FUNC(true, getMouseScreenY) - FUNC(true, setDefaultSoundVolume) - FUNC(true, setSoundVolume) - FUNC(true, setSoundLoopPoints) - FUNC(true, setSpeechMode) - FUNC(true, setLightMap) - FUNC(true, think) - FUNC(true, getCharacterDirection) - FUNC(true, isCharacter) - FUNC(true, isScreenRegion) - FUNC(true, isMoving) - FUNC(true, deleteFile) - FUNC(true, renameFile) - FUNC(true, hardScroll) - FUNC(true, stringWidth) - FUNC(true, setSpeechSpeed) - FUNC(true, normalCharacter) - FUNC(true, fetchEvent) - FUNC(true, transitionLevel) - FUNC(true, spinCharacter) - FUNC(true, setFontSpacing) - FUNC(true, burnString) - FUNC(true, captureAllKeys) - FUNC(true, cacheSound) - FUNC(true, setCharacterSpinSpeed) - FUNC(true, transitionMode) - FUNC(false, _rem_movieStart) - FUNC(false, _rem_movieAbort) - FUNC(false, _rem_moviePlaying) - FUNC(false, _rem_updateDisplay) - FUNC(true, getSoundCache) - FUNC(true, saveCustomData) - FUNC(true, loadCustomData) - FUNC(true, setCustomEncoding) - FUNC(true, freeSound) - FUNC(true, parallaxAdd) - FUNC(true, parallaxClear) - FUNC(true, setBlankColour) - FUNC(true, setBurnColour) - FUNC(true, getPixelColour) - FUNC(true, makeFastArray) - FUNC(true, getCharacterScale) - FUNC(true, getLanguageID) - FUNC(false, _rem_launchWith) - FUNC(true, getFramesPerSecond) - FUNC(true, showThumbnail) - FUNC(true, setThumbnailSize) - FUNC(true, hasFlag) - FUNC(true, snapshotGrab) - FUNC(true, snapshotClear) - FUNC(true, bodgeFilenames) - FUNC(false, _rem_registryGetString) - FUNC(true, quitWithFatalError) - FUNC(true, _rem_setCharacterAA) - FUNC(true, _rem_setMaximumAA) - FUNC(true, setBackgroundEffect) - FUNC(true, doBackgroundEffect) - FUNC(true, setCharacterAngleOffset) - FUNC(true, setCharacterTransparency) - FUNC(true, setCharacterColourise) - FUNC(true, zoomCamera) - FUNC(true, playMovie) - FUNC(true, stopMovie) - FUNC(true, pauseMovie) + FUNC(true, say, -1) + FUNC(true, skipSpeech, 0) + FUNC(true, statusText, 1) + FUNC(true, pause, 1) + FUNC(true, onLeftMouse, -1) + FUNC(true, onRightMouse, -1) + FUNC(true, setCursor, 1) + FUNC(true, addOverlay, 3) + FUNC(true, addCharacter, 4) + FUNC(true, playSound, 1) + FUNC(true, getMouseX, 0) + FUNC(true, getMouseY, 0) + FUNC(true, addScreenRegion, 8) + FUNC(true, onMoveMouse, -1) + FUNC(true, onFocusChange, -1) + FUNC(true, getOverObject, 0) + FUNC(true, blankScreen, 0) + FUNC(true, moveCharacter, -1) + FUNC(true, onKeyboard, -1) + FUNC(true, getObjectX, 1) + FUNC(true, getObjectY, 1) + FUNC(true, random, 1) + FUNC(true, spawnSub, 1) + FUNC(true, blankArea, 4) + FUNC(true, hideCharacter, 1) + FUNC(true, showCharacter, 1) + FUNC(true, callEvent, 2) + FUNC(true, removeScreenRegion, 1) + FUNC(true, animate, 2) + FUNC(true, turnCharacter, 2) + FUNC(true, removeAllCharacters, 0) + FUNC(true, removeAllScreenRegions, 0) + FUNC(true, setScale, 2) + FUNC(true, newStack, -1) + FUNC(true, pushToStack, 2) + FUNC(true, popFromStack, 1) + FUNC(true, clearStatus, 0) + FUNC(true, addStatus, 0) + FUNC(true, removeLastStatus, 0) + FUNC(true, lightStatus, 1) + FUNC(true, getStatusText, 0) + FUNC(true, setStatusColour, 3) + FUNC(true, deleteFromStack, 2) + FUNC(true, freeze, 0) + FUNC(true, unfreeze, 0) + FUNC(true, pasteImage, 3) + FUNC(true, copyStack, 1) + FUNC(true, completeTimers, 0) + FUNC(true, setCharacterDrawMode, 2) + FUNC(true, anim, -1) + FUNC(true, costume, -1) + FUNC(true, pickOne, -1) + FUNC(true, setCostume, 2) + FUNC(true, wait, 2) + FUNC(true, somethingSpeaking, 0) + FUNC(true, substring, 3) + FUNC(true, stringLength, 1) + FUNC(true, darkBackground, 0) + FUNC(true, saveGame, 1) + FUNC(true, loadGame, 1) + FUNC(true, quitGame, 0) + FUNC(true, rename, 2) + FUNC(true, stackSize, 1) + FUNC(true, pasteString, 3) + FUNC(true, startMusic, 3) + FUNC(true, setDefaultMusicVolume, 1) + FUNC(true, setMusicVolume, 2) + FUNC(true, stopMusic, 1) + FUNC(true, stopSound, 1) + FUNC(true, setFont, 3) + FUNC(true, alignStatus, 1) + FUNC(true, showFloor, 0) + FUNC(true, showBoxes, 0) + FUNC(true, positionStatus, 2) + FUNC(true, setFloor, 1) + FUNC(true, forceCharacter, -1) + FUNC(true, jumpCharacter, -1) + FUNC(true, peekStart, 1) + FUNC(true, peekEnd, 1) + FUNC(true, enqueue, 2) + FUNC(true, setZBuffer, 1) + FUNC(true, getMatchingFiles, 1) + FUNC(true, inFont, 1) + FUNC(true, onLeftMouseUp, -1) + FUNC(true, onRightMouseUp, -1) + FUNC(true, loopSound, -1) + FUNC(true, removeCharacter, 1) + FUNC(true, stopCharacter, 1) + FUNC(true, launch, 1) + FUNC(true, howFrozen, 0) + FUNC(true, setPasteColour, 3) + FUNC(true, setLitStatusColour, 3) + FUNC(true, fileExists, 1) + FUNC(true, floatCharacter, 2) + FUNC(true, cancelSub, 1) + FUNC(true, setCharacterWalkSpeed, 2) + FUNC(true, deleteAllFromStack, 2) + FUNC(true, setCharacterExtra, 2) + FUNC(true, mixOverlay, 3) + FUNC(true, pasteCharacter, 1) + FUNC(true, setSceneDimensions, 2) + FUNC(true, aimCamera, 2) + FUNC(true, getMouseScreenX, 0) + FUNC(true, getMouseScreenY, 0) + FUNC(true, setDefaultSoundVolume, 1) + FUNC(true, setSoundVolume, 2) + FUNC(true, setSoundLoopPoints, 3) + FUNC(true, setSpeechMode, 1) + FUNC(true, setLightMap, -1) + FUNC(true, think, -1) + FUNC(true, getCharacterDirection, 1) + FUNC(true, isCharacter, 1) + FUNC(true, isScreenRegion, 1) + FUNC(true, isMoving, 1) + FUNC(true, deleteFile, 1) + FUNC(true, renameFile, 2) + FUNC(true, hardScroll, 1) + FUNC(true, stringWidth, 1) + FUNC(true, setSpeechSpeed, 1) + FUNC(true, normalCharacter, 1) + FUNC(true, fetchEvent, 2) + FUNC(true, transitionLevel, 1) + FUNC(true, spinCharacter, 2) + FUNC(true, setFontSpacing, 1) + FUNC(true, burnString, 3) + FUNC(true, captureAllKeys, 1) + FUNC(true, cacheSound, 1) + FUNC(true, setCharacterSpinSpeed, 2) + FUNC(true, transitionMode, 1) + FUNC(false, _rem_movieStart, 1) + FUNC(false, _rem_movieAbort, 0) + FUNC(false, _rem_moviePlaying, 0) + FUNC(false, _rem_updateDisplay, 1) + FUNC(true, getSoundCache, 0) + FUNC(true, saveCustomData, 2) + FUNC(true, loadCustomData, 1) + FUNC(true, setCustomEncoding, 1) + FUNC(true, freeSound, 1) + FUNC(true, parallaxAdd, 3) + FUNC(true, parallaxClear, 0) + FUNC(true, setBlankColour, 3) + FUNC(true, setBurnColour, 3) + FUNC(true, getPixelColour, 2) + FUNC(true, makeFastArray, 1) + FUNC(true, getCharacterScale, 1) + FUNC(true, getLanguageID, 0) + FUNC(false, _rem_launchWith, 2) + FUNC(true, getFramesPerSecond, 0) + FUNC(true, showThumbnail, 3) + FUNC(true, setThumbnailSize, 2) + FUNC(true, hasFlag, 2) + FUNC(true, snapshotGrab, 0) + FUNC(true, snapshotClear, 0) + FUNC(true, bodgeFilenames, 1) + FUNC(false, _rem_registryGetString, 2) + FUNC(true, quitWithFatalError, 1) + FUNC(true, _rem_setCharacterAA, 4) + FUNC(true, _rem_setMaximumAA, 3) + FUNC(true, setBackgroundEffect, -1) + FUNC(true, doBackgroundEffect, 0) + FUNC(true, setCharacterAngleOffset, 2) + FUNC(true, setCharacterTransparency, 2) + FUNC(true, setCharacterColourise, 5) + FUNC(true, zoomCamera, 1) + FUNC(true, playMovie, 1) + FUNC(true, stopMovie, 0) + FUNC(true, pauseMovie, 0) }; #undef FUNC -int NUM_FUNCS = (sizeof (builtInFunctionArray) / sizeof (builtInFunctionArray[0])); +const static int NUM_FUNCS = (sizeof (builtInFunctionArray) / sizeof (builtInFunctionArray[0])); } // End of namespace Sludge |