What, exactly, do you need? :\The Man in Black said:Oh, I know the code. Datas I would need to rewrite would be the contents of submodel arrays, essentially.
void SetBodygroup( CStudioHdr *pstudiohdr, int& body, int iGroup, int iValue )
{
if (! pstudiohdr)
return;
if (iGroup >= pstudiohdr->numbodyparts())
return;
mstudiobodyparts_t *pbodypart = pstudiohdr->pBodypart( iGroup );
if (iValue >= pbodypart->nummodels)
return;
int iCurrent = (body / pbodypart->base) % pbodypart->nummodels;
body = (body - (iCurrent * pbodypart->base) + (iValue * pbodypart->base));
}
Hrmm... If you mean the actual model data... I might be able to find out the bit where it stores it in the model compiler code. (Although, IIRC, I can't make a functional compiler with said code, so...)The Man In Black said:Submodels are stored in one giant single-dimension array, wherein the elements represent every possible combination of the parts. Essentially, the array would look something like:
{ {Head1,Body1,Arms1,Legs1}, {Head2,Body1,Arms1,Legs1}, {Head3 (...) {HeadN,BodyN,ArmsN,LegsN} }
Point is, the model file has compressed it all into something very difficult, thus the complicated equation for finding out the new array location whenever you change a small part. What I would need is to know HOW the model is compressing the submodels into the array. I doubt it's something that one would be able to get the code to spit out. It'd likely take some research hitting buttons ingame.
And as I said, this would all be on the basis that the calculations for finding the right submodel are incorrect, and would do absolutely nothing if the engine was just having trouble displaying the proper one, despite the right index. I'd have to think on how to test which side is buggering without rewriting the calculations anew...
void WriteModel( )
{
int i, j, k;
mstudiobodyparts_t *pbodypart;
mstudiomodel_t *pmodel;
// vec3_t *bbox;
byte *pbone;
vec3_t *pvert;
vec3_t *pnorm;
mstudiomesh_t *pmesh;
s_trianglevert_t *psrctri;
int cur;
int total_tris = 0;
int total_strips = 0;
pbodypart = (mstudiobodyparts_t *)pData;
phdr->numbodyparts = numbodyparts;
phdr->bodypartindex = (pData - pStart);
pData += numbodyparts * sizeof( mstudiobodyparts_t );
pmodel = (mstudiomodel_t *)pData;
pData += nummodels * sizeof( mstudiomodel_t );
for (i = 0, j = 0; i < numbodyparts; i++)
{
strcpy( pbodypart[i].name, bodypart[i].name );
pbodypart[i].nummodels = bodypart[i].nummodels;
pbodypart[i].base = bodypart[i].base;
pbodypart[i].modelindex = ((byte *)&pmodel[j]) - pStart;
j += bodypart[i].nummodels;
}
ALIGN( pData );
cur = (int)pData;
for (i = 0; i < nummodels; i++)
{
int normmap[MAXSTUDIOVERTS];
int normimap[MAXSTUDIOVERTS];
int n = 0;
strcpy( pmodel[i].name, model[i]->name );
// save bbox info
// remap normals to be sorted by skin reference
for (j = 0; j < model[i]->nummesh; j++)
{
for (k = 0; k < model[i]->numnorms; k++)
{
if (model[i]->normal[k].skinref == model[i]->pmesh[j]->skinref)
{
normmap[k] = n;
normimap[n] = k;
n++;
model[i]->pmesh[j]->numnorms++;
}
}
}
// save vertice bones
pbone = pData;
pmodel[i].numverts = model[i]->numverts;
pmodel[i].vertinfoindex = (pData - pStart);
for (j = 0; j < pmodel[i].numverts; j++)
{
*pbone++ = model[i]->vert[j].bone;
}
ALIGN( pbone );
// save normal bones
pmodel[i].numnorms = model[i]->numnorms;
pmodel[i].norminfoindex = ((byte *)pbone - pStart);
for (j = 0; j < pmodel[i].numnorms; j++)
{
*pbone++ = model[i]->normal[normimap[j]].bone;
}
ALIGN( pbone );
pData = pbone;
// save group info
pvert = (vec3_t *)pData;
pData += model[i]->numverts * sizeof( vec3_t );
pmodel[i].vertindex = ((byte *)pvert - pStart);
ALIGN( pData );
pnorm = (vec3_t *)pData;
pData += model[i]->numnorms * sizeof( vec3_t );
pmodel[i].normindex = ((byte *)pnorm - pStart);
ALIGN( pData );
for (j = 0; j < model[i]->numverts; j++)
{
VectorCopy( model[i]->vert[j].org, pvert[j] );
}
for (j = 0; j < model[i]->numnorms; j++)
{
VectorCopy( model[i]->normal[normimap[j]].org, pnorm[j] );
}
printf("vertices %6d bytes (%d vertices, %d normals)\n", pData - cur, model[i]->numverts, model[i]->numnorms);
cur = (int)pData;
// save mesh info
pmesh = (mstudiomesh_t *)pData;
pmodel[i].nummesh = model[i]->nummesh;
pmodel[i].meshindex = (pData - pStart);
pData += pmodel[i].nummesh * sizeof( mstudiomesh_t );
ALIGN( pData );
total_tris = 0;
total_strips = 0;
for (j = 0; j < model[i]->nummesh; j++)
{
int numCmdBytes;
byte *pCmdSrc;
pmesh[j].numtris = model[i]->pmesh[j]->numtris;
pmesh[j].skinref = model[i]->pmesh[j]->skinref;
pmesh[j].numnorms = model[i]->pmesh[j]->numnorms;
psrctri = (s_trianglevert_t *)(model[i]->pmesh[j]->triangle);
for (k = 0; k < pmesh[j].numtris * 3; k++)
{
psrctri->normindex = normmap[psrctri->normindex];
psrctri++;
}
numCmdBytes = BuildTris( model[i]->pmesh[j]->triangle, model[i]->pmesh[j], &pCmdSrc );
pmesh[j].triindex = (pData - pStart);
memcpy( pData, pCmdSrc, numCmdBytes );
pData += numCmdBytes;
ALIGN( pData );
total_tris += pmesh[j].numtris;
total_strips += numcommandnodes;
}
printf("mesh %6d bytes (%d tris, %d strips)\n", pData - cur, total_tris, total_strips);
cur = (int)pData;
}
}
You're... Serious, aren't you?FER said:At least post a link to that goblin, I bet It wouldnt look half bad if it was less boxy and has a different face texture, plus its original content (or is it?... )
Why would you want to replace the current texture with that inflatable balloon texture? :\
Shouldn't it be already like this? I don't know if the models need to have that set but the HL engine should support this. (multiple hitboxes that is)FER said:BTW is it possible that bosses can have more than one hitbox? (eg: like the first boss in cry of fear who has it weakspot in its back but shooting it on anywhere else only stuns it)