# King's Quest IV: The Perils of Rosella - Interaction Documentation A comprehensive documentation of all game interactions extracted from the decompiled SCI (Sierra's Creative Interpreter) source code. This project documents the logic, conditions, state changes, and dependencies for recreating King's Quest IV as a modern point-and-click adventure. ## Repository Structure ``` / ├── rooms/ # Room-specific interaction documentation │ ├── kq4-001.md # Beach (starting room) │ ├── kq4-002.md # Beach continuation │ ├── kq4-007.md # Fisherman's shack exterior │ ├── kq4-042.md # Fisherman's cottage interior │ └── ... # One file per room ├── KQ4_v1.006.004_int0.000.502_SRC_(6)/ │ └── src/ # Decompiled SCI scripts │ ├── Main.sc # Game engine & global handlers │ ├── Game.sc # Core game classes │ ├── Feature.sc # Object interaction framework │ ├── InvI.sc # Inventory system │ ├── rm1.sc - rm99.sc # Room scripts │ └── *.sc # Various utility scripts └── README.md # This file ``` ## Source Code Overview ### File Types - **`.sc` files**: Sierra Script source code (main logic) - **`.sco` files**: Compiled script object files (not human-readable) - **`game.sh`**: Header file with game constants and defines ### Key Source Files | File | Purpose | |------|---------| | `Main.sc` | Global game state, inventory, death handlers, sound management | | `Game.sc` | Core Game class, save/load system, event handling | | `Feature.sc` | Base classes for interactive objects (Feature, View, Actor) | | `InvI.sc` | Inventory item definitions and display logic | | `Class_255_0.sc` | Low-level system procedures and kernel functions | | `rm##.sc` | Individual room scripts (rooms 1-99) | | `*Reg.sc` | Region scripts (shared logic for multiple rooms) | ### Room Script Anatomy Each room script (`rm##.sc`) typically contains: ``` Room## of Rm # Room class definition ├── Properties │ └── picture # Background image number ├── Methods │ ├── init() # Room initialization │ │ ├── north/south/east/west # Exit directions │ │ ├── horizon # Walkable area boundary │ │ ├── setRegions: # Apply shared region logic │ │ ├── Props/Actors/Views # Interactive objects │ │ └── gEgo positioning # Player start position │ ├── doit() # Per-frame logic (rarely used) │ ├── handleEvent() # Text parser input handling │ └── dispose() # Cleanup when leaving room └── Instances ├── Scripts # Multi-step sequences ├── Props # Animated objects ├── Views # Static scenery └── Sounds # Audio effects ``` ## Game Systems ### Parser Commands The original game uses a text parser with verb-noun structure: - **`Said 'look/grass'`** - Player typed "look at grass" - **`Said 'use/key'`** - Player typed "use key" - **`Said 'take/diamond'`** - Player typed "take diamond" - **`Said '[