Prev: AAF1 Up: Map Next: AB53
AB38: Sprite coordinates from map
Returns polar sprite coordinates from an entry in the map. Used by the routines at move_towards_center_1, handle_shot_collision, create_sprite_from_map_entry_1 and display_center_enemies.
Input
HL Map address
Output
D Polar y
E Polar x
polar_coord_from_map AB38 PUSH HL Save map address
AB39 LD DE,center_enemy_map Base address of map
AB3C OR A Clear carry
AB3D SBC HL,DE Map address - map base (offset 0 - 35)
AB3F ADD HL,HL x2 = offset
AB40 LD DE,start_coordinates_table Table address
AB43 ADD HL,DE Add offset
AB44 LD A,(center_x_offset) Get x offset
AB47 ADD A,(HL) Add table value
AB48 AND $3F Mod 64
AB4A LD E,A Store in E
AB4B INC HL Next table address
AB4C LD A,(center_y_offset) Get y offset
AB4F ADD A,(HL) Add table value
AB50 LD D,A Store in D
AB51 POP HL Restore map address
AB52 RET
Prev: AAF1 Up: Map Next: AB53