| Routines

30706: Make ANGELFACE hit now and then

Used by the routines at 63455 and 63492. Decides whether ANGELFACE should throw a punch, and gets the punching action under way if so.
Input
H | 207 (ANGELFACE)
30706 | LD L,0 | Byte 0 of ANGELFACE's buffer holds his animatory state
30708 | BIT 0,(HL) | Is ANGELFACE midstride?
30710 | RET NZ | Return if so
30711 | CALL 30543 | Is ANGELFACE exactly on the top, middle or bottom floor?
30714 | RET NZ | Return if not
30715 | CALL 25233 | A=random number
30718 | RLCA | Return 50% of the time
30719 | RET NC
30720 | CALL 28004 | Can any adults see ANGELFACE?
30723 | RET C | Return if so
30724 | LD B,3 | Is there anyone 3 spaces in front of ANGELFACE and facing him?
30726 | CALL 30664
30729 | RET C | Return if not
30730 | POP BC | Drop the return address (25431)
30731 | POP BC | Pop the value of HL that was pushed on to the stack by the routine at 25296 before coming here; RET will now take us back either to 25296 to move the next character, or to the main loop
30732 | LD HL,30739 | Place the address of the uninterruptible subcommand routine at 30739 into bytes 17 and 18 of ANGELFACE's buffer
30735 | LD (53009),HL
30738 | RET |