diff --git a/source/build/include/buildtypes.h b/source/build/include/buildtypes.h index d526315a0..1432efd83 100644 --- a/source/build/include/buildtypes.h +++ b/source/build/include/buildtypes.h @@ -152,6 +152,7 @@ enum // Raze extensions, using the higher bits to avoid conflitcs with the reserved and undocumented bits above. CSTAT_SPRITE_MDLROTATE = 1u<<16u, // Only for tsprites: rotate if this is a model or voxel. + CSTAT_SPRITE_NOFIND = 1u<<17u, // Invisible to neartag and hitscan }; enum diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index f8f2fa38e..bedbf0eab 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -1428,6 +1428,10 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32 { auto const spr = (uspriteptr_t)&sprite[z]; uint32_t const cstat = spr->cstat; + + if (cstat & CSTAT_SPRITE_NOFIND) + continue; + #ifdef USE_OPENGL if (!hitallsprites) #endif diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 52648e5d6..f8b3f014d 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -2360,6 +2360,8 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, { auto const spr = (uspriteptr_t)&sprite[z]; + if (spr->cstat & CSTAT_SPRITE_NOFIND) + continue; if (blacklist_sprite_func && blacklist_sprite_func(z)) continue; diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index e2ab87b15..d24915c25 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1014,7 +1014,7 @@ void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2) // This originally depended on undefined behavior as the deleted sprite was still used for the sound // with no checking if it got reused in the mean time. spri->picnum = 0; // give it a picnum without any behavior attached, just in case - spri->cstat |= CSTAT_SPRITE_INVISIBLE; + spri->cstat |= CSTAT_SPRITE_INVISIBLE|CSTAT_SPRITE_NOFIND; changespritestat(actor->GetIndex(), STAT_REMOVED); } }