Routines
 Prev: 79AC Up: Map Next: 7A14
79AE: Make any female characters near a mouse start or continue jumping
Used by the routine at 7A16. Does nothing if the mouse is off-screen. Otherwise, for each female character that is facing the mouse and within five spaces to the left or right of it, either (a) makes her stand on a chair or start jumping if she isn't already, or (b) makes her stay on the chair or keep jumping for a little longer.
Input
H Mouse's character number (0xC6, 0xC7, 0xCE-0xD0, 0xD4)
79AE LD A,(\$7FFF) A=leftmost column of the play area on screen
79B1 LD B,A Copy this to B
79B2 LD L,\$01 Point HL at byte 0x01 of the mouse's buffer
79B4 LD A,(HL) A=mouse's x-coordinate
79B5 LD E,A Copy this to E
79B6 SUB B
79B7 INC A
79B8 CP \$20 Is this mouse off-screen?
79BA RET NC Return if so
79BB INC L L=0x02
79BC LD D,(HL) D=mouse's y-coordinate
79BD LD H,\$B7 0xB7=little girl no. 1
79BF LD B,\$07 There are 7 little girls to check
79C1 CALL \$79CD Make them start jumping if necessary
79C4 LD H,\$CC 0xCC=MISS TAKE
79C6 INC B B=1
79C7 CALL \$79CD Make MISS TAKE start jumping if necessary
79CA LD H,\$D1 0xD1=HAYLEY
79CC INC B B=1
At this point H holds the number of the first female character to check, and B the number of characters to check (for proximity to a mouse).
79CD LD L,\$02 Point HL at byte 0x02 of the female character's buffer
79CF LD A,D A=mouse's y-coordinate
79D0 SUB (HL) Subtract that of the female character under consideration
79D1 JR Z,\$79DD Jump if the female character is standing on the same floor as the mouse
79D3 DEC A Is the female character one level above the mouse?
79D4 JR NZ,\$7A10 Jump ahead to consider the next character if not
79D6 LD L,\$12 Pick up the MSB of any uninterruptible subcommand routine address in bytes 0x11 and 0x12 of the character's buffer
79D8 LD A,(HL)
79D9 CP \$79 Is this character jumping (0x79=MSB of 7966 or 7974)?
79DB JR NZ,\$7A10 Jump ahead to consider the next character if not
79DD LD L,\$01 Point HL at byte 0x01 of the character's buffer
79DF LD A,(HL) A=female character's x-coordinate
79E0 SUB E Subtract that of the mouse
79E1 LD L,\$00 Point HL at byte 0x00 of the character's buffer
79E3 JR Z,\$79F9 Jump if the girl is standing right where the mouse is
79E5 JR NC,\$79F1 Jump if the girl is standing to the right of the mouse
79E7 CP \$FB Is the girl within 5 spaces to the left of the mouse?
79E9 JR C,\$7A10 Jump ahead to consider the next character if not
79EB BIT 7,(HL) Is the female character facing left?
79ED JR Z,\$7A10 Jump ahead to consider the next character if so
79EF JR \$79F9
79F1 CP \$06 Is the girl within 5 spaces to the right of the mouse?
79F3 JR NC,\$7A10 Jump ahead to consider the next character if not
79F5 BIT 7,(HL) Is the female character facing right?
79F7 JR NZ,\$7A10 Jump ahead to consider the next character if so
The female character is located within 5 spaces of the mouse, and is facing it. Figure out whether she's already jumping, or can start jumping.
79F9 LD L,\$12 Pick up the MSB of any uninterruptible subcommand routine address in bytes 0x11 and 0x12 of the female character's buffer
79FB LD A,(HL)
79FC CP \$79 Set the zero flag if the routine address is 7966 or 7974 (i.e. the character is already jumping)
79FE INC HL Point HL at byte 0x13 of the character's buffer
79FF JR NZ,\$7A05 Jump if the character is not jumping
7A01 SET 4,(HL) Otherwise ensure this character continues jumping for a little longer by setting the counter in byte 0x13 to at least 0x10
7A03 JR \$7A10 Jump ahead to consider the next character
7A05 AND A Is there an uninterruptible subcommand routine address other than 7966 or 7974 in bytes 0x11 and 0x12 of the character's buffer (meaning she is otherwise occupied)?
7A06 JR NZ,\$7A10 Jump ahead to consider the next character if so
The female character is not jumping at the moment. Make her start.
7A08 LD (HL),\$15 Set the delay parameter at byte 0x13 determining how long the female character will jump up and down
7A0A DEC L
7A0B LD (HL),\$79 Place the address of the uninterruptible subcommand routine at 7974 into bytes 0x11 and 0x12 of the female character's buffer
7A0D DEC L
7A0E LD (HL),\$74
7A10 INC H Next female character
7A11 DJNZ \$79CD Jump back until all the characters have been checked
7A13 RET
 Prev: 79AC Up: Map Next: 7A14