Prev: 8652 Up: Map Next: 868D
8666: Colour a one-or-two-player line
Used by the routines at menu_loop and menu_show_players.
Called by menu_loop and menu_show_players. Colours one line nine characters wide from the screen position in HL (line $2F for one player, $3F for two, x $70): bright magenta ($43), or bright white ($47) if it is the one chosen (player_count: 0 one player, 1 two) and bit 2 of the pass counter (in object_records) is set. In the menu loop the counter's bit 2 changes every four passes, so the chosen line flashes.
Input
HL Screen position (x, bottom line)
colour_player_line 8666 LD B,$43 Magenta unless the flash is on...
8668 LD A,(pass_counter)
866B AND $04
866D JR Z,colour_player_line_0
866F LD A,H ...and this is the chosen line: (line - $2F) / 16 is its number
8670 SUB $2F
8672 LD C,A
8673 SRL C
8675 SRL C
8677 SRL C
8679 SRL C
867B LD A,(player_count)
867E CP C
867F JR NZ,colour_player_line_0
8681 LD B,$47 White
colour_player_line_0 8683 LD A,B Put the attribute into the patch and colour it (fill_attributes)
8684 LD ($868F),A
8687 LD DE,player_line_colour
868A JP fill_attributes
Prev: 8652 Up: Map Next: 868D