Prev: 6BC7 Up: Map Next: 6C02
6BD0: Update Smoke Bomb
Moves a smoke bomb 04 pixels at a time in the direction it was fired. Every sixteen updates it grows into the next size of cloud (types 04 to 06). The bomb is removed if it hits a bug (see CheckWeaponHit) or reaches the edge of the play area.
Input
IX Smoke bomb object
UpdateSmokeBomb 6BD0 CALL StoreEntity Remember the position and state using StoreEntity.
6BD3 LD A,(IX+$05) Jump to RemoveWeapon to remove the bomb if it has hit a bug.
6BD6 AND A
6BD7 JP NZ,RemoveWeapon
6BDA INC (IX+$04) Increment the age of the bomb in IX+04 by one.
6BDD LD A,(IX+$04) A=the age of the bomb.
6BE0 AND %00001111 Keep only bits 0-3 (every sixteenth update).
6BE2 CALL Z,GrowSmokeBomb Call GrowSmokeBomb every sixteen updates.
6BE5 LD A,$04 A=04 (the distance to move).
6BE7 BIT 6,(IX+$00) Jump to UpdateSmokeBomb_Move if the bomb is moving right (bit 6 is not set).
6BEB JR Z,UpdateSmokeBomb_Move
6BED NEG Negate the distance (move left).
UpdateSmokeBomb_Move 6BEF ADD A,(IX+$01) Add the X position of the bomb.
6BF2 CP $18 Jump to RemoveWeapon to remove the bomb if it is past the left edge.
6BF4 JP C,RemoveWeapon
6BF7 CP $D8 Jump to RemoveWeapon to remove the bomb if it is past the right edge.
6BF9 JP NC,RemoveWeapon
6BFC LD (IX+$01),A Write the new X position.
6BFF JP DrawObject Jump to DrawObject to draw the bomb.
Prev: 6BC7 Up: Map Next: 6C02