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 texture 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 low retainer walls to be displayed with a background sky in the distance behind the wall.

The Doom engine contains explicit code to deal with this case. Rockets fired at these "sky walls" do not explode, but instead disappear. Similarly, if they are shot with a hitscan weapon, bullet puffs do not appear.

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: li->backsector->ceilingheight < z