#include "l_cmd.h"
#include "l_math.h"
#include "l_mem.h"
#include "l_log.h"
#include "../botlib/l_script.h"
#include "l_bsp_hl.h"
#include "l_bsp_ent.h"
Include dependency graph for l_bsp_hl.c:

Go to the source code of this file.
|
|
Definition at line 637 of file l_bsp_hl.c. Referenced by HL_PrintBSPFileSizes(). |
|
|
Definition at line 638 of file l_bsp_hl.c. Referenced by HL_PrintBSPFileSizes(). |
|
||||||||||||||||||||
|
Definition at line 640 of file l_bsp_hl.c. References qprintf(). Referenced by HL_PrintBSPFileSizes(). 00641 {
00642 float percentage = maxitems ? items * 100.0 / maxitems : 0.0;
00643
00644 qprintf("%-12s %7i/%-7i %7i/%-7i (%4.1f%%)",
00645 szItem, items, maxitems, items * itemsize, maxitems * itemsize, percentage );
00646 if ( percentage > 80.0 )
00647 qprintf( "VERY FULL!\n" );
00648 else if ( percentage > 95.0 )
00649 qprintf( "SIZE DANGER!\n" );
00650 else if ( percentage > 99.9 )
00651 qprintf( "SIZE OVERFLOW!!!\n" );
00652 else
00653 qprintf( "\n" );
00654 return items * itemsize;
00655 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 245 of file l_bsp_hl.c. Referenced by HL_LoadBSPFile(). 00246 {
00247 int checksum = 0;
00248
00249 while( bytes-- )
00250 checksum = (checksum << 4) ^ *((char *)buffer)++;
00251
00252 return checksum;
00253 }
|
|
||||||||||||||||
|
Definition at line 657 of file l_bsp_hl.c. References qprintf(). Referenced by HL_PrintBSPFileSizes(). 00658 {
00659 float percentage = maxstorage ? itemstorage * 100.0 / maxstorage : 0.0;
00660
00661 qprintf("%-12s [variable] %7i/%-7i (%4.1f%%)",
00662 szItem, itemstorage, maxstorage, percentage );
00663 if ( percentage > 80.0 )
00664 qprintf( "VERY FULL!\n" );
00665 else if ( percentage > 95.0 )
00666 qprintf( "SIZE DANGER!\n" );
00667 else if ( percentage > 99.9 )
00668 qprintf( "SIZE OVERFLOW!!!\n" );
00669 else
00670 qprintf( "\n" );
00671 return itemstorage;
00672 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 583 of file l_bsp_hl.c. References data, hl_lump_t::filelen, hl_lump_t::fileofs, ftell(), hl_header, LittleLong(), hl_dheader_t::lumps, SafeWrite(), and wadfile. Referenced by HL_WriteBSPFile(). 00584 {
00585 hl_lump_t *lump;
00586
00587 lump = &hl_header->lumps[lumpnum];
00588
00589 lump->fileofs = LittleLong( ftell(wadfile) );
00590 lump->filelen = LittleLong(len);
00591 SafeWrite (wadfile, data, (len+3)&~3);
00592 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 260 of file l_bsp_hl.c. References byte, hl_numleafs, and j. 00261 {
00262 int j;
00263 int rep;
00264 int visrow;
00265 byte *dest_p;
00266
00267 dest_p = dest;
00268 visrow = (hl_numleafs + 7)>>3;
00269
00270 for (j=0 ; j<visrow ; j++)
00271 {
00272 *dest_p++ = vis[j];
00273 if (vis[j])
00274 continue;
00275
00276 rep = 1;
00277 for ( j++; j<visrow ; j++)
00278 if (vis[j] || rep == 255)
00279 break;
00280 else
00281 rep++;
00282 *dest_p++ = rep;
00283 j--;
00284 }
00285
00286 return dest_p - dest;
00287 }
|
|
||||||||||||||||||||
|
Definition at line 487 of file l_bsp_hl.c. References byte, Error(), hl_lump_t::filelen, hl_lump_t::fileofs, hl_fileLength, hl_header, length(), hl_dheader_t::lumps, memcpy(), and printf(). Referenced by HL_LoadBSPFile(). 00488 {
00489 int length, ofs;
00490
00491 length = hl_header->lumps[lump].filelen;
00492 ofs = hl_header->lumps[lump].fileofs;
00493
00494 if (length % size) {
00495 Error ("LoadBSPFile: odd lump size");
00496 }
00497 // somehow things got out of range
00498 if ((length/size) > maxsize) {
00499 printf("WARNING: exceeded max size for lump %d size %d > maxsize %d\n", lump, (length/size), maxsize);
00500 length = maxsize * size;
00501 }
00502 if ( ofs + length > hl_fileLength ) {
00503 printf("WARNING: exceeded file length for lump %d\n", lump);
00504 length = hl_fileLength - ofs;
00505 if ( length <= 0 ) {
00506 return 0;
00507 }
00508 }
00509
00510 memcpy (dest, (byte *)hl_header + ofs, length);
00511
00512 return length / size;
00513 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 295 of file l_bsp_hl.c. References byte, c, hl_numleafs, and in. 00296 {
00297 int c;
00298 byte *out;
00299 int row;
00300
00301 row = (hl_numleafs+7)>>3;
00302 out = decompressed;
00303
00304 do
00305 {
00306 if (*in)
00307 {
00308 *out++ = *in++;
00309 continue;
00310 }
00311
00312 c = in[1];
00313 in += 2;
00314 while (c)
00315 {
00316 *out++ = 0;
00317 c--;
00318 }
00319 } while (out - decompressed < row);
00320 }
|
|
|
Definition at line 169 of file l_bsp_hl.c. References FreeMemory(), hl_allocatedbspmem, hl_dclipnodes, hl_dedges, hl_dentdata, hl_dfaces, hl_dleafs, hl_dlightdata, hl_dmarksurfaces, hl_dmodels, hl_dnodes, hl_dplanes, hl_dsurfedges, hl_dtexdata, hl_dvertexes, hl_dvisdata, hl_entdatasize, hl_lightdatasize, hl_numclipnodes, hl_numedges, hl_numfaces, hl_numleafs, hl_nummarksurfaces, hl_nummodels, hl_numnodes, hl_numplanes, hl_numsurfedges, hl_numtexinfo, hl_numvertexes, hl_texdatasize, hl_texinfo, hl_visdatasize, Log_Print(), and PrintMemorySize(). Referenced by LoadMapFromBSP(). 00170 {
00171 //models
00172 hl_nummodels = 0;
00173 FreeMemory(hl_dmodels);
00174 hl_dmodels = NULL;
00175 //visibility
00176 hl_visdatasize = 0;
00177 FreeMemory(hl_dvisdata);
00178 hl_dvisdata = NULL;
00179 //light data
00180 hl_lightdatasize = 0;
00181 FreeMemory(hl_dlightdata);
00182 hl_dlightdata = NULL;
00183 //texture data
00184 hl_texdatasize = 0;
00185 FreeMemory(hl_dtexdata);
00186 hl_dtexdata = NULL;
00187 //entities
00188 hl_entdatasize = 0;
00189 FreeMemory(hl_dentdata);
00190 hl_dentdata = NULL;
00191 //leaves
00192 hl_numleafs = 0;
00193 FreeMemory(hl_dleafs);
00194 hl_dleafs = NULL;
00195 //planes
00196 hl_numplanes = 0;
00197 FreeMemory(hl_dplanes);
00198 hl_dplanes = NULL;
00199 //vertexes
00200 hl_numvertexes = 0;
00201 FreeMemory(hl_dvertexes);
00202 hl_dvertexes = NULL;
00203 //nodes
00204 hl_numnodes = 0;
00205 FreeMemory(hl_dnodes);
00206 hl_dnodes = NULL;
00207 //texture info
00208 hl_numtexinfo = 0;
00209 FreeMemory(hl_texinfo);
00210 hl_texinfo = NULL;
00211 //faces
00212 hl_numfaces = 0;
00213 FreeMemory(hl_dfaces);
00214 hl_dfaces = NULL;
00215 //clip nodes
00216 hl_numclipnodes = 0;
00217 FreeMemory(hl_dclipnodes);
00218 hl_dclipnodes = NULL;
00219 //edges
00220 hl_numedges = 0;
00221 FreeMemory(hl_dedges);
00222 hl_dedges = NULL;
00223 //mark surfaces
00224 hl_nummarksurfaces = 0;
00225 FreeMemory(hl_dmarksurfaces);
00226 hl_dmarksurfaces = NULL;
00227 //surface edges
00228 hl_numsurfedges = 0;
00229 FreeMemory(hl_dsurfedges);
00230 hl_dsurfedges = NULL;
00231 //
00232 Log_Print("freed ");
00233 PrintMemorySize(hl_allocatedbspmem);
00234 Log_Print(" of BSP memory\n");
00235 hl_allocatedbspmem = 0;
00236 } //end of the function HL_FreeMaxBSP
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 520 of file l_bsp_hl.c. References Error(), FastChecksum(), FreeMemory(), HL_BSPVERSION, HL_CopyLump(), hl_dclipnodes, hl_dclipnodes_checksum, hl_dedges, hl_dedges_checksum, hl_dentdata, hl_dentdata_checksum, hl_dfaces, hl_dfaces_checksum, hl_dleafs, hl_dleafs_checksum, hl_dlightdata, hl_dlightdata_checksum, hl_dmarksurfaces, hl_dmarksurfaces_checksum, hl_dmodels, hl_dmodels_checksum, hl_dnodes, hl_dnodes_checksum, hl_dplanes, hl_dplanes_checksum, hl_dsurfedges, hl_dsurfedges_checksum, hl_dtexdata, hl_dtexdata_checksum, hl_dvertexes, hl_dvertexes_checksum, hl_dvisdata, hl_dvisdata_checksum, hl_entdatasize, hl_fileLength, hl_header, hl_lightdatasize, HL_LUMP_CLIPNODES, HL_LUMP_EDGES, HL_LUMP_ENTITIES, HL_LUMP_FACES, HL_LUMP_LEAFS, HL_LUMP_LIGHTING, HL_LUMP_MARKSURFACES, HL_LUMP_MODELS, HL_LUMP_NODES, HL_LUMP_PLANES, HL_LUMP_SURFEDGES, HL_LUMP_TEXINFO, HL_LUMP_TEXTURES, HL_LUMP_VERTEXES, HL_LUMP_VISIBILITY, HL_MAX_MAP_CLIPNODES, HL_MAX_MAP_EDGES, HL_MAX_MAP_ENTSTRING, HL_MAX_MAP_FACES, HL_MAX_MAP_LEAFS, HL_MAX_MAP_LIGHTING, HL_MAX_MAP_MARKSURFACES, HL_MAX_MAP_MIPTEX, HL_MAX_MAP_MODELS, HL_MAX_MAP_NODES, HL_MAX_MAP_PLANES, HL_MAX_MAP_SURFEDGES, HL_MAX_MAP_TEXINFO, HL_MAX_MAP_VERTS, HL_MAX_MAP_VISIBILITY, hl_numclipnodes, hl_numedges, hl_numfaces, hl_numleafs, hl_nummarksurfaces, hl_nummodels, hl_numnodes, hl_numplanes, hl_numsurfedges, hl_numtexinfo, hl_numvertexes, HL_SwapBSPFile(), hl_texdatasize, hl_texinfo, hl_texinfo_checksum, hl_texinfo_t, hl_visdatasize, i, length(), LittleLong(), LoadFile(), offset, and hl_dheader_t::version. Referenced by HL_LoadMapFromBSP(). 00521 {
00522 int i;
00523
00524 //
00525 // load the file header
00526 //
00527 hl_fileLength = LoadFile (filename, (void **)&hl_header, offset, length);
00528
00529 // swap the header
00530 for (i=0 ; i< sizeof(hl_dheader_t)/4 ; i++)
00531 ((int *)hl_header)[i] = LittleLong ( ((int *)hl_header)[i]);
00532
00533 if (hl_header->version != HL_BSPVERSION)
00534 Error ("%s is version %i, not %i", filename, hl_header->version, HL_BSPVERSION);
00535
00536 hl_nummodels = HL_CopyLump (HL_LUMP_MODELS, hl_dmodels, sizeof(hl_dmodel_t), HL_MAX_MAP_MODELS );
00537 hl_numvertexes = HL_CopyLump (HL_LUMP_VERTEXES, hl_dvertexes, sizeof(hl_dvertex_t), HL_MAX_MAP_VERTS );
00538 hl_numplanes = HL_CopyLump (HL_LUMP_PLANES, hl_dplanes, sizeof(hl_dplane_t), HL_MAX_MAP_PLANES );
00539 hl_numleafs = HL_CopyLump (HL_LUMP_LEAFS, hl_dleafs, sizeof(hl_dleaf_t), HL_MAX_MAP_LEAFS );
00540 hl_numnodes = HL_CopyLump (HL_LUMP_NODES, hl_dnodes, sizeof(hl_dnode_t), HL_MAX_MAP_NODES );
00541 hl_numtexinfo = HL_CopyLump (HL_LUMP_TEXINFO, hl_texinfo, sizeof(hl_texinfo_t), HL_MAX_MAP_TEXINFO );
00542 hl_numclipnodes = HL_CopyLump (HL_LUMP_CLIPNODES, hl_dclipnodes, sizeof(hl_dclipnode_t), HL_MAX_MAP_CLIPNODES );
00543 hl_numfaces = HL_CopyLump (HL_LUMP_FACES, hl_dfaces, sizeof(hl_dface_t), HL_MAX_MAP_FACES );
00544 hl_nummarksurfaces = HL_CopyLump (HL_LUMP_MARKSURFACES, hl_dmarksurfaces, sizeof(hl_dmarksurfaces[0]), HL_MAX_MAP_MARKSURFACES );
00545 hl_numsurfedges = HL_CopyLump (HL_LUMP_SURFEDGES, hl_dsurfedges, sizeof(hl_dsurfedges[0]), HL_MAX_MAP_SURFEDGES );
00546 hl_numedges = HL_CopyLump (HL_LUMP_EDGES, hl_dedges, sizeof(hl_dedge_t), HL_MAX_MAP_EDGES );
00547
00548 hl_texdatasize = HL_CopyLump (HL_LUMP_TEXTURES, hl_dtexdata, 1, HL_MAX_MAP_MIPTEX );
00549 hl_visdatasize = HL_CopyLump (HL_LUMP_VISIBILITY, hl_dvisdata, 1, HL_MAX_MAP_VISIBILITY );
00550 hl_lightdatasize = HL_CopyLump (HL_LUMP_LIGHTING, hl_dlightdata, 1, HL_MAX_MAP_LIGHTING );
00551 hl_entdatasize = HL_CopyLump (HL_LUMP_ENTITIES, hl_dentdata, 1, HL_MAX_MAP_ENTSTRING );
00552
00553 FreeMemory(hl_header); // everything has been copied out
00554
00555 //
00556 // swap everything
00557 //
00558 HL_SwapBSPFile (false);
00559
00560 hl_dmodels_checksum = FastChecksum( hl_dmodels, hl_nummodels*sizeof(hl_dmodels[0]) );
00561 hl_dvertexes_checksum = FastChecksum( hl_dvertexes, hl_numvertexes*sizeof(hl_dvertexes[0]) );
00562 hl_dplanes_checksum = FastChecksum( hl_dplanes, hl_numplanes*sizeof(hl_dplanes[0]) );
00563 hl_dleafs_checksum = FastChecksum( hl_dleafs, hl_numleafs*sizeof(hl_dleafs[0]) );
00564 hl_dnodes_checksum = FastChecksum( hl_dnodes, hl_numnodes*sizeof(hl_dnodes[0]) );
00565 hl_texinfo_checksum = FastChecksum( hl_texinfo, hl_numtexinfo*sizeof(hl_texinfo[0]) );
00566 hl_dclipnodes_checksum = FastChecksum( hl_dclipnodes, hl_numclipnodes*sizeof(hl_dclipnodes[0]) );
00567 hl_dfaces_checksum = FastChecksum( hl_dfaces, hl_numfaces*sizeof(hl_dfaces[0]) );
00568 hl_dmarksurfaces_checksum = FastChecksum( hl_dmarksurfaces, hl_nummarksurfaces*sizeof(hl_dmarksurfaces[0]) );
00569 hl_dsurfedges_checksum = FastChecksum( hl_dsurfedges, hl_numsurfedges*sizeof(hl_dsurfedges[0]) );
00570 hl_dedges_checksum = FastChecksum( hl_dedges, hl_numedges*sizeof(hl_dedges[0]) );
00571 hl_dtexdata_checksum = FastChecksum( hl_dtexdata, hl_numedges*sizeof(hl_dtexdata[0]) );
00572 hl_dvisdata_checksum = FastChecksum( hl_dvisdata, hl_visdatasize*sizeof(hl_dvisdata[0]) );
00573 hl_dlightdata_checksum = FastChecksum( hl_dlightdata, hl_lightdatasize*sizeof(hl_dlightdata[0]) );
00574 hl_dentdata_checksum = FastChecksum( hl_dentdata, hl_entdatasize*sizeof(hl_dentdata[0]) );
00575
00576 }
|
Here is the call graph for this function:

|
|
Definition at line 779 of file l_bsp_hl.c. References FreeScript(), hl_dentdata, hl_entdatasize, LoadScriptMemory(), num_entities, ParseEntity(), SCFL_NOSTRINGESCAPECHARS, SCFL_NOSTRINGWHITESPACES, script, and SetScriptFlags(). Referenced by HL_LoadMapFromBSP(). 00780 {
00781 script_t *script;
00782
00783 num_entities = 0;
00784 script = LoadScriptMemory(hl_dentdata, hl_entdatasize, "*Half-Life bsp file");
00785 SetScriptFlags(script, SCFL_NOSTRINGWHITESPACES |
00786 SCFL_NOSTRINGESCAPECHARS);
00787
00788 while(ParseEntity(script))
00789 {
00790 } //end while
00791
00792 FreeScript(script);
00793 } //end of the function HL_ParseEntities
|
Here is the call graph for this function:

|
|
Definition at line 681 of file l_bsp_hl.c. References ArrayUsage(), ENTRIES, ENTRYSIZE, GlobUsage(), hl_dclipnodes, hl_dedges, hl_dentdata, hl_dfaces, hl_dleafs, hl_dlightdata, hl_dmarksurfaces, hl_dmodels, hl_dnodes, hl_dplanes, hl_dsurfedges, hl_dtexdata, hl_dvertexes, hl_dvisdata, hl_entdatasize, hl_lightdatasize, hl_numclipnodes, hl_numedges, hl_numfaces, hl_numleafs, hl_nummarksurfaces, hl_nummodels, hl_numnodes, hl_numplanes, hl_numsurfedges, hl_numtexinfo, hl_numvertexes, hl_texdatasize, hl_texinfo, hl_visdatasize, and qprintf(). 00682 {
00683 int numtextures = hl_texdatasize ? ((hl_dmiptexlump_t*)hl_dtexdata)->nummiptex : 0;
00684 int totalmemory = 0;
00685
00686 qprintf("\n");
00687 qprintf("Object names Objects/Maxobjs Memory / Maxmem Fullness\n" );
00688 qprintf("------------ --------------- --------------- --------\n" );
00689
00690 totalmemory += ArrayUsage( "models", hl_nummodels, ENTRIES(hl_dmodels), ENTRYSIZE(hl_dmodels) );
00691 totalmemory += ArrayUsage( "planes", hl_numplanes, ENTRIES(hl_dplanes), ENTRYSIZE(hl_dplanes) );
00692 totalmemory += ArrayUsage( "vertexes", hl_numvertexes, ENTRIES(hl_dvertexes), ENTRYSIZE(hl_dvertexes) );
00693 totalmemory += ArrayUsage( "nodes", hl_numnodes, ENTRIES(hl_dnodes), ENTRYSIZE(hl_dnodes) );
00694 totalmemory += ArrayUsage( "texinfos", hl_numtexinfo, ENTRIES(hl_texinfo), ENTRYSIZE(hl_texinfo) );
00695 totalmemory += ArrayUsage( "faces", hl_numfaces, ENTRIES(hl_dfaces), ENTRYSIZE(hl_dfaces) );
00696 totalmemory += ArrayUsage( "clipnodes", hl_numclipnodes, ENTRIES(hl_dclipnodes), ENTRYSIZE(hl_dclipnodes) );
00697 totalmemory += ArrayUsage( "leaves", hl_numleafs, ENTRIES(hl_dleafs), ENTRYSIZE(hl_dleafs) );
00698 totalmemory += ArrayUsage( "marksurfaces",hl_nummarksurfaces,ENTRIES(hl_dmarksurfaces),ENTRYSIZE(hl_dmarksurfaces) );
00699 totalmemory += ArrayUsage( "surfedges", hl_numsurfedges, ENTRIES(hl_dsurfedges), ENTRYSIZE(hl_dsurfedges) );
00700 totalmemory += ArrayUsage( "edges", hl_numedges, ENTRIES(hl_dedges), ENTRYSIZE(hl_dedges) );
00701
00702 totalmemory += GlobUsage( "texdata", hl_texdatasize, sizeof(hl_dtexdata) );
00703 totalmemory += GlobUsage( "lightdata", hl_lightdatasize, sizeof(hl_dlightdata) );
00704 totalmemory += GlobUsage( "visdata", hl_visdatasize, sizeof(hl_dvisdata) );
00705 totalmemory += GlobUsage( "entdata", hl_entdatasize, sizeof(hl_dentdata) );
00706
00707 qprintf( "=== Total BSP file data space used: %d bytes ===\n\n", totalmemory );
00708 }
|
Here is the call graph for this function:

|
|
Definition at line 331 of file l_bsp_hl.c. References c, hl_dclipnode_t::children, hl_dnode_t::children, hl_dleaf_t::contents, d, hl_dmiptexlump_t::dataofs, hl_dplane_t::dist, hl_dface_t::firstedge, hl_dnode_t::firstface, hl_dmodel_t::firstface, hl_dleaf_t::firstmarksurface, hl_texinfo_s::flags, hl_dmodel_t::headnode, hl_dclipnodes, hl_dedges, hl_dfaces, hl_dleafs, hl_dmarksurfaces, hl_dmodels, hl_dnodes, hl_dplanes, hl_dsurfedges, hl_dvertexes, hl_texinfo, i, j, hl_dface_t::lightofs, LittleFloat(), LittleLong(), LittleShort(), hl_dleaf_t::maxs, hl_dnode_t::maxs, hl_dmodel_t::maxs, hl_dleaf_t::mins, hl_dnode_t::mins, hl_dmodel_t::mins, hl_texinfo_s::miptex, hl_dplane_t::normal, numedges, hl_dface_t::numedges, numfaces, hl_dnode_t::numfaces, hl_dmodel_t::numfaces, hl_dleaf_t::nummarksurfaces, hl_dmiptexlump_t::nummiptex, hl_dmodel_t::origin, hl_dclipnode_t::planenum, hl_dnode_t::planenum, hl_dface_t::planenum, hl_dvertex_t::point, hl_dface_t::side, texinfo, hl_dface_t::texinfo, hl_dplane_t::type, v, hl_dedge_t::v, vecs, hl_texinfo_s::vecs, hl_dmodel_t::visleafs, and hl_dleaf_t::visofs. Referenced by HL_LoadBSPFile(), and HL_WriteBSPFile(). 00332 {
00333 int i, j, c;
00334 hl_dmodel_t *d;
00335 hl_dmiptexlump_t *mtl;
00336
00337
00338 // models
00339 for (i = 0; i < hl_nummodels; i++)
00340 {
00341 d = &hl_dmodels[i];
00342
00343 for (j = 0; j < HL_MAX_MAP_HULLS; j++)
00344 d->headnode[j] = LittleLong(d->headnode[j]);
00345
00346 d->visleafs = LittleLong(d->visleafs);
00347 d->firstface = LittleLong(d->firstface);
00348 d->numfaces = LittleLong(d->numfaces);
00349
00350 for (j = 0; j < 3; j++)
00351 {
00352 d->mins[j] = LittleFloat(d->mins[j]);
00353 d->maxs[j] = LittleFloat(d->maxs[j]);
00354 d->origin[j] = LittleFloat(d->origin[j]);
00355 }
00356 }
00357
00358 //
00359 // vertexes
00360 //
00361 for (i = 0; i < hl_numvertexes; i++)
00362 {
00363 for (j = 0; j < 3; j++)
00364 hl_dvertexes[i].point[j] = LittleFloat (hl_dvertexes[i].point[j]);
00365 }
00366
00367 //
00368 // planes
00369 //
00370 for (i=0 ; i<hl_numplanes ; i++)
00371 {
00372 for (j=0 ; j<3 ; j++)
00373 hl_dplanes[i].normal[j] = LittleFloat (hl_dplanes[i].normal[j]);
00374 hl_dplanes[i].dist = LittleFloat (hl_dplanes[i].dist);
00375 hl_dplanes[i].type = LittleLong (hl_dplanes[i].type);
00376 }
00377
00378 //
00379 // texinfos
00380 //
00381 for (i=0 ; i<hl_numtexinfo ; i++)
00382 {
00383 for (j=0 ; j<8 ; j++)
00384 hl_texinfo[i].vecs[0][j] = LittleFloat (hl_texinfo[i].vecs[0][j]);
00385 hl_texinfo[i].miptex = LittleLong (hl_texinfo[i].miptex);
00386 hl_texinfo[i].flags = LittleLong (hl_texinfo[i].flags);
00387 }
00388
00389 //
00390 // faces
00391 //
00392 for (i=0 ; i<hl_numfaces ; i++)
00393 {
00394 hl_dfaces[i].texinfo = LittleShort (hl_dfaces[i].texinfo);
00395 hl_dfaces[i].planenum = LittleShort (hl_dfaces[i].planenum);
00396 hl_dfaces[i].side = LittleShort (hl_dfaces[i].side);
00397 hl_dfaces[i].lightofs = LittleLong (hl_dfaces[i].lightofs);
00398 hl_dfaces[i].firstedge = LittleLong (hl_dfaces[i].firstedge);
00399 hl_dfaces[i].numedges = LittleShort (hl_dfaces[i].numedges);
00400 }
00401
00402 //
00403 // nodes
00404 //
00405 for (i=0 ; i<hl_numnodes ; i++)
00406 {
00407 hl_dnodes[i].planenum = LittleLong (hl_dnodes[i].planenum);
00408 for (j=0 ; j<3 ; j++)
00409 {
00410 hl_dnodes[i].mins[j] = LittleShort (hl_dnodes[i].mins[j]);
00411 hl_dnodes[i].maxs[j] = LittleShort (hl_dnodes[i].maxs[j]);
00412 }
00413 hl_dnodes[i].children[0] = LittleShort (hl_dnodes[i].children[0]);
00414 hl_dnodes[i].children[1] = LittleShort (hl_dnodes[i].children[1]);
00415 hl_dnodes[i].firstface = LittleShort (hl_dnodes[i].firstface);
00416 hl_dnodes[i].numfaces = LittleShort (hl_dnodes[i].numfaces);
00417 }
00418
00419 //
00420 // leafs
00421 //
00422 for (i=0 ; i<hl_numleafs ; i++)
00423 {
00424 hl_dleafs[i].contents = LittleLong (hl_dleafs[i].contents);
00425 for (j=0 ; j<3 ; j++)
00426 {
00427 hl_dleafs[i].mins[j] = LittleShort (hl_dleafs[i].mins[j]);
00428 hl_dleafs[i].maxs[j] = LittleShort (hl_dleafs[i].maxs[j]);
00429 }
00430
00431 hl_dleafs[i].firstmarksurface = LittleShort (hl_dleafs[i].firstmarksurface);
00432 hl_dleafs[i].nummarksurfaces = LittleShort (hl_dleafs[i].nummarksurfaces);
00433 hl_dleafs[i].visofs = LittleLong (hl_dleafs[i].visofs);
00434 }
00435
00436 //
00437 // clipnodes
00438 //
00439 for (i=0 ; i<hl_numclipnodes ; i++)
00440 {
00441 hl_dclipnodes[i].planenum = LittleLong (hl_dclipnodes[i].planenum);
00442 hl_dclipnodes[i].children[0] = LittleShort (hl_dclipnodes[i].children[0]);
00443 hl_dclipnodes[i].children[1] = LittleShort (hl_dclipnodes[i].children[1]);
00444 }
00445
00446 //
00447 // miptex
00448 //
00449 if (hl_texdatasize)
00450 {
00451 mtl = (hl_dmiptexlump_t *)hl_dtexdata;
00452 if (todisk)
00453 c = mtl->nummiptex;
00454 else
00455 c = LittleLong(mtl->nummiptex);
00456 mtl->nummiptex = LittleLong (mtl->nummiptex);
00457 for (i=0 ; i< |