build: reworked build and package to simplify process
build: reworked build and package to simplify process build: windows dll is now compiled by clang, msvc build added to extras package fix: clear all the implicit conversions in the code (also fixed some bugs) fix: crash on never xash3d-fwgs engine fix: fixed bad bot behaviors on aarch64 fix: crash on some maps due to missing previous node fix: finally removed memset(this) within bot creatin
This commit is contained in:
parent
ae4e12c48c
commit
53df621dfc
35 changed files with 1004 additions and 949 deletions
22
inc/config.h
22
inc/config.h
|
|
@ -38,20 +38,20 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
Array <StringArray> m_chat;
|
||||
Array <Array <ChatterItem>> m_chatter;
|
||||
Array <StringArray> m_chat {};
|
||||
Array <Array <ChatterItem>> m_chatter {};
|
||||
|
||||
Array <BotName> m_botNames;
|
||||
Array <Keywords> m_replies;
|
||||
SmallArray <WeaponInfo> m_weapons;
|
||||
SmallArray <WeaponProp> m_weaponProps;
|
||||
Array <BotName> m_botNames {};
|
||||
Array <Keywords> m_replies {};
|
||||
SmallArray <WeaponInfo> m_weapons {};
|
||||
SmallArray <WeaponProp> m_weaponProps {};
|
||||
|
||||
StringArray m_logos;
|
||||
StringArray m_avatars;
|
||||
StringArray m_logos {};
|
||||
StringArray m_avatars {};
|
||||
|
||||
HashMap <uint32, String, Hash <int32>> m_language;
|
||||
HashMap <int32, DifficultyData> m_difficulty;
|
||||
HashMap <String, String> m_custom;
|
||||
HashMap <uint32, String, Hash <int32>> m_language {};
|
||||
HashMap <int32, DifficultyData> m_difficulty {};
|
||||
HashMap <String, String> m_custom {};
|
||||
|
||||
// default tables for personality weapon preferences, overridden by weapon.cfg
|
||||
SmallArray <int32> m_normalWeaponPrefs = { 0, 2, 1, 4, 5, 6, 3, 12, 10, 24, 25, 13, 11, 8, 7, 22, 23, 18, 21, 17, 19, 15, 17, 9, 14, 16 };
|
||||
|
|
|
|||
|
|
@ -63,21 +63,21 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
StringArray m_args;
|
||||
Array <BotCmd> m_cmds;
|
||||
Array <BotMenu> m_menus;
|
||||
Deque <PrintQueue> m_printQueue;
|
||||
IntArray m_campIterator;
|
||||
StringArray m_args {};
|
||||
Array <BotCmd> m_cmds {};
|
||||
Array <BotMenu> m_menus {};
|
||||
Deque <PrintQueue> m_printQueue {};
|
||||
IntArray m_campIterator {};
|
||||
|
||||
edict_t *m_ent;
|
||||
Bot *m_djump;
|
||||
edict_t *m_ent {};
|
||||
Bot *m_djump {};
|
||||
|
||||
bool m_isFromConsole;
|
||||
bool m_rapidOutput;
|
||||
bool m_isMenuFillCommand;
|
||||
bool m_ignoreTranslate;
|
||||
bool m_isFromConsole {};
|
||||
bool m_rapidOutput {};
|
||||
bool m_isMenuFillCommand {};
|
||||
bool m_ignoreTranslate {};
|
||||
|
||||
int m_menuServerFillTeam;
|
||||
int m_menuServerFillTeam {};
|
||||
int m_interMenuData[4] = { 0, };
|
||||
|
||||
float m_printQueueFlushTimestamp {};
|
||||
|
|
|
|||
42
inc/engine.h
42
inc/engine.h
|
|
@ -112,27 +112,27 @@ public:
|
|||
using EntitySearch = Lambda <EntitySearchResult (edict_t *)>;
|
||||
|
||||
private:
|
||||
int m_drawModels[DrawLine::Count] { };
|
||||
int m_spawnCount[Team::Unassigned] { };
|
||||
int m_drawModels[DrawLine::Count] {};
|
||||
int m_spawnCount[Team::Unassigned] {};
|
||||
|
||||
// bot client command
|
||||
StringArray m_botArgs;
|
||||
StringArray m_botArgs {};
|
||||
|
||||
edict_t *m_startEntity;
|
||||
edict_t *m_localEntity;
|
||||
edict_t *m_startEntity {};
|
||||
edict_t *m_localEntity {};
|
||||
|
||||
Array <edict_t *> m_breakables;
|
||||
SmallArray <ConVarReg> m_cvars;
|
||||
SharedLibrary m_gameLib;
|
||||
EngineWrap m_engineWrap;
|
||||
Array <edict_t *> m_breakables {};
|
||||
SmallArray <ConVarReg> m_cvars {};
|
||||
SharedLibrary m_gameLib {};
|
||||
EngineWrap m_engineWrap {};
|
||||
|
||||
bool m_precached;
|
||||
bool m_precached {};
|
||||
|
||||
int m_gameFlags {};
|
||||
int m_mapFlags {};
|
||||
|
||||
float m_oneSecondFrame; // per second updated
|
||||
float m_halfSecondFrame; // per half second update
|
||||
float m_oneSecondFrame {}; // per second updated
|
||||
float m_halfSecondFrame {}; // per half second update
|
||||
|
||||
public:
|
||||
Game ();
|
||||
|
|
@ -240,8 +240,8 @@ public:
|
|||
}
|
||||
|
||||
// gets custom engine argv for client command
|
||||
const char *botArgv (size_t index) const {
|
||||
if (index >= m_botArgs.length ()) {
|
||||
const char *botArgv (int32 index) const {
|
||||
if (static_cast <size_t> (index) >= m_botArgs.length ()) {
|
||||
return "";
|
||||
}
|
||||
return m_botArgs[index].chars ();
|
||||
|
|
@ -517,7 +517,7 @@ public:
|
|||
class LightMeasure final : public Singleton <LightMeasure> {
|
||||
private:
|
||||
lightstyle_t m_lightstyle[MAX_LIGHTSTYLES] {};
|
||||
int m_lightstyleValue[MAX_LIGHTSTYLEVALUE] {};
|
||||
uint32 m_lightstyleValue[MAX_LIGHTSTYLEVALUE] {};
|
||||
bool m_doAnimation = false;
|
||||
|
||||
Color m_point;
|
||||
|
|
@ -563,8 +563,8 @@ public:
|
|||
|
||||
// simple handler for parsing and rewriting queries (fake queries)
|
||||
class QueryBuffer {
|
||||
SmallArray <uint8> m_buffer;
|
||||
size_t m_cursor;
|
||||
SmallArray <uint8> m_buffer {};
|
||||
size_t m_cursor {};
|
||||
|
||||
public:
|
||||
QueryBuffer (const uint8 *msg, size_t length, size_t shift) : m_cursor (0) {
|
||||
|
|
@ -640,7 +640,7 @@ private:
|
|||
#if defined (CR_WINDOWS)
|
||||
# define DLSYM_FUNCTION GetProcAddress
|
||||
# define DLCLOSE_FUNCTION FreeLibrary
|
||||
# define DLSYM_RETURN PVOID
|
||||
# define DLSYM_RETURN SharedLibrary::Handle
|
||||
# define DLSYM_HANDLE HMODULE
|
||||
#else
|
||||
# define DLSYM_FUNCTION dlsym
|
||||
|
|
@ -654,7 +654,7 @@ private:
|
|||
|
||||
Detour <decltype (DLSYM_FUNCTION)> m_dlsym;
|
||||
Detour <decltype (DLCLOSE_FUNCTION)> m_dlclose;
|
||||
HashMap <StringRef, DLSYM_RETURN> m_exports;
|
||||
HashMap <StringRef, SharedLibrary::Func> m_exports;
|
||||
|
||||
SharedLibrary m_self;
|
||||
|
||||
|
|
@ -663,7 +663,7 @@ public:
|
|||
|
||||
public:
|
||||
void initialize ();
|
||||
DLSYM_RETURN lookup (SharedLibrary::Handle module, const char *function);
|
||||
SharedLibrary::Func lookup (SharedLibrary::Handle module, const char *function);
|
||||
|
||||
int close (DLSYM_HANDLE module) {
|
||||
if (m_self.handle () == module) {
|
||||
|
|
@ -701,7 +701,7 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
static DLSYM_RETURN CR_STDCALL lookupHandler (SharedLibrary::Handle module, const char *function) {
|
||||
static SharedLibrary::Func CR_STDCALL lookupHandler (SharedLibrary::Handle module, const char *function) {
|
||||
return EntityLinkage::instance ().lookup (module, function);
|
||||
}
|
||||
|
||||
|
|
|
|||
77
inc/graph.h
77
inc/graph.h
|
|
@ -186,10 +186,10 @@ struct PODPath {
|
|||
// this structure links nodes returned from pathfinder
|
||||
class PathWalk final : public DenyCopying {
|
||||
private:
|
||||
size_t m_cursor = 0;
|
||||
size_t m_length = 0;
|
||||
size_t m_cursor {};
|
||||
size_t m_length {};
|
||||
|
||||
UniquePtr <int32[]> m_path;
|
||||
UniquePtr <int32[]> m_path {};
|
||||
|
||||
public:
|
||||
explicit PathWalk () = default;
|
||||
|
|
@ -263,60 +263,59 @@ private:
|
|||
int x, y, z;
|
||||
};
|
||||
|
||||
int m_editFlags;
|
||||
int m_loadAttempts;
|
||||
int m_cacheNodeIndex;
|
||||
int m_lastJumpNode;
|
||||
int m_findWPIndex;
|
||||
int m_facingAtIndex;
|
||||
int m_editFlags {};
|
||||
int m_loadAttempts {};
|
||||
int m_cacheNodeIndex {};
|
||||
int m_lastJumpNode {};
|
||||
int m_findWPIndex {};
|
||||
int m_facingAtIndex {};
|
||||
int m_highestDamage[kGameTeamNum] {};
|
||||
int m_autoSaveCount;
|
||||
int m_autoSaveCount {};
|
||||
|
||||
float m_timeJumpStarted;
|
||||
float m_autoPathDistance;
|
||||
float m_pathDisplayTime;
|
||||
float m_arrowDisplayTime;
|
||||
float m_timeJumpStarted {};
|
||||
float m_autoPathDistance {};
|
||||
float m_pathDisplayTime {};
|
||||
float m_arrowDisplayTime {};
|
||||
|
||||
bool m_isOnLadder;
|
||||
bool m_endJumpPoint;
|
||||
bool m_jumpLearnNode;
|
||||
bool m_hasChanged;
|
||||
bool m_needsVisRebuild;
|
||||
bool m_narrowChecked;
|
||||
bool m_isOnLadder {};
|
||||
bool m_endJumpPoint {};
|
||||
bool m_jumpLearnNode {};
|
||||
bool m_hasChanged {};
|
||||
bool m_needsVisRebuild {};
|
||||
bool m_narrowChecked {};
|
||||
|
||||
Vector m_learnVelocity;
|
||||
Vector m_learnPosition;
|
||||
Vector m_bombOrigin;
|
||||
Vector m_lastNode;
|
||||
Vector m_learnVelocity {};
|
||||
Vector m_learnPosition {};
|
||||
Vector m_bombOrigin {};
|
||||
Vector m_lastNode {};
|
||||
|
||||
IntArray m_terrorPoints;
|
||||
IntArray m_ctPoints;
|
||||
IntArray m_goalPoints;
|
||||
IntArray m_campPoints;
|
||||
IntArray m_sniperPoints;
|
||||
IntArray m_rescuePoints;
|
||||
IntArray m_visitedGoals;
|
||||
IntArray m_terrorPoints {};
|
||||
IntArray m_ctPoints {};
|
||||
IntArray m_goalPoints {};
|
||||
IntArray m_campPoints {};
|
||||
IntArray m_sniperPoints {};
|
||||
IntArray m_rescuePoints {};
|
||||
IntArray m_visitedGoals {};
|
||||
|
||||
SmallArray <int32> m_buckets[kMaxBucketsInsidePos][kMaxBucketsInsidePos][kMaxBucketsInsidePos];
|
||||
SmallArray <Matrix> m_matrix;
|
||||
SmallArray <Practice> m_practice;
|
||||
SmallArray <Path> m_paths;
|
||||
SmallArray <uint8> m_vistable;
|
||||
SmallArray <Matrix> m_matrix {};
|
||||
SmallArray <Practice> m_practice {};
|
||||
SmallArray <Path> m_paths {};
|
||||
SmallArray <uint8> m_vistable {};
|
||||
|
||||
String m_graphAuthor;
|
||||
String m_graphModified;
|
||||
String m_graphAuthor {};
|
||||
String m_graphModified {};
|
||||
|
||||
ExtenHeader m_extenHeader {};
|
||||
StorageHeader m_graphHeader {};
|
||||
|
||||
edict_t *m_editor;
|
||||
edict_t *m_editor {};
|
||||
|
||||
public:
|
||||
BotGraph ();
|
||||
~BotGraph () = default;
|
||||
|
||||
public:
|
||||
|
||||
int getFacingIndex ();
|
||||
int getFarest (const Vector &origin, float maxDistance = 32.0);
|
||||
int getNearest (const Vector &origin, float minDistance = kInfiniteDistance, int flags = -1);
|
||||
|
|
|
|||
|
|
@ -54,13 +54,13 @@ public:
|
|||
using UniqueBot = UniquePtr <Bot>;
|
||||
|
||||
private:
|
||||
float m_timeRoundStart;
|
||||
float m_timeRoundEnd;
|
||||
float m_timeRoundMid;
|
||||
float m_timeRoundStart {};
|
||||
float m_timeRoundEnd {};
|
||||
float m_timeRoundMid {};
|
||||
|
||||
float m_autoKillCheckTime; // time to kill all the bots ?
|
||||
float m_maintainTime; // time to maintain bot creation
|
||||
float m_quotaMaintainTime; // time to maintain bot quota
|
||||
float m_autoKillCheckTime {}; // time to kill all the bots ?
|
||||
float m_maintainTime {}; // time to maintain bot creation
|
||||
float m_quotaMaintainTime {}; // time to maintain bot quota
|
||||
float m_grenadeUpdateTime {}; // time to update active grenades
|
||||
float m_entityUpdateTime {}; // time to update intresting entities
|
||||
float m_plantSearchUpdateTime {}; // time to update for searching planted bomb
|
||||
|
|
@ -68,26 +68,26 @@ private:
|
|||
float m_timeBombPlanted {}; // time the bomb were planted
|
||||
float m_lastRadioTime[kGameTeamNum] {}; // global radio time
|
||||
|
||||
int m_lastWinner; // the team who won previous round
|
||||
int m_lastDifficulty; // last bots difficulty
|
||||
int m_bombSayStatus; // some bot is issued whine about bomb
|
||||
int m_lastWinner {}; // the team who won previous round
|
||||
int m_lastDifficulty {}; // last bots difficulty
|
||||
int m_bombSayStatus {}; // some bot is issued whine about bomb
|
||||
int m_lastRadio[kGameTeamNum] {}; // last radio message for team
|
||||
|
||||
bool m_leaderChoosen[kGameTeamNum] {}; // is team leader choose theese round
|
||||
bool m_economicsGood[kGameTeamNum] {}; // is team able to buy anything
|
||||
bool m_bombPlanted;
|
||||
bool m_botsCanPause;
|
||||
bool m_roundOver;
|
||||
bool m_bombPlanted {};
|
||||
bool m_botsCanPause {};
|
||||
bool m_roundOver {};
|
||||
|
||||
Array <edict_t *> m_activeGrenades; // holds currently active grenades on the map
|
||||
Array <edict_t *> m_intrestingEntities; // holds currently intresting entities on the map
|
||||
Array <edict_t *> m_activeGrenades {}; // holds currently active grenades on the map
|
||||
Array <edict_t *> m_intrestingEntities {}; // holds currently intresting entities on the map
|
||||
|
||||
Deque <String> m_saveBotNames; // bots names that persist upon changelevel
|
||||
Deque <BotRequest> m_addRequests; // bot creation tab
|
||||
SmallArray <BotTask> m_filters; // task filters
|
||||
SmallArray <UniqueBot> m_bots; // all available bots
|
||||
Deque <String> m_saveBotNames {}; // bots names that persist upon changelevel
|
||||
Deque <BotRequest> m_addRequests {}; // bot creation tab
|
||||
SmallArray <BotTask> m_filters {}; // task filters
|
||||
SmallArray <UniqueBot> m_bots {}; // all available bots
|
||||
|
||||
edict_t *m_killerEntity; // killer entity for bots
|
||||
edict_t *m_killerEntity {}; // killer entity for bots
|
||||
FrustumData m_frustumData {};
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -82,22 +82,22 @@ private:
|
|||
};
|
||||
|
||||
private:
|
||||
HashMap <String, int32> m_textMsgCache; // cache strings for faster access for textmsg
|
||||
HashMap <String, int32> m_showMenuCache; // cache for the showmenu message
|
||||
HashMap <String, int32> m_statusIconCache; // cache for status icon message
|
||||
HashMap <String, int32> m_teamInfoCache; // cache for teaminfo message
|
||||
HashMap <String, int32> m_textMsgCache {}; // cache strings for faster access for textmsg
|
||||
HashMap <String, int32> m_showMenuCache {}; // cache for the showmenu message
|
||||
HashMap <String, int32> m_statusIconCache {}; // cache for status icon message
|
||||
HashMap <String, int32> m_teamInfoCache {}; // cache for teaminfo message
|
||||
|
||||
private:
|
||||
Bot *m_bot {}; // owner of a message
|
||||
NetMsg m_current {}; // ongoing message id
|
||||
|
||||
SmallArray <Args> m_args; // args collected from write* functions
|
||||
SmallArray <Args> m_args {}; // args collected from write* functions
|
||||
|
||||
HashMap <String, NetMsg> m_wanted; // wanted messages
|
||||
HashMap <int32, NetMsg> m_reverseMap; // maps engine message id to our message id
|
||||
HashMap <String, NetMsg> m_wanted {}; // wanted messages
|
||||
HashMap <int32, NetMsg> m_reverseMap {}; // maps engine message id to our message id
|
||||
|
||||
HashMap <NetMsg, int32, MsgHash> m_maps; // maps our message to id to engine message id
|
||||
HashMap <NetMsg, MsgFunc, MsgHash> m_handlers; // maps our message id to handler function
|
||||
HashMap <NetMsg, int32, MsgHash> m_maps {}; // maps our message to id to engine message id
|
||||
HashMap <NetMsg, MsgFunc, MsgHash> m_handlers {}; // maps our message id to handler function
|
||||
|
||||
private:
|
||||
void netMsgTextMsg ();
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
class Product final : public Singleton <Product> {
|
||||
public:
|
||||
struct Build {
|
||||
StringRef hash { MODULE_BUILD_HASH };
|
||||
StringRef author { MODULE_BUILD_AUTHOR };
|
||||
StringRef count { MODULE_BUILD_COUNT };
|
||||
StringRef machine { MODULE_BUILD_MACHINE };
|
||||
StringRef compiler { MODULE_BUILD_COMPILER };
|
||||
StringRef id { MODULE_BOT_BUILD_ID };
|
||||
} build { };
|
||||
StringRef hash { MODULE_COMMIT_COUNT };
|
||||
StringRef count { MODULE_COMMIT_HASH };
|
||||
StringRef author { MODULE_AUTHOR };
|
||||
StringRef machine { MODULE_MACHINE };
|
||||
StringRef compiler { MODULE_COMPILER };
|
||||
StringRef id { MODULE_BUILD_ID };
|
||||
} build {};
|
||||
|
||||
public:
|
||||
StringRef name { "YaPB" };
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
StringRef logtag { "YB" };
|
||||
StringRef dtime { __DATE__ " " __TIME__ };
|
||||
StringRef date { __DATE__ };
|
||||
StringRef version { MODULE_BOT_VERSION "." MODULE_BUILD_COUNT };
|
||||
StringRef version { MODULE_VERSION "." MODULE_COMMIT_COUNT };
|
||||
StringRef cmdPri { "yb" };
|
||||
StringRef cmdSec { "yapb" };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ CR_DECLARE_SCOPED_ENUM (Noise,
|
|||
|
||||
class BotSupport final : public Singleton <BotSupport> {
|
||||
private:
|
||||
bool m_needToSendWelcome;
|
||||
float m_welcomeReceiveTime;
|
||||
bool m_needToSendWelcome {};
|
||||
float m_welcomeReceiveTime {};
|
||||
|
||||
StringArray m_sentences;
|
||||
SmallArray <Client> m_clients;
|
||||
SmallArray <Twin <String, String>> m_tags;
|
||||
StringArray m_sentences {};
|
||||
SmallArray <Client> m_clients {};
|
||||
SmallArray <Twin <String, String>> m_tags {};
|
||||
|
||||
HashMap <int32, String> m_weaponAlias;
|
||||
HashMap <String, int32> m_noiseCache;
|
||||
HashMap <int32, String> m_weaponAlias {};
|
||||
HashMap <String, int32> m_noiseCache {};
|
||||
Detour <decltype (sendto)> m_sendToDetour { "ws2_32.dll", "sendto", sendto };
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,12 +8,11 @@
|
|||
#pragma once
|
||||
|
||||
// fallback if no git or custom build
|
||||
#define MODULE_BUILD_HASH "0"
|
||||
#define MODULE_BUILD_AUTHOR "yapb@jeefo.net"
|
||||
#define MODULE_BUILD_COUNT "0"
|
||||
#define MODULE_BUILD_MACHINE "localhost"
|
||||
#define MODULE_BUILD_COMPILER "unknown"
|
||||
|
||||
#define MODULE_BOT_VERSION "4.3"
|
||||
#define MODULE_BOT_VERSION_FILE 4,3,0,000
|
||||
#define MODULE_BOT_BUILD_ID "0:0"
|
||||
#define MODULE_COMMIT_COUNT "0"
|
||||
#define MODULE_COMMIT_HASH "0"
|
||||
#define MODULE_AUTHOR "default@mail.net"
|
||||
#define MODULE_MACHINE "localhost"
|
||||
#define MODULE_COMPILER "default"
|
||||
#define MODULE_VERSION "4.0"
|
||||
#define MODULE_VERSION_FILE 4,0,0,000
|
||||
#define MODULE_BUILD_ID "0:0"
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
// generated by meson build system
|
||||
#ifndef MODULE_BUILD_HASH
|
||||
# define MODULE_BUILD_HASH "@hash@"
|
||||
# define MODULE_BUILD_AUTHOR @author@
|
||||
# define MODULE_BUILD_COUNT "@count@"
|
||||
# define MODULE_BUILD_MACHINE "@machine@"
|
||||
# define MODULE_BUILD_COMPILER "@compiler@"
|
||||
# define MODULE_BOT_VERSION "@version@"
|
||||
# define MODULE_BOT_VERSION_FILE @version_win@,@count@
|
||||
# define MODULE_BOT_BUILD_ID "@count@:@hash@"
|
||||
# define MODULE_COMMIT_COUNT "@count@"
|
||||
# define MODULE_COMMIT_HASH "@hash@"
|
||||
# define MODULE_AUTHOR @author@
|
||||
# define MODULE_MACHINE "@machine@"
|
||||
# define MODULE_COMPILER "@compiler@"
|
||||
# define MODULE_VERSION "@version@"
|
||||
# define MODULE_VERSION_FILE @winver@,@count@
|
||||
# define MODULE_BUILD_ID "@count@:@hash@"
|
||||
#endif
|
||||
|
|
|
|||
166
inc/yapb.h
166
inc/yapb.h
|
|
@ -349,7 +349,7 @@ CR_DECLARE_SCOPED_ENUM (Reload,
|
|||
)
|
||||
|
||||
// collision probes
|
||||
CR_DECLARE_SCOPED_ENUM (CollisionProbe,
|
||||
CR_DECLARE_SCOPED_ENUM (CollisionProbe, uint32,
|
||||
Jump = cr::bit (0), // probe jump when colliding
|
||||
Duck = cr::bit (1), // probe duck when colliding
|
||||
Strafe = cr::bit (2) // probe strafing when colliding
|
||||
|
|
@ -367,7 +367,7 @@ CR_DECLARE_SCOPED_ENUM (BotMsg,
|
|||
)
|
||||
|
||||
// sensing states
|
||||
CR_DECLARE_SCOPED_ENUM (Sense,
|
||||
CR_DECLARE_SCOPED_ENUM_TYPE (Sense, uint32,
|
||||
SeeingEnemy = cr::bit (0), // seeing an enemy
|
||||
HearingEnemy = cr::bit (1), // hearing an enemy
|
||||
SuspectEnemy = cr::bit (2), // suspect enemy behind obstacle
|
||||
|
|
@ -378,7 +378,7 @@ CR_DECLARE_SCOPED_ENUM (Sense,
|
|||
)
|
||||
|
||||
// positions to aim at
|
||||
CR_DECLARE_SCOPED_ENUM (AimFlags,
|
||||
CR_DECLARE_SCOPED_ENUM_TYPE (AimFlags, uint32,
|
||||
Nav = cr::bit (0), // aim at nav point
|
||||
Camp = cr::bit (1), // aim at camp vector
|
||||
PredictPath = cr::bit (2), // aim at predicted path
|
||||
|
|
@ -590,12 +590,12 @@ struct Client {
|
|||
|
||||
// define chatting collection structure
|
||||
struct ChatCollection {
|
||||
int chatProbability;
|
||||
float chatDelay;
|
||||
float timeNextChat;
|
||||
int entityIndex;
|
||||
String sayText;
|
||||
StringArray lastUsedSentences;
|
||||
int chatProbability {};
|
||||
float chatDelay {};
|
||||
float timeNextChat {};
|
||||
int entityIndex {};
|
||||
String sayText {};
|
||||
StringArray lastUsedSentences {};
|
||||
};
|
||||
|
||||
// include bot graph stuff
|
||||
|
|
@ -622,7 +622,7 @@ private:
|
|||
|
||||
int m_oldButtons {}; // our old buttons
|
||||
int m_reloadState {}; // current reload state
|
||||
int m_voicePitch; // bot voice pitch
|
||||
int m_voicePitch {}; // bot voice pitch
|
||||
int m_loosedBombNodeIndex {}; // nearest to loosed bomb node
|
||||
int m_plantedBombNodeIndex {}; // nearest to planted bomb node
|
||||
int m_currentNodeIndex {}; // current node index
|
||||
|
|
@ -635,19 +635,18 @@ private:
|
|||
int m_tryOpenDoor {}; // attempt's to open the door
|
||||
int m_liftState {}; // state of lift handling
|
||||
int m_radioSelect {}; // radio entry
|
||||
|
||||
|
||||
|
||||
float m_headedTime {};
|
||||
float m_prevTime {}; // time previously checked movement speed
|
||||
float m_heavyTimestamp; // is it time to execute heavy-weight functions
|
||||
float m_heavyTimestamp {}; // is it time to execute heavy-weight functions
|
||||
float m_prevSpeed {}; // speed some frames before
|
||||
float m_timeDoorOpen {}; // time to next door open check
|
||||
float m_lastChatTime {}; // time bot last chatted
|
||||
float m_timeLogoSpray {}; // time bot last spray logo
|
||||
float m_knifeAttackTime {}; // time to rush with knife (at the beginning of the round)
|
||||
float m_duckDefuseCheckTime {}; // time to check for ducking for defuse
|
||||
float m_frameInterval; // bot's frame interval
|
||||
float m_lastCommandTime; // time bot last thinked
|
||||
float m_frameInterval {}; // bot's frame interval
|
||||
float m_lastCommandTime {}; // time bot last thinked
|
||||
float m_reloadCheckTime {}; // time to check reloading
|
||||
float m_zoomCheckTime {}; // time to check zoom again
|
||||
float m_shieldCheckTime {}; // time to check shiled drawing again
|
||||
|
|
@ -685,15 +684,15 @@ private:
|
|||
float m_minSpeed {}; // minimum speed in normal mode
|
||||
float m_oldCombatDesire {}; // holds old desire for filtering
|
||||
float m_itemCheckTime {}; // time next search for items needs to be done
|
||||
float m_joinServerTime; // time when bot joined the game
|
||||
float m_playServerTime; // time bot spent in the game
|
||||
float m_joinServerTime {}; // time when bot joined the game
|
||||
float m_playServerTime {}; // time bot spent in the game
|
||||
float m_changeViewTime {}; // timestamp to change look at while at freezetime
|
||||
float m_breakableTime {}; // breakeble acquired time
|
||||
|
||||
bool m_moveToGoal {}; // bot currently moving to goal??
|
||||
bool m_isStuck {}; // bot is stuck
|
||||
bool m_isReloading {}; // bot is reloading a gun
|
||||
bool m_forceRadio; // should bot use radio anyway?
|
||||
bool m_forceRadio {}; // should bot use radio anyway?
|
||||
bool m_defendedBomb {}; // defend action issued
|
||||
bool m_defendHostage {}; // defend action issued
|
||||
bool m_duckDefuse {}; // should or not bot duck to defuse bomb
|
||||
|
|
@ -708,14 +707,14 @@ private:
|
|||
bool m_moveToC4 {}; // ct is moving to bomb
|
||||
bool m_grenadeRequested {}; // bot requested change to grenade
|
||||
|
||||
Pickup m_pickupType; // type of entity which needs to be used/picked up
|
||||
PathWalk m_pathWalk; // pointer to current node from path
|
||||
Dodge m_combatStrafeDir; // direction to strafe
|
||||
Fight m_fightStyle; // combat style to use
|
||||
CollisionState m_collisionState; // collision State
|
||||
FindPath m_pathType; // which pathfinder to use
|
||||
Pickup m_pickupType {}; // type of entity which needs to be used/picked up
|
||||
PathWalk m_pathWalk {}; // pointer to current node from path
|
||||
Dodge m_combatStrafeDir {}; // direction to strafe
|
||||
Fight m_fightStyle {}; // combat style to use
|
||||
CollisionState m_collisionState {}; // collision State
|
||||
FindPath m_pathType {}; // which pathfinder to use
|
||||
uint8 m_enemyParts {}; // visibility flags
|
||||
TraceResult m_lastTrace[TraceChannel::Num]; // last trace result
|
||||
TraceResult m_lastTrace[TraceChannel::Num] {}; // last trace result
|
||||
|
||||
edict_t *m_pickupItem {}; // pointer to entity of item to use/pickup
|
||||
edict_t *m_itemIgnore {}; // pointer to entity to ignore for pickup
|
||||
|
|
@ -725,31 +724,31 @@ private:
|
|||
edict_t *m_targetEntity {}; // the entity that the bot is trying to reach
|
||||
edict_t *m_avoidGrenade {}; // pointer to grenade entity to avoid
|
||||
|
||||
Vector m_liftTravelPos; // lift travel position
|
||||
Vector m_moveAngles; // bot move angles
|
||||
Vector m_idealAngles; // angle wanted
|
||||
Vector m_randomizedIdealAngles; // angle wanted with noise
|
||||
Vector m_angularDeviation; // angular deviation from current to ideal angles
|
||||
Vector m_aimSpeed; // aim speed calculated
|
||||
Vector m_aimLastError; // last calculated aim error
|
||||
Vector m_prevOrigin; // origin some frames before
|
||||
Vector m_lookAt; // vector bot should look at
|
||||
Vector m_throw; // origin of node to throw grenades
|
||||
Vector m_enemyOrigin; // target origin chosen for shooting
|
||||
Vector m_grenade; // calculated vector for grenades
|
||||
Vector m_entity; // origin of entities like buttons etc.
|
||||
Vector m_camp; // aiming vector when camping.
|
||||
Vector m_desiredVelocity; // desired velocity for jump nodes
|
||||
Vector m_breakableOrigin; // origin of breakable
|
||||
Vector m_liftTravelPos {}; // lift travel position
|
||||
Vector m_moveAngles {}; // bot move angles
|
||||
Vector m_idealAngles {}; // angle wanted
|
||||
Vector m_randomizedIdealAngles {}; // angle wanted with noise
|
||||
Vector m_angularDeviation {}; // angular deviation from current to ideal angles
|
||||
Vector m_aimSpeed {}; // aim speed calculated
|
||||
Vector m_aimLastError {}; // last calculated aim error
|
||||
Vector m_prevOrigin {}; // origin some frames before
|
||||
Vector m_lookAt {}; // vector bot should look at
|
||||
Vector m_throw {}; // origin of node to throw grenades
|
||||
Vector m_enemyOrigin {}; // target origin chosen for shooting
|
||||
Vector m_grenade {}; // calculated vector for grenades
|
||||
Vector m_entity {}; // origin of entities like buttons etc.
|
||||
Vector m_camp {}; // aiming vector when camping.
|
||||
Vector m_desiredVelocity {}; // desired velocity for jump nodes
|
||||
Vector m_breakableOrigin {}; // origin of breakable
|
||||
|
||||
Array <edict_t *> m_ignoredBreakable; // list of ignored breakables
|
||||
Array <edict_t *> m_hostages; // pointer to used hostage entities
|
||||
Array <Route> m_routes; // pointer
|
||||
Array <int32> m_goalHistory; // history of selected goals
|
||||
Array <edict_t *> m_ignoredBreakable {}; // list of ignored breakables
|
||||
Array <edict_t *> m_hostages {}; // pointer to used hostage entities
|
||||
Array <Route> m_routes {}; // pointer
|
||||
Array <int32> m_goalHistory {}; // history of selected goals
|
||||
|
||||
BinaryHeap <RouteTwin> m_routeQue;
|
||||
BinaryHeap <RouteTwin> m_routeQue {};
|
||||
Path *m_path {}; // pointer to the current path node
|
||||
String m_chatBuffer; // space for strings (say text...)
|
||||
String m_chatBuffer {}; // space for strings (say text...)
|
||||
FrustumPlane m_frustum[FrustumSide::Num] {};
|
||||
|
||||
private:
|
||||
|
|
@ -879,8 +878,8 @@ private:
|
|||
void focusEnemy ();
|
||||
void selectBestWeapon ();
|
||||
void selectSecondary ();
|
||||
void selectWeaponByName (const char *name);
|
||||
void selectWeaponById (int num);
|
||||
void selectWeaponByName (StringRef name);
|
||||
void selectWeaponByIndex (int index);
|
||||
|
||||
void completeTask ();
|
||||
void tasks ();
|
||||
|
|
@ -938,17 +937,17 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
entvars_t *pev;
|
||||
entvars_t *pev {};
|
||||
|
||||
int m_index; // saved bot index
|
||||
int m_wantedTeam; // player team bot wants select
|
||||
int m_wantedSkin; // player model bot wants to select
|
||||
int m_difficulty; // bots hard level
|
||||
int m_moneyAmount; // amount of money in bot's bank
|
||||
int m_index {}; // saved bot index
|
||||
int m_wantedTeam {}; // player team bot wants select
|
||||
int m_wantedSkin {}; // player model bot wants to select
|
||||
int m_difficulty {}; // bots hard level
|
||||
int m_moneyAmount {}; // amount of money in bot's bank
|
||||
|
||||
float m_spawnTime {}; // time this bot spawned
|
||||
float m_timeTeamOrder {}; // time of last radio command
|
||||
float m_slowFrameTimestamp; // time to per-second think
|
||||
float m_slowFrameTimestamp {}; // time to per-second think
|
||||
float m_nextBuyTime {}; // next buy time
|
||||
float m_checkDarkTime {}; // check for darkness time
|
||||
float m_preventFlashing {}; // bot turned away from flashbang
|
||||
|
|
@ -957,11 +956,11 @@ public:
|
|||
float m_blindSidemoveSpeed {}; // mad side move speeds when bot is blind
|
||||
float m_fallDownTime {}; // time bot started to fall
|
||||
float m_duckForJump {}; // is bot needed to duck for double jump
|
||||
float m_baseAgressionLevel; // base aggression level (on initializing)
|
||||
float m_baseFearLevel; // base fear level (on initializing)
|
||||
float m_agressionLevel; // dynamic aggression level (in game)
|
||||
float m_fearLevel; // dynamic fear level (in game)
|
||||
float m_nextEmotionUpdate; // next time to sanitize emotions
|
||||
float m_baseAgressionLevel {}; // base aggression level (on initializing)
|
||||
float m_baseFearLevel {}; // base fear level (on initializing)
|
||||
float m_agressionLevel {}; // dynamic aggression level (in game)
|
||||
float m_fearLevel {}; // dynamic fear level (in game)
|
||||
float m_nextEmotionUpdate {}; // next time to sanitize emotions
|
||||
float m_updateTime {}; // skip some frames in bot thinking
|
||||
float m_updateInterval {}; // interval between frames
|
||||
float m_goalValue {}; // ranking value for this node
|
||||
|
|
@ -980,21 +979,21 @@ public:
|
|||
float m_shootTime {}; // time to shoot
|
||||
float m_timeLastFired {}; // time to last firing
|
||||
float m_difficultyChange {}; // time when auto-difficulty was last applied to this bot
|
||||
float m_kpdRatio; // kill per death ratio
|
||||
float m_healthValue; // clamped bot health
|
||||
float m_stayTime; // stay time before reconnect
|
||||
float m_kpdRatio {}; // kill per death ratio
|
||||
float m_healthValue {}; // clamped bot health
|
||||
float m_stayTime {}; // stay time before reconnect
|
||||
|
||||
int m_blindNodeIndex {}; // node index to cover when blind
|
||||
int m_flashLevel {}; // flashlight level
|
||||
int m_basePing; // base ping for bot
|
||||
int m_basePing {}; // base ping for bot
|
||||
int m_numEnemiesLeft {}; // number of enemies alive left on map
|
||||
int m_numFriendsLeft {}; // number of friend alive left on map
|
||||
int m_retryJoin; // retry count for chosing team/class
|
||||
int m_startAction; // team/class selection state
|
||||
int m_retryJoin {}; // retry count for chosing team/class
|
||||
int m_startAction {}; // team/class selection state
|
||||
int m_voteKickIndex {}; // index of player to vote against
|
||||
int m_lastVoteKick {}; // last index
|
||||
int m_voteMap {}; // number of map to vote for
|
||||
int m_logotypeIndex; // index for logotype
|
||||
int m_logotypeIndex {}; // index for logotype
|
||||
int m_buyState {}; // current count in buying
|
||||
int m_blindButton {}; // buttons bot press, when blind
|
||||
int m_radioOrder {}; // actual command
|
||||
|
|
@ -1002,14 +1001,14 @@ public:
|
|||
int m_chosenGoalIndex {}; // used for experience, same as above
|
||||
int m_lastDamageType {}; // stores last damage
|
||||
int m_team {}; // bot team
|
||||
int m_currentWeapon; // one current weapon for each bot
|
||||
int m_weaponType; // current weapon type
|
||||
int m_currentWeapon {}; // one current weapon for each bot
|
||||
int m_weaponType {}; // current weapon type
|
||||
int m_ammoInClip[kMaxWeapons] {}; // ammo in clip for each weapons
|
||||
int m_ammo[MAX_AMMO_SLOTS] {}; // total ammo amounts
|
||||
|
||||
bool m_isVIP {}; // bot is vip?
|
||||
bool m_notKilled; // has the player been killed or has he just respawned
|
||||
bool m_notStarted; // team/class not chosen yet
|
||||
bool m_notKilled {}; // has the player been killed or has he just respawned
|
||||
bool m_notStarted {}; // team/class not chosen yet
|
||||
bool m_ignoreBuyDelay {}; // when reaching buyzone in the middle of the round don't do pauses
|
||||
bool m_inBombZone {}; // bot in the bomb zone or not
|
||||
bool m_inBuyZone {}; // bot currently in buy zone
|
||||
|
|
@ -1033,17 +1032,17 @@ public:
|
|||
edict_t *m_lastVictim {}; // pointer to killed entity
|
||||
edict_t *m_trackingEdict {}; // pointer to last tracked player when camping/hiding
|
||||
|
||||
Vector m_pathOrigin; // origin of node
|
||||
Vector m_destOrigin; // origin of move destination
|
||||
Vector m_position; // position to move to in move to position task
|
||||
Vector m_doubleJumpOrigin; // origin of double jump
|
||||
Vector m_lastEnemyOrigin; // vector to last enemy origin
|
||||
Vector m_pathOrigin {}; // origin of node
|
||||
Vector m_destOrigin {}; // origin of move destination
|
||||
Vector m_position {}; // position to move to in move to position task
|
||||
Vector m_doubleJumpOrigin {}; // origin of double jump
|
||||
Vector m_lastEnemyOrigin {}; // vector to last enemy origin
|
||||
|
||||
ChatCollection m_sayTextBuffer; // holds the index & the actual message of the last unprocessed text message of a player
|
||||
BurstMode m_weaponBurstMode; // bot using burst mode? (famas/glock18, but also silencer mode)
|
||||
Personality m_personality; // bots type
|
||||
Array <BotTask> m_tasks;
|
||||
Deque <int32> m_msgQueue;
|
||||
ChatCollection m_sayTextBuffer {}; // holds the index & the actual message of the last unprocessed text message of a player
|
||||
BurstMode m_weaponBurstMode {}; // bot using burst mode? (famas/glock18, but also silencer mode)
|
||||
Personality m_personality {}; // bots type
|
||||
Array <BotTask> m_tasks {};
|
||||
Deque <int32> m_msgQueue {};
|
||||
|
||||
public:
|
||||
Bot (edict_t *bot, int difficulty, int personality, int team, int skin);
|
||||
|
|
@ -1101,6 +1100,7 @@ public:
|
|||
bool canSkipNextTrace (TraceChannel channel);
|
||||
|
||||
int getAmmo ();
|
||||
int getAmmo (int id);
|
||||
int getNearestToPlantedBomb ();
|
||||
|
||||
float getFrameInterval ();
|
||||
|
|
@ -1111,6 +1111,8 @@ public:
|
|||
int getAmmoInClip () const {
|
||||
return m_ammoInClip[m_currentWeapon];
|
||||
}
|
||||
|
||||
bool isLowOnAmmo (const int index, const float factor) const;
|
||||
|
||||
Vector getCenter () const {
|
||||
return (pev->absmax + pev->absmin) * 0.5;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue