00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "../game/q_shared.h"
00033 #include "l_memory.h"
00034 #include "l_script.h"
00035 #include "l_precomp.h"
00036 #include "l_struct.h"
00037 #include "l_libvar.h"
00038 #include "aasfile.h"
00039 #include "../game/botlib.h"
00040 #include "../game/be_aas.h"
00041 #include "be_interface.h"
00042 #include "be_aas_funcs.h"
00043 #include "be_aas_def.h"
00044
00045 #define MAX_DEBUGLINES 1024
00046 #define MAX_DEBUGPOLYGONS 8192
00047
00048 int debuglines[MAX_DEBUGLINES];
00049 int debuglinevisible[MAX_DEBUGLINES];
00050 int numdebuglines;
00051
00052 static int debugpolygons[MAX_DEBUGPOLYGONS];
00053
00054
00055
00056
00057
00058
00059
00060 void AAS_ClearShownPolygons(void)
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 }
00069
00070
00071
00072
00073
00074
00075
00076
00077 }
00078
00079
00080
00081
00082
00083
00084 void AAS_ShowPolygon(int color, int numpoints, vec3_t *points)
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 }
00095 }
00096 }
00097
00098
00099
00100
00101
00102
00103 void AAS_ClearShownDebugLines(void)
00104 {
00105 int i;
00106
00107
00108 for (i = 0; i < MAX_DEBUGLINES; i++)
00109 {
00110 if (debuglines[i])
00111 {
00112
00113 botimport.DebugLineDelete(debuglines[i]);
00114 debuglines[i] = 0;
00115 debuglinevisible[i] = qfalse;
00116 }
00117 }
00118 }
00119
00120
00121
00122
00123
00124
00125 void AAS_DebugLine(vec3_t start, vec3_t end, int color)
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 }
00137 if (!debuglinevisible[line])
00138 {
00139 botimport.DebugLineShow(debuglines[line], start, end, color);
00140 debuglinevisible[line] = qtrue;
00141 return;
00142 }
00143 }
00144 }
00145
00146
00147
00148
00149
00150
00151 void AAS_PermanentLine(vec3_t start, vec3_t end, int color)
00152 {
00153 int line;
00154
00155 line = botimport.DebugLineCreate();
00156 botimport.DebugLineShow(line, start, end, color);
00157 }
00158
00159
00160
00161
00162
00163
00164 void AAS_DrawPermanentCross(vec3_t origin, float size, int color)
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 }
00179 }
00180
00181
00182
00183
00184
00185
00186 void AAS_DrawPlaneCross(vec3_t point, vec3_t normal, float dist, int type, int color)
00187 {
00188 int n0, n1, n2, j, line, lines[2];
00189 vec3_t start1, end1, start2, end2;
00190
00191
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 }
00227 else if (!debuglinevisible[line])
00228 {
00229 lines[j++] = debuglines[line];
00230 debuglinevisible[line] = qtrue;
00231 }
00232 }
00233 botimport.DebugLineShow(lines[0], start1, end1, color);
00234 botimport.DebugLineShow(lines[1], start2, end2, color);
00235 }
00236
00237
00238
00239
00240
00241
00242 void AAS_ShowBoundingBox(vec3_t origin, vec3_t mins, vec3_t maxs)
00243 {
00244 vec3_t bboxcorners[8];
00245 int lines[3];
00246 int i, j, line;
00247
00248
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
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
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 }
00279 else if (!debuglinevisible[line])
00280 {
00281 lines[j++] = debuglines[line];
00282 debuglinevisible[line] = qtrue;
00283 }
00284 }
00285
00286 botimport.DebugLineShow(lines[0], bboxcorners[i],
00287 bboxcorners[(i+1)&3], LINECOLOR_RED);
00288
00289 botimport.DebugLineShow(lines[1], bboxcorners[4+i],
00290 bboxcorners[4+((i+1)&3)], LINECOLOR_RED);
00291
00292 botimport.DebugLineShow(lines[2], bboxcorners[i],
00293 bboxcorners[4+i], LINECOLOR_RED);
00294 }
00295 }
00296
00297
00298
00299
00300
00301
00302 void AAS_ShowFace(int facenum)
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
00312 if (facenum >= aasworld.numfaces)
00313 {
00314 botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00315 }
00316 face = &aasworld.faces[facenum];
00317
00318 for (i = 0; i < face->numedges; i++)
00319 {
00320
00321 edgenum = abs(aasworld.edgeindex[face->firstedge + i]);
00322
00323 if (edgenum >= aasworld.numedges)
00324 {
00325 botimport.Print(PRT_ERROR, "edgenum %d out of range\n", edgenum);
00326 }
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 }
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 }
00343
00344
00345
00346
00347
00348
00349 void AAS_ShowFacePolygon(int facenum, int color, int flip)
00350 {
00351 int i, edgenum, numpoints;
00352 vec3_t points[128];
00353 aas_edge_t *edge;
00354 aas_face_t *face;
00355
00356
00357 if (facenum >= aasworld.numfaces)
00358 {
00359 botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00360 }
00361 face = &aasworld.faces[facenum];
00362
00363 numpoints = 0;
00364 if (flip)
00365 {
00366 for (i = face->numedges-1; i >= 0; i--)
00367 {
00368
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 }
00374 }
00375 else
00376 {
00377 for (i = 0; i < face->numedges; i++)
00378 {
00379
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 }
00385 }
00386 AAS_ShowPolygon(color, numpoints, points);
00387 }
00388
00389
00390
00391
00392
00393
00394 void AAS_ShowArea(int areanum, int groundfacesonly)
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 }
00412
00413 area = &aasworld.areas[areanum];
00414
00415 for (i = 0; i < area->numfaces; i++)
00416 {
00417 facenum = abs(aasworld.faceindex[area->firstface + i]);
00418
00419 if (facenum >= aasworld.numfaces)
00420 {
00421 botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00422 }
00423 face = &aasworld.faces[facenum];
00424
00425 if (groundfacesonly)
00426 {
00427 if (!(face->faceflags & (FACE_GROUND | FACE_LADDER))) continue;
00428 }
00429
00430 for (j = 0; j < face->numedges; j++)
00431 {
00432
00433 edgenum = abs(aasworld.edgeindex[face->firstedge + j]);
00434
00435 if (edgenum >= aasworld.numedges)
00436 {
00437 botimport.Print(PRT_ERROR, "edgenum %d out of range\n", edgenum);
00438 }
00439
00440 for (n = 0; n < numareaedges; n++)
00441 {
00442 if (areaedges[n] == edgenum) break;
00443 }
00444 if (n == numareaedges && numareaedges < MAX_DEBUGLINES)
00445 {
00446 areaedges[numareaedges++] = edgenum;
00447 }
00448 }
00449
00450 }
00451
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 }
00462 if (!debuglinevisible[line])
00463 {
00464 break;
00465 }
00466 }
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 }
00479 }
00480
00481
00482
00483
00484
00485
00486 void AAS_ShowAreaPolygons(int areanum, int color, int groundfacesonly)
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 }
00499
00500 area = &aasworld.areas[areanum];
00501
00502 for (i = 0; i < area->numfaces; i++)
00503 {
00504 facenum = abs(aasworld.faceindex[area->firstface + i]);
00505
00506 if (facenum >= aasworld.numfaces)
00507 {
00508 botimport.Print(PRT_ERROR, "facenum %d out of range\n", facenum);
00509 }
00510 face = &aasworld.faces[facenum];
00511
00512 if (groundfacesonly)
00513 {
00514 if (!(face->faceflags & (FACE_GROUND | FACE_LADDER))) continue;
00515 }
00516 AAS_ShowFacePolygon(facenum, color, face->frontarea != areanum);
00517 }
00518 }
00519
00520
00521
00522
00523
00524
00525 void AAS_DrawCross(vec3_t origin, float size, int color)
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 }
00538 }
00539
00540
00541
00542
00543
00544
00545 void AAS_PrintTravelType(int traveltype)
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 }
00570 botimport.Print(PRT_MESSAGE, "%s", str);
00571 #endif
00572 }
00573
00574
00575
00576
00577
00578
00579 void AAS_DrawArrow(vec3_t start, vec3_t end, int linecolor, int arrowcolor)
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 }
00599
00600
00601
00602
00603
00604
00605 void AAS_ShowReachability(aas_reachability_t *reach)
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
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
00624 VectorScale(dir, speed, velocity);
00625
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 }
00639 }
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
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 }
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
00666
00667 VectorScale(dir, reach->edgenum, velocity);
00668
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 }
00677 }
00678
00679
00680
00681
00682
00683
00684 void AAS_ShowReachableAreas(int areanum)
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 }
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 }
00710 AAS_ShowReachability(&reach);
00711 }
00712
00713 void AAS_FloodAreas_r(int areanum, int cluster, int *done)
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
00723 area = &aasworld.areas[areanum];
00724 settings = &aasworld.areasettings[areanum];
00725
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 }
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
00761
00762
00763
00764
00765 AAS_FloodAreas_r(nextareanum, cluster, done);
00766 }
00767 }
00768
00769 void AAS_FloodAreas(vec3_t origin)
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 }