Prev: 27059 Up: Map Next: 27099
27067: Fire Streamer
Used by the routine at FireWeapon.
Starts a streamer in the weapon slot held in FreeWeaponSlot, in front of Robbie. It is not fired if Robbie is too close to the edge of the play area. The colour of the streamer is chosen at random.
Input
DE State_Robbie_Colour (the colour of Robbie)
HL The weapon object
FireStreamer 27067 CALL GetRobbieDirection Get the X position and the direction using GetRobbieDirection.
27070 JR Z,FireStreamer_Right Jump to FireStreamer_Right if the streamer goes to the right.
27072 CP 56 Return if Robbie is too close to the left edge.
27074 RET C
27075 SUB 12 Subtract 12 from the X position (so it starts to the left of Robbie).
27077 LD (HL),82 Write 82 (a streamer moving left) to the state of the weapon.
This entry point is used by the routine at FireStreamer_Right.
FireStreamer_Colour 27079 PUSH AF Stash the X position on the stack.
27080 PUSH HL Stash the weapon object on the stack.
27081 LD A,(24089) A=the random number from RandomNumber.
27084 AND %00000011 Keep only bits 0-1 (a random colour number from 0 to 3).
27086 LD C,A C=the random colour number.
27087 LD B,0 Clear the high byte of the offset in B.
27089 LD HL,27099 HL=StreamerColours.
27092 ADD HL,BC Add the offset to find the colour in the table.
27093 LD B,(HL) B=the colour of the streamer.
27094 POP HL Restore the weapon object from the stack.
27095 POP AF Restore the X position from the stack.
27096 JP CreateWeapon Jump to CreateWeapon to create the weapon.
Prev: 27059 Up: Map Next: 27099