Prev: 39650 Up: Map Next: 39971
39867: Handler: The Pip
Move the shot with its horizontal speed and test whether it has hit.
Input
IX Actor slot
Handler_ThePip 39867 LD H,(IX+3) Fetch the high byte of the world X.
39870 LD L,(IX+2) Fetch the low byte of the world X.
39873 LD DE,(24698) Fetch Jetman_Position.
39877 AND A Subtract the scroll position.
39878 SBC HL,DE
39880 BIT 7,(IX+5) Jump to Handler_ThePip_ShotStillOnScreen if the horizontal speed is negative.
39884 JR NZ,Handler_ThePip_ShotStillOnScreen
39886 LD A,H Fetch the high byte of the gap.
39887 AND %00011111 Keep only bits 0-4.
39889 CP 1 Jump to Handler_ThePip_ShotClearType if the shot has left the screen.
39891 JR Z,Handler_ThePip_ShotClearType
Move the shot along its horizontal speed.
Handler_ThePip_MoveShotX 39893 LD H,(IX+3) Fetch the high byte of the world X.
39896 LD L,(IX+2) Fetch the low byte of the world X.
Turn the horizontal speed into a signed pixel step.
39899 LD A,(IX+5) Fetch the horizontal speed.
39902 LD D,0 Clear D for a positive step.
39904 SRA A Divide it by 16.
39906 SRA A
39908 SRA A
39910 SRA A
39912 JP P,Handler_ThePip_AddShotStep Jump to Handler_ThePip_AddShotStep if the speed is positive.
39915 LD D,255 Set D=255 for a negative step.
Handler_ThePip_AddShotStep 39917 LD E,A Store the pixel step in E.
Add the step to the world X, keep it in range and write it back.
39918 ADD HL,DE Add the step to the world X.
39919 LD A,H Fetch the high byte.
39920 AND %00011111 Keep only bits 0-4.
39922 LD (IX+3),A Write the high byte back.
39925 LD (IX+2),L Write the low byte back.
Draw the shot and colour its sprite.
39928 CALL DrawObjectSprite Call DrawObjectSprite.
39931 CALL ColouriseSprite Call ColouriseSprite.
39934 BIT 0,(IX+16) Jump to Handler_ThePip_ShotHit if bit 0 of *IX+16 is reset.
39938 JR Z,Handler_ThePip_ShotHit
39940 LD BC,80 Set the points to award in BC to 0080.
39943 CALL AddPointsToScore Call AddPointsToScore.
39946 CALL StartSmallExplosion Call StartSmallExplosion.
Test whether the shot has hit Jetman, and kill him if so.
Handler_ThePip_ShotHit 39949 CALL TickThenExplode_CloseRange Return if TickThenExplode_CloseRange does not set carry.
39952 RET NC
39953 CALL StartSmallExplosion Call StartSmallExplosion.
39956 JP TickThenExplode_KillJetman Jump to TickThenExplode_KillJetman.
Handler_ThePip_ShotStillOnScreen 39959 LD A,H Fetch the high byte of the gap.
39960 OR %11100000 Set bits 5-7.
39962 CP 254 Jump to Handler_ThePip_MoveShotX if the shot has not left the left edge.
39964 JR NZ,Handler_ThePip_MoveShotX
Handler_ThePip_ShotClearType 39966 LD (IX+0),0 Write 0 to the actor type.
39970 RET Return.
Prev: 39650 Up: Map Next: 39971