| Prev: 8B1E | Up: Map | Next: 8B70 |
8B3C: Render an object with collision detection.
|
Two-phase rendering pipeline: (1) erase old sprite at previous_object_coordinates using XOR blending, (2) draw new sprite at object_coordinates using OR blending, checking for pixel collisions during the draw phase. Sprite frame is selected from E's lower bits for sub-pixel alignment.
|
||||||||||||||||
| render_object | 8B3C | PUSH DE | Store width and set screen attributes for the sprite area. | |||||||||||||
| 8B3D | LD ($8B1A),A | |||||||||||||||
| 8B40 | NOP | |||||||||||||||
| 8B41 | CALL set_sprite_attributes | |||||||||||||||
| 8B44 | LD A,E | Select sprite frame from E's lower bits (sub-pixel alignment). | ||||||||||||||
| 8B45 | AND $07 | |||||||||||||||
| 8B47 | SRL A | |||||||||||||||
| 8B49 | INC A | |||||||||||||||
| 8B4A | OR A | |||||||||||||||
| 8B4B | SBC HL,BC | |||||||||||||||
| render_object_frame_loop | 8B4D | ADD HL,BC | ||||||||||||||
| 8B4E | DEC A | |||||||||||||||
| 8B4F | JR NZ,render_object_frame_loop | |||||||||||||||
| 8B51 | LD ($8B10),HL | Store selected frame pointer for both erase and draw passes. | ||||||||||||||
| 8B54 | LD ($8B16),HL | |||||||||||||||
| 8B57 | POP DE | |||||||||||||||
|
This entry point is used by the routine at render_explosions.
|
||||||||||||||||
| render_object_entry | 8B58 | PUSH DE | Calculate screen addresses for new and old positions. | |||||||||||||
| 8B59 | LD BC,($8B0C) | |||||||||||||||
| 8B5D | CALL calculate_pixel_address | |||||||||||||||
| 8B60 | LD ($8B12),HL | |||||||||||||||
| 8B63 | LD BC,($8B0A) | |||||||||||||||
| 8B67 | CALL calculate_pixel_address | |||||||||||||||
| 8B6A | LD ($8B14),HL | |||||||||||||||
| 8B6D | JP adjust_old_screen_third_loop | Jump to render loop. | ||||||||||||||
| Prev: 8B1E | Up: Map | Next: 8B70 |