Prev: 27504 Up: Map Next: 27591
27557: Create Weapon
Used by the routines at FireRepellentSpray and FireStreamer.
Writes the position and the colour of a new weapon into its object and plays the sound for the type of the weapon. The weapon starts 12 pixels above Robbie.
Input
A The X position of the weapon
B The colour of the weapon
DE State_Robbie_Pos_X (the X position of Robbie)
HL The weapon object (which has the state already written)
CreateWeapon 27557 INC HL Move onto the X position of the weapon.
27558 LD (HL),A Write the X position.
27559 INC DE Move onto the Y position of Robbie.
27560 INC HL Move onto the Y position of the weapon.
27561 LD A,(DE) A=the Y position of Robbie.
27562 SUB 12 Subtract 12.
27564 LD (HL),A Write the Y position.
27565 INC HL Move onto the colour of the weapon.
27566 LD (HL),B Write the colour.
27567 INC HL Move onto IX+4 of the weapon.
27568 XOR A A=0.
27569 LD (HL),A Write 0 to IX+4.
27570 INC HL Move onto IX+5 of the weapon (the "hit" flag).
27571 LD (HL),A Write 0 to IX+5.
27572 LD HL,(24092) HL=the weapon object from FreeWeaponSlot.
27575 LD A,(HL) A=the state of the weapon.
27576 AND %00111111 Keep only bits 0-5 (the type of the weapon).
27578 CP 8 Jump to PlayRepellentSound to play the repellent sound if it matches.
27580 JP Z,PlayRepellentSound
27583 CP 18 Jump to PlayStreamerSound to play the streamer sound if it matches.
27585 JP Z,PlayStreamerSound
27588 JP PlaySmokeSound Jump to PlaySmokeSound to play the smoke sound.
Prev: 27504 Up: Map Next: 27591