# 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 documentation (one directory per room)
│   ├── kq4-001-beach/             # Beach (starting room)
│   │   ├── 001-beach.md           # Room documentation
│   │   ├── pic_001_visual.png     # Background visual
│   │   ├── pic_001_control.png    # Control (walkable areas)
│   │   └── pic_001_priority.png   # Priority (z-ordering)
│   ├── kq4-002-meadow/            # Meadow (with Satyr/Pan)
│   ├── kq4-010-forest-path/      # Forest Path
│   └── ...                        # One directory per room
├── docs/scripts/                   # Non-room script documentation
│   └── non-room-scripts.md        # Core, region, and interaction scripts
├── 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 '[<around][/room]'`** - "look around" or "look room"

### State Management

Global variables track game state:

| Variable | Purpose |
|----------|---------|
| `gEgo` | Player character object |
| `gRoom` | Current room instance |
| `gPrevRoomNum` | Previous room number |
| `gInv` | Inventory collection |
| `global100` | Unknown flag (weather/time?) |
| `global101` | Room has been visited |
| `global116` | Story progression state |
| `global105` | Multi-path room state |

### Inventory System

Items referenced by index in `gInv at: ##`:

| Index | Item |
|-------|------|
| 1 | Diamonds |
| 17 | Fishing pole |
| ... | (others documented per-room) |

### Message System

Text displayed via `Print scriptNum messageNum`:
- `Print 1 0` = Message 0 from script 1
- Messages stored separately in RESOURCE files
- To be extracted and added to room documentation

### Looking Up Text in the Strings Directory

Message text is extracted and stored in the `strings/` directory:

| File Pattern | Contents |
|--------------|----------|
| `strings/script_XXX_strings.txt` | Script-specific strings (room names, object names) |
| `strings/text_XXX.txt` | In-game dialog and message text |

**To look up a message:**

1. Identify the script number from the `Print` command (e.g., `Print 2 1` = script 2, message 1)
2. Open `strings/text_XXX.txt` where XXX matches the script number
3. Find the entry with the matching message number (e.g., `[0001]`)

**Example:**
```
Print 2 1  →  Look in strings/text_002.txt, line [0001]
Result: "You see a river in the distance to the north."
```

**Note:** Message numbers in the code start from 0 and are displayed in brackets (e.g., `[0001]` = message 1).

## Room Documentation Format

Each room file follows this structure:

```markdown
# Room ##: [Room Name]

## Overview
- **Room Number**: ##
- **Picture**: ###
- **Region**: [Beach/Forest/Castle/etc.]
- **Exits**: North→#, South→#, East→#, West→#

## Objects

### [Object Name]
- **Type**: Prop/View/Actor
- **Position**: (x, y)
- **View**: ### (sprite/animation resource)
- **States**: [list of possible states]

#### Interactions

**Look**:
- Condition: [when visible]
- Text: "Message from game"
- Logic: [simplified state check]

**Use [Item]**:
- Condition: [inventory check]
- Effect: [what happens]
- State Change: [global or local variable changes]

## NPCs

### [Character Name]
- **Type**: Actor
- **Behavior**: [wandering, stationary, scripted]

#### Dialogue
- **Greeting**: [initial interaction]
- **Topics**: [what player can ask about]
- **Conditions**: [when available]

## Scripts

### [Script Name]
- **Trigger**: [what starts it]
- **Steps**: [sequence of actions]
- **State Changes**: [what it modifies]

## Walkthrough Integration

- **Critical Path**: [essential interactions]
- **Optional**: [side content]
- **Deaths**: [ways to die in this room]
```

## Conversion Notes for Point-and-Click

When adapting to a KQ5-style interface (walk, look, hand, talk, inventory):

1. **Walk**: Automated - player clicks destination, character walks there
2. **Look**: Maps to `Said 'look/object'` commands
3. **Hand**: Maps to `Said 'use/object'`, `Said 'take/object'`, `Said 'open/object'`
4. **Talk**: Maps to `Said 'talk/person'` or `Said 'ask/person/about'`
5. **Inventory**: Click item, then click target (replaces `Said 'use/item/on/target'`)

### Simplifications Made

- **Auto-walking**: No manual positioning needed
- **Context-sensitive**: Combine look/take/use based on object type
- **Smart defaults**: Auto-select appropriate verb for known object types
- **Inventory drag**: Drag item to target instead of typing commands

## Message Extraction Status

| Status | Description |
|--------|-------------|
| ⏳ Pending | Text resources not yet extracted from RESOURCE.### files |
| 📝 Documented | Text added to room files |

Text messages referenced as `Print scriptNum messageNum` will be extracted from the game's RESOURCE files and added to each room's documentation.

## Generating Room Visuals

Each room directory contains rendered PNG images of the game's PIC resources:

### Using sci_pic_render

```bash
./sci_pic_render <room_number> "<path_to_game>" <output_directory>
```

**Example:**
```bash
./sci_pic_render 1 "King's Quest IV - The Perils of Rosella (1988)/KQ4" rooms/kq4-001-beach
```

This generates three PNG files in the room directory:
- `pic_###_visual.png` - The background visual
- `pic_###_control.png` - Control (walkable areas)
- `pic_###_priority.png` - Priority (z-ordering)

### Directory Structure

```
rooms/
├── kq4-001-beach/
│   ├── 001-beach.md           # Room documentation
│   ├── pic_001_visual.png    # Background
│   ├── pic_001_control.png   # Walkable areas
│   └── pic_001_priority.png  # Z-ordering
└── kq4-010-forest-path/
    └── ...
```

## Contributing

When adding room documentation:

1. Read the corresponding `rm##.sc` file
2. Document all `handleEvent` interactions
3. Note all Props, Views, and Actors
4. Track state dependencies (global variables)
5. Include original text when available
6. Describe simplified logic for point-and-click adaptation

## Progress

| Room Number | Room Description | Status |
|-------------|------------------|--------|
| 001 | Beach  | ![pic_001_visual.png](./rooms/kq4-001-beach/pic_001_visual.png) [DONE](./rooms/kq4-001-beach/001-beach.md) |
| 002 | Meadow (with Satyr/Pan)  | ![pic_002_visual.png](./rooms/kq4-002-meadow/pic_002_visual.png) [DONE](./rooms/kq4-002-meadow/kq4-002-meadow.md) |
| 003 | Fountain Pool  | ![pic_003_visual.png](./rooms/kq4-003-fountain-pool/pic_003_visual.png) [DONE](./rooms/kq4-003-fountain-pool/kq4-003-fountain-pool.md) |
| 004 | Ogre's Cottage Exterior  | ![pic_004_visual.png](./rooms/kq4-004-ogres-cottage/pic_004_visual.png) [DONE](./rooms/kq4-004-ogres-cottage/kq4-004-ogres-cottage.md) |
| 005 | Forest Grove  | ![pic_005_visual.png](./rooms/kq4-005-forest-grove/pic_005_visual.png) [DONE](./rooms/kq4-005-forest-grove/kq4-005-forest-grove.md) |
| 006 | Cave Entrance  | ![pic_006_visual.png](./rooms/kq4-006-cave-entrance/pic_006_visual.png) [DONE](./rooms/kq4-006-cave-entrance/kq4-006-cave-entrance.md) |
| 007 | Fisherman's Shack Exterior  | ![pic_007_visual.png](./rooms/kq4-007-fishermans-shack/pic_007_visual.png) [DONE](./rooms/kq4-007-fishermans-shack/kq4-007-fishermans-shack.md) |
| 008 | Back of Fisherman's Shack  | ![pic_008_visual.png](./rooms/kq4-008-back-of-fishermans-shack/pic_008_visual.png) [DONE](./rooms/kq4-008-back-of-fishermans-shack/kq4-008-back-of-fishermans-shack.md) |
| 009 | Shady Wooded Area  | ![pic_009_visual.png](./rooms/kq4-009-shady-wooded-area/pic_009_visual.png) [DONE](./rooms/kq4-009-shady-wooded-area/kq4-009-shady-wooded-area.md) |
| 010 | Forest Path  | ![pic_010_visual.png](./rooms/kq4-010-forest-path/pic_010_visual.png) [DONE](./rooms/kq4-010-forest-path/kq4-010-forest-path.md) |
| 011 | Enchanted Grove  | ![pic_011_visual.png](./rooms/kq4-011-enchanted-grove/pic_011_visual.png) [DONE](./rooms/kq4-011-enchanted-grove/kq4-011-enchanted-grove.md) |
| 012 | Haunted Forest  | ![pic_012_visual.png](./rooms/kq4-012-haunted-forest/pic_012_visual.png) [DONE](./rooms/kq4-012-haunted-forest/kq4-012-haunted-forest.md) |
| 013 | Beach  | ![pic_013_visual.png](./rooms/kq4-013-beach/pic_013_visual.png) [DONE](./rooms/kq4-013-beach/kq4-013-beach.md) |
| 014 | Green Meadow  | ![pic_014_visual.png](./rooms/kq4-014-green-meadow/pic_014_visual.png) [DONE](./rooms/kq4-014-green-meadow/kq4-014-green-meadow.md) |
| 015 | The Frog Pond  | ![pic_015_visual.png](./rooms/kq4-015-frog-pond/pic_015_visual.png) [DONE](./rooms/kq4-015-frog-pond/kq4-015-frog-pond.md) |
| 016 | Graveyard  | ![pic_016_visual.png](./rooms/kq4-016-graveyard/pic_016_visual.png) [DONE](./rooms/kq4-016-graveyard/kq4-016-graveyard.md) |
| 017 | Spooky House Exterior  | ![pic_017_visual.png](./rooms/kq4-017-spooky-house-exterior/pic_017_visual.png) [DONE](./rooms/kq4-017-spooky-house-exterior/kq4-017-spooky-house-exterior.md) |
| 018 | Cemetery  | ![pic_018_visual.png](./rooms/kq4-018-cemetery/pic_018_visual.png) [DONE](./rooms/kq4-018-cemetery/kq4-018-cemetery.md) |
| 019 | Coastal Cliffs  | ![pic_019_visual.png](./rooms/kq4-019-coastal-cliffs/pic_019_visual.png) [DONE](./rooms/kq4-019-coastal-cliffs/kq4-019-coastal-cliffs.md) |
| 020 | Meadow  | ![pic_020_visual.png](./rooms/kq4-020-meadow/pic_020_visual.png) [DONE](./rooms/kq4-020-meadow/kq4-020-meadow.md) |
| 021 | Bridge Over Stream  | ![pic_021_visual.png](./rooms/kq4-021-bridge-over-stream/pic_021_visual.png) [DONE](./rooms/kq4-021-bridge-over-stream/kq4-021-bridge-over-stream.md) |
| 022 | Gnome's Cottage  | ![pic_022_visual.png](./rooms/kq4-022-gnomes-cottage/pic_022_visual.png) [DONE](./rooms/kq4-022-gnomes-cottage/kq4-022-gnomes-cottage.md) |
| 023 | Forest Path with Cottage  | ![pic_023_visual.png](./rooms/kq4-023-forest-path-with-cottage/pic_023_visual.png) [DONE](./rooms/kq4-023-forest-path-with-cottage/kq4-023-forest-path-with-cottage.md) |
| 024 | Waterfall and Pool  | ![pic_024_visual.png](./rooms/kq4-024-waterfall-and-pool/pic_024_visual.png) [DONE](./rooms/kq4-024-waterfall-and-pool/024-waterfall-and-pool.md) |
| 025 | Beach at River Delta  | ![pic_025_visual.png](./rooms/kq4-025-beach-at-river-delta/pic_025_visual.png) [DONE](./rooms/kq4-025-beach-at-river-delta/kq4-025-beach-at-river-delta.md) |
| 026 | River Meadow  | ![pic_026_visual.png](./rooms/kq4-026-river-meadow/pic_026_visual.png) [DONE](./rooms/kq4-026-river-meadow/kq4-026-river-meadow.md) |
| 027 | Forest Path  | ![pic_027_visual.png](./rooms/kq4-027-forest-path/pic_027_visual.png) [DONE](./rooms/kq4-027-forest-path/kq4-027-forest-path.md) |
| 028 | Mine Entrance  | ![pic_028_visual.png](./rooms/kq4-028-mine-entrance/pic_028_visual.png) [DONE](./rooms/kq4-028-mine-entrance/kq4-028-mine-entrance.md) |
| 029 | Dense Forest  | ![pic_029_visual.png](./rooms/kq4-029-dense-forest/pic_029_visual.png) [DONE](./rooms/kq4-029-dense-forest/kq4-029-dense-forest.md) |
| 030 | Mountain Pass  | ![pic_030_visual.png](./rooms/kq4-030-mountain-pass/pic_030_visual.png) [DONE](./rooms/kq4-030-mountain-pass/kq4-030-mountain-pass.md) |
| 031 | Open Ocean  | ![pic_031_visual.png](./rooms/kq4-031-open-ocean/pic_031_visual.png) [DONE](./rooms/kq4-031-open-ocean/kq4-031-open-ocean.md) |
| 032 | Ocean Near Island  | ![pic_032_visual.png](./rooms/kq4-032-ocean-near-island/pic_032_visual.png) [DONE](./rooms/kq4-032-ocean-near-island/kq4-032-ocean-near-island.md) |
| 033 | Enchanted Island Beach  | ![pic_033_visual.png](./rooms/kq4-033-enchanted-island-beach/pic_033_visual.png) [DONE](./rooms/kq4-033-enchanted-island-beach/kq4-033-enchanted-island-beach.md) |
| 034 | Island Beach  | ![pic_034_visual.png](./rooms/kq4-034-island-beach/pic_034_visual.png) [DONE](./rooms/kq4-034-island-beach/kq4-034-island-beach.md) |
| 035 | Island Beach  | ![pic_035_visual.png](./rooms/kq4-035-island-beach/pic_035_visual.png) [DONE](./rooms/kq4-035-island-beach/kq4-035-island-beach.md) |
| 036 | Island Garden Pond  | ![pic_036_visual.png](./rooms/kq4-036-island-garden-pond/pic_036_visual.png) [DONE](./rooms/kq4-036-island-garden-pond/kq4-036-island-garden-pond.md) |
| 037 | Fairy Island  | ![pic_037_visual.png](./rooms/kq4-037-fairy-island/pic_037_visual.png) [DONE](./rooms/kq4-037-fairy-island/kq4-037-fairy-island.md) |
| 038 | Island Garden  | ![pic_038_visual.png](./rooms/kq4-038-island-garden/pic_038_visual.png) [DONE](./rooms/kq4-038-island-garden/kq4-038-island-garden.md) |
| 039 | Island Beach  | ![pic_039_visual.png](./rooms/kq4-039-island-beach/pic_039_visual.png) [DONE](./rooms/kq4-039-island-beach/kq4-039-island-beach.md) |
| 040 | Island Beach (East)  | ![pic_040_visual.png](./rooms/kq4-040-island-beach-east/pic_040_visual.png) [DONE](./rooms/kq4-040-island-beach-east/kq4-040-island-beach-east.md) |
| 041 | Island Shore  | ![pic_041_visual.png](./rooms/kq4-041-island-shore/pic_041_visual.png) [DONE](./rooms/kq4-041-island-shore/kq4-041-island-shore.md) |
| 042 | Fisherman's Cottage Interior  | ![pic_042_visual.png](./rooms/kq4-042-fishermans-shack-inside/pic_042_visual.png) [DONE](./rooms/kq4-042-fishermans-shack-inside/kq4-042-fishermans-shack-inside.md) |
| 043 | Desert Island  | ![pic_043_visual.png](./rooms/kq4-043-desert-island/pic_043_visual.png) [DONE](./rooms/kq4-043-desert-island/kq4-043-desert-island.md) |
| 044 | Inside Whale  | ![pic_044_visual.png](./rooms/kq4-044-inside-whale/pic_044_visual.png) [DONE](./rooms/kq4-044-inside-whale/kq4-044-inside-whale.md) |
| 045 | Genesta's Bed Chamber  | ![pic_045_visual.png](./rooms/kq4-045-genestas-bed-chamber/pic_045_visual.png) [DONE](./rooms/kq4-045-genestas-bed-chamber/kq4-045-genestas-bed-chamber.md) |
| 046 | Tower Stairway  | ![pic_046_visual.png](./rooms/kq4-046-tower-stairway/pic_046_visual.png) [DONE](./rooms/kq4-046-tower-stairway/kq4-046-tower-stairway.md) |
| 047 | Genesta's Palace Entry Hall  | ![pic_047_visual.png](./rooms/kq4-047-genestas-palace-entry-hall/pic_047_visual.png) [DONE](./rooms/kq4-047-genestas-palace-entry-hall/kq4-047-genestas-palace-entry-hall.md) |
| 048 | Ogre's Bedroom  | ![pic_048_visual.png](./rooms/kq4-048-ogres-bedroom/pic_048_visual.png) [DONE](./rooms/kq4-048-ogres-bedroom/kq4-048-ogres-bedroom.md) |
| 049 | Ogre's Cottage  | ![pic_049_visual.png](./rooms/kq4-049-ogres-cottage/pic_049_visual.png) [DONE](./rooms/kq4-049-ogres-cottage/kq4-049-ogres-cottage.md) |
| 050 | Ogress's Kitchen  | ![pic_050_visual.png](./rooms/kq4-050-ogress-kitchen/pic_050_visual.png) [DONE](./rooms/kq4-050-ogress-kitchen/kq4-050-ogress-kitchen.md) |
| 051 | Ogre's Closet  | ![pic_051_visual.png](./rooms/kq4-051-ogres-closet/pic_051_visual.png) [DONE](./rooms/kq4-051-ogres-closet/kq4-051-ogres-closet.md) |
| 052 | | N/A (doesn't exist) |
| 053 | Seven Dwarfs' Bedroom  | ![pic_053_visual.png](./rooms/kq4-053-seven-dwarfs-bedroom/pic_053_visual.png) [DONE](./rooms/kq4-053-seven-dwarfs-bedroom/kq4-053-seven-dwarfs-bedroom.md) |
| 054 | Seven Dwarfs' Cottage  | ![pic_054_visual.png](./rooms/kq4-054-seven-dwarfs-cottage/pic_054_visual.png) [DONE](./rooms/kq4-054-seven-dwarfs-cottage/kq4-054-seven-dwarfs-cottage.md) |
| 055 | Seven Dwarfs Diamond Mine  | ![pic_055_visual.png](./rooms/kq4-055-seven-dwarfs-diamond-mine/pic_055_visual.png) [DONE](./rooms/kq4-055-seven-dwarfs-diamond-mine/055-seven-dwarfs-diamond-mine.md) |
| 056 | Seven Dwarfs' Diamond Mine (West)  | ![pic_056_visual.png](./rooms/kq4-056-seven-dwarfs-diamond-mine-west/pic_056_visual.png) [DONE](./rooms/kq4-056-seven-dwarfs-diamond-mine-west/kq4-056-seven-dwarfs-diamond-mine-west.md) |
| 057 | Witches' Cave  | ![pic_057_visual.png](./rooms/kq4-057-witch-cave/pic_057_visual.png) [DONE](./rooms/kq4-057-witch-cave/57-witch-cave.md) |
| 058 | Tower Organ Room  | ![pic_058_visual.png](./rooms/kq4-058-tower-organ-room/pic_058_visual.png) [DONE](./rooms/kq4-058-tower-organ-room/kq4-058-tower-organ-room.md) |
| 059 | Baby Nursery  | ![pic_059_visual.png](./rooms/kq4-059-baby-nursery/pic_059_visual.png) [DONE](./rooms/kq4-059-baby-nursery/kq4-059-baby-nursery.md) |
| 060 | Bedroom  | ![pic_060_visual.png](./rooms/kq4-060-bedroom/pic_060_visual.png) [DONE](./rooms/kq4-060-bedroom/kq4-060-bedroom.md) |
| 061 | Tower Stairs  | ![pic_061_visual.png](./rooms/kq4-061-tower-stairs/pic_061_visual.png) [DONE](./rooms/kq4-061-tower-stairs/kq4-061-tower-stairs.md) |
| 062 | Bedroom  | ![pic_062_visual.png](./rooms/kq4-062-bedroom/pic_062_visual.png) [DONE](./rooms/kq4-062-bedroom/kq4-062-bedroom.md) |
| 063 | Attic  | ![pic_063_visual.png](./rooms/kq4-063-attic/pic_063_visual.png) [DONE](./rooms/kq4-063-attic/kq4-063-attic.md) |
| 064 | Old Dining Room  | ![pic_064_visual.png](./rooms/kq4-064-old-dining-room/pic_064_visual.png) [DONE](./rooms/kq4-064-old-dining-room/kq4-064-old-dining-room.md) |
| 065 | Old Kitchen  | ![pic_065_visual.png](./rooms/kq4-065-old-kitchen/pic_065_visual.png) [DONE](./rooms/kq4-065-old-kitchen/kq4-065-old-kitchen.md) |
| 066 | Secret Tower  | ![pic_066_visual.png](./rooms/kq4-066-secret-tower/pic_066_visual.png) [DONE](./rooms/kq4-066-secret-tower/kq4-066-secret-tower.md) |
| 067 | The Parlor  | ![pic_067_visual.png](./rooms/kq4-067-the-parlor/pic_067_visual.png) [DONE](./rooms/kq4-067-the-parlor/kq4-067-the-parlor.md) |
| 068 | The Foyer  | ![pic_068_visual.png](./rooms/kq4-068-the-foyer/pic_068_visual.png) [DONE](./rooms/kq4-068-the-foyer/kq4-068-the-foyer.md) |
| 069 | The Crypt  | ![pic_069_visual.png](./rooms/kq4-069-the-crypt/pic_069_visual.png) [DONE](./rooms/kq4-069-the-crypt/kq4-069-the-crypt.md) |
| 070 | Waterfall Cave  | ![pic_070_visual.png](./rooms/kq4-070-waterfall-cave/pic_070_visual.png) [DONE](./rooms/kq4-070-waterfall-cave/070-waterfall-cave.md) |
| 071 | Cave Entrance  | ![pic_071_visual.png](./rooms/kq4-071-cave-entrance/pic_071_visual.png) [DONE](./rooms/kq4-071-cave-entrance/kq4-071-cave-entrance.md) |
| 072 | Dark Cave Passage  | ![pic_072_visual.png](./rooms/kq4-072-dark-cave-passage/pic_072_visual.png) [DONE](./rooms/kq4-072-dark-cave-passage/kq4-072-dark-cave-passage.md) |
| 073 | Cave Exit  | ![pic_073_visual.png](./rooms/kq4-073-cave-exit/pic_073_visual.png) [DONE](./rooms/kq4-073-cave-exit/kq4-073-cave-exit.md) |
| 074 | Troll Cave  | ![pic_074_visual.png](./rooms/kq4-074-troll-cave/pic_074_visual.png) [DONE](./rooms/kq4-074-troll-cave/kq4-074-troll-cave.md) |
| 075 | Troll Cave Passage  | ![pic_075_visual.png](./rooms/kq4-075-troll-cave-passage/pic_075_visual.png) [DONE](./rooms/kq4-075-troll-cave-passage/kq4-075-troll-cave-passage.md) |
| 076 | Dark Chasm  | ![pic_076_visual.png](./rooms/kq4-076-dark-chasm/pic_076_visual.png) [DONE](./rooms/kq4-076-dark-chasm/kq4-076-dark-chasm.md) |
| 077 | Swamp  | ![pic_077_visual.png](./rooms/kq4-077-swamp/pic_077_visual.png) [DONE](./rooms/kq4-077-swamp/kq4-077-swamp.md) |
| 078 | Swamp Island  | ![pic_078_visual.png](./rooms/kq4-078-swamp-island/pic_078_visual.png) [DONE](./rooms/kq4-078-swamp-island/kq4-078-swamp-island.md) |
| 079 | Mountain Path to Dark Castle  | ![pic_079_visual.png](./rooms/kq4-079-mountain-path-to-dark-castle/pic_079_visual.png) [DONE](./rooms/kq4-079-mountain-path-to-dark-castle/kq4-079-mountain-path-to-dark-castle.md) |
| 080 | Lolotte's Castle Entrance  | ![pic_080_visual.png](./rooms/kq4-080-lolottes-castle-entrance/pic_080_visual.png) [DONE](./rooms/kq4-080-lolottes-castle-entrance/kq4-080-lolottes-castle-entrance.md) |
| 081 | Edgar's Tower Bedroom  | ![pic_081_visual.png](./rooms/kq4-081-edgars-tower-bedroom/pic_081_visual.png) [DONE](./rooms/kq4-081-edgars-tower-bedroom/kq4-081-edgars-tower-bedroom.md) |
| 082 | Lolotte's Tower Bedroom  | ![pic_082_visual.png](./rooms/kq4-082-lolottes-tower-bedroom/pic_082_visual.png) [DONE](./rooms/kq4-082-lolottes-tower-bedroom/kq4-082-lolottes-tower-bedroom.md) |
| 083 | Castle Dungeon Cell  | ![pic_083_visual.png](./rooms/kq4-083-castle-dungeon-cell/pic_083_visual.png) [DONE](./rooms/kq4-083-castle-dungeon-cell/kq4-083-castle-dungeon-cell.md) |
| 084 | Cottage Front  | ![pic_084_visual.png](./rooms/kq4-084-cottage-front/pic_084_visual.png) [DONE](./rooms/kq4-084-cottage-front/kq4-084-cottage-front.md) |
| 085 | Dark Tower Stairs  | ![pic_085_visual.png](./rooms/kq4-085-dark-tower-stairs/pic_085_visual.png) [DONE](./rooms/kq4-085-dark-tower-stairs/kq4-085-dark-tower-stairs.md) |
| 086 | Dim Hallway (West End)  | ![pic_086_visual.png](./rooms/kq4-086-dim-hallway-west-end/pic_086_visual.png) [DONE](./rooms/kq4-086-dim-hallway-west-end/kq4-086-dim-hallway-west-end.md) |
| 087 | East End of Hallway  | ![pic_087_visual.png](./rooms/kq4-087-east-end-of-hallway/pic_087_visual.png) [DONE](./rooms/kq4-087-east-end-of-hallway/kq4-087-east-end-of-hallway.md) |
| 088 | Stone Tower Stairs  | ![pic_088_visual.png](./rooms/kq4-088-stone-tower-stairs/pic_088_visual.png) [DONE](./rooms/kq4-088-stone-tower-stairs/kq4-088-stone-tower-stairs.md) |
| 089 | Castle Kitchen  | ![pic_089_visual.png](./rooms/kq4-089-castle-kitchen/pic_089_visual.png) [DONE](./rooms/kq4-089-castle-kitchen/kq4-089-castle-kitchen.md) |
| 090 | West Tower Bottom  | ![pic_090_visual.png](./rooms/kq4-090-west-tower-bottom/pic_090_visual.png) [DONE](./rooms/kq4-090-west-tower-bottom/kq4-090-west-tower-bottom.md) |
| 091 | Castle Dining Room  | ![pic_091_visual.png](./rooms/kq4-091-castle-dining-room/pic_091_visual.png) [DONE](./rooms/kq4-091-castle-dining-room/kq4-091-castle-dining-room.md) |
| 092 | Lolotte's Throne Room  | ![pic_092_visual.png](./rooms/kq4-092-lolottes-throne-room/pic_092_visual.png) [DONE](./rooms/kq4-092-lolottes-throne-room/kq4-092-lolottes-throne-room.md) |
| 093 | Bottom of East Tower  | ![pic_093_visual.png](./rooms/kq4-093-bottom-of-east-tower/pic_093_visual.png) [DONE](./rooms/kq4-093-bottom-of-east-tower/kq4-093-bottom-of-east-tower.md) |
| 094 | Unicorn Stable  | ![pic_094_visual.png](./rooms/kq4-094-unicorn-stable/pic_094_visual.png) [DONE](./rooms/kq4-094-unicorn-stable/kq4-094-unicorn-stable.md) |
| 095 | Fisherman's Pier  | ![pic_095_visual.png](./rooms/kq4-095-fishermans-pier/pic_095_visual.png) [DONE](./rooms/kq4-095-fishermans-pier/kq4-095-fishermans-pier.md) |
| 096 | | N/A (doesn't exist) |
| 097 | | N/A (doesn't exist) |
| 098 | Transitional Room  | [DONE](./rooms/kq4-098-transitional-room/kq4-098-transitional-room.md) |
| 099 | Transitional Room  | [DONE](./rooms/kq4-099-transitional-room/kq4-099-transitional-room.md) |

## Non-Room Scripts

In addition to room-specific documentation, this project also documents the game's non-room scripts including core system scripts, region scripts, and interaction scripts.

| Category | Description | Documentation |
|----------|-------------|---------------|
| Core System | Main.sc, Game.sc, Feature.sc, InvI.sc, Sound.sc, etc. | [Non-Room Scripts](./docs/scripts/non-room-scripts.md) |
| Region Scripts | BeachReg.sc, Forest Region.sc, GhostWander.sc, etc. | [Non-Room Scripts](./docs/scripts/non-room-scripts.md) |
| Interaction Scripts | PlayFlute.sc, ShootBow.sc, ReadBook.sc, etc. | [Non-Room Scripts](./docs/scripts/non-room-scripts.md) |
| Special/Cutscene | Intro.sc, CopyProtect.sc, EndMusic.sc | [Non-Room Scripts](./docs/scripts/non-room-scripts.md) |

## Credits

- **Original Game**: Sierra On-Line (1988)
- **Decompilation**: Unknown decompiler tools
- **Source Code**: King's Quest IV v1.006.004
- **Documentation**: Created for remake project

## License

This documentation is for educational and preservation purposes. King's Quest IV is a trademark of Sierra On-Line/Activision.
