updated botlib.h

This commit is contained in:
Walter Julius Hennecke 2014-10-11 19:11:11 +02:00
parent 881df8c239
commit e921ee5039
2 changed files with 314 additions and 282 deletions

View file

@ -40,7 +40,7 @@ typedef enum {
BFL_AVOIDRIGHT = 16, //!<avoid obstacles by going to the right BFL_AVOIDRIGHT = 16, //!<avoid obstacles by going to the right
BFL_IDEALVIEWSET = 32, //!<bot has ideal view angles set BFL_IDEALVIEWSET = 32, //!<bot has ideal view angles set
BFL_FIGHTSUICIDAL = 64 //!<bot is in a suicidal fight BFL_FIGHTSUICIDAL = 64 //!<bot is in a suicidal fight
} BFL; } AI_main_BFL;
//long term goal types //long term goal types
typedef enum { typedef enum {
@ -55,7 +55,7 @@ typedef enum {
LTG_PATROL, //!<patrol LTG_PATROL, //!<patrol
LTG_GETITEM, //!<get an item LTG_GETITEM, //!<get an item
LTG_KILL //!<kill someone LTG_KILL //!<kill someone
} LTG; } AI_main_LTG;
//some goal dedication times //some goal dedication times
#define TEAM_HELP_TIME 10 //!<1 minute teamplay help time #define TEAM_HELP_TIME 10 //!<1 minute teamplay help time

View file

@ -36,60 +36,67 @@ struct weaponinfo_s;
#define LINECOLOR_ORANGE 5 //0xe0e1e2e3L #define LINECOLOR_ORANGE 5 //0xe0e1e2e3L
//Print types //Print types
#define PRT_MESSAGE 1 typedef enum {
#define PRT_WARNING 2 PRT_MESSAGE = 1,
#define PRT_ERROR 3 PRT_WARNING,
#define PRT_FATAL 4 PRT_ERROR,
#define PRT_EXIT 5 PRT_FATAL,
PRT_EXIT
} botlib_PrintType;
//console message types //console message types
#define CMS_NORMAL 0 typedef enum {
#define CMS_CHAT 1 CMS_NORMAL,
CMS_CHAT
} botlib_ConsoleMessageTpye;
//botlib error codes //botlib error codes
#define BLERR_NOERROR 0 //!<no error typedef enum {
#define BLERR_LIBRARYNOTSETUP 1 //!<library not setup BLERR_NOERROR, //!<no error
#define BLERR_INVALIDENTITYNUMBER 2 //!<invalid entity number BLERR_LIBRARYNOTSETUP, //!<library not setup
#define BLERR_NOAASFILE 3 //!<no AAS file available BLERR_INVALIDENTITYNUMBER, //!<invalid entity number
#define BLERR_CANNOTOPENAASFILE 4 //!<cannot open AAS file BLERR_NOAASFILE, //!<no AAS file available
#define BLERR_WRONGAASFILEID 5 //!<incorrect AAS file id BLERR_CANNOTOPENAASFILE, //!<cannot open AAS file
#define BLERR_WRONGAASFILEVERSION 6 //!<incorrect AAS file version BLERR_WRONGAASFILEID, //!<incorrect AAS file id
#define BLERR_CANNOTREADAASLUMP 7 //!<cannot read AAS file lump BLERR_WRONGAASFILEVERSION, //!<incorrect AAS file version
#define BLERR_CANNOTLOADICHAT 8 //!<cannot load initial chats BLERR_CANNOTREADAASLUMP, //!<cannot read AAS file lump
#define BLERR_CANNOTLOADITEMWEIGHTS 9 //!<cannot load item weights BLERR_CANNOTLOADICHAT, //!<cannot load initial chats
#define BLERR_CANNOTLOADITEMCONFIG 10 //!<cannot load item config BLERR_CANNOTLOADITEMWEIGHTS, //!<cannot load item weights
#define BLERR_CANNOTLOADWEAPONWEIGHTS 11 //!<cannot load weapon weights BLERR_CANNOTLOADITEMCONFIG, //!<cannot load item config
#define BLERR_CANNOTLOADWEAPONCONFIG 12 //!<cannot load weapon config BLERR_CANNOTLOADWEAPONWEIGHTS, //!<cannot load weapon weights
BLERR_CANNOTLOADWEAPONCONFIG, //!<cannot load weapon config
} botlib_ErrorCode;
//action flags //action flags
#define ACTION_ATTACK 1 typedef enum {
#define ACTION_USE 2 ACTION_ATTACK = 1,
#define ACTION_RESPAWN 4 ACTION_USE = 2,
#define ACTION_JUMP 8 ACTION_RESPAWN = 4,
#define ACTION_MOVEUP 8 ACTION_JUMP = 8,
#define ACTION_CROUCH 16 ACTION_MOVEUP = 8,
#define ACTION_MOVEDOWN 16 ACTION_CROUCH = 16,
#define ACTION_MOVEFORWARD 32 ACTION_MOVEDOWN = 16,
#define ACTION_MOVEBACK 64 ACTION_MOVEFORWARD = 32,
#define ACTION_MOVELEFT 128 ACTION_MOVEBACK = 64,
#define ACTION_MOVERIGHT 256 ACTION_MOVELEFT = 128,
#define ACTION_DELAYEDJUMP 512 ACTION_MOVERIGHT = 256,
#define ACTION_TALK 1024 ACTION_DELAYEDJUMP = 512,
#define ACTION_GESTURE 2048 ACTION_TALK = 1024,
#define ACTION_WALK 4096 ACTION_GESTURE = 2048,
#define ACTION_ALT_ATTACK 8192 ACTION_WALK = 4096,
ACTION_ALT_ATTACK = 8192
} botlib_ActionFlag;
/** /**
* the bot input, will be converted to an usercmd_t * the bot input, will be converted to an usercmd_t
*/ */
typedef struct bot_input_s typedef struct bot_input_s {
{ double thinktime; //!<time since last output (in seconds)
float thinktime; //!<time since last output (in seconds)
vec3_t dir; //!<movement direction 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 vec3_t viewangles; //!<the view angles
int actionflags; //!<one of the ACTION_? flags int32_t actionflags; //!<one of the ACTION_? flags
int weapon; //!<weapon to use int32_t weapon; //!<weapon to use
} bot_input_t; } bot_input_t;
#ifndef BSPTRACE #ifndef BSPTRACE
@ -99,29 +106,27 @@ typedef struct bot_input_s
/** /**
* bsp_trace_t hit surface * bsp_trace_t hit surface
*/ */
typedef struct bsp_surface_s typedef struct bsp_surface_s {
{
char name[16]; char name[16];
int flags; int32_t flags;
int value; int32_t value;
} bsp_surface_t; } bsp_surface_t;
//remove the bsp_trace_s structure definition l8r on //remove the bsp_trace_s structure definition l8r on
/** /**
* a trace is returned when a box is swept through the world * 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 allsolid; //!< if true, plane is not valid
qboolean startsolid; //!< if true, the initial point was in a solid area 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 vec3_t endpos; //!< final position
cplane_t plane; //!< surface normal at impact cplane_t plane; //!< surface normal at impact
float exp_dist; //!< expanded plane distance double exp_dist; //!< expanded plane distance
int sidenum; //!< number of the brush side hit int32_t sidenum; //!< number of the brush side hit
bsp_surface_t surface; //!< the hit point surface bsp_surface_t surface; //!< the hit point surface
int contents; //!< contents on other side of surface hit int32_t contents; //!< contents on other side of surface hit
int ent; //!< number of entity hit int32_t ent; //!< number of entity hit
} bsp_trace_t; } bsp_trace_t;
#endif // BSPTRACE #endif // BSPTRACE
@ -129,289 +134,316 @@ typedef struct bsp_trace_s
/** /**
* entitystate for bots * entitystate for bots
*/ */
typedef struct bot_entitystate_s typedef struct bot_entitystate_s {
{ int32_t type; // entity type
int type; // entity type int32_t flags; // entity flags
int flags; // entity flags
vec3_t origin; // origin of the entity vec3_t origin; // origin of the entity
vec3_t angles; // angles of the model vec3_t angles; // angles of the model
vec3_t old_origin; // for lerping vec3_t old_origin; // for lerping
vec3_t mins; // bounding box minimums vec3_t mins; // bounding box minimums
vec3_t maxs; // bounding box maximums vec3_t maxs; // bounding box maximums
int groundent; // ground entity int32_t groundent; // ground entity
int solid; // solid type int32_t solid; // solid type
int modelindex; // model used int32_t modelindex; // model used
int modelindex2; // weapons, CTF flags, etc int32_t modelindex2; // weapons, CTF flags, etc
int frame; // model frame number int32_t frame; // model frame number
int event; // impulse events -- muzzle flashes, footsteps, etc int32_t event; // impulse events -- muzzle flashes, footsteps, etc
int eventParm; // even parameter int32_t eventParm; // even parameter
int powerups; // bit flags int32_t powerups; // bit flags
int weapon; // determines weapon and flash model, etc int32_t weapon; // determines weapon and flash model, etc
int legsAnim; // mask off ANIM_TOGGLEBIT int32_t legsAnim; // mask off ANIM_TOGGLEBIT
int torsoAnim; // mask off ANIM_TOGGLEBIT int32_t torsoAnim; // mask off ANIM_TOGGLEBIT
} bot_entitystate_t; } bot_entitystate_t;
/** /**
* bot AI library exported functions * bot AI library exported functions
*/ */
typedef struct botlib_import_s typedef struct botlib_import_s {
{
//!print messages from the bot library //!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 //!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 //!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 //!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 //!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 //!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 //!send a bot client command
void(*BotClientCommand)(int client, char* command); void(*BotClientCommand)(int client, char* command);
//memory allocation //memory allocation
void *(*GetMemory)(int size); void *(*GetMemory)(int32_t size);
void(*FreeMemory)(void* ptr); void(*FreeMemory)(void* ptr);
void *(*HunkAlloc)(int size); void *(*HunkAlloc)(int32_t size);
//file system access //file system access
int (*FS_FOpenFile)( const char *qpath, fileHandle_t *file, fsMode_t mode ); int32_t(*FS_FOpenFile)(const char* qpath, fileHandle_t* file, fsMode_t mode);
int (*FS_Read)( void *buffer, int len, fileHandle_t f ); int32_t(*FS_Read)(void* buffer, int32_t len, fileHandle_t f);
int (*FS_Write)( const void *buffer, int len, fileHandle_t f ); int32_t(*FS_Write)(const void* buffer, int32_t len, fileHandle_t f);
void(*FS_FCloseFile)(fileHandle_t f); void(*FS_FCloseFile)(fileHandle_t f);
int (*FS_Seek)( fileHandle_t f, long offset, int origin ); int32_t(*FS_Seek)(fileHandle_t f, int64_t offset, int32_t origin);
//debug visualisation stuff //debug visualisation stuff
int (*DebugLineCreate)(void); int32_t(*DebugLineCreate)(void);
void (*DebugLineDelete)(int line); void(*DebugLineDelete)(int32_t line);
void (*DebugLineShow)(int line, vec3_t start, vec3_t end, int color); void(*DebugLineShow)(int32_t line, vec3_t start, vec3_t end, int32_t color);
//
int (*DebugPolygonCreate)(int color, int numPoints, vec3_t *points); int32_t(*DebugPolygonCreate)(int32_t color, int32_t numPoints, vec3_t* points);
void (*DebugPolygonDelete)(int id); void(*DebugPolygonDelete)(int32_t id);
} botlib_import_t; } botlib_import_t;
/** /**
* needed for bot navigation * needed for bot navigation
*/ */
typedef struct aas_export_s typedef struct aas_export_s {
{
//----------------------------------- //-----------------------------------
// be_aas_entity.h // 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 // be_aas_main.h
//----------------------------------- //-----------------------------------
int (*AAS_Initialized)(void); int32_t(*AAS_Initialized)(void);
void (*AAS_PresenceTypeBoundingBox)(int presencetype, vec3_t mins, vec3_t maxs); void(*AAS_PresenceTypeBoundingBox)(int32_t presencetype, vec3_t mins, vec3_t maxs);
float (*AAS_Time)(void); double(*AAS_Time)(void);
//-------------------------------------------- //--------------------------------------------
// be_aas_sample.c // be_aas_sample.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_PointAreaNum)(vec3_t point); int32_t(*AAS_PointAreaNum)(vec3_t point);
int (*AAS_TraceAreas)(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas); int32_t(*AAS_TraceAreas)(vec3_t start, vec3_t end, int32_t* areas, vec3_t* points, int32_t maxareas);
//-------------------------------------------- //--------------------------------------------
// be_aas_bspq3.c // be_aas_bspq3.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_PointContents)(vec3_t point); int32_t(*AAS_PointContents)(vec3_t point);
int (*AAS_NextBSPEntity)(int ent); int32_t(*AAS_NextBSPEntity)(int32_t ent);
int (*AAS_ValueForBSPEpairKey)(int ent, char *key, char *value, int size); int32_t(*AAS_ValueForBSPEpairKey)(int32_t ent, char* key, char* value, int32_t size);
int (*AAS_VectorForBSPEpairKey)(int ent, char *key, vec3_t v); int32_t(*AAS_VectorForBSPEpairKey)(int32_t ent, char* key, vec3_t v);
int (*AAS_FloatForBSPEpairKey)(int ent, char *key, float *value); int32_t(*AAS_FloatForBSPEpairKey)(int32_t ent, char* key, double* value);
int (*AAS_IntForBSPEpairKey)(int ent, char *key, int *value); int32_t(*AAS_IntForBSPEpairKey)(int32_t ent, char* key, int32_t* value);
//-------------------------------------------- //--------------------------------------------
// be_aas_reach.c // be_aas_reach.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_AreaReachability)(int areanum); int32_t(*AAS_AreaReachability)(int32_t areanum);
//-------------------------------------------- //--------------------------------------------
// be_aas_route.c // 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 // be_aas_move.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_Swimming)(vec3_t origin); int32_t(*AAS_Swimming)(vec3_t origin);
int (*AAS_PredictClientMovement)(struct aas_clientmove_s *move, int32_t(*AAS_PredictClientMovement)(struct aas_clientmove_s* move,
int entnum, vec3_t origin, int32_t entnum, vec3_t origin,
int presencetype, int onground, int32_t presencetype, int32_t onground,
vec3_t velocity, vec3_t cmdmove, vec3_t velocity, vec3_t cmdmove,
int cmdframes, int32_t cmdframes,
int maxframes, float frametime, int32_t maxframes, double frametime,
int stopevent, int stopareanum, int visualize); int32_t stopevent, int32_t stopareanum, int32_t visualize);
} aas_export_t; } aas_export_t;
/** /**
* *
*/ */
typedef struct ea_export_s typedef struct ea_export_s {
{
//ClientCommand elementary actions //ClientCommand elementary actions
void (*EA_Say)(int client, char *str); void(*EA_Say)(int32_t client, char* str);
void (*EA_SayTeam)(int client, char *str); void(*EA_SayTeam)(int32_t client, char* str);
void (*EA_SayClass)(int client, char *str); void(*EA_SayClass)(int32_t client, char* str);
void (*EA_UseItem)(int client, char *it); void(*EA_UseItem)(int32_t client, char* it);
void (*EA_DropItem)(int client, char *it); void(*EA_DropItem)(int32_t client, char *it);
void (*EA_UseInv)(int client, char *inv); void(*EA_UseInv)(int32_t client, char* inv);
void (*EA_DropInv)(int client, char *inv); void(*EA_DropInv)(int32_t client, char* inv);
void (*EA_Gesture)(int client); void(*EA_Gesture)(int32_t client);
void (*EA_Command)(int client, char *command ); void(*EA_Command)(int32_t client, char* command);
//regular elementary actions //regular elementary actions
void (*EA_SelectWeapon)(int client, int weapon); void(*EA_SelectWeapon)(int32_t client, int32_t weapon);
void (*EA_Talk)(int client); void(*EA_Talk)(int32_t client);
void (*EA_Attack)(int client); void(*EA_Attack)(int32_t client);
void (*EA_Alt_Attack)(int client); void(*EA_Alt_Attack)(int32_t client);
void (*EA_Use)(int client); void(*EA_Use)(int32_t client);
void (*EA_Respawn)(int client); void(*EA_Respawn)(int32_t client);
void (*EA_Jump)(int client); void(*EA_Jump)(int32_t client);
void (*EA_DelayedJump)(int client); void(*EA_DelayedJump)(int32_t client);
void (*EA_Crouch)(int client); void(*EA_Crouch)(int32_t client);
void (*EA_MoveUp)(int client); void(*EA_MoveUp)(int32_t client);
void (*EA_MoveDown)(int client); void(*EA_MoveDown)(int32_t client);
void (*EA_MoveForward)(int client); void(*EA_MoveForward)(int32_t client);
void (*EA_MoveBack)(int client); void(*EA_MoveBack)(int32_t client);
void (*EA_MoveLeft)(int client); void(*EA_MoveLeft)(int32_t client);
void (*EA_MoveRight)(int client); void(*EA_MoveRight)(int32_t client);
void (*EA_Move)(int client, vec3_t dir, float speed); void(*EA_Move)(int32_t client, vec3_t dir, double speed);
void (*EA_View)(int client, vec3_t viewangles); void(*EA_View)(int32_t client, vec3_t viewangles);
//send regular input to the server //send regular input to the server
void (*EA_EndRegular)(int client, float thinktime); void(*EA_EndRegular)(int32_t client, double thinktime);
void (*EA_GetInput)(int client, float thinktime, bot_input_t *input); void(*EA_GetInput)(int32_t client, double thinktime, bot_input_t* input);
void (*EA_ResetInput)(int client); void(*EA_ResetInput)(int32_t client);
} ea_export_t; } ea_export_t;
/** /**
* *
*/ */
typedef struct ai_export_s typedef struct ai_export_s {
{
//----------------------------------- //-----------------------------------
// be_ai_char.h // be_ai_char.h
//----------------------------------- //-----------------------------------
int (*BotLoadCharacter)(char *charfile, int skill); int32_t(*BotLoadCharacter)(char* charfile, int32_t skill);
void (*BotFreeCharacter)(int character); void(*BotFreeCharacter)(int32_t character);
float (*Characteristic_Float)(int character, int index); double(*Characteristic_Float)(int32_t character, int32_t index);
float (*Characteristic_BFloat)(int character, int index, float min, float max); double(*Characteristic_BFloat)(int32_t character, int32_t index, double min, double max);
int (*Characteristic_Integer)(int character, int index); int32_t(*Characteristic_Integer)(int32_t character, int32_t index);
int (*Characteristic_BInteger)(int character, int index, int min, int max); int32_t(*Characteristic_BInteger)(int32_t character, int32_t index, int32_t min, int32_t max);
void (*Characteristic_String)(int character, int index, char *buf, int size); void(*Characteristic_String)(int32_t character, int32_t index, char* buf, int32_t size);
//----------------------------------- //-----------------------------------
// be_ai_chat.h // be_ai_chat.h
//----------------------------------- //-----------------------------------
int (*BotAllocChatState)(void); int32_t(*BotAllocChatState)(void);
void (*BotFreeChatState)(int handle); void(*BotFreeChatState)(int32_t handle);
void (*BotQueueConsoleMessage)(int chatstate, int type, char *message); void(*BotQueueConsoleMessage)(int32_t chatstate, int32_t type, char* message);
void (*BotRemoveConsoleMessage)(int chatstate, int handle); void(*BotRemoveConsoleMessage)(int32_t chatstate, int32_t handle);
int (*BotNextConsoleMessage)(int chatstate, struct bot_consolemessage_s *cm); int32_t(*BotNextConsoleMessage)(int32_t chatstate, struct bot_consolemessage_s* cm);
int (*BotNumConsoleMessages)(int chatstate); int32_t(*BotNumConsoleMessages)(int32_t 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); 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);
int (*BotNumInitialChats)(int chatstate, char *type); int32_t(*BotNumInitialChats)(int32_t 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); 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);
int (*BotChatLength)(int chatstate); int32_t(*BotChatLength)(int32_t chatstate);
void (*BotEnterChat)(int chatstate, int client, int sendto); void(*BotEnterChat)(int32_t chatstate, int32_t client, int32_t sendto);
void (*BotGetChatMessage)(int chatstate, char *buf, int size); void(*BotGetChatMessage)(int32_t chatstate, char* buf, int32_t size);
int (*StringContains)(char *str1, char *str2, int casesensitive); int32_t(*StringContains)(char* str1, char* str2, int32_t casesensitive);
int (*BotFindMatch)(char *str, struct bot_match_s *match, unsigned long int context); int32_t(*BotFindMatch)(char* str, struct bot_match_s* match, uint64_t context);
void (*BotMatchVariable)(struct bot_match_s *match, int variable, char *buf, int size); void(*BotMatchVariable)(struct bot_match_s* match, int32_t variable, char* buf, int32_t size);
void(*UnifyWhiteSpaces)(char* string); void(*UnifyWhiteSpaces)(char* string);
void (*BotReplaceSynonyms)(char *string, unsigned long int context); void(*BotReplaceSynonyms)(char* string, uint64_t context);
int (*BotLoadChatFile)(int chatstate, char *chatfile, char *chatname); int32_t(*BotLoadChatFile)(int32_t chatstate, char* chatfile, char* chatname);
void (*BotSetChatGender)(int chatstate, int gender); void(*BotSetChatGender)(int32_t chatstate, int32_t gender);
void (*BotSetChatName)(int chatstate, char *name); void(*BotSetChatName)(int32_t chatstate, char* name);
//----------------------------------- //-----------------------------------
// be_ai_goal.h // be_ai_goal.h
//----------------------------------- //-----------------------------------
void (*BotResetGoalState)(int goalstate); void(*BotResetGoalState)(int32_t goalstate);
void (*BotResetAvoidGoals)(int goalstate); void(*BotResetAvoidGoals)(int32_t goalstate);
void (*BotRemoveFromAvoidGoals)(int goalstate, int number); void(*BotRemoveFromAvoidGoals)(int32_t goalstate, int32_t number);
void (*BotPushGoal)(int goalstate, struct bot_goal_s *goal); void(*BotPushGoal)(int32_t goalstate, struct bot_goal_s* goal);
void (*BotPopGoal)(int goalstate); void(*BotPopGoal)(int32_t goalstate);
void (*BotEmptyGoalStack)(int goalstate); void(*BotEmptyGoalStack)(int32_t goalstate);
void (*BotDumpAvoidGoals)(int goalstate); void(*BotDumpAvoidGoals)(int32_t goalstate);
void (*BotDumpGoalStack)(int goalstate); void(*BotDumpGoalStack)(int32_t goalstate);
void (*BotGoalName)(int number, char *name, int size); void(*BotGoalName)(int32_t number, char* name, int32_t size);
int (*BotGetTopGoal)(int goalstate, struct bot_goal_s *goal); int32_t(*BotGetTopGoal)(int32_t goalstate, struct bot_goal_s* goal);
int (*BotGetSecondGoal)(int goalstate, struct bot_goal_s *goal); int32_t(*BotGetSecondGoal)(int32_t goalstate, struct bot_goal_s* goal);
int (*BotChooseLTGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags, qboolean botRoamsOnly); int32_t(*BotChooseLTGItem)(int32_t goalstate, vec3_t origin, int32_t* inventory, int32_t travelflags, qboolean botRoamsOnly);
int (*BotChooseNBGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags, int32_t(*BotChooseNBGItem)(int32_t goalstate, vec3_t origin, int32_t* inventory, int32_t travelflags, struct bot_goal_s* ltg, double maxtime, qboolean botRoamsOnly);
struct bot_goal_s *ltg, float maxtime, qboolean botRoamsOnly); int32_t(*BotTouchingGoal)(vec3_t origin, struct bot_goal_s* goal);
int (*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);
int (*BotItemGoalInVisButNotVisible)(int 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);
int (*BotGetLevelItemGoal)(int index, char *classname, struct bot_goal_s *goal); int32_t(*BotGetNextCampSpotGoal)(int32_t num, struct bot_goal_s* goal);
int (*BotGetNextCampSpotGoal)(int num, struct bot_goal_s *goal); int32_t(*BotGetMapLocationGoal)(char* name, struct bot_goal_s* goal);
int (*BotGetMapLocationGoal)(char *name, struct bot_goal_s *goal); double(*BotAvoidGoalTime)(int32_t goalstate, int32_t number);
float (*BotAvoidGoalTime)(int goalstate, int number);
void(*BotInitLevelItems)(void); void(*BotInitLevelItems)(void);
void(*BotUpdateEntityItems)(void); void(*BotUpdateEntityItems)(void);
int (*BotLoadItemWeights)(int goalstate, char *filename); int32_t(*BotLoadItemWeights)(int32_t goalstate, char* filename);
void (*BotFreeItemWeights)(int goalstate); void(*BotFreeItemWeights)(int32_t goalstate);
void (*BotInterbreedGoalFuzzyLogic)(int parent1, int parent2, int child); void(*BotInterbreedGoalFuzzyLogic)(int32_t parent1, int32_t parent2, int32_t child);
void (*BotSaveGoalFuzzyLogic)(int goalstate, char *filename); void(*BotSaveGoalFuzzyLogic)(int32_t goalstate, char* filename);
void (*BotMutateGoalFuzzyLogic)(int goalstate, float range); void(*BotMutateGoalFuzzyLogic)(int32_t goalstate, double range);
int (*BotAllocGoalState)(int client); int32_t(*BotAllocGoalState)(int32_t client);
void (*BotFreeGoalState)(int handle); void(*BotFreeGoalState)(int32_t handle);
//----------------------------------- //-----------------------------------
// be_ai_move.h // be_ai_move.h
//----------------------------------- //-----------------------------------
void (*BotResetMoveState)(int movestate); void(*BotResetMoveState)(int32_t movestate);
void (*BotMoveToGoal)(struct bot_moveresult_s *result, int movestate, struct bot_goal_s *goal, int travelflags); void(*BotMoveToGoal)(struct bot_moveresult_s* result, int32_t movestate, struct bot_goal_s* goal, int32_t travelflags);
int (*BotMoveInDirection)(int movestate, vec3_t dir, float speed, int type); int32_t(*BotMoveInDirection)(int32_t movestate, vec3_t dir, double speed, int32_t type);
void (*BotResetAvoidReach)(int movestate); void(*BotResetAvoidReach)(int32_t movestate);
void (*BotResetLastAvoidReach)(int movestate); void(*BotResetLastAvoidReach)(int32_t movestate);
int (*BotReachabilityArea)(vec3_t origin, int testground); int32_t(*BotReachabilityArea)(vec3_t origin, int32_t testground);
int (*BotMovementViewTarget)(int movestate, struct bot_goal_s *goal, int travelflags, float lookahead, vec3_t target); int32_t(*BotMovementViewTarget)(int32_t movestate, struct bot_goal_s* goal, int32_t travelflags, double lookahead, vec3_t target);
int (*BotPredictVisiblePosition)(vec3_t origin, int areanum, struct bot_goal_s *goal, int travelflags, vec3_t target); int32_t(*BotPredictVisiblePosition)(vec3_t origin, int32_t areanum, struct bot_goal_s* goal, int32_t travelflags, vec3_t target);
int (*BotAllocMoveState)(void); int32_t(*BotAllocMoveState)(void);
void (*BotFreeMoveState)(int handle); void(*BotFreeMoveState)(int32_t handle);
void (*BotInitMoveState)(int handle, struct bot_initmove_s *initmove); void(*BotInitMoveState)(int32_t handle, struct bot_initmove_s* initmove);
//----------------------------------- //-----------------------------------
// be_ai_weap.h // be_ai_weap.h
//----------------------------------- //-----------------------------------
int (*BotChooseBestFightWeapon)(int weaponstate, int *inventory, qboolean meleeRange); int32_t(*BotChooseBestFightWeapon)(int32_t weaponstate, int32_t* inventory, qboolean meleeRange);
void (*BotGetWeaponInfo)(int weaponstate, int weapon, struct weaponinfo_s *weaponinfo); void(*BotGetWeaponInfo)(int32_t weaponstate, int32_t weapon, struct weaponinfo_s* weaponinfo);
int (*BotLoadWeaponWeights)(int weaponstate, char *filename); int32_t(*BotLoadWeaponWeights)(int32_t weaponstate, char* filename);
int (*BotAllocWeaponState)(void); int32_t(*BotAllocWeaponState)(void);
void (*BotFreeWeaponState)(int weaponstate); void(*BotFreeWeaponState)(int32_t weaponstate);
void (*BotResetWeaponState)(int weaponstate); void(*BotResetWeaponState)(int32_t weaponstate);
//----------------------------------- //-----------------------------------
// be_ai_gen.h // 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; } ai_export_t;
/** /**
* bot AI library imported functions * bot AI library imported functions
*/ */
typedef struct botlib_export_s typedef struct botlib_export_s {
{
//!Area Awareness System functions //!Area Awareness System functions
aas_export_t aas; aas_export_t aas;
//!Elementary Action functions //!Elementary Action functions
ea_export_t ea; ea_export_t ea;
//!AI functions //!AI functions
ai_export_t ai; ai_export_t ai;
//!setup the bot library, returns BLERR_ //!setup the bot library, returns BLERR_
int (*BotLibSetup)(void); int32_t(*BotLibSetup)(void);
//!shutdown the bot library, returns BLERR_ //!shutdown the bot library, returns BLERR_
int (*BotLibShutdown)(void); int32_t(*BotLibShutdown)(void);
//!sets a library variable returns BLERR_ //!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_ //!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_ //!sets a C-like define returns BLERR_
int (*BotLibDefine)(char *string); int32_t(*BotLibDefine)(char* string);
//!start a frame in the bot library //!start a frame in the bot library
int (*BotLibStartFrame)(float time); int32_t(*BotLibStartFrame)(double time);
//!load a new map in the bot library //!load a new map in the bot library
int (*BotLibLoadMap)(const char *mapname); int32_t(*BotLibLoadMap)(const char* mapname);
//!entity updates //!entity updates
int (*BotLibUpdateEntity)(int ent, bot_entitystate_t *state); int32_t(*BotLibUpdateEntity)(int32_t ent, bot_entitystate_t* state);
//!just for testing //!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; } botlib_export_t;
//linking of bot library //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: /* Library variables: