- fixed handling of bad class assignment to map picnums.

This commit is contained in:
Christoph Oelckers 2022-11-24 08:12:18 +01:00
parent a7ba843eb5
commit 13e19bad36
8 changed files with 13 additions and 11 deletions

View file

@ -345,6 +345,7 @@ void ChangeActorSect(DCoreActor* actor, sectortype* sect, bool tail)
DCoreActor* InsertActor(PClass* type, sectortype* sector, int stat, bool tail)
{
if (type == nullptr) return nullptr;
assert(type->IsDescendantOf(RUNTIME_CLASS(DCoreActor)));
if (!type->IsDescendantOf(RUNTIME_CLASS(DCoreActor)))
{

View file

@ -272,9 +272,13 @@ struct SpawnRec
PClass* cls;
int param;
PClass* Class()
PClass* Class(int pn)
{
if (!cls && clsname != NAME_None) cls = PClass::FindClass(clsname);
if (cls == nullptr)
{
Printf(TEXTCOLOR_RED "Bad class name %s for ID# %d\n", clsname.GetChars(), pn);
}
clsname = NAME_None;
return cls;
}

View file

@ -1014,6 +1014,7 @@ x(FECES, 4802)
x(DRONE, 4916)
x(RECON, 4989)
y(RRTILE5014, 5014)
y(RRTILE5015, 5015)
y(RRTILE5016, 5016)
y(RRTILE5017, 5017)
y(RRTILE5018, 5018)

View file

@ -937,15 +937,11 @@ static TArray<DDukeActor*> spawnactors(SpawnSpriteDef& sprites)
spawns.Pop();
continue;
}
if (i == 210)
{
int a = 0;
}
auto sprt = &sprites.sprites[i];
auto info = spawnMap.CheckKey(sprt->picnum);
auto actor = static_cast<DDukeActor*>(InsertActor(info? info->Class() : RUNTIME_CLASS(DDukeActor), sprt->sectp, sprt->statnum));
auto cls = info ? info->Class(sprt->picnum) : nullptr;;
auto actor = static_cast<DDukeActor*>(InsertActor(cls? cls : RUNTIME_CLASS(DDukeActor), sprt->sectp, sprt->statnum));
if (actor)
{
spawns[j++] = actor;

View file

@ -552,7 +552,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
geosector[geocnt] = actor->sector();
for (auto actor2 : actors)
{
if (actor->spr.lotag == actor2->spr.lotag && actor2 != actor && actor2->spr.picnum == RRTILE19)
if (actor && actor->spr.lotag == actor2->spr.lotag && actor2 != actor && actor2->spr.picnum == RRTILE19)
{
if (actor2->spr.hitag == 1)
{

View file

@ -1064,7 +1064,7 @@ void checkhitwall_r(DDukeActor* spr, walltype* wal, const DVector3& pos, int atw
}
case RRTILE7555:
if (!isRRRA()) break;
wal->picnum = SBMOVE;
wal->picnum = RRTILE5015;
S_PlayActorSound(GLASS_HEAVYBREAK, spr);
return;
case RRTILE7441:

View file

@ -63,7 +63,7 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, PClassActor*
auto info = spawnMap.CheckKey(s_pn);
if (info)
{
clstype = static_cast<PClassActor*>(info->Class());
clstype = static_cast<PClassActor*>(info->Class(s_pn));
basepicnum = info->param;
}
}

View file

@ -127,7 +127,7 @@ class DukeGPSpeed : DukeActor
}
// the following ones are only used in RR.
class TorchCtrl : DukeActor
class DukeTorchCtrl : DukeActor
{
override void StaticSetup()
{