![]() |
Routines |
| Prev: 814B | Up: Map | Next: 81DB |
|
Sets the weapon's velocity from the direction the player is facing: +4, -4 or nothing on each axis, taken from the sign of +$06 and +$07. A shot therefore travels four pixels a frame along whichever axes the player was moving on, and a diagonal shot moves on both.
Confirmed live -- firing and reading the weapon's velocity field back gives exactly $04 and $FC, and the shot's x walks across the room four pixels at a time.
|
||||||||
| FIRE_WEAPON | 817C | LD HL,$EA9E | The weapon's velocity field, +$0E of the player's record. | |||||
| 817F | LD A,$30 | A lifetime of 48 frames, in +$0F of the weapon's record (WEAPON_LIFE, which lies in the sound slot's unused tail). | ||||||
| 8181 | LD ($EAA7),A | |||||||
| 8184 | LD A,$00 | And clear its contact flag. | ||||||
| 8186 | LD ($EA9A),A | |||||||
| 8189 | LD A,(IX+$06) | Standing still: nothing to fire along. | ||||||
| 818C | OR (IX+$07) | |||||||
| 818F | JR Z,FIRE_WEAPON_4 | |||||||
| 8191 | LD A,(IX+$06) | Which way on this axis? | ||||||
| 8194 | AND A | |||||||
| 8195 | JR Z,FIRE_WEAPON_1 | |||||||
| 8197 | JP M,FIRE_WEAPON_0 | |||||||
| 819A | LD A,$04 | Right or down. | ||||||
| 819C | JR FIRE_WEAPON_1 | |||||||
| FIRE_WEAPON_0 | 819E | LD A,$FC | Left or up: $FC is minus four. | |||||
| FIRE_WEAPON_1 | 81A0 | LD (HL),A | Store it and do the other axis the same way. | |||||
| 81A1 | INC HL | |||||||
| 81A2 | LD A,(IX+$07) | |||||||
| 81A5 | AND A | |||||||
| 81A6 | JR Z,FIRE_WEAPON_3 | |||||||
| 81A8 | JP M,FIRE_WEAPON_2 | |||||||
| 81AB | LD A,$04 | |||||||
| 81AD | JR FIRE_WEAPON_3 | |||||||
| FIRE_WEAPON_2 | 81AF | LD A,$FC | ||||||
| FIRE_WEAPON_3 | 81B1 | LD (HL),A | ||||||
| 81B2 | RET | |||||||
| FIRE_WEAPON_4 | 81B3 | LD A,(IX+$00) | ||||||
| 81B6 | DEC A | |||||||
| 81B7 | AND $0C | |||||||
| 81B9 | JR Z,FIRE_WEAPON_5 | |||||||
| 81BB | CP $04 | |||||||
| 81BD | JR Z,FIRE_WEAPON_6 | |||||||
| 81BF | CP $08 | |||||||
| 81C1 | JR NZ,FIRE_WEAPON_7 | |||||||
| 81C3 | LD (HL),$00 | |||||||
| 81C5 | INC HL | |||||||
| 81C6 | LD (HL),$FC | |||||||
| 81C8 | RET | |||||||
| FIRE_WEAPON_5 | 81C9 | LD (HL),$FC | ||||||
| 81CB | INC HL | |||||||
| 81CC | LD (HL),$00 | |||||||
| 81CE | RET | |||||||
| FIRE_WEAPON_6 | 81CF | LD (HL),$04 | ||||||
| 81D1 | INC HL | |||||||
| 81D2 | LD (HL),$00 | |||||||
| 81D4 | RET | |||||||
| FIRE_WEAPON_7 | 81D5 | LD (HL),$00 | ||||||
| 81D7 | INC HL | |||||||
| 81D8 | LD (HL),$04 | |||||||
| 81DA | RET | |||||||
| Prev: 814B | Up: Map | Next: 81DB |