Prev: BC83 Up: Map Next: BD34
BC9D: Show the carried things on the panel, if they have changed
Used by the routine at RENDER_DYNAMIC_OBJECTS.
Called every turn by RENDER_DYNAMIC_OBJECTS; it acts only when PANEL_DUE is set, as TAKE_OR_LEAVE sets it when what he carries changes, and not once the game is won. The panel's drawing (COLOUR_PANEL) comes in at SHOW_CARRIED_NOW to draw them regardless.
The panel shows the three slots CARRIED, the one after it, and CARRIED_LAST (four bytes each: the graphic first), in three boxes 24 pixels square at the bottom left of the screen, at pixel x 8, 32 and 56, y 0. For each, the box is cleared in the buffer (FILL_BOX), the thing's sprite drawn there through the spare record at PANEL_RECORD (by the entry into CALC_PIXEL_XY_AND_RENDER past the projection, with the mirror bit clear), and the box copied to the screen (BLIT_TO_SCREEN); then its three by three attribute cells are coloured by the graphic's low four bits, from CARRIED_COLOURS, which gives each of the four kinds of valve its own colour. An empty slot is cleared, and coloured as if graphic 0. As Pentagram's SHOW_CARRIED; Knight Lore's does the same with more routines.
SHOW_CARRIED BC9D LD A,(WON) not once the game is won
BCA0 AND A
BCA1 RET NZ
BCA2 LD A,(PANEL_DUE) nothing has changed; or clear the flag
BCA5 AND A
BCA6 RET Z
BCA7 XOR A
BCA8 LD (PANEL_DUE),A
This entry point is used by the routine at COLOUR_PANEL.
SHOW_CARRIED_NOW BCAB PUSH IX IX = the spare record; three boxes; HL = the first slot shown
BCAD LD IX,PANEL_RECORD
BCB1 LD B,$03
BCB3 LD HL,CARRIED
SHOW_CARRIED_BOX BCB6 PUSH BC the box's pixel x: 8 + 24 times its number; pixel y 0, the bottom of the screen
BCB7 PUSH HL
BCB8 LD A,B
BCB9 NEG
BCBB ADD A,$03
BCBD SLA A
BCBF SLA A
BCC1 SLA A
BCC3 LD C,A
BCC4 SLA A
BCC6 ADD A,C
BCC7 ADD A,$08
BCC9 LD (IX+$1A),A
BCCC LD (IX+$1B),$00
BCD0 LD C,(IX+$1A) clear three bytes by 24 rows of the buffer
BCD3 LD B,(IX+$1B)
BCD6 PUSH HL
BCD7 CALL CALC_VIDBUF_ADDR
BCDA LD L,C
BCDB LD H,B
BCDC LD BC,$0318
BCDF XOR A
BCE0 CALL FILL_BOX
BCE3 POP HL something there: its sprite into the buffer, not mirrored
BCE4 LD A,(HL)
BCE5 AND A
BCE6 JR Z,SHOW_CARRIED_0
BCE8 RES 6,(IX+$07)
BCEC LD (IX+$00),A
BCEF CALL PRINT_SPRITE
SHOW_CARRIED_0 BCF2 LD C,(IX+$1A) copy the box from the buffer to the screen
BCF5 LD B,(IX+$1B)
BCF8 CALL CALC_VRAM_ADDR
BCFB CALL CALC_VIDBUF_ADDR
BCFE LD L,C
BCFF LD H,B
BD00 LD BC,$1803
BD03 CALL BLIT_TO_SCREEN
BD06 POP HL C = the colour for the slot's graphic
BD07 POP BC
BD08 PUSH BC
BD09 PUSH HL
BD0A LD A,(HL)
BD0B AND $0F
BD0D LD E,A
BD0E LD D,$00
BD10 LD HL,CARRIED_COLOURS
BD13 ADD HL,DE
BD14 LD C,(HL)
BD15 LD L,(IX+$1A) DE = the attribute address of the box's top row, 23 pixels up
BD18 LD A,(IX+$1B)
BD1B ADD A,$17
BD1D LD H,A
BD1E CALL CALC_ATTRIB_ADDR
BD21 EX DE,HL
BD22 LD A,C colour three cells by three
BD23 LD BC,$0303
BD26 CALL FILL_BOX
BD29 POP HL the next slot, four bytes on
BD2A POP BC
BD2B INC HL
BD2C INC HL
BD2D INC HL
BD2E INC HL
BD2F DJNZ SHOW_CARRIED_BOX
BD31 POP IX IX back
BD33 RET
Prev: BC83 Up: Map Next: BD34