![]() |
Routines |
| Prev: 26243 | Up: Map | Next: 26337 |
|
Used by the routine at Handler_Worms.
A worm was found at Percy's position; check if Percy is low enough to collect it and not already carrying one.
|
||||||||
| Handler_Worm_Found | 26280 | LD A,(IX+1) | Jump to Animate_Worm if Percy's Y position is less than 121 (not low enough to pick up the worm). | |||||
| 26283 | CP 121 | |||||||
| 26285 | JR C,Animate_Worm | |||||||
| 26287 | LD A,(24490) | Jump to Animate_Worm if *CarryingWormFlag is set (so Percy is already carrying a worm). | ||||||
| 26290 | OR A | |||||||
| 26291 | JR NZ,Animate_Worm | |||||||
|
Percy is in position and not carrying; collect the worm.
|
||||||||
| 26293 | OR %11111111 | Set *CarryingWormFlag to 255 (mark Percy as carrying a worm). | ||||||
| 26295 | LD (24490),A | |||||||
| 26298 | PUSH DE | Stash the position, worm counter and room attribute pointer on the stack. | ||||||
| 26299 | PUSH BC | |||||||
| 26300 | PUSH HL | |||||||
| 26301 | DEC HL | Move back three bytes in the room attribute data and write 30 to mark this worm as collected. | ||||||
| 26302 | DEC HL | |||||||
| 26303 | DEC HL | |||||||
| 26304 | LD (HL),30 | |||||||
| 26306 | PUSH IX | Stash IX on the stack. | ||||||
|
|
||||||||
| 26308 | LD DE,100 | Play a two-part collection sound effect by calling BEEP with durations of 0100/ 0200 then 0100/ 0100. | ||||||
| 26311 | LD HL,200 | |||||||
| 26314 | CALL 949 | |||||||
| 26317 | LD HL,100 | |||||||
| 26320 | LD DE,100 | |||||||
| 26323 | CALL 949 | |||||||
| 26326 | POP IX | Restore IX, the room attribute pointer, worm counter and position from the stack. | ||||||
| 26328 | POP HL | |||||||
| 26329 | POP BC | |||||||
| 26330 | POP DE | |||||||
| 26331 | XOR A | Write 0 to clear *EggDropFlag. | ||||||
| 26332 | LD (24489),A | |||||||
| 26335 | JR Next_Worm_Entry | Jump to Next_Worm_Entry to continue scanning. | ||||||
| Prev: 26243 | Up: Map | Next: 26337 |