diff --git a/tools/qfcc/doc/man/qfcc.1 b/tools/qfcc/doc/man/qfcc.1 index 3d81958ba..0bdfcfb15 100644 --- a/tools/qfcc/doc/man/qfcc.1 +++ b/tools/qfcc/doc/man/qfcc.1 @@ -113,7 +113,7 @@ Specify output file name. In \fBprogs.src\fP mode, this overrides the output file in \*[progs.src]. .TP .B \-\-progdefs -Generate \fIprogdefs.h\fP. +Generate \fIprogdefs.h\fP. Forces \fB\-\-code crc\fP. .TP .B \-P, \-\-progs\-src FILE File to use instead of \*[progs.src]. @@ -192,6 +192,11 @@ that assigns values to initialized globals in this manner. Preprocess all input files with \*[cpp]. This includes the \*[progs.src] file when used. .TP +.B crc +Write the CRC of \fBprogdefs.h\fP to \*(lqprogs.dat\*(rq. Default for v6 progs, +otherwise defaults to off. However, \fB\-\-progdefs\fP has the effect of +forcing this option. +.TP .B debug Generate debug code for QuakeForge engines. The QuakeForge engine has the ability to load line number and other debugging diff --git a/tools/qfcc/include/options.h b/tools/qfcc/include/options.h index 2d05e8e76..d154aee13 100644 --- a/tools/qfcc/include/options.h +++ b/tools/qfcc/include/options.h @@ -35,6 +35,7 @@ typedef struct { qboolean cow; // Turn constants into variables if written to + qboolean crc; // Write progsdef.h crc to progs.dat qboolean debug; // Generate debug info for the engine qboolean short_circuit; // short circuit logic for && and || qboolean fast_float; // use floats directly in ifs diff --git a/tools/qfcc/source/options.c b/tools/qfcc/source/options.c index bd1d09734..0c738156a 100644 --- a/tools/qfcc/source/options.c +++ b/tools/qfcc/source/options.c @@ -184,6 +184,7 @@ code_usage (void) printf ( " [no-]cow Allow assignment to initialized globals.\n" " [no-]cpp Preprocess all input files with cpp.\n" +" [no-]crc Write progdefs.h crc to progs.dat.\n" " [no-]debug Generate debug information.\n" " [no-]fast-float Use float values directly in \"if\" statements.\n" " help Display his text.\n" @@ -274,6 +275,7 @@ DecodeArgs (int argc, char **argv) options.code.short_circuit = -1; options.code.local_merging = -1; options.code.vector_components = -1; + options.code.crc = -1; options.code.fast_float = true; options.warnings.uninited_variable = true; options.warnings.unused = true; @@ -381,6 +383,8 @@ DecodeArgs (int argc, char **argv) options.code.cow = flag; } else if (!(strcasecmp (temp, "cpp"))) { cpp_name = flag ? CPP_NAME : 0; + } else if (!(strcasecmp (temp, "crc"))) { + options.code.crc = flag; } else if (!(strcasecmp (temp, "debug"))) { options.code.debug = flag; } else if (!(strcasecmp (temp, "fast-float"))) { @@ -580,8 +584,14 @@ DecodeArgs (int argc, char **argv) if (options.code.vector_components == (qboolean) -1) options.code.vector_components = false; } - if (options.code.progsversion == PROG_ID_VERSION) + if (options.code.progsversion == PROG_ID_VERSION) { add_cpp_def ("-D__VERSION6__=1"); + if (options.code.crc == (qboolean) -1) + options.code.crc = true; + } else { + if (options.code.crc == (qboolean) -1) + options.code.crc = false; + } // add the default paths if (!options.no_default_paths) { diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index 888241d1a..3b1234fb1 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -378,8 +378,12 @@ finish_link (void) //finish_compilation (); // write progdefs.h - if (options.progdefs_h) - progs->crc = WriteProgdefs (progs, "progdefs.h"); + if (options.code.crc || options.progdefs_h) { + const char *progdefs_h = "progdefs.h"; + if (!options.progdefs_h) + progdefs_h = 0; + progs->crc = WriteProgdefs (progs, progdefs_h); + } WriteProgs (progs, size); if (options.code.debug) {