From f115d3105e2e7979f98bcbaee1ec630b8f059e61 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Tue, 3 Sep 2019 16:55:14 +0300 Subject: [PATCH] Add Drop to floor flag for item_generic --- dlls/gearbox/generic_items.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/gearbox/generic_items.cpp b/dlls/gearbox/generic_items.cpp index c8217cbf..5b5088e5 100644 --- a/dlls/gearbox/generic_items.cpp +++ b/dlls/gearbox/generic_items.cpp @@ -21,6 +21,8 @@ //========================================================= // Generic item //========================================================= +#define SF_ITEM_GENERIC_DROP_TO_FLOOR 1 + class CItemGeneric : public CBaseAnimating { public: @@ -62,6 +64,15 @@ void CItemGeneric::Spawn(void) // Call startup sequence to look for a sequence to play. SetThink(&CItemGeneric::StartupThink); pev->nextthink = gpGlobals->time + 0.1f; + + if (FBitSet(pev->spawnflags, SF_ITEM_GENERIC_DROP_TO_FLOOR)) + { + if( DROP_TO_FLOOR(ENT( pev ) ) == 0 ) + { + ALERT(at_error, "Item %s fell out of level at %f,%f,%f\n", STRING( pev->classname ), pev->origin.x, pev->origin.y, pev->origin.z); + UTIL_Remove( this ); + } + } } void CItemGeneric::Precache(void)