From be7bac045513761a71617404c52a96a4a8d5a3c7 Mon Sep 17 00:00:00 2001 From: LegendaryGuard Date: Sun, 4 Aug 2024 14:10:35 +0200 Subject: [PATCH] Fix idItem::GiveToPlayer in CallFunc function when picking up items like ammo or health, that crashes on dhewm3, it works better with inv_carry only --- game/Item.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/game/Item.cpp b/game/Item.cpp index c1fa7eb..24ccf7b 100644 --- a/game/Item.cpp +++ b/game/Item.cpp @@ -585,12 +585,12 @@ bool idItem::GiveToPlayer( idPlayer *player ) { } if ( val ) { - if ( spawnArgs.GetString( "scriptobject" ) != "" ) { + if ( spawnArgs.GetString( "scriptobject" ) != "" + && spawnArgs.GetBool( "inv_carry" ) ) { // if the item is ammo or health, game crashes, so that doesn't work in dhewm3 if ( !g_noPickupNotification.GetBool() && !spawnArgs.GetBool( "dontNotifyOnPickup" ) ) { - // CallFunc( "pickup_message" ); // doesn't work in dhewm3, crashes - player->ShowHudMessage( va("You got the %s\n", spawnArgs.GetString( "inv_name" )) ); + CallFunc( "pickup_message" ); } - // CallFunc( "pickup_effect" ); // doesn't work in dhewm3, crashes + CallFunc( "pickup_effect" ); } gameLocal.SetPersistentRemove( name.c_str() );