This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
|
|
Definition at line 151 of file l_bsp_q2.c. References allocatedbspmem, byte, dareaportals, dareas, dbrushes, dbrushsides, dedges, dentdata, dfaces, dleafbrushes, dleaffaces, dleafs, dlightdata, dmodels, dnodes, dplanes, dsurfedges, dvertexes, dvis, dvisdata, entdatasize, GetClearedMemory(), lightdatasize, Log_Print(), MAX_MAP_AREAPORTALS, MAX_MAP_AREAS, MAX_MAP_BRUSHES, MAX_MAP_BRUSHSIDES, MAX_MAP_EDGES, MAX_MAP_ENTSTRING, MAX_MAP_FACES, MAX_MAP_LEAFBRUSHES, MAX_MAP_LEAFFACES, MAX_MAP_LEAFS, MAX_MAP_LIGHTING, MAX_MAP_MODELS, MAX_MAP_NODES, MAX_MAP_PLANES, MAX_MAP_SURFEDGES, MAX_MAP_VERTS, MAX_MAP_VISIBILITY, numareaportals, numareas, numbrushes, numbrushsides, numedges, numfaces, numleafbrushes, numleaffaces, numleafs, nummodels, numnodes, numplanes, numsurfedges, numvertexes, PrintMemorySize(), and visdatasize. Referenced by LoadMapFromBSP(). 00152 {
00153 //models
00154 nummodels = 0;
00155 dmodels = (dmodel_t *) GetClearedMemory(MAX_MAP_MODELS * sizeof(dmodel_t));
00156 allocatedbspmem += MAX_MAP_MODELS * sizeof(dmodel_t);
00157 //vis data
00158 visdatasize = 0;
00159 dvisdata = (byte *) GetClearedMemory(MAX_MAP_VISIBILITY * sizeof(byte));
00160 dvis = (dvis_t *) dvisdata;
00161 allocatedbspmem += MAX_MAP_VISIBILITY * sizeof(byte);
00162 //light data
00163 lightdatasize = 0;
00164 dlightdata = (byte *) GetClearedMemory(MAX_MAP_LIGHTING * sizeof(byte));
00165 allocatedbspmem += MAX_MAP_LIGHTING * sizeof(byte);
00166 //entity data
00167 entdatasize = 0;
00168 dentdata = (char *) GetClearedMemory(MAX_MAP_ENTSTRING * sizeof(char));
00169 allocatedbspmem += MAX_MAP_ENTSTRING * sizeof(char);
00170 //leafs
00171 numleafs = 0;
00172 dleafs = (dleaf_t *) GetClearedMemory(MAX_MAP_LEAFS * sizeof(dleaf_t));
00173 allocatedbspmem += MAX_MAP_LEAFS * sizeof(dleaf_t);
00174 //planes
00175 numplanes = 0;
00176 dplanes = (dplane_t *) GetClearedMemory(MAX_MAP_PLANES * sizeof(dplane_t));
00177 allocatedbspmem += MAX_MAP_PLANES * sizeof(dplane_t);
00178 //vertexes
00179 numvertexes = 0;
00180 dvertexes = (dvertex_t *) GetClearedMemory(MAX_MAP_VERTS * sizeof(dvertex_t));
00181 allocatedbspmem += MAX_MAP_VERTS * sizeof(dvertex_t);
00182 //nodes
00183 numnodes = 0;
00184 dnodes = (dnode_t *) GetClearedMemory(MAX_MAP_NODES * sizeof(dnode_t));
00185 allocatedbspmem += MAX_MAP_NODES * sizeof(dnode_t);
00186 /*
00187 //texture info
00188 numtexinfo = 0;
00189 texinfo = (texinfo_t *) GetClearedMemory(MAX_MAP_TEXINFO * sizeof(texinfo_t));
00190 allocatedbspmem += MAX_MAP_TEXINFO * sizeof(texinfo_t);
00191 //*/
00192 //faces
00193 numfaces = 0;
00194 dfaces = (dface_t *) GetClearedMemory(MAX_MAP_FACES * sizeof(dface_t));
00195 allocatedbspmem += MAX_MAP_FACES * sizeof(dface_t);
00196 //edges
00197 numedges = 0;
00198 dedges = (dedge_t *) GetClearedMemory(MAX_MAP_EDGES * sizeof(dedge_t));
00199 allocatedbspmem += MAX_MAP_EDGES * sizeof(dedge_t);
00200 //leaf faces
00201 numleaffaces = 0;
00202 dleaffaces = (unsigned short *) GetClearedMemory(MAX_MAP_LEAFFACES * sizeof(unsigned short));
00203 allocatedbspmem += MAX_MAP_LEAFFACES * sizeof(unsigned short);
00204 //leaf brushes
00205 numleafbrushes = 0;
00206 dleafbrushes = (unsigned short *) GetClearedMemory(MAX_MAP_LEAFBRUSHES * sizeof(unsigned short));
00207 allocatedbspmem += MAX_MAP_LEAFBRUSHES * sizeof(unsigned short);
00208 //surface edges
00209 numsurfedges = 0;
00210 dsurfedges = (int *) GetClearedMemory(MAX_MAP_SURFEDGES * sizeof(int));
00211 allocatedbspmem += MAX_MAP_SURFEDGES * sizeof(int);
00212 //brushes
00213 numbrushes = 0;
00214 dbrushes = (dbrush_t *) GetClearedMemory(MAX_MAP_BRUSHES * sizeof(dbrush_t));
00215 allocatedbspmem += MAX_MAP_BRUSHES * sizeof(dbrush_t);
00216 //brushsides
00217 numbrushsides = 0;
00218 dbrushsides = (dbrushside_t *) GetClearedMemory(MAX_MAP_BRUSHSIDES * sizeof(dbrushside_t));
00219 allocatedbspmem += MAX_MAP_BRUSHSIDES * sizeof(dbrushside_t);
00220 //areas
00221 numareas = 0;
00222 dareas = (darea_t *) GetClearedMemory(MAX_MAP_AREAS * sizeof(darea_t));
00223 allocatedbspmem += MAX_MAP_AREAS * sizeof(darea_t);
00224 //area portals
00225 numareaportals = 0;
00226 dareaportals = (dareaportal_t *) GetClearedMemory(MAX_MAP_AREAPORTALS * sizeof(dareaportal_t));
00227 allocatedbspmem += MAX_MAP_AREAPORTALS * sizeof(dareaportal_t);
00228 //print allocated memory
00229 Log_Print("allocated ");
00230 PrintMemorySize(allocatedbspmem);
00231 Log_Print(" of BSP memory\n");
00232 } //end of the function Q2_AllocMaxBSP
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 568 of file l_bsp_q2.c. References byte, dvis, j, and dvis_t::numclusters. 00569 {
00570 int j;
00571 int rep;
00572 int visrow;
00573 byte *dest_p;
00574
00575 dest_p = dest;
00576 // visrow = (r_numvisleafs + 7)>>3;
00577 visrow = (dvis->numclusters + 7)>>3;
00578
00579 for (j=0 ; j<visrow ; j++)
00580 {
00581 *dest_p++ = vis[j];
00582 if (vis[j])
00583 continue;
00584
00585 rep = 1;
00586 for ( j++; j<visrow ; j++)
00587 if (vis[j] || rep == 255)
00588 break;
00589 else
00590 rep++;
00591 *dest_p++ = rep;
00592 j--;
00593 }
00594
00595 return dest_p - dest;
00596 }
|
|
||||||||||||
|
Definition at line 604 of file l_bsp_q2.c. References byte, c, dvis, Error(), in, and dvis_t::numclusters. 00605 {
00606 int c;
00607 byte *out;
00608 int row;
00609
00610 // row = (r_numvisleafs+7)>>3;
00611 row = (dvis->numclusters+7)>>3;
00612 out = decompressed;
00613
00614 do
00615 {
00616 if (*in)
00617 {
00618 *out++ = *in++;
00619 continue;
00620 }
00621
00622 c = in[1];
00623 if (!c)
00624 Error ("DecompressVis: 0 repeat");
00625 in += 2;
00626 while (c)
00627 {
00628 *out++ = 0;
00629 c--;
00630 }
00631 } while (out - decompressed < row);
00632 }
|
Here is the call graph for this function:

|
|
Definition at line 234 of file l_bsp_q2.c. References allocatedbspmem, dareaportals, dareas, dbrushes, dbrushsides, dedges, dentdata, dfaces, dleafbrushes, dleaffaces, dleafs, dlightdata, dmodels, dnodes, dplanes, dsurfedges, dvertexes, dvis, dvisdata, entdatasize, FreeMemory(), lightdatasize, Log_Print(), numareaportals, numareas, numbrushes, numbrushsides, numedges, numfaces, numleafbrushes, numleaffaces, numleafs, nummodels, numnodes, numplanes, numsurfedges, numvertexes, PrintMemorySize(), and visdatasize. Referenced by LoadMapFromBSP(). 00235 {
00236 //models
00237 nummodels = 0;
00238 FreeMemory(dmodels);
00239 dmodels = NULL;
00240 //vis data
00241 visdatasize = 0;
00242 FreeMemory(dvisdata);
00243 dvisdata = NULL;
00244 dvis = NULL;
00245 //light data
00246 lightdatasize = 0;
00247 FreeMemory(dlightdata);
00248 dlightdata = NULL;
00249 //entity data
00250 entdatasize = 0;
00251 FreeMemory(dentdata);
00252 dentdata = NULL;
00253 //leafs
00254 numleafs = 0;
00255 FreeMemory(dleafs);
00256 dleafs = NULL;
00257 //planes
00258 numplanes = 0;
00259 FreeMemory(dplanes);
00260 dplanes = NULL;
00261 //vertexes
00262 numvertexes = 0;
00263 FreeMemory(dvertexes);
00264 dvertexes = NULL;
00265 //nodes
00266 numnodes = 0;
00267 FreeMemory(dnodes);
00268 dnodes = NULL;
00269 /*
00270 //texture info
00271 numtexinfo = 0;
00272 FreeMemory(texinfo);
00273 texinfo = NULL;
00274 //*/
00275 //faces
00276 numfaces = 0;
00277 FreeMemory(dfaces);
00278 dfaces = NULL;
00279 //edges
00280 numedges = 0;
00281 FreeMemory(dedges);
00282 dedges = NULL;
00283 //leaf faces
00284 numleaffaces = 0;
00285 FreeMemory(dleaffaces);
00286 dleaffaces = NULL;
00287 //leaf brushes
00288 numleafbrushes = 0;
00289 FreeMemory(dleafbrushes);
00290 dleafbrushes = NULL;
00291 //surface edges
00292 numsurfedges = 0;
00293 FreeMemory(dsurfedges);
00294 dsurfedges = NULL;
00295 //brushes
00296 numbrushes = 0;
00297 FreeMemory(dbrushes);
00298 dbrushes = NULL;
00299 //brushsides
00300 numbrushsides = 0;
00301 FreeMemory(dbrushsides);
00302 dbrushsides = NULL;
00303 //areas
00304 numareas = 0;
00305 FreeMemory(dareas);
00306 dareas = NULL;
00307 //area portals
00308 numareaportals = 0;
00309 FreeMemory(dareaportals);
00310 dareaportals = NULL;
00311 //
00312 Log_Print("freed ");
00313 PrintMemorySize(allocatedbspmem);
00314 Log_Print(" of BSP memory\n");
00315 allocatedbspmem = 0;
00316 } //end of the function Q2_FreeMaxBSP
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 853 of file l_bsp_q2.c. References BSPVERSION, dareaportals, dareas, dbrushes, dbrushsides, dedges, dentdata, dfaces, dleafbrushes, dleaffaces, dleafs, dlightdata, dmodels, dnodes, dplanes, dpop, dsurfedges, dvertexes, dvisdata, entdatasize, Error(), FreeMemory(), header, i, dheader_t::ident, length(), lightdatasize, LittleLong(), LoadFile(), LUMP_AREAPORTALS, LUMP_AREAS, LUMP_BRUSHES, LUMP_BRUSHSIDES, LUMP_EDGES, LUMP_ENTITIES, LUMP_FACES, LUMP_LEAFBRUSHES, LUMP_LEAFFACES, LUMP_LEAFS, LUMP_LIGHTING, LUMP_MODELS, LUMP_NODES, LUMP_PLANES, LUMP_POP, LUMP_SURFEDGES, LUMP_TEXINFO, LUMP_VERTEXES, LUMP_VISIBILITY, MAX_MAP_AREAPORTALS, MAX_MAP_AREAS, MAX_MAP_BRUSHES, MAX_MAP_BRUSHSIDES, MAX_MAP_DPOP, MAX_MAP_EDGES, MAX_MAP_ENTSTRING, MAX_MAP_FACES, MAX_MAP_LEAFBRUSHES, MAX_MAP_LEAFFACES, MAX_MAP_LEAFS, MAX_MAP_LIGHTING, MAX_MAP_MODELS, MAX_MAP_NODES, MAX_MAP_PLANES, MAX_MAP_SURFEDGES, MAX_MAP_TEXINFO, MAX_MAP_VERTS, MAX_MAP_VISIBILITY, numareaportals, numareas, numbrushes, numbrushsides, numedges, numfaces, numleafbrushes, numleaffaces, numleafs, nummodels, numnodes, numplanes, numsurfedges, numtexinfo, numvertexes, offset, Q2_CopyLump(), Q2_FixTextureReferences(), Q2_SwapBSPFile(), texinfo, texinfo_t, dheader_t::version, and visdatasize. Referenced by Q2_LoadMapFromBSP(). 00854 {
00855 int i;
00856
00857 //
00858 // load the file header
00859 //
00860 LoadFile (filename, (void **)&header, offset, length);
00861
00862 // swap the header
00863 for (i=0 ; i< sizeof(dheader_t)/4 ; i++)
00864 ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
00865
00866 if (header->ident != IDBSPHEADER)
00867 Error ("%s is not a IBSP file", filename);
00868 if (header->version != BSPVERSION)
00869 Error ("%s is version %i, not %i", filename, header->version, BSPVERSION);
00870
00871 nummodels = Q2_CopyLump (LUMP_MODELS, dmodels, sizeof(dmodel_t), MAX_MAP_MODELS);
00872 numvertexes = Q2_CopyLump (LUMP_VERTEXES, dvertexes, sizeof(dvertex_t), MAX_MAP_VERTS);
00873 numplanes = Q2_CopyLump (LUMP_PLANES, dplanes, sizeof(dplane_t), MAX_MAP_PLANES);
00874 numleafs = Q2_CopyLump (LUMP_LEAFS, dleafs, sizeof(dleaf_t), MAX_MAP_LEAFS);
00875 numnodes = Q2_CopyLump (LUMP_NODES, dnodes, sizeof(dnode_t), MAX_MAP_NODES);
00876 numtexinfo = Q2_CopyLump (LUMP_TEXINFO, texinfo, sizeof(texinfo_t), MAX_MAP_TEXINFO);
00877 numfaces = Q2_CopyLump (LUMP_FACES, dfaces, sizeof(dface_t), MAX_MAP_FACES);
00878 numleaffaces = Q2_CopyLump (LUMP_LEAFFACES, dleaffaces, sizeof(dleaffaces[0]), MAX_MAP_LEAFFACES);
00879 numleafbrushes = Q2_CopyLump (LUMP_LEAFBRUSHES, dleafbrushes, sizeof(dleafbrushes[0]), MAX_MAP_LEAFBRUSHES);
00880 numsurfedges = Q2_CopyLump (LUMP_SURFEDGES, dsurfedges, sizeof(dsurfedges[0]), MAX_MAP_SURFEDGES);
00881 numedges = Q2_CopyLump (LUMP_EDGES, dedges, sizeof(dedge_t), MAX_MAP_EDGES);
00882 numbrushes = Q2_CopyLump (LUMP_BRUSHES, dbrushes, sizeof(dbrush_t), MAX_MAP_BRUSHES);
00883 numbrushsides = Q2_CopyLump (LUMP_BRUSHSIDES, dbrushsides, sizeof(dbrushside_t), MAX_MAP_BRUSHSIDES);
00884 numareas = Q2_CopyLump (LUMP_AREAS, dareas, sizeof(darea_t), MAX_MAP_AREAS);
00885 numareaportals = Q2_CopyLump (LUMP_AREAPORTALS, dareaportals, sizeof(dareaportal_t), MAX_MAP_AREAPORTALS);
00886
00887 visdatasize = Q2_CopyLump (LUMP_VISIBILITY, dvisdata, 1, MAX_MAP_VISIBILITY);
00888 lightdatasize = Q2_CopyLump (LUMP_LIGHTING, dlightdata, 1, MAX_MAP_LIGHTING);
00889 entdatasize = Q2_CopyLump (LUMP_ENTITIES, dentdata, 1, MAX_MAP_ENTSTRING);
00890
00891 Q2_CopyLump (LUMP_POP, dpop, 1, MAX_MAP_DPOP);
00892
00893 FreeMemory(header); // everything has been copied out
00894
00895 //
00896 // swap everything
00897 //
00898 Q2_SwapBSPFile (false);
00899
00900 Q2_FixTextureReferences();
00901 } //end of the function Q2_LoadBSPFile
|
Here is the call graph for this function:

|
|
Definition at line 911 of file l_bsp_q2.c. References BSPVERSION, Error(), f, fclose(), lump_t::filelen, lump_t::fileofs, fopen(), fread(), FreeMemory(), fseek(), GetMemory(), header, i, dheader_t::ident, length(), LittleLong(), dheader_t::lumps, numtexinfo, Q2_SwapBSPFile(), SEEK_SET, texinfo, texinfo_t, and dheader_t::version. 00912 {
00913 int i;
00914 FILE *f;
00915 int length, ofs;
00916
00917 header = GetMemory(sizeof(dheader_t));
00918
00919 f = fopen (filename, "rb");
00920 fread (header, sizeof(dheader_t), 1, f);
00921
00922 // swap the header
00923 for (i=0 ; i< sizeof(dheader_t)/4 ; i++)
00924 ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
00925
00926 if (header->ident != IDBSPHEADER)
00927 Error ("%s is not a IBSP file", filename);
00928 if (header->version != BSPVERSION)
00929 Error ("%s is version %i, not %i", filename, header->version, BSPVERSION);
00930
00931
00932 length = header->lumps[LUMP_TEXINFO].filelen;
00933 ofs = header->lumps[LUMP_TEXINFO].fileofs;
00934
00935 fseek (f, ofs, SEEK_SET);
00936 fread (texinfo, length, 1, f);
00937 fclose (f);
00938
00939 numtexinfo = length / sizeof(texinfo_t);
00940
00941 FreeMemory(header); // everything has been copied out
00942
00943 Q2_SwapBSPFile (false);
00944 } //end of the function Q2_LoadBSPFileTexinfo
|
Here is the call graph for this function:

|
|
Definition at line 1070 of file l_bsp_q2.c. References dentdata, entdatasize, FreeScript(), LoadScriptMemory(), num_entities, ParseEntity(), SCFL_NOSTRINGESCAPECHARS, SCFL_NOSTRINGWHITESPACES, script, and SetScriptFlags(). Referenced by Q2_LoadMapFromBSP(), and Q2_PrintBSPFileSizes(). 01071 {
01072 script_t *script;
01073
01074 num_entities = 0;
01075 script = LoadScriptMemory(dentdata, entdatasize, "*Quake2 bsp file");
01076 SetScriptFlags(script, SCFL_NOSTRINGWHITESPACES |
01077 SCFL_NOSTRINGESCAPECHARS);
01078
01079 while(ParseEntity(script))
01080 {
01081 } //end while
01082
01083 FreeScript(script);
01084 } //end of the function Q2_ParseEntities
|
Here is the call graph for this function:

|
|
Definition at line 1018 of file l_bsp_q2.c. References dleafbrushes, dleaffaces, dsurfedges, entdatasize, lightdatasize, num_entities, numareaportals, numareas, numbrushes, numbrushsides, numedges, numfaces, numleafbrushes, numleaffaces, numleafs, nummodels, numnodes, numplanes, numsurfedges, numtexinfo, numvertexes, printf(), Q2_ParseEntities(), texinfo_t, and visdatasize. 01019 {
01020 if (!num_entities)
01021 Q2_ParseEntities();
01022
01023 printf ("%6i models %7i\n"
01024 ,nummodels, (int)(nummodels*sizeof(dmodel_t)));
01025 printf ("%6i brushes %7i\n"
01026 ,numbrushes, (int)(numbrushes*sizeof(dbrush_t)));
01027 printf ("%6i brushsides %7i\n"
01028 ,numbrushsides, (int)(numbrushsides*sizeof(dbrushside_t)));
01029 printf ("%6i planes %7i\n"
01030 ,numplanes, (int)(numplanes*sizeof(dplane_t)));
01031 printf ("%6i texinfo %7i\n"
01032 ,numtexinfo, (int)(numtexinfo*sizeof(texinfo_t)));
01033 printf ("%6i entdata %7i\n", num_entities, entdatasize);
01034
01035 printf ("\n");
01036
01037 printf ("%6i vertexes %7i\n"
01038 ,numvertexes, (int)(numvertexes*sizeof(dvertex_t)));
01039 printf ("%6i nodes %7i\n"
01040 ,numnodes, (int)(numnodes*sizeof(dnode_t)));
01041 printf ("%6i faces %7i\n"
01042 ,numfaces, (int)(numfaces*sizeof(dface_t)));
01043 printf ("%6i leafs %7i\n"
01044 ,numleafs, (int)(numleafs*sizeof(dleaf_t)));
01045 printf ("%6i leaffaces %7i\n"
01046 ,numleaffaces, (int)(numleaffaces*sizeof(dleaffaces[0])));
01047 printf ("%6i leafbrushes %7i\n"
01048 ,numleafbrushes, (int)(numleafbrushes*sizeof(dleafbrushes[0])));
01049 printf ("%6i surfedges %7i\n"
01050 ,numsurfedges, (int)(numsurfedges*sizeof(dsurfedges[0])));
01051 printf ("%6i edges %7i\n"
01052 ,numedges, (int)(numedges*sizeof(dedge_t)));
01053 //NEW
01054 printf ("%6i areas %7i\n"
01055 ,numareas, (int)(numareas*sizeof(darea_t)));
01056 printf ("%6i areaportals %7i\n"
01057 ,numareaportals, (int)(numareaportals*sizeof(dareaportal_t)));
01058 //ENDNEW
01059 printf (" lightdata %7i\n", lightdatasize);
01060 printf (" visdata %7i\n", visdatasize);
01061 } //end of the function Q2_PrintBSPFileSizes
|
Here is the call graph for this function:

|
|
Definition at line 1094 of file l_bsp_q2.c. References entdatasize, entities, epair_t, entity_t::epairs, Error(), i, epair_s::key, line, epair_s::next, sprintf(), strcat(), strcpy(), StripTrailing(), strlen(), epair_s::value, and value. Referenced by EndBSPFile(). 01095 {
01096 char *buf, *end;
01097 epair_t *ep;
01098 char line[2048];
01099 int i;
01100 char key[1024], value[1024];
01101
01102 buf = dentdata;
01103 end = buf;
01104 *end = 0;
01105
01106 for (i=0 ; i<num_entities ; i++)
01107 {
01108 ep = entities[i].epairs;
01109 if (!ep)
01110 continue; // ent got removed
01111
01112 strcat (end,"{\n");
01113 end += 2;
01114
01115 for (ep = entities[i].epairs ; ep ; ep=ep->next)
01116 {
01117 strcpy (key, ep->key);
01118 StripTrailing (key);
01119 strcpy (value, ep->value);
01120 StripTrailing (value);
01121
01122 sprintf (line, "\"%s\" \"%s\"\n", key, value);
01123 strcat (end, line);
01124 end += strlen(line);
01125 }
01126 strcat (end,"}\n");
01127 end += 2;
01128
01129 if (end > buf + MAX_MAP_ENTSTRING)
01130 Error ("Entity text too long");
01131 }
01132 entdatasize = end - buf + 1;
01133 } //end of the function Q2_UnparseEntities
|
Here is the call graph for this function:

|
|
Definition at line 970 of file l_bsp_q2.c. References BSPVERSION, dareaportals, dareas, dbrushes, dbrushsides, dedges, dentdata, dfaces, dleafbrushes, dleaffaces, dleafs, dlightdata, dmodels, dnodes, dplanes, dpop, dsurfedges, dvertexes, dvisdata, entdatasize, fclose(), fseek(), header, IDBSPHEADER, dheader_t::ident, lightdatasize, LittleLong(), LUMP_AREAPORTALS, LUMP_AREAS, LUMP_BRUSHES, LUMP_BRUSHSIDES, LUMP_EDGES, LUMP_ENTITIES, LUMP_FACES, LUMP_LEAFBRUSHES, LUMP_LEAFFACES, LUMP_LEAFS, LUMP_LIGHTING, LUMP_MODELS, LUMP_NODES, LUMP_PLANES, LUMP_POP, LUMP_SURFEDGES, LUMP_TEXINFO, LUMP_VERTEXES, LUMP_VISIBILITY, memset(), numareaportals, numareas, numbrushes, numbrushsides, numedges, numfaces, numleafbrushes, numleaffaces, numleafs, nummodels, numnodes, numplanes, numsurfedges, numtexinfo, numvertexes, Q2_AddLump(), Q2_SwapBSPFile(), SafeOpenWrite(), SafeWrite(), SEEK_SET, texinfo, texinfo_t, dheader_t::version, visdatasize, and wadfile. 00971 {
00972 header = &outheader;
00973 memset (header, 0, sizeof(dheader_t));
00974
00975 Q2_SwapBSPFile (true);
00976
00977 header->ident = LittleLong (IDBSPHEADER);
00978 header->version = LittleLong (BSPVERSION);
00979
00980 wadfile = SafeOpenWrite (filename);
00981 SafeWrite (wadfile, header, sizeof(dheader_t)); // overwritten later
00982
00983 Q2_AddLump (LUMP_PLANES, dplanes, numplanes*sizeof(dplane_t));
00984 Q2_AddLump (LUMP_LEAFS, dleafs, numleafs*sizeof(dleaf_t));
00985 Q2_AddLump (LUMP_VERTEXES, dvertexes, numvertexes*sizeof(dvertex_t));
00986 Q2_AddLump (LUMP_NODES, dnodes, numnodes*sizeof(dnode_t));
00987 Q2_AddLump (LUMP_TEXINFO, texinfo, numtexinfo*sizeof(texinfo_t));
00988 Q2_AddLump (LUMP_FACES, dfaces, numfaces*sizeof(dface_t));
00989 Q2_AddLump (LUMP_BRUSHES, dbrushes, numbrushes*sizeof(dbrush_t));
00990 Q2_AddLump (LUMP_BRUSHSIDES, dbrushsides, numbrushsides*sizeof(dbrushside_t));
00991 Q2_AddLump (LUMP_LEAFFACES, dleaffaces, numleaffaces*sizeof(dleaffaces[0]));
00992 Q2_AddLump (LUMP_LEAFBRUSHES, dleafbrushes, numleafbrushes*sizeof(dleafbrushes[0]));
00993 Q2_AddLump (LUMP_SURFEDGES, dsurfedges, numsurfedges*sizeof(dsurfedges[0]));
00994 Q2_AddLump (LUMP_EDGES, dedges, numedges*sizeof(dedge_t));
00995 Q2_AddLump (LUMP_MODELS, dmodels, nummodels*sizeof(dmodel_t));
00996 Q2_AddLump (LUMP_AREAS, dareas, numareas*sizeof(darea_t));
00997 Q2_AddLump (LUMP_AREAPORTALS, dareaportals, numareaportals*sizeof(dareaportal_t));
00998
00999 Q2_AddLump (LUMP_LIGHTING, dlightdata, lightdatasize);
01000 Q2_AddLump (LUMP_VISIBILITY, dvisdata, visdatasize);
01001 Q2_AddLump (LUMP_ENTITIES, dentdata, entdatasize);
01002 Q2_AddLump (LUMP_POP, dpop, sizeof(dpop));
01003
01004 fseek (wadfile, 0, SEEK_SET);
01005 SafeWrite (wadfile, header, sizeof(dheader_t));
01006 fclose (wadfile);
01007 } //end of the function Q2_WriteBSPFile
|
Here is the call graph for this function:

|
|
Definition at line 144 of file l_bsp_q2.c. Referenced by Q2_BSPBrushToMapBrush(), and Q2_FixTextureReferences(). |
|
|
Definition at line 138 of file l_bsp_q2.c. Referenced by Q2_AllocMaxBSP(), Q2_FreeMaxBSP(), Q2_LoadBSPFile(), Q2_SwapBSPFile(), and Q2_WriteBSPFile(). |
|
|
Definition at line 135 of file l_bsp_q2.c. Referenced by Q2_AllocMaxBSP(), Q2_FreeMaxBSP(), Q2_LoadBSPFile(), Q2_SwapBSPFile(), and Q2_WriteBSPFile(). |
|
|
Definition at line 129 of file l_bsp_q2.c. |
|
|
Definition at line 132 of file l_bsp_q2.c. |
|
|
Definition at line 117 of file l_bsp_q2.c. |
|
|
Definition at line 95 of file l_bsp_q2.c. |
|
|
Definition at line 114 of file l_bsp_q2.c. |
|
|
Definition at line 123 of file l_bsp_q2.c. |
|
|
Definition at line 120 of file l_bsp_q2.c. |
|
|
Definition at line 98 of file l_bsp_q2.c. |
|
|
Definition at line 92 of file l_bsp_q2.c. |
|
|
Definition at line 85 of file l_bsp_q2.c. |
|
|
Definition at line 107 of file l_bsp_q2.c. |
|
|
Definition at line 101 of file l_bsp_q2.c. |
|
|
Definition at line 141 of file l_bsp_q2.c. Referenced by EndBSPFile(), Q2_LoadBSPFile(), and Q2_WriteBSPFile(). |
|
|
Definition at line 126 of file l_bsp_q2.c. |
|
|
Definition at line 104 of file l_bsp_q2.c. |
|
|
Definition at line 89 of file l_bsp_q2.c. Referenced by Q2_AllocMaxBSP(), Q2_CompressVis(), Q2_DecompressVis(), Q2_FreeMaxBSP(), and Q2_SwapBSPFile(). |
|
|
Definition at line 88 of file l_bsp_q2.c. |
|
|
Definition at line 94 of file l_bsp_q2.c. |
|
|
Definition at line 91 of file l_bsp_q2.c. |
|
|
Definition at line 137 of file l_bsp_q2.c. Referenced by Q2_AllocMaxBSP(), |