analyze: allow to disable goal marking analyze: add cvars descriptions and bounds nav: added optional post path smoothing for astar algorithm nav: now bots will use Dijkstra algo instead of floyd-warshall if memory usage too high (controlled via yb_path_floyd_memory_limit cvar) (fixes #434) nav: vistable are now calculated every frame to prevent game-freeze during loading the game (fixes #434) graph: pracrice reworked to hash table so memory footprint is as low as possible (at cost 5-10% performance loss on practice) (fixes #434) control: bots commands now is case-insensitive bot: major refactoring of bot's code nav: issue warnings about path fail only with debug practice: check for visibility when updating danger index analyzer: suspend any analyzing on change level control: add kickall_ct/kickall_t nav: increase blocked distance in stuck check
128 lines
2.9 KiB
C++
128 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
|