mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
Fix user quotes colored with a 2-digit number being wrongly x-aligned.
Such game text was shown starting from about the center of the screen. The reason for the bug was this code: t += 1 + isdigit(*(t+2)); The sequence points here are at the beginning and end of this assignment expression, and the updating of t may happen anywhere between these (C99 6.5.16 #3). Please don't write such code. When in doubt, and assignment and reference to the same object should be split! git-svn-id: https://svn.eduke32.com/eduke32@2380 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0919c186ba
commit
668774c12e
1 changed files with 9 additions and 4 deletions
|
@ -328,7 +328,7 @@ int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const
|
|||
{
|
||||
int32_t ac;
|
||||
char centre;
|
||||
int32_t squishtext = ((f&2) != 0);
|
||||
const int32_t squishtext = ((f&2) != 0);
|
||||
int32_t shift = 16, widthx = 320;
|
||||
int32_t ox, oy, origx = x, origy = y;
|
||||
|
||||
|
@ -341,7 +341,8 @@ int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const
|
|||
shift = 0;
|
||||
}
|
||||
|
||||
if ((centre = (x == (widthx>>1))))
|
||||
centre = (x == (widthx>>1));
|
||||
if (centre)
|
||||
{
|
||||
const char *oldt = t;
|
||||
int32_t newx = 0;
|
||||
|
@ -358,7 +359,10 @@ int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const
|
|||
|
||||
if (*t == '^' && isdigit(*(t+1)))
|
||||
{
|
||||
t += 1 + isdigit(*(t+2));
|
||||
t++;
|
||||
if (isdigit(*(t+1)))
|
||||
t++;
|
||||
// t += 1 + isdigit(*(t+2)); // This code is wrong, see C99 6.5.16 #3
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -366,7 +370,8 @@ int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const
|
|||
|
||||
if (ac < tile || ac > (tile + 93)) break;
|
||||
|
||||
newx += i = ((((f & 8) ? 8 : tilesizx[ac]) - squishtext) * z)>>16;
|
||||
i = ((((f & 8) ? 8 : tilesizx[ac]) - squishtext) * z)>>16;
|
||||
newx += i;
|
||||
|
||||
if (*t >= '0' && *t <= '9')
|
||||
newx -= i - ((8 * z)>>16);
|
||||
|
|
Loading…
Reference in a new issue