fix: bots at difficulty 0 unable to do anything useful

fix: lang configs unable to parse last translated line (fixes #340)
fix: last enemy isn't  cleared instantly with dead entity anymore
fix: bot weakness in pistol rounds
analyzer: improved optimization of useless nodes
linkage: make inability to call gamedll player( non-fatal
linkage: fixed bot boot  on WON engines pre 2000 builds (support for beta 6.5 restored)
cvars: added suupport to revert all cvars to defaults via 'yb cvars defaults'
cvars: added cv_preferred_personality  to select bot default personality
refactor: use single function to send hud messages over the bot code
bot: added random original podbot welcome message to preserve origins of this bot
conf: shuffle bot names and chatter items on conflig load
conf: simplified a bit chatter.cfg syntax (old syntax  still works
build: added support for building with CMake (thanks @Velaron)
refactor: rall the memory hooks moved into their one cpp file
This commit is contained in:
jeefo 2024-01-19 00:03:45 +03:00
commit bf91ef2831
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
35 changed files with 1256 additions and 734 deletions

View file

@ -52,6 +52,9 @@ void GraphAnalyze::update () {
if (m_updateInterval >= game.time ()) {
return;
}
else {
displayOverlayMessage ();
}
// add basic nodes
if (!m_basicsCreated) {
@ -157,6 +160,8 @@ void GraphAnalyze::finish () {
return;
}
vistab.startRebuild ();
ctrl.enableDrawModels (false);
cv_quota.revert ();
}
}
@ -171,13 +176,6 @@ void GraphAnalyze::optimize () {
}
cleanup ();
// clear the useless connections
if (cv_graph_analyze_clean_paths_on_finish.bool_ ()) {
for (auto i = 0; i < graph.length (); ++i) {
graph.clearConnections (i);
}
}
auto smooth = [] (const Array <int> &nodes) {
Vector result;
@ -203,7 +201,7 @@ void GraphAnalyze::optimize () {
Array <int> indexes;
for (const auto &link : path.links) {
if (graph.exists (link.index) && !m_optimizedNodes[link.index] && cr::fequal (path.origin.z, graph[link.index].origin.z)) {
if (graph.exists (link.index) && !m_optimizedNodes[link.index] && !AStarAlgo::cantSkipNode (path.number, link.index, true)) {
indexes.emplace (link.index);
}
}
@ -218,6 +216,13 @@ void GraphAnalyze::optimize () {
graph.add (NodeAddFlag::Normal, pos);
}
}
// clear the useless connections
if (cv_graph_analyze_clean_paths_on_finish.bool_ ()) {
for (auto i = 0; i < graph.length (); ++i) {
graph.clearConnections (i);
}
}
}
void GraphAnalyze::cleanup () {
@ -262,6 +267,37 @@ void GraphAnalyze::cleanup () {
}
}
void GraphAnalyze::displayOverlayMessage () {
auto listenserverEdict = game.getLocalEntity ();
if (game.isNullEntity (listenserverEdict) || !m_isAnalyzing) {
return;
}
constexpr StringRef analyzeHudMesssage =
"+--------------------------------------------------------+\n"
" Map analysis for bots is in progress. Please Wait.. \n"
"+--------------------------------------------------------+\n";
static hudtextparms_t textParams {};
textParams.channel = 1;
textParams.x = -1.0f;
textParams.y = -1.0f;
textParams.effect = 1;
textParams.r1 = textParams.r2 = static_cast <uint8_t> (255);
textParams.g1 = textParams.g2 = static_cast <uint8_t> (31);
textParams.b1 = textParams.b2 = static_cast <uint8_t> (75);
textParams.a1 = textParams.a2 = static_cast <uint8_t> (0);
textParams.fadeinTime = 0.0078125f;
textParams.fadeoutTime = 0.0078125f;
textParams.holdTime = m_updateInterval;
textParams.fxTime = 0.25f;
game.sendHudMessage (listenserverEdict, textParams, analyzeHudMesssage);
}
void GraphAnalyze::flood (const Vector &pos, const Vector &next, float range) {
range *= 0.75f;