Prev: 762E Up: Map Next: 76AC
7649: Operate balloon movement and rendering.
Moves a balloon horizontally, checking for terrain collisions. Balloons bounce off riverbanks by reversing direction.
Input
B Y position
C X position
D Object definition (bit 6 = orientation: 0=right, 1=left)
operate_balloon 7649 BIT 7,B If balloon is off-screen (Y bit 7 set), skip to main loop.
764B JP NZ,jp_operate_viewport_slots
764E LD A,($5EEF) Only operate every 4th frame (frame counter AND 3 == 1). Check orientation.
7651 AND $03
7653 CP $01
7655 JP NZ,jp_operate_viewport_slots
7658 BIT 6,D
765A JP Z,operate_balloon_right
765D PUSH BC Left-facing: Check terrain 16 pixels left of sprite origin (top row). Reverse on collision.
765E LD A,C
765F SUB $10
7661 LD C,A
7662 CALL calculate_pixel_address
7665 LD A,(HL)
7666 POP BC
7667 CP $00
7669 CALL NZ,reverse_balloon_direction
766C PUSH BC Check terrain 16 pixels left, 8 pixels down (bottom row). Reverse on collision.
766D LD A,C
766E SUB $10
7670 LD C,A
7671 LD A,B
7672 ADD A,$08
7674 LD B,A
7675 CALL calculate_pixel_address
7678 LD A,(HL)
7679 POP BC
767A CP $00
767C CALL NZ,reverse_balloon_direction
767F LD ($8B0A),BC Save position, move left by 2 pixels.
7683 DEC C
7684 DEC C
Shared entry point for balloon rendering (also used by right-facing balloon).
operate_balloon_shared 7685 LD HL,($5F60) Read object definition from viewport, write updated position back.
7688 DEC HL
7689 LD D,(HL)
768A DEC HL
768B LD (HL),B
768C DEC HL
768D LD (HL),C
768E LD ($8B0C),BC Store render position and load balloon sprite pointer.
7692 LD HL,$8972
7695 LD A,($5EEF) Calculate frame offset from frame counter (unused - overwritten below).
7698 AND $03
769A ADD A,$0C
769C LD E,A
769D LD A,$02
769F LD BC,$0020
76A2 LD E,$0E
76A4 LD D,$10
76A6 CALL render_sprite Render balloon, return to main loop.
76A9 JP operate_viewport_slots
Prev: 762E Up: Map Next: 76AC