light: convert WriteLitFile to use the bspdata struct

Avoids reference to global LightDataSize.  Need to move writing the lit
file above the call to WriteBSPFile, since that will do the byte swapping.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2013-08-20 15:23:04 +09:30
parent 5facda6ff9
commit 6ddb109dde
3 changed files with 8 additions and 6 deletions

View File

@ -20,6 +20,8 @@
#ifndef __LIGHT_LITFILE_H__
#define __LIGHT_LITFILE_H__
#include <common/bspfile.h>
#define LIT_VERSION 1
typedef struct litheader_s {
@ -27,6 +29,6 @@ typedef struct litheader_s {
int version;
} litheader_t;
void WriteLitFile(const char *filename, int version);
void WriteLitFile(const bspdata_t *bsp, const char *filename, int version);
#endif /* __LIGHT_LITFILE_H__ */

View File

@ -302,13 +302,13 @@ main(int argc, const char **argv)
WriteEntitiesToString();
if (write_litfile)
WriteLitFile(&bsp, source, LIT_VERSION);
/* Still need to update from globals */
GetBSPGlobals(&bsp);
WriteBSPFile(source, &bsp, bsp_version);
if (write_litfile)
WriteLitFile(source, LIT_VERSION);
end = I_FloatTime();
logprint("%5.1f seconds elapsed\n", end - start);

View File

@ -23,7 +23,7 @@
#include <common/cmdlib.h>
void
WriteLitFile(const char *filename, int version)
WriteLitFile(const bspdata_t *bsp, const char *filename, int version)
{
FILE *litfile;
char litname[1024];
@ -41,6 +41,6 @@ WriteLitFile(const char *filename, int version)
litfile = SafeOpenWrite(litname);
SafeWrite(litfile, &header, sizeof(header));
SafeWrite(litfile, lit_filebase, lightdatasize * 3);
SafeWrite(litfile, lit_filebase, bsp->lightdatasize * 3);
fclose(litfile);
}