mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +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,6 +415,29 @@ static unsigned FindModel(const char * path, const char * modelfile)
|
|||
FMemLump lumpd = Wads.ReadLump(lump);
|
||||
char * buffer = (char*)lumpd.GetMem();
|
||||
|
||||
bool isunreal3d = false;
|
||||
if ( fullname.IndexOf("_d.3d") == fullname.Len()-5 )
|
||||
{
|
||||
FString anivfile = fullname.GetChars();
|
||||
anivfile.Substitute("_d.3d","_a.3d");
|
||||
if ( Wads.CheckNumForFullName(anivfile) > 0 )
|
||||
{
|
||||
model = new FUE1Model;
|
||||
isunreal3d = true;
|
||||
}
|
||||
}
|
||||
else if ( fullname.IndexOf("_a.3d") == fullname.Len()-5 )
|
||||
{
|
||||
FString datafile = fullname.GetChars();
|
||||
datafile.Substitute("_a.3d","_d.3d");
|
||||
if ( Wads.CheckNumForFullName(datafile) > 0 )
|
||||
{
|
||||
model = new FUE1Model;
|
||||
isunreal3d = true;
|
||||
}
|
||||
}
|
||||
if ( !isunreal3d )
|
||||
{
|
||||
if (!memcmp(buffer, "DMDM", 4))
|
||||
{
|
||||
model = new FDMDModel;
|
||||
|
@ -427,9 +450,6 @@ static unsigned FindModel(const char * path, const char * modelfile)
|
|||
{
|
||||
model = new FMD3Model;
|
||||
}
|
||||
else if (!memcmp(buffer, "UMSH", 4))
|
||||
{
|
||||
model = new FUE1Model;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
mLumpNum = lumpnum;
|
||||
// read signature
|
||||
if ( memcmp(buffer,"UMSH",4) )
|
||||
return false;
|
||||
int lumpnum2;
|
||||
FMemLump lump2;
|
||||
const char *buffer2;
|
||||
FString realfilename = Wads.GetLumpFullName(lumpnum);
|
||||
if ( realfilename.IndexOf("_d.3d") == realfilename.Len()-5 )
|
||||
{
|
||||
realfilename.Substitute("_d.3d","_a.3d");
|
||||
lumpnum2 = Wads.CheckNumForFullName(realfilename);
|
||||
lump2 = Wads.ReadLump(lumpnum2);
|
||||
buffer2 = (char*)lump2.GetMem();
|
||||
// map structures
|
||||
int ofs = 4;
|
||||
dhead = (d3dhead*)(buffer+ofs);
|
||||
ofs += sizeof(d3dhead);
|
||||
dpolys = (d3dpoly*)(buffer+ofs);
|
||||
ofs += sizeof(d3dpoly)*dhead->numpolys;
|
||||
ahead = (a3dhead*)(buffer+ofs);
|
||||
ofs += sizeof(a3dhead);
|
||||
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
|
||||
numVerts = dhead->numverts;
|
||||
numFrames = ahead->numframes;
|
||||
|
|
Loading…
Reference in a new issue