diff --git a/common/bspfile.c b/common/bspfile.c index 35e07cfa..f6a5fbd7 100644 --- a/common/bspfile.c +++ b/common/bspfile.c @@ -207,17 +207,17 @@ CopyLump(const dheader_t *header, int lumpnum, void *destptr) * LoadBSPFile * ============= */ -int +void LoadBSPFile(const char *filename, bspdata_t *bsp) { dheader_t *header; - int i, version; + int i; /* load the file header */ LoadFile(filename, &header); /* check the file version */ - version = header->version = LittleLong(header->version); + bsp->version = header->version = LittleLong(header->version); logprint("BSP is version %i\n", header->version); if (header->version != BSPVERSION) Error("Sorry, only bsp version %d supported.", BSPVERSION); @@ -252,9 +252,6 @@ LoadBSPFile(const char *filename, bspdata_t *bsp) /* swap everything */ SwapBSPFile(bsp, TO_CPU); - - /* Return the version */ - return version; } /* ========================================================================= */ @@ -285,7 +282,7 @@ AddLump(bspfile_t *bspfile, int lumpnum, const void *data, int count) * ============= */ void -WriteBSPFile(const char *filename, bspdata_t *bsp, int version) +WriteBSPFile(const char *filename, bspdata_t *bsp) { bspfile_t bspfile; @@ -293,8 +290,8 @@ WriteBSPFile(const char *filename, bspdata_t *bsp, int version) SwapBSPFile(bsp, TO_DISK); - bspfile.header.version = LittleLong(version); - logprint("Writing BSP version %i\n", bspfile.header.version); + bspfile.header.version = LittleLong(bsp->version); + logprint("Writing BSP version %i\n", bsp->version); bspfile.file = SafeOpenWrite(filename); /* Save header space, updated after adding the lumps */ diff --git a/include/common/bspfile.h b/include/common/bspfile.h index 7fc93b6d..16298798 100644 --- a/include/common/bspfile.h +++ b/include/common/bspfile.h @@ -254,6 +254,8 @@ typedef union { /* ========================================================================= */ typedef struct { + int version; + int nummodels; dmodel_t *dmodels; @@ -300,9 +302,8 @@ typedef struct { int32_t *dsurfedges; } bspdata_t; -/* LoadBSPFile returns the BSP version... */ -int LoadBSPFile(const char *filename, bspdata_t *bsp); -void WriteBSPFile(const char *filename, bspdata_t *bsp, int version); +void LoadBSPFile(const char *filename, bspdata_t *bsp); +void WriteBSPFile(const char *filename, bspdata_t *bsp); void PrintBSPFileSizes(const bspdata_t *bsp); #endif /* __COMMON_BSPFILE_H__ */ diff --git a/light/light.c b/light/light.c index 52946673..882e04fd 100644 --- a/light/light.c +++ b/light/light.c @@ -214,7 +214,7 @@ int main(int argc, const char **argv) { bspdata_t bsp; - int i, bsp_version; + int i; double start; double end; char source[1024]; @@ -292,7 +292,7 @@ main(int argc, const char **argv) strcpy(source, argv[i]); StripExtension(source); DefaultExtension(source, ".bsp"); - bsp_version = LoadBSPFile(source, &bsp); + LoadBSPFile(source, &bsp); LoadEntities(&bsp); MakeTnodes(&bsp); @@ -306,7 +306,7 @@ main(int argc, const char **argv) if (write_litfile) WriteLitFile(&bsp, source, LIT_VERSION); - WriteBSPFile(source, &bsp, bsp_version); + WriteBSPFile(source, &bsp); end = I_FloatTime(); logprint("%5.1f seconds elapsed\n", end - start); diff --git a/vis/vis.c b/vis/vis.c index eccb488d..f6aa9397 100644 --- a/vis/vis.c +++ b/vis/vis.c @@ -1175,7 +1175,7 @@ int main(int argc, char **argv) { bspdata_t bsp; - int i, bsp_version; + int i; init_log("vis.log"); logprint("---- vis / TyrUtils " stringify(TYRUTILS_VERSION) " ----\n"); @@ -1238,7 +1238,7 @@ main(int argc, char **argv) StripExtension(sourcefile); DefaultExtension(sourcefile, ".bsp"); - bsp_version = LoadBSPFile(sourcefile, &bsp); + LoadBSPFile(sourcefile, &bsp); strcpy(portalfile, argv[i]); StripExtension(portalfile); @@ -1270,7 +1270,7 @@ main(int argc, char **argv) CalcAmbientSounds(&bsp); - WriteBSPFile(sourcefile, &bsp, bsp_version); + WriteBSPFile(sourcefile, &bsp); // unlink (portalfile);