![]() |
Routines |
| Prev: 7628 | Up: Map | Next: 7679 |
|
Used by the routine at Handler_UFO.
Handles the UFO's abduction of Percy. Teleports Percy to the UFO's position while playing a tractor beam sound effect, then on the final frame drops Percy downward.
|
||||||||
| UFO_Abduct_Percy | 7633 | CP $01 | Jump to UFO_Drop_Percy if the abduction timer is equal to 01 (final frame of abduction). | |||||
| 7635 | JR Z,UFO_Drop_Percy | |||||||
|
Play the tractor beam sound effect.
|
||||||||
| 7637 | LD HL,$767F | Point HL at UFO_Tractor_Beam_Pitch (tractor beam sound pitch). | ||||||
| 763A | LD E,(HL) | Load the pitch into E and C. | ||||||
| 763B | LD C,(HL) | |||||||
| Tractor_Beam_SoundStep_Loop | 763C | LD B,E | Copy to B. | |||||
| 763D | LD A,$01 | Set initial speaker state to 01. | ||||||
| Tractor_Beam_Sound_Inner | 763F | NOP | Action a delay loop. | |||||
| 7640 | DJNZ Tractor_Beam_Sound_Inner | |||||||
| 7642 | XOR %00011000 | Toggle the speaker bits and output to the speaker port. | ||||||
| 7644 | OUT ($FE),A | |||||||
| 7646 | DEC C | Decrement C and loop back to Tractor_Beam_SoundStep_Loop until the sound step is complete. | ||||||
| 7647 | JR NZ,Tractor_Beam_SoundStep_Loop | |||||||
| 7649 | LD A,(HL) | Complement and mask the pitch value. | ||||||
| 764A | CPL | |||||||
| 764B | AND %00111111 | |||||||
| 764D | LD (HL),A | Write back to *HL. | ||||||
|
Teleport Percy to the UFO's position.
|
||||||||
| 764E | LD A,(IX+$00) | Copy the UFO's X position to Percy's X at *Percy_X_Position. | ||||||
| 7651 | LD ($DAC0),A | |||||||
| 7654 | LD A,(IX+$01) | Copy the UFO's Y position plus 0A to Percy's Y at *Percy_Y_Position. | ||||||
| 7657 | ADD A,$0A | |||||||
| 7659 | LD ($DAC1),A | |||||||
| 765C | LD A,(IX+$02) | Copy the UFO's sprite active value to Percy's at *Percy_Colour. | ||||||
| 765F | LD ($DAC2),A | |||||||
| 7662 | XOR A | Write 00 to clear *FallingState. | ||||||
| 7663 | LD ($5FA7),A | |||||||
| 7666 | JP CancelEggDrop | Jump to CancelEggDrop. | ||||||
|
Final frame of abduction; drop Percy downward.
|
||||||||
| UFO_Drop_Percy | 7669 | LD A,($DAC1) | Add 14 to Percy's Y position at *Percy_Y_Position. | |||||
| 766C | ADD A,$14 | |||||||
| 766E | LD ($DAC1),A | |||||||
| 7671 | LD ($5FA7),A | Write the result to *FallingState (set collision flag). | ||||||
| 7674 | XOR A | Write 00 to clear *UFO_Abduction_Timer. | ||||||
| 7675 | LD ($767E),A | |||||||
| 7678 | RET | Return. | ||||||
| Prev: 7628 | Up: Map | Next: 7679 |