Prev: B944 Up: Map Next: B97A
B946: Find the list of landscape boxes for a page
Used by the routine at place_collision_box.
The landscape's collision boxes are kept page by page: the world is a ring of $60 pages across, each 224 pixels wide (x 8 to $E7), and a stack of pages down, each 160 lines high (y $18 to $B7). The screen shows parts of four at once, and draw_landscape builds a list of boxes for each of them in the four work areas: loader_entry for the view's page (view_column across, view_row down), ground_cell_bottom_left for the one below it, ground_cell_top_right for the one to its right, ground_cell_bottom_right for the one below and right. This finds the list for page D across, B down; a page off the screen gets the empty list at empty_box_list.
Each list is a count, then five bytes a box: +0 its left x, +1 its bottom line, +2 its width, +3 its height (or, for a slope, its other edge's line), +4 its kind (see collide_with_landscape).
Input
B the page down
D the page across
Output
IX the list
F Z if found
find_page_boxes B946 LD E,B E = the page down
B947 LD IX,loader_entry the view's page
B94B LD BC,(view_column)
B94F CALL page_matches
B952 RET Z
B953 LD IX,ground_cell_bottom_left the one below
B957 INC B
B958 CALL page_matches
B95B RET Z
B95C LD IX,ground_cell_bottom_right the one below and right (across wraps at $60)
B960 INC C
B961 LD A,C
B962 CP $60
B964 JR NZ,find_page_boxes_0
B966 LD C,$00
find_page_boxes_0 B968 CALL page_matches
B96B RET Z
B96C DEC B the one to the right
B96D LD IX,ground_cell_top_right
B971 CALL page_matches
B974 RET Z
B975 LD IX,empty_box_list none: the empty list
B979 RET
Prev: B944 Up: Map Next: B97A