The Sierra Creative Interpreter

Lars Skovlund

Christoph Reichenbach

Ravi I.

Rickard Lind

Petr Vyhnak

Dark Minister

Francois Boyer

This book describes the Sierra Creative Interpreter, versions 0.xxx and 1.xxx to the extent known to the general public, as well as the FreeSCI interpreter for those games. Please contact the author if you find that anything is being described incorrectly or missing.

Warning

This version of the documentation is incomplete and covers only some parts of SCI0.

Copyright (C) 1999, 2000, 2001 by the authors

Permission is hereby granted, free of charge, to any person obtaining a copy of this documentation to deal in the Documentation without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Documentation, and to permit persons to whom the Documentation is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Documentation.

THE DOCUMENTATION IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DOCUMENTATION OR THE USE OR OTHER DEALINGS IN THE DOCUMENTATION.

The Sierra Creative Interpreter was originally developed by Sierra On-Line, Inc. "Sierra On-Line Inc. (TM)" is a registered trademark of Sierra On-Line, Inc. "Quest for Glory: So You Want To Be A Hero", "Quest For Glory 2: Trial By Fire" and "Space Quest 3: The Pirates of Pestulon" are trademarks of Sierra On-Line, Inc.


Table of Contents
Preface
1. Introduction
The basics
Resource storage
The individual resources: A summary
Graphical resources summarized
Sound resources summarized
Logic resources summarized
SCI01 extensions
SCI1 extensions
Sierra SCI games
SCI0 games
SCI01 games
SCI1.0 games
SCI1.1 games
2. Resource files
SCI0 resources
resource.map
resource.<nr>
SCI1 resources
resource.map
resource.<nr>
Decompression algorithms
Decompression algorithm LZW
Decompression algorithm HUFFMAN
Decompression algorithm COMP3
Decompression algorithm DCL-EXPLODE
Decompression algorithm UNKNOWN
3. The Graphics subsystem
General stuff
SCI Ports
The Cursor resource
Color mapping for the SCI0 mouse pointer
Color mapping for the SCI1 mouse pointer
The SCI0 View Resource
The View Resource
Cell List
Image Cell
The SCI font resource
The SCI0 and SCI01 pic resource
Windows, Dialogs and Controls
Pictures and movement control
4. The Sound subsystem
The SCI0 Sound Resource Format
Preface
Sound Devices
File Format
Revision history
Mapping instruments in FreeSCI
The Patch.002 resource
Percussion instruments
5. The SCI virtual machine
Introduction
Script resources
Selectors
Function invocation
Variable types
Interpreter initialization and the main execution loop
The SCI Heap
Heap structure
Memory handles
Initialization
Memory allocation
The Sierra PMachine
Local variables (LocalVar)
Global variables
Temporary variables
Parameter variables
Objects
The PMachine "registers"
The instruction set
Kernel functions
Parameter types
6. SCI in action
Event handling in SCI
Event types and modifiers
The Parser
Vocabulary file formats
The black box: The magic behind Sierra's text parser
The Parse tree
Said specs
Matching the trees
Views and animation in SCI
List of Tables
2-1. SCI0 compression algorithms
2-2. SCI01 compression algorithms
2-3. SCI1.0 compression algorithms
2-4. SCI1.1 compression algorithms
3-1. The SCI font resource data structure
3-2. The SCI font resource character data structure
6-1. SCI and FreeSCI signal bits
List of Examples
6-1. Parse grammar example
6-2. Parser example
6-3. Semantic tree example