mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-03-02 16:55:26 +03:00
Refactoring
This commit is contained in:
parent
a4fa8c6bc4
commit
7f9cf53c49
@ -6,7 +6,7 @@
|
||||
#include <sstream>
|
||||
#include <cmath>
|
||||
|
||||
void Assertions::StringEquals(std::string message, std::string expected, std::string actual, const char* fileName, long lineNumber) {
|
||||
void Assertions::StringEquals(std::string message, std::string expected, std::string actual, const char *fileName, long lineNumber) {
|
||||
if (expected != actual) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -14,8 +14,8 @@ void Assertions::StringEquals(std::string message, std::string expected, std::st
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::StringEquals(std::string message, const char* expected, const char* actual, const char* fileName, long lineNumber) {
|
||||
if (actual == NULL) {
|
||||
void Assertions::StringEquals(std::string message, const char *expected, const char *actual, const char *fileName, long lineNumber) {
|
||||
if (actual == nullptr) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got NULL";
|
||||
throw TestFailException(ss.str(), std::string(fileName), lineNumber);
|
||||
@ -27,13 +27,13 @@ void Assertions::StringEquals(std::string message, const char* expected, const c
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::ConditionFailed(std::string message, std::string condition, const char* fileName, long lineNumber) {
|
||||
void Assertions::ConditionFailed(std::string message, std::string condition, const char *fileName, long lineNumber) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (condition failed: " << condition << ")";
|
||||
throw TestFailException(ss.str(), std::string(fileName), lineNumber);
|
||||
}
|
||||
|
||||
void Assertions::LongEquals(std::string message, long expected, long actual, const char* fileName, long lineNumber) {
|
||||
void Assertions::LongEquals(std::string message, long expected, long actual, const char *fileName, long lineNumber) {
|
||||
if (expected != actual) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -41,7 +41,7 @@ void Assertions::LongEquals(std::string message, long expected, long actual, con
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::UInt32Equals(std::string message, unsigned int expected, unsigned int actual, const char* fileName, long lineNumber) {
|
||||
void Assertions::UInt32Equals(std::string message, unsigned int expected, unsigned int actual, const char *fileName, long lineNumber) {
|
||||
if (expected != actual) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -49,7 +49,7 @@ void Assertions::UInt32Equals(std::string message, unsigned int expected, unsign
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::CharEquals(std::string message, char expected, char actual, const char* fileName, long lineNumber) {
|
||||
void Assertions::CharEquals(std::string message, char expected, char actual, const char *fileName, long lineNumber) {
|
||||
if (expected != actual) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -57,7 +57,7 @@ void Assertions::CharEquals(std::string message, char expected, char actual, con
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::DoubleEquals(std::string message, double expected, double actual, double epsilon, const char* fileName, long lineNumber) {
|
||||
void Assertions::DoubleEquals(std::string message, double expected, double actual, double epsilon, const char *fileName, long lineNumber) {
|
||||
if (std::abs(expected - actual) > epsilon) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '" << expected << "', got '" << actual << "')";
|
||||
@ -65,7 +65,7 @@ void Assertions::DoubleEquals(std::string message, double expected, double actua
|
||||
}
|
||||
}
|
||||
|
||||
void Assertions::MemoryEquals(std::string message, void* expected, void* actual, int size, const char* fileName, long lineNumber) {
|
||||
void Assertions::MemoryEquals(std::string message, void *expected, void *actual, int size, const char *fileName, long lineNumber) {
|
||||
if (memcmp(expected, actual, size)) {
|
||||
std::stringstream ss;
|
||||
ss << message << " (expected '";
|
||||
@ -81,4 +81,4 @@ void Assertions::MemoryEquals(std::string message, void* expected, void* actual,
|
||||
ss << "')";
|
||||
throw TestFailException(ss.str(), std::string(fileName), lineNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,18 +6,17 @@
|
||||
#include "cppunitlite/Test.h"
|
||||
#include "cppunitlite/TestRegistry.h"
|
||||
|
||||
int GradleAdapter::writeAllTestsInfoToFile(const char* fname) {
|
||||
FILE* outFile = fopen(fname, "w");
|
||||
if (outFile == NULL) {
|
||||
int GradleAdapter::writeAllTestsInfoToFile(const char *fname) {
|
||||
FILE *outFile = fopen(fname, "w");
|
||||
if (!outFile) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
fprintf(outFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||
|
||||
fprintf(outFile, "<tests>\n");
|
||||
|
||||
Test* curTest = TestRegistry::getFirstTest();
|
||||
while (curTest != NULL) {
|
||||
Test *curTest = TestRegistry::getFirstTest();
|
||||
while (curTest) {
|
||||
fprintf(outFile, "<test ");
|
||||
|
||||
fprintf(outFile, " name=\"%s\" ", curTest->getName());
|
||||
@ -33,16 +32,16 @@ int GradleAdapter::writeAllTestsInfoToFile(const char* fname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::runTest(const char* groupName, const char* testName) {
|
||||
Test* curTest = TestRegistry::getFirstTest();
|
||||
while (curTest != NULL) {
|
||||
int GradleAdapter::runTest(const char *groupName, const char *testName) {
|
||||
Test *curTest = TestRegistry::getFirstTest();
|
||||
while (curTest) {
|
||||
if (!strcmp(groupName, curTest->getGroup()) && !strcmp(testName, curTest->getName())) {
|
||||
break;
|
||||
}
|
||||
curTest = curTest->getNext();
|
||||
}
|
||||
|
||||
if (curTest == NULL) {
|
||||
if (!curTest) {
|
||||
printf("Test group='%s' name='%s' not found\n", groupName, testName);
|
||||
return 2;
|
||||
}
|
||||
@ -58,10 +57,10 @@ int GradleAdapter::runTest(const char* groupName, const char* testName) {
|
||||
}
|
||||
}
|
||||
|
||||
int GradleAdapter::runGroup(const char* groupName) {
|
||||
Test* curTest = TestRegistry::getFirstTest();
|
||||
int GradleAdapter::runGroup(const char *groupName) {
|
||||
Test *curTest = TestRegistry::getFirstTest();
|
||||
int ranTests = 0;
|
||||
while (curTest != NULL) {
|
||||
while (curTest) {
|
||||
if (strcmp(groupName, curTest->getGroup())) {
|
||||
curTest = curTest->getNext();
|
||||
continue;
|
||||
@ -88,9 +87,9 @@ int GradleAdapter::runGroup(const char* groupName) {
|
||||
}
|
||||
|
||||
int GradleAdapter::runAllTests() {
|
||||
Test* curTest = TestRegistry::getFirstTest();
|
||||
Test *curTest = TestRegistry::getFirstTest();
|
||||
int ranTests = 0;
|
||||
while (curTest != NULL) {
|
||||
while (curTest) {
|
||||
TestResult result;
|
||||
curTest->run(result);
|
||||
ranTests++;
|
||||
@ -106,7 +105,7 @@ int GradleAdapter::runAllTests() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::testsEntryPoint(int argc, char* argv[]) {
|
||||
int GradleAdapter::testsEntryPoint(int argc, char *argv[]) {
|
||||
if (argc < 2 || !strcmp(argv[1], "-all")) {
|
||||
return runAllTests();
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
#include "cppunitlite/Test.h"
|
||||
#include "cppunitlite/TestRegistry.h"
|
||||
#include "cppunitlite/Failure.h"
|
||||
@ -7,21 +5,18 @@
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
Test::Test (const char* testName, const char* testGroup, int timeout)
|
||||
: name_ (testName), group_ (testGroup), timeout_(timeout)
|
||||
{
|
||||
next_ = NULL;
|
||||
next_ = nullptr;
|
||||
TestRegistry::addTest(this);
|
||||
}
|
||||
|
||||
|
||||
Test *Test::getNext() const
|
||||
{
|
||||
return next_;
|
||||
}
|
||||
|
||||
|
||||
void Test::setNext(Test *test)
|
||||
{
|
||||
next_ = test;
|
||||
|
@ -29,17 +29,12 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
|
||||
// probably gamedll compiled with flag /fpmath:fasted,
|
||||
// so we need to use type double, otherwise will be the test failed
|
||||
|
||||
typedef double float_precision;
|
||||
|
||||
// NOTE: In some cases we need high precision of floating-point,
|
||||
// so use double instead of float, otherwise unittest will fail
|
||||
typedef double real_t;
|
||||
#else
|
||||
|
||||
typedef float float_precision;
|
||||
|
||||
#endif // PLAY_GAMEDLL
|
||||
typedef float real_t;
|
||||
#endif
|
||||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec3_t[3];
|
||||
|
@ -49,7 +49,7 @@ EXT_FUNC bool CCSPlayer::JoinTeam(TeamName team)
|
||||
pPlayer->m_iTeam = SPECTATOR;
|
||||
pPlayer->m_iJoiningState = JOINED;
|
||||
|
||||
pPlayer->m_pIntroCamera = NULL;
|
||||
pPlayer->m_pIntroCamera = nullptr;
|
||||
pPlayer->m_bTeamChanged = true;
|
||||
|
||||
pPlayer->TeamChangeUpdate();
|
||||
@ -154,7 +154,7 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
pPlayer->m_bHasDefuser = false;
|
||||
pPlayer->pev->body = 0;
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, pPlayer->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_HIDE);
|
||||
WRITE_STRING("defuser");
|
||||
MESSAGE_END();
|
||||
@ -181,7 +181,7 @@ EXT_FUNC bool CCSPlayer::RemovePlayerItem(const char *pszItemName)
|
||||
pPlayer->m_iKevlar = ARMOR_NONE;
|
||||
pPlayer->pev->armorvalue = 0;
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, NULL, pPlayer->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgArmorType, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(0);
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ void CBaseAnimating::SetSequenceBox()
|
||||
Vector rmax(-9999, -9999, -9999);
|
||||
|
||||
Vector base, transformed;
|
||||
for (int i = 0; i <= 1; ++i)
|
||||
for (int i = 0; i <= 1; i++)
|
||||
{
|
||||
base.x = bounds[i].x;
|
||||
for (int j = 0; j <= 1; j++)
|
||||
|
@ -55,12 +55,12 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity)
|
||||
|
||||
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex);
|
||||
|
||||
for (i = 0; i < pstudiohdr->numseq; ++i)
|
||||
for (i = 0; i < pstudiohdr->numseq; i++)
|
||||
{
|
||||
if (pseqdesc[i].activity == activity)
|
||||
{
|
||||
weightTotal += pseqdesc[i].actweight;
|
||||
++activitySequenceCount;
|
||||
activitySequenceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity)
|
||||
{
|
||||
int which = RANDOM_LONG(0, weightTotal - 1);
|
||||
|
||||
for (i = 0; i < pstudiohdr->numseq; ++i)
|
||||
for (i = 0; i < pstudiohdr->numseq; i++)
|
||||
{
|
||||
if (pseqdesc[i].activity == activity)
|
||||
{
|
||||
@ -87,7 +87,7 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity)
|
||||
{
|
||||
select = RANDOM_LONG(0, activitySequenceCount - 1);
|
||||
|
||||
for (i = 0; i < pstudiohdr->numseq; ++i)
|
||||
for (i = 0; i < pstudiohdr->numseq; i++)
|
||||
{
|
||||
if (pseqdesc[i].activity == activity)
|
||||
{
|
||||
@ -96,7 +96,7 @@ int LookupActivity(void *pmodel, entvars_t *pev, int activity)
|
||||
return i;
|
||||
}
|
||||
|
||||
--select;
|
||||
select--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,7 +118,7 @@ int LookupActivityHeaviest(void *pmodel, entvars_t *pev, int activity)
|
||||
int weight = 0;
|
||||
int seq = ACT_INVALID;
|
||||
|
||||
for (int i = 0; i < pstudiohdr->numseq; ++i)
|
||||
for (int i = 0; i < pstudiohdr->numseq; i++)
|
||||
{
|
||||
if (pseqdesc[i].activity == activity)
|
||||
{
|
||||
@ -161,7 +161,7 @@ int LookupSequence(void *pmodel, const char *label)
|
||||
|
||||
// Look up by sequence name.
|
||||
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex);
|
||||
for (int i = 0; i < pstudiohdr->numseq; ++i)
|
||||
for (int i = 0; i < pstudiohdr->numseq; i++)
|
||||
{
|
||||
if (!Q_stricmp(pseqdesc[i].label, label))
|
||||
return i;
|
||||
@ -196,7 +196,7 @@ NOXREF void SequencePrecache(void *pmodel, const char *pSequenceName)
|
||||
mstudioseqdesc_t *pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + index;
|
||||
mstudioevent_t *pevent = (mstudioevent_t *)((byte *)pstudiohdr + pseqdesc->eventindex);
|
||||
|
||||
for (int i = 0; i < pseqdesc->numevents; ++i)
|
||||
for (int i = 0; i < pseqdesc->numevents; i++)
|
||||
{
|
||||
// Don't send client-side events to the server AI
|
||||
if (pevent[i].event >= EVENT_CLIENT)
|
||||
@ -446,7 +446,7 @@ int FindTransition(void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir)
|
||||
}
|
||||
|
||||
// look for someone going
|
||||
for (int i = 0; i < pstudiohdr->numseq; ++i)
|
||||
for (int i = 0; i < pstudiohdr->numseq; i++)
|
||||
{
|
||||
if (pseqdesc[i].entrynode == iEndNode && pseqdesc[i].exitnode == iInternNode)
|
||||
{
|
||||
@ -562,8 +562,8 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion)
|
||||
#else // REGAMEDLL_FIXES
|
||||
void AngleQuaternion(vec_t *angles, vec_t *quaternion)
|
||||
{
|
||||
float_precision sy, cy, sp_, cp;
|
||||
float_precision angle;
|
||||
real_t sy, cy, sp_, cp;
|
||||
real_t angle;
|
||||
float sr, cr;
|
||||
|
||||
float ftmp0;
|
||||
@ -597,10 +597,10 @@ void AngleQuaternion(vec_t *angles, vec_t *quaternion)
|
||||
void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
|
||||
{
|
||||
int i;
|
||||
float_precision a = 0;
|
||||
float_precision b = 0;
|
||||
real_t a = 0;
|
||||
real_t b = 0;
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
a += (p[i] - q[i]) * (p[i] - q[i]);
|
||||
b += (p[i] + q[i]) * (p[i] + q[i]);
|
||||
@ -608,7 +608,7 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
|
||||
|
||||
if (a > b)
|
||||
{
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (i = 0; i < 4; i++)
|
||||
q[i] = -q[i];
|
||||
}
|
||||
|
||||
@ -619,13 +619,13 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
|
||||
{
|
||||
if ((1.0 - cosom) > 0.00000001)
|
||||
{
|
||||
float_precision cosomega = Q_acos(float_precision(cosom));
|
||||
real_t cosomega = Q_acos(real_t(cosom));
|
||||
|
||||
float omega = cosomega;
|
||||
float sinom = Q_sin(cosomega);
|
||||
|
||||
sclp = Q_sin((1.0 - t) * omega) / sinom;
|
||||
sclq = Q_sin(float_precision(omega * t)) / sinom;
|
||||
sclq = Q_sin(real_t(omega * t)) / sinom;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -633,7 +633,7 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
|
||||
sclp = 1.0 - t;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (i = 0; i < 4; i++)
|
||||
qt[i] = sclp * p[i] + sclq * q[i];
|
||||
}
|
||||
else
|
||||
@ -646,7 +646,7 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
|
||||
sclp = Q_sin((1.0 - t) * 0.5 * M_PI);
|
||||
sclq = Q_sin(t * 0.5 * M_PI);
|
||||
|
||||
for (i = 0; i < 3; ++i)
|
||||
for (i = 0; i < 3; i++)
|
||||
qt[i] = sclp * p[i] + sclq * qt[i];
|
||||
}
|
||||
}
|
||||
@ -908,7 +908,7 @@ void StudioSlerpBones(vec4_t *q1, float pos1[][3], vec4_t *q2, float pos2[][3],
|
||||
s = Q_clamp(s, 0.0f, 1.0f);
|
||||
s1 = 1.0f - s;
|
||||
|
||||
for (i = 0; i < g_pstudiohdr->numbones; ++i)
|
||||
for (i = 0; i < g_pstudiohdr->numbones; i++)
|
||||
{
|
||||
QuaternionSlerp(q1[i], q2[i], s, q3);
|
||||
|
||||
@ -955,12 +955,12 @@ void ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4])
|
||||
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3];
|
||||
}
|
||||
|
||||
float_precision StudioEstimateFrame(float frame, mstudioseqdesc_t *pseqdesc)
|
||||
real_t StudioEstimateFrame(float frame, mstudioseqdesc_t *pseqdesc)
|
||||
{
|
||||
if (pseqdesc->numframes <= 1)
|
||||
return 0;
|
||||
|
||||
return float_precision(pseqdesc->numframes - 1) * frame / 256;
|
||||
return real_t(pseqdesc->numframes - 1) * frame / 256;
|
||||
}
|
||||
|
||||
void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t *angles, const vec_t *origin, const byte *pcontroller, const byte *pblending, int iBone, const edict_t *pEdict)
|
||||
@ -997,7 +997,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
|
||||
{
|
||||
chainlength = g_pstudiohdr->numbones;
|
||||
|
||||
for (i = 0; i < chainlength; ++i)
|
||||
for (i = 0; i < chainlength; i++)
|
||||
chain[(chainlength - i) - 1] = i;
|
||||
}
|
||||
else
|
||||
@ -1018,7 +1018,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
|
||||
{
|
||||
if (pseqdesc->numblends > 1)
|
||||
{
|
||||
float b = float_precision(pblending[0]) / 255.0f;
|
||||
float b = real_t(pblending[0]) / 255.0f;
|
||||
|
||||
panim = StudioGetAnim(pModel, pseqdesc);
|
||||
panim += g_pstudiohdr->numbones;
|
||||
@ -1033,7 +1033,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
|
||||
/*static */float pos3[MAXSTUDIOBONES][3], pos4[MAXSTUDIOBONES][3];
|
||||
/*static */float q3[MAXSTUDIOBONES][4], q4[MAXSTUDIOBONES][4];
|
||||
|
||||
float_precision s, t;
|
||||
real_t s, t;
|
||||
s = GetPlayerYaw(pEdict);
|
||||
t = GetPlayerPitch(pEdict);
|
||||
|
||||
@ -1136,7 +1136,7 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
|
||||
panim = StudioGetAnim(pModel, pseqdesc);
|
||||
StudioCalcRotations(pbones, chain, chainlength, adj, pos2, q2, pseqdesc, panim, 0, 0);
|
||||
|
||||
for (i = 0; i < g_pstudiohdr->numbones; ++i)
|
||||
for (i = 0; i < g_pstudiohdr->numbones; i++)
|
||||
{
|
||||
if (!Q_strcmp(pbones[i].name, "Bip01 Spine"))
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ void CBaseMonster::GibMonster()
|
||||
// throw some human gibs.
|
||||
CGib::SpawnRandomGibs(pev, 4, 1);
|
||||
}
|
||||
|
||||
gibbed = true;
|
||||
}
|
||||
else if (HasAlienGibs())
|
||||
@ -28,6 +29,7 @@ void CBaseMonster::GibMonster()
|
||||
// Throw alien gibs
|
||||
CGib::SpawnRandomGibs(pev, 4, 0);
|
||||
}
|
||||
|
||||
gibbed = true;
|
||||
}
|
||||
|
||||
@ -40,7 +42,9 @@ void CBaseMonster::GibMonster()
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
else
|
||||
{
|
||||
FadeMonster();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +354,7 @@ void CBaseMonster::Killed(entvars_t *pevAttacker, int iGib)
|
||||
}
|
||||
else if (pev->flags & FL_MONSTER)
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
BecomeDead();
|
||||
}
|
||||
|
||||
@ -444,9 +448,7 @@ BOOL CBaseMonster::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, f
|
||||
vecDir = (pInflictor->Center() - Vector(0, 0, 10) - Center()).Normalize();
|
||||
#else
|
||||
// TODO: fix test demo
|
||||
vecDir = NormalizeSubtract<
|
||||
float_precision, float, float_precision, float_precision
|
||||
>(Center(), pInflictor->Center() - Vector(0, 0, 10));
|
||||
vecDir = NormalizeSubtract<real_t, float, real_t, real_t>(Center(), pInflictor->Center() - Vector(0, 0, 10));
|
||||
#endif
|
||||
vecDir = g_vecAttackDir = vecDir.Normalize();
|
||||
}
|
||||
@ -568,12 +570,12 @@ BOOL CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacke
|
||||
|
||||
float CBaseMonster::DamageForce(float damage)
|
||||
{
|
||||
float_precision force = damage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5;
|
||||
|
||||
real_t force = damage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5;
|
||||
if (force > 1000.0)
|
||||
{
|
||||
force = 1000.0;
|
||||
}
|
||||
|
||||
return force;
|
||||
}
|
||||
|
||||
@ -736,7 +738,7 @@ NOXREF void CBaseMonster::CorpseFallThink()
|
||||
{
|
||||
if (pev->flags & FL_ONGROUND)
|
||||
{
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
SetSequenceBox();
|
||||
|
||||
// link into world.
|
||||
@ -830,10 +832,10 @@ void CBaseMonster::Look(int iDistance)
|
||||
// DON'T let visibility information from last frame sit around!
|
||||
ClearConditions(bits_COND_SEE_HATE | bits_COND_SEE_DISLIKE | bits_COND_SEE_ENEMY | bits_COND_SEE_FEAR | bits_COND_SEE_NEMESIS | bits_COND_SEE_CLIENT);
|
||||
|
||||
m_pLink = NULL;
|
||||
m_pLink = nullptr;
|
||||
|
||||
// the current visible entity that we're dealing with
|
||||
CBaseEntity *pSightEnt = NULL;
|
||||
CBaseEntity *pSightEnt = nullptr;
|
||||
CBaseEntity *pList[100];
|
||||
|
||||
Vector delta(iDistance, iDistance, iDistance);
|
||||
@ -909,10 +911,10 @@ CBaseEntity *CBaseMonster::BestVisibleEnemy()
|
||||
// so first visible entity will become the closest.
|
||||
iNearest = 8192;
|
||||
pNextEnt = m_pLink;
|
||||
pReturn = NULL;
|
||||
pReturn = nullptr;
|
||||
iBestRelationship = R_NO;
|
||||
|
||||
while (pNextEnt != NULL)
|
||||
while (pNextEnt)
|
||||
{
|
||||
if (pNextEnt->IsAlive())
|
||||
{
|
||||
@ -968,7 +970,7 @@ NOXREF void CBaseMonster::MakeDamageBloodDecal(int cCount, float flNoise, TraceR
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < cCount; ++i)
|
||||
for (i = 0; i < cCount; i++)
|
||||
{
|
||||
vecTraceDir = vecDir;
|
||||
|
||||
|
@ -132,7 +132,7 @@ void CFuncConveyor::Spawn()
|
||||
void CFuncConveyor::UpdateSpeed(float speed)
|
||||
{
|
||||
// Encode it as an integer with 4 fractional bits
|
||||
int speedCode = int(Q_fabs(float_precision(speed)) * 16.0);
|
||||
int speedCode = int(Q_fabs(real_t(speed)) * 16.0);
|
||||
|
||||
if (speed < 0)
|
||||
pev->rendercolor.x = 1;
|
||||
@ -499,9 +499,9 @@ void CFuncRotating::HurtTouch(CBaseEntity *pOther)
|
||||
void CFuncRotating::RampPitchVol(BOOL fUp)
|
||||
{
|
||||
Vector vecAVel = pev->avelocity;
|
||||
float_precision vecCur;
|
||||
float_precision vecFinal;
|
||||
float_precision fpct;
|
||||
real_t vecCur;
|
||||
real_t vecFinal;
|
||||
real_t fpct;
|
||||
float fvol;
|
||||
float fpitch;
|
||||
int pitch;
|
||||
@ -733,7 +733,7 @@ void CPendulum::Spawn()
|
||||
pev->speed = 100;
|
||||
|
||||
// Calculate constant acceleration from speed and distance
|
||||
m_accel = (pev->speed * pev->speed) / (2 * Q_fabs(float_precision(m_distance)));
|
||||
m_accel = (pev->speed * pev->speed) / (2 * Q_fabs(real_t(m_distance)));
|
||||
m_maxSpeed = pev->speed;
|
||||
m_start = pev->angles;
|
||||
m_center = pev->angles + (m_distance * 0.5) * pev->movedir;
|
||||
@ -764,7 +764,7 @@ void CPendulum::PendulumUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
|
||||
{
|
||||
if (pev->spawnflags & SF_PENDULUM_AUTO_RETURN)
|
||||
{
|
||||
float_precision delta;
|
||||
real_t delta;
|
||||
|
||||
delta = CBaseToggle::AxisDelta(pev->spawnflags, pev->angles, m_start);
|
||||
|
||||
@ -776,7 +776,7 @@ void CPendulum::PendulumUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T
|
||||
{
|
||||
// Dead stop
|
||||
pev->speed = 0;
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->avelocity = g_vecZero;
|
||||
}
|
||||
}
|
||||
@ -796,7 +796,7 @@ void CPendulum::Stop()
|
||||
{
|
||||
pev->angles = m_start;
|
||||
pev->speed = 0;
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->avelocity = g_vecZero;
|
||||
}
|
||||
|
||||
@ -845,7 +845,7 @@ void CPendulum::Swing()
|
||||
{
|
||||
pev->angles = m_center;
|
||||
pev->speed = 0;
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->avelocity = g_vecZero;
|
||||
}
|
||||
else if (pev->speed > m_dampSpeed)
|
||||
|
@ -36,30 +36,30 @@ LINK_ENTITY_TO_CLASS(bot, CCSBot, CAPI_CSBot)
|
||||
#endif
|
||||
|
||||
// Return the number of bots following the given player
|
||||
int GetBotFollowCount(CBasePlayer *leader)
|
||||
int GetBotFollowCount(CBasePlayer *pLeader)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
if (!player->IsBot())
|
||||
if (!pPlayer->IsBot())
|
||||
continue;
|
||||
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
CCSBot *bot = reinterpret_cast<CCSBot *>(player);
|
||||
if (bot->IsBot() && bot->GetFollowLeader() == leader)
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
if (pBot->IsBot() && pBot->GetFollowLeader() == pLeader)
|
||||
count++;
|
||||
}
|
||||
|
||||
@ -195,13 +195,13 @@ bool IsIntersectingBox(const Vector &start, const Vector &end, const Vector &box
|
||||
{
|
||||
constexpr auto HI_X = BIT(1);
|
||||
constexpr auto LO_X = BIT(2);
|
||||
|
||||
|
||||
constexpr auto HI_Y = BIT(3);
|
||||
constexpr auto LO_Y = BIT(4);
|
||||
|
||||
|
||||
constexpr auto HI_Z = BIT(5);
|
||||
constexpr auto LO_Z = BIT(6);
|
||||
|
||||
|
||||
unsigned char startFlags = 0;
|
||||
unsigned char endFlags = 0;
|
||||
|
||||
@ -246,20 +246,20 @@ bool IsIntersectingBox(const Vector &start, const Vector &end, const Vector &box
|
||||
}
|
||||
|
||||
// When bot is touched by another entity.
|
||||
void CCSBot::BotTouch(CBaseEntity *other)
|
||||
void CCSBot::BotTouch(CBaseEntity *pOther)
|
||||
{
|
||||
// if we have touched a higher-priority player, make way
|
||||
// TODO: Need to account for reaction time, etc.
|
||||
if (other->IsPlayer())
|
||||
if (pOther->IsPlayer())
|
||||
{
|
||||
// if we are defusing a bomb, don't move
|
||||
if (IsDefusingBomb())
|
||||
return;
|
||||
|
||||
CBasePlayer *player = static_cast<CBasePlayer *>(other);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
// get priority of other player
|
||||
unsigned int otherPri = TheCSBots()->GetPlayerPriority(player);
|
||||
unsigned int otherPri = TheCSBots()->GetPlayerPriority(pPlayer);
|
||||
|
||||
// get our priority
|
||||
unsigned int myPri = TheCSBots()->GetPlayerPriority(this);
|
||||
@ -274,34 +274,34 @@ void CCSBot::BotTouch(CBaseEntity *other)
|
||||
unsigned int avoidPri = TheCSBots()->GetPlayerPriority(m_avoid);
|
||||
if (avoidPri < otherPri)
|
||||
{
|
||||
// ignore 'other' because we're already avoiding someone better
|
||||
// ignore 'pOther' because we're already avoiding someone better
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_avoid = static_cast<CBasePlayer *>(other);
|
||||
m_avoid = static_cast<CBasePlayer *>(pOther);
|
||||
m_avoidTimestamp = gpGlobals->time;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// If we won't be able to break it, don't try
|
||||
if (other->pev->takedamage != DAMAGE_YES)
|
||||
if (pOther->pev->takedamage != DAMAGE_YES)
|
||||
return;
|
||||
|
||||
if (IsAttacking())
|
||||
return;
|
||||
|
||||
// See if it's breakable
|
||||
if (FClassnameIs(other->pev, "func_breakable"))
|
||||
if (FClassnameIs(pOther->pev, "func_breakable"))
|
||||
{
|
||||
Vector center = (other->pev->absmax + other->pev->absmin) / 2.0f;
|
||||
Vector center = (pOther->pev->absmax + pOther->pev->absmin) / 2.0f;
|
||||
bool breakIt = true;
|
||||
|
||||
if (m_pathLength)
|
||||
{
|
||||
Vector goal = m_goalPosition + Vector(0, 0, HalfHumanHeight);
|
||||
breakIt = IsIntersectingBox(pev->origin, goal, other->pev->absmin, other->pev->absmax);
|
||||
breakIt = IsIntersectingBox(pev->origin, goal, pOther->pev->absmin, pOther->pev->absmax);
|
||||
}
|
||||
|
||||
if (breakIt)
|
||||
@ -361,11 +361,11 @@ CBasePlayer *CCSBot::FindNearbyPlayer()
|
||||
}
|
||||
|
||||
// Assign given player as our current enemy to attack
|
||||
void CCSBot::SetEnemy(CBasePlayer *enemy)
|
||||
void CCSBot::SetEnemy(CBasePlayer *pEnemy)
|
||||
{
|
||||
if (m_enemy != enemy)
|
||||
if (m_enemy != pEnemy)
|
||||
{
|
||||
m_enemy = enemy;
|
||||
m_enemy = pEnemy;
|
||||
m_currentEnemyAcquireTimestamp = gpGlobals->time;
|
||||
}
|
||||
}
|
||||
@ -420,7 +420,7 @@ bool CCSBot::StayOnNavMesh()
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCSBot::Panic(CBasePlayer *enemy)
|
||||
void CCSBot::Panic(CBasePlayer *pEnemy)
|
||||
{
|
||||
if (IsSurprised())
|
||||
return;
|
||||
@ -431,7 +431,7 @@ void CCSBot::Panic(CBasePlayer *enemy)
|
||||
|
||||
if (GetProfile()->GetSkill() >= 0.5f)
|
||||
{
|
||||
Vector2D toEnemy = (enemy->pev->origin - pev->origin).Make2D();
|
||||
Vector2D toEnemy = (pEnemy->pev->origin - pev->origin).Make2D();
|
||||
toEnemy.NormalizeInPlace();
|
||||
|
||||
float along = DotProduct(toEnemy, dir);
|
||||
@ -439,7 +439,7 @@ void CCSBot::Panic(CBasePlayer *enemy)
|
||||
float c45 = 0.7071f;
|
||||
float size = 100.0f;
|
||||
|
||||
float_precision shift = RANDOM_FLOAT(-75.0, 75.0);
|
||||
real_t shift = RANDOM_FLOAT(-75.0, 75.0);
|
||||
|
||||
if (along > c45)
|
||||
{
|
||||
@ -465,7 +465,7 @@ void CCSBot::Panic(CBasePlayer *enemy)
|
||||
else
|
||||
{
|
||||
const float offset = 200.0f;
|
||||
float_precision side = RANDOM_FLOAT(-offset, offset) * 2.0f;
|
||||
real_t side = RANDOM_FLOAT(-offset, offset) * 2.0f;
|
||||
|
||||
spot.x = pev->origin.x - dir.x * offset + perp.x * side;
|
||||
spot.y = pev->origin.y - dir.y * offset + perp.y * side;
|
||||
@ -619,18 +619,18 @@ void CCSBot::UpdateHostageEscortCount()
|
||||
// recount the hostages in case we lost some
|
||||
m_hostageEscortCount = 0;
|
||||
|
||||
CHostage *hostage = nullptr;
|
||||
while ((hostage = UTIL_FindEntityByClassname(hostage, "hostage_entity")))
|
||||
CHostage *pHostage = nullptr;
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (FNullEnt(hostage->edict()))
|
||||
if (FNullEnt(pHostage->edict()))
|
||||
break;
|
||||
|
||||
// skip dead or rescued hostages
|
||||
if (!hostage->IsAlive())
|
||||
if (!pHostage->IsAlive())
|
||||
continue;
|
||||
|
||||
// check if hostage has targeted us, and is following
|
||||
if (hostage->IsFollowing(this))
|
||||
if (pHostage->IsFollowing(this))
|
||||
m_hostageEscortCount++;
|
||||
}
|
||||
}
|
||||
@ -660,43 +660,43 @@ CBasePlayer *CCSBot::GetImportantEnemy(bool checkVisibility) const
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
// is it a player?
|
||||
if (!player->IsPlayer())
|
||||
if (!pPlayer->IsPlayer())
|
||||
continue;
|
||||
|
||||
// is it alive?
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
// skip friends
|
||||
if (BotRelationship(player) == BOT_TEAMMATE)
|
||||
if (BotRelationship(pPlayer) == BOT_TEAMMATE)
|
||||
continue;
|
||||
|
||||
// is it "important"
|
||||
if (!TheCSBots()->IsImportantPlayer(player))
|
||||
if (!TheCSBots()->IsImportantPlayer(pPlayer))
|
||||
continue;
|
||||
|
||||
// is it closest?
|
||||
Vector d = pev->origin - player->pev->origin;
|
||||
Vector d = pev->origin - pPlayer->pev->origin;
|
||||
|
||||
float distSq = d.x * d.x + d.y * d.y + d.z * d.z;
|
||||
if (distSq < nearDist)
|
||||
{
|
||||
if (checkVisibility && !IsVisible(player, CHECK_FOV))
|
||||
if (checkVisibility && !IsVisible(pPlayer, CHECK_FOV))
|
||||
continue;
|
||||
|
||||
nearEnemy = player;
|
||||
nearEnemy = pPlayer;
|
||||
nearDist = distSq;
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ public:
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual const char *GetName() const { return "Follow"; }
|
||||
|
||||
void SetLeader(CBasePlayer *leader) { m_leader = leader; }
|
||||
void SetLeader(CBasePlayer *pLeader) { m_leader = pLeader; }
|
||||
|
||||
private:
|
||||
void ComputeLeaderMotionState(float leaderSpeed);
|
||||
@ -287,7 +287,7 @@ public:
|
||||
virtual void OnExit(CCSBot *me);
|
||||
virtual const char *GetName() const { return "UseEntity"; }
|
||||
|
||||
void SetEntity(CBaseEntity *entity) { m_entity = entity; }
|
||||
void SetEntity(CBaseEntity *pEntity) { m_entity = pEntity; }
|
||||
|
||||
private:
|
||||
EntityHandle<CBaseEntity> m_entity;
|
||||
@ -313,13 +313,13 @@ public:
|
||||
virtual void Walk();
|
||||
virtual bool Jump(bool mustJump = false); // returns true if jump was started
|
||||
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *entity = nullptr, CBaseEntity *other = nullptr); // invoked when event occurs in the game (some events have NULL entity)
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr); // invoked when event occurs in the game (some events have NULL entity)
|
||||
|
||||
#define CHECK_FOV true
|
||||
virtual bool IsVisible(const Vector *pos, bool testFOV = false) const; // return true if we can see the point
|
||||
virtual bool IsVisible(CBasePlayer *player, bool testFOV = false, unsigned char *visParts = nullptr) const; // return true if we can see any part of the player
|
||||
virtual bool IsVisible(const Vector *pos, bool testFOV = false) const; // return true if we can see the point
|
||||
virtual bool IsVisible(CBasePlayer *pPlayer, bool testFOV = false, unsigned char *visParts = nullptr) const; // return true if we can see any part of the player
|
||||
|
||||
virtual bool IsEnemyPartVisible(VisiblePartType part) const; // if enemy is visible, return the part we see for our current enemy
|
||||
virtual bool IsEnemyPartVisible(VisiblePartType part) const; // if enemy is visible, return the part we see for our current enemy
|
||||
|
||||
public:
|
||||
void Disconnect();
|
||||
@ -374,12 +374,12 @@ public:
|
||||
bool IsEscapingFromBomb() const; // return true if we are escaping from the bomb
|
||||
|
||||
void RescueHostages();
|
||||
void UseEntity(CBaseEntity *entity); // use the entity
|
||||
void UseEntity(CBaseEntity *pEntity); // use the entity
|
||||
|
||||
bool IsBuying() const;
|
||||
|
||||
void Panic(CBasePlayer *enemy); // look around in panic
|
||||
void Follow(CBasePlayer *player); // begin following given Player
|
||||
void Panic(CBasePlayer *pEnemy); // look around in panic
|
||||
void Follow(CBasePlayer *pPlayer); // begin following given Player
|
||||
void ContinueFollowing(); // continue following our leader after finishing what we were doing
|
||||
void StopFollowing(); // stop following
|
||||
bool IsFollowing() const; // return true if we are following someone (not necessarily in the follow state)
|
||||
@ -437,7 +437,7 @@ public:
|
||||
NUM_TASKS
|
||||
};
|
||||
|
||||
void SetTask(TaskType task, CBaseEntity *entity = nullptr); // set our current "task"
|
||||
void SetTask(TaskType task, CBaseEntity *pEntity = nullptr); // set our current "task"
|
||||
TaskType GetTask() const;
|
||||
CBaseEntity *GetTaskEntity();
|
||||
|
||||
@ -495,7 +495,7 @@ public:
|
||||
// enemies
|
||||
// BOTPORT: GetEnemy() collides with GetEnemy() in CBaseEntity - need to use different nomenclature
|
||||
|
||||
void SetEnemy(CBasePlayer *enemy); // set given player as our current enemy
|
||||
void SetEnemy(CBasePlayer *pEnemy); // set given player as our current enemy
|
||||
CBasePlayer *GetEnemy();
|
||||
int GetNearbyEnemyCount() const; // return max number of nearby enemies we've seen recently
|
||||
unsigned int GetEnemyPlace() const; // return location where we see the majority of our enemies
|
||||
@ -563,7 +563,7 @@ public:
|
||||
bool IsUsingLadder() const; // returns true if we are in the process of negotiating a ladder
|
||||
void GetOffLadder();
|
||||
|
||||
void SetGoalEntity(CBaseEntity *entity);
|
||||
void SetGoalEntity(CBaseEntity *pEntity);
|
||||
|
||||
template <typename T = CBaseEntity>
|
||||
T *GetGoalEntity();
|
||||
@ -654,7 +654,7 @@ public:
|
||||
void BotDeathThink();
|
||||
CBasePlayer *FindNearbyPlayer();
|
||||
void AdjustSafeTime(); // called when enemy seen to adjust safe time for this round
|
||||
void EXPORT BotTouch(CBaseEntity *other);
|
||||
void EXPORT BotTouch(CBaseEntity *pOther);
|
||||
bool HasAnyAmmo(CBasePlayerWeapon *weapon) const;
|
||||
|
||||
private:
|
||||
@ -750,7 +750,7 @@ private:
|
||||
void SetupLadderMovement();
|
||||
void SetPathIndex(int newIndex); // set the current index along the path
|
||||
void DrawPath();
|
||||
int FindOurPositionOnPath(Vector *close, bool local = false) const; // compute the closest point to our current position on our path
|
||||
int FindOurPositionOnPath(Vector *close, bool local = false) const; // compute the closest point to our current position on our path
|
||||
int FindPathPoint(float aheadRange, Vector *point, int *prevIndex = nullptr); // compute a point a fixed distance ahead along our path.
|
||||
bool FindClosestPointOnPath(const Vector *worldPos, int startIndex, int endIndex, Vector *close) const; // compute closest point on path to given point
|
||||
bool IsStraightLinePathWalkable(const Vector *goal) const; // test for un-jumpable height change, or unrecoverable fall
|
||||
@ -1000,7 +1000,7 @@ private:
|
||||
void StartNormalProcess();
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
bool IsNoticable(const CBasePlayer *player, unsigned char visibleParts) const; // return true if we "notice" given player
|
||||
bool IsNoticable(const CBasePlayer *pPlayer, unsigned char visibleParts) const; // return true if we "notice" given player
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -1124,10 +1124,10 @@ inline bool CCSBot::IsNoiseHeard() const
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void CCSBot::SetTask(TaskType task, CBaseEntity *entity)
|
||||
inline void CCSBot::SetTask(TaskType task, CBaseEntity *pEntity)
|
||||
{
|
||||
m_task = task;
|
||||
m_taskEntity = entity;
|
||||
m_taskEntity = pEntity;
|
||||
}
|
||||
|
||||
inline CCSBot::TaskType CCSBot::GetTask() const
|
||||
@ -1281,9 +1281,9 @@ inline bool CCSBot::IsUsingLadder() const
|
||||
return m_pathLadder != nullptr;
|
||||
}
|
||||
|
||||
inline void CCSBot::SetGoalEntity(CBaseEntity *entity)
|
||||
inline void CCSBot::SetGoalEntity(CBaseEntity *pEntity)
|
||||
{
|
||||
m_goalEntity = entity;
|
||||
m_goalEntity = pEntity;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -1393,7 +1393,7 @@ inline int CCSBot::GetHostageEscortCount() const
|
||||
|
||||
inline void CCSBot::IncreaseHostageEscortCount()
|
||||
{
|
||||
++m_hostageEscortCount;
|
||||
m_hostageEscortCount++;
|
||||
}
|
||||
|
||||
inline void CCSBot::ResetWaitForHostagePatience()
|
||||
@ -1464,12 +1464,8 @@ public:
|
||||
bool operator()(CNavArea *area)
|
||||
{
|
||||
// collect all the hiding spots in this area
|
||||
const HidingSpotList *list = area->GetHidingSpotList();
|
||||
|
||||
for (HidingSpotList::const_iterator iter = list->begin(); iter != list->end(); ++iter)
|
||||
for (auto const spot : *area->GetHidingSpotList())
|
||||
{
|
||||
const HidingSpot *spot = (*iter);
|
||||
|
||||
if (m_count >= MAX_SPOTS)
|
||||
break;
|
||||
|
||||
@ -1545,9 +1541,9 @@ public:
|
||||
class PathCost
|
||||
{
|
||||
public:
|
||||
PathCost(CCSBot *bot, RouteType route = SAFEST_ROUTE)
|
||||
PathCost(CCSBot *pBot, RouteType route = SAFEST_ROUTE)
|
||||
{
|
||||
m_bot = bot;
|
||||
m_bot = pBot;
|
||||
m_route = route;
|
||||
}
|
||||
float operator()(CNavArea *area, CNavArea *fromArea, const CNavLadder *ladder)
|
||||
@ -1632,7 +1628,7 @@ public:
|
||||
if (area->GetAttributes() & NAV_CROUCH)
|
||||
{
|
||||
// these areas are very slow to move through
|
||||
float_precision crouchPenalty = (m_route == FASTEST_ROUTE) ? 20.0f : 5.0f;
|
||||
real_t crouchPenalty = (m_route == FASTEST_ROUTE) ? 20.0f : 5.0f;
|
||||
|
||||
// avoid crouch areas if we are rescuing hostages
|
||||
if (m_bot->GetHostageEscortCount())
|
||||
@ -1643,15 +1639,6 @@ public:
|
||||
cost += crouchPenalty * dist;
|
||||
}
|
||||
|
||||
// if this is a "walk" area, add penalty
|
||||
if (area->GetAttributes() & NAV_WALK)
|
||||
{
|
||||
// these areas are kinda slow to move through
|
||||
float_precision walkPenalty = (m_route == FASTEST_ROUTE) ? 2.5f : 1.5f;
|
||||
|
||||
cost += walkPenalty * dist;
|
||||
}
|
||||
|
||||
// if this is a "jump" area, add penalty
|
||||
if (area->GetAttributes() & NAV_JUMP)
|
||||
{
|
||||
@ -1696,19 +1683,19 @@ private:
|
||||
class FollowTargetCollector
|
||||
{
|
||||
public:
|
||||
FollowTargetCollector(CBasePlayer *player)
|
||||
FollowTargetCollector(CBasePlayer *pPlayer)
|
||||
{
|
||||
m_player = player;
|
||||
m_forward.x = player->pev->velocity.x;
|
||||
m_forward.y = player->pev->velocity.y;
|
||||
m_player = pPlayer;
|
||||
m_forward.x = pPlayer->pev->velocity.x;
|
||||
m_forward.y = pPlayer->pev->velocity.y;
|
||||
|
||||
float speed = m_forward.NormalizeInPlace();
|
||||
|
||||
const float walkSpeed = 100.0f;
|
||||
if (speed < walkSpeed)
|
||||
{
|
||||
m_cutoff.x = player->pev->origin.x;
|
||||
m_cutoff.y = player->pev->origin.y;
|
||||
m_cutoff.x = pPlayer->pev->origin.x;
|
||||
m_cutoff.y = pPlayer->pev->origin.y;
|
||||
|
||||
m_forward.x = 0.0f;
|
||||
m_forward.y = 0.0f;
|
||||
@ -1716,10 +1703,10 @@ public:
|
||||
else
|
||||
{
|
||||
const float k = 1.5f;
|
||||
float_precision trimSpeed = (speed < 200.0f) ? speed : 200.0f;
|
||||
real_t trimSpeed = (speed < 200.0f) ? speed : 200.0f;
|
||||
|
||||
m_cutoff.x = player->pev->origin.x + k * trimSpeed * m_forward.x;
|
||||
m_cutoff.y = player->pev->origin.y + k * trimSpeed * m_forward.y;
|
||||
m_cutoff.x = pPlayer->pev->origin.x + k * trimSpeed * m_forward.x;
|
||||
m_cutoff.y = pPlayer->pev->origin.y + k * trimSpeed * m_forward.y;
|
||||
}
|
||||
|
||||
m_targetAreaCount = 0;
|
||||
@ -1744,9 +1731,10 @@ public:
|
||||
Vector2D to(((*area->GetCenter()).x - m_cutoff.x), (*area->GetCenter()).y - m_cutoff.y);
|
||||
to.NormalizeInPlace();
|
||||
|
||||
//if (DotProduct(to, m_forward) > 0.7071f)
|
||||
if ((to.x * m_forward.x + to.y * m_forward.y) > 0.7071f)
|
||||
if (DotProduct(to, m_forward) > 0.7071f)
|
||||
{
|
||||
m_targetArea[m_targetAreaCount++] = area;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1763,7 +1751,7 @@ public:
|
||||
void InstallBotControl();
|
||||
void Bot_ServerCommand();
|
||||
void Bot_RegisterCVars();
|
||||
int GetBotFollowCount(CBasePlayer *leader);
|
||||
int GetBotFollowCount(CBasePlayer *pLeader);
|
||||
const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange);
|
||||
|
||||
void drawProgressMeter(float progress, char *title);
|
||||
|
@ -59,93 +59,93 @@ const Vector *GetRandomSpotAtPlace(Place place)
|
||||
}
|
||||
|
||||
// Transmit meme to other bots
|
||||
void BotMeme::Transmit(CCSBot *sender) const
|
||||
void BotMeme::Transmit(CCSBot *pSender) const
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
// skip self
|
||||
if (sender == player)
|
||||
if (pSender == pPlayer)
|
||||
continue;
|
||||
|
||||
// ignore dead humans
|
||||
if (!player->IsBot() && !player->IsAlive())
|
||||
if (!pPlayer->IsBot() && !pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
// ignore enemies, since we can't hear them talk
|
||||
if (sender->BotRelationship(player) == CCSBot::BOT_ENEMY)
|
||||
if (pSender->BotRelationship(pPlayer) == CCSBot::BOT_ENEMY)
|
||||
continue;
|
||||
|
||||
// if not a bot, fail the test
|
||||
if (!player->IsBot())
|
||||
if (!pPlayer->IsBot())
|
||||
continue;
|
||||
|
||||
// allow bot to interpret our meme
|
||||
Interpret(sender, (CCSBot *)player);
|
||||
Interpret(pSender, (CCSBot *)pPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
// A teammate called for help - respond
|
||||
void BotHelpMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotHelpMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
const float maxHelpRange = 3000.0f; // 2000
|
||||
receiver->RespondToHelpRequest(sender, m_place, maxHelpRange);
|
||||
pReceiver->RespondToHelpRequest(pSender, m_place, maxHelpRange);
|
||||
}
|
||||
|
||||
// A teammate reported information about a bombsite
|
||||
void BotBombsiteStatusMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotBombsiteStatusMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
// remember this bombsite's status
|
||||
if (m_status == CLEAR)
|
||||
receiver->GetGameState()->ClearBombsite(m_zoneIndex);
|
||||
pReceiver->GetGameState()->ClearBombsite(m_zoneIndex);
|
||||
else
|
||||
receiver->GetGameState()->MarkBombsiteAsPlanted(m_zoneIndex);
|
||||
pReceiver->GetGameState()->MarkBombsiteAsPlanted(m_zoneIndex);
|
||||
|
||||
// if we were heading to the just-cleared bombsite, pick another one to search
|
||||
// if our target bombsite wasn't cleared, will will continue going to it,
|
||||
// because GetNextBombsiteToSearch() will return the same zone (since its not cleared)
|
||||
// if the bomb was planted, we will head to that bombsite
|
||||
if (receiver->GetTask() == CCSBot::FIND_TICKING_BOMB)
|
||||
if (pReceiver->GetTask() == CCSBot::FIND_TICKING_BOMB)
|
||||
{
|
||||
receiver->Idle();
|
||||
receiver->GetChatter()->Affirmative();
|
||||
pReceiver->Idle();
|
||||
pReceiver->GetChatter()->Affirmative();
|
||||
}
|
||||
}
|
||||
|
||||
// A teammate reported information about the bomb
|
||||
void BotBombStatusMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotBombStatusMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
// update our gamestate based on teammate's report
|
||||
switch (m_state)
|
||||
{
|
||||
case CSGameState::MOVING:
|
||||
{
|
||||
receiver->GetGameState()->UpdateBomber(&m_pos);
|
||||
pReceiver->GetGameState()->UpdateBomber(&m_pos);
|
||||
|
||||
// if we are hunting and see no enemies, respond
|
||||
if (!receiver->IsRogue() && receiver->IsHunting() && receiver->GetNearbyEnemyCount() == 0)
|
||||
receiver->RespondToHelpRequest(sender, TheNavAreaGrid.GetPlace(&m_pos));
|
||||
if (!pReceiver->IsRogue() && pReceiver->IsHunting() && pReceiver->GetNearbyEnemyCount() == 0)
|
||||
pReceiver->RespondToHelpRequest(pSender, TheNavAreaGrid.GetPlace(&m_pos));
|
||||
|
||||
break;
|
||||
}
|
||||
case CSGameState::LOOSE:
|
||||
{
|
||||
receiver->GetGameState()->UpdateLooseBomb(&m_pos);
|
||||
pReceiver->GetGameState()->UpdateLooseBomb(&m_pos);
|
||||
|
||||
if (receiver->GetTask() == CCSBot::GUARD_BOMB_ZONE)
|
||||
if (pReceiver->GetTask() == CCSBot::GUARD_BOMB_ZONE)
|
||||
{
|
||||
receiver->Idle();
|
||||
receiver->GetChatter()->Affirmative();
|
||||
pReceiver->Idle();
|
||||
pReceiver->GetChatter()->Affirmative();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -153,17 +153,17 @@ void BotBombStatusMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
}
|
||||
|
||||
// A teammate has asked that we follow him
|
||||
void BotFollowMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotFollowMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
if (receiver->IsRogue())
|
||||
if (pReceiver->IsRogue())
|
||||
return;
|
||||
|
||||
// if we're busy, ignore
|
||||
if (receiver->IsBusy())
|
||||
if (pReceiver->IsBusy())
|
||||
return;
|
||||
|
||||
PathCost pathCost(receiver);
|
||||
float travelDistance = NavAreaTravelDistance(receiver->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&sender->pev->origin), pathCost);
|
||||
PathCost pathCost(pReceiver);
|
||||
float travelDistance = NavAreaTravelDistance(pReceiver->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&pSender->pev->origin), pathCost);
|
||||
if (travelDistance < 0.0f)
|
||||
return;
|
||||
|
||||
@ -172,80 +172,81 @@ void BotFollowMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
return;
|
||||
|
||||
// begin following
|
||||
receiver->Follow(sender);
|
||||
pReceiver->Follow(pSender);
|
||||
|
||||
// acknowledge
|
||||
receiver->GetChatter()->Say("CoveringFriend");
|
||||
pReceiver->GetChatter()->Say("CoveringFriend");
|
||||
}
|
||||
|
||||
// A teammate has asked us to defend a place
|
||||
void BotDefendHereMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotDefendHereMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
if (receiver->IsRogue())
|
||||
if (pReceiver->IsRogue())
|
||||
return;
|
||||
|
||||
// if we're busy, ignore
|
||||
if (receiver->IsBusy())
|
||||
if (pReceiver->IsBusy())
|
||||
return;
|
||||
|
||||
Place place = TheNavAreaGrid.GetPlace(&m_pos);
|
||||
if (place != UNDEFINED_PLACE)
|
||||
{
|
||||
// pick a random hiding spot in this place
|
||||
const Vector *spot = FindRandomHidingSpot(receiver, place, receiver->IsSniper());
|
||||
const Vector *spot = FindRandomHidingSpot(pReceiver, place, pReceiver->IsSniper());
|
||||
if (spot)
|
||||
{
|
||||
receiver->SetTask(CCSBot::HOLD_POSITION);
|
||||
receiver->Hide(spot);
|
||||
pReceiver->SetTask(CCSBot::HOLD_POSITION);
|
||||
pReceiver->Hide(spot);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// hide nearby
|
||||
receiver->SetTask(CCSBot::HOLD_POSITION);
|
||||
receiver->Hide(TheNavAreaGrid.GetNearestNavArea(&m_pos));
|
||||
pReceiver->SetTask(CCSBot::HOLD_POSITION);
|
||||
pReceiver->Hide(TheNavAreaGrid.GetNearestNavArea(&m_pos));
|
||||
|
||||
// acknowledge
|
||||
receiver->GetChatter()->Say("Affirmative");
|
||||
pReceiver->GetChatter()->Say("Affirmative");
|
||||
}
|
||||
|
||||
// A teammate has asked where the bomb is planted
|
||||
void BotWhereBombMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotWhereBombMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
int zone = receiver->GetGameState()->GetPlantedBombsite();
|
||||
|
||||
int zone = pReceiver->GetGameState()->GetPlantedBombsite();
|
||||
if (zone != CSGameState::UNKNOWN)
|
||||
receiver->GetChatter()->FoundPlantedBomb(zone);
|
||||
{
|
||||
pReceiver->GetChatter()->FoundPlantedBomb(zone);
|
||||
}
|
||||
}
|
||||
|
||||
// A teammate has asked us to report in
|
||||
void BotRequestReportMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotRequestReportMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
receiver->GetChatter()->ReportingIn();
|
||||
pReceiver->GetChatter()->ReportingIn();
|
||||
}
|
||||
|
||||
// A teammate told us all the hostages are gone
|
||||
void BotAllHostagesGoneMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotAllHostagesGoneMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
receiver->GetGameState()->AllHostagesGone();
|
||||
pReceiver->GetGameState()->AllHostagesGone();
|
||||
|
||||
// acknowledge
|
||||
receiver->GetChatter()->Say("Affirmative");
|
||||
pReceiver->GetChatter()->Say("Affirmative");
|
||||
}
|
||||
|
||||
// A teammate told us a CT is talking to a hostage
|
||||
void BotHostageBeingTakenMeme::Interpret(CCSBot *sender, CCSBot *receiver) const
|
||||
void BotHostageBeingTakenMeme::Interpret(CCSBot *pSender, CCSBot *pReceiver) const
|
||||
{
|
||||
receiver->GetGameState()->HostageWasTaken();
|
||||
pReceiver->GetGameState()->HostageWasTaken();
|
||||
|
||||
// if we're busy, ignore
|
||||
if (receiver->IsBusy())
|
||||
if (pReceiver->IsBusy())
|
||||
return;
|
||||
|
||||
receiver->Idle();
|
||||
pReceiver->Idle();
|
||||
|
||||
// acknowledge
|
||||
receiver->GetChatter()->Say("Affirmative");
|
||||
pReceiver->GetChatter()->Say("Affirmative");
|
||||
}
|
||||
|
||||
BotSpeakable::BotSpeakable()
|
||||
@ -1405,7 +1406,7 @@ void BotChatterInterface::ReportEnemies()
|
||||
}
|
||||
}
|
||||
|
||||
void BotChatterInterface::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void BotChatterInterface::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
;
|
||||
}
|
||||
@ -1521,32 +1522,32 @@ BotStatement *BotChatterInterface::GetActiveStatement()
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
// ignore dead humans
|
||||
if (!player->IsBot() && !player->IsAlive())
|
||||
if (!pPlayer->IsBot() && !pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
// ignore enemies, since we can't hear them talk
|
||||
if (m_me->BotRelationship(player) == CCSBot::BOT_ENEMY)
|
||||
if (m_me->BotRelationship(pPlayer) == CCSBot::BOT_ENEMY)
|
||||
continue;
|
||||
|
||||
// if not a bot, fail the test
|
||||
// TODO: Check if human is currently talking
|
||||
if (!player->IsBot())
|
||||
if (!pPlayer->IsBot())
|
||||
continue;
|
||||
|
||||
CCSBot *bot = reinterpret_cast<CCSBot *>(player);
|
||||
auto say = bot->GetChatter()->m_statementList;
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
auto say = pBot->GetChatter()->m_statementList;
|
||||
while (say)
|
||||
{
|
||||
// if this statement is currently being spoken, return it
|
||||
|
@ -44,22 +44,22 @@ typedef unsigned int CountCriteria;
|
||||
class BotMeme
|
||||
{
|
||||
public:
|
||||
void Transmit(CCSBot *sender) const; // transmit meme to other bots
|
||||
void Transmit(CCSBot *pSender) const; // transmit meme to other bots
|
||||
|
||||
virtual ~BotMeme(){}
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const = 0; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const = 0; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
class BotAllHostagesGoneMeme: public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
class BotHostageBeingTakenMeme: public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
class BotHelpMeme: public BotMeme
|
||||
@ -69,7 +69,7 @@ public:
|
||||
{
|
||||
m_place = place;
|
||||
}
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
|
||||
private:
|
||||
Place m_place;
|
||||
@ -85,7 +85,7 @@ public:
|
||||
m_zoneIndex = zoneIndex;
|
||||
m_status = status;
|
||||
}
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
|
||||
private:
|
||||
int m_zoneIndex; // the bombsite
|
||||
@ -102,7 +102,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
|
||||
private:
|
||||
CSGameState::BombState m_state;
|
||||
@ -112,7 +112,7 @@ private:
|
||||
class BotFollowMeme: public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
class BotDefendHereMeme: public BotMeme
|
||||
@ -122,7 +122,7 @@ public:
|
||||
{
|
||||
m_pos = pos;
|
||||
}
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
|
||||
private:
|
||||
Vector m_pos;
|
||||
@ -131,13 +131,13 @@ private:
|
||||
class BotWhereBombMeme: public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
class BotRequestReportMeme: public BotMeme
|
||||
{
|
||||
public:
|
||||
virtual void Interpret(CCSBot *sender, CCSBot *receiver) const; // cause the given bot to act on this meme
|
||||
virtual void Interpret(CCSBot *pSender, CCSBot *pReceiver) const; // cause the given bot to act on this meme
|
||||
};
|
||||
|
||||
enum BotStatementType
|
||||
@ -296,7 +296,7 @@ private:
|
||||
|
||||
inline int BotPhraseManager::FindPlaceIndex(Place where) const
|
||||
{
|
||||
for (int i = 0; i < m_placeCount; ++i)
|
||||
for (int i = 0; i < m_placeCount; i++)
|
||||
{
|
||||
if (m_placeStatementHistory[i].placeID == where)
|
||||
return i;
|
||||
@ -449,7 +449,7 @@ public:
|
||||
void Reset(); // reset to initial state
|
||||
void Update(); // process ongoing chatter
|
||||
|
||||
void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other); // invoked when event occurs in the game (some events have NULL entities)
|
||||
void OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther); // invoked when event occurs in the game (some events have NULL entities)
|
||||
void OnDeath(); // invoked when we die
|
||||
|
||||
enum VerbosityType
|
||||
|
@ -28,10 +28,10 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSBot::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
GetGameState()->OnEvent(event, entity, other);
|
||||
GetChatter()->OnEvent(event, entity, other);
|
||||
GetGameState()->OnEvent(event, pEntity, pOther);
|
||||
GetChatter()->OnEvent(event, pEntity, pOther);
|
||||
|
||||
// Morale adjustments happen even for dead players
|
||||
switch (event)
|
||||
@ -61,7 +61,7 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *othe
|
||||
if (!IsAlive())
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
|
||||
// If we just saw a nearby friend die, and we haven't yet acquired an enemy
|
||||
// automatically acquire our dead friend's killer
|
||||
@ -71,7 +71,7 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *othe
|
||||
{
|
||||
if (BotRelationship(pPlayer) == BOT_TEAMMATE)
|
||||
{
|
||||
CBasePlayer *pKiller = static_cast<CBasePlayer *>(other);
|
||||
CBasePlayer *pKiller = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
// check that attacker is an enemy (for friendly fire, etc)
|
||||
if (pKiller && pKiller->IsPlayer())
|
||||
@ -99,174 +99,174 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *othe
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case EVENT_PLAYER_DIED:
|
||||
case EVENT_PLAYER_DIED:
|
||||
{
|
||||
CBasePlayer *pVictim = pPlayer;
|
||||
CBasePlayer *pKiller = (pOther && pOther->IsPlayer()) ? static_cast<CBasePlayer *>(pOther) : nullptr;
|
||||
|
||||
// if the human player died in the single player game, tell the team
|
||||
if (CSGameRules()->IsCareer() && !pVictim->IsBot() && BotRelationship(pVictim) == BOT_TEAMMATE)
|
||||
{
|
||||
CBasePlayer *pVictim = pPlayer;
|
||||
CBasePlayer *pKiller = (other && other->IsPlayer()) ? static_cast<CBasePlayer *>(other) : nullptr;
|
||||
GetChatter()->Say("CommanderDown", 20.0f);
|
||||
}
|
||||
|
||||
// if the human player died in the single player game, tell the team
|
||||
if (CSGameRules()->IsCareer() && !pVictim->IsBot() && BotRelationship(pVictim) == BOT_TEAMMATE)
|
||||
// keep track of the last player we killed
|
||||
if (pKiller == this)
|
||||
{
|
||||
m_lastVictimID = pVictim->entindex();
|
||||
}
|
||||
|
||||
// react to teammate death
|
||||
if (BotRelationship(pVictim) == BOT_TEAMMATE)
|
||||
{
|
||||
// chastise friendly fire from humans
|
||||
if (pKiller && !pKiller->IsBot() && BotRelationship(pKiller) == BOT_TEAMMATE && pKiller != this)
|
||||
{
|
||||
GetChatter()->Say("CommanderDown", 20.0f);
|
||||
GetChatter()->KilledFriend();
|
||||
}
|
||||
|
||||
// keep track of the last player we killed
|
||||
if (pKiller == this)
|
||||
if (IsHunting())
|
||||
{
|
||||
m_lastVictimID = pVictim->entindex();
|
||||
PrintIfWatched("Rethinking hunt due to teammate death\n");
|
||||
Idle();
|
||||
return;
|
||||
}
|
||||
|
||||
// react to teammate death
|
||||
if (BotRelationship(pVictim) == BOT_TEAMMATE)
|
||||
if (IsAttacking())
|
||||
{
|
||||
// chastise friendly fire from humans
|
||||
if (pKiller && !pKiller->IsBot() && BotRelationship(pKiller) == BOT_TEAMMATE && pKiller != this)
|
||||
if (GetTimeSinceLastSawEnemy() > 0.4f)
|
||||
{
|
||||
GetChatter()->KilledFriend();
|
||||
}
|
||||
PrintIfWatched("Rethinking my attack due to teammate death\n");
|
||||
|
||||
if (IsHunting())
|
||||
{
|
||||
PrintIfWatched("Rethinking hunt due to teammate death\n");
|
||||
Idle();
|
||||
// allow us to sneak past windows, doors, etc
|
||||
IgnoreEnemies(1.0f);
|
||||
|
||||
// move to last known position of enemy - this could cause us to flank if
|
||||
// the danger has changed due to our teammate's recent death
|
||||
SetTask(MOVE_TO_LAST_KNOWN_ENEMY_POSITION, GetEnemy());
|
||||
MoveTo(&GetLastKnownEnemyPosition());
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsAttacking())
|
||||
{
|
||||
if (GetTimeSinceLastSawEnemy() > 0.4f)
|
||||
{
|
||||
PrintIfWatched("Rethinking my attack due to teammate death\n");
|
||||
|
||||
// allow us to sneak past windows, doors, etc
|
||||
IgnoreEnemies(1.0f);
|
||||
|
||||
// move to last known position of enemy - this could cause us to flank if
|
||||
// the danger has changed due to our teammate's recent death
|
||||
SetTask(MOVE_TO_LAST_KNOWN_ENEMY_POSITION, GetEnemy());
|
||||
MoveTo(&GetLastKnownEnemyPosition());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// an enemy was killed
|
||||
else
|
||||
}
|
||||
// an enemy was killed
|
||||
else
|
||||
{
|
||||
if (pKiller && BotRelationship(pKiller) == BOT_TEAMMATE)
|
||||
{
|
||||
if (pKiller && BotRelationship(pKiller) == BOT_TEAMMATE)
|
||||
// only chatter about enemy kills if we see them occur, and they were the last one we see
|
||||
if (GetNearbyEnemyCount() <= 1)
|
||||
{
|
||||
// only chatter about enemy kills if we see them occur, and they were the last one we see
|
||||
if (GetNearbyEnemyCount() <= 1)
|
||||
{
|
||||
// report if number of enemies left is few and we killed the last one we saw locally
|
||||
GetChatter()->EnemiesRemaining();
|
||||
// report if number of enemies left is few and we killed the last one we saw locally
|
||||
GetChatter()->EnemiesRemaining();
|
||||
|
||||
if (IsVisible(&pVictim->pev->origin, CHECK_FOV))
|
||||
if (IsVisible(&pVictim->pev->origin, CHECK_FOV))
|
||||
{
|
||||
// congratulate teammates on their kills
|
||||
if (pKiller != this)
|
||||
{
|
||||
// congratulate teammates on their kills
|
||||
if (pKiller != this)
|
||||
float delay = RANDOM_FLOAT(2.0f, 3.0f);
|
||||
if (pKiller->IsBot())
|
||||
{
|
||||
float delay = RANDOM_FLOAT(2.0f, 3.0f);
|
||||
if (pKiller->IsBot())
|
||||
{
|
||||
if (RANDOM_FLOAT(0.0f, 100.0f) < 40.0f)
|
||||
GetChatter()->Say("NiceShot", 3.0f, delay);
|
||||
}
|
||||
if (RANDOM_FLOAT(0.0f, 100.0f) < 40.0f)
|
||||
GetChatter()->Say("NiceShot", 3.0f, delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
// humans get the honorific
|
||||
if (CSGameRules()->IsCareer())
|
||||
GetChatter()->Say("NiceShotCommander", 3.0f, delay);
|
||||
else
|
||||
{
|
||||
// humans get the honorific
|
||||
if (CSGameRules()->IsCareer())
|
||||
GetChatter()->Say("NiceShotCommander", 3.0f, delay);
|
||||
else
|
||||
GetChatter()->Say("NiceShotSir", 3.0f, delay);
|
||||
}
|
||||
GetChatter()->Say("NiceShotSir", 3.0f, delay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case EVENT_TERRORISTS_WIN:
|
||||
if (m_iTeam == TERRORIST)
|
||||
GetChatter()->CelebrateWin();
|
||||
return;
|
||||
case EVENT_CTS_WIN:
|
||||
if (m_iTeam == CT)
|
||||
GetChatter()->CelebrateWin();
|
||||
return;
|
||||
case EVENT_BOMB_DEFUSED:
|
||||
if (m_iTeam == CT && TheCSBots()->GetBombTimeLeft() < 2.0)
|
||||
GetChatter()->Say("BarelyDefused");
|
||||
return;
|
||||
case EVENT_BOMB_PICKED_UP:
|
||||
return;
|
||||
}
|
||||
case EVENT_TERRORISTS_WIN:
|
||||
if (m_iTeam == TERRORIST)
|
||||
GetChatter()->CelebrateWin();
|
||||
return;
|
||||
case EVENT_CTS_WIN:
|
||||
if (m_iTeam == CT)
|
||||
GetChatter()->CelebrateWin();
|
||||
return;
|
||||
case EVENT_BOMB_DEFUSED:
|
||||
if (m_iTeam == CT && TheCSBots()->GetBombTimeLeft() < 2.0)
|
||||
GetChatter()->Say("BarelyDefused");
|
||||
return;
|
||||
case EVENT_BOMB_PICKED_UP:
|
||||
{
|
||||
if (m_iTeam == CT && pPlayer)
|
||||
{
|
||||
if (m_iTeam == CT && pPlayer)
|
||||
// check if we're close enough to hear it
|
||||
const float bombPickupHearRangeSq = 1000.0f * 1000.0f;
|
||||
if ((pev->origin - pPlayer->pev->origin).LengthSquared() < bombPickupHearRangeSq)
|
||||
{
|
||||
// check if we're close enough to hear it
|
||||
const float bombPickupHearRangeSq = 1000.0f * 1000.0f;
|
||||
if ((pev->origin - pPlayer->pev->origin).LengthSquared() < bombPickupHearRangeSq)
|
||||
{
|
||||
GetChatter()->TheyPickedUpTheBomb();
|
||||
}
|
||||
GetChatter()->TheyPickedUpTheBomb();
|
||||
}
|
||||
return;
|
||||
}
|
||||
case EVENT_BOMB_BEEP:
|
||||
return;
|
||||
}
|
||||
case EVENT_BOMB_BEEP:
|
||||
{
|
||||
// if we don't know where the bomb is, but heard it beep, we've discovered it
|
||||
if (GetGameState()->IsPlantedBombLocationKnown() == false)
|
||||
{
|
||||
// if we don't know where the bomb is, but heard it beep, we've discovered it
|
||||
if (GetGameState()->IsPlantedBombLocationKnown() == false)
|
||||
// check if we're close enough to hear it
|
||||
const float bombBeepHearRangeSq = 1000.0f * 1000.0f;
|
||||
if ((pev->origin - pEntity->pev->origin).LengthSquared() < bombBeepHearRangeSq)
|
||||
{
|
||||
// check if we're close enough to hear it
|
||||
const float bombBeepHearRangeSq = 1000.0f * 1000.0f;
|
||||
if ((pev->origin - entity->pev->origin).LengthSquared() < bombBeepHearRangeSq)
|
||||
// radio the news to our team
|
||||
if (m_iTeam == CT && GetGameState()->GetPlantedBombsite() == CSGameState::UNKNOWN)
|
||||
{
|
||||
// radio the news to our team
|
||||
if (m_iTeam == CT && GetGameState()->GetPlantedBombsite() == CSGameState::UNKNOWN)
|
||||
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(&pEntity->pev->origin);
|
||||
if (zone)
|
||||
{
|
||||
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(&entity->pev->origin);
|
||||
if (zone)
|
||||
{
|
||||
GetChatter()->FoundPlantedBomb(zone->m_index);
|
||||
}
|
||||
GetChatter()->FoundPlantedBomb(zone->m_index);
|
||||
}
|
||||
|
||||
// remember where the bomb is
|
||||
GetGameState()->UpdatePlantedBomb(&entity->pev->origin);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
case EVENT_BOMB_PLANTED:
|
||||
{
|
||||
// if we're a CT, forget what we're doing and go after the bomb
|
||||
if (m_iTeam == CT)
|
||||
{
|
||||
Idle();
|
||||
}
|
||||
|
||||
// if we are following someone, stop following
|
||||
if (IsFollowing())
|
||||
{
|
||||
StopFollowing();
|
||||
Idle();
|
||||
// remember where the bomb is
|
||||
GetGameState()->UpdatePlantedBomb(&pEntity->pev->origin);
|
||||
}
|
||||
|
||||
OnEvent(EVENT_BOMB_BEEP, other);
|
||||
return;
|
||||
}
|
||||
case EVENT_BOMB_DEFUSE_ABORTED:
|
||||
PrintIfWatched("BOMB DEFUSE ABORTED\n");
|
||||
return;
|
||||
case EVENT_WEAPON_FIRED:
|
||||
case EVENT_WEAPON_FIRED_ON_EMPTY:
|
||||
case EVENT_WEAPON_RELOADED:
|
||||
return;
|
||||
}
|
||||
case EVENT_BOMB_PLANTED:
|
||||
{
|
||||
// if we're a CT, forget what we're doing and go after the bomb
|
||||
if (m_iTeam == CT)
|
||||
{
|
||||
if (m_enemy == entity && IsUsingKnife())
|
||||
ForceRun(5.0f);
|
||||
break;
|
||||
Idle();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
||||
// if we are following someone, stop following
|
||||
if (IsFollowing())
|
||||
{
|
||||
StopFollowing();
|
||||
Idle();
|
||||
}
|
||||
|
||||
OnEvent(EVENT_BOMB_BEEP, pOther);
|
||||
return;
|
||||
}
|
||||
case EVENT_BOMB_DEFUSE_ABORTED:
|
||||
PrintIfWatched("BOMB DEFUSE ABORTED\n");
|
||||
return;
|
||||
case EVENT_WEAPON_FIRED:
|
||||
case EVENT_WEAPON_FIRED_ON_EMPTY:
|
||||
case EVENT_WEAPON_RELOADED:
|
||||
{
|
||||
if (m_enemy == pEntity && IsUsingKnife())
|
||||
ForceRun(5.0f);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Process radio events from our team
|
||||
@ -288,18 +288,18 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *othe
|
||||
|
||||
if (!IsRogue() && event == EVENT_HOSTAGE_CALLED_FOR_HELP && m_iTeam == CT && IsHunting())
|
||||
{
|
||||
if ((entity->pev->origin - pev->origin).IsLengthGreaterThan(1000.0f))
|
||||
if ((pEntity->pev->origin - pev->origin).IsLengthGreaterThan(1000.0f))
|
||||
return;
|
||||
|
||||
if (IsVisible(&entity->Center()))
|
||||
if (IsVisible(&pEntity->Center()))
|
||||
{
|
||||
m_task = COLLECT_HOSTAGES;
|
||||
m_taskEntity = nullptr;
|
||||
|
||||
Run();
|
||||
m_goalEntity = entity;
|
||||
m_goalEntity = pEntity;
|
||||
|
||||
MoveTo(&entity->pev->origin, m_hostageEscortCount == 0 ? SAFEST_ROUTE : FASTEST_ROUTE);
|
||||
MoveTo(&pEntity->pev->origin, m_hostageEscortCount == 0 ? SAFEST_ROUTE : FASTEST_ROUTE);
|
||||
PrintIfWatched("I'm fetching a hostage that called out to me\n");
|
||||
|
||||
return;
|
||||
@ -314,7 +314,7 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *othe
|
||||
PriorityType priority;
|
||||
bool isHostile;
|
||||
|
||||
if (IsGameEventAudible(event, entity, other, &range, &priority, &isHostile) == false)
|
||||
if (IsGameEventAudible(event, pEntity, pOther, &range, &priority, &isHostile) == false)
|
||||
return;
|
||||
|
||||
if (event == EVENT_HOSTAGE_USED)
|
||||
@ -322,7 +322,7 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *othe
|
||||
if (m_iTeam == CT)
|
||||
return;
|
||||
|
||||
if ((entity->pev->origin - pev->origin).IsLengthGreaterThan(range))
|
||||
if ((pEntity->pev->origin - pev->origin).IsLengthGreaterThan(range))
|
||||
return;
|
||||
|
||||
GetChatter()->HostagesBeingTaken();
|
||||
|
@ -33,20 +33,20 @@ const float updateTimesliceDuration = 0.5f;
|
||||
int _navAreaCount = 0;
|
||||
int _currentIndex = 0;
|
||||
|
||||
inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirType mountDir)
|
||||
inline CNavNode *LadderEndSearch(CBaseEntity *pEntity, const Vector *pos, NavDirType mountDir)
|
||||
{
|
||||
Vector center = *pos;
|
||||
AddDirectionVector(¢er, mountDir, HalfHumanWidth);
|
||||
|
||||
// Test the ladder dismount point first, then each cardinal direction one and two steps away
|
||||
for (int d = (-1); d < 2 * NUM_DIRECTIONS; ++d)
|
||||
for (int dir = (-1); dir < 2 * NUM_DIRECTIONS; dir++)
|
||||
{
|
||||
Vector tryPos = center;
|
||||
|
||||
if (d >= NUM_DIRECTIONS)
|
||||
AddDirectionVector(&tryPos, (NavDirType)(d - NUM_DIRECTIONS), GenerationStepSize * 2.0f);
|
||||
else if (d >= 0)
|
||||
AddDirectionVector(&tryPos, (NavDirType)d, GenerationStepSize);
|
||||
if (dir >= NUM_DIRECTIONS)
|
||||
AddDirectionVector(&tryPos, (NavDirType)(dir - NUM_DIRECTIONS), GenerationStepSize * 2.0f);
|
||||
else if (dir >= 0)
|
||||
AddDirectionVector(&tryPos, (NavDirType)dir, GenerationStepSize);
|
||||
|
||||
// step up a rung, to ensure adjacent floors are below us
|
||||
tryPos.z += GenerationStepSize;
|
||||
@ -60,7 +60,7 @@ inline CNavNode *LadderEndSearch(CBaseEntity *entity, const Vector *pos, NavDirT
|
||||
// make sure this point is not on the other side of a wall
|
||||
const float fudge = 2.0f;
|
||||
TraceResult result;
|
||||
UTIL_TraceLine(center + Vector(0, 0, fudge), tryPos + Vector(0, 0, fudge), ignore_monsters, dont_ignore_glass, ENT(entity->pev), &result);
|
||||
UTIL_TraceLine(center + Vector(0, 0, fudge), tryPos + Vector(0, 0, fudge), ignore_monsters, dont_ignore_glass, ENT(pEntity->pev), &result);
|
||||
|
||||
if (result.flFraction != 1.0f
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|
@ -104,6 +104,10 @@ CCSBotManager::CCSBotManager()
|
||||
{
|
||||
TheBotPhrases->Initialize((*pVoiceBanks)[i], i);
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
AddServerCommands();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Invoked when a new round begins
|
||||
@ -182,27 +186,27 @@ bool CCSBotManager::IsWeaponUseable(CBasePlayerItem *item) const
|
||||
}
|
||||
|
||||
// Return true if this player is on "defense"
|
||||
bool CCSBotManager::IsOnDefense(CBasePlayer *player) const
|
||||
bool CCSBotManager::IsOnDefense(CBasePlayer *pPlayer) const
|
||||
{
|
||||
switch (GetScenario())
|
||||
{
|
||||
case SCENARIO_DEFUSE_BOMB:
|
||||
return (player->m_iTeam == CT);
|
||||
case SCENARIO_DEFUSE_BOMB:
|
||||
return (pPlayer->m_iTeam == CT);
|
||||
|
||||
case SCENARIO_RESCUE_HOSTAGES:
|
||||
return (player->m_iTeam == TERRORIST);
|
||||
case SCENARIO_RESCUE_HOSTAGES:
|
||||
return (pPlayer->m_iTeam == TERRORIST);
|
||||
|
||||
case SCENARIO_ESCORT_VIP:
|
||||
return (player->m_iTeam == TERRORIST);
|
||||
case SCENARIO_ESCORT_VIP:
|
||||
return (pPlayer->m_iTeam == TERRORIST);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true if this player is on "offense"
|
||||
bool CCSBotManager::IsOnOffense(CBasePlayer *player) const
|
||||
bool CCSBotManager::IsOnOffense(CBasePlayer *pPlayer) const
|
||||
{
|
||||
return !IsOnDefense(player);
|
||||
return !IsOnDefense(pPlayer);
|
||||
}
|
||||
|
||||
// Invoked when a map has just been loaded
|
||||
@ -221,7 +225,10 @@ void CCSBotManager::ServerActivate()
|
||||
m_isAnalysisRequested = false;
|
||||
|
||||
m_bServerActive = true;
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
AddServerCommands();
|
||||
#endif
|
||||
|
||||
TheBotPhrases->OnMapChange();
|
||||
}
|
||||
@ -266,7 +273,6 @@ void CCSBotManager::AddServerCommands()
|
||||
AddServerCommand("bot_nav_crouch");
|
||||
AddServerCommand("bot_nav_jump");
|
||||
AddServerCommand("bot_nav_precise");
|
||||
AddServerCommand("bot_nav_walk");
|
||||
AddServerCommand("bot_nav_no_jump");
|
||||
AddServerCommand("bot_nav_analyze");
|
||||
AddServerCommand("bot_nav_strip");
|
||||
@ -299,8 +305,8 @@ void CCSBotManager::ClientDisconnect(CBasePlayer *pPlayer)
|
||||
|
||||
auto pevTemp = VARS(pPlayer->edict());
|
||||
|
||||
CCSBot *bot = reinterpret_cast<CCSBot *>(pPlayer);
|
||||
bot->Disconnect();
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
pBot->Disconnect();
|
||||
|
||||
if (!FStringNull(pPlayer->pev->classname))
|
||||
{
|
||||
@ -309,9 +315,9 @@ void CCSBotManager::ClientDisconnect(CBasePlayer *pPlayer)
|
||||
|
||||
FREE_PRIVATE(pPlayer->edict());
|
||||
|
||||
auto player = GetClassPtr<CCSPlayer>((CBasePlayer *)pevTemp);
|
||||
AddEntityHashValue(player->pev, STRING(player->pev->classname), CLASSNAME);
|
||||
player->pev->flags = FL_DORMANT;
|
||||
pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pevTemp);
|
||||
AddEntityHashValue(pPlayer->pev, STRING(pPlayer->pev->classname), CLASSNAME);
|
||||
pPlayer->pev->flags = FL_DORMANT;
|
||||
}
|
||||
|
||||
void PrintAllEntities()
|
||||
@ -337,7 +343,14 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
|
||||
if (FStrEq(pcmd, "bot_about"))
|
||||
{
|
||||
Q_sprintf(buffer, "\n--------------------------------------------------------------------------\nThe Official Counter-Strike Bot V%d.%02d\nCreated by Michael S. Booth\nWeb: www.turtlerockstudios.com\\csbot\nE-mail: csbot@turtlerockstudios.com\n--------------------------------------------------------------------------\n\n", BOT_VERSION_MAJOR, BOT_VERSION_MINOR);
|
||||
Q_snprintf(buffer, sizeof(buffer),
|
||||
"\n--------------------------------------------------------------------------\n"
|
||||
"The Official Counter-Strike Bot V%d.%02d\n"
|
||||
"Created by Michael S. Booth\n"
|
||||
"Web: www.turtlerockstudios.com\\csbot\n"
|
||||
"E-mail: csbot@turtlerockstudios.com\n"
|
||||
"--------------------------------------------------------------------------\n\n", BOT_VERSION_MAJOR, BOT_VERSION_MINOR);
|
||||
|
||||
CONSOLE_ECHO(buffer);
|
||||
HintMessageToAllPlayers(buffer);
|
||||
}
|
||||
@ -522,10 +535,6 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
{
|
||||
m_editCmd = EDIT_ATTRIB_PRECISE;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_walk"))
|
||||
{
|
||||
m_editCmd = EDIT_ATTRIB_WALK;
|
||||
}
|
||||
else if (FStrEq(pcmd, "bot_nav_no_jump"))
|
||||
{
|
||||
m_editCmd = EDIT_ATTRIB_NO_JUMP;
|
||||
@ -641,17 +650,17 @@ void CCSBotManager::ServerCommand(const char *pcmd)
|
||||
if (!pEntity->IsPlayer())
|
||||
continue;
|
||||
|
||||
if ((pEntity->pev->flags & FL_DORMANT) == FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *playerOrBot = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
if (playerOrBot->IsBot())
|
||||
{
|
||||
CCSBot *bot = static_cast<CCSBot *>(playerOrBot);
|
||||
if (bot)
|
||||
CCSBot *pBot = static_cast<CCSBot *>(playerOrBot);
|
||||
if (pBot)
|
||||
{
|
||||
bot->MoveTo(&area->m_center, FASTEST_ROUTE);
|
||||
pBot->MoveTo(&area->m_center, FASTEST_ROUTE);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -1271,7 +1280,7 @@ CNavArea *CCSBotManager::GetRandomAreaInZone(const Zone *zone) const
|
||||
return zone->m_area[RANDOM_LONG(0, zone->m_areaCount - 1)];
|
||||
}
|
||||
|
||||
void CCSBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSBotManager::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
@ -1281,7 +1290,7 @@ void CCSBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntit
|
||||
break;
|
||||
|
||||
case EVENT_BOMB_DEFUSING:
|
||||
m_bombDefuser = (CBasePlayer *)entity;
|
||||
m_bombDefuser = static_cast<CBasePlayer *>(pEntity);
|
||||
break;
|
||||
|
||||
case EVENT_BOMB_DEFUSE_ABORTED:
|
||||
@ -1308,7 +1317,7 @@ void CCSBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntit
|
||||
break;
|
||||
}
|
||||
|
||||
CBotManager::OnEvent(event, entity, other);
|
||||
CBotManager::OnEvent(event, pEntity, pOther);
|
||||
}
|
||||
|
||||
// Get the time remaining before the planted bomb explodes
|
||||
@ -1332,13 +1341,13 @@ void CCSBotManager::SetLooseBomb(CBaseEntity *bomb)
|
||||
}
|
||||
|
||||
// Return true if player is important to scenario (VIP, bomb carrier, etc)
|
||||
bool CCSBotManager::IsImportantPlayer(CBasePlayer *player) const
|
||||
bool CCSBotManager::IsImportantPlayer(CBasePlayer *pPlayer) const
|
||||
{
|
||||
switch (GetScenario())
|
||||
{
|
||||
case SCENARIO_DEFUSE_BOMB:
|
||||
{
|
||||
if (player->m_iTeam == TERRORIST && player->IsBombGuy())
|
||||
if (pPlayer->m_iTeam == TERRORIST && pPlayer->IsBombGuy())
|
||||
return true;
|
||||
|
||||
// TODO: TEAM_CT's defusing the bomb are important
|
||||
@ -1346,7 +1355,7 @@ bool CCSBotManager::IsImportantPlayer(CBasePlayer *player) const
|
||||
}
|
||||
case SCENARIO_ESCORT_VIP:
|
||||
{
|
||||
if (player->m_iTeam == CT && player->m_bIsVIP)
|
||||
if (pPlayer->m_iTeam == CT && pPlayer->m_bIsVIP)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -1363,50 +1372,50 @@ bool CCSBotManager::IsImportantPlayer(CBasePlayer *player) const
|
||||
}
|
||||
|
||||
// Return priority of player (0 = max pri)
|
||||
unsigned int CCSBotManager::GetPlayerPriority(CBasePlayer *player) const
|
||||
unsigned int CCSBotManager::GetPlayerPriority(CBasePlayer *pPlayer) const
|
||||
{
|
||||
const unsigned int lowestPriority = 0xFFFFFFFF;
|
||||
|
||||
if (!player->IsPlayer())
|
||||
if (!pPlayer->IsPlayer())
|
||||
return lowestPriority;
|
||||
|
||||
// human players have highest priority
|
||||
if (!player->IsBot())
|
||||
if (!pPlayer->IsBot())
|
||||
return 0;
|
||||
|
||||
CCSBot *bot = reinterpret_cast<CCSBot *>(player);
|
||||
CCSBot *pBot = static_cast<CCSBot *>(pPlayer);
|
||||
|
||||
// bots doing something important for the current scenario have high priority
|
||||
switch (GetScenario())
|
||||
{
|
||||
case SCENARIO_DEFUSE_BOMB:
|
||||
{
|
||||
// the bomb carrier has high priority
|
||||
if (bot->m_iTeam == TERRORIST && bot->m_bHasC4)
|
||||
return 1;
|
||||
case SCENARIO_DEFUSE_BOMB:
|
||||
{
|
||||
// the bomb carrier has high priority
|
||||
if (pBot->m_iTeam == TERRORIST && pBot->m_bHasC4)
|
||||
return 1;
|
||||
|
||||
break;
|
||||
}
|
||||
case SCENARIO_ESCORT_VIP:
|
||||
{
|
||||
// the VIP has high priority
|
||||
if (bot->m_iTeam == CT && bot->m_bIsVIP)
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
case SCENARIO_ESCORT_VIP:
|
||||
{
|
||||
// the VIP has high priority
|
||||
if (pBot->m_iTeam == CT && pBot->m_bIsVIP)
|
||||
return 1;
|
||||
|
||||
break;
|
||||
}
|
||||
case SCENARIO_RESCUE_HOSTAGES:
|
||||
{
|
||||
// TEAM_CT's rescuing hostages have high priority
|
||||
if (bot->m_iTeam == CT && bot->GetHostageEscortCount())
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
case SCENARIO_RESCUE_HOSTAGES:
|
||||
{
|
||||
// TEAM_CT's rescuing hostages have high priority
|
||||
if (pBot->m_iTeam == CT && pBot->GetHostageEscortCount())
|
||||
return 1;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// everyone else is ranked by their unique ID (which cannot be zero)
|
||||
return 1 + bot->GetID();
|
||||
return 1 + pBot->GetID();
|
||||
}
|
||||
|
||||
// Return the last time the given radio message was sent for given team
|
||||
|
@ -51,9 +51,9 @@ public:
|
||||
virtual void RestartRound(); // (EXTEND) invoked when a new round begins
|
||||
virtual void StartFrame(); // (EXTEND) called each frame
|
||||
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *entity = nullptr, CBaseEntity *other = nullptr);
|
||||
virtual unsigned int GetPlayerPriority(CBasePlayer *player) const; // return priority of player (0 = max pri)
|
||||
virtual bool IsImportantPlayer(CBasePlayer *player) const; // return true if player is important to scenario (VIP, bomb carrier, etc)
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr);
|
||||
virtual unsigned int GetPlayerPriority(CBasePlayer *pPlayer) const; // return priority of pPlayer (0 = max pri)
|
||||
virtual bool IsImportantPlayer(CBasePlayer *pPlayer) const; // return true if pPlayer is important to scenario (VIP, bomb carrier, etc)
|
||||
|
||||
public:
|
||||
void ValidateMapData();
|
||||
@ -117,7 +117,7 @@ public:
|
||||
const Zone *GetZone(int i) const { return &m_zone[i]; }
|
||||
const Zone *GetZone(const Vector *pos) const; // return the zone that contains the given position
|
||||
const Zone *GetClosestZone(const Vector *pos) const; // return the closest zone to the given position
|
||||
const Zone *GetClosestZone(const CBaseEntity *entity) const { return GetClosestZone(&entity->pev->origin); } // return the closest zone to the given entity
|
||||
const Zone *GetClosestZone(const CBaseEntity *pEntity) const { return GetClosestZone(&pEntity->pev->origin); } // return the closest zone to the given entity
|
||||
int GetZoneCount() const { return m_zoneCount; }
|
||||
|
||||
const Vector *GetRandomPositionInZone(const Zone *zone) const;
|
||||
@ -139,9 +139,9 @@ public:
|
||||
continue;
|
||||
|
||||
// just use the first overlapping nav area as a reasonable approximation
|
||||
float_precision dist = NavAreaTravelDistance(startArea, m_zone[i].m_area[0], costFunc);
|
||||
real_t dist = NavAreaTravelDistance(startArea, m_zone[i].m_area[0], costFunc);
|
||||
|
||||
if (/*dist >= 0.0f && */dist < closeDist)
|
||||
if (dist >= 0.0f && dist < closeDist)
|
||||
{
|
||||
closeZone = &m_zone[i];
|
||||
closeDist = dist;
|
||||
@ -180,25 +180,25 @@ public:
|
||||
float GetLastSeenEnemyTimestamp() const { return m_lastSeenEnemyTimestamp; } // return the last time anyone has seen an enemy
|
||||
void SetLastSeenEnemyTimestamp() { m_lastSeenEnemyTimestamp = gpGlobals->time; }
|
||||
|
||||
float GetRoundStartTime() const { return m_roundStartTimestamp; }
|
||||
float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began
|
||||
float GetRoundStartTime() const { return m_roundStartTimestamp; }
|
||||
float GetElapsedRoundTime() const { return gpGlobals->time - m_roundStartTimestamp; } // return the elapsed time since the current round began
|
||||
|
||||
bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; }
|
||||
bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; }
|
||||
bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; }
|
||||
bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; }
|
||||
bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; }
|
||||
bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; }
|
||||
bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; }
|
||||
bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; }
|
||||
bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; }
|
||||
bool AllowRogues() const { return cv_bot_allow_rogues.value != 0.0f; }
|
||||
bool AllowPistols() const { return cv_bot_allow_pistols.value != 0.0f; }
|
||||
bool AllowShotguns() const { return cv_bot_allow_shotguns.value != 0.0f; }
|
||||
bool AllowSubMachineGuns() const { return cv_bot_allow_sub_machine_guns.value != 0.0f; }
|
||||
bool AllowRifles() const { return cv_bot_allow_rifles.value != 0.0f; }
|
||||
bool AllowMachineGuns() const { return cv_bot_allow_machine_guns.value != 0.0f; }
|
||||
bool AllowGrenades() const { return cv_bot_allow_grenades.value != 0.0f; }
|
||||
bool AllowSnipers() const { return cv_bot_allow_snipers.value != 0.0f; }
|
||||
bool AllowTacticalShield() const { return cv_bot_allow_shield.value != 0.0f; }
|
||||
bool AllowFriendlyFireDamage() const { return friendlyfire.value != 0.0f; }
|
||||
|
||||
bool IsWeaponUseable(CBasePlayerItem *item) const; // return true if the bot can use this weapon
|
||||
|
||||
bool IsDefenseRushing() const { return m_isDefenseRushing; } // returns true if defense team has "decided" to rush this round
|
||||
bool IsOnDefense(CBasePlayer *player) const; // return true if this player is on "defense"
|
||||
bool IsOnOffense(CBasePlayer *player) const; // return true if this player is on "offense"
|
||||
bool IsOnDefense(CBasePlayer *pPlayer) const; // return true if this player is on "defense"
|
||||
bool IsOnOffense(CBasePlayer *pPlayer) const; // return true if this player is on "offense"
|
||||
|
||||
bool IsRoundOver() const { return m_isRoundOver; } // return true if the round has ended
|
||||
|
||||
|
@ -129,7 +129,7 @@ bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump)
|
||||
if (m_isJumpCrouching)
|
||||
return false;
|
||||
|
||||
float_precision dz = ground - GetFeetZ();
|
||||
real_t dz = ground - GetFeetZ();
|
||||
|
||||
if (dz > StepHeight && !onlyJumpDown)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ bool CCSBot::ComputePathPositions()
|
||||
for (int i = 1; i < m_pathLength; i++)
|
||||
{
|
||||
const ConnectInfo *from = &m_path[i - 1];
|
||||
ConnectInfo *to = &m_path[i ];
|
||||
ConnectInfo *to = &m_path[i];
|
||||
|
||||
// walk along the floor to the next area
|
||||
if (to->how <= GO_WEST)
|
||||
@ -669,11 +669,11 @@ int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
|
||||
Vector eyes = feet + Vector(0, 0, HalfHumanHeight); // in case we're crouching
|
||||
Vector pos;
|
||||
const Vector *from, *to;
|
||||
float_precision length;
|
||||
real_t length;
|
||||
float closeLength;
|
||||
float closeDistSq = 9999999999.9;
|
||||
int closeIndex = -1;
|
||||
float_precision distSq;
|
||||
real_t distSq;
|
||||
|
||||
int start, end;
|
||||
|
||||
@ -1085,7 +1085,7 @@ float CCSBot::GetApproximateFallDamage(float height) const
|
||||
const float slope = 0.2178f;
|
||||
const float intercept = 26.0f;
|
||||
|
||||
float_precision damage = slope * height - intercept;
|
||||
real_t damage = slope * height - intercept;
|
||||
|
||||
if (damage < 0.0f)
|
||||
return 0.0f;
|
||||
@ -1116,26 +1116,26 @@ bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
|
||||
// check if any friends are overlapping this linear path
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
// ignore enemies
|
||||
if (BotRelationship(player) == BOT_ENEMY)
|
||||
if (BotRelationship(pPlayer) == BOT_ENEMY)
|
||||
continue;
|
||||
|
||||
if (player == this)
|
||||
if (pPlayer == this)
|
||||
continue;
|
||||
|
||||
// compute vector from us to our friend
|
||||
Vector toFriend = player->pev->origin - pev->origin;
|
||||
Vector toFriend = pPlayer->pev->origin - pev->origin;
|
||||
|
||||
// check if friend is in our "personal space"
|
||||
const float personalSpace = 100.0f;
|
||||
@ -1158,7 +1158,7 @@ bool CCSBot::IsFriendInTheWay(const Vector *goalPos) const
|
||||
|
||||
// check if friend overlaps our intended line of movement
|
||||
const float friendRadius = 30.0f;
|
||||
if ((pos - player->pev->origin).IsLengthLessThan(friendRadius))
|
||||
if ((pos - pPlayer->pev->origin).IsLengthLessThan(friendRadius))
|
||||
{
|
||||
// friend is in our personal space and overlaps our intended line of movement
|
||||
m_isFriendInTheWay = true;
|
||||
@ -1393,29 +1393,6 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange)
|
||||
StandUp();
|
||||
}
|
||||
// end crouching logic
|
||||
|
||||
// Walking
|
||||
bool didWalk = false;
|
||||
for (int i = prevIndex; i < m_pathLength; ++i)
|
||||
{
|
||||
const CNavArea *to = m_path[i].area;
|
||||
|
||||
Vector close;
|
||||
to->GetClosestPointOnArea(&pev->origin, &close);
|
||||
|
||||
if ((close - pev->origin).Make2D().IsLengthGreaterThan(crouchRange))
|
||||
break;
|
||||
|
||||
if (to->GetAttributes() & NAV_WALK)
|
||||
{
|
||||
Walk();
|
||||
didWalk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!didWalk)
|
||||
Run();
|
||||
}
|
||||
|
||||
// compute our forward facing angle
|
||||
|
@ -260,7 +260,7 @@ bool CCSBot::RespondToHelpRequest(CBasePlayer *them, Place place, float maxRange
|
||||
{
|
||||
// compute actual travel distance
|
||||
PathCost pc(this);
|
||||
float_precision travelDistance = NavAreaTravelDistance(m_lastKnownArea, TheNavAreaGrid.GetNearestNavArea(&them->pev->origin), pc);
|
||||
real_t travelDistance = NavAreaTravelDistance(m_lastKnownArea, TheNavAreaGrid.GetNearestNavArea(&them->pev->origin), pc);
|
||||
if (travelDistance < 0.0f)
|
||||
return false;
|
||||
|
||||
|
@ -58,20 +58,20 @@ void CCSBot::EscapeFromBomb()
|
||||
SetState(&m_escapeFromBombState);
|
||||
}
|
||||
|
||||
void CCSBot::Follow(CBasePlayer *player)
|
||||
void CCSBot::Follow(CBasePlayer *pPlayer)
|
||||
{
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
return;
|
||||
|
||||
// note when we began following
|
||||
if (!m_isFollowing || m_leader != player)
|
||||
if (!m_isFollowing || m_leader != pPlayer)
|
||||
m_followTimestamp = gpGlobals->time;
|
||||
|
||||
m_isFollowing = true;
|
||||
m_leader = player;
|
||||
m_leader = pPlayer;
|
||||
|
||||
SetTask(FOLLOW);
|
||||
m_followState.SetLeader(player);
|
||||
m_followState.SetLeader(pPlayer);
|
||||
SetState(&m_followState);
|
||||
}
|
||||
|
||||
@ -98,9 +98,9 @@ void CCSBot::RescueHostages()
|
||||
}
|
||||
|
||||
// Use the entity
|
||||
void CCSBot::UseEntity(CBaseEntity *entity)
|
||||
void CCSBot::UseEntity(CBaseEntity *pEntity)
|
||||
{
|
||||
m_useEntityState.SetEntity(entity);
|
||||
m_useEntityState.SetEntity(pEntity);
|
||||
SetState(&m_useEntityState);
|
||||
}
|
||||
|
||||
@ -322,9 +322,9 @@ void CCSBot::Attack(CBasePlayer *victim)
|
||||
Vector idealAngle = UTIL_VecToAngles(toEnemy);
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
float_precision deltaYaw = float_precision(Q_abs(m_lookYaw - idealAngle.y));
|
||||
real_t deltaYaw = real_t(Q_abs(m_lookYaw - idealAngle.y));
|
||||
#else
|
||||
float_precision deltaYaw = float_precision(Q_abs(int64(m_lookYaw - idealAngle.y)));
|
||||
real_t deltaYaw = real_t(Q_abs(int64(m_lookYaw - idealAngle.y)));
|
||||
#endif
|
||||
|
||||
while (deltaYaw > 180.0f)
|
||||
|
@ -659,17 +659,17 @@ void CCSBot::Update()
|
||||
// chance of following is proportional to teamwork attribute
|
||||
if (GetProfile()->GetTeamwork() > RANDOM_FLOAT(0.0f, 1.0f))
|
||||
{
|
||||
CBasePlayer *leader = GetClosestVisibleHumanFriend();
|
||||
if (leader && leader->IsAutoFollowAllowed())
|
||||
CBasePlayer *pLeader = GetClosestVisibleHumanFriend();
|
||||
if (pLeader && pLeader->IsAutoFollowAllowed())
|
||||
{
|
||||
// count how many bots are already following this player
|
||||
const float maxFollowCount = 2;
|
||||
if (GetBotFollowCount(leader) < maxFollowCount)
|
||||
if (GetBotFollowCount(pLeader) < maxFollowCount)
|
||||
{
|
||||
const float autoFollowRange = 300.0f;
|
||||
if ((leader->pev->origin - pev->origin).IsLengthLessThan(autoFollowRange))
|
||||
if ((pLeader->pev->origin - pev->origin).IsLengthLessThan(autoFollowRange))
|
||||
{
|
||||
CNavArea *leaderArea = TheNavAreaGrid.GetNavArea(&leader->pev->origin);
|
||||
CNavArea *leaderArea = TheNavAreaGrid.GetNavArea(&pLeader->pev->origin);
|
||||
if (leaderArea)
|
||||
{
|
||||
PathCost cost(this, FASTEST_ROUTE);
|
||||
@ -677,8 +677,8 @@ void CCSBot::Update()
|
||||
if (/*travelRange >= 0.0f &&*/ travelRange < autoFollowRange)
|
||||
{
|
||||
// follow this human
|
||||
Follow(leader);
|
||||
PrintIfWatched("Auto-Following %s\n", STRING(leader->pev->netname));
|
||||
Follow(pLeader);
|
||||
PrintIfWatched("Auto-Following %s\n", STRING(pLeader->pev->netname));
|
||||
|
||||
if (CSGameRules()->IsCareer())
|
||||
{
|
||||
|
@ -247,9 +247,9 @@ bool CCSBot::IsVisible(const Vector *pos, bool testFOV) const
|
||||
|
||||
// Return true if we can see any part of the player
|
||||
// Check parts in order of importance. Return the first part seen in "visParts" if it is non-NULL.
|
||||
bool CCSBot::IsVisible(CBasePlayer *player, bool testFOV, unsigned char *visParts) const
|
||||
bool CCSBot::IsVisible(CBasePlayer *pPlayer, bool testFOV, unsigned char *visParts) const
|
||||
{
|
||||
Vector spot = player->pev->origin;
|
||||
Vector spot = pPlayer->pev->origin;
|
||||
unsigned char testVisParts = NONE;
|
||||
|
||||
// finish chest check
|
||||
@ -266,10 +266,10 @@ bool CCSBot::IsVisible(CBasePlayer *player, bool testFOV, unsigned char *visPart
|
||||
const float standFeet = 34.0f;
|
||||
const float crouchFeet = 14.0f;
|
||||
|
||||
if (player->pev->flags & FL_DUCKING)
|
||||
spot.z = player->pev->origin.z - crouchFeet;
|
||||
if (pPlayer->pev->flags & FL_DUCKING)
|
||||
spot.z = pPlayer->pev->origin.z - crouchFeet;
|
||||
else
|
||||
spot.z = player->pev->origin.z - standFeet;
|
||||
spot.z = pPlayer->pev->origin.z - standFeet;
|
||||
|
||||
// check feet
|
||||
if (IsVisible(&spot, testFOV))
|
||||
@ -277,17 +277,17 @@ bool CCSBot::IsVisible(CBasePlayer *player, bool testFOV, unsigned char *visPart
|
||||
|
||||
// check "edges"
|
||||
const float edgeOffset = 13.0f;
|
||||
Vector2D dir = (player->pev->origin - pev->origin).Make2D();
|
||||
Vector2D dir = (pPlayer->pev->origin - pev->origin).Make2D();
|
||||
dir.NormalizeInPlace();
|
||||
|
||||
Vector2D perp(-dir.y, dir.x);
|
||||
|
||||
spot = player->pev->origin + Vector(perp.x * edgeOffset, perp.y * edgeOffset, 0);
|
||||
spot = pPlayer->pev->origin + Vector(perp.x * edgeOffset, perp.y * edgeOffset, 0);
|
||||
|
||||
if (IsVisible(&spot, testFOV))
|
||||
testVisParts |= LEFT_SIDE;
|
||||
|
||||
spot = player->pev->origin - Vector(perp.x * edgeOffset, perp.y * edgeOffset, 0);
|
||||
spot = pPlayer->pev->origin - Vector(perp.x * edgeOffset, perp.y * edgeOffset, 0);
|
||||
|
||||
if (IsVisible(&spot, testFOV))
|
||||
testVisParts |= RIGHT_SIDE;
|
||||
@ -497,7 +497,7 @@ void CCSBot::UpdateLookAround(bool updateNow)
|
||||
// TODO: Use skill parameter instead of accuracy
|
||||
|
||||
// lower skills have exponentially longer delays
|
||||
float_precision asleep = (1.0f - GetProfile()->GetSkill());
|
||||
real_t asleep = (1.0f - GetProfile()->GetSkill());
|
||||
asleep *= asleep;
|
||||
asleep *= asleep;
|
||||
|
||||
@ -505,7 +505,8 @@ void CCSBot::UpdateLookAround(bool updateNow)
|
||||
|
||||
// figure out how far along the path segment we are
|
||||
Vector delta = m_spotEncounter->path.to - m_spotEncounter->path.from;
|
||||
float_precision length = delta.Length();
|
||||
real_t length = delta.Length();
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
float adx = Q_abs(delta.x);
|
||||
float ady = Q_abs(delta.y);
|
||||
@ -513,7 +514,7 @@ void CCSBot::UpdateLookAround(bool updateNow)
|
||||
float adx = float(Q_abs(int64(delta.x)));
|
||||
float ady = float(Q_abs(int64(delta.y)));
|
||||
#endif
|
||||
float_precision t;
|
||||
real_t t;
|
||||
|
||||
if (adx > ady)
|
||||
t = (pev->origin.x - m_spotEncounter->path.from.x) / delta.x;
|
||||
@ -693,51 +694,51 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
||||
{
|
||||
for (i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
// is it a player?
|
||||
if (!player->IsPlayer())
|
||||
if (!pPlayer->IsPlayer())
|
||||
continue;
|
||||
|
||||
// ignore self
|
||||
if (player->entindex() == entindex())
|
||||
if (pPlayer->entindex() == entindex())
|
||||
continue;
|
||||
|
||||
// is it alive?
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
// is it an enemy?
|
||||
if (BotRelationship(player) == BOT_TEAMMATE)
|
||||
if (BotRelationship(pPlayer) == BOT_TEAMMATE)
|
||||
{
|
||||
TraceResult result;
|
||||
UTIL_TraceLine(GetEyePosition(), player->pev->origin, ignore_monsters, ignore_glass, edict(), &result);
|
||||
UTIL_TraceLine(GetEyePosition(), pPlayer->pev->origin, ignore_monsters, ignore_glass, edict(), &result);
|
||||
if (result.flFraction == 1.0f)
|
||||
{
|
||||
// update watch timestamp
|
||||
int idx = player->entindex() - 1;
|
||||
int idx = pPlayer->entindex() - 1;
|
||||
m_watchInfo[idx].timestamp = gpGlobals->time;
|
||||
m_watchInfo[idx].isEnemy = false;
|
||||
|
||||
// keep track of our closest friend
|
||||
Vector to = pev->origin - player->pev->origin;
|
||||
Vector to = pev->origin - pPlayer->pev->origin;
|
||||
float rangeSq = to.LengthSquared();
|
||||
if (rangeSq < closeFriendRange)
|
||||
{
|
||||
m_closestVisibleFriend = player;
|
||||
m_closestVisibleFriend = pPlayer;
|
||||
closeFriendRange = rangeSq;
|
||||
}
|
||||
|
||||
// keep track of our closest human friend
|
||||
if (!player->IsBot() && rangeSq < closeHumanFriendRange)
|
||||
if (!pPlayer->IsBot() && rangeSq < closeHumanFriendRange)
|
||||
{
|
||||
m_closestVisibleHumanFriend = player;
|
||||
m_closestVisibleHumanFriend = pPlayer;
|
||||
closeHumanFriendRange = rangeSq;
|
||||
}
|
||||
}
|
||||
@ -747,14 +748,14 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
||||
|
||||
// check if this enemy is fully
|
||||
unsigned char visParts;
|
||||
if (!IsVisible(player, CHECK_FOV, &visParts))
|
||||
if (!IsVisible(pPlayer, CHECK_FOV, &visParts))
|
||||
continue;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// do we notice this enemy? (always notice current enemy)
|
||||
if (player != currentThreat)
|
||||
if (pPlayer != currentThreat)
|
||||
{
|
||||
if (!IsNoticable(player, visParts))
|
||||
if (!IsNoticable(pPlayer, visParts))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -762,24 +763,24 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
||||
#endif
|
||||
|
||||
// update watch timestamp
|
||||
int idx = player->entindex() - 1;
|
||||
int idx = pPlayer->entindex() - 1;
|
||||
m_watchInfo[idx].timestamp = gpGlobals->time;
|
||||
m_watchInfo[idx].isEnemy = true;
|
||||
|
||||
// note if we see the bomber
|
||||
if (player->IsBombGuy())
|
||||
if (pPlayer->IsBombGuy())
|
||||
{
|
||||
m_bomber = player;
|
||||
m_bomber = pPlayer;
|
||||
}
|
||||
|
||||
// keep track of all visible threats
|
||||
Vector d = pev->origin - player->pev->origin;
|
||||
Vector d = pev->origin - pPlayer->pev->origin;
|
||||
float distSq = d.LengthSquared();
|
||||
|
||||
// maintain set of visible threats, sorted by increasing distance
|
||||
if (threatCount == 0)
|
||||
{
|
||||
threat[0].enemy = player;
|
||||
threat[0].enemy = pPlayer;
|
||||
threat[0].range = distSq;
|
||||
threatCount = 1;
|
||||
}
|
||||
@ -794,11 +795,11 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
||||
}
|
||||
|
||||
// shift lower half down a notch
|
||||
for (int k = threatCount - 1; k >= j; --k)
|
||||
for (int k = threatCount - 1; k >= j; k--)
|
||||
threat[k + 1] = threat[k];
|
||||
|
||||
// insert threat into sorted list
|
||||
threat[j].enemy = player;
|
||||
threat[j].enemy = pPlayer;
|
||||
threat[j].range = distSq;
|
||||
|
||||
if (threatCount < MAX_THREATS)
|
||||
@ -857,11 +858,11 @@ CBasePlayer *CCSBot::FindMostDangerousThreat()
|
||||
{
|
||||
// find the area the player/bot is standing on
|
||||
CNavArea *area;
|
||||
CCSBot *bot = reinterpret_cast<CCSBot *>(threat[i].enemy);
|
||||
CCSBot *pBot = static_cast<CCSBot *>(threat[i].enemy);
|
||||
|
||||
if (bot->IsBot())
|
||||
if (pBot->IsBot())
|
||||
{
|
||||
area = bot->GetLastKnownArea();
|
||||
area = pBot->GetLastKnownArea();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1071,7 +1072,7 @@ void CCSBot::Blind(float duration, float holdTime, float fadeTime, int alpha)
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
bool CCSBot::IsNoticable(const CBasePlayer *player, unsigned char visibleParts) const
|
||||
bool CCSBot::IsNoticable(const CBasePlayer *pPlayer, unsigned char visibleParts) const
|
||||
{
|
||||
float deltaT = m_attentionInterval.GetElapsedTime();
|
||||
|
||||
@ -1113,7 +1114,7 @@ bool CCSBot::IsNoticable(const CBasePlayer *player, unsigned char visibleParts)
|
||||
}
|
||||
|
||||
// compute range modifier - farther away players are harder to notice, depeding on what they are doing
|
||||
float range = (player->pev->origin - pev->origin).Length();
|
||||
float range = (pPlayer->pev->origin - pev->origin).Length();
|
||||
const float closeRange = 300.0f;
|
||||
const float farRange = 1000.0f;
|
||||
|
||||
@ -1132,9 +1133,9 @@ bool CCSBot::IsNoticable(const CBasePlayer *player, unsigned char visibleParts)
|
||||
}
|
||||
|
||||
// harder to notice when crouched
|
||||
bool isCrouching = (player->pev->flags & FL_DUCKING) == FL_DUCKING;
|
||||
bool isCrouching = (pPlayer->pev->flags & FL_DUCKING) == FL_DUCKING;
|
||||
// moving players are easier to spot
|
||||
float playerSpeedSq = player->pev->velocity.LengthSquared();
|
||||
float playerSpeedSq = pPlayer->pev->velocity.LengthSquared();
|
||||
const float runSpeed = 200.0f;
|
||||
const float walkSpeed = 30.0f;
|
||||
float farChance, closeChance;
|
||||
|
@ -61,18 +61,18 @@ void CCSBot::FireWeaponAtEnemy()
|
||||
Vector2D toAimSpot = (m_aimSpot - pev->origin).Make2D();
|
||||
float rangeToEnemy = toAimSpot.NormalizeInPlace();
|
||||
|
||||
const float_precision halfPI = (M_PI / 180.0f);
|
||||
float_precision yaw = pev->v_angle[YAW] * halfPI;
|
||||
const real_t halfPI = (M_PI / 180.0f);
|
||||
real_t yaw = pev->v_angle[YAW] * halfPI;
|
||||
|
||||
Vector2D dir(Q_cos(yaw), Q_sin(yaw));
|
||||
float_precision onTarget = DotProduct(toAimSpot, dir);
|
||||
real_t onTarget = DotProduct(toAimSpot, dir);
|
||||
|
||||
// aim more precisely with a sniper rifle
|
||||
// because rifles' bullets spray, dont have to be very precise
|
||||
const float_precision halfSize = (IsUsingSniperRifle()) ? HalfHumanWidth : 2.0f * HalfHumanWidth;
|
||||
const real_t halfSize = (IsUsingSniperRifle()) ? HalfHumanWidth : 2.0f * HalfHumanWidth;
|
||||
|
||||
// aiming tolerance depends on how close the target is - closer targets subtend larger angles
|
||||
float_precision aimTolerance = Q_cos(Q_atan(halfSize / rangeToEnemy));
|
||||
real_t aimTolerance = Q_cos(Q_atan(halfSize / rangeToEnemy));
|
||||
|
||||
if (onTarget > aimTolerance)
|
||||
{
|
||||
@ -205,7 +205,7 @@ void CCSBot::SetAimOffset(float accuracy)
|
||||
PrintIfWatched("Accuracy = %4.3f\n", accuracy);
|
||||
|
||||
float range = (m_lastEnemyPosition - pev->origin).Length();
|
||||
const float_precision maxOffset = range * (float_precision(m_iFOV) / DEFAULT_FOV) * 0.1;
|
||||
const real_t maxOffset = range * (real_t(m_iFOV) / DEFAULT_FOV) * 0.1;
|
||||
float error = maxOffset * (1 - accuracy);
|
||||
|
||||
m_aimOffsetGoal[0] = RANDOM_FLOAT(-error, error);
|
||||
@ -443,10 +443,6 @@ void CCSBot::EquipBestWeapon(bool mustEquip)
|
||||
if ((TheCSBots()->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
||||
|| (TheCSBots()->AllowMachineGuns() && weaponClass == WEAPONCLASS_MACHINEGUN)
|
||||
|| (TheCSBots()->AllowRifles() && weaponClass == WEAPONCLASS_RIFLE)
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
// TODO: already is checked shotguns!
|
||||
|| (TheCSBots()->AllowShotguns() && weaponClass == WEAPONCLASS_SHOTGUN)
|
||||
#endif
|
||||
|| (TheCSBots()->AllowSnipers() && weaponClass == WEAPONCLASS_SNIPERRIFLE)
|
||||
|| (TheCSBots()->AllowSubMachineGuns() && weaponClass == WEAPONCLASS_SUBMACHINEGUN)
|
||||
|| (TheCSBots()->AllowTacticalShield() && pPrimary->m_iId == WEAPON_SHIELDGUN))
|
||||
|
@ -93,7 +93,7 @@ void CSGameState::Reset()
|
||||
}
|
||||
|
||||
// Update game state based on events we have received
|
||||
void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CSGameState::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
@ -103,9 +103,9 @@ void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity
|
||||
SetBombState(PLANTED);
|
||||
|
||||
// Terrorists always know where the bomb is
|
||||
if (m_owner->m_iTeam == TERRORIST && other)
|
||||
if (m_owner->m_iTeam == TERRORIST && pOther)
|
||||
{
|
||||
UpdatePlantedBomb(&other->pev->origin);
|
||||
UpdatePlantedBomb(&pOther->pev->origin);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
CSGameState(CCSBot *owner);
|
||||
|
||||
void Reset();
|
||||
void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other); // Event handling
|
||||
void OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther); // Event handling
|
||||
bool IsRoundOver() const; // true if round has been won or lost (but not yet reset)
|
||||
|
||||
// bomb defuse scenario
|
||||
@ -79,7 +79,7 @@ public:
|
||||
const Vector *GetBombPosition() const; // return where we think the bomb is, or NULL if we don't know
|
||||
|
||||
// hostage rescue scenario
|
||||
CHostage *GetNearestFreeHostage(Vector *knowPos = NULL) const; // return the closest free hostage, and where we think it is (knowPos)
|
||||
CHostage *GetNearestFreeHostage(Vector *knowPos = nullptr) const; // return the closest free hostage, and where we think it is (knowPos)
|
||||
const Vector *GetRandomFreeHostagePosition();
|
||||
bool AreAllHostagesBeingRescued() const; // return true if there are no free hostages
|
||||
bool AreAllHostagesGone() const; // all hostages have been rescued or are dead
|
||||
|
@ -397,11 +397,11 @@ void BuyState::OnUpdate(CCSBot *me)
|
||||
|
||||
for (int i = 0; i < MAX_BUY_WEAPON_PRIMARY; i++)
|
||||
{
|
||||
if ((masterPrimary[i].type == SHOTGUN && TheCSBots()->AllowShotguns()) ||
|
||||
(masterPrimary[i].type == SUB_MACHINE_GUN && TheCSBots()->AllowSubMachineGuns()) ||
|
||||
(masterPrimary[i].type == RIFLE && TheCSBots()->AllowRifles()) ||
|
||||
(masterPrimary[i].type == SNIPER_RIFLE && TheCSBots()->AllowSnipers() && wantSniper) ||
|
||||
(masterPrimary[i].type == MACHINE_GUN && TheCSBots()->AllowMachineGuns()))
|
||||
if ((masterPrimary[i].type == SHOTGUN && TheCSBots()->AllowShotguns())
|
||||
|| (masterPrimary[i].type == SUB_MACHINE_GUN && TheCSBots()->AllowSubMachineGuns())
|
||||
|| (masterPrimary[i].type == RIFLE && TheCSBots()->AllowRifles())
|
||||
|| (masterPrimary[i].type == SNIPER_RIFLE && TheCSBots()->AllowSnipers() && wantSniper)
|
||||
|| (masterPrimary[i].type == MACHINE_GUN && TheCSBots()->AllowMachineGuns()))
|
||||
{
|
||||
stockPrimary[stockPrimaryCount++] = &masterPrimary[i];
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ void FollowState::OnUpdate(CCSBot *me)
|
||||
area = collector.m_targetArea[a];
|
||||
area->GetClosestPointOnArea(&me->pev->origin, &close);
|
||||
|
||||
float_precision rangeSq = (me->pev->origin - close).LengthSquared();
|
||||
real_t rangeSq = (me->pev->origin - close).LengthSquared();
|
||||
if (rangeSq < closeRangeSq)
|
||||
{
|
||||
target = area;
|
||||
|
@ -115,22 +115,22 @@ void HideState::OnUpdate(CCSBot *me)
|
||||
// if we are momentarily hiding while following someone, check to see if he has moved on
|
||||
if (me->IsFollowing())
|
||||
{
|
||||
CBasePlayer *leader = me->GetFollowLeader();
|
||||
CBasePlayer *pLeader = me->GetFollowLeader();
|
||||
|
||||
// BOTPORT: Determine walk/run velocity thresholds
|
||||
float runThreshold = 200.0f;
|
||||
if (leader->pev->velocity.IsLengthGreaterThan(runThreshold))
|
||||
if (pLeader->pev->velocity.IsLengthGreaterThan(runThreshold))
|
||||
{
|
||||
// leader is running, stay with him
|
||||
me->Follow(leader);
|
||||
me->Follow(pLeader);
|
||||
return;
|
||||
}
|
||||
|
||||
// if leader has moved, stay with him
|
||||
const float followRange = 250.0f;
|
||||
if ((m_leaderAnchorPos - leader->pev->origin).IsLengthGreaterThan(followRange))
|
||||
if ((m_leaderAnchorPos - pLeader->pev->origin).IsLengthGreaterThan(followRange))
|
||||
{
|
||||
me->Follow(leader);
|
||||
me->Follow(pLeader);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ void HuntState::OnUpdate(CCSBot *me)
|
||||
continue;
|
||||
|
||||
// keep track of the least recently cleared area
|
||||
float_precision age = gpGlobals->time - area->GetClearedTimestamp(me->m_iTeam - 1);
|
||||
real_t age = gpGlobals->time - area->GetClearedTimestamp(me->m_iTeam - 1);
|
||||
if (age > oldest)
|
||||
{
|
||||
oldest = age;
|
||||
|
@ -310,7 +310,7 @@ void IdleState::OnUpdate(CCSBot *me)
|
||||
|
||||
// just use the first overlapping nav area as a reasonable approximation
|
||||
ShortestPathCost pathCost = ShortestPathCost();
|
||||
float_precision dist = NavAreaTravelDistance(me->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&TheCSBots()->GetZone(z)->m_center), pathCost);
|
||||
real_t dist = NavAreaTravelDistance(me->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&TheCSBots()->GetZone(z)->m_center), pathCost);
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (dist < 0.0f)
|
||||
|
@ -178,7 +178,7 @@ void CMultiSource::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
|
||||
useType = USE_ON;
|
||||
}
|
||||
|
||||
SUB_UseTargets(NULL, useType, 0);
|
||||
SUB_UseTargets(nullptr, useType, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ BOOL CBaseButton::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, fl
|
||||
}
|
||||
|
||||
// Temporarily disable the touch function, until movement is finished.
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
|
||||
m_hActivator = CBaseEntity::Instance(pevAttacker);
|
||||
if (!m_hActivator)
|
||||
@ -482,7 +482,7 @@ void CBaseButton::Spawn()
|
||||
m_vecPosition1 = pev->origin;
|
||||
|
||||
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
|
||||
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
|
||||
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(real_t(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(real_t(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(real_t(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
|
||||
|
||||
// Is this a non-moving button?
|
||||
if (((m_vecPosition2 - m_vecPosition1).Length() < 1) || (pev->spawnflags & SF_BUTTON_DONTMOVE))
|
||||
@ -501,7 +501,7 @@ void CBaseButton::Spawn()
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
SetUse(&CBaseButton::ButtonUse);
|
||||
}
|
||||
}
|
||||
@ -640,7 +640,7 @@ void CBaseButton::ButtonTouch(CBaseEntity *pOther)
|
||||
}
|
||||
|
||||
// Temporarily disable the touch function, until movement is finished.
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
|
||||
if (code == BUTTON_RETURN)
|
||||
{
|
||||
@ -703,10 +703,12 @@ void CBaseButton::TriggerAndWait()
|
||||
if (!(pev->spawnflags & SF_BUTTON_TOUCH_ONLY))
|
||||
{
|
||||
// ALL buttons are now use only
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTouch(&CBaseButton::ButtonTouch);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -752,7 +754,7 @@ void CBaseButton::Restart()
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
SetUse(&CBaseButton::ButtonUse);
|
||||
}
|
||||
}
|
||||
@ -799,10 +801,12 @@ void CBaseButton::ButtonBackHome()
|
||||
if (!(pev->spawnflags & SF_BUTTON_TOUCH_ONLY))
|
||||
{
|
||||
// All buttons are now use only
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTouch(&CBaseButton::ButtonTouch);
|
||||
}
|
||||
|
||||
// reset think for a sparking button
|
||||
if (pev->spawnflags & SF_BUTTON_SPARK_IF_OFF)
|
||||
@ -884,11 +888,14 @@ void CRotButton::Spawn()
|
||||
// if the button is flagged for USE button activation only, take away it's touch function and add a use function
|
||||
if (!(pev->spawnflags & SF_BUTTON_TOUCH_ONLY))
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
SetUse(&CRotButton::ButtonUse);
|
||||
}
|
||||
else // touchable button
|
||||
// touchable button
|
||||
else
|
||||
{
|
||||
SetTouch(&CRotButton::ButtonTouch);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
@ -1092,7 +1099,9 @@ void CMomentaryRotButton::Off()
|
||||
m_direction = -1;
|
||||
}
|
||||
else
|
||||
SetThink(NULL);
|
||||
{
|
||||
SetThink(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void CMomentaryRotButton::Return()
|
||||
@ -1115,7 +1124,7 @@ void CMomentaryRotButton::UpdateSelfReturn(float value)
|
||||
pev->avelocity = g_vecZero;
|
||||
pev->angles = m_start;
|
||||
pev->nextthink = -1;
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1135,8 +1144,8 @@ LINK_ENTITY_TO_CLASS(env_debris, CEnvSpark, CCSEnvSpark)
|
||||
|
||||
void CEnvSpark::Spawn()
|
||||
{
|
||||
SetThink(NULL);
|
||||
SetUse(NULL);
|
||||
SetThink(nullptr);
|
||||
SetUse(nullptr);
|
||||
|
||||
// Use for on/off
|
||||
if (pev->spawnflags & SF_SPARK_TOOGLE)
|
||||
@ -1212,7 +1221,7 @@ void CEnvSpark::SparkStart(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
||||
void CEnvSpark::SparkStop(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
|
||||
{
|
||||
SetUse(&CEnvSpark::SparkStart);
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
|
||||
LINK_ENTITY_TO_CLASS(button_target, CButtonTarget, CCSButtonTarget)
|
||||
@ -1243,17 +1252,20 @@ void CButtonTarget::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
||||
SUB_UseTargets(pActivator, USE_ON, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SUB_UseTargets(pActivator, USE_OFF, 0);
|
||||
}
|
||||
}
|
||||
|
||||
int CButtonTarget::ObjectCaps()
|
||||
{
|
||||
int caps = (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION);
|
||||
|
||||
if (pev->spawnflags & SF_BTARGET_USE)
|
||||
return caps | FCAP_IMPULSE_USE;
|
||||
else
|
||||
return caps;
|
||||
{
|
||||
caps |= FCAP_IMPULSE_USE;
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
BOOL CButtonTarget::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
|
||||
|
@ -129,22 +129,22 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
|
||||
|
||||
if (m_rescuer)
|
||||
{
|
||||
int hostages_ = 0;
|
||||
CHostage *hostageEntity = nullptr;
|
||||
int hostagesCount = 0;
|
||||
CHostage *pHostage = nullptr;
|
||||
|
||||
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (!hostageEntity->IsAlive())
|
||||
if (!pHostage->IsAlive())
|
||||
continue;
|
||||
|
||||
if (!hostageEntity->IsFollowingSomeone())
|
||||
if (!pHostage->IsFollowingSomeone())
|
||||
continue;
|
||||
|
||||
if (hostageEntity->m_target == pVictim)
|
||||
++hostages_;
|
||||
if (pHostage->m_target == pVictim)
|
||||
hostagesCount++;
|
||||
}
|
||||
|
||||
if (!hostages_)
|
||||
if (!hostagesCount)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, b
|
||||
return;
|
||||
}
|
||||
|
||||
++m_eventsSeen;
|
||||
m_eventsSeen++;
|
||||
SendPartialNotification();
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerH
|
||||
return;
|
||||
}
|
||||
|
||||
++m_eventsSeen;
|
||||
m_eventsSeen++;
|
||||
SendPartialNotification();
|
||||
}
|
||||
|
||||
@ -205,25 +205,23 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
|
||||
|
||||
if (m_rescuer)
|
||||
{
|
||||
int hostages_ = 0;
|
||||
CHostage *hostageEntity = nullptr;
|
||||
int hostagesCount = 0;
|
||||
CHostage *pHostage = nullptr;
|
||||
|
||||
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (!hostageEntity->IsAlive())
|
||||
if (!pHostage->IsAlive())
|
||||
continue;
|
||||
|
||||
if (!hostageEntity->IsFollowingSomeone())
|
||||
if (!pHostage->IsFollowingSomeone())
|
||||
continue;
|
||||
|
||||
if (hostageEntity->m_target == pAttacker)
|
||||
++hostages_;
|
||||
if (pHostage->m_target == pAttacker)
|
||||
hostagesCount++;
|
||||
}
|
||||
|
||||
if (!hostages_)
|
||||
{
|
||||
if (!hostagesCount)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_event != EVENT_KILL || (!m_weaponId && !m_weaponClassId))
|
||||
@ -234,35 +232,35 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
|
||||
{
|
||||
if (!Q_strcmp(m_name, "defendhostages"))
|
||||
{
|
||||
int hostages_ = 0;
|
||||
CHostage *hostageEntity = nullptr;
|
||||
int hostagesCount = 0;
|
||||
CHostage *pHostage = nullptr;
|
||||
|
||||
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (hostageEntity->pev->takedamage != DAMAGE_YES && hostageEntity->pev->deadflag != DEAD_DEAD)
|
||||
++hostages_;
|
||||
if (pHostage->pev->takedamage != DAMAGE_YES && pHostage->pev->deadflag != DEAD_DEAD)
|
||||
hostagesCount++;
|
||||
}
|
||||
|
||||
if (!hostages_)
|
||||
if (!hostagesCount)
|
||||
{
|
||||
++m_eventsSeen;
|
||||
m_eventsSeen++;
|
||||
SendPartialNotification();
|
||||
}
|
||||
}
|
||||
else if (!Q_strcmp(m_name, "hostagessurvive"))
|
||||
{
|
||||
int hostages_ = 0;
|
||||
CHostage *hostageEntity = nullptr;
|
||||
int hostagesCount = 0;
|
||||
CHostage *pHostage = nullptr;
|
||||
|
||||
while ((hostageEntity = (CHostage *)UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")))
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (hostageEntity && hostageEntity->IsDead())
|
||||
++hostages_;
|
||||
if (pHostage && pHostage->IsDead())
|
||||
hostagesCount++;
|
||||
}
|
||||
|
||||
if (!hostages_)
|
||||
if (!hostagesCount)
|
||||
{
|
||||
++m_eventsSeen;
|
||||
m_eventsSeen++;
|
||||
SendPartialNotification();
|
||||
}
|
||||
}
|
||||
@ -276,22 +274,22 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
|
||||
}
|
||||
else if (IsTaskCompletableThisRound())
|
||||
{
|
||||
++m_eventsSeen;
|
||||
m_eventsSeen++;
|
||||
SendPartialNotification();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++m_eventsSeen;
|
||||
m_eventsSeen++;
|
||||
SendPartialNotification();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (event == m_event && !m_mustLive && m_eventsSeen >= m_eventsNeeded && IsTaskCompletableThisRound())
|
||||
{
|
||||
CBasePlayer *player = UTIL_GetLocalPlayer();
|
||||
EMIT_SOUND(ENT(player->pev), CHAN_VOICE, "events/task_complete.wav", VOL_NORM, ATTN_NORM);
|
||||
EMIT_SOUND(ENT(pLocalPlayer->pev), CHAN_VOICE, "events/task_complete.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
m_isComplete = true;
|
||||
MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer);
|
||||
@ -309,7 +307,7 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
|
||||
if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast"))
|
||||
{
|
||||
TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime()));
|
||||
UTIL_GetLocalPlayer()->SyncRoundTimer();
|
||||
pLocalPlayer->SyncRoundTimer();
|
||||
}
|
||||
}
|
||||
else if (event >= EVENT_ROUND_DRAW)
|
||||
@ -327,8 +325,7 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
|
||||
{
|
||||
if (m_eventsSeen >= m_eventsNeeded && !m_diedThisRound && IsTaskCompletableThisRound())
|
||||
{
|
||||
CBasePlayer *player = UTIL_GetLocalPlayer();
|
||||
EMIT_SOUND(ENT(player->pev), CHAN_VOICE, "events/task_complete.wav", VOL_NORM, ATTN_NORM);
|
||||
EMIT_SOUND(ENT(pLocalPlayer->pev), CHAN_VOICE, "events/task_complete.wav", VOL_NORM, ATTN_NORM);
|
||||
|
||||
m_isComplete = true;
|
||||
MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer);
|
||||
@ -341,7 +338,7 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
|
||||
if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast"))
|
||||
{
|
||||
TheCareerTasks->SetFinishedTaskTime(int(TheCareerTasks->GetRoundElapsedTime()));
|
||||
UTIL_GetLocalPlayer()->SyncRoundTimer();
|
||||
pLocalPlayer->SyncRoundTimer();
|
||||
}
|
||||
|
||||
if (TheTutor)
|
||||
@ -539,11 +536,11 @@ void CCareerTaskManager::HandleDeath(int team, CBasePlayer *pAttacker)
|
||||
if (enemyTeam != team)
|
||||
return;
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (pPlayer && pPlayer->m_iTeam == enemyTeam && pPlayer->IsAlive())
|
||||
++numEnemies;
|
||||
numEnemies++;
|
||||
}
|
||||
|
||||
if (!numEnemies)
|
||||
@ -564,13 +561,13 @@ bool CCareerTaskManager::AreAllTasksComplete()
|
||||
|
||||
int CCareerTaskManager::GetNumRemainingTasks()
|
||||
{
|
||||
int nCount = 0;
|
||||
int nTasksCount = 0;
|
||||
for (auto task : m_tasks) {
|
||||
if (task->IsComplete())
|
||||
++nCount;
|
||||
nTasksCount++;
|
||||
}
|
||||
|
||||
return nCount;
|
||||
return nTasksCount;
|
||||
}
|
||||
|
||||
float CCareerTaskManager::GetRoundElapsedTime()
|
||||
|
@ -114,10 +114,10 @@ public:
|
||||
void Reset(bool deleteTasks = true);
|
||||
void AddTask(const char *taskName, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, bool isComplete);
|
||||
|
||||
void HandleEvent(GameEventType event, CBasePlayer *pAttacker = NULL, CBasePlayer *pVictim = NULL);
|
||||
void HandleEvent(GameEventType event, CBasePlayer *pAttacker = nullptr, CBasePlayer *pVictim = nullptr);
|
||||
void HandleEnemyKill(bool wasBlind, const char *weaponName, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim);
|
||||
void HandleWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim);
|
||||
void HandleDeath(int team, CBasePlayer *pAttacker = NULL);
|
||||
void HandleDeath(int team, CBasePlayer *pAttacker = nullptr);
|
||||
void HandleWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker);
|
||||
void HandleEnemyInjury(const char *weaponName, bool attackerHasShield, CBasePlayer *pAttacker);
|
||||
|
||||
|
@ -412,7 +412,7 @@ void DispatchThink(edict_t *pent)
|
||||
|
||||
if (pEntity)
|
||||
{
|
||||
if (pEntity->pev->flags & FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
{
|
||||
ALERT(at_error, "Dormant entity %s is thinking!!\n", STRING(pEntity->pev->classname));
|
||||
}
|
||||
@ -451,7 +451,7 @@ void DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData)
|
||||
// These don't use ltime & nextthink as times really, but we'll fudge around it.
|
||||
if (pEntity->pev->movetype == MOVETYPE_PUSH)
|
||||
{
|
||||
float_precision delta = pEntity->pev->nextthink - pEntity->pev->ltime;
|
||||
real_t delta = pEntity->pev->nextthink - pEntity->pev->ltime;
|
||||
pEntity->pev->ltime = gpGlobals->time;
|
||||
pEntity->pev->nextthink = pEntity->pev->ltime + delta;
|
||||
}
|
||||
@ -677,7 +677,7 @@ BOOL CBaseEntity::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, fl
|
||||
Vector vecDir = pev->origin - (pevInflictor->absmin + pevInflictor->absmax) * 0.5;
|
||||
vecDir = vecDir.Normalize();
|
||||
|
||||
float_precision flForce = flDamage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5;
|
||||
real_t flForce = flDamage * ((32 * 32 * 72.0) / (pev->size.x * pev->size.y * pev->size.z)) * 5;
|
||||
|
||||
if (flForce > 1000.0)
|
||||
flForce = 1000.0;
|
||||
@ -769,19 +769,19 @@ void SetObjectCollisionBox(entvars_t *pev)
|
||||
if (pev->solid == SOLID_BSP && (pev->angles.x || pev->angles.y || pev->angles.z))
|
||||
{
|
||||
// expand for rotation
|
||||
float_precision max, v;
|
||||
real_t max, v;
|
||||
int i;
|
||||
|
||||
max = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
v = Q_fabs(float_precision(((float *)pev->mins)[i]));
|
||||
v = Q_fabs(real_t(((float *)pev->mins)[i]));
|
||||
if (v > max)
|
||||
{
|
||||
max = v;
|
||||
}
|
||||
|
||||
v = Q_fabs(float_precision(((float *)pev->maxs)[i]));
|
||||
v = Q_fabs(real_t(((float *)pev->maxs)[i]));
|
||||
if (v > max)
|
||||
{
|
||||
max = v;
|
||||
@ -845,11 +845,6 @@ void CBaseEntity::MakeDormant()
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
}
|
||||
|
||||
int CBaseEntity::IsDormant()
|
||||
{
|
||||
return (pev->flags & FL_DORMANT) == FL_DORMANT;
|
||||
}
|
||||
|
||||
BOOL CBaseEntity::IsInWorld()
|
||||
{
|
||||
// position
|
||||
|
@ -151,7 +151,11 @@ public:
|
||||
bool Intersects(CBaseEntity *pOther);
|
||||
bool Intersects(const Vector &mins, const Vector &maxs);
|
||||
void MakeDormant();
|
||||
int IsDormant();
|
||||
|
||||
// This entity's classname.
|
||||
const char *GetClassname() const { return pev->classname.str(); }
|
||||
|
||||
bool IsDormant() const { return (pev->flags & FL_DORMANT) == FL_DORMANT; }
|
||||
BOOL IsLockedByMaster() { return FALSE; }
|
||||
|
||||
public:
|
||||
@ -266,7 +270,7 @@ public:
|
||||
};
|
||||
|
||||
// Inlines
|
||||
inline BOOL FNullEnt(CBaseEntity *ent) { return (ent == NULL || FNullEnt(ent->edict())); }
|
||||
inline BOOL FNullEnt(CBaseEntity *pEntity) { return (pEntity == nullptr || FNullEnt(pEntity->edict())); }
|
||||
|
||||
template <typename T>
|
||||
inline void CBaseEntity::SetThink(void (T::*pfn)())
|
||||
|
@ -446,7 +446,7 @@ NOXREF int CountTeams()
|
||||
if (pPlayer->m_iTeam == UNASSIGNED)
|
||||
continue;
|
||||
|
||||
if (pPlayer->pev->flags & FL_DORMANT)
|
||||
if (pPlayer->IsDormant())
|
||||
continue;
|
||||
|
||||
if (pPlayer->m_iTeam == SPECTATOR)
|
||||
@ -472,7 +472,7 @@ void ListPlayers(CBasePlayer *current)
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (pEntity->pev->flags & FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
@ -499,7 +499,7 @@ int CountTeamPlayers(int iTeam)
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (pEntity->pev->flags & FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
if (GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev)->m_iTeam == iTeam)
|
||||
@ -655,7 +655,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
|
||||
SET_CLIENT_MAXSPEED(ENT(pPlayer->pev), 1);
|
||||
SET_MODEL(ENT(pPlayer->pev), "models/player.mdl");
|
||||
|
||||
pPlayer->SetThink(NULL);
|
||||
pPlayer->SetThink(nullptr);
|
||||
|
||||
CBaseEntity *pTarget = nullptr;
|
||||
pPlayer->m_pIntroCamera = UTIL_FindEntityByClassname(nullptr, "trigger_camera");
|
||||
@ -721,7 +721,6 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
|
||||
|
||||
void Host_Say(edict_t *pEntity, BOOL teamonly)
|
||||
{
|
||||
CBasePlayer *client;
|
||||
int j;
|
||||
char *p;
|
||||
char text[128];
|
||||
@ -919,39 +918,39 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
|
||||
// This may return the world in single player if the client types something between levels or during spawn
|
||||
// so check it, or it will infinite loop
|
||||
|
||||
client = nullptr;
|
||||
while ((client = (CBasePlayer *)UTIL_FindEntityByClassname(client, "player")))
|
||||
CBasePlayer *pReceiver = nullptr;
|
||||
while ((pReceiver = UTIL_FindEntityByClassname(pReceiver, "player")))
|
||||
{
|
||||
if (FNullEnt(client->edict()))
|
||||
if (FNullEnt(pReceiver->edict()))
|
||||
break;
|
||||
|
||||
if (!client->pev)
|
||||
if (!pReceiver->pev)
|
||||
continue;
|
||||
|
||||
if (client->edict() == pEntity)
|
||||
if (pReceiver->edict() == pEntity)
|
||||
continue;
|
||||
|
||||
// Not a client ? (should never be true)
|
||||
if (!client->IsNetClient())
|
||||
if (!pReceiver->IsNetClient())
|
||||
continue;
|
||||
|
||||
// can the receiver hear the sender? or has he muted him?
|
||||
if (gpGlobals->deathmatch != 0.0f && CSGameRules()->m_VoiceGameMgr.PlayerHasBlockedPlayer(client, pPlayer))
|
||||
if (gpGlobals->deathmatch != 0.0f && CSGameRules()->m_VoiceGameMgr.PlayerHasBlockedPlayer(pReceiver, pPlayer))
|
||||
continue;
|
||||
|
||||
if (teamonly && client->m_iTeam != pPlayer->m_iTeam)
|
||||
if (teamonly && pReceiver->m_iTeam != pPlayer->m_iTeam)
|
||||
continue;
|
||||
|
||||
if ((client->pev->deadflag != DEAD_NO && !bSenderDead) || (client->pev->deadflag == DEAD_NO && bSenderDead))
|
||||
if ((pReceiver->pev->deadflag != DEAD_NO && !bSenderDead) || (pReceiver->pev->deadflag == DEAD_NO && bSenderDead))
|
||||
{
|
||||
if (!(pPlayer->pev->flags & FL_PROXY))
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((client->m_iIgnoreGlobalChat == IGNOREMSG_ENEMY && client->m_iTeam == pPlayer->m_iTeam)
|
||||
|| client->m_iIgnoreGlobalChat == IGNOREMSG_NONE)
|
||||
if ((pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_ENEMY && pReceiver->m_iTeam == pPlayer->m_iTeam)
|
||||
|| pReceiver->m_iIgnoreGlobalChat == IGNOREMSG_NONE)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgSayText, nullptr, client->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgSayText, nullptr, pReceiver->pev);
|
||||
WRITE_BYTE(ENTINDEX(pEntity));
|
||||
WRITE_STRING(pszFormat);
|
||||
WRITE_STRING("");
|
||||
@ -966,8 +965,6 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
|
||||
}
|
||||
}
|
||||
|
||||
char *fullText = p;
|
||||
|
||||
// print to the sending client
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgSayText, nullptr, &pEntity->v);
|
||||
WRITE_BYTE(ENTINDEX(pEntity));
|
||||
@ -991,7 +988,9 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
|
||||
SERVER_PRINT(UTIL_VarArgs(pszConsoleFormat, STRING(pPlayer->pev->netname), text));
|
||||
}
|
||||
else
|
||||
{
|
||||
SERVER_PRINT(text);
|
||||
}
|
||||
|
||||
if (logmessages.value)
|
||||
{
|
||||
@ -1001,7 +1000,7 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
|
||||
char *szTeam = GetTeam(pPlayer->m_iTeam);
|
||||
|
||||
UTIL_LogPrintf("\"%s<%i><%s><%s>\" %s \"%s\"%s\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict()),
|
||||
szTeam, temp, fullText, deadText);
|
||||
szTeam, temp, p, deadText);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3363,7 +3362,7 @@ void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *pa
|
||||
{
|
||||
pPlayer->ClearAutoBuyData();
|
||||
|
||||
for (int i = 1; i < CMD_ARGC_(); ++i)
|
||||
for (int i = 1; i < CMD_ARGC_(); i++)
|
||||
{
|
||||
pPlayer->AddAutoBuyData(CMD_ARGV_(i));
|
||||
}
|
||||
@ -3534,7 +3533,7 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
EmptyEntityHashTable();
|
||||
|
||||
// Clients have not been initialized yet
|
||||
for (i = 0; i < edictCount; ++i)
|
||||
for (i = 0; i < edictCount; i++)
|
||||
{
|
||||
edict_t *pEdict = &pEdictList[i];
|
||||
|
||||
@ -3548,13 +3547,15 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
pClass = CBaseEntity::Instance(pEdict);
|
||||
|
||||
// Activate this entity if it's got a class & isn't dormant
|
||||
if (pClass && !(pClass->pev->flags & FL_DORMANT))
|
||||
if (pClass && !pClass->IsDormant())
|
||||
{
|
||||
AddEntityHashValue(&pEdict->v, STRING(pEdict->v.classname), CLASSNAME);
|
||||
pClass->Activate();
|
||||
}
|
||||
else
|
||||
{
|
||||
ALERT(at_console, "Can't instance %s\n", STRING(pEdict->v.classname));
|
||||
}
|
||||
}
|
||||
|
||||
// Link user messages here to make sure first client can get them...
|
||||
@ -3771,12 +3772,12 @@ void ClientPrecache()
|
||||
else
|
||||
numPlayerModels = ARRAYSIZE(sPlayerModelFiles) - 2;
|
||||
|
||||
for (i = 0; i < numPlayerModels; ++i)
|
||||
for (i = 0; i < numPlayerModels; i++)
|
||||
PRECACHE_MODEL(sPlayerModelFiles[i]);
|
||||
|
||||
if (AreRunningCZero())
|
||||
{
|
||||
for (i = FirstCustomSkin; i <= LastCustomSkin; ++i)
|
||||
for (i = FirstCustomSkin; i <= LastCustomSkin; i++)
|
||||
{
|
||||
const char *fname = TheBotProfiles->GetCustomSkinFname(i);
|
||||
|
||||
@ -3836,12 +3837,12 @@ void ClientPrecache()
|
||||
Vector vMin(-38, -24, -41);
|
||||
Vector vMax(38, 24, 41);
|
||||
|
||||
for (i = 0; i < numPlayerModels; ++i)
|
||||
for (i = 0; i < numPlayerModels; i++)
|
||||
ENGINE_FORCE_UNMODIFIED(force_model_specifybounds, (float *)&vMin, (float *)&vMax, sPlayerModelFiles[i]);
|
||||
|
||||
if (AreRunningCZero())
|
||||
{
|
||||
for (i = FirstCustomSkin; i <= LastCustomSkin; ++i)
|
||||
for (i = FirstCustomSkin; i <= LastCustomSkin; i++)
|
||||
{
|
||||
const char *fname = TheBotProfiles->GetCustomSkinFname(i);
|
||||
if (!fname)
|
||||
@ -4198,11 +4199,12 @@ bool CheckPlayerPVSLeafChanged(edict_t *client, int clientnum)
|
||||
if (pvs->headnode != client->headnode || pvs->num_leafs != client->num_leafs)
|
||||
return true;
|
||||
|
||||
for (int i = 0; i < pvs->num_leafs; ++i)
|
||||
for (int i = 0; i < pvs->num_leafs; i++)
|
||||
{
|
||||
if (client->leafnums[i] != pvs->leafnums[i])
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4325,10 +4327,10 @@ BOOL EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, e
|
||||
state->framerate = ent->v.framerate;
|
||||
state->body = ent->v.body;
|
||||
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (i = 0; i < 4; i++)
|
||||
state->controller[i] = ent->v.controller[i];
|
||||
|
||||
for (i = 0; i < 2; ++i)
|
||||
for (i = 0; i < 2; i++)
|
||||
state->blending[i] = ent->v.blending[i];
|
||||
|
||||
state->rendermode = ent->v.rendermode;
|
||||
|
@ -94,14 +94,14 @@ void SV_Career_EndRound_f()
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player || FNullEnt(player->pev))
|
||||
if (!pPlayer || FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (player->IsBot() && player->m_iTeam == pLocalPlayer->m_iTeam)
|
||||
if (pPlayer->IsBot() && pPlayer->m_iTeam == pLocalPlayer->m_iTeam)
|
||||
{
|
||||
SERVER_COMMAND(UTIL_VarArgs("bot_kill \"%s\"\n", STRING(player->pev->netname)));
|
||||
SERVER_COMMAND(UTIL_VarArgs("bot_kill \"%s\"\n", STRING(pPlayer->pev->netname)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ void PlayerBlind(CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAt
|
||||
|
||||
if (!fadetoblack.value)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pObserver = UTIL_PlayerByIndex(i);
|
||||
if (pObserver && pObserver->IsObservingPlayer(pPlayer))
|
||||
@ -132,7 +132,7 @@ void RadiusFlash(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker,
|
||||
}
|
||||
}
|
||||
|
||||
float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
|
||||
float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *pEntity)
|
||||
{
|
||||
float retval = 0.0f;
|
||||
TraceResult tr;
|
||||
@ -148,10 +148,10 @@ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
|
||||
const float damagePercentageRightSide = 0.10f;
|
||||
const float damagePercentageLeftSide = 0.10f;
|
||||
|
||||
if (!entity->IsPlayer())
|
||||
if (!pEntity->IsPlayer())
|
||||
{
|
||||
// the entity is not a player, so the damage is all or nothing.
|
||||
UTIL_TraceLine(vecSrc, entity->pev->origin, ignore_monsters, nullptr, &tr);
|
||||
UTIL_TraceLine(vecSrc, pEntity->pev->origin, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval = 1.0f;
|
||||
@ -160,34 +160,34 @@ float GetAmountOfPlayerVisible(Vector vecSrc, CBaseEntity *entity)
|
||||
}
|
||||
|
||||
// check chest
|
||||
Vector vecChest = entity->pev->origin;
|
||||
Vector vecChest = pEntity->pev->origin;
|
||||
UTIL_TraceLine(vecSrc, vecChest, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageChest;
|
||||
|
||||
// check top of head
|
||||
Vector vecHead = entity->pev->origin + Vector(0, 0, topOfHead);
|
||||
Vector vecHead = pEntity->pev->origin + Vector(0, 0, topOfHead);
|
||||
UTIL_TraceLine(vecSrc, vecHead, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageHead;
|
||||
|
||||
// check feet
|
||||
Vector vecFeet = entity->pev->origin;
|
||||
vecFeet.z -= (entity->pev->flags & FL_DUCKING) ? crouchFeet : standFeet;
|
||||
Vector vecFeet = pEntity->pev->origin;
|
||||
vecFeet.z -= (pEntity->pev->flags & FL_DUCKING) ? crouchFeet : standFeet;
|
||||
|
||||
UTIL_TraceLine(vecSrc, vecFeet, ignore_monsters, nullptr, &tr);
|
||||
|
||||
if (tr.flFraction == 1.0f)
|
||||
retval += damagePercentageFeet;
|
||||
|
||||
Vector2D dir = (entity->pev->origin - vecSrc).Make2D();
|
||||
Vector2D dir = (pEntity->pev->origin - vecSrc).Make2D();
|
||||
dir.NormalizeInPlace();
|
||||
|
||||
Vector2D perp(-dir.y * edgeOffset, dir.x * edgeOffset);
|
||||
Vector vecRightSide = entity->pev->origin + Vector(perp.x, perp.y, 0);
|
||||
Vector vecLeftSide = entity->pev->origin - Vector(perp.x, perp.y, 0);
|
||||
Vector vecRightSide = pEntity->pev->origin + Vector(perp.x, perp.y, 0);
|
||||
Vector vecLeftSide = pEntity->pev->origin - Vector(perp.x, perp.y, 0);
|
||||
|
||||
// check right "edge"
|
||||
UTIL_TraceLine(vecSrc, vecRightSide, ignore_monsters, nullptr, &tr);
|
||||
|
@ -213,7 +213,7 @@ void CBaseDoor::Spawn()
|
||||
m_vecPosition1 = pev->origin;
|
||||
|
||||
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
|
||||
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
|
||||
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(real_t(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(real_t(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(real_t(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
|
||||
|
||||
assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2));
|
||||
|
||||
@ -230,7 +230,7 @@ void CBaseDoor::Spawn()
|
||||
// if the door is flagged for USE button activation only, use NULL touch function
|
||||
if (pev->spawnflags & SF_DOOR_USE_ONLY)
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -248,7 +248,7 @@ void CBaseDoor::Restart()
|
||||
DoorGoDown();
|
||||
|
||||
if (pev->spawnflags & SF_DOOR_USE_ONLY)
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
else
|
||||
SetTouch(&CBaseDoor::DoorTouch);
|
||||
}
|
||||
@ -442,7 +442,7 @@ void CBaseDoor::DoorTouch(CBaseEntity *pOther)
|
||||
if (DoorActivate())
|
||||
{
|
||||
// Temporarily disable the touch function, until movement is finished.
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -717,7 +717,7 @@ void CBaseDoor::DoorHitBottom()
|
||||
if (pev->spawnflags & SF_DOOR_USE_ONLY)
|
||||
{
|
||||
// use only door
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -942,7 +942,7 @@ void CRotDoor::Spawn()
|
||||
|
||||
if (pev->spawnflags & SF_DOOR_USE_ONLY)
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -988,7 +988,7 @@ void CMomentaryDoor::Spawn()
|
||||
m_vecPosition1 = pev->origin;
|
||||
|
||||
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
|
||||
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(float_precision(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(float_precision(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(float_precision(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
|
||||
m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(real_t(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(real_t(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(real_t(pev->movedir.z * (pev->size.z - 2))) - m_flLip));
|
||||
assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2));
|
||||
|
||||
if (pev->spawnflags & SF_DOOR_START_OPEN)
|
||||
@ -1000,7 +1000,7 @@ void CMomentaryDoor::Spawn()
|
||||
m_vecPosition1 = pev->origin;
|
||||
}
|
||||
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
Precache();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ void CBubbling::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useT
|
||||
}
|
||||
else
|
||||
{
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->nextthink = 0;
|
||||
}
|
||||
}
|
||||
@ -334,7 +334,7 @@ void CLightning::Spawn()
|
||||
|
||||
if (ServerSide())
|
||||
{
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
if (pev->dmg > 0)
|
||||
{
|
||||
SetThink(&CLightning::DamageThink);
|
||||
@ -477,7 +477,7 @@ void CLightning::StrikeUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
||||
if (m_active)
|
||||
{
|
||||
m_active = 0;
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -486,7 +486,7 @@ void CLightning::StrikeUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TY
|
||||
}
|
||||
|
||||
if (!(pev->spawnflags & SF_BEAM_TOGGLE))
|
||||
SetUse(NULL);
|
||||
SetUse(nullptr);
|
||||
}
|
||||
|
||||
int IsPointEntity(CBaseEntity *pEnt)
|
||||
@ -1021,7 +1021,7 @@ void CGlow::Animate(float frames)
|
||||
{
|
||||
if (m_maxFrame > 0)
|
||||
{
|
||||
pev->frame = Q_fmod(float_precision(pev->frame + frames), float_precision(m_maxFrame));
|
||||
pev->frame = Q_fmod(real_t(pev->frame + frames), real_t(m_maxFrame));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1222,7 +1222,7 @@ void CSprite::Animate(float frames)
|
||||
TurnOff();
|
||||
|
||||
else if (m_maxFrame > 0)
|
||||
pev->frame = Q_fmod(float_precision(pev->frame), float_precision(m_maxFrame));
|
||||
pev->frame = Q_fmod(real_t(pev->frame), real_t(m_maxFrame));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1414,7 +1414,7 @@ void CGibShooter::ShootThink()
|
||||
if (pev->spawnflags & SF_GIBSHOOTER_REPEATABLE)
|
||||
{
|
||||
m_iGibs = m_iGibCapacity;
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
else
|
||||
@ -1544,7 +1544,7 @@ void CTestEffect::TestThink()
|
||||
|
||||
if (t < 3.0)
|
||||
{
|
||||
for (i = 0; i < m_iBeam; ++i)
|
||||
for (i = 0; i < m_iBeam; i++)
|
||||
{
|
||||
t = (gpGlobals->time - m_flBeamTime[i]) / (3.0f + m_flStartTime - m_flBeamTime[i]);
|
||||
m_pBeam[i]->SetBrightness(int(255.0f * t));
|
||||
@ -1554,14 +1554,14 @@ void CTestEffect::TestThink()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < m_iBeam; ++i)
|
||||
for (i = 0; i < m_iBeam; i++)
|
||||
{
|
||||
UTIL_Remove(m_pBeam[i]);
|
||||
}
|
||||
|
||||
m_flStartTime = gpGlobals->time;
|
||||
m_iBeam = 0;
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1965,7 +1965,7 @@ void CItemSoda::CanThink()
|
||||
pev->solid = SOLID_TRIGGER;
|
||||
UTIL_SetSize(pev, Vector(-8, -8, 0), Vector(8, 8, 8));
|
||||
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
SetTouch(&CItemSoda::CanTouch);
|
||||
}
|
||||
|
||||
@ -2002,7 +2002,7 @@ void CItemSoda::CanTouch(CBaseEntity *pOther)
|
||||
pev->movetype = MOVETYPE_NONE;
|
||||
pev->effects = EF_NODRAW;
|
||||
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
SetThink(&CItemSoda::SUB_Remove);
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
void SetColor(int r, int g, int b) { pev->rendercolor.x = r; pev->rendercolor.y = g; pev->rendercolor.z = b; }
|
||||
void SetBrightness(int brightness) { pev->renderamt = brightness; }
|
||||
|
||||
void AnimateAndDie(float_precision framerate)
|
||||
void AnimateAndDie(real_t framerate)
|
||||
{
|
||||
SetThink(&CSprite::AnimateUntilDead);
|
||||
pev->framerate = framerate;
|
||||
|
@ -165,8 +165,7 @@ void CEnvExplosion::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
||||
if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSPARKS))
|
||||
{
|
||||
int sparkCount = RANDOM_LONG(0, 3);
|
||||
|
||||
for (int i = 0; i < sparkCount; ++i)
|
||||
for (int i = 0; i < sparkCount; i++)
|
||||
{
|
||||
Create("spark_shower", pev->origin, tr.vecPlaneNormal, nullptr);
|
||||
}
|
||||
@ -194,7 +193,7 @@ void CEnvExplosion::Smoke()
|
||||
}
|
||||
}
|
||||
|
||||
// HACKHACK -- create one of these and fake a keyvalue to get the right explosion setup
|
||||
// HACKHACK: create one of these and fake a keyvalue to get the right explosion setup
|
||||
void ExplosionCreate(const Vector ¢er, Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage)
|
||||
{
|
||||
KeyValueData kvd;
|
||||
|
@ -104,14 +104,14 @@ void CBreakable::Spawn()
|
||||
m_angle = pev->angles.y;
|
||||
pev->angles.y = 0;
|
||||
|
||||
// HACK: matGlass can receive decals, we need the client to know about this
|
||||
// so use class to store the material flag
|
||||
// HACK: matGlass can receive decals, we need the client to know about this
|
||||
// so use class to store the material flag
|
||||
if (m_Material == matGlass)
|
||||
{
|
||||
pev->playerclass = 1;
|
||||
}
|
||||
|
||||
//set size and link into world.
|
||||
// set size and link into world.
|
||||
SET_MODEL(ENT(pev), STRING(pev->model));
|
||||
|
||||
SetTouch(&CBreakable::BreakTouch);
|
||||
@ -119,7 +119,7 @@ void CBreakable::Spawn()
|
||||
// Only break on trigger
|
||||
if (pev->spawnflags & SF_BREAK_TRIGGER_ONLY)
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
|
||||
// Flag unbreakable glass as "worldbrush" so it will block ALL tracelines
|
||||
@ -150,7 +150,7 @@ void CBreakable::Restart()
|
||||
|
||||
if (pev->spawnflags & SF_BREAK_TRIGGER_ONLY)
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
}
|
||||
|
||||
if (!IsBreakable() && pev->rendermode != kRenderNormal)
|
||||
@ -282,7 +282,7 @@ void CBreakable::MaterialSoundPrecache(Materials precacheMaterial)
|
||||
|
||||
pSoundList = MaterialSoundList(precacheMaterial, soundCount);
|
||||
|
||||
for (i = 0; i < soundCount; ++i)
|
||||
for (i = 0; i < soundCount; i++)
|
||||
{
|
||||
PRECACHE_SOUND((char *)pSoundList[i]);
|
||||
}
|
||||
@ -487,7 +487,7 @@ void CBreakable::BreakTouch(CBaseEntity *pOther)
|
||||
|
||||
if (flDamage >= pev->health)
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
TakeDamage(pevToucher, pevToucher, flDamage, DMG_CRUSH);
|
||||
|
||||
// do a little damage to player if we broke glass or computer
|
||||
@ -502,7 +502,7 @@ void CBreakable::BreakTouch(CBaseEntity *pOther)
|
||||
DamageSound();
|
||||
|
||||
SetThink(&CBreakable::Die);
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
|
||||
// BUGBUG: why doesn't zero delay work?
|
||||
if (m_flDelay == 0.0f)
|
||||
@ -803,15 +803,15 @@ void CBreakable::Die()
|
||||
CBaseEntity *pList[256];
|
||||
int count = UTIL_EntitiesInBox(pList, ARRAYSIZE(pList), mins, maxs, FL_ONGROUND);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
pList[i]->pev->flags &= ~FL_ONGROUND;
|
||||
pList[i]->pev->groundentity = nullptr;
|
||||
}
|
||||
|
||||
pev->solid = SOLID_NOT;
|
||||
SUB_UseTargets(NULL, USE_TOGGLE, 0);
|
||||
SetThink(NULL);
|
||||
SUB_UseTargets(nullptr, USE_TOGGLE, 0);
|
||||
SetThink(nullptr);
|
||||
|
||||
pev->nextthink = pev->ltime + 0.1f;
|
||||
|
||||
@ -1023,7 +1023,7 @@ void CPushable::Move(CBaseEntity *pOther, int push)
|
||||
bPlayerTouch = true;
|
||||
}
|
||||
|
||||
float_precision factor;
|
||||
real_t factor;
|
||||
|
||||
if (bPlayerTouch)
|
||||
{
|
||||
@ -1039,12 +1039,14 @@ void CPushable::Move(CBaseEntity *pOther, int push)
|
||||
factor = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
factor = 0.25f;
|
||||
}
|
||||
|
||||
pev->velocity.x += pevToucher->velocity.x * factor;
|
||||
pev->velocity.y += pevToucher->velocity.y * factor;
|
||||
|
||||
float_precision length = Q_sqrt(pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y);
|
||||
real_t length = Q_sqrt(pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y);
|
||||
|
||||
if (push && (length > MaxSpeed()))
|
||||
{
|
||||
|
@ -361,7 +361,7 @@ void CFuncTank::Think()
|
||||
pev->avelocity = g_vecZero;
|
||||
TrackTarget();
|
||||
|
||||
if (fabs(float_precision(pev->avelocity.x)) > 1 || fabs(float_precision(pev->avelocity.y)) > 1)
|
||||
if (Q_fabs(real_t(pev->avelocity.x)) > 1 || Q_fabs(real_t(pev->avelocity.y)) > 1)
|
||||
StartRotSound();
|
||||
else
|
||||
StopRotSound();
|
||||
@ -468,7 +468,7 @@ void CFuncTank::TrackTarget()
|
||||
}
|
||||
|
||||
// Move toward target at rate or less
|
||||
float_precision distY = UTIL_AngleDistance(angles.y, pev->angles.y);
|
||||
real_t distY = UTIL_AngleDistance(angles.y, pev->angles.y);
|
||||
pev->avelocity.y = distY * 10.0f;
|
||||
|
||||
if (pev->avelocity.y > m_yawRate)
|
||||
@ -491,7 +491,7 @@ void CFuncTank::TrackTarget()
|
||||
}
|
||||
|
||||
// Move toward target at rate or less
|
||||
float_precision distX = UTIL_AngleDistance(angles.x, pev->angles.x);
|
||||
real_t distX = UTIL_AngleDistance(angles.x, pev->angles.x);
|
||||
pev->avelocity.x = distX * 10.0f;
|
||||
|
||||
if (pev->avelocity.x > m_pitchRate)
|
||||
@ -508,7 +508,7 @@ void CFuncTank::TrackTarget()
|
||||
return;
|
||||
}
|
||||
|
||||
if (CanFire() && ((fabs(distX) < m_pitchTolerance && fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT)))
|
||||
if (CanFire() && ((Q_fabs(distX) < m_pitchTolerance && Q_fabs(distY) < m_yawTolerance) || (pev->spawnflags & SF_TANK_LINEOFSIGHT)))
|
||||
{
|
||||
bool fire = false;
|
||||
Vector forward;
|
||||
@ -541,7 +541,7 @@ void CFuncTank::TrackTarget()
|
||||
// If barrel is offset, add in additional rotation
|
||||
void CFuncTank::AdjustAnglesForBarrel(Vector &angles, float distance)
|
||||
{
|
||||
float_precision r2, d2;
|
||||
real_t r2, d2;
|
||||
|
||||
if (m_barrelPos.y != 0.0f || m_barrelPos.z != 0.0f)
|
||||
{
|
||||
@ -599,7 +599,7 @@ void CFuncTank::TankTrace(const Vector &vecStart, const Vector &vecForward, cons
|
||||
{
|
||||
// get circular gaussian spread
|
||||
float x, z;
|
||||
float_precision y;
|
||||
real_t y;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -651,9 +651,9 @@ public:
|
||||
VFUNC void SetAccountRules(RewardRules rules, int amount) { m_rgRewardAccountRules[rules] = static_cast<RewardAccount>(amount); }
|
||||
VFUNC RewardAccount GetAccountRules(RewardRules rules) const { return m_rgRewardAccountRules[rules]; }
|
||||
|
||||
void DisplayMaps(CBasePlayer *player, int iVote);
|
||||
void DisplayMaps(CBasePlayer *pPlayer, int iVote);
|
||||
void ResetAllMapVotes();
|
||||
void ProcessMapVote(CBasePlayer *player, int iVote);
|
||||
void ProcessMapVote(CBasePlayer *pPlayer, int iVote);
|
||||
|
||||
// BOMB MAP FUNCTIONS
|
||||
VFUNC BOOL IsThereABomber();
|
||||
|
@ -79,6 +79,7 @@ void CGrenade::Explode(TraceResult *pTrace, int bitsDamageType)
|
||||
pev->velocity = g_vecZero;
|
||||
pev->nextthink = gpGlobals->time + 0.3f;
|
||||
|
||||
// draw sparks
|
||||
if (iContents != CONTENTS_WATER)
|
||||
{
|
||||
int sparkCount = RANDOM_LONG(0, 3);
|
||||
@ -469,7 +470,7 @@ void CGrenade::SG_Smoke()
|
||||
else
|
||||
{
|
||||
Vector origin, angle;
|
||||
float_precision x_old, y_old, R_angle;
|
||||
real_t x_old, y_old, R_angle;
|
||||
|
||||
UTIL_MakeVectors(pev->angles);
|
||||
|
||||
@ -479,8 +480,8 @@ void CGrenade::SG_Smoke()
|
||||
|
||||
R_angle = m_angle / (180.00433335 / M_PI);
|
||||
|
||||
x_old = Q_cos(float_precision(R_angle));
|
||||
y_old = Q_sin(float_precision(R_angle));
|
||||
x_old = Q_cos(real_t(R_angle));
|
||||
y_old = Q_sin(real_t(R_angle));
|
||||
|
||||
angle.x = origin.x * x_old - origin.y * y_old;
|
||||
angle.y = origin.x * y_old + origin.y * x_old;
|
||||
@ -949,18 +950,18 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
|
||||
return;
|
||||
|
||||
// TODO: We must be sure that the activator is a player.
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pActivator->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pActivator->pev);
|
||||
|
||||
// For CTs to defuse the c4
|
||||
if (player->m_iTeam != CT)
|
||||
if (pPlayer->m_iTeam != CT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if((player->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground
|
||||
if((pPlayer->pev->flags & FL_ONGROUND) != FL_ONGROUND) // Defuse should start only on ground
|
||||
{
|
||||
ClientPrint(player->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground");
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#C4_Defuse_Must_Be_On_Ground");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -972,7 +973,7 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
|
||||
}
|
||||
|
||||
// freeze the player in place while defusing
|
||||
SET_CLIENT_MAXSPEED(player->edict(), 1);
|
||||
SET_CLIENT_MAXSPEED(pPlayer->edict(), 1);
|
||||
|
||||
if (TheBots)
|
||||
{
|
||||
@ -984,38 +985,38 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
|
||||
TheCareerTasks->HandleEvent(EVENT_BOMB_DEFUSING);
|
||||
}
|
||||
|
||||
if (player->m_bHasDefuser)
|
||||
if (pPlayer->m_bHasDefuser)
|
||||
{
|
||||
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Begin_Bomb_Defuse_With_Kit\"\n",
|
||||
STRING(player->pev->netname),
|
||||
GETPLAYERUSERID(player->edict()),
|
||||
GETPLAYERAUTHID(player->edict()));
|
||||
STRING(pPlayer->pev->netname),
|
||||
GETPLAYERUSERID(pPlayer->edict()),
|
||||
GETPLAYERAUTHID(pPlayer->edict()));
|
||||
|
||||
// TODO show messages on clients on event
|
||||
ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit");
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Defusing_Bomb_With_Defuse_Kit");
|
||||
|
||||
m_flDefuseCountDown = gpGlobals->time + 5.0f;
|
||||
|
||||
// start the progress bar
|
||||
player->SetProgressBarTime(5);
|
||||
pPlayer->SetProgressBarTime(5);
|
||||
}
|
||||
else
|
||||
{
|
||||
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Begin_Bomb_Defuse_Without_Kit\"\n",
|
||||
STRING(player->pev->netname),
|
||||
GETPLAYERUSERID(player->edict()),
|
||||
GETPLAYERAUTHID(player->edict()));
|
||||
STRING(pPlayer->pev->netname),
|
||||
GETPLAYERUSERID(pPlayer->edict()),
|
||||
GETPLAYERAUTHID(pPlayer->edict()));
|
||||
|
||||
// TODO: show messages on clients on event
|
||||
ClientPrint(player->pev, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit");
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Defusing_Bomb_Without_Defuse_Kit");
|
||||
|
||||
m_flDefuseCountDown = gpGlobals->time + 10.0f;
|
||||
|
||||
// start the progress bar
|
||||
player->SetProgressBarTime(10);
|
||||
pPlayer->SetProgressBarTime(10);
|
||||
}
|
||||
|
||||
player->m_bIsDefusing = true;
|
||||
pPlayer->m_bIsDefusing = true;
|
||||
m_pBombDefuser = static_cast<CBasePlayer *>(pActivator);
|
||||
m_bStartDefuse = true;
|
||||
m_fNextDefuse = gpGlobals->time + NEXT_DEFUSE_TIME;
|
||||
@ -1023,7 +1024,7 @@ void CGrenade::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useTy
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
EMIT_SOUND(edict(), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM); // Emit sound using bomb.
|
||||
#else
|
||||
EMIT_SOUND(ENT(player->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
|
||||
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "weapons/c4_disarm.wav", VOL_NORM, ATTN_NORM);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cG
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < cGibs; ++i)
|
||||
for (int i = 0; i < cGibs; i++)
|
||||
{
|
||||
CGib *pGib = GetClassPtr<CCSGib>((CGib *)nullptr);
|
||||
|
||||
@ -67,7 +67,7 @@ NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cG
|
||||
pGib->pev->solid = SOLID_BBOX;
|
||||
UTIL_SetSize(pGib->pev, Vector(0, 0,0), Vector(0, 0, 0));
|
||||
pGib->SetTouch(&CGib::StickyGibTouch);
|
||||
pGib->SetThink(NULL);
|
||||
pGib->SetThink(nullptr);
|
||||
}
|
||||
|
||||
pGib->LimitVelocity();
|
||||
@ -136,8 +136,7 @@ void CGib::SpawnHeadGib(entvars_t *pevVictim)
|
||||
|
||||
void CGib::SpawnRandomGibs(entvars_t *pevVictim, int cGibs, int human)
|
||||
{
|
||||
int cSplat;
|
||||
for (cSplat = 0; cSplat < cGibs; ++cSplat)
|
||||
for (int cSplat = 0; cSplat < cGibs; cSplat++)
|
||||
{
|
||||
CGib *pGib = GetClassPtr<CCSGib>((CGib *)nullptr);
|
||||
|
||||
|
@ -226,7 +226,7 @@ void CCyclerSprite::Animate(float frames)
|
||||
|
||||
if (m_maxFrame > 0)
|
||||
{
|
||||
pev->frame = Q_fmod(float_precision(pev->frame), float_precision(m_maxFrame));
|
||||
pev->frame = Q_fmod(real_t(pev->frame), real_t(m_maxFrame));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -398,7 +398,9 @@ void CHostage::IdleThink()
|
||||
pPlayer = m_improv->GetFollowLeader();
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)m_hTargetEnt->pev);
|
||||
}
|
||||
|
||||
if (!pPlayer || pPlayer->m_iTeam == CT)
|
||||
{
|
||||
@ -1002,7 +1004,7 @@ void CHostage::Touch(CBaseEntity *pOther)
|
||||
pev->velocity.y += vPush.y;
|
||||
#else
|
||||
// TODO: fix test demo
|
||||
pev->velocity = pev->velocity + NormalizeMulScalar<float_precision, float_precision, float>(vPush, pushForce);
|
||||
pev->velocity = pev->velocity + NormalizeMulScalar<real_t, real_t, float>(vPush, pushForce);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1114,7 +1116,7 @@ void CHostage::MoveToward(const Vector &vecLoc)
|
||||
Vector vecbigDest;
|
||||
Vector vecMove;
|
||||
CBaseEntity *pFollowing;
|
||||
float_precision flDist;
|
||||
real_t flDist;
|
||||
|
||||
pFollowing = GetClassPtr<CCSEntity>((CBaseEntity *)m_hTargetEnt->pev);
|
||||
vecMove = vecLoc - pev->origin;
|
||||
@ -1132,7 +1134,7 @@ void CHostage::MoveToward(const Vector &vecLoc)
|
||||
auto nFwdMove = m_LocalNav->PathTraversable(pev->origin, vecbigDest, FALSE);
|
||||
if (nFwdMove != PTRAVELS_EMPTY)
|
||||
{
|
||||
float_precision flSpeed = 250;
|
||||
real_t flSpeed = 250;
|
||||
|
||||
vecbigDest = pFollowing->pev->origin;
|
||||
vecbigDest.z += pFollowing->pev->mins.z;
|
||||
@ -1480,15 +1482,15 @@ bool CHostageManager::IsNearbyHostageTalking(CHostageImprov *improv)
|
||||
for (int i = 0; i < m_hostageCount; i++)
|
||||
{
|
||||
const float closeRange = 500.0f;
|
||||
const CHostageImprov *other = m_hostage[i]->m_improv;
|
||||
const CHostageImprov *pHostage = m_hostage[i]->m_improv;
|
||||
|
||||
if (!other)
|
||||
if (!pHostage)
|
||||
continue;
|
||||
|
||||
if (!other->IsAlive() || other == improv)
|
||||
if (!pHostage->IsAlive() || pHostage == improv)
|
||||
continue;
|
||||
|
||||
if (!(improv->GetCentroid() - other->GetCentroid()).IsLengthGreaterThan(closeRange) && !other->IsTalking())
|
||||
if (!(improv->GetCentroid() - pHostage->GetCentroid()).IsLengthGreaterThan(closeRange) && !pHostage->IsTalking())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -1501,16 +1503,16 @@ bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv)
|
||||
{
|
||||
for (int i = 0; i < m_hostageCount; i++)
|
||||
{
|
||||
const CHostageImprov *other = m_hostage[i]->m_improv;
|
||||
const CHostageImprov *pHostage = m_hostage[i]->m_improv;
|
||||
|
||||
if (!other)
|
||||
if (!pHostage)
|
||||
continue;
|
||||
|
||||
if (!other->IsAlive() || other == improv)
|
||||
if (!pHostage->IsAlive() || pHostage == improv)
|
||||
continue;
|
||||
|
||||
const float closeRange = 500.0f;
|
||||
if (!(improv->GetCentroid() - other->GetCentroid()).IsLengthGreaterThan(closeRange) && other->IsJumping())
|
||||
if (!(improv->GetCentroid() - pHostage->GetCentroid()).IsLengthGreaterThan(closeRange) && pHostage->IsJumping())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -1519,14 +1521,14 @@ bool CHostageManager::IsNearbyHostageJumping(CHostageImprov *improv)
|
||||
return false;
|
||||
}
|
||||
|
||||
void CHostageManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CHostageManager::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
for (int i = 0; i < m_hostageCount; i++)
|
||||
{
|
||||
CHostageImprov *improv = m_hostage[i]->m_improv;
|
||||
if (improv)
|
||||
{
|
||||
improv->OnGameEvent(event, entity, other);
|
||||
improv->OnGameEvent(event, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1611,23 +1613,21 @@ char *SimpleChatter::GetSound(HostageChatterType type, float *duration)
|
||||
return sound;
|
||||
}
|
||||
|
||||
float SimpleChatter::PlaySound(CBaseEntity *entity, HostageChatterType type)
|
||||
float SimpleChatter::PlaySound(CBaseEntity *pEntity, HostageChatterType type)
|
||||
{
|
||||
CHostage *hostage;
|
||||
float duration;
|
||||
char *sound;
|
||||
int pitch;
|
||||
int attenuation = 1;
|
||||
char *pszSoundName = GetSound(type, &duration);
|
||||
CHostage *pHostage = static_cast<CHostage *>(pEntity);
|
||||
|
||||
sound = GetSound(type, &duration);
|
||||
hostage = static_cast<CHostage *>(entity);
|
||||
|
||||
if (!sound)
|
||||
if (!pszSoundName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (hostage->m_whichModel)
|
||||
int pitch;
|
||||
int attenuation = 1;
|
||||
|
||||
switch (pHostage->m_whichModel)
|
||||
{
|
||||
case CHostage::REGULAR_GUY:
|
||||
pitch = 92;
|
||||
@ -1644,13 +1644,13 @@ float SimpleChatter::PlaySound(CBaseEntity *entity, HostageChatterType type)
|
||||
break;
|
||||
}
|
||||
|
||||
EMIT_SOUND_DYN(ENT(hostage->pev), CHAN_VOICE, sound, VOL_NORM, attenuation, 0, pitch);
|
||||
EMIT_SOUND_DYN(ENT(pHostage->pev), CHAN_VOICE, pszSoundName, VOL_NORM, attenuation, 0, pitch);
|
||||
|
||||
if (type == HOSTAGE_CHATTER_CALL_TO_RESCUER)
|
||||
{
|
||||
if (TheBots)
|
||||
{
|
||||
TheBots->OnEvent(EVENT_HOSTAGE_CALLED_FOR_HELP, hostage);
|
||||
TheBots->OnEvent(EVENT_HOSTAGE_CALLED_FOR_HELP, pHostage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,13 +134,13 @@ public:
|
||||
|
||||
return m_hTargetEnt;
|
||||
}
|
||||
bool IsFollowing(const CBaseEntity *entity = nullptr)
|
||||
bool IsFollowing(const CBaseEntity *pEntity = nullptr)
|
||||
{
|
||||
if (m_improv) {
|
||||
return m_improv->IsFollowing();
|
||||
return m_improv->IsFollowing(pEntity);
|
||||
}
|
||||
|
||||
if ((!entity && !m_hTargetEnt) || (entity && m_hTargetEnt != entity))
|
||||
if ((!pEntity && !m_hTargetEnt) || (pEntity && m_hTargetEnt != pEntity))
|
||||
return false;
|
||||
|
||||
if (m_State != FOLLOW)
|
||||
@ -211,7 +211,7 @@ public:
|
||||
};
|
||||
|
||||
void AddSound(HostageChatterType type, char *filename);
|
||||
float PlaySound(CBaseEntity *entity, HostageChatterType type);
|
||||
float PlaySound(CBaseEntity *pEntity, HostageChatterType type);
|
||||
char *GetSound(HostageChatterType type, float *duration);
|
||||
void Shuffle(ChatterSet *chatter);
|
||||
|
||||
@ -235,7 +235,7 @@ public:
|
||||
}
|
||||
bool IsNearbyHostageTalking(CHostageImprov *improv);
|
||||
bool IsNearbyHostageJumping(CHostageImprov *improv);
|
||||
void OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
|
||||
void OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
|
||||
// Iterate over all active hostages in the game, invoking functor on each.
|
||||
// If functor returns false, stop iteration and return false.
|
||||
|
@ -40,10 +40,10 @@ inline void DrawAxes(const Vector &origin, int red, int green, int blue)
|
||||
UTIL_DrawBeamPoints(origin + Vector(0, 0, size), origin - Vector(0, 0, size), 2, red, green, blue);
|
||||
}
|
||||
|
||||
CHostageImprov::CHostageImprov(CBaseEntity *entity)
|
||||
CHostageImprov::CHostageImprov(CBaseEntity *pEntity)
|
||||
{
|
||||
m_animateState.Reset();
|
||||
m_hostage = static_cast<CHostage *>(entity);
|
||||
m_hostage = static_cast<CHostage *>(pEntity);
|
||||
OnReset();
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ void CHostageImprov::ClearFaceTo()
|
||||
void CHostageImprov::MoveTowards(const Vector &pos, float deltaT)
|
||||
{
|
||||
Vector move;
|
||||
float_precision accelRate;
|
||||
real_t accelRate;
|
||||
const float crouchWalkRate = 250.0f;
|
||||
|
||||
// Jump up on ledges
|
||||
@ -230,9 +230,9 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
|
||||
to.NormalizeInPlace();
|
||||
#else
|
||||
// TODO: fix test demo
|
||||
float_precision float_x = target.x - GetFeet().x;
|
||||
float_precision float_y = target.y - GetFeet().y;
|
||||
float_precision flLen = to.Length();
|
||||
real_t float_x = target.x - GetFeet().x;
|
||||
real_t float_y = target.y - GetFeet().y;
|
||||
real_t flLen = to.Length();
|
||||
|
||||
if (flLen <= 0)
|
||||
{
|
||||
@ -251,7 +251,7 @@ bool CHostageImprov::FaceTowards(const Vector &target, float deltaT)
|
||||
Vector2D lat(BotCOS(moveAngle), BotSIN(moveAngle));
|
||||
Vector2D dir(-lat.y, lat.x);
|
||||
|
||||
float_precision dot = DotProduct(to, dir);
|
||||
real_t dot = DotProduct(to, dir);
|
||||
|
||||
if (DotProduct(to, lat) < 0.0f)
|
||||
{
|
||||
@ -291,21 +291,21 @@ void CHostageImprov::FaceOutwards()
|
||||
|
||||
static Vector corner[] =
|
||||
{
|
||||
Vector(-1000, 1000, 0),
|
||||
Vector(1000, 1000, 0),
|
||||
Vector(-1000, 1000, 0),
|
||||
Vector( 1000, 1000, 0),
|
||||
Vector(-1000, -1000, 0),
|
||||
Vector(1000, -1000, 0)
|
||||
Vector( 1000, -1000, 0)
|
||||
};
|
||||
|
||||
const int cornerCount = ARRAYSIZE(corner);
|
||||
|
||||
for (int i = 0; i < cornerCount; ++i)
|
||||
for (int i = 0; i < cornerCount; i++)
|
||||
{
|
||||
to = GetCentroid() + corner[i];
|
||||
|
||||
UTIL_TraceLine(GetCentroid(), to, ignore_monsters, ignore_glass, m_hostage->edict(), &result);
|
||||
|
||||
float_precision range = (result.vecEndPos - GetCentroid()).LengthSquared();
|
||||
real_t range = (result.vecEndPos - GetCentroid()).LengthSquared();
|
||||
|
||||
if (range > farthestRange)
|
||||
{
|
||||
@ -353,20 +353,20 @@ bool CHostageImprov::IsFriendInTheWay(const Vector &goalPos) const
|
||||
}
|
||||
|
||||
// check if any CT are overlapping this linear path
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (!player->IsAlive() || player->m_iTeam == TERRORIST)
|
||||
if (!pPlayer->IsAlive() || pPlayer->m_iTeam == TERRORIST)
|
||||
continue;
|
||||
|
||||
if (IsFriendInTheWay(player, goalPos))
|
||||
if (IsFriendInTheWay(pPlayer, goalPos))
|
||||
{
|
||||
m_isFriendInTheWay = true;
|
||||
break;
|
||||
@ -529,19 +529,19 @@ bool CHostageImprov::IsVisible(const Vector &pos, bool testFOV) const
|
||||
return result.flFraction == 1.0f;
|
||||
}
|
||||
|
||||
bool CHostageImprov::IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance) const
|
||||
bool CHostageImprov::IsPlayerLookingAtMe(CBasePlayer *pOther, float cosTolerance) const
|
||||
{
|
||||
Vector2D toOther = (other->pev->origin - GetCentroid()).Make2D();
|
||||
Vector2D toOther = (pOther->pev->origin - GetCentroid()).Make2D();
|
||||
toOther.NormalizeInPlace();
|
||||
|
||||
UTIL_MakeVectors(other->pev->punchangle + other->pev->v_angle);
|
||||
UTIL_MakeVectors(pOther->pev->punchangle + pOther->pev->v_angle);
|
||||
|
||||
Vector2D otherDir = gpGlobals->v_forward.Make2D();
|
||||
otherDir.NormalizeInPlace();
|
||||
|
||||
if (-cosTolerance > DotProduct(toOther, otherDir))
|
||||
{
|
||||
if (IsVisible(other->EyePosition()))
|
||||
if (IsVisible(pOther->EyePosition()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -552,18 +552,18 @@ bool CHostageImprov::IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance)
|
||||
|
||||
CBasePlayer *CHostageImprov::IsAnyPlayerLookingAtMe(int team, float cosTolerance) const
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!IsEntityValid(player))
|
||||
if (!IsEntityValid(pPlayer))
|
||||
continue;
|
||||
|
||||
if (player->IsAlive() && (team == UNASSIGNED || player->m_iTeam == team))
|
||||
if (pPlayer->IsAlive() && (team == UNASSIGNED || pPlayer->m_iTeam == team))
|
||||
{
|
||||
if (IsPlayerLookingAtMe(player, cosTolerance))
|
||||
if (IsPlayerLookingAtMe(pPlayer, cosTolerance))
|
||||
{
|
||||
return player;
|
||||
return pPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -579,24 +579,24 @@ CBasePlayer *CHostageImprov::GetClosestPlayerByTravelDistance(int team, float *r
|
||||
if (!GetLastKnownArea())
|
||||
return nullptr;
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!IsEntityValid(player))
|
||||
if (!IsEntityValid(pPlayer))
|
||||
continue;
|
||||
|
||||
if (player->IsAlive() && (team == UNASSIGNED || player->m_iTeam == team))
|
||||
if (pPlayer->IsAlive() && (team == UNASSIGNED || pPlayer->m_iTeam == team))
|
||||
{
|
||||
ShortestPathCost cost;
|
||||
Vector vecCenter = player->Center();
|
||||
Vector vecCenter = pPlayer->Center();
|
||||
|
||||
float_precision range = NavAreaTravelDistance(GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&vecCenter), cost);
|
||||
real_t range = NavAreaTravelDistance(GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&vecCenter), cost);
|
||||
|
||||
if (range > 0 && range < closeRange)
|
||||
{
|
||||
closeRange = range;
|
||||
close = player;
|
||||
close = pPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -670,24 +670,24 @@ void CHostageImprov::UpdateVision()
|
||||
|
||||
m_visiblePlayerCount = 0;
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
if (player->IsAlive() && IsVisible(player->pev->origin, true))
|
||||
if (pPlayer->IsAlive() && IsVisible(pPlayer->pev->origin, true))
|
||||
{
|
||||
m_visiblePlayer[m_visiblePlayerCount] = player;
|
||||
m_visiblePlayer[m_visiblePlayerCount] = pPlayer;
|
||||
|
||||
if (player->m_iTeam == TERRORIST)
|
||||
if (pPlayer->m_iTeam == TERRORIST)
|
||||
m_lastSawT.Start();
|
||||
else
|
||||
m_lastSawCT.Start();
|
||||
@ -904,7 +904,7 @@ void CHostageImprov::UpdatePosition(float deltaT)
|
||||
m_hostage->pev->velocity.x = dir.x * pushSpeed;
|
||||
m_hostage->pev->velocity.y = dir.y * pushSpeed;
|
||||
#else
|
||||
Vector vecRet = NormalizeMulScalar<float_precision, float_precision, float_precision, float>(dir, pushSpeed);
|
||||
Vector vecRet = NormalizeMulScalar<real_t, real_t, real_t, float>(dir, pushSpeed);
|
||||
m_hostage->pev->velocity.x = vecRet.x;
|
||||
m_hostage->pev->velocity.y = vecRet.y;
|
||||
#endif
|
||||
@ -919,8 +919,8 @@ void CHostageImprov::UpdatePosition(float deltaT)
|
||||
if (m_isLookingAt)
|
||||
{
|
||||
Vector angles = UTIL_VecToAngles(m_viewGoal - GetEyes());
|
||||
float_precision pitch = angles.x - m_hostage->pev->angles.x;
|
||||
float_precision yaw = angles.y - m_hostage->pev->angles.y;
|
||||
real_t pitch = angles.x - m_hostage->pev->angles.x;
|
||||
real_t yaw = angles.y - m_hostage->pev->angles.y;
|
||||
|
||||
while (yaw > 180.0f)
|
||||
yaw -= 360.0f;
|
||||
@ -987,7 +987,7 @@ void CHostageImprov::UpdatePosition(float deltaT)
|
||||
m_vel.x += m_vel.x * -friction * deltaT;
|
||||
m_vel.y += m_vel.y * -friction * deltaT;
|
||||
|
||||
float_precision speed = m_vel.NormalizeInPlace();
|
||||
real_t speed = m_vel.NormalizeInPlace();
|
||||
|
||||
const float maxSpeed = 285.0f;
|
||||
if (speed > maxSpeed)
|
||||
@ -1120,7 +1120,7 @@ void CHostageImprov::OnUpdate(float deltaT)
|
||||
if (m_blinkCounter)
|
||||
{
|
||||
m_hostage->pev->body = 1;
|
||||
--m_blinkCounter;
|
||||
m_blinkCounter--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1253,13 +1253,13 @@ void CHostageImprov::OnUpdate(float deltaT)
|
||||
m_animateState.OnUpdate(this);
|
||||
}
|
||||
|
||||
void CHostageImprov::OnGameEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CHostageImprov::OnGameEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case EVENT_BULLET_IMPACT:
|
||||
{
|
||||
Vector *impactPos = (Vector *)other;
|
||||
Vector *impactPos = (Vector *)pOther;
|
||||
const float nearRange = 100.0f;
|
||||
|
||||
if ((GetCentroid() - *impactPos).IsLengthLessThan(nearRange))
|
||||
@ -1270,24 +1270,24 @@ void CHostageImprov::OnGameEvent(GameEventType event, CBaseEntity *entity, CBase
|
||||
}
|
||||
case EVENT_PLAYER_DIED:
|
||||
case EVENT_HOSTAGE_KILLED:
|
||||
if (IsVisible(entity->pev->origin, true))
|
||||
if (IsVisible(pEntity->pev->origin, true))
|
||||
{
|
||||
Frighten(TERRIFIED);
|
||||
|
||||
if (!entity->IsPlayer() || (entity->IsPlayer() && ((CBasePlayer *)entity)->m_iTeam != TERRORIST))
|
||||
if (!pEntity->IsPlayer() || (pEntity->IsPlayer() && ((CBasePlayer *)pEntity)->m_iTeam != TERRORIST))
|
||||
{
|
||||
DelayedChatter(RANDOM_FLOAT(0.5f, 0.7f), HOSTAGE_CHATTER_SCARED_OF_MURDER, true);
|
||||
}
|
||||
if (!entity->IsPlayer())
|
||||
if (!pEntity->IsPlayer())
|
||||
{
|
||||
m_idleState.OnInjury();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVENT_HOSTAGE_RESCUED:
|
||||
if (m_hostage == other)
|
||||
if (m_hostage == pOther)
|
||||
{
|
||||
if (!entity)
|
||||
if (!pEntity)
|
||||
return;
|
||||
|
||||
Chatter(HOSTAGE_CHATTER_RESCUED, false);
|
||||
@ -1309,11 +1309,11 @@ void CHostageImprov::OnGameEvent(GameEventType event, CBaseEntity *entity, CBase
|
||||
PriorityType priority;
|
||||
bool isHostile;
|
||||
|
||||
if (entity && IsGameEventAudible(event, entity, other, &range, &priority, &isHostile))
|
||||
if (pEntity && IsGameEventAudible(event, pEntity, pOther, &range, &priority, &isHostile))
|
||||
{
|
||||
const float fudge = 0.4f;
|
||||
|
||||
if ((m_hostage->pev->origin - entity->pev->origin).IsLengthLessThan(range * fudge))
|
||||
if ((m_hostage->pev->origin - pEntity->pev->origin).IsLengthLessThan(range * fudge))
|
||||
{
|
||||
m_lastNoiseTimer.Start();
|
||||
|
||||
@ -1347,7 +1347,7 @@ void CHostageImprov::OnGameEvent(GameEventType event, CBaseEntity *entity, CBase
|
||||
|
||||
if (event == EVENT_FLASHBANG_GRENADE_EXPLODED)
|
||||
{
|
||||
Vector *impactPos = (Vector *)other;
|
||||
Vector *impactPos = (Vector *)pOther;
|
||||
const float flashRange = 1000.0f;
|
||||
|
||||
if ((GetEyes() - *impactPos).IsLengthLessThan(flashRange) && IsVisible(*impactPos))
|
||||
@ -1358,22 +1358,19 @@ void CHostageImprov::OnGameEvent(GameEventType event, CBaseEntity *entity, CBase
|
||||
}
|
||||
}
|
||||
|
||||
void CHostageImprov::OnTouch(CBaseEntity *other)
|
||||
void CHostageImprov::OnTouch(CBaseEntity *pOther)
|
||||
{
|
||||
const char *classname;
|
||||
Vector2D to;
|
||||
const float pushForce = 20.0f;
|
||||
|
||||
classname = STRING(other->pev->classname);
|
||||
|
||||
if (cv_hostage_debug.value != 0.0)
|
||||
{
|
||||
CONSOLE_ECHO("%5.1f: Hostage hit '%s'\n", gpGlobals->time, classname);
|
||||
CONSOLE_ECHO("%5.1f: Hostage hit '%s'\n", gpGlobals->time, pOther->GetClassname());
|
||||
}
|
||||
|
||||
m_collisionTimer.Start();
|
||||
|
||||
if (FStrEq(classname, "worldspawn"))
|
||||
if (FStrEq(pOther->pev->classname, "worldspawn"))
|
||||
{
|
||||
const float lookAheadRange = 30.0f;
|
||||
float ground;
|
||||
@ -1396,7 +1393,7 @@ void CHostageImprov::OnTouch(CBaseEntity *other)
|
||||
|
||||
Vector pos = alongFloor * lookAheadRange;
|
||||
|
||||
for (float_precision offset = 1.0f; offset <= 18.0f; offset += 3.0f)
|
||||
for (real_t offset = 1.0f; offset <= 18.0f; offset += 3.0f)
|
||||
{
|
||||
Vector vecStart = GetFeet();
|
||||
vecStart.z += offset;
|
||||
@ -1468,13 +1465,13 @@ void CHostageImprov::OnTouch(CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (FStrEq(classname, "func_breakable"))
|
||||
else if (FStrEq(pOther->pev->classname, "func_breakable"))
|
||||
{
|
||||
other->TakeDamage(m_hostage->pev, m_hostage->pev, 9999.9, DMG_BULLET);
|
||||
pOther->TakeDamage(m_hostage->pev, m_hostage->pev, 9999.9, DMG_BULLET);
|
||||
}
|
||||
else if (other->IsPlayer() || FClassnameIs(other->pev, "hostage_entity"))
|
||||
else if (pOther->IsPlayer() || FClassnameIs(pOther->pev, "hostage_entity"))
|
||||
{
|
||||
to = (m_hostage->pev->origin - other->pev->origin).Make2D();
|
||||
to = (m_hostage->pev->origin - pOther->pev->origin).Make2D();
|
||||
to.NormalizeInPlace();
|
||||
|
||||
m_vel.x += to.x * pushForce;
|
||||
@ -1511,14 +1508,14 @@ CBasePlayer *CHostageImprov::GetClosestVisiblePlayer(int team)
|
||||
CBasePlayer *close = nullptr;
|
||||
float closeRangeSq = 1e8f;
|
||||
|
||||
for (int i = 0; i < m_visiblePlayerCount; ++i)
|
||||
for (int i = 0; i < m_visiblePlayerCount; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = m_visiblePlayer[i];
|
||||
|
||||
if (!pPlayer || (team > 0 && pPlayer->m_iTeam != team))
|
||||
continue;
|
||||
|
||||
float_precision rangeSq = (GetCentroid() - pPlayer->pev->origin).LengthSquared();
|
||||
real_t rangeSq = (GetCentroid() - pPlayer->pev->origin).LengthSquared();
|
||||
|
||||
if (rangeSq < closeRangeSq)
|
||||
{
|
||||
@ -1822,18 +1819,18 @@ void CHostageImprov::ClearPath()
|
||||
|
||||
if (result.pHit)
|
||||
{
|
||||
entvars_t *entity = VARS(result.pHit);
|
||||
if (FClassnameIs(entity, "func_door") || FClassnameIs(entity, "func_door_rotating"))
|
||||
edict_t *pEntity = result.pHit;
|
||||
if (FClassnameIs(pEntity, "func_door") || FClassnameIs(pEntity, "func_door_rotating"))
|
||||
{
|
||||
CBaseEntity *pObject = CBaseEntity::Instance(entity);
|
||||
CBaseEntity *pObject = CBaseEntity::Instance(pEntity);
|
||||
if (pObject)
|
||||
{
|
||||
pObject->Touch(m_hostage);
|
||||
}
|
||||
}
|
||||
else if (FClassnameIs(entity, "func_breakable") && entity->takedamage == DAMAGE_YES)
|
||||
else if (FClassnameIs(pEntity, "func_breakable") && pEntity->v.takedamage == DAMAGE_YES)
|
||||
{
|
||||
CBaseEntity *pObject = CBaseEntity::Instance(entity);
|
||||
CBaseEntity *pObject = CBaseEntity::Instance(pEntity);
|
||||
if (pObject)
|
||||
{
|
||||
pObject->TakeDamage(m_hostage->pev, m_hostage->pev, 9999.9, DMG_BULLET);
|
||||
|
@ -38,7 +38,7 @@ enum HostageChatterType;
|
||||
class CHostageImprov: public CImprov
|
||||
{
|
||||
public:
|
||||
CHostageImprov(CBaseEntity *entity = nullptr);
|
||||
CHostageImprov(CBaseEntity *pEntity = nullptr);
|
||||
~CHostageImprov() {};
|
||||
|
||||
// invoked when an improv reaches its MoveTo goal
|
||||
@ -98,18 +98,18 @@ public:
|
||||
virtual bool CanCrouch() const { return true; }
|
||||
virtual bool CanJump() const { return true; }
|
||||
virtual bool IsVisible(const Vector &pos, bool testFOV = false) const; // return true if hostage can see position
|
||||
virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const;
|
||||
virtual bool IsPlayerLookingAtMe(CBasePlayer *pOther, float cosTolerance = 0.95f) const;
|
||||
virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const;
|
||||
virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = nullptr) const;
|
||||
virtual CNavArea *GetLastKnownArea() const { return m_lastKnownArea; }
|
||||
virtual void OnUpdate(float deltaT);
|
||||
virtual void OnUpkeep(float deltaT);
|
||||
virtual void OnReset();
|
||||
virtual void OnGameEvent(GameEventType event, CBaseEntity *entity = nullptr, CBaseEntity *other = nullptr);
|
||||
virtual void OnTouch(CBaseEntity *other); // in contact with "other"
|
||||
virtual void OnGameEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr);
|
||||
virtual void OnTouch(CBaseEntity *pOther); // in contact with "other"
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
void ApplyForce2(float_precision x, float_precision y);
|
||||
void ApplyForce2(real_t x, real_t y);
|
||||
#endif
|
||||
|
||||
public:
|
||||
@ -353,19 +353,19 @@ public:
|
||||
m_velDir = improv->GetActualVelocity();
|
||||
m_speed = m_velDir.NormalizeInPlace();
|
||||
}
|
||||
bool operator()(CBaseEntity *entity)
|
||||
bool operator()(CBaseEntity *pEntity)
|
||||
{
|
||||
const float space = 1.0f;
|
||||
Vector to;
|
||||
float range;
|
||||
|
||||
if (entity == reinterpret_cast<CBaseEntity *>(m_improv->GetEntity()))
|
||||
if (pEntity == reinterpret_cast<CBaseEntity *>(m_improv->GetEntity()))
|
||||
return true;
|
||||
|
||||
if (entity->IsPlayer() && !entity->IsAlive())
|
||||
if (pEntity->IsPlayer() && !pEntity->IsAlive())
|
||||
return true;
|
||||
|
||||
to = entity->pev->origin - m_improv->GetCentroid();
|
||||
to = pEntity->pev->origin - m_improv->GetCentroid();
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
// TODO: fix test demo
|
||||
@ -374,7 +374,7 @@ public:
|
||||
range = to.NormalizeInPlace();
|
||||
#endif
|
||||
|
||||
CBasePlayer *player = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
|
||||
const float spring = 50.0f;
|
||||
const float damper = 1.0f;
|
||||
@ -383,11 +383,11 @@ public:
|
||||
return true;
|
||||
|
||||
const float cosTolerance = 0.8f;
|
||||
if (entity->IsPlayer() && player->m_iTeam == CT && !m_improv->IsFollowing() && m_improv->IsPlayerLookingAtMe(player, cosTolerance))
|
||||
if (pEntity->IsPlayer() && pPlayer->m_iTeam == CT && !m_improv->IsFollowing() && m_improv->IsPlayerLookingAtMe(pPlayer, cosTolerance))
|
||||
return true;
|
||||
|
||||
const float minSpace = (spring - range);
|
||||
float_precision ds = -minSpace;
|
||||
real_t ds = -minSpace;
|
||||
|
||||
#ifndef PLAY_GAMEDLL
|
||||
m_improv->ApplyForce(to * ds);
|
||||
@ -417,16 +417,16 @@ public:
|
||||
m_dir = Vector(BotCOS(me->GetMoveAngle()), BotSIN(me->GetMoveAngle()), 0.0f);
|
||||
m_isBlocked = false;
|
||||
}
|
||||
bool operator()(CBaseEntity *entity)
|
||||
bool operator()(CBaseEntity *pEntity)
|
||||
{
|
||||
Vector to;
|
||||
float_precision range;
|
||||
real_t range;
|
||||
const float closeRange = 60.0f;
|
||||
const float aheadTolerance = 0.95f;
|
||||
|
||||
if (entity != reinterpret_cast<CBaseEntity *>(m_me->GetEntity()))
|
||||
if (pEntity != reinterpret_cast<CBaseEntity *>(m_me->GetEntity()))
|
||||
{
|
||||
to = (entity->Center() - m_me->GetCentroid());
|
||||
to = (pEntity->Center() - m_me->GetCentroid());
|
||||
range = to.NormalizeInPlace();
|
||||
|
||||
if (range <= closeRange && DotProduct(to, m_dir) >= aheadTolerance)
|
||||
@ -444,7 +444,7 @@ private:
|
||||
};
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
inline void CHostageImprov::ApplyForce2(float_precision x, float_precision y)
|
||||
inline void CHostageImprov::ApplyForce2(real_t x, real_t y)
|
||||
{
|
||||
m_vel.x += x;
|
||||
m_vel.y += y;
|
||||
|
@ -129,7 +129,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
|
||||
offsetYAbs = offsetY;
|
||||
|
||||
vecSource = m_vecStartingLoc;
|
||||
vecDest = vecSource + Vector(float_precision(offsetX) * HOSTAGE_STEPSIZE, float_precision(offsetY) * HOSTAGE_STEPSIZE, 0);
|
||||
vecDest = vecSource + Vector(real_t(offsetX) * HOSTAGE_STEPSIZE, real_t(offsetY) * HOSTAGE_STEPSIZE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -149,7 +149,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY,
|
||||
}
|
||||
|
||||
vecSource = nodeCurrent->vecLoc;
|
||||
vecDest = vecSource + Vector((float_precision(offsetX) * HOSTAGE_STEPSIZE), (float_precision(offsetY) * HOSTAGE_STEPSIZE), 0);
|
||||
vecDest = vecSource + Vector((real_t(offsetX) * HOSTAGE_STEPSIZE), (real_t(offsetY) * HOSTAGE_STEPSIZE), 0);
|
||||
|
||||
if (m_nindexAvailableNode)
|
||||
{
|
||||
@ -230,15 +230,13 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
|
||||
|
||||
if (!nodeCurrent->fSearched)
|
||||
{
|
||||
float_precision flCurrentVal;
|
||||
float_precision flDistFromStart;
|
||||
real_t flCurrentVal;
|
||||
real_t flDistFromStart;
|
||||
|
||||
float flDistToDest;
|
||||
float_precision flZDiff = -1.0;
|
||||
real_t flZDiff = -1.0;
|
||||
|
||||
flDistFromStart = LengthSubtract
|
||||
<float_precision, float_precision,
|
||||
float_precision, float_precision>(vecDest, nodeCurrent->vecLoc);
|
||||
flDistFromStart = LengthSubtract<real_t, real_t, real_t, real_t>(vecDest, nodeCurrent->vecLoc);
|
||||
|
||||
flDistToDest = nodeCurrent->vecLoc.z - vecDest.z;
|
||||
if (flDistToDest >= 0.0)
|
||||
@ -251,7 +249,7 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest)
|
||||
else
|
||||
flZDiff = 1.25;
|
||||
|
||||
flCurrentVal = flZDiff * (float_precision(nodeCurrent->bDepth) * HOSTAGE_STEPSIZE + flDistFromStart);
|
||||
flCurrentVal = flZDiff * (real_t(nodeCurrent->bDepth) * HOSTAGE_STEPSIZE + flDistFromStart);
|
||||
if (flCurrentVal < flBestVal)
|
||||
{
|
||||
flBestVal = flCurrentVal;
|
||||
@ -307,7 +305,7 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg
|
||||
|
||||
localnode_t *node;
|
||||
Vector vecNodeLoc;
|
||||
float_precision flDistToDest;
|
||||
real_t flDistToDest;
|
||||
|
||||
m_vecStartingLoc = vecStart;
|
||||
m_nindexAvailableNode = 0;
|
||||
@ -400,7 +398,7 @@ node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float
|
||||
Vector vecNodeLoc;
|
||||
node_index_t nIndexLast;
|
||||
|
||||
vecPathDir = NormalizeSubtract<float_precision, float, float, float_precision>(vecStart, vecDest);
|
||||
vecPathDir = NormalizeSubtract<real_t, float, float, real_t>(vecStart, vecDest);
|
||||
vecActualDest = vecDest - (vecPathDir * flTargetRadius);
|
||||
|
||||
if (PathTraversable(vecStart, vecActualDest, fNoMonsters) == PTRAVELS_EMPTY)
|
||||
@ -457,7 +455,7 @@ PathTraversAble CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, B
|
||||
Vector vecSrcTmp;
|
||||
Vector vecDestTmp;
|
||||
Vector vecDir;
|
||||
float_precision flTotal;
|
||||
real_t flTotal;
|
||||
auto retval = PTRAVELS_EMPTY;
|
||||
|
||||
vecSrcTmp = vecSource;
|
||||
@ -585,7 +583,7 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, BOOL fNoMon
|
||||
vecDown = vecDest - vecSource;
|
||||
|
||||
vecAngles = UTIL_VecToAngles(tr.vecPlaneNormal);
|
||||
vecSlopeEnd.z = vecDown.Length2D() * Q_tan(float_precision((90.0 - vecAngles.x) * (M_PI / 180))) + vecSource.z;
|
||||
vecSlopeEnd.z = vecDown.Length2D() * Q_tan(real_t((90.0 - vecAngles.x) * (M_PI / 180))) + vecSource.z;
|
||||
|
||||
if (!PathClear(vecSource, vecSlopeEnd, fNoMonsters, tr))
|
||||
{
|
||||
@ -773,15 +771,11 @@ BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr)
|
||||
|
||||
void CLocalNav::Think()
|
||||
{
|
||||
static cvar_t *sv_stepsize = NULL;
|
||||
if (gpGlobals->time >= m_flNextCvarCheck)
|
||||
{
|
||||
if (sv_stepsize != NULL)
|
||||
m_flStepSize = sv_stepsize->value;
|
||||
else
|
||||
if (g_psv_stepsize)
|
||||
{
|
||||
sv_stepsize = CVAR_GET_POINTER("sv_stepsize");
|
||||
m_flStepSize = sv_stepsize ? sv_stepsize->value : 18;
|
||||
m_flStepSize = g_psv_stepsize->value;
|
||||
}
|
||||
|
||||
m_flNextCvarCheck = gpGlobals->time + 1.0f;
|
||||
|
@ -181,7 +181,7 @@ public:
|
||||
virtual void UpdateStationaryAnimation(CHostageImprov *improv);
|
||||
|
||||
public:
|
||||
void SetLeader(CBasePlayer *leader) { m_leader = leader; }
|
||||
void SetLeader(CBasePlayer *pLeader) { m_leader = pLeader; }
|
||||
CBasePlayer *GetLeader() const { return m_leader; }
|
||||
|
||||
private:
|
||||
|
@ -159,10 +159,10 @@ void HostageEscapeState::OnUpdate(CHostageImprov *improv)
|
||||
else
|
||||
improv->Run();
|
||||
|
||||
CBasePlayer *player = improv->GetClosestVisiblePlayer(UNASSIGNED);
|
||||
if (player)
|
||||
CBasePlayer *pPlayer = improv->GetClosestVisiblePlayer(UNASSIGNED);
|
||||
if (pPlayer)
|
||||
{
|
||||
if (player->m_iTeam != TERRORIST)
|
||||
if (pPlayer->m_iTeam != TERRORIST)
|
||||
{
|
||||
improv->Stop();
|
||||
improv->Idle();
|
||||
@ -170,7 +170,7 @@ void HostageEscapeState::OnUpdate(CHostageImprov *improv)
|
||||
}
|
||||
|
||||
const float farRange = 750.0f;
|
||||
if ((player->pev->origin - improv->GetCentroid()).IsLengthGreaterThan(farRange))
|
||||
if ((pPlayer->pev->origin - improv->GetCentroid()).IsLengthGreaterThan(farRange))
|
||||
{
|
||||
improv->Frighten(CHostageImprov::NERVOUS);
|
||||
|
||||
|
@ -65,7 +65,7 @@ void HostageFollowState::OnUpdate(CHostageImprov *improv)
|
||||
return;
|
||||
}
|
||||
|
||||
float_precision range = (m_leader->pev->origin - improv->GetCentroid()).Length();
|
||||
real_t range = (m_leader->pev->origin - improv->GetCentroid()).Length();
|
||||
|
||||
const float maxPathLength = 3000.0f;
|
||||
const float giveUpRange = 1000.0f;
|
||||
|
@ -122,7 +122,7 @@ void CItem::ItemTouch(CBaseEntity *pOther)
|
||||
if (MyTouch(pPlayer))
|
||||
{
|
||||
SUB_UseTargets(pOther, USE_TOGGLE, 0);
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
g_pGameRules->PlayerGotItem(pPlayer, this);
|
||||
|
||||
if (g_pGameRules->ItemShouldRespawn(this) == GR_ITEM_RESPAWN_YES)
|
||||
@ -138,7 +138,7 @@ void CItem::ItemTouch(CBaseEntity *pOther)
|
||||
|
||||
CBaseEntity *CItem::Respawn()
|
||||
{
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
|
||||
pev->effects |= EF_NODRAW;
|
||||
|
||||
|
@ -144,26 +144,16 @@ void CEnvLight::KeyValue(KeyValueData *pkvd)
|
||||
|
||||
void CEnvLight::Spawn()
|
||||
{
|
||||
#ifdef HOOK_GAMEDLL
|
||||
// NOTE: fix negative the values for function sprintf from STD C++:
|
||||
// expected - sv_skyvec_y "0.000000"
|
||||
// with using sprintf from STD C++, got - sv_skyvec_y "-0.000000"
|
||||
// If we not doing it then the test will be failed!
|
||||
#define SPRINTF_OLD_STD_FIX + 0
|
||||
#else
|
||||
#define SPRINTF_OLD_STD_FIX
|
||||
#endif
|
||||
|
||||
char szVector[64];
|
||||
UTIL_MakeAimVectors(pev->angles);
|
||||
|
||||
Q_sprintf(szVector, "%f", gpGlobals->v_forward.x SPRINTF_OLD_STD_FIX);
|
||||
Q_sprintf(szVector, "%f", gpGlobals->v_forward.x);
|
||||
CVAR_SET_STRING("sv_skyvec_x", szVector);
|
||||
|
||||
Q_sprintf(szVector, "%f", gpGlobals->v_forward.y SPRINTF_OLD_STD_FIX);
|
||||
Q_sprintf(szVector, "%f", gpGlobals->v_forward.y);
|
||||
CVAR_SET_STRING("sv_skyvec_y", szVector);
|
||||
|
||||
Q_sprintf(szVector, "%f", gpGlobals->v_forward.z SPRINTF_OLD_STD_FIX);
|
||||
Q_sprintf(szVector, "%f", gpGlobals->v_forward.z);
|
||||
CVAR_SET_STRING("sv_skyvec_z", szVector);
|
||||
|
||||
CLight::Spawn();
|
||||
|
@ -470,7 +470,11 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
|
||||
m_iCareerMatchWins = 0;
|
||||
|
||||
m_iRoundWinDifference = int(CVAR_GET_FLOAT("mp_windifference"));
|
||||
CCareerTaskManager::Create();
|
||||
|
||||
if (IsCareer())
|
||||
{
|
||||
CCareerTaskManager::Create();
|
||||
}
|
||||
|
||||
if (m_iRoundWinDifference < 1)
|
||||
{
|
||||
@ -620,15 +624,15 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GiveC4)()
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player || FNullEnt(player->edict()))
|
||||
if (!pPlayer || FNullEnt(pPlayer->edict()))
|
||||
continue;
|
||||
|
||||
if (player->pev->deadflag != DEAD_NO || player->m_iTeam != TERRORIST)
|
||||
if (pPlayer->pev->deadflag != DEAD_NO || pPlayer->m_iTeam != TERRORIST)
|
||||
continue;
|
||||
|
||||
if (!player->IsBot())
|
||||
if (!pPlayer->IsBot())
|
||||
humansPresent++;
|
||||
}
|
||||
|
||||
@ -645,25 +649,25 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GiveC4)()
|
||||
}
|
||||
|
||||
// Give the C4 to the specified T player..
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (!pPlayer->IsPlayer())
|
||||
if (!pEntity->IsPlayer())
|
||||
continue;
|
||||
|
||||
if (pPlayer->pev->flags == FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
if (player->pev->deadflag != DEAD_NO || player->m_iTeam != TERRORIST || (giveToHumans && player->IsBot()))
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
if (pPlayer->pev->deadflag != DEAD_NO || pPlayer->m_iTeam != TERRORIST || (giveToHumans && pPlayer->IsBot()))
|
||||
continue;
|
||||
|
||||
if (++iTemp == m_iC4Guy)
|
||||
{
|
||||
if (player->MakeBomber())
|
||||
if (pPlayer->MakeBomber())
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// we already have bomber
|
||||
@ -677,25 +681,25 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(GiveC4)()
|
||||
if (!IsThereABomber())
|
||||
{
|
||||
m_iC4Guy = 0;
|
||||
pPlayer = nullptr;
|
||||
pEntity = nullptr;
|
||||
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (!pPlayer->IsPlayer())
|
||||
if (!pEntity->IsPlayer())
|
||||
continue;
|
||||
|
||||
if (pPlayer->pev->flags == FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
if (player->pev->deadflag != DEAD_NO || player->m_iTeam != TERRORIST)
|
||||
if (pPlayer->pev->deadflag != DEAD_NO || pPlayer->m_iTeam != TERRORIST)
|
||||
continue;
|
||||
|
||||
player->MakeBomber();
|
||||
pPlayer->MakeBomber();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -862,44 +866,28 @@ void CHalfLifeMultiplay::InitializePlayerCounts(int &NumAliveTerrorist, int &Num
|
||||
// initialize count dead/alive players
|
||||
|
||||
// Count how many dead players there are on each team.
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
{
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
}
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
|
||||
if (pPlayer->pev->flags == FL_DORMANT)
|
||||
{
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: check it out, for what here used player->IsBot() ?
|
||||
// maybe body this conditions is located under the wrapper #ifdef 0
|
||||
// if (player->IsBot())
|
||||
// {
|
||||
// #ifdef 0
|
||||
// ....
|
||||
// #endif
|
||||
// }
|
||||
|
||||
switch (player->m_iTeam)
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
switch (pPlayer->m_iTeam)
|
||||
{
|
||||
case CT:
|
||||
{
|
||||
m_iNumCT++;
|
||||
|
||||
if (player->m_iMenu != Menu_ChooseAppearance)
|
||||
if (pPlayer->m_iMenu != Menu_ChooseAppearance)
|
||||
{
|
||||
m_iNumSpawnableCT++;
|
||||
//player->IsBot();
|
||||
}
|
||||
|
||||
//player->IsBot();
|
||||
if (player->pev->deadflag != DEAD_NO)
|
||||
if (pPlayer->pev->deadflag != DEAD_NO)
|
||||
NumDeadCT++;
|
||||
else
|
||||
NumAliveCT++;
|
||||
@ -910,20 +898,18 @@ void CHalfLifeMultiplay::InitializePlayerCounts(int &NumAliveTerrorist, int &Num
|
||||
{
|
||||
m_iNumTerrorist++;
|
||||
|
||||
if (player->m_iMenu != Menu_ChooseAppearance)
|
||||
if (pPlayer->m_iMenu != Menu_ChooseAppearance)
|
||||
{
|
||||
m_iNumSpawnableTerrorist++;
|
||||
//player->IsBot();
|
||||
}
|
||||
//player->IsBot();
|
||||
|
||||
if (player->pev->deadflag != DEAD_NO)
|
||||
if (pPlayer->pev->deadflag != DEAD_NO)
|
||||
NumDeadTerrorist++;
|
||||
else
|
||||
NumAliveTerrorist++;
|
||||
|
||||
// Check to see if this guy escaped.
|
||||
if (player->m_bEscaped)
|
||||
if (pPlayer->m_bEscaped)
|
||||
m_iHaveEscaped++;
|
||||
|
||||
break;
|
||||
@ -1006,8 +992,8 @@ bool EXT_FUNC CHalfLifeMultiplay::NeededPlayersCheck()
|
||||
{
|
||||
if (IsCareer())
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(gpGlobals->maxClients);
|
||||
if (!player || !player->IsBot())
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(gpGlobals->maxClients);
|
||||
if (!pPlayer || !pPlayer->IsBot())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -1180,7 +1166,7 @@ bool EXT_FUNC CHalfLifeMultiplay::PrisonRoundEndCheck(int NumAliveTerrorist, int
|
||||
// checks to scenario Escaped Terrorist's
|
||||
if (m_bMapHasEscapeZone)
|
||||
{
|
||||
m_flEscapeRatio = float_precision(m_iHaveEscaped) / float_precision(m_iNumEscapers);
|
||||
m_flEscapeRatio = real_t(m_iHaveEscaped) / real_t(m_iNumEscapers);
|
||||
|
||||
if (m_flEscapeRatio >= m_flRequiredEscapeRatio)
|
||||
{
|
||||
@ -1330,7 +1316,7 @@ bool CHalfLifeMultiplay::TeamExterminationCheck(int NumAliveTerrorist, int NumAl
|
||||
CGrenade *pBomb = nullptr;
|
||||
bool nowin = false;
|
||||
|
||||
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
while ((pBomb = UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
{
|
||||
if (pBomb->m_bIsC4 && !pBomb->m_bJustBlew)
|
||||
{
|
||||
@ -1368,7 +1354,7 @@ bool CHalfLifeMultiplay::Hostage_Rescue(float tmDelay)
|
||||
|
||||
if (!m_bNeededPlayers)
|
||||
{
|
||||
++m_iNumCTWins;
|
||||
m_iNumCTWins++;
|
||||
// Update the clients team score
|
||||
UpdateTeamScores();
|
||||
}
|
||||
@ -1401,27 +1387,27 @@ bool CHalfLifeMultiplay::Hostage_Rescue(float tmDelay)
|
||||
bool CHalfLifeMultiplay::HostageRescueRoundEndCheck()
|
||||
{
|
||||
// Check to see if 50% of the hostages have been rescued.
|
||||
CBaseEntity *hostage = nullptr;
|
||||
int iHostages = 0;
|
||||
CBaseEntity *pHostage = nullptr;
|
||||
int hostagesCount = 0;
|
||||
|
||||
// Assume that all hostages are either rescued or dead..
|
||||
bool bHostageAlive = false;
|
||||
|
||||
while ((hostage = UTIL_FindEntityByClassname(hostage, "hostage_entity")))
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
iHostages++;
|
||||
hostagesCount++;
|
||||
|
||||
// We've found a live hostage. don't end the round
|
||||
if (hostage->IsAlive())
|
||||
if (pHostage->IsAlive())
|
||||
{
|
||||
bHostageAlive = true;
|
||||
}
|
||||
}
|
||||
|
||||
// There are no hostages alive.. check to see if the CTs have rescued atleast 50% of them.
|
||||
if (!bHostageAlive && iHostages > 0)
|
||||
if (!bHostageAlive && hostagesCount > 0)
|
||||
{
|
||||
if (m_iHostagesRescued >= (iHostages * 0.5f))
|
||||
if (m_iHostagesRescued >= (hostagesCount * 0.5f))
|
||||
{
|
||||
return OnRoundEnd_Intercept(WINSTATUS_CTS, ROUND_ALL_HOSTAGES_RESCUED, GetRoundRestartDelay());
|
||||
}
|
||||
@ -1432,18 +1418,18 @@ bool CHalfLifeMultiplay::HostageRescueRoundEndCheck()
|
||||
|
||||
void CHalfLifeMultiplay::SwapAllPlayers()
|
||||
{
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (pPlayer->pev->flags == FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
player->SwitchTeam();
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
pPlayer->SwitchTeam();
|
||||
}
|
||||
|
||||
// Swap Team victories
|
||||
@ -1520,23 +1506,23 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(BalanceTeams)()
|
||||
iHighestUserID = 0;
|
||||
toSwap = nullptr;
|
||||
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
|
||||
// search for player with highest UserID = most recently joined to switch over
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (pPlayer->pev->flags == FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
if (player->m_iTeam == iTeamToSwap && GETPLAYERUSERID(player->edict()) > iHighestUserID && m_pVIP != player)
|
||||
if (pPlayer->m_iTeam == iTeamToSwap && GETPLAYERUSERID(pPlayer->edict()) > iHighestUserID && m_pVIP != pPlayer)
|
||||
{
|
||||
iHighestUserID = GETPLAYERUSERID(player->edict());
|
||||
toSwap = player;
|
||||
iHighestUserID = GETPLAYERUSERID(pPlayer->edict());
|
||||
toSwap = pPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1600,7 +1586,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(RestartRound)()
|
||||
if (!m_bCompleteReset)
|
||||
#endif
|
||||
{
|
||||
++m_iTotalRoundsPlayed;
|
||||
m_iTotalRoundsPlayed++;
|
||||
}
|
||||
|
||||
ClearBodyQue();
|
||||
@ -1659,10 +1645,12 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(RestartRound)()
|
||||
|
||||
if ((m_iNumCT - m_iNumTerrorist) >= 2 || (m_iNumTerrorist - m_iNumCT) >= 2)
|
||||
{
|
||||
++m_iUnBalancedRounds;
|
||||
m_iUnBalancedRounds++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iUnBalancedRounds = 0;
|
||||
}
|
||||
|
||||
// Warn the players of an impending auto-balance next round...
|
||||
if (shouldBalancedOnNextRound() && m_iUnBalancedRounds == 1)
|
||||
@ -1720,10 +1708,11 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(RestartRound)()
|
||||
// Reset the player stats
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *plr = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (plr && !FNullEnt(plr->pev))
|
||||
plr->Reset();
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (pPlayer && !FNullEnt(pPlayer->pev))
|
||||
{
|
||||
pPlayer->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (TheBots)
|
||||
@ -1885,68 +1874,68 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(RestartRound)()
|
||||
#endif
|
||||
|
||||
// tell bots that the round is restarting
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (pPlayer->pev->flags == FL_DORMANT)
|
||||
if (pEntity->pev->flags == FL_DORMANT)
|
||||
continue;
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
player->m_iNumSpawns = 0;
|
||||
player->m_bTeamChanged = false;
|
||||
pPlayer->m_iNumSpawns = 0;
|
||||
pPlayer->m_bTeamChanged = false;
|
||||
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
// NOTE: unreachable code
|
||||
if (!player->IsPlayer())
|
||||
if (!pPlayer->IsPlayer())
|
||||
{
|
||||
player->SyncRoundTimer();
|
||||
pPlayer->SyncRoundTimer();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (player->m_iTeam == CT)
|
||||
if (pPlayer->m_iTeam == CT)
|
||||
{
|
||||
if (!player->m_bReceivesNoMoneyNextRound)
|
||||
if (!pPlayer->m_bReceivesNoMoneyNextRound)
|
||||
{
|
||||
player->AddAccount(m_iAccountCT, RT_ROUND_BONUS);
|
||||
pPlayer->AddAccount(m_iAccountCT, RT_ROUND_BONUS);
|
||||
}
|
||||
}
|
||||
else if (player->m_iTeam == TERRORIST)
|
||||
else if (pPlayer->m_iTeam == TERRORIST)
|
||||
{
|
||||
// Add another potential escaper to the mix!
|
||||
m_iNumEscapers++;
|
||||
|
||||
if (!player->m_bReceivesNoMoneyNextRound)
|
||||
if (!pPlayer->m_bReceivesNoMoneyNextRound)
|
||||
{
|
||||
player->AddAccount(m_iAccountTerrorist, RT_ROUND_BONUS);
|
||||
pPlayer->AddAccount(m_iAccountTerrorist, RT_ROUND_BONUS);
|
||||
}
|
||||
|
||||
// If it's a prison scenario then remove the Ts guns
|
||||
if (m_bMapHasEscapeZone)
|
||||
{
|
||||
// this will cause them to be reset with default weapons, armor, and items
|
||||
player->m_bNotKilled = false;
|
||||
pPlayer->m_bNotKilled = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->m_iTeam != UNASSIGNED && player->m_iTeam != SPECTATOR)
|
||||
if (pPlayer->m_iTeam != UNASSIGNED && pPlayer->m_iTeam != SPECTATOR)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// remove the c4 if the player is carrying it
|
||||
if (player->m_bHasC4) {
|
||||
player->RemoveBomb();
|
||||
if (pPlayer->m_bHasC4) {
|
||||
pPlayer->RemoveBomb();
|
||||
}
|
||||
#else
|
||||
// drop the c4 if the player is carrying it
|
||||
if (player->m_bHasC4) {
|
||||
player->DropPlayerItem("weapon_c4");
|
||||
if (pPlayer->m_bHasC4) {
|
||||
pPlayer->DropPlayerItem("weapon_c4");
|
||||
}
|
||||
#endif
|
||||
|
||||
player->RoundRespawn();
|
||||
pPlayer->RoundRespawn();
|
||||
}
|
||||
|
||||
// Gooseman : The following code fixes the HUD icon bug
|
||||
@ -1986,8 +1975,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(RestartRound)()
|
||||
BOOL CHalfLifeMultiplay::IsThereABomber()
|
||||
{
|
||||
CBasePlayer *pPlayer = nullptr;
|
||||
|
||||
while ((pPlayer = (CBasePlayer *)UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
break;
|
||||
@ -2066,7 +2054,7 @@ BOOL CHalfLifeMultiplay::TeamStacked(int newTeam_id, int curTeam_id)
|
||||
|
||||
void CHalfLifeMultiplay::StackVIPQueue()
|
||||
{
|
||||
for (int i = MAX_VIP_QUEUES - 2; i > 0; --i)
|
||||
for (int i = MAX_VIP_QUEUES - 2; i > 0; i--)
|
||||
{
|
||||
if (m_pVIPQueue[i - 1])
|
||||
{
|
||||
@ -2211,66 +2199,62 @@ void CHalfLifeMultiplay::PickNextVIP()
|
||||
|
||||
int iCount = 1;
|
||||
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
CBasePlayer *player = nullptr;
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
CBasePlayer *pLastPlayer = nullptr;
|
||||
|
||||
pPlayer = UTIL_FindEntityByClassname(pPlayer, "player");
|
||||
|
||||
while (pPlayer && !FNullEnt(pPlayer->edict()))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (!(pPlayer->pev->flags & FL_DORMANT))
|
||||
if (!FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
if (pPlayer->m_iTeam == CT && iCount == m_iLastPick)
|
||||
{
|
||||
player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
if (pPlayer == m_pVIP && pLastPlayer)
|
||||
pPlayer = pLastPlayer;
|
||||
|
||||
if (player->m_iTeam == CT && iCount == m_iLastPick)
|
||||
// Remove the current VIP from his VIP status and make him a regular CT.
|
||||
if (m_pVIP)
|
||||
{
|
||||
if (player == m_pVIP && pLastPlayer)
|
||||
player = pLastPlayer;
|
||||
|
||||
// Remove the current VIP from his VIP status and make him a regular CT.
|
||||
if (m_pVIP)
|
||||
{
|
||||
ResetCurrentVIP();
|
||||
}
|
||||
|
||||
player->MakeVIP();
|
||||
m_iConsecutiveVIP = 0;
|
||||
|
||||
return;
|
||||
ResetCurrentVIP();
|
||||
}
|
||||
else if (player->m_iTeam == CT)
|
||||
iCount++;
|
||||
|
||||
if (player->m_iTeam != SPECTATOR)
|
||||
pLastPlayer = player;
|
||||
pPlayer->MakeVIP();
|
||||
m_iConsecutiveVIP = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
pPlayer = UTIL_FindEntityByClassname(pPlayer, "player");
|
||||
if (pPlayer->m_iTeam == CT)
|
||||
iCount++;
|
||||
|
||||
if (pPlayer->m_iTeam != SPECTATOR)
|
||||
pLastPlayer = pPlayer;
|
||||
}
|
||||
}
|
||||
// There is no VIP and there is no one waiting to be the VIP.. therefore just pick the first CT player we can find.
|
||||
else if (m_pVIP == nullptr)
|
||||
{
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
CBasePlayer *player = nullptr;
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
|
||||
pPlayer = UTIL_FindEntityByClassname(pPlayer, "player");
|
||||
while (pPlayer && !FNullEnt(pPlayer->edict()))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (pPlayer->pev->flags != FL_DORMANT)
|
||||
if (!FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
if (pEntity->IsDormant())
|
||||
continue;
|
||||
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
if (pPlayer->m_iTeam == CT)
|
||||
{
|
||||
player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
|
||||
if (player->m_iTeam == CT)
|
||||
{
|
||||
player->MakeVIP();
|
||||
m_iConsecutiveVIP = 0;
|
||||
return;
|
||||
}
|
||||
pPlayer->MakeVIP();
|
||||
m_iConsecutiveVIP = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
pPlayer = UTIL_FindEntityByClassname(pPlayer, "player");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3041,7 +3025,7 @@ bool CHalfLifeMultiplay::IsBombPlanted()
|
||||
if (m_bMapHasBombTarget)
|
||||
{
|
||||
CGrenade *bomb = nullptr;
|
||||
while ((bomb = (CGrenade *)UTIL_FindEntityByClassname(bomb, "grenade")))
|
||||
while ((bomb = UTIL_FindEntityByClassname(bomb, "grenade")))
|
||||
{
|
||||
if (bomb->m_bIsC4)
|
||||
{
|
||||
@ -3053,22 +3037,21 @@ bool CHalfLifeMultiplay::IsBombPlanted()
|
||||
return false;
|
||||
}
|
||||
|
||||
// living players on the given team need to be marked as not receiving any money
|
||||
// next round.
|
||||
// Living players on the given team need to be marked as not receiving any money next round.
|
||||
void CHalfLifeMultiplay::MarkLivingPlayersOnTeamAsNotReceivingMoneyNextRound(int iTeam)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player || FNullEnt(player->pev))
|
||||
if (!pPlayer || FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (player->m_iTeam == iTeam)
|
||||
if (pPlayer->m_iTeam == iTeam)
|
||||
{
|
||||
if (player->pev->health > 0 && player->pev->deadflag == DEAD_NO)
|
||||
if (pPlayer->pev->health > 0 && pPlayer->pev->deadflag == DEAD_NO)
|
||||
{
|
||||
player->m_bReceivesNoMoneyNextRound = true;
|
||||
pPlayer->m_bReceivesNoMoneyNextRound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3097,14 +3080,14 @@ void CHalfLifeMultiplay::CareerRestart()
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player || FNullEnt(player->pev))
|
||||
if (!pPlayer || FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (!player->IsBot())
|
||||
if (!pPlayer->IsBot())
|
||||
{
|
||||
player->ForceClientDllUpdate();
|
||||
pPlayer->ForceClientDllUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3379,7 +3362,7 @@ void CHalfLifeMultiplay::InitHUD(CBasePlayer *pl)
|
||||
else
|
||||
{
|
||||
CGrenade *bomb = nullptr;
|
||||
while ((bomb = (CGrenade *)UTIL_FindEntityByClassname(bomb, "grenade")))
|
||||
while ((bomb = UTIL_FindEntityByClassname(bomb, "grenade")))
|
||||
{
|
||||
if (bomb->m_bIsC4)
|
||||
{
|
||||
@ -3477,22 +3460,22 @@ void CHalfLifeMultiplay::ClientDisconnected(edict_t *pClient)
|
||||
pPlayer->m_pObserver->SUB_Remove();
|
||||
}
|
||||
|
||||
CBasePlayer *pClient = nullptr;
|
||||
while ((pClient = UTIL_FindEntityByClassname(pClient, "player")))
|
||||
CBasePlayer *pObserver = nullptr;
|
||||
while ((pObserver = UTIL_FindEntityByClassname(pObserver, "player")))
|
||||
{
|
||||
if (FNullEnt(pClient->edict()))
|
||||
if (FNullEnt(pObserver->edict()))
|
||||
break;
|
||||
|
||||
if (!pClient->pev || pClient == pPlayer)
|
||||
if (!pObserver->pev || pObserver == pPlayer)
|
||||
continue;
|
||||
|
||||
// If a spectator was chasing this player, move him/her onto the next player
|
||||
if (pClient->m_hObserverTarget == pPlayer)
|
||||
if (pObserver->m_hObserverTarget == pPlayer)
|
||||
{
|
||||
int iMode = pClient->pev->iuser1;
|
||||
int iMode = pObserver->pev->iuser1;
|
||||
|
||||
pClient->pev->iuser1 = OBS_NONE;
|
||||
pClient->Observer_SetMode(iMode);
|
||||
pObserver->pev->iuser1 = OBS_NONE;
|
||||
pObserver->Observer_SetMode(iMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4170,10 +4153,7 @@ int CHalfLifeMultiplay::PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pT
|
||||
return GR_NOTTEAMMATE;
|
||||
}
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
CBasePlayer *target = GetClassPtr<CCSPlayer>((CBasePlayer *)pTarget->pev);
|
||||
|
||||
if (player->m_iTeam != target->m_iTeam)
|
||||
if (pPlayer->m_iTeam != static_cast<CBasePlayer *>(pTarget)->m_iTeam)
|
||||
{
|
||||
return GR_NOTTEAMMATE;
|
||||
}
|
||||
@ -4428,40 +4408,67 @@ void ExtractCommandString(char *s, char *szCommand)
|
||||
char value[512]; // use two buffers so compares
|
||||
|
||||
// work without stomping on each other
|
||||
char *o;
|
||||
char *c;
|
||||
int nCount;
|
||||
|
||||
if (*s == '\\')
|
||||
s++;
|
||||
|
||||
while (true)
|
||||
while (*s)
|
||||
{
|
||||
o = pkey;
|
||||
if (*s == '\\')
|
||||
{
|
||||
// skip the slash
|
||||
s++;
|
||||
}
|
||||
|
||||
// Copy a key
|
||||
c = pkey;
|
||||
nCount = 0;
|
||||
|
||||
while (*s != '\\')
|
||||
{
|
||||
if (!*s)
|
||||
{
|
||||
return;
|
||||
// allow value to be ended with NULL
|
||||
break;
|
||||
}
|
||||
|
||||
*o++ = *s++;
|
||||
if (nCount >= sizeof(pkey))
|
||||
{
|
||||
s++;
|
||||
// skip oversized key chars till the slash or EOL
|
||||
continue;
|
||||
}
|
||||
|
||||
*c++ = *s++;
|
||||
nCount++;
|
||||
}
|
||||
|
||||
*o = '\0';
|
||||
s++;
|
||||
*c = '\0';
|
||||
s++; // skip the slash
|
||||
|
||||
o = value;
|
||||
// Copy a value
|
||||
c = value;
|
||||
nCount = 0;
|
||||
|
||||
while (*s != '\\' && *s)
|
||||
while (*s != '\\')
|
||||
{
|
||||
if (!*s)
|
||||
{
|
||||
return;
|
||||
// allow value to be ended with NULL
|
||||
break;
|
||||
}
|
||||
|
||||
*o++ = *s++;
|
||||
if (nCount >= sizeof(value))
|
||||
{
|
||||
s++;
|
||||
// skip oversized value chars till the slash or EOL
|
||||
continue;
|
||||
}
|
||||
|
||||
*c++ = *s++;
|
||||
nCount++;
|
||||
}
|
||||
|
||||
*o = '\0';
|
||||
*c = '\0';
|
||||
|
||||
Q_strcat(szCommand, pkey);
|
||||
if (Q_strlen(value) > 0)
|
||||
@ -4471,29 +4478,28 @@ void ExtractCommandString(char *s, char *szCommand)
|
||||
}
|
||||
Q_strcat(szCommand, "\n");
|
||||
|
||||
if (!*s)
|
||||
/*if (!*s)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s++;
|
||||
s++;*/
|
||||
}
|
||||
}
|
||||
|
||||
void CHalfLifeMultiplay::ResetAllMapVotes()
|
||||
{
|
||||
CBaseEntity *pTempEntity = nullptr;
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
|
||||
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pTempEntity->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
CBasePlayer *pTempPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pTempEntity->pev);
|
||||
|
||||
if (pTempPlayer->m_iTeam != UNASSIGNED)
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
if (pPlayer->m_iTeam != UNASSIGNED)
|
||||
{
|
||||
pTempPlayer->m_iMapVote = 0;
|
||||
pPlayer->m_iMapVote = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4517,14 +4523,14 @@ int GetMapCount()
|
||||
if (!item)
|
||||
break;
|
||||
|
||||
++nCount;
|
||||
nCount++;
|
||||
item = item->next;
|
||||
} while (item != mapcycle.next_item);
|
||||
|
||||
return nCount;
|
||||
}
|
||||
|
||||
void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote)
|
||||
void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *pPlayer, int iVote)
|
||||
{
|
||||
static mapcycle_t mapcycle2;
|
||||
char *mapcfile = (char *)CVAR_GET_STRING("mapcyclefile");
|
||||
@ -4541,16 +4547,18 @@ void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote)
|
||||
if (item->next == mapcycle2.next_item)
|
||||
done = 1;
|
||||
|
||||
++iCount;
|
||||
iCount++;
|
||||
|
||||
if (player)
|
||||
if (pPlayer)
|
||||
{
|
||||
if (m_iMapVotes[iCount] == 1)
|
||||
{
|
||||
ClientPrint(player->pev, HUD_PRINTCONSOLE, "#Vote", UTIL_dtos1(iCount), item->mapname, UTIL_dtos2(1));
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTCONSOLE, "#Vote", UTIL_dtos1(iCount), item->mapname, UTIL_dtos2(1));
|
||||
}
|
||||
else
|
||||
ClientPrint(player->pev, HUD_PRINTCONSOLE, "#Votes", UTIL_dtos1(iCount), item->mapname, UTIL_dtos2(m_iMapVotes[iCount]));
|
||||
{
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTCONSOLE, "#Votes", UTIL_dtos1(iCount), item->mapname, UTIL_dtos2(m_iMapVotes[iCount]));
|
||||
}
|
||||
}
|
||||
|
||||
if (iCount == iVote)
|
||||
@ -4581,24 +4589,24 @@ void CHalfLifeMultiplay::DisplayMaps(CBasePlayer *player, int iVote)
|
||||
ResetAllMapVotes();
|
||||
}
|
||||
|
||||
void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote)
|
||||
void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *pPlayer, int iVote)
|
||||
{
|
||||
CBaseEntity *pTempEntity = nullptr;
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
int iValidVotes = 0, iNumPlayers = 0;
|
||||
|
||||
while ((pTempEntity = UTIL_FindEntityByClassname(pTempEntity, "player")))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pTempEntity->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
CBasePlayer *pTempPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pTempEntity->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
if (pTempPlayer->m_iTeam != UNASSIGNED)
|
||||
if (pPlayer->m_iTeam != UNASSIGNED)
|
||||
{
|
||||
++iNumPlayers;
|
||||
iNumPlayers++;
|
||||
|
||||
if (pTempPlayer->m_iMapVote == iVote)
|
||||
++iValidVotes;
|
||||
if (pPlayer->m_iMapVote == iVote)
|
||||
iValidVotes++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4624,11 +4632,13 @@ void CHalfLifeMultiplay::ProcessMapVote(CBasePlayer *player, int iVote)
|
||||
|
||||
if (iValidVotes < iRequiredVotes)
|
||||
{
|
||||
DisplayMaps(player, 0);
|
||||
ClientPrint(player->pev, HUD_PRINTCONSOLE, "#Game_required_votes", UTIL_dtos1(iRequiredVotes));
|
||||
DisplayMaps(pPlayer, 0);
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTCONSOLE, "#Game_required_votes", UTIL_dtos1(iRequiredVotes));
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayMaps(nullptr, iVote);
|
||||
}
|
||||
}
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, ChangeLevel);
|
||||
|
@ -201,7 +201,7 @@ CPathTrack *CPathTrack::LookAhead(Vector *origin, float dist, int move)
|
||||
while (dist > 0)
|
||||
{
|
||||
Vector dir = pcurrent->pev->origin - currentPos;
|
||||
float_precision length = dir.Length();
|
||||
real_t length = dir.Length();
|
||||
|
||||
if (!length)
|
||||
{
|
||||
@ -260,7 +260,7 @@ CPathTrack *CPathTrack::LookAhead(Vector *origin, float dist, int move)
|
||||
}
|
||||
|
||||
Vector dir = pcurrent->GetNext()->pev->origin - currentPos;
|
||||
float_precision length = dir.Length();
|
||||
real_t length = dir.Length();
|
||||
|
||||
if (!length && !ValidPath(pcurrent->GetNext()->GetNext(), move))
|
||||
{
|
||||
|
@ -356,7 +356,7 @@ void CFuncPlat::PlatUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
||||
}
|
||||
else
|
||||
{
|
||||
SetUse(NULL);
|
||||
SetUse(nullptr);
|
||||
|
||||
if (m_toggle_state == TS_AT_TOP)
|
||||
{
|
||||
@ -829,7 +829,7 @@ void CFuncTrain::Restart()
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->velocity = g_vecZero;
|
||||
|
||||
// restore of first target
|
||||
@ -958,7 +958,7 @@ void CFuncTrackTrain::Blocked(CBaseEntity *pOther)
|
||||
// Blocker is on-ground on the train
|
||||
if ((pevOther->flags & FL_ONGROUND) && VARS(pevOther->groundentity) == pev)
|
||||
{
|
||||
float_precision deltaSpeed = Q_fabs(float_precision(pev->speed));
|
||||
real_t deltaSpeed = Q_fabs(real_t(pev->speed));
|
||||
|
||||
if (deltaSpeed > 50)
|
||||
{
|
||||
@ -1004,12 +1004,12 @@ void CFuncTrackTrain::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYP
|
||||
pev->velocity = g_vecZero;
|
||||
pev->avelocity = g_vecZero;
|
||||
StopSound();
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float_precision delta = (int(pev->speed * 4.0f) / int(m_speed)) * 0.25 + 0.25 * value;
|
||||
real_t delta = (int(pev->speed * 4.0f) / int(m_speed)) * 0.25 + 0.25 * value;
|
||||
|
||||
if (delta > 1)
|
||||
delta = 1;
|
||||
@ -1115,8 +1115,8 @@ void CFuncTrackTrain::Next()
|
||||
pev->velocity = (nextPos - pev->origin) * 10;
|
||||
#else
|
||||
// TODO: fix test demo
|
||||
pev->velocity.x = (float_precision(nextPos.x - pev->origin.x) * 10.0f);
|
||||
pev->velocity.y = (float_precision(nextPos.y - pev->origin.y) * 10.0f);
|
||||
pev->velocity.x = (real_t(nextPos.x - pev->origin.x) * 10.0f);
|
||||
pev->velocity.y = (real_t(nextPos.y - pev->origin.y) * 10.0f);
|
||||
pev->velocity.z = ((nextPos.z - pev->origin.z) * 10.0f);
|
||||
#endif
|
||||
|
||||
@ -1140,7 +1140,7 @@ void CFuncTrackTrain::Next()
|
||||
// TODO: All of this crap has to be done to make the angles not wrap around, revisit this.
|
||||
UTIL_FixupAngles(angles);
|
||||
#else
|
||||
float_precision fixAngleY = angles.y + 180.0f;
|
||||
real_t fixAngleY = angles.y + 180.0f;
|
||||
|
||||
angles.x = UTIL_FixupAngle(angles.x);
|
||||
angles.y = UTIL_FixupAngle(fixAngleY); // TODO: fix test demo
|
||||
@ -1388,7 +1388,7 @@ void CFuncTrackTrain::NearestPath()
|
||||
{
|
||||
CPathTrack *pTrack = nullptr;
|
||||
CPathTrack *pNearest = nullptr;
|
||||
float_precision dist;
|
||||
real_t dist;
|
||||
float closest = 1024.0f;
|
||||
|
||||
while ((pTrack = UTIL_FindEntityInSphere(pTrack, pev->origin, 1024.0f)))
|
||||
@ -1409,7 +1409,7 @@ void CFuncTrackTrain::NearestPath()
|
||||
if (!pNearest)
|
||||
{
|
||||
ALERT(at_console, "Can't find a nearby track !!!\n");
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1732,7 +1732,7 @@ TRAIN_CODE CFuncTrackChange::EvaluateTrain(CPathTrack *pcurrent)
|
||||
return TRAIN_BLOCKING;
|
||||
|
||||
Vector dist = pev->origin - m_train->pev->origin;
|
||||
float_precision length = dist.Length2D();
|
||||
real_t length = dist.Length2D();
|
||||
|
||||
// Empirically determined close distance
|
||||
if (length < m_train->m_length)
|
||||
@ -1750,7 +1750,7 @@ TRAIN_CODE CFuncTrackChange::EvaluateTrain(CPathTrack *pcurrent)
|
||||
|
||||
void CFuncTrackChange::UpdateTrain(Vector &dest)
|
||||
{
|
||||
float_precision time = (pev->nextthink - pev->ltime);
|
||||
real_t time = (pev->nextthink - pev->ltime);
|
||||
|
||||
m_train->pev->velocity = pev->velocity;
|
||||
m_train->pev->avelocity = pev->avelocity;
|
||||
@ -1904,7 +1904,7 @@ void CFuncTrackChange::HitBottom()
|
||||
//UpdateTrain();
|
||||
m_train->SetTrack(m_trackBottom);
|
||||
}
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->nextthink = -1;
|
||||
|
||||
UpdateAutoTargets(m_toggle_state);
|
||||
@ -1922,7 +1922,7 @@ void CFuncTrackChange::HitTop()
|
||||
}
|
||||
|
||||
// Don't let the plat go back down
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
pev->nextthink = -1;
|
||||
|
||||
UpdateAutoTargets(m_toggle_state);
|
||||
@ -2076,7 +2076,7 @@ void CGunTarget::Start()
|
||||
|
||||
void CGunTarget::Next()
|
||||
{
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
|
||||
m_hTargetEnt = GetNextTarget();
|
||||
CBaseEntity *pTarget = m_hTargetEnt;
|
||||
|
@ -318,7 +318,6 @@ CBasePlayer *CBasePlayer::GetNextRadioRecipient(CBasePlayer *pStartPlayer)
|
||||
else if (pPlayer)
|
||||
{
|
||||
int iSpecMode = IsObserver();
|
||||
|
||||
if (iSpecMode != OBS_CHASE_LOCKED && iSpecMode != OBS_CHASE_FREE && iSpecMode != OBS_IN_EYE)
|
||||
continue;
|
||||
|
||||
@ -386,9 +385,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Radio)(const char *msg_id, const char *msg
|
||||
if (!FNullEnt(pPlayer->m_hObserverTarget))
|
||||
continue;
|
||||
|
||||
CBasePlayer *pTarget = static_cast<CBasePlayer *>(CBaseEntity::Instance(pPlayer->m_hObserverTarget->pev));
|
||||
|
||||
if (pTarget && pTarget->m_iTeam == m_iTeam)
|
||||
if (m_hObserverTarget && m_hObserverTarget->m_iTeam == m_iTeam)
|
||||
{
|
||||
bSend = true;
|
||||
}
|
||||
@ -440,9 +437,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Radio)(const char *msg_id, const char *msg
|
||||
MESSAGE_BEGIN(MSG_ONE, SVC_TEMPENTITY, nullptr, pEntity->pev);
|
||||
WRITE_BYTE(TE_PLAYERATTACHMENT);
|
||||
WRITE_BYTE(ENTINDEX(edict())); // byte (entity index of player)
|
||||
WRITE_COORD(35); // coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset)
|
||||
WRITE_COORD(35); // coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset)
|
||||
WRITE_SHORT(g_sModelIndexRadio); // short (model index) of tempent
|
||||
WRITE_SHORT(15); // short (life * 10 ) e.g. 40 = 4 seconds
|
||||
WRITE_SHORT(15); // short (life * 10 ) e.g. 40 = 4 seconds
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
@ -814,7 +811,6 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
BOOL bTeamAttack = FALSE;
|
||||
int armorHit = 0;
|
||||
CBasePlayer *pAttack = nullptr;
|
||||
CBaseEntity *pAttacker = nullptr;
|
||||
|
||||
if (bitsDamageType & (DMG_EXPLOSION | DMG_BLAST | DMG_FALL))
|
||||
m_LastHitGroup = HITGROUP_GENERIC;
|
||||
@ -865,8 +861,8 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
|
||||
if (pev->armorvalue != 0.0f && IsArmored(m_LastHitGroup))
|
||||
{
|
||||
float_precision flNew = flRatio * flDamage;
|
||||
float_precision flArmor = (flDamage - flNew) * flBonus;
|
||||
real_t flNew = flRatio * flDamage;
|
||||
real_t flArmor = (flDamage - flNew) * flBonus;
|
||||
|
||||
// Does this use more armor than we have?
|
||||
if (flArmor > pev->armorvalue)
|
||||
@ -894,7 +890,9 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
Pain(m_LastHitGroup, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pain(m_LastHitGroup, false);
|
||||
}
|
||||
|
||||
m_lastDamageAmount = flDamage;
|
||||
|
||||
@ -922,23 +920,12 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
TheBots->OnEvent(EVENT_PLAYER_TOOK_DAMAGE, this, pAttack);
|
||||
}
|
||||
|
||||
if (CSGameRules()->IsCareer())
|
||||
if (TheCareerTasks)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
CBasePlayer *pPlayerAttacker = CBasePlayer::Instance(pevAttacker);
|
||||
if (pPlayerAttacker && !pPlayerAttacker->IsBot() && pPlayerAttacker->m_iTeam != m_iTeam)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
bool killedByHumanPlayer = (!pPlayer->IsBot() && pPlayer->pev == pevAttacker && pPlayer->m_iTeam != m_iTeam);
|
||||
if (killedByHumanPlayer)
|
||||
{
|
||||
if (TheCareerTasks)
|
||||
{
|
||||
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayer->HasShield(), pPlayer);
|
||||
}
|
||||
}
|
||||
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayerAttacker->HasShield(), pPlayerAttacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -981,7 +968,7 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
return bTookDamage;
|
||||
}
|
||||
|
||||
pAttacker = CBaseEntity::Instance(pevAttacker);
|
||||
CBaseEntity *pAttacker = CBaseEntity::Instance(pevAttacker);
|
||||
|
||||
if (!g_pGameRules->FPlayerCanTakeDamage(this, pAttacker) && !FClassnameIs(pevInflictor, "grenade"))
|
||||
{
|
||||
@ -1028,17 +1015,17 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
bTeamAttack = TRUE;
|
||||
if (gpGlobals->time > pAttack->m_flLastAttackedTeammate + 0.6f)
|
||||
{
|
||||
CBaseEntity *pBasePlayer = nullptr;
|
||||
while ((pBasePlayer = UTIL_FindEntityByClassname(pBasePlayer, "player")))
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pBasePlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
CBasePlayer *basePlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pBasePlayer->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
if (basePlayer->m_iTeam == m_iTeam)
|
||||
if (pPlayer->m_iTeam == m_iTeam)
|
||||
{
|
||||
ClientPrint(basePlayer->pev, HUD_PRINTTALK, "#Game_teammate_attack", STRING(pAttack->pev->netname));
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTTALK, "#Game_teammate_attack", STRING(pAttack->pev->netname));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1113,6 +1100,7 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
|
||||
m_flVelocityModifier = 0.65f;
|
||||
}
|
||||
|
||||
SetAnimation(PLAYER_LARGE_FLINCH);
|
||||
}
|
||||
}
|
||||
@ -1124,8 +1112,8 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
// armor doesn't protect against fall or drown damage!
|
||||
if (pev->armorvalue != 0.0f && !(bitsDamageType & (DMG_DROWN | DMG_FALL)) && IsArmored(m_LastHitGroup))
|
||||
{
|
||||
float_precision flNew = flRatio * flDamage;
|
||||
float_precision flArmor = (flDamage - flNew) * flBonus;
|
||||
real_t flNew = flRatio * flDamage;
|
||||
real_t flArmor = (flDamage - flNew) * flBonus;
|
||||
|
||||
// Does this use more armor than we have?
|
||||
if (flArmor > pev->armorvalue)
|
||||
@ -1155,7 +1143,9 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
Pain(m_LastHitGroup, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pain(m_LastHitGroup, false);
|
||||
}
|
||||
|
||||
LogAttack(pAttack, this, bTeamAttack, flDamage, armorHit, pev->health - flDamage, pev->armorvalue, GetWeaponName(pevInflictor, pevAttacker));
|
||||
|
||||
@ -1170,23 +1160,12 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(TakeDamage)(entvars_t *pevInflictor, entva
|
||||
TheBots->OnEvent(EVENT_PLAYER_TOOK_DAMAGE, this, pAttack);
|
||||
}
|
||||
|
||||
if (CSGameRules()->IsCareer())
|
||||
if (TheCareerTasks)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
CBasePlayer *pPlayerAttacker = CBasePlayer::Instance(pevAttacker);
|
||||
if (pPlayerAttacker && !pPlayerAttacker->IsBot() && pPlayerAttacker->m_iTeam != m_iTeam)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
bool killedByHumanPlayer = (!pPlayer->IsBot() && pPlayer->pev == pevAttacker && pPlayer->m_iTeam != m_iTeam);
|
||||
if (killedByHumanPlayer)
|
||||
{
|
||||
if (TheCareerTasks)
|
||||
{
|
||||
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayer->HasShield(), pPlayer);
|
||||
}
|
||||
}
|
||||
TheCareerTasks->HandleEnemyInjury(GetWeaponName(pevInflictor, pevAttacker), pPlayerAttacker->HasShield(), pPlayerAttacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1598,19 +1577,19 @@ void CBasePlayer::SetProgressBarTime(int time)
|
||||
WRITE_SHORT(time);
|
||||
MESSAGE_END();
|
||||
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
int myIndex = entindex();
|
||||
int playerIndex = entindex();
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
if (player->IsObserver() == OBS_IN_EYE && player->pev->iuser2 == myIndex)
|
||||
if (pPlayer->IsObserver() == OBS_IN_EYE && pPlayer->pev->iuser2 == playerIndex)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBarTime, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBarTime, nullptr, pPlayer->pev);
|
||||
WRITE_SHORT(time);
|
||||
MESSAGE_END();
|
||||
}
|
||||
@ -1638,19 +1617,19 @@ void CBasePlayer::SetProgressBarTime2(int time, float timeElapsed)
|
||||
WRITE_SHORT(iTimeElapsed);
|
||||
MESSAGE_END();
|
||||
|
||||
CBaseEntity *pPlayer = nullptr;
|
||||
int myIndex = entindex();
|
||||
int playerIndex = entindex();
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
|
||||
while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")))
|
||||
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
|
||||
{
|
||||
if (FNullEnt(pPlayer->edict()))
|
||||
if (FNullEnt(pEntity->edict()))
|
||||
break;
|
||||
|
||||
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pPlayer->pev);
|
||||
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pEntity->pev);
|
||||
|
||||
if (player->IsObserver() == OBS_IN_EYE && player->pev->iuser2 == myIndex)
|
||||
if (pPlayer->IsObserver() == OBS_IN_EYE && pPlayer->pev->iuser2 == playerIndex)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBarTime2, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBarTime2, nullptr, pPlayer->pev);
|
||||
WRITE_SHORT(time);
|
||||
WRITE_SHORT(iTimeElapsed);
|
||||
MESSAGE_END();
|
||||
@ -1658,9 +1637,9 @@ void CBasePlayer::SetProgressBarTime2(int time, float timeElapsed)
|
||||
}
|
||||
}
|
||||
|
||||
void BuyZoneIcon_Set(CBasePlayer *player)
|
||||
void BuyZoneIcon_Set(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_SHOW);
|
||||
WRITE_STRING("buyzone");
|
||||
WRITE_BYTE(0);
|
||||
@ -1669,45 +1648,46 @@ void BuyZoneIcon_Set(CBasePlayer *player)
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
void BuyZoneIcon_Clear(CBasePlayer *player)
|
||||
void BuyZoneIcon_Clear(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_HIDE);
|
||||
WRITE_STRING("buyzone");
|
||||
MESSAGE_END();
|
||||
|
||||
if (player->m_iMenu >= Menu_Buy)
|
||||
if (pPlayer->m_iMenu >= Menu_Buy)
|
||||
{
|
||||
if (player->m_iMenu <= Menu_BuyItem)
|
||||
if (pPlayer->m_iMenu <= Menu_BuyItem)
|
||||
{
|
||||
CLIENT_COMMAND(ENT(player->pev), "slot10\n");
|
||||
CLIENT_COMMAND(ENT(pPlayer->pev), "slot10\n");
|
||||
}
|
||||
else if (player->m_iMenu == Menu_ClientBuy)
|
||||
else if (pPlayer->m_iMenu == Menu_ClientBuy)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, pPlayer->pev);
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BombTargetFlash_Set(CBasePlayer *player)
|
||||
void BombTargetFlash_Set(CBasePlayer *pPlayer)
|
||||
{
|
||||
if (player->m_bHasC4 && !(player->m_flDisplayHistory & DHF_IN_TARGET_ZONE))
|
||||
if (pPlayer->m_bHasC4 && !(pPlayer->m_flDisplayHistory & DHF_IN_TARGET_ZONE))
|
||||
{
|
||||
player->m_flDisplayHistory |= DHF_IN_TARGET_ZONE;
|
||||
player->HintMessage("#Hint_you_are_in_targetzone");
|
||||
pPlayer->m_flDisplayHistory |= DHF_IN_TARGET_ZONE;
|
||||
pPlayer->HintMessage("#Hint_you_are_in_targetzone");
|
||||
}
|
||||
player->SetBombIcon(TRUE);
|
||||
|
||||
pPlayer->SetBombIcon(TRUE);
|
||||
}
|
||||
|
||||
void BombTargetFlash_Clear(CBasePlayer *player)
|
||||
void BombTargetFlash_Clear(CBasePlayer *pPlayer)
|
||||
{
|
||||
player->SetBombIcon(FALSE);
|
||||
pPlayer->SetBombIcon(FALSE);
|
||||
}
|
||||
|
||||
void RescueZoneIcon_Set(CBasePlayer *player)
|
||||
void RescueZoneIcon_Set(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_SHOW);
|
||||
WRITE_STRING("rescue");
|
||||
WRITE_BYTE(0);
|
||||
@ -1715,37 +1695,37 @@ void RescueZoneIcon_Set(CBasePlayer *player)
|
||||
WRITE_BYTE(0);
|
||||
MESSAGE_END();
|
||||
|
||||
if (player->m_iTeam == CT && !(player->m_flDisplayHistory & DHF_IN_RESCUE_ZONE))
|
||||
if (pPlayer->m_iTeam == CT && !(pPlayer->m_flDisplayHistory & DHF_IN_RESCUE_ZONE))
|
||||
{
|
||||
player->m_flDisplayHistory |= DHF_IN_RESCUE_ZONE;
|
||||
player->HintMessage("#Hint_hostage_rescue_zone");
|
||||
pPlayer->m_flDisplayHistory |= DHF_IN_RESCUE_ZONE;
|
||||
pPlayer->HintMessage("#Hint_hostage_rescue_zone");
|
||||
}
|
||||
}
|
||||
|
||||
void RescueZoneIcon_Clear(CBasePlayer *player)
|
||||
void RescueZoneIcon_Clear(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_HIDE);
|
||||
WRITE_STRING("rescue");
|
||||
MESSAGE_END();
|
||||
|
||||
if (player->m_iMenu >= Menu_Buy)
|
||||
if (pPlayer->m_iMenu >= Menu_Buy)
|
||||
{
|
||||
if (player->m_iMenu <= Menu_BuyItem)
|
||||
if (pPlayer->m_iMenu <= Menu_BuyItem)
|
||||
{
|
||||
CLIENT_COMMAND(ENT(player->pev), "slot10\n");
|
||||
CLIENT_COMMAND(ENT(pPlayer->pev), "slot10\n");
|
||||
}
|
||||
else if (player->m_iMenu == Menu_ClientBuy)
|
||||
else if (pPlayer->m_iMenu == Menu_ClientBuy)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, pPlayer->pev);
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EscapeZoneIcon_Set(CBasePlayer *player)
|
||||
void EscapeZoneIcon_Set(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_SHOW);
|
||||
WRITE_STRING("escape");
|
||||
WRITE_BYTE(0);
|
||||
@ -1753,40 +1733,40 @@ void EscapeZoneIcon_Set(CBasePlayer *player)
|
||||
WRITE_BYTE(0);
|
||||
MESSAGE_END();
|
||||
|
||||
if (player->m_iTeam == CT)
|
||||
if (pPlayer->m_iTeam == CT)
|
||||
{
|
||||
if (!(player->m_flDisplayHistory & DHF_IN_ESCAPE_ZONE))
|
||||
if (!(pPlayer->m_flDisplayHistory & DHF_IN_ESCAPE_ZONE))
|
||||
{
|
||||
player->m_flDisplayHistory |= DHF_IN_ESCAPE_ZONE;
|
||||
player->HintMessage("#Hint_terrorist_escape_zone");
|
||||
pPlayer->m_flDisplayHistory |= DHF_IN_ESCAPE_ZONE;
|
||||
pPlayer->HintMessage("#Hint_terrorist_escape_zone");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EscapeZoneIcon_Clear(CBasePlayer *player)
|
||||
void EscapeZoneIcon_Clear(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_HIDE);
|
||||
WRITE_STRING("escape");
|
||||
MESSAGE_END();
|
||||
|
||||
if (player->m_iMenu >= Menu_Buy)
|
||||
if (pPlayer->m_iMenu >= Menu_Buy)
|
||||
{
|
||||
if (player->m_iMenu <= Menu_BuyItem)
|
||||
if (pPlayer->m_iMenu <= Menu_BuyItem)
|
||||
{
|
||||
CLIENT_COMMAND(player->edict(), "slot10\n");
|
||||
CLIENT_COMMAND(pPlayer->edict(), "slot10\n");
|
||||
}
|
||||
else if (player->m_iMenu == Menu_ClientBuy)
|
||||
else if (pPlayer->m_iMenu == Menu_ClientBuy)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, pPlayer->pev);
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VIP_SafetyZoneIcon_Set(CBasePlayer *player)
|
||||
void VIP_SafetyZoneIcon_Set(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_SHOW);
|
||||
WRITE_STRING("vipsafety");
|
||||
WRITE_BYTE(0);
|
||||
@ -1794,37 +1774,37 @@ void VIP_SafetyZoneIcon_Set(CBasePlayer *player)
|
||||
WRITE_BYTE(0);
|
||||
MESSAGE_END();
|
||||
|
||||
if (!(player->m_flDisplayHistory & DHF_IN_VIPSAFETY_ZONE))
|
||||
if (!(pPlayer->m_flDisplayHistory & DHF_IN_VIPSAFETY_ZONE))
|
||||
{
|
||||
if (player->m_iTeam == CT)
|
||||
if (pPlayer->m_iTeam == CT)
|
||||
{
|
||||
player->m_flDisplayHistory |= DHF_IN_VIPSAFETY_ZONE;
|
||||
player->HintMessage("#Hint_ct_vip_zone", TRUE);
|
||||
pPlayer->m_flDisplayHistory |= DHF_IN_VIPSAFETY_ZONE;
|
||||
pPlayer->HintMessage("#Hint_ct_vip_zone", TRUE);
|
||||
}
|
||||
else if (player->m_iTeam == TERRORIST)
|
||||
else if (pPlayer->m_iTeam == TERRORIST)
|
||||
{
|
||||
player->m_flDisplayHistory |= DHF_IN_VIPSAFETY_ZONE;
|
||||
player->HintMessage("#Hint_terrorist_vip_zone", TRUE);
|
||||
pPlayer->m_flDisplayHistory |= DHF_IN_VIPSAFETY_ZONE;
|
||||
pPlayer->HintMessage("#Hint_terrorist_vip_zone", TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VIP_SafetyZoneIcon_Clear(CBasePlayer *player)
|
||||
void VIP_SafetyZoneIcon_Clear(CBasePlayer *pPlayer)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, nullptr, pPlayer->pev);
|
||||
WRITE_BYTE(STATUSICON_HIDE);
|
||||
WRITE_STRING("vipsafety");
|
||||
MESSAGE_END();
|
||||
|
||||
if (player->m_iMenu >= Menu_Buy)
|
||||
if (pPlayer->m_iMenu >= Menu_Buy)
|
||||
{
|
||||
if (player->m_iMenu <= Menu_BuyItem)
|
||||
if (pPlayer->m_iMenu <= Menu_BuyItem)
|
||||
{
|
||||
CLIENT_COMMAND(player->edict(), "slot10\n");
|
||||
CLIENT_COMMAND(pPlayer->edict(), "slot10\n");
|
||||
}
|
||||
else if (player->m_iMenu == Menu_ClientBuy)
|
||||
else if (pPlayer->m_iMenu == Menu_ClientBuy)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgBuyClose, nullptr, pPlayer->pev);
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
@ -1832,7 +1812,7 @@ void VIP_SafetyZoneIcon_Clear(CBasePlayer *player)
|
||||
|
||||
void CBasePlayer::SendFOV(int fov)
|
||||
{
|
||||
pev->fov = float_precision(fov);
|
||||
pev->fov = real_t(fov);
|
||||
m_iClientFOV = fov;
|
||||
m_iFOV = fov;
|
||||
|
||||
@ -3704,24 +3684,24 @@ void EXT_FUNC CBasePlayer::__API_HOOK(StartObserver)(Vector &vecPosition, Vector
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
bool CanSeeUseable(CBasePlayer *me, CBaseEntity *entity)
|
||||
bool CanSeeUseable(CBasePlayer *me, CBaseEntity *pEntity)
|
||||
{
|
||||
TraceResult result;
|
||||
Vector eye = me->pev->origin + me->pev->view_ofs;
|
||||
|
||||
if (FClassnameIs(entity->pev, "hostage_entity"))
|
||||
if (FClassnameIs(pEntity->pev, "hostage_entity"))
|
||||
{
|
||||
Vector chest = entity->pev->origin + Vector(0, 0, HalfHumanHeight);
|
||||
Vector head = entity->pev->origin + Vector(0, 0, HumanHeight * 0.9);
|
||||
Vector knees = entity->pev->origin + Vector(0, 0, StepHeight);
|
||||
Vector chest = pEntity->pev->origin + Vector(0, 0, HalfHumanHeight);
|
||||
Vector head = pEntity->pev->origin + Vector(0, 0, HumanHeight * 0.9);
|
||||
Vector knees = pEntity->pev->origin + Vector(0, 0, StepHeight);
|
||||
|
||||
UTIL_TraceLine(eye, chest, ignore_monsters, ignore_glass, me->edict(), &result);
|
||||
if (result.flFraction < 1.0f)
|
||||
{
|
||||
UTIL_TraceLine(eye, head, ignore_monsters, ignore_glass, entity->edict(), &result);
|
||||
UTIL_TraceLine(eye, head, ignore_monsters, ignore_glass, pEntity->edict(), &result);
|
||||
if (result.flFraction < 1.0f)
|
||||
{
|
||||
UTIL_TraceLine(eye, knees, ignore_monsters, ignore_glass, entity->edict(), &result);
|
||||
UTIL_TraceLine(eye, knees, ignore_monsters, ignore_glass, pEntity->edict(), &result);
|
||||
if (result.flFraction < 1.0f)
|
||||
{
|
||||
return false;
|
||||
@ -4184,7 +4164,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)()
|
||||
// Slow down the player based on the velocity modifier
|
||||
if (m_flVelocityModifier < 1.0f)
|
||||
{
|
||||
float_precision modvel = m_flVelocityModifier + 0.01;
|
||||
real_t modvel = m_flVelocityModifier + 0.01;
|
||||
|
||||
m_flVelocityModifier = modvel;
|
||||
pev->velocity = pev->velocity * modvel;
|
||||
@ -4199,7 +4179,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(PreThink)()
|
||||
// check every 5 seconds
|
||||
m_flIdleCheckTime = gpGlobals->time + 5.0;
|
||||
|
||||
float_precision flLastMove = gpGlobals->time - m_fLastMovement;
|
||||
real_t flLastMove = gpGlobals->time - m_fLastMovement;
|
||||
|
||||
//check if this player has been inactive for 2 rounds straight
|
||||
if (flLastMove > CSGameRules()->m_fMaxIdlePeriod)
|
||||
@ -5455,10 +5435,10 @@ void CBasePlayer::SetScoreboardAttributes(CBasePlayer *destination)
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (player && !FNullEnt(player->edict()))
|
||||
SetScoreboardAttributes(player);
|
||||
if (pPlayer && !FNullEnt(pPlayer->edict()))
|
||||
SetScoreboardAttributes(pPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6157,22 +6137,22 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse)
|
||||
}
|
||||
}
|
||||
|
||||
void OLD_CheckBuyZone(CBasePlayer *player)
|
||||
void OLD_CheckBuyZone(CBasePlayer *pPlayer)
|
||||
{
|
||||
const char *pszSpawnClass = nullptr;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (!CSGameRules()->CanPlayerBuy(player))
|
||||
if (!CSGameRules()->CanPlayerBuy(pPlayer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (player->m_iTeam == TERRORIST)
|
||||
if (pPlayer->m_iTeam == TERRORIST)
|
||||
{
|
||||
pszSpawnClass = "info_player_deathmatch";
|
||||
}
|
||||
else if (player->m_iTeam == CT)
|
||||
else if (pPlayer->m_iTeam == CT)
|
||||
{
|
||||
pszSpawnClass = "info_player_start";
|
||||
}
|
||||
@ -6182,9 +6162,9 @@ void OLD_CheckBuyZone(CBasePlayer *player)
|
||||
CBaseEntity *pSpot = nullptr;
|
||||
while ((pSpot = UTIL_FindEntityByClassname(pSpot, pszSpawnClass)))
|
||||
{
|
||||
if ((pSpot->pev->origin - player->pev->origin).Length() < 200.0f)
|
||||
if ((pSpot->pev->origin - pPlayer->pev->origin).Length() < 200.0f)
|
||||
{
|
||||
player->m_signals.Signal(SIGNAL_BUY);
|
||||
pPlayer->m_signals.Signal(SIGNAL_BUY);
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
break;
|
||||
#endif
|
||||
@ -6193,14 +6173,14 @@ void OLD_CheckBuyZone(CBasePlayer *player)
|
||||
}
|
||||
}
|
||||
|
||||
void OLD_CheckBombTarget(CBasePlayer *player)
|
||||
void OLD_CheckBombTarget(CBasePlayer *pPlayer)
|
||||
{
|
||||
CBaseEntity *pSpot = nullptr;
|
||||
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_bomb_target")))
|
||||
{
|
||||
if ((pSpot->pev->origin - player->pev->origin).Length() <= 256.0f)
|
||||
if ((pSpot->pev->origin - pPlayer->pev->origin).Length() <= 256.0f)
|
||||
{
|
||||
player->m_signals.Signal(SIGNAL_BOMB);
|
||||
pPlayer->m_signals.Signal(SIGNAL_BOMB);
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
break;
|
||||
#endif
|
||||
@ -6208,14 +6188,14 @@ void OLD_CheckBombTarget(CBasePlayer *player)
|
||||
}
|
||||
}
|
||||
|
||||
void OLD_CheckRescueZone(CBasePlayer *player)
|
||||
void OLD_CheckRescueZone(CBasePlayer *pPlayer)
|
||||
{
|
||||
CBaseEntity *pSpot = nullptr;
|
||||
while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue")))
|
||||
{
|
||||
if ((pSpot->pev->origin - player->pev->origin).Length() <= 256.0f)
|
||||
if ((pSpot->pev->origin - pPlayer->pev->origin).Length() <= 256.0f)
|
||||
{
|
||||
player->m_signals.Signal(SIGNAL_RESCUE);
|
||||
pPlayer->m_signals.Signal(SIGNAL_RESCUE);
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
break;
|
||||
#endif
|
||||
@ -6552,25 +6532,25 @@ void CBasePlayer::SendHostagePos()
|
||||
|
||||
void CBasePlayer::SendHostageIcons()
|
||||
{
|
||||
CBaseEntity *pHostage = nullptr;
|
||||
int numHostages = 0;
|
||||
char buf[16];
|
||||
|
||||
if (!AreRunningCZero())
|
||||
return;
|
||||
|
||||
int hostagesCount = 0;
|
||||
CBaseEntity *pHostage = nullptr;
|
||||
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (pHostage->IsAlive())
|
||||
numHostages++;
|
||||
hostagesCount++;
|
||||
}
|
||||
|
||||
if (numHostages > MAX_HOSTAGE_ICON)
|
||||
numHostages = MAX_HOSTAGE_ICON;
|
||||
if (hostagesCount > MAX_HOSTAGE_ICON)
|
||||
hostagesCount = MAX_HOSTAGE_ICON;
|
||||
|
||||
Q_snprintf(buf, ARRAYSIZE(buf), "hostage%d", numHostages);
|
||||
char buf[16];
|
||||
Q_snprintf(buf, ARRAYSIZE(buf), "hostage%d", hostagesCount);
|
||||
|
||||
if (numHostages)
|
||||
if (hostagesCount)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgScenarioIcon, nullptr, pev);
|
||||
WRITE_BYTE(1); // active
|
||||
@ -7778,7 +7758,7 @@ void CStripWeapons::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE
|
||||
|
||||
void CBasePlayer::StudioEstimateGait()
|
||||
{
|
||||
float_precision dt;
|
||||
real_t dt;
|
||||
Vector est_velocity;
|
||||
|
||||
dt = gpGlobals->frametime;
|
||||
@ -7810,8 +7790,8 @@ void CBasePlayer::StudioEstimateGait()
|
||||
|
||||
if (!est_velocity.x && !est_velocity.y)
|
||||
{
|
||||
float_precision flYawDiff = pev->angles.y - m_flGaityaw;
|
||||
float_precision flYaw = Q_fmod(flYawDiff, 360);
|
||||
real_t flYawDiff = pev->angles.y - m_flGaityaw;
|
||||
real_t flYaw = Q_fmod(flYawDiff, 360);
|
||||
|
||||
flYawDiff = flYawDiff - int64(flYawDiff / 360) * 360;
|
||||
|
||||
@ -7839,9 +7819,9 @@ void CBasePlayer::StudioEstimateGait()
|
||||
flYawDiff *= dt;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (float_precision(Q_abs(flYawDiff)) < 0.1f)
|
||||
if (real_t(Q_abs(flYawDiff)) < 0.1f)
|
||||
#else
|
||||
if (float_precision(Q_abs(int64(flYawDiff))) < 0.1f)
|
||||
if (real_t(Q_abs(int64(flYawDiff))) < 0.1f)
|
||||
#endif
|
||||
flYawDiff = 0;
|
||||
|
||||
@ -7851,7 +7831,7 @@ void CBasePlayer::StudioEstimateGait()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flGaityaw = (Q_atan2(float_precision(est_velocity.y), float_precision(est_velocity.x)) * 180 / M_PI);
|
||||
m_flGaityaw = (Q_atan2(real_t(est_velocity.y), real_t(est_velocity.x)) * 180 / M_PI);
|
||||
|
||||
if (m_flGaityaw > 180)
|
||||
m_flGaityaw = 180;
|
||||
@ -7901,8 +7881,8 @@ void CBasePlayer::CalculateYawBlend()
|
||||
float dt;
|
||||
float maxyaw = 255.0f;
|
||||
|
||||
float_precision flYaw; // view direction relative to movement
|
||||
float_precision blend_yaw;
|
||||
real_t flYaw; // view direction relative to movement
|
||||
real_t blend_yaw;
|
||||
|
||||
dt = gpGlobals->frametime;
|
||||
|
||||
@ -7915,7 +7895,7 @@ void CBasePlayer::CalculateYawBlend()
|
||||
StudioEstimateGait();
|
||||
|
||||
// calc side to side turning
|
||||
flYaw = Q_fmod(float_precision(pev->angles.y - m_flGaityaw), 360);
|
||||
flYaw = Q_fmod(real_t(pev->angles.y - m_flGaityaw), 360);
|
||||
|
||||
if (flYaw < -180)
|
||||
flYaw += 360;
|
||||
@ -7956,7 +7936,7 @@ void CBasePlayer::CalculateYawBlend()
|
||||
void CBasePlayer::StudioProcessGait()
|
||||
{
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
float_precision dt = gpGlobals->frametime;
|
||||
real_t dt = gpGlobals->frametime;
|
||||
|
||||
if (dt < 0.0)
|
||||
dt = 0;
|
||||
@ -7994,7 +7974,7 @@ void CBasePlayer::ResetStamina()
|
||||
pev->fuser2 = 0;
|
||||
}
|
||||
|
||||
float_precision GetPlayerPitch(const edict_t *pEdict)
|
||||
real_t GetPlayerPitch(const edict_t *pEdict)
|
||||
{
|
||||
if (!pEdict)
|
||||
return 0.0f;
|
||||
@ -8008,7 +7988,7 @@ float_precision GetPlayerPitch(const edict_t *pEdict)
|
||||
return pPlayer->m_flPitch;
|
||||
}
|
||||
|
||||
float_precision GetPlayerYaw(const edict_t *pEdict)
|
||||
real_t GetPlayerYaw(const edict_t *pEdict)
|
||||
{
|
||||
if (!pEdict)
|
||||
return 0.0f;
|
||||
@ -8806,6 +8786,7 @@ void CBasePlayer::ParseAutoBuyString(const char *string, bool &boughtPrimary, bo
|
||||
command[i] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -9165,21 +9146,21 @@ void CBasePlayer::UpdateLocation(bool forceUpdate)
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!player)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (player->m_iTeam == m_iTeam || player->m_iTeam == SPECTATOR)
|
||||
if (pPlayer->m_iTeam == m_iTeam || pPlayer->m_iTeam == SPECTATOR)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgLocation, nullptr, player->edict());
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgLocation, nullptr, pPlayer->edict());
|
||||
WRITE_BYTE(entindex());
|
||||
WRITE_STRING(m_lastLocation);
|
||||
MESSAGE_END();
|
||||
}
|
||||
else if (forceUpdate)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgLocation, nullptr, player->edict());
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgLocation, nullptr, pPlayer->edict());
|
||||
WRITE_BYTE(entindex());
|
||||
WRITE_STRING("");
|
||||
MESSAGE_END();
|
||||
|
@ -664,7 +664,7 @@ public:
|
||||
|
||||
int random_seed;
|
||||
unsigned short m_usPlayerBleed;
|
||||
EHANDLE m_hObserverTarget;
|
||||
EntityHandle<CBasePlayer> m_hObserverTarget;
|
||||
float m_flNextObserverInput;
|
||||
int m_iObserverWeapon;
|
||||
int m_iObserverC4State;
|
||||
@ -877,9 +877,11 @@ public:
|
||||
|
||||
inline bool CBasePlayer::IsReloading() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = static_cast<CBasePlayerWeapon *>(m_pActiveItem);
|
||||
if (weapon && weapon->m_fInReload)
|
||||
CBasePlayerWeapon *pCurrentWeapon = static_cast<CBasePlayerWeapon *>(m_pActiveItem);
|
||||
if (pCurrentWeapon && pCurrentWeapon->m_fInReload)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -896,18 +898,18 @@ inline CCSPlayer *CBasePlayer::CSPlayer() const {
|
||||
// Index is 1 based
|
||||
inline CBasePlayer *UTIL_PlayerByIndex(int playerIndex)
|
||||
{
|
||||
return (CBasePlayer *)GET_PRIVATE(INDEXENT(playerIndex));
|
||||
return GET_PRIVATE<CBasePlayer>(INDEXENT(playerIndex));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline CBasePlayer *UTIL_PlayerByIndexSafe(int playerIndex)
|
||||
{
|
||||
CBasePlayer *player = nullptr;
|
||||
CBasePlayer *pPlayer = nullptr;
|
||||
if (likely(playerIndex > 0 && playerIndex <= gpGlobals->maxClients))
|
||||
player = UTIL_PlayerByIndex(playerIndex);
|
||||
pPlayer = UTIL_PlayerByIndex(playerIndex);
|
||||
|
||||
return player;
|
||||
return pPlayer;
|
||||
}
|
||||
|
||||
extern int gEvilImpulse101;
|
||||
@ -918,22 +920,22 @@ extern CBaseEntity *g_pLastTerroristSpawn;
|
||||
extern BOOL gInitHUD;
|
||||
extern cvar_t *sv_aim;
|
||||
|
||||
void OLD_CheckBuyZone(CBasePlayer *player);
|
||||
void OLD_CheckBombTarget(CBasePlayer *player);
|
||||
void OLD_CheckRescueZone(CBasePlayer *player);
|
||||
void OLD_CheckBuyZone(CBasePlayer *pPlayer);
|
||||
void OLD_CheckBombTarget(CBasePlayer *pPlayer);
|
||||
void OLD_CheckRescueZone(CBasePlayer *pPlayer);
|
||||
|
||||
void BuyZoneIcon_Set(CBasePlayer *player);
|
||||
void BuyZoneIcon_Clear(CBasePlayer *player);
|
||||
void BombTargetFlash_Set(CBasePlayer *player);
|
||||
void BombTargetFlash_Clear(CBasePlayer *player);
|
||||
void RescueZoneIcon_Set(CBasePlayer *player);
|
||||
void RescueZoneIcon_Clear(CBasePlayer *player);
|
||||
void EscapeZoneIcon_Set(CBasePlayer *player);
|
||||
void EscapeZoneIcon_Clear(CBasePlayer *player);
|
||||
void EscapeZoneIcon_Set(CBasePlayer *player);
|
||||
void EscapeZoneIcon_Clear(CBasePlayer *player);
|
||||
void VIP_SafetyZoneIcon_Set(CBasePlayer *player);
|
||||
void VIP_SafetyZoneIcon_Clear(CBasePlayer *player);
|
||||
void BuyZoneIcon_Set(CBasePlayer *pPlayer);
|
||||
void BuyZoneIcon_Clear(CBasePlayer *pPlayer);
|
||||
void BombTargetFlash_Set(CBasePlayer *pPlayer);
|
||||
void BombTargetFlash_Clear(CBasePlayer *pPlayer);
|
||||
void RescueZoneIcon_Set(CBasePlayer *pPlayer);
|
||||
void RescueZoneIcon_Clear(CBasePlayer *pPlayer);
|
||||
void EscapeZoneIcon_Set(CBasePlayer *pPlayer);
|
||||
void EscapeZoneIcon_Clear(CBasePlayer *pPlayer);
|
||||
void EscapeZoneIcon_Set(CBasePlayer *pPlayer);
|
||||
void EscapeZoneIcon_Clear(CBasePlayer *pPlayer);
|
||||
void VIP_SafetyZoneIcon_Set(CBasePlayer *pPlayer);
|
||||
void VIP_SafetyZoneIcon_Clear(CBasePlayer *pPlayer);
|
||||
|
||||
void SendItemStatus(CBasePlayer *pPlayer);
|
||||
const char *GetCSModelName(int item_id);
|
||||
@ -941,12 +943,12 @@ Vector VecVelocityForDamage(float flDamage);
|
||||
int TrainSpeed(int iSpeed, int iMax);
|
||||
const char *GetWeaponName(entvars_t *pevInflictor, entvars_t *pKiller);
|
||||
void LogAttack(CBasePlayer *pAttacker, CBasePlayer *pVictim, int teamAttack, int healthHit, int armorHit, int newHealth, int newArmor, const char *killer_weapon_name);
|
||||
bool CanSeeUseable(CBasePlayer *me, CBaseEntity *entity);
|
||||
bool CanSeeUseable(CBasePlayer *me, CBaseEntity *pEntity);
|
||||
void FixPlayerCrouchStuck(edict_t *pPlayer);
|
||||
BOOL IsSpawnPointValid(CBaseEntity *pPlayer, CBaseEntity *pSpot);
|
||||
CBaseEntity *FindEntityForward(CBaseEntity *pMe);
|
||||
float_precision GetPlayerPitch(const edict_t *pEdict);
|
||||
float_precision GetPlayerYaw(const edict_t *pEdict);
|
||||
real_t GetPlayerPitch(const edict_t *pEdict);
|
||||
real_t GetPlayerYaw(const edict_t *pEdict);
|
||||
int GetPlayerGaitsequence(const edict_t *pEdict);
|
||||
const char *GetBuyStringForWeaponClass(int weaponClass);
|
||||
bool IsPrimaryWeaponClass(int classId);
|
||||
|
@ -872,7 +872,7 @@ BOOL FEnvSoundInRange(entvars_t *pev, entvars_t *pevTarget, float *pflRange)
|
||||
Vector vecSpot1 = pev->origin + pev->view_ofs;
|
||||
Vector vecSpot2 = pevTarget->origin + pevTarget->view_ofs;
|
||||
Vector vecRange;
|
||||
float_precision flRange;
|
||||
real_t flRange;
|
||||
TraceResult tr;
|
||||
|
||||
UTIL_TraceLine(vecSpot1, vecSpot2, ignore_monsters, ENT(pev), &tr);
|
||||
@ -1017,11 +1017,11 @@ void USENTENCEG_InitLRU(unsigned char *plru, int count)
|
||||
if (count > MAX_SENTENCE_LRU)
|
||||
count = MAX_SENTENCE_LRU;
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
for (i = 0; i < count; i++)
|
||||
plru[i] = (unsigned char)i;
|
||||
|
||||
// randomize array
|
||||
for (i = 0; i < (count * 4); ++i)
|
||||
for (i = 0; i < (count * 4); i++)
|
||||
{
|
||||
j = RANDOM_LONG(0, count - 1);
|
||||
k = RANDOM_LONG(0, count - 1);
|
||||
@ -1103,7 +1103,7 @@ int USENTENCEG_Pick(int isentenceg, char *szfound)
|
||||
|
||||
while (!ffound)
|
||||
{
|
||||
for (i = 0; i < count; ++i)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (plru[i] != 0xFF)
|
||||
{
|
||||
@ -1594,7 +1594,7 @@ char TEXTURETYPE_Find(char *name)
|
||||
{
|
||||
// CONSIDER: pre-sort texture names and perform faster binary search here
|
||||
|
||||
for (int i = 0; i < gcTextures; ++i)
|
||||
for (int i = 0; i < gcTextures; i++)
|
||||
{
|
||||
if (!Q_strnicmp(name, &(grgszTextureName[i][0]), MAX_TEXTURENAME_LENGHT - 1))
|
||||
return (grgchTextureType[i]);
|
||||
|
@ -200,7 +200,7 @@ void CSoundEnt::Initialize()
|
||||
m_iActiveSound = SOUNDLIST_EMPTY;
|
||||
|
||||
// clear all sounds, and link them into the free sound list.
|
||||
for (i = 0; i < MAX_WORLD_SOUNDS; ++i)
|
||||
for (i = 0; i < MAX_WORLD_SOUNDS; i++)
|
||||
{
|
||||
m_SoundPool[i].Clear();
|
||||
m_SoundPool[i].m_iNext = i + 1;
|
||||
@ -210,7 +210,7 @@ void CSoundEnt::Initialize()
|
||||
m_SoundPool[i - 1].m_iNext = SOUNDLIST_EMPTY;
|
||||
|
||||
// now reserve enough sounds for each client
|
||||
for (i = 0; i < gpGlobals->maxClients; ++i)
|
||||
for (i = 0; i < gpGlobals->maxClients; i++)
|
||||
{
|
||||
iSound = pSoundEnt->IAllocSound();
|
||||
|
||||
|
@ -325,7 +325,7 @@ void CBaseToggle::LinearMove(Vector vecDest, float flSpeed)
|
||||
Vector vecDestDelta = vecDest - pev->origin;
|
||||
|
||||
// divide vector length by speed to get time to reach dest
|
||||
float_precision flTravelTime = vecDestDelta.Length() / flSpeed;
|
||||
real_t flTravelTime = vecDestDelta.Length() / flSpeed;
|
||||
|
||||
// set nextthink to trigger a call to LinearMoveDone when dest is reached
|
||||
pev->nextthink = pev->ltime + flTravelTime;
|
||||
@ -377,7 +377,7 @@ void CBaseToggle::AngularMove(Vector vecDestAngle, float flSpeed)
|
||||
Vector vecDestDelta = vecDestAngle - pev->angles;
|
||||
|
||||
// divide by speed to get time to reach dest
|
||||
float_precision flTravelTime = vecDestDelta.Length() / flSpeed;
|
||||
real_t flTravelTime = vecDestDelta.Length() / flSpeed;
|
||||
|
||||
// set nextthink to trigger a call to AngularMoveDone when dest is reached
|
||||
pev->nextthink = pev->ltime + flTravelTime;
|
||||
|
@ -108,7 +108,7 @@ void CHalfLifeTraining::PlayerThink(CBasePlayer *pPlayer)
|
||||
}
|
||||
|
||||
CGrenade *pBomb = nullptr;
|
||||
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
while ((pBomb = UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
{
|
||||
if (pBomb->m_pentCurBombTarget)
|
||||
pBomb->m_bStartDefuse = true;
|
||||
@ -231,7 +231,7 @@ void CHalfLifeTraining::CheckWinConditions()
|
||||
{
|
||||
CGrenade *pBomb = nullptr;
|
||||
|
||||
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
while ((pBomb = UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
{
|
||||
if (!pBomb->m_bIsC4 || !pBomb->m_bJustBlew)
|
||||
continue;
|
||||
@ -246,7 +246,7 @@ void CHalfLifeTraining::CheckWinConditions()
|
||||
{
|
||||
CGrenade *pBomb = nullptr;
|
||||
|
||||
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
while ((pBomb = UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
{
|
||||
if (!pBomb->m_bIsC4 || !pBomb->m_bJustBlew)
|
||||
continue;
|
||||
|
@ -216,7 +216,7 @@ void CMultiManager::Spawn()
|
||||
while (bSwapped)
|
||||
{
|
||||
bSwapped = false;
|
||||
for (int i = 1; i < m_cTargets; ++i)
|
||||
for (int i = 1; i < m_cTargets; i++)
|
||||
{
|
||||
if (m_flTargetDelay[i] < m_flTargetDelay[i - 1])
|
||||
{
|
||||
@ -239,7 +239,7 @@ void CMultiManager::Restart()
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
edict_t *pentTarget = nullptr;
|
||||
|
||||
for (int i = 0; i < m_cTargets; ++i)
|
||||
for (int i = 0; i < m_cTargets; i++)
|
||||
{
|
||||
const char *name = STRING(m_iTargetName[i]);
|
||||
|
||||
@ -259,7 +259,7 @@ void CMultiManager::Restart()
|
||||
}
|
||||
#endif
|
||||
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
|
||||
if (IsClone())
|
||||
{
|
||||
@ -273,7 +273,7 @@ void CMultiManager::Restart()
|
||||
|
||||
BOOL CMultiManager::HasTarget(string_t targetname)
|
||||
{
|
||||
for (int i = 0; i < m_cTargets; ++i)
|
||||
for (int i = 0; i < m_cTargets; i++)
|
||||
{
|
||||
if (FStrEq(STRING(targetname), STRING(m_iTargetName[i])))
|
||||
{
|
||||
@ -300,7 +300,7 @@ void CMultiManager::ManagerThink()
|
||||
// have we fired all targets?
|
||||
if (m_index >= m_cTargets)
|
||||
{
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
if (IsClone())
|
||||
{
|
||||
UTIL_Remove(this);
|
||||
@ -311,7 +311,9 @@ void CMultiManager::ManagerThink()
|
||||
SetUse(&CMultiManager::ManagerUse);
|
||||
}
|
||||
else
|
||||
{
|
||||
pev->nextthink = m_startTime + m_flTargetDelay[m_index];
|
||||
}
|
||||
}
|
||||
|
||||
CMultiManager *CMultiManager::Clone()
|
||||
@ -354,7 +356,7 @@ void CMultiManager::ManagerUse(CBaseEntity *pActivator, CBaseEntity *pCaller, US
|
||||
m_startTime = gpGlobals->time;
|
||||
|
||||
// disable use until all targets have fired
|
||||
SetUse(NULL);
|
||||
SetUse(nullptr);
|
||||
SetThink(&CMultiManager::ManagerThink);
|
||||
|
||||
pev->nextthink = gpGlobals->time;
|
||||
@ -528,7 +530,7 @@ void CTriggerMonsterJump::Think()
|
||||
|
||||
// Unlink from trigger list
|
||||
UTIL_SetOrigin(pev, pev->origin);
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
|
||||
void CTriggerMonsterJump::Touch(CBaseEntity *pOther)
|
||||
@ -651,7 +653,7 @@ void CTriggerCDAudio::PlayTrack(edict_t *pEdict)
|
||||
{
|
||||
PlayCDTrack(pEdict, int(pev->health));
|
||||
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
UTIL_Remove(this);
|
||||
}
|
||||
|
||||
@ -723,7 +725,7 @@ void CTriggerHurt::Spawn()
|
||||
}
|
||||
else
|
||||
{
|
||||
SetUse(NULL);
|
||||
SetUse(nullptr);
|
||||
}
|
||||
|
||||
if (m_bitsDamageInflict & DMG_RADIATION)
|
||||
@ -764,7 +766,7 @@ void CTriggerHurt::RadiationThink()
|
||||
{
|
||||
edict_t *pentPlayer;
|
||||
CBasePlayer *pPlayer = nullptr;
|
||||
float_precision flRange;
|
||||
real_t flRange;
|
||||
entvars_t *pevTarget;
|
||||
Vector vecSpot1;
|
||||
Vector vecSpot2;
|
||||
@ -855,7 +857,7 @@ void CBaseTrigger::HurtTouch(CBaseEntity *pOther)
|
||||
return;
|
||||
}
|
||||
|
||||
// HACKHACK -- In multiplayer, players touch this based on packet receipt.
|
||||
// HACKHACK: In multiplayer, players touch this based on packet receipt.
|
||||
// So the players who send packets later aren't always hurt. Keep track of
|
||||
// how much time has passed and whether or not you've touched that player
|
||||
if (g_pGameRules->IsMultiplayer())
|
||||
@ -901,7 +903,7 @@ void CBaseTrigger::HurtTouch(CBaseEntity *pOther)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Original code -- single player
|
||||
// Original code: single player
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pev->dmgtime > gpGlobals->time && gpGlobals->time >= pev->pain_finished)
|
||||
#else
|
||||
@ -1073,12 +1075,12 @@ void CBaseTrigger::ActivateMultiTrigger(CBaseEntity *pActivator)
|
||||
{
|
||||
// we can't just remove (self) here, because this is a touch function
|
||||
// called while C code is looping through area links...
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
pev->nextthink = gpGlobals->time + 0.1f;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (!(pev->spawnflags & SF_TRIGGER_NORESET) && m_flWait == -2)
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
else
|
||||
#endif
|
||||
SetThink(&CBaseTrigger::SUB_Remove);
|
||||
@ -1088,7 +1090,7 @@ void CBaseTrigger::ActivateMultiTrigger(CBaseEntity *pActivator)
|
||||
// the wait time has passed, so set back up for another activation
|
||||
void CBaseTrigger::MultiWaitOver()
|
||||
{
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
|
||||
void CBaseTrigger::CounterUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
|
||||
@ -1394,7 +1396,7 @@ int CChangeLevel::AddTransitionToList(LEVELLIST *pLevelList, int listCount, cons
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < listCount; ++i)
|
||||
for (i = 0; i < listCount; i++)
|
||||
{
|
||||
if (pLevelList[i].pentLandmark == pentLandmark && Q_strcmp(pLevelList[i].mapName, pMapName) == 0)
|
||||
{
|
||||
@ -1808,16 +1810,16 @@ void CBuyZone::BuyTouch(CBaseEntity *pOther)
|
||||
if (!pOther->IsPlayer())
|
||||
return;
|
||||
|
||||
CBasePlayer *p = static_cast<CBasePlayer *>(pOther);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
if (pev->team == UNASSIGNED || pev->team == p->m_iTeam)
|
||||
if (pev->team == UNASSIGNED || pev->team == pPlayer->m_iTeam)
|
||||
{
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (!CSGameRules()->CanPlayerBuy(p))
|
||||
if (!CSGameRules()->CanPlayerBuy(pPlayer))
|
||||
return;
|
||||
#endif
|
||||
|
||||
p->m_signals.Signal(SIGNAL_BUY);
|
||||
pPlayer->m_signals.Signal(SIGNAL_BUY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1836,12 +1838,12 @@ void CBombTarget::BombTargetTouch(CBaseEntity *pOther)
|
||||
if (!pOther->IsPlayer())
|
||||
return;
|
||||
|
||||
CBasePlayer *p = static_cast<CBasePlayer *>(pOther);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
if (p->m_bHasC4)
|
||||
if (pPlayer->m_bHasC4)
|
||||
{
|
||||
p->m_signals.Signal(SIGNAL_BOMB);
|
||||
p->m_pentCurBombTarget = ENT(pev);
|
||||
pPlayer->m_signals.Signal(SIGNAL_BOMB);
|
||||
pPlayer->m_pentCurBombTarget = ENT(pev);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1884,26 +1886,27 @@ void CEscapeZone::EscapeTouch(CBaseEntity *pOther)
|
||||
if (!pOther->IsPlayer())
|
||||
return;
|
||||
|
||||
CBasePlayer *p = static_cast<CBasePlayer *>(pOther);
|
||||
CBasePlayer *pEscapee = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
switch (p->m_iTeam)
|
||||
switch (pEscapee->m_iTeam)
|
||||
{
|
||||
case TERRORIST:
|
||||
if (!p->m_bEscaped)
|
||||
if (!pEscapee->m_bEscaped)
|
||||
{
|
||||
p->m_bEscaped = true;
|
||||
pEscapee->m_bEscaped = true;
|
||||
CSGameRules()->CheckWinConditions();
|
||||
|
||||
UTIL_LogPrintf("\"%s<%i><%s><TERRORIST>\" triggered \"Terrorist_Escaped\"\n", STRING(p->pev->netname), GETPLAYERUSERID(p->edict()), GETPLAYERAUTHID(p->edict()));
|
||||
UTIL_LogPrintf("\"%s<%i><%s><TERRORIST>\" triggered \"Terrorist_Escaped\"\n",
|
||||
STRING(pEscapee->pev->netname), GETPLAYERUSERID(pEscapee->edict()), GETPLAYERAUTHID(pEscapee->edict()));
|
||||
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!pPlayer || FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (pPlayer->m_iTeam == p->m_iTeam)
|
||||
if (pPlayer->m_iTeam == pEscapee->m_iTeam)
|
||||
{
|
||||
ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Terrorist_Escaped");
|
||||
}
|
||||
@ -1911,7 +1914,7 @@ void CEscapeZone::EscapeTouch(CBaseEntity *pOther)
|
||||
}
|
||||
break;
|
||||
case CT:
|
||||
p->m_signals.Signal(SIGNAL_ESCAPE);
|
||||
pEscapee->m_signals.Signal(SIGNAL_ESCAPE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1929,18 +1932,18 @@ void CVIP_SafetyZone::VIP_SafetyTouch(CBaseEntity *pOther)
|
||||
if (!pOther->IsPlayer())
|
||||
return;
|
||||
|
||||
CBasePlayer *p = static_cast<CBasePlayer *>(pOther);
|
||||
p->m_signals.Signal(SIGNAL_VIPSAFETY);
|
||||
CBasePlayer *pEscapee = static_cast<CBasePlayer *>(pOther);
|
||||
pEscapee->m_signals.Signal(SIGNAL_VIPSAFETY);
|
||||
|
||||
if (p->m_bIsVIP)
|
||||
if (pEscapee->m_bIsVIP)
|
||||
{
|
||||
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Escaped_As_VIP\"\n",
|
||||
STRING(p->pev->netname), GETPLAYERUSERID(p->edict()), GETPLAYERAUTHID(p->edict()));
|
||||
STRING(pEscapee->pev->netname), GETPLAYERUSERID(pEscapee->edict()), GETPLAYERAUTHID(pEscapee->edict()));
|
||||
|
||||
p->m_bEscaped = true;
|
||||
pEscapee->m_bEscaped = true;
|
||||
|
||||
p->Disappear();
|
||||
p->AddAccount(REWARD_VIP_HAVE_SELF_RESCUED, RT_VIP_RESCUED_MYSELF);
|
||||
pEscapee->Disappear();
|
||||
pEscapee->AddAccount(REWARD_VIP_HAVE_SELF_RESCUED, RT_VIP_RESCUED_MYSELF);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1967,7 +1970,7 @@ void CTriggerSave::SaveTouch(CBaseEntity *pOther)
|
||||
if (!pOther->IsPlayer())
|
||||
return;
|
||||
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
UTIL_Remove(this);
|
||||
SERVER_COMMAND("autosave\n");
|
||||
}
|
||||
@ -1980,7 +1983,7 @@ void CTriggerEndSection::EndSectionUse(CBaseEntity *pActivator, CBaseEntity *pCa
|
||||
if (pActivator && !pActivator->IsNetClient())
|
||||
return;
|
||||
|
||||
SetUse(NULL);
|
||||
SetUse(nullptr);
|
||||
if (!FStringNull(pev->message))
|
||||
{
|
||||
END_SECTION(STRING(pev->message));
|
||||
@ -2013,7 +2016,7 @@ void CTriggerEndSection::EndSectionTouch(CBaseEntity *pOther)
|
||||
if (!pOther->IsNetClient())
|
||||
return;
|
||||
|
||||
SetTouch(NULL);
|
||||
SetTouch(nullptr);
|
||||
if (!FStringNull(pev->message))
|
||||
{
|
||||
END_SECTION(STRING(pev->message));
|
||||
@ -2295,8 +2298,8 @@ void CTriggerCamera::FollowTarget()
|
||||
if (pev->angles.y < 0)
|
||||
pev->angles.y += 360;
|
||||
|
||||
float_precision dx = vecGoal.x - pev->angles.x;
|
||||
float_precision dy = vecGoal.y - pev->angles.y;
|
||||
real_t dx = vecGoal.x - pev->angles.x;
|
||||
real_t dy = vecGoal.y - pev->angles.y;
|
||||
|
||||
if (dx < -180)
|
||||
dx += 360;
|
||||
@ -2379,7 +2382,7 @@ void CTriggerCamera::Move()
|
||||
pev->speed = UTIL_Approach(m_targetSpeed, pev->speed, m_acceleration * gpGlobals->frametime);
|
||||
}
|
||||
|
||||
float_precision fraction = 2 * gpGlobals->frametime;
|
||||
real_t fraction = 2 * gpGlobals->frametime;
|
||||
pev->velocity = ((pev->movedir * pev->speed) * fraction) + (pev->velocity * (1 - fraction));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
CBaseTutorState();
|
||||
|
||||
virtual ~CBaseTutorState();
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0;
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther) = 0;
|
||||
virtual const char *GetStateString() = 0;
|
||||
|
||||
public:
|
||||
@ -76,7 +76,7 @@ public:
|
||||
CBaseTutorStateSystem();
|
||||
|
||||
virtual ~CBaseTutorStateSystem();
|
||||
virtual bool UpdateState(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0;
|
||||
virtual bool UpdateState(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther) = 0;
|
||||
virtual const char *GetCurrentStateString() = 0;
|
||||
virtual CBaseTutorState *ConstructNewState(TutorStateType stateType) = 0;
|
||||
|
||||
|
@ -135,10 +135,10 @@ CBaseTutor::~CBaseTutor()
|
||||
}
|
||||
}
|
||||
|
||||
void CBaseTutor::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CBaseTutor::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CallEventHandler(event, entity, other);
|
||||
CheckForStateTransition(event, entity, other);
|
||||
CallEventHandler(event, pEntity, pOther);
|
||||
CheckForStateTransition(event, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CBaseTutor::ShotFired(Vector source, Vector target)
|
||||
@ -146,9 +146,9 @@ void CBaseTutor::ShotFired(Vector source, Vector target)
|
||||
HandleShotFired(source, target);
|
||||
}
|
||||
|
||||
void CBaseTutor::CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CBaseTutor::CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
if (m_stateSystem->UpdateState(event, entity, other))
|
||||
if (m_stateSystem->UpdateState(event, pEntity, pOther))
|
||||
{
|
||||
DisplayNewStateDescriptionToPlayer();
|
||||
}
|
||||
@ -159,7 +159,7 @@ void CBaseTutor::StartFrame(float time)
|
||||
TutorThink(time);
|
||||
}
|
||||
|
||||
void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char *szMessage, TutorMessageEvent *event)
|
||||
void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *pPlayer, int id, const char *szMessage, TutorMessageEvent *event)
|
||||
{
|
||||
TutorMessage *definition;
|
||||
int numArgs;
|
||||
@ -168,7 +168,7 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char
|
||||
numArgs = event->GetNumParameters();
|
||||
definition = GetTutorMessageDefinition(event->GetID());
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgTutorText, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgTutorText, nullptr, pPlayer->pev);
|
||||
WRITE_STRING(szMessage);
|
||||
WRITE_BYTE(numArgs);
|
||||
|
||||
@ -182,7 +182,7 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char
|
||||
}
|
||||
|
||||
WRITE_SHORT(id);
|
||||
WRITE_SHORT(player->IsAlive() == FALSE);
|
||||
WRITE_SHORT(pPlayer->IsAlive() == FALSE);
|
||||
|
||||
if (definition)
|
||||
WRITE_SHORT(definition->m_type);
|
||||
@ -199,13 +199,13 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char
|
||||
switch (definition->m_type)
|
||||
{
|
||||
case TUTORMESSAGETYPE_FRIEND_DEATH:
|
||||
EMIT_SOUND_DYN(ENT(player->pev), CHAN_ITEM, "events/friend_died.wav", VOL_NORM, ATTN_NORM, 0, 120);
|
||||
EMIT_SOUND_DYN(ENT(pPlayer->pev), CHAN_ITEM, "events/friend_died.wav", VOL_NORM, ATTN_NORM, 0, 120);
|
||||
break;
|
||||
case TUTORMESSAGETYPE_ENEMY_DEATH:
|
||||
EMIT_SOUND_DYN(ENT(player->pev), CHAN_ITEM, "events/enemy_died.wav", VOL_NORM, ATTN_NORM, 0, 85);
|
||||
EMIT_SOUND_DYN(ENT(pPlayer->pev), CHAN_ITEM, "events/enemy_died.wav", VOL_NORM, ATTN_NORM, 0, 85);
|
||||
break;
|
||||
default:
|
||||
EMIT_SOUND_DYN(ENT(player->pev), CHAN_ITEM, "events/tutor_msg.wav", VOL_NORM, ATTN_NORM, 0, 100);
|
||||
EMIT_SOUND_DYN(ENT(pPlayer->pev), CHAN_ITEM, "events/tutor_msg.wav", VOL_NORM, ATTN_NORM, 0, 100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -217,9 +217,9 @@ void CBaseTutor::DisplayMessageToPlayer(CBasePlayer *player, int id, const char
|
||||
}
|
||||
}
|
||||
|
||||
NOXREF void CBaseTutor::DrawLineToEntity(CBasePlayer *player, int entindex, int id)
|
||||
NOXREF void CBaseTutor::DrawLineToEntity(CBasePlayer *pPlayer, int entindex, int id)
|
||||
{
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgTutorLine, nullptr, player->pev);
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgTutorLine, nullptr, pPlayer->pev);
|
||||
WRITE_SHORT(entindex);
|
||||
WRITE_SHORT(id);
|
||||
MESSAGE_END();
|
||||
@ -254,25 +254,25 @@ void CBaseTutor::CloseCurrentWindow()
|
||||
}
|
||||
}
|
||||
|
||||
void CBaseTutor::CalculatePathForObjective(CBaseEntity *player)
|
||||
void CBaseTutor::CalculatePathForObjective(CBaseEntity *pPlayer)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
bool CBaseTutor::IsEntityInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player)
|
||||
bool CBaseTutor::IsEntityInViewOfPlayer(CBaseEntity *pEntity, CBasePlayer *pPlayer)
|
||||
{
|
||||
if (!entity || !player)
|
||||
if (!pEntity || !pPlayer)
|
||||
return false;
|
||||
|
||||
if (cv_tutor_view_distance.value < (entity->pev->origin - player->pev->origin).Length())
|
||||
if (cv_tutor_view_distance.value < (pEntity->pev->origin - pPlayer->pev->origin).Length())
|
||||
return false;
|
||||
|
||||
if (player->FInViewCone(entity))
|
||||
if (pPlayer->FInViewCone(pEntity))
|
||||
{
|
||||
TraceResult result;
|
||||
Vector eye = player->pev->view_ofs + player->pev->origin;
|
||||
Vector eye = pPlayer->pev->view_ofs + pPlayer->pev->origin;
|
||||
|
||||
UTIL_TraceLine(eye, entity->pev->origin, ignore_monsters, ignore_glass, player->pev->pContainingEntity, &result);
|
||||
UTIL_TraceLine(eye, pEntity->pev->origin, ignore_monsters, ignore_glass, pPlayer->pev->pContainingEntity, &result);
|
||||
|
||||
if (result.flFraction == 1.0f)
|
||||
{
|
||||
@ -283,20 +283,20 @@ bool CBaseTutor::IsEntityInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CBaseTutor::IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *player)
|
||||
bool CBaseTutor::IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *pPlayer)
|
||||
{
|
||||
if (!origin || !player)
|
||||
if (!origin || !pPlayer)
|
||||
return false;
|
||||
|
||||
if (cv_tutor_look_distance.value < (*origin - player->pev->origin).Length())
|
||||
if (cv_tutor_look_distance.value < (*origin - pPlayer->pev->origin).Length())
|
||||
return false;
|
||||
|
||||
if (player->IsLookingAtPosition(origin, cv_tutor_look_angle.value))
|
||||
if (pPlayer->IsLookingAtPosition(origin, cv_tutor_look_angle.value))
|
||||
{
|
||||
TraceResult result;
|
||||
Vector eye = player->pev->origin + player->pev->view_ofs;
|
||||
Vector eye = pPlayer->pev->origin + pPlayer->pev->view_ofs;
|
||||
|
||||
UTIL_TraceLine(eye, *origin, ignore_monsters, ignore_glass, ENT(player->pev), &result);
|
||||
UTIL_TraceLine(eye, *origin, ignore_monsters, ignore_glass, ENT(pPlayer->pev), &result);
|
||||
|
||||
if (result.flFraction == 1.0f)
|
||||
return true;
|
||||
@ -305,22 +305,22 @@ bool CBaseTutor::IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *player)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CBaseTutor::IsPlayerLookingAtEntity(CBaseEntity *entity, CBasePlayer *player)
|
||||
bool CBaseTutor::IsPlayerLookingAtEntity(CBaseEntity *pEntity, CBasePlayer *pPlayer)
|
||||
{
|
||||
if (!entity || !player)
|
||||
if (!pEntity || !pPlayer)
|
||||
return false;
|
||||
|
||||
UTIL_MakeVectors(player->pev->v_angle);
|
||||
UTIL_MakeVectors(pPlayer->pev->v_angle);
|
||||
|
||||
Vector srcVec = player->pev->view_ofs + player->pev->origin;
|
||||
Vector srcVec = pPlayer->pev->view_ofs + pPlayer->pev->origin;
|
||||
Vector destVec = gpGlobals->v_forward * cv_tutor_look_distance.value + srcVec;
|
||||
|
||||
TraceResult result;
|
||||
UTIL_TraceLine(srcVec, destVec, dont_ignore_monsters, ignore_glass, ENT(player->pev), &result);
|
||||
UTIL_TraceLine(srcVec, destVec, dont_ignore_monsters, ignore_glass, ENT(pPlayer->pev), &result);
|
||||
|
||||
if (result.pHit)
|
||||
{
|
||||
if (!FNullEnt(result.pHit) && CBaseEntity::Instance(result.pHit) == entity)
|
||||
if (!FNullEnt(result.pHit) && CBaseEntity::Instance(result.pHit) == pEntity)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -329,22 +329,21 @@ bool CBaseTutor::IsPlayerLookingAtEntity(CBaseEntity *entity, CBasePlayer *playe
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CBaseTutor::IsBombsiteInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player)
|
||||
bool CBaseTutor::IsBombsiteInViewOfPlayer(CBaseEntity *pEntity, CBasePlayer *pPlayer)
|
||||
{
|
||||
if (!entity || !player)
|
||||
if (!pEntity || !pPlayer)
|
||||
return false;
|
||||
|
||||
Vector bombSiteCenter = (entity->pev->absmax + entity->pev->absmin) * 0.5f;
|
||||
|
||||
if (cv_tutor_view_distance.value < (bombSiteCenter - player->pev->origin).Length())
|
||||
Vector bombSiteCenter = pEntity->Center();
|
||||
if (cv_tutor_view_distance.value < (bombSiteCenter - pPlayer->pev->origin).Length())
|
||||
return false;
|
||||
|
||||
if (player->FInViewCone(entity))
|
||||
if (pPlayer->FInViewCone(pEntity))
|
||||
{
|
||||
TraceResult result;
|
||||
Vector eye = player->pev->origin + player->pev->view_ofs;
|
||||
Vector eye = pPlayer->pev->origin + pPlayer->pev->view_ofs;
|
||||
|
||||
UTIL_TraceLine(eye, bombSiteCenter, ignore_monsters, ignore_glass, ENT(player->pev), &result);
|
||||
UTIL_TraceLine(eye, bombSiteCenter, ignore_monsters, ignore_glass, ENT(pPlayer->pev), &result);
|
||||
|
||||
if (result.flFraction == 1.0f)
|
||||
{
|
||||
@ -355,12 +354,12 @@ bool CBaseTutor::IsBombsiteInViewOfPlayer(CBaseEntity *entity, CBasePlayer *play
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CBaseTutor::IsEntityInBombsite(CBaseEntity *bombsite, CBaseEntity *entity)
|
||||
bool CBaseTutor::IsEntityInBombsite(CBaseEntity *bombsite, CBaseEntity *pEntity)
|
||||
{
|
||||
if (!bombsite || !entity)
|
||||
if (!bombsite || !pEntity)
|
||||
return false;
|
||||
|
||||
return bombsite->Intersects(entity);
|
||||
return bombsite->Intersects(pEntity);
|
||||
}
|
||||
|
||||
bool CBaseTutor::DoMessagesHaveSameID(int id1, int id2)
|
||||
|
@ -65,29 +65,29 @@ public:
|
||||
virtual ~CBaseTutor();
|
||||
virtual void TutorThink(float time) = 0;
|
||||
virtual void PurgeMessages() = 0;
|
||||
virtual void CallEventHandler(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0;
|
||||
virtual void CallEventHandler(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther) = 0;
|
||||
virtual void ShowTutorMessage(TutorMessageEvent *event) = 0;
|
||||
|
||||
virtual bool IsEntityInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player);
|
||||
virtual bool IsBombsiteInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player);
|
||||
virtual bool IsEntityInBombsite(CBaseEntity *bombsite, CBaseEntity *entity);
|
||||
virtual bool IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *player);
|
||||
virtual bool IsPlayerLookingAtEntity(CBaseEntity *entity, CBasePlayer *player);
|
||||
virtual bool IsEntityInViewOfPlayer(CBaseEntity *pEntity, CBasePlayer *pPlayer);
|
||||
virtual bool IsBombsiteInViewOfPlayer(CBaseEntity *pEntity, CBasePlayer *pPlayer);
|
||||
virtual bool IsEntityInBombsite(CBaseEntity *bombsite, CBaseEntity *pEntity);
|
||||
virtual bool IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *pPlayer);
|
||||
virtual bool IsPlayerLookingAtEntity(CBaseEntity *pEntity, CBasePlayer *pPlayer);
|
||||
|
||||
virtual void HandleShotFired(Vector source, Vector target) = 0;
|
||||
virtual struct TutorMessage *GetTutorMessageDefinition(int messageID) = 0;
|
||||
|
||||
public:
|
||||
void StartFrame(float time);
|
||||
void OnEvent(GameEventType event, CBaseEntity *entity = nullptr, CBaseEntity *other = nullptr);
|
||||
void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr);
|
||||
|
||||
void ShotFired(Vector source, Vector target);
|
||||
void DisplayMessageToPlayer(CBasePlayer *player, int id, const char *szMessage, TutorMessageEvent *event);
|
||||
void DrawLineToEntity(CBasePlayer *player, int entindex, int id);
|
||||
void DisplayMessageToPlayer(CBasePlayer *pPlayer, int id, const char *szMessage, TutorMessageEvent *event);
|
||||
void DrawLineToEntity(CBasePlayer *pPlayer, int entindex, int id);
|
||||
void DisplayNewStateDescriptionToPlayer();
|
||||
void CloseCurrentWindow();
|
||||
void CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
|
||||
void CalculatePathForObjective(CBaseEntity *player);
|
||||
void CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void CalculatePathForObjective(CBaseEntity *pPlayer);
|
||||
bool DoMessagesHaveSameID(int id1, int id2);
|
||||
|
||||
protected:
|
||||
|
@ -14,7 +14,7 @@ CCSTutorStateSystem::~CCSTutorStateSystem()
|
||||
}
|
||||
}
|
||||
|
||||
bool CCSTutorStateSystem::UpdateState(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
bool CCSTutorStateSystem::UpdateState(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
if (!m_currentState)
|
||||
{
|
||||
@ -23,7 +23,7 @@ bool CCSTutorStateSystem::UpdateState(GameEventType event, CBaseEntity *entity,
|
||||
|
||||
if (m_currentState)
|
||||
{
|
||||
TutorStateType nextStateType = m_currentState->CheckForStateTransition(event, entity, other);
|
||||
TutorStateType nextStateType = m_currentState->CheckForStateTransition(event, pEntity, pOther);
|
||||
if (nextStateType != TUTORSTATE_UNDEFINED)
|
||||
{
|
||||
delete m_currentState;
|
||||
@ -67,22 +67,22 @@ CCSTutorUndefinedState::~CCSTutorUndefinedState()
|
||||
;
|
||||
}
|
||||
|
||||
TutorStateType CCSTutorUndefinedState::CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorStateType CCSTutorUndefinedState::CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
if (event == EVENT_PLAYER_SPAWNED)
|
||||
{
|
||||
return HandlePlayerSpawned(entity, other);
|
||||
return HandlePlayerSpawned(pEntity, pOther);
|
||||
}
|
||||
|
||||
return TUTORSTATE_UNDEFINED;
|
||||
}
|
||||
|
||||
TutorStateType CCSTutorUndefinedState::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorStateType CCSTutorUndefinedState::HandlePlayerSpawned(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (pLocalPlayer)
|
||||
{
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == pLocalPlayer)
|
||||
{
|
||||
return TUTORSTATE_WAITING_FOR_START;
|
||||
@ -107,14 +107,14 @@ CCSTutorWaitingForStartState::~CCSTutorWaitingForStartState()
|
||||
;
|
||||
}
|
||||
|
||||
TutorStateType CCSTutorWaitingForStartState::CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorStateType CCSTutorWaitingForStartState::CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case EVENT_PLAYER_SPAWNED:
|
||||
return HandlePlayerSpawned(entity, other);
|
||||
return HandlePlayerSpawned(pEntity, pOther);
|
||||
case EVENT_BUY_TIME_START:
|
||||
return HandleBuyTimeStart(entity, other);
|
||||
return HandleBuyTimeStart(pEntity, pOther);
|
||||
}
|
||||
|
||||
return TUTORSTATE_UNDEFINED;
|
||||
@ -132,12 +132,12 @@ const char *CCSTutorWaitingForStartState::GetStateString()
|
||||
return m_TutorStateStrings[m_type];
|
||||
}
|
||||
|
||||
TutorStateType CCSTutorWaitingForStartState::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorStateType CCSTutorWaitingForStartState::HandlePlayerSpawned(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (pLocalPlayer)
|
||||
{
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == pLocalPlayer)
|
||||
{
|
||||
return TUTORSTATE_WAITING_FOR_START;
|
||||
@ -147,7 +147,7 @@ TutorStateType CCSTutorWaitingForStartState::HandlePlayerSpawned(CBaseEntity *en
|
||||
return TUTORSTATE_UNDEFINED;
|
||||
}
|
||||
|
||||
TutorStateType CCSTutorWaitingForStartState::HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorStateType CCSTutorWaitingForStartState::HandleBuyTimeStart(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
return TUTORSTATE_BUYTIME;
|
||||
}
|
||||
@ -162,11 +162,11 @@ CCSTutorBuyMenuState::~CCSTutorBuyMenuState()
|
||||
;
|
||||
}
|
||||
|
||||
TutorStateType CCSTutorBuyMenuState::CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorStateType CCSTutorBuyMenuState::CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
if (event == EVENT_ROUND_START)
|
||||
{
|
||||
return HandleRoundStart(entity, other);
|
||||
return HandleRoundStart(pEntity, pOther);
|
||||
}
|
||||
|
||||
return TUTORSTATE_UNDEFINED;
|
||||
@ -184,7 +184,7 @@ const char *CCSTutorBuyMenuState::GetStateString()
|
||||
return m_TutorStateStrings[m_type];
|
||||
}
|
||||
|
||||
TutorStateType CCSTutorBuyMenuState::HandleRoundStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorStateType CCSTutorBuyMenuState::HandleRoundStart(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
return TUTORSTATE_WAITING_FOR_START;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
CCSTutorStateSystem();
|
||||
|
||||
virtual ~CCSTutorStateSystem();
|
||||
virtual bool UpdateState(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
|
||||
virtual bool UpdateState(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
virtual const char *GetCurrentStateString();
|
||||
|
||||
protected:
|
||||
@ -47,11 +47,11 @@ public:
|
||||
CCSTutorUndefinedState();
|
||||
|
||||
virtual ~CCSTutorUndefinedState();
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
virtual const char *GetStateString();
|
||||
|
||||
protected:
|
||||
TutorStateType HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other);
|
||||
TutorStateType HandlePlayerSpawned(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
};
|
||||
|
||||
class CCSTutorWaitingForStartState: public CBaseTutorState
|
||||
@ -60,12 +60,12 @@ public:
|
||||
CCSTutorWaitingForStartState();
|
||||
|
||||
virtual ~CCSTutorWaitingForStartState();
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
virtual const char *GetStateString();
|
||||
|
||||
protected:
|
||||
TutorStateType HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other);
|
||||
TutorStateType HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other);
|
||||
TutorStateType HandlePlayerSpawned(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
TutorStateType HandleBuyTimeStart(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
};
|
||||
|
||||
class CCSTutorBuyMenuState: public CBaseTutorState
|
||||
@ -74,9 +74,9 @@ public:
|
||||
CCSTutorBuyMenuState();
|
||||
|
||||
virtual ~CCSTutorBuyMenuState();
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
|
||||
virtual TutorStateType CheckForStateTransition(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
virtual const char *GetStateString();
|
||||
|
||||
protected:
|
||||
TutorStateType HandleRoundStart(CBaseEntity *entity, CBaseEntity *other);
|
||||
TutorStateType HandleRoundStart(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
};
|
||||
|
@ -752,7 +752,7 @@ NOXREF void CCSTutor::LookupHotKey(TutorMessageID mid, int paramNum, wchar_t *bu
|
||||
#endif
|
||||
}
|
||||
|
||||
TutorMessageEvent *CCSTutor::CreateTutorMessageEvent(TutorMessageID mid, CBaseEntity *entity, CBaseEntity *other)
|
||||
TutorMessageEvent *CCSTutor::CreateTutorMessageEvent(TutorMessageID mid, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
char enemyList[2048];
|
||||
char teammateList[2048];
|
||||
@ -892,9 +892,9 @@ void CCSTutor::AddToEventList(TutorMessageEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
auto event = CreateTutorMessageEvent(mid, entity, other);
|
||||
auto event = CreateTutorMessageEvent(mid, pEntity, pOther);
|
||||
if (event)
|
||||
{
|
||||
auto message = GetTutorMessageDefinition(mid);
|
||||
@ -906,7 +906,7 @@ void CCSTutor::CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *entity,
|
||||
m_lastScenarioEvent = nullptr;
|
||||
}
|
||||
|
||||
m_lastScenarioEvent = CreateTutorMessageEvent(mid, entity, other);
|
||||
m_lastScenarioEvent = CreateTutorMessageEvent(mid, pEntity, pOther);
|
||||
}
|
||||
|
||||
AddToEventList(event);
|
||||
@ -1093,197 +1093,197 @@ void CCSTutor::ConstructMessageAndDisplay()
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::CallEventHandler(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::CallEventHandler(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case EVENT_WEAPON_FIRED:
|
||||
HandleWeaponFired(entity, other);
|
||||
HandleWeaponFired(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_WEAPON_FIRED_ON_EMPTY:
|
||||
HandleWeaponFiredOnEmpty(entity, other);
|
||||
HandleWeaponFiredOnEmpty(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_WEAPON_RELOADED:
|
||||
HandleWeaponReloaded(entity, other);
|
||||
HandleWeaponReloaded(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_BEING_SHOT_AT:
|
||||
HandleBeingShotAt(entity, other);
|
||||
HandleBeingShotAt(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_PLAYER_BLINDED_BY_FLASHBANG:
|
||||
HandlePlayerBlindedByFlashbang(entity, other);
|
||||
HandlePlayerBlindedByFlashbang(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_PLAYER_DIED:
|
||||
HandlePlayerDied(entity, other);
|
||||
HandlePlayerDied(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_PLAYER_TOOK_DAMAGE:
|
||||
HandlePlayerTookDamage(entity, other);
|
||||
HandlePlayerTookDamage(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_HOSTAGE_DAMAGED:
|
||||
HandleHostageDamaged(entity, other);
|
||||
HandleHostageDamaged(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_HOSTAGE_KILLED:
|
||||
HandleHostageKilled(entity, other);
|
||||
HandleHostageKilled(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_BOMB_PLANTED:
|
||||
HandleBombPlanted(entity, other);
|
||||
HandleBombPlanted(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_BOMB_DEFUSING:
|
||||
HandleBombDefusing(entity, other);
|
||||
HandleBombDefusing(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_BOMB_DEFUSED:
|
||||
HandleBombDefused(entity, other);
|
||||
HandleBombDefused(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_BOMB_EXPLODED:
|
||||
HandleBombExploded(entity, other);
|
||||
HandleBombExploded(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_HOSTAGE_USED:
|
||||
HandleHostageUsed(entity, other);
|
||||
HandleHostageUsed(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_HOSTAGE_RESCUED:
|
||||
HandleHostageRescued(entity, other);
|
||||
HandleHostageRescued(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_ALL_HOSTAGES_RESCUED:
|
||||
HandleAllHostagesRescued(entity, other);
|
||||
HandleAllHostagesRescued(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TERRORISTS_WIN:
|
||||
HandleTWin(entity, other);
|
||||
HandleTWin(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_CTS_WIN:
|
||||
HandleCTWin(entity, other);
|
||||
HandleCTWin(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_ROUND_DRAW:
|
||||
HandleRoundDraw(entity, other);
|
||||
HandleRoundDraw(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_ROUND_START:
|
||||
HandleRoundStart(entity, other);
|
||||
HandleRoundStart(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_PLAYER_SPAWNED:
|
||||
HandlePlayerSpawned(entity, other);
|
||||
HandlePlayerSpawned(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_PLAYER_LEFT_BUY_ZONE:
|
||||
HandlePlayerLeftBuyZone(entity, other);
|
||||
HandlePlayerLeftBuyZone(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_DEATH_CAMERA_START:
|
||||
HandleDeathCameraStart(entity, other);
|
||||
HandleDeathCameraStart(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_BUY_MENU_OPENNED:
|
||||
HandleBuyMenuOpenned(entity, other);
|
||||
HandleBuyMenuOpenned(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_AUTOBUY:
|
||||
HandleAutoBuy(entity, other);
|
||||
HandleAutoBuy(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_NOT_BUYING_ANYTHING:
|
||||
HandleNotBuyingAnything(entity, other);
|
||||
HandleNotBuyingAnything(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_NEED_TO_BUY_PRIMARY_WEAPON:
|
||||
HandleNeedToBuyPrimaryWeapon(entity, other);
|
||||
HandleNeedToBuyPrimaryWeapon(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_NEED_TO_BUY_PRIMARY_AMMO:
|
||||
HandleNeedToBuyPrimaryAmmo(entity, other);
|
||||
HandleNeedToBuyPrimaryAmmo(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_NEED_TO_BUY_SECONDARY_AMMO:
|
||||
HandleNeedToBuySecondaryAmmo(entity, other);
|
||||
HandleNeedToBuySecondaryAmmo(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_NEED_TO_BUY_ARMOR:
|
||||
HandleNeedToBuyArmor(entity, other);
|
||||
HandleNeedToBuyArmor(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_NEED_TO_BUY_DEFUSE_KIT:
|
||||
HandleNeedToBuyDefuseKit(entity, other);
|
||||
HandleNeedToBuyDefuseKit(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_TUTOR_NEED_TO_BUY_GRENADE:
|
||||
HandleNeedToBuyGrenade(entity, other);
|
||||
HandleNeedToBuyGrenade(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_CAREER_TASK_DONE:
|
||||
HandleCareerTaskDone(entity, other);
|
||||
HandleCareerTaskDone(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_COVER_ME:
|
||||
HandleRadioCoverMe(entity, other);
|
||||
HandleRadioCoverMe(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_YOU_TAKE_THE_POINT:
|
||||
HandleRadioYouTakeThePoint(entity, other);
|
||||
HandleRadioYouTakeThePoint(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_HOLD_THIS_POSITION:
|
||||
HandleRadioHoldThisPosition(entity, other);
|
||||
HandleRadioHoldThisPosition(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_REGROUP_TEAM:
|
||||
HandleRadioRegroupTeam(entity, other);
|
||||
HandleRadioRegroupTeam(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_FOLLOW_ME:
|
||||
HandleRadioFollowMe(entity, other);
|
||||
HandleRadioFollowMe(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_TAKING_FIRE:
|
||||
HandleRadioTakingFire(entity, other);
|
||||
HandleRadioTakingFire(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_GO_GO_GO:
|
||||
HandleRadioGoGoGo(entity, other);
|
||||
HandleRadioGoGoGo(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_TEAM_FALL_BACK:
|
||||
HandleRadioTeamFallBack(entity, other);
|
||||
HandleRadioTeamFallBack(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_STICK_TOGETHER_TEAM:
|
||||
HandleRadioStickTogetherTeam(entity, other);
|
||||
HandleRadioStickTogetherTeam(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_GET_IN_POSITION_AND_WAIT:
|
||||
HandleRadioGetInPositionAndWait(entity, other);
|
||||
HandleRadioGetInPositionAndWait(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_STORM_THE_FRONT:
|
||||
HandleRadioStormTheFront(entity, other);
|
||||
HandleRadioStormTheFront(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_REPORT_IN_TEAM:
|
||||
HandleRadioReportInTeam(entity, other);
|
||||
HandleRadioReportInTeam(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_AFFIRMATIVE:
|
||||
HandleRadioAffirmative(entity, other);
|
||||
HandleRadioAffirmative(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_ENEMY_SPOTTED:
|
||||
HandleRadioEnemySpotted(entity, other);
|
||||
HandleRadioEnemySpotted(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_NEED_BACKUP:
|
||||
HandleRadioNeedBackup(entity, other);
|
||||
HandleRadioNeedBackup(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_SECTOR_CLEAR:
|
||||
HandleRadioSectorClear(entity, other);
|
||||
HandleRadioSectorClear(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_IN_POSITION:
|
||||
HandleRadioInPosition(entity, other);
|
||||
HandleRadioInPosition(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_REPORTING_IN:
|
||||
HandleRadioReportingIn(entity, other);
|
||||
HandleRadioReportingIn(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_GET_OUT_OF_THERE:
|
||||
HandleRadioGetOutOfThere(entity, other);
|
||||
HandleRadioGetOutOfThere(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_NEGATIVE:
|
||||
HandleRadioNegative(entity, other);
|
||||
HandleRadioNegative(pEntity, pOther);
|
||||
break;
|
||||
case EVENT_RADIO_ENEMY_DOWN:
|
||||
HandleRadioEnemyDown(entity, other);
|
||||
HandleRadioEnemyDown(pEntity, pOther);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleWeaponFired(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleWeaponFired(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer || !pLocalPlayer->IsAlive())
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer == pLocalPlayer)
|
||||
{
|
||||
CheckForNeedToReload();
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleWeaponFiredOnEmpty(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleWeaponFiredOnEmpty(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == pLocalPlayer)
|
||||
{
|
||||
CBasePlayerWeapon *pCurrentWeapon = static_cast<CBasePlayerWeapon *>(pPlayer->m_pActiveItem);
|
||||
@ -1300,23 +1300,23 @@ void CCSTutor::HandleWeaponFiredOnEmpty(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleWeaponReloaded(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleWeaponReloaded(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == UTIL_GetLocalPlayer())
|
||||
{
|
||||
CancelEvent(YOU_SHOULD_RELOAD);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandlePlayerDied(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pVictim = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(other);
|
||||
CBasePlayer *pVictim = static_cast<CBasePlayer *>(pEntity);
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
if (pVictim && !pVictim->IsPlayer())
|
||||
{
|
||||
@ -1332,7 +1332,7 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
if (pLocalPlayer->m_bKilledByBomb)
|
||||
{
|
||||
CreateAndAddEventToList(YOU_DIED, entity, other);
|
||||
CreateAndAddEventToList(YOU_DIED, pEntity, pOther);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1345,7 +1345,7 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
|
||||
if (pVictim == pAttacker && pVictim == pLocalPlayer)
|
||||
{
|
||||
CreateAndAddEventToList(YOU_DIED, entity, other);
|
||||
CreateAndAddEventToList(YOU_DIED, pEntity, pOther);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1356,7 +1356,7 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
if (pVictim->m_iTeam == pAttacker->m_iTeam)
|
||||
{
|
||||
CreateAndAddEventToList(YOU_KILLED_A_TEAMMATE, entity, other);
|
||||
CreateAndAddEventToList(YOU_KILLED_A_TEAMMATE, pEntity, pOther);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1368,9 +1368,9 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
switch (numT)
|
||||
{
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY_HEADSHOT, entity, other); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT_ONE_LEFT, entity, other); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT, entity, other); break;
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY_HEADSHOT, pEntity, pOther); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT_ONE_LEFT, pEntity, pOther); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT, pEntity, pOther); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1378,9 +1378,9 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
switch (numCT)
|
||||
{
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY_HEADSHOT, entity, other); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT_ONE_LEFT, entity, other); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT, entity, other); break;
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY_HEADSHOT, pEntity, pOther); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT_ONE_LEFT, pEntity, pOther); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER_HEADSHOT, pEntity, pOther); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1394,9 +1394,9 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
switch (numT)
|
||||
{
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY, entity, other); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_ONE_LEFT, entity, other); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER, entity, other); break;
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY, pEntity, pOther); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_ONE_LEFT, pEntity, pOther); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER, pEntity, pOther); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1404,9 +1404,9 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
switch (numCT)
|
||||
{
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY, entity, other); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_ONE_LEFT, entity, other); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER, entity, other); break;
|
||||
case 0: CreateAndAddEventToList(YOU_KILLED_LAST_ENEMY, pEntity, pOther); break;
|
||||
case 1: CreateAndAddEventToList(YOU_KILLED_PLAYER_ONE_LEFT, pEntity, pOther); break;
|
||||
default: CreateAndAddEventToList(YOU_KILLED_PLAYER, pEntity, pOther); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1415,7 +1415,7 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
else if (pVictim == pLocalPlayer)
|
||||
{
|
||||
CreateAndAddEventToList(pVictim->m_bHeadshotKilled ? YOU_DIED_HEADSHOT : YOU_DIED, entity, other);
|
||||
CreateAndAddEventToList(pVictim->m_bHeadshotKilled ? YOU_DIED_HEADSHOT : YOU_DIED, pEntity, pOther);
|
||||
}
|
||||
else if (pVictim->m_iTeam == pLocalPlayer->m_iTeam)
|
||||
{
|
||||
@ -1427,26 +1427,26 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
if (numCT == 1)
|
||||
{
|
||||
CreateAndAddEventToList(LAST_TEAMMATE_KILLED, entity, other);
|
||||
CreateAndAddEventToList(LAST_TEAMMATE_KILLED, pEntity, pOther);
|
||||
}
|
||||
else if (numCT == 2)
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, pEntity, pOther);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (numCT == 1)
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, pEntity, pOther);
|
||||
}
|
||||
else if (numCT > 1)
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1457,26 +1457,26 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
if (numT == 1)
|
||||
{
|
||||
CreateAndAddEventToList(LAST_TEAMMATE_KILLED, entity, other);
|
||||
CreateAndAddEventToList(LAST_TEAMMATE_KILLED, pEntity, pOther);
|
||||
}
|
||||
else if (numT == 2)
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, pEntity, pOther);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (numT == 1)
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED_ONE_LEFT, pEntity, pOther);
|
||||
}
|
||||
else if (numT > 1)
|
||||
{
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, entity, other);
|
||||
CreateAndAddEventToList(TEAMMATE_KILLED, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1491,9 +1491,9 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
switch (numT)
|
||||
{
|
||||
case 0: CreateAndAddEventToList(LAST_ENEMY_KILLED, entity, other); break;
|
||||
case 1: CreateAndAddEventToList(ENEMY_KILLED_ONE_LEFT, entity, other); break;
|
||||
default: CreateAndAddEventToList(ENEMY_KILLED, entity, other); break;
|
||||
case 0: CreateAndAddEventToList(LAST_ENEMY_KILLED, pEntity, pOther); break;
|
||||
case 1: CreateAndAddEventToList(ENEMY_KILLED_ONE_LEFT, pEntity, pOther); break;
|
||||
default: CreateAndAddEventToList(ENEMY_KILLED, pEntity, pOther); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1501,9 +1501,9 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
{
|
||||
switch (numCT)
|
||||
{
|
||||
case 0: CreateAndAddEventToList(LAST_ENEMY_KILLED, entity, other); break;
|
||||
case 1: CreateAndAddEventToList(ENEMY_KILLED_ONE_LEFT, entity, other); break;
|
||||
default: CreateAndAddEventToList(ENEMY_KILLED, entity, other); break;
|
||||
case 0: CreateAndAddEventToList(LAST_ENEMY_KILLED, pEntity, pOther); break;
|
||||
case 1: CreateAndAddEventToList(ENEMY_KILLED_ONE_LEFT, pEntity, pOther); break;
|
||||
default: CreateAndAddEventToList(ENEMY_KILLED, pEntity, pOther); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1511,14 +1511,14 @@ void CCSTutor::HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandlePlayerTookDamage(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandlePlayerTookDamage(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pVictim = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(other);
|
||||
CBasePlayer *pVictim = static_cast<CBasePlayer *>(pEntity);
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
if (pVictim && !pVictim->IsPlayer())
|
||||
{
|
||||
@ -1540,33 +1540,33 @@ void CCSTutor::HandlePlayerTookDamage(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandlePlayerBlindedByFlashbang(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandlePlayerBlindedByFlashbang(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == pLocalPlayer)
|
||||
{
|
||||
CreateAndAddEventToList(YOU_ARE_BLIND_FROM_FLASHBANG);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandlePlayerSpawned(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (!pPlayer || !pPlayer->IsPlayer() || pPlayer != UTIL_GetLocalPlayer())
|
||||
return;
|
||||
|
||||
m_haveSpawned = true;
|
||||
m_lastInGameHintShown = INGAME_HINT_BEGIN;
|
||||
CreateAndAddEventToList(YOU_SPAWNED, entity, other);
|
||||
CreateAndAddEventToList(YOU_SPAWNED, pEntity, pOther);
|
||||
}
|
||||
|
||||
NOXREF void CCSTutor::HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity *other)
|
||||
NOXREF void CCSTutor::HandleClientCorpseSpawned(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (!pPlayer || !pPlayer->IsPlayer())
|
||||
return;
|
||||
|
||||
@ -1578,7 +1578,7 @@ NOXREF void CCSTutor::HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity
|
||||
m_clientCorpseList.push_back(corpse);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleBuyMenuOpenned(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleBuyMenuOpenned(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
if (m_currentlyShownMessageID == BUY_TIME_BEGIN)
|
||||
{
|
||||
@ -1587,7 +1587,7 @@ void CCSTutor::HandleBuyMenuOpenned(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleAutoBuy(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleAutoBuy(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
if (m_currentlyShownMessageID == BUY_TIME_BEGIN)
|
||||
{
|
||||
@ -1595,12 +1595,12 @@ void CCSTutor::HandleAutoBuy(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
NOXREF void CCSTutor::HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
NOXREF void CCSTutor::HandleBuyTimeStart(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void CCSTutor::HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandlePlayerLeftBuyZone(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
m_messageTypeMask = (TUTORMESSAGETYPE_DEFAULT | TUTORMESSAGETYPE_FRIEND_DEATH | TUTORMESSAGETYPE_ENEMY_DEATH | TUTORMESSAGETYPE_SCENARIO | TUTORMESSAGETYPE_CAREER | TUTORMESSAGETYPE_INGAME_HINT | TUTORMESSAGETYPE_END_GAME);
|
||||
|
||||
@ -1615,7 +1615,7 @@ void CCSTutor::HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleBombPlanted(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
@ -1623,21 +1623,21 @@ void CCSTutor::HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other)
|
||||
|
||||
if (pLocalPlayer->IsAlive() && pLocalPlayer->m_iTeam == CT)
|
||||
{
|
||||
CreateAndAddEventToList(BOMB_PLANTED_CT, entity, other);
|
||||
CreateAndAddEventToList(BOMB_PLANTED_CT, pEntity, pOther);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateAndAddEventToList(BOMB_PLANTED_T, entity, other);
|
||||
CreateAndAddEventToList(BOMB_PLANTED_T, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleBombDefused(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleBombDefused(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pDefuser = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pDefuser = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pDefuser && pDefuser->IsPlayer() && pDefuser == pLocalPlayer)
|
||||
{
|
||||
CreateAndAddEventToList(YOU_DEFUSED_BOMB);
|
||||
@ -1652,20 +1652,20 @@ void CCSTutor::HandleBombDefused(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleBombDefusing(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleBombDefusing(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == pLocalPlayer && !pPlayer->m_bHasDefuser)
|
||||
{
|
||||
CreateAndAddEventToList(DEFUSING_WITHOUT_KIT);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleBombExploded(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleBombExploded(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
@ -1679,7 +1679,7 @@ void CCSTutor::HandleBombExploded(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRoundStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRoundStart(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
|
||||
@ -1697,7 +1697,7 @@ void CCSTutor::HandleRoundStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
case TERRORIST:
|
||||
{
|
||||
if (pLocalPlayer->m_bHasC4)
|
||||
CreateAndAddEventToList(YOU_ARE_BOMB_CARRIER, entity, other);
|
||||
CreateAndAddEventToList(YOU_ARE_BOMB_CARRIER, pEntity, pOther);
|
||||
else
|
||||
CreateAndAddEventToList(ROUND_START_DE_T);
|
||||
break;
|
||||
@ -1714,26 +1714,26 @@ void CCSTutor::HandleRoundStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleBeingShotAt(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleBeingShotAt(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == pLocalPlayer && pLocalPlayer->IsAlive())
|
||||
{
|
||||
CreateAndAddEventToList(YOU_HAVE_BEEN_SHOT_AT, entity, other);
|
||||
CreateAndAddEventToList(YOU_HAVE_BEEN_SHOT_AT, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleHostageUsed(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleHostageUsed(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pActivator = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pActivator = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pActivator && pActivator->IsPlayer())
|
||||
{
|
||||
bool unusedHostages = !CheckForAllHostagesFollowingSomeone();
|
||||
@ -1752,13 +1752,13 @@ void CCSTutor::HandleHostageUsed(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleHostageRescued(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleHostageRescued(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pRescuer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pRescuer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pRescuer && pRescuer->IsPlayer())
|
||||
{
|
||||
switch (pLocalPlayer->m_iTeam)
|
||||
@ -1769,7 +1769,7 @@ void CCSTutor::HandleHostageRescued(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleAllHostagesRescued(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleAllHostagesRescued(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
@ -1782,20 +1782,20 @@ void CCSTutor::HandleAllHostagesRescued(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleHostageDamaged(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleHostageDamaged(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(other);
|
||||
if (entity && pAttacker && pAttacker->IsPlayer() && pLocalPlayer == pAttacker)
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(pOther);
|
||||
if (pEntity && pAttacker && pAttacker->IsPlayer() && pLocalPlayer == pAttacker)
|
||||
{
|
||||
CreateAndAddEventToList(YOU_DAMAGED_HOSTAGE);
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleHostageKilled(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleHostageKilled(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
@ -1803,8 +1803,8 @@ void CCSTutor::HandleHostageKilled(CBaseEntity *entity, CBaseEntity *other)
|
||||
|
||||
CheckForAllHostagesDead();
|
||||
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(other);
|
||||
if (entity && pAttacker && pAttacker->IsPlayer())
|
||||
CBasePlayer *pAttacker = static_cast<CBasePlayer *>(pOther);
|
||||
if (pEntity && pAttacker && pAttacker->IsPlayer())
|
||||
{
|
||||
bool unusedHostages = CheckForAllHostagesFollowingSomeone();
|
||||
if (pLocalPlayer == pAttacker)
|
||||
@ -1823,7 +1823,7 @@ void CCSTutor::HandleHostageKilled(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRoundDraw(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRoundDraw(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
if (CSGameRules()->m_iTotalRoundsPlayed)
|
||||
{
|
||||
@ -1833,25 +1833,25 @@ void CCSTutor::HandleRoundDraw(CBaseEntity *entity, CBaseEntity *other)
|
||||
ResetPlayerDeathInfo();
|
||||
}
|
||||
|
||||
void CCSTutor::HandleCTWin(CBaseEntity *entith, CBaseEntity *other)
|
||||
void CCSTutor::HandleCTWin(CBaseEntity *entith, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(CT_WIN);
|
||||
ResetPlayerDeathInfo();
|
||||
}
|
||||
|
||||
void CCSTutor::HandleTWin(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleTWin(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(T_WIN);
|
||||
ResetPlayerDeathInfo();
|
||||
}
|
||||
|
||||
void CCSTutor::HandleDeathCameraStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleDeathCameraStart(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pLocalPlayer)
|
||||
return;
|
||||
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
if (pPlayer && pPlayer->IsPlayer() && pPlayer == pLocalPlayer)
|
||||
{
|
||||
m_messageTypeMask = (TUTORMESSAGETYPE_FRIEND_DEATH | TUTORMESSAGETYPE_ENEMY_DEATH | TUTORMESSAGETYPE_HINT | TUTORMESSAGETYPE_END_GAME);
|
||||
@ -1859,147 +1859,147 @@ void CCSTutor::HandleDeathCameraStart(CBaseEntity *entity, CBaseEntity *other)
|
||||
}
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioCoverMe(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioCoverMe(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_COVER_ME, entity, other);
|
||||
CreateAndAddEventToList(RADIO_COVER_ME, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioYouTakeThePoint(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioYouTakeThePoint(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_YOU_TAKE_THE_POINT, entity, other);
|
||||
CreateAndAddEventToList(RADIO_YOU_TAKE_THE_POINT, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioHoldThisPosition(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioHoldThisPosition(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_HOLD_THIS_POSITION, entity, other);
|
||||
CreateAndAddEventToList(RADIO_HOLD_THIS_POSITION, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioRegroupTeam(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioRegroupTeam(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_REGROUP_TEAM, entity, other);
|
||||
CreateAndAddEventToList(RADIO_REGROUP_TEAM, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioFollowMe(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioFollowMe(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_FOLLOW_ME, entity, other);
|
||||
CreateAndAddEventToList(RADIO_FOLLOW_ME, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioTakingFire(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioTakingFire(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_TAKING_FIRE, entity, other);
|
||||
CreateAndAddEventToList(RADIO_TAKING_FIRE, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioGoGoGo(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioGoGoGo(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_GO_GO_GO, entity, other);
|
||||
CreateAndAddEventToList(RADIO_GO_GO_GO, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioTeamFallBack(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioTeamFallBack(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_TEAM_FALL_BACK, entity, other);
|
||||
CreateAndAddEventToList(RADIO_TEAM_FALL_BACK, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioStickTogetherTeam(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioStickTogetherTeam(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_STICK_TOGETHER_TEAM, entity, other);
|
||||
CreateAndAddEventToList(RADIO_STICK_TOGETHER_TEAM, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioGetInPositionAndWait(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioGetInPositionAndWait(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_GET_IN_POSITION_AND_WAIT, entity, other);
|
||||
CreateAndAddEventToList(RADIO_GET_IN_POSITION_AND_WAIT, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioStormTheFront(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioStormTheFront(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_STORM_THE_FRONT, entity, other);
|
||||
CreateAndAddEventToList(RADIO_STORM_THE_FRONT, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioReportInTeam(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioReportInTeam(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_REPORT_IN_TEAM, entity, other);
|
||||
CreateAndAddEventToList(RADIO_REPORT_IN_TEAM, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioAffirmative(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioAffirmative(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_AFFIRMATIVE, entity, other);
|
||||
CreateAndAddEventToList(RADIO_AFFIRMATIVE, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioEnemySpotted(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioEnemySpotted(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_ENEMY_SPOTTED, entity, other);
|
||||
CreateAndAddEventToList(RADIO_ENEMY_SPOTTED, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioNeedBackup(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioNeedBackup(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_NEED_BACKUP, entity, other);
|
||||
CreateAndAddEventToList(RADIO_NEED_BACKUP, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioSectorClear(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioSectorClear(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_SECTOR_CLEAR, entity, other);
|
||||
CreateAndAddEventToList(RADIO_SECTOR_CLEAR, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioInPosition(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioInPosition(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_IN_POSITION, entity, other);
|
||||
CreateAndAddEventToList(RADIO_IN_POSITION, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioReportingIn(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioReportingIn(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_REPORTING_IN, entity, other);
|
||||
CreateAndAddEventToList(RADIO_REPORTING_IN, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioGetOutOfThere(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioGetOutOfThere(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_GET_OUT_OF_THERE, entity, other);
|
||||
CreateAndAddEventToList(RADIO_GET_OUT_OF_THERE, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioNegative(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioNegative(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_NEGATIVE, entity, other);
|
||||
CreateAndAddEventToList(RADIO_NEGATIVE, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleRadioEnemyDown(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleRadioEnemyDown(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(RADIO_ENEMY_DOWN, entity, other);
|
||||
CreateAndAddEventToList(RADIO_ENEMY_DOWN, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleNotBuyingAnything(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleNotBuyingAnything(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(BUY_TIME_BEGIN, entity, other);
|
||||
CreateAndAddEventToList(BUY_TIME_BEGIN, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleNeedToBuyPrimaryWeapon(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleNeedToBuyPrimaryWeapon(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(BUY_NEED_PRIMARY, entity, other);
|
||||
CreateAndAddEventToList(BUY_NEED_PRIMARY, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleNeedToBuyPrimaryAmmo(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleNeedToBuyPrimaryAmmo(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(BUY_NEED_PRIMARY_AMMO, entity, other);
|
||||
CreateAndAddEventToList(BUY_NEED_PRIMARY_AMMO, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleNeedToBuySecondaryAmmo(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleNeedToBuySecondaryAmmo(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(BUY_NEED_SECONDARY_AMMO, entity, other);
|
||||
CreateAndAddEventToList(BUY_NEED_SECONDARY_AMMO, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleNeedToBuyArmor(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleNeedToBuyArmor(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(BUY_NEED_ARMOR, entity, other);
|
||||
CreateAndAddEventToList(BUY_NEED_ARMOR, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleNeedToBuyDefuseKit(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleNeedToBuyDefuseKit(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(BUY_NEED_DEFUSE_KIT, entity, other);
|
||||
CreateAndAddEventToList(BUY_NEED_DEFUSE_KIT, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleNeedToBuyGrenade(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleNeedToBuyGrenade(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
CreateAndAddEventToList(BUY_NEED_GRENADE, entity, other);
|
||||
CreateAndAddEventToList(BUY_NEED_GRENADE, pEntity, pOther);
|
||||
}
|
||||
|
||||
void CCSTutor::HandleCareerTaskDone(CBaseEntity *entity, CBaseEntity *other)
|
||||
void CCSTutor::HandleCareerTaskDone(CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
int numTasksRemaining = 0;
|
||||
|
||||
@ -2263,7 +2263,7 @@ TutorMessageID CCSTutor::CheckForInBombZone()
|
||||
bool CCSTutor::IsBombPlantedInBombsite(CBaseEntity *bombTarget)
|
||||
{
|
||||
CGrenade *pBomb = nullptr;
|
||||
while ((pBomb = (CGrenade *)UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
while ((pBomb = UTIL_FindEntityByClassname(pBomb, "grenade")))
|
||||
{
|
||||
if (pBomb->m_bIsC4 && IsEntityInBombsite(pBomb, bombTarget))
|
||||
{
|
||||
@ -2376,7 +2376,7 @@ void CCSTutor::CheckForAllHostagesDead()
|
||||
bool foundLiveOne = false;
|
||||
CHostage *pHostage = nullptr;
|
||||
|
||||
while ((pHostage = (CHostage *)UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (pHostage->IsAlive())
|
||||
{
|
||||
@ -2396,7 +2396,7 @@ bool CCSTutor::CheckForAllHostagesFollowingSomeone()
|
||||
bool foundUnusedOne = false;
|
||||
CHostage *pHostage = nullptr;
|
||||
|
||||
while ((pHostage = (CHostage *)UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (pHostage->IsAlive())
|
||||
{
|
||||
|
@ -275,13 +275,13 @@ public:
|
||||
virtual ~CCSTutor();
|
||||
virtual void TutorThink(float time);
|
||||
virtual void PurgeMessages();
|
||||
virtual void CallEventHandler(GameEventType event, CBaseEntity *entity, CBaseEntity *other);
|
||||
virtual void CallEventHandler(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
virtual void ShowTutorMessage(TutorMessageEvent *event);
|
||||
virtual void HandleShotFired(Vector source, Vector target);
|
||||
virtual TutorMessage *GetTutorMessageDefinition(int messageID);
|
||||
|
||||
void CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *entity = NULL, CBaseEntity *other = NULL);
|
||||
TutorMessageEvent *CreateTutorMessageEvent(TutorMessageID mid, CBaseEntity *entity = NULL, CBaseEntity *other = NULL);
|
||||
void CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr);
|
||||
TutorMessageEvent *CreateTutorMessageEvent(TutorMessageID mid, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr);
|
||||
void AddToEventList(TutorMessageEvent *event);
|
||||
void DeleteEventFromEventList(TutorMessageEvent *event);
|
||||
void ClearEventList();
|
||||
@ -307,62 +307,62 @@ public:
|
||||
bool IsHostageMap();
|
||||
|
||||
public:
|
||||
void HandleWeaponFired(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleWeaponFiredOnEmpty(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleWeaponReloaded(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandlePlayerTookDamage(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandlePlayerBlindedByFlashbang(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRoundStart(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleBombDefused(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleBombExploded(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleHostageUsed(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleHostageRescued(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleHostageDamaged(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleHostageKilled(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleAllHostagesRescued(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleBeingShotAt(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRoundDraw(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleCTWin(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleTWin(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleDeathCameraStart(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleBombDefusing(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioCoverMe(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioYouTakeThePoint(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioHoldThisPosition(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioRegroupTeam(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioFollowMe(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioTakingFire(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioGoGoGo(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioTeamFallBack(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioStickTogetherTeam(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioGetInPositionAndWait(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioStormTheFront(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioReportInTeam(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioAffirmative(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioEnemySpotted(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioNeedBackup(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioSectorClear(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioInPosition(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioReportingIn(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioGetOutOfThere(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioNegative(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleRadioEnemyDown(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleBuyMenuOpenned(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleAutoBuy(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleNotBuyingAnything(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleNeedToBuyPrimaryWeapon(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleNeedToBuyPrimaryAmmo(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleNeedToBuySecondaryAmmo(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleNeedToBuyArmor(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleNeedToBuyDefuseKit(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleNeedToBuyGrenade(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleCareerTaskDone(CBaseEntity *entity, CBaseEntity *other);
|
||||
void HandleWeaponFired(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleWeaponFiredOnEmpty(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleWeaponReloaded(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandlePlayerDied(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandlePlayerSpawned(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleClientCorpseSpawned(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandlePlayerTookDamage(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandlePlayerBlindedByFlashbang(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleBuyTimeStart(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandlePlayerLeftBuyZone(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleBombPlanted(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRoundStart(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleBombDefused(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleBombExploded(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleHostageUsed(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleHostageRescued(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleHostageDamaged(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleHostageKilled(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleAllHostagesRescued(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleBeingShotAt(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRoundDraw(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleCTWin(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleTWin(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleDeathCameraStart(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleBombDefusing(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioCoverMe(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioYouTakeThePoint(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioHoldThisPosition(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioRegroupTeam(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioFollowMe(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioTakingFire(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioGoGoGo(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioTeamFallBack(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioStickTogetherTeam(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioGetInPositionAndWait(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioStormTheFront(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioReportInTeam(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioAffirmative(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioEnemySpotted(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioNeedBackup(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioSectorClear(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioInPosition(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioReportingIn(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioGetOutOfThere(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioNegative(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleRadioEnemyDown(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleBuyMenuOpenned(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleAutoBuy(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleNotBuyingAnything(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleNeedToBuyPrimaryWeapon(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleNeedToBuyPrimaryAmmo(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleNeedToBuySecondaryAmmo(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleNeedToBuyArmor(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleNeedToBuyDefuseKit(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleNeedToBuyGrenade(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
void HandleCareerTaskDone(CBaseEntity *pEntity, CBaseEntity *pOther);
|
||||
|
||||
void GetNumPlayersAliveOnTeams(int &numT, int &numCT);
|
||||
void CheckForBombViewable();
|
||||
@ -384,7 +384,7 @@ public:
|
||||
bool IsBombPlantedInBombZone(const char *pszBombZone);
|
||||
void ReadTutorMessageFile();
|
||||
void ApplyPersistentDecay();
|
||||
CBaseEntity *GetEntityForMessageID(int messageID, CBaseEntity *last = NULL);
|
||||
CBaseEntity *GetEntityForMessageID(int messageID, CBaseEntity *last = nullptr);
|
||||
void ResetPlayerDeathInfo();
|
||||
void ConstructRecentDeathsList(TeamName team, char *buf, int buflen, TutorMessageEvent *event);
|
||||
|
||||
|
@ -919,7 +919,7 @@ float UTIL_Approach(float target, float value, float speed)
|
||||
return value;
|
||||
}
|
||||
|
||||
float_precision UTIL_ApproachAngle(float target, float value, float speed)
|
||||
real_t UTIL_ApproachAngle(float target, float value, float speed)
|
||||
{
|
||||
target = UTIL_AngleMod(target);
|
||||
|
||||
@ -948,9 +948,9 @@ float_precision UTIL_ApproachAngle(float target, float value, float speed)
|
||||
return value;
|
||||
}
|
||||
|
||||
float_precision UTIL_AngleDistance(float next, float cur)
|
||||
real_t UTIL_AngleDistance(float next, float cur)
|
||||
{
|
||||
float_precision delta;
|
||||
real_t delta;
|
||||
|
||||
delta = next - cur;
|
||||
|
||||
@ -1617,7 +1617,7 @@ bool UTIL_IsGame(const char *pszGameName)
|
||||
return false;
|
||||
}
|
||||
|
||||
float_precision UTIL_GetPlayerGaitYaw(int playerIndex)
|
||||
real_t UTIL_GetPlayerGaitYaw(int playerIndex)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(playerIndex);
|
||||
if (pPlayer)
|
||||
|
@ -88,7 +88,7 @@
|
||||
#define VEC_DUCK_VIEW Vector(0, 0, 12)
|
||||
|
||||
#define PRECACHE_SOUND_ARRAY(a) \
|
||||
{ for (int i = 0; i < ARRAYSIZE(a); ++i) PRECACHE_SOUND((char *)a[i]); }
|
||||
{ for (int i = 0; i < ARRAYSIZE(a); i++) PRECACHE_SOUND((char *)a[i]); }
|
||||
|
||||
#define PLAYBACK_EVENT(flags, who, index)\
|
||||
PLAYBACK_EVENT_FULL(flags, who, index, 0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
|
||||
@ -251,8 +251,8 @@ float UTIL_VecToYaw(const Vector &vec);
|
||||
void UTIL_SetOrigin(entvars_t *pev, const Vector &vecOrigin);
|
||||
void UTIL_ParticleEffect(const Vector &vecOrigin, const Vector &vecDirection, ULONG ulColor, ULONG ulCount);
|
||||
float UTIL_Approach(float target, float value, float speed);
|
||||
float_precision UTIL_ApproachAngle(float target, float value, float speed);
|
||||
float_precision UTIL_AngleDistance(float next, float cur);
|
||||
real_t UTIL_ApproachAngle(float target, float value, float speed);
|
||||
real_t UTIL_AngleDistance(float next, float cur);
|
||||
float UTIL_SplineFraction(float value, float scale);
|
||||
char *UTIL_VarArgs(char *format, ...);
|
||||
Vector UTIL_GetAimVector(edict_t *pent, float flSpeed);
|
||||
@ -289,7 +289,7 @@ void EntvarsKeyvalue(entvars_t *pev, KeyValueData *pkvd);
|
||||
char UTIL_TextureHit(TraceResult *ptr, Vector vecSrc, Vector vecEnd);
|
||||
int GetPlayerTeam(int index);
|
||||
bool UTIL_IsGame(const char *pszGameName);
|
||||
float_precision UTIL_GetPlayerGaitYaw(int playerIndex);
|
||||
real_t UTIL_GetPlayerGaitYaw(int playerIndex);
|
||||
int UTIL_ReadFlags(const char *c);
|
||||
bool UTIL_AreBotsAllowed();
|
||||
bool UTIL_AreHostagesImprov();
|
||||
@ -351,9 +351,9 @@ public:
|
||||
|
||||
int UTIL_CountPlayersInBrushVolume(bool bOnlyAlive, CBaseEntity *pBrushEntity, int &playersInCount, int &playersOutCount, CPlayerInVolumeAdapter *pAdapter = nullptr);
|
||||
|
||||
inline float_precision UTIL_FixupAngle(float_precision v)
|
||||
inline real_t UTIL_FixupAngle(real_t v)
|
||||
{
|
||||
float_precision angle = v;
|
||||
real_t angle = v;
|
||||
|
||||
while (angle < 0)
|
||||
angle += 360;
|
||||
|
@ -71,15 +71,15 @@ public:
|
||||
|
||||
// Methods
|
||||
inline void CopyToArray(float *rgfl) const { *(int *)&rgfl[0] = *(int *)&x; *(int *)&rgfl[1] = *(int *)&y; }
|
||||
inline float_precision Length() const { return Q_sqrt(float_precision(x * x + y * y)); } // Get the vector's magnitude
|
||||
inline float LengthSquared() const { return (x * x + y * y); } // Get the vector's magnitude squared
|
||||
inline real_t Length() const { return Q_sqrt(real_t(x * x + y * y)); } // Get the vector's magnitude
|
||||
inline float LengthSquared() const { return (x * x + y * y); } // Get the vector's magnitude squared
|
||||
|
||||
operator float*() { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
|
||||
Vector2D Normalize() const
|
||||
{
|
||||
float_precision flLen = Length();
|
||||
real_t flLen = Length();
|
||||
if (!flLen)
|
||||
return Vector2D(0, 0);
|
||||
|
||||
@ -93,9 +93,9 @@ public:
|
||||
}
|
||||
inline bool IsLengthLessThan (float length) const { return (LengthSquared() < length * length); }
|
||||
inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); }
|
||||
float_precision NormalizeInPlace()
|
||||
real_t NormalizeInPlace()
|
||||
{
|
||||
float_precision flLen = Length();
|
||||
real_t flLen = Length();
|
||||
if (flLen > 0.0)
|
||||
{
|
||||
x = vec_t(1 / flLen * x);
|
||||
@ -118,7 +118,7 @@ public:
|
||||
vec_t x, y;
|
||||
};
|
||||
|
||||
inline float_precision DotProduct(const Vector2D &a, const Vector2D &b)
|
||||
inline real_t DotProduct(const Vector2D &a, const Vector2D &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y);
|
||||
}
|
||||
@ -179,17 +179,17 @@ public:
|
||||
}
|
||||
|
||||
// Get the vector's magnitude
|
||||
float_precision Length() const
|
||||
real_t Length() const
|
||||
{
|
||||
float_precision x1 = float_precision(x);
|
||||
float_precision y1 = float_precision(y);
|
||||
float_precision z1 = float_precision(z);
|
||||
real_t x1 = real_t(x);
|
||||
real_t y1 = real_t(y);
|
||||
real_t z1 = real_t(z);
|
||||
|
||||
return Q_sqrt(x1 * x1 + y1 * y1 + z1 * z1);
|
||||
}
|
||||
|
||||
// Get the vector's magnitude squared
|
||||
float_precision LengthSquared() const { return (x * x + y * y + z * z); }
|
||||
real_t LengthSquared() const { return (x * x + y * y + z * z); }
|
||||
|
||||
operator float*() { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
operator const float*() const { return &x; } // Vectors will now automatically convert to float * when needed
|
||||
@ -207,7 +207,7 @@ public:
|
||||
#else
|
||||
Vector Normalize()
|
||||
{
|
||||
float_precision flLen = Length();
|
||||
real_t flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
@ -221,7 +221,7 @@ public:
|
||||
#ifndef PLAY_GAMEDLL
|
||||
return Normalize();
|
||||
#else
|
||||
float_precision flLen = Length();
|
||||
real_t flLen = Length();
|
||||
if (flLen == 0)
|
||||
return Vector(0, 0, 1);
|
||||
|
||||
@ -237,14 +237,14 @@ public:
|
||||
return Vec2;
|
||||
}
|
||||
|
||||
float_precision Length2D() const { return Q_sqrt(float_precision(x * x + y * y)); }
|
||||
real_t Length2D() const { return Q_sqrt(real_t(x * x + y * y)); }
|
||||
|
||||
inline bool IsLengthLessThan (float length) const { return (LengthSquared() < length * length); }
|
||||
inline bool IsLengthGreaterThan(float length) const { return (LengthSquared() > length * length); }
|
||||
|
||||
#ifdef PLAY_GAMEDLL
|
||||
template<typename T = float_precision>
|
||||
float_precision NormalizeInPlace()
|
||||
template<typename T = real_t>
|
||||
real_t NormalizeInPlace()
|
||||
{
|
||||
T flLen = Length();
|
||||
|
||||
@ -298,12 +298,12 @@ inline Vector operator*(float fl, const Vector &v)
|
||||
return v * fl;
|
||||
}
|
||||
|
||||
inline float_precision DotProduct(const Vector &a, const Vector &b)
|
||||
inline real_t DotProduct(const Vector &a, const Vector &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y + a.z * b.z);
|
||||
}
|
||||
|
||||
inline float_precision DotProduct2D(const Vector &a, const Vector &b)
|
||||
inline real_t DotProduct2D(const Vector &a, const Vector &b)
|
||||
{
|
||||
return (a.x * b.x + a.y * b.y);
|
||||
}
|
||||
@ -325,7 +325,7 @@ inline LenType LengthSubtract(Vector vecStart, Vector vecDest)
|
||||
Y floatY = (vecDest.y - vecStart.y);
|
||||
Z floatZ = (vecDest.z - vecStart.z);
|
||||
|
||||
return Q_sqrt(float_precision(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
return Q_sqrt(real_t(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
}
|
||||
|
||||
template<
|
||||
@ -344,7 +344,7 @@ inline Vector NormalizeSubtract(Vector vecStart, Vector vecDest)
|
||||
Y floatY = (vecDest.y - vecStart.y);
|
||||
Z floatZ = (vecDest.z - vecStart.z);
|
||||
|
||||
LenType flLen = Q_sqrt(float_precision(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
LenType flLen = Q_sqrt(real_t(floatX * floatX + floatY * floatY + floatZ * floatZ));
|
||||
|
||||
if (flLen == 0.0)
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ void CFuncVehicle::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
|
||||
pev->avelocity = g_vecZero;
|
||||
|
||||
StopSound();
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ void CFuncVehicle::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE u
|
||||
}
|
||||
}
|
||||
|
||||
float_precision flSpeedRatio = delta;
|
||||
real_t flSpeedRatio = delta;
|
||||
|
||||
if (delta > 0)
|
||||
{
|
||||
@ -297,7 +297,7 @@ void CFuncVehicle::UpdateSound()
|
||||
|
||||
void CFuncVehicle::CheckTurning()
|
||||
{
|
||||
float_precision maxspeed;
|
||||
real_t maxspeed;
|
||||
TraceResult tr;
|
||||
bool bTurnIntoWall = false;
|
||||
|
||||
@ -566,7 +566,7 @@ void CFuncVehicle::Next()
|
||||
Vector vTargetAngle, vAngle;
|
||||
|
||||
float vx;
|
||||
float_precision vy;
|
||||
real_t vy;
|
||||
|
||||
m_vVehicleDirection = CrossProduct(m_vSurfaceNormal, gpGlobals->v_forward);
|
||||
m_vVehicleDirection = CrossProduct(m_vSurfaceNormal, m_vVehicleDirection);
|
||||
@ -766,7 +766,7 @@ void CFuncVehicle::NearestPath()
|
||||
{
|
||||
CPathTrack *pTrack = nullptr;
|
||||
CPathTrack *pNearest = nullptr;
|
||||
float_precision dist;
|
||||
real_t dist;
|
||||
float closest = 1024.0f;
|
||||
|
||||
while ((pTrack = UTIL_FindEntityInSphere(pTrack, pev->origin, 1024.0f)))
|
||||
@ -787,7 +787,7 @@ void CFuncVehicle::NearestPath()
|
||||
if (!pNearest)
|
||||
{
|
||||
ALERT(at_console, "Can't find a nearby track !!!\n");
|
||||
SetThink(NULL);
|
||||
SetThink(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -677,7 +677,7 @@ bool CBasePlayerWeapon::ShieldSecondaryFire(int iUpAnim, int iDownAnim)
|
||||
|
||||
void CBasePlayerWeapon::KickBack(float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change)
|
||||
{
|
||||
float_precision flKickUp;
|
||||
real_t flKickUp;
|
||||
float flKickLateral;
|
||||
|
||||
if (m_iShotsFired == 1)
|
||||
@ -2083,7 +2083,7 @@ void CArmoury::Restart()
|
||||
return;
|
||||
}
|
||||
|
||||
float flRatio = float_precision(m_iInitialCount / CSGameRules()->m_iTotalGrenadeCount) * float_precision(CSGameRules()->m_iNumTerrorist) * 1.75;
|
||||
float flRatio = real_t(m_iInitialCount / CSGameRules()->m_iTotalGrenadeCount) * real_t(CSGameRules()->m_iNumTerrorist) * 1.75;
|
||||
m_iCount = int(flRatio);
|
||||
}
|
||||
else if (m_iItem == ARMOURY_KEVLAR || m_iItem == ARMOURY_ASSAULT)
|
||||
@ -2097,7 +2097,7 @@ void CArmoury::Restart()
|
||||
return;
|
||||
}
|
||||
|
||||
float flRatio = float_precision(m_iInitialCount / CSGameRules()->m_iTotalArmourCount) * float_precision(CSGameRules()->m_iNumTerrorist);
|
||||
float flRatio = real_t(m_iInitialCount / CSGameRules()->m_iTotalArmourCount) * real_t(CSGameRules()->m_iNumTerrorist);
|
||||
m_iCount = int(flRatio);
|
||||
}
|
||||
else
|
||||
@ -2111,7 +2111,7 @@ void CArmoury::Restart()
|
||||
return;
|
||||
}
|
||||
|
||||
float flRatio = float_precision(m_iInitialCount / CSGameRules()->m_iTotalGunCount) * float_precision(CSGameRules()->m_iNumTerrorist) * 0.85;
|
||||
float flRatio = real_t(m_iInitialCount / CSGameRules()->m_iTotalGunCount) * real_t(CSGameRules()->m_iNumTerrorist) * 0.85;
|
||||
m_iCount = int(flRatio);
|
||||
}
|
||||
}
|
||||
@ -2206,13 +2206,13 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
||||
if (!pOther->IsPlayer())
|
||||
return;
|
||||
|
||||
CBasePlayer *p = static_cast<CBasePlayer *>(pOther);
|
||||
CBasePlayer *pToucher = static_cast<CBasePlayer *>(pOther);
|
||||
|
||||
if (p->m_bIsVIP)
|
||||
if (pToucher->m_bIsVIP)
|
||||
return;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (p->HasRestrictItem(GetItemIdByArmoury(m_iItem), ITEM_TYPE_TOUCHED))
|
||||
if (pToucher->HasRestrictItem(GetItemIdByArmoury(m_iItem), ITEM_TYPE_TOUCHED))
|
||||
return;
|
||||
#endif
|
||||
|
||||
@ -2223,32 +2223,32 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
||||
#endif
|
||||
))
|
||||
{
|
||||
if (p->m_bHasPrimary)
|
||||
if (pToucher->m_bHasPrimary)
|
||||
return;
|
||||
|
||||
m_iCount--;
|
||||
auto item = &armouryItemInfo[m_iItem];
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
p->GiveNamedItemEx(item->entityName);
|
||||
pToucher->GiveNamedItemEx(item->entityName);
|
||||
#else
|
||||
p->GiveNamedItem(item->entityName);
|
||||
pToucher->GiveNamedItem(item->entityName);
|
||||
#endif
|
||||
|
||||
p->GiveAmmo(item->giveAmount, item->ammoName, item->maxRounds);
|
||||
pToucher->GiveAmmo(item->giveAmount, item->ammoName, item->maxRounds);
|
||||
}
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// secondary weapons (pistols)
|
||||
else if (m_iCount > 0 && m_iItem >= ARMOURY_GLOCK18)
|
||||
{
|
||||
if (p->m_rgpPlayerItems[PISTOL_SLOT])
|
||||
if (pToucher->m_rgpPlayerItems[PISTOL_SLOT])
|
||||
return;
|
||||
|
||||
m_iCount--;
|
||||
auto item = &armouryItemInfo[m_iItem];
|
||||
|
||||
p->GiveNamedItemEx(item->entityName);
|
||||
p->GiveAmmo(item->giveAmount, item->ammoName, item->maxRounds);
|
||||
pToucher->GiveNamedItemEx(item->entityName);
|
||||
pToucher->GiveAmmo(item->giveAmount, item->ammoName, item->maxRounds);
|
||||
}
|
||||
#endif
|
||||
// items & grenades
|
||||
@ -2258,56 +2258,56 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
|
||||
{
|
||||
case ARMOURY_FLASHBANG:
|
||||
{
|
||||
if (p->AmmoInventory(AMMO_FLASHBANG) >= MaxAmmoCarry(WEAPON_FLASHBANG))
|
||||
if (pToucher->AmmoInventory(AMMO_FLASHBANG) >= MaxAmmoCarry(WEAPON_FLASHBANG))
|
||||
return;
|
||||
|
||||
p->GiveNamedItem("weapon_flashbang");
|
||||
pToucher->GiveNamedItem("weapon_flashbang");
|
||||
m_iCount--;
|
||||
break;
|
||||
}
|
||||
case ARMOURY_HEGRENADE:
|
||||
{
|
||||
if (p->AmmoInventory(AMMO_HEGRENADE) >= MaxAmmoCarry(WEAPON_HEGRENADE))
|
||||
if (pToucher->AmmoInventory(AMMO_HEGRENADE) >= MaxAmmoCarry(WEAPON_HEGRENADE))
|
||||
return;
|
||||
|
||||
p->GiveNamedItem("weapon_hegrenade");
|
||||
pToucher->GiveNamedItem("weapon_hegrenade");
|
||||
m_iCount--;
|
||||
break;
|
||||
}
|
||||
case ARMOURY_KEVLAR:
|
||||
{
|
||||
if (p->m_iKevlar == ARMOR_KEVLAR)
|
||||
if (pToucher->m_iKevlar == ARMOR_KEVLAR)
|
||||
return;
|
||||
|
||||
p->GiveNamedItem("item_kevlar");
|
||||
pToucher->GiveNamedItem("item_kevlar");
|
||||
m_iCount--;
|
||||
break;
|
||||
}
|
||||
case ARMOURY_ASSAULT:
|
||||
{
|
||||
if (p->m_iKevlar == ARMOR_VESTHELM)
|
||||
if (pToucher->m_iKevlar == ARMOR_VESTHELM)
|
||||
return;
|
||||
|
||||
p->GiveNamedItem("item_assaultsuit");
|
||||
pToucher->GiveNamedItem("item_assaultsuit");
|
||||
m_iCount--;
|
||||
break;
|
||||
}
|
||||
case ARMOURY_SMOKEGRENADE:
|
||||
{
|
||||
if (p->AmmoInventory(AMMO_SMOKEGRENADE) >= MaxAmmoCarry(WEAPON_SMOKEGRENADE))
|
||||
if (pToucher->AmmoInventory(AMMO_SMOKEGRENADE) >= MaxAmmoCarry(WEAPON_SMOKEGRENADE))
|
||||
return;
|
||||
|
||||
p->GiveNamedItem("weapon_smokegrenade");
|
||||
pToucher->GiveNamedItem("weapon_smokegrenade");
|
||||
m_iCount--;
|
||||
break;
|
||||
}
|
||||
#ifdef REGAMEDLL_ADD
|
||||
case ARMOURY_SHIELD:
|
||||
{
|
||||
if (p->m_bHasPrimary || (p->m_rgpPlayerItems[PISTOL_SLOT] && p->GetItemById(WEAPON_ELITE)))
|
||||
if (pToucher->m_bHasPrimary || (pToucher->m_rgpPlayerItems[PISTOL_SLOT] && pToucher->GetItemById(WEAPON_ELITE)))
|
||||
return;
|
||||
|
||||
p->GiveNamedItemEx("weapon_shield");
|
||||
pToucher->GiveNamedItemEx("weapon_shield");
|
||||
m_iCount--;
|
||||
break;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ public:
|
||||
virtual int PrimaryAmmoIndex() { return -1; }
|
||||
virtual int SecondaryAmmoIndex() { return -1; }
|
||||
virtual int UpdateClientData(CBasePlayer *pPlayer) { return 0; }
|
||||
virtual CBasePlayerItem *GetWeaponPtr() { return NULL; }
|
||||
virtual CBasePlayerItem *GetWeaponPtr() { return nullptr; }
|
||||
virtual float GetMaxSpeed() { return 260.0f; }
|
||||
virtual int iItemSlot() { return 0; } // return 0 to MAX_ITEMS_SLOTS, used in hud
|
||||
|
||||
@ -443,7 +443,7 @@ public:
|
||||
|
||||
public:
|
||||
BOOL IsEmpty();
|
||||
int GiveAmmo(int iCount, char *szName, int iMax, int *pIndex = NULL);
|
||||
int GiveAmmo(int iCount, char *szName, int iMax, int *pIndex = nullptr);
|
||||
|
||||
void EXPORT Kill();
|
||||
void EXPORT BombThink();
|
||||
|
@ -183,7 +183,7 @@ void CFlashbang::WeaponIdle()
|
||||
else
|
||||
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
|
||||
|
||||
float_precision flVel = (90.0f - angThrow.x) * 6.0f;
|
||||
real_t flVel = (90.0f - angThrow.x) * 6.0f;
|
||||
|
||||
if (flVel > 750.0f)
|
||||
flVel = 750.0f;
|
||||
|
@ -39,7 +39,7 @@ int CG3SG1::GetItemInfo(ItemInfo *p)
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "762Nato";
|
||||
p->iMaxAmmo1 = MAX_AMMO_762NATO;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->pszAmmo2 = nullptr;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = G3SG1_MAX_CLIP;
|
||||
p->iSlot = 0;
|
||||
@ -73,7 +73,7 @@ void CG3SG1::SecondaryAttack()
|
||||
|
||||
m_pPlayer->ResetMaxSpeed();
|
||||
|
||||
if (TheBots != NULL)
|
||||
if (TheBots)
|
||||
{
|
||||
TheBots->OnEvent(EVENT_WEAPON_ZOOMED, m_pPlayer);
|
||||
}
|
||||
@ -136,7 +136,7 @@ void CG3SG1::G3SG1Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim)
|
||||
m_flNextPrimaryAttack = GetNextAttackDelay(0.2);
|
||||
}
|
||||
|
||||
if (TheBots != NULL)
|
||||
if (TheBots)
|
||||
{
|
||||
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, fl
|
||||
|
||||
if (tmpTrace.flFraction < 1.0f)
|
||||
{
|
||||
float_precision thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();
|
||||
real_t thisDistance = (tmpTrace.vecEndPos - vecSrc).Length();
|
||||
|
||||
if (thisDistance < distance)
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ void CSmokeGrenade::WeaponIdle()
|
||||
else
|
||||
angThrow.x = -10 + angThrow.x * ((90 + 10) / 90.0);
|
||||
|
||||
float_precision flVel = (90.0f - angThrow.x) * 6.0f;
|
||||
real_t flVel = (90.0f - angThrow.x) * 6.0f;
|
||||
|
||||
if (flVel > 750.0f)
|
||||
flVel = 750.0f;
|
||||
|
@ -37,7 +37,7 @@ int CXM1014::GetItemInfo(ItemInfo *p)
|
||||
p->pszName = STRING(pev->classname);
|
||||
p->pszAmmo1 = "buckshot";
|
||||
p->iMaxAmmo1 = MAX_AMMO_BUCKSHOT;
|
||||
p->pszAmmo2 = NULL;
|
||||
p->pszAmmo2 = nullptr;
|
||||
p->iMaxAmmo2 = -1;
|
||||
p->iMaxClip = XM1014_MAX_CLIP;
|
||||
p->iSlot = 0;
|
||||
@ -76,7 +76,7 @@ void CXM1014::PrimaryAttack()
|
||||
PlayEmptySound();
|
||||
}
|
||||
|
||||
if (TheBots != NULL)
|
||||
if (TheBots)
|
||||
{
|
||||
TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer);
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
||||
enum GameEventType
|
||||
{
|
||||
EVENT_INVALID = 0,
|
||||
EVENT_WEAPON_FIRED, // tell bots the player is attack (argumens: 1 = attacker, 2 = NULL)
|
||||
EVENT_WEAPON_FIRED_ON_EMPTY, // tell bots the player is attack without clip ammo (argumens: 1 = attacker, 2 = NULL)
|
||||
EVENT_WEAPON_RELOADED, // tell bots the player is reloading his weapon (argumens: 1 = reloader, 2 = NULL)
|
||||
EVENT_WEAPON_FIRED, // tell bots the player is attack (argumens: 1 = attacker, 2 = NULL)
|
||||
EVENT_WEAPON_FIRED_ON_EMPTY, // tell bots the player is attack without clip ammo (argumens: 1 = attacker, 2 = NULL)
|
||||
EVENT_WEAPON_RELOADED, // tell bots the player is reloading his weapon (argumens: 1 = reloader, 2 = NULL)
|
||||
|
||||
EVENT_HE_GRENADE_EXPLODED, // tell bots the HE grenade is exploded (argumens: 1 = grenade thrower, 2 = NULL)
|
||||
EVENT_FLASHBANG_GRENADE_EXPLODED, // tell bots the flashbang grenade is exploded (argumens: 1 = grenade thrower, 2 = explosion origin)
|
||||
@ -50,35 +50,35 @@ enum GameEventType
|
||||
EVENT_HOSTAGE_DAMAGED, // tell bots the player has injured a hostage (argumens: 1 = hostage, 2 = injurer)
|
||||
EVENT_HOSTAGE_KILLED, // tell bots the player has killed a hostage (argumens: 1 = hostage, 2 = killer)
|
||||
|
||||
EVENT_DOOR, // tell bots the door is moving (argumens: 1 = door, 2 = NULL)
|
||||
EVENT_BREAK_GLASS, // tell bots the glass has break (argumens: 1 = glass, 2 = NULL)
|
||||
EVENT_BREAK_WOOD, // tell bots the wood has break (argumens: 1 = wood, 2 = NULL)
|
||||
EVENT_BREAK_METAL, // tell bots the metal/computer has break (argumens: 1 = metal/computer, 2 = NULL)
|
||||
EVENT_BREAK_FLESH, // tell bots the flesh has break (argumens: 1 = flesh, 2 = NULL)
|
||||
EVENT_BREAK_CONCRETE, // tell bots the concrete has break (argumens: 1 = concrete, 2 = NULL)
|
||||
EVENT_DOOR, // tell bots the door is moving (argumens: 1 = door, 2 = NULL)
|
||||
EVENT_BREAK_GLASS, // tell bots the glass has break (argumens: 1 = glass, 2 = NULL)
|
||||
EVENT_BREAK_WOOD, // tell bots the wood has break (argumens: 1 = wood, 2 = NULL)
|
||||
EVENT_BREAK_METAL, // tell bots the metal/computer has break (argumens: 1 = metal/computer, 2 = NULL)
|
||||
EVENT_BREAK_FLESH, // tell bots the flesh has break (argumens: 1 = flesh, 2 = NULL)
|
||||
EVENT_BREAK_CONCRETE, // tell bots the concrete has break (argumens: 1 = concrete, 2 = NULL)
|
||||
|
||||
EVENT_BOMB_PLANTED, // tell bots the bomb has been planted (argumens: 1 = planter, 2 = NULL)
|
||||
EVENT_BOMB_DROPPED, // tell bots the bomb has been dropped (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_BOMB_PICKED_UP, // let the bots hear the bomb pickup (argumens: 1 = player that pickup c4, 2 = NULL)
|
||||
EVENT_BOMB_BEEP, // let the bots hear the bomb beeping (argumens: 1 = c4, 2 = NULL)
|
||||
EVENT_BOMB_DEFUSING, // tell the bots someone has started defusing (argumens: 1 = defuser, 2 = NULL)
|
||||
EVENT_BOMB_DEFUSE_ABORTED, // tell the bots someone has aborted defusing (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_BOMB_DEFUSED, // tell the bots the bomb is defused (argumens: 1 = defuser, 2 = NULL)
|
||||
EVENT_BOMB_EXPLODED, // let the bots hear the bomb exploding (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_BOMB_PLANTED, // tell bots the bomb has been planted (argumens: 1 = planter, 2 = NULL)
|
||||
EVENT_BOMB_DROPPED, // tell bots the bomb has been dropped (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_BOMB_PICKED_UP, // let the bots hear the bomb pickup (argumens: 1 = player that pickup c4, 2 = NULL)
|
||||
EVENT_BOMB_BEEP, // let the bots hear the bomb beeping (argumens: 1 = c4, 2 = NULL)
|
||||
EVENT_BOMB_DEFUSING, // tell the bots someone has started defusing (argumens: 1 = defuser, 2 = NULL)
|
||||
EVENT_BOMB_DEFUSE_ABORTED, // tell the bots someone has aborted defusing (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_BOMB_DEFUSED, // tell the bots the bomb is defused (argumens: 1 = defuser, 2 = NULL)
|
||||
EVENT_BOMB_EXPLODED, // let the bots hear the bomb exploding (argumens: 1 = NULL, 2 = NULL)
|
||||
|
||||
EVENT_HOSTAGE_USED, // tell bots the hostage is used (argumens: 1 = user, 2 = NULL)
|
||||
EVENT_HOSTAGE_RESCUED, // tell bots the hostage is rescued (argumens: 1 = rescuer (CBasePlayer *), 2 = hostage (CHostage *))
|
||||
EVENT_ALL_HOSTAGES_RESCUED, // tell bots the all hostages are rescued (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_HOSTAGE_USED, // tell bots the hostage is used (argumens: 1 = user, 2 = NULL)
|
||||
EVENT_HOSTAGE_RESCUED, // tell bots the hostage is rescued (argumens: 1 = rescuer (CBasePlayer *), 2 = hostage (CHostage *))
|
||||
EVENT_ALL_HOSTAGES_RESCUED, // tell bots the all hostages are rescued (argumens: 1 = NULL, 2 = NULL)
|
||||
|
||||
EVENT_VIP_ESCAPED, // tell bots the VIP is escaped (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_VIP_ASSASSINATED, // tell bots the VIP is assassinated (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_TERRORISTS_WIN, // tell bots the terrorists won the round (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_CTS_WIN, // tell bots the CTs won the round (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_DRAW, // tell bots the round was a draw (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_WIN, // tell carreer the round was a win (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_LOSS, // tell carreer the round was a loss (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_START, // tell bots the round was started (when freeze period is expired) (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_PLAYER_SPAWNED, // tell bots the player is spawned (argumens: 1 = spawned player, 2 = NULL)
|
||||
EVENT_VIP_ESCAPED, // tell bots the VIP is escaped (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_VIP_ASSASSINATED, // tell bots the VIP is assassinated (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_TERRORISTS_WIN, // tell bots the terrorists won the round (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_CTS_WIN, // tell bots the CTs won the round (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_DRAW, // tell bots the round was a draw (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_WIN, // tell carreer the round was a win (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_LOSS, // tell carreer the round was a loss (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_ROUND_START, // tell bots the round was started (when freeze period is expired) (argumens: 1 = NULL, 2 = NULL)
|
||||
EVENT_PLAYER_SPAWNED, // tell bots the player is spawned (argumens: 1 = spawned player, 2 = NULL)
|
||||
EVENT_CLIENT_CORPSE_SPAWNED,
|
||||
EVENT_BUY_TIME_START,
|
||||
EVENT_PLAYER_LEFT_BUY_ZONE,
|
||||
|
@ -104,14 +104,14 @@ inline int CBitVec<NUM_BITS>::GetNumBits()
|
||||
template<int NUM_BITS>
|
||||
inline CBitVec<NUM_BITS>::CBitVec()
|
||||
{
|
||||
for (int i = 0; i < NUM_DWORDS; ++i)
|
||||
for (int i = 0; i < NUM_DWORDS; i++)
|
||||
m_DWords[i] = 0;
|
||||
}
|
||||
|
||||
template<int NUM_BITS>
|
||||
inline void CBitVec<NUM_BITS>::Init(int val)
|
||||
{
|
||||
for (int i = 0; i < GetNumBits(); ++i)
|
||||
for (int i = 0; i < GetNumBits(); i++)
|
||||
{
|
||||
(*this)[i] = val;
|
||||
}
|
||||
@ -134,7 +134,7 @@ inline CBitVecAccessor CBitVec<NUM_BITS>::operator[](int i)
|
||||
template<int NUM_BITS>
|
||||
inline bool CBitVec<NUM_BITS>::operator==(CBitVec<NUM_BITS> const &other)
|
||||
{
|
||||
for (int i = 0; i < NUM_DWORDS; ++i)
|
||||
for (int i = 0; i < NUM_DWORDS; i++)
|
||||
{
|
||||
if (m_DWords[i] != other.m_DWords[i])
|
||||
return false;
|
||||
|
@ -316,20 +316,20 @@ void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, co
|
||||
#endif
|
||||
|
||||
// Returns TRUE if given entity is our enemy
|
||||
bool CBot::IsEnemy(CBaseEntity *ent) const
|
||||
bool CBot::IsEnemy(CBaseEntity *pEntity) const
|
||||
{
|
||||
// only Players (real and AI) can be enemies
|
||||
if (!ent->IsPlayer())
|
||||
if (!pEntity->IsPlayer())
|
||||
return false;
|
||||
|
||||
// corpses are no threat
|
||||
if (!ent->IsAlive())
|
||||
if (!pEntity->IsAlive())
|
||||
return false;
|
||||
|
||||
CBasePlayer *player = static_cast<CBasePlayer *>(ent);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
|
||||
// if they are on our team, they are our friends
|
||||
if (BotRelationship(player) == BOT_TEAMMATE)
|
||||
if (BotRelationship(pPlayer) == BOT_TEAMMATE)
|
||||
return false;
|
||||
|
||||
// yep, we hate 'em
|
||||
@ -340,25 +340,25 @@ bool CBot::IsEnemy(CBaseEntity *ent) const
|
||||
int CBot::GetEnemiesRemaining() const
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBaseEntity *player = UTIL_PlayerByIndex(i);
|
||||
if (!player)
|
||||
CBaseEntity *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
if (!IsEnemy(player))
|
||||
if (!IsEnemy(pPlayer))
|
||||
continue;
|
||||
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
++count;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
@ -368,28 +368,28 @@ int CBot::GetEnemiesRemaining() const
|
||||
int CBot::GetFriendsRemaining() const
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBaseEntity *player = UTIL_PlayerByIndex(i);
|
||||
if (!player)
|
||||
CBaseEntity *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
if (IsEnemy(player))
|
||||
if (IsEnemy(pPlayer))
|
||||
continue;
|
||||
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
if (player == static_cast<CBaseEntity *>(const_cast<CBot *>(this)))
|
||||
if (pPlayer == static_cast<CBaseEntity *>(const_cast<CBot *>(this)))
|
||||
continue;
|
||||
|
||||
++count;
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
@ -403,13 +403,13 @@ bool CBot::IsLocalPlayerWatchingMe() const
|
||||
|
||||
int myIndex = const_cast<CBot *>(this)->entindex();
|
||||
|
||||
CBasePlayer *player = UTIL_GetLocalPlayer();
|
||||
if (!player)
|
||||
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
|
||||
if (!pPlayer)
|
||||
return false;
|
||||
|
||||
if (((player->pev->flags & FL_SPECTATOR) || player->m_iTeam == SPECTATOR) && player->pev->iuser2 == myIndex)
|
||||
if (((pPlayer->pev->flags & FL_SPECTATOR) || pPlayer->m_iTeam == SPECTATOR) && pPlayer->pev->iuser2 == myIndex)
|
||||
{
|
||||
switch (player->pev->iuser1)
|
||||
switch (pPlayer->pev->iuser1)
|
||||
{
|
||||
case OBS_CHASE_LOCKED:
|
||||
case OBS_CHASE_FREE:
|
||||
|
@ -45,7 +45,7 @@ T *CreateBot(const BotProfile *profile)
|
||||
if (UTIL_ClientsInGame() >= gpGlobals->maxClients)
|
||||
{
|
||||
CONSOLE_ECHO("Unable to create bot: Server is full (%d/%d clients).\n", UTIL_ClientsInGame(), gpGlobals->maxClients);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char netname[64];
|
||||
@ -55,11 +55,11 @@ T *CreateBot(const BotProfile *profile)
|
||||
if (FNullEnt(pentBot))
|
||||
{
|
||||
CONSOLE_ECHO("Unable to create bot: pfnCreateFakeClient() returned null.\n");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
T *pBot = NULL;
|
||||
T *pBot = nullptr;
|
||||
FREE_PRIVATE(pentBot);
|
||||
pBot = GetClassPtr<TWrap>((T *)VARS(pentBot));
|
||||
pBot->Initialize(profile);
|
||||
@ -131,13 +131,13 @@ public:
|
||||
virtual void Reload();
|
||||
|
||||
// invoked when event occurs in the game (some events have NULL entities)
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL) {};
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr) {};
|
||||
|
||||
// return true if we can see the point
|
||||
virtual bool IsVisible(const Vector *pos, bool testFOV = false) const = 0;
|
||||
|
||||
// return true if we can see any part of the player
|
||||
virtual bool IsVisible(CBasePlayer *player, bool testFOV = false, unsigned char *visParts = NULL) const = 0;
|
||||
virtual bool IsVisible(CBasePlayer *pPlayer, bool testFOV = false, unsigned char *visParts = nullptr) const = 0;
|
||||
|
||||
enum VisiblePartType : uint8
|
||||
{
|
||||
@ -153,10 +153,10 @@ public:
|
||||
virtual bool IsEnemyPartVisible(VisiblePartType part) const = 0;
|
||||
|
||||
// return true if player is facing towards us
|
||||
virtual bool IsPlayerFacingMe(CBasePlayer *other) const;
|
||||
virtual bool IsPlayerFacingMe(CBasePlayer *pOther) const;
|
||||
|
||||
// returns true if other player is pointing right at us
|
||||
virtual bool IsPlayerLookingAtMe(CBasePlayer *other) const;
|
||||
virtual bool IsPlayerLookingAtMe(CBasePlayer *pOther) const;
|
||||
virtual void ExecuteCommand();
|
||||
virtual void SetModel(const char *modelName);
|
||||
|
||||
@ -197,7 +197,7 @@ public:
|
||||
bool IsUsingScope() const;
|
||||
|
||||
// returns TRUE if given entity is our enemy
|
||||
bool IsEnemy(CBaseEntity *ent) const;
|
||||
bool IsEnemy(CBaseEntity *pEntity) const;
|
||||
|
||||
// return number of enemies left alive
|
||||
int GetEnemiesRemaining() const;
|
||||
@ -238,7 +238,7 @@ public:
|
||||
protected:
|
||||
#ifndef REGAMEDLL_FIXES
|
||||
// Do a "client command" - useful for invoking menu choices, etc.
|
||||
void ClientCommand(const char *cmd, const char *arg1 = NULL, const char *arg2 = NULL, const char *arg3 = NULL);
|
||||
void ClientCommand(const char *cmd, const char *arg1 = nullptr, const char *arg2 = nullptr, const char *arg3 = nullptr);
|
||||
#endif
|
||||
|
||||
// the "personality" profile of this bot
|
||||
@ -320,20 +320,20 @@ inline CBasePlayerWeapon *CBot::GetActiveWeapon() const
|
||||
|
||||
inline bool CBot::IsActiveWeaponReloading() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
if (weapon == NULL)
|
||||
CBasePlayerWeapon *pCurrentWeapon = GetActiveWeapon();
|
||||
if (!pCurrentWeapon)
|
||||
return false;
|
||||
|
||||
return (weapon->m_fInReload || weapon->m_fInSpecialReload) != 0;
|
||||
return (pCurrentWeapon->m_fInReload || pCurrentWeapon->m_fInSpecialReload) != 0;
|
||||
}
|
||||
|
||||
inline bool CBot::IsActiveWeaponRecoilHigh() const
|
||||
{
|
||||
CBasePlayerWeapon *weapon = GetActiveWeapon();
|
||||
if (weapon != NULL)
|
||||
CBasePlayerWeapon *pCurrentWeapon = GetActiveWeapon();
|
||||
if (pCurrentWeapon)
|
||||
{
|
||||
const float highRecoil = 0.4f;
|
||||
return (weapon->m_flAccuracy > highRecoil) != 0;
|
||||
return (pCurrentWeapon->m_flAccuracy > highRecoil) != 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -343,40 +343,42 @@ inline void CBot::PushPostureContext()
|
||||
{
|
||||
if (m_postureStackIndex == MAX_POSTURE_STACK)
|
||||
{
|
||||
if (pev != NULL)
|
||||
if (pev)
|
||||
{
|
||||
PrintIfWatched("PushPostureContext() overflow error!\n");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_postureStack[m_postureStackIndex].isRunning = m_isRunning;
|
||||
m_postureStack[m_postureStackIndex].isCrouching = m_isCrouching;
|
||||
++m_postureStackIndex;
|
||||
m_postureStackIndex++;
|
||||
}
|
||||
|
||||
inline void CBot::PopPostureContext()
|
||||
{
|
||||
if (m_postureStackIndex == 0)
|
||||
{
|
||||
if (pev != NULL)
|
||||
if (pev)
|
||||
{
|
||||
PrintIfWatched("PopPostureContext() underflow error!\n");
|
||||
}
|
||||
|
||||
m_isRunning = true;
|
||||
m_isCrouching = false;
|
||||
return;
|
||||
}
|
||||
|
||||
--m_postureStackIndex;
|
||||
m_postureStackIndex--;
|
||||
m_isRunning = m_postureStack[m_postureStackIndex].isRunning;
|
||||
m_isCrouching = m_postureStack[m_postureStackIndex].isCrouching;
|
||||
}
|
||||
|
||||
inline bool CBot::IsPlayerFacingMe(CBasePlayer *other) const
|
||||
inline bool CBot::IsPlayerFacingMe(CBasePlayer *pOther) const
|
||||
{
|
||||
Vector toOther = other->pev->origin - pev->origin;
|
||||
UTIL_MakeVectors(other->pev->v_angle + other->pev->punchangle);
|
||||
Vector toOther = pOther->pev->origin - pev->origin;
|
||||
UTIL_MakeVectors(pOther->pev->v_angle + pOther->pev->punchangle);
|
||||
Vector otherDir = gpGlobals->v_forward;
|
||||
|
||||
if (otherDir.x * toOther.x + otherDir.y * toOther.y < 0.0f)
|
||||
@ -385,18 +387,18 @@ inline bool CBot::IsPlayerFacingMe(CBasePlayer *other) const
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool CBot::IsPlayerLookingAtMe(CBasePlayer *other) const
|
||||
inline bool CBot::IsPlayerLookingAtMe(CBasePlayer *pOther) const
|
||||
{
|
||||
Vector toOther = other->pev->origin - pev->origin;
|
||||
Vector toOther = pOther->pev->origin - pev->origin;
|
||||
toOther.NormalizeInPlace();
|
||||
|
||||
UTIL_MakeVectors(other->pev->v_angle + other->pev->punchangle);
|
||||
UTIL_MakeVectors(pOther->pev->v_angle + pOther->pev->punchangle);
|
||||
Vector otherDir = gpGlobals->v_forward;
|
||||
|
||||
const float lookAtCos = 0.9f;
|
||||
if (otherDir.x * toOther.x + otherDir.y * toOther.y < -lookAtCos)
|
||||
{
|
||||
Vector vec(other->EyePosition());
|
||||
Vector vec(pOther->EyePosition());
|
||||
if (IsVisible(&vec))
|
||||
return true;
|
||||
}
|
||||
|
@ -216,41 +216,41 @@ const char *CBotManager::GetNavMapFilename() const
|
||||
// Invoked when given player does given event (some events have NULL player).
|
||||
// Events are propogated to all bots.
|
||||
// TODO: This has become the game-wide event dispatcher. We should restructure this.
|
||||
void CBotManager::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other)
|
||||
void CBotManager::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther)
|
||||
{
|
||||
// propogate event to all bots
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (player == NULL)
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(player->pev))
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(player->pev->netname), ""))
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
if (!player->IsBot())
|
||||
if (!pPlayer->IsBot())
|
||||
continue;
|
||||
|
||||
// do not send self-generated event
|
||||
if (entity == player)
|
||||
if (pEntity == pPlayer)
|
||||
continue;
|
||||
|
||||
CBot *bot = static_cast<CBot *>(player);
|
||||
bot->OnEvent(event, entity, other);
|
||||
CBot *bot = static_cast<CBot *>(pPlayer);
|
||||
bot->OnEvent(event, pEntity, pOther);
|
||||
}
|
||||
|
||||
if (TheTutor != NULL)
|
||||
if (TheTutor)
|
||||
{
|
||||
TheTutor->OnEvent(event, entity, other);
|
||||
TheTutor->OnEvent(event, pEntity, pOther);
|
||||
}
|
||||
|
||||
if (g_pHostages != NULL)
|
||||
if (g_pHostages)
|
||||
{
|
||||
g_pHostages->OnEvent(event, entity, other);
|
||||
g_pHostages->OnEvent(event, pEntity, pOther);
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,14 +265,12 @@ void CBotManager::AddGrenade(int type, CGrenade *grenade)
|
||||
// The grenade entity in the world is going away
|
||||
void CBotManager::RemoveGrenade(CGrenade *grenade)
|
||||
{
|
||||
for (auto iter = m_activeGrenadeList.begin(); iter != m_activeGrenadeList.end(); iter++)
|
||||
for (auto ag : m_activeGrenadeList)
|
||||
{
|
||||
ActiveGrenade *ag = (*iter);
|
||||
|
||||
if (ag->IsEntity(grenade))
|
||||
{
|
||||
ag->OnEntityGone();
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ public:
|
||||
virtual void StartFrame();
|
||||
|
||||
// Events are propogated to all bots.
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *entity = nullptr, CBaseEntity *other = nullptr); // Invoked when event occurs in the game (some events have NULL entity).
|
||||
virtual unsigned int GetPlayerPriority(CBasePlayer *player) const = 0; // return priority of player (0 = max pri)
|
||||
virtual void OnEvent(GameEventType event, CBaseEntity *pEntity = nullptr, CBaseEntity *pOther = nullptr); // Invoked when event occurs in the game (some events have NULL entity).
|
||||
virtual unsigned int GetPlayerPriority(CBasePlayer *pPlayer) const = 0; // return priority of player (0 = max pri)
|
||||
|
||||
public:
|
||||
const char *GetNavMapFilename() const; // return the filename for this map's "nav" file
|
||||
|
@ -393,12 +393,44 @@ bool UTIL_IsVisibleToTeam(const Vector &spot, int team, float maxRange)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return the local player
|
||||
CBasePlayer *UTIL_GetLocalPlayer()
|
||||
{
|
||||
if (!IS_DEDICATED_SERVER())
|
||||
return UTIL_PlayerByIndex(1);
|
||||
// no "local player" if this is a dedicated server or a single player game
|
||||
if (IS_DEDICATED_SERVER())
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
// just try to find any player
|
||||
for (int iIndex = 1; iIndex <= gpGlobals->maxClients; iIndex++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(iIndex);
|
||||
|
||||
return nullptr;
|
||||
if (!pPlayer)
|
||||
continue;
|
||||
|
||||
if (FNullEnt(pPlayer->pev))
|
||||
continue;
|
||||
|
||||
if (FStrEq(STRING(pPlayer->pev->netname), ""))
|
||||
continue;
|
||||
|
||||
if (pPlayer->IsBot())
|
||||
continue;
|
||||
|
||||
if (pPlayer->m_iTeam != TERRORIST && pPlayer->m_iTeam != CT)
|
||||
continue;
|
||||
|
||||
if (pPlayer->m_iJoiningState != JOINED)
|
||||
continue;
|
||||
|
||||
return pPlayer;
|
||||
}
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return UTIL_PlayerByIndex(1);
|
||||
}
|
||||
|
||||
NOXREF Vector UTIL_ComputeOrigin(entvars_t *pevVars)
|
||||
@ -563,7 +595,7 @@ void InitBotTrig()
|
||||
{
|
||||
for (int i = 0; i < COS_TABLE_SIZE; i++)
|
||||
{
|
||||
float_precision angle = 2.0f * M_PI * float(i) / float(COS_TABLE_SIZE - 1);
|
||||
real_t angle = 2.0f * M_PI * float(i) / float(COS_TABLE_SIZE - 1);
|
||||
cosTable[i] = Q_cos(angle);
|
||||
}
|
||||
}
|
||||
@ -583,11 +615,11 @@ float BotSIN(float angle)
|
||||
}
|
||||
|
||||
// Determine if this event is audible, and if so, return its audible range and priority
|
||||
bool IsGameEventAudible(GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile)
|
||||
bool IsGameEventAudible(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther, float *range, PriorityType *priority, bool *isHostile)
|
||||
{
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(entity);
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer *>(pEntity);
|
||||
|
||||
if (!entity || !pPlayer->IsPlayer())
|
||||
if (!pEntity || !pPlayer->IsPlayer())
|
||||
pPlayer = nullptr;
|
||||
|
||||
const float ShortRange = 1000.0f;
|
||||
|
@ -89,7 +89,7 @@ inline bool IsEntityValid(CBaseEntity *pEntity)
|
||||
if (FStrEq(STRING(pEntity->pev->netname), ""))
|
||||
return false;
|
||||
|
||||
if (pEntity->pev->flags & FL_DORMANT)
|
||||
if (pEntity->IsDormant())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -143,7 +143,7 @@ inline bool IsIntersecting2D(const Vector &startA, const Vector &endA, const Vec
|
||||
template <typename Functor>
|
||||
bool ForEachPlayer(Functor &func)
|
||||
{
|
||||
for (int i = 1; i <= gpGlobals->maxClients; ++i)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
if (!IsEntityValid(pPlayer))
|
||||
@ -193,5 +193,5 @@ void BotPrecache();
|
||||
void InitBotTrig();
|
||||
float BotCOS(float angle);
|
||||
float BotSIN(float angle);
|
||||
bool IsGameEventAudible(enum GameEventType event, CBaseEntity *entity, CBaseEntity *other, float *range, PriorityType *priority, bool *isHostile);
|
||||
bool IsGameEventAudible(enum GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther, float *range, PriorityType *priority, bool *isHostile);
|
||||
void HintMessageToAllPlayers(const char *message);
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
virtual void StartLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0; // invoked when a ladder is encountered while following a path
|
||||
|
||||
virtual bool TraverseLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0; // traverse given ladder
|
||||
virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0; // find "simple" ground height, treating current nav area as part of the floor
|
||||
virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = nullptr) = 0; // find "simple" ground height, treating current nav area as part of the floor
|
||||
|
||||
virtual void Run() = 0;
|
||||
virtual void Walk() = 0;
|
||||
@ -109,16 +109,16 @@ public:
|
||||
virtual bool CanRun() const = 0;
|
||||
virtual bool CanCrouch() const = 0;
|
||||
virtual bool CanJump() const = 0;
|
||||
virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if improv can see position
|
||||
virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0; // return true if 'other' is looking right at me
|
||||
virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; // return player on given team that is looking right at me (team == 0 means any team), NULL otherwise
|
||||
virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if improv can see position
|
||||
virtual bool IsPlayerLookingAtMe(CBasePlayer *pOther, float cosTolerance = 0.95f) const = 0; // return true if 'other' is looking right at me
|
||||
virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; // return player on given team that is looking right at me (team == 0 means any team), NULL otherwise
|
||||
|
||||
virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0; // return actual travel distance to closest player on given team (team == 0 means any team)
|
||||
virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = nullptr) const = 0; // return actual travel distance to closest player on given team (team == 0 means any team)
|
||||
virtual CNavArea *GetLastKnownArea() const = 0;
|
||||
|
||||
virtual void OnUpdate(float deltaT) = 0; // a less frequent, full update 'tick'
|
||||
virtual void OnUpkeep(float deltaT) = 0; // a frequent, lightweight update 'tick'
|
||||
virtual void OnReset() = 0; // reset improv to initial state
|
||||
virtual void OnGameEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; // invoked when an event occurs in the game
|
||||
virtual void OnTouch(CBaseEntity *other) = 0; // "other" has touched us
|
||||
virtual void OnGameEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOther) = 0; // invoked when an event occurs in the game
|
||||
virtual void OnTouch(CBaseEntity *pOther) = 0; // "other" has touched us
|
||||
};
|
||||
|
@ -69,7 +69,6 @@ enum NavAttributeType
|
||||
NAV_JUMP = 0x02, // must jump to traverse this area
|
||||
NAV_PRECISE = 0x04, // do not adjust for obstacles, just move along area
|
||||
NAV_NO_JUMP = 0x08, // inhibit discontinuity jumping
|
||||
NAV_WALK = 0x10, // must not run through this area
|
||||
};
|
||||
|
||||
enum NavDirType
|
||||
@ -251,7 +250,7 @@ inline float DirectionToAngle(NavDirType dir)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
inline NavDirType AngleToDirection(float_precision angle)
|
||||
inline NavDirType AngleToDirection(real_t angle)
|
||||
{
|
||||
while (angle < 0.0f)
|
||||
angle += 360.0f;
|
||||
@ -314,7 +313,7 @@ inline float SnapToGrid(float value)
|
||||
return c * GenerationStepSize;
|
||||
}
|
||||
|
||||
inline float_precision NormalizeAngle(float_precision angle)
|
||||
inline real_t NormalizeAngle(real_t angle)
|
||||
{
|
||||
while (angle < -180.0f)
|
||||
angle += 360.0f;
|
||||
@ -371,14 +370,14 @@ inline bool VectorsAreEqual(const Vector *a, const Vector *b, float tolerance =
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool IsEntityWalkable(entvars_t *entity, unsigned int flags)
|
||||
inline bool IsEntityWalkable(entvars_t *pev, unsigned int flags)
|
||||
{
|
||||
// if we hit a door, assume its walkable because it will open when we touch it
|
||||
if (FClassnameIs(entity, "func_door") || FClassnameIs(entity, "func_door_rotating"))
|
||||
if (FClassnameIs(pev, "func_door") || FClassnameIs(pev, "func_door_rotating"))
|
||||
return (flags & WALK_THRU_DOORS) ? true : false;
|
||||
|
||||
// if we hit a breakable object, assume its walkable because we will shoot it when we touch it
|
||||
if (FClassnameIs(entity, "func_breakable") && entity->takedamage == DAMAGE_YES)
|
||||
else if (FClassnameIs(pev, "func_breakable") && pev->takedamage == DAMAGE_YES)
|
||||
return (flags & WALK_THRU_BREAKABLES) ? true : false;
|
||||
|
||||
return false;
|
||||
@ -395,16 +394,20 @@ inline bool IsWalkableTraceLineClear(Vector &from, Vector &to, unsigned int flag
|
||||
{
|
||||
UTIL_TraceLine(useFrom, to, ignore_monsters, pEntIgnore, &result);
|
||||
|
||||
if (result.flFraction != 1.0f && IsEntityWalkable(VARS(result.pHit), flags))
|
||||
// if we hit a walkable entity, try again
|
||||
if (result.flFraction != 1.0f && (result.pHit && IsEntityWalkable(VARS(result.pHit), flags)))
|
||||
{
|
||||
pEntIgnore = result.pHit;
|
||||
|
||||
// start from just beyond where we hit to avoid infinite loops
|
||||
Vector dir = to - from;
|
||||
dir.NormalizeInPlace();
|
||||
useFrom = result.vecEndPos + 5.0f * dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result.flFraction == 1.0f)
|
||||
|
@ -827,11 +827,12 @@ bool CNavArea::MergeEdit(CNavArea *adj)
|
||||
// check that these areas can be merged
|
||||
const float tolerance = 1.0f;
|
||||
bool merge = false;
|
||||
if (abs(m_extent.lo.x - adj->m_extent.lo.x) < tolerance && abs(m_extent.hi.x - adj->m_extent.hi.x) < tolerance)
|
||||
if (Q_abs(m_extent.lo.x - adj->m_extent.lo.x) < tolerance &&
|
||||
Q_abs(m_extent.hi.x - adj->m_extent.hi.x) < tolerance)
|
||||
merge = true;
|
||||
|
||||
if (abs(m_extent.lo.y - adj->m_extent.lo.y) < tolerance &&
|
||||
abs(m_extent.hi.y - adj->m_extent.hi.y) < tolerance)
|
||||
if (Q_abs(m_extent.lo.y - adj->m_extent.lo.y) < tolerance &&
|
||||
Q_abs(m_extent.hi.y - adj->m_extent.hi.y) < tolerance)
|
||||
merge = true;
|
||||
|
||||
if (merge == false)
|
||||
@ -2363,19 +2364,6 @@ void CNavArea::Draw(byte red, byte green, byte blue, int duration)
|
||||
UTIL_DrawBeamPoints(down, left, duration, red, green, blue);
|
||||
UTIL_DrawBeamPoints(left, up, duration, red, green, blue);
|
||||
}
|
||||
|
||||
if (GetAttributes() & NAV_WALK)
|
||||
{
|
||||
float size = 8.0f;
|
||||
Vector up(m_center.x - size, m_center.y - size, m_center.z + cv_bot_nav_zdraw.value);
|
||||
Vector down(m_center.x + size, m_center.y + size, m_center.z + cv_bot_nav_zdraw.value);
|
||||
Vector left(m_center.x - size, m_center.y + size, m_center.z + cv_bot_nav_zdraw.value);
|
||||
Vector right(m_center.x + size, m_center.y - size, m_center.z + cv_bot_nav_zdraw.value);
|
||||
UTIL_DrawBeamPoints(up, right, duration, red, green, blue);
|
||||
UTIL_DrawBeamPoints(right, down, duration, red, green, blue);
|
||||
UTIL_DrawBeamPoints(down, left, duration, red, green, blue);
|
||||
UTIL_DrawBeamPoints(left, up, duration, red, green, blue);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw selected corner for debugging
|
||||
@ -3085,25 +3073,25 @@ void DrawDanger()
|
||||
}
|
||||
|
||||
// If a player is at the given spot, return true
|
||||
bool IsSpotOccupied(CBaseEntity *me, const Vector *pos)
|
||||
bool IsSpotOccupied(CBaseEntity *pEntity, const Vector *pos)
|
||||
{
|
||||
const float closeRange = 75.0f;
|
||||
|
||||
// is there a player in this spot
|
||||
float range;
|
||||
CBasePlayer *player = UTIL_GetClosestPlayer(pos, &range);
|
||||
CBasePlayer *pClosest = UTIL_GetClosestPlayer(pos, &range);
|
||||
|
||||
if (player != me)
|
||||
if (pEntity != pClosest)
|
||||
{
|
||||
if (player && range < closeRange)
|
||||
if (pClosest && range < closeRange)
|
||||
return true;
|
||||
}
|
||||
|
||||
// is there is a hostage in this spot
|
||||
if (g_pHostages)
|
||||
{
|
||||
CHostage *hostage = g_pHostages->GetClosestHostage(*pos, &range);
|
||||
if (hostage && hostage != me && range < closeRange)
|
||||
CHostage *pHostage = g_pHostages->GetClosestHostage(*pos, &range);
|
||||
if (pHostage && pEntity != pHostage && range < closeRange)
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3264,31 +3252,31 @@ const Vector *FindNearbyHidingSpot(CBaseEntity *me, const Vector *pos, CNavArea
|
||||
// Return true if moving from "start" to "finish" will cross a player's line of fire
|
||||
// The path from "start" to "finish" is assumed to be a straight line
|
||||
// "start" and "finish" are assumed to be points on the ground
|
||||
bool IsCrossingLineOfFire(const Vector &start, const Vector &finish, CBaseEntity *ignore, int ignoreTeam)
|
||||
bool IsCrossingLineOfFire(const Vector &start, const Vector &finish, CBaseEntity *pEntIgnore, int ignoreTeam)
|
||||
{
|
||||
for (int p = 1; p <= gpGlobals->maxClients; p++)
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(p);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (!IsEntityValid(player))
|
||||
if (!IsEntityValid(pPlayer))
|
||||
continue;
|
||||
|
||||
if (player == ignore)
|
||||
if (pPlayer == pEntIgnore)
|
||||
continue;
|
||||
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
if (ignoreTeam && player->m_iTeam == ignoreTeam)
|
||||
if (ignoreTeam && pPlayer->m_iTeam == ignoreTeam)
|
||||
continue;
|
||||
|
||||
UTIL_MakeVectors(player->pev->v_angle + player->pev->punchangle);
|
||||
UTIL_MakeVectors(pPlayer->pev->v_angle + pPlayer->pev->punchangle);
|
||||
|
||||
const float longRange = 5000.0f;
|
||||
Vector playerTarget = player->pev->origin + longRange * gpGlobals->v_forward;
|
||||
Vector playerTarget = pPlayer->pev->origin + longRange * gpGlobals->v_forward;
|
||||
|
||||
Vector result;
|
||||
if (IsIntersecting2D(start, finish, player->pev->origin, playerTarget, &result))
|
||||
if (IsIntersecting2D(start, finish, pPlayer->pev->origin, playerTarget, &result))
|
||||
{
|
||||
float loZ, hiZ;
|
||||
if (start.z < finish.z)
|
||||
@ -3409,28 +3397,28 @@ const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavAr
|
||||
|
||||
// Return number of players with given teamID in this area (teamID == 0 means any/all)
|
||||
// TODO: Keep pointers to contained Players to make this a zero-time query
|
||||
int CNavArea::GetPlayerCount(int teamID, CBasePlayer *ignore) const
|
||||
int CNavArea::GetPlayerCount(int teamID, CBasePlayer *pEntIgnore) const
|
||||
{
|
||||
int nCount = 0;
|
||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||
{
|
||||
CBasePlayer *player = UTIL_PlayerByIndex(i);
|
||||
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
|
||||
|
||||
if (player == ignore)
|
||||
if (pPlayer == pEntIgnore)
|
||||
continue;
|
||||
|
||||
if (!IsEntityValid(player))
|
||||
if (!IsEntityValid(pPlayer))
|
||||
continue;
|
||||
|
||||
if (!player->IsPlayer())
|
||||
if (!pPlayer->IsPlayer())
|
||||
continue;
|
||||
|
||||
if (!player->IsAlive())
|
||||
if (!pPlayer->IsAlive())
|
||||
continue;
|
||||
|
||||
if (teamID == UNASSIGNED || player->m_iTeam == teamID)
|
||||
if (teamID == UNASSIGNED || pPlayer->m_iTeam == teamID)
|
||||
{
|
||||
if (Contains(&player->pev->origin))
|
||||
if (Contains(&pPlayer->pev->origin))
|
||||
nCount++;
|
||||
}
|
||||
}
|
||||
@ -3841,12 +3829,11 @@ void EditNavAreas(NavEditCmdType cmd)
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_sprintf(attrib, "%s%s%s%s%s",
|
||||
(area->GetAttributes() & NAV_CROUCH) ? "CROUCH " : "",
|
||||
(area->GetAttributes() & NAV_JUMP) ? "JUMP " : "",
|
||||
Q_sprintf(attrib, "%s%s%s%s",
|
||||
(area->GetAttributes() & NAV_CROUCH) ? "CROUCH " : "",
|
||||
(area->GetAttributes() & NAV_JUMP) ? "JUMP " : "",
|
||||
(area->GetAttributes() & NAV_PRECISE) ? "PRECISE " : "",
|
||||
(area->GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP " : "",
|
||||
(area->GetAttributes() & NAV_WALK) ? "WALK " : "");
|
||||
(area->GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP " : "");
|
||||
}
|
||||
|
||||
Q_sprintf(buffer, "Area #%d %s %s\n", area->GetID(), locName, attrib);
|
||||
@ -3990,10 +3977,6 @@ void EditNavAreas(NavEditCmdType cmd)
|
||||
EMIT_SOUND_DYN(ENT(pLocalPlayer->pev), CHAN_ITEM, "buttons/bell1.wav", 1, ATTN_NORM, 0, 100);
|
||||
area->SetAttributes(area->GetAttributes() ^ NAV_PRECISE);
|
||||
break;
|
||||
case EDIT_ATTRIB_WALK:
|
||||
EMIT_SOUND_DYN(ENT(UTIL_GetLocalPlayer()->pev), CHAN_ITEM, "buttons/bell1.wav", 1, ATTN_NORM, 0, 100);
|
||||
area->SetAttributes(area->GetAttributes() ^ NAV_WALK);
|
||||
break;
|
||||
case EDIT_ATTRIB_NO_JUMP:
|
||||
EMIT_SOUND_DYN(ENT(pLocalPlayer->pev), CHAN_ITEM, "buttons/bell1.wav", 1, ATTN_NORM, 0, 100);
|
||||
area->SetAttributes(area->GetAttributes() ^ NAV_NO_JUMP);
|
||||
@ -4314,11 +4297,10 @@ bool GetGroundHeight(const Vector *pos, float *height, Vector *normal)
|
||||
|
||||
UTIL_TraceLine(from, to, ignore_monsters, dont_ignore_glass, ignore, &result);
|
||||
|
||||
if (result.pHit)
|
||||
if (result.flFraction != 1.0f && result.pHit)
|
||||
{
|
||||
if (FClassnameIs(VARS(result.pHit), "func_door")
|
||||
|| FClassnameIs(VARS(result.pHit), "func_door_rotating")
|
||||
|| (FClassnameIs(VARS(result.pHit), "func_breakable") && VARS(result.pHit)->takedamage == DAMAGE_YES))
|
||||
// ignoring any entities that we can walk through
|
||||
if (IsEntityWalkable(VARS(result.pHit), WALK_THRU_DOORS | WALK_THRU_BREAKABLES))
|
||||
{
|
||||
ignore = result.pHit;
|
||||
continue;
|
||||
|
@ -50,7 +50,6 @@ enum NavEditCmdType
|
||||
EDIT_ATTRIB_CROUCH, // toggle crouch attribute on current area
|
||||
EDIT_ATTRIB_JUMP, // toggle jump attribute on current area
|
||||
EDIT_ATTRIB_PRECISE, // toggle precise attribute on current area
|
||||
EDIT_ATTRIB_WALK, // toggle walk attribute on current area
|
||||
EDIT_ATTRIB_NO_JUMP, // toggle inhibiting discontinuity jumping in current area
|
||||
EDIT_BEGIN_AREA, // begin creating a new nav area
|
||||
EDIT_END_AREA, // end creation of the new nav area
|
||||
@ -635,7 +634,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa
|
||||
// TODO: Cost might work as "manhattan distance"
|
||||
startArea->SetTotalCost((*startArea->GetCenter() - actualGoalPos).Length());
|
||||
|
||||
float_precision initCost = costFunc(startArea, nullptr, nullptr);
|
||||
real_t initCost = costFunc(startArea, nullptr, nullptr);
|
||||
if (initCost < 0.0f)
|
||||
return false;
|
||||
|
||||
@ -781,7 +780,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa
|
||||
if (newArea == area)
|
||||
continue;
|
||||
|
||||
float_precision newCostSoFar = costFunc(newArea, area, ladder);
|
||||
real_t newCostSoFar = costFunc(newArea, area, ladder);
|
||||
|
||||
// check if cost functor says this area is a dead-end
|
||||
if (newCostSoFar < 0.0f)
|
||||
@ -795,7 +794,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa
|
||||
else
|
||||
{
|
||||
// compute estimate of distance left to go
|
||||
float_precision newCostRemaining = (*newArea->GetCenter() - actualGoalPos).Length();
|
||||
real_t newCostRemaining = (*newArea->GetCenter() - actualGoalPos).Length();
|
||||
|
||||
// track closest area to goal in case path fails
|
||||
if (closestArea && newCostRemaining < closestAreaDist)
|
||||
@ -830,7 +829,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa
|
||||
|
||||
// Compute distance between two areas. Return -1 if can't reach 'endArea' from 'startArea'.
|
||||
template <typename CostFunctor>
|
||||
float_precision NavAreaTravelDistance(CNavArea *startArea, CNavArea *endArea, CostFunctor &costFunc)
|
||||
real_t NavAreaTravelDistance(CNavArea *startArea, CNavArea *endArea, CostFunctor &costFunc)
|
||||
{
|
||||
if (!startArea)
|
||||
return -1.0f;
|
||||
@ -846,7 +845,7 @@ float_precision NavAreaTravelDistance(CNavArea *startArea, CNavArea *endArea, Co
|
||||
return -1.0f;
|
||||
|
||||
// compute distance along path
|
||||
float_precision distance = 0.0f;
|
||||
real_t distance = 0.0f;
|
||||
for (CNavArea *area = endArea; area->GetParent(); area = area->GetParent())
|
||||
{
|
||||
distance += (*area->GetCenter() - *area->GetParent()->GetCenter()).Length();
|
||||
@ -863,7 +862,7 @@ float NavAreaTravelDistance(const Vector *startPos, CNavArea *startArea, const V
|
||||
return -1.0f;
|
||||
|
||||
// compute path between areas using given cost heuristic
|
||||
CNavArea *goalArea = NULL;
|
||||
CNavArea *goalArea = nullptr;
|
||||
if (NavAreaBuildPath(startArea, TheNavAreaGrid.GetNearestNavArea(goalPos), goalPos, costFunc, &goalArea) == false)
|
||||
return -1.0f;
|
||||
|
||||
|
@ -130,13 +130,12 @@ void CNavArea::Save(FILE *fp) const
|
||||
fprintf(fp, "v %f %f %f\n", m_extent.lo.x, m_extent.hi.y, m_swZ);
|
||||
|
||||
static int base = 1;
|
||||
fprintf(fp, "\n\ng %04dArea%s%s%s%s%s\n", m_id,
|
||||
fprintf(fp, "\n\ng %04dArea%s%s%s%s\n", m_id,
|
||||
(GetAttributes() & NAV_CROUCH) ? "CROUCH" : "", (GetAttributes() & NAV_JUMP) ? "JUMP" : "",
|
||||
(GetAttributes() & NAV_PRECISE) ? "PRECISE" : "", (GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP" : "",
|
||||
(GetAttributes() & NAV_WALK) ? "NAV_WALK" : "");
|
||||
(GetAttributes() & NAV_PRECISE) ? "PRECISE" : "", (GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP" : "");
|
||||
|
||||
fprintf(fp, "f %d %d %d %d %d\n\n", base, base + 1, base + 2, base + 3, base + 4);
|
||||
base += 5;
|
||||
fprintf(fp, "f %d %d %d %d\n\n", base, base + 1, base + 2, base + 3);
|
||||
base += 4;
|
||||
}
|
||||
|
||||
void CNavArea::Save(int fd, unsigned int version)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user