Routines

24348: 'K' pressed - kiss


The address of this routine is found in the keypress table at 58624

A ERIC's animatory state
D ERIC's y-coordinate
E ERIC's x-coordinate

24348 2100D1 LD HL,53504 Point HL at the byte 0 of HAYLEY's buffer
24351 AE XOR (HL) Are ERIC and HAYLEY facing the same way?
24352 07 RLCA
24353 3017 JR NC,24378 Jump if so
24355 CB56 BIT 2,(HL) Is HAYLEY standing up?
24357 2013 JR NZ,24378 Jump if not
24359 7E LD A,(HL) A=HAYLEY's animatory state
24360 07 RLCA
24361 9F SBC A,A
24362 87 ADD A,A
24363 2F CPL
24364 87 ADD A,A
24365 2C INC L
24366 86 ADD A,(HL) Now A=x-coordinate of position two spaces in front of HAYLEY
24367 BB CP E Does ERIC's x-coordinate match?
24368 2008 JR NZ,24378 Jump if not
24370 2C INC L
24371 7E LD A,(HL) A=HAYLEY's y-coordinate
24372 92 SUB D Does ERIC's y-coordinate match?
24373 2003 JR NZ,24378 Jump if not
24375 2E12 LD L,18
24377 BE CP (HL) NB: A=0
24378 3E01 LD A,1 1: ERIC midstride
24380 2124D2 LD HL,53796 At 53796 lies a RET instruction
24383 C22AE1 JP NZ,57642 Jump if HAYLEY is engaged in some activity that prevents her from kissing
24386 3AE27F LD A,(32738)
24389 A7 AND A Has ERIC used up all his kisses?
24390 2003 JR NZ,24395 Jump if not
24392 21085F LD HL,24328 Routine at 24328: hit ERIC
24395 2211D1 LD (53521),HL Put the appropriate routine address into bytes 17 and 18 of HAYLEY's buffer
24398 28E4 JR Z,24372 Jump back if ERIC has used up all his kisses
24400 D607 SUB 7
24402 3001 JR NC,24405
24404 AF XOR A
24405 32E27F LD (32738),A Reduce the store of kisses
24408 2AE77F LD HL,(32743) HL=number of lines/10
24411 019CFF LD BC,65436 BC=-100
24414 AF XOR A
24415 09 ADD HL,BC
24416 3802 JR C,24420
24418 67 LD H,A HL=0
24419 6F LD L,A
24420 22E77F LD (32743),HL Decrease ERIC's lines by 1000 (or to 0)
24423 CDCB73 CALL 29643 Print number of lines
24426 26D1 LD H,209 209=HAYLEY
24428 CDB461 CALL 25012 Update SRB for HAYLEY's current animatory state and location
24431 2E14 LD L,20 Save HAYLEY's current animatory state in byte 20 of her buffer for later retrieval
24433 77 LD (HL),A
24434 2D DEC L Save HAYLEY's current x-coordinate in byte 19 of her buffer for later retrieval
24435 73 LD (HL),E
24436 2E01 LD L,1 Set HAYLEY's x-coordinate to 224 (out of sight) briefly
24438 36E0 LD (HL),224
24440 26D2 LD H,210 210=ERIC
24442 CDB461 CALL 25012 Update SRB for ERIC's current animatory state and location
24445 2E01 LD L,1
24447 07 RLCA Is ERIC facing right?
24448 3802 JR C,24452 Jump if so
24450 35 DEC (HL)
24451 35 DEC (HL)
24452 34 INC (HL) Move ERIC one space forward for the snog
24453 3E0F LD A,15 15: ERIC and HAYLEY kissing
24455 CDB75E CALL 24247 Adjust animatory state, update SRB, and return to 24458 next time
24458 CDC4F3 CALL 62404 Make sound effect
24461 2113D1 LD HL,53523 Point HL at byte 19 of HAYLEY's buffer
24464 5E LD E,(HL) Pick up HAYLEY's pre-kiss x-coordinate in E
24465 2E02 LD L,2
24467 56 LD D,(HL) D=HAYLEY's y-coordinate
24468 CDBD77 CALL 30653 Restore HAYLEY's pre-kiss coordinates and animatory state and update SRB
24471 26D2 LD H,210 210=ERIC
24473 C3E25E JP 24290