home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 March / maximum-cd-2000-03.iso / Quake3 Game Source / Q3AGameSource.exe / Main / be_ai_move.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-18  |  4.4 KB  |  109 lines

  1. // Copyright (C) 1999-2000 Id Software, Inc.
  2. //
  3.  
  4. /*****************************************************************************
  5.  * name:        be_ai_move.h
  6.  *
  7.  * desc:        movement AI
  8.  *
  9.  * $Archive: /source/code/botlib/be_ai_move.h $
  10.  * $Author: Mrelusive $ 
  11.  * $Revision: 2 $
  12.  * $Modtime: 10/05/99 3:32p $
  13.  * $Date: 10/05/99 3:42p $
  14.  *
  15.  *****************************************************************************/
  16.  
  17. //movement types
  18. #define MOVE_WALK                        1
  19. #define MOVE_CROUCH                        2
  20. #define MOVE_JUMP                        4
  21. #define MOVE_GRAPPLE                    8
  22. #define MOVE_ROCKETJUMP                    16
  23. #define MOVE_BFGJUMP                    32
  24. //move flags
  25. #define MFL_BARRIERJUMP                    1        //bot is performing a barrier jump
  26. #define MFL_ONGROUND                    2        //bot is in the ground
  27. #define MFL_SWIMMING                    4        //bot is swimming
  28. #define MFL_AGAINSTLADDER                8        //bot is against a ladder
  29. #define MFL_WATERJUMP                    16        //bot is waterjumping
  30. #define MFL_TELEPORTED                    32        //bot is being teleported
  31. #define MFL_GRAPPLEPULL                    64        //bot is being pulled by the grapple
  32. #define MFL_ACTIVEGRAPPLE                128        //bot is using the grapple hook
  33. #define MFL_GRAPPLERESET                256        //bot has reset the grapple
  34. #define MFL_WALK                        512        //bot should walk slowly
  35. //move result flags
  36. #define MOVERESULT_MOVEMENTVIEW            1        //bot uses view for movement
  37. #define MOVERESULT_SWIMVIEW                2        //bot uses view for swimming
  38. #define MOVERESULT_WAITING                4        //bot is waiting for something
  39. #define MOVERESULT_MOVEMENTVIEWSET        8        //bot has set the view in movement code
  40. #define MOVERESULT_MOVEMENTWEAPON        16        //bot uses weapon for movement
  41. #define MOVERESULT_ONTOPOFOBSTACLE        32        //bot is ontop of obstacle
  42. #define MOVERESULT_ONTOPOF_FUNCBOB        64        //bot is ontop of a func_bobbing
  43. #define MOVERESULT_ONTOPOF_ELEVATOR        128        //bot is ontop of an elevator (func_plat)
  44. //
  45. #define MAX_AVOIDREACH                    1
  46. //
  47. #define RESULTTYPE_ELEVATORUP            1        //elevator is up
  48. #define RESULTTYPE_WAITFORFUNCBOBBING    2        //waiting for func bobbing to arrive
  49. #define RESULTTYPE_BADGRAPPLEPATH        4        //grapple path is obstructured
  50.  
  51. //structure used to initialize the movement state
  52. //the or_moveflags MFL_ONGROUND, MFL_TELEPORTED and MFL_WATERJUMP come from the playerstate
  53. typedef struct bot_initmove_s
  54. {
  55.     vec3_t origin;                //origin of the bot
  56.     vec3_t velocity;            //velocity of the bot
  57.     vec3_t viewoffset;            //view offset
  58.     int entitynum;                //entity number of the bot
  59.     int client;                    //client number of the bot
  60.     float thinktime;            //time the bot thinks
  61.     int presencetype;            //presencetype of the bot
  62.     vec3_t viewangles;            //view angles of the bot
  63.     int or_moveflags;            //values ored to the movement flags
  64. } bot_initmove_t;
  65.  
  66. //NOTE: the ideal_viewangles are only valid if MFL_MOVEMENTVIEW is set
  67. typedef struct bot_moveresult_s
  68. {
  69.     int failure;                //true if movement failed all together
  70.     int type;                    //failure or blocked type
  71.     int blocked;                //true if blocked by an entity
  72.     int blockentity;            //entity blocking the bot
  73.     int traveltype;                //last executed travel type
  74.     int flags;                    //result flags
  75.     int weapon;                    //weapon used for movement
  76.     vec3_t movedir;                //movement direction
  77.     vec3_t ideal_viewangles;    //ideal viewangles for the movement
  78. } bot_moveresult_t;
  79.  
  80. //resets the whole movestate
  81. void BotResetMoveState(int movestate);
  82. //moves the bot to the given goal
  83. void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, int travelflags);
  84. //moves the bot in the specified direction
  85. int BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
  86. //reset avoid reachability
  87. void BotResetAvoidReach(int movestate);
  88. //resets the last avoid reachability
  89. void BotResetLastAvoidReach(int movestate);
  90. //returns a reachability area if the origin is in one
  91. int BotReachabilityArea(vec3_t origin, int client);
  92. //view target based on movement
  93. int BotMovementViewTarget(int movestate, bot_goal_t *goal, int travelflags, float lookahead, vec3_t target);
  94. //predict the position of a player
  95. int BotPredictVisiblePosition(vec3_t origin, int areanum, bot_goal_t *goal, int travelflags, vec3_t target);
  96. //returns the handle of a newly allocated movestate
  97. int BotAllocMoveState(void);
  98. //frees the movestate with the given handle
  99. void BotFreeMoveState(int handle);
  100. //initialize movement state
  101. void BotInitMoveState(int handle, bot_initmove_t *initmove);
  102. //must be called every map change
  103. void BotSetBrushModelTypes(void);
  104. //setup movement AI
  105. int BotSetupMoveAI(void);
  106. //shutdown movement AI
  107. void BotShutdownMoveAI(void);
  108.  
  109.