Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print centerprint messages to the console #159

Conversation

hemebond
Copy link
Contributor

@hemebond hemebond commented Apr 2, 2024

Add new function Con_CenterPrint which can be used to print messages to the console, without showing onscreen, and with a "horizontal rule" above and below. Use Con_CenterPrint to log centerprint messages to the console.

image

Fixes #98

@bones-was-here
Copy link
Contributor

You seem to have included an unused global con_previouscenterprint.

Do you have plans to call Con_CenterPrint() from other places? If not then IMO this should be inlined in SCR_CenterPrint().

@hemebond
Copy link
Contributor Author

You seem to have included an unused global con_previouscenterprint.

Cheers. That was going to hold the previous message before I found scr_centerstring. Will remove it.

Do you have plans to call Con_CenterPrint() from other places? If not then IMO this should be inlined in SCR_CenterPrint().

I don't think there are other places from where I would call it. You would prefer for the contents of Con_CenterPrint() to be inside SCR_CenterPrint()?

@bones-was-here
Copy link
Contributor

Yes please, we can always split it out later if we find a reason to.

@hemebond
Copy link
Contributor Author

All done.

hemebond and others added 6 commits April 30, 2024 10:57
… center-aligning centerprint messages in the console.
Signed-off-by: bones_was_here <[email protected]>
Signed-off-by: bones_was_here <[email protected]>
Parm names and the printf attribute make IDEs and other tools more useful.

Signed-off-by: bones_was_here <[email protected]>
Fixes printing an empty message when stepping out of the trigger on
alk1.2 start.bsp, and repeated prints of the same message when those are
triggered repeatedly.

Signed-off-by: bones_was_here <[email protected]>
@bones-was-here bones-was-here merged commit 8698e53 into DarkPlacesEngine:master May 28, 2024
1 check passed
bones-was-here added a commit that referenced this pull request May 31, 2024
This code was OK, but if someone were to change the buffer size(s) such
that line[] were smaller than msg[], or were to call Con_CenterPrintf()
with a maxLineLength > 40, then a buffer overflow would have become
possible.  This patch prevents it.

See #159

Signed-off-by: bones_was_here <[email protected]>
bones-was-here added a commit that referenced this pull request Aug 1, 2024
Fixes a bug introduced by me in
#159 where a
`svc_finale` message with the empty string could cause a
previously displayed engine centreprint to appear again.

Signed-off-by: bones_was_here <[email protected]>
nyov pushed a commit to xonotic/darkplaces that referenced this pull request Aug 5, 2024
Fixes a bug introduced by me in
DarkPlacesEngine/DarkPlaces#159 where a
`svc_finale` message with the empty string could cause a
previously displayed engine centreprint to appear again.

Signed-off-by: bones_was_here <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

centerprint text should also go into the console
2 participants