![]() |
Routines |
| Prev: C11D | Up: Map | Next: C1BD |
|
Used by the routine at PLAYER_LEGS.
On a new press of fire (bit 6 of INPUT, latched by FIRE_HELD), takes the first free of the two bolt records (BOLTS and BOLT_SECOND), copies the player's legs into it and makes it graphic 150, moving 8 units a turn the way he faces (BOLT_STEPS), starting 16 units ahead of him and 4 higher. If that start is outside the room's walls -- he stands in a doorway, or faces a wall close up -- the bolt is taken back; otherwise it makes the firing sound (FIRE_SOUND). BOLT flies it.
|
||||||||
| FIRE | C126 | LD HL,BOLTS | the first bolt record | |||||
| C129 | LD A,(INPUT) | fire not pressed: unlatch, and nothing more | ||||||
| C12C | AND $40 | |||||||
| C12E | JR NZ,FIRE_0 | |||||||
| C130 | XOR A | |||||||
| C131 | LD (FIRE_HELD),A | |||||||
| C134 | RET | |||||||
| FIRE_0 | C135 | LD A,(FIRE_HELD) | still held since the last shot: nothing; otherwise latch | |||||
| C138 | AND A | |||||||
| C139 | RET NZ | |||||||
| C13A | INC A | |||||||
| C13B | LD (FIRE_HELD),A | |||||||
| C13E | LD BC,$0020 | the first bolt record if it is empty, else the second; both busy: no shot | ||||||
| C141 | LD A,(HL) | |||||||
| C142 | AND A | |||||||
| C143 | JR Z,FIRE_1 | |||||||
| C145 | ADD HL,BC | |||||||
| C146 | LD A,(HL) | |||||||
| C147 | AND A | |||||||
| C148 | RET NZ | |||||||
| FIRE_1 | C149 | EX DE,HL | IY = the bolt; a copy of the legs' record | |||||
| C14A | PUSH DE | |||||||
| C14B | POP IY | |||||||
| C14D | PUSH IX | |||||||
| C14F | POP HL | |||||||
| C150 | LDIR | |||||||
| C152 | LD (IY+$00),$96 | graphic 150 | ||||||
| C156 | CALL GET_SPRITE_DIR | HL = the step for the way he faces (GET_SPRITE_DIR) in BOLT_STEPS | ||||||
| C159 | LD L,A | |||||||
| C15A | LD H,$00 | |||||||
| C15C | LD DE,BOLT_STEPS | |||||||
| C15F | ADD HL,HL | |||||||
| C160 | ADD HL,DE | |||||||
| C161 | LD A,(HL) | kept at +$14 and +$15, and twice it added to U and V: 16 units ahead | ||||||
| C162 | LD (IY+$14),A | |||||||
| C165 | ADD A,A | |||||||
| C166 | LD E,A | |||||||
| C167 | INC HL | |||||||
| C168 | LD A,(HL) | |||||||
| C169 | LD (IY+$15),A | |||||||
| C16C | ADD A,A | |||||||
| C16D | ADD A,(IY+$02) | |||||||
| C170 | LD (IY+$02),A | |||||||
| C173 | LD A,E | |||||||
| C174 | ADD A,(IY+$01) | |||||||
| C177 | LD (IY+$01),A | |||||||
| C17A | LD A,(IY+$03) | 4 units higher | ||||||
| C17D | ADD A,$04 | |||||||
| C17F | LD (IY+$03),A | |||||||
| C182 | LD (IY+$07),$14 | flags $14 (bits 4 and 2), nothing bumped, half-height 8 | ||||||
| C186 | LD (IY+$0C),$00 | |||||||
| C18A | LD (IY+$06),$08 | |||||||
| C18E | LD HL,(ROOM_EXTENT) | inside the room's walls, as CHK_PLYR_OOB tests... | ||||||
| C191 | LD A,L | |||||||
| C192 | SUB (IY+$04) | |||||||
| C195 | LD L,A | |||||||
| C196 | LD A,H | |||||||
| C197 | SUB (IY+$05) | |||||||
| C19A | LD H,A | |||||||
| C19B | LD A,(IY+$01) | |||||||
| C19E | SUB $80 | |||||||
| C1A0 | JP P,FIRE_2 | |||||||
| C1A3 | NEG | |||||||
| FIRE_2 | C1A5 | CP L | ||||||
| C1A6 | JR NC,FIRE_4 | |||||||
| C1A8 | LD A,(IY+$02) | |||||||
| C1AB | SUB $80 | |||||||
| C1AD | JP P,FIRE_3 | |||||||
| C1B0 | NEG | |||||||
| FIRE_3 | C1B2 | CP H | ||||||
| C1B3 | JR NC,FIRE_4 | |||||||
| C1B5 | JP FIRE_SOUND | ...the firing sound | ||||||
| FIRE_4 | C1B8 | LD (IY+$00),$00 | outside: no bolt after all | |||||
| C1BC | RET | |||||||
| Prev: C11D | Up: Map | Next: C1BD |