aboutsummaryrefslogtreecommitdiffstats
path: root/code/botlib
diff options
context:
space:
mode:
authorzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-09-02 20:13:47 +0000
committerzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-09-02 20:13:47 +0000
commit122fe646235067bae2a620f877a6d76af067d7f3 (patch)
tree136082c7dd759e9bb4cfab0a1668d3b43af984c1 /code/botlib
parentf5de4773415589c3e6ed64f9f67479b4f8bb9668 (diff)
downloadioquake3-aero-122fe646235067bae2a620f877a6d76af067d7f3.tar.gz
ioquake3-aero-122fe646235067bae2a620f877a6d76af067d7f3.zip
Cleanups from pomac!
git-svn-id: svn://svn.icculus.org/quake3/trunk@67 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/botlib')
-rw-r--r--code/botlib/be_aas_reach.c25
-rw-r--r--code/botlib/be_ai_move.c104
2 files changed, 41 insertions, 88 deletions
diff --git a/code/botlib/be_aas_reach.c b/code/botlib/be_aas_reach.c
index 4b69d28..f26523a 100644
--- a/code/botlib/be_aas_reach.c
+++ b/code/botlib/be_aas_reach.c
@@ -1067,8 +1067,8 @@ int AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(int area1num, int area2
float length, ground_bestlength, water_bestlength, ground_bestdist, water_bestdist;
vec3_t v1, v2, v3, v4, tmpv, p1area1, p1area2, p2area1, p2area2;
vec3_t normal, ort, edgevec, start, end, dir;
- vec3_t ground_beststart, ground_bestend, ground_bestnormal;
- vec3_t water_beststart, water_bestend, water_bestnormal;
+ vec3_t ground_beststart = {0, 0, 0}, ground_bestend = {0, 0, 0}, ground_bestnormal = {0, 0, 0};
+ vec3_t water_beststart = {0, 0, 0}, water_bestend = {0, 0, 0}, water_bestnormal = {0, 0, 0};
vec3_t invgravity = {0, 0, 1};
vec3_t testpoint;
aas_plane_t *plane;
@@ -2379,15 +2379,15 @@ int AAS_Reachability_Jump(int area1num, int area2num)
//===========================================================================
int AAS_Reachability_Ladder(int area1num, int area2num)
{
- int i, j, k, l, edge1num, edge2num, sharededgenum, lowestedgenum;
- int face1num, face2num, ladderface1num, ladderface2num;
+ int i, j, k, l, edge1num, edge2num, sharededgenum = 0, lowestedgenum = 0;
+ int face1num, face2num, ladderface1num = 0, ladderface2num = 0;
int ladderface1vertical, ladderface2vertical, firstv;
- float face1area, face2area, bestface1area, bestface2area;
+ float face1area, face2area, bestface1area = -9999, bestface2area = -9999;
float phys_jumpvel, maxjumpheight;
vec3_t area1point, area2point, v1, v2, up = {0, 0, 1};
- vec3_t mid, lowestpoint, start, end, sharededgevec, dir;
+ vec3_t mid, lowestpoint = {0, 0}, start, end, sharededgevec, dir;
aas_area_t *area1, *area2;
- aas_face_t *face1, *face2, *ladderface1, *ladderface2;
+ aas_face_t *face1, *face2, *ladderface1 = NULL, *ladderface2 = NULL;
aas_plane_t *plane1, *plane2;
aas_edge_t *sharededge, *edge1;
aas_lreachability_t *lreach;
@@ -2401,16 +2401,7 @@ int AAS_Reachability_Ladder(int area1num, int area2num)
area1 = &aasworld.areas[area1num];
area2 = &aasworld.areas[area2num];
- //
- ladderface1 = NULL;
- ladderface2 = NULL;
- ladderface1num = 0; //make compiler happy
- ladderface2num = 0; //make compiler happy
- bestface1area = -9999;
- bestface2area = -9999;
- sharededgenum = 0; //make compiler happy
- lowestedgenum = 0; //make compiler happy
- //
+
for (i = 0; i < area1->numfaces; i++)
{
face1num = aasworld.faceindex[area1->firstface + i];
diff --git a/code/botlib/be_ai_move.c b/code/botlib/be_ai_move.c
index 1f3b8ee..7ff6a21 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( 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;