mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-26 05:51:36 +00:00
changed texture update validation to normal CRC
This commit is contained in:
parent
5242630d16
commit
1a3eb27f8b
1 changed files with 8 additions and 15 deletions
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "bothdefs.h" // needed by: common.h, net.h, client.h
|
#include "bothdefs.h" // needed by: common.h, net.h, client.h
|
||||||
|
|
||||||
|
#include "crc.h" // LordHavoc: for texture update validation
|
||||||
#include "bspfile.h" // needed by: glquake.h
|
#include "bspfile.h" // needed by: glquake.h
|
||||||
#include "vid.h"
|
#include "vid.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
@ -79,9 +80,6 @@ extern byte *draw_chars; // 8*8 graphic characters
|
||||||
qpic_t *draw_disc;
|
qpic_t *draw_disc;
|
||||||
qpic_t *draw_backtile;
|
qpic_t *draw_backtile;
|
||||||
|
|
||||||
static int ltexcrctable[256]; // cache mismatch checking --KB
|
|
||||||
|
|
||||||
|
|
||||||
static int translate_texture;
|
static int translate_texture;
|
||||||
static int char_texture;
|
static int char_texture;
|
||||||
static int cs_texture; // crosshair texturea
|
static int cs_texture; // crosshair texturea
|
||||||
|
@ -120,7 +118,7 @@ typedef struct
|
||||||
int width, height;
|
int width, height;
|
||||||
int bytesperpixel;
|
int bytesperpixel;
|
||||||
qboolean mipmap;
|
qboolean mipmap;
|
||||||
int crc; // not really a standard CRC, but it works
|
unsigned short crc; // LordHavoc: CRC for texture validation
|
||||||
} gltexture_t;
|
} gltexture_t;
|
||||||
|
|
||||||
static gltexture_t gltextures[MAX_GLTEXTURES];
|
static gltexture_t gltextures[MAX_GLTEXTURES];
|
||||||
|
@ -1326,16 +1324,11 @@ GL_LoadTexture
|
||||||
*/
|
*/
|
||||||
int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel)
|
int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel)
|
||||||
{
|
{
|
||||||
int i, s, lcrc;
|
int i, crc;
|
||||||
gltexture_t *glt;
|
gltexture_t *glt;
|
||||||
|
|
||||||
// LordHavoc's cache check, not a standard crc but it works --KB
|
// LordHavoc: now just using a standard CRC for texture validation
|
||||||
lcrc = 0;
|
crc = CRC_Block(data, width*height*bytesperpixel);
|
||||||
s = width*height*bytesperpixel; // size
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
ltexcrctable[i] = i + 1;
|
|
||||||
for (i = 0; i < s; i++)
|
|
||||||
lcrc += (ltexcrctable[data[i] & 255]++);
|
|
||||||
|
|
||||||
// see if the texture is allready present
|
// see if the texture is allready present
|
||||||
if (identifier[0])
|
if (identifier[0])
|
||||||
|
@ -1344,7 +1337,7 @@ int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolea
|
||||||
{
|
{
|
||||||
if (!strcmp (identifier, glt->identifier))
|
if (!strcmp (identifier, glt->identifier))
|
||||||
{
|
{
|
||||||
if (lcrc != glt->crc
|
if (crc != glt->crc
|
||||||
|| width != glt->width
|
|| width != glt->width
|
||||||
|| height != glt->height
|
|| height != glt->height
|
||||||
|| bytesperpixel != glt->bytesperpixel)
|
|| bytesperpixel != glt->bytesperpixel)
|
||||||
|
@ -1368,7 +1361,7 @@ int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolea
|
||||||
texture_extension_number++;
|
texture_extension_number++;
|
||||||
|
|
||||||
SetupTexture:
|
SetupTexture:
|
||||||
glt->crc = lcrc;
|
glt->crc = crc;
|
||||||
glt->width = width;
|
glt->width = width;
|
||||||
glt->height = height;
|
glt->height = height;
|
||||||
glt->bytesperpixel = bytesperpixel;
|
glt->bytesperpixel = bytesperpixel;
|
||||||
|
|
Loading…
Reference in a new issue