do not threat c4 as grenade
simplify linkents several other fixes
This commit is contained in:
parent
e9d826ccea
commit
a7231d87ed
8 changed files with 58 additions and 88 deletions
|
|
@ -1242,7 +1242,7 @@ void Bot::CheckMessageQueue (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (m_radioSelect != Radio_ReportingIn && g_radioInsteadVoice || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || g_gameVersion == CSV_OLD)
|
||||
if ((m_radioSelect != Radio_ReportingIn && g_radioInsteadVoice) || yb_communication_type.GetInt () != 2 || g_chatterFactory[m_radioSelect].IsEmpty () || g_gameVersion == CSV_OLD)
|
||||
{
|
||||
if (m_radioSelect < Radio_GoGoGo)
|
||||
FakeClientCommand (GetEntity (), "radio1");
|
||||
|
|
@ -2128,29 +2128,25 @@ void Bot::PushTask (TaskID id, float desire, int data, float time, bool resume)
|
|||
DeleteSearchNodes ();
|
||||
IgnoreCollisionShortly ();
|
||||
|
||||
int taskId = GetTaskId ();
|
||||
|
||||
// leader bot?
|
||||
if (m_isLeader && GetTaskId () == TASK_SEEKCOVER)
|
||||
if (m_isLeader && taskId == TASK_SEEKCOVER)
|
||||
CommandTeam (); // reorganize team if fleeing
|
||||
|
||||
if (GetTaskId () == TASK_CAMP)
|
||||
if (taskId == TASK_CAMP)
|
||||
SelectBestWeapon ();
|
||||
|
||||
// this is best place to handle some voice commands report team some info
|
||||
if (Random.Long (0, 100) < 95)
|
||||
{
|
||||
switch (GetTaskId ())
|
||||
{
|
||||
case TASK_BLINDED:
|
||||
if (taskId == TASK_BLINDED)
|
||||
InstantChatterMessage (Chatter_GotBlinded);
|
||||
break;
|
||||
|
||||
case TASK_PLANTBOMB:
|
||||
else if (taskId == TASK_PLANTBOMB)
|
||||
InstantChatterMessage (Chatter_PlantingC4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Random.Long (0, 100) < 80 && GetTaskId () == TASK_CAMP)
|
||||
if (Random.Long (0, 100) < 80 && taskId == TASK_CAMP)
|
||||
{
|
||||
if ((g_mapType & MAP_DE) && g_bombPlanted)
|
||||
ChatterMessage (Chatter_GuardDroppedC4);
|
||||
|
|
@ -4440,6 +4436,10 @@ void Bot::RunTask_PickupItem ()
|
|||
|
||||
switch (m_pickupType)
|
||||
{
|
||||
case PICKUP_DROPPED_C4:
|
||||
case PICKUP_NONE:
|
||||
break;
|
||||
|
||||
case PICKUP_WEAPON:
|
||||
m_aimFlags |= AIM_NAVPOINT;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ void StripTags (char *buffer)
|
|||
{
|
||||
// this function strips 'clan' tags specified below in given string buffer
|
||||
|
||||
char *tagOpen[] = {"-=", "-[", "-]", "-}", "-{", "<[", "<]", "[-", "]-", "{-", "}-", "[[", "[", "{", "]", "}", "<", ">", "-", "|", "=", "+", "(", ")"};
|
||||
char *tagClose[] = {"=-", "]-", "[-", "{-", "}-", "]>", "[>", "-]", "-[", "-}", "-{", "]]", "]", "}", "[", "{", ">", "<", "-", "|", "=", "+", ")", "("};
|
||||
const char *tagOpen[] = {"-=", "-[", "-]", "-}", "-{", "<[", "<]", "[-", "]-", "{-", "}-", "[[", "[", "{", "]", "}", "<", ">", "-", "|", "=", "+", "(", ")"};
|
||||
const char *tagClose[] = {"=-", "]-", "[-", "{-", "}-", "]>", "[>", "-]", "-[", "-}", "-{", "]]", "]", "}", "[", "{", ">", "<", "-", "|", "=", "+", ")", "("};
|
||||
|
||||
int index, fieldStart, fieldStop, i;
|
||||
int length = strlen (buffer); // get length of string
|
||||
|
|
|
|||
|
|
@ -869,7 +869,7 @@ WeaponSelectEnd:
|
|||
{
|
||||
if (distance >= 750.0f && !IsShieldDrawn ())
|
||||
pev->button |= IN_ATTACK2; // draw the shield
|
||||
else if (IsShieldDrawn () || (!IsEntityNull (m_enemy) && (m_enemy->v.button & IN_RELOAD) || !IsEnemyViewable(m_enemy)))
|
||||
else if (IsShieldDrawn () || (!IsEntityNull (m_enemy) && ((m_enemy->v.button & IN_RELOAD) || !IsEnemyViewable(m_enemy))))
|
||||
pev->button |= IN_ATTACK2; // draw out the shield
|
||||
|
||||
m_shieldCheckTime = GetWorldTime () + 1.0f;
|
||||
|
|
|
|||
|
|
@ -2206,9 +2206,6 @@ void StartFrame (void)
|
|||
}
|
||||
bots.CalculatePingOffsets ();
|
||||
|
||||
if (g_bombPlanted)
|
||||
waypoints.SetBombPosition ();
|
||||
|
||||
if (g_isMetamod)
|
||||
{
|
||||
static cvar_t *csdm_active;
|
||||
|
|
@ -3208,18 +3205,23 @@ void ConVarWrapper::PushRegisteredConVarsToEngine (bool gameVars)
|
|||
}
|
||||
}
|
||||
|
||||
#define LINK_ENTITY(entityFunction) \
|
||||
export void entityFunction (entvars_t *pev) \
|
||||
static void LinkEntity_Helper (EntityPtr_t &entAddress, const char *name, entvars_t *pev)
|
||||
{
|
||||
// here we're see an ugliest hack :)
|
||||
if (entAddress == NULL || g_gameVersion == CSV_CZERO)
|
||||
entAddress = g_gameLib->GetFuncAddr <EntityPtr_t > (name);
|
||||
|
||||
if (entAddress == NULL)
|
||||
return;
|
||||
|
||||
entAddress (pev);
|
||||
}
|
||||
|
||||
#define LINK_ENTITY(entityName) \
|
||||
export void entityName (entvars_t *pev) \
|
||||
{ \
|
||||
static EntityPtr_t entity_addr = NULL; \
|
||||
\
|
||||
if (entity_addr == NULL) \
|
||||
entity_addr = g_gameLib->GetFuncAddr <EntityPtr_t> (#entityFunction); \
|
||||
\
|
||||
if (entity_addr == NULL) \
|
||||
return; \
|
||||
\
|
||||
(*entity_addr) (pev); \
|
||||
static EntityPtr_t addr = NULL; \
|
||||
LinkEntity_Helper (addr, #entityName, pev); \
|
||||
} \
|
||||
|
||||
// entities in counter-strike...
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@ void BotManager::TouchWithKillerEntity (Bot *bot)
|
|||
MDLL_Touch (m_killerEntity, bot->GetEntity ());
|
||||
}
|
||||
|
||||
// it's already defined in interface.cpp
|
||||
extern "C" void player (entvars_t *pev);
|
||||
|
||||
void BotManager::CallGameEntity (entvars_t *vars)
|
||||
{
|
||||
// this function calls gamedll player() function, in case to create player entity in game
|
||||
|
|
@ -100,14 +103,7 @@ void BotManager::CallGameEntity (entvars_t *vars)
|
|||
CALL_GAME_ENTITY (PLID, "player", vars);
|
||||
return;
|
||||
}
|
||||
|
||||
static EntityPtr_t playerFunction = NULL;
|
||||
|
||||
if (playerFunction == NULL)
|
||||
playerFunction = g_gameLib->GetFuncAddr <EntityPtr_t> ("player");
|
||||
|
||||
if (playerFunction != NULL)
|
||||
(*playerFunction) (vars);
|
||||
player (vars);
|
||||
}
|
||||
|
||||
int BotManager::CreateBot (const String &name, int difficulty, int personality, int team, int member)
|
||||
|
|
@ -851,7 +847,7 @@ Bot::Bot (edict_t *bot, int difficulty, int personality, int team, int member, c
|
|||
char rejectReason[128];
|
||||
int clientIndex = IndexOfEntity (bot);
|
||||
|
||||
memset (this, 0, sizeof (*this));
|
||||
memset (reinterpret_cast <void *> (this), 0, sizeof (*this));
|
||||
|
||||
pev = &bot->v;
|
||||
|
||||
|
|
@ -1477,7 +1473,13 @@ void BotManager::UpdateActiveGrenades (void)
|
|||
|
||||
// search the map for any type of grenade
|
||||
while (!IsEntityNull (grenade = FIND_ENTITY_BY_CLASSNAME (grenade, "grenade")))
|
||||
{
|
||||
// do not count c4 as a grenade
|
||||
if (strcmp (STRING (grenade->v.model) + 9, "c4.mdl") == 0)
|
||||
continue;
|
||||
|
||||
m_activeGrenades.Push (grenade);
|
||||
}
|
||||
}
|
||||
|
||||
const Array <entity_t> &BotManager::GetActiveGrenades (void)
|
||||
|
|
|
|||
|
|
@ -1565,7 +1565,7 @@ void Waypoint::Think (void)
|
|||
float distance = (m_paths[i]->origin - g_hostEntity->v.origin).GetLength ();
|
||||
|
||||
// check if waypoint is whitin a distance, and is visible
|
||||
if (distance < 1024.0f && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 512.0f))
|
||||
if (distance < 512.0f && ((::IsVisible (m_paths[i]->origin, g_hostEntity) && IsInViewCone (m_paths[i]->origin, g_hostEntity)) || !IsAlive (g_hostEntity) || distance < 128.0f))
|
||||
{
|
||||
// check the distance
|
||||
if (distance < nearestDistance)
|
||||
|
|
@ -1574,7 +1574,7 @@ void Waypoint::Think (void)
|
|||
nearestDistance = distance;
|
||||
}
|
||||
|
||||
if (m_waypointDisplayTime[i] + 1.0f < GetWorldTime ())
|
||||
if (m_waypointDisplayTime[i] + 0.8f < GetWorldTime ())
|
||||
{
|
||||
float nodeHeight = 0.0f;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue