Prev: AC34 Up: Map Next: ACDD
AC60: Update and draw the ground objects
Used by the routine at scroll_landscape.
Once a pass, from the landscape's drawing (scroll_landscape): before or after the landscape is drawn depending on which way the screen is moving up or down. For each of the six records at ground_objects in use:
A ground object (not a pick-up) whose +$18 bits 1-3 are set may fire (ground_object_fires). The pair of images is started (clear_sprite_pair) and, if it was drawn last pass, its erase set up (prepare_erase). animate_object animates it if bit 7 of +$15 is set; a pick-up is tested against the ship (collect_pickup). An object to be removed is freed and only rubbed out; any other is placed for this pass (prepare_draw). The compositor rubs out and draws (draw_object_images); a ground object's colour patch is trimmed (trim_colour_patch); the colours are put on (colour_sprite); and a ground object is tested against the special beam (beam_hits_ground_object).
The ground objects do not move by themselves: their positions in the world are fixed, and they move on the screen as the view scrolls (place_on_screen).
update_ground_objects AC60 LD A,(map_rebuild) Unless the view is being built (map_rebuild), the rocket first (draw_rocket)
AC63 AND A
AC64 CALL Z,draw_rocket
AC67 LD IX,ground_objects The six records
AC6B LD B,$06
update_ground_objects_0 AC6D PUSH BC
AC6E PUSH IX
AC70 LD A,(IX+$00) Free
AC73 CP $FF
AC75 JR Z,update_ground_objects_4
AC77 BIT 7,(IX+$03) A ground object: let it fire, if +$18 bits 1-3 give a kind of shot
AC7B JR NZ,update_ground_objects_1
AC7D LD A,(IX+$18)
AC80 AND $0E
AC82 SRL A
AC84 LD (scratch_count),A
AC87 CALL NZ,ground_object_fires
update_ground_objects_1 AC8A CALL clear_sprite_pair Start the pair; set up the erase if it was drawn last pass
AC8D BIT 7,(IX+$10)
AC91 CALL NZ,prepare_erase
AC94 RES 6,(IX+$10) Clear the left-clip mark (prepare_erase has passed it on); keep the erase in the other registers
AC98 EXX
AC99 BIT 7,(IX+$15) Animate it if bit 7 of +$15
AC9D CALL NZ,animate_object
ACA0 BIT 7,(IX+$03) A pick-up: is it taken?
ACA4 CALL NZ,collect_pickup
ACA7 BIT 4,(IX+$10) To be removed: free it, and draw nothing new
ACAB JR Z,update_ground_objects_2
ACAD LD (IX+$00),$FF
ACB1 LD (IX+$10),$00
ACB5 JR update_ground_objects_3
update_ground_objects_2 ACB7 CALL prepare_draw Otherwise place it for this pass
update_ground_objects_3 ACBA CALL draw_object_images Rub out and draw
ACBD LD IY,(current_object) A ground object: trim its colour patch
ACC1 BIT 7,(IY+$03)
ACC5 CALL Z,trim_colour_patch
ACC8 CALL colour_sprite Colour it
ACCB LD IX,(current_object) Test it against the special beam
ACCF CALL beam_hits_ground_object
update_ground_objects_4 ACD2 POP IX Next record
ACD4 LD BC,$001A
ACD7 ADD IX,BC
ACD9 POP BC
ACDA DJNZ update_ground_objects_0
ACDC RET
Prev: AC34 Up: Map Next: ACDD