fixes clang warnings
fixed bad combat strafe dir direction selection added more 'shoot thru wall' code as reaction on sound
This commit is contained in:
parent
8d6b315fa5
commit
4b0188222f
8 changed files with 68 additions and 86 deletions
|
|
@ -3488,23 +3488,6 @@ public:
|
|||
return fgets (buffer, count, m_handle);
|
||||
}
|
||||
|
||||
//
|
||||
// Function: GetBuffer
|
||||
// Gets the line from file stream, and stores it inside string class.
|
||||
//
|
||||
// Parameters:
|
||||
// buffer - String buffer, that should receive line.
|
||||
// count - Max. size of buffer.
|
||||
//
|
||||
// Returns:
|
||||
// True if operation succeeded, false otherwise.
|
||||
//
|
||||
bool GetBuffer (String &buffer, int count)
|
||||
{
|
||||
assert (m_handle != NULL);
|
||||
return !String (fgets (buffer, count, m_handle)).IsEmpty ();
|
||||
}
|
||||
|
||||
//
|
||||
// Function: Printf
|
||||
// Puts formatted buffer, into stream.
|
||||
|
|
@ -3834,7 +3817,10 @@ public:
|
|||
return NULL;
|
||||
|
||||
int lineStartOffset = m_filePos;
|
||||
int lineEndOffset = (m_fileSize - m_filePos > count - 1) ? (lineEndOffset = m_filePos + count - 1) : lineEndOffset = m_fileSize - 1;
|
||||
int lineEndOffset = m_fileSize - 1;
|
||||
|
||||
if (m_fileSize - m_filePos > count - 1)
|
||||
lineEndOffset = m_filePos + count - 1;
|
||||
|
||||
while (m_filePos < lineEndOffset)
|
||||
{
|
||||
|
|
@ -3866,22 +3852,6 @@ public:
|
|||
return buffer;
|
||||
}
|
||||
|
||||
//
|
||||
// Function: GetBuffer
|
||||
// Gets the line from file stream, and stores it inside string class.
|
||||
//
|
||||
// Parameters:
|
||||
// buffer - String buffer, that should receive line.
|
||||
// count - Max. size of buffer.
|
||||
//
|
||||
// Returns:
|
||||
// True if operation succeeded, false otherwise.
|
||||
//
|
||||
bool GetBuffer (String &buffer, int count)
|
||||
{
|
||||
return !String (GetBuffer (buffer, count)).IsEmpty ();
|
||||
}
|
||||
|
||||
//
|
||||
// Function: Read
|
||||
// Reads buffer from file stream in binary format.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#define DEBUG 1
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable : 4244) // int or float down-conversion
|
||||
#pragma warning (disable : 4305) // int or float data truncation
|
||||
#pragma warning (disable : 4201) // nameless struct/union
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#pragma warning (disable : 4702) // unreachable code
|
||||
#pragma warning (disable : 4706) // assignment within conditional expression
|
||||
|
||||
/* (dz): disable deprecation warnings concerning unsafe CRT functions */
|
||||
/* disable deprecation warnings concerning unsafe CRT functions */
|
||||
#if !defined _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -989,7 +989,7 @@ void Bot::InstantChatterMessage (int type)
|
|||
SwitchChatterIcon (true);
|
||||
|
||||
// delay only reportteam
|
||||
if (type == Radio_ReportTeam && m_timeRepotingInDelay < engine.Time ())
|
||||
if (type == Radio_ReportTeam)
|
||||
{
|
||||
if (m_timeRepotingInDelay < engine.Time ())
|
||||
return;
|
||||
|
|
@ -2607,14 +2607,14 @@ void Bot::CheckRadioCommands (void)
|
|||
|
||||
case Radio_SectorClear:
|
||||
// is bomb planted and it's a ct
|
||||
if (g_bombPlanted)
|
||||
{
|
||||
int bombPoint = -1;
|
||||
if (!g_bombPlanted)
|
||||
break;
|
||||
|
||||
// check if it's a ct command
|
||||
if (engine.GetTeam (m_radioEntity) == CT && m_team == CT && IsValidBot (m_radioEntity) && g_timeNextBombUpdate < engine.Time ())
|
||||
{
|
||||
float minDistance = 99999.0f;
|
||||
int bombPoint = -1;
|
||||
|
||||
// find nearest bomb waypoint to player
|
||||
FOR_EACH_AE (waypoints.m_goalPoints, i)
|
||||
|
|
@ -2646,7 +2646,6 @@ void Bot::CheckRadioCommands (void)
|
|||
}
|
||||
g_timeNextBombUpdate = engine.Time () + 0.5f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Radio_GetInPosition:
|
||||
|
|
@ -3108,7 +3107,7 @@ void Bot::RunTask_Normal (void)
|
|||
}
|
||||
|
||||
// don't allow vip on as_ maps to camp + don't allow terrorist carrying c4 to camp
|
||||
if (campingAllowed && IsPlayerVIP (GetEntity ()) || ((g_mapType & MAP_DE) && m_team == TERRORIST && !g_bombPlanted && m_hasC4))
|
||||
if (campingAllowed && (IsPlayerVIP (GetEntity ()) || ((g_mapType & MAP_DE) && m_team == TERRORIST && !g_bombPlanted && m_hasC4)))
|
||||
campingAllowed = false;
|
||||
|
||||
// check if another bot is already camping here
|
||||
|
|
@ -5995,6 +5994,20 @@ void Bot::ReactOnSound (void)
|
|||
m_states |= STATE_SEEING_ENEMY;
|
||||
m_seeEnemyTime = engine.Time ();
|
||||
}
|
||||
else // check if heard enemy can be shoot through some obstacle
|
||||
{
|
||||
if (m_difficulty > 2 && m_lastEnemy == player && m_seeEnemyTime + 3.0 > engine.Time () && yb_shoots_thru_walls.GetBool () && IsShootableThruObstacle (player->v.origin + player->v.view_ofs))
|
||||
{
|
||||
m_enemy = player;
|
||||
m_lastEnemy = player;
|
||||
m_enemyOrigin = player->v.origin;
|
||||
m_lastEnemyOrigin = player->v.origin;
|
||||
|
||||
m_states |= (STATE_SEEING_ENEMY | STATE_SUSPECT_ENEMY);
|
||||
m_seeEnemyTime = engine.Time ();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1112,18 +1112,18 @@ void Bot::CombatFight (void)
|
|||
m_combatStrafeDir = STRAFE_DIR_RIGHT;
|
||||
|
||||
if (Random.Long (1, 100) < 30)
|
||||
m_combatStrafeDir == STRAFE_DIR_LEFT ? STRAFE_DIR_RIGHT : STRAFE_DIR_LEFT;
|
||||
m_combatStrafeDir = (m_combatStrafeDir == STRAFE_DIR_LEFT ? STRAFE_DIR_RIGHT : STRAFE_DIR_LEFT);
|
||||
|
||||
m_strafeSetTime = engine.Time () + Random.Float (1.5f, 3.0f);
|
||||
m_strafeSetTime = engine.Time () + Random.Float (0.5f, 3.0f);
|
||||
}
|
||||
|
||||
if (m_combatStrafeDir == STRAFE_DIR_LEFT)
|
||||
if (m_combatStrafeDir == STRAFE_DIR_RIGHT)
|
||||
{
|
||||
if (!CheckWallOnLeft ())
|
||||
m_strafeSpeed = -pev->maxspeed;
|
||||
else
|
||||
{
|
||||
m_combatStrafeDir == STRAFE_DIR_LEFT ? STRAFE_DIR_RIGHT : STRAFE_DIR_LEFT;
|
||||
m_combatStrafeDir = STRAFE_DIR_LEFT;
|
||||
m_strafeSetTime = engine.Time () + 1.5f;
|
||||
}
|
||||
}
|
||||
|
|
@ -1133,7 +1133,7 @@ void Bot::CombatFight (void)
|
|||
m_strafeSpeed = pev->maxspeed;
|
||||
else
|
||||
{
|
||||
m_combatStrafeDir == STRAFE_DIR_LEFT ? STRAFE_DIR_RIGHT : STRAFE_DIR_LEFT;
|
||||
m_combatStrafeDir = STRAFE_DIR_RIGHT;
|
||||
m_strafeSetTime = engine.Time () + 1.5f;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Yet Another POD-Bot, based on PODBot by Markus Klinge ("CountFloyd").
|
||||
// Copyright (c) YaPB Development Team.
|
||||
//
|
||||
|
|
@ -2939,7 +2939,7 @@ export int Server_GetBlendingInterface (int version, void **ppinterface, void *p
|
|||
return (*g_serverBlendingAPI) (version, ppinterface, pstudio, rotationmatrix, bonetransform);
|
||||
}
|
||||
|
||||
export int Meta_Query (char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
export int Meta_Query (char *, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
|
||||
{
|
||||
// this function is the first function ever called by metamod in the plugin DLL. Its purpose
|
||||
// is for metamod to retrieve basic information about the plugin, such as its meta-interface
|
||||
|
|
@ -2951,7 +2951,7 @@ export int Meta_Query (char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *p
|
|||
return TRUE; // tell metamod this plugin looks safe
|
||||
}
|
||||
|
||||
export int Meta_Attach (PLUG_LOADTIME now, metamod_funcs_t *functionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs)
|
||||
export int Meta_Attach (PLUG_LOADTIME, metamod_funcs_t *functionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs)
|
||||
{
|
||||
// this function is called when metamod attempts to load the plugin. Since it's the place
|
||||
// where we can tell if the plugin will be allowed to run or not, we wait until here to make
|
||||
|
|
@ -2965,7 +2965,7 @@ export int Meta_Attach (PLUG_LOADTIME now, metamod_funcs_t *functionTable, meta_
|
|||
return TRUE; // returning true enables metamod to attach this plugin
|
||||
}
|
||||
|
||||
export int Meta_Detach (PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
|
||||
export int Meta_Detach (PLUG_LOADTIME, PL_UNLOAD_REASON)
|
||||
{
|
||||
// this function is called when metamod unloads the plugin. A basic check is made in order
|
||||
// to prevent unloading the plugin if its processing should not be interrupted.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ BotManager::BotManager (void)
|
|||
|
||||
m_creationTab.RemoveAll ();
|
||||
m_killerEntity = NULL;
|
||||
m_balanceCount = 0;
|
||||
}
|
||||
|
||||
BotManager::~BotManager (void)
|
||||
|
|
@ -1095,7 +1096,7 @@ void Bot::NewRound (void)
|
|||
|
||||
m_maxThrowTimer = 0.0f;
|
||||
m_timeTeamOrder = 0.0f;
|
||||
m_timeRepotingInDelay = 0.0f;
|
||||
m_timeRepotingInDelay = Random.Float (40.0f, 240.0f);
|
||||
m_askCheckTime = 0.0f;
|
||||
m_minSpeed = 260.0f;
|
||||
m_prevSpeed = 0.0f;
|
||||
|
|
@ -1399,7 +1400,7 @@ void BotManager::CalculatePingOffsets (void)
|
|||
|
||||
void BotManager::SendPingDataOffsets (edict_t *to)
|
||||
{
|
||||
if ((g_gameFlags & GAME_LEGACY) || yb_latency_display.GetInt () != 2 || engine.IsNullEntity (to))
|
||||
if ((g_gameFlags & GAME_LEGACY) || yb_latency_display.GetInt () != 2 || engine.IsNullEntity (to) || (to->v.flags & FL_FAKECLIENT))
|
||||
return;
|
||||
|
||||
if (!(to->v.flags & FL_CLIENT) && !(((to->v.button & IN_SCORE) || !(to->v.oldbuttons & IN_SCORE))))
|
||||
|
|
@ -1413,7 +1414,7 @@ void BotManager::SendPingDataOffsets (edict_t *to)
|
|||
|
||||
for (int i = 0; i < engine.MaxClients (); i++)
|
||||
{
|
||||
Bot *bot = GetBot (i);
|
||||
Bot *bot = m_bots[i];
|
||||
|
||||
if (bot == NULL)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Yet Another POD-Bot, based on PODBot by Markus Klinge ("CountFloyd").
|
||||
// Copyright (c) YaPB Development Team.
|
||||
//
|
||||
|
|
@ -374,8 +374,6 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
|
|||
// FIXME: doesn't care for ladder movement (handled separately) should be included in some way
|
||||
if ((m_moveSpeed >= 10.0f || m_strafeSpeed >= 10.0f) && m_lastCollTime < engine.Time () && m_seeEnemyTime + 0.8f < engine.Time () && GetTaskId () != TASK_ATTACK)
|
||||
{
|
||||
bool cantMoveForward = false;
|
||||
|
||||
if (movedDistance < 2.0f && m_prevSpeed >= 20.0f) // didn't we move enough previously?
|
||||
{
|
||||
// Then consider being stuck
|
||||
|
|
@ -388,7 +386,7 @@ void Bot::CheckTerrain (float movedDistance, const Vector &dirNormal)
|
|||
else // not stuck yet
|
||||
{
|
||||
// test if there's something ahead blocking the way
|
||||
if ((cantMoveForward = CantMoveForward (dirNormal, &tr)) && !IsOnLadder ())
|
||||
if (CantMoveForward (dirNormal, &tr) && !IsOnLadder ())
|
||||
{
|
||||
if (m_firstCollideTime == 0.0f)
|
||||
m_firstCollideTime = engine.Time () + 0.2f;
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ void NetworkMsg::Execute (void *p)
|
|||
if (yb_csdm_mode.GetInt () == 2)
|
||||
cl.team = playerIndex;
|
||||
else
|
||||
cl.team = g_clients[playerIndex - 1].realTeam;
|
||||
cl.team = cl.realTeam;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue