fix: startup on hlds_l 3111e (still needs nosmid)

build: add option to build bot without any smid instructions
refactor: fix static analyzer warnings
crlib: update submodule (fix double anglevectors call)
This commit is contained in:
jeefo 2024-10-27 20:51:37 +03:00
commit c7c5e0eaf9
No known key found for this signature in database
GPG key ID: D696786B81B667C8
14 changed files with 92 additions and 70 deletions

View file

@ -4057,7 +4057,7 @@ void Bot::updateHearing () {
}
m_lastEnemyOrigin = getHeardOriginWithError ();
}
else {
else if (m_hearedEnemy != nullptr) {
// if bot had an enemy but the heard one is nearer, take it instead
const float distanceSq = m_lastEnemyOrigin.distanceSq (pev->origin);

View file

@ -1992,7 +1992,7 @@ void BotControl::showMenu (int id) {
parsed.text = translated;
// make menu looks best
if (!(game.is (GameFlags::Legacy))) {
if (!game.is (GameFlags::Legacy)) {
for (int j = 0; j < 10; ++j) {
parsed.text.replace (strings.format ("%d.", j), strings.format ("\\r%d.\\w", j));
}

View file

@ -662,7 +662,7 @@ void ConVar::setPrefix (StringRef name, int32_t type) {
void Game::checkCvarsBounds () {
for (const auto &var : m_cvars) {
if (!var.self->ptr) {
if (!var.self || !var.self->ptr) {
continue;
}
@ -1143,8 +1143,12 @@ void Game::printBotVersion () {
botRuntimeFlags.push ("HL25");
}
if (botRuntimeFlags.empty ()) {
botRuntimeFlags.push ("None");
}
// print if we're using sse 4.x instructions
if (cpuflags.sse41 || cpuflags.sse42 || cpuflags.neon) {
if (plat.simd && (cpuflags.sse41 || cpuflags.sse42 || cpuflags.neon)) {
Array <String> simdLevels {};
if (cpuflags.sse41) {

View file

@ -2835,8 +2835,6 @@ void BotGraph::unassignPath (int from, int to) {
}
void BotGraph::convertFromPOD (Path &path, const PODPath &pod) {
path = {};
path.number = pod.number;
path.flags = pod.flags;
path.origin = pod.origin;
@ -2861,8 +2859,6 @@ void BotGraph::convertFromPOD (Path &path, const PODPath &pod) {
}
void BotGraph::convertToPOD (const Path &path, PODPath &pod) {
pod = {};
pod.number = path.number;
pod.flags = path.flags;
pod.origin = path.origin;

View file

@ -530,17 +530,6 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) {
};
}
table->pfnLightStyle = [] (int style, char *val) {
// this function update lightstyle for the bots
illum.updateLight (style, val);
if (game.is (GameFlags::Metamod)) {
RETURN_META (MRES_IGNORED);
}
engfuncs.pfnLightStyle (style, val);
};
if (game.is (GameFlags::Legacy)) {
table->pfnFindEntityByString = [] (edict_t *edictStartSearchAfter, const char *field, const char *value) {
// round starts in counter-strike 1.5
@ -555,21 +544,34 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) {
};
}
table->pfnGetPlayerAuthId = [] (edict_t *e) -> const char * {
if (bots[e]) {
auto authid = util.getFakeSteamId (e);
if (!game.is (GameFlags::Legacy)) {
table->pfnLightStyle = [] (int style, char *val) {
// this function update lightstyle for the bots
illum.updateLight (style, val);
if (game.is (GameFlags::Metamod)) {
RETURN_META_VALUE (MRES_SUPERCEDE, authid.chars ());
RETURN_META (MRES_IGNORED);
}
return authid.chars ();
}
engfuncs.pfnLightStyle (style, val);
};
if (game.is (GameFlags::Metamod)) {
RETURN_META_VALUE (MRES_IGNORED, nullptr);
}
return engfuncs.pfnGetPlayerAuthId (e);
};
table->pfnGetPlayerAuthId = [] (edict_t *e) -> const char * {
if (bots[e]) {
auto authid = util.getFakeSteamId (e);
if (game.is (GameFlags::Metamod)) {
RETURN_META_VALUE (MRES_SUPERCEDE, authid.chars ());
}
return authid.chars ();
}
if (game.is (GameFlags::Metamod)) {
RETURN_META_VALUE (MRES_IGNORED, nullptr);
}
return engfuncs.pfnGetPlayerAuthId (e);
};
}
table->pfnEmitSound = [] (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int flags, int pitch) {
// this function tells the engine that the entity pointed to by "entity", is emitting a sound

View file

@ -57,7 +57,7 @@ float Heuristic::gfunctionKills (int team, int currentIndex, int) {
if (current.flags & NodeFlag::Crouch) {
cost *= 1.5f;
}
return cost;
return cost + 0.5f;
}
auto Heuristic::gfunctionKillsCTWithHostage (int team, int currentIndex, int parentIndex) -> float {

View file

@ -430,6 +430,11 @@ StringRef BotStorage::getRunningPath () {
if (path.startsWith ("<unk")) {
logger.fatal ("Unable to detect library path. Giving up...");
}
// remove dot prefix
if (path.startsWith (".")) {
path.ltrim (".\\/");
}
auto parts = path.substr (1).split (kPathSeparator);
parts.pop (); // remove library name