Import OA 0.8.8 tree
This commit is contained in:
267
code/botlib/aasfile.h
Normal file
267
code/botlib/aasfile.h
Normal file
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
||||
//NOTE: int = default signed
|
||||
// default long
|
||||
|
||||
#define AASID (('S'<<24)+('A'<<16)+('A'<<8)+'E')
|
||||
#define AASVERSION_OLD 4
|
||||
#define AASVERSION 5
|
||||
|
||||
//presence types
|
||||
#define PRESENCE_NONE 1
|
||||
#define PRESENCE_NORMAL 2
|
||||
#define PRESENCE_CROUCH 4
|
||||
|
||||
//travel types
|
||||
#define MAX_TRAVELTYPES 32
|
||||
#define TRAVEL_INVALID 1 //temporary not possible
|
||||
#define TRAVEL_WALK 2 //walking
|
||||
#define TRAVEL_CROUCH 3 //crouching
|
||||
#define TRAVEL_BARRIERJUMP 4 //jumping onto a barrier
|
||||
#define TRAVEL_JUMP 5 //jumping
|
||||
#define TRAVEL_LADDER 6 //climbing a ladder
|
||||
#define TRAVEL_WALKOFFLEDGE 7 //walking of a ledge
|
||||
#define TRAVEL_SWIM 8 //swimming
|
||||
#define TRAVEL_WATERJUMP 9 //jump out of the water
|
||||
#define TRAVEL_TELEPORT 10 //teleportation
|
||||
#define TRAVEL_ELEVATOR 11 //travel by elevator
|
||||
#define TRAVEL_ROCKETJUMP 12 //rocket jumping required for travel
|
||||
#define TRAVEL_BFGJUMP 13 //bfg jumping required for travel
|
||||
#define TRAVEL_GRAPPLEHOOK 14 //grappling hook required for travel
|
||||
#define TRAVEL_DOUBLEJUMP 15 //double jump
|
||||
#define TRAVEL_RAMPJUMP 16 //ramp jump
|
||||
#define TRAVEL_STRAFEJUMP 17 //strafe jump
|
||||
#define TRAVEL_JUMPPAD 18 //jump pad
|
||||
#define TRAVEL_FUNCBOB 19 //func bob
|
||||
|
||||
//additional travel flags
|
||||
#define TRAVELTYPE_MASK 0xFFFFFF
|
||||
#define TRAVELFLAG_NOTTEAM1 (1 << 24)
|
||||
#define TRAVELFLAG_NOTTEAM2 (2 << 24)
|
||||
|
||||
//face flags
|
||||
#define FACE_SOLID 1 //just solid at the other side
|
||||
#define FACE_LADDER 2 //ladder
|
||||
#define FACE_GROUND 4 //standing on ground when in this face
|
||||
#define FACE_GAP 8 //gap in the ground
|
||||
#define FACE_LIQUID 16 //face seperating two areas with liquid
|
||||
#define FACE_LIQUIDSURFACE 32 //face seperating liquid and air
|
||||
#define FACE_BRIDGE 64 //can walk over this face if bridge is closed
|
||||
|
||||
//area contents
|
||||
#define AREACONTENTS_WATER 1
|
||||
#define AREACONTENTS_LAVA 2
|
||||
#define AREACONTENTS_SLIME 4
|
||||
#define AREACONTENTS_CLUSTERPORTAL 8
|
||||
#define AREACONTENTS_TELEPORTAL 16
|
||||
#define AREACONTENTS_ROUTEPORTAL 32
|
||||
#define AREACONTENTS_TELEPORTER 64
|
||||
#define AREACONTENTS_JUMPPAD 128
|
||||
#define AREACONTENTS_DONOTENTER 256
|
||||
#define AREACONTENTS_VIEWPORTAL 512
|
||||
#define AREACONTENTS_MOVER 1024
|
||||
#define AREACONTENTS_NOTTEAM1 2048
|
||||
#define AREACONTENTS_NOTTEAM2 4096
|
||||
//number of model of the mover inside this area
|
||||
#define AREACONTENTS_MODELNUMSHIFT 24
|
||||
#define AREACONTENTS_MAXMODELNUM 0xFF
|
||||
#define AREACONTENTS_MODELNUM (AREACONTENTS_MAXMODELNUM << AREACONTENTS_MODELNUMSHIFT)
|
||||
|
||||
//area flags
|
||||
#define AREA_GROUNDED 1 //bot can stand on the ground
|
||||
#define AREA_LADDER 2 //area contains one or more ladder faces
|
||||
#define AREA_LIQUID 4 //area contains a liquid
|
||||
#define AREA_DISABLED 8 //area is disabled for routing when set
|
||||
#define AREA_BRIDGE 16 //area ontop of a bridge
|
||||
|
||||
//aas file header lumps
|
||||
#define AAS_LUMPS 14
|
||||
#define AASLUMP_BBOXES 0
|
||||
#define AASLUMP_VERTEXES 1
|
||||
#define AASLUMP_PLANES 2
|
||||
#define AASLUMP_EDGES 3
|
||||
#define AASLUMP_EDGEINDEX 4
|
||||
#define AASLUMP_FACES 5
|
||||
#define AASLUMP_FACEINDEX 6
|
||||
#define AASLUMP_AREAS 7
|
||||
#define AASLUMP_AREASETTINGS 8
|
||||
#define AASLUMP_REACHABILITY 9
|
||||
#define AASLUMP_NODES 10
|
||||
#define AASLUMP_PORTALS 11
|
||||
#define AASLUMP_PORTALINDEX 12
|
||||
#define AASLUMP_CLUSTERS 13
|
||||
|
||||
//========== bounding box =========
|
||||
|
||||
//bounding box
|
||||
typedef struct aas_bbox_s
|
||||
{
|
||||
int presencetype;
|
||||
int flags;
|
||||
vec3_t mins, maxs;
|
||||
} aas_bbox_t;
|
||||
|
||||
//============ settings ===========
|
||||
|
||||
//reachability to another area
|
||||
typedef struct aas_reachability_s
|
||||
{
|
||||
int areanum; //number of the reachable area
|
||||
int facenum; //number of the face towards the other area
|
||||
int edgenum; //number of the edge towards the other area
|
||||
vec3_t start; //start point of inter area movement
|
||||
vec3_t end; //end point of inter area movement
|
||||
int traveltype; //type of travel required to get to the area
|
||||
unsigned short int traveltime;//travel time of the inter area movement
|
||||
} aas_reachability_t;
|
||||
|
||||
//area settings
|
||||
typedef struct aas_areasettings_s
|
||||
{
|
||||
//could also add all kind of statistic fields
|
||||
int contents; //contents of the area
|
||||
int areaflags; //several area flags
|
||||
int presencetype; //how a bot can be present in this area
|
||||
int cluster; //cluster the area belongs to, if negative it's a portal
|
||||
int clusterareanum; //number of the area in the cluster
|
||||
int numreachableareas; //number of reachable areas from this one
|
||||
int firstreachablearea; //first reachable area in the reachable area index
|
||||
} aas_areasettings_t;
|
||||
|
||||
//cluster portal
|
||||
typedef struct aas_portal_s
|
||||
{
|
||||
int areanum; //area that is the actual portal
|
||||
int frontcluster; //cluster at front of portal
|
||||
int backcluster; //cluster at back of portal
|
||||
int clusterareanum[2]; //number of the area in the front and back cluster
|
||||
} aas_portal_t;
|
||||
|
||||
//cluster portal index
|
||||
typedef int aas_portalindex_t;
|
||||
|
||||
//cluster
|
||||
typedef struct aas_cluster_s
|
||||
{
|
||||
int numareas; //number of areas in the cluster
|
||||
int numreachabilityareas; //number of areas with reachabilities
|
||||
int numportals; //number of cluster portals
|
||||
int firstportal; //first cluster portal in the index
|
||||
} aas_cluster_t;
|
||||
|
||||
//============ 3d definition ============
|
||||
|
||||
typedef vec3_t aas_vertex_t;
|
||||
|
||||
//just a plane in the third dimension
|
||||
typedef struct aas_plane_s
|
||||
{
|
||||
vec3_t normal; //normal vector of the plane
|
||||
float dist; //distance of the plane (normal vector * distance = point in plane)
|
||||
int type;
|
||||
} aas_plane_t;
|
||||
|
||||
//edge
|
||||
typedef struct aas_edge_s
|
||||
{
|
||||
int v[2]; //numbers of the vertexes of this edge
|
||||
} aas_edge_t;
|
||||
|
||||
//edge index, negative if vertexes are reversed
|
||||
typedef int aas_edgeindex_t;
|
||||
|
||||
//a face bounds an area, often it will also seperate two areas
|
||||
typedef struct aas_face_s
|
||||
{
|
||||
int planenum; //number of the plane this face is in
|
||||
int faceflags; //face flags (no use to create face settings for just this field)
|
||||
int numedges; //number of edges in the boundary of the face
|
||||
int firstedge; //first edge in the edge index
|
||||
int frontarea; //area at the front of this face
|
||||
int backarea; //area at the back of this face
|
||||
} aas_face_t;
|
||||
|
||||
//face index, stores a negative index if backside of face
|
||||
typedef int aas_faceindex_t;
|
||||
|
||||
//area with a boundary of faces
|
||||
typedef struct aas_area_s
|
||||
{
|
||||
int areanum; //number of this area
|
||||
//3d definition
|
||||
int numfaces; //number of faces used for the boundary of the area
|
||||
int firstface; //first face in the face index used for the boundary of the area
|
||||
vec3_t mins; //mins of the area
|
||||
vec3_t maxs; //maxs of the area
|
||||
vec3_t center; //'center' of the area
|
||||
} aas_area_t;
|
||||
|
||||
//nodes of the bsp tree
|
||||
typedef struct aas_node_s
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; //child nodes of this node, or areas as leaves when negative
|
||||
//when a child is zero it's a solid leaf
|
||||
} aas_node_t;
|
||||
|
||||
//=========== aas file ===============
|
||||
|
||||
//header lump
|
||||
typedef struct
|
||||
{
|
||||
int fileofs;
|
||||
int filelen;
|
||||
} aas_lump_t;
|
||||
|
||||
//aas file header
|
||||
typedef struct aas_header_s
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
int bspchecksum;
|
||||
//data entries
|
||||
aas_lump_t lumps[AAS_LUMPS];
|
||||
} aas_header_t;
|
||||
|
||||
|
||||
//====== additional information ======
|
||||
/*
|
||||
|
||||
- when a node child is a solid leaf the node child number is zero
|
||||
- two adjacent areas (sharing a plane at opposite sides) share a face
|
||||
this face is a portal between the areas
|
||||
- when an area uses a face from the faceindex with a positive index
|
||||
then the face plane normal points into the area
|
||||
- the face edges are stored counter clockwise using the edgeindex
|
||||
- two adjacent convex areas (sharing a face) only share One face
|
||||
this is a simple result of the areas being convex
|
||||
- the areas can't have a mixture of ground and gap faces
|
||||
other mixtures of faces in one area are allowed
|
||||
- areas with the AREACONTENTS_CLUSTERPORTAL in the settings have
|
||||
the cluster number set to the negative portal number
|
||||
- edge zero is a dummy
|
||||
- face zero is a dummy
|
||||
- area zero is a dummy
|
||||
- node zero is a dummy
|
||||
*/
|
221
code/botlib/be_aas.h
Normal file
221
code/botlib/be_aas.h
Normal file
@@ -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 Quake III Arena source code; 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;
|
89
code/botlib/be_aas_bsp.h
Normal file
89
code/botlib/be_aas_bsp.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_bsp.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_bsp.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
//loads the given BSP file
|
||||
int AAS_LoadBSPFile(void);
|
||||
//dump the loaded BSP data
|
||||
void AAS_DumpBSPData(void);
|
||||
//unlink the given entity from the bsp tree leaves
|
||||
void AAS_UnlinkFromBSPLeaves(bsp_link_t *leaves);
|
||||
//link the given entity to the bsp tree leaves of the given model
|
||||
bsp_link_t *AAS_BSPLinkEntity(vec3_t absmins,
|
||||
vec3_t absmaxs,
|
||||
int entnum,
|
||||
int modelnum);
|
||||
|
||||
//calculates collision with given entity
|
||||
qboolean AAS_EntityCollision(int entnum,
|
||||
vec3_t start,
|
||||
vec3_t boxmins,
|
||||
vec3_t boxmaxs,
|
||||
vec3_t end,
|
||||
int contentmask,
|
||||
bsp_trace_t *trace);
|
||||
//for debugging
|
||||
void AAS_PrintFreeBSPLinks(char *str);
|
||||
//
|
||||
#endif //AASINTERN
|
||||
|
||||
#define MAX_EPAIRKEY 128
|
||||
|
||||
//trace through the world
|
||||
bsp_trace_t AAS_Trace( vec3_t start,
|
||||
vec3_t mins,
|
||||
vec3_t maxs,
|
||||
vec3_t end,
|
||||
int passent,
|
||||
int contentmask);
|
||||
//returns the contents at the given point
|
||||
int AAS_PointContents(vec3_t point);
|
||||
//returns true when p2 is in the PVS of p1
|
||||
qboolean AAS_inPVS(vec3_t p1, vec3_t p2);
|
||||
//returns true when p2 is in the PHS of p1
|
||||
qboolean AAS_inPHS(vec3_t p1, vec3_t p2);
|
||||
//returns true if the given areas are connected
|
||||
qboolean AAS_AreasConnected(int area1, int area2);
|
||||
//creates a list with entities totally or partly within the given box
|
||||
int AAS_BoxEntities(vec3_t absmins, vec3_t absmaxs, int *list, int maxcount);
|
||||
//gets the mins, maxs and origin of a BSP model
|
||||
void AAS_BSPModelMinsMaxsOrigin(int modelnum, vec3_t angles, vec3_t mins, vec3_t maxs, vec3_t origin);
|
||||
//handle to the next bsp entity
|
||||
int AAS_NextBSPEntity(int ent);
|
||||
//return the value of the BSP epair key
|
||||
int AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size);
|
||||
//get a vector for the BSP epair key
|
||||
int AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v);
|
||||
//get a float for the BSP epair key
|
||||
int AAS_FloatForBSPEpairKey(int ent, char *key, float *value);
|
||||
//get an integer for the BSP epair key
|
||||
int AAS_IntForBSPEpairKey(int ent, char *key, int *value);
|
||||
|
38
code/botlib/be_aas_cluster.h
Normal file
38
code/botlib/be_aas_cluster.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_cluster.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_cluster.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
//initialize the AAS clustering
|
||||
void AAS_InitClustering(void);
|
||||
//
|
||||
void AAS_SetViewPortalsAsClusterPortals(void);
|
||||
#endif //AASINTERN
|
||||
|
62
code/botlib/be_aas_debug.h
Normal file
62
code/botlib/be_aas_debug.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_debug.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_debug.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//clear the shown debug lines
|
||||
void AAS_ClearShownDebugLines(void);
|
||||
//
|
||||
void AAS_ClearShownPolygons(void);
|
||||
//show a debug line
|
||||
void AAS_DebugLine(vec3_t start, vec3_t end, int color);
|
||||
//show a permenent line
|
||||
void AAS_PermanentLine(vec3_t start, vec3_t end, int color);
|
||||
//show a permanent cross
|
||||
void AAS_DrawPermanentCross(vec3_t origin, float size, int color);
|
||||
//draw a cross in the plane
|
||||
void AAS_DrawPlaneCross(vec3_t point, vec3_t normal, float dist, int type, int color);
|
||||
//show a bounding box
|
||||
void AAS_ShowBoundingBox(vec3_t origin, vec3_t mins, vec3_t maxs);
|
||||
//show a face
|
||||
void AAS_ShowFace(int facenum);
|
||||
//show an area
|
||||
void AAS_ShowArea(int areanum, int groundfacesonly);
|
||||
//
|
||||
void AAS_ShowAreaPolygons(int areanum, int color, int groundfacesonly);
|
||||
//draw a cros
|
||||
void AAS_DrawCross(vec3_t origin, float size, int color);
|
||||
//print the travel type
|
||||
void AAS_PrintTravelType(int traveltype);
|
||||
//draw an arrow
|
||||
void AAS_DrawArrow(vec3_t start, vec3_t end, int linecolor, int arrowcolor);
|
||||
//visualize the given reachability
|
||||
void AAS_ShowReachability(struct aas_reachability_s *reach);
|
||||
//show the reachable areas from the given area
|
||||
void AAS_ShowReachableAreas(int areanum);
|
||||
|
306
code/botlib/be_aas_def.h
Normal file
306
code/botlib/be_aas_def.h
Normal file
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_def.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_def.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//debugging on
|
||||
#define AAS_DEBUG
|
||||
|
||||
#define MAX_CLIENTS 64
|
||||
#define MAX_MODELS 256 // these are sent over the net as 8 bits
|
||||
#define MAX_SOUNDS 256 // so they cannot be blindly increased
|
||||
#define MAX_CONFIGSTRINGS 1024
|
||||
|
||||
#define CS_SCORES 32
|
||||
#define CS_MODELS (CS_SCORES+MAX_CLIENTS)
|
||||
#define CS_SOUNDS (CS_MODELS+MAX_MODELS)
|
||||
|
||||
#define DF_AASENTNUMBER(x) (x - aasworld.entities)
|
||||
#define DF_NUMBERAASENT(x) (&aasworld.entities[x])
|
||||
#define DF_AASENTCLIENT(x) (x - aasworld.entities - 1)
|
||||
#define DF_CLIENTAASENT(x) (&aasworld.entities[x + 1])
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH MAX_QPATH
|
||||
#endif
|
||||
|
||||
//string index (for model, sound and image index)
|
||||
typedef struct aas_stringindex_s
|
||||
{
|
||||
int numindexes;
|
||||
char **index;
|
||||
} aas_stringindex_t;
|
||||
|
||||
//structure to link entities to areas and areas to entities
|
||||
typedef struct aas_link_s
|
||||
{
|
||||
int entnum;
|
||||
int areanum;
|
||||
struct aas_link_s *next_ent, *prev_ent;
|
||||
struct aas_link_s *next_area, *prev_area;
|
||||
} aas_link_t;
|
||||
|
||||
//structure to link entities to leaves and leaves to entities
|
||||
typedef struct bsp_link_s
|
||||
{
|
||||
int entnum;
|
||||
int leafnum;
|
||||
struct bsp_link_s *next_ent, *prev_ent;
|
||||
struct bsp_link_s *next_leaf, *prev_leaf;
|
||||
} bsp_link_t;
|
||||
|
||||
typedef struct bsp_entdata_s
|
||||
{
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
vec3_t absmins;
|
||||
vec3_t absmaxs;
|
||||
int solid;
|
||||
int modelnum;
|
||||
} bsp_entdata_t;
|
||||
|
||||
//entity
|
||||
typedef struct aas_entity_s
|
||||
{
|
||||
//entity info
|
||||
aas_entityinfo_t i;
|
||||
//links into the AAS areas
|
||||
aas_link_t *areas;
|
||||
//links into the BSP leaves
|
||||
bsp_link_t *leaves;
|
||||
} aas_entity_t;
|
||||
|
||||
typedef struct aas_settings_s
|
||||
{
|
||||
vec3_t phys_gravitydirection;
|
||||
float phys_friction;
|
||||
float phys_stopspeed;
|
||||
float phys_gravity;
|
||||
float phys_waterfriction;
|
||||
float phys_watergravity;
|
||||
float phys_maxvelocity;
|
||||
float phys_maxwalkvelocity;
|
||||
float phys_maxcrouchvelocity;
|
||||
float phys_maxswimvelocity;
|
||||
float phys_walkaccelerate;
|
||||
float phys_airaccelerate;
|
||||
float phys_swimaccelerate;
|
||||
float phys_maxstep;
|
||||
float phys_maxsteepness;
|
||||
float phys_maxwaterjump;
|
||||
float phys_maxbarrier;
|
||||
float phys_jumpvel;
|
||||
float phys_falldelta5;
|
||||
float phys_falldelta10;
|
||||
float rs_waterjump;
|
||||
float rs_teleport;
|
||||
float rs_barrierjump;
|
||||
float rs_startcrouch;
|
||||
float rs_startgrapple;
|
||||
float rs_startwalkoffledge;
|
||||
float rs_startjump;
|
||||
float rs_rocketjump;
|
||||
float rs_bfgjump;
|
||||
float rs_jumppad;
|
||||
float rs_aircontrolledjumppad;
|
||||
float rs_funcbob;
|
||||
float rs_startelevator;
|
||||
float rs_falldamage5;
|
||||
float rs_falldamage10;
|
||||
float rs_maxfallheight;
|
||||
float rs_maxjumpfallheight;
|
||||
} aas_settings_t;
|
||||
|
||||
#define CACHETYPE_PORTAL 0
|
||||
#define CACHETYPE_AREA 1
|
||||
|
||||
//routing cache
|
||||
typedef struct aas_routingcache_s
|
||||
{
|
||||
byte type; //portal or area cache
|
||||
float time; //last time accessed or updated
|
||||
int size; //size of the routing cache
|
||||
int cluster; //cluster the cache is for
|
||||
int areanum; //area the cache is created for
|
||||
vec3_t origin; //origin within the area
|
||||
float starttraveltime; //travel time to start with
|
||||
int travelflags; //combinations of the travel flags
|
||||
struct aas_routingcache_s *prev, *next;
|
||||
struct aas_routingcache_s *time_prev, *time_next;
|
||||
unsigned char *reachabilities; //reachabilities used for routing
|
||||
unsigned short int traveltimes[1]; //travel time for every area (variable sized)
|
||||
} aas_routingcache_t;
|
||||
|
||||
//fields for the routing algorithm
|
||||
typedef struct aas_routingupdate_s
|
||||
{
|
||||
int cluster;
|
||||
int areanum; //area number of the update
|
||||
vec3_t start; //start point the area was entered
|
||||
unsigned short int tmptraveltime; //temporary travel time
|
||||
unsigned short int *areatraveltimes; //travel times within the area
|
||||
qboolean inlist; //true if the update is in the list
|
||||
struct aas_routingupdate_s *next;
|
||||
struct aas_routingupdate_s *prev;
|
||||
} aas_routingupdate_t;
|
||||
|
||||
//reversed reachability link
|
||||
typedef struct aas_reversedlink_s
|
||||
{
|
||||
int linknum; //the aas_areareachability_t
|
||||
int areanum; //reachable from this area
|
||||
struct aas_reversedlink_s *next; //next link
|
||||
} aas_reversedlink_t;
|
||||
|
||||
//reversed area reachability
|
||||
typedef struct aas_reversedreachability_s
|
||||
{
|
||||
int numlinks;
|
||||
aas_reversedlink_t *first;
|
||||
} aas_reversedreachability_t;
|
||||
|
||||
//areas a reachability goes through
|
||||
typedef struct aas_reachabilityareas_s
|
||||
{
|
||||
int firstarea, numareas;
|
||||
} aas_reachabilityareas_t;
|
||||
|
||||
typedef struct aas_s
|
||||
{
|
||||
int loaded; //true when an AAS file is loaded
|
||||
int initialized; //true when AAS has been initialized
|
||||
int savefile; //set true when file should be saved
|
||||
int bspchecksum;
|
||||
//current time
|
||||
float time;
|
||||
int numframes;
|
||||
//name of the aas file
|
||||
char filename[MAX_PATH];
|
||||
char mapname[MAX_PATH];
|
||||
//bounding boxes
|
||||
int numbboxes;
|
||||
aas_bbox_t *bboxes;
|
||||
//vertexes
|
||||
int numvertexes;
|
||||
aas_vertex_t *vertexes;
|
||||
//planes
|
||||
int numplanes;
|
||||
aas_plane_t *planes;
|
||||
//edges
|
||||
int numedges;
|
||||
aas_edge_t *edges;
|
||||
//edge index
|
||||
int edgeindexsize;
|
||||
aas_edgeindex_t *edgeindex;
|
||||
//faces
|
||||
int numfaces;
|
||||
aas_face_t *faces;
|
||||
//face index
|
||||
int faceindexsize;
|
||||
aas_faceindex_t *faceindex;
|
||||
//convex areas
|
||||
int numareas;
|
||||
aas_area_t *areas;
|
||||
//convex area settings
|
||||
int numareasettings;
|
||||
aas_areasettings_t *areasettings;
|
||||
//reachablity list
|
||||
int reachabilitysize;
|
||||
aas_reachability_t *reachability;
|
||||
//nodes of the bsp tree
|
||||
int numnodes;
|
||||
aas_node_t *nodes;
|
||||
//cluster portals
|
||||
int numportals;
|
||||
aas_portal_t *portals;
|
||||
//cluster portal index
|
||||
int portalindexsize;
|
||||
aas_portalindex_t *portalindex;
|
||||
//clusters
|
||||
int numclusters;
|
||||
aas_cluster_t *clusters;
|
||||
//
|
||||
int numreachabilityareas;
|
||||
float reachabilitytime;
|
||||
//enities linked in the areas
|
||||
aas_link_t *linkheap; //heap with link structures
|
||||
int linkheapsize; //size of the link heap
|
||||
aas_link_t *freelinks; //first free link
|
||||
aas_link_t **arealinkedentities; //entities linked into areas
|
||||
//entities
|
||||
int maxentities;
|
||||
int maxclients;
|
||||
aas_entity_t *entities;
|
||||
//string indexes
|
||||
char *configstrings[MAX_CONFIGSTRINGS];
|
||||
int indexessetup;
|
||||
//index to retrieve travel flag for a travel type
|
||||
int travelflagfortype[MAX_TRAVELTYPES];
|
||||
//travel flags for each area based on contents
|
||||
int *areacontentstravelflags;
|
||||
//routing update
|
||||
aas_routingupdate_t *areaupdate;
|
||||
aas_routingupdate_t *portalupdate;
|
||||
//number of routing updates during a frame (reset every frame)
|
||||
int frameroutingupdates;
|
||||
//reversed reachability links
|
||||
aas_reversedreachability_t *reversedreachability;
|
||||
//travel times within the areas
|
||||
unsigned short ***areatraveltimes;
|
||||
//array of size numclusters with cluster cache
|
||||
aas_routingcache_t ***clusterareacache;
|
||||
aas_routingcache_t **portalcache;
|
||||
//cache list sorted on time
|
||||
aas_routingcache_t *oldestcache; // start of cache list sorted on time
|
||||
aas_routingcache_t *newestcache; // end of cache list sorted on time
|
||||
//maximum travel time through portal areas
|
||||
int *portalmaxtraveltimes;
|
||||
//areas the reachabilities go through
|
||||
int *reachabilityareaindex;
|
||||
aas_reachabilityareas_t *reachabilityareas;
|
||||
} aas_t;
|
||||
|
||||
#define AASINTERN
|
||||
|
||||
#ifndef BSPCINCLUDE
|
||||
|
||||
#include "be_aas_main.h"
|
||||
#include "be_aas_entity.h"
|
||||
#include "be_aas_sample.h"
|
||||
#include "be_aas_cluster.h"
|
||||
#include "be_aas_reach.h"
|
||||
#include "be_aas_route.h"
|
||||
#include "be_aas_routealt.h"
|
||||
#include "be_aas_debug.h"
|
||||
#include "be_aas_file.h"
|
||||
#include "be_aas_optimize.h"
|
||||
#include "be_aas_bsp.h"
|
||||
#include "be_aas_move.h"
|
||||
|
||||
#endif //BSPCINCLUDE
|
63
code/botlib/be_aas_entity.h
Normal file
63
code/botlib/be_aas_entity.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_entity.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_entity.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
//invalidates all entity infos
|
||||
void AAS_InvalidateEntities(void);
|
||||
//unlink not updated entities
|
||||
void AAS_UnlinkInvalidEntities(void);
|
||||
//resets the entity AAS and BSP links (sets areas and leaves pointers to NULL)
|
||||
void AAS_ResetEntityLinks(void);
|
||||
//updates an entity
|
||||
int AAS_UpdateEntity(int ent, bot_entitystate_t *state);
|
||||
//gives the entity data used for collision detection
|
||||
void AAS_EntityBSPData(int entnum, bsp_entdata_t *entdata);
|
||||
#endif //AASINTERN
|
||||
|
||||
//returns the size of the entity bounding box in mins and maxs
|
||||
void AAS_EntitySize(int entnum, vec3_t mins, vec3_t maxs);
|
||||
//returns the BSP model number of the entity
|
||||
int AAS_EntityModelNum(int entnum);
|
||||
//returns the origin of an entity with the given model number
|
||||
int AAS_OriginOfMoverWithModelNum(int modelnum, vec3_t origin);
|
||||
//returns the best reachable area the entity is situated in
|
||||
int AAS_BestReachableEntityArea(int entnum);
|
||||
//returns the info of the given entity
|
||||
void AAS_EntityInfo(int entnum, aas_entityinfo_t *info);
|
||||
//returns the next entity
|
||||
int AAS_NextEntity(int entnum);
|
||||
//returns the origin of the entity
|
||||
void AAS_EntityOrigin(int entnum, vec3_t origin);
|
||||
//returns the entity type
|
||||
int AAS_EntityType(int entnum);
|
||||
//returns the model index of the entity
|
||||
int AAS_EntityModelindex(int entnum);
|
||||
|
42
code/botlib/be_aas_file.h
Normal file
42
code/botlib/be_aas_file.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_file.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_file.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
//loads the AAS file with the given name
|
||||
int AAS_LoadAASFile(char *filename);
|
||||
//writes an AAS file with the given name
|
||||
qboolean AAS_WriteAASFile(char *filename);
|
||||
//dumps the loaded AAS data
|
||||
void AAS_DumpAASData(void);
|
||||
//print AAS file information
|
||||
void AAS_FileInfo(void);
|
||||
#endif //AASINTERN
|
||||
|
47
code/botlib/be_aas_funcs.h
Normal file
47
code/botlib/be_aas_funcs.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_funcs.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_funcs.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef BSPCINCLUDE
|
||||
|
||||
#include "be_aas_main.h"
|
||||
#include "be_aas_entity.h"
|
||||
#include "be_aas_sample.h"
|
||||
#include "be_aas_cluster.h"
|
||||
#include "be_aas_reach.h"
|
||||
#include "be_aas_route.h"
|
||||
#include "be_aas_routealt.h"
|
||||
#include "be_aas_debug.h"
|
||||
#include "be_aas_file.h"
|
||||
#include "be_aas_optimize.h"
|
||||
#include "be_aas_bsp.h"
|
||||
#include "be_aas_move.h"
|
||||
|
||||
#endif //BSPCINCLUDE
|
61
code/botlib/be_aas_main.h
Normal file
61
code/botlib/be_aas_main.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_main.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_main.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
|
||||
extern aas_t aasworld;
|
||||
|
||||
//AAS error message
|
||||
void QDECL AAS_Error(char *fmt, ...);
|
||||
//set AAS initialized
|
||||
void AAS_SetInitialized(void);
|
||||
//setup AAS with the given number of entities and clients
|
||||
int AAS_Setup(void);
|
||||
//shutdown AAS
|
||||
void AAS_Shutdown(void);
|
||||
//start a new map
|
||||
int AAS_LoadMap(const char *mapname);
|
||||
//start a new time frame
|
||||
int AAS_StartFrame(float time);
|
||||
#endif //AASINTERN
|
||||
|
||||
//returns true if AAS is initialized
|
||||
int AAS_Initialized(void);
|
||||
//returns true if the AAS file is loaded
|
||||
int AAS_Loaded(void);
|
||||
//returns the model name from the given index
|
||||
char *AAS_ModelFromIndex(int index);
|
||||
//returns the index from the given model name
|
||||
int AAS_IndexFromModel(char *modelname);
|
||||
//returns the current time
|
||||
float AAS_Time(void);
|
||||
//
|
||||
void AAS_ProjectPointOntoVector( vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_t vProj );
|
71
code/botlib/be_aas_move.h
Normal file
71
code/botlib/be_aas_move.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_move.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_move.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
extern aas_settings_t aassettings;
|
||||
#endif //AASINTERN
|
||||
|
||||
//movement prediction
|
||||
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);
|
||||
//predict movement until bounding box is hit
|
||||
int AAS_ClientMovementHitBBox(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,
|
||||
vec3_t mins, vec3_t maxs, int visualize);
|
||||
//returns true if on the ground at the given origin
|
||||
int AAS_OnGround(vec3_t origin, int presencetype, int passent);
|
||||
//returns true if swimming at the given origin
|
||||
int AAS_Swimming(vec3_t origin);
|
||||
//returns the jump reachability run start point
|
||||
void AAS_JumpReachRunStart(struct aas_reachability_s *reach, vec3_t runstart);
|
||||
//returns true if against a ladder at the given origin
|
||||
int AAS_AgainstLadder(vec3_t origin);
|
||||
//rocket jump Z velocity when rocket-jumping at origin
|
||||
float AAS_RocketJumpZVelocity(vec3_t origin);
|
||||
//bfg jump Z velocity when bfg-jumping at origin
|
||||
float AAS_BFGJumpZVelocity(vec3_t origin);
|
||||
//calculates the horizontal velocity needed for a jump and returns true this velocity could be calculated
|
||||
int AAS_HorizontalVelocityForJump(float zvel, vec3_t start, vec3_t end, float *velocity);
|
||||
//
|
||||
void AAS_SetMovedir(vec3_t angles, vec3_t movedir);
|
||||
//
|
||||
int AAS_DropToFloor(vec3_t origin, vec3_t mins, vec3_t maxs);
|
||||
//
|
||||
void AAS_InitSettings(void);
|
33
code/botlib/be_aas_optimize.h
Normal file
33
code/botlib/be_aas_optimize.h
Normal file
@@ -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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_optimize.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_optimize.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void AAS_Optimize(void);
|
||||
|
68
code/botlib/be_aas_reach.h
Normal file
68
code/botlib/be_aas_reach.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_reach.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_reach.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
//initialize calculating the reachabilities
|
||||
void AAS_InitReachability(void);
|
||||
//continue calculating the reachabilities
|
||||
int AAS_ContinueInitReachability(float time);
|
||||
//
|
||||
int AAS_BestReachableLinkArea(aas_link_t *areas);
|
||||
#endif //AASINTERN
|
||||
|
||||
//returns true if the are has reachabilities to other areas
|
||||
int AAS_AreaReachability(int areanum);
|
||||
//returns the best reachable area and goal origin for a bounding box at the given origin
|
||||
int AAS_BestReachableArea(vec3_t origin, vec3_t mins, vec3_t maxs, vec3_t goalorigin);
|
||||
//returns the best jumppad area from which the bbox at origin is reachable
|
||||
int AAS_BestReachableFromJumpPadArea(vec3_t origin, vec3_t mins, vec3_t maxs);
|
||||
//returns the next reachability using the given model
|
||||
int AAS_NextModelReachability(int num, int modelnum);
|
||||
//returns the total area of the ground faces of the given area
|
||||
float AAS_AreaGroundFaceArea(int areanum);
|
||||
//returns true if the area is crouch only
|
||||
int AAS_AreaCrouch(int areanum);
|
||||
//returns true if a player can swim in this area
|
||||
int AAS_AreaSwim(int areanum);
|
||||
//returns true if the area is filled with a liquid
|
||||
int AAS_AreaLiquid(int areanum);
|
||||
//returns true if the area contains lava
|
||||
int AAS_AreaLava(int areanum);
|
||||
//returns true if the area contains slime
|
||||
int AAS_AreaSlime(int areanum);
|
||||
//returns true if the area has one or more ground faces
|
||||
int AAS_AreaGrounded(int areanum);
|
||||
//returns true if the area has one or more ladder faces
|
||||
int AAS_AreaLadder(int areanum);
|
||||
//returns true if the area is a jump pad
|
||||
int AAS_AreaJumpPad(int areanum);
|
||||
//returns true if the area is donotenter
|
||||
int AAS_AreaDoNotEnter(int areanum);
|
67
code/botlib/be_aas_route.h
Normal file
67
code/botlib/be_aas_route.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_route.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_route.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
//initialize the AAS routing
|
||||
void AAS_InitRouting(void);
|
||||
//free the AAS routing caches
|
||||
void AAS_FreeRoutingCaches(void);
|
||||
//returns the travel time from start to end in the given area
|
||||
unsigned short int AAS_AreaTravelTime(int areanum, vec3_t start, vec3_t end);
|
||||
//
|
||||
void AAS_CreateAllRoutingCache(void);
|
||||
void AAS_WriteRouteCache(void);
|
||||
//
|
||||
void AAS_RoutingInfo(void);
|
||||
#endif //AASINTERN
|
||||
|
||||
//returns the travel flag for the given travel type
|
||||
int AAS_TravelFlagForType(int traveltype);
|
||||
//return the travel flag(s) for traveling through this area
|
||||
int AAS_AreaContentsTravelFlags(int areanum);
|
||||
//returns the index of the next reachability for the given area
|
||||
int AAS_NextAreaReachability(int areanum, int reachnum);
|
||||
//returns the reachability with the given index
|
||||
void AAS_ReachabilityFromNum(int num, struct aas_reachability_s *reach);
|
||||
//returns a random goal area and goal origin
|
||||
int AAS_RandomGoalArea(int areanum, int travelflags, int *goalareanum, vec3_t goalorigin);
|
||||
//enable or disable an area for routing
|
||||
int AAS_EnableRoutingArea(int areanum, int enable);
|
||||
//returns the travel time within the given area from start to end
|
||||
unsigned short int AAS_AreaTravelTime(int areanum, vec3_t start, vec3_t end);
|
||||
//returns the travel time from the area to the goal area using the given travel flags
|
||||
int AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags);
|
||||
//predict a route up to a stop event
|
||||
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);
|
||||
|
||||
|
40
code/botlib/be_aas_routealt.h
Normal file
40
code/botlib/be_aas_routealt.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_routealt.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_routealt.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
void AAS_InitAlternativeRouting(void);
|
||||
void AAS_ShutdownAlternativeRouting(void);
|
||||
#endif //AASINTERN
|
||||
|
||||
|
||||
int AAS_AlternativeRouteGoals(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
|
||||
aas_altroutegoal_t *altroutegoals, int maxaltroutegoals,
|
||||
int type);
|
69
code/botlib/be_aas_sample.h
Normal file
69
code/botlib/be_aas_sample.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_aas_sample.h
|
||||
*
|
||||
* desc: AAS
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_aas_sample.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef AASINTERN
|
||||
void AAS_InitAASLinkHeap(void);
|
||||
void AAS_InitAASLinkedEntities(void);
|
||||
void AAS_FreeAASLinkHeap(void);
|
||||
void AAS_FreeAASLinkedEntities(void);
|
||||
aas_face_t *AAS_AreaGroundFace(int areanum, vec3_t point);
|
||||
aas_face_t *AAS_TraceEndFace(aas_trace_t *trace);
|
||||
aas_plane_t *AAS_PlaneFromNum(int planenum);
|
||||
aas_link_t *AAS_AASLinkEntity(vec3_t absmins, vec3_t absmaxs, int entnum);
|
||||
aas_link_t *AAS_LinkEntityClientBBox(vec3_t absmins, vec3_t absmaxs, int entnum, int presencetype);
|
||||
qboolean AAS_PointInsideFace(int facenum, vec3_t point, float epsilon);
|
||||
qboolean AAS_InsideFace(aas_face_t *face, vec3_t pnormal, vec3_t point, float epsilon);
|
||||
void AAS_UnlinkFromAreas(aas_link_t *areas);
|
||||
#endif //AASINTERN
|
||||
|
||||
//returns the mins and maxs of the bounding box for the given presence type
|
||||
void AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs);
|
||||
//returns the cluster the area is in (negative portal number if the area is a portal)
|
||||
int AAS_AreaCluster(int areanum);
|
||||
//returns the presence type(s) of the area
|
||||
int AAS_AreaPresenceType(int areanum);
|
||||
//returns the presence type(s) at the given point
|
||||
int AAS_PointPresenceType(vec3_t point);
|
||||
//returns the result of the trace of a client bbox
|
||||
aas_trace_t AAS_TraceClientBBox(vec3_t start, vec3_t end, int presencetype, int passent);
|
||||
//stores the areas the trace went through and returns the number of passed areas
|
||||
int AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas);
|
||||
//returns the areas the bounding box is in
|
||||
int AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas);
|
||||
//return area information
|
||||
int AAS_AreaInfo( int areanum, aas_areainfo_t *info );
|
||||
//returns the area the point is in
|
||||
int AAS_PointAreaNum(vec3_t point);
|
||||
//
|
||||
int AAS_PointReachabilityAreaIndex( vec3_t point );
|
||||
//returns the plane the given face is in
|
||||
void AAS_FacePlane(int facenum, vec3_t normal, float *dist);
|
||||
|
48
code/botlib/be_ai_char.h
Normal file
48
code/botlib/be_ai_char.h
Normal file
@@ -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 Quake III Arena source code; 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);
|
113
code/botlib/be_ai_chat.h
Normal file
113
code/botlib/be_ai_chat.h
Normal file
@@ -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 Quake III Arena source code; 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);
|
||||
|
33
code/botlib/be_ai_gen.h
Normal file
33
code/botlib/be_ai_gen.h
Normal file
@@ -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 Quake III Arena source code; 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);
|
118
code/botlib/be_ai_goal.h
Normal file
118
code/botlib/be_ai_goal.h
Normal file
@@ -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 Quake III Arena source code; 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);
|
142
code/botlib/be_ai_move.h
Normal file
142
code/botlib/be_ai_move.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; 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}}
|
||||
|
||||
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);
|
||||
|
104
code/botlib/be_ai_weap.h
Normal file
104
code/botlib/be_ai_weap.h
Normal file
@@ -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 Quake III Arena source code; 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);
|
83
code/botlib/be_ai_weight.h
Normal file
83
code/botlib/be_ai_weight.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_ai_weight.h
|
||||
*
|
||||
* desc: fuzzy weights
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_ai_weight.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define WT_BALANCE 1
|
||||
#define MAX_WEIGHTS 128
|
||||
|
||||
//fuzzy seperator
|
||||
typedef struct fuzzyseperator_s
|
||||
{
|
||||
int index;
|
||||
int value;
|
||||
int type;
|
||||
float weight;
|
||||
float minweight;
|
||||
float maxweight;
|
||||
struct fuzzyseperator_s *child;
|
||||
struct fuzzyseperator_s *next;
|
||||
} fuzzyseperator_t;
|
||||
|
||||
//fuzzy weight
|
||||
typedef struct weight_s
|
||||
{
|
||||
char *name;
|
||||
struct fuzzyseperator_s *firstseperator;
|
||||
} weight_t;
|
||||
|
||||
//weight configuration
|
||||
typedef struct weightconfig_s
|
||||
{
|
||||
int numweights;
|
||||
weight_t weights[MAX_WEIGHTS];
|
||||
char filename[MAX_QPATH];
|
||||
} weightconfig_t;
|
||||
|
||||
//reads a weight configuration
|
||||
weightconfig_t *ReadWeightConfig(char *filename);
|
||||
//free a weight configuration
|
||||
void FreeWeightConfig(weightconfig_t *config);
|
||||
//writes a weight configuration, returns true if successfull
|
||||
qboolean WriteWeightConfig(char *filename, weightconfig_t *config);
|
||||
//find the fuzzy weight with the given name
|
||||
int FindFuzzyWeight(weightconfig_t *wc, char *name);
|
||||
//returns the fuzzy weight for the given inventory and weight
|
||||
float FuzzyWeight(int *inventory, weightconfig_t *wc, int weightnum);
|
||||
float FuzzyWeightUndecided(int *inventory, weightconfig_t *wc, int weightnum);
|
||||
//scales the weight with the given name
|
||||
void ScaleWeight(weightconfig_t *config, char *name, float scale);
|
||||
//scale the balance range
|
||||
void ScaleBalanceRange(weightconfig_t *config, float scale);
|
||||
//evolves the weight configuration
|
||||
void EvolveWeightConfig(weightconfig_t *config);
|
||||
//interbreed the weight configurations and stores the interbreeded one in configout
|
||||
void InterbreedWeightConfigs(weightconfig_t *config1, weightconfig_t *config2, weightconfig_t *configout);
|
||||
//frees cached weight configurations
|
||||
void BotShutdownWeights(void);
|
66
code/botlib/be_ea.h
Normal file
66
code/botlib/be_ea.h
Normal file
@@ -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 Quake III Arena source code; 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);
|
57
code/botlib/be_interface.h
Normal file
57
code/botlib/be_interface.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: be_interface.h
|
||||
*
|
||||
* desc: botlib interface
|
||||
*
|
||||
* $Archive: /source/code/botlib/be_interface.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//#define DEBUG //debug code
|
||||
#define RANDOMIZE //randomize bot behaviour
|
||||
|
||||
//FIXME: get rid of this global structure
|
||||
typedef struct botlib_globals_s
|
||||
{
|
||||
int botlibsetup; //true when the bot library has been setup
|
||||
int maxentities; //maximum number of entities
|
||||
int maxclients; //maximum number of clients
|
||||
float time; //the global time
|
||||
#ifdef DEBUG
|
||||
qboolean debug; //true if debug is on
|
||||
int goalareanum;
|
||||
vec3_t goalorigin;
|
||||
int runai;
|
||||
#endif
|
||||
} botlib_globals_t;
|
||||
|
||||
|
||||
extern botlib_globals_t botlibglobals;
|
||||
extern botlib_import_t botimport;
|
||||
extern int bot_developer; //true if developer is on
|
||||
|
||||
//
|
||||
int Sys_MilliSeconds(void);
|
||||
|
516
code/botlib/botlib.h
Normal file
516
code/botlib/botlib.h
Normal file
@@ -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 Quake III Arena source code; 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
|
||||
|
||||
*/
|
||||
|
29
code/botlib/l_crc.h
Normal file
29
code/botlib/l_crc.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
typedef unsigned short crc_t;
|
||||
|
||||
void CRC_Init(unsigned short *crcvalue);
|
||||
void CRC_ProcessByte(unsigned short *crcvalue, byte data);
|
||||
unsigned short CRC_Value(unsigned short crcvalue);
|
||||
unsigned short CRC_ProcessString(unsigned char *data, int length);
|
||||
void CRC_ContinueProcessString(unsigned short *crc, char *data, int length);
|
63
code/botlib/l_libvar.h
Normal file
63
code/botlib/l_libvar.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_libvar.h
|
||||
*
|
||||
* desc: botlib vars
|
||||
*
|
||||
* $Archive: /source/code/botlib/l_libvar.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//library variable
|
||||
typedef struct libvar_s
|
||||
{
|
||||
char *name;
|
||||
char *string;
|
||||
int flags;
|
||||
qboolean modified; // set each time the cvar is changed
|
||||
float value;
|
||||
struct libvar_s *next;
|
||||
} libvar_t;
|
||||
|
||||
//removes all library variables
|
||||
void LibVarDeAllocAll(void);
|
||||
//gets the library variable with the given name
|
||||
libvar_t *LibVarGet(char *var_name);
|
||||
//gets the string of the library variable with the given name
|
||||
char *LibVarGetString(char *var_name);
|
||||
//gets the value of the library variable with the given name
|
||||
float LibVarGetValue(char *var_name);
|
||||
//creates the library variable if not existing already and returns it
|
||||
libvar_t *LibVar(char *var_name, char *value);
|
||||
//creates the library variable if not existing already and returns the value
|
||||
float LibVarValue(char *var_name, char *value);
|
||||
//creates the library variable if not existing already and returns the value string
|
||||
char *LibVarString(char *var_name, char *value);
|
||||
//sets the library variable
|
||||
void LibVarSet(char *var_name, char *value);
|
||||
//returns true if the library variable has been modified
|
||||
qboolean LibVarChanged(char *var_name);
|
||||
//sets the library variable to unmodified
|
||||
void LibVarSetNotModified(char *var_name);
|
||||
|
46
code/botlib/l_log.h
Normal file
46
code/botlib/l_log.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_log.h
|
||||
*
|
||||
* desc: log file
|
||||
*
|
||||
* $Archive: /source/code/botlib/l_log.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//open a log file
|
||||
void Log_Open(char *filename);
|
||||
//close the current log file
|
||||
void Log_Close(void);
|
||||
//close log file if present
|
||||
void Log_Shutdown(void);
|
||||
//write to the current opened log file
|
||||
void QDECL Log_Write(char *fmt, ...);
|
||||
//write to the current opened log file with a time stamp
|
||||
void QDECL Log_WriteTimeStamped(char *fmt, ...);
|
||||
//returns a pointer to the log file
|
||||
FILE *Log_FilePointer(void);
|
||||
//flush log file
|
||||
void Log_Flush(void);
|
||||
|
76
code/botlib/l_memory.h
Normal file
76
code/botlib/l_memory.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_memory.h
|
||||
*
|
||||
* desc: memory management
|
||||
*
|
||||
* $Archive: /source/code/botlib/l_memory.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//#define MEMDEBUG
|
||||
|
||||
#ifdef MEMDEBUG
|
||||
#define GetMemory(size) GetMemoryDebug(size, #size, __FILE__, __LINE__);
|
||||
#define GetClearedMemory(size) GetClearedMemoryDebug(size, #size, __FILE__, __LINE__);
|
||||
//allocate a memory block of the given size
|
||||
void *GetMemoryDebug(unsigned long size, char *label, char *file, int line);
|
||||
//allocate a memory block of the given size and clear it
|
||||
void *GetClearedMemoryDebug(unsigned long size, char *label, char *file, int line);
|
||||
//
|
||||
#define GetHunkMemory(size) GetHunkMemoryDebug(size, #size, __FILE__, __LINE__);
|
||||
#define GetClearedHunkMemory(size) GetClearedHunkMemoryDebug(size, #size, __FILE__, __LINE__);
|
||||
//allocate a memory block of the given size
|
||||
void *GetHunkMemoryDebug(unsigned long size, char *label, char *file, int line);
|
||||
//allocate a memory block of the given size and clear it
|
||||
void *GetClearedHunkMemoryDebug(unsigned long size, char *label, char *file, int line);
|
||||
#else
|
||||
//allocate a memory block of the given size
|
||||
void *GetMemory(unsigned long size);
|
||||
//allocate a memory block of the given size and clear it
|
||||
void *GetClearedMemory(unsigned long size);
|
||||
//
|
||||
#ifdef BSPC
|
||||
#define GetHunkMemory GetMemory
|
||||
#define GetClearedHunkMemory GetClearedMemory
|
||||
#else
|
||||
//allocate a memory block of the given size
|
||||
void *GetHunkMemory(unsigned long size);
|
||||
//allocate a memory block of the given size and clear it
|
||||
void *GetClearedHunkMemory(unsigned long size);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//free the given memory block
|
||||
void FreeMemory(void *ptr);
|
||||
//returns the amount available memory
|
||||
int AvailableMemory(void);
|
||||
//prints the total used memory size
|
||||
void PrintUsedMemorySize(void);
|
||||
//print all memory blocks with label
|
||||
void PrintMemoryLabels(void);
|
||||
//returns the size of the memory block in bytes
|
||||
int MemoryByteSize(void *ptr);
|
||||
//free all allocated memory
|
||||
void DumpMemory(void);
|
180
code/botlib/l_precomp.h
Normal file
180
code/botlib/l_precomp.h
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_precomp.h
|
||||
*
|
||||
* desc: pre compiler
|
||||
*
|
||||
* $Archive: /source/code/botlib/l_precomp.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH MAX_QPATH
|
||||
#endif
|
||||
|
||||
#ifndef PATH_SEPERATORSTR
|
||||
#if defined(WIN32)|defined(_WIN32)|defined(__NT__)|defined(__WINDOWS__)|defined(__WINDOWS_386__)
|
||||
#define PATHSEPERATOR_STR "\\"
|
||||
#else
|
||||
#define PATHSEPERATOR_STR "/"
|
||||
#endif
|
||||
#endif
|
||||
#ifndef PATH_SEPERATORCHAR
|
||||
#if defined(WIN32)|defined(_WIN32)|defined(__NT__)|defined(__WINDOWS__)|defined(__WINDOWS_386__)
|
||||
#define PATHSEPERATOR_CHAR '\\'
|
||||
#else
|
||||
#define PATHSEPERATOR_CHAR '/'
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BSPC) && !defined(QDECL)
|
||||
#define QDECL
|
||||
#endif
|
||||
|
||||
|
||||
#define DEFINE_FIXED 0x0001
|
||||
|
||||
#define BUILTIN_LINE 1
|
||||
#define BUILTIN_FILE 2
|
||||
#define BUILTIN_DATE 3
|
||||
#define BUILTIN_TIME 4
|
||||
#define BUILTIN_STDC 5
|
||||
|
||||
#define INDENT_IF 0x0001
|
||||
#define INDENT_ELSE 0x0002
|
||||
#define INDENT_ELIF 0x0004
|
||||
#define INDENT_IFDEF 0x0008
|
||||
#define INDENT_IFNDEF 0x0010
|
||||
|
||||
//macro definitions
|
||||
typedef struct define_s
|
||||
{
|
||||
char *name; //define name
|
||||
int flags; //define flags
|
||||
int builtin; // > 0 if builtin define
|
||||
int numparms; //number of define parameters
|
||||
token_t *parms; //define parameters
|
||||
token_t *tokens; //macro tokens (possibly containing parm tokens)
|
||||
struct define_s *next; //next defined macro in a list
|
||||
struct define_s *hashnext; //next define in the hash chain
|
||||
} define_t;
|
||||
|
||||
//indents
|
||||
//used for conditional compilation directives:
|
||||
//#if, #else, #elif, #ifdef, #ifndef
|
||||
typedef struct indent_s
|
||||
{
|
||||
int type; //indent type
|
||||
int skip; //true if skipping current indent
|
||||
script_t *script; //script the indent was in
|
||||
struct indent_s *next; //next indent on the indent stack
|
||||
} indent_t;
|
||||
|
||||
//source file
|
||||
typedef struct source_s
|
||||
{
|
||||
char filename[1024]; //file name of the script
|
||||
char includepath[1024]; //path to include files
|
||||
punctuation_t *punctuations; //punctuations to use
|
||||
script_t *scriptstack; //stack with scripts of the source
|
||||
token_t *tokens; //tokens to read first
|
||||
define_t *defines; //list with macro definitions
|
||||
define_t **definehash; //hash chain with defines
|
||||
indent_t *indentstack; //stack with indents
|
||||
int skip; // > 0 if skipping conditional code
|
||||
token_t token; //last read token
|
||||
} source_t;
|
||||
|
||||
|
||||
//read a token from the source
|
||||
int PC_ReadToken(source_t *source, token_t *token);
|
||||
//expect a certain token
|
||||
int PC_ExpectTokenString(source_t *source, char *string);
|
||||
//expect a certain token type
|
||||
int PC_ExpectTokenType(source_t *source, int type, int subtype, token_t *token);
|
||||
//expect a token
|
||||
int PC_ExpectAnyToken(source_t *source, token_t *token);
|
||||
//returns true when the token is available
|
||||
int PC_CheckTokenString(source_t *source, char *string);
|
||||
//returns true an reads the token when a token with the given type is available
|
||||
int PC_CheckTokenType(source_t *source, int type, int subtype, token_t *token);
|
||||
//skip tokens until the given token string is read
|
||||
int PC_SkipUntilString(source_t *source, char *string);
|
||||
//unread the last token read from the script
|
||||
void PC_UnreadLastToken(source_t *source);
|
||||
//unread the given token
|
||||
void PC_UnreadToken(source_t *source, token_t *token);
|
||||
//read a token only if on the same line, lines are concatenated with a slash
|
||||
int PC_ReadLine(source_t *source, token_t *token);
|
||||
//returns true if there was a white space in front of the token
|
||||
int PC_WhiteSpaceBeforeToken(token_t *token);
|
||||
//add a define to the source
|
||||
int PC_AddDefine(source_t *source, char *string);
|
||||
//add a globals define that will be added to all opened sources
|
||||
int PC_AddGlobalDefine(char *string);
|
||||
//remove the given global define
|
||||
int PC_RemoveGlobalDefine(char *name);
|
||||
//remove all globals defines
|
||||
void PC_RemoveAllGlobalDefines(void);
|
||||
//add builtin defines
|
||||
void PC_AddBuiltinDefines(source_t *source);
|
||||
//set the source include path
|
||||
void PC_SetIncludePath(source_t *source, char *path);
|
||||
//set the punction set
|
||||
void PC_SetPunctuations(source_t *source, punctuation_t *p);
|
||||
//set the base folder to load files from
|
||||
void PC_SetBaseFolder(char *path);
|
||||
//load a source file
|
||||
source_t *LoadSourceFile(const char *filename);
|
||||
//load a source from memory
|
||||
source_t *LoadSourceMemory(char *ptr, int length, char *name);
|
||||
//free the given source
|
||||
void FreeSource(source_t *source);
|
||||
//print a source error
|
||||
void QDECL SourceError(source_t *source, char *str, ...);
|
||||
//print a source warning
|
||||
void QDECL SourceWarning(source_t *source, char *str, ...);
|
||||
|
||||
#ifdef BSPC
|
||||
// some of BSPC source does include game/q_shared.h and some does not
|
||||
// we define pc_token_s pc_token_t if needed (yes, it's ugly)
|
||||
#ifndef __Q_SHARED_H
|
||||
#define MAX_TOKENLENGTH 1024
|
||||
typedef struct pc_token_s
|
||||
{
|
||||
int type;
|
||||
int subtype;
|
||||
int intvalue;
|
||||
float floatvalue;
|
||||
char string[MAX_TOKENLENGTH];
|
||||
} pc_token_t;
|
||||
#endif //!_Q_SHARED_H
|
||||
#endif //BSPC
|
||||
|
||||
//
|
||||
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);
|
||||
void PC_CheckOpenSourceHandles(void);
|
247
code/botlib/l_script.h
Normal file
247
code/botlib/l_script.h
Normal file
@@ -0,0 +1,247 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_script.h
|
||||
*
|
||||
* desc: lexicographical parser
|
||||
*
|
||||
* $Archive: /source/code/botlib/l_script.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//undef if binary numbers of the form 0b... or 0B... are not allowed
|
||||
#define BINARYNUMBERS
|
||||
//undef if not using the token.intvalue and token.floatvalue
|
||||
#define NUMBERVALUE
|
||||
//use dollar sign also as punctuation
|
||||
#define DOLLAR
|
||||
|
||||
//maximum token length
|
||||
#define MAX_TOKEN 1024
|
||||
|
||||
#if defined(BSPC) && !defined(QDECL)
|
||||
#define QDECL
|
||||
#endif
|
||||
|
||||
|
||||
//script flags
|
||||
#define SCFL_NOERRORS 0x0001
|
||||
#define SCFL_NOWARNINGS 0x0002
|
||||
#define SCFL_NOSTRINGWHITESPACES 0x0004
|
||||
#define SCFL_NOSTRINGESCAPECHARS 0x0008
|
||||
#define SCFL_PRIMITIVE 0x0010
|
||||
#define SCFL_NOBINARYNUMBERS 0x0020
|
||||
#define SCFL_NONUMBERVALUES 0x0040
|
||||
|
||||
//token types
|
||||
#define TT_STRING 1 // string
|
||||
#define TT_LITERAL 2 // literal
|
||||
#define TT_NUMBER 3 // number
|
||||
#define TT_NAME 4 // name
|
||||
#define TT_PUNCTUATION 5 // punctuation
|
||||
|
||||
//string sub type
|
||||
//---------------
|
||||
// the length of the string
|
||||
//literal sub type
|
||||
//----------------
|
||||
// the ASCII code of the literal
|
||||
//number sub type
|
||||
//---------------
|
||||
#define TT_DECIMAL 0x0008 // decimal number
|
||||
#define TT_HEX 0x0100 // hexadecimal number
|
||||
#define TT_OCTAL 0x0200 // octal number
|
||||
#ifdef BINARYNUMBERS
|
||||
#define TT_BINARY 0x0400 // binary number
|
||||
#endif //BINARYNUMBERS
|
||||
#define TT_FLOAT 0x0800 // floating point number
|
||||
#define TT_INTEGER 0x1000 // integer number
|
||||
#define TT_LONG 0x2000 // long number
|
||||
#define TT_UNSIGNED 0x4000 // unsigned number
|
||||
//punctuation sub type
|
||||
//--------------------
|
||||
#define P_RSHIFT_ASSIGN 1
|
||||
#define P_LSHIFT_ASSIGN 2
|
||||
#define P_PARMS 3
|
||||
#define P_PRECOMPMERGE 4
|
||||
|
||||
#define P_LOGIC_AND 5
|
||||
#define P_LOGIC_OR 6
|
||||
#define P_LOGIC_GEQ 7
|
||||
#define P_LOGIC_LEQ 8
|
||||
#define P_LOGIC_EQ 9
|
||||
#define P_LOGIC_UNEQ 10
|
||||
|
||||
#define P_MUL_ASSIGN 11
|
||||
#define P_DIV_ASSIGN 12
|
||||
#define P_MOD_ASSIGN 13
|
||||
#define P_ADD_ASSIGN 14
|
||||
#define P_SUB_ASSIGN 15
|
||||
#define P_INC 16
|
||||
#define P_DEC 17
|
||||
|
||||
#define P_BIN_AND_ASSIGN 18
|
||||
#define P_BIN_OR_ASSIGN 19
|
||||
#define P_BIN_XOR_ASSIGN 20
|
||||
#define P_RSHIFT 21
|
||||
#define P_LSHIFT 22
|
||||
|
||||
#define P_POINTERREF 23
|
||||
#define P_CPP1 24
|
||||
#define P_CPP2 25
|
||||
#define P_MUL 26
|
||||
#define P_DIV 27
|
||||
#define P_MOD 28
|
||||
#define P_ADD 29
|
||||
#define P_SUB 30
|
||||
#define P_ASSIGN 31
|
||||
|
||||
#define P_BIN_AND 32
|
||||
#define P_BIN_OR 33
|
||||
#define P_BIN_XOR 34
|
||||
#define P_BIN_NOT 35
|
||||
|
||||
#define P_LOGIC_NOT 36
|
||||
#define P_LOGIC_GREATER 37
|
||||
#define P_LOGIC_LESS 38
|
||||
|
||||
#define P_REF 39
|
||||
#define P_COMMA 40
|
||||
#define P_SEMICOLON 41
|
||||
#define P_COLON 42
|
||||
#define P_QUESTIONMARK 43
|
||||
|
||||
#define P_PARENTHESESOPEN 44
|
||||
#define P_PARENTHESESCLOSE 45
|
||||
#define P_BRACEOPEN 46
|
||||
#define P_BRACECLOSE 47
|
||||
#define P_SQBRACKETOPEN 48
|
||||
#define P_SQBRACKETCLOSE 49
|
||||
#define P_BACKSLASH 50
|
||||
|
||||
#define P_PRECOMP 51
|
||||
#define P_DOLLAR 52
|
||||
//name sub type
|
||||
//-------------
|
||||
// the length of the name
|
||||
|
||||
//punctuation
|
||||
typedef struct punctuation_s
|
||||
{
|
||||
char *p; //punctuation character(s)
|
||||
int n; //punctuation indication
|
||||
struct punctuation_s *next; //next punctuation
|
||||
} punctuation_t;
|
||||
|
||||
//token
|
||||
typedef struct token_s
|
||||
{
|
||||
char string[MAX_TOKEN]; //available token
|
||||
int type; //last read token type
|
||||
int subtype; //last read token sub type
|
||||
#ifdef NUMBERVALUE
|
||||
unsigned long int intvalue; //integer value
|
||||
float floatvalue; //floating point value
|
||||
#endif //NUMBERVALUE
|
||||
char *whitespace_p; //start of white space before token
|
||||
char *endwhitespace_p; //start of white space before token
|
||||
int line; //line the token was on
|
||||
int linescrossed; //lines crossed in white space
|
||||
struct token_s *next; //next token in chain
|
||||
} token_t;
|
||||
|
||||
//script file
|
||||
typedef struct script_s
|
||||
{
|
||||
char filename[1024]; //file name of the script
|
||||
char *buffer; //buffer containing the script
|
||||
char *script_p; //current pointer in the script
|
||||
char *end_p; //pointer to the end of the script
|
||||
char *lastscript_p; //script pointer before reading token
|
||||
char *whitespace_p; //begin of the white space
|
||||
char *endwhitespace_p; //end of the white space
|
||||
int length; //length of the script in bytes
|
||||
int line; //current line in script
|
||||
int lastline; //line before reading token
|
||||
int tokenavailable; //set by UnreadLastToken
|
||||
int flags; //several script flags
|
||||
punctuation_t *punctuations; //the punctuations used in the script
|
||||
punctuation_t **punctuationtable;
|
||||
token_t token; //available token
|
||||
struct script_s *next; //next script in a chain
|
||||
} script_t;
|
||||
|
||||
//read a token from the script
|
||||
int PS_ReadToken(script_t *script, token_t *token);
|
||||
//expect a certain token
|
||||
int PS_ExpectTokenString(script_t *script, char *string);
|
||||
//expect a certain token type
|
||||
int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token);
|
||||
//expect a token
|
||||
int PS_ExpectAnyToken(script_t *script, token_t *token);
|
||||
//returns true when the token is available
|
||||
int PS_CheckTokenString(script_t *script, char *string);
|
||||
//returns true an reads the token when a token with the given type is available
|
||||
int PS_CheckTokenType(script_t *script, int type, int subtype, token_t *token);
|
||||
//skip tokens until the given token string is read
|
||||
int PS_SkipUntilString(script_t *script, char *string);
|
||||
//unread the last token read from the script
|
||||
void PS_UnreadLastToken(script_t *script);
|
||||
//unread the given token
|
||||
void PS_UnreadToken(script_t *script, token_t *token);
|
||||
//returns the next character of the read white space, returns NULL if none
|
||||
char PS_NextWhiteSpaceChar(script_t *script);
|
||||
//remove any leading and trailing double quotes from the token
|
||||
void StripDoubleQuotes(char *string);
|
||||
//remove any leading and trailing single quotes from the token
|
||||
void StripSingleQuotes(char *string);
|
||||
//read a possible signed integer
|
||||
signed long int ReadSignedInt(script_t *script);
|
||||
//read a possible signed floating point number
|
||||
float ReadSignedFloat(script_t *script);
|
||||
//set an array with punctuations, NULL restores default C/C++ set
|
||||
void SetScriptPunctuations(script_t *script, punctuation_t *p);
|
||||
//set script flags
|
||||
void SetScriptFlags(script_t *script, int flags);
|
||||
//get script flags
|
||||
int GetScriptFlags(script_t *script);
|
||||
//reset a script
|
||||
void ResetScript(script_t *script);
|
||||
//returns true if at the end of the script
|
||||
int EndOfScript(script_t *script);
|
||||
//returns a pointer to the punctuation with the given number
|
||||
char *PunctuationFromNum(script_t *script, int num);
|
||||
//load a script from the given file at the given offset with the given length
|
||||
script_t *LoadScriptFile(const char *filename);
|
||||
//load a script from the given memory with the given length
|
||||
script_t *LoadScriptMemory(char *ptr, int length, char *name);
|
||||
//free a script
|
||||
void FreeScript(script_t *script);
|
||||
//set the base folder to load files from
|
||||
void PS_SetBaseFolder(char *path);
|
||||
//print a script error with filename and line number
|
||||
void QDECL ScriptError(script_t *script, char *str, ...);
|
||||
//print a script warning with filename and line number
|
||||
void QDECL ScriptWarning(script_t *script, char *str, ...);
|
||||
|
||||
|
75
code/botlib/l_struct.h
Normal file
75
code/botlib/l_struct.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_struct.h
|
||||
*
|
||||
* desc: structure reading/writing
|
||||
*
|
||||
* $Archive: /source/code/botlib/l_struct.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#define MAX_STRINGFIELD 80
|
||||
//field types
|
||||
#define FT_CHAR 1 // char
|
||||
#define FT_INT 2 // int
|
||||
#define FT_FLOAT 3 // float
|
||||
#define FT_STRING 4 // char [MAX_STRINGFIELD]
|
||||
#define FT_STRUCT 6 // struct (sub structure)
|
||||
//type only mask
|
||||
#define FT_TYPE 0x00FF // only type, clear subtype
|
||||
//sub types
|
||||
#define FT_ARRAY 0x0100 // array of type
|
||||
#define FT_BOUNDED 0x0200 // bounded value
|
||||
#define FT_UNSIGNED 0x0400
|
||||
|
||||
//structure field definition
|
||||
typedef struct fielddef_s
|
||||
{
|
||||
char *name; //name of the field
|
||||
int offset; //offset in the structure
|
||||
int type; //type of the field
|
||||
//type specific fields
|
||||
int maxarray; //maximum array size
|
||||
float floatmin, floatmax; //float min and max
|
||||
struct structdef_s *substruct; //sub structure
|
||||
} fielddef_t;
|
||||
|
||||
//structure definition
|
||||
typedef struct structdef_s
|
||||
{
|
||||
int size;
|
||||
fielddef_t *fields;
|
||||
} structdef_t;
|
||||
|
||||
//read a structure from a script
|
||||
int ReadStructure(source_t *source, structdef_t *def, char *structure);
|
||||
//write a structure to a file
|
||||
int WriteStructure(FILE *fp, structdef_t *def, char *structure);
|
||||
//writes indents
|
||||
int WriteIndent(FILE *fp, int indent);
|
||||
//writes a float without traling zeros
|
||||
int WriteFloat(FILE *fp, float value);
|
||||
|
||||
|
37
code/botlib/l_utils.h
Normal file
37
code/botlib/l_utils.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
===========================================================================
|
||||
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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* name: l_util.h
|
||||
*
|
||||
* desc: utils
|
||||
*
|
||||
* $Archive: /source/code/botlib/l_util.h $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define Vector2Angles(v,a) vectoangles(v,a)
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH MAX_QPATH
|
||||
#endif
|
||||
#define Maximum(x,y) (x > y ? x : y)
|
||||
#define Minimum(x,y) (x < y ? x : y)
|
55
code/botlib/lcc.mak
Normal file
55
code/botlib/lcc.mak
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# Makefile for Gladiator Bot library: gladiator.dll
|
||||
# Intended for LCC-Win32
|
||||
#
|
||||
|
||||
CC=lcc
|
||||
CFLAGS=-DC_ONLY -o
|
||||
OBJS= be_aas_bspq2.obj \
|
||||
be_aas_bsphl.obj \
|
||||
be_aas_cluster.obj \
|
||||
be_aas_debug.obj \
|
||||
be_aas_entity.obj \
|
||||
be_aas_file.obj \
|
||||
be_aas_light.obj \
|
||||
be_aas_main.obj \
|
||||
be_aas_move.obj \
|
||||
be_aas_optimize.obj \
|
||||
be_aas_reach.obj \
|
||||
be_aas_route.obj \
|
||||
be_aas_routealt.obj \
|
||||
be_aas_sample.obj \
|
||||
be_aas_sound.obj \
|
||||
be_ai2_dm.obj \
|
||||
be_ai2_dmnet.obj \
|
||||
be_ai2_main.obj \
|
||||
be_ai_char.obj \
|
||||
be_ai_chat.obj \
|
||||
be_ai_goal.obj \
|
||||
be_ai_load.obj \
|
||||
be_ai_move.obj \
|
||||
be_ai_weap.obj \
|
||||
be_ai_weight.obj \
|
||||
be_ea.obj \
|
||||
be_interface.obj \
|
||||
l_crc.obj \
|
||||
l_libvar.obj \
|
||||
l_log.obj \
|
||||
l_memory.obj \
|
||||
l_precomp.obj \
|
||||
l_script.obj \
|
||||
l_struct.obj \
|
||||
l_utils.obj \
|
||||
q_shared.obj
|
||||
|
||||
all: gladiator.dll
|
||||
|
||||
gladiator.dll: $(OBJS)
|
||||
lcclnk -dll -entry GetBotAPI *.obj botlib.def -o gladiator.dll
|
||||
|
||||
clean:
|
||||
del *.obj gladiator.dll
|
||||
|
||||
%.obj: %.c
|
||||
$(CC) $(CFLAGS) $<
|
||||
|
92
code/botlib/linux-i386.mak
Normal file
92
code/botlib/linux-i386.mak
Normal file
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# Makefile for Gladiator Bot library: gladiator.so
|
||||
# Intended for gcc/Linux
|
||||
#
|
||||
|
||||
ARCH=i386
|
||||
CC=gcc
|
||||
BASE_CFLAGS=-Dstricmp=strcasecmp
|
||||
|
||||
#use these cflags to optimize it
|
||||
CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \
|
||||
-fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
|
||||
-malign-jumps=2 -malign-functions=2
|
||||
#use these when debugging
|
||||
#CFLAGS=$(BASE_CFLAGS) -g
|
||||
|
||||
LDFLAGS=-ldl -lm
|
||||
SHLIBEXT=so
|
||||
SHLIBCFLAGS=-fPIC
|
||||
SHLIBLDFLAGS=-shared
|
||||
|
||||
DO_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||
|
||||
#############################################################################
|
||||
# SETUP AND BUILD
|
||||
# GLADIATOR BOT
|
||||
#############################################################################
|
||||
|
||||
.c.o:
|
||||
$(DO_CC)
|
||||
|
||||
GAME_OBJS = \
|
||||
be_aas_bsphl.o\
|
||||
be_aas_bspq2.o\
|
||||
be_aas_cluster.o\
|
||||
be_aas_debug.o\
|
||||
be_aas_entity.o\
|
||||
be_aas_file.o\
|
||||
be_aas_light.o\
|
||||
be_aas_main.o\
|
||||
be_aas_move.o\
|
||||
be_aas_optimize.o\
|
||||
be_aas_reach.o\
|
||||
be_aas_route.o\
|
||||
be_aas_routealt.o\
|
||||
be_aas_sample.o\
|
||||
be_aas_sound.o\
|
||||
be_ai2_dmq2.o\
|
||||
be_ai2_dmhl.o\
|
||||
be_ai2_dmnet.o\
|
||||
be_ai2_main.o\
|
||||
be_ai_char.o\
|
||||
be_ai_chat.o\
|
||||
be_ai_goal.o\
|
||||
be_ai_load.o\
|
||||
be_ai_move.o\
|
||||
be_ai_weap.o\
|
||||
be_ai_weight.o\
|
||||
be_ea.o\
|
||||
be_interface.o\
|
||||
l_crc.o\
|
||||
l_libvar.o\
|
||||
l_log.o\
|
||||
l_memory.o\
|
||||
l_precomp.o\
|
||||
l_script.o\
|
||||
l_struct.o\
|
||||
l_utils.o\
|
||||
q_shared.o
|
||||
|
||||
glad$(ARCH).$(SHLIBEXT) : $(GAME_OBJS)
|
||||
$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(GAME_OBJS)
|
||||
|
||||
|
||||
#############################################################################
|
||||
# MISC
|
||||
#############################################################################
|
||||
|
||||
clean:
|
||||
-rm -f $(GAME_OBJS)
|
||||
|
||||
depend:
|
||||
gcc -MM $(GAME_OBJS:.o=.c)
|
||||
|
||||
|
||||
install:
|
||||
cp gladiator.so ..
|
||||
|
||||
#
|
||||
# From "make depend"
|
||||
#
|
||||
|
Reference in New Issue
Block a user