lots of changes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@228 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-09-20 23:25:38 +00:00
parent 956bebbd1d
commit 9c59fafc3e
70 changed files with 1417 additions and 1094 deletions

View File

@ -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)

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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;}
}
}

View File

@ -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;
}
}
}

View File

@ -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
}
}
}

View File

@ -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 <key> [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

View File

@ -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])<<palshift[1]) | ((b&palmask[2])<<palshift[2])]
//#define FindPallete(r,g,b) (pal777to8[r>>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<<rs;
palshift[1] = 1<<gs;
palshift[2] = 1<<bs;
size = palshift[0]*palshift[1]*palshift[2];
gshift = rs;
bshift = rs+gs;
rs = 8-rs;
gs = 8-gs;
bs = 8-bs;
rstep = 1<<rs;
gstep = 1<<gs;
bstep = 1<<bs;
palmask[0] = 0xff ^ (rstep - 1);
palmask[1] = 0xff ^ (gstep - 1);
palmask[2] = 0xff ^ (bstep - 1);
palxxxto8 = Hunk_AllocName(size, "RGB data");
if (!palxxxto8)
BZ_Free(palxxxto8);
palxxxto8 = NULL;
temp = BZ_Malloc(size);
COM_FOpenFile (filename, &f);
if (f)
{
fread(temp, 1, size, f); //cached
fclose(f);
palxxxto8 = temp;
// update shifts
palshift[0] = rs;
palshift[1] = (8 - palshift[0]) - gs;
palshift[2] = palshift[1] + (8 - bs);
return;
}
rstep >>= 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<<gshift)+(b<<bshift)] = GetPalette((r<<rs)+rstep, (g<<gs)+gstep, (b<<bs)+bstep);
}
palxxxto8 = temp;
// update shifts
palshift[0] = rs;
palshift[1] = (8 - palshift[0]) - gs;
palshift[2] = palshift[1] + (8 - bs);
if (r_palconvwrite.value)
COM_WriteFile(filename, palxxxto8, size);
}
#endif
@ -916,7 +772,6 @@ char *Media_NextTrack(void)
///temporary residence for media handling
#include "roq.h"
int filmtexture;
roq_info *roqfilm;
sfxcache_t *moviesoundbuffer;
@ -1076,9 +931,6 @@ qboolean Media_PlayFilm(char *name)
if (key_dest != key_console)
scr_con_current=0;
media_filmtype = MFT_STATIC;
#ifndef RGLQUAKE
MakeVideoPalette();
#endif
return true;
}
if (dot && (!strcmp(dot, ".cin")))
@ -1093,9 +945,6 @@ qboolean Media_PlayFilm(char *name)
if (key_dest != key_console)
scr_con_current=0;
media_filmtype = MFT_ROQ;
#ifndef RGLQUAKE
MakeVideoPalette();
#endif
return true;
}
#ifdef WINAVI
@ -1210,8 +1059,6 @@ soundpos=0;
scr_con_current=0;
media_filmtype = MFT_AVI;
MakeVideoPalette();
return true;
}
#endif
@ -1220,430 +1067,6 @@ soundpos=0;
return false;
}
void Media_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette) //bgrandupsidedown is hackily done. It should be a temporary buffer that also indicates stuff.
{
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
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);
}
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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = FindPallete(src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth; x++) //sw 32 bit rendering is bgrx
{
dest[x] = (((src[(f>>16)*4]*(1<<redbits))/256)<<redshift) + (((src[(f>>16)*4+1]*(1<<greenbits))/256)<<greenshift) + (((src[(f>>16)*4+2]*(1<<bluebits))/256)<<blueshift);
f += fstep;
}
}
}
}
else if (r_pixbytes == 4)
{
qbyte *dest, *src;
int lines=vid.conheight;
int v;
int f, fstep;
dest = vid.conbuffer;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes*4)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth*4 ; x+=4) //sw 32 bit rendering is bgrx
{
dest[x] = src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (lines - y)*inheight/vid.conheight;
src = framedata + v*inwidth*3;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = FindPallete(src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = FindPallete(src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (lines - y)*inheight/vid.conheight;
src = framedata + v*inwidth*3;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth; x++) //sw 32 bit rendering is bgrx
{
dest[x] = (((src[(f>>16)*3+2]*(1<<redbits))/256)<<redshift) + (((src[(f>>16)*3+1]*(1<<greenbits))/256)<<greenshift) + (((src[(f>>16)*3+0]*(1<<bluebits))/256)<<blueshift);
f += fstep;
}
}
}
}
else
{
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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth; x++) //sw 32 bit rendering is bgrx
{
dest[x] = (((src[(f>>16)*4]*(1<<redbits))/256)<<redshift) + (((src[(f>>16)*4+1]*(1<<greenbits))/256)<<greenshift) + (((src[(f>>16)*4+2]*(1<<bluebits))/256)<<blueshift);
f += fstep;
}
}
}
}
}
else if (r_pixbytes == 4)
{
if (bgrandupsidedown)
{
unsigned int *dest;
qbyte *src;
int lines=vid.conheight;
int v;
int f, fstep;
dest = (unsigned int *)vid.conbuffer;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes)
{
v = (lines - y)*inheight/vid.conheight;
src = framedata + v*inwidth*3;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x++) //sw 32 bit rendering is bgrx
{
*(dest+x) = *(int *)(src + (f>>16)*3);
f += fstep;
}
}
}
}
else
{
qbyte *dest, *src;
int lines=vid.conheight;
int v;
int f, fstep;
dest = vid.conbuffer;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes*4)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth*4 ; x+=4) //sw 32 bit rendering is bgrx
{
dest[x] = src[(f>>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)

View File

@ -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);

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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)
{

View File

@ -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 <text>: 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

View File

@ -1,6 +1,8 @@
#include "quakedef.h"
#ifdef RGLQUAKE
#include "glquake.h" //overkill
#endif
#ifndef _WIN32
#include <unistd.h>

View File

@ -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
/*

View File

@ -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;

View File

@ -33,10 +33,11 @@
#ifdef ZQUAKETEAMPLAY
#include "quakedef.h"
#include "version.h"
//#include "version.h"
#include "sound.h"
//#include "pmove.h"
#include <time.h>
#include <ctype.h>
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 <text>: 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

View File

@ -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 = &macro_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, &macro_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

View File

@ -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;

View File

@ -21,12 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ctype.h>
#ifdef SERVERONLY
#include "qwsvdef.h"
#else
#include "quakedef.h"
#endif

View File

@ -1,5 +1,7 @@
#include "quakedef.h"
#ifdef RGLQUAKE
#include "glquake.h"
#endif
#define MAX_Q3MAP_INDICES 0x80000
#define MAX_Q3MAP_VERTEXES 0x80000

View File

@ -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)

View File

@ -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
//

View File

@ -171,4 +171,4 @@ typedef enum {
UI_GETVIDINFO = 504,
UI_GET_STRING = 510,
} ui_builtinnum_t;
} ui_builtinnum_t;

View File

@ -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

View File

@ -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"

View File

@ -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;
}

View File

@ -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);
}
//====================================================================
/*

View File

@ -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).

View File

@ -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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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]));
}

View File

@ -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();

View File

@ -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);

View File

@ -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"

View File

@ -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];

View File

@ -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')

View File

@ -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;

View File

@ -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 ; i<maxedicts; i++)
{
(struct edict_s *)e = prinst->edicttable[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 ; i<inst->maxedicts; 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)

View File

@ -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**)&current_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**)&current_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**)&current_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
}

View File

@ -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;

View File

@ -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))

View File

@ -1,6 +1,7 @@
// cmdlib.c
#include "qcc.h"
#include <ctype.h>
//#include <sys/time.h>
#define PATHSEPERATOR '/'

View File

@ -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();
}

View File

@ -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);
}

View File

@ -1019,9 +1019,9 @@ strofs = (strofs+3)&~3;
for (i=0 ; i<numtypeinfos ; i++)
{
if (qcc_typeinfo[i].aux_type)
(unsigned int)qcc_typeinfo[i].aux_type = qcc_typeinfo[i].aux_type - qcc_typeinfo;
qcc_typeinfo[i].aux_type = (QCC_type_t*)(qcc_typeinfo[i].aux_type - qcc_typeinfo);
if (qcc_typeinfo[i].next)
(unsigned int)qcc_typeinfo[i].next = qcc_typeinfo[i].next - qcc_typeinfo;
qcc_typeinfo[i].next = (QCC_type_t*)(qcc_typeinfo[i].next - qcc_typeinfo);
qcc_typeinfo[i].name = (char *)QCC_CopyDupBackString(qcc_typeinfo[i].name);
}
@ -2182,13 +2182,13 @@ void QCC_PR_CommandLinePrecompilerOptions (void)
//optimisations.
else if ( !strnicmp(myargv[i], "-O", 2) || !strnicmp(myargv[i], "/O", 2) )
{
p = 0;
if (myargv[i][2] >= '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++)

View File

@ -976,4 +976,4 @@ pbool Decompile(progfuncs_t *progfuncs, char *fname)
}
#endif
#endif
#endif

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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
};

View File

@ -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));

View File

@ -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

View File

@ -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));

View File

@ -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);

View File

@ -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

View File

@ -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)];

View File

@ -433,4 +433,4 @@ CLVS_socket=0;
}
#endif
#endif
#endif

View File

@ -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

View File

@ -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])<<palshift[1]) | ((b&palmask[2])<<palshift[2])]
//#define FindPallete(r,g,b) (pal777to8[r>>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<<rs;
palshift[1] = 1<<gs;
palshift[2] = 1<<bs;
size = palshift[0]*palshift[1]*palshift[2];
gshift = rs;
bshift = rs+gs;
rs = 8-rs;
gs = 8-gs;
bs = 8-bs;
rstep = 1<<rs;
gstep = 1<<gs;
bstep = 1<<bs;
palmask[0] = 0xff ^ (rstep - 1);
palmask[1] = 0xff ^ (gstep - 1);
palmask[2] = 0xff ^ (bstep - 1);
palxxxto8 = Hunk_AllocName(size, "RGB data");
if (!palxxxto8)
BZ_Free(palxxxto8);
palxxxto8 = NULL;
temp = BZ_Malloc(size);
COM_FOpenFile (filename, &f);
if (f)
{
fread(temp, 1, size, f); //cached
fclose(f);
palxxxto8 = temp;
// update shifts
palshift[0] = rs;
palshift[1] = (8 - palshift[0]) - gs;
palshift[2] = palshift[1] + (8 - bs);
return;
}
rstep >>= 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<<gshift)+(b<<bshift)] = GetPalette((r<<rs)+rstep, (g<<gs)+gstep, (b<<bs)+bstep);
}
palxxxto8 = temp;
// update shifts
palshift[0] = rs;
palshift[1] = (8 - palshift[0]) - gs;
palshift[2] = palshift[1] + (8 - bs);
if (r_palconvwrite.value)
COM_WriteFile(filename, palxxxto8, size);
}
void MediaSW_ShowFrame8bit(qbyte *framedata, int inwidth, int inheight, qbyte *palette)
{
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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = FindPallete(src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth; x++) //sw 32 bit rendering is bgrx
{
dest[x] = (((src[(f>>16)*4]*(1<<redbits))/256)<<redshift) + (((src[(f>>16)*4+1]*(1<<greenbits))/256)<<greenshift) + (((src[(f>>16)*4+2]*(1<<bluebits))/256)<<blueshift);
f += fstep;
}
}
}
}
else if (r_pixbytes == 4)
{
qbyte *dest, *src;
int lines=vid.conheight;
int v;
int f, fstep;
dest = vid.conbuffer;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes*4)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth*4 ; x+=4) //sw 32 bit rendering is bgrx
{
dest[x] = src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = FindPallete(src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth; x++) //sw 32 bit rendering is bgrx
{
dest[x] = (((src[(f>>16)*4]*(1<<redbits))/256)<<redshift) + (((src[(f>>16)*4+1]*(1<<greenbits))/256)<<greenshift) + (((src[(f>>16)*4+2]*(1<<bluebits))/256)<<blueshift);
f += fstep;
}
}
}
}
else if (r_pixbytes == 4)
{
qbyte *dest, *src;
int lines=vid.conheight;
int v;
int f, fstep;
dest = vid.conbuffer;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes*4)
{
v = (vid.conheight - lines + y)*inheight/vid.conheight;
src = framedata + v*inwidth*4;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth*4 ; x+=4) //sw 32 bit rendering is bgrx
{
dest[x] = src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (lines - y)*inheight/vid.conheight;
src = framedata + v*inwidth*3;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x+=4)
{
dest[x] = FindPallete(src[(f>>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<lines ; y++, dest += vid.conrowbytes)
{
v = (lines - y)*inheight/vid.conheight;
src = framedata + v*inwidth*3;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth; x++) //sw 32 bit rendering is bgrx
{
dest[x] = (((src[(f>>16)*3+2]*(1<<redbits))/256)<<redshift) + (((src[(f>>16)*3+1]*(1<<greenbits))/256)<<greenshift) + (((src[(f>>16)*3+0]*(1<<bluebits))/256)<<blueshift);
f += fstep;
}
}
}
}
else if (r_pixbytes == 4)
{
unsigned int *dest;
qbyte *src;
int lines=vid.conheight;
int v;
int f, fstep;
dest = (unsigned int *)vid.conbuffer;
for (y=0 ; y<lines ; y++, dest += vid.conrowbytes)
{
v = (lines - y)*inheight/vid.conheight;
src = framedata + v*inwidth*3;
{
f = 0;
fstep = ((inwidth)*0x10000)/vid.conwidth;
for (x=0 ; x<vid.conwidth ; x++) //sw 32 bit rendering is bgrx
{
*(dest+x) = *(int *)(src + (f>>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);
}

View File

@ -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;