Skool Daze Routines
28102: Control vertical flight of catapult pellet
The address of this routine is placed in bytes 111 and 112 of a catapult pellet's buffer by the routine at 27932.
H 170 (BOY WANDER's pellet) or 171 (ERIC's pellet)
28102 CALL 25108 Update SRB for current location of pellet
28105 LD B,A B=pellet's animatory state
28106 LD A,D A=pellet's y-coordinate
28107 CP 152 152=ceiling of top floor
28109 JP Z,27940 Jump if the pellet is here
28112 DEC D Up a level
28113 LD L,113 Byte 113 holds the vertical distance left to travel
28115 DEC (HL) Has the pellet finished travelling?
28116 JP Z,27940 Jump if so
28119 LD A,B A=pellet's animatory state
28120 CALL 25008 Update pellet's animatory state and location and update SRB
This entry point is used by the routine at 27932.
28123 LD L,97 Byte 97 holds the pellet's y-coordinate
28125 LD D,(HL) Pick this up in D
28126 INC D D=y-coordinate of location directly above pellet
28127 INC L Byte 98 holds the pellet's x-coordinate
28128 LD E,(HL) Pick this up in E
28129 INC E E=x-coordinate of potential target
This entry point is used by the routine at 63270 with DE holding the coordinates or ERIC's hand.
28130 SET 7,E E=128 + x-coordinate of potential target
28132 PUSH HL
28133 CALL 28143 Has the pellet (or ERIC's hand) hit a shield?
28136 POP HL
28137 RET NC Return if not
28138 LD L,113 The pellet has hit a shield; set its remaining distance to travel to 1, so it will be terminated next time
28140 LD (HL),1
28142 RET