From 5dab1c1f1db1556a6648f3c66e1066888257ae51 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 18 Jul 2017 22:54:03 +0500 Subject: [PATCH] Revert "Merge https://github.com/LevShisterov/BugfixedHL/commit/29c4d46ad02492a33ddd9bb4ace0c873855eebe7" This reverts commit 075fd2903075aaa28b0d4930d7d1ba0d1b73f492. --- dlls/items.cpp | 1 - dlls/weapons.cpp | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/items.cpp b/dlls/items.cpp index b0b2aa38..d9cc7871 100644 --- a/dlls/items.cpp +++ b/dlls/items.cpp @@ -166,7 +166,6 @@ void CItem::Materialize( void ) } SetTouch( &CItem::ItemTouch ); - SetThink( NULL ); } #define SF_SUIT_SHORTLOGON 0x0001 diff --git a/dlls/weapons.cpp b/dlls/weapons.cpp index 22b4a456..61b038c0 100644 --- a/dlls/weapons.cpp +++ b/dlls/weapons.cpp @@ -485,7 +485,7 @@ void CBasePlayerItem::Materialize( void ) pev->solid = SOLID_TRIGGER; UTIL_SetOrigin( pev, pev->origin );// link into world. - SetTouch( &CBasePlayerItem::DefaultTouch ); + SetTouch( &CBasePlayerItem::DefaultTouch); SetThink( NULL ); } @@ -578,6 +578,13 @@ void CBasePlayerItem::DefaultTouch( CBaseEntity *pOther ) } SUB_UseTargets( pOther, USE_TOGGLE, 0 ); // UNDONE: when should this happen? + + // If the item is falling and its Think remains FallItem after the player picks it up, + // then after the item touches the ground its Touch will be set back to DefaultTouch, + // so the player will pick it up again, this time Kill-ing the item (since we already have it in the inventory), + // which will make the pointer bad and crash the game. + if( m_pfnThink == &CBasePlayerItem::FallThink ) + SetThink( NULL ); } BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted ) @@ -727,7 +734,7 @@ void CBasePlayerItem::AttachToPlayer( CBasePlayer *pPlayer ) pev->modelindex = 0;// server won't send down to clients if modelindex == 0 pev->model = iStringNull; pev->owner = pPlayer->edict(); - pev->nextthink = 0;// Remove think - prevents futher attempts to materialize + pev->nextthink = gpGlobals->time + .1; SetTouch( NULL ); SetThink( NULL ); } @@ -1047,7 +1054,6 @@ void CBasePlayerAmmo::Materialize( void ) } SetTouch( &CBasePlayerAmmo::DefaultTouch ); - SetThink( NULL ); } void CBasePlayerAmmo::DefaultTouch( CBaseEntity *pOther )