decal/infodecal: Make sure tempdecals aren't being removed, as that would kill the decal-chain.

This commit is contained in:
Marco Cawthorne 2019-03-01 01:24:15 +01:00
parent 5276d1f8cc
commit 2f101866b7
3 changed files with 14 additions and 5 deletions

View file

@ -47,8 +47,13 @@ void infodecal(void)
}
if (!self.texture) {
print("^1ERROR:^7 infodecal with no .texture\n");
remove(self);
dprint("^1ERROR:^7 infodecal with no .texture\n");
/* Tempdecals == decals that are not spawned by the map, but by the
* decal-que (see shared/decals.c), so you can't remove them without
* causing a pointer error - just abort. */
if (self.classname != "tempdecal") {
remove(self);
}
return;
}
@ -91,8 +96,11 @@ void infodecal(void)
}
if (frac == 1.0f) {
print(sprintf("infodecal tracing failed at %v\n", self.origin));
remove(self);
dprint(sprintf("infodecal tracing failed at %v\n", self.origin));
if (self.classname != "tempdecal") {
remove(self);
}
return;
}

View file

@ -47,6 +47,7 @@ void Decals_PlaceBig(vector pos)
#else
entity decal = Decals_Next();
setorigin(decal, pos);
decal.classname = "tempdecal";
decal.texture = sprintf("{bigshot%d", floor(random(1,6)));
decal.think = infodecal;
decal.nextthink = time /*+ 0.1f*/;

View file

@ -16,6 +16,7 @@ void Effect_CreateExplosion( vector vPos ) {
WriteCoord( MSG_MULTICAST, vPos_z );
msg_entity = self;
multicast( vPos, MULTICAST_PVS );
Decals_PlaceScorch(vPos);
#else
sprite eExplosion = spawn(sprite);
setorigin( eExplosion, vPos );
@ -31,7 +32,6 @@ void Effect_CreateExplosion( vector vPos ) {
eExplosion.nextthink = time + 0.05f;
te_explosion( vPos );
Decals_PlaceScorch(vPos);
#endif
}