mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-02-23 20:41:11 +00:00
updated botlib.h
This commit is contained in:
parent
881df8c239
commit
e921ee5039
2 changed files with 314 additions and 282 deletions
|
@ -22,8 +22,8 @@
|
|||
#include "be_aas.h"
|
||||
#include "botlib.h"
|
||||
|
||||
//some maxs
|
||||
#define MAX_NETNAME 36
|
||||
//some maxs
|
||||
#define MAX_NETNAME 36
|
||||
#define MAX_FILEPATH 144
|
||||
|
||||
//#define DEBUG
|
||||
|
@ -40,7 +40,7 @@ typedef enum {
|
|||
BFL_AVOIDRIGHT = 16, //!<avoid obstacles by going to the right
|
||||
BFL_IDEALVIEWSET = 32, //!<bot has ideal view angles set
|
||||
BFL_FIGHTSUICIDAL = 64 //!<bot is in a suicidal fight
|
||||
} BFL;
|
||||
} AI_main_BFL;
|
||||
|
||||
//long term goal types
|
||||
typedef enum {
|
||||
|
@ -55,7 +55,7 @@ typedef enum {
|
|||
LTG_PATROL, //!<patrol
|
||||
LTG_GETITEM, //!<get an item
|
||||
LTG_KILL //!<kill someone
|
||||
} LTG;
|
||||
} AI_main_LTG;
|
||||
|
||||
//some goal dedication times
|
||||
#define TEAM_HELP_TIME 10 //!<1 minute teamplay help time
|
||||
|
@ -250,47 +250,47 @@ int32_t AI_main_BotAIGetSnapshotEntity(int32_t clientNum, int32_t sequence, enti
|
|||
|
||||
int32_t AI_main_BotTeamLeader(bot_state_t *bs);
|
||||
|
||||
/**
|
||||
* Setup bot AI.
|
||||
*
|
||||
* \param restart Determines if this is a map restart.
|
||||
*/
|
||||
int32_t AI_main_BotAISetup(int32_t restart);
|
||||
/**
|
||||
* Setup bot AI.
|
||||
*
|
||||
* \param restart Determines if this is a map restart.
|
||||
*/
|
||||
int32_t AI_main_BotAISetup(int32_t restart);
|
||||
|
||||
/**
|
||||
* Shutdown bot AI.
|
||||
*
|
||||
* \param restart Determines if this is a map restart.
|
||||
*/
|
||||
/**
|
||||
* Shutdown bot AI.
|
||||
*
|
||||
* \param restart Determines if this is a map restart.
|
||||
*/
|
||||
int32_t AI_main_BotAIShutdown(int32_t restart);
|
||||
|
||||
/**
|
||||
* Load map in bot lib.
|
||||
*
|
||||
* \param restart Determines if this is a map restart.
|
||||
*/
|
||||
int32_t AI_main_BotAILoadMap(int32_t restart);
|
||||
/**
|
||||
* Load map in bot lib.
|
||||
*
|
||||
* \param restart Determines if this is a map restart.
|
||||
*/
|
||||
int32_t AI_main_BotAILoadMap(int32_t restart);
|
||||
|
||||
/**
|
||||
* Setup bot AI for client.
|
||||
*
|
||||
* \param client client number
|
||||
* \param settings bot settings
|
||||
*/
|
||||
int32_t AI_main_BotAISetupClient(int32_t client, bot_settings_t* settings);
|
||||
|
||||
/**
|
||||
* Shutdown bot client.
|
||||
*
|
||||
* \param client client number
|
||||
*/
|
||||
int32_t AI_main_BotAIShutdownClient(int32_t client);
|
||||
|
||||
/**
|
||||
* Star frame.
|
||||
*
|
||||
* \param time current time
|
||||
*/
|
||||
/**
|
||||
* Setup bot AI for client.
|
||||
*
|
||||
* \param client client number
|
||||
* \param settings bot settings
|
||||
*/
|
||||
int32_t AI_main_BotAISetupClient(int32_t client, bot_settings_t* settings);
|
||||
|
||||
/**
|
||||
* Shutdown bot client.
|
||||
*
|
||||
* \param client client number
|
||||
*/
|
||||
int32_t AI_main_BotAIShutdownClient(int32_t client);
|
||||
|
||||
/**
|
||||
* Star frame.
|
||||
*
|
||||
* \param time current time
|
||||
*/
|
||||
int32_t AI_main_BotAIStartFrame(int32_t time);
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* desc: bot AI library
|
||||
*
|
||||
* $Archive: /StarTrek/Code-DM/game/botlib.h $
|
||||
* $Author: Mgummelt $
|
||||
* $Author: Mgummelt $
|
||||
* $Revision: 4 $
|
||||
* $Modtime: 3/12/01 3:08p $
|
||||
* $Date: 3/12/01 4:43p $
|
||||
|
@ -29,67 +29,74 @@ struct weaponinfo_s;
|
|||
|
||||
//debug line colors
|
||||
#define LINECOLOR_NONE -1
|
||||
#define LINECOLOR_RED 1//0xf2f2f0f0L
|
||||
#define LINECOLOR_GREEN 2//0xd0d1d2d3L
|
||||
#define LINECOLOR_BLUE 3//0xf3f3f1f1L
|
||||
#define LINECOLOR_YELLOW 4//0xdcdddedfL
|
||||
#define LINECOLOR_ORANGE 5//0xe0e1e2e3L
|
||||
#define LINECOLOR_RED 1 //0xf2f2f0f0L
|
||||
#define LINECOLOR_GREEN 2 //0xd0d1d2d3L
|
||||
#define LINECOLOR_BLUE 3 //0xf3f3f1f1L
|
||||
#define LINECOLOR_YELLOW 4 //0xdcdddedfL
|
||||
#define LINECOLOR_ORANGE 5 //0xe0e1e2e3L
|
||||
|
||||
//Print types
|
||||
#define PRT_MESSAGE 1
|
||||
#define PRT_WARNING 2
|
||||
#define PRT_ERROR 3
|
||||
#define PRT_FATAL 4
|
||||
#define PRT_EXIT 5
|
||||
typedef enum {
|
||||
PRT_MESSAGE = 1,
|
||||
PRT_WARNING,
|
||||
PRT_ERROR,
|
||||
PRT_FATAL,
|
||||
PRT_EXIT
|
||||
} botlib_PrintType;
|
||||
|
||||
//console message types
|
||||
#define CMS_NORMAL 0
|
||||
#define CMS_CHAT 1
|
||||
typedef enum {
|
||||
CMS_NORMAL,
|
||||
CMS_CHAT
|
||||
} botlib_ConsoleMessageTpye;
|
||||
|
||||
//botlib error codes
|
||||
#define BLERR_NOERROR 0 //!<no error
|
||||
#define BLERR_LIBRARYNOTSETUP 1 //!<library not setup
|
||||
#define BLERR_INVALIDENTITYNUMBER 2 //!<invalid entity number
|
||||
#define BLERR_NOAASFILE 3 //!<no AAS file available
|
||||
#define BLERR_CANNOTOPENAASFILE 4 //!<cannot open AAS file
|
||||
#define BLERR_WRONGAASFILEID 5 //!<incorrect AAS file id
|
||||
#define BLERR_WRONGAASFILEVERSION 6 //!<incorrect AAS file version
|
||||
#define BLERR_CANNOTREADAASLUMP 7 //!<cannot read AAS file lump
|
||||
#define BLERR_CANNOTLOADICHAT 8 //!<cannot load initial chats
|
||||
#define BLERR_CANNOTLOADITEMWEIGHTS 9 //!<cannot load item weights
|
||||
#define BLERR_CANNOTLOADITEMCONFIG 10 //!<cannot load item config
|
||||
#define BLERR_CANNOTLOADWEAPONWEIGHTS 11 //!<cannot load weapon weights
|
||||
#define BLERR_CANNOTLOADWEAPONCONFIG 12 //!<cannot load weapon config
|
||||
typedef enum {
|
||||
BLERR_NOERROR, //!<no error
|
||||
BLERR_LIBRARYNOTSETUP, //!<library not setup
|
||||
BLERR_INVALIDENTITYNUMBER, //!<invalid entity number
|
||||
BLERR_NOAASFILE, //!<no AAS file available
|
||||
BLERR_CANNOTOPENAASFILE, //!<cannot open AAS file
|
||||
BLERR_WRONGAASFILEID, //!<incorrect AAS file id
|
||||
BLERR_WRONGAASFILEVERSION, //!<incorrect AAS file version
|
||||
BLERR_CANNOTREADAASLUMP, //!<cannot read AAS file lump
|
||||
BLERR_CANNOTLOADICHAT, //!<cannot load initial chats
|
||||
BLERR_CANNOTLOADITEMWEIGHTS, //!<cannot load item weights
|
||||
BLERR_CANNOTLOADITEMCONFIG, //!<cannot load item config
|
||||
BLERR_CANNOTLOADWEAPONWEIGHTS, //!<cannot load weapon weights
|
||||
BLERR_CANNOTLOADWEAPONCONFIG, //!<cannot load weapon config
|
||||
} botlib_ErrorCode;
|
||||
|
||||
//action flags
|
||||
#define ACTION_ATTACK 1
|
||||
#define ACTION_USE 2
|
||||
#define ACTION_RESPAWN 4
|
||||
#define ACTION_JUMP 8
|
||||
#define ACTION_MOVEUP 8
|
||||
#define ACTION_CROUCH 16
|
||||
#define ACTION_MOVEDOWN 16
|
||||
#define ACTION_MOVEFORWARD 32
|
||||
#define ACTION_MOVEBACK 64
|
||||
#define ACTION_MOVELEFT 128
|
||||
#define ACTION_MOVERIGHT 256
|
||||
#define ACTION_DELAYEDJUMP 512
|
||||
#define ACTION_TALK 1024
|
||||
#define ACTION_GESTURE 2048
|
||||
#define ACTION_WALK 4096
|
||||
#define ACTION_ALT_ATTACK 8192
|
||||
typedef enum {
|
||||
ACTION_ATTACK = 1,
|
||||
ACTION_USE = 2,
|
||||
ACTION_RESPAWN = 4,
|
||||
ACTION_JUMP = 8,
|
||||
ACTION_MOVEUP = 8,
|
||||
ACTION_CROUCH = 16,
|
||||
ACTION_MOVEDOWN = 16,
|
||||
ACTION_MOVEFORWARD = 32,
|
||||
ACTION_MOVEBACK = 64,
|
||||
ACTION_MOVELEFT = 128,
|
||||
ACTION_MOVERIGHT = 256,
|
||||
ACTION_DELAYEDJUMP = 512,
|
||||
ACTION_TALK = 1024,
|
||||
ACTION_GESTURE = 2048,
|
||||
ACTION_WALK = 4096,
|
||||
ACTION_ALT_ATTACK = 8192
|
||||
} botlib_ActionFlag;
|
||||
|
||||
/**
|
||||
* the bot input, will be converted to an usercmd_t
|
||||
*/
|
||||
typedef struct bot_input_s
|
||||
{
|
||||
float thinktime; //!<time since last output (in seconds)
|
||||
typedef struct bot_input_s {
|
||||
double thinktime; //!<time since last output (in seconds)
|
||||
vec3_t dir; //!<movement direction
|
||||
float speed; //!<speed in the range [0, 400]
|
||||
double speed; //!<speed in the range [0, 400]
|
||||
vec3_t viewangles; //!<the view angles
|
||||
int actionflags; //!<one of the ACTION_? flags
|
||||
int weapon; //!<weapon to use
|
||||
int32_t actionflags; //!<one of the ACTION_? flags
|
||||
int32_t weapon; //!<weapon to use
|
||||
} bot_input_t;
|
||||
|
||||
#ifndef BSPTRACE
|
||||
|
@ -99,29 +106,27 @@ typedef struct bot_input_s
|
|||
/**
|
||||
* bsp_trace_t hit surface
|
||||
*/
|
||||
typedef struct bsp_surface_s
|
||||
{
|
||||
typedef struct bsp_surface_s {
|
||||
char name[16];
|
||||
int flags;
|
||||
int value;
|
||||
int32_t flags;
|
||||
int32_t value;
|
||||
} bsp_surface_t;
|
||||
|
||||
//remove the bsp_trace_s structure definition l8r on
|
||||
/**
|
||||
* a trace is returned when a box is swept through the world
|
||||
*/
|
||||
typedef struct bsp_trace_s
|
||||
{
|
||||
typedef struct bsp_trace_s {
|
||||
qboolean allsolid; //!< if true, plane is not valid
|
||||
qboolean startsolid; //!< if true, the initial point was in a solid area
|
||||
float fraction; //!< time completed, 1.0 = didn't hit anything
|
||||
double fraction; //!< time completed, 1.0 = didn't hit anything
|
||||
vec3_t endpos; //!< final position
|
||||
cplane_t plane; //!< surface normal at impact
|
||||
float exp_dist; //!< expanded plane distance
|
||||
int sidenum; //!< number of the brush side hit
|
||||
double exp_dist; //!< expanded plane distance
|
||||
int32_t sidenum; //!< number of the brush side hit
|
||||
bsp_surface_t surface; //!< the hit point surface
|
||||
int contents; //!< contents on other side of surface hit
|
||||
int ent; //!< number of entity hit
|
||||
int32_t contents; //!< contents on other side of surface hit
|
||||
int32_t ent; //!< number of entity hit
|
||||
} bsp_trace_t;
|
||||
|
||||
#endif // BSPTRACE
|
||||
|
@ -129,289 +134,316 @@ typedef struct bsp_trace_s
|
|||
/**
|
||||
* entitystate for bots
|
||||
*/
|
||||
typedef struct bot_entitystate_s
|
||||
{
|
||||
int type; // entity type
|
||||
int flags; // entity flags
|
||||
typedef struct bot_entitystate_s {
|
||||
int32_t type; // entity type
|
||||
int32_t flags; // entity flags
|
||||
vec3_t origin; // origin of the entity
|
||||
vec3_t angles; // angles of the model
|
||||
vec3_t old_origin; // for lerping
|
||||
vec3_t mins; // bounding box minimums
|
||||
vec3_t maxs; // bounding box maximums
|
||||
int groundent; // ground entity
|
||||
int solid; // solid type
|
||||
int modelindex; // model used
|
||||
int modelindex2; // weapons, CTF flags, etc
|
||||
int frame; // model frame number
|
||||
int event; // impulse events -- muzzle flashes, footsteps, etc
|
||||
int eventParm; // even parameter
|
||||
int powerups; // bit flags
|
||||
int weapon; // determines weapon and flash model, etc
|
||||
int legsAnim; // mask off ANIM_TOGGLEBIT
|
||||
int torsoAnim; // mask off ANIM_TOGGLEBIT
|
||||
int32_t groundent; // ground entity
|
||||
int32_t solid; // solid type
|
||||
int32_t modelindex; // model used
|
||||
int32_t modelindex2; // weapons, CTF flags, etc
|
||||
int32_t frame; // model frame number
|
||||
int32_t event; // impulse events -- muzzle flashes, footsteps, etc
|
||||
int32_t eventParm; // even parameter
|
||||
int32_t powerups; // bit flags
|
||||
int32_t weapon; // determines weapon and flash model, etc
|
||||
int32_t legsAnim; // mask off ANIM_TOGGLEBIT
|
||||
int32_t torsoAnim; // mask off ANIM_TOGGLEBIT
|
||||
} bot_entitystate_t;
|
||||
|
||||
/**
|
||||
* bot AI library exported functions
|
||||
*/
|
||||
typedef struct botlib_import_s
|
||||
{
|
||||
typedef struct botlib_import_s {
|
||||
//!print messages from the bot library
|
||||
void (QDECL *Print)(int type, char *fmt, ...);
|
||||
void (QDECL *Print)(int32_t type, char *fmt, ...);
|
||||
|
||||
//!trace a bbox through the world
|
||||
void (*Trace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
|
||||
void(*Trace)(bsp_trace_t* trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int32_t passent, int32_t contentmask);
|
||||
|
||||
//!trace a bbox against a specific entity
|
||||
void (*EntityTrace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int entnum, int contentmask);
|
||||
void(*EntityTrace)(bsp_trace_t* trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int32_t entnum, int32_t contentmask);
|
||||
|
||||
//!retrieve the contents at the given point
|
||||
int (*PointContents)(vec3_t point);
|
||||
int(*PointContents)(vec3_t point);
|
||||
|
||||
//!check if the point is in potential visible sight
|
||||
int (*inPVS)(vec3_t p1, vec3_t p2);
|
||||
int(*inPVS)(vec3_t p1, vec3_t p2);
|
||||
|
||||
//!retrieve the BSP entity data lump
|
||||
char *(*BSPEntityData)(void);
|
||||
char *(*BSPEntityData)(void);
|
||||
|
||||
//
|
||||
void (*BSPModelMinsMaxsOrigin)(int modelnum, vec3_t angles, vec3_t mins, vec3_t maxs, vec3_t origin);
|
||||
void(*BSPModelMinsMaxsOrigin)(int32_t modelnum, vec3_t angles, vec3_t mins, vec3_t maxs, vec3_t origin);
|
||||
|
||||
//!send a bot client command
|
||||
void (*BotClientCommand)(int client, char *command);
|
||||
void(*BotClientCommand)(int client, char* command);
|
||||
|
||||
//memory allocation
|
||||
void *(*GetMemory)(int size);
|
||||
void (*FreeMemory)(void *ptr);
|
||||
void *(*HunkAlloc)(int size);
|
||||
void *(*GetMemory)(int32_t size);
|
||||
void(*FreeMemory)(void* ptr);
|
||||
void *(*HunkAlloc)(int32_t size);
|
||||
|
||||
//file system access
|
||||
int (*FS_FOpenFile)( const char *qpath, fileHandle_t *file, fsMode_t mode );
|
||||
int (*FS_Read)( void *buffer, int len, fileHandle_t f );
|
||||
int (*FS_Write)( const void *buffer, int len, fileHandle_t f );
|
||||
void (*FS_FCloseFile)( fileHandle_t f );
|
||||
int (*FS_Seek)( fileHandle_t f, long offset, int origin );
|
||||
int32_t(*FS_FOpenFile)(const char* qpath, fileHandle_t* file, fsMode_t mode);
|
||||
int32_t(*FS_Read)(void* buffer, int32_t len, fileHandle_t f);
|
||||
int32_t(*FS_Write)(const void* buffer, int32_t len, fileHandle_t f);
|
||||
void(*FS_FCloseFile)(fileHandle_t f);
|
||||
int32_t(*FS_Seek)(fileHandle_t f, int64_t offset, int32_t origin);
|
||||
|
||||
//debug visualisation stuff
|
||||
int (*DebugLineCreate)(void);
|
||||
void (*DebugLineDelete)(int line);
|
||||
void (*DebugLineShow)(int line, vec3_t start, vec3_t end, int color);
|
||||
//
|
||||
int (*DebugPolygonCreate)(int color, int numPoints, vec3_t *points);
|
||||
void (*DebugPolygonDelete)(int id);
|
||||
int32_t(*DebugLineCreate)(void);
|
||||
void(*DebugLineDelete)(int32_t line);
|
||||
void(*DebugLineShow)(int32_t line, vec3_t start, vec3_t end, int32_t color);
|
||||
|
||||
int32_t(*DebugPolygonCreate)(int32_t color, int32_t numPoints, vec3_t* points);
|
||||
void(*DebugPolygonDelete)(int32_t id);
|
||||
} botlib_import_t;
|
||||
|
||||
/**
|
||||
* needed for bot navigation
|
||||
*/
|
||||
typedef struct aas_export_s
|
||||
{
|
||||
typedef struct aas_export_s {
|
||||
//-----------------------------------
|
||||
// be_aas_entity.h
|
||||
//-----------------------------------
|
||||
void (*AAS_EntityInfo)(int entnum, struct aas_entityinfo_s *info);
|
||||
void(*AAS_EntityInfo)(int32_t entnum, struct aas_entityinfo_s* info);
|
||||
|
||||
//-----------------------------------
|
||||
// be_aas_main.h
|
||||
//-----------------------------------
|
||||
int (*AAS_Initialized)(void);
|
||||
void (*AAS_PresenceTypeBoundingBox)(int presencetype, vec3_t mins, vec3_t maxs);
|
||||
float (*AAS_Time)(void);
|
||||
int32_t(*AAS_Initialized)(void);
|
||||
void(*AAS_PresenceTypeBoundingBox)(int32_t presencetype, vec3_t mins, vec3_t maxs);
|
||||
double(*AAS_Time)(void);
|
||||
|
||||
//--------------------------------------------
|
||||
// be_aas_sample.c
|
||||
//--------------------------------------------
|
||||
int (*AAS_PointAreaNum)(vec3_t point);
|
||||
int (*AAS_TraceAreas)(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas);
|
||||
int32_t(*AAS_PointAreaNum)(vec3_t point);
|
||||
int32_t(*AAS_TraceAreas)(vec3_t start, vec3_t end, int32_t* areas, vec3_t* points, int32_t maxareas);
|
||||
|
||||
//--------------------------------------------
|
||||
// be_aas_bspq3.c
|
||||
//--------------------------------------------
|
||||
int (*AAS_PointContents)(vec3_t point);
|
||||
int (*AAS_NextBSPEntity)(int ent);
|
||||
int (*AAS_ValueForBSPEpairKey)(int ent, char *key, char *value, int size);
|
||||
int (*AAS_VectorForBSPEpairKey)(int ent, char *key, vec3_t v);
|
||||
int (*AAS_FloatForBSPEpairKey)(int ent, char *key, float *value);
|
||||
int (*AAS_IntForBSPEpairKey)(int ent, char *key, int *value);
|
||||
int32_t(*AAS_PointContents)(vec3_t point);
|
||||
int32_t(*AAS_NextBSPEntity)(int32_t ent);
|
||||
int32_t(*AAS_ValueForBSPEpairKey)(int32_t ent, char* key, char* value, int32_t size);
|
||||
int32_t(*AAS_VectorForBSPEpairKey)(int32_t ent, char* key, vec3_t v);
|
||||
int32_t(*AAS_FloatForBSPEpairKey)(int32_t ent, char* key, double* value);
|
||||
int32_t(*AAS_IntForBSPEpairKey)(int32_t ent, char* key, int32_t* value);
|
||||
|
||||
//--------------------------------------------
|
||||
// be_aas_reach.c
|
||||
//--------------------------------------------
|
||||
int (*AAS_AreaReachability)(int areanum);
|
||||
int32_t(*AAS_AreaReachability)(int32_t areanum);
|
||||
|
||||
//--------------------------------------------
|
||||
// be_aas_route.c
|
||||
//--------------------------------------------
|
||||
int (*AAS_AreaTravelTimeToGoalArea)(int areanum, vec3_t origin, int goalareanum, int travelflags);
|
||||
int32_t(*AAS_AreaTravelTimeToGoalArea)(int32_t areanum, vec3_t origin, int32_t goalareanum, int32_t travelflags);
|
||||
|
||||
//--------------------------------------------
|
||||
// be_aas_move.c
|
||||
//--------------------------------------------
|
||||
int (*AAS_Swimming)(vec3_t origin);
|
||||
int (*AAS_PredictClientMovement)(struct aas_clientmove_s *move,
|
||||
int entnum, vec3_t origin,
|
||||
int presencetype, int onground,
|
||||
vec3_t velocity, vec3_t cmdmove,
|
||||
int cmdframes,
|
||||
int maxframes, float frametime,
|
||||
int stopevent, int stopareanum, int visualize);
|
||||
int32_t(*AAS_Swimming)(vec3_t origin);
|
||||
int32_t(*AAS_PredictClientMovement)(struct aas_clientmove_s* move,
|
||||
int32_t entnum, vec3_t origin,
|
||||
int32_t presencetype, int32_t onground,
|
||||
vec3_t velocity, vec3_t cmdmove,
|
||||
int32_t cmdframes,
|
||||
int32_t maxframes, double frametime,
|
||||
int32_t stopevent, int32_t stopareanum, int32_t visualize);
|
||||
} aas_export_t;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
typedef struct ea_export_s
|
||||
{
|
||||
typedef struct ea_export_s {
|
||||
//ClientCommand elementary actions
|
||||
void (*EA_Say)(int client, char *str);
|
||||
void (*EA_SayTeam)(int client, char *str);
|
||||
void (*EA_SayClass)(int client, char *str);
|
||||
void (*EA_UseItem)(int client, char *it);
|
||||
void (*EA_DropItem)(int client, char *it);
|
||||
void (*EA_UseInv)(int client, char *inv);
|
||||
void (*EA_DropInv)(int client, char *inv);
|
||||
void (*EA_Gesture)(int client);
|
||||
void (*EA_Command)(int client, char *command );
|
||||
void(*EA_Say)(int32_t client, char* str);
|
||||
void(*EA_SayTeam)(int32_t client, char* str);
|
||||
void(*EA_SayClass)(int32_t client, char* str);
|
||||
void(*EA_UseItem)(int32_t client, char* it);
|
||||
void(*EA_DropItem)(int32_t client, char *it);
|
||||
void(*EA_UseInv)(int32_t client, char* inv);
|
||||
void(*EA_DropInv)(int32_t client, char* inv);
|
||||
void(*EA_Gesture)(int32_t client);
|
||||
void(*EA_Command)(int32_t client, char* command);
|
||||
|
||||
//regular elementary actions
|
||||
void (*EA_SelectWeapon)(int client, int weapon);
|
||||
void (*EA_Talk)(int client);
|
||||
void (*EA_Attack)(int client);
|
||||
void (*EA_Alt_Attack)(int client);
|
||||
void (*EA_Use)(int client);
|
||||
void (*EA_Respawn)(int client);
|
||||
void (*EA_Jump)(int client);
|
||||
void (*EA_DelayedJump)(int client);
|
||||
void (*EA_Crouch)(int client);
|
||||
void (*EA_MoveUp)(int client);
|
||||
void (*EA_MoveDown)(int client);
|
||||
void (*EA_MoveForward)(int client);
|
||||
void (*EA_MoveBack)(int client);
|
||||
void (*EA_MoveLeft)(int client);
|
||||
void (*EA_MoveRight)(int client);
|
||||
void (*EA_Move)(int client, vec3_t dir, float speed);
|
||||
void (*EA_View)(int client, vec3_t viewangles);
|
||||
void(*EA_SelectWeapon)(int32_t client, int32_t weapon);
|
||||
void(*EA_Talk)(int32_t client);
|
||||
void(*EA_Attack)(int32_t client);
|
||||
void(*EA_Alt_Attack)(int32_t client);
|
||||
void(*EA_Use)(int32_t client);
|
||||
void(*EA_Respawn)(int32_t client);
|
||||
void(*EA_Jump)(int32_t client);
|
||||
void(*EA_DelayedJump)(int32_t client);
|
||||
void(*EA_Crouch)(int32_t client);
|
||||
void(*EA_MoveUp)(int32_t client);
|
||||
void(*EA_MoveDown)(int32_t client);
|
||||
void(*EA_MoveForward)(int32_t client);
|
||||
void(*EA_MoveBack)(int32_t client);
|
||||
void(*EA_MoveLeft)(int32_t client);
|
||||
void(*EA_MoveRight)(int32_t client);
|
||||
void(*EA_Move)(int32_t client, vec3_t dir, double speed);
|
||||
void(*EA_View)(int32_t client, vec3_t viewangles);
|
||||
|
||||
//send regular input to the server
|
||||
void (*EA_EndRegular)(int client, float thinktime);
|
||||
void (*EA_GetInput)(int client, float thinktime, bot_input_t *input);
|
||||
void (*EA_ResetInput)(int client);
|
||||
void(*EA_EndRegular)(int32_t client, double thinktime);
|
||||
void(*EA_GetInput)(int32_t client, double thinktime, bot_input_t* input);
|
||||
void(*EA_ResetInput)(int32_t client);
|
||||
} ea_export_t;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
typedef struct ai_export_s
|
||||
{
|
||||
typedef struct ai_export_s {
|
||||
//-----------------------------------
|
||||
// be_ai_char.h
|
||||
//-----------------------------------
|
||||
int (*BotLoadCharacter)(char *charfile, int skill);
|
||||
void (*BotFreeCharacter)(int character);
|
||||
float (*Characteristic_Float)(int character, int index);
|
||||
float (*Characteristic_BFloat)(int character, int index, float min, float max);
|
||||
int (*Characteristic_Integer)(int character, int index);
|
||||
int (*Characteristic_BInteger)(int character, int index, int min, int max);
|
||||
void (*Characteristic_String)(int character, int index, char *buf, int size);
|
||||
int32_t(*BotLoadCharacter)(char* charfile, int32_t skill);
|
||||
void(*BotFreeCharacter)(int32_t character);
|
||||
double(*Characteristic_Float)(int32_t character, int32_t index);
|
||||
double(*Characteristic_BFloat)(int32_t character, int32_t index, double min, double max);
|
||||
int32_t(*Characteristic_Integer)(int32_t character, int32_t index);
|
||||
int32_t(*Characteristic_BInteger)(int32_t character, int32_t index, int32_t min, int32_t max);
|
||||
void(*Characteristic_String)(int32_t character, int32_t index, char* buf, int32_t size);
|
||||
|
||||
//-----------------------------------
|
||||
// be_ai_chat.h
|
||||
//-----------------------------------
|
||||
int (*BotAllocChatState)(void);
|
||||
void (*BotFreeChatState)(int handle);
|
||||
void (*BotQueueConsoleMessage)(int chatstate, int type, char *message);
|
||||
void (*BotRemoveConsoleMessage)(int chatstate, int handle);
|
||||
int (*BotNextConsoleMessage)(int chatstate, struct bot_consolemessage_s *cm);
|
||||
int (*BotNumConsoleMessages)(int chatstate);
|
||||
void (*BotInitialChat)(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
|
||||
int (*BotNumInitialChats)(int chatstate, char *type);
|
||||
int (*BotReplyChat)(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
|
||||
int (*BotChatLength)(int chatstate);
|
||||
void (*BotEnterChat)(int chatstate, int client, int sendto);
|
||||
void (*BotGetChatMessage)(int chatstate, char *buf, int size);
|
||||
int (*StringContains)(char *str1, char *str2, int casesensitive);
|
||||
int (*BotFindMatch)(char *str, struct bot_match_s *match, unsigned long int context);
|
||||
void (*BotMatchVariable)(struct bot_match_s *match, int variable, char *buf, int size);
|
||||
void (*UnifyWhiteSpaces)(char *string);
|
||||
void (*BotReplaceSynonyms)(char *string, unsigned long int context);
|
||||
int (*BotLoadChatFile)(int chatstate, char *chatfile, char *chatname);
|
||||
void (*BotSetChatGender)(int chatstate, int gender);
|
||||
void (*BotSetChatName)(int chatstate, char *name);
|
||||
int32_t(*BotAllocChatState)(void);
|
||||
void(*BotFreeChatState)(int32_t handle);
|
||||
void(*BotQueueConsoleMessage)(int32_t chatstate, int32_t type, char* message);
|
||||
void(*BotRemoveConsoleMessage)(int32_t chatstate, int32_t handle);
|
||||
int32_t(*BotNextConsoleMessage)(int32_t chatstate, struct bot_consolemessage_s* cm);
|
||||
int32_t(*BotNumConsoleMessages)(int32_t chatstate);
|
||||
void(*BotInitialChat)(int32_t chatstate, char* type, int32_t mcontext, char* var0, char* var1, char* var2, char* var3, char* var4, char* var5, char* var6, char* var7);
|
||||
int32_t(*BotNumInitialChats)(int32_t chatstate, char* type);
|
||||
int32_t(*BotReplyChat)(int32_t chatstate, char* message, int32_t mcontext, int32_t vcontext, char* var0, char* var1, char* var2, char* var3, char* var4, char* var5, char* var6, char* var7);
|
||||
int32_t(*BotChatLength)(int32_t chatstate);
|
||||
void(*BotEnterChat)(int32_t chatstate, int32_t client, int32_t sendto);
|
||||
void(*BotGetChatMessage)(int32_t chatstate, char* buf, int32_t size);
|
||||
int32_t(*StringContains)(char* str1, char* str2, int32_t casesensitive);
|
||||
int32_t(*BotFindMatch)(char* str, struct bot_match_s* match, uint64_t context);
|
||||
void(*BotMatchVariable)(struct bot_match_s* match, int32_t variable, char* buf, int32_t size);
|
||||
void(*UnifyWhiteSpaces)(char* string);
|
||||
void(*BotReplaceSynonyms)(char* string, uint64_t context);
|
||||
int32_t(*BotLoadChatFile)(int32_t chatstate, char* chatfile, char* chatname);
|
||||
void(*BotSetChatGender)(int32_t chatstate, int32_t gender);
|
||||
void(*BotSetChatName)(int32_t chatstate, char* name);
|
||||
|
||||
//-----------------------------------
|
||||
// be_ai_goal.h
|
||||
//-----------------------------------
|
||||
void (*BotResetGoalState)(int goalstate);
|
||||
void (*BotResetAvoidGoals)(int goalstate);
|
||||
void (*BotRemoveFromAvoidGoals)(int goalstate, int number);
|
||||
void (*BotPushGoal)(int goalstate, struct bot_goal_s *goal);
|
||||
void (*BotPopGoal)(int goalstate);
|
||||
void (*BotEmptyGoalStack)(int goalstate);
|
||||
void (*BotDumpAvoidGoals)(int goalstate);
|
||||
void (*BotDumpGoalStack)(int goalstate);
|
||||
void (*BotGoalName)(int number, char *name, int size);
|
||||
int (*BotGetTopGoal)(int goalstate, struct bot_goal_s *goal);
|
||||
int (*BotGetSecondGoal)(int goalstate, struct bot_goal_s *goal);
|
||||
int (*BotChooseLTGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags, qboolean botRoamsOnly);
|
||||
int (*BotChooseNBGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags,
|
||||
struct bot_goal_s *ltg, float maxtime, qboolean botRoamsOnly);
|
||||
int (*BotTouchingGoal)(vec3_t origin, struct bot_goal_s *goal);
|
||||
int (*BotItemGoalInVisButNotVisible)(int viewer, vec3_t eye, vec3_t viewangles, struct bot_goal_s *goal);
|
||||
int (*BotGetLevelItemGoal)(int index, char *classname, struct bot_goal_s *goal);
|
||||
int (*BotGetNextCampSpotGoal)(int num, struct bot_goal_s *goal);
|
||||
int (*BotGetMapLocationGoal)(char *name, struct bot_goal_s *goal);
|
||||
float (*BotAvoidGoalTime)(int goalstate, int number);
|
||||
void (*BotInitLevelItems)(void);
|
||||
void (*BotUpdateEntityItems)(void);
|
||||
int (*BotLoadItemWeights)(int goalstate, char *filename);
|
||||
void (*BotFreeItemWeights)(int goalstate);
|
||||
void (*BotInterbreedGoalFuzzyLogic)(int parent1, int parent2, int child);
|
||||
void (*BotSaveGoalFuzzyLogic)(int goalstate, char *filename);
|
||||
void (*BotMutateGoalFuzzyLogic)(int goalstate, float range);
|
||||
int (*BotAllocGoalState)(int client);
|
||||
void (*BotFreeGoalState)(int handle);
|
||||
void(*BotResetGoalState)(int32_t goalstate);
|
||||
void(*BotResetAvoidGoals)(int32_t goalstate);
|
||||
void(*BotRemoveFromAvoidGoals)(int32_t goalstate, int32_t number);
|
||||
void(*BotPushGoal)(int32_t goalstate, struct bot_goal_s* goal);
|
||||
void(*BotPopGoal)(int32_t goalstate);
|
||||
void(*BotEmptyGoalStack)(int32_t goalstate);
|
||||
void(*BotDumpAvoidGoals)(int32_t goalstate);
|
||||
void(*BotDumpGoalStack)(int32_t goalstate);
|
||||
void(*BotGoalName)(int32_t number, char* name, int32_t size);
|
||||
int32_t(*BotGetTopGoal)(int32_t goalstate, struct bot_goal_s* goal);
|
||||
int32_t(*BotGetSecondGoal)(int32_t goalstate, struct bot_goal_s* goal);
|
||||
int32_t(*BotChooseLTGItem)(int32_t goalstate, vec3_t origin, int32_t* inventory, int32_t travelflags, qboolean botRoamsOnly);
|
||||
int32_t(*BotChooseNBGItem)(int32_t goalstate, vec3_t origin, int32_t* inventory, int32_t travelflags, struct bot_goal_s* ltg, double maxtime, qboolean botRoamsOnly);
|
||||
int32_t(*BotTouchingGoal)(vec3_t origin, struct bot_goal_s* goal);
|
||||
int32_t(*BotItemGoalInVisButNotVisible)(int32_t viewer, vec3_t eye, vec3_t viewangles, struct bot_goal_s* goal);
|
||||
int32_t(*BotGetLevelItemGoal)(int32_t index, char* classname, struct bot_goal_s* goal);
|
||||
int32_t(*BotGetNextCampSpotGoal)(int32_t num, struct bot_goal_s* goal);
|
||||
int32_t(*BotGetMapLocationGoal)(char* name, struct bot_goal_s* goal);
|
||||
double(*BotAvoidGoalTime)(int32_t goalstate, int32_t number);
|
||||
void(*BotInitLevelItems)(void);
|
||||
void(*BotUpdateEntityItems)(void);
|
||||
int32_t(*BotLoadItemWeights)(int32_t goalstate, char* filename);
|
||||
void(*BotFreeItemWeights)(int32_t goalstate);
|
||||
void(*BotInterbreedGoalFuzzyLogic)(int32_t parent1, int32_t parent2, int32_t child);
|
||||
void(*BotSaveGoalFuzzyLogic)(int32_t goalstate, char* filename);
|
||||
void(*BotMutateGoalFuzzyLogic)(int32_t goalstate, double range);
|
||||
int32_t(*BotAllocGoalState)(int32_t client);
|
||||
void(*BotFreeGoalState)(int32_t handle);
|
||||
|
||||
//-----------------------------------
|
||||
// be_ai_move.h
|
||||
//-----------------------------------
|
||||
void (*BotResetMoveState)(int movestate);
|
||||
void (*BotMoveToGoal)(struct bot_moveresult_s *result, int movestate, struct bot_goal_s *goal, int travelflags);
|
||||
int (*BotMoveInDirection)(int movestate, vec3_t dir, float speed, int type);
|
||||
void (*BotResetAvoidReach)(int movestate);
|
||||
void (*BotResetLastAvoidReach)(int movestate);
|
||||
int (*BotReachabilityArea)(vec3_t origin, int testground);
|
||||
int (*BotMovementViewTarget)(int movestate, struct bot_goal_s *goal, int travelflags, float lookahead, vec3_t target);
|
||||
int (*BotPredictVisiblePosition)(vec3_t origin, int areanum, struct bot_goal_s *goal, int travelflags, vec3_t target);
|
||||
int (*BotAllocMoveState)(void);
|
||||
void (*BotFreeMoveState)(int handle);
|
||||
void (*BotInitMoveState)(int handle, struct bot_initmove_s *initmove);
|
||||
void(*BotResetMoveState)(int32_t movestate);
|
||||
void(*BotMoveToGoal)(struct bot_moveresult_s* result, int32_t movestate, struct bot_goal_s* goal, int32_t travelflags);
|
||||
int32_t(*BotMoveInDirection)(int32_t movestate, vec3_t dir, double speed, int32_t type);
|
||||
void(*BotResetAvoidReach)(int32_t movestate);
|
||||
void(*BotResetLastAvoidReach)(int32_t movestate);
|
||||
int32_t(*BotReachabilityArea)(vec3_t origin, int32_t testground);
|
||||
int32_t(*BotMovementViewTarget)(int32_t movestate, struct bot_goal_s* goal, int32_t travelflags, double lookahead, vec3_t target);
|
||||
int32_t(*BotPredictVisiblePosition)(vec3_t origin, int32_t areanum, struct bot_goal_s* goal, int32_t travelflags, vec3_t target);
|
||||
int32_t(*BotAllocMoveState)(void);
|
||||
void(*BotFreeMoveState)(int32_t handle);
|
||||
void(*BotInitMoveState)(int32_t handle, struct bot_initmove_s* initmove);
|
||||
|
||||
//-----------------------------------
|
||||
// be_ai_weap.h
|
||||
//-----------------------------------
|
||||
int (*BotChooseBestFightWeapon)(int weaponstate, int *inventory, qboolean meleeRange);
|
||||
void (*BotGetWeaponInfo)(int weaponstate, int weapon, struct weaponinfo_s *weaponinfo);
|
||||
int (*BotLoadWeaponWeights)(int weaponstate, char *filename);
|
||||
int (*BotAllocWeaponState)(void);
|
||||
void (*BotFreeWeaponState)(int weaponstate);
|
||||
void (*BotResetWeaponState)(int weaponstate);
|
||||
int32_t(*BotChooseBestFightWeapon)(int32_t weaponstate, int32_t* inventory, qboolean meleeRange);
|
||||
void(*BotGetWeaponInfo)(int32_t weaponstate, int32_t weapon, struct weaponinfo_s* weaponinfo);
|
||||
int32_t(*BotLoadWeaponWeights)(int32_t weaponstate, char* filename);
|
||||
int32_t(*BotAllocWeaponState)(void);
|
||||
void(*BotFreeWeaponState)(int32_t weaponstate);
|
||||
void(*BotResetWeaponState)(int32_t weaponstate);
|
||||
|
||||
//-----------------------------------
|
||||
// be_ai_gen.h
|
||||
//-----------------------------------
|
||||
int (*GeneticParentsAndChildSelection)(int numranks, float *ranks, int *parent1, int *parent2, int *child);
|
||||
int32_t(*GeneticParentsAndChildSelection)(int32_t numranks, double* ranks, int32_t* parent1, int32_t* parent2, int32_t* child);
|
||||
} ai_export_t;
|
||||
|
||||
/**
|
||||
* bot AI library imported functions
|
||||
*/
|
||||
typedef struct botlib_export_s
|
||||
{
|
||||
typedef struct botlib_export_s {
|
||||
//!Area Awareness System functions
|
||||
aas_export_t aas;
|
||||
|
||||
//!Elementary Action functions
|
||||
ea_export_t ea;
|
||||
|
||||
//!AI functions
|
||||
ai_export_t ai;
|
||||
|
||||
//!setup the bot library, returns BLERR_
|
||||
int (*BotLibSetup)(void);
|
||||
int32_t(*BotLibSetup)(void);
|
||||
|
||||
//!shutdown the bot library, returns BLERR_
|
||||
int (*BotLibShutdown)(void);
|
||||
int32_t(*BotLibShutdown)(void);
|
||||
|
||||
//!sets a library variable returns BLERR_
|
||||
int (*BotLibVarSet)(char *var_name, char *value);
|
||||
int32_t(*BotLibVarSet)(char* var_name, char* value);
|
||||
|
||||
//!gets a library variable returns BLERR_
|
||||
int (*BotLibVarGet)(char *var_name, char *value, int size);
|
||||
int32_t(*BotLibVarGet)(char* var_name, char* value, int32_t size);
|
||||
|
||||
//!sets a C-like define returns BLERR_
|
||||
int (*BotLibDefine)(char *string);
|
||||
int32_t(*BotLibDefine)(char* string);
|
||||
|
||||
//!start a frame in the bot library
|
||||
int (*BotLibStartFrame)(float time);
|
||||
int32_t(*BotLibStartFrame)(double time);
|
||||
|
||||
//!load a new map in the bot library
|
||||
int (*BotLibLoadMap)(const char *mapname);
|
||||
int32_t(*BotLibLoadMap)(const char* mapname);
|
||||
|
||||
//!entity updates
|
||||
int (*BotLibUpdateEntity)(int ent, bot_entitystate_t *state);
|
||||
int32_t(*BotLibUpdateEntity)(int32_t ent, bot_entitystate_t* state);
|
||||
|
||||
//!just for testing
|
||||
int (*Test)(int parm0, char *parm1, vec3_t parm2, vec3_t parm3);
|
||||
int32_t(*Test)(int32_t parm0, char* parm1, vec3_t parm2, vec3_t parm3);
|
||||
} botlib_export_t;
|
||||
|
||||
//linking of bot library
|
||||
botlib_export_t *GetBotLibAPI( int apiVersion, botlib_import_t *import );
|
||||
botlib_export_t* GetBotLibAPI(int32_t apiVersion, botlib_import_t* import);
|
||||
|
||||
/* Library variables:
|
||||
|
||||
|
|
Loading…
Reference in a new issue