aim: verify camp angles from nav data before using them

aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
This commit is contained in:
jeefo 2023-04-07 14:46:49 +03:00
commit 29c00565dc
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
31 changed files with 1395 additions and 1305 deletions

View file

@ -75,14 +75,14 @@ struct ConVarReg {
float initial, min, max;
bool missing;
bool bounded;
int32 type;
int32_t type;
};
// entity prototype
using EntityFunction = void (*) (entvars_t *);
// rehlds has this fixed, but original hlds doesn't allocate string space passed to precache* argument, so game will crash when unloading module using metamod
class EngineWrap final : public DenyCopying {
class EngineWrap final {
public:
EngineWrap () = default;
~EngineWrap () = default;
@ -93,11 +93,11 @@ private:
}
public:
int32 precacheModel (const char *model) const {
int32_t precacheModel (const char *model) const {
return engfuncs.pfnPrecacheModel (allocStr (model));
}
int32 precacheSound (const char *sound) const {
int32_t precacheSound (const char *sound) const {
return engfuncs.pfnPrecacheSound (allocStr (sound));
}
@ -182,7 +182,7 @@ public:
void prepareBotArgs (edict_t *ent, String str);
// adds cvar to registration stack
void addNewCvar (const char *name, const char *value, const char *info, bool bounded, float min, float max, int32 varType, bool missingAction, const char *regval, class ConVar *self);
void addNewCvar (const char *name, const char *value, const char *info, bool bounded, float min, float max, int32_t varType, bool missingAction, const char *regval, class ConVar *self);
// check the cvar bounds
void checkCvarsBounds ();
@ -240,7 +240,7 @@ public:
}
// gets custom engine argv for client command
const char *botArgv (int32 index) const {
const char *botArgv (int32_t index) const {
if (static_cast <size_t> (index) >= m_botArgs.length ()) {
return "";
}
@ -248,8 +248,8 @@ public:
}
// gets custom engine argc for client command
int32 botArgc () const {
return m_botArgs.length <int32> ();
int32_t botArgc () const {
return m_botArgs.length <int32_t> ();
}
// gets edict pointer out of entity index
@ -314,10 +314,10 @@ public:
void setPlayerStartDrawModels ();
// check the engine visibility wrapper
bool checkVisibility (edict_t *ent, uint8 *set);
bool checkVisibility (edict_t *ent, uint8_t *set);
// get pvs/pas visibility set
uint8 *getVisibilitySet (Bot *bot, bool pvs);
uint8_t *getVisibilitySet (Bot *bot, bool pvs);
// what kind of game engine / game dll / mod / tool we're running ?
bool is (const int type) const {
@ -409,11 +409,11 @@ public:
~ConVar () = default;
public:
ConVar (const char *name, const char *initval, int32 type = Var::NoServer, bool regMissing = false, const char *regVal = nullptr) : ptr (nullptr) {
ConVar (const char *name, const char *initval, int32_t type = Var::NoServer, bool regMissing = false, const char *regVal = nullptr) : ptr (nullptr) {
Game::instance ().addNewCvar (name, initval, "", false, 0.0f, 0.0f, type, regMissing, regVal, this);
}
ConVar (const char *name, const char *initval, const char *info, bool bounded = true, float min = 0.0f, float max = 1.0f, int32 type = Var::NoServer, bool regMissing = false, const char *regVal = nullptr) : ptr (nullptr) {
ConVar (const char *name, const char *initval, const char *info, bool bounded = true, float min = 0.0f, float max = 1.0f, int32_t type = Var::NoServer, bool regMissing = false, const char *regVal = nullptr) : ptr (nullptr) {
Game::instance ().addNewCvar (name, initval, info, bounded, min, max, type, regMissing, regVal, this);
}
@ -505,8 +505,8 @@ public:
}
public:
static inline uint16 fu16 (float value, float scale) {
return cr::clamp <uint16> (static_cast <uint16> (value * cr::bit (static_cast <short> (scale))), 0, USHRT_MAX);
static inline uint16_t fu16 (float value, float scale) {
return cr::clamp <uint16_t> (static_cast <uint16_t> (value * cr::bit (static_cast <short> (scale))), 0, USHRT_MAX);
}
static inline short fs16 (float value, float scale) {
@ -517,7 +517,7 @@ public:
class LightMeasure final : public Singleton <LightMeasure> {
private:
lightstyle_t m_lightstyle[MAX_LIGHTSTYLES] {};
uint32 m_lightstyleValue[MAX_LIGHTSTYLEVALUE] {};
uint32_t m_lightstyleValue[MAX_LIGHTSTYLEVALUE] {};
bool m_doAnimation = false;
Color m_point;
@ -563,11 +563,11 @@ public:
// simple handler for parsing and rewriting queries (fake queries)
class QueryBuffer {
SmallArray <uint8> m_buffer {};
SmallArray <uint8_t> m_buffer {};
size_t m_cursor {};
public:
QueryBuffer (const uint8 *msg, size_t length, size_t shift) : m_cursor (0) {
QueryBuffer (const uint8_t *msg, size_t length, size_t shift) : m_cursor (0) {
m_buffer.insert (0, msg, length);
m_cursor += shift;
}
@ -630,7 +630,7 @@ public:
}
public:
Twin <const uint8 *, size_t> data () {
Twin <const uint8_t *, size_t> data () {
return { m_buffer.data (), m_buffer.length () };
}
};