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

aas_areamerging.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

void AAS_MergeAreas (void)


Function Documentation

void AAS_MergeAreas void   ) 
 

Definition at line 325 of file aas_areamerging.c.

References AAS_GroundArea(), AAS_RefreshMergedTree_r(), AAS_TryMergeFaceAreas(), tmp_aas_s::areas, tmp_face_s::backarea, tmp_face_s::frontarea, tmp_area_s::invalid, tmp_area_s::l_next, Log_Write(), tmp_face_s::next, tmp_aas_s::nodes, qprintf(), tmp_area_t, tmp_face_t, tmpaasworld, and tmp_area_s::tmpfaces.

Referenced by AAS_Create().

00326 {
00327     int side, nummerges, merges, groundfirst;
00328     tmp_area_t *tmparea, *othertmparea;
00329     tmp_face_t *face;
00330 
00331     nummerges = 0;
00332     Log_Write("AAS_MergeAreas\r\n");
00333     qprintf("%6d areas merged", 1);
00334     //
00335     groundfirst = true;
00336     //for (i = 0; i < 4 || merges; i++)
00337     while(1)
00338     {
00339         //if (i < 2) groundfirst = true;
00340         //else groundfirst = false;
00341         //
00342         merges = 0;
00343         //first merge grounded areas only
00344         for (tmparea = tmpaasworld.areas; tmparea; tmparea = tmparea->l_next)
00345         {
00346             //if the area is invalid
00347             if (tmparea->invalid)
00348             {
00349                 continue;
00350             } //end if
00351             //
00352             if (groundfirst)
00353             {
00354                 if (!AAS_GroundArea(tmparea)) continue;
00355             } //end if
00356             //
00357             for (face = tmparea->tmpfaces; face; face = face->next[side])
00358             {
00359                 side = (face->frontarea != tmparea);
00360                 //if the face has both a front and back area
00361                 if (face->frontarea && face->backarea)
00362                 {
00363                     //
00364                     if (face->frontarea == tmparea) othertmparea = face->backarea;
00365                     else othertmparea = face->frontarea;
00366                     //
00367                     if (groundfirst)
00368                     {
00369                         if (!AAS_GroundArea(othertmparea)) continue;
00370                     } //end if
00371                     if (AAS_TryMergeFaceAreas(face))
00372                     {
00373                         qprintf("\r%6d", ++nummerges);
00374                         merges++;
00375                         break;
00376                     } //end if
00377                 } //end if
00378             } //end for
00379         } //end for
00380         if (!merges)
00381         {
00382             if (groundfirst) groundfirst = false;
00383             else break;
00384         } //end if
00385     } //end for
00386     qprintf("\n");
00387     Log_Write("%6d areas merged\r\n", nummerges);
00388     //refresh the merged tree
00389     AAS_RefreshMergedTree_r(tmpaasworld.nodes);
00390 } //end of the function AAS_MergeAreas

Here is the call graph for this function:


Generated on Thu Aug 25 12:44:42 2005 for Quake III Arena by  doxygen 1.3.9.1