reworked menusys combo items, as per mushi's request. should be a bit prettier now.

fixed most gcc warnings when compiling for linux.
client can now connect to 10002 servers. probably 10000+10001 too, but too lazy to test.
doom3 map loading is working again, but has too many issues for it to be useful (leaks, premature purges, no texture_d suffix support), so its still disabled for now.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4999 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2016-02-15 06:01:17 +00:00
parent 46c63cbedb
commit 5920bf05fb
98 changed files with 1037 additions and 763 deletions

View file

@ -1104,6 +1104,7 @@ ifneq (,$(findstring linux,$(FTE_TARGET)))
SV_DIR=sv_linux$(BITS)
SV_EXE_NAME=../fteqw.sv$(BITS)
SV_LDFLAGS=
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -DMULTITHREAD
NPFTE_OBJS=httpclient.o image.o sys_linux_threads.o sys_npfte.o sys_axfte.o sys_plugfte.o
NPFTE_DLL_NAME=../npfte$(BITS).so

View file

@ -1739,10 +1739,11 @@ int AAS_AreaRouteToGoalArea(int areanum, vec3_t origin, int goalareanum, int tra
// into the portal area
t += aasworld.portalmaxtraveltimes[portalnum];
//
if (origin)
{
*reachnum = aasworld.areasettings[areanum].firstreachablearea +
areacache->reachabilities[clusterareanum];
if (origin)
{
reach = aasworld.reachability + *reachnum;
t += AAS_AreaTravelTime(areanum, origin, reach->start);
} //end if

View file

@ -919,7 +919,6 @@ void Cam_Track(playerview_t *pv, usercmd_t *cmd)
void Cam_SetModAutoTrack(int userid)
{ //this is a hint from the server about who to track
int slot;
playerview_t *pv = &cl.playerview[0];
cl.autotrack_hint = -1;
for (slot = 0; slot < cl.allocated_client_slots; slot++)
{

View file

@ -397,8 +397,9 @@ typedef struct {
size_t maxfrags;
size_t numfrags;
} q3markFragment_ctx_t;
static void CG_MarkFragments_Callback(q3markFragment_ctx_t *ctx, vec3_t *fte_restrict points, size_t numtris, shader_t *shader)
static void CG_MarkFragments_Callback(void *vctx, vec3_t *fte_restrict points, size_t numtris, shader_t *shader)
{
q3markFragment_ctx_t *ctx = vctx;
size_t i;
if (numtris > ctx->maxfrags-ctx->numfrags)
numtris = ctx->maxfrags-ctx->numfrags;

View file

@ -1986,7 +1986,10 @@ vfsfile_t *CL_OpenFileInZipOrSys(char *name, qboolean usesystempath)
//tries to determine the demo type
void CL_PlayDemoFile(vfsfile_t *f, char *demoname, qboolean issyspath)
{
qofs_t start;
#if defined(Q2CLIENT) || defined(NQPROT)
//figure out where we started
qofs_t start = VFS_TELL(f);
#endif
if (!VFS_GETLEN (f))
{
@ -1995,9 +1998,6 @@ void CL_PlayDemoFile(vfsfile_t *f, char *demoname, qboolean issyspath)
return;
}
//figure out where we started
start = VFS_TELL(f);
#ifdef Q2CLIENT
{
int len;
@ -2015,6 +2015,7 @@ void CL_PlayDemoFile(vfsfile_t *f, char *demoname, qboolean issyspath)
CL_PlayDemoStream(f, NULL, demoname, issyspath, DPB_QUAKE2, 0);
return;
}
VFS_SEEK(f, start);
}
#endif

View file

@ -1580,7 +1580,12 @@ void CLNQ_ParseEntity(unsigned int bits)
state->dpflags = (bits & NQU_NOLERP)?RENDER_STEP:0;
if (bits & NQU_MODEL)
{
if (CPNQ_IS_BJP)
state->modelindex = MSG_ReadShort ();
else
state->modelindex = MSG_ReadByte ();
}
if (bits & NQU_FRAME)
state->frame = MSG_ReadByte();
@ -2438,7 +2443,6 @@ void CLQ1_AddVisibleBBoxes(void)
wedict_t *e;
int i;
shader_t *s;
extern world_t csqc_world;
vec3_t min, max, size;
switch(r_showbboxes.ival & 3)
@ -2453,7 +2457,10 @@ void CLQ1_AddVisibleBBoxes(void)
#endif
#ifdef CSQC_DAT
case 2:
{
extern world_t csqc_world;
w = &csqc_world;
}
break;
#endif
case 3:

View file

@ -732,15 +732,15 @@ void CL_CheckForResend (void)
{
extern cvar_t dpcompat_nopreparse;
memset(&connectinfo, 0, sizeof(connectinfo));
Q_strncpyz (cls.servername, "internalserver", sizeof(cls.servername));
Cvar_ForceSet(&cl_servername, cls.servername);
if (!NET_StringToAdr(cls.servername, 0, &connectinfo.adr))
return; //erk?
connectinfo.trying = true;
connectinfo.istransfer = false;
NET_InitClient(true);
Q_strncpyz (cls.servername, "internalserver", sizeof(cls.servername));
Cvar_ForceSet(&cl_servername, cls.servername);
NET_StringToAdr(cls.servername, 0, &connectinfo.adr);
cls.state = ca_disconnected;
switch (svs.gametype)
{
@ -1363,7 +1363,11 @@ void CL_Rcon_f (void)
return;
}
NET_StringToAdr (rcon_address.string, PORT_QWSERVER, &to);
if (!NET_StringToAdr (rcon_address.string, PORT_QWSERVER, &to))
{
Con_Printf("Unable to resolve target address\n");
return;
}
}
NET_SendPacket (NS_CLIENT, strlen(message)+1, message, &to);
@ -1715,7 +1719,7 @@ void CL_Disconnect (void)
Alias_WipeStuffedAliases();
//now start up the csqc/menu module again.
// CSQC_UnconnectedInit();
// (void)CSQC_UnconnectedInit();
}
#undef serverrunning
@ -1732,7 +1736,7 @@ void CL_Disconnect_f (void)
connectinfo.trying = false;
CSQC_UnconnectedInit();
(void)CSQC_UnconnectedInit();
}
/*
@ -2730,7 +2734,8 @@ void CL_ConnectionlessPacket (void)
netadr_t adr;
char *data = MSG_ReadStringLine();
Con_TPrintf ("redirect to %s\n", data);
NET_StringToAdr(data, PORT_QWSERVER, &adr);
if (NET_StringToAdr(data, PORT_QWSERVER, &adr))
{
data = "\xff\xff\xff\xffgetchallenge\n";
if (NET_CompareAdr(&connectinfo.adr, &net_from))
@ -2739,6 +2744,7 @@ void CL_ConnectionlessPacket (void)
connectinfo.adr = adr;
NET_SendPacket (NS_CLIENT, strlen(data), data, &adr);
}
}
return;
}
else if (!strcmp(s, "reject"))
@ -4463,6 +4469,7 @@ void Host_RunFilePrompted(void *ctx, int button)
Host_DoRunFile(f);
}
#ifdef WEBCLIENT
static qboolean isurl(char *url)
{
#ifdef FTE_TARGET_WEB
@ -4470,6 +4477,7 @@ static qboolean isurl(char *url)
#endif
return /*!strncmp(url, "data:", 5) || */!strncmp(url, "http://", 7) || !strncmp(url, "https://", 8);
}
#endif
qboolean FS_FixupGamedirForExternalFile(char *input, char *filename, size_t fnamelen);
@ -5058,7 +5066,6 @@ double Host_Frame (double time)
if (cls.demoplayback && !cl.stillloading)
{
extern qboolean shader_reload_needed; //this can take some time when you have weird glsl.
qboolean haswork = cl.sendprespawn || COM_HasWork();
if (!hadwork && !haswork)
CL_ProgressDemoTime();
@ -5427,7 +5434,6 @@ void CL_ArgumentOverrides(void)
void CL_ExecInitialConfigs(char *resetcommand)
{
int qrc, hrc, def;
extern cvar_t fs_gamename, com_protocolname; //these come from the manifest, so shouldn't be reset by cvarreset
Cbuf_Execute (); //make sure any pending console commands are done with. mostly, anyway...
SCR_ShowPic_Clear(true);

View file

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CL_GetNumberedEntityInfo (int num, float *org, float *ang);
void CLDP_ParseDarkPlaces5Entities(void);
static void CL_SetStatNumeric (int pnum, int stat, int ivalue, float fvalue);
static void CL_SetStatInt (int pnum, int stat, int ivalue);
#define CL_SetStatInt(pnum,stat,ival) do{int thevalue=ival; CL_SetStatNumeric(pnum,stat,thevalue,thevalue);}while(0)
static qboolean CL_CheckModelResources (char *name);
char cl_dp_csqc_progsname[128];
@ -2292,7 +2292,7 @@ void DL_Abort(qdownload_t *dl, enum qdlabort aborttype)
for (b = dl->dlblocks; b; b = n)
{
if (b->state == DLB_RECEIVED)
VFS_PRINTF(parts, "c %"PRIx64" %"PRIx64"\n", (long long)b->start, (long long)b->end);
VFS_PRINTF(parts, "c %"PRIx64" %"PRIx64"\n", (quint64_t)b->start, (quint64_t)b->end);
else
{
for(;;)
@ -2307,7 +2307,7 @@ void DL_Abort(qdownload_t *dl, enum qdlabort aborttype)
}
break;
}
VFS_PRINTF(parts, "m %"PRIx64" %"PRIx64"\n", (long long)b->start, (long long)b->end);
VFS_PRINTF(parts, "m %"PRIx64" %"PRIx64"\n", (quint64_t)b->start, (quint64_t)b->end);
}
n = b->next;
@ -3297,15 +3297,15 @@ void CLNQ_ParseProtoVersion(void)
cls.protocol_nq = (cls.protocol_nq==CPNQ_PROQUAKE3_4)?CPNQ_PROQUAKE3_4:CPNQ_ID;
cls.z_ext = 0;
if (protover == NEHD_PROTOCOL_VERSION)
if (protover == PROTOCOL_VERSION_NEHD)
Host_EndGame ("Nehahra demo net protocol is not supported\n");
else if (protover == FITZ_PROTOCOL_VERSION)
else if (protover == PROTOCOL_VERSION_FITZ)
{
//fitzquake 0.85
cls.protocol_nq = CPNQ_FITZ666;
Con_DPrintf("FitzQuake 666 protocol\n");
}
else if (protover == RMQ_PROTOCOL_VERSION)
else if (protover == PROTOCOL_VERSION_RMQ)
{
int fl;
cls.protocol_nq = CPNQ_FITZ666;
@ -3323,7 +3323,7 @@ void CLNQ_ParseProtoVersion(void)
if (fl & ~(RMQFL_SHORTANGLE|RMQFL_FLOATANGLE|RMQFL_24BITCOORD|RMQFL_FLOATCOORD|RMQFL_EDICTSCALE))
Con_Printf("WARNING: Server is using unsupported RMQ extensions\n");
}
else if (protover == DP5_PROTOCOL_VERSION)
else if (protover == PROTOCOL_VERSION_DP5)
{
//darkplaces5
cls.protocol_nq = CPNQ_DP5;
@ -3332,7 +3332,7 @@ void CLNQ_ParseProtoVersion(void)
Con_DPrintf("DP5 protocols\n");
}
else if (protover == DP6_PROTOCOL_VERSION)
else if (protover == PROTOCOL_VERSION_DP6)
{
//darkplaces6 (it's a small difference from dp5)
cls.protocol_nq = CPNQ_DP6;
@ -3343,7 +3343,7 @@ void CLNQ_ParseProtoVersion(void)
Con_DPrintf("DP6 protocols\n");
}
else if (protover == DP7_PROTOCOL_VERSION)
else if (protover == PROTOCOL_VERSION_DP7)
{
//darkplaces7 (it's a small difference from dp5)
cls.protocol_nq = CPNQ_DP7;
@ -3354,18 +3354,29 @@ void CLNQ_ParseProtoVersion(void)
Con_DPrintf("DP7 protocols\n");
}
else if (protover == H2_PROTOCOL_VERSION)
else if (protover == PROTOCOL_VERSION_H2)
{
Host_EndGame ("\nUnable to connect to standard Hexen2 servers. Host the game with "DISTRIBUTION"\n");
}
else if (protover != NQ_PROTOCOL_VERSION)
else if (protover == PROTOCOL_VERSION_BJP1)
{
Host_EndGame ("Server is using protocol version %i, which is not supported by this version of " FULLENGINENAME ".", protover);
cls.protocol_nq = CPNQ_BJP1;
Con_DPrintf("bjp1 %i protocol\n", PROTOCOL_VERSION_BJP1);
}
else
else if (protover == PROTOCOL_VERSION_BJP2)
{
cls.protocol_nq = CPNQ_BJP2;
Con_DPrintf("bjp2 %i protocol\n", PROTOCOL_VERSION_BJP2);
}
else if (protover == PROTOCOL_VERSION_BJP3)
{
cls.protocol_nq = CPNQ_BJP3;
Con_DPrintf("bjp3 %i protocol\n", PROTOCOL_VERSION_BJP2);
}
else if (protover == PROTOCOL_VERSION_NQ)
Con_DPrintf("Standard NQ protocols\n");
}
else
Host_EndGame ("Server is using protocol version %i, which is not supported by this version of " FULLENGINENAME ".", protover);
if (cls.fteprotocolextensions & PEXT_FLOATCOORDS)
{
if (netprim.anglesize < 2)
@ -3639,7 +3650,13 @@ void CLNQ_ParseClientdata (void)
if (bits & SU_WEAPONFRAME) weaponframe |= (unsigned char)MSG_ReadByte();
if (bits & SU_ARMOR) armour |= (unsigned char)MSG_ReadByte();
if (bits & SU_WEAPONMODEL) weaponmodel |= (unsigned char)MSG_ReadByte();
if (bits & SU_WEAPONMODEL)
{
if (CPNQ_IS_BJP)
weaponmodel |= (unsigned short)MSG_ReadShort();
else
weaponmodel |= (unsigned char)MSG_ReadByte();
}
health |= MSG_ReadShort();
currentammo |= MSG_ReadByte();
shells |= MSG_ReadByte();
@ -4086,6 +4103,9 @@ void CL_ParseBaseline (entity_state_t *es)
memcpy(es, &nullentitystate, sizeof(entity_state_t));
if (cls.protocol == CP_NETQUAKE && CPNQ_IS_BJP)
es->modelindex = MSG_ReadShort ();
else
es->modelindex = MSG_ReadByte ();
es->frame = MSG_ReadByte ();
es->colormap = MSG_ReadByte();
@ -4298,7 +4318,7 @@ void CL_ParseStaticSound (qboolean large)
for (i=0 ; i<3 ; i++)
org[i] = MSG_ReadCoord ();
if (large)
if (large || (cls.protocol == CP_NETQUAKE && cls.protocol_nq == CPNQ_BJP2))
sound_num = (unsigned short)MSG_ReadShort();
else
sound_num = MSG_ReadByte ();
@ -4532,7 +4552,7 @@ void CLNQ_ParseStartSoundPacket(void)
/*unpack mangling*/
channel = (channel & 7) | ((channel & 0x0f1) << 1);
if (field_mask & DPSND_LARGESOUND)
if ((field_mask & DPSND_LARGESOUND) || (cls.protocol == CP_NETQUAKE && (cls.protocol_nq == CPNQ_BJP2 || cls.protocol_nq == CPNQ_BJP3))) //bjp2 kinda sucks
sound_num = (unsigned short)MSG_ReadShort();
else
sound_num = (unsigned char)MSG_ReadByte ();
@ -5002,10 +5022,6 @@ static void CL_SetStatNumeric (int pnum, int stat, int ivalue, float fvalue)
}
#endif
}
static void CL_SetStatInt (int pnum, int stat, int ivalue)
{
CL_SetStatNumeric(pnum,stat,ivalue,ivalue);
}
void CL_SetStatString (int pnum, int stat, char *value)
{
@ -5894,7 +5910,7 @@ static void CL_ParseItemTimer(void)
atof(Cmd_Argv(3))};
float radius = atof(Cmd_Argv(4));
//unsigned int rgb = strtoul(Cmd_Argv(5), NULL, 16);
char *timername = Cmd_Argv(6);
// char *timername = Cmd_Argv(6);
unsigned int entnum = strtoul(Cmd_Argv(7), NULL, 0);
struct itemtimer_s *timer;
@ -6180,6 +6196,8 @@ void CL_ParsePortalState(void)
a1 = MSG_ReadByte();
#ifdef Q2BSPS
CMQ2_SetAreaPortalState(cl.worldmodel, a1, !!(mode&1));
#else
(void)a1;
#endif
break;
case 0xc0:
@ -6195,6 +6213,9 @@ void CL_ParsePortalState(void)
}
#ifdef Q3BSPS
CMQ3_SetAreaPortalState(cl.worldmodel, a1, a2, !!(mode&1));
#else
(void)a1;
(void)a2;
#endif
break;
@ -6827,11 +6848,12 @@ void CLQ2_ParseServerMessage (void)
seat = 0;
if (cmd == svcq2_playerinfo && (cls.fteprotocolextensions & PEXT_SPLITSCREEN))
{
{ //playerinfo should not normally be seen here.
//so we can just 'borrow' it for seat numbers for targetted svcs.
SHOWNET(va("%i", cmd));
seat = MSG_ReadByte ();
if (seat >= MAX_SPLITS)
Host_EndGame ("CLQ2_ParseServerMessage: Invalid seat", cmd);
Host_EndGame ("CLQ2_ParseServerMessage: Unsupported seat (%i)", seat);
cmd = MSG_ReadByte ();
}

View file

@ -837,7 +837,6 @@ static qintptr_t VARGS Plug_GetWeaponStats(void *offset, quintptr_t mask, const
struct wstats_s *result = VM_POINTER(arg[1]);
size_t maxresults = VM_LONG(arg[2]);
int count = 0;
int i;
if (VM_OOB(arg[0], maxresults*sizeof(*result)))

View file

@ -574,7 +574,6 @@ short LerpAngles16(short to, short from, float frac)
void CL_CalcClientTime(void)
{
extern float demtime;
if (!cls.state)
{
cl.servertime += host_frametime;
@ -989,7 +988,6 @@ void CL_PredictMovePNum (int seat)
if ((cl.inframes[cl.validsequence & UPDATE_MASK].playerstate[pv->cam_spec_track].messagenum == cl.validsequence) ||
(pv->cam_spec_track+1 < cl.maxlerpents && cl.lerpents[pv->cam_spec_track+1].sequence == cl.lerpentssequence))
{
extern cvar_t cl_chasecam;
pv->cam_state = CAM_EYECAM;
pv->viewentity = pv->cam_spec_track+1;
cam_nowlocked = true;

View file

@ -2298,7 +2298,7 @@ static void SCR_ScreenShot_f (void)
Con_Printf ("Couldn't write %s\n", sysname);
}
void *SCR_ScreenShot_FBO(int fbwidth, int fbheight, enum uploadfmt *fmt)
void *SCR_ScreenShot_Capture(int fbwidth, int fbheight, enum uploadfmt *fmt)
{
int width, height;
void *buf;
@ -2342,8 +2342,9 @@ void *SCR_ScreenShot_FBO(int fbwidth, int fbheight, enum uploadfmt *fmt)
Q_strncpyz(r_refdef.rt_destcolour[0].texname, "", sizeof(r_refdef.rt_destcolour[0].texname));
BE_RenderToTextureUpdate2d(true);
if (width != fbwidth || height != fbheight)
if (!buf || width != fbwidth || height != fbheight)
{
*fmt = TF_INVALID;
BZ_Free(buf);
return NULL;
}
@ -2427,7 +2428,7 @@ static void SCR_ScreenShot_Mega_f(void)
r_refdef.stereomethod = STEREO_LEFTONLY;
}
buffers[buf] = SCR_ScreenShot_FBO(fbwidth, fbheight, &fmt[buf]);
buffers[buf] = SCR_ScreenShot_Capture(fbwidth, fbheight, &fmt[buf]);
if (width[buf] != width[0] || height[buf] != height[0] || fmt[buf] != fmt[0])
{ //invalid is better than unmatched.
@ -2467,14 +2468,13 @@ static void SCR_ScreenShot_VR_f(void)
int height; //equirectangular 360 * 180 gives a nice clean ratio
int px = 4;
int step = atof(Cmd_Argv(3));
unsigned int *left_buffer;
unsigned int *right_buffer;
unsigned int *buf;
void *left_buffer, *right_buffer, *buf;
enum uploadfmt fmt;
int lx, rx, x, y;
vec3_t baseang;
float ang;
extern cvar_t r_projection, r_stereo_separation;
qboolean fail = false;
extern cvar_t r_projection, r_stereo_separation, r_stereo_convergence;;
VectorCopy(r_refdef.viewangles, baseang);
if (width <= 2)
@ -2484,7 +2484,7 @@ static void SCR_ScreenShot_VR_f(void)
step = 5;
left_buffer = BZF_Malloc (width*height*2*px);
right_buffer = left_buffer + width*height;
right_buffer = (qbyte*)left_buffer + width*height*px;
if (strstr (screenyname, "..") || strchr(screenyname, ':') || *screenyname == '.' || *screenyname == '/')
screenyname = "";
@ -2520,7 +2520,7 @@ static void SCR_ScreenShot_VR_f(void)
r_refdef.stereomethod = STEREO_OFF;
cl.playerview->simangles[0] = 0; //pitch is BAD
cl.playerview->simangles[1] = baseang[1];// - 360.0*(lx + 0.5*(rx-lx)) / width;
cl.playerview->simangles[1] = baseang[1] + r_stereo_convergence.value*0.5;
cl.playerview->simangles[2] = 0; //roll is BAD
VectorCopy(cl.playerview->simangles, cl.playerview->viewangles);
@ -2530,29 +2530,68 @@ static void SCR_ScreenShot_VR_f(void)
r_refdef.eyeoffset[0] = sin(ang) * r_stereo_separation.value * 0.5;
r_refdef.eyeoffset[1] = cos(ang) * r_stereo_separation.value * 0.5;
r_refdef.eyeoffset[2] = 0;
buf = SCR_ScreenShot_FBO(width, height, &fmt);
if (buf && fmt == TF_BGRA32)
buf = SCR_ScreenShot_Capture(width, height, &fmt);
switch(fmt)
{
case TF_BGRA32:
for (y = 0; y < height; y++)
for (x = lx; x < rx; x++)
left_buffer[y*width + x] = buf[y*width + /*(width-step)/2 +*/ x];
((unsigned int*)left_buffer)[y*width + x] = ((unsigned int*)buf)[y*width + x];
break;
case TF_RGB24:
for (y = 0; y < height; y++)
for (x = lx; x < rx; x++)
{
((qbyte*)left_buffer)[(y*width + x)*4+0] = ((qbyte*)buf)[(y*width + x)*3+2];
((qbyte*)left_buffer)[(y*width + x)*4+1] = ((qbyte*)buf)[(y*width + x)*3+1];
((qbyte*)left_buffer)[(y*width + x)*4+2] = ((qbyte*)buf)[(y*width + x)*3+0];
((qbyte*)left_buffer)[(y*width + x)*4+3] = 255;
}
break;
default:
fail = true;
break;
}
BZ_Free(buf);
cl.playerview->simangles[0] = 0; //pitch is BAD
cl.playerview->simangles[1] = baseang[1] - r_stereo_convergence.value*0.5;
cl.playerview->simangles[2] = 0; //roll is BAD
VectorCopy(cl.playerview->simangles, cl.playerview->viewangles);
r_refdef.eyeoffset[0] *= -1;
r_refdef.eyeoffset[1] *= -1;
r_refdef.eyeoffset[2] = 0;
buf = SCR_ScreenShot_FBO(width, height, &fmt);
if (buf && fmt == TF_BGRA32)
buf = SCR_ScreenShot_Capture(width, height, &fmt);
switch(fmt)
{
case TF_BGRA32:
for (y = 0; y < height; y++)
for (x = lx; x < rx; x++)
right_buffer[y*width + x] = buf[y*width + /*(width-step)/2 +*/ x];
((unsigned int*)right_buffer)[y*width + x] = ((unsigned int*)buf)[y*width + x];
break;
case TF_RGB24:
for (y = 0; y < height; y++)
for (x = lx; x < rx; x++)
{
((qbyte*)right_buffer)[(y*width + x)*4+0] = ((qbyte*)buf)[(y*width + x)*3+2];
((qbyte*)right_buffer)[(y*width + x)*4+1] = ((qbyte*)buf)[(y*width + x)*3+1];
((qbyte*)right_buffer)[(y*width + x)*4+2] = ((qbyte*)buf)[(y*width + x)*3+0];
((qbyte*)right_buffer)[(y*width + x)*4+3] = 255;
}
break;
default:
fail = true;
break;
}
BZ_Free(buf);
}
if (SCR_ScreenShot(filename, FS_GAMEONLY, &left_buffer, 1, width, height*2, TF_BGRA32))
if (fail)
Con_Printf ("Unable to capture suitable screen image\n");
else if (SCR_ScreenShot(filename, FS_GAMEONLY, &left_buffer, 1, width, height*2, TF_BGRA32))
{
char sysname[1024];
FS_NativePath(filename, FS_GAMEONLY, sysname, sizeof(sysname));

View file

@ -2411,20 +2411,20 @@ void CL_Laser (vec3_t start, vec3_t end, int colors)
void CLQ2_ParseSteam(void)
{
vec3_t pos, dir;
qbyte colour;
/*qbyte colour;
short magnitude;
unsigned int duration;
unsigned int duration;*/
signed int id = MSG_ReadShort();
qbyte count = MSG_ReadByte();
/*qbyte count =*/ MSG_ReadByte();
MSG_ReadPos(pos);
MSG_ReadPos(dir);
colour = MSG_ReadByte();
magnitude = MSG_ReadShort();
/*colour =*/ MSG_ReadByte();
/*magnitude =*/ MSG_ReadShort();
if (id == -1)
duration = MSG_ReadLong();
/*duration =*/ MSG_ReadLong();
else
duration = 0;
/*duration = 0;*/
Con_Printf("FIXME: CLQ2_ParseSteam: stub\n");
}

View file

@ -802,7 +802,8 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
{
serverinfo_t *info;
COM_Parse(cmdtext + 5);
NET_StringToAdr(com_token, 0, &ui_pings[i]);
if (NET_StringToAdr(com_token, 0, &ui_pings[i]))
{
info = Master_InfoForServer(&ui_pings[i]);
if (info)
{
@ -810,6 +811,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
info->sends++;
Master_QueryServer(info);
}
}
break;
}
}
@ -819,7 +821,7 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
netadr_t na;
MasterInfo_Refresh();
NET_StringToAdr("255.255.255.255", PORT_Q3SERVER, &na);
if (NET_StringToAdr("255.255.255.255", PORT_Q3SERVER, &na))
NET_SendPollPacket (14, va("%c%c%c%cgetstatus\n", 255, 255, 255, 255), na);
}
else

View file

@ -444,12 +444,16 @@ typedef struct
{
CPNQ_ID,
CPNQ_PROQUAKE3_4,
CPNQ_BJP1, //16bit models, strict 8bit sounds
CPNQ_BJP2, //16bit models, strict 16bit sounds
CPNQ_BJP3, //16bit models, flagged 16bit sounds
CPNQ_FITZ666, /*and rmqe999 protocol*/
CPNQ_DP5,
CPNQ_DP6,
CPNQ_DP7
} protocol_nq;
#define CPNQ_IS_DP (cls.protocol_nq >= CPNQ_DP5)
#define CPNQ_IS_BJP (cls.protocol_nq >= CPNQ_BJP1 && cls.protocol_nq <= CPNQ_BJP3)
int protocol_q2;
@ -1549,10 +1553,10 @@ int CIN_RunCinematic (struct cinematics_s *cin, qbyte **outdata, int *outwidth,
typedef struct cin_s cin_t;
#ifdef NOMEDIA
#define Media_Playing() false
#define Media_Init() 0
#define Media_Init() (void)0
#define Media_PlayingFullScreen() false
#define Media_PlayFilm(n,e) false
#define Media_StopFilm(a) true
#define Media_StopFilm(a) (void)true
#else
/*media playing system*/
qboolean Media_PlayingFullScreen(void);

View file

@ -121,7 +121,6 @@ sfx_t *S_PrecacheSexedSound(int entnum, const char *soundname)
void CLQ2_EntityEvent(entity_state_t *es)
{
float ATTN_IDLE = 2;
switch (es->u.q2.event)
{
case Q2EV_NONE:
@ -2092,9 +2091,6 @@ CL_AddViewWeapon
*/
static void CLQ2_AddViewWeapon (int seat, q2player_state_t *ps, q2player_state_t *ops)
{
entity_t gun; // view model
extern cvar_t cl_gunx, cl_guny, cl_gunz;
extern cvar_t cl_gunanglex, cl_gunangley, cl_gunanglez;
playerview_t *pv = &cl.playerview[seat];
pv->vm.oldmodel = NULL;
@ -2115,8 +2111,6 @@ static void CLQ2_AddViewWeapon (int seat, q2player_state_t *ps, q2player_state_t
AngleVectors(pv->simangles, pv->vw_axis[0], pv->vw_axis[1], pv->vw_axis[2]);
VectorInverse(pv->vw_axis[1]);
memset (&gun, 0, sizeof(gun));
pv->vm.oldmodel = cl.model_precache[ps->gunindex];
if (!pv->vm.oldmodel)
return;
@ -2126,42 +2120,6 @@ static void CLQ2_AddViewWeapon (int seat, q2player_state_t *ps, q2player_state_t
pv->vm.prevframe = ps->gunframe;
else
pv->vm.prevframe = ops->gunframe;
/*
gun.shaderRGBAf[0] = 1;
gun.shaderRGBAf[1] = 1;
gun.shaderRGBAf[2] = 1;
if (r_drawviewmodel.value < 1 || r_drawviewmodel.value > 0)
gun.shaderRGBAf[3] = r_drawviewmodel.value;
else
gun.shaderRGBAf[3] = 1;
// set up gun position
#ifdef PEXT_SCALE
gun.scale = 1;
#endif
gun.origin[0] = cl_gunz.value;
gun.origin[1] = -cl_gunx.value;
gun.origin[2] = -cl_guny.value;
gun.angles[0] = cl_gunanglex.value;
gun.angles[1] = cl_gunangley.value;
gun.angles[2] = cl_gunanglez.value;
gun.framestate.g[FS_REG].frame[0] = ps->gunframe;
if (gun.framestate.g[FS_REG].frame[0] == 0)
gun.framestate.g[FS_REG].frame[1] = 0; // just changed weapons, don't lerp from old
else
gun.framestate.g[FS_REG].frame[1] = ops->gunframe;
gun.playerindex = -1;
gun.flags = Q2RF_MINLIGHT | RF_DEPTHHACK | RF_WEAPONMODEL;
gun.framestate.g[FS_REG].lerpweight[0] = cl.lerpfrac;
gun.framestate.g[FS_REG].lerpweight[1] = 1-cl.lerpfrac;
VectorCopy (gun.origin, gun.oldorigin); // don't lerp at all
V_AddEntity (&gun);
*/
}
@ -2274,7 +2232,9 @@ Emits all entities, particles, and lights to the refresh
*/
void CLQ2_AddEntities (void)
{
#ifdef _DEBUG
extern cvar_t chase_active, chase_back, chase_up;
#endif
int seat;
if (cls.state != ca_active)
return;

View file

@ -931,7 +931,7 @@ void VARGS Con_Printf (const char *fmt, ...)
if (!Sys_IsMainThread())
{
COM_AddWork(0, Con_PrintFromThread, NULL, Z_StrDup(msg), 0, 0);
COM_AddWork(WG_MAIN, Con_PrintFromThread, NULL, Z_StrDup(msg), 0, 0);
return;
}
@ -1007,7 +1007,7 @@ static void Con_DPrintFromThread (void *ctx, void *data, size_t a, size_t b)
Con_Log(data);
else
{
Sys_Printf ("%s", data); // also echo to debugging console
Sys_Printf ("%s", (const char*)data); // also echo to debugging console
Con_PrintCon(&con_main, data, con_main.parseflags);
}
BZ_Free(data);
@ -1043,7 +1043,7 @@ void VARGS Con_DPrintf (const char *fmt, ...)
if (!Sys_IsMainThread())
{
if (developer.ival)
COM_AddWork(0, Con_DPrintFromThread, NULL, Z_StrDup(msg), 0, 0);
COM_AddWork(WG_MAIN, Con_DPrintFromThread, NULL, Z_StrDup(msg), 0, 0);
return;
}

View file

@ -2561,7 +2561,7 @@ static qboolean Image_ReadDDSFile(texid_t tex, unsigned int flags, char *fname,
mips->mipcount = mipnum;
COM_AddWork(0, Image_LoadTextureMips, tex, mips, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTextureMips, tex, mips, 0, 0);
return true;
}
#endif
@ -2606,8 +2606,6 @@ static qboolean Image_ReadBLPFile(texid_t tex, unsigned int flags, char *fname,
if (blp->encoding == 2)
{
int blocksize;
//s3tc/dxt
switch(blp->alphaencoding)
{
@ -2617,15 +2615,12 @@ static qboolean Image_ReadBLPFile(texid_t tex, unsigned int flags, char *fname,
mips->encoding = PTI_S3RGBA1;
else
mips->encoding = PTI_S3RGB1;
blocksize = 8;
break;
case 1: //dxt2/3
mips->encoding = PTI_S3RGBA3;
blocksize = 16;
break;
case 7: //dxt4/5
mips->encoding = PTI_S3RGBA5;
blocksize = 16;
break;
}
for (miplevel = 0; miplevel < 16; )
@ -2735,7 +2730,7 @@ static qboolean Image_ReadBLPFile(texid_t tex, unsigned int flags, char *fname,
mips->mipcount = miplevel;
}
COM_AddWork(0, Image_LoadTextureMips, tex, mips, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTextureMips, tex, mips, 0, 0);
return true;
}
@ -4049,7 +4044,7 @@ static qboolean Image_LoadRawTexture(texid_t tex, unsigned int flags, void *rawd
if (flags & IF_NOWORKER)
Image_LoadTexture_Failed(tex, NULL, 0, 0);
else
COM_AddWork(0, Image_LoadTexture_Failed, tex, NULL, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTexture_Failed, tex, NULL, 0, 0);
return false;
}
Image_GenerateMips(mips, flags);
@ -4061,7 +4056,7 @@ static qboolean Image_LoadRawTexture(texid_t tex, unsigned int flags, void *rawd
if (flags & IF_NOWORKER)
Image_LoadTextureMips(tex, mips, 0, 0);
else
COM_AddWork(0, Image_LoadTextureMips, tex, mips, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTextureMips, tex, mips, 0, 0);
return true;
}
@ -4154,7 +4149,7 @@ qboolean Image_LoadTextureFromMemory(texid_t tex, int flags, const char *iname,
if (flags & IF_NOWORKER)
Image_LoadTextureMips(tex, mips, 0, 0);
else
COM_AddWork(0, Image_LoadTextureMips, tex, mips, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTextureMips, tex, mips, 0, 0);
return true;
}
#endif
@ -4252,7 +4247,7 @@ static qboolean Image_LoadCubemapTexture(texid_t tex, char *nicename)
if (tex->flags & IF_NOWORKER)
Image_LoadTextureMips(tex, mips, 0, 0);
else
COM_AddWork(0, Image_LoadTextureMips, tex, mips, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTextureMips, tex, mips, 0, 0);
return true;
}
@ -4291,7 +4286,7 @@ void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t b)
if (tex->flags & IF_NOWORKER)
Image_LoadTexture_Failed(tex, NULL, 0, 0);
else
COM_AddWork(0, Image_LoadTexture_Failed, tex, NULL, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTexture_Failed, tex, NULL, 0, 0);
}
return;
}
@ -4481,7 +4476,7 @@ void Image_LoadHiResTextureWorker(void *ctx, void *data, size_t a, size_t b)
if (tex->flags & IF_NOWORKER)
Image_LoadTexture_Failed(tex, NULL, 0, 0);
else
COM_AddWork(0, Image_LoadTexture_Failed, tex, NULL, 0, 0);
COM_AddWork(WG_MAIN, Image_LoadTexture_Failed, tex, NULL, 0, 0);
}
@ -4589,7 +4584,6 @@ void Image_Downloaded(struct dl_download *dl)
image_t *Image_GetTexture(const char *identifier, const char *subpath, unsigned int flags, void *fallbackdata, void *fallbackpalette, int fallbackwidth, int fallbackheight, uploadfmt_t fallbackfmt)
{
image_t *tex;
static int seq;
qboolean dontposttoworker = (flags & (IF_NOWORKER | IF_LOADNOW));
qboolean lowpri = (flags & IF_LOWPRIORITY);
@ -4701,9 +4695,9 @@ image_t *Image_GetTexture(const char *identifier, const char *subpath, unsigned
else
#endif
if (lowpri)
COM_AddWork(1, Image_LoadHiResTextureWorker, tex, NULL, 0, 0);
COM_AddWork(WG_LOADER, Image_LoadHiResTextureWorker, tex, NULL, 0, 0);
else
COM_AddWork(1, Image_LoadHiResTextureWorker, tex, NULL, 0, 0);
COM_AddWork(WG_LOADER, Image_LoadHiResTextureWorker, tex, NULL, 0, 0);
}
return tex;
}

View file

@ -517,7 +517,13 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frame
int mfwt;
qboolean strafe_x, strafe_y;
int wpnum;
#ifdef PEXT_CSQC
#ifdef MULTITHREAD
extern qboolean runningindepphys;
#else
const qboolean runningindepphys = false;
#endif
#endif
//small performance boost
if (mouse->type == M_INVALID)

View file

@ -213,7 +213,7 @@ void INS_ProcessInputMessage(struct InputEvent *msg, qboolean consumemotion)
void INS_Commands(void)
{
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid))
{
}
void INS_Move (float *movements, int pnum)

View file

@ -912,7 +912,7 @@ void INS_Accumulate(void) //input polling
void INS_Commands (void) //used to Cbuf_AddText joystick button events in windows.
{
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid))
{
}

View file

@ -98,7 +98,7 @@ HRESULT (WINAPI *pDirectInputCreate)(HINSTANCE hinst, DWORD dwVersion,
// mouse variables
static cvar_t in_dinput = CVARF("in_dinput","0", CVAR_ARCHIVE);
static cvar_t in_xinput = CVARFD("in_xinput","0", CVAR_ARCHIVE, "Enables the use of xinput for controllers.\nNote that if you have a headset plugged in, that headset will be used for audio playback if no specific audio device is configured (may require snd_restart too).");
static cvar_t in_xinput = CVARFD("in_xinput","0", CVAR_ARCHIVE, "Enables the use of xinput for controllers.\nNote that if you have a headset plugged in, that headset will be used for audio playback if no specific audio device is configured.");
static cvar_t in_builtinkeymap = CVARF("in_builtinkeymap", "0", CVAR_ARCHIVE);
static cvar_t in_simulatemultitouch = CVAR("in_simulatemultitouch", "0");
static cvar_t in_nonstandarddeadkeys = CVARD("in_nonstandarddeadkeys", "1", "Discard input events that result in multiple keys. Only the last key will be used. This results in behaviour that differs from eg notepad. To use a dead key, press it twice instead of the dead key followed by space.");
@ -2066,7 +2066,7 @@ void INS_JoyMove (float *movements, int pnum)
}
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid))
{
int idx;

View file

@ -58,7 +58,7 @@ void INS_ReInit (void);
void INS_Init (void);
void INS_Shutdown (void);
void INS_Commands (void); //final chance to call IN_MouseMove/IN_KeyEvent each frame
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid));
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid));
void INS_SetupControllerAudioDevices(qboolean enabled); //creates audio devices for each controller (where controllers have their own audio devices)
#define DEVID_UNSET -1

View file

@ -411,7 +411,6 @@ static qboolean MI_Selectable(menuoption_t *op)
static void M_CheckMouseMove(void)
{
qboolean foundexclusive = false;
int mgt;
menu_t *menu;
menuoption_t *option;
@ -424,8 +423,6 @@ static void M_CheckMouseMove(void)
if (mousemoved)
{
mgt = M_GameType();
for (menu = firstmenu; menu; menu = menu->parent)
{
if (menu->exclusive)
@ -450,7 +447,7 @@ static void M_CheckMouseMove(void)
if (!option->common.noselectionsound)
{
#ifdef HEXEN2
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
S_LocalSound ("raven/menu1.wav");
else
#endif
@ -930,7 +927,6 @@ menuoption_t *MC_AddCursorSmall(menu_t *menu, menuresel_t *reselection, int x, i
menupicture_t *MC_AddCursor(menu_t *menu, menuresel_t *reselection, int x, int y)
{
int mgt;
menupicture_t *n = Z_Malloc(sizeof(menupicture_t));
if (reselection)
menu->reselection = reselection;
@ -944,8 +940,7 @@ menupicture_t *MC_AddCursor(menu_t *menu, menuresel_t *reselection, int x, int y
n->common.next = menu->options;
menu->options = (menuoption_t *)n;
mgt = M_GameType();
switch(mgt)
switch(M_GameType())
{
#ifdef Q2CLIENT
case MGT_QUAKE2:
@ -1806,9 +1801,6 @@ menuoption_t *M_PrevSelectableItem(menu_t *m, menuoption_t *old)
void M_Complex_Key(int key, int unicode)
{
int mgt;
mgt = M_GameType();
if (!currentmenu)
return; //erm...
@ -1832,7 +1824,7 @@ void M_Complex_Key(int key, int unicode)
return;
#ifdef HEXEN2
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
S_LocalSound ("raven/menu1.wav");
else
#endif
@ -1869,7 +1861,7 @@ void M_Complex_Key(int key, int unicode)
//remove
M_RemoveMenu(currentmenu);
#ifdef HEXEN2
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
S_LocalSound ("raven/menu3.wav");
else
#endif
@ -1882,7 +1874,7 @@ void M_Complex_Key(int key, int unicode)
if (currentmenu->selecteditem)
{
#ifdef HEXEN2
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
S_LocalSound ("raven/menu1.wav");
else
#endif
@ -1898,7 +1890,7 @@ void M_Complex_Key(int key, int unicode)
if (currentmenu->selecteditem)
{
#ifdef HEXEN2
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
S_LocalSound ("raven/menu1.wav");
else
#endif
@ -1932,7 +1924,7 @@ void M_Complex_Key(int key, int unicode)
{
Cbuf_AddText(currentmenu->selecteditem->button.command, RESTRICT_LOCAL);
#ifdef HEXEN2
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
S_LocalSound ("raven/menu2.wav");
else
#endif
@ -1964,107 +1956,12 @@ void M_Complex_Key(int key, int unicode)
typedef struct {
int itemselected;
menu_t *dropout;
menutext_t *op[64];
char *text[64];
menu_t *parent;
} guiinfo_t;
static qboolean MC_GuiKey(int key, menu_t *menu)
{
guiinfo_t *info = (guiinfo_t *)menu->data;
switch(key)
{
case K_ESCAPE:
if (info->dropout)
MC_GuiKey(key, info->dropout);
else
{
guiinfo_t *gui;
M_RemoveMenu(menu);
if (menu->parent)
{
gui = (guiinfo_t *)menu->parent->data;
gui->dropout = NULL;
}
}
break;
case K_ENTER:
case K_KP_ENTER:
case K_RIGHTARROW:
if (info->dropout)
MC_GuiKey(key, info->dropout);
else
{
int y, i;
guiinfo_t *gui;
info->dropout = M_CreateMenu(sizeof(guiinfo_t));
currentmenu = info->dropout;
info->dropout->key = MC_GuiKey;
info->dropout->exclusive = false;
info->dropout->parent = menu;
info->dropout->xpos = 0;
info->dropout->ypos = menu->ypos+info->itemselected*8;
for (i = 0; info->text[i]; i++)
if (info->dropout->xpos < strlen(info->text[i]))
info->dropout->xpos = strlen(info->text[i]);
info->dropout->xpos*=8;
info->dropout->xpos+=menu->xpos;
gui = (guiinfo_t *)info->dropout->data;
gui->text[0] = "Hello";
gui->text[1] = "Hello again";
gui->text[2] = "Hello yet again";
for (y = 0, i = 0; gui->text[i]; i++, y+=1*8)
{
info->op[i] = MC_AddRedText(info->dropout, 0, 0, y, gui->text[i], false);
}
}
break;
case K_LEFTARROW:
if (info->dropout)
MC_GuiKey(key, info->dropout);
else
{
guiinfo_t *gui;
M_RemoveMenu(menu);
if (menu->parent)
{
gui = (guiinfo_t *)menu->parent->data;
gui->dropout = NULL;
}
}
break;
case K_UPARROW:
info->op[info->itemselected]->isred = true;
if (info->itemselected)
info->itemselected--;
info->op[info->itemselected]->isred = false;
break;
case K_DOWNARROW:
if (!info->op[info->itemselected])
break;
info->op[info->itemselected]->isred = true;
if (info->text[info->itemselected+1])
info->itemselected++;
info->op[info->itemselected]->isred = false;
break;
}
return true;
}
extern int m_save_demonum;
qboolean MC_Main_Key (int key, menu_t *menu) //here purly to restart demos.
{
if (key == K_ESCAPE || key == K_MOUSE2)
{
extern cvar_t cl_demoreel, con_stayhidden;
extern cvar_t con_stayhidden;
//don't spam menu open+close events if we're not going to be allowing the console to appear
if (con_stayhidden.ival && cls.state == ca_disconnected)
@ -2073,15 +1970,6 @@ qboolean MC_Main_Key (int key, menu_t *menu) //here purly to restart demos.
Key_Dest_Remove(kdm_emenu);
m_state = m_none;
/* if (m_save_demonum != -1)
{
cls.demonum = m_save_demonum;
m_save_demonum = -1;
if (cls.demonum != -1 && !cls.demoplayback && cls.state == ca_disconnected && cl_demoreel.ival)
CL_NextDemo ();
}
*/
return true;
}
return false;
@ -2095,8 +1983,6 @@ void M_Menu_Main_f (void)
mpic_t *p;
static menuresel_t resel;
int mgt;
#ifdef CSQC_DAT
if (CSQC_ConsoleCommand(va("%s %s", Cmd_Argv(0), Cmd_Args())))
return;
@ -2137,9 +2023,8 @@ void M_Menu_Main_f (void)
S_LocalSound ("misc/menu2.wav");
mgt = M_GameType();
#ifdef Q2CLIENT
if (mgt == MGT_QUAKE2) //quake2 main menu.
if (M_GameType() == MGT_QUAKE2) //quake2 main menu.
{
if (R_GetShaderSizes(R2D_SafeCachePic("pics/m_main_quit"), NULL, NULL, true) > 0)
{
@ -2195,7 +2080,7 @@ void M_Menu_Main_f (void)
else
#endif
#ifdef HEXEN2
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
{
p = R2D_SafeCachePic("gfx/menu/title0.lmp");
if (R_GetShaderSizes(p, NULL, NULL, true) <= 0)

View file

@ -777,9 +777,9 @@ dojoin:
char safename[128];
Q_strncpyz(safename, server->name, sizeof(safename));
//ALWAYS sanitize your inputs.
while(s = strchr(safename, ';'))
while((s = strchr(safename, ';')))
*s = ' ';
while(s = strchr(safename, '\n'))
while((s = strchr(safename, '\n')))
*s = ' ';
if (key == 'c')
Sys_SaveClipboard(va("%s - %s\n", server->name, NET_AdrToString(buf, sizeof(buf), &server->adr)));

View file

@ -36,7 +36,9 @@ static char media_friendlyname[MAX_QPATH];
#define MEDIA_GAMEMUSIC (1u<<0) //cd music. also music command etc.
#define MEDIA_CVARLIST (1u<<1) //cvar abuse. handy for preserving times when switching tracks.
#define MEDIA_PLAYLIST (1u<<2) //
#if !defined(NOMEDIA)
static unsigned int media_playlisttypes;
#endif
static unsigned int media_playlistcurrent;
static int cdplayingtrack; //currently playing cd track (becomes 0 when paused)
@ -57,10 +59,12 @@ static int cdnumtracks; //maximum cd track we can play.
//cvar abuse
#if !defined(NOMEDIA)
static int music_playlist_last;
static cvar_t music_playlist_index = CVAR("music_playlist_index", "-1");
// created dynamically: CVAR("music_playlist_list0+", ""),
// created dynamically: CVAR("music_playlist_sampleposition0+", "-1"),
#endif
static qboolean Media_Changed (unsigned int mediatype)
@ -115,9 +119,9 @@ qboolean Media_NamedTrack(const char *track, const char *looptrack)
};
char trackname[MAX_QPATH];
int ie, ip;
qboolean found = false;
#endif
char *trackend;
qboolean found = false;
if (!track || !*track) //ignore calls if the primary track is invalid. whatever is already playing will continue to play.
return false;
@ -138,9 +142,7 @@ qboolean Media_NamedTrack(const char *track, const char *looptrack)
if (!strcmp(looptrack, "-")) //- for the looptrack argument can be used to prevent looping.
looptrack = "";
#if defined(NOMEDIA)
found = false;
#else
#ifndef NOMEDIA
for(ip = 0; path[ip] && !found; ip++)
{
if (tracknum)
@ -3233,6 +3235,8 @@ void Media_RecordFrame (void)
case TF_RGBA32:
qglReadPixels(0, 0, vid.fbpwidth, vid.fbpheight, GL_RGBA, GL_UNSIGNED_BYTE, 0);
break;
default:
break;
}
qglBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
}
@ -3444,7 +3448,6 @@ void Media_StopRecordFilm_f (void)
if (pbo_format)
{
int i;
int imagesize = vid.fbpwidth * vid.fbpheight * 4;
while (pbo_oldest < captureframe)
{
qbyte *buffer;
@ -3559,7 +3562,7 @@ static void Media_RecordFilm (char *recordingname, qboolean demo)
#ifdef CAN_USE_PBOS
pbo_format = TF_INVALID;
if (qrenderer == QR_OPENGL && !gl_config.gles && gl_config.glversion >= 2.1)
{ //both tgas and vfw favour bgr24, so lets get the gl drivers to suffer instead of us.
{ //both tgas and vfw favour bgr24, so lets get the gl drivers to suffer instead of us, where possible.
if (vid.fbpwidth & 3)
pbo_format = TF_BGRA32; //don't bother changing pack alignment, just use something that is guarenteed to not need anything.
else

View file

@ -420,16 +420,14 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
void M_Menu_Setup_f (void)
{
int mgt;
setupmenu_t *info;
menu_t *menu;
menucustom_t *ci;
menubutton_t *b;
static menuresel_t resel;
mgt = M_GameType();
#ifdef Q2CLIENT
if (mgt == MGT_QUAKE2) //quake2 main menu.
if (M_GameType() == MGT_QUAKE2) //quake2 main menu.
{
if (R2D_SafeCachePic("pics/m_banner_player_setup"))
{
@ -481,7 +479,7 @@ void M_Menu_Setup_f (void)
(info->teamedit = MC_AddEdit(menu, 64, 160, 56, "Your team", team.string));
#ifdef HEXEN2
info->ticlass = -1;
if (mgt == MGT_HEXEN2)
if (M_GameType() == MGT_HEXEN2)
{
static const char *classnames[] =
{
@ -597,7 +595,6 @@ qboolean MultiBeginGame (union menuoption_s *option,struct menu_s *menu, int key
}
void M_Menu_GameOptions_f (void)
{
extern cvar_t pr_maxedicts;
static const char *deathmatchoptions[] = {
"Cooperative",
"Deathmatch 1",

View file

@ -172,19 +172,27 @@ qboolean M_Options_InvertMouse (menucheck_t *option, struct menu_s *menu, chk_se
}
}
#if defined(WEBCLIENT) && defined(_WIN32)
#define HAVEAUTOUPDATE
void M_Options_Remove(menu_t *m)
{
menucombo_t *c = m->data;
if (c)
Sys_SetAutoUpdateSetting(c->selectedoption);
}
#endif
//options menu.
void M_Menu_Options_f (void)
{
extern cvar_t crosshair, r_projection, sv_autosave;
extern cvar_t crosshair, r_projection;
#ifndef CLIENTONLY
extern cvar_t sv_autosave;
#endif
int y;
#ifdef HAVEAUTOUPDATE
#define HAVEAUTOUPDATE
menuoption_t *updatecbo;
static const char *autoupopts[] = {
"Revert",
@ -193,7 +201,7 @@ void M_Menu_Options_f (void)
"Untested(Latest)",
NULL
};
#endif
static const char *projections[] = {
"Regular",
"Stereographic",
@ -209,9 +217,11 @@ void M_Menu_Options_f (void)
"2",
"3",
"4",
"5",
NULL
};
#ifndef CLIENTONLY
static const char *autosaveopts[] = {
"Off",
"30 secs",
@ -221,7 +231,7 @@ void M_Menu_Options_f (void)
"5 mins",
NULL
};
static const char *autsavevals[] = {
static const char *autosavevals[] = {
"0",
"0.5",
"1",
@ -230,6 +240,7 @@ void M_Menu_Options_f (void)
"5",
NULL
};
#endif
menubulk_t bulk[] = {
MB_CONSOLECMD("Customize controls", "menu_keys\n", "Modify keyboard and mouse inputs."),
@ -246,9 +257,11 @@ void M_Menu_Options_f (void)
MB_CHECKBOXCVAR("Lookspring", lookspring, 0),
MB_CHECKBOXCVAR("Lookstrafe", lookstrafe, 0),
MB_CHECKBOXCVAR("Windowed Mouse", _windowed_mouse, 0),
#ifdef HAVEAUTOUPDATE
MB_COMBORETURN("Auto Update", autoupopts, Sys_GetAutoUpdateSetting(), updatecbo, "This downloads engine updates from the internet, when a new build is available."),
#endif
#ifndef CLIENTONLY
MB_COMBOCVAR("Auto Save", sv_autosave, autosaveopts, autsavevals, NULL),
MB_COMBOCVAR("Auto Save", sv_autosave, autosaveopts, autosavevals, NULL),
#endif
MB_SPACING(4),
// removed hud options (cl_sbar, cl_hudswap, old-style chat, old-style msg)
@ -300,9 +313,10 @@ void M_Menu_Options_f (void)
}
#endif
#ifdef HAVEAUTOUPDATE
menu->data = updatecbo;
menu->remove = M_Options_Remove;
#endif
}
#ifndef __CYGWIN__
@ -1220,6 +1234,7 @@ qboolean M_VideoApplyShadowLighting (union menuoption_s *op,struct menu_s *menu,
if (key != K_ENTER && key != K_KP_ENTER && key != K_MOUSE1)
return false;
#ifdef RTLIGHTS
{
char *cvarsrw = "0";
char *cvarsrws = "0";
@ -1243,6 +1258,7 @@ qboolean M_VideoApplyShadowLighting (union menuoption_s *op,struct menu_s *menu,
Cbuf_AddText(va("r_vertexlight %s;r_shadow_realtime_world %s;r_shadow_realtime_world_shadows %s\n", cvarv, cvarsrw, cvarsrws), RESTRICT_LOCAL);
#endif
}
#endif
{
char *cvard = "0";
@ -1269,11 +1285,20 @@ qboolean M_VideoApplyShadowLighting (union menuoption_s *op,struct menu_s *menu,
cvarvd = "1";
break;
}
#ifdef RTLIGHTS
#ifdef MINIMAL
Cbuf_AddText(va("r_shadow_realtime_dlight %s;r_shadow_realtime_dlight_shadows %s;r_dynamic %s\n", cvarsrd, cvarsrds, cvard), RESTRICT_LOCAL);
#else
Cbuf_AddText(va("r_shadow_realtime_dlight %s;r_shadow_realtime_dlight_shadows %s;r_dynamic %s;r_vertexdlight %s\n", cvarsrd, cvarsrds, cvard, cvarvd), RESTRICT_LOCAL);
#endif
#else
#ifdef MINIMAL
Cbuf_AddText(va("r_dynamic %s\n", cvard), RESTRICT_LOCAL);
#else
Cbuf_AddText(va("r_dynamic %s;r_vertexdlight %s\n", cvard, cvarvd), RESTRICT_LOCAL);
#endif
#endif
(void)cvarsrd, (void)cvarsrds, (void)cvard, (void)cvarvd;
}
Cbuf_AddText("vid_restart\n", RESTRICT_LOCAL);
@ -1288,9 +1313,11 @@ void M_Menu_Lighting_f (void)
#ifndef MINIMAL
extern cvar_t r_vertexlight, r_vertexdlights;
#endif
extern cvar_t r_stains, r_shadows, r_shadow_realtime_world, r_loadlits, r_dynamic;
extern cvar_t r_stains, r_shadows, r_loadlits;
extern cvar_t r_lightstylesmooth, r_nolightdir;
extern cvar_t r_shadow_realtime_dlight, r_shadow_realtime_dlight_shadows;
#ifdef RTLIGHTS
extern cvar_t r_dynamic, r_shadow_realtime_world, r_shadow_realtime_dlight, r_shadow_realtime_dlight_shadows;
#endif
extern cvar_t r_fb_models, r_rocketlight, r_powerupglow;
extern cvar_t v_powerupshell, r_explosionlight;
//extern cvar_t r_fb_bmodels, r_shadow_realtime_world_lightmaps, r_lightstylespeed;
@ -1298,10 +1325,12 @@ void M_Menu_Lighting_f (void)
static const char *lightingopts[] =
{
"Standard",
#ifdef RTLIGHTS
"Realtime",
"RT+Shadows",
#ifndef MINIMAL
"Vertex",
#endif
#endif
NULL
};
@ -1309,11 +1338,13 @@ void M_Menu_Lighting_f (void)
{
"None",
"Standard",
#ifdef RTLIGHTS
"Realtime",
"RT+Shadows",
"Threaded Lightmaps",
#ifndef MINIMAL
"Vertex",
#endif
#endif
NULL
};
@ -1381,9 +1412,9 @@ void M_Menu_Lighting_f (void)
int y;
menu_t *menu = M_Options_Title(&y, sizeof(lightingmenuinfo_t));
#ifdef RTLIGHTS
int lightselect, dlightselect;
#ifdef RTLIGHTS
if (r_shadow_realtime_world.ival)
{
if (r_shadow_realtime_world_shadows.ival)
@ -1391,13 +1422,16 @@ void M_Menu_Lighting_f (void)
else
lightselect = 1;
}
#ifndef MINIMAL
else if (r_vertexlight.ival)
lightselect = 3;
#endif
else
#endif
#ifndef MINIMAL
if (r_vertexlight.ival)
lightselect = 3;
else
#endif
lightselect = 0;
#ifdef RTLIGHTS
if (r_shadow_realtime_dlight.ival)
{
if (r_shadow_realtime_dlight_shadows.ival)
@ -1411,11 +1445,12 @@ void M_Menu_Lighting_f (void)
else if (r_vertexdlights.ival)
dlightselect = 5;
#endif
else if (r_dynamic.ival > 0)
else
#endif
if (r_dynamic.ival > 0)
dlightselect = 1;
else
dlightselect = 0;
#endif
{
lightingmenuinfo_t *info = menu->data;
@ -1423,9 +1458,9 @@ void M_Menu_Lighting_f (void)
{
MB_REDTEXT("Lighting Options", false),
MB_TEXT("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", false),
#ifdef RTLIGHTS
MB_COMBORETURN("Lighting Mode", lightingopts, lightselect, info->lightcombo, "Selects method used for world lighting. Realtime lighting requires appropriate realtime lighting files for maps."),
MB_COMBORETURN("Dynamic Lighting Mode", dlightopts, dlightselect, info->dlightcombo, "Selects method used for dynamic lighting such as explosion lights and muzzle flashes."),
#ifdef RTLIGHTS
MB_CHECKBOXCVARTIP("Soft Shadows", r_shadow_shadowmapping, 0, "Enables softer shadows instead of course-edged pixelated shadows."),
MB_CMD("Apply Lighting", M_VideoApplyShadowLighting, "Applies set lighting modes and restarts video."),
MB_SPACING(4),
@ -1456,6 +1491,7 @@ menucombo_t *skillcombo;
menucombo_t *mapcombo;
} singleplayerinfo_t;
#ifndef CLIENTONLY
static const char *maplist_q1[] =
{
"start",
@ -1528,7 +1564,7 @@ static const char *mapoptions_q1[] =
NULL
};
#ifdef Q2CLIENT
static const char *maplist_q2[] =
{
"base1",
@ -1614,6 +1650,8 @@ static const char *mapoptions_q2[] =
"boss2 (Unit 9 Boss Levels: Final Showdown)",
NULL
};
#endif
#endif
qboolean M_Apply_SP_Cheats (union menuoption_s *op,struct menu_s *menu,int key)
{
@ -1638,8 +1676,10 @@ qboolean M_Apply_SP_Cheats (union menuoption_s *op,struct menu_s *menu,int key)
break;
}
#ifndef CLIENTONLY
if ((unsigned int)info->mapcombo->selectedoption >= sizeof(maplist_q1)/sizeof(maplist_q1[0]))
Cbuf_AddText(va("map %s\n", maplist_q1[info->mapcombo->selectedoption]), RESTRICT_LOCAL);
#endif
M_RemoveMenu(menu);
Cbuf_AddText("menu_spcheats\n", RESTRICT_LOCAL);
@ -1649,6 +1689,7 @@ qboolean M_Apply_SP_Cheats (union menuoption_s *op,struct menu_s *menu,int key)
void M_Menu_Singleplayer_Cheats_Quake (void)
{
#ifndef CLIENTONLY
static const char *skilloptions[] =
{
"Easy",
@ -1658,15 +1699,13 @@ void M_Menu_Singleplayer_Cheats_Quake (void)
"None Set",
NULL
};
singleplayerinfo_t *info;
int cursorpositionY;
#ifndef CLIENTONLY
int currentskill;
int currentmap;
extern cvar_t sv_gravity, sv_cheats, sv_maxspeed, skill;
extern cvar_t host_mapname;
#endif
singleplayerinfo_t *info;
int cursorpositionY;
int y;
menu_t *menu = M_Options_Title(&y, sizeof(*info));
info = menu->data;
@ -1725,6 +1764,7 @@ void M_Menu_Singleplayer_Cheats_Quake (void)
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 170, 0, cursorpositionY, NULL, false);
}
#ifdef Q2CLIENT
// Quake 2
typedef struct {
@ -1760,7 +1800,6 @@ qboolean M_Apply_SP_Cheats_Q2 (union menuoption_s *op,struct menu_s *menu,int ke
return true;
}
void M_Menu_Singleplayer_Cheats_Quake2 (void)
{
@ -1848,11 +1887,9 @@ void M_Menu_Singleplayer_Cheats_Quake2 (void)
menu->selecteditem = (union menuoption_s *)info->skillcombo;
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 170, 0, cursorpositionY, NULL, false);
}
#endif // Quake 2
// Hexen 2
// Quake 2
#ifdef HEXEN2 // Hexen 2
typedef struct {
menucombo_t *skillcombo;
menucombo_t *mapcombo;
@ -2203,6 +2240,7 @@ void M_Menu_Singleplayer_Cheats_Hexen2 (void)
menu->selecteditem = (union menuoption_s *)info->skillcombo;
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 250, 0, cursorpositionY, NULL, false);
}
#endif
void M_Menu_Singleplayer_Cheats_f (void)
{

View file

@ -295,8 +295,8 @@ void M_Menu_SinglePlayer_f (void)
#ifndef CLIENTONLY
menubutton_t *b;
mpic_t *p;
#endif
static menuresel_t resel;
#endif
Key_Dest_Add(kdm_emenu);
m_state = m_complex;

View file

@ -1276,7 +1276,7 @@ void M_Reinit(void)
{
M_Init_Internal();
CSQC_UnconnectedInit();
(void)CSQC_UnconnectedInit();
}
}
@ -1329,7 +1329,7 @@ void M_Reinit(void)
if (!MP_Init())
#endif
{
CSQC_UnconnectedInit();
(void)CSQC_UnconnectedInit();
}
}
void M_Init (void)

View file

@ -333,7 +333,7 @@ void SV_Master_Worker_Resolve(void *ctx, void *data, size_t a, size_t b)
first = false;
}
work->success = !!found;
COM_AddWork(0, SV_Master_Worker_Resolved, NULL, work, a, b);
COM_AddWork(WG_MAIN, SV_Master_Worker_Resolved, NULL, work, a, b);
}
/*
@ -388,7 +388,7 @@ void SV_Master_Heartbeat (void)
struct thr_res *work = Z_Malloc(sizeof(*work) + strlen(net_masterlist[i].cv.string));
strcpy(work->str, net_masterlist[i].cv.string);
net_masterlist[i].resolving = true; //don't spam work
COM_AddWork(0, SV_Master_Worker_Resolve, NULL, work, i, 0);
COM_AddWork(WG_MAIN, SV_Master_Worker_Resolve, NULL, work, i, 0);
}
}
else
@ -1259,9 +1259,10 @@ serverinfo_t *Master_FindRoute(netadr_t target)
if (chain)
*chain = 0;
NET_StringToAdr(cl_proxyaddr.string, 0, &pa);
if (NET_StringToAdr(cl_proxyaddr.string, 0, &pa))
prox = Master_InfoForServer(&pa);
else
prox = NULL;
if (chain)
*chain = '@';
}
@ -1419,7 +1420,7 @@ void CLMaster_AddMaster_Worker_Resolve(void *ctx, void *data, size_t a, size_t b
//add the main ip address
work->adr = adrs[0];
COM_AddWork(0, CLMaster_AddMaster_Worker_Resolved, NULL, work, a, b);
COM_AddWork(WG_MAIN, CLMaster_AddMaster_Worker_Resolved, NULL, work, a, b);
//add dupes too (eg: ipv4+ipv6)
for (i = 1; i < found; i++)
@ -1445,7 +1446,7 @@ void CLMaster_AddMaster_Worker_Resolve(void *ctx, void *data, size_t a, size_t b
alt->sends = 1;
alt->nosave = true;
alt->adr = adrs[i];
COM_AddWork(0, CLMaster_AddMaster_Worker_Resolved, NULL, alt, a, b);
COM_AddWork(WG_MAIN, CLMaster_AddMaster_Worker_Resolved, NULL, alt, a, b);
}
}
}
@ -1468,7 +1469,7 @@ void Master_AddMaster (char *address, enum mastertype_e mastertype, enum masterp
strcpy(mast->address, address);
mast->sends = 1;
COM_AddWork(1, CLMaster_AddMaster_Worker_Resolve, NULL, mast, 0, 0);
COM_AddWork(WG_LOADER, CLMaster_AddMaster_Worker_Resolve, NULL, mast, 0, 0);
}
void MasterInfo_Shutdown(void)
@ -2104,7 +2105,10 @@ char *jsonnode(int level, char *node)
if (level == 1)
{
if (!strcmp(key, "IPAddress"))
NET_StringToAdr(com_token, 0, &adr);
{
if (!NET_StringToAdr(com_token, 0, &adr))
adr.type = NA_INVALID;
}
if (!strcmp(key, "Port"))
port = atoi(com_token);
if (!strcmp(key, "DNS"))
@ -2843,14 +2847,14 @@ int CL_ReadServerInfo(char *msg, enum masterprotocol_e prototype, qboolean favor
{
case PROTOCOL_VERSION_QW: info->special = SS_QUAKEWORLD; break;
#ifdef NQPROT
case NQ_PROTOCOL_VERSION: info->special = SS_NETQUAKE; break;
case H2_PROTOCOL_VERSION: info->special = SS_NETQUAKE; break; //erk
case NEHD_PROTOCOL_VERSION: info->special = SS_NETQUAKE; break;
case FITZ_PROTOCOL_VERSION: info->special = SS_NETQUAKE; break;
case RMQ_PROTOCOL_VERSION: info->special = SS_NETQUAKE; break;
case DP5_PROTOCOL_VERSION: info->special = SS_DARKPLACES; break; //dp actually says 3... but hey, that's dp being WEIRD.
case DP6_PROTOCOL_VERSION: info->special = SS_DARKPLACES; break;
case DP7_PROTOCOL_VERSION: info->special = SS_DARKPLACES; break;
case PROTOCOL_VERSION_NQ: info->special = SS_NETQUAKE; break;
case PROTOCOL_VERSION_H2: info->special = SS_NETQUAKE; break; //erk
case PROTOCOL_VERSION_NEHD: info->special = SS_NETQUAKE; break;
case PROTOCOL_VERSION_FITZ: info->special = SS_NETQUAKE; break;
case PROTOCOL_VERSION_RMQ: info->special = SS_NETQUAKE; break;
case PROTOCOL_VERSION_DP5: info->special = SS_DARKPLACES; break; //dp actually says 3... but hey, that's dp being WEIRD.
case PROTOCOL_VERSION_DP6: info->special = SS_DARKPLACES; break;
case PROTOCOL_VERSION_DP7: info->special = SS_DARKPLACES; break;
#endif
default:
if (PROTOCOL_VERSION_Q2 >= info->protocol && info->protocol >= PROTOCOL_VERSION_Q2_MIN)

View file

@ -847,11 +847,10 @@ static void Classic_BrightField (vec3_t org)
extern float r_avertexnormals[NUMVERTEXNORMALS][3];
float beamlength = 16;
int count;
int i;
cparticle_t *p;
float angle;
float sr, sp, sy, cr, cp, cy;
float sp, sy, cp, cy;
vec3_t forward;
float dist;
@ -859,12 +858,15 @@ static void Classic_BrightField (vec3_t org)
particleframe = cl_framecount;
dist = 64;
count = 50;
if (!avelocities[0][0])
{
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
avelocities[0][i] = (rand()&255) * 0.01;
for (i=0 ; i<NUMVERTEXNORMALS ; i++)
{
avelocities[i][0] = (rand()&255) * 0.01;
avelocities[i][1] = (rand()&255) * 0.01;
avelocities[i][2] = (rand()&255) * 0.01;
}
}
for (i=0 ; i<NUMVERTEXNORMALS ; i++)
@ -882,9 +884,8 @@ static void Classic_BrightField (vec3_t org)
angle = cl.time * avelocities[i][1];
sp = sin(angle);
cp = cos(angle);
angle = cl.time * avelocities[i][2];
sr = sin(angle);
cr = cos(angle);
//fixme: is roll important?
forward[0] = cp*cy;
forward[1] = cp*sy;

View file

@ -2356,6 +2356,9 @@ qboolean PScript_Query(int typenum, int body, char *outstr, int outstrlen)
case SM_BOX:
Q_strncatz(outstr, va("spawnmode box %g %g\n", ptype->spawnparam1, ptype->spawnparam2), outstrlen);
break;
case SM_MESHSURFACE:
Q_strncatz(outstr, va("spawnmode meshsurface\n"), outstrlen);
break;
}
if (ptype->spawnvel || ptype->spawnvelvert || all)
Q_strncatz(outstr, va("spawnvel %g %g\n", ptype->spawnvel, ptype->spawnvelvert), outstrlen);
@ -4138,7 +4141,6 @@ static void PScript_ApplyOrgVel(vec3_t oorg, vec3_t ovel, vec3_t eforg, vec3_t a
static void PScript_EffectSpawned(part_type_t *ptype, vec3_t org, vec3_t axis[3], int dlkey, float countscale)
{
extern cvar_t r_rocketlight;
extern cvar_t r_lightflicker;
if (ptype->nummodels)
{

View file

@ -198,6 +198,7 @@ static void bonemat_fromqcvectors(float *out, const float vx[3], const float vy[
out[10] = vz[2];
out[11] = t[2];
}
#ifndef SERVERONLY
static void bonemat_fromaxisorg(float *out, vec3_t axis[3], const float t[3])
{
out[0] = axis[0][0];
@ -213,6 +214,7 @@ static void bonemat_fromaxisorg(float *out, vec3_t axis[3], const float t[3])
out[10]= axis[2][2];
out[11]= t[2];
}
#endif
static void bonemat_fromentity(world_t *w, wedict_t *ed, float *trans)
{
vec3_t d[3], a;
@ -932,7 +934,9 @@ void skel_info_f(void)
{
if (skelobjects[i].world)
{
#ifndef SERVERONLY
extern world_t csqc_world;
#endif
Con_Printf("doll %i:\n", i);
#ifndef CLIENTONLY
if (skelobjects[i].world == &sv.world)

View file

@ -325,7 +325,13 @@ extern cvar_t worker_flush;
qboolean COM_DoWork(int thread, qboolean leavelocked);
#define COM_MainThreadWork() while (COM_DoWork(0, false) && worker_flush.ival) /*called each frame to do any gl uploads or whatever*/
#define COM_MainThreadFlush() while (COM_DoWork(0, false)) /*make sure the main thread has done ALL work pending*/
void COM_AddWork(int thread, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b);
typedef enum
{
WG_MAIN = 0,
WG_LOADER = 1,
WG_COUNT = 2 //main and loaders
} wgroup_t;
void COM_AddWork(wgroup_t thread, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b);
qboolean COM_HasWork(void);
void COM_WorkerFullSync(void);
void COM_DestroyWorkerThread(void);

View file

@ -5,10 +5,17 @@
#include "shader.h"
#endif
//FIXME: shadowmaps should build a cache of the nearby area surfaces and flag those models as RF_NOSHADOW or something
void Mod_SetParent (mnode_t *node, mnode_t *parent);
static int D3_ClusterForPoint (struct model_s *model, vec3_t point);
#ifndef SERVERONLY
void ModD3_GenAreaVBO(void *ctx, void *data, size_t a, size_t b)
{
model_t *sub = ctx;
BE_GenBrushModelVBO(sub);
}
static qboolean Mod_LoadMap_Proc(model_t *model, char *data)
{
char token[256];
@ -106,6 +113,7 @@ static qboolean Mod_LoadMap_Proc(model_t *model, char *data)
data = COM_ParseOut(data, token, sizeof(token));
b[surf].shader = R_RegisterShader_Vertex(token);
// R_BuildDefaultTexnums(NULL, b[surf].shader);
data = COM_ParseOut(data, token, sizeof(token));
numverts = atoi(token);
data = COM_ParseOut(data, token, sizeof(token));
@ -116,7 +124,7 @@ static qboolean Mod_LoadMap_Proc(model_t *model, char *data)
m[surf].numvertexes = numverts;
m[surf].numindexes = numindicies;
vdata = ZG_Malloc(&model->memgroup, numverts * (sizeof(vecV_t) + sizeof(vec2_t) + sizeof(vec3_t) + sizeof(vec4_t)) + numindicies * sizeof(index_t));
vdata = ZG_Malloc(&sub->memgroup, numverts * (sizeof(vecV_t) + sizeof(vec2_t) + sizeof(vec3_t) + sizeof(vec4_t)) + numindicies * sizeof(index_t));
m[surf].colors4f_array[0] = (vec4_t*)vdata;vdata += sizeof(vec4_t)*numverts;
m[surf].xyz_array = (vecV_t*)vdata;vdata += sizeof(vecV_t)*numverts;
@ -194,7 +202,8 @@ static qboolean Mod_LoadMap_Proc(model_t *model, char *data)
sub->fromgame = fg_doom3;
sub->type = mod_brush;
BE_GenBrushModelVBO(sub);
COM_AddWork(WG_MAIN, ModD3_GenAreaVBO, sub, NULL, MLS_LOADED, 0);
COM_AddWork(WG_MAIN, Mod_ModelLoaded, sub, NULL, MLS_LOADED, 0);
}
else if (!strcmp(token, "shadowModel"))
{
@ -358,7 +367,8 @@ static qboolean Mod_LoadMap_Proc(model_t *model, char *data)
qboolean R_CullBox (vec3_t mins, vec3_t maxs);
static int walkno;
/*convert each portal to a 2d box, because its much much simpler than true poly clipping*/
/*fixme: convert each portal to a 2d box, because its much much simpler than true poly clipping*/
/*fixme: use occlusion tests, with temporal coherance (draw the portal as black or something if we think its invisible)*/
static void D3_WalkPortal(model_t *mod, int start, vec_t bounds[4], unsigned char *vis)
{
int i;
@ -393,70 +403,56 @@ static void D3_WalkPortal(model_t *mod, int start, vec_t bounds[4], unsigned cha
unsigned char *D3_CalcVis(model_t *mod, vec3_t org)
{
int start;
static unsigned char vis[256];
static qbyte visbuf[256];
qbyte *usevis;
vec_t newbounds[4];
int area;
entity_t ent;
start = D3_ClusterForPoint(mod, org);
/*figure out which area we're in*/
if (start < 0)
{
/*outside the world, just make it all visible, and take the fps hit*/
memset(vis, 255, 4);
return vis;
memset(visbuf, 255, 4);
usevis = visbuf;
}
else if (r_novis.value)
return vis;
usevis = visbuf;
else
{
memset(vis, 0, 4);
memset(visbuf, 0, 4);
/*make a bounds the size of the view*/
newbounds[0] = -1;
newbounds[1] = 1;
newbounds[2] = -1;
newbounds[3] = 1;
walkno++;
D3_WalkPortal(mod, start, newbounds, vis);
D3_WalkPortal(mod, start, newbounds, visbuf);
// Con_Printf("%x %x %x %x\n", vis[0], vis[1], vis[2], vis[3]);
return vis;
}
usevis = visbuf;
}
/*emits static entities, one for each area, which is only visible if that area is in the vis*/
void D3_GenerateAreas(model_t *mod)
{
entity_t *ent;
int area;
//now generate the various entities for that region.
memset(&ent, 0, sizeof(ent));
for (area = 0; area < 256*8; area++)
{
if (cl.num_statics == cl_max_static_entities)
if (usevis[area>>3] & (1u<<(area&7)))
{
cl_max_static_entities += 16;
cl_static_entities = BZ_Realloc(cl_static_entities, sizeof(*cl_static_entities) * cl_max_static_entities);
ent.model = Mod_FindName(va("*_area%i", area));
ent.scale = 1;
AngleVectors(ent.angles, ent.axis[0], ent.axis[1], ent.axis[2]);
VectorInverse(ent.axis[1]);
ent.shaderRGBAf[0] = 1;
ent.shaderRGBAf[1] = 1;
ent.shaderRGBAf[2] = 1;
ent.shaderRGBAf[3] = 1;
V_AddEntity(&ent);
}
ent = &cl_static_entities[cl.num_statics].ent;
cl_static_entities[cl.num_statics].mdlidx = 0;
memset(ent, 0, sizeof(*ent));
ent->model = Mod_FindName(va("*_area%i", area));
ent->scale = 1;
AngleVectors(ent->angles, ent->axis[0], ent->axis[1], ent->axis[2]);
VectorInverse(ent->axis[1]);
ent->shaderRGBAf[0] = 1;
ent->shaderRGBAf[1] = 1;
ent->shaderRGBAf[2] = 1;
ent->shaderRGBAf[3] = 1;
/*put it in that area*/
cl_static_entities[cl.num_statics].pvscache.num_leafs = 1;
cl_static_entities[cl.num_statics].pvscache.leafnums[0] = area;
if (ent->model && ent->model->loadstate != MLS_NOTLOADED)
cl.num_statics++;
else
break;
}
return usevis;
}
#endif
@ -526,7 +522,7 @@ typedef struct cm_surface_s
int numedges;
vec4_t *edge;
shader_t *shader;
// shader_t *shader;
struct cm_surface_s *next;
} cm_surface_t;
@ -1167,7 +1163,8 @@ qboolean QDECL D3_LoadMap_CollisionMap(model_t *mod, void *buf, size_t bufsize)
buf = COM_ParseOut(buf, token, sizeof(token));
#ifndef SERVERONLY
surf->shader = R_RegisterShader_Vertex(token);
// surf->shader = R_RegisterShader_Vertex(token);
// R_BuildDefaultTexnums(NULL, surf->shader);
#endif
if (filever == 3)
@ -1320,6 +1317,8 @@ qboolean QDECL D3_LoadMap_CollisionMap(model_t *mod, void *buf, size_t bufsize)
BZ_Free(buf);
}
#endif
return true;
}

View file

@ -2801,7 +2801,7 @@ void R_GenWorldEBO(void *ctx, void *data, size_t a, size_t b)
Surf_SimpleWorld(es, pvs);
COM_AddWork(0, R_GeneratedWorldEBO, es, NULL, 0, 0);
COM_AddWork(WG_MAIN, R_GeneratedWorldEBO, es, NULL, 0, 0);
}
#endif
@ -2816,7 +2816,6 @@ void Surf_DrawWorld (void)
//surfvis vs entvis - the key difference is that surfvis is surfaces while entvis is volume. though surfvis should be frustum culled also for lighting. entvis doesn't care.
qbyte *surfvis, *entvis;
qbyte frustumvis_[MAX_MAP_LEAFS/8];
extern cvar_t temp1;
RSpeedLocals();
if (r_refdef.flags & RDF_NOWORLDMODEL)
@ -2883,7 +2882,7 @@ void Surf_DrawWorld (void)
for (i = 0; i < MAX_LIGHTSTYLES; i++)
webogenerating->lightstylevalues[i] = d_lightstylevalue[i];
Q_strncpyz(webogenerating->dbgid, "webostate", sizeof(webogenerating->dbgid));
COM_AddWork(1, R_GenWorldEBO, webogenerating, NULL, 0, 0);
COM_AddWork(WG_LOADER, R_GenWorldEBO, webogenerating, NULL, 0, 0);
}
}
if (webostate)
@ -3057,8 +3056,8 @@ void Surf_Clear(model_t *mod)
{
int i;
vbo_t *vbo;
if (mod->fromgame == fg_doom3)
return;/*they're on the hunk*/
// if (mod->fromgame == fg_doom3)
// return;/*they're on the hunk*/
#ifdef THREADEDWORLD
while(webogenerating)
@ -3580,11 +3579,6 @@ TRACE(("dbg: Surf_NewMap: tp\n"));
TP_NewMap();
R_SetSky(cl.skyname);
#ifdef MAP_PROC
if (cl.worldmodel->fromgame == fg_doom3)
D3_GenerateAreas(cl.worldmodel);
#endif
for (i = 0; i < cl.num_statics; i++)
{
vec3_t mins, maxs;

View file

@ -252,6 +252,7 @@ cvar_t vid_dpi_x = CVARFD ("vid_dpi_x", "0", CVAR_NOSET, "For mods that ne
cvar_t vid_dpi_y = CVARFD ("vid_dpi_y", "0", CVAR_NOSET, "For mods that need to determine the physical screen size (like with touchscreens). 0 means unknown");
cvar_t r_stereo_separation = CVARD("r_stereo_separation", "4", "How far apart your eyes are, in quake units. A non-zero value will enable stereoscoping rendering. You might need some of them retro 3d glasses. Hardware support is recommended, see r_stereo_context.");
cvar_t r_stereo_convergence = CVARD("r_stereo_convergence", "0", "Nudges the angle of each eye inwards when using stereoscopic rendering.");
cvar_t r_stereo_method = CVARFD("r_stereo_method", "0", CVAR_ARCHIVE, "Value 0 = Off.\nValue 1 = Attempt hardware acceleration. Requires vid_restart.\nValue 2 = red/cyan.\nValue 3 = red/blue.\nValue 4=red/green.\nValue 5=eye strain.");
extern cvar_t r_dodgytgafiles;
@ -737,6 +738,7 @@ void Renderer_Init(void)
Cvar_Register (&r_wireframe_smooth, GRAPHICALNICETIES);
Cvar_Register (&r_refract_fbo, GRAPHICALNICETIES);
Cvar_Register (&r_stereo_separation, GRAPHICALNICETIES);
Cvar_Register (&r_stereo_convergence, GRAPHICALNICETIES);
Cvar_Register (&r_stereo_method, GRAPHICALNICETIES);
Cvar_Register(&scr_viewsize, SCREENOPTIONS);

View file

@ -206,6 +206,7 @@ static ALC_API ALCboolean (ALC_APIENTRY *palcIsExtensionPresent)( ALCdevice
//#include "AL/al.h"
//#include "AL/alext.h"
#if defined(VOICECHAT)
//capture-specific stuff
static ALC_API void (ALC_APIENTRY *palcGetIntegerv)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
static ALC_API ALCdevice * (ALC_APIENTRY *palcCaptureOpenDevice)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
@ -216,6 +217,7 @@ static ALC_API void (ALC_APIENTRY *palcCaptureSamples)( ALCdevice *dev
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
#define ALC_CAPTURE_SAMPLES 0x312
#endif
#endif

View file

@ -831,7 +831,7 @@ void S_LoadSoundWorker (void *ctx, void *ctxdata, size_t a, size_t b)
else
{
Con_SafePrintf ("Couldn't load %s\n", namebuffer);
COM_AddWork(0, S_LoadedOrFailed, s, NULL, SLS_FAILED, 0);
COM_AddWork(WG_MAIN, S_LoadedOrFailed, s, NULL, SLS_FAILED, 0);
return;
}
}
@ -880,7 +880,7 @@ void S_LoadSoundWorker (void *ctx, void *ctxdata, size_t a, size_t b)
{
//FIXME: check to see if queued for download.
Con_DPrintf ("Couldn't load %s\n", namebuffer);
COM_AddWork(0, S_LoadedOrFailed, s, NULL, SLS_FAILED, 0);
COM_AddWork(WG_MAIN, S_LoadedOrFailed, s, NULL, SLS_FAILED, 0);
return;
}
@ -891,7 +891,7 @@ void S_LoadSoundWorker (void *ctx, void *ctxdata, size_t a, size_t b)
if (AudioInputPlugins[i](s, data, filesize, snd_speed))
{
//wake up the main thread in case it decided to wait for us.
COM_AddWork(0, S_LoadedOrFailed, s, NULL, SLS_LOADED, 0);
COM_AddWork(WG_MAIN, S_LoadedOrFailed, s, NULL, SLS_LOADED, 0);
BZ_Free(data);
return;
}
@ -901,7 +901,7 @@ void S_LoadSoundWorker (void *ctx, void *ctxdata, size_t a, size_t b)
if (s->loadstate != SLS_FAILED)
Con_Printf ("Format not recognised: %s\n", namebuffer);
COM_AddWork(0, S_LoadedOrFailed, s, NULL, SLS_FAILED, 0);
COM_AddWork(WG_MAIN, S_LoadedOrFailed, s, NULL, SLS_FAILED, 0);
BZ_Free(data);
return;
}
@ -911,7 +911,7 @@ qboolean S_LoadSound (sfx_t *s)
if (s->loadstate == SLS_NOTLOADED && sndcardinfo)
{
s->loadstate = SLS_LOADING;
COM_AddWork(1, S_LoadSoundWorker, s, NULL, 0, 0);
COM_AddWork(WG_LOADER, S_LoadSoundWorker, s, NULL, 0, 0);
}
if (s->loadstate == SLS_FAILED)
return false; //it failed to load once before, don't bother trying again.

View file

@ -151,8 +151,6 @@ static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssam
int outspeed = snd_speed;
int errorcode = 1;
// Con_Printf("Minlength = %03i ", minlength);
start *= 2*dec->srcchannels;
@ -287,12 +285,12 @@ static sfxcache_t *OV_DecodeSome(struct sfx_s *sfx, struct sfxcache_s *buf, ssam
}
return buf;
}
static void OV_CanceledDecoder(void *ctx, void *data, size_t a, size_t b)
/*static void OV_CanceledDecoder(void *ctx, void *data, size_t a, size_t b)
{
sfx_t *s = ctx;
if (s->loadstate != SLS_LOADING)
s->loadstate = SLS_NOTLOADED;
}
}*/
static void OV_CancelDecoder(sfx_t *s)
{
ovdecoderbuffer_t *dec;
@ -320,7 +318,7 @@ static void OV_CancelDecoder(sfx_t *s)
//due to the nature of message passing, we can get into a state where the main thread is going to flag us as loaded when we have already failed.
//that is bad.
//so post a message to the main thread to override it, just in case.
// COM_AddWork(0, OV_CanceledDecoder, s, NULL, SLS_NOTLOADED, 0);
// COM_AddWork(WG_MAIN, OV_CanceledDecoder, s, NULL, SLS_NOTLOADED, 0);
s->loadstate = SLS_NOTLOADED;
}

View file

@ -84,7 +84,7 @@ void INS_Move(float *movements, int pnum)
void INS_Commands(void)
{
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid))
{
}
void INS_Init(void)

View file

@ -1907,7 +1907,7 @@ void R_DrawNameTags(void)
}
}
if ((!cl.spectator && !cls.demoplayback || !scr_autoid.ival) && (!cl.teamplay || !scr_autoid_team.ival))
if (((!cl.spectator && !cls.demoplayback) || !scr_autoid.ival) && (!cl.teamplay || !scr_autoid_team.ival))
return;
if (cls.state != ca_active || !cl.validsequence || cl.intermissionmode != IM_NONE)
return;

View file

@ -211,7 +211,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SVRANKING
#define USE_SQLITE
#ifdef SERVERONLY
#define USE_MYSQL //allow mysql in dedicated servers.
// #define USE_MYSQL //allow mysql in dedicated servers.
#endif
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT)
#define SUBSERVERS //use subserver code.

View file

@ -265,7 +265,7 @@ void Cbuf_AddText (const char *text, int level)
if (!Sys_IsMainThread())
{
COM_AddWork(0, Cbuf_WorkerAddText, NULL, Z_StrDup(text), level, 0);
COM_AddWork(WG_MAIN, Cbuf_WorkerAddText, NULL, Z_StrDup(text), level, 0);
return;
}

View file

@ -36,7 +36,7 @@ void Mod_DoCRC(model_t *mod, char *buffer, int buffersize)
for (len = buffersize, p = buffer; len; len--, p++)
QCRC_ProcessByte(&crc, *p);
COM_AddWork(0, Mod_UpdateCRC, (mod->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, NULL, crc, 0);
COM_AddWork(WG_MAIN, Mod_UpdateCRC, (mod->engineflags & MDLF_PLAYER) ? pmodel_name : emodel_name, NULL, crc, 0);
if (!(mod->engineflags & MDLF_PLAYER))
{ //eyes
@ -1025,14 +1025,8 @@ void R_LightArrays(const entity_t *entity, vecV_t *coords, avec4_t *colours, int
}
}
}
#endif
static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float lerp, float expand, float lerpcutoff)
{
#ifdef SERVERONLY
//no lerping in dedicated servers. too lazy.
mesh->xyz_array = p1->ofsverts;
#else
extern cvar_t r_nolerp; // r_nolightdir is unused
float blerp = 1-lerp;
int i;
@ -1124,9 +1118,9 @@ static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float
}
}
}
#endif
}
#endif
#endif
#ifdef SKELETALMODELS
/*
@ -1151,7 +1145,9 @@ static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion
galiasanimation_t *g;
unsigned int b;
float totalweight = 0;
#ifndef SERVERONLY
extern cvar_t r_nolerp;
#endif
lerps->skeltype = SKEL_IDENTITY; //sometimes nothing else is valid.
@ -1623,16 +1619,20 @@ void Alias_Shutdown(void)
qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, int surfnum, entity_t *e, qboolean usebones)
{
extern cvar_t r_nolerp;
galiasanimation_t *g1, *g2;
#ifndef SERVERONLY
extern cvar_t r_nolerp;
float lerpcutoff;
#endif
int frame1;
int frame2;
float lerp;
float fg1time;
// float fg2time;
#ifdef SKELETALMODELS
qboolean bytecolours = false;
#endif
if (!inf->numanimations)
{
@ -1670,7 +1670,9 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in
#ifndef SERVERONLY
mesh->colors4f_array[0] = inf->ofs_rgbaf;
mesh->colors4b_array = inf->ofs_rgbaub;
#ifdef SKELETALMODELS
bytecolours = !!inf->ofs_rgbaub;
#endif
mesh->st_array = inf->ofs_st_array;
#endif
mesh->trneighbors = inf->ofs_trineighbours;
@ -1923,9 +1925,8 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in
frame2=0;
}
lerpcutoff = inf->lerpcutoff * r_lerpmuzzlehack.value;
#ifndef SERVERONLY
lerpcutoff = inf->lerpcutoff * r_lerpmuzzlehack.value;
if (/*qrenderer != QR_OPENGL ||*/ Sh_StencilShadowsActive() || e->fatness || lerpcutoff)
{
mesh->xyz2_array = NULL;
@ -1937,7 +1938,9 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in
#endif
{
galiaspose_t *p1 = &g1->poseofs[frame1];
#ifndef SERVERONLY
galiaspose_t *p2 = &g2->poseofs[frame2];
#endif
meshcache.vbo.indicies = inf->vboindicies;
meshcache.vbo.indexcount = inf->numindexes;
@ -2054,7 +2057,7 @@ qboolean Mod_Trace_Trisoup(vecV_t *posedata, index_t *indexes, int numindexes, v
float frac;
vec3_t impactpoint;
shader_t *lineshader = NULL;
// shader_t *lineshader = NULL;
for (i = 0; i < numindexes; i+=3)
{
@ -2208,7 +2211,9 @@ qboolean Mod_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3],
vecV_t *posedata;
index_t *indexes;
int surfnum = 0;
#ifdef SKELETALMODELS
int cursurfnum = -1;
#endif
vec3_t start_l, end_l;
@ -2348,6 +2353,7 @@ static void Mod_ClampModelSize(model_t *mod)
#endif
}
#ifndef SERVERONLY
static int R_FindTriangleWithEdge (index_t *indexes, int numtris, int start, int end, int ignore)
{
int i;
@ -2377,10 +2383,20 @@ static int R_FindTriangleWithEdge (index_t *indexes, int numtris, int start, int
return match;
}
static void Mod_BuildTriangleNeighbours ( int *neighbours, index_t *indexes, int numtris )
#endif
void Mod_CompileTriangleNeighbours(model_t *loadmodel, galiasinfo_t *galias)
{
#ifndef SERVERONLY
if (Sh_StencilShadowsActive())
{
int i, *n;
index_t *index;
index_t *indexes = galias->ofs_indexes;
int numtris = galias->numindexes/3;
int *neighbours;
neighbours = ZG_Malloc(&loadmodel->memgroup, sizeof(int)*numtris*3);
galias->ofs_trineighbours = neighbours;
for (i = 0, index = indexes, n = neighbours; i < numtris; i++, index += 3, n += 3)
{
@ -2389,16 +2405,6 @@ static void Mod_BuildTriangleNeighbours ( int *neighbours, index_t *indexes, int
n[2] = R_FindTriangleWithEdge (indexes, numtris, index[0], index[2], i);
}
}
void Mod_CompileTriangleNeighbours(model_t *loadmodel, galiasinfo_t *galias)
{
#ifndef SERVERONLY
if (Sh_StencilShadowsActive())
{
int *neighbours;
neighbours = ZG_Malloc(&loadmodel->memgroup, sizeof(int)*galias->numindexes/3*3);
galias->ofs_trineighbours = neighbours;
Mod_BuildTriangleNeighbours(neighbours, galias->ofs_indexes, galias->numindexes/3);
}
#endif
}
@ -2571,7 +2577,6 @@ void Mod_BuildTextureVectors(galiasinfo_t *galias)
vec3_t *nv, *sv, *tv;
vec2_t *tc;
index_t *idx;
int vbospace = 0;
//don't fail on dedicated servers
if (!BE_VBO_Begin)
@ -3170,39 +3175,6 @@ static void *Q1MDL_LoadSkins_GL (galiasinfo_t *galias, dmdl_t *pq1inmodel, model
frames[0].texels = saved;
memcpy(saved, pskintype+1, s);
Mod_FloodFillSkin(saved, outskin->skinwidth, outskin->skinheight);
#if 0
//the extra underscore is to stop replacement matches
if (!TEXVALID(texture))
{
snprintf(skinname, sizeof(skinname), "%s__%i.", basename, i);
switch (skintranstype)
{
default:
texture = r_nulltex;//R_LoadTexture(skinname,outskin->skinwidth,outskin->skinheight, TF_SOLID8, saved, IF_NOALPHA|IF_NOGAMMA);
if (r_fb_models.ival)
{
snprintf(skinname, sizeof(skinname), "%s__%i_luma.", basename, i);
fbtexture = r_nulltex;//R_LoadTextureFB(skinname, outskin->skinwidth, outskin->skinheight, saved, IF_NOGAMMA);
}
if (r_loadbumpmapping)
{
snprintf(skinname, sizeof(skinname), "%s__%i_bump.", basename, i);
bumptexture = r_nulltex;//R_LoadTexture8BumpPal(skinname, outskin->skinwidth, outskin->skinheight, saved, IF_NOGAMMA);
}
break;
case 2:
texture = r_nulltex;//R_LoadTexture(skinname,outskin->skinwidth,outskin->skinheight, TF_H2_T7G1, saved, IF_NOGAMMA);
break;
case 3:
texture = r_nulltex;//R_LoadTexture(skinname,outskin->skinwidth,outskin->skinheight, TF_H2_TRANS8_0, saved, IF_NOGAMMA);
break;
case 4:
texture = r_nulltex;//R_LoadTexture(skinname,outskin->skinwidth,outskin->skinheight, TF_H2_T4A4, saved, IF_NOGAMMA);
break;
}
}
#endif
}
else
frames = ZG_Malloc(&loadmodel->memgroup, sizeof(*frames));
@ -3344,7 +3316,7 @@ static void *Q1MDL_LoadSkins_GL (galiasinfo_t *galias, dmdl_t *pq1inmodel, model
void Mesh_HandleFramegroupsFile(model_t *mod, galiasinfo_t *galias)
{
unsigned int numanims, a, p, n, g, oldnumanims = galias->numanimations, targpose;
unsigned int numanims, a, p, g, oldnumanims = galias->numanimations, targpose;
galiasanimation_t *o, *oldanims = galias->ofsanimations, *frame;
frameinfo_t *framegroups = ParseFrameInfo(mod->name, &numanims);
if (framegroups)
@ -3356,7 +3328,7 @@ void Mesh_HandleFramegroupsFile(model_t *mod, galiasinfo_t *galias)
for (p = 0; p < framegroups[a].posecount; p++)
{
targpose = framegroups[a].firstpose + p;
for (n = 0, g = 0, frame = oldanims; g < oldnumanims; g++, frame++)
for (g = 0, frame = oldanims; g < oldnumanims; g++, frame++)
{
if (targpose < frame->numposes)
break;
@ -4635,6 +4607,7 @@ qboolean QDECL Mod_LoadQ3Model(model_t *mod, void *buffer, size_t fsize)
vec3_t *tvector;
vec2_t *st_array;
md3Shader_t *inshader;
int externalskins;
#endif
// int version;
int s, i, j, d;
@ -4655,7 +4628,6 @@ qboolean QDECL Mod_LoadQ3Model(model_t *mod, void *buffer, size_t fsize)
int size;
int externalskins;
md3Header_t *header;
md3Surface_t *surf;
@ -4671,8 +4643,6 @@ qboolean QDECL Mod_LoadQ3Model(model_t *mod, void *buffer, size_t fsize)
#ifndef SERVERONLY
externalskins = Mod_CountSkinFiles(mod->name);
#else
externalskins = 0;
#endif
min[0] = min[1] = min[2] = 0;
@ -5994,7 +5964,6 @@ qboolean QDECL Mod_LoadDarkPlacesModel(model_t *mod, void *buffer, size_t fsize)
unsigned int *index; index_t *outdex; // groan...
int numtransforms;
int numverts;
header = buffer;
@ -6048,7 +6017,6 @@ qboolean QDECL Mod_LoadDarkPlacesModel(model_t *mod, void *buffer, size_t fsize)
mesh->ofs_groupids = BigLong(mesh->ofs_groupids);
numverts = mesh->num_verts;
numtransforms = 0;
//count and byteswap the transformations
vert = (dpmvertex_t*)((char *)buffer+mesh->ofs_verts);
@ -6064,11 +6032,11 @@ qboolean QDECL Mod_LoadDarkPlacesModel(model_t *mod, void *buffer, size_t fsize)
#ifdef SERVERONLY
transforms = ZG_Malloc(&mod->memgroup, numtransforms*sizeof(galisskeletaltransforms_t) + mesh->num_tris*3*sizeof(index_t));
#else
outst = ZG_Malloc(&mod->memgroup, numverts*sizeof(vec2_t) + numtransforms*sizeof(galisskeletaltransforms_t) + mesh->num_tris*3*sizeof(index_t));
outst = ZG_Malloc(&mod->memgroup, mesh->num_verts*sizeof(vec2_t) + numtransforms*sizeof(galisskeletaltransforms_t) + mesh->num_tris*3*sizeof(index_t));
m->ofs_st_array = (vec2_t*)outst;
m->numverts = mesh->num_verts;
inst = (float*)((char*)buffer + mesh->ofs_texcoords);
for (j = 0; j < numverts; j++, outst+=2, inst+=2)
for (j = 0; j < mesh->num_verts; j++, outst+=2, inst+=2)
{
outst[0] = BigFloat(inst[0]);
outst[1] = BigFloat(inst[1]);

View file

@ -78,10 +78,10 @@ glibc SUCKS. 64bit glibc is depending upon glibc 2.14 because of some implementa
or something.
anyway, the actual interface is the same. the old version might be slower, but when updating glibc generally results in also installing systemd, requiring the new version is NOT an option.
*/
#if defined(__GNUC__) && defined(__LP64__)
#if defined(__GNUC__) && defined(__LP64__) && defined(__linux__)
#include <features.h> /* for glibc version */
#if defined(__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 14)
__asm__(".symver oldmemcpy,memcpy@GLIBC_2.2.5");
__asm__(".symver oldmemcpy,memcpy@GLIBC_2.2.5"); void *oldmemcpy(void *__restrict dst, const void *__restrict src, size_t len);
__attribute__ ((visibility ("hidden"))) void *memcpy(void *__restrict dst, const void *__restrict src, size_t len)
{
return oldmemcpy(dst,src,len);
@ -4763,9 +4763,6 @@ cvar_t worker_flush = CVARD("worker_flush", "1", "If set, process the entire loa
cvar_t worker_count = CVARFDC("worker_count", "", CVAR_NOTFROMSERVER, "Specifies the number of worker threads to utilise.", COM_WorkerCount_Change);
cvar_t worker_sleeptime = CVARFD("worker_sleeptime", "0", CVAR_NOTFROMSERVER, "Causes workers to sleep for a period of time after each job.");
#define WG_MAIN 0
#define WG_LOADER 1
#define WG_COUNT 2 //main and loaders
#define WORKERTHREADS 16 //max
/*multithreading worker thread stuff*/
static int com_liveworkers[WG_COUNT];
@ -4781,7 +4778,6 @@ static struct com_worker_s
} request;
volatile int ackseq;
} com_worker[WORKERTHREADS];
static unsigned int mainthreadid;
qboolean com_workererror;
static struct com_work_s
{
@ -4803,8 +4799,7 @@ qboolean COM_HasWork(void)
}
return false;
}
//thread==0 is main thread, thread==1 is a worker thread
void COM_AddWork(int tg, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b)
void COM_AddWork(wgroup_t tg, void(*func)(void *ctx, void *data, size_t a, size_t b), void *ctx, void *data, size_t a, size_t b)
{
struct com_work_s *work;
@ -4900,7 +4895,7 @@ qboolean COM_DoWork(int tg, qboolean leavelocked)
//nothing going on, if leavelocked then noone can add anything until we sleep.
return false;
}
static void COM_WorkerSync_ThreadAck(void *ctx, void *data, size_t a, size_t b)
/*static void COM_WorkerSync_ThreadAck(void *ctx, void *data, size_t a, size_t b)
{
int us;
int *ackbuf = ctx;
@ -4920,6 +4915,7 @@ static void COM_WorkerSync_ThreadAck(void *ctx, void *data, size_t a, size_t b)
Sys_ConditionSignal(com_workercondition[WG_MAIN]);
Sys_UnlockConditional(com_workercondition[WG_MAIN]);
}
*/
/*static void COM_WorkerSync_SignalMain(void *ctx, void *data, size_t a, size_t b)
{
Sys_LockConditional(com_workercondition[a]);
@ -5261,9 +5257,9 @@ static void COM_InitWorkerThread(void)
//technically its ready now...
if (COM_CheckParm("-noworker"))
if (COM_CheckParm("-noworker") || COM_CheckParm("-noworkers"))
{
worker_count.string = "0";
worker_count.enginevalue = "0";
worker_count.flags |= CVAR_NOSET;
}
Cvar_Register(&worker_count, NULL);

View file

@ -37,11 +37,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdint.h>
#define qintptr_t intptr_t
#define quintptr_t uintptr_t
#define qint32_t qint32_t
#define quint32_t quint32_t
#define qint64_t qint64_t
#define quint64_t quint64_t
#else
#define qint32_t int
#define quint32_t unsigned qint32_t
#if defined(_WIN64)
#define qintptr_t __int64
#define FTE_WORDSIZE 64
#define quintptr_t unsigned qintptr_t
#define qint64_t __int64
#define quint64_t unsigned __int64
#elif defined(_WIN32)
#ifndef _MSC_VER
#define __w64
@ -50,16 +58,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef unsigned __int32 __w64 quintptr_t;
// #define qintptr_t __int32
// #define quintptr_t unsigned qintptr_t
#define qint64_t __int64
#define quint64_t unsigned __int64
#define FTE_WORDSIZE 32
#else
#if __WORDSIZE == 64
#ifdef __LP64__
#define qintptr_t long
#define qint64_t long
#define FTE_WORDSIZE 64
#elif __WORDSIZE == 64
#define qintptr_t long long
#define qint64_t long long
#define FTE_WORDSIZE 64
#else
#define qintptr_t long
#define qint64_t long long
#define FTE_WORDSIZE 32
#endif
#define quintptr_t unsigned qintptr_t
#define quint64_t unsigned qint64_t
#endif
#endif
@ -397,13 +414,13 @@ extern char com_configdir[MAX_OSPATH]; //dir to put cfg_save configs in
#define FS_64BIT
#endif
#if 1//def FS_64BIT
typedef unsigned long long qofs_t; //type to use for a file offset
typedef quint64_t qofs_t; //type to use for a file offset
#define qofs_Make(low,high) (low | (((qofs_t)(high))<<32))
#define qofs_Low(o) ((o)&0xffffffffu)
#define qofs_High(o) ((o)>>32)
#define qofs_Error(o) ((o) == ~0ull)
#else
typedef unsigned int qofs_t; //type to use for a file offset
typedef quint32_t qofs_t; //type to use for a file offset
#define qofs_Make(low,high) (low)
#define qofs_Low(o) (o)
#define qofs_High(o) (0)

View file

@ -2516,7 +2516,7 @@ qboolean FS_PathURLCache(const char *url, char *path, size_t pathsize)
{
const char *FS_GetCleanPath(const char *pattern, char *outbuf, int outlen);
char tmp[MAX_QPATH];
char *o = tmp, *e = o + sizeof(tmp)-1;
char *o = tmp;
const char *i = url;
strcpy(o, "downloads/");
o += strlen(o);
@ -3814,6 +3814,7 @@ static ftemanifest_t *FS_GenerateLegacyManifest(char *newbasedir, int sizeof_new
return man;
}
#ifdef WEBCLIENT
static char *FS_RelativeURL(char *base, char *file, char *buffer, int bufferlen)
{
//fixme: cope with windows paths
@ -3847,16 +3848,15 @@ static char *FS_RelativeURL(char *base, char *file, char *buffer, int bufferlen)
return buffer;
}
#ifdef WEBCLIENT
static struct dl_download *curpackagedownload;
static enum manifestdeptype_e fspdl_type;
static enum {
X_DLONLY,
X_COPY,
X_MULTIUNZIP,
X_UNZIP,
X_GZ,
X_XZ
X_DLONLY, //simple pk3 file
X_COPY, //we copy it from an existing install (ie: special install path for total conversion)
X_MULTIUNZIP, //zip with multiple files that need extracting
X_UNZIP, //pull a single file from a zip
X_GZ, //dlonly+ungzip
X_XZ //dlonly+unxzip
} fspdl_extracttype;
static char fspdl_internalname[MAX_QPATH];
static char fspdl_temppath[MAX_OSPATH];
@ -4256,6 +4256,8 @@ static qboolean FS_BeginPackageDownload(struct manpack_s *pack, char *baseurl, q
tmpf = NULL;
#endif
break;
default:
break;
}
if (!tmpf)
@ -4697,12 +4699,12 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs, qboolean
{
FS_ReloadPackFilesFlags(~0);
Sys_UnlockMutex(fs_thread_mutex);
FS_BeginManifestUpdates();
COM_CheckRegistered();
Sys_UnlockMutex(fs_thread_mutex);
if (allowreloadconfigs)
{
qboolean vidrestart = false;
@ -4751,11 +4753,13 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs, qboolean
#endif
}
}
#ifndef SERVERONLY
else if (vidrestart)
{
#ifndef SERVERONLY
Cbuf_AddText ("vid_reload\n", RESTRICT_LOCAL);
#endif
}
}
//rebuild the cache now, should be safe to waste some cycles on it
COM_FlushFSCache(false, true);

View file

@ -52,15 +52,19 @@ void *zlib_handle;
#endif
#endif
#ifndef Z_U4
#define z_crc_t uLongf
#endif
//#pragma comment(lib, MSVCLIBSPATH "zlib.lib")
static int (ZEXPORT *qinflateEnd) (z_streamp strm) ZSTATIC(inflateEnd);
static int (ZEXPORT *qinflate) (z_streamp strm, int flush) ZSTATIC(inflate);
static int (ZEXPORT *qinflateInit2_) (z_streamp strm, int windowBits,
const char *version, int stream_size) ZSTATIC(inflateInit2_);
//static uLong (ZEXPORT *qcrc32) (uLong crc, const Bytef *buf, uInt len) ZSTATIC(crc32);
//static z_crc_t (ZEXPORT *qcrc32) (uLong crc, const Bytef *buf, uInt len) ZSTATIC(crc32);
#ifdef ZIPCRYPT
static const uLongf *(ZEXPORT *qget_crc_table) (void) ZSTATIC(get_crc_table);
static const z_crc_t *(ZEXPORT *qget_crc_table) (void) ZSTATIC(get_crc_table);
#endif
#define qinflateInit2(strm, windowBits) \
@ -288,7 +292,7 @@ static int QDECL FS_GZ_Dec_Write(vfsfile_t *f, const void *buffer, int len)
{
if (n->inlen >= 8)
{
unsigned int crc = (n->in[0]<<0) | (n->in[1]<<8) | (n->in[2]<<16) | (n->in[3]<<24);
//unsigned int crc = (n->in[0]<<0) | (n->in[1]<<8) | (n->in[2]<<16) | (n->in[3]<<24);
unsigned int isize = (n->in[4]<<0) | (n->in[5]<<8) | (n->in[6]<<16) | (n->in[7]<<24);
if (n->strm.total_out != isize)
return -1; //the file we just received decoded to a different length (yay, concat...).
@ -853,7 +857,7 @@ static vfsfile_t *FSZIP_Decompress_ToTempFile(struct decompressstate *decompress
zipfile_t *source = decompress->source;
qboolean encrypted = decompress->encrypted;
unsigned int cryptkeys[3];
const uLongf *crctab = decompress->crctable;
const z_crc_t *crctab = decompress->crctable;
memcpy(cryptkeys, decompress->initialkey, sizeof(cryptkeys));

View file

@ -57,11 +57,12 @@ qboolean Mod_LoadEdges (model_t *loadmodel, qbyte *mod_base, lump_t *l, qboolean
qboolean Mod_LoadMarksurfaces (model_t *loadmodel, qbyte *mod_base, lump_t *l, qboolean lm);
qboolean Mod_LoadSurfedges (model_t *loadmodel, qbyte *mod_base, lump_t *l);
#ifdef Q2BSPS
static qboolean CM_NativeTrace(model_t *model, int forcehullnum, int frame, vec3_t axis[3], vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, qboolean capsule, unsigned int contents, trace_t *trace);
static unsigned int CM_NativeContents(struct model_s *model, int hulloverride, int frame, vec3_t axis[3], vec3_t p, vec3_t mins, vec3_t maxs);
static unsigned int Q2BSP_PointContents(model_t *mod, vec3_t axis[3], vec3_t p);
static int CM_PointCluster (model_t *mod, vec3_t p);
#endif
float RadiusFromBounds (vec3_t mins, vec3_t maxs)
{
@ -3875,9 +3876,11 @@ static cmodel_t *CM_LoadMap (model_t *mod, qbyte *filein, size_t filelen, qboole
char loadname[32];
qbyte *mod_base = (qbyte *)filein;
#ifndef SERVERONLY
void (*buildmeshes)(model_t *mod, msurface_t *surf, builddata_t *cookie) = NULL;
qbyte *facedata = NULL;
unsigned int facesize = 0;
#endif
cminfo_t *prv;
COM_FileBase (mod->name, loadname, sizeof(loadname));
@ -4263,7 +4266,7 @@ static cmodel_t *CM_LoadMap (model_t *mod, qbyte *filein, size_t filelen, qboole
bd->buildfunc = buildmeshes;
memcpy(bd+1, facedata + mod->firstmodelsurface*facesize, facesize*mod->nummodelsurfaces);
}
COM_AddWork(0, ModBrush_LoadGLStuff, mod, bd, 0, 0);
COM_AddWork(WG_MAIN, ModBrush_LoadGLStuff, mod, bd, 0, 0);
}
#endif
@ -4320,10 +4323,10 @@ static cmodel_t *CM_LoadMap (model_t *mod, qbyte *filein, size_t filelen, qboole
bd->buildfunc = buildmeshes;
memcpy(bd+1, facedata + mod->firstmodelsurface*facesize, facesize*mod->nummodelsurfaces);
}
COM_AddWork(0, ModBrush_LoadGLStuff, mod, bd, i, 0);
COM_AddWork(WG_MAIN, ModBrush_LoadGLStuff, mod, bd, i, 0);
}
#endif
COM_AddWork(0, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
COM_AddWork(WG_MAIN, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
}
#ifdef TERRAIN
@ -4426,7 +4429,6 @@ can just be stored out and get a proper clipping hull structure.
void CM_InitBoxHull (void)
{
int i;
int side;
mplane_t *p;
q2cbrushside_t *s;
@ -4455,8 +4457,6 @@ void CM_InitBoxHull (void)
for (i=0 ; i<6 ; i++)
{
side = i&1;
//the pointers
s = &box_sides[i];
p = &box_planes[i];

View file

@ -62,11 +62,7 @@ struct sockaddr_qstorage
{
short dontusesa_family;
unsigned char dontusesa_pad[6];
#if defined(_MSC_VER) || defined(MINGW)
__int64 sa_align;
#else
int sa_align[2];
#endif
qint64_t sa_align;
unsigned char sa_pad2[112];
};
@ -269,14 +265,17 @@ void Huff_EmitByte(int ch, qbyte *buffer, int *count);
#define CCREP_RULE_INFO 0x85
//server->client protocol info
#define NQ_PROTOCOL_VERSION 15
#define H2_PROTOCOL_VERSION 19
#define NEHD_PROTOCOL_VERSION 250
#define FITZ_PROTOCOL_VERSION 666
#define RMQ_PROTOCOL_VERSION 999
#define DP5_PROTOCOL_VERSION 3502
#define DP6_PROTOCOL_VERSION 3503
#define DP7_PROTOCOL_VERSION 3504
#define PROTOCOL_VERSION_NQ 15
#define PROTOCOL_VERSION_H2 19
#define PROTOCOL_VERSION_NEHD 250
#define PROTOCOL_VERSION_FITZ 666
#define PROTOCOL_VERSION_RMQ 999
#define PROTOCOL_VERSION_DP5 3502
#define PROTOCOL_VERSION_DP6 3503
#define PROTOCOL_VERSION_DP7 3504
#define PROTOCOL_VERSION_BJP1 10000
#define PROTOCOL_VERSION_BJP2 10001
#define PROTOCOL_VERSION_BJP3 10002
/*RMQ protocol flags*/
#define RMQFL_SHORTANGLE (1 << 1)

View file

@ -668,13 +668,15 @@ qboolean QDECL ICE_Set(struct icestate_s *con, const char *prop, const char *val
{
Z_Free(con->stunserver);
con->stunserver = Z_StrDup(value);
NET_StringToAdr(con->stunserver, con->stunport, &con->pubstunserver);
if (!NET_StringToAdr(con->stunserver, con->stunport, &con->pubstunserver))
return false;
}
else if (!strcmp(prop, "stunport"))
{
con->stunport = atoi(value);
if (con->stunserver)
NET_StringToAdr(con->stunserver, con->stunport, &con->pubstunserver);
if (!NET_StringToAdr(con->stunserver, con->stunport, &con->pubstunserver))
return false;
}
/*
else if (!strcmp(prop, "sdp"))
@ -785,7 +787,7 @@ qboolean QDECL ICE_Set(struct icestate_s *con, const char *prop, const char *val
return false;
return true;
}
qboolean QDECL ICE_Get(struct icestate_s *con, char *prop, char *value, int valuelen)
qboolean QDECL ICE_Get(struct icestate_s *con, const char *prop, char *value, int valuelen)
{
if (!strcmp(prop, "sid"))
Q_strncpyz(value, con->conname, valuelen);
@ -983,9 +985,7 @@ void ICE_Tick(void)
{
struct icecandidate_s *rc;
rc = con->rc;
if (rc)
NET_StringToAdr(rc->info.addr, rc->info.port, &con->chosenpeer);
else
if (!rc || !NET_StringToAdr(rc->info.addr, rc->info.port, &con->chosenpeer))
con->chosenpeer.type = NA_INVALID;
ICE_Set(con, "state", STRINGIFY(ICE_CONNECTED));
}

View file

@ -201,7 +201,7 @@ typedef struct
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
static void QDECL SSL_Close(vfsfile_t *vfs)
static qboolean QDECL SSL_Close(vfsfile_t *vfs)
{
gnutlsfile_t *file = (void*)vfs;
@ -213,6 +213,7 @@ static void QDECL SSL_Close(vfsfile_t *vfs)
if (file->stream)
VFS_CLOSE(file->stream);
file->stream = NULL;
return true;
}
static int QDECL SSL_CheckCert(gnutls_session_t session)
{

View file

@ -81,7 +81,6 @@ cvar_t net_enabled = CVARD("net_enabled", "1", "If 0, disables all network acce
extern cvar_t sv_public, sv_listen_qw, sv_listen_nq, sv_listen_dp, sv_listen_q3;
static qboolean allowconnects = false;
@ -439,7 +438,7 @@ static void NET_AdrToStringDoResolve(void *ctx, void *data, size_t a, size_t b)
NET_BaseAdrToString(adrstring, NI_MAXHOST, n);
}
}
COM_AddWork(0, resolved, ctx, adrstring, a, b);
COM_AddWork(WG_MAIN, resolved, ctx, adrstring, a, b);
Z_Free(n);
}
@ -448,7 +447,7 @@ void NET_AdrToStringResolve (netadr_t *adr, void (*resolved)(void *ctx, void *da
netadr_t *n = Z_Malloc(sizeof(*n) + sizeof(void*));
*n = *adr;
*(void**)(n+1) = resolved;
COM_AddWork(2, NET_AdrToStringDoResolve, ctx, n, a, b);
COM_AddWork(WG_LOADER, NET_AdrToStringDoResolve, ctx, n, a, b);
}
*/
@ -824,6 +823,7 @@ size_t NET_StringToSockaddr2 (const char *s, int defaultport, struct sockaddr_qs
char dupbase[256];
int len;
size_t i;
double restime = Sys_DoubleTime();
memset(&udp6hint, 0, sizeof(udp6hint));
udp6hint.ai_family = 0;//Any... we check for AF_INET6 or 4
@ -863,6 +863,13 @@ size_t NET_StringToSockaddr2 (const char *s, int defaultport, struct sockaddr_qs
if (error) //failed, try string with no port.
error = pgetaddrinfo(s, NULL, &udp6hint, &addrinfo); //remember, this func will return any address family that could be using the udp protocol... (ip4 or ip6)
}
restime = Sys_DoubleTime()-restime;
if (restime > 0.5)
{ //adding this in an attempt to debug somewhat periodic stalls that I'm being told about.
Con_DPrintf("DNS resolution of %s %s %f seconds (on %s thread)\n", s, error?"failed after":"took", restime, Sys_IsMainThread()?"main":"worker");
}
if (error)
{
return false;
@ -1764,20 +1771,26 @@ ftenet_connections_t *FTENET_CreateCollection(qboolean listen)
col->islisten = listen;
return col;
}
#if !defined(SERVERONLY) && !defined(CLIENTONLY)
static ftenet_generic_connection_t *FTENET_Loop_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
#endif
static ftenet_generic_connection_t *FTENET_UDP4_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
static ftenet_generic_connection_t *FTENET_UDP6_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
#ifdef TCPCONNECT
static ftenet_generic_connection_t *FTENET_TCP4Connect_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
static ftenet_generic_connection_t *FTENET_TCP6Connect_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
static ftenet_generic_connection_t *FTENET_TLS4Connect_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
static ftenet_generic_connection_t *FTENET_TLS6Connect_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
#endif
#ifdef USEIPX
static ftenet_generic_connection_t *FTENET_IPX_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
#endif
#ifdef HAVE_WEBSOCKCL
static ftenet_generic_connection_t *FTENET_WebSocket_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
#endif
#ifdef IRCCONNECT
static ftenet_generic_connection_t *FTENET_IRCConnect_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
#endif
#ifdef HAVE_NATPMP
static ftenet_generic_connection_t *FTENET_NATPMP_EstablishConnection(qboolean isserver, const char *address, netadr_t adr);
#endif
@ -2095,7 +2108,7 @@ qboolean FTENET_AddToCollection(ftenet_connections_t *col, const char *name, con
ftenet_generic_connection_t *(*establish[countof(adr)])(qboolean isserver, const char *address, netadr_t adr);
char address[countof(adr)][256];
unsigned int i, j;
qboolean success;
qboolean success = false;
if (strchr(name, ':'))
return false;
@ -2109,7 +2122,10 @@ qboolean FTENET_AddToCollection(ftenet_connections_t *col, const char *name, con
else if (islisten)
NET_PortToAdr(addrtype, address[i], &adr[i]);
else
NET_StringToAdr(address[i], 0, &adr[i]);
{
if (!NET_StringToAdr(address[i], 0, &adr[i]))
return false;
}
switch(adr[i].type)
{
@ -3377,7 +3393,7 @@ handshakeerror:
}
if ((ctrl & 0x7f) == 127)
{
unsigned long long ullpaylen;
quint64_t ullpaylen;
//as a payload is not allowed to be encoded as too large a type, and quakeworld never used packets larger than 1450 bytes anyway, this code isn't needed (65k is the max even without this)
if (sizeof(ullpaylen) < 8)
{
@ -3389,14 +3405,14 @@ handshakeerror:
if (payoffs + 8 > st->inlen)
break;
ullpaylen =
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+0]<<56ull |
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+1]<<48ull |
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+2]<<40ull |
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+3]<<32ull |
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+4]<<24ull |
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+5]<<16ull |
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+6]<< 8ull |
(unsigned long long)((unsigned char*)st->inbuffer)[payoffs+7]<< 0ull;
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+0]<<56ull |
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+1]<<48ull |
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+2]<<40ull |
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+3]<<32ull |
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+4]<<24ull |
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+5]<<16ull |
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+6]<< 8ull |
(quint64_t)((unsigned char*)st->inbuffer)[payoffs+7]<< 0ull;
if (ullpaylen < 0x10000)
{
Con_Printf ("%s: payload size (%"PRIu64") encoded badly\n", NET_AdrToString (adr, sizeof(adr), &st->remoteaddr), ullpaylen);
@ -3936,7 +3952,8 @@ qboolean FTENET_IRCConnect_GetPacket(ftenet_generic_connection_t *gcon)
cvar_t *ircsomething = Cvar_Get("ircsomething", "moo", 0, "IRC Connect");
cvar_t *ircclientaddr = Cvar_Get("ircclientaddr", "127.0.0.1", 0, "IRC Connect");
NET_StringToAdr(con->ircserver.address.irc.host, 6667, &ip);
if (!NET_StringToAdr(con->ircserver.address.irc.host, 6667, &ip))
return false;
con->generic.thesocket = TCP_OpenStream(&ip);
//when hosting, the specified nick is the name we're using.
@ -5002,8 +5019,8 @@ qboolean NET_EnsureRoute(ftenet_connections_t *collection, char *routename, char
{
netadr_t adr;
NET_StringToAdr(host, 0, &adr);
if (NET_StringToAdr(host, 0, &adr))
{
switch(adr.type)
{
case NA_WEBSOCKET:
@ -5020,6 +5037,7 @@ qboolean NET_EnsureRoute(ftenet_connections_t *collection, char *routename, char
//not recognised, or not needed
break;
}
}
return true;
}
@ -5557,7 +5575,8 @@ void NET_GetLocalAddress (int socket, netadr_t *out)
buff[512-1] = 0;
if (!NET_StringToAdr (buff, 0, &adr)) //urm
NET_StringToAdr ("127.0.0.1", 0, &adr);
if (!NET_StringToAdr ("127.0.0.1", 0, &adr))
return;
namelen = sizeof(address);
@ -5648,6 +5667,7 @@ void NET_ClientPort_f(void)
qboolean NET_WasSpecialPacket(netsrc_t netsrc)
{
#ifdef HAVE_NATPMP
ftenet_connections_t *collection = NULL;
if (netsrc == NS_SERVER)
{
@ -5661,6 +5681,7 @@ qboolean NET_WasSpecialPacket(netsrc_t netsrc)
collection = cls.sockets;
#endif
}
#endif
#ifdef SUPPORT_ICE
if (ICE_WasStun(netsrc))
@ -5851,8 +5872,6 @@ void SVNET_RegisterCvars(void)
void NET_CloseServer(void)
{
allowconnects = false;
FTENET_CloseCollection(svs.sockets);
svs.sockets = NULL;
}
@ -5869,8 +5888,6 @@ void NET_InitServer(void)
#endif
}
allowconnects = true;
#ifdef HAVE_IPV4
Cvar_ForceCallback(&sv_port_ipv4);
#endif

View file

@ -235,8 +235,8 @@ struct icestate_s;
typedef struct
{
struct icestate_s *(QDECL *ICE_Create)(void *module, char *conname, char *peername, enum icemode_e mode, enum iceproto_e proto); //doesn't start pinging anything.
qboolean (QDECL *ICE_Set)(struct icestate_s *con, char *prop, char *value);
qboolean (QDECL *ICE_Get)(struct icestate_s *con, char *prop, char *value, int valuesize);
qboolean (QDECL *ICE_Set)(struct icestate_s *con, const char *prop, const char *value);
qboolean (QDECL *ICE_Get)(struct icestate_s *con, const char *prop, char *value, int valuesize);
struct icecandinfo_s *(QDECL *ICE_GetLCandidateInfo)(struct icestate_s *con); //retrieves candidates that need reporting to the peer.
void (QDECL *ICE_AddRCandidateInfo)(struct icestate_s *con, struct icecandinfo_s *cand); //stuff that came from the peer.
void (QDECL *ICE_Close)(struct icestate_s *con); //bye then.

View file

@ -135,10 +135,10 @@ void Plug_RegisterBuiltin(char *name, Plug_Builtin_t bi, int flags)
static qintptr_t VARGS Plug_GetNativePointer(void *offset, quintptr_t mask, const qintptr_t *args)
{
#ifdef SUPPORT_ICE
char *p = (char *)VM_POINTER(args[0]);
if (offset) //QVMs are not allowed to call this
return 0;
#ifdef SUPPORT_ICE
if (!strcmp(p, ICE_API_CURRENT))
return (qintptr_t)&iceapi;
#endif

View file

@ -96,7 +96,9 @@ char *PF_VarString (pubprogfuncs_t *prinst, int first, struct globalvars_s *pr_g
static int debuggerresume;
static int debuggerresumeline;
extern int isPlugin; //if 2, we were invoked by a debugger, and we need to give it debug locations (and it'll feed us continue/steps/breakpoints)
#ifndef SERVERONLY
static int debuggerstacky;
#endif
#if defined(_WIN32) && !defined(FTE_SDL)
#include <windows.h>
@ -139,6 +141,13 @@ size_t debuggerwnd;
qboolean QCExternalDebuggerCommand(char *text)
{
#if defined(CSQC_DAT) && !defined(SERVERONLY)
extern world_t csqc_world;
#endif
#if defined(MENU_DAT) && !defined(SERVERONLY)
extern world_t menu_world;
#endif
if (!isPlugin)
return false;
if ((!strncmp(text, "qcstep", 6) && (text[6] == 0 || text[6] == ' ')) || (!strncmp(text, "qcresume", 8) && (text[8] == 0 || text[8] == ' ')))
@ -187,16 +196,15 @@ qboolean QCExternalDebuggerCommand(char *text)
else if (!strncmp(text, "qcinspect ", 10))
{
//called on mouse-over events in the gui
extern world_t csqc_world, menu_world;
char *variable;
char *function;
// char *function;
char resultbuffer[8192], tmpbuffer[8192];
char *vmnames[4] = {"cur: ", "ssqc: ", "csqc: ", "menu: "};
char *values[4] = {NULL, NULL, NULL, NULL};
int i;
Cmd_TokenizeString(text, false, false);
variable = Cmd_Argv(1);
function = Cmd_Argv(2);
// function = Cmd_Argv(2);
//togglebreakpoint just finds the first statement (via the function table for file names) with the specified line number, and sets some unused high bit that causes it to be an invalid opcode.
@ -243,7 +251,7 @@ qboolean QCExternalDebuggerCommand(char *text)
}
else if (!strncmp(text, "qcreload", 8))
{
#ifdef MENU_DAT
#if defined(MENU_DAT) && !defined(SERVERONLY)
Cbuf_AddText("menu_restart\n", RESTRICT_LOCAL);
#endif
#ifndef CLIENTONLY
@ -255,7 +263,6 @@ qboolean QCExternalDebuggerCommand(char *text)
}
else if (!strncmp(text, "qcbreakpoint ", 13))
{
extern world_t csqc_world, menu_world;
int mode;
char *filename;
int line;
@ -1744,7 +1751,7 @@ void QCBUILTIN PF_hash_createtab (pubprogfuncs_t *prinst, struct globalvars_s *p
}
if (i == pf_hash_maxtables)
{ //all slots taken, expand list
if (!ZF_ReallocElements(&pf_hashtab, &pf_hash_maxtables, pf_hash_maxtables+64, sizeof(*pf_hashtab)))
if (!ZF_ReallocElements((void**)&pf_hashtab, &pf_hash_maxtables, pf_hash_maxtables+64, sizeof(*pf_hashtab)))
{
G_FLOAT(OFS_RETURN) = 0;
return;
@ -2684,7 +2691,6 @@ void QCBUILTIN PF_copyentity (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
void QCBUILTIN PF_entityprotection (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
world_t *w = prinst->parms->user;
wedict_t *e = G_WEDICT(prinst, OFS_PARM0);
int prot = G_FLOAT(OFS_PARM1);
@ -3547,7 +3553,7 @@ void QCBUILTIN PF_buf_create (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
int i;
const char *type = ((prinst->callargc>0)?PR_GetStringOfs(prinst, OFS_PARM0):"string");
unsigned int flags = ((prinst->callargc>1)?G_FLOAT(OFS_PARM1):0);
// unsigned int flags = ((prinst->callargc>1)?G_FLOAT(OFS_PARM1):1);
if (!Q_strcasecmp(type, "string"))
;

View file

@ -127,13 +127,24 @@ qboolean Sys_ConditionSignal(void *condv); //lock first
qboolean Sys_ConditionBroadcast(void *condv); //lock first
void Sys_DestroyConditional(void *condv);
#else
#define Sys_IsMainThread() (true)
#define Sys_CreateMutex() (NULL)
#define Sys_LockMutex(m) (true)
#define Sys_UnlockMutex(m) (true)
#define Sys_DestroyMutex(m)
#ifdef __GNUC__ //gcc complains about if (true) when these are maros. msvc complains about static not being called in headers. gah.
static inline qboolean Sys_MutexStub(void) {return true;}
static inline void *Sys_CreateMutex(void) {return NULL;}
#define Sys_IsMainThread() Sys_MutexStub()
#define Sys_DestroyMutex(m) Sys_MutexStub()
#define Sys_IsMainThread() Sys_MutexStub()
#define Sys_LockMutex(m) Sys_MutexStub()
#define Sys_UnlockMutex(m) Sys_MutexStub()
static inline qboolean Sys_IsThread(void *thread) {return !thread;}
#else
#define Sys_IsMainThread() (qboolean)(true)
#define Sys_CreateMutex() (void*)(NULL)
#define Sys_LockMutex(m) (qboolean)(true)
#define Sys_UnlockMutex(m) (qboolean)(true)
#define Sys_DestroyMutex(m) (void)0
#define Sys_IsThread(t) (!t)
#endif
#endif
void Sys_Sleep(double seconds);

View file

@ -20228,6 +20228,170 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\common\sys_linux_threads.c"
>
<FileConfiguration
Name="MinGLDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release Dedicated Server|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release Dedicated Server|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug Dedicated Server|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug Dedicated Server|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\client\sys_morphos.c"
>

View file

@ -2194,7 +2194,6 @@ static void R_Sprite_GenerateTrisoup(entity_t *e, int bemode)
vec4_t *rgba;
scenetris_t *t;
extern cvar_t gl_blendsprites;
shader_t *shader = NULL;
mspriteframe_t *frame;
@ -2260,9 +2259,9 @@ static void R_Sprite_GenerateTrisoup(entity_t *e, int bemode)
}
else
{
#ifdef RTLIGHTS
extern cvar_t r_shadow_realtime_world_lightmaps;
//lit sprites need to sample the world lighting. with rtlights that generally means they're 0.
#ifdef RTLIGHTS
if (r_shadow_realtime_world.ival)
lightmap = r_shadow_realtime_world_lightmaps.value;
else
@ -2498,8 +2497,8 @@ void BE_GenModelBatches(batch_t **batches, const dlight_t *dl, unsigned int bemo
model_t *emodel;
unsigned int orig_numstris = cl_numstris;
unsigned int orig_numvisedicts = cl_numvisedicts;
unsigned int orig_numstrisidx = cl_numstrisidx;
unsigned int orig_numstrisvert = cl_numstrisvert;
// unsigned int orig_numstrisidx = cl_numstrisidx;
// unsigned int orig_numstrisvert = cl_numstrisvert;
/*clear the batch list*/
for (i = 0; i < SHADER_SORT_COUNT; i++)

View file

@ -2249,7 +2249,7 @@ static void deformgen(const deformv_t *deformv, int cnt, vecV_t *src, vecV_t *ds
for (j = 0; j < 4; j++)
{
VectorSubtract(quad[j], rot_centre, tv);
Matrix3_Multiply_Vec3(result, tv, quad[j]);
Matrix3_Multiply_Vec3((const vec3_t*)result, tv, quad[j]);
VectorAdd(rot_centre, quad[j], quad[j]);
}
}
@ -2397,7 +2397,7 @@ static void alphagen(const shaderpass_t *pass, int cnt, avec4_t *const src, avec
{
VectorSubtract(r_origin, shaderstate.curentity->origin, v1);
if (!Matrix3_Compare(shaderstate.curentity->axis, axisDefault))
if (!Matrix3_Compare((const vec3_t*)shaderstate.curentity->axis, (const vec3_t*)axisDefault))
{
Matrix3_Multiply_Vec3(shaderstate.curentity->axis, v1, v2);
}
@ -2844,7 +2844,10 @@ static void BE_SubmitMeshChain(qboolean usetesselation)
#ifndef GLSLONLY
static void DrawPass(const shaderpass_t *pass)
{
int i, j, k;
int i;
#if MAXRLIGHTMAPS > 1
int j, k;
#endif
int tmu;
int lastpass = pass->numMergedPasses;
unsigned int attr = (1u<<VATTR_LEG_VERTEX) | (1u<<VATTR_LEG_COLOUR);
@ -3717,7 +3720,9 @@ static qboolean GLBE_RegisterLightShader(int mode)
qboolean GLBE_SelectDLight(dlight_t *dl, vec3_t colour, vec3_t axis[3], unsigned int lmode)
{
#ifdef RTLIGHTS
extern cvar_t gl_specular;
#endif
shaderstate.lastuniform = 0;
shaderstate.curdlight = dl;
@ -5430,7 +5435,9 @@ void GLBE_DrawLightPrePass(qbyte *vis)
void GLBE_DrawWorld (batch_t **worldbatches, qbyte *vis)
{
#ifdef RTLIGHTS
extern cvar_t r_shadow_realtime_world, r_shadow_realtime_world_lightmaps;
#endif
batch_t *batches[SHADER_SORT_COUNT];
batch_t **ob = shaderstate.mbatches;
RSpeedLocals();

View file

@ -238,7 +238,7 @@ static void GL_Texturemode_Apply(GLenum targ, unsigned int flags)
{
if ((filter[1] && !(flags & IF_NEAREST)) || (flags & IF_LINEAR))
{
if (filter[0] && !(flags & IF_NEAREST) || (flags & IF_LINEAR))
if ((filter[0] && !(flags & IF_NEAREST)) || (flags & IF_LINEAR))
min = GL_LINEAR_MIPMAP_LINEAR;
else
min = GL_NEAREST_MIPMAP_LINEAR;

View file

@ -1784,7 +1784,7 @@ float Font_LineScaleWidth(conchar_t *start, conchar_t *end)
int x = 0;
struct font_s *font = curfont;
unsigned int codeflags, codepoint;
for (; start < end; start)
while(start < end)
{
start = Font_Decode(start, &codeflags, &codepoint);
x = Font_CharEndCoord(font, x, codeflags, codepoint);

View file

@ -381,16 +381,18 @@ typedef struct heightmap_s
#ifndef SERVERONLY
static void ted_dorelight(heightmap_t *hm);
#endif
static void Terr_WorkerLoadedSectionLightmap(void *ctx, void *data, size_t a, size_t b);
static qboolean Terr_Collect(heightmap_t *hm);
#endif
static hmsection_t *Terr_GetSection(heightmap_t *hm, int x, int y, unsigned int flags);
static void Terr_LoadSectionWorker(void *ctx, void *data, size_t a, size_t b);
static void Terr_WorkerLoadedSectionLightmap(void *ctx, void *data, size_t a, size_t b);
static void Terr_WorkerLoadedSection(void *ctx, void *data, size_t a, size_t b);
static void Terr_WorkerFailedSection(void *ctx, void *data, size_t a, size_t b);
static void Terr_Brush_DeleteIdx(heightmap_t *hm, size_t idx);
#ifndef SERVERONLY
static void Terr_Brush_Draw(heightmap_t *hm, batch_t **batches, entity_t *e);
#endif
#ifndef SERVERONLY
static texid_t Terr_LoadTexture(char *name)
@ -692,7 +694,7 @@ static hmsection_t *Terr_GenerateSection(heightmap_t *hm, int sx, int sy, qboole
#ifdef LOADERTHREAD
Sys_UnlockMutex(com_resourcemutex);
#endif
COM_AddWork(1, Terr_LoadSectionWorker, s, hm, sx, sy);
COM_AddWork(WG_LOADER, Terr_LoadSectionWorker, s, hm, sx, sy);
return s;
}
if (scheduleload)
@ -722,6 +724,7 @@ static void *Terr_GenerateWater(hmsection_t *s, float maxheight)
return w;
}
#ifndef SERVERONLY
//embeds a mesh
static void Terr_AddMesh(heightmap_t *hm, int loadflags, model_t *mod, vec3_t epos, vec3_t axis[3], float scale)
{
@ -840,6 +843,7 @@ static void Terr_AddMesh(heightmap_t *hm, int loadflags, model_t *mod, vec3_t ep
}
Sys_UnlockMutex(hm->entitylock);
}
#endif
static void *Terr_ReadV1(heightmap_t *hm, hmsection_t *s, void *ptr, int len)
{
@ -884,7 +888,7 @@ static void *Terr_ReadV1(heightmap_t *hm, hmsection_t *s, void *ptr, int len)
/*load in the mixture/lighting*/
lmstart = BZ_Malloc(SECTTEXSIZE*SECTTEXSIZE*4);
memcpy(lmstart, ds->texmap, SECTTEXSIZE*SECTTEXSIZE*4);
COM_AddWork(0, Terr_WorkerLoadedSectionLightmap, hm, lmstart, s->sx, s->sy);
COM_AddWork(WG_MAIN, Terr_WorkerLoadedSectionLightmap, hm, lmstart, s->sx, s->sy);
s->mesh.colors4f_array[0] = s->colours;
if (flags & TSF_HASCOLOURS)
@ -1199,6 +1203,7 @@ static void Terr_SaveV2(heightmap_t *hm, hmsection_t *s, vfsfile_t *f, int sx, i
VFS_WRITE(f, strm.buffer, strm.pos);
strm.pos = 0;
}
#ifndef SERVERONLY
static void Terr_WorkerLoadedSectionLightmap(void *ctx, void *data, size_t a, size_t b)
{
heightmap_t *hm = ctx;
@ -1223,6 +1228,7 @@ static void Terr_WorkerLoadedSectionLightmap(void *ctx, void *data, size_t a, si
BZ_Free(data);
}
#endif
#endif
static void *Terr_ReadV2(heightmap_t *hm, hmsection_t *s, void *ptr, int len)
{
#ifndef SERVERONLY
@ -1363,7 +1369,7 @@ static void *Terr_ReadV2(heightmap_t *hm, hmsection_t *s, void *ptr, int len)
}
if (lmstart)
COM_AddWork(0, Terr_WorkerLoadedSectionLightmap, hm, lmstart, s->sx, s->sy);
COM_AddWork(WG_MAIN, Terr_WorkerLoadedSectionLightmap, hm, lmstart, s->sx, s->sy);
/*load any static ents*/
j = Terr_Read_SInt(&strm);
@ -1597,9 +1603,9 @@ static hmsection_t *Terr_ReadSection(heightmap_t *hm, hmsection_t *s, int ver, v
s->loadstate = TSLS_LOADING2;
if (failed)
COM_AddWork(0, Terr_WorkerFailedSection, s, NULL, s->sx, s->sy);
COM_AddWork(WG_MAIN, Terr_WorkerFailedSection, s, NULL, s->sx, s->sy);
else
COM_AddWork(0, Terr_WorkerLoadedSection, s, NULL, s->sx, s->sy);
COM_AddWork(WG_MAIN, Terr_WorkerLoadedSection, s, NULL, s->sx, s->sy);
return s;
}
@ -1638,9 +1644,9 @@ qboolean Terr_DownloadedSection(char *fname)
}
#endif
#ifndef SERVERONLY
static void Terr_LoadSection(heightmap_t *hm, hmsection_t *s, int sx, int sy, unsigned int flags)
{
#ifndef SERVERONLY
//when using networked terrain, the client will never load a section from disk, but will only load it from the server
//one section at a time.
if (mod_terrain_networked.ival && !sv.state)
@ -1653,20 +1659,19 @@ static void Terr_LoadSection(heightmap_t *hm, hmsection_t *s, int sx, int sy, un
CL_CheckOrEnqueDownloadFile(Terr_DiskSectionName(hm, sx, sy, fname, sizeof(fname)), Terr_TempDiskSectionName(hm, sx, sy), DLLF_OVERWRITE|DLLF_TEMPORARY);
return;
}
#endif
if (!s)
{
Terr_GenerateSection(hm, sx, sy, true);
}
}
#endif
static void Terr_LoadSectionWorker(void *ctx, void *data, size_t a, size_t b)
{
heightmap_t *hm = data;
hmsection_t *s = ctx;
int sx = a;
int sy = b;
int flags = 0;
void *diskimage;
qofs_t len;
char fname[MAX_QPATH];
@ -2199,6 +2204,7 @@ static void Terr_DoEditNotify(heightmap_t *hm)
}
}
#ifndef SERVERONLY
//garbage collect the oldest section, to make space for another
static qboolean Terr_Collect(heightmap_t *hm)
{
@ -2239,6 +2245,7 @@ static qboolean Terr_Collect(heightmap_t *hm)
return false;
}
#endif
#endif
/*purge all sections, but not root
lightmaps only are purged whenever the client rudely kills lightmaps (purges all lightmaps on map changes, to cope with models/maps potentially being unloaded)
@ -4345,8 +4352,6 @@ void Heightmap_FindTouchedLeafs (model_t *mod, pvscache_t *ent, float *mins, flo
void Heightmap_LightPointValues (model_t *mod, vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir)
{
float time = realtime;
res_diffuse[0] = 128;
res_diffuse[1] = 128;
res_diffuse[2] = 128;
@ -5249,8 +5254,8 @@ void Terr_ParseEntityLump(char *data, heightmap_t *heightmap)
void Terr_FinishTerrain(model_t *mod)
{
heightmap_t *hm = mod->terrain;
#ifndef SERVERONLY
heightmap_t *hm = mod->terrain;
if (qrenderer != QR_NONE)
{
if (*hm->skyname)
@ -6453,7 +6458,7 @@ void QCBUILTIN PF_brush_selected(pubprogfuncs_t *prinst, struct globalvars_s *pr
model_t *mod = vmw->Get_CModel(vmw, G_FLOAT(OFS_PARM0));
heightmap_t *hm = mod?mod->terrain:NULL;
unsigned int brushid = G_INT(OFS_PARM1);
unsigned int faceid = G_INT(OFS_PARM2);
// unsigned int faceid = G_INT(OFS_PARM2);
unsigned int state = G_FLOAT(OFS_PARM3);
unsigned int i;
brushes_t *br;

View file

@ -971,7 +971,9 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
unsigned *buf = NULL;
char mdlbase[MAX_QPATH];
char *replstr;
#ifdef DSPMODELS
qboolean doomsprite = false;
#endif
unsigned int magic, i;
size_t filesize;
char ext[8];
@ -986,7 +988,7 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
mod->maxs[1] = 16;
mod->maxs[2] = 16;
mod->engineflags = 0;
COM_AddWork(0, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
COM_AddWork(WG_MAIN, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
return;
}
@ -1042,11 +1044,13 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
COM_FileExtension(mod->name, ext, sizeof(ext));
if (!Q_strcasecmp(ext, "spr") || !Q_strcasecmp(ext, "sp2"))
replstr = ""; // sprite
#ifdef DSPMODELS
else if (!Q_strcasecmp(ext, "dsp")) // doom sprite
{
replstr = "";
doomsprite = true;
}
#endif
else // assume models
replstr = r_replacemodels.string;
@ -1080,7 +1084,7 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
TRACE(("Mod_LoadModel: doomsprite: \"%s\"\n", mod->name));
Mod_LoadDoomSprite(mod);
BZ_Free(buf);
COM_AddWork(0, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
COM_AddWork(WG_MAIN, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
return;
}
#endif
@ -1149,7 +1153,7 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
BZ_Free(buf);
COM_AddWork(0, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
COM_AddWork(WG_MAIN, Mod_ModelLoaded, mod, NULL, MLS_LOADED, 0);
return;
}
@ -1161,7 +1165,7 @@ void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
mod->maxs[1] = 16;
mod->maxs[2] = 16;
mod->engineflags = 0;
COM_AddWork(0, Mod_ModelLoaded, mod, NULL, MLS_FAILED, verbose);
COM_AddWork(WG_MAIN, Mod_ModelLoaded, mod, NULL, MLS_FAILED, verbose);
}
@ -1174,9 +1178,9 @@ model_t *Mod_LoadModel (model_t *mod, enum mlverbosity_e verbose)
// Mod_LoadModelWorker(mod, MLV_WARN, 0);
// else
if (verbose == MLV_ERROR || verbose == MLV_WARNSYNC)
COM_AddWork(0, Mod_LoadModelWorker, mod, NULL, verbose, 0);
COM_AddWork(WG_MAIN, Mod_LoadModelWorker, mod, NULL, verbose, 0);
else
COM_AddWork(1, Mod_LoadModelWorker, mod, NULL, verbose, 0);
COM_AddWork(WG_LOADER, Mod_LoadModelWorker, mod, NULL, verbose, 0);
}
if (verbose == MLV_ERROR)
@ -1216,7 +1220,7 @@ model_t *Mod_ForName (const char *name, enum mlverbosity_e verbosity)
===============================================================================
*/
#ifndef SERVERONLY
static const struct
{
const char *oldname;
@ -1264,6 +1268,7 @@ static const char *Mod_RemapBuggyTexture(const char *name, const qbyte *data, un
}
return NULL;
}
#endif
void Mod_FinishTexture(texture_t *tx, const char *loadname, qboolean safetoloadfromwads)
@ -4830,12 +4835,12 @@ TRACE(("LoadBrushModel %i\n", __LINE__));
TRACE(("LoadBrushModel %i\n", __LINE__));
if (!isDedicated || ode)
{
COM_AddWork(0, ModBrush_LoadGLStuff, submod, NULL, i, 0);
COM_AddWork(WG_MAIN, ModBrush_LoadGLStuff, submod, NULL, i, 0);
}
TRACE(("LoadBrushModel %i\n", __LINE__));
if (i)
COM_AddWork(0, Mod_ModelLoaded, submod, NULL, MLS_LOADED, 0);
COM_AddWork(WG_MAIN, Mod_ModelLoaded, submod, NULL, MLS_LOADED, 0);
if (i < submod->numsubmodels-1)
{ // duplicate the basic information
char name[MAX_QPATH];

View file

@ -39,6 +39,7 @@ typedef enum {
SHADER_SORT_PORTAL,
SHADER_SORT_SKY,
SHADER_SORT_OPAQUE,
//fixme: occlusion tests
SHADER_SORT_DECAL,
SHADER_SORT_SEETHROUGH,
SHADER_SORT_BANNER,

View file

@ -1670,7 +1670,9 @@ void GLQ1BSP_LightPointValues(model_t *model, vec3_t point, vec3_t res_diffuse,
{
vec3_t end;
float *r;
#ifdef RTLIGHTS
extern cvar_t r_shadow_realtime_world, r_shadow_realtime_world_lightmaps;
#endif
if (!model->lightdata || r_fullbright.ival)
{

View file

@ -60,6 +60,7 @@ cvar_t gl_affinemodels = SCVAR("gl_affinemodels","0");
cvar_t gl_finish = SCVAR("gl_finish","0");
cvar_t gl_dither = SCVAR("gl_dither", "1");
extern cvar_t r_stereo_separation;
extern cvar_t r_stereo_convergence;
extern cvar_t r_stereo_method;
extern cvar_t r_postprocshader, r_fxaa;
@ -405,7 +406,9 @@ void R_SetupGL (float stereooffset)
newa[0] = r_refdef.viewangles[0];
newa[1] = r_refdef.viewangles[1];
newa[2] = r_refdef.viewangles[2] + gl_screenangle.value;
if (1)
if (stereooffset)
newa[1] += r_stereo_convergence.value * ((stereooffset>0)?-0.5:0.5); //can we get away with this cheapness? rip 6dof
if (0)
{
vec3_t paxis[3];
AngleVectors (newa, paxis[0], paxis[1], paxis[2]);

View file

@ -296,8 +296,8 @@ char *GLVID_GetRGBInfo(int *truewidth, int *trueheight, enum uploadfmt *fmt)
}
ret = BZ_Realloc(ret, (*truewidth)*(*trueheight)*3);
}
#ifdef _DEBUG
else if (!gl_config.gles && gl_config.glversion >= 1.2)
#if 1//def _DEBUG
else if (!gl_config.gles && sh_config.texfmt[PTI_BGRA8])
{
*fmt = TF_BGRA32;
ret = BZ_Malloc((*truewidth)*(*trueheight)*4);

View file

@ -832,7 +832,7 @@ static void Shader_ClutterParms(shader_t *shader, shaderpass_t *pass, char **ptr
static void Shader_SkyParms(shader_t *shader, shaderpass_t *pass, char **ptr)
{
skydome_t *skydome;
float skyheight;
// float skyheight;
char *boxname;
if (shader->skydome)
@ -846,7 +846,7 @@ static void Shader_SkyParms(shader_t *shader, shaderpass_t *pass, char **ptr)
boxname = Shader_ParseString(ptr);
Shader_ParseSkySides(shader->name, boxname, skydome->farbox_textures);
skyheight = Shader_ParseFloat(shader, ptr, 512);
/*skyheight =*/ Shader_ParseFloat(shader, ptr, 512);
boxname = Shader_ParseString(ptr);
Shader_ParseSkySides(shader->name, boxname, skydome->nearbox_textures);
@ -1867,10 +1867,10 @@ static void Shader_HLSL11ProgramName (shader_t *shader, shaderpass_t *pass, char
static void Shader_ProgramParam ( shader_t *shader, shaderpass_t *pass, char **ptr )
{
#if 1
Con_DPrintf("shader %s: 'param' no longer supported\n", shader->name);
#elif defined(GLQUAKE)
cvar_t *cv = NULL;
int specialint = 0;
float specialfloat = 0;
vec3_t specialvec = {0};
enum shaderprogparmtype_e parmtype = SP_BAD;
char *token;
qboolean silent = false;
@ -1952,9 +1952,12 @@ static void Shader_ProgramParam ( shader_t *shader, shaderpass_t *pass, char **p
else
token = Shader_ParseSensString(ptr);
#if 0//def GLQUAKE
if (qrenderer == QR_OPENGL)
{
int specialint = 0;
float specialfloat = 0;
vec3_t specialvec = {0};
int p;
qboolean foundone;
unsigned int uniformloc;
@ -2493,11 +2496,10 @@ static void Shaderpass_ClampMap (shader_t *shader, shaderpass_t *pass, char **pt
static void Shaderpass_VideoMap (shader_t *shader, shaderpass_t *pass, char **ptr)
{
char *token;
token = Shader_ParseSensString (ptr);
char *token = Shader_ParseSensString (ptr);
#ifdef NOMEDIA
(void)token;
#else
if (pass->cin)
Z_Free (pass->cin);

View file

@ -2026,7 +2026,7 @@ void INS_ReInit(void)
void INS_Shutdown(void)
{
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid))
{
}

View file

@ -205,7 +205,7 @@ void INS_Shutdown (void)
void INS_Commands (void)
{
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid))
{
}
void INS_Move (float *movements, int pnum)

View file

@ -2359,7 +2359,7 @@ LONG WINAPI GLMainWndProc (
{
COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lParam;
#ifdef WTHREAD
COM_AddWork(0, MainThreadWndProc, NULL, memcpy(Z_Malloc(cds->cbData), cds->lpData, cds->cbData), uMsg, cds->cbData);
COM_AddWork(WG_MAIN, MainThreadWndProc, NULL, memcpy(Z_Malloc(cds->cbData), cds->lpData, cds->cbData), uMsg, cds->cbData);
#else
Host_RunFile(cds->lpData, cds->cbData, NULL);
#endif
@ -2368,7 +2368,7 @@ LONG WINAPI GLMainWndProc (
break;
case WM_KILLFOCUS:
#ifdef WTHREAD
COM_AddWork(0, MainThreadWndProc, NULL, NULL, uMsg, 0);
COM_AddWork(WG_MAIN, MainThreadWndProc, NULL, NULL, uMsg, 0);
#else
GLAppActivate(FALSE, Minimized);//FIXME: thread
if (modestate == MS_FULLDIB)
@ -2378,7 +2378,7 @@ LONG WINAPI GLMainWndProc (
break;
case WM_SETFOCUS:
#ifdef WTHREAD
COM_AddWork(0, MainThreadWndProc, NULL, NULL, uMsg, 0);
COM_AddWork(WG_MAIN, MainThreadWndProc, NULL, NULL, uMsg, 0);
#else
if (!GLAppActivate(TRUE, Minimized))//FIXME: thread
break;
@ -2396,7 +2396,7 @@ LONG WINAPI GLMainWndProc (
case WM_MOVE:
VID_UpdateWindowStatus (hWnd);
#ifdef WTHREAD
COM_AddWork(0, MainThreadWndProc, NULL, NULL, uMsg, 0);
COM_AddWork(WG_MAIN, MainThreadWndProc, NULL, NULL, uMsg, 0);
#else
Cvar_ForceCallback(&vid_conautoscale);
#endif
@ -2535,7 +2535,7 @@ LONG WINAPI GLMainWndProc (
{
VID_UpdateWindowStatus (hWnd);
#ifdef WTHREAD
COM_AddWork(0, MainThreadWndProc, NULL, NULL, uMsg, 0);
COM_AddWork(WG_MAIN, MainThreadWndProc, NULL, NULL, uMsg, 0);
#else
Cvar_ForceCallback(&vid_conautoscale);
#endif

View file

@ -2221,7 +2221,7 @@ qboolean QDECL Mod_LoadDoomLevel(model_t *mod, void *buffer, size_t fsize)
QuakifyThings(mod, thingsl);
COM_AddWork(0, Doom_LoadShaders, mod, NULL, 0, 0);
COM_AddWork(WG_MAIN, Doom_LoadShaders, mod, NULL, 0, 0);
return true;
}

View file

@ -515,7 +515,6 @@ struct shader_s
texnums_t *defaulttextures; //must always have at least one entry. multiple will only appear if the diffuse texture was animmapped.
struct shader_s *next;
int id;
//end of shared fields.
shader_t *bemoverrides[bemoverride_max];
shader_t *remapto; //render using this shader instead. for q3 nonsense.
@ -551,7 +550,7 @@ struct shader_s
SHADER_NODLIGHT = 1 << 15, //from surfaceflags
SHADER_HASLIGHTMAP = 1 << 16,
SHADER_HASTOPBOTTOM = 1 << 17,
SHADER_STATICDATA = 1 << 18, //set if true: no deforms, no tcgen, rgbgen=identitylighting, alphagen=identity, tmu0=st + tmu1=lm(if available) for every pass, no norms
// SHADER_STATICDATA = 1 << 18, //set if true: no deforms, no tcgen, rgbgen=identitylighting, alphagen=identity, tmu0=st + tmu1=lm(if available) for every pass, no norms
SHADER_HASREFLECT = 1 << 19, //says that we need to generate a reflection image first
SHADER_HASREFRACT = 1 << 20, //says that we need to generate a refraction image first
SHADER_HASREFRACTDEPTH = 1 << 21, //refraction generation needs to generate a depth texture too.
@ -586,7 +585,6 @@ struct shader_s
char modelname[1];
} *clutter;
// meshfeatures_t features;
bucket_t bucket;
};

View file

@ -295,7 +295,7 @@ void Cookie_Feed(char *domain, int secure, char *name, char *value)
{
cookie_t **link, *c;
Sys_LockMutex(com_resourcemutex);
for(link = &cookies; c = *link; link = &(*link)->next)
for(link = &cookies; (c=*link)!=NULL; link = &(*link)->next)
{
if (!strcmp(c->domain, domain) && c->secure == secure && !strcmp(c->name, name))
break;
@ -368,7 +368,7 @@ void Cookie_Regurgitate(char *domain, int secure, char *buffer, size_t buffersiz
{
qboolean hascookies = false;
cookie_t *c;
char *l = buffer;
// char *l = buffer;
buffersize -= 3; //\r\n\0
*buffer = 0;
Sys_LockMutex(com_resourcemutex);
@ -1328,7 +1328,7 @@ static int DL_Thread_Work(void *arg)
}
#if defined(LOADERTHREAD) && !defined(NPFTE)
COM_AddWork(0, HTTP_Wake_Think, NULL, NULL, 0, 0);
COM_AddWork(WG_MAIN, HTTP_Wake_Think, NULL, NULL, 0, 0);
#endif
return 0;
}

View file

@ -15,7 +15,7 @@ static char lastrecordedmvd[MAX_QPATH];
static IWeb_FileGen_t *IWeb_GenerationBuffer;
static size_t IWeb_GenerationBufferTotal;
/*
static void IWeb_MoreGeneratedResize(size_t newsize)
{
IWeb_FileGen_t *ob;
@ -37,6 +37,7 @@ static void IWeb_MoreGeneratedResize(size_t newsize)
IWeb_GenerationBufferTotal = newsize;
}
*/
static void IWeb_Generate(const char *buf)
{
size_t count = strlen(buf);
@ -72,6 +73,7 @@ static void IWeb_Generate(const char *buf)
int Rank_Enumerate (unsigned int first, unsigned int last, void (*callback) (const rankinfo_t *ri)); //leader first.
/*
static void IWeb_ParseForm(char *info, int infolen, char *text)
{
char *eq, *and;
@ -196,7 +198,7 @@ static void IWeb_GenerateAdminFile(char *parms, char *content, int contentlength
IWeb_Generate("<H1>Remote administration is not enabled.<H2>");
IWeb_Generate("</BODY></HTML>");
}
*/
static void IWeb_GenerateRankingsFileCallback(const rankinfo_t *ri)
{

View file

@ -733,13 +733,6 @@ eval_t *PDECL PR_FindGlobal(pubprogfuncs_t *ppf, const char *globname, progsnum_
return NULL;
}
//fixme: remove?
static void PDECL SetGlobalEdict(pubprogfuncs_t *ppf, struct edict_s *ed, int ofs)
{
progfuncs_t *progfuncs = (progfuncs_t*)ppf;
((int*)pr_globals)[ofs] = EDICT_TO_PROG(progfuncs, ed);
}
char *PDECL PR_VarString (pubprogfuncs_t *ppf, int first)
{
progfuncs_t *progfuncs = (progfuncs_t*)ppf;
@ -1027,6 +1020,7 @@ string_t PDECL PR_AllocTempString (pubprogfuncs_t *ppf, const char *str)
return 0;
len = strlen(str)+1;
res = PR_AllocTempStringLen(ppf, &out, len);
if (res)
memcpy(out, str, len);
return res;
#else

View file

@ -21,7 +21,7 @@ Sets everything to NULL
*/
void PDECL QC_ClearEdict (pubprogfuncs_t *ppf, struct edict_s *ed)
{
progfuncs_t *progfuncs = (progfuncs_t*)ppf;
// progfuncs_t *progfuncs = (progfuncs_t*)ppf;
edictrun_t *e = (edictrun_t *)ed;
int num = e->entnum;
memset (e->fields, 0, e->fieldsize);
@ -1882,7 +1882,6 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, const char *file, float killonspawnfl
char filename[128];
int num;
int numbuiltins;
edictrun_t *ed=NULL;
ddef16_t *d16;
ddef32_t *d32;
@ -2005,7 +2004,6 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, const char *file, float killonspawnfl
filename[0] = '\0';
header_crc = 0;
numbuiltins = 0;
while(1)
{

View file

@ -603,7 +603,7 @@ pbool LocateDebugTerm(progfuncs_t *progfuncs, char *key, eval_t **result, etype_
char *c, *c2;
etype_t type = ev_void;
struct edictrun_s *ed;
etype_t ptrtype = ev_void;
// etype_t ptrtype = ev_void;
c = strchr(key, '.');
if (c) *c = '\0';
@ -807,7 +807,7 @@ char *PDECL PR_EvaluateDebugString(pubprogfuncs_t *ppf, char *key)
{
if (!LocateDebugTerm(progfuncs, key+1, &val, &type, &fakeval) && val != &fakeval)
return "(unable to evaluate)";
QC_snprintfz(buf, sizeof(buf), "(%s*)%#x", ((type>=10)?"???":basictypenames[type]), (char*)val - progfuncs->funcs.stringtable);
QC_snprintfz(buf, sizeof(buf), "(%s*)%#x", ((type>=10)?"???":basictypenames[type]), (unsigned int)((char*)val - progfuncs->funcs.stringtable));
return buf;
}
@ -1955,6 +1955,10 @@ pbool PDECL PR_GetBuiltinCallInfo (pubprogfuncs_t *ppf, int *builtinnum, char *f
op = pr_statements32[st].op;
a = pr_statements32[st].a;
break;
default:
op = OP_DONE;
a = 0;
break;
}
*builtinnum = 0;

View file

@ -1057,6 +1057,7 @@ static void inline QCC_PR_Expect (char *string)
void editbadfile(char *fname, int line);
char *TypeName(QCC_type_t *type, char *buffer, int buffersize);
void QCC_PR_AddIncludePath(const char *newinc);
void QCC_PR_IncludeChunk (char *data, pbool duplicate, char *filename);
void QCC_PR_IncludeChunkEx(char *data, pbool duplicate, char *filename, CompilerConstant_t *cnst);
void QCC_PR_CloseProcessor(void);

View file

@ -8605,7 +8605,7 @@ QCC_ref_t *QCC_PR_RefExpression (QCC_ref_t *retbuf, int priority, int exprflags)
}
if (priority > 1 && exprflags & EXPR_WARN_ABOVE_1)
QCC_PR_ParseWarning(WARN_UNARYNOTSCOPE, "unary-not applies to non-unary expression");
QCC_PR_ParseWarning(WARN_UNARYNOTSCOPE, "suggest parenthesis for unary operator that applies to multiple terms");
break;
}
@ -12661,7 +12661,7 @@ void QCC_PR_ParseDefs (char *classname)
QCC_def_t *def, *d;
QCC_sref_t dynlength;
QCC_function_t *f;
int i = 0; // warning: i may be used uninitialized in this function
// int i = 0; // warning: i may be used uninitialized in this function
pbool shared=false;
pbool isstatic=defaultstatic;
pbool externfnc=false;

View file

@ -112,7 +112,7 @@ void QCC_PR_CloseProcessor(void)
*qccincludedir[i] = 0;
currentchunk = NULL;
}
void QCC_PR_AddIncludePath(char *newinc)
void QCC_PR_AddIncludePath(const char *newinc)
{
int i;
@ -1445,13 +1445,25 @@ void QCC_PR_LexString (void)
if (!c)
QCC_PR_ParseError (ERR_EOF, "EOF inside quote");
if (!qccwarningaction[WARN_NOTUTF8] && c < 0 && utf8_check(&pr_token[c-1], &code))
/*
if (!qccwarningaction[WARN_NOTUTF8] && (c&0x80))
{
//convert 0xe000 private-use area to quake's charset (if they don't have the utf-8 warning enabled)
//note: this may have a small false-positive risk.
if (utf8_check(pr_file_p-1, &code))
{
if (code >= 0xe000 && code <= 0xe0ff)
pr_file_p += utf8_check(&pr_token[c-1], &code)-1;
{
pr_file_p += utf8_check(pr_file_p-1, &code)-1;
c = code & 0xff;
}
else
QCC_PR_ParseWarning(WARN_DODGYCHARSET, "non-ascii chars outside of quake-mapped private-use area", sizeof(pr_token)-1);
}
else
QCC_PR_ParseWarning(WARN_DODGYCHARSET, "source file is not unicode", sizeof(pr_token)-1);
}
*/
/* //these two conditions are generally part of the C preprocessor.
if (c == '\\' && *pr_file_p == '\r' && pr_file_p[1] == '\n')
@ -4722,9 +4734,9 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
pbool isnonvirt = false;
pbool isstatic = false;
pbool isignored = false;
pbool ispublic = false;
pbool isprivate = false;
pbool isprotected = false;
// pbool ispublic = false;
// pbool isprivate = false;
// pbool isprotected = false;
while(1)
{
if (QCC_PR_CheckKeyword(1, "nonvirtual"))
@ -4738,11 +4750,11 @@ QCC_type_t *QCC_PR_ParseType (int newtype, pbool silentfail)
else if (QCC_PR_CheckKeyword(1, "strip"))
isignored = true;
else if (QCC_PR_CheckKeyword(1, "public"))
ispublic = true;
/*ispublic = true*/;
else if (QCC_PR_CheckKeyword(1, "private"))
isprivate = true;
/*isprivate = true*/;
else if (QCC_PR_CheckKeyword(1, "protected"))
isprotected = true;
/*isprotected = true*/;
else
break;
}

View file

@ -9297,7 +9297,7 @@ static void QCBUILTIN PF_SendPacket(pubprogfuncs_t *prinst, struct globalvars_s
const char *address = PR_GetStringOfs(prinst, OFS_PARM0);
const char *contents = PF_VarString(prinst, 1, pr_globals);
NET_StringToAdr(address, 0, &to);
if (NET_StringToAdr(address, 0, &to))
NET_SendPacket(NS_SERVER, strlen(contents), contents, &to);
}
@ -9356,6 +9356,11 @@ static void QCBUILTIN PF_resourcestatus(pubprogfuncs_t *prinst, struct globalvar
}
}
break;
case RESTYPE_PARTICLE:
case RESTYPE_SHADER:
case RESTYPE_SKIN:
case RESTYPE_TEXTURE:
//FIXME
default:
G_FLOAT(OFS_RETURN) = -1;
break;

View file

@ -1097,7 +1097,6 @@ void SV_Savegame (const char *savename, qboolean mapchange)
extern cvar_t temp1;
extern cvar_t noexit;
extern cvar_t pr_maxedicts;
extern cvar_t scr_sshot_type;
client_t *cl;
@ -1230,7 +1229,7 @@ void SV_Savegame (const char *savename, qboolean mapchange)
{
int width;
int height;
qbyte *rgbbuffer;
void *rgbbuffer;
image_t *img;
//poke the various modes into redrawing the screen (without huds), to avoid any menus or console drawn over the top of the current backbuffer.
@ -1257,6 +1256,7 @@ void SV_Savegame (const char *savename, qboolean mapchange)
rgbbuffer = VID_GetRGBInfo(&width, &height, &fmt);
if (rgbbuffer)
{
// extern cvar_t scr_sshot_type;
SCR_ScreenShot(savefilename, FS_GAMEONLY, &rgbbuffer, 1, width, height, fmt);
BZ_Free(rgbbuffer);

View file

@ -1104,7 +1104,7 @@ qboolean MSV_ClusterLogin(char *guid, char *userinfo, size_t userinfosize);
void MSV_PollSlaves(void);
void MSV_Status(void);
#else
#define SSV_UpdateAddresses() false
#define SSV_UpdateAddresses() ((void)0)
#define MSV_ClusterLogin(guid,info,infosize) false
#define SSV_IsSubServer() false
#endif

View file

@ -48,17 +48,17 @@ static const struct banflags_s
const char *names[2];
} banflags[] =
{
{BAN_BAN, "ban"},
{BAN_PERMIT, "safe", "permit"},
{BAN_CUFF, "cuff"},
{BAN_MUTE, "mute"},
{BAN_CRIPPLED, "cripple"},
{BAN_DEAF, "deaf"},
{BAN_LAGGED, "lag", "lagged"},
{BAN_VIP, "vip"},
{BAN_BLIND, "blind"},
{BAN_SPECONLY, "spec"},
{BAN_STEALTH, "stealth"}
{BAN_BAN, {"ban"}},
{BAN_PERMIT, {"safe", "permit"}},
{BAN_CUFF, {"cuff"}},
{BAN_MUTE, {"mute"}},
{BAN_CRIPPLED, {"cripple"}},
{BAN_DEAF, {"deaf"}},
{BAN_LAGGED, {"lag", "lagged"}},
{BAN_VIP, {"vip"}},
{BAN_BLIND, {"blind"}},
{BAN_SPECONLY, {"spec"}},
{BAN_STEALTH, {"stealth"}}
};
//generic helper function for naming players.
@ -434,7 +434,6 @@ void SV_Map_f (void)
qboolean waschangelevel = false;
int i;
char *startspot;
float oldtime;
nextserver = 0;
@ -651,7 +650,6 @@ void SV_Map_f (void)
MP_Toggle(0);
#endif
oldtime = sv.time;
if (preserveplayers && svprogfuncs)
{
for (i=0 ; i<svs.allocated_client_slots ; i++) //we need to drop all q2 clients. We don't mix q1w with q2.
@ -1264,7 +1262,7 @@ static void SV_BanList_f (void)
{
*middlebit = 0;
if (nb->expiretime)
Q_strncatz(middlebit, va(",\t+%"PRIu64, (unsigned long long)nb->expiretime - bantime), sizeof(middlebit));
Q_strncatz(middlebit, va(",\t+%"PRIu64, (quint64_t)(nb->expiretime - bantime)), sizeof(middlebit));
if (nb->reason[0])
Q_strncatz(middlebit, ",\t", sizeof(middlebit));
Con_Printf("%s%s%s\n", NET_AdrToStringMasked(adr, sizeof(adr), &nb->adr, &nb->adrmask), middlebit, nb->reason);
@ -1302,7 +1300,7 @@ static void SV_FilterList_f (void)
if (nb->expiretime)
{
time_t secs = nb->expiretime - curtime;
Con_Printf("%s %s +%"PRIu64":%02u\n", NET_AdrToStringMasked(adr, sizeof(adr), &nb->adr, &nb->adrmask), banflagtext, (unsigned long long)(secs/60), (unsigned int)(secs%60));
Con_Printf("%s %s +%"PRIu64":%02u\n", NET_AdrToStringMasked(adr, sizeof(adr), &nb->adr, &nb->adrmask), banflagtext, (quint64_t)(secs/60), (unsigned int)(secs%60));
}
else
Con_Printf("%s %s\n", NET_AdrToStringMasked(adr, sizeof(adr), &nb->adr, &nb->adrmask), banflagtext);
@ -1487,9 +1485,9 @@ static void SV_WriteIP_f (void)
}
}
if (bi->reason[0])
s = va("addip %s %s %"PRIu64" \"%s\"\n", NET_AdrToStringMasked(adr, sizeof(adr), &bi->adr, &bi->adrmask), banflagtext, (unsigned long long) bi->expiretime, bi->reason);
s = va("addip %s %s %"PRIu64" \"%s\"\n", NET_AdrToStringMasked(adr, sizeof(adr), &bi->adr, &bi->adrmask), banflagtext, (quint64_t) bi->expiretime, bi->reason);
else if (bi->expiretime)
s = va("addip %s %s %"PRIu64"\n", NET_AdrToStringMasked(adr, sizeof(adr), &bi->adr, &bi->adrmask), banflagtext, (unsigned long long) bi->expiretime);
s = va("addip %s %s %"PRIu64"\n", NET_AdrToStringMasked(adr, sizeof(adr), &bi->adr, &bi->adrmask), banflagtext, (quint64_t) bi->expiretime);
else
s = va("addip %s %s\n", NET_AdrToStringMasked(adr, sizeof(adr), &bi->adr, &bi->adrmask), banflagtext);
VFS_WRITE(f, s, strlen(s));

View file

@ -1747,16 +1747,23 @@ void SVDP_EmitEntityDelta(entity_state_t *from, entity_state_t *to, sizebuf_t *m
void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t *msg)
{
client_frame_t *fromframe;
packet_entities_t *from;
int oldindex, newindex;
int oldnum, newnum;
int oldmax;
// this is the frame that we are going to delta update from
fromframe = &client->frameunion.frames[client->netchan.incoming_sequence-1 & UPDATE_MASK];
if (!client->netchan.incoming_sequence)
{
oldmax = 0;
from = NULL;
}
else
{
client_frame_t *fromframe = &client->frameunion.frames[(client->netchan.incoming_sequence-1) & UPDATE_MASK];
from = &fromframe->entities;
oldmax = from->num_entities;
}
// Con_Printf ("frame %i\n", client->netchan.incoming_sequence);

View file

@ -760,8 +760,9 @@ void SV_WipeServerState(void)
if (sv.stringsalloced)
{
unsigned int i;
char **ptrs = (char**)&sv.strings;
for (i = 0; i < sizeof(sv.strings) / sizeof(sv.strings.ptrs[0]); i++)
Z_Free((char*)sv.strings.ptrs[i]);
Z_Free(ptrs[i]);
}
memset (&sv, 0, sizeof(sv));
sv.logindatabase = -1;

View file

@ -2389,18 +2389,18 @@ client_t *SVC_DirectConnect(void)
protocol = (protocol==SCP_PROQUAKE)?SCP_PROQUAKE:SCP_NETQUAKE;
else switch(sv_protocol_nq.ival)
{
case RMQ_PROTOCOL_VERSION:
case FITZ_PROTOCOL_VERSION:
case PROTOCOL_VERSION_RMQ:
case PROTOCOL_VERSION_FITZ:
protocol = SCP_FITZ666;
break;
case 15:
//don't trip up on proquake's angle change.
protocol = (protocol==SCP_PROQUAKE)?SCP_PROQUAKE:SCP_NETQUAKE;
break;
case DP6_PROTOCOL_VERSION:
case PROTOCOL_VERSION_DP6:
protocol = SCP_DARKPLACES6;
break;
case DP7_PROTOCOL_VERSION:
case PROTOCOL_VERSION_DP7:
protocol = SCP_DARKPLACES7;
break;
default:
@ -3812,13 +3812,14 @@ void SV_OpenRoute_f(void)
netadr_t to;
char data[64];
NET_StringToAdr(Cmd_Argv(1), PORT_QWCLIENT, &to);
if (NET_StringToAdr(Cmd_Argv(1), PORT_QWCLIENT, &to))
{
sprintf(data, "\xff\xff\xff\xff%c", S2C_CONNECTION);
Netchan_OutOfBandPrint(NS_SERVER, &to, "hello");
// NET_SendPacket (strlen(data)+1, data, to);
}
}
//============================================================================

View file

@ -1835,7 +1835,7 @@ void SV_UpdateQCStats(edict_t *ent, int *statsi, char const** statss, float *sta
}
/*this function calculates the current stat values for the given client*/
void SV_CalcClientStats(client_t *client, int statsi[MAX_CL_STATS], float statsf[MAX_CL_STATS], char const **statss)
void SV_CalcClientStats(client_t *client, int statsi[MAX_CL_STATS], float statsf[MAX_CL_STATS], const char **statss)
{
edict_t *ent;
ent = client->edict;
@ -1938,7 +1938,7 @@ void SV_UpdateClientStats (client_t *client, int pnum, sizebuf_t *msg, client_fr
{
int statsi[MAX_CL_STATS];
float statsf[MAX_CL_STATS];
char *statss[MAX_CL_STATS];
const char *statss[MAX_CL_STATS];
int i, m;
/*figure out what the stat values should be*/
@ -1963,8 +1963,7 @@ void SV_UpdateClientStats (client_t *client, int pnum, sizebuf_t *msg, client_fr
//diff string stats.
for (i=0 ; i<m ; i++)
{
char *blank="";
char *o=client->statss[i], *n=statss[i];
const char *o=client->statss[i], *n=statss[i];
if (o != n)
{
if (!o)
@ -1974,8 +1973,8 @@ void SV_UpdateClientStats (client_t *client, int pnum, sizebuf_t *msg, client_fr
if (strcmp(o, n))
client->pendingstats[(i+MAX_CL_STATS)>>5u] |= 1u<<((i+MAX_CL_STATS)&0x1f);
//FIXME: we could always just run the QCGC on the player's string stats too. wouldn't need string compares that way
if (client->statss)
Z_Free(client->statss[i]);
if (client->statss[i])
Z_Free((void*)client->statss[i]);
client->statss[i] = (statss[i]&&*statss[i])?Z_StrDup(statss[i]):NULL;
}
}
@ -2041,7 +2040,7 @@ void SV_UpdateClientStats (client_t *client, int pnum, sizebuf_t *msg, client_fr
{
if (client->pendingstats[(i+MAX_CL_STATS)>>5u] & (1u<<((i+MAX_CL_STATS)&0x1f)))
{
char *s = client->statss[i];
const char *s = client->statss[i];
if (!s)
s = "";
@ -2105,7 +2104,13 @@ void SV_UpdateClientStats (client_t *client, int pnum, sizebuf_t *msg, client_fr
if (statss[i] || client->statss[i])
if (strcmp(statss[i]?statss[i]:"", client->statss[i]?client->statss[i]:""))
{
client->statss[i] = statss[i];
if (client->statss[i])
Z_Free((void*)client->statss[i]);
if (statss[i] && *statss[i])
client->statss[i] = Z_StrDup(statss[i]);
else
client->statss[i] = NULL;
if (pnum)
{
ClientReliableWrite_Begin(client->controller, svcfte_choosesplitclient, 5+strlen(statss[i]));
@ -2884,7 +2889,7 @@ void SV_SendClientMessages (void)
c->netchan.nqunreliableonly = false;
c->send_message = false;
//nq sends one packet only for each server physics frame
if (c->nextservertimeupdate < pt && c->state >= ca_connected)
if (c->nextservertimeupdate < pt && c->state >= cs_connected)
{
c->send_message = true;
c->nextservertimeupdate = pt + 1.0/77;
@ -2953,7 +2958,7 @@ void SV_SendMVDMessage(void)
sizebuf_t msg;
int statsi[MAX_CL_STATS];
float statsf[MAX_CL_STATS];
char *statss[MAX_CL_STATS];
const char *statss[MAX_CL_STATS];
float min_fps;
extern cvar_t sv_demofps;
extern cvar_t sv_demoPings;
@ -3032,7 +3037,14 @@ void SV_SendMVDMessage(void)
if (strcmp(statss[j]?statss[j]:"", demo.statss[i][j]?demo.statss[i][j]:""))
{
sizebuf_t *msg = MVDWrite_Begin(dem_stats, i, 3+strlen(statss[j]));
demo.statss[i][j] = statss[j];
if (demo.statss[i][j])
Z_Free(demo.statss[i][j]);
if (statss[j] && *statss[j])
demo.statss[i][j] = Z_StrDup(statss[j]);
else
demo.statss[i][j] = NULL;
MSG_WriteByte(msg, svcfte_updatestatstring);
MSG_WriteByte(msg, j);
MSG_WriteString(msg, statss[j]);

View file

@ -689,7 +689,6 @@ int main(int argc, char *argv[])
quakeparms_t parms;
// fd_set fdset;
// extern int net_socket;
int j;
signal(SIGPIPE, SIG_IGN);
tcgetattr(STDIN_FILENO, &orig);

View file

@ -500,7 +500,7 @@ void SVNQ_New_f (void)
protext1 = host_client->fteprotocolextensions;
protext2 = host_client->fteprotocolextensions2;
protmain = NQ_PROTOCOL_VERSION;
protmain = PROTOCOL_VERSION_NQ;
protfl = 0;
//force floatcoords as required.
if (sv.nqdatagram.prim.coordsize >= 4)
@ -525,33 +525,33 @@ void SVNQ_New_f (void)
if (protfl)
{
protext1 &= ~PEXT_FLOATCOORDS; //never report floatcoords when using rmq protocol, as the base protocol allows us to be more specific anyway.
protmain = RMQ_PROTOCOL_VERSION;
protmain = PROTOCOL_VERSION_RMQ;
protoname = "RMQ";
}
else
{
protmain = FITZ_PROTOCOL_VERSION;
protmain = PROTOCOL_VERSION_FITZ;
protoname = "666";
}
}
else
{
host_client->protocol = (host_client->protocol!=SCP_NETQUAKE)?SCP_PROQUAKE:SCP_NETQUAKE; //identical other than the client->server angles
protmain = NQ_PROTOCOL_VERSION;
protmain = PROTOCOL_VERSION_NQ;
protoname = "NQ";
}
maxplayers = 16;
break;
case SCP_DARKPLACES6:
SV_LogPlayer(host_client, "new (DP6)");
protmain = DP6_PROTOCOL_VERSION;
protmain = PROTOCOL_VERSION_DP6;
protext1 &= ~PEXT_FLOATCOORDS; //always enabled, try not to break things
maxplayers = 255;
protoname = "DPP6";
break;
case SCP_DARKPLACES7:
SV_LogPlayer(host_client, "new (DP7)");
protmain = DP7_PROTOCOL_VERSION;
protmain = PROTOCOL_VERSION_DP7;
protext1 &= ~PEXT_FLOATCOORDS; //always enabled, try not to break things
maxplayers = 255;
protoname = "DPP7";
@ -580,11 +580,18 @@ void SVNQ_New_f (void)
}
COM_FileBase(sv.modelname, mapname, sizeof(mapname));
// if (host_client->netchan.remote_address.type != NA_LOOPBACK) //don't display this to localhost, because its just spam at the end of the day. you don't want to see it in single player.
{
//note that certain clients glitch out if this does not have a trailing new line.
//note that those clients will also glitch out from vanilla servers too.
//vanilla prints something like: VERSION 1.08 SERVER (%i CRC)
//which isn't all that useful. so lets customise it to advertise properly, as well as provide gamedir and map (file)name info
Q_snprintfz (message, sizeof(message), "%c\n%s - "DISTRIBUTION" (%s%s%s%s %s) - %s", 2, gamedir,
protoname,(protext1||(protext2&~(PEXT2_REPLACEMENTDELTAS|PEXT2_VOICECHAT)))?"+":"",(protext2&PEXT2_REPLACEMENTDELTAS)?"F":"",(protext2&PEXT2_VOICECHAT)?"V":"",
build, mapname);
MSG_WriteByte (&host_client->netchan.message, svc_print);
MSG_WriteString (&host_client->netchan.message,message);
}
if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)
{
@ -625,7 +632,7 @@ void SVNQ_New_f (void)
MSG_WriteLong (&host_client->netchan.message, protext2);
}
MSG_WriteLong (&host_client->netchan.message, protmain);
if (protmain == RMQ_PROTOCOL_VERSION)
if (protmain == PROTOCOL_VERSION_RMQ)
MSG_WriteLong (&host_client->netchan.message, protfl);
MSG_WriteByte (&host_client->netchan.message, (sv.allocated_client_slots>maxplayers)?maxplayers:sv.allocated_client_slots);
@ -3669,18 +3676,15 @@ void SV_Pause_f (void)
static void SV_UpdateSeats(client_t *controller)
{
client_t *cl, *prev;
client_t *cl;
int curclients;
for (curclients = 0, cl = controller; cl; cl = cl->controlled)
{
prev = cl;
curclients++;
}
if (controller->protocol == SCP_QUAKE2)
return; //wait for the clientinfo stuff instead.
for (curclients = 0, cl = controller; cl; cl = cl->controlled)
curclients++;
ClientReliableWrite_Begin(controller, svc_signonnum, 2+curclients);
ClientReliableWrite_Byte(controller, curclients);
for (curclients = 0, cl = controller; cl; cl = cl->controlled, curclients++)
@ -5234,12 +5238,14 @@ void SVNQ_Begin_f (void)
// call the spawn function
pr_global_struct->time = sv.world.physicstime;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
if (pr_global_ptrs->ClientConnect)
PR_ExecuteProgram (svprogfuncs, pr_global_struct->ClientConnect);
sv.skipbprintclient = NULL;
// actually spawn the player
pr_global_struct->time = sv.world.physicstime;
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv_player);
if (pr_global_ptrs->PutClientInServer)
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PutClientInServer);
}
}
@ -5311,7 +5317,28 @@ void SVNQ_PreSpawn_f (void)
host_client->prespawn_idx = 0;
if (sv_mapcheck.value)
Con_Printf("Warning: %s cannot be enforced on NQ clients.\n", sv_mapcheck.name); //as you can fake it in a client anyway, this is hardly a significant issue.
{
const char *prot = "";
switch(host_client->protocol)
{
case SCP_NETQUAKE:
prot = " (nq)";
break;
case SCP_PROQUAKE:
prot = " (pq)";
break;
case SCP_FITZ666:
prot = " (fitz)";
break;
case SCP_DARKPLACES6:
prot = " (dpp6)";
break;
case SCP_DARKPLACES7:
prot = " (dpp7)";
break;
}
Con_Printf("Warning: %s cannot be enforced on player %s%s.\n", sv_mapcheck.name, host_client->name, prot); //as you can fake it in a client anyway, this is hardly a significant issue.
}
}
host_client->send_message = true;
@ -6222,7 +6249,6 @@ SV_RunCmd
*/
void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
{
extern int isPlugin;
edict_t *ent;
int i, n;
int oldmsec;
@ -6254,10 +6280,11 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
if ((tmp_time = realtime - host_client->last_check) >= sv_cheatspeedchecktime.value)
{
extern int isPlugin;
double tmp_time;
tmp_time = tmp_time * 1000.0 * sv_cheatpc.value/100.0;
if (host_client->msecs > tmp_time &&
isPlugin < 2) //debugging can result in WEIRD timings, so don't warn about weird timings if we're likely to get blocked out for long periods
isPlugin < 2) //qc-debugging can result in WEIRD timings, so don't warn about weird timings if we're likely to get blocked out for long periods
{
host_client->msec_cheating++;
SV_BroadcastTPrintf(PRINT_HIGH,

View file

@ -306,7 +306,7 @@ void INS_Accumulate(void)
void INS_Commands (void)
{
}
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, char *type, char *devicename, int *qdevid))
void INS_EnumerateDevices(void *ctx, void(*callback)(void *ctx, const char *type, const char *devicename, int *qdevid))
{
}

View file

@ -1601,7 +1601,7 @@ void SendNQClientData(sv_t *tv, viewer_t *v, netmsg_t *msg)
WriteByte (msg, 0);
}
// [always sent] if (bits & SU_ITEMS)
if (bits & SU_ITEMS)
WriteLong (msg, pl->stats[STAT_ITEMS]);
if (bits & SU_WEAPONFRAME)

View file

@ -6,6 +6,8 @@ Will show actual value when focused, and will show readable value when not.
The possible values is a separate popup.
*/
//FIXME: should probably set up a grabs to intercept right-click / escape outside of the item
class mitem_combo;
class mitem_combo_popup;
@ -20,11 +22,7 @@ class mitem_combo : mitem
float firstrow;
float visrows;
virtual void() item_remove =
{
strunzone(mstrlist);
super::item_remove();
};
virtual void() item_remove;
};
class mitem_combo_popup : mitem
@ -34,6 +32,22 @@ class mitem_combo_popup : mitem
virtual void(mitem newfocus, float changedflag) item_focuschange;
mitem_combo pfriend;
virtual void() item_remove =
{
if (pfriend)
pfriend.cfriend = 0;
super::item_remove();
};
};
void() mitem_combo::item_remove =
{
mitem_combo_popup p = cfriend;
if (p)
p.item_remove();
strunzone(mstrlist);
super::item_remove();
};
void(vector pos) mitem_combo::item_draw =
@ -63,11 +77,13 @@ void(vector pos) mitem_combo::item_draw =
pos_x += item_size_x / 2;
/* //border
ui.drawfill(pos, [item_size_x/2, 1], TD_BOT, item_alpha, 0);
ui.drawfill(pos, [1, item_size_y - 1], TD_RGT, item_alpha, 0);
ui.drawfill(pos + [item_size_x/2-1, 1], [1, item_size_y - 1], TD_LFT, item_alpha, 0);
ui.drawfill(pos + [0, item_size_y-1], [item_size_x/2, 1], TD_TOP, item_alpha, 0);
*/
//silly strings need to get cut off properly.
ui.setcliparea(pos[0], pos[1], item_size_x/2, item_size_y);
pos_y += (item_size_y - item_scale)*0.5;
@ -109,11 +125,12 @@ void(vector pos) mitem_combo_popup::item_draw =
ui.drawfill(pos, item_size, item_rgb, item_alpha, 0);
/* //border
ui.drawfill(pos, [item_size_x, 1], TD_BOT, item_alpha, 0);
ui.drawfill(pos, [1, item_size_y - 1], TD_RGT, item_alpha, 0);
ui.drawfill(pos + [item_size_x-1, 1], [1, item_size_y - 1], TD_LFT, item_alpha, 0);
ui.drawfill(pos + [0, item_size_y-1], [item_size_x, 1], TD_TOP, item_alpha, 0);
pos_x += 1;
*/ pos_x += 1;
v = tokenize(f.mstrlist);
for (c = 0; c < v; c += 2)
@ -179,8 +196,15 @@ float(vector pos, float scan, float char, float down) mitem_combo::item_keypress
}
}
if (scan == K_ESCAPE)
if (scan == K_ESCAPE || scan == K_MOUSE2)
{
if (cfriend)
{
cfriend.item_remove();
return TRUE;
}
return FALSE;
}
else if (scan == K_MWHEELUP || (scan == K_UPARROW && cfriend))
{
i -= 2;

View file

@ -24,11 +24,11 @@ void(vector pos) mitem_edit::item_draw =
super::item_draw(pos);
pos_x += item_size_x / 2;
ui.drawfill(pos, [item_size_x/2, 1], TD_BOT, item_alpha, 0);
/* ui.drawfill(pos, [item_size_x/2, 1], TD_BOT, item_alpha, 0);
ui.drawfill(pos, [1, self.item_size_y - 1], TD_RGT, item_alpha, 0);
ui.drawfill(pos + [item_size_x/2-1, 1], [1, item_size_y - 1], TD_LFT, item_alpha, 0);
ui.drawfill(pos + [0, item_size_y-1], [item_size_x/2, 1], TD_TOP, item_alpha, 0);
pos_y += (item_size_y - item_scale)*0.5;
*/ pos_y += (item_size_y - item_scale)*0.5;
pos_x += 1;
spos = min(spos, strlen(curval));

View file

@ -51,8 +51,13 @@ var float dp_workarounds;
#define TD_RGT '0.2 0.2 0.2'
#define TD_BOT '0.0 0.0 0.0'
#define MENUBACK_RGB '0.5 0.5 0.6'
#ifndef MENUBACK_RGB
#define MENUBACK_RGB '0.4 0.365 0.29'
//#define MENUBACK_RGB '0.5 0.5 0.6'
#endif
#ifndef MENUBACK_ALPHA
#define MENUBACK_ALPHA 0.8
#endif
//#ifdef TARGET_FTE
//#pragma TARGET FTE