![]() |
Routines |
| Prev: A18C | Up: Map | Next: A1FF |
|
Handles the four amulet pieces (sprite IDs 90 to 93), which are placed in the rooms by PlaceAmuletPieces. The piece flashes when it is in the room the player is in and when the player touches it, it is collected.
Collecting a piece sets the bit in 970D that corresponds to the piece, sets bit 7 of the same byte so that the amulet is shown by TestPlayerProgress, and awards 7500 points.
|
||||||||
|
Do nothing unless the piece is in the same room as the player.
|
||||||||
| HandlerAmuletPiece | A1AB | LD A,($9703) | Fetch the room of the player from 9703. | |||||
| A1AE | CP (IX+$01) | Compare with the room of the amulet piece. | ||||||
| A1B1 | RET NZ | Return if the amulet piece is in a different room to the player. | ||||||
| A1B2 | LD BC,$0C0C | Set how far above and to the right of the amulet piece the player can be in BC to 0C0C (see TestPlayerTouchingActor). | ||||||
|
Every other frame, cycle the piece through the colours 44 to 47.
|
||||||||
| A1B5 | LD A,($9693) | Fetch the low byte of the game timer from GameTimer. | ||||||
| A1B8 | AND %00000001 | Keep only bit 0. | ||||||
| A1BA | JR NZ,AmuletPiece_TestTouch | Jump to AmuletPiece_TestTouch if bit 0 is set (the colour only changes on alternate passes). | ||||||
| A1BC | LD A,(IX+$05) | Fetch the colour of the amulet piece. | ||||||
| A1BF | INC A | Move on to the next colour. | ||||||
| A1C0 | AND %00000011 | Keep only bits 0-1. | ||||||
| A1C2 | OR %01000100 | Set bits 2 and 6, giving a bright ink colour of 04-07. | ||||||
| A1C4 | LD (IX+$05),A | Set the new colour of the amulet piece. | ||||||
|
Test whether the player is touching the piece.
|
||||||||
| AmuletPiece_TestTouch | A1C7 | CALL TestPlayerTouchingActor | Test whether the player is touching the amulet piece. | |||||
| A1CA | JP NC,ColourPickup | Jump to ColourPickup to draw the amulet piece if the player is not touching it. | ||||||
|
The piece has been collected, so work out which bit to set.
|
||||||||
| A1CD | LD A,($970D) | Fetch the amulet pieces collected from 970D. | ||||||
| A1D0 | OR %10000000 | Set bit 7 (the "show the amulet" flag). | ||||||
| A1D2 | LD C,A | Stash the new amulet pieces collected in C. | ||||||
| A1D3 | LD A,(IX+$00) | Fetch the sprite ID of the amulet piece. | ||||||
| A1D6 | SUB $90 | Subtract 90 to get the number of the amulet piece. | ||||||
| A1D8 | JR Z,AmuletPiece_First | Jump to AmuletPiece_First if this is the first amulet piece. | ||||||
| A1DA | DEC A | Move on to the next piece number. | ||||||
| A1DB | JR Z,AmuletPiece_Second | Jump to AmuletPiece_Second if this is the second amulet piece. | ||||||
| A1DD | DEC A | Move on to the next piece number. | ||||||
| A1DE | JR Z,AmuletPiece_Third | Jump to AmuletPiece_Third if this is the third amulet piece. | ||||||
| A1E0 | SET 3,C | Set bit 3 of the amulet pieces collected, as this is the fourth piece. | ||||||
| AmuletPiece_Collected | A1E2 | LD A,C | Fetch the new amulet pieces collected. | |||||
| A1E3 | LD ($970D),A | Store the amulet pieces collected in 970D. | ||||||
| A1E6 | CALL DrawEntity | Erase the amulet piece from the screen. | ||||||
| A1E9 | LD (IX+$00),$00 | Remove the amulet piece by setting its sprite ID to 00. | ||||||
|
Add 7500 points to the player's score.
|
||||||||
| A1ED | LD BC,$7500 | Set the points to award in BC to 7500 (stored as BCD). | ||||||
| A1F0 | JP AddPointsToScore | Jump to AddPointsToScore to add the points to the score. | ||||||
|
Set the bit for the first, second or third piece.
|
||||||||
| AmuletPiece_First | A1F3 | SET 0,C | Set bit 0 of the amulet pieces collected for the first piece. | |||||
| A1F5 | JR AmuletPiece_Collected | Jump to AmuletPiece_Collected. | ||||||
| AmuletPiece_Second | A1F7 | SET 1,C | Set bit 1 of the amulet pieces collected for the second piece. | |||||
| A1F9 | JR AmuletPiece_Collected | Jump to AmuletPiece_Collected. | ||||||
| AmuletPiece_Third | A1FB | SET 2,C | Set bit 2 of the amulet pieces collected for the third piece. | |||||
| A1FD | JR AmuletPiece_Collected | Jump to AmuletPiece_Collected. | ||||||
| Prev: A18C | Up: Map | Next: A1FF |