'game_player_equip' checking buggy maps

This commit is contained in:
s1lentq 2021-06-22 14:17:31 +07:00
parent 1ac96b8180
commit 63efbfc1d6
4 changed files with 37 additions and 3 deletions

View File

@ -563,6 +563,33 @@ void CGamePlayerEquip::KeyValue(KeyValueData *pkvd)
}
}
bool CGamePlayerEquip::HasBuggyMap() const
{
if (!UseOnly())
return false;
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "multi_manager")))
{
if (FNullEnt(pEntity))
break;
// Consider case with game_playerspawn only
if (!FStrEq(pEntity->pev->targetname, "game_playerspawn"))
continue;
// Lookup 'game_player_equip' into multi_manager
if (pEntity->HasTarget(pev->targetname))
{
ALERT(at_warning, "%s is BUGGY! 'game_player_equip' may be called twice, this has only direct actiavte behavior.\nTriggered by (#%d) %s.\n",
STRING(gpGlobals->mapname), ENTINDEX(pEntity->pev), STRING(pEntity->pev->classname));
return true;
}
}
return false;
}
void CGamePlayerEquip::Touch(CBaseEntity *pOther)
{
if (CanEquipOverTouch(pOther))

View File

@ -258,7 +258,8 @@ public:
public:
bool UseOnly() const { return (pev->spawnflags & SF_PLAYEREQUIP_USEONLY) == SF_PLAYEREQUIP_USEONLY; }
bool RemoveWeapons() const { return (pev->spawnflags & SF_PLAYEREQUIP_REMOVEWEAPONS) == SF_PLAYEREQUIP_REMOVEWEAPONS; }
bool HasBuggyMap() const;
bool CanEquipOverTouch(CBaseEntity *pOther)
{
if (!CanFireForActivator(pOther))

View File

@ -9978,9 +9978,15 @@ void EXT_FUNC CBasePlayer::__API_HOOK(OnSpawnEquip)(bool addDefault, bool equipG
#endif
{
pWeaponEntity->Touch(this);
addDefault = false;
}
#ifdef REGAMEDLL_FIXES
// TODO: Remove me someday!
// Check buggy map and spew message about it!
// 'game_player_equip' may be call twice on player spawn and 'game_playerspawn' event
else if (pWeaponEntity->HasBuggyMap())
addDefault = false; // Don't give default items now, because we have a deferred equipment
#endif
}
}

View File

@ -1727,7 +1727,7 @@ bool UTIL_AreHostagesImprov()
#ifdef REGAMEDLL_ADD
if (g_engfuncs.pfnEngCheckParm == nullptr)
return false;
// someday in CS 1.6
int improv = ENG_CHECK_PARM("-host-improv", nullptr);
if (improv)