Prev: 27103 Up: Map Next: 27185
27112: Update Streamer
Moves a streamer 8 pixels at a time in the direction it was fired. The streamer alternates between two sprites as it travels, and is removed if it hits a bug (see CheckWeaponHit) or reaches the edge of the play area.
Input
IX Streamer object
UpdateStreamer 27112 CALL StoreEntity Remember the position and state using StoreEntity.
27115 LD A,(IX+5) Jump to RemoveStreamer to remove the streamer if it has hit a bug.
27118 AND A
27119 JR NZ,RemoveStreamer
27121 LD A,8 A=8 (the distance to move).
27123 BIT 6,(IX+0) Jump to UpdateStreamer_Move if the streamer is moving right (bit 6 is not set).
27127 JR Z,UpdateStreamer_Move
27129 NEG Negate the distance (move left).
UpdateStreamer_Move 27131 ADD A,(IX+1) Add the X position of the streamer.
27134 CP 24 Jump to RemoveStreamer to remove the streamer if it is past the left edge.
27136 JR C,RemoveStreamer
27138 CP 224 Jump to RemoveStreamer to remove the streamer if it is past the right edge.
27140 JR NC,RemoveStreamer
27142 LD (IX+1),A Write the new X position.
Choose the sprite for the new position, using bit 3 of the X position.
27145 AND 8 Jump to UpdateStreamer_SecondSprite if bit 3 of the X position is not set.
27147 JR Z,UpdateStreamer_SecondSprite
27149 LD DE,31121 DE=Sprite_Streamer_1 (the first sprite).
UpdateStreamer_Draw 27152 CALL SetUpSprite_Address Set up the new sprite using SetUpSprite_Address.
27155 EXX Switch to the shadow registers.
Choose the sprite for the previous position in the same way.
27156 LD A,(24075) A=the previous X position from Actor.
27159 AND 8 Jump to UpdateStreamer_PreviousSecondSprite if bit 3 of the previous X position is not set.
27161 JR Z,UpdateStreamer_PreviousSecondSprite
27163 LD DE,31121 DE=Sprite_Streamer_1 (the first sprite).
UpdateStreamer_Previous 27166 CALL SetUpPreviousSprite_Address Set up the previous sprite using SetUpPreviousSprite_Address.
27169 CALL DisplayEntity_Compare Erase the previous sprite and draw the new one using DisplayEntity_Compare.
27172 JP ColouriseSprite Jump to ColouriseSprite to colour the sprite.
UpdateStreamer_SecondSprite 27175 LD DE,31138 DE=Sprite_Streamer_2 (the second sprite).
27178 JR UpdateStreamer_Draw Jump to UpdateStreamer_Draw.
UpdateStreamer_PreviousSecondSprite 27180 LD DE,31138 DE=Sprite_Streamer_2 (the second sprite).
27183 JR UpdateStreamer_Previous Jump to UpdateStreamer_Previous.
Prev: 27103 Up: Map Next: 27185