improved sniping
fixed bots never choice camping tactic, due to agression level oveflow cosmetic changes
This commit is contained in:
parent
363b430c41
commit
9e5c1540f9
13 changed files with 336 additions and 310 deletions
157
include/core.h
157
include/core.h
|
|
@ -18,155 +18,7 @@
|
|||
|
||||
using namespace Math;
|
||||
|
||||
// detects the build platform
|
||||
#if defined (__linux__) || defined (__debian__) || defined (__linux)
|
||||
#define PLATFORM_LINUX 1
|
||||
#elif defined (__APPLE__)
|
||||
#define PLATFORM_OSX 1
|
||||
#elif defined (_WIN32)
|
||||
#define PLATFORM_WIN32 1
|
||||
#endif
|
||||
|
||||
// detects the compiler
|
||||
#if defined (_MSC_VER)
|
||||
#define COMPILER_VISUALC _MSC_VER
|
||||
#elif defined (__MINGW32__)
|
||||
#define COMPILER_MINGW32 __MINGW32__
|
||||
#endif
|
||||
|
||||
// configure export macros
|
||||
#if defined (COMPILER_VISUALC) || defined (COMPILER_MINGW32)
|
||||
#define export extern "C" __declspec (dllexport)
|
||||
#elif defined (PLATFORM_LINUX) || defined (PLATFORM_OSX)
|
||||
#define export extern "C" __attribute__((visibility("default")))
|
||||
#else
|
||||
#error "Can't configure export macros. Compiler unrecognized."
|
||||
#endif
|
||||
|
||||
// operating system specific macros, functions and typedefs
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
||||
#include <direct.h>
|
||||
|
||||
#define DLL_ENTRYPOINT int STDCALL DllMain (HINSTANCE, DWORD dwReason, LPVOID)
|
||||
#define DLL_DETACHING (dwReason == DLL_PROCESS_DETACH)
|
||||
#define DLL_RETENTRY return TRUE
|
||||
|
||||
#if defined (COMPILER_VISUALC)
|
||||
#define DLL_GIVEFNPTRSTODLL extern "C" void STDCALL
|
||||
#elif defined (COMPILER_MINGW32)
|
||||
#define DLL_GIVEFNPTRSTODLL export void STDCALL
|
||||
#endif
|
||||
|
||||
// specify export parameter
|
||||
#if defined (COMPILER_VISUALC) && (COMPILER_VISUALC > 1000)
|
||||
#pragma comment (linker, "/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1")
|
||||
#pragma comment (linker, "/SECTION:.data,RW")
|
||||
#endif
|
||||
|
||||
typedef int (FAR *EntityAPI_t) (gamefuncs_t *, int);
|
||||
typedef int (FAR *NewEntityAPI_t) (newgamefuncs_t *, int *);
|
||||
typedef int (FAR *BlendAPI_t) (int, void **, void *, float (*)[3][4], float (*)[128][3][4]);
|
||||
typedef void (STDCALL *FuncPointers_t) (enginefuncs_t *, globalvars_t *);
|
||||
typedef void (FAR *EntityPtr_t) (entvars_t *);
|
||||
|
||||
#elif defined (PLATFORM_LINUX) || defined (PLATFORM_OSX)
|
||||
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#define DLL_ENTRYPOINT __attribute__((destructor)) void _fini (void)
|
||||
#define DLL_DETACHING TRUE
|
||||
#define DLL_RETENTRY return
|
||||
#define DLL_GIVEFNPTRSTODLL extern "C" void __attribute__((visibility("default")))
|
||||
|
||||
#if defined (__ANDROID__)
|
||||
#define PLATFORM_ANDROID 1
|
||||
#endif
|
||||
|
||||
typedef int (*EntityAPI_t) (gamefuncs_t *, int);
|
||||
typedef int (*NewEntityAPI_t) (newgamefuncs_t *, int *);
|
||||
typedef int (*BlendAPI_t) (int, void **, void *, float (*)[3][4], float (*)[128][3][4]);
|
||||
typedef void (*FuncPointers_t) (enginefuncs_t *, globalvars_t *);
|
||||
typedef void (*EntityPtr_t) (entvars_t *);
|
||||
|
||||
#else
|
||||
#error "Platform unrecognized."
|
||||
#endif
|
||||
|
||||
// library wrapper
|
||||
class Library
|
||||
{
|
||||
private:
|
||||
void *m_ptr;
|
||||
|
||||
public:
|
||||
|
||||
Library (const char *fileName)
|
||||
{
|
||||
m_ptr = NULL;
|
||||
|
||||
if (fileName == NULL)
|
||||
return;
|
||||
|
||||
LoadLib (fileName);
|
||||
}
|
||||
|
||||
~Library (void)
|
||||
{
|
||||
if (!IsLoaded ())
|
||||
return;
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
FreeLibrary ((HMODULE) m_ptr);
|
||||
#else
|
||||
dlclose (m_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
inline void *LoadLib (const char *fileName)
|
||||
{
|
||||
#ifdef PLATFORM_WIN32
|
||||
m_ptr = LoadLibrary (fileName);
|
||||
#else
|
||||
m_ptr = dlopen (fileName, RTLD_NOW);
|
||||
#endif
|
||||
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
template <typename R> R GetFuncAddr (const char *function)
|
||||
{
|
||||
if (!IsLoaded ())
|
||||
return NULL;
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
return reinterpret_cast <R> (GetProcAddress (static_cast <HMODULE> (m_ptr), function));
|
||||
#else
|
||||
return reinterpret_cast <R> (dlsym (m_ptr, function));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename R> R GetHandle (void)
|
||||
{
|
||||
return (R) m_ptr;
|
||||
}
|
||||
|
||||
inline bool IsLoaded (void) const
|
||||
{
|
||||
return m_ptr != NULL;
|
||||
}
|
||||
};
|
||||
#include "platform.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
|
@ -258,9 +110,9 @@ enum CollisionState
|
|||
// counter-strike team id's
|
||||
enum Team
|
||||
{
|
||||
TEAM_TF = 0,
|
||||
TEAM_CF,
|
||||
TEAM_SPEC
|
||||
TERRORIST = 0,
|
||||
CT,
|
||||
SPECTATOR
|
||||
};
|
||||
|
||||
// client flags
|
||||
|
|
@ -1362,6 +1214,7 @@ private:
|
|||
float m_maintainTime; // time to maintain bot creation
|
||||
float m_quotaMaintainTime; // time to maintain bot quota
|
||||
int m_lastWinner; // the team who won previous round
|
||||
int m_balanceCount; // limit of bots to add
|
||||
|
||||
bool m_economicsGood[2]; // is team able to buy anything
|
||||
bool m_deathMsgSent; // for fakeping
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue