[PATCH] Prepare model.c for merge

Differences between the NQ/QW model.c implementations are now trivial to
separate.

diff -urN -X exclude a/NQ/model.c head/NQ/model.c
--- a/NQ/model.c	2006-06-10 20:29:10.000000000 +0930
+++ head/NQ/model.c	2006-06-10 20:31:40.000000000 +0930
@@ -29,6 +29,10 @@
 #include "r_local.h"
 #include "sys.h"
 
+#ifdef QW_HACK
+#include "crc.h"
+#endif
+
 model_t *loadmodel;
 char loadname[32];		// for hunk tags
 
@@ -1119,6 +1123,26 @@
     for (i = 0; i < sizeof(dheader_t) / 4; i++)
 	((int *)header)[i] = LittleLong(((int *)header)[i]);
 
+#ifdef QW_HACK
+    mod->checksum = 0;
+    mod->checksum2 = 0;
+
+// checksum all of the map, except for entities
+    for (i = 0; i < HEADER_LUMPS; i++) {
+	if (i == LUMP_ENTITIES)
+	    continue;
+	mod->checksum ^=
+	    Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
+			      header->lumps[i].filelen);
+
+	if (i == LUMP_VISIBILITY || i == LUMP_LEAFS || i == LUMP_NODES)
+	    continue;
+	mod->checksum2 ^=
+	    Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
+			      header->lumps[i].filelen);
+    }
+#endif
+
 // load into heap
 
     Mod_LoadVertexes(&header->lumps[LUMP_VERTEXES]);
@@ -1409,6 +1433,35 @@
     int skinsize;
     int start, end, total;
 
+#ifdef QW_HACK
+    if (!strcmp(loadmodel->name, "progs/player.mdl") ||
+	!strcmp(loadmodel->name, "progs/eyes.mdl")) {
+	unsigned short crc;
+	byte *p;
+	int len;
+	char st[40];
+
+	CRC_Init(&crc);
+	for (len = com_filesize, p = buffer; len; len--, p++)
+	    CRC_ProcessByte(&crc, *p);
+
+	sprintf(st, "%d", (int)crc);
+	Info_SetValueForKey(cls.userinfo,
+			    !strcmp(loadmodel->name,
+				    "progs/player.mdl") ? pmodel_name :
+			    emodel_name, st, MAX_INFO_STRING);
+
+	if (cls.state >= ca_connected) {
+	    MSG_WriteByte(&cls.netchan.message, clc_stringcmd);
+	    sprintf(st, "setinfo %s %d",
+		    !strcmp(loadmodel->name,
+			    "progs/player.mdl") ? pmodel_name : emodel_name,
+		    (int)crc);
+	    SZ_Print(&cls.netchan.message, st);
+	}
+    }
+#endif
+
     start = Hunk_LowMark();
 
     pinmodel = (mdl_t *)buffer;
diff -urN -X exclude a/QW/client/model.c head/QW/client/model.c
--- a/QW/client/model.c	2006-06-10 20:29:10.000000000 +0930
+++ head/QW/client/model.c	2006-06-10 20:31:26.000000000 +0930
@@ -25,11 +25,14 @@
 #include <stdint.h>
 
 #include "console.h"
-#include "crc.h"
 #include "quakedef.h"
 #include "r_local.h"
 #include "sys.h"
 
+#ifdef QW_HACK
+#include "crc.h"
+#endif
+
 model_t *loadmodel;
 char loadname[32];		// for hunk tags
 
@@ -1120,6 +1123,7 @@
     for (i = 0; i < sizeof(dheader_t) / 4; i++)
 	((int *)header)[i] = LittleLong(((int *)header)[i]);
 
+#ifdef QW_HACK
     mod->checksum = 0;
     mod->checksum2 = 0;
 
@@ -1137,6 +1141,7 @@
 	    Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
 			      header->lumps[i].filelen);
     }
+#endif
 
 // load into heap
 
@@ -1428,6 +1433,7 @@
     int skinsize;
     int start, end, total;
 
+#ifdef QW_HACK
     if (!strcmp(loadmodel->name, "progs/player.mdl") ||
 	!strcmp(loadmodel->name, "progs/eyes.mdl")) {
 	unsigned short crc;
@@ -1454,6 +1460,7 @@
 	    SZ_Print(&cls.netchan.message, st);
 	}
     }
+#endif
 
     start = Hunk_LowMark();
 
