mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix off by 1 error in con_hudlines
Originally written by Zwip-Zwap Zapony for the SRB2 repository as part of STJR/SRB2!1931, partially flattened to avoid waiting for the merger of the entire branch. - 0, not 1 as previously was the case, now shows zero lines. - Now inclusively capped between 0 and 20 lines in the cvar, rather than silently in the console code.
This commit is contained in:
parent
c36d987be7
commit
ea53197084
1 changed files with 10 additions and 14 deletions
|
|
@ -70,8 +70,8 @@ static INT32 con_curlines; // vid lines currently used by console
|
||||||
|
|
||||||
INT32 con_clipviewtop; // (useless)
|
INT32 con_clipviewtop; // (useless)
|
||||||
|
|
||||||
static INT32 con_hudlines; // number of console heads up message lines
|
static UINT8 con_hudlines; // number of console heads up message lines
|
||||||
static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
static INT32 con_hudtime[MAXHUDLINES]; // remaining time of display for hud msg lines
|
||||||
|
|
||||||
INT32 con_clearlines; // top screen lines to refresh when view reduced
|
INT32 con_clearlines; // top screen lines to refresh when view reduced
|
||||||
boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh
|
boolean con_hudupdate; // when messages scroll, we need a backgrnd refresh
|
||||||
|
|
@ -127,7 +127,8 @@ static char con_buffer[CON_BUFFERSIZE];
|
||||||
static consvar_t cons_msgtimeout = CVAR_INIT ("con_hudtime", "5", CV_SAVE, CV_Unsigned, NULL);
|
static consvar_t cons_msgtimeout = CVAR_INIT ("con_hudtime", "5", CV_SAVE, CV_Unsigned, NULL);
|
||||||
|
|
||||||
// number of lines displayed on the HUD
|
// number of lines displayed on the HUD
|
||||||
static consvar_t cons_hudlines = CVAR_INIT ("con_hudlines", "5", CV_CALL|CV_SAVE, CV_Unsigned, CONS_hudlines_Change);
|
static CV_PossibleValue_t hudlines_cons_t[] = {{0, "MIN"}, {MAXHUDLINES, "MAX"}, {0, "None"}, {0, NULL}};
|
||||||
|
static consvar_t cons_hudlines = CVAR_INIT ("con_hudlines", "5", CV_CALL|CV_SAVE, hudlines_cons_t, CONS_hudlines_Change);
|
||||||
|
|
||||||
// number of lines console move per frame
|
// number of lines console move per frame
|
||||||
// (con_speed needs a limit, apparently)
|
// (con_speed needs a limit, apparently)
|
||||||
|
|
@ -177,11 +178,6 @@ static void CONS_hudlines_Change(void)
|
||||||
for (i = 0; i < con_hudlines; i++)
|
for (i = 0; i < con_hudlines; i++)
|
||||||
con_hudtime[i] = 0;
|
con_hudtime[i] = 0;
|
||||||
|
|
||||||
if (cons_hudlines.value < 1)
|
|
||||||
cons_hudlines.value = 1;
|
|
||||||
else if (cons_hudlines.value > MAXHUDLINES)
|
|
||||||
cons_hudlines.value = MAXHUDLINES;
|
|
||||||
|
|
||||||
con_hudlines = cons_hudlines.value;
|
con_hudlines = cons_hudlines.value;
|
||||||
|
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
@ -799,9 +795,8 @@ void CON_Ticker(void)
|
||||||
// make overlay messages disappear after a while
|
// make overlay messages disappear after a while
|
||||||
for (i = 0; i < con_hudlines; i++)
|
for (i = 0; i < con_hudlines; i++)
|
||||||
{
|
{
|
||||||
con_hudtime[i]--;
|
if (con_hudtime[i])
|
||||||
if (con_hudtime[i] < 0)
|
con_hudtime[i]--;
|
||||||
con_hudtime[i] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
@ -1349,7 +1344,8 @@ boolean CON_Responder(event_t *ev)
|
||||||
static void CON_Linefeed(void)
|
static void CON_Linefeed(void)
|
||||||
{
|
{
|
||||||
// set time for heads up messages
|
// set time for heads up messages
|
||||||
con_hudtime[con_cy%con_hudlines] = cons_msgtimeout.value*TICRATE;
|
if (con_hudlines)
|
||||||
|
con_hudtime[con_cy%con_hudlines] = cons_msgtimeout.value*TICRATE;
|
||||||
|
|
||||||
con_cy++;
|
con_cy++;
|
||||||
con_cx = 0;
|
con_cx = 0;
|
||||||
|
|
@ -1689,7 +1685,7 @@ static void CON_DrawHudlines(void)
|
||||||
INT32 charwidth = 8 * con_scalefactor;
|
INT32 charwidth = 8 * con_scalefactor;
|
||||||
INT32 charheight = 8 * con_scalefactor;
|
INT32 charheight = 8 * con_scalefactor;
|
||||||
|
|
||||||
if (con_hudlines <= 0)
|
if (!con_hudlines)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (chat_on && OLDCHAT)
|
if (chat_on && OLDCHAT)
|
||||||
|
|
@ -1697,7 +1693,7 @@ static void CON_DrawHudlines(void)
|
||||||
else
|
else
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
for (i = con_cy - con_hudlines+1; i <= con_cy; i++)
|
for (i = con_cy - con_hudlines; i <= con_cy; i++)
|
||||||
{
|
{
|
||||||
size_t c;
|
size_t c;
|
||||||
INT32 x;
|
INT32 x;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue