fix: logos config not initialized (resolves #691)
bot: make sure rescue zone icon blinking to consider bot reached rescue zone when escorting hostages (ref #688) bot: remove hardcoded radio communication randoms, so they're now depends on bots personality refactor: some refactoring of code
This commit is contained in:
parent
d6d76e136d
commit
6dfb09f110
26 changed files with 180 additions and 141 deletions
|
|
@ -53,7 +53,7 @@ private:
|
|||
void cleanup ();
|
||||
|
||||
// show overlay message about analyzing
|
||||
void displayOverlayMessage ();
|
||||
void displayOverlayMessage () const;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ public:
|
|||
void levelShutdown ();
|
||||
|
||||
// display world line
|
||||
void drawLine (edict_t *ent, const Vector &start, const Vector &end, int width, int noise, const Color &color, int brightness, int speed, int life, DrawLine type = DrawLine::Simple);
|
||||
void drawLine (edict_t *ent, const Vector &start, const Vector &end, int width, int noise, const Color &color, int brightness, int speed, int life, DrawLine type = DrawLine::Simple) const;
|
||||
|
||||
// test line
|
||||
void testLine (const Vector &start, const Vector &end, int ignoreFlags, edict_t *ignoreEntity, TraceResult *ptr);
|
||||
|
|
@ -260,13 +260,13 @@ public:
|
|||
void searchEntities (StringRef field, StringRef value, EntitySearch functor);
|
||||
|
||||
// search entities in sphere
|
||||
void searchEntities (const Vector &position, float radius, EntitySearch functor);
|
||||
void searchEntities (const Vector &position, float radius, EntitySearch functor) const;
|
||||
|
||||
// check if map has entity
|
||||
bool hasEntityInGame (StringRef classname);
|
||||
|
||||
// print the version to server console on startup
|
||||
void printBotVersion ();
|
||||
void printBotVersion () const;
|
||||
|
||||
// ensure prosperous gaming environment as per: https://github.com/yapb/yapb/issues/575
|
||||
void ensureHealthyGameEnvironment ();
|
||||
|
|
@ -388,7 +388,7 @@ public:
|
|||
bool checkVisibility (edict_t *ent, uint8_t *set);
|
||||
|
||||
// get pvs/pas visibility set
|
||||
uint8_t *getVisibilitySet (Bot *bot, bool pvs);
|
||||
uint8_t *getVisibilitySet (Bot *bot, bool pvs) const;
|
||||
|
||||
// what kind of game engine / game dll / mod / tool we're running ?
|
||||
bool is (const int type) const {
|
||||
|
|
|
|||
12
inc/graph.h
12
inc/graph.h
|
|
@ -218,9 +218,9 @@ public:
|
|||
bool convertOldFormat ();
|
||||
bool isConnected (int a, int b);
|
||||
bool isConnected (int index);
|
||||
bool isNodeReacheableEx (const Vector &src, const Vector &destination, const float maxHeight);
|
||||
bool isNodeReacheable (const Vector &src, const Vector &destination);
|
||||
bool isNodeReacheableWithJump (const Vector &src, const Vector &destination);
|
||||
bool isNodeReacheableEx (const Vector &src, const Vector &destination, const float maxHeight) const;
|
||||
bool isNodeReacheable (const Vector &src, const Vector &destination) const;
|
||||
bool isNodeReacheableWithJump (const Vector &src, const Vector &destination) const;
|
||||
bool checkNodes (bool teleportPlayer, bool onlyPaths = false);
|
||||
bool isVisited (int index);
|
||||
|
||||
|
|
@ -255,13 +255,13 @@ public:
|
|||
void eraseFromBucket (const Vector &pos, int index);
|
||||
void setBombOrigin (bool reset = false, const Vector &pos = nullptr);
|
||||
void unassignPath (int from, int to);
|
||||
void convertFromPOD (Path &path, const PODPath &pod);
|
||||
void convertFromPOD (Path &path, const PODPath &pod) const;
|
||||
void convertToPOD (const Path &path, PODPath &pod);
|
||||
void convertCampDirection (Path &path);
|
||||
void convertCampDirection (Path &path) const;
|
||||
void setAutoPathDistance (const float distance);
|
||||
void showStats ();
|
||||
void showFileInfo ();
|
||||
void emitNotify (int32_t sound);
|
||||
void emitNotify (int32_t sound) const;
|
||||
void syncCollectOnline ();
|
||||
void collectOnline ();
|
||||
|
||||
|
|
|
|||
27
inc/hooks.h
27
inc/hooks.h
|
|
@ -109,19 +109,22 @@ public:
|
|||
};
|
||||
|
||||
// used for transit calls between game dll and engine without all needed functions on bot side
|
||||
class DynamicLinkerHook : public Singleton <DynamicLinkerHook> {
|
||||
class EntityLinkHook : public Singleton <EntityLinkHook> {
|
||||
private:
|
||||
#if defined(CR_WINDOWS)
|
||||
# define DLSYM_FUNCTION GetProcAddress
|
||||
# define DLCLOSE_FUNCTION FreeLibrary
|
||||
#elif defined(CR_PSVITA) // just a shim
|
||||
# define DLSYM_FUNCTION vrtld_dlsym
|
||||
# define DLCLOSE_FUNCTION vrtld_dlclose
|
||||
#else
|
||||
# define DLSYM_FUNCTION dlsym
|
||||
# define DLCLOSE_FUNCTION dlclose
|
||||
#endif
|
||||
|
||||
private:
|
||||
using DlsymProto = SharedLibrary::Func CR_STDCALL (SharedLibrary::Handle, const char *);
|
||||
using DlcloseProto = int CR_STDCALL (SharedLibrary::Handle);
|
||||
using DlsymProto = decltype (DLSYM_FUNCTION);
|
||||
using DlcloseProto = decltype (DLCLOSE_FUNCTION);
|
||||
|
||||
private:
|
||||
bool m_paused { false };
|
||||
|
|
@ -133,16 +136,16 @@ private:
|
|||
SharedLibrary m_self {};
|
||||
|
||||
public:
|
||||
DynamicLinkerHook () = default;
|
||||
~DynamicLinkerHook () = default;
|
||||
EntityLinkHook () = default;
|
||||
~EntityLinkHook () = default;
|
||||
|
||||
public:
|
||||
void initialize ();
|
||||
bool needsBypass () const;
|
||||
|
||||
SharedLibrary::Func lookup (SharedLibrary::Handle module, const char *function);
|
||||
SharedLibrary::Func lookupSymbol (SharedLibrary::Handle module, const char *function);
|
||||
|
||||
decltype (auto) close (SharedLibrary::Handle module) {
|
||||
decltype (auto) freeLibrary (SharedLibrary::Handle module) {
|
||||
if (m_self.handle () == module) {
|
||||
disable ();
|
||||
return m_dlclose (module);
|
||||
|
|
@ -177,15 +180,15 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
CR_FORCE_STACK_ALIGN static SharedLibrary::Func CR_STDCALL lookupHandler (SharedLibrary::Handle module, const char *function) {
|
||||
return instance ().lookup (module, function);
|
||||
CR_FORCE_STACK_ALIGN static SharedLibrary::Func CR_STDCALL lookupHandler (SharedLibrary::Handle handle, const char *function) {
|
||||
return instance ().lookupSymbol (handle, function);
|
||||
}
|
||||
|
||||
CR_FORCE_STACK_ALIGN static int CR_STDCALL closeHandler (SharedLibrary::Handle module) {
|
||||
return instance ().close (module);
|
||||
CR_FORCE_STACK_ALIGN static int CR_STDCALL closeHandler (SharedLibrary::Handle handle) {
|
||||
return instance ().freeLibrary (handle);
|
||||
}
|
||||
};
|
||||
|
||||
// expose global
|
||||
CR_EXPOSE_GLOBAL_SINGLETON (DynamicLinkerHook, entlink);
|
||||
CR_EXPOSE_GLOBAL_SINGLETON (EntityLinkHook, entlink);
|
||||
CR_EXPOSE_GLOBAL_SINGLETON (ServerQueryHook, fakequeries);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public:
|
|||
void kickEveryone (bool instant = false, bool zeroQuota = true);
|
||||
void kickBot (int index);
|
||||
void kickFromTeam (Team team, bool removeAll = false);
|
||||
void killAllBots (int team = -1, bool silent = false);
|
||||
void killAllBots (int team = Team::Invalid, bool silent = false);
|
||||
void maintainQuota ();
|
||||
void maintainAutoKill ();
|
||||
void maintainLeaders ();
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ public:
|
|||
bool load ();
|
||||
|
||||
// flush matrices to disk, so we will not rebuild them on load same map
|
||||
void save ();
|
||||
void save () const;
|
||||
|
||||
// do the pathfinding
|
||||
bool find (int srcIndex, int destIndex, NodeAdderFn onAddedNode, int *pathDistance = nullptr);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
public:
|
||||
// updates bot view frustum
|
||||
void calculate (Planes &planes, const Vector &viewAngle, const Vector &viewOffset);
|
||||
void calculate (Planes &planes, const Vector &viewAngle, const Vector &viewOffset) const;
|
||||
|
||||
// check if object inside frustum plane
|
||||
bool isObjectInsidePlane (const Plane &plane, const Vector ¢er, float height, float radius) const;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public:
|
|||
bool visible (int srcIndex, int destIndex, VisIndex vis = VisIndex::Any);
|
||||
|
||||
void load ();
|
||||
void save ();
|
||||
void save () const;
|
||||
void rebuild ();
|
||||
|
||||
public:
|
||||
|
|
|
|||
55
inc/yapb.h
55
inc/yapb.h
|
|
@ -225,6 +225,7 @@ private:
|
|||
int m_tryOpenDoor {}; // attempt's to open the door
|
||||
int m_liftState {}; // state of lift handling
|
||||
int m_radioSelect {}; // radio entry
|
||||
int m_radioPercent {}; // radio usage percent (in response)
|
||||
int m_killsCount {}; // the kills count of a bot
|
||||
|
||||
int m_lastPredictIndex {}; // last predicted path index
|
||||
|
|
@ -370,7 +371,7 @@ private:
|
|||
CountdownTimer m_repathTimer {}; // bots is going to repath his route
|
||||
|
||||
private:
|
||||
int pickBestWeapon (Array <int> &vec, int moneySave);
|
||||
int pickBestWeapon (Array <int> &vec, int moneySave) const;
|
||||
int getRandomCampDir ();
|
||||
int findAimingNode (const Vector &to, int &pathLength);
|
||||
int findNearestNode ();
|
||||
|
|
@ -382,18 +383,18 @@ private:
|
|||
int findGoalPost (int tactic, IntArray *defensive, IntArray *offensive);
|
||||
int bestPrimaryCarried ();
|
||||
int bestSecondaryCarried ();
|
||||
int bestGrenadeCarried ();
|
||||
int getBestOwnedWeapon ();
|
||||
int getBestOwnedPistol ();
|
||||
int bestGrenadeCarried () const;
|
||||
int getBestOwnedWeapon () const;
|
||||
int getBestOwnedPistol () const;
|
||||
int changeNodeIndex (int index);
|
||||
int numEnemiesNear (const Vector &origin, const float radius);
|
||||
int numFriendsNear (const Vector &origin, const float radius);
|
||||
int numEnemiesNear (const Vector &origin, const float radius) const;
|
||||
int numFriendsNear (const Vector &origin, const float radius) const;
|
||||
|
||||
float getBombTimeleft () const;
|
||||
float getEstimatedNodeReachTime ();
|
||||
float isInFOV (const Vector &dest);
|
||||
float isInFOV (const Vector &dest) const;
|
||||
float getShiftSpeed ();
|
||||
float calculateScaleFactor (edict_t *ent);
|
||||
float calculateScaleFactor (edict_t *ent) const;
|
||||
|
||||
bool canReplaceWeapon ();
|
||||
bool canDuckUnder (const Vector &normal);
|
||||
|
|
@ -418,14 +419,14 @@ private:
|
|||
bool seesEnemy (edict_t *player);
|
||||
bool hasActiveGoal ();
|
||||
bool advanceMovement ();
|
||||
bool isBombDefusing (const Vector &bombOrigin);
|
||||
bool isBombDefusing (const Vector &bombOrigin) const;
|
||||
bool isOccupiedNode (int index, bool needZeroVelocity = false);
|
||||
bool seesItem (const Vector &dest, StringRef classname);
|
||||
bool lastEnemyShootable ();
|
||||
bool rateGroundWeapon (edict_t *ent);
|
||||
bool reactOnEnemy ();
|
||||
bool selectBestNextNode ();
|
||||
bool hasAnyWeapons ();
|
||||
bool hasAnyWeapons () const;
|
||||
bool hasAnyAmmoInClip ();
|
||||
bool isKnifeMode ();
|
||||
bool isGrenadeWar ();
|
||||
|
|
@ -439,13 +440,13 @@ private:
|
|||
bool isEnemyHidden (edict_t *enemy);
|
||||
bool isEnemyInvincible (edict_t *enemy);
|
||||
bool isEnemyNoTarget (edict_t *enemy);
|
||||
bool isEnemyInDarkArea (edict_t *enemy);
|
||||
bool isFriendInLineOfFire (float distance);
|
||||
bool isEnemyInDarkArea (edict_t *enemy) const;
|
||||
bool isFriendInLineOfFire (float distance) const;
|
||||
bool isGroupOfEnemies (const Vector &location);
|
||||
bool isPenetrableObstacle (const Vector &dest);
|
||||
bool isPenetrableObstacle1 (const Vector &dest, int penetratePower);
|
||||
bool isPenetrableObstacle2 (const Vector &dest, int penetratePower);
|
||||
bool isPenetrableObstacle3 (const Vector &dest, int penetratePower);
|
||||
bool isPenetrableObstacle1 (const Vector &dest, int penetratePower) const;
|
||||
bool isPenetrableObstacle2 (const Vector &dest, int penetratePower) const;
|
||||
bool isPenetrableObstacle3 (const Vector &dest, int penetratePower) const;
|
||||
bool isEnemyBehindShield (edict_t *enemy);
|
||||
bool checkChatKeywords (String &reply);
|
||||
bool isReplyingToChat ();
|
||||
|
|
@ -455,13 +456,13 @@ private:
|
|||
bool canRunHeavyWeight ();
|
||||
bool isEnemyInSight (Vector &endPos);
|
||||
bool isEnemyNoticeable (float range);
|
||||
bool isCreature ();
|
||||
bool isPreviousLadder ();
|
||||
bool isCreature () const;
|
||||
bool isPreviousLadder () const;
|
||||
bool isIgnoredItem (edict_t *ent);
|
||||
|
||||
void doPlayerAvoidance (const Vector &normal);
|
||||
void selectCampButtons (int index);
|
||||
void instantChatter (int type);
|
||||
void instantChatter (int type) const;
|
||||
void update ();
|
||||
void runMovement ();
|
||||
void checkSpawnConditions ();
|
||||
|
|
@ -488,7 +489,7 @@ private:
|
|||
void checkFall ();
|
||||
void checkDarkness ();
|
||||
void checkParachute ();
|
||||
void updatePracticeValue (int damage);
|
||||
void updatePracticeValue (int damage) const;
|
||||
void updatePracticeDamage (edict_t *attacker, int damage);
|
||||
void findShortestPath (int srcIndex, int destIndex);
|
||||
void findPath (int srcIndex, int destIndex, FindPath pathType = FindPath::Fast);
|
||||
|
|
@ -563,9 +564,9 @@ private:
|
|||
Vector isBombAudible ();
|
||||
Vector getBodyOffsetError (float distance);
|
||||
Vector getCampDirection (const Vector &dest);
|
||||
Vector getCustomHeight (float distance);
|
||||
Vector getCustomHeight (float distance) const;
|
||||
|
||||
uint8_t computeMsec ();
|
||||
uint8_t computeMsec () const;
|
||||
|
||||
private:
|
||||
bool isOnLadder () const {
|
||||
|
|
@ -735,7 +736,7 @@ public:
|
|||
void pushMsgQueue (int message);
|
||||
void prepareChatMessage (StringRef message);
|
||||
void checkForChat ();
|
||||
void showChatterIcon (bool show, bool disconnect = false);
|
||||
void showChatterIcon (bool show, bool disconnect = false) const;
|
||||
void clearSearchNodes ();
|
||||
void checkBreakable (edict_t *touch);
|
||||
void checkBreakablesAround ();
|
||||
|
|
@ -757,16 +758,16 @@ public:
|
|||
void sendBotToOrigin (const Vector &origin);
|
||||
void markStale ();
|
||||
bool hasHostage ();
|
||||
bool hasPrimaryWeapon ();
|
||||
bool hasSecondaryWeapon ();
|
||||
bool hasPrimaryWeapon () const;
|
||||
bool hasSecondaryWeapon () const;
|
||||
bool hasShield ();
|
||||
bool isShieldDrawn ();
|
||||
bool findNextBestNode ();
|
||||
bool findNextBestNodeEx (const IntArray &data, bool handleFails);
|
||||
bool seesEntity (const Vector &dest, bool fromBody = false);
|
||||
|
||||
int getAmmo ();
|
||||
int getAmmo (int id);
|
||||
int getAmmo () const;
|
||||
int getAmmo (int id) const;
|
||||
int getNearestToPlantedBomb ();
|
||||
|
||||
float getConnectionTime ();
|
||||
|
|
@ -793,7 +794,7 @@ public:
|
|||
return getTask ()->id;
|
||||
}
|
||||
|
||||
edict_t *ent () {
|
||||
edict_t *ent () const {
|
||||
return pev->pContainingEntity;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue