Prev: E581 Up: Map Next: E6BC
E5F4: Handler: Items
Used by the routine at InitialiseGame.
Handler_Items E5F4 LD IX,($5BE0) Point IX at *ReferenceItems.
Walk the item table looking for one the player is standing on.
Handler_Items_Loop E5F8 LD A,(IX+$00) Return if this item entry is the terminator (FF).
E5FB CP $FF
E5FD RET Z
E5FE LD C,A C=this item's horizontal co-ordinate.
E5FF LD B,(IX+$01) B=this item's vertical co-ordinate.
E602 LD A,(IX+$05) Jump to Handler_Items_Next if this item has already been collected.
E605 CP $00
E607 JR Z,Handler_Items_Next
E609 LD A,($F232) A=*PlayerVerticalCoordinate.
E60C DEC A Move one row up to the player's feet.
E60D CP B Jump to Handler_Items_Next if the player is not on this item's row.
E60E JR NZ,Handler_Items_Next
E610 LD A,($F231) A=*TablePlayerAttributes.
E613 SUB C Subtract the item column.
E614 JR Z,Item_Collected Jump to Item_Collected if the player is in this item's column.
E616 CP $FF
E618 JR Z,Item_Collected
Handler_Items_Next E61A LD DE,$0007 Move IX on to the next seven-byte item entry.
E61D ADD IX,DE
E61F JR Handler_Items_Loop Jump to Handler_Items_Loop.
Item_Collected E621 CALL Controller_BombCheck Maybe place a bomb at this item.
E624 LD A,$04 Queue the collected-item sound at SoundFlag_General.
E626 LD ($FFFE),A
E629 LD A,$00 A=00.
E62B LD D,$02 Set the blank sprite width/ height (02/ 02).
E62D LD E,$02
E62F PUSH DE Stash the blank size on the stack.
E630 CALL WriteGameSpriteBuffer Blank the item in the game sprite buffer.
E633 CALL $0DD9 Call CL_SET.
E636 POP DE Restore the blank size from the stack.
E637 LD HL,$9F6C Write 9F6C to *CHARS.
E63A LD ($5C36),HL
E63D LD A,$20 A=a blank character.
E63F CALL PrintSprite Print the blank over the item.
E642 LD (IX+$05),$00 Mark this item as collected.
E646 LD A,$10 Set INK: YELLOW (06).
E648 RST $10
E649 LD A,$06
E64B RST $10
E64C LD A,$11 Set PAPER: *Active_BorderColour.
E64E RST $10
E64F LD A,($5BD0)
E652 RST $10
Restore the default ZX Spectrum font.
E653 LD HL,$3C00 Write CHARSET-0100 to *CHARS.
E656 LD ($5C36),HL
E659 LD C,$13 Move the cursor to the booty count.
E65B LD B,$01
E65D CALL $0DD9
E660 LD BC,($5BF4) Increment *PlayerBooty by one.
E664 INC BC
E665 LD ($5BF4),BC
E669 CALL $1A1B Print the new booty count.
E66C LD C,$05 Move the cursor to the treasure count.
E66E LD B,$01
E670 CALL $0DD9
E673 LD BC,($5BF2) Decrease *PlayerTreasure by one.
E677 DEC BC
E678 LD ($5BF2),BC
E67C LD A,B Jump to Item_Collected_TestTreasure if the remaining treasure is not 32.
E67D CP $00
E67F JR NZ,Item_Collected_TestTreasure
E681 LD A,C Jump to Item_Collected_TestTreasure if the remaining low byte is not 32.
E682 CP $32
E684 JR NZ,Item_Collected_TestTreasure
E686 LD A,($5BD3) Record the current room in *GoldenKeyRoom.
E689 LD ($5BFC),A
E68C LD A,(IX+$00) Record this item's column in *PositionGoldenKey.
E68F LD ($5BFD),A
E692 LD A,(IX+$01) A=this item's row.
E695 INC A Move one row down for the golden-key position.
E696 LD ($5BFE),A Write it to *PositionGoldenKey_Vertical.
Item_Collected_TestTreasure E699 LD A,C Test whether any treasure remains.
E69A CP $00
E69C PUSH AF Stash that result on the stack.
E69D CALL NZ,$1A1B Print the remaining treasure if it is not zero.
E6A0 LD A,$20 A=ASCII "space" (20).
E6A2 CALL PrintColourCharacter Call PrintColourCharacter.
E6A5 POP AF Restore the remaining-treasure result from the stack.
E6A6 RET NZ Return if treasure still remains.
E6A7 LD A,$2D Start *TimerGoldenKey at 2D seconds.
E6A9 LD ($5BFF),A
E6AC LD BC,$0014 Write the golden-key frame skip to *TimerGoldenKey_FrameSkip.
E6AF LD ($5BFA),BC
Restore the default ZX Spectrum font.
E6B3 LD HL,$3C00 Write CHARSET-0100 to *CHARS.
E6B6 LD ($5C36),HL
E6B9 JP PrintFindTheGoldKey Jump to PrintFindTheGoldKey.
Prev: E581 Up: Map Next: E6BC