SCI/Specifications/Graphics/Kernel calls
Kernel calls
Palette syscall
The subfunctions listed here are for version 1.001.029; the subfunction indices are given in figure 3.3. Palette ranges are closed intervals. The functions are described in detail below.
Subfunctions of the Palette syscall:
- (Palette PAL LOAD PALETTE number mode)
- Loads the palette resource given by number and makes it the current global palette. The exact semantics depend on the mode parameter, see section 3.10.
- (Palette PAL SET FLAGS first last bit)
- For the range of palette entries givem by first and last, sets the given bit(s) in the palette flags (using the binary OR operator).
- (Palette PAL CLEAR FLAGS first last bit)
- For the range of palette entries givem by first and last, sets the given bit(s) in the palette flags (using the binary NAND operator).
- (Palette PAL SET BRIGHTNESS first last brightness defer)
- For the range of palette entries given by first and last, sets the brightness (measured in percent) to brightness. The defer flag, if given, tells SCI whether to defer the changes until later. If the parameter is not given, the changes are always committed immediately.
- (Palette PAL CLOSEST RGB r g b)
- Finds the palette entry that matches the given rgb triple most closely. Infinite tolerance is used – new palette entries are never created.
Returns: The index of the matching palette entry.
- (Palette PAL CYCLE first last speed ...)
- Cycles the given range(s) of palette entries once. The speed parameter can be used to control the cycling as follows: The interpreter remembers each active cycling range, and stores a timestamp for each of them. We only cycle a particular range if at least speed game ticks have passed since the last time we did so. The interpreter is responsible for aging the active cycles and eventually getting rid of them.
An arbitrary number of arguments can be given in groups of three. The given cycles are performed sequentially. A negative speed indicates reverse cycling (but the function as a speed setting still applies).
Figure 3.3 Subfunction indices of the Palette() kernel call
Subfunction | Index |
PAL_LOAD_PALETTE | 1 |
PAL_SET_FLAGS | 2 |
PAL_CLEAR_FLAGS | 3 |
PAL_SET_BRIGHTNESS | 4 |
PAL_CLOSEST_RGB | 5 |
PAL_CYCLE | 6 |
PAL_SAVE_PALETTE | 7 |
PAL_RESTORE_PALETTE | 8 |
- (Palette PAL SAVE PALETTE)
- Allocates memory for a palette and stores a snapshot of the global palette in it (including brightness values). The memory may be released either by using the PAL RESTORE PALETTE subfunction or the Memory kernel call.
Returns: A pointer to the allocated memory block
- (Palette PAL RESTORE PALETTE handle)
- Restores the contents of a palette handle and implicitly frees the associated memory.