Skip to content

Commit

Permalink
Fix up some obscure builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shpoike committed Apr 17, 2023
1 parent 8c8a4ea commit 1ce399e
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 41 deletions.
2 changes: 1 addition & 1 deletion engine/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ void CL_CheckForResend (void)
}
else
{
CL_ConnectAbort ("No route to host, giving up\n");
CL_ConnectAbort ("Unable to connect to %s, giving up\n", cls.servername);

NET_CloseClient();
}
Expand Down
3 changes: 1 addition & 2 deletions engine/client/cl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -978,10 +978,9 @@ qboolean CL_CheckOrEnqueDownloadFile (const char *filename, const char *localnam

if (flags & DLLF_ALLOWWEB)
{
extern cvar_t sv_dlURL;
const char *dlURL = InfoBuf_ValueForKey(&cl.serverinfo, "sv_dlURL");
if (!*dlURL)
dlURL = sv_dlURL.string;
dlURL = fs_dlURL.string;
flags &= ~(DLLF_TRYWEB|DLLF_ALLOWWEB);
if (*dlURL && (flags & DLLF_NONGAME) && !strncmp(filename, "package/", 8))
{ //filename is something like: package/GAMEDIR/foo.pk3
Expand Down
24 changes: 18 additions & 6 deletions engine/client/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1512,20 +1512,32 @@ static int QDECL V_DepthSortTwoEntities(const void *p1,const void *p2)
}
void V_DepthSortEntities(float *vieworg)
{
int i;
int i, j;
vec3_t disp;
for (i = 0; i < cl_numvisedicts; i++)
{
if (cl_visedicts[i].flags & RF_WEAPONMODEL)
{ //weapon models have their own extra matrix thing going on. don't mess up because of it.
cl_visedicts[i].angles[0] = 0;
//however, qsort is not stable so hide ordering in here so they still come out with the same ordering, at least with respect to each other.
cl_visedicts[i].angles[0] = -1-i;
continue;
}
if (cl_visedicts[i].rtype == RT_MODEL && cl_visedicts[i].model && cl_visedicts[i].model->type == mod_brush)
{
VectorAdd(cl_visedicts[i].model->maxs, cl_visedicts[i].model->mins, disp);
VectorMA(cl_visedicts[i].origin, 0.5, disp, disp);
VectorSubtract(disp, vieworg, disp);
if (1)
{ //by nearest point.
for (j=0 ; j<3 ; j++)
{
disp[j] = vieworg[j] - cl_visedicts[i].origin[j];
disp[j] -= bound(cl_visedicts[i].model->mins[j], disp[j], cl_visedicts[i].model->maxs[j]);
}
}
else
{ //by midpoint...
VectorAdd(cl_visedicts[i].model->maxs, cl_visedicts[i].model->mins, disp);
VectorMA(cl_visedicts[i].origin, 0.5, disp, disp);
VectorSubtract(disp, vieworg, disp);
}
}
else
{
Expand Down Expand Up @@ -2181,7 +2193,7 @@ void R_DrawNameTags(void)
}
else
#endif
if (w && w->progs && svs.gametype == GT_PROGS)
if (w && w->progs && w->progs->saveent)
{
int best = 0;
float bestscore = 0, score = 0;
Expand Down
6 changes: 6 additions & 0 deletions engine/common/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ static cvar_t fs_gamepath = CVARAFD ("fs_gamepath"/*q3ish*/, "", "fs_gamedir"/
static cvar_t fs_basepath = CVARAFD ("fs_basepath"/*q3*/, "", "fs_basedir"/*q2*/, CVAR_NOUNSAFEEXPAND|CVAR_NOSET|CVAR_NOSAVE, "Provided for Q2/Q3 compat. System path of the base directory.");
static cvar_t fs_homepath = CVARAFD ("fs_homepath"/*q3ish*/, "", "fs_homedir"/*q2ish*/, CVAR_NOUNSAFEEXPAND|CVAR_NOSET|CVAR_NOSAVE, "Provided for Q2/Q3 compat. System path of the base directory.");
static cvar_t dpcompat_ignoremodificationtimes = CVARAFD("fs_packageprioritisation", "1", "dpcompat_ignoremodificationtimes", CVAR_NOUNSAFEEXPAND|CVAR_NOSAVE, "Favours the package that is:\n0: Most recently modified\n1: Is alphabetically last (favour z over a, 9 over 0).");
#ifdef FTE_TARGET_WEB
cvar_t fs_dlURL = CVARAFD(/*ioq3*/"sv_dlURL", "", /*dp*/"sv_curl_defaulturl", CVAR_SERVERINFO|CVAR_NOSAVE, "Provides clients with an external url from which they can obtain pk3s/packages from an external http server instead of having to download over udp.");
#else
cvar_t fs_dlURL = CVARAFD(/*ioq3*/"sv_dlURL", "", /*dp*/"sv_curl_defaulturl", CVAR_SERVERINFO|CVAR_ARCHIVE, "Provides clients with an external url from which they can obtain pk3s/packages from an external http server instead of having to download over udp.");
#endif
int active_fs_cachetype;
static int fs_referencetype;
int fs_finds;
Expand Down Expand Up @@ -7717,6 +7722,7 @@ void COM_InitFilesystem (void)
Cvar_Register(&fs_gamepath, "Filesystem");
Cvar_Register(&fs_basepath, "Filesystem");
Cvar_Register(&fs_homepath, "Filesystem");
Cvar_Register(&fs_dlURL, "Filesystem");

COM_InitHomedir(NULL);

Expand Down
1 change: 1 addition & 0 deletions engine/common/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern int fs_hash_files; //for tracking efficiency. no functional use.
extern qboolean fs_readonly; //if true, fopen(, "w") should always fail.
extern void *fs_thread_mutex;
extern float fs_accessed_time;
extern cvar_t fs_dlURL;

struct searchpath_s;
struct searchpathfuncs_s
Expand Down
14 changes: 12 additions & 2 deletions engine/common/gl_q2bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ struct cminfo_s;

void CM_Init(void);

static qboolean CM_HeadnodeVisible (struct model_s *mod, int nodenum, const qbyte *visbits);
static qboolean VARGS CM_AreasConnected (struct model_s *mod, unsigned int area1, unsigned int area2);
static size_t CM_WriteAreaBits (struct model_s *mod, qbyte *buffer, size_t buffersize, int area, qboolean merge);
static qbyte *CM_ClusterPVS (struct model_s *mod, int cluster, pvsbuffer_t *buffer, pvsmerge_t merge);
Expand All @@ -82,9 +81,12 @@ static void CM_SetAreaPortalState (model_t *mod, unsigned int portalnum, unsigne
static size_t CM_SaveAreaPortalBlob (model_t *mod, void **data);
static size_t CM_LoadAreaPortalBlob (model_t *mod, void *ptr, size_t ptrsize);

#ifdef HAVE_SERVER
static unsigned int Q23BSP_FatPVS(model_t *mod, const vec3_t org, pvsbuffer_t *buffer, qboolean merge);
static qboolean Q23BSP_EdictInFatPVS(model_t *mod, const struct pvscache_s *ent, const qbyte *pvs, const int *areas);
static void Q23BSP_FindTouchedLeafs(model_t *mod, struct pvscache_s *ent, const float *mins, const float *maxs);
static qboolean CM_HeadnodeVisible (struct model_s *mod, int nodenum, const qbyte *visbits);
#endif

#ifdef HAVE_CLIENT
static void CM_PrepareFrame(model_t *mod, refdef_t *refdef, int area, int viewclusters[2], pvsbuffer_t *vis, qbyte **entvis_out, qbyte **surfvis_out);
Expand Down Expand Up @@ -4123,7 +4125,7 @@ static void CM_OpenAllPortals(model_t *mod, char *ents) //this is a compleate ha
#endif


#if defined(HAVE_SERVER) && defined(Q3BSPS)
#if defined(Q3BSPS)
static void CalcClusterPHS(cminfo_t *prv, int cluster)
{
int j, k, l, index;
Expand Down Expand Up @@ -4167,6 +4169,8 @@ static void CalcClusterPHS(cminfo_t *prv, int cluster)
}
prv->phscalced[cluster>>3] |= 1<<(cluster&7);
}
#endif
#if defined(HAVE_SERVER) && defined(Q3BSPS)
static void CMQ3_CalcPHS (model_t *mod)
{
cminfo_t *prv = (cminfo_t*)mod->meshinfo;
Expand Down Expand Up @@ -5197,12 +5201,14 @@ static int CM_PointLeafnum_r (model_t *mod, const vec3_t p, int num)
return -1 - num;
}

#ifdef HAVE_SERVER
static int CM_PointLeafnum (model_t *mod, const vec3_t p)
{
if (!mod || mod->loadstate != MLS_LOADED)
return 0; // sound may call this without map loaded
return CM_PointLeafnum_r (mod, p, 0);
}
#endif

static int CM_PointCluster (model_t *mod, const vec3_t p, int *area)
{
Expand Down Expand Up @@ -6884,6 +6890,7 @@ static qbyte *CM_ClusterPHS (model_t *mod, int cluster, pvsbuffer_t *buffer)
return buffer->buffer;
}

#ifdef HAVE_SERVER
static unsigned int SV_Q2BSP_FatPVS (model_t *mod, const vec3_t org, pvsbuffer_t *result, qboolean merge)
{
int leafs[64];
Expand Down Expand Up @@ -7053,6 +7060,7 @@ static void Q23BSP_FindTouchedLeafs(model_t *model, struct pvscache_s *ent, cons
}
}
}
#endif

/*
===============================================================================
Expand Down Expand Up @@ -7314,6 +7322,7 @@ static size_t CM_LoadAreaPortalBlob (model_t *mod, void *ptr, size_t ptrsize)
return 0;
}

#ifdef HAVE_SERVER
/*
=============
CM_HeadnodeVisible
Expand Down Expand Up @@ -7344,6 +7353,7 @@ static qboolean CM_HeadnodeVisible (model_t *mod, int nodenum, const qbyte *visb
return true;
return CM_HeadnodeVisible(mod, node->childnum[1], visbits);
}
#endif

static unsigned int Q2BSP_PointContents(model_t *mod, const vec3_t axis[3], const vec3_t p)
{
Expand Down
4 changes: 4 additions & 0 deletions engine/common/net_ssl_winsspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ Note: testing this stuff is a pain when eg browsers do NOT support DTLS1.0 any m
#define SECPKG_ATTR_DTLS_MTU 34
#endif

#ifndef CRYPT_ARCHIVABLE
#define CRYPT_ARCHIVABLE 0x00004000
#endif


//hungarian ensures we hit no macros.
static struct
Expand Down
4 changes: 4 additions & 0 deletions engine/common/net_wins.c
Original file line number Diff line number Diff line change
Expand Up @@ -5531,6 +5531,7 @@ void FTENET_TCP_PrintStatus(ftenet_generic_connection_t *gcon)
static qboolean FTENET_TCP_KillStream(ftenet_tcp_connection_t *con, ftenet_tcp_stream_t *st, const char *reason)
{ //some sort of error. kill the connection info (will be cleaned up later)

#ifdef HAVE_HTTPSV
if (st->clienttype == TCPC_WEBRTC_CLIENT && st->clientstream && !strcmp(st->webrtc.resource, st->webrtc.resource))
{
qbyte msg[256];
Expand All @@ -5541,6 +5542,7 @@ static qboolean FTENET_TCP_KillStream(ftenet_tcp_connection_t *con, ftenet_tcp_s

FTENET_TCP_WebSocket_Splurge(st, WS_PACKETTYPE_BINARYFRAME, msg, 3+strlen(msg+3));
}
#endif

#ifdef HAVE_EPOLL
if (st->socketnum != INVALID_SOCKET)
Expand Down Expand Up @@ -6312,6 +6314,7 @@ static qboolean FTENET_TCP_GetPacket(ftenet_generic_connection_t *gcon)
}
FTENET_TCP_Flush(con, st);

#ifdef HAVE_HTTPSV
if (st->clienttype==TCPC_WEBRTC_CLIENT && st->webrtc.target.type!=NA_INVALID && st->webrtc.resendtime < timeval && st->clientstream)
{
if (st->webrtc.offer)
Expand Down Expand Up @@ -6385,6 +6388,7 @@ static qboolean FTENET_TCP_GetPacket(ftenet_generic_connection_t *gcon)
else
st->webrtc.resendtime = timeval + 30;
}
#endif
}

if (con->generic.thesocket != INVALID_SOCKET && con->active < 256)
Expand Down
9 changes: 7 additions & 2 deletions engine/common/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ static qhandle_t QDECL Plug_FS_Open(const char *fname, qhandle_t *outhandle, int
#ifndef WEBCLIENT
f = NULL;
#else
Con_DPrintf("Plugin %s requesting %s\n", currentplug->name, fname);
Con_Printf("Plugin %s requesting %s\n", currentplug->name, fname);
handle = Plug_NewStreamHandle(STREAM_WEB);
pluginstreamarray[handle].dl = HTTP_CL_Get(fname, NULL, Plug_DownloadComplete);
pluginstreamarray[handle].dl->user_num = handle;
Expand Down Expand Up @@ -2033,10 +2033,15 @@ static void *QDECL PlugBI_GetEngineInterface(const char *interfacename, size_t s
InfoBuf_ValueForKey,
Info_ValueForKey,
Info_SetValueForKey,

#ifdef HAVE_SERVER
SV_DropClient,
SV_ExtractFromUserinfo,
SV_ChallengePasses,
#else
NULL,
NULL,
NULL,
#endif
};
if (structsize == sizeof(funcs))
return &funcs;
Expand Down
4 changes: 2 additions & 2 deletions engine/common/pr_bgcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3942,7 +3942,7 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
for (j=0 ; j<3 ; j++)
{
eorg[j] = org[j] - ent->v->origin[j];
eorg[j] -= bound(ent->v->mins[j], org[j], ent->v->maxs[j]);
eorg[j] -= bound(ent->v->mins[j], eorg[j], ent->v->maxs[j]);
}
}
else
Expand Down Expand Up @@ -3972,7 +3972,7 @@ void QCBUILTIN PF_findradius (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
for (j=0 ; j<3 ; j++)
{
eorg[j] = org[j] - ent->v->origin[j];
eorg[j] -= bound(ent->v->mins[j], org[j], ent->v->maxs[j]);
eorg[j] -= bound(ent->v->mins[j], eorg[j], ent->v->maxs[j]);
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion engine/common/q3api.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct q3gamecode_s
void (*SendAuthPacket)(struct ftenet_connections_s *socket, netadr_t *gameserver);
void (*SendConnectPacket)(struct ftenet_connections_s *socket, netadr_t *to, int challenge, int qport, infobuf_t *userinfo);
void (*Established)(void);
void (*VARGS SendClientCommand)(const char *fmt, ...) LIKEPRINTF(1);
void (VARGS *SendClientCommand)(const char *fmt, ...) LIKEPRINTF(1);
void (*SendCmd)(struct ftenet_connections_s *socket, struct usercmd_s *cmd, unsigned int movesequence, double gametime);
int (*ParseServerMessage) (sizebuf_t *msg);
void (*Disconnect) (struct ftenet_connections_s *socket); //disconnects from the server, killing all connection+cgame state.
Expand Down
6 changes: 0 additions & 6 deletions engine/server/sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ extern cvar_t password;
#endif
cvar_t spectator_password = CVARF("spectator_password", "", CVAR_NOUNSAFEEXPAND); // password for entering as a sepctator

#ifdef FTE_TARGET_WEB
cvar_t sv_dlURL = CVARAFD(/*ioq3*/"sv_dlURL", "", /*dp*/"sv_curl_defaulturl", CVAR_SERVERINFO|CVAR_NOSAVE, "Provides clients with an external url from which they can obtain pk3s/packages from an external http server instead of having to download over udp.");
#else
cvar_t sv_dlURL = CVARAFD(/*ioq3*/"sv_dlURL", "", /*dp*/"sv_curl_defaulturl", CVAR_SERVERINFO|CVAR_ARCHIVE, "Provides clients with an external url from which they can obtain pk3s/packages from an external http server instead of having to download over udp.");
#endif
cvar_t allow_download = CVARAD("allow_download", "1", /*q3*/"sv_allowDownload", "If 1, permits downloading. Set to 0 to unconditionally block *ALL* downloads from this server. You may wish to set sv_dlURL if you wish clients to still be able to download content.");
cvar_t allow_download_skins = CVARD("allow_download_skins", "1", "0 blocks downloading of any file in the skins/ directory");
cvar_t allow_download_models = CVARD("allow_download_models", "1", "0 blocks downloading of any file in the progs/ or models/ directory");
Expand Down Expand Up @@ -5898,7 +5893,6 @@ void SV_InitLocal (void)

Cvar_Register (&filterban, cvargroup_servercontrol);

Cvar_Register (&sv_dlURL, cvargroup_serverpermissions);
Cvar_Register (&allow_download, cvargroup_serverpermissions);
Cvar_Register (&allow_download_skins, cvargroup_serverpermissions);
Cvar_Register (&allow_download_models, cvargroup_serverpermissions);
Expand Down
Loading

0 comments on commit 1ce399e

Please sign in to comment.