From 6e3846c8c344152b6867abf94852798be5ef2004 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 10 Feb 2009 06:30:50 +0000 Subject: [PATCH] retain _q3map2_version worldspawn tag when using -onlyents git-svn-id: svn://svn.icculus.org/netradiant/trunk@184 61c419a2-8eb2-4b30-bcec-8cead039b335 --- Makefile | 6 ++++-- tools/quake3/q3map2/bsp.c | 18 +++++++++++++++++- tools/quake3/q3map2/q3map2.h | 5 ++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c89da777..19fbfafd 100644 --- a/Makefile +++ b/Makefile @@ -202,16 +202,18 @@ endif endif # VERSION! -RADIANT_VERSION = 1.5.0 +RADIANT_VERSION = 1.5.0n RADIANT_MAJOR_VERSION = 5 RADIANT_MINOR_VERSION = 0 +Q3MAP_VERSION = 2.5.17n SVN_VERSION := $(shell $(SVNVERSION) -n $(STDERR_TO_DEVNULL) | $(SED) 's/M$$//g; s/.*://g;') ifneq ($(SVN_VERSION),) RADIANT_VERSION := $(RADIANT_VERSION)-svn$(SVN_VERSION) + Q3MAP_VERSION := $(Q3MAP_VERSION)-svn$(SVN_VERSION) endif -CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\"" +CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\"" -DQ3MAP_VERSION="\"$(Q3MAP_VERSION)\"" .PHONY: all all: \ diff --git a/tools/quake3/q3map2/bsp.c b/tools/quake3/q3map2/bsp.c index 9b695d02..b82eeec8 100644 --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@ -613,19 +613,35 @@ this is probably broken unless teamed with a radiant version that preserves enti void OnlyEnts( void ) { char out[ 1024 ]; - // TODO save and restore _q3map2_cmdline when doing this + + char save_cmdline[1024], save_version[1024]; + const char *p; /* note it */ Sys_Printf( "--- OnlyEnts ---\n" ); sprintf( out, "%s.bsp", source ); LoadBSPFile( out ); + + ParseEntities(); + p = ValueForKey(&entities[0], "_q3map2_cmdline"); + strncpy(save_cmdline, p, sizeof(save_cmdline)); + save_cmdline[sizeof(save_cmdline)-1] = 0; + p = ValueForKey(&entities[0], "_q3map2_version"); + strncpy(save_version, p, sizeof(save_version)); + save_version[sizeof(save_version)-1] = 0; + numEntities = 0; LoadShaderInfo(); LoadMapFile( name, qfalse ); SetModelNumbers(); SetLightStyles(); + + if(*save_cmdline) + SetKeyValue(&entities[0], "_q3map2_cmdline", save_cmdline); + if(*save_version) + SetKeyValue(&entities[0], "_q3map2_version", save_version); numBSPEntities = numEntities; UnparseEntities(); diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 8c972554..2ff8e713 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -35,11 +35,14 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2." /* version */ -#define Q3MAP_VERSION "2.5.17-div0" +#ifndef Q3MAP_VERSION +#error no Q3MAP_VERSION defined +#endif #define Q3MAP_MOTD "Your map saw the pretty lights from q3map2's BFG" + /* ------------------------------------------------------------------------------- dependencies -- 2.39.2