Routines

31150: Make any girls near a mouse start jumping


Used by routine at 31254

H Character number of mouse

31150 3AFF7F LD A,(32767) A=column of play area at far left of screen
31153 47 LD B,A
31154 2E01 LD L,1
31156 7E LD A,(HL) A=mouse's x-coordinate
31157 5F LD E,A
31158 90 SUB B
31159 3C INC A
31160 FE20 CP 32 Is this mouse off-screen?
31162 D0 RET NC Return if so
31163 2C INC L
31164 56 LD D,(HL) D=mouse's y-coordinate
31165 26B7 LD H,183 183=little girl no. 1
31167 0607 LD B,7 There are 7 little girls to check
31169 CDCD79 CALL 31181 Make them start jumping if necessary
31172 26CC LD H,204 204=MISS TAKE
31174 04 INC B B=1
31175 CDCD79 CALL 31181 Make MISS TAKE start jumping if necessary
31178 26D1 LD H,209 209=HAYLEY
31180 04 INC B B=1
31181 2E02 LD L,2
31183 7A LD A,D A=mouse's y-coordinate
31184 96 SUB (HL) Subtract that of the female character under consideration
31185 280A JR Z,31197 Jump if the female character is standing on the same floor as the mouse
31187 3D DEC A Is the female character in the air on the same floor as the mouse?
31188 203A JR NZ,31248 Jump to consider next character if not
31190 2E12 LD L,18 Pick up the MSB of the address of any controlling routine in bytes 17 and 18 of the character's buffer
31192 7E LD A,(HL)
31193 FE79 CP 121 Is this character already jumping?
31195 2033 JR NZ,31248 Jump to consider the next character if not
31197 2E01 LD L,1
31199 7E LD A,(HL) A=female character's x-coordinate
31200 93 SUB E Subtract that of the mouse
31201 2E00 LD L,0
31203 2814 JR Z,31225 Jump if the girl is standing right where the mouse is
31205 300A JR NC,31217 Jump if the girl is standing to the right of the mouse
31207 FEFB CP 251 Is the girl within 5 spaces to the left of the mouse?
31209 3825 JR C,31248 Jump to consider next character if not
31211 CB7E BIT 7,(HL) Is the female character facing left?
31213 2821 JR Z,31248 Jump to consider next character if so
31215 1808 JR 31225
31217 FE06 CP 6 Is the girl within 5 spaces to the right of the mouse?
31219 301B JR NC,31248 Jump to consider next character if not
31221 CB7E BIT 7,(HL) Is the female character facing right?
31223 2017 JR NZ,31248 Jump to consider next character if so
31225 2E12 LD L,18 Pick up the MSB of the address of any controlling routine in bytes 17 and 18 of the character's buffer
31227 7E LD A,(HL)
31228 FE79 CP 121 Is this character already jumping?
31230 23 INC HL
31231 2004 JR NZ,31237 Jump if not
31233 CBE6 SET 4,(HL) Otherwise ensure this character continues jumping for a little longer
31235 180B JR 31248
31237 A7 AND A Is there a controlling routine address in bytes 17 and 18?
31238 2008 JR NZ,31248 Jump to consider next character if so
31240 3615 LD (HL),21 Set delay parameter at byte 19 determining how long female character will jump up and down
31242 2D DEC L
31243 3679 LD (HL),121 Place the address of the routine at 31092 into bytes 17 and 18 of the female character's buffer
31245 2D DEC L
31246 3674 LD (HL),116
31248 24 INC H Next female character
31249 10BA DJNZ 31181
31251 C9 RET