Prev: 27591 Up: Map Next: 27650
27600: Update Smoke Bomb
Moves a smoke bomb 4 pixels at a time in the direction it was fired. Every sixteen updates it grows into the next size of cloud (types 4 to 6). 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 27600 CALL StoreEntity Remember the position and state using StoreEntity.
27603 LD A,(IX+5) Jump to RemoveWeapon to remove the bomb if it has hit a bug.
27606 AND A
27607 JP NZ,RemoveWeapon
27610 INC (IX+4) Increment the age of the bomb in IX+4 by one.
27613 LD A,(IX+4) A=the age of the bomb.
27616 AND %00001111 Keep only bits 0-3 (every sixteenth update).
27618 CALL Z,GrowSmokeBomb Call GrowSmokeBomb every sixteen updates.
27621 LD A,4 A=4 (the distance to move).
27623 BIT 6,(IX+0) Jump to UpdateSmokeBomb_Move if the bomb is moving right (bit 6 is not set).
27627 JR Z,UpdateSmokeBomb_Move
27629 NEG Negate the distance (move left).
UpdateSmokeBomb_Move 27631 ADD A,(IX+1) Add the X position of the bomb.
27634 CP 24 Jump to RemoveWeapon to remove the bomb if it is past the left edge.
27636 JP C,RemoveWeapon
27639 CP 216 Jump to RemoveWeapon to remove the bomb if it is past the right edge.
27641 JP NC,RemoveWeapon
27644 LD (IX+1),A Write the new X position.
27647 JP DrawObject Jump to DrawObject to draw the bomb.
Prev: 27591 Up: Map Next: 27650