Prev: 41471 Up: Map Next: 41524
41479: Show Amulet
Used by the routine at TestPlayerProgress.
Clears the play area and draws the amulet in the middle of the screen. The amulet is drawn as four graphics, one for each piece. Every piece is drawn as a plain red silhouette, unless it has been collected, in which case it is drawn in full colour. Each of the graphics is drawn by DrawRoom_Process, which holds two sets of attributes for each graphic, the second of which is only used when AttributeSetFlag is set.
Once the amulet has been drawn the poem is shown by HandlerPoems.
Before After ShowAmulet
show-amulet-before show-amulet-after
Input
IX Actor record of the player
ShowAmulet 41479 CALL ClearPlayArea_Attributes Clear the attribute buffer of the play area.
41482 CALL ClearPlayArea Clear the play area.
41485 LD A,(IX+11) Fetch the amulet pieces collected from 38669.
41488 LD C,A Stash the amulet pieces collected in C.
41489 LD HL,50036 Point HL at the table of amulet graphics and positions at AmuletGraphicsTable.
Draw each of the amulet pieces in turn.
ShowAmulet_Loop 41492 LD E,(HL) Fetch the address of the next graphic from the table into DE.
41493 INC HL
41494 LD D,(HL)
41495 LD A,E Jump to HandlerPoems if the end of the table has been reached (the address is zero).
41496 OR D
41497 JR Z,HandlerPoems
41499 INC HL Move onto the position of the graphic.
41500 SRL C Shift the collected flag for this amulet piece out of C and into the carry flag.
41502 JR NC,ShowAmulet_Draw Jump to ShowAmulet_Draw if the amulet piece has not been collected.
41504 LD A,1 Write 1 to AttributeSetFlag so that the graphic is drawn in full colour.
41506 LD (38578),A
ShowAmulet_Draw 41509 PUSH BC Stash the amulet pieces remaining on the stack.
41510 LD C,(HL) Fetch the position of the graphic from the table (C is the X position and B the Y position).
41511 INC HL
41512 LD B,(HL)
41513 INC HL Move onto the next table entry.
41514 PUSH HL Stash the table pointer on the stack.
41515 LD H,B Copy the position to HL.
41516 LD L,C
41517 CALL DrawRoom_Process Draw the graphic of the amulet piece.
41520 POP HL Restore the table pointer and the amulet pieces remaining from the stack.
41521 POP BC
41522 JR ShowAmulet_Loop Jump back to ShowAmulet_Loop to draw the next amulet piece.
Prev: 41471 Up: Map Next: 41524