Reverting pomac's change here, hopefully that fixes this.

This commit is contained in:
Zachary Slater 2005-09-02 21:52:28 +00:00
parent e09e027914
commit 1697a709a1

View file

@ -1327,12 +1327,28 @@ 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_cleared( result );
bot_moveresult_t 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];
@ -1385,7 +1401,9 @@ bot_moveresult_t BotFinishTravel_Walk(bot_movestate_t *ms, aas_reachability_t *r
{
vec3_t hordir;
float dist, speed;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//if not on the ground and changed areas... don't walk back!!
//(doesn't seem to help)
/*
@ -1421,8 +1439,9 @@ bot_moveresult_t BotTravel_Crouch(bot_movestate_t *ms, aas_reachability_t *reach
{
float speed;
vec3_t hordir;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//
speed = 400;
//walk straight to reachability end
@ -1450,8 +1469,9 @@ bot_moveresult_t BotTravel_BarrierJump(bot_movestate_t *ms, aas_reachability_t *
{
float dist, speed;
vec3_t hordir;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//walk straight to reachability start
hordir[0] = reach->start[0] - ms->origin[0];
hordir[1] = reach->start[1] - ms->origin[1];
@ -1484,8 +1504,9 @@ bot_moveresult_t BotFinishTravel_BarrierJump(bot_movestate_t *ms, aas_reachabili
{
float dist;
vec3_t hordir;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//if near the top or going down
if (ms->velocity[2] < 250)
{
@ -1511,8 +1532,9 @@ 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_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//swim straight to reachability end
VectorSubtract(reach->start, ms->origin, dir);
VectorNormalize(dir);
@ -1537,8 +1559,9 @@ bot_moveresult_t BotTravel_WaterJump(bot_movestate_t *ms, aas_reachability_t *re
{
vec3_t dir, hordir;
float dist;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//swim straight to reachability end
VectorSubtract(reach->end, ms->origin, dir);
VectorCopy(dir, hordir);
@ -1570,9 +1593,10 @@ bot_moveresult_t BotFinishTravel_WaterJump(bot_movestate_t *ms, aas_reachability
{
vec3_t dir, pnt;
float dist;
bot_moveresult_t_cleared( result );
bot_moveresult_t 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
@ -1606,8 +1630,9 @@ bot_moveresult_t BotTravel_WalkOffLedge(bot_movestate_t *ms, aas_reachability_t
{
vec3_t hordir, dir;
float dist, speed, reachhordist;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//check if the bot is blocked by anything
VectorSubtract(reach->start, ms->origin, dir);
VectorNormalize(dir);
@ -1705,8 +1730,9 @@ 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);
@ -1743,8 +1769,9 @@ 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_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//
sv_jumpvel = botlibglobals.sv_jumpvel->value;
//walk straight to the reachability start
@ -1791,9 +1818,10 @@ 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_cleared( result );
bot_moveresult_t result;
bsp_trace_t trace;
BotClearMoveResult(&result);
//
hordir[0] = reach->start[0] - reach->end[0];
hordir[1] = reach->start[1] - reach->end[1];
@ -1863,8 +1891,9 @@ 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_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//
AAS_JumpReachRunStart(reach, runstart);
//*
@ -1932,8 +1961,9 @@ bot_moveresult_t BotFinishTravel_Jump(bot_movestate_t *ms, aas_reachability_t *r
{
vec3_t hordir, hordir2;
float speed, dist;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//if not jumped yet
if (!ms->jumpreach) return result;
//go straight to the reachability end
@ -1968,8 +1998,9 @@ 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_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//
// if ((ms->moveflags & MFL_AGAINSTLADDER))
//NOTE: not a good idea for ladders starting in water
@ -2021,8 +2052,9 @@ bot_moveresult_t BotTravel_Teleport(bot_movestate_t *ms, aas_reachability_t *rea
{
vec3_t hordir;
float dist;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//if the bot is being teleported
if (ms->moveflags & MFL_TELEPORTED) return result;
@ -2051,8 +2083,9 @@ 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_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//if standing on the plat
if (BotOnMover(ms->origin, ms->entitynum, reach))
{
@ -2200,8 +2233,9 @@ 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_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//
MoverBottomCenter(reach, bottomcenter);
VectorSubtract(bottomcenter, ms->origin, bottomdir);
@ -2288,8 +2322,9 @@ 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_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//
BotFuncBobStartEnd(reach, bob_start, bob_end, bob_origin);
//if standing ontop of the func_bobbing
@ -2444,9 +2479,10 @@ 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_cleared( result );
bot_moveresult_t result;
float dist, speed;
BotClearMoveResult(&result);
//
BotFuncBobStartEnd(reach, bob_start, bob_end, bob_origin);
//
@ -2553,7 +2589,7 @@ void BotResetGrapple(bot_movestate_t *ms)
//===========================================================================
bot_moveresult_t BotTravel_Grapple(bot_movestate_t *ms, aas_reachability_t *reach)
{
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
float dist, speed;
vec3_t dir, viewdir, org;
int state, areanum;
@ -2565,6 +2601,7 @@ 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)
{
@ -2708,9 +2745,10 @@ bot_moveresult_t BotTravel_RocketJump(bot_movestate_t *ms, aas_reachability_t *r
{
vec3_t hordir;
float dist, speed;
bot_moveresult_t_cleared( result );
bot_moveresult_t 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];
@ -2772,9 +2810,10 @@ bot_moveresult_t BotTravel_BFGJump(bot_movestate_t *ms, aas_reachability_t *reac
{
vec3_t hordir;
float dist, speed;
bot_moveresult_t_cleared( result );
bot_moveresult_t 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];
@ -2832,8 +2871,9 @@ bot_moveresult_t BotFinishTravel_WeaponJump(bot_movestate_t *ms, aas_reachabilit
{
vec3_t hordir;
float speed;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
//if not jumped yet
if (!ms->jumpreach) return result;
/*
@ -2871,8 +2911,9 @@ bot_moveresult_t BotTravel_JumpPad(bot_movestate_t *ms, aas_reachability_t *reac
{
float dist, speed;
vec3_t hordir;
bot_moveresult_t_cleared( result );
bot_moveresult_t 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];
@ -2897,8 +2938,9 @@ bot_moveresult_t BotFinishTravel_JumpPad(bot_movestate_t *ms, aas_reachability_t
{
float speed;
vec3_t hordir;
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
BotClearMoveResult(&result);
if (!BotAirControl(ms->origin, ms->velocity, reach->end, hordir, &speed))
{
hordir[0] = reach->end[0] - ms->origin[0];
@ -2955,7 +2997,7 @@ int BotReachabilityTime(aas_reachability_t *reach)
//===========================================================================
bot_moveresult_t BotMoveInGoalArea(bot_movestate_t *ms, bot_goal_t *goal)
{
bot_moveresult_t_cleared( result );
bot_moveresult_t result;
vec3_t dir;
float dist, speed;
@ -2964,6 +3006,7 @@ 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];
@ -3018,13 +3061,8 @@ 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;