Merge branch 'master' of git@git.magicalgirl.moe:KartKrew/Kart-Public.git into next

This commit is contained in:
Sryder 2020-06-13 14:15:58 +01:00
commit b96d315f25
3 changed files with 40 additions and 28 deletions

View file

@ -143,7 +143,7 @@ static const GLfloat byte2float[256] = {
// -----------------+ // -----------------+
#ifdef DEBUG_TO_FILE #ifdef DEBUG_TO_FILE
FILE *gllogstream; FILE *gllogstream = NULL;
#endif #endif
FUNCPRINTF void GL_DBG_Printf(const char *format, ...) FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
@ -152,14 +152,14 @@ FUNCPRINTF void GL_DBG_Printf(const char *format, ...)
char str[4096] = ""; char str[4096] = "";
va_list arglist; va_list arglist;
if (!gllogstream) if (gllogstream)
gllogstream = fopen("ogllog.txt", "w"); {
va_start(arglist, format);
vsnprintf(str, 4096, format, arglist);
va_end(arglist);
va_start(arglist, format); fwrite(str, strlen(str), 1, gllogstream);
vsnprintf(str, 4096, format, arglist); }
va_end(arglist);
fwrite(str, strlen(str), 1, gllogstream);
#else #else
(void)format; (void)format;
#endif #endif

View file

@ -1408,7 +1408,7 @@ static void P_LoadRawSideDefs2(void *data)
UINT16 i; UINT16 i;
INT32 num; INT32 num;
size_t j; size_t j;
UINT32 cr, cg, cb; RGBA_t color;
for (i = 0; i < numsides; i++) for (i = 0; i < numsides; i++)
{ {
@ -1490,23 +1490,21 @@ static void P_LoadRawSideDefs2(void *data)
// encore mode colormaps! // encore mode colormaps!
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code. // do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
// do this for both the start and fade colormaps. // do this for both the start and fade colormaps.
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0); color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
#ifdef GLENCORE #ifdef GLENCORE
if (encoremap) if (encoremap)
{ {
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
cr = pLocalPalette[j].s.red; color = pLocalPalette[j];
cg = pLocalPalette[j].s.green;
cb = pLocalPalette[j].s.blue;
} }
#endif #endif
sec->extra_colormap->rgba = cr + cg + cb; sec->extra_colormap->rgba = color.rgba;
// alpha // alpha
if (msd->toptexture[7]) if (msd->toptexture[7])
@ -1533,23 +1531,21 @@ static void P_LoadRawSideDefs2(void *data)
col = msd->bottomtexture; col = msd->bottomtexture;
// do the exact same thing as above here. // do the exact same thing as above here.
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0); color.s.red = (HEX2INT(col[1]) << 4) + HEX2INT(col[2]);
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8); color.s.green = (HEX2INT(col[3]) << 4) + HEX2INT(col[4]);
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); color.s.blue = (HEX2INT(col[5]) << 4) + HEX2INT(col[6]);
#ifdef GLENCORE #ifdef GLENCORE
if (encoremap) if (encoremap)
{ {
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)]; j = encoremap[NearestColor(color.s.red, color.s.green, color.s.blue)];
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation //CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
cr = pLocalPalette[j].s.red; color = pLocalPalette[j];
cg = pLocalPalette[j].s.green;
cb = pLocalPalette[j].s.blue;
} }
#endif #endif
sec->extra_colormap->fadergba = cr + cg + cb; sec->extra_colormap->fadergba = color.rgba;
// alpha // alpha
if (msd->bottomtexture[7]) if (msd->bottomtexture[7])

View file

@ -33,6 +33,7 @@
#endif #endif
#include "../doomdef.h" #include "../doomdef.h"
#include "../d_main.h"
#ifdef HWRENDER #ifdef HWRENDER
#include "../hardware/r_opengl/r_opengl.h" #include "../hardware/r_opengl/r_opengl.h"
@ -154,11 +155,26 @@ boolean OglSdlSurface(INT32 w, INT32 h)
{ {
INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value; INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
static boolean first_init = false; static boolean first_init = false;
const char *gllogdir = NULL;
oglflags = 0; oglflags = 0;
if (!first_init) if (!first_init)
{ {
if (!gllogstream)
{
gllogdir = D_Home();
#ifdef DEBUG_TO_FILE
#ifdef DEFAULTDIR
if (gllogdir)
gllogstream = fopen(va("%s/"DEFAULTDIR"/ogllog.txt",gllogdir), "wt");
else
#endif
gllogstream = fopen("./ogllog.txt", "wt");
#endif
}
gl_version = pglGetString(GL_VERSION); gl_version = pglGetString(GL_VERSION);
gl_renderer = pglGetString(GL_RENDERER); gl_renderer = pglGetString(GL_RENDERER);
gl_extensions = pglGetString(GL_EXTENSIONS); gl_extensions = pglGetString(GL_EXTENSIONS);