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:
parent
3d84b96534
commit
c7c5e0eaf9
14 changed files with 92 additions and 70 deletions
|
|
@ -74,7 +74,7 @@ if((CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
|
|||
target_compile_options(${PROJECT_NAME} PRIVATE -funroll-loops -fomit-frame-pointer -fno-stack-protector -fvisibility=hidden -fvisibility-inlines-hidden)
|
||||
|
||||
if(NOT WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "arm" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -fdata-sections -ffunction-sections -fcf-protection=none)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -fdata-sections -ffunction-sections -fcf-protection=none -fno-plt)
|
||||
target_link_options(${PROJECT_NAME} PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/ext/ldscripts/version.lds -Wl,--gc-sections)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit c0d1357bcd6b638368f345489c1a0dc70b4a9b38
|
||||
Subproject commit 63cfde122f6479ec94af5c16caf9fbda885f814a
|
||||
18
inc/graph.h
18
inc/graph.h
|
|
@ -100,19 +100,19 @@ struct PODGraphHeader {
|
|||
|
||||
// defines linked nodes
|
||||
struct PathLink {
|
||||
Vector velocity;
|
||||
int32_t distance;
|
||||
uint16_t flags;
|
||||
int16_t index;
|
||||
Vector velocity {};
|
||||
int32_t distance {};
|
||||
uint16_t flags {};
|
||||
int16_t index {};
|
||||
};
|
||||
|
||||
// define graph path structure for yapb
|
||||
struct Path {
|
||||
int32_t number, flags;
|
||||
Vector origin, start, end;
|
||||
float radius, light, display;
|
||||
PathLink links[kMaxNodeLinks];
|
||||
PathVis vis;
|
||||
int32_t number {}, flags {};
|
||||
Vector origin {}, start {}, end {};
|
||||
float radius {}, light {}, display {};
|
||||
PathLink links[kMaxNodeLinks] {};
|
||||
PathVis vis {};
|
||||
};
|
||||
|
||||
// define waypoint structure for podbot (will convert on load)
|
||||
|
|
|
|||
40
inc/yapb.h
40
inc/yapb.h
|
|
@ -39,13 +39,13 @@ public:
|
|||
|
||||
// weapon properties structure
|
||||
struct WeaponProp {
|
||||
String classname;
|
||||
int ammo1; // ammo index for primary ammo
|
||||
int ammo1Max; // max primary ammo
|
||||
int slot; // HUD slot (0 based)
|
||||
int pos; // slot position
|
||||
int id; // weapon ID
|
||||
int flags; // flags???
|
||||
String classname {};
|
||||
int ammo1 {}; // ammo index for primary ammo
|
||||
int ammo1Max {}; // max primary ammo
|
||||
int slot {}; // HUD slot (0 based)
|
||||
int pos {}; // slot position
|
||||
int id {}; // weapon ID
|
||||
int flags {}; // flags???
|
||||
};
|
||||
|
||||
// weapon info structure
|
||||
|
|
@ -89,23 +89,23 @@ public:
|
|||
|
||||
// clients noise
|
||||
struct ClientNoise {
|
||||
Vector pos;
|
||||
float dist;
|
||||
float last;
|
||||
Vector pos {};
|
||||
float dist {};
|
||||
float last {};
|
||||
};
|
||||
|
||||
// array of clients struct
|
||||
struct Client {
|
||||
edict_t *ent; // pointer to actual edict
|
||||
Vector origin; // position in the world
|
||||
int team; // bot team
|
||||
int team2; // real bot team in free for all mode (csdm)
|
||||
int flags; // client flags
|
||||
int radio; // radio orders
|
||||
int menu; // identifier to opened menu
|
||||
int iconFlags[kGameMaxPlayers]; // flag holding chatter icons
|
||||
float iconTimestamp[kGameMaxPlayers]; // timers for chatter icons
|
||||
ClientNoise noise;
|
||||
edict_t *ent {}; // pointer to actual edict
|
||||
Vector origin {}; // position in the world
|
||||
int team {}; // bot team
|
||||
int team2 {}; // real bot team in free for all mode (csdm)
|
||||
int flags {}; // client flags
|
||||
int radio {}; // radio orders
|
||||
int menu {}; // identifier to opened menu
|
||||
int iconFlags[kGameMaxPlayers] {}; // flag holding chatter icons
|
||||
float iconTimestamp[kGameMaxPlayers] {}; // timers for chatter icons
|
||||
ClientNoise noise {};
|
||||
};
|
||||
|
||||
// think delay mapping
|
||||
|
|
|
|||
17
meson.build
17
meson.build
|
|
@ -41,6 +41,7 @@ build_type = get_option ('buildtype')
|
|||
opt_64bit = get_option('64bit')
|
||||
opt_native = get_option('native')
|
||||
opt_winxp = get_option('winxp')
|
||||
opt_nosimd = get_option('nosimd')
|
||||
|
||||
# cpp and ldflags from scratch
|
||||
cxxflags = []
|
||||
|
|
@ -96,6 +97,11 @@ if opt_native
|
|||
cxxflags += ['-DCR_NATIVE_BUILD']
|
||||
endif
|
||||
|
||||
# globally disables all simd optimizations
|
||||
if opt_nosimd
|
||||
cxxflags += ['-DCR_DISABLE_SIMD']
|
||||
endif
|
||||
|
||||
# configure flags gcc and clang
|
||||
if cxx == 'clang' or cxx == 'gcc'
|
||||
cxxflags += [
|
||||
|
|
@ -111,14 +117,18 @@ if cxx == 'clang' or cxx == 'gcc'
|
|||
'-march=armv8-a+fp+simd',
|
||||
]
|
||||
elif cpu != 'arm' and not cpu.startswith('ppc')
|
||||
if not opt_nosimd
|
||||
cxxflags += [
|
||||
'-mmmx', '-msse', '-msse2', '-msse3', '-mfpmath=sse'
|
||||
'-msse', '-msse2', '-mfpmath=sse'
|
||||
]
|
||||
endif
|
||||
|
||||
if opt_native
|
||||
cxxflags += '-march=native'
|
||||
else
|
||||
elif opt_64bit
|
||||
cxxflags += '-march=x86-64'
|
||||
else
|
||||
cxxflags += '-march=i686'
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
@ -132,7 +142,8 @@ if cxx == 'clang' or cxx == 'gcc'
|
|||
cxxflags += [
|
||||
'-fdata-sections',
|
||||
'-ffunction-sections',
|
||||
'-fcf-protection=none'
|
||||
'-fcf-protection=none',
|
||||
'-fno-plt'
|
||||
]
|
||||
|
||||
ldflags += [
|
||||
|
|
|
|||
|
|
@ -13,3 +13,7 @@ option('native', type : 'boolean', value : false,
|
|||
|
||||
option('winxp', type : 'boolean', value : false,
|
||||
description: 'Configure MSVC build to output Windows XP compatible binary.')
|
||||
|
||||
option('nosimd', type : 'boolean', value : false,
|
||||
description: 'Disables all SIMD or NEON optimizations.')
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,6 +544,18 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) {
|
|||
};
|
||||
}
|
||||
|
||||
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 (MRES_IGNORED);
|
||||
}
|
||||
engfuncs.pfnLightStyle (style, val);
|
||||
};
|
||||
|
||||
table->pfnGetPlayerAuthId = [] (edict_t *e) -> const char * {
|
||||
if (bots[e]) {
|
||||
auto authid = util.getFakeSteamId (e);
|
||||
|
|
@ -570,6 +571,7 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) {
|
|||
}
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue