From 9c59fafc3ea2646cd23438277a85c4a0ab38ca67 Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 20 Sep 2004 23:25:38 +0000 Subject: [PATCH] lots of changes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@228 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile.mingw | 9 +- engine/client/cd_win.c | 7 +- engine/client/cl_ents.c | 1 + engine/client/cl_main.c | 2 +- engine/client/cl_screen.c | 2 + engine/client/fragstats.c | 13 +- engine/client/image.c | 65 ++-- engine/client/in_win.c | 45 +++ engine/client/keys.c | 11 +- engine/client/m_mp3.c | 587 +------------------------------- engine/client/merged.h | 3 + engine/client/net_master.c | 2 + engine/client/r_bulleten.c | 2 + engine/client/r_part.c | 10 +- engine/client/render.h | 11 +- engine/client/renderer.c | 25 +- engine/client/snd_dma.c | 10 +- engine/client/snd_win.c | 12 +- engine/client/sys_win.c | 1 - engine/client/teamplay.c | 80 +---- engine/client/valid.c | 2 + engine/client/view.c | 35 +- engine/client/wad.c | 30 +- engine/client/zqtp.c | 91 ++++- engine/common/cmd.c | 68 ++-- engine/common/cmd.h | 2 +- engine/common/common.c | 5 - engine/common/gl_q2bsp.c | 2 + engine/common/huff.c | 4 +- engine/common/net_chan.c | 2 +- engine/common/ui_public.h | 2 +- engine/common/zone.c | 105 +++++- engine/ftequake/ftequake.dsp | 32 +- engine/gl/gl_alias.c | 26 +- engine/gl/gl_draw.c | 177 +++++++++- engine/gl/gl_model.c | 38 ++- engine/gl/gl_ppl.c | 44 ++- engine/gl/gl_rlight.c | 9 +- engine/gl/gl_rmain.c | 15 + engine/gl/gl_rmisc.c | 2 +- engine/gl/gl_rsurf.c | 2 +- engine/gl/gl_vidnt.c | 26 +- engine/gl/glquake.h | 7 +- engine/gl/gltod3d/gl_fakegl.cpp | 1 + engine/http/ftpserver.c | 2 - engine/http/httpserver.c | 4 +- engine/qclib/hash.c | 4 +- engine/qclib/initlib.c | 27 +- engine/qclib/pr_edict.c | 84 ++--- engine/qclib/progsint.h | 5 - engine/qclib/progslib.h | 4 - engine/qclib/qcc_cmdlib.c | 1 + engine/qclib/qcc_pr_comp.c | 24 +- engine/qclib/qcc_pr_lex.c | 2 +- engine/qclib/qccmain.c | 12 +- engine/qclib/qcdecomp.c | 2 +- engine/qux/Xmd.h | 2 +- engine/qux/m_x.c | 32 +- engine/qux/x_reqs.c | 114 +++---- engine/server/pr_cmds.c | 10 +- engine/server/savegame.c | 4 +- engine/server/sv_init.c | 2 +- engine/server/sv_main.c | 5 +- engine/server/sv_phys.c | 2 +- engine/server/sv_send.c | 2 +- engine/server/sv_user.c | 78 +++-- engine/sndcodec/snd_vc.c | 2 +- engine/sw/d_local.h | 7 + engine/sw/d_trans.c | 453 +++++++++++++++++++++++- engine/sw/sw_draw.c | 2 + 70 files changed, 1417 insertions(+), 1094 deletions(-) diff --git a/engine/Makefile.mingw b/engine/Makefile.mingw index 342c77ca5..22c7df4c9 100644 --- a/engine/Makefile.mingw +++ b/engine/Makefile.mingw @@ -29,11 +29,11 @@ W32LDFLAGS= RELEASELDFLAGS=-s -BASE_CFLAGS=-Wall -I$(CLIENT_DIR) -I$(COMMON_DIR) -I$(SW_DIR) -I$(GL_DIR) -I$(SERVER_DIR) -I$(PROGS_DIR) -I$(DXSDK_DIR)/include -DWEBSVCL -DDYNAMIC_ENTS -D_WIN32 +BASE_CFLAGS=-Wall -I$(CLIENT_DIR) -I$(COMMON_DIR) -I$(SW_DIR) -I$(GL_DIR) -I$(SERVER_DIR) -I$(PROGS_DIR) -I$(DXSDK_DIR)/include -DWEBSVCL -D_WIN32 CLIENT_ONLY_CFLAGS=$(BASE_CFLAGS) -DCLIENTONLY SERVER_ONLY_CFLAGS=$(BASE_CFLAGS) -DSERVERONLY JOINT_CFLAGS=$(BASE_CFLAGS) -DEBUG_CFLAGS=-g -ggdb +DEBUG_CFLAGS=-g -ggdb -DZQUAKETEAMPLAY RELEASE_CFLAGS=-O6 -s -fno-strict-aliasing -ffast-math -funroll-loops -fexpensive-optimizations $(CPUOPTIMIZATIONS) GLCFLAGS= @@ -47,6 +47,7 @@ NQPROT_OBJS = \ CLIENT_OBJS = \ $(OUT_DIR)/textedit.o \ $(OUT_DIR)/teamplay.o \ + $(OUT_DIR)/zqtp.o \ $(OUT_DIR)/cl_demo.o \ $(OUT_DIR)/cl_ents.o \ $(OUT_DIR)/clq2_ents.o \ @@ -594,6 +595,10 @@ $(OUT_DIR)/translate.o : $(COMMON_DIR)/translate.c $(OUT_DIR)/teamplay.o : $(CLIENT_DIR)/teamplay.c $(DO_CC) + +$(OUT_DIR)/zqtp.o : $(CLIENT_DIR)/zqtp.c + $(DO_CC) + $(OUT_DIR)/cl_main.o : $(CLIENT_DIR)/cl_main.c $(DO_CC) diff --git a/engine/client/cd_win.c b/engine/client/cd_win.c index 22fe9025f..cf5a3fb1b 100644 --- a/engine/client/cd_win.c +++ b/engine/client/cd_win.c @@ -34,12 +34,9 @@ static qboolean enabled = false; static qboolean playLooping = false; static float cdvolume; static qbyte remap[100]; -static qbyte cdrom; static qbyte playTrack; static qbyte maxTrack; -static qboolean playingsoundfile; - UINT wDeviceID; @@ -47,7 +44,7 @@ static void CDAudio_Eject(void) { DWORD dwReturn; - if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL)) + if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD)NULL))) Con_DPrintf("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); } @@ -56,7 +53,7 @@ static void CDAudio_CloseDoor(void) { DWORD dwReturn; - if (dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL)) + if ((dwReturn = mciSendCommand(wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD)NULL))) Con_DPrintf("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); } diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 66298fe76..7f26ad532 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1755,6 +1755,7 @@ void CL_SetSolidEntities (void) pmove.physents[pmove.numphysent].model = cl.model_precache[state->modelindex]; VectorCopy (state->origin, pmove.physents[pmove.numphysent].origin); VectorCopy (state->angles, pmove.physents[pmove.numphysent].angles); + pmove.physents[pmove.numphysent].angles[0]*=-1; if (++pmove.numphysent == MAX_PHYSENTS) break; } diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 8e92757bf..51d6b8e11 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1882,7 +1882,7 @@ void CL_Download_f (void) } strcpy(cls.downloadtempname, cls.downloadname); - cls.downloadqw = fopen (cls.downloadname, "wb"); +// cls.downloadqw = fopen (cls.downloadname, "wb"); cls.downloadmethod = DL_QW; diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 2853eb132..6ec196fd1 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -21,7 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // cl_screen.c -- master for refresh, status bar, console, chat, notify, etc #include "quakedef.h" +#ifdef RGLQUAKE #include "glquake.h"//would prefer not to have this +#endif diff --git a/engine/client/fragstats.c b/engine/client/fragstats.c index e6e1d48ec..13fca66f1 100644 --- a/engine/client/fragstats.c +++ b/engine/client/fragstats.c @@ -299,6 +299,7 @@ static void Stats_LoadFragFile(char *name) char *file; char *end; char *tk, *tz; + char oend; Stats_Clear(); @@ -306,13 +307,17 @@ static void Stats_LoadFragFile(char *name) COM_DefaultExtension(filename, ".dat"); file = COM_LoadTempFile(filename); - if (!file) + if (!file || !*file) return; + oend = 1; for (;;) { + if (!oend) + break; for (end = file; *end && *end != '\n'; end++) ; + oend = *end; *end = '\0'; if (!*file) break; @@ -398,9 +403,11 @@ static void Stats_LoadFragFile(char *name) Stats_StatMessage(fftype, 0, Cmd_Argv(3), NULL); } - else {Con_Printf("Unrecognised directive \"%s\"\n", tk);continue;} + else + {Con_Printf("Unrecognised directive \"%s\"\n", tk);continue;} } - else {Con_Printf("Unrecognised directive \"%s\"\n", tk);continue;} + else + {Con_Printf("Unrecognised directive \"%s\"\n", tk);continue;} } } diff --git a/engine/client/image.c b/engine/client/image.c index e47c5e81e..81983879a 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -1,5 +1,7 @@ #include "quakedef.h" +#ifdef RGLQUAKE #include "glquake.h" +#endif cvar_t r_dodgytgafiles = {"r_dodgytgafiles", "0"}; //Certain tgas are upside down. //This is due to a bug in tenebrae. @@ -1474,6 +1476,31 @@ void BoostGamma(qbyte *rgba, int width, int height) #if defined(RGLQUAKE) +//returns r8g8b8a8 +qbyte *Read32BitImageFile(qbyte *buf, int len, int *width, int *height) +{ + qbyte *data; + if ((data = ReadTargaFile(buf, len, width, height, false))) + return data; + +#ifdef AVAIL_PNGLIB + if ((buf[0] == -119 && buf[1] == 'P' && buf[2] == 'N' && buf[3] == 'G') && (data = ReadPNGFile(buf, com_filesize, width, height))) + return data; +#endif +#ifdef AVAIL_JPEGLIB + //jpeg jfif only. + if ((buf[0] == 0xff && buf[1] == 0xd8 && buf[2] == 0xff && buf[3] == 0xe0) && (data = ReadJPEGFile(buf, com_filesize, width, height))) + return data; +#endif + if ((data = ReadPCXFile(buf, com_filesize, width, height))) + return data; + + if ((buf[0] == 'B' && buf[1] == 'M') && (data = ReadBMPFile(buf, com_filesize, width, height))) + return data; + + return NULL; +} + int GL_LoadTexture8Bump (char *identifier, int width, int height, unsigned char *data, qboolean mipmap); int image_width, image_height; @@ -1548,49 +1575,21 @@ int Mod_LoadHiResTexture(char *name, qboolean mipmap, qboolean alpha, qboolean c _snprintf(fname, sizeof(fname)-1, path[i], nicename, extensions[e]); if ((buf = COM_LoadFile (fname, 5))) { - if ((data = ReadTargaFile(buf, com_filesize, &image_width, &image_height, false))) + if ((data = Read32BitImageFile(buf, com_filesize, &image_width, &image_height))) { BoostGamma(data, image_width, image_height); len = GL_LoadTexture32 (name, image_width, image_height, (unsigned*)data, mipmap, alpha); BZ_Free(data); - } -#ifdef AVAIL_PNGLIB - else if ((buf[0] == -119 && buf[1] == 'P' && buf[2] == 'N' && buf[3] == 'G') &&(data = ReadPNGFile(buf, com_filesize, &image_width, &image_height))) - { - BoostGamma(data, image_width, image_height); - len = GL_LoadTexture32 (name, image_width, image_height, (unsigned*)data, mipmap, alpha); - BZ_Free(data); - } -#endif -#ifdef AVAIL_JPEGLIB - else if ((data = ReadJPEGFile(buf, com_filesize, &image_width, &image_height))) - { - BoostGamma(data, image_width, image_height); - len = GL_LoadTexture32 (name, image_width, image_height, (unsigned*)data, mipmap, alpha); - BZ_Free(data); - } -#endif - else if ((data = ReadPCXFile(buf, com_filesize, &image_width, &image_height))) - { - BoostGamma(data, image_width, image_height); - len = GL_LoadTexture32(name, image_width, image_height, (unsigned*)data, mipmap, alpha); - BZ_Free(data); - } - else if ((buf[0] == 'B' && buf[1] == 'M') && (data = ReadBMPFile(buf, com_filesize, &image_width, &image_height))) - { - BoostGamma(data, image_width, image_height); - len = GL_LoadTexture32(name, image_width, image_height, (unsigned*)data, mipmap, alpha); - BZ_Free(data); + + BZ_Free(buf); + + return len; } else { BZ_Free(buf); continue; } - - BZ_Free(buf); - - return len; } } } diff --git a/engine/client/in_win.c b/engine/client/in_win.c index fa199b3ba..a6e263b80 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -45,6 +45,7 @@ HRESULT (WINAPI *pDirectInputCreate)(HINSTANCE hinst, DWORD dwVersion, // mouse variables cvar_t m_filter = {"m_filter","0"}; +cvar_t m_forcewheel = {"m_forcewheel", "1"}; cvar_t in_mwhook = {"in_mwhook","0", NULL, CVAR_ARCHIVE}; cvar_t in_dinput = {"in_dinput","0", NULL, CVAR_ARCHIVE}; @@ -820,6 +821,7 @@ void IN_Init (void) // mouse variables Cvar_Register (&m_filter, "Input stuff"); + Cvar_Register (&m_forcewheel, "Input stuff"); Cvar_Register (&in_mwhook, "Input stuff"); Cvar_Register (&in_dinput, "Input stuff"); @@ -1114,6 +1116,17 @@ void IN_MouseMove (usercmd_t *cmd, int pnum) sysmouse.delta[1] += od.dwData; break; + case DIMOFS_Z: + if (m_forcewheel.value) + { + if (od.dwData & 0x80) + sysmouse.wheeldelta++; + else + sysmouse.wheeldelta--; + } + break; + + case DIMOFS_BUTTON0: if (od.dwData & 0x80) sysmouse.buttons |= 1; @@ -1134,6 +1147,38 @@ void IN_MouseMove (usercmd_t *cmd, int pnum) else sysmouse.buttons &= ~(1<<2); break; + case DIMOFS_BUTTON3: + if (od.dwData & 0x80) + sysmouse.buttons |= (1<<3); + else + sysmouse.buttons &= ~(1<<3); + break; +#if (DIRECTINPUT_VERSION >= 0x0700) + case DIMOFS_BUTTON4: + if (od.dwData & 0x80) + sysmouse.buttons |= (1<<4); + else + sysmouse.buttons &= ~(1<<4); + break; + case DIMOFS_BUTTON5: + if (od.dwData & 0x80) + sysmouse.buttons |= (1<<5); + else + sysmouse.buttons &= ~(1<<5); + break; + case DIMOFS_BUTTON6: + if (od.dwData & 0x80) + sysmouse.buttons |= (1<<6); + else + sysmouse.buttons &= ~(1<<6); + break; + case DIMOFS_BUTTON7: + if (od.dwData & 0x80) + sysmouse.buttons |= (1<<7); + else + sysmouse.buttons &= ~(1<<7); + break; +#endif } } } diff --git a/engine/client/keys.c b/engine/client/keys.c index 879805f49..d9f4ff104 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -816,14 +816,14 @@ void Key_Unbindall_f (void) Key_Bind_f =================== */ -void Key_Bind_f (void) //FIXME: work with modifiers +void Key_Bind_f (void) { int i, c, b, modifier; char cmd[1024]; c = Cmd_Argc(); - if (c != 2 && c != 3) + if (c < 2) { Con_Printf ("bind [command] : attach a command to a key\n"); return; @@ -843,6 +843,13 @@ void Key_Bind_f (void) //FIXME: work with modifiers Con_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) ); return; } + + if (c > 3) + { + Cmd_ShiftArgs(1); + Key_SetBinding (b, modifier, Cmd_Args(), Cmd_ExecLevel); + return; + } // copy the rest of the command line cmd[0] = 0; // start out with a null string diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index dc4c5ffa1..a53fe99c3 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -2,153 +2,9 @@ //was origonally an mp3 track selector, now handles lots of media specific stuff - like q3 films! //should rename to m_media.c #include "quakedef.h" - +#ifdef RGLQUAKE #include "glquake.h"//fixme - -//pal77* pal777to8; -qbyte *palxxxto8; - -#define FindPallete(r,g,b) palxxxto8[((r&palmask[0])>>palshift[0]) | ((g&palmask[1])<>1][g>>1][b>>1]) -qbyte GetPalette(int red, int green, int blue) -{ - if (palxxxto8) //fast precalculated method - return FindPallete(red,green,blue); - else //slow, horrible method. - { - int i, best=15; - int bestdif=256*256*256, curdif; - extern qbyte *host_basepal; - qbyte *pa; - - #define _abs(x) ((x)*(x)) - - pa = host_basepal; - for (i = 0; i < 256; i++, pa+=3) - { - curdif = _abs(red - pa[0]) + _abs(green - pa[1]) + _abs(blue - pa[2]); - if (curdif < bestdif) - { - if (curdif<1) - return i; - bestdif = curdif; - best = i; - } - } - return best; - } -} - -void MakeVideoPalette(void) -{ -// pal77 *temp; - qbyte *temp; - int r, g, b; - int rs, gs, bs, size; - int rstep, gstep, bstep; - int gshift, bshift; - FILE *f; - char filename[11]; - - if (strlen(r_palconvbits.string) < 3) - { - // r5g6b5 is default - rs = 5; - gs = 6; - bs = 5; - } - else - { - // convert to int - rs = r_palconvbits.string[0] - '0'; - gs = r_palconvbits.string[1] - '0'; - bs = r_palconvbits.string[2] - '0'; - - // limit to 4-8 (can't have 3 because the forumla breaks) - if (rs < 4) - rs = 4; - else if (rs > 8) - rs = 8; - - if (gs < 4) - gs = 4; - else if (gs > 8) - gs = 8; - - if (bs < 4) - bs = 4; - else if (bs > 8) - bs = 8; - } - - Q_strcpy(filename, "rgb000.pal"); - filename[3] = rs + '0'; - filename[4] = gs + '0'; - filename[5] = bs + '0'; - - palshift[0] = 1<>= 1; - gstep >>= 1; - bstep >>= 1; - - for (r = palshift[0] - 1; r >= 0; r--) - for (g = palshift[1] - 1; g >= 0; g--) - for (b = palshift[2] - 1; b >= 0; b--) - { - temp[r+(g<width, roqfilm->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, framedata); -// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); -// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); - - glDisable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glTexCoord2f(0, 1); - glVertex2f(0, vid.height); - glTexCoord2f(1, 1); - glVertex2f(vid.width, vid.height); - glTexCoord2f(1, 0); - glVertex2f(vid.width, 0); - glEnd(); - glEnable(GL_ALPHA_TEST); - } - else -#endif -#ifdef SWQUAKE - if (qrenderer == QR_SOFTWARE) - { - int y, x; - - D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly - if (r_pixbytes == 1) - { - qbyte *dest, *src; - int lines=vid.conheight; - int v; - int f, fstep; - - dest = vid.conbuffer; - - for (y=0 ; y>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - dest[x+1] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - dest[x+2] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - dest[x+3] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - } - } - } - } - else if (r_pixbytes == 2) - { -extern int redbits, redshift; -extern int greenbits, greenshift; -extern int bluebits, blueshift; - - unsigned short *dest; - qbyte *src; - int lines=vid.conheight; - int v; - int f, fstep; - - dest = (unsigned short *)vid.conbuffer; - - for (y=0 ; y>16)*4]*(1<>16)*4+1]*(1<>16)*4+2]*(1<>16)*4+2]; - dest[x+1] = src[(f>>16)*4+1]; - dest[x+2] = src[(f>>16)*4]; - f += fstep; - } - } - } - } - else - Sys_Error("24 bit rendering?"); - - D_DisableBackBufferAccess (); // for adapters that can't stay mapped in - } - else -#endif - Sys_Error("Bad renderer in Media_ShowFrame"); - - SCR_SetUpToDrawConsole(); - if (scr_con_current) - SCR_DrawConsole (false); - - M_Draw(0); -} - -void Media_ShowFrame(qbyte *framedata, int inwidth, int inheight, qbyte *bgrandupsidedown) //bgrandupsidedown is hackily done. It should be a temporary buffer that also indicates stuff. -{ - int y, x; - -#ifdef RGLQUAKE - if (qrenderer == QR_OPENGL) - { - if (bgrandupsidedown) //this is for avi files. (blooming windows programmers...) - { //convert it. - int v; - unsigned int f, fstep; - qbyte *src, *dest; - dest = bgrandupsidedown; - //change from bgr bottomup to rgba bottomdown - for (y=1 ; y<=filmnheight ; y++) - { - v = ((filmnheight - y)*(float)inheight/filmnheight); - src = framedata + v*(inwidth*3); - { - f = 0; - fstep = ((inwidth)*0x10000)/filmnwidth; - - for (x=filmnwidth ; x&3 ; x--) //do the odd ones first. (bigger condition) - { - *dest++ = src[(f>>16)*3+2]; - *dest++ = src[(f>>16)*3+1]; - *dest++ = src[(f>>16)*3+0]; - *dest++ = 255; - f += fstep; - } - for ( ; x ; x-=4) //loop through the remaining chunks. - { - dest[0] = src[(f>>16)*3+2]; - dest[1] = src[(f>>16)*3+1]; - dest[2] = src[(f>>16)*3+0]; - dest[3] = 255; - f += fstep; - - dest[4] = src[(f>>16)*3+2]; - dest[5] = src[(f>>16)*3+1]; - dest[6] = src[(f>>16)*3+0]; - dest[7] = 255; - f += fstep; - - dest[8] = src[(f>>16)*3+2]; - dest[9] = src[(f>>16)*3+1]; - dest[10] = src[(f>>16)*3+0]; - dest[11] = 255; - f += fstep; - - dest[12] = src[(f>>16)*3+2]; - dest[13] = src[(f>>16)*3+1]; - dest[14] = src[(f>>16)*3+0]; - dest[15] = 255; - f += fstep; - - dest += 16; - } - } - } - } - - if (!filmtexture) - { - filmtexture=texture_extension_number; - texture_extension_number++; - } - - GL_Set2D (); - - GL_Bind(filmtexture); - GL_Upload32("", (unsigned *)framedata, inwidth, inheight, false, false); //we may need to rescale the image -// glTexImage2D (GL_TEXTURE_2D, 0, 3, roqfilm->width, roqfilm->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, framedata); -// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); -// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); - - glDisable(GL_BLEND); - glDisable(GL_ALPHA_TEST); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glTexCoord2f(0, 1); - glVertex2f(0, vid.height); - glTexCoord2f(1, 1); - glVertex2f(vid.width, vid.height); - glTexCoord2f(1, 0); - glVertex2f(vid.width, 0); - glEnd(); - glEnable(GL_ALPHA_TEST); - } - else -#endif -#ifdef SWQUAKE - if (qrenderer == QR_SOFTWARE) - { - D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly - if (r_pixbytes == 1) - { - qbyte *dest, *src; - int lines=vid.conheight; - int v; - int f, fstep; - - dest = vid.conbuffer; - - if (bgrandupsidedown) - { - for (y=0 ; y>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); - f += fstep; - dest[x+1] = FindPallete(src[(f>>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); - f += fstep; - dest[x+2] = FindPallete(src[(f>>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); - f += fstep; - dest[x+3] = FindPallete(src[(f>>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); - f += fstep; - } - } - } - - } - else - { - for (y=0 ; y>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - dest[x+1] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - dest[x+2] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - dest[x+3] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); - f += fstep; - } - } - } - } - } - else if (r_pixbytes == 2) - { - if (bgrandupsidedown) - { -extern int redbits, redshift; -extern int greenbits, greenshift; -extern int bluebits, blueshift; - - unsigned short *dest; - qbyte *src; - int lines=vid.conheight; - int v; - int f, fstep; - - dest = (unsigned short *)vid.conbuffer; - - for (y=0 ; y>16)*3+2]*(1<>16)*3+1]*(1<>16)*3+0]*(1<>16)*4]*(1<>16)*4+1]*(1<>16)*4+2]*(1<>16)*3); - f += fstep; - } - } - } - } - else - { - qbyte *dest, *src; - int lines=vid.conheight; - int v; - int f, fstep; - - dest = vid.conbuffer; - - for (y=0 ; y>16)*4+2]; - dest[x+1] = src[(f>>16)*4+1]; - dest[x+2] = src[(f>>16)*4]; - f += fstep; - } - } - } - } - } - else - Sys_Error("24 bit rendering?"); - - D_DisableBackBufferAccess (); // for adapters that can't stay mapped in - } - else -#endif - Sys_Error("Bad renderer in Media_ShowFrame"); - - SCR_SetUpToDrawConsole(); - if (scr_con_current) - SCR_DrawConsole (false); -} - qboolean Media_ShowFilm(void) { // sfx_t *s; @@ -1715,7 +1138,7 @@ qboolean Media_ShowFilm(void) return true; } - Media_ShowFrame(framedata, roqfilm->width, roqfilm->height, NULL); + Media_ShowFrameRGBA_32(framedata, roqfilm->width, roqfilm->height); if (roqfilm->audio_channels && sndcardinfo && roqfilm->aud_pos < roqfilm->vid_pos) if (roq_read_audio(roqfilm)>0) @@ -1732,7 +1155,7 @@ qboolean Media_ShowFilm(void) case MFT_STATIC: - Media_ShowFrame(staticfilmimage, imagewidth, imageheight, NULL); + Media_ShowFrameRGBA_32(staticfilmimage, imagewidth, imageheight); return true; #ifdef WINAVI @@ -1761,7 +1184,7 @@ qboolean Media_ShowFilm(void) } else { - Media_ShowFrame(staticfilmimage, imagewidth, imageheight, framedata); + Media_ShowFrameBGR_24_Flip(staticfilmimage, imagewidth, imageheight); } if (pavisound) diff --git a/engine/client/merged.h b/engine/client/merged.h index ff0f77ce6..2dd926c52 100644 --- a/engine/client/merged.h +++ b/engine/client/merged.h @@ -57,6 +57,9 @@ extern void (*R_AddStain) (vec3_t org, float red, float green, float blue, extern void (*R_LessenStains) (void); extern void (*R_DrawWaterSurfaces) (void); +extern void (*Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight); //input is bottom up... +extern void (*Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight); //top down +extern void (*Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette); //paletted topdown (framedata is 8bit indexes into palette) extern qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette); extern void (*VID_DeInit) (void); diff --git a/engine/client/net_master.c b/engine/client/net_master.c index c56b2f8ec..e3a0fcf41 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -327,7 +327,9 @@ int NET_CheckPollSockets(void) if (*(int *)net_message.data == -1) { int c; +#ifdef Q2CLIENT char *s; +#endif MSG_BeginReading (); MSG_ReadLong (); // skip the -1 diff --git a/engine/client/r_bulleten.c b/engine/client/r_bulleten.c index 213229b91..c8143722f 100644 --- a/engine/client/r_bulleten.c +++ b/engine/client/r_bulleten.c @@ -29,7 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "r_local.h" #include "d_local.h" #endif +#ifdef RGLQUAKE #include "glquake.h"//hack +#endif /* Effects: diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 0098673d8..d74d3e4c0 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -22,7 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef SWQUAKE #include "r_local.h" #endif +#ifdef RGLQUAKE #include "glquake.h"//hack +#endif #include "renderque.h" @@ -212,6 +214,7 @@ part_type_t *GetParticleType(char *name) ptype->cliptype = -1; ptype->emit = -1; ptype->loaded = 0; + ptype->ramp = NULL; return ptype; } @@ -895,7 +898,7 @@ void R_Part_NewServer(void) else { Cbuf_AddText(va("exec %s.cfg\n", r_particlesdesc.string), RESTRICT_LOCAL); -#if defined(_DEBUG) && defined(WIN32) //expand the particles cfg into a C style quoted string, and copy to clipboard so I can paste it in. +/*#if defined(_DEBUG) && defined(WIN32) //expand the particles cfg into a C style quoted string, and copy to clipboard so I can paste it in. { char *TL_ExpandToCString(char *in); extern HWND mainwindow; @@ -932,7 +935,7 @@ void R_Part_NewServer(void) SetClipboardData(CF_TEXT, hglbCopy); CloseClipboard(); } -#endif +#endif*/ } } @@ -2234,7 +2237,6 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type) } lasttype = type; - glEnd(); glDisable(GL_TEXTURE_2D); if (type->blendmode == BM_ADD) //addative glBlendFunc(GL_SRC_ALPHA, GL_ONE); @@ -2244,6 +2246,7 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glShadeModel(GL_SMOOTH); } + glEnd(); scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1] + (p->org[2] - r_origin[2])*vpn[2]; @@ -2276,6 +2279,7 @@ void GL_DrawTrifanParticle(particle_t *p, part_type_t *type) glVertex3fv (v); } glEnd (); + glBegin (GL_LINES); } void GL_DrawSparkedParticle(particle_t *p, part_type_t *type) diff --git a/engine/client/render.h b/engine/client/render.h index b61ffef7c..0d49d8acc 100644 --- a/engine/client/render.h +++ b/engine/client/render.h @@ -159,6 +159,9 @@ void GLR_DrawWaterSurfaces (void); void GLR_AddStain(vec3_t org, float red, float green, float blue, float radius); void GLR_LessenStains(void); +void MediaGL_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette); +void MediaGL_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down +void MediaGL_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up... #endif #if defined(SWQUAKE) @@ -181,6 +184,10 @@ void SWR_PushDlights (void); void SWR_AddStain(vec3_t org, float red, float green, float blue, float radius); void SWR_LessenStains(void); + +void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette); +void MediaSW_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight); //top down +void MediaSW_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight); //input is bottom up... #endif void R_ParseParticleEffect (void); void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count); @@ -257,12 +264,9 @@ void SWMod_NowLoadExternal(void); #endif qboolean Media_ShowFilm(void); -void Media_ShowFrame(qbyte *framedata, int inwidth, int inheight, qbyte *bgrandupsidedown); -void Media_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette); //for media playback not based in m_mp3.c gotta rename that file... void Media_CaptureDemoEnd(void); void Media_RecordAudioFrame (short *sample_buffer, int samples); void Media_RecordFrame (void); -void MakeVideoPalette(void); void R_Part_SkyTri(float *v1, float *v2, float *v3, struct msurface_s *surf); void R_ClearParticles (void); @@ -304,6 +308,7 @@ void CL_NewDlightRGB (int key, float x, float y, float z, float radius, float ti float r, float g, float b); void Renderer_Init(void); +void R_RestartRenderer_f (void);//this goes here so we can save some stack when first initing the sw renderer. //used to live in glquake.h qbyte GetPalette(int red, int green, int blue); diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 90ddab02a..a75eeb9ba 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -218,15 +218,18 @@ cvar_t gl_skyboxname = {"r_skybox", ""}; #if defined(RGLQUAKE) cvar_t gl_ztrick = {"gl_ztrick","1"}; extern cvar_t r_waterlayers; -cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", NULL, CVAR_ARCHIVE }; +cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", NULL, CVAR_ARCHIVE}; cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", NULL, CVAR_ARCHIVE}; cvar_t gl_subdivide_water = {"gl_subdivide_water", "0", NULL, CVAR_ARCHIVE}; +cvar_t vid_hardwaregamma = {"vid_hardwaregamma", "1", NULL, CVAR_ARCHIVE}; void GLRenderer_Init(void) { extern cvar_t gl_contrast; //screen Cvar_Register (&gl_triplebuffer, GLRENDEREROPTIONS); + Cvar_Register (&vid_hardwaregamma, GLRENDEREROPTIONS); + //model Cvar_Register (&gl_subdivide_size, GLRENDEREROPTIONS); Cvar_Register (&gl_subdivide_water, GLRENDEREROPTIONS); @@ -377,7 +380,6 @@ void R_InitTextures (void) void R_SetRenderer_f (void); -void R_RestartRenderer_f (void); void Renderer_Init(void) { @@ -558,6 +560,10 @@ void (*R_PushDlights) (void); void (*R_AddStain) (vec3_t org, float red, float green, float blue, float radius); void (*R_LessenStains) (void); +void (*Media_ShowFrameBGR_24_Flip) (qbyte *framedata, int inwidth, int inheight); //input is bottom up... +void (*Media_ShowFrameRGBA_32) (qbyte *framedata, int inwidth, int inheight); //top down +void (*Media_ShowFrame8bit) (qbyte *framedata, int inwidth, int inheight, qbyte *palette); //paletted topdown (framedata is 8bit indexes into palette) + void (*Mod_Init) (void); void (*Mod_ClearAll) (void); struct model_s *(*Mod_ForName) (char *name, qboolean crash); @@ -810,6 +816,10 @@ void R_SetRenderer(r_qrenderer_t wanted) VID_ShiftPalette = NULL; VID_GetRGBInfo = NULL; + Media_ShowFrame8bit = NULL; + Media_ShowFrameRGBA_32 = NULL; + Media_ShowFrameBGR_24_Flip = NULL; + #ifdef SWQUAKE //Any one of them that works. Mod_Init = SWMod_Init; Mod_Think = SWMod_Think; @@ -897,6 +907,10 @@ void R_SetRenderer(r_qrenderer_t wanted) VID_ShiftPalette = SWVID_ShiftPalette; VID_GetRGBInfo = SWVID_GetRGBInfo; + Media_ShowFrame8bit = MediaSW_ShowFrame8bit; + Media_ShowFrameRGBA_32 = MediaSW_ShowFrameRGBA_32; + Media_ShowFrameBGR_24_Flip = MediaSW_ShowFrameBGR_24_Flip; + Mod_Init = SWMod_Init; Mod_Think = SWMod_Think; Mod_ClearAll = SWMod_ClearAll; @@ -970,6 +984,10 @@ void R_SetRenderer(r_qrenderer_t wanted) VID_ShiftPalette = GLVID_ShiftPalette; VID_GetRGBInfo = GLVID_GetRGBInfo; + Media_ShowFrame8bit = MediaGL_ShowFrame8bit; + Media_ShowFrameRGBA_32 = MediaGL_ShowFrameRGBA_32; + Media_ShowFrameBGR_24_Flip = MediaGL_ShowFrameBGR_24_Flip; + Mod_Init = GLMod_Init; Mod_Think = GLMod_Think; Mod_ClearAll = GLMod_ClearAll; @@ -1037,7 +1055,6 @@ qboolean R_ApplyRenderer (rendererstate_t *newr) qbyte *data; isDedicated = false; v_oldgammavalue = -1; //force the gamma to be reset - V_CheckGamma(); Con_Printf("Setting mode %i*%i*%i*%i\n", newr->width, newr->height, newr->bpp, newr->rate); @@ -1096,6 +1113,8 @@ qboolean R_ApplyRenderer (rendererstate_t *newr) if (!VID_Init(newr, host_basepal)) return false; + GLV_UpdatePalette(); + v_oldgammavalue = -1; //force the gamma to be reset W_LoadWadFile("gfx.wad"); Draw_Init(); diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index acc97d9d7..ef13119d0 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -173,11 +173,11 @@ void S_Startup (void) for(;;) { sc = Z_Malloc(sizeof(soundcardinfo_t)); - if (snd_khz.value == 48) + if (snd_khz.value >= 45) sc->sn.speed = 48000; - else if (snd_khz.value == 44 || snd_khz.value == 44.100) + else if (snd_khz.value >= 30) //set by a slider sc->sn.speed = 44100; - else if (snd_khz.value == 22 || snd_khz.value == 22.050) + else if (snd_khz.value >= 20) sc->sn.speed = 22050; else sc->sn.speed = 11025; @@ -197,7 +197,7 @@ void S_Startup (void) break; } - if (sc->sn.numchannels == 2) + if (sc->sn.numchannels < 3) { sc->pitch[0] = 0; sc->pitch[1] = 0; @@ -206,7 +206,7 @@ void S_Startup (void) sc->yaw[0] = 270; sc->yaw[1] = 90; } - else if (sc->sn.numchannels == 4) + else if (sc->sn.numchannels < 5) { sc->pitch[0] = 0; sc->pitch[1] = 0; diff --git a/engine/client/snd_win.c b/engine/client/snd_win.c index 7ce0069bc..280d712da 100644 --- a/engine/client/snd_win.c +++ b/engine/client/snd_win.c @@ -436,11 +436,11 @@ sndinitstat SNDDMA_InitDirect (soundcardinfo_t *sc) sc->sn.samplebits = 16; if (!sc->sn.speed) { - if (snd_khz.value == 48) + if (snd_khz.value >= 45) sc->sn.speed = 48000; - else if (snd_khz.value == 44 || snd_khz.value == 44.1) + else if (snd_khz.value >= 30) //set by a slider sc->sn.speed = 44100; - else if (snd_khz.value == 22 || snd_khz.value == 22.05) + else if (snd_khz.value >= 20) sc->sn.speed = 22050; else sc->sn.speed = 11025; @@ -448,7 +448,7 @@ sndinitstat SNDDMA_InitDirect (soundcardinfo_t *sc) memset (&format, 0, sizeof(format)); - if (snd_speakers.value >= 6) //5.1 surround + if (snd_speakers.value >= 5) //5.1 surround { format.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; format.Format.cbSize = 22; @@ -457,7 +457,7 @@ sndinitstat SNDDMA_InitDirect (soundcardinfo_t *sc) format.dwChannelMask = KSAUDIO_SPEAKER_5POINT1; sc->sn.numchannels = 6; } - else if (snd_speakers.value >= 4) //4 speaker quad + else if (snd_speakers.value >= 3) //4 speaker quad { format.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; format.Format.cbSize = 22; @@ -466,7 +466,7 @@ sndinitstat SNDDMA_InitDirect (soundcardinfo_t *sc) format.dwChannelMask = KSAUDIO_SPEAKER_QUAD; sc->sn.numchannels = 4; } - else if (snd_speakers.value >= 2) //stereo + else if (snd_speakers.value >= 1.5) //stereo { format.Format.wFormatTag = WAVE_FORMAT_PCM; format.Format.cbSize = 0; diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index 7cf055246..ca96c0421 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -98,7 +98,6 @@ cvar_t sys_disableWinKeys = {"sys_disableWinKeys", "0"}; LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam) { KBDLLHOOKSTRUCT *pkbhs = (KBDLLHOOKSTRUCT *) lParam; - BOOL bControlKeyDown = 0; if (ActiveApp) switch (nCode) { diff --git a/engine/client/teamplay.c b/engine/client/teamplay.c index 94da3eefe..9843a235f 100644 --- a/engine/client/teamplay.c +++ b/engine/client/teamplay.c @@ -186,7 +186,6 @@ char *CL_LocationName(float *pos) #define INVIS_CHAR2 138 #define INVIS_CHAR3 160 -#ifdef ZQUAKETEAMPLAY /* =============== CL_Say @@ -194,63 +193,7 @@ CL_Say Handles both say and say_team =============== */ -void CL_Say (qboolean team) -{ - extern cvar_t cl_fakename; - char text[1024], sendtext[1024], *s; - if (Cmd_Argc() < 2) - { - if (team) - Con_Printf ("%s : send a team message\n", Cmd_Argv(0)); - return; - } - - if (cls.state == ca_disconnected) - { - Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0)); - return; - } - - MSG_WriteByte (&cls.netchan.message, clc_stringcmd); - SZ_Print (&cls.netchan.message, team ? "say_team " : "say "); - - s = TP_ParseMacroString (Cmd_Args()); - Q_strncpyz (text, TP_ParseFunChars (s, true), sizeof(text)); - - sendtext[0] = 0; - if (team && !cl.spectator && cl_fakename.string[0] && - !strchr(s, '\x0d') /* explicit $\ in message overrides cl_fakename */) - { - char buf[1024]; - Cmd_ExpandString (cl_fakename.string, buf); - strcpy (buf, TP_ParseMacroString (buf)); - Q_snprintfz (sendtext, sizeof(sendtext), "\x0d%s: ", TP_ParseFunChars(buf, true)); - } - - strlcat (sendtext, text, sizeof(sendtext)); - - if (sendtext[0] < 32) - SZ_Print (&cls.netchan.message, "\""); // add quotes so that old servers parse the message correctly - - SZ_Print (&cls.netchan.message, sendtext); - - if (sendtext[0] < 32) - SZ_Print (&cls.netchan.message, "\""); // add quotes so that old servers parse the message correctly -} - - -void CL_Say_f (void) -{ - CL_Say (false); -} - -void CL_SayTeam_f (void) -{ - CL_Say (true); -} - -#else void CL_Say_f (void) { char string[256]; @@ -400,11 +343,17 @@ void CL_Say_f (void) MSG_WriteChar(&cls.netchan.message, '\0'); } +void TP_Init(void) +{ +} + +void TP_CheckPickupSound(char *s, vec3_t org) +{ +} + + #endif - - - qboolean TP_SoundTrigger(char *message) //if there is a trigger there, play it. Return true if we found one, stripping off the file (it's neater that way). { char *strip; @@ -446,14 +395,3 @@ qboolean TP_SoundTrigger(char *message) //if there is a trigger there, play it. } return false; } - -void TP_Init(void) -{ -} - -void TP_CheckPickupSound(char *s, vec3_t org) -{ -} - - -#endif diff --git a/engine/client/valid.c b/engine/client/valid.c index c49a1feaf..2fdfc9e46 100644 --- a/engine/client/valid.c +++ b/engine/client/valid.c @@ -1,6 +1,8 @@ #include "quakedef.h" +#ifdef RGLQUAKE #include "glquake.h" //overkill +#endif #ifndef _WIN32 #include diff --git a/engine/client/view.c b/engine/client/view.c index aa1fa94f2..46587d5df 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "r_local.h" #endif +#include "winquake.h" + #ifdef FISH void R_RenderView_fisheye(void); cvar_t ffov = {"ffov", "160"}; @@ -294,7 +296,8 @@ cvar_t v_contrast = {"contrast", "1", NULL, CVAR_ARCHIVE}; qbyte gammatable[256]; // palette is sent through this -qbyte ramps[3][256]; +unsigned short ramps[3][256]; +extern qboolean gammaworks; float v_blend[4]; // rgba 0.0 - 1.0 /* void BuildGammaTable (float g) @@ -354,7 +357,7 @@ qboolean V_CheckGamma (void) return false; v_oldcontrastvalue = v_contrast.value; v_oldgammavalue = v_gamma.value; - + BuildGammaTable (v_gamma.value, v_contrast.value); vid.recalc_refdef = 1; // force a surface cache flush @@ -626,8 +629,8 @@ void GLV_UpdatePalette (void) { int i, j; qboolean new; - qbyte *basepal, *newpal; - qbyte pal[768]; +// qbyte *basepal, *newpal; +// qbyte pal[768]; float r,g,b,a; int ir, ig, ib; qboolean force; @@ -687,28 +690,16 @@ void GLV_UpdatePalette (void) if (ib > 255) ib = 255; - ramps[0][i] = gammatable[ir]; - ramps[1][i] = gammatable[ig]; - ramps[2][i] = gammatable[ib]; + ramps[0][i] = gammatable[ir]<<8; + ramps[1][i] = gammatable[ig]<<8; + ramps[2][i] = gammatable[ib]<<8; } - basepal = host_basepal; - newpal = pal; - - for (i=0 ; i<256 ; i++) + VID_ShiftPalette (NULL); + if (gammaworks) { - ir = basepal[0]; - ig = basepal[1]; - ib = basepal[2]; - basepal += 3; - - newpal[0] = ramps[0][ir]; - newpal[1] = ramps[1][ig]; - newpal[2] = ramps[2][ib]; - newpal += 3; + BuildGammaTable(1,1); } - - VID_ShiftPalette (pal); } #endif /* diff --git a/engine/client/wad.c b/engine/client/wad.c index 2800ca6c3..7a691fa07 100644 --- a/engine/client/wad.c +++ b/engine/client/wad.c @@ -511,11 +511,17 @@ void Mod_ParseInfoFromEntityLump(char *data) //actually, this should be in the m } } +//textures/fred.wad is the DP standard - I wanna go for that one. +//textures/halfline/fred.wad is what fuhquake can use (yuck). +//fred.wad is what half-life supports. + +//we only try one download, for textures/fred.wad +//but we will load wads from the other two paths if we have them locally. qboolean Wad_NextDownload (void) { - char wadname[4096]; + char wadname[4096+9]="textures/"; int i, j, k; - + if (*wads) //now go about checking the wads { j = 0; @@ -536,9 +542,12 @@ qboolean Wad_NextDownload (void) k = wads[i]; wads[i] = 0; strcpy(wadname, &wads[j]); - if (*wadname) - if (!CL_CheckOrDownloadFile(wadname, true)) - return false; + if (wadname[9]) + { + if (COM_FCheckExists(wadname+9)) //wad is in root dir, so we don't need to try textures. + if (!CL_CheckOrDownloadFile(wadname, true)) + return false; + } wads[i] = k; j = i+1; @@ -568,9 +577,14 @@ qboolean Wad_NextDownload (void) { k = wads[i]; wads[i] = 0; - strcpy(wadname, &wads[j]); - if (*wadname) - W_LoadTextureWadFile (wadname, false); + strcpy(wadname+9, &wads[j]); + if (wadname[9]) + { + if (COM_FCheckExists(wadname+9)) + W_LoadTextureWadFile (wadname+9, false); + else + W_LoadTextureWadFile (wadname, false); + } j = i+1; if (!k) break; diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index d503aabd0..241510412 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -33,10 +33,11 @@ #ifdef ZQUAKETEAMPLAY #include "quakedef.h" -#include "version.h" +//#include "version.h" #include "sound.h" //#include "pmove.h" #include +#include typedef qboolean qbool; @@ -50,12 +51,14 @@ typedef qboolean qbool; #define Q_stricmp stricmp #define Q_strnicmp strnicmp -#define isalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) +/*#define isalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) #define isdigit(x) ((x) >= '0' && (x) <= '9') #define isxdigit(x) (isdigit(x) || ((x) >= 'a' && (x) <= 'f')) - +*/ #define Q_rint(f) ((int)((f)+0.5)) +void Cmd_AddMacro(char *s, char *(*f)(void)); + #ifndef HAVE_STRLCAT size_t strlcat (char *dst, const char *src, size_t size) { @@ -402,19 +405,19 @@ char *Macro_BestAmmo (void) switch (_Macro_BestWeapon()) { case IT_SHOTGUN: case IT_SUPER_SHOTGUN: - sprintf(macro_buf, "%i", cl.stats[STAT_SHELLS]); + sprintf(macro_buf, "%i", cl.stats[0][STAT_SHELLS]); return macro_buf; case IT_NAILGUN: case IT_SUPER_NAILGUN: - sprintf(macro_buf, "%i", cl.stats[STAT_NAILS]); + sprintf(macro_buf, "%i", cl.stats[0][STAT_NAILS]); return macro_buf; case IT_GRENADE_LAUNCHER: case IT_ROCKET_LAUNCHER: - sprintf(macro_buf, "%i", cl.stats[STAT_ROCKETS]); + sprintf(macro_buf, "%i", cl.stats[0][STAT_ROCKETS]); return macro_buf; case IT_LIGHTNING: - sprintf(macro_buf, "%i", cl.stats[STAT_CELLS]); + sprintf(macro_buf, "%i", cl.stats[0][STAT_CELLS]); return macro_buf; default: @@ -518,7 +521,7 @@ char *Macro_Date (void) ptm = localtime (&t); if (!ptm) return "#bad date#"; - strftime (macro_buf, sizeof(macro_buf)-1, "%d.%m.%y", ptm); + strftime (macro_buf, sizeof(macro_buf)-1, "%d.%m.%Y", ptm); return macro_buf; } @@ -1037,7 +1040,7 @@ char *TP_LocationName (vec3_t location) float dist, mindist; vec3_t vec; static qbool recursive; - char *buf; + static char buf[1024]; if (!loc_numentries || (cls.state != ca_active)) return tp_name_someplace.string; @@ -1058,7 +1061,7 @@ char *TP_LocationName (vec3_t location) } recursive = true; - buf = Cmd_ExpandString (locdata[minnum].name, RESTRICT_LOCAL); + Cmd_ExpandString (locdata[minnum].name, buf, sizeof(buf), Cmd_ExecLevel); recursive = false; return buf; @@ -2431,5 +2434,73 @@ void TP_Init (void) Cmd_AddCommand ("tp_took", TP_Took_f); Cmd_AddCommand ("tp_pickup", TP_Pickup_f); Cmd_AddCommand ("tp_point", TP_Point_f); + + TP_InitMacros(); +} + + + + + + + + + +void CL_Say (qboolean team) +{ + extern cvar_t cl_fakename; + char text[1024], sendtext[1024], *s; + + if (Cmd_Argc() < 2) + { + if (team) + Con_Printf ("%s : send a team message\n", Cmd_Argv(0)); + return; + } + + if (cls.state == ca_disconnected) + { + Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0)); + return; + } + + MSG_WriteByte (&cls.netchan.message, clc_stringcmd); + SZ_Print (&cls.netchan.message, team ? "say_team " : "say "); + + s = TP_ParseMacroString (Cmd_Args()); + Q_strncpyz (text, TP_ParseFunChars (s, true), sizeof(text)); + + sendtext[0] = 0; + if (team && !cl.spectator && cl_fakename.string[0] && + !strchr(s, '\x0d') /* explicit $\ in message overrides cl_fakename */) + { + char buf[1024]; + Cmd_ExpandString (cl_fakename.string, buf, sizeof(buf), Cmd_ExecLevel); + strcpy (buf, TP_ParseMacroString (buf)); + Q_snprintfz (sendtext, sizeof(sendtext), "\x0d%s: ", TP_ParseFunChars(buf, true)); + } + + strlcat (sendtext, text, sizeof(sendtext)); + + if (sendtext[0] < 32) + SZ_Print (&cls.netchan.message, "\""); // add quotes so that old servers parse the message correctly + + SZ_Print (&cls.netchan.message, sendtext); + + if (sendtext[0] < 32) + SZ_Print (&cls.netchan.message, "\""); // add quotes so that old servers parse the message correctly +} + + +void CL_Say_f (void) +{ + CL_Say (false); +} + +void CL_SayTeam_f (void) +{ + CL_Say (true); } #endif + + diff --git a/engine/common/cmd.c b/engine/common/cmd.c index d3e6b6fb0..0dbab6858 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -80,7 +80,7 @@ void Cmd_AddMacro(char *s, char *(*f)(void)) macro_commands[macro_count++].func = f; } -char *TP_MacroString (char *s) +char *TP_MacroString (char *s, int *len) { int i; macro_command_t *macro; @@ -90,6 +90,8 @@ char *TP_MacroString (char *s) macro = ¯o_commands[i]; if (!Q_strcasecmp(s, macro->name)) { + if (len) + *len = strlen(macro->name); return macro->func(); } macro++; @@ -1000,8 +1002,7 @@ If not SERVERONLY, also expands $macro expressions Note: dest must point to a 1024 byte buffer ================ */ -char *TP_MacroString (char *s); -void Cmd_ExpandString (char *data, char *dest) +char *Cmd_ExpandString (char *data, char *dest, int destlen, int maxaccesslevel) { unsigned int c; char buf[255]; @@ -1009,10 +1010,9 @@ void Cmd_ExpandString (char *data, char *dest) cvar_t *var, *bestvar; int quotes = 0; char *str; - int name_length; -#ifndef SERVERONLY - extern int macro_length; -#endif + char *bestmacro; + int name_length, macro_length; + qboolean striptrailing; len = 0; @@ -1025,10 +1025,14 @@ void Cmd_ExpandString (char *data, char *dest) { data++; + striptrailing = *data == '-'; + // Copy the text after '$' to a temp buffer i = 0; buf[0] = 0; bestvar = NULL; + bestmacro = NULL; + macro_length=0; while ((c = *data) > 32) { if (c == '$') @@ -1036,33 +1040,37 @@ void Cmd_ExpandString (char *data, char *dest) data++; buf[i++] = c; buf[i] = 0; - if ( (var = Cvar_FindVar(buf)) != NULL ) - bestvar = var; + if ( (var = Cvar_FindVar(buf+striptrailing)) != NULL ) + { + if (var->restriction <= maxaccesslevel) + bestvar = var; + } +#ifdef SERVERONLY + if ((str = TP_MacroString (buf+striptrailing, ¯o_length))) + bestmacro = str; +#endif } -#ifndef SERVERONLY - if (dedicated) - str = NULL; - else { - str = TP_MacroString (buf); + if (bestmacro) + { + str = bestmacro; name_length = macro_length; } - if (bestvar && (!str || (strlen(bestvar->name) > macro_length))) { + else if (bestvar) + { str = bestvar->string; name_length = strlen(bestvar->name); } -#else - if (bestvar) { - str = bestvar->string; - name_length = strlen(bestvar->name); - } else + else + { str = NULL; -#endif + name_length = 0; + } if (str) { // check buffer size - if (len + strlen(str) >= 1024-1) + if (len + strlen(str) >= destlen-1) break; strcpy(&dest[len], str); @@ -1070,12 +1078,16 @@ void Cmd_ExpandString (char *data, char *dest) i = name_length; while (buf[i]) dest[len++] = buf[i++]; + + if (striptrailing && !*str) + while(*data <= ' ' && *data) + data++; } else { // no matching cvar or macro dest[len++] = '$'; - if (len + strlen(buf) >= 1024-1) + if (len + strlen(buf) >= destlen-1) break; strcpy (&dest[len], buf); len += strlen(buf); @@ -1086,12 +1098,14 @@ void Cmd_ExpandString (char *data, char *dest) dest[len] = c; data++; len++; - if (len >= 1024-1) + if (len >= destlen-1) break; } }; dest[len] = 0; + + return dest; } #else @@ -1153,7 +1167,7 @@ char *Cmd_ExpandString (char *input, int maxaccesslevel) } if (maxaccesslevel == RESTRICT_LOCAL) //don't expand without full rights. (prevents a few loopholes) { - macro = TP_MacroString(name); + macro = TP_MacroString(name, NULL); if (macro) { memmove(s+strlen(macro), s+i+1, len-c-i); @@ -1647,9 +1661,11 @@ void Cmd_ExecuteString (char *text, int level) cmd_function_t *cmd; cmdalias_t *a; + static char dest[8192]; + Cmd_ExecLevel = level; - text = Cmd_ExpandString(text, level); + text = Cmd_ExpandString(text, dest, sizeof(dest), level); Cmd_TokenizeString (text); // execute the command line diff --git a/engine/common/cmd.h b/engine/common/cmd.h index dbed22bf9..9a3b4c186 100644 --- a/engine/common/cmd.h +++ b/engine/common/cmd.h @@ -133,7 +133,7 @@ void Cmd_StuffCmds_f (void); void Cmd_ShiftArgs (int ammount); -char *Cmd_ExpandString (char *input, int maxaccesslevel); +char *Cmd_ExpandString (char *data, char *dest, int destlen, int maxaccesslevel); extern cvar_t rcon_level; diff --git a/engine/common/common.c b/engine/common/common.c index cf8e2994b..ec2a1515e 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -21,12 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -#ifdef SERVERONLY -#include "qwsvdef.h" -#else #include "quakedef.h" -#endif - diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 1939f1112..1b11420d5 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -1,5 +1,7 @@ #include "quakedef.h" +#ifdef RGLQUAKE #include "glquake.h" +#endif #define MAX_Q3MAP_INDICES 0x80000 #define MAX_Q3MAP_VERTEXES 0x80000 diff --git a/engine/common/huff.c b/engine/common/huff.c index d8beafa04..63d1d946b 100644 --- a/engine/common/huff.c +++ b/engine/common/huff.c @@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #define ID_INLINE -#define VALUE(a) ((int )(a)) -#define NODE(a) ((void *)(a)) +#define VALUE(a) (*(int *)&(a)) +#define NODE(a) ((void*)(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 a339b338b..878f38e61 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -499,7 +499,7 @@ qboolean Netchan_Process (netchan_t *chan) // if (reliable_ack == (unsigned)chan->reliable_sequence) chan->reliable_length = 0; // it has been received - + // // if this message contains a reliable message, bump incoming_reliable_sequence // diff --git a/engine/common/ui_public.h b/engine/common/ui_public.h index d0a803f90..bd28807c9 100644 --- a/engine/common/ui_public.h +++ b/engine/common/ui_public.h @@ -171,4 +171,4 @@ typedef enum { UI_GETVIDINFO = 504, UI_GET_STRING = 510, -} ui_builtinnum_t; \ No newline at end of file +} ui_builtinnum_t; diff --git a/engine/common/zone.c b/engine/common/zone.c index 9d89bf933..787dbf291 100644 --- a/engine/common/zone.c +++ b/engine/common/zone.c @@ -33,6 +33,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void Cache_FreeLow (int new_low_hunk); void Cache_FreeHigh (int new_high_hunk); +#ifdef _DEBUG +#define MEMDEBUG 8192 //Debugging adds sentinels (the number is the size - I have the ram) +#endif + +#ifndef MEMDEBUG +#define MEMDEBUG 0 //needs to be defined because it makes some bits of code simpler +#endif + +#if MEMDEBUG > 0 +qbyte sentinalkey; +#endif + @@ -123,10 +135,31 @@ int Z_Allocated(void) void Z_Free (void *c) { zone_t *nz; - nz = ((zone_t *)c)-1; + nz = ((zone_t *)((char*)c-MEMDEBUG))-1; // Z_CheckSentinals(); +#if MEMDEBUG>0 + { + int i; + qbyte *buf; + buf = (qbyte *)(nz+1); + for (i = 0; i < MEMDEBUG; i++) + { + if (buf[i] != sentinalkey) + *(int*)0 = -3; //force a crash... this'll get our attention. + } + buf+=MEMDEBUG; + //app data + buf += nz->size; + for (i = 0; i < MEMDEBUG; i++) + { + if (buf[i] != sentinalkey) + *(int*)0 = -3; //force a crash... this'll get our attention. + } + } +#endif + // if (nz->sentinal1 != ZONESENTINAL || nz->sentinal2 != ZONESENTINAL) // Sys_Error("zone was not z_malloced\n"); @@ -148,7 +181,7 @@ void Z_FreeTags(int tag) { next = zone->next; if (zone->tag == tag) - Z_Free(zone+1); + Z_Free((char*)(zone+1)+MEMDEBUG); } } @@ -176,9 +209,9 @@ void *Z_BaseTagMalloc (int size, int tag, qboolean clear) vsprintf (buffer, descrip,argptr); va_end (argptr); - nt = malloc(size + sizeof(zone_t)+strlen(buffer)+1); + nt = malloc(size + sizeof(zone_t)+strlen(buffer)+1 + MEMDEBUG*2); #else - nt = malloc(size + sizeof(zone_t)); + nt = malloc(size + sizeof(zone_t)+ MEMDEBUG*2); #endif if (!nt) Sys_Error("Z_BaseTagMalloc: failed on allocation of %i bytes", size); @@ -192,11 +225,18 @@ void *Z_BaseTagMalloc (int size, int tag, qboolean clear) zone_head->prev = nt; zone_head = nt; buf = (void *)(nt+1); + +#if MEMDEBUG > 0 + memset(buf, sentinalkey, MEMDEBUG); + buf = (char*)buf+MEMDEBUG; + memset((char*)buf+size, sentinalkey, MEMDEBUG); +#endif + if (clear) Q_memset(buf, 0, size); #ifdef NAMEDMALLOCS - strcpy((char *)(nt+1) + nt->size, buffer); + strcpy((char *)(nt+1) + nt->size + MEMDEBUG*2, buffer); #endif return buf; } @@ -253,8 +293,8 @@ void *BZ_Realloc(void *data, int newsize) zone_t *oldzone; void *newdata; if (!data) - return BZ_Malloc(newsize); - oldzone = ((zone_t *)data)-1; + return Z_Malloc(newsize); + oldzone = ((zone_t *)((char *)data-MEMDEBUG))-1; newdata = BZ_Malloc(newsize); if (oldzone->size < newsize) { @@ -863,11 +903,12 @@ Hunk_HighAllocName */ void *Hunk_HighAllocName (int size, char *name) { - hunk_t *h; - #ifdef _WIN32 Sys_Error("High hunk was disabled"); -#endif + return NULL; +#else + + hunk_t *h; if (size < 0) Sys_Error ("Hunk_HighAllocName: bad size: %i", size); @@ -901,6 +942,7 @@ void *Hunk_HighAllocName (int size, char *name) Q_strncpyz (h->name, name, sizeof(h->name)); return (void *)(h+1); +#endif } @@ -915,6 +957,9 @@ clears old temp. #ifdef _WIN32 typedef struct hnktemps_s { struct hnktemps_s *next; +#if MEMDEBUG>0 + int len; +#endif } hnktemps_t; hnktemps_t *hnktemps; @@ -924,7 +969,27 @@ void Hunk_TempFree(void) while (hnktemps) { +#if MEMDEBUG>0 + int i; + qbyte *buf; + buf = (qbyte *)(hnktemps+1); + for (i = 0; i < MEMDEBUG; i++) + { + if (buf[i] != sentinalkey) + *(int*)0 = -3; //force a crash... this'll get our attention. + } + buf+=MEMDEBUG; + //app data + buf += hnktemps->len; + for (i = 0; i < MEMDEBUG; i++) + { + if (buf[i] != sentinalkey) + *(int*)0 = -3; //force a crash... this'll get our attention. + } +#endif + nt = hnktemps->next; + free(hnktemps); hnktemps = nt; } @@ -938,6 +1003,19 @@ void *Hunk_TempAllocMore (int size) { void *buf; #ifdef _WIN32 +#if MEMDEBUG>0 + hnktemps_t *nt; + nt = malloc(size + sizeof(hnktemps_t) + MEMDEBUG*2); + nt->next = hnktemps; + nt->len = size; + hnktemps = nt; + buf = (void *)(nt+1); + memset(buf, sentinalkey, MEMDEBUG); + buf = (char *)buf + MEMDEBUG; + memset(buf, 0, size); + memset((char *)buf + size, sentinalkey, MEMDEBUG); + return buf; +#else hnktemps_t *nt; nt = malloc(size + sizeof(hnktemps_t)); nt->next = hnktemps; @@ -945,6 +1023,7 @@ void *Hunk_TempAllocMore (int size) buf = (void *)(nt+1); memset(buf, 0, size); return buf; +#endif #else if (!hunk_tempactive) @@ -1490,7 +1569,11 @@ void Memory_Init (void *buf, int size) hunk_size = size; hunk_low_used = 0; hunk_high_used = 0; - + +#if MEMDEBUG > 0 + sentinalkey = rand(); +#endif + Cache_Init (); #ifndef NOZONE diff --git a/engine/ftequake/ftequake.dsp b/engine/ftequake/ftequake.dsp index 970662779..473687077 100644 --- a/engine/ftequake/ftequake.dsp +++ b/engine/ftequake/ftequake.dsp @@ -51,7 +51,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /W3 /GX /O2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "SWQUAKE" /FR /YX /FD /c +# ADD CPP /nologo /G6 /W3 /GX /O2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "SWQUAKE" /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "NDEBUG" @@ -77,7 +77,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G6 /ML /W3 /Gm /GX /ZI /Od /I "../client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SWQUAKE" /FR".\Debug/" /Fp".\Debug/qwcl.pch" /YX /Fo".\Debug/" /Fd".\Debug/" /FD /c +# ADD CPP /nologo /G6 /ML /W3 /Gm /GX /ZI /Od /I "../client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SWQUAKE" /FR".\Debug/" /Fp".\Debug/qwcl.pch" /YX /Fo".\Debug/" /Fd".\Debug/" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -103,7 +103,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /D "AVAIL_OGGVORBIS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c +# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /D "AVAIL_OGGVORBIS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c # SUBTRACT CPP /X # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -132,7 +132,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\client" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /G6 /Gr /W3 /GX /O2 /Ob2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c +# ADD CPP /nologo /G6 /Gr /W3 /GX /O2 /Ob2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "NDEBUG" @@ -159,7 +159,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NQPROT" /D "_DEBUG" /D "GLQUAKE" /D "SERVERDLL" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c -# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "AVAIL_DX7" /Fr /Fp".\MDebug/qwcl.pch" /YX /FD /c +# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "AVAIL_DX7" /D "ZQUAKETEAMPLAY" /Fr /Fp".\MDebug/qwcl.pch" /YX"quakedef.h" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -170,7 +170,7 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../fteglqw.exe" # SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\MDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../ftemqw.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\MDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../ftemqw.exe" # SUBTRACT LINK32 /profile /pdb:none !ELSEIF "$(CFG)" == "ftequake - Win32 MRelease" @@ -188,7 +188,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NOSOUNDASM" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "SERVERDLL" /D "NQPROT" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c -# ADD CPP /nologo /G6 /GX /O2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /Fr /YX /FD /c +# ADD CPP /nologo /G6 /GX /O2 /I "..\client" /I "../libs/dxsdk7/include" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "GLQUAKE" /D "SWQUAKE" /D "AVAIL_DX7" /D "ZQUAKETEAMPLAY" /Fr /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "NDEBUG" @@ -215,7 +215,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NQPROT" /D "_DEBUG" /D "GLQUAKE" /D "SERVERDLL" /D "WIN32" /D "_WINDOWS" /D "Q2SERVER" /D "DYNAMIC_ENTS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c -# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "MINIMAL" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c +# ADD CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -244,7 +244,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /G6 /Gr /W3 /GX /O2 /Ob2 /I "..\client\gltod3d\sdk7\include" /I "..\client\gltod3d\D3DFrame" /I "..\dxsdk\sdk\inc" /I "..\scitech\include" /I "..\client" /D "NOSOUNDASM" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "SERVERDLL" /D "NQPROT" /D "WIN32" /D "_WINDOWS" /D "Q2SERVER" /D "DYNAMIC_ENTS" /FR /YX /FD /c -# ADD CPP /nologo /G6 /Gr /W3 /GX /O2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "MINIMAL" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c +# ADD CPP /nologo /G6 /Gr /W3 /GX /O2 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "NDEBUG" /D "_MBCS" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "NDEBUG" @@ -271,7 +271,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "MINIMAL" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c -# ADD CPP /nologo /G6 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "MINIMAL" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SERVERONLY" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c +# ADD CPP /nologo /G6 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "SERVERONLY" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -282,7 +282,7 @@ BSC32=bscmake.exe LINK32=link.exe # ADD BASE LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:windows /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../fteminglqw.exe" # SUBTRACT BASE LINK32 /pdb:none -# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../../fteminglqw.exe" +# ADD LINK32 comctl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /pdb:".\GLDebug/dglqwcl.pdb" /debug /machine:I386 /out:"../../fteqwsv.exe" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "ftequake - Win32 Release Dedicated Server" @@ -300,7 +300,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /ML /W3 /GX /ZI /Od /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "MINIMAL" /D "_DEBUG" /D "GLQUAKE" /D "WIN32" /D "_WINDOWS" /D "SERVERONLY" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c -# ADD CPP /nologo /G6 /ML /W3 /GX /O1 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /D "MINIMAL" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SERVERONLY" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c +# ADD CPP /nologo /G6 /ML /W3 /GX /O1 /I "..\client" /I "../common" /I "../server" /I "../gl" /I "../sw" /I "../qclib" /I "../libs" /I "../libs/dxsdk7/include" /D "MINIMAL" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "SERVERONLY" /FR".\GLDebug/" /Fp".\GLDebug/qwcl.pch" /YX /Fo".\GLDebug/" /Fd".\GLDebug/" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x809 /d "_DEBUG" @@ -6492,8 +6492,8 @@ SOURCE=..\client\winquake.rc !IF "$(CFG)" == "ftequake - Win32 Release" -# ADD BASE RSC /l 0x809 /i "\ftetgcvs\sourceforge\engine\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" -# ADD RSC /l 0x809 /i "\ftetgcvs\sourceforge\engine\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" /d "MINIMAL" +# ADD BASE RSC /l 0x809 /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" +# ADD RSC /l 0x809 /i "\ftetgcvs\source\client" /i "\ftetgcvs\temp\client" /i "\ftetgcvs\fte\QW\client" /d "MINIMAL" !ELSEIF "$(CFG)" == "ftequake - Win32 Debug" @@ -6529,6 +6529,10 @@ SOURCE=..\client\winquake.rc SOURCE=..\common\bothdefs.h # End Source File +# Begin Source File + +SOURCE=..\common\protocol.h +# End Source File # End Group # Begin Group "Resource Files" diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index 11558b7de..aae51fa25 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -135,15 +135,15 @@ static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float int temp; vec3_t *p1v, *p2v; vec3_t *p1n, *p2n; - (char *)p1v = (char *)p1 + p1->ofsverts; - (char *)p2v = (char *)p2 + p2->ofsverts; + p1v = (vec3_t *)((char *)p1 + p1->ofsverts); + p2v = (vec3_t *)((char *)p2 + p2->ofsverts); - (char *)p1n = (char *)p1 + p1->ofsnormals; - (char *)p2n = (char *)p2 + p2->ofsnormals; + p1n = (vec3_t *)((char *)p1 + p1->ofsnormals); + p2n = (vec3_t *)((char *)p2 + p2->ofsnormals); if (p1v == p2v || r_nolerp.value) { - (char *)mesh->normals_array = (char *)p1 + p1->ofsnormals; + mesh->normals_array = (vec3_t*)((char *)p1 + p1->ofsnormals); if (r_nolightdir.value) { for (i = 0; i < mesh->numvertexes; i++) @@ -375,18 +375,18 @@ static void R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int f numTempVertexCoords = inf->numverts; } - (char *)mesh->indexes = (char *)inf + inf->ofs_indexes; + mesh->indexes = (int*)((char *)inf + inf->ofs_indexes); mesh->numindexes = inf->numindexes; - (char *)mesh->st_array = (char *)inf + inf->ofs_st_array; + mesh->st_array = (vec2_t*)((char *)inf + inf->ofs_st_array); mesh->lmst_array = NULL; mesh->colors_array = tempColours; mesh->normals_array = tempNormals; mesh->xyz_array = tempVertexCoords; mesh->numvertexes = inf->numverts; - (char *)mesh->trneighbors = (char *)inf + inf->ofs_trineighbours; + mesh->trneighbors = (int *)((char *)inf + inf->ofs_trineighbours); - (char *)g1 = (char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame1; - (char *)g2 = (char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame2; + g1 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame1); + g2 = (galiasgroup_t*)((char *)inf + inf->groupofs + sizeof(galiasgroup_t)*frame2); if (g1 == g2) //lerping within group is only done if not changing group { @@ -610,7 +610,7 @@ static galiastexnum_t *GL_ChooseSkin(galiasinfo_t *inf, char *modelname, entity_ } else { - (char *)skins = (char *)inf + inf->ofsskins; + skins = (galiasskin_t*)((char *)inf + inf->ofsskins); if (e->skinnum >= 0 && e->skinnum < inf->numskins) skins += e->skinnum; @@ -1283,7 +1283,7 @@ void R_DrawGAliasModelLighting (entity_t *e) GL_DrawMesh(&mesh, NULL, 0, 0); if (inf->nextsurf) - (char *)inf = (char *)inf + inf->nextsurf; + inf = (galiasinfo_t*)((char *)inf + inf->nextsurf); else inf = NULL; } @@ -1356,7 +1356,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius) } if (inf->nextsurf) - (char *)inf = (char *)inf + inf->nextsurf; + inf = (galiasinfo_t*)((char *)inf + inf->nextsurf); else inf = NULL; } diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index 84a815088..76dda940c 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -49,6 +49,8 @@ unsigned char *d_15to8table; qboolean inited15to8; extern cvar_t crosshair, cl_crossx, cl_crossy, crosshaircolor; +static int filmtexture; + extern cvar_t gl_nobind; extern cvar_t gl_max_size; extern cvar_t gl_picmip; @@ -635,7 +637,6 @@ void GLDraw_ReInit (void) extern int alphaskytexture; extern int skyboxtex[6]; extern int lightmap_textures; - extern int filmtexture; int maxtexsize; @@ -1741,6 +1742,180 @@ void GL_Set2D (void) } } + + + + + +void MediaGL_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette) //bottom up +{ + if (!filmtexture) + { + filmtexture=texture_extension_number; + texture_extension_number++; + } + + GL_Set2D (); + + GL_Bind(filmtexture); + GL_Upload8Pal24(framedata, palette, inwidth, inheight, false, false); //we may need to rescale the image +// glTexImage2D (GL_TEXTURE_2D, 0, 3, roqfilm->width, roqfilm->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, framedata); +// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max); +// glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); + + glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(0, 0); + glTexCoord2f(0, 1); + glVertex2f(0, vid.height); + glTexCoord2f(1, 1); + glVertex2f(vid.width, vid.height); + glTexCoord2f(1, 0); + glVertex2f(vid.width, 0); + glEnd(); + glEnable(GL_ALPHA_TEST); + + + SCR_SetUpToDrawConsole(); + if (scr_con_current) + SCR_DrawConsole (false); + + M_Draw(0); +} + +void MediaGL_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight)//top down +{ + if (!filmtexture) + { + filmtexture=texture_extension_number; + texture_extension_number++; + } + + GL_Set2D (); + + GL_Bind(filmtexture); + GL_Upload32("", (unsigned *)framedata, inwidth, inheight, false, false); //we may need to rescale the image + + glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(0, 0); + glTexCoord2f(0, 1); + glVertex2f(0, vid.height); + glTexCoord2f(1, 1); + glVertex2f(vid.width, vid.height); + glTexCoord2f(1, 0); + glVertex2f(vid.width, 0); + glEnd(); + glEnable(GL_ALPHA_TEST); + + + SCR_SetUpToDrawConsole(); + if (scr_con_current) + SCR_DrawConsole (false); +} + + +void MediaGL_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight) +{ + //we need these as we resize it as we convert to rgba + extern int filmnwidth; + extern int filmnheight; + + int y, x; + + int v; + unsigned int f, fstep; + qbyte *src, *dest; + dest = uploadmemorybufferintermediate; + //change from bgr bottomup to rgba topdown + + if (inwidth*inheight > sizeofuploadmemorybufferintermediate/4) + Sys_Error("MediaGL_ShowFrameBGR_24_Flip: image too big (%i*%i)", inwidth, inheight); + + for (y=1 ; y<=filmnheight ; y++) + { + v = ((filmnheight - y)*(float)inheight/filmnheight); + src = framedata + v*(inwidth*3); + { + f = 0; + fstep = ((inwidth)*0x10000)/filmnwidth; + + for (x=filmnwidth ; x&3 ; x--) //do the odd ones first. (bigger condition) + { + *dest++ = src[(f>>16)*3+2]; + *dest++ = src[(f>>16)*3+1]; + *dest++ = src[(f>>16)*3+0]; + *dest++ = 255; + f += fstep; + } + for ( ; x ; x-=4) //loop through the remaining chunks. + { + dest[0] = src[(f>>16)*3+2]; + dest[1] = src[(f>>16)*3+1]; + dest[2] = src[(f>>16)*3+0]; + dest[3] = 255; + f += fstep; + + dest[4] = src[(f>>16)*3+2]; + dest[5] = src[(f>>16)*3+1]; + dest[6] = src[(f>>16)*3+0]; + dest[7] = 255; + f += fstep; + + dest[8] = src[(f>>16)*3+2]; + dest[9] = src[(f>>16)*3+1]; + dest[10] = src[(f>>16)*3+0]; + dest[11] = 255; + f += fstep; + + dest[12] = src[(f>>16)*3+2]; + dest[13] = src[(f>>16)*3+1]; + dest[14] = src[(f>>16)*3+0]; + dest[15] = 255; + f += fstep; + + dest += 16; + } + } + } + + if (!filmtexture) + { + filmtexture=texture_extension_number; + texture_extension_number++; + } + + GL_Set2D (); + + GL_Bind(filmtexture); + GL_Upload32("", (unsigned *)framedata, inwidth, inheight, false, false); //we may need to rescale the image + + glDisable(GL_BLEND); + glDisable(GL_ALPHA_TEST); + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(0, 0); + glTexCoord2f(0, 1); + glVertex2f(0, vid.height); + glTexCoord2f(1, 1); + glVertex2f(vid.width, vid.height); + glTexCoord2f(1, 0); + glVertex2f(vid.width, 0); + glEnd(); + glEnable(GL_ALPHA_TEST); + + + SCR_SetUpToDrawConsole(); + if (scr_con_current) + SCR_DrawConsole (false); +} + + + //==================================================================== /* diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index d904d31cd..810d9de9c 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -729,6 +729,8 @@ void GLMod_InitTextureDescs(char *mapname) if (advtexturedesc) BZ_Free(advtexturedesc); advtexturedesc = COM_LoadMallocFile(va("maps/shaders/%s.shaders", mapname)); + if (!advtexturedesc) + advtexturedesc = COM_LoadMallocFile(va("shaders/%s.shaders", mapname)); if (advtexturedesc) { mapsection = advtexturedesc; @@ -741,13 +743,14 @@ void GLMod_InitTextureDescs(char *mapname) defaultsection = GLMod_TD_Section(advtexturedesc, "default"); } } -void GLMod_LoadAdvancedTextureSection(char *section, char *name, int *base, int *norm, int *luma, int *alphamode, qboolean *cull) //fixme: add gloss +void GLMod_LoadAdvancedTextureSection(char *section, char *name, int *base, int *norm, int *luma, int *gloss, int *alphamode, qboolean *cull) //fixme: add gloss { char stdname[MAX_QPATH] = ""; char flatname[MAX_QPATH] = ""; char bumpname[MAX_QPATH] = ""; char normname[MAX_QPATH] = ""; char lumaname[MAX_QPATH] = ""; + char glossname[MAX_QPATH] = ""; section = GLMod_TD_Section(section, name); @@ -771,22 +774,29 @@ void GLMod_LoadAdvancedTextureSection(char *section, char *name, int *base, int section = COM_ParseToken(section); Q_strncpyz(stdname, com_token, sizeof(stdname)); } - else if (!stricmp(com_token, "flatmap") || !stricmp(com_token, "diffuse")) + else if (!stricmp(com_token, "flatmap") || !stricmp(com_token, "flat") + || !stricmp(com_token, "diffusemap") || !stricmp(com_token, "diffuse")) { section = COM_ParseToken(section); Q_strncpyz(flatname, com_token, sizeof(flatname)); } - else if (!stricmp(com_token, "bumpmap")) + else if (!stricmp(com_token, "bumpmap") || !stricmp(com_token, "bump")) { section = COM_ParseToken(section); Q_strncpyz(bumpname, com_token, sizeof(bumpname)); } - else if (!stricmp(com_token, "normalmap")) + else if (!stricmp(com_token, "normalmap") || !stricmp(com_token, "normal")) { section = COM_ParseToken(section); Q_strncpyz(normname, com_token, sizeof(normname)); } - else if (!stricmp(com_token, "luma") || !stricmp(com_token, "glow")) + else if (!stricmp(com_token, "glossmap") || !stricmp(com_token, "gloss")) + { + section = COM_ParseToken(section); + Q_strncpyz(glossname, com_token, sizeof(glossname)); + } + else if (!stricmp(com_token, "luma") || !stricmp(com_token, "glow") + || !stricmp(com_token, "ambient") || !stricmp(com_token, "ambientmap")) { section = COM_ParseToken(section); Q_strncpyz(lumaname, com_token, sizeof(lumaname)); @@ -806,6 +816,8 @@ void GLMod_LoadAdvancedTextureSection(char *section, char *name, int *base, int *norm = 0; if (luma) *luma = 0; + if (gloss) + *gloss = 0; if (!*stdname && !*flatname) return; @@ -834,21 +846,24 @@ void GLMod_LoadAdvancedTextureSection(char *section, char *name, int *base, int *base = Mod_LoadHiResTexture(flatname, true, false, true); if (luma && *lumaname) *luma = Mod_LoadHiResTexture(lumaname, true, true, true); + + if (*norm && gloss && *glossname && gl_specular.value) + *gloss = Mod_LoadHiResTexture(glossname, true, false, true); } -void GLMod_LoadAdvancedTexture(char *name, int *base, int *norm, int *luma, int *alphamode, qboolean *cull) //fixme: add gloss +void GLMod_LoadAdvancedTexture(char *name, int *base, int *norm, int *luma, int *gloss, int *alphamode, qboolean *cull) //fixme: add gloss { if (!gl_load24bit.value) return; if (mapsection) { - GLMod_LoadAdvancedTextureSection(mapsection, name,base,norm,luma,alphamode,cull); + GLMod_LoadAdvancedTextureSection(mapsection, name,base,norm,luma,gloss,alphamode,cull); if (*base) return; } if (defaultsection) - GLMod_LoadAdvancedTextureSection(defaultsection, name,base,norm,luma,alphamode,cull); + GLMod_LoadAdvancedTextureSection(defaultsection, name,base,norm,luma,gloss,alphamode,cull); } /* @@ -870,7 +885,7 @@ void GLMod_LoadTextures (lump_t *l) qbyte *base; GLMod_InitTextureDescs(loadname); - + if (!l->filelen) { loadmodel->textures = NULL; @@ -927,7 +942,8 @@ void GLMod_LoadTextures (lump_t *l) if (!R_AddBulleten(tx)) #endif { - GLMod_LoadAdvancedTexture(tx->name, &tx->gl_texturenum, &tx->gl_texturenumbumpmap, &tx->gl_texturenumfb, NULL, NULL); + tx->gl_texturenum = 0; + GLMod_LoadAdvancedTexture(tx->name, &tx->gl_texturenum, &tx->gl_texturenumbumpmap, &tx->gl_texturenumfb, &tx->gl_texturenumspec, NULL, NULL); if (tx->gl_texturenum) continue; @@ -953,9 +969,9 @@ void GLMod_LoadTextures (lump_t *l) if (r_fb_bmodels.value) { + _snprintf(altname, sizeof(altname)-1, "%s_luma", mt->name); if (gl_load24bit.value && r_fb_bmodels.value) { - _snprintf(altname, sizeof(altname)-1, "%s_luma", mt->name); tx->gl_texturenumfb = Mod_LoadReplacementTexture(altname, true, false); } if (!tx->gl_texturenumfb) //generate one (if possible). diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index c22538b46..86eca481e 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -2943,7 +2943,6 @@ void PPL_AddLight(dlight_t *dl) } } } - glStencilFunc( GL_ALWAYS, 1, ~0 ); glDisable(GL_BLEND); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); @@ -2997,6 +2996,8 @@ void PPL_AddLight(dlight_t *dl) glClear(GL_STENCIL_BUFFER_BIT); glDisable(GL_CULL_FACE); + glStencilFunc( GL_ALWAYS, 1, ~0 ); + qglStencilOpSeparateATI(GL_BACK, GL_KEEP, sincrw, GL_KEEP); qglStencilOpSeparateATI(GL_FRONT, GL_KEEP, sdecrw, GL_KEEP); PPL_RecursiveWorldNode(dl); @@ -3015,12 +3016,13 @@ void PPL_AddLight(dlight_t *dl) glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); - glCullFace(GL_BACK); qglActiveStencilFaceEXT(GL_BACK); glStencilOp(GL_KEEP, sincrw, GL_KEEP); + glStencilFunc( GL_ALWAYS, 1, ~0 ); qglActiveStencilFaceEXT(GL_FRONT); glStencilOp(GL_KEEP, sdecrw, GL_KEEP); + glStencilFunc( GL_ALWAYS, 1, ~0 ); PPL_RecursiveWorldNode(dl); PPL_DrawShadowMeshes(dl); @@ -3036,12 +3038,16 @@ void PPL_AddLight(dlight_t *dl) glEnable(GL_CULL_FACE); glStencilFunc( GL_EQUAL, 0, ~0 ); + qglActiveStencilFaceEXT(GL_BACK); + glStencilFunc( GL_EQUAL, 0, ~0 ); } else //your graphics card sucks and lacks efficient stencil shadow techniques. { //centered around 0. Will only be increased then decreased less. glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); + glStencilFunc( GL_ALWAYS, 1, ~0 ); + glCullFace(GL_BACK); glStencilOp(GL_KEEP, sincrw, GL_KEEP); PPL_RecursiveWorldNode(dl); @@ -3085,22 +3091,24 @@ void PPL_DrawWorld (void) dlight_t *l; int i; + vec3_t mins, maxs; + int maxshadowlights = gl_maxshadowlights.value; if (maxshadowlights < 1) maxshadowlights = 1; - if (qglGetError()) - Con_Printf("GL Error before world\n"); +// if (qglGetError()) +// Con_Printf("GL Error before world\n"); //glColorMask(0,0,0,0); PPL_BaseTextures(cl.worldmodel); - if (qglGetError()) - Con_Printf("GL Error during base textures\n"); +// if (qglGetError()) +// Con_Printf("GL Error during base textures\n"); //glColorMask(1,1,1,1); PPL_BaseEntTextures(); // CL_NewDlightRGB(1, r_refdef.vieworg[0], r_refdef.vieworg[1]-16, r_refdef.vieworg[2]-24, 128, 1, 1, 1, 1); - if (qglGetError()) - Con_Printf("GL Error on entities\n"); +// if (qglGetError()) +// Con_Printf("GL Error on entities\n"); if (r_shadows.value && glStencilFunc) { @@ -3114,6 +3122,18 @@ void PPL_DrawWorld (void) continue; //quick check for darklight if (!maxshadowlights--) break; + + mins[0] = l->origin[0] - l->radius; + mins[1] = l->origin[1] - l->radius; + mins[2] = l->origin[2] - l->radius; + maxs[0] = l->origin[0] + l->radius; + maxs[1] = l->origin[1] + l->radius; + maxs[2] = l->origin[2] + l->radius; + if (R_CullBox(mins, maxs)) + continue; + if (R_CullSphere(l->origin, l->radius)) + continue; + l->color[0]*=2.5; l->color[1]*=2.5; l->color[2]*=2.5; @@ -3130,13 +3150,13 @@ void PPL_DrawWorld (void) glDisableClientState(GL_VERTEX_ARRAY); } - if (qglGetError()) - Con_Printf("GL Error on shadow lighting\n"); +// if (qglGetError()) +// Con_Printf("GL Error on shadow lighting\n"); PPL_DrawEntFullBrights(); - if (qglGetError()) - Con_Printf("GL Error on fullbrights/details\n"); +// if (qglGetError()) +// Con_Printf("GL Error on fullbrights/details\n"); // Con_Printf("%i %i %i\n", shadowsurfcount, shadowedgecount, shadowlightfaces); shadowsurfcount = 0; diff --git a/engine/gl/gl_rlight.c b/engine/gl/gl_rlight.c index 4c9c7bc5d..29c16df74 100644 --- a/engine/gl/gl_rlight.c +++ b/engine/gl/gl_rlight.c @@ -405,9 +405,12 @@ void GLQ3_LightGrid(vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t vec3_t vf, vf2; vec3_t ambient, diffuse; - res_dir[0] = 1; - res_dir[1] = 1; - res_dir[2] = 0.1; + if (res_dir) + { + res_dir[0] = 1; + res_dir[1] = 1; + res_dir[2] = 0.1; + } if (!lg) { diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 94cf808f7..409eee022 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -156,6 +156,21 @@ qboolean R_CullBox (vec3_t mins, vec3_t maxs) return false; } +qboolean R_CullSphere (vec3_t org, float radius) +{ + //four frustrum planes all point inwards in an expanding 'cone'. + int i; + float d; + + for (i=0 ; i<4 ; i++) + { + d = DotProduct(frustum[i].normal, org)-frustum[i].dist; + if (d < -radius) + return true; + } + return false; +} + void R_RotateForEntity (entity_t *e) { diff --git a/engine/gl/gl_rmisc.c b/engine/gl/gl_rmisc.c index b20d91e1d..d810ddaad 100644 --- a/engine/gl/gl_rmisc.c +++ b/engine/gl/gl_rmisc.c @@ -453,7 +453,7 @@ void R_MakeTexWad_f(void) if (!scale) scale = 2; -// h = FindFirstFile(va("%s/textures/*.tga", com_gamedir), &fd); +// h = FindFirstFile(va("%s/textures/ *.tga", com_gamedir), &fd); //if this is uncommented, clear that space... (gcc warning fix) if (!shader) return; mip = BZ_Malloc(1024*1024); diff --git a/engine/gl/gl_rsurf.c b/engine/gl/gl_rsurf.c index 96acb78f4..09070bed3 100644 --- a/engine/gl/gl_rsurf.c +++ b/engine/gl/gl_rsurf.c @@ -3053,7 +3053,7 @@ int GLAllocBlock (int w, int h, int *x, int *y) } if (!lightmap[texnum]) { - lightmap[texnum] = BZ_Malloc(sizeof(*lightmap[texnum])); + lightmap[texnum] = Z_Malloc(sizeof(*lightmap[texnum])); } diff --git a/engine/gl/gl_vidnt.c b/engine/gl/gl_vidnt.c index 5eac66fbe..d85487e84 100644 --- a/engine/gl/gl_vidnt.c +++ b/engine/gl/gl_vidnt.c @@ -88,6 +88,8 @@ extern qboolean mouseactive; // from in_win.c static HICON hIcon; extern qboolean vid_isfullscreen; +unsigned short origionalgammaramps[3][256]; + #ifdef SWQUAKE extern #endif @@ -155,6 +157,7 @@ extern cvar_t vid_nopageflip; extern cvar_t _vid_wait_override; extern cvar_t vid_stretch_by_2; extern cvar_t _windowed_mouse; +extern cvar_t vid_hardwaregamma; int window_center_x, window_center_y, window_x, window_y, window_width, window_height; RECT window_rect; @@ -591,6 +594,9 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette) vid.recalc_refdef = 1; + maindc = GetDC(mainwindow); + GetDeviceGammaRamp(maindc, origionalgammaramps); + if (!VID_AttachGL(info)) return false; @@ -819,15 +825,22 @@ void GLVID_SetPalette (unsigned char *palette) d_8to24rgbtable[255] &= 0xffffff; // 255 is transparent } -BOOL gammaworks; +qboolean gammaworks; void GLVID_ShiftPalette (unsigned char *palette) { -// extern qbyte ramps[3][256]; + extern unsigned short ramps[3][256]; // VID_SetPalette (palette); -// gammaworks = SetDeviceGammaRamp (maindc, ramps); + if (vid_hardwaregamma.value) //this is needed because ATI drivers don't work properly. + gammaworks = !!SetDeviceGammaRamp (maindc, ramps); + else + gammaworks = false; + if (!gammaworks) + { + SetDeviceGammaRamp(maindc, origionalgammaramps); + } } @@ -839,6 +852,8 @@ void VID_SetDefaultMode (void) void GLVID_Shutdown (void) { + SetDeviceGammaRamp(maindc, origionalgammaramps); + VID_UnSetMode(); } @@ -1258,7 +1273,8 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) vid.maxwarpheight = WARP_HEIGHT; vid.colormap = host_colormap; - DestroyWindow (hwnd_dialog); + if (hwnd_dialog) + DestroyWindow (hwnd_dialog); Check_Gamma(palette, 0); VID_SetPalette (palette); @@ -1269,8 +1285,6 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) return false; } - maindc = GetDC(mainwindow); - // Check for 3DFX Extensions and initialize them. VID_Init8bitPalette(); diff --git a/engine/gl/glquake.h b/engine/gl/glquake.h index 19ba018ea..920ae4368 100644 --- a/engine/gl/glquake.h +++ b/engine/gl/glquake.h @@ -34,12 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define APIENTRY #endif -// typedef qbyte pal77[128][128]; -// pal77 *pal777to8; -qbyte *palxxxto8; -int palmask[3]; -int palshift[3]; - void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs); qboolean BoundsIntersect (vec3_t mins1, vec3_t maxs1, vec3_t mins2, vec3_t maxs2); void ClearBounds (vec3_t mins, vec3_t maxs); @@ -257,6 +251,7 @@ void GL_Set2D (void); // gl_rmain.c // qboolean R_CullBox (vec3_t mins, vec3_t maxs); +qboolean R_CullSphere (vec3_t origin, float radius); void R_RotateForEntity (entity_t *e); void R_DrawAliasModel (entity_t *e); diff --git a/engine/gl/gltod3d/gl_fakegl.cpp b/engine/gl/gltod3d/gl_fakegl.cpp index 5cc36bba3..347e6d228 100644 --- a/engine/gl/gltod3d/gl_fakegl.cpp +++ b/engine/gl/gltod3d/gl_fakegl.cpp @@ -56,6 +56,7 @@ the fact that it uses wrapper functions to call methods in a class could be a re #define D3D_OVERLOADS #define RELEASENULL(object) if (object) {object->Release();} +#include "dxsdk7/include/ddraw.h" #include "dxsdk7/include/d3d.h" #include "dxsdk7/include/d3dx.h" diff --git a/engine/http/ftpserver.c b/engine/http/ftpserver.c index 03eaccac4..24805a534 100644 --- a/engine/http/ftpserver.c +++ b/engine/http/ftpserver.c @@ -167,7 +167,6 @@ int SendFileNameTo(char *fname, int size, void *socket) int FTP_SV_makelistensocket(unsigned long blocking) { char name[256]; - unsigned long _true = true; int sock; struct hostent *hent; @@ -264,7 +263,6 @@ iwboolean FTP_ServerThinkForConnection(FTPclient_t *cl) struct sockaddr_in from; int fromlen; char *msg, *line; -unsigned long _true = true; char mode[64]; static char resource[8192]; diff --git a/engine/http/httpserver.c b/engine/http/httpserver.c index 99133fb22..5b1cf6e48 100644 --- a/engine/http/httpserver.c +++ b/engine/http/httpserver.c @@ -47,7 +47,7 @@ static qboolean httpserverinitied = false; static int httpserversocket; -typedef enum {HTTP_WAITINGFORREQUEST,HTTP_SENDING,HTTP_RECEIVING} http_mode_t; +typedef enum {HTTP_WAITINGFORREQUEST,HTTP_SENDING} http_mode_t; @@ -391,7 +391,7 @@ cont: else if (HTTPmarkup) sprintf(resource, "HTTP/0.9 200 OK\r\n\r\n"); else - sprintf(resource, ""); + strcpy(resource, ""); msg = resource; if (*mode == 'H' || *mode == 'h') diff --git a/engine/qclib/hash.c b/engine/qclib/hash.c index deab730ca..7fc6e440e 100644 --- a/engine/qclib/hash.c +++ b/engine/qclib/hash.c @@ -113,7 +113,7 @@ void *Hash_AddKey(hashtable_t *table, int key, void *data) buck = qccHunkAlloc(sizeof(bucket_t)); buck->data = data; - (int)buck->keystring = key; + buck->keystring = (char*)key; buck->next = table->bucket[bucknum]; table->bucket[bucknum] = buck; @@ -125,7 +125,7 @@ void *Hash_AddKey2(hashtable_t *table, int key, void *data, bucket_t *buck) int bucknum = key%table->numbuckets; buck->data = data; - (int)buck->keystring = key; + buck->keystring = (char*)key; buck->next = table->bucket[bucknum]; table->bucket[bucknum] = buck; diff --git a/engine/qclib/initlib.c b/engine/qclib/initlib.c index cd790c9b0..d31d25e4d 100644 --- a/engine/qclib/initlib.c +++ b/engine/qclib/initlib.c @@ -68,35 +68,18 @@ int PR_InitEnts(progfuncs_t *progfuncs, int max_ents) pr_max_edict_size = pr_edict_size; -#ifdef DYNAMIC_ENTS prinst->edicttable = PRHunkAlloc(progfuncs, maxedicts*sizeof(struct edicts_s *)); sv_edicts = PRHunkAlloc(progfuncs, pr_edict_size); prinst->edicttable[0] = sv_edicts; sv_num_edicts = 1; -#else - sv_edicts = PRHunkAlloc(progfuncs, (pr_edict_size) * maxedicts); - - {int a; - for (a = 1; a < maxedicts; a++) - { - ((edictrun_t*)EDICT_NUM(progfuncs, a))->isfree = true; - ((edictrun_t*)EDICT_NUM(progfuncs, a))->freetime = 0; - } - } -#endif - - - sv_num_edicts = 1; return pr_edict_size; } char tempedicts[2048]; //used as a safty buffer void PR_Configure (progfuncs_t *progfuncs, void *mem, int mem_size, int max_progs) //can be used to wipe all memory { -#ifdef DYNAMIC_ENTS int i; edictrun_t *e; -#endif // int a; pr_max_edict_size=0; @@ -105,16 +88,14 @@ void PR_Configure (progfuncs_t *progfuncs, void *mem, int mem_size, int max_prog QC_StartShares(progfuncs); QC_InitShares(progfuncs); -#ifdef DYNAMIC_ENTS for ( i=1 ; iedicttable[i]; + e = (edictrun_t *)(prinst->edicttable[i]); prinst->edicttable[i] = NULL; // e->entnum = i; if (e) memfree(e); } -#endif PRHunkFree(progfuncs, 0); //clear mem - our hunk may not be a real hunk. @@ -452,17 +433,14 @@ void CloseProgs(progfuncs_t *inst) extensionbuiltin_t *eb; void (VARGS *f) (void *); -#ifdef DYNAMIC_ENTS int i; edictrun_t *e; -#endif f = inst->parms->memfree; -#ifdef DYNAMIC_ENTS for ( i=1 ; imaxedicts; i++) { - (struct edict_s *)e = inst->prinst->edicttable[i]; + e = (edictrun_t *)(inst->prinst->edicttable[i]); inst->prinst->edicttable[i] = NULL; if (e) { @@ -470,7 +448,6 @@ void CloseProgs(progfuncs_t *inst) f(e); } } -#endif PRHunkFree(inst, 0); while(inst->prinst->extensionbuiltin) diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 398f525ff..a18b6617f 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -91,12 +91,8 @@ struct edict_s *ED_Alloc (progfuncs_t *progfuncs) { if (!e) { - if (e) - memfree(e); -#ifdef DYNAMIC_ENTS - prinst->edicttable[i] = (struct edict_s *)e = (void*)memalloc(pr_edict_size); + prinst->edicttable[i] = *(struct edict_s **)&e = (void*)memalloc(pr_edict_size); e->entnum = i; -#endif } ED_ClearEdict (progfuncs, e); @@ -118,12 +114,8 @@ struct edict_s *ED_Alloc (progfuncs_t *progfuncs) { if (!e) { - if (e) - memfree(e); - #ifdef DYNAMIC_ENTS - prinst->edicttable[i] = (struct edict_s *)e = (void*)memalloc(pr_edict_size); + prinst->edicttable[i] = *(struct edict_s **)&e = (void*)memalloc(pr_edict_size); e->entnum = i; - #endif } ED_ClearEdict (progfuncs, e); @@ -140,13 +132,13 @@ struct edict_s *ED_Alloc (progfuncs_t *progfuncs) sv_num_edicts++; e = (edictrun_t*)EDICT_NUM(progfuncs, i); -#ifdef DYNAMIC_ENTS + if (!e) { - prinst->edicttable[i] = (struct edict_s *)e = (void*)memalloc(pr_edict_size); + prinst->edicttable[i] = *(struct edict_s **)&e = (void*)memalloc(pr_edict_size); e->entnum = i; } -#endif + ED_ClearEdict (progfuncs, e); if (externs->entspawn) @@ -1545,14 +1537,13 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags) for (num = 0; num < numents; num++) { ed = (edictrun_t *)EDICT_NUM(progfuncs, num); -#ifdef DYNAMIC_ENTS + if (!ed) { - prinst->edicttable[num] = (struct edict_s *)ed = (void*)memalloc(pr_edict_size); + prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(pr_edict_size); ed->entnum = num; ed->isfree = true; } -#endif } } @@ -1566,21 +1557,20 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags) else { ed = (edictrun_t *)EDICT_NUM(progfuncs, num); -#ifdef DYNAMIC_ENTS + if (!ed) { Sys_Error("Edict was not allocated\n"); - prinst->edicttable[num] = (struct edict_s *)ed = (void*)memalloc(pr_edict_size); + prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(pr_edict_size); ed->entnum = num; } -#endif } ed->isfree = false; file = ED_ParseEdict(progfuncs, file, ed); if (killonspawnflags) { - var = GetEdictFieldValue (progfuncs, (struct edict_s *)ed, "spawnflags", &spawnflagscache); + var = GetEdictFieldValue (progfuncs, (struct edict_s *)&ed, "spawnflags", &spawnflagscache); if (var) { if ((int)var->_float & (int)killonspawnflags) @@ -1660,14 +1650,13 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags) for (num = 0; num < numents; num++) { ed = (edictrun_t *)EDICT_NUM(progfuncs, num); -#ifdef DYNAMIC_ENTS + if (!ed) { - prinst->edicttable[num] = (struct edict_s *)ed = (void*)memalloc(pr_edict_size); + prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(pr_edict_size); ed->entnum = num; ed->isfree = true; } -#endif } } @@ -1818,14 +1807,13 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags) else { ed = (edictrun_t *)EDICT_NUM(progfuncs, numents); -#ifdef DYNAMIC_ENTS if (!ed) { - prinst->edicttable[numents] = (struct edict_s *)ed = (void*)memalloc(pr_edict_size); + prinst->edicttable[numents] = *(struct edict_s **)&ed = (void*)memalloc(pr_edict_size); ed->entnum = numents; ed->isfree = true; } -#endif + sv_num_edicts = numents; ed->isfree = false; file = ED_ParseEdict (progfuncs, file, ed); @@ -1842,14 +1830,13 @@ int LoadEnts(progfuncs_t *progfuncs, char *file, float killonspawnflags) for (num = 0; num < numents; num++) { ed = (edictrun_t *)EDICT_NUM(progfuncs, num); -#ifdef DYNAMIC_ENTS + if (!ed) { - prinst->edicttable[num] = (struct edict_s *)ed = (void*)memalloc(pr_edict_size); + prinst->edicttable[num] = *(struct edict_s **)&ed = (void*)memalloc(pr_edict_size); ed->entnum = num; ed->isfree = true; } -#endif } } @@ -2220,9 +2207,9 @@ retry: fnc = pr_functions = (dfunction_t *)((qbyte *)pr_progs + pr_progs->ofs_functions); pr_strings = ((char *)pr_progs + pr_progs->ofs_strings); - gd16 = pr_globaldefs16 = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_globaldefs); - fld16 = pr_fielddefs16 = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_fielddefs); - pr_statements16 = (dstatement16_t *)((qbyte *)pr_progs + pr_progs->ofs_statements); + current_progstate->globaldefs = *(void**)&gd16 = (void *)((qbyte *)pr_progs + pr_progs->ofs_globaldefs); + current_progstate->fielddefs = *(void**)&fld16 = (void *)((qbyte *)pr_progs + pr_progs->ofs_fielddefs); + current_progstate->statements = (void *)((qbyte *)pr_progs + pr_progs->ofs_statements); glob = pr_globals = (void *)((qbyte *)pr_progs + pr_progs->ofs_globals); @@ -2252,7 +2239,7 @@ retry: s = PRHunkAlloc(progfuncs, len); QC_decode(progfuncs, LittleLong(*(int *)pr_statements16), len, 2, (char *)(((int *)pr_statements16)+1), s); - pr_statements16 = (dstatement16_t *)s; + current_progstate->statements = (dstatement16_t *)s; } if (pr_progs->blockscompressed & 2) //global defs { @@ -2270,7 +2257,7 @@ retry: s = PRHunkAlloc(progfuncs, len); QC_decode(progfuncs, LittleLong(*(int *)pr_globaldefs16), len, 2, (char *)(((int *)pr_globaldefs16)+1), s); - gd16 = pr_globaldefs16 = (ddef16_t *)s; + gd16 = *(ddef16_t**)¤t_progstate->globaldefs = (ddef16_t *)s; } if (pr_progs->blockscompressed & 4) //fields { @@ -2288,7 +2275,7 @@ retry: s = PRHunkAlloc(progfuncs, len); QC_decode(progfuncs, LittleLong(*(int *)pr_fielddefs16), len, 2, (char *)(((int *)pr_fielddefs16)+1), s); - pr_fielddefs16 = (ddef16_t *)s; + *(ddef16_t**)¤t_progstate->fielddefs = (ddef16_t *)s; } if (pr_progs->blockscompressed & 8) //functions { @@ -2312,7 +2299,7 @@ retry: s = PRHunkAlloc(progfuncs, len); QC_decode(progfuncs, LittleLong(*(int *)pr_globals), len, 2, (char *)(((int *)pr_globals)+1), s); - glob = pr_globals = (float *)s; + glob = current_progstate->globals = (float *)s; } if (pr_progs->ofslinenums && pr_progs->blockscompressed & 64) //line numbers { @@ -2334,7 +2321,7 @@ retry: pr_functions = fnc; // pr_strings = ((char *)pr_progs + pr_progs->ofs_strings); - gd16 = pr_globaldefs16 = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_globaldefs); + gd16 = *(ddef16_t**)¤t_progstate->globaldefs = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_globaldefs); fld16 = (ddef16_t *)((qbyte *)pr_progs + pr_progs->ofs_fielddefs); // pr_statements16 = (dstatement16_t *)((qbyte *)pr_progs + pr_progs->ofs_statements); pr_globals = glob; @@ -2371,14 +2358,14 @@ retry: if (!strncmp(fnc[i].s_name+4, eb->name+1, strlen(eb->name+1))) { fnc[i].first_statement = -0x7fffffff; - (void*)fnc[i].profile = (void*)eb->func; + *(void**)&fnc[i].profile = (void*)eb->func; break; } } else if (!strcmp(fnc[i].s_name+4, eb->name)) { fnc[i].first_statement = -0x7fffffff; - (void*)fnc[i].profile = (void*)eb->func; + *(void**)&fnc[i].profile = (void*)eb->func; break; } } @@ -2655,7 +2642,7 @@ retry: isfriked = false; } else - (char *)((int *)glob)[gd16[i].ofs] = NULL; + *(char **)&((int *)glob)[gd16[i].ofs] = NULL; } break; case ev_function: @@ -2718,7 +2705,7 @@ retry: isfriked = false; } else if (isfriked != -1) - (char *)((int *)glob)[pr_globaldefs32[i].ofs] = NULL; + *(char **)&((int *)glob)[pr_globaldefs32[i].ofs] = NULL; break; case ev_function: @@ -2777,27 +2764,14 @@ struct edict_s *EDICT_NUM(progfuncs_t *progfuncs, int n) { if (n < 0 || n >= maxedicts) Sys_Error ("QCLIB: EDICT_NUM: bad number %i", n); -#ifdef DYNAMIC_ENTS + return prinst->edicttable[n]; -#else - return (struct edict_s *)((qbyte *)sv_edicts+ (n)*pr_edict_size); -#endif } int NUM_FOR_EDICT(progfuncs_t *progfuncs, struct edict_s *e) { -#ifdef DYNAMIC_ENTS edictrun_t *er = (edictrun_t*)e; if (er->entnum < 0 || er->entnum >= maxedicts) Sys_Error ("QCLIB: NUM_FOR_EDICT: bad pointer (%i)", e); return er->entnum; -#else - int b; - b = (qbyte *)e - (qbyte *)sv_edicts; - b = b / pr_edict_size; - - if (b < 0 || b >= sv_num_edicts) - Sys_Error ("QCLIB: NUM_FOR_EDICT: bad pointer (%i)", b); - return b; -#endif } diff --git a/engine/qclib/progsint.h b/engine/qclib/progsint.h index 0c724c3bf..c3773c61b 100644 --- a/engine/qclib/progsint.h +++ b/engine/qclib/progsint.h @@ -32,8 +32,6 @@ typedef unsigned char qbyte; #define PROGSUSED #endif -#define DYNAMIC_ENTS - extern int maxedicts; extern int maxprogs; extern int hunksize; @@ -412,10 +410,7 @@ var(int, hunksize); var(extensionbuiltin_t *, extensionbuiltin); #define extensionbuiltin prinst->extensionbuiltin -#ifdef DYNAMIC_ENTS struct edict_s **edicttable; -#endif - } prinst_t; extern vec3_t vec3_origin; diff --git a/engine/qclib/progslib.h b/engine/qclib/progslib.h index dcd085602..115f7dbcf 100644 --- a/engine/qclib/progslib.h +++ b/engine/qclib/progslib.h @@ -231,11 +231,7 @@ typedef union eval_s #define PR_RegisterBuiltin(pf, name, func) (*pf->RegisterBuiltin) (pf, name, func) -//#ifdef DYNAMIC_ENTS #define NEXT_EDICT(pf,o) EDICT_NUM(pf, NUM_FOR_EDICT(pf, o)+1) -/*#else -#define NEXT_EDICT(pf, o) (edict_t *)(((char *)o)+ pr_edict_size) -#endif*/ #define RETURN_EDICT(pf, e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(pf, e)) diff --git a/engine/qclib/qcc_cmdlib.c b/engine/qclib/qcc_cmdlib.c index c1fa9a97a..d28ca1078 100644 --- a/engine/qclib/qcc_cmdlib.c +++ b/engine/qclib/qcc_cmdlib.c @@ -1,6 +1,7 @@ // cmdlib.c #include "qcc.h" +#include //#include #define PATHSEPERATOR '/' diff --git a/engine/qclib/qcc_pr_comp.c b/engine/qclib/qcc_pr_comp.c index f2997475e..0a88f52b4 100644 --- a/engine/qclib/qcc_pr_comp.c +++ b/engine/qclib/qcc_pr_comp.c @@ -4886,7 +4886,7 @@ void QCC_PR_ParseState (void) void QCC_PR_ParseAsm(void) { QCC_dstatement_t *patch1; - int op; + int op, p; QCC_def_t *a, *b, *c; if (QCC_PR_Check("local")) @@ -4905,34 +4905,34 @@ QCC_dstatement_t *patch1; { if (pr_opcodes[op].type_a==NULL) { - (short)(int)a = (short)pr_immediate._float; + p = (short)pr_immediate._float; QCC_PR_Lex(); patch1 = &statements[numstatements]; QCC_PR_Statement3(&pr_opcodes[op], NULL, NULL, NULL); - patch1->a = (short)(int)a; + patch1->a = (short)(int)p; } else if (pr_opcodes[op].type_b==NULL) { a = QCC_PR_ParseValue(pr_classtype); - (short)(int)b = (short)pr_immediate._float; + p = (short)pr_immediate._float; QCC_PR_Lex(); patch1 = &statements[numstatements]; QCC_PR_Statement3(&pr_opcodes[op], a, NULL, NULL); - patch1->b = (short)(int)b; + patch1->b = (short)(int)p; } else { a = QCC_PR_ParseValue(pr_classtype); b = QCC_PR_ParseValue(pr_classtype); - (short)(int)c = (short)pr_immediate._float; + p = (short)pr_immediate._float; QCC_PR_Lex(); patch1 = &statements[numstatements]; QCC_PR_Statement3(&pr_opcodes[op], a, b, NULL); - patch1->c = (short)(int)c; + patch1->c = (short)(int)p; } } else @@ -5082,7 +5082,7 @@ void QCC_CompoundJumps(int first, int last) } while (statements[statement].op == OP_GOTO) { - (signed)statements[st].a = statement+statements[statement].a - st; + *(signed*)&statements[st].a = statement+statements[statement].a - st; statement = st + (signed)statements[st].a; optres_compound_jumps++; } @@ -5092,7 +5092,7 @@ void QCC_CompoundJumps(int first, int last) statement = st + (signed)statements[st].b; while (statements[statement].op == OP_GOTO) { - (signed)statements[st].b = statement+statements[statement].a - st; + *(signed*)&statements[st].b = statement+statements[statement].a - st; statement = st + (signed)statements[st].b; optres_compound_jumps++; } @@ -5102,7 +5102,7 @@ void QCC_CompoundJumps(int first, int last) statement = st + (signed)statements[st].c; while (statements[statement].op == OP_GOTO) { - (signed)statements[st].c = statement+statements[statement].a - st; + *(signed*)&statements[st].c = statement+statements[statement].a - st; statement = st + (signed)statements[st].c; optres_compound_jumps++; } @@ -5479,7 +5479,7 @@ QCC_function_t *QCC_PR_ParseImmediateStatements (QCC_type_t *type) { if (!strcmp(pr_gotos[i].name, pr_labels[j].name)) { - (signed int)statements[pr_gotos[i].statementno].a += pr_labels[j].statementno - pr_gotos[i].statementno; + *(signed int*)&statements[pr_gotos[i].statementno].a += pr_labels[j].statementno - pr_gotos[i].statementno; break; } } @@ -6295,7 +6295,7 @@ void QCC_PR_ParseDefs (char *classname) i>>=1; } if (bits != 1) - QCC_PR_ParseWarning(WARN_ENUMFLAGS_NOTBINARY, "enumflags - %i not a binary value", (int)v); + QCC_PR_ParseWarning(WARN_ENUMFLAGS_NOTBINARY, "enumflags - value %i not a single bit", (int)v); } QCC_PR_Lex(); } diff --git a/engine/qclib/qcc_pr_lex.c b/engine/qclib/qcc_pr_lex.c index b5f95ad7e..b77c50583 100644 --- a/engine/qclib/qcc_pr_lex.c +++ b/engine/qclib/qcc_pr_lex.c @@ -1069,7 +1069,7 @@ float QCC_PR_LexFloat (void) len++; pr_file_p++; c = *pr_file_p; - } while ((c >= '0' && c<= '9') || c == '.'&&pr_file_p[1]!='.'); + } while ((c >= '0' && c<= '9') || (c == '.'&&pr_file_p[1]!='.')); //only allow a . if the next isn't too... pr_token[len] = 0; return (float)atof (pr_token); } diff --git a/engine/qclib/qccmain.c b/engine/qclib/qccmain.c index fef38e2e1..da6e620f3 100644 --- a/engine/qclib/qccmain.c +++ b/engine/qclib/qccmain.c @@ -1019,9 +1019,9 @@ strofs = (strofs+3)&~3; for (i=0 ; i= '0' && myargv[i][2] <= '3') { - p=0; } else if (!strnicmp(myargv[i]+2, "no-", 3)) { - if (myargv[i][5]) + if (!myargv[i][5]) for (p = 0; optimisations[p].enabled; p++) if ((*optimisations[p].abbrev && !stricmp(myargv[i]+5, optimisations[p].abbrev)) || !stricmp(myargv[i]+5, optimisations[p].fullname)) { @@ -2212,6 +2212,7 @@ void QCC_PR_CommandLinePrecompilerOptions (void) else if ( !strnicmp(myargv[i], "-K", 2) || !strnicmp(myargv[i], "/K", 2) ) { + p = 0; if (!strnicmp(myargv[i]+2, "no-", 3)) { for (p = 0; compiler_flag[p].enabled; p++) @@ -2236,6 +2237,7 @@ void QCC_PR_CommandLinePrecompilerOptions (void) } else if ( !strnicmp(myargv[i], "-F", 2) || !strnicmp(myargv[i], "/F", 2) ) { + p = 0; if (!strnicmp(myargv[i]+2, "no-", 3)) { for (p = 0; compiler_flag[p].enabled; p++) @@ -2262,6 +2264,7 @@ void QCC_PR_CommandLinePrecompilerOptions (void) else if ( !strncmp(myargv[i], "-T", 2) || !strncmp(myargv[i], "/T", 2) ) { + p = 0; for (p = 0; targets[p].name; p++) if (!stricmp(myargv[i]+2, targets[p].name)) { @@ -2281,6 +2284,7 @@ void QCC_PR_CommandLinePrecompilerOptions (void) memset(qccwarningdisabled, 1, sizeof(qccwarningdisabled)); else { + p = 0; if (!strnicmp(myargv[i]+2, "no-", 3)) { for (p = 0; warningnames[p].name; p++) diff --git a/engine/qclib/qcdecomp.c b/engine/qclib/qcdecomp.c index ae18bf606..fdb177696 100644 --- a/engine/qclib/qcdecomp.c +++ b/engine/qclib/qcdecomp.c @@ -976,4 +976,4 @@ pbool Decompile(progfuncs_t *progfuncs, char *fname) } #endif -#endif \ No newline at end of file +#endif diff --git a/engine/qux/Xmd.h b/engine/qux/Xmd.h index 377b9bcd6..35de1d6a2 100644 --- a/engine/qux/Xmd.h +++ b/engine/qux/Xmd.h @@ -154,7 +154,7 @@ typedef unsigned char CARD8; typedef CARD32 BITS32; typedef CARD16 BITS16; -#ifndef I_NEED_OS2_H +#if !defined(I_NEED_OS2_H) && !defined(_WIN32) typedef CARD8 BYTE; typedef CARD8 BOOL; #else diff --git a/engine/qux/m_x.c b/engine/qux/m_x.c index 5907ef942..cf467af63 100644 --- a/engine/qux/m_x.c +++ b/engine/qux/m_x.c @@ -588,7 +588,7 @@ nextmessage: { cl->requestnum++; - if (req->reqType < 0 || req->reqType >= 256 || !XRequests[req->reqType]) +/* if (req->reqType < 0 || req->reqType >= 256 || !XRequests[req->reqType]) { // Con_Printf("X request %i, len %i - NOT SUPPORTED\n", req->reqType, rlen*4); @@ -597,6 +597,7 @@ nextmessage: // cl->tobedropped = true; } else +*/ { // Con_Printf("X request %i, len %i\n", req->reqType, rlen*4); @@ -782,7 +783,9 @@ void XWindows_TendToClients(void) int addrlen; xclient_t *cl, *prev=NULL; int newclient; +#ifndef MULTITHREADWIN32 unsigned int _true = 1; +#endif if (xlistensocket != -1) { @@ -800,7 +803,7 @@ void XWindows_TendToClients(void) #ifdef MULTITHREADWIN32 InitializeCriticalSection (&cl->delecatesection); - {int tid; + {DWORD tid; cl->threadhandle = CreateThread(NULL, 0, X_RunClient, cl, 0, &tid); } @@ -1075,7 +1078,7 @@ void X_EvalutateCursorOwner(int movemode) int wcx; int wcy; - extern xwindow_t *xpgrabbedwindow, *xpconfinewindow; + extern xwindow_t *xpconfinewindow; { extern int mousecursor_x, mousecursor_y; @@ -1140,7 +1143,7 @@ void X_EvalutateCursorOwner(int movemode) if (mx != x_mousex || my != x_mousey || x_windowwithcursor != cursorowner->res.id) { - extern qboolean keydown[256]; +// extern qboolean keydown[256]; // Con_Printf("move %i %i\n", mx, my); @@ -1157,7 +1160,7 @@ void X_EvalutateCursorOwner(int movemode) xwindow_t *a,*b; int d1,d2; - if (XS_GetResource(x_windowwithcursor, &wnd) != x_window) + if (XS_GetResource(x_windowwithcursor, (void**)&wnd) != x_window) wnd = rootwindow; x_windowwithcursor = cursorowner->res.id; @@ -1345,7 +1348,7 @@ void X_EvalutateCursorOwner(int movemode) { //same window ev.u.keyButtonPointer.child = x_windowwithcursor; - if (XS_GetResource(x_windowwithcursor, &wnd) == x_window) + if (XS_GetResource(x_windowwithcursor, (void**)&wnd) == x_window) { //cursor still in the same child. int mask = PointerMotionMask; if (mousestate) @@ -1375,7 +1378,7 @@ void X_EvalutateFocus(int movemode) xEvent ev; xwindow_t *fo, *po, *wnd; - if (XS_GetResource(x_windowwithcursor, &po) != x_window) + if (XS_GetResource(x_windowwithcursor, (void**)&po) != x_window) po = rootwindow; // xfocusedwindow = NULL; @@ -1383,7 +1386,7 @@ void X_EvalutateFocus(int movemode) if (!xfocusedwindow) { - if (XS_GetResource(x_windowwithcursor, &fo) != x_window) + if (XS_GetResource(x_windowwithcursor, (void**)&fo) != x_window) fo = rootwindow; } else @@ -1393,7 +1396,6 @@ void X_EvalutateFocus(int movemode) if (x_windowwithfocus != fo->res.id) { - extern qboolean keydown[256]; ev.u.u.detail = 0; ev.u.u.sequenceNumber = 0; ev.u.focus.mode = movemode; @@ -1401,7 +1403,7 @@ void X_EvalutateFocus(int movemode) xwindow_t *a,*b; int d1,d2; - if (XS_GetResource(x_windowwithfocus, &wnd) != x_window) + if (XS_GetResource(x_windowwithfocus, (void**)&wnd) != x_window) wnd = rootwindow; x_windowwithfocus = fo->res.id; @@ -1641,7 +1643,7 @@ void XWindows_Draw(void) } XWindows_TendToClients(); - Media_ShowFrame(xscreen, xscreenwidth, xscreenheight, NULL); + Media_ShowFrameRGBA_32 (xscreen, xscreenwidth, xscreenheight); Con_DrawNotify(); @@ -1724,7 +1726,7 @@ void XWindows_Key(int key) ev.u.keyButtonPointer.event = ev.u.keyButtonPointer.child; ev.u.keyButtonPointer.eventX = ev.u.keyButtonPointer.rootX; ev.u.keyButtonPointer.eventY = ev.u.keyButtonPointer.rootY; - if (XS_GetResource(x_windowwithcursor, &wnd) == x_window) + if (XS_GetResource(x_windowwithcursor, (void**)&wnd) == x_window) { ev.u.u.sequenceNumber = xpointergrabclient->requestnum; while(wnd) @@ -1736,7 +1738,7 @@ void XWindows_Key(int key) X_SendData(xpointergrabclient, &ev, sizeof(ev)); } } - else if (XS_GetResource(ev.u.keyButtonPointer.child, &wnd) == x_window) + else if (XS_GetResource(ev.u.keyButtonPointer.child, (void**)&wnd) == x_window) X_SendInputNotification(&ev, wnd, (ev.u.u.type==ButtonPress)?ButtonPressMask:KeyPressMask); } } @@ -1805,7 +1807,7 @@ void XWindows_Keyup(int key) ev.u.keyButtonPointer.event = ev.u.keyButtonPointer.child; ev.u.keyButtonPointer.eventX = ev.u.keyButtonPointer.rootX; ev.u.keyButtonPointer.eventY = ev.u.keyButtonPointer.rootY; - if (XS_GetResource(x_windowwithcursor, &wnd) == x_window) + if (XS_GetResource(x_windowwithcursor, (void**)&wnd) == x_window) { ev.u.u.sequenceNumber = xpointergrabclient->requestnum; while(wnd) @@ -1817,7 +1819,7 @@ void XWindows_Keyup(int key) X_SendData(xpointergrabclient, &ev, sizeof(ev)); } } - else if (XS_GetResource(ev.u.keyButtonPointer.child, &wnd) == x_window) + else if (XS_GetResource(ev.u.keyButtonPointer.child, (void**)&wnd) == x_window) { X_SendInputNotification(&ev, wnd, (ev.u.u.type==ButtonRelease)?ButtonReleaseMask:KeyReleaseMask); } diff --git a/engine/qux/x_reqs.c b/engine/qux/x_reqs.c index 341e00c68..c84ccb79d 100644 --- a/engine/qux/x_reqs.c +++ b/engine/qux/x_reqs.c @@ -262,7 +262,7 @@ void XR_GetAtomName (xclient_t *cl, xReq *request) xatom_t *xa; - if (XS_GetResource(req->id, &xa) != x_atom) + if (XS_GetResource(req->id, (void**)&xa) != x_atom) { X_SendError(cl, BadAtom, req->id, X_GetAtomName, 0); return; @@ -331,12 +331,12 @@ void XR_GetProperty (xclient_t *cl, xReq *request) int trailing; xGetPropertyReply *rep = (xGetPropertyReply*)buffer; - if (XS_GetResource(req->window, &wnd) != x_window) + if (XS_GetResource(req->window, (void**)&wnd) != x_window) { //wait a minute, That's not a window!!! X_SendError(cl, BadWindow, req->window, X_GetProperty, 0); return; } - if (XS_GetResource(req->property, NULL) != x_atom) + if (XS_GetResource(req->property, (void**)NULL) != x_atom) { //whoops X_SendError(cl, BadAtom, req->property, X_GetProperty, 0); return; @@ -392,7 +392,7 @@ void XR_ListProperties(xclient_t *cl, xReq *request) xListPropertiesReply *rep = (xListPropertiesReply*)buffer; Atom *out = (Atom *)(rep+1); - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { //wait a minute, That's not a window!!! X_SendError(cl, BadWindow, req->id, X_GetProperty, 0); return; @@ -430,13 +430,13 @@ void XR_ChangeProperty (xclient_t *cl, xReq *request) xatom_t *atom; xwindow_t *wnd; - if (XS_GetResource(req->window, &wnd) != x_window) + if (XS_GetResource(req->window, (void**)&wnd) != x_window) { //wait a minute, That's not a window!!! X_SendError(cl, BadWindow, req->window, X_ChangeProperty, 0); return; } - if (XS_GetResource(req->property, &atom) != x_atom) + if (XS_GetResource(req->property, (void**)&atom) != x_atom) { X_SendError(cl, BadAtom, req->property, X_ChangeProperty, 0); return; @@ -494,13 +494,13 @@ void XR_DeleteProperty(xclient_t *cl, xReq *request) xwindow_t *wnd; - if (XS_GetResource(req->window, &wnd) != x_window) + if (XS_GetResource(req->window, (void**)&wnd) != x_window) { //wait a minute, That's not a window!!! X_SendError(cl, BadWindow, req->window, X_DeleteProperty, 0); return; } - if (XS_GetResource(req->property, NULL) != x_atom) + if (XS_GetResource(req->property, (void**)NULL) != x_atom) { X_SendError(cl, BadAtom, req->property, X_DeleteProperty, 0); return; @@ -532,13 +532,13 @@ void XR_GetSelectionOwner (xclient_t *cl, xReq *request) xGetSelectionOwnerReply reply; xatom_t *atom; - if (XS_GetResource(req->id, &atom) != x_atom) + if (XS_GetResource(req->id, (void**)&atom) != x_atom) { X_SendError(cl, BadAtom, req->id, X_GetSelectionOwner, 0); return; } - if (XS_GetResource(atom->selectionownerwindowid, NULL) != x_window) //make sure the window still exists. + if (XS_GetResource(atom->selectionownerwindowid, (void**)NULL) != x_window) //make sure the window still exists. { atom->selectionownerwindowid = None; } @@ -562,13 +562,13 @@ void XR_SetSelectionOwner (xclient_t *cl, xReq *request) xatom_t *atom; xwindow_t *window; - if (XS_GetResource(req->selection, &atom) != x_atom) + if (XS_GetResource(req->selection, (void**)&atom) != x_atom) { X_SendError(cl, BadAtom, req->selection, X_SetSelectionOwner, 0); return; } - if (XS_GetResource(req->window, &window) != x_window) //make sure the window still exists. + if (XS_GetResource(req->window, (void**)&window) != x_window) //make sure the window still exists. { X_SendError(cl, BadWindow, req->window, X_SetSelectionOwner, 0); return; @@ -617,7 +617,7 @@ void XR_SetInputFocus (xclient_t *cl, xReq *request) xResourceReq *req = (xResourceReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { X_SendError(cl, BadDrawable, req->id, X_SetInputFocus, 0); return; @@ -682,7 +682,7 @@ void XR_GetGeometry (xclient_t *cl, xReq *request) rep.pad2 = 0; rep.pad3 = 0; - switch(XS_GetResource(req->id, &drawable)) + switch(XS_GetResource(req->id, (void**)&drawable)) { case x_window: wnd = (xwindow_t*)drawable; @@ -719,13 +719,13 @@ void XR_CreateWindow (xclient_t *cl, xReq *request) X_SendError(cl, BadMatch, req->wid, X_CreateWindow, 0); return; } - if (XS_GetResource(req->wid, &parent) != x_none) + if (XS_GetResource(req->wid, (void**)&parent) != x_none) { X_SendError(cl, BadIDChoice, req->wid, X_CreateWindow, 0); return; } - if (XS_GetResource(req->parent, &parent) != x_window) + if (XS_GetResource(req->parent, (void**)&parent) != x_window) { X_SendError(cl, BadWindow, req->parent, X_CreateWindow, 0); return; @@ -750,7 +750,7 @@ void XR_CreateWindow (xclient_t *cl, xReq *request) if (req->mask & CWBackPixmap) { wnd->backpixmap = NULL; - if (XS_GetResource(*parameters, &wnd->backpixmap) != x_pixmap) + if (XS_GetResource(*parameters, (void**)&wnd->backpixmap) != x_pixmap) { if (*parameters) X_SendError(cl, BadPixmap, *parameters, X_CreateWindow, 0); @@ -898,7 +898,7 @@ void XR_ChangeWindowAttributes (xclient_t *cl, xReq *request) xChangeWindowAttributesReq *req = (xChangeWindowAttributesReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->window, &wnd) != x_window) + if (XS_GetResource(req->window, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->window, X_ChangeWindowAttributes, 0); return; @@ -911,7 +911,7 @@ void XR_ChangeWindowAttributes (xclient_t *cl, xReq *request) if (wnd->backpixmap) wnd->backpixmap->references--; wnd->backpixmap = NULL; - if (XS_GetResource(*parameters, &wnd->backpixmap) != x_pixmap) + if (XS_GetResource(*parameters, (void**)&wnd->backpixmap) != x_pixmap) { if (*parameters) X_SendError(cl, BadPixmap, *parameters, X_ChangeWindowAttributes, 0); @@ -933,7 +933,7 @@ void XR_ChangeWindowAttributes (xclient_t *cl, xReq *request) { X_SendError(cl, BadImplementation, 0, X_ChangeWindowAttributes, 0); /* wnd->borderpixmap = NULL; - if (XS_GetResource(*parameters, &wnd->borderpixmap) != x_pixmap) + if (XS_GetResource(*parameters, (void**)&wnd->borderpixmap) != x_pixmap) { if (*parameters) X_SendError(cl, BadPixmap, *parameters, X_ChangeWindowAttributes, 0); @@ -1054,7 +1054,7 @@ void XR_ConfigureWindow (xclient_t *cl, xReq *request) CARD32 *parm; - if (XS_GetResource(req->window, &wnd) != x_window) + if (XS_GetResource(req->window, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->window, X_ConfigureWindow, 0); return; @@ -1182,12 +1182,12 @@ void XR_ReparentWindow (xclient_t *cl, xReq *request) xReparentWindowReq *req = (xReparentWindowReq *)request; xwindow_t *wnd, *parent; - if (XS_GetResource(req->window, &wnd) != x_window) + if (XS_GetResource(req->window, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->window, X_ReparentWindow, 0); return; } - if (XS_GetResource(req->parent, &parent) != x_window) + if (XS_GetResource(req->parent, (void**)&parent) != x_window) { X_SendError(cl, BadWindow, req->parent, X_ReparentWindow, 0); return; @@ -1229,7 +1229,7 @@ void XR_DestroyWindow (xclient_t *cl, xReq *request) xResourceReq *req = (xResourceReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->id, X_DestroyWindow, 0); return; @@ -1249,7 +1249,7 @@ void XR_QueryTree (xclient_t *cl, xReq *request) Window *cwnd; - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->id, X_DestroyWindow, 0); return; @@ -1293,7 +1293,7 @@ void XR_GetWindowAttributes (xclient_t *cl, xReq *request) xGetWindowAttributesReply rep; - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->id, X_GetWindowAttributes, 0); return; @@ -1495,7 +1495,7 @@ void XR_ChangeGC(xclient_t *cl, xReq *request) xChangeGCReq *req = (xChangeGCReq *)request; xgcontext_t *gc; - if (XS_GetResource(req->gc, &gc) != x_gcontext) + if (XS_GetResource(req->gc, (void**)&gc) != x_gcontext) { X_SendError(cl, BadGC, req->gc, X_FreeGC, 0); return; @@ -1509,7 +1509,7 @@ void XR_CreateGC(xclient_t *cl, xReq *request) xCreateGCReq *req = (xCreateGCReq *)request; xresource_t *drawable; - if (XS_GetResource(req->gc, &drawable) != x_none) + if (XS_GetResource(req->gc, (void**)&drawable) != x_none) { // if (req->gc == cl->ridbase&&drawable->owner) // XS_DestroyResourcesOfClient(drawable->owner); @@ -1519,7 +1519,7 @@ void XR_CreateGC(xclient_t *cl, xReq *request) return; } } - XS_GetResource(req->drawable, &drawable); + XS_GetResource(req->drawable, (void**)&drawable); /*if (drawable->restype != x_window && drawable->restype != x_gcontext) { X_SendError(cl, BadDrawable, req->drawable, X_CreateGC, 0); @@ -1533,7 +1533,7 @@ void XR_FreeGC(xclient_t *cl, xReq *request) { xResourceReq *req = (xResourceReq *)request; xresource_t *gc; - if (XS_GetResource(req->id, &gc) != x_gcontext) + if (XS_GetResource(req->id, (void**)&gc) != x_gcontext) { X_SendError(cl, BadGC, req->id, X_FreeGC, 0); return; @@ -1685,7 +1685,7 @@ void XR_ClearArea(xclient_t *cl, xReq *request) xClearAreaReq *req = (xClearAreaReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->window, &wnd) != x_window) + if (XS_GetResource(req->window, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->window, X_ClearArea, 0); return; @@ -1737,14 +1737,14 @@ void XR_CopyArea(xclient_t *cl, xReq *request) //from and to pixmap or drawable. int outwidth; int outheight; - if (XS_GetResource(req->gc, &gc) == x_none) + if (XS_GetResource(req->gc, (void**)&gc) == x_none) { X_SendError(cl, BadGC, req->gc, X_PutImage, 0); return; } - switch (XS_GetResource(req->srcDrawable, &drawable)) + switch (XS_GetResource(req->srcDrawable, (void**)&drawable)) { default: X_SendError(cl, BadDrawable, req->srcDrawable, X_PutImage, 0); @@ -1783,7 +1783,7 @@ void XR_CopyArea(xclient_t *cl, xReq *request) //from and to pixmap or drawable. break; } - switch (XS_GetResource(req->dstDrawable, &drawable)) + switch (XS_GetResource(req->dstDrawable, (void**)&drawable)) { default: X_SendError(cl, BadDrawable, req->dstDrawable, X_PutImage, 0); @@ -1832,7 +1832,7 @@ void XR_MapWindow(xclient_t *cl, xReq *request) xResourceReq *req = (xResourceReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->id, X_MapWindow, 0); return; @@ -1937,7 +1937,7 @@ void XR_UnmapWindow(xclient_t *cl, xReq *request) xResourceReq *req = (xResourceReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->id, X_UnmapWindow, 0); return; @@ -1974,7 +1974,7 @@ void XR_MapSubwindows(xclient_t *cl, xReq *request) xResourceReq *req = (xResourceReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->id, &wnd) != x_window) + if (XS_GetResource(req->id, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->id, X_MapWindow, 0); return; @@ -1992,13 +1992,13 @@ void XR_CreatePixmap(xclient_t *cl, xReq *request) xCreatePixmapReq *req = (xCreatePixmapReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->drawable, &wnd) != x_window) + if (XS_GetResource(req->drawable, (void**)&wnd) != x_window) { X_SendError(cl, BadDrawable, req->drawable, X_CreatePixmap, 0); return; } - if (XS_GetResource(req->pid, &wnd) != x_none) + if (XS_GetResource(req->pid, (void**)&wnd) != x_none) { X_SendError(cl, BadIDChoice, req->pid, X_CreatePixmap, 0); } @@ -2010,7 +2010,7 @@ void XR_FreePixmap(xclient_t *cl, xReq *request) { xResourceReq *req = (xResourceReq *)request; xresource_t *pm; - if (XS_GetResource(req->id, &pm) != x_pixmap) + if (XS_GetResource(req->id, (void**)&pm) != x_pixmap) { X_SendError(cl, BadPixmap, req->id, X_FreePixmap, 0); return; @@ -2033,13 +2033,13 @@ void XR_PutImage(xclient_t *cl, xReq *request) int drdepth; unsigned char *drbuffer; - if (XS_GetResource(req->drawable, &drawable) == x_none) + if (XS_GetResource(req->drawable, (void**)&drawable) == x_none) { X_SendError(cl, BadDrawable, req->drawable, X_PutImage, 0); return; } - if (XS_GetResource(req->gc, &gc) == x_none) + if (XS_GetResource(req->gc, (void**)&gc) == x_none) { X_SendError(cl, BadGC, req->gc, X_PutImage, 0); return; @@ -2189,7 +2189,7 @@ void XR_GetImage(xclient_t *cl, xReq *request) int drheight; unsigned char *drbuffer; - if (XS_GetResource(req->drawable, &drawable) == x_none) + if (XS_GetResource(req->drawable, (void**)&drawable) == x_none) { X_SendError(cl, BadDrawable, req->drawable, X_PutImage, 0); return; @@ -2358,13 +2358,13 @@ void XR_PolyLine(xclient_t *cl, xReq *request) - if (XS_GetResource(req->drawable, &drawable) == x_none) + if (XS_GetResource(req->drawable, (void**)&drawable) == x_none) { X_SendError(cl, BadDrawable, req->drawable, X_PolyRectangle, 0); return; } - if (XS_GetResource(req->gc, &gc) == x_none) + if (XS_GetResource(req->gc, (void**)&gc) == x_none) { X_SendError(cl, BadGC, req->gc, X_PolyRectangle, 0); return; @@ -2452,13 +2452,13 @@ void XR_PolyRectangle(xclient_t *cl, xReq *request) - if (XS_GetResource(req->drawable, &drawable) == x_none) + if (XS_GetResource(req->drawable, (void**)&drawable) == x_none) { X_SendError(cl, BadDrawable, req->drawable, X_PolyRectangle, 0); return; } - if (XS_GetResource(req->gc, &gc) == x_none) + if (XS_GetResource(req->gc, (void**)&gc) == x_none) { X_SendError(cl, BadGC, req->gc, X_PolyRectangle, 0); return; @@ -2542,7 +2542,7 @@ void XR_PolyRectangle(xclient_t *cl, xReq *request) out = (unsigned int *)drbuffer + (rect[0] + rect[1]*drwidth); for (i = 0; i < rect[2]; i++) { - GCFunc(gc->fgcolour, *(char *)&out[i], gc->function, *(char *)&out[i], 0xffffff); + GCFunc(gc->fgcolour, *(char *)&out[i], gc->function, *(char *)&out[i], 0xff); } rect[3]--; @@ -2607,13 +2607,13 @@ void XR_PolyPoint(xclient_t *cl, xReq *request) short lastpoint[2]; - if (XS_GetResource(req->drawable, &drawable) == x_none) + if (XS_GetResource(req->drawable, (void**)&drawable) == x_none) { X_SendError(cl, BadDrawable, req->drawable, X_PolyPoint, 0); return; } - if (XS_GetResource(req->gc, &gc) != x_gcontext) + if (XS_GetResource(req->gc, (void**)&gc) != x_gcontext) { X_SendError(cl, BadGC, req->gc, X_PolyPoint, 0); return; @@ -2761,13 +2761,13 @@ void XR_PolyText(xclient_t *cl, xReq *request) int xpos, ypos; - if (XS_GetResource(req->drawable, &drawable) == x_none) + if (XS_GetResource(req->drawable, (void**)&drawable) == x_none) { X_SendError(cl, BadDrawable, req->drawable, req->reqType, 0); return; } - if (XS_GetResource(req->gc, &gc) != x_gcontext) + if (XS_GetResource(req->gc, (void**)&gc) != x_gcontext) { X_SendError(cl, BadGC, req->gc, req->reqType, 0); return; @@ -2861,7 +2861,7 @@ void XR_OpenFont(xclient_t *cl, xReq *request) //basically ignored. We only supp void XR_ListFonts(xclient_t *cl, xReq *request) //basically ignored. We only support one font... { - xListFontsReq *req = (xListFontsReq *)request; +// xListFontsReq *req = (xListFontsReq *)request; int buffer[256]; xListFontsReply *reply = (xListFontsReply *)buffer; @@ -2875,7 +2875,7 @@ void XR_ListFonts(xclient_t *cl, xReq *request) //basically ignored. We only sup void XR_QueryFont(xclient_t *cl, xReq *request) //basically ignored. We only support one font... { - xResourceReq *req = (xResourceReq *)request; +// xResourceReq *req = (xResourceReq *)request; char buffer[8192]; xQueryFontReply *rep = (xQueryFontReply *)buffer; @@ -3064,7 +3064,7 @@ void XR_SendEvent (xclient_t *cl, xReq *request) xSendEventReq *req = (xSendEventReq *)request; xwindow_t *wnd; - if (XS_GetResource(req->destination, &wnd) != x_window) + if (XS_GetResource(req->destination, (void**)&wnd) != x_window) { X_SendError(cl, BadWindow, req->destination, X_SendEvent, 0); return; @@ -3150,8 +3150,8 @@ void XR_GrabPointer (xclient_t *cl, xReq *request) } xpointergrabclient = cl; - XS_GetResource(req->grabWindow, &xpgrabbedwindow); - XS_GetResource(req->confineTo, &xpconfinewindow); + XS_GetResource(req->grabWindow, (void**)&xpgrabbedwindow); + XS_GetResource(req->confineTo, (void**)&xpconfinewindow); X_EvalutateCursorOwner(NotifyGrab); diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index fb543af41..376a15207 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -936,7 +936,7 @@ void Q_InitProgs(void) if (f) { pr_globals = PR_globals(svprogfuncs, PR_CURRENT); - (string_t)G_INT(OFS_PARM0) = PR_SetString(svprogfuncs, as); + G_INT(OFS_PARM0) = (int)PR_SetString(svprogfuncs, as); PR_ExecuteProgram (svprogfuncs, f); } else @@ -1054,7 +1054,7 @@ void Q_InitProgs(void) if (f) { pr_globals = PR_globals(svprogfuncs, PR_CURRENT); - (string_t)G_INT(OFS_PARM0) = PR_SetString(svprogfuncs, as); + G_INT(OFS_PARM0) = (int)PR_SetString(svprogfuncs, as); PR_ExecuteProgram (svprogfuncs, f); } else @@ -1096,7 +1096,7 @@ void Q_InitProgs(void) if (f) { pr_globals = PR_globals(svprogfuncs, PR_CURRENT); - (string_t)G_INT(OFS_PARM0) = PR_SetString(svprogfuncs, as); + G_INT(OFS_PARM0) = (int)PR_SetString(svprogfuncs, as); PR_ExecuteProgram (svprogfuncs, f); } else @@ -1130,7 +1130,7 @@ qboolean PR_QCChat(char *text, int say_type) if (!ChatMessage) return false; - (string_t)G_INT(OFS_PARM0) = PR_SetString(svprogfuncs, text); + G_INT(OFS_PARM0) = (int)PR_SetString(svprogfuncs, text); G_FLOAT(OFS_PARM1) = say_type; PR_ExecuteProgram (svprogfuncs, ChatMessage); @@ -2394,7 +2394,7 @@ void PF_LocalSound(progfuncs_t *prinst, struct globalvars_s *pr_globals) float chan = G_FLOAT(OFS_PARM1); float vol = G_FLOAT(OFS_PARM2); - if (sfx = S_PrecacheSound(s)) + if ((sfx = S_PrecacheSound(s))) S_StartSound(cl.playernum[0], chan, sfx, cl.simorg[0], vol, 0.0); #endif }; diff --git a/engine/server/savegame.c b/engine/server/savegame.c index 5d4c02d75..636641ac4 100644 --- a/engine/server/savegame.c +++ b/engine/server/savegame.c @@ -814,8 +814,8 @@ void SV_Savegame_f (void) if (*cl->name) for (len = 0; len < NUM_SPAWN_PARMS; len++) - fprintf(f, "%i (%f)\n", cl->spawn_parms[len], cl->spawn_parms[len]); //write ints as not everyone passes a float in the parms. - //write floats so you can use it to debug. + fprintf(f, "%i (%f)\n", *(int*)&cl->spawn_parms[len], cl->spawn_parms[len]); //write ints as not everyone passes a float in the parms. + //write floats too so you can use it to debug. } Q_strncpyz(str, svs.info, sizeof(str)); diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index 5b0c93266..3faadb75f 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -463,7 +463,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us #ifndef SERVERONLY if (!isDedicated && !qrenderer) { - Cmd_ExecuteString("vid_restart\n", RESTRICT_LOCAL); + R_RestartRenderer_f(); } #endif diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index bb7ffa0e7..3489d18e2 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -73,6 +73,9 @@ cvar_t allow_download_demos = {"allow_download_demos", "1"}; cvar_t allow_download_maps = {"allow_download_maps", "1"}; cvar_t allow_download_anymap = {"allow_download_pakmaps", "0"}; cvar_t allow_download_root = {"allow_download_root", "0"}; +cvar_t allow_download_textures = {"allow_download_textures", "1"}; +cvar_t allow_download_pk3s = {"allow_download_pk3s", "1"}; +cvar_t allow_download_wads = {"allow_download_wads", "1"}; cvar_t sv_public = {"sv_public", "1"}; cvar_t sv_highchars = {"sv_highchars", "1"}; @@ -393,7 +396,7 @@ void SV_DropClient (client_t *drop) drop->old_frags = 0; drop->kills = 0; drop->deaths = 0; - if (drop->edict) + if (svprogfuncs && drop->edict) drop->edict->v.frags = 0; drop->name[0] = 0; memset (drop->userinfo, 0, sizeof(drop->userinfo)); diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 9bbd24294..8c39e0bfb 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -553,7 +553,7 @@ qboolean SV_PushAngles (edict_t *pusher, vec3_t move, vec3_t amove) // figure movement due to the pusher's amove VectorSubtract (check->v.origin, pusher->v.origin, org); org2[0] = DotProduct (org, forward); - org2[1] = -DotProduct (org, right); + org2[1] = DotProduct (org, right); org2[2] = DotProduct (org, up); VectorSubtract (org2, org, move2); VectorAdd (check->v.origin, move2, check->v.origin); diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index ccba3fe31..178612e25 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -877,8 +877,8 @@ SV_WriteClientdataToMessage */ void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg) { - int i; #ifdef NQPROT + int i; int bits, items; edict_t *ent; #endif diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index cc78816d1..495fda583 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -1346,6 +1346,9 @@ Con_DPrintf ("UPLOAD: %d received\n", size); } +//Use of this function is on name only. +//Be aware that the maps directory should be restricted based on weather the file was from a pack file +//this is to preserve copyright - please do not breach due to a bug. qboolean SV_AllowDownload (char *name) { extern cvar_t allow_download; @@ -1353,28 +1356,64 @@ qboolean SV_AllowDownload (char *name) extern cvar_t allow_download_models; extern cvar_t allow_download_sounds; extern cvar_t allow_download_demos; - extern cvar_t allow_download_maps, allow_download_anymap; + extern cvar_t allow_download_maps; + extern cvar_t allow_download_textures; + extern cvar_t allow_download_pk3s; + extern cvar_t allow_download_wads; extern cvar_t allow_download_root; - extern int file_from_pak; // ZOID did file come from pak? +// extern int file_from_pak; // ZOID did file come from pak? - if (strstr (name, "..") || !allow_download.value - // leading dot is no good - || *name == '.' - // leading slash bad as well, must be in subdir - || *name == '/' - // next up, skin check - || (strncmp(name, "skins/", 6) == 0 && !allow_download_skins.value) - // now models - || (strncmp(name, "progs/", 6) == 0 && !allow_download_models.value) - // now sounds - || (strncmp(name, "sound/", 6) == 0 && !allow_download_sounds.value) - // now maps (note special case for maps, must not be in pak) - || (strncmp(name, "maps/", 5) == 0 && !(allow_download_maps.value||allow_download_anymap.value)) - //demos - || (strncmp(name, "demos/", 6) == 0 && !allow_download_demos.value) - // MUST be in a subdirectory - || (!strstr (name, "/") && !allow_download_root.value)) + //allowed at all? + if (!allow_download.value) return false; + + //no subdirs? + if (strstr (name, "..")) //no under paths. + return false; + if (*name == '.') //relative is pointless + return false; + if (*name == '/') //no absolute. + return false; + if (strchr(name, '\\')) //no windows paths - grow up lame windows users. + return false; + + if (strncmp(name, "maps/", 5) == 0 && (allow_download_maps.value)) + return true; + + //skins? + if (strncmp(name, "skins/", 6) == 0 && allow_download_skins.value) + return true; + //models + if ((strncmp(name, "progs/", 6) == 0|| + strncmp(name, "models/", 7) == 0) && allow_download_models.value) + return true; + //sound + if (strncmp(name, "sound/", 6) == 0 && allow_download_sounds.value) + return true; + //demos + if (strncmp(name, "demos/", 6) == 0 && allow_download_demos.value) + return true; + + //textures + if (strncmp(name, "texures/", 8) == 0 && allow_download_textures.value) + return true; + + //wads + if (strncmp(name, "wads/", 5) == 0 && allow_download_wads.value) + return true; + if (!strcmp(".wad", COM_FileExtension(name)) && allow_download_wads.value) + return true; + + //pk3s. + if (!strcmp(".pk3", COM_FileExtension(name)) && allow_download_pk3s.value) + if (strnicmp(name, "pak", 3)) //don't give out q3 pk3 files. + return true; + + //root of gamedir + if (strchr(name, '/') && !allow_download_root.value) + return false; + + //any other subdirs are allowed return true; } /* @@ -3217,6 +3256,7 @@ vec3_t offset; VectorCopy (check->v.origin, pe->origin); VectorCopy (check->v.angles, pe->angles); + pe->angles[0]*=-1; //quake is wierd. pe->info = NUM_FOR_EDICT(svprogfuncs, check); if (check->v.solid == SOLID_BSP) pe->model = sv.models[(int)(check->v.modelindex)]; diff --git a/engine/sndcodec/snd_vc.c b/engine/sndcodec/snd_vc.c index 18b3a5368..a04aa7e20 100644 --- a/engine/sndcodec/snd_vc.c +++ b/engine/sndcodec/snd_vc.c @@ -433,4 +433,4 @@ CLVS_socket=0; } #endif -#endif \ No newline at end of file +#endif diff --git a/engine/sw/d_local.h b/engine/sw/d_local.h index 5e3c4f463..cd535ff3f 100644 --- a/engine/sw/d_local.h +++ b/engine/sw/d_local.h @@ -142,5 +142,12 @@ void D_InitTrans(void); #define Trans(p, p2) (t_curlookupp[p][p2]) // void Set_TransLevelI(int level); void Set_TransLevelF(float level); + + + +extern qbyte *palxxxto8; +extern int palmask[3]; +extern int palshift[3]; + #endif diff --git a/engine/sw/d_trans.c b/engine/sw/d_trans.c index 4b499e691..e896573f2 100644 --- a/engine/sw/d_trans.c +++ b/engine/sw/d_trans.c @@ -1,8 +1,11 @@ +//contains routines for blending images (as well as blitting 32bit to 8bit type stuff) + + #include "quakedef.h" #include "d_local.h" #include "r_local.h" -#ifdef PEXT_TRANS +void MakeVideoPalette(void); int t_numtables; qbyte p1multitable[] = {1, 99, 49, 97, 48, 19, 47, 93, 23, 91, 9, 89, 22, 87, 43, 17, 21, 83, 41, 81, 4, 79, 39, 77, 19, 3, 37, 73, 18, 71, 7, 69, 17, 67, 33, 13, 16, 63, 31, 61, 3, 59, 29, 57, 14, 11, 27, 53, 13, 51, 1, 49, 12, 47, 23, 9, 11, 43, 21, 41, 2, 39, 19, 37, 9, 7, 17, 33, 8, 31, 3, 29, 7, 27, 13, 1, 6, 23, 11, 21, 1, 19, 9, 17, 4, 3, 7, 13, 3, 11, 1, 9, 2, 7, 3, 1, 1, 3, 1, 1, 0}; @@ -293,4 +296,450 @@ void Set_TransLevelF(float level) //MUST be between 0 and 1 } } -#endif +qbyte *palxxxto8; +int palmask[3]; +int palshift[3]; + + + +#define FindPallete(r,g,b) palxxxto8[((r&palmask[0])>>palshift[0]) | ((g&palmask[1])<>1][g>>1][b>>1]) +qbyte GetPalette(int red, int green, int blue) +{ + if (palxxxto8) //fast precalculated method + return FindPallete(red,green,blue); + else //slow, horrible method. + { + int i, best=15; + int bestdif=256*256*256, curdif; + extern qbyte *host_basepal; + qbyte *pa; + + #define _abs(x) ((x)*(x)) + + pa = host_basepal; + for (i = 0; i < 256; i++, pa+=3) + { + curdif = _abs(red - pa[0]) + _abs(green - pa[1]) + _abs(blue - pa[2]); + if (curdif < bestdif) + { + if (curdif<1) + return i; + bestdif = curdif; + best = i; + } + } + return best; + } +} + +void MakeVideoPalette(void) +{ +// pal77 *temp; + qbyte *temp; + int r, g, b; + int rs, gs, bs, size; + int rstep, gstep, bstep; + int gshift, bshift; + FILE *f; + char filename[11]; + + if (strlen(r_palconvbits.string) < 3) + { + // r5g6b5 is default + rs = 5; + gs = 6; + bs = 5; + } + else + { + // convert to int + rs = r_palconvbits.string[0] - '0'; + gs = r_palconvbits.string[1] - '0'; + bs = r_palconvbits.string[2] - '0'; + + // limit to 4-8 (can't have 3 because the forumla breaks) + if (rs < 4) + rs = 4; + else if (rs > 8) + rs = 8; + + if (gs < 4) + gs = 4; + else if (gs > 8) + gs = 8; + + if (bs < 4) + bs = 4; + else if (bs > 8) + bs = 8; + } + + Q_strcpy(filename, "rgb000.pal"); + filename[3] = rs + '0'; + filename[4] = gs + '0'; + filename[5] = bs + '0'; + + palshift[0] = 1<>= 1; + gstep >>= 1; + bstep >>= 1; + + for (r = palshift[0] - 1; r >= 0; r--) + for (g = palshift[1] - 1; g >= 0; g--) + for (b = palshift[2] - 1; b >= 0; b--) + { + temp[r+(g<>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + dest[x+1] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + dest[x+2] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + dest[x+3] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + } + } + } + } + else if (r_pixbytes == 2) + { +extern int redbits, redshift; +extern int greenbits, greenshift; +extern int bluebits, blueshift; + + unsigned short *dest; + qbyte *src; + int lines=vid.conheight; + int v; + int f, fstep; + + dest = (unsigned short *)vid.conbuffer; + + for (y=0 ; y>16)*4]*(1<>16)*4+1]*(1<>16)*4+2]*(1<>16)*4+2]; + dest[x+1] = src[(f>>16)*4+1]; + dest[x+2] = src[(f>>16)*4]; + f += fstep; + } + } + } + } + else + Sys_Error("24 bit rendering?"); + + D_DisableBackBufferAccess (); // for adapters that can't stay mapped in + + SCR_SetUpToDrawConsole(); + if (scr_con_current) + SCR_DrawConsole (false); + + M_Draw(0); +} + +void MediaSW_ShowFrameRGBA_32(qbyte *framedata, int inwidth, int inheight) //top down +{ + int y, x; + + D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly + if (r_pixbytes == 1) + { + qbyte *dest, *src; + int lines=vid.conheight; + int v; + int f, fstep; + + dest = vid.conbuffer; + + for (y=0 ; y>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + dest[x+1] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + dest[x+2] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + dest[x+3] = FindPallete(src[(f>>16)*4], src[(f>>16)*4+1], src[(f>>16)*4+2]); + f += fstep; + } + } + } + } + else if (r_pixbytes == 2) + { +extern int redbits, redshift; +extern int greenbits, greenshift; +extern int bluebits, blueshift; + + unsigned short *dest; + qbyte *src; + int lines=vid.conheight; + int v; + int f, fstep; + + dest = (unsigned short *)vid.conbuffer; + + for (y=0 ; y>16)*4]*(1<>16)*4+1]*(1<>16)*4+2]*(1<>16)*4+2]; + dest[x+1] = src[(f>>16)*4+1]; + dest[x+2] = src[(f>>16)*4]; + f += fstep; + } + } + } + } + else + Sys_Error("24 bit rendering?"); + + D_DisableBackBufferAccess (); // for adapters that can't stay mapped in + + SCR_SetUpToDrawConsole(); + if (scr_con_current) + SCR_DrawConsole (false); +} + +void MediaSW_ShowFrameBGR_24_Flip(qbyte *framedata, int inwidth, int inheight) //input is bottom up... +{ + int y, x; + + D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly + if (r_pixbytes == 1) + { + qbyte *dest, *src; + int lines=vid.conheight; + int v; + int f, fstep; + + dest = vid.conbuffer; + + for (y=0 ; y>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); + f += fstep; + dest[x+1] = FindPallete(src[(f>>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); + f += fstep; + dest[x+2] = FindPallete(src[(f>>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); + f += fstep; + dest[x+3] = FindPallete(src[(f>>16)*3+2], src[(f>>16)*3+1], src[(f>>16)*3]); + f += fstep; + } + } + } + } + else if (r_pixbytes == 2) + { +extern int redbits, redshift; +extern int greenbits, greenshift; +extern int bluebits, blueshift; + + unsigned short *dest; + qbyte *src; + int lines=vid.conheight; + int v; + int f, fstep; + + dest = (unsigned short *)vid.conbuffer; + + for (y=0 ; y>16)*3+2]*(1<>16)*3+1]*(1<>16)*3+0]*(1<>16)*3); + f += fstep; + } + } + } + } + else + Sys_Error("24 bit rendering?"); + + D_DisableBackBufferAccess (); // for adapters that can't stay mapped in + + SCR_SetUpToDrawConsole(); + if (scr_con_current) + SCR_DrawConsole (false); +} diff --git a/engine/sw/sw_draw.c b/engine/sw/sw_draw.c index b57dc1ce0..ed77bbc47 100644 --- a/engine/sw/sw_draw.c +++ b/engine/sw/sw_draw.c @@ -22,7 +22,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // vid buffer #include "quakedef.h" +#ifdef RGLQUAKE #include "glquake.h" //with sw refresh??? +#endif #include "d_local.h" //trans stuff extern unsigned int *d_8to32table;