[renderer] Fix the other renderers for qwaq not loading gfx.wad

The whole draw system needs an overhaul :/
This commit is contained in:
Bill Currie 2022-05-09 16:30:05 +09:00
parent 2ebefd7850
commit be7a7d8bec
3 changed files with 39 additions and 15 deletions

View file

@ -171,7 +171,7 @@ qpic_t *
gl_Draw_PicFromWad (const char *name)
{
glpic_t *gl;
qpic_t *p, *pic;
qpic_t *p = 0, *pic;
tex_t *targa;
pic = W_GetLumpName (name);
@ -187,7 +187,7 @@ gl_Draw_PicFromWad (const char *name)
} else
gl->texnum = GL_LoadTexture (name, targa->width, targa->height,
targa->data, false, true, 4);
} else {
} else if (pic) {
p = pic;
gl = (glpic_t *) p->data;
gl->texnum = GL_LoadTexture (name, p->width, p->height, p->data,
@ -365,16 +365,23 @@ gl_Draw_Init (void)
true, 4);
width = image->width;
height = image->height;
} else {
draw_chars = W_GetLumpName ("conchars");
for (i = 0; i < 256 * 64; i++)
if (draw_chars[i] == 0)
} else if ((draw_chars = W_GetLumpName ("conchars"))) {
for (i = 0; i < 256 * 64; i++) {
if (draw_chars[i] == 0) {
draw_chars[i] = 255; // proper transparent color
}
}
char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false,
true, 1);
width = 128;
height = 128;
} else {
qpic_t *charspic = Draw_Font8x8Pic ();
char_texture = GL_LoadTexture ("charset", 128, 128, charspic->data,
false, true, 1);
width = 128;
height = 128;
}
// initialize the character cell texture coordinates.

View file

@ -407,11 +407,19 @@ glsl_Draw_Init (void)
draw_scrap = GLSL_CreateScrap (2048, GL_LUMINANCE, 0);
draw_chars = W_GetLumpName ("conchars");
for (i = 0; i < 256 * 64; i++)
if (draw_chars[i] == 0)
draw_chars[i] = 255; // proper transparent color
conchars = pic_data ("conchars", 128, 128, draw_chars);
if (draw_chars) {
for (i = 0; i < 256 * 64; i++) {
if (draw_chars[i] == 0) {
draw_chars[i] = 255; // proper transparent color
}
}
conchars = pic_data ("conchars", 128, 128, draw_chars);
} else {
qpic_t *charspic = Draw_Font8x8Pic ();
conchars = pic_data ("conchars", charspic->width,
charspic->height, charspic->data);
free (charspic);
}
pic = (qpic_t *) QFS_LoadFile (QFS_FOpenFile ("gfx/conback.lmp"), 0);
if (pic) {

View file

@ -237,10 +237,16 @@ Draw_Init (void)
draw_disc = W_GetLumpName ("disc");
draw_backtile = W_GetLumpName ("backtile");
r_rectdesc.width = draw_backtile->width;
r_rectdesc.height = draw_backtile->height;
r_rectdesc.ptexbytes = draw_backtile->data;
r_rectdesc.rowbytes = draw_backtile->width;
if (!draw_chars) {
qpic_t *pic = Draw_Font8x8Pic ();
draw_chars = pic->data; // FIXME indirect hold on the memory
}
if (draw_backtile) {
r_rectdesc.width = draw_backtile->width;
r_rectdesc.height = draw_backtile->height;
r_rectdesc.ptexbytes = draw_backtile->data;
r_rectdesc.rowbytes = draw_backtile->width;
}
}
@ -697,6 +703,9 @@ Draw_TileClear (int x, int y, int w, int h)
byte *psrc;
vrect_t vr;
if (!r_rectdesc.height) {
return;
}
CLIP (x, y, w, h, (int) vid.width, (int) vid.height);
vr.y = y;