Some checks failed
Linux / Build Linux (push) Has been cancelled
Linux / Build Linux-1 (push) Has been cancelled
macOS / Build macOS (push) Has been cancelled
macOS / Build macOS-1 (push) Has been cancelled
Windows (MinGW) / Build MinGW (push) Has been cancelled
Windows (MinGW) / Build MinGW-1 (push) Has been cancelled
Windows (MSVC) / Build Windows (push) Has been cancelled
Windows (MSVC) / Build Windows-1 (push) Has been cancelled
113 lines
4.2 KiB
Diff
113 lines
4.2 KiB
Diff
-- from quake retexturing project
|
|
|
|
diff --git a/Quake/gl_model.c b/Quake/gl_model.c
|
|
index ea6a68b..eec1f0f 100644
|
|
--- a/Quake/gl_model.c
|
|
+++ b/Quake/gl_model.c
|
|
@@ -40,6 +40,8 @@
|
|
static cvar_t external_vis = {"external_vis", "1", CVAR_ARCHIVE};
|
|
static cvar_t external_textures = {"external_textures", "1", CVAR_ARCHIVE};
|
|
|
|
+extern cvar_t r_externaltexture_fix; //mk
|
|
+
|
|
static byte *mod_novis;
|
|
static int mod_novis_capacity;
|
|
|
|
@@ -808,6 +810,13 @@ static void Mod_LoadTextures (lump_t *l)
|
|
if (!q_strncasecmp(tx->name,"sky",3)) //sky texture //also note -- was Q_strncmp, changed to match qbsp
|
|
#endif
|
|
{
|
|
+ if (r_externaltexture_fix.value) { //mk
|
|
+ if (strstr(tx->name,"sky4")) {
|
|
+ if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==13039)
|
|
+ q_strlcpy(tx->name, "sky1", sizeof(tx->name));
|
|
+ Con_Printf(" using %s\n", tx->name);
|
|
+ }
|
|
+ }
|
|
if (loadmodel->bspversion == BSPVERSION_QUAKE64)
|
|
Sky_LoadTextureQ64 (loadmodel, tx);
|
|
else
|
|
@@ -878,6 +887,50 @@ static void Mod_LoadTextures (lump_t *l)
|
|
//external textures -- first look in "textures/mapname/" then look in "textures/"
|
|
mark = Hunk_LowMark ();
|
|
COM_StripExtension (loadmodel->name + 5, mapname, sizeof(mapname));
|
|
+
|
|
+ if (r_externaltexture_fix.value) { //mk
|
|
+ if (strstr(tx->name,"plat_top1")) {
|
|
+ if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==24428)
|
|
+ q_strlcpy(tx->name, "plat_top1_cable", sizeof(tx->name));
|
|
+ else
|
|
+ q_strlcpy(tx->name, "plat_top1_bolt", sizeof(tx->name));
|
|
+ Con_Printf(" using %s\n", tx->name);
|
|
+ }
|
|
+ if (strstr(tx->name,"metal5_2")) {
|
|
+ if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==49173)
|
|
+ q_strlcpy(tx->name, "metal5_2_x", sizeof(tx->name));
|
|
+ else
|
|
+ q_strlcpy(tx->name, "metal5_2_arc", sizeof(tx->name));
|
|
+ Con_Printf(" using %s\n", tx->name);
|
|
+ }
|
|
+ if (strstr(tx->name,"metal5_4")) {
|
|
+ if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==20977)
|
|
+ q_strlcpy(tx->name, "metal5_4_double", sizeof(tx->name));
|
|
+ else
|
|
+ q_strlcpy(tx->name, "metal5_4_arc", sizeof(tx->name));
|
|
+ Con_Printf(" using %s\n", tx->name);
|
|
+ }
|
|
+ if (strstr(tx->name,"metal5_8")) {
|
|
+ if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==48444)
|
|
+ q_strlcpy(tx->name, "metal5_8_rune", sizeof(tx->name));
|
|
+ else
|
|
+ q_strlcpy(tx->name, "metal5_8_back", sizeof(tx->name));
|
|
+ Con_Printf(" using %s\n", tx->name);
|
|
+ }
|
|
+ if (strstr(tx->name,"metal5_8")) {
|
|
+ if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==48444)
|
|
+ q_strlcpy(tx->name, "metal5_8_rune", sizeof(tx->name));
|
|
+ else
|
|
+ q_strlcpy(tx->name, "metal5_8_back", sizeof(tx->name));
|
|
+ Con_Printf(" using %s\n", tx->name);
|
|
+ }
|
|
+ if (strstr(tx->name,"window03")) {
|
|
+ if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==63697) // e4m2 variant
|
|
+ q_strlcpy(tx->name, "window03_e4m2", sizeof(tx->name));
|
|
+ Con_Printf(" using %s\n", tx->name);
|
|
+ }
|
|
+ }
|
|
+
|
|
q_snprintf (filename, sizeof(filename), "textures/%s/%s", mapname, tx->name);
|
|
data = Image_LoadImage (filename, &fwidth, &fheight);
|
|
if (!data)
|
|
diff --git a/Quake/gl_rmain.c b/Quake/gl_rmain.c
|
|
index 1406759..7b6280f 100644
|
|
--- a/Quake/gl_rmain.c
|
|
+++ b/Quake/gl_rmain.c
|
|
@@ -100,6 +100,8 @@
|
|
extern cvar_t r_vfog;
|
|
//johnfitz
|
|
|
|
+cvar_t r_externaltexture_fix = {"r_externaltexture_fix", "0", CVAR_ARCHIVE}; //mk
|
|
+
|
|
cvar_t gl_zfix = {"gl_zfix", "0", CVAR_NONE}; // QuakeSpasm z-fighting fix
|
|
|
|
cvar_t r_lavaalpha = {"r_lavaalpha","0",CVAR_NONE};
|
|
diff --git a/Quake/gl_rmisc.c b/Quake/gl_rmisc.c
|
|
index 963d55e..e9b251b 100644
|
|
--- a/Quake/gl_rmisc.c
|
|
+++ b/Quake/gl_rmisc.c
|
|
@@ -47,6 +47,7 @@
|
|
extern cvar_t r_noshadow_list;
|
|
//johnfitz
|
|
extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix
|
|
+extern cvar_t r_externaltexture_fix; //mk
|
|
|
|
extern gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz
|
|
|
|
@@ -230,6 +231,7 @@ void R_Init (void)
|
|
Cvar_SetCallback (&r_lavaalpha, R_SetLavaalpha_f);
|
|
Cvar_SetCallback (&r_telealpha, R_SetTelealpha_f);
|
|
Cvar_SetCallback (&r_slimealpha, R_SetSlimealpha_f);
|
|
+ Cvar_RegisterVariable (&r_externaltexture_fix);//mk
|
|
|
|
R_InitParticles ();
|
|
R_SetClearColor_f (&r_clearcolor); //johnfitz
|