# Room 41: Island Shore

The island shore serves as the gateway to the magical island. This coastal room features gentle wave animations along the shoreline and connects to multiple destinations: the ivory palace to the north (room 35), the dock area to the east (room 31), another beach area to the west (room 40), and a southern coastal area (room 32). The dominant feature visible from this room is the splendid ivory palace that dominates the island's center.

## Look Description

"The beautiful blue ocean washes gently upon the shore of the magical island. Dominating the center of this island is a splendid ivory palace."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look/island` | "The beautiful blue ocean washes gently upon the shore of the magical island. Dominating the center of this island is a splendid ivory palace." (Print 41 0) |
| TODO | Look | `look/around` | "The beautiful blue ocean washes gently upon the shore of the magical island. Dominating the center of this island is a splendid ivory palace." (Print 41 0) |
| TODO | Look | `look/room` | "The beautiful blue ocean washes gently upon the shore of the magical island. Dominating the center of this island is a splendid ivory palace." (Print 41 0) |
| TODO | Look | `look[<around>][!*]` | "The beautiful blue ocean washes gently upon the shore of the magical island. Dominating the center of this island is a splendid ivory palace." (Print 41 0) |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Background | waveActions_a | Continuous on room init | Initializes wave animation by adding wave props to picture, then cycles through each wave sequentially, showing and hiding cels to create gentle wave motion effect |
| TODO | Background | waveActions_b | Continuous (alternate animation) | Similar to waveActions_a but conditionally runs based on global223 flag - when global223 is true, cycles through wave animation; otherwise adds waves to picture statically |
| TODO | Background | Room doit | Continuous | Checks player position on control areas - if heading north (0-90 or 270-360 degrees) and on control area $0040, transitions to room 35; if on control area $0010, transitions to room 38 |

## Technical Notes

- **Room Number**: 41
- **Picture**: 41
- **Region**: 505, 501, 503, 504
- **Exits**: North→35 (palace), South→32, East→31 (dock), West→40
- **Horizon**: 80

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global223` | `0`, `1` | Time-based flag controlling wave animation behavior - alternate script uses this to determine whether to cycle animations or display static waves |
| `gEgoOnControl` | bitmask | Control area detection under player position |
| `local1` | number | Wave animation counter used to iterate through wave list |

### Entry Points

| Source Room | Condition | Position |
|-------------|-----------|----------|
| 38 | default | x: 19 y: 99 |
| 35 | view = 2 (normal) | posn: 182 112 |
| 35 | view = 5 | posn: 186 112 |
| 35 | view = 6 | posn: 186 112 |
| 35 | view = 7 | posn: 201 112 |
| 35 | view = 8 (swimming) | posn: 237 112 |
| 31 | default | x: 318 y: 110 |
| 32 | default | x: 138 y: 188 |
| 40 | default | x: 1 (preserve y) |

### Control Areas

- `$0040` - North transition zone: triggers room 35 (palace entrance)
- `$0010` - Water zone: triggers room 38 (waterfall/water area)

### Wave Objects

| Name | View | Loop | Initial Cel | Position |
|------|------|------|-------------|----------|
| wave1 | 664 | 0 | 3 | 150, 125 |
| wave2 | 664 | 1 | 2 | 112, 165 |
| wave3 | 664 | 2 | 3 | 37, 175 |
