diff --git a/docs/rh-log.txt b/docs/rh-log.txt index ac1362295..733aef90d 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ December 25, 2009 (Changes by Graf Zahl) +- Fixed: Decals could spread to walls which had a decal-less texture or + were flagged not to have decals. +- Fixed: DBaseDecal/DImpactDecal::CloneSelf never checked the return value + from their StickToWall call and left unplaced decals behind if that happened. - Reintroduced Doom.exe's player_t::usedown variable so that respawning a player does not immediately activate switches. oldbuttons was not usable for this. This also required that CopyPlayer preserves this info. diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 51a30e081..d992bec9e 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -298,6 +298,13 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor else return FNullTextureID(); CalcFracPos (wall, x, y); + FTexture *texture = TexMan[tex]; + + if (texture == NULL || texture->bNoDecals) + { + return FNullTextureID(); + } + return tex; } @@ -546,11 +553,18 @@ DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_ DBaseDecal *decal = new DBaseDecal(iz); if (decal != NULL) { - decal->StickToWall (wall, ix, iy, ffloor); - tpl->ApplyToDecal (decal, wall); - decal->AlphaColor = AlphaColor; - decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) | - (this->RenderFlags & ~RF_DECALMASK); + if (decal->StickToWall (wall, ix, iy, ffloor).isValid()) + { + tpl->ApplyToDecal (decal, wall); + decal->AlphaColor = AlphaColor; + decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) | + (this->RenderFlags & ~RF_DECALMASK); + } + else + { + decal->Destroy(); + return NULL; + } } return decal; } @@ -652,16 +666,12 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x, } DImpactDecal::CheckMax(); decal = new DImpactDecal (z); - - FTextureID stickypic = decal->StickToWall (wall, x, y, ffloor); - FTexture *tex = TexMan[stickypic]; - - if (tex != NULL && tex->bNoDecals) + if (decal == NULL) { return NULL; } - if (decal == NULL) + if (!decal->StickToWall (wall, x, y, ffloor).isValid()) { return NULL; } @@ -685,15 +695,27 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, fixed_t x, DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_t iy, fixed_t iz, side_t *wall, F3DFloor * ffloor) const { + if (wall->Flags & WALLF_NOAUTODECALS) + { + return NULL; + } + DImpactDecal::CheckMax(); DImpactDecal *decal = new DImpactDecal(iz); if (decal != NULL) { - decal->StickToWall (wall, ix, iy, ffloor); - tpl->ApplyToDecal (decal, wall); - decal->AlphaColor = AlphaColor; - decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) | - (this->RenderFlags & ~RF_DECALMASK); + if (decal->StickToWall (wall, ix, iy, ffloor).isValid()) + { + tpl->ApplyToDecal (decal, wall); + decal->AlphaColor = AlphaColor; + decal->RenderFlags = (decal->RenderFlags & RF_DECALMASK) | + (this->RenderFlags & ~RF_DECALMASK); + } + else + { + decal->Destroy(); + return NULL; + } } return decal; }