+ // nothing to do
+ }
+ else if (!strcmp(pchunk->id, "PNTS0000"))
+ {
+ pskpnts_t *p;
+ if (recordsize != sizeof(*p))
+ Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
+ // byteswap in place and keep the pointer
+ numpnts = numrecords;
+ pnts = (pskpnts_t *)buffer;
+ for (index = 0, p = (pskpnts_t *)buffer;index < numrecords;index++, p++)
+ {
+ p->origin[0] = LittleFloat(p->origin[0]);
+ p->origin[1] = LittleFloat(p->origin[1]);
+ p->origin[2] = LittleFloat(p->origin[2]);
+ }
+ buffer = p;
+ }
+ else if (!strcmp(pchunk->id, "VTXW0000"))
+ {
+ pskvtxw_t *p;
+ if (recordsize != sizeof(*p))
+ Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
+ // byteswap in place and keep the pointer
+ numvtxw = numrecords;
+ vtxw = (pskvtxw_t *)buffer;
+ for (index = 0, p = (pskvtxw_t *)buffer;index < numrecords;index++, p++)
+ {
+ p->pntsindex = LittleShort(p->pntsindex);
+ p->texcoord[0] = LittleFloat(p->texcoord[0]);
+ p->texcoord[1] = LittleFloat(p->texcoord[1]);
+ if (p->pntsindex >= numpnts)
+ {
+ Con_Printf("%s: vtxw->pntsindex %i >= numpnts %i\n", loadmodel->name, p->pntsindex, numpnts);
+ p->pntsindex = 0;
+ }
+ }
+ buffer = p;
+ }
+ else if (!strcmp(pchunk->id, "FACE0000"))
+ {
+ pskface_t *p;
+ if (recordsize != sizeof(*p))
+ Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
+ // byteswap in place and keep the pointer
+ numfaces = numrecords;
+ faces = (pskface_t *)buffer;
+ for (index = 0, p = (pskface_t *)buffer;index < numrecords;index++, p++)
+ {
+ p->vtxwindex[0] = LittleShort(p->vtxwindex[0]);
+ p->vtxwindex[1] = LittleShort(p->vtxwindex[1]);
+ p->vtxwindex[2] = LittleShort(p->vtxwindex[2]);
+ p->group = LittleLong(p->group);
+ if (p->vtxwindex[0] >= numvtxw)
+ {
+ Con_Printf("%s: face->vtxwindex[0] %i >= numvtxw %i\n", loadmodel->name, p->vtxwindex[0], numvtxw);
+ p->vtxwindex[0] = 0;
+ }
+ if (p->vtxwindex[1] >= numvtxw)
+ {
+ Con_Printf("%s: face->vtxwindex[1] %i >= numvtxw %i\n", loadmodel->name, p->vtxwindex[1], numvtxw);
+ p->vtxwindex[1] = 0;
+ }
+ if (p->vtxwindex[2] >= numvtxw)
+ {
+ Con_Printf("%s: face->vtxwindex[2] %i >= numvtxw %i\n", loadmodel->name, p->vtxwindex[2], numvtxw);
+ p->vtxwindex[2] = 0;
+ }
+ }
+ buffer = p;
+ }
+ else if (!strcmp(pchunk->id, "MATT0000"))
+ {
+ pskmatt_t *p;
+ if (recordsize != sizeof(*p))
+ Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
+ // byteswap in place and keep the pointer
+ nummatts = numrecords;
+ matts = (pskmatt_t *)buffer;
+ for (index = 0, p = (pskmatt_t *)buffer;index < numrecords;index++, p++)
+ {
+ }
+ buffer = p;
+ }
+ else if (!strcmp(pchunk->id, "REFSKELT"))
+ {
+ pskboneinfo_t *p;
+ if (recordsize != sizeof(*p))
+ Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
+ // byteswap in place and keep the pointer
+ numbones = numrecords;
+ bones = (pskboneinfo_t *)buffer;
+ for (index = 0, p = (pskboneinfo_t *)buffer;index < numrecords;index++, p++)
+ {
+ p->numchildren = LittleLong(p->numchildren);
+ p->parent = LittleLong(p->parent);
+ p->basepose.quat[0] = LittleFloat(p->basepose.quat[0]);
+ p->basepose.quat[1] = LittleFloat(p->basepose.quat[1]);
+ p->basepose.quat[2] = LittleFloat(p->basepose.quat[2]);
+ p->basepose.quat[3] = LittleFloat(p->basepose.quat[3]);
+ p->basepose.origin[0] = LittleFloat(p->basepose.origin[0]);
+ p->basepose.origin[1] = LittleFloat(p->basepose.origin[1]);
+ p->basepose.origin[2] = LittleFloat(p->basepose.origin[2]);
+ p->basepose.unknown = LittleFloat(p->basepose.unknown);
+ p->basepose.size[0] = LittleFloat(p->basepose.size[0]);
+ p->basepose.size[1] = LittleFloat(p->basepose.size[1]);
+ p->basepose.size[2] = LittleFloat(p->basepose.size[2]);
+#ifdef PSKQUATNEGATIONS
+ if (index)
+ {
+ p->basepose.quat[0] *= -1;
+ p->basepose.quat[1] *= -1;
+ p->basepose.quat[2] *= -1;
+ }
+ else
+ {
+ p->basepose.quat[0] *= 1;
+ p->basepose.quat[1] *= -1;
+ p->basepose.quat[2] *= 1;
+ }
+#endif
+ if (p->parent < 0 || p->parent >= numbones)
+ {
+ Con_Printf("%s: bone->parent %i >= numbones %i\n", loadmodel->name, p->parent, numbones);
+ p->parent = 0;
+ }
+ }
+ buffer = p;
+ }
+ else if (!strcmp(pchunk->id, "RAWWEIGHTS"))
+ {
+ pskrawweights_t *p;
+ if (recordsize != sizeof(*p))
+ Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
+ // byteswap in place and keep the pointer
+ numrawweights = numrecords;
+ rawweights = (pskrawweights_t *)buffer;
+ for (index = 0, p = (pskrawweights_t *)buffer;index < numrecords;index++, p++)
+ {
+ p->weight = LittleFloat(p->weight);
+ p->pntsindex = LittleLong(p->pntsindex);
+ p->boneindex = LittleLong(p->boneindex);
+ if (p->pntsindex < 0 || p->pntsindex >= numpnts)
+ {
+ Con_Printf("%s: weight->pntsindex %i >= numpnts %i\n", loadmodel->name, p->pntsindex, numpnts);
+ p->pntsindex = 0;
+ }
+ if (p->boneindex < 0 || p->boneindex >= numbones)
+ {
+ Con_Printf("%s: weight->boneindex %i >= numbones %i\n", loadmodel->name, p->boneindex, numbones);
+ p->boneindex = 0;
+ }
+ }
+ buffer = p;