This commit is contained in:
Walter Julius Hennecke 2014-03-09 23:49:29 +01:00
parent 7b03b70668
commit d4d5f3f521
20 changed files with 2492 additions and 2517 deletions

View File

@ -15,31 +15,31 @@
*****************************************************************************/ *****************************************************************************/
// //
int BotChat_EnterGame(bot_state_t *bs); int BotChat_EnterGame(bot_state_t* bs);
// //
int BotChat_ExitGame(bot_state_t *bs); int BotChat_ExitGame(bot_state_t* bs);
// //
int BotChat_StartLevel(bot_state_t *bs); int BotChat_StartLevel(bot_state_t* bs);
// //
int BotChat_EndLevel(bot_state_t *bs); int BotChat_EndLevel(bot_state_t* bs);
// //
int BotChat_HitTalking(bot_state_t *bs); int BotChat_HitTalking(bot_state_t* bs);
// //
int BotChat_HitNoDeath(bot_state_t *bs); int BotChat_HitNoDeath(bot_state_t* bs);
// //
int BotChat_HitNoKill(bot_state_t *bs); int BotChat_HitNoKill(bot_state_t* bs);
// //
int BotChat_Death(bot_state_t *bs); int BotChat_Death(bot_state_t* bs);
// //
int BotChat_Kill(bot_state_t *bs); int BotChat_Kill(bot_state_t* bs);
// //
int BotChat_EnemySuicide(bot_state_t *bs); int BotChat_EnemySuicide(bot_state_t* bs);
// //
int BotChat_Random(bot_state_t *bs); int BotChat_Random(bot_state_t* bs);
// time the selected chat takes to type in // time the selected chat takes to type in
float BotChatTime(bot_state_t *bs); float BotChatTime(bot_state_t* bs);
// returns true if the bot can chat at the current position // returns true if the bot can chat at the current position
int BotValidChatPosition(bot_state_t *bs); int BotValidChatPosition(bot_state_t* bs);
// test the initial bot chats // test the initial bot chats
void BotChatTest(bot_state_t *bs); void BotChatTest(bot_state_t* bs);

View File

@ -16,6 +16,6 @@
extern int notleader[MAX_CLIENTS]; extern int notleader[MAX_CLIENTS];
int BotMatchMessage(bot_state_t *bs, char *message); int BotMatchMessage(bot_state_t* bs, char* message);
void BotPrintTeamGoal(bot_state_t *bs); void BotPrintTeamGoal(bot_state_t* bs);

View File

@ -16,29 +16,29 @@
#define MAX_NODESWITCHES 50 #define MAX_NODESWITCHES 50
void AIEnter_Intermission(bot_state_t *bs, const char *s); void AIEnter_Intermission(bot_state_t* bs, const char* s);
void AIEnter_Observer(bot_state_t *bs, const char *s); void AIEnter_Observer(bot_state_t* bs, const char* s);
void AIEnter_Respawn(bot_state_t *bs, const char *s); void AIEnter_Respawn(bot_state_t* bs, const char* s);
void AIEnter_Stand(bot_state_t *bs, const char *s); void AIEnter_Stand(bot_state_t* bs, const char* s);
void AIEnter_Seek_ActivateEntity(bot_state_t *bs, const char *s); void AIEnter_Seek_ActivateEntity(bot_state_t* bs, const char* s);
void AIEnter_Seek_NBG(bot_state_t *bs, const char *s); void AIEnter_Seek_NBG(bot_state_t* bs, const char* s);
void AIEnter_Seek_LTG(bot_state_t *bs, const char *s); void AIEnter_Seek_LTG(bot_state_t* bs, const char* s);
void AIEnter_Battle_Fight(bot_state_t *bs, const char *s); void AIEnter_Battle_Fight(bot_state_t* bs, const char* s);
void AIEnter_Battle_Chase(bot_state_t *bs, const char *s); void AIEnter_Battle_Chase(bot_state_t* bs, const char* s);
void AIEnter_Battle_Retreat(bot_state_t *bs, const char *s); void AIEnter_Battle_Retreat(bot_state_t* bs, const char* s);
void AIEnter_Battle_NBG(bot_state_t *bs, const char *s); void AIEnter_Battle_NBG(bot_state_t* bs, const char* s);
int AINode_Intermission(bot_state_t *bs); int AINode_Intermission(bot_state_t* bs);
int AINode_Observer(bot_state_t *bs); int AINode_Observer(bot_state_t* bs);
int AINode_Respawn(bot_state_t *bs); int AINode_Respawn(bot_state_t* bs);
int AINode_Stand(bot_state_t *bs); int AINode_Stand(bot_state_t* bs);
int AINode_Seek_ActivateEntity(bot_state_t *bs); int AINode_Seek_ActivateEntity(bot_state_t* bs);
int AINode_Seek_NBG(bot_state_t *bs); int AINode_Seek_NBG(bot_state_t* bs);
int AINode_Seek_LTG(bot_state_t *bs); int AINode_Seek_LTG(bot_state_t* bs);
int AINode_Battle_Fight(bot_state_t *bs); int AINode_Battle_Fight(bot_state_t* bs);
int AINode_Battle_Chase(bot_state_t *bs); int AINode_Battle_Chase(bot_state_t* bs);
int AINode_Battle_Retreat(bot_state_t *bs); int AINode_Battle_Retreat(bot_state_t* bs);
int AINode_Battle_NBG(bot_state_t *bs); int AINode_Battle_NBG(bot_state_t* bs);
void BotResetNodeSwitches(void); void BotResetNodeSwitches(void);
void BotDumpNodeSwitches(bot_state_t *bs); void BotDumpNodeSwitches(bot_state_t* bs);

View File

@ -19,148 +19,148 @@ void BotSetupDeathmatchAI(void);
//shutdown the deathmatch AI //shutdown the deathmatch AI
void BotShutdownDeathmatchAI(void); void BotShutdownDeathmatchAI(void);
//let the bot live within it's deathmatch AI net //let the bot live within it's deathmatch AI net
void BotDeathmatchAI(bot_state_t *bs, float thinktime); void BotDeathmatchAI(bot_state_t* bs, float thinktime);
//free waypoints //free waypoints
void BotFreeWaypoints(bot_waypoint_t *wp); void BotFreeWaypoints(bot_waypoint_t* wp);
//choose a weapon //choose a weapon
void BotChooseWeapon(bot_state_t *bs); void BotChooseWeapon(bot_state_t* bs);
//setup movement stuff //setup movement stuff
void BotSetupForMovement(bot_state_t *bs); void BotSetupForMovement(bot_state_t* bs);
//update the inventory //update the inventory
void BotUpdateInventory(bot_state_t *bs); void BotUpdateInventory(bot_state_t* bs);
//update the inventory during battle //update the inventory during battle
void BotUpdateBattleInventory(bot_state_t *bs, int enemy); void BotUpdateBattleInventory(bot_state_t* bs, int enemy);
//use holdable items during battle //use holdable items during battle
void BotBattleUseItems(bot_state_t *bs); void BotBattleUseItems(bot_state_t* bs);
//return true if the bot is dead //return true if the bot is dead
qboolean BotIsDead(bot_state_t *bs); qboolean BotIsDead(bot_state_t* bs);
//returns true if the bot is in observer mode //returns true if the bot is in observer mode
qboolean BotIsObserver(bot_state_t *bs); qboolean BotIsObserver(bot_state_t* bs);
//returns true if the bot is in the intermission //returns true if the bot is in the intermission
qboolean BotIntermission(bot_state_t *bs); qboolean BotIntermission(bot_state_t* bs);
//returns true if the bot is in lava or slime //returns true if the bot is in lava or slime
qboolean BotInLavaOrSlime(bot_state_t *bs); qboolean BotInLavaOrSlime(bot_state_t* bs);
//returns true if the entity is dead //returns true if the entity is dead
qboolean EntityIsDead(aas_entityinfo_t *entinfo); qboolean EntityIsDead(aas_entityinfo_t* entinfo);
//returns true if the entity is invisible //returns true if the entity is invisible
qboolean EntityIsInvisible(aas_entityinfo_t *entinfo); qboolean EntityIsInvisible(aas_entityinfo_t* entinfo);
//returns true if the entity is shooting //returns true if the entity is shooting
qboolean EntityIsShooting(aas_entityinfo_t *entinfo); qboolean EntityIsShooting(aas_entityinfo_t* entinfo);
#ifdef MISSIONPACK #ifdef MISSIONPACK
//returns true if this entity has the kamikaze //returns true if this entity has the kamikaze
qboolean EntityHasKamikaze(aas_entityinfo_t *entinfo); qboolean EntityHasKamikaze(aas_entityinfo_t* entinfo);
#endif #endif
// set a user info key/value pair // set a user info key/value pair
void BotSetUserInfo(bot_state_t *bs, char *key, char *value); void BotSetUserInfo(bot_state_t* bs, char* key, char* value);
// set the team status (offense, defense etc.) // set the team status (offense, defense etc.)
void BotSetTeamStatus(bot_state_t *bs); void BotSetTeamStatus(bot_state_t* bs);
//returns the name of the client //returns the name of the client
char *ClientName(int client, char *name, int size); char* ClientName(int client, char* name, int size);
//returns an simplyfied client name //returns an simplyfied client name
char *EasyClientName(int client, char *name, int size); char* EasyClientName(int client, char* name, int size);
//returns the skin used by the client //returns the skin used by the client
char *ClientSkin(int client, char *skin, int size); char* ClientSkin(int client, char* skin, int size);
// returns the appropriate synonym context for the current game type and situation // returns the appropriate synonym context for the current game type and situation
int BotSynonymContext(bot_state_t *bs); int BotSynonymContext(bot_state_t* bs);
// set last ordered task // set last ordered task
int BotSetLastOrderedTask(bot_state_t *bs); int BotSetLastOrderedTask(bot_state_t* bs);
// selection of goals for teamplay // selection of goals for teamplay
void BotTeamGoals(bot_state_t *bs, int retreat); void BotTeamGoals(bot_state_t* bs, int retreat);
//returns the aggression of the bot in the range [0, 100] //returns the aggression of the bot in the range [0, 100]
float BotAggression(bot_state_t *bs); float BotAggression(bot_state_t* bs);
//returns how bad the bot feels //returns how bad the bot feels
float BotFeelingBad(bot_state_t *bs); float BotFeelingBad(bot_state_t* bs);
//returns true if the bot wants to retreat //returns true if the bot wants to retreat
int BotWantsToRetreat(bot_state_t *bs); int BotWantsToRetreat(bot_state_t* bs);
//returns true if the bot wants to chase //returns true if the bot wants to chase
int BotWantsToChase(bot_state_t *bs); int BotWantsToChase(bot_state_t* bs);
//returns true if the bot wants to help //returns true if the bot wants to help
int BotWantsToHelp(bot_state_t *bs); int BotWantsToHelp(bot_state_t* bs);
//returns true if the bot can and wants to rocketjump //returns true if the bot can and wants to rocketjump
int BotCanAndWantsToRocketJump(bot_state_t *bs); int BotCanAndWantsToRocketJump(bot_state_t* bs);
// returns true if the bot has a persistant powerup and a weapon // returns true if the bot has a persistant powerup and a weapon
int BotHasPersistantPowerupAndWeapon(bot_state_t *bs); int BotHasPersistantPowerupAndWeapon(bot_state_t* bs);
//returns true if the bot wants to and goes camping //returns true if the bot wants to and goes camping
int BotWantsToCamp(bot_state_t *bs); int BotWantsToCamp(bot_state_t* bs);
//the bot will perform attack movements //the bot will perform attack movements
bot_moveresult_t BotAttackMove(bot_state_t *bs, int tfl); bot_moveresult_t BotAttackMove(bot_state_t* bs, int tfl);
//returns true if the bot and the entity are in the same team //returns true if the bot and the entity are in the same team
int BotSameTeam(bot_state_t *bs, int entnum); int BotSameTeam(bot_state_t* bs, int entnum);
//returns true if teamplay is on //returns true if teamplay is on
int TeamPlayIsOn(void); int TeamPlayIsOn(void);
// returns the client number of the team mate flag carrier (-1 if none) // returns the client number of the team mate flag carrier (-1 if none)
int BotTeamFlagCarrier(bot_state_t *bs); int BotTeamFlagCarrier(bot_state_t* bs);
//returns visible team mate flag carrier if available //returns visible team mate flag carrier if available
int BotTeamFlagCarrierVisible(bot_state_t *bs); int BotTeamFlagCarrierVisible(bot_state_t* bs);
//returns visible enemy flag carrier if available //returns visible enemy flag carrier if available
int BotEnemyFlagCarrierVisible(bot_state_t *bs); int BotEnemyFlagCarrierVisible(bot_state_t* bs);
//get the number of visible teammates and enemies //get the number of visible teammates and enemies
void BotVisibleTeamMatesAndEnemies(bot_state_t *bs, int *teammates, int *enemies, float range); void BotVisibleTeamMatesAndEnemies(bot_state_t* bs, int* teammates, int* enemies, float range);
//returns true if within the field of vision for the given angles //returns true if within the field of vision for the given angles
qboolean InFieldOfVision(vec3_t viewangles, float fov, vec3_t angles); qboolean InFieldOfVision(vec3_t viewangles, float fov, vec3_t angles);
//returns true and sets the .enemy field when an enemy is found //returns true and sets the .enemy field when an enemy is found
int BotFindEnemy(bot_state_t *bs, int curenemy); int BotFindEnemy(bot_state_t* bs, int curenemy);
//returns a roam goal //returns a roam goal
void BotRoamGoal(bot_state_t *bs, vec3_t goal); void BotRoamGoal(bot_state_t* bs, vec3_t goal);
//returns entity visibility in the range [0, 1] //returns entity visibility in the range [0, 1]
float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int ent); float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int ent);
//the bot will aim at the current enemy //the bot will aim at the current enemy
void BotAimAtEnemy(bot_state_t *bs); void BotAimAtEnemy(bot_state_t* bs);
//check if the bot should attack //check if the bot should attack
void BotCheckAttack(bot_state_t *bs); void BotCheckAttack(bot_state_t* bs);
//AI when the bot is blocked //AI when the bot is blocked
void BotAIBlocked(bot_state_t *bs, bot_moveresult_t *moveresult, int activate); void BotAIBlocked(bot_state_t* bs, bot_moveresult_t* moveresult, int activate);
//AI to predict obstacles //AI to predict obstacles
int BotAIPredictObstacles(bot_state_t *bs, bot_goal_t *goal); int BotAIPredictObstacles(bot_state_t* bs, bot_goal_t* goal);
//enable or disable the areas the blocking entity is in //enable or disable the areas the blocking entity is in
void BotEnableActivateGoalAreas(bot_activategoal_t *activategoal, int enable); void BotEnableActivateGoalAreas(bot_activategoal_t* activategoal, int enable);
//pop an activate goal from the stack //pop an activate goal from the stack
int BotPopFromActivateGoalStack(bot_state_t *bs); int BotPopFromActivateGoalStack(bot_state_t* bs);
//clear the activate goal stack //clear the activate goal stack
void BotClearActivateGoalStack(bot_state_t *bs); void BotClearActivateGoalStack(bot_state_t* bs);
//returns the team the bot is in //returns the team the bot is in
int BotTeam(bot_state_t *bs); int BotTeam(bot_state_t* bs);
//retuns the opposite team of the bot //retuns the opposite team of the bot
int BotOppositeTeam(bot_state_t *bs); int BotOppositeTeam(bot_state_t* bs);
//returns the flag the bot is carrying (CTFFLAG_?) //returns the flag the bot is carrying (CTFFLAG_?)
int BotCTFCarryingFlag(bot_state_t *bs); int BotCTFCarryingFlag(bot_state_t* bs);
//remember the last ordered task //remember the last ordered task
void BotRememberLastOrderedTask(bot_state_t *bs); void BotRememberLastOrderedTask(bot_state_t* bs);
//set ctf goals (defend base, get enemy flag) during seek //set ctf goals (defend base, get enemy flag) during seek
void BotCTFSeekGoals(bot_state_t *bs); void BotCTFSeekGoals(bot_state_t* bs);
//set ctf goals (defend base, get enemy flag) during retreat //set ctf goals (defend base, get enemy flag) during retreat
void BotCTFRetreatGoals(bot_state_t *bs); void BotCTFRetreatGoals(bot_state_t* bs);
// //
#ifdef MISSIONPACK #ifdef MISSIONPACK
int Bot1FCTFCarryingFlag(bot_state_t *bs); int Bot1FCTFCarryingFlag(bot_state_t* bs);
int BotHarvesterCarryingCubes(bot_state_t *bs); int BotHarvesterCarryingCubes(bot_state_t* bs);
void Bot1FCTFSeekGoals(bot_state_t *bs); void Bot1FCTFSeekGoals(bot_state_t* bs);
void Bot1FCTFRetreatGoals(bot_state_t *bs); void Bot1FCTFRetreatGoals(bot_state_t* bs);
void BotObeliskSeekGoals(bot_state_t *bs); void BotObeliskSeekGoals(bot_state_t* bs);
void BotObeliskRetreatGoals(bot_state_t *bs); void BotObeliskRetreatGoals(bot_state_t* bs);
void BotGoHarvest(bot_state_t *bs); void BotGoHarvest(bot_state_t* bs);
void BotHarvesterSeekGoals(bot_state_t *bs); void BotHarvesterSeekGoals(bot_state_t* bs);
void BotHarvesterRetreatGoals(bot_state_t *bs); void BotHarvesterRetreatGoals(bot_state_t* bs);
int BotTeamCubeCarrierVisible(bot_state_t *bs); int BotTeamCubeCarrierVisible(bot_state_t* bs);
int BotEnemyCubeCarrierVisible(bot_state_t *bs); int BotEnemyCubeCarrierVisible(bot_state_t* bs);
#endif #endif
//get a random alternate route goal towards the given base //get a random alternate route goal towards the given base
int BotGetAlternateRouteGoal(bot_state_t *bs, int base); int BotGetAlternateRouteGoal(bot_state_t* bs, int base);
//returns either the alternate route goal or the given goal //returns either the alternate route goal or the given goal
bot_goal_t *BotAlternateRoute(bot_state_t *bs, bot_goal_t *goal); bot_goal_t* BotAlternateRoute(bot_state_t* bs, bot_goal_t* goal);
//create a new waypoint //create a new waypoint
bot_waypoint_t *BotCreateWayPoint(char *name, vec3_t origin, int areanum); bot_waypoint_t* BotCreateWayPoint(char* name, vec3_t origin, int areanum);
//find a waypoint with the given name //find a waypoint with the given name
bot_waypoint_t *BotFindWayPoint(bot_waypoint_t *waypoints, char *name); bot_waypoint_t* BotFindWayPoint(bot_waypoint_t* waypoints, char* name);
//strstr but case insensitive //strstr but case insensitive
char *stristr(char *str, char *charset); char* stristr(char* str, char* charset);
//returns the number of the client with the given name //returns the number of the client with the given name
int ClientFromName(char *name); int ClientFromName(char* name);
int ClientOnSameTeamFromName(bot_state_t *bs, char *name); int ClientOnSameTeamFromName(bot_state_t* bs, char* name);
// //
int BotPointAreaNum(vec3_t origin); int BotPointAreaNum(vec3_t origin);
// //
void BotMapScripts(bot_state_t *bs); void BotMapScripts(bot_state_t* bs);
//ctf flags //ctf flags
#define CTF_FLAG_NONE 0 #define CTF_FLAG_NONE 0

View File

@ -76,19 +76,18 @@
#define MAX_PROXMINES 64 #define MAX_PROXMINES 64
//check points //check points
typedef struct bot_waypoint_s typedef struct bot_waypoint_s {
{
int inuse; int inuse;
char name[32]; char name[32];
bot_goal_t goal; bot_goal_t goal;
struct bot_waypoint_s *next, *prev; struct bot_waypoint_s* next;
struct bot_waypoint_s* prev;
} bot_waypoint_t; } bot_waypoint_t;
#define MAX_ACTIVATESTACK 8 #define MAX_ACTIVATESTACK 8
#define MAX_ACTIVATEAREAS 32 #define MAX_ACTIVATEAREAS 32
typedef struct bot_activategoal_s typedef struct bot_activategoal_s {
{
int inuse; int inuse;
bot_goal_t goal; //goal to activate (buttons etc.) bot_goal_t goal; //goal to activate (buttons etc.)
float time; //time to activate something float time; //time to activate something
@ -101,12 +100,11 @@ typedef struct bot_activategoal_s
int areas[MAX_ACTIVATEAREAS]; //routing areas disabled by blocking entity int areas[MAX_ACTIVATEAREAS]; //routing areas disabled by blocking entity
int numareas; //number of disabled routing areas int numareas; //number of disabled routing areas
int areasdisabled; //true if the areas are disabled for the routing int areasdisabled; //true if the areas are disabled for the routing
struct bot_activategoal_s *next; //next activate goal on stack struct bot_activategoal_s* next; //next activate goal on stack
} bot_activategoal_t; } bot_activategoal_t;
//bot state //bot state
typedef struct bot_state_s typedef struct bot_state_s {
{
int inuse; //true if this state is used by a bot client int inuse; //true if this state is used by a bot client
int botthink_residual; //residual for the bot thinks int botthink_residual; //residual for the bot thinks
int client; //client number of the bot int client; //client number of the bot
@ -117,7 +115,7 @@ typedef struct bot_state_s
int entityeventTime[1024]; //last entity event time int entityeventTime[1024]; //last entity event time
// //
bot_settings_t settings; //several bot settings bot_settings_t settings; //several bot settings
int (*ainode)(struct bot_state_s *bs); //current AI node int(*ainode)(struct bot_state_s* bs); //current AI node
float thinktime; //time the bot thinks this frame float thinktime; //time the bot thinks this frame
vec3_t origin; //origin of the bot vec3_t origin; //origin of the bot
vec3_t velocity; //velocity of the bot vec3_t velocity; //velocity of the bot
@ -256,31 +254,31 @@ typedef struct bot_state_s
vec3_t formation_origin; //origin the bot uses for relative positioning vec3_t formation_origin; //origin the bot uses for relative positioning
bot_goal_t formation_goal; //formation goal bot_goal_t formation_goal; //formation goal
bot_activategoal_t *activatestack; //first activate goal on the stack bot_activategoal_t* activatestack; //first activate goal on the stack
bot_activategoal_t activategoalheap[MAX_ACTIVATESTACK]; //activate goal heap bot_activategoal_t activategoalheap[MAX_ACTIVATESTACK]; //activate goal heap
bot_waypoint_t *checkpoints; //check points bot_waypoint_t* checkpoints; //check points
bot_waypoint_t *patrolpoints; //patrol points bot_waypoint_t* patrolpoints; //patrol points
bot_waypoint_t *curpatrolpoint; //current patrol point the bot is going for bot_waypoint_t* curpatrolpoint; //current patrol point the bot is going for
int patrolflags; //patrol flags int patrolflags; //patrol flags
} bot_state_t; } bot_state_t;
//resets the whole bot state //resets the whole bot state
void BotResetState(bot_state_t *bs); void BotResetState(bot_state_t* bs);
//returns the number of bots in the game //returns the number of bots in the game
int NumBots(void); int NumBots(void);
//returns info about the entity //returns info about the entity
void BotEntityInfo(int entnum, aas_entityinfo_t *info); void BotEntityInfo(int entnum, aas_entityinfo_t* info);
extern float floattime; extern float floattime;
#define FloatTime() level.time #define FloatTime() level.time
// from the game source // from the game source
void QDECL BotAI_Print(int type, const char *fmt, ...); void QDECL BotAI_Print(int type, const char* fmt, ...);
void QDECL QDECL BotAI_BotInitialChat( bot_state_t *bs, const char *type, ... ); void QDECL QDECL BotAI_BotInitialChat(bot_state_t* bs, const char* type, ...);
void BotAI_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask); void BotAI_Trace(bsp_trace_t* bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
int BotAI_GetClientState( int clientNum, playerState_t *state ); int BotAI_GetClientState(int clientNum, playerState_t* state);
int BotAI_GetEntityState( int entityNum, entityState_t *state ); int BotAI_GetEntityState(int entityNum, entityState_t* state);
int BotAI_GetSnapshotEntity( int clientNum, int sequence, entityState_t *state ); int BotAI_GetSnapshotEntity(int clientNum, int sequence, entityState_t* state);
int BotTeamLeader(bot_state_t *bs); int BotTeamLeader(bot_state_t* bs);
#endif // __AI_MAIN__ #endif // __AI_MAIN__

View File

@ -14,10 +14,10 @@
* *
*****************************************************************************/ *****************************************************************************/
void BotTeamAI(bot_state_t *bs); void BotTeamAI(bot_state_t* bs);
int BotGetTeamMateTaskPreference(bot_state_t *bs, int teammate); int BotGetTeamMateTaskPreference(bot_state_t* bs, int teammate);
void BotSetTeamMateTaskPreference(bot_state_t *bs, int teammate, int preference); void BotSetTeamMateTaskPreference(bot_state_t* bs, int teammate, int preference);
void BotVoiceChat(bot_state_t *bs, int toclient, const char *voicechat); void BotVoiceChat(bot_state_t* bs, int toclient, const char* voicechat);
void BotVoiceChatOnly(bot_state_t *bs, int toclient, const char *voicechat); void BotVoiceChatOnly(bot_state_t* bs, int toclient, const char* voicechat);

View File

@ -14,7 +14,7 @@
* *
*****************************************************************************/ *****************************************************************************/
int BotVoiceChatCommand(bot_state_t *bs, int mode, char *voicechat); int BotVoiceChatCommand(bot_state_t* bs, int mode, char* voicechat);
void BotVoiceChat_Defend(bot_state_t *bs, int client, int mode); void BotVoiceChat_Defend(bot_state_t* bs, int client, int mode);

View File

@ -51,26 +51,25 @@
//default travel flags //default travel flags
#define TFL_DEFAULT TFL_WALK|TFL_CROUCH|TFL_BARRIERJUMP|\ #define TFL_DEFAULT TFL_WALK|TFL_CROUCH|TFL_BARRIERJUMP|\
TFL_JUMP|TFL_LADDER|\ TFL_JUMP | TFL_LADDER | \
TFL_WALKOFFLEDGE|TFL_SWIM|TFL_WATERJUMP|\ TFL_WALKOFFLEDGE | TFL_SWIM | TFL_WATERJUMP | \
TFL_TELEPORT|TFL_ELEVATOR|\ TFL_TELEPORT | TFL_ELEVATOR | \
TFL_AIR|TFL_WATER|TFL_JUMPPAD|TFL_FUNCBOB TFL_AIR | TFL_WATER | TFL_JUMPPAD | TFL_FUNCBOB
// already defined in g_public.h in tiki tech, moved to l_util.h so the botlib stuff compiles but the gamecode also compiles // already defined in g_public.h in tiki tech, moved to l_util.h so the botlib stuff compiles but the gamecode also compiles
/* /*
typedef enum typedef enum
{ {
SOLID_NOT, // no interaction with other objects SOLID_NOT, // no interaction with other objects
SOLID_TRIGGER, // only touch when inside, after moving SOLID_TRIGGER, // only touch when inside, after moving
SOLID_BBOX, // touch on edge SOLID_BBOX, // touch on edge
SOLID_BSP // bsp clip, touch on edge SOLID_BSP // bsp clip, touch on edge
} solid_t; } solid_t;
*/ */
//a trace is returned when a box is swept through the AAS world //a trace is returned when a box is swept through the AAS world
typedef struct aas_trace_s typedef struct aas_trace_s {
{ 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 float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position vec3_t endpos; // final position
int ent; // entity blocking the trace int ent; // entity blocking the trace
@ -85,32 +84,31 @@ typedef struct aas_trace_s
/* /*
typedef struct bsp_surface_s typedef struct bsp_surface_s
{ {
char name[16]; char name[16];
int flags; int flags;
int value; int value;
} bsp_surface_t; } bsp_surface_t;
//a trace is returned when a box is swept through the BSP world //a trace is returned when a box is swept through the BSP 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 float 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 float exp_dist; // expanded plane distance
int sidenum; // number of the brush side hit int sidenum; // number of the brush side hit
bsp_surface_t surface; // hit surface bsp_surface_t surface; // hit surface
int contents; // contents on other side of surface hit int contents; // contents on other side of surface hit
int ent; // number of entity hit int ent; // number of entity hit
} bsp_trace_t; } bsp_trace_t;
*/ */
// //
//entity info //entity info
typedef struct aas_entityinfo_s typedef struct aas_entityinfo_s {
{
int valid; // true if updated this frame int valid; // true if updated this frame
int type; // entity type int type; // entity type
int flags; // entity flags int flags; // entity flags
@ -137,8 +135,7 @@ typedef struct aas_entityinfo_s
} aas_entityinfo_t; } aas_entityinfo_t;
// area info // area info
typedef struct aas_areainfo_s typedef struct aas_areainfo_s {
{
int contents; int contents;
int flags; int flags;
int presencetype; int presencetype;
@ -164,8 +161,7 @@ typedef struct aas_areainfo_s
#define SE_HITBOUNDINGBOX 2048 // hit the specified bounding box #define SE_HITBOUNDINGBOX 2048 // hit the specified bounding box
#define SE_TOUCHCLUSTERPORTAL 4096 // touching a cluster portal #define SE_TOUCHCLUSTERPORTAL 4096 // touching a cluster portal
typedef struct aas_clientmove_s typedef struct aas_clientmove_s {
{
vec3_t endpos; //position at the end of movement prediction vec3_t endpos; //position at the end of movement prediction
int endarea; //area at end of movement prediction int endarea; //area at end of movement prediction
vec3_t velocity; //velocity at the end of movement prediction vec3_t velocity; //velocity at the end of movement prediction
@ -182,8 +178,7 @@ typedef struct aas_clientmove_s
#define ALTROUTEGOAL_CLUSTERPORTALS 2 #define ALTROUTEGOAL_CLUSTERPORTALS 2
#define ALTROUTEGOAL_VIEWPORTALS 4 #define ALTROUTEGOAL_VIEWPORTALS 4
typedef struct aas_altroutegoal_s typedef struct aas_altroutegoal_s {
{
vec3_t origin; vec3_t origin;
int areanum; int areanum;
unsigned short starttraveltime; unsigned short starttraveltime;
@ -198,8 +193,7 @@ typedef struct aas_altroutegoal_s
#define RSE_ENTERCONTENTS 4 //stop when entering the given contents #define RSE_ENTERCONTENTS 4 //stop when entering the given contents
#define RSE_ENTERAREA 8 //stop when entering the given area #define RSE_ENTERAREA 8 //stop when entering the given area
typedef struct aas_predictroute_s typedef struct aas_predictroute_s {
{
vec3_t endpos; //position at the end of movement prediction vec3_t endpos; //position at the end of movement prediction
int endarea; //area at end of movement prediction int endarea; //area at end of movement prediction
int stopevent; //event that made the prediction stop int stopevent; //event that made the prediction stop

View File

@ -15,7 +15,7 @@
*****************************************************************************/ *****************************************************************************/
//loads a bot character from a file //loads a bot character from a file
int BotLoadCharacter(char *charfile, float skill); int BotLoadCharacter(char* charfile, float skill);
//frees a bot character //frees a bot character
void BotFreeCharacter(int character); void BotFreeCharacter(int character);
//returns a float characteristic //returns a float characteristic
@ -27,6 +27,6 @@ int Characteristic_Integer(int character, int index);
//returns a bounded integer characteristic //returns a bounded integer characteristic
int Characteristic_BInteger(int character, int index, int min, int max); int Characteristic_BInteger(int character, int index, int min, int max);
//returns a string characteristic //returns a string characteristic
void Characteristic_String(int character, int index, char *buf, int size); void Characteristic_String(int character, int index, char* buf, int size);
//free cached bot characters //free cached bot characters
void BotShutdownCharacters(void); void BotShutdownCharacters(void);

View File

@ -26,24 +26,22 @@
#define CHAT_TELL 2 #define CHAT_TELL 2
//a console message //a console message
typedef struct bot_consolemessage_s typedef struct bot_consolemessage_s {
{
int handle; int handle;
float time; //message time float time; //message time
int type; //message type int type; //message type
char message[MAX_MESSAGE_SIZE]; //message char message[MAX_MESSAGE_SIZE]; //message
struct bot_consolemessage_s *prev, *next; //prev and next in list struct bot_consolemessage_s* prev; // prev in list
struct bot_consolemessage_s* next; // next in list
} bot_consolemessage_t; } bot_consolemessage_t;
//match variable //match variable
typedef struct bot_matchvariable_s typedef struct bot_matchvariable_s {
{
char offset; char offset;
int length; int length;
} bot_matchvariable_t; } bot_matchvariable_t;
//returned to AI when a match is found //returned to AI when a match is found
typedef struct bot_match_s typedef struct bot_match_s {
{
char string[MAX_MESSAGE_SIZE]; char string[MAX_MESSAGE_SIZE];
int type; int type;
int subtype; int subtype;
@ -59,39 +57,39 @@ int BotAllocChatState(void);
//frees the chatstate //frees the chatstate
void BotFreeChatState(int handle); void BotFreeChatState(int handle);
//adds a console message to the chat state //adds a console message to the chat state
void BotQueueConsoleMessage(int chatstate, int type, char *message); void BotQueueConsoleMessage(int chatstate, int type, char* message);
//removes the console message from the chat state //removes the console message from the chat state
void BotRemoveConsoleMessage(int chatstate, int handle); void BotRemoveConsoleMessage(int chatstate, int handle);
//returns the next console message from the state //returns the next console message from the state
int BotNextConsoleMessage(int chatstate, bot_consolemessage_t *cm); int BotNextConsoleMessage(int chatstate, bot_consolemessage_t* cm);
//returns the number of console messages currently stored in the state //returns the number of console messages currently stored in the state
int BotNumConsoleMessages(int chatstate); int BotNumConsoleMessages(int chatstate);
//selects a chat message of the given type //selects a chat message of the given type
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(int chatstate, char* type, int mcontext, char* var0, char* var1, char* var2, char* var3, char* var4, char* var5, char* var6, char* var7);
//returns the number of initial chat messages of the given type //returns the number of initial chat messages of the given type
int BotNumInitialChats(int chatstate, char *type); int BotNumInitialChats(int chatstate, char* type);
//find and select a reply for the given message //find and select a reply for the given message
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 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);
//returns the length of the currently selected chat message //returns the length of the currently selected chat message
int BotChatLength(int chatstate); int BotChatLength(int chatstate);
//enters the selected chat message //enters the selected chat message
void BotEnterChat(int chatstate, int clientto, int sendto); void BotEnterChat(int chatstate, int clientto, int sendto);
//get the chat message ready to be output //get the chat message ready to be output
void BotGetChatMessage(int chatstate, char *buf, int size); void BotGetChatMessage(int chatstate, char* buf, int size);
//checks if the first string contains the second one, returns index into first string or -1 if not found //checks if the first string contains the second one, returns index into first string or -1 if not found
int StringContains(char *str1, char *str2, int casesensitive); int StringContains(char* str1, char* str2, int casesensitive);
//finds a match for the given string using the match templates //finds a match for the given string using the match templates
int BotFindMatch(char *str, bot_match_t *match, unsigned long int context); int BotFindMatch(char* str, bot_match_t* match, unsigned long int context);
//returns a variable from a match //returns a variable from a match
void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size); void BotMatchVariable(bot_match_t* match, int variable, char* buf, int size);
//unify all the white spaces in the string //unify all the white spaces in the string
void UnifyWhiteSpaces(char *string); void UnifyWhiteSpaces(char* string);
//replace all the context related synonyms in the string //replace all the context related synonyms in the string
void BotReplaceSynonyms(char *string, unsigned long int context); void BotReplaceSynonyms(char* string, unsigned long int context);
//loads a chat file for the chat state //loads a chat file for the chat state
int BotLoadChatFile(int chatstate, char *chatfile, char *chatname); int BotLoadChatFile(int chatstate, char* chatfile, char* chatname);
//store the gender of the bot in the chat state //store the gender of the bot in the chat state
void BotSetChatGender(int chatstate, int gender); void BotSetChatGender(int chatstate, int gender);
//store the bot name in the chat state //store the bot name in the chat state
void BotSetChatName(int chatstate, char *name, int client); void BotSetChatName(int chatstate, char* name, int client);

View File

@ -14,4 +14,4 @@
* *
*****************************************************************************/ *****************************************************************************/
int GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child); int GeneticParentsAndChildSelection(int numranks, float* ranks, int* parent1, int* parent2, int* child);

View File

@ -22,8 +22,7 @@
#define GFL_DROPPED 4 #define GFL_DROPPED 4
//a bot goal //a bot goal
typedef struct bot_goal_s typedef struct bot_goal_s {
{
vec3_t origin; //origin of the goal vec3_t origin; //origin of the goal
int areanum; //area number of the goal int areanum; //area number of the goal
vec3_t mins, maxs; //mins and maxs of the goal vec3_t mins, maxs; //mins and maxs of the goal
@ -40,7 +39,7 @@ void BotResetAvoidGoals(int goalstate);
//remove the goal with the given number from the avoid goals //remove the goal with the given number from the avoid goals
void BotRemoveFromAvoidGoals(int goalstate, int number); void BotRemoveFromAvoidGoals(int goalstate, int number);
//push a goal onto the goal stack //push a goal onto the goal stack
void BotPushGoal(int goalstate, bot_goal_t *goal); void BotPushGoal(int goalstate, bot_goal_t* goal);
//pop a goal from the goal stack //pop a goal from the goal stack
void BotPopGoal(int goalstate); void BotPopGoal(int goalstate);
//empty the bot's goal stack //empty the bot's goal stack
@ -50,30 +49,30 @@ void BotDumpAvoidGoals(int goalstate);
//dump the goal stack //dump the goal stack
void BotDumpGoalStack(int goalstate); void BotDumpGoalStack(int goalstate);
//get the name name of the goal with the given number //get the name name of the goal with the given number
void BotGoalName(int number, char *name, int size); void BotGoalName(int number, char* name, int size);
//get the top goal from the stack //get the top goal from the stack
int BotGetTopGoal(int goalstate, bot_goal_t *goal); int BotGetTopGoal(int goalstate, bot_goal_t* goal);
//get the second goal on the stack //get the second goal on the stack
int BotGetSecondGoal(int goalstate, bot_goal_t *goal); int BotGetSecondGoal(int goalstate, bot_goal_t* goal);
//choose the best long term goal item for the bot //choose the best long term goal item for the bot
int BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags); int BotChooseLTGItem(int goalstate, vec3_t origin, int* inventory, int travelflags);
//choose the best nearby goal item for the bot //choose the best nearby goal item for the bot
//the item may not be further away from the current bot position than maxtime //the item may not be further away from the current bot position than maxtime
//also the travel time from the nearby goal towards the long term goal may not //also the travel time from the nearby goal towards the long term goal may not
//be larger than the travel time towards the long term goal from the current bot position //be larger than the travel time towards the long term goal from the current bot position
int BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, int BotChooseNBGItem(int goalstate, vec3_t origin, int* inventory, int travelflags,
bot_goal_t *ltg, float maxtime); bot_goal_t* ltg, float maxtime);
//returns true if the bot touches the goal //returns true if the bot touches the goal
int BotTouchingGoal(vec3_t origin, bot_goal_t *goal); int BotTouchingGoal(vec3_t origin, bot_goal_t* goal);
//returns true if the goal should be visible but isn't //returns true if the goal should be visible but isn't
int BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t *goal); int BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t* goal);
//search for a goal for the given classname, the index can be used //search for a goal for the given classname, the index can be used
//as a start point for the search when multiple goals are available with that same classname //as a start point for the search when multiple goals are available with that same classname
int BotGetLevelItemGoal(int index, char *classname, bot_goal_t *goal); int BotGetLevelItemGoal(int index, char* classname, bot_goal_t* goal);
//get the next camp spot in the map //get the next camp spot in the map
int BotGetNextCampSpotGoal(int num, bot_goal_t *goal); int BotGetNextCampSpotGoal(int num, bot_goal_t* goal);
//get the map location with the given name //get the map location with the given name
int BotGetMapLocationGoal(char *name, bot_goal_t *goal); int BotGetMapLocationGoal(char* name, bot_goal_t* goal);
//returns the avoid goal time //returns the avoid goal time
float BotAvoidGoalTime(int goalstate, int number); float BotAvoidGoalTime(int goalstate, int number);
//set the avoid goal time //set the avoid goal time
@ -85,11 +84,11 @@ void BotUpdateEntityItems(void);
//interbreed the goal fuzzy logic //interbreed the goal fuzzy logic
void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child); void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
//save the goal fuzzy logic to disk //save the goal fuzzy logic to disk
void BotSaveGoalFuzzyLogic(int goalstate, char *filename); void BotSaveGoalFuzzyLogic(int goalstate, char* filename);
//mutate the goal fuzzy logic //mutate the goal fuzzy logic
void BotMutateGoalFuzzyLogic(int goalstate, float range); void BotMutateGoalFuzzyLogic(int goalstate, float range);
//loads item weights for the bot //loads item weights for the bot
int BotLoadItemWeights(int goalstate, char *filename); int BotLoadItemWeights(int goalstate, char* filename);
//frees the item weights of the bot //frees the item weights of the bot
void BotFreeItemWeights(int goalstate); void BotFreeItemWeights(int goalstate);
//returns the handle of a newly allocated goal state //returns the handle of a newly allocated goal state

View File

@ -57,8 +57,7 @@
//structure used to initialize the movement state //structure used to initialize the movement state
//the or_moveflags MFL_ONGROUND, MFL_TELEPORTED and MFL_WATERJUMP come from the playerstate //the or_moveflags MFL_ONGROUND, MFL_TELEPORTED and MFL_WATERJUMP come from the playerstate
typedef struct bot_initmove_s typedef struct bot_initmove_s {
{
vec3_t origin; //origin of the bot vec3_t origin; //origin of the bot
vec3_t velocity; //velocity of the bot vec3_t velocity; //velocity of the bot
vec3_t viewoffset; //view offset vec3_t viewoffset; //view offset
@ -71,8 +70,7 @@ typedef struct bot_initmove_s
} bot_initmove_t; } bot_initmove_t;
//NOTE: the ideal_viewangles are only valid if MFL_MOVEMENTVIEW is set //NOTE: the ideal_viewangles are only valid if MFL_MOVEMENTVIEW is set
typedef struct bot_moveresult_s typedef struct bot_moveresult_s {
{
int failure; //true if movement failed all together int failure; //true if movement failed all together
int type; //failure or blocked type int type; //failure or blocked type
int blocked; //true if blocked by an entity int blocked; //true if blocked by an entity
@ -86,8 +84,7 @@ typedef struct bot_moveresult_s
// bk001204: from code/botlib/be_ai_move.c // bk001204: from code/botlib/be_ai_move.c
// TTimo 04/12/2001 was moved here to avoid dup defines // TTimo 04/12/2001 was moved here to avoid dup defines
typedef struct bot_avoidspot_s typedef struct bot_avoidspot_s {
{
vec3_t origin; vec3_t origin;
float radius; float radius;
int type; int type;
@ -96,7 +93,7 @@ typedef struct bot_avoidspot_s
//resets the whole move state //resets the whole move state
void BotResetMoveState(int movestate); void BotResetMoveState(int movestate);
//moves the bot to the given goal //moves the bot to the given goal
void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, int travelflags); void BotMoveToGoal(bot_moveresult_t* result, int movestate, bot_goal_t* goal, int travelflags);
//moves the bot in the specified direction using the specified type of movement //moves the bot in the specified direction using the specified type of movement
int BotMoveInDirection(int movestate, vec3_t dir, float speed, int type); int BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
//reset avoid reachability //reset avoid reachability
@ -106,15 +103,15 @@ void BotResetLastAvoidReach(int movestate);
//returns a reachability area if the origin is in one //returns a reachability area if the origin is in one
int BotReachabilityArea(vec3_t origin, int client); int BotReachabilityArea(vec3_t origin, int client);
//view target based on movement //view target based on movement
int BotMovementViewTarget(int movestate, bot_goal_t *goal, int travelflags, float lookahead, vec3_t target); int BotMovementViewTarget(int movestate, bot_goal_t* goal, int travelflags, float lookahead, vec3_t target);
//predict the position of a player based on movement towards a goal //predict the position of a player based on movement towards a goal
int BotPredictVisiblePosition(vec3_t origin, int areanum, bot_goal_t *goal, int travelflags, vec3_t target); int BotPredictVisiblePosition(vec3_t origin, int areanum, bot_goal_t* goal, int travelflags, vec3_t target);
//returns the handle of a newly allocated movestate //returns the handle of a newly allocated movestate
int BotAllocMoveState(void); int BotAllocMoveState(void);
//frees the movestate with the given handle //frees the movestate with the given handle
void BotFreeMoveState(int handle); void BotFreeMoveState(int handle);
//initialize movement state before performing any movement //initialize movement state before performing any movement
void BotInitMoveState(int handle, bot_initmove_t *initmove); void BotInitMoveState(int handle, bot_initmove_t* initmove);
//add a spot to avoid (if type == AVOID_CLEAR all spots are removed) //add a spot to avoid (if type == AVOID_CLEAR all spots are removed)
void BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type); void BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
//must be called every map change //must be called every map change

View File

@ -24,8 +24,7 @@
#define DAMAGETYPE_RADIAL 2 //radial damage #define DAMAGETYPE_RADIAL 2 //radial damage
#define DAMAGETYPE_VISIBLE 4 //damage to all entities visible to the projectile #define DAMAGETYPE_VISIBLE 4 //damage to all entities visible to the projectile
typedef struct projectileinfo_s typedef struct projectileinfo_s {
{
char name[MAX_STRINGFIELD]; char name[MAX_STRINGFIELD];
char model[MAX_STRINGFIELD]; char model[MAX_STRINGFIELD];
int flags; int flags;
@ -42,8 +41,7 @@ typedef struct projectileinfo_s
float bouncestop; float bouncestop;
} projectileinfo_t; } projectileinfo_t;
typedef struct weaponinfo_s typedef struct weaponinfo_s {
{
int valid; //true if the weapon info is valid int valid; //true if the weapon info is valid
int number; //number of the weapon int number; //number of the weapon
char name[MAX_STRINGFIELD]; char name[MAX_STRINGFIELD];
@ -77,11 +75,11 @@ int BotSetupWeaponAI(void);
//shut down the weapon AI //shut down the weapon AI
void BotShutdownWeaponAI(void); void BotShutdownWeaponAI(void);
//returns the best weapon to fight with //returns the best weapon to fight with
int BotChooseBestFightWeapon(int weaponstate, int *inventory); int BotChooseBestFightWeapon(int weaponstate, int* inventory);
//returns the information of the current weapon //returns the information of the current weapon
void BotGetWeaponInfo(int weaponstate, int weapon, weaponinfo_t *weaponinfo); void BotGetWeaponInfo(int weaponstate, int weapon, weaponinfo_t* weaponinfo);
//loads the weapon weights //loads the weapon weights
int BotLoadWeaponWeights(int weaponstate, char *filename); int BotLoadWeaponWeights(int weaponstate, char* filename);
//returns a handle to a newly allocated weapon state //returns a handle to a newly allocated weapon state
int BotAllocWeaponState(void); int BotAllocWeaponState(void);
//frees the weapon state //frees the weapon state

View File

@ -90,14 +90,13 @@ struct weaponinfo_s;
#define ACTION_FOLLOWME 0x8000000 #define ACTION_FOLLOWME 0x8000000
//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 {
{
float 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] float 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 int actionflags; //one of the ACTION_? flags
int weapon,latchweapon; //weapon to use int weapon, latchweapon; //weapon to use
int firestate; //right/left hand fire state int firestate; //right/left hand fire state
} bot_input_t; } bot_input_t;
@ -106,8 +105,7 @@ typedef struct bot_input_s
#define BSPTRACE #define BSPTRACE
//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; int flags;
int value; int value;
@ -115,8 +113,7 @@ typedef struct bsp_surface_s
//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 float fraction; // time completed, 1.0 = didn't hit anything
@ -132,8 +129,7 @@ typedef struct bsp_trace_s
#endif // BSPTRACE #endif // BSPTRACE
//entity state //entity state
typedef struct bot_entitystate_s typedef struct bot_entitystate_s {
{
int type; // entity type int type; // entity type
int flags; // entity flags int flags; // entity flags
vec3_t origin; // origin of the entity vec3_t origin; // origin of the entity
@ -155,96 +151,94 @@ typedef struct bot_entitystate_s
} 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)(int 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, int passent, int 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, int entnum, int 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)(int 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, const char *command); // was char *, changed for c++ compilation void(*BotClientCommand)(int client, const char* command); // was char *, changed for c++ compilation
//memory allocation //memory allocation
void *(*GetMemory)(int size); // allocate from Zone void* (*GetMemory)(int size); // allocate from Zone
void (*FreeMemory)(void *ptr); // free memory from Zone void(*FreeMemory)(void* ptr); // free memory from Zone
int (*AvailableMemory)(void); // available Zone memory int(*AvailableMemory)(void); // available Zone memory
void *(*HunkAlloc)(int size); // allocate from hunk void* (*HunkAlloc)(int size); // allocate from hunk
//file system access //file system access
int (*FS_FOpenFile)( const char *qpath, fileHandle_t *file, fsMode_t mode ); int(*FS_FOpenFile)(const char* qpath, fileHandle_t* file, fsMode_t mode);
int (*FS_Read)( void *buffer, int len, fileHandle_t f ); int(*FS_Read)(void* buffer, int len, fileHandle_t f);
int (*FS_Write)( const void *buffer, int len, fileHandle_t f ); int(*FS_Write)(const void* buffer, int 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 ); int(*FS_Seek)(fileHandle_t f, long offset, int origin);
//debug visualisation stuff //debug visualisation stuff
int (*DebugLineCreate)(void); int(*DebugLineCreate)(void);
void (*DebugLineDelete)(int line); void(*DebugLineDelete)(int line);
void (*DebugLineShow)(int line, vec3_t start, vec3_t end, int color); void(*DebugLineShow)(int line, vec3_t start, vec3_t end, int color);
// //
int (*DebugPolygonCreate)(int color, int numPoints, vec3_t *points); int(*DebugPolygonCreate)(int color, int numPoints, vec3_t* points);
void (*DebugPolygonDelete)(int id); void(*DebugPolygonDelete)(int id);
} botlib_import_t; } botlib_import_t;
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)(int entnum, struct aas_entityinfo_s* info);
//----------------------------------- //-----------------------------------
// be_aas_main.h // be_aas_main.h
//----------------------------------- //-----------------------------------
int (*AAS_Initialized)(void); int(*AAS_Initialized)(void);
void (*AAS_PresenceTypeBoundingBox)(int presencetype, vec3_t mins, vec3_t maxs); void(*AAS_PresenceTypeBoundingBox)(int presencetype, vec3_t mins, vec3_t maxs);
float (*AAS_Time)(void); float(*AAS_Time)(void);
//-------------------------------------------- //--------------------------------------------
// be_aas_sample.c // be_aas_sample.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_PointAreaNum)(vec3_t point); int(*AAS_PointAreaNum)(vec3_t point);
int (*AAS_PointReachabilityAreaIndex)( vec3_t point ); int(*AAS_PointReachabilityAreaIndex)(vec3_t point);
int (*AAS_TraceAreas)(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas); int(*AAS_TraceAreas)(vec3_t start, vec3_t end, int* areas, vec3_t* points, int maxareas);
int (*AAS_BBoxAreas)(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas); int(*AAS_BBoxAreas)(vec3_t absmins, vec3_t absmaxs, int* areas, int maxareas);
int (*AAS_AreaInfo)( int areanum, struct aas_areainfo_s *info ); int(*AAS_AreaInfo)(int areanum, struct aas_areainfo_s* info);
//-------------------------------------------- //--------------------------------------------
// be_aas_bspq3.c // be_aas_bspq3.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_PointContents)(vec3_t point); int(*AAS_PointContents)(vec3_t point);
int (*AAS_NextBSPEntity)(int ent); int(*AAS_NextBSPEntity)(int ent);
int (*AAS_ValueForBSPEpairKey)(int ent, char *key, char *value, int size); int(*AAS_ValueForBSPEpairKey)(int ent, char* key, char* value, int size);
int (*AAS_VectorForBSPEpairKey)(int ent, char *key, vec3_t v); int(*AAS_VectorForBSPEpairKey)(int ent, char* key, vec3_t v);
int (*AAS_FloatForBSPEpairKey)(int ent, char *key, float *value); int(*AAS_FloatForBSPEpairKey)(int ent, char* key, float* value);
int (*AAS_IntForBSPEpairKey)(int ent, char *key, int *value); int(*AAS_IntForBSPEpairKey)(int ent, char* key, int* value);
//-------------------------------------------- //--------------------------------------------
// be_aas_reach.c // be_aas_reach.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_AreaReachability)(int areanum); int(*AAS_AreaReachability)(int areanum);
//-------------------------------------------- //--------------------------------------------
// be_aas_route.c // be_aas_route.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_AreaTravelTimeToGoalArea)(int areanum, vec3_t origin, int goalareanum, int travelflags); int(*AAS_AreaTravelTimeToGoalArea)(int areanum, vec3_t origin, int goalareanum, int travelflags);
int (*AAS_EnableRoutingArea)(int areanum, int enable); int(*AAS_EnableRoutingArea)(int areanum, int enable);
int (*AAS_PredictRoute)(struct aas_predictroute_s *route, int areanum, vec3_t origin, int(*AAS_PredictRoute)(struct aas_predictroute_s* route, int areanum, vec3_t origin,
int goalareanum, int travelflags, int maxareas, int maxtime, int goalareanum, int travelflags, int maxareas, int maxtime,
int stopevent, int stopcontents, int stoptfl, int stopareanum); int stopevent, int stopcontents, int stoptfl, int stopareanum);
//-------------------------------------------- //--------------------------------------------
// be_aas_altroute.c // be_aas_altroute.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_AlternativeRouteGoals)(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags, int(*AAS_AlternativeRouteGoals)(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
struct aas_altroutegoal_s *altroutegoals, int maxaltroutegoals, struct aas_altroutegoal_s* altroutegoals, int maxaltroutegoals,
int type); int type);
//-------------------------------------------- //--------------------------------------------
// be_aas_move.c // be_aas_move.c
//-------------------------------------------- //--------------------------------------------
int (*AAS_Swimming)(vec3_t origin); int(*AAS_Swimming)(vec3_t origin);
int (*AAS_PredictClientMovement)(struct aas_clientmove_s *move, int(*AAS_PredictClientMovement)(struct aas_clientmove_s* move,
int entnum, vec3_t origin, int entnum, vec3_t origin,
int presencetype, int onground, int presencetype, int onground,
vec3_t velocity, vec3_t cmdmove, vec3_t velocity, vec3_t cmdmove,
@ -253,140 +247,137 @@ typedef struct aas_export_s
int stopevent, int stopareanum, int visualize); int stopevent, int stopareanum, int 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_Command)(int client, const char *command ); void(*EA_Command)(int client, const char* command);
void (*EA_Say)(int client, char *str); void(*EA_Say)(int client, char* str);
void (*EA_SayTeam)(int client, char *str); void(*EA_SayTeam)(int client, char* str);
// //
void (*EA_Action)(int client, int action); void(*EA_Action)(int client, int action);
void (*EA_Gesture)(int client); void(*EA_Gesture)(int client);
void (*EA_Talk)(int client); void(*EA_Talk)(int client);
void (*EA_ToggleFireState)(int client); void(*EA_ToggleFireState)(int client);
void (*EA_Attack)(int client, int primarydangerous, int altdangerous); void(*EA_Attack)(int client, int primarydangerous, int altdangerous);
void (*EA_Use)(int client); void(*EA_Use)(int client);
void (*EA_Respawn)(int client); void(*EA_Respawn)(int client);
void (*EA_MoveUp)(int client); void(*EA_MoveUp)(int client);
void (*EA_MoveDown)(int client); void(*EA_MoveDown)(int client);
void (*EA_MoveForward)(int client); void(*EA_MoveForward)(int client);
void (*EA_MoveBack)(int client); void(*EA_MoveBack)(int client);
void (*EA_MoveLeft)(int client); void(*EA_MoveLeft)(int client);
void (*EA_MoveRight)(int client); void(*EA_MoveRight)(int client);
void (*EA_Crouch)(int client); void(*EA_Crouch)(int client);
void (*EA_SelectWeapon)(int client, int weapon); void(*EA_SelectWeapon)(int client, int weapon);
void (*EA_Jump)(int client); void(*EA_Jump)(int client);
void (*EA_DelayedJump)(int client); void(*EA_DelayedJump)(int client);
void (*EA_Move)(int client, vec3_t dir, float speed); void(*EA_Move)(int client, vec3_t dir, float speed);
void (*EA_View)(int client, vec3_t viewangles); void(*EA_View)(int 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)(int client, float thinktime);
void (*EA_GetInput)(int client, float thinktime, bot_input_t *input); void(*EA_GetInput)(int client, float thinktime, bot_input_t* input);
void (*EA_ResetInput)(int client); void(*EA_ResetInput)(int 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, float skill); int(*BotLoadCharacter)(char* charfile, float skill);
void (*BotFreeCharacter)(int character); void(*BotFreeCharacter)(int character);
float (*Characteristic_Float)(int character, int index); float(*Characteristic_Float)(int character, int index);
float (*Characteristic_BFloat)(int character, int index, float min, float max); float(*Characteristic_BFloat)(int character, int index, float min, float max);
int (*Characteristic_Integer)(int character, int index); int(*Characteristic_Integer)(int character, int index);
int (*Characteristic_BInteger)(int character, int index, int min, int max); int(*Characteristic_BInteger)(int character, int index, int min, int max);
void (*Characteristic_String)(int character, int index, char *buf, int size); void(*Characteristic_String)(int character, int index, char* buf, int size);
//----------------------------------- //-----------------------------------
// be_ai_chat.h // be_ai_chat.h
//----------------------------------- //-----------------------------------
int (*BotAllocChatState)(void); int(*BotAllocChatState)(void);
void (*BotFreeChatState)(int handle); void(*BotFreeChatState)(int handle);
void (*BotQueueConsoleMessage)(int chatstate, int type, char *message); void(*BotQueueConsoleMessage)(int chatstate, int type, char* message);
void (*BotRemoveConsoleMessage)(int chatstate, int handle); void(*BotRemoveConsoleMessage)(int chatstate, int handle);
int (*BotNextConsoleMessage)(int chatstate, struct bot_consolemessage_s *cm); int(*BotNextConsoleMessage)(int chatstate, struct bot_consolemessage_s* cm);
int (*BotNumConsoleMessages)(int chatstate); 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); 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(*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(*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); int(*BotChatLength)(int chatstate);
void (*BotEnterChat)(int chatstate, int client, int sendto); void(*BotEnterChat)(int chatstate, int client, int sendto);
void (*BotGetChatMessage)(int chatstate, char *buf, int size); void(*BotGetChatMessage)(int chatstate, char* buf, int size);
int (*StringContains)(char *str1, char *str2, int casesensitive); int(*StringContains)(char* str1, char* str2, int casesensitive);
int (*BotFindMatch)(char *str, struct bot_match_s *match, unsigned long int context); 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(*BotMatchVariable)(struct bot_match_s* match, int variable, char* buf, int size);
void (*UnifyWhiteSpaces)(char *string); void(*UnifyWhiteSpaces)(char* string);
void (*BotReplaceSynonyms)(char *string, unsigned long int context); void(*BotReplaceSynonyms)(char* string, unsigned long int context);
int (*BotLoadChatFile)(int chatstate, char *chatfile, char *chatname); int(*BotLoadChatFile)(int chatstate, char* chatfile, char* chatname);
void (*BotSetChatGender)(int chatstate, int gender); void(*BotSetChatGender)(int chatstate, int gender);
void (*BotSetChatName)(int chatstate, char *name, int client); void(*BotSetChatName)(int chatstate, char* name, int client);
//----------------------------------- //-----------------------------------
// be_ai_goal.h // be_ai_goal.h
//----------------------------------- //-----------------------------------
void (*BotResetGoalState)(int goalstate); void(*BotResetGoalState)(int goalstate);
void (*BotResetAvoidGoals)(int goalstate); void(*BotResetAvoidGoals)(int goalstate);
void (*BotRemoveFromAvoidGoals)(int goalstate, int number); void(*BotRemoveFromAvoidGoals)(int goalstate, int number);
void (*BotPushGoal)(int goalstate, struct bot_goal_s *goal); void(*BotPushGoal)(int goalstate, struct bot_goal_s* goal);
void (*BotPopGoal)(int goalstate); void(*BotPopGoal)(int goalstate);
void (*BotEmptyGoalStack)(int goalstate); void(*BotEmptyGoalStack)(int goalstate);
void (*BotDumpAvoidGoals)(int goalstate); void(*BotDumpAvoidGoals)(int goalstate);
void (*BotDumpGoalStack)(int goalstate); void(*BotDumpGoalStack)(int goalstate);
void (*BotGoalName)(int number, char *name, int size); void(*BotGoalName)(int number, char* name, int size);
int (*BotGetTopGoal)(int goalstate, struct bot_goal_s *goal); int(*BotGetTopGoal)(int goalstate, struct bot_goal_s* goal);
int (*BotGetSecondGoal)(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); int(*BotChooseLTGItem)(int goalstate, vec3_t origin, int* inventory, int travelflags);
int (*BotChooseNBGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags, int(*BotChooseNBGItem)(int goalstate, vec3_t origin, int* inventory, int travelflags,
struct bot_goal_s *ltg, float maxtime); struct bot_goal_s* ltg, float maxtime);
int (*BotTouchingGoal)(vec3_t origin, struct bot_goal_s *goal); 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(*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(*BotGetLevelItemGoal)(int index, char* classname, struct bot_goal_s* goal);
int (*BotGetNextCampSpotGoal)(int num, struct bot_goal_s *goal); int(*BotGetNextCampSpotGoal)(int num, struct bot_goal_s* goal);
int (*BotGetMapLocationGoal)(char *name, struct bot_goal_s *goal); int(*BotGetMapLocationGoal)(char* name, struct bot_goal_s* goal);
float (*BotAvoidGoalTime)(int goalstate, int number); float(*BotAvoidGoalTime)(int goalstate, int number);
void (*BotSetAvoidGoalTime)(int goalstate, int number, float avoidtime); void(*BotSetAvoidGoalTime)(int goalstate, int number, float avoidtime);
void (*BotInitLevelItems)(void); void(*BotInitLevelItems)(void);
void (*BotUpdateEntityItems)(void); void(*BotUpdateEntityItems)(void);
int (*BotLoadItemWeights)(int goalstate, char *filename); int(*BotLoadItemWeights)(int goalstate, char* filename);
void (*BotFreeItemWeights)(int goalstate); void(*BotFreeItemWeights)(int goalstate);
void (*BotInterbreedGoalFuzzyLogic)(int parent1, int parent2, int child); void(*BotInterbreedGoalFuzzyLogic)(int parent1, int parent2, int child);
void (*BotSaveGoalFuzzyLogic)(int goalstate, char *filename); void(*BotSaveGoalFuzzyLogic)(int goalstate, char* filename);
void (*BotMutateGoalFuzzyLogic)(int goalstate, float range); void(*BotMutateGoalFuzzyLogic)(int goalstate, float range);
int (*BotAllocGoalState)(int client); int(*BotAllocGoalState)(int client);
void (*BotFreeGoalState)(int handle); void(*BotFreeGoalState)(int handle);
//----------------------------------- //-----------------------------------
// be_ai_move.h // be_ai_move.h
//----------------------------------- //-----------------------------------
void (*BotResetMoveState)(int movestate); void(*BotResetMoveState)(int movestate);
void (*BotMoveToGoal)(struct bot_moveresult_s *result, int movestate, struct bot_goal_s *goal, int travelflags); 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); int(*BotMoveInDirection)(int movestate, vec3_t dir, float speed, int type);
void (*BotResetAvoidReach)(int movestate); void(*BotResetAvoidReach)(int movestate);
void (*BotResetLastAvoidReach)(int movestate); void(*BotResetLastAvoidReach)(int movestate);
int (*BotReachabilityArea)(vec3_t origin, int testground); int(*BotReachabilityArea)(vec3_t origin, int testground);
int (*BotMovementViewTarget)(int movestate, struct bot_goal_s *goal, int travelflags, float lookahead, vec3_t target); 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(*BotPredictVisiblePosition)(vec3_t origin, int areanum, struct bot_goal_s* goal, int travelflags, vec3_t target);
int (*BotAllocMoveState)(void); int(*BotAllocMoveState)(void);
void (*BotFreeMoveState)(int handle); void(*BotFreeMoveState)(int handle);
void (*BotInitMoveState)(int handle, struct bot_initmove_s *initmove); void(*BotInitMoveState)(int handle, struct bot_initmove_s* initmove);
void (*BotAddAvoidSpot)(int movestate, vec3_t origin, float radius, int type); void(*BotAddAvoidSpot)(int movestate, vec3_t origin, float radius, int type);
//----------------------------------- //-----------------------------------
// be_ai_weap.h // be_ai_weap.h
//----------------------------------- //-----------------------------------
int (*BotChooseBestFightWeapon)(int weaponstate, int *inventory); int(*BotChooseBestFightWeapon)(int weaponstate, int* inventory);
void (*BotGetWeaponInfo)(int weaponstate, int weapon, struct weaponinfo_s *weaponinfo); void(*BotGetWeaponInfo)(int weaponstate, int weapon, struct weaponinfo_s* weaponinfo);
int (*BotLoadWeaponWeights)(int weaponstate, char *filename); int(*BotLoadWeaponWeights)(int weaponstate, char* filename);
int (*BotAllocWeaponState)(void); int(*BotAllocWeaponState)(void);
void (*BotFreeWeaponState)(int weaponstate); void(*BotFreeWeaponState)(int weaponstate);
void (*BotResetWeaponState)(int weaponstate); void(*BotResetWeaponState)(int weaponstate);
//----------------------------------- //-----------------------------------
// be_ai_gen.h // be_ai_gen.h
//----------------------------------- //-----------------------------------
int (*GeneticParentsAndChildSelection)(int numranks, float *ranks, int *parent1, int *parent2, int *child); int(*GeneticParentsAndChildSelection)(int numranks, float* ranks, int* parent1, int* parent2, int* 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
@ -394,33 +385,33 @@ typedef struct botlib_export_s
//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); int(*BotLibSetup)(void);
//shutdown the bot library, returns BLERR_ //shutdown the bot library, returns BLERR_
int (*BotLibShutdown)(void); int(*BotLibShutdown)(void);
//sets a library variable returns BLERR_ //sets a library variable returns BLERR_
int (*BotLibVarSet)(char *var_name, char *value); int(*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); int(*BotLibVarGet)(char* var_name, char* value, int size);
//sets a C-like define returns BLERR_ //sets a C-like define returns BLERR_
int (*PC_AddGlobalDefine)(char *string); int(*PC_AddGlobalDefine)(char* string);
int (*PC_LoadSourceHandle)(const char *filename); int(*PC_LoadSourceHandle)(const char* filename);
int (*PC_FreeSourceHandle)(int handle); int(*PC_FreeSourceHandle)(int handle);
// int (*PC_ReadTokenHandle)(int handle, pc_token_t *pc_token); // int (*PC_ReadTokenHandle)(int handle, pc_token_t* pc_token);
int (*PC_SourceFileAndLine)(int handle, char *filename, int *line); int(*PC_SourceFileAndLine)(int handle, char* filename, int* line);
//start a frame in the bot library //start a frame in the bot library
int (*BotLibStartFrame)(float time); int(*BotLibStartFrame)(float time);
//load a new map in the bot library //load a new map in the bot library
int (*BotLibLoadMap)(const char *mapname); int(*BotLibLoadMap)(const char* mapname);
//entity updates //entity updates
int (*BotLibUpdateEntity)(int ent, bot_entitystate_t *state); int(*BotLibUpdateEntity)(int ent, bot_entitystate_t* state);
//just for testing //just for testing
int (*Test)(int parm0, int parm1, vec3_t parm2, vec3_t parm3); int(*Test)(int parm0, int 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(int apiVersion, botlib_import_t* import);
/* Library variables: /* Library variables: