Prev: 28101 Up: Map Next: 28143
28102: Control the vertical flight of a catapult pellet
The address of this uninterruptible subcommand routine is placed into bytes 111 and 112 of a catapult pellet's buffer by the routine at 27932. It controls the pellet from the beginning of its vertical flight to the end, including any collision with a shield.
Input
H 170 (BOY WANDER's pellet) or 171 (ERIC's pellet)
28102 CALL 25108 Update the SRB for the pellet's current location
28105 LD B,A B=pellet's animatory state
28106 LD A,D A=pellet's y-coordinate
28107 CP 152 Has the pellet hit the ceiling of the top floor?
28109 JP Z,27940 Terminate the pellet if so
28112 DEC D Up a level
28113 LD L,113 Byte 113 of the pellet's buffer holds the 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 the pellet's location and update the SRB
This entry point is used by the routine at 27932 to check whether a pellet fired from a staircase has hit a shield.
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 the pellet's potential target
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 the pellet's potential target
This entry point is used by the routine at 63270 with DE holding the coordinates of ERIC's hand (and H=172).
28130 SET 7,E E=128 + x-coordinate of the 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 If it was a pellet that hit the shield, this sets its remaining distance to travel to 1, so it will be terminated the next time this routine is called
28140 LD (HL),1
28142 RET
Prev: 28101 Up: Map Next: 28143