Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
cc6eac08
Commit
cc6eac08
authored
Feb 4, 2023
by
Zwip-Zwap Zapony
Browse files
Options
Downloads
Patches
Plain Diff
Fix con_hudlines being off by one
parent
337a94eb
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1931
Fix con_hudlines being off by one, Fix con_hudtime overflow
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/console.c
+8
-11
8 additions, 11 deletions
src/console.c
with
8 additions
and
11 deletions
src/console.c
+
8
−
11
View file @
cc6eac08
...
@@ -72,7 +72,7 @@ static INT32 con_curlines; // vid lines currently used by console
...
@@ -72,7 +72,7 @@ static INT32 con_curlines; // vid lines currently used by console
INT32
con_clipviewtop
;
// (useless)
INT32
con_clipviewtop
;
// (useless)
static
INT
32
con_hudlines
;
// number of console heads up message lines
static
U
INT
8
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
...
@@ -128,7 +128,8 @@ static char con_buffer[CON_BUFFERSIZE];
...
@@ -128,7 +128,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
[]
=
{{
1
,
"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)
...
@@ -168,11 +169,6 @@ static void CONS_hudlines_Change(void)
...
@@ -168,11 +169,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
();
...
@@ -1328,6 +1324,7 @@ boolean CON_Responder(event_t *ev)
...
@@ -1328,6 +1324,7 @@ 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
if
(
con_hudlines
)
con_hudtime
[
con_cy
%
con_hudlines
]
=
cons_msgtimeout
.
value
*
TICRATE
;
con_hudtime
[
con_cy
%
con_hudlines
]
=
cons_msgtimeout
.
value
*
TICRATE
;
con_cy
++
;
con_cy
++
;
...
@@ -1684,7 +1681,7 @@ static void CON_DrawHudlines(void)
...
@@ -1684,7 +1681,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
)
...
@@ -1692,7 +1689,7 @@ static void CON_DrawHudlines(void)
...
@@ -1692,7 +1689,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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment