#include "sinfiles.h"
Include dependency graph for l_bsp_sin.h:

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

Go to the source code of this file.
|
|
Definition at line 28 of file l_bsp_sin.h. Referenced by LoadMapFromBSP(), Sin_LoadBSPFile(), Sin_LoadBSPFileTexinfo(), and Sin_WriteBSPFile(). |
|
|
Definition at line 29 of file l_bsp_sin.h. Referenced by Sin_LoadBSPFile(), Sin_LoadBSPFileTexinfo(), and Sin_WriteBSPFile(). |
|
|
Definition at line 25 of file l_bsp_sin.h. Referenced by LoadMapFromBSP(). |
|
|
Definition at line 26 of file l_bsp_sin.h. |
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 468 of file l_bsp_sin.c. References byte, j, sin_dvis_t::numclusters, and sin_dvis. 00469 {
00470 int j;
00471 int rep;
00472 int visrow;
00473 byte *dest_p;
00474
00475 dest_p = dest;
00476 // visrow = (r_numvisleafs + 7)>>3;
00477 visrow = (sin_dvis->numclusters + 7)>>3;
00478
00479 for (j=0 ; j<visrow ; j++)
00480 {
00481 *dest_p++ = vis[j];
00482 if (vis[j])
00483 continue;
00484
00485 rep = 1;
00486 for ( j++; j<visrow ; j++)
00487 if (vis[j] || rep == 255)
00488 break;
00489 else
00490 rep++;
00491 *dest_p++ = rep;
00492 j--;
00493 }
00494
00495 return dest_p - dest;
00496 } //end of the function Sin_CompressVis
|
|
||||||||||||
|
Definition at line 504 of file l_bsp_sin.c. References byte, c, Error(), in, sin_dvis_t::numclusters, and sin_dvis. 00505 {
00506 int c;
00507 byte *out;
00508 int row;
00509
00510 // row = (r_numvisleafs+7)>>3;
00511 row = (sin_dvis->numclusters+7)>>3;
00512 out = decompressed;
00513
00514 do
00515 {
00516 if (*in)
00517 {
00518 *out++ = *in++;
00519 continue;
00520 }
00521
00522 c = in[1];
00523 if (!c)
00524 Error ("DecompressVis: 0 repeat");
00525 in += 2;
00526 while (c)
00527 {
00528 *out++ = 0;
00529 c--;
00530 }
00531 } while (out - decompressed < row);
00532 } //end of the function Sin_DecompressVis
|
Here is the call graph for this function:

|
|
Definition at line 186 of file l_bsp_sin.c. References FreeMemory(), Log_Print(), PrintMemorySize(), sin_allocatedbspmem, sin_dareaportals, sin_dareas, sin_dbrushes, sin_dbrushsides, sin_dedges, sin_dentdata, sin_dfaces, sin_dleafbrushes, sin_dleaffaces, sin_dleafs, sin_dlightdata, sin_dmodels, sin_dnodes, sin_dplanes, sin_dsurfedges, sin_dvertexes, sin_dvis, sin_dvisdata, sin_entdatasize, sin_lightdatasize, sin_lightinfo, sin_numareaportals, sin_numareas, sin_numbrushes, sin_numbrushsides, sin_numedges, sin_numfaces, sin_numleafbrushes, sin_numleaffaces, sin_numleafs, sin_numlightinfo, sin_nummodels, sin_numnodes, sin_numplanes, sin_numsurfedges, sin_numtexinfo, sin_numvertexes, sin_texinfo, and sin_visdatasize. Referenced by LoadMapFromBSP(). 00187 {
00188 //models
00189 sin_nummodels = 0;
00190 FreeMemory(sin_dmodels);
00191 sin_dmodels = NULL;
00192 //vis data
00193 sin_visdatasize = 0;
00194 FreeMemory(sin_dvisdata);
00195 sin_dvisdata = NULL;
00196 sin_dvis = NULL;
00197 //light data
00198 sin_lightdatasize = 0;
00199 FreeMemory(sin_dlightdata);
00200 sin_dlightdata = NULL;
00201 //entity data
00202 sin_entdatasize = 0;
00203 FreeMemory(sin_dentdata);
00204 sin_dentdata = NULL;
00205 //leafs
00206 sin_numleafs = 0;
00207 FreeMemory(sin_dleafs);
00208 sin_dleafs = NULL;
00209 //planes
00210 sin_numplanes = 0;
00211 FreeMemory(sin_dplanes);
00212 sin_dplanes = NULL;
00213 //vertexes
00214 sin_numvertexes = 0;
00215 FreeMemory(sin_dvertexes);
00216 sin_dvertexes = NULL;
00217 //nodes
00218 sin_numnodes = 0;
00219 FreeMemory(sin_dnodes);
00220 sin_dnodes = NULL;
00221 //texture info
00222 sin_numtexinfo = 0;
00223 FreeMemory(sin_texinfo);
00224 sin_texinfo = NULL;
00225 //faces
00226 sin_numfaces = 0;
00227 FreeMemory(sin_dfaces);
00228 sin_dfaces = NULL;
00229 //edges
00230 sin_numedges = 0;
00231 FreeMemory(sin_dedges);
00232 sin_dedges = NULL;
00233 //leaf faces
00234 sin_numleaffaces = 0;
00235 FreeMemory(sin_dleaffaces);
00236 sin_dleaffaces = NULL;
00237 //leaf brushes
00238 sin_numleafbrushes = 0;
00239 FreeMemory(sin_dleafbrushes);
00240 sin_dleafbrushes = NULL;
00241 //surface edges
00242 sin_numsurfedges = 0;
00243 FreeMemory(sin_dsurfedges);
00244 sin_dsurfedges = NULL;
00245 //brushes
00246 sin_numbrushes = 0;
00247 FreeMemory(sin_dbrushes);
00248 sin_dbrushes = NULL;
00249 //brushsides
00250 sin_numbrushsides = 0;
00251 FreeMemory(sin_dbrushsides);
00252 sin_dbrushsides = NULL;
00253 //areas
00254 sin_numareas = 0;
00255 FreeMemory(sin_dareas);
00256 sin_dareas = NULL;
00257 //area portals
00258 sin_numareaportals = 0;
00259 FreeMemory(sin_dareaportals);
00260 sin_dareaportals = NULL;
00261 //light info
00262 sin_numlightinfo = 0;
00263 FreeMemory(sin_lightinfo);
00264 sin_lightinfo = NULL;
00265 //
00266 Log_Print("freed ");
00267 PrintMemorySize(sin_allocatedbspmem);
00268 Log_Print(" of BSP memory\n");
00269 sin_allocatedbspmem = 0;
00270 } //end of the function Sin_FreeMaxBSP
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 825 of file l_bsp_sin.c. References Error(), FreeMemory(), header, i, dheader_t::ident, length(), LittleLong(), LoadFile(), offset, SIN_BSPHEADER, SIN_BSPVERSION, Sin_CopyLump(), sin_dareaportals, sin_dareas, sin_dbrushes, sin_dbrushsides, sin_dedges, sin_dentdata, sin_dfaces, sin_dleafbrushes, sin_dleaffaces, sin_dleafs, sin_dlightdata, sin_dmodels, sin_dnodes, sin_dplanes, sin_dpop, sin_dsurfedges, sin_dvertexes, sin_dvisdata, sin_entdatasize, sin_lightdatasize, sin_lightinfo, sin_lightvalue_t, SIN_LUMP_AREAPORTALS, SIN_LUMP_AREAS, SIN_LUMP_BRUSHES, SIN_LUMP_BRUSHSIDES, SIN_LUMP_EDGES, SIN_LUMP_ENTITIES, SIN_LUMP_FACES, SIN_LUMP_LEAFBRUSHES, SIN_LUMP_LEAFFACES, SIN_LUMP_LEAFS, SIN_LUMP_LIGHTINFO, SIN_LUMP_LIGHTING, SIN_LUMP_MODELS, SIN_LUMP_NODES, SIN_LUMP_PLANES, SIN_LUMP_POP, SIN_LUMP_SURFEDGES, SIN_LUMP_TEXINFO, SIN_LUMP_VERTEXES, SIN_LUMP_VISIBILITY, SIN_MAX_MAP_AREAPORTALS, SIN_MAX_MAP_AREAS, SIN_MAX_MAP_BRUSHES, SIN_MAX_MAP_BRUSHSIDES, SIN_MAX_MAP_EDGES, SIN_MAX_MAP_ENTSTRING, SIN_MAX_MAP_FACES, SIN_MAX_MAP_LEAFBRUSHES, SIN_MAX_MAP_LEAFFACES, SIN_MAX_MAP_LEAFS, SIN_MAX_MAP_LIGHTINFO, SIN_MAX_MAP_LIGHTING, SIN_MAX_MAP_MODELS, SIN_MAX_MAP_NODES, SIN_MAX_MAP_PLANES, SIN_MAX_MAP_SURFEDGES, SIN_MAX_MAP_TEXINFO, SIN_MAX_MAP_VERTS, SIN_MAX_MAP_VISIBILITY, sin_numareaportals, sin_numareas, sin_numbrushes, sin_numbrushsides, sin_numedges, sin_numfaces, sin_numleafbrushes, sin_numleaffaces, sin_numleafs, sin_numlightinfo, sin_nummodels, sin_numnodes, sin_numplanes, sin_numsurfedges, sin_numtexinfo, sin_numvertexes, Sin_SwapBSPFile(), sin_texinfo, sin_texinfo_t, sin_visdatasize, and dheader_t::version. Referenced by Sin_LoadMapFromBSP(). 00826 {
00827 int i;
00828
00829 //
00830 // load the file header
00831 //
00832 LoadFile (filename, (void **)&header, offset, length);
00833
00834 // swap the header
00835 for (i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
00836 ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
00837
00838 if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER)
00839 Error ("%s is not a IBSP file", filename);
00840 if (header->version != SIN_BSPVERSION && header->version != SINGAME_BSPVERSION)
00841 Error ("%s is version %i, not %i", filename, header->version, SIN_BSPVERSION);
00842
00843 #ifdef SIN
00844 sin_nummodels = Sin_CopyLump (SIN_LUMP_MODELS, sin_dmodels, sizeof(sin_dmodel_t), SIN_MAX_MAP_MODELS);
00845 sin_numvertexes = Sin_CopyLump (SIN_LUMP_VERTEXES, sin_dvertexes, sizeof(sin_dvertex_t), SIN_MAX_MAP_VERTS);
00846 sin_numplanes = Sin_CopyLump (SIN_LUMP_PLANES, sin_dplanes, sizeof(sin_dplane_t), SIN_MAX_MAP_PLANES);
00847 sin_numleafs = Sin_CopyLump (SIN_LUMP_LEAFS, sin_dleafs, sizeof(sin_dleaf_t), SIN_MAX_MAP_LEAFS);
00848 sin_numnodes = Sin_CopyLump (SIN_LUMP_NODES, sin_dnodes, sizeof(sin_dnode_t), SIN_MAX_MAP_NODES);
00849 sin_numtexinfo = Sin_CopyLump (SIN_LUMP_TEXINFO, sin_texinfo, sizeof(sin_texinfo_t), SIN_MAX_MAP_TEXINFO);
00850 sin_numfaces = Sin_CopyLump (SIN_LUMP_FACES, sin_dfaces, sizeof(sin_dface_t), SIN_MAX_MAP_FACES);
00851 sin_numleaffaces = Sin_CopyLump (SIN_LUMP_LEAFFACES, sin_dleaffaces, sizeof(sin_dleaffaces[0]), SIN_MAX_MAP_LEAFFACES);
00852 sin_numleafbrushes = Sin_CopyLump (SIN_LUMP_LEAFBRUSHES, sin_dleafbrushes, sizeof(sin_dleafbrushes[0]), SIN_MAX_MAP_LEAFBRUSHES);
00853 sin_numsurfedges = Sin_CopyLump (SIN_LUMP_SURFEDGES, sin_dsurfedges, sizeof(sin_dsurfedges[0]), SIN_MAX_MAP_SURFEDGES);
00854 sin_numedges = Sin_CopyLump (SIN_LUMP_EDGES, sin_dedges, sizeof(sin_dedge_t), SIN_MAX_MAP_EDGES);
00855 sin_numbrushes = Sin_CopyLump (SIN_LUMP_BRUSHES, sin_dbrushes, sizeof(sin_dbrush_t), SIN_MAX_MAP_BRUSHES);
00856 sin_numbrushsides = Sin_CopyLump (SIN_LUMP_BRUSHSIDES, sin_dbrushsides, sizeof(sin_dbrushside_t), SIN_MAX_MAP_BRUSHSIDES);
00857 sin_numareas = Sin_CopyLump (SIN_LUMP_AREAS, sin_dareas, sizeof(sin_darea_t), SIN_MAX_MAP_AREAS);
00858 sin_numareaportals = Sin_CopyLump (SIN_LUMP_AREAPORTALS, sin_dareaportals, sizeof(sin_dareaportal_t), SIN_MAX_MAP_AREAPORTALS);
00859 sin_numlightinfo = Sin_CopyLump (SIN_LUMP_LIGHTINFO, sin_lightinfo, sizeof(sin_lightvalue_t), SIN_MAX_MAP_LIGHTINFO);
00860
00861 sin_visdatasize = Sin_CopyLump (SIN_LUMP_VISIBILITY, sin_dvisdata, 1, SIN_MAX_MAP_VISIBILITY);
00862 sin_lightdatasize = Sin_CopyLump (SIN_LUMP_LIGHTING, sin_dlightdata, 1, SIN_MAX_MAP_LIGHTING);
00863 sin_entdatasize = Sin_CopyLump (SIN_LUMP_ENTITIES, sin_dentdata, 1, SIN_MAX_MAP_ENTSTRING);
00864
00865 Sin_CopyLump (SIN_LUMP_POP, sin_dpop, 1, sizeof(sin_dpop));
00866 #else
00867 sin_nummodels = Sin_CopyLump (SIN_LUMP_MODELS, sin_dmodels, sizeof(sin_dmodel_t));
00868 sin_numvertexes = Sin_CopyLump (SIN_LUMP_VERTEXES, sin_dvertexes, sizeof(sin_dvertex_t));
00869 sin_numplanes = Sin_CopyLump (SIN_LUMP_PLANES, sin_dplanes, sizeof(sin_dplane_t));
00870 sin_numleafs = Sin_CopyLump (SIN_LUMP_LEAFS, sin_dleafs, sizeof(sin_dleaf_t));
00871 sin_numnodes = Sin_CopyLump (SIN_LUMP_NODES, sin_dnodes, sizeof(sin_dnode_t));
00872 sin_numtexinfo = Sin_CopyLump (SIN_LUMP_TEXINFO, sin_texinfo, sizeof(sin_texinfo_t));
00873 sin_numfaces = Sin_CopyLump (SIN_LUMP_FACES, sin_dfaces, sizeof(sin_dface_t));
00874 sin_numleaffaces = Sin_CopyLump (SIN_LUMP_LEAFFACES, sin_dleaffaces, sizeof(sin_dleaffaces[0]));
00875 sin_numleafbrushes = Sin_CopyLump (SIN_LUMP_LEAFBRUSHES, sin_dleafbrushes, sizeof(sin_dleafbrushes[0]));
00876 sin_numsurfedges = Sin_CopyLump (SIN_LUMP_SURFEDGES, sin_dsurfedges, sizeof(sin_dsurfedges[0]));
00877 sin_numedges = Sin_CopyLump (SIN_LUMP_EDGES, sin_dedges, sizeof(sin_dedge_t));
00878 sin_numbrushes = Sin_CopyLump (SIN_LUMP_BRUSHES, sin_dbrushes, sizeof(sin_dbrush_t));
00879 sin_numbrushsides = Sin_CopyLump (SIN_LUMP_BRUSHSIDES, sin_dbrushsides, sizeof(sin_dbrushside_t));
00880 sin_numareas = Sin_CopyLump (SIN_LUMP_AREAS, sin_dareas, sizeof(sin_darea_t));
00881 sin_numareaportals = Sin_CopyLump (SIN_LUMP_AREAPORTALS, sin_dareaportals, sizeof(sin_dareaportal_t));
00882
00883 sin_visdatasize = Sin_CopyLump (SIN_LUMP_VISIBILITY, sin_dvisdata, 1);
00884 sin_lightdatasize = Sin_CopyLump (SIN_LUMP_LIGHTING, sin_dlightdata, 1);
00885 sin_entdatasize = Sin_CopyLump (SIN_LUMP_ENTITIES, sin_dentdata, 1);
00886
00887 Sin_CopyLump (SIN_LUMP_POP, sin_dpop, 1);
00888 #endif
00889
00890 FreeMemory(header); // everything has been copied out
00891
00892 //
00893 // swap everything
00894 //
00895 Sin_SwapBSPFile (false);
00896 } //end of the function Sin_LoadBSPFile
|
Here is the call graph for this function:

|
|
Definition at line 905 of file l_bsp_sin.c. References Error(), f, fclose(), lump_t::filelen, lump_t::fileofs, fopen(), fread(), FreeMemory(), fseek(), GetMemory(), header, i, dheader_t::ident, length(), LittleLong(), dheader_t::lumps, SEEK_SET, SIN_BSPHEADER, SIN_BSPVERSION, sin_numtexinfo, Sin_SwapBSPFile(), sin_texinfo, sin_texinfo_t, and dheader_t::version. 00906 {
00907 int i;
00908 FILE *f;
00909 int length, ofs;
00910
00911 header = GetMemory(sizeof(sin_dheader_t));
00912
00913 f = fopen (filename, "rb");
00914 fread (header, sizeof(sin_dheader_t), 1, f);
00915
00916 // swap the header
00917 for (i=0 ; i< sizeof(sin_dheader_t)/4 ; i++)
00918 ((int *)header)[i] = LittleLong ( ((int *)header)[i]);
00919
00920 if (header->ident != SIN_BSPHEADER && header->ident != SINGAME_BSPHEADER)
00921 Error ("%s is not a IBSP file", filename);
00922 if (header->version != SIN_BSPVERSION && header->version != SINGAME_BSPVERSION)
00923 Error ("%s is version %i, not %i", filename, header->version, SIN_BSPVERSION);
00924
00925
00926 length = header->lumps[SIN_LUMP_TEXINFO].filelen;
00927 ofs = header->lumps[SIN_LUMP_TEXINFO].fileofs;
00928
00929 fseek (f, ofs, SEEK_SET);
00930 fread (sin_texinfo, length, 1, f);
00931 fclose (f);
00932
00933 sin_numtexinfo = length / sizeof(sin_texinfo_t);
00934
00935 FreeMemory(header); // everything has been copied out
00936
00937 Sin_SwapBSPFile (false);
00938 } //end of the function Sin_LoadBSPFilesTexinfo
|
Here is the call graph for this function:

|
|
Definition at line 1057 of file l_bsp_sin.c. References FreeScript(), LoadScriptMemory(), num_entities, ParseEntity(), SCFL_NOSTRINGESCAPECHARS, SCFL_NOSTRINGWHITESPACES, script, SetScriptFlags(), sin_dentdata, and sin_entdatasize. Referenced by Sin_LoadMapFromBSP(), and Sin_PrintBSPFileSizes(). 01058 {
01059 script_t *script;
01060
01061 num_entities = 0;
01062 script = LoadScriptMemory(sin_dentdata, sin_entdatasize, "*sin bsp file");
01063 SetScriptFlags(script, SCFL_NOSTRINGWHITESPACES |
01064 SCFL_NOSTRINGESCAPECHARS);
01065
01066 while(ParseEntity(script))
01067 {
01068 } //end while
01069
01070 FreeScript(script);
01071 } //end of the function Sin_ParseEntities
|
Here is the call graph for this function:

|
|
Definition at line 1145 of file l_bsp_sin.c. References Log_Print(), num_entities, sin_dleafbrushes, sin_dleaffaces, sin_dsurfedges, sin_entdatasize, sin_lightdatasize, sin_lightvalue_t, sin_numbrushes, sin_numbrushsides, sin_numedges, sin_numfaces, sin_numleafbrushes, sin_numleaffaces, sin_numleafs, sin_numlightinfo, sin_nummodels, sin_numnodes, sin_numplanes, sin_numsurfedges, sin_numtexinfo, sin_numvertexes, Sin_ParseEntities(), sin_texinfo_t, and sin_visdatasize. 01146 {
01147 if (!num_entities)
01148 Sin_ParseEntities ();
01149
01150 Log_Print("%6i models %7i\n"
01151 ,sin_nummodels, (int)(sin_nummodels*sizeof(sin_dmodel_t)));
01152 Log_Print("%6i brushes %7i\n"
01153 ,sin_numbrushes, (int)(sin_numbrushes*sizeof(sin_dbrush_t)));
01154 Log_Print("%6i brushsides %7i\n"
01155 ,sin_numbrushsides, (int)(sin_numbrushsides*sizeof(sin_dbrushside_t)));
01156 Log_Print("%6i planes %7i\n"
01157 ,sin_numplanes, (int)(sin_numplanes*sizeof(sin_dplane_t)));
01158 Log_Print("%6i texinfo %7i\n"
01159 ,sin_numtexinfo, (int)(sin_numtexinfo*sizeof(sin_texinfo_t)));
01160 #ifdef SIN
01161 Log_Print("%6i lightinfo %7i\n"
01162 ,sin_numlightinfo, (int)(sin_numlightinfo*sizeof(sin_lightvalue_t)));
01163 #endif
01164 Log_Print("%6i entdata %7i\n", num_entities, sin_entdatasize);
01165
01166 Log_Print("\n");
01167
01168 Log_Print("%6i vertexes %7i\n"
01169 ,sin_numvertexes, (int)(sin_numvertexes*sizeof(sin_dvertex_t)));
01170 Log_Print("%6i nodes %7i\n"
01171 ,sin_numnodes, (int)(sin_numnodes*sizeof(sin_dnode_t)));
01172 Log_Print("%6i faces %7i\n"
01173 ,sin_numfaces, (int)(sin_numfaces*sizeof(sin_dface_t)));
01174 Log_Print("%6i leafs %7i\n"
01175 ,sin_numleafs, (int)(sin_numleafs*sizeof(sin_dleaf_t)));
01176 Log_Print("%6i leaffaces %7i\n"
01177 ,sin_numleaffaces, (int)(sin_numleaffaces*sizeof(sin_dleaffaces[0])));
01178 Log_Print("%6i leafbrushes %7i\n"
01179 ,sin_numleafbrushes, (int)(sin_numleafbrushes*sizeof(sin_dleafbrushes[0])));
01180 Log_Print("%6i surfedges %7i\n"
01181 ,sin_numsurfedges, (int)(sin_numsurfedges*sizeof(sin_dsurfedges[0])));
01182 Log_Print("%6i edges %7i\n"
01183 ,sin_numedges, (int)(sin_numedges*sizeof(sin_dedge_t)));
01184 Log_Print(" lightdata %7i\n", sin_lightdatasize);
01185 Log_Print(" visdata %7i\n", sin_visdatasize);
01186 }
|
Here is the call graph for this function:

|
|
Definition at line 1081 of file l_bsp_sin.c. References entities, epair_t, entity_t::epairs, Error(), i, epair_s::key, line, epair_s::next, sin_entdatasize, sprintf(), strcat(), strcpy(), StripTrailing(), strlen(), epair_s::value, and value. 01082 {
01083 char *buf, *end;
01084 epair_t *ep;
01085 char line[2048];
01086 int i;
01087 char key[1024], value[1024];
01088
01089 buf = sin_dentdata;
01090 end = buf;
01091 *end = 0;
01092
01093 for (i=0 ; i<num_entities ; i++)
01094 {
01095 ep = entities[i].epairs;
01096 if (!ep)
01097 continue; // ent got removed
01098
01099 strcat (end,"{\n");
01100 end += 2;
01101
01102 for (ep = entities[i].epairs ; ep ; ep=ep->next)
01103 {
01104 strcpy (key, ep->key);
01105 StripTrailing (key);
01106 strcpy (value, ep->value);
01107 StripTrailing (value);
01108
01109 sprintf (line, "\"%s\" \"%s\"\n", key, value);
01110 strcat (end, line);
01111 end += strlen(line);
01112 }
01113 strcat (end,"}\n");
01114 end += 2;
01115
01116 if (end > buf + SIN_MAX_MAP_ENTSTRING)
01117 Error ("Entity text too long");
01118 }
01119 sin_entdatasize = end - buf + 1;
01120 } //end of the function Sin_UnparseEntities
|
Here is the call graph for this function:

|
|
Definition at line 982 of file l_bsp_sin.c. References fclose(), fseek(), header, dheader_t::ident, LittleLong(), memset(), SafeOpenWrite(), SafeWrite(), SEEK_SET, Sin_AddLump(), SIN_BSPHEADER, SIN_BSPVERSION, sin_dareaportals, sin_dareas, sin_dbrushes, sin_dbrushsides, sin_dedges, sin_dentdata, sin_dfaces, sin_dleafbrushes, sin_dleaffaces, sin_dleafs, sin_dlightdata, sin_dmodels, sin_dnodes, sin_dplanes, sin_dpop, sin_dsurfedges, sin_dvertexes, sin_dvisdata, sin_entdatasize, sin_lightdatasize, sin_lightinfo, sin_lightvalue_t, SIN_LUMP_AREAPORTALS, SIN_LUMP_AREAS, SIN_LUMP_BRUSHES, SIN_LUMP_BRUSHSIDES, SIN_LUMP_EDGES, SIN_LUMP_ENTITIES, SIN_LUMP_FACES, SIN_LUMP_LEAFBRUSHES, SIN_LUMP_LEAFFACES, SIN_LUMP_LEAFS, SIN_LUMP_LIGHTINFO, SIN_LUMP_LIGHTING, SIN_LUMP_MODELS, SIN_LUMP_NODES, SIN_LUMP_PLANES, SIN_LUMP_POP, SIN_LUMP_SURFEDGES, SIN_LUMP_TEXINFO, SIN_LUMP_VERTEXES, SIN_LUMP_VISIBILITY, SIN_MAX_MAP_AREAPORTALS, SIN_MAX_MAP_AREAS, SIN_MAX_MAP_BRUSHES, SIN_MAX_MAP_BRUSHSIDES, SIN_MAX_MAP_EDGES, SIN_MAX_MAP_ENTSTRING, SIN_MAX_MAP_FACES, SIN_MAX_MAP_LEAFBRUSHES, SIN_MAX_MAP_LEAFFACES, SIN_MAX_MAP_LEAFS, SIN_MAX_MAP_LIGHTINFO, SIN_MAX_MAP_LIGHTING, SIN_MAX_MAP_MODELS, SIN_MAX_MAP_NODES, SIN_MAX_MAP_PLANES, SIN_MAX_MAP_SURFEDGES, SIN_MAX_MAP_TEXINFO, SIN_MAX_MAP_VERTS, SIN_MAX_MAP_VISIBILITY, sin_numareaportals, sin_numareas, sin_numbrushes, sin_numbrushsides, sin_numedges, sin_numfaces, sin_numleafbrushes, sin_numleaffaces, sin_numleafs, sin_numlightinfo, sin_nummodels, sin_numnodes, sin_numplanes, sin_numsurfedges, sin_numtexinfo, sin_numvertexes, Sin_SwapBSPFile(), sin_texinfo, sin_texinfo_t, sin_visdatasize, dheader_t::version, and wadfile. 00983 {
00984 header = &outheader;
00985 memset (header, 0, sizeof(sin_dheader_t));
00986
00987 Sin_SwapBSPFile (true);
00988
00989 header->ident = LittleLong (SIN_BSPHEADER);
00990 header->version = LittleLong (SIN_BSPVERSION);
00991
00992 wadfile = SafeOpenWrite (filename);
00993 SafeWrite (wadfile, header, sizeof(sin_dheader_t)); // overwritten later
00994
00995 #ifdef SIN
00996 Sin_AddLump (SIN_LUMP_PLANES, sin_dplanes, sin_numplanes, sizeof(sin_dplane_t), SIN_MAX_MAP_PLANES);
00997 Sin_AddLump (SIN_LUMP_LEAFS, sin_dleafs, sin_numleafs, sizeof(sin_dleaf_t), SIN_MAX_MAP_LEAFS);
00998 Sin_AddLump (SIN_LUMP_VERTEXES, sin_dvertexes, sin_numvertexes, sizeof(sin_dvertex_t), SIN_MAX_MAP_VERTS);
00999 Sin_AddLump (SIN_LUMP_NODES, sin_dnodes, sin_numnodes, sizeof(sin_dnode_t), SIN_MAX_MAP_NODES);
01000 Sin_AddLump (SIN_LUMP_TEXINFO, sin_texinfo, sin_numtexinfo, sizeof(sin_texinfo_t), SIN_MAX_MAP_TEXINFO);
01001 Sin_AddLump (SIN_LUMP_FACES, sin_dfaces, sin_numfaces, sizeof(sin_dface_t), SIN_MAX_MAP_FACES);
01002 Sin_AddLump (SIN_LUMP_BRUSHES, sin_dbrushes, sin_numbrushes, sizeof(sin_dbrush_t), SIN_MAX_MAP_BRUSHES);
01003 Sin_AddLump (SIN_LUMP_BRUSHSIDES, sin_dbrushsides, sin_numbrushsides, sizeof(sin_dbrushside_t), SIN_MAX_MAP_BRUSHSIDES);
01004 Sin_AddLump (SIN_LUMP_LEAFFACES, sin_dleaffaces, sin_numleaffaces, sizeof(sin_dleaffaces[0]), SIN_MAX_MAP_LEAFFACES);
01005 Sin_AddLump (SIN_LUMP_LEAFBRUSHES, sin_dleafbrushes, sin_numleafbrushes, sizeof(sin_dleafbrushes[0]), SIN_MAX_MAP_LEAFBRUSHES);
01006 Sin_AddLump (SIN_LUMP_SURFEDGES, sin_dsurfedges, sin_numsurfedges, sizeof(sin_dsurfedges[0]), SIN_MAX_MAP_SURFEDGES);
01007 Sin_AddLump (SIN_LUMP_EDGES, sin_dedges, sin_numedges, sizeof(sin_dedge_t), SIN_MAX_MAP_EDGES);
01008 Sin_AddLump (SIN_LUMP_MODELS, sin_dmodels, sin_nummodels, sizeof(sin_dmodel_t), SIN_MAX_MAP_MODELS);
01009 Sin_AddLump (SIN_LUMP_AREAS, sin_dareas, sin_numareas, sizeof(sin_darea_t), SIN_MAX_MAP_AREAS);
01010 Sin_AddLump (SIN_LUMP_AREAPORTALS, sin_dareaportals, sin_numareaportals, sizeof(sin_dareaportal_t), SIN_MAX_MAP_AREAPORTALS);
01011 Sin_AddLump (SIN_LUMP_LIGHTINFO, sin_lightinfo, sin_numlightinfo, sizeof(sin_lightvalue_t), SIN_MAX_MAP_LIGHTINFO);
01012
01013 Sin_AddLump (SIN_LUMP_LIGHTING, sin_dlightdata, sin_lightdatasize, 1, SIN_MAX_MAP_LIGHTING);
01014 Sin_AddLump (SIN_LUMP_VISIBILITY, sin_dvisdata, sin_visdatasize, 1, SIN_MAX_MAP_VISIBILITY);
01015 Sin_AddLump (SIN_LUMP_ENTITIES, sin_dentdata, sin_entdatasize, 1, SIN_MAX_MAP_ENTSTRING);
01016 Sin_AddLump (SIN_LUMP_POP, sin_dpop, sizeof(sin_dpop), 1, sizeof(sin_dpop));
01017 #else
01018 Sin_AddLump (SIN_LUMP_PLANES, sin_dplanes, sin_numplanes*sizeof(sin_dplane_t));
01019 Sin_AddLump (SIN_LUMP_LEAFS, sin_dleafs, sin_numleafs*sizeof(sin_dleaf_t));
01020 Sin_AddLump (SIN_LUMP_VERTEXES, sin_dvertexes, sin_numvertexes*sizeof(sin_dvertex_t));
01021 Sin_AddLump (SIN_LUMP_NODES, sin_dnodes, sin_numnodes*sizeof(sin_dnode_t));
01022 Sin_AddLump (SIN_LUMP_TEXINFO, sin_texinfo, sin_numtexinfo*sizeof(sin_texinfo_t));
01023 Sin_AddLump (SI |