mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +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
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2005-2016 Christoph Oelckers
|
||||
|
@ -415,21 +415,41 @@ static unsigned FindModel(const char * path, const char * modelfile)
|
|||
FMemLump lumpd = Wads.ReadLump(lump);
|
||||
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;
|
||||
}
|
||||
else if (!memcmp(buffer, "UMSH", 4))
|
||||
{
|
||||
model = new FUE1Model;
|
||||
if (!memcmp(buffer, "DMDM", 4))
|
||||
{
|
||||
model = new FDMDModel;
|
||||
}
|
||||
else if (!memcmp(buffer, "IDP2", 4))
|
||||
{
|
||||
model = new FMD2Model;
|
||||
}
|
||||
else if (!memcmp(buffer, "IDP3", 4))
|
||||
{
|
||||
model = new FMD3Model;
|
||||
}
|
||||
}
|
||||
|
||||
if (model != nullptr)
|
||||
|
@ -541,7 +561,7 @@ void gl_InitModels()
|
|||
smf.xscale=smf.yscale=smf.zscale=1.f;
|
||||
|
||||
smf.type = PClass::FindClass(sc.String);
|
||||
if (!smf.type || smf.type->Defaults == nullptr)
|
||||
if (!smf.type || smf.type->Defaults == nullptr)
|
||||
{
|
||||
sc.ScriptError("MODELDEF: Unknown actor type '%s'\n", sc.String);
|
||||
}
|
||||
|
@ -581,7 +601,7 @@ void gl_InitModels()
|
|||
sc.MustGetFloat();
|
||||
smf.zscale = sc.Float;
|
||||
}
|
||||
// [BB] Added zoffset reading.
|
||||
// [BB] Added zoffset reading.
|
||||
// Now it must be considered deprecated.
|
||||
else if (sc.Compare("zoffset"))
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
// 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);
|
||||
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
|
||||
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