示例#1
0
//
// A fairly efficient way to draw a number
//  based on differences from the old number.
// Note: worth the trouble?
//
void STlib_drawNum(st_number_t *n)
{
    int         numdigits = n->width;
    int         num = *n->num;

    patch_t     *patch = n->p[0];
    int         w = SHORT(patch->width);
    int         h = SHORT(patch->height);
    int         x = n->x;

    n->oldnum = *n->num;

    // if non-number, do not draw it
    if (num == 1994)
        return;

    // in the special case of 0, you draw 0
    if (!num)
    {
        if (h == 6 && !STYSNUM0)
        {
            if (r_detail == r_detail_low)
                STlib_drawLowNum(0, 160, 47, x - w, n->y);
            else
                STlib_drawHighNum(0, 160, 47, x - w, n->y);
        }
        else
            V_DrawPatch(x - w, n->y, FG, patch);
    }
    else

        // draw the new number
        while (num && numdigits--)
        {
            x -= w;
            if (h == 6 && !STYSNUM0)
            {
                if (r_detail == r_detail_low)
                    STlib_drawLowNum(num % 10, 160, 47, x, n->y);
                else
                    STlib_drawHighNum(num % 10, 160, 47, x, n->y);
            }
            else
               V_DrawPatch(x, n->y, FG, n->p[num % 10]);
            num /= 10;
        }
}
示例#2
0
static void STlib_drawSmallNum(st_number_t *n)
{
    int numdigits = n->width;
    int num = MAX(0, *n->num);
    int x = n->x;

    // in the special case of 0, you draw 0
    if (!num)
    {
        if (usesmallnums)
        {
            if (r_detail == r_detail_high)
                STlib_drawHighNum(0, 160, 47, x - 4, n->y);
            else
                STlib_drawLowNum(0, 160, 47, x - 4, n->y);
        }
        else
            V_DrawPatch(x - 4, n->y, 0, n->p[0]);
    }
    else
    {
        // draw the new number
        while (num && numdigits--)
        {
            x -= 4;

            if (usesmallnums)
            {
                if (r_detail == r_detail_high)
                    STlib_drawHighNum(num % 10, 160, 47, x, n->y);
                else
                    STlib_drawLowNum(num % 10, 160, 47, x, n->y);
            }
            else
                V_DrawPatch(x, n->y, 0, n->p[num % 10]);

            num /= 10;
        }
    }
}
示例#3
0
void STlib_updateArmsIcon(st_multicon_t *mi, dboolean refresh, int i)
{
    if (*mi->on && (mi->oldinum != *mi->inum || refresh) && *mi->inum != -1)
    {
        if (STYSNUM0)
            V_DrawPatch(mi->x, mi->y, FG, mi->p[*mi->inum]);
        else
        {
            if (r_detail == r_detail_low)
                STlib_drawLowNum(i + 2, (*mi->inum ? 160 : 93), 47, mi->x, mi->y);
            else
                STlib_drawHighNum(i + 2, (*mi->inum ? 160 : 93), 47, mi->x, mi->y);
        }
        mi->oldinum = *mi->inum;
    }
}
示例#4
0
void STlib_updateArmsIcon(st_multicon_t *mi, dboolean refresh, int i)
{
    if ((mi->oldinum != *mi->inum || refresh) && *mi->inum != -1)
    {
        if (usesmallnums)
        {
            if (r_detail == r_detail_high)
                STlib_drawHighNum(i + 2, (*mi->inum ? 160 : 93), 47, mi->x, mi->y);
            else
                STlib_drawLowNum(i + 2, (*mi->inum ? 160 : 93), 47, mi->x, mi->y);
        }
        else
            V_DrawPatch(mi->x, mi->y, 0, mi->p[*mi->inum]);

        mi->oldinum = *mi->inum;
    }
}
示例#5
0
//
// A fairly efficient way to draw a number
//  based on differences from the old number.
// Note: worth the trouble?
//
void STlib_drawNum(st_number_t *n)
{
    int         numdigits = n->width;
    int         num = *n->num;

    int         w = SHORT(n->p[0]->width);
    int         x = n->x;

    int         neg;

    n->oldnum = *n->num;

    neg = (num < 0);

    if (neg)
    {
        if (numdigits == 2 && num < -9)
            num = -9;
        else if (numdigits == 3 && num < -99)
            num = -99;

        num = -num;
    }

    // clear the area
    x = n->x - numdigits * w;

    // if non-number, do not draw it
    if (num == 1994)
        return;

    x = n->x;

    // in the special case of 0, you draw 0
    if (!num)
    {
        if (SHORT(n->p[0]->height) == 6 && !STYSNUM0)
        {
            if (r_detail == low)
                STlib_drawLowNum(0, 160, 47, x - w, n->y);
            else
                STlib_drawHighNum(0, 160, 47, x - w, n->y);
        }
        else
            V_DrawPatch(x - w, n->y, FG, n->p[0]);
    }

    // draw the new number
    while (num && numdigits--)
    {
        x -= w;
        if (SHORT(n->p[0]->height) == 6 && !STYSNUM0)
        {
            if (r_detail == low)
                STlib_drawLowNum(num % 10, 160, 47, x, n->y);
            else
                STlib_drawHighNum(num % 10, 160, 47, x, n->y);
        }
        else
           V_DrawPatch(x, n->y, FG, n->p[num % 10]);
        num /= 10;
    }

    // draw a minus sign if necessary
    if (neg)
        V_DrawPatch(x - 8, n->y, FG, sttminus);
}