Prev: 55088 Up: Map Next: 55283
55188: Check for any fired missiles/bolts
Used by the routines at 54983, 54994, 55068 and 55088.
Checking if:
  • a creature has fired a missile at Maroc, or
  • Maroc has fired a missile.
Only one creature missile and one Maroc-fired missile (i.e. 2 missiles total) can be on-screen at any one time.
55188 LD A,0
55190 LD (60116),A Indicates screen/viewport - 0 = current screen/viewport
55193 LD A,5
55195 LD (60314),A Pre-set the missile type. 5 = missile fired at Maroc by creatures (rather than vice versa)
Check if a missile/bolt has been set up (and if not, set it up):
55198 LD A,(60307) Get missile number (table at 27868)
55201 CP 0
55203 JR Z,55213 0 = no missile present
55205 CALL 56095 If not zero, set up this missile set data
55208 LD A,0 Missile has now been set up and stored in the data sets at 31744, so can now set the missile number to zero
55210 LD (60307),A
Check if Maroc has launched a missile spell:
55213 LD A,(60568) This byte contains an 'action' byte set when Maroc presses fire after aiming his missile-based spell cursor, and contains values for the different missile spells
55216 CP 0 If zero, Maroc hasn't fired a missile spell - skip next section
55218 JR Z,55283
Maroc has launched a missile-type spell. Calculate trajectory of missile:
55220 LD A,(60306) Flag indicating if Maroc has fired a missile (1 = missile fired, 0 = no missile)
55223 CP 0
55225 JR NZ,55278 If there's already one, skip the setup
55227 INC A Increment so the flag = 1 (missile fired)
55228 LD (60306),A ...and re-store.
55231 LD A,0 Precision/overflow byte for horizontal/vertical item position (reset both to 0)
55233 LD (60308),A
55236 LD (60310),A
55239 LD A,(60096) Maroc's horizontal (X-axis) screen position
55242 LD (60309),A Set this as the missile's horizontal (X) co-ordinate origin
55245 LD A,(60097) Maroc's vertical (Y-axis) screen position
55248 LD (60311),A Set this as the missile's vertical (Y) co-ordinate origin
55251 LD A,(60159) Get the vertical (Y) pixel position of the aiming cursor
55254 LD (60313),A Store as the target vertical pixel (Y) co-ordinate for the missile
55257 LD A,(60160) Get the horizontal (X) pixel position of the aiming cursor
55260 RRA This value is currently in pixel steps, so divide by 4 to get into 4-pixel (half-character steps)
55261 RRA
55262 AND 63 Filter out any unnecessary carry bits
55264 LD (60312),A ...and store
55267 LD A,8 Item/missile type = 8 (missile fired by Maroc)
55269 LD (60314),A Store in missile data set
55272 LD A,(60568)
55275 CALL 56095 Set up missile data
55278 LD A,0 This is the action byte set when Maroc presses fire after aiming his missile-based spell cursor - contains values for the different missile spells
55280 LD (60568),A Now that the missile has been initialized, set this flag to 0.
Prev: 55088 Up: Map Next: 55283