Prev: C489 Up: Map Next: C52F
C4DC: Colour the carried things on the panel, flashing an object near its villain
Used by the routine at NEW_GAME.
Every turn. Each carried thing's icon is given its colour from THING_COLOURS, two by two, from the bottom of the panel up to the first empty place: an object in the colour its villain is drawn in once destroyed (DRAW_VILLAINS), the four kinds of antibody magenta, green, cyan and yellow. An object whose villain is less than five cells from the knight in column and row flashes through the antibody colours instead, one a turn: the game's sign that the villain it kills is near.
COLOUR_CARRIED C4DC LD BC,THING_COLOURS in the second register set: the colours, and the attribute of the lowest place
C4DF LD HL,$5AC2
C4E2 EXX
C4E3 LD DE,CARRIED the eleven places, as far as the first empty one
C4E6 LD B,$0B
COLOUR_CARRIED_0 C4E8 LD A,(DE)
C4E9 AND A
C4EA RET Z
C4EB CP $05 an object? is its villain near?
C4ED JR C,COLOUR_CARRIED_2
COLOUR_CARRIED_1 C4EF EXX the thing's colour
C4F0 EX DE,HL
C4F1 LD L,A
C4F2 LD H,$00
C4F4 ADD HL,BC
C4F5 LD A,(HL)
C4F6 EX DE,HL two attributes, and the two above; HL on up to the next place
C4F7 LD (HL),A
C4F8 INC HL
C4F9 LD (HL),A
C4FA LD DE,$FFDF
C4FD ADD HL,DE
C4FE LD (HL),A
C4FF INC HL
C500 LD (HL),A
C501 ADD HL,DE
C502 EXX the next place
C503 INC DE
C504 DJNZ COLOUR_CARRIED_0
C506 RET
COLOUR_CARRIED_2 C507 PUSH AF IX = the villain object n kills: record 4 - n; less than five cells away?
C508 PUSH DE
C509 CPL
C50A ADD A,$05
C50C ADD A,A
C50D ADD A,A
C50E ADD A,A
C50F ADD A,A
C510 LD E,A
C511 LD D,$00
C513 LD IX,VILLAINS
C517 ADD IX,DE
C519 LD C,$05
C51B CALL NEAR_KNIGHT
C51E JR C,COLOUR_CARRIED_3
C520 POP DE no: its own colour
C521 POP AF
C522 JR COLOUR_CARRIED_1
COLOUR_CARRIED_3 C524 POP DE yes: an antibody's colour, a different one each turn
C525 POP AF
C526 LD A,(TURNS)
C529 AND $03
C52B ADD A,$05
C52D JR COLOUR_CARRIED_1
Prev: C489 Up: Map Next: C52F