Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

Gbspfile.h File Reference

#include <Stdio.h>
#include "BaseType.h"
#include "Vec3d.h"
#include <windows.h>
#include "DCommon.h"
#include "VFile.h"
#include "Motion.h"

Go to the source code of this file.

Compounds

struct  GBSP_BSPData
struct  GBSP_Chunk
struct  GBSP_ChunkData
struct  GBSP_Header
struct  GFX_Area
struct  GFX_AreaPortal
struct  GFX_BNode
struct  GFX_Cluster
struct  GFX_Face
struct  GFX_Leaf
struct  GFX_LeafSide
struct  GFX_Model
struct  GFX_Node
struct  GFX_Plane
struct  GFX_Portal
struct  GFX_SkyData
struct  GFX_TexInfo
struct  GFX_Texture

Defines

#define GBSP_VERSION   15
#define GBSP_CHUNK_HEADER   0
#define GBSP_CHUNK_MODELS   1
#define GBSP_CHUNK_NODES   2
#define GBSP_CHUNK_BNODES   3
#define GBSP_CHUNK_LEAFS   4
#define GBSP_CHUNK_CLUSTERS   5
#define GBSP_CHUNK_AREAS   6
#define GBSP_CHUNK_AREA_PORTALS   7
#define GBSP_CHUNK_LEAF_SIDES   8
#define GBSP_CHUNK_PORTALS   9
#define GBSP_CHUNK_PLANES   10
#define GBSP_CHUNK_FACES   11
#define GBSP_CHUNK_LEAF_FACES   12
#define GBSP_CHUNK_VERT_INDEX   13
#define GBSP_CHUNK_VERTS   14
#define GBSP_CHUNK_RGB_VERTS   15
#define GBSP_CHUNK_ENTDATA   16
#define GBSP_CHUNK_TEXINFO   17
#define GBSP_CHUNK_TEXTURES   18
#define GBSP_CHUNK_TEXDATA   19
#define GBSP_CHUNK_LIGHTDATA   20
#define GBSP_CHUNK_VISDATA   21
#define GBSP_CHUNK_SKYDATA   22
#define GBSP_CHUNK_PALETTES   23
#define GBSP_CHUNK_MOTIONS   24
#define GBSP_CHUNK_END   0xffff
#define GE_CONTENTS_SOLID   (1<<0)
#define GE_CONTENTS_WINDOW   (1<<1)
#define GE_CONTENTS_EMPTY   (1<<2)
#define GE_CONTENTS_TRANSLUCENT   (1<<3)
#define GE_CONTENTS_WAVY   (1<<4)
#define GE_CONTENTS_DETAIL   (1<<5)
#define GE_CONTENTS_CLIP   (1<<6)
#define GE_CONTENTS_HINT   (1<<7)
#define GE_CONTENTS_AREA   (1<<8)
#define GE_CONTENTS_FLOCKING   (1<<9)
#define GE_CONTENTS_SHEET   (1<<10)
#define GE_RESERVED3   (1<<11)
#define GE_RESERVED4   (1<<12)
#define GE_RESERVED5   (1<<13)
#define GE_RESERVED6   (1<<14)
#define GE_RESERVED7   (1<<15)
#define GE_CONTENTS_USER1   (1<<16)
#define GE_CONTENTS_USER2   (1<<17)
#define GE_CONTENTS_USER3   (1<<18)
#define GE_CONTENTS_USER4   (1<<19)
#define GE_CONTENTS_USER5   (1<<20)
#define GE_CONTENTS_USER6   (1<<21)
#define GE_CONTENTS_USER7   (1<<22)
#define GE_CONTENTS_USER8   (1<<23)
#define GE_CONTENTS_USER9   (1<<24)
#define GE_CONTENTS_USER10   (1<<25)
#define GE_CONTENTS_USER11   (1<<26)
#define GE_CONTENTS_USER12   (1<<27)
#define GE_CONTENTS_USER13   (1<<28)
#define GE_CONTENTS_USER14   (1<<29)
#define GE_CONTENTS_USER15   (1<<30)
#define GE_CONTENTS_USER16   (1<<31)
#define GE_CONTENTS_SOLID_CLIP   (GE_CONTENTS_SOLID | GE_CONTENTS_WINDOW | GE_CONTENTS_CLIP)
#define GE_CONTENTS_CANNOT_OCCUPY   GE_CONTENTS_SOLID_CLIP
#define GE_VISIBLE_CONTENTS
#define BSP_CONTENTS_SOLID   -1
#define BSP_CONTENTS_EMPTY   -2
#define PLANE_X   0
#define PLANE_Y   1
#define PLANE_Z   2
#define PLANE_ANYX   3
#define PLANE_ANYY   4
#define PLANE_ANYZ   5
#define PLANE_ANY   6

Functions

geBoolean GBSP_LoadGBSPFile (geVFile *File, GBSP_BSPData *BSP)
geBoolean GBSP_FreeGBSPFile (GBSP_BSPData *BSP)


Define Documentation

#define BSP_CONTENTS_EMPTY   -2
 

Definition at line 130 of file Gbspfile.h.

Referenced by Trace_InverseTreeFromBox().

#define BSP_CONTENTS_SOLID   -1
 

Definition at line 129 of file Gbspfile.h.

Referenced by BSPIntersectMisc(), BSPIntersectMisc2(), and Trace_InverseTreeFromBox().

#define GBSP_CHUNK_AREA_PORTALS   7
 

Definition at line 48 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_AREAS   6
 

Definition at line 47 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_BNODES   3
 

Definition at line 44 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_CLUSTERS   5
 

Definition at line 46 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_END   0xffff
 

Definition at line 69 of file Gbspfile.h.

Referenced by GBSP_LoadGBSPFile(), and ReadChunk().

#define GBSP_CHUNK_ENTDATA   16
 

Definition at line 57 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_FACES   11
 

Definition at line 52 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_HEADER   0
 

Definition at line 40 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_LEAF_FACES   12
 

Definition at line 53 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_LEAF_SIDES   8
 

Definition at line 49 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_LEAFS   4
 

Definition at line 45 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_LIGHTDATA   20
 

Definition at line 63 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_MODELS   1
 

Definition at line 42 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_MOTIONS   24
 

Definition at line 67 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_NODES   2
 

Definition at line 43 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_PALETTES   23
 

Definition at line 66 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_PLANES   10
 

Definition at line 51 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_PORTALS   9
 

Definition at line 50 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_RGB_VERTS   15
 

Definition at line 56 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_SKYDATA   22
 

Definition at line 65 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_TEXDATA   19
 

Definition at line 61 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_TEXINFO   17
 

Definition at line 59 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_TEXTURES   18
 

Definition at line 60 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_VERT_INDEX   13
 

Definition at line 54 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_VERTS   14
 

Definition at line 55 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_CHUNK_VISDATA   21
 

Definition at line 64 of file Gbspfile.h.

Referenced by ReadChunk().

#define GBSP_VERSION   15
 

Definition at line 38 of file Gbspfile.h.

Referenced by ReadChunk().

#define GE_CONTENTS_AREA   (1<<8)
 

Definition at line 87 of file Gbspfile.h.

#define GE_CONTENTS_CANNOT_OCCUPY   GE_CONTENTS_SOLID_CLIP
 

Definition at line 119 of file Gbspfile.h.

#define GE_CONTENTS_CLIP   (1<<6)
 

Definition at line 85 of file Gbspfile.h.

#define GE_CONTENTS_DETAIL   (1<<5)
 

Definition at line 83 of file Gbspfile.h.

#define GE_CONTENTS_EMPTY   (1<<2)
 

Definition at line 79 of file Gbspfile.h.

#define GE_CONTENTS_FLOCKING   (1<<9)
 

Definition at line 89 of file Gbspfile.h.

#define GE_CONTENTS_HINT   (1<<7)
 

Definition at line 86 of file Gbspfile.h.

#define GE_CONTENTS_SHEET   (1<<10)
 

Definition at line 90 of file Gbspfile.h.

#define GE_CONTENTS_SOLID   (1<<0)
 

Definition at line 77 of file Gbspfile.h.

#define GE_CONTENTS_SOLID_CLIP   (GE_CONTENTS_SOLID | GE_CONTENTS_WINDOW | GE_CONTENTS_CLIP)
 

Definition at line 118 of file Gbspfile.h.

#define GE_CONTENTS_TRANSLUCENT   (1<<3)
 

Definition at line 81 of file Gbspfile.h.

#define GE_CONTENTS_USER1   (1<<16)
 

Definition at line 98 of file Gbspfile.h.

#define GE_CONTENTS_USER10   (1<<25)
 

Definition at line 107 of file Gbspfile.h.

#define GE_CONTENTS_USER11   (1<<26)
 

Definition at line 108 of file Gbspfile.h.

#define GE_CONTENTS_USER12   (1<<27)
 

Definition at line 109 of file Gbspfile.h.

#define GE_CONTENTS_USER13   (1<<28)
 

Definition at line 110 of file Gbspfile.h.

#define GE_CONTENTS_USER14   (1<<29)
 

Definition at line 111 of file Gbspfile.h.

#define GE_CONTENTS_USER15   (1<<30)
 

Definition at line 112 of file Gbspfile.h.

#define GE_CONTENTS_USER16   (1<<31)
 

Definition at line 113 of file Gbspfile.h.

#define GE_CONTENTS_USER2   (1<<17)
 

Definition at line 99 of file Gbspfile.h.

#define GE_CONTENTS_USER3   (1<<18)
 

Definition at line 100 of file Gbspfile.h.

#define GE_CONTENTS_USER4   (1<<19)
 

Definition at line 101 of file Gbspfile.h.

#define GE_CONTENTS_USER5   (1<<20)
 

Definition at line 102 of file Gbspfile.h.

#define GE_CONTENTS_USER6   (1<<21)
 

Definition at line 103 of file Gbspfile.h.

#define GE_CONTENTS_USER7   (1<<22)
 

Definition at line 104 of file Gbspfile.h.

#define GE_CONTENTS_USER8   (1<<23)
 

Definition at line 105 of file Gbspfile.h.

#define GE_CONTENTS_USER9   (1<<24)
 

Definition at line 106 of file Gbspfile.h.

#define GE_CONTENTS_WAVY   (1<<4)
 

Definition at line 82 of file Gbspfile.h.

#define GE_CONTENTS_WINDOW   (1<<1)
 

Definition at line 78 of file Gbspfile.h.

#define GE_RESERVED3   (1<<11)
 

Definition at line 91 of file Gbspfile.h.

#define GE_RESERVED4   (1<<12)
 

Definition at line 92 of file Gbspfile.h.

#define GE_RESERVED5   (1<<13)
 

Definition at line 93 of file Gbspfile.h.

#define GE_RESERVED6   (1<<14)
 

Definition at line 94 of file Gbspfile.h.

#define GE_RESERVED7   (1<<15)
 

Definition at line 95 of file Gbspfile.h.

#define GE_VISIBLE_CONTENTS
 

Value:

Definition at line 122 of file Gbspfile.h.

#define PLANE_ANY   6
 

Definition at line 138 of file Gbspfile.h.

Referenced by BSPIntersectMisc(), BSPIntersectMisc2(), Frustum_SetFromCamera(), Frustum_SetFromPoly(), gePlane_SetFromVerts(), gePuppet_RenderThroughFrustum(), IntersectLeafSides_r(), PointInLeafSides(), Trace_ActorCollide(), Trace_InverseTreeFromBox(), and Trace_WorldCollisionExact().

#define PLANE_ANYX   3
 

Definition at line 135 of file Gbspfile.h.

Referenced by Trace_BoxOnPlaneSide().

#define PLANE_ANYY   4
 

Definition at line 136 of file Gbspfile.h.

#define PLANE_ANYZ   5
 

Definition at line 137 of file Gbspfile.h.

#define PLANE_X   0
 

Definition at line 132 of file Gbspfile.h.

Referenced by Plane_FaceDistanceFast(), and Plane_PlaneDistanceFast().

#define PLANE_Y   1
 

Definition at line 133 of file Gbspfile.h.

Referenced by Plane_FaceDistanceFast(), and Plane_PlaneDistanceFast().

#define PLANE_Z   2
 

Definition at line 134 of file Gbspfile.h.

Referenced by Plane_FaceDistanceFast(), and Plane_PlaneDistanceFast().


Function Documentation

geBoolean GBSP_FreeGBSPFile GBSP_BSPData BSP  ) 
 

Definition at line 512 of file Gbspfile.c.

References geMotion_Destroy(), geRam_Free, GBSP_BSPData::GFXAreaPortals, GBSP_BSPData::GFXAreas, GBSP_BSPData::GFXBNodes, GBSP_BSPData::GFXClusters, GBSP_BSPData::GFXEntData, GBSP_BSPData::GFXFaces, GBSP_BSPData::GFXLeafFaces, GBSP_BSPData::GFXLeafs, GBSP_BSPData::GFXLeafSides, GBSP_BSPData::GFXLightData, GBSP_BSPData::GFXModels, GBSP_BSPData::GFXNodes, GBSP_BSPData::GFXPalettes, GBSP_BSPData::GFXPlanes, GBSP_BSPData::GFXPortals, GBSP_BSPData::GFXRGBVerts, GBSP_BSPData::GFXTexData, GBSP_BSPData::GFXTexInfo, GBSP_BSPData::GFXTextures, GBSP_BSPData::GFXVertIndexList, GBSP_BSPData::GFXVerts, GBSP_BSPData::GFXVisData, GFX_Model::Motion, NULL, GBSP_BSPData::NumGFXAreaPortals, GBSP_BSPData::NumGFXAreas, GBSP_BSPData::NumGFXBNodes, GBSP_BSPData::NumGFXClusters, GBSP_BSPData::NumGFXEntData, GBSP_BSPData::NumGFXFaces, GBSP_BSPData::NumGFXLeafFaces, GBSP_BSPData::NumGFXLeafs, GBSP_BSPData::NumGFXLeafSides, GBSP_BSPData::NumGFXLightData, GBSP_BSPData::NumGFXModels, GBSP_BSPData::NumGFXNodes, GBSP_BSPData::NumGFXPlanes, GBSP_BSPData::NumGFXPortals, GBSP_BSPData::NumGFXRGBVerts, GBSP_BSPData::NumGFXTexData, GBSP_BSPData::NumGFXTexInfo, GBSP_BSPData::NumGFXTextures, GBSP_BSPData::NumGFXVertIndexList, GBSP_BSPData::NumGFXVerts, GBSP_BSPData::NumGFXVisData, and TRUE.

Referenced by geWorld_Free().

00513 {
00514         if (BSP->GFXModels)
00515         {
00516                 int i;
00517                 for     (i = 0; i < BSP->NumGFXModels; i++)
00518                         if (BSP->GFXModels[i].Motion != NULL)
00519                                 geMotion_Destroy(&(BSP->GFXModels[i].Motion));
00520                 geRam_Free(BSP->GFXModels);
00521         }
00522 
00523         if (BSP->GFXNodes)
00524                 geRam_Free(BSP->GFXNodes);
00525         if (BSP->GFXBNodes)
00526                 geRam_Free(BSP->GFXBNodes);
00527         if (BSP->GFXLeafs)
00528                 geRam_Free(BSP->GFXLeafs);
00529         if (BSP->GFXClusters)
00530                 geRam_Free(BSP->GFXClusters);
00531         if (BSP->GFXAreas)
00532                 geRam_Free(BSP->GFXAreas);
00533         if (BSP->GFXAreaPortals)
00534                 geRam_Free(BSP->GFXAreaPortals);
00535         if (BSP->GFXPortals)
00536                 geRam_Free(BSP->GFXPortals);
00537         if (BSP->GFXPlanes)
00538                 geRam_Free(BSP->GFXPlanes);
00539         if (BSP->GFXFaces)
00540                 geRam_Free(BSP->GFXFaces);
00541         if (BSP->GFXLeafFaces)
00542                 geRam_Free(BSP->GFXLeafFaces);
00543         if (BSP->GFXLeafSides)
00544                 geRam_Free(BSP->GFXLeafSides);
00545         if (BSP->GFXVerts)
00546                 geRam_Free(BSP->GFXVerts);
00547         if (BSP->GFXVertIndexList)
00548                 geRam_Free(BSP->GFXVertIndexList);
00549         if (BSP->GFXRGBVerts)
00550                 geRam_Free(BSP->GFXRGBVerts);
00551         if (BSP->GFXTextures)
00552                 geRam_Free(BSP->GFXTextures);
00553         if (BSP->GFXTexInfo)
00554                 geRam_Free(BSP->GFXTexInfo);
00555         if (BSP->GFXTexData)
00556                 geRam_Free(BSP->GFXTexData);
00557         if (BSP->GFXPalettes)
00558                 geRam_Free(BSP->GFXPalettes);
00559         if (BSP->GFXEntData)
00560                 geRam_Free(BSP->GFXEntData);
00561         if (BSP->GFXLightData)
00562                 geRam_Free(BSP->GFXLightData);
00563         if (BSP->GFXVisData)
00564                 geRam_Free(BSP->GFXVisData);
00565 
00566         BSP->GFXModels = NULL;
00567         BSP->GFXNodes = NULL;
00568         BSP->GFXBNodes = NULL;
00569         BSP->GFXLeafs = NULL;
00570         BSP->GFXClusters = NULL;
00571         BSP->GFXAreas = NULL;
00572         BSP->GFXAreaPortals = NULL;
00573         BSP->GFXPlanes = NULL;
00574         BSP->GFXFaces = NULL;
00575         BSP->GFXLeafFaces = NULL;
00576         BSP->GFXLeafSides = NULL;
00577         BSP->GFXVerts = NULL;
00578         BSP->GFXVertIndexList = NULL;
00579         BSP->GFXRGBVerts = NULL;
00580         BSP->GFXEntData = NULL;
00581         
00582         BSP->GFXTextures = NULL;
00583         BSP->GFXTexInfo = NULL;
00584         BSP->GFXTexData = NULL;
00585         BSP->GFXPalettes = NULL;
00586 
00587         BSP->GFXLightData = NULL;
00588         BSP->GFXVisData = NULL;
00589         BSP->GFXPortals = NULL;
00590 
00591         BSP->NumGFXModels = 0;
00592         BSP->NumGFXNodes = 0;
00593         BSP->NumGFXBNodes = 0;
00594         BSP->NumGFXLeafs = 0;
00595         BSP->NumGFXClusters = 0;
00596         BSP->NumGFXAreas = 0;
00597         BSP->NumGFXAreaPortals = 0;
00598         BSP->NumGFXPlanes = 0;
00599         BSP->NumGFXFaces = 0;
00600         BSP->NumGFXLeafFaces = 0;
00601         BSP->NumGFXLeafSides = 0;
00602         BSP->NumGFXVerts = 0;
00603         BSP->NumGFXVertIndexList = 0;
00604         BSP->NumGFXRGBVerts = 0;
00605 
00606         BSP->NumGFXEntData = 0;
00607         BSP->NumGFXTexInfo = 0;
00608         BSP->NumGFXTextures = 0;
00609         BSP->NumGFXTexData = 0;
00610 
00611         BSP->NumGFXLightData = 0;
00612         BSP->NumGFXVisData = 0;
00613         BSP->NumGFXPortals = 0;
00614 
00615         return TRUE;
00616 }

geBoolean GBSP_LoadGBSPFile geVFile File,
GBSP_BSPData BSP
 

Definition at line 487 of file Gbspfile.c.

References GBSP_CHUNK_END, GE_ERR_ERROR_READING_BSP_CHUNK, GE_FALSE, geErrorLog_Add, NULL, ReadChunk(), TRUE, and GBSP_Chunk::Type.

Referenced by CreateGBSP().

00488 {
00489         GBSP_Chunk      Chunk;
00490 
00491         assert(File);
00492         assert(BSP);
00493 
00494         while (1)
00495         {
00496                 if (!ReadChunk(BSP, &Chunk, File))
00497                 {
00498                         geErrorLog_Add(GE_ERR_ERROR_READING_BSP_CHUNK, NULL);
00499                         return GE_FALSE;
00500                 }
00501                 
00502                 if (Chunk.Type == GBSP_CHUNK_END)
00503                         break;
00504         }
00505 
00506         return TRUE;
00507 }


Generated on Tue Sep 30 12:37:34 2003 for GTestAndEngine by doxygen 1.3.2