- fixed some crashes in the .def parser and texture initialization code.

This commit is contained in:
Christoph Oelckers 2020-09-25 20:51:02 +02:00
parent 73c57af9ca
commit 3344e73fed
2 changed files with 29 additions and 14 deletions

View file

@ -13,40 +13,55 @@ using scriptfile = FScanner;
inline int32_t scriptfile_getnumber(scriptfile *sf, int32_t *num)
{
bool res = sf->GetNumber();
if (res) *num = sf->Number;
else *num = 0;
if (num)
{
if (res) *num = sf->Number;
else *num = 0;
}
return !res;
}
inline int32_t scriptfile_getdouble(scriptfile *sf, double *num)
{
bool res = sf->GetFloat();
if (res) *num = sf->Float;
else *num = 0;
if (num)
{
if (res) *num = sf->Float;
else *num = 0;
}
return !res;
}
inline int32_t scriptfile_getstring(scriptfile *sf, FString *st)
{
bool res = sf->GetString();
if (res) *st = sf->String;
else *st = "";
if (st)
{
if (res) *st = sf->String;
else *st = "";
}
return !res;
}
inline int32_t scriptfile_getsymbol(scriptfile *sf, int32_t *num)
{
bool res = sf->GetNumber(true);
if (res) *num = sf->Number;
else *num = 0;
if (num)
{
if (res) *num = sf->Number;
else *num = 0;
}
return !res;
}
inline int32_t scriptfile_getsymbol(scriptfile* sf, int64_t* num)
{
bool res = sf->GetNumber(true);
if (res) *num = sf->BigNumber;
else *num = 0;
if (num)
{
if (res) *num = sf->BigNumber;
else *num = 0;
}
return !res;
}

View file

@ -542,10 +542,10 @@ void BuildTiles::PostLoadSetup()
auto tex = rep.faces[0];
// Make a copy so that multiple appearances of the same texture can be handled. They will all refer to the same internal texture anyway.
tex = MakeGameTexture(tex->GetTexture(), "", ETextureType::Any);
tex->SetGlowmap(glowTex->GetTexture());
tex->SetDetailmap(detailTex->GetTexture());
tex->SetNormalmap(normalTex->GetTexture());
tex->SetSpecularmap(specTex->GetTexture());
if (glowTex) tex->SetGlowmap(glowTex->GetTexture());
if (detailTex) tex->SetDetailmap(detailTex->GetTexture());
if (normalTex) tex->SetNormalmap(normalTex->GetTexture());
if (specTex) tex->SetSpecularmap(specTex->GetTexture());
tex->SetDetailScale(scalex, scaley);
rep.faces[0] = tex;
}