| Prev: 6642 | Up: Map | Next: 66CC |
6682: Render player plane sprite
|
Used by the routines at play and scroll_screen.
|
||||
|
Renders the player's plane at its current position. Only executes in GAMEPLAY_MODE_NORMAL; returns immediately in other modes (scroll-in, overview, refuel).
Sets COLLISION_MODE_FUEL_DEPOT so the collision system checks for fuel depot contact during rendering. Backs up missile coordinates to state_plane_missile_y_backup before modifying them for collision detection.
Selects between normal sprite (sprite_plane) and banked sprite (sprite_plane_banked) based on state_plane_sprite_bank. Player 2 uses different attributes (same as ship).
|
||||
| render_plane | 6682 | LD A,($5F68) | Return if not in GAMEPLAY_MODE_NORMAL. | |
| 6685 | CP $00 | |||
| 6687 | RET NZ | |||
| 6688 | LD A,($5F72) | Backup missile coords to state_plane_missile_y_backup; set up plane position (Y=$80, X from state_plane_x). | ||
| 668B | LD HL,($5EF3) | |||
| 668E | LD ($5F8F),HL | |||
| 6691 | LD C,A | Set COLLISION_MODE_FUEL_DEPOT and store plane coords. | ||
| 6692 | LD B,$80 | |||
| 6694 | LD A,$01 | |||
| 6696 | LD ($5EF5),A | |||
| 6699 | LD ($8B0C),BC | |||
| 669D | CALL advance_object | Calculate previous position for sprite erasure. | ||
| 66A0 | LD ($8B0A),BC | |||
| 66A4 | LD BC,$0010 | Set frame size and sprite pointer from ptr_plane_sprite. | ||
| 66A7 | LD HL,($5EF7) | |||
| 66AA | LD ($8B0E),HL | |||
| 66AD | LD E,$0E | Set attributes; call ld_attributes_ship for Player 2 (uses ship attributes). | ||
| 66AF | LD A,($923D) | |||
| 66B2 | CP $02 | |||
| 66B4 | CALL Z,ld_attributes_ship | |||
| 66B7 | LD D,$08 | Set height, load sprite base; if bank=$04, use sprite_plane_banked. | ||
| 66B9 | LD HL,$83B1 | |||
| 66BC | LD A,($5F69) | |||
| 66BF | CP $04 | |||
| 66C1 | CALL Z,ld_sprite_plane_banked | |||
| 66C4 | LD A,$02 | Set width and call render_object to render. | ||
| 66C6 | CALL render_object | |||
| 66C9 | JP restore_plane_state_after_render | Restore state. | ||
| Prev: 6642 | Up: Map | Next: 66CC |