mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-16 17:01:53 +00:00
[qfbsp] Print the number of textures in the bsp
I needed to check what sort of numbers to expect for bsp texture counts. It turns out id maps use only 81 max, but oum uses up to 173.
This commit is contained in:
parent
4dc2e6cac2
commit
ca9566a425
1 changed files with 34 additions and 17 deletions
|
@ -7,7 +7,9 @@
|
|||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "tools/qfbsp/include/brush.h"
|
||||
#include "tools/qfbsp/include/bsp5.h"
|
||||
|
@ -16,26 +18,35 @@
|
|||
|
||||
typedef struct lumpinfo_s {
|
||||
const char *name;
|
||||
int data;
|
||||
int size;
|
||||
const char *(*extra) (const void *data);
|
||||
} lumpinfo_t;
|
||||
|
||||
static const char *
|
||||
num_textures (const void *data)
|
||||
{
|
||||
__auto_type d = (const dmiptexlump_t *)data;
|
||||
return va (0, " %7d", LittleLong (d->nummiptex));
|
||||
}
|
||||
|
||||
#define O(f) field_offset (bsp_t, f)
|
||||
static lumpinfo_t lump_info[] = {
|
||||
{ "entities", O(entdatasize) },
|
||||
{ "planes", O(numplanes) },
|
||||
{ "textures", O(texdatasize) },
|
||||
{ "vertices", O(numvertexes) },
|
||||
{ "visibility", O(visdatasize) },
|
||||
{ "nodes", O(numnodes) },
|
||||
{ "texinfo", O(numtexinfo) },
|
||||
{ "faces", O(numfaces) },
|
||||
{ "lighting", O(lightdatasize) },
|
||||
{ "clipnodes", O(numclipnodes) },
|
||||
{ "leafs", O(numleafs) },
|
||||
{ "marksurfaces", O(nummarksurfaces) },
|
||||
{ "edges", O(numedges) },
|
||||
{ "surfedges", O(numsurfedges) },
|
||||
{ "models", O(nummodels) },
|
||||
{ "entities", O(entdata), O(entdatasize) },
|
||||
{ "planes", O(planes), O(numplanes) },
|
||||
{ "textures", O(texdata), O(texdatasize), num_textures },
|
||||
{ "vertices", O(vertexes), O(numvertexes) },
|
||||
{ "visibility", O(visdata), O(visdatasize) },
|
||||
{ "nodes", O(nodes), O(numnodes) },
|
||||
{ "texinfo", O(texinfo), O(numtexinfo) },
|
||||
{ "faces", O(faces), O(numfaces) },
|
||||
{ "lighting", O(lightdata), O(lightdatasize) },
|
||||
{ "clipnodes", O(clipnodes), O(numclipnodes) },
|
||||
{ "leafs", O(leafs), O(numleafs) },
|
||||
{ "marksurfaces", O(marksurfaces), O(nummarksurfaces) },
|
||||
{ "edges", O(edges), O(numedges) },
|
||||
{ "surfedges", O(surfedges), O(numsurfedges) },
|
||||
{ "models", O(models), O(nummodels) },
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -45,10 +56,16 @@ bspinfo ()
|
|||
for (int i = 0; i < HEADER_LUMPS; i++) {
|
||||
lump_t *lump = &bsp->header->lumps[i];
|
||||
lumpinfo_t *info = &lump_info[i];
|
||||
const void *data = *(void **)((byte *) bsp + info->data);
|
||||
size_t *size = (size_t *)((byte *) bsp + info->size);
|
||||
const char *extra = "";
|
||||
|
||||
printf (" %-12s: %7d %7d %7zd\n", info->name,
|
||||
lump->fileofs, lump->filelen, *size);
|
||||
if (info->extra) {
|
||||
extra = info->extra (data);
|
||||
}
|
||||
|
||||
printf (" %-12s: %7d %7d %7zd%s\n", info->name,
|
||||
lump->fileofs, lump->filelen, *size, extra);
|
||||
|
||||
}
|
||||
for (unsigned i = 0; i < bsp->nummodels; i++) {
|
||||
|
|
Loading…
Reference in a new issue