CZero: Fix broken Career Tasks (#836)

* Fix HandleEnemyKill params and Hostage target detection

* Var name mistake

* Grouping more code on FIXES macro
This commit is contained in:
Francisco Muñoz 2023-07-10 08:44:31 -04:00 committed by GitHub
parent 12560c2b87
commit d4deabfe59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View File

@ -136,10 +136,14 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
if (!pHostage->IsAlive())
continue;
#ifndef REGAMEDLL_FIXES
if (!pHostage->IsFollowingSomeone())
continue;
if (pHostage->m_target == pVictim)
#else
if (pHostage->IsFollowing(pVictim))
#endif
hostagesCount++;
}
@ -211,11 +215,14 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
{
if (!pHostage->IsAlive())
continue;
#ifndef REGAMEDLL_FIXES
if (!pHostage->IsFollowingSomeone())
continue;
if (pHostage->m_target == pAttacker)
#else
if (pHostage->IsFollowing(pAttacker))
#endif
hostagesCount++;
}

View File

@ -2046,8 +2046,27 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
}
TheCareerTasks->HandleDeath(m_iTeam, this);
#ifdef REGAMEDLL_FIXES
if (!m_bKilledByBomb)
{
CBasePlayer *pAttacker = CBasePlayer::Instance(pevAttacker);
if(pAttacker /*safety*/ && !pAttacker->IsBot() && pAttacker->m_iTeam != m_iTeam)
{
if (pAttacker->HasShield())
killerHasShield = true;
if (IsBot() && IsBlind()) // dystopm: shouldn't be !IsBot() ?
wasBlind = true;
TheCareerTasks->HandleEnemyKill(wasBlind, GetWeaponName(g_pevLastInflictor, pevAttacker), m_bHeadshotKilled, killerHasShield, pAttacker, this); // last 2 param swapped to match function definition
}
}
#endif
}
#ifndef REGAMEDLL_FIXES
if (!m_bKilledByBomb)
{
CBasePlayer *pAttacker = CBasePlayer::Instance(pevAttacker);
@ -2077,6 +2096,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
}
}
}
#endif
}
if (!m_bKilledByBomb)