# Room 77: Swamp

This is a muddy swamp area connecting the cave entrance (Room 73) to the open swamp marsh (Room 78). The player must crawl into the cave to reach Room 73 on the west side, or hop across the swamp tufts to reach Room 78 on the east side. The room features animated props in the background and uses a complex jump system to traverse the marshy terrain.

## Look Description

"From here, a huge muddy swamp spreads eastward. Large moss-covered swamp trees tower overhead, while grass tufts and reedy plants poke up from the mire. You can hear the many chirpings and croakings of unseen swamp creatures."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look` / `look around` / `look room` / `look marsh` / `look[<around][/!*]` | "From here, a huge muddy swamp spreads eastward. Large moss-covered swamp trees tower overhead, while grass tufts and reedy plants poke up from the mire. You can hear the many chirpings and croakings of unseen swamp creatures." (Print 77 0) |
| TODO | Look | `look<in/cave` | "It sure is dark in there!" (Print 77 1) |
| TODO | Look | `look/cave` | "A small cave leads into the mountain." (Print 77 2) |
| TODO | Action | `crawl/` | If in rect (40,154,63,170): initiates crawl into cave script. Otherwise: "You're not close enough." (Print 77 3) |
| TODO | Action | `hop` / `hop,hop` | Initiates jump sequence across swamp tufts to Room 78 |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | egoCrawlOut | Entering room from west (Room 73) | Animation sequence of player crawling out of cave, transitioning from view 49 (crawling) to view 21 (crouching) to view 2 (standing). Sets `global105` to 12 when complete. |
| TODO | Interaction | egoCrawlIn | Player uses `crawl` command near cave entrance OR automatic trigger when facing cave at right position | Animation sequence of player crawling into cave: crouches down (view 21), transitions to crawling (view 49), moves to edge, then transports to Room 73. Sets `global105` to 0 during crawl, and `global205` to 1 on exit. |
| TODO | Background | jump | Player uses `hop` command | Complex multi-state jump sequence across swamp. Tracks jump progress via `local0` and `local1`. Uses `local2` array for jump waypoint coordinates. If player is in wrong position, shows "Not from here!" (Print 77 5). If `global105 = 13`, shows "Just Move." (Print 77 4) and resets. On successful jump to east edge with proper positioning, transports to Room 78. |

## Technical Notes

- **Room Number**: 77
- **Picture**: 77 (or 177 if global100 is set)
- **Region**: 513 (Swamp Region)
- **Exits**: East→78, West→73 (via crawl)
- **Music**: Not specified in room script

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global105` | `0`, `12`, `13` | Player crawl/jump state: 0 = default, 12 = crawled out (ready to crawl in), 13 = can't jump yet |
| `global205` | `0`, `1` | Jump enabled flag: 1 = jumping enabled (hop command works) |
| `global101` | `0` | Reset to 0 on room init |
| `local0` | Number | Jump progress counter (increments on successful jumps east) |
| `local1` | Number | Jump Y-position tracker for waypoint calculation |
| `local2` | Array | Jump waypoint coordinates (11 pairs of x,y positions for hop path) |
| `gEgoViewer` | Script/0 | Stores player's viewer script during jump sequence to restore after |

### Additional Technical Details

- Room uses Region 513 for shared swamp logic
- Two animated props (newProp, newProp_2) using view 650 for background atmosphere
- Player must be in specific position range (87-106, y 161-172) and facing east (loop 0) to jump successfully
- Automatic crawl-in trigger: player faces cave (heading 256-284), is in normal view (2), on control area $4000, and not already in a script
- The jump script disables player control (proc0_8) during animation and re-enables on completion (proc0_9)
- If player has special views (5, 6, 7 - likely different character forms), jump state is reset
- Entry from east (Room 78) starts player at position (301, 161) facing east
- Entry from west (Room 73) or default starts player crawling out of cave at position (32, 160)
