From ef00485e5d26f0a4b8dd21af959a4695f833d770 Mon Sep 17 00:00:00 2001 From: Chris Brooke Date: Mon, 30 Jul 2012 23:24:29 +0100 Subject: [PATCH] Initial QuakeLive support. --- l_bsp_q3.c | 6 +++--- map.c | 7 +++++++ q3files.h | 7 +++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/l_bsp_q3.c b/l_bsp_q3.c index 525824d..e10044f 100644 --- a/l_bsp_q3.c +++ b/l_bsp_q3.c @@ -599,11 +599,11 @@ void Q3_LoadBSPFile(struct quakefile_s *qf) // swap the header Q3_SwapBlock( (int *)header, sizeof(*header) ); - if ( header->ident != Q3_BSP_IDENT ) { + if ( header->ident != Q3_BSP_IDENT && header->ident != QL_BSP_IDENT ) { Error( "%s is not a IBSP file", qf->filename ); } - if ( header->version != Q3_BSP_VERSION ) { - Error( "%s is version %i, not %i", qf->filename, header->version, Q3_BSP_VERSION ); + if ( header->version != Q3_BSP_VERSION && header->version != QL_BSP_VERSION ) { + Error( "%s is version %i, not (%i or %i)", qf->filename, header->version, Q3_BSP_VERSION, QL_BSP_VERSION ); } q3_numShaders = Q3_CopyLump( header, Q3_LUMP_SHADERS, (void *) &q3_dshaders, sizeof(q3_dshader_t) ); diff --git a/map.c b/map.c index deacec4..7527ee0 100644 --- a/map.c +++ b/map.c @@ -1212,6 +1212,13 @@ int LoadMapFromBSP(struct quakefile_s *qf) idheader.ident = LittleLong(idheader.ident); idheader.version = LittleLong(idheader.version); + //QuakeLive BSP file + if (idheader.ident == QL_BSP_IDENT && idheader.version == QL_BSP_VERSION) + { + ResetMapLoading(); + Q3_LoadMapFromBSP(qf); + Q3_FreeMaxBSP(); + } //end if //Quake3 BSP file if (idheader.ident == Q3_BSP_IDENT && idheader.version == Q3_BSP_VERSION) { diff --git a/q3files.h b/q3files.h index a28a341..2150948 100644 --- a/q3files.h +++ b/q3files.h @@ -204,6 +204,13 @@ typedef struct { #define Q3_BSP_VERSION 46 +// quick fix for creating aas files for ql bsp's. +// (later this will probably need to be seperated, if we plan to add further support for ql) +#define QL_BSP_IDENT (('P'<<24)+('S'<<16)+('B'<<8)+'I') + // little-endian "IBSP" + +#define QL_BSP_VERSION 47 +// *********************************************************** // there shouldn't be any problem with increasing these values at the // expense of more memory allocation in the utilities