Skip to content

SCUMM 8 API: Rooms

Paul Nicholas edited this page May 2, 2017 · 5 revisions

Each screen that the user sees is a Room in SCUMM-8. This can be a room in the traditional sense, such as a hallway or bedroom - or it can be an exterior scene. Rooms can even be used to simulate "title" screens and special effects. A Room is basically just a backdrop image that can contain other stuff.

Room Definitions

Properties

The following properties apply to Room definitions.

  • map

    • The x1,y1 (top-left cell pos) and x2,y2 (bottom-right cell pos) of the map that should be used as the room.
      For example: map = {80,24,103,31}
  • trans_col

    • The color to draw as transparent (defaults to 0 = black)
  • col_replace

    • Allows you to specify an alternative color to one originally in room/object/actor sprites. Useful for reusing existing content.
    • For example: col_replace = {5,2}
  • lighting

    • Specifies the lighting level to use for a given room/object/actor, from 1=Normal to 0=black (default = 1).
    • For example: lighting = 0.75

Objects (list)

Specifies the list of objects (variables) that should exist in this room. If objects are not added to a Rooms objects list, they will not be drawn.

For example:

objects = {
  obj_library_door_hall,
  obj_lightswitch,
  obj_fire
},

Enter (func)

If specified, the code within the enter function will be executed every time the room is "entered". Therefore, if you only want the code run once, you'll need to set a flag and check for it.

For example:

enter = function(me)
  -- animate fireplace
  start_script(me.scripts.anim_fire, true) -- bg script
end,

Exit (func)

If specified, the code within the exit function will be executed every time the room is "exited". Therefore, if you only want the code run once, you'll need to set a flag and check for it.

For example:

exit = function(me)
  -- pause fireplace while not in room (to save cpu)
  stop_script(me.scripts.anim_fire)
end,
Clone this wiki locally