Routines

64259: Deal with ERIC when stepping off plant or plant pot


This routine is called by the routine at 63405 when bit 2 at 32749 is set

64259 21F37F LD HL,32755
64262 35 DEC (HL) Is it time to deal with ERIC yet?
64263 C0 RET NZ Return if not
64264 3605 LD (HL),5
64266 2100D2 LD HL,53760 HL points to byte 0 of ERIC' buffer (holding his animatory state)
64269 CB46 BIT 0,(HL) Is ERIC midstride?
64271 28E6 JR Z,64247 Jump to make him so if not
64273 3AED7F LD A,(32749) Is ERIC going to fall out of a window
or step over the skool gate?
64276 FE0C CP 12
64278 3E04 LD A,4
64280 280A JR Z,64292 Jump to set reset bit 3 at 32749 if so
64282 2C INC L
64283 7E LD A,(HL) A=ERIC's x-coordinate
64284 FE5C CP 92 92=x-coordinate of plant pot on top floor
64286 3E20 LD A,32 Set bit 5 in A
64288 2802 JR Z,64292 Jump if ERIC is going to fall from top floor window
64290 3E08 LD A,8 Set bit 3 in A
64292 32ED7F LD (32749),A
64295 CD5471 CALL 29012 Make sound effect
64298 26D2 LD H,210 210=ERIC
64300 CDB461 CALL 25012 Update SRB for ERIC's current animatory state and location
64303 3C INC A
64304 E682 AND 130 Now A=ERIC's new animatory state
64306 1D DEC E Decrement ERIC's x-coordinate
64307 CB7F BIT 7,A Is ERIC facing left?
64309 2802 JR Z,64313 Jump if so
64311 1C INC E Move ERIC forward (facing right)
64312 1C INC E
64313 C30C6E JP 28172 Update SRB for ERIC's new animatory state and location, make sound effect, and scroll screen if necessary