File: quake_retexturing_project.patch

package info (click to toggle)
quakespasm 0.93.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,672 kB
  • sloc: ansic: 52,034; sh: 306; makefile: 263
file content (119 lines) | stat: -rw-r--r-- 4,464 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

Index: Quake/gl_model.c
===================================================================
--- Quake/gl_model.c	(revision 1463)
+++ Quake/gl_model.c	(working copy)
@@ -429,6 +429,8 @@ void Mod_LoadTextures (lump_t *l)
 	extern byte *hunk_base;
 //johnfitz
 
+	extern cvar_t r_externaltexture_fix; //mk
+
 	//johnfitz -- don't return early if no textures; still need to create dummy texture
 	if (!l->filelen)
 	{
@@ -490,7 +492,17 @@ void Mod_LoadTextures (lump_t *l)
 		if (!isDedicated) //no texture uploading for dedicated server
 		{
 			if (!q_strncasecmp(tx->name,"sky",3)) //sky texture //also note -- was Q_strncmp, changed to match qbsp
+			{
+				//mk -- begin
+				if (r_externaltexture_fix.value) {
+					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);
+					}
+				} //mk -- end
 				Sky_LoadTexture (tx);
+			}
 			else if (tx->name[0] == '*') //warping texture
 			{
 				//external textures -- first look in "textures/mapname/" then look in "textures/"
@@ -540,6 +552,52 @@ 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));
+				//mk begin
+				if (r_externaltexture_fix.value) {
+					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);
+					}
+				} //mk end
+
 				q_snprintf (filename, sizeof(filename), "textures/%s/%s", mapname, tx->name);
 				data = Image_LoadImage (filename, &fwidth, &fheight);
 				if (!data)
Index: Quake/gl_rmain.c
===================================================================
--- Quake/gl_rmain.c	(revision 1406)
+++ Quake/gl_rmain.c	(working copy)
@@ -101,6 +101,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
 
Index: Quake/gl_rmisc.c
===================================================================
--- Quake/gl_rmisc.c	(revision 1406)
+++ Quake/gl_rmisc.c	(working copy)
@@ -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
 
@@ -231,6 +232,7 @@ void R_Init (void)
 	Cvar_RegisterVariable (&r_noshadow_list);
 	Cvar_SetCallback (&r_noshadow_list, R_Model_ExtraFlags_List_f);
 	//johnfitz
+	Cvar_RegisterVariable (&r_externaltexture_fix); //mk
 
 	Cvar_RegisterVariable (&gl_zfix); // QuakeSpasm z-fighting fix
 	Cvar_RegisterVariable (&r_lavaalpha);