Prev: AB53 Up: Map Next: ABFF
AB72: Display distant enemies at the center of the screen
display_center_enemies AB72 LD HL,update_counters_countdown Countdown for when to update counters
AB75 DEC (HL) -1
AB76 JP P,display_center_enemies_2 If > 0, then don't update other counters
AB79 LD (HL),$0F Reset to 15
AB7B LD A,(center_y_offset) Y offset
AB7E LD HL,center_y_direction Add direction 1 or -1
AB81 ADD A,(HL) ...
AB82 LD (center_y_offset),A Store y offset
AB85 JP P,display_center_enemies_0 If y counter > 0 then skip ahead
AB88 NEG Else make positive
display_center_enemies_0 AB8A CP $01 If not 1
AB8C JR NZ,display_center_enemies_1 Then skip ahead
AB8E LD A,(HL) IF 1, get direction
AB8F NEG Reverse direction
AB91 LD (HL),A Store direction
AB92 LD A,(center_x_offset) x offset
AB95 INC A +1
AB96 AND $3F Mod 64
AB98 LD (center_x_offset),A Store x offset
display_center_enemies_1 AB9B LD HL,center_enemies_redraw Set flag
AB9E SET 0,(HL) ...
display_center_enemies_2 ABA0 LD A,(center_enemy_processed) Get enemy to process
ABA3 CP $24 If 36,
ABA5 JP Z,display_center_enemies_names Then jump to update name table
ABA8 OR A If 0 then erase all enemies
ABA9 JR NZ,display_center_enemies_3 Else jump ahead
ABAB LD HL,(center_enemies_name_2) Get first name used for center enemies
ABAE LD H,$00 Set MSB to 0
ABB0 ADD HL,HL Multiply by 8
ABB1 ADD HL,HL ...
ABB2 ADD HL,HL ...
ABB3 LD DE,$0000 Add pattern table address
ABB6 ADD HL,DE ...
ABB7 LD (center_enemies_pattern),HL Save VDP address
ABBA LD DE,$0080 Clear 16 patterns
ABBD XOR A ...
ABBE CALL $1F82 FILL_VRAM
ABC1 LD A,(center_enemy_processed) Get enemy to process
display_center_enemies_3 ABC4 LD C,A BC = enemy to process
ABC5 LD B,$00 ...
ABC7 LD HL,center_enemy_map Add map address
ABCA ADD HL,BC ...
ABCB BIT 7,(HL) If unallocated
ABCD JP NZ,display_center_enemies_5 Then update counter and return
ABD0 CALL polar_coord_from_map Now DE contains polar y,x
ABD3 CALL polar_to_screen Convert polar to screen
ABD6 PUSH DE Save screen coordinates
ABD7 LD A,(HL) Get map value
ABD8 RRA Isolate 3 bits
ABD9 RRA ...
ABDA AND $0E ...
ABDC LD C,A And load into BC
ABDD LD B,$00 ...
ABDF LD HL,pixel_offsets_table Add table base address
ABE2 ADD HL,BC ...
ABE3 CALL plot_pixel Plot pixel
ABE6 LD A,(HL) Get x offset
ABE7 OR A If zero
ABE8 JR Z,display_center_enemies_4 Then skip ahead
ABEA ADD A,E Add to screen x
ABEB LD E,A ...
ABEC CALL plot_pixel Plot pixel
display_center_enemies_4 ABEF INC HL Next table address
ABF0 POP DE Restore screen coordinates
ABF1 LD A,(HL) Get y offset
ABF2 OR A If zero
ABF3 JR Z,display_center_enemies_5 Then skip ahead
ABF5 ADD A,D Add to screen x
ABF6 LD D,A ...
ABF7 CALL plot_pixel Plot pixel
display_center_enemies_5 ABFA LD HL,center_enemy_processed Update counter
ABFD INC (HL) ...
ABFE RET
Prev: AB53 Up: Map Next: ABFF