From f35c156800c8abed1440b972d41cc784ae0e0476 Mon Sep 17 00:00:00 2001 From: Shpoike Date: Wed, 22 Jan 2025 05:31:22 +0000 Subject: [PATCH] Fix some build option compile errors. Strip a small bit of redundant code. --- engine/client/cl_input.c | 2 +- engine/client/m_options.c | 6 +++ engine/client/net_master.c | 6 +-- engine/client/pr_csqc.c | 72 ---------------------------------- engine/client/renderer.c | 46 +--------------------- engine/client/sbar.c | 4 ++ engine/common/com_bih.c | 2 + engine/common/config_minimal.h | 1 + engine/common/pr_common.h | 1 + engine/common/protocol.h | 2 + 10 files changed, 22 insertions(+), 120 deletions(-) diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index 7fdb94c01..b62babf59 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -854,8 +854,8 @@ qboolean IN_DrawWeaponWheel(int pnum) } void IN_WWheelDown (void) { -#ifdef CSQC_DAT int pnum = CL_TargettedSplit(false); +#ifdef CSQC_DAT if (CSQC_ConsoleCommand(pnum, Cmd_Argv(0))) return; #endif diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 3f797f565..8c9932a96 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -3506,7 +3506,9 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct emenu modelview_t *mods = c->dptr; skinfile_t *skin; texnums_t *texnums; +#ifdef SKELETALMODELS qboolean boneanimsonly; +#endif model_t *animmodel = NULL; if (R2D_Flush) @@ -3730,6 +3732,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct emenu } #endif +#ifdef SKELETALMODELS if (animmodel)// && Mod_GetNumBones(ent.model, false)==Mod_GetNumBones(animmodel, false)) { int numbones = Mod_GetNumBones(ent.model, false); @@ -3740,6 +3743,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct emenu ent.framestate.skeltype = SKEL_RELATIVE; } else +#endif animmodel = ent.model; //not using it. sorry. warn? @@ -3850,6 +3854,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct emenu } #endif } +#ifdef SKELETALMODELS boneanimsonly = false; if (ent.model && ent.model->loadstate == MLS_LOADED && ent.model->type == mod_alias) { //some models don't actually contain any mesh data, but exist as containers for skeletal animations that can be skel_built into a different model's anims. @@ -3908,6 +3913,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct emenu } } } +#endif V_AddAxisEntity(&ent); diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 29f2f6255..30f6c8515 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -3487,8 +3487,10 @@ static int CL_ReadServerInfo(char *msg, enum masterprotocol_e prototype, qboolea if (!MasterInfo_ReadProtocol(info, msg)) { //try and guess. + if (0) + ; #ifdef Q2CLIENT - if (prototype == MP_QUAKE2) + else if (prototype == MP_QUAKE2) info->special |= SS_QUAKE2; #endif #ifdef Q3CLIENT @@ -3499,9 +3501,7 @@ static int CL_ReadServerInfo(char *msg, enum masterprotocol_e prototype, qboolea else if (prototype == MP_NETQUAKE) info->special |= SS_NETQUAKE; #endif -#if defined(Q2CLIENT) || defined(Q3CLIENT) || defined(NQPROT) else -#endif info->special |= SS_QUAKEWORLD; } if (favorite) //was specifically named, not retrieved from a master. diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 09756e514..a53734f95 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -42,20 +42,10 @@ extern cvar_t sv_demo_write_csqc; static pubprogfuncs_t *csqcprogs; -typedef struct csqctreadstate_s { - float resumetime; - struct qcthread_s *thread; - int self; - int other; - - struct csqctreadstate_s *next; -} csqctreadstate_t; - static qboolean csprogs_promiscuous; static unsigned int csprogs_checksum; static size_t csprogs_checksize; static char csprogs_checkname[MAX_QPATH]; -static csqctreadstate_t *csqcthreads; qboolean csqc_resortfrags; world_t csqc_world; @@ -5239,50 +5229,6 @@ static void QCBUILTIN PF_cl_te_particlesnow (pubprogfuncs_t *prinst, struct glob P_RunParticleWeather(min, max, vel, howmany, colour, "snow"); } -void CSQC_RunThreads(void) -{ - csqctreadstate_t *state = csqcthreads, *next; - csqcthreads = NULL; - while(state) - { - next = state->next; - - if (state->resumetime > cl.servertime) - { //not time yet, reform original list. - state->next = csqcthreads; - csqcthreads = state; - } - else - { //call it and forget it ever happened. The Sleep biltin will recreate if needed. - - - *csqcg.self = EDICT_TO_PROG(csqcprogs, EDICT_NUM_UB(csqcprogs, state->self)); - *csqcg.other = EDICT_TO_PROG(csqcprogs, EDICT_NUM_UB(csqcprogs, state->other)); - - csqcprogs->RunThread(csqcprogs, state->thread); - csqcprogs->parms->memfree(state->thread); - csqcprogs->parms->memfree(state); - } - - state = next; - } -} - -static void QCBUILTIN PF_cs_addprogs (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) -{ - const char *s = PR_GetStringOfs(prinst, OFS_PARM0); - int newp; - if (!s || !*s) - newp = -1; - else - { - newp = PR_LoadProgs(prinst, s); - if (newp >= 0) - PR_ProgsAdded(csqcprogs, newp, s); - } - G_FLOAT(OFS_RETURN) = newp; -} - static void QCBUILTIN PF_cs_OpenPortal (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { int state = G_FLOAT(OFS_PARM1)!=0; @@ -7546,21 +7492,6 @@ static void VARGS CSQC_Abort (const char *format, ...) //an error occured. Host_EndGame("csqc error"); } -static void CSQC_ForgetThreads(void) -{ - csqctreadstate_t *state = csqcthreads, *next; - csqcthreads = NULL; - while(state) - { - next = state->next; - - csqcprogs->parms->memfree(state->thread); - csqcprogs->parms->memfree(state); - - state = next; - } -} - static void PDECL CSQC_EntSpawn (struct edict_s *e, int loading) { struct csqcedict_s *ent = (csqcedict_t*)e; @@ -7720,7 +7651,6 @@ void CSQC_Shutdown(void) Material_RegisterLoader(&csqc_world, NULL); key_dest_absolutemouse &= ~kdm_game; - CSQC_ForgetThreads(); PR_ReleaseFonts(kdm_game); PR_Common_Shutdown(csqcprogs, false); World_Destroy(&csqc_world); @@ -8885,8 +8815,6 @@ qboolean CSQC_DrawView(void) if (cl.worldmodel) Surf_LessenStains(); - CSQC_RunThreads(); //wake up any qc threads - #ifdef HAVE_LEGACY if (csqcg.autocvar_vid_conwidth) *csqcg.autocvar_vid_conwidth = vid.width; diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 6f55a12c4..9d4cd8036 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -1936,7 +1936,7 @@ TRACE(("dbg: R_ApplyRenderer: efrags\n")); void R_ReloadRenderer_f (void) { -#if !defined(CLIENTONLY) && (defined(Q2BSPS) || defined(Q3BSPS)) +#if !defined(CLIENTONLY) void *portalblob = NULL; size_t portalsize = 0; #endif @@ -2200,7 +2200,7 @@ static int QDECL R_SortRenderers(const void *av, const void *bv) void R_RestartRenderer (rendererstate_t *newr) { -#if !defined(CLIENTONLY) && (defined(Q2BSPS) || defined(Q3BSPS)) +#if !defined(CLIENTONLY) void *portalblob = NULL; size_t portalsize = 0; #endif @@ -2766,7 +2766,6 @@ int SignbitsForPlane (mplane_t *out) } return bits; } -#if 1 void R_SetFrustum (float projmat[16], float viewmat[16]) { float scale; @@ -2873,47 +2872,6 @@ void R_SetFrustum (float projmat[16], float viewmat[16]) p->signbits = SignbitsForPlane (p); } } -#else -void R_SetFrustum (void) -{ - int i; - - if (r_novis.ival & 4) - return; - - /* removed - assumes fov_x == fov_y - if (r_refdef.fov_x == 90) - { - // front side is visible - - VectorAdd (vpn, vright, frustum[0].normal); - VectorSubtract (vpn, vright, frustum[1].normal); - - VectorAdd (vpn, vup, frustum[2].normal); - VectorSubtract (vpn, vup, frustum[3].normal); - } - else - */ - { - - // rotate VPN right by FOV_X/2 degrees - RotatePointAroundVector( frustum[0].normal, vup, vpn, -(90-r_refdef.fov_x / 2 ) ); - // rotate VPN left by FOV_X/2 degrees - RotatePointAroundVector( frustum[1].normal, vup, vpn, 90-r_refdef.fov_x / 2 ); - // rotate VPN up by FOV_X/2 degrees - RotatePointAroundVector( frustum[2].normal, vright, vpn, 90-r_refdef.fov_y / 2 ); - // rotate VPN down by FOV_X/2 degrees - RotatePointAroundVector( frustum[3].normal, vright, vpn, -( 90 - r_refdef.fov_y / 2 ) ); - } - - for (i=0 ; i<4 ; i++) - { - frustum[i].type = PLANE_ANYZ; - frustum[i].dist = DotProduct (r_origin, frustum[i].normal); - frustum[i].signbits = SignbitsForPlane (&frustum[i]); - } -} -#endif diff --git a/engine/client/sbar.c b/engine/client/sbar.c index 19b239d44..0b03086a7 100644 --- a/engine/client/sbar.c +++ b/engine/client/sbar.c @@ -3725,12 +3725,15 @@ void Sbar_DeathmatchOverlay (playerview_t *pv, int start) cl.last_ping_request = realtime; CL_SendClientCommand(true, "pings"); } +#ifdef NQPROT else if (cls.protocol == CP_NETQUAKE && !cls.qex) { cl.last_ping_request = realtime; CL_SendClientCommand(true, "ping"); } +#endif } +#ifdef NQPROT if (cls.protocol == CP_NETQUAKE && !cls.qex) { if (cl.nqplayernamechanged && cl.nqplayernamechanged < realtime) @@ -3740,6 +3743,7 @@ void Sbar_DeathmatchOverlay (playerview_t *pv, int start) CL_SendClientCommand(true, "status"); } } +#endif if (start) y = start; diff --git a/engine/common/com_bih.c b/engine/common/com_bih.c index b61c252dc..66bc39447 100644 --- a/engine/common/com_bih.c +++ b/engine/common/com_bih.c @@ -1850,6 +1850,7 @@ void BIH_Build (model_t *mod, struct bihleaf_s *leafs, size_t numleafs) mod->funcs.PointContents = BIH_PointContents; mod->funcs.NativeContents = BIH_NativeContents; } +#ifdef SKELETALMODELS void BIH_BuildAlias (model_t *mod, galiasinfo_t *meshes) { size_t numleafs, i; @@ -1883,3 +1884,4 @@ void BIH_BuildAlias (model_t *mod, galiasinfo_t *meshes) } BIH_Build(mod, leafs, leaf-leafs); } +#endif diff --git a/engine/common/config_minimal.h b/engine/common/config_minimal.h index 2680d4253..d3503f1c3 100644 --- a/engine/common/config_minimal.h +++ b/engine/common/config_minimal.h @@ -44,6 +44,7 @@ #define MULTITHREAD //misc basic multithreading - dsound, downloads, basic stuff that's unlikely to have race conditions. #define LOADERTHREAD //worker threads for loading misc stuff. falls back on main thread if not supported. #define AVAIL_DINPUT +#define MAX_CLIENTS 32 //32 for vanilla qw. max 255. //#define SIDEVIEWS 4 //enable secondary/reverse views. //#define MAX_SPLITS 4u #define VERTEXINDEXBYTES 2 //16bit indexes work everywhere but may break some file types, 32bit indexes are optional in gles<=2 and d3d<=9 and take more memory/copying but allow for bigger batches/models. Plugins need to be compiled the same way so this is no longer set per-renderer. diff --git a/engine/common/pr_common.h b/engine/common/pr_common.h index 63980f2ba..429abb944 100644 --- a/engine/common/pr_common.h +++ b/engine/common/pr_common.h @@ -276,6 +276,7 @@ void QCBUILTIN PF_setattachment(pubprogfuncs_t *prinst, struct globalvars_s *pr_ #define PF_frameduration PF_Fixme #define PF_modelframecount PF_Fixme #define PF_frameforname PF_Fixme + #define PF_frameforaction PF_Fixme #define PF_skel_delete PF_Fixme #define PF_skel_copybones PF_Fixme #define PF_skel_premul_bones PF_Fixme diff --git a/engine/common/protocol.h b/engine/common/protocol.h index 6e5709b7b..5f6a4a2d9 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -1181,7 +1181,9 @@ enum { ========================================================== */ +#ifndef MAX_CLIENTS #define MAX_CLIENTS 255 /*max 255, min 32*/ +#endif #define QWMAX_CLIENTS 32 /*QW's standard max. clients might have issues above this value*/ #define NQMAX_CLIENTS 16 /*NQ's standard max. clients might have issues above this value*/