yapb-noob-edition/ext/hlsdk/extdll.h
jeefo a616f25b1a
bot: implemented asynchronous pathfinding
nav: floyd-warshall matrices and practice updates are done asynchronously by now
add: yb_threadpool_workers cvar, that controls number of worker threads bot will use
add: cv_autovacate_keep_slots, the amount of slots to keep by auto vacate
aim: enemy prediction is now done asynchronously by now
bot: minor fixes and refactoring, including analyze suspend mistake (ref #441)

note: the master builds are now NOT production ready, please test before installing on real servers!
2023-05-06 20:14:03 +03:00

126 lines
2.9 KiB
C++

/***
*
* Copyright (c) 1999-2005, Valve Corporation. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* This source code contains proprietary and confidential information of
* Valve LLC and its suppliers. Access to this code is restricted to
* persons who have executed a written SDK license with Valve. Any access,
* use or distribution of this code by or to any unlicensed person is illegal.
*
****/
#ifndef EXTDLL_H
#define EXTDLL_H
typedef int func_t; //
typedef float vec_t; // needed before including progdefs.h
typedef vec_t vec2_t[2];
typedef vec_t vec4_t[4];
typedef int qboolean;
typedef unsigned char byte;
#include <crlib/vector.h>
#include <crlib/string.h>
#if defined (CR_ARCH_X64)
using estring_t = int32_t;
#else
using estring_t = uint32_t;
#endif
// idea from regamedll
class string_t final : public cr::DenyCopying {
private:
estring_t offset;
public:
explicit string_t () : offset (0) {}
string_t (int offset) : offset (offset) {}
~string_t () = default;
public:
const char *chars (estring_t shift = 0) const;
public:
operator estring_t () const {
return offset;
}
string_t &operator = (const string_t &rhs) {
offset = rhs.offset;
return *this;
}
};
typedef cr::Vector vec3_t;
typedef struct edict_s edict_t;
#include "const.h"
#include "progdefs.h"
#include "model.h"
typedef struct link_s {
struct link_s *prev, *next;
} link_t;
typedef struct {
vec3_t normal;
float dist;
} plane_t;
struct edict_s {
int free;
int serialnumber;
link_t area; // linked to a division node or leaf
int headnode; // -1 to use normal leaf check
int num_leafs;
short leafnums[MAX_ENT_LEAFS];
float freetime; // sv.time when the object was freed
void *pvPrivateData; // Alloced and freed by engine, used by DLLs
entvars_t v; // C exported fields from progs
};
#include "eiface.h"
extern globalvars_t *globals;
extern enginefuncs_t engfuncs;
extern gamefuncs_t dllapi;
// Use this instead of ALLOC_STRING on constant strings
static inline const char *STRING (estring_t offset) {
return globals->pStringBase + offset;
}
// form fwgs-hlsdk
#if defined (CR_ARCH_X64)
static inline int MAKE_STRING (const char *val) {
long long ptrdiff = val - STRING (0);
if (ptrdiff > INT_MAX || ptrdiff < INT_MIN) {
return engfuncs.pfnAllocString (val);
}
return static_cast <int> (ptrdiff);
}
#else
static inline estring_t MAKE_STRING (const char *str) {
return static_cast <estring_t> (reinterpret_cast <uint64_t> (str) - reinterpret_cast <uint64_t> (globals->pStringBase));
}
#endif
inline const char *string_t::chars (estring_t shift) const {
auto result = STRING (offset);
return cr::strings.isEmpty (result) ? &cr::kNullChar : (result + shift);
}
enum HLBool : int32_t {
HLFalse, HLTrue
};
#endif // EXTDLL_H