some optimizations

This commit is contained in:
jeefo 2014-09-17 20:36:42 +04:00
commit 1fa0acf472
17 changed files with 146 additions and 130 deletions

View file

@ -972,7 +972,6 @@ private:
float m_randomizeAnglesTime; // time last randomized location
float m_playerTargetTime; // time last targeting
void SwitchChatterIcon (bool show);
void InstantChatterMessage (int type);
void BotAI (void);
void CheckSpawnTimeConditions (void);
@ -1136,6 +1135,7 @@ public:
bool m_buyingFinished; // done with buying
bool m_buyPending; // bot buy is pending
bool m_hasDefuser; // does bot has defuser
bool m_hasC4; // does bot has c4 bomb
bool m_hasProgressBar; // has progress bar on a HUD
bool m_jumpReady; // is double jump ready
bool m_canChooseAimDirection; // can choose aiming direction
@ -1212,7 +1212,7 @@ public:
inline edict_t *GetEntity (void) { return ENT (pev); };
inline EOFFSET GetOffset (void) { return OFFSET (pev); };
inline int GetIndex (void) { return ENTINDEX (GetEntity ()); };
int GetIndex (void);
inline Vector Center (void) { return (pev->absmax + pev->absmin) * 0.5; };
inline Vector EyePosition (void) { return pev->origin + pev->view_ofs; };
@ -1225,6 +1225,7 @@ public:
bool FindWaypoint (void);
bool EntityIsVisible (const Vector &dest, bool fromBody = false);
void SwitchChatterIcon (bool show);
void DeleteSearchNodes (void);
void RemoveCertainTask (TaskId_t id);
@ -1260,6 +1261,7 @@ public:
bool UsesSubmachineGun (void);
bool UsesZoomableRifle (void);
bool UsesBadPrimary (void);
bool UsesCampGun (void);
bool HasPrimaryWeapon (void);
bool HasSecondaryWeapon(void);
bool HasShield (void);
@ -1654,24 +1656,6 @@ extern void DecalTrace (entvars_t *pev, TraceResult *trace, int logotypeIndex);
extern void SoundAttachToThreat (edict_t *ent, const char *sample, float volume);
extern void SoundSimulateUpdate (int playerIndex);
static inline bool IsNullString (const char *input)
{
if (input == NULL)
return true;
return *input == '\0';
}
static inline float GetWorldTime (void)
{
return g_pGlobals->time;
}
static inline int GetMaxClients (void)
{
return g_pGlobals->maxClients;
}
// very global convars
extern ConVar yb_jasonmode;
extern ConVar yb_communication_type;
@ -1681,4 +1665,9 @@ extern ConVar yb_ignore_enemies;
#include <globals.h>
#include <compress.h>
#include <resource.h>
#include <resource.h>
inline int Bot::GetIndex (void)
{
return IndexOfEntity (GetEntity ());
}

View file

@ -230,7 +230,7 @@ typedef struct enginefuncs_s
void (*pfnSetPhysicsKeyValue) (const edict_t *client, const char *key, const char *value);
const char *(*pfnGetPhysicsInfoString) (const edict_t *client);
unsigned short (*pfnPrecacheEvent) (int type, const char *psz);
void (*pfnPlaybackEvent) (int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
void (*pfnPlaybackEvent) (int flags, const edict_t *pInvoker, unsigned short evIndexOfEntity, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
unsigned char *(*pfnSetFatPVS) (float *org);
unsigned char *(*pfnSetFatPAS) (float *org);
int (*pfnCheckVisibility) (const edict_t *entity, unsigned char *pset);

View file

@ -129,14 +129,7 @@ static inline entvars_t *VARS (EOFFSET eoffset)
{
return VARS (ENT (eoffset));
}
static inline int ENTINDEX (edict_t *ent)
{
return (*g_engfuncs.pfnIndexOfEdict) (ent);
}
static inline edict_t *INDEXENT (int iEdictNum)
{
return (*g_engfuncs.pfnPEntityOfEntIndex) (iEdictNum);
}
static inline void MESSAGE_BEGIN (int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent)
{
(*g_engfuncs.pfnMessageBegin) (msg_dest, msg_type, pOrigin, ENT (ent));

View file

@ -83,4 +83,32 @@ extern gamefuncs_t g_functionTable;
extern EntityAPI_t g_entityAPI;
extern FuncPointers_t g_funcPointers;
extern NewEntityAPI_t g_getNewEntityAPI;
extern BlendAPI_t g_serverBlendingAPI;
extern BlendAPI_t g_serverBlendingAPI;
static inline bool IsNullString (const char *input)
{
if (input == NULL)
return true;
return *input == '\0';
}
static inline float GetWorldTime (void)
{
return g_pGlobals->time;
}
static inline int GetMaxClients (void)
{
return g_pGlobals->maxClients;
}
static inline edict_t *EntityOfIndex (const int index)
{
return static_cast <edict_t *> (g_worldEdict + index);
};
inline int IndexOfEntity (const edict_t *ent)
{
return static_cast <int> (ent - g_worldEdict);
};

View file

@ -19,7 +19,7 @@
#define PRODUCT_DESCRIPTION PRODUCT_NAME " v" PRODUCT_VERSION " - The Counter-Strike 1.6 Bot"
#define PRODUCT_COPYRIGHT "Copyright © 2014, by " PRODUCT_AUTHOR
#define PRODUCT_LEGAL "Half-Life, Counter-Strike, Counter-Strike: Condition Zero, Steam, Valve is a trademark of Valve Corporation"
#define PRODUCT_ORIGINAL_NAME "yapb_.dll"
#define PRODUCT_ORIGINAL_NAME "yapb.dll"
#define PRODUCT_INTERNAL_NAME "podbot"
#define PRODUCT_VERSION_DWORD 2,6,0 // major version, minor version, WIP (or Update) version, BUILD number (generated with RES file)
#define PRODUCT_SUPPORT_VERSION "1.4 - CZ"