some PWADs have STNUM* patches of various width/height (Avactor.wad) (#691)

* some PWADs have STNUM* patches of various width/height (Avactor.wad)

* redraw parts of STBAR every tick

* always redraw entire STBAR every tic
This commit is contained in:
Roman Fomin 2022-08-04 22:53:42 +07:00 committed by GitHub
parent 6137fb4143
commit 4adc9391f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 38 deletions

View File

@ -101,23 +101,14 @@ void STlib_drawNum
char *outrng, //jff 2/16/98 add color translation to digit output
boolean refresh )
{
int numdigits = n->width;
int num = *n->num;
int w = SHORT(n->p[0]->width);
int h = SHORT(n->p[0]->height);
int x = n->x;
int rectx, recty;
int neg;
// [crispy] redraw only if necessary
if (n->oldnum == num && !refresh)
{
return;
}
n->oldnum = *n->num;
neg = num < 0;
@ -132,13 +123,6 @@ void STlib_drawNum
num = -num;
}
// clear the area
rectx = x - SHORT(n->p[0]->leftoffset) - numdigits * w + WIDESCREENDELTA;
recty = n->y - SHORT(n->p[0]->topoffset);
if (!st_crispyhud)
V_CopyRect(rectx, recty - ST_Y, BG, numdigits * w, h, rectx, recty, FG);
// if non-number, do not draw it
if (num == 1994)
return;
@ -169,10 +153,11 @@ void STlib_drawNum
//jff 2/16/98 add color translation to digit output
if (neg && sttminus)
{
w = SHORT(sttminus->width);
if (outrng && !sts_always_red)
V_DrawPatchTranslated(x - 8, n->y, FG, sttminus,outrng,0);
V_DrawPatchTranslated(x - w, n->y, FG, sttminus,outrng,0);
else //jff 2/18/98 allow use of faster draw routine from config
V_DrawPatch(x - 8, n->y, FG, sttminus);
V_DrawPatch(x - w, n->y, FG, sttminus);
}
}
@ -289,29 +274,10 @@ void STlib_updateMultIcon
( st_multicon_t* mi,
boolean refresh )
{
int w;
int h;
int x;
int y;
if (*mi->on && (mi->oldinum != *mi->inum || refresh))
if (*mi->on)
{
if (mi->oldinum != -1)
{
x = mi->x - SHORT(mi->p[mi->oldinum]->leftoffset);
y = mi->y - SHORT(mi->p[mi->oldinum]->topoffset);
w = SHORT(mi->p[mi->oldinum]->width);
h = SHORT(mi->p[mi->oldinum]->height);
if (y - ST_Y < 0)
I_Error("updateMultIcon: y - ST_Y < 0");
if (!st_crispyhud)
V_CopyRect(x + WIDESCREENDELTA, y-ST_Y, BG, w, h, x + WIDESCREENDELTA, y, FG);
}
if (*mi->inum != -1) // killough 2/16/98: redraw only if != -1
V_DrawPatch(mi->x, mi->y, FG, mi->p[*mi->inum]);
mi->oldinum = *mi->inum;
}
}

View File

@ -851,6 +851,12 @@ void ST_drawWidgets(boolean refresh)
int i;
int maxammo = plyr->maxammo[weaponinfo[w_ready.data].ammo];
// clear area
if (!st_crispyhud)
{
V_CopyRect(WIDESCREENDELTA, 0, BG, ST_WIDTH, ST_HEIGHT, WIDESCREENDELTA, ST_Y, FG);
}
// used by w_arms[] widgets
st_armson = st_statusbaron && !deathmatch;