yapb-noob-edition/inc/analyze.h
jeefo bf91ef2831
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
2024-01-19 00:03:45 +03:00

82 lines
1.8 KiB
C++

//
// YaPB, based on PODBot by Markus Klinge ("CountFloyd").
// Copyright © YaPB Project Developers <yapb@jeefo.net>.
//
// SPDX-License-Identifier: MIT
//
#pragma once
// next code is based on cs-ebot implementation, devised by EfeDursun125
class GraphAnalyze : public Singleton <GraphAnalyze> {
public:
GraphAnalyze () = default;
~GraphAnalyze () = default;
private:
float m_updateInterval {}; // time to update analyzer
bool m_basicsCreated {}; // basics nodes were created?
bool m_isCrouch {}; // is node to be created as crouch ?
bool m_isAnalyzing {}; // we're in analyzing ?
bool m_isAnalyzed {}; // current node is analyzed
bool m_expandedNodes[kMaxNodes] {}; // all nodes expanded ?
bool m_optimizedNodes[kMaxNodes] {}; // all nodes expanded ?
public:
// start analysis process
void start ();
// update analysis process
void update ();
// suspend analysis
void suspend ();
private:
// flood with nodes
void flood (const Vector &pos, const Vector &next, float range);
// set update interval (keeps game from freezing)
void setUpdateInterval ();
// mark nodes as goals
void markGoals ();
// terminate analysis and save data
void finish ();
// optimize nodes a little
void optimize ();
// cleanup bad nodes
void cleanup ();
// show overlay message about analyzing
void displayOverlayMessage ();
public:
// node should be created as crouch
bool isCrouch () const {
return m_isCrouch;
}
// is currently analyzing ?
bool isAnalyzing () const {
return m_isAnalyzing;
}
// current graph is analyzed graph ?
bool isAnalyzed () const {
return m_isAnalyzed;
}
// mark as optimized
void markOptimized (const int index) {
m_optimizedNodes[index] = true;
}
};
// expose global
CR_EXPOSE_GLOBAL_SINGLETON (GraphAnalyze, analyzer);