]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix a crash reported by Lardarse when using more skin textures for a
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Apr 2007 08:03:27 +0000 (08:03 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Apr 2007 08:03:27 +0000 (08:03 +0000)
.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

index cece735a4d26768fbfcc5da466c19b8ed4d57cb5..b4e723f98572a3bdd1b031b4e7483f140079d6e7 100644 (file)
@@ -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];
+                       }
                }
        }