# Room 51: Ogre's Closet

This room is the interior of the ogre's small closet. The room features a closet door with a keyhole mechanism that triggers a complex animation sequence involving the ogre and his wife in the adjacent kitchen. Players can examine the keyhole, open the closet door to escape to the kitchen (Room 49), or attempt to use the keyhole with or without the magic hen to witness the ogres' routine.

## Look Description

"You have found yourself inside the ogres' small closet. For a closet, it's surprisingly empty. You notice a large keyhole under the doorknob of the closet door."

## Interactions

| Status | Behavior Type | Command | Response |
|--------|--------------|---------|----------|
| TODO | Look | `look keyhole` | "There is a large keyhole under the doorknob of the closet door." (Print 51 2) |
| TODO | Look | `look door` | "There is a large keyhole under the doorknob of the closet door." (Print 51 2) |
| TODO | Look | `look wall` | "There is nothing of importance on the walls." (Print 51 3) |
| TODO | Look | `look dirt` / `look down` | "There is nothing of importance on the floor." (Print 51 4) |
| TODO | Look | `look around` / `look room` / `look closet` / `look cottage` | "You have found yourself inside the ogres' small closet. For a closet, it's surprisingly empty. You notice a large keyhole under the doorknob of the closet door." (Print 51 5) |
| TODO | Action | `open door` / `open closet` | Opens closet door if keyhole not in use, else "It's already open." (Print 51 7) |
| TODO | Action | `close door` | Closes closet door if open, else "It's already closed." (Print 51 8) |

## Scripts

| Status | Behavior Type | Name | Trigger | Behavior |
|--------|--------------|------|---------|----------|
| TODO | Interaction | theKeyhole | Looking at keyhole with crown (item 33) when ogre state > 0 and < 5 | Plays full keyhole animation sequence: Rosella shrinks and enters keyhole, watches ogre and ogress dialogue, sees hen lay golden egg, ogre falls asleep, returns to closet with hen moved to Room 49, sets `ogre_state = 3` then later to `5` |
| TODO | Interaction | emptyHole | Looking at keyhole without crown or when ogre state is 0 or 5 | Plays shortened sequence: Rosella shrinks and enters keyhole, sees ogre sleeping (if state = 3), returns to closet |
| TODO | Interaction | doorOpen | Opening closet door | Opens door animation, reveals kitchen (Room 49), moves player to Room 49. Shows different views behind door based on ogre state (1-4) |

## Technical Notes

- **Room Number**: 51
- **Picture**: 51
- **Region**: 602 (Ogre House Closet)
- **Exits**: East→49 (through closet door)
- **Music**: Keyhole music (sound #61)

### State Variables

| Variable | Values | Description |
|----------|--------|-------------|
| `global101` | `1` | Entering room flag, set on init |
| `global165` | `0`, `1`, `2`, `3`, `4`, `5` | Ogre/hen sequence state - tracks progression of getting the hen from ogre |
| `global166` | `0`, `1` | Keyhole used flag - set to 1 when entering keyhole sequence |
| `global189` | `1`, `0` | Music state flag - set to 1 on room init, 0 on dispose |
| `global100` | `true`, `false` | Genie/defeated state - affects visuals in keyhole sequence |

### Additional Technical Details

- Room uses Region 602 for shared ogre house logic
- The closet door is actually a keyhole that Rosella shrinks into to steal the magic hen
- Item 33 is the "magic hen" that lays golden eggs
- Entry from Room 49 or new game places player at position (156, 139)
- The keyhole view cel 0 indicates closed keyhole; cel > 0 indicates open
- When opening door, different views shown based on ogre state (global165):
  - State 1-4: Shows ogress with different expressions based on state
  - State 0 or 5: Door shown empty
- The door opens into Room 49 (the ogre's kitchen)
