refactor: reformat the code
This commit is contained in:
parent
79320802bb
commit
009bdf2f3e
15 changed files with 852 additions and 850 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
# Auto detect text files and perform LF normalization
|
# Auto detect text files and perform LF normalization
|
||||||
* text=lf
|
* text=lf
|
||||||
|
* text eol=lf
|
||||||
|
|
||||||
# Custom for Visual Studio
|
# Custom for Visual Studio
|
||||||
*.sln merge=union
|
*.sln merge=union
|
||||||
|
|
|
||||||
|
|
@ -475,7 +475,7 @@ void Bot::updatePickups () {
|
||||||
else if (m_healthValue >= 100.0f && model == "medkit.mdl") {
|
else if (m_healthValue >= 100.0f && model == "medkit.mdl") {
|
||||||
allowPickup = false;
|
allowPickup = false;
|
||||||
}
|
}
|
||||||
else if (pev->armorvalue >= 100.0f && (model == "kevlar.mdl"|| model == "battery.mdl" || model == "assault.mdl")) {
|
else if (pev->armorvalue >= 100.0f && (model == "kevlar.mdl" || model == "battery.mdl" || model == "assault.mdl")) {
|
||||||
allowPickup = false;
|
allowPickup = false;
|
||||||
}
|
}
|
||||||
else if ((pev->weapons & cr::bit (Weapon::Flashbang)) && model == kFlashbangModelName) {
|
else if ((pev->weapons & cr::bit (Weapon::Flashbang)) && model == kFlashbangModelName) {
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,7 @@ Vector Bot::getBodyOffsetError (float distance) {
|
||||||
|
|
||||||
m_aimLastError = Vector (rg (mins.x * hitError, maxs.x * hitError), rg (mins.y * hitError, maxs.y * hitError), rg (mins.z * hitError * 0.5f, maxs.z * hitError * 0.5f));
|
m_aimLastError = Vector (rg (mins.x * hitError, maxs.x * hitError), rg (mins.y * hitError, maxs.y * hitError), rg (mins.z * hitError * 0.5f, maxs.z * hitError * 0.5f));
|
||||||
|
|
||||||
const auto &aimError = conf.getDifficultyTweaks (m_difficulty) ->aimError;
|
const auto &aimError = conf.getDifficultyTweaks (m_difficulty)->aimError;
|
||||||
m_aimLastError += Vector (rg (-aimError.x, aimError.x), rg (-aimError.y, aimError.y), rg (-aimError.z, aimError.z));
|
m_aimLastError += Vector (rg (-aimError.x, aimError.x), rg (-aimError.y, aimError.y), rg (-aimError.z, aimError.z));
|
||||||
|
|
||||||
m_aimErrorTime = game.time () + rg (0.4f, 0.8f);
|
m_aimErrorTime = game.time () + rg (0.4f, 0.8f);
|
||||||
|
|
@ -643,7 +643,7 @@ Vector Bot::getCustomHeight (float distance) {
|
||||||
{ 0.0f, 0.0f, 0.0f }, // melee
|
{ 0.0f, 0.0f, 0.0f }, // melee
|
||||||
{ 0.5f, -0.1f, -1.5f }, // pistol
|
{ 0.5f, -0.1f, -1.5f }, // pistol
|
||||||
{ 6.5f, 6.0f, -2.0f }, // shotgun
|
{ 6.5f, 6.0f, -2.0f }, // shotgun
|
||||||
{ 0.5f -7.5f, -9.5f }, // zoomrifle
|
{ 0.5f - 7.5f, -9.5f }, // zoomrifle
|
||||||
{ 0.5f, -7.5f, -9.5f }, // rifle
|
{ 0.5f, -7.5f, -9.5f }, // rifle
|
||||||
{ 0.5f, -7.5f, -9.5f }, // smg
|
{ 0.5f, -7.5f, -9.5f }, // smg
|
||||||
{ 0.0f, -2.5f, -6.0f }, // sniper
|
{ 0.0f, -2.5f, -6.0f }, // sniper
|
||||||
|
|
@ -2183,7 +2183,8 @@ void Bot::checkGrenadesThrow () {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Weapon::Flashbang: {
|
case Weapon::Flashbang:
|
||||||
|
{
|
||||||
const int nearest = graph.getNearest (m_lastEnemy->v.velocity.get2d () + m_lastEnemy->v.origin);
|
const int nearest = graph.getNearest (m_lastEnemy->v.velocity.get2d () + m_lastEnemy->v.origin);
|
||||||
|
|
||||||
if (nearest != kInvalidNodeIndex) {
|
if (nearest != kInvalidNodeIndex) {
|
||||||
|
|
|
||||||
|
|
@ -1527,7 +1527,7 @@ void BotGraph::syncInitLightLevels () {
|
||||||
|
|
||||||
// update light levels for all nodes
|
// update light levels for all nodes
|
||||||
for (auto &path : m_paths) {
|
for (auto &path : m_paths) {
|
||||||
path.light = illum.getLightLevel (path.origin + Vector { 0.0f, 0.0f, 16.0f} );
|
path.light = illum.getLightLevel (path.origin + Vector { 0.0f, 0.0f, 16.0f });
|
||||||
}
|
}
|
||||||
m_lightChecked = true;
|
m_lightChecked = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ plugin_info_t Plugin_info = {
|
||||||
|
|
||||||
// compilers can't create lambdas with vaargs, so put this one in it's own namespace
|
// compilers can't create lambdas with vaargs, so put this one in it's own namespace
|
||||||
namespace Hooks {
|
namespace Hooks {
|
||||||
void handler_engClientCommand (edict_t *ent, char const *format, ...) {
|
void handler_engClientCommand (edict_t *ent, char const *format, ...) {
|
||||||
// this function forces the client whose player entity is ent to issue a client command.
|
// this function forces the client whose player entity is ent to issue a client command.
|
||||||
// How it works is that clients all have a argv global string in their client DLL that
|
// How it works is that clients all have a argv global string in their client DLL that
|
||||||
// stores the command string; if ever that string is filled with characters, the client DLL
|
// stores the command string; if ever that string is filled with characters, the client DLL
|
||||||
|
|
@ -70,7 +70,7 @@ namespace Hooks {
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
engfuncs.pfnClientCommand (ent, buffer);
|
engfuncs.pfnClientCommand (ent, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int interfaceVersion) {
|
CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int interfaceVersion) {
|
||||||
|
|
@ -488,7 +488,7 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entlink.needsBypass () && !game.is (GameFlags::Metamod)) {
|
if (entlink.needsBypass () && !game.is (GameFlags::Metamod)) {
|
||||||
table->pfnCreateNamedEntity = [] (string_t classname) -> edict_t *{
|
table->pfnCreateNamedEntity = [] (string_t classname) -> edict_t * {
|
||||||
|
|
||||||
if (entlink.isPaused ()) {
|
if (entlink.isPaused ()) {
|
||||||
entlink.enable ();
|
entlink.enable ();
|
||||||
|
|
|
||||||
|
|
@ -945,7 +945,7 @@ void Bot::defuseBomb_ () {
|
||||||
if (m_isReloading && bombPos.distanceSq2d (pev->origin) < cr::sqrf (80.0f)) {
|
if (m_isReloading && bombPos.distanceSq2d (pev->origin) < cr::sqrf (80.0f)) {
|
||||||
if (m_numEnemiesLeft == 0
|
if (m_numEnemiesLeft == 0
|
||||||
|| timeToBlowUp < fullDefuseTime + 7.0f
|
|| timeToBlowUp < fullDefuseTime + 7.0f
|
||||||
|| ((getAmmoInClip () > 8 && m_reloadState == Reload::Primary)|| (getAmmoInClip () > 5 && m_reloadState == Reload::Secondary))) {
|
|| ((getAmmoInClip () > 8 && m_reloadState == Reload::Primary) || (getAmmoInClip () > 5 && m_reloadState == Reload::Secondary))) {
|
||||||
|
|
||||||
const int weaponIndex = bestWeaponCarried ();
|
const int weaponIndex = bestWeaponCarried ();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue