Routines |
Prev: EED7 | Up: Map | Next: F104 |
Used by the routine at InitialiseGame.
|
||||
See No Pirates.
|
||||
Handler_Pirates | F001 | LD A,($F334) | Return if *LiftsPiratesFrameSkip is equal to 00. | |
F004 | CP $00 | |||
F006 | RET Z | |||
F007 | LD HL,$8E28 | Write 8E28 (Graphics_Pirate) to *CHARS. | ||
F00A | LD ($5C36),HL | |||
F00D | LD IX,($5BDE) | IX=*ReferencePirate. | ||
Handler_Pirates_Loop | F011 | LD A,(IX+$00) | Return if Pirate state (*IX+00) is equal to OFF (FF). | |
F014 | CP $FF | |||
F016 | RET Z | |||
F017 | LD A,$10 | Set INK: Pirate attribute (*IX+09). | ||
F019 | RST $10 | |||
F01A | LD A,(IX+$09) | |||
F01D | RST $10 | |||
Update the sprite frame.
|
||||
F01E | LD A,(IX+$06) | Fetch the current Pirate sprite reference (*IX+06). | ||
F021 | ADD A,$06 | Add 06. | ||
F023 | LD (IX+$06),A | Write it back to the current Pirate sprite reference (*IX+06). | ||
F026 | CP $4A | Jump to Handler_Pirates_CheckSpriteFrames if A is not equal to 4A. | ||
F028 | JR NZ,Handler_Pirates_CheckSpriteFrames | |||
F02A | LD (IX+$06),$20 | Write 20 (facing right) to Pirate sprite reference (*IX+06). | ||
Handler_Pirates_CheckSpriteFrames | F02E | CP $80 | Jump to Handler_Pirates_SkipSpriteFrames if A is not equal to 80. | |
F030 | JR NZ,Handler_Pirates_SkipSpriteFrames | |||
F032 | LD (IX+$06),$50 | Write 50 (facing left) to Pirate sprite reference (*IX+06). | ||
Handler_Pirates_SkipSpriteFrames | F036 | CALL $EEA6 | Call EEA6. | |
F039 | LD A,C | Jump to Handler_Pirate_TurnRight if C is equal to 22. | ||
F03A | CP $22 | |||
F03C | JP Z,Handler_Pirate_TurnRight | |||
F03F | CP $03 | Jump to Handler_Pirate_TurnLeft if C is equal to 03. | ||
F041 | JP Z,Handler_Pirate_TurnLeft | |||
F044 | PUSH DE | Stash DE and BC on the stack. | ||
F045 | PUSH BC | |||
F046 | LD A,(IX+$04) | Jump to Handler_Pirates_0 if the direction the Pirate is moving (*IX+04) is not right (FF). | ||
F049 | CP $FF | |||
F04B | JR NZ,Handler_Pirates_0 | |||
F04D | DEC C | Decrease C by two. | ||
F04E | DEC C | |||
Handler_Pirates_0 | F04F | CALL $F1AF | Call F1AF. | |
F052 | POP BC | Restore BC and DE from the stack. | ||
F053 | POP DE | |||
F054 | CP $FF | Jump to Pirate_TurnController if A is not equal to FF. | ||
F056 | JP NZ,Pirate_TurnController | |||
F059 | PUSH BC | Stash BC and DE on the stack. | ||
F05A | PUSH DE | |||
F05B | DEC B | Decrease B by three. | ||
F05C | DEC B | |||
F05D | DEC B | |||
F05E | LD A,(IX+$04) | Jump to Handler_Pirates_1 if the direction the Pirate is moving (*IX+04) is not right (FF). | ||
F061 | CP $FF | |||
F063 | JR NZ,Handler_Pirates_1 | |||
F065 | DEC C | Decrease C by two. | ||
F066 | DEC C | |||
Handler_Pirates_1 | F067 | CALL ConvertCoordinateToBufferOffset | Call ConvertCoordinateToBufferOffset. | |
F06A | LD HL,$A1C4 | HL=BufferRoom. | ||
F06D | LD DE,($F330) | DE=*BufferRoomPointer. | ||
F071 | ADD HL,DE | HL+=DE. | ||
F072 | POP DE | Restore DE and BC from the stack. | ||
F073 | POP BC | |||
F074 | LD A,(HL) | Jump to Pirate_TurnController if *HL is lower than 21. | ||
F075 | CP $21 | |||
F077 | JP C,Pirate_TurnController | |||
F07A | LD (IX+$00),C | Write C to *IX+00. | ||
F07D | LD (IX+$01),B | Write B to *IX+01. | ||
F080 | LD (IX+$02),E | Write E to *IX+02. | ||
F083 | LD (IX+$03),D | Write D to *IX+03. | ||
F086 | CALL $E9E2 | Call E9E2. | ||
Handler_Pirates_2 | F089 | CALL $EED7 | Call EED7. | |
F08C | LD A,(IX+$00) | Write *IX+00 to *IX+0D. | ||
F08F | LD (IX+$0D),A | |||
F092 | LD A,(IX+$01) | Write *IX+01 to *IX+0E. | ||
F095 | LD (IX+$0E),A | |||
F098 | LD A,(IX+$02) | Write *IX+02 to *IX+0B. | ||
F09B | LD (IX+$0B),A | |||
F09E | LD A,(IX+$03) | Write *IX+03 to *IX+0F. | ||
F0A1 | LD (IX+$0F),A | |||
F0A4 | LD C,(IX+$00) | C=*IX+00. | ||
F0A7 | DEC C | Decrease C by one. | ||
F0A8 | SLA C | Shift C left two positions (with carry). | ||
F0AA | SLA C | |||
F0AC | LD A,(IX+$02) | A=*IX+02. | ||
F0AF | ADD A,C | A+=C. | ||
F0B0 | LD C,A | C=A. | ||
F0B1 | LD A,($F233) | B=*F233. | ||
F0B4 | LD B,A | |||
F0B5 | LD A,($F231) | A=*TablePlayerAttributes. | ||
F0B8 | DEC A | Decrease A by one. | ||
F0B9 | SLA A | Shift A left two positions (with carry). | ||
F0BB | SLA A | |||
F0BD | ADD A,B | A+=B. | ||
F0BE | ADD A,$07 | A+=07. | ||
F0C0 | SUB C | A-=C. | ||
See Immune To Pirates.
|
||||
F0C1 | CP $10 | Jump to Handler_Pirate_Next if A is higher than 10. | ||
F0C3 | JR NC,Handler_Pirate_Next | |||
F0C5 | LD B,(IX+$01) | B=*IX+01. | ||
F0C8 | LD A,($F232) | A=*F232. | ||
F0CB | ADD A,$02 | A+=02. | ||
F0CD | SUB B | A-=B. | ||
F0CE | CP $06 | Jump to Handler_Pirate_Next if A is higher than 06. | ||
F0D0 | JP NC,Handler_Pirate_Next | |||
F0D3 | LD A,$02 | Write 02 to *SoundFlag_General. | ||
F0D5 | LD ($FFFE),A | |||
F0D8 | JP LoseLife | Jump to LoseLife. | ||
Move onto the next Pirate.
|
||||
Handler_Pirate_Next | F0DB | LD DE,$0010 | IX+=0010. | |
F0DE | ADD IX,DE | |||
F0E0 | JP Handler_Pirates_Loop | Jump to Handler_Pirates_Loop. | ||
Alters the direction of the Pirate to now face and move left.
|
||||
Handler_Pirate_TurnLeft | F0E3 | LD (IX+$04),$01 | Write 01 (move left) to Pirate direction (*IX+04). | |
F0E7 | LD (IX+$06),$50 | Write 50 (facing left) to Pirate sprite reference (*IX+06). | ||
F0EB | JP Handler_Pirates_2 | Jump to Handler_Pirates_2. | ||
Alters the direction of the Pirate to now face and move right.
|
||||
Handler_Pirate_TurnRight | F0EE | LD (IX+$04),$FF | Write FF (move right) to Pirate direction (*IX+04). | |
F0F2 | LD (IX+$06),$20 | Write 20 (facing right) to Pirate sprite reference (*IX+06). | ||
F0F6 | JP Handler_Pirates_2 | Jump to Handler_Pirates_2. | ||
Handle making the Pirate about-turn.
|
||||
Pirate_TurnController | F0F9 | LD A,(IX+$04) | Jump to Handler_Pirate_TurnLeft if the direction the Pirate is moving (*IX+04) is right (FF). | |
F0FC | CP $FF | |||
F0FE | JP Z,Handler_Pirate_TurnLeft | |||
F101 | JP Handler_Pirate_TurnRight | Jump to Handler_Pirate_TurnRight. |
Prev: EED7 | Up: Map | Next: F104 |