diff --git a/engine/d3d/d3d_mesh.c b/engine/d3d/d3d_mesh.c index e0b7fed90..64fbe475b 100644 --- a/engine/d3d/d3d_mesh.c +++ b/engine/d3d/d3d_mesh.c @@ -172,7 +172,11 @@ static galiastexnum_t *D3D_ChooseSkin(galiasinfo_t *inf, char *modelname, int su skinname = modelname; if (!skincolourmapped.numbuckets) - Hash_InitTable(&skincolourmapped, 256, BZ_Malloc(Hash_BytesForBuckets(256))); + { + void *buckets = BZ_Malloc(Hash_BytesForBuckets(256)); + memset(buckets, 0, Hash_BytesForBuckets(256)); + Hash_InitTable(&skincolourmapped, 256, buckets); + } for (cm = Hash_Get(&skincolourmapped, skinname); cm; cm = Hash_GetNext(&skincolourmapped, skinname, cm)) { @@ -211,6 +215,9 @@ static galiastexnum_t *D3D_ChooseSkin(galiasinfo_t *inf, char *modelname, int su cm->skinnum = e->skinnum; cm->texnum.fullbright = 0; cm->texnum.base = 0; +#ifdef Q3SHADERS + cm->texnum.shader = NULL; +#endif if (!texnums) { //load just the skin (q2) diff --git a/engine/d3d9/d3d9_mesh.c b/engine/d3d9/d3d9_mesh.c index 27e635cd1..ec2fbd626 100644 --- a/engine/d3d9/d3d9_mesh.c +++ b/engine/d3d9/d3d9_mesh.c @@ -172,7 +172,11 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s skinname = modelname; if (!skincolourmapped.numbuckets) - Hash_InitTable(&skincolourmapped, 256, BZ_Malloc(Hash_BytesForBuckets(256))); + { + void *buckets = BZ_Malloc(Hash_BytesForBuckets(256)); + memset(buckets, 0, Hash_BytesForBuckets(256)); + Hash_InitTable(&skincolourmapped, 256, buckets); + } for (cm = Hash_Get(&skincolourmapped, skinname); cm; cm = Hash_GetNext(&skincolourmapped, skinname, cm)) { @@ -211,6 +215,9 @@ static galiastexnum_t *D3D9_ChooseSkin(galiasinfo_t *inf, char *modelname, int s cm->skinnum = e->skinnum; cm->texnum.fullbright = 0; cm->texnum.base = 0; +#ifdef Q3SHADERS + cm->texnum.shader = NULL; +#endif if (!texnums) { //load just the skin (q2) diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 32f9d1b78..e3c0b73e8 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -1064,7 +1064,11 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur } if (!skincolourmapped.numbuckets) - Hash_InitTable(&skincolourmapped, 256, BZ_Malloc(Hash_BytesForBuckets(256))); + { + void *buckets = BZ_Malloc(Hash_BytesForBuckets(256)); + memset(buckets, 0, Hash_BytesForBuckets(256)); + Hash_InitTable(&skincolourmapped, 256, buckets); + } for (cm = Hash_Get(&skincolourmapped, skinname); cm; cm = Hash_GetNext(&skincolourmapped, skinname, cm)) { @@ -1097,6 +1101,9 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, int sur cm->skinnum = e->skinnum; cm->texnum.fullbright = 0; cm->texnum.base = 0; +#ifdef Q3SHADERS + cm->texnum.shader = NULL; +#endif if (!texnums) { //load just the skin @@ -2808,3 +2815,4 @@ void GL_GenerateNormals(float *orgs, float *normals, int *indicies, int numtris, #endif #endif // defined(RGLQUAKE) || defined(SERVERONLY) + diff --git a/engine/qclib/hash.c b/engine/qclib/hash.c index 5b0f2d88e..e30a5773f 100644 --- a/engine/qclib/hash.c +++ b/engine/qclib/hash.c @@ -8,6 +8,7 @@ #endif #endif +// hash init assumes we get clean memory void Hash_InitTable(hashtable_t *table, int numbucks, void *mem) { table->numbuckets = numbucks;