Prev: E062 Up: Map Next: E0FD
E08F: Bring in the map's objects for the window's two map columns
Used by the routine at load_map_window.
The things lying in the world are listed column by column: map_objects_per_column holds a count for each map column, map_object_kinds one byte per object (bits 0-5 its kind, bit 7 set once it is gone), and map_object_places two position bytes per object. The index of column view_column's first object is the sum of the counts before it; spawn_objects_from_list brings in that column's objects, then the next column's (right_map_column), restarting at object 0 when the column wraps to 0. Last, slots still free get +$10 cleared.
spawn_column_objects E08F LD A,(view_column) Index of the column's first object, into box_x.
E092 LD B,A
E093 LD HL,$0000
E096 LD DE,map_objects_per_column
E099 AND A
E09A JR Z,spawn_column_objects_1
spawn_column_objects_0 E09C LD A,(DE)
E09D CALL add_a_to_hl
E0A0 INC DE
E0A1 DJNZ spawn_column_objects_0
spawn_column_objects_1 E0A3 LD (box_x),HL
E0A6 ADD HL,HL Object counts of the two columns.
E0A7 EX DE,HL
E0A8 LD A,(HL)
E0A9 LD (left_column_objects),A
E0AC INC HL
E0AD LD A,(HL)
E0AE LD (right_column_objects),A
E0B1 LD IX,map_object_places Pointers to its positions and kinds; bring them in.
E0B5 ADD IX,DE
E0B7 LD DE,map_object_kinds
E0BA LD HL,(box_x)
E0BD ADD HL,DE
E0BE LD A,(view_column)
E0C1 LD C,A
E0C2 LD A,(left_column_objects)
E0C5 LD B,A
E0C6 CALL spawn_objects_from_list
E0C9 LD A,(right_map_column) The next column (from object 0 if it wrapped; that path never ran).
E0CC AND A
E0CD JR NZ,spawn_column_objects_2
E0CF LD HL,$0000
E0D2 LD (box_x),HL
E0D5 LD HL,map_object_kinds
E0D8 LD IX,map_object_places
spawn_column_objects_2 E0DC LD C,A
E0DD LD A,(right_column_objects)
E0E0 LD B,A
E0E1 CALL spawn_objects_from_list
E0E4 LD B,$04 Free slots: +$10 cleared.
E0E6 LD IX,ground_objects
This entry point is used by the routine at load_map_window.
spawn_column_objects_3 E0EA LD DE,$001A
spawn_column_objects_4 E0ED LD A,(IX+$00)
E0F0 CP $FF
E0F2 JR NZ,spawn_column_objects_5
E0F4 LD (IX+$10),$00
spawn_column_objects_5 E0F8 ADD IX,DE
E0FA DJNZ spawn_column_objects_4
E0FC RET }
Prev: E062 Up: Map Next: E0FD