Prev: 9AE2 Up: Map Next: 9C23
9BBB: Handler: The Pip
Move the shot with its horizontal speed and test whether it has hit.
Input
IX Actor slot
Handler_ThePip 9BBB LD H,(IX+$03) Fetch the high byte of the world X.
9BBE LD L,(IX+$02) Fetch the low byte of the world X.
9BC1 LD DE,($607A) Fetch Jetman_Position.
9BC5 AND A Subtract the scroll position.
9BC6 SBC HL,DE
9BC8 BIT 7,(IX+$05) Jump to Handler_ThePip_ShotStillOnScreen if the horizontal speed is negative.
9BCC JR NZ,Handler_ThePip_ShotStillOnScreen
9BCE LD A,H Fetch the high byte of the gap.
9BCF AND %00011111 Keep only bits 0-4.
9BD1 CP $01 Jump to Handler_ThePip_ShotClearType if the shot has left the screen.
9BD3 JR Z,Handler_ThePip_ShotClearType
Move the shot along its horizontal speed.
Handler_ThePip_MoveShotX 9BD5 LD H,(IX+$03) Fetch the high byte of the world X.
9BD8 LD L,(IX+$02) Fetch the low byte of the world X.
Turn the horizontal speed into a signed pixel step.
9BDB LD A,(IX+$05) Fetch the horizontal speed.
9BDE LD D,$00 Clear D for a positive step.
9BE0 SRA A Divide it by 10.
9BE2 SRA A
9BE4 SRA A
9BE6 SRA A
9BE8 JP P,Handler_ThePip_AddShotStep Jump to Handler_ThePip_AddShotStep if the speed is positive.
9BEB LD D,$FF Set D=FF for a negative step.
Handler_ThePip_AddShotStep 9BED LD E,A Store the pixel step in E.
Add the step to the world X, keep it in range and write it back.
9BEE ADD HL,DE Add the step to the world X.
9BEF LD A,H Fetch the high byte.
9BF0 AND %00011111 Keep only bits 0-4.
9BF2 LD (IX+$03),A Write the high byte back.
9BF5 LD (IX+$02),L Write the low byte back.
Draw the shot and colour its sprite.
9BF8 CALL DrawObjectSprite Call DrawObjectSprite.
9BFB CALL ColouriseSprite Call ColouriseSprite.
9BFE BIT 0,(IX+$10) Jump to Handler_ThePip_ShotHit if bit 0 of *IX+10 is reset.
9C02 JR Z,Handler_ThePip_ShotHit
9C04 LD BC,$0050 Set the points to award in BC to 0050.
9C07 CALL AddPointsToScore Call AddPointsToScore.
9C0A CALL StartSmallExplosion Call StartSmallExplosion.
Test whether the shot has hit Jetman, and kill him if so.
Handler_ThePip_ShotHit 9C0D CALL TickThenExplode_CloseRange Return if TickThenExplode_CloseRange does not set carry.
9C10 RET NC
9C11 CALL StartSmallExplosion Call StartSmallExplosion.
9C14 JP TickThenExplode_KillJetman Jump to TickThenExplode_KillJetman.
Handler_ThePip_ShotStillOnScreen 9C17 LD A,H Fetch the high byte of the gap.
9C18 OR %11100000 Set bits 5-7.
9C1A CP $FE Jump to Handler_ThePip_MoveShotX if the shot has not left the left edge.
9C1C JR NZ,Handler_ThePip_MoveShotX
Handler_ThePip_ShotClearType 9C1E LD (IX+$00),$00 Write 00 to the actor type.
9C22 RET Return.
Prev: 9AE2 Up: Map Next: 9C23