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

be_aas_reach.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_AreaCrouch (int areanum)
int AAS_AreaDoNotEnter (int areanum)
int AAS_AreaGrounded (int areanum)
float AAS_AreaGroundFaceArea (int areanum)
int AAS_AreaJumpPad (int areanum)
int AAS_AreaLadder (int areanum)
int AAS_AreaLava (int areanum)
int AAS_AreaLiquid (int areanum)
int AAS_AreaReachability (int areanum)
int AAS_AreaSlime (int areanum)
int AAS_AreaSwim (int areanum)
int AAS_BestReachableArea (vec3_t origin, vec3_t mins, vec3_t maxs, vec3_t goalorigin)
int AAS_BestReachableFromJumpPadArea (vec3_t origin, vec3_t mins, vec3_t maxs)
int AAS_NextModelReachability (int num, int modelnum)


Function Documentation

int AAS_AreaCrouch int  areanum  ) 
 

Definition at line 657 of file be_aas_reach.c.

References aasworld, aas_s::areasettings, and aas_areasettings_s::presencetype.

Referenced by AAS_AreaTravelTime(), AAS_Reachability_EqualFloorHeight(), AAS_Reachability_Jump(), and AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge().

00658 {
00659     if (!(aasworld.areasettings[areanum].presencetype & PRESENCE_NORMAL)) return qtrue;
00660     else return qfalse;
00661 } //end of the function AAS_AreaCrouch

int AAS_AreaDoNotEnter int  areanum  ) 
 

Definition at line 764 of file be_aas_reach.c.

References aasworld, aas_s::areasettings, and aas_areasettings_s::contents.

Referenced by AAS_AreaRouteToGoalArea(), and BotGetReachabilityToGoal().

00765 {
00766     return (aasworld.areasettings[areanum].contents & AREACONTENTS_DONOTENTER);
00767 } //end of the function AAS_AreaDoNotEnter

int AAS_AreaGrounded int  areanum  ) 
 

Definition at line 713 of file be_aas_reach.c.

References aasworld, aas_areasettings_s::areaflags, and aas_s::areasettings.

Referenced by AAS_BestReachableLinkArea(), AAS_NearbySolidOrGap(), AAS_Reachability_Elevator(), AAS_Reachability_EqualFloorHeight(), AAS_Reachability_Grapple(), AAS_Reachability_Jump(), AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(), AAS_Reachability_WalkOffLedge(), and AAS_Reachability_WeaponJump().

00714 {
00715     return (aasworld.areasettings[areanum].areaflags & AREA_GROUNDED);
00716 } //end of the function AAS_AreaGround

float AAS_AreaGroundFaceArea int  areanum  ) 
 

Definition at line 539 of file be_aas_reach.c.

References aas_area_t, aas_face_t, AAS_FaceArea(), aasworld, abs(), aas_s::areas, aas_face_s::faceflags, aas_s::faceindex, aas_s::faces, aas_area_s::firstface, i, and aas_area_s::numfaces.

Referenced by AAS_RandomGoalArea().

00540 {
00541     int i;
00542     float total;
00543     aas_area_t *area;
00544     aas_face_t *face;
00545 
00546     total = 0;
00547     area = &aasworld.areas[areanum];
00548     for (i = 0; i < area->numfaces; i++)
00549     {
00550         face = &aasworld.faces[abs(aasworld.faceindex[area->firstface + i])];
00551         if (!(face->faceflags & FACE_GROUND)) continue;
00552         //
00553         total += AAS_FaceArea(face);
00554     } //end for
00555     return total;
00556 } //end of the function AAS_AreaGroundFaceArea

Here is the call graph for this function:

int AAS_AreaJumpPad int  areanum  ) 
 

Definition at line 734 of file be_aas_reach.c.

References aasworld, aas_s::areasettings, and aas_areasettings_s::contents.

Referenced by AAS_BestReachableFromJumpPadArea(), AAS_Reachability_Jump(), AAS_Reachability_JumpPad(), AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(), AAS_Reachability_Teleport(), AAS_Reachability_WalkOffLedge(), BotMoveToGoal(), and BotUpdateEntityItems().

00735 {
00736     return (aasworld.areasettings[areanum].contents & AREACONTENTS_JUMPPAD);
00737 } //end of the function AAS_AreaJumpPad

int AAS_AreaLadder int  areanum  ) 
 

Definition at line 724 of file be_aas_reach.c.

References aasworld, aas_areasettings_s::areaflags, and aas_s::areasettings.

Referenced by AAS_Reachability_Ladder().

00725 {
00726     return (aasworld.areasettings[areanum].areaflags & AREA_LADDER);
00727 } //end of the function AAS_AreaLadder

int AAS_AreaLava int  areanum  ) 
 

Definition at line 692 of file be_aas_reach.c.

References aasworld, aas_s::areasettings, and aas_areasettings_s::contents.

00693 {
00694     return (aasworld.areasettings[areanum].contents & AREACONTENTS_LAVA);
00695 } //end of the function AAS_AreaLava

int AAS_AreaLiquid int  areanum  ) 
 

Definition at line 681 of file be_aas_reach.c.

References aasworld, aas_areasettings_s::areaflags, and aas_s::areasettings.

00682 {
00683     if (aasworld.areasettings[areanum].areaflags & AREA_LIQUID) return qtrue;
00684     else return qfalse;
00685 } //end of the function AAS_AreaLiquid

int AAS_AreaReachability int  areanum  ) 
 

Definition at line 523 of file be_aas_reach.c.

References AAS_Error, aasworld, aas_s::areasettings, aas_s::numareas, and aas_areasettings_s::numreachableareas.

Referenced by AAS_AlternativeRouteGoals(), AAS_BestReachableLinkArea(), AAS_CreateAllRoutingCache(), AAS_NumberClusterAreas(), AAS_PointReachabilityAreaIndex(), AAS_RandomGoalArea(), BotCheckBlocked(), BotChooseLTGItem(), BotChooseNBGItem(), BotFuzzyPointReachabilityArea(), BotMoveToGoal(), and BotReachabilityArea().

00524 {
00525     if (areanum < 0 || areanum >= aasworld.numareas)
00526     {
00527         AAS_Error("AAS_AreaReachability: areanum %d out of range", areanum);
00528         return 0;
00529     } //end if
00530     return aasworld.areasettings[areanum].numreachableareas;
00531 } //end of the function AAS_AreaReachability

int AAS_AreaSlime int  areanum  ) 
 

Definition at line 702 of file be_aas_reach.c.

References aasworld, aas_s::areasettings, and aas_areasettings_s::contents.

00703 {
00704     return (aasworld.areasettings[areanum].contents & AREACONTENTS_SLIME);
00705 } //end of the function AAS_AreaSlime

int AAS_AreaSwim int  areanum  ) 
 

Definition at line 669 of file be_aas_reach.c.

References aasworld, aas_areasettings_s::areaflags, and aas_s::areasettings.

Referenced by AAS_AreaTravelTime(), AAS_BestReachableLinkArea(), AAS_NearbySolidOrGap(), AAS_RandomGoalArea(), AAS_Reachability_Elevator(), AAS_Reachability_Grapple(), AAS_Reachability_Step_Barrier_WaterJump_WalkOffLedge(), AAS_Reachability_Swim(), AAS_Reachability_WalkOffLedge(), and AAS_Reachability_WeaponJump().

00670 {
00671     if (aasworld.areasettings[areanum].areaflags & AREA_LIQUID) return qtrue;
00672     else return qfalse;
00673 } //end of the function AAS_AreaSwim

int AAS_BestReachableArea vec3_t  origin,
vec3_t  mins,
vec3_t  maxs,
vec3_t  goalorigin
 

Definition at line 360 of file be_aas_reach.c.

References AAS_BestReachableLinkArea(), AAS_DrawPermanentCross(), aas_link_t, AAS_LinkEntityClientBBox(), AAS_PointAreaNum(), aas_trace_t, AAS_TraceClientBBox(), AAS_UnlinkFromAreas(), aasworld, botimport, aas_trace_s::endpos, i, j, k, l, LINECOLOR_RED, aas_s::loaded, Log_Write(), PRESENCE_CROUCH, PRT_ERROR, PRT_MESSAGE, aas_trace_s::startsolid, vec3_t, VectorAdd, and VectorCopy.

Referenced by AAS_SetWeaponJumpAreaFlags(), BotInitLevelItems(), and BotUpdateEntityItems().

00361 {
00362     int areanum, i, j, k, l;
00363     aas_link_t *areas;
00364     vec3_t absmins, absmaxs;
00365     //vec3_t bbmins, bbmaxs;
00366     vec3_t start, end;
00367     aas_trace_t trace;
00368 
00369     if (!aasworld.loaded)
00370     {
00371         botimport.Print(PRT_ERROR, "AAS_BestReachableArea: aas not loaded\n");
00372         return 0;
00373     } //end if
00374     //find a point in an area
00375     VectorCopy(origin, start);
00376     areanum = AAS_PointAreaNum(start);
00377     //while no area found fudge around a little
00378     for (i = 0; i < 5 && !areanum; i++)
00379     {
00380         for (j = 0; j < 5 && !areanum; j++)
00381         {
00382             for (k = -1; k <= 1 && !areanum; k++)
00383             {
00384                 for (l = -1; l <= 1 && !areanum; l++)
00385                 {
00386                     VectorCopy(origin, start);
00387                     start[0] += (float) j * 4 * k;
00388                     start[1] += (float) j * 4 * l;
00389                     start[2] += (float) i * 4;
00390                     areanum = AAS_PointAreaNum(start);
00391                 } //end for
00392             } //end for
00393         } //end for
00394     } //end for
00395     //if an area was found
00396     if (areanum)
00397     {
00398         //drop client bbox down and try again
00399         VectorCopy(start, end);
00400         start[2] += 0.25;
00401         end[2] -= 50;
00402         trace = AAS_TraceClientBBox(start, end, PRESENCE_CROUCH, -1);
00403         if (!trace.startsolid)
00404         {
00405             areanum = AAS_PointAreaNum(trace.endpos);
00406             VectorCopy(trace.endpos, goalorigin);
00407             //FIXME: cannot enable next line right now because the reachability
00408             // does not have to be calculated when the level items are loaded
00409             //if the origin is in an area with reachability
00410             //if (AAS_AreaReachability(areanum)) return areanum;
00411             if (areanum) return areanum;
00412         } //end if
00413         else
00414         {
00415             //it can very well happen that the AAS_PointAreaNum function tells that
00416             //a point is in an area and that starting a AAS_TraceClientBBox from that
00417             //point will return trace.startsolid qtrue
00418 #if 0
00419             if (AAS_PointAreaNum(start))
00420             {
00421                 Log_Write("point %f %f %f in area %d but trace startsolid", start[0], start[1], start[2], areanum);
00422                 AAS_DrawPermanentCross(start, 4, LINECOLOR_RED);
00423             } //end if
00424             botimport.Print(PRT_MESSAGE, "AAS_BestReachableArea: start solid\n");
00425 #endif
00426             VectorCopy(start, goalorigin);
00427             return areanum;
00428         } //end else
00429     } //end if
00430     //
00431     //AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, bbmins, bbmaxs);
00432     //NOTE: the goal origin does not have to be in the goal area
00433     // because the bot will have to move towards the item origin anyway
00434     VectorCopy(origin, goalorigin);
00435     //
00436     VectorAdd(origin, mins, absmins);
00437     VectorAdd(origin, maxs, absmaxs);
00438     //add bounding box size
00439     //VectorSubtract(absmins, bbmaxs, absmins);
00440     //VectorSubtract(absmaxs, bbmins, absmaxs);
00441     //link an invalid (-1) entity
00442     areas = AAS_LinkEntityClientBBox(absmins, absmaxs, -1, PRESENCE_CROUCH);
00443     //get the reachable link arae
00444     areanum = AAS_BestReachableLinkArea(areas);
00445     //unlink the invalid entity
00446     AAS_UnlinkFromAreas(areas);
00447     //
00448     return areanum;
00449 } //end of the function AAS_BestReachableArea

Here is the call graph for this function:

int AAS_BestReachableFromJumpPadArea vec3_t  origin,
vec3_t  mins,
vec3_t  maxs
 

Definition at line 290 of file be_aas_reach.c.

References AAS_AreaJumpPad(), AAS_AreaVolume(), aas_clientmove_t, AAS_ClientMovementHitBBox(), AAS_GetJumpPadInfo(), aas_link_t, AAS_LinkEntityClientBBox(), AAS_NextBSPEntity(), AAS_UnlinkFromAreas(), AAS_ValueForBSPEpairKey(), aas_link_s::areanum, botimport, Com_Memset(), f, aas_clientmove_s::frames, LibVarValue(), MAX_EPAIRKEY, move(), aas_link_s::next_area, PRESENCE_CROUCH, PRESENCE_NORMAL, PRT_MESSAGE, qfalse, strcmp(), vec3_t, VectorAdd, and VectorSet.

Referenced by BotInitLevelItems().

00291 {
00292     int area2num, ent, bot_visualizejumppads, bestareanum;
00293     float volume, bestareavolume;
00294     vec3_t areastart, cmdmove, bboxmins, bboxmaxs;
00295     vec3_t absmins, absmaxs, velocity;
00296     aas_clientmove_t move;
00297     aas_link_t *areas, *link;
00298     char classname[MAX_EPAIRKEY];
00299 
00300 #ifdef BSPC
00301     bot_visualizejumppads = 0;
00302 #else
00303     bot_visualizejumppads = LibVarValue("bot_visualizejumppads", "0");
00304 #endif
00305     VectorAdd(origin, mins, bboxmins);
00306     VectorAdd(origin, maxs, bboxmaxs);
00307     for (ent = AAS_NextBSPEntity(0); ent; ent = AAS_NextBSPEntity(ent))
00308     {
00309         if (!AAS_ValueForBSPEpairKey(ent, "classname", classname, MAX_EPAIRKEY)) continue;
00310         if (strcmp(classname, "trigger_push")) continue;
00311         //
00312         if (!AAS_GetJumpPadInfo(ent, areastart, absmins, absmaxs, velocity)) continue;
00313         //get the areas the jump pad brush is in
00314         areas = AAS_LinkEntityClientBBox(absmins, absmaxs, -1, PRESENCE_CROUCH);
00315         for (link = areas; link; link = link->next_area)
00316         {
00317             if (AAS_AreaJumpPad(link->areanum)) break;
00318         } //end for
00319         if (!link)
00320         {
00321             botimport.Print(PRT_MESSAGE, "trigger_push not in any jump pad area\n");
00322             AAS_UnlinkFromAreas(areas);
00323             continue;
00324         } //end if
00325         //
00326         //botimport.Print(PRT_MESSAGE, "found a trigger_push with velocity %f %f %f\n", velocity[0], velocity[1], velocity[2]);
00327         //
00328         VectorSet(cmdmove, 0, 0, 0);
00329         Com_Memset(&move, 0, sizeof(aas_clientmove_t));
00330         area2num = 0;
00331         AAS_ClientMovementHitBBox(&move, -1, areastart, PRESENCE_NORMAL, qfalse,
00332                                 velocity, cmdmove, 0, 30, 0.1f, bboxmins, bboxmaxs, bot_visualizejumppads);
00333         if (move.frames < 30)
00334         {
00335             bestareanum = 0;
00336             bestareavolume = 0;
00337             for (link = areas; link; link = link->next_area)
00338             {
00339                 if (!AAS_AreaJumpPad(link->areanum)) continue;
00340                 volume = AAS_AreaVolume(link->areanum);
00341                 if (volume >= bestareavolume)
00342                 {
00343                     bestareanum = link->areanum;
00344                     bestareavolume = volume;
00345                 } //end if
00346             } //end if
00347             AAS_UnlinkFromAreas(areas);
00348             return bestareanum;
00349         } //end if
00350         AAS_UnlinkFromAreas(areas);
00351     } //end for
00352     return 0;
00353 } //end of the function AAS_BestReachableFromJumpPadArea

Here is the call graph for this function:

int AAS_NextModelReachability int  num,
int  modelnum
 

Definition at line 1974 of file be_aas_route.c.

References aasworld, aas_reachability_s::facenum, i, aas_s::reachability, aas_s::reachabilitysize, and aas_reachability_s::traveltype.

Referenced by BotMoveToGoal(), and BotReachabilityArea().

01975 {
01976     int i;
01977 
01978     if (num <= 0) num = 1;
01979     else if (num >= aasworld.reachabilitysize) return 0;
01980     else num++;
01981     //
01982     for (i = num; i < aasworld.reachabilitysize; i++)
01983     {
01984         if ((aasworld.reachability[i].traveltype & TRAVELTYPE_MASK) == TRAVEL_ELEVATOR)
01985         {
01986             if (aasworld.reachability[i].facenum == modelnum) return i;
01987         } //end if
01988         else if ((aasworld.reachability[i].traveltype & TRAVELTYPE_MASK) == TRAVEL_FUNCBOB)
01989         {
01990             if ((aasworld.reachability[i].facenum & 0x0000FFFF) == modelnum) return i;
01991         } //end if
01992     } //end for
01993     return 0;
01994 } //end of the function AAS_NextModelReachability


Generated on Thu Aug 25 12:40:07 2005 for Quake III Arena by  doxygen 1.3.9.1