Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

be_ai_move.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 //
00023 
00024 /*****************************************************************************
00025  * name:        be_ai_move.h
00026  *
00027  * desc:        movement AI
00028  *
00029  * $Archive: /source/code/botlib/be_ai_move.h $
00030  *
00031  *****************************************************************************/
00032 
00033 //movement types
00034 #define MOVE_WALK                       1
00035 #define MOVE_CROUCH                     2
00036 #define MOVE_JUMP                       4
00037 #define MOVE_GRAPPLE                    8
00038 #define MOVE_ROCKETJUMP                 16
00039 #define MOVE_BFGJUMP                    32
00040 //move flags
00041 #define MFL_BARRIERJUMP                 1       //bot is performing a barrier jump
00042 #define MFL_ONGROUND                    2       //bot is in the ground
00043 #define MFL_SWIMMING                    4       //bot is swimming
00044 #define MFL_AGAINSTLADDER               8       //bot is against a ladder
00045 #define MFL_WATERJUMP                   16      //bot is waterjumping
00046 #define MFL_TELEPORTED                  32      //bot is being teleported
00047 #define MFL_GRAPPLEPULL                 64      //bot is being pulled by the grapple
00048 #define MFL_ACTIVEGRAPPLE               128     //bot is using the grapple hook
00049 #define MFL_GRAPPLERESET                256     //bot has reset the grapple
00050 #define MFL_WALK                        512     //bot should walk slowly
00051 // move result flags
00052 #define MOVERESULT_MOVEMENTVIEW         1       //bot uses view for movement
00053 #define MOVERESULT_SWIMVIEW             2       //bot uses view for swimming
00054 #define MOVERESULT_WAITING              4       //bot is waiting for something
00055 #define MOVERESULT_MOVEMENTVIEWSET      8       //bot has set the view in movement code
00056 #define MOVERESULT_MOVEMENTWEAPON       16      //bot uses weapon for movement
00057 #define MOVERESULT_ONTOPOFOBSTACLE      32      //bot is ontop of obstacle
00058 #define MOVERESULT_ONTOPOF_FUNCBOB      64      //bot is ontop of a func_bobbing
00059 #define MOVERESULT_ONTOPOF_ELEVATOR     128     //bot is ontop of an elevator (func_plat)
00060 #define MOVERESULT_BLOCKEDBYAVOIDSPOT   256     //bot is blocked by an avoid spot
00061 //
00062 #define MAX_AVOIDREACH                  1
00063 #define MAX_AVOIDSPOTS                  32
00064 // avoid spot types
00065 #define AVOID_CLEAR                     0       //clear all avoid spots
00066 #define AVOID_ALWAYS                    1       //avoid always
00067 #define AVOID_DONTBLOCK                 2       //never totally block
00068 // restult types
00069 #define RESULTTYPE_ELEVATORUP           1       //elevator is up
00070 #define RESULTTYPE_WAITFORFUNCBOBBING   2       //waiting for func bobbing to arrive
00071 #define RESULTTYPE_BADGRAPPLEPATH       4       //grapple path is obstructed
00072 #define RESULTTYPE_INSOLIDAREA          8       //stuck in solid area, this is bad
00073 
00074 //structure used to initialize the movement state
00075 //the or_moveflags MFL_ONGROUND, MFL_TELEPORTED and MFL_WATERJUMP come from the playerstate
00076 typedef struct bot_initmove_s
00077 {
00078     vec3_t origin;              //origin of the bot
00079     vec3_t velocity;            //velocity of the bot
00080     vec3_t viewoffset;          //view offset
00081     int entitynum;              //entity number of the bot
00082     int client;                 //client number of the bot
00083     float thinktime;            //time the bot thinks
00084     int presencetype;           //presencetype of the bot
00085     vec3_t viewangles;          //view angles of the bot
00086     int or_moveflags;           //values ored to the movement flags
00087 } bot_initmove_t;
00088 
00089 //NOTE: the ideal_viewangles are only valid if MFL_MOVEMENTVIEW is set
00090 typedef struct bot_moveresult_s
00091 {
00092     int failure;                //true if movement failed all together
00093     int type;                   //failure or blocked type
00094     int blocked;                //true if blocked by an entity
00095     int blockentity;            //entity blocking the bot
00096     int traveltype;             //last executed travel type
00097     int flags;                  //result flags
00098     int weapon;                 //weapon used for movement
00099     vec3_t movedir;             //movement direction
00100     vec3_t ideal_viewangles;    //ideal viewangles for the movement
00101 } bot_moveresult_t;
00102 
00103 // bk001204: from code/botlib/be_ai_move.c
00104 // TTimo 04/12/2001 was moved here to avoid dup defines
00105 typedef struct bot_avoidspot_s
00106 {
00107     vec3_t origin;
00108     float radius;
00109     int type;
00110 } bot_avoidspot_t;
00111 
00112 //resets the whole move state
00113 void BotResetMoveState(int movestate);
00114 //moves the bot to the given goal
00115 void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, int travelflags);
00116 //moves the bot in the specified direction using the specified type of movement
00117 int BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
00118 //reset avoid reachability
00119 void BotResetAvoidReach(int movestate);
00120 //resets the last avoid reachability
00121 void BotResetLastAvoidReach(int movestate);
00122 //returns a reachability area if the origin is in one
00123 int BotReachabilityArea(vec3_t origin, int client);
00124 //view target based on movement
00125 int BotMovementViewTarget(int movestate, bot_goal_t *goal, int travelflags, float lookahead, vec3_t target);
00126 //predict the position of a player based on movement towards a goal
00127 int BotPredictVisiblePosition(vec3_t origin, int areanum, bot_goal_t *goal, int travelflags, vec3_t target);
00128 //returns the handle of a newly allocated movestate
00129 int BotAllocMoveState(void);
00130 //frees the movestate with the given handle
00131 void BotFreeMoveState(int handle);
00132 //initialize movement state before performing any movement
00133 void BotInitMoveState(int handle, bot_initmove_t *initmove);
00134 //add a spot to avoid (if type == AVOID_CLEAR all spots are removed)
00135 void BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
00136 //must be called every map change
00137 void BotSetBrushModelTypes(void);
00138 //setup movement AI
00139 int BotSetupMoveAI(void);
00140 //shutdown movement AI
00141 void BotShutdownMoveAI(void);
00142 

Generated on Thu Aug 25 12:37:30 2005 for Quake III Arena by  doxygen 1.3.9.1