Prev: AA37 Up: Map Next: AB98
AAD7: Pick up a pick-up the ship touches
Used by the routine at update_ground_objects.
For each pick-up record (bit 7 of +3) every pass (update_ground_objects). A pick-up is taken when it was on the screen last pass, between line $28 and the bottom and between x=$30 and $90, and its box touches a narrow box under the middle of the ship: 16 pixels from x=$70, the ship's height less ten. Then a sound (sound_pick_up), 1000 added to the score (the score adder near the end of test_player_shots), the record is emptied (bit 4 of +$10, so its image is rubbed out this pass), and:
A rocket part (graphic $1E) is taken only when add-on 1 is fitted (+7 of the player's record score) and it is the part due next (its kind against +$1B, the parts delivered); its colours become $FA. It is hung under the ship: the ship record's +$1F gets the part number with bits 6 and 7 set (draw_ship then calls toggle_carried_part), +$1A of the player's record the part carried, and the part's 4-byte entry from +$49 of the player's record is marked taken.
Any other pick-up is an add-on: +$1F gets its kind plus one, which draw_ship fits (build_ship_sprite), and its entry from +$1D of the player's record is marked. Kinds 9 and $0A are the slab and the spire (add-ons 10 and 11), the load carried_part puts down: kind $0A, the spire, is never taken; kind 9, the slab, only with add-on 9 fitted (+$0F), and taking it clears +$1F and carried_part_facing, sets +$10 of the player's record (player_count_nine) to 9 (the whole load is carried again) and empties second_pickup_record, which holds the spire. Much of this never ran in the build's sessions: the rocket parts' tests, their hanging and the kind-9 code.
Input
IX The pick-up's record
collect_pickup AAD7 LD A,(IX+$00) A rocket part?
AADA CP $1E
AADC JR NZ,collect_pickup_0
AADE LD A,(addon_slots) Only with add-on 1 fitted and when it is the part due next; recolour it
AAE1 AND A
AAE2 RET Z
AAE3 LD A,(IX+$13)
AAE6 AND $0F
AAE8 LD B,A
AAE9 LD A,(parts_built)
AAEC CP B
AAED RET NZ
AAEE LD (IX+$0D),$FA
collect_pickup_0 AAF2 LD A,(IX+$13) Kind $0A is never taken; kind 9 only with add-on 9
AAF5 AND $0F
AAF7 CP $0A
AAF9 RET Z
AAFA CP $09
AAFC JR NZ,collect_pickup_1
AAFE LD A,(addon_nine)
AB01 AND A
AB02 RET Z
collect_pickup_1 AB03 LD A,(old_sprite_rows) Not if it was not on the screen
AB06 AND A
AB07 RET Z
AB08 LD ($ABA7),A Its height, and where it was drawn: only from line $28 down and between x=$30 and $90
AB0B LD HL,(old_sprite_x)
AB0E LD A,H
AB0F CP $28
AB11 RET C
AB12 LD A,L
AB13 CP $30
AB15 RET C
AB16 CP $90
AB18 RET NC
AB19 LD (collision_box),HL Its box
AB1C LD A,(sprite_width)
AB1F ADD A,A
AB20 ADD A,A
AB21 ADD A,A
AB22 LD (collision_box_size),A
AB25 LD HL,(ship_screen_x) The ship's: 16 pixels from x=$70, its height less ten
AB28 LD L,$70
AB2A LD D,$10
AB2C LD A,(ship_height)
AB2F SUB $0A
AB31 LD E,A
AB32 CALL test_collision_box
AB35 LD A,(scratch_count) Not touching
AB38 AND A
AB39 RET Z
AB3A CALL sound_pick_up Taken: a sound
AB3D LD BC,$1000 1000 to the score
AB40 CALL add_score
AB43 LD A,(IX+$00) A rocket part: hang it with bits 6 and 7 set, and keep the part number
AB46 CP $1E
AB48 JR NZ,collect_pickup_2
AB4A LD A,(IX+$13)
AB4D AND $0F
AB4F OR $C0
AB51 LD (part_being_fitted),A
AB54 LD HL,place_eleven
AB57 AND $0F
AB59 LD (rocket_part_carried),A
AB5C JR collect_pickup_3
collect_pickup_2 AB5E LD A,(IX+$13) An add-on: fit kind+1
AB61 INC A
AB62 LD (part_being_fitted),A
AB65 DEC A
AB66 LD HL,player_places
collect_pickup_3 AB69 ADD A,A Mark it as taken in the player's record
AB6A ADD A,A
AB6B CALL add_a_to_hl
AB6E SET 7,(HL)
AB70 SET 4,(IX+$10) Rub it out this pass and free the record
AB74 LD (IX+$00),$FF
AB78 LD A,(IX+$13) Kind 9, the slab: carry the load again, and empty the other pick-up record (the spire)
AB7B CP $09
AB7D RET NZ
AB7E XOR A
AB7F LD (part_being_fitted),A
AB82 LD (carried_part_facing),A
AB85 LD A,$09
AB87 LD (player_count_nine),A
AB8A LD A,($A89D)
AB8D OR $10
AB8F LD ($A89D),A
AB92 LD HL,place_ten
AB95 SET 7,(HL)
AB97 RET
Prev: AA37 Up: Map Next: AB98