rendrers: add hereric 2 console font workaround

This commit is contained in:
Denis Pauk 2025-05-17 20:41:36 +03:00
parent d2eeb19428
commit dd6b8f9396
5 changed files with 22 additions and 7 deletions

View file

@ -35,6 +35,7 @@ static image_t *draw_font_alt = NULL;
static stbtt_bakedchar *draw_fontcodes = NULL;
extern qboolean scrap_dirty;
static qboolean draw_chars_has_alt;
void Scrap_Upload(void);
extern unsigned r_rawpalette[256];
@ -51,6 +52,8 @@ Draw_InitLocal(void)
&draw_fontcodes, &draw_font, &draw_font_alt, R_LoadPic);
draw_chars = R_LoadConsoleChars((findimage_t)R_FindImage);
/* Heretic 2 uses more than 128 symbols in image */
draw_chars_has_alt = !(draw_chars && !strcmp(draw_chars->name, "pics/misc/conchars.m32"));
}
void
@ -143,7 +146,7 @@ RDraw_StringScaled(int x, int y, float scale, qboolean alt, const char *message)
{
int xor;
xor = alt ? 0x80 : 0;
xor = (alt && draw_chars_has_alt) ? 0x80 : 0;
if (value > ' ' && value < 128)
{

View file

@ -36,6 +36,7 @@ gl3image_t *draw_chars = NULL;
static gl3image_t *draw_font = NULL;
static gl3image_t *draw_font_alt = NULL;
static stbtt_bakedchar *draw_fontcodes = NULL;
static qboolean draw_chars_has_alt;
static GLuint vbo2D = 0, vao2D = 0, vao2Dcolor = 0; // vao2D is for textured rendering, vao2Dcolor for color-only
@ -51,6 +52,8 @@ GL3_Draw_InitLocal(void)
&draw_fontcodes, &draw_font, &draw_font_alt, (loadimage_t)GL3_LoadPic);
draw_chars = R_LoadConsoleChars((findimage_t)GL3_FindImage);
/* Heretic 2 uses more than 128 symbols in image */
draw_chars_has_alt = !(draw_chars && !strcmp(draw_chars->name, "pics/misc/conchars.m32"));
// set up attribute layout for 2D textured rendering
glGenVertexArrays(1, &vao2D);
@ -215,7 +218,7 @@ GL3_Draw_StringScaled(int x, int y, float scale, qboolean alt, const char *messa
{
int xor;
xor = alt ? 0x80 : 0;
xor = (alt && draw_chars_has_alt) ? 0x80 : 0;
if (value > ' ' && value < 128)
{

View file

@ -36,6 +36,7 @@ gl4image_t *draw_chars = NULL;
static gl4image_t *draw_font = NULL;
static gl4image_t *draw_font_alt = NULL;
static stbtt_bakedchar *draw_fontcodes = NULL;
static qboolean draw_chars_has_alt;
static GLuint vbo2D = 0, vao2D = 0, vao2Dcolor = 0; // vao2D is for textured rendering, vao2Dcolor for color-only
@ -51,6 +52,8 @@ GL4_Draw_InitLocal(void)
&draw_fontcodes, &draw_font, &draw_font_alt, (loadimage_t)GL4_LoadPic);
draw_chars = R_LoadConsoleChars((findimage_t)GL4_FindImage);
/* Heretic 2 uses more than 128 symbols in image */
draw_chars_has_alt = !(draw_chars && !strcmp(draw_chars->name, "pics/misc/conchars.m32"));
// set up attribute layout for 2D textured rendering
glGenVertexArrays(1, &vao2D);
@ -215,7 +218,7 @@ GL4_Draw_StringScaled(int x, int y, float scale, qboolean alt, const char *messa
{
int xor;
xor = alt ? 0x80 : 0;
xor = (alt && draw_chars_has_alt) ? 0x80 : 0;
if (value > ' ' && value < 128)
{

View file

@ -22,7 +22,8 @@
#include "header/local.h"
static image_t *draw_chars; // 8*8 graphic characters
static image_t *draw_chars; // 8*8 graphic characters
static qboolean draw_chars_has_alt;
//=============================================================================
@ -45,9 +46,11 @@ Draw_InitLocal
===============
*/
void
Draw_InitLocal (void)
Draw_InitLocal(void)
{
draw_chars = R_LoadConsoleChars((findimage_t)R_FindImage);
/* Heretic 2 uses more than 128 symbols in image */
draw_chars_has_alt = !(draw_chars && !strcmp(draw_chars->name, "pics/misc/conchars.m32"));
}
/*
@ -379,7 +382,7 @@ RE_Draw_StringScaled(int x, int y, float scale, qboolean alt, const char *messag
{
int xor;
xor = alt ? 0x80 : 0;
xor = (alt && draw_chars_has_alt) ? 0x80 : 0;
while (*message)
{

View file

@ -31,6 +31,7 @@ static image_t *draw_chars = NULL;
static image_t *draw_font = NULL;
static image_t *draw_font_alt = NULL;
static stbtt_bakedchar *draw_fontcodes = NULL;
static qboolean draw_chars_has_alt;
void R_LoadTTFFont(const char *ttffont, int vid_height, float *r_font_size,
int *r_font_height, stbtt_bakedchar **draw_fontcodes,
@ -44,6 +45,8 @@ Draw_InitLocal(void)
&draw_fontcodes, &draw_font, &draw_font_alt, Vk_LoadPic);
draw_chars = R_LoadConsoleChars((findimage_t)Vk_FindImage);
/* Heretic 2 uses more than 128 symbols in image */
draw_chars_has_alt = !(draw_chars && !strcmp(draw_chars->name, "pics/misc/conchars.m32"));
}
void
@ -138,7 +141,7 @@ RE_Draw_StringScaled(int x, int y, float scale, qboolean alt, const char *messag
{
int xor;
xor = alt ? 0x80 : 0;
xor = (alt && draw_chars_has_alt) ? 0x80 : 0;
if (value > ' ' && value < 128)
{