Tutorial *24*

This is fairly easy.
Open the ref_gl.dll project. Open "gl_model.c" and look for the function called: R_RegisterModel().

Then after the line right in the beginning that reads:



dmdl_t *pheader;

...add right below it:


//jkrige - md2 tga loading

char md2skin[MAX_PATH];

//jkrige

Then... scroll down in this function till you find the lines reading:



for (i=0 ; i<pheader->num_skins ; i++)

	mod->skins[i] = GL_FindImage ((char *)pheader + pheader->ofs_skins +

i*MAX_SKINNAME, it_skin);

Replace them with:



//jkrige - md2 tga loading

i*MAX_SKINNAME, it_skin);

for (i=0 ; i<pheader->num_skins ; i++)

{

	COM_StripExtension((char *)pheader + pheader->ofs_skins +

	i*MAX_SKINNAME, md2skin);

	strcat(md2skin, ".tga");

	mod->skins[i] = GL_FindImage (md2skin, it_skin);

	if(!mod->skins[i])

	mod->skins[i] = GL_FindImage ((char *)pheader + pheader->ofs_skins +

	i*MAX_SKINNAME, it_skin);

}

//jkrige

*Wham-bam-thank-you-mam* and we are done! :)
All we need to do now is add corresponding TGA textures in the same fasion as per usual, and if the engine finds a TGA it'll load it, rather than the PCX if there is one. ;)



 
Sign up
Login:
Passwd:
[Remember Me]