From: eihrul Date: Mon, 8 Mar 2010 03:08:08 +0000 (+0000) Subject: misc IQM loading fixes X-Git-Tag: xonotic-v0.1.0preview~230^2~428 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=63d72af7573ba79f1c8f5cfd95cdafa5bd9a0f1f;p=xonotic%2Fdarkplaces.git misc IQM loading fixes git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10041 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_alias.c b/model_alias.c index b9dafe91..6c57d609 100644 --- a/model_alias.c +++ b/model_alias.c @@ -3086,6 +3086,7 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) iqmpose_t *pose; iqmmesh_t *mesh; iqmbounds_t *bounds; + iqmvertexarray_t *va; unsigned short *framedata; float biggestorigin; const int *inelements; @@ -3145,39 +3146,39 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) return; } + va = (iqmvertexarray_t *)(pbase + header->ofs_vertexarrays); for (i = 0;i < (int)header->num_vertexarrays;i++) { - iqmvertexarray_t *va = (iqmvertexarray_t *)(pbase + header->ofs_vertexarrays); - va->type = LittleLong(va->type); - va->flags = LittleLong(va->flags); - va->format = LittleLong(va->format); - va->size = LittleLong(va->size); - va->offset = LittleLong(va->offset); - switch (va->type) + va[i].type = LittleLong(va[i].type); + va[i].flags = LittleLong(va[i].flags); + va[i].format = LittleLong(va[i].format); + va[i].size = LittleLong(va[i].size); + va[i].offset = LittleLong(va[i].offset); + switch (va[i].type) { case IQM_POSITION: - if (va->format == IQM_FLOAT && va->size == 3) - vposition = (float *)(pbase + va->offset); + if (va[i].format == IQM_FLOAT && va[i].size == 3) + vposition = (float *)(pbase + va[i].offset); break; case IQM_TEXCOORD: - if (va->format == IQM_FLOAT && va->size == 2) - vtexcoord = (float *)(pbase + va->offset); + if (va[i].format == IQM_FLOAT && va[i].size == 2) + vtexcoord = (float *)(pbase + va[i].offset); break; case IQM_NORMAL: - if (va->format == IQM_FLOAT && va->size == 3) - vnormal = (float *)(pbase + va->offset); + if (va[i].format == IQM_FLOAT && va[i].size == 3) + vnormal = (float *)(pbase + va[i].offset); break; case IQM_TANGENT: - if (va->format == IQM_FLOAT && va->size == 4) - vtangent = (float *)(pbase + va->offset); + if (va[i].format == IQM_FLOAT && va[i].size == 4) + vtangent = (float *)(pbase + va[i].offset); break; case IQM_BLENDINDEXES: - if (va->format == IQM_UBYTE && va->size == 4) - vblendindexes = (unsigned char *)(pbase + va->offset); + if (va[i].format == IQM_UBYTE && va[i].size == 4) + vblendindexes = (unsigned char *)(pbase + va[i].offset); break; case IQM_BLENDWEIGHTS: - if (va->format == IQM_UBYTE && va->size == 4) - vblendweights = (unsigned char *)(pbase + va->offset); + if (va[i].format == IQM_UBYTE && va[i].size == 4) + vblendweights = (unsigned char *)(pbase + va[i].offset); break; } } @@ -3332,7 +3333,7 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) if (header->ofs_inversebasepose) { inversebasepose = (const float *) (pbase + header->ofs_inversebasepose); - for (i = 0;i < 12*(int)header->num_poses;j++) + for (i = 0;i < 12*(int)header->num_poses;i++) loadmodel->data_baseboneposeinverse[i] = LittleFloat(inversebasepose[i]); }