Reduced 'Need backup' for unskilled bots.
Fixed some typos.
This commit is contained in:
parent
91c4d9ce1f
commit
d04f44d8fc
5 changed files with 19 additions and 28 deletions
|
|
@ -212,5 +212,4 @@ struct Platform : public Singleton <Platform> {
|
||||||
// expose platform singleton
|
// expose platform singleton
|
||||||
static auto &plat = Platform::get ();
|
static auto &plat = Platform::get ();
|
||||||
|
|
||||||
|
|
||||||
CR_NAMESPACE_END
|
CR_NAMESPACE_END
|
||||||
|
|
@ -70,7 +70,7 @@ public:
|
||||||
int32 lookup = m_hashTable[hash32 (&in[cur])];
|
int32 lookup = m_hashTable[hash32 (&in[cur])];
|
||||||
|
|
||||||
while (lookup > limit) {
|
while (lookup > limit) {
|
||||||
if (in[lookup + bestLength] == in[cur + bestLength] && load32 (&in[lookup]) == load32 (&in[cur])) {
|
if (in[lookup + bestLength] == in[cur + bestLength] && load <uint32> (&in[lookup]) == load <uint32> (&in[cur])) {
|
||||||
int32 length = MinMatch;
|
int32 length = MinMatch;
|
||||||
|
|
||||||
while (length < maxMatch && in[lookup + length] == in[cur + length]) {
|
while (length < maxMatch && in[lookup + length] == in[cur + length]) {
|
||||||
|
|
@ -107,7 +107,7 @@ public:
|
||||||
int32 lookup = m_hashTable[hash32 (&in[next])];
|
int32 lookup = m_hashTable[hash32 (&in[next])];
|
||||||
|
|
||||||
while (lookup > limit) {
|
while (lookup > limit) {
|
||||||
if (in[lookup + bestLength] == in[next + bestLength] && load32 (&in[lookup]) == load32 (&in[next])) {
|
if (in[lookup + bestLength] == in[next + bestLength] && load <uint32> (&in[lookup]) == load <uint32> (&in[next])) {
|
||||||
int32 length = MinMatch;
|
int32 length = MinMatch;
|
||||||
|
|
||||||
while (length < target && in[lookup + length] == in[next + length]) {
|
while (length < target && in[lookup + length] == in[next + length]) {
|
||||||
|
|
@ -224,7 +224,7 @@ public:
|
||||||
if ((opEnd - op) < length) {
|
if ((opEnd - op) < length) {
|
||||||
return UncompressFailure;
|
return UncompressFailure;
|
||||||
}
|
}
|
||||||
const auto dist = ((token & 16) << 12) + load16 (ip);
|
const auto dist = ((token & 16) << 12) + load <uint16> (ip);
|
||||||
ip += 2;
|
ip += 2;
|
||||||
|
|
||||||
auto cp = op - dist;
|
auto cp = op - dist;
|
||||||
|
|
@ -251,16 +251,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16 load16 (void *ptr) {
|
template <typename U> U load (void *ptr) {
|
||||||
uint16 ret;
|
U ret;
|
||||||
memcpy (&ret, ptr, sizeof (uint16));
|
memcpy (&ret, ptr, sizeof (U));
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 load32 (void *ptr) {
|
|
||||||
uint32 ret;
|
|
||||||
memcpy (&ret, ptr, sizeof (uint32));
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +267,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 hash32 (void *ptr) {
|
uint32 hash32 (void *ptr) {
|
||||||
return (load32 (ptr) * 0x9e3779b9) >> (32 - HashBits);
|
return (load <uint32> (ptr) * 0x9e3779b9) >> (32 - HashBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy (uint8 *dst, uint8 *src, int32 count) {
|
void copy (uint8 *dst, uint8 *src, int32 count) {
|
||||||
|
|
|
||||||
|
|
@ -268,13 +268,13 @@ CR_DECLARE_SCOPED_ENUM (Weapon,
|
||||||
// buy counts
|
// buy counts
|
||||||
CR_DECLARE_SCOPED_ENUM (BuyState,
|
CR_DECLARE_SCOPED_ENUM (BuyState,
|
||||||
PrimaryWeapon = 0,
|
PrimaryWeapon = 0,
|
||||||
ArmorVestHelm,
|
ArmorVestHelm,
|
||||||
SecondaryWeapon,
|
SecondaryWeapon,
|
||||||
Grenades,
|
Grenades,
|
||||||
DefusalKit,
|
DefusalKit,
|
||||||
Ammo,
|
Ammo,
|
||||||
NightVision,
|
NightVision,
|
||||||
Done
|
Done
|
||||||
)
|
)
|
||||||
|
|
||||||
// economics limits
|
// economics limits
|
||||||
|
|
@ -979,7 +979,7 @@ public:
|
||||||
void showChaterIcon (bool show);
|
void showChaterIcon (bool show);
|
||||||
void clearSearchNodes ();
|
void clearSearchNodes ();
|
||||||
void checkBreakable (edict_t *touch);
|
void checkBreakable (edict_t *touch);
|
||||||
void checkBreablesAround ();
|
void checkBreakablesAround ();
|
||||||
void startTask (Task id, float desire, int data, float time, bool resume);
|
void startTask (Task id, float desire, int data, float time, bool resume);
|
||||||
void clearTask (Task id);
|
void clearTask (Task id);
|
||||||
void filterTasks ();
|
void filterTasks ();
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ void Bot::checkBreakable (edict_t *touch) {
|
||||||
startTask (Task::ShootBreakable, TaskPri::ShootBreakable, kInvalidNodeIndex, 0.0f, false);
|
startTask (Task::ShootBreakable, TaskPri::ShootBreakable, kInvalidNodeIndex, 0.0f, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bot::checkBreablesAround () {
|
void Bot::checkBreakablesAround () {
|
||||||
if (!yb_destroy_breakables_around.bool_ () || m_currentWeapon == Weapon::Knife || rg.chance (25) || !game.hasBreakables () || m_seeEnemyTime + 4.0f > game.time () || !game.isNullEntity (m_enemy) || !hasPrimaryWeapon ()) {
|
if (!yb_destroy_breakables_around.bool_ () || m_currentWeapon == Weapon::Knife || rg.chance (25) || !game.hasBreakables () || m_seeEnemyTime + 4.0f > game.time () || !game.isNullEntity (m_enemy) || !hasPrimaryWeapon ()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -2282,7 +2282,6 @@ void Bot::checkRadioQueue () {
|
||||||
pushRadioMessage (Radio::RogerThat);
|
pushRadioMessage (Radio::RogerThat);
|
||||||
|
|
||||||
m_campButtons = 0;
|
m_campButtons = 0;
|
||||||
|
|
||||||
startTask (Task::Pause, TaskPri::Pause, kInvalidNodeIndex, game.time () + rg.float_ (30.0f, 60.0f), false);
|
startTask (Task::Pause, TaskPri::Pause, kInvalidNodeIndex, game.time () + rg.float_ (30.0f, 60.0f), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2875,7 +2874,7 @@ void Bot::frame () {
|
||||||
|
|
||||||
checkSpawnConditions ();
|
checkSpawnConditions ();
|
||||||
checkForChat ();
|
checkForChat ();
|
||||||
checkBreablesAround ();
|
checkBreakablesAround ();
|
||||||
|
|
||||||
if (game.is (GameFlags::HasBotVoice)) {
|
if (game.is (GameFlags::HasBotVoice)) {
|
||||||
showChaterIcon (false); // end voice feedback
|
showChaterIcon (false); // end voice feedback
|
||||||
|
|
@ -3753,7 +3752,7 @@ void Bot::bombDefuse_ () {
|
||||||
bool defuseError = false;
|
bool defuseError = false;
|
||||||
|
|
||||||
// exception: bomb has been defused
|
// exception: bomb has been defused
|
||||||
if (bombPos.empty () || game.isNullEntity (m_pickupItem)) {
|
if (bombPos.empty () || !pickupExists) {
|
||||||
defuseError = true;
|
defuseError = true;
|
||||||
|
|
||||||
if (m_numFriendsLeft != 0 && rg.chance (50)) {
|
if (m_numFriendsLeft != 0 && rg.chance (50)) {
|
||||||
|
|
|
||||||
|
|
@ -922,7 +922,7 @@ void Bot::fireWeapons () {
|
||||||
m_reloadState = Reload::Primary;
|
m_reloadState = Reload::Primary;
|
||||||
m_reloadCheckTime = game.time ();
|
m_reloadCheckTime = game.time ();
|
||||||
|
|
||||||
if (rg.chance (cr::abs (m_difficulty * 25 - 100))) {
|
if (rg.chance (cr::abs (m_difficulty * 25 - 100)) && rg.chance (5)) {
|
||||||
pushRadioMessage (Radio::NeedBackup);
|
pushRadioMessage (Radio::NeedBackup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue