Added custom function SetClientUserInfoModel and him hook.

Added param -host-improv for enable HostageImprove.
Refactoring hostage.
This commit is contained in:
s1lentq 2016-05-30 17:19:56 +06:00
parent 9203344b98
commit 905064d44d
15 changed files with 300 additions and 222 deletions

View File

@ -1510,7 +1510,7 @@ void __API_HOOK(HandleMenu_ChooseAppearance)(CBasePlayer *player, int slot)
player->pev->body = 0;
player->m_iModelName = appearance.model_id;
SET_CLIENT_KEY_VALUE(player->entindex(), GET_INFO_BUFFER(player->edict()), "model", appearance.model_name);
player->SetClientUserInfoModel(GET_INFO_BUFFER(player->edict()), appearance.model_name);
player->SetNewPlayerModel(sPlayerModelFiles[ appearance.model_name_index ]);
if (CSGameRules()->m_iMapHasVIPSafetyZone == MAP_VIP_SAFETYZONE_UNINITIALIZED)

View File

@ -13,6 +13,163 @@ int g_iHostageNumber = 0;
#endif
struct
{
HostageChatterType type;
char *fileName;
} hostageSoundStruct[] = {
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/getouttahere.wav" },
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/illfollow.wav" },
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letsdoit.wav" },
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letsgo.wav" },
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letshurry.wav" },
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letsmove.wav" },
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/okletsgo.wav" },
{ HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/youlead.wav" },
{ HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/comeback.wav" },
{ HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/dontleaveme.wav" },
{ HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/illstayhere.wav" },
{ HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/notleaveme.wav" },
{ HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/yeahillstay.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/donthurtme1.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/donthurtme2.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/dontkill.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/endpeace.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/nevernegotiate.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/nottellanything.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/surrender.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/whatdoyou.wav" },
{ HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/whyareyou.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/donthurtme1.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/donthurtme2.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/dontkill.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/dontkill.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/illgoback1.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/illgoback2.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/okokgoing.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/okokgoing2.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/sorry1.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/sorry2.wav" },
{ HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/sorry3.wav" },
{ HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain1.wav" },
{ HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain2.wav" },
{ HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain3.wav" },
{ HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain4.wav" },
{ HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain5.wav" },
{ HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain6.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/awwcrap1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/awwcrap2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/getdown1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/getdown2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/getdown3.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookout1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookout2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookshooting1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookshooting2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookshooting3.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/ohgod1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/ohgod2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awwcrap1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awwcrap2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/deargod1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/deargod2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/deargod3.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohgod1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohgod2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohno1.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohno2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awww2.wav" },
{ HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awww4.wav" },
{ HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/awwcrap1.wav" },
{ HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/awwcrap2.wav" },
{ HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/lookout1.wav" },
{ HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/lookout2.wav" },
{ HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/areyousave.wav" },
{ HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/getmeoutta1.wav" },
{ HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/getmeoutta2.wav" },
{ HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/imahostage.wav" },
{ HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/rescueme1.wav" },
{ HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/rescueme2.wav" },
{ HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/theyregonna.wav" },
{ HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/areyousave.wav" },
{ HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/getmeoutta1.wav" },
{ HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/getmeoutta2.wav" },
{ HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/rescueme1.wav" },
{ HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/rescueme2.wav" },
{ HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/almostouttahere.wav" },
{ HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/almostthere.wav" },
{ HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/keepgoing.wav" },
{ HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/notfar.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/alldead.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/goodnews.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/outtahere.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over1.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over2.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over3.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over4.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over5.wav" },
{ HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/relief.wav" },
{ HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/doomed.wav" },
{ HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/godno.wav" },
{ HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/nowwhat.wav" },
{ HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/ohman.wav" },
{ HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/ohno.wav" },
{ HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/finally.wav" },
{ HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/finallysafe.wav" },
{ HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/thankyou.wav" },
{ HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/wemadeit1.wav" },
{ HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/wemadeit2.wav" },
{ HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/wemadeit3.wav" },
{ HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/becareful1.wav" },
{ HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/becareful2.wav" },
{ HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/stillaround1.wav" },
{ HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/stillaround2.wav" },
{ HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/lookout1.wav" },
{ HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/lookout2.wav" },
{ HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/overthere1.wav" },
{ HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/overthere2.wav" },
{ HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/helpme1.wav" },
{ HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/helpme2.wav" },
{ HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/hey1.wav" },
{ HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/hey2.wav" },
{ HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/overhere1.wav" },
{ HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough1.wav" },
{ HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough2.wav" },
{ HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough3.wav" },
{ HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough4.wav" },
{ HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough5.wav" },
{ HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough6.wav" },
{ HOSTAGE_CHATTER_BLINDED, "hostage/hflash/cantsee.wav" },
{ HOSTAGE_CHATTER_BLINDED, "hostage/hflash/myeyes.wav" },
{ HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/grenade1.wav" },
{ HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/grenade2.wav" },
{ HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/run.wav" },
{ HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/watchout.wav" },
{ HOSTAGE_CHATTER_DEATH_CRY, "hostage/hdie/hdeath1.wav" },
{ HOSTAGE_CHATTER_DEATH_CRY, "hostage/hdie/hdeath2.wav" },
{ HOSTAGE_CHATTER_DEATH_CRY, "hostage/hdie/hdeath3.wav" },
};
LINK_ENTITY_TO_CLASS(hostage_entity, CHostage, CCSHostage);
LINK_ENTITY_TO_CLASS(monster_scientist, CHostage, CCSHostage);
@ -99,7 +256,7 @@ void CHostage::__MAKE_VHOOK(Precache)()
{
static int which = 0;
if (g_bIsCzeroGame)
if (AreImprovAllowed())
{
switch (which)
{
@ -561,7 +718,7 @@ void CHostage::SetDeathActivity()
return;
}
if (g_bIsCzeroGame)
if (AreImprovAllowed())
{
switch (m_LastHitGroup)
{
@ -641,7 +798,6 @@ void CHostage::ApplyHostagePenalty(CBasePlayer *pAttacker)
return;
int iHostagePenalty = int(CVAR_GET_FLOAT("mp_hostagepenalty"));
if (iHostagePenalty)
{
if (pAttacker->m_iHostagesKilled++ == iHostagePenalty)
@ -777,7 +933,6 @@ void CHostage::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
}
CBasePlayer *pPlayer = (CBasePlayer *)pOther;
if (pPlayer->IsPlayer())
{
if (pPlayer->m_iTeam != CT)
@ -910,13 +1065,12 @@ void CHostage::MoveToward(const Vector &vecLoc)
Vector vecbigDest;
Vector vecMove;
CBaseEntity *pFollowing;
Vector vecAng;
float_precision flDist;
pFollowing = GetClassPtr<CCSEntity>((CBaseEntity *)m_hTargetEnt->pev);
vecMove = vecLoc - pev->origin;
vecAng = UTIL_VecToAngles(vecMove);
vecAng = Vector(0, vecAng.y, 0);
Vector vecAng(0, UTIL_VecToAngles(vecMove).y, 0);
UTIL_MakeVectorsPrivate(vecAng, vecFwd, NULL, NULL);
if ((vecFwd * s_flStepSize_LocalNav).Length2D() <= (vecLoc - pev->origin).Length2D())
@ -1023,7 +1177,6 @@ void CHostage::NavReady()
void CHostage::SendHostagePositionMsg()
{
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL)
{
if (FNullEnt(pEntity->edict()))
@ -1053,7 +1206,6 @@ void CHostage::SendHostagePositionMsg()
void CHostage::SendHostageEventMsg()
{
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL)
{
if (FNullEnt(pEntity->edict()))
@ -1081,7 +1233,6 @@ void CHostage::SendHostageEventMsg()
void CHostage::Wiggle()
{
TraceResult tr;
Vector vec(0, 0, 0);
Vector wiggle_directions[] =
{
@ -1095,14 +1246,10 @@ void CHostage::Wiggle()
Vector(-50, -50, 0)
};
for (int i = 0; i < ARRAYSIZE(wiggle_directions); ++i)
{
Vector dest = pev->origin + wiggle_directions[i];
for (auto& dir : wiggle_directions) {
Vector dest = pev->origin + dir;
if (m_LocalNav->PathTraversable(pev->origin, dest, TRUE) == PATH_TRAVERSABLE_EMPTY)
{
vec = vec - wiggle_directions[i];
}
vec = vec - dir;
}
#ifndef PLAY_GAMEDLL
@ -1181,9 +1328,9 @@ void CHostage::PreThink()
if (flRaisedDist > flOrigDist)
{
Vector vecNewOrigin = pev->origin;
Vector vecNewOrigin(pev->origin);
vecNewOrigin.z = tr.vecEndPos.z;
UTIL_SetOrigin(pev, vecNewOrigin);
pev->velocity.z += pev->gravity * g_psv_gravity->value * gpGlobals->frametime;
}
@ -1193,7 +1340,7 @@ void Hostage_RegisterCVars()
{
// These cvars are only used in czero
#ifdef REGAMEDLL_FIXES
if (!g_bIsCzeroGame)
if (!AreImprovAllowed())
return;
#endif
@ -1228,138 +1375,16 @@ void CHostageManager::ServerActivate()
AddHostage((CHostage *)pEntity);
}
if (g_bIsCzeroGame)
if (AreImprovAllowed())
{
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/getouttahere.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/illfollow.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letsdoit.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letsgo.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letshurry.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/letsmove.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/okletsgo.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_START_FOLLOW, "hostage/huse/youlead.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/comeback.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/dontleaveme.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/illstayhere.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/notleaveme.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_STOP_FOLLOW, "hostage/hunuse/yeahillstay.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/donthurtme1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/donthurtme2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/dontkill.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/endpeace.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/nevernegotiate.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/nottellanything.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/surrender.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/whatdoyou.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_INTIMIDATED, "hostage/hseenbyt/whyareyou.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/donthurtme1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/donthurtme2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/dontkill.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hseenbyt/dontkill.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/illgoback1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/illgoback2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/okokgoing.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/okokgoing2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/sorry1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/sorry2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RETREAT, "hostage/hretreat/sorry3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain4.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain5.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PAIN, "hostage/hpain/hpain6.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/awwcrap1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/awwcrap2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/getdown1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/getdown2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/getdown3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookout1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookout2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookshooting1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookshooting2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/lookshooting3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/ohgod1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_GUNFIRE, "hostage/hreactions/ohgod2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awwcrap1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awwcrap2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/deargod1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/deargod2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/deargod3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohgod1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohgod2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohno1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/ohno2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awww2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SCARED_OF_MURDER, "hostage/hreactions/awww4.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/awwcrap1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/awwcrap2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/lookout1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_LOOK_OUT, "hostage/hreactions/lookout2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/areyousave.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/getmeoutta1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/getmeoutta2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/imahostage.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/rescueme1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/rescueme2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_PLEASE_RESCUE_ME, "hostage/hseenbyct/theyregonna.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/areyousave.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/getmeoutta1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/getmeoutta2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/rescueme1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_IMPATIENT_FOR_RESCUE, "hostage/hseenbyct/rescueme2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/almostouttahere.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/almostthere.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/keepgoing.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SEE_RESCUE_ZONE, "hostage/hseezone/notfar.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/alldead.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/goodnews.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/outtahere.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over4.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/over5.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CTS_WIN, "hostage/hctwin/relief.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/doomed.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/godno.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/nowwhat.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/ohman.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_TERRORISTS_WIN, "hostage/htwin/ohno.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/finally.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/finallysafe.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/thankyou.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/wemadeit1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/wemadeit2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_RESCUED, "hostage/hrescued/wemadeit3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/becareful1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/becareful2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/stillaround1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_NEARBY, "hostage/hwarn/stillaround2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/lookout1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/lookout2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/overthere1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_WARN_SPOTTED, "hostage/hwarn/overthere2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/helpme1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/helpme2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/hey1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/hey2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_CALL_TO_RESCUER, "hostage/hwavect/overhere1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough3.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough4.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough5.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_COUGH, "hostage/hsmoke/cough6.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_BLINDED, "hostage/hflash/cantsee.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_BLINDED, "hostage/hflash/myeyes.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/grenade1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/grenade2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/run.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_SAW_HE_GRENADE, "hostage/hgrenade/watchout.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_DEATH_CRY, "hostage/hdie/hdeath1.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_DEATH_CRY, "hostage/hdie/hdeath2.wav");
m_chatter.AddSound(HOSTAGE_CHATTER_DEATH_CRY, "hostage/hdie/hdeath3.wav");
for (auto& sound : hostageSoundStruct) {
m_chatter.AddSound(sound.type, sound.fileName);
}
#ifdef REGAMEDLL_ADD
if (!AreRunningCZero())
LoadNavigationMap();
#endif
}
}
@ -1459,32 +1484,30 @@ void CHostageManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEnt
SimpleChatter::SimpleChatter()
{
for (int i = 0; i < ARRAYSIZE(m_chatter); ++i)
for (auto& chatter : m_chatter)
{
m_chatter[i].count = 0;
m_chatter[i].index = 0;
m_chatter[i].needsShuffle = false;
chatter.count = 0;
chatter.index = 0;
chatter.needsShuffle = false;
}
}
SimpleChatter::~SimpleChatter()
{
for (int i = 0; i < ARRAYSIZE(m_chatter); ++i)
for (auto& chatter : m_chatter)
{
for (int f = 0; f < m_chatter[i].count; f++)
for (int f = 0; f < chatter.count; f++)
{
delete[] m_chatter[i].file[f].filename;
m_chatter[i].file[f].filename = NULL;
delete[] chatter.file[f].filename;
chatter.file[f].filename = nullptr;
}
}
}
void SimpleChatter::AddSound(HostageChatterType type, char *filename)
{
ChatterSet *chatter;
char actualFilename[128];
chatter = &m_chatter[type];
auto chatter = &m_chatter[type];
Q_snprintf(actualFilename, sizeof(actualFilename), "sound\\%s", filename);

View File

@ -2281,26 +2281,26 @@ void CHalfLifeMultiplay::ResetCurrentVIP()
{
case 1:
m_pVIP->m_iModelName = MODEL_GSG9;
SET_CLIENT_KEY_VALUE(m_pVIP->entindex(), infobuffer, "model", "gsg9");
m_pVIP->SetClientUserInfoModel(infobuffer, "gsg9");
break;
case 2:
m_pVIP->m_iModelName = MODEL_SAS;
SET_CLIENT_KEY_VALUE(m_pVIP->entindex(), infobuffer, "model", "sas");
m_pVIP->SetClientUserInfoModel(infobuffer, "sas");
break;
case 3:
m_pVIP->m_iModelName = MODEL_GIGN;
SET_CLIENT_KEY_VALUE(m_pVIP->entindex(), infobuffer, "model", "gign");
m_pVIP->SetClientUserInfoModel(infobuffer, "gign");
break;
case 4:
if (g_bIsCzeroGame)
{
m_pVIP->m_iModelName = MODEL_SPETSNAZ;
SET_CLIENT_KEY_VALUE(m_pVIP->entindex(), infobuffer, "model", "spetsnaz");
m_pVIP->SetClientUserInfoModel(infobuffer, "spetsnaz");
break;
}
default:
m_pVIP->m_iModelName = MODEL_URBAN;
SET_CLIENT_KEY_VALUE(m_pVIP->entindex(), infobuffer, "model", "urban");
m_pVIP->SetClientUserInfoModel(infobuffer, "urban");
break;
}

View File

@ -341,11 +341,33 @@ const char *GetCSModelName(int item_id)
return modelName;
}
void EXT_FUNC CBasePlayer::SetClientUserInfoModel_api(char *infobuffer, char *szNewModel)
{
SET_CLIENT_KEY_VALUE(entindex(), infobuffer, "model", szNewModel);
}
void CBasePlayer::SetClientUserInfoModel(char *infobuffer, char *szNewModel)
{
if (szNewModel == nullptr)
return;
if (Q_strcmp(GET_KEY_VALUE(infobuffer, "model"), szNewModel) != 0)
{
g_ReGameHookchains.m_CBasePlayer_SetClientUserInfoModel.callChain(&CBasePlayer::SetClientUserInfoModel_api, this, infobuffer, szNewModel);
}
}
void CBasePlayer::SetPlayerModel(BOOL HasC4)
{
char *infobuffer = GET_INFO_BUFFER(edict());
char *model;
#ifdef REGAMEDLL_ADD
CCSPlayer *pPlayer = CSPlayer(this);
if (*pPlayer->m_szModel != '\0') {
model = pPlayer->m_szModel;
} else
#endif
if (m_iTeam == CT)
{
switch (m_iModelName)
@ -426,10 +448,7 @@ void CBasePlayer::SetPlayerModel(BOOL HasC4)
else
model = "urban";
if (Q_strcmp(GET_KEY_VALUE(infobuffer, "model"), model) != 0)
{
SET_CLIENT_KEY_VALUE(entindex(), infobuffer, "model", model);
}
SetClientUserInfoModel(infobuffer, model);
}
CBasePlayer *CBasePlayer::GetNextRadioRecipient(CBasePlayer *pStartPlayer)
@ -1576,7 +1595,7 @@ void CBasePlayer::RemoveAllItems(BOOL removeSuit)
}
m_pActiveItem = NULL;
m_bHasPrimary = NULL;
m_bHasPrimary = false;
pev->viewmodel = 0;
pev->weaponmodel = 0;
@ -3232,7 +3251,7 @@ void CBasePlayer::MakeVIP()
pev->body = 0;
m_iModelName = MODEL_VIP;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "vip");
SetClientUserInfoModel(GET_INFO_BUFFER(edict()), "vip");
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Became_VIP\"\n", STRING(pev->netname), GETPLAYERUSERID(edict()), GETPLAYERAUTHID(edict()));
m_iTeam = CT;
@ -7403,6 +7422,7 @@ void CBasePlayer::SwitchTeam()
char *szOldTeam;
char *szNewTeam;
const char *szName;
char *szNewModel = nullptr;
oldTeam = m_iTeam;
@ -7414,28 +7434,28 @@ void CBasePlayer::SwitchTeam()
{
case MODEL_URBAN:
m_iModelName = MODEL_LEET;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "leet");
szNewModel = "leet";
break;
case MODEL_GIGN:
m_iModelName = MODEL_GUERILLA;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "guerilla");
szNewModel = "guerilla";
break;
case MODEL_SAS:
m_iModelName = MODEL_ARCTIC;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "arctic");
szNewModel = "arctic";
break;
case MODEL_SPETSNAZ:
if (g_bIsCzeroGame)
{
m_iModelName = MODEL_MILITIA;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "militia");
szNewModel = "militia";
break;
}
default:
if (m_iModelName == MODEL_GSG9 || !IsBot() || !TheBotProfiles->GetCustomSkinModelname(m_iModelName))
{
m_iModelName = MODEL_TERROR;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "terror");
szNewModel = "terror";
}
break;
}
@ -7448,36 +7468,38 @@ void CBasePlayer::SwitchTeam()
{
case MODEL_TERROR:
m_iModelName = MODEL_GSG9;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "gsg9");
szNewModel = "gsg9";
break;
case MODEL_ARCTIC:
m_iModelName = MODEL_SAS;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "sas");
szNewModel = "sas";
break;
case MODEL_GUERILLA:
m_iModelName = MODEL_GIGN;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "gign");
szNewModel = "gign";
break;
case MODEL_MILITIA:
if (g_bIsCzeroGame)
{
m_iModelName = MODEL_SPETSNAZ;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "spetsnaz");
szNewModel = "spetsnaz";
break;
}
default:
if (m_iModelName == MODEL_LEET || !IsBot() || !TheBotProfiles->GetCustomSkinModelname(m_iModelName))
{
m_iModelName = MODEL_URBAN;
SET_CLIENT_KEY_VALUE(entindex(), GET_INFO_BUFFER(edict()), "model", "urban");
szNewModel = "urban";
}
break;
}
}
SetClientUserInfoModel(GET_INFO_BUFFER(edict()), szNewModel);
MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo);
WRITE_BYTE(entindex());
WRITE_STRING(GetTeamName(m_iTeam));

View File

@ -463,6 +463,8 @@ public:
void SetProgressBarTime(int time);
void SetProgressBarTime2(int time, float timeElapsed);
void SetPlayerModel(BOOL HasC4);
void SetClientUserInfoModel(char *infobuffer, char *szNewModel);
void SetClientUserInfoModel_api(char *infobuffer, char *szNewModel);
void SetNewPlayerModel(const char *modelName);
BOOL SwitchWeapon(CBasePlayerItem *pWeapon);
void CheckPowerups();

View File

@ -2374,7 +2374,11 @@ bool UTIL_AreHostagesImprov()
#ifdef REGAMEDLL_ADD
// someday in CS 1.6
// ...
int improv = ENG_CHECK_PARM("-host-improv", NULL);
if (improv)
{
return true;
}
#endif
return false;

Binary file not shown.

View File

@ -32,7 +32,7 @@
#include "interface.h"
#define REGAMEDLL_API_VERSION_MAJOR 1
#define REGAMEDLL_API_VERSION_MINOR 0
#define REGAMEDLL_API_VERSION_MINOR 1
// CBasePlayer::Spawn hook
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Spawn;
@ -147,7 +147,9 @@ typedef IVoidHookChainRegistryClass<class CBasePlayer, int, enum RewardType, boo
typedef IVoidHookChain<bool> IReGameHook_CBasePlayer_GiveShield;
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_GiveShield;
// CBasePlayer:SetClientUserInfoModel hook
typedef IVoidHookChain<char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoModel;
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
// CBaseAnimating::ResetSequenceInfo hook
@ -331,6 +333,7 @@ public:
virtual IReGameHookRegistry_CBasePlayer_GiveNamedItem* CBasePlayer_GiveNamedItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount() = 0;
virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0;
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0;
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;

View File

@ -306,6 +306,9 @@ public:
virtual void DropPlayerItem(const char *pszItemName) = 0;
virtual void RemoveShield() = 0;
virtual void RemoveAllItems(bool bRemoveSuit) = 0;
virtual void SetPlayerModel(bool bHasC4) = 0;
virtual void SetPlayerModelEx(const char *modelName) = 0;
virtual void SetNewPlayerModel(const char *modelName) = 0;
};
class IAPI_Bot: public ICSPlayer {

View File

@ -31,8 +31,8 @@
#include "hookchains.h"
#include "interface.h"
#define REGAMEDLL_API_VERSION_MAJOR 1
#define REGAMEDLL_API_VERSION_MINOR 0
#define REGAMEDLL_API_VERSION_MAJOR 2
#define REGAMEDLL_API_VERSION_MINOR 1
// CBasePlayer::Spawn hook
typedef IVoidHookChain<> IReGameHook_CBasePlayer_Spawn;
@ -147,7 +147,9 @@ typedef IVoidHookChainRegistryClass<class CBasePlayer, int, enum RewardType, boo
typedef IVoidHookChain<bool> IReGameHook_CBasePlayer_GiveShield;
typedef IVoidHookChainRegistryClass<class CBasePlayer, bool> IReGameHookRegistry_CBasePlayer_GiveShield;
// CBasePlayer:SetClientUserInfoModel hook
typedef IVoidHookChain<char *, char *> IReGameHook_CBasePlayer_SetClientUserInfoModel;
typedef IVoidHookChainRegistryClass<class CBasePlayer, char *, char *> IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
// CBaseAnimating::ResetSequenceInfo hook
@ -331,6 +333,7 @@ public:
virtual IReGameHookRegistry_CBasePlayer_GiveNamedItem* CBasePlayer_GiveNamedItem() = 0;
virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount() = 0;
virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0;
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0;
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0;
virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0;

View File

@ -306,6 +306,9 @@ public:
virtual void DropPlayerItem(const char *pszItemName) = 0;
virtual void RemoveShield() = 0;
virtual void RemoveAllItems(bool bRemoveSuit) = 0;
virtual void SetPlayerModel(bool bHasC4) = 0;
virtual void SetPlayerModelEx(const char *modelName) = 0;
virtual void SetNewPlayerModel(const char *modelName) = 0;
};
class IAPI_Bot: public ICSPlayer {

View File

@ -1,3 +1,8 @@
#pragma once
extern void Regamedll_Game_Init();
inline bool AreRunningCZero()
{
return g_bIsCzeroGame;
}

View File

@ -78,6 +78,7 @@ IReGameHookRegistry_CBasePlayer_GiveDefaultItems* CReGameHookchains::CBasePlayer
IReGameHookRegistry_CBasePlayer_GiveNamedItem* CReGameHookchains::CBasePlayer_GiveNamedItem() { return &m_CBasePlayer_GiveNamedItem; }
IReGameHookRegistry_CBasePlayer_AddAccount* CReGameHookchains::CBasePlayer_AddAccount() { return &m_CBasePlayer_AddAccount; }
IReGameHookRegistry_CBasePlayer_GiveShield* CReGameHookchains::CBasePlayer_GiveShield() { return &m_CBasePlayer_GiveShield; }
IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CReGameHookchains::CBasePlayer_SetClientUserInfoModel() { return &m_CBasePlayer_SetClientUserInfoModel; }
IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CReGameHookchains::CBaseAnimating_ResetSequenceInfo() { return &m_CBaseAnimating_ResetSequenceInfo; }

View File

@ -32,91 +32,91 @@
#include "regamedll_interfaces_impl.h"
// CBasePlayer::Spawn hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_Spawn;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_Spawn;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_Spawn;
// CBasePlayer::Precache hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_Precache;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_Precache;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_Precache;
// CBasePlayer::ObjectCaps hook
typedef IHookChainClassImpl<int, CBasePlayer> CRegameHook_CBasePlayer_ObjectCaps;
typedef IHookChainClassImpl<int, CBasePlayer> CReGameHook_CBasePlayer_ObjectCaps;
typedef IHookChainRegistryClassImpl<int, CBasePlayer> CReGameHookRegistry_CBasePlayer_ObjectCaps;
// CBasePlayer::Classify hook
typedef IHookChainClassImpl<int, CBasePlayer> CRegameHook_CBasePlayer_Classify;
typedef IHookChainClassImpl<int, CBasePlayer> CReGameHook_CBasePlayer_Classify;
typedef IHookChainRegistryClassImpl<int, CBasePlayer> CReGameHookRegistry_CBasePlayer_Classify;
// CBasePlayer::TraceAttack hook
typedef IVoidHookChainClassImpl<CBasePlayer, entvars_t *, float, Vector &, TraceResult *, int> CRegameHook_CBasePlayer_TraceAttack;
typedef IVoidHookChainClassImpl<CBasePlayer, entvars_t *, float, Vector &, TraceResult *, int> CReGameHook_CBasePlayer_TraceAttack;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, entvars_t *, float, Vector &, TraceResult *, int> CReGameHookRegistry_CBasePlayer_TraceAttack;
// CBasePlayer::TakeDamage hook
typedef IHookChainClassImpl<int, CBasePlayer, entvars_t *, entvars_t *, float&, int> CRegameHook_CBasePlayer_TakeDamage;
typedef IHookChainClassImpl<int, CBasePlayer, entvars_t *, entvars_t *, float&, int> CReGameHook_CBasePlayer_TakeDamage;
typedef IHookChainRegistryClassImpl<int, CBasePlayer, entvars_t *, entvars_t *, float&, int> CReGameHookRegistry_CBasePlayer_TakeDamage;
// CBasePlayer::TakeHealth hook
typedef IHookChainClassImpl<int, CBasePlayer, float, int> CRegameHook_CBasePlayer_TakeHealth;
typedef IHookChainClassImpl<int, CBasePlayer, float, int> CReGameHook_CBasePlayer_TakeHealth;
typedef IHookChainRegistryClassImpl<int, CBasePlayer, float, int> CReGameHookRegistry_CBasePlayer_TakeHealth;
// CBasePlayer::Killed hook
typedef IVoidHookChainClassImpl<CBasePlayer, entvars_t *, int> CRegameHook_CBasePlayer_Killed;
typedef IVoidHookChainClassImpl<CBasePlayer, entvars_t *, int> CReGameHook_CBasePlayer_Killed;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, entvars_t *, int> CReGameHookRegistry_CBasePlayer_Killed;
// CBasePlayer::AddPoints hook
typedef IVoidHookChainClassImpl<CBasePlayer, int, BOOL> CRegameHook_CBasePlayer_AddPoints;
typedef IVoidHookChainClassImpl<CBasePlayer, int, BOOL> CReGameHook_CBasePlayer_AddPoints;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, int, BOOL> CReGameHookRegistry_CBasePlayer_AddPoints;
// CBasePlayer::AddPointsToTeam hook
typedef IVoidHookChainClassImpl<CBasePlayer, int, BOOL> CRegameHook_CBasePlayer_AddPointsToTeam;
typedef IVoidHookChainClassImpl<CBasePlayer, int, BOOL> CReGameHook_CBasePlayer_AddPointsToTeam;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, int, BOOL> CReGameHookRegistry_CBasePlayer_AddPointsToTeam;
// CBasePlayer::AddPlayerItem hook
typedef IHookChainClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CRegameHook_CBasePlayer_AddPlayerItem;
typedef IHookChainClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CReGameHook_CBasePlayer_AddPlayerItem;
typedef IHookChainRegistryClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CReGameHookRegistry_CBasePlayer_AddPlayerItem;
// CBasePlayer::RemovePlayerItem hook
typedef IHookChainClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CRegameHook_CBasePlayer_RemovePlayerItem;
typedef IHookChainClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CReGameHook_CBasePlayer_RemovePlayerItem;
typedef IHookChainRegistryClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CReGameHookRegistry_CBasePlayer_RemovePlayerItem;
// CBasePlayer::GiveAmmo hook
typedef IHookChainClassImpl<int, CBasePlayer, int , char *, int> CRegameHook_CBasePlayer_GiveAmmo;
typedef IHookChainClassImpl<int, CBasePlayer, int , char *, int> CReGameHook_CBasePlayer_GiveAmmo;
typedef IHookChainRegistryClassImpl<int, CBasePlayer, int , char *, int> CReGameHookRegistry_CBasePlayer_GiveAmmo;
// CBasePlayer::ResetMaxSpeed hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_ResetMaxSpeed;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_ResetMaxSpeed;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_ResetMaxSpeed;
// CBasePlayer::Jump hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_Jump;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_Jump;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_Jump;
// CBasePlayer::Duck hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_Duck;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_Duck;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_Duck;
// CBasePlayer::PreThink hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_PreThink;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_PreThink;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_PreThink;
// CBasePlayer::PostThink hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_PostThink;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_PostThink;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_PostThink;
// CBasePlayer::UpdateClientData hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_UpdateClientData;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_UpdateClientData;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_UpdateClientData;
// CBasePlayer::ImpulseCommands hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_ImpulseCommands;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_ImpulseCommands;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_ImpulseCommands;
// CBasePlayer::RoundRespawn hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_RoundRespawn;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_RoundRespawn;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_RoundRespawn;
// CBasePlayer::Blind hook
typedef IVoidHookChainClassImpl<CBasePlayer, float, float, float, int> CRegameHook_CBasePlayer_Blind;
typedef IVoidHookChainClassImpl<CBasePlayer, float, float, float, int> CReGameHook_CBasePlayer_Blind;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, float, float, float, int> CReGameHookRegistry_CBasePlayer_Blind;
@ -125,30 +125,32 @@ typedef IHookChainClassImpl<CBaseEntity *, CBasePlayer, int, bool> CReGameHook_C
typedef IHookChainRegistryClassImpl<CBaseEntity *, CBasePlayer, int, bool> CReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
// CBasePlayer::SetAnimation hook
typedef IVoidHookChainClassImpl<CBasePlayer, PLAYER_ANIM> CRegameHook_CBasePlayer_SetAnimation;
typedef IVoidHookChainClassImpl<CBasePlayer, PLAYER_ANIM> CReGameHook_CBasePlayer_SetAnimation;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, PLAYER_ANIM> CReGameHookRegistry_CBasePlayer_SetAnimation;
// CBasePlayer::GiveDefaultItems hook
typedef IVoidHookChainClassImpl<CBasePlayer> CRegameHook_CBasePlayer_GiveDefaultItems;
typedef IVoidHookChainClassImpl<CBasePlayer> CReGameHook_CBasePlayer_GiveDefaultItems;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer> CReGameHookRegistry_CBasePlayer_GiveDefaultItems;
// CBasePlayer::GiveNamedItem hook
typedef IVoidHookChainClassImpl<CBasePlayer, const char *> CRegameHook_CBasePlayer_GiveNamedItem;
typedef IVoidHookChainClassImpl<CBasePlayer, const char *> CReGameHook_CBasePlayer_GiveNamedItem;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, const char *> CReGameHookRegistry_CBasePlayer_GiveNamedItem;
// CBasePlayer::AddAccount hook
typedef IVoidHookChainClassImpl<CBasePlayer, int, RewardType, bool> CRegameHook_CBasePlayer_AddAccount;
typedef IVoidHookChainClassImpl<CBasePlayer, int, RewardType, bool> CReGameHook_CBasePlayer_AddAccount;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, int, RewardType, bool> CReGameHookRegistry_CBasePlayer_AddAccount;
// CBasePlayer::GiveShield hook
typedef IVoidHookChainClassImpl<CBasePlayer, bool> CRegameHook_CBasePlayer_GiveShield;
typedef IVoidHookChainClassImpl<CBasePlayer, bool> CReGameHook_CBasePlayer_GiveShield;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, bool> CReGameHookRegistry_CBasePlayer_GiveShield;
// CBasePlayer:SetClientUserInfoModel hook
typedef IVoidHookChainClassImpl<CBasePlayer, char *, char *> CReGameHook_CBasePlayer_SetClientUserInfoModel;
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, char *, char *> CReGameHookRegistry_CBasePlayer_SetClientUserInfoModel;
// CBaseAnimating::ResetSequenceInfo hook
typedef IVoidHookChainClassImpl<CBaseAnimating> CRegameHook_CBaseAnimating_ResetSequenceInfo;
typedef IVoidHookChainClassImpl<CBaseAnimating> CReGameHook_CBaseAnimating_ResetSequenceInfo;
typedef IVoidHookChainRegistryClassImpl<CBaseAnimating> CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo;
@ -324,6 +326,7 @@ public:
CReGameHookRegistry_CBasePlayer_GiveNamedItem m_CBasePlayer_GiveNamedItem;
CReGameHookRegistry_CBasePlayer_AddAccount m_CBasePlayer_AddAccount;
CReGameHookRegistry_CBasePlayer_GiveShield m_CBasePlayer_GiveShield;
CReGameHookRegistry_CBasePlayer_SetClientUserInfoModel m_CBasePlayer_SetClientUserInfoModel;
CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo m_CBaseAnimating_ResetSequenceInfo;
@ -394,6 +397,7 @@ public:
virtual IReGameHookRegistry_CBasePlayer_GiveNamedItem* CBasePlayer_GiveNamedItem();
virtual IReGameHookRegistry_CBasePlayer_AddAccount* CBasePlayer_AddAccount();
virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield();
virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel();
virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo();

View File

@ -294,9 +294,12 @@ public:
virtual void KeyValue(KeyValueData *pkvd) { m_pEntity->KeyValue(pkvd); }
};
#pragma warning(disable:4351) // new behavior: elements of array will be default initialized
class CCSPlayer: public CCSMonster {
public:
CCSPlayer(CBaseEntity *pEntity) : CCSMonster(pEntity) {}
char m_szModel[32];
CCSPlayer(CBaseEntity *pEntity) : CCSMonster(pEntity), m_szModel() {}
virtual void Spawn() { m_pEntity->Spawn(); }
virtual void Precache() { m_pEntity->Precache(); }
@ -350,7 +353,9 @@ public:
virtual void DropPlayerItem(const char *pszItemName) { ((CBasePlayer *)m_pEntity)->DropPlayerItem(pszItemName); }
virtual void RemoveShield() { ((CBasePlayer *)m_pEntity)->RemoveShield(); }
virtual void RemoveAllItems(bool bRemoveSuit) { ((CBasePlayer *)m_pEntity)->RemoveAllItems(bRemoveSuit ? TRUE : FALSE); }
virtual void SetPlayerModel(bool bHasC4) { ((CBasePlayer *)m_pEntity)->SetPlayerModel(bHasC4 ? TRUE : FALSE); }
virtual void SetPlayerModelEx(const char *modelName) { strncpy(m_szModel, modelName, sizeof(m_szModel) - 1); m_szModel[sizeof(m_szModel) - 1] = '\0'; };
virtual void SetNewPlayerModel(const char *modelName) { ((CBasePlayer *)m_pEntity)->SetNewPlayerModel(modelName); }
};
class CAPI_Bot: public CCSPlayer {
@ -2559,7 +2564,7 @@ inline T *CBASE_TO_CSENTITY(CBaseEntity *a)
inline CCSPlayer *CSPlayer(int iPlayerNum) { return reinterpret_cast<CCSPlayer *>(g_GameEntities[iPlayerNum]); }
inline CCSPlayer *CSPlayer(const edict_t *pEdict) { return CSPlayer(ENTINDEX(pEdict)); }
inline CCSPlayer *CSPlayer(CBaseEntity *pEntity) { return CSPlayer(pEntity->entindex()); }
inline CCSPlayer *CSPlayer(CBasePlayer *pPlayer) { return CSPlayer(pPlayer->entindex()); }
inline CCSEntity *CSEntity(int iEntityNum) { return reinterpret_cast<CCSEntity *>(g_GameEntities[iEntityNum]); }
inline CCSEntity *CSEntity(const edict_t *pEdict) { return CSEntity(ENTINDEX(pEdict)); }