diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index c27e3d4e..df5767f1 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -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) diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index aebf7a85..945997e5 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -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((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); diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index bdc02989..99006952 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -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; } diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 177b8d16..9d7492e9 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -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>\" 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)); diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 2fae8061..fb8dbeff 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -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(); diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index a2596a93..942a7e4b 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -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; diff --git a/regamedll/extra/HostageImprov/host_improv.zip b/regamedll/extra/HostageImprov/host_improv.zip new file mode 100644 index 00000000..7c8220ed Binary files /dev/null and b/regamedll/extra/HostageImprov/host_improv.zip differ diff --git a/regamedll/extra/cssdk/dlls/regamedll_api.h b/regamedll/extra/cssdk/dlls/regamedll_api.h index 411c5958..226b18cd 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_api.h +++ b/regamedll/extra/cssdk/dlls/regamedll_api.h @@ -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 IReGameHook_CBasePlayer_GiveShield; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveShield; - +// CBasePlayer:SetClientUserInfoModel hook +typedef IVoidHookChain IReGameHook_CBasePlayer_SetClientUserInfoModel; +typedef IVoidHookChainRegistryClass 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; diff --git a/regamedll/extra/cssdk/dlls/regamedll_interfaces.h b/regamedll/extra/cssdk/dlls/regamedll_interfaces.h index 033e6bb8..09d2d620 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_interfaces.h +++ b/regamedll/extra/cssdk/dlls/regamedll_interfaces.h @@ -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 { diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index 411c5958..858b61d8 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -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 IReGameHook_CBasePlayer_GiveShield; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_GiveShield; - +// CBasePlayer:SetClientUserInfoModel hook +typedef IVoidHookChain IReGameHook_CBasePlayer_SetClientUserInfoModel; +typedef IVoidHookChainRegistryClass 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; diff --git a/regamedll/public/regamedll/regamedll_interfaces.h b/regamedll/public/regamedll/regamedll_interfaces.h index 033e6bb8..09d2d620 100644 --- a/regamedll/public/regamedll/regamedll_interfaces.h +++ b/regamedll/public/regamedll/regamedll_interfaces.h @@ -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 { diff --git a/regamedll/regamedll/regamedll.h b/regamedll/regamedll/regamedll.h index fa39c931..b828eace 100644 --- a/regamedll/regamedll/regamedll.h +++ b/regamedll/regamedll/regamedll.h @@ -1,3 +1,8 @@ #pragma once extern void Regamedll_Game_Init(); + +inline bool AreRunningCZero() +{ + return g_bIsCzeroGame; +} diff --git a/regamedll/regamedll/regamedll_api_impl.cpp b/regamedll/regamedll/regamedll_api_impl.cpp index b1120ad8..b01d3c88 100644 --- a/regamedll/regamedll/regamedll_api_impl.cpp +++ b/regamedll/regamedll/regamedll_api_impl.cpp @@ -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; } diff --git a/regamedll/regamedll/regamedll_api_impl.h b/regamedll/regamedll/regamedll_api_impl.h index 2453317d..0daa2036 100644 --- a/regamedll/regamedll/regamedll_api_impl.h +++ b/regamedll/regamedll/regamedll_api_impl.h @@ -32,91 +32,91 @@ #include "regamedll_interfaces_impl.h" // CBasePlayer::Spawn hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_Spawn; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_Spawn; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Spawn; // CBasePlayer::Precache hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_Precache; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_Precache; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Precache; // CBasePlayer::ObjectCaps hook -typedef IHookChainClassImpl CRegameHook_CBasePlayer_ObjectCaps; +typedef IHookChainClassImpl CReGameHook_CBasePlayer_ObjectCaps; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_ObjectCaps; // CBasePlayer::Classify hook -typedef IHookChainClassImpl CRegameHook_CBasePlayer_Classify; +typedef IHookChainClassImpl CReGameHook_CBasePlayer_Classify; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Classify; // CBasePlayer::TraceAttack hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_TraceAttack; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_TraceAttack; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_TraceAttack; // CBasePlayer::TakeDamage hook -typedef IHookChainClassImpl CRegameHook_CBasePlayer_TakeDamage; +typedef IHookChainClassImpl CReGameHook_CBasePlayer_TakeDamage; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_TakeDamage; // CBasePlayer::TakeHealth hook -typedef IHookChainClassImpl CRegameHook_CBasePlayer_TakeHealth; +typedef IHookChainClassImpl CReGameHook_CBasePlayer_TakeHealth; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_TakeHealth; // CBasePlayer::Killed hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_Killed; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_Killed; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Killed; // CBasePlayer::AddPoints hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_AddPoints; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_AddPoints; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_AddPoints; // CBasePlayer::AddPointsToTeam hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_AddPointsToTeam; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_AddPointsToTeam; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_AddPointsToTeam; // CBasePlayer::AddPlayerItem hook -typedef IHookChainClassImpl CRegameHook_CBasePlayer_AddPlayerItem; +typedef IHookChainClassImpl CReGameHook_CBasePlayer_AddPlayerItem; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_AddPlayerItem; // CBasePlayer::RemovePlayerItem hook -typedef IHookChainClassImpl CRegameHook_CBasePlayer_RemovePlayerItem; +typedef IHookChainClassImpl CReGameHook_CBasePlayer_RemovePlayerItem; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_RemovePlayerItem; // CBasePlayer::GiveAmmo hook -typedef IHookChainClassImpl CRegameHook_CBasePlayer_GiveAmmo; +typedef IHookChainClassImpl CReGameHook_CBasePlayer_GiveAmmo; typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_GiveAmmo; // CBasePlayer::ResetMaxSpeed hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_ResetMaxSpeed; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_ResetMaxSpeed; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_ResetMaxSpeed; // CBasePlayer::Jump hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_Jump; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_Jump; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Jump; // CBasePlayer::Duck hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_Duck; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_Duck; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Duck; // CBasePlayer::PreThink hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_PreThink; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_PreThink; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_PreThink; // CBasePlayer::PostThink hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_PostThink; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_PostThink; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_PostThink; // CBasePlayer::UpdateClientData hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_UpdateClientData; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_UpdateClientData; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_UpdateClientData; // CBasePlayer::ImpulseCommands hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_ImpulseCommands; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_ImpulseCommands; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_ImpulseCommands; // CBasePlayer::RoundRespawn hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_RoundRespawn; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_RoundRespawn; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_RoundRespawn; // CBasePlayer::Blind hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_Blind; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_Blind; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Blind; @@ -125,30 +125,32 @@ typedef IHookChainClassImpl CReGameHook_C typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_Observer_IsValidTarget; // CBasePlayer::SetAnimation hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_SetAnimation; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_SetAnimation; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_SetAnimation; // CBasePlayer::GiveDefaultItems hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_GiveDefaultItems; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_GiveDefaultItems; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_GiveDefaultItems; // CBasePlayer::GiveNamedItem hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_GiveNamedItem; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_GiveNamedItem; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_GiveNamedItem; // CBasePlayer::AddAccount hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_AddAccount; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_AddAccount; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_AddAccount; // CBasePlayer::GiveShield hook -typedef IVoidHookChainClassImpl CRegameHook_CBasePlayer_GiveShield; +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_GiveShield; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_GiveShield; - +// CBasePlayer:SetClientUserInfoModel hook +typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_SetClientUserInfoModel; +typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_SetClientUserInfoModel; // CBaseAnimating::ResetSequenceInfo hook -typedef IVoidHookChainClassImpl CRegameHook_CBaseAnimating_ResetSequenceInfo; +typedef IVoidHookChainClassImpl CReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClassImpl 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(); diff --git a/regamedll/regamedll/regamedll_interfaces_impl.h b/regamedll/regamedll/regamedll_interfaces_impl.h index 90a5281c..7b9dce59 100644 --- a/regamedll/regamedll/regamedll_interfaces_impl.h +++ b/regamedll/regamedll/regamedll_interfaces_impl.h @@ -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(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(g_GameEntities[iEntityNum]); } inline CCSEntity *CSEntity(const edict_t *pEdict) { return CSEntity(ENTINDEX(pEdict)); }