# Room 19: Coastal Cliffs

This is a coastal cliff area overlooking the ocean. The room features animated waves in the background and dangerous cliff edges where the player can fall if they venture too close to the edge. A floating entity (genie) may appear under certain conditions related to a magic item and time elapsed. The player can navigate between a meadow to the east, the beach to the south, a cave to the north, and another area to the west.

## Look Description

"Wistfully, you stare out over the ocean, wishing you could go home and see your family again. Unfortunately, reality sets in, and you remember your difficult situation. Turning your head, you look eastward toward a meadowland covered with wildflowers, and heave a big sigh of sadness."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look /grass` | "A pretty meadow leads eastward." (Print 19 0) |
| TODO | Look | `look /cliff` | "Better be careful around the cliffs!" (Print 19 1) |
| TODO | Look | `look [around][/room]` | "Wistfully, you stare out over the ocean, wishing you could go home and see your family again. Unfortunately, reality sets in, and you remember your difficult situation. Turning your head, you look eastward toward a meadowland covered with wildflowers, and heave a big sigh of sadness." (Print 19 2) |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Background | waveActions | Continuous (room init) | Animates three wave props (wave1, wave2, wave3) cycling through their cells to create ocean wave animation |
| TODO | Interaction | fallLmagenta | Walking on magenta control area ($2000) while `global107 = 11` | Player falls from edge, moves to position (gEgo x, gEgo y + 40), plays falling animation, shakes screen, displays "You really should be more careful, Rosella!" message, sets `global127 = 1` |
| TODO | Interaction | fallLred | Walking on red control area ($1000) while `global107 = 11` | Player falls, moves to position (222, 170), plays falling animation, shakes screen, displays "That last step was a doozy!" message, sets `global127 = 1` |
| TODO | Interaction | fallGrey | Walking on grey control area ($0100) while `global107 = 11` | Player falls, moves to position (263, 173), plays falling animation, shakes screen, displays "Watch where you're going, Rosella!" message, sets `global127 = 1` |
| TODO | Interaction | fallLgrey | Walking on light grey control area ($0080) while `global107 = 11` | Player falls, moves to position (270, 173), plays falling animation, shakes screen, displays "That last step was a doozy!" message, sets `global127 = 1` |
| TODO | Interaction | fallRed | Walking on red control area ($0010) while `global107 = 11` | Player falls straight down, moves to position (gEgo x, 178), plays falling animation, shakes screen, displays "That last step was a doozy!" message, sets `global127 = 1` |
| TODO | Interaction | fallBrown | Walking on brown control area ($0040) while `global107 = 11` | Player falls, moves to position (239, 187), plays falling animation, shakes screen with 3 seconds, displays "That last step was a real doozy!" message, sets `global127 = 1` |
| TODO | Interaction | fallGreen | Walking on green control area ($0004) while `global107 = 11` | Player falls, moves to position (240, 219), plays falling animation, shakes screen, displays "Oops, you slipped!" message, sets `global127 = 1` |
| TODO | Background | doFall | Triggered when player is about to fall | Stops all sounds, plays fall sound (sound 51), stops any floating entity animation |

## Technical Notes

- **Room Number**: 19
- **Picture**: 19
- **Regions**: 516, 503, 501, 504
- **Exits**: North→13, South→25, East→20, West→31
- **Horizon**: 104

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global101` | 0 | Reset to 0 on room entry |
| `global105` | 0-4 | Player entry state/position index (determines starting position) |
| `global107` | 0, 11 | Edge zone indicator: 11 when player is on cliff edge, 0 otherwise |
| `global118` | number | Random value (1-30 divided by 10) when genie conditions met |
| `global127` | 0, 1 | Fall state: set to 1 after player falls |
| `global100` | boolean | Overlay flag - if set, overlay 119 is displayed |
| `local2` | number | Time calculation: (global160 - global213) * 60 + (global159 - global214) |

### Additional Technical Details

- Room uses setRegions: 516 503 501 504 (multiple region scripts applied)
- Three wave Prop instances (wave1, wave2, wave3) with view 666 create animated ocean effect
- Control areas determine fall behavior:
  - $2000: magenta area - fall to (x, y+40)
  - $1000: red area - fall to (222, 170)
  - $0100: grey area - fall to (263, 173)
  - $0080: light grey area - fall to (270, 173)
  - $0010: red area - fall straight down
  - $0040: brown area - fall to (239, 187)
  - $0004: green area - fall to (240, 219)
- Floating entity (gNewAct_2) appears conditionally when player has item 9 (magic lamp) and local2 >= 3, displays view 174 loop 2 cel 0
- When falling, player view changes to 17 (falling animation), then to 33 (lying down)
- Sound 51 plays during fall sequence
- Player priority adjusts based on position (setPri: 12, 13, 14)
- The room checks `gEgo inRect:` for priority zone between x:254-316 and y:104-115
