![]() |
Routines |
| Prev: BA0B | Up: Map | Next: BA2E |
|
Used by the routines at test_landscape_at and ship_pass.
The engine's collision with the ground, for the ship (ship_pass, piece_step_x $FF), the shots' probes (probe_shot, piece_step_x $80) and the objects (test_landscape_at, piece_step_x 0). The record's box -- C pixels wide and B lines high, up from its bottom line -- is placed where its speed would take it (place_collision_box), cut into the parts in each page it overlaps (one, two or four), and each part tested against every box in that page's list (find_page_boxes). scratch_count is non-zero for a hit; for the ship and the objects the speed is also changed, a bounce or a slide.
A box's kind, its +4: if any of bits 2-5 is set it is a solid block (hit_block): bits 4-5 clear make it a floor (bit 2: direction 0 in piece_classes) or a ceiling (bit 3: direction 7), a floor tested only while the record moves down onto it and a ceiling only while it moves up into it (either, too, while it does not move up or down); bit 4 or 5 set makes it a wall, tested by the way it is moving across. If bits 2-5 are all clear it is a slope (hit_slope), its shape tested by test_landscape_piece: bits 0-2 the slope's kind (2 a 45-degree one), bits 6-7 which way it faces.
piece_ceiling keeps track of what has happened this pass: bit 7 a block hit (no more blocks tested), bit 6 a bounce (no more boxes at all), bit 4 a slope hit (no more slopes).
|
||||||||||||||||
| collide_with_landscape | BA21 | XOR A | no hit yet; keep IX; set up the first part | |||||||||||||
| BA22 | LD (scratch_count),A | |||||||||||||||
| BA25 | LD (collision_object),IX | |||||||||||||||
| BA29 | CALL place_collision_box | |||||||||||||||
| BA2C | JR next_part_boxes_0 | |||||||||||||||
| Prev: BA0B | Up: Map | Next: BA2E |