Bullet puffs do not appear in outdoor areas

When shooting walls in Doom, bullet "puffs" appear. However, due to a bug in the game, these may not appear in outdoor areas when shooting certain walls.

Technical
The bug occurs due to a logic bug in the code for handling skies.

In Doom, if a linedef bridges two sectors with different ceiling heights and has no upper texture to be displayed in the space between the sectors, the ceiling texture of the lower sector appears to "bleed" into the empty space. This is used to deliberate effect in outdoor areas where a special sky texture (F_SKY1) is used for the ceiling texture. This allows the sky texture beyond low outer walls to look like real sky, as opposed to a sky wallpaper.

The Doom engine contains explicit code to deal with this case. Rockets fired at these "sky walls" do not explode, but instead disappear, but if the walls are shot point-blank the rockets explode in the normal fashion and the player takes splash damage. Similarly, shooting such walls with a hitscan weapon produces no bullet puffs, unless the shooter is right in front of the wall.

It is because of this that the bullet puff bug occurs. Although a check is made to determine if the back sector of the linedef has sky for its ceiling, no check is made that it is actually the upper texture that has been hit.

From PTR_ShootTraverse in p_map.c:

if (li->frontsector->ceilingpic == skyflatnum) { // don't shoot the sky! if (z > li->frontsector->ceilingheight) return false; // it's a sky hack wall if (li->backsector && li->backsector->ceilingpic == skyflatnum) return false; } // Spawn bullet puffs. P_SpawnPuff (x,y,z);

The bug can be fixed through the addition of an extra condition to the "sky hack wall" test: