aboutsummaryrefslogtreecommitdiffstats
path: root/code/botlib
diff options
context:
space:
mode:
Diffstat (limited to 'code/botlib')
-rw-r--r--code/botlib/be_ai_move.c104
1 files changed, 33 insertions, 71 deletions
diff --git a/code/botlib/be_ai_move.c b/code/botlib/be_ai_move.c
index 1f3b8ee..30eefc7 100644
--- a/code/botlib/be_ai_move.c
+++ b/code/botlib/be_ai_move.c
@@ -1327,28 +1327,12 @@ void BotCheckBlocked(bot_movestate_t *ms, vec3_t dir, int checkbottom, bot_mover
// Returns: -
// Changes Globals: -
//===========================================================================
-void BotClearMoveResult(bot_moveresult_t *moveresult)
-{
- moveresult->failure = qfalse;
- moveresult->type = 0;
- moveresult->blocked = qfalse;
- moveresult->blockentity = 0;
- moveresult->traveltype = 0;
- moveresult->flags = 0;
-} //end of the function BotClearMoveResult
-//===========================================================================
-//
-// Parameter: -
-// Returns: -
-// Changes Globals: -
-//===========================================================================
bot_moveresult_t BotTravel_Walk(bot_movestate_t *ms, aas_reachability_t *reach)
{
float dist, speed;
vec3_t hordir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//first walk straight to the reachability start
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
@@ -1401,9 +1385,7 @@ bot_moveresult_t BotFinishTravel_Walk(bot_movestate_t *ms, aas_reachability_t *r
{
vec3_t hordir;
float dist, speed;
- bot_moveresult_t result;
-
- BotClearMoveResult(&result);
+ bot_moveresult_t_cleared( result );
//if not on the ground and changed areas... don't walk back!!
//(doesn't seem to help)
/*
@@ -1439,9 +1421,8 @@ bot_moveresult_t BotTravel_Crouch(bot_movestate_t *ms, aas_reachability_t *reach
{
float speed;
vec3_t hordir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//
speed = 400;
//walk straight to reachability end
@@ -1469,9 +1450,8 @@ bot_moveresult_t BotTravel_BarrierJump(bot_movestate_t *ms, aas_reachability_t *
{
float dist, speed;
vec3_t hordir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//walk straight to reachability start
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
@@ -1504,9 +1484,8 @@ bot_moveresult_t BotFinishTravel_BarrierJump(bot_movestate_t *ms, aas_reachabili
{
float dist;
vec3_t hordir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//if near the top or going down
if (ms->velocity[2] < 250)
{
@@ -1532,9 +1511,8 @@ bot_moveresult_t BotFinishTravel_BarrierJump(bot_movestate_t *ms, aas_reachabili
bot_moveresult_t BotTravel_Swim(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t dir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//swim straight to reachability end
VectorSubtract(reach->start, ms->origin, dir);
VectorNormalize(dir);
@@ -1559,9 +1537,8 @@ bot_moveresult_t BotTravel_WaterJump(bot_movestate_t *ms, aas_reachability_t *re
{
vec3_t dir, hordir;
float dist;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//swim straight to reachability end
VectorSubtract(reach->end, ms->origin, dir);
VectorCopy(dir, hordir);
@@ -1593,10 +1570,9 @@ bot_moveresult_t BotFinishTravel_WaterJump(bot_movestate_t *ms, aas_reachability
{
vec3_t dir, pnt;
float dist;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
//botimport.Print(PRT_MESSAGE, "BotFinishTravel_WaterJump\n");
- BotClearMoveResult(&result);
//if waterjumping there's nothing to do
if (ms->moveflags & MFL_WATERJUMP) return result;
//if not touching any water anymore don't do anything
@@ -1630,9 +1606,8 @@ bot_moveresult_t BotTravel_WalkOffLedge(bot_movestate_t *ms, aas_reachability_t
{
vec3_t hordir, dir;
float dist, speed, reachhordist;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//check if the bot is blocked by anything
VectorSubtract(reach->start, ms->origin, dir);
VectorNormalize(dir);
@@ -1730,9 +1705,8 @@ bot_moveresult_t BotFinishTravel_WalkOffLedge(bot_movestate_t *ms, aas_reachabil
{
vec3_t dir, hordir, end, v;
float dist, speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//
VectorSubtract(reach->end, ms->origin, dir);
BotCheckBlocked(ms, dir, qtrue, &result);
@@ -1769,9 +1743,8 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t hordir;
float dist, gapdist, speed, horspeed, sv_jumpvel;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//
sv_jumpvel = botlibglobals.sv_jumpvel->value;
//walk straight to the reachability start
@@ -1818,10 +1791,9 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t hordir, dir1, dir2, mins, maxs, start, end;
float dist1, dist2, speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
bsp_trace_t trace;
- BotClearMoveResult(&result);
//
hordir[0] = reach->start[0] - reach->end[0];
hordir[1] = reach->start[1] - reach->end[1];
@@ -1891,9 +1863,8 @@ bot_moveresult_t BotTravel_Jump(bot_movestate_t *ms, aas_reachability_t *reach)
vec3_t hordir, dir1, dir2, start, end, runstart;
// vec3_t runstart, dir1, dir2, hordir;
float dist1, dist2, speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//
AAS_JumpReachRunStart(reach, runstart);
//*
@@ -1961,9 +1932,8 @@ bot_moveresult_t BotFinishTravel_Jump(bot_movestate_t *ms, aas_reachability_t *r
{
vec3_t hordir, hordir2;
float speed, dist;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//if not jumped yet
if (!ms->jumpreach) return result;
//go straight to the reachability end
@@ -1998,9 +1968,8 @@ bot_moveresult_t BotTravel_Ladder(bot_movestate_t *ms, aas_reachability_t *reach
vec3_t dir, viewdir;//, hordir;
vec3_t origin = {0, 0, 0};
// vec3_t up = {0, 0, 1};
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//
// if ((ms->moveflags & MFL_AGAINSTLADDER))
//NOTE: not a good idea for ladders starting in water
@@ -2052,9 +2021,8 @@ bot_moveresult_t BotTravel_Teleport(bot_movestate_t *ms, aas_reachability_t *rea
{
vec3_t hordir;
float dist;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//if the bot is being teleported
if (ms->moveflags & MFL_TELEPORTED) return result;
@@ -2083,9 +2051,8 @@ bot_moveresult_t BotTravel_Elevator(bot_movestate_t *ms, aas_reachability_t *rea
{
vec3_t dir, dir1, dir2, hordir, bottomcenter;
float dist, dist1, dist2, speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//if standing on the plat
if (BotOnMover(ms->origin, ms->entitynum, reach))
{
@@ -2233,9 +2200,8 @@ bot_moveresult_t BotTravel_Elevator(bot_movestate_t *ms, aas_reachability_t *rea
bot_moveresult_t BotFinishTravel_Elevator(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t bottomcenter, bottomdir, topdir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//
MoverBottomCenter(reach, bottomcenter);
VectorSubtract(bottomcenter, ms->origin, bottomdir);
@@ -2322,9 +2288,8 @@ bot_moveresult_t BotTravel_FuncBobbing(bot_movestate_t *ms, aas_reachability_t *
{
vec3_t dir, dir1, dir2, hordir, bottomcenter, bob_start, bob_end, bob_origin;
float dist, dist1, dist2, speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//
BotFuncBobStartEnd(reach, bob_start, bob_end, bob_origin);
//if standing ontop of the func_bobbing
@@ -2479,10 +2444,9 @@ bot_moveresult_t BotTravel_FuncBobbing(bot_movestate_t *ms, aas_reachability_t *
bot_moveresult_t BotFinishTravel_FuncBobbing(bot_movestate_t *ms, aas_reachability_t *reach)
{
vec3_t bob_origin, bob_start, bob_end, dir, hordir, bottomcenter;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
float dist, speed;
- BotClearMoveResult(&result);
//
BotFuncBobStartEnd(reach, bob_start, bob_end, bob_origin);
//
@@ -2589,7 +2553,7 @@ void BotResetGrapple(bot_movestate_t *ms)
//===========================================================================
bot_moveresult_t BotTravel_Grapple(bot_movestate_t *ms, aas_reachability_t *reach)
{
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
float dist, speed;
vec3_t dir, viewdir, org;
int state, areanum;
@@ -2601,7 +2565,6 @@ bot_moveresult_t BotTravel_Grapple(bot_movestate_t *ms, aas_reachability_t *reac
botimport.DebugLineShow(debugline, reach->start, reach->end, LINECOLOR_BLUE);
#endif //DEBUG_GRAPPLE
- BotClearMoveResult(&result);
//
if (ms->moveflags & MFL_GRAPPLERESET)
{
@@ -2745,10 +2708,9 @@ bot_moveresult_t BotTravel_RocketJump(bot_movestate_t *ms, aas_reachability_t *r
{
vec3_t hordir;
float dist, speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
//botimport.Print(PRT_MESSAGE, "BotTravel_RocketJump: bah\n");
- BotClearMoveResult(&result);
//
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
@@ -2810,10 +2772,9 @@ bot_moveresult_t BotTravel_BFGJump(bot_movestate_t *ms, aas_reachability_t *reac
{
vec3_t hordir;
float dist, speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
//botimport.Print(PRT_MESSAGE, "BotTravel_BFGJump: bah\n");
- BotClearMoveResult(&result);
//
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
@@ -2871,9 +2832,8 @@ bot_moveresult_t BotFinishTravel_WeaponJump(bot_movestate_t *ms, aas_reachabilit
{
vec3_t hordir;
float speed;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//if not jumped yet
if (!ms->jumpreach) return result;
/*
@@ -2911,9 +2871,8 @@ bot_moveresult_t BotTravel_JumpPad(bot_movestate_t *ms, aas_reachability_t *reac
{
float dist, speed;
vec3_t hordir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
//first walk straight to the reachability start
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
@@ -2938,9 +2897,8 @@ bot_moveresult_t BotFinishTravel_JumpPad(bot_movestate_t *ms, aas_reachability_t
{
float speed;
vec3_t hordir;
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
- BotClearMoveResult(&result);
if (!BotAirControl(ms->origin, ms->velocity, reach->end, hordir, &speed))
{
hordir[0] = reach->end[0] - ms->origin[0];
@@ -2997,7 +2955,7 @@ int BotReachabilityTime(aas_reachability_t *reach)
//===========================================================================
bot_moveresult_t BotMoveInGoalArea(bot_movestate_t *ms, bot_goal_t *goal)
{
- bot_moveresult_t result;
+ bot_moveresult_t_cleared( result );
vec3_t dir;
float dist, speed;
@@ -3006,7 +2964,6 @@ bot_moveresult_t BotMoveInGoalArea(bot_movestate_t *ms, bot_goal_t *goal)
//AAS_ClearShownDebugLines();
//AAS_DebugLine(ms->origin, goal->origin, LINECOLOR_RED);
#endif //DEBUG
- BotClearMoveResult(&result);
//walk straight to the goal origin
dir[0] = goal->origin[0] - ms->origin[0];
dir[1] = goal->origin[1] - ms->origin[1];
@@ -3061,8 +3018,13 @@ void BotMoveToGoal(bot_moveresult_t *result, int movestate, bot_goal_t *goal, in
//bsp_trace_t trace;
//static int debugline;
+ result->failure = qfalse;
+ result->type = 0;
+ result->blocked = qfalse;
+ result->blockentity = 0;
+ result->traveltype = 0;
+ result->flags = 0;
- BotClearMoveResult(result);
//
ms = BotMoveStateFromHandle(movestate);
if (!ms) return;