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

This commit is contained in:
LegendaryGuard 2024-08-04 14:10:35 +02:00
parent f924ef8641
commit be7bac0455

View file

@ -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() );