# Room 12: Haunted Forest

This is the eastern section of the Haunted Forest in King's Quest IV, featuring a bizarre group of scary, human-like trees. The room continues the dangerous tree-grabbing mechanic from room 11, with multiple animated tree props (views 690-696) positioned throughout the forest that can capture Rosella when she gets too close to their reaching branches. Steep mountains block the eastern exit. The room connects to other forest areas and serves as a hazard area with tree-grabbing traps.

## Look Description

"You have come upon a bizarre group of scary, human-like trees. A thick forest of pine trees surrounds this strange group. Steep mountains block your way to the east."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look` / `look around` / `look room` / `look[<at][/forest,forest]` | "You have come upon a bizarre group of scary, human-like trees. A thick forest of pine trees surrounds this strange group. Steep mountains block your way to the east." (Print 12 0) |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | grabbed | Player touches control areas (bitmasks $0010, $0020, $0040, $0080, $2000, $1000, $0800, $0400, $0200, $0100, $0004, $0008) anywhere in the room | Stops walking music, plays caught music, animates a tree grabbing the ego (using newProp_6 array based on control area), displays random tree-themed death message (wooden/limb/leaf/sap/root puns), sets global127=1 (game over state). Multiple control areas correspond to different tree props that grab the player. |
| TODO | Background | treeAnimation | Continuous when room loaded | Trees (newProp_6 1-12) are static props with cycleSpeed=1 but stopUpd called, except animated elements (newProp through newProp_5) have setCycle:Fwd for continuous animation |

## Technical Notes

- **Room Number**: 12
- **Picture**: 12
- **Region**: 509 (Forest Region), 511 (referenced but not found)
- **Exits**: North→6, South→18, West→11
- **Music**: Walking music (sound 64), Caught music (sound 65)

### Objects

| Object | View | Loop | Description |
|--------|------|------|-------------|
| newProp | 688 | 0 | Animated element at 265,97 - cel 3 |
| newProp_2 | 688 | 1 | Animated element at 12,59 - cel 4 |
| newProp_3 | 688 | 2 | Animated element at 210,64 - cel 1 |
| newProp_4 | 688 | 3 | Animated element at 154,86 - cel 4 |
| newProp_5 | 688 | 4 | Animated element at 98,107 - cel 4 |
| newProp_6[1] | 695 | 0 | Tree at 29,53 |
| newProp_6[2] | 695 | 1 | Tree at 57,61 |
| newProp_6[3] | 695 | 2 | Tree at 77,60 |
| newProp_6[4] | 695 | 3 | Tree at 147,85 |
| newProp_6[5] | 695 | 4 | Tree at 161,87 |
| newProp_6[6] | 692 | 4 | Tree at 121,69 |
| newProp_6[7] | 696 | 0 | Tree at 206,75 |
| newProp_6[8] | 696 | 1 | Tree at 21,63 |
| newProp_6[9] | 696 | 2 | Tree at 98,124 |
| newProp_6[10] | 694 | 1 | Tree at 231,82 |
| newProp_6[11] | 693 | 2 | Tree at 6,85 |
| newProp_6[12] | 690 | 0 | Tree at 222,93 |

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global101` | `0` | Set to 0 on room init |
| `global100` | `true`, `false` | When true, overlay picture 112 is displayed |
| `global112` | `true`, `false` | When true, tree grabbing is disabled (can walk safely) |
| `global127` | `0`, `1` | Set to 1 when player is caught by trees (game over state) |
| `local13` | `1-3` | Animation cel parameter for grabbing animation |
| `local14` | `1-12` | Tracks which tree prop grabbed the player |

### Control Areas

The room uses multiple control areas (bitmasks) to detect when player touches different tree zones:

| Bitmask | local14 | local13 | Tree Triggered |
|---------|---------|---------|----------------|
| $0080 | 2 | 1 | newProp_6[2] grabbing |
| $2000 | 3 | 1 | newProp_6[3] grabbing |
| $0040 | 6 | 1 | newProp_6[6] grabbing |
| $0020 | 5 | 1 | newProp_6[5] grabbing |
| $0100 | 1 | 2 | newProp_6[1] grabbing |
| $1000 | 4 | 2 | newProp_6[4] grabbing |
| $0010 | 7 | 2 | newProp_6[7] grabbing |
| $0200 | 8 | 2 | newProp_6[8] grabbing |
| $0800 | 9 | 2 | newProp_6[9] grabbing |
| $0004 | 10 | 2 | newProp_6[10] grabbing |
| $0400 | 11 | 2 | newProp_6[11] grabbing |
| $0008 | 12 | 3 | newProp_6[12] grabbing |

### Death Messages

When caught, one of these messages displays (Print 12 1-6):
1. "Wooden you know it. You've been caught!"
2. "You've really gotten yourself out on a limb this time, Rosella!"
3. "Talk about being torn limb from limb!"
4. "Time to 'leaf' this mortal world!"
5. "You've been a real sap this time, Rosella!"
6. "It seems you'll discover your roots, Rosella!"

### Additional Technical Details

- Entry from west (room 11): Player positioned at x=1, y=max(horizon+2, egoY)
- Entry from north (room 6): Player positioned at x=max(egoX, 211), y=horizon+2
- Entry from south (room 18): Player y=188, x clamped between 32-189
- Entry from new game (0): Player positioned at x=290, y=160
- Blocks defined: newBlk (194,115,230,118), newBlk_2 (170,106,183,110) that ego observes
- Walking music (64) plays on room entry
- Caught music (65) pre-loaded for grab sequence
- Overlay 112 shown if global100 is true
