aboutsummaryrefslogtreecommitdiffstats
path: root/code/botlib
diff options
context:
space:
mode:
Diffstat (limited to 'code/botlib')
-rw-r--r--code/botlib/be_aas.h221
-rw-r--r--code/botlib/be_aas_bspq3.c6
-rw-r--r--code/botlib/be_aas_cluster.c6
-rw-r--r--code/botlib/be_aas_debug.c6
-rw-r--r--code/botlib/be_aas_entity.c6
-rw-r--r--code/botlib/be_aas_file.c6
-rw-r--r--code/botlib/be_aas_main.c6
-rw-r--r--code/botlib/be_aas_move.c6
-rw-r--r--code/botlib/be_aas_optimize.c6
-rw-r--r--code/botlib/be_aas_reach.c6
-rw-r--r--code/botlib/be_aas_route.c6
-rw-r--r--code/botlib/be_aas_routealt.c6
-rw-r--r--code/botlib/be_aas_sample.c6
-rw-r--r--code/botlib/be_ai_char.c8
-rw-r--r--code/botlib/be_ai_char.h48
-rw-r--r--code/botlib/be_ai_chat.c10
-rw-r--r--code/botlib/be_ai_chat.h113
-rw-r--r--code/botlib/be_ai_gen.c8
-rw-r--r--code/botlib/be_ai_gen.h33
-rw-r--r--code/botlib/be_ai_goal.c10
-rw-r--r--code/botlib/be_ai_goal.h118
-rw-r--r--code/botlib/be_ai_move.c14
-rw-r--r--code/botlib/be_ai_move.h144
-rw-r--r--code/botlib/be_ai_weap.c8
-rw-r--r--code/botlib/be_ai_weap.h104
-rw-r--r--code/botlib/be_ai_weight.c6
-rw-r--r--code/botlib/be_ea.c4
-rw-r--r--code/botlib/be_ea.h66
-rw-r--r--code/botlib/be_interface.c20
-rw-r--r--code/botlib/botlib.h516
-rw-r--r--code/botlib/l_crc.c4
-rw-r--r--code/botlib/l_libvar.c2
-rw-r--r--code/botlib/l_log.c4
-rw-r--r--code/botlib/l_memory.c4
-rw-r--r--code/botlib/l_precomp.c4
-rw-r--r--code/botlib/l_script.c4
-rw-r--r--code/botlib/l_struct.c4
37 files changed, 1456 insertions, 93 deletions
diff --git a/code/botlib/be_aas.h b/code/botlib/be_aas.h
new file mode 100644
index 0000000..4a98a8e
--- /dev/null
+++ b/code/botlib/be_aas.h
@@ -0,0 +1,221 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+
+/*****************************************************************************
+ * name: be_aas.h
+ *
+ * desc: Area Awareness System, stuff exported to the AI
+ *
+ * $Archive: /source/code/botlib/be_aas.h $
+ *
+ *****************************************************************************/
+
+#ifndef MAX_STRINGFIELD
+#define MAX_STRINGFIELD 80
+#endif
+
+//travel flags
+#define TFL_INVALID 0x00000001 //traveling temporary not possible
+#define TFL_WALK 0x00000002 //walking
+#define TFL_CROUCH 0x00000004 //crouching
+#define TFL_BARRIERJUMP 0x00000008 //jumping onto a barrier
+#define TFL_JUMP 0x00000010 //jumping
+#define TFL_LADDER 0x00000020 //climbing a ladder
+#define TFL_WALKOFFLEDGE 0x00000080 //walking of a ledge
+#define TFL_SWIM 0x00000100 //swimming
+#define TFL_WATERJUMP 0x00000200 //jumping out of the water
+#define TFL_TELEPORT 0x00000400 //teleporting
+#define TFL_ELEVATOR 0x00000800 //elevator
+#define TFL_ROCKETJUMP 0x00001000 //rocket jumping
+#define TFL_BFGJUMP 0x00002000 //bfg jumping
+#define TFL_GRAPPLEHOOK 0x00004000 //grappling hook
+#define TFL_DOUBLEJUMP 0x00008000 //double jump
+#define TFL_RAMPJUMP 0x00010000 //ramp jump
+#define TFL_STRAFEJUMP 0x00020000 //strafe jump
+#define TFL_JUMPPAD 0x00040000 //jump pad
+#define TFL_AIR 0x00080000 //travel through air
+#define TFL_WATER 0x00100000 //travel through water
+#define TFL_SLIME 0x00200000 //travel through slime
+#define TFL_LAVA 0x00400000 //travel through lava
+#define TFL_DONOTENTER 0x00800000 //travel through donotenter area
+#define TFL_FUNCBOB 0x01000000 //func bobbing
+#define TFL_FLIGHT 0x02000000 //flight
+#define TFL_BRIDGE 0x04000000 //move over a bridge
+//
+#define TFL_NOTTEAM1 0x08000000 //not team 1
+#define TFL_NOTTEAM2 0x10000000 //not team 2
+
+//default travel flags
+#define TFL_DEFAULT TFL_WALK|TFL_CROUCH|TFL_BARRIERJUMP|\
+ TFL_JUMP|TFL_LADDER|\
+ TFL_WALKOFFLEDGE|TFL_SWIM|TFL_WATERJUMP|\
+ TFL_TELEPORT|TFL_ELEVATOR|\
+ TFL_AIR|TFL_WATER|TFL_JUMPPAD|TFL_FUNCBOB
+
+typedef enum
+{
+ SOLID_NOT, // no interaction with other objects
+ SOLID_TRIGGER, // only touch when inside, after moving
+ SOLID_BBOX, // touch on edge
+ SOLID_BSP // bsp clip, touch on edge
+} solid_t;
+
+//a trace is returned when a box is swept through the AAS world
+typedef struct aas_trace_s
+{
+ qboolean startsolid; // if true, the initial point was in a solid area
+ float fraction; // time completed, 1.0 = didn't hit anything
+ vec3_t endpos; // final position
+ int ent; // entity blocking the trace
+ int lastarea; // last area the trace was in (zero if none)
+ int area; // area blocking the trace (zero if none)
+ int planenum; // number of the plane that was hit
+} aas_trace_t;
+
+/* Defined in botlib.h
+
+//bsp_trace_t hit surface
+typedef struct bsp_surface_s
+{
+ char name[16];
+ int flags;
+ int value;
+} bsp_surface_t;
+
+//a trace is returned when a box is swept through the BSP world
+typedef struct bsp_trace_s
+{
+ qboolean allsolid; // if true, plane is not valid
+ qboolean startsolid; // if true, the initial point was in a solid area
+ float fraction; // time completed, 1.0 = didn't hit anything
+ vec3_t endpos; // final position
+ cplane_t plane; // surface normal at impact
+ float exp_dist; // expanded plane distance
+ int sidenum; // number of the brush side hit
+ bsp_surface_t surface; // hit surface
+ int contents; // contents on other side of surface hit
+ int ent; // number of entity hit
+} bsp_trace_t;
+//
+*/
+
+//entity info
+typedef struct aas_entityinfo_s
+{
+ int valid; // true if updated this frame
+ int type; // entity type
+ int flags; // entity flags
+ float ltime; // local time
+ float update_time; // time between last and current update
+ int number; // number of the entity
+ vec3_t origin; // origin of the entity
+ vec3_t angles; // angles of the model
+ vec3_t old_origin; // for lerping
+ vec3_t lastvisorigin; // last visible origin
+ vec3_t mins; // bounding box minimums
+ vec3_t maxs; // bounding box maximums
+ int groundent; // ground entity
+ int solid; // solid type
+ int modelindex; // model used
+ int modelindex2; // weapons, CTF flags, etc
+ int frame; // model frame number
+ int event; // impulse events -- muzzle flashes, footsteps, etc
+ int eventParm; // even parameter
+ int powerups; // bit flags
+ int weapon; // determines weapon and flash model, etc
+ int legsAnim; // mask off ANIM_TOGGLEBIT
+ int torsoAnim; // mask off ANIM_TOGGLEBIT
+} aas_entityinfo_t;
+
+// area info
+typedef struct aas_areainfo_s
+{
+ int contents;
+ int flags;
+ int presencetype;
+ int cluster;
+ vec3_t mins;
+ vec3_t maxs;
+ vec3_t center;
+} aas_areainfo_t;
+
+// client movement prediction stop events, stop as soon as:
+#define SE_NONE 0
+#define SE_HITGROUND 1 // the ground is hit
+#define SE_LEAVEGROUND 2 // there's no ground
+#define SE_ENTERWATER 4 // water is entered
+#define SE_ENTERSLIME 8 // slime is entered
+#define SE_ENTERLAVA 16 // lava is entered
+#define SE_HITGROUNDDAMAGE 32 // the ground is hit with damage
+#define SE_GAP 64 // there's a gap
+#define SE_TOUCHJUMPPAD 128 // touching a jump pad area
+#define SE_TOUCHTELEPORTER 256 // touching teleporter
+#define SE_ENTERAREA 512 // the given stoparea is entered
+#define SE_HITGROUNDAREA 1024 // a ground face in the area is hit
+#define SE_HITBOUNDINGBOX 2048 // hit the specified bounding box
+#define SE_TOUCHCLUSTERPORTAL 4096 // touching a cluster portal
+
+typedef struct aas_clientmove_s
+{
+ vec3_t endpos; //position at the end of movement prediction
+ int endarea; //area at end of movement prediction
+ vec3_t velocity; //velocity at the end of movement prediction
+ aas_trace_t trace; //last trace
+ int presencetype; //presence type at end of movement prediction
+ int stopevent; //event that made the prediction stop
+ int endcontents; //contents at the end of movement prediction
+ float time; //time predicted ahead
+ int frames; //number of frames predicted ahead
+} aas_clientmove_t;
+
+// alternate route goals
+#define ALTROUTEGOAL_ALL 1
+#define ALTROUTEGOAL_CLUSTERPORTALS 2
+#define ALTROUTEGOAL_VIEWPORTALS 4
+
+typedef struct aas_altroutegoal_s
+{
+ vec3_t origin;
+ int areanum;
+ unsigned short starttraveltime;
+ unsigned short goaltraveltime;
+ unsigned short extratraveltime;
+} aas_altroutegoal_t;
+
+// route prediction stop events
+#define RSE_NONE 0
+#define RSE_NOROUTE 1 //no route to goal
+#define RSE_USETRAVELTYPE 2 //stop as soon as on of the given travel types is used
+#define RSE_ENTERCONTENTS 4 //stop when entering the given contents
+#define RSE_ENTERAREA 8 //stop when entering the given area
+
+typedef struct aas_predictroute_s
+{
+ vec3_t endpos; //position at the end of movement prediction
+ int endarea; //area at end of movement prediction
+ int stopevent; //event that made the prediction stop
+ int endcontents; //contents at the end of movement prediction
+ int endtravelflags; //end travel flags
+ int numareas; //number of areas predicted ahead
+ int time; //time predicted ahead (in hundreth of a sec)
+} aas_predictroute_t;
diff --git a/code/botlib/be_aas_bspq3.c b/code/botlib/be_aas_bspq3.c
index 97c286d..68084be 100644
--- a/code/botlib/be_aas_bspq3.c
+++ b/code/botlib/be_aas_bspq3.c
@@ -29,14 +29,14 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_cluster.c b/code/botlib/be_aas_cluster.c
index 118dd0a..cdbce02 100644
--- a/code/botlib/be_aas_cluster.c
+++ b/code/botlib/be_aas_cluster.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
@@ -38,8 +38,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_memory.h"
#include "l_libvar.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_debug.c b/code/botlib/be_aas_debug.c
index a665c0c..c27475e 100644
--- a/code/botlib/be_aas_debug.c
+++ b/code/botlib/be_aas_debug.c
@@ -29,15 +29,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "l_libvar.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_interface.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_entity.c b/code/botlib/be_aas_entity.c
index e11356b..0ec201c 100644
--- a/code/botlib/be_aas_entity.c
+++ b/code/botlib/be_aas_entity.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
@@ -37,8 +37,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_utils.h"
#include "l_log.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_file.c b/code/botlib/be_aas_file.c
index f73c962..6d4103a 100644
--- a/code/botlib/be_aas_file.c
+++ b/code/botlib/be_aas_file.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
@@ -37,8 +37,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_libvar.h"
#include "l_utils.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_main.c b/code/botlib/be_aas_main.c
index dac1ce3..ad04ef7 100644
--- a/code/botlib/be_aas_main.c
+++ b/code/botlib/be_aas_main.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_libvar.h"
#include "l_utils.h"
@@ -38,8 +38,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_struct.h"
#include "l_log.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_move.c b/code/botlib/be_aas_move.c
index 3433153..5b3ac1f 100644
--- a/code/botlib/be_aas_move.c
+++ b/code/botlib/be_aas_move.c
@@ -29,15 +29,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "l_libvar.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_optimize.c b/code/botlib/be_aas_optimize.c
index 605dc4d..48b6c90 100644
--- a/code/botlib/be_aas_optimize.c
+++ b/code/botlib/be_aas_optimize.c
@@ -30,15 +30,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_libvar.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_reach.c b/code/botlib/be_aas_reach.c
index f26523a..4b7f8ee 100644
--- a/code/botlib/be_aas_reach.c
+++ b/code/botlib/be_aas_reach.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_log.h"
#include "l_memory.h"
#include "l_script.h"
@@ -37,8 +37,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_route.c b/code/botlib/be_aas_route.c
index 642be81..9275bf2 100644
--- a/code/botlib/be_aas_route.c
+++ b/code/botlib/be_aas_route.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_utils.h"
#include "l_memory.h"
#include "l_log.h"
@@ -39,8 +39,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_routealt.c b/code/botlib/be_aas_routealt.c
index 956302d..20705db 100644
--- a/code/botlib/be_aas_routealt.c
+++ b/code/botlib/be_aas_routealt.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_utils.h"
#include "l_memory.h"
#include "l_log.h"
@@ -37,8 +37,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_aas_sample.c b/code/botlib/be_aas_sample.c
index f12b5e0..a2f0d0b 100644
--- a/code/botlib/be_aas_sample.c
+++ b/code/botlib/be_aas_sample.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
@@ -38,8 +38,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_libvar.h"
#endif
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_interface.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"
diff --git a/code/botlib/be_ai_char.c b/code/botlib/be_ai_char.c
index ea34030..778a70d 100644
--- a/code/botlib/be_ai_char.c
+++ b/code/botlib/be_ai_char.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_log.h"
#include "l_memory.h"
#include "l_utils.h"
@@ -38,11 +38,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_struct.h"
#include "l_libvar.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
-#include "../game/be_ai_char.h"
+#include "be_ai_char.h"
#define MAX_CHARACTERISTICS 80
diff --git a/code/botlib/be_ai_char.h b/code/botlib/be_ai_char.h
new file mode 100644
index 0000000..573fa1d
--- /dev/null
+++ b/code/botlib/be_ai_char.h
@@ -0,0 +1,48 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+
+/*****************************************************************************
+ * name: be_ai_char.h
+ *
+ * desc: bot characters
+ *
+ * $Archive: /source/code/botlib/be_ai_char.h $
+ *
+ *****************************************************************************/
+
+//loads a bot character from a file
+int BotLoadCharacter(char *charfile, float skill);
+//frees a bot character
+void BotFreeCharacter(int character);
+//returns a float characteristic
+float Characteristic_Float(int character, int index);
+//returns a bounded float characteristic
+float Characteristic_BFloat(int character, int index, float min, float max);
+//returns an integer characteristic
+int Characteristic_Integer(int character, int index);
+//returns a bounded integer characteristic
+int Characteristic_BInteger(int character, int index, int min, int max);
+//returns a string characteristic
+void Characteristic_String(int character, int index, char *buf, int size);
+//free cached bot characters
+void BotShutdownCharacters(void);
diff --git a/code/botlib/be_ai_chat.c b/code/botlib/be_ai_chat.c
index 7c719dd..a05a8eb 100644
--- a/code/botlib/be_ai_chat.c
+++ b/code/botlib/be_ai_chat.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_libvar.h"
#include "l_script.h"
@@ -38,12 +38,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_utils.h"
#include "l_log.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
-#include "../game/be_ea.h"
-#include "../game/be_ai_chat.h"
+#include "be_ea.h"
+#include "be_ai_chat.h"
//escape character
diff --git a/code/botlib/be_ai_chat.h b/code/botlib/be_ai_chat.h
new file mode 100644
index 0000000..67a38ed
--- /dev/null
+++ b/code/botlib/be_ai_chat.h
@@ -0,0 +1,113 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+/*****************************************************************************
+ * name: be_ai_chat.h
+ *
+ * desc: char AI
+ *
+ * $Archive: /source/code/botlib/be_ai_chat.h $
+ *
+ *****************************************************************************/
+
+#define MAX_MESSAGE_SIZE 256
+#define MAX_CHATTYPE_NAME 32
+#define MAX_MATCHVARIABLES 8
+
+#define CHAT_GENDERLESS 0
+#define CHAT_GENDERFEMALE 1
+#define CHAT_GENDERMALE 2
+
+#define CHAT_ALL 0
+#define CHAT_TEAM 1
+#define CHAT_TELL 2
+
+//a console message
+typedef struct bot_consolemessage_s
+{
+ int handle;
+ float time; //message time
+ int type; //message type
+ char message[MAX_MESSAGE_SIZE]; //message
+ struct bot_consolemessage_s *prev, *next; //prev and next in list
+} bot_consolemessage_t;
+
+//match variable
+typedef struct bot_matchvariable_s
+{
+ char offset;
+ int length;
+} bot_matchvariable_t;
+//returned to AI when a match is found
+typedef struct bot_match_s
+{
+ char string[MAX_MESSAGE_SIZE];
+ int type;
+ int subtype;
+ bot_matchvariable_t variables[MAX_MATCHVARIABLES];
+} bot_match_t;
+
+//setup the chat AI
+int BotSetupChatAI(void);
+//shutdown the chat AI
+void BotShutdownChatAI(void);
+//returns the handle to a newly allocated chat state
+int BotAllocChatState(void);
+//frees the chatstate
+void BotFreeChatState(int handle);
+//adds a console message to the chat state
+void BotQueueConsoleMessage(int chatstate, int type, char *message);
+//removes the console message from the chat state
+void BotRemoveConsoleMessage(int chatstate, int handle);
+//returns the next console message from the state
+int BotNextConsoleMessage(int chatstate, bot_consolemessage_t *cm);
+//returns the number of console messages currently stored in the state
+int BotNumConsoleMessages(int chatstate);
+//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);
+//returns the number of initial chat messages of the given type
+int BotNumInitialChats(int chatstate, char *type);
+//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);
+//returns the length of the currently selected chat message
+int BotChatLength(int chatstate);
+//enters the selected chat message
+void BotEnterChat(int chatstate, int clientto, int sendto);
+//get the chat message ready to be output
+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
+int StringContains(char *str1, char *str2, int casesensitive);
+//finds a match for the given string using the match templates
+int BotFindMatch(char *str, bot_match_t *match, unsigned long int context);
+//returns a variable from a match
+void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size);
+//unify all the white spaces in the string
+void UnifyWhiteSpaces(char *string);
+//replace all the context related synonyms in the string
+void BotReplaceSynonyms(char *string, unsigned long int context);
+//loads a chat file for the chat state
+int BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
+//store the gender of the bot in the chat state
+void BotSetChatGender(int chatstate, int gender);
+//store the bot name in the chat state
+void BotSetChatName(int chatstate, char *name, int client);
+
diff --git a/code/botlib/be_ai_gen.c b/code/botlib/be_ai_gen.c
index b897738..e71c8cf 100644
--- a/code/botlib/be_ai_gen.c
+++ b/code/botlib/be_ai_gen.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_log.h"
#include "l_utils.h"
@@ -37,11 +37,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
-#include "../game/be_ai_gen.h"
+#include "be_ai_gen.h"
//===========================================================================
//
diff --git a/code/botlib/be_ai_gen.h b/code/botlib/be_ai_gen.h
new file mode 100644
index 0000000..2a4b53d
--- /dev/null
+++ b/code/botlib/be_ai_gen.h
@@ -0,0 +1,33 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+
+/*****************************************************************************
+ * name: be_ai_gen.h
+ *
+ * desc: genetic selection
+ *
+ * $Archive: /source/code/botlib/be_ai_gen.h $
+ *
+ *****************************************************************************/
+
+int GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child);
diff --git a/code/botlib/be_ai_goal.c b/code/botlib/be_ai_goal.c
index c3f721a..4d53e6c 100644
--- a/code/botlib/be_ai_goal.c
+++ b/code/botlib/be_ai_goal.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_utils.h"
#include "l_libvar.h"
#include "l_memory.h"
@@ -38,13 +38,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_ai_weight.h"
-#include "../game/be_ai_goal.h"
-#include "../game/be_ai_move.h"
+#include "be_ai_goal.h"
+#include "be_ai_move.h"
//#define DEBUG_AI_GOAL
#ifdef RANDOMIZE
diff --git a/code/botlib/be_ai_goal.h b/code/botlib/be_ai_goal.h
new file mode 100644
index 0000000..354609d
--- /dev/null
+++ b/code/botlib/be_ai_goal.h
@@ -0,0 +1,118 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+/*****************************************************************************
+ * name: be_ai_goal.h
+ *
+ * desc: goal AI
+ *
+ * $Archive: /source/code/botlib/be_ai_goal.h $
+ *
+ *****************************************************************************/
+
+#define MAX_AVOIDGOALS 256
+#define MAX_GOALSTACK 8
+
+#define GFL_NONE 0
+#define GFL_ITEM 1
+#define GFL_ROAM 2
+#define GFL_DROPPED 4
+
+//a bot goal
+typedef struct bot_goal_s
+{
+ vec3_t origin; //origin of the goal
+ int areanum; //area number of the goal
+ vec3_t mins, maxs; //mins and maxs of the goal
+ int entitynum; //number of the goal entity
+ int number; //goal number
+ int flags; //goal flags
+ int iteminfo; //item information
+} bot_goal_t;
+
+//reset the whole goal state, but keep the item weights
+void BotResetGoalState(int goalstate);
+//reset avoid goals
+void BotResetAvoidGoals(int goalstate);
+//remove the goal with the given number from the avoid goals
+void BotRemoveFromAvoidGoals(int goalstate, int number);
+//push a goal onto the goal stack
+void BotPushGoal(int goalstate, bot_goal_t *goal);
+//pop a goal from the goal stack
+void BotPopGoal(int goalstate);
+//empty the bot's goal stack
+void BotEmptyGoalStack(int goalstate);
+//dump the avoid goals
+void BotDumpAvoidGoals(int goalstate);
+//dump the goal stack
+void BotDumpGoalStack(int goalstate);
+//get the name name of the goal with the given number
+void BotGoalName(int number, char *name, int size);
+//get the top goal from the stack
+int BotGetTopGoal(int goalstate, bot_goal_t *goal);
+//get the second goal on the stack
+int BotGetSecondGoal(int goalstate, bot_goal_t *goal);
+//choose the best long term goal item for the bot
+int BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags);
+//choose the best nearby goal item for the bot
+//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
+//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,
+ bot_goal_t *ltg, float maxtime);
+//returns true if the bot touches the goal
+int BotTouchingGoal(vec3_t origin, bot_goal_t *goal);
+//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);
+//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
+int BotGetLevelItemGoal(int index, char *classname, bot_goal_t *goal);
+//get the next camp spot in the map
+int BotGetNextCampSpotGoal(int num, bot_goal_t *goal);
+//get the map location with the given name
+int BotGetMapLocationGoal(char *name, bot_goal_t *goal);
+//returns the avoid goal time
+float BotAvoidGoalTime(int goalstate, int number);
+//set the avoid goal time
+void BotSetAvoidGoalTime(int goalstate, int number, float avoidtime);
+//initializes the items in the level
+void BotInitLevelItems(void);
+//regularly update dynamic entity items (dropped weapons, flags etc.)
+void BotUpdateEntityItems(void);
+//interbreed the goal fuzzy logic
+void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
+//save the goal fuzzy logic to disk
+void BotSaveGoalFuzzyLogic(int goalstate, char *filename);
+//mutate the goal fuzzy logic
+void BotMutateGoalFuzzyLogic(int goalstate, float range);
+//loads item weights for the bot
+int BotLoadItemWeights(int goalstate, char *filename);
+//frees the item weights of the bot
+void BotFreeItemWeights(int goalstate);
+//returns the handle of a newly allocated goal state
+int BotAllocGoalState(int client);
+//free the given goal state
+void BotFreeGoalState(int handle);
+//setup the goal AI
+int BotSetupGoalAI(void);
+//shut down the goal AI
+void BotShutdownGoalAI(void);
diff --git a/code/botlib/be_ai_move.c b/code/botlib/be_ai_move.c
index 30eefc7..02b8e4a 100644
--- a/code/botlib/be_ai_move.c
+++ b/code/botlib/be_ai_move.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_libvar.h"
#include "l_utils.h"
@@ -37,21 +37,21 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
-#include "../game/be_ea.h"
-#include "../game/be_ai_goal.h"
-#include "../game/be_ai_move.h"
+#include "be_ea.h"
+#include "be_ai_goal.h"
+#include "be_ai_move.h"
//#define DEBUG_AI_MOVE
//#define DEBUG_ELEVATOR
//#define DEBUG_GRAPPLE
-// bk001204 - redundant bot_avoidspot_t, see ../game/be_ai_move.h
+// bk001204 - redundant bot_avoidspot_t, see be_ai_move.h
//movement state
//NOTE: the moveflags MFL_ONGROUND, MFL_TELEPORTED, MFL_WATERJUMP and
diff --git a/code/botlib/be_ai_move.h b/code/botlib/be_ai_move.h
new file mode 100644
index 0000000..0aed6d7
--- /dev/null
+++ b/code/botlib/be_ai_move.h
@@ -0,0 +1,144 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+
+/*****************************************************************************
+ * name: be_ai_move.h
+ *
+ * desc: movement AI
+ *
+ * $Archive: /source/code/botlib/be_ai_move.h $
+ *
+ *****************************************************************************/
+
+//movement types
+#define MOVE_WALK 1
+#define MOVE_CROUCH 2
+#define MOVE_JUMP 4
+#define MOVE_GRAPPLE 8
+#define MOVE_ROCKETJUMP 16
+#define MOVE_BFGJUMP 32
+//move flags
+#define MFL_BARRIERJUMP 1 //bot is performing a barrier jump
+#define MFL_ONGROUND 2 //bot is in the ground
+#define MFL_SWIMMING 4 //bot is swimming
+#define MFL_AGAINSTLADDER 8 //bot is against a ladder
+#define MFL_WATERJUMP 16 //bot is waterjumping
+#define MFL_TELEPORTED 32 //bot is being teleported
+#define MFL_GRAPPLEPULL 64 //bot is being pulled by the grapple
+#define MFL_ACTIVEGRAPPLE 128 //bot is using the grapple hook
+#define MFL_GRAPPLERESET 256 //bot has reset the grapple
+#define MFL_WALK 512 //bot should walk slowly
+// move result flags
+#define MOVERESULT_MOVEMENTVIEW 1 //bot uses view for movement
+#define MOVERESULT_SWIMVIEW 2 //bot uses view for swimming
+#define MOVERESULT_WAITING 4 //bot is waiting for something
+#define MOVERESULT_MOVEMENTVIEWSET 8 //bot has set the view in movement code
+#define MOVERESULT_MOVEMENTWEAPON 16 //bot uses weapon for movement
+#define MOVERESULT_ONTOPOFOBSTACLE 32 //bot is ontop of obstacle
+#define MOVERESULT_ONTOPOF_FUNCBOB 64 //bot is ontop of a func_bobbing
+#define MOVERESULT_ONTOPOF_ELEVATOR 128 //bot is ontop of an elevator (func_plat)
+#define MOVERESULT_BLOCKEDBYAVOIDSPOT 256 //bot is blocked by an avoid spot
+//
+#define MAX_AVOIDREACH 1
+#define MAX_AVOIDSPOTS 32
+// avoid spot types
+#define AVOID_CLEAR 0 //clear all avoid spots
+#define AVOID_ALWAYS 1 //avoid always
+#define AVOID_DONTBLOCK 2 //never totally block
+// restult types
+#define RESULTTYPE_ELEVATORUP 1 //elevator is up
+#define RESULTTYPE_WAITFORFUNCBOBBING 2 //waiting for func bobbing to arrive
+#define RESULTTYPE_BADGRAPPLEPATH 4 //grapple path is obstructed
+#define RESULTTYPE_INSOLIDAREA 8 //stuck in solid area, this is bad
+
+//structure used to initialize the movement state
+//the or_moveflags MFL_ONGROUND, MFL_TELEPORTED and MFL_WATERJUMP come from the playerstate
+typedef struct bot_initmove_s
+{
+ vec3_t origin; //origin of the bot
+ vec3_t velocity; //velocity of the bot
+ vec3_t viewoffset; //view offset
+ int entitynum; //entity number of the bot
+ int client; //client number of the bot
+ float thinktime; //time the bot thinks
+ int presencetype; //presencetype of the bot
+ vec3_t viewangles; //view angles of the bot
+ int or_moveflags; //values ored to the movement flags
+} bot_initmove_t;
+
+//NOTE: the ideal_viewangles are only valid if MFL_MOVEMENTVIEW is set
+typedef struct bot_moveresult_s
+{
+ int failure; //true if movement failed all together
+ int type; //failure or blocked type
+ int blocked; //true if blocked by an entity
+ int blockentity; //entity blocking the bot
+ int traveltype; //last executed travel type
+ int flags; //result flags
+ int weapon; //weapon used for movement
+ vec3_t movedir; //movement direction
+ vec3_t ideal_viewangles; //ideal viewangles for the movement
+} bot_moveresult_t;
+
+#define bot_moveresult_t_cleared(x) bot_moveresult_t (x) = {0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, {0, 0, 0}}
+
+// bk001204: from code/botlib/be_ai_move.c
+// TTimo 04/12/2001 was moved here to avoid dup defines
+typedef struct bot_avoidspot_s
+{
+ vec3_t origin;
+ float radius;
+ int type;
+} bot_avoidspot_t;
+
+//resets the whole move state
+void BotResetMoveState(int movestate);
+//moves the bot to the given goal
+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
+int BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
+//reset avoid reachability
+void BotResetAvoidReach(int movestate);
+//resets the last avoid reachability
+void BotResetLastAvoidReach(int movestate);
+//returns a reachability area if the origin is in one
+int BotReachabilityArea(vec3_t origin, int client);
+//view target based on movement
+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
+int BotPredictVisiblePosition(vec3_t origin, int areanum, bot_goal_t *goal, int travelflags, vec3_t target);
+//returns the handle of a newly allocated movestate
+int BotAllocMoveState(void);
+//frees the movestate with the given handle
+void BotFreeMoveState(int handle);
+//initialize movement state before performing any movement
+void BotInitMoveState(int handle, bot_initmove_t *initmove);
+//add a spot to avoid (if type == AVOID_CLEAR all spots are removed)
+void BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
+//must be called every map change
+void BotSetBrushModelTypes(void);
+//setup movement AI
+int BotSetupMoveAI(void);
+//shutdown movement AI
+void BotShutdownMoveAI(void);
+
diff --git a/code/botlib/be_ai_weap.c b/code/botlib/be_ai_weap.c
index 22d989e..a6fddf8 100644
--- a/code/botlib/be_ai_weap.c
+++ b/code/botlib/be_ai_weap.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_libvar.h"
#include "l_log.h"
#include "l_memory.h"
@@ -38,12 +38,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_ai_weight.h" //fuzzy weights
-#include "../game/be_ai_weap.h"
+#include "be_ai_weap.h"
//#define DEBUG_AI_WEAP
diff --git a/code/botlib/be_ai_weap.h b/code/botlib/be_ai_weap.h
new file mode 100644
index 0000000..b78ad68
--- /dev/null
+++ b/code/botlib/be_ai_weap.h
@@ -0,0 +1,104 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+
+/*****************************************************************************
+ * name: be_ai_weap.h
+ *
+ * desc: weapon AI
+ *
+ * $Archive: /source/code/botlib/be_ai_weap.h $
+ *
+ *****************************************************************************/
+
+//projectile flags
+#define PFL_WINDOWDAMAGE 1 //projectile damages through window
+#define PFL_RETURN 2 //set when projectile returns to owner
+//weapon flags
+#define WFL_FIRERELEASED 1 //set when projectile is fired with key-up event
+//damage types
+#define DAMAGETYPE_IMPACT 1 //damage on impact
+#define DAMAGETYPE_RADIAL 2 //radial damage
+#define DAMAGETYPE_VISIBLE 4 //damage to all entities visible to the projectile
+
+typedef struct projectileinfo_s
+{
+ char name[MAX_STRINGFIELD];
+ char model[MAX_STRINGFIELD];
+ int flags;
+ float gravity;
+ int damage;
+ float radius;
+ int visdamage;
+ int damagetype;
+ int healthinc;
+ float push;
+ float detonation;
+ float bounce;
+ float bouncefric;
+ float bouncestop;
+} projectileinfo_t;
+
+typedef struct weaponinfo_s
+{
+ int valid; //true if the weapon info is valid
+ int number; //number of the weapon
+ char name[MAX_STRINGFIELD];
+ char model[MAX_STRINGFIELD];
+ int level;
+ int weaponindex;
+ int flags;
+ char projectile[MAX_STRINGFIELD];
+ int numprojectiles;
+ float hspread;
+ float vspread;
+ float speed;
+ float acceleration;
+ vec3_t recoil;
+ vec3_t offset;
+ vec3_t angleoffset;
+ float extrazvelocity;
+ int ammoamount;
+ int ammoindex;
+ float activate;
+ float reload;
+ float spinup;
+ float spindown;
+ projectileinfo_t proj; //pointer to the used projectile
+} weaponinfo_t;
+
+//setup the weapon AI
+int BotSetupWeaponAI(void);
+//shut down the weapon AI
+void BotShutdownWeaponAI(void);
+//returns the best weapon to fight with
+int BotChooseBestFightWeapon(int weaponstate, int *inventory);
+//returns the information of the current weapon
+void BotGetWeaponInfo(int weaponstate, int weapon, weaponinfo_t *weaponinfo);
+//loads the weapon weights
+int BotLoadWeaponWeights(int weaponstate, char *filename);
+//returns a handle to a newly allocated weapon state
+int BotAllocWeaponState(void);
+//frees the weapon state
+void BotFreeWeaponState(int weaponstate);
+//resets the whole weapon state
+void BotResetWeaponState(int weaponstate);
diff --git a/code/botlib/be_ai_weight.c b/code/botlib/be_ai_weight.c
index 9212519..0e239e4 100644
--- a/code/botlib/be_ai_weight.c
+++ b/code/botlib/be_ai_weight.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_log.h"
#include "l_utils.h"
@@ -38,8 +38,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_struct.h"
#include "l_libvar.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_interface.h"
#include "be_ai_weight.h"
diff --git a/code/botlib/be_ea.c b/code/botlib/be_ea.c
index 5c0dd6c..918a455 100644
--- a/code/botlib/be_ea.c
+++ b/code/botlib/be_ea.c
@@ -29,12 +29,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
-#include "../game/botlib.h"
+#include "botlib.h"
#include "be_interface.h"
#define MAX_USERMOVE 400
diff --git a/code/botlib/be_ea.h b/code/botlib/be_ea.h
new file mode 100644
index 0000000..1bc436b
--- /dev/null
+++ b/code/botlib/be_ea.h
@@ -0,0 +1,66 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+
+/*****************************************************************************
+ * name: be_ea.h
+ *
+ * desc: elementary actions
+ *
+ * $Archive: /source/code/botlib/be_ea.h $
+ *
+ *****************************************************************************/
+
+//ClientCommand elementary actions
+void EA_Say(int client, char *str);
+void EA_SayTeam(int client, char *str);
+void EA_Command(int client, char *command );
+
+void EA_Action(int client, int action);
+void EA_Crouch(int client);
+void EA_Walk(int client);
+void EA_MoveUp(int client);
+void EA_MoveDown(int client);
+void EA_MoveForward(int client);
+void EA_MoveBack(int client);
+void EA_MoveLeft(int client);
+void EA_MoveRight(int client);
+void EA_Attack(int client);
+void EA_Respawn(int client);
+void EA_Talk(int client);
+void EA_Gesture(int client);
+void EA_Use(int client);
+
+//regular elementary actions
+void EA_SelectWeapon(int client, int weapon);
+void EA_Jump(int client);
+void EA_DelayedJump(int client);
+void EA_Move(int client, vec3_t dir, float speed);
+void EA_View(int client, vec3_t viewangles);
+
+//send regular input to the server
+void EA_EndRegular(int client, float thinktime);
+void EA_GetInput(int client, float thinktime, bot_input_t *input);
+void EA_ResetInput(int client);
+//setup and shutdown routines
+int EA_Setup(void);
+void EA_Shutdown(void);
diff --git a/code/botlib/be_interface.c b/code/botlib/be_interface.c
index b4f2d3c..efff32f 100644
--- a/code/botlib/be_interface.c
+++ b/code/botlib/be_interface.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_log.h"
#include "l_libvar.h"
@@ -37,20 +37,20 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "l_precomp.h"
#include "l_struct.h"
#include "aasfile.h"
-#include "../game/botlib.h"
-#include "../game/be_aas.h"
+#include "botlib.h"
+#include "be_aas.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"
#include "be_interface.h"
-#include "../game/be_ea.h"
+#include "be_ea.h"
#include "be_ai_weight.h"
-#include "../game/be_ai_goal.h"
-#include "../game/be_ai_move.h"
-#include "../game/be_ai_weap.h"
-#include "../game/be_ai_chat.h"
-#include "../game/be_ai_char.h"
-#include "../game/be_ai_gen.h"
+#include "be_ai_goal.h"
+#include "be_ai_move.h"
+#include "be_ai_weap.h"
+#include "be_ai_chat.h"
+#include "be_ai_char.h"
+#include "be_ai_gen.h"
//library globals in a structure
botlib_globals_t botlibglobals;
diff --git a/code/botlib/botlib.h b/code/botlib/botlib.h
new file mode 100644
index 0000000..687affe
--- /dev/null
+++ b/code/botlib/botlib.h
@@ -0,0 +1,516 @@
+/*
+===========================================================================
+Copyright (C) 1999-2005 Id Software, Inc.
+
+This file is part of Quake III Arena source code.
+
+Quake III Arena source code is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Quake III Arena source code is distributed in the hope that it will be
+useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Foobar; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+===========================================================================
+*/
+//
+/*****************************************************************************
+ * name: botlib.h
+ *
+ * desc: bot AI library
+ *
+ * $Archive: /source/code/game/botai.h $
+ *
+ *****************************************************************************/
+
+#define BOTLIB_API_VERSION 2
+
+struct aas_clientmove_s;
+struct aas_entityinfo_s;
+struct aas_areainfo_s;
+struct aas_altroutegoal_s;
+struct aas_predictroute_s;
+struct bot_consolemessage_s;
+struct bot_match_s;
+struct bot_goal_s;
+struct bot_moveresult_s;
+struct bot_initmove_s;
+struct weaponinfo_s;
+
+#define BOTFILESBASEFOLDER "botfiles"
+//debug line colors
+#define LINECOLOR_NONE -1
+#define LINECOLOR_RED 1//0xf2f2f0f0L
+#define LINECOLOR_GREEN 2//0xd0d1d2d3L
+#define LINECOLOR_BLUE 3//0xf3f3f1f1L
+#define LINECOLOR_YELLOW 4//0xdcdddedfL
+#define LINECOLOR_ORANGE 5//0xe0e1e2e3L
+
+//Print types
+#define PRT_MESSAGE 1
+#define PRT_WARNING 2
+#define PRT_ERROR 3
+#define PRT_FATAL 4
+#define PRT_EXIT 5
+
+//console message types
+#define CMS_NORMAL 0
+#define CMS_CHAT 1
+
+//botlib error codes
+#define BLERR_NOERROR 0 //no error
+#define BLERR_LIBRARYNOTSETUP 1 //library not setup
+#define BLERR_INVALIDENTITYNUMBER 2 //invalid entity number
+#define BLERR_NOAASFILE 3 //no AAS file available
+#define BLERR_CANNOTOPENAASFILE 4 //cannot open AAS file
+#define BLERR_WRONGAASFILEID 5 //incorrect AAS file id
+#define BLERR_WRONGAASFILEVERSION 6 //incorrect AAS file version
+#define BLERR_CANNOTREADAASLUMP 7 //cannot read AAS file lump
+#define BLERR_CANNOTLOADICHAT 8 //cannot load initial chats
+#define BLERR_CANNOTLOADITEMWEIGHTS 9 //cannot load item weights
+#define BLERR_CANNOTLOADITEMCONFIG 10 //cannot load item config
+#define BLERR_CANNOTLOADWEAPONWEIGHTS 11 //cannot load weapon weights
+#define BLERR_CANNOTLOADWEAPONCONFIG 12 //cannot load weapon config
+
+//action flags
+#define ACTION_ATTACK 0x0000001
+#define ACTION_USE 0x0000002
+#define ACTION_RESPAWN 0x0000008
+#define ACTION_JUMP 0x0000010
+#define ACTION_MOVEUP 0x0000020
+#define ACTION_CROUCH 0x0000080
+#define ACTION_MOVEDOWN 0x0000100
+#define ACTION_MOVEFORWARD 0x0000200
+#define ACTION_MOVEBACK 0x0000800
+#define ACTION_MOVELEFT 0x0001000
+#define ACTION_MOVERIGHT 0x0002000
+#define ACTION_DELAYEDJUMP 0x0008000
+#define ACTION_TALK 0x0010000
+#define ACTION_GESTURE 0x0020000
+#define ACTION_WALK 0x0080000
+#define ACTION_AFFIRMATIVE 0x0100000
+#define ACTION_NEGATIVE 0x0200000
+#define ACTION_GETFLAG 0x0800000
+#define ACTION_GUARDBASE 0x1000000
+#define ACTION_PATROL 0x2000000
+#define ACTION_FOLLOWME 0x8000000
+
+//the bot input, will be converted to an usercmd_t
+typedef struct bot_input_s
+{
+ float thinktime; //time since last output (in seconds)
+ vec3_t dir; //movement direction
+ float speed; //speed in the range [0, 400]
+ vec3_t viewangles; //the view angles
+ int actionflags; //one of the ACTION_? flags
+ int weapon; //weapon to use
+} bot_input_t;
+
+#ifndef BSPTRACE
+
+#define BSPTRACE
+
+//bsp_trace_t hit surface
+typedef struct bsp_surface_s
+{
+ char name[16];
+ int flags;
+ int value;
+} bsp_surface_t;
+
+//remove the bsp_trace_s structure definition l8r on
+//a trace is returned when a box is swept through the world
+typedef struct bsp_trace_s
+{
+ qboolean allsolid; // if true, plane is not valid
+ qboolean startsolid; // if true, the initial point was in a solid area
+ float fraction; // time completed, 1.0 = didn't hit anything
+ vec3_t endpos; // final position
+ cplane_t plane; // surface normal at impact
+ float exp_dist; // expanded plane distance
+ int sidenum; // number of the brush side hit
+ bsp_surface_t surface; // the hit point surface
+ int contents; // contents on other side of surface hit
+ int ent; // number of entity hit
+} bsp_trace_t;
+
+#endif // BSPTRACE
+
+//entity state
+typedef struct bot_entitystate_s
+{
+ int type; // entity type
+ int flags; // entity flags
+ vec3_t origin; // origin of the entity
+ vec3_t angles; // angles of the model
+ vec3_t old_origin; // for lerping
+ vec3_t mins; // bounding box minimums
+ vec3_t maxs; // bounding box maximums
+ int groundent; // ground entity
+ int solid; // solid type
+ int modelindex; // model used
+ int modelindex2; // weapons, CTF flags, etc
+ int frame; // model frame number
+ int event; // impulse events -- muzzle flashes, footsteps, etc
+ int eventParm; // even parameter
+ int powerups; // bit flags
+ int weapon; // determines weapon and flash model, etc
+ int legsAnim; // mask off ANIM_TOGGLEBIT
+ int torsoAnim; // mask off ANIM_TOGGLEBIT
+} bot_entitystate_t;
+
+//bot AI library exported functions
+typedef struct botlib_import_s
+{
+ //print messages from the bot library
+ void (QDECL *Print)(int type, char *fmt, ...);
+ //trace a bbox through the world
+ void (*Trace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask);
+ //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);
+ //retrieve the contents at the given point
+ int (*PointContents)(vec3_t point);
+ //check if the point is in potential visible sight
+ int (*inPVS)(vec3_t p1, vec3_t p2);
+ //retrieve the BSP entity data lump
+ char *(*BSPEntityData)(void);
+ //
+ void (*BSPModelMinsMaxsOrigin)(int modelnum, vec3_t angles, vec3_t mins, vec3_t maxs, vec3_t origin);
+ //send a bot client command
+ void (*BotClientCommand)(int client, char *command);
+ //memory allocation
+ void *(*GetMemory)(int size); // allocate from Zone
+ void (*FreeMemory)(void *ptr); // free memory from Zone
+ int (*AvailableMemory)(void); // available Zone memory
+ void *(*HunkAlloc)(int size); // allocate from hunk
+ //file system access
+ int (*FS_FOpenFile)( const char *qpath, fileHandle_t *file, fsMode_t mode );
+ int (*FS_Read)( void *buffer, int len, fileHandle_t f );
+ int (*FS_Write)( const void *buffer, int len, fileHandle_t f );
+ void (*FS_FCloseFile)( fileHandle_t f );
+ int (*FS_Seek)( fileHandle_t f, long offset, int origin );
+ //debug visualisation stuff
+ int (*DebugLineCreate)(void);
+ void (*DebugLineDelete)(int line);
+ void (*DebugLineShow)(int line, vec3_t start, vec3_t end, int color);
+ //
+ int (*DebugPolygonCreate)(int color, int numPoints, vec3_t *points);
+ void (*DebugPolygonDelete)(int id);
+} botlib_import_t;
+
+typedef struct aas_export_s
+{
+ //-----------------------------------
+ // be_aas_entity.h
+ //-----------------------------------
+ void (*AAS_EntityInfo)(int entnum, struct aas_entityinfo_s *info);
+ //-----------------------------------
+ // be_aas_main.h
+ //-----------------------------------
+ int (*AAS_Initialized)(void);
+ void (*AAS_PresenceTypeBoundingBox)(int presencetype, vec3_t mins, vec3_t maxs);
+ float (*AAS_Time)(void);
+ //--------------------------------------------
+ // be_aas_sample.c
+ //--------------------------------------------
+ int (*AAS_PointAreaNum)(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_BBoxAreas)(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas);
+ int (*AAS_AreaInfo)( int areanum, struct aas_areainfo_s *info );
+ //--------------------------------------------
+ // be_aas_bspq3.c
+ //--------------------------------------------
+ int (*AAS_PointContents)(vec3_t point);
+ int (*AAS_NextBSPEntity)(int ent);
+ int (*AAS_ValueForBSPEpairKey)(int ent, char *key, char *value, int size);
+ int (*AAS_VectorForBSPEpairKey)(int ent, char *key, vec3_t v);
+ int (*AAS_FloatForBSPEpairKey)(int ent, char *key, float *value);
+ int (*AAS_IntForBSPEpairKey)(int ent, char *key, int *value);
+ //--------------------------------------------
+ // be_aas_reach.c
+ //--------------------------------------------
+ int (*AAS_AreaReachability)(int areanum);
+ //--------------------------------------------
+ // be_aas_route.c
+ //--------------------------------------------
+ int (*AAS_AreaTravelTimeToGoalArea)(int areanum, vec3_t origin, int goalareanum, int travelflags);
+ int (*AAS_EnableRoutingArea)(int areanum, int enable);
+ int (*AAS_PredictRoute)(struct aas_predictroute_s *route, int areanum, vec3_t origin,
+ int goalareanum, int travelflags, int maxareas, int maxtime,
+ int stopevent, int stopcontents, int stoptfl, int stopareanum);
+ //--------------------------------------------
+ // be_aas_altroute.c
+ //--------------------------------------------
+ int (*AAS_AlternativeRouteGoals)(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
+ struct aas_altroutegoal_s *altroutegoals, int maxaltroutegoals,
+ int type);
+ //--------------------------------------------
+ // be_aas_move.c
+ //--------------------------------------------
+ int (*AAS_Swimming)(vec3_t origin);
+ int (*AAS_PredictClientMovement)(struct aas_clientmove_s *move,
+ int entnum, vec3_t origin,
+ int presencetype, int onground,
+ vec3_t velocity, vec3_t cmdmove,
+ int cmdframes,
+ int maxframes, float frametime,
+ int stopevent, int stopareanum, int visualize);
+} aas_export_t;
+
+typedef struct ea_export_s
+{
+ //ClientCommand elementary actions
+ void (*EA_Command)(int client, char *command );
+ void (*EA_Say)(int client, char *str);
+ void (*EA_SayTeam)(int client, char *str);
+ //
+ void (*EA_Action)(int client, int action);
+ void (*EA_Gesture)(int client);
+ void (*EA_Talk)(int client);
+ void (*EA_Attack)(int client);
+ void (*EA_Use)(int client);
+ void (*EA_Respawn)(int client);
+ void (*EA_MoveUp)(int client);
+ void (*EA_MoveDown)(int client);
+ void (*EA_MoveForward)(int client);
+ void (*EA_MoveBack)(int client);
+ void (*EA_MoveLeft)(int client);
+ void (*EA_MoveRight)(int client);
+ void (*EA_Crouch)(int client);
+
+ void (*EA_SelectWeapon)(int client, int weapon);
+ void (*EA_Jump)(int client);
+ void (*EA_DelayedJump)(int client);
+ void (*EA_Move)(int client, vec3_t dir, float speed);
+ void (*EA_View)(int client, vec3_t viewangles);
+ //send regular input to the server
+ void (*EA_EndRegular)(int client, float thinktime);
+ void (*EA_GetInput)(int client, float thinktime, bot_input_t *input);
+ void (*EA_ResetInput)(int client);
+} ea_export_t;
+
+typedef struct ai_export_s
+{
+ //-----------------------------------
+ // be_ai_char.h
+ //-----------------------------------
+ int (*BotLoadCharacter)(char *charfile, float skill);
+ void (*BotFreeCharacter)(int character);
+ float (*Characteristic_Float)(int character, int index);
+ float (*Characteristic_BFloat)(int character, int index, float min, float max);
+ int (*Characteristic_Integer)(int character, int index);
+ int (*Characteristic_BInteger)(int character, int index, int min, int max);
+ void (*Characteristic_String)(int character, int index, char *buf, int size);
+ //-----------------------------------
+ // be_ai_chat.h
+ //-----------------------------------
+ int (*BotAllocChatState)(void);
+ void (*BotFreeChatState)(int handle);
+ void (*BotQueueConsoleMessage)(int chatstate, int type, char *message);
+ void (*BotRemoveConsoleMessage)(int chatstate, int handle);
+ int (*BotNextConsoleMessage)(int chatstate, struct bot_consolemessage_s *cm);
+ int (*BotNumConsoleMessages)(int chatstate);
+ void (*BotInitialChat)(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
+ int (*BotNumInitialChats)(int chatstate, char *type);
+ int (*BotReplyChat)(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
+ int (*BotChatLength)(int chatstate);
+ void (*BotEnterChat)(int chatstate, int client, int sendto);
+ void (*BotGetChatMessage)(int chatstate, char *buf, int size);
+ int (*StringContains)(char *str1, char *str2, int casesensitive);
+ int (*BotFindMatch)(char *str, struct bot_match_s *match, unsigned long int context);
+ void (*BotMatchVariable)(struct bot_match_s *match, int variable, char *buf, int size);
+ void (*UnifyWhiteSpaces)(char *string);
+ void (*BotReplaceSynonyms)(char *string, unsigned long int context);
+ int (*BotLoadChatFile)(int chatstate, char *chatfile, char *chatname);
+ void (*BotSetChatGender)(int chatstate, int gender);
+ void (*BotSetChatName)(int chatstate, char *name, int client);
+ //-----------------------------------
+ // be_ai_goal.h
+ //-----------------------------------
+ void (*BotResetGoalState)(int goalstate);
+ void (*BotResetAvoidGoals)(int goalstate);
+ void (*BotRemoveFromAvoidGoals)(int goalstate, int number);
+ void (*BotPushGoal)(int goalstate, struct bot_goal_s *goal);
+ void (*BotPopGoal)(int goalstate);
+ void (*BotEmptyGoalStack)(int goalstate);
+ void (*BotDumpAvoidGoals)(int goalstate);
+ void (*BotDumpGoalStack)(int goalstate);
+ void (*BotGoalName)(int number, char *name, int size);
+ int (*BotGetTopGoal)(int goalstate, struct bot_goal_s *goal);
+ int (*BotGetSecondGoal)(int goalstate, struct bot_goal_s *goal);
+ int (*BotChooseLTGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags);
+ int (*BotChooseNBGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags,
+ struct bot_goal_s *ltg, float maxtime);
+ int (*BotTouchingGoal)(vec3_t origin, struct bot_goal_s *goal);
+ int (*BotItemGoalInVisButNotVisible)(int viewer, vec3_t eye, vec3_t viewangles, struct bot_goal_s *goal);
+ int (*BotGetLevelItemGoal)(int index, char *classname, struct bot_goal_s *goal);
+ int (*BotGetNextCampSpotGoal)(int num, struct bot_goal_s *goal);
+ int (*BotGetMapLocationGoal)(char *name, struct bot_goal_s *goal);
+ float (*BotAvoidGoalTime)(int goalstate, int number);
+ void (*BotSetAvoidGoalTime)(int goalstate, int number, float avoidtime);
+ void (*BotInitLevelItems)(void);
+ void (*BotUpdateEntityItems)(void);
+ int (*BotLoadItemWeights)(int goalstate, char *filename);
+ void (*BotFreeItemWeights)(int goalstate);
+ void (*BotInterbreedGoalFuzzyLogic)(int parent1, int parent2, int child);
+ void (*BotSaveGoalFuzzyLogic)(int goalstate, char *filename);
+ void (*BotMutateGoalFuzzyLogic)(int goalstate, float range);
+ int (*BotAllocGoalState)(int client);
+ void (*BotFreeGoalState)(int handle);
+ //-----------------------------------
+ // be_ai_move.h
+ //-----------------------------------
+ void (*BotResetMoveState)(int movestate);
+ void (*BotMoveToGoal)(struct bot_moveresult_s *result, int movestate, struct bot_goal_s *goal, int travelflags);
+ int (*BotMoveInDirection)(int movestate, vec3_t dir, float speed, int type);
+ void (*BotResetAvoidReach)(int movestate);
+ void (*BotResetLastAvoidReach)(int movestate);
+ int (*BotReachabilityArea)(vec3_t origin, int testground);
+ int (*BotMovementViewTarget)(int movestate, struct bot_goal_s *goal, int travelflags, float lookahead, vec3_t target);
+ int (*BotPredictVisiblePosition)(vec3_t origin, int areanum, struct bot_goal_s *goal, int travelflags, vec3_t target);
+ int (*BotAllocMoveState)(void);
+ void (*BotFreeMoveState)(int handle);
+ void (*BotInitMoveState)(int handle, struct bot_initmove_s *initmove);
+ void (*BotAddAvoidSpot)(int movestate, vec3_t origin, float radius, int type);
+ //-----------------------------------
+ // be_ai_weap.h
+ //-----------------------------------
+ int (*BotChooseBestFightWeapon)(int weaponstate, int *inventory);
+ void (*BotGetWeaponInfo)(int weaponstate, int weapon, struct weaponinfo_s *weaponinfo);
+ int (*BotLoadWeaponWeights)(int weaponstate, char *filename);
+ int (*BotAllocWeaponState)(void);
+ void (*BotFreeWeaponState)(int weaponstate);
+ void (*BotResetWeaponState)(int weaponstate);
+ //-----------------------------------
+ // be_ai_gen.h
+ //-----------------------------------
+ int (*GeneticParentsAndChildSelection)(int numranks, float *ranks, int *parent1, int *parent2, int *child);
+} ai_export_t;
+
+//bot AI library imported functions
+typedef struct botlib_export_s
+{
+ //Area Awareness System functions
+ aas_export_t aas;
+ //Elementary Action functions
+ ea_export_t ea;
+ //AI functions
+ ai_export_t ai;
+ //setup the bot library, returns BLERR_
+ int (*BotLibSetup)(void);
+ //shutdown the bot library, returns BLERR_
+ int (*BotLibShutdown)(void);
+ //sets a library variable returns BLERR_
+ int (*BotLibVarSet)(char *var_name, char *value);
+ //gets a library variable returns BLERR_
+ int (*BotLibVarGet)(char *var_name, char *value, int size);
+
+ //sets a C-like define returns BLERR_
+ int (*PC_AddGlobalDefine)(char *string);
+ int (*PC_LoadSourceHandle)(const char *filename);
+ int (*PC_FreeSourceHandle)(int handle);
+ int (*PC_ReadTokenHandle)(int handle, pc_token_t *pc_token);
+ int (*PC_SourceFileAndLine)(int handle, char *filename, int *line);
+
+ //start a frame in the bot library
+ int (*BotLibStartFrame)(float time);
+ //load a new map in the bot library
+ int (*BotLibLoadMap)(const char *mapname);
+ //entity updates
+ int (*BotLibUpdateEntity)(int ent, bot_entitystate_t *state);
+ //just for testing
+ int (*Test)(int parm0, char *parm1, vec3_t parm2, vec3_t parm3);
+} botlib_export_t;
+
+//linking of bot library
+botlib_export_t *GetBotLibAPI( int apiVersion, botlib_import_t *import );
+
+/* Library variables:
+
+name: default: module(s): description:
+
+"basedir" "" l_utils.c base directory
+"gamedir" "" l_utils.c game directory
+"cddir" "" l_utils.c CD directory
+
+"log" "0" l_log.c enable/disable creating a log file
+"maxclients" "4" be_interface.c maximum number of clients
+"maxentities" "1024" be_interface.c maximum number of entities
+"bot_developer" "0" be_interface.c bot developer mode
+
+"phys_friction" "6" be_aas_move.c ground friction
+"phys_stopspeed" "100" be_aas_move.c stop speed
+"phys_gravity" "800" be_aas_move.c gravity value
+"phys_waterfriction" "1" be_aas_move.c water friction
+"phys_watergravity" "400" be_aas_move.c gravity in water
+"phys_maxvelocity" "320" be_aas_move.c maximum velocity
+"phys_maxwalkvelocity" "320" be_aas_move.c maximum walk velocity
+"phys_maxcrouchvelocity" "100" be_aas_move.c maximum crouch velocity
+"phys_maxswimvelocity" "150" be_aas_move.c maximum swim velocity
+"phys_walkaccelerate" "10" be_aas_move.c walk acceleration
+"phys_airaccelerate" "1" be_aas_move.c air acceleration
+"phys_swimaccelerate" "4" be_aas_move.c swim acceleration
+"phys_maxstep" "18" be_aas_move.c maximum step height
+"phys_maxsteepness" "0.7" be_aas_move.c maximum floor steepness
+"phys_maxbarrier" "32" be_aas_move.c maximum barrier height
+"phys_maxwaterjump" "19" be_aas_move.c maximum waterjump height
+"phys_jumpvel" "270" be_aas_move.c jump z velocity
+"phys_falldelta5" "40" be_aas_move.c
+"phys_falldelta10" "60" be_aas_move.c
+"rs_waterjump" "400" be_aas_move.c
+"rs_teleport" "50" be_aas_move.c
+"rs_barrierjump" "100" be_aas_move.c
+"rs_startcrouch" "300" be_aas_move.c
+"rs_startgrapple" "500" be_aas_move.c
+"rs_startwalkoffledge" "70" be_aas_move.c
+"rs_startjump" "300" be_aas_move.c
+"rs_rocketjump" "500" be_aas_move.c
+"rs_bfgjump" "500" be_aas_move.c
+"rs_jumppad" "250" be_aas_move.c
+"rs_aircontrolledjumppad" "300" be_aas_move.c
+"rs_funcbob" "300" be_aas_move.c
+"rs_startelevator" "50" be_aas_move.c
+"rs_falldamage5" "300" be_aas_move.c
+"rs_falldamage10" "500" be_aas_move.c
+"rs_maxjumpfallheight" "450" be_aas_move.c
+
+"max_aaslinks" "4096" be_aas_sample.c maximum links in the AAS
+"max_routingcache" "4096" be_aas_route.c maximum routing cache size in KB
+"forceclustering" "0" be_aas_main.c force recalculation of clusters
+"forcereachability" "0" be_aas_main.c force recalculation of reachabilities
+"forcewrite" "0" be_aas_main.c force writing of aas file
+"aasoptimize" "0" be_aas_main.c enable aas optimization
+"sv_mapChecksum" "0" be_aas_main.c BSP file checksum
+"bot_visualizejumppads" "0" be_aas_reach.c visualize jump pads
+
+"bot_reloadcharacters" "0" - reload bot character files
+"ai_gametype" "0" be_ai_goal.c game type
+"droppedweight" "1000" be_ai_goal.c additional dropped item weight
+"weapindex_rocketlauncher" "5" be_ai_move.c rl weapon index for rocket jumping
+"weapindex_bfg10k" "9" be_ai_move.c bfg weapon index for bfg jumping
+"weapindex_grapple" "10" be_ai_move.c grapple weapon index for grappling
+"entitytypemissile" "3" be_ai_move.c ET_MISSILE
+"offhandgrapple" "0" be_ai_move.c enable off hand grapple hook
+"cmd_grappleon" "grappleon" be_ai_move.c command to activate off hand grapple
+"cmd_grappleoff" "grappleoff" be_ai_move.c command to deactivate off hand grapple
+"itemconfig" "items.c" be_ai_goal.c item configuration file
+"weaponconfig" "weapons.c" be_ai_weap.c weapon configuration file
+"synfile" "syn.c" be_ai_chat.c file with synonyms
+"rndfile" "rnd.c" be_ai_chat.c file with random strings
+"matchfile" "match.c" be_ai_chat.c file with match strings
+"nochat" "0" be_ai_chat.c disable chats
+"max_messages" "1024" be_ai_chat.c console message heap size
+"max_weaponinfo" "32" be_ai_weap.c maximum number of weapon info
+"max_projectileinfo" "32" be_ai_weap.c maximum number of projectile info
+"max_iteminfo" "256" be_ai_goal.c maximum number of item info
+"max_levelitems" "256" be_ai_goal.c maximum number of level items
+
+*/
+
diff --git a/code/botlib/l_crc.c b/code/botlib/l_crc.c
index 8b1067b..b270045 100644
--- a/code/botlib/l_crc.c
+++ b/code/botlib/l_crc.c
@@ -33,8 +33,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <stdio.h>
#include <string.h>
-#include "../game/q_shared.h"
-#include "../game/botlib.h"
+#include "../qcommon/q_shared.h"
+#include "botlib.h"
#include "be_interface.h" //for botimport.Print
diff --git a/code/botlib/l_libvar.c b/code/botlib/l_libvar.c
index a8629c8..abd17bd 100644
--- a/code/botlib/l_libvar.c
+++ b/code/botlib/l_libvar.c
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
+#include "../qcommon/q_shared.h"
#include "l_memory.h"
#include "l_libvar.h"
diff --git a/code/botlib/l_log.c b/code/botlib/l_log.c
index 7b1a346..bd62244 100644
--- a/code/botlib/l_log.c
+++ b/code/botlib/l_log.c
@@ -33,8 +33,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <stdio.h>
#include <string.h>
-#include "../game/q_shared.h"
-#include "../game/botlib.h"
+#include "../qcommon/q_shared.h"
+#include "botlib.h"
#include "be_interface.h" //for botimport.Print
#include "l_libvar.h"
diff --git a/code/botlib/l_memory.c b/code/botlib/l_memory.c
index 7bc12f6..9cdd408 100644
--- a/code/botlib/l_memory.c
+++ b/code/botlib/l_memory.c
@@ -29,8 +29,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
-#include "../game/q_shared.h"
-#include "../game/botlib.h"
+#include "../qcommon/q_shared.h"
+#include "botlib.h"
#include "l_log.h"
#include "be_interface.h"
diff --git a/code/botlib/l_precomp.c b/code/botlib/l_precomp.c
index 5122931..54199c7 100644
--- a/code/botlib/l_precomp.c
+++ b/code/botlib/l_precomp.c
@@ -53,8 +53,8 @@ typedef enum {qfalse, qtrue} qboolean;
#endif //SCREWUP
#ifdef BOTLIB
-#include "../game/q_shared.h"
-#include "../game/botlib.h"
+#include "../qcommon/q_shared.h"
+#include "botlib.h"
#include "be_interface.h"
#include "l_memory.h"
#include "l_script.h"
diff --git a/code/botlib/l_script.c b/code/botlib/l_script.c
index e782e7f..c4af638 100644
--- a/code/botlib/l_script.c
+++ b/code/botlib/l_script.c
@@ -49,8 +49,8 @@ typedef enum {qfalse, qtrue} qboolean;
#ifdef BOTLIB
//include files for usage in the bot library
-#include "../game/q_shared.h"
-#include "../game/botlib.h"
+#include "../qcommon/q_shared.h"
+#include "botlib.h"
#include "be_interface.h"
#include "l_script.h"
#include "l_memory.h"
diff --git a/code/botlib/l_struct.c b/code/botlib/l_struct.c
index c628821..ed47c39 100644
--- a/code/botlib/l_struct.c
+++ b/code/botlib/l_struct.c
@@ -30,8 +30,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
#ifdef BOTLIB
-#include "../game/q_shared.h"
-#include "../game/botlib.h" //for the include of be_interface.h
+#include "../qcommon/q_shared.h"
+#include "botlib.h" //for the include of be_interface.h
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"