Prev: 24328 Up: Map Next: 24476
24348: 'K' pressed - kiss
The address of this routine is found in the table of keypress handling routines at 58704. It is called from the main loop at 63210 when 'K' is pressed.
Input
A ERIC's animatory state
D ERIC's y-coordinate
E ERIC's x-coordinate
24348 LD HL,53504 Point HL at byte 0 of HAYLEY's buffer
24351 XOR (HL) Are ERIC and HAYLEY facing the same way?
24352 RLCA
24353 JR NC,24378 Jump if so
24355 BIT 2,(HL) Is HAYLEY standing up?
24357 JR NZ,24378 Jump if not
24359 LD A,(HL) A=HAYLEY's animatory state
24360 RLCA A=x-coordinate of the position two spaces in front of HAYLEY
24361 SBC A,A
24362 ADD A,A
24363 CPL
24364 ADD A,A
24365 INC L
24366 ADD A,(HL)
24367 CP E Does ERIC's x-coordinate match this?
24368 JR NZ,24378 Jump if not
24370 INC L L=2
24371 LD A,(HL) A=HAYLEY's y-coordinate
24372 SUB D Jump if ERIC's y-coordinate does not match HAYLEY's, or ERIC has used up all his kisses
24373 JR NZ,24378
24375 LD L,18 Set the zero flag if there is no uninterruptible subcommand routine address in HAYLEY's buffer (A=0)
24377 CP (HL)
At this point the zero flag is set if HAYLEY is kissable (i.e. ERIC and HAYLEY are standing and facing each other at close proximity, and ERIC hasn't already used up all his kisses), and reset otherwise.
24378 LD A,1 1: ERIC midstride
24380 LD HL,53796 At 53796 lies a RET instruction
24383 JP NZ,57642 Jump if HAYLEY is not kissable at this time
24386 LD A,(32738) 32738 holds HAYLEY's kiss counter
24389 AND A Has ERIC used up all his kisses?
24390 JR NZ,24395 Jump if not
24392 LD HL,24328 24328: hit ERIC
24395 LD (53521),HL Place the appropriate uninterruptible subcommand routine address (24328: hit ERIC, or 53796: do nothing) into bytes 17 and 18 of HAYLEY's buffer
24398 JR Z,24372 Make HAYLEY hit ERIC if he's used up all his kisses
ERIC has scored a kiss.
24400 SUB 7 Subtract 7 from the kiss counter
24402 JR NC,24405 Jump if that doesn't take it below zero
24404 XOR A Set it to zero otherwise
24405 LD (32738),A Store the new kiss count at 32738
24408 LD HL,(32743) 32743 holds the lines total (divided by 10)
24411 LD BC,65436 BC=-100
24414 XOR A
24415 ADD HL,BC Subtract 1000 from the lines total
24416 JR C,24420 Jump if the lines total (in HL) is still positive
24418 LD H,A Otherwise set HL=0
24419 LD L,A
24420 LD (32743),HL Decrease ERIC's lines total by 1000 (or to 0)
24423 CALL 29643 Print the number of lines
24426 LD H,209 209=HAYLEY
24428 CALL 25012 Update the SRB for HAYLEY's current animatory state and location
24431 LD L,20 Save HAYLEY's current animatory state in byte 20 of her buffer for later retrieval
24433 LD (HL),A
24434 DEC L Save HAYLEY's current x-coordinate in byte 19 of her buffer for later retrieval
24435 LD (HL),E
24436 LD L,1 Set HAYLEY's x-coordinate to 224 (out of sight) briefly
24438 LD (HL),224
24440 LD H,210 210=ERIC
24442 CALL 25012 Update the SRB for ERIC's current animatory state and location
24445 LD L,1 Point HL at byte 1 of ERIC's buffer
24447 RLCA Is ERIC facing right (bit 7 set)?
24448 JR C,24452 Jump if so
24450 DEC (HL)
24451 DEC (HL)
24452 INC (HL) Move ERIC one space forward for the snog (which pushes ERIC through the closed skool gate if he kisses HAYLEY from behind it; this is a bug)
24453 LD A,15 15: ERIC and HAYLEY kissing
24455 CALL 24247 Adjust ERIC's animatory state, update the SRB, and return to 24458 (below) next time
24458 CALL 62404 Make a sound effect
24461 LD HL,53523 Point HL at byte 19 of HAYLEY's buffer
24464 LD E,(HL) Pick up HAYLEY's pre-kiss x-coordinate in E
24465 LD L,2 Point HL at byte 2 of HAYLEY's buffer
24467 LD D,(HL) D=HAYLEY's y-coordinate
24468 CALL 30653 Restore HAYLEY's pre-kiss coordinates and animatory state and update the SRB
24471 LD H,210 210=ERIC
24473 JP 24290 Detach ERIC from HAYLEY's embrace
Prev: 24328 Up: Map Next: 24476