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

be_aas_debug.c File Reference

#include "../game/q_shared.h"
#include "l_memory.h"
#include "l_script.h"
#include "l_precomp.h"
#include "l_struct.h"
#include "l_libvar.h"
#include "aasfile.h"
#include "../game/botlib.h"
#include "../game/be_aas.h"
#include "be_interface.h"
#include "be_aas_funcs.h"
#include "be_aas_def.h"

Include dependency graph for be_aas_debug.c:

Include dependency graph

Go to the source code of this file.

Defines

#define MAX_DEBUGLINES   1024
#define MAX_DEBUGPOLYGONS   8192

Functions

void AAS_ClearShownDebugLines (void)
void AAS_ClearShownPolygons (void)
void AAS_DebugLine (vec3_t start, vec3_t end, int color)
void AAS_DrawArrow (vec3_t start, vec3_t end, int linecolor, int arrowcolor)
void AAS_DrawCross (vec3_t origin, float size, int color)
void AAS_DrawPermanentCross (vec3_t origin, float size, int color)
void AAS_DrawPlaneCross (vec3_t point, vec3_t normal, float dist, int type, int color)
void AAS_FloodAreas (vec3_t origin)
void AAS_FloodAreas_r (int areanum, int cluster, int *done)
void AAS_PermanentLine (vec3_t start, vec3_t end, int color)
void AAS_PrintTravelType (int traveltype)
void AAS_ShowArea (int areanum, int groundfacesonly)
void AAS_ShowAreaPolygons (int areanum, int color, int groundfacesonly)
void AAS_ShowBoundingBox (vec3_t origin, vec3_t mins, vec3_t maxs)
void AAS_ShowFace (int facenum)
void AAS_ShowFacePolygon (int facenum, int color, int flip)
void AAS_ShowPolygon (int color, int numpoints, vec3_t *points)
void AAS_ShowReachability (aas_reachability_t *reach)
void AAS_ShowReachableAreas (int areanum)

Variables

int debuglines [MAX_DEBUGLINES]
int debuglinevisible [MAX_DEBUGLINES]
int debugpolygons [MAX_DEBUGPOLYGONS]
int numdebuglines


Define Documentation

#define MAX_DEBUGLINES   1024
 

Definition at line 45 of file be_aas_debug.c.

#define MAX_DEBUGPOLYGONS   8192
 

Definition at line 46 of file be_aas_debug.c.


Function Documentation

void AAS_ClearShownDebugLines void   ) 
 

Definition at line 103 of file be_aas_debug.c.

Referenced by AAS_TestMovementPrediction(), BotExportTest(), and BotMoveToGoal().

00104 {
00105     int i;
00106 
00107     //make all lines invisible
00108     for (i = 0; i < MAX_DEBUGLINES; i++)
00109     {
00110         if (debuglines[i])
00111         {
00112             //botimport.DebugLineShow(debuglines[i], NULL, NULL, LINECOLOR_NONE);
00113             botimport.DebugLineDelete(debuglines[i]);
00114             debuglines[i] = 0;
00115             debuglinevisible[i] = qfalse;
00116         } //end if
00117     } //end for
00118 } //end of the function AAS_ClearShownDebugLines

void AAS_ClearShownPolygons void   ) 
 

Definition at line 60 of file be_aas_debug.c.

References botimport, botlib_import_s::DebugPolygonDelete, debugpolygons, and i.

Referenced by BotExportTest().

00061 {
00062     int i;
00063 //*
00064     for (i = 0; i < MAX_DEBUGPOLYGONS; i++)
00065     {
00066         if (debugpolygons[i]) botimport.DebugPolygonDelete(debugpolygons[i]);
00067         debugpolygons[i] = 0;
00068     } //end for
00069 //*/
00070 /*
00071     for (i = 0; i < MAX_DEBUGPOLYGONS; i++)
00072     {
00073         botimport.DebugPolygonDelete(i);
00074         debugpolygons[i] = 0;
00075     } //end for
00076 */
00077 } //end of the function AAS_ClearShownPolygons

void AAS_DebugLine vec3_t  start,
vec3_t  end,
int  color
 

Definition at line 125 of file be_aas_debug.c.

00126 {
00127     int line;
00128 
00129     for (line = 0; line < MAX_DEBUGLINES; line++)
00130     {
00131         if (!debuglines[line])
00132         {
00133             debuglines[line] = botimport.DebugLineCreate();
00134             debuglinevisible[line] = qfalse;
00135             numdebuglines++;
00136         } //end if
00137         if (!debuglinevisible[line])
00138         {
00139             botimport.DebugLineShow(debuglines[line], start, end, color);
00140             debuglinevisible[line] = qtrue;
00141             return;
00142         } //end else
00143     } //end for
00144 } //end of the function AAS_DebugLine

void AAS_DrawArrow vec3_t  start,
vec3_t  end,
int  linecolor,
int  arrowcolor
 

Definition at line 579 of file be_aas_debug.c.

References AAS_DebugLine(), CrossProduct(), DotProduct, p2, up, vec3_t, VectorCopy, VectorMA, VectorNormalize(), VectorSet, and VectorSubtract.

Referenced by AAS_ShowReachability().

00580 {
00581     vec3_t dir, cross, p1, p2, up = {0, 0, 1};
00582     float dot;
00583 
00584     VectorSubtract(end, start, dir);
00585     VectorNormalize(dir);
00586     dot = DotProduct(dir, up);
00587     if (dot > 0.99 || dot < -0.99) VectorSet(cross, 1, 0, 0);
00588     else CrossProduct(dir, up, cross);
00589 
00590     VectorMA(end, -6, dir, p1);
00591     VectorCopy(p1, p2);
00592     VectorMA(p1, 6, cross, p1);
00593     VectorMA(p2, -6, cross, p2);
00594 
00595     AAS_DebugLine(start, end, linecolor);
00596     AAS_DebugLine(p1, end, arrowcolor);
00597     AAS_DebugLine(p2, end, arrowcolor);
00598 } //end of the function AAS_DrawArrow

Here is the call graph for this function:

void AAS_DrawCross vec3_t  origin,
float  size,
int  color
 

Definition at line 525 of file be_aas_debug.c.

References AAS_DebugLine(), i, vec3_t, and VectorCopy.

Referenced by AAS_ShowReachability().

00526 {
00527     int i;
00528     vec3_t start, end;
00529 
00530     for (i = 0; i < 3; i++)
00531     {
00532         VectorCopy(origin, start);
00533         start[i] += size;
00534         VectorCopy(origin, end);
00535         end[i] -= size;
00536         AAS_DebugLine(start, end, color);
00537     } //end for
00538 } //end of the function AAS_DrawCross

Here is the call graph for this function:

void AAS_DrawPermanentCross vec3_t  origin,
float  size,
int  color
 

Definition at line 164 of file be_aas_debug.c.

References AAS_DebugLine(), botimport, botlib_import_s::DebugLineCreate, botlib_import_s::DebugLineShow, i, vec3_t, and VectorCopy.

Referenced by AAS_BestReachableArea().

00165 {
00166     int i, debugline;
00167     vec3_t start, end;
00168 
00169     for (i = 0; i < 3; i++)
00170     {
00171         VectorCopy(origin, start);
00172         start[i] += size;
00173         VectorCopy(origin, end);
00174         end[i] -= size;
00175         AAS_DebugLine(start, end, color);
00176         debugline = botimport.DebugLineCreate();
00177         botimport.DebugLineShow(debugline, start, end, color);
00178     } //end for
00179 } //end of the function AAS_DrawPermanentCross

Here is the call graph for this function:

void AAS_DrawPlaneCross vec3_t  point,
vec3_t  normal,
float  dist,
int  type,
int  color
 

Definition at line 186 of file be_aas_debug.c.

References botimport, botlib_import_s::DebugLineCreate, debuglines, botlib_import_s::DebugLineShow, debuglinevisible, j, line, numdebuglines, point, type, vec3_t, and VectorCopy.

Referenced by BotExportTest().

00187 {
00188     int n0, n1, n2, j, line, lines[2];
00189     vec3_t start1, end1, start2, end2;
00190 
00191     //make a cross in the hit plane at the hit point
00192     VectorCopy(point, start1);
00193     VectorCopy(point, end1);
00194     VectorCopy(point, start2);
00195     VectorCopy(point, end2);
00196 
00197     n0 = type % 3;
00198     n1 = (type + 1) % 3;
00199     n2 = (type + 2) % 3;
00200     start1[n1] -= 6;
00201     start1[n2] -= 6;
00202     end1[n1] += 6;
00203     end1[n2] += 6;
00204     start2[n1] += 6;
00205     start2[n2] -= 6;
00206     end2[n1] -= 6;
00207     end2[n2] += 6;
00208 
00209     start1[n0] = (dist - (start1[n1] * normal[n1] +
00210                 start1[n2] * normal[n2])) / normal[n0];
00211     end1[n0] = (dist - (end1[n1] * normal[n1] +
00212                 end1[n2] * normal[n2])) / normal[n0];
00213     start2[n0] = (dist - (start2[n1] * normal[n1] +
00214                 start2[n2] * normal[n2])) / normal[n0];
00215     end2[n0] = (dist - (end2[n1] * normal[n1] +
00216                 end2[n2] * normal[n2])) / normal[n0];
00217 
00218     for (j = 0, line = 0; j < 2 && line < MAX_DEBUGLINES; line++)
00219     {
00220         if (!debuglines[line])
00221         {
00222             debuglines[line] = botimport.DebugLineCreate();
00223             lines[j++] = debuglines[line];
00224             debuglinevisible[line] = qtrue;
00225             numdebuglines++;
00226         } //end if
00227         else if (!debuglinevisible[line])
00228         {
00229             lines[j++] = debuglines[line];
00230             debuglinevisible[line] = qtrue;
00231         } //end else
00232     } //end for
00233     botimport.DebugLineShow(lines[0], start1, end1, color);
00234     botimport.DebugLineShow(lines[1], start2, end2, color);
00235 } //end of the function AAS_DrawPlaneCross

void AAS_FloodAreas vec3_t  origin  ) 
 

Definition at line 769 of file be_aas_debug.c.

References AAS_AreaCluster(), AAS_FloodAreas_r(), AAS_PointAreaNum(), aasworld, GetClearedMemory(), and aas_s::numareas.

Referenced by BotExportTest().

00770 {
00771     int areanum, cluster, *done;
00772 
00773     done = (int *) GetClearedMemory(aasworld.numareas * sizeof(int));
00774     areanum = AAS_PointAreaNum(origin);
00775     cluster = AAS_AreaCluster(areanum);
00776     AAS_FloodAreas_r(areanum, cluster, done);
00777 }

Here is the call graph for this function:

void AAS_FloodAreas_r int  areanum,
int  cluster,
int *  done
 

Definition at line 713 of file be_aas_debug.c.

References aas_area_t, AAS_AreaCluster(), aas_areasettings_t, aas_face_t, aas_reachability_t, AAS_ShowAreaPolygons(), aasworld, abs(), aas_reachability_s::areanum, aas_s::areas, aas_s::areasettings, aas_face_s::backarea, aas_areasettings_s::contents, aas_s::faceindex, aas_s::faces, aas_area_s::firstface, aas_areasettings_s::firstreachablearea, aas_face_s::frontarea, i, aas_area_s::numfaces, aas_areasettings_s::numreachableareas, qtrue, and aas_s::reachability.

Referenced by AAS_FloodAreas().

00714 {
00715     int nextareanum, i, facenum;
00716     aas_area_t *area;
00717     aas_face_t *face;
00718     aas_areasettings_t *settings;
00719     aas_reachability_t *reach;
00720 
00721     AAS_ShowAreaPolygons(areanum, 1, qtrue);
00722     //pointer to the convex area
00723     area = &aasworld.areas[areanum];
00724     settings = &aasworld.areasettings[areanum];
00725     //walk through the faces of the area
00726     for (i = 0; i < area->numfaces; i++)
00727     {
00728         facenum = abs(aasworld.faceindex[area->firstface + i]);
00729         face = &aasworld.faces[facenum];
00730         if (face->frontarea == areanum)
00731             nextareanum = face->backarea;
00732         else
00733             nextareanum = face->frontarea;
00734         if (!nextareanum)
00735             continue;
00736         if (done[nextareanum])
00737             continue;
00738         done[nextareanum] = qtrue;
00739         if (aasworld.areasettings[nextareanum].contents & AREACONTENTS_VIEWPORTAL)
00740             continue;
00741         if (AAS_AreaCluster(nextareanum) != cluster)
00742             continue;
00743         AAS_FloodAreas_r(nextareanum, cluster, done);
00744     } //end for
00745     //
00746     for (i = 0; i < settings->numreachableareas; i++)
00747     {
00748         reach = &aasworld.reachability[settings->firstreachablearea + i];
00749         nextareanum = reach->areanum;
00750         if (!nextareanum)
00751             continue;
00752         if (done[nextareanum])
00753             continue;
00754         done[nextareanum] = qtrue;
00755         if (aasworld.areasettings[nextareanum].contents & AREACONTENTS_VIEWPORTAL)
00756             continue;
00757         if (AAS_AreaCluster(nextareanum) != cluster)
00758             continue;
00759         /*
00760         if ((reach->traveltype & TRAVELTYPE_MASK) == TRAVEL_WALKOFFLEDGE)
00761         {
00762             AAS_DebugLine(reach->start, reach->end, 1);
00763         }
00764         */
00765         AAS_FloodAreas_r(nextareanum, cluster, done);
00766     }
00767 }

Here is the call graph for this function:

void AAS_PermanentLine vec3_t  start,
vec3_t  end,
int  color
 

Definition at line 151 of file be_aas_debug.c.

References botimport, botlib_import_s::DebugLineCreate, botlib_import_s::DebugLineShow, and line.

Referenced by AAS_FindFaceReachabilities(), and AAS_Reachability_FuncBobbing().

00152 {
00153     int line;
00154 
00155     line = botimport.DebugLineCreate();
00156     botimport.DebugLineShow(line, start, end, color);
00157 } //end of the function AAS_PermenentLine

void AAS_PrintTravelType int  traveltype  ) 
 

Definition at line 545 of file be_aas_debug.c.

References botimport, PRT_MESSAGE, TRAVEL_BARRIERJUMP, TRAVEL_BFGJUMP, TRAVEL_CROUCH, TRAVEL_ELEVATOR, TRAVEL_FUNCBOB, TRAVEL_GRAPPLEHOOK, TRAVEL_INVALID, TRAVEL_JUMP, TRAVEL_JUMPPAD, TRAVEL_LADDER, TRAVEL_ROCKETJUMP, TRAVEL_SWIM, TRAVEL_TELEPORT, TRAVEL_WALK, TRAVEL_WALKOFFLEDGE, and TRAVEL_WATERJUMP.

Referenced by AAS_ShowReachableAreas(), and BotMoveToGoal().

00546 {
00547 #ifdef DEBUG
00548     char *str;
00549     //
00550     switch(traveltype & TRAVELTYPE_MASK)
00551     {
00552         case TRAVEL_INVALID: str = "TRAVEL_INVALID"; break;
00553         case TRAVEL_WALK: str = "TRAVEL_WALK"; break;
00554         case TRAVEL_CROUCH: str = "TRAVEL_CROUCH"; break;
00555         case TRAVEL_BARRIERJUMP: str = "TRAVEL_BARRIERJUMP"; break;
00556         case TRAVEL_JUMP: str = "TRAVEL_JUMP"; break;
00557         case TRAVEL_LADDER: str = "TRAVEL_LADDER"; break;
00558         case TRAVEL_WALKOFFLEDGE: str = "TRAVEL_WALKOFFLEDGE"; break;
00559         case TRAVEL_SWIM: str = "TRAVEL_SWIM"; break;
00560         case TRAVEL_WATERJUMP: str = "TRAVEL_WATERJUMP"; break;
00561         case TRAVEL_TELEPORT: str = "TRAVEL_TELEPORT"; break;
00562         case TRAVEL_ELEVATOR: str = "TRAVEL_ELEVATOR"; break;
00563         case TRAVEL_ROCKETJUMP: str = "TRAVEL_ROCKETJUMP"; break;
00564         case TRAVEL_BFGJUMP: str = "TRAVEL_BFGJUMP"; break;
00565         case TRAVEL_GRAPPLEHOOK: str = "TRAVEL_GRAPPLEHOOK"; break;
00566         case TRAVEL_JUMPPAD: str = "TRAVEL_JUMPPAD"; break;
00567         case TRAVEL_FUNCBOB: str = "TRAVEL_FUNCBOB"; break;
00568         default: str = "UNKNOWN TRAVEL TYPE"; break;
00569     } //end switch
00570     botimport.Print(PRT_MESSAGE, "%s", str);
00571 #endif
00572 } //end of the function AAS_PrintTravelType

void AAS_ShowArea int  areanum,
int  groundfacesonly
 

Definition at line 394 of file be_aas_debug.c.

References aas_area_t, aas_edge_t, aas_face_t, aasworld, abs(), aas_s::areas, botimport, botlib_import_s::DebugLineCreate, debuglines, botlib_import_s::DebugLineShow, debuglinevisible, aas_s::edgeindex, aas_s::edges, FACE_GROUND, aas_face_s::faceflags, aas_s::faceindex, aas_s::faces, aas_face_s::firstedge, aas_area_s::firstface, i, j, line, n, aas_s::numareas, numdebuglines, aas_face_s::numedges, aas_s::numedges, aas_area_s::numfaces, aas_s::numfaces, PRT_ERROR, aas_edge_s::v, and aas_s::vertexes.

00395 {
00396     int areaedges[MAX_DEBUGLINES];
00397     int numareaedges, i, j, n, color = 0, line;
00398     int facenum, edgenum;
00399     aas_area_t *area;
00400     aas_face_t *face;
00401     aas_edge_t *edge;
00402 
00403     //
00404     numareaedges = 0;
00405     //
00406     if (areanum < 0 || areanum >= aasworld.numareas)
00407     {
00408         botimport.Print(PRT_ERROR, "area %d out of range [0, %d]\n",
00409                                 areanum, aasworld.numareas);
00410         return;
00411     } //end if
00412     //pointer to the convex area
00413     area = &aasworld.areas[areanum];
00414     //walk through the faces of the area
00415     for (i = 0; i < area->numfaces; i++)
00416     {
00417         facenum = abs(aasworld.faceindex[area->firstface + i]);
00418         //check if face number is in range
00419         if (facenum >= aasworld.numfaces)
00420         {
00421             botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00422         } //end if
00423         face = &aasworld.faces[facenum];
00424         //ground faces only
00425         if (groundfacesonly)
00426         {
00427             if (!(face->faceflags & (FACE_GROUND | FACE_LADDER))) continue;
00428         } //end if
00429         //walk through the edges of the face
00430         for (j = 0; j < face->numedges; j++)
00431         {
00432             //edge number
00433             edgenum = abs(aasworld.edgeindex[face->firstedge + j]);
00434             //check if edge number is in range
00435             if (edgenum >= aasworld.numedges)
00436             {
00437                 botimport.Print(PRT_ERROR, "edgenum %d out of range\n", edgenum);
00438             } //end if
00439             //check if the edge is stored already
00440             for (n = 0; n < numareaedges; n++)
00441             {
00442                 if (areaedges[n] == edgenum) break;
00443             } //end for
00444             if (n == numareaedges && numareaedges < MAX_DEBUGLINES)
00445             {
00446                 areaedges[numareaedges++] = edgenum;
00447             } //end if
00448         } //end for
00449         //AAS_ShowFace(facenum);
00450     } //end for
00451     //draw all the edges
00452     for (n = 0; n < numareaedges; n++)
00453     {
00454         for (line = 0; line < MAX_DEBUGLINES; line++)
00455         {
00456             if (!debuglines[line])
00457             {
00458                 debuglines[line] = botimport.DebugLineCreate();
00459                 debuglinevisible[line] = qfalse;
00460                 numdebuglines++;
00461             } //end if
00462             if (!debuglinevisible[line])
00463             {
00464                 break;
00465             } //end else
00466         } //end for
00467         if (line >= MAX_DEBUGLINES) return;
00468         edge = &aasworld.edges[areaedges[n]];
00469         if (color == LINECOLOR_RED) color = LINECOLOR_BLUE;
00470         else if (color == LINECOLOR_BLUE) color = LINECOLOR_GREEN;
00471         else if (color == LINECOLOR_GREEN) color = LINECOLOR_YELLOW;
00472         else color = LINECOLOR_RED;
00473         botimport.DebugLineShow(debuglines[line],
00474                                     aasworld.vertexes[edge->v[0]],
00475                                     aasworld.vertexes[edge->v[1]],
00476                                     color);
00477         debuglinevisible[line] = qtrue;
00478     } //end for*/
00479 } //end of the function AAS_ShowArea

Here is the call graph for this function:

void AAS_ShowAreaPolygons int  areanum,
int  color,
int  groundfacesonly
 

Definition at line 486 of file be_aas_debug.c.

References aas_area_t, aas_face_t, AAS_ShowFacePolygon(), aasworld, abs(), aas_s::areas, botimport, FACE_GROUND, aas_face_s::faceflags, aas_s::faceindex, aas_s::faces, aas_area_s::firstface, aas_face_s::frontarea, i, aas_s::numareas, aas_area_s::numfaces, aas_s::numfaces, and PRT_ERROR.

Referenced by AAS_AlternativeRouteGoals(), AAS_FloodAreas_r(), AAS_ShowReachability(), and BotExportTest().

00487 {
00488     int i, facenum;
00489     aas_area_t *area;
00490     aas_face_t *face;
00491 
00492     //
00493     if (areanum < 0 || areanum >= aasworld.numareas)
00494     {
00495         botimport.Print(PRT_ERROR, "area %d out of range [0, %d]\n",
00496                                 areanum, aasworld.numareas);
00497         return;
00498     } //end if
00499     //pointer to the convex area
00500     area = &aasworld.areas[areanum];
00501     //walk through the faces of the area
00502     for (i = 0; i < area->numfaces; i++)
00503     {
00504         facenum = abs(aasworld.faceindex[area->firstface + i]);
00505         //check if face number is in range
00506         if (facenum >= aasworld.numfaces)
00507         {
00508             botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00509         } //end if
00510         face = &aasworld.faces[facenum];
00511         //ground faces only
00512         if (groundfacesonly)
00513         {
00514             if (!(face->faceflags & (FACE_GROUND | FACE_LADDER))) continue;
00515         } //end if
00516         AAS_ShowFacePolygon(facenum, color, face->frontarea != areanum);
00517     } //end for
00518 } //end of the function AAS_ShowAreaPolygons

Here is the call graph for this function:

void AAS_ShowBoundingBox vec3_t  origin,
vec3_t  mins,
vec3_t  maxs
 

Definition at line 242 of file be_aas_debug.c.

References botimport, Com_Memcpy(), botlib_import_s::DebugLineCreate, debuglines, botlib_import_s::DebugLineShow, debuglinevisible, i, j, line, LINECOLOR_RED, numdebuglines, and vec3_t.

Referenced by BotExportTest().

00243 {
00244     vec3_t bboxcorners[8];
00245     int lines[3];
00246     int i, j, line;
00247 
00248     //upper corners
00249     bboxcorners[0][0] = origin[0] + maxs[0];
00250     bboxcorners[0][1] = origin[1] + maxs[1];
00251     bboxcorners[0][2] = origin[2] + maxs[2];
00252     //
00253     bboxcorners[1][0] = origin[0] + mins[0];
00254     bboxcorners[1][1] = origin[1] + maxs[1];
00255     bboxcorners[1][2] = origin[2] + maxs[2];
00256     //
00257     bboxcorners[2][0] = origin[0] + mins[0];
00258     bboxcorners[2][1] = origin[1] + mins[1];
00259     bboxcorners[2][2] = origin[2] + maxs[2];
00260     //
00261     bboxcorners[3][0] = origin[0] + maxs[0];
00262     bboxcorners[3][1] = origin[1] + mins[1];
00263     bboxcorners[3][2] = origin[2] + maxs[2];
00264     //lower corners
00265     Com_Memcpy(bboxcorners[4], bboxcorners[0], sizeof(vec3_t) * 4);
00266     for (i = 0; i < 4; i++) bboxcorners[4 + i][2] = origin[2] + mins[2];
00267     //draw bounding box
00268     for (i = 0; i < 4; i++)
00269     {
00270         for (j = 0, line = 0; j < 3 && line < MAX_DEBUGLINES; line++)
00271         {
00272             if (!debuglines[line])
00273             {
00274                 debuglines[line] = botimport.DebugLineCreate();
00275                 lines[j++] = debuglines[line];
00276                 debuglinevisible[line] = qtrue;
00277                 numdebuglines++;
00278             } //end if
00279             else if (!debuglinevisible[line])
00280             {
00281                 lines[j++] = debuglines[line];
00282                 debuglinevisible[line] = qtrue;
00283             } //end else
00284         } //end for
00285         //top plane
00286         botimport.DebugLineShow(lines[0], bboxcorners[i],
00287                                     bboxcorners[(i+1)&3], LINECOLOR_RED);
00288         //bottom plane
00289         botimport.DebugLineShow(lines[1], bboxcorners[4+i],
00290                                     bboxcorners[4+((i+1)&3)], LINECOLOR_RED);
00291         //vertical lines
00292         botimport.DebugLineShow(lines[2], bboxcorners[i],
00293                                     bboxcorners[4+i], LINECOLOR_RED);
00294     } //end for
00295 } //end of the function AAS_ShowBoundingBox

Here is the call graph for this function:

void AAS_ShowFace int  facenum  ) 
 

Definition at line 302 of file be_aas_debug.c.

References AAS_DebugLine(), aas_edge_t, aas_face_t, aas_plane_t, aasworld, abs(), botimport, aas_s::edgeindex, aas_s::edges, aas_s::faces, aas_face_s::firstedge, i, LINECOLOR_RED, aas_plane_s::normal, aas_face_s::numedges, aas_s::numedges, aas_s::numfaces, aas_face_s::planenum, aas_s::planes, PRT_ERROR, aas_edge_s::v, vec3_t, VectorCopy, VectorMA, and aas_s::vertexes.

Referenced by BotExportTest().

00303 {
00304     int i, color, edgenum;
00305     aas_edge_t *edge;
00306     aas_face_t *face;
00307     aas_plane_t *plane;
00308     vec3_t start, end;
00309 
00310     color = LINECOLOR_YELLOW;
00311     //check if face number is in range
00312     if (facenum >= aasworld.numfaces)
00313     {
00314         botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00315     } //end if
00316     face = &aasworld.faces[facenum];
00317     //walk through the edges of the face
00318     for (i = 0; i < face->numedges; i++)
00319     {
00320         //edge number
00321         edgenum = abs(aasworld.edgeindex[face->firstedge + i]);
00322         //check if edge number is in range
00323         if (edgenum >= aasworld.numedges)
00324         {
00325             botimport.Print(PRT_ERROR, "edgenum %d out of range\n", edgenum);
00326         } //end if
00327         edge = &aasworld.edges[edgenum];
00328         if (color == LINECOLOR_RED) color = LINECOLOR_GREEN;
00329         else if (color == LINECOLOR_GREEN) color = LINECOLOR_BLUE;
00330         else if (color == LINECOLOR_BLUE) color = LINECOLOR_YELLOW;
00331         else color = LINECOLOR_RED;
00332         AAS_DebugLine(aasworld.vertexes[edge->v[0]],
00333                                         aasworld.vertexes[edge->v[1]],
00334                                         color);
00335     } //end for
00336     plane = &aasworld.planes[face->planenum];
00337     edgenum = abs(aasworld.edgeindex[face->firstedge]);
00338     edge = &aasworld.edges[edgenum];
00339     VectorCopy(aasworld.vertexes[edge->v[0]], start);
00340     VectorMA(start, 20, plane->normal, end);
00341     AAS_DebugLine(start, end, LINECOLOR_RED);
00342 } //end of the function AAS_ShowFace

Here is the call graph for this function:

void AAS_ShowFacePolygon int  facenum,
int  color,
int  flip
 

Definition at line 349 of file be_aas_debug.c.

References aas_edge_t, aas_face_t, AAS_ShowPolygon(), aasworld, abs(), botimport, aas_s::edgeindex, aas_s::edges, aas_s::faces, aas_face_s::firstedge, i, aas_face_s::numedges, aas_s::numfaces, points, PRT_ERROR, aas_edge_s::v, vec3_t, VectorCopy, and aas_s::vertexes.

Referenced by AAS_ShowAreaPolygons().

00350 {
00351     int i, edgenum, numpoints;
00352     vec3_t points[128];
00353     aas_edge_t *edge;
00354     aas_face_t *face;
00355 
00356     //check if face number is in range
00357     if (facenum >= aasworld.numfaces)
00358     {
00359         botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00360     } //end if
00361     face = &aasworld.faces[facenum];
00362     //walk through the edges of the face
00363     numpoints = 0;
00364     if (flip)
00365     {
00366         for (i = face->numedges-1; i >= 0; i--)
00367         {
00368             //edge number
00369             edgenum = aasworld.edgeindex[face->firstedge + i];
00370             edge = &aasworld.edges[abs(edgenum)];
00371             VectorCopy(aasworld.vertexes[edge->v[edgenum < 0]], points[numpoints]);
00372             numpoints++;
00373         } //end for
00374     } //end if
00375     else
00376     {
00377         for (i = 0; i < face->numedges; i++)
00378         {
00379             //edge number
00380             edgenum = aasworld.edgeindex[face->firstedge + i];
00381             edge = &aasworld.edges[abs(edgenum)];
00382             VectorCopy(aasworld.vertexes[edge->v[edgenum < 0]], points[numpoints]);
00383             numpoints++;
00384         } //end for
00385     } //end else
00386     AAS_ShowPolygon(color, numpoints, points);
00387 } //end of the function AAS_ShowFacePolygon

Here is the call graph for this function:

void AAS_ShowPolygon int  color,
int  numpoints,
vec3_t points
 

Definition at line 84 of file be_aas_debug.c.

References botimport, botlib_import_s::DebugPolygonCreate, debugpolygons, i, and points.

Referenced by AAS_ShowFacePolygon().

00085 {
00086     int i;
00087 
00088     for (i = 0; i < MAX_DEBUGPOLYGONS; i++)
00089     {
00090         if (!debugpolygons[i])
00091         {
00092             debugpolygons[i] = botimport.DebugPolygonCreate(color, numpoints, points);
00093             break;
00094         } //end if
00095     } //end for
00096 } //end of the function AAS_ShowPolygon

void AAS_ShowReachability aas_reachability_t reach  ) 
 

Definition at line 605 of file be_aas_debug.c.

References aas_clientmove_t, AAS_DrawArrow(), AAS_DrawCross(), AAS_HorizontalVelocityForJump(), AAS_JumpReachRunStart(), AAS_PredictClientMovement(), aas_reachability_t, AAS_RocketJumpZVelocity(), AAS_ShowAreaPolygons(), aassettings, aas_reachability_s::areanum, aas_reachability_s::edgenum, aas_reachability_s::end, aas_reachability_s::facenum, LINECOLOR_BLUE, LINECOLOR_YELLOW, move(), aas_settings_s::phys_jumpvel, PRESENCE_NORMAL, qtrue, SE_ENTERLAVA, SE_ENTERSLIME, SE_ENTERWATER, SE_HITGROUND, SE_HITGROUNDAREA, SE_HITGROUNDDAMAGE, SE_TOUCHJUMPPAD, aas_reachability_s::start, TRAVEL_JUMP, aas_reachability_s::traveltype, vec3_t, VectorClear, VectorNormalize(), VectorScale, VectorSet, and VectorSubtract.

00606 {
00607     vec3_t dir, cmdmove, velocity;
00608     float speed, zvel;
00609     aas_clientmove_t move;
00610 
00611     AAS_ShowAreaPolygons(reach->areanum, 5, qtrue);
00612     //AAS_ShowArea(reach->areanum, qtrue);
00613     AAS_DrawArrow(reach->start, reach->end, LINECOLOR_BLUE, LINECOLOR_YELLOW);
00614     //
00615     if ((reach->traveltype & TRAVELTYPE_MASK) == TRAVEL_JUMP ||
00616         (reach->traveltype & TRAVELTYPE_MASK) == TRAVEL_WALKOFFLEDGE)
00617     {
00618         AAS_HorizontalVelocityForJump(aassettings.phys_jumpvel, reach->start, reach->end, &speed);
00619         //
00620         VectorSubtract(reach->end, reach->start, dir);
00621         dir[2] = 0;
00622         VectorNormalize(dir);
00623         //set the velocity
00624         VectorScale(dir, speed, velocity);
00625         //set the command movement
00626         VectorClear(cmdmove);
00627         cmdmove[2] = aassettings.phys_jumpvel;
00628         //
00629         AAS_PredictClientMovement(&move, -1, reach->start, PRESENCE_NORMAL, qtrue,
00630                                     velocity, cmdmove, 3, 30, 0.1f,
00631                                     SE_HITGROUND|SE_ENTERWATER|SE_ENTERSLIME|
00632                                     SE_ENTERLAVA|SE_HITGROUNDDAMAGE, 0, qtrue);
00633         //
00634         if ((reach->traveltype & TRAVELTYPE_MASK) == TRAVEL_JUMP)
00635         {
00636             AAS_JumpReachRunStart(reach, dir);
00637             AAS_DrawCross(dir, 4, LINECOLOR_BLUE);
00638         } //end if
00639     } //end if
00640     else if ((reach->traveltype & TRAVELTYPE_MASK) == TRAVEL_ROCKETJUMP)
00641     {
00642         zvel = AAS_RocketJumpZVelocity(reach->start);
00643         AAS_HorizontalVelocityForJump(zvel, reach->start, reach->end, &speed);
00644         //
00645         VectorSubtract(reach->end, reach->start, dir);
00646         dir[2] = 0;
00647         VectorNormalize(dir);
00648         //get command movement
00649         VectorScale(dir, speed, cmdmove);
00650         VectorSet(velocity, 0, 0, zvel);
00651         //
00652         AAS_PredictClientMovement(&move, -1, reach->start, PRESENCE_NORMAL, qtrue,
00653                                     velocity, cmdmove, 30, 30, 0.1f,
00654                                     SE_ENTERWATER|SE_ENTERSLIME|
00655                                     SE_ENTERLAVA|SE_HITGROUNDDAMAGE|
00656                                     SE_TOUCHJUMPPAD|SE_HITGROUNDAREA, reach->areanum, qtrue);
00657     } //end else if
00658     else if ((reach->traveltype & TRAVELTYPE_MASK) == TRAVEL_JUMPPAD)
00659     {
00660         VectorSet(cmdmove, 0, 0, 0);
00661         //
00662         VectorSubtract(reach->end, reach->start, dir);
00663         dir[2] = 0;
00664         VectorNormalize(dir);
00665         //set the velocity
00666         //NOTE: the edgenum is the horizontal velocity
00667         VectorScale(dir, reach->edgenum, velocity);
00668         //NOTE: the facenum is the Z velocity
00669         velocity[2] = reach->facenum;
00670         //
00671         AAS_PredictClientMovement(&move, -1, reach->start, PRESENCE_NORMAL, qtrue,
00672                                     velocity, cmdmove, 30, 30, 0.1f,
00673                                     SE_ENTERWATER|SE_ENTERSLIME|
00674                                     SE_ENTERLAVA|SE_HITGROUNDDAMAGE|
00675                                     SE_TOUCHJUMPPAD|SE_HITGROUNDAREA, reach->areanum, qtrue);
00676     } //end else if
00677 } //end of the function AAS_ShowReachability

Here is the call graph for this function:

void AAS_ShowReachableAreas int  areanum  ) 
 

Definition at line 684 of file be_aas_debug.c.

References aas_areasettings_t, AAS_PrintTravelType(), aas_reachability_t, AAS_ShowReachability(), AAS_Time(), aasworld, aas_s::areasettings, botimport, Com_Memcpy(), aas_areasettings_s::firstreachablearea, aas_areasettings_s::numreachableareas, PRT_MESSAGE, aas_s::reachability, aas_reachability_s::traveltype, and TRAVELTYPE_MASK.

Referenced by BotExportTest().

00685 {
00686     aas_areasettings_t *settings;
00687     static aas_reachability_t reach;
00688     static int index, lastareanum;
00689     static float lasttime;
00690 
00691     if (areanum != lastareanum)
00692     {
00693         index = 0;
00694         lastareanum = areanum;
00695     } //end if
00696     settings = &aasworld.areasettings[areanum];
00697     //
00698     if (!settings->numreachableareas) return;
00699     //
00700     if (index >= settings->numreachableareas) index = 0;
00701     //
00702     if (AAS_Time() - lasttime > 1.5)
00703     {
00704         Com_Memcpy(&reach, &aasworld.reachability[settings->firstreachablearea + index], sizeof(aas_reachability_t));
00705         index++;
00706         lasttime = AAS_Time();
00707         AAS_PrintTravelType(reach.traveltype & TRAVELTYPE_MASK);
00708         botimport.Print(PRT_MESSAGE, "\n");
00709     } //end if
00710     AAS_ShowReachability(&reach);
00711 } //end of the function ShowReachableAreas

Here is the call graph for this function:


Variable Documentation

int debuglines[MAX_DEBUGLINES]
 

Definition at line 48 of file be_aas_debug.c.

Referenced by AAS_ClearShownDebugLines(), AAS_DebugLine(), AAS_DrawPlaneCross(), AAS_ShowArea(), and AAS_ShowBoundingBox().

int debuglinevisible[MAX_DEBUGLINES]
 

Definition at line 49 of file be_aas_debug.c.

Referenced by AAS_ClearShownDebugLines(), AAS_DebugLine(), AAS_DrawPlaneCross(), AAS_ShowArea(), and AAS_ShowBoundingBox().