![]() |
Routines |
Prev: 61143 | Up: Map | Next: 61700 |
Used by the routine at InitialiseGame.
|
||||
See No Pirates.
|
||||
Handler_Pirates | 61441 | LD A,(62260) | Return if *LiftsPiratesFrameSkip is equal to 0. | |
61444 | CP 0 | |||
61446 | RET Z | |||
61447 | LD HL,36392 | Write 36392 (Graphics_Pirate) to *CHARS. | ||
61450 | LD (23606),HL | |||
61453 | LD IX,(23518) | IX=*ReferencePirate. | ||
Handler_Pirates_Loop | 61457 | LD A,(IX+0) | Return if Pirate state (*IX+0) is equal to OFF (255). | |
61460 | CP 255 | |||
61462 | RET Z | |||
61463 | LD A,16 | Set INK: Pirate attribute (*IX+9). | ||
61465 | RST 16 | |||
61466 | LD A,(IX+9) | |||
61469 | RST 16 | |||
Update the sprite frame.
|
||||
61470 | LD A,(IX+6) | Fetch the current Pirate sprite reference (*IX+6). | ||
61473 | ADD A,6 | Add 6. | ||
61475 | LD (IX+6),A | Write it back to the current Pirate sprite reference (*IX+6). | ||
61478 | CP 74 | Jump to Handler_Pirates_CheckSpriteFrames if A is not equal to 74. | ||
61480 | JR NZ,Handler_Pirates_CheckSpriteFrames | |||
61482 | LD (IX+6),32 | Write 32 (facing right) to Pirate sprite reference (*IX+6). | ||
Handler_Pirates_CheckSpriteFrames | 61486 | CP 128 | Jump to Handler_Pirates_SkipSpriteFrames if A is not equal to 128. | |
61488 | JR NZ,Handler_Pirates_SkipSpriteFrames | |||
61490 | LD (IX+6),80 | Write 80 (facing left) to Pirate sprite reference (*IX+6). | ||
Handler_Pirates_SkipSpriteFrames | 61494 | CALL 61094 | Call 61094. | |
61497 | LD A,C | Jump to Handler_Pirate_TurnRight if C is equal to 34. | ||
61498 | CP 34 | |||
61500 | JP Z,Handler_Pirate_TurnRight | |||
61503 | CP 3 | Jump to Handler_Pirate_TurnLeft if C is equal to 3. | ||
61505 | JP Z,Handler_Pirate_TurnLeft | |||
61508 | PUSH DE | Stash DE and BC on the stack. | ||
61509 | PUSH BC | |||
61510 | LD A,(IX+4) | Jump to Handler_Pirates_0 if the direction the Pirate is moving (*IX+4) is not right (255). | ||
61513 | CP 255 | |||
61515 | JR NZ,Handler_Pirates_0 | |||
61517 | DEC C | Decrease C by two. | ||
61518 | DEC C | |||
Handler_Pirates_0 | 61519 | CALL 61871 | Call 61871. | |
61522 | POP BC | Restore BC and DE from the stack. | ||
61523 | POP DE | |||
61524 | CP 255 | Jump to Pirate_TurnController if A is not equal to 255. | ||
61526 | JP NZ,Pirate_TurnController | |||
61529 | PUSH BC | Stash BC and DE on the stack. | ||
61530 | PUSH DE | |||
61531 | DEC B | Decrease B by three. | ||
61532 | DEC B | |||
61533 | DEC B | |||
61534 | LD A,(IX+4) | Jump to Handler_Pirates_1 if the direction the Pirate is moving (*IX+4) is not right (255). | ||
61537 | CP 255 | |||
61539 | JR NZ,Handler_Pirates_1 | |||
61541 | DEC C | Decrease C by two. | ||
61542 | DEC C | |||
Handler_Pirates_1 | 61543 | CALL ConvertCoordinateToBufferOffset | Call ConvertCoordinateToBufferOffset. | |
61546 | LD HL,41412 | HL=BufferRoom. | ||
61549 | LD DE,(62256) | DE=*BufferRoomPointer. | ||
61553 | ADD HL,DE | HL+=DE. | ||
61554 | POP DE | Restore DE and BC from the stack. | ||
61555 | POP BC | |||
61556 | LD A,(HL) | Jump to Pirate_TurnController if *HL is lower than 33. | ||
61557 | CP 33 | |||
61559 | JP C,Pirate_TurnController | |||
61562 | LD (IX+0),C | Write C to *IX+0. | ||
61565 | LD (IX+1),B | Write B to *IX+1. | ||
61568 | LD (IX+2),E | Write E to *IX+2. | ||
61571 | LD (IX+3),D | Write D to *IX+3. | ||
61574 | CALL 59874 | Call 59874. | ||
Handler_Pirates_2 | 61577 | CALL 61143 | Call 61143. | |
61580 | LD A,(IX+0) | Write *IX+0 to *IX+13. | ||
61583 | LD (IX+13),A | |||
61586 | LD A,(IX+1) | Write *IX+1 to *IX+14. | ||
61589 | LD (IX+14),A | |||
61592 | LD A,(IX+2) | Write *IX+2 to *IX+11. | ||
61595 | LD (IX+11),A | |||
61598 | LD A,(IX+3) | Write *IX+3 to *IX+15. | ||
61601 | LD (IX+15),A | |||
61604 | LD C,(IX+0) | C=*IX+0. | ||
61607 | DEC C | Decrease C by one. | ||
61608 | SLA C | Shift C left two positions (with carry). | ||
61610 | SLA C | |||
61612 | LD A,(IX+2) | A=*IX+2. | ||
61615 | ADD A,C | A+=C. | ||
61616 | LD C,A | C=A. | ||
61617 | LD A,(62003) | B=*62003. | ||
61620 | LD B,A | |||
61621 | LD A,(62001) | A=*TablePlayerAttributes. | ||
61624 | DEC A | Decrease A by one. | ||
61625 | SLA A | Shift A left two positions (with carry). | ||
61627 | SLA A | |||
61629 | ADD A,B | A+=B. | ||
61630 | ADD A,7 | A+=7. | ||
61632 | SUB C | A-=C. | ||
See Immune To Pirates.
|
||||
61633 | CP 16 | Jump to Handler_Pirate_Next if A is higher than 16. | ||
61635 | JR NC,Handler_Pirate_Next | |||
61637 | LD B,(IX+1) | B=*IX+1. | ||
61640 | LD A,(62002) | A=*62002. | ||
61643 | ADD A,2 | A+=2. | ||
61645 | SUB B | A-=B. | ||
61646 | CP 6 | Jump to Handler_Pirate_Next if A is higher than 6. | ||
61648 | JP NC,Handler_Pirate_Next | |||
61651 | LD A,2 | Write 2 to *SoundFlag_General. | ||
61653 | LD (65534),A | |||
61656 | JP LoseLife | Jump to LoseLife. | ||
Move onto the next Pirate.
|
||||
Handler_Pirate_Next | 61659 | LD DE,16 | IX+=0016. | |
61662 | ADD IX,DE | |||
61664 | JP Handler_Pirates_Loop | Jump to Handler_Pirates_Loop. | ||
Alters the direction of the Pirate to now face and move left.
|
||||
Handler_Pirate_TurnLeft | 61667 | LD (IX+4),1 | Write 1 (move left) to Pirate direction (*IX+4). | |
61671 | LD (IX+6),80 | Write 80 (facing left) to Pirate sprite reference (*IX+6). | ||
61675 | JP Handler_Pirates_2 | Jump to Handler_Pirates_2. | ||
Alters the direction of the Pirate to now face and move right.
|
||||
Handler_Pirate_TurnRight | 61678 | LD (IX+4),255 | Write 255 (move right) to Pirate direction (*IX+4). | |
61682 | LD (IX+6),32 | Write 32 (facing right) to Pirate sprite reference (*IX+6). | ||
61686 | JP Handler_Pirates_2 | Jump to Handler_Pirates_2. | ||
Handle making the Pirate about-turn.
|
||||
Pirate_TurnController | 61689 | LD A,(IX+4) | Jump to Handler_Pirate_TurnLeft if the direction the Pirate is moving (*IX+4) is right (255). | |
61692 | CP 255 | |||
61694 | JP Z,Handler_Pirate_TurnLeft | |||
61697 | JP Handler_Pirate_TurnRight | Jump to Handler_Pirate_TurnRight. |
Prev: 61143 | Up: Map | Next: 61700 |