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

aas_map.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_CreateMapBrushes (mapbrush_t *brush, entity_t *mapent, int addbevels)


Function Documentation

void AAS_CreateMapBrushes mapbrush_t brush,
entity_t mapent,
int  addbevels
 

Definition at line 722 of file aas_map.c.

References AAS_CopyMapBrush(), AAS_ExpandMapBrush(), AAS_MakeBrushWindings(), AAS_PositionBrush(), AAS_SetTexinfo(), AAS_ValidEntity(), AddBrushBevels(), cfg_s::bboxes, cfg, mapbrush_s::contents, CONTENTS_AREAPORTAL, CONTENTS_CLUSTERPORTAL, CONTENTS_DONOTENTER, CONTENTS_JUMPPAD, CONTENTS_LADDER, CONTENTS_LAVA, CONTENTS_MOVER, CONTENTS_SLIME, CONTENTS_SOLID, CONTENTS_TELEPORTER, CONTENTS_WATER, CONTENTS_WINDOW, entities, mapbrush_s::expansionbbox, FreeBrushWindings(), i, mapbrush_s::leafnum, mapbrush_t, mapent, aas_bbox_s::maxs, aas_bbox_s::mins, cfg_s::numbboxes, entity_t::numbrushes, nummapbrushes, nummapbrushsides, mapbrush_s::numsides, and aas_bbox_s::presencetype.

Referenced by AAS_CreateCurveBrushes(), HL_BSPBrushToMapBrush(), Q1_BSPBrushToMapBrush(), Q2_BSPBrushToMapBrush(), Q2_ParseBrush(), Q3_BSPBrushToMapBrush(), and Sin_BSPBrushToMapBrush().

00723 {
00724     int i;
00725     //side_t *s;
00726     mapbrush_t *bboxbrushes[16];
00727 
00728     //if the brushes are not from an entity used for AAS
00729     if (!AAS_ValidEntity(mapent))
00730     {
00731         nummapbrushsides -= brush->numsides;
00732         brush->numsides = 0;
00733         return;
00734     } //end if
00735     //
00736     AAS_PositionBrush(mapent, brush);
00737     //from all normal solid brushes only the textured brush sides will
00738     //be used as bsp splitters, so set the right texinfo reference here
00739     AAS_SetTexinfo(brush);
00740     //remove contents detail flag, otherwise player clip contents won't be
00741     //bsped correctly for AAS!
00742     brush->contents &= ~CONTENTS_DETAIL;
00743     //if the brush has contents area portal it should be the only contents
00744     if (brush->contents & (CONTENTS_AREAPORTAL|CONTENTS_CLUSTERPORTAL))
00745     {
00746         brush->contents = CONTENTS_CLUSTERPORTAL;
00747         brush->leafnum = -1;
00748     } //end if
00749     //window and playerclip are used for player clipping, make them solid
00750     if (brush->contents & (CONTENTS_WINDOW | CONTENTS_PLAYERCLIP))
00751     {
00752         //
00753         brush->contents &= ~(CONTENTS_WINDOW | CONTENTS_PLAYERCLIP);
00754         brush->contents |= CONTENTS_SOLID;
00755         brush->leafnum = -1;
00756     } //end if
00757     //
00758     if (brush->contents & CONTENTS_BOTCLIP)
00759     {
00760         brush->contents = CONTENTS_SOLID;
00761         brush->leafnum = -1;
00762     } //end if
00763     //
00764     //Log_Write("brush %d contents = ", brush->brushnum);
00765     //PrintContents(brush->contents);
00766     //Log_Write("\r\n");
00767     //if not one of the following brushes then the brush is NOT used for AAS
00768     if (!(brush->contents & (CONTENTS_SOLID
00769                                     | CONTENTS_LADDER
00770                                     | CONTENTS_CLUSTERPORTAL
00771                                     | CONTENTS_DONOTENTER
00772                                     | CONTENTS_TELEPORTER
00773                                     | CONTENTS_JUMPPAD
00774                                     | CONTENTS_WATER
00775                                     | CONTENTS_LAVA
00776                                     | CONTENTS_SLIME
00777                                     | CONTENTS_MOVER
00778                                     )))
00779     {
00780         nummapbrushsides -= brush->numsides;
00781         brush->numsides = 0;
00782         return;
00783     } //end if
00784     //fix the map brush
00785     //AAS_FixMapBrush(brush);
00786     //if brush bevels should be added (for real map brushes, not bsp map brushes)
00787     if (addbevels)
00788     {
00789         //NOTE: we first have to get the mins and maxs of the brush before
00790         //          creating the brush bevels... the mins and maxs are used to
00791         //          create them. so we call MakeBrushWindings to get the mins
00792         //          and maxs and then after creating the bevels we free the
00793         //          windings because they are created for all sides (including
00794         //          bevels) a little later
00795         AAS_MakeBrushWindings(brush);
00796         AddBrushBevels(brush);
00797         FreeBrushWindings(brush);
00798     } //end if
00799     //NOTE: add the brush to the WORLD entity!!!
00800     mapent = &entities[0];
00801     //there's at least one new brush for now
00802     nummapbrushes++;
00803     mapent->numbrushes++;
00804     //liquid brushes are expanded for the maximum possible bounding box
00805     if (brush->contents & (CONTENTS_WATER
00806                                     | CONTENTS_LAVA
00807                                     | CONTENTS_SLIME 
00808                                     | CONTENTS_TELEPORTER
00809                                     | CONTENTS_JUMPPAD
00810                                     | CONTENTS_DONOTENTER
00811                                     | CONTENTS_MOVER
00812                                     ))
00813     {
00814         brush->expansionbbox = 0;
00815         //NOTE: the first bounding box is the max
00816         //FIXME: use max bounding box created from all bboxes
00817         AAS_ExpandMapBrush(brush, cfg.bboxes[0].mins, cfg.bboxes[0].maxs);
00818         AAS_MakeBrushWindings(brush);
00819     } //end if
00820     //area portal brushes are NOT expanded
00821     else if (brush->contents & CONTENTS_CLUSTERPORTAL)
00822     {
00823         brush->expansionbbox = 0;
00824         //NOTE: the first bounding box is the max
00825         //FIXME: use max bounding box created from all bboxes
00826         AAS_ExpandMapBrush(brush, cfg.bboxes[0].mins, cfg.bboxes[0].maxs);
00827         AAS_MakeBrushWindings(brush);
00828     } //end if
00829     //all solid brushes are expanded for all bounding boxes
00830     else if (brush->contents & (CONTENTS_SOLID
00831                                         | CONTENTS_LADDER
00832                                         ))
00833     {
00834         //brush for the first bounding box
00835         bboxbrushes[0] = brush;
00836         //make a copy for the other bounding boxes
00837         for (i = 1; i < cfg.numbboxes; i++)
00838         {
00839             bboxbrushes[i] = AAS_CopyMapBrush(brush, mapent);
00840         } //end for
00841         //expand every brush for it's bounding box and create windings
00842         for (i = 0; i < cfg.numbboxes; i++)
00843         {
00844             AAS_ExpandMapBrush(bboxbrushes[i], cfg.bboxes[i].mins, cfg.bboxes[i].maxs);
00845             bboxbrushes[i]->expansionbbox = cfg.bboxes[i].presencetype;
00846             AAS_MakeBrushWindings(bboxbrushes[i]);
00847         } //end for
00848     } //end else
00849 } //end of the function AAS_CreateMapBrushes

Here is the call graph for this function:


Generated on Thu Aug 25 12:46:36 2005 for Quake III Arena by  doxygen 1.3.9.1