Prev: 64242 Up: Map Next: 64316
64259: Deal with ERIC when he's stepping off a plant, a plant pot, or the assembly hall stage
Used by the routine at 63405 when bit 2 at 32749 is set (by the routine at 64242 or 64316, or by this routine on the first pass through). On entry, bit 3 at 32749 is also set if ERIC is stepping out of an open window, over the closed skool gate, or off the assembly hall stage. On exit, ERIC's status flags at 32749 are set as follows:
Bit Meaning
2 ERIC has completed one step towards an open window, over the closed skool gate, or off the stage
3 ERIC is now falling (but not from the top-floor window)
5 ERIC is now falling out of the top-floor window
64259 LD HL,32755 32755 holds ERIC's main action timer
64262 DEC (HL) Is it time to deal with ERIC yet?
64263 RET NZ Return if not
64264 LD (HL),5 Reset ERIC's main action timer to 5
64266 LD HL,53760 Point HL at byte 0 of ERIC' buffer
64269 BIT 0,(HL) Is ERIC midstride?
64271 JR Z,64247 Make him so if not (with an accompanying sound effect)
64273 LD A,(32749) Set the zero flag if bit 3 of ERIC's secondary status flags at 32749 is also set
64276 CP 12
64278 LD A,4 Set bit 2 (only) in A
64280 JR Z,64292 Reset bit 3 at 32749 if ERIC has just stepped off a fully grown plant towards an open window or the closed skool gate, or just stepped off the stage
64282 INC L L=1
64283 LD A,(HL) A=ERIC's x-coordinate
64284 CP 92 This is the x-coordinate of the plant pot on the top floor
64286 LD A,32 Set bit 5 in A
64288 JR Z,64292 Jump if ERIC is going to fall from the top-floor window
64290 LD A,8 Set bit 3 in A
64292 LD (32749),A Set the appropriate bit (2, 3 or 5) in ERIC's secondary status flags at 32749
64295 CALL 29012 Make a sound effect
64298 LD H,210 210=ERIC
64300 CALL 25012 Update the SRB for ERIC's current animatory state and location
64303 INC A A=ERIC's new animatory state (standing)
64304 AND 130
64306 DEC E Decrement ERIC's x-coordinate
64307 BIT 7,A Is ERIC facing left?
64309 JR Z,64313 Jump if so
64311 INC E Increment ERIC's x-coordinate (if he's facing right)
64312 INC E
64313 JP 28172 Update ERIC's animatory state and location, make a sound effect, and scroll the screen if necessary
Prev: 64242 Up: Map Next: 64316