tweaked a little weapon firing code
fixed chatter icon not disappearing set bots correct walk speeds implemented some sse2 stuff update linux & android makefiles
This commit is contained in:
parent
2eec5839bd
commit
c07065ca9d
15 changed files with 268 additions and 221 deletions
|
|
@ -10,7 +10,6 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a-hard)
|
|||
LOCAL_MODULE_FILENAME = libyapb_hardfp
|
||||
endif
|
||||
|
||||
LOCAL_CONLYFLAGS += -std=c99
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
|
||||
$(LOCAL_PATH)/../include/engine
|
||||
|
||||
|
|
@ -28,7 +27,8 @@ LOCAL_SRC_FILES := \
|
|||
support.cpp \
|
||||
waypoint.cpp \
|
||||
|
||||
LOCAL_CFLAGS += -O2 -DLINUX -D_LINUX -DPOSIX -DHAVE_STDINT_H -D__extern_always_inline=inline -D_strdup=strdup -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp -fno-strict-aliasing -Wall -Werror
|
||||
LOCAL_CPPFLAGS += -w -fno-exceptions -fno-rtti
|
||||
LOCAL_CFLAGS += -Ofast -std=c++11 -DLINUX -D_LINUX -DPOSIX -pipe -flto -fno-strict-aliasing -Wall -Werror
|
||||
LOCAL_CPPFLAGS += -fno-exceptions -fno-rtti
|
||||
LOCAL_LDFLAGS += -flto
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
|
|
|||
|
|
@ -1007,9 +1007,6 @@ void Bot::InstantChatterMessage (int type)
|
|||
if (!(g_gameFlags & GAME_SUPPORT_BOT_VOICE) || yb_communication_type.GetInt () != 2 || g_chatterFactory[type].IsEmpty ())
|
||||
return;
|
||||
|
||||
if (m_notKilled)
|
||||
EnableChatterIcon (true);
|
||||
|
||||
// delay only report team
|
||||
if (type == Radio_ReportTeam)
|
||||
{
|
||||
|
|
@ -1019,9 +1016,10 @@ void Bot::InstantChatterMessage (int type)
|
|||
m_timeRepotingInDelay = engine.Time () + Random.Float (30.0f, 60.0f);
|
||||
}
|
||||
auto playbackSound = g_chatterFactory[type].GetRandomElement ();
|
||||
auto painSound = g_chatterFactory[Chatter_DiePain].GetRandomElement ();
|
||||
|
||||
const String &defaultSound = playbackSound.name;
|
||||
const String &painSound = g_chatterFactory[Chatter_DiePain].GetRandomElement ().name;
|
||||
if (m_notKilled)
|
||||
EnableChatterIcon (true);
|
||||
|
||||
for (int i = 0; i < engine.MaxClients (); i++)
|
||||
{
|
||||
|
|
@ -1034,14 +1032,18 @@ void Bot::InstantChatterMessage (int type)
|
|||
WRITE_BYTE (GetIndex ());
|
||||
|
||||
if (pev->deadflag & DEAD_DYING)
|
||||
WRITE_STRING (FormatBuffer ("%s/%s.wav", yb_chatter_path.GetString (), painSound.GetBuffer ()));
|
||||
{
|
||||
client.iconTimestamp[GetIndex ()] = engine.Time () + painSound.duration;
|
||||
WRITE_STRING (FormatBuffer ("%s/%s.wav", yb_chatter_path.GetString (), painSound.name.GetBuffer ()));
|
||||
}
|
||||
else if (!(pev->deadflag & DEAD_DEAD))
|
||||
WRITE_STRING (FormatBuffer ("%s/%s.wav", yb_chatter_path.GetString (), defaultSound.GetBuffer ()));
|
||||
|
||||
{
|
||||
client.iconTimestamp[GetIndex ()] = engine.Time () + playbackSound.duration;
|
||||
WRITE_STRING (FormatBuffer ("%s/%s.wav", yb_chatter_path.GetString (), playbackSound.name.GetBuffer ()));
|
||||
}
|
||||
WRITE_SHORT (m_voicePitch);
|
||||
MESSAGE_END ();
|
||||
|
||||
client.iconTimestamp[GetIndex ()] = engine.Time () + playbackSound.duration;
|
||||
client.iconFlags[GetIndex ()] |= CF_ICON;
|
||||
}
|
||||
}
|
||||
|
|
@ -2828,11 +2830,8 @@ void Bot::ChooseAimDirection (void)
|
|||
{
|
||||
bool changePredictedEnemy = true;
|
||||
|
||||
if (m_trackingEdict == m_lastEnemy)
|
||||
{
|
||||
if (m_timeNextTracking < engine.Time ())
|
||||
changePredictedEnemy = false;
|
||||
}
|
||||
if (m_trackingEdict == m_lastEnemy && m_timeNextTracking < engine.Time ())
|
||||
changePredictedEnemy = false;
|
||||
|
||||
if (changePredictedEnemy)
|
||||
{
|
||||
|
|
@ -3605,10 +3604,10 @@ void Bot::RunTask_Camp (void)
|
|||
if (--numFoundPoints >= 0)
|
||||
m_camp = waypoints.GetPath (foundPoints[Random.Int (0, numFoundPoints)])->origin;
|
||||
else
|
||||
m_camp = waypoints.GetPath (GetAimingWaypoint ())->origin;
|
||||
m_camp = waypoints.GetPath (GetCampAimingWaypoint ())->origin;
|
||||
}
|
||||
else
|
||||
m_camp = waypoints.GetPath (GetAimingWaypoint ())->origin;
|
||||
m_camp = waypoints.GetPath (GetCampAimingWaypoint ())->origin;
|
||||
}
|
||||
// press remembered crouch button
|
||||
pev->button |= m_campButtons;
|
||||
|
|
@ -5230,7 +5229,7 @@ int Bot::GetAmmo (void)
|
|||
return m_ammo[g_weaponDefs[m_currentWeapon].ammo1];
|
||||
}
|
||||
|
||||
void Bot::TakeDamage (edict_t *inflictor, int damage, int armor, int bits)
|
||||
void Bot::GetDamage (edict_t *inflictor, int damage, int armor, int bits)
|
||||
{
|
||||
// this function gets called from the network message handler, when bot's gets hurt from any
|
||||
// other player.
|
||||
|
|
@ -5283,7 +5282,7 @@ void Bot::TakeDamage (edict_t *inflictor, int damage, int armor, int bits)
|
|||
m_seeEnemyTime = engine.Time ();
|
||||
}
|
||||
|
||||
if (yb_csdm_mode.GetInt () == 0)
|
||||
if (!yb_csdm_mode.GetBool ())
|
||||
CollectExperienceData (inflictor, armor + damage);
|
||||
}
|
||||
}
|
||||
|
|
@ -5298,19 +5297,19 @@ void Bot::TakeDamage (edict_t *inflictor, int damage, int armor, int bits)
|
|||
}
|
||||
}
|
||||
|
||||
void Bot::TakeBlinded (int r, int g, int b, int alpha)
|
||||
void Bot::GotBlind (int alpha)
|
||||
{
|
||||
// this function gets called by network message handler, when screenfade message get's send
|
||||
// it's used to make bot blind from the grenade.
|
||||
|
||||
if (r != 255 || g != 255 || b != 255 || alpha <= 170)
|
||||
m_maxViewDistance = Random.Float (10.0f, 20.0f);
|
||||
m_blindTime = engine.Time () + static_cast <float> (alpha - 200) / 16.0f;
|
||||
|
||||
if (m_blindTime < engine.Time ())
|
||||
return;
|
||||
|
||||
m_enemy = nullptr;
|
||||
|
||||
m_maxViewDistance = Random.Float (10.0f, 20.0f);
|
||||
m_blindTime = engine.Time () + static_cast <float> (alpha - 200) / 16.0f;
|
||||
|
||||
if (m_difficulty <= 2)
|
||||
{
|
||||
m_blindMoveSpeed = 0.0f;
|
||||
|
|
@ -5323,22 +5322,20 @@ void Bot::TakeBlinded (int r, int g, int b, int alpha)
|
|||
m_blindMoveSpeed = -pev->maxspeed;
|
||||
m_blindSidemoveSpeed = 0.0f;
|
||||
|
||||
float walkSpeed = GetWalkSpeed ();
|
||||
|
||||
if (Random.Int (0, 100) > 50)
|
||||
m_blindSidemoveSpeed = walkSpeed;
|
||||
m_blindSidemoveSpeed = pev->maxspeed;
|
||||
else
|
||||
m_blindSidemoveSpeed = -walkSpeed;
|
||||
m_blindSidemoveSpeed = -pev->maxspeed;
|
||||
|
||||
if (pev->health < 85.0f)
|
||||
m_blindMoveSpeed = -walkSpeed;
|
||||
m_blindMoveSpeed = -pev->maxspeed;
|
||||
else if (m_personality == PERSONALITY_CAREFUL)
|
||||
{
|
||||
m_blindMoveSpeed = 0.0f;
|
||||
m_blindButton = IN_DUCK;
|
||||
}
|
||||
else
|
||||
m_blindMoveSpeed = walkSpeed;
|
||||
m_blindMoveSpeed = pev->maxspeed;
|
||||
}
|
||||
|
||||
void Bot::CollectGoalExperience (int damage, int team)
|
||||
|
|
@ -5456,7 +5453,7 @@ void Bot::HandleChatterMessage (const char *tempMessage)
|
|||
{
|
||||
// this function is added to prevent engine crashes with: 'Message XX started, before message XX ended', or something.
|
||||
|
||||
if (FStrEq (tempMessage, "#CTs_Win") && m_team == CT)
|
||||
if ((m_team == CT && strcmp (tempMessage, "#CTs_Win") == 0) || (m_team == TERRORIST && strcmp (tempMessage, "#Terrorists_Win") == 0))
|
||||
{
|
||||
if (g_timeRoundMid > engine.Time ())
|
||||
ChatterMessage (Chatter_QuicklyWonTheRound);
|
||||
|
|
@ -5464,21 +5461,13 @@ void Bot::HandleChatterMessage (const char *tempMessage)
|
|||
ChatterMessage (Chatter_WonTheRound);
|
||||
}
|
||||
|
||||
if (FStrEq (tempMessage, "#Terrorists_Win") && m_team == TERRORIST)
|
||||
{
|
||||
if (g_timeRoundMid > engine.Time ())
|
||||
ChatterMessage (Chatter_QuicklyWonTheRound);
|
||||
else
|
||||
ChatterMessage (Chatter_WonTheRound);
|
||||
}
|
||||
|
||||
if (FStrEq (tempMessage, "#Bot_TeamAttack"))
|
||||
else if (strcmp (tempMessage, "#Bot_TeamAttack") == 0)
|
||||
ChatterMessage (Chatter_FriendlyFire);
|
||||
|
||||
if (FStrEq (tempMessage, "#Bot_NiceShotCommander"))
|
||||
else if (strcmp (tempMessage, "#Bot_NiceShotCommander") == 0)
|
||||
ChatterMessage (Chatter_NiceshotCommander);
|
||||
|
||||
if (FStrEq (tempMessage, "#Bot_NiceShotPall"))
|
||||
else if (strcmp (tempMessage, "#Bot_NiceShotPall") == 0)
|
||||
ChatterMessage (Chatter_NiceshotPall);
|
||||
}
|
||||
|
||||
|
|
@ -5605,8 +5594,8 @@ Vector Bot::CheckToss(const Vector &start, const Vector &stop)
|
|||
if ((midPoint.z < start.z) || (midPoint.z < end.z))
|
||||
return Vector::GetZero ();
|
||||
|
||||
float timeOne = sqrtf ((midPoint.z - start.z) / (0.5f * gravity));
|
||||
float timeTwo = sqrtf ((midPoint.z - end.z) / (0.5f * gravity));
|
||||
float timeOne = A_sqrtf ((midPoint.z - start.z) / (0.5f * gravity));
|
||||
float timeTwo = A_sqrtf ((midPoint.z - end.z) / (0.5f * gravity));
|
||||
|
||||
if (timeOne < 0.1f)
|
||||
return Vector::GetZero ();
|
||||
|
|
@ -6050,8 +6039,8 @@ bool Bot::IsBombDefusing (const Vector &bombOrigin)
|
|||
|
||||
float Bot::GetWalkSpeed (void)
|
||||
{
|
||||
if ((GetTaskId () == TASK_SEEKCOVER) || (pev->flags & FL_DUCKING) || (pev->button & IN_DUCK) || (pev->oldbuttons & IN_DUCK) || (m_currentTravelFlags & PATHFLAG_JUMP) || (m_currentPath != nullptr && m_currentPath->flags & FLAG_LADDER) || IsOnLadder () || IsInWater ())
|
||||
if (GetTaskId () == TASK_SEEKCOVER || (pev->flags & FL_DUCKING) || (pev->button & IN_DUCK) || (pev->oldbuttons & IN_DUCK) || (m_currentTravelFlags & PATHFLAG_JUMP) || (m_currentPath != nullptr && m_currentPath->flags & FLAG_LADDER) || IsOnLadder () || IsInWater ())
|
||||
return pev->maxspeed;
|
||||
|
||||
return static_cast <float> ((static_cast <int> (pev->maxspeed) * 0.5f) + (static_cast <int> (pev->maxspeed) / 50.0f)) - 18.0f;
|
||||
return static_cast <float> (pev->maxspeed * 0.4f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ bool Bot::IsFriendInLineOfFire (float distance)
|
|||
edict_t *ent = client.ent;
|
||||
|
||||
float friendDistance = (ent->v.origin - pev->origin).GetLength ();
|
||||
float squareDistance = sqrtf (1089.0f + (friendDistance * friendDistance));
|
||||
float squareDistance = A_sqrtf (1089.0f + (friendDistance * friendDistance));
|
||||
|
||||
if (GetShootingConeDeviation (GetEntity (), &ent->v.origin) > (friendDistance * friendDistance) / (squareDistance * squareDistance) && friendDistance <= distance)
|
||||
return true;
|
||||
|
|
@ -705,11 +705,11 @@ bool Bot::DoFirePause (float distance)
|
|||
}
|
||||
|
||||
float offset = 0.0f;
|
||||
const float BurstDistance = 300.0f;
|
||||
const float SprayDistance = 200.0f;
|
||||
|
||||
if (distance < BurstDistance)
|
||||
if (distance < SprayDistance)
|
||||
return false;
|
||||
else if (distance < 2 * BurstDistance)
|
||||
else if (distance < 2 * SprayDistance)
|
||||
offset = 10.0f;
|
||||
else
|
||||
offset = 5.0f;
|
||||
|
|
@ -717,11 +717,16 @@ bool Bot::DoFirePause (float distance)
|
|||
const float xPunch = DegreeToRadian (pev->punchangle.x);
|
||||
const float yPunch = DegreeToRadian (pev->punchangle.y);
|
||||
|
||||
float interval = m_thinkInterval;
|
||||
|
||||
if ((g_gameFlags & GAME_LEGACY) && Math::FltZero (interval))
|
||||
interval = (1.0f / 30.0f) * Random.Float (0.95f, 1.05f);
|
||||
|
||||
// check if we need to compensate recoil
|
||||
if (tanf (sqrtf (fabsf (xPunch * xPunch) + fabsf (yPunch * yPunch))) * distance > offset + 30.0f + ((100 - (m_difficulty * 25)) / 100.f))
|
||||
if (tanf (A_sqrtf (fabsf (xPunch * xPunch) + fabsf (yPunch * yPunch))) * distance > offset + 30.0f + ((100 - (m_difficulty * 25)) / 100.f))
|
||||
{
|
||||
if (m_firePause < engine.Time () - 0.4f)
|
||||
m_firePause = engine.Time () + Random.Float (0.4f, 0.4f + 0.3f * ((100 - (m_difficulty * 25)) / 100.f));
|
||||
if (m_firePause < engine.Time () - interval)
|
||||
m_firePause = engine.Time () + Random.Float (0.5f, 0.5f + 0.3f * ((100.0f - (m_difficulty * 25)) / 100.f));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -783,7 +783,7 @@ void Engine::ProcessMessageCapture (void *ptr)
|
|||
damageBits = intVal;
|
||||
|
||||
if (bot != nullptr && (damageArmor > 0 || damageTaken > 0))
|
||||
bot->TakeDamage (bot->pev->dmg_inflictor, damageTaken, damageArmor, damageBits);
|
||||
bot->GetDamage (bot->pev->dmg_inflictor, damageTaken, damageArmor, damageBits);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
@ -916,7 +916,8 @@ void Engine::ProcessMessageCapture (void *ptr)
|
|||
break;
|
||||
|
||||
case 6:
|
||||
bot->TakeBlinded (r, g, b, byteVal);
|
||||
if (bot != nullptr && r >= 255 && g >= 255 && b >= 255 && byteVal > 170)
|
||||
bot->GotBlind (byteVal);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ int BotCommandHandler (edict_t *ent, const char *arg0, const char *arg1, const c
|
|||
DisplayMenuToClient (ent, BOT_MENU_COMMANDS);
|
||||
else
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
engine.CenterPrintf ("You're dead, and have no access to this menu");
|
||||
}
|
||||
}
|
||||
|
|
@ -1217,14 +1217,14 @@ void ClientCommand (edict_t *ent)
|
|||
|
||||
return;
|
||||
}
|
||||
else if (A_stricmp (command, "menuselect") == 0 && !IsNullString (arg1) && g_clients[issuerPlayerIndex].menu != BOT_MENU_IVALID)
|
||||
else if (A_stricmp (command, "menuselect") == 0 && !IsNullString (arg1) && g_clients[issuerPlayerIndex].menu != BOT_MENU_INVALID)
|
||||
{
|
||||
Client *client = &g_clients[issuerPlayerIndex];
|
||||
int selection = atoi (arg1);
|
||||
|
||||
if (client->menu == BOT_MENU_WAYPOINT_TYPE)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1247,7 +1247,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1257,7 +1257,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_WAYPOINT_FLAG)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1288,7 +1288,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_WAYPOINT_MAIN_PAGE1)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1339,7 +1339,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1349,7 +1349,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_WAYPOINT_MAIN_PAGE2)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1445,7 +1445,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_WAYPOINT_RADIUS)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
g_waypointOn = true; // turn waypoints on in case
|
||||
|
||||
|
|
@ -1461,7 +1461,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_MAIN)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1484,7 +1484,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
@ -1495,7 +1495,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_CONTROL)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1520,7 +1520,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1530,7 +1530,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_FEATURES)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1557,13 +1557,13 @@ void ClientCommand (edict_t *ent)
|
|||
DisplayMenuToClient (ent, BOT_MENU_COMMANDS);
|
||||
else
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
engine.CenterPrintf ("You're dead, and have no access to this menu");
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1573,7 +1573,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_COMMANDS)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
Bot *bot = nullptr;
|
||||
|
||||
switch (selection)
|
||||
|
|
@ -1609,7 +1609,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1620,7 +1620,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu ==BOT_MENU_WAYPOINT_AUTOPATH)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
const float autoDistanceValue[] = {0.0f, 100.0f, 130.0f, 160.0f, 190.0f, 220.0f, 250.0f };
|
||||
|
||||
|
|
@ -1639,7 +1639,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_WAYPOINT_PATH)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1656,7 +1656,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1667,7 +1667,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_DIFFICULTY)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
client->menu = BOT_MENU_PERSONALITY;
|
||||
|
||||
|
|
@ -1694,7 +1694,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1708,7 +1708,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_TEAM_SELECT && fillCommand)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1724,7 +1724,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1734,7 +1734,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_PERSONALITY && fillCommand)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1745,7 +1745,7 @@ void ClientCommand (edict_t *ent)
|
|||
bots.FillServer (fillServerTeam, selection - 2, g_storeAddbotVars[0]);
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1755,7 +1755,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_TEAM_SELECT)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1778,7 +1778,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1788,7 +1788,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_PERSONALITY)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1801,7 +1801,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1811,7 +1811,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_TERRORIST_SELECT || client->menu == BOT_MENU_CT_SELECT)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1825,7 +1825,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1835,7 +1835,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_WEAPON_MODE)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1850,7 +1850,7 @@ void ClientCommand (edict_t *ent)
|
|||
break;
|
||||
|
||||
case 10:
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID);
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID);
|
||||
break;
|
||||
}
|
||||
if (g_gameFlags & GAME_METAMOD)
|
||||
|
|
@ -1860,7 +1860,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_KICK_PAGE_1)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1890,7 +1890,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_KICK_PAGE_2)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1920,7 +1920,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_KICK_PAGE_3)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -1950,7 +1950,7 @@ void ClientCommand (edict_t *ent)
|
|||
}
|
||||
else if (client->menu == BOT_MENU_KICK_PAGE_4)
|
||||
{
|
||||
DisplayMenuToClient (ent, BOT_MENU_IVALID); // reset menu display
|
||||
DisplayMenuToClient (ent, BOT_MENU_INVALID); // reset menu display
|
||||
|
||||
switch (selection)
|
||||
{
|
||||
|
|
@ -2367,8 +2367,7 @@ void pfnClientCommand (edict_t *ent, char const *format, ...)
|
|||
_vsnprintf (buffer, SIZEOF_CHAR (buffer), format, ap);
|
||||
va_end (ap);
|
||||
|
||||
// is the target entity an official bot, or a third party bot ?
|
||||
if (IsValidBot (ent))
|
||||
if (bots.GetBot (ent))
|
||||
{
|
||||
engine.IssueBotCommand (ent, buffer);
|
||||
|
||||
|
|
@ -2771,6 +2770,7 @@ void pfnAlertMessage (ALERT_TYPE alertType, char *format, ...)
|
|||
(*g_engfuncs.pfnAlertMessage) (alertType, buffer);
|
||||
}
|
||||
|
||||
typedef void (*entity_func_t) (entvars_t *);
|
||||
gamedll_funcs_t gameDLLFunc;
|
||||
|
||||
SHARED_LIBRARAY_EXPORT int GetEntityAPI2 (gamefuncs_t *functionTable, int *)
|
||||
|
|
@ -2789,7 +2789,7 @@ SHARED_LIBRARAY_EXPORT int GetEntityAPI2 (gamefuncs_t *functionTable, int *)
|
|||
|
||||
if (!(g_gameFlags & GAME_METAMOD))
|
||||
{
|
||||
auto api_GetEntityAPI = g_gameLib->GetFuncAddr <GetEntityApi2_FN> ("GetEntityAPI");
|
||||
auto api_GetEntityAPI = g_gameLib->GetFuncAddr <int (*) (gamefuncs_t *, int)> ("GetEntityAPI");
|
||||
|
||||
// pass other DLLs engine callbacks to function table...
|
||||
if (api_GetEntityAPI (&g_functionTable, INTERFACE_VERSION) == 0)
|
||||
|
|
@ -2848,7 +2848,7 @@ SHARED_LIBRARAY_EXPORT int GetNewDLLFunctions (newgamefuncs_t *functionTable, in
|
|||
// pass them too, else the DLL interfacing wouldn't be complete and the game possibly wouldn't
|
||||
// run properly.
|
||||
|
||||
auto api_GetNewDLLFunctions = g_gameLib->GetFuncAddr <GetNewEntityApi_FN> ("GetNewDLLFunctions");
|
||||
auto api_GetNewDLLFunctions = g_gameLib->GetFuncAddr <int (*) (newgamefuncs_t *, int *)> ("GetNewDLLFunctions");
|
||||
|
||||
if (api_GetNewDLLFunctions == nullptr)
|
||||
return FALSE;
|
||||
|
|
@ -2908,7 +2908,7 @@ SHARED_LIBRARAY_EXPORT int Server_GetBlendingInterface (int version, void **ppin
|
|||
// of the body move, which bones, which hitboxes and how) between the server and the game DLL.
|
||||
// some MODs can be using a different hitbox scheme than the standard one.
|
||||
|
||||
auto api_GetBlendingInterface = g_gameLib->GetFuncAddr <GetBlendingInterface_FN> ("Server_GetBlendingInterface");
|
||||
auto api_GetBlendingInterface = g_gameLib->GetFuncAddr <int (*) (int, void **, void *, float (*)[3][4], float (*)[128][3][4])> ("Server_GetBlendingInterface");
|
||||
|
||||
if (api_GetBlendingInterface == nullptr)
|
||||
return FALSE;
|
||||
|
|
@ -3021,7 +3021,7 @@ Library *LoadCSBinary (void)
|
|||
return nullptr;
|
||||
}
|
||||
// detect if we're running modern game
|
||||
Entity_FN entity = game->GetFuncAddr <Entity_FN> ("weapon_famas");
|
||||
auto entity = game->GetFuncAddr <entity_func_t> ("weapon_famas");
|
||||
|
||||
// detect xash engine
|
||||
if (g_engfuncs.pfnCVarGetPointer ("build") != nullptr)
|
||||
|
|
@ -3147,7 +3147,7 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
}
|
||||
#endif
|
||||
|
||||
auto api_GiveFnptrsToDll = g_gameLib->GetFuncAddr <GiveFnptrsToDll_FN> ("GiveFnptrsToDll");
|
||||
auto api_GiveFnptrsToDll = g_gameLib->GetFuncAddr <void (STD_CALL *) (enginefuncs_t *, globalvars_t *)> ("GiveFnptrsToDll");
|
||||
|
||||
if (!api_GiveFnptrsToDll)
|
||||
TerminateOnMalloc ();
|
||||
|
|
@ -3173,10 +3173,10 @@ DLL_ENTRYPOINT
|
|||
DLL_RETENTRY; // the return data type is OS specific too
|
||||
}
|
||||
|
||||
void LinkEntity_Helper (Entity_FN &addr, const char *name, entvars_t *pev)
|
||||
void LinkEntity_Helper (entity_func_t &addr, const char *name, entvars_t *pev)
|
||||
{
|
||||
if (addr == nullptr)
|
||||
addr = g_gameLib->GetFuncAddr <Entity_FN > (name);
|
||||
addr = g_gameLib->GetFuncAddr <entity_func_t> (name);
|
||||
|
||||
if (addr == nullptr)
|
||||
return;
|
||||
|
|
@ -3187,7 +3187,7 @@ void LinkEntity_Helper (Entity_FN &addr, const char *name, entvars_t *pev)
|
|||
#define LINK_ENTITY(entityName) \
|
||||
SHARED_LIBRARAY_EXPORT void entityName (entvars_t *pev) \
|
||||
{ \
|
||||
static Entity_FN addr; \
|
||||
static entity_func_t addr; \
|
||||
LinkEntity_Helper (addr, #entityName, pev); \
|
||||
} \
|
||||
|
||||
|
|
|
|||
|
|
@ -171,12 +171,12 @@ BotCreationResult BotManager::CreateBot (const String &name, int difficulty, int
|
|||
if (botName == nullptr)
|
||||
continue;
|
||||
|
||||
if (botName->usedBy != 0)
|
||||
if (botName->name.GetLength () < 3 || botName->usedBy != 0)
|
||||
continue;
|
||||
|
||||
nameFound = true;
|
||||
strncpy (outputName, botName->name, SIZEOF_CHAR (outputName));
|
||||
|
||||
strncpy (outputName, botName->name.GetBuffer (), SIZEOF_CHAR (outputName));
|
||||
steamId = botName->steamId;
|
||||
}
|
||||
}
|
||||
|
|
@ -191,11 +191,11 @@ BotCreationResult BotManager::CreateBot (const String &name, int difficulty, int
|
|||
char prefixedName[33]; // temp buffer for storing modified name
|
||||
|
||||
if (!IsNullString (yb_name_prefix.GetString ()))
|
||||
sprintf (prefixedName, "%s %s", yb_name_prefix.GetString (), outputName);
|
||||
snprintf (prefixedName, SIZEOF_CHAR (prefixedName), "%s %s", yb_name_prefix.GetString (), outputName);
|
||||
|
||||
// buffer has been modified, copy to real name
|
||||
if (!IsNullString (prefixedName))
|
||||
strcpy (outputName, prefixedName);
|
||||
strncpy (outputName, prefixedName, SIZEOF_CHAR (outputName));
|
||||
}
|
||||
bot = g_engfuncs.pfnCreateFakeClient (outputName);
|
||||
|
||||
|
|
|
|||
|
|
@ -3095,7 +3095,7 @@ void Bot::ChangeYaw (float speed)
|
|||
|
||||
#endif
|
||||
|
||||
int Bot::GetAimingWaypoint (void)
|
||||
int Bot::GetCampAimingWaypoint (void)
|
||||
{
|
||||
// find a good waypoint to look at when camping
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ bool IsInViewCone (const Vector &origin, edict_t *ent)
|
|||
{
|
||||
MakeVectors (ent->v.v_angle);
|
||||
|
||||
if (((origin - (ent->v.origin + ent->v.view_ofs)).Normalize () | g_pGlobals->v_forward) >= cosf (((ent->v.fov > 0 ? ent->v.fov : 90.0f) * 0.5f) * MATH_D2R))
|
||||
if (((origin - (ent->v.origin + ent->v.view_ofs)).Normalize () | g_pGlobals->v_forward) >= A_cosf (((ent->v.fov > 0 ? ent->v.fov : 90.0f) * 0.5f) * MATH_D2R))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -129,42 +129,32 @@ void DisplayMenuToClient (edict_t *ent, MenuId menu)
|
|||
|
||||
Client &client = g_clients[engine.IndexOfEntity (ent) - 1];
|
||||
|
||||
if (menu == BOT_MENU_IVALID)
|
||||
if (menu == BOT_MENU_INVALID)
|
||||
{
|
||||
MESSAGE_BEGIN (MSG_ONE_UNRELIABLE, engine.FindMessageId (NETMSG_SHOWMENU), nullptr, ent);
|
||||
WRITE_SHORT (0);
|
||||
WRITE_CHAR (0);
|
||||
WRITE_BYTE (0);
|
||||
WRITE_STRING ("");
|
||||
WRITE_SHORT (0);
|
||||
WRITE_CHAR (0);
|
||||
WRITE_BYTE (0);
|
||||
WRITE_STRING ("");
|
||||
MESSAGE_END ();
|
||||
|
||||
client.menu = BOT_MENU_IVALID;
|
||||
client.menu = BOT_MENU_INVALID;
|
||||
return;
|
||||
}
|
||||
int menuIndex = 0;
|
||||
|
||||
MenuText *menuPtr = nullptr;
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE_HLSDK (g_menus); i++)
|
||||
for (; menuIndex < ARRAYSIZE_HLSDK (g_menus); menuIndex++)
|
||||
{
|
||||
if (g_menus[i].id == menu)
|
||||
{
|
||||
menuPtr = &g_menus[i];
|
||||
if (g_menus[menuIndex].id == menu)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// worst case
|
||||
if (!menuPtr)
|
||||
{
|
||||
client.menu = BOT_MENU_IVALID;
|
||||
return;
|
||||
}
|
||||
const char *displayText = ((g_gameFlags & (GAME_XASH_ENGINE | GAME_MOBILITY)) && !yb_display_menu_text.GetBool ()) ? " " : menuPtr->text.GetBuffer ();
|
||||
const auto &menuRef = g_menus[menuIndex];
|
||||
const char *displayText = ((g_gameFlags & (GAME_XASH_ENGINE | GAME_MOBILITY)) && !yb_display_menu_text.GetBool ()) ? " " : menuRef.text.GetBuffer ();
|
||||
|
||||
while (strlen (displayText) >= 64)
|
||||
{
|
||||
MESSAGE_BEGIN (MSG_ONE_UNRELIABLE, engine.FindMessageId (NETMSG_SHOWMENU), nullptr, ent);
|
||||
WRITE_SHORT (menuPtr->slots);
|
||||
WRITE_SHORT (menuRef.slots);
|
||||
WRITE_CHAR (-1);
|
||||
WRITE_BYTE (1);
|
||||
|
||||
|
|
@ -176,7 +166,7 @@ void DisplayMenuToClient (edict_t *ent, MenuId menu)
|
|||
}
|
||||
|
||||
MESSAGE_BEGIN (MSG_ONE_UNRELIABLE, engine.FindMessageId (NETMSG_SHOWMENU), nullptr, ent);
|
||||
WRITE_SHORT (menuPtr->slots);
|
||||
WRITE_SHORT (menuRef.slots);
|
||||
WRITE_CHAR (-1);
|
||||
WRITE_BYTE (0);
|
||||
WRITE_STRING (displayText);
|
||||
|
|
@ -756,7 +746,7 @@ void SoundAttachToClients (edict_t *ent, const char *sample, float volume)
|
|||
|
||||
// in case of worst case
|
||||
if (index < 0 || index >= engine.MaxClients ())
|
||||
index = 0;
|
||||
return;
|
||||
|
||||
Client &client = g_clients[index];
|
||||
|
||||
|
|
|
|||
|
|
@ -1727,7 +1727,7 @@ void Waypoint::Think (void)
|
|||
// if radius is nonzero, draw a full circle
|
||||
if (path->radius > 0.0f)
|
||||
{
|
||||
float squareRoot = sqrtf (path->radius * path->radius * 0.5f);
|
||||
float squareRoot = A_sqrtf (path->radius * path->radius * 0.5f);
|
||||
|
||||
engine.DrawLine (g_hostEntity, origin + Vector (path->radius, 0.0f, 0.0f), origin + Vector (squareRoot, -squareRoot, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
engine.DrawLine (g_hostEntity, origin + Vector (squareRoot, -squareRoot, 0.0f), origin + Vector (0.0f, -path->radius, 0.0f), 5, 0, 0, 0, 255, 200, 0, 10);
|
||||
|
|
@ -1743,7 +1743,7 @@ void Waypoint::Think (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
float squareRoot = sqrtf (32.0f);
|
||||
float squareRoot = A_sqrtf (32.0f);
|
||||
|
||||
engine.DrawLine (g_hostEntity, origin + Vector (squareRoot, -squareRoot, 0.0f), origin + Vector (-squareRoot, squareRoot, 0.0f), 5, 0, 255, 0, 0, 200, 0, 10);
|
||||
engine.DrawLine (g_hostEntity, origin + Vector (-squareRoot, -squareRoot, 0.0f), origin + Vector (squareRoot, squareRoot, 0.0f), 5, 0, 255, 0, 0, 200, 0, 10);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue