mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-13 15:18:00 +03:00
Hostage minor fixes
Minor cleanup
This commit is contained in:
parent
1579273f62
commit
f63ad678c2
@ -11,4 +11,3 @@ BOOL gDisplayTitle;
|
|||||||
bool g_bIsBeta = false;
|
bool g_bIsBeta = false;
|
||||||
bool g_bIsCzeroGame = false;
|
bool g_bIsCzeroGame = false;
|
||||||
bool g_bAllowedCSBot = false;
|
bool g_bAllowedCSBot = false;
|
||||||
bool g_bHostageImprov = false;
|
|
||||||
|
@ -38,4 +38,3 @@ extern BOOL gDisplayTitle;
|
|||||||
extern bool g_bIsBeta;
|
extern bool g_bIsBeta;
|
||||||
extern bool g_bIsCzeroGame;
|
extern bool g_bIsCzeroGame;
|
||||||
extern bool g_bAllowedCSBot;
|
extern bool g_bAllowedCSBot;
|
||||||
extern bool g_bHostageImprov;
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
|
|
||||||
cvar_t cv_hostage_ai_enable = { "hostage_ai_enable", "1", 0, 1.0f, nullptr };
|
cvar_t cv_hostage_ai_enable = { "hostage_ai_enable", "0", 0, 0.0f, nullptr };
|
||||||
cvar_t cv_hostage_debug = { "hostage_debug", "0", FCVAR_SERVER, 0.0f, nullptr };
|
cvar_t cv_hostage_debug = { "hostage_debug", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||||
cvar_t cv_hostage_stop = { "hostage_stop", "0", FCVAR_SERVER, 0.0f, nullptr };
|
cvar_t cv_hostage_stop = { "hostage_stop", "0", FCVAR_SERVER, 0.0f, nullptr };
|
||||||
|
|
||||||
@ -269,36 +269,41 @@ void CHostage::Spawn()
|
|||||||
|
|
||||||
void CHostage::Precache()
|
void CHostage::Precache()
|
||||||
{
|
{
|
||||||
if (AreImprovAllowed())
|
if (cv_hostage_ai_enable.value)
|
||||||
{
|
{
|
||||||
|
string_t model = iStringNull;
|
||||||
|
|
||||||
static int which = 0;
|
static int which = 0;
|
||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case REGULAR_GUY:
|
case REGULAR_GUY:
|
||||||
pev->model = MAKE_STRING("models/hostageA.mdl");
|
model = MAKE_STRING("models/hostageA.mdl");
|
||||||
break;
|
break;
|
||||||
case OLD_GUY:
|
case OLD_GUY:
|
||||||
pev->model = MAKE_STRING("models/hostageB.mdl");
|
model = MAKE_STRING("models/hostageB.mdl");
|
||||||
break;
|
break;
|
||||||
case BLACK_GUY:
|
case BLACK_GUY:
|
||||||
pev->model = MAKE_STRING("models/hostageC.mdl");
|
model = MAKE_STRING("models/hostageC.mdl");
|
||||||
break;
|
break;
|
||||||
case GOOFY_GUY:
|
case GOOFY_GUY:
|
||||||
pev->model = MAKE_STRING("models/hostageD.mdl");
|
model = MAKE_STRING("models/hostageD.mdl");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_whichModel = static_cast<ModelType>(which);
|
m_whichModel = static_cast<ModelType>(which);
|
||||||
|
|
||||||
if (++which > 3)
|
if (++which > GOOFY_GUY)
|
||||||
which = 0;
|
which = REGULAR_GUY;
|
||||||
|
|
||||||
if (!g_pFileSystem->FileExists(pev->model))
|
if (g_pFileSystem->FileExists(model))
|
||||||
|
{
|
||||||
|
pev->model = model;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// It seems that the model is missing, so use classic hostages
|
// It seems that the model is missing, so use classic hostages
|
||||||
g_bHostageImprov = false;
|
CVAR_SET_FLOAT("hostage_ai_enable", 0);
|
||||||
pev->model = iStringNull;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +352,7 @@ void CHostage::IdleThink()
|
|||||||
const float giveUpTime = (1 / 30.0f);
|
const float giveUpTime = (1 / 30.0f);
|
||||||
float const updateRate = 0.1f;
|
float const updateRate = 0.1f;
|
||||||
|
|
||||||
if (AreImprovAllowed() && !TheNavAreaList.empty())
|
if (cv_hostage_ai_enable.value && !TheNavAreaList.empty())
|
||||||
{
|
{
|
||||||
if (!m_improv)
|
if (!m_improv)
|
||||||
{
|
{
|
||||||
@ -776,7 +781,7 @@ void CHostage::SetDeathActivity()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AreImprovAllowed())
|
if (cv_hostage_ai_enable.value)
|
||||||
{
|
{
|
||||||
switch (m_LastHitGroup)
|
switch (m_LastHitGroup)
|
||||||
{
|
{
|
||||||
@ -1402,7 +1407,7 @@ void Hostage_RegisterCVars()
|
|||||||
{
|
{
|
||||||
// These cvars are only used in czero
|
// These cvars are only used in czero
|
||||||
#ifdef REGAMEDLL_FIXES
|
#ifdef REGAMEDLL_FIXES
|
||||||
if (!AreImprovAllowed())
|
if (!cv_hostage_ai_enable.value)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1437,7 +1442,7 @@ void CHostageManager::ServerActivate()
|
|||||||
AddHostage(pHostage);
|
AddHostage(pHostage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AreImprovAllowed())
|
if (cv_hostage_ai_enable.value)
|
||||||
{
|
{
|
||||||
for (auto& snd : hostageSoundStruct) {
|
for (auto& snd : hostageSoundStruct) {
|
||||||
m_chatter.AddSound(snd.type, snd.fileName);
|
m_chatter.AddSound(snd.type, snd.fileName);
|
||||||
@ -1573,6 +1578,9 @@ void SimpleChatter::AddSound(HostageChatterType type, char *filename)
|
|||||||
|
|
||||||
Q_snprintf(actualFilename, sizeof(actualFilename), "sound\\%s", filename);
|
Q_snprintf(actualFilename, sizeof(actualFilename), "sound\\%s", filename);
|
||||||
|
|
||||||
|
if (!g_pFileSystem->FileExists(actualFilename))
|
||||||
|
return;
|
||||||
|
|
||||||
chatter->file[chatter->count].filename = CloneString(filename);
|
chatter->file[chatter->count].filename = CloneString(filename);
|
||||||
chatter->file[chatter->count].duration = (double)GET_APPROX_WAVE_PLAY_LEN(actualFilename) / 1000.0;
|
chatter->file[chatter->count].duration = (double)GET_APPROX_WAVE_PLAY_LEN(actualFilename) / 1000.0;
|
||||||
|
|
||||||
@ -1610,6 +1618,9 @@ void SimpleChatter::Shuffle(ChatterSet *chatter)
|
|||||||
char *SimpleChatter::GetSound(HostageChatterType type, float *duration)
|
char *SimpleChatter::GetSound(HostageChatterType type, float *duration)
|
||||||
{
|
{
|
||||||
ChatterSet *chatter = &m_chatter[type];
|
ChatterSet *chatter = &m_chatter[type];
|
||||||
|
if (chatter->count == 0)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
char *sound;
|
char *sound;
|
||||||
|
|
||||||
Shuffle(chatter);
|
Shuffle(chatter);
|
||||||
|
@ -285,11 +285,5 @@ private:
|
|||||||
SimpleChatter m_chatter;
|
SimpleChatter m_chatter;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine whether hostage improv can be used or not
|
|
||||||
inline bool AreImprovAllowed()
|
|
||||||
{
|
|
||||||
return g_bHostageImprov;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Hostage_RegisterCVars();
|
void Hostage_RegisterCVars();
|
||||||
void InstallHostageManager();
|
void InstallHostageManager();
|
||||||
|
@ -4173,7 +4173,7 @@ void CBasePlayer::PlayerUse()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool useNewHostages = !TheNavAreaList.empty() && AreImprovAllowed();
|
bool useNewHostages = !TheNavAreaList.empty() && cv_hostage_ai_enable.value;
|
||||||
CBaseEntity *pObject = nullptr;
|
CBaseEntity *pObject = nullptr;
|
||||||
CBaseEntity *pClosest = nullptr;
|
CBaseEntity *pClosest = nullptr;
|
||||||
Vector vecLOS;
|
Vector vecLOS;
|
||||||
|
@ -33,7 +33,6 @@ void Regamedll_Game_Init()
|
|||||||
g_bIsBeta = UTIL_IsBeta();
|
g_bIsBeta = UTIL_IsBeta();
|
||||||
g_bIsCzeroGame = UTIL_IsGame("czero");
|
g_bIsCzeroGame = UTIL_IsGame("czero");
|
||||||
g_bAllowedCSBot = UTIL_AreBotsAllowed(); // determine whether bots can be used or not
|
g_bAllowedCSBot = UTIL_AreBotsAllowed(); // determine whether bots can be used or not
|
||||||
g_bHostageImprov = UTIL_AreHostagesImprov(); // determine whether hostage improv can be used or not
|
|
||||||
|
|
||||||
WeaponInfoReset();
|
WeaponInfoReset();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user