Multiplayer Setup Menu -- Colour bar

Post tutorials on how to do certain tasks within game or engine code here.
Post Reply
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Multiplayer Setup Menu -- Colour bar

Post by mh »

Simple but effective, let's add a colour selection bar to the multiplayer setup menu so that you can see what options are available. Pop this somewhere in menu.c:

Code: Select all

void M_DrawColorBar (int x, int y, int highlight)
{
    int i;
    int intense = highlight * 16 + (highlight < 8 ? 11 : 4);

    // position correctly
    x = x + ((vid.width - 320) >> 1);

    for (i = 0; i < 14; i++)
    {
        // take the approximate midpoint colour (handle backward ranges)
        int c = i * 16 + (i < 8 ? 8 : 7);

        // braw baseline colour (offset downwards a little so that it fits correctly
        Draw_Fill (x + i * 8, y + 4, 8, 8, c);
    }

    // draw the highlight rectangle
    Draw_Fill (x - 1 + highlight * 8, y + 3, 10, 10, 15);

    // redraw the highlighted color at brighter intensity
    Draw_Fill (x + highlight * 8, y + 4, 8, 8, intense);
}
And in M_Setup_Draw change these:

Code: Select all

    M_Print (64, 80, "Shirt color");
    M_Print (64, 104, "Pants color");
To these:

Code: Select all

    M_Print (64, 80, "Shirt color");
    M_DrawColorBar (64, 88, setup_top);
    M_Print (64, 104, "Pants color");
    M_DrawColorBar (64, 112, setup_bottom);
You'll need to nudge the bigbox.lmp and menuplyr.lmp a little to the right; about 16 is enough.

Job's a good 'un. :D
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

sounds cool
Post Reply