mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 00:20:51 +00:00
Discarded "UMSH" packed format, now loads _d.3d + _a.3d pairs
This commit is contained in:
parent
f285e550d6
commit
ffc12eec29
2 changed files with 61 additions and 25 deletions
|
@ -415,21 +415,41 @@ static unsigned FindModel(const char * path, const char * modelfile)
|
||||||
FMemLump lumpd = Wads.ReadLump(lump);
|
FMemLump lumpd = Wads.ReadLump(lump);
|
||||||
char * buffer = (char*)lumpd.GetMem();
|
char * buffer = (char*)lumpd.GetMem();
|
||||||
|
|
||||||
if (!memcmp(buffer, "DMDM", 4))
|
bool isunreal3d = false;
|
||||||
|
if ( fullname.IndexOf("_d.3d") == fullname.Len()-5 )
|
||||||
{
|
{
|
||||||
model = new FDMDModel;
|
FString anivfile = fullname.GetChars();
|
||||||
|
anivfile.Substitute("_d.3d","_a.3d");
|
||||||
|
if ( Wads.CheckNumForFullName(anivfile) > 0 )
|
||||||
|
{
|
||||||
|
model = new FUE1Model;
|
||||||
|
isunreal3d = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!memcmp(buffer, "IDP2", 4))
|
else if ( fullname.IndexOf("_a.3d") == fullname.Len()-5 )
|
||||||
{
|
{
|
||||||
model = new FMD2Model;
|
FString datafile = fullname.GetChars();
|
||||||
|
datafile.Substitute("_a.3d","_d.3d");
|
||||||
|
if ( Wads.CheckNumForFullName(datafile) > 0 )
|
||||||
|
{
|
||||||
|
model = new FUE1Model;
|
||||||
|
isunreal3d = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!memcmp(buffer, "IDP3", 4))
|
if ( !isunreal3d )
|
||||||
{
|
{
|
||||||
model = new FMD3Model;
|
if (!memcmp(buffer, "DMDM", 4))
|
||||||
}
|
{
|
||||||
else if (!memcmp(buffer, "UMSH", 4))
|
model = new FDMDModel;
|
||||||
{
|
}
|
||||||
model = new FUE1Model;
|
else if (!memcmp(buffer, "IDP2", 4))
|
||||||
|
{
|
||||||
|
model = new FMD2Model;
|
||||||
|
}
|
||||||
|
else if (!memcmp(buffer, "IDP3", 4))
|
||||||
|
{
|
||||||
|
model = new FMD3Model;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model != nullptr)
|
if (model != nullptr)
|
||||||
|
|
|
@ -42,18 +42,34 @@ double unpackuvert( uint32_t n, int c )
|
||||||
bool FUE1Model::Load( const char *filename, int lumpnum, const char *buffer, int length )
|
bool FUE1Model::Load( const char *filename, int lumpnum, const char *buffer, int length )
|
||||||
{
|
{
|
||||||
mLumpNum = lumpnum;
|
mLumpNum = lumpnum;
|
||||||
// read signature
|
int lumpnum2;
|
||||||
if ( memcmp(buffer,"UMSH",4) )
|
FMemLump lump2;
|
||||||
return false;
|
const char *buffer2;
|
||||||
// map structures
|
FString realfilename = Wads.GetLumpFullName(lumpnum);
|
||||||
int ofs = 4;
|
if ( realfilename.IndexOf("_d.3d") == realfilename.Len()-5 )
|
||||||
dhead = (d3dhead*)(buffer+ofs);
|
{
|
||||||
ofs += sizeof(d3dhead);
|
realfilename.Substitute("_d.3d","_a.3d");
|
||||||
dpolys = (d3dpoly*)(buffer+ofs);
|
lumpnum2 = Wads.CheckNumForFullName(realfilename);
|
||||||
ofs += sizeof(d3dpoly)*dhead->numpolys;
|
lump2 = Wads.ReadLump(lumpnum2);
|
||||||
ahead = (a3dhead*)(buffer+ofs);
|
buffer2 = (char*)lump2.GetMem();
|
||||||
ofs += sizeof(a3dhead);
|
// map structures
|
||||||
averts = (uint32_t*)(buffer+ofs);
|
dhead = (d3dhead*)(buffer);
|
||||||
|
dpolys = (d3dpoly*)(buffer+sizeof(d3dhead));
|
||||||
|
ahead = (a3dhead*)(buffer2);
|
||||||
|
averts = (uint32_t*)(buffer2+sizeof(a3dhead));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
realfilename.Substitute("_a.3d","_d.3d");
|
||||||
|
lumpnum2 = Wads.CheckNumForFullName(realfilename);
|
||||||
|
lump2 = Wads.ReadLump(lumpnum2);
|
||||||
|
buffer2 = (char*)lump2.GetMem();
|
||||||
|
// map structures
|
||||||
|
dhead = (d3dhead*)(buffer2);
|
||||||
|
dpolys = (d3dpoly*)(buffer2+sizeof(d3dhead));
|
||||||
|
ahead = (a3dhead*)(buffer);
|
||||||
|
averts = (uint32_t*)(buffer+sizeof(a3dhead));
|
||||||
|
}
|
||||||
// set counters
|
// set counters
|
||||||
numVerts = dhead->numverts;
|
numVerts = dhead->numverts;
|
||||||
numFrames = ahead->numframes;
|
numFrames = ahead->numframes;
|
||||||
|
|
Loading…
Reference in a new issue