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

be_aas_move.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int AAS_AgainstLadder (vec3_t origin)
float AAS_BFGJumpZVelocity (vec3_t origin)
int AAS_ClientMovementHitBBox (struct aas_clientmove_s *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, vec3_t mins, vec3_t maxs, int visualize)
int AAS_DropToFloor (vec3_t origin, vec3_t mins, vec3_t maxs)
int AAS_HorizontalVelocityForJump (float zvel, vec3_t start, vec3_t end, float *velocity)
void AAS_InitSettings (void)
void AAS_JumpReachRunStart (struct aas_reachability_s *reach, vec3_t runstart)
int AAS_OnGround (vec3_t origin, int presencetype, int passent)
int AAS_PredictClientMovement (struct aas_clientmove_s *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize)
float AAS_RocketJumpZVelocity (vec3_t origin)
void AAS_SetMovedir (vec3_t angles, vec3_t movedir)
int AAS_Swimming (vec3_t origin)


Function Documentation

int AAS_AgainstLadder vec3_t  origin  ) 
 

Definition at line 123 of file be_aas_move.c.

References aas_area_t, aas_face_t, aas_plane_t, AAS_PointAreaNum(), AAS_PointInsideFace(), aasworld, abs(), aas_areasettings_s::areaflags, aas_s::areas, aas_s::areasettings, aas_plane_s::dist, DotProduct, f, aas_face_s::faceflags, aas_s::faceindex, aas_s::faces, aas_area_s::firstface, i, aas_plane_s::normal, aas_area_s::numfaces, aas_face_s::planenum, aas_s::planes, aas_areasettings_s::presencetype, vec3_t, and VectorCopy.

Referenced by BotMoveToGoal().

00124 {
00125     int areanum, i, facenum, side;
00126     vec3_t org;
00127     aas_plane_t *plane;
00128     aas_face_t *face;
00129     aas_area_t *area;
00130 
00131     VectorCopy(origin, org);
00132     areanum = AAS_PointAreaNum(org);
00133     if (!areanum)
00134     {
00135         org[0] += 1;
00136         areanum = AAS_PointAreaNum(org);
00137         if (!areanum)
00138         {
00139             org[1] += 1;
00140             areanum = AAS_PointAreaNum(org);
00141             if (!areanum)
00142             {
00143                 org[0] -= 2;
00144                 areanum = AAS_PointAreaNum(org);
00145                 if (!areanum)
00146                 {
00147                     org[1] -= 2;
00148                     areanum = AAS_PointAreaNum(org);
00149                 } //end if
00150             } //end if
00151         } //end if
00152     } //end if
00153     //if in solid... wrrr shouldn't happen
00154     if (!areanum) return qfalse;
00155     //if not in a ladder area
00156     if (!(aasworld.areasettings[areanum].areaflags & AREA_LADDER)) return qfalse;
00157     //if a crouch only area
00158     if (!(aasworld.areasettings[areanum].presencetype & PRESENCE_NORMAL)) return qfalse;
00159     //
00160     area = &aasworld.areas[areanum];
00161     for (i = 0; i < area->numfaces; i++)
00162     {
00163         facenum = aasworld.faceindex[area->firstface + i];
00164         side = facenum < 0;
00165         face = &aasworld.faces[abs(facenum)];
00166         //if the face isn't a ladder face
00167         if (!(face->faceflags & FACE_LADDER)) continue;
00168         //get the plane the face is in
00169         plane = &aasworld.planes[face->planenum ^ side];
00170         //if the origin is pretty close to the plane
00171         if (abs(DotProduct(plane->normal, origin) - plane->dist) < 3)
00172         {
00173             if (AAS_PointInsideFace(abs(facenum), origin, 0.1f)) return qtrue;
00174         } //end if
00175     } //end for
00176     return qfalse;
00177 } //end of the function AAS_AgainstLadder

Here is the call graph for this function:

float AAS_BFGJumpZVelocity vec3_t  origin  ) 
 

Definition at line 352 of file be_aas_move.c.

References AAS_WeaponJumpZVelocity().

Referenced by AAS_Reachability_WeaponJump().

00353 {
00354     //bfg radius damage is 1000 (p_weapon.c: weapon_bfg_fire)
00355     return AAS_WeaponJumpZVelocity(origin, 120);
00356 } //end of the function AAS_BFGJumpZVelocity

Here is the call graph for this function:

int AAS_ClientMovementHitBBox struct aas_clientmove_s move,
int  entnum,
vec3_t  origin,
int  presencetype,
int  onground,
vec3_t  velocity,
vec3_t  cmdmove,
int  cmdframes,
int  maxframes,
float  frametime,
vec3_t  mins,
vec3_t  maxs,
int  visualize
 

Definition at line 1014 of file be_aas_move.c.

References AAS_ClientMovementPrediction(), move(), and SE_HITBOUNDINGBOX.

Referenced by AAS_BestReachableFromJumpPadArea().

01021 {
01022     return AAS_ClientMovementPrediction(move, entnum, origin, presencetype, onground,
01023                                         velocity, cmdmove, cmdframes, maxframes,
01024                                         frametime, SE_HITBOUNDINGBOX, 0,
01025                                         mins, maxs, visualize);
01026 } //end of the function AAS_ClientMovementHitBBox

Here is the call graph for this function:

int AAS_DropToFloor vec3_t  origin,
vec3_t  mins,
vec3_t  maxs
 

Definition at line 56 of file be_aas_move.c.

References AAS_Trace(), bsp_trace_t, CONTENTS_SOLID, bsp_trace_s::endpos, bsp_trace_s::startsolid, vec3_t, and VectorCopy.

Referenced by AAS_SetWeaponJumpAreaFlags(), and BotInitLevelItems().

00057 {
00058     vec3_t end;
00059     bsp_trace_t trace;
00060 
00061     VectorCopy(origin, end);
00062     end[2] -= 100;
00063     trace = AAS_Trace(origin, mins, maxs, end, 0, CONTENTS_SOLID);
00064     if (trace.startsolid) return qfalse;
00065     VectorCopy(trace.endpos, origin);
00066     return qtrue;
00067 } //end of the function AAS_DropToFloor

Here is the call graph for this function:

int AAS_HorizontalVelocityForJump float  zvel,
vec3_t  start,
vec3_t  end,
float *  velocity
 

Definition at line 1062 of file be_aas_move.c.

References aassettings, aas_settings_s::phys_gravity, aas_settings_s::phys_maxvelocity, sqrt(), t, top, vec3_t, and VectorSubtract.

Referenced by AAS_FindFaceReachabilities(), AAS_Reachability_Jump(), AAS_Reachability_JumpPad(), AAS_Reachability_WeaponJump(), AAS_ShowReachability(), and BotTravel_WalkOffLedge().

01063 {
01064     float phys_gravity, phys_maxvelocity;
01065     float maxjump, height2fall, t, top;
01066     vec3_t dir;
01067 
01068     phys_gravity = aassettings.phys_gravity;
01069     phys_maxvelocity = aassettings.phys_maxvelocity;
01070 
01071     //maximum height a player can jump with the given initial z velocity
01072     maxjump = 0.5 * phys_gravity * (zvel / phys_gravity) * (zvel / phys_gravity);
01073     //top of the parabolic jump
01074     top = start[2] + maxjump;
01075     //height the bot will fall from the top
01076     height2fall = top - end[2];
01077     //if the goal is to high to jump to
01078     if (height2fall < 0)
01079     {
01080         *velocity = phys_maxvelocity;
01081         return 0;
01082     } //end if
01083     //time a player takes to fall the height
01084     t = sqrt(height2fall / (0.5 * phys_gravity));
01085     //direction from start to end
01086     VectorSubtract(end, start, dir);
01087     //
01088     if ( (t + zvel / phys_gravity) == 0.0f ) {
01089         *velocity = phys_maxvelocity;
01090         return 0;
01091     }
01092     //calculate horizontal speed
01093     *velocity = sqrt(dir[0]*dir[0] + dir[1]*dir[1]) / (t + zvel / phys_gravity);
01094     //the horizontal speed must be lower than the max speed
01095     if (*velocity > phys_maxvelocity)
01096     {
01097         *velocity = phys_maxvelocity;
01098         return 0;
01099     } //end if
01100     return 1;
01101 } //end of the function AAS_HorizontalVelocityForJump

Here is the call graph for this function:

void AAS_InitSettings void   ) 
 

Definition at line 74 of file be_aas_move.c.

References aassettings, LibVarValue(), aas_settings_s::phys_airaccelerate, aas_settings_s::phys_falldelta10, aas_settings_s::phys_falldelta5, aas_settings_s::phys_friction, aas_settings_s::phys_gravity, aas_settings_s::phys_gravitydirection, aas_settings_s::phys_jumpvel, aas_settings_s::phys_maxbarrier, aas_settings_s::phys_maxcrouchvelocity, aas_settings_s::phys_maxsteepness, aas_settings_s::phys_maxstep, aas_settings_s::phys_maxswimvelocity, aas_settings_s::phys_maxvelocity, aas_settings_s::phys_maxwalkvelocity, aas_settings_s::phys_maxwaterjump, aas_settings_s::phys_stopspeed, aas_settings_s::phys_swimaccelerate, aas_settings_s::phys_walkaccelerate, aas_settings_s::phys_waterfriction, aas_settings_s::phys_watergravity, aas_settings_s::rs_aircontrolledjumppad, aas_settings_s::rs_barrierjump, aas_settings_s::rs_bfgjump, aas_settings_s::rs_falldamage10, aas_settings_s::rs_falldamage5, aas_settings_s::rs_funcbob, aas_settings_s::rs_jumppad, aas_settings_s::rs_maxfallheight, aas_settings_s::rs_maxjumpfallheight, aas_settings_s::rs_rocketjump, aas_settings_s::rs_startcrouch, aas_settings_s::rs_startelevator, aas_settings_s::rs_startgrapple, aas_settings_s::rs_startjump, aas_settings_s::rs_startwalkoffledge, aas_settings_s::rs_teleport, and aas_settings_s::rs_waterjump.

Referenced by AAS_CalcReachAndClusters(), and AAS_LoadMap().

00075 {
00076     aassettings.phys_gravitydirection[0]    = 0;
00077     aassettings.phys_gravitydirection[1]    = 0;
00078     aassettings.phys_gravitydirection[2]    = -1;
00079     aassettings.phys_friction               = LibVarValue("phys_friction", "6");
00080     aassettings.phys_stopspeed              = LibVarValue("phys_stopspeed", "100");
00081     aassettings.phys_gravity                = LibVarValue("phys_gravity", "800");
00082     aassettings.phys_waterfriction          = LibVarValue("phys_waterfriction", "1");
00083     aassettings.phys_watergravity           = LibVarValue("phys_watergravity", "400");
00084     aassettings.phys_maxvelocity            = LibVarValue("phys_maxvelocity", "320");
00085     aassettings.phys_maxwalkvelocity        = LibVarValue("phys_maxwalkvelocity", "320");
00086     aassettings.phys_maxcrouchvelocity      = LibVarValue("phys_maxcrouchvelocity", "100");
00087     aassettings.phys_maxswimvelocity        = LibVarValue("phys_maxswimvelocity", "150");
00088     aassettings.phys_walkaccelerate         = LibVarValue("phys_walkaccelerate", "10");
00089     aassettings.phys_airaccelerate          = LibVarValue("phys_airaccelerate", "1");
00090     aassettings.phys_swimaccelerate         = LibVarValue("phys_swimaccelerate", "4");
00091     aassettings.phys_maxstep                = LibVarValue("phys_maxstep", "19");
00092     aassettings.phys_maxsteepness           = LibVarValue("phys_maxsteepness", "0.7");
00093     aassettings.phys_maxwaterjump           = LibVarValue("phys_maxwaterjump", "18");
00094     aassettings.phys_maxbarrier             = LibVarValue("phys_maxbarrier", "33");
00095     aassettings.phys_jumpvel                = LibVarValue("phys_jumpvel", "270");
00096     aassettings.phys_falldelta5             = LibVarValue("phys_falldelta5", "40");
00097     aassettings.phys_falldelta10            = LibVarValue("phys_falldelta10", "60");
00098     aassettings.rs_waterjump                = LibVarValue("rs_waterjump", "400");
00099     aassettings.rs_teleport                 = LibVarValue("rs_teleport", "50");
00100     aassettings.rs_barrierjump              = LibVarValue("rs_barrierjump", "100");
00101     aassettings.rs_startcrouch              = LibVarValue("rs_startcrouch", "300");
00102     aassettings.rs_startgrapple             = LibVarValue("rs_startgrapple", "500");
00103     aassettings.rs_startwalkoffledge        = LibVarValue("rs_startwalkoffledge", "70");
00104     aassettings.rs_startjump                = LibVarValue("rs_startjump", "300");
00105     aassettings.rs_rocketjump               = LibVarValue("rs_rocketjump", "500");
00106     aassettings.rs_bfgjump                  = LibVarValue("rs_bfgjump", "500");
00107     aassettings.rs_jumppad                  = LibVarValue("rs_jumppad", "250");
00108     aassettings.rs_aircontrolledjumppad     = LibVarValue("rs_aircontrolledjumppad", "300");
00109     aassettings.rs_funcbob                  = LibVarValue("rs_funcbob", "300");
00110     aassettings.rs_startelevator            = LibVarValue("rs_startelevator", "50");
00111     aassettings.rs_falldamage5              = LibVarValue("rs_falldamage5", "300");
00112     aassettings.rs_falldamage10             = LibVarValue("rs_falldamage10", "500");
00113     aassettings.rs_maxfallheight            = LibVarValue("rs_maxfallheight", "0");
00114     aassettings.rs_maxjumpfallheight        = LibVarValue("rs_maxjumpfallheight", "450");
00115 } //end of the function AAS_InitSettings

Here is the call graph for this function:

void AAS_JumpReachRunStart struct aas_reachability_s reach,
vec3_t  runstart
 

Referenced by AAS_ShowReachability(), and BotTravel_Jump().

int AAS_OnGround vec3_t  origin,
int  presencetype,
int  passent
 

Definition at line 185 of file be_aas_move.c.

References aas_plane_t, AAS_PlaneFromNum(), aas_trace_t, AAS_TraceClientBBox(), aassettings, DotProduct, aas_trace_s::endpos, aas_trace_s::fraction, aas_plane_s::normal, aas_settings_s::phys_maxsteepness, aas_trace_s::planenum, aas_trace_s::startsolid, up, vec3_t, and VectorCopy.

Referenced by AAS_ClientMovementPrediction(), BotMoveToGoal(), and BotWalkInDirection().

00186 {
00187     aas_trace_t trace;
00188     vec3_t end, up = {0, 0, 1};
00189     aas_plane_t *plane;
00190 
00191     VectorCopy(origin, end);
00192     end[2] -= 10;
00193 
00194     trace = AAS_TraceClientBBox(origin, end, presencetype, passent);
00195 
00196     //if in solid
00197     if (trace.startsolid) return qfalse;
00198     //if nothing hit at all
00199     if (trace.fraction >= 1.0) return qfalse;
00200     //if too far from the hit plane
00201     if (origin[2] - trace.endpos[2] > 10) return qfalse;
00202     //check if the plane isn't too steep
00203     plane = AAS_PlaneFromNum(trace.planenum);
00204     if (DotProduct(plane->normal, up) < aassettings.phys_maxsteepness) return qfalse;
00205     //the bot is on the ground
00206     return qtrue;
00207 } //end of the function AAS_OnGround

Here is the call graph for this function:

int AAS_PredictClientMovement struct aas_clientmove_s move,
int  entnum,
vec3_t  origin,
int  presencetype,
int  onground,
vec3_t  velocity,
vec3_t  cmdmove,
int  cmdframes,
int  maxframes,
float  frametime,
int  stopevent,
int  stopareanum,
int  visualize
 

Definition at line 994 of file be_aas_move.c.

References AAS_ClientMovementPrediction(), move(), and vec3_t.

Referenced by AAS_JumpReachRunStart(), AAS_Reachability_Jump(), AAS_Reachability_JumpPad(), AAS_Reachability_Teleport(), AAS_Reachability_WeaponJump(), AAS_ShowReachability(), AAS_TestMovementPrediction(), and BotWalkInDirection().

01001 {
01002     vec3_t mins, maxs;
01003     return AAS_ClientMovementPrediction(move, entnum, origin, presencetype, onground,
01004                                         velocity, cmdmove, cmdframes, maxframes,
01005                                         frametime, stopevent, stopareanum,
01006                                         mins, maxs, visualize);
01007 } //end of the function AAS_PredictClientMovement

Here is the call graph for this function:

float AAS_RocketJumpZVelocity vec3_t  origin  ) 
 

Definition at line 341 of file be_aas_move.c.

References AAS_WeaponJumpZVelocity().

Referenced by AAS_Reachability_WeaponJump(), and AAS_ShowReachability().

00342 {
00343     //rocket radius damage is 120 (p_weapon.c: Weapon_RocketLauncher_Fire)
00344     return AAS_WeaponJumpZVelocity(origin, 120);
00345 } //end of the function AAS_RocketJumpZVelocity

Here is the call graph for this function:

void AAS_SetMovedir vec3_t  angles,
vec3_t  movedir
 

Definition at line 235 of file be_aas_move.c.

References AngleVectors(), MOVEDIR_DOWN, MOVEDIR_UP, NULL, VEC_DOWN, VEC_UP, VectorCompare(), and VectorCopy.

00236 {
00237     if (VectorCompare(angles, VEC_UP))
00238     {
00239         VectorCopy(MOVEDIR_UP, movedir);
00240     } //end if
00241     else if (VectorCompare(angles, VEC_DOWN))
00242     {
00243         VectorCopy(MOVEDIR_DOWN, movedir);
00244     } //end else if
00245     else
00246     {
00247         AngleVectors(angles, movedir, NULL, NULL);
00248     } //end else
00249 } //end of the function AAS_SetMovedir

Here is the call graph for this function:

int AAS_Swimming vec3_t  origin  ) 
 

Definition at line 215 of file be_aas_move.c.

References AAS_PointContents(), CONTENTS_LAVA, CONTENTS_SLIME, vec3_t, and VectorCopy.

Referenced by AAS_ClientMovementPrediction(), AAS_TestMovementPrediction(), BotMoveInDirection(), BotMoveToGoal(), and BotReachabilityArea().

00216 {
00217     vec3_t testorg;
00218 
00219     VectorCopy(origin, testorg);
00220     testorg[2] -= 2;
00221     if (AAS_PointContents(testorg) & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER)) return qtrue;
00222     return qfalse;
00223 } //end of the function AAS_Swimming

Here is the call graph for this function:


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