Sike, even better: Hack in textureflag support.

This commit is contained in:
Steam Deck User 2023-02-13 17:38:10 -05:00
parent fd4c35185c
commit b30f349572
3 changed files with 51 additions and 44 deletions

View file

@ -1251,30 +1251,50 @@ void Mod_LoadFaces (lump_t *l)
else
out->samples = loadmodel->lightdata + (i);
if (!Q_strncmp(out->texinfo->texture->name,"sky",3))
{
// motolegacy -- moved from video_hardware_surface
// modified to use new TEXFLAG hacky fields and have
// surfs use the same shabang.
const char* tex_name = out->texinfo->texture->name;
// Sky textures.
if (tex_name[0] == 's' && tex_name[1] == 'k' && tex_name[2] == 'y') {
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
//if(kurok)
//GL_SubdivideSurface (out); // cut up polygon for warps
//else
GL_Surface (out); // Don't cut up polygon for warps
GL_Surface(out); // Don't cut up polygon for warps
continue;
}
if (!Q_strncmp(out->texinfo->texture->name,"*",1))// turbulent
{
// Turbulent.
else if (tex_name[0] == '*') {
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
for (i=0 ; i<2 ; i++)
{
out->extents[i] = 16384;
out->texturemins[i] = -8192;
}
GL_Surface (out); // Don't cut up polygon for warps
//GL_SubdivideSurface (out);// cut up polygon for warps
continue;
}
// Don't draw texture and lightmaps.
else if (tex_name[0] == 'n' && tex_name[1] == 'o' && tex_name[2] == 'd' && tex_name[3] == 'r' &&
tex_name[4] == 'a' && tex_name[5] == 'w') {
out->flags |= TEXFLAG_NODRAW;
continue;
}
// Surface uvmaps warp, like metal or glass effects.
else if ((tex_name[0] == 'e' && tex_name[1] == 'n' && tex_name[2] == 'v') || (tex_name[0] == 'g' &&
tex_name[1] == 'l' && tex_name[2] == 'a' && tex_name[3] == 's' && tex_name[4] == 's')) {
out->flags |= TEXFLAG_REFLECT;
continue;
} else {
out->flags |= TEXFLAG_NORMAL;
continue;
}
// motolegacy -- end modification
}
}

View file

@ -111,10 +111,14 @@ typedef struct texture_s
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
#define SURF_DRAWSPRITE 8
#define SURF_DRAWTURB 0x10
#define SURF_DRAWTILED 0x20
#define SURF_DRAWBACKGROUND 0x40
#define SURF_UNDERWATER 0x80
#define SURF_DRAWTURB 0x10 // 16
#define SURF_DRAWTILED 0x20 // 32
#define SURF_DRAWBACKGROUND 0x40 // 64
#define SURF_UNDERWATER 0x80 // 128
#define TEXFLAG_NODRAW 256
#define TEXFLAG_REFLECT 512
#define TEXFLAG_NORMAL 1024
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct

View file

@ -912,40 +912,23 @@ void R_RenderBrushPoly (msurface_t *fa)
}
sceGuEnable(GU_ALPHA_TEST);
sceGuAlphaFunc(GU_GREATER, 0xaa, 0xff);
sceGuAlphaFunc(GU_GREATER, 0x88, 0xff);
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
// motolegacy -- avoid spamming with strncmp lol
// a little ugly but does the job!
// also some improved logic thanks to darkduke/ipq
const char *tex_name = fa->texinfo->texture->name;
if (fa->flags & SURF_UNDERWATER)
DrawGLWaterPoly (fa->polys);
// Don't draw texture and lightmaps.
else if (tex_name[0] == 'n' && tex_name[1] == 'o' &&
tex_name[2] == 'd' && tex_name[3] == 'r' &&
tex_name[4] == 'a' && tex_name[5] == 'w')
// motolegacy -- use our new texflag hack
if (fa->flags & TEXFLAG_NODRAW)
return;
// Alpha blended textures, no lightmaps.
else if (tex_name[0] == '{' || tex_name[0] == 'z') {
DrawGLPoly(fa->polys);
switch(fa->flags) {
case TEXFLAG_REFLECT:
EmitReflectivePolys(fa);
break;
case TEXFLAG_NORMAL:
default:
DrawGLPoly(fa->polys);
break;
}
// No lightmaps.
else if (tex_name[0] == 'l' && tex_name[1] == 'i' &&
tex_name[2] == 'g' && tex_name[3] == 'h' &&
tex_name[4] == 't') {
DrawGLPoly(fa->polys);
}
// Surface uvmaps warp, like metal or glass effects.
else if ((tex_name[0] == 'e' && tex_name[1] == 'n' &&
tex_name[2] == 'v') || (tex_name[0] == 'g' &&
tex_name[1] == 'l' && tex_name[2] == 'a' &&
tex_name[3] == 's' && tex_name[4] == 's')) {
EmitReflectivePolys(fa);
} else
DrawGLPoly(fa->polys);
// motolegacy -- end new stuff
// motolegacy -- end texflags
// add the poly to the proper lightmap chain
fa->polys->chain = lightmap_polys[fa->lightmaptexturenum];