Prev: C863 Up: Map Next: C8C8
C869: Handle Bag
Type 04: a bag falling in the bag stage. A hit adds 0100 to Bounty and removes the bag. Otherwise the speeds in bytes 0A and 0B are added to the position, and the bag is removed if it leaves the screen.
Input
IX The address of the bag
Jump to HandleBag_Hit if the shot has hit the bag.
HandleBag C869 CALL CheckShotHit Call CheckShotHit.
C86C JR C,HandleBag_Hit Jump to HandleBag_Hit if the shot is touching.
Move the bag sideways.
C86E LD L,(IX+$01) Fetch the horizontal position.
C871 LD H,(IX+$02)
C874 LD E,(IX+$0A) Fetch the horizontal speed.
C877 CALL AddSpeedToPosition Call AddSpeedToPosition.
C87A LD A,H Jump to RemoveBag if it is less than 10.
C87B CP $10
C87D JR C,RemoveBag
C87F CP $D8 Jump to RemoveBag if it is D8 or more.
C881 JR NC,RemoveBag
C883 LD (IX+$01),L Set the horizontal position.
C886 LD (IX+$02),H
C889 LD L,H Make the pixel the screen position.
C88A LD H,$00
C88C LD ($A24E),HL Set ScreenHorizontalPosition.
Move the bag down.
C88F LD L,(IX+$03) Fetch the vertical position.
C892 LD H,(IX+$04)
C895 LD E,(IX+$0B) Fetch the vertical speed.
C898 CALL AddSpeedToPosition Call AddSpeedToPosition.
C89B LD A,H Jump to RemoveBag if it is less than 30.
C89C CP $30
C89E JR C,RemoveBag
C8A0 LD (IX+$03),L Set the vertical position.
C8A3 LD (IX+$04),H
C8A6 LD L,H Make the pixel the screen position.
C8A7 LD H,$00
C8A9 LD ($A250),HL Set ScreenVerticalPosition.
C8AC JP DrawScrollingObject_CountDrawn Jump to DrawScrollingObject_CountDrawn.
Add 0100 to the bounty.
HandleBag_Hit C8AF LD BC,$0100 Set BC to 0100.
C8B2 CALL AddToBounty Call AddToBounty.
C8B5 CALL DrawBountyDigits Call DrawBountyDigits.
Play the sound and remove the bag.
HandleBag_PlaySound C8B8 LD A,$04 Set SoundNotesLeft to 04.
C8BA LD ($A23C),A
C8BD LD HL,$AECF Set SoundNoteAddress to SoundEffectNotes_BeforeBag.
C8C0 LD ($A23D),HL
RemoveBag C8C3 LD (IX+$00),$00 Make the type 00 and return.
C8C7 RET
Prev: C863 Up: Map Next: C8C8