1
0
Fork 0
forked from fte/fteqw

Fixed hexen2 dedicated server models.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3610 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-10-23 17:52:28 +00:00
parent cfde45d9fc
commit 1b34642cb2
2 changed files with 31 additions and 13 deletions

View file

@ -1917,11 +1917,11 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
Q_strncpyz(frame->name, frameinfo->name, sizeof(frame->name)); Q_strncpyz(frame->name, frameinfo->name, sizeof(frame->name));
verts = (vecV_t *)(pose+1); verts = (vecV_t *)(pose+1);
normals = (vec3_t*)&verts[galias->numverts];
svec = &normals[galias->numverts]; svec = &normals[galias->numverts];
tvec = &svec[galias->numverts]; tvec = &svec[galias->numverts];
pose->ofsverts = (char *)verts - (char *)pose; pose->ofsverts = (char *)verts - (char *)pose;
#ifndef SERVERONLY #ifndef SERVERONLY
normals = (vec3_t*)&verts[galias->numverts];
pose->ofsnormals = (char *)normals - (char *)pose; pose->ofsnormals = (char *)normals - (char *)pose;
pose->ofssvector = (char *)svec - (char *)pose; pose->ofssvector = (char *)svec - (char *)pose;
pose->ofstvector = (char *)tvec - (char *)pose; pose->ofstvector = (char *)tvec - (char *)pose;
@ -1940,7 +1940,9 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
if (seamremaps[j] != j) if (seamremaps[j] != j)
{ {
VectorCopy(verts[j], verts[seamremaps[j]]); VectorCopy(verts[j], verts[seamremaps[j]]);
#ifndef SERVERONLY
VectorCopy(normals[j], normals[seamremaps[j]]); VectorCopy(normals[j], normals[seamremaps[j]]);
#endif
} }
} }
@ -1953,16 +1955,21 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
case ALIAS_GROUP_SWAPPED: // prerelease case ALIAS_GROUP_SWAPPED: // prerelease
ingroup = (daliasgroup_t *)(pframetype+1); ingroup = (daliasgroup_t *)(pframetype+1);
pose = (galiaspose_t *)Hunk_Alloc(LittleLong(ingroup->numframes)*(sizeof(galiaspose_t) + (sizeof(vecV_t)+sizeof(vec3_t)*3)*galias->numverts));
frame->poseofs = (char *)pose - (char *)frame;
frame->numposes = LittleLong(ingroup->numframes); frame->numposes = LittleLong(ingroup->numframes);
frame->loop = true; #ifdef SERVERONLY
galias->groups++; pose = (galiaspose_t *)Hunk_Alloc(frame->numposes*(sizeof(galiaspose_t) + sizeof(vecV_t)*galias->numverts));
verts = (vecV_t *)(pose+frame->numposes);
#else
pose = (galiaspose_t *)Hunk_Alloc(frame->numposes*(sizeof(galiaspose_t) + (sizeof(vecV_t)+sizeof(vec3_t)*3)*galias->numverts));
verts = (vecV_t *)(pose+frame->numposes); verts = (vecV_t *)(pose+frame->numposes);
normals = (vec3_t*)&verts[galias->numverts]; normals = (vec3_t*)&verts[galias->numverts];
svec = &normals[galias->numverts]; svec = &normals[galias->numverts];
tvec = &svec[galias->numverts]; tvec = &svec[galias->numverts];
#endif
frame->poseofs = (char *)pose - (char *)frame;
frame->loop = true;
galias->groups++;
intervals = (daliasinterval_t *)(ingroup+1); intervals = (daliasinterval_t *)(ingroup+1);
sinter = LittleFloat(intervals->interval); sinter = LittleFloat(intervals->interval);
@ -1997,13 +2004,19 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
if (seamremaps[j] != j) if (seamremaps[j] != j)
{ {
VectorCopy(verts[j], verts[seamremaps[j]]); VectorCopy(verts[j], verts[seamremaps[j]]);
#ifndef SERVERONLY
VectorCopy(normals[j], normals[seamremaps[j]]); VectorCopy(normals[j], normals[seamremaps[j]]);
#endif
} }
} }
#ifndef SERVERONLY
verts = (vecV_t*)&tvec[galias->numverts]; verts = (vecV_t*)&tvec[galias->numverts];
normals = (vec3_t*)&verts[galias->numverts]; normals = (vec3_t*)&verts[galias->numverts];
svec = &normals[galias->numverts]; svec = &normals[galias->numverts];
tvec = &svec[galias->numverts]; tvec = &svec[galias->numverts];
#else
verts = &verts[galias->numverts];
#endif
pose++; pose++;
pinframe += pq1inmodel->numverts; pinframe += pq1inmodel->numverts;
@ -2022,7 +2035,7 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
return pframetype; return pframetype;
} }
static void *H1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps) static void *H2_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
{ {
galiaspose_t *pose; galiaspose_t *pose;
galiasgroup_t *frame; galiasgroup_t *frame;
@ -2540,7 +2553,7 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
/*separate st + vert lists*/ /*separate st + vert lists*/
pinh2triangles = (dh2triangle_t *)&pinstverts[pq1inmodel->num_st]; pinh2triangles = (dh2triangle_t *)&pinstverts[pq1inmodel->num_st];
seamremap = BZ_Malloc(sizeof(int)*pq1inmodel->numtris*3); seamremap = BZ_Malloc(sizeof(*seamremap)*pq1inmodel->numtris*3);
galias->numverts = pq1inmodel->numverts; galias->numverts = pq1inmodel->numverts;
galias->numindexes = pq1inmodel->numtris*3; galias->numindexes = pq1inmodel->numtris*3;
@ -2609,7 +2622,7 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
#endif #endif
end = &pinh2triangles[pq1inmodel->numtris]; end = &pinh2triangles[pq1inmodel->numtris];
if (H1_LoadFrameGroup((daliasframetype_t *)end, seamremap) == NULL) if (H2_LoadFrameGroup((daliasframetype_t *)end, seamremap) == NULL)
{ {
BZ_Free(seamremap); BZ_Free(seamremap);
Hunk_FreeToLowMark (hunkstart); Hunk_FreeToLowMark (hunkstart);
@ -2631,12 +2644,12 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
if (pinstverts[i].onseam) if (pinstverts[i].onseam)
onseams++; onseams++;
} }
seamremap = BZ_Malloc(sizeof(int)*pq1inmodel->numverts); seamremap = BZ_Malloc(sizeof(*seamremap)*pq1inmodel->numverts);
galias->numverts = pq1inmodel->numverts+onseams; galias->numverts = pq1inmodel->numverts+onseams;
//st //st
#ifndef SERVERONLY #ifndef SERVERONLY
st_array = Hunk_Alloc(sizeof(*st_array)*(pq1inmodel->numverts+onseams)); st_array = Hunk_Alloc(sizeof(*st_array)*(pq1inmodel->numverts+onseams));
galias->ofs_st_array = (char *)st_array - (char *)galias; galias->ofs_st_array = (char *)st_array - (char *)galias;
for (j=pq1inmodel->numverts,i = 0; i < pq1inmodel->numverts; i++) for (j=pq1inmodel->numverts,i = 0; i < pq1inmodel->numverts; i++)
@ -2654,7 +2667,12 @@ qboolean Mod_LoadQ1Model (model_t *mod, void *buffer)
else else
seamremap[i] = i; seamremap[i] = i;
} }
#endif #else
for (i = 0; i < pq1inmodel->numverts; i++)
{
seamremap[i] = i;
}
#endif
//trianglelists; //trianglelists;
pinq1triangles = (dtriangle_t *)&pinstverts[pq1inmodel->numverts]; pinq1triangles = (dtriangle_t *)&pinstverts[pq1inmodel->numverts];

View file

@ -439,7 +439,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
goto couldntload; goto couldntload;
break; break;
case RAPOLYHEADER:
case IDPOLYHEADER: case IDPOLYHEADER:
if (!Mod_LoadQ1Model(mod, buf)) if (!Mod_LoadQ1Model(mod, buf))
goto couldntload; goto couldntload;