![]() |
Routines |
| Prev: 910A | Up: Map | Next: 917C |
|
Used by the routines at update_objects and beam_hits_ground_object.
The box at collision_box from where the object was drawn this pass (current_object): x, bottom line, width and height. A sprite straddling the left edge of the view (a flag in old_sprite_width) has its x moved in and its width cut, and one running off the right is cut at the right edge ($EE). row_count gets its top line. Nothing is done when it was not drawn (height 0 in old_sprite_x); the height left in D tells test_player_shots the same.
|
||||||||
| object_box | 9143 | LD IY,(current_object) | Drawn at x, bottom line; drawn this wide | |||||
| 9147 | LD L,(IY+$11) | |||||||
| 914A | LD H,(IY+$12) | |||||||
| 914D | LD A,(sprite_width_drawn) | |||||||
| 9150 | LD E,A | |||||||
| 9151 | LD A,(new_sprite_rows) | This high; not drawn: no box | ||||||
| 9154 | LD D,A | |||||||
| 9155 | LD A,D | |||||||
| 9156 | DEC A | |||||||
| 9157 | RET M | |||||||
| 9158 | LD A,(sprite_left_clip) | Straddling the left edge: x moves in by 8 and the width is cut | ||||||
| 915B | AND A | |||||||
| 915C | LD A,L | |||||||
| 915D | JR Z,object_box_0 | |||||||
| 915F | ADD A,E | |||||||
| 9160 | LD L,$08 | |||||||
| 9162 | SUB L | |||||||
| 9163 | LD E,A | |||||||
| 9164 | JR object_box_1 | |||||||
| object_box_0 | 9166 | ADD A,$17 | Running off the right: the width ends at x=$EE | |||||
| 9168 | ADD A,E | |||||||
| 9169 | JR NC,object_box_1 | |||||||
| 916B | LD A,$EE | |||||||
| 916D | SUB L | |||||||
| 916E | LD E,A | |||||||
| object_box_1 | 916F | LD (collision_box),HL | The box | |||||
| 9172 | LD (collision_box_size),DE | |||||||
| 9176 | LD A,H | Its top line | ||||||
| 9177 | SUB D | |||||||
| 9178 | LD (row_count),A | |||||||
| 917B | RET | |||||||
| Prev: 910A | Up: Map | Next: 917C |