-
Notifications
You must be signed in to change notification settings - Fork 3
Scumm 6 functions
-
1. Scripts
- startScript
- startScript0
- startScript2
- freezeUnfreeze
- breakScript
- breakXTimes
- stopObjectScript
- stopScript
- int isScriptRunning
- waitForActor
- waitForMessage
- waitForCamera
- waitForSentence
- waitForAnimation
- waitForTurn
- delay( ticks ), delaySeconds( sec ), delayMinutes
- stopSentence
- killAllScriptsExceptCurrent
- jumpToScript
- int isRoomScriptRunning
- 2. Interface
-
3. Room
- startRoom
- startRoomWithEgo
- setBoxFlags
- createBoxMatrix
- int getSpecialBox
- int isInBox
- int getBoxFlags
- setBoxSet
- setRoomColor
- setShakeOn(), setShakeOff
- setRoomIntensity
- setRoomRGBIntensity
- setRoomShadow
- roomPalManipulate
- setRoomCycleDelay
- setRoomPalette
- setRoomScroll
- setScreen
- screenEffect
- setPseudoRooms
- fadeOut( effect ), fadeIn
- setShadowPalette
- shiftShadowPalette
- int getRoomObjects
- saveLoadThing
-
4. Objects
- startObject
- startObject2
- drawObject
- drawObjectAt
- int isObjectOfClass
- setObjectClass
- int getObjectState( obj ), setObjectState
- int getObjectOwner( obj ), setObjectOwner
- pickupObject
- int getObjectX( obj ), int getObjectY
- int getObjectDir
- setObjectName
- int getObjectAt
- int getObjectVerbEntrypoint
- int getRoomObjectX( obj ), int getRoomObjectY
- int getRoomObjectWidth( obj ), int getRoomObjectHeight
- enqueueObject
- stampObject
- int getObjectNewDir
- loadFlObject
-
5. Actor
- setCurrentActor
- initActor
- initActorQuick
- setActorName
- walkActorToObj
- walkActorTo
- putActorAt
- putActorAtObject
- actorFace
- setActorStanding
- setActorDirection
- actorTurnToDirection
- setActorIgnoreTurnsOn(), setActorIgnoreTurnsOff
- actorFreeze(), actorUnfreeze
- setActorWalkSpeed
- int isActorMoving
- setActorIgnoreBoxes
- setActorFollowBoxes
- int getActorElevation( actor ), setActorElevation
- int getActorCostume( actor ), setActorCostume
- animateActor
- setActorAnimSpeed
- setActorWalkFrame
- setActorTalkFrame
- setActorStandFrame
- setActorInitFrame
- setActorDefaultFrames
- int getActorAnimVar( actor, var ), setActorAnimVar
- int getActorAnimCounter1
- setActorSounds
- int getActorRoom
- int getActorWalkBox
- setActorPalette
- setActorTalkColor
- int getActorWidth( actor ), setActorWidth
- setActorScale
- actorNeverZClip
- setActorZClip
- setActorShadowMode
- setActorTalkPos
- int getActorLayer( actor ), setActorLayer
- setActorWalkScript
- setActorTalkScript
- int getActorAt
- int getActorXScale
- int isActorInBox
- actorSay( actor, string ), egoSay
- int getActorFrame
- setActorScale
- setActorShadowMode
- stopTalking
- 6. Inventory
-
7. Verb
- doSentence
- int getVerbAt
- setCurrentVerb
- setVerbImage
- setVerbName
- setVerbColor
- setVerbHiColor
- setVerbXY
- setVerbOn(), setVerbOff
- killVerb
- initVerb
- setVerbDimColor
- verbDim
- setVerbKey
- verbCenter
- setVerbNameString
- setVerbObject
- setVerbBackColor
- redrawVerb
- saveVerbs( fromVerb, toVerb, slot ), restoreVerbs
- deleteVerbs
- int getVerbX( verb ), int getVerbY
- 8. Music and sound
-
9. Resources
- loadScript( script ), loadSound( sound ), loadCostume( cost ), loadRoom( room ), loadCharset
- nukeScript( script ), nukeSound( sound ), nukeCostume( cost ), nukeRoom( room ), nukeCharset
- lockScript( script ), lockSound( sound ), lockCostume( cost ), lockRoom
- unlockScript( script ), unlockSound( sound ), unlockCostume( cost ), unlockRoom
- nukeFlObjects
- 10. Game
- 11. Print
- 12. Utils
An almost complete list of the built-in functions in scumm. A couple are still missing as they are not yet usable in ScummC for some reason. Nearly all need a better description.
I renamed many functions compared to the name found in ScummVM and other references in order to bring a little more consistence in the naming schema and make some name more descriptive. Any comments or suggestion is more than welcome.
OP Code: 0×5E
The 2 first bits of flags are used: bit 0 mean freeze resistant, and bit 1 recursive. Freeze resistant mean that the script won’t be freezed by “normal” freezeUnfreeze() calls. If recursive is not set, then any running instance of the script is stopped before the script is started.
OP Code: 0×5F
Same as calling startScript with flags set to 0.
OP Code: 0xBF
Same as calling startScript with flags set to 2.
OP Code: 0×6A
Unfreeze all frozen thread if a == 0. If a < 0×80 it freeze all freezable threads. If a >= 0×80 it freeze all threads including the unfreezable.
Freezing is a nestable operation, a thread which is frozen twice must be thawed twice before it becomes runnable again.
OP Code: 0×6C
Break out of the current script letting other scripts execute.
OP Code: 0xCA
Break a script X times.
OP Code: 0×77
Stop an object script.
OP Code: 0×7C
Stop a script.
OP Code: 0×8B
Check if a script is running.
OP Code: 0xA9A8
Break the current script until the actor stop moving.
OP Code: 0xA9A9
Break the script as long a message is displayed (check VAR_HAVE_MSG).
OP Code: 0xA9AA
Break the current script until the camera finished moving.
OP Code: 0xA9AB
Break the current script until the sentence script is finished.
OP Code: 0xA9E2
Break the current script until the actor animation is finished ??
OP Code: 0×9AE8
Break the current script until the actor finished turning. WARNING: ScummVM have a dirty hack because of some problems in the dig. See scumm/script_v6.cpp for more details. If the actor have an id such that actor % 45 == 0 the hack will kick in and the current actor will be used instead.
OP Code: 0xB0, 0xB1, 0xB2
Break the current script for some times. A tick is 1/60th of a second.
OP Code: 0xB3
Stop the sentence script.
OP Code: 0xC9 [ 0×09 ]
Stop all script except the current one.
OP Code: 0xD5
Stop all running script, then start a new one. flags are the same as for startScript.
OP Code: 0xD8
Check if the verb script from an object owned by the room is running. This opcode is not supported by the LEC interpreter.
OP Code: 0×6B90, 0×6B91
Enable/Disable the mouse cursor.
OP Code: 0×6B92, 0×6B93
Enable/Disable user input.
OP Code: 0×6B94-0×6B97
These are a bit different, they use ++ and — instead of setting to 0 or 1. Dunno what they are good for.
OP Code: 0×6B99
Use the given object as cursor.
OP Code: 0×6B9A
Set the cursor hotspot coordinate.
OP Code: 0×6BD6
Set the transparent color for the cursor.
OP Code: 0×6B9C
Set the charset used for text.
OP Code: 0×6B9D
Set the colormap used for the charset, it need 16 entries.
OP Code: 0×78
Pan the camera to show column x.
OP Code: 0×7A
Set camera to show column x.
OP Code: 0×79
Make the camera automatically follow the given actor.
OP Code: 0xC9 [ 0×04 ]
Set the cursor from a part of the view.
OP Code: 0xC9 [ 0×6E ]
OP Code: 0×7B
Start the given room.
WARNING: In scummvm this function is named loadRoom. However it is clashing with the resource functions. So I renamed this one startRoom which anyway better reflect what it do.
OP Code: 0×85
Load a room then walk the actor to the given object ?? If x is not -1 walk to x, y ??
WARNING: In scummvm this function is named loadRoomWithEgo, I renamed it to match the startRoom() function.
OP Code: 0×99
Set the given flags for on the box listed. The flags are the same as those stored in the BOXD structure. For reference:
- 0×08 : X flip
- 0×10 : Y flip
- 0×20 : Ignore scale / Player only
- 0×40 : Locked
- 0×80 : Invisible
To disable/enable a box blocking/allowing actors to go through it you want to set the Invisible flag. When this is done createBoxMatrix() must be called for the changes to take effect.
OP Code: 0×9A
Recreate the room box matrix of the current room. The box matrix store the point between the box, in other word how to get from box A to box B.
OP Code: 0xC8 [ 0×73 ]
OP Code: 0xC8 [ 0×74 ]
Check if a point is inside a box.
OP Code: 0xC8 [ 0xD7 ]
Get the flags of a box.
OP Code: 0xE4
Switch the room to an alternative box set (or if you like, “path”). This mean room can have several box set, that’s new to me as in 0.6.1 that op code did nothing.
OP Code: 0×9CAF
Set a palette entry.
OP Code: 0×9CB0,0×9CB1
Start, stop the good old shaking effect.
OP Code: 0×9CB3
Equivalent to setRoomRGBIntensity(scale,scale,scale,start,end). This will generally be used to darken the image and such kind of effect.
OP Code: 0×9CB6
Modify the rgb intensity of the palette elements from start to end. The scaling is as follow: newRed = red * rScale / 0xFF.
OP Code: 0×9CB7
Setup the shadow palette. Entries are defined with: r = ((palR/4)*rScale)/256 where palR is the red value of the color in the current palette.
OP Code: 0×9CBA
Do some tricks with palette, dunno what. It seems resID must a palette.
OP Code: 0×9CBB
Set the delay between palette rotation steps.
OP Code: 0×9CD5
Set the current room palette.
OP Code: 0×9CAC
Set the area that will be visible. Internally it just set VAR_CAMERA_MIN_X and VAR_CAMERA_MAX_X but it also clamp their value screenWidth/2 and roomWidth-(screenWidth/2).
OP Code: 0×9CAE
Setup the room image size and position. The height (bottom-top) MUST match the height of the room image otherwise the rendering go havoc.
OP Code: 0×9CB5
Set the effect that will be used on the next room switching. The effect parameter store in fact 2 effect a closing and an opening one. The highest byte define the closing effect and the lowest byte define the opening effect. So for ex. screenEffect(0×8082) would first do the dissolve then the scroll.
- 0×01: box closing effect with the image
- 0×02: new image slide from the top left
- 0×03: new image slide from the bottom right
- 0×04: old image slide to the top left
- 0×05: box opening with the image
- 0×06: new image slide from the left and a bit above
- 0×80: disolve
- 0×81: black screen
- 0×82: scroll from the left
- 0×83: scroll from the right
- 0×84: scroll from the top
- 0×85: scroll from the bottom
- 0×86: fine dissolve
- 0×87: columns dissolve
OP Code: 0xA1
Set the listed pseudo room to point to room. pseudo rooms must be greater or equal to 0×80.
OP Code: 0xC9 [ 0×05 ], 0xC9 [ 0×06 ]
Perform a fade-in or fade-out affect like on room transition.
OP Code: 0xC9 [ 0×6C ]
OP Code: 0xC9 [ 0×70 ]
OP Code: 0xDD
Return an array with all object in the room. ScummVM have a warning if room is not the current room. Dunno why. This OP code is not supported by the LEC interpreter for dott.
OP Code: 0×9CB3
Really dunno what that do.
Note that objects and actors share the same address space. Actors have addresses up to 0xE (0xF is used to represent the room). This mean that some of the following functions are also usable with actors.
OP Code: 0×60
Execute the code attached to an abject verb. Flags are the same as for scripts: bit 0 freeze resistant, bit 1 recursive.
OP Code: 0xBE
Same as calling startObject with flags set to 2.
OP Code: 0×61
Force a redraw. If state is 0 it’s set to 1, probably to be sure it really draw something. Useful for redrawing backgrounds in a credit sequence for example.
OP Code: 0×62
Same as drawObject but at a given position.
OP Code: 0×6D
Check if an object match the given class combination. If the class number is or’d with 0×80 then the object must belong to the class, otherwise it mustn’t belong to it. For ex isObjectOfClass(obj,[ Openable + 128, Pickable ]) will return 1 if the object is Openable and not Pickable. Note that we use + here because the LEC interpreter doesn’t support bitwise or. As classes number only range up to 32 using + is ok anyway.
OP Code: 0×6E
Set the classes an object belong to. As for isObjectOfClass() the highest bit of the classes indicate if the object belong to the class or not. 0 have a special effect it reset the class of the object at the same index (inside the room). That must be checked against the LEC interpreter.
OP Code: 0×6F, 0×70
Get/Set the state of an object.
OP Code: 0×72, 0×71
Get/Set the owner of an object. Owner should be an actor, but can be 0.
OP Code: 0×84
Make VAR_EGO the owner of the object, set the object as untouchable, turn it into state 1 and run the inventory script. It’s generally just what is needed to pick an object from the room.
OP Code: 0×8D, 0×8E
Get the object/actor X or Y coordinate.
OP Code: 0×8F
Get the direction of an object, that is in which direction actors standing in front of it should look.
OP Code: 0×97
Change the name of an object.
OP Code: 0xA0
Find the object at the given position.
OP Code: 0xA3
Return the offset at which the code for the given verb is found. Mostly useful to find out if an object implement a verb or not.
OP Code: 0xC8 [ 0xCF ], 0xC8 [ 0D0 ]
Get the position of an object in the current room.
OP Code: 0xC8 [ 0xD1 ], 0xC8 [ 0D2 ]
Get the size of an object in the current room.
OP Code: 0xC9 [ 0×77 ]
OP Code: 0xCD
Set the object state, optionally setting the object position to x*8,y*8 if x != -1. (might be useful for a “find the object” puzzle?)
OP Code: 0xED
Get the object direction in a “new” format ??
OP Code: 0×9B77
Create an FlObject effectively loading an object from another room in the current one.
OP Code: 0×9DC5
Set an actor as the current one.
OP Code: 0×9D53
Reset the actor and play it’s init anim ??
OP Code: 0×9DD9
Like actorInit() but it directly go to anim 2 (the walk anim by default).
OP Code: 0×9D58
Set the name of the current actor.
OP Code: 0×7D
Make an actor walk to an object. It will go at distance pixel away from the object, where distance is only horizontal.
OP Code: 0×7E
Make an actor walk to the given position.
OP Code: 0×7F
Give an actor a new position. If room == 0xFF, it use the room where the actor currently is.
OP Code: 0×80
Put an actor next to an object, eventually in another room ??
OP Code: 0×81
Make the actor face the given object or actor.
OP Code: 0×9DE5
Stop the current actor and make it stand.
OP Code: 0×9DE6
Set the direction of the current actor.
OP Code: 0×9DE7
Make the actor turn to the given direction. The direction is in degree (0 is north, 90 east, 180 south and 270 west). This doesn’t seems to be supported by the LEC interpreter.
OP Code: 0×9DD7, 0×9DD8
Probably change the way the current actor is turning on himself.
OP Code: 0×9DE9, 0×9DEA
Freeze, unfreeze the current actor.
OP Code: 0×9D4D
Set the walking speed of the current actor. The higher the value the slower it is.
OP Code: 0×8A
Check if the actor is moving ??
OP Code: 0×9D5F
Allow the current actor to go anywhere ??
OP Code: 0×9D60
Force the actor to stay in the boxes.
OP Code: 0xA2, 0×9D54
Get the elevation of the given actor. Set the elevation of the current actor.
OP Code: 0×91, 0×9D4C
Get the costume worn by an actor. Set the costume of the current actor.
OP Code: 0×82
Make the actor play the given anim.
OP Code: 0×9D61
Set the current actor animation speed.
OP Code: 0×9D4F
Change the frame used for the walk anim of the current actor. Default to 2.
OP Code: 0×9D50
Change the frames used for starting, stoping a talking sequence. Default to 4 and 5.
OP Code: 0×9D51
Set the anim used when the current actor is standing. Default to 3 .
OP Code: 0×9D59
Set the anim used when initing the current actor. Default to 1.
OP Code: 0×9D55
Reset the current actor anims to the defaults.
OP Code: 0xD2, 0×9DC6
Get/Set the value of an actor animation variable.
OP Code: 0xAB
Get the actor’s first anim counter. According to ScummVM, this is equivalent to the amount of times “frameSkip()” has been called in the costume.
OP Code: 0×9D4E
Set the sounds used by the costume of the current actor.
OP Code: 0×8C
Get the room in which the actor is present.
OP Code: 0×90
Get the current walk box of the actor.
OP Code: 0×9D56
Remaps the specified color (0-32) in the actors costume palette to room_color. Useful for fixing costume colors and differentiating actors.
OP Code: 0×9D57
Set the color to be used for text said by the current actor.
OP Code: 0xA8, 0×9D5B
Get the actor width. Set the current actor width. Dunno really what’s that for.
OP Code: 0×9D5C
Set the current actor scaling factor.
OP Code: 0×9D5D
Disable z clipping on the current actor.
OP Code: 0×9DE1
Enable / disable z clipping of the current actor.
OP Code: 0×9D62
Set the current actor shadow mode. Dunno what’s that is.
OP Code: 0×9D63
Set the offset to use to place the text of the current actor.
OP Code: 0xEC, 0×9DE3
Get the layer of an actor, set the layer of the current actor.
OP Code: 0×9DE4
Set the walk script for the current actor.
OP Code: 0×9DEB
Set the talk script for the current actor.
OP Code: 0×9F
Get the actor at the given position.
OP Code: 0xAA
Get the X scale factor of the actor.
OP Code: 0xAF
Check if an actor is inside a box.
OP Code: 0xBA
Make the actor (or ego) say something. egoSay(s) is equivalent to actorSay(VAR_EGO,s).
OP Code: 0xC8 [ 0xD4 ]
Get the current frame of an actor.
OP Code: 0xC9 [ 0×6B ]
Set the actor scaling.
OP Code: 0xC9 [ 0×6F ]
OP Code: 0xD1
Stops whichever actor is talking from talking. Note that this wont work in the DOTT interpreter, so instead use:
actorSay(0xFF, "");
OP Code: 0×92
Find the object idx (first, second, etc) in the owner inventory.
OP Code: 0×93
Get the number of objects owned by owner.
OP Code: 0×83
Prepare a sentence. The sentence script is then called with verb, objA and objB as argument. objB might be 0.
OP Code: 0×94
Find the verb at the given coordinate.
OP Code: 0×9EC4
Set the current verb.
OP Code: 0×9E7C
Set the object image to be used with the current verb. The object must be in the resource room. To use object from other rooms use verbSetObject().
OP Code: 0×9E7D
Set the name of the current verb.
OP Code: 0×9E7E
Set the color of the current verb.
OP Code: 0×9E7F
Set the highlight color of the current verb.
OP Code: 0×9E80
Set the position of the current verb.
OP Code: 0×9E81, 0×9E82
Enable, disable the current verb.
OP Code: 0×9E83
Destroy the current verb.
OP Code: 0×9E84
Initialize the current verb.
OP Code: 0×9E85
Set the dimmed color for the current verb.
OP Code: 0×9E86
Set the current verb as dimmed.
OP Code: 0×9E87
Set the key binded to the current verb.
OP Code: 0×9E88
Set the current verb as centered.
OP Code: 0×9E89
Set the current verb name’s from an array. This function need the array address as argument.
OP Code: 0×9E8B
Set the current verb image using an object from any room.
OP Code: 0×9E8C
Set the background color for the current verb.
OP Code: 0×9EFF
Redraw the current verb.
OP Code: 0xA58D
Save/restore the verbs fromVerb to toVerb to/from the given slot. Typically this is used to hide a set of verbs without multiple costly calls to setCurrentVerb().
OP Code: 0xA58E
Destroy a verb save ??
OP Code: 0xC8 [ 0xD5 ], 0xC8 [ 0xD6 ]
Get the position of a verb.
OP Code: 0×69
Stop the background music.
OP Code: 0×74
Plays the given sound resource. The actual sound should be a sound, not a voice.
OP Code: 0×75
Stop the sound (or is the argument something else ?)
OP Code: 0×76
Start the background music.
OP Code: 0×98
Check if the given sound is running ??
OP Code: 0xC9 [ 0×7C ]
OP Code: 0xAC
The main gateway to imuse. This should be abstracted.
loadScript( script ), loadSound( sound ), loadCostume( cost ), loadRoom( room ), loadCharset( chset)
OP Code: 0×9B64-0×9B67, 0×9B75
Ensure that a resource is loaded.
nukeScript( script ), nukeSound( sound ), nukeCostume( cost ), nukeRoom( room ), nukeCharset( chset )
OP Code: 0×9B68-09B6B, 0×9B76
Free a resource.
OP Code: 0×9B6C-0×9B6F
Lock a resource in memory. So it’s still available even after leaving the room.
OP Code: 0×9B70-0×9B73
Unlock a resource.
OP Code: 0xC9 [ 0×68 ]
Destroy the FlObjects with address between first and last.
10. Game
OP Code: 0xAE9E
Restart the game without any confirmation.
OP Code: 0xAE9F
Set the game in paused mode.
OP Code: 0xAEA0
Quit the game without any confirmation.
The print function are available in 6 versions:
- print: 0xB4XX
- cursorPrint: 0xB5XX
- dbgPrint: 0xB6XX
- sysPrint: 0xB7XX
- actorPrint: 0xB8XX
- egoPrint: 0xB9XX
All functions are identical in each variant except actorPrintBegin which take the actor as argument (all other *PrintBegin don’t take any argument. Taking printAt as example the other variant are: cursorPrintAt, dbgPrintAt, sysPrintAt, actorPrintAt and egoPrintAt.
OP Code: 0xXX41
Set the position where a string should be printed.
OP Code: 0xXX42
Set the color in which the string will be printed.
OP Code: 0xXX43
Set some clipping ???
OP Code: 0xXX47
Set the string to be left aligned ??
OP Code: 0xXX45
Set the string to be centered ??
OP Code: 0xXX48
Set the string to be displayed above an actor ??
OP Code: 0xXX4A
The actor saying it will mumble ??
OP Code: 0xXX4B
Print a string.
OP Code: 0xXXFE, 0xXXFF
Start/End a print context.
OP Code: 0×87
Return a random number between 0 and max. VAR_RANDOM_NR is also set with the returned value.
OP Code: 0×88
Return a random number between min and max. Also set VAR_RANDOM_NR.
OP Code: 0xA6
Draw a box on the screen.
OP Code: 0xAD
Check if val exist in the list.
OP Code: 0xC4
Return the absolute value of val.
OP Code: 0xC5
Get the distance between two objects.
OP Code: 0xC6
Get the distance between an object and a point.
OP Code: 0xC7
Get the distance between two points.
OP Code: 0xC8 [ 0×71 ]
Get the value of a pixel from the screen, probably only available in S&M
OP Code: 0xC8 [ 0xCE ]
Get the best matching palette entry for the given RGB value.
OP Code: 0xC8 [ 0xD3 ]
Get the state of a key.
OP Code: 0xC9 [ 0×78 ]
Swap two colors in the palette.
OP Code: 0xC9 [ 0×7B ]
Overwrite a color from the palette with another.
OP Code: 0xCB
Pick element idx in the list. The engine will spit an error if idx is out of range, dunno if that lead to a shutdown, but probably.
OP Code: 0xCC
Like pickOneOf but it return default if idx is out of range.
OP Code: 0xD0
Get the current date and time. The result is set in the following variables: VAR_TIMEDATE_YEAR, VAR_TIMEDATE_MONTH, VAR_TIMEDATE_DAY, VAR_TIMEDATE_HOUR and VAR_TIMEDATE_MINUTE.
OP Code: 0xD4
Shuffle the array element between index min and max.