From 32e828d5ecef847a80dcc44350a55df1220cce95 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 17 Apr 2007 08:03:27 +0000 Subject: [PATCH] fix a crash reported by Lardarse when using more skin textures for a .mdl model than skins exist in the model, this was caused by texture_t containing pointers to itself that were broken by the reallocation of the array git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7113 d7cf8633-e32d-0410-b094-e92efae38249 --- model_alias.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/model_alias.c b/model_alias.c index cece735a..b4e723f9 100644 --- a/model_alias.c +++ b/model_alias.c @@ -1025,6 +1025,14 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) //increase skin counts loadmodel->numskins++; totalskins++; + + // fix up the pointers since they are pointing at the old textures array + // FIXME: this is a hack! + for (j = 0;j < loadmodel->numskins * loadmodel->num_surfaces;j++) + { + loadmodel->data_textures[j].currentframe = &loadmodel->data_textures[j]; + loadmodel->data_textures[j].currentskinframe = &loadmodel->data_textures[j].skinframes[0]; + } } } -- 2.39.2