| Routines

38196: Deal with special rooms (Master Bedroom, The Bathroom)

Used by the routine at 35245.
38196 | LD A,(33824) | Pick up the number of the current room from 33824
38199 | CP 35 | Are we in Master Bedroom?
38201 | JR NZ,38298 | Jump if not
38203 | LD A,(34271) | Pick up the game mode indicator from 34271
38206 | OR A | Has Willy collected all the items?
38207 | JR NZ,38262 | Jump if so
Willy hasn't collected all the items yet, so Maria is on guard.
38209 | LD A,(34251) | Pick up the minute counter from 34251; this will determine Maria's animation frame
38212 | AND 2 | Keep only bit 1, move it to bit 5, and set bit 7
38214 | RRCA
38215 | RRCA
38216 | RRCA
38217 | RRCA
38218 | OR 128
38220 | LD E,A | Now E=128 (foot down) or 160 (foot raised)
38221 | LD A,(34255) | Pick up Willy's y-coordinate from 34255
38224 | CP 208 | Is Willy on the floor below the ramp?
38226 | JR Z,38236 | Jump if so
38228 | LD E,192 | E=192 (raising arm)
38230 | CP 192 | Is Willy 8 or fewer pixels above floor level?
38232 | JR NC,38236 | Jump if so
38234 | LD E,224 | E=224 (arm raised)
38236 | LD D,156 | Point DE at the sprite graphic data for Maria (40064, 40096, 40128 or 40160)
38238 | LD HL,26734 | Draw Maria at (11,14) in the screen buffer at 24576
38241 | LD C,1
38243 | CALL 37974
38246 | JP NZ,37047 | Kill Willy if Maria collided with him
38249 | LD HL,17733 | H=L=69 (INK 5: PAPER 0: BRIGHT 1)
38252 | LD (23918),HL | Set the attribute bytes for the top half of Maria's sprite in the buffer at 23552
38255 | LD HL,1799 | H=L=7 (INK 7: PAPER 0: BRIGHT 0)
38258 | LD (23950),HL | Set the attribute bytes for the bottom half of Maria's sprite in the buffer at 23552
38261 | RET |
Willy has collected all the items, so Maria is gone.
38262 | LD A,(34259) | Pick up Willy's screen x-coordinate from 34259
38265 | AND 31
38267 | CP 6 | Has Willy reached the bed (at x=5) yet?
38269 | RET NC | Return if not
38270 | LD A,2 | Update the game mode indicator at 34271 to 2 (Willy is running to the toilet)
38272 | LD (34271),A
38275 | RET |