From 1a5c8da88081dc0bebccc58b52cda92bb1326fcc Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 8 Mar 2022 05:32:38 +0000 Subject: [PATCH] Make it easier to compile q3 statically. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6215 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile | 11 ++++++----- engine/common/config_fteqw.h | 1 + engine/common/plugin.c | 2 +- engine/common/q3common.c | 6 ++++++ engine/common/q3common.h | 3 +++ 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/engine/Makefile b/engine/Makefile index 6a12f3d3..68af7b19 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -134,8 +134,8 @@ endif ifeq (,$(findstring DNO_OPUS,$(FTE_CONFIG_EXTRA))) USE_OPUS=1 endif -ifeq (,$(findstring DNO_BOTLIB,$(FTE_CONFIG_EXTRA))) - USE_BOTLIB=1 +ifneq (,$(findstring DLINK_QUAKE3,$(FTE_CONFIG_EXTRA))) + LINK_QUAKE3=1 endif ifeq (,$(findstring DNO_VORBISFILE,$(FTE_CONFIG_EXTRA))) USE_VORBISFILE=1 @@ -944,9 +944,9 @@ COMMON_OBJS = \ q1bsp.o \ q2pmove.o -ifeq (1,$(USE_BOTLIB)) - BOTLIB_CFLAGS=-I$(BOTLIB_DIR) -DBOTLIB -DBOTLIB_STATIC - BOTLIB_OBJS = \ +ifeq (1,$(LINK_QUAKE3)) + ALL_CFLAGS+=-I$(BOTLIB_DIR) -DBOTLIB -DBOTLIB_STATIC -DSTATIC_Q3 + COMMON_OBJS += \ clq3_parse.o \ cl_ui.o \ cl_cg.o \ @@ -2534,4 +2534,5 @@ install: sv-rel gl-rel mingl-rel qcc-rel version: @echo $(SVN_VERSION) @echo $(SVN_DATE) + @echo $(FTE_CONFIG_EXTRA) diff --git a/engine/common/config_fteqw.h b/engine/common/config_fteqw.h index bcf8bae8..876692fb 100644 --- a/engine/common/config_fteqw.h +++ b/engine/common/config_fteqw.h @@ -208,6 +208,7 @@ #ifdef AVAIL_JPEGLIB -DLINK_JPEG #endif +//-DLINK_QUAKE3 //ask the makefile to bake the quake3 plugin into the engine itself. //-DNO_OPUS //-DNO_SPEEX //disable static speex diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 764a520d..54d6f431 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -42,7 +42,7 @@ static struct #endif #ifdef STATIC_Q3 - {"Q3", Plug_Q3_Init}, + {"quake3", Plug_Q3_Init}, #endif {NULL} }; diff --git a/engine/common/q3common.c b/engine/common/q3common.c index 56d01c4b..61b474a0 100644 --- a/engine/common/q3common.c +++ b/engine/common/q3common.c @@ -10,8 +10,10 @@ plugmsgfuncs_t *msgfuncs; plugworldfuncs_t *worldfuncs; plugmasterfuncs_t *masterfuncs; +#ifndef STATIC_Q3 double realtime; struct netprim_s msg_nullnetprim; +#endif //mostly for access to sv.state or svs.sockets q3serverstate_t sv3; @@ -1694,10 +1696,12 @@ static struct q3gamecode_s q3funcs = }, }; +#ifndef STATIC_Q3 void Q3_Frame(double enginetime, double gametime) { realtime = enginetime; } +#endif void Q3_Shutdown(void) { @@ -1731,7 +1735,9 @@ qboolean Plug_Init(void) Con_Printf("Engine is already using a q3-derived gamecode plugin.\n"); return false; } +#ifndef STATIC_Q3 plugfuncs->ExportFunction("Tick", Q3_Frame); +#endif drawfuncs = plugfuncs->GetEngineInterface(plug2dfuncs_name, sizeof(*drawfuncs)); scenefuncs = plugfuncs->GetEngineInterface(plug3dfuncs_name, sizeof(*scenefuncs)); diff --git a/engine/common/q3common.h b/engine/common/q3common.h index a265d925..2e575569 100644 --- a/engine/common/q3common.h +++ b/engine/common/q3common.h @@ -1,3 +1,6 @@ +#ifndef FTEPLUGIN +#define FTEPLUGIN +#endif #include "../plugins/plugin.h" #include "clq3defs.h"