diff --git a/engine/Makefile b/engine/Makefile index 66e62b7f9..1942abe32 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -6,11 +6,15 @@ STRIPFLAGS=--strip-unneeded --remove-section=.comment CPUOPTIMIZATIONS= -BASE_DIR=$(realpath .) +#canonicalize the source path. except emscripten warns about that like crazy. *sigh* +BASE_DIR:=$(realpath .) +ifeq ($(FTE_TARGET),web) + BASE_DIR:=. +endif SVNREVISION:=-DSVNREVISION=$(shell test -d .svn && svnversion || echo -) -WHOAMI=$(shell whoami) +WHOAMI:=$(shell whoami) #only limited forms of cross-making is supported #only the following 3 are supported @@ -84,8 +88,8 @@ ifeq ($(FTE_TARGET),droid) TOOLCHAIN:=$(ANDROID_NDK_ROOT)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi- endif ANDROID_SCRIPT=android.bat - #make can't cope with absolute paths in dependancy files - NODEPS = 1 + #make can't cope with absolute win32 paths in dependancy files + DEPCC= endif DROID_API_LEVEL=4 @@ -820,7 +824,7 @@ ifeq ($(FTE_TARGET),vc) DO_CC=@$(CC) /nologo $(ALL_CFLAGS) -Fo$@ -c $< DO_LD=$(DO_ECHO) "$(MSVCPATH)link" /nologo /out:"$@" /nodefaultlib:libc.lib /LARGEADDRESSAWARE /nodefaultlib:MSVCRT $(MSVCLIB) /manifest:no /OPT:REF wsock32.lib user32.lib advapi32.lib winmm.lib libs/zlib$(BITS).lib shell32.lib PRECOMPHEADERS = - NODEPS = 1 + DEPCC= LIBS_DIR=./libs/ @@ -1094,9 +1098,11 @@ endif ifeq ($(FTE_TARGET),web) WEB_PREJS ?= --pre-js web/prejs.js WEB_MEMORY?=402653184 - RELEASE_CFLAGS=-O1 -DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB $(WEB_PREJS) - DEBUG_CFLAGS=-O0 -g --jcache -DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB $(WEB_PREJS) - CC=emcc -s TOTAL_MEMORY=$(WEB_MEMORY) + RELEASE_CFLAGS=-DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB + DEBUG_CFLAGS=-g --jcache -DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB + RELEASE_LDFLAGS=-O1 $(WEB_PREJS) -s TOTAL_MEMORY=$(WEB_MEMORY) + DEBUG_LDLAGS=-O0 $(WEB_PREJS) -s TOTAL_MEMORY=$(WEB_MEMORY) + CC=emcc #-s ASM_JS=1 #BASELDFLAGS= @@ -1126,10 +1132,12 @@ ifeq ($(FTE_TARGET),web) OGGVORBISLDFLAGS= BOTLIB_CFLAGS= - NODEPS = 1 + #generate deps properly + #DEPCC= endif SV_DIR?=sv_sdl +DEPCC?=$(CC) -include Makefile_private @@ -1192,9 +1200,9 @@ $(OUT_DIR)/npplug.o : ftequake/npplug.rc # rm -f $@.$$$$ $(OUT_DIR)/%.o $(OUT_DIR)/%.d : %.c -ifeq ($(NODEPS),) +ifneq ($(DEPCC),) @set -e; rm -f $@.d; \ - $(CC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ + $(DEPCC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ sed 's,\($*\)\.o[ :]*,$@ $@.d : ,g' < $@.d.$$$$ > $@.d; \ sed -e 's/.*://' -e 's/\\$$//' < $@.d.$$$$ | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.d; \ rm -f $@.d.$$$$ @@ -1202,9 +1210,9 @@ endif $(DO_CC) -I$(OUT_DIR) $(OUT_DIR)/%.o $(OUT_DIR)/%.d : %.cpp -ifeq ($(NODEPS),) +ifneq ($(DEPCC),) @set -e; rm -f $@.d; \ - $(CC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ + $(DEPCC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ sed 's,\($*\)\.o[ :]*,$@ $@.d : ,g' < $@.d.$$$$ > $@.d; \ sed -e 's/.*://' -e 's/\\$$//' < $@.d.$$$$ | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.d; \ rm -f $@.d.$$$$ @@ -1212,9 +1220,9 @@ endif $(DO_CC) -I$(OUT_DIR) $(OUT_DIR)/%.oo $(OUT_DIR)/%.d : %.c -ifeq ($(NODEPS),) +ifneq ($(DEPCC),) @set -e; rm -f $@.d; \ - $(CC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ + $(DEPCC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ sed 's,\($*\)\.oo[ :]*,$@ $@.d : ,g' < $@.d.$$$$ > $@.d; \ sed -e 's/.*://' -e 's/\\$$//' < $@.d.$$$$ | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.d; \ rm -f $@.d.$$$$ @@ -1223,7 +1231,7 @@ endif $(OUT_DIR)/%.mo $(OUT_DIR)/%.d : %.m @set -e; rm -f $@.d; \ - $(CC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ + $(DEPCC) -MM $(ALL_CFLAGS) $< > $@.d.$$$$; \ sed 's,\($*\)\.mo[ :]*,$@ $@.d : ,g' < $@.d.$$$$ > $@.d; \ sed -e 's/.*://' -e 's/\\$$//' < $@.d.$$$$ | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.d; \ rm -f $@.d.$$$$ @@ -1231,7 +1239,7 @@ $(OUT_DIR)/%.mo $(OUT_DIR)/%.d : %.m #enables use of precompiled headers in gcc 3.4 onwards. $(OUT_DIR)/quakedef.h.gch : quakedef.h - $(CC) -x c $(BASE_CFLAGS) $(WCFLAGS) -o $@ -c $< $(CFLAGS) + $(CC) -x c $(ALL_CFLAGS) -o $@ -c $< PRECOMPHEADERS ?= $(OUT_DIR)/quakedef.h.gch #addprefix is to add the ./release/server/ part of the object name diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 16800fe60..4119d4993 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -1469,7 +1469,7 @@ void CL_PlayDemo_f (void) void CL_PlayDemo(char *demoname) { char name[256]; - int ft, neg; + int ft, neg = false; int len; char type; char chr; @@ -1564,8 +1564,6 @@ void CL_PlayDemo(char *demoname) } else { - cls.protocol = CP_QUAKEWORLD; - ft = 0; //work out if the first line is a int for the track number. while ((VFS_READ(cls.demoinfile, &chr, 1)==1) && (chr != '\n')) { @@ -1576,6 +1574,8 @@ void CL_PlayDemo(char *demoname) else ft = ft * 10 + ((int)chr - '0'); } + if (neg) + ft *= -1; if (chr == '\n') { #ifndef NQPROT @@ -1583,12 +1583,17 @@ void CL_PlayDemo(char *demoname) CL_StopPlayback(); return; #else + //fixme: play that cdtrack. cls.protocol = CP_NETQUAKE; cls.demoplayback = DPB_NETQUAKE; //nq demos. :o) #endif } else + { + cls.protocol = CP_QUAKEWORLD; + VFS_SEEK(cls.demoinfile, start); //quakeworld demo, so go back to start. + } } TP_ExecTrigger ("f_demostart"); diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 631ed69df..c8ceeae64 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1288,7 +1288,7 @@ void CLDP_ParseDarkPlaces5Entities(void) //the things I do.. :o( static packet_entities_t newpack; entity_state_t *to, *from; - unsigned short read; + unsigned int read; int oldi, newi, lowesti, lowestv, newremaining; qboolean remove; @@ -1306,12 +1306,15 @@ void CLDP_ParseDarkPlaces5Entities(void) //the things I do.. :o( oldi = 0; newpack.num_entities = 0; - for (read = MSG_ReadShort(); read!=0x8000; read = MSG_ReadShort()) + for (;;) { + read = MSG_ReadShort(); if (msg_badread) Host_EndGame("Corrupt entitiy message packet\n"); remove = !!(read&0x8000); - read&=~0x8000; + read&=0x7fff; + if (remove && !read) + break; //remove world signals end of packet. if (read >= MAX_EDICTS) Host_EndGame("Too many entities.\n"); @@ -1417,7 +1420,6 @@ void CLNQ_ParseEntity(unsigned int bits) int num; entity_state_t *state;//, *from; entity_state_t *base; - static float lasttime; packet_entities_t *pack; if (cls.signon == 4 - 1) @@ -1461,7 +1463,6 @@ void CLNQ_ParseEntity(unsigned int bits) pack->entities = BZ_Realloc(pack->entities, sizeof(entity_state_t)*pack->max_entities); memset(pack->entities + pack->num_entities, 0, sizeof(entity_state_t)); } - lasttime = realtime; state = &pack->entities[pack->num_entities++]; } @@ -3615,21 +3616,6 @@ int lastplayerinfo; void CL_ParseClientdata (void); void CL_MVDUpdateSpectator(void) { - player_state_t *self, *oldself; - int s; - for (s = 0; s < cl.splitclients; s++) - { - self = &cl.inframes[cl.parsecount & UPDATE_MASK].playerstate[cl.playernum[s]]; - oldself = &cl.inframes[(cls.netchan.outgoing_sequence - 1) & UPDATE_MASK].playerstate[cl.playernum[s]]; -// cl.frames[cl.parsecount & UPDATE_MASK].senttime = cl.frames[(cls.netchan.outgoing_sequence - 1) & UPDATE_MASK].senttime; - -// self->messagenum = cl.parsecount; - -// VectorCopy(oldself->origin, self->origin); -// VectorCopy(oldself->velocity, self->velocity); -// VectorCopy(oldself->viewangles, self->viewangles); - } - CL_ParseClientdata(); } @@ -4121,7 +4107,6 @@ void CL_LinkPlayers (void) entity_t *ent; int msec; inframe_t *frame; - inframe_t *fromf; int oldphysent; vec3_t angles; qboolean predictplayers; @@ -4139,7 +4124,6 @@ void CL_LinkPlayers (void) playertime = realtime; frame = &cl.inframes[cl.validsequence&UPDATE_MASK]; - fromf = &cl.inframes[cl.oldvalidsequence&UPDATE_MASK]; predictplayers = cl_predict_players.ival; if (cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV) diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index 233a9b9e2..80c3e3de2 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -1818,7 +1818,10 @@ void CL_SendCmd (double frametime, qboolean mainloop) } #ifdef VOICECHAT - S_Voip_Transmit(clc_voicechat, &buf); + if (cls.protocol == CP_QUAKE2) + S_Voip_Transmit(clcq2_voicechat, &buf); + else + S_Voip_Transmit(clc_voicechat, &buf); #endif // diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 5d0861d0a..da3df14f6 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -2842,7 +2842,7 @@ void CL_ReadPackets (void) qboolean CL_AllowArbitaryDownload(char *localfile) { - qboolean allow; + int allow; //never allow certain (native code) arbitary downloads. if (!strnicmp(localfile, "game", 4) || !stricmp(localfile, "progs.dat") || !stricmp(localfile, "menu.dat") || !stricmp(localfile, "csprogs.dat") || !stricmp(localfile, "qwprogs.dat") || strstr(localfile, "..") || strstr(localfile, ":") || strstr(localfile, "//") || strstr(localfile, ".qvm") || strstr(localfile, ".dll") || strstr(localfile, ".so")) { //yes, I know the user can use a different progs from the one that is specified. If you leave it blank there will be no problem. (server isn't allowed to stuff progs cvar) @@ -2953,7 +2953,6 @@ void CL_DownloadSize_f(void) } else if (!strcmp(size, "r")) { //'download this file instead' - int allow = cl_download_redirection.ival; redirection = Cmd_Argv(3); if (!CL_AllowArbitaryDownload(redirection)) @@ -3546,7 +3545,7 @@ double Host_Frame (double time) static double time3 = 0; int pass1, pass2, pass3; // float fps; - double realframetime, newrealtime; + double newrealtime; static double spare; float maxfps; qboolean maxfpsignoreserver; @@ -3561,15 +3560,12 @@ double Host_Frame (double time) newrealtime = Media_TweekCaptureFrameTime(realtime, time); - realframetime = time = newrealtime - realtime; + time = newrealtime - realtime; realtime = newrealtime; if (oldrealtime > realtime) oldrealtime = 0; -// if (cls.demoplayback && cl_demospeed.value>0) -// realframetime *= cl_demospeed.value; // this probably screws up other timings - if (cl.gamespeed<0.1) cl.gamespeed = 1; time *= cl.gamespeed; @@ -3835,7 +3831,6 @@ void CL_ReadCDKey(void) buffer = COM_LoadTempFile("q3key"); if (buffer) //a cdkey is meant to be 16 chars { - cvar_t *var; char *chr; for (chr = buffer; *chr; chr++) { @@ -3845,7 +3840,7 @@ void CL_ReadCDKey(void) break; } } - var = Cvar_Get("cl_cdkey", buffer, CVAR_LATCH|CVAR_NOUNSAFEEXPAND, "Q3 compatability"); + Cvar_Get("cl_cdkey", buffer, CVAR_LATCH|CVAR_NOUNSAFEEXPAND, "Q3 compatability"); } } #endif diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index ca81b498b..81ccc2d62 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -391,7 +391,7 @@ qboolean CL_EnqueDownload(char *filename, char *localname, unsigned int flags) return false; } ext = COM_FileExtension(localname); - if (!stricmp(localname, "dll") || !stricmp(localname, "so") || strchr(localname, '\\') || strchr(localname, ':') || strstr(localname, "..")) + if (!stricmp(ext, "dll") || !stricmp(ext, "so") || strchr(localname, '\\') || strchr(localname, ':') || strstr(localname, "..")) { Con_Printf("Denying download of \"%s\"\n", filename); return false; @@ -1890,6 +1890,7 @@ void CL_ParseDownload (void) char *localname; Q_strncpyz(name, MSG_ReadString(), sizeof(name)); localname = MSG_ReadString(); + Con_DPrintf("Download for %s redirected to %s\n", localname, name); /*quakeforge http download redirection*/ if (cls.downloadqw) { @@ -3838,11 +3839,11 @@ void CLQ2_ParseStartSoundPacket(void) *skin = '\0'; if (*model) { - S_StartSound (ent, channel, S_PrecacheSound(va("players/%s/%s", model, cl.sound_precache[sound_num]->name+1)), pos, volume, attenuation, 0, 0); + S_StartSound (ent, channel, S_PrecacheSound(va("players/%s/%s", model, cl.sound_precache[sound_num]->name+1)), pos, volume, attenuation, ofs, 0); return; } } - S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume, attenuation, 0, 0); + S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume, attenuation, ofs, 0); } #endif diff --git a/engine/client/clq2_ents.c b/engine/client/clq2_ents.c index b744b105b..36f64bb6a 100644 --- a/engine/client/clq2_ents.c +++ b/engine/client/clq2_ents.c @@ -1823,7 +1823,6 @@ void CLQ2_CalcViewValues (void) extern cvar_t v_gunkick_q2; int i; float lerp, backlerp; - q2centity_t *ent; q2frame_t *oldframe; q2player_state_t *ps, *ops; extern cvar_t gl_cshiftenabled; @@ -1846,7 +1845,6 @@ void CLQ2_CalcViewValues (void) || abs(ops->pmove.origin[2] - ps->pmove.origin[2]) > 256*8) ops = ps; // don't interpolate - ent = &cl_entities[cl.playernum[0]+1]; lerp = cl.lerpfrac; // calculate the origin diff --git a/engine/client/clq3_parse.c b/engine/client/clq3_parse.c index d1ea5825e..15d646c60 100644 --- a/engine/client/clq3_parse.c +++ b/engine/client/clq3_parse.c @@ -475,7 +475,9 @@ qboolean CLQ3_SystemInfoChanged(char *str) while(rn) { + char crc[64]; vfsfile_t *f; + rc = COM_ParseOut(rc, crc, sizeof(crc)); rn = COM_Parse(rn); if (!*com_token) break; @@ -483,22 +485,31 @@ qboolean CLQ3_SystemInfoChanged(char *str) if (!strchr(com_token, '/')) //don't let some muppet tell us to download quake3.exe break; + //as much as I'd like to use COM_FCheckExists, this stuf is relative to root, not the gamedir. f = FS_OpenVFS(va("%s.pk3", com_token), "rb", FS_ROOT); if (f) - VFS_CLOSE(f); - else { - //fixme: request to download it - Con_Printf("Sending request to download %s\n", com_token); - CLQ3_SendClientCommand("download %s.pk3", com_token); - ccs.downloadchunknum = 0; - snprintf(cls.downloadlocalname, sizeof(cls.downloadlocalname), "%s.pk3", com_token); - snprintf(cls.downloadremotename, sizeof(cls.downloadremotename), "%s.pk3", com_token); - snprintf(cls.downloadtempname, sizeof(cls.downloadtempname), "%s.tmp", com_token); - cls.downloadmethod = DL_Q3; - cls.downloadpercent = 0; - return false; + VFS_CLOSE(f); + continue; } + FS_GenCachedPakName(va("%s.pk3", com_token), crc, cls.downloadlocalname, sizeof(cls.downloadlocalname)); + f = FS_OpenVFS(cls.downloadlocalname, "rb", FS_ROOT); + if (f) + { + VFS_CLOSE(f); + continue; + } + + //fixme: request to download it + Con_Printf("Sending request to download %s\n", com_token); + CLQ3_SendClientCommand("download %s.pk3", com_token); + ccs.downloadchunknum = 0; + //q3's downloads are relative to root, but they do at least force a pk3 extension. + FS_GenCachedPakName(va("%s.tmp", com_token), crc, cls.downloadtempname, sizeof(cls.downloadtempname)); + snprintf(cls.downloadremotename, sizeof(cls.downloadremotename), "%s.pk3", com_token); + cls.downloadmethod = DL_Q3; + cls.downloadpercent = 0; + return false; } pc = Info_ValueForKey(str, "sv_paks"); //the ones that we are allowed to use (in order!) diff --git a/engine/client/console.c b/engine/client/console.c index e653593fa..58338cb13 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -367,7 +367,7 @@ void Key_ClearTyping (void) void Con_History_Load(void) { char line[8192]; - unsigned char *cr; + char *cr; vfsfile_t *file = FS_OpenVFS("conhistory.txt", "rb", FS_ROOT); for (edit_line=0 ; edit_line<=CON_EDIT_LINES_MASK ; edit_line++) diff --git a/engine/client/image.c b/engine/client/image.c index d9db1f2f1..e158b097d 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -45,7 +45,7 @@ typedef struct { //cm = colourmap char *ReadGreyTargaFile (qbyte *data, int flen, tgaheader_t *tgahead, int asgrey) //preswapped header { - int columns, rows, numPixels; + int columns, rows; int row, column; qbyte *pixbuf, *pal; qboolean flipped; @@ -60,7 +60,7 @@ char *ReadGreyTargaFile (qbyte *data, int flen, tgaheader_t *tgahead, int asgrey return NULL; } - if (tgahead->version==1 && tgahead->bpp != 8 && + if (tgahead->version==1 && tgahead->bpp != 8 && tgahead->cm_size != 24 && tgahead->cm_len != 256) { Con_Printf("LoadGrayTGA: Strange palette type\n"); @@ -70,7 +70,6 @@ char *ReadGreyTargaFile (qbyte *data, int flen, tgaheader_t *tgahead, int asgrey columns = tgahead->width; rows = tgahead->height; - numPixels = columns * rows; flipped = !((tgahead->attribs & 0x20) >> 5); #ifndef NPFTE @@ -1700,11 +1699,11 @@ qbyte *ReadPCXData(qbyte *buf, int length, int width, int height, qbyte *result) { pcx_t *pcx; // pcx_t pcxbuf; - qbyte *palette; +// qbyte *palette; qbyte *pix; int x, y; int dataByte, runLength; - int count; +// int count; qbyte *data; unsigned short xmin, ymin, swidth, sheight; @@ -1735,13 +1734,8 @@ qbyte *ReadPCXData(qbyte *buf, int length, int width, int height, qbyte *result) return NULL; //we can't feed the requester with enough info } - - palette = buf + length-768; - data = (char *)(pcx+1); - count = (swidth) * (sheight); - for (y=0 ; yurl, '?'); char *ext; if (dl->file && dl->status == DL_FINISHED) @@ -882,6 +881,7 @@ static void CL_BootDownload_Complete(struct dl_download *dl) if (!stricmp(ext, "zip")) { #ifdef AVAIL_ZLIB + void *zip; if (dl->status == DL_FINISHED) zip = zipfilefuncs.OpenNew(dl->file, dl->url); else diff --git a/engine/client/m_items.c b/engine/client/m_items.c index b87e7e477..bb728f624 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -567,7 +567,6 @@ static void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu { int x = xpos+option->common.posx; int y = ypos+option->common.posy; - int l; int keys[2]; char *keyname; @@ -578,7 +577,6 @@ static void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu x += strlen(option->bind.caption)*8+28; { extern cvar_t cl_forcesplitclient; - l = strlen (option->bind.command); M_FindKeysForCommand (cl_forcesplitclient.ival, option->bind.command, keys); diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index 85eadf233..f09510961 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -595,7 +595,7 @@ void M_Media_Key (int key) } else if (selectedoption>=0) { - mediatrack_t *prevtrack, *tr; + mediatrack_t *tr; int num=0; tr=tracks; while(tr) @@ -603,7 +603,6 @@ void M_Media_Key (int key) if (num == selectedoption) break; - prevtrack = tr; tr=tr->next; num++; } diff --git a/engine/client/m_options.c b/engine/client/m_options.c index be10ab10e..faa0b3070 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -239,7 +239,9 @@ void M_Menu_Audio_f (void) menu_t *menu; extern cvar_t nosound, snd_leftisright, snd_khz, snd_speakers, ambient_level, bgmvolume, snd_playersoundvolume, ambient_fade, cl_staticsounds, snd_inactive, _snd_mixahead, snd_usemultipledevices; // extern cvar_t snd_noextraupdate, snd_eax, precache; +#ifdef VOICECHAT extern cvar_t cl_voip_play, cl_voip_send; +#endif static const char *soundqualityoptions[] = { "11025 Hz", diff --git a/engine/client/merged.h b/engine/client/merged.h index 2f29a2807..8e786202f 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -189,9 +189,10 @@ typedef struct texid_s texid_tf; //small context for easy vbo creation. typedef struct { - unsigned int maxsize; - unsigned int pos; + size_t maxsize; + size_t pos; int vboid[2]; + void *fallback; } vbobctx_t; typedef struct vboarray_s diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 6c3e862c2..4db17bee8 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -2125,17 +2125,7 @@ void CL_MasterListParse(netadrtype_t adrtype, int type, qboolean slashpad) for (i = 0; i < adrlen; i++) ((qbyte *)&info->adr.address)[i] = MSG_ReadByte(); break; - - // warning: enumeration value 'NA_*' not handled in switch - case NA_WEBSOCKET: - case NA_INVALID: - case NA_LOOPBACK: - case NA_BROADCAST_IP: - case NA_BROADCAST_IP6: - case NA_BROADCAST_IPX: - case NA_TCP: - case NA_TCPV6: - case NA_IRC: + default: break; } diff --git a/engine/client/p_classic.c b/engine/client/p_classic.c index 80ee29c53..c7e9c42d9 100644 --- a/engine/client/p_classic.c +++ b/engine/client/p_classic.c @@ -333,7 +333,6 @@ static void PClassic_DrawParticles(void) float time2, time3, time1, dvel, frametime, grav; vec3_t up, right; float dist, scale, r_partscale=0; - unsigned int *palette; #ifdef POLYS scenetris_t *scenetri; #else @@ -342,13 +341,6 @@ static void PClassic_DrawParticles(void) static float oldtime; RSpeedMark(); -/*#ifdef D3DQUAKE - if (qrenderer == QR_DIRECT3D) - palette = d_8to24bgrtable; - else -#endif*/ - palette = d_8to24rgbtable; - //make sure all ents are pushed through first RQ_RenderBatchClear(); diff --git a/engine/client/p_script.c b/engine/client/p_script.c index 6adee76db..513bd6a88 100644 --- a/engine/client/p_script.c +++ b/engine/client/p_script.c @@ -1883,7 +1883,6 @@ static void P_ImportEffectInfo_f(void) part_type_t *ptype = NULL; int parenttype; char *file, *line; - char *cmd; char arg[8][1024]; int args = 0; char *config = "effectinfo"; @@ -1917,7 +1916,6 @@ static void P_ImportEffectInfo_f(void) if (args <= 0) continue; - cmd = arg[0]; if (!strcmp(arg[0], "effect")) { char newname[64]; diff --git a/engine/client/pr_clcmd.c b/engine/client/pr_clcmd.c index 7a5cf6274..4f09ad6ae 100644 --- a/engine/client/pr_clcmd.c +++ b/engine/client/pr_clcmd.c @@ -571,8 +571,8 @@ void QCBUILTIN PF_cl_GetBindMap (pubprogfuncs_t *prinst, struct globalvars_s *pr } void QCBUILTIN PF_cl_SetBindMap (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { - int primary = G_FLOAT(OFS_PARM0+0); - int secondary = G_FLOAT(OFS_PARM0+1); +// int primary = G_FLOAT(OFS_PARM0+0); +// int secondary = G_FLOAT(OFS_PARM0+1); // if (IN_SetBindMap(primary, secondary)) // G_FLOAT(OFS_RETURN) = 1; G_FLOAT(OFS_RETURN) = 0; diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 396dacc2c..d619b5052 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -1550,7 +1550,7 @@ static void QCBUILTIN PF_cs_SetSize(pubprogfuncs_t *prinst, struct globalvars_s World_LinkEdict(&csqc_world, (wedict_t*)ent, false); } -static void cs_settracevars(trace_t *tr) +static void cs_settracevars(trace_t *tr, struct globalvars_s *pr_globals) { *csqcg.trace_allsolid = tr->allsolid; *csqcg.trace_startsolid = tr->startsolid; @@ -1599,7 +1599,7 @@ static void QCBUILTIN PF_cs_traceline(pubprogfuncs_t *prinst, struct globalvars_ trace = World_Move (&csqc_world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent); ent->xv->hull = savedhull; - cs_settracevars(&trace); + cs_settracevars(&trace, pr_globals); } static void QCBUILTIN PF_cs_tracebox(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -1621,7 +1621,7 @@ static void QCBUILTIN PF_cs_tracebox(pubprogfuncs_t *prinst, struct globalvars_s trace = World_Move (&csqc_world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent); ent->xv->hull = savedhull; - cs_settracevars(&trace); + cs_settracevars(&trace, pr_globals); } static trace_t CS_Trace_Toss (csqcedict_t *tossent, csqcedict_t *ignore) @@ -1679,7 +1679,7 @@ static void QCBUILTIN PF_cs_tracetoss (pubprogfuncs_t *prinst, struct globalvars trace = CS_Trace_Toss (ent, ignore); - cs_settracevars(&trace); + cs_settracevars(&trace, pr_globals); } static void QCBUILTIN PF_cs_pointcontents(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) @@ -3335,7 +3335,7 @@ static void QCBUILTIN PF_rotatevectorsbytag (pubprogfuncs_t *prinst, struct glob - +//fixme merge with ssqc static void QCBUILTIN PF_cs_checkbottom (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { csqcedict_t *ent; @@ -3353,6 +3353,7 @@ static void QCBUILTIN PF_cs_break (pubprogfuncs_t *prinst, struct globalvars_s * #endif } +//fixme merge with ssqc static void QCBUILTIN PF_cs_walkmove (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { csqcedict_t *ent; @@ -3385,12 +3386,13 @@ static void QCBUILTIN PF_cs_walkmove (pubprogfuncs_t *prinst, struct globalvars_ // save program state, because CS_movestep may call other progs oldself = *csqcg.self; - G_FLOAT(OFS_RETURN) = World_movestep(&csqc_world, (wedict_t*)ent, move, true, false, NULL, pr_globals); + G_FLOAT(OFS_RETURN) = World_movestep(&csqc_world, (wedict_t*)ent, move, true, false, settrace?cs_settracevars:NULL, pr_globals); // restore program state *csqcg.self = oldself; } +//fixme merge with ssqc static void QCBUILTIN PF_cs_movetogoal (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { wedict_t *ent; diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 2b431db85..8a3e140c6 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -10,6 +10,25 @@ #if defined(MENU_DAT) || defined(CSQC_DAT) #include "cl_master.h" +extern int r2d_be_flags; +#define DRAWFLAG_NORMAL 0 +#define DRAWFLAG_ADD 1 +#define DRAWFLAG_MODULATE 2 +#define DRAWFLAG_MODULATE2 3 +static unsigned int PF_SelectDPDrawFlag(int flag) +{ + //flags: + //0 = blend + //1 = add + //2 = modulate + //3 = modulate*2 + flag &= 3; + if (flag == DRAWFLAG_ADD) + return BEF_FORCEADDITIVE; + else + return 0; +} + //float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457; void QCBUILTIN PF_CL_drawfill (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -266,6 +285,7 @@ void QCBUILTIN PF_CL_drawcolouredstring (pubprogfuncs_t *prinst, struct globalva COM_ParseFunString(CON_WHITEMASK, text, buffer, sizeof(buffer), false); str = buffer; + r2d_be_flags = PF_SelectDPDrawFlag(flag); PR_CL_BeginString(prinst, pos[0], pos[1], size[0], size[1], &px, &py); ipx = px; Font_ForceColour(r, g, b, alpha); @@ -281,6 +301,7 @@ void QCBUILTIN PF_CL_drawcolouredstring (pubprogfuncs_t *prinst, struct globalva } Font_InvalidateColour(); Font_EndString(NULL); + r2d_be_flags = 0; } void QCBUILTIN PF_CL_stringwidth(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) @@ -300,25 +321,6 @@ void QCBUILTIN PF_CL_stringwidth(pubprogfuncs_t *prinst, struct globalvars_s *pr G_FLOAT(OFS_RETURN) = (px * vid.width) / vid.rotpixelwidth; } -#define DRAWFLAG_NORMAL 0 -#define DRAWFLAG_ADD 1 -#define DRAWFLAG_MODULATE 2 -#define DRAWFLAG_MODULATE2 3 - -extern unsigned int r2d_be_flags; -static unsigned int PF_SelectDPDrawFlag(int flag) -{ - //flags: - //0 = blend - //1 = add - //2 = modulate - //3 = modulate*2 - if (flag == 1) - return BEF_FORCEADDITIVE; - else - return 0; -} - //float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456; void QCBUILTIN PF_CL_drawpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -378,13 +380,8 @@ void QCBUILTIN PF_CL_drawsubpic (pubprogfuncs_t *prinst, struct globalvars_s *pr void QCBUILTIN PF_CL_is_cached_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { char *str; - str = PR_GetStringOfs(prinst, OFS_PARM0); - -// if (Draw_IsCached) -// G_FLOAT(OFS_RETURN) = !!Draw_IsCached(str); -// else - G_FLOAT(OFS_RETURN) = 1; + G_FLOAT(OFS_RETURN) = !!R_RegisterCustom(str, NULL, NULL); } void QCBUILTIN PF_CL_precache_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) @@ -421,11 +418,12 @@ void QCBUILTIN PF_CL_precache_pic (pubprogfuncs_t *prinst, struct globalvars_s * void QCBUILTIN PF_CL_free_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { + //we don't support this, as the shader could be used elsewhere also, and we have pointers to things. +/* char *str; - str = PR_GetStringOfs(prinst, OFS_PARM0); - - //we don't support this. + R_UnloadShader(R_RegisterCustom(str, NULL, NULL)); +*/ } //float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454; diff --git a/engine/client/pr_skelobj.c b/engine/client/pr_skelobj.c index 6f516f13b..c1c67cfcd 100644 --- a/engine/client/pr_skelobj.c +++ b/engine/client/pr_skelobj.c @@ -627,7 +627,6 @@ static doll_t *rag_loaddoll(model_t *mod, char *fname, int numbones) { doll_t *d; void *fptr = NULL; - int fsize; for (d = dolllist; d; d = d->next) { @@ -636,7 +635,7 @@ static doll_t *rag_loaddoll(model_t *mod, char *fname, int numbones) return d; } - fsize = FS_LoadFile(fname, &fptr); + FS_LoadFile(fname, &fptr); if (!fptr) { #ifndef SERVERONLY diff --git a/engine/client/r_2d.c b/engine/client/r_2d.c index 947448ec1..ecd99a8e5 100644 --- a/engine/client/r_2d.c +++ b/engine/client/r_2d.c @@ -422,13 +422,11 @@ void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int /* this is an ugly special case drawing func that's only used for the player color selection menu */ void R2D_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qbyte *translation) { - int v, u, c; + int v, u; unsigned trans[64*64], *dest; qbyte *src; int p; - c = width * height; - dest = trans; for (v=0 ; v<64 ; v++, dest += 64) { diff --git a/engine/client/r_d3.c b/engine/client/r_d3.c index 5facc8332..4599ce7b4 100644 --- a/engine/client/r_d3.c +++ b/engine/client/r_d3.c @@ -277,7 +277,7 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data) } else if (!strcmp(token, "interAreaPortals")) { - int numareas; + //int numareas; int pno, v; portal_t *p; @@ -286,7 +286,7 @@ qboolean Mod_LoadMap_Proc(model_t *model, char *data) return false; data = COM_ParseOut(data, token, sizeof(token)); - numareas = atoi(token); + //numareas = atoi(token); data = COM_ParseOut(data, token, sizeof(token)); model->numportals = atoi(token); diff --git a/engine/client/roq_read.c b/engine/client/roq_read.c index 6a6c40e95..b3cea0a64 100644 --- a/engine/client/roq_read.c +++ b/engine/client/roq_read.c @@ -68,15 +68,13 @@ unsigned long ret; /* -------------------------------------------------------------------------- */ static int roq_parse_file(vfsfile_t *fp, roq_info *ri) { -unsigned int head1, head3, chunk_id, chunk_arg; +unsigned int head1, head3, chunk_id;//, chunk_arg; long head2, chunk_size; long fpos; #ifndef FAST int max_frame; #endif -#define rfeof(f) (VFS_TELL(f)>= ri->maxpos) - #ifndef FAST ri->num_audio_bytes = ri->num_frames = max_frame = 0; ri->audio_channels = 0; @@ -91,22 +89,22 @@ int max_frame; return 1; } - ri->roq_start = VFS_TELL(fp); - while(!rfeof(fp)) + ri->roq_start = fpos = VFS_TELL(fp); + while(fpos+8 <= ri->maxpos) { #if DBUG > 20 Con_Printf("---------------------------------------------------------------------------\n"); #endif - fpos = VFS_TELL(fp); + VFS_SEEK(fp, fpos); + chunk_id = get_word(fp); chunk_size = get_long(fp); - chunk_arg = get_word(fp); - if (chunk_size == -1) //FIXME: THIS SHOULD NOT HAPPEN + /*chunk_arg =*/ get_word(fp); + fpos += 8 + chunk_size; + if (chunk_size == 0xffffffff || fpos > ri->maxpos) //FIXME: THIS SHOULD NOT HAPPEN break; - if(chunk_size > ri->buf_size) + if (chunk_size > ri->buf_size) ri->buf_size = chunk_size; - if(rfeof(fp)) - break; #if DBUG > 20 Con_Printf("%03d 0x%06lx: chunk: 0x%02x size: %ld cells: 2x2=%d,4x4=%d\n", i, fpos, chunk_id, chunk_size, v1>>8,v1&0xff); @@ -122,32 +120,29 @@ int max_frame; return 0; //we have all the data we need now. We always find a sound chunk first, or none at all. #endif } - else - { #ifndef FAST - if(chunk_id == RoQ_QUAD_VQ) + else if(chunk_id == RoQ_QUAD_VQ) + { + ri->num_frames++; + if(ri->num_frames > max_frame) { - ri->num_frames++; - if(ri->num_frames > max_frame) - { - max_frame += 5000; + max_frame += 5000; if((ri->frame_offset = BZ_Realloc(ri->frame_offset, sizeof(long) * max_frame)) == NULL) return 1; } ri->frame_offset[ri->num_frames] = fpos; } + } #endif - if(chunk_id == RoQ_SOUND_MONO || chunk_id == RoQ_SOUND_STEREO) - { - if(chunk_id == RoQ_SOUND_MONO) - ri->audio_channels = 1; - else - ri->audio_channels = 2; + else if(chunk_id == RoQ_SOUND_MONO || chunk_id == RoQ_SOUND_STEREO) + { + if(chunk_id == RoQ_SOUND_MONO) + ri->audio_channels = 1; + else + ri->audio_channels = 2; #ifndef FAST - ri->num_audio_bytes += chunk_size; + ri->num_audio_bytes += chunk_size; #endif - } - VFS_SEEK(fp, VFS_TELL(fp) + chunk_size); } } @@ -403,18 +398,18 @@ unsigned char *tp, *buf; int frame_stats[2][4] = {{0},{0}}; roq_qcell *qcell; - VFS_SEEK(fp, ri->vid_pos); +long fpos = ri->vid_pos; - while(!rfeof(fp)) + VFS_SEEK(fp, fpos); + while(fpos+8 < ri->maxpos) { chunk_id = get_word(fp); chunk_size = get_long(fp); chunk_arg = get_word(fp); - if (chunk_size == 0xffffffff) + fpos += 8+chunk_size; + if (chunk_size == 0xffffffff || fpos > ri->maxpos) return -1; - if(rfeof(fp)) - break; - if(chunk_id == RoQ_QUAD_VQ) + if (chunk_id == RoQ_QUAD_VQ) break; if(chunk_id == RoQ_QUAD_CODEBOOK) { @@ -427,12 +422,12 @@ roq_qcell *qcell; for(j = 0; j < 4; j++) ri->qcells[i].idx[j] = VFS_GETC(fp); } else - VFS_SEEK(fp, VFS_TELL(fp)+chunk_size); + VFS_SEEK(fp, fpos); } if(chunk_id != RoQ_QUAD_VQ) { - ri->vid_pos = VFS_TELL(fp); + ri->vid_pos = fpos; return 0; } @@ -539,7 +534,7 @@ roq_qcell *qcell; Con_Printf("for 04x04 CCC = %d, FCC = %d, MOT = %d, SLD = %d, PAT = 0\n", frame_stats[1][3], frame_stats[1][1], frame_stats[1][0], frame_stats[1][2]); #endif - ri->vid_pos = VFS_TELL(fp); + ri->vid_pos = fpos; if(ri->frame_num == 1) { @@ -574,23 +569,25 @@ unsigned int chunk_id = 0, chunk_arg = 0; unsigned long chunk_size = 0; int i, snd_left, snd_right; - VFS_SEEK(fp, ri->aud_pos); +long fpos; + + fpos = ri->aud_pos; + ri->audio_size = 0; for(;;) { - if(rfeof(fp)) + VFS_SEEK(fp, fpos); + if(fpos >= ri->maxpos) return -1; chunk_id = get_word(fp); chunk_size = get_long(fp); chunk_arg = get_word(fp); - if (chunk_size == 0xffffffff) - return -1; - if(rfeof(fp)) + fpos += 8+chunk_size; + if (chunk_size == 0xffffffff || fpos > ri->maxpos) return -1; if (chunk_id == RoQ_SOUND_MONO || chunk_id == RoQ_SOUND_STEREO) break; - VFS_SEEK(fp, VFS_TELL(fp)+chunk_size); } if(ri->audio_buf_size < chunk_size*2) @@ -614,7 +611,7 @@ int i, snd_left, snd_right; snd_left += (int)ri->snd_sqr_arr[(unsigned)VFS_GETC(fp)]; *(short *)&ri->audio[i * 2] = snd_left; } - ri->aud_pos = VFS_TELL(fp); + ri->aud_pos = fpos; return chunk_size; } @@ -630,13 +627,12 @@ int i, snd_left, snd_right; *(short *)&ri->audio[i * 2] = snd_left; *(short *)&ri->audio[i * 2 + 2] = snd_right; } - ri->aud_pos = VFS_TELL(fp); + ri->aud_pos = fpos; return chunk_size; } - ri->aud_pos = VFS_TELL(fp); + ri->aud_pos = fpos; return 0; } -#undef rfeof #endif diff --git a/engine/client/sbar.c b/engine/client/sbar.c index 63f26a6e5..c0fe8b0f6 100644 --- a/engine/client/sbar.c +++ b/engine/client/sbar.c @@ -2782,7 +2782,7 @@ enum void Sbar_DeathmatchOverlay (int start) { mpic_t *pic; - int i, k, l; + int i, k; int x, y, f; char num[12]; player_info_t *s; @@ -2831,8 +2831,6 @@ void Sbar_DeathmatchOverlay (int start) Sbar_SortFrags(true, true); // draw the text - l = scoreboardlines; - if (start) y = start; else diff --git a/engine/client/snd_alsa.c b/engine/client/snd_alsa.c index a833f9433..fd9afbbde 100755 --- a/engine/client/snd_alsa.c +++ b/engine/client/snd_alsa.c @@ -282,11 +282,13 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum) cvar_t *devname; int err; - int bps, stereo; - unsigned int rate; snd_pcm_hw_params_t *hw; snd_pcm_sw_params_t *sw; +#if 0 + int bps, stereo; + unsigned int rate; snd_pcm_uframes_t frag_size; +#endif qboolean mmap = false; if (!Alsa_InitAlsa()) diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 8dba872a6..3ec313624 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -1443,7 +1443,6 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch) vec_t dist; vec_t scale; vec3_t world_vec; - sfx_t *snd; int i; // anything coming from the view entity will always be full volume @@ -1457,7 +1456,6 @@ void SND_Spatialize(soundcardinfo_t *sc, channel_t *ch) } // calculate stereo seperation and distance attenuation - snd = ch->sfx; VectorSubtract(ch->origin, listener_origin, world_vec); dist = VectorNormalize(world_vec) * ch->dist_mult; @@ -2325,7 +2323,6 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels, soundcardinfo_t *si; int i; int prepadl; - int oldlength; int spare; int outsamples; double speedfactor; @@ -2396,8 +2393,6 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels, speedfactor = (double)speed/snd_speed; outsamples = samples/speedfactor; - oldlength = s->length; - prepadl = 0x7fffffff; for (si = sndcardinfo; si; si=si->next) //make sure all cards are playing, and that we still get a prepad if just one is. { diff --git a/engine/client/snd_ov.c b/engine/client/snd_ov.c index 56d4914dc..686e5da34 100644 --- a/engine/client/snd_ov.c +++ b/engine/client/snd_ov.c @@ -80,14 +80,11 @@ qboolean OV_StartDecode(unsigned char *start, unsigned long length, ovdecoderbuf qboolean S_LoadOVSound (sfx_t *s, qbyte *data, int datalen, int sndspeed) { - char *name; ovdecoderbuffer_t *buffer; if (datalen < 4 || strncmp(data, "OggS", 4)) return false; - name = s->name; - buffer = Z_Malloc(sizeof(ovdecoderbuffer_t)); buffer->decodedbytestart = 0; diff --git a/engine/client/sys_linux.c b/engine/client/sys_linux.c index a56ec821f..9d6718bfa 100644 --- a/engine/client/sys_linux.c +++ b/engine/client/sys_linux.c @@ -65,6 +65,7 @@ int sys_parentwidth; int sys_parentheight; long sys_parentwindow; +qboolean X11_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate); char *basedir = "."; @@ -511,11 +512,10 @@ void *Sys_GetGameAPI(void *parms) char *searchpath; const char *agamename = "gamei386.so"; const char *ggamename = "game.so"; - char *result; void *ret; - result = getcwd(curpath, sizeof(curpath)); // do something with result? + getcwd(curpath, sizeof(curpath)); // do something with result? #ifdef warningmsg #pragma warningmsg("Search for both gamei386.so and game.so") diff --git a/engine/client/sys_sdl.c b/engine/client/sys_sdl.c index 14f1df453..6c142c525 100644 --- a/engine/client/sys_sdl.c +++ b/engine/client/sys_sdl.c @@ -15,6 +15,10 @@ #include #endif +#ifdef FTE_TARGET_WEB +#include +#endif + #ifndef isDedicated qboolean isDedicated; #endif @@ -363,15 +367,13 @@ void *Sys_GetGameAPI (void *parms) Con_DPrintf("Searching for %s\n", gamename); - getcwd(curpath, sizeof(curpath)); - searchpath = 0; while((searchpath = COM_NextPath(searchpath))) { if (searchpath[0] == '/') snprintf(name, sizeof(name), "%s/%s", searchpath, gamename); else - snprintf(name, sizeof(name), "%s/%s/%s", curpath, searchpath, gamename); + snprintf(name, sizeof(name), "./%s/%s", searchpath, gamename); q2gamedll = Sys_LoadLibrary(name, funcs); if (q2gamedll && gamename) diff --git a/engine/client/view.c b/engine/client/view.c index 441abfe6e..bc752733e 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -1427,14 +1427,10 @@ void V_RenderPlayerViews(int plnum) } if (e) { - float s; memcpy(r_refdef.viewangles, e->angles, sizeof(vec3_t)); memcpy(r_refdef.vieworg, e->origin, sizeof(vec3_t)); -// cl.viewentity = cl.viewentity2; +// cl.viewentity = cl.viewentity2; -// s = (realtime - e->lerptime)*10; -// if (s > 1) s=1; - s=0; r_refdef.vieworg[0]=r_refdef.vieworg[0];//*s+(1-s)*e->lerporigin[0]; r_refdef.vieworg[1]=r_refdef.vieworg[1];//*s+(1-s)*e->lerporigin[1]; r_refdef.vieworg[2]=r_refdef.vieworg[2];//*s+(1-s)*e->lerporigin[2]; diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 3087251a1..6ada1dae9 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -1103,7 +1103,7 @@ char *Cmd_ExpandCvar(char *cvarname, int maxaccesslevel, int *len) char *fixup = NULL, fixval=0; cvar_t *var; static char temp[12]; - size_t result; + unsigned int result; namestart = cvarname; if (*cvarname == '{') @@ -1121,11 +1121,10 @@ char *Cmd_ExpandCvar(char *cvarname, int maxaccesslevel, int *len) fixval = *fixup; } - result = strtol(cvarname, &end, 10); // do something with result - - if (fixval && *end == '\0') //only expand $0 if its actually ${0} - this avoids conflicting with the $0 macro + result = strtoul(cvarname, &end, 10); + if (fixval && *end == 0) //only expand $0 if its actually ${0} - this avoids conflicting with the $0 macro { //purely numerical - ret = Cmd_Argv(atoi(cvarname)); + ret = Cmd_Argv(result); } else if (!strcmp(cvarname, "*") || !stricmp(cvarname, "cmd_args")) { diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 0fd470426..2390e2ba2 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -791,7 +791,6 @@ int Alias_GetBoneRelations(galiasinfo_t *inf, framestate_t *fstate, float *resul #ifdef SKELETALMODELS if (inf->numbones) { - galiasbone_t *bone; galiasgroup_t *g1, *g2; float *matrix; //the matrix for a single bone in a single pose. @@ -858,7 +857,6 @@ int Alias_GetBoneRelations(galiasinfo_t *inf, framestate_t *fstate, float *resul } } - bone = (galiasbone_t*)((char*)inf + inf->ofsbones); //the higher level merges old/new anims, but we still need to blend between automated frame-groups. g1 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame1); g2 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame2); @@ -1288,12 +1286,11 @@ static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float p1t = (vec3_t *)((char *)p1 + p1->ofstvector); p2t = (vec3_t *)((char *)p2 + p2->ofstvector); - mesh->normals_array = p1n; - mesh->snormals_array = p1s; - mesh->tnormals_array = p1t; - mesh->colors4f_array = NULL; + mesh->snormals_array = blerp>0.5?p2s:p1s; //never lerp + mesh->tnormals_array = blerp>0.5?p2t:p1t; //never lerp + mesh->colors4f_array = NULL; //not generated - if (p1v == p2v || r_nolerp.value) + if (p1v == p2v || r_nolerp.value || !blerp) { mesh->normals_array = p1n; mesh->snormals_array = p1s; @@ -1463,7 +1460,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in int frame2; float lerp; float fg1time; - float fg2time; +// float fg2time; if (!inf->groups) { @@ -1618,7 +1615,7 @@ qboolean Alias_GAliasBuildMesh(mesh_t *mesh, vbo_t **vbop, galiasinfo_t *inf, in frame2 = e->framestate.g[FS_REG].frame[1]; lerp = e->framestate.g[FS_REG].lerpfrac; fg1time = e->framestate.g[FS_REG].frametime[0]; - fg2time = e->framestate.g[FS_REG].frametime[1]; + //fg2time = e->framestate.g[FS_REG].frametime[1]; if (frame1 < 0) { @@ -3714,13 +3711,13 @@ qboolean Mod_GetTag(model_t *model, int tagnum, framestate_t *fstate, float *res md3tag_t *t1, *t2; int frame1, frame2; - float f1time, f2time; + //float f1time, f2time; //tags/md3s don't support framegroups. float f2ness; frame1 = fstate->g[FS_REG].frame[0]; frame2 = fstate->g[FS_REG].frame[1]; - f1time = fstate->g[FS_REG].frametime[0]; - f2time = fstate->g[FS_REG].frametime[1]; + //f1time = fstate->g[FS_REG].frametime[0]; + //f2time = fstate->g[FS_REG].frametime[1]; f2ness = fstate->g[FS_REG].lerpfrac; if (tagnum <= 0 || tagnum > inf->numtags) diff --git a/engine/common/com_phys_ode.c b/engine/common/com_phys_ode.c index 30755f7a8..052981134 100644 --- a/engine/common/com_phys_ode.c +++ b/engine/common/com_phys_ode.c @@ -1678,7 +1678,6 @@ static qboolean GenerateCollisionMesh(world_t *world, model_t *mod, wedict_t *ed mesh_t *mesh; unsigned int numverts; unsigned int numindexes,i; - unsigned int ni; numverts = 0; numindexes = 0; @@ -1708,8 +1707,6 @@ static qboolean GenerateCollisionMesh(world_t *world, model_t *mod, wedict_t *ed ed->ode.ode_element3i = BZ_Malloc(numindexes*sizeof(*ed->ode.ode_element3i)); ed->ode.ode_vertex3f = BZ_Malloc(numverts*sizeof(vec3_t)); - ni = numindexes; - numverts = 0; numindexes = 0; for (sno = 0; sno < mod->nummodelsurfaces; sno++) diff --git a/engine/common/common.c b/engine/common/common.c index 48c36cd51..fdaadbd6e 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" +#include #include #include diff --git a/engine/common/common.h b/engine/common/common.h index af7390ce9..22bfa87a8 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -355,6 +355,7 @@ char *FS_WhichPackForLocation(flocation_t *loc); qboolean FS_GetPackageDownloadable(const char *package); char *FS_GetPackHashes(char *buffer, int buffersize, qboolean referencedonly); char *FS_GetPackNames(char *buffer, int buffersize, int referencedonly, qboolean ext); +void FS_GenCachedPakName(char *pname, char *crc, char *local, int llen); void FS_ReferenceControl(unsigned int refflag, unsigned int resetflags); FTE_DEPRECATED int COM_FOpenFile (const char *filename, FILE **file); diff --git a/engine/common/fs.c b/engine/common/fs.c index eddffeca4..0f7d9d941 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -1382,7 +1382,7 @@ typedef struct { const char *puredesc; } wildpaks_t; -static int QDECL FS_AddWildDataFiles (const char *descriptor, int size, void *vparam, struct searchpath_s *path) +static int QDECL FS_AddWildDataFiles (const char *descriptor, int size, void *vparam, void *path) { wildpaks_t *param = vparam; vfsfile_t *vfs; @@ -1611,7 +1611,7 @@ char *COM_NextPath (char *prevpath) return NULL; } -#ifndef CLIENTONLY +#if 0//ndef CLIENTONLY char *COM_GetPathInfo (int i, int *crc) { //#ifdef WEBSERVER @@ -1703,7 +1703,6 @@ void COM_Gamedir (const char *dir) { char thispath[64]; searchpath_t *next; - int dlen; qboolean isbase; if (!*dir || !strcmp(dir, ".") || strstr(dir, "..") || strstr(dir, "/") @@ -1714,7 +1713,6 @@ void COM_Gamedir (const char *dir) } isbase = false; - dlen = strlen(dir); for (next = com_searchpaths; next; next = next->next) { if (next == com_base_searchpaths) @@ -1992,7 +1990,6 @@ void FS_ImpurePacks(const char *names, const char *crcs) { char local[MAX_OSPATH]; vfsfile_t *vfs; - char *ext = COM_FileExtension(pname); FS_GenCachedPakName(pname, va("%i", crc), local, sizeof(local)); vfs = FS_OpenVFS(local, "rb", FS_ROOT); diff --git a/engine/common/fs_pak.c b/engine/common/fs_pak.c index 70572d5b5..1fe8016f5 100644 --- a/engine/common/fs_pak.c +++ b/engine/common/fs_pak.c @@ -90,7 +90,7 @@ void QDECL FSPAK_BuildHash(void *handle, int depth, void (QDECL *AddFileHash)(in qboolean QDECL FSPAK_FLocate(void *handle, flocation_t *loc, const char *filename, void *hashedresult) { mpackfile_t *pf = hashedresult; - int i, len; + int i; pack_t *pak = handle; // look through all the pak file elements @@ -114,7 +114,6 @@ qboolean QDECL FSPAK_FLocate(void *handle, flocation_t *loc, const char *filenam if (pf) { - len = pf->filelen; if (loc) { loc->index = pf - pak->files; @@ -199,8 +198,8 @@ void *QDECL FSPAK_LoadPackFile (vfsfile_t *file, const char *desc) if (packhandle == NULL) return NULL; - VFS_READ(packhandle, &header, sizeof(header)); - if (header.id[0] != 'P' || header.id[1] != 'A' + read = VFS_READ(packhandle, &header, sizeof(header)); + if (read < sizeof(header) || header.id[0] != 'P' || header.id[1] != 'A' || header.id[2] != 'C' || header.id[3] != 'K') { Con_Printf("%s is not a pak - %c%c%c%c\n", desc, header.id[0], header.id[1], header.id[2], header.id[3]); @@ -234,6 +233,12 @@ void *QDECL FSPAK_LoadPackFile (vfsfile_t *file, const char *desc) { *info.name = '\0'; read = VFS_READ(packhandle, &info, sizeof(info)); + if (read != sizeof(info)) + { + Con_Printf("PAK file table truncated, only found %i files out of %i\n", i, numpackfiles); + numpackfiles = i; + break; + } /* for (j=0 ; jfilelen; if (loc) { loc->index = pf - zip->files; diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index ea7f062a5..276bf91c9 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -635,7 +635,7 @@ static void SnapPlane( vec3_t normal, vec_t *dist ) */ static int CM_CreateFacetFromPoints(q2cbrush_t *facet, vec3_t *verts, int numverts, q2mapsurface_t *shaderref, mplane_t *brushplanes ) { - int i, j, k; + int i, j; int axis, dir; vec3_t normal, mins, maxs; float d, dist; @@ -721,7 +721,7 @@ static int CM_CreateFacetFromPoints(q2cbrush_t *facet, vec3_t *verts, int numver for( i = 0; i < numverts; i++ ) { j = ( i + 1 ) % numverts; - k = ( i + 2 ) % numverts; +// k = ( i + 2 ) % numverts; VectorSubtract( verts[i], verts[j], vec ); if( VectorNormalize( vec ) < 0.5 ) diff --git a/engine/common/huff.c b/engine/common/huff.c index b49c7122d..85c7db6ee 100644 --- a/engine/common/huff.c +++ b/engine/common/huff.c @@ -26,8 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef HUFFNETWORK #define ID_INLINE -#define VALUE(a) (*(int *)&(a)) -#define NODE(a) ((void*)(a)) +#define VALUE(a) (*(size_t *)&(a)) +#define NODE(a) ((void*)((size_t)a)) #define NODE_START NODE( 1) #define NODE_NONE NODE(256) diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 9aece7ebf..19e5f65aa 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -439,7 +439,7 @@ nqprot_t NQNetChan_Process(netchan_t *chan) drop = sequence - chan->incoming_unreliable - 1; if (drop > 0) { - Con_DPrintf("Dropped %i datagrams (%i - %i)\n", chan->incoming_unreliable+1, sequence-1); + Con_DPrintf("Dropped %i datagrams (%i - %i)\n", drop, chan->incoming_unreliable+1, sequence-1); chan->drop_count += drop; } chan->incoming_unreliable = sequence; @@ -778,9 +778,6 @@ qboolean Netchan_Process (netchan_t *chan) unsigned sequence, sequence_ack; unsigned reliable_ack, reliable_message; char adr[MAX_ADR_SIZE]; -#ifndef CLIENTONLY - int qport; -#endif int offset; if ( @@ -797,10 +794,10 @@ qboolean Netchan_Process (netchan_t *chan) sequence = MSG_ReadLong (); sequence_ack = MSG_ReadLong (); - // read the qport if we are a server + // skip over the qport if we are a server (its handled elsewhere) #ifndef CLIENTONLY if (chan->sock == NS_SERVER) - qport = MSG_ReadShort (); + MSG_ReadShort (); #endif if (chan->fragmentsize) diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 66dd45dd0..9e91398af 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -763,7 +763,11 @@ qboolean NET_StringToSockaddr (const char *s, int defaultport, struct sockaddr_q else #endif #ifdef IPPROTO_IPV6 +#ifdef pgetaddrinfo + if (1) +#else if (pgetaddrinfo) +#endif { struct addrinfo *addrinfo = NULL; struct addrinfo *pos; @@ -1120,6 +1124,7 @@ void NET_IntegerToMask (netadr_t *a, netadr_t *amask, int bits) case NA_LOOPBACK: break; // warning: enumeration value âNA_*â not handled in switch + case NA_NATPMP: case NA_WEBSOCKET: case NA_TCP: case NA_TCPV6: @@ -1649,8 +1654,12 @@ static ftenet_generic_connection_t *FTENET_UDP4_EstablishConnection(qboolean iss static ftenet_generic_connection_t *FTENET_UDP6_EstablishConnection(qboolean isserver, const char *address); static ftenet_generic_connection_t *FTENET_TCP4Connect_EstablishConnection(qboolean isserver, const char *address); static ftenet_generic_connection_t *FTENET_TCP6Connect_EstablishConnection(qboolean isserver, const char *address); +#ifdef USEIPX static ftenet_generic_connection_t *FTENET_IPX_EstablishConnection(qboolean isserver, const char *address); +#endif +#ifdef HAVE_WEBSOCKCL static ftenet_generic_connection_t *FTENET_WebSocket_EstablishConnection(qboolean isserver, const char *address); +#endif static ftenet_generic_connection_t *FTENET_IRCConnect_EstablishConnection(qboolean isserver, const char *address); static ftenet_generic_connection_t *FTENET_NATPMP_EstablishConnection(qboolean isserver, const char *address); @@ -2017,8 +2026,10 @@ int FTENET_Generic_GetLocalAddress(ftenet_generic_connection_t *con, netadr_t *o struct sockaddr_qstorage from; int fromsize = sizeof(from); netadr_t adr; +#ifdef USE_GETHOSTNAME_LOCALLISTING char adrs[MAX_ADR_SIZE]; int b; +#endif int idx = 0; if (getsockname (con->thesocket, (struct sockaddr*)&from, &fromsize) != -1) @@ -2370,9 +2381,9 @@ ftenet_generic_connection_t *FTENET_Generic_EstablishConnection(int adrfamily, i { if (0 == setsockopt(newsocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&_false, sizeof(_false))) { - int ip = ((struct sockaddr_in*)&qs)->sin_addr.s_addr; +// int ip = ((struct sockaddr_in*)&qs)->sin_addr.s_addr; int port = ((struct sockaddr_in*)&qs)->sin_port; - ip = ((struct sockaddr_in*)&qs)->sin_addr.s_addr; +// ip = ((struct sockaddr_in*)&qs)->sin_addr.s_addr; memset(&qs, 0, sizeof(struct sockaddr_in6)); ((struct sockaddr_in6*)&qs)->sin6_family = AF_INET6; /* @@ -2783,7 +2794,7 @@ closesvstream: { if (atoi(arg[WCATTR_WSVER]) != 13) { - Con_Printf("Outdated websocket request from %s. got version %i, expected version 13\n", arg[WCATTR_URL], NET_AdrToString (adr, sizeof(adr), &st->remoteaddr), arg[WCATTR_WSVER]); + Con_Printf("Outdated websocket request for \"%s\" from \"%s\". got version %i, expected version 13\n", arg[WCATTR_URL], NET_AdrToString (adr, sizeof(adr), &st->remoteaddr), atoi(arg[WCATTR_WSVER])); memmove(st->inbuffer, st->inbuffer+i, st->inlen - (i)); st->inlen -= i; @@ -5138,7 +5149,6 @@ void SVNET_RegisterCvars(void) p = COM_CheckParm ("-svport"); if (p && p < com_argc) { - extern cvar_t sv_port_ipv4, sv_port_ipv6, sv_port_ipx; int port = atoi(com_argv[p+1]); if (!port) port = PORT_QWSERVER; @@ -5167,16 +5177,13 @@ void NET_CloseServer(void) void NET_InitServer(void) { - char *port; - port = STRINGIFY(PORT_QWSERVER); - if (sv_listen_nq.value || sv_listen_dp.value || sv_listen_qw.value || sv_listen_q3.value) { if (!svs.sockets) { svs.sockets = FTENET_CreateCollection(true); #ifndef SERVERONLY - FTENET_AddToCollection(svs.sockets, "SVLoopback", port, NA_LOOPBACK, true); + FTENET_AddToCollection(svs.sockets, "SVLoopback", STRINGIFY(PORT_QWSERVER), NA_LOOPBACK, true); #endif } @@ -5207,7 +5214,7 @@ void NET_InitServer(void) #ifndef SERVERONLY svs.sockets = FTENET_CreateCollection(true); - FTENET_AddToCollection(svs.sockets, "SVLoopback", port, NA_LOOPBACK, true); + FTENET_AddToCollection(svs.sockets, "SVLoopback", STRINGIFY(PORT_QWSERVER), NA_LOOPBACK, true); #endif } @@ -5285,7 +5292,7 @@ int QDECL VFSTCP_ReadBytes (struct vfsfile_s *file, void *buffer, int bytestorea switch(e) { case ECONNABORTED: - Sys_Printf("conenction aborted\n", e); + Sys_Printf("conenction aborted\n"); break; default: Sys_Printf("socket error %i\n", e); diff --git a/engine/common/plugin.c b/engine/common/plugin.c index 0a1c739f3..1634744fc 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -348,7 +348,7 @@ plugin_t *Plug_Load(char *file) return newplug; } -static int QDECL Plug_Emumerated (const char *name, int size, void *param, struct searchpath_s *spath) +static int QDECL Plug_Emumerated (const char *name, int size, void *param, void *spath) { char vmname[MAX_QPATH]; Q_strncpyz(vmname, name, sizeof(vmname)); @@ -358,7 +358,7 @@ static int QDECL Plug_Emumerated (const char *name, int size, void *param, struc return true; } -static int QDECL Plug_EnumeratedRoot (const char *name, int size, void *param, struct searchpath_s *spath) +static int QDECL Plug_EnumeratedRoot (const char *name, int size, void *param, void *spath) { char vmname[MAX_QPATH]; int len; @@ -560,7 +560,7 @@ static qintptr_t VARGS Plug_Cvar_Register(void *offset, quintptr_t mask, const q static qintptr_t VARGS Plug_Cvar_Update(void *offset, quintptr_t mask, const qintptr_t *arg) { int handle; - int modcount; +// int modcount; char *stringv; //255 bytes long. float *floatv; cvar_t *var; @@ -573,16 +573,17 @@ static qintptr_t VARGS Plug_Cvar_Update(void *offset, quintptr_t mask, const qin if (VM_OOB(arg[2], 256) || VM_OOB(arg[3], 4)) //Oi, plugin - you screwed up return 0; - modcount = VM_LONG(arg[1]); + //modcount = VM_LONG(arg[1]); //for future optimisation stringv = VM_POINTER(arg[2]); floatv = VM_POINTER(arg[3]); var = plugincvararray[handle].var; - - strcpy(stringv, var->string); - *floatv = var->value; - + //if (var->modified != modcount) //for future optimisation + { + strcpy(stringv, var->string); + *floatv = var->value; + } return var->modified; } diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index a4473eea8..06a245266 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -260,14 +260,13 @@ void QCBUILTIN PF_getsurfacepoint(pubprogfuncs_t *prinst, struct globalvars_s *p // #436 vector(entity e, float s) getsurfacenormal (DP_QC_GETSURFACE) void QCBUILTIN PF_getsurfacenormal(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { - unsigned int surfnum, pointnum; + unsigned int surfnum; model_t *model; wedict_t *ent; world_t *w = prinst->parms->user; ent = G_WEDICT(prinst, OFS_PARM0); surfnum = G_FLOAT(OFS_PARM1); - pointnum = G_FLOAT(OFS_PARM2); model = w->Get_CModel(w, ent->v->modelindex); @@ -1111,7 +1110,6 @@ static void PF_hash_destroytab_enum(void *ctx, void *ent) void QCBUILTIN PF_hash_destroytab (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { int tab = G_FLOAT(OFS_PARM0) - FIRST_QC_HASHTABLE_INDEX; - pf_hashentry_t *ent = NULL; if (tab >= 0 && tab < MAX_QC_HASHTABLES && pf_hashtab[tab].prinst) { pf_hashtab[tab].prinst = NULL; @@ -1588,7 +1586,7 @@ void search_close_progs(pubprogfuncs_t *prinst, qboolean complain) prvm_nextsearchhandle = 0; //might as well. } -int QDECL search_enumerate(const char *name, int fsize, void *parm, struct searchpath_s *spath) +int QDECL search_enumerate(const char *name, int fsize, void *parm, void *spath) { prvmsearch_t *s = parm; @@ -3534,10 +3532,10 @@ void QCBUILTIN PF_Abort(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) //used for entity function variables - not actually needed anymore void QCBUILTIN PF_externrefcall (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { - int progsnum; +// int progsnum; func_t f; int i; - progsnum = G_PROG(OFS_PARM0); +// progsnum = G_PROG(OFS_PARM0); f = G_INT(OFS_PARM1); for (i = OFS_PARM0; i < OFS_PARM5; i+=3) diff --git a/engine/common/protocol.h b/engine/common/protocol.h index dbc96323c..131671473 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -344,8 +344,11 @@ enum clcq2_ops_e clcq2_bad, clcq2_nop, clcq2_move, // [[usercmd_t] - clcq2_userinfo, // [[userinfo string] - clcq2_stringcmd // [string] message + clcq2_userinfo, // [[userinfo string] + clcq2_stringcmd, // [string] message + + //fte-extended + clcq2_voicechat }; diff --git a/engine/common/q3common.c b/engine/common/q3common.c index bc0171638..df8a76aee 100644 --- a/engine/common/q3common.c +++ b/engine/common/q3common.c @@ -414,13 +414,14 @@ MSG_WriteHuffBits */ static void MSG_WriteHuffBits( sizebuf_t *msg, int value, int bits ) { - int startbits; +#ifdef MSG_PROFILING + int startbits = msg->currentbit; +#endif int remaining; int i; value &= 0xFFFFFFFFU >> (32 - bits); remaining = bits & 7; - startbits = msg->currentbit; for( i=0; inext) { cacheused += cs->size; @@ -1776,6 +1769,8 @@ void Hunk_Print_f (void) #if 0 { zone_t *zone; + int zoneused = 0; + int zoneblocks = 0; for(zone = zone_head; zone; zone=zone->next) { diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 3797ad673..df0507599 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -951,14 +951,14 @@ void R_GAlias_DrawBatch(batch_t *batch) static mesh_t mesh; static mesh_t *meshl = &mesh; - qboolean needrecolour; - qboolean nolightdir; +// qboolean needrecolour; +// qboolean nolightdir; e = batch->ent; clmodel = e->model; currententity = e; - nolightdir = R_CalcModelLighting(e, clmodel); + /*nolightdir =*/ R_CalcModelLighting(e, clmodel); inf = RMod_Extradata (clmodel); if (inf) @@ -968,7 +968,7 @@ void R_GAlias_DrawBatch(batch_t *batch) { if (batch->surf_first == surfnum) { - needrecolour = Alias_GAliasBuildMesh(&mesh, &batch->vbo, inf, surfnum, e, batch->shader->prog && batch->shader->prog->permu[PERMUTATION_SKELETAL].handle.glsl); + /*needrecolour =*/ Alias_GAliasBuildMesh(&mesh, &batch->vbo, inf, surfnum, e, batch->shader->prog && batch->shader->prog->permu[PERMUTATION_SKELETAL].handle.glsl); batch->mesh = &meshl; return; } diff --git a/engine/gl/gl_font.c b/engine/gl/gl_font.c index 576aad7e1..8990e95ad 100644 --- a/engine/gl/gl_font.c +++ b/engine/gl/gl_font.c @@ -26,6 +26,7 @@ void Font_EndString(struct font_s *font); int Font_LineBreaks(conchar_t *start, conchar_t *end, int maxpixelwidth, int maxlines, conchar_t **starts, conchar_t **ends); struct font_s *font_conchar; struct font_s *font_tiny; +extern int r2d_be_flags; #ifdef AVAIL_FREETYPE #include @@ -312,10 +313,10 @@ static void Font_Flush(void) font_backmesh.numvertexes = font_foremesh.numvertexes; font_backmesh.istrifan = font_foremesh.istrifan; - BE_DrawMesh_Single(fontplanes.backshader, &font_backmesh, NULL, &fontplanes.backshader->defaulttextures, 0); + BE_DrawMesh_Single(fontplanes.backshader, &font_backmesh, NULL, &fontplanes.backshader->defaulttextures, r2d_be_flags); } TEXASSIGN(fontplanes.shader->defaulttextures.base, font_texture); - BE_DrawMesh_Single(fontplanes.shader, &font_foremesh, NULL, &fontplanes.shader->defaulttextures, 0); + BE_DrawMesh_Single(fontplanes.shader, &font_foremesh, NULL, &fontplanes.shader->defaulttextures, r2d_be_flags); font_foremesh.numindexes = 0; font_foremesh.numvertexes = 0; } diff --git a/engine/gl/gl_heightmap.c b/engine/gl/gl_heightmap.c index 02924dd0a..12b8535e1 100644 --- a/engine/gl/gl_heightmap.c +++ b/engine/gl/gl_heightmap.c @@ -175,7 +175,9 @@ typedef struct heightmap_s } heightmap_t; +#ifndef SERVERONLY static void ted_dorelight(heightmap_t *hm); +#endif static qboolean Terr_Collect(heightmap_t *hm); @@ -342,7 +344,7 @@ static qboolean Terr_IsSectionFName(heightmap_t *hm, char *fname, int *sx, int * return false; return true; } -static hmsection_t *Terr_ReadSection(heightmap_t *hm, hmsection_t *s, int sx, int sy, dsection_t *ds, unsigned int dslen) +static hmsection_t *Terr_ReadSection(heightmap_t *hm, hmsection_t *s, int sx, int sy, void *filebase, unsigned int filelen) { int i, j; #ifndef SERVERONLY @@ -350,10 +352,12 @@ static hmsection_t *Terr_ReadSection(heightmap_t *hm, hmsection_t *s, int sx, in unsigned char *lm; float *colours; #endif - void *ptr; + void *ptr = filebase; + dsection_t *ds = NULL; - if (ds) + if (ptr) { + ds = ptr; if (ds->magic != SECTION_MAGIC) return NULL; if (ds->ver != SECTION_VER) @@ -362,6 +366,8 @@ static hmsection_t *Terr_ReadSection(heightmap_t *hm, hmsection_t *s, int sx, in ds = NULL; } } + else + filelen = 0; if (!s) { @@ -391,8 +397,9 @@ static hmsection_t *Terr_ReadSection(heightmap_t *hm, hmsection_t *s, int sx, in Terr_InitLightmap(s); #endif - if (ds) + if (ptr) { + ds = ptr; s->flags = ds->flags | TSF_DIRTY; /*load the heights*/ @@ -889,7 +896,6 @@ qboolean Terrain_LocateSection(char *name, flocation_t *loc) heightmap_t *hm; hmsection_t *s; int x, y; - int nlen = strlen(name); //reject if its not in maps if (strncmp(name, "maps/", 5)) @@ -3291,8 +3297,6 @@ qboolean Terr_LoadTerrainModel (model_t *mod, void *buffer) { heightmap_t *hm; - float skyrotate; - vec3_t skyaxis; char shadername[MAX_QPATH]; char skyname[MAX_QPATH]; int sectsize = 0; @@ -3301,11 +3305,6 @@ qboolean Terr_LoadTerrainModel (model_t *mod, void *buffer) strcpy(shadername, "terrainshader"); strcpy(skyname, "night"); - skyrotate = 0; - skyaxis[0] = 0; - skyaxis[1] = 0; - skyaxis[2] = 0; - buffer = COM_Parse(buffer); if (strcmp(com_token, "terrain")) { @@ -3402,7 +3401,8 @@ void Mod_Terrain_Create_f(void) mdata = va( "terrain\n" "{\n" - "classname worldspawn\n" + "classname \"worldspawn\"\n" + "message \"%s\"\n" "_segmentsize 1024\n" "_minxsegment -2048\n" "_minysegment -2048\n" @@ -3415,7 +3415,7 @@ void Mod_Terrain_Create_f(void) "classname info_player_start\n" "origin \"0 0 1024\"\n" "}\n" - , mname); + , Cmd_Argv(2)); COM_WriteFile(mname, mdata, strlen(mdata)); } void Mod_Terrain_Reload_f(void) diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index b4cfb7f3e..3e4483da3 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -4483,7 +4483,7 @@ qboolean RMod_LoadSpriteModel (model_t *mod, void *buffer) int numframes; int size; dspriteframetype_t *pframetype; - int rendertype=0; +// int rendertype=0; unsigned char pal[256*4]; int sptype; int hunkstart; @@ -4506,7 +4506,7 @@ qboolean RMod_LoadSpriteModel (model_t *mod, void *buffer) if (LittleLong(pin->version) == SPRITEHL_VERSION) { pin = (dsprite_t*)((char*)pin + 4); - rendertype = LittleLong (pin->type); + /*rendertype =*/ LittleLong (pin->type); //not sure what the values mean. } numframes = LittleLong (pin->numframes); diff --git a/engine/gl/gl_rlight.c b/engine/gl/gl_rlight.c index ea22bb925..eb3fafe67 100644 --- a/engine/gl/gl_rlight.c +++ b/engine/gl/gl_rlight.c @@ -460,7 +460,7 @@ void R_ImportRTLights(char *entlump) typedef enum lighttype_e {LIGHTTYPE_MINUSX, LIGHTTYPE_RECIPX, LIGHTTYPE_RECIPXX, LIGHTTYPE_NONE, LIGHTTYPE_SUN, LIGHTTYPE_MINUSXX} lighttype_t; /*I'm using the DP code so I know I'll get the DP results*/ - int entnum, style, islight, skin, pflags, effects, n; + int entnum, style, islight, skin, pflags, n; lighttype_t type; float origin[3], angles[3], radius, color[3], light[4], fadescale, lightscale, originhack[3], overridecolor[3], vec[4]; char key[256], value[8192]; @@ -491,7 +491,7 @@ void R_ImportRTLights(char *entlump) style = 0; skin = 0; pflags = 0; - effects = 0; + //effects = 0; islight = false; nest = 1; while (1) @@ -633,8 +633,8 @@ void R_ImportRTLights(char *entlump) skin = (int)atof(value); else if (!strcmp("pflags", key)) pflags = (int)atof(value); - else if (!strcmp("effects", key)) - effects = (int)atof(value); + //else if (!strcmp("effects", key)) + //effects = (int)atof(value); else if (!strcmp("scale", key)) lightscale = atof(value); @@ -703,8 +703,8 @@ void R_ImportRTLights(char *entlump) dl->lightcolourscales[0] = r_editlights_import_ambient.value; dl->lightcolourscales[1] = r_editlights_import_diffuse.value; dl->lightcolourscales[2] = r_editlights_import_specular.value; - - //FIXME: cubemaps if skin >= 16 + if (skin >= 16) + snprintf(dl->cubemapname, sizeof(dl->cubemapname), "cubemaps/%i", skin); } } } diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index ecaed0bf5..5c40c34e5 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -367,7 +367,6 @@ R_SetupGL */ void R_SetupGL (float stereooffset) { - float screenaspect; int x, x2, y2, y, w, h; vec3_t newa; @@ -424,7 +423,6 @@ void R_SetupGL (float stereooffset) fov_y *= 1 + (((sin(cl.time * 3.0) + 1) * 0.015) * r_waterwarp.value); } - screenaspect = (float)r_refdef.vrect.width/r_refdef.vrect.height; if (r_refdef.useperspective) { int stencilshadows = 0; diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 881f91bdf..9fbcafc03 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -176,7 +176,7 @@ static float Shader_FloatArgument(shader_t *shader, char *arg) //grab an argument instead, otherwise 0 var = shader->name; - while(var = strchr(var, '#')) + while((var = strchr(var, '#'))) { if (!strnicmp(var, arg, arglen)) { diff --git a/engine/gl/gl_shadow.c b/engine/gl/gl_shadow.c index e37427cb5..1e86d0e58 100644 --- a/engine/gl/gl_shadow.c +++ b/engine/gl/gl_shadow.c @@ -1943,7 +1943,7 @@ void GL_EndRenderBuffer_DepthOnly(texid_t depthtexture, int texsize) static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, int smsize, float proj[16]) { qboolean oxv; - vec3_t t1,t2, t3; + vec3_t t1,t2; texture_t *tex; int tno; @@ -1972,8 +1972,8 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, int sms case 3: //-x - back VectorNegate(l->axis[0], t1); - VectorNegate(l->axis[1], t2); - VectorNegate(l->axis[2], t3); +// VectorNegate(l->axis[1], t2); +// VectorNegate(l->axis[2], t3); Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, t1, l->axis[1], l->axis[2], l->origin); r_refdef.flipcull = true; break; @@ -2182,7 +2182,6 @@ void Sh_GenShadowMap (dlight_t *l, qbyte *lvis) static void Sh_DrawShadowMapLight(dlight_t *l, vec3_t colour, qbyte *vvis) { - int ve; vec3_t mins, maxs; qbyte *lvis; qbyte lvisb[MAX_MAP_LEAFS/8]; @@ -2244,8 +2243,6 @@ static void Sh_DrawShadowMapLight(dlight_t *l, vec3_t colour, qbyte *vvis) //may as well use scissors Sh_Scissor(rect); - ve = 0; - BE_SelectEntity(&r_worldentity); GLBE_SelectDLight(l, colour); diff --git a/engine/gl/ltface.c b/engine/gl/ltface.c index 274019b97..009bb8b70 100644 --- a/engine/gl/ltface.c +++ b/engine/gl/ltface.c @@ -459,7 +459,7 @@ For each texture aligned grid point, back project onto the plane to get the world xyz value of the sample point ================= */ -int c_bad; +static int c_bad; static void LightCalcPoints (llightinfo_t *l) { int i; @@ -754,15 +754,16 @@ void LightFace (int surfnum) int i,j,c,ch; vec_t total, mean; int size; - int lightmapwidth, lightmapsize; + int lightmapwidth; #ifdef UTILITY + int lightmapsize; byte *out; #endif byte *rgbout; byte *dulout; vec3_t *light, *norm; vec3_t wnorm, temp, svector, tvector; - int w, h; + int w; f = dfaces + surfnum; @@ -852,12 +853,12 @@ void LightFace (int surfnum) for (i=0 ; i styles[i] = l.lightstyles[i]; - lightmapsize = size*l.numlightstyles; #ifdef UTILITY + lightmapsize = size*l.numlightstyles; if (runningrgblightdatabase) { - out = GetFakeFileSpace(&f->lightofs, size); + out = GetFakeFileSpace(&f->lightofs, lightmapsize); rgbout = runningrgblightdatabase + f->lightofs*3; dulout = runninglightnormbase + f->lightofs*3; } @@ -886,7 +887,7 @@ void LightFace (int surfnum) // extra filtering - h = (l.texsize[1]+1)*2; +// h = (l.texsize[1]+1)*2; w = (l.texsize[0]+1)*2; for (i=0 ; i< l.numlightstyles ; i++) diff --git a/engine/http/ftpserver.c b/engine/http/ftpserver.c index 79d2d0e78..e6ed08935 100644 --- a/engine/http/ftpserver.c +++ b/engine/http/ftpserver.c @@ -134,7 +134,7 @@ void FTP_ServerShutdown(void) } //we ought to filter this to remove duplicates. -static int QDECL SendFileNameTo(const char *rawname, int size, void *param, struct searchpath_s *spath) +static int QDECL SendFileNameTo(const char *rawname, int size, void *param, void *spath) { int socket = *(int*)param; // int i; diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index 764b9997e..6977877e6 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -308,7 +308,7 @@ static void PDECL PR_memfree (pubprogfuncs_t *ppf, void *memptr) printf("PF_memfree: unable to free the non-null empty string constant at %x\n", ptr); } else - printf("PF_memfree: pointer invalid - out of range (%x >= %x)\n", ptr, prinst.addressableused); + printf("PF_memfree: pointer invalid - out of range (%x >= %x)\n", ptr, (unsigned int)prinst.addressableused); PR_StackTrace(&progfuncs->funcs); return; } diff --git a/engine/qclib/pr_multi.c b/engine/qclib/pr_multi.c index 16938857b..dd36390de 100644 --- a/engine/qclib/pr_multi.c +++ b/engine/qclib/pr_multi.c @@ -375,8 +375,6 @@ void PDECL QC_AddSharedFieldVar(pubprogfuncs_t *ppf, int num, char *stringtable) // int pnum; unsigned int i, o; - char *s; - //look for an existing match not needed, cos we look a little later too. /* for (i = 0; i < numfields; i++) @@ -407,8 +405,6 @@ void PDECL QC_AddSharedFieldVar(pubprogfuncs_t *ppf, int num, char *stringtable) } } - s = pr_globaldefs16[num].s_name+stringtable; - for (i = 0; i < prinst.numfields; i++) { o = prinst.field[i].progsofs; @@ -436,8 +432,6 @@ void PDECL QC_AddSharedFieldVar(pubprogfuncs_t *ppf, int num, char *stringtable) } } - s = pr_globaldefs32[num].s_name+stringtable; - for (i = 0; i < prinst.numfields; i++) { o = prinst.field[i].progsofs; diff --git a/engine/qclib/qcc.h b/engine/qclib/qcc.h index 2b1a11ee1..b5798bf90 100644 --- a/engine/qclib/qcc.h +++ b/engine/qclib/qcc.h @@ -566,6 +566,7 @@ pbool QCC_PR_CheckName (char *string); void QCC_PR_Expect (char *string); pbool QCC_PR_CheckKeyword(int keywordenabled, char *string); #endif +pbool QCC_PR_CheckTokenComment(char *string, char **comment); void VARGS QCC_PR_ParseError (int errortype, char *error, ...); pbool VARGS QCC_PR_ParseWarning (int warningtype, char *error, ...); pbool VARGS QCC_PR_Warning (int type, char *file, int line, char *error, ...); diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index 9965488c6..9ca538e81 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -2971,8 +2971,7 @@ QCC_def_t *QCC_PR_GenerateFunctionCall (QCC_def_t *func, QCC_def_t *arglist[], i QCC_def_t *d, *oldret, *oself; int i; QCC_type_t *t; - int extraparms=false; - int np; +// int np; int laststatement = numstatements; int callconvention; @@ -2998,8 +2997,7 @@ QCC_def_t *QCC_PR_GenerateFunctionCall (QCC_def_t *func, QCC_def_t *arglist[], i QCC_PR_ParseErrorPrintDef (ERR_NOTAFUNCTION, func, "not a function"); } -// copy the arguments to the global parameter variables - if (t->type == ev_variant) +/* if (t->type == ev_variant) { extraparms = true; np = 0; @@ -3011,9 +3009,10 @@ QCC_def_t *QCC_PR_GenerateFunctionCall (QCC_def_t *func, QCC_def_t *arglist[], i } else np = t->num_parms; +*/ if (strchr(func->name, ':') && laststatement && statements[laststatement-1].op == OP_LOAD_FNC && statements[laststatement-1].c == func->ofs) - { //we're entering OO code with a different self. + { //we're entering OO code with a different self. make sure self is preserved. //eg: other.touch(self) //FIXME: problems could occur with hexen2 calling conventions when parm0/1 is 'self' @@ -3198,17 +3197,10 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_def_t *func) //warning, the func could int extraparms=false; int np; - int callconvention; - QCC_def_t *param[MAX_PARMS+MAX_EXTRA_PARMS]; func->timescalled++; - if (QCC_OPCodeValid(&pr_opcodes[OP_CALL1H])) - callconvention = OP_CALL1H; //FTE extended - else - callconvention = OP_CALL1; //standard - t = func->type; if (t->type == ev_variant) @@ -5391,7 +5383,9 @@ QCC_def_t *QCC_PR_Expression (int priority, int exprflags) int opnum; QCC_def_t *e, *e2; - etype_t type_a, type_b, type_c; + etype_t type_a; + //etype_t type_b; + etype_t type_c; if (priority == 0) return QCC_PR_Term (exprflags); @@ -5525,10 +5519,7 @@ QCC_def_t *QCC_PR_Expression (int priority, int exprflags) // type check type_a = e->type->type; - type_b = e2->type->type; - -// if (type_a == ev_pointer && type_b == ev_pointer) -// QCC_PR_ParseWarning(0, "Debug: pointer op pointer"); +// type_b = e2->type->type; if (op->name[0] == '.')// field access gets type from field { @@ -6831,9 +6822,7 @@ void QCC_PR_ParseState (void) { char *name; QCC_def_t *s1, *def, *sc = pr_scope; - char f; - f = *pr_token; if (QCC_PR_CheckToken("++") || QCC_PR_CheckToken("--")) { s1 = QCC_PR_ParseImmediate (); diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index d8373b284..9b7a35757 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -743,7 +743,7 @@ pbool QCC_WriteData (int crc) if (compressoutput) progs.blockscompressed |=64; //line numbers if (compressoutput) progs.blockscompressed |=128; //types //include a type block? - types = debugtarget; + //types = debugtarget; if (types && sizeof(char *) != sizeof(string_t)) { //qcc_typeinfo_t has a char* inside it, which changes size @@ -1331,6 +1331,7 @@ strofs = (strofs+3)&~3; else SafeWrite (h, qcc_pr_globals, numpr_globals*4); +/* if (types) for (i=0 ; inext) { - ld = d; if (!strcmp (d->name, "end_sys_globals")) break; if (d->ofsfunctions[num].first_statement; diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 626588368..33d5062fe 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -1329,7 +1329,6 @@ void Q_InitProgs(void) globalvars_t *pr_globals; static char addons[2048]; char *as, *a; - int num = 0; progsnum_t prnum, oldprnum=-1; int d1, d2; @@ -1343,7 +1342,6 @@ void Q_InitProgs(void) PR_RegisterFields(); - num = svs.numprogs; svs.numprogs=0; d1 = COM_FDepthFile("progs.dat", true); @@ -2893,6 +2891,8 @@ static void QCBUILTIN PF_particle4 (pubprogfuncs_t *prinst, globalvars_t *pr_glo static void QCBUILTIN PF_h2particleexplosion(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { + Con_Printf("H2FIXME: PF_h2particleexplosion not implemented\n"); +/* float *org; int color,radius,counter; @@ -2900,7 +2900,6 @@ static void QCBUILTIN PF_h2particleexplosion(pubprogfuncs_t *prinst, struct glob color = G_FLOAT(OFS_PARM1); radius = G_FLOAT(OFS_PARM2); counter = G_FLOAT(OFS_PARM3); -/* MSG_WriteByte(&sv.datagram, svc_particle_explosion); MSG_WriteCoord(&sv.datagram, org[0]); MSG_WriteCoord(&sv.datagram, org[1]); @@ -4247,11 +4246,10 @@ static void QCBUILTIN PF_aim (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl int i, j; trace_t tr; float dist, bestdist; - float speed; char *noaim; ent = G_EDICT(prinst, OFS_PARM0); - speed = G_FLOAT(OFS_PARM1); +// speed = G_FLOAT(OFS_PARM1); VectorCopy (ent->v->origin, start); start[2] += 20; @@ -5777,7 +5775,6 @@ void QCBUILTIN PF_sqlreadfloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_ void QCBUILTIN PF_sqlerror (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { sqlserver_t *server; - int serverref = G_FLOAT(OFS_PARM0); if (SQL_Available()) { @@ -7228,7 +7225,8 @@ void SV_RegisterH2CustomTents(void) } static void QCBUILTIN PF_h2starteffect(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { - float *min, *max, *angle, *size; + float *min, *max, *size; +// float *angle; float colour; // float wait, radius, frame, framelength, duration; // int flags, skin; @@ -7272,7 +7270,7 @@ static void QCBUILTIN PF_h2starteffect(pubprogfuncs_t *prinst, struct globalvars case ce_fountain: /*this effect is meant to be persistant (endeffect is never used)*/ org = G_VECTOR(OFS_PARM1); - angle = G_VECTOR(OFS_PARM2); +// angle = G_VECTOR(OFS_PARM2); dir = G_VECTOR(OFS_PARM3); colour = G_FLOAT(OFS_PARM4); count = G_FLOAT(OFS_PARM5); diff --git a/engine/server/savegame.c b/engine/server/savegame.c index bad7eabca..e25814b97 100644 --- a/engine/server/savegame.c +++ b/engine/server/savegame.c @@ -518,8 +518,6 @@ qboolean SV_LoadLevelCache(char *savename, char *level, char *startspot, qboolea int current_skill; - int clnum; - int pt; int modelpos; @@ -692,7 +690,7 @@ qboolean SV_LoadLevelCache(char *savename, char *level, char *startspot, qboolea filelen -= filepos; file = BZ_Malloc(filelen+1); memset(file, 0, filelen+1); - clnum=VFS_READ(f, file, filelen); + VFS_READ(f, file, filelen); file[filelen]='\0'; sv.world.edict_size=svprogfuncs->load_ents(svprogfuncs, file, 0); BZ_Free(file); diff --git a/engine/server/sv_ccmds.c b/engine/server/sv_ccmds.c index 6f1049951..4e6a65057 100644 --- a/engine/server/sv_ccmds.c +++ b/engine/server/sv_ccmds.c @@ -374,7 +374,7 @@ void SV_Give_f (void) } } -int QDECL ShowMapList (const char *name, int flags, void *parm, struct searchpath_s *spath) +int QDECL ShowMapList (const char *name, int flags, void *parm, void *spath) { if (name[5] == 'b' && name[6] == '_') //skip box models return true; diff --git a/engine/server/sv_ents.c b/engine/server/sv_ents.c index 7a3e5ffe4..95c6c43f5 100644 --- a/engine/server/sv_ents.c +++ b/engine/server/sv_ents.c @@ -1623,7 +1623,6 @@ 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) { - edict_t *ent; client_frame_t *fromframe; packet_entities_t *from; int oldindex, newindex; @@ -1666,7 +1665,6 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t if (newnum < oldnum) { // this is a new entity, send it from the baseline... as far as dp understands it... - ent = EDICT_NUM(svprogfuncs, newnum); //Con_Printf ("baseline %i\n", newnum); SVDP_EmitEntityDelta (&nullentitystate, &to->entities[newindex], msg, true); newindex++; @@ -2118,7 +2116,7 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t * if (client->state < cs_spawned) { - Con_Printf("SV_WritePlayersToClient: not spawned yet\n", client->namebuf); + Con_Printf("SV_WritePlayersToClient: not spawned yet\n"); return; } diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index 2c85a6d86..da9185d36 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -683,7 +683,7 @@ typedef struct #define SORT_NO 0 #define SORT_BY_DATE 1 -int QDECL Sys_listdirFound(const char *fname, int fsize, void *uptr, struct searchpath_s *spath) +int QDECL Sys_listdirFound(const char *fname, int fsize, void *uptr, void *spath) { file_t *f; dir_t *dir = uptr; diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index eec845e9f..023f7184e 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -287,8 +287,6 @@ static int WPhys_FlyMove (world_t *w, wedict_t *ent, const vec3_t gravitydir, fl int blocked; vec3_t diff; - vec3_t startorg; - numbumps = 4; blocked = 0; @@ -298,8 +296,6 @@ static int WPhys_FlyMove (world_t *w, wedict_t *ent, const vec3_t gravitydir, fl time_left = time; - VectorCopy (ent->v->origin, startorg); - for (bumpcount=0 ; bumpcountv->velocity, host_frametime, move); if (!DotProduct(move, move)) return; - VectorCopy(ent->v->origin, temporg); fl = 0; #ifndef CLIENTONLY @@ -1648,7 +1642,8 @@ static int WPhys_SetOnGround (world_t *w, wedict_t *ent, const float *gravitydir } static void WPhys_WalkMove (world_t *w, wedict_t *ent, const float *gravitydir) { - int clip, oldonground, originalmove_clip, originalmove_flags, originalmove_groundentity; + //int originalmove_clip; + int clip, oldonground, originalmove_flags, originalmove_groundentity; vec3_t upmove, downmove, start_origin, start_velocity, originalmove_origin, originalmove_velocity; trace_t downtrace, steptrace; @@ -1668,7 +1663,7 @@ static void WPhys_WalkMove (world_t *w, wedict_t *ent, const float *gravitydir) VectorCopy(ent->v->origin, originalmove_origin); VectorCopy(ent->v->velocity, originalmove_velocity); - originalmove_clip = clip; + //originalmove_clip = clip; originalmove_flags = (int)ent->v->flags; originalmove_groundentity = ent->v->groundentity; @@ -2210,12 +2205,7 @@ qboolean SV_Physics (void) SV_PreRunCmd(); -#ifdef SERVERONLY - ucmd.msec = host_frametime*1000; -#else - // FIXME: Something very weird is going on here! ucmd.msec = ms; -#endif ucmd.angles[0] = (int)(sv_player->v->v_angle[0] * (65535/360.0f)); ucmd.angles[1] = (int)(sv_player->v->v_angle[1] * (65535/360.0f)); ucmd.angles[2] = (int)(sv_player->v->v_angle[2] * (65535/360.0f)); diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index 643d35c87..ec5e017e6 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -836,7 +836,7 @@ void SV_MulticastProtExt(vec3_t origin, multicast_t to, int dimension_mask, int else msg = &demo.datagram; } - SZ_Write(&demo.datagram, sv.multicast.data, sv.multicast.cursize); + SZ_Write(msg, sv.multicast.data, sv.multicast.cursize); } #ifdef NQPROT diff --git a/engine/server/sv_sql.c b/engine/server/sv_sql.c index a91acb30c..0d318d559 100644 --- a/engine/server/sv_sql.c +++ b/engine/server/sv_sql.c @@ -188,9 +188,12 @@ int sql_serverworker(void *sref) { sqlserver_t *server = (sqlserver_t *)sref; const char *error = NULL; - int tinit = -1, i; + int i; qboolean needlock = false; qboolean allokay = true; +#ifdef USE_MYSQL + int tinit = -1; +#endif switch(server->driver) { @@ -260,11 +263,7 @@ int sql_serverworker(void *sref) { queryrequest_t *qreq = NULL; queryresult_t *qres; - const char *qerror = NULL; - int rows = -1; int columns = -1; - int qesize = 0; - void *res = NULL; if (!(qreq = SQL_PullRequest(server, needlock))) { @@ -279,51 +278,61 @@ int sql_serverworker(void *sref) switch(server->driver) { + default: + error = "Bad database driver"; + allokay = false; + break; #ifdef USE_MYSQL case SQLDRV_MYSQL: - // perform the query and fill out the result structure - if (qmysql_query(server->mysql, qreq->query)) - qerror = qmysql_error(server->mysql); - else // query succeeded { - res = qmysql_store_result(server->mysql); - if (res) // result set returned - { - rows = qmysql_num_rows(res); - columns = qmysql_num_fields(res); - } - else if (qmysql_field_count(server->mysql) == 0) // no result set - { - rows = qmysql_affected_rows(server->mysql); - if (rows < 0) - rows = 0; - columns = 0; - } - else // error + void *res = NULL; + int qesize = 0; + int rows = -1; + const char *qerror = NULL; + // perform the query and fill out the result structure + if (qmysql_query(server->mysql, qreq->query)) qerror = qmysql_error(server->mysql); - - } + else // query succeeded + { + res = qmysql_store_result(server->mysql); + if (res) // result set returned + { + rows = qmysql_num_rows(res); + columns = qmysql_num_fields(res); + } + else if (qmysql_field_count(server->mysql) == 0) // no result set + { + rows = qmysql_affected_rows(server->mysql); + if (rows < 0) + rows = 0; + columns = 0; + } + else // error + qerror = qmysql_error(server->mysql); + + } - if (qerror) - qesize = Q_strlen(qerror); - qres = (queryresult_t *)ZF_Malloc(sizeof(queryresult_t) + qesize); - if (qres) - { if (qerror) - Q_strncpy(qres->error, qerror, qesize); - qres->result = res; - qres->rows = rows; - qres->columns = columns; - qres->request = qreq; - qres->eof = true; // store result has no more rows to read afterwards + qesize = Q_strlen(qerror); + qres = (queryresult_t *)ZF_Malloc(sizeof(queryresult_t) + qesize); + if (qres) + { + if (qerror) + Q_strncpy(qres->error, qerror, qesize); + qres->result = res; + qres->rows = rows; + qres->columns = columns; + qres->request = qreq; + qres->eof = true; // store result has no more rows to read afterwards - SQL_PushResult(server, qres); - } - else // we're screwed here so bomb out - { - server->active = false; - error = "MALLOC ERROR! Unable to allocate query result!"; - break; + SQL_PushResult(server, qres); + } + else // we're screwed here so bomb out + { + server->active = false; + error = "MALLOC ERROR! Unable to allocate query result!"; + break; + } } break; #endif @@ -335,7 +344,6 @@ int sql_serverworker(void *sref) const char *trailingstring; char *statementstring = qreq->query; char **mat; - int matsize; int rowspace; int totalrows = 0; qboolean keeplooping = true; @@ -353,8 +361,6 @@ int sql_serverworker(void *sref) { rowspace = 65; - matsize = columns * sizeof(char*); - qres = (queryresult_t *)ZF_Malloc(sizeof(queryresult_t) + columns * sizeof(char*) * rowspace); mat = (char**)(qres + 1); if (qres) @@ -461,6 +467,8 @@ int sql_serverworker(void *sref) server->sqlite = NULL; break; #endif + default: + break; } // if we have a server error we still need to put it on the queue @@ -527,6 +535,8 @@ static void SQL_DeallocResult(sqlserver_t *server, queryresult_t *qres) // deallocate current result switch(server->driver) { + default: + break; #ifdef USE_MYSQL case SQLDRV_MYSQL: if (qres->result) @@ -1030,6 +1040,9 @@ void SQL_Status_f(void) server->connectparams[3], server->active ? "active" : "inactive"); break; + default: + Con_Printf("Bad driver\n"); + break; } if (reqnum) @@ -1116,7 +1129,7 @@ void SQL_ServerCycle (void) if (!server) continue; - while (qres = SQL_PullResult(server)) + while ((qres = SQL_PullResult(server))) { qreq = qres->request; qres->next = NULL; diff --git a/engine/server/sv_sys_unix.c b/engine/server/sv_sys_unix.c index 7f4f6c3e8..7d449d7cc 100644 --- a/engine/server/sv_sys_unix.c +++ b/engine/server/sv_sys_unix.c @@ -917,6 +917,7 @@ void *Sys_GetAddressForName(dllhandle_t *module, const char *exportname) } +#if 0 static void *game_library; void Sys_UnloadGame(void) @@ -936,11 +937,10 @@ void *Sys_GetGameAPI(void *parms) char curpath[MAX_OSPATH]; char *searchpath; const char *gamename = "gamei386.so"; - char *result; void *ret; - result = getcwd(curpath, sizeof(curpath)); // do soemthing with the result + getcwd(curpath, sizeof(curpath)); // do soemthing with the result searchpath = 0; while((searchpath = COM_NextPath(searchpath))) @@ -962,6 +962,7 @@ void *Sys_GetGameAPI(void *parms) return 0; } +#endif void Sys_ServerActivity(void) { diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index e4b2879fb..85ff67a41 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -6631,7 +6631,7 @@ void SVQ2_ExecuteClientMessage (client_t *cl) break; #ifdef VOICECHAT - case clc_voicechat: + case clcq2_voicechat: SV_VoiceReadPacket(); break; #endif @@ -6769,7 +6769,6 @@ void SVNQ_ExecuteClientMessage (client_t *cl) int c; char *s; client_frame_t *frame; - int seq_hash; cl->netchan.outgoing_sequence++; cl->netchan.incoming_acknowledged = cl->netchan.outgoing_sequence-1; @@ -6795,8 +6794,6 @@ void SVNQ_ExecuteClientMessage (client_t *cl) host_client = cl; sv_player = host_client->edict; - seq_hash = cl->netchan.incoming_sequence; - // mark time so clients will know how much to predict // other players cl->localtime = sv.time; diff --git a/engine/server/world.c b/engine/server/world.c index f7c84ebfe..da9f4686c 100644 --- a/engine/server/world.c +++ b/engine/server/world.c @@ -1116,9 +1116,6 @@ static void World_AreaEdicts_r (areanode_t *node) { link_t *l, *next, *start; wedict_t *check; - int count; - - count = 0; // touch linked edicts start = &node->edicts; @@ -1188,9 +1185,6 @@ static void WorldQ2_AreaEdicts_r (areanode_t *node) { link_t *l, *next, *start; q2edict_t *check; - int count; - - count = 0; // touch linked edicts start = &node->edicts;