| Routines

38298: Animate the toilet in The Bathroom

Used by the routine at 38196.
38298 | LD A,(33824) | Pick up the number of the current room from 33824
38301 | CP 33 | Are we in The Bathroom?
38303 | RET NZ | Return if not
38304 | LD A,(34251) | Pick up the minute counter from 34251; this will determine the animation frame to use for the toilet
38307 | AND 1 | Keep only bit 0 and move it to bit 5
38309 | RRCA
38310 | RRCA
38311 | RRCA
38312 | LD E,A | Now E=0 or 32
38313 | LD A,(34271) | Pick up the game mode indicator from 34271
38316 | CP 3 | Is Willy's head down the toilet?
38318 | JR NZ,38322 | Jump if not
38320 | SET 6,E | Now E=64 or 96
38322 | LD D,166 | Point DE at the toilet sprite to use (42496, 42528, 42560 or 42592)
38324 | LD IX,33488 | Draw the toilet at (13,28) in the screen buffer at 24576
38328 | LD BC,4124
38331 | CALL 38504
38334 | LD HL,1799 | H=L=7 (INK 7: PAPER 0)
38337 | LD (23996),HL | Set the attribute bytes for the toilet in the buffer at 23552
38340 | LD (24028),HL
38343 | RET |